peaks-loop 4.0.7 → 4.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.
Files changed (156) hide show
  1. package/CHANGELOG.md +58 -288
  2. package/dist/cli/commands/_register.js +2 -0
  3. package/dist/cli/commands/baseline-commands.d.ts +3 -0
  4. package/dist/cli/commands/baseline-commands.js +146 -0
  5. package/dist/cli/commands/code-job-shape-commands.js +8 -11
  6. package/dist/cli/commands/code-mode-gate-commands.js +1 -43
  7. package/dist/cli/commands/code-runtime-commands.js +36 -14
  8. package/dist/cli/commands/core/skill-command.js +75 -13
  9. package/dist/cli/commands/core/standards-command.js +5 -50
  10. package/dist/cli/commands/dispatch-commands.d.ts +20 -0
  11. package/dist/cli/commands/dispatch-commands.js +39 -38
  12. package/dist/cli/commands/dispatch-from-dag.js +17 -0
  13. package/dist/cli/commands/heartbeat-commands.d.ts +21 -0
  14. package/dist/cli/commands/heartbeat-commands.js +40 -0
  15. package/dist/cli/commands/hook-handle.js +5 -2
  16. package/dist/cli/commands/hooks-commands.js +9 -26
  17. package/dist/cli/commands/loop-eval-commands.js +5 -2
  18. package/dist/cli/commands/statusline-commands.js +1 -1
  19. package/dist/cli/commands/sub-agent-commands.js +0 -2
  20. package/dist/cli/commands/sub-agent-shared.d.ts +7 -9
  21. package/dist/cli/commands/workflow-commands.js +8 -0
  22. package/dist/cli/commands/workflow-lifecycle-commands.d.ts +63 -0
  23. package/dist/cli/commands/workflow-lifecycle-commands.js +302 -0
  24. package/dist/cli/commands/workspace/init-command.js +19 -0
  25. package/dist/services/audit/backing-detector.d.ts +2 -19
  26. package/dist/services/audit/backing-detector.js +7 -66
  27. package/dist/services/audit/enforcers/active-skill-resolver.d.ts +25 -9
  28. package/dist/services/audit/enforcers/active-skill-resolver.js +83 -21
  29. package/dist/services/audit/enforcers/lint-audit-regression.js +1 -10
  30. package/dist/services/capability-audit-service/cross-check.d.ts +8 -0
  31. package/dist/services/capability-audit-service/cross-check.js +11 -0
  32. package/dist/services/capability-audit-service/index.d.ts +3 -0
  33. package/dist/services/capability-audit-service/index.js +2 -0
  34. package/dist/services/capability-audit-service/runner.d.ts +27 -0
  35. package/dist/services/capability-audit-service/runner.js +40 -0
  36. package/dist/services/capability-audit-service/staleness.d.ts +1 -0
  37. package/dist/services/capability-audit-service/staleness.js +7 -0
  38. package/dist/services/capability-audit-service/types.d.ts +24 -0
  39. package/dist/services/capability-audit-service/types.js +1 -0
  40. package/dist/services/capability-baseline/store.d.ts +33 -0
  41. package/dist/services/capability-baseline/store.js +80 -0
  42. package/dist/services/capability-baseline/types.d.ts +45 -0
  43. package/dist/services/capability-baseline/types.js +5 -0
  44. package/dist/services/capability-baseline/validator.d.ts +19 -0
  45. package/dist/services/capability-baseline/validator.js +38 -0
  46. package/dist/services/capability-guard-runner/contracts/J01.d.ts +2 -0
  47. package/dist/services/capability-guard-runner/contracts/J01.js +48 -0
  48. package/dist/services/capability-guard-runner/contracts/J02.d.ts +2 -0
  49. package/dist/services/capability-guard-runner/contracts/J02.js +34 -0
  50. package/dist/services/capability-guard-runner/contracts/J03.d.ts +2 -0
  51. package/dist/services/capability-guard-runner/contracts/J03.js +24 -0
  52. package/dist/services/capability-guard-runner/contracts/J04.d.ts +2 -0
  53. package/dist/services/capability-guard-runner/contracts/J04.js +40 -0
  54. package/dist/services/capability-guard-runner/contracts/J05.d.ts +2 -0
  55. package/dist/services/capability-guard-runner/contracts/J05.js +21 -0
  56. package/dist/services/capability-guard-runner/contracts/J06.d.ts +2 -0
  57. package/dist/services/capability-guard-runner/contracts/J06.js +43 -0
  58. package/dist/services/capability-guard-runner/contracts/J07.d.ts +2 -0
  59. package/dist/services/capability-guard-runner/contracts/J07.js +53 -0
  60. package/dist/services/capability-guard-runner/contracts/J08.d.ts +2 -0
  61. package/dist/services/capability-guard-runner/contracts/J08.js +43 -0
  62. package/dist/services/capability-guard-runner/contracts/J09.d.ts +2 -0
  63. package/dist/services/capability-guard-runner/contracts/J09.js +44 -0
  64. package/dist/services/capability-guard-runner/contracts/J10.d.ts +2 -0
  65. package/dist/services/capability-guard-runner/contracts/J10.js +40 -0
  66. package/dist/services/capability-guard-runner/contracts/J11.d.ts +2 -0
  67. package/dist/services/capability-guard-runner/contracts/J11.js +39 -0
  68. package/dist/services/capability-guard-runner/contracts/J12.d.ts +2 -0
  69. package/dist/services/capability-guard-runner/contracts/J12.js +34 -0
  70. package/dist/services/capability-guard-runner/contracts/J13.d.ts +2 -0
  71. package/dist/services/capability-guard-runner/contracts/J13.js +45 -0
  72. package/dist/services/capability-guard-runner/contracts/J14.d.ts +2 -0
  73. package/dist/services/capability-guard-runner/contracts/J14.js +36 -0
  74. package/dist/services/capability-guard-runner/contracts/J15.d.ts +2 -0
  75. package/dist/services/capability-guard-runner/contracts/J15.js +40 -0
  76. package/dist/services/capability-guard-runner/diff.d.ts +2 -0
  77. package/dist/services/capability-guard-runner/diff.js +7 -0
  78. package/dist/services/capability-guard-runner/runner.d.ts +9 -0
  79. package/dist/services/capability-guard-runner/runner.js +22 -0
  80. package/dist/services/capability-guard-runner/types.d.ts +39 -0
  81. package/dist/services/capability-guard-runner/types.js +1 -0
  82. package/dist/services/code/auto-compact-orchestrator.d.ts +35 -2
  83. package/dist/services/code/auto-compact-orchestrator.js +29 -9
  84. package/dist/services/context/build-dispatch-system-prompt.js +0 -18
  85. package/dist/services/dispatch/dispatch-record-writer.d.ts +25 -1
  86. package/dist/services/dispatch/dispatch-record-writer.js +85 -15
  87. package/dist/services/dispatch/test-tool-detection.d.ts +0 -14
  88. package/dist/services/dispatch/test-tool-detection.js +0 -22
  89. package/dist/services/doctor/doctor-service/checks/skill-presence.d.ts +8 -0
  90. package/dist/services/doctor/doctor-service/checks/skill-presence.js +9 -1
  91. package/dist/services/evolution/evolution-types.d.ts +16 -16
  92. package/dist/services/final-review/final-review-service.d.ts +8 -0
  93. package/dist/services/final-review/final-review-service.js +14 -0
  94. package/dist/services/final-review/final-review-types.d.ts +1 -1
  95. package/dist/services/hooks/presence-marker-detector.d.ts +6 -0
  96. package/dist/services/hooks/presence-marker-detector.js +48 -0
  97. package/dist/services/ide/adapters/claude-code-adapter.js +20 -0
  98. package/dist/services/ide/adapters/codex-adapter.js +20 -1
  99. package/dist/services/ide/adapters/cursor-adapter.js +21 -1
  100. package/dist/services/ide/adapters/hermes-adapter.js +20 -1
  101. package/dist/services/ide/adapters/openclaw-adapter.js +20 -1
  102. package/dist/services/ide/adapters/qoder-adapter.js +20 -1
  103. package/dist/services/ide/adapters/tongyi-lingma-adapter.js +20 -1
  104. package/dist/services/ide/adapters/trae-adapter.js +21 -1
  105. package/dist/services/ide/adapters/zcode-adapter.js +19 -0
  106. package/dist/services/ide/ide-types.d.ts +15 -0
  107. package/dist/services/job/job-progress-store.d.ts +2 -2
  108. package/dist/services/job/job-types.d.ts +26 -26
  109. package/dist/services/observability/observability-service.d.ts +4 -4
  110. package/dist/services/scan/archetype-service.js +2 -52
  111. package/dist/services/sediment/json-schema.d.ts +4 -4
  112. package/dist/services/session/caller-binding-service.d.ts +21 -0
  113. package/dist/services/session/caller-binding-service.js +35 -0
  114. package/dist/services/session/caller-id-types.d.ts +62 -13
  115. package/dist/services/session/caller-id-types.js +25 -13
  116. package/dist/services/session/index.d.ts +4 -2
  117. package/dist/services/session/index.js +8 -2
  118. package/dist/services/session/platform-fallbacks.d.ts +25 -17
  119. package/dist/services/session/platform-fallbacks.js +26 -28
  120. package/dist/services/session/resolve-caller-id.d.ts +64 -29
  121. package/dist/services/session/resolve-caller-id.js +122 -48
  122. package/dist/services/session/session-manager.d.ts +0 -29
  123. package/dist/services/session/session-manager.js +0 -33
  124. package/dist/services/session/session-resume-service.d.ts +4 -0
  125. package/dist/services/session/session-resume-service.js +4 -0
  126. package/dist/services/skills/hooks-settings-service.d.ts +0 -41
  127. package/dist/services/skills/hooks-settings-service.js +5 -61
  128. package/dist/services/skills/presence-lease-service.d.ts +73 -0
  129. package/dist/services/skills/presence-lease-service.js +358 -0
  130. package/dist/services/skills/presence-lease-types.d.ts +75 -0
  131. package/dist/services/skills/presence-lease-types.js +16 -0
  132. package/dist/services/skills/skill-presence-service.js +86 -22
  133. package/dist/services/skills/skill-statusline-renderer.d.ts +46 -56
  134. package/dist/services/skills/skill-statusline-renderer.js +312 -100
  135. package/dist/services/slice/slice-check-service.js +0 -59
  136. package/dist/services/standards/project-standards-service.js +0 -44
  137. package/dist/services/workflow/workflow-graph-store.d.ts +77 -0
  138. package/dist/services/workflow/workflow-graph-store.js +278 -0
  139. package/dist/services/workflow/workflow-graph-types.d.ts +56 -0
  140. package/dist/services/workflow/workflow-graph-types.js +67 -0
  141. package/dist/services/workflow/workflow-inflight-probe.d.ts +52 -0
  142. package/dist/services/workflow/workflow-inflight-probe.js +86 -0
  143. package/dist/services/workflow/workflow-node-lifecycle.d.ts +67 -0
  144. package/dist/services/workflow/workflow-node-lifecycle.js +348 -0
  145. package/dist/services/workflow/workflow-presence-lifecycle.d.ts +58 -0
  146. package/dist/services/workflow/workflow-presence-lifecycle.js +196 -0
  147. package/dist/services/workspace/reconcile-service.d.ts +31 -0
  148. package/dist/services/workspace/reconcile-service.js +132 -1
  149. package/package.json +5 -4
  150. package/skills/peaks-code/SKILL.md +5 -43
  151. package/skills/peaks-code/references/completion-handoff.md +1 -1
  152. package/skills/peaks-code/references/skill-presence-and-title.md +1 -1
  153. package/dist/cli/commands/sub-agent-exec-command.d.ts +0 -25
  154. package/dist/cli/commands/sub-agent-exec-command.js +0 -132
  155. package/dist/services/standards/find-skills-integration.d.ts +0 -59
  156. package/dist/services/standards/find-skills-integration.js +0 -225
