carthagent 0.0.0-stage → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +219 -2
- package/bin/ctg.mjs +736 -0
- package/docs/budgets.md +72 -0
- package/docs/compaction.md +34 -0
- package/docs/context-efficiency-plan.md +24 -0
- package/docs/context-efficiency-review.md +27 -0
- package/docs/context-efficiency.md +49 -0
- package/docs/deepseek-jev-benchmark-plan.md +70 -0
- package/docs/deepseek-jev-benchmark-repair-plan.md +20 -0
- package/docs/deepseek-jev-benchmark-restart.md +9 -0
- package/docs/deepseek-jev-benchmark-results.md +77 -0
- package/docs/deepseek-jev-benchmark-running.md +60 -0
- package/docs/deepseek-jev-benchmark-v3-results.md +41 -0
- package/docs/deepseek-jev-benchmark-v4-protocol.md +15 -0
- package/docs/deepseek-jev-benchmark-v4-results.md +119 -0
- package/docs/deepseek-jev-http400-diagnosis.md +45 -0
- package/docs/delivery-review-evidence.md +53 -0
- package/docs/delivery-timeout-repair-plan.md +51 -0
- package/docs/evaluation-readiness.md +31 -0
- package/docs/evaluation.md +70 -0
- package/docs/extending.md +354 -0
- package/docs/glm-pilot-execution.md +9 -0
- package/docs/glm-pilot-plan.md +15 -0
- package/docs/glm-pilot-results.md +71 -0
- package/docs/graph-context-optimization.md +15 -0
- package/docs/jev-repository-pilot-plan.md +25 -0
- package/docs/jev-repository-pilot-protocol.md +39 -0
- package/docs/jev-repository-pilot-restart.md +7 -0
- package/docs/jev-repository-pilot-results.md +79 -0
- package/docs/jev.md +32 -0
- package/docs/model-registry.md +25 -0
- package/docs/native-compatibility.md +117 -0
- package/docs/opencode-archive.md +9 -0
- package/docs/opencode-migration.md +115 -0
- package/docs/opencode-runtime.md +94 -0
- package/docs/opencode-workspace.md +31 -0
- package/docs/owned-runtime-workflow-registration.md +17 -0
- package/docs/plan-advisor-evaluation.md +38 -0
- package/docs/planning-startup-fix-plan.md +23 -0
- package/docs/planning-startup-fix-review.md +24 -0
- package/docs/planning.md +118 -0
- package/docs/production-merge-review.md +23 -0
- package/docs/quality.md +35 -0
- package/docs/repository-benchmark-design.md +111 -0
- package/docs/review-assurance.md +9 -0
- package/docs/review-experiment-results.md +59 -0
- package/docs/tested-planning-roadmap.md +58 -0
- package/docs/tested-planning.md +58 -0
- package/docs/tui-pickers.md +9 -0
- package/docs/webdriver.md +83 -0
- package/docs/workflow-modes.md +26 -0
- package/docs/workflow.d2 +17 -0
- package/docs/workflow.svg +149 -0
- package/docs/workspace-coordination.md +9 -0
- package/evaluate.mjs +249 -0
- package/extensions/codegraph.ts +36 -0
- package/extensions/delivery.ts +819 -0
- package/extensions/experiential.ts +21 -0
- package/extensions/subscriptions.ts +21 -0
- package/guidance/profiles/authenticated-web.json +24 -0
- package/guidance/profiles/data-visualization.json +25 -0
- package/guidance/profiles/database-change.json +24 -0
- package/guidance/profiles/external-api.json +24 -0
- package/guidance/profiles/transactional-data.json +25 -0
- package/guidance/profiles/web-application.json +26 -0
- package/lib/acceptance-review.mjs +4 -0
- package/lib/browser-bin.mjs +160 -0
- package/lib/browser-errors.mjs +54 -0
- package/lib/browser.mjs +219 -0
- package/lib/budget.mjs +37 -0
- package/lib/cdp.mjs +221 -0
- package/lib/cloud/client.mjs +275 -0
- package/lib/cloud/control-plane.mjs +350 -0
- package/lib/cloud/gateway.mjs +380 -0
- package/lib/cloud/http.mjs +135 -0
- package/lib/cloud/ledger.mjs +215 -0
- package/lib/codegraph-query.mjs +60 -0
- package/lib/codegraph.mjs +378 -0
- package/lib/context-archive.mjs +18 -0
- package/lib/delivery-context.mjs +132 -0
- package/lib/delivery-guidance.mjs +9 -0
- package/lib/delivery-review.mjs +94 -0
- package/lib/delivery.mjs +610 -0
- package/lib/engine.mjs +137 -0
- package/lib/guidance.mjs +71 -0
- package/lib/jev-advisor.mjs +47 -0
- package/lib/opencode/archive.mjs +122 -0
- package/lib/opencode/compatibility.mjs +19 -0
- package/lib/opencode/credentials.mjs +205 -0
- package/lib/opencode/evaluation-budget-plugin/index.ts +147 -0
- package/lib/opencode/evaluation.mjs +242 -0
- package/lib/opencode/file-lock.mjs +86 -0
- package/lib/opencode/headless.mjs +200 -0
- package/lib/opencode/review.mjs +213 -0
- package/lib/opencode/runtime.mjs +246 -0
- package/lib/opencode/service.mjs +249 -0
- package/lib/opencode/session-options.mjs +60 -0
- package/lib/opencode/workspace.mjs +133 -0
- package/lib/openrouter-jev.mjs +37 -0
- package/lib/outcome-contract.mjs +21 -0
- package/lib/plan-advisor.mjs +38 -0
- package/lib/planning-access.mjs +7 -0
- package/lib/planning-advice.mjs +28 -0
- package/lib/planning-discovery.mjs +14 -0
- package/lib/planning-guide.mjs +34 -0
- package/lib/planning-view.mjs +57 -0
- package/lib/planning.mjs +155 -0
- package/lib/probe-diagnostics.mjs +13 -0
- package/lib/providers/experiential.mjs +292 -0
- package/lib/providers/model-catalog.json +700 -0
- package/lib/providers/model-catalog.mjs +7 -0
- package/lib/providers/names.mjs +13 -0
- package/lib/providers/subscription-models.mjs +483 -0
- package/lib/reports.mjs +80 -0
- package/lib/review-state.mjs +49 -0
- package/lib/review.mjs +114 -0
- package/lib/scenarios.mjs +99 -0
- package/lib/ship-auth.mjs +44 -0
- package/lib/ship-jev.mjs +59 -0
- package/lib/ship-telemetry.mjs +183 -0
- package/lib/tui/ansi.mjs +255 -0
- package/lib/tui/app.mjs +2445 -0
- package/lib/tui/auth.mjs +249 -0
- package/lib/tui/carthage.mjs +109 -0
- package/lib/tui/clipboard.mjs +122 -0
- package/lib/tui/d2.mjs +431 -0
- package/lib/tui/feed.mjs +467 -0
- package/lib/tui/framing.mjs +80 -0
- package/lib/tui/glyphs.mjs +172 -0
- package/lib/tui/hash-worker.mjs +11 -0
- package/lib/tui/mock-engine.mjs +222 -0
- package/lib/tui/models.mjs +73 -0
- package/lib/tui/picker.mjs +18 -0
- package/lib/tui/theme.mjs +663 -0
- package/lib/tui/title.mjs +7 -0
- package/lib/update-channel.mjs +62 -0
- package/lib/update.mjs +230 -0
- package/lib/webdriver.mjs +82 -0
- package/lib/workflow.mjs +88 -0
- package/lib/workspace.mjs +39 -0
- package/metadata.json +8 -0
- package/package.json +94 -4
- package/plugins/carthagent/index.ts +3 -0
- package/plugins/carthagent/package.json +28 -0
- package/plugins/carthagent/src/archive-rpc.ts +46 -0
- package/plugins/carthagent/src/bootstrap.ts +38 -0
- package/plugins/carthagent/src/index.ts +62 -0
- package/plugins/carthagent/src/pull-request-rpc.ts +54 -0
- package/plugins/carthagent/src/rpc.ts +76 -0
- package/plugins/carthagent/src/server/archive-rpc.ts +327 -0
- package/plugins/carthagent/src/server/budgets.ts +21 -0
- package/plugins/carthagent/src/server/codegraph.ts +46 -0
- package/plugins/carthagent/src/server/delivery.ts +488 -0
- package/plugins/carthagent/src/server/device-auth.ts +91 -0
- package/plugins/carthagent/src/server/native-delivery.ts +26 -0
- package/plugins/carthagent/src/server/orchestration.ts +56 -0
- package/plugins/carthagent/src/server/policy.ts +24 -0
- package/plugins/carthagent/src/server/providers.ts +424 -0
- package/plugins/carthagent/src/server/pull-request-rpc.ts +387 -0
- package/plugins/carthagent/src/server/session-controls.ts +82 -0
- package/plugins/carthagent/src/server/telemetry.ts +92 -0
- package/plugins/carthagent/src/server/workspace-rpc.ts +349 -0
- package/plugins/carthagent/src/session-rpc.ts +31 -0
- package/plugins/carthagent/src/testing.ts +85 -0
- package/plugins/carthagent/src/workspace-rpc.ts +133 -0
- package/plugins/carthagent/test-plugin/index.ts +4 -0
- package/plugins/carthagent/test-plugin/package.json +1 -0
- package/plugins/carthagent/tsconfig.json +19 -0
- package/plugins/carthagent/tui.ts +1 -0
- package/prompts/delivery.md +7 -0
- package/public/index.html +983 -0
- package/scenarios/cli/grade_cli.py +69 -0
- package/scenarios/cli/scenario.json +21 -0
- package/scenarios/game/baseline/minecraft.py +193 -0
- package/scenarios/game/context.md +1 -0
- package/scenarios/game/grade_minecraft_clone.py +603 -0
- package/scenarios/game/requirements.txt +2 -0
- package/scenarios/game/scenario.json +33 -0
- package/server.mjs +341 -0
- package/skills/game-development/SKILL.md +36 -0
- package/skills/game-development/assets/ursina_starter.py +98 -0
- package/skills/game-development/scripts/verify_ursina.py +80 -0
- package/skills/software-delivery/SKILL.md +50 -0
- package/skills/typescript-delivery/SKILL.md +69 -0
- package/tests/acceptance-review.test.mjs +13 -0
- package/tests/auth.test.mjs +234 -0
- package/tests/bounded-summary.test.mjs +68 -0
- package/tests/browser-bin.test.mjs +91 -0
- package/tests/browser.test.mjs +96 -0
- package/tests/budget-engine.test.mjs +110 -0
- package/tests/budget.test.mjs +23 -0
- package/tests/cli.test.mjs +245 -0
- package/tests/clipboard.test.mjs +79 -0
- package/tests/cloud-client.test.mjs +129 -0
- package/tests/cloud-control-plane.test.mjs +144 -0
- package/tests/cloud-gateway.test.mjs +147 -0
- package/tests/cloud-http.test.mjs +102 -0
- package/tests/cloud-ledger.test.mjs +75 -0
- package/tests/codegraph-query.test.mjs +66 -0
- package/tests/codegraph.test.mjs +142 -0
- package/tests/delivery-context.test.mjs +66 -0
- package/tests/delivery-review.test.mjs +139 -0
- package/tests/delivery.test.mjs +343 -0
- package/tests/engine-api.mjs +24 -0
- package/tests/experiential-extension.test.mjs +37 -0
- package/tests/experiential.test.mjs +300 -0
- package/tests/extension.test.mjs +921 -0
- package/tests/fixtures/archive-plugin/index.ts +10 -0
- package/tests/guidance.test.mjs +78 -0
- package/tests/model-registry.test.mjs +68 -0
- package/tests/models.test.mjs +70 -0
- package/tests/openai-idempotency.test.mjs +99 -0
- package/tests/opencode-archive-rpc.test.mjs +82 -0
- package/tests/opencode-delivery.test.mjs +231 -0
- package/tests/opencode-providers.test.mjs +414 -0
- package/tests/opencode-runtime.test.mjs +455 -0
- package/tests/opencode-session-controls.test.mjs +115 -0
- package/tests/opencode-session-options.test.mjs +26 -0
- package/tests/opencode-workspace.test.mjs +339 -0
- package/tests/outcome-contract.test.mjs +17 -0
- package/tests/picker.test.mjs +34 -0
- package/tests/plan-advisor.test.mjs +88 -0
- package/tests/plan-review-loop.test.mjs +53 -0
- package/tests/planning-advice.test.mjs +27 -0
- package/tests/planning-contract.test.mjs +65 -0
- package/tests/planning-startup.test.mjs +38 -0
- package/tests/planning-view.test.mjs +33 -0
- package/tests/planning.test.mjs +223 -0
- package/tests/probe-diagnostics.test.mjs +21 -0
- package/tests/pull-request-rpc.test.mjs +366 -0
- package/tests/review-state.test.mjs +32 -0
- package/tests/review.test.mjs +127 -0
- package/tests/server.test.mjs +252 -0
- package/tests/ship-jev.test.mjs +77 -0
- package/tests/ship-telemetry.test.mjs +333 -0
- package/tests/standard-workflow.test.mjs +28 -0
- package/tests/subscription-models.test.mjs +416 -0
- package/tests/subscriptions-extension.test.mjs +27 -0
- package/tests/terminal-title.test.mjs +13 -0
- package/tests/test_grade_minecraft_clone.py +199 -0
- package/tests/test_starter.py +78 -0
- package/tests/theme.test.mjs +175 -0
- package/tests/tui-copy-paste.test.mjs +54 -0
- package/tests/tui.test.mjs +808 -0
- package/tests/update-channels.test.mjs +129 -0
- package/tests/update.test.mjs +175 -0
- package/tests/webdriver.test.mjs +31 -0
- package/tests/workflow.test.mjs +47 -0
- package/tests/workspace-rpc.test.mjs +236 -0
- package/tests/workspace.test.mjs +24 -0
- package/tools/benchmark/advisor.test.mjs +7 -0
- package/tools/benchmark/advisor.ts +27 -0
- package/tools/benchmark/campaign.mjs +45 -0
- package/tools/benchmark/diagnose-request.mjs +40 -0
- package/tools/benchmark/eval-common.mjs +32 -0
- package/tools/benchmark/eval-ledger.mjs +22 -0
- package/tools/benchmark/eval-shop.mjs +26 -0
- package/tools/benchmark/eval-voxel.mjs +20 -0
- package/tools/benchmark/evaluate.mjs +24 -0
- package/tools/benchmark/evaluators.test.mjs +13 -0
- package/tools/benchmark/fixtures/shop/server.mjs +18 -0
- package/tools/benchmark/fixtures/shop/ui.html +8 -0
- package/tools/benchmark/freeze.mjs +30 -0
- package/tools/benchmark/gateway.mjs +91 -0
- package/tools/benchmark/gateway.test.mjs +38 -0
- package/tools/benchmark/generator.mjs +11 -0
- package/tools/benchmark/generator.test.mjs +26 -0
- package/tools/benchmark/guard.test.mjs +133 -0
- package/tools/benchmark/guard.ts +136 -0
- package/tools/benchmark/native-plugin/index.ts +24 -0
- package/tools/benchmark/planning-startup.test.mjs +47 -0
- package/tools/benchmark/preflight-live.mjs +31 -0
- package/tools/benchmark/preflight.mjs +22 -0
- package/tools/benchmark/replay-diagnostic.mjs +23 -0
- package/tools/benchmark/runner.mjs +141 -0
- package/tools/benchmark/runner.test.mjs +93 -0
- package/tools/benchmark/runtime.mjs +23 -0
- package/tools/benchmark/selftest.mjs +47 -0
- package/tools/benchmark/smoke-jev.mjs +5 -0
- package/tools/benchmark/tasks.mjs +20 -0
- package/tools/benchmark/transport.mjs +65 -0
- package/tools/benchmark/transport.test.mjs +44 -0
- package/tools/benchmark/upstream-error.mjs +18 -0
- package/tools/benchmark/upstream-error.test.mjs +10 -0
- package/tools/browser-check.mjs +109 -0
- package/tools/check-syntax.mjs +27 -0
- package/tools/evaluate-plan-advisor.mjs +20 -0
- package/tools/native-fixture.mjs +194 -0
- package/tools/native-pty-smoke.py +108 -0
- package/tools/native-report-plugin/index.ts +50 -0
- package/tools/native-report-plugin/package.json +7 -0
- package/tools/patch-compaction.mjs +24 -0
- package/tools/patch-model-catalog.mjs +12 -0
- package/tools/patch-print-shutdown.mjs +39 -0
- package/tools/repo-pilot/evaluator.cjs +32 -0
- package/tools/repo-pilot/reference.mjs +43 -0
- package/tools/repo-pilot/runner.mjs +85 -0
- package/tools/repo-pilot/sandbox-entry.mjs +12 -0
- package/tools/repo-pilot/tasks.mjs +20 -0
- package/tools/repo-pilot/type-evaluator.cjs +6 -0
- package/tools/test-native-controls.mjs +84 -0
- package/tools/test-native-delivery-host.mjs +307 -0
- package/tools/test-native-evaluation.mjs +46 -0
- package/tools/test-native-host.mjs +385 -0
- package/tools/test-native-outcomes.mjs +73 -0
- package/tools/test-native-package.mjs +70 -0
- package/tools/test-native-pty.mjs +20 -0
- package/tools/test-native-report.mjs +88 -0
- package/tools/test-native-swe-host.mjs +132 -0
- package/tools/test-native-swe.mjs +122 -0
- package/tools/test-picker-pty.py +45 -0
- package/tools/test-python.mjs +29 -0
- package/tools/test-webdriver.mjs +54 -0
- package/tools/verify-release-version.mjs +37 -0
- package/tools/webdriver-check.mjs +52 -0
- package/vendor/agent/bounded-summary.mjs +88 -0
- package/vendor/agent/chunks/anthropic-messages-VWZZOSJQ.js +6 -0
- package/vendor/agent/chunks/anthropic.js +75 -0
- package/vendor/agent/chunks/azure-openai-responses-BJLAM6CD.js +2 -0
- package/vendor/agent/chunks/bedrock-converse-stream.js +74 -0
- package/vendor/agent/chunks/chord-context.js +96 -0
- package/vendor/agent/chunks/chunk-4L3WN2XY.js +2 -0
- package/vendor/agent/chunks/chunk-6CYCI3EJ.js +12 -0
- package/vendor/agent/chunks/chunk-6R7UI4IY.js +2 -0
- package/vendor/agent/chunks/chunk-7ZC4UXSL.js +2 -0
- package/vendor/agent/chunks/chunk-AXIIZGTV.js +2 -0
- package/vendor/agent/chunks/chunk-CLNPYIDP.js +42 -0
- package/vendor/agent/chunks/chunk-DRQDKNXA.js +2 -0
- package/vendor/agent/chunks/chunk-GMWCTUPB.js +2 -0
- package/vendor/agent/chunks/chunk-IDDQWTHI.js +2 -0
- package/vendor/agent/chunks/chunk-JVUZSMYM.js +1548 -0
- package/vendor/agent/chunks/chunk-L2ZPNLYD.js +2 -0
- package/vendor/agent/chunks/chunk-NUHFSC37.js +25 -0
- package/vendor/agent/chunks/chunk-OUXLLA64.js +11 -0
- package/vendor/agent/chunks/chunk-PGXDEOVV.js +2 -0
- package/vendor/agent/chunks/chunk-PJACZCIR.js +2 -0
- package/vendor/agent/chunks/chunk-PRRNXB7S.js +2 -0
- package/vendor/agent/chunks/chunk-TEPMHNKQ.js +2 -0
- package/vendor/agent/chunks/chunk-TRDNDS6A.js +4 -0
- package/vendor/agent/chunks/chunk-U6ZMQKGD.js +50 -0
- package/vendor/agent/chunks/chunk-UAQELI3K.js +2 -0
- package/vendor/agent/chunks/chunk-USJZMAIR.js +2 -0
- package/vendor/agent/chunks/chunk-XDUWOHPL.js +6 -0
- package/vendor/agent/chunks/chunk-XNGRGP62.js +2 -0
- package/vendor/agent/chunks/github-copilot.js +2 -0
- package/vendor/agent/chunks/google-generative-ai-Q2K7FBDI.js +2 -0
- package/vendor/agent/chunks/google-vertex-7UJBF4S7.js +2 -0
- package/vendor/agent/chunks/https-proxy-agent-2VXB7436.js +13 -0
- package/vendor/agent/chunks/image-resize-worker.js +2 -0
- package/vendor/agent/chunks/kimi-coding.js +2 -0
- package/vendor/agent/chunks/lib-HGQMNYVT.js +9 -0
- package/vendor/agent/chunks/mistral-conversations-4M6BZBX6.js +5 -0
- package/vendor/agent/chunks/multipart-parser-SQ6GDJL7.js +3 -0
- package/vendor/agent/chunks/node-KG362ECQ.js +16 -0
- package/vendor/agent/chunks/node-TWVVAGPO.js +2 -0
- package/vendor/agent/chunks/openai-codex-responses-R6VYZTVY.js +10 -0
- package/vendor/agent/chunks/openai-codex.js +75 -0
- package/vendor/agent/chunks/openai-completions-EKZT2IH2.js +7 -0
- package/vendor/agent/chunks/openai-responses-TFDINO6W.js +2 -0
- package/vendor/agent/chunks/openrouter-images-N4XVVFSD.js +2 -0
- package/vendor/agent/chunks/openrouter.js +75 -0
- package/vendor/agent/chunks/pi-messages-PML4SPVJ.js +8 -0
- package/vendor/agent/chunks/radius.js +75 -0
- package/vendor/agent/chunks/src-UK77SYZE.js +4 -0
- package/vendor/agent/chunks/xai.js +2 -0
- package/vendor/agent/cli.js +3 -0
- package/vendor/agent/dist/modes/interactive/theme/dark.json +91 -0
- package/vendor/agent/dist/modes/interactive/theme/light.json +90 -0
- package/vendor/agent/dist/modes/interactive/theme/theme-schema.json +356 -0
- package/vendor/agent/index.js +2 -0
- package/vendor/agent/modes/interactive/theme/dark.json +91 -0
- package/vendor/agent/modes/interactive/theme/light.json +90 -0
- package/vendor/agent/modes/interactive/theme/theme-schema.json +356 -0
- package/vendor/agent/package.json +14 -0
- package/vendor/agent/rpc-entry.js +3 -0
- package/vendor/agent/theme/dark.json +91 -0
- package/vendor/agent/theme/light.json +90 -0
- package/vendor/agent/theme/theme-schema.json +356 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import type { Context } from '@opencode/plugin/promise/plugin';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { existsSync, lstatSync, readFileSync, statSync } from 'node:fs';
|
|
4
|
+
import { basename, join, relative, resolve, sep } from 'node:path';
|
|
5
|
+
import { completionIssues, evidenceFresh, fingerprint, reviewFresh, requiresReview, validatePlan } from '../../../../lib/delivery.mjs';
|
|
6
|
+
import { planningView } from '../../../../lib/planning-view.mjs';
|
|
7
|
+
import { planningStatus } from '../../../../lib/planning.mjs';
|
|
8
|
+
import { localReviewSnapshot, startReview } from '../../../../lib/opencode/review.mjs';
|
|
9
|
+
import { createTask, listTasks } from '../../../../lib/opencode/workspace.mjs';
|
|
10
|
+
import { assertActiveReport, activeReportPath } from '../../../../lib/workspace.mjs';
|
|
11
|
+
import { Workspace, type WorkspaceSnapshot } from '../workspace-rpc';
|
|
12
|
+
|
|
13
|
+
type TaskRecord = { id: string; task: string; sessionID: string; worktree: string; status: string; branch?: string };
|
|
14
|
+
type OperationRecord = { id: string; task: string; sessionID?: string; worktree?: string; status: string; branch?: string };
|
|
15
|
+
type TaskState = { tasks: TaskRecord[]; operations: OperationRecord[] };
|
|
16
|
+
type NativeSession = Awaited<ReturnType<Context['session']['get']>>;
|
|
17
|
+
type JsonRecord = Record<string, unknown>;
|
|
18
|
+
type DeliveryCheck = JsonRecord & { id: string; kind?: string; argv?: string[] };
|
|
19
|
+
type DeliveryStep = string | (JsonRecord & { id: string; title: string; dependsOn: string[]; checks: string[] });
|
|
20
|
+
type DeliveryAcceptance = JsonRecord & { requirement: string; checks: string[] };
|
|
21
|
+
type DeliveryPlan = JsonRecord & {
|
|
22
|
+
goal: string; artifacts: string[]; outputs?: string[]; assumptions?: string[]; steps: DeliveryStep[];
|
|
23
|
+
acceptance: DeliveryAcceptance[]; checks: DeliveryCheck[]; design?: JsonRecord; verification?: string;
|
|
24
|
+
};
|
|
25
|
+
type DeliveryState = { runId: string; revision: number; status?: string; plan: DeliveryPlan; evidence?: Record<string, JsonRecord>; stepStatus?: Record<string, string> };
|
|
26
|
+
|
|
27
|
+
const MAX_TEXT = 4000;
|
|
28
|
+
const boundedText = (value: unknown, max = MAX_TEXT) => typeof value === 'string' ? value.slice(0, max) : '';
|
|
29
|
+
const asRecord = (value: unknown): JsonRecord => value && typeof value === 'object' && !Array.isArray(value) ? value as JsonRecord : {};
|
|
30
|
+
const boundedList = <T>(value: unknown, max: number, project: (item: unknown, index: number) => T): T[] => Array.isArray(value) ? value.slice(0, max).map(project) : [];
|
|
31
|
+
const listLength = (value: unknown) => Array.isArray(value) ? value.length : 0;
|
|
32
|
+
|
|
33
|
+
function reportFor(directory: string, sessionID: string) {
|
|
34
|
+
try {
|
|
35
|
+
const path = activeReportPath(directory);
|
|
36
|
+
if (!path || !existsSync(path)) return { status: 'unavailable' } as const;
|
|
37
|
+
const reportRelative = relative(directory, path).split(sep);
|
|
38
|
+
if (reportRelative.length !== 4 || reportRelative[0] !== '.harness' || reportRelative[1] !== sessionID || reportRelative[3] !== 'report.json') return { status: 'unavailable' } as const;
|
|
39
|
+
let cursor = resolve(directory);
|
|
40
|
+
for (const part of reportRelative) {
|
|
41
|
+
cursor = join(cursor, part);
|
|
42
|
+
const info = lstatSync(cursor);
|
|
43
|
+
if (info.isSymbolicLink()) return { status: 'invalid' } as const;
|
|
44
|
+
}
|
|
45
|
+
if (!lstatSync(path).isFile()) return { status: 'invalid' } as const;
|
|
46
|
+
if (statSync(path).size > 1024 * 1024) return { status: 'invalid' } as const;
|
|
47
|
+
const state = JSON.parse(readFileSync(path, 'utf8')) as DeliveryState;
|
|
48
|
+
if (!state || typeof state !== 'object' || !state.plan || typeof state.runId !== 'string' || !state.runId || state.runId.length > 128 || reportRelative[2] !== state.runId || !Number.isSafeInteger(state.revision) || state.revision < 1 || !Array.isArray(state.plan.checks)) return { status: 'invalid' } as const;
|
|
49
|
+
if (state.status !== undefined && !['implementing', 'verifying', 'verified', 'blocked'].includes(state.status)) return { status: 'invalid' } as const;
|
|
50
|
+
if (state.evidence !== undefined && (!state.evidence || typeof state.evidence !== 'object' || Array.isArray(state.evidence) || Object.keys(state.evidence).length > 20000)) return { status: 'invalid' } as const;
|
|
51
|
+
validatePlan(state.plan, directory);
|
|
52
|
+
if (Object.keys(state.evidence ?? {}).some(id => !state.plan.checks?.some(check => check.id === id))) return { status: 'invalid' } as const;
|
|
53
|
+
for (const check of state.plan.checks) {
|
|
54
|
+
const receipt = state.evidence?.[check.id];
|
|
55
|
+
if (receipt && (typeof receipt.passed !== 'boolean' || typeof receipt.fingerprint !== 'string' || receipt.runId !== undefined && typeof receipt.runId !== 'string' || receipt.revision !== undefined && !Number.isSafeInteger(receipt.revision) || receipt.checkDigest !== undefined && typeof receipt.checkDigest !== 'string' || receipt.code !== undefined && !Number.isSafeInteger(receipt.code) || receipt.durationMs !== undefined && !Number.isFinite(receipt.durationMs))) return { status: 'invalid' } as const;
|
|
56
|
+
}
|
|
57
|
+
assertActiveReport(directory, path);
|
|
58
|
+
const current = fingerprint(directory, ['.']);
|
|
59
|
+
if (!/^[a-f0-9]{64}$/.test(current)) return { status: 'invalid' } as const;
|
|
60
|
+
const view = planningView(state, current);
|
|
61
|
+
const workflowView = view.workflow as { authored?: boolean; semantics?: string; nodes?: JsonRecord[]; edges?: JsonRecord[] } | null;
|
|
62
|
+
const allEvidence = state.plan.checks.map(raw => {
|
|
63
|
+
const check = asRecord(raw) as DeliveryCheck;
|
|
64
|
+
const receipt = state.evidence?.[check.id];
|
|
65
|
+
const fresh = evidenceFresh(check, receipt, current, state);
|
|
66
|
+
const status = !receipt ? 'pending' : !receipt.passed ? 'failed' : fresh ? 'fresh' : 'stale';
|
|
67
|
+
const filename = typeof receipt?.logPath === 'string' && !receipt.logPath.split(/[\\/]/).includes('..') ? basename(receipt.logPath) : undefined;
|
|
68
|
+
return {
|
|
69
|
+
id: boundedText(check.id, 80), status,
|
|
70
|
+
...(Number.isSafeInteger(receipt?.executedRevision) ? { executedRevision: receipt?.executedRevision as number } : {}),
|
|
71
|
+
...(Number.isSafeInteger(receipt?.code) ? { code: receipt?.code as number } : {}),
|
|
72
|
+
...(filename ? { filename: boundedText(filename, 160) } : {}),
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
const evidence = allEvidence.slice(0, 100);
|
|
76
|
+
const plan = {
|
|
77
|
+
goal: boundedText(state.plan.goal), verification: boundedText(state.plan.verification ?? 'required', 32),
|
|
78
|
+
acceptance: boundedList(state.plan.acceptance, 80, raw => { const item = asRecord(raw); return { requirement: boundedText(item.requirement), checks: boundedList(item.checks, 100, id => boundedText(id, 80)) }; }),
|
|
79
|
+
artifacts: boundedList(state.plan.artifacts, 40, item => boundedText(item, 240)),
|
|
80
|
+
outputs: boundedList(state.plan.outputs, 40, item => boundedText(item, 240)),
|
|
81
|
+
assumptions: boundedList(state.plan.assumptions, 40, item => boundedText(item)),
|
|
82
|
+
checks: boundedList(state.plan.checks, 100, raw => { const check = asRecord(raw); return { id: boundedText(check.id, 80), kind: boundedText(check.kind, 32), argv: boundedList(check.argv, 32, item => boundedText(item, 1000)), timeoutSeconds: Number.isSafeInteger(check.timeoutSeconds) ? check.timeoutSeconds as number : 0 }; }),
|
|
83
|
+
steps: boundedList(state.plan.steps, 40, (raw, index) => { const step = asRecord(raw); return {
|
|
84
|
+
id: boundedText(typeof raw === 'string' ? `legacy_${index + 1}` : step.id, 80),
|
|
85
|
+
title: boundedText(typeof raw === 'string' ? raw : step.title),
|
|
86
|
+
status: boundedText(state.stepStatus?.[`step${index}`] ?? 'pending', 32),
|
|
87
|
+
dependsOn: boundedList(typeof raw === 'string' ? [] : step.dependsOn, 40, item => boundedText(item, 80)),
|
|
88
|
+
checks: boundedList(typeof raw === 'string' ? [] : step.checks, 100, item => boundedText(item, 80)),
|
|
89
|
+
}; }),
|
|
90
|
+
scenarios: boundedList(asRecord(state.plan.design).scenarios, 80, raw => { const scenario = asRecord(raw); return { id: boundedText(scenario.id, 80), requirement: boundedText(scenario.requirement), kind: boundedText(scenario.kind, 32), path: boundedList(scenario.path, 40, item => boundedText(item, 80)), checks: boundedList(scenario.checks, 100, item => boundedText(item, 80)), input: boundedText(scenario.input), expected: boundedText(scenario.expected), assertion: boundedText(scenario.assertion) }; }),
|
|
91
|
+
risks: boundedList(asRecord(state.plan.design).risks, 80, raw => { const risk = asRecord(raw); return { id: boundedText(risk.id, 80), description: boundedText(risk.description), status: boundedText(risk.status, 32), blocking: risk.blocking === true, evidence: boundedText(risk.evidence) }; }),
|
|
92
|
+
};
|
|
93
|
+
const workflow = {
|
|
94
|
+
authored: workflowView?.authored === true,
|
|
95
|
+
semantics: boundedText(workflowView?.semantics, 1000),
|
|
96
|
+
nodes: boundedList(workflowView?.nodes, 100, raw => { const node = asRecord(raw); return {
|
|
97
|
+
id: boundedText(node.id, 80), title: boundedText(node.title), type: boundedText(node.type, 32), status: boundedText(node.status, 32),
|
|
98
|
+
...(typeof node.step === 'string' ? { step: boundedText(node.step, 80) } : {}),
|
|
99
|
+
requirements: boundedList(node.requirements, 80, item => boundedText(item)), components: boundedList(node.components, 80, item => boundedText(item, 80)),
|
|
100
|
+
checks: boundedList(node.checks, 100, item => boundedText(item, 80)), inputs: boundedList(node.inputs, 80, item => boundedText(item)),
|
|
101
|
+
artifacts: boundedList(node.artifacts, 80, item => boundedText(item, 240)), effects: boundedList(node.effects, 10, item => boundedText(item, 32)),
|
|
102
|
+
...(typeof node.condition === 'string' ? { condition: boundedText(node.condition) } : {}),
|
|
103
|
+
}; }),
|
|
104
|
+
edges: boundedList(workflowView?.edges, 200, raw => { const edge = asRecord(raw); return {
|
|
105
|
+
from: boundedText(edge.from, 80), to: boundedText(edge.to, 80), kind: boundedText(edge.kind, 32),
|
|
106
|
+
...(typeof edge.label === 'string' ? { label: boundedText(edge.label) } : {}),
|
|
107
|
+
...(typeof edge.when === 'string' ? { when: boundedText(edge.when) } : {}),
|
|
108
|
+
...(typeof edge.stop === 'string' ? { stop: boundedText(edge.stop) } : {}),
|
|
109
|
+
...(Number.isSafeInteger(edge.maxAttempts) ? { maxAttempts: edge.maxAttempts as number } : {}),
|
|
110
|
+
}; }),
|
|
111
|
+
};
|
|
112
|
+
const architecture = {
|
|
113
|
+
nodes: boundedList(view.architecture?.nodes, 80, raw => { const node = asRecord(raw); return { id: boundedText(node.id, 80), title: boundedText(node.title), layer: boundedText(node.layer, 32), excludes: boundedList(node.excludes, 30, item => boundedText(item)), requirements: boundedList(node.requirements, 80, item => boundedText(item)) }; }),
|
|
114
|
+
edges: boundedList(view.architecture?.edges, 200, raw => { const edge = asRecord(raw); return { from: boundedText(edge.from, 80), to: boundedText(edge.to, 80), kind: boundedText(edge.kind, 32) }; }),
|
|
115
|
+
ports: boundedList(view.architecture?.ports, 80, raw => { const port = asRecord(raw); return { id: boundedText(port.id, 80), owner: boundedText(port.owner, 80), adapter: boundedText(port.adapter, 80), compositionRoot: boundedText(port.compositionRoot, 80), input: boundedText(port.input), output: boundedText(port.output), errors: boundedText(port.errors), injection: boundedText(port.injection), testDouble: boundedText(port.testDouble), integrationAssertion: boundedText(port.integrationAssertion) }; }),
|
|
116
|
+
};
|
|
117
|
+
const gate = planningStatus(state, current);
|
|
118
|
+
const issues = completionIssues(state, directory, current);
|
|
119
|
+
const reviewRequired = requiresReview(state);
|
|
120
|
+
const reviewIsFresh = !reviewRequired || reviewFresh(state, current);
|
|
121
|
+
const isStale = allEvidence.some(item => item.status === 'stale') || reviewRequired && !reviewIsFresh;
|
|
122
|
+
const planningViewLocked = view.gate.locked;
|
|
123
|
+
const noCompletionIssues = !Object.values(issues).some(value => Array.isArray(value) && value.length > 0);
|
|
124
|
+
const allChecksFresh = allEvidence.length > 0 && allEvidence.every(item => item.status === 'fresh');
|
|
125
|
+
const ready = !planningViewLocked && noCompletionIssues && reviewIsFresh && allChecksFresh;
|
|
126
|
+
const complete = ready && (state.plan.verification ?? 'required') === 'required';
|
|
127
|
+
const status = state.status === 'blocked' ? 'blocked' : state.status === 'verified' && complete ? 'verified' : isStale ? 'stale' : state.status === 'verifying' ? 'verifying' : 'implementing';
|
|
128
|
+
const truncation = {
|
|
129
|
+
checks: { returned: evidence.length, total: allEvidence.length },
|
|
130
|
+
acceptance: { returned: plan.acceptance.length, total: state.plan.acceptance.length },
|
|
131
|
+
steps: { returned: plan.steps.length, total: state.plan.steps.length },
|
|
132
|
+
artifacts: { returned: plan.artifacts.length, total: state.plan.artifacts.length },
|
|
133
|
+
outputs: { returned: plan.outputs.length, total: state.plan.outputs?.length ?? 0 },
|
|
134
|
+
assumptions: { returned: plan.assumptions.length, total: state.plan.assumptions?.length ?? 0 },
|
|
135
|
+
scenarios: { returned: plan.scenarios.length, total: listLength(asRecord(state.plan.design).scenarios) },
|
|
136
|
+
risks: { returned: plan.risks.length, total: listLength(asRecord(state.plan.design).risks) },
|
|
137
|
+
workflowNodes: { returned: workflow.nodes.length, total: workflowView?.nodes?.length ?? 0 },
|
|
138
|
+
workflowEdges: { returned: workflow.edges.length, total: workflowView?.edges?.length ?? 0 },
|
|
139
|
+
architectureNodes: { returned: architecture.nodes.length, total: view.architecture?.nodes?.length ?? 0 },
|
|
140
|
+
architectureEdges: { returned: architecture.edges.length, total: view.architecture?.edges?.length ?? 0 },
|
|
141
|
+
architecturePorts: { returned: architecture.ports.length, total: view.architecture?.ports?.length ?? 0 },
|
|
142
|
+
};
|
|
143
|
+
const result = { status, freshness: isStale ? 'stale' : 'current', completion: ready ? 'ready' : 'incomplete', gate: gate.locked ? 'locked' : 'open', runId: state.runId, revision: state.revision, fingerprint: current, plan, workflow, architecture, evidence, truncation };
|
|
144
|
+
if (Buffer.byteLength(JSON.stringify(result), 'utf8') > 64 * 1024) return { status: 'invalid' } as const;
|
|
145
|
+
return result;
|
|
146
|
+
} catch {
|
|
147
|
+
return { status: 'invalid' } as const;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
type ReviewModel = { providerID: string; id: string; variant?: string };
|
|
151
|
+
|
|
152
|
+
function configuredReviewModel(value: unknown): ReviewModel | undefined {
|
|
153
|
+
if (value === undefined) return undefined;
|
|
154
|
+
if (!value || typeof value !== 'object' || !('providerID' in value) || typeof value.providerID !== 'string' || !value.providerID.trim() || !('id' in value) || typeof value.id !== 'string' || !value.id.trim()) {
|
|
155
|
+
throw new Error('Invalid server reviewModel: providerID and id must be non-empty strings');
|
|
156
|
+
}
|
|
157
|
+
if ('variant' in value && value.variant !== undefined && (typeof value.variant !== 'string' || !value.variant.trim())) {
|
|
158
|
+
throw new Error('Invalid server reviewModel: variant must be a non-empty string when provided');
|
|
159
|
+
}
|
|
160
|
+
return { providerID: value.providerID.trim(), id: value.id.trim(), ...('variant' in value && typeof value.variant === 'string' ? { variant: value.variant.trim() } : {}) };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function taskStatus(session?: NativeSession, running = false) {
|
|
164
|
+
if (!session) return 'unavailable';
|
|
165
|
+
if (running) return 'running';
|
|
166
|
+
if (session.outcome === 'failed' || session.outcome === 'interrupted') return session.outcome;
|
|
167
|
+
// A successful model turn does not complete the durable logical delivery task.
|
|
168
|
+
return 'unknown';
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Register real native workspace operations. Durable task records identify sessions which
|
|
172
|
+
* must be verified through the location-scoped native API; the TUI adds its full native list. */
|
|
173
|
+
export async function registerWorkspaceRpc(ctx: Context, options: {
|
|
174
|
+
notify?: (summary: WorkspaceSnapshot) => void;
|
|
175
|
+
reviewModel?: ReviewModel;
|
|
176
|
+
} = {}) {
|
|
177
|
+
const reviewModel = configuredReviewModel(options.reviewModel);
|
|
178
|
+
const root = resolve(ctx.location.project.canonical);
|
|
179
|
+
const locationDirectory = resolve(ctx.location.directory);
|
|
180
|
+
const projectID = ctx.location.project.id;
|
|
181
|
+
let disposed = false;
|
|
182
|
+
const events = new AbortController();
|
|
183
|
+
const running = new Set<string>();
|
|
184
|
+
const records = () => listTasks({ canonical: root, includeOperations: true }) as TaskState;
|
|
185
|
+
const owns = async (sessionID: string, signal?: AbortSignal) => {
|
|
186
|
+
signal?.throwIfAborted();
|
|
187
|
+
const session = await ctx.session.get({ sessionID }, { signal });
|
|
188
|
+
const taskState = records();
|
|
189
|
+
const task = taskState.tasks.find(record => record.sessionID === sessionID);
|
|
190
|
+
const directory = resolve(session.location.directory);
|
|
191
|
+
const operation = taskState.operations.find(record => record.sessionID === sessionID);
|
|
192
|
+
const ownedTask = task ?? (operation?.worktree ? operation as TaskRecord : undefined);
|
|
193
|
+
if (session.projectID !== projectID || directory !== root && directory !== locationDirectory && (!ownedTask || resolve(ownedTask.worktree) !== directory)) throw new Error('Session belongs to another workspace location');
|
|
194
|
+
return session;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const snapshot = async (requestedProjectID?: string, signal?: AbortSignal): Promise<WorkspaceSnapshot> => {
|
|
198
|
+
if (requestedProjectID && requestedProjectID !== projectID) throw new Error('Project is outside this OpenCode workspace location');
|
|
199
|
+
const taskState = records();
|
|
200
|
+
const ids = [...new Set([...taskState.tasks.map(record => record.sessionID), ...taskState.operations.map(record => record.sessionID)].filter((id): id is string => typeof id === 'string'))];
|
|
201
|
+
signal?.throwIfAborted();
|
|
202
|
+
const sessions = await Promise.all(ids.map(async id => {
|
|
203
|
+
try { return { id, session: await owns(id, signal), status: 'verified' as const }; } catch (error) {
|
|
204
|
+
if (signal?.aborted) throw error;
|
|
205
|
+
return { id, session: null, status: 'unavailable' as const };
|
|
206
|
+
}
|
|
207
|
+
}));
|
|
208
|
+
const byID = new Map(sessions.filter(item => item.session).map(item => [item.id, item.session!]));
|
|
209
|
+
const tasks: WorkspaceSnapshot['tasks'] = taskState.tasks.map(record => {
|
|
210
|
+
const session = byID.get(record.sessionID);
|
|
211
|
+
return {
|
|
212
|
+
id: record.id, projectID, title: record.task, status: taskStatus(session, running.has(record.sessionID)),
|
|
213
|
+
...(!session || session.outcome === 'failed' || session.outcome === 'interrupted' ? { attention: true } : {}),
|
|
214
|
+
directory: record.worktree, ...(record.branch ? { branch: record.branch } : {}),
|
|
215
|
+
};
|
|
216
|
+
});
|
|
217
|
+
for (const op of taskState.operations) if (op.status !== 'complete' && op.status !== 'reconciled') {
|
|
218
|
+
tasks.push({ id: op.id, projectID, title: op.task, status: op.status, attention: op.status === 'recovery-required', ...(op.worktree ? { directory: op.worktree } : {}), ...(op.branch ? { branch: op.branch } : {}) });
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
projects: [{ id: projectID, directory: root, name: basename(root) }], tasks,
|
|
222
|
+
sessions: sessions.flatMap(item => {
|
|
223
|
+
if (!item.session) return [{ id: item.id, title: 'Session unavailable', status: 'unavailable', directory: taskState.tasks.find(record => record.sessionID === item.id)?.worktree ?? locationDirectory }];
|
|
224
|
+
const session = item.session;
|
|
225
|
+
const task = taskState.tasks.find(record => record.sessionID === session.id);
|
|
226
|
+
return {
|
|
227
|
+
id: session.id, ...(task ? { taskID: task.id, projectID } : {}), title: session.title ?? 'Untitled session',
|
|
228
|
+
status: running.has(session.id) ? 'running' : session.outcome ?? 'unknown', updatedAt: new Date(session.time.updated).toISOString(), directory: session.location.directory,
|
|
229
|
+
};
|
|
230
|
+
}),
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const registration = await ctx.rpc.register(Workspace, {
|
|
235
|
+
snapshot: async (value, call) => { const input = value as { projectID?: string }; return snapshot(input.projectID, call.signal); },
|
|
236
|
+
open: async (value, call) => {
|
|
237
|
+
const input = value as { sessionID: string };
|
|
238
|
+
const session = await owns(input.sessionID, call.signal);
|
|
239
|
+
call.signal.throwIfAborted();
|
|
240
|
+
await ctx.session.get({ sessionID: session.id }, { signal: call.signal });
|
|
241
|
+
return { opened: true, directory: session.location.directory };
|
|
242
|
+
},
|
|
243
|
+
createWorktree: async (value, call) => {
|
|
244
|
+
const input = value as { projectID: string; name: string };
|
|
245
|
+
if (input.projectID !== projectID) throw new Error('Project is outside this OpenCode workspace location');
|
|
246
|
+
call.signal.throwIfAborted();
|
|
247
|
+
const result = await ctx.worktree.create({ projectID, name: input.name }, { signal: call.signal });
|
|
248
|
+
return { directory: resolve(result.directory) };
|
|
249
|
+
},
|
|
250
|
+
createTask: async (value, call) => {
|
|
251
|
+
const input = value as { task: string; branch?: string };
|
|
252
|
+
call.signal.throwIfAborted();
|
|
253
|
+
const record = await createTask({ ctx, canonical: root, projectID, task: input.task, branch: input.branch, signal: call.signal });
|
|
254
|
+
await emitUpdated();
|
|
255
|
+
return { taskID: record.id, sessionID: record.sessionID, directory: record.worktree };
|
|
256
|
+
},
|
|
257
|
+
delivery: async (value, call) => {
|
|
258
|
+
const input = value as { sessionID: string };
|
|
259
|
+
const session = await owns(input.sessionID, call.signal);
|
|
260
|
+
const directory = resolve(session.location.directory);
|
|
261
|
+
if (session.projectID !== projectID) throw new Error('Session belongs to another project');
|
|
262
|
+
const task = records().tasks.find(record => record.sessionID === session.id);
|
|
263
|
+
const operation = records().operations.find(record => record.sessionID === session.id);
|
|
264
|
+
const expectedDirectory = task?.worktree ?? operation?.worktree ?? locationDirectory;
|
|
265
|
+
if (directory !== resolve(expectedDirectory)) throw new Error('Delivery report is not owned by this session');
|
|
266
|
+
return reportFor(directory, session.id);
|
|
267
|
+
},
|
|
268
|
+
review: async (value, call) => {
|
|
269
|
+
const input = value as { sessionID: string };
|
|
270
|
+
const session = await owns(input.sessionID, call.signal);
|
|
271
|
+
const report = reportFor(session.location.directory, session.id);
|
|
272
|
+
const receiptPath = resolve(session.location.directory, '.harness', 'reviews', `${createHash('sha256').update(`session:${session.id}`).digest('hex')}.json`);
|
|
273
|
+
if (!existsSync(receiptPath)) return { status: report.status === 'stale' || report.status === 'invalid' ? report.status : 'unreviewed' };
|
|
274
|
+
const receipt = JSON.parse(readFileSync(receiptPath, 'utf8'));
|
|
275
|
+
const current = localReviewSnapshot(session.location.directory);
|
|
276
|
+
const valid = receipt?.version === 1 && receipt.identity === `session:${session.id}` && Array.isArray(receipt.history);
|
|
277
|
+
if (!valid) return { status: 'invalid' };
|
|
278
|
+
const fresh = receipt.snapshot === current.snapshot && receipt.head === current.head && ['approved', 'changes-requested'].includes(receipt.status);
|
|
279
|
+
return { status: fresh ? receipt.status : 'stale', summary: fresh ? `${receipt.rounds} review round(s) · ${current.snapshot}` : 'Review source changed since this receipt' };
|
|
280
|
+
},
|
|
281
|
+
startReview: async (value, call) => {
|
|
282
|
+
const input = value as { sessionID: string };
|
|
283
|
+
const session = await owns(input.sessionID, call.signal);
|
|
284
|
+
try {
|
|
285
|
+
const result = await startReview({ ctx, cwd: session.location.directory, identity: `session:${session.id}`, model: reviewModel, signal: call.signal });
|
|
286
|
+
return { status: result.verdict === 'APPROVE' ? 'approved' : 'changes-requested', summary: `${result.findings.findings.length} findings · ${result.snapshot}`, sessionID: result.reviewerSessionID };
|
|
287
|
+
} catch (error) {
|
|
288
|
+
if (call.signal.aborted) throw error;
|
|
289
|
+
return call.error('reviewFailed', error instanceof Error ? error.message : String(error), { message: error instanceof Error ? error.message : String(error) });
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
const emitUpdated = async () => {
|
|
295
|
+
if (!disposed) await registration.events.emit('updated', { revision: new Date().toISOString() });
|
|
296
|
+
};
|
|
297
|
+
const watcher = (async () => {
|
|
298
|
+
try {
|
|
299
|
+
for await (const event of ctx.event.subscribe({ signal: events.signal })) {
|
|
300
|
+
if (disposed) return;
|
|
301
|
+
const detail = event as { type: string; location?: { directory: string }; data?: { sessionID?: string; status?: { type?: string } } };
|
|
302
|
+
const sessionID = detail.data?.sessionID;
|
|
303
|
+
let sessionDirectory: string | undefined;
|
|
304
|
+
if (sessionID) {
|
|
305
|
+
try {
|
|
306
|
+
const session = await owns(sessionID);
|
|
307
|
+
sessionDirectory = resolve(session.location.directory);
|
|
308
|
+
} catch {
|
|
309
|
+
const taskState = records();
|
|
310
|
+
const task = taskState.tasks.find(record => record.sessionID === sessionID);
|
|
311
|
+
const operation = taskState.operations.find(record => record.sessionID === sessionID);
|
|
312
|
+
const recordedDirectory = task?.worktree ?? operation?.worktree;
|
|
313
|
+
const eventDirectory = detail.location?.directory && resolve(detail.location.directory);
|
|
314
|
+
if (recordedDirectory && detail.type === 'session.deleted') sessionDirectory = resolve(recordedDirectory);
|
|
315
|
+
else if (eventDirectory && [root, locationDirectory, ...taskState.tasks.map(record => resolve(record.worktree)), ...taskState.operations.map(record => record.worktree ? resolve(record.worktree) : undefined).filter((directory): directory is string => Boolean(directory))].includes(eventDirectory)) sessionDirectory = eventDirectory;
|
|
316
|
+
else continue;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const taskDirectories = [...records().tasks.map(task => resolve(task.worktree)), ...records().operations.map(operation => operation.worktree && resolve(operation.worktree)).filter((directory): directory is string => Boolean(directory))];
|
|
320
|
+
const relevantDirectories = new Set([root, locationDirectory, ...taskDirectories]);
|
|
321
|
+
if (sessionDirectory && !relevantDirectories.has(sessionDirectory)) continue;
|
|
322
|
+
if (!sessionID && detail.location?.directory && !relevantDirectories.has(resolve(detail.location.directory))) continue;
|
|
323
|
+
if (!sessionID && !detail.location?.directory) continue;
|
|
324
|
+
if (detail.type.startsWith('session.execution.') && sessionID) {
|
|
325
|
+
if (detail.type === 'session.execution.started') running.add(sessionID);
|
|
326
|
+
else if (['session.execution.succeeded', 'session.execution.failed', 'session.execution.interrupted'].includes(detail.type)) running.delete(sessionID);
|
|
327
|
+
}
|
|
328
|
+
if (detail.type === 'session.status' && sessionID && detail.data?.status?.type) {
|
|
329
|
+
if (detail.data.status.type === 'busy' || detail.data.status.type === 'retry') running.add(sessionID);
|
|
330
|
+
else running.delete(sessionID);
|
|
331
|
+
}
|
|
332
|
+
if (['session.updated', 'session.created', 'session.deleted', 'session.status', 'session.execution.started', 'session.execution.succeeded', 'session.execution.failed', 'session.execution.interrupted', 'worktree.updated'].includes(detail.type)) {
|
|
333
|
+
try {
|
|
334
|
+
const value = await snapshot();
|
|
335
|
+
options.notify?.(value);
|
|
336
|
+
} catch { /* Updates are invalidations; reads fail closed. */ }
|
|
337
|
+
try { await emitUpdated(); } catch { /* A disconnected subscriber must not kill the native event stream. */ }
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
} catch { /* Stream ends with host teardown; no polling or retry loop. */ }
|
|
341
|
+
})();
|
|
342
|
+
|
|
343
|
+
return async () => {
|
|
344
|
+
disposed = true;
|
|
345
|
+
events.abort();
|
|
346
|
+
await registration.dispose();
|
|
347
|
+
await watcher;
|
|
348
|
+
};
|
|
349
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Rpc } from '@opencode/plugin/rpc';
|
|
2
|
+
|
|
3
|
+
const errors = {
|
|
4
|
+
wrong_workspace: {
|
|
5
|
+
type: 'object', properties: { sessionID: { type: 'string' } },
|
|
6
|
+
required: ['sessionID'], additionalProperties: false,
|
|
7
|
+
},
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
export const SessionControls = Rpc.define({
|
|
11
|
+
id: 'carthagent.session',
|
|
12
|
+
methods: {
|
|
13
|
+
framing: {
|
|
14
|
+
input: {
|
|
15
|
+
type: 'object', properties: { sessionID: { type: 'string', minLength: 1 }, enabled: { type: 'boolean' } },
|
|
16
|
+
required: ['sessionID'], additionalProperties: false,
|
|
17
|
+
},
|
|
18
|
+
output: { type: 'object', properties: { enabled: { type: 'boolean' } }, required: ['enabled'], additionalProperties: false },
|
|
19
|
+
errors,
|
|
20
|
+
},
|
|
21
|
+
compact: {
|
|
22
|
+
input: {
|
|
23
|
+
type: 'object', properties: { sessionID: { type: 'string', minLength: 1 }, notes: { type: 'string', maxLength: 16000 } },
|
|
24
|
+
required: ['sessionID'], additionalProperties: false,
|
|
25
|
+
},
|
|
26
|
+
output: { type: 'object', properties: { admitted: { type: 'boolean' } }, required: ['admitted'], additionalProperties: false },
|
|
27
|
+
errors,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
events: {},
|
|
31
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { registerSessionControls } from './server/session-controls';
|
|
2
|
+
import { registerNativeDelivery } from './server/native-delivery';
|
|
3
|
+
import { Carthagent } from './rpc';
|
|
4
|
+
import type { Context } from '@opencode/plugin/promise/plugin';
|
|
5
|
+
import type { ShellHooks } from '@opencode/plugin/promise/shell';
|
|
6
|
+
|
|
7
|
+
const TestDiagnostics = {
|
|
8
|
+
id: 'carthagent-test',
|
|
9
|
+
methods: {
|
|
10
|
+
state: {
|
|
11
|
+
input: { type: 'object', properties: { sessionID: { type: 'string', minLength: 1 } }, required: ['sessionID'], additionalProperties: false },
|
|
12
|
+
output: { type: 'object', properties: {
|
|
13
|
+
budget: { type: ['object', 'null'], additionalProperties: true },
|
|
14
|
+
delivery: { type: ['object', 'null'], additionalProperties: true },
|
|
15
|
+
invocations: { type: 'array', items: { type: 'object', additionalProperties: true } },
|
|
16
|
+
}, required: ['budget', 'delivery', 'invocations'], additionalProperties: false },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
events: {},
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
/** Full host registration for the isolated native integration harness. */
|
|
23
|
+
export async function setupNativeTestPlugin(context: Parameters<typeof registerSessionControls>[0]) {
|
|
24
|
+
const cleanups: Array<() => Promise<void>> = [];
|
|
25
|
+
const invocations: Array<{ hook: string; tool?: string; command?: string }> = [];
|
|
26
|
+
const monitored = {
|
|
27
|
+
...context,
|
|
28
|
+
tool: {
|
|
29
|
+
...context.tool,
|
|
30
|
+
hook: async (name: 'execute.before' | 'execute.after', callback: (event: { tool: string; id: string; sessionID: string }) => unknown) => context.tool.hook(name, async (event) => {
|
|
31
|
+
if (name === 'execute.before' || name === 'execute.after') invocations.push({ hook: name, tool: event.tool });
|
|
32
|
+
await callback(event);
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
shell: {
|
|
36
|
+
...context.shell,
|
|
37
|
+
hook: async (name: keyof ShellHooks, callback: (event: ShellHooks[keyof ShellHooks]) => unknown) => context.shell.hook(name, async (event) => {
|
|
38
|
+
if (name === 'create.before') invocations.push({ hook: `shell.${name}`, command: event.command });
|
|
39
|
+
await callback(event);
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
} as unknown as Context;
|
|
43
|
+
try {
|
|
44
|
+
cleanups.push(await registerSessionControls(monitored));
|
|
45
|
+
cleanups.push(await registerNativeDelivery(monitored));
|
|
46
|
+
const registration = await context.rpc.register(Carthagent, {
|
|
47
|
+
health: async () => ({ protocol: 1, hostVersion: context.app.version, directory: context.location.directory }),
|
|
48
|
+
echo: async input => ({ text: (input as { text: string }).text }),
|
|
49
|
+
authStart: async () => { throw new Error('Device authorization is not available in the isolated delivery test plugin.'); },
|
|
50
|
+
authCancel: async () => ({ cancelled: false }),
|
|
51
|
+
});
|
|
52
|
+
cleanups.push(async () => registration.dispose());
|
|
53
|
+
const diagnostics = await context.rpc.register(TestDiagnostics, {
|
|
54
|
+
state: async (input) => {
|
|
55
|
+
const { sessionID } = input as { sessionID: string };
|
|
56
|
+
const stored = await context.storage.get(`session/${sessionID}`);
|
|
57
|
+
const state = stored && typeof stored === 'object' && !Array.isArray(stored) ? stored as Record<string, unknown> : undefined;
|
|
58
|
+
return {
|
|
59
|
+
budget: isRecord(state?.budget) ? { tools: state.budget.tools, limits: state.budget.limits, stopped: state.budget.stopped } : null,
|
|
60
|
+
delivery: isRecord(state?.state) ? {
|
|
61
|
+
workflowMode: state.state.workflowMode,
|
|
62
|
+
status: state.state.status,
|
|
63
|
+
planning: isRecord(state.state.planning) ? JSON.parse(JSON.stringify({
|
|
64
|
+
validation: state.state.planning.validation,
|
|
65
|
+
capture: isRecord(state.state.planning.capture) ? { id: state.state.planning.capture.id } : null,
|
|
66
|
+
review: state.state.planning.review,
|
|
67
|
+
approval: state.state.planning.approval,
|
|
68
|
+
started: state.state.planning.started,
|
|
69
|
+
})) : null,
|
|
70
|
+
} : null,
|
|
71
|
+
invocations,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
cleanups.push(async () => diagnostics.dispose());
|
|
76
|
+
return async () => { for (const cleanup of cleanups.reverse()) await cleanup(); };
|
|
77
|
+
} catch (error) {
|
|
78
|
+
await Promise.allSettled(cleanups.reverse().map(cleanup => cleanup()));
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
84
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
85
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Rpc } from '@opencode/plugin/rpc';
|
|
2
|
+
|
|
3
|
+
const string = { type: 'string', minLength: 1 } as const;
|
|
4
|
+
const sessionInput = {
|
|
5
|
+
type: 'object', properties: { sessionID: string }, required: ['sessionID'], additionalProperties: false,
|
|
6
|
+
} as const;
|
|
7
|
+
const project = {
|
|
8
|
+
type: 'object', properties: { id: string, directory: string, name: string },
|
|
9
|
+
required: ['id', 'directory'], additionalProperties: false,
|
|
10
|
+
} as const;
|
|
11
|
+
const task = {
|
|
12
|
+
type: 'object', properties: {
|
|
13
|
+
id: string, projectID: string, title: string, status: string,
|
|
14
|
+
attention: { type: 'boolean' }, directory: string, branch: string,
|
|
15
|
+
}, required: ['id', 'projectID', 'title', 'status'], additionalProperties: false,
|
|
16
|
+
} as const;
|
|
17
|
+
const session = {
|
|
18
|
+
type: 'object', properties: {
|
|
19
|
+
id: string, taskID: string, projectID: string, title: { type: 'string' }, status: string,
|
|
20
|
+
updatedAt: string, directory: string,
|
|
21
|
+
}, required: ['id', 'title', 'status', 'directory'], additionalProperties: false,
|
|
22
|
+
} as const;
|
|
23
|
+
const evidenceItem = {
|
|
24
|
+
type: 'object', properties: {
|
|
25
|
+
id: string, status: { type: 'string', enum: ['pending', 'failed', 'fresh', 'stale'] },
|
|
26
|
+
executedRevision: { type: 'integer' }, code: { type: 'integer' }, filename: string,
|
|
27
|
+
}, required: ['id', 'status'], additionalProperties: false,
|
|
28
|
+
} as const;
|
|
29
|
+
const deliveryPlan = {
|
|
30
|
+
type: 'object', properties: {
|
|
31
|
+
goal: { type: 'string' }, verification: { type: 'string' },
|
|
32
|
+
acceptance: { type: 'array', items: { type: 'object', properties: { requirement: { type: 'string' }, checks: { type: 'array', items: string } }, required: ['requirement', 'checks'], additionalProperties: false } },
|
|
33
|
+
artifacts: { type: 'array', items: { type: 'string' } }, outputs: { type: 'array', items: { type: 'string' } }, assumptions: { type: 'array', items: { type: 'string' } },
|
|
34
|
+
checks: { type: 'array', items: { type: 'object', properties: { id: string, kind: { type: 'string' }, argv: { type: 'array', items: { type: 'string' } }, timeoutSeconds: { type: 'integer' } }, required: ['id', 'kind', 'argv', 'timeoutSeconds'], additionalProperties: false } },
|
|
35
|
+
steps: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, title: { type: 'string' }, status: { type: 'string' }, dependsOn: { type: 'array', items: { type: 'string' } }, checks: { type: 'array', items: { type: 'string' } } }, required: ['id', 'title', 'status', 'dependsOn', 'checks'], additionalProperties: false } },
|
|
36
|
+
scenarios: { type: 'array', items: { type: 'object', properties: { id: string, requirement: { type: 'string' }, kind: { type: 'string' }, path: { type: 'array', items: { type: 'string' } }, checks: { type: 'array', items: { type: 'string' } }, input: { type: 'string' }, expected: { type: 'string' }, assertion: { type: 'string' } }, required: ['id', 'requirement', 'kind', 'path', 'checks', 'input', 'expected', 'assertion'], additionalProperties: false } },
|
|
37
|
+
risks: { type: 'array', items: { type: 'object', properties: { id: string, description: { type: 'string' }, status: { type: 'string' }, blocking: { type: 'boolean' }, evidence: { type: 'string' } }, required: ['id', 'description', 'status', 'blocking', 'evidence'], additionalProperties: false } },
|
|
38
|
+
}, required: ['goal', 'verification', 'acceptance', 'steps', 'artifacts', 'outputs', 'assumptions', 'checks', 'scenarios', 'risks'], additionalProperties: false,
|
|
39
|
+
} as const;
|
|
40
|
+
const graphNodes = { type: 'array', items: { type: 'object', properties: { id: string, title: { type: 'string' }, type: { type: 'string' }, status: { type: 'string' }, layer: { type: 'string' }, excludes: { type: 'array', items: { type: 'string' } }, requirements: { type: 'array', items: { type: 'string' } } }, required: ['id', 'title'], additionalProperties: false } } as const;
|
|
41
|
+
const graphEdges = { type: 'array', items: { type: 'object', properties: { from: { type: 'string' }, to: { type: 'string' }, kind: { type: 'string' }, label: { type: 'string' } }, required: ['from', 'to', 'kind'], additionalProperties: false } } as const;
|
|
42
|
+
const workflowGraph = {
|
|
43
|
+
type: 'object', properties: {
|
|
44
|
+
authored: { type: 'boolean' }, semantics: { type: 'string' },
|
|
45
|
+
nodes: { type: 'array', items: { type: 'object', properties: {
|
|
46
|
+
id: string, title: { type: 'string' }, type: { type: 'string' }, status: { type: 'string' }, step: { type: 'string' },
|
|
47
|
+
requirements: { type: 'array', items: { type: 'string' } }, components: { type: 'array', items: { type: 'string' } }, checks: { type: 'array', items: { type: 'string' } },
|
|
48
|
+
inputs: { type: 'array', items: { type: 'string' } }, artifacts: { type: 'array', items: { type: 'string' } }, effects: { type: 'array', items: { type: 'string' } }, condition: { type: 'string' },
|
|
49
|
+
}, required: ['id', 'title', 'type', 'status', 'requirements', 'components', 'checks', 'inputs', 'artifacts', 'effects'], additionalProperties: false } },
|
|
50
|
+
edges: { type: 'array', items: { type: 'object', properties: { from: { type: 'string' }, to: { type: 'string' }, kind: { type: 'string' }, label: { type: 'string' }, when: { type: 'string' }, stop: { type: 'string' }, maxAttempts: { type: 'integer' } }, required: ['from', 'to', 'kind'], additionalProperties: false } },
|
|
51
|
+
}, required: ['authored', 'semantics', 'nodes', 'edges'], additionalProperties: false,
|
|
52
|
+
} as const;
|
|
53
|
+
const architectureGraph = {
|
|
54
|
+
type: 'object', properties: {
|
|
55
|
+
nodes: graphNodes, edges: graphEdges,
|
|
56
|
+
ports: { type: 'array', items: { type: 'object', properties: { id: string, owner: string, adapter: string, compositionRoot: string, input: { type: 'string' }, output: { type: 'string' }, errors: { type: 'string' }, injection: { type: 'string' }, testDouble: { type: 'string' }, integrationAssertion: { type: 'string' } }, required: ['id', 'owner', 'adapter', 'compositionRoot', 'input', 'output', 'errors', 'injection', 'testDouble', 'integrationAssertion'], additionalProperties: false } },
|
|
57
|
+
}, required: ['nodes', 'edges', 'ports'], additionalProperties: false,
|
|
58
|
+
} as const;
|
|
59
|
+
const deliveryTruncation = {
|
|
60
|
+
type: 'object', properties: Object.fromEntries(['checks', 'acceptance', 'steps', 'artifacts', 'outputs', 'assumptions', 'scenarios', 'risks', 'workflowNodes', 'workflowEdges', 'architectureNodes', 'architectureEdges', 'architecturePorts'].map(key => [key, { type: 'object', properties: { returned: { type: 'integer' }, total: { type: 'integer' } }, required: ['returned', 'total'], additionalProperties: false }])), required: ['checks', 'acceptance', 'steps', 'artifacts', 'outputs', 'assumptions', 'scenarios', 'risks', 'workflowNodes', 'workflowEdges', 'architectureNodes', 'architectureEdges', 'architecturePorts'], additionalProperties: false,
|
|
61
|
+
} as const;
|
|
62
|
+
const deliveryFullProperties = {
|
|
63
|
+
status: { type: 'string', enum: ['active', 'implementing', 'verifying', 'verified', 'blocked', 'stale'] },
|
|
64
|
+
freshness: { type: 'string', enum: ['current', 'stale'] },
|
|
65
|
+
completion: { type: 'string', enum: ['ready', 'incomplete'] },
|
|
66
|
+
gate: { type: 'string', enum: ['locked', 'open'] },
|
|
67
|
+
runId: string,
|
|
68
|
+
revision: { type: 'integer' },
|
|
69
|
+
fingerprint: { type: 'string', minLength: 64, maxLength: 64 },
|
|
70
|
+
plan: deliveryPlan,
|
|
71
|
+
workflow: workflowGraph,
|
|
72
|
+
architecture: architectureGraph,
|
|
73
|
+
evidence: { type: 'array', items: evidenceItem },
|
|
74
|
+
truncation: deliveryTruncation,
|
|
75
|
+
} as const;
|
|
76
|
+
const deliveryOutput = {
|
|
77
|
+
oneOf: [
|
|
78
|
+
{ type: 'object', properties: deliveryFullProperties, required: Object.keys(deliveryFullProperties), additionalProperties: false },
|
|
79
|
+
{ type: 'object', properties: { status: { type: 'string', enum: ['unavailable', 'invalid'] } }, required: ['status'], additionalProperties: false },
|
|
80
|
+
],
|
|
81
|
+
} as const;
|
|
82
|
+
|
|
83
|
+
/** Shared server/TUI contract. Callers supply the intended native location on every call. */
|
|
84
|
+
export const Workspace = Rpc.define({
|
|
85
|
+
id: 'carthagent.workspace',
|
|
86
|
+
methods: {
|
|
87
|
+
snapshot: {
|
|
88
|
+
input: { type: 'object', properties: { projectID: string }, additionalProperties: false },
|
|
89
|
+
output: {
|
|
90
|
+
type: 'object', properties: {
|
|
91
|
+
projects: { type: 'array', items: project }, tasks: { type: 'array', items: task },
|
|
92
|
+
sessions: { type: 'array', items: session },
|
|
93
|
+
}, required: ['projects', 'tasks', 'sessions'], additionalProperties: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
open: {
|
|
97
|
+
input: sessionInput,
|
|
98
|
+
output: { type: 'object', properties: { opened: { type: 'boolean' }, directory: string }, required: ['opened', 'directory'], additionalProperties: false },
|
|
99
|
+
},
|
|
100
|
+
createWorktree: {
|
|
101
|
+
input: { type: 'object', properties: { projectID: string, name: string }, required: ['projectID', 'name'], additionalProperties: false },
|
|
102
|
+
output: { type: 'object', properties: { directory: string }, required: ['directory'], additionalProperties: false },
|
|
103
|
+
},
|
|
104
|
+
createTask: {
|
|
105
|
+
input: { type: 'object', properties: { task: string, branch: string }, required: ['task'], additionalProperties: false },
|
|
106
|
+
output: { type: 'object', properties: { taskID: string, sessionID: string, directory: string }, required: ['taskID', 'sessionID', 'directory'], additionalProperties: false },
|
|
107
|
+
},
|
|
108
|
+
delivery: {
|
|
109
|
+
input: sessionInput,
|
|
110
|
+
output: deliveryOutput,
|
|
111
|
+
},
|
|
112
|
+
review: {
|
|
113
|
+
input: sessionInput,
|
|
114
|
+
output: { type: 'object', properties: { status: string, summary: { type: 'string' } }, required: ['status'], additionalProperties: false },
|
|
115
|
+
},
|
|
116
|
+
startReview: {
|
|
117
|
+
input: sessionInput,
|
|
118
|
+
output: { type: 'object', properties: { status: string, summary: { type: 'string' }, sessionID: string }, required: ['status', 'summary'], additionalProperties: false },
|
|
119
|
+
errors: {
|
|
120
|
+
reviewFailed: { data: { type: 'object', properties: { message: string }, required: ['message'], additionalProperties: false } },
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
events: {
|
|
125
|
+
updated: { schema: { type: 'object', properties: { revision: string }, required: ['revision'], additionalProperties: false } },
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
export interface WorkspaceSnapshot {
|
|
130
|
+
projects: Array<{ id: string; directory: string; name?: string }>;
|
|
131
|
+
tasks: Array<{ id: string; projectID: string; title: string; status: string; attention?: boolean; directory?: string; branch?: string }>;
|
|
132
|
+
sessions: Array<{ id: string; taskID?: string; projectID?: string; title: string; status: string; updatedAt?: string; directory: string }>;
|
|
133
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@carthagent/native-integration-test-plugin","version":"1.0.0","type":"module","private":true}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2023",
|
|
4
|
+
"lib": ["ES2023", "DOM"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"jsx": "preserve",
|
|
8
|
+
"jsxImportSource": "@opentui/solid",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
"checkJs": false,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"types": ["node"],
|
|
15
|
+
"allowImportingTsExtensions": true,
|
|
16
|
+
"resolveJsonModule": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["*.ts", "src/**/*.ts", "src/**/*.tsx"]
|
|
19
|
+
}
|