snipara-companion 3.6.8 → 3.6.10

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/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  Release notes for `snipara-companion`, newest first.
4
4
 
5
+ ## New In 3.6.10
6
+
7
+ - Captures rationale-shaped messages from verified standalone commits through
8
+ Why Capture, carrying commit SHA and changed-file provenance while keeping
9
+ candidates pending human review.
10
+ - Skips automatic commit capture during managed workflows so phase/final
11
+ rationale is not duplicated.
12
+
13
+ ## New In 3.6.9
14
+
15
+ - Auto-accepts only `info` and `watch` Advisor recommendations in managed
16
+ workflows, with an auditable `policy_auto` source and stable reason codes;
17
+ `risk` and `block` recommendations still require explicit authority.
18
+ - Adds an evidence-derived Judgment Resolution V1 beside the immutable original
19
+ card. Verification-only warnings can become `ready` after a completed outcome
20
+ and matching passed evidence, while failed evidence, collaboration blockers,
21
+ `resolve_blocker` actions, and explicit blocked decisions remain hard blocks.
22
+ - Preserves superseded responses and refreshed cards in bounded local history,
23
+ and normalizes older Judgment V1 states without a migration or schema reset.
24
+ - Makes action-to-evidence matching explicit for tests, type checks, lint,
25
+ builds, package review, deployment/guard review, impact inspection, and Team
26
+ Sync handoffs.
27
+
5
28
  ## New In 3.6.8
6
29
 
7
30
  - Redacts macOS workspace paths consistently when the same temporary directory
package/README.md CHANGED
@@ -313,6 +313,7 @@ After the first impact check, keep the work resumable:
313
313
 
314
314
  ```bash
315
315
  npx -y snipara-companion workflow start --goal "ship auth hardening"
316
+ npx -y snipara-companion workflow judgment
316
317
  npx -y snipara-companion workflow phase-start audit
317
318
  npx -y snipara-companion lead-plan --task "ship auth hardening" --changed-files src/auth/session.ts --proof "pnpm test auth" --acceptance "auth tests pass"
318
319
  npx -y snipara-companion lead-plan --from-plan ./project-health-lead-plan.json --reconcile --changed-files src/auth/session.ts
@@ -332,12 +333,21 @@ npx -y snipara-companion workflow producer-review --latest --outcome useful --re
332
333
  npx -y snipara-companion handoff --summary "auth impact mapped" --next "run auth tests"
333
334
  ```
334
335
 
336
+ Managed workflow judgments use risk-based authority. `info` and `watch`
337
+ recommendations are accepted locally by policy and remain auditable; `risk` and
338
+ `block` recommendations still need `workflow judgment-respond`. The immutable
339
+ card is never rewritten. Companion appends an effective resolution and can lift
340
+ a verification-only `proof_required` state only after a completed outcome and
341
+ matching passed evidence. Failed evidence, a blocked collaboration guard, a
342
+ `resolve_blocker` action, or an explicit blocked response remains a hard stop.
343
+
335
344
  `snipara-companion` writes local state under `.snipara/` so a coding agent can
336
345
  resume with the current phase, recent handoffs, timeline, context packs, and
337
346
  verification hints.
338
347
 
339
348
  `workflow timeline` reads the append-only activity log at
340
- `.snipara/activity/timeline.jsonl`. `workflow session` derives
349
+ `.snipara/activity/timeline.jsonl`, including privacy-safe PostToolUse outcomes
350
+ and file evidence when the Companion hook is installed. `workflow session` derives
341
351
  `.snipara/activity/session.json` for fast local resume and Orchestrator dogfood;
342
352
  Session Snapshot V0 includes latest activity, risk reasons, touched files, a
343
353
  next action, and advisory Intent Detection V0. Intent Detection V0 reports the
@@ -489,8 +499,15 @@ Release notes live in [CHANGELOG.md](./CHANGELOG.md).
489
499
  When project auth is configured, `workflow phase-commit`, `final-commit`, and
490
500
  `team-sync handoff` also run reviewed Why Capture. The Companion first sends a
491
501
  read-only preview and confirms only when the server detects durable rationale.
