@soleri/core 9.2.0 → 9.3.0

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 (298) hide show
  1. package/data/flows/build.flow.yaml +8 -9
  2. package/data/flows/deliver.flow.yaml +9 -10
  3. package/data/flows/design.flow.yaml +3 -4
  4. package/data/flows/enhance.flow.yaml +5 -6
  5. package/data/flows/explore.flow.yaml +3 -4
  6. package/data/flows/fix.flow.yaml +5 -6
  7. package/data/flows/plan.flow.yaml +4 -5
  8. package/data/flows/review.flow.yaml +3 -4
  9. package/dist/curator/curator.d.ts.map +1 -1
  10. package/dist/curator/curator.js +98 -22
  11. package/dist/curator/curator.js.map +1 -1
  12. package/dist/engine/bin/soleri-engine.js.map +1 -1
  13. package/dist/engine/module-manifest.d.ts.map +1 -1
  14. package/dist/engine/module-manifest.js +21 -1
  15. package/dist/engine/module-manifest.js.map +1 -1
  16. package/dist/engine/register-engine.d.ts.map +1 -1
  17. package/dist/engine/register-engine.js +25 -1
  18. package/dist/engine/register-engine.js.map +1 -1
  19. package/dist/flows/gate-evaluator.js.map +1 -1
  20. package/dist/operator/operator-profile.d.ts.map +1 -1
  21. package/dist/operator/operator-profile.js +11 -5
  22. package/dist/operator/operator-profile.js.map +1 -1
  23. package/dist/operator/operator-signals.d.ts.map +1 -1
  24. package/dist/operator/operator-signals.js.map +1 -1
  25. package/dist/planning/evidence-collector.js.map +1 -1
  26. package/dist/planning/gap-passes.d.ts.map +1 -1
  27. package/dist/planning/gap-passes.js +23 -6
  28. package/dist/planning/gap-passes.js.map +1 -1
  29. package/dist/planning/gap-patterns.d.ts.map +1 -1
  30. package/dist/planning/gap-patterns.js +57 -11
  31. package/dist/planning/gap-patterns.js.map +1 -1
  32. package/dist/planning/github-projection.d.ts.map +1 -1
  33. package/dist/planning/github-projection.js +39 -20
  34. package/dist/planning/github-projection.js.map +1 -1
  35. package/dist/planning/impact-analyzer.d.ts.map +1 -1
  36. package/dist/planning/impact-analyzer.js +20 -18
  37. package/dist/planning/impact-analyzer.js.map +1 -1
  38. package/dist/planning/plan-lifecycle.d.ts.map +1 -1
  39. package/dist/planning/plan-lifecycle.js +22 -9
  40. package/dist/planning/plan-lifecycle.js.map +1 -1
  41. package/dist/planning/planner.d.ts.map +1 -1
  42. package/dist/planning/planner.js +60 -17
  43. package/dist/planning/planner.js.map +1 -1
  44. package/dist/planning/rationalization-detector.d.ts.map +1 -1
  45. package/dist/planning/rationalization-detector.js.map +1 -1
  46. package/dist/planning/reconciliation-engine.d.ts.map +1 -1
  47. package/dist/planning/reconciliation-engine.js.map +1 -1
  48. package/dist/planning/task-verifier.d.ts.map +1 -1
  49. package/dist/planning/task-verifier.js +14 -6
  50. package/dist/planning/task-verifier.js.map +1 -1
  51. package/dist/runtime/admin-setup-ops.d.ts.map +1 -1
  52. package/dist/runtime/admin-setup-ops.js +2 -1
  53. package/dist/runtime/admin-setup-ops.js.map +1 -1
  54. package/dist/runtime/branching-ops.d.ts +12 -0
  55. package/dist/runtime/branching-ops.d.ts.map +1 -0
  56. package/dist/runtime/branching-ops.js +100 -0
  57. package/dist/runtime/branching-ops.js.map +1 -0
  58. package/dist/runtime/context-health.d.ts.map +1 -1
  59. package/dist/runtime/context-health.js.map +1 -1
  60. package/dist/runtime/facades/branching-facade.d.ts +7 -0
  61. package/dist/runtime/facades/branching-facade.d.ts.map +1 -0
  62. package/dist/runtime/facades/branching-facade.js +8 -0
  63. package/dist/runtime/facades/branching-facade.js.map +1 -0
  64. package/dist/runtime/facades/chat-service-ops.d.ts.map +1 -1
  65. package/dist/runtime/facades/chat-service-ops.js +3 -1
  66. package/dist/runtime/facades/chat-service-ops.js.map +1 -1
  67. package/dist/runtime/facades/chat-transport-ops.d.ts.map +1 -1
  68. package/dist/runtime/facades/chat-transport-ops.js.map +1 -1
  69. package/dist/runtime/facades/index.d.ts.map +1 -1
  70. package/dist/runtime/facades/index.js +42 -0
  71. package/dist/runtime/facades/index.js.map +1 -1
  72. package/dist/runtime/facades/intake-facade.d.ts +9 -0
  73. package/dist/runtime/facades/intake-facade.d.ts.map +1 -0
  74. package/dist/runtime/facades/intake-facade.js +11 -0
  75. package/dist/runtime/facades/intake-facade.js.map +1 -0
  76. package/dist/runtime/facades/links-facade.d.ts +9 -0
  77. package/dist/runtime/facades/links-facade.d.ts.map +1 -0
  78. package/dist/runtime/facades/links-facade.js +10 -0
  79. package/dist/runtime/facades/links-facade.js.map +1 -0
  80. package/dist/runtime/facades/operator-facade.d.ts.map +1 -1
  81. package/dist/runtime/facades/operator-facade.js.map +1 -1
  82. package/dist/runtime/facades/plan-facade.d.ts.map +1 -1
  83. package/dist/runtime/facades/plan-facade.js +4 -1
  84. package/dist/runtime/facades/plan-facade.js.map +1 -1
  85. package/dist/runtime/facades/tier-facade.d.ts +7 -0
  86. package/dist/runtime/facades/tier-facade.d.ts.map +1 -0
  87. package/dist/runtime/facades/tier-facade.js +8 -0
  88. package/dist/runtime/facades/tier-facade.js.map +1 -0
  89. package/dist/runtime/facades/vault-facade.d.ts +9 -1
  90. package/dist/runtime/facades/vault-facade.d.ts.map +1 -1
  91. package/dist/runtime/facades/vault-facade.js +44 -187
  92. package/dist/runtime/facades/vault-facade.js.map +1 -1
  93. package/dist/runtime/github-integration.d.ts.map +1 -1
  94. package/dist/runtime/github-integration.js +11 -4
  95. package/dist/runtime/github-integration.js.map +1 -1
  96. package/dist/runtime/orchestrate-ops.d.ts.map +1 -1
  97. package/dist/runtime/orchestrate-ops.js +32 -10
  98. package/dist/runtime/orchestrate-ops.js.map +1 -1
  99. package/dist/runtime/planning-extra-ops.d.ts.map +1 -1
  100. package/dist/runtime/planning-extra-ops.js.map +1 -1
  101. package/dist/runtime/runtime.d.ts.map +1 -1
  102. package/dist/runtime/runtime.js +3 -1
  103. package/dist/runtime/runtime.js.map +1 -1
  104. package/dist/runtime/session-briefing.d.ts.map +1 -1
  105. package/dist/runtime/session-briefing.js +5 -1
  106. package/dist/runtime/session-briefing.js.map +1 -1
  107. package/dist/runtime/tier-ops.d.ts +13 -0
  108. package/dist/runtime/tier-ops.d.ts.map +1 -0
  109. package/dist/runtime/tier-ops.js +110 -0
  110. package/dist/runtime/tier-ops.js.map +1 -0
  111. package/dist/skills/sync-skills.d.ts.map +1 -1
  112. package/dist/skills/sync-skills.js +1 -1
  113. package/dist/skills/sync-skills.js.map +1 -1
  114. package/dist/vault/linking.d.ts.map +1 -1
  115. package/dist/vault/linking.js +41 -5
  116. package/dist/vault/linking.js.map +1 -1
  117. package/dist/vault/vault-entries.d.ts.map +1 -1
  118. package/dist/vault/vault-entries.js +68 -26
  119. package/dist/vault/vault-entries.js.map +1 -1
  120. package/dist/vault/vault-maintenance.d.ts.map +1 -1
  121. package/dist/vault/vault-maintenance.js +6 -2
  122. package/dist/vault/vault-maintenance.js.map +1 -1
  123. package/dist/vault/vault-markdown-sync.d.ts.map +1 -1
  124. package/dist/vault/vault-markdown-sync.js.map +1 -1
  125. package/dist/vault/vault-memories.d.ts.map +1 -1
  126. package/dist/vault/vault-memories.js +3 -1
  127. package/dist/vault/vault-memories.js.map +1 -1
  128. package/dist/vault/vault-schema.js +36 -10
  129. package/dist/vault/vault-schema.js.map +1 -1
  130. package/dist/vault/vault.d.ts.map +1 -1
  131. package/dist/vault/vault.js +5 -1
  132. package/dist/vault/vault.js.map +1 -1
  133. package/package.json +7 -7
  134. package/src/agency/agency-manager.test.ts +60 -40
  135. package/src/agency/default-rules.test.ts +17 -9
  136. package/src/capabilities/registry.test.ts +2 -12
  137. package/src/chat/agent-loop.test.ts +33 -43
  138. package/src/chat/mcp-bridge.test.ts +7 -2
  139. package/src/claudemd/inject.test.ts +2 -12
  140. package/src/context/context-engine.test.ts +96 -51
  141. package/src/control/intent-router.test.ts +3 -3
  142. package/src/curator/classifier.test.ts +14 -8
  143. package/src/curator/contradiction-detector.test.ts +30 -5
  144. package/src/curator/curator.ts +278 -56
  145. package/src/curator/duplicate-detector.test.ts +77 -15
  146. package/src/curator/quality-gate.test.ts +71 -31
  147. package/src/curator/tag-manager.test.ts +12 -4
  148. package/src/domain-packs/knowledge-installer.test.ts +2 -10
  149. package/src/domain-packs/token-resolver.test.ts +1 -3
  150. package/src/domain-packs/types.test.ts +16 -2
  151. package/src/enforcement/registry.test.ts +2 -8
  152. package/src/engine/bin/soleri-engine.ts +3 -1
  153. package/src/engine/module-manifest.test.ts +5 -4
  154. package/src/engine/module-manifest.ts +21 -1
  155. package/src/engine/register-engine.test.ts +6 -1
  156. package/src/engine/register-engine.ts +26 -3
  157. package/src/errors/classify.test.ts +6 -2
  158. package/src/errors/retry.test.ts +1 -4
  159. package/src/facades/facade-factory.test.ts +110 -64
  160. package/src/flows/epilogue.test.ts +16 -10
  161. package/src/flows/gate-evaluator.test.ts +12 -6
  162. package/src/flows/gate-evaluator.ts +1 -3
  163. package/src/governance/governance.test.ts +137 -21
  164. package/src/health/health-registry.test.ts +8 -1
  165. package/src/intake/content-classifier.test.ts +121 -51
  166. package/src/intake/dedup-gate.test.ts +38 -22
  167. package/src/intake/intake-pipeline.test.ts +5 -3
  168. package/src/intake/text-ingester.test.ts +26 -20
  169. package/src/llm/key-pool.test.ts +1 -3
  170. package/src/llm/llm-client.test.ts +1 -4
  171. package/src/llm/oauth-discovery.test.ts +16 -16
  172. package/src/llm/utils.test.ts +62 -18
  173. package/src/logging/logger.test.ts +4 -1
  174. package/src/loop/loop-manager.test.ts +2 -6
  175. package/src/migrations/migration-runner.edge-cases.test.ts +2 -7
  176. package/src/operator/operator-profile-extended.test.ts +15 -5
  177. package/src/operator/operator-profile.test.ts +26 -8
  178. package/src/operator/operator-profile.ts +38 -22
  179. package/src/operator/operator-signals-extended.test.ts +35 -23
  180. package/src/operator/operator-signals.test.ts +6 -10
  181. package/src/operator/operator-signals.ts +2 -1
  182. package/src/operator/prompts/hook-precompact-operator-dispatch.md +10 -6
  183. package/src/operator/prompts/subagent-soft-signal-extractor.md +5 -0
  184. package/src/operator/prompts/subagent-synthesis-cognition.md +19 -10
  185. package/src/operator/prompts/subagent-synthesis-communication.md +13 -7
  186. package/src/operator/prompts/subagent-synthesis-technical.md +19 -9
  187. package/src/operator/prompts/subagent-synthesis-trust.md +27 -21
  188. package/src/persona/defaults.test.ts +1 -5
  189. package/src/planning/evidence-collector.test.ts +147 -38
  190. package/src/planning/evidence-collector.ts +1 -4
  191. package/src/planning/gap-analysis-alternatives.test.ts +41 -11
  192. package/src/planning/gap-passes.test.ts +215 -33
  193. package/src/planning/gap-passes.ts +115 -46
  194. package/src/planning/gap-patterns.test.ts +87 -13
  195. package/src/planning/gap-patterns.ts +114 -31
  196. package/src/planning/github-projection.test.ts +6 -1
  197. package/src/planning/github-projection.ts +41 -20
  198. package/src/planning/impact-analyzer.test.ts +10 -23
  199. package/src/planning/impact-analyzer.ts +33 -46
  200. package/src/planning/plan-lifecycle.test.ts +103 -36
  201. package/src/planning/plan-lifecycle.ts +49 -18
  202. package/src/planning/planner.test.ts +12 -2
  203. package/src/planning/planner.ts +198 -58
  204. package/src/planning/rationalization-detector.test.ts +5 -20
  205. package/src/planning/rationalization-detector.ts +14 -16
  206. package/src/planning/reconciliation-engine.test.ts +20 -3
  207. package/src/planning/reconciliation-engine.ts +1 -2
  208. package/src/planning/task-verifier.test.ts +59 -27
  209. package/src/planning/task-verifier.ts +15 -9
  210. package/src/playbooks/playbook-executor.test.ts +1 -3
  211. package/src/plugins/plugin-loader.test.ts +19 -14
  212. package/src/plugins/plugin-registry.test.ts +45 -33
  213. package/src/project/project-registry.test.ts +23 -12
  214. package/src/prompts/template-manager.test.ts +4 -1
  215. package/src/queue/job-queue.test.ts +10 -14
  216. package/src/runtime/admin-extra-ops.test.ts +5 -19
  217. package/src/runtime/admin-ops.test.ts +1 -3
  218. package/src/runtime/admin-setup-ops.test.ts +3 -4
  219. package/src/runtime/admin-setup-ops.ts +9 -2
  220. package/src/runtime/archive-ops.test.ts +4 -1
  221. package/src/runtime/branching-ops.test.ts +144 -0
  222. package/src/runtime/branching-ops.ts +107 -0
  223. package/src/runtime/capture-ops.test.ts +7 -21
  224. package/src/runtime/chain-ops.test.ts +16 -6
  225. package/src/runtime/claude-md-helpers.test.ts +1 -3
  226. package/src/runtime/context-health.test.ts +1 -3
  227. package/src/runtime/context-health.ts +1 -3
  228. package/src/runtime/curator-extra-ops.test.ts +3 -1
  229. package/src/runtime/domain-ops.test.ts +46 -36
  230. package/src/runtime/facades/admin-facade.test.ts +1 -4
  231. package/src/runtime/facades/archive-facade.test.ts +21 -7
  232. package/src/runtime/facades/brain-facade.test.ts +176 -72
  233. package/src/runtime/facades/branching-facade.test.ts +43 -0
  234. package/src/runtime/facades/branching-facade.ts +11 -0
  235. package/src/runtime/facades/chat-facade.test.ts +81 -28
  236. package/src/runtime/facades/chat-service-ops.test.ts +178 -73
  237. package/src/runtime/facades/chat-service-ops.ts +3 -1
  238. package/src/runtime/facades/chat-session-ops.test.ts +25 -10
  239. package/src/runtime/facades/chat-transport-ops.test.ts +101 -34
  240. package/src/runtime/facades/chat-transport-ops.ts +0 -1
  241. package/src/runtime/facades/context-facade.test.ts +19 -4
  242. package/src/runtime/facades/control-facade.test.ts +3 -3
  243. package/src/runtime/facades/index.ts +42 -0
  244. package/src/runtime/facades/intake-facade.test.ts +215 -0
  245. package/src/runtime/facades/intake-facade.ts +14 -0
  246. package/src/runtime/facades/links-facade.test.ts +203 -0
  247. package/src/runtime/facades/links-facade.ts +13 -0
  248. package/src/runtime/facades/loop-facade.test.ts +22 -5
  249. package/src/runtime/facades/memory-facade.test.ts +19 -5
  250. package/src/runtime/facades/operator-facade.test.ts +17 -4
  251. package/src/runtime/facades/operator-facade.ts +11 -3
  252. package/src/runtime/facades/orchestrate-facade.test.ts +7 -1
  253. package/src/runtime/facades/plan-facade.test.ts +29 -12
  254. package/src/runtime/facades/plan-facade.ts +7 -2
  255. package/src/runtime/facades/tier-facade.test.ts +47 -0
  256. package/src/runtime/facades/tier-facade.ts +11 -0
  257. package/src/runtime/facades/vault-facade.test.ts +174 -242
  258. package/src/runtime/facades/vault-facade.ts +55 -199
  259. package/src/runtime/github-integration.ts +11 -8
  260. package/src/runtime/grading-ops.test.ts +39 -8
  261. package/src/runtime/intake-ops.test.ts +69 -16
  262. package/src/runtime/loop-ops.test.ts +16 -6
  263. package/src/runtime/memory-cross-project-ops.test.ts +25 -14
  264. package/src/runtime/orchestrate-ops.ts +54 -27
  265. package/src/runtime/pack-ops.test.ts +23 -6
  266. package/src/runtime/planning-extra-ops.test.ts +17 -7
  267. package/src/runtime/planning-extra-ops.ts +3 -1
  268. package/src/runtime/playbook-ops.test.ts +26 -3
  269. package/src/runtime/plugin-ops.test.ts +83 -25
  270. package/src/runtime/project-ops.test.ts +26 -6
  271. package/src/runtime/runtime.ts +3 -1
  272. package/src/runtime/session-briefing.test.ts +183 -54
  273. package/src/runtime/session-briefing.ts +8 -2
  274. package/src/runtime/sync-ops.test.ts +3 -12
  275. package/src/runtime/telemetry-ops.test.ts +31 -6
  276. package/src/runtime/tier-ops.test.ts +159 -0
  277. package/src/runtime/tier-ops.ts +119 -0
  278. package/src/runtime/vault-extra-ops.test.ts +32 -8
  279. package/src/runtime/vault-sharing-ops.test.ts +1 -4
  280. package/src/skills/sync-skills.ts +2 -12
  281. package/src/transport/ws-server.test.ts +7 -4
  282. package/src/vault/__tests__/vault-characterization.test.ts +492 -81
  283. package/src/vault/linking.test.ts +50 -17
  284. package/src/vault/linking.ts +48 -7
  285. package/src/vault/obsidian-sync.test.ts +6 -3
  286. package/src/vault/scope-detector.test.ts +1 -3
  287. package/src/vault/vault-branching.test.ts +9 -7
  288. package/src/vault/vault-entries.ts +209 -65
  289. package/src/vault/vault-maintenance.ts +7 -12
  290. package/src/vault/vault-manager.test.ts +10 -10
  291. package/src/vault/vault-markdown-sync.ts +4 -1
  292. package/src/vault/vault-memories.ts +7 -7
  293. package/src/vault/vault-schema.ts +72 -15
  294. package/src/vault/vault.ts +55 -9
  295. package/src/brain/strength-scorer.ts +0 -404
  296. package/src/engine/index.ts +0 -21
  297. package/src/persona/index.ts +0 -9
  298. package/src/vault/vault-interfaces.ts +0 -56
