From fc66563579b822dd0e1f2d2c44746224c6a72880 Mon Sep 17 00:00:00 2001 From: ada-97bec15779 Date: Sun, 11 Oct 2026 15:10:49 +0800 Subject: [PATCH 1/3] Add versioned vector retrieval and guarded multi-agent workflows --- .github/workflows/ci.yml | 7 + packages/dsh-triton-riscv/README.md | 3 +- .../dsh-triton-riscv/frontend/src/App.tsx | 274 +++++---- .../frontend/src/WorkflowPanel.test.tsx | 163 ++++++ .../frontend/src/WorkflowPanel.tsx | 447 +++++++++++++++ .../dsh-triton-riscv/frontend/src/styles.css | 176 ++++++ .../frontend/src/workflow-api.ts | 76 +++ packages/dsh-triton-riscv/lib/config.js | 56 +- .../dsh-triton-riscv/lib/native-adapter.js | 13 +- packages/dsh-triton-riscv/package.json | 1 + .../python/codex_agent/README.md | 155 +++++ .../python/codex_agent/diagnostic_memory.py | 18 + .../python/codex_agent/embeddings.py | 23 +- .../python/codex_agent/failure_diagnosis.py | 8 +- .../python/codex_agent/harness/cordis.yml | 27 +- .../python/codex_agent/harness/mcp_server.py | 20 +- .../python/codex_agent/harness/runtime.py | 6 +- .../python/codex_agent/indexing/__init__.py | 1 + .../python/codex_agent/indexing/__main__.py | 69 +++ .../python/codex_agent/indexing/cleanup.py | 24 + .../python/codex_agent/indexing/qdrant.py | 82 +++ .../python/codex_agent/indexing/retrieval.py | 160 ++++++ .../python/codex_agent/indexing/store.py | 231 ++++++++ .../python/codex_agent/indexing/worker.py | 140 +++++ .../python/codex_agent/memory.py | 118 +++- .../python/codex_agent/memory_api.py | 29 +- .../python/codex_agent/memory_chunking.py | 46 +- .../python/codex_agent/memory_context.py | 36 +- .../python/codex_agent/memory_expansion.py | 187 ++++++ .../python/codex_agent/memory_lineage.py | 84 +++ .../python/codex_agent/memory_view.py | 37 +- .../python/codex_agent/messaging/broker.py | 6 +- .../codex_agent/orchestration/__init__.py | 1 + .../python/codex_agent/orchestration/api.py | 76 +++ .../codex_agent/orchestration/coordinator.py | 263 +++++++++ .../codex_agent/orchestration/evidence.py | 24 + .../codex_agent/orchestration/lifecycle.py | 350 ++++++++++++ .../codex_agent/orchestration/models.py | 69 +++ .../codex_agent/orchestration/prompts.py | 91 +++ .../codex_agent/orchestration/retrieval.py | 26 + .../codex_agent/orchestration/role-policy.mjs | 22 + .../python/codex_agent/orchestration/roles.py | 191 +++++++ .../codex_agent/orchestration/runtime.py | 95 ++++ .../codex_agent/orchestration/schema.py | 39 ++ .../codex_agent/orchestration/service.py | 144 +++++ .../python/codex_agent/orchestration/store.py | 278 +++++++++ .../python/codex_agent/platform/api.py | 2 + .../python/codex_agent/platform/store.py | 7 +- .../python/codex_agent/process_control.py | 1 + .../python/codex_agent/runtime_config.py | 39 +- .../versions/0003_memory_lineage.py | 44 ++ .../versions/0004_memory_indexes.py | 33 ++ .../versions/0005_operator_workflows.py | 51 ++ .../python/codex_agent/storage/schema.py | 38 +- .../python/codex_agent/tasks/service.py | 9 +- .../python/codex_agent/tasks/store.py | 40 +- .../codex_agent/tests/test_agent_roles.py | 365 ++++++++++++ .../tests/test_failure_diagnosis.py | 19 + .../python/codex_agent/tests/test_harness.py | 45 ++ .../codex_agent/tests/test_index_backfill.py | 150 +++++ .../codex_agent/tests/test_mcp_tools.py | 62 ++ .../tests/test_memory_expansion.py | 241 ++++++++ .../codex_agent/tests/test_memory_indexing.py | 533 ++++++++++++++++++ .../codex_agent/tests/test_memory_lineage.py | 293 ++++++++++ .../codex_agent/tests/test_mysql_storage.py | 3 + .../codex_agent/tests/test_orchestration.py | 445 +++++++++++++++ .../tests/test_orchestration_integration.py | 259 +++++++++ .../tests/test_orchestration_lifecycle.py | 408 ++++++++++++++ .../tests/test_orchestration_worker.py | 424 ++++++++++++++ .../tests/test_vector_retrieval.py | 264 +++++++++ .../python/codex_agent/workers/__main__.py | 9 +- .../python/codex_agent/workers/consumer.py | 11 +- .../python/codex_agent/workers/handlers.py | 38 +- .../dsh-triton-riscv/python/pyproject.toml | 3 +- .../scripts/check-package.mjs | 10 + .../scripts/local-environment.mjs | 26 + .../tests/integration/frontend.spec.ts | 18 + .../tests/native-host.spec.ts | 270 +++++++-- .../tests/unit/inputs.spec.ts | 32 ++ .../tests/unit/local-environment.spec.ts | 36 ++ .../tests/unit/native-adapter.spec.ts | 51 ++ .../tests/unit/role-policy.spec.ts | 73 +++ 82 files changed, 8484 insertions(+), 260 deletions(-) create mode 100644 packages/dsh-triton-riscv/frontend/src/WorkflowPanel.test.tsx create mode 100644 packages/dsh-triton-riscv/frontend/src/WorkflowPanel.tsx create mode 100644 packages/dsh-triton-riscv/frontend/src/workflow-api.ts create mode 100644 packages/dsh-triton-riscv/python/codex_agent/indexing/__init__.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/indexing/__main__.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/indexing/cleanup.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/indexing/qdrant.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/indexing/retrieval.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/indexing/store.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/indexing/worker.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/memory_expansion.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/memory_lineage.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/__init__.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/api.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/coordinator.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/evidence.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/lifecycle.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/models.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/prompts.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/retrieval.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/role-policy.mjs create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/roles.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/runtime.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/schema.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/service.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/orchestration/store.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/storage/migrations/versions/0003_memory_lineage.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/storage/migrations/versions/0004_memory_indexes.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/storage/migrations/versions/0005_operator_workflows.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_agent_roles.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_index_backfill.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_memory_expansion.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_memory_indexing.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_memory_lineage.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_orchestration.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_orchestration_integration.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_orchestration_lifecycle.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_orchestration_worker.py create mode 100644 packages/dsh-triton-riscv/python/codex_agent/tests/test_vector_retrieval.py create mode 100644 packages/dsh-triton-riscv/tests/integration/frontend.spec.ts create mode 100644 packages/dsh-triton-riscv/tests/unit/role-policy.spec.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a4969f..16a59f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,6 +73,12 @@ jobs: options: >- --health-cmd="rabbitmq-diagnostics -q ping" --health-interval=10s --health-timeout=5s --health-retries=12 + qdrant: + image: qdrant/qdrant:v1.19.2 + env: + QDRANT__TELEMETRY_DISABLED: 'true' + ports: + - 6333/tcp steps: - name: Checkout harness uses: actions/checkout@v4 @@ -124,4 +130,5 @@ jobs: TRITON_MYSQL_URL: mysql+pymysql://root:ci-only-password@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/triton_agent_test TRITON_TEST_REDIS_URL: redis://127.0.0.1:${{ job.services.redis.ports['6379'] }}/0 TRITON_TEST_AMQP_URL: amqp://ci:ci-only-password@127.0.0.1:${{ job.services.rabbitmq.ports['5672'] }}/ + TRITON_TEST_QDRANT_URL: http://127.0.0.1:${{ job.services.qdrant.ports['6333'] }} run: pnpm test:all --reporter=verbose diff --git a/packages/dsh-triton-riscv/README.md b/packages/dsh-triton-riscv/README.md index a11f2bc..c81d748 100644 --- a/packages/dsh-triton-riscv/README.md +++ b/packages/dsh-triton-riscv/README.md @@ -94,13 +94,14 @@ See [backend options](python/codex_agent/README.md#redis-options). ### Development Tests -Vitest drives JavaScript, Python and native-host integration tests. After setup, +Vitest drives JavaScript, existing Python regressions, frontend and native-host integration tests. After setup, from the plugin directory, configure **disposable** services (never production): ```sh export TRITON_MYSQL_URL='mysql+pymysql://USER:PASSWORD@127.0.0.1:3306/triton_agent_test' export TRITON_TEST_REDIS_URL='redis://127.0.0.1:6379/0' export TRITON_TEST_AMQP_URL='amqp://guest:guest@127.0.0.1:5672/' +export TRITON_TEST_QDRANT_URL='http://127.0.0.1:6333' .venv/bin/python -I -m codex_agent.storage upgrade npm test ``` diff --git a/packages/dsh-triton-riscv/frontend/src/App.tsx b/packages/dsh-triton-riscv/frontend/src/App.tsx index 896e2d8..cbf3e6c 100644 --- a/packages/dsh-triton-riscv/frontend/src/App.tsx +++ b/packages/dsh-triton-riscv/frontend/src/App.tsx @@ -1,6 +1,22 @@ -import { Bot, Check, Menu, PanelRight, Pin, PinOff, Play, Plus, Send, Trash2, UserRound, X } from 'lucide-react' +import { + Bot, + Check, + GitBranch, + Menu, + PanelRight, + Pin, + PinOff, + Play, + Plus, + Send, + Trash2, + UserRound, + X, +} from 'lucide-react' import { FormEvent, KeyboardEvent, useEffect, useRef, useState } from 'react' import { api } from './api' +import { WorkflowPanel } from './WorkflowPanel' +import { workflowApi } from './workflow-api' import { MessageText, shortDate } from './format' import type { Bootstrap, Run, RunEvent, ProposalReview, Session, SessionBundle, ValidationPlanReview } from './types' @@ -288,6 +304,8 @@ function CommandApproval({ export default function App() { const [bootstrap, setBootstrap] = useState(null) const [sessions, setSessions] = useState([]) + const [workflowEnabled, setWorkflowEnabled] = useState(false) + const [mode, setMode] = useState<'chat' | 'workflow'>('chat') const [activeSessionId, setActiveSessionId] = useState(null) const [bundle, setBundle] = useState(null) const [activeRun, setActiveRun] = useState(null) @@ -413,6 +431,12 @@ export default function App() { useEffect(() => { let cancelled = false + void workflowApi + .config() + .then(config => { + if (!cancelled) setWorkflowEnabled(config.enabled) + }) + .catch(() => {}) const start = async () => { try { const [initialBootstrap, initialSessions] = await Promise.all([api.bootstrap(), api.listSessions()]) @@ -651,17 +675,37 @@ export default function App() {

