@quantiya/codevibe-claude-plugin 2.0.28 → 2.0.30

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.
Files changed (25) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/server.js +20 -18
  3. package/node_modules/@quantiya/codevibe-core/dist/index.d.ts +5 -1
  4. package/node_modules/@quantiya/codevibe-core/dist/index.js +442 -419
  5. package/node_modules/@quantiya/codevibe-core/dist/local-executor/__tests__/local-executor-teams-summary.test.d.ts +1 -0
  6. package/node_modules/@quantiya/codevibe-core/dist/local-executor/hook-bridge.d.ts +2 -1
  7. package/node_modules/@quantiya/codevibe-core/dist/local-executor/index.d.ts +5 -0
  8. package/node_modules/@quantiya/codevibe-core/dist/local-executor/local-executor-impl.d.ts +16 -0
  9. package/node_modules/@quantiya/codevibe-core/dist/local-executor/team-summary.d.ts +151 -0
  10. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/__tests__/audit-buffer-join.test.d.ts +1 -0
  11. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/__tests__/audit-normalization.test.d.ts +1 -0
  12. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/__tests__/audit-summary.test.d.ts +1 -0
  13. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/__tests__/decision-map-lifecycle.test.d.ts +1 -0
  14. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/__tests__/query_audit_tier_gate.test.d.ts +1 -0
  15. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/__tests__/quorum-loop-fail-safe.test.d.ts +1 -0
  16. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/__tests__/quorum-loop-summary.test.d.ts +1 -0
  17. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/audit-runner.d.ts +25 -0
  18. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/audit-summary.d.ts +240 -0
  19. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.d.ts +11 -3
  20. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.js +3348 -678
  21. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/gate-decision-submit.d.ts +1 -1
  22. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/index.d.ts +23 -2
  23. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/quorum-loop.d.ts +96 -1
  24. package/node_modules/@quantiya/codevibe-core/package.json +2 -2
  25. package/package.json +2 -2
@@ -1,13 +1,14 @@
1
1
  import { AuthorityError, AuthorityScope } from './authority';
2
2
  import { ClassAEmitter, ClassAEmitterContext } from './class-a-emit';
3
3
  import { AgentKind, HookEvent } from './types';