@@ -10,7 +10,10 @@ import type { AgentRuntime } from './types.js';
10
10
  /** Minimal in-memory project registry stub. */
11
11
  function makeProjectRegistryStub() {
12
12
  const projects = new Map<string, { id: string; name: string; lastAccessed: number }>();
13
- const rules = new Map<string, Array<{ id: string; category: string; text: string; priority: number }>>();
13
+ const rules = new Map<
14
+ string,
15
+ Array<{ id: string; category: string; text: string; priority: number }>
16
+ >();
14
17
  const links: Array<{ sourceId: string; targetId: string; linkType: string }> = [];
15
18
  let ruleCounter = 0;
16
19
 
@@ -39,7 +42,10 @@ function makeProjectRegistryStub() {
39
42
  removeRule: (ruleId: string) => {
40
43
  for (const [, arr] of rules) {
41
44
  const idx = arr.findIndex((r) => r.id === ruleId);
42
- if (idx >= 0) { arr.splice(idx, 1); return true; }
45
+ if (idx >= 0) {
46
+ arr.splice(idx, 1);
47
+ return true;
48
+ }
43
49
  }
44
50
  return false;
45
51
  },
@@ -52,14 +58,19 @@ function makeProjectRegistryStub() {
52
58
  let count = 0;
53
59
  for (let i = links.length - 1; i >= 0; i--) {
54
60
  const l = links[i];
55
- if (l.sourceId === sourceId && l.targetId === targetId && (!linkType || l.linkType === linkType)) {
61
+ if (
62
+ l.sourceId === sourceId &&
63
+ l.targetId === targetId &&
64
+ (!linkType || l.linkType === linkType)
65
+ ) {
56
66
  links.splice(i, 1);
57
67
  count++;
58
68
  }
59
69
  }
60
70
  return count;
61
71
  },
62
- getLinks: (projectId: string) => links.filter((l) => l.sourceId === projectId || l.targetId === projectId),
72
+ getLinks: (projectId: string) =>
73
+ links.filter((l) => l.sourceId === projectId || l.targetId === projectId),
63
74
  getLinkedProjects: (projectId: string) => {
64
75
  return links
65
76
  .filter((l) => l.sourceId === projectId || l.targetId === projectId)
@@ -181,7 +192,12 @@ describe('project-ops', () => {
181
192
  const { ops, registry } = setup();
182
193
  registry._seed('a', 'A');
183
194
  registry._seed('b', 'B');
184
- await executeOp(ops, 'project_add_rule', { projectId: 'a', category: 'behavior', text: 'r1', priority: 0 });
195
+ await executeOp(ops, 'project_add_rule', {
196
+ projectId: 'a',
197
+ category: 'behavior',
198
+ text: 'r1',
199
+ priority: 0,
200
+ });
185
201
 
186
202
  const res = await executeOp(ops, 'project_list_rules');
187
203
  const data = res.data as { count: number; projects: Array<{ ruleCount: number }> };
@@ -207,7 +223,11 @@ describe('project-ops', () => {
207
223
  registry._seed('b', 'B');
208
224
  await executeOp(ops, 'project_link', { sourceId: 'a', targetId: 'b', linkType: 'parent' });
209
225
 
210
- const res = await executeOp(ops, 'project_unlink', { sourceId: 'a', targetId: 'b', linkType: 'parent' });
226
+ const res = await executeOp(ops, 'project_unlink', {
227
+ sourceId: 'a',
228
+ targetId: 'b',
229
+ linkType: 'parent',
230
+ });
211
231
  expect((res.data as { removed: number }).removed).toBe(1);
212
232
  });
213
233
 
@@ -210,7 +210,9 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
210
210
  logger.info(`Markdown sync: ${result.synced} entries synced, ${result.skipped} skipped`);
211
211
  }
212
212
  },
213
- () => { /* best-effort — never block boot */ },
213
+ () => {
214
+ /* best-effort — never block boot */
215
+ },
214
216
  );
215
217
 
216
218
  // ─── Auto-signal pipeline wiring ───────────────────────────────────
@@ -10,8 +10,19 @@ import type { OperatorProfile } from '../operator/operator-types.js';
10
10
 
11
11
  function makeRuntime(overrides?: {
12
12
  vaultStats?: { totalEntries: number; byType?: Record<string, number> };
13
- sessions?: Array<{ endedAt: string | null; domain: string | null; context: string | null; toolsUsed: string[]; filesModified: string[] }>;
14
- plans?: Array<{ id: string; status: string; objective?: string; tasks: Array<{ status: string }> }>;
13
+ sessions?: Array<{
14
+ endedAt: string | null;
15
+ domain: string | null;
16
+ context: string | null;
17
+ toolsUsed: string[];
18
+ filesModified: string[];
19
+ }>;
20
+ plans?: Array<{
21
+ id: string;
22
+ status: string;
23
+ objective?: string;
24
+ tasks: Array<{ status: string }>;
25
+ }>;
15
26
  recentEntries?: Array<{ title: string }>;
16
27
  recommendations?: Array<{ pattern: string; strength: number }>;
17
28
  proposals?: Array<{ title: string; confidence: number; type: string; promoted: boolean }>;
@@ -54,7 +65,11 @@ describe('session-briefing', () => {
54
65
  const res = await executeOp(ops, 'session_briefing', {});
55
66
 
56
67
  expect(res.success).toBe(true);
57
- const data = res.data as { sections: Array<{ label: string }>; generatedAt: number; dataPointsConsulted: number };
68
+ const data = res.data as {
69
+ sections: Array<{ label: string }>;
70
+ generatedAt: number;
71
+ dataPointsConsulted: number;
72
+ };
58
73
  expect(data.generatedAt).toBeGreaterThan(0);
59
74
  expect(Array.isArray(data.sections)).toBe(true);
60
75
  });
@@ -81,13 +96,15 @@ describe('session-briefing', () => {
81
96
 
82
97
  it('includes Last session section', async () => {
83
98
  const runtime = makeRuntime({
84
- sessions: [{
85
- endedAt: new Date(Date.now() - 3600000).toISOString(),
86
- domain: 'frontend',
87
- context: 'Refactored button component',
88
- toolsUsed: ['vault_search', 'brain_recommend'],
89
- filesModified: ['src/button.tsx'],
90
- }],
99
+ sessions: [
100
+ {
101
+ endedAt: new Date(Date.now() - 3600000).toISOString(),
102
+ domain: 'frontend',
103
+ context: 'Refactored button component',
104
+ toolsUsed: ['vault_search', 'brain_recommend'],
105
+ filesModified: ['src/button.tsx'],
106
+ },
107
+ ],
91
108
  });
92
109
  const ops = captureOps(createSessionBriefingOps(runtime));
93
110
  const res = await executeOp(ops, 'session_briefing', {});
@@ -102,7 +119,12 @@ describe('session-briefing', () => {
102
119
  it('includes Active plans section', async () => {
103
120
  const runtime = makeRuntime({
104
121
  plans: [
105
- { id: 'p1', status: 'executing', objective: 'Build dashboard', tasks: [{ status: 'completed' }, { status: 'pending' }] },
122
+ {
123
+ id: 'p1',
124
+ status: 'executing',
125
+ objective: 'Build dashboard',
126
+ tasks: [{ status: 'completed' }, { status: 'pending' }],
127
+ },
106
128
  { id: 'p2', status: 'completed', objective: 'Done', tasks: [] },
107
129
  ],
108
130
  });
@@ -110,7 +132,9 @@ describe('session-briefing', () => {
110
132
  const res = await executeOp(ops, 'session_briefing', {});
111
133
 
112
134
  const data = res.data as { sections: Array<{ label: string; content: string }> };
113
- const plans = data.sections.find((s) => s.label === 'Active plan' || s.label.startsWith('Active plans'));
135
+ const plans = data.sections.find(
136
+ (s) => s.label === 'Active plan' || s.label.startsWith('Active plans'),
137
+ );
114
138
  expect(plans).toBeDefined();
115
139
  expect(plans!.content).toContain('Build dashboard');
116
140
  expect(plans!.content).toContain('1/2 tasks');
@@ -162,7 +186,15 @@ describe('session-briefing', () => {
162
186
  it('respects maxSections limit', async () => {
163
187
  const runtime = makeRuntime({
164
188
  vaultStats: { totalEntries: 2, byType: {} },
165
- sessions: [{ endedAt: new Date().toISOString(), domain: 'd', context: 'c', toolsUsed: ['t'], filesModified: ['f'] }],
189
+ sessions: [
190
+ {
191
+ endedAt: new Date().toISOString(),
192
+ domain: 'd',
193
+ context: 'c',
194
+ toolsUsed: ['t'],
195
+ filesModified: ['f'],
196
+ },
197
+ ],
166
198
  plans: [{ id: 'p', status: 'executing', objective: 'o', tasks: [] }],
167
199
  recentEntries: [{ title: 't' }],
168
200
  recommendations: [{ pattern: 'p', strength: 0.9 }],
@@ -179,17 +211,39 @@ describe('session-briefing', () => {
179
211
  it('gracefully handles subsystem errors', async () => {
180
212
  const runtime = {
181
213
  brainIntelligence: {
182
- listSessions: () => { throw new Error('DB closed'); },
183
- recommend: () => { throw new Error('DB closed'); },
184
- getProposals: () => { throw new Error('DB closed'); },
214
+ listSessions: () => {
215
+ throw new Error('DB closed');
216
+ },
217
+ recommend: () => {
218
+ throw new Error('DB closed');
219
+ },
220
+ getProposals: () => {
221
+ throw new Error('DB closed');
222
+ },
223
+ },
224
+ planner: {
225
+ list: () => {
226
+ throw new Error('no plans');
227
+ },
185
228
  },
186
- planner: { list: () => { throw new Error('no plans'); } },
187
229
  vault: {
188
- stats: () => { throw new Error('no vault'); },
189
- getRecent: () => { throw new Error('no vault'); },
230
+ stats: () => {
231
+ throw new Error('no vault');
232
+ },
233
+ getRecent: () => {
234
+ throw new Error('no vault');
235
+ },
236
+ },
237
+ curator: {
238
+ healthAudit: () => {
239
+ throw new Error('no curator');
240
+ },
241
+ },
242
+ operatorProfile: {
243
+ getProfile: () => {
244
+ throw new Error('no profile');
245
+ },
190
246
  },
191
- curator: { healthAudit: () => { throw new Error('no curator'); } },
192
- operatorProfile: { getProfile: () => { throw new Error('no profile'); } },
193
247
  } as unknown as AgentRuntime;
194
248
 
195
249
  const ops = captureOps(createSessionBriefingOps(runtime));
@@ -202,7 +256,12 @@ describe('session-briefing', () => {
202
256
  it('includes Pending proposals when present', async () => {
203
257
  const runtime = makeRuntime({
204
258
  proposals: [
205
- { title: 'Use TDD for all new features', confidence: 0.8, type: 'pattern', promoted: false },
259
+ {
260
+ title: 'Use TDD for all new features',
261
+ confidence: 0.8,
262
+ type: 'pattern',
263
+ promoted: false,
264
+ },
206
265
  { title: 'Low confidence', confidence: 0.2, type: 'anti-pattern', promoted: false },
207
266
  ],
208
267
  });
@@ -225,13 +284,36 @@ describe('session-briefing', () => {
225
284
  operatorId: 'op',
226
285
  version: 1,
227
286
  identity: { name: null, timezone: null, locale: null, personalDetails: [] },
228
- cognition: { learningStyle: 'visual', decisionStyle: 'analytical', abstractionPreference: 0.5, detailOrientation: 0.5, attentionPatterns: [] },
229
- communication: { style: 'mixed', formality: 0.5, verbosity: 0.5, preferredFormats: [], reactionPatterns: [] },
287
+ cognition: {
288
+ learningStyle: 'visual',
289
+ decisionStyle: 'analytical',
290
+ abstractionPreference: 0.5,
291
+ detailOrientation: 0.5,
292
+ attentionPatterns: [],
293
+ },
294
+ communication: {
295
+ style: 'mixed',
296
+ formality: 0.5,
297
+ verbosity: 0.5,
298
+ preferredFormats: [],
299
+ reactionPatterns: [],
300
+ },
230
301
  workingRules: { rules: [], inferredPriorities: [] },
231
- trustModel: { level: 'new', currentLevel: 0.5, challengeThreshold: 0.5, autonomyGrants: [], corrections: [] },
302
+ trustModel: {
303
+ level: 'new',
304
+ currentLevel: 0.5,
305
+ challengeThreshold: 0.5,
306
+ autonomyGrants: [],
307
+ corrections: [],
308
+ },
232
309
  tasteProfile: { aestheticPreferences: [], toolPreferences: [], workflowPreferences: [] },
233
310
  growthEdges: { observed: [], selfReported: [], progressNotes: [] },
234
- technicalContext: { primaryLanguages: [], frameworks: [], expertiseLevels: [], environmentDetails: [] },
311
+ technicalContext: {
312
+ primaryLanguages: [],
313
+ frameworks: [],
314
+ expertiseLevels: [],
315
+ environmentDetails: [],
316
+ },
235
317
  sessionCount: 0,
236
318
  lastSynthesis: null,
237
319
  createdAt: new Date().toISOString(),
@@ -246,56 +328,103 @@ describe('session-briefing', () => {
246
328
  });
247
329
 
248
330
  it('includes communication style when not mixed', () => {
249
- const result = buildAdaptationSummary(makeProfile({
250
- communication: { style: 'terse', formality: 0.8, verbosity: 0.3, preferredFormats: [], reactionPatterns: [] },
251
- }));
331
+ const result = buildAdaptationSummary(
332
+ makeProfile({
333
+ communication: {
334
+ style: 'terse',
335
+ formality: 0.8,
336
+ verbosity: 0.3,
337
+ preferredFormats: [],
338
+ reactionPatterns: [],
339
+ },
340
+ }),
341
+ );
252
342
  expect(result).toContain('Communication: terse, formal');
253
343
  });
254
344
 
255
345
  it('includes trust level when not new', () => {
256
- const result = buildAdaptationSummary(makeProfile({
257
- trustModel: { level: 'established', currentLevel: 0.8, challengeThreshold: 0.5, autonomyGrants: [], corrections: [] },
258
- }));
346
+ const result = buildAdaptationSummary(
347
+ makeProfile({
348
+ trustModel: {
349
+ level: 'established',
350
+ currentLevel: 0.8,
351
+ challengeThreshold: 0.5,
352
+ autonomyGrants: [],
353
+ corrections: [],
354
+ },
355
+ }),
356
+ );
259
357
  expect(result).toContain('Trust: established');
260
358
  expect(result).toContain('high autonomy');
261
359
  });
262
360
 
263
361
  it('includes working rules as priorities', () => {
264
- const result = buildAdaptationSummary(makeProfile({
265
- workingRules: {
266
- rules: [
267
- { rule: 'Always write tests first', source: 'observed', confidence: 0.9, addedAt: '' },
268
- { rule: 'Prefer small PRs', source: 'observed', confidence: 0.8, addedAt: '' },
269
- ],
270
- inferredPriorities: [],
271
- },
272
- }));
362
+ const result = buildAdaptationSummary(
363
+ makeProfile({
364
+ workingRules: {
365
+ rules: [
366
+ {
367
+ rule: 'Always write tests first',
368
+ source: 'observed',
369
+ confidence: 0.9,
370
+ addedAt: '',
371
+ },
372
+ { rule: 'Prefer small PRs', source: 'observed', confidence: 0.8, addedAt: '' },
373
+ ],
374
+ inferredPriorities: [],
375
+ },
376
+ }),
377
+ );
273
378
  expect(result).toContain('Priorities:');
274
379
  expect(result).toContain('Always write tests first');
275
380
  });
276
381
 
277
382
  it('includes growth edges', () => {
278
- const result = buildAdaptationSummary(makeProfile({
279
- growthEdges: {
280
- observed: [{ area: 'TypeScript generics', evidence: 'struggled with mapped types', observedAt: '' }],
281
- selfReported: [],
282
- progressNotes: [],
283
- },
284
- }));
383
+ const result = buildAdaptationSummary(
384
+ makeProfile({
385
+ growthEdges: {
386
+ observed: [
387
+ {
388
+ area: 'TypeScript generics',
389
+ evidence: 'struggled with mapped types',
390
+ observedAt: '',
391
+ },
392
+ ],
393
+ selfReported: [],
394
+ progressNotes: [],
395
+ },
396
+ }),
397
+ );
285
398
  expect(result).toContain('Growth edges: TypeScript generics');
286
399
  });
287
400
 
288
401
  it('shows casual for low formality', () => {
289
- const result = buildAdaptationSummary(makeProfile({
290
- communication: { style: 'conversational', formality: 0.2, verbosity: 0.5, preferredFormats: [], reactionPatterns: [] },
291
- }));
402
+ const result = buildAdaptationSummary(
403
+ makeProfile({
404
+ communication: {
405
+ style: 'conversational',
406
+ formality: 0.2,
407
+ verbosity: 0.5,
408
+ preferredFormats: [],
409
+ reactionPatterns: [],
410
+ },
411
+ }),
412
+ );
292
413
  expect(result).toContain('casual');
293
414
  });
294
415
 
295
416
  it('shows check before acting for low trust level', () => {
296
- const result = buildAdaptationSummary(makeProfile({
297
- trustModel: { level: 'developing', currentLevel: 0.2, challengeThreshold: 0.5, autonomyGrants: [], corrections: [] },
298
- }));
417
+ const result = buildAdaptationSummary(
418
+ makeProfile({
419
+ trustModel: {
420
+ level: 'developing',
421
+ currentLevel: 0.2,
422
+ challengeThreshold: 0.5,
423
+ autonomyGrants: [],
424
+ corrections: [],
425
+ },
426
+ }),
427
+ );
299
428
  expect(result).toContain('check before acting');
300
429
  });
301
430
  });
@@ -215,14 +215,20 @@ export function buildAdaptationSummary(profile: OperatorProfile): string | null
215
215
 
216
216
  // Communication style
217
217
  if (communication.style && communication.style !== 'mixed') {
218
- const formality = communication.formality >= 0.7 ? 'formal' : communication.formality <= 0.3 ? 'casual' : '';
218
+ const formality =
219
+ communication.formality >= 0.7 ? 'formal' : communication.formality <= 0.3 ? 'casual' : '';
219
220
  const parts = [communication.style, formality].filter(Boolean);
220
221
  lines.push(`Communication: ${parts.join(', ')}`);
221
222
  }
222
223
 
223
224
  // Challenge threshold / pushback level
224
225
  if (trustModel.level !== 'new') {
225
- const autonomy = trustModel.currentLevel >= 0.7 ? 'high autonomy' : trustModel.currentLevel <= 0.3 ? 'check before acting' : 'moderate autonomy';
226
+ const autonomy =
227
+ trustModel.currentLevel >= 0.7
228
+ ? 'high autonomy'
229
+ : trustModel.currentLevel <= 0.3
230
+ ? 'check before acting'
231
+ : 'moderate autonomy';
226
232
  lines.push(`Trust: ${trustModel.level} — ${autonomy}`);
227
233
  }
228
234
 
@@ -95,10 +95,7 @@ describe('createSyncOps', () => {
95
95
  describe('vault_git_push', () => {
96
96
  it('initializes sync and pushes entries', async () => {
97
97
  const op = findOp(ops, 'vault_git_push');
98
- const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
99
- string,
100
- unknown
101
- >;
98
+ const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<string, unknown>;
102
99
  expect(result.pushed).toBe(5);
103
100
  });
104
101
  });
@@ -108,10 +105,7 @@ describe('createSyncOps', () => {
108
105
  describe('vault_git_pull', () => {
109
106
  it('pulls entries from git directory', async () => {
110
107
  const op = findOp(ops, 'vault_git_pull');
111
- const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
112
- string,
113
- unknown
114
- >;
108
+ const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<string, unknown>;
115
109
  expect(result.imported).toBe(3);
116
110
  });
117
111
  });
@@ -121,10 +115,7 @@ describe('createSyncOps', () => {
121
115
  describe('vault_git_sync', () => {
122
116
  it('performs bidirectional sync', async () => {
123
117
  const op = findOp(ops, 'vault_git_sync');
124
- const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
125
- string,
126
- unknown
127
- >;
118
+ const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<string, unknown>;
128
119
  expect(result.pushed).toBe(2);
129
120
  expect(result.pulled).toBe(1);
130
121
  });
@@ -8,8 +8,18 @@ import { createTelemetryOps } from './telemetry-ops.js';
8
8
  import type { AgentRuntime } from './types.js';
9
9
 
10
10
  function makeTelemetryStub(
11
- stats: { errorsByOp: Record<string, number>; slowestOps: Array<{ op: string; avgMs: number }>; avgDurationMs: number },
12
- recent: Array<{ op: string; facade: string; success: boolean; error?: string; timestamp: number }>,
11
+ stats: {
12
+ errorsByOp: Record<string, number>;
13
+ slowestOps: Array<{ op: string; avgMs: number }>;
14
+ avgDurationMs: number;
15
+ },
16
+ recent: Array<{
17
+ op: string;
18
+ facade: string;
19
+ success: boolean;
20
+ error?: string;
21
+ timestamp: number;
22
+ }>,
13
23
  ) {
14
24
  return {
15
25
  getStats: () => stats,
@@ -28,7 +38,11 @@ describe('telemetry-ops', () => {
28
38
  const res = await executeOp(ops, 'telemetry_errors');
29
39
 
30
40
  expect(res.success).toBe(true);
31
- const data = res.data as { errorCount: number; errorsByOp: Record<string, number>; recentErrors: unknown[] };
41
+ const data = res.data as {
42
+ errorCount: number;
43
+ errorsByOp: Record<string, number>;
44
+ recentErrors: unknown[];
45
+ };
32
46
  expect(data.errorCount).toBe(0);
33
47
  expect(data.recentErrors).toEqual([]);
34
48
  expect(data.errorsByOp).toEqual({});
@@ -49,7 +63,11 @@ describe('telemetry-ops', () => {
49
63
  const res = await executeOp(ops, 'telemetry_errors');
50
64
 
51
65
  expect(res.success).toBe(true);
52
- const data = res.data as { errorCount: number; errorsByOp: Record<string, number>; recentErrors: Array<{ op: string }> };
66
+ const data = res.data as {
67
+ errorCount: number;
68
+ errorsByOp: Record<string, number>;
69
+ recentErrors: Array<{ op: string }>;
70
+ };
53
71
  expect(data.errorCount).toBe(3);
54
72
  expect(data.errorsByOp).toEqual({ vault_search: 2, plan_create: 1 });
55
73
  expect(data.recentErrors).toHaveLength(3);
@@ -58,7 +76,11 @@ describe('telemetry-ops', () => {
58
76
 
59
77
  it('caps recentErrors at 20', async () => {
60
78
  const recent = Array.from({ length: 30 }, (_, i) => ({
61
- op: `op_${i}`, facade: 'test', success: false, error: 'err', timestamp: i,
79
+ op: `op_${i}`,
80
+ facade: 'test',
81
+ success: false,
82
+ error: 'err',
83
+ timestamp: i,
62
84
  }));
63
85
  const telemetry = makeTelemetryStub(
64
86
  { errorsByOp: {}, slowestOps: [], avgDurationMs: 0 },
@@ -90,7 +112,10 @@ describe('telemetry-ops', () => {
90
112
  const res = await executeOp(ops, 'telemetry_slow_ops', {});
91
113
 
92
114
  expect(res.success).toBe(true);
93
- const data = res.data as { slowOps: Array<{ op: string; avgMs: number }>; avgDurationMs: number };
115
+ const data = res.data as {
116
+ slowOps: Array<{ op: string; avgMs: number }>;
117
+ avgDurationMs: number;
118
+ };
94
119
  expect(data.slowOps).toHaveLength(2);
95
120
  expect(data.slowOps.map((o) => o.op)).toEqual(['vault_search', 'plan_create']);
96
121
  expect(data.avgDurationMs).toBe(133);