492
- Confirmed candidates enter the pending review queue; capture failures remain
493
- visible but do not block the primary workflow command. No documentation prompt
494
- is shown. `final-commit` remains handoff-only: the report explains what was
495
- stored or proposed, but it does not approve pending candidates or write final
496
- summary text as durable memory.
502
+ Low-risk, directly confirmed and sufficiently evidenced captures can be
503
+ approved by the hosted memory policy; shared-scope, conflicting, weakly
504
+ supported, imported, or canonical decision-draft candidates remain reviewed.
505
+ Capture failures stay visible but do not block the primary workflow command. No
506
+ documentation prompt is shown. `final-commit` remains handoff-only: the report
507
+ explains what was stored or proposed, but it does not itself approve canonical
508
+ decision drafts or write final summary text as durable memory.
509
+ After a verified `git commit`, `git revert`, or `git cherry-pick` result, the
510
+ PostToolUse hook runs the same preview-then-confirm flow when no managed
511
+ workflow is active. It submits the commit message, commit SHA, and changed-file
512
+ evidence as `sourceKind=commit`; ordinary messages produce no candidate, and
513
+ any captured rationale remains pending human review.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { AdvisorInfluenceLifecycle, HostedContextControlSource, HostedContextControlPlan, HostedContextControlApplyReceipt, ProjectIntentDetectionResult, ProjectPolicyDecision, ProjectRealityCheckResult, ContextMutationPlan, ContextMutationApplyReceipt, ProjectContextValidationReport, ProjectDriftReport, AgentContextResolution, AgentContextValidationReport, AgentContextEvidenceReceipt, AgentContextEvidenceReport, ProjectIntelligenceEngineeringLeadPlanSummary, ProjectPolicyRule, DecisionRequest, AdvisorInfluenceLifecycleState, OutcomeIntelligenceCalibration, OutcomeIntelligenceReceipt, ControlledWorkerExecutionMode, WorkerTrustCategory, ControlledWorkerExecutionReceipt, UnifiedReceiptEnvelope, WorkerTrustCandidate, WorkerProfile, WorkerTrustEvent } from '@snipara/project-intelligence-contracts';
2
+ import { AdvisorInfluenceLifecycle, HostedContextControlSource, HostedContextControlPlan, HostedContextControlApplyReceipt, ProjectIntentDetectionResult, ProjectPolicyDecision, ProjectRealityCheckResult, ContextMutationPlan, ContextMutationApplyReceipt, ProjectContextValidationReport, ProjectDriftReport, AgentContextResolution, AgentContextValidationReport, AgentContextEvidenceReceipt, AgentContextEvidenceReport, ProjectIntelligenceEngineeringLeadPlanSummary, ProjectPolicyRule, AdvisorInfluenceLifecycleState, DecisionRequest, OutcomeIntelligenceCalibration, OutcomeIntelligenceReceipt, OutcomeIntelligenceEvidence, ControlledWorkerExecutionMode, WorkerTrustCategory, ControlledWorkerExecutionReceipt, UnifiedReceiptEnvelope, WorkerTrustCandidate, WorkerProfile, WorkerTrustEvent } from '@snipara/project-intelligence-contracts';
3
3
 
4
4
  declare function resolveQueryFromToolInput(toolInput?: string, tool?: string): string | null;
5
5
 