4
+ import type { ShellEventEmitResult } from '../orchestration-shell/emit-shell-event';
4
5
  export type EmitShellEventFn = (args: {
5
6
  sessionId: string;
6
7
  type: 'USER_PROMPT' | 'ASSISTANT_RESPONSE' | 'INTERACTIVE_PROMPT' | 'LOCAL_AUTHORITY_REFUSAL' | 'NOTIFICATION' | 'CONTINUATION_PACKET_FAILED';
7
8
  content?: string;
8
9
  metadata?: Record<string, unknown>;
9
10
  timestamp?: string;
10
- }) => Promise<void>;
11
+ }) => Promise<ShellEventEmitResult>;
11
12
  export interface HookBridgeDeps {
12
13
  emitter: ClassAEmitter;
13
14
  emitShellEvent: EmitShellEventFn;
@@ -48,3 +48,8 @@ export { resolveSlotConflicts } from './merge-conflict-resolve';
48
48
  export type { ConflictResolverContext, HumanGatedConflict, SlotResolveResult, } from './merge-conflict-resolve';
49
49
  export { mergeBaseOf, lsTreeEntry, diff3MergeBlobs, extractThreeWayConflict, assembleResolvedTree, } from './worktree-merge';
50
50
  export type { TreeEntry } from './worktree-merge';
51
+ export { atomicWriteJsonSync, FileDurableTeamDeliveryJournal, wireSnapshotMergeObserver, adaptSnapshotMergeResult, runSnapshotMergeWithObservedCleanup, emitTeamCompletionSummary, } from './team-summary';
52
+ export type { AtomicWriteOptions, TeamDeliveryJournalEntry, TeamDeliveryRouting, SnapshotCleanupObserver, WireSnapshotMergeObserverResult, AdaptedSnapshotMergeResult, RunSnapshotMergeWithObservedCleanupOptions, EmitTeamCompletionSummaryOptions, EmitTeamCompletionSummaryResult, } from './team-summary';
53
+ export { WorkspaceShadow, type ShadowEnv, type ShadowDiffFile, } from './workspace-shadow';
54
+ export { runSnapshotMergeGate, createSnapshotTrackBundle, type SnapshotTrackBundle, } from './snapshot-merge';
55
+ export { captureWorkspaceRootAuthority, type WorkspaceRootAuthority, } from './workspace-authority';
@@ -341,6 +341,13 @@ export interface LocalExecutorImplDeps {
341
341
  completeSnapshotGroup?: (taskGroupId: string) => Promise<void>;
342
342
  /** Normal-exit retirement of all ordinary durable resources from this session. */
343
343
  disposeSnapshotSessionResources?: () => Promise<void>;
344
+ /** P36 / R2-F2: Read member review evidence (reviewer seconds, findings) for team merge tracks. */
345
+ readMemberReviewEvidence?: (taskId: string) => {
346
+ reviewerSeconds?: number;
347
+ findings?: any[];
348
+ } | undefined;
349
+ /** P36 / R2-F2: Callback for aggregate team merge desktop audit summary. */
350
+ onTeamMergeAuditSummary?: (summary: any) => void;
344
351
  /**
345
352
  * Legacy-named TEST SEAM around the merge-gate body. Production defaults to
346
353
  * the reviewed-bundle filesystem snapshot implementation.
@@ -478,12 +485,21 @@ export declare class LocalExecutorImpl implements LocalExecutor {
478
485
  /** One exact final retirement result, reusable by strict/non-strict callers. */
479
486
  private durableSessionResourceFailures;
480
487
  private _lastMergeGateEmitMs;
488
+ onTeamMergeAuditSummary?: (summary: any) => void;
489
+ readonly memberReviewEvidenceByTask: Map<string, {
490
+ reviewerSeconds: number;
491
+ findings: any[];
492
+ }>;
481
493
  private readonly teamDeps;
482
494
  private readonly logger;
483
495
  private readonly teamModeEnabled;
484
496
  private readonly substrateEngager?;
485
497
  private readonly strictBadgeSink?;
486
498
  constructor(deps: LocalExecutorImplDeps);
499
+ /**
500
+ * P36 / R2-F2: Replays pending companion team completion deliveries from the durable journal.
501
+ */
502
+ replayPendingTeamDeliveries(): Promise<void>;
487
503
  /**
488
504
  * Single-entrypoint authority gate per master §9:1284. Dispatches to the
489
505
  * underlying `authority.ts` primitive based on `action.kind`. Throws
@@ -0,0 +1,151 @@
1
+ export interface AtomicWriteOptions {
2
+ interruptBeforeRename?: boolean;
3
+ injectDirectorySyncError?: Error;
4
+ }
5
+ /**
6
+ * Performs a crash-safe atomic write of serialized JSON data:
7
+ * 1. Writes to temporary file with restrictive permissions (0o600).
8
+ * 2. Flushes to disk via fsyncSync.
9
+ * 3. Supports interrupt injection for crash-recovery verification.
10
+ * 4. Atomic rename into target path.
11
+ * 5. Fsyncs containing directory.
12
+ */
13
+ export declare function atomicWriteJsonSync(targetPath: string, data: unknown, options?: AtomicWriteOptions): void;
14
+ export declare function isProcessAlive(pid: number): boolean;
15
+ export interface TeamDeliveryJournalEntry {
16
+ deliveryId: string;
17
+ status: 'PENDING' | 'SENT';
18
+ leadTaskId: string;
19
+ sessionId: string;
20
+ payload: any;
21
+ receipt: any | null;
22
+ claimOwnerPid?: number | null;
23
+ claimToken?: string | null;
24
+ claimedAt?: string | null;
25
+ updatedAt: string;
26
+ }
27
+ export interface TeamDeliveryRouting {
28
+ leadTaskId?: string | null;
29
+ sessionId?: string | null;
30
+ }
31
+ export declare function validateDeliveryJournalEntry(item: any, filePath?: string, index?: number): void;
32
+ /**
33
+ * Durable persistent journal tracking PENDING and SENT delivery states for companion notifications.
34
+ * Guarantees in-memory mutations only occur AFTER atomic disk persistence succeeds.
35
+ */
36
+ export declare class FileDurableTeamDeliveryJournal {
37
+ readonly filePath: string;
38
+ private entries;
39
+ private isCorrupted;
40
+ private corruptionError;
41
+ constructor(filePath: string);
42
+ private backupCorruptFile;
43
+ private withLock;
44
+ private assertNotCorrupted;
45
+ private persistEntriesSync;
46
+ load(): void;
47
+ recordPending(deliveryId: string, payload: any, routingOrOptions?: TeamDeliveryRouting | AtomicWriteOptions, maybeOptions?: AtomicWriteOptions): void;
48
+ claimDeliveryAdmission(deliveryId: string, summaryPayload: any, routing: TeamDeliveryRouting): {
49
+ admitted: boolean;
50
+ claimToken?: string;
51
+ alreadySent?: boolean;
52
+ existingEntry?: TeamDeliveryJournalEntry;
53
+ };
54
+ releaseDeliveryAdmission(deliveryId: string, claimToken?: string): void;
55
+ recordSent(deliveryId: string, receipt: any, claimTokenOrOptions?: string | AtomicWriteOptions, maybeOptions?: AtomicWriteOptions): void;
56
+ getEntry(deliveryId: string): TeamDeliveryJournalEntry | null;
57
+ getPendingEntries(): TeamDeliveryJournalEntry[];
58
+ getAllEntries(): TeamDeliveryJournalEntry[];
59
+ }
60
+ export interface SnapshotCleanupObserver {
61
+ shadowCreated: boolean;
62
+ shadowDisposed: boolean;
63
+ createdShadows: Set<any>;
64
+ disposedShadows: Set<any>;
65
+ }
66
+ export interface WireSnapshotMergeObserverResult {
67
+ observer: SnapshotCleanupObserver;
68
+ hookedOnShadowCreated: (shadow: any) => void;
69
+ hookedOnShadowDisposed: (shadow: any) => void;
70
+ }
71
+ export declare function wireSnapshotMergeObserver(existingArgs?: {
72
+ onShadowCreated?: (shadow: any) => void;
73
+ onShadowDisposed?: (shadow: any) => void;
74
+ }): WireSnapshotMergeObserverResult;
75
+ export interface AdaptedSnapshotMergeResult {
76
+ outcome: 'PASS' | 'FAIL' | 'UNRESOLVED' | 'UNKNOWN';
77
+ teardownStatus: 'clean' | 'retained_for_gc' | 'unrecorded';
78
+ leadTaskId: string | null;
79
+ totalReviewerSeconds: number;
80
+ rolledUpFindings: string[];
81
+ }
82
+ export declare function adaptSnapshotMergeResult(options: {
83
+ mergeGateResult: string;
84
+ cleanupObserver?: SnapshotCleanupObserver;
85
+ tracks?: Array<{
86
+ taskId?: string;
87
+ role?: string;
88
+ reviewerSeconds?: number;
89
+ findings?: Array<{
90
+ findingId: string;
91
+ issue: string;
92
+ changesMade: string;
93
+ }>;
94
+ }>;
95
+ }): AdaptedSnapshotMergeResult;
96
+ export interface RunSnapshotMergeWithObservedCleanupOptions {
97
+ mergeGateRunner: (args: {
98
+ onShadowCreated: (shadow: any) => void;
99
+ onShadowDisposed: (shadow: any) => void;
100
+ }) => Promise<string>;
101
+ existingOnShadowCreated?: (shadow: any) => void;
102
+ existingOnShadowDisposed?: (shadow: any) => void;
103
+ tracks?: Array<{
104
+ taskId?: string;
105
+ role?: string;
106
+ reviewerSeconds?: number;
107
+ findings?: Array<{
108
+ findingId: string;
109
+ issue: string;
110
+ changesMade: string;
111
+ }>;
112
+ }>;
113
+ }
114
+ /**
115
+ * REQ-6 Candidate Snapshot Merge-Gate Hook:
116
+ * Runs the merge gate with cleanup observation while preserving caller callbacks.
117
+ */
118
+ export declare function runSnapshotMergeWithObservedCleanup(options: RunSnapshotMergeWithObservedCleanupOptions): Promise<AdaptedSnapshotMergeResult>;
119
+ export interface EmitTeamCompletionSummaryOptions {
120
+ deliveryId: string;
121
+ leadTaskId?: string | null;
122
+ sessionId?: string | null;
123
+ summaryData?: any;
124
+ store: FileDurableTeamDeliveryJournal;
125
+ leEmitFn: (args: {
126
+ sessionId: string;
127
+ type: 'NOTIFICATION';
128
+ content?: string;
129
+ metadata?: Record<string, unknown>;
130
+ }) => Promise<{
131
+ emitted: boolean;
132
+ eventId?: string;
133
+ [k: string]: any;
134
+ }>;
135
+ }
136
+ export interface EmitTeamCompletionSummaryResult {
137
+ emitted: boolean;
138
+ alreadySent?: boolean;
139
+ deliveryId: string;
140
+ receipt?: any;
141
+ summaryPayload?: any;
142
+ }
143
+ /**
144
+ * Emits the team completion audit summary over the companion wire:
145
+ * 1. Serializes in-flight emission attempts per deliveryId.
146
+ * 2. Short-circuits if already marked SENT in the durable journal.
147
+ * 3. Validates and binds delivery routing (leadTaskId, sessionId) and rejects conflicting replays.
148
+ * 4. Preserves complete summaryData in journal and emitted envelope.
149
+ * 5. Records SENT with validated receipt upon successful emission.
150
+ */
151
+ export declare function emitTeamCompletionSummary(options: EmitTeamCompletionSummaryOptions): Promise<EmitTeamCompletionSummaryResult>;
@@ -1,6 +1,7 @@
1
1
  import type { AppSyncClient } from '../appsync';
2
2
  import type { Tier } from './types';
3
3
  import { type AuditBrowserModel, type DecryptContentFn } from './audit-browser';
4
+ import { type TaskAuditSummaryModel } from './audit-summary';
4
5
  /** Upgrade CTA appended below the Max interstitial (matches the existing copy). */
5
6
  export declare const AUDIT_BROWSER_UPGRADE_HINT = "Upgrade to Max at https://quantiya.ai/codevibe to access the audit browser.";
6
7
  /**
@@ -68,3 +69,27 @@ export declare function runAuditBrowser(deps: RunAuditBrowserDeps): Promise<RunA
68
69
  * model directly as JSON instead (see `cli.ts`).
69
70
  */
70
71
  export declare function renderAuditResultText(result: RunAuditBrowserResult): string;
72
+ export declare const AUDIT_SUMMARY_PRO_MAX_HEADLINE = "Task audit summary is available for Pro and Max users.";
73
+ export declare const AUDIT_SUMMARY_UPGRADE_HINT = "Upgrade to Pro or Max at https://quantiya.ai/codevibe to access task audit summaries.";
74
+ export interface RunAuditSummaryDeps {
75
+ appsyncClient: AuditAppSyncClient;
76
+ taskId: string;
77
+ sessionId: string;
78
+ tier?: Tier;
79
+ getSessionKeyFn?: (sessionId: string) => Promise<string | null>;
80
+ resolveTierFn?: () => Promise<Tier>;
81
+ }
82
+ export type RunAuditSummaryResult = {
83
+ kind: 'gated';
84
+ headline: string;
85
+ upgradeHint: string;
86
+ } | {
87
+ kind: 'ok';
88
+ model: TaskAuditSummaryModel;
89
+ markdown: string;
90
+ } | {
91
+ kind: 'error';
92
+ line: string;
93
+ reason: string;
94
+ };
95
+ export declare function runAuditSummary(deps: RunAuditSummaryDeps): Promise<RunAuditSummaryResult>;
@@ -0,0 +1,240 @@
1
+ import type { VerdictKind } from '../reviewer/types';
2
+ export declare const MAX_SUMMARY_BYTES = 16384;
3
+ export declare const FIELD_MAX_CHARS = 512;
4
+ export declare const MAX_SEATS_PER_MODEL = 10;
5
+ export declare const MAX_FINDINGS_PER_MODEL = 20;
6
+ export declare const MAX_RESIDUALS_PER_RECORD = 10;
7
+ export declare const ROUND_SOFT_CAP_BYTES = 4096;
8
+ export declare const SECTION_BYTE_BUDGETS: {
9
+ readonly section1: 1800;
10
+ readonly section2: 7500;
11
+ readonly section3: 1800;
12
+ readonly section4: 1800;
13
+ readonly section5: 1800;
14
+ };
15
+ export declare const EXHAUST_MAP: Record<string, string>;
16
+ export declare const GATE_EVENT_KINDS: Set<string>;
17
+ export type TaskCompletionOutcome = 'QUORUM_APPROVED' | 'USER_OVERRIDE_ACCEPTED' | 'CANCELLED' | 'REJECTED' | 'ESCALATED' | 'CORRUPTED_AUDIT_LOG' | 'UNKNOWN';
18
+ export interface AuditSeatModel {
19
+ round: number;
20
+ seatId: string;
21
+ role: string;
22
+ reviewerModel: string;
23
+ reviewerAgent?: string;
24
+ modelUsed?: string;
25
+ verdict: string;
26
+ reasoning?: string;
27
+ durationSeconds: number | null;
28
+ durationEstimated?: boolean;
29
+ tokensUsed?: number | null;
30
+ latencyMs?: number | null;
31
+ }
32
+ export interface AuditFindingModel {
33
+ round: number;
34
+ seatId: string;
35
+ findingId: string;
36
+ issue: string;
37
+ changesMade: string;
38
+ }
39
+ export interface VerificationResultModel {
40
+ testStatus?: string;
41
+ testDetails?: string;
42
+ teardownStatus?: string;
43
+ filesApplied?: number;
44
+ completedAt?: string;
45
+ serverAuthorizedAt?: string;
46
+ workspaceApplicationStatus?: 'applied' | 'pending_merge_gate' | 'unobserved';
47
+ }
48
+ export interface TaskAuditSummaryModel {
49
+ taskId: string;
50
+ sessionId?: string;
51
+ taskTitle?: string;
52
+ completionOutcome: TaskCompletionOutcome;
53
+ outcomeBanner: string;
54
+ decisionLabel?: string;
55
+ totalReviewerSeconds: number | null;
56
+ wallclockSeconds?: number | null;
57
+ timingPartial?: boolean;
58
+ roundDurations?: Record<number, number>;
59
+ roundTimingPartial?: Record<number, boolean>;
60
+ residualStatus?: string;
61
+ omissionNotice?: string;
62
+ seats: AuditSeatModel[];
63
+ findings: AuditFindingModel[];
64
+ residualObservations: string[];
65
+ verification: VerificationResultModel;
66
+ }
67
+ export interface UserDecisionRecord {
68
+ decision: string;
69
+ isFinalApproval?: boolean;
70
+ notes?: string;
71
+ timestamp?: string;
72
+ gateId?: string;
73
+ canonicalDecision?: string;
74
+ decisionClaimId?: string;
75
+ origin?: string;
76
+ }
77
+ export interface ReviewHistorySnapshot {
78
+ taskId: string;
79
+ historyDegraded?: boolean;
80
+ omittedFindingsCount?: number;
81
+ omittedResidualsCount?: number;
82
+ omittedRounds?: number;
83
+ truncatedForSize?: boolean;
84
+ expectedRoster?: Array<{
85
+ seatId: string;
86
+ role: string;
87
+ }>;
88
+ records: Array<{
89
+ round: number;
90
+ seatId: string;
91
+ role: string;
92
+ reviewerAgent: string;
93
+ verdict: VerdictKind | string;
94
+ suggestedChanges: string[];
95
+ reasoning: string;
96
+ modelUsed?: string | null;
97
+ tokensUsed?: number | null;
98
+ latencyMs?: number | null;
99
+ durationSeconds?: number | null;
100
+ residualObservations?: string[];
101
+ historyDegraded?: boolean;
102
+ omittedFindingsCount?: number;
103
+ omittedResidualsCount?: number;
104
+ }>;
105
+ }
106
+ /**
107
+ * Code-point safe capping preserving UTF-16 surrogate pairs and complete Unicode characters.
108
+ * Slices by Unicode code points (not code units) to ensure zero \uFFFD replacement characters.
109
+ */
110
+ export declare function capCodePoints(str: string | undefined | null, maxCodePoints: number): string;
111
+ /**
112
+ * Bounds string characters safely up to maxBytes UTF-8 without splitting multibyte characters.
113
+ */
114
+ export declare function sliceStringToUtf8ByteLimit(str: string, maxBytes: number): string;
115
+ /**
116
+ * Clamps a single section to its UTF-8 byte budget, appending truncation notice if exceeded.
117
+ */
118
+ export declare function clampSectionBytes(title: string, content: string, maxBytes: number): string;
119
+ /**
120
+ * Assembles the 5 markdown sections and verifies strict <= 16384 bytes and 0 \uFFFD.
121
+ */
122
+ export declare function assembleFiveSectionMarkdown(sections: {
123
+ s1: string;
124
+ s2: string;
125
+ s3: string;
126
+ s4: string;
127
+ s5: string;
128
+ }, customTitles?: {
129
+ s1?: string;
130
+ s2?: string;
131
+ s3?: string;
132
+ s4?: string;
133
+ s5?: string;
134
+ }): string;
135
+ /**
136
+ * Enforces memory and field limits on a summary model, truncating excess items with omission notices.
137
+ */
138
+ export declare function boundSummaryModel(model: TaskAuditSummaryModel): TaskAuditSummaryModel;
139
+ export declare function parseSeqNum(val: unknown): number;
140
+ export declare function decryptGcm(ciphertextB64: string, keyBuffer: Buffer): string;
141
+ export declare function encryptGcm(plaintext: string, keyBuffer: Buffer): string;
142
+ export declare function extractEffectivePayload(payload: any): {
143
+ dict: Record<string, any>;
144
+ hasSpec: boolean;
145
+ };
146
+ export declare function normalizeVerdictKind(raw: unknown): string;
147
+ export declare function normalizeGateOutcome(raw: unknown): string;
148
+ export interface NormalizedGateState {
149
+ gateId: string;
150
+ wireRoundNumber: number | null;
151
+ roundNumber: number;
152
+ minSeqNum: number;
153
+ maxSeqNum: number;
154
+ outcome: string;
155
+ seats: Map<string, any>;
156
+ alternateChain: Map<string, string>;
157
+ }
158
+ export interface NormalizedAuditTrail {
159
+ gates: Map<string, NormalizedGateState>;
160
+ nonGateEvents: Array<{
161
+ seqNum: number;
162
+ kind: string;
163
+ payload: Record<string, any>;
164
+ }>;
165
+ userDecisions: Array<{
166
+ seqNum: number;
167
+ decision: string;
168
+ gateId: string | null;
169
+ notes: string;
170
+ timestamp?: string;
171
+ }>;
172
+ userDecisionsByGate: Map<string, {
173
+ seqNum: number;
174
+ decision: string;
175
+ gateId: string | null;
176
+ notes: string;
177
+ timestamp?: string;
178
+ }>;
179
+ hasTaskLevelCorruption: boolean;
180
+ taskLevelDecryptionErrors: number;
181
+ corruptionBanner: string;
182
+ }
183
+ export interface DecodedAuditEntry {
184
+ seqNum: number;
185
+ kind: string;
186
+ payload: any;
187
+ timestamp?: string;
188
+ entry_id?: string;
189
+ entryId?: string;
190
+ task_id?: string;
191
+ taskId?: string;
192
+ isEncrypted: boolean;
193
+ decryptionFailed: boolean;
194
+ decryptionError?: string;
195
+ rawEntry: any;
196
+ }
197
+ export declare function decodeAuditEntries(entries: any[], sessionKey?: Buffer | null): {
198
+ decodedEntries: DecodedAuditEntry[];
199
+ hasTaskLevelCorruption: boolean;
200
+ taskLevelDecryptionErrors: number;
201
+ corruptionBanner: string;
202
+ };
203
+ export declare function normalizeAuditTrail(wireEntries: any[], sessionKey?: Buffer | null): NormalizedAuditTrail;
204
+ export declare function synthesizeConsensus(normalized: NormalizedAuditTrail): {
205
+ overallOutcome: TaskCompletionOutcome;
206
+ banner: string;
207
+ omissionNotice: string;
208
+ gates: Map<string, NormalizedGateState>;
209
+ };
210
+ export declare function aggregateVerificationResults(events: any[]): {
211
+ status: string;
212
+ details: string;
213
+ };
214
+ export declare function reconstructDecisionFromAudit(auditEntries: any[], sessionKey?: Buffer | null, taskId?: string): {
215
+ outcome: TaskCompletionOutcome;
216
+ banner: string;
217
+ decisionLabel: string;
218
+ serverAuthorizedAt?: string;
219
+ };
220
+ export declare function isTaskCompletionAuditSummary(type: string, metadata: unknown): boolean;
221
+ export interface CompileAuditSummaryArgs {
222
+ taskId: string;
223
+ sessionId?: string;
224
+ taskTitle?: string;
225
+ historySnapshot?: ReviewHistorySnapshot | null;
226
+ userDecision?: UserDecisionRecord | null;
227
+ auditEntries?: any[];
228
+ sessionKey?: Buffer | null;
229
+ filesApplied?: number;
230
+ completedAt?: string;
231
+ serverAuthorizedAt?: string;
232
+ wallclockSeconds?: number;
233
+ expectedRoster?: Array<{
234
+ seatId: string;
235
+ role: string;
236
+ }>;
237
+ workspaceApplicationStatus?: 'applied' | 'pending_merge_gate' | 'unobserved';
238
+ }
239
+ export declare function compileAuditSummary(args: CompileAuditSummaryArgs): TaskAuditSummaryModel;
240
+ export declare function renderSummaryMarkdown(summaryModel: TaskAuditSummaryModel): string;
@@ -3,9 +3,12 @@ import { Session } from '../types';
3
3
  import { Mode, Tier } from './types';
4
4
  import { type ModeSelectionDeps } from './mode-selection';
5
5
  import { type RunOrchestrationShellArgs } from './index';
6
- import { type ShellEventEmit } from './emit-shell-event';
6
+ import { type ShellEventEmit, type ShellEventEmitResult } from './emit-shell-event';
7
7
  import { BackendPlannerClient, PlannerCacheLayer, PlannerHealthMachine, type LocalGemmaAdvisoryRunner, type LocalGemmaPlannerRunner } from '../planner';
8
8
  import type { PlannerAdapter, PlannerInput, PlannerDecision, PlannerProbeResult } from '../planner/adapter';
9
+ import { keychainManager } from '../keychain';
10
+ export { keychainManager };
11
+ import type { TaskAuditSummaryModel } from './audit-summary';
9
12
  import { type LocalExecutor, type AuthorityScope, type EmitShellEventFn as LEEmitShellEventFn } from '../local-executor';
10
13
  import { type EngineGroupState } from '../local-executor';
11
14
  import type { TeamTapEvent } from './index';
@@ -135,6 +138,7 @@ export declare function triggerStartupOrphanSweep(appsyncClient: AppSyncClient,
135
138
  * BEFORE the mode parse so `audit` isn't swallowed as a passthrough arg.
136
139
  */
137
140
  export interface ParsedAuditArgs {
141
+ subcommand?: 'show' | 'summary';
138
142
  taskId: string;
139
143
  json: boolean;
140
144
  /** Explicit session override; when absent the runner resolves the active session. */
@@ -401,7 +405,7 @@ export interface BuildQuorumLoopExecutorResult {
401
405
  export declare function buildQuorumLoopExecutor(args: {
402
406
  appsyncClient: AppSyncClient;
403
407
  session: Session;
404
- emitter: (args: ShellEventEmit) => Promise<unknown>;
408
+ emitter: (args: ShellEventEmit) => Promise<ShellEventEmitResult>;
405
409
  /** CP-1.f LOCK RP-6 — host-detected agents threaded into the loop. */
406
410
  detectedAgents?: string[];
407
411
  /** #585 auto-continuation (Max) — the resolved tier, threaded to the loop. */
@@ -434,7 +438,7 @@ export declare function mapTeamLeEventToShellEmit(e: Parameters<LEEmitShellEvent
434
438
  export declare function buildTeamLocalExecutor(args: {
435
439
  appsyncClient: AppSyncClient;
436
440
  session: Session;
437
- emitter: (args: ShellEventEmit) => Promise<unknown>;
441
+ emitter: (args: ShellEventEmit) => Promise<ShellEventEmitResult>;
438
442
  initialScope: AuthorityScope;
439
443
  /** CP-1.f LOCK RP-6 — host-detected agents threaded into the loop. */
440
444
  detectedAgents?: string[];
@@ -455,6 +459,10 @@ export declare function buildTeamLocalExecutor(args: {
455
459
  * built. ABSENT (tests) → the classifier is not wired → regex parser.
456
460
  */
457
461
  classifyRunner?: LocalGemmaPlannerRunner | null;
462
+ /** P36: Task-completion audit summary local store callback. */
463
+ onTaskAuditSummary?: (summary: TaskAuditSummaryModel, markdown: string) => void;
464
+ /** P36: Aggregate team merge audit summary callback. */
465
+ onTeamMergeAuditSummary?: (summary: any) => void;
458
466
  }): Promise<BuildTeamLocalExecutorResult>;
459
467
  /**
460
468
  * PHASE-589/469 W3.1 (C4 / RESIDUAL 2) — probe the engine's TERMINAL view of a