{bundle?.session.title || '新对话'}

- DeepSeek Harness - +
+ + +
+ {mode === 'chat' && ( + + )}
{error && ( @@ -672,115 +716,121 @@ export default function App() { )} -
- {!bundle?.messages.length ? ( - - ) : ( - bundle.messages.map(message => { - return ( -
- {message.role === 'assistant' && ( -
- -
- )} + {mode === 'workflow' && activeSessionId ? ( + + ) : ( + <> +
+ {!bundle?.messages.length ? ( + + ) : ( + bundle.messages.map(message => { + return ( +
+ {message.role === 'assistant' && ( +
+ +
+ )} +
+
+ +
+
+ {message.role === 'user' && ( +
+ +
+ )} +
+ ) + }) + )} + {streamingText && ( +
+
+ +
- + +
- {message.role === 'user' && ( -
- +
+ )} + {agentWorking && !streamingText && ( +
+
+ +
+
+ - )} +
- ) - }) - )} - {streamingText && ( -
-
- -
-
-
- -
-
-
- )} - {agentWorking && !streamingText && ( -
-
- -
-
- + )} +
+
+ {approvalEvents.length > 0 && ( +
+ {approvalEvents.map(event => + event.payload.validation_run_id ? ( + + ) : ( + + ), + )}
-
- )} -
-
- {approvalEvents.length > 0 && ( -
- {approvalEvents.map(event => - event.payload.validation_run_id ? ( - - ) : ( - - ), )} -
+
+ {bootstrap?.suggestions.map(suggestion => ( + + ))} +
+
+