@@ -23,199 +23,6 @@ declare function buildCommitResultMetadata(options: {
23
23
  };
24
24
  declare function extractFilesFromToolInput(toolInput?: string): string[];
25
25
 
26
- type ContextPackKind = "tool_output" | "log" | "diff" | "file" | "text" | "note";
27
- interface ContextPackRecord {
28
- version: "snipara.context_pack.v1";
29
- id: string;
30
- createdAt: string;
31
- updatedAt: string;
32
- kind: ContextPackKind;
33
- label: string | null;
34
- source: string | null;
35
- tags: string[];
36
- repoRoot: string;
37
- sha256: string;
38
- bytes: number;
39
- lineCount: number;
40
- contentType: "text/plain";
41
- contentEncoding: "utf8";
42
- preview: string;
43
- expiresAt: string | null;
44
- sensitive: boolean;
45
- warnings: Array<{
46
- code: string;
47
- message: string;
48
- }>;
49
- storage: {
50
- baseRelativePath: string;
51
- manifestRelativePath: string;
52
- blobRelativePath: string;
53
- };
54
- }
55
- interface PackContextOptions {
56
- cwd?: string;
57
- content: string;
58
- label?: string;
59
- source?: string;
60
- kind?: string;
61
- tags?: string[];
62
- ttlDays?: number;
63
- maxBytes?: number;
64
- allowSensitive?: boolean;
65
- now?: Date;
66
- }
67
- interface ContextPackPackCommandOptions {
68
- cwd?: string;
69
- text?: string;
70
- file?: string;
71
- input?: string;
72
- label?: string;
73
- source?: string;
74
- kind?: string;
75
- tags?: string[];
76
- ttlDays?: number;
77
- maxBytes?: number;
78
- allowSensitive?: boolean;
79
- json?: boolean;
80
- }
81
- interface ContextPackRetrieveCommandOptions {
82
- cwd?: string;
83
- output?: string;
84
- metadataOnly?: boolean;
85
- json?: boolean;
86
- }
87
- interface ContextPackStatsCommandOptions {
88
- cwd?: string;
89
- json?: boolean;
90
- }
91
- interface ContextPackCleanCommandOptions {
92
- cwd?: string;
93
- all?: boolean;
94
- expired?: boolean;
95
- olderThanDays?: number;
96
- dryRun?: boolean;
97
- json?: boolean;
98
- now?: Date;
99
- }
100
- interface ContextPackStoragePaths {
101
- repoRoot: string;
102
- baseDir: string;
103
- blobsDir: string;
104
- manifestsDir: string;
105
- latestPath: string;
106
- }
107
- interface PackContextResult {
108
- record: ContextPackRecord;
109
- created: boolean;
110
- baseDir: string;
111
- manifestPath: string;
112
- blobPath: string;
113
- }
114
- interface RetrieveContextPackResult {
115
- record: ContextPackRecord;
116
- content: string;
117
- baseDir: string;
118
- manifestPath: string;
119
- blobPath: string;
120
- }
121
- interface ContextPackStats {
122
- version: "snipara.context_pack.stats.v1";
123
- baseDir: string;
124
- totalPacks: number;
125
- totalBytes: number;
126
- sensitivePacks: number;
127
- expiredPacks: number;
128
- kinds: Record<string, number>;
129
- oldestCreatedAt: string | null;
130
- newestCreatedAt: string | null;
131
- latestId: string | null;
132
- }
133
- interface ContextPackCleanResult {
134
- version: "snipara.context_pack.clean.v1";
135
- baseDir: string;
136
- dryRun: boolean;
137
- selected: number;
138
- deleted: number;
139
- deletedIds: string[];
140
- }
141
- declare function getContextPackStoragePaths(cwd?: string): ContextPackStoragePaths;
142
- declare function packContext(options: PackContextOptions): PackContextResult;
143
- declare function resolveContextPackRecord(idOrRef: string, cwd?: string): {
144
- paths: ContextPackStoragePaths;
145
- record: ContextPackRecord;
146
- manifestPath: string;
147
- };
148
- declare function retrieveContextPack(idOrRef: string, cwd?: string): RetrieveContextPackResult;
149
- declare function buildContextPackStats(options?: ContextPackStatsCommandOptions): ContextPackStats;
150
- declare function cleanContextPacks(options?: ContextPackCleanCommandOptions): ContextPackCleanResult;
151
- declare function contextPackPackCommand(options: ContextPackPackCommandOptions): Promise<void>;
152
- declare function contextPackRetrieveCommand(idOrRef: string, options?: ContextPackRetrieveCommandOptions): Promise<void>;
153
- declare function contextPackStatsCommand(options?: ContextPackStatsCommandOptions): Promise<void>;
154
- declare function contextPackCleanCommand(options?: ContextPackCleanCommandOptions): Promise<void>;
155
-
156
- type PrivacyLevel = "standard" | "sensitive" | "restricted";
157
- type CanonicalEventType = "session_start" | "session_end" | "compact" | "message_user" | "message_assistant" | "tool_call" | "tool_result" | "file_changed" | "error_observed";
158
- interface CanonicalEventOptions {
159
- eventType: CanonicalEventType;
160
- client?: string;
161
- workspace?: string;
162
- sessionId?: string;
163
- agentId?: string;
164
- privacyLevel?: PrivacyLevel;
165
- payload?: Record<string, unknown>;
166
- contextPackReceipts?: LocalContextPackReceiptPayload[];
167
- }
168
- type LocalContextPackReceiptOperation = "pack" | "retrieve" | "reference";
169
- interface LocalContextPackReceiptPayload {
170
- version: "snipara.context_pack.receipt.v1";
171
- receipt_id: string;
172
- pack_id: string;
173
- operation: LocalContextPackReceiptOperation;
174
- content_uploaded: false;
175
- policy_decision: "local_only" | "blocked" | "metadata_only";
176
- privacy_level: PrivacyLevel;
177
- kind: ContextPackRecord["kind"];
178
- label?: string | null;
179
- source?: string | null;
180
- tags: string[];
181
- bytes: number;
182
- line_count: number;
183
- baseline_tokens?: number;
184
- packed_tokens?: number;
185
- retrieved_tokens?: number;
186
- saved_tokens?: number;
187
- payload_digest?: string;
188
- sensitive: boolean;
189
- created_at: string;
190
- expires_at?: string | null;
191
- local_ref: {
192
- base_relative_path: string;
193
- manifest_relative_path: string;
194
- };
195
- }
196
- declare function buildLocalContextPackReceipt(record: ContextPackRecord, options?: {
197
- operation?: LocalContextPackReceiptOperation;
198
- privacyLevel?: PrivacyLevel;
199
- policyDecision?: LocalContextPackReceiptPayload["policy_decision"];
200
- }): LocalContextPackReceiptPayload;
201
- declare function buildLocalContextPackReceipts(options: {
202
- ids: string[];
203
- cwd?: string;
204
- operation?: LocalContextPackReceiptOperation;
205
- privacyLevel?: PrivacyLevel;
206
- }): LocalContextPackReceiptPayload[];
207
- declare function attachLocalContextPackReceipts(payload: Record<string, unknown>, receipts: LocalContextPackReceiptPayload[]): Record<string, unknown>;
208
- declare function buildCanonicalEvent(options: CanonicalEventOptions): {
209
- type: CanonicalEventType;
210
- client: string;
211
- workspace: string;
212
- session_id: string;
213
- agent_id: string;
214
- timestamp: string;
215
- privacy_level: PrivacyLevel;
216
- payload: Record<string, unknown>;
217
- };
218
-
219
26
  interface RLMConfig {
220
27
  apiKey?: string;
221
28
  projectId?: string;
@@ -478,7 +285,7 @@ interface SessionPersistResult {
478
285
  session_id: string;
479
286
  files_tracked: number;
480
287
  }
481
- type WhyCaptureSourceKind = "phase_commit" | "final_commit" | "handoff";
288
+ type WhyCaptureSourceKind = "commit" | "phase_commit" | "final_commit" | "handoff";
482
289
  interface WhyCaptureInput {
483
290
  decision?: string;
484
291
  why?: string;
@@ -1565,6 +1372,242 @@ declare function listProjectsForApiKey(apiKey: string, apiUrl?: string, timeout?
1565
1372
  */
1566
1373
  declare function createClient(timeout?: number, options?: ConfigResolutionOptions): RLMClient;
1567
1374
 
1375
+ interface CompanionWhyCaptureCandidate {
1376
+ text: string;
1377
+ type?: string;
1378
+ category?: string;
1379
+ decision?: string;
1380
+ rationale?: string;
1381
+ }
1382
+ interface CompanionWhyCaptureMemory {
1383
+ memoryId?: string;
1384
+ text: string;
1385
+ type?: string;
1386
+ category?: string;
1387
+ reviewStatus?: string;
1388
+ }
1389
+ interface CompanionWhyCaptureIssue {
1390
+ text: string;
1391
+ reason?: string;
1392
+ }
1393
+ interface CompanionWhyCaptureReceipt {
1394
+ status: "captured" | "no_candidates" | "skipped" | "error";
1395
+ sourceKind: WhyCaptureSourceKind;
1396
+ previewCandidateCount: number;
1397
+ capturedCount: number;
1398
+ previewCandidates: CompanionWhyCaptureCandidate[];
1399
+ pendingMemories: CompanionWhyCaptureMemory[];
1400
+ duplicates: CompanionWhyCaptureIssue[];
1401
+ failed: CompanionWhyCaptureIssue[];
1402
+ commitSha?: string;
1403
+ error?: string;
1404
+ }
1405
+ interface StandaloneCommitEvidence {
1406
+ commitSha: string;
1407
+ summary: string;
1408
+ files: string[];
1409
+ }
1410
+ declare function hasActiveManagedWorkflow(cwd: string): boolean;
1411
+ declare function readStandaloneCommitEvidence(cwd: string, commitSha: string, additionalFiles?: string[]): StandaloneCommitEvidence | undefined;
1412
+ declare function captureStandaloneCommitWhy(input: {
1413
+ cwd: string;
1414
+ commitSha: string;
1415
+ files?: string[];
1416
+ }): Promise<CompanionWhyCaptureReceipt>;
1417
+
1418
+ type ContextPackKind = "tool_output" | "log" | "diff" | "file" | "text" | "note";
1419
+ interface ContextPackRecord {
1420
+ version: "snipara.context_pack.v1";
1421
+ id: string;
1422
+ createdAt: string;
1423
+ updatedAt: string;
1424
+ kind: ContextPackKind;
1425
+ label: string | null;
1426
+ source: string | null;
1427
+ tags: string[];
1428
+ repoRoot: string;
1429
+ sha256: string;
1430
+ bytes: number;
1431
+ lineCount: number;
1432
+ contentType: "text/plain";
1433
+ contentEncoding: "utf8";
1434
+ preview: string;
1435
+ expiresAt: string | null;
1436
+ sensitive: boolean;
1437
+ warnings: Array<{
1438
+ code: string;
1439
+ message: string;
1440
+ }>;
1441
+ storage: {
1442
+ baseRelativePath: string;
1443
+ manifestRelativePath: string;
1444
+ blobRelativePath: string;
1445
+ };
1446
+ }
1447
+ interface PackContextOptions {
1448
+ cwd?: string;
1449
+ content: string;
1450
+ label?: string;
1451
+ source?: string;
1452
+ kind?: string;
1453
+ tags?: string[];
1454
+ ttlDays?: number;
1455
+ maxBytes?: number;
1456
+ allowSensitive?: boolean;
1457
+ now?: Date;
1458
+ }
1459
+ interface ContextPackPackCommandOptions {
1460
+ cwd?: string;
1461
+ text?: string;
1462
+ file?: string;
1463
+ input?: string;
1464
+ label?: string;
1465
+ source?: string;
1466
+ kind?: string;
1467
+ tags?: string[];
1468
+ ttlDays?: number;
1469
+ maxBytes?: number;
1470
+ allowSensitive?: boolean;
1471
+ json?: boolean;
1472
+ }
1473
+ interface ContextPackRetrieveCommandOptions {
1474
+ cwd?: string;
1475
+ output?: string;
1476
+ metadataOnly?: boolean;
1477
+ json?: boolean;
1478
+ }
1479
+ interface ContextPackStatsCommandOptions {
1480
+ cwd?: string;
1481
+ json?: boolean;
1482
+ }
1483
+ interface ContextPackCleanCommandOptions {
1484
+ cwd?: string;
1485
+ all?: boolean;
1486
+ expired?: boolean;
1487
+ olderThanDays?: number;
1488
+ dryRun?: boolean;
1489
+ json?: boolean;
1490
+ now?: Date;
1491
+ }
1492
+ interface ContextPackStoragePaths {
1493
+ repoRoot: string;
1494
+ baseDir: string;
1495
+ blobsDir: string;
1496
+ manifestsDir: string;
1497
+ latestPath: string;
1498
+ }
1499
+ interface PackContextResult {
1500
+ record: ContextPackRecord;
1501
+ created: boolean;
1502
+ baseDir: string;
1503
+ manifestPath: string;
1504
+ blobPath: string;
1505
+ }
1506
+ interface RetrieveContextPackResult {
1507
+ record: ContextPackRecord;
1508
+ content: string;
1509
+ baseDir: string;
1510
+ manifestPath: string;
1511
+ blobPath: string;
1512
+ }
1513
+ interface ContextPackStats {
1514
+ version: "snipara.context_pack.stats.v1";
1515
+ baseDir: string;
1516
+ totalPacks: number;
1517
+ totalBytes: number;
1518
+ sensitivePacks: number;
1519
+ expiredPacks: number;
1520
+ kinds: Record<string, number>;
1521
+ oldestCreatedAt: string | null;
1522
+ newestCreatedAt: string | null;
1523
+ latestId: string | null;
1524
+ }
1525
+ interface ContextPackCleanResult {
1526
+ version: "snipara.context_pack.clean.v1";
1527
+ baseDir: string;
1528
+ dryRun: boolean;
1529
+ selected: number;
1530
+ deleted: number;
1531
+ deletedIds: string[];
1532
+ }
1533
+ declare function getContextPackStoragePaths(cwd?: string): ContextPackStoragePaths;
1534
+ declare function packContext(options: PackContextOptions): PackContextResult;
1535
+ declare function resolveContextPackRecord(idOrRef: string, cwd?: string): {
1536
+ paths: ContextPackStoragePaths;
1537
+ record: ContextPackRecord;
1538
+ manifestPath: string;
1539
+ };
1540
+ declare function retrieveContextPack(idOrRef: string, cwd?: string): RetrieveContextPackResult;
1541
+ declare function buildContextPackStats(options?: ContextPackStatsCommandOptions): ContextPackStats;
1542
+ declare function cleanContextPacks(options?: ContextPackCleanCommandOptions): ContextPackCleanResult;
1543
+ declare function contextPackPackCommand(options: ContextPackPackCommandOptions): Promise<void>;
1544
+ declare function contextPackRetrieveCommand(idOrRef: string, options?: ContextPackRetrieveCommandOptions): Promise<void>;
1545
+ declare function contextPackStatsCommand(options?: ContextPackStatsCommandOptions): Promise<void>;
1546
+ declare function contextPackCleanCommand(options?: ContextPackCleanCommandOptions): Promise<void>;
1547
+
1548
+ type PrivacyLevel = "standard" | "sensitive" | "restricted";
1549
+ type CanonicalEventType = "session_start" | "session_end" | "compact" | "message_user" | "message_assistant" | "tool_call" | "tool_result" | "file_changed" | "error_observed";
1550
+ interface CanonicalEventOptions {
1551
+ eventType: CanonicalEventType;
1552
+ client?: string;
1553
+ workspace?: string;
1554
+ sessionId?: string;
1555
+ agentId?: string;
1556
+ privacyLevel?: PrivacyLevel;
1557
+ payload?: Record<string, unknown>;
1558
+ contextPackReceipts?: LocalContextPackReceiptPayload[];
1559
+ }
1560
+ type LocalContextPackReceiptOperation = "pack" | "retrieve" | "reference";
1561
+ interface LocalContextPackReceiptPayload {
1562
+ version: "snipara.context_pack.receipt.v1";
1563
+ receipt_id: string;
1564
+ pack_id: string;
1565
+ operation: LocalContextPackReceiptOperation;
1566
+ content_uploaded: false;
1567
+ policy_decision: "local_only" | "blocked" | "metadata_only";
1568
+ privacy_level: PrivacyLevel;
1569
+ kind: ContextPackRecord["kind"];
1570
+ label?: string | null;
1571
+ source?: string | null;
1572
+ tags: string[];
1573
+ bytes: number;
1574
+ line_count: number;
1575
+ baseline_tokens?: number;
1576
+ packed_tokens?: number;
1577
+ retrieved_tokens?: number;
1578
+ saved_tokens?: number;
1579
+ payload_digest?: string;
1580
+ sensitive: boolean;
1581
+ created_at: string;
1582
+ expires_at?: string | null;
1583
+ local_ref: {
1584
+ base_relative_path: string;
1585
+ manifest_relative_path: string;
1586
+ };
1587
+ }
1588
+ declare function buildLocalContextPackReceipt(record: ContextPackRecord, options?: {
1589
+ operation?: LocalContextPackReceiptOperation;
1590
+ privacyLevel?: PrivacyLevel;
1591
+ policyDecision?: LocalContextPackReceiptPayload["policy_decision"];
1592
+ }): LocalContextPackReceiptPayload;
1593
+ declare function buildLocalContextPackReceipts(options: {
1594
+ ids: string[];
1595
+ cwd?: string;
1596
+ operation?: LocalContextPackReceiptOperation;
1597
+ privacyLevel?: PrivacyLevel;
1598
+ }): LocalContextPackReceiptPayload[];
1599
+ declare function attachLocalContextPackReceipts(payload: Record<string, unknown>, receipts: LocalContextPackReceiptPayload[]): Record<string, unknown>;
1600
+ declare function buildCanonicalEvent(options: CanonicalEventOptions): {
1601
+ type: CanonicalEventType;
1602
+ client: string;
1603
+ workspace: string;
1604
+ session_id: string;
1605
+ agent_id: string;
1606
+ timestamp: string;
1607
+ privacy_level: PrivacyLevel;
1608
+ payload: Record<string, unknown>;
1609
+ };
1610
+
1568
1611
  type ToolResultClassification = "success" | "failure" | "empty_result" | "timeout";
1569
1612
  interface ToolResultPayloadOptions {
1570
1613
  tool?: string;
@@ -1699,7 +1742,7 @@ declare function runMemoryGuardCheck(options?: MemoryGuardCheckOptions): Promise
1699
1742
 
1700
1743
  declare const ACTIVITY_TIMELINE_VERSION: "snipara.activity_timeline.v0";
1701
1744
  declare const SESSION_SNAPSHOT_VERSION: "snipara.session_snapshot.v0";
1702
- type ActivityEventSource = "workflow" | "team-sync" | "decision" | "producer-loop" | "journal" | "orchestrator";
1745
+ type ActivityEventSource = "workflow" | "tool" | "team-sync" | "decision" | "producer-loop" | "journal" | "orchestrator";
1703
1746
  interface ActivityTimelineEvent {
1704
1747
  schemaVersion: typeof ACTIVITY_TIMELINE_VERSION;
1705
1748
  eventId: string;
@@ -3921,37 +3964,6 @@ declare function getTeamSyncStatePath(rootDir?: string): string;
3921
3964
  declare function buildAgenticHandoffMarkdown(artifact: AgenticHandoffArtifact): string;
3922
3965
  declare function teamSyncSweepCommand(options: TeamSyncCommandOptions): Promise<void>;
3923
3966
 
3924
- interface CompanionWhyCaptureCandidate {
3925
- text: string;
3926
- type?: string;
3927
- category?: string;
3928
- decision?: string;
3929
- rationale?: string;
3930
- }
3931
- interface CompanionWhyCaptureMemory {
3932
- memoryId?: string;
3933
- text: string;
3934
- type?: string;
3935
- category?: string;
3936
- reviewStatus?: string;
3937
- }
3938
- interface CompanionWhyCaptureIssue {
3939
- text: string;
3940
- reason?: string;
3941
- }
3942
- interface CompanionWhyCaptureReceipt {
3943
- status: "captured" | "no_candidates" | "skipped" | "error";
3944
- sourceKind: WhyCaptureSourceKind;
3945
- previewCandidateCount: number;
3946
- capturedCount: number;
3947
- previewCandidates: CompanionWhyCaptureCandidate[];
3948
- pendingMemories: CompanionWhyCaptureMemory[];
3949
- duplicates: CompanionWhyCaptureIssue[];
3950
- failed: CompanionWhyCaptureIssue[];
3951
- commitSha?: string;
3952
- error?: string;
3953
- }
3954
-
3955
3967
  declare const FINAL_COMMIT_REPORT_VERSION: "snipara.final_commit_report.v1";
3956
3968
  declare const FINAL_COMMIT_REPORT_RELATIVE_PATH: string;
3957
3969
  type FinalCommitOutcome = "completed" | "partial" | "blocked" | "abandoned";
@@ -4316,12 +4328,39 @@ interface ManagedWorkflowJudgmentResponse {
4316
4328
  recommendationId: string;
4317
4329
  decision: AdvisorInfluenceAgentDecision;
4318
4330
  respondedAt: string;
4331
+ source: "explicit" | "policy_auto";
4332
+ policyVersion?: "snipara.workflow.judgment-autonomy.v1";
4333
+ reasonCodes: string[];
4319
4334
  planBefore?: string;
4320
4335
  planAfter?: string;
4321
4336
  initialReceipt?: ProjectRunAdvisorReceiptCapture;
4322
4337
  closeoutReceipt?: ProjectRunAdvisorReceiptCapture;
4323
4338
  outcomeReceipts?: OutcomeIntelligenceReceipt[];
4324
4339
  }
4340
+ interface ManagedWorkflowJudgmentResolution {
4341
+ version: "snipara.workflow.judgment-resolution.v1";
4342
+ evaluatedAt: string;
4343
+ state: ProjectJudgmentState;
4344
+ canProceed: ProjectJudgmentCanProceed;
4345
+ originalCard: {
4346
+ generatedAt: string;
4347
+ state: ProjectJudgmentState;
4348
+ canProceed: ProjectJudgmentCanProceed;
4349
+ score: number;
4350
+ };
4351
+ reasonCodes: string[];
4352
+ hardBlockerCodes: string[];
4353
+ pendingExplicitRecommendationIds: string[];
4354
+ autoResponseCount: number;
4355
+ evidence: {
4356
+ passedCount: number;
4357
+ failedCount: number;
4358
+ skippedCount: number;
4359
+ requiredActionCount: number;
4360
+ satisfiedRequiredActionCount: number;
4361
+ unsatisfiedRequiredActions: string[];
4362
+ };
4363
+ }
4325
4364
  interface ManagedWorkflowJudgmentState {
4326
4365
  version: "snipara.workflow.judgment.v1";
4327
4366
  generatedAt: string;
@@ -4329,6 +4368,8 @@ interface ManagedWorkflowJudgmentState {
4329
4368
  brief: ManagedWorkflowJudgmentBrief;
4330
4369
  card: ProjectIntelligenceJudgmentCard;
4331
4370
  responses: ManagedWorkflowJudgmentResponse[];
4371
+ responseHistory?: ManagedWorkflowJudgmentResponse[];
4372
+ resolution?: ManagedWorkflowJudgmentResolution;
4332
4373
  }
4333
4374
  interface ManagedWorkflowState {
4334
4375
  schemaVersion: ManagedWorkflowSchemaVersion;
@@ -4344,6 +4385,7 @@ interface ManagedWorkflowState {
4344
4385
  runtime?: ManagedWorkflowRuntimeState;
4345
4386
  coordination?: ManagedWorkflowCoordinationState;
4346
4387
  judgment?: ManagedWorkflowJudgmentState;
4388
+ judgmentHistory?: ManagedWorkflowJudgmentState[];
4347
4389
  phaseCommitReceipts?: WorkflowPhaseCommitReceipt[];
4348
4390
  finalReport?: FinalCommitReportArtifact;
4349
4391
  lastCommit?: {
@@ -4743,6 +4785,12 @@ declare function buildSyncDocumentsDryRun(documents: SyncDocumentInput[], option
4743
4785
  reindexMode?: ReindexMode;
4744
4786
  now?: Date;
4745
4787
  }): SyncDocumentsDryRunSummary;
4788
+ declare function applyManagedWorkflowPolicyAutoResponses(judgment: ManagedWorkflowJudgmentState, respondedAt?: string): ManagedWorkflowJudgmentResponse[];
4789
+ declare function deriveManagedWorkflowJudgmentResolution(judgment: ManagedWorkflowJudgmentState, options?: {
4790
+ evidence?: OutcomeIntelligenceEvidence[];
4791
+ outcome?: TaskCommitOutcome;
4792
+ evaluatedAt?: string;
4793
+ }): ManagedWorkflowJudgmentResolution;
4746
4794
  declare function buildAgenticWorkStatus(cwd?: string): AgenticWorkStatus;
4747
4795
  declare function buildAgenticTimeline(options?: {
4748
4796
  limit?: number;
@@ -5232,4 +5280,4 @@ declare function installAutomationBundle(args: {
5232
5280
  }): Promise<AutomationInstallResult>;
5233
5281
  declare function getAutomationStatus(projectDir?: string): AutomationStatusResult;
5234
5282
 
5235
- export { AGENT_CONTEXT_EVIDENCE_DEFAULT_LEDGER, AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, CODING_INTELLIGENCE_LEDGER_VERSION, COLLABORATION_STATE_RELATIVE_PATH, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES, ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, FINAL_COMMIT_REPORT_RELATIVE_PATH, FINAL_COMMIT_REPORT_VERSION, MEMORY_GUARD_CONTEXT_TIMEOUT_MS, MEMORY_GUARD_RECALL_TIMEOUT_MS, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, POLICY_LEDGER_SYNC_REPORT_VERSION, PRODUCER_LOOP_ARTIFACT_VERSION, PRODUCER_LOOP_RELATIVE_DIR, PRODUCER_LOOP_REPORT_VERSION, TEAM_SYNC_STATE_RELATIVE_PATH, WHY_OUTCOME_CAPTURE_VERSION, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, addLocalWorker, agentContextEvidenceRecordCommand, agentContextEvidenceStatusCommand, agentContextEvidenceTemplateCommand, agentContextResolveCommand, agentContextValidateCommand, agentReadinessAuditCommand, appendActivityEvent, applyLocalContextMutationPlan, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCodingIntelligenceLedger, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCommitResultMetadata, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildEvalCaseArtifact, buildFinalCommitReport, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalAgentContextValidationReport, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextMutationPlan, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalProjectContextValidationReport, buildLocalProjectDriftReport, buildLocalProjectRealityCheck, buildLocalProjectRealityCheckWithAutoContext, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildPolicyLedgerSyncReport, buildProducerLoopReport, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapBrief, buildSessionBootstrapQuality, buildSessionSnapshot, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWhyOutcomeCaptureReport, buildWorkerTrustCandidates, buildWorkflowImpactGate, buildWorkflowPhaseCommitReceipt, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, cleanContextPacks, codingLedgerExportCommand, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectPolicyLedgerSyncArtifacts, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextControlApplyCommand, contextControlDriftCommand, contextControlHostedApplyCommand, contextControlHostedDiffCommand, contextControlPlanCommand, contextControlValidateCommand, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, controlledWorkerExecuteCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, formatAgentContextResolution, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatFinalCommitReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, hashWorkerProfile, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, memoryReviewsCommand, mergeHybridCodeResults, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, outcomeCapturePreviewCommand, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readActivityTimeline, readAgentContextEvidenceLedger, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, readLocalWorkersConfig, readSessionSnapshot, readWorkerTrustEvent, realityCheckCommand, referencesIngestCommand, referencesScanCommand, resolveAutoWorkflowMode, resolveCodeGraphMode, resolveContextPackRecord, resolveFullWorkflowTokenBudget, resolveLocalWorkerRoutingDefaults, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldFailCollaborationGuard, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, workerTrustCandidateCommand, workerTrustReviewCommand, workerTrustStatusCommand, workersLocalAddCommand, workersLocalListCommand, workersLocalProbePrintCommand, workersLocalRemoveCommand, workersLocalStatusCommand, workflowSyncPolicyLedgerCommand, writeFinalCommitReport, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff, writeProducerLoopArtifact, writeSessionSnapshot };
5283
+ export { AGENT_CONTEXT_EVIDENCE_DEFAULT_LEDGER, AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, CODING_INTELLIGENCE_LEDGER_VERSION, COLLABORATION_STATE_RELATIVE_PATH, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES, ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, FINAL_COMMIT_REPORT_RELATIVE_PATH, FINAL_COMMIT_REPORT_VERSION, MEMORY_GUARD_CONTEXT_TIMEOUT_MS, MEMORY_GUARD_RECALL_TIMEOUT_MS, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, POLICY_LEDGER_SYNC_REPORT_VERSION, PRODUCER_LOOP_ARTIFACT_VERSION, PRODUCER_LOOP_RELATIVE_DIR, PRODUCER_LOOP_REPORT_VERSION, TEAM_SYNC_STATE_RELATIVE_PATH, WHY_OUTCOME_CAPTURE_VERSION, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, addLocalWorker, agentContextEvidenceRecordCommand, agentContextEvidenceStatusCommand, agentContextEvidenceTemplateCommand, agentContextResolveCommand, agentContextValidateCommand, agentReadinessAuditCommand, appendActivityEvent, applyLocalContextMutationPlan, applyManagedWorkflowPolicyAutoResponses, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCodingIntelligenceLedger, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCommitResultMetadata, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildEvalCaseArtifact, buildFinalCommitReport, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalAgentContextValidationReport, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextMutationPlan, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalProjectContextValidationReport, buildLocalProjectDriftReport, buildLocalProjectRealityCheck, buildLocalProjectRealityCheckWithAutoContext, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildPolicyLedgerSyncReport, buildProducerLoopReport, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapBrief, buildSessionBootstrapQuality, buildSessionSnapshot, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWhyOutcomeCaptureReport, buildWorkerTrustCandidates, buildWorkflowImpactGate, buildWorkflowPhaseCommitReceipt, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, captureStandaloneCommitWhy, categoryFromGuardTag, classifyToolResult, cleanContextPacks, codingLedgerExportCommand, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectPolicyLedgerSyncArtifacts, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextControlApplyCommand, contextControlDriftCommand, contextControlHostedApplyCommand, contextControlHostedDiffCommand, contextControlPlanCommand, contextControlValidateCommand, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, controlledWorkerExecuteCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, deriveManagedWorkflowJudgmentResolution, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, formatAgentContextResolution, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatFinalCommitReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, hasActiveManagedWorkflow, hashWorkerProfile, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, memoryReviewsCommand, mergeHybridCodeResults, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, outcomeCapturePreviewCommand, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readActivityTimeline, readAgentContextEvidenceLedger, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, readLocalWorkersConfig, readSessionSnapshot, readStandaloneCommitEvidence, readWorkerTrustEvent, realityCheckCommand, referencesIngestCommand, referencesScanCommand, resolveAutoWorkflowMode, resolveCodeGraphMode, resolveContextPackRecord, resolveFullWorkflowTokenBudget, resolveLocalWorkerRoutingDefaults, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldFailCollaborationGuard, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, workerTrustCandidateCommand, workerTrustReviewCommand, workerTrustStatusCommand, workersLocalAddCommand, workersLocalListCommand, workersLocalProbePrintCommand, workersLocalRemoveCommand, workersLocalStatusCommand, workflowSyncPolicyLedgerCommand, writeFinalCommitReport, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff, writeProducerLoopArtifact, writeSessionSnapshot };