@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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { AuthorityScope } from './authority';
|
|
2
2
|
import { ClassAEmitter, ClassAEmitterContext } from './class-a-emit';
|
|
3
3
|
import { EmitShellEventFn } from './hook-bridge';
|
|
4
|
-
import { ClassBInbound } from './types';
|
|
4
|
+
import { ClassBInbound, GateDispatchPayload, MergeGateDispatchPayload, ReviewerDispatchPayload, ReviseFeedbackPayload, TaskGroupHaltedPayload, TrackAssignedPayload } from './types';
|
|
5
|
+
import type { ContinuationPacketWriter } from '../continuation/packet-writer';
|
|
6
|
+
import type { PacketWriteInput } from '../continuation/types';
|
|
5
7
|
export type ClassBVerificationResult = {
|
|
6
8
|
ok: true;
|
|
7
9
|
} | {
|
|
@@ -51,6 +53,28 @@ export declare class UlidReplayRegistry {
|
|
|
51
53
|
/** Test-only — exposes seen-set size. */
|
|
52
54
|
get sizeForTests(): number;
|
|
53
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Normalize an inbound `TrackAssigned` wire object (engine camelCase +
|
|
58
|
+
* lowercase agent) into the desktop's internal snake_case `TrackAssignedPayload`
|
|
59
|
+
* shape. Returns a plain object that `isValidTrackAssignedPayload` then deeply
|
|
60
|
+
* validates — invalid input still flows through to the validator (which drops).
|
|
61
|
+
* Best-effort: never throws (Class B consumption is best-effort per LOCK #E3-1).
|
|
62
|
+
*/
|
|
63
|
+
export declare function normalizeTrackAssignedWire(raw: unknown): Partial<TrackAssignedPayload>;
|
|
64
|
+
/**
|
|
65
|
+
* FIX-3 — deep-validate a `TrackAssigned` payload BEFORE caching it or invoking
|
|
66
|
+
* the `launchTrack` DI callback. The shallow truthiness check left malformed
|
|
67
|
+
* NESTED fields (`write_paths` / `auto_modified_files` not arrays, invalid
|
|
68
|
+
* `implementor_agent` enum, non-numeric `track_index` / `dispatch_generation`,
|
|
69
|
+
* missing `ownership_scope` sub-arrays) to throw later inside
|
|
70
|
+
* `scopeFromOwnership` / `launchTrack` / `buildChangedFileSets`, crashing Class
|
|
71
|
+
* B consumption. Returns `true` only when EVERY field the team path reads is
|
|
72
|
+
* well-typed; the caller drops + logs on `false`.
|
|
73
|
+
*
|
|
74
|
+
* NOTE: kept structural (no throw) — Class B consumption is best-effort per
|
|
75
|
+
* LOCK #E3-1, so an invalid packet is dropped, never surfaced as an exception.
|
|
76
|
+
*/
|
|
77
|
+
export declare function isValidTrackAssignedPayload(payload: Partial<TrackAssignedPayload> | undefined): payload is TrackAssignedPayload;
|
|
54
78
|
export interface ClassBConsumerState {
|
|
55
79
|
/** Last received PlannerDecisionApproved per taskId; CP-2 reads. */
|
|
56
80
|
plannerDecisionByTask: Map<string, Extract<ClassBInbound, {
|
|
@@ -64,6 +88,17 @@ export interface ClassBConsumerState {
|
|
|
64
88
|
continuationOfferByHandoff: Map<string, Extract<ClassBInbound, {
|
|
65
89
|
kind: 'ContinuationOffer';
|
|
66
90
|
}>>;
|
|
91
|
+
/**
|
|
92
|
+
* CP-12 W2.b — last received TrackAssigned per `<task_group_id>::<track_index>`
|
|
93
|
+
* (introspection / re-dispatch reconciliation). The idempotency-by-generation
|
|
94
|
+
* decision lives in the `TrackRegistry` (track-registry.ts), NOT here — this
|
|
95
|
+
* is a record of what the consumer saw, not the spawn gate.
|
|
96
|
+
*/
|
|
97
|
+
trackAssignedByTrack: Map<string, TrackAssignedPayload>;
|
|
98
|
+
/** CP-12 W2.b — last received MergeGateDispatch per `merge_gate_id`. */
|
|
99
|
+
mergeGateDispatchByGate: Map<string, MergeGateDispatchPayload>;
|
|
100
|
+
/** CP-12 W2.b — last received TaskGroupHalted per `task_group_id`. */
|
|
101
|
+
taskGroupHaltedByGroup: Map<string, TaskGroupHaltedPayload>;
|
|
67
102
|
}
|
|
68
103
|
export interface ClassBConsumerDeps {
|
|
69
104
|
emitter: ClassAEmitter;
|
|
@@ -71,10 +106,116 @@ export interface ClassBConsumerDeps {
|
|
|
71
106
|
getContext: () => ClassAEmitterContext;
|
|
72
107
|
/** Called on TaskAuthorized to mutate the LocalExecutorImpl's authority scope (CP-0 §2.5 invariant #6). */
|
|
73
108
|
advanceAuthorityScope: (newScope: AuthorityScope, taskId: string) => void;
|
|
74
|
-
/**
|
|
75
|
-
|
|
109
|
+
/**
|
|
110
|
+
* CP-1.f execute-first (D5 / #PR-1 / #PR-3) — called on the `TaskAuthorized`
|
|
111
|
+
* Class-B edge (the engine's SINGLE canonical "authorized-to-execute" signal,
|
|
112
|
+
* which fires for ALL THREE authorize paths: FinalApprovalPending+Approve,
|
|
113
|
+
* Halted+Accept, Halted+AcceptWithNotes — NOT keyed on `final_approval_resolved`
|
|
114
|
+
* alone). PROMOTES the task's shadow onto the real tree (the ONLY place the
|
|
115
|
+
* real workspace is mutated). Idempotent (#PR-4) — a packet + recovery
|
|
116
|
+
* double-fire is a safe no-op. When OMITTED (non-loop LE / tests), no promote
|
|
117
|
+
* runs (back-compat; only `advanceAuthorityScope` fires).
|
|
118
|
+
*/
|
|
119
|
+
promoteOnTaskAuthorized?: (taskId: string) => Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Called on PolicyRejection to surface the rejection to the user (LOCK C4-3
|
|
122
|
+
* user-visible channel). Audited-path fix (Fix B) — `rejectedTaskId` carries
|
|
123
|
+
* the rejected task's OWN taskId (from the outer Class B envelope; the
|
|
124
|
+
* PolicyRejection payload has none) so the desktop wiring discards EXACTLY
|
|
125
|
+
* that task's shadow rather than the now-active task's. Undefined when the
|
|
126
|
+
* envelope lacked a taskId.
|
|
127
|
+
*/
|
|
128
|
+
notifyPolicyRejection?: (detail: string, category: string, recommendedRecovery: string, rejectedTaskId?: string) => void;
|
|
76
129
|
/** Test seam for deterministic UlidReplayRegistry behavior. */
|
|
77
130
|
replayRegistry?: UlidReplayRegistry;
|
|
131
|
+
/**
|
|
132
|
+
* CP-6 LOCK #C6-A-10 — optional continuation packet writer. When
|
|
133
|
+
* present, `handleContinuationOffer` writes the local
|
|
134
|
+
* `CONTINUATION.md` packet after caching the offer and computes the
|
|
135
|
+
* authoritative JCS-canonical-JSON SHA-256 hash, then invokes the
|
|
136
|
+
* direct `recordContinuationPacketWritten` mutation. When omitted
|
|
137
|
+
* (back-compat for unit tests + pre-CP-6 LocalExecutorImpl instances),
|
|
138
|
+
* the consumer behaves exactly as before — cache-update only.
|
|
139
|
+
*/
|
|
140
|
+
continuationPacketWriter?: ContinuationPacketWriter;
|
|
141
|
+
/**
|
|
142
|
+
* CP-6 — caller-supplied builder that turns an inbound
|
|
143
|
+
* `ContinuationOffer` into a `PacketWriteInput`. The class-B consumer
|
|
144
|
+
* has no view of the local sessionId / taskSummary / completedWork
|
|
145
|
+
* narrative — those live in the LocalExecutorImpl session state.
|
|
146
|
+
* When omitted, the consumer derives a minimal sentinel-only packet
|
|
147
|
+
* from the inbound offer payload (handoffId → taskId fall-back).
|
|
148
|
+
*/
|
|
149
|
+
buildContinuationPacketInput?: (packet: Extract<ClassBInbound, {
|
|
150
|
+
kind: 'ContinuationOffer';
|
|
151
|
+
}>) => PacketWriteInput | null;
|
|
152
|
+
/**
|
|
153
|
+
* Launch the implementor for a track (#C12-14). MUST be idempotent by
|
|
154
|
+
* `(task_group_id, track_index, dispatch_generation)` — the LE's
|
|
155
|
+
* `TrackRegistry` ignores a duplicate generation (a duplicate `TrackAssigned`
|
|
156
|
+
* spawns NOTHING). Advances the per-track authority scope to
|
|
157
|
+
* `ownership_scope` and runs the track in its isolated `state_dir`.
|
|
158
|
+
*/
|
|
159
|
+
launchTrack?: (payload: TrackAssignedPayload) => Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Run the MergeGate integration check on the `owner_track_index` track,
|
|
162
|
+
* classify + sign the result, and `submitMergeGateVerdict` (#C12-7/#C12-8).
|
|
163
|
+
*/
|
|
164
|
+
runMergeGate?: (payload: MergeGateDispatchPayload) => Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Surface a group halt to the UI (NOTIFICATION + choices) and signal the
|
|
167
|
+
* in-flight track processes to stop (#C12-12). Deep choice-driven
|
|
168
|
+
* auto-resolution is server-side (#C12-3) — the LE only surfaces + stops.
|
|
169
|
+
*/
|
|
170
|
+
haltTaskGroup?: (payload: TaskGroupHaltedPayload) => Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* §3.C.18 — REAL Ed25519 signature verifier. Resolves (+ caches) the
|
|
173
|
+
* engine's Class-B public key and cryptographically verifies the packet's
|
|
174
|
+
* signature fail-closed. Returns `true` ONLY when the signature is
|
|
175
|
+
* cryptographically valid. When OMITTED (CP-1.e unit tests + pre-CP-1.f LE
|
|
176
|
+
* instances that never receive live packets), only the structural
|
|
177
|
+
* `verifyClassBSignature` check runs (back-compat). #C1F-9: production wires
|
|
178
|
+
* this so live Class B is fail-closed.
|
|
179
|
+
*/
|
|
180
|
+
classBSignatureVerifier?: (packet: ClassBInbound) => Promise<boolean>;
|
|
181
|
+
/**
|
|
182
|
+
* CP-1.f Wave 3 FIX — §3.C.20 — consume a `GATE_DISPATCH` packet. For the
|
|
183
|
+
* round-0 `reviewer_quorum` gate (`gateType === "reviewer_quorum"`,
|
|
184
|
+
* `reviewerSeats` absent at START), the shell spawns the implementor + submits
|
|
185
|
+
* its output against `gateRunId` (the engine's round-0 gate_id — the desktop
|
|
186
|
+
* CANNOT learn it from the `startTask` mutation response, which only carries
|
|
187
|
+
* the workflow-state label string). MUST dedup on `gateRunId` (a sweeper / WS
|
|
188
|
+
* re-deliver must NOT double-spawn). `verification` / `final_approval` gate
|
|
189
|
+
* types are OUT OF SCOPE for CP-1.f single-task (the shell logs + ignores
|
|
190
|
+
* them). When OMITTED (non-loop LE / tests), the kind is cached + logged
|
|
191
|
+
* (back-compat — the existing `gateDispatchByRun` cache update still runs).
|
|
192
|
+
*
|
|
193
|
+
* CP-12 W2.b (§3.C.2 / H1) — `envelopeTaskId` carries the OUTER Class-B
|
|
194
|
+
* envelope's `task_id` (the `GateDispatchPayload` has none), so the team
|
|
195
|
+
* quorum loop can route the round-0 dispatch to the right per-track `task_id`.
|
|
196
|
+
* The engine stamps this on EVERY gate dispatch — single-impl INCLUDED (it
|
|
197
|
+
* equals the loop's single active task). The quorum loop discriminates team vs
|
|
198
|
+
* single-impl by `envelopeTaskId !== activeTaskId`, NOT by presence, so a
|
|
199
|
+
* single-impl dispatch (envelopeTaskId === activeTaskId) falls back to the
|
|
200
|
+
* single active task — byte-identical to today. Mirrors the
|
|
201
|
+
* `notifyPolicyRejection(.., rejectedTaskId?)` precedent.
|
|
202
|
+
*/
|
|
203
|
+
gateDispatch?: (payload: GateDispatchPayload, envelopeTaskId?: string) => Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* §3.C.21 — spawn ALL assigned reviewer seats for a REVIEWER_DISPATCH packet.
|
|
206
|
+
* The shell fetches+decrypts each seat's prompt, runs `registry.evaluate`,
|
|
207
|
+
* synthesizes ESCALATE on reviewer error (#C1F-8), and submits the verdict.
|
|
208
|
+
* MUST be idempotent per `(gateId, seatId)` so a dropped-packet recovery
|
|
209
|
+
* re-spawn is a no-op (§3.C.21b double-guard lives shell-side).
|
|
210
|
+
*/
|
|
211
|
+
spawnReviewers?: (payload: ReviewerDispatchPayload) => Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* §3.C.23 — re-run the implementor for round N+1 with the aggregated REVISE
|
|
214
|
+
* findings, then `submitImplementorOutput(nextGateId)`. MUST dedup on
|
|
215
|
+
* `reviseFeedbackId` + the implementor double-spawn guard (shell-side) so a
|
|
216
|
+
* sweeper re-emit after a crash is idempotent.
|
|
217
|
+
*/
|
|
218
|
+
runReviseRound?: (payload: ReviseFeedbackPayload) => Promise<void>;
|
|
78
219
|
}
|
|
79
220
|
/**
|
|
80
221
|
* Class B inbound consumer per design §6.1.
|
|
@@ -92,12 +233,26 @@ export declare class ClassBConsumer {
|
|
|
92
233
|
private readonly state;
|
|
93
234
|
private readonly replayRegistry;
|
|
94
235
|
constructor(deps: ClassBConsumerDeps);
|
|
95
|
-
|
|
236
|
+
/**
|
|
237
|
+
* @param envelopeTaskId Audited-path fix (Fix B) — the OUTER Class B envelope's
|
|
238
|
+
* `taskId` (`ClassBPacketEnvelopeMeta.taskId`). Forwarded ONLY to
|
|
239
|
+
* `handlePolicyRejection`, whose payload (`PolicyRejectionPayload`) carries no
|
|
240
|
+
* taskId of its own, so the rejection can discard EXACTLY the rejected task's
|
|
241
|
+
* shadow instead of "whatever task is active now". Optional — undefined for
|
|
242
|
+
* unit tests / non-WS callers (the discard then degrades to a no-op for that
|
|
243
|
+
* rejection, never the wrong task's shadow).
|
|
244
|
+
*/
|
|
245
|
+
consume(packet: ClassBInbound, envelopeTaskId?: string): Promise<void>;
|
|
96
246
|
private handlePlannerDecisionApproved;
|
|
97
247
|
private handleGateDispatch;
|
|
98
248
|
private handleContinuationOffer;
|
|
99
249
|
private handleTaskAuthorized;
|
|
100
250
|
private handlePolicyRejection;
|
|
251
|
+
private handleTrackAssigned;
|
|
252
|
+
private handleMergeGateDispatch;
|
|
253
|
+
private handleTaskGroupHalted;
|
|
254
|
+
private handleReviewerDispatch;
|
|
255
|
+
private handleReviseFeedback;
|
|
101
256
|
/**
|
|
102
257
|
* Constructs an AuthorityRefusal with one of the LOCK #E4-1 widened category
|
|
103
258
|
* literals and emits an EXECUTOR_REFUSAL via the CP-1.c emitter. Audit-only:
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
/** Outcome of a cryptographic Class B verify. */
|
|
3
|
+
export type ClassBCryptoVerifyResult = {
|
|
4
|
+
ok: true;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
reason: 'malformed_envelope' | 'malformed_key' | 'signature_mismatch';
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Build a Node `KeyObject` Ed25519 public key from the raw 32-byte verifying
|
|
11
|
+
* key (base64). Ed25519 public keys are an OKP JWK with `crv: 'Ed25519'` and a
|
|
12
|
+
* base64url `x` of the 32 raw bytes. Throws on a non-32-byte key.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ed25519PublicKeyFromRaw(publicKeyB64: string): crypto.KeyObject;
|
|
15
|
+
/**
|
|
16
|
+
* Produce the RFC 8785 JCS canonical-JSON STRING of the full Class B envelope
|
|
17
|
+
* with BOTH signature carriers removed. Mirrors the engine's
|
|
18
|
+
* `canonical_json_for_signing` exactly. The envelope's keys are already
|
|
19
|
+
* camelCase on the wire; JCS sorts lexicographically over the wire-key names.
|
|
20
|
+
*/
|
|
21
|
+
export declare function classBCanonicalForSigning(envelope: Record<string, unknown>): string;
|
|
22
|
+
/**
|
|
23
|
+
* Cryptographically verify an inbound Class B packet's Ed25519 signature
|
|
24
|
+
* against `publicKeyB64` (the engine's verifying key). FAIL-CLOSED: any
|
|
25
|
+
* malformed input or signature mismatch → `{ ok: false }`. Never throws.
|
|
26
|
+
*
|
|
27
|
+
* `packet` is the parsed `packetJson` (the full `ClassBEnvelope` with all
|
|
28
|
+
* wire fields — `parseClassBPacketPayload` returns it verbatim).
|
|
29
|
+
*/
|
|
30
|
+
export declare function verifyClassBEd25519(packet: unknown, publicKeyB64: string): ClassBCryptoVerifyResult;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ConflictFileMeta } from './conflict-types';
|
|
2
|
+
/** The outcome of attempting a class-1 reconciler. */
|
|
3
|
+
export type Class1ReconcileResult = {
|
|
4
|
+
status: 'resolved';
|
|
5
|
+
/** The deterministic resolved file bytes. */
|
|
6
|
+
bytes: Buffer;
|
|
7
|
+
/** Which deterministic reconciler produced this (lockfile-only in W3-core). */
|
|
8
|
+
reconciler: 'lockfile';
|
|
9
|
+
/** Byte-level explanation (audited rationale). */
|
|
10
|
+
explanation: string;
|
|
11
|
+
} | {
|
|
12
|
+
/** Escalate OUT of class-1 to a reviewed path. `to:3` = human gate. */
|
|
13
|
+
status: 'escalate';
|
|
14
|
+
to: 2 | 3;
|
|
15
|
+
reason: string;
|
|
16
|
+
humanGateTrigger?: 'lockfile_version_delta';
|
|
17
|
+
} | {
|
|
18
|
+
status: 'not_applicable';
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Extract a deterministic, order-insensitive multiset of CANONICAL FULL entries
|
|
22
|
+
* from a lockfile by type, or `null` if the type is unsupported/unparseable (→
|
|
23
|
+
* fail closed). "Full" is the point (Stage-2 r2 Codex HIGH): each entry carries
|
|
24
|
+
* EVERY provenance/verification field, not just `name@version` —
|
|
25
|
+
* - Cargo.lock: the whole `[[package]]` block (name, version, **source**,
|
|
26
|
+
* **checksum**, dependencies), normalized + line-sorted within the block;
|
|
27
|
+
* - package-lock.json: each entry's FULL object (version, **resolved**,
|
|
28
|
+
* **integrity**, …) via {@link stableStringify};
|
|
29
|
+
* - go.sum: the FULL line (module version **hash**, incl. `/go.mod` rows).
|
|
30
|
+
* So a pure re-serialization (reorder) yields an EQUAL multiset, while ANY field
|
|
31
|
+
* delta — a version change OR a same-version checksum/integrity/source swap (a
|
|
32
|
+
* supply-chain substitution) — yields a DIFFERENT multiset → escalation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function lockfileCanonicalEntries(path: string, content: string): string[] | null;
|
|
35
|
+
/**
|
|
36
|
+
* §4.3 class-1 — lockfile reconciliation, EXACT FULL-ENTRY-SET only. If the track
|
|
37
|
+
* and counterpart lockfiles resolve the **exact same** canonical full-entry
|
|
38
|
+
* multiset (a pure re-sort/re-serialization — NO field changed anywhere,
|
|
39
|
+
* including every checksum/integrity/source/hash), the resolution = the track
|
|
40
|
+
* lockfile verbatim (both encode byte-equivalent dependencies). If the entry
|
|
41
|
+
* sets DIFFER in ANY field — a version change OR a same-version checksum/
|
|
42
|
+
* integrity/source swap (a supply-chain substitution, Stage-2 r2 Codex HIGH) —
|
|
43
|
+
* it is a real change → **escalate to class-3 (human)**, never a silent merge.
|
|
44
|
+
* Unsupported/unparseable lockfile → also escalate (fail closed).
|
|
45
|
+
*/
|
|
46
|
+
export declare function reconcileLockfile(meta: ConflictFileMeta): Class1ReconcileResult;
|
|
47
|
+
/**
|
|
48
|
+
* Attempt the class-1 reconcilers for a conflict. In W3-core the ONLY class-1
|
|
49
|
+
* reconciler is the lockfile reconciler, so `lockfileHint` is required for a
|
|
50
|
+
* resolution: with it, the lockfile reconciler runs (and ESCALATES a
|
|
51
|
+
* version-delta rather than silently falling through); without it, no class-1
|
|
52
|
+
* reconciler applies → `not_applicable` (→ the resolve pipeline routes the
|
|
53
|
+
* conflict to class-2, reviewed). Whitespace/import-order class-1 reconciliation
|
|
54
|
+
* is deferred to the language-aware follow-on (see the module header).
|
|
55
|
+
*/
|
|
56
|
+
export declare function attemptClass1(meta: ConflictFileMeta, opts?: {
|
|
57
|
+
lockfileHint?: boolean;
|
|
58
|
+
}): Class1ReconcileResult;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ConflictFileMeta, ConflictHunk } from './conflict-types';
|
|
2
|
+
import { type ConflictResolutionRecord, type ConflictResolutionStore } from './conflict-resolution-store';
|
|
3
|
+
/** The bounded prompt handed to the broker (only these bytes cross the boundary). */
|
|
4
|
+
export interface ResolverPrompt {
|
|
5
|
+
path: string;
|
|
6
|
+
conflictKind: string;
|
|
7
|
+
hunkOrdinal: number;
|
|
8
|
+
baseLines: string[];
|
|
9
|
+
trackLines: string[];
|
|
10
|
+
counterpartLines: string[];
|
|
11
|
+
/** Bounded surrounding-file context (already budget-checked). */
|
|
12
|
+
surroundingContext: string;
|
|
13
|
+
}
|
|
14
|
+
/** The model's reply, as returned by the brokered call. */
|
|
15
|
+
export interface ResolverModelResult {
|
|
16
|
+
/** The resolved hunk lines the model proposes. */
|
|
17
|
+
resolvedHunkLines: string[];
|
|
18
|
+
/** The model's rationale. */
|
|
19
|
+
rationale: string;
|
|
20
|
+
/** Best-effort self-reported confidence (0..1). NOT a gate (class-2 is Tier-2'd). */
|
|
21
|
+
confidence?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Abstracts the single allowlisted BROKERED model call (§8). The live impl
|
|
25
|
+
* (W3-6) constructs a `BrokerRequest` and calls the CP-7 broker's `handle()`;
|
|
26
|
+
* tests inject a deterministic stub. It receives ONLY the bounded prompt and
|
|
27
|
+
* returns ONLY the bounded result — no raw network, no ambient creds.
|
|
28
|
+
*/
|
|
29
|
+
export interface ConflictModelCaller {
|
|
30
|
+
resolve(prompt: ResolverPrompt): Promise<ResolverModelResult>;
|
|
31
|
+
}
|
|
32
|
+
/** Inputs for resolving one class-2 conflict hunk. */
|
|
33
|
+
export interface ResolveClass2Input {
|
|
34
|
+
meta: ConflictFileMeta;
|
|
35
|
+
hunk: ConflictHunk;
|
|
36
|
+
repoId: string;
|
|
37
|
+
mergeImplId: string;
|
|
38
|
+
/** Bounded surrounding-file context bytes (the assembler's responsibility). */
|
|
39
|
+
surroundingContext: string;
|
|
40
|
+
/** Max prompt bytes; exceeding → escalate to human (§8). */
|
|
41
|
+
maxContextBytes: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ResolveClass2Deps {
|
|
44
|
+
store: ConflictResolutionStore;
|
|
45
|
+
caller: ConflictModelCaller;
|
|
46
|
+
}
|
|
47
|
+
/** The outcome of a class-2 resolve attempt. */
|
|
48
|
+
export type ResolveClass2Result = {
|
|
49
|
+
status: 'resolved';
|
|
50
|
+
/** The recorded ConflictResolution (`replayed` true = served from the store). */
|
|
51
|
+
record: ConflictResolutionRecord;
|
|
52
|
+
replayed: boolean;
|
|
53
|
+
/** SHA-256 of the prompt bytes sent to the broker (audit). Absent on replay. */
|
|
54
|
+
promptHash?: string;
|
|
55
|
+
/** SHA-256 of the model response bytes (audit). Absent on replay. */
|
|
56
|
+
responseHash?: string;
|
|
57
|
+
} | {
|
|
58
|
+
/** Escalate to the human gate (class-3) — over-budget context or a
|
|
59
|
+
* fail-closed model-call failure. NEVER an ambient fallback. */
|
|
60
|
+
status: 'escalate';
|
|
61
|
+
reason: string;
|
|
62
|
+
humanGateTrigger: 'context_budget' | 'model_call_failed';
|
|
63
|
+
};
|
|
64
|
+
/** Assemble the bounded resolver prompt (only these bytes cross the boundary). */
|
|
65
|
+
export declare function assembleResolverPrompt(input: ResolveClass2Input): ResolverPrompt;
|
|
66
|
+
/** Deterministic byte size of a prompt (for the §8 budget check). */
|
|
67
|
+
export declare function promptByteSize(prompt: ResolverPrompt): number;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve one class-2 conflict hunk (§4.3 / §8). Replay-first, bounded-context,
|
|
70
|
+
* brokered, fail-closed. Records the resolution on a fresh resolve. The caller
|
|
71
|
+
* (W3-6) composes the resolved hunk into the file and Tier-2-reviews the merged
|
|
72
|
+
* result before promote.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveClass2(input: ResolveClass2Input, deps: ResolveClass2Deps): Promise<ResolveClass2Result>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ConflictModelCaller, ResolverModelResult, ResolverPrompt } from './class2-resolver';
|
|
2
|
+
/** The single confined model invocation the caller depends on (injected). */
|
|
3
|
+
export interface ConfinedModelRunner {
|
|
4
|
+
/**
|
|
5
|
+
* Run the model over `promptText` under the engaged confinement (substrate
|
|
6
|
+
* broker path A, or trusted-container legacy spawn path B) and return its raw
|
|
7
|
+
* stdout. MUST run read-only over only the prompt bytes; MUST NOT expose an
|
|
8
|
+
* ambient vendor credential to an unconfined child (the factory guarantees the
|
|
9
|
+
* confinement before constructing the caller). Throws on spawn/timeout failure.
|
|
10
|
+
*/
|
|
11
|
+
runConfinedModel(promptText: string): Promise<string>;
|
|
12
|
+
/** The merge-gate audit scope (Stage-2 r2 codex LOW) — carried for the audit trail. */
|
|
13
|
+
ownerTaskId: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Render the bounded class-2 resolver prompt as model-ready text. Only the
|
|
17
|
+
* `ResolverPrompt` bytes (the three 3-way sides + the already-budget-checked
|
|
18
|
+
* surrounding context) cross the boundary. Instructs a STRICT JSON reply so the
|
|
19
|
+
* parse is unambiguous + fail-closed.
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderResolverPromptText(prompt: ResolverPrompt): string;
|
|
22
|
+
/**
|
|
23
|
+
* Extract the STRICT JSON `ResolverModelResult` from the model's raw stdout.
|
|
24
|
+
* Tolerates surrounding whitespace + a single fenced ```json block, but requires
|
|
25
|
+
* a well-formed object with a string[] `resolvedHunkLines`. Throws (fail-closed)
|
|
26
|
+
* on anything else — `resolveClass2` escalates the hunk to the human gate.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseResolverModelResult(raw: string): ResolverModelResult;
|
|
29
|
+
/**
|
|
30
|
+
* The concrete confined class-2 model caller (§2.1). Constructed ONLY when a
|
|
31
|
+
* confinement holds (path A/B); path C never reaches here (the factory returns
|
|
32
|
+
* `null` → the gate runs without a resolver → halt-on-conflict). Errors propagate
|
|
33
|
+
* to `resolveClass2`, which escalates fail-closed to the human gate.
|
|
34
|
+
*/
|
|
35
|
+
export declare class ConfinedModelCaller implements ConflictModelCaller {
|
|
36
|
+
private readonly runner;
|
|
37
|
+
constructor(runner: ConfinedModelRunner);
|
|
38
|
+
resolve(prompt: ResolverPrompt): Promise<ResolverModelResult>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ConflictClassification, ConflictFileMeta } from './conflict-types';
|
|
2
|
+
import { type SharedContractDetectorOptions } from './shared-contract-detector';
|
|
3
|
+
/**
|
|
4
|
+
* Classify a single conflicting path (§4.3). The result's `class` is FINAL for
|
|
5
|
+
* class-3 and for the lockfile class-1 route; for a general content conflict the
|
|
6
|
+
* result is class-2 (content-eligible) and the resolve pipeline (W3-6) may
|
|
7
|
+
* downgrade it to class-1 if a deterministic reconciler proves it order/format
|
|
8
|
+
* only. Pure + deterministic.
|
|
9
|
+
*
|
|
10
|
+
* Order (first match wins, hard triggers first so they can never be bypassed):
|
|
11
|
+
* 1. non-content conflict kind → class-3 (FINAL)
|
|
12
|
+
* 2. binary → class-3 (FINAL)
|
|
13
|
+
* 2b. non-UTF-8 text (no NUL) → class-3 (FINAL) — the UTF-8 diff3 path would corrupt it
|
|
14
|
+
* 3. Git-LFS → class-3 (FINAL)
|
|
15
|
+
* 4. dangerous .gitattributes driver → class-3 (FINAL)
|
|
16
|
+
* 5. HARD shared-contract (detector hardGate ∪ planner) → class-3 (FINAL)
|
|
17
|
+
* 6. lockfile (detector, non-hard) → class-1 (reconciler: 'lockfile')
|
|
18
|
+
* 7. otherwise (regular-file text content) → class-2 (content-eligible)
|
|
19
|
+
* [add/add is a class-3 hard kind at step 1, never reaches here]
|
|
20
|
+
*/
|
|
21
|
+
export declare function classifyConflict(meta: ConflictFileMeta, opts?: SharedContractDetectorOptions): ConflictClassification;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AgenticResolutionRecord, ConflictResolutionRecord, ConflictResolutionStore } from './conflict-resolution-store';
|
|
2
|
+
import type { ResolutionSetEntry, ResolutionSetIndex } from './resolution-set-index';
|
|
3
|
+
/** Symmetric content cipher for at-rest encryption (the team session key, cli.ts). */
|
|
4
|
+
export interface ContentCipher {
|
|
5
|
+
encrypt(plaintext: string): string;
|
|
6
|
+
decrypt(ciphertext: string): string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The durable, content-encrypted {@link ConflictResolutionStore} (§2.4). Loads the
|
|
10
|
+
* per-group file once, serves reads from memory, and flushes atomically on each
|
|
11
|
+
* `put`. Idempotent on `conflict_id` (the recorded resolution for an exact 3-way
|
|
12
|
+
* input is immutable — a second put keeps the original).
|
|
13
|
+
*
|
|
14
|
+
* SINGLE-WRITER INVARIANT (Stage-2 r1 agy LOW): the in-memory cache assumes ONE
|
|
15
|
+
* live instance per group at a time. That holds by construction — the store is
|
|
16
|
+
* built ONCE per merge-gate run (`runWorktreeMergeBranch`) and written only inside
|
|
17
|
+
* the SEQUENTIAL merge-train (one slot at a time), and the merge gate is dispatched
|
|
18
|
+
* at most once per group. Two concurrent gate runs for the same group would be a
|
|
19
|
+
* separate (double-promote) bug; if that invariant is ever relaxed, this store
|
|
20
|
+
* needs a per-group RMW lock (cf. `RevertManifestStore.withTrackTipLock`).
|
|
21
|
+
*/
|
|
22
|
+
export declare class DurableConflictResolutionStore implements ConflictResolutionStore {
|
|
23
|
+
private readonly group;
|
|
24
|
+
private readonly cipher?;
|
|
25
|
+
private cache;
|
|
26
|
+
private agenticCache;
|
|
27
|
+
/** attemptId → keys (conflict_id / instance_id) written PENDING under it (CP-14 WB2). */
|
|
28
|
+
private pendingCache;
|
|
29
|
+
constructor(opts: {
|
|
30
|
+
taskGroupId: string;
|
|
31
|
+
rootDir?: string;
|
|
32
|
+
cipher?: ContentCipher;
|
|
33
|
+
});
|
|
34
|
+
private load;
|
|
35
|
+
private decode;
|
|
36
|
+
private encode;
|
|
37
|
+
get(conflictId: string): Promise<ConflictResolutionRecord | null>;
|
|
38
|
+
put(record: ConflictResolutionRecord, attemptId?: string): Promise<ConflictResolutionRecord>;
|
|
39
|
+
private loadAgentic;
|
|
40
|
+
private decodeAgentic;
|
|
41
|
+
private encodeAgentic;
|
|
42
|
+
getAgentic(instanceId: string): Promise<AgenticResolutionRecord | null>;
|
|
43
|
+
putAgentic(record: AgenticResolutionRecord, attemptId?: string): Promise<AgenticResolutionRecord>;
|
|
44
|
+
private loadPending;
|
|
45
|
+
/** Durably record that `key` was written PENDING under `attemptId` (no-op without an attemptId). */
|
|
46
|
+
private trackPending;
|
|
47
|
+
clearPending(attemptId: string): Promise<void>;
|
|
48
|
+
delete(key: string): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
/** The durable {@link ResolutionSetIndex} (§2.3) — structural, no content, plaintext. */
|
|
51
|
+
export declare class DurableResolutionSetIndex implements ResolutionSetIndex {
|
|
52
|
+
private readonly group;
|
|
53
|
+
private cache;
|
|
54
|
+
constructor(opts: {
|
|
55
|
+
taskGroupId: string;
|
|
56
|
+
rootDir?: string;
|
|
57
|
+
});
|
|
58
|
+
private load;
|
|
59
|
+
get(setHash: string): Promise<ResolutionSetEntry | null>;
|
|
60
|
+
put(setHash: string, entry: ResolutionSetEntry): Promise<void>;
|
|
61
|
+
}
|