@quantiya/codevibe-core 2.0.1 → 2.0.2
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/dist/__tests__/prompt-parser.test.d.ts +1 -0
- package/dist/adapter/registry.d.ts +69 -2
- package/dist/appsync/__tests__/appsync-client-event-source-filter.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client-task-group.test.d.ts +1 -0
- package/dist/appsync/__tests__/cleanup-subscription.test.d.ts +1 -0
- package/dist/appsync/__tests__/coerce-awsjson-and-review-summary.test.d.ts +1 -0
- package/dist/appsync/__tests__/cp1f-quorum-sdk.test.d.ts +1 -0
- package/dist/appsync/__tests__/event-throttle.test.d.ts +1 -0
- package/dist/appsync/appsync-client.d.ts +621 -10
- package/dist/appsync/event-throttle.d.ts +28 -0
- package/dist/appsync/index.d.ts +3 -0
- package/dist/appsync/queries.d.ts +19 -0
- package/dist/audit-keys/index.d.ts +32 -0
- package/dist/auth/auth-service.d.ts +32 -2
- package/dist/auth/auth-telemetry.d.ts +19 -1
- package/dist/auth/index.d.ts +1 -0
- package/dist/companion-mode/persist-preference.d.ts +1 -1
- package/dist/config/config.d.ts +8 -1
- package/dist/continuation/__tests__/dirty-state-collector.test.d.ts +1 -0
- package/dist/continuation/__tests__/integration.test.d.ts +1 -0
- package/dist/continuation/__tests__/packet-reader.test.d.ts +1 -0
- package/dist/continuation/__tests__/packet-writer.test.d.ts +1 -0
- package/dist/continuation/__tests__/parity.test.d.ts +1 -0
- package/dist/continuation/__tests__/status-cli.test.d.ts +1 -0
- package/dist/continuation/dirty-state-collector.d.ts +46 -0
- package/dist/continuation/index.d.ts +8 -0
- package/dist/continuation/packet-reader.d.ts +33 -0
- package/dist/continuation/packet-writer.d.ts +86 -0
- package/dist/continuation/types.d.ts +239 -0
- package/dist/credential-broker/__tests__/broker.test.d.ts +1 -0
- package/dist/credential-broker/__tests__/canonical.test.d.ts +1 -0
- package/dist/credential-broker/__tests__/scrubber.test.d.ts +1 -0
- package/dist/credential-broker/__tests__/upstream-client.test.d.ts +1 -0
- package/dist/credential-broker/__tests__/vendor-key-store.test.d.ts +1 -0
- package/dist/credential-broker/audit-sink.d.ts +69 -0
- package/dist/credential-broker/broker-config.d.ts +39 -0
- package/dist/credential-broker/broker-token.d.ts +123 -0
- package/dist/credential-broker/broker.d.ts +165 -0
- package/dist/credential-broker/canonical.d.ts +119 -0
- package/dist/credential-broker/index.d.ts +15 -0
- package/dist/credential-broker/scrubber.d.ts +45 -0
- package/dist/credential-broker/types.d.ts +141 -0
- package/dist/credential-broker/upstream-client.d.ts +20 -0
- package/dist/credential-broker/vendor-key-store.d.ts +54 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +427 -124
- package/dist/keychain/__tests__/keychain-backend.test.d.ts +1 -0
- package/dist/keychain/keychain-backend.d.ts +82 -0
- package/dist/local-executor/__tests__/agentic-disposable-repo.test.d.ts +1 -0
- package/dist/local-executor/__tests__/agentic-resolve.test.d.ts +1 -0
- package/dist/local-executor/__tests__/agentic-resolver-flag.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class-a-sign.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class1-reconcilers.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class2-resolver.test.d.ts +1 -0
- package/dist/local-executor/__tests__/confined-model-caller.test.d.ts +1 -0
- package/dist/local-executor/__tests__/conflict-classifier.test.d.ts +1 -0
- package/dist/local-executor/__tests__/conflict-resolution-durable-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/conflict-resolution-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/cp1f-quorum-consumer.test.d.ts +1 -0
- package/dist/local-executor/__tests__/cp7-audit-writer.test.d.ts +1 -0
- package/dist/local-executor/__tests__/durable-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/git-lock-retry.test.d.ts +1 -0
- package/dist/local-executor/__tests__/implementor-argv.test.d.ts +1 -0
- package/dist/local-executor/__tests__/local-executor-teams.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-conflict-extract.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-conflict-git.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-conflict-resolve-agentic.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-conflict-resolve.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-journal-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-train-agentic-recovery.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-train-w3.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-train-waveb.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-train.test.d.ts +1 -0
- package/dist/local-executor/__tests__/promote-wal-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/revert-reconcile.test.d.ts +1 -0
- package/dist/local-executor/__tests__/revert-runner.test.d.ts +1 -0
- package/dist/local-executor/__tests__/shared-contract-detector.test.d.ts +1 -0
- package/dist/local-executor/__tests__/substrate-engage.test.d.ts +1 -0
- package/dist/local-executor/__tests__/team-execution-flag.test.d.ts +1 -0
- package/dist/local-executor/__tests__/track-registry.test.d.ts +1 -0
- package/dist/local-executor/__tests__/wb2-review-bundle.test.d.ts +1 -0
- package/dist/local-executor/__tests__/wb2-substrate-spawn.live.test.d.ts +1 -0
- package/dist/local-executor/__tests__/workspace-shadow.test.d.ts +1 -0
- package/dist/local-executor/__tests__/worktree-merge.test.d.ts +1 -0
- package/dist/local-executor/agentic-disposable-repo.d.ts +52 -0
- package/dist/local-executor/agentic-resolve.d.ts +54 -0
- package/dist/local-executor/agentic-resolver-flag.d.ts +9 -0
- package/dist/local-executor/authority.d.ts +33 -1
- package/dist/local-executor/class-a-emit.d.ts +3 -1
- package/dist/local-executor/class-a-sign.d.ts +57 -0
- package/dist/local-executor/class-b-consumer.d.ts +159 -4
- package/dist/local-executor/class-b-verify.d.ts +30 -0
- package/dist/local-executor/class1-reconcilers.d.ts +58 -0
- package/dist/local-executor/class2-resolver.d.ts +74 -0
- package/dist/local-executor/confined-model-caller.d.ts +39 -0
- package/dist/local-executor/conflict-classifier.d.ts +21 -0
- package/dist/local-executor/conflict-resolution-durable-store.d.ts +61 -0
- package/dist/local-executor/conflict-resolution-store.d.ts +210 -0
- package/dist/local-executor/conflict-types.d.ts +86 -0
- package/dist/local-executor/cp7-audit-writer.d.ts +152 -0
- package/dist/local-executor/durable-store.d.ts +334 -0
- package/dist/local-executor/git-lock-retry.d.ts +40 -0
- package/dist/local-executor/hook-bridge.d.ts +1 -1
- package/dist/local-executor/implementor-argv.d.ts +183 -0
- package/dist/local-executor/index.d.ts +44 -3
- package/dist/local-executor/local-executor-impl.d.ts +645 -4
- package/dist/local-executor/merge-conflict-extract.d.ts +34 -0
- package/dist/local-executor/merge-conflict-resolve.d.ts +101 -0
- package/dist/local-executor/merge-journal-store.d.ts +311 -0
- package/dist/local-executor/merge-train.d.ts +713 -0
- package/dist/local-executor/promote-wal-store.d.ts +301 -0
- package/dist/local-executor/resolution-set-index.d.ts +51 -0
- package/dist/local-executor/revert-reconcile.d.ts +89 -0
- package/dist/local-executor/revert-runner.d.ts +17 -0
- package/dist/local-executor/shared-contract-detector.d.ts +57 -0
- package/dist/local-executor/spawn.d.ts +29 -1
- package/dist/local-executor/task-group-types.d.ts +346 -0
- package/dist/local-executor/team-execution-flag.d.ts +21 -0
- package/dist/local-executor/track-registry.d.ts +50 -0
- package/dist/local-executor/types.d.ts +238 -4
- package/dist/local-executor/wb2-review-bundle.d.ts +59 -0
- package/dist/local-executor/workspace-shadow.d.ts +290 -0
- package/dist/local-executor/worktree-merge.d.ts +601 -0
- package/dist/local-model/__tests__/installer.test.d.ts +1 -0
- package/dist/local-model/__tests__/manager.test.d.ts +1 -0
- package/dist/local-model/__tests__/ollama.test.d.ts +1 -0
- package/dist/local-model/__tests__/runtime.test.d.ts +1 -0
- package/dist/local-model/__tests__/state.test.d.ts +1 -0
- package/dist/local-model/manager.d.ts +119 -0
- package/dist/local-model/ollama.d.ts +27 -0
- package/dist/local-model/runtime.d.ts +27 -0
- package/dist/local-model/state.d.ts +32 -0
- package/dist/orchestration/detect-agents.d.ts +15 -2
- package/dist/orchestration/setup-types.d.ts +2 -1
- package/dist/orchestration-shell/__tests__/attachments.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/audit-browser.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/audited-path-fixes.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/bracketed-paste.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-group-halt-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-orchestration-session-bootstrap.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-probe-group-status.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-quorum-loop-tier.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-verdict-classifier-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-store.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp10-585-accept-echo-target.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp10-585-loop.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp10-585-prompts.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp12-w2b-team-loop.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp12-w4-team-recovery.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp1f-quorum-loop.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp606-team-track-user-resolved.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp7-reviewer-substrate.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/declared-test-runner.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/familiarize-routing.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/gate-decision-submit.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/gate-details-panel.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/gate-verdict-details-dispatch.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/group-decision-submit.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/image-attach-e2e.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/input-bar-autocomplete.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/live-region-cap.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/live-static-order.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/model-cli.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/non-gate-prompt-routing.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/orchestration-app-group-decision-transport.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/orchestration-app-layout.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/reissue-team-retained-spec.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/review-summary-render.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/reviewer-wizard.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/reviewers-format.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/root-discovery.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/serialize-submissions.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/slash-suggest.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/status-format.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/task-progress.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/team-decompose-routing.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/team-decompose-types.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/team-decompose.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/team-e2e-smoke.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/tier2-reviewer-selection.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/web-browsing.test.d.ts +1 -0
- package/dist/orchestration-shell/attachments.d.ts +152 -0
- package/dist/orchestration-shell/audit-browser.d.ts +115 -0
- package/dist/orchestration-shell/audit-runner.d.ts +59 -0
- package/dist/orchestration-shell/bracketed-paste.d.ts +26 -0
- package/dist/orchestration-shell/cli.d.ts +336 -1
- package/dist/orchestration-shell/cli.js +39318 -3436
- package/dist/orchestration-shell/components/AuditLogPanel.d.ts +11 -0
- package/dist/orchestration-shell/components/ConversationPane.d.ts +7 -1
- package/dist/orchestration-shell/components/GateDetailsPanel.d.ts +57 -0
- package/dist/orchestration-shell/components/GatePanelEntry.d.ts +9 -0
- package/dist/orchestration-shell/components/GatePromptEntry.d.ts +7 -0
- package/dist/orchestration-shell/components/InputBar.d.ts +17 -3
- package/dist/orchestration-shell/components/LiveProgressLine.d.ts +8 -0
- package/dist/orchestration-shell/components/MultiTrackStatusNode.d.ts +8 -0
- package/dist/orchestration-shell/components/OrchestrationApp.d.ts +81 -15
- package/dist/orchestration-shell/components/ReviewerSetupWizard.d.ts +24 -0
- package/dist/orchestration-shell/components/StatusBar.d.ts +15 -2
- package/dist/orchestration-shell/context-store.d.ts +389 -0
- package/dist/orchestration-shell/declared-test-runner.d.ts +84 -0
- package/dist/orchestration-shell/emit-shell-event.d.ts +1 -1
- package/dist/orchestration-shell/gate-decision-submit.d.ts +245 -0
- package/dist/orchestration-shell/gate-prompts.d.ts +361 -3
- package/dist/orchestration-shell/index.d.ts +613 -1
- package/dist/orchestration-shell/ink-runtime.d.ts +21 -1
- package/dist/orchestration-shell/live-region-cap.d.ts +70 -0
- package/dist/orchestration-shell/live-static-order.d.ts +22 -0
- package/dist/orchestration-shell/non-tty-fallback.d.ts +21 -0
- package/dist/orchestration-shell/quorum-loop.d.ts +1900 -0
- package/dist/orchestration-shell/root-discovery.d.ts +25 -0
- package/dist/orchestration-shell/route-browse.d.ts +20 -0
- package/dist/orchestration-shell/slash-router.d.ts +20 -1
- package/dist/orchestration-shell/slash-routes/continuation.d.ts +71 -0
- package/dist/orchestration-shell/slash-routes/reviewers.d.ts +41 -0
- package/dist/orchestration-shell/slash-suggest.d.ts +29 -0
- package/dist/orchestration-shell/status-format.d.ts +59 -0
- package/dist/orchestration-shell/task-progress.d.ts +122 -0
- package/dist/orchestration-shell/team-decompose.d.ts +196 -0
- package/dist/orchestration-shell/types.d.ts +363 -3
- package/dist/orchestration-shell/vendor/ink-parse-keypress.d.ts +42 -0
- package/dist/orchestration-shell/web/extract.d.ts +11 -0
- package/dist/orchestration-shell/web/fetch.d.ts +15 -0
- package/dist/orchestration-shell/web/ip.d.ts +26 -0
- package/dist/orchestration-shell/web/sanitize.d.ts +14 -0
- package/dist/orchestration-shell/web/search.d.ts +16 -0
- package/dist/planner/__tests__/local-gemma.test.d.ts +1 -0
- package/dist/planner/index.d.ts +2 -0
- package/dist/planner/local-advisory.d.ts +84 -0
- package/dist/planner/local-gemma.d.ts +23 -0
- package/dist/planner/types.d.ts +16 -6
- package/dist/reviewer/__tests__/antigravity-provider.test.d.ts +1 -0
- package/dist/reviewer/__tests__/claude-provider-json.test.d.ts +1 -0
- package/dist/reviewer/__tests__/cp7-reviewer-sandbox.test.d.ts +1 -0
- package/dist/reviewer/__tests__/output-parser-classifier-helpers.test.d.ts +1 -0
- package/dist/reviewer/__tests__/verdict-classifier.test.d.ts +1 -0
- package/dist/reviewer/index.d.ts +2 -0
- package/dist/reviewer/output-parser.d.ts +48 -12
- package/dist/reviewer/provider.d.ts +107 -3
- package/dist/reviewer/providers/__tests__/failure-classifier.test.d.ts +1 -0
- package/dist/reviewer/providers/antigravity.d.ts +49 -0
- package/dist/reviewer/providers/claude.d.ts +19 -4
- package/dist/reviewer/providers/codex.d.ts +47 -5
- package/dist/reviewer/providers/failure-classifier.d.ts +26 -0
- package/dist/reviewer/providers/gemini.d.ts +5 -4
- package/dist/reviewer/registry.d.ts +5 -5
- package/dist/reviewer/subprocess.d.ts +37 -0
- package/dist/reviewer/token-usage.d.ts +32 -0
- package/dist/reviewer/types.d.ts +5 -5
- package/dist/reviewer/verdict-classifier.d.ts +62 -0
- package/dist/session/__tests__/prepare-event-timestamp.test.d.ts +1 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/session/prepare-event-timestamp.d.ts +30 -0
- package/dist/substrate/__tests__/docker.test.d.ts +1 -0
- package/dist/substrate/__tests__/forwarder.test.d.ts +1 -0
- package/dist/substrate/__tests__/git-proxy.test.d.ts +1 -0
- package/dist/substrate/__tests__/sandbox-exec.test.d.ts +1 -0
- package/dist/substrate/__tests__/substrate-e2e.integration.test.d.ts +1 -0
- package/dist/substrate/command-runner.d.ts +19 -0
- package/dist/substrate/docker.d.ts +134 -0
- package/dist/substrate/errors.d.ts +33 -0
- package/dist/substrate/forwarder.d.ts +67 -0
- package/dist/substrate/git-proxy.d.ts +35 -0
- package/dist/substrate/index.d.ts +12 -0
- package/dist/substrate/relay-script.d.ts +27 -0
- package/dist/substrate/sandbox-exec.d.ts +116 -0
- package/dist/substrate/types.d.ts +218 -0
- package/dist/substrate-launch/__tests__/apikey-bootstrap.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/creditless-loop.integration.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/engage-substrate.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/fallback-ladder.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/le-env-scrub.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/sanitized-env.test.d.ts +1 -0
- package/dist/substrate-launch/apikey-bootstrap.d.ts +84 -0
- package/dist/substrate-launch/engage-substrate.d.ts +102 -0
- package/dist/substrate-launch/fallback-ladder.d.ts +49 -0
- package/dist/substrate-launch/index.d.ts +12 -0
- package/dist/substrate-launch/le-env-scrub.d.ts +77 -0
- package/dist/substrate-launch/sanitized-env.d.ts +73 -0
- package/dist/types/auth.d.ts +6 -1
- package/dist/types/events.d.ts +3 -1
- package/dist/types/reviewer.d.ts +6 -6
- package/package.json +7 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { StructuralSummary } from '../structural-summary/types';
|
|
2
|
+
export interface LocalGemmaAdvisoryRunner {
|
|
3
|
+
generateAdvisory(promptText: string, options?: LocalGemmaAdvisoryOptions): Promise<string>;
|
|
4
|
+
runtimeLabel: string;
|
|
5
|
+
}
|
|
6
|
+
export type LocalGemmaAdvisoryResponseFormat = 'json' | 'text';
|
|
7
|
+
export interface LocalGemmaAdvisoryOptions {
|
|
8
|
+
responseFormat?: LocalGemmaAdvisoryResponseFormat;
|
|
9
|
+
numPredict?: number;
|
|
10
|
+
/**
|
|
11
|
+
* RAW base64 images (NO `data:` prefix) for the MULTIMODAL local answerer
|
|
12
|
+
* (IMAGE-ATTACHMENT-DESIGN.md §6). Set ONLY by the shell's `routeAdvisory` /
|
|
13
|
+
* image-brainstorm with `responseFormat:'text'`. The Ollama runtime forwards
|
|
14
|
+
* these to `/api/generate images[]`; the subprocess `LocalGemmaProcessRunner`
|
|
15
|
+
* has no image channel and IGNORES them (documented no-op, §6 Role B). NEVER set
|
|
16
|
+
* on the classifier (forced-JSON) or on `browse`/`familiarize`.
|
|
17
|
+
*/
|
|
18
|
+
images?: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function redactAbsoluteLocalPaths(text: string): string;
|
|
21
|
+
export declare function renderLocalGemmaFamiliarizePrompt(args: {
|
|
22
|
+
userPrompt: string;
|
|
23
|
+
summary: StructuralSummary;
|
|
24
|
+
}): string;
|
|
25
|
+
/**
|
|
26
|
+
* WEB-BROWSING (docs/WEB-BROWSING-DESIGN.md): build the advisory prompt for a
|
|
27
|
+
* fetched web page. The model ANSWERS THE USER'S QUESTION grounded in the fetched
|
|
28
|
+
* content. `content`/`title`/`url` are ALREADY terminal-sanitized by the caller;
|
|
29
|
+
* here we additionally treat them as untrusted DATA in the prompt.
|
|
30
|
+
*
|
|
31
|
+
* Dogfood-tuned against the real local model (see MAX_BROWSE_CONTENT_CHARS): the prompt
|
|
32
|
+
* is deliberately CONCISE + title-pointing — a long, heavily-instructed prompt makes the
|
|
33
|
+
* small model WORSE (it ignores the answer and over-cautiously refuses or invents). The
|
|
34
|
+
* model answers in PROSE (caller uses responseFormat:'text'); `parseLocalGemmaBrowseSummary`
|
|
35
|
+
* tolerates either prose or JSON. The title/content stay in the JSON DATA payload (escaped
|
|
36
|
+
* — also defeats label-spoofing) and are NEVER interpolated into the instruction prose.
|
|
37
|
+
*
|
|
38
|
+
* Budget: cap title/url/userPrompt + content (lead), then SHRINK on ACTUAL rendered length
|
|
39
|
+
* (JSON.stringify can expand quote/backslash-heavy text) so the emitted JSON stays valid.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderLocalGemmaBrowsePrompt(args: {
|
|
42
|
+
userPrompt: string;
|
|
43
|
+
source: {
|
|
44
|
+
url: string;
|
|
45
|
+
title: string;
|
|
46
|
+
};
|
|
47
|
+
content: string;
|
|
48
|
+
}): string;
|
|
49
|
+
/**
|
|
50
|
+
* WEB-BROWSING (search-route): turn the user's request + recent conversation into a
|
|
51
|
+
* concise web-search QUERY. The local model resolves acronyms/pronouns from context
|
|
52
|
+
* (e.g. "do a web search on ACP" + a prior turn defining "Agent Client Protocol" →
|
|
53
|
+
* "ACP Agent Client Protocol") — replacing the old brittle regex that searched the raw
|
|
54
|
+
* command sentence. Dogfood-validated against the real local model (gemma4 8B): produces
|
|
55
|
+
* context-aware terms, and clean terms when there's no useful context.
|
|
56
|
+
*
|
|
57
|
+
* The output is a short keyword string used ONLY as a DDG search query — the caller
|
|
58
|
+
* sanitizes + path-redacts + caps it. Prior turns are the user's OWN conversation (already
|
|
59
|
+
* sanitized at ingest); the prompt asks for a query only and is framed as untrusted data.
|
|
60
|
+
*/
|
|
61
|
+
export declare function renderLocalGemmaSearchQueryPrompt(args: {
|
|
62
|
+
userPrompt: string;
|
|
63
|
+
priorTurns?: string[];
|
|
64
|
+
}): string;
|
|
65
|
+
export declare function renderLocalGemmaBrainstormPrompt(args: {
|
|
66
|
+
userPrompt: string;
|
|
67
|
+
summary?: StructuralSummary | null;
|
|
68
|
+
priorTurns?: string[];
|
|
69
|
+
}): string;
|
|
70
|
+
export declare function brainstormPromptRequestsCommandGuidance(text: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* WEB-BROWSING (search-route hardening): a LENIENT summary parse for the browse
|
|
73
|
+
* route. Unlike `parseLocalGemmaAdvisorySummary` (which hard-rejects any key
|
|
74
|
+
* besides `summary`), the model summarizing a content-rich page often adds extra
|
|
75
|
+
* keys (`version`, `key_points`, …) — that should NOT hard-fail the answer. We
|
|
76
|
+
* extract `summary` if present, else the longest string field, else the
|
|
77
|
+
* stringified object as a last resort; then redact + cap. Throws only if there's
|
|
78
|
+
* genuinely no usable text. The browse caller now uses `{responseFormat:'text'}`, so
|
|
79
|
+
* PROSE (the raw-text fallback) is the common path; a JSON object is still tolerated if
|
|
80
|
+
* the model emits one.
|
|
81
|
+
*/
|
|
82
|
+
export declare function parseLocalGemmaBrowseSummary(raw: string): string;
|
|
83
|
+
export declare function parseLocalGemmaAdvisorySummary(raw: string): string;
|
|
84
|
+
export declare function parseLocalGemmaBrainstormSummary(raw: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PlannerAdapter } from './adapter';
|
|
2
|
+
import type { LocalGemmaAdvisoryRunner } from './local-advisory';
|
|
3
|
+
import type { PlannerDecision, PlannerInput, PlannerProbeResult } from './types';
|
|
4
|
+
export interface LocalGemmaPlannerRunner {
|
|
5
|
+
classify(promptText: string): Promise<string>;
|
|
6
|
+
generateAdvisory?: LocalGemmaAdvisoryRunner['generateAdvisory'];
|
|
7
|
+
probe?(): Promise<PlannerProbeResult>;
|
|
8
|
+
runtimeLabel: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Text-only route classifier prompt. It intentionally excludes repository
|
|
12
|
+
* paths, summaries, source snippets, file bodies, and the raw structural digest.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderLocalGemmaPlannerPrompt(input: PlannerInput): string;
|
|
15
|
+
export declare function parseLocalGemmaPlannerDecision(raw: string): PlannerDecision;
|
|
16
|
+
export declare class LocalGemmaPlannerAdapter implements PlannerAdapter {
|
|
17
|
+
private readonly runner;
|
|
18
|
+
private activeSessionId;
|
|
19
|
+
constructor(runner: LocalGemmaPlannerRunner);
|
|
20
|
+
classify(input: PlannerInput): Promise<PlannerDecision>;
|
|
21
|
+
probe(): Promise<PlannerProbeResult>;
|
|
22
|
+
setActiveSession(sessionId: string | null): void;
|
|
23
|
+
}
|
package/dist/planner/types.d.ts
CHANGED
|
@@ -18,16 +18,16 @@ export declare const SessionContextSchema: z.ZodObject<{
|
|
|
18
18
|
}, "strip", z.ZodTypeAny, {
|
|
19
19
|
sessionId: string;
|
|
20
20
|
userId: string;
|
|
21
|
-
structuralSummaryDigest: string;
|
|
22
21
|
tier: "FREE" | "PRO" | "MAX";
|
|
23
22
|
currentTaskState: "none" | "merge_gate_pending" | "in_progress" | "awaiting_user" | "awaiting_review";
|
|
23
|
+
structuralSummaryDigest: string;
|
|
24
24
|
recentEventCount: number;
|
|
25
25
|
}, {
|
|
26
26
|
sessionId: string;
|
|
27
27
|
userId: string;
|
|
28
|
-
structuralSummaryDigest: string;
|
|
29
28
|
tier: "FREE" | "PRO" | "MAX";
|
|
30
29
|
currentTaskState: "none" | "merge_gate_pending" | "in_progress" | "awaiting_user" | "awaiting_review";
|
|
30
|
+
structuralSummaryDigest: string;
|
|
31
31
|
recentEventCount: number;
|
|
32
32
|
}>;
|
|
33
33
|
export interface BudgetHint {
|
|
@@ -65,30 +65,40 @@ export interface PlannerInput {
|
|
|
65
65
|
budgetHint: BudgetHint;
|
|
66
66
|
}
|
|
67
67
|
export interface PlannerDecision {
|
|
68
|
-
action: 'start_task' | 'summarize_current_status' | 'advisory_response' | 'ask_user' | 'refuse';
|
|
68
|
+
action: 'start_task' | 'summarize_current_status' | 'advisory_response' | 'ask_user' | 'refuse' | 'team_decompose' | 'familiarize' | 'brainstorm' | 'browse';
|
|
69
69
|
rationale: string;
|
|
70
70
|
clarifying_question?: string;
|
|
71
71
|
advisory_summary?: string;
|
|
72
|
+
/** WEB-BROWSING — explicit http(s) URLs to read (validated/guarded downstream). */
|
|
73
|
+
browseUrls?: string[];
|
|
74
|
+
/** WEB-BROWSING — a web-search query when no explicit URL is given. */
|
|
75
|
+
browseQuery?: string;
|
|
72
76
|
/** Opaque per parent §6 lines 967-972; CP-1 NEVER inspects fields. */
|
|
73
77
|
gateRequest?: Record<string, unknown>;
|
|
74
78
|
}
|
|
75
79
|
export declare const PlannerDecisionSchema: z.ZodObject<{
|
|
76
|
-
action: z.ZodEnum<["start_task", "summarize_current_status", "advisory_response", "ask_user", "refuse"]>;
|
|
80
|
+
action: z.ZodEnum<["start_task", "summarize_current_status", "advisory_response", "ask_user", "refuse", "team_decompose", "familiarize", "brainstorm", "browse"]>;
|
|
77
81
|
rationale: z.ZodString;
|
|
78
82
|
clarifying_question: z.ZodOptional<z.ZodString>;
|
|
79
83
|
advisory_summary: z.ZodOptional<z.ZodString>;
|
|
84
|
+
browseUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
85
|
+
browseQuery: z.ZodOptional<z.ZodString>;
|
|
80
86
|
gateRequest: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
87
|
}, "strip", z.ZodTypeAny, {
|
|
82
|
-
action: "start_task" | "summarize_current_status" | "advisory_response" | "ask_user" | "refuse";
|
|
88
|
+
action: "start_task" | "summarize_current_status" | "advisory_response" | "ask_user" | "refuse" | "team_decompose" | "familiarize" | "brainstorm" | "browse";
|
|
83
89
|
rationale: string;
|
|
84
90
|
clarifying_question?: string | undefined;
|
|
85
91
|
advisory_summary?: string | undefined;
|
|
92
|
+
browseUrls?: string[] | undefined;
|
|
93
|
+
browseQuery?: string | undefined;
|
|
86
94
|
gateRequest?: Record<string, unknown> | undefined;
|
|
87
95
|
}, {
|
|
88
|
-
action: "start_task" | "summarize_current_status" | "advisory_response" | "ask_user" | "refuse";
|
|
96
|
+
action: "start_task" | "summarize_current_status" | "advisory_response" | "ask_user" | "refuse" | "team_decompose" | "familiarize" | "brainstorm" | "browse";
|
|
89
97
|
rationale: string;
|
|
90
98
|
clarifying_question?: string | undefined;
|
|
91
99
|
advisory_summary?: string | undefined;
|
|
100
|
+
browseUrls?: string[] | undefined;
|
|
101
|
+
browseQuery?: string | undefined;
|
|
92
102
|
gateRequest?: Record<string, unknown> | undefined;
|
|
93
103
|
}>;
|
|
94
104
|
export interface PlannerProbeResult {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/reviewer/index.d.ts
CHANGED
|
@@ -11,5 +11,7 @@ export type { GeminiEnvelope, GeminiModelStats, GeminiReviewerProviderOptions, G
|
|
|
11
11
|
export { GeminiReviewerProvider } from './providers/gemini.js';
|
|
12
12
|
export type { CodexReviewerProviderOptions } from './providers/codex.js';
|
|
13
13
|
export { CodexReviewerProvider } from './providers/codex.js';
|
|
14
|
+
export type { AntigravityReviewerProviderOptions } from './providers/antigravity.js';
|
|
15
|
+
export { AntigravityReviewerProvider } from './providers/antigravity.js';
|
|
14
16
|
export { ReviewerRegistry, createSubprocessReviewerRegistry, } from './registry.js';
|
|
15
17
|
export { MockReviewerSpawner, StaticReviewerMock } from './mocks.js';
|
|
@@ -33,14 +33,14 @@ export type VerdictParseError = {
|
|
|
33
33
|
kind: 'empty_output';
|
|
34
34
|
} | {
|
|
35
35
|
/**
|
|
36
|
-
* The first non-blank line
|
|
37
|
-
* verdict keywords (case-insensitive).
|
|
38
|
-
*
|
|
39
|
-
*
|
|
36
|
+
* The first non-blank line could not be reduced to one of the four
|
|
37
|
+
* verdict keywords (case-insensitive). Harmless wrappers/labels such as
|
|
38
|
+
* `**APPROVE**` and `VERDICT: APPROVE` are accepted; prose prefaces are
|
|
39
|
+
* still rejected.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* Under the relaxed contract this fires ONLY on the FIRST non-blank
|
|
42
|
+
* line — trailing/interleaved prose AFTER a bulleted list no longer
|
|
43
|
+
* errors (it is folded into `reasoning`; see the module header).
|
|
44
44
|
*/
|
|
45
45
|
kind: 'invalid_verdict';
|
|
46
46
|
/** The offending line, trimmed but otherwise verbatim. */
|
|
@@ -52,8 +52,11 @@ export type VerdictParseError = {
|
|
|
52
52
|
* line is a parse failure. */
|
|
53
53
|
kind: 'reasoning_missing';
|
|
54
54
|
} | {
|
|
55
|
-
/** Verdict was REVISE but no
|
|
56
|
-
*
|
|
55
|
+
/** Verdict was REVISE but no concrete change could be found — neither a
|
|
56
|
+
* bulleted suggested-changes list NOR fallback prose (#581). REVISE
|
|
57
|
+
* requires at least one concrete change; in practice this is
|
|
58
|
+
* unreachable because `reasoning_missing` already rejects a REVISE with
|
|
59
|
+
* no prose, but the variant is kept as a fail-closed guard. */
|
|
57
60
|
kind: 'revise_missing_changes';
|
|
58
61
|
} | {
|
|
59
62
|
/** A non-REVISE verdict was followed by a bulleted list, which the
|
|
@@ -87,9 +90,42 @@ export type ParseResult = {
|
|
|
87
90
|
/**
|
|
88
91
|
* Parse a reviewer reply. Strict: any deviation from the locked format
|
|
89
92
|
* returns `{ ok: false, error: ... }` which the subprocess layer routes to
|
|
90
|
-
* a parse-failure `ReviewerError`.
|
|
93
|
+
* a parse-failure `ReviewerError`. The ONE deliberate relaxation is the #581
|
|
94
|
+
* REVISE-prose leniency documented in the module header.
|
|
91
95
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
96
|
+
* Was a byte-for-byte port of Rust's `parse_verdict_output`; the #581
|
|
97
|
+
* leniency is a TS-only divergence (this is the live path — the Rust parser
|
|
98
|
+
* is legacy/off-path). The shared-with-Rust test set is preserved verbatim;
|
|
99
|
+
* the #581 leniency tests are TS-additive.
|
|
94
100
|
*/
|
|
95
101
|
export declare function parseVerdictOutput(raw: string): ParseResult;
|
|
102
|
+
/**
|
|
103
|
+
* [Gemma classifier · D5] Extract `suggested_changes` from a REVISE reviewer's
|
|
104
|
+
* (verdict-STRIPPED) reasoning, mirroring `parseVerdictOutput`'s BULLETS-FIRST-
|
|
105
|
+
* ELSE-PROSE behavior (a bare `deriveChangesFromProse` would fold `- `/`* `
|
|
106
|
+
* bullet lists into one paragraph, LOSING structure). Collect `- `/`* ` bullets
|
|
107
|
+
* (dropping empties, folding indented continuations, treating trailing non-indented
|
|
108
|
+
* prose as commentary NOT a change); if any bullet was found, return them; else
|
|
109
|
+
* fall back to `deriveChangesFromProse` (numbered-list / paragraph derivation).
|
|
110
|
+
* Empty result ⇒ the caller downgrades REVISE → ESCALATE (fail-closed).
|
|
111
|
+
*/
|
|
112
|
+
export declare function extractSuggestedChanges(reasoning: string): string[];
|
|
113
|
+
/**
|
|
114
|
+
* [Gemma classifier · D2a] The verdict KIND of a line iff it is a STANDALONE
|
|
115
|
+
* verdict line — `parseVerdictToken` (which strips the `VERDICT:`/`DECISION:`
|
|
116
|
+
* label, markdown wrappers, and trailing punctuation) parses it AND it carries NO
|
|
117
|
+
* inline reasoning. So `APPROVE`, `**APPROVE**`, `VERDICT: APPROVE`, `APPROVE.`
|
|
118
|
+
* → their kind; `APPROVE because the tests pass` → `null` (inline reasoning). Used
|
|
119
|
+
* by the classifier's deterministic conflicting-verdict guard + `postVerdictReasoning`.
|
|
120
|
+
*/
|
|
121
|
+
export declare function standaloneVerdictKind(line: string): VerdictKind | null;
|
|
122
|
+
/**
|
|
123
|
+
* [Gemma classifier · D5/HIGH-A] The reviewer's post-verdict reasoning for change
|
|
124
|
+
* derivation: the text AFTER the FIRST standalone verdict line (dropping the
|
|
125
|
+
* pre-verdict preamble + the verdict line), with any REMAINING standalone verdict
|
|
126
|
+
* lines removed; if there is NO standalone verdict line (Gemma inferred the verdict
|
|
127
|
+
* from non-standalone text), the whole `rawText`. Mirrors the shipped parser, which
|
|
128
|
+
* only ever sees verdict-stripped `reasoning` — feeding raw text to change
|
|
129
|
+
* derivation would promote the preamble + the verdict token to bogus changes.
|
|
130
|
+
*/
|
|
131
|
+
export declare function postVerdictReasoning(rawText: string): string;
|
|
@@ -1,4 +1,68 @@
|
|
|
1
|
+
import type { SubstrateHandle } from '../substrate/types.js';
|
|
2
|
+
import type { VerdictClassifier } from './verdict-classifier.js';
|
|
1
3
|
import type { AgentKind, ReviewerRole, ReviewerVerdict } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* CP-7 §8 (Stage-1-resolved) — per-evaluate options threaded from the live
|
|
6
|
+
* caller (`QuorumLoop.spawnOneSeat`) down through the registry into the
|
|
7
|
+
* provider. Today it carries ONLY the optional CP-7 substrate handle; it is an
|
|
8
|
+
* options object (not a positional arg) so future per-evaluate knobs do not
|
|
9
|
+
* churn every provider signature.
|
|
10
|
+
*
|
|
11
|
+
* # Why this is NOT on `ReviewerSpec`
|
|
12
|
+
*
|
|
13
|
+
* `ReviewerSpec` is a wire-format DATA struct (snake_case, echoed into the
|
|
14
|
+
* audit log + FFI). A live `SubstrateHandle` is a runtime resource (broker +
|
|
15
|
+
* sandbox lifecycle) that must NEVER be serialized — keeping it on a separate
|
|
16
|
+
* non-wire options object preserves the spec's data-only contract.
|
|
17
|
+
*/
|
|
18
|
+
export interface ReviewerEvaluateOptions {
|
|
19
|
+
/**
|
|
20
|
+
* CP-7 §8 — when present, the reviewer runs INSIDE the CP-7 trusted-execution
|
|
21
|
+
* sandbox + broker (no ambient vendor creds; model call via the loopback
|
|
22
|
+
* broker), exactly like a substrate-confined implementor. The provider
|
|
23
|
+
* forwards it to `runReviewer({ …, substrate })` AND drops the
|
|
24
|
+
* `{...process.env}` env spread in its `buildCommand` (the env is pre-baked
|
|
25
|
+
* sanitized at `substrate.launch()`). ABSENT → the legacy unsandboxed path
|
|
26
|
+
* (byte-identical to pre-CP-7-reviewer-sandbox behavior).
|
|
27
|
+
*/
|
|
28
|
+
substrate?: SubstrateHandle;
|
|
29
|
+
/**
|
|
30
|
+
* CP-7 reviewer-sandbox fix — the HOST path of the substrate workdir (the
|
|
31
|
+
* sandboxed child's cwd). REQUIRED in practice whenever {@link substrate} is
|
|
32
|
+
* present for the Codex provider, which writes its verdict via `codex exec
|
|
33
|
+
* --output-last-message <path>`: on the sandbox path that file MUST live in
|
|
34
|
+
* the sandbox-writable + host-readable workdir, NOT `os.tmpdir()` (which the
|
|
35
|
+
* A1 container does not mount and the A5 Seatbelt profile does not grant for
|
|
36
|
+
* writes). The provider passes a RELATIVE filename to codex (codex's cwd ==
|
|
37
|
+
* the workdir on BOTH backends — A5 `cwd: workdir`; Docker `docker exec -w
|
|
38
|
+
* /workspace`) and reads it back from `<workdir>/<name>` on the host (the same
|
|
39
|
+
* inode, even when A5 canonicalizes the workdir — the host read follows the
|
|
40
|
+
* symlink). The Claude / Gemini providers do not use a file output, so they
|
|
41
|
+
* ignore this field. ABSENT (legacy path / non-substrate) → the provider uses
|
|
42
|
+
* its byte-identical legacy `os.tmpdir()` location.
|
|
43
|
+
*
|
|
44
|
+
* # Why this is NOT derivable from `substrate`
|
|
45
|
+
*
|
|
46
|
+
* `SubstrateHandle` (a runtime resource) deliberately does NOT expose the
|
|
47
|
+
* workdir — it is a launch-time input the caller already holds. Threading the
|
|
48
|
+
* host workdir here (the loop's `workingDir`, the very value it engages the
|
|
49
|
+
* substrate with) keeps the handle's surface minimal.
|
|
50
|
+
*/
|
|
51
|
+
workdir?: string;
|
|
52
|
+
/**
|
|
53
|
+
* REVIEWER-VERDICT-GEMMA-CLASSIFIER-DESIGN.md (D1) — when present, the provider's
|
|
54
|
+
* `buildVerdict` calls `await classifyVerdict(rawText, ctx)` (local-Gemma verdict
|
|
55
|
+
* classification, fail-closed) INSTEAD of the regex `parseVerdictOutput`. Under
|
|
56
|
+
* the default `gemma` mode this is ALWAYS present (the real Gemma classifier, or
|
|
57
|
+
* a dummy always-ESCALATE classifier when the runner is null at boot) — so a
|
|
58
|
+
* silent regex fallback is impossible. ABSENT ⇒ the provider uses the regex
|
|
59
|
+
* `parseVerdictOutput`, reachable ONLY via `CODEVIBE_REVIEWER_VERDICT_CLASSIFIER=regex`
|
|
60
|
+
* (a deliberate `undefined`, never an accidental missing-classifier fallback).
|
|
61
|
+
* The non-zero-exit → `spawn_failed` guard still runs FIRST (a crashed reviewer
|
|
62
|
+
* is a spawn failure, never sent to the classifier).
|
|
63
|
+
*/
|
|
64
|
+
classifyVerdict?: VerdictClassifier;
|
|
65
|
+
}
|
|
2
66
|
/**
|
|
3
67
|
* Spec for spawning one reviewer at one gate. Constructed by the engine
|
|
4
68
|
* from `ReviewerAgentSpec` (from `PolicySnapshot`) + the context bundle for
|
|
@@ -67,6 +131,28 @@ export interface ReviewerSpec {
|
|
|
67
131
|
*/
|
|
68
132
|
model_hint: string | null;
|
|
69
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* CP-1.f escalation per-seat surfacing — SAFE, CLOSED failure-classification
|
|
136
|
+
* label. The cross-repo contract (`/tmp/cp1f-escalation-impl-contract.md` §1)
|
|
137
|
+
* pins this taxonomy byte-for-byte with the Rust side
|
|
138
|
+
* (`reason_code: Option<ReviewerFailureReason>` on `ReviewerError::SpawnFailed`,
|
|
139
|
+
* `#[serde(rename_all = "snake_case")]`).
|
|
140
|
+
*
|
|
141
|
+
* # Safety invariant (LOAD-BEARING)
|
|
142
|
+
*
|
|
143
|
+
* This is a LABEL ONLY. It MUST NEVER carry raw stderr / stdout / paths /
|
|
144
|
+
* credentials. It is **distinct from and never derived into** the raw
|
|
145
|
+
* `spawn_failed.reason` (which DOES carry stderr). `QuorumLoop.synthesizeEscalate`
|
|
146
|
+
* reads ONLY this label and maps it through a fixed `label → human template`
|
|
147
|
+
* table — the raw `.reason` never reaches the wire `reasoning`.
|
|
148
|
+
*
|
|
149
|
+
* - `usage_limit` — provider hit a usage / capacity / rate limit.
|
|
150
|
+
* - `auth_failed` — provider could not authenticate (401 / not-logged-in).
|
|
151
|
+
* - `timeout` — the wrapper's own wall-clock timeout fired.
|
|
152
|
+
* - `parse_failure` — the stream parsed but yielded no usable final reply.
|
|
153
|
+
* - `spawn_failed` — generic fallback (non-zero exit, no structured error).
|
|
154
|
+
*/
|
|
155
|
+
export type ReviewerFailureReason = 'usage_limit' | 'auth_failed' | 'timeout' | 'parse_failure' | 'spawn_failed';
|
|
70
156
|
/**
|
|
71
157
|
* Typed error thrown by `ReviewerProvider.evaluate`. Discriminated union
|
|
72
158
|
* matching Rust's `#[serde(tag = "kind", rename_all = "snake_case")]` enum.
|
|
@@ -86,11 +172,26 @@ export type ReviewerError = {
|
|
|
86
172
|
elapsed_ms: number;
|
|
87
173
|
} | {
|
|
88
174
|
/** Reviewer process could not be launched (CLI missing, spawn syscall
|
|
89
|
-
* failed, etc.). */
|
|
175
|
+
* failed, etc.) OR exited non-zero. */
|
|
90
176
|
kind: 'spawn_failed';
|
|
91
177
|
agent: AgentKind;
|
|
92
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Human-readable cause. **MAY carry raw stderr** — must stay in logs /
|
|
180
|
+
* audit only. NEVER promote this into the synthesized verdict wire
|
|
181
|
+
* `reasoning` (CP-1.f sanitization invariant). Use `failureReason` for
|
|
182
|
+
* the user-facing one-liner instead.
|
|
183
|
+
*/
|
|
93
184
|
reason: string;
|
|
185
|
+
/**
|
|
186
|
+
* CP-1.f — SAFE, CLOSED classification of WHY the reviewer could not
|
|
187
|
+
* complete, derived from the provider's `--json` STDOUT error stream
|
|
188
|
+
* (NOT from `reason`/stderr). `QuorumLoop.synthesizeEscalate` reads this
|
|
189
|
+
* — never `reason` — and maps it through a fixed human template.
|
|
190
|
+
* Optional: absent on the legacy path (older serialized errors) →
|
|
191
|
+
* `synthesizeEscalate` falls back to the clean `spawn_failed` template,
|
|
192
|
+
* never raw output.
|
|
193
|
+
*/
|
|
194
|
+
failureReason?: ReviewerFailureReason;
|
|
94
195
|
} | {
|
|
95
196
|
/** Reviewer returned but its output couldn't be parsed into a valid
|
|
96
197
|
* verdict. Raw output is preserved for the audit log. */
|
|
@@ -144,10 +245,13 @@ export interface ReviewerProvider {
|
|
|
144
245
|
* @param spec - the reviewer to spawn (seat_id + role + agent + prompt + timeout)
|
|
145
246
|
* @param gateId - the `ReviewGate` UUID this verdict attaches to. Stored
|
|
146
247
|
* on the returned `ReviewerVerdict.gate_id`.
|
|
248
|
+
* @param opts - CP-7 §8 (Stage-1-resolved) OPTIONAL per-evaluate options;
|
|
249
|
+
* carries the substrate handle when the reviewer is sandboxed.
|
|
250
|
+
* ABSENT/`{}` → the legacy unsandboxed path (byte-identical).
|
|
147
251
|
* @returns the parsed `ReviewerVerdict` on success.
|
|
148
252
|
* @throws `ReviewerErrorClass` on timeout, spawn failure, parse failure,
|
|
149
253
|
* cancellation, or internal join failure. Use `e.detail.kind` to
|
|
150
254
|
* narrow.
|
|
151
255
|
*/
|
|
152
|
-
evaluate(spec: ReviewerSpec, gateId: string): Promise<ReviewerVerdict>;
|
|
256
|
+
evaluate(spec: ReviewerSpec, gateId: string, opts?: ReviewerEvaluateOptions): Promise<ReviewerVerdict>;
|
|
153
257
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReviewerEvaluateOptions, type ReviewerProvider, type ReviewerSpec } from '../provider.js';
|
|
2
|
+
import { type SubprocessOutcome } from '../subprocess.js';
|
|
3
|
+
import type { ReviewerVerdict } from '../types.js';
|
|
4
|
+
import { type VerdictClassifier } from '../verdict-classifier.js';
|
|
5
|
+
/** Built command shape — split out so tests can inspect args/env without spawning. */
|
|
6
|
+
export interface BuiltCommand {
|
|
7
|
+
command: string;
|
|
8
|
+
args: string[];
|
|
9
|
+
env: NodeJS.ProcessEnv;
|
|
10
|
+
}
|
|
11
|
+
/** Construction options. */
|
|
12
|
+
export interface AntigravityReviewerProviderOptions {
|
|
13
|
+
/** Override the `agy` executable path (tests point at a fixture CLI). */
|
|
14
|
+
executable?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Real Antigravity reviewer provider. Wraps the `agy` CLI (the bare
|
|
18
|
+
* Google-distributed binary — NOT the `codevibe-agy` 1.x wrapper).
|
|
19
|
+
*/
|
|
20
|
+
export declare class AntigravityReviewerProvider implements ReviewerProvider {
|
|
21
|
+
private readonly executable;
|
|
22
|
+
constructor(opts?: AntigravityReviewerProviderOptions);
|
|
23
|
+
evaluate(spec: ReviewerSpec, gateId: string, opts?: ReviewerEvaluateOptions): Promise<ReviewerVerdict>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Construct the agy CLI invocation (design D4):
|
|
27
|
+
*
|
|
28
|
+
* - `--print ''` — non-interactive one-shot; the EMPTY value selects the
|
|
29
|
+
* STDIN prompt (fed by `runReviewer`), keeping multi-line markdown out of
|
|
30
|
+
* argv (same posture as gemini's `-p ''`).
|
|
31
|
+
* - `--model <hint>` — optional; omitted when `spec.model_hint` is `null`
|
|
32
|
+
* (agy default model).
|
|
33
|
+
* - `--print-timeout <s>s` — agy's INTERNAL print-mode poll ceiling, derived
|
|
34
|
+
* from the spec timeout so agy gives up (with its own clean teardown)
|
|
35
|
+
* BEFORE `runReviewer`'s external `timeout_ms` kill fires.
|
|
36
|
+
* - `--add-dir <workdir>` — grants agy's tools the repo (workspace-centric).
|
|
37
|
+
*
|
|
38
|
+
* No `--output-format json` exists in agy print mode — stdout is the raw
|
|
39
|
+
* reply text and there is no usage/token envelope (D10: tokens_used null).
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildCommand(executable: string, spec: ReviewerSpec, workdir: string): BuiltCommand;
|
|
42
|
+
/**
|
|
43
|
+
* Map the raw subprocess outcome into a `ReviewerVerdict` or throw a
|
|
44
|
+
* structured `ReviewerErrorClass`. Exit code first (a crashed CLI's stdout is
|
|
45
|
+
* unreliable); then the verdict text is `outcome.stdout` VERBATIM (no json
|
|
46
|
+
* unwrap — agy print mode is plain text) fed to the injected classifier
|
|
47
|
+
* (default) or the legacy regex parser (`CODEVIBE_REVIEWER_VERDICT_CLASSIFIER=regex`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildVerdict(spec: ReviewerSpec, gateId: string, outcome: SubprocessOutcome, classifyVerdict?: VerdictClassifier): Promise<ReviewerVerdict>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type ReviewerProvider, type ReviewerSpec } from '../provider.js';
|
|
1
|
+
import { type ReviewerEvaluateOptions, type ReviewerProvider, type ReviewerSpec } from '../provider.js';
|
|
2
2
|
import { type SubprocessOutcome } from '../subprocess.js';
|
|
3
3
|
import type { ReviewerVerdict } from '../types.js';
|
|
4
|
+
import { type VerdictClassifier } from '../verdict-classifier.js';
|
|
4
5
|
/**
|
|
5
6
|
* Built command shape — split out so tests can inspect args / env without
|
|
6
7
|
* spawning a process. `runReviewer` consumes this shape directly.
|
|
@@ -27,7 +28,7 @@ export interface ClaudeReviewerProviderOptions {
|
|
|
27
28
|
export declare class ClaudeReviewerProvider implements ReviewerProvider {
|
|
28
29
|
private readonly executable;
|
|
29
30
|
constructor(opts?: ClaudeReviewerProviderOptions);
|
|
30
|
-
evaluate(spec: ReviewerSpec, gateId: string): Promise<ReviewerVerdict>;
|
|
31
|
+
evaluate(spec: ReviewerSpec, gateId: string, opts?: ReviewerEvaluateOptions): Promise<ReviewerVerdict>;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Construct the Claude CLI invocation. Split out from `evaluate` so unit
|
|
@@ -48,12 +49,26 @@ export declare class ClaudeReviewerProvider implements ReviewerProvider {
|
|
|
48
49
|
*
|
|
49
50
|
* Set unconditionally to `'1'` in the child's environment. See module docs
|
|
50
51
|
* for the rationale and why `--bare` was rejected as the primary defense.
|
|
52
|
+
*
|
|
53
|
+
* # CP-7 §8 (Stage-1-resolved) — `sandboxed` drops the `process.env` spread
|
|
54
|
+
*
|
|
55
|
+
* On the SUBSTRATE path (`sandboxed === true`) the returned `env` is EMPTY:
|
|
56
|
+
* the reviewer's real env is pre-baked at `substrate.launch()` (the I1
|
|
57
|
+
* allow-list `sanitizedEnv` — broker base-URL + config dir, NO vendor key),
|
|
58
|
+
* and `runReviewer` ignores `BuiltCommand.env` when a substrate handle is
|
|
59
|
+
* present. We deliberately do NOT spread `{...process.env}` here in that
|
|
60
|
+
* case: the spread re-introduces `ANTHROPIC_API_KEY` / OAuth env + the host
|
|
61
|
+
* `ANTHROPIC_BASE_URL` / `CLAUDE_CONFIG_DIR` that would DEFEAT the broker
|
|
62
|
+
* redirect (THE moat hole). The `QUORUM_REVIEWER_SUBPROCESS` marker is folded
|
|
63
|
+
* into the substrate's sanitizedEnv at launch (the engager's marker step),
|
|
64
|
+
* not via this field. On the LEGACY path (`sandboxed === false`, the default)
|
|
65
|
+
* the env is built exactly as before — byte-identical non-regression.
|
|
51
66
|
*/
|
|
52
|
-
export declare function buildCommand(executable: string, spec: ReviewerSpec): BuiltCommand;
|
|
67
|
+
export declare function buildCommand(executable: string, spec: ReviewerSpec, sandboxed?: boolean): BuiltCommand;
|
|
53
68
|
/**
|
|
54
69
|
* Map the raw subprocess outcome into a `ReviewerVerdict` or throw a
|
|
55
70
|
* structured `ReviewerErrorClass`. Exit code is checked first — a crashed
|
|
56
71
|
* CLI that happened to print something valid on stdout should still be
|
|
57
72
|
* treated as a spawn failure, not a silently-accepted verdict.
|
|
58
73
|
*/
|
|
59
|
-
export declare function buildVerdict(spec: ReviewerSpec, gateId: string, outcome: SubprocessOutcome): ReviewerVerdict
|
|
74
|
+
export declare function buildVerdict(spec: ReviewerSpec, gateId: string, outcome: SubprocessOutcome, classifyVerdict?: VerdictClassifier): Promise<ReviewerVerdict>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type ReviewerProvider, type ReviewerSpec } from '../provider.js';
|
|
1
|
+
import { type ReviewerEvaluateOptions, type ReviewerProvider, type ReviewerSpec } from '../provider.js';
|
|
2
2
|
import { type SubprocessOutcome } from '../subprocess.js';
|
|
3
3
|
import type { ReviewerVerdict } from '../types.js';
|
|
4
|
+
import { type VerdictClassifier } from '../verdict-classifier.js';
|
|
4
5
|
import type { BuiltCommand } from './claude.js';
|
|
5
6
|
/** Construction options. */
|
|
6
7
|
export interface CodexReviewerProviderOptions {
|
|
@@ -15,7 +16,7 @@ export interface CodexReviewerProviderOptions {
|
|
|
15
16
|
export declare class CodexReviewerProvider implements ReviewerProvider {
|
|
16
17
|
private readonly executable;
|
|
17
18
|
constructor(opts?: CodexReviewerProviderOptions);
|
|
18
|
-
evaluate(spec: ReviewerSpec, gateId: string): Promise<ReviewerVerdict>;
|
|
19
|
+
evaluate(spec: ReviewerSpec, gateId: string, opts?: ReviewerEvaluateOptions): Promise<ReviewerVerdict>;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Construct the Codex CLI invocation. Split out from `evaluate` so unit
|
|
@@ -35,18 +36,26 @@ export declare class CodexReviewerProvider implements ReviewerProvider {
|
|
|
35
36
|
* - `--ephemeral` — do NOT write a session JSONL under
|
|
36
37
|
* `~/.codex/sessions/`.
|
|
37
38
|
* - `--output-last-message <path>` — write the model's final agent
|
|
38
|
-
* message verbatim to `path`.
|
|
39
|
+
* message verbatim to `path`. On the LEGACY path `path` is an ABSOLUTE
|
|
40
|
+
* `os.tmpdir()` file; on the SUBSTRATE path it is a RELATIVE filename so
|
|
41
|
+
* codex writes it into its cwd (the workdir) — the only sandbox-writable +
|
|
42
|
+
* host-readable location (see `evaluate` / `resolveLastMessagePaths`).
|
|
39
43
|
* - `--model <hint>` — optional; omitted when `spec.model_hint` is `null`.
|
|
40
44
|
* - `-` (final arg) — read prompt from stdin.
|
|
45
|
+
*
|
|
46
|
+
* `lastMessagePath` is the value passed to `--output-last-message` AS CODEX
|
|
47
|
+
* SEES IT (the in-sandbox arg): an absolute tmp path on the legacy path, a
|
|
48
|
+
* relative-to-cwd filename on the substrate path. The CALLER (`evaluate`) owns
|
|
49
|
+
* the corresponding HOST read/unlink path.
|
|
41
50
|
*/
|
|
42
|
-
export declare function buildCommand(executable: string, spec: ReviewerSpec, lastMessagePath: string): BuiltCommand;
|
|
51
|
+
export declare function buildCommand(executable: string, spec: ReviewerSpec, lastMessagePath: string, sandboxed?: boolean): BuiltCommand;
|
|
43
52
|
/**
|
|
44
53
|
* Map the raw subprocess outcome + the file Codex wrote into a
|
|
45
54
|
* `ReviewerVerdict` or throw a structured `ReviewerErrorClass`. See
|
|
46
55
|
* `claude.ts::buildVerdict` for the shared safety rule (non-zero exit
|
|
47
56
|
* overrides any parseable stdout / file).
|
|
48
57
|
*/
|
|
49
|
-
export declare function buildVerdict(spec: ReviewerSpec, gateId: string, outcome: SubprocessOutcome, lastMessage: string): ReviewerVerdict
|
|
58
|
+
export declare function buildVerdict(spec: ReviewerSpec, gateId: string, outcome: SubprocessOutcome, lastMessage: string, classifyVerdict?: VerdictClassifier): Promise<ReviewerVerdict>;
|
|
50
59
|
/**
|
|
51
60
|
* Sum `usage.input_tokens + usage.output_tokens` across every
|
|
52
61
|
* `turn.completed` JSONL event in `stdout`. Returns `null` when no
|
|
@@ -63,5 +72,38 @@ export declare function sumCodexTokens(stdout: string): number | null;
|
|
|
63
72
|
* the OS temp dir; we own its lifecycle (create on codex's side, read +
|
|
64
73
|
* delete on ours). Per-process pid + UUID is enough — no race risk across
|
|
65
74
|
* concurrent reviewers in the same engine run.
|
|
75
|
+
*
|
|
76
|
+
* Used for the LEGACY (unsandboxed) path; the sandbox path routes the file
|
|
77
|
+
* THROUGH the workdir instead — see {@link resolveLastMessagePaths}.
|
|
66
78
|
*/
|
|
67
79
|
export declare function makeLastMessagePath(): string;
|
|
80
|
+
/**
|
|
81
|
+
* CP-7 reviewer-sandbox fix — resolve the TWO paths for the codex
|
|
82
|
+
* `--output-last-message` file:
|
|
83
|
+
* - `argPath` — what codex SEES (the value passed to the CLI flag).
|
|
84
|
+
* - `hostPath` — what the HOST reads/unlinks the file at.
|
|
85
|
+
*
|
|
86
|
+
* LEGACY (`sandboxed === false`): both are the SAME absolute `os.tmpdir()`
|
|
87
|
+
* path (byte-identical to pre-CP-7-reviewer-sandbox behavior). codex writes
|
|
88
|
+
* the host tmp file directly.
|
|
89
|
+
*
|
|
90
|
+
* SUBSTRATE (`sandboxed === true`): codex cannot write the host `os.tmpdir()`
|
|
91
|
+
* (A1 never mounts host `/tmp`; A5's Seatbelt profile grants writes to the
|
|
92
|
+
* WORKDIR only). So `argPath` is a RELATIVE filename: codex's cwd IS the
|
|
93
|
+
* workdir on both backends (A5 spawns `cwd: workdir`; Docker `docker exec -w
|
|
94
|
+
* /workspace`), so codex writes `<sandboxCwd>/<name>`. The host reads it at
|
|
95
|
+
* `hostPath = <workdir>/<name>` — the SAME inode (A5 shares the host fs even
|
|
96
|
+
* after the substrate canonicalizes the workdir, because the host read follows
|
|
97
|
+
* the symlink; A1 bind-mounts the workdir, so `<workdir>` on the host IS
|
|
98
|
+
* `/workspace` in the container). A relative `argPath` is deliberately
|
|
99
|
+
* cwd-agnostic, so it is correct for BOTH backends without per-backend mapping.
|
|
100
|
+
*
|
|
101
|
+
* FAIL-CLOSED: the substrate path REQUIRES the host `workdir`. Without it we
|
|
102
|
+
* cannot read codex's verdict back, so we THROW (the caller turns a provider
|
|
103
|
+
* throw into a clean synthesized ESCALATE) rather than silently writing to a
|
|
104
|
+
* relative file the host cannot locate.
|
|
105
|
+
*/
|
|
106
|
+
export declare function resolveLastMessagePaths(sandboxed: boolean, workdir: string | undefined): {
|
|
107
|
+
argPath: string;
|
|
108
|
+
hostPath: string;
|
|
109
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReviewerFailureReason } from '../provider.js';
|
|
2
|
+
/**
|
|
3
|
+
* Classify a single provider error MESSAGE into a `ReviewerFailureReason`, or
|
|
4
|
+
* `null` if it matches no known structured-failure signal.
|
|
5
|
+
*
|
|
6
|
+
* SAFE: returns only the closed label — never the message. Pure string match;
|
|
7
|
+
* no I/O, never throws.
|
|
8
|
+
*/
|
|
9
|
+
export declare function classifyFailureMessage(message: string): ReviewerFailureReason | null;
|
|
10
|
+
/**
|
|
11
|
+
* Scan a provider's `--json` STDOUT event stream for a structured failure
|
|
12
|
+
* event (`{"type":"error"}` / `{"type":"turn.failed"}`) and classify the FIRST
|
|
13
|
+
* one found into a `ReviewerFailureReason`. Returns `null` when the stream
|
|
14
|
+
* carries no classifiable structured error (caller falls back to the generic
|
|
15
|
+
* `spawn_failed` label).
|
|
16
|
+
*
|
|
17
|
+
* # Truncation tolerance (LOAD-BEARING)
|
|
18
|
+
*
|
|
19
|
+
* Each line is JSON; per-line `JSON.parse` is wrapped in try/catch. A truncated
|
|
20
|
+
* final line — which a timeout / abort can leave behind mid-flush — is SKIPPED,
|
|
21
|
+
* never thrown. The whole scan degrades gracefully to `null` rather than
|
|
22
|
+
* propagating a parse error up through the escalation-synthesis path.
|
|
23
|
+
*
|
|
24
|
+
* SAFE: returns only the closed label — never any raw stream content.
|
|
25
|
+
*/
|
|
26
|
+
export declare function classifyFailureFromStdout(stdout: string): ReviewerFailureReason | null;
|