@quantiya/codevibe-core 2.0.7 → 2.0.9
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/appsync/__tests__/dispose-watcher-socket.test.d.ts +1 -0
- package/dist/appsync/__tests__/refresh-open-prompt-ttl-chunk.test.d.ts +1 -0
- package/dist/appsync/appsync-client.d.ts +232 -30
- package/dist/appsync/queries.d.ts +2 -0
- package/dist/auth/__tests__/keychain-cli-nudge.test.d.ts +1 -0
- package/dist/auth/__tests__/keychain-cli.test.d.ts +1 -0
- package/dist/auth/keychain-cli.d.ts +14 -0
- package/dist/companion-mode/index.d.ts +14 -0
- package/dist/credential-broker/oauth-account-lock.d.ts +47 -1
- package/dist/crypto/__tests__/open-prompt-id.test.d.ts +1 -0
- package/dist/crypto/index.d.ts +1 -0
- package/dist/crypto/open-prompt-id.d.ts +36 -0
- package/dist/e1/__tests__/prompt-raise.test.d.ts +1 -0
- package/dist/e1/index.d.ts +2 -0
- package/dist/e1/prompt-raise.d.ts +65 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4652 -252
- package/dist/keychain/__tests__/keychain-manager.test.d.ts +1 -0
- package/dist/keychain/__tests__/keychain-migrate.test.d.ts +1 -0
- package/dist/keychain/__tests__/migrate-nudge.test.d.ts +1 -0
- package/dist/keychain/keychain-backend.d.ts +105 -0
- package/dist/keychain/keychain-manager.d.ts +17 -3
- package/dist/keychain/keychain-migrate.d.ts +63 -0
- package/dist/keychain/migrate-nudge.d.ts +38 -0
- package/dist/local-executor/__tests__/anchored-fs.test.d.ts +1 -0
- package/dist/local-executor/__tests__/bounded-directory.test.d.ts +1 -0
- package/dist/local-executor/__tests__/bounded-output.test.d.ts +1 -0
- package/dist/local-executor/__tests__/durable-directory.test.d.ts +1 -0
- package/dist/local-executor/__tests__/hosted-class-a-sink.test.d.ts +1 -0
- package/dist/local-executor/__tests__/process-identity.test.d.ts +1 -0
- package/dist/local-executor/__tests__/process-tree.test.d.ts +1 -0
- package/dist/local-executor/__tests__/protocol-backlog-wiring.test.d.ts +1 -0
- package/dist/local-executor/__tests__/protocol-backlog.test.d.ts +1 -0
- package/dist/local-executor/__tests__/publication-authority-capability.test.d.ts +1 -0
- package/dist/local-executor/__tests__/snapshot-merge.test.d.ts +1 -0
- package/dist/local-executor/__tests__/workspace-authority-fixture.d.ts +3 -0
- package/dist/local-executor/__tests__/workspace-authority.test.d.ts +1 -0
- package/dist/local-executor/__tests__/workspace-cleanup-audit.test.d.ts +1 -0
- package/dist/local-executor/__tests__/workspace-materializer.test.d.ts +1 -0
- package/dist/local-executor/agentic-disposable-repo.d.ts +23 -6
- package/dist/local-executor/agentic-resolve.d.ts +16 -0
- package/dist/local-executor/anchored-fs.d.ts +250 -0
- package/dist/local-executor/bounded-directory.d.ts +78 -0
- package/dist/local-executor/bounded-helper.d.ts +22 -0
- package/dist/local-executor/bounded-output.d.ts +11 -0
- package/dist/local-executor/class-a-emit.d.ts +13 -1
- package/dist/local-executor/durable-directory.d.ts +25 -0
- package/dist/local-executor/durable-store.d.ts +217 -25
- package/dist/local-executor/hosted-class-a-sink.d.ts +27 -0
- package/dist/local-executor/index.d.ts +3 -2
- package/dist/local-executor/local-executor-impl.d.ts +159 -69
- package/dist/local-executor/process-identity.d.ts +46 -0
- package/dist/local-executor/process-tree.d.ts +123 -0
- package/dist/local-executor/protocol-backlog.d.ts +62 -0
- package/dist/local-executor/revert-reconcile.d.ts +4 -0
- package/dist/local-executor/revert-runner.d.ts +14 -1
- package/dist/local-executor/snapshot-merge.d.ts +124 -0
- package/dist/local-executor/task-group-types.d.ts +7 -6
- package/dist/local-executor/team-execution-flag.d.ts +2 -2
- package/dist/local-executor/track-registry.d.ts +2 -0
- package/dist/local-executor/types.d.ts +33 -2
- package/dist/local-executor/verification-gates/build.d.ts +5 -0
- package/dist/local-executor/verification-gates/deploy-preflight.d.ts +2 -0
- package/dist/local-executor/verification-gates/diff-sanity.d.ts +12 -0
- package/dist/local-executor/verification-gates/hostile-grep.d.ts +2 -0
- package/dist/local-executor/verification-gates/lint.d.ts +2 -0
- package/dist/local-executor/verification-gates/shell-runner.d.ts +5 -0
- package/dist/local-executor/verification-gates/source-traceability.d.ts +2 -0
- package/dist/local-executor/verification-gates/tests.d.ts +3 -0
- package/dist/local-executor/verification-gates/typecheck.d.ts +3 -0
- package/dist/local-executor/verification-runner.d.ts +6 -0
- package/dist/local-executor/workspace-authority.d.ts +45 -0
- package/dist/local-executor/workspace-cleanup-audit.d.ts +3 -0
- package/dist/local-executor/workspace-materializer.d.ts +48 -0
- package/dist/local-executor/workspace-shadow.d.ts +380 -85
- package/dist/orchestration-shell/__tests__/advisory-attachment-journal.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/direct-file-delete.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/flag-command.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/halt-message-wire-content.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/planner-offer-e1.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/workspace-shutdown.test.d.ts +1 -0
- package/dist/orchestration-shell/advisory-attachment-journal.d.ts +165 -0
- package/dist/orchestration-shell/attachments.d.ts +47 -58
- package/dist/orchestration-shell/audit-browser.d.ts +54 -1
- package/dist/orchestration-shell/bounded-shutdown.d.ts +6 -0
- package/dist/orchestration-shell/cli.d.ts +10 -0
- package/dist/orchestration-shell/cli.js +38355 -27300
- package/dist/orchestration-shell/context-items.d.ts +3 -0
- package/dist/orchestration-shell/declared-test-runner.d.ts +21 -2
- package/dist/orchestration-shell/direct-file-delete.d.ts +22 -0
- package/dist/orchestration-shell/emit-shell-event.d.ts +7 -0
- package/dist/orchestration-shell/explicit-tty-exit.d.ts +1 -2
- package/dist/orchestration-shell/flag-command.d.ts +81 -0
- package/dist/orchestration-shell/gate-decision-submit.d.ts +11 -0
- package/dist/orchestration-shell/gate-prompts.d.ts +116 -0
- package/dist/orchestration-shell/index.d.ts +34 -6
- package/dist/orchestration-shell/planner-offer-e1.d.ts +97 -0
- package/dist/orchestration-shell/quorum-loop.d.ts +312 -61
- package/dist/orchestration-shell/reducer.d.ts +9 -0
- package/dist/orchestration-shell/task-progress.d.ts +18 -4
- package/dist/orchestration-shell/team-decompose.d.ts +10 -10
- package/dist/orchestration-shell/types.d.ts +90 -2
- package/dist/orchestration-shell/workspace-shutdown.d.ts +47 -0
- package/dist/reviewer/output-parser.d.ts +19 -0
- package/dist/reviewer/providers/codex.d.ts +5 -3
- package/dist/reviewer/token-usage.d.ts +41 -12
- package/dist/reviewer/types.d.ts +6 -0
- package/dist/reviewer/verdict-classifier.d.ts +1 -0
- package/dist/session/session-rekey.d.ts +4 -3
- package/dist/substrate/__tests__/command-runner.test.d.ts +1 -0
- package/dist/substrate/command-runner.d.ts +2 -0
- package/dist/substrate/docker.d.ts +7 -32
- package/dist/substrate/index.d.ts +0 -1
- package/dist/substrate/sandbox-exec.d.ts +0 -13
- package/dist/substrate/types.d.ts +15 -2
- package/dist/substrate-launch/__tests__/reviewer-credential-preflight.test.d.ts +1 -0
- package/dist/substrate-launch/engage-substrate.d.ts +3 -0
- package/dist/substrate-launch/index.d.ts +2 -0
- package/dist/substrate-launch/reviewer-credential-preflight.d.ts +50 -0
- package/dist/test-publication-authority-setup.d.ts +1 -0
- package/dist/tool-activity/replay-cursor.d.ts +42 -8
- package/dist/track-presentation.d.ts +2 -0
- package/dist/track-presentation.test.d.ts +1 -0
- package/dist/types/encryption.d.ts +5 -0
- package/dist/types/events.d.ts +5 -0
- package/package.json +3 -3
- package/dist/substrate/git-proxy.d.ts +0 -35
- /package/dist/{substrate/__tests__/git-proxy.test.d.ts → appsync/__tests__/appsync-client-flag-locator.test.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,30 @@
|
|
|
1
|
+
import WebSocket from 'ws';
|
|
1
2
|
import { CreateEventInput, CreateSessionInput, UpdateSessionInput, UpdateEventStatusInput, Event, Session, EventSource, DeviceKey, GrantSessionKeyInput, UpdateReviewerPolicyInput, UserReviewerPolicySnapshot } from '../types';
|
|
2
3
|
import type { PostDecisionAction } from '../orchestration-shell/types';
|
|
4
|
+
import type { InvocationUsageSnapshot } from '../reviewer/token-usage';
|
|
3
5
|
import type { CreateTaskGroupInput, CreateTaskGroupResult, SubmitMergeGateVerdictInput, SubmitMergeGateVerdictResult, SubmitTrackVerificationOutcomeInput, SubmitTrackVerificationOutcomeResult, ClaimGroupDecisionInput, ClaimGroupDecisionResult } from '../local-executor/task-group-types';
|
|
4
6
|
import type { ReviewerVerdict, ReviewerRole, AgentKind as ReviewerAgentKind } from '../reviewer/types';
|
|
5
7
|
import type { PlannerDecision } from '../planner/types';
|
|
8
|
+
/**
|
|
9
|
+
* Dispose a watcher/subscription WebSocket without crashing the process
|
|
10
|
+
* (#657 D-1 fix-forward — the clean-quit session/admission leak).
|
|
11
|
+
*
|
|
12
|
+
* `ws.close()` on a still-CONNECTING socket aborts the handshake and emits an
|
|
13
|
+
* ASYNC 'error' ("WebSocket was closed before the connection was established")
|
|
14
|
+
* on a LATER tick. Every prior disposal site paired `close(1000)` with
|
|
15
|
+
* `removeAllListeners()` — in either order — so that late emission always
|
|
16
|
+
* found a listener-less socket and crashed Node with an unhandled 'error'
|
|
17
|
+
* mid-teardown, BEFORE `retireHostedSession` could land the session INACTIVE
|
|
18
|
+
* mutation. Net effect: every clean `/quit` whose Class B watcher (or any
|
|
19
|
+
* other watcher) was mid-(re)connect leaked an ACTIVE session row AND an
|
|
20
|
+
* `activeSessionAdmissionCount` slot (#101 class), hard-capping the
|
|
21
|
+
* 19-scenario GA baseline after exactly the free headroom.
|
|
22
|
+
*
|
|
23
|
+
* Order is load-bearing: strip stale handlers FIRST, re-arm a swallow-all
|
|
24
|
+
* 'error' handler, THEN close. Exported for the regression test only — not
|
|
25
|
+
* part of the public SDK surface.
|
|
26
|
+
*/
|
|
27
|
+
export declare function disposeWatcherSocket(ws: WebSocket, subscriptionId?: string): void;
|
|
6
28
|
/**
|
|
7
29
|
* One assigned reviewer seat returned by `getInReviewAssignments`. Mirrors the
|
|
8
30
|
* engine `InReviewAssignment` serde (camelCase) in
|
|
@@ -26,33 +48,37 @@ export interface InReviewAssignment {
|
|
|
26
48
|
* recovery-row type — NOT an extension of the live `TrackAssignedPayload` (so the
|
|
27
49
|
* live Class B contract stays unpolluted). Mirrors the engine handler's camelCase
|
|
28
50
|
* `TeamTrackRecoveryRow` serde:
|
|
29
|
-
* - ALWAYS present: `taskGroupId`, `trackIndex`, `
|
|
51
|
+
* - ALWAYS present: `taskGroupId`, `trackIndex`, `taskId`,
|
|
52
|
+
* `dispatchGeneration`, `relaunch`, and `encryptedBrief?`
|
|
30
53
|
* (omitted when the track had no description → recovery treats it as an empty
|
|
31
|
-
* brief).
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* two groups (#593 Stage-2 r2 Codex MEDIUM).
|
|
54
|
+
* brief). The four identity fields bind recovered brief and tombstone
|
|
55
|
+
* authority to `(taskGroupId, trackIndex, taskId, dispatchGeneration)`;
|
|
56
|
+
* reused group/index slots cannot cross-contaminate generations.
|
|
35
57
|
* - ONLY when `relaunch === true` (flattened at top level): the full live
|
|
36
|
-
* `TrackAssigned` wire-field set (
|
|
37
|
-
* `ownershipScope`, `isSharedTestOwner`, `stateDir`,
|
|
38
|
-
* `
|
|
58
|
+
* `TrackAssigned` wire-field set (the always-present identity fields plus
|
|
59
|
+
* `implementorAgent`, `ownershipScope`, `isSharedTestOwner`, `stateDir`,
|
|
60
|
+
* `dispatchId`, `conflictContext`) and recovery metadata (`gateRunId`,
|
|
39
61
|
* `gateType`). These camelCase keys are byte-identical to the live
|
|
40
62
|
* `TrackAssigned` Class B packet, so `normalizeTrackAssignedWire(row)` accepts
|
|
41
63
|
* a relaunch row directly (it picks the expected keys and ignores the extras).
|
|
42
64
|
*
|
|
43
65
|
* Typed loosely (`unknown` payload past the always-present fields) because the
|
|
44
|
-
* relaunch keys are present-or-absent
|
|
45
|
-
* `normalizeTrackAssignedWire` +
|
|
46
|
-
*
|
|
66
|
+
* relaunch keys are present-or-absent. Recovery first validates complete row
|
|
67
|
+
* shape/correlation, then runs the shared `normalizeTrackAssignedWire` +
|
|
68
|
+
* `isValidTrackAssignedPayload` live validators.
|
|
47
69
|
*/
|
|
48
70
|
export interface TeamTrackRecoveryRow {
|
|
49
71
|
/**
|
|
50
72
|
* The owning task group's id — present on EVERY row (seed-only + relaunch) so
|
|
51
|
-
* recovered
|
|
52
|
-
*
|
|
73
|
+
* recovered rows carry complete authority, so B.2's cross-group aggregation
|
|
74
|
+
* cannot collide on a shared `trackIndex`.
|
|
53
75
|
*/
|
|
54
76
|
taskGroupId: string;
|
|
55
77
|
trackIndex: number;
|
|
78
|
+
/** Child task identity; present on seed-only and relaunch rows. */
|
|
79
|
+
taskId: string;
|
|
80
|
+
/** Current u32 dispatch generation; present on every recovery row. */
|
|
81
|
+
dispatchGeneration: number;
|
|
56
82
|
/** Bare base64 ciphertext; absent when the track had no description. */
|
|
57
83
|
encryptedBrief?: string;
|
|
58
84
|
relaunch: boolean;
|
|
@@ -89,6 +115,33 @@ export interface PutContextItemInput {
|
|
|
89
115
|
trackId?: string;
|
|
90
116
|
ciphertext: string;
|
|
91
117
|
}
|
|
118
|
+
/** Host-emittable audit surface used by the signed Class A transport. */
|
|
119
|
+
export interface RecordExecutionEventInput {
|
|
120
|
+
taskId: string;
|
|
121
|
+
sessionId: string;
|
|
122
|
+
kind: 'TASK_CREATED' | 'TASK_TERMINATED' | 'PROGRESS_EVENT' | 'TOOL_USE' | 'DESTRUCTIVE_ACTION_ESCALATED' | 'FLAG_BAD_APPROVAL';
|
|
123
|
+
/** Free-form JSON; encrypted before crossing AppSync. */
|
|
124
|
+
payload: unknown;
|
|
125
|
+
dedupKeyHex: string;
|
|
126
|
+
/**
|
|
127
|
+
* O1 C1 (#652) §3.1 item 3 — the plaintext flag-target locator, REQUIRED
|
|
128
|
+
* when `kind = 'FLAG_BAD_APPROVAL'` and absent otherwise (non-flag events
|
|
129
|
+
* stay byte-identical to the pre-O1-C1 wire). Row COORDINATES only — zero
|
|
130
|
+
* content. Field names mirror the Rust handler DTO
|
|
131
|
+
* (`RecordExecutionEventInput` in core-rs `types.rs`, camelCase serde) —
|
|
132
|
+
* the wire-shape source of truth. The server rejects a request whose
|
|
133
|
+
* `taskId` ≠ `flaggedTaskId` (the per-task dedup-partition pin).
|
|
134
|
+
*/
|
|
135
|
+
flaggedTaskId?: string;
|
|
136
|
+
/**
|
|
137
|
+
* The flagged row's audit-table sort key — the zero-padded 16-digit
|
|
138
|
+
* `seqNum` string exactly as surfaced by `queryAudit`'s additive
|
|
139
|
+
* `AuditEntryWireRow.seqNum` projection.
|
|
140
|
+
*/
|
|
141
|
+
flaggedSeqNum?: string;
|
|
142
|
+
/** The flagged entry's `entry_id` (also the dedup-key derivation input). */
|
|
143
|
+
flaggedEntryId?: string;
|
|
144
|
+
}
|
|
92
145
|
/**
|
|
93
146
|
* PHASE-CP-1-F.1 Part A (LOCK L2) — tolerant `AWSJSON!` object read.
|
|
94
147
|
*
|
|
@@ -133,6 +186,63 @@ export interface TaskReviewSummaryReviewer {
|
|
|
133
186
|
reasoning: string;
|
|
134
187
|
/** ReviewerVerdict.suggested_changes (may be empty). */
|
|
135
188
|
suggestedChanges: string[];
|
|
189
|
+
/** Non-blocking observations that did not request another revision. */
|
|
190
|
+
residualObservations?: string[];
|
|
191
|
+
}
|
|
192
|
+
export interface TaskReviewSummaryRequirements {
|
|
193
|
+
problem: string;
|
|
194
|
+
expectedOutputs: string[];
|
|
195
|
+
}
|
|
196
|
+
export interface TaskReviewSummaryImplementor {
|
|
197
|
+
agent: string;
|
|
198
|
+
trackIndex?: number;
|
|
199
|
+
taskId: string;
|
|
200
|
+
}
|
|
201
|
+
export interface TaskReviewSummaryQuorumSeat {
|
|
202
|
+
seatId: number;
|
|
203
|
+
role: string;
|
|
204
|
+
agent: string;
|
|
205
|
+
}
|
|
206
|
+
export interface TaskReviewSummaryQuorum {
|
|
207
|
+
seats: TaskReviewSummaryQuorumSeat[];
|
|
208
|
+
roundCount: number;
|
|
209
|
+
revisionCount: number;
|
|
210
|
+
}
|
|
211
|
+
export interface TaskReviewSummaryMergeGate {
|
|
212
|
+
applicable: boolean;
|
|
213
|
+
outcome: string;
|
|
214
|
+
resolution?: string;
|
|
215
|
+
}
|
|
216
|
+
export interface TaskReviewSummaryDurations {
|
|
217
|
+
taskElapsedMs?: number;
|
|
218
|
+
reviewerElapsedMs?: number;
|
|
219
|
+
availability: string;
|
|
220
|
+
}
|
|
221
|
+
export interface TaskReviewSummaryTokenUsage {
|
|
222
|
+
knownTotal?: number;
|
|
223
|
+
knownInput?: number;
|
|
224
|
+
knownOutput?: number;
|
|
225
|
+
knownCachedInput?: number;
|
|
226
|
+
availability: string;
|
|
227
|
+
unavailableRoles: string[];
|
|
228
|
+
invocations?: TaskReviewSummaryTokenInvocation[];
|
|
229
|
+
}
|
|
230
|
+
export interface TaskReviewSummaryTokenInvocation {
|
|
231
|
+
role: string;
|
|
232
|
+
agent: string;
|
|
233
|
+
taskId?: string;
|
|
234
|
+
trackIndex?: number;
|
|
235
|
+
round?: number;
|
|
236
|
+
gateId?: string;
|
|
237
|
+
seatId?: number;
|
|
238
|
+
reviewerRole?: string;
|
|
239
|
+
inputTokens?: number;
|
|
240
|
+
outputTokens?: number;
|
|
241
|
+
cachedInputTokens?: number;
|
|
242
|
+
totalTokens?: number;
|
|
243
|
+
elapsedMs?: number;
|
|
244
|
+
availability: string;
|
|
245
|
+
unavailableReason?: string;
|
|
136
246
|
}
|
|
137
247
|
/** One round in the per-round summary (decrypted). */
|
|
138
248
|
export interface TaskReviewSummaryRound {
|
|
@@ -153,6 +263,15 @@ export interface TaskReviewSummaryRound {
|
|
|
153
263
|
* projection; `truncatedForSize`/`omittedRounds` flag the size-cap degrade.
|
|
154
264
|
*/
|
|
155
265
|
export interface TaskReviewSummary {
|
|
266
|
+
/** Present on the additive P15 terminal-report shape; absent on legacy v1. */
|
|
267
|
+
schemaVersion?: number;
|
|
268
|
+
requirements?: TaskReviewSummaryRequirements;
|
|
269
|
+
implementors?: TaskReviewSummaryImplementor[];
|
|
270
|
+
reviewQuorum?: TaskReviewSummaryQuorum;
|
|
271
|
+
mergeGate?: TaskReviewSummaryMergeGate;
|
|
272
|
+
durations?: TaskReviewSummaryDurations;
|
|
273
|
+
tokenUsage?: TaskReviewSummaryTokenUsage;
|
|
274
|
+
residualRisks?: string[];
|
|
156
275
|
rounds: TaskReviewSummaryRound[];
|
|
157
276
|
/** The resolution that produced the final-approval prompt (normally proceed). */
|
|
158
277
|
finalOutcome: string;
|
|
@@ -282,8 +401,31 @@ export declare class AppSyncClient {
|
|
|
282
401
|
*/
|
|
283
402
|
private lastRefreshNetworkError;
|
|
284
403
|
private pendingRefresh;
|
|
404
|
+
private pendingRefreshCredential;
|
|
405
|
+
/**
|
|
406
|
+
* All five WebSocket watcher families reconcile the same process-wide token
|
|
407
|
+
* cache. Collapse concurrent reconnects onto one bounded durable read /
|
|
408
|
+
* refresh operation so a keyring stall cannot multiply native calls.
|
|
409
|
+
*/
|
|
410
|
+
private pendingReconnectReconciliation;
|
|
411
|
+
/**
|
|
412
|
+
* A stopped watcher cancels only its wait on the shared reconciliation. The
|
|
413
|
+
* flight remains live for other watcher families and owns its own deadline.
|
|
414
|
+
*/
|
|
415
|
+
private reconnectReconciliationWaiters;
|
|
416
|
+
/**
|
|
417
|
+
* Every in-process credential replacement advances this generation. Async
|
|
418
|
+
* refresh/reconciliation work captures it before starting and may mutate the
|
|
419
|
+
* token cache only while that captured generation is still current.
|
|
420
|
+
*/
|
|
421
|
+
private tokenStateGeneration;
|
|
285
422
|
private lastRefreshFailureAt;
|
|
423
|
+
private lastRefreshFailureCredential;
|
|
286
424
|
private static readonly REFRESH_BACKOFF_MS;
|
|
425
|
+
/** Bounds the shared Cognito flight even when a transport ignores abort. */
|
|
426
|
+
private static readonly COGNITO_REFRESH_TIMEOUT_MS;
|
|
427
|
+
/** Bounds the durable read and any refresh as one reconnect operation. */
|
|
428
|
+
private static readonly RECONNECT_RECONCILIATION_TIMEOUT_MS;
|
|
287
429
|
private deviceKeyWatcher;
|
|
288
430
|
private sessionUpdateWatchers;
|
|
289
431
|
private applyUserDecisionWatchers;
|
|
@@ -322,6 +464,23 @@ export declare class AppSyncClient {
|
|
|
322
464
|
/**
|
|
323
465
|
* Refresh expired tokens
|
|
324
466
|
*/
|
|
467
|
+
private static abortReason;
|
|
468
|
+
private static throwIfAborted;
|
|
469
|
+
/**
|
|
470
|
+
* Bound one stage by its owning operation's absolute deadline. Every stage
|
|
471
|
+
* receives the same `deadlineAtMs`; a storage-backed retry therefore consumes
|
|
472
|
+
* the first attempt's elapsed time instead of acquiring another full timeout.
|
|
473
|
+
* `onTimeout` is used by network stages to abort their transport, while the
|
|
474
|
+
* explicit race remains authoritative when it ignores that signal.
|
|
475
|
+
*/
|
|
476
|
+
private static awaitWithinAbsoluteDeadline;
|
|
477
|
+
/**
|
|
478
|
+
* Cancel only this caller's wait. The shared operation remains live for
|
|
479
|
+
* concurrent callers and its owner clears the single-flight slot only when
|
|
480
|
+
* the operation itself settles.
|
|
481
|
+
*/
|
|
482
|
+
private static awaitSharedFlightForCaller;
|
|
483
|
+
private replaceTokens;
|
|
325
484
|
private refreshTokens;
|
|
326
485
|
/**
|
|
327
486
|
* Do the work of refreshing tokens. Tries the caller-supplied tokens
|
|
@@ -345,25 +504,35 @@ export declare class AppSyncClient {
|
|
|
345
504
|
*/
|
|
346
505
|
private callCognitoRefresh;
|
|
347
506
|
/**
|
|
348
|
-
* Apply a successful refresh response
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
507
|
+
* Apply a successful refresh response to this process's in-memory cache.
|
|
508
|
+
* Cognito's refresh response does not rotate the durable refresh token, so
|
|
509
|
+
* the already-stored credentials remain sufficient to refresh again after a
|
|
510
|
+
* restart.
|
|
352
511
|
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
* of this function. That would re-break both guarantees this hotfix
|
|
360
|
-
* makes: no-restart recovery becomes "restart required to escape
|
|
361
|
-
* the keychain-lock window," and backoff stays unarmed so the
|
|
362
|
-
* caller hot-loops against a working Cognito endpoint — R1's MEDIUM
|
|
363
|
-
* on round 1 of this review. Persistence-failure is loud-logged
|
|
364
|
-
* so operators can see degraded durability without losing availability.
|
|
512
|
+
* Do not rewrite durable login credentials from this background refresh.
|
|
513
|
+
* Native keychain writes are not cancellable: once a deadline wins, a late
|
|
514
|
+
* write could otherwise overwrite a newer out-of-band login or resurrect
|
|
515
|
+
* credentials deleted by a concurrent logout process. Login/logout remain
|
|
516
|
+
* the sole durable credential writers; refresh remains one bounded,
|
|
517
|
+
* memory-only operation.
|
|
365
518
|
*/
|
|
366
519
|
private applyRefreshedTokens;
|
|
520
|
+
/**
|
|
521
|
+
* Reconcile durable login credentials with this process's token cache before
|
|
522
|
+
* reconnecting a WebSocket watcher.
|
|
523
|
+
*
|
|
524
|
+
* Background refresh deliberately leaves the durable refresh credential
|
|
525
|
+
* unchanged. When storage still contains the older access/id pair for that
|
|
526
|
+
* same refresh token, a newer non-expired in-memory pair must therefore win;
|
|
527
|
+
* otherwise every reconnect would issue a redundant Cognito refresh. A
|
|
528
|
+
* different stored refresh token is an out-of-band login and remains
|
|
529
|
+
* authoritative.
|
|
530
|
+
*/
|
|
531
|
+
private reconcileTokensBeforeReconnect;
|
|
532
|
+
private performReconnectTokenReconciliation;
|
|
533
|
+
private beginReconnectReconciliationWait;
|
|
534
|
+
private finishReconnectReconciliationWait;
|
|
535
|
+
private cancelReconnectReconciliationWait;
|
|
367
536
|
/**
|
|
368
537
|
* Check if authenticated
|
|
369
538
|
*/
|
|
@@ -387,6 +556,14 @@ export declare class AppSyncClient {
|
|
|
387
556
|
* available for retry/diagnosis.
|
|
388
557
|
*/
|
|
389
558
|
putContextItem(input: PutContextItemInput): Promise<void>;
|
|
559
|
+
/**
|
|
560
|
+
* Persist one host-authenticated execution fact. The payload is encrypted
|
|
561
|
+
* under the task's session key; for team child tasks the backend performs the
|
|
562
|
+
* same conditional write as the audit append to renew that exact track lease.
|
|
563
|
+
*/
|
|
564
|
+
recordExecutionEvent(input: RecordExecutionEventInput, sessionKeyBase64: string, options?: {
|
|
565
|
+
signal?: AbortSignal;
|
|
566
|
+
}): Promise<void>;
|
|
390
567
|
/**
|
|
391
568
|
* Update a session
|
|
392
569
|
*/
|
|
@@ -400,6 +577,16 @@ export declare class AppSyncClient {
|
|
|
400
577
|
* Create an event
|
|
401
578
|
*/
|
|
402
579
|
createEvent(input: CreateEventInput): Promise<Event>;
|
|
580
|
+
/**
|
|
581
|
+
* E1 (§3.1) — liveness TTL co-refresh for the caller's still-open prompt rows
|
|
582
|
+
* (+ their deep-linked Events). Plugins call this heartbeat-driven for their
|
|
583
|
+
* durable open-prompt ledger so a >7-day-open prompt's row is NOT TTL-deleted
|
|
584
|
+
* (under-nag). The backend is scoped to `$ctx.identity.sub` + `attribute_exists`
|
|
585
|
+
* per promptId, so it works post-retirement too. Returns the promptIds whose
|
|
586
|
+
* row/Event had already aged out — the caller re-raises those (§6a-4
|
|
587
|
+
* return-driven re-raise). No-ops on an empty list (no network call).
|
|
588
|
+
*/
|
|
589
|
+
refreshOpenPromptTtl(promptIds: string[]): Promise<string[]>;
|
|
403
590
|
/**
|
|
404
591
|
* Update event status
|
|
405
592
|
*/
|
|
@@ -666,7 +853,9 @@ export declare class AppSyncClient {
|
|
|
666
853
|
* real classification; the signing helper is `signMergeClassification` in
|
|
667
854
|
* `local-executor/class-a-sign.ts`). W2.a ships the SDK surface only.
|
|
668
855
|
*/
|
|
669
|
-
submitMergeGateVerdict(input: SubmitMergeGateVerdictInput
|
|
856
|
+
submitMergeGateVerdict(input: SubmitMergeGateVerdictInput, opts?: {
|
|
857
|
+
signal?: AbortSignal;
|
|
858
|
+
}): Promise<SubmitMergeGateVerdictResult>;
|
|
670
859
|
/**
|
|
671
860
|
* PHASE-589/469 W1 (LOCK #589-F) — report that ONE team track HARD-FAILED
|
|
672
861
|
* its own local gate (a declared-test failure or an out-of-scope write). The
|
|
@@ -718,6 +907,7 @@ export declare class AppSyncClient {
|
|
|
718
907
|
sessionId: string;
|
|
719
908
|
decision: PlannerDecision;
|
|
720
909
|
availableAgents?: string[];
|
|
910
|
+
implementorAgent?: string;
|
|
721
911
|
}): Promise<{
|
|
722
912
|
workflowState: string;
|
|
723
913
|
}>;
|
|
@@ -733,6 +923,7 @@ export declare class AppSyncClient {
|
|
|
733
923
|
sessionId: string;
|
|
734
924
|
roundNumber: number;
|
|
735
925
|
rawOutput: string;
|
|
926
|
+
usage?: InvocationUsageSnapshot;
|
|
736
927
|
}, sessionKeyBase64: string): Promise<{
|
|
737
928
|
gateId: string;
|
|
738
929
|
workflowState: string;
|
|
@@ -1085,6 +1276,8 @@ export declare class AppSyncClient {
|
|
|
1085
1276
|
/** Shared initial confirmation makes duplicate start calls idempotent. */
|
|
1086
1277
|
private heartbeatInitialPulses;
|
|
1087
1278
|
private heartbeatInitialOutcomes;
|
|
1279
|
+
/** Every pulse that may still persist a timestamp, including periodic pulses. */
|
|
1280
|
+
private heartbeatInFlight;
|
|
1088
1281
|
/**
|
|
1089
1282
|
* Start periodic heartbeat for a session.
|
|
1090
1283
|
* Updates lastHeartbeatAt on the session every intervalMs (default 2 minutes).
|
|
@@ -1095,6 +1288,15 @@ export declare class AppSyncClient {
|
|
|
1095
1288
|
* Stop heartbeat for a session.
|
|
1096
1289
|
*/
|
|
1097
1290
|
stopHeartbeat(sessionId: string): void;
|
|
1291
|
+
/**
|
|
1292
|
+
* Fence every heartbeat generation, wait for already-issued timestamp writes,
|
|
1293
|
+
* then persist an expired timestamp so mobile immediately renders the desktop
|
|
1294
|
+
* disconnected. The ordering is load-bearing: writing the tombstone before an
|
|
1295
|
+
* in-flight pulse settles would let that older pulse make the row look live
|
|
1296
|
+
* again after this method returned.
|
|
1297
|
+
*/
|
|
1298
|
+
invalidateHeartbeat(sessionId: string): Promise<boolean>;
|
|
1299
|
+
private trackHeartbeatPulse;
|
|
1098
1300
|
/**
|
|
1099
1301
|
* Send a single heartbeat update.
|
|
1100
1302
|
*/
|
|
@@ -24,10 +24,12 @@ export declare const queries: {
|
|
|
24
24
|
getTaskReviewSummary: string;
|
|
25
25
|
};
|
|
26
26
|
export declare const mutations: {
|
|
27
|
+
recordExecutionEvent: string;
|
|
27
28
|
putContextItem: string;
|
|
28
29
|
createSession: string;
|
|
29
30
|
updateSession: string;
|
|
30
31
|
createEvent: string;
|
|
32
|
+
refreshOpenPromptTtl: string;
|
|
31
33
|
updateEventStatus: string;
|
|
32
34
|
registerDeviceKey: string;
|
|
33
35
|
grantSessionKey: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the `keychain` subcommand group. Returns the process exit code (does NOT
|
|
3
|
+
* call `process.exit` — the caller does, keeping this unit-testable). `argv` is
|
|
4
|
+
* the raw process argv (node, script, "keychain", subcommand, flags…).
|
|
5
|
+
*/
|
|
6
|
+
export declare function runKeychainCli(argv: string[]): Promise<number>;
|
|
7
|
+
/**
|
|
8
|
+
* Advisory nudge for `codevibe login` / `codevibe status` (GA follow-up to #642):
|
|
9
|
+
* when this machine still holds file-backed credentials, has NOT migrated, and the
|
|
10
|
+
* OS keyring is actually usable, print the `keychain migrate` suggestion. Purely
|
|
11
|
+
* additive output — never throws, never mutates state, silent on any ambiguity
|
|
12
|
+
* (see migrate-nudge.ts invariants).
|
|
13
|
+
*/
|
|
14
|
+
export declare function maybePrintKeychainMigrationNudge(print?: (line: string) => void): Promise<void>;
|
|
@@ -53,6 +53,20 @@ export interface CompanionProcessResult {
|
|
|
53
53
|
* both PATH alias dependency and a manifest path traversal/symlink escape.
|
|
54
54
|
*/
|
|
55
55
|
export declare function resolveDeclaredCompanionLauncher(packageJsonPath: string): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve a Companion plugin manifest from either:
|
|
58
|
+
*
|
|
59
|
+
* 1. this core package's ordinary dependency graph (published install), or
|
|
60
|
+
* 2. the node_modules graph that contains the CLI path used to start Node
|
|
61
|
+
* (local npm-link/dev-link install).
|
|
62
|
+
*
|
|
63
|
+
* Node resolves a symlinked module from its real path by default. Consequently,
|
|
64
|
+
* a locally linked codevibe-core cannot see the plugin siblings that remain
|
|
65
|
+
* under the meta-package's node_modules when it uses lexical `require.resolve`
|
|
66
|
+
* alone. `process.argv[1]` retains the invoked, meta-package-owned CLI path, so
|
|
67
|
+
* a require anchored there reproduces the dependency graph the user launched.
|
|
68
|
+
*/
|
|
69
|
+
export declare function resolveCompanionPluginManifest(packageName: string, invokedCliPath?: string | undefined): string | null;
|
|
56
70
|
/**
|
|
57
71
|
* §4 LOCK lines 232-273. Detect → resolve → persist → exec.
|
|
58
72
|
*
|
|
@@ -18,6 +18,15 @@ export interface OAuthAccountLockOptions {
|
|
|
18
18
|
heartbeatMs?: number;
|
|
19
19
|
/** Contention deadline. Default 60s. */
|
|
20
20
|
maxWaitMs?: number;
|
|
21
|
+
/**
|
|
22
|
+
* OWNERLESS-strand grace (F6). A lockdir present with NO readable `owner.json`
|
|
23
|
+
* is a crash strand (mkdir succeeded but the owner write / rmdir did not) that is
|
|
24
|
+
* FENCED-recovered once its mtime has been idle THIS long. Default = 2×TTL — far
|
|
25
|
+
* larger than the sub-millisecond mkdir→owner.json write window, so a live
|
|
26
|
+
* mid-acquire is never mistaken for a strand. Set high to disable recovery in
|
|
27
|
+
* practice.
|
|
28
|
+
*/
|
|
29
|
+
ownerlessGraceMs?: number;
|
|
21
30
|
/** Base retry backoff. Default 25ms (capped 1s). */
|
|
22
31
|
backoffMs?: number;
|
|
23
32
|
now?: () => number;
|
|
@@ -59,6 +68,7 @@ export declare class OAuthAccountLock {
|
|
|
59
68
|
private readonly ttlMs;
|
|
60
69
|
private readonly heartbeatMs;
|
|
61
70
|
private readonly maxWaitMs;
|
|
71
|
+
private readonly ownerlessGraceMs;
|
|
62
72
|
private readonly backoffMs;
|
|
63
73
|
private readonly now;
|
|
64
74
|
private readonly delayFn;
|
|
@@ -76,7 +86,8 @@ export declare class OAuthAccountLock {
|
|
|
76
86
|
* ZERO side effects on the persisted bundle on any fail-closed path.
|
|
77
87
|
*/
|
|
78
88
|
acquire(): Promise<LockHandle>;
|
|
79
|
-
/** Whether the EXISTING lockdir holder is reclaimable (dead),
|
|
89
|
+
/** Whether the EXISTING lockdir holder is reclaimable (dead), an ownerless strand
|
|
90
|
+
* (F6), or must be waited on. */
|
|
80
91
|
private classifyExistingHolder;
|
|
81
92
|
/**
|
|
82
93
|
* Reclaim a stale, provably-dead lockdir under the SEPARATE reclaim guard.
|
|
@@ -85,9 +96,44 @@ export declare class OAuthAccountLock {
|
|
|
85
96
|
* the guard is dead/stranded (fail-closed → offline cleanup).
|
|
86
97
|
*/
|
|
87
98
|
private tryReclaim;
|
|
99
|
+
/**
|
|
100
|
+
* FENCED recovery of a stranded OWNERLESS lockdir (F6) — the same reclaim-guard
|
|
101
|
+
* mutex + rename primitive as the dead-owner path, so at most one recoverer ever
|
|
102
|
+
* proceeds and no live successor is displaced. Returns a fresh {@link LockHandle}
|
|
103
|
+
* on success, or `null` if aborted (guard held/stranded, an owner appeared, or the
|
|
104
|
+
* dir freshened/vanished under the guard).
|
|
105
|
+
*
|
|
106
|
+
* RESIDUAL (documented): the ONE window this cannot fully close is a live acquirer
|
|
107
|
+
* OS-suspended (SIGSTOP) or GC-frozen for LONGER than `ownerlessGraceMs` precisely
|
|
108
|
+
* within the sub-millisecond gap between its `mkdir(lockDir)` and its
|
|
109
|
+
* `writeFile(owner.json)`. If that acquirer's owner-write lands AFTER our rename +
|
|
110
|
+
* fresh mkdir, it overwrites our `owner.json`; our `reassertOwnership()` (the
|
|
111
|
+
* broker's before-every-mutation backstop) then returns false and we abort — no two
|
|
112
|
+
* committed writers for vendor-key callers. For the keychain file-store lock (which
|
|
113
|
+
* does not reassert) this leaves a vanishingly-narrow two-writer window, strictly
|
|
114
|
+
* better than the previous PERMANENT strand that broke all auth until offline
|
|
115
|
+
* cleanup. The grace (default 2×TTL) makes the precondition astronomically unlikely.
|
|
116
|
+
*/
|
|
117
|
+
private tryReclaimOwnerless;
|
|
118
|
+
/** Remove a renamed-away ownerless strand (it holds no owner.json by definition). */
|
|
119
|
+
private removeOwnerlessStaleDir;
|
|
88
120
|
/** Write `owner.json`, start the heartbeat, and build the handle. */
|
|
89
121
|
private onAcquired;
|
|
90
122
|
private tryMkdir;
|
|
123
|
+
/**
|
|
124
|
+
* Tri-state read of a lockdir's owner.json (R4-2). Only a genuine ENOENT is
|
|
125
|
+
* `absent`; a present-but-unreadable (EACCES/EIO/…) or unparseable/invalid file is
|
|
126
|
+
* `unreadable` (fail closed — never treated as ownerless or dead).
|
|
127
|
+
*/
|
|
128
|
+
private readOwnerState;
|
|
129
|
+
/**
|
|
130
|
+
* Boolean-owner accessor for the non-recovery paths (heartbeat tick, reassert,
|
|
131
|
+
* release, dead-owner reclaim, stale-dir cleanup): an `unreadable` owner maps to
|
|
132
|
+
* `null`, which is the SAFE direction for every one of those (reassert→false→abort;
|
|
133
|
+
* tick→skip; release→don't touch; dead-reclaim re-read→abort). The
|
|
134
|
+
* ownerless-recovery path uses `readOwnerState` directly so it can tell `absent`
|
|
135
|
+
* (recoverable) from `unreadable` (must wait).
|
|
136
|
+
*/
|
|
91
137
|
private readOwner;
|
|
92
138
|
private lockDirAge;
|
|
93
139
|
private removeStaleDir;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { CryptoService, cryptoService, CryptoError, ENCRYPTION_VERSION } from './crypto-service';
|
|
2
2
|
export { encryptForEmit } from './encrypt-for-emit';
|
|
3
3
|
export type { EncryptedEmitPayload } from './encrypt-for-emit';
|
|
4
|
+
export { E1_PROMPT_ID_DOMAIN, deriveOpenPromptId, mintOwnerToken, } from './open-prompt-id';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E1 "missed-prompt recovery" — the producer-side self-certifying promptId
|
|
3
|
+
* commitment (PHASE-E1-MISSED-PROMPT-RECOVERY-DESIGN.md §3.1 / §4).
|
|
4
|
+
*
|
|
5
|
+
* A producer (a plugin, or core's own planner-offer path) mints a secret
|
|
6
|
+
* `ownerToken` per raise and emits `promptId = deriveOpenPromptId(ownerToken)`.
|
|
7
|
+
* The backend's `classifyRaise` re-derives and admits the openPrompts row ONLY
|
|
8
|
+
* when `promptId == derive(ownerToken)` (WRITE_ROW). Because SHA-256 is
|
|
9
|
+
* preimage-resistant, an attacker who knows a victim's promptId cannot produce a
|
|
10
|
+
* token that derives to it, so ownership survives the token never being stored
|
|
11
|
+
* server-side (it is NEVER projected back to clients).
|
|
12
|
+
*
|
|
13
|
+
* THIS IS A CROSS-PRODUCER BYTE CONTRACT. This file is the byte-for-byte port of
|
|
14
|
+
* the backend `lambda/shared/e1-open-prompts.ts` derive. core / codex / claude /
|
|
15
|
+
* agy MUST all reproduce the SAME bytes: same domain string, the SINGLE `\0`
|
|
16
|
+
* (0x00) separator, UTF-8 encoding of the token, SHA-256, first 16 bytes, and the
|
|
17
|
+
* v4 UUID version/variant shaping. A single divergent byte yields a different
|
|
18
|
+
* promptId → the backend REJECTs the raise → a HIDDEN prompt (under-nag). The
|
|
19
|
+
* pinned golden vectors in `__tests__/open-prompt-id.test.ts` (identical to the
|
|
20
|
+
* backend's `cdk/test/e1-open-prompts.test.ts`) lock this. Do NOT alter the
|
|
21
|
+
* domain, drop/duplicate the separator, or re-encode.
|
|
22
|
+
*/
|
|
23
|
+
/** Pinned domain separator for the promptId commitment (never change post-ship). */
|
|
24
|
+
export declare const E1_PROMPT_ID_DOMAIN = "codevibe.e1.openprompt.promptid.v1";
|
|
25
|
+
/**
|
|
26
|
+
* `derive(ownerToken) = uuidFormat( SHA-256(E1_DOMAIN ‖ 0x00 ‖ ownerToken)[:16] )`
|
|
27
|
+
* A BARE UUID — NO `synth-` prefix. Preimage-resistant.
|
|
28
|
+
*/
|
|
29
|
+
export declare function deriveOpenPromptId(ownerToken: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Mint a fresh 256-bit secret `ownerToken` for one raise. Hex-encoded so it is a
|
|
32
|
+
* safe plaintext GraphQL string. Never persisted server-side; the producer
|
|
33
|
+
* stashes it in its durable PromptRaiseRecord so a retirement/resume re-raise can
|
|
34
|
+
* re-commit the SAME promptId.
|
|
35
|
+
*/
|
|
36
|
+
export declare function mintOwnerToken(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E1 missed-prompt recovery — the SHARED producer-side raise identity
|
|
3
|
+
* (PHASE-E1-MISSED-PROMPT-RECOVERY-DESIGN.md §4 / §6a-4). core + claude + codex +
|
|
4
|
+
* agy all mint + emit + persist the SAME shape so a retirement/resume re-raise
|
|
5
|
+
* re-commits the SAME `promptId`.
|
|
6
|
+
*
|
|
7
|
+
* A producer mints a fresh `ownerToken` at FIRST raise and stashes it in a
|
|
8
|
+
* durable `PromptRaiseRecord`. Every raise/re-raise emits
|
|
9
|
+
* `promptId = deriveOpenPromptId(ownerToken)` + the token, so the backend
|
|
10
|
+
* `classifyRaise` WRITE_ROWs the durable open-prompt row (first raise on the
|
|
11
|
+
* `attribute_not_exists` branch, a re-raise on the `ownerToken = :token` branch).
|
|
12
|
+
*
|
|
13
|
+
* SECRECY INVARIANT (design Stage-1 v37): `ownerToken` is the secret behind the
|
|
14
|
+
* commitment — it must be stripped from EVERY same-user-readable surface (it is
|
|
15
|
+
* never in a Query/fan-out/listEvents projection). Persist it ONLY in the local
|
|
16
|
+
* durable record on the producer's own machine.
|
|
17
|
+
*
|
|
18
|
+
* Scope: this is the shared E1 IDENTITY. Each plugin's persistence adapter wraps
|
|
19
|
+
* this record with its own re-raise CONTENT (the prompt text / options), because
|
|
20
|
+
* those shapes differ per agent (claude tmux options, codex tool-input, agy pane
|
|
21
|
+
* capture). Keep the identity here; keep the content in the plugin.
|
|
22
|
+
*/
|
|
23
|
+
export type E1ProducerKind = 'PLUGIN_APPROVAL' | 'CORE_OFFER';
|
|
24
|
+
/** The durable, per-producer record (§6a-4). Persisted locally; never uploaded. */
|
|
25
|
+
export interface PromptRaiseRecord {
|
|
26
|
+
/** = deriveOpenPromptId(ownerToken). The stable cross-surface prompt identity. */
|
|
27
|
+
promptId: string;
|
|
28
|
+
/** IMMUTABLE 256-bit secret minted ONCE at first raise. NEVER surface it. */
|
|
29
|
+
ownerToken: string;
|
|
30
|
+
/** The session this prompt belongs to (for the resolve-delete origin binding). */
|
|
31
|
+
sessionId: string;
|
|
32
|
+
producerKind: E1ProducerKind;
|
|
33
|
+
/** CLAUDE | CODEX | ANTIGRAVITY (for the mobile row + fan-out). */
|
|
34
|
+
agentType?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
/** false = SUPPRESSED (options unparseable → badge-only NOTIFICATION carrier). */
|
|
37
|
+
mobileActionable: boolean;
|
|
38
|
+
/** First-raise wall clock (ms); record-creation time, for local ordering/debug. */
|
|
39
|
+
raisedAtMs: number;
|
|
40
|
+
}
|
|
41
|
+
/** The additive `CreateEventInput` fields a raise/re-raise puts on the wire. */
|
|
42
|
+
export interface E1RaiseFields {
|
|
43
|
+
ownerToken: string;
|
|
44
|
+
promptId: string;
|
|
45
|
+
producerKind: E1ProducerKind;
|
|
46
|
+
mobileActionable: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** Derive the wire fields from a (new or persisted) record — pure. */
|
|
49
|
+
export declare function raiseFieldsFromRecord(r: PromptRaiseRecord): E1RaiseFields;
|
|
50
|
+
/**
|
|
51
|
+
* FIRST raise: mint a fresh secret, derive its committed promptId, and return
|
|
52
|
+
* both the wire fields and the durable record to persist. The caller persists
|
|
53
|
+
* `record` (via its per-plugin adapter) so a later restart can re-raise.
|
|
54
|
+
*/
|
|
55
|
+
export declare function newPromptRaise(opts: {
|
|
56
|
+
sessionId: string;
|
|
57
|
+
producerKind: E1ProducerKind;
|
|
58
|
+
mobileActionable: boolean;
|
|
59
|
+
agentType?: string;
|
|
60
|
+
title?: string;
|
|
61
|
+
nowMs?: number;
|
|
62
|
+
}): {
|
|
63
|
+
record: PromptRaiseRecord;
|
|
64
|
+
fields: E1RaiseFields;
|
|
65
|
+
};
|