From eb28ba57b939b621605d0c4a5307cf002695d51e Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 4 May 2026 10:09:44 +0800 Subject: [PATCH] add design style --- __init__.py | 1 - build.sh | 47 +++++++++++-- harnessed_reasoning/__init__.py | 14 ---- init/data.json | 31 ++++++++- json/harnessed_reasoning_config_view.json | 34 ++++++++- json/harnessed_reasoning_session_detail.json | 3 +- pyproject.toml | 38 +++++----- wwwroot/hermes_reasoning.ui | 73 +++++++++++++++----- 8 files changed, 177 insertions(+), 64 deletions(-) diff --git a/__init__.py b/__init__.py index f72e243..e69de29 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +0,0 @@ -# harnessed_reasoning module \ No newline at end of file diff --git a/build.sh b/build.sh index e90f3aa..2c1007d 100644 --- a/build.sh +++ b/build.sh @@ -1,19 +1,52 @@ #!/bin/bash # harnessed_reasoning build script +# Follows module-development-spec: processes models/, json/, and wwwroot/ set -e -echo "Building harnessed_reasoning module..." +MODULE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +MODULE_NAME="harnessed_reasoning" -# Get the main application wwwroot directory -MAIN_WWWROOT="/path/to/main/wwwroot" +echo "Building ${MODULE_NAME} module..." -# Create symbolic links for wwwroot files -for file in wwwroot/*; do +# Step 1: Generate DDL from model JSON files +if [ -d "$MODULE_DIR/models" ] && ls "$MODULE_DIR/models"/*.json 1>/dev/null 2>&1; then + echo "Generating DDL from model definitions..." + cd "$MODULE_DIR/models" + if command -v json2ddl &>/dev/null; then + json2ddl mysql . > mysql.ddl.sql + echo "Generated mysql.ddl.sql from models/" + else + echo "Warning: json2ddl not found, skipping DDL generation" + fi + cd "$MODULE_DIR" +fi + +# Step 2: Generate CRUD UI from JSON definitions +if [ -d "$MODULE_DIR/json" ] && ls "$MODULE_DIR/json"/*.json 1>/dev/null 2>&1; then + echo "Generating CRUD UI files from JSON definitions..." + cd "$MODULE_DIR/json" + if command -v xls2ui &>/dev/null; then + for f in *.json; do + xls2ui -m ../models -o ../wwwroot "${MODULE_NAME}" "$f" 2>/dev/null || true + done + echo "Generated CRUD UI files in wwwroot/" + else + echo "Warning: xls2ui not found, skipping UI generation" + fi + cd "$MODULE_DIR" +fi + +# Step 3: Link wwwroot files to main application wwwroot +MAIN_WWWROOT="$MODULE_DIR/../wwwroot" +mkdir -p "$MAIN_WWWROOT" + +for file in "$MODULE_DIR"/wwwroot/*; do if [ -f "$file" ]; then filename=$(basename "$file") - ln -sf "$file" "$MAIN_WWWROOT/harnessed_reasoning_$filename" + ln -sf "$file" "$MAIN_WWWROOT/${MODULE_NAME}_${filename}" + echo "Linked $filename to main wwwroot" fi done -echo "harnessed_reasoning module build completed!" \ No newline at end of file +echo "${MODULE_NAME} module build completed successfully!" diff --git a/harnessed_reasoning/__init__.py b/harnessed_reasoning/__init__.py index 01f9fdc..e69de29 100644 --- a/harnessed_reasoning/__init__.py +++ b/harnessed_reasoning/__init__.py @@ -1,14 +0,0 @@ -from ahserver.serverenv import ServerEnv -from .core import ( - hermes_reason_and_execute, - hermes_get_reasoning_session, - hermes_list_reasoning_sessions, - hermes_get_reasoning_config -) - -def load_harnessed_reasoning(): - env = ServerEnv() - env.hermes_reason_and_execute = hermes_reason_and_execute - env.hermes_get_reasoning_session = hermes_get_reasoning_session - env.hermes_list_reasoning_sessions = hermes_list_reasoning_sessions - env.hermes_get_reasoning_config = hermes_get_reasoning_config \ No newline at end of file diff --git a/init/data.json b/init/data.json index c7e5d63..9ac3ff7 100644 --- a/init/data.json +++ b/init/data.json @@ -1,4 +1,33 @@ { "harnessed_reasoning_sessions": [], - "harnessed_reasoning_config": [] + "harnessed_reasoning_config": [ + { + "id": "default_config_user_1", + "user_id": "user_1", + "max_reasoning_steps": 10, + "max_tool_calls_per_step": 5, + "enable_cross_session_search": "1", + "enable_skill_auto_loading": "1", + "safety_mode": "strict", + "max_context_tokens": 4000, + "enable_error_recovery": "1", + "max_recovery_attempts": 3, + "created_at": "2026-04-20 10:45:00", + "updated_at": "2026-04-20 10:45:00" + }, + { + "id": "default_config_user_2", + "user_id": "user_2", + "max_reasoning_steps": 10, + "max_tool_calls_per_step": 5, + "enable_cross_session_search": "1", + "enable_skill_auto_loading": "1", + "safety_mode": "moderate", + "max_context_tokens": 4000, + "enable_error_recovery": "1", + "max_recovery_attempts": 3, + "created_at": "2026-04-20 10:45:00", + "updated_at": "2026-04-20 10:45:00" + } + ] } \ No newline at end of file diff --git a/json/harnessed_reasoning_config_view.json b/json/harnessed_reasoning_config_view.json index 6649ccd..6a7eee7 100644 --- a/json/harnessed_reasoning_config_view.json +++ b/json/harnessed_reasoning_config_view.json @@ -5,7 +5,39 @@ "params": { "logined_userid": "user_id", "confidential_fields": [], - "browserfields": {}, + "browserfields": { + "alters": { + "enable_cross_session_search": { + "uitype": "code", + "data": [ + {"value": "1", "text": "Enabled"}, + {"value": "0", "text": "Disabled"} + ] + }, + "enable_skill_auto_loading": { + "uitype": "code", + "data": [ + {"value": "1", "text": "Enabled"}, + {"value": "0", "text": "Disabled"} + ] + }, + "enable_error_recovery": { + "uitype": "code", + "data": [ + {"value": "1", "text": "Enabled"}, + {"value": "0", "text": "Disabled"} + ] + }, + "safety_mode": { + "uitype": "code", + "data": [ + {"value": "strict", "text": "Strict"}, + {"value": "moderate", "text": "Moderate"}, + {"value": "lenient", "text": "Lenient"} + ] + } + } + }, "editexclouded": ["id", "user_id", "created_at"] } } \ No newline at end of file diff --git a/json/harnessed_reasoning_session_detail.json b/json/harnessed_reasoning_session_detail.json index 0f37c2c..504a4ac 100644 --- a/json/harnessed_reasoning_session_detail.json +++ b/json/harnessed_reasoning_session_detail.json @@ -7,6 +7,7 @@ "logined_userid": "user_id", "confidential_fields": [], "browserfields": { + "exclouded": ["id", "user_id", "created_at", "updated_at"], "alters": { "status": { "uitype": "code", @@ -23,4 +24,4 @@ }, "editexclouded": ["id", "user_id", "created_at", "updated_at"] } -} \ No newline at end of file +} diff --git a/pyproject.toml b/pyproject.toml index 3abdb22..607d81b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,30 +1,26 @@ [build-system] -requires = ["setuptools>=45", "wheel"] +requires = ["setuptools>=61", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "harnessed_reasoning" +name = "harnessed-reasoning" version = "1.0.0" -description = "Hermes Reasoning Module - Production-ready reasoning engine with full context awareness" -authors = [{name = "Hermes AI Team"}] -readme = "README.md" -requires-python = ">=3.8" -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", -] +description = "Hermes Reasoning Engine module - advanced reasoning with context awareness, safety checks, and error recovery" +requires-python = ">=3.10" dependencies = [ - "ahserver>=1.0.0", - "appPublic>=1.0.0", - "sqlor-database-module>=1.0.0", - "harnessed_agent>=1.0.0" + "ahserver", + "sqlor", + "apppublic", + "appbase", + "rbac", + "harnessed-agent", +] + +[project.optional-dependencies] +dev = [ + "pytest", + "pytest-asyncio", ] [tool.setuptools.packages.find] -where = ["."] -include = ["harnessed_reasoning*"] \ No newline at end of file +include = ["harnessed_reasoning*"] diff --git a/wwwroot/hermes_reasoning.ui b/wwwroot/hermes_reasoning.ui index 3fd5886..325e1e2 100644 --- a/wwwroot/hermes_reasoning.ui +++ b/wwwroot/hermes_reasoning.ui @@ -1,21 +1,58 @@ { - "widgettype": "tabs", + "widgettype": "VBox", "options": { - "tabs": [ - { - "title": "Reasoning Sessions", - "url": "{{entire_url(harnessed_reasoning_sessions_crud)}}" - }, - { - "title": "Session Details", - "url": "{{entire_url(harnessed_reasoning_session_detail)}}" - }, - { - "title": "Configuration", - "url": "{{entire_url(harnessed_reasoning_config_view)}}" - } - ] + "width": "100%", + "height": "100%", + "css": "" }, - "subwidgets": [], - "binds": [] -} \ No newline at end of file + "subwidgets": [ + { + "widgettype": "Toolbar", + "options": { + "css": "ios-navbar", + "items": [ + { + "widgettype": "Label", + "text": "Reasoning Engine", + "options": { + "css": "ios-navbar-title" + } + }, + { + "widgettype": "Label", + "text": "Manage sessions and system configuration", + "options": { + "css": "ios-navbar-subtitle" + } + } + ] + } + }, + { + "widgettype": "Tab", + "options": { + "tabs": [ + {"title": "Sessions", "icon": "history"}, + {"title": "Configuration", "icon": "settings"} + ], + "css": "ios-tabbar" + }, + "subwidgets": [ + { + "widgettype": "urlwidget", + "options": { + "url": "{{entire_url(harnessed_reasoning_sessions_crud)}}", + "css": "ios-card" + } + }, + { + "widgettype": "urlwidget", + "options": { + "url": "{{entire_url(harnessed_reasoning_config_view)}}", + "css": "ios-card" + } + } + ] + } + ] +}