@quantiya/codevibe-core 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/agy-cli-contract.d.ts +14 -0
- package/dist/appsync/appsync-client.d.ts +59 -31
- package/dist/appsync/event-throttle.d.ts +33 -0
- package/dist/appsync/index.d.ts +3 -2
- package/dist/appsync/queries.d.ts +4 -2
- package/dist/auth/auth-telemetry.d.ts +26 -0
- package/dist/auth/vendor-key-cli.d.ts +49 -0
- package/dist/companion-mode/index.d.ts +36 -22
- package/dist/companion-mode/persist-preference.d.ts +1 -5
- package/dist/companion-mode/resolve-agent.d.ts +5 -4
- package/dist/config/config.d.ts +0 -5
- package/dist/credential-broker/__tests__/upstream-result-helpers.d.ts +21 -0
- package/dist/credential-broker/broker.d.ts +196 -12
- package/dist/credential-broker/chatgpt-config.d.ts +40 -0
- package/dist/credential-broker/index.d.ts +4 -1
- package/dist/credential-broker/oauth-account-lock.d.ts +104 -0
- package/dist/credential-broker/oauth-refresh.d.ts +72 -0
- package/dist/credential-broker/types.d.ts +165 -17
- package/dist/credential-broker/upstream-client.d.ts +3 -2
- package/dist/credential-broker/vendor-key-store.d.ts +32 -1
- package/dist/crypto/__tests__/encrypt-for-emit.test.d.ts +1 -0
- package/dist/crypto/encrypt-for-emit.d.ts +39 -0
- package/dist/crypto/index.d.ts +2 -0
- package/dist/daemon/__tests__/process-guards.test.d.ts +1 -0
- package/dist/daemon/index.d.ts +2 -0
- package/dist/daemon/process-guards.d.ts +38 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +308 -281
- package/dist/keychain/keychain-manager.d.ts +25 -4
- package/dist/local-executor/__tests__/reviewer-rationale-flag.test.d.ts +1 -0
- package/dist/local-executor/class-a-sign.d.ts +15 -0
- package/dist/local-executor/group-decision-outcome.d.ts +11 -0
- package/dist/local-executor/implementor-argv.d.ts +89 -7
- package/dist/local-executor/local-executor-impl.d.ts +18 -7
- package/dist/local-executor/merge-conflict-resolve.d.ts +19 -0
- package/dist/local-executor/revert-reconcile.d.ts +12 -0
- package/dist/local-executor/reviewer-rationale-flag.d.ts +10 -0
- package/dist/local-executor/types.d.ts +1 -0
- package/dist/local-model/manager.d.ts +1 -1
- package/dist/local-model/ollama.d.ts +40 -0
- package/dist/orchestration/__tests__/detect-agents.test.d.ts +1 -0
- package/dist/orchestration/detect-agents.d.ts +10 -30
- package/dist/orchestration/index.d.ts +1 -2
- package/dist/orchestration-shell/__tests__/a1a-planner-offers.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/a6-cli-surface.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/advisory-attachments-dir-race.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/advisory-multi-mention-panel.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/advisory-panel-attachments.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/advisory-quota-stdout-result.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/agent-turn-context-batch.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/bounded-shutdown.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/brainstorm-quorum-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/brainstorm-quorum.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-team-session-key.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/command-intent.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-compaction.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-items-hosted-sync.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-items-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-items.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp8-full-team-events.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp8-team-decomposed-zk.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/explicit-tty-exit.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/mention-suggest.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/route-browse-summarize-recovery.test.d.ts +1 -0
- package/dist/orchestration-shell/attachments.d.ts +58 -2
- package/dist/orchestration-shell/bounded-shutdown.d.ts +16 -0
- package/dist/orchestration-shell/brainstorm-quorum.d.ts +118 -0
- package/dist/orchestration-shell/cli.d.ts +97 -70
- package/dist/orchestration-shell/cli.js +30990 -22426
- package/dist/orchestration-shell/command-intent.d.ts +56 -0
- package/dist/orchestration-shell/components/InputBar.d.ts +6 -0
- package/dist/orchestration-shell/components/OrchestrationApp.d.ts +2 -0
- package/dist/orchestration-shell/context-compaction.d.ts +264 -0
- package/dist/orchestration-shell/context-items-hosted-sync.d.ts +19 -0
- package/dist/orchestration-shell/context-items.d.ts +408 -0
- package/dist/orchestration-shell/context-store.d.ts +162 -0
- package/dist/orchestration-shell/emit-shell-event.d.ts +34 -13
- package/dist/orchestration-shell/explicit-tty-exit.d.ts +18 -0
- package/dist/orchestration-shell/gate-prompts.d.ts +3 -3
- package/dist/orchestration-shell/index.d.ts +306 -37
- package/dist/orchestration-shell/mention-suggest.d.ts +11 -0
- package/dist/orchestration-shell/mode-selection.d.ts +4 -22
- package/dist/orchestration-shell/quorum-loop.d.ts +336 -20
- package/dist/orchestration-shell/task-progress.d.ts +2 -0
- package/dist/orchestration-shell/team-decompose.d.ts +37 -19
- package/dist/orchestration-shell/types.d.ts +71 -4
- package/dist/planner/index.d.ts +1 -1
- package/dist/planner/local-advisory.d.ts +12 -0
- package/dist/planner/local-gemma.d.ts +27 -0
- package/dist/planner/types.d.ts +7 -0
- package/dist/reviewer/index.d.ts +0 -2
- package/dist/reviewer/provider.d.ts +9 -6
- package/dist/reviewer/providers/antigravity.d.ts +2 -3
- package/dist/reviewer/registry.d.ts +9 -4
- package/dist/reviewer/token-usage.d.ts +10 -0
- package/dist/session/__tests__/device-registration-lease.test.d.ts +1 -0
- package/dist/session/__tests__/pending-session-create.test.d.ts +1 -0
- package/dist/session/__tests__/session-rekey-fingerprint.test.d.ts +1 -0
- package/dist/session/__tests__/session-resume-key-reconciliation.test.d.ts +1 -0
- package/dist/session/__tests__/session-resume-pending-first.test.d.ts +1 -0
- package/dist/session/device-key-watcher.d.ts +1 -0
- package/dist/session/index.d.ts +4 -2
- package/dist/session/pending-session-create.d.ts +61 -0
- package/dist/session/register-device-key.d.ts +11 -1
- package/dist/session/session-rekey.d.ts +4 -5
- package/dist/session/session-resume.d.ts +21 -1
- package/dist/substrate/docker.d.ts +7 -0
- package/dist/substrate/sandbox-exec.d.ts +17 -3
- package/dist/substrate/types.d.ts +32 -3
- package/dist/substrate-launch/apikey-bootstrap.d.ts +24 -1
- package/dist/substrate-launch/engage-substrate.d.ts +17 -0
- package/dist/substrate-launch/sanitized-env.d.ts +5 -5
- package/dist/tool-activity/__tests__/consolidator.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/digest.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/flock-rollout-lock.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/ledger.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/outbox.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/replay-cursor.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/session-map.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/socket-rollout-lock.test.d.ts +1 -0
- package/dist/tool-activity/atomic-file.d.ts +27 -0
- package/dist/tool-activity/consolidator.d.ts +253 -0
- package/dist/tool-activity/digest.d.ts +4 -0
- package/dist/tool-activity/flock-rollout-lock.d.ts +68 -0
- package/dist/tool-activity/index.d.ts +9 -0
- package/dist/tool-activity/ledger.d.ts +274 -0
- package/dist/tool-activity/outbox.d.ts +60 -0
- package/dist/tool-activity/replay-cursor.d.ts +156 -0
- package/dist/tool-activity/session-map.d.ts +133 -0
- package/dist/tool-activity/socket-rollout-lock.d.ts +57 -0
- package/dist/tool-activity/types.d.ts +368 -0
- package/dist/types/encryption.d.ts +4 -0
- package/dist/types/events.d.ts +24 -4
- package/dist/types/session.d.ts +32 -2
- package/package.json +5 -4
- package/dist/orchestration/orchestration-cli.d.ts +0 -12
- package/dist/orchestration/setup-bootstrap.d.ts +0 -146
- package/dist/orchestration/setup-failure-recourse.d.ts +0 -23
- package/dist/orchestration/setup-save.d.ts +0 -47
- package/dist/orchestration/setup-seat-picker.d.ts +0 -72
- package/dist/orchestration/setup-telemetry.d.ts +0 -54
- package/dist/orchestration/setup-test-agents.d.ts +0 -108
- package/dist/orchestration/setup-types.d.ts +0 -146
- package/dist/orchestration/setup-wizard.d.ts +0 -57
- package/dist/orchestration-shell/cohort-flag.d.ts +0 -16
- package/dist/reviewer/providers/gemini.d.ts +0 -109
- /package/dist/{companion-mode/__tests__/detect-parallel.test.d.ts → appsync/__tests__/appsync-client-context-items.test.d.ts} +0 -0
- /package/dist/{orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts → appsync/__tests__/heartbeat-active.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-bootstrap.test.d.ts → appsync/__tests__/orphan-sweep-null-heartbeat.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-failure-recourse.test.d.ts → auth/__tests__/vendor-key-cli.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-save.test.d.ts → companion-mode/__tests__/mode-selected-emit.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-seat-picker.test.d.ts → companion-mode/__tests__/private-launcher-detection.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-telemetry.test.d.ts → companion-mode/__tests__/private-launcher-path.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-test-agents.test.d.ts → credential-broker/__tests__/broker-c4.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-types.test.d.ts → credential-broker/__tests__/broker-streaming.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-wizard.test.d.ts → credential-broker/__tests__/chatgpt-config.test.d.ts} +0 -0
- /package/dist/{reviewer/providers/__tests__/gemini-live-smoke.test.d.ts → credential-broker/__tests__/oauth-account-lock.test.d.ts} +0 -0
- /package/dist/{reviewer/providers/__tests__/gemini.test.d.ts → credential-broker/__tests__/oauth-refresh.test.d.ts} +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AppSyncClient } from '../appsync';
|
|
2
|
+
import { type Session } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* §3 LOCK lines 173-181. Names + per-type metadata shapes are part of
|
|
4
5
|
* the Stage A contract. CP-1.a ships the union; CP-1.b/c/d add call
|
|
5
6
|
* sites for each emit type.
|
|
6
7
|
*/
|
|
7
|
-
export type NewEventTypeKind = 'MODE_SELECTED' | 'PLANNER_DECISION' | 'PLANNER_CACHE_HIT' | 'PLANNER_DEGRADED' | 'PLANNER_OUTAGE' | 'PLANNER_RECOVERED' | 'SLASH_COMMAND_INVOKED' | 'STRUCTURAL_SUMMARY_GENERATED' | 'LOCAL_AUTHORITY_REFUSAL' | 'NOTIFICATION' | 'ASSISTANT_RESPONSE' | 'USER_PROMPT';
|
|
8
|
+
export type NewEventTypeKind = 'MODE_SELECTED' | 'PLANNER_DECISION' | 'PLANNER_CACHE_HIT' | 'PLANNER_DEGRADED' | 'PLANNER_OUTAGE' | 'PLANNER_RECOVERED' | 'SLASH_COMMAND_INVOKED' | 'STRUCTURAL_SUMMARY_GENERATED' | 'LOCAL_AUTHORITY_REFUSAL' | 'NOTIFICATION' | 'TEAM_DECOMPOSED' | 'TEAM_TRACK_STATUS' | 'TEAM_GROUP_RESOLVED' | 'ASSISTANT_RESPONSE' | 'USER_PROMPT' | 'INTERACTIVE_PROMPT';
|
|
8
9
|
/**
|
|
9
10
|
* §3 LOCK lines 160-170. ShellEventEmit contract.
|
|
10
11
|
*
|
|
@@ -29,6 +30,10 @@ export interface ShellEventEmit {
|
|
|
29
30
|
isEncrypted: true;
|
|
30
31
|
/** RFC3339; if omitted, server fills in via existing VTL. */
|
|
31
32
|
timestamp?: string;
|
|
33
|
+
/** Pre-minted nonce when encrypted metadata must bind the response nonce. */
|
|
34
|
+
writerEventNonce?: string;
|
|
35
|
+
/** Proven local key mismatch: emit the safe legacy joined fallback. */
|
|
36
|
+
disableWriterAttestation?: boolean;
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* Test seam — allows the unit tests to swap the AppSync client without
|
|
@@ -38,27 +43,43 @@ export interface ShellEventEmit {
|
|
|
38
43
|
export interface EmitShellEventDeps {
|
|
39
44
|
appsyncClient: Pick<AppSyncClient, 'createEvent'>;
|
|
40
45
|
getSessionKey: (sessionId: string) => Promise<string | null>;
|
|
41
|
-
|
|
46
|
+
session?: Session;
|
|
42
47
|
}
|
|
48
|
+
export type ShellEventEmitResult = {
|
|
49
|
+
emitted: true;
|
|
50
|
+
eventId: string;
|
|
51
|
+
sessionId: string;
|
|
52
|
+
type: NewEventTypeKind;
|
|
53
|
+
source: 'DESKTOP';
|
|
54
|
+
writer?: {
|
|
55
|
+
authenticated: true;
|
|
56
|
+
eventNonce: string;
|
|
57
|
+
contentCiphertextSha256: string;
|
|
58
|
+
metadataCiphertextSha256: string;
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
emitted: false;
|
|
62
|
+
reason: 'missing_session_key' | 'auth_required' | 'auth_unavailable' | 'create_failed' | 'definitive_rejection' | 'invalid_response' | 'writer_ineligible';
|
|
63
|
+
error?: unknown;
|
|
64
|
+
};
|
|
43
65
|
/**
|
|
44
|
-
* §3 LOCK lines 184-207. Single chokepoint enforcing the
|
|
45
|
-
*
|
|
66
|
+
* §3 LOCK lines 184-207. Single chokepoint enforcing the encryption
|
|
67
|
+
* invariants for all 9 new EventTypes.
|
|
46
68
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* (existing surface, no schema change).
|
|
69
|
+
* Encrypts content + metadata under the session key, then calls
|
|
70
|
+
* `createEvent` via Pattern B Lambda resolver (existing surface, no
|
|
71
|
+
* schema change). Emits unconditionally (the cohort gate was removed).
|
|
51
72
|
*
|
|
52
73
|
* `deps` is the test seam. Production callers omit it and the function
|
|
53
74
|
* resolves the default `keychainManager` + `cryptoService` references.
|
|
54
75
|
* The AppSync client is REQUIRED — there is no global default in
|
|
55
76
|
* codevibe-core (each plugin instantiates its own `AppSyncClient`).
|
|
56
77
|
*/
|
|
57
|
-
export declare function emitShellEvent(args: ShellEventEmit, deps: EmitShellEventDeps): Promise<
|
|
78
|
+
export declare function emitShellEvent(args: ShellEventEmit, deps: EmitShellEventDeps): Promise<ShellEventEmitResult>;
|
|
58
79
|
/**
|
|
59
80
|
* Convenience helper for production callers — binds default
|
|
60
|
-
* dependencies (`keychainManager` for session-key lookup
|
|
61
|
-
*
|
|
62
|
-
*
|
|
81
|
+
* dependencies (`keychainManager` for session-key lookup) and accepts
|
|
82
|
+
* the AppSync client separately because there's no global default in
|
|
83
|
+
* `codevibe-core`.
|
|
63
84
|
*/
|
|
64
|
-
export declare function createShellEventEmitter(appsyncClient: Pick<AppSyncClient, 'createEvent'
|
|
85
|
+
export declare function createShellEventEmitter(appsyncClient: Pick<AppSyncClient, 'createEvent'>, session?: Session): (args: ShellEventEmit) => Promise<ShellEventEmitResult>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ExplicitTtyExitDeps {
|
|
2
|
+
runPlannerTeardown: () => Promise<void>;
|
|
3
|
+
retireSession: () => Promise<void>;
|
|
4
|
+
unmount: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface ExplicitTtyExitCoordinator {
|
|
7
|
+
completion: Promise<void>;
|
|
8
|
+
start: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Owns the explicit `/exit` and `/quit` boundary for the Ink shell.
|
|
12
|
+
*
|
|
13
|
+
* Ink's `waitUntilExit()` normally resolves after `unmount()`, but terminal
|
|
14
|
+
* stream teardown can leave that promise pending. The explicit completion
|
|
15
|
+
* promise lets the shell continue into its catch-all cleanup after the durable
|
|
16
|
+
* session retirement has finished, independent of Ink's internal exit promise.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createExplicitTtyExitCoordinator(deps: ExplicitTtyExitDeps): ExplicitTtyExitCoordinator;
|
|
@@ -71,8 +71,8 @@ export interface GatePromptOption {
|
|
|
71
71
|
readonly description: string;
|
|
72
72
|
/**
|
|
73
73
|
* PHASE-CP-10-MIN (#585) — the per-option target agent for the
|
|
74
|
-
* `continuation_offer_handoff` prompt (CLAUDE/CODEX/
|
|
75
|
-
* On the wire the 3
|
|
74
|
+
* `continuation_offer_handoff` prompt (CLAUDE/CODEX/ANTIGRAVITY).
|
|
75
|
+
* On the wire the 3 agent options all carry `id: "CONTINUE_WITH"` (a valid
|
|
76
76
|
* `UserDecisionKind`); the agent rides this NEW per-option `targetAgent`
|
|
77
77
|
* field (Rust `OptionPayload.target_agent` with
|
|
78
78
|
* `#[serde(rename="targetAgent", skip_serializing_if="Option::is_none")]`,
|
|
@@ -114,7 +114,7 @@ export interface GatePromptEnvelope {
|
|
|
114
114
|
readonly verdictDetails?: GateVerdictDetails;
|
|
115
115
|
/** The continuation offer's desktop-minted ULID (`metadata.offerId`). */
|
|
116
116
|
readonly offerId?: string;
|
|
117
|
-
/** The agent that halted (closed enum CLAUDE/CODEX/
|
|
117
|
+
/** The agent that halted (closed enum CLAUDE/CODEX/ANTIGRAVITY; `metadata.sourceAgent`). */
|
|
118
118
|
readonly sourceAgent?: string;
|
|
119
119
|
/** The authoritative 64-hex SHA-256 packet hash (`metadata.packetHash`). */
|
|
120
120
|
readonly packetHash?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
1
2
|
import { AppSyncClient } from '../appsync';
|
|
2
3
|
import { Session } from '../types';
|
|
3
4
|
import { OrchestrationStore } from './store';
|
|
@@ -6,9 +7,11 @@ import { type GroupDecisionSubmitDeps } from './gate-decision-submit';
|
|
|
6
7
|
import { type ContinuationCliResult, type ContinuationCliDeps } from './slash-routes/continuation';
|
|
7
8
|
import { loadReviewerWizardData } from './slash-routes/reviewers';
|
|
8
9
|
import { createShellEventEmitter } from './emit-shell-event';
|
|
10
|
+
import { type AgentMentionIntent, type CommandIntentTarget } from './command-intent';
|
|
11
|
+
import { type BrainstormPanelActiveAgent } from './brainstorm-quorum';
|
|
9
12
|
import { type RunAuditBrowserResult } from './audit-runner';
|
|
10
13
|
import { Tier } from './types';
|
|
11
|
-
import type { PendingClarification } from './types';
|
|
14
|
+
import type { ConversationEntry, PendingClarification } from './types';
|
|
12
15
|
import { type GatePromptEnvelope, type DecryptedReviewSummaryInput } from './gate-prompts';
|
|
13
16
|
import type { Event, UpdateEventStatusInput } from '../types/events';
|
|
14
17
|
import { type StructuralSummaryGenerator } from '../structural-summary';
|
|
@@ -21,7 +24,13 @@ import type { WorkItemInput, DisjointnessRejection, RevertManifestStore } from '
|
|
|
21
24
|
import type { QuorumLoop } from './quorum-loop';
|
|
22
25
|
import { ensureFreshContextStore } from './context-store';
|
|
23
26
|
import type { EnsureFreshResult } from './context-store';
|
|
27
|
+
import { contextItemOccurrence, type ContextDurabilityReceipt } from './context-items';
|
|
28
|
+
import { renderRehydratedSessionContext } from './context-compaction';
|
|
24
29
|
import { type TaskProgressEvent } from './task-progress';
|
|
30
|
+
export declare class OrchestrationShellStartupError extends Error {
|
|
31
|
+
readonly cause?: unknown;
|
|
32
|
+
constructor(message: string, cause?: unknown);
|
|
33
|
+
}
|
|
25
34
|
export interface RunOrchestrationShellArgs {
|
|
26
35
|
/** Authenticated AppSync client (caller is responsible for `authenticateWithStoredTokens`). */
|
|
27
36
|
appsyncClient: AppSyncClient;
|
|
@@ -29,6 +38,11 @@ export interface RunOrchestrationShellArgs {
|
|
|
29
38
|
session: Session;
|
|
30
39
|
/** Current tier — used by the StatusBar + downstream tier gating. */
|
|
31
40
|
tier: Tier;
|
|
41
|
+
/**
|
|
42
|
+
* Startup lifecycle handoff. Called only after this function's catch-all
|
|
43
|
+
* teardown `finally` is armed; until then the admitting CLI owns retirement.
|
|
44
|
+
*/
|
|
45
|
+
acceptSessionLifecycleOwnership?: () => void;
|
|
32
46
|
/**
|
|
33
47
|
* CP-1.b IMPL r2 H-3 — Optional planner adapter. When supplied,
|
|
34
48
|
* `runOrchestrationShell` binds the active session via
|
|
@@ -93,7 +107,7 @@ export interface RunOrchestrationShellArgs {
|
|
|
93
107
|
* (a) subscribes `subscribeToClassBPackets(session.userId)` →
|
|
94
108
|
* `localExecutor.consumeClassB(packet)` (item 2) + teardown cleanup;
|
|
95
109
|
* (b) enables the `/team` slash command (item 5).
|
|
96
|
-
* A single-track/Companion
|
|
110
|
+
* A single-track/Companion session OMITS this — no Class B
|
|
97
111
|
* subscription, no team mode, no status node (byte-identical behavior).
|
|
98
112
|
*/
|
|
99
113
|
localExecutor?: LocalExecutor;
|
|
@@ -128,7 +142,7 @@ export interface RunOrchestrationShellArgs {
|
|
|
128
142
|
* `runOrchestrationShell` installs the store-dispatching `fn` so the loop's
|
|
129
143
|
* `onProgress` events render as an ephemeral spinner line + persisted
|
|
130
144
|
* milestones, and emits `waiting_user` when a gate prompt arrives. A non-loop
|
|
131
|
-
* / Companion
|
|
145
|
+
* / Companion session OMITS this — no spinner line ever renders.
|
|
132
146
|
*/
|
|
133
147
|
progressTap?: {
|
|
134
148
|
fn: (event: TaskProgressEvent) => void;
|
|
@@ -140,7 +154,7 @@ export interface RunOrchestrationShellArgs {
|
|
|
140
154
|
* PolicyRejection becomes a classified `SHELL_ADVISORY` in the conversation
|
|
141
155
|
* (the existing mobile NOTIFICATION path is unchanged). The shadow-discard side
|
|
142
156
|
* is handled by `cli.ts` (which holds the QuorumLoop reference). A non-loop /
|
|
143
|
-
* Companion
|
|
157
|
+
* Companion session OMITS this.
|
|
144
158
|
*/
|
|
145
159
|
policyRejectionTap?: {
|
|
146
160
|
fn: (info: {
|
|
@@ -149,6 +163,22 @@ export interface RunOrchestrationShellArgs {
|
|
|
149
163
|
recommendedRecovery: string;
|
|
150
164
|
}) => void;
|
|
151
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* A1e (P3 slice-wiring REMAP) — the dispatch-context tap holder (`cli.ts`
|
|
168
|
+
* builds it alongside the loop). When present, `runOrchestrationShell`
|
|
169
|
+
* installs the real composer (`composeDispatchContextBlock`): the resolved
|
|
170
|
+
* `context_ref` structural slice + the FRESH-ONLY `repo_state` overview,
|
|
171
|
+
* with the §8.3 stale→background-re-delegation hook wired to the quiet
|
|
172
|
+
* frontier re-read. A non-loop / Companion session OMITS this — the
|
|
173
|
+
* implementor stdin stays byte-identical to pre-A1e.
|
|
174
|
+
*/
|
|
175
|
+
dispatchContextTap?: {
|
|
176
|
+
fn: (input: {
|
|
177
|
+
taskId: string;
|
|
178
|
+
agent: string;
|
|
179
|
+
roundNumber: number;
|
|
180
|
+
}) => Promise<string>;
|
|
181
|
+
};
|
|
152
182
|
/**
|
|
153
183
|
* PHASE-589/469 W3.2 — the two-phase group-escalation decision deps, built in
|
|
154
184
|
* `cli.ts` alongside the team LE (the keychain/E2E/signing-heavy assembly:
|
|
@@ -189,10 +219,12 @@ export interface TeamTapEvent {
|
|
|
189
219
|
}
|
|
190
220
|
export { processMarkers, withRoleMarker } from './process-markers';
|
|
191
221
|
export { emitShellEvent, createShellEventEmitter, type ShellEventEmit, type NewEventTypeKind, } from './emit-shell-event';
|
|
192
|
-
export { pickMode,
|
|
222
|
+
export { pickMode, type ModeSelectionDeps, } from './mode-selection';
|
|
193
223
|
export { readStickyPreference, writeStickyPreference, stickyPreferenceFilePath, } from './sticky-preference';
|
|
194
|
-
export {
|
|
195
|
-
export {
|
|
224
|
+
export { deriveWorkspaceId, deriveRepoId, normalizeRepoRelativePath, contextStoreDir, loadContextStore, writeContextStore, writeRepoState, loadRepoState, type RepoStateRecord, gcContextStore, computeSummaryInputHash, probeFreshness, ensureFreshContextStore, mintContextRef, resolveContextRef, sliceSummary, type ContextRef, type SliceSelector, type SliceSelectorEntry, type ContextStoreMetadata, type ContextStoreEntry, type ResolvedContextSlice, type FreshnessProbeResult, type EnsureFreshResult, type EnsureFreshDeps, } from './context-store';
|
|
225
|
+
export { CONTEXT_SESSION_PSEUDO_TASK_NAMESPACE, deriveSessionPseudoTaskId, auditPartitionTaskIdFor, appendContextItem, flushContextItems, readContextItems, readVerifiedContextItems, verifyContextItemChain, buildContextItemWireRow, decryptContextItemWireRow, projectItemsForRole, labelPermitsRole, projectRepoStateForDispatch, appendRepoStateItem, composeDispatchContextBlock, contextItemsLogPath, isTransientContextItem, DISPATCH_CONTEXT_MAX_CHARS, NON_GIT_REPO_STATE_MAX_AGE_MS, type ContextItem, type ContextItemDraft, type ContextItemKind, type ContextItemAuthor, type ContextItemSensitivity, type ContextItemProjectionRole, type ContextItemValidity, type ContextItemWireRow, type RepoStateBody, type RepoStateProjection, type ChainVerificationResult, type VerifiedContextItemsResult, } from './context-items';
|
|
226
|
+
export { configureContextItemsHostedSync, wakeContextItemsHostedSync, drainContextItemsHostedSync, clearContextItemsHostedSync, contextItemsHostedSyncStatePath, type ContextItemsHostedSyncDeps, } from './context-items-hosted-sync';
|
|
227
|
+
export { compactSessionContext, maybeFireCompactionSafetyValve, rehydrateSessionContext, renderRehydratedSessionContext, distillItems, projectDistilledForRole, loadCompactionCache, compactionCachePath, onTaskBoundary, gcContextItemLogs, scheduleContextItemsGc, COMPACTION_SAFETY_VALVE_TAIL_BYTES, COMPACTION_KEEP_HOT_RECENT_ITEMS, CONTEXT_ITEMS_RETENTION_MS, SESSION_CONTEXT_SECTION_MAX_CHARS, type DistilledFact, type DistilledTaskSummary, type SessionCompactionCache, type CompactionResult, type RehydratedSessionContext, } from './context-compaction';
|
|
196
228
|
export { routeSlashCommand, applySlashOutput, type SlashOutput, type ShellAction, } from './slash-router';
|
|
197
229
|
export { buildAuditBrowserModel, routeAuditEntry, auditKindLabel, auditKindCopy, renderAuditBrowserText, renderAuditEntryText, ENTRY_DETAILS_UNAVAILABLE, NO_AUDIT_ENTRIES, AUDIT_LOG_TOO_LARGE, AUDIT_LOG_TITLE, AUDIT_BROWSER_MAX_HEADLINE, WIRE_PUBLIC_PLAINTEXT_KINDS, type AuditBrowserModel, type AuditEntryModel, type AuditReviewerVerdictModel, type AuditTaskAuthorizedModel, type DecryptContentFn, } from './audit-browser';
|
|
198
230
|
export { runAuditBrowser, renderAuditResultText, AUDIT_BROWSER_UPGRADE_HINT, type RunAuditBrowserResult, type RunAuditBrowserDeps, } from './audit-runner';
|
|
@@ -202,6 +234,59 @@ export { createOrchestrationStore, type OrchestrationStore } from './store';
|
|
|
202
234
|
export type { Mode, Tier, PlannerDecision, AgentKind, PlannerHealthState, RunningTaskState, ReviewerSeatState, GateState, ExecutionEventEntry, RefusalEventEntry, BypassEventEntry, MobileEventEntry, EventStreamEntry, ConversationEntry, QueuedTask, PendingClarification, OrchestrationState, OrchestrationAction, LastModeFile, TeamState, TeamTrackEntry, TeamTrackState, TeamMergeGateStatus, LiveProgress, } from './types';
|
|
203
235
|
export { formatElapsed, isSpinnerPhase, renderProgressLine, type TaskProgressEvent, type OnProgress, } from './task-progress';
|
|
204
236
|
export { runDeclaredTestSurfaces, DECLARED_TEST_TIMEOUT_MS, type DeclaredTestResult, type DeclaredTestReason, type RunDeclaredTestSurfacesArgs, } from './declared-test-runner';
|
|
237
|
+
/**
|
|
238
|
+
* [A1g] Round-5 (Codex round-4 MEDIUM) — INVOCATION-OWNED conversation deltas.
|
|
239
|
+
*
|
|
240
|
+
* The turn mirror (`emitOrchestrationTurnMirror`) authors THIS turn's conductor
|
|
241
|
+
* reply + mobile `ASSISTANT_RESPONSE` from the entries this submission produced.
|
|
242
|
+
* It USED to slice a GLOBAL window (`conversation.slice(convLenBefore)` → end),
|
|
243
|
+
* which is only sound for a strictly-serialized turn. A slash COMMAND bypasses
|
|
244
|
+
* the NL queue (`serializeShellSubmissions`), so it runs CONCURRENTLY with an
|
|
245
|
+
* in-flight `@all` panel / NL turn; the global window then bleeds in the
|
|
246
|
+
* concurrent turn's non-`localOnly` advisory (e.g. the panel's joined
|
|
247
|
+
* `### Agent …` blob), which the bypassing (always-UNOWNED) mirror would author
|
|
248
|
+
* as its OWN conductor turn — MISATTRIBUTING the agents' design output to the
|
|
249
|
+
* conductor (defeating the F2 suppression the owning turn applies).
|
|
250
|
+
*
|
|
251
|
+
* The fix attributes each newly-appended `ConversationEntry` to the submission
|
|
252
|
+
* that dispatched it. `AsyncLocalStorage` carries a per-submission `ownEntries`
|
|
253
|
+
* sink; the wrapped `store.dispatch` (below) pushes each new conversation entry
|
|
254
|
+
* into the CURRENTLY-EXECUTING submission's sink. ALS propagates the context
|
|
255
|
+
* across `await`s AND isolates concurrent submissions, so `@all`'s advisory
|
|
256
|
+
* lands in `@all`'s sink and a concurrent `/status`'s mirror never sees it. The
|
|
257
|
+
* mirror then authors from `ownEntries` (this turn's OWN entries), not the
|
|
258
|
+
* global slice. Backward-compatible: callers/tests that pass no `ownEntries`
|
|
259
|
+
* fall back to the `convLenBefore` slice (unchanged behavior).
|
|
260
|
+
*/
|
|
261
|
+
export interface TurnAuthoringSink {
|
|
262
|
+
ownEntries: ConversationEntry[];
|
|
263
|
+
}
|
|
264
|
+
export declare const turnAuthoringContext: AsyncLocalStorage<TurnAuthoringSink>;
|
|
265
|
+
/**
|
|
266
|
+
* [A1g] Round-5 (Codex round-4 MEDIUM) — install the invocation-owned-delta
|
|
267
|
+
* attribution wrapper on `store.dispatch`. After each dispatch, any NEWLY
|
|
268
|
+
* appended `ConversationEntry` is pushed into the CURRENTLY-EXECUTING
|
|
269
|
+
* submission's `ownEntries` sink (from `turnAuthoringContext`). ALS hands the
|
|
270
|
+
* wrapper the right sink even across `await`s and through the whole handler
|
|
271
|
+
* call tree, so concurrent submissions (a slash bypass vs. an in-flight `@all`)
|
|
272
|
+
* never cross-contaminate each other's invocation-owned delta. Dispatched
|
|
273
|
+
* outside a submission (no active sink) ⇒ no attribution (those entries were
|
|
274
|
+
* never part of a turn's mirror anyway). Exported so the concurrent-isolation
|
|
275
|
+
* property can be unit-tested without spinning up the full TUI.
|
|
276
|
+
*
|
|
277
|
+
* [A1g] Round-6 (Codex round-5 MEDIUM) — detect new entries by ulid IDENTITY,
|
|
278
|
+
* NOT by `conversation.length` growth. The conversation is a RING BUFFER that
|
|
279
|
+
* front-evicts at `CONVERSATION_BUFFER_MAX` (reducer.ts `appendConversation`),
|
|
280
|
+
* so once at capacity an append keeps `length` FLAT — a length-growth test
|
|
281
|
+
* would then collect NOTHING, so the mirror emits neither the companion prompt
|
|
282
|
+
* nor the reply AND omits the human ContextItem, while the ownership token
|
|
283
|
+
* still drains the buffered panel replies → agent turns persisted WITHOUT their
|
|
284
|
+
* human question (fail-closed question-before-answer violation). An id-set diff
|
|
285
|
+
* is eviction-proof. A reentrancy depth-guard ensures a synchronous nested
|
|
286
|
+
* dispatch (a subscriber that re-dispatches) is attributed exactly once by the
|
|
287
|
+
* OUTERMOST diff — never double-pushed.
|
|
288
|
+
*/
|
|
289
|
+
export declare function installTurnAuthoringDispatchWrapper(store: OrchestrationStore): void;
|
|
205
290
|
/**
|
|
206
291
|
* §5 lines 336-365 LOCK + §16 LOCK #14. Single entrypoint that wires
|
|
207
292
|
* the store + emit chokepoint + slash router and either mounts the
|
|
@@ -339,6 +424,42 @@ export declare function createSubscribedEventDispatcher(deps: {
|
|
|
339
424
|
* #469]). Called from the `teamShellEventTap.fn` installed at startup.
|
|
340
425
|
*/
|
|
341
426
|
export declare function routeTeamShellEventToStore(store: OrchestrationStore, evt: TeamTapEvent): void;
|
|
427
|
+
export declare const BRAINSTORM_PANEL_ADVISORY_TIMEOUT_MS = 1800000;
|
|
428
|
+
export declare function routeReadOnlyAgentMention(args: {
|
|
429
|
+
store: OrchestrationStore;
|
|
430
|
+
shellArgs: RunOrchestrationShellArgs;
|
|
431
|
+
intent: AgentMentionIntent;
|
|
432
|
+
advisoryBrief: string;
|
|
433
|
+
/**
|
|
434
|
+
* [#637] This turn's validated image attachments + the ordered `[Image #N]`
|
|
435
|
+
* chip-path list — the SAME `turnAttachments`/`turnImagePaths` pair the /task
|
|
436
|
+
* path threads into `composeImplementationBrief`. When present, the panel
|
|
437
|
+
* dispatch rewrites the brief's image tokens to staged in-worktree refs and
|
|
438
|
+
* appends a per-agent read-list per cell, so a CLI advisory agent receives
|
|
439
|
+
* real file refs instead of the literal chip token / a raw local path.
|
|
440
|
+
*/
|
|
441
|
+
attachments?: ImageAttachment[];
|
|
442
|
+
attachmentPaths?: string[];
|
|
443
|
+
/**
|
|
444
|
+
* [#637] ALL `@`-mention targets of this turn (ordered, de-duplicated —
|
|
445
|
+
* `extractAllAgentMentionIntents`). Widens ONLY the LOCAL panel active set on
|
|
446
|
+
* a multi-mention directed turn; the FROZEN `CommandIntentEnvelope` still
|
|
447
|
+
* carries the FIRST mention (`args.intent`). Absent/single-element → exactly
|
|
448
|
+
* the prior directed behavior.
|
|
449
|
+
*/
|
|
450
|
+
mentionTargets?: readonly CommandIntentTarget[];
|
|
451
|
+
/**
|
|
452
|
+
* [A1g] Round-4 — the per-turn ownership token this invocation stamps when it
|
|
453
|
+
* commits to a panel turn (see `BrainstormTurnOwnership`). Optional so direct
|
|
454
|
+
* unit callers/tests can omit it; the turn-mirror reads the SAME object to
|
|
455
|
+
* decide whether to drain this turn's buffered replies.
|
|
456
|
+
*/
|
|
457
|
+
turnOwnership?: BrainstormTurnOwnership;
|
|
458
|
+
emitShellEventBound?: ReturnType<typeof createShellEventEmitter>;
|
|
459
|
+
promptText?: string;
|
|
460
|
+
promptOrigin?: 'desktop' | 'mobile';
|
|
461
|
+
mobilePromptEventId?: string;
|
|
462
|
+
}): Promise<boolean>;
|
|
342
463
|
/**
|
|
343
464
|
* PHASE-590 §3.D step 0 / §4.4 — compose the LOSSLESS implementation brief.
|
|
344
465
|
*
|
|
@@ -483,6 +604,8 @@ export declare function routeTeamDecompose(deps: {
|
|
|
483
604
|
/** Stage-2 R3 HIGH — the loop's durable store, so the live launch persists the retained spec + attachments. */
|
|
484
605
|
durableStore?: RevertManifestStore;
|
|
485
606
|
}): Promise<void>;
|
|
607
|
+
/** Test seam — reset the module-level A1e composer (vitest-gated). */
|
|
608
|
+
export declare function resetDispatchContextComposerForTests(): void;
|
|
486
609
|
/**
|
|
487
610
|
* CP-4 §4.1 (#600) — `familiarize` desktop route: the context-priming task.
|
|
488
611
|
*
|
|
@@ -566,6 +689,23 @@ export declare function routeAdvisory(deps: {
|
|
|
566
689
|
args: RunOrchestrationShellArgs;
|
|
567
690
|
userPrompt: string;
|
|
568
691
|
images: string[];
|
|
692
|
+
/**
|
|
693
|
+
* #619 — recent conversation turns for the TEXT-ONLY answerer case. When an
|
|
694
|
+
* `advisory_response` lands mid-conversation, the classifier's inline
|
|
695
|
+
* `advisory_summary` is BLIND to context (it rendered a meta-monologue "I
|
|
696
|
+
* will provide a helpful response…" in real dogfood). With `priorTurns`
|
|
697
|
+
* threaded, THIS produces the sole answer instead: a context-aware direct
|
|
698
|
+
* reply from the local answerer. Turns are already bounded + per-turn capped
|
|
699
|
+
* by the collector (compact-don't-wipe).
|
|
700
|
+
*/
|
|
701
|
+
priorTurns?: string[];
|
|
702
|
+
/**
|
|
703
|
+
* #619 Stage-2 (Codex LOW) — how many images the USER attached this turn,
|
|
704
|
+
* regardless of how many survived base64 read. When >0 but `images` is empty
|
|
705
|
+
* (all unreadable), the prompt keeps the image framing so the model says the
|
|
706
|
+
* image couldn't be used instead of answering as if none was attached.
|
|
707
|
+
*/
|
|
708
|
+
attemptedImages?: number;
|
|
569
709
|
}): Promise<void>;
|
|
570
710
|
export declare function parseTeamWorkItems(rawArg: string): {
|
|
571
711
|
ok: true;
|
|
@@ -611,6 +751,16 @@ export interface HandleShellUserInputDeps extends StructuralSummaryRunDeps {
|
|
|
611
751
|
* and the `[Image #N]` labels are stripped from the classify prompt.
|
|
612
752
|
*/
|
|
613
753
|
images?: string[];
|
|
754
|
+
/**
|
|
755
|
+
* The submission's origin. `'mobile'` marks the mobile→desktop RETURN path
|
|
756
|
+
* (`routeMobileUserPrompt` → the serialized submission wrapper): the turn mirror
|
|
757
|
+
* suppresses USER_PROMPT to avoid duplicating the phone's sent message, while
|
|
758
|
+
* pending planner offers remain answerable because F4 mirrors them as
|
|
759
|
+
* INTERACTIVE_PROMPT. Absent ⇒ a keyboard turn.
|
|
760
|
+
*/
|
|
761
|
+
inputOrigin?: 'mobile';
|
|
762
|
+
/** Loaded mobile USER_PROMPT event id used as the structured turn anchor. */
|
|
763
|
+
inputOriginEventId?: string;
|
|
614
764
|
/** Test seam — defaults to the real `addBodyPath`. */
|
|
615
765
|
addBodyPathFn?: (path: string, tier: Tier) => Promise<unknown>;
|
|
616
766
|
/** Test seam — defaults to the real `regenerateStructuralSummary`. */
|
|
@@ -645,6 +795,12 @@ export interface HandleShellUserInputDeps extends StructuralSummaryRunDeps {
|
|
|
645
795
|
* touching the filesystem / git.
|
|
646
796
|
*/
|
|
647
797
|
ensureFreshContextStoreFn?: typeof ensureFreshContextStore;
|
|
798
|
+
/**
|
|
799
|
+
* Test seam for the local planner's canonical multi-turn context projection.
|
|
800
|
+
* Production uses the same role-filtered ContextItems renderer used by agent
|
|
801
|
+
* dispatch; hosted-planner turns do not call it.
|
|
802
|
+
*/
|
|
803
|
+
renderRehydratedSessionContextFn?: typeof renderRehydratedSessionContext;
|
|
648
804
|
/**
|
|
649
805
|
* `/reviewer-setup` wizard (2026-06-29) — Test seam for the async wizard-open
|
|
650
806
|
* data load. Defaults to the real `loadReviewerWizardData` (detect installed
|
|
@@ -660,6 +816,14 @@ export interface HandleShellUserInputDeps extends StructuralSummaryRunDeps {
|
|
|
660
816
|
* path (vitest runs non-TTY) and `() => false` for the fallback advisory.
|
|
661
817
|
*/
|
|
662
818
|
isInteractiveTtyFn?: () => boolean;
|
|
819
|
+
/**
|
|
820
|
+
* [A1g] Round-4 — the per-turn brainstorm-panel ownership token minted by
|
|
821
|
+
* `serializeShellSubmissions` for THIS submission. The read-only `@`-mention
|
|
822
|
+
* router stamps `brainstormPanelOwned` on it when it commits to a panel turn;
|
|
823
|
+
* the turn-mirror reads the SAME object to decide whether to drain this turn's
|
|
824
|
+
* buffered replies. Optional — direct unit callers/tests may omit it.
|
|
825
|
+
*/
|
|
826
|
+
turnOwnership?: BrainstormTurnOwnership;
|
|
663
827
|
}
|
|
664
828
|
/**
|
|
665
829
|
* Slash + natural-language dispatch. Extracted from `runOrchestrationShell`
|
|
@@ -699,6 +863,8 @@ export interface ShellSubmitOptions {
|
|
|
699
863
|
* keyboard turn (both `USER_PROMPT` + `ASSISTANT_RESPONSE` mirror as today).
|
|
700
864
|
*/
|
|
701
865
|
fromMobile?: boolean;
|
|
866
|
+
/** Exact loaded MOBILE USER_PROMPT anchor for an attributed agent turn. */
|
|
867
|
+
mobilePromptEventId?: string;
|
|
702
868
|
}
|
|
703
869
|
export declare function serializeShellSubmissions(handler: (text: string, images?: string[], options?: ShellSubmitOptions) => Promise<void>): (text: string, images?: string[], options?: ShellSubmitOptions) => Promise<void>;
|
|
704
870
|
/**
|
|
@@ -738,37 +904,123 @@ export declare function buildContinuationActionDeps(args: RunOrchestrationShellA
|
|
|
738
904
|
export declare function detectBrowseFastPath(text: string, pending: PendingClarification | null): string[] | null;
|
|
739
905
|
export declare function handleShellUserInput(deps: HandleShellUserInputDeps): Promise<void>;
|
|
740
906
|
/**
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
907
|
+
* [A1g] Stage-2 round-4 (Codex round-3 MEDIUM) — the EXPLICIT per-turn panel-
|
|
908
|
+
* ownership token. `serializeShellSubmissions` mints ONE fresh object per
|
|
909
|
+
* submission and threads it into BOTH `handleShellUserInput` (whose router SETS
|
|
910
|
+
* `brainstormPanelOwned` at the SAME point it commits to a panel turn + buffers
|
|
911
|
+
* replies) AND the turn-mirror (which DRAINS the buffered replies and suppresses
|
|
912
|
+
* step-4b conductor authoring iff owned). Ownership is decided by the ACTUAL
|
|
913
|
+
* router this invocation — never re-inferred from the current turn's text.
|
|
914
|
+
*
|
|
915
|
+
* Re-inferring from `userEntry.text` (the prior `isBrainstormMentionTurn` probe)
|
|
916
|
+
* was WRONG on two paths: (a) a clarification-ANSWER turn that carries an earlier
|
|
917
|
+
* `@agent` override routes the panel (via `agentMentionIntentFromOverride` →
|
|
918
|
+
* `suppressMentionLocalAnswer`), yet its OWN text has no leading `@`-mention, so
|
|
919
|
+
* the mirror failed to drain — leaking a stale buffered reply into a LATER
|
|
920
|
+
* mention turn; (b) a bypassing slash command (`/status`) has no user-message
|
|
921
|
+
* entry at all. A per-invocation token is immune to both: the slash / clarify
|
|
922
|
+
* turn simply never sets it, and the routing turn always does. Replaces the old
|
|
923
|
+
* session-keyed `brainstormPanelTurns` marker (the token fully subsumes it —
|
|
924
|
+
* "a panel ran this turn" is exactly `brainstormPanelOwned`).
|
|
925
|
+
*/
|
|
926
|
+
export interface BrainstormTurnOwnership {
|
|
927
|
+
brainstormPanelOwned: boolean;
|
|
928
|
+
agentTurn?: {
|
|
929
|
+
route: 'broadcast' | 'directed';
|
|
930
|
+
turnId: string;
|
|
931
|
+
header: string;
|
|
932
|
+
cells: Array<{
|
|
933
|
+
authorAgent: BrainstormPanelActiveAgent;
|
|
934
|
+
status: 'completed' | 'quota_walled' | 'failed';
|
|
935
|
+
boundedBody: string;
|
|
936
|
+
}>;
|
|
937
|
+
prompt: {
|
|
938
|
+
kind: 'legacy_joined';
|
|
939
|
+
} | {
|
|
940
|
+
kind: 'mobile_existing';
|
|
941
|
+
eventId: string;
|
|
942
|
+
} | {
|
|
943
|
+
kind: 'agent_turn_pre_emitted';
|
|
944
|
+
eventId: string;
|
|
945
|
+
writerEventNonce: string;
|
|
946
|
+
contentCiphertextSha256: string;
|
|
947
|
+
metadataCiphertextSha256: string;
|
|
948
|
+
} | {
|
|
949
|
+
kind: 'agent_turn_pre_emit_failed';
|
|
950
|
+
};
|
|
951
|
+
responseWriterEventNonce: string;
|
|
952
|
+
authoring?: {
|
|
953
|
+
kind: 'committed';
|
|
954
|
+
receipt: ContextDurabilityReceipt;
|
|
955
|
+
humanOccurrence: ReturnType<typeof contextItemOccurrence>;
|
|
956
|
+
agentOccurrences: Map<string, ReturnType<typeof contextItemOccurrence>>;
|
|
957
|
+
} | {
|
|
958
|
+
kind: 'authority_failed';
|
|
959
|
+
};
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
/** Vitest-gated reset for the M5 registry + [A1g] panel state (the established seam pattern). */
|
|
963
|
+
export declare function resetTurnAuthoringStateForTests(): void;
|
|
964
|
+
/**
|
|
965
|
+
* [A1g] Stage-2 (agy LOW-3) — release a session's turn-authoring + panel state at
|
|
966
|
+
* shell teardown. The shell is single-session-per-process, so these session-keyed
|
|
967
|
+
* maps hold ≤1 key in practice; this closes the unbounded-growth seam anyway (and
|
|
968
|
+
* the pre-existing A1f `openQuestionRegistry` gap) so a long-lived host embedding
|
|
969
|
+
* the shell across sessions never accumulates dead keys. Idempotent; safe to call
|
|
970
|
+
* on any exit path. Non-throwing (delete on a Map/Set never throws).
|
|
771
971
|
*/
|
|
972
|
+
export declare function clearTurnAuthoringSessionState(sessionId: string): void;
|
|
973
|
+
/**
|
|
974
|
+
* A1f (design §6 + the A1e-deferred full-vocabulary authoring) — author this
|
|
975
|
+
* turn's typed ContextItems at the ONE per-turn chokepoint: the turn mirror
|
|
976
|
+
* runs once per serialized turn (keyboard AND mobile-origin — the §4.2
|
|
977
|
+
* single write authority folds mobile turns into the chain HERE) with the
|
|
978
|
+
* turn's conversation delta.
|
|
979
|
+
*
|
|
980
|
+
* Deterministic emitter-assigned labels (§4.2 — never the conductor):
|
|
981
|
+
* - human `turn` (DURABLE per Finding-2) — Stage-2 R1 H1: labeled
|
|
982
|
+
* planner/brainstorm ONLY (conversation, not task contract — §5
|
|
983
|
+
* explicitly excludes the full conversation from implementor windows;
|
|
984
|
+
* the implementor-sanctioned "answered clarifications + prior handoff
|
|
985
|
+
* turns" ride the existing brief-composition path, not this projection).
|
|
986
|
+
* An answering turn carries `refs` to the question item it answers (M5).
|
|
987
|
+
* - `decision` per planner-decision entry (author `conductor`; durable) —
|
|
988
|
+
* broadly visible (task-shaping, §6 distillation payload), task-scoped
|
|
989
|
+
* when the decision carries a taskId (H1 scope).
|
|
990
|
+
* - `open_question` when THIS turn asked a still-unanswered clarification
|
|
991
|
+
* (author `conductor`; durable) — broadly visible ("answered
|
|
992
|
+
* clarifications" are §5-sanctioned; the M5 linkage retires it once
|
|
993
|
+
* answered).
|
|
994
|
+
* - conductor reply `turn` (TRANSIENT — Finding-2 buffer) —
|
|
995
|
+
* planner/brainstorm-visible.
|
|
996
|
+
*
|
|
997
|
+
* Stage-2 (Codex MEDIUM-2 / agy HIGH-1) — an AWAITABLE per-turn barrier:
|
|
998
|
+
* every append this turn REGISTERS is collected into `pending` and the
|
|
999
|
+
* function resolves only once they all settle. `emitOrchestrationTurnMirror`
|
|
1000
|
+
* awaits it, so — since the mirror runs inside `serializeShellSubmissions` —
|
|
1001
|
+
* Turn N's appends are durably registered BEFORE Turn N+1's turn begins (no
|
|
1002
|
+
* cross-turn [T1-human, T2-human, T1-panel] interleave). Registration is still
|
|
1003
|
+
* synchronous (the M5 registry + mutex chain order are unchanged: the only
|
|
1004
|
+
* `await` is the final `Promise.all` after every append is registered). Every
|
|
1005
|
+
* pushed promise is individually `.catch()`-guarded, so the barrier never
|
|
1006
|
+
* rejects — authoring must never fail the turn. Ends with the §6 O(1) mid-task
|
|
1007
|
+
* safety-valve check (fire-and-forget; NOT part of the barrier). Exported for
|
|
1008
|
+
* direct testing.
|
|
1009
|
+
*/
|
|
1010
|
+
export declare function authorTurnContextItems(deps: {
|
|
1011
|
+
store: OrchestrationStore;
|
|
1012
|
+
sessionId: string;
|
|
1013
|
+
delta: ConversationEntry[];
|
|
1014
|
+
/**
|
|
1015
|
+
* [A1g] Round-4 — did THIS invocation's router commit to a brainstorm-panel
|
|
1016
|
+
* turn (the `BrainstormTurnOwnership` token it stamped)? Only an owning turn
|
|
1017
|
+
* drains its buffered replies + suppresses step-4b. Absent/false ⇒ not a panel
|
|
1018
|
+
* turn (a plain conversational turn, a bypassing slash command, or an untagged
|
|
1019
|
+
* clarification answer that did not itself route a panel).
|
|
1020
|
+
*/
|
|
1021
|
+
panelOwnedThisTurn?: boolean;
|
|
1022
|
+
turnOwnership?: BrainstormTurnOwnership;
|
|
1023
|
+
}): Promise<void>;
|
|
772
1024
|
export declare function emitOrchestrationTurnMirror(deps: {
|
|
773
1025
|
store: OrchestrationStore;
|
|
774
1026
|
sessionId: string;
|
|
@@ -784,6 +1036,23 @@ export declare function emitOrchestrationTurnMirror(deps: {
|
|
|
784
1036
|
* the planner's reply reaches mobile. Absent/false ⇒ a keyboard turn (mirror both).
|
|
785
1037
|
*/
|
|
786
1038
|
skipUserPromptMirror?: boolean;
|
|
1039
|
+
/**
|
|
1040
|
+
* [A1g] Round-4 — the per-turn brainstorm-panel ownership token minted for THIS
|
|
1041
|
+
* submission (see `BrainstormTurnOwnership`). Threaded to `authorTurnContextItems`
|
|
1042
|
+
* as the drain authority. Absent for callers/tests that never route a panel.
|
|
1043
|
+
*/
|
|
1044
|
+
turnOwnership?: BrainstormTurnOwnership;
|
|
1045
|
+
/**
|
|
1046
|
+
* [A1g] Round-5 (Codex round-4 MEDIUM) — the conversation entries THIS
|
|
1047
|
+
* submission produced (see `turnAuthoringContext`). When present, the mirror
|
|
1048
|
+
* authors from these INVOCATION-OWNED entries instead of a global
|
|
1049
|
+
* `conversation.slice(convLenBefore)` window — so a concurrent slash bypass's
|
|
1050
|
+
* advisory (or this turn's advisory bleeding into a concurrent bypass) is
|
|
1051
|
+
* never mis-authored to the wrong turn. Absent ⇒ fall back to the
|
|
1052
|
+
* `convLenBefore` slice (unchanged behavior for callers/tests that don't
|
|
1053
|
+
* thread a sink).
|
|
1054
|
+
*/
|
|
1055
|
+
ownEntries?: ConversationEntry[];
|
|
787
1056
|
}): Promise<void>;
|
|
788
1057
|
/**
|
|
789
1058
|
* CP-4 §4.2 (Codex r1 M1 — the double-walk unify) — the SINGLE structural-
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface MentionSuggestion {
|
|
2
|
+
name: string;
|
|
3
|
+
blurb: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function buildMentionSuggestions(availableAgents?: readonly string[]): MentionSuggestion[];
|
|
6
|
+
export declare function isMentionInProgress(value: string, cursor?: number): boolean;
|
|
7
|
+
export declare function filterMentionSuggestions(value: string, suggestions: readonly MentionSuggestion[], cursor?: number): MentionSuggestion[];
|
|
8
|
+
export declare function replaceMentionAtCursor(value: string, cursor: number, replacement: string): {
|
|
9
|
+
value: string;
|
|
10
|
+
cursor: number;
|
|
11
|
+
};
|