@@ -9,7 +9,7 @@ export declare const SliceStateSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
9
9
  repairCycles: z.ZodDefault<z.ZodNumber>;
10
10
  blockedReason: z.ZodOptional<z.ZodString>;
11
11
  }, "strip", z.ZodTypeAny, {
12
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
12
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
13
13
  label: string;
14
14
  sliceId: string;
15
15
  repairCycles: number;
@@ -18,7 +18,7 @@ export declare const SliceStateSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
18
18
  failureReason?: string | undefined;
19
19
  blockedReason?: string | undefined;
20
20
  }, {
21
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
21
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
22
22
  label: string;
23
23
  sliceId: string;
24
24
  commitSha?: string | undefined;
@@ -27,7 +27,7 @@ export declare const SliceStateSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
27
27
  repairCycles?: number | undefined;
28
28
  blockedReason?: string | undefined;
29
29
  }>, {
30
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
30
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
31
31
  label: string;
32
32
  sliceId: string;
33
33
  repairCycles: number;
@@ -36,7 +36,7 @@ export declare const SliceStateSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
36
36
  failureReason?: string | undefined;
37
37
  blockedReason?: string | undefined;
38
38
  }, {
39
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
39
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
40
40
  label: string;
41
41
  sliceId: string;
42
42
  commitSha?: string | undefined;
@@ -45,7 +45,7 @@ export declare const SliceStateSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
45
45
  repairCycles?: number | undefined;
46
46
  blockedReason?: string | undefined;
47
47
  }>, {
48
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
48
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
49
49
  label: string;
50
50
  sliceId: string;
51
51
  repairCycles: number;
@@ -54,7 +54,7 @@ export declare const SliceStateSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
54
54
  failureReason?: string | undefined;
55
55
  blockedReason?: string | undefined;
56
56
  }, {
57
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
57
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
58
58
  label: string;
59
59
  sliceId: string;
60
60
  commitSha?: string | undefined;
@@ -63,7 +63,7 @@ export declare const SliceStateSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
63
63
  repairCycles?: number | undefined;
64
64
  blockedReason?: string | undefined;
65
65
  }>, {
66
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
66
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
67
67
  label: string;
68
68
  sliceId: string;
69
69
  repairCycles: number;
@@ -72,7 +72,7 @@ export declare const SliceStateSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
72
72
  failureReason?: string | undefined;
73
73
  blockedReason?: string | undefined;
74
74
  }, {
75
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
75
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
76
76
  label: string;
77
77
  sliceId: string;
78
78
  commitSha?: string | undefined;
@@ -117,7 +117,7 @@ export declare const JobStateSchema: z.ZodObject<{
117
117
  repairCycles: z.ZodDefault<z.ZodNumber>;
118
118
  blockedReason: z.ZodOptional<z.ZodString>;
119
119
  }, "strip", z.ZodTypeAny, {
120
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
120
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
121
121
  label: string;
122
122
  sliceId: string;
123
123
  repairCycles: number;
@@ -126,7 +126,7 @@ export declare const JobStateSchema: z.ZodObject<{
126
126
  failureReason?: string | undefined;
127
127
  blockedReason?: string | undefined;
128
128
  }, {
129
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
129
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
130
130
  label: string;
131
131
  sliceId: string;
132
132
  commitSha?: string | undefined;
@@ -135,7 +135,7 @@ export declare const JobStateSchema: z.ZodObject<{
135
135
  repairCycles?: number | undefined;
136
136
  blockedReason?: string | undefined;
137
137
  }>, {
138
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
138
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
139
139
  label: string;
140
140
  sliceId: string;
141
141
  repairCycles: number;
@@ -144,7 +144,7 @@ export declare const JobStateSchema: z.ZodObject<{
144
144
  failureReason?: string | undefined;
145
145
  blockedReason?: string | undefined;
146
146
  }, {
147
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
147
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
148
148
  label: string;
149
149
  sliceId: string;
150
150
  commitSha?: string | undefined;
@@ -153,7 +153,7 @@ export declare const JobStateSchema: z.ZodObject<{
153
153
  repairCycles?: number | undefined;
154
154
  blockedReason?: string | undefined;
155
155
  }>, {
156
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
156
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
157
157
  label: string;
158
158
  sliceId: string;
159
159
  repairCycles: number;
@@ -162,7 +162,7 @@ export declare const JobStateSchema: z.ZodObject<{
162
162
  failureReason?: string | undefined;
163
163
  blockedReason?: string | undefined;
164
164
  }, {
165
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
165
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
166
166
  label: string;
167
167
  sliceId: string;
168
168
  commitSha?: string | undefined;
@@ -171,7 +171,7 @@ export declare const JobStateSchema: z.ZodObject<{
171
171
  repairCycles?: number | undefined;
172
172
  blockedReason?: string | undefined;
173
173
  }>, {
174
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
174
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
175
175
  label: string;
176
176
  sliceId: string;
177
177
  repairCycles: number;
@@ -180,7 +180,7 @@ export declare const JobStateSchema: z.ZodObject<{
180
180
  failureReason?: string | undefined;
181
181
  blockedReason?: string | undefined;
182
182
  }, {
183
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
183
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
184
184
  label: string;
185
185
  sliceId: string;
186
186
  commitSha?: string | undefined;
@@ -200,7 +200,7 @@ export declare const JobStateSchema: z.ZodObject<{
200
200
  rotateEvery: number;
201
201
  mainSessionCycle: number;
202
202
  slices: {
203
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
203
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
204
204
  label: string;
205
205
  sliceId: string;
206
206
  repairCycles: number;
@@ -221,7 +221,7 @@ export declare const JobStateSchema: z.ZodObject<{
221
221
  jobId: string;
222
222
  startedAt: string;
223
223
  slices: {
224
- status: "pending" | "blocked" | "failed" | "done" | "skipped" | "in-progress";
224
+ status: "pending" | "blocked" | "failed" | "skipped" | "done" | "in-progress";
225
225
  label: string;
226
226
  sliceId: string;
227
227
  commitSha?: string | undefined;
@@ -294,8 +294,8 @@ export declare const JobStatusSummarySchema: z.ZodObject<{
294
294
  }, "strip", z.ZodTypeAny, {
295
295
  blocked: number;
296
296
  failed: number;
297
- done: number;
298
297
  skipped: number;
298
+ done: number;
299
299
  total: number;
300
300
  mainLoopStrategy: "single" | "rotating";
301
301
  mainSessionCycle: number;
@@ -312,8 +312,8 @@ export declare const JobStatusSummarySchema: z.ZodObject<{
312
312
  }, {
313
313
  blocked: number;
314
314
  failed: number;
315
- done: number;
316
315
  skipped: number;
316
+ done: number;
317
317
  total: number;
318
318
  mainLoopStrategy: "single" | "rotating";
319
319
  mainSessionCycle: number;
@@ -374,7 +374,7 @@ export declare const JobCheckpointInputSchema: z.ZodEffects<z.ZodEffects<z.ZodOb
374
374
  json: z.ZodDefault<z.ZodBoolean>;
375
375
  }, "strip", z.ZodTypeAny, {
376
376
  project: string;
377
- state: "failed" | "done" | "skipped";
377
+ state: "failed" | "skipped" | "done";
378
378
  json: boolean;
379
379
  jobId: string;
380
380
  sliceId: string;
@@ -382,7 +382,7 @@ export declare const JobCheckpointInputSchema: z.ZodEffects<z.ZodEffects<z.ZodOb
382
382
  commitSha?: string | undefined;
383
383
  }, {
384
384
  project: string;
385
- state: "failed" | "done" | "skipped";
385
+ state: "failed" | "skipped" | "done";
386
386
  jobId: string;
387
387
  sliceId: string;
388
388
  reason?: string | undefined;
@@ -390,7 +390,7 @@ export declare const JobCheckpointInputSchema: z.ZodEffects<z.ZodEffects<z.ZodOb
390
390
  commitSha?: string | undefined;
391
391
  }>, {
392
392
  project: string;
393
- state: "failed" | "done" | "skipped";
393
+ state: "failed" | "skipped" | "done";
394
394
  json: boolean;
395
395
  jobId: string;
396
396
  sliceId: string;
@@ -398,7 +398,7 @@ export declare const JobCheckpointInputSchema: z.ZodEffects<z.ZodEffects<z.ZodOb
398
398
  commitSha?: string | undefined;
399
399
  }, {
400
400
  project: string;
401
- state: "failed" | "done" | "skipped";
401
+ state: "failed" | "skipped" | "done";
402
402
  jobId: string;
403
403
  sliceId: string;
404
404
  reason?: string | undefined;
@@ -406,7 +406,7 @@ export declare const JobCheckpointInputSchema: z.ZodEffects<z.ZodEffects<z.ZodOb
406
406
  commitSha?: string | undefined;
407
407
  }>, {
408
408
  project: string;
409
- state: "failed" | "done" | "skipped";
409
+ state: "failed" | "skipped" | "done";
410
410
  json: boolean;
411
411
  jobId: string;
412
412
  sliceId: string;
@@ -414,7 +414,7 @@ export declare const JobCheckpointInputSchema: z.ZodEffects<z.ZodEffects<z.ZodOb
414
414
  commitSha?: string | undefined;
415
415
  }, {
416
416
  project: string;
417
- state: "failed" | "done" | "skipped";
417
+ state: "failed" | "skipped" | "done";
418
418
  jobId: string;
419
419
  sliceId: string;
420
420
  reason?: string | undefined;
@@ -33,19 +33,19 @@ export declare const ObservabilityEventSchema: z.ZodObject<{
33
33
  role: z.ZodOptional<z.ZodEnum<["rd", "qa", "code-reviewer", "karpathy-reviewer", "peaks-security-audit", "peaks-perf-audit"]>>;
34
34
  detail: z.ZodRecord<z.ZodString, z.ZodUnknown>;
35
35
  }, "strip", z.ZodTypeAny, {
36
+ schemaVersion: 1;
36
37
  sessionId: string;
37
38
  detail: Record<string, unknown>;
38
- schemaVersion: 1;
39
39
  ts: string;
40
- category: "slice-transition" | "dispatch" | "checkpoint" | "mode-gate" | "context-trigger" | "post-compact" | "cycle" | "token-usage" | "monotonic-trigger" | "lease";
40
+ category: "dispatch" | "slice-transition" | "checkpoint" | "mode-gate" | "context-trigger" | "post-compact" | "cycle" | "token-usage" | "monotonic-trigger" | "lease";
41
41
  role?: "qa" | "rd" | "code-reviewer" | "karpathy-reviewer" | "peaks-security-audit" | "peaks-perf-audit" | undefined;
42
42
  sliceRid?: string | undefined;
43
43
  }, {
44
+ schemaVersion: 1;
44
45
  sessionId: string;
45
46
  detail: Record<string, unknown>;
46
- schemaVersion: 1;
47
47
  ts: string;
48
- category: "slice-transition" | "dispatch" | "checkpoint" | "mode-gate" | "context-trigger" | "post-compact" | "cycle" | "token-usage" | "monotonic-trigger" | "lease";
48
+ category: "dispatch" | "slice-transition" | "checkpoint" | "mode-gate" | "context-trigger" | "post-compact" | "cycle" | "token-usage" | "monotonic-trigger" | "lease";
49
49
  role?: "qa" | "rd" | "code-reviewer" | "karpathy-reviewer" | "peaks-security-audit" | "peaks-perf-audit" | undefined;
50
50
  sliceRid?: string | undefined;
51
51
  }>;
@@ -44,46 +44,6 @@ async function readPackageJsonDeps(projectRoot) {
44
44
  return { exists: true, deps: {} };
45
45
  }
46
46
  }
47
- /**
48
- * Slice 4.0.7-dogfood-PR-8: walk packages/[name]/package.json one
49
- * level deep and merge each sub-package's deps into a single map
50
- * (later sub-packages win on key collision; this is the conservative
51
- * "first detected framework" behavior). Returns empty when the
52
- * project is not a monorepo or has no packages dir. Deliberately
53
- * does NOT recurse into nested workspaces.
54
- */
55
- async function readMonorepoSubPackageDeps(projectRoot) {
56
- const packagesDir = join(projectRoot, 'packages');
57
- if (!(await pathExists(packagesDir)))
58
- return {};
59
- let entries;
60
- try {
61
- entries = await readdir(packagesDir);
62
- }
63
- catch {
64
- return {};
65
- }
66
- const merged = {};
67
- for (const entry of entries) {
68
- if (entry === '.' || entry === '..')
69
- continue;
70
- const subPkgPath = join(packagesDir, entry, 'package.json');
71
- if (!(await pathExists(subPkgPath)))
72
- continue;
73
- try {
74
- const raw = await readText(subPkgPath);
75
- const parsed = JSON.parse(raw);
76
- Object.assign(merged, parsed.dependencies ?? {});
77
- Object.assign(merged, parsed.devDependencies ?? {});
78
- Object.assign(merged, parsed.peerDependencies ?? {});
79
- Object.assign(merged, parsed.optionalDependencies ?? {});
80
- }
81
- catch {
82
- // skip malformed sub-package; keep walking
83
- }
84
- }
85
- return merged;
86
- }
87
47
  async function detectBackendFrameworks(deps) {
88
48
  return BACKEND_DEP_NAMES.filter((name) => name !== 'next' && Object.prototype.hasOwnProperty.call(deps, name));
89
49
  }
@@ -266,18 +226,8 @@ function decideFrontendOnly(report) {
266
226
  export async function scanArchetype(options) {
267
227
  const { projectRoot } = options;
268
228
  const { exists: hasPackageJson, deps } = await readPackageJsonDeps(projectRoot);
269
- // Slice 4.0.7-dogfood-PR-8 (ice-cola surface probe 2026-08-02): a
270
- // monorepo root often carries only a thin workspace manifest (no
271
- // framework deps). Ice-cola root has peaks-loop only, and the
272
- // @nestjs/core dep lives in packages[server].package.json. Pre-rid
273
- // this reported `hasBackendFramework: false` for a NestJS monorepo
274
- // because the dep scan only looked at the root. The fix adds a
275
- // 1-level-deep walk into the packages dir and merges each
276
- // sub-package's deps into the dedup result.
277
- const monorepoSubDeps = await readMonorepoSubPackageDeps(projectRoot);
278
- const mergedDeps = { ...deps, ...monorepoSubDeps };
279
- const backendFrameworks = await detectBackendFrameworks(mergedDeps);
280
- const hasNext = Object.prototype.hasOwnProperty.call(mergedDeps, 'next');
229
+ const backendFrameworks = await detectBackendFrameworks(deps);
230
+ const hasNext = Object.prototype.hasOwnProperty.call(deps, 'next');
281
231
  const hasNextApiRoutes = await detectNextApiRoutes(projectRoot, hasNext);
282
232
  const backendDirsPresent = await detectBackendDirs(projectRoot);
283
233
  const swaggerPaths = await detectSwagger(projectRoot);
@@ -107,6 +107,7 @@ export declare const BeeManifestSchema: z.ZodEffects<z.ZodObject<{
107
107
  }, "strip", z.ZodTypeAny, {
108
108
  name: string;
109
109
  description: string;
110
+ schemaVersion: "peaks.bee/1";
110
111
  segments: {
111
112
  name: string;
112
113
  outputs: {
@@ -128,7 +129,6 @@ export declare const BeeManifestSchema: z.ZodEffects<z.ZodObject<{
128
129
  retireOnMissesInRow?: number | undefined;
129
130
  };
130
131
  source: "user" | "system";
131
- schemaVersion: "peaks.bee/1";
132
132
  promotion_status: "candidate" | "stable" | "retired" | "system-stable";
133
133
  entrypoint: {
134
134
  preamble: string;
@@ -142,6 +142,7 @@ export declare const BeeManifestSchema: z.ZodEffects<z.ZodObject<{
142
142
  }, {
143
143
  name: string;
144
144
  description: string;
145
+ schemaVersion: "peaks.bee/1";
145
146
  segments: {
146
147
  name: string;
147
148
  outputs: {
@@ -163,7 +164,6 @@ export declare const BeeManifestSchema: z.ZodEffects<z.ZodObject<{
163
164
  retireOnMissesInRow?: number | undefined;
164
165
  };
165
166
  source: "user" | "system";
166
- schemaVersion: "peaks.bee/1";
167
167
  promotion_status: "candidate" | "stable" | "retired" | "system-stable";
168
168
  entrypoint: {
169
169
  preamble: string;
@@ -177,6 +177,7 @@ export declare const BeeManifestSchema: z.ZodEffects<z.ZodObject<{
177
177
  }>, {
178
178
  name: string;
179
179
  description: string;
180
+ schemaVersion: "peaks.bee/1";
180
181
  segments: {
181
182
  name: string;
182
183
  outputs: {
@@ -198,7 +199,6 @@ export declare const BeeManifestSchema: z.ZodEffects<z.ZodObject<{
198
199
  retireOnMissesInRow?: number | undefined;
199
200
  };
200
201
  source: "user" | "system";
201
- schemaVersion: "peaks.bee/1";
202
202
  promotion_status: "candidate" | "stable" | "retired" | "system-stable";
203
203
  entrypoint: {
204
204
  preamble: string;
@@ -212,6 +212,7 @@ export declare const BeeManifestSchema: z.ZodEffects<z.ZodObject<{
212
212
  }, {
213
213
  name: string;
214
214
  description: string;
215
+ schemaVersion: "peaks.bee/1";
215
216
  segments: {
216
217
  name: string;
217
218
  outputs: {
@@ -233,7 +234,6 @@ export declare const BeeManifestSchema: z.ZodEffects<z.ZodObject<{
233
234
  retireOnMissesInRow?: number | undefined;
234
235
  };
235
236
  source: "user" | "system";
236
- schemaVersion: "peaks.bee/1";
237
237
  promotion_status: "candidate" | "stable" | "retired" | "system-stable";
238
238
  entrypoint: {
239
239
  preamble: string;
@@ -68,3 +68,24 @@ export declare function setCallerBinding(projectRoot: string, callerId: string,
68
68
  * re-reading).
69
69
  */
70
70
  export declare function listCallerBindings(projectRoot: string): CallerBinding[];
71
+ /**
72
+ * Slice 4.0.8 (RD §6 migration): on a `presence:set` sweep, the
73
+ * legacy per-caller `active-skill-<callerId>.json` files are
74
+ * migrated into the canonical `presence-index/<callerId>.json` +
75
+ * `leases/presence-<caller>-<workflow>.json` layout. This function
76
+ * is invoked by `reconcileWorkspace` during the migration window;
77
+ * the canonical `setPresenceLease` is the new write path so
78
+ * post-migration `presence:set` calls route through the lease
79
+ * service directly. The legacy on-disk shape is preserved here as
80
+ * a read-only input (it remains the source of truth for pre-4.0.8
81
+ * callers that haven't migrated yet).
82
+ */
83
+ export declare function reconcileLegacyCallerPresence(input: {
84
+ projectRoot: string;
85
+ callerId: string;
86
+ peakSessionId: string;
87
+ }): {
88
+ migrated: boolean;
89
+ reason: 'already-canonical' | 'missing-legacy' | 'success' | 'io-error';
90
+ error?: string;
91
+ };
@@ -146,3 +146,38 @@ export function listCallerBindings(projectRoot) {
146
146
  }
147
147
  return out;
148
148
  }
149
+ /**
150
+ * Slice 4.0.8 (RD §6 migration): on a `presence:set` sweep, the
151
+ * legacy per-caller `active-skill-<callerId>.json` files are
152
+ * migrated into the canonical `presence-index/<callerId>.json` +
153
+ * `leases/presence-<caller>-<workflow>.json` layout. This function
154
+ * is invoked by `reconcileWorkspace` during the migration window;
155
+ * the canonical `setPresenceLease` is the new write path so
156
+ * post-migration `presence:set` calls route through the lease
157
+ * service directly. The legacy on-disk shape is preserved here as
158
+ * a read-only input (it remains the source of truth for pre-4.0.8
159
+ * callers that haven't migrated yet).
160
+ */
161
+ export function reconcileLegacyCallerPresence(input) {
162
+ const legacyPath = getActiveSkillFileForCaller(input.projectRoot, input.peakSessionId, input.callerId);
163
+ if (!existsSync(legacyPath)) {
164
+ return { migrated: false, reason: 'missing-legacy' };
165
+ }
166
+ // The canonical index lives at `<sessionDir>/presence-index/<callerId>.json`;
167
+ // a successful `setPresenceLease` would have written it already. We don't
168
+ // auto-write here (the canonical write path is the lease service); this
169
+ // function only reports the migration status. The caller decides whether
170
+ // to write the canonical record (via `setPresenceLease`) or to leave the
171
+ // legacy file in place.
172
+ try {
173
+ const raw = readFileSync(legacyPath, 'utf8');
174
+ const parsed = JSON.parse(raw);
175
+ if (typeof parsed.skill !== 'string') {
176
+ return { migrated: false, reason: 'io-error', error: 'legacy file malformed' };
177
+ }
178
+ return { migrated: true, reason: 'success' };
179
+ }
180
+ catch (err) {
181
+ return { migrated: false, reason: 'io-error', error: err.message };
182
+ }
183
+ }
@@ -1,18 +1,60 @@
1
1
  /**
2
- * Caller-Id Resolution types (slice 020 — caller-keyed session binding).
2
+ * Caller-Id Resolution types (slice 020 — caller-keyed session binding,
3
+ * refactored in slice 4.0.8 to be adapter-owned per RD §5).
3
4
  *
4
- * The single shared `.peaks/_runtime/session.json` and
5
- * `.peaks/_runtime/active-skill.json` files are replaced with per-caller
6
- * layouts: `.peaks/_runtime/callers/<callerId>.json` and
7
- * `.peaks/_runtime/<peakSid>/active-skill-<callerId>.json`. The
8
- * `callerId` is a generic identifier the calling platform declares
9
- * itself (Claude Code via `CLAUDE_CODE_SESSION_ID`, future platforms
10
- * via `PLATFORM_FALLBACKS`).
5
+ * Per RD §5 + C1 user-confirmed product decision (binding 2026-08-03):
6
+ * "Every caller resolution MUST go through the active IDE adapter. Anyone
7
+ * whose IDE is not detected by peaks adapter dispatch gets
8
+ * PEAKS_CALLER_NOT_RESOLVED. This is the desired product contract
9
+ * (vendor-neutral)."
11
10
  *
12
- * See `.peaks/_runtime/2026-06-09-session-8bfe7d/prd/source/caller-id-contract.md`
13
- * for the freeze-in contract (D1-D7 + M1-M5).
11
+ * As of 4.0.8 the per-platform `PLATFORM_FALLBACKS` table is DELETED. The
12
+ * legacy `CallerIdSource` (`'fallback' | 'flag' | 'env' | 'none'`) is
13
+ * preserved for back-compat with consumers that read the value, but the
14
+ * core resolution path only ever emits `'env-flag' | 'adapter' | 'none'`
15
+ * via the new `CallerProjection.source` field.
16
+ *
17
+ * See `.peaks/_runtime/2026-08-03-session-bee258/rd/requests/001-2026-08-03-presence-lease-graph-design.md`
18
+ * for the slice 4.0.8 contract.
14
19
  */
15
20
  export type CallerIdSource = 'flag' | 'env' | 'fallback' | 'none';
21
+ /**
22
+ * The 4.0.8 slice-2 source union: caller was resolved by the
23
+ * PEAKS_CALLER_ID vendor-neutral override (`env-flag`) or by the active
24
+ * IDE adapter (`adapter`). `none` is reserved for the "could not resolve
25
+ * any callerId" failure case.
26
+ */
27
+ export type CallerProjectionSource = 'env-flag' | 'adapter' | 'none';
28
+ /**
29
+ * Canonical typed error union for caller-id resolution failures. The
30
+ * adapter contract already throws `PEAKS_CALLER_NOT_RESOLVED` via the
31
+ * `code: 'PEAKS_CALLER_NOT_RESOLVED'` field on the thrown Error. The
32
+ * new union keeps the typed projection + the typed code so callers can
33
+ * branch on either.
34
+ */
35
+ export type CallerResolveErrorCode = 'PEAKS_CALLER_NOT_RESOLVED' | 'PEAKS_SESSION_NOT_BOUND';
36
+ /**
37
+ * Canonical caller projection returned by `resolveCallerId` in 4.0.8.
38
+ * Replaces the bare-string return shape so callers (and the statusline
39
+ * / hook consumers) can read `{ adapterId, callerId, workflowId, graphRef,
40
+ * source }` directly without re-reading the on-disk lease / index.
41
+ */
42
+ export interface CallerProjection {
43
+ /** Active adapter id (e.g. 'claude-code', 'trae'). */
44
+ readonly adapterId: string;
45
+ /** Resolved callerId (validated against CALLER_ID_REGEX). */
46
+ readonly callerId: string;
47
+ /** Workflow id the caller is bound to (from the per-(sid, caller) index). */
48
+ readonly workflowId: string | null;
49
+ /** graphRef the caller's lease points at, or null when no active lease. */
50
+ readonly graphRef: string | null;
51
+ /**
52
+ * Origin of the resolved callerId. `env-flag` = PEAKS_CALLER_ID
53
+ * override; `adapter` = active IDE adapter's resolveCallerId;
54
+ * `none` = resolution failed (PEAKS_CALLER_NOT_RESOLVED).
55
+ */
56
+ readonly source: CallerProjectionSource;
57
+ }
16
58
  /**
17
59
  * On-disk shape of `.peaks/_runtime/callers/<callerId>.json`. One file
18
60
  * per caller; two callers may point to the same `peakSessionId` (D6).
@@ -58,15 +100,22 @@ export interface CallerSkillPresence {
58
100
  */
59
101
  export declare const CALLER_ID_REGEX: RegExp;
60
102
  /**
61
- * Thrown by `resolveCallerId` for two cases:
103
+ * Thrown by `resolveCallerId` for two cases (legacy shape; preserved
104
+ * for back-compat with consumers that catch `CallerIdError`):
62
105
  *
63
106
  * - `code: 'EX_USAGE'` (exit 64, D2): no callerId available
64
- * anywhere (flag/env/fallback all empty).
107
+ * anywhere (flag/env/adapter all empty / not resolvable).
65
108
  * - `code: 'EX_DATAERR'` (exit 65, D5): resolved callerId does not
66
109
  * match D1's regex.
67
110
  *
111
+ * In 4.0.8 the adapter layer throws `PEAKS_CALLER_NOT_RESOLVED` first;
112
+ * the `CallerIdError` is rethrown with a synthesized message only when
113
+ * the env-flag path itself validates. New code should branch on
114
+ * `(err as Error & { code?: string }).code === 'PEAKS_CALLER_NOT_RESOLVED'`
115
+ * rather than the legacy `EX_USAGE` / `EX_DATAERR` codes.
116
+ *
68
117
  * The `source` field tells the user where the bad id came from
69
- * (`flag` / `env` / `fallback` / `none`) so the error message points
118
+ * (`flag` / `env` / `adapter` / `none`) so the error message points
70
119
  * at the right thing to fix.
71
120
  */
72
121
  export declare class CallerIdError extends Error {
@@ -1,16 +1,21 @@
1
1
  /**
2
- * Caller-Id Resolution types (slice 020 — caller-keyed session binding).
2
+ * Caller-Id Resolution types (slice 020 — caller-keyed session binding,
3
+ * refactored in slice 4.0.8 to be adapter-owned per RD §5).
3
4
  *
4
- * The single shared `.peaks/_runtime/session.json` and
5
- * `.peaks/_runtime/active-skill.json` files are replaced with per-caller
6
- * layouts: `.peaks/_runtime/callers/<callerId>.json` and
7
- * `.peaks/_runtime/<peakSid>/active-skill-<callerId>.json`. The
8
- * `callerId` is a generic identifier the calling platform declares
9
- * itself (Claude Code via `CLAUDE_CODE_SESSION_ID`, future platforms
10
- * via `PLATFORM_FALLBACKS`).
5
+ * Per RD §5 + C1 user-confirmed product decision (binding 2026-08-03):
6
+ * "Every caller resolution MUST go through the active IDE adapter. Anyone
7
+ * whose IDE is not detected by peaks adapter dispatch gets
8
+ * PEAKS_CALLER_NOT_RESOLVED. This is the desired product contract
9
+ * (vendor-neutral)."
11
10
  *
12
- * See `.peaks/_runtime/2026-06-09-session-8bfe7d/prd/source/caller-id-contract.md`
13
- * for the freeze-in contract (D1-D7 + M1-M5).
11
+ * As of 4.0.8 the per-platform `PLATFORM_FALLBACKS` table is DELETED. The
12
+ * legacy `CallerIdSource` (`'fallback' | 'flag' | 'env' | 'none'`) is
13
+ * preserved for back-compat with consumers that read the value, but the
14
+ * core resolution path only ever emits `'env-flag' | 'adapter' | 'none'`
15
+ * via the new `CallerProjection.source` field.
16
+ *
17
+ * See `.peaks/_runtime/2026-08-03-session-bee258/rd/requests/001-2026-08-03-presence-lease-graph-design.md`
18
+ * for the slice 4.0.8 contract.
14
19
  */
15
20
  /**
16
21
  * D1 callerId regex: ASCII letters, digits, dot, underscore, hyphen;
@@ -21,15 +26,22 @@
21
26
  */
22
27
  export const CALLER_ID_REGEX = /^[a-zA-Z0-9._-]{1,200}$/;
23
28
  /**
24
- * Thrown by `resolveCallerId` for two cases:
29
+ * Thrown by `resolveCallerId` for two cases (legacy shape; preserved
30
+ * for back-compat with consumers that catch `CallerIdError`):
25
31
  *
26
32
  * - `code: 'EX_USAGE'` (exit 64, D2): no callerId available
27
- * anywhere (flag/env/fallback all empty).
33
+ * anywhere (flag/env/adapter all empty / not resolvable).
28
34
  * - `code: 'EX_DATAERR'` (exit 65, D5): resolved callerId does not
29
35
  * match D1's regex.
30
36
  *
37
+ * In 4.0.8 the adapter layer throws `PEAKS_CALLER_NOT_RESOLVED` first;
38
+ * the `CallerIdError` is rethrown with a synthesized message only when
39
+ * the env-flag path itself validates. New code should branch on
40
+ * `(err as Error & { code?: string }).code === 'PEAKS_CALLER_NOT_RESOLVED'`
41
+ * rather than the legacy `EX_USAGE` / `EX_DATAERR` codes.
42
+ *
31
43
  * The `source` field tells the user where the bad id came from
32
- * (`flag` / `env` / `fallback` / `none`) so the error message points
44
+ * (`flag` / `env` / `adapter` / `none`) so the error message points
33
45
  * at the right thing to fix.
34
46
  */
35
47
  export class CallerIdError extends Error {
@@ -1,6 +1,8 @@
1
- export { ensureSession, getSessionId, getSessionIdCanonical, resolveActiveSessionId, getCurrentSessionDir, listSessions, getSessionMeta, setSessionMeta, setSessionTitle, listSessionMetas, getProjectScanPath, hasProjectScan, setCurrentSessionBinding, rotateSessionBinding, type SessionInfo, type SessionMeta } from './session-manager.js';
1
+ export { ensureSession, getSessionId, getCurrentSessionDir, listSessions, getSessionMeta, setSessionMeta, setSessionTitle, listSessionMetas, getProjectScanPath, hasProjectScan, setCurrentSessionBinding, rotateSessionBinding, type SessionInfo, type SessionMeta } from './session-manager.js';
2
2
  export { getSessionDir } from './getSessionDir.js';
3
- export { resolveCallerId, type ResolveCallerIdOptions } from './resolve-caller-id.js';
3
+ export { resolveCallerId, } from './resolve-caller-id.js';
4
4
  export { getCallerBindingFile, getActiveSkillFileForCaller, synthesiseLegacyCallerId, getCallerBinding, setCallerBinding, listCallerBindings } from './caller-binding-service.js';
5
5
  export { PLATFORM_FALLBACKS, type PlatformFallback } from './platform-fallbacks.js';
6
+ export { resolveCallerProjection, type ResolveCallerIdOptions } from './resolve-caller-id.js';
7
+ export { type CallerProjection, type CallerProjectionSource, type CallerResolveErrorCode } from './caller-id-types.js';
6
8
  export { CALLER_ID_REGEX, CallerIdError, type CallerBinding, type CallerSkillPresence, type CallerIdSource } from './caller-id-types.js';
@@ -1,7 +1,13 @@
1
- export { ensureSession, getSessionId, getSessionIdCanonical, resolveActiveSessionId, getCurrentSessionDir, listSessions, getSessionMeta, setSessionMeta, setSessionTitle, listSessionMetas, getProjectScanPath, hasProjectScan, setCurrentSessionBinding, rotateSessionBinding } from './session-manager.js';
1
+ export { ensureSession, getSessionId, getCurrentSessionDir, listSessions, getSessionMeta, setSessionMeta, setSessionTitle, listSessionMetas, getProjectScanPath, hasProjectScan, setCurrentSessionBinding, rotateSessionBinding } from './session-manager.js';
2
2
  export { getSessionDir } from './getSessionDir.js';
3
3
  // Slice 020 — caller-keyed session binding. The new canonical path.
4
- export { resolveCallerId } from './resolve-caller-id.js';
4
+ export { resolveCallerId, } from './resolve-caller-id.js';
5
5
  export { getCallerBindingFile, getActiveSkillFileForCaller, synthesiseLegacyCallerId, getCallerBinding, setCallerBinding, listCallerBindings } from './caller-binding-service.js';
6
+ // Slice 4.0.8 (C1): PLATFORM_FALLBACKS is deleted. Re-export kept as
7
+ // a deprecated alias for one minor release so legacy consumers keep
8
+ // type-checking; the array is empty and unused at runtime. New code
9
+ // should rely on the active IDE adapter's `resolveCallerId(env)`
10
+ // instead.
6
11
  export { PLATFORM_FALLBACKS } from './platform-fallbacks.js';
12
+ export { resolveCallerProjection } from './resolve-caller-id.js';
7
13
  export { CALLER_ID_REGEX, CallerIdError } from './caller-id-types.js';