omnius 1.0.591 → 1.0.592

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 (131) hide show
  1. package/.aiwg/addons/omnius-docs/README.md +15 -1
  2. package/.aiwg/addons/omnius-docs/manifest.json +28 -68
  3. package/.aiwg/addons/omnius-docs/skills/agent-failure-recovery/SKILL.md +2 -1
  4. package/.aiwg/addons/omnius-docs/skills/browser-interaction-validation/SKILL.md +2 -1
  5. package/.aiwg/addons/omnius-docs/skills/evidence-directed-delivery/SKILL.md +2 -1
  6. package/.aiwg/addons/omnius-docs/skills/hardware-evidence-audit/SKILL.md +2 -1
  7. package/.aiwg/addons/omnius-docs/skills/omnius-docs/SKILL.md +17 -7
  8. package/.aiwg/addons/omnius-docs/skills/omnius-inference-docs/SKILL.md +27 -0
  9. package/.aiwg/addons/omnius-docs/skills/omnius-integration-docs/SKILL.md +21 -0
  10. package/.aiwg/addons/omnius-docs/skills/omnius-ops-docs/SKILL.md +2 -0
  11. package/.aiwg/addons/omnius-docs/skills/omnius-realtime-docs/SKILL.md +2 -0
  12. package/.aiwg/addons/omnius-docs/skills/omnius-sponsor-docs/SKILL.md +2 -0
  13. package/.aiwg/addons/omnius-docs/skills/omnius-telegram-docs/SKILL.md +2 -0
  14. package/.aiwg/addons/omnius-docs/skills/omnius-tools-docs/SKILL.md +23 -0
  15. package/.aiwg/addons/omnius-docs/skills/omnius-version-compatibility-docs/SKILL.md +23 -0
  16. package/.aiwg/addons/omnius-docs/skills/runtime-provenance-audit/SKILL.md +2 -1
  17. package/.aiwg/addons/omnius-docs/skills/secrets-and-config-audit/SKILL.md +2 -1
  18. package/.aiwg/addons/omnius-docs/skills/test-surface-audit/SKILL.md +2 -1
  19. package/.aiwg/addons/omnius-docs/skills/workspace-reality-audit/SKILL.md +2 -1
  20. package/.aiwg/addons/omnius-rest-docs/README.md +3 -0
  21. package/.aiwg/addons/omnius-rest-docs/manifest.json +27 -20
  22. package/.aiwg/addons/omnius-rest-docs/skills/omnius-rest-docs/SKILL.md +9 -5
  23. package/README.md +36 -0
  24. package/dist/discovery.d.ts +50 -0
  25. package/dist/index.js +5975 -4021
  26. package/dist/library.d.ts +7 -0
  27. package/dist/library.js +950 -0
  28. package/dist/postinstall-daemon.cjs +18 -0
  29. package/dist/providerRegistry.d.ts +80 -0
  30. package/dist/service-version.d.ts +35 -0
  31. package/docs/.vitepress/config.mts +8 -0
  32. package/docs/DISCOVERY.json +20224 -0
  33. package/docs/DISCOVERY.md +648 -0
  34. package/docs/HANDOFF-crl-encoder-decoder-fix.md +129 -0
  35. package/docs/agent-memory/INDEX.md +9 -4
  36. package/docs/agent-memory/index.md +7 -0
  37. package/docs/concept-relational-language.md +869 -0
  38. package/docs/context-management-medium-models-proposal.md +449 -0
  39. package/docs/dedup-false-positive-meta-analysis.md +96 -0
  40. package/docs/discovery/catalog-overrides.json +724 -0
  41. package/docs/duplicate-calls-root-cause-analysis.md +91 -0
  42. package/docs/duplicate-calls-root-cause-deep.md +155 -0
  43. package/docs/ephemeral-skill-pack-small-context.md +57 -0
  44. package/docs/explorations/context-window-todo-association.md +156 -0
  45. package/docs/explorations/todo-association-verify.json +30 -0
  46. package/docs/explorations/verification-ledger.json +45 -0
  47. package/docs/explorations/verify-todo-association.sh +30 -0
  48. package/docs/flowstate.md +806 -0
  49. package/docs/getting-started/install.md +24 -0
  50. package/docs/getting-started/model-providers.md +13 -0
  51. package/docs/guides/agent-integration.md +87 -0
  52. package/docs/guides/bring-your-own-inference.md +126 -0
  53. package/docs/guides/tools-and-web-search.md +95 -0
  54. package/docs/index.md +14 -0
  55. package/docs/longhaul-35b-workorders.md +496 -0
  56. package/docs/memory-integration-analysis.md +303 -0
  57. package/docs/model-capability-awareness-and-multimodal-memory-root-fix.md +799 -0
  58. package/docs/multimodal-identity-memory-implementation.md +76 -0
  59. package/docs/omnius-self-edit-eval-2026-06-10.md +169 -0
  60. package/docs/opencode-agentic-loop-comparison.md +290 -0
  61. package/docs/operations/security-and-remote-access.md +2 -2
  62. package/docs/operations/version-compatibility.md +63 -0
  63. package/docs/proposals/git-progress-tracking-strategy.md +289 -0
  64. package/docs/proposals/opencode-modules/backendAdapter.ts +443 -0
  65. package/docs/proposals/opencode-modules/childSession.ts +288 -0
  66. package/docs/proposals/opencode-modules/compactionAgent.ts +101 -0
  67. package/docs/proposals/opencode-modules/orchestrator.ts +387 -0
  68. package/docs/proposals/opencode-modules/runner.ts +258 -0
  69. package/docs/reference/auth-map.md +87 -196
  70. package/docs/reference/configuration.md +27 -0
  71. package/docs/reference/rest-api.md +7 -0
  72. package/docs/reference/slash-commands.md +125 -2
  73. package/docs/research/_archived/README.md +18 -0
  74. package/docs/research/_archived/context_window_attention_model.py +418 -0
  75. package/docs/research/_archived/context_window_attention_spec.md +55 -0
  76. package/docs/research/_archived/context_window_attention_weights.json +68 -0
  77. package/docs/research/k-splanifolds.pdf +0 -0
  78. package/docs/research/personality-verbosity-control.md +293 -0
  79. package/docs/rest/INDEX.md +7 -0
  80. package/docs/rest/QUICKREF.md +18 -0
  81. package/docs/rest/REST-DOCS-MANIFEST.json +1 -0
  82. package/docs/rest/auth-and-scopes.md +7 -1
  83. package/docs/rest/endpoints/discovery.md +44 -0
  84. package/docs/rest/endpoints/events.md +5 -0
  85. package/docs/rest/endpoints/tools.md +9 -0
  86. package/docs/reviews/adversary-system-review.md +42 -0
  87. package/docs/sana-and-video-generation-integration-plan.md +712 -0
  88. package/docs/session-diary-llm-training-analysis.md +218 -0
  89. package/docs/telegram-dmn-curiosity-outreach-scaffold.md +91 -0
  90. package/docs/telegram-mid-horizon-download-loop-handoff.md +468 -0
  91. package/docs/telegram-reflection-corpus-integration-plan.md +306 -0
  92. package/docs/telegram-unified-tooling-architecture.md +332 -0
  93. package/docs/threat-model.md +868 -0
  94. package/docs/trajectory-grounding.md +160 -0
  95. package/docs/voice-flow-architecture.md +489 -0
  96. package/docs/work-orders/WO-AM-GAPS.md +638 -0
  97. package/docs/work-orders/daemon-hud-ui-overhaul.md +82 -0
  98. package/docs/work-orders/hermes-architecture-deltas/01-public-scrutiny-provenance-control/INDEX.md +21 -0
  99. package/docs/work-orders/hermes-architecture-deltas/01-public-scrutiny-provenance-control/WORKORDER.md +225 -0
  100. package/docs/work-orders/hermes-architecture-deltas/02-context-engine-plugin-boundary/INDEX.md +20 -0
  101. package/docs/work-orders/hermes-architecture-deltas/02-context-engine-plugin-boundary/WORKORDER.md +198 -0
  102. package/docs/work-orders/hermes-architecture-deltas/03-typed-gateway-event-stream/INDEX.md +19 -0
  103. package/docs/work-orders/hermes-architecture-deltas/03-typed-gateway-event-stream/WORKORDER.md +172 -0
  104. package/docs/work-orders/hermes-architecture-deltas/04-task-local-gateway-context/INDEX.md +19 -0
  105. package/docs/work-orders/hermes-architecture-deltas/04-task-local-gateway-context/WORKORDER.md +169 -0
  106. package/docs/work-orders/hermes-architecture-deltas/05-process-lifecycle-monitoring-notifications/INDEX.md +22 -0
  107. package/docs/work-orders/hermes-architecture-deltas/05-process-lifecycle-monitoring-notifications/WORKORDER.md +189 -0
  108. package/docs/work-orders/hermes-architecture-deltas/06-vision-evidence-routing-ladder/INDEX.md +22 -0
  109. package/docs/work-orders/hermes-architecture-deltas/06-vision-evidence-routing-ladder/WORKORDER.md +199 -0
  110. package/docs/work-orders/hermes-architecture-deltas/07-durable-multi-agent-kanban/INDEX.md +20 -0
  111. package/docs/work-orders/hermes-architecture-deltas/07-durable-multi-agent-kanban/WORKORDER.md +174 -0
  112. package/docs/work-orders/hermes-architecture-deltas/08-completion-critic-reconciliation-ledger/INDEX.md +22 -0
  113. package/docs/work-orders/hermes-architecture-deltas/08-completion-critic-reconciliation-ledger/WORKORDER.md +226 -0
  114. package/docs/work-orders/hermes-architecture-deltas/INDEX.md +38 -0
  115. package/docs/work-orders/omnius-context-engineering-behavior-fixes.md +281 -0
  116. package/docs/work-orders/telegram-dropbear-context-rca-workorder.md +202 -0
  117. package/docs/work-orders/world-class-memory-compiler/README.md +162 -0
  118. package/docs/work-orders/world-class-memory-compiler/TRACKER.md +179 -0
  119. package/docs/work-orders/world-class-memory-compiler/WO-01-exact-request-budget.md +79 -0
  120. package/docs/work-orders/world-class-memory-compiler/WO-02-typed-memory-fabric.md +65 -0
  121. package/docs/work-orders/world-class-memory-compiler/WO-03-dependency-working-set.md +55 -0
  122. package/docs/work-orders/world-class-memory-compiler/WO-04-inference-memory-compiler.md +67 -0
  123. package/docs/work-orders/world-class-memory-compiler/WO-05-artifact-fidelity-materialization.md +72 -0
  124. package/docs/work-orders/world-class-memory-compiler/WO-06-temporal-hybrid-retrieval.md +49 -0
  125. package/docs/work-orders/world-class-memory-compiler/WO-07-evaluation-harness.md +45 -0
  126. package/docs/work-orders/world-class-memory-compiler/WO-08-rollout-legacy-removal.md +45 -0
  127. package/docs/x402-remote-inference-plan.md +323 -0
  128. package/npm-shrinkwrap.json +108 -117
  129. package/package.json +7 -6
  130. package/templates/AGENTS.md +6 -0
  131. package/templates/OMNIUS.md +20 -0
@@ -0,0 +1,288 @@
1
+ /**
2
+ * P0: Child sessions with permission derivation.
3
+ *
4
+ * Creates persisted child sessions in the session DB with full lifecycle
5
+ * management. Permissions cascade from parent: parent's deny rules are
6
+ * forwarded, and the child session gets a restricted permission set by default.
7
+ */
8
+
9
+ import { v4 as uuidv4 } from "uuid";
10
+
11
+ export interface ChildSessionPermissions {
12
+ /** Tools the child can call (subset of parent's permissions) */
13
+ tools: string[];
14
+ /** File patterns the child can read */
15
+ readPatterns: string[];
16
+ /** File patterns the child can write */
17
+ writePatterns: string[];
18
+ /** Shell commands the child can execute */
19
+ shellPatterns: string[];
20
+ /** Whether the child can spawn sub-agents */
21
+ canSpawnAgents: boolean;
22
+ /** Whether the child can call task_complete */
23
+ canComplete: boolean;
24
+ /** Whether the child can access the parent's session messages */
25
+ canAccessParentMessages: boolean;
26
+ }
27
+
28
+ export interface ChildSession {
29
+ /** Unique session ID */
30
+ id: string;
31
+ /** Parent session ID */
32
+ parentSessionId: string;
33
+ /** Title/description of the child session */
34
+ title: string;
35
+ /** Agent type used for this session */
36
+ agent: string;
37
+ /** Permissions derived from parent */
38
+ permissions: ChildSessionPermissions;
39
+ /** Whether the session is active */
40
+ isActive: boolean;
41
+ /** When the session was created */
42
+ createdAt: string;
43
+ /** When the session was last active */
44
+ updatedAt: string;
45
+ /** Accumulated context/messages for this session */
46
+ messages: Array<{ role: string; content: string }>;
47
+ /** Parent's deny rules that cascade to this child */
48
+ parentDenyRules: string[];
49
+ /** task_id for resumption */
50
+ taskId?: string;
51
+ }
52
+
53
+ export class ChildSessionManager {
54
+ private sessions: Map<string, ChildSession> = new Map();
55
+
56
+ /**
57
+ * Create a new child session with permission derivation from parent.
58
+ * Implements OpenCode's pattern: sessions.create({ parentID, title, agent, permission })
59
+ */
60
+ create(
61
+ parentSessionId: string,
62
+ title: string,
63
+ agent: string,
64
+ parentPermissions?: ChildSessionPermissions,
65
+ parentDenyRules?: string[],
66
+ ): ChildSession {
67
+ const id = `child-${uuidv4()}`;
68
+ const now = new Date().toISOString();
69
+
70
+ // Permission derivation: forward parent's denies, default-deny tool/task
71
+ const permissions: ChildSessionPermissions = {
72
+ tools: parentPermissions?.tools ?? [],
73
+ readPatterns: parentPermissions?.readPatterns ?? ["**/*"],
74
+ writePatterns: parentPermissions?.writePatterns ?? [],
75
+ shellPatterns: parentPermissions?.shellPatterns ?? [],
76
+ canSpawnAgents: false, // default-deny
77
+ canComplete: false, // default-deny
78
+ canAccessParentMessages: false, // default-deny
79
+ };
80
+
81
+ // Forward parent's deny rules
82
+ const denyRules = parentDenyRules ?? [];
83
+
84
+ const session: ChildSession = {
85
+ id,
86
+ parentSessionId,
87
+ title,
88
+ agent,
89
+ permissions,
90
+ isActive: true,
91
+ createdAt: now,
92
+ updatedAt: now,
93
+ messages: [],
94
+ parentDenyRules: denyRules,
95
+ };
96
+
97
+ this.sessions.set(id, session);
98
+ return session;
99
+ }
100
+
101
+ /**
102
+ * Get a child session by ID.
103
+ */
104
+ get(id: string): ChildSession | undefined {
105
+ return this.sessions.get(id);
106
+ }
107
+
108
+ /**
109
+ * Check if a child session can perform an action based on its permissions.
110
+ * Returns { allowed: boolean, reason?: string }
111
+ */
112
+ checkPermission(
113
+ sessionId: string,
114
+ action: "read" | "write" | "shell" | "spawn" | "complete" | "accessMessages",
115
+ target?: string,
116
+ ): { allowed: boolean; reason?: string } {
117
+ const session = this.sessions.get(sessionId);
118
+ if (!session) {
119
+ return { allowed: false, reason: "Session not found" };
120
+ }
121
+
122
+ if (!session.isActive) {
123
+ return { allowed: false, reason: "Session is inactive" };
124
+ }
125
+
126
+ // Check parent deny rules first (they cascade)
127
+ for (const rule of session.parentDenyRules) {
128
+ if (this.matchesRule(rule, action, target)) {
129
+ return { allowed: false, reason: `Denied by parent deny rule: ${rule}` };
130
+ }
131
+ }
132
+
133
+ // Check child permissions
134
+ switch (action) {
135
+ case "read":
136
+ return {
137
+ allowed: session.permissions.readPatterns.some((p) =>
138
+ this.matchesPattern(p, target ?? ""),
139
+ ),
140
+ reason: target ? `No matching read pattern for: ${target}` : undefined,
141
+ };
142
+ case "write":
143
+ return {
144
+ allowed: session.permissions.writePatterns.some((p) =>
145
+ this.matchesPattern(p, target ?? ""),
146
+ ),
147
+ reason: target ? `No matching write pattern for: ${target}` : undefined,
148
+ };
149
+ case "shell":
150
+ return {
151
+ allowed: session.permissions.shellPatterns.some((p) =>
152
+ this.matchesPattern(p, target ?? ""),
153
+ ),
154
+ reason: target ? `No matching shell pattern for: ${target}` : undefined,
155
+ };
156
+ case "spawn":
157
+ return {
158
+ allowed: session.permissions.canSpawnAgents,
159
+ reason: "Child sessions cannot spawn agents by default",
160
+ };
161
+ case "complete":
162
+ return {
163
+ allowed: session.permissions.canComplete,
164
+ reason: "Child sessions cannot call task_complete by default",
165
+ };
166
+ case "accessMessages":
167
+ return {
168
+ allowed: session.permissions.canAccessParentMessages,
169
+ reason: "Child sessions cannot access parent messages by default",
170
+ };
171
+ default:
172
+ return { allowed: false, reason: `Unknown action: ${action}` };
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Add messages to a child session.
178
+ */
179
+ addMessage(sessionId: string, message: { role: string; content: string }): boolean {
180
+ const session = this.sessions.get(sessionId);
181
+ if (!session) return false;
182
+
183
+ session.messages.push(message);
184
+ session.updatedAt = new Date().toISOString();
185
+ return true;
186
+ }
187
+
188
+ /**
189
+ * Close a child session.
190
+ */
191
+ close(sessionId: string): boolean {
192
+ const session = this.sessions.get(sessionId);
193
+ if (!session) return false;
194
+
195
+ session.isActive = false;
196
+ return true;
197
+ }
198
+
199
+ /**
200
+ * Get or create a child session — resumes by task_id if available, otherwise creates new.
201
+ * Implements OpenCode's task_id resumption pattern: passing a prior task_id continues
202
+ * the same subagent session with accumulated context.
203
+ */
204
+ getOrCreateChildSession(
205
+ parentSessionId: string,
206
+ title: string,
207
+ agent: string,
208
+ parentPermissions?: ChildSessionPermissions,
209
+ parentDenyRules?: string[],
210
+ taskId?: string,
211
+ ): ChildSession {
212
+ // Try to resume by task_id first
213
+ if (taskId) {
214
+ const existing = this.resume(taskId);
215
+ if (existing) {
216
+ return existing;
217
+ }
218
+ }
219
+
220
+ // Create new session
221
+ const session = this.create(parentSessionId, title, agent, parentPermissions, parentDenyRules);
222
+
223
+ // Assign task_id if provided
224
+ if (taskId) {
225
+ this.assignTaskId(session.id, taskId);
226
+ }
227
+
228
+ return session;
229
+ }
230
+
231
+ /**
232
+ * List all active child sessions for a parent.
233
+ */
234
+ listActive(parentSessionId: string): ChildSession[] {
235
+ return Array.from(this.sessions.values()).filter(
236
+ (s) => s.parentSessionId === parentSessionId && s.isActive,
237
+ );
238
+ }
239
+
240
+ /**
241
+ * Resume a child session by task_id.
242
+ * Implements OpenCode's task_id resumption pattern.
243
+ */
244
+ resume(taskId: string): ChildSession | undefined {
245
+ for (const session of this.sessions.values()) {
246
+ if (session.taskId === taskId && session.isActive) {
247
+ return session;
248
+ }
249
+ }
250
+ return undefined;
251
+ }
252
+
253
+ /**
254
+ * Assign a task_id to a child session for resumption.
255
+ */
256
+ assignTaskId(sessionId: string, taskId: string): boolean {
257
+ const session = this.sessions.get(sessionId);
258
+ if (!session) return false;
259
+
260
+ session.taskId = taskId;
261
+ session.updatedAt = new Date().toISOString();
262
+ return true;
263
+ }
264
+
265
+ // --- Helpers ---
266
+
267
+ private matchesRule(rule: string, action: string, target?: string): boolean {
268
+ // Simple rule matching: "deny:read:*", "deny:write:*.env", etc.
269
+ if (rule.startsWith("deny:")) {
270
+ const [_, actionPattern, ...targetPatterns] = rule.split(":");
271
+ if (actionPattern !== action) return false;
272
+ if (targetPatterns.length === 0) return true; // deny all for this action
273
+ return targetPatterns.some((p) => this.matchesPattern(p, target ?? ""));
274
+ }
275
+ return false;
276
+ }
277
+
278
+ private matchesPattern(pattern: string, target: string): boolean {
279
+ if (pattern === "*") return true;
280
+ if (pattern.startsWith("**/")) {
281
+ return target.endsWith(pattern.slice(3));
282
+ }
283
+ if (pattern.endsWith("/*")) {
284
+ return target.startsWith(pattern.slice(0, -2));
285
+ }
286
+ return target === pattern;
287
+ }
288
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * compactionAgent.ts — Dedicated zero-tool context compression agent.
3
+ *
4
+ * Offloads context compression to a separate agent so the main conversation
5
+ * context is never polluted with compression instructions. The compaction agent:
6
+ * - Has NO tool access (zero-tool agent)
7
+ * - Receives the current conversation context
8
+ * - Returns a compressed version that preserves key facts, decisions, and state
9
+ */
10
+
11
+ import type { ChatMessage } from "./agent-types.js";
12
+
13
+ export interface CompactionOptions {
14
+ /** Token threshold to trigger compaction (default: 128000) */
15
+ tokenThreshold?: number;
16
+ /** Minimum tokens to keep after compaction (default: 32000) */
17
+ minTokens?: number;
18
+ }
19
+
20
+ export interface CompactionResult {
21
+ /** Whether compaction was performed */
22
+ compacted: boolean;
23
+ /** The compressed messages */
24
+ messages: ChatMessage[];
25
+ /** Summary of what was compressed */
26
+ summary: string;
27
+ }
28
+
29
+ /**
30
+ * Estimate the number of tokens in a set of messages.
31
+ * Rough heuristic: 1 token ≈ 4 characters.
32
+ */
33
+ export function estimateMessagesTokens(messages: ChatMessage[]): number {
34
+ let chars = 0;
35
+ for (const message of messages) {
36
+ if (typeof message.content === "string") {
37
+ chars += message.content.length;
38
+ }
39
+ if (message.tool_calls) {
40
+ for (const call of message.tool_calls) {
41
+ chars += JSON.stringify(call).length;
42
+ }
43
+ }
44
+ }
45
+ return Math.ceil(chars / 4);
46
+ }
47
+
48
+ /**
49
+ * Check if the current message history exceeds the token threshold.
50
+ */
51
+ export function shouldCompact(messages: ChatMessage[], options?: CompactionOptions): boolean {
52
+ const threshold = options?.tokenThreshold ?? 128000;
53
+ return estimateMessagesTokens(messages) > threshold;
54
+ }
55
+
56
+ /**
57
+ * Compress the conversation history using the compaction agent.
58
+ */
59
+ export async function compactMessages(
60
+ messages: ChatMessage[],
61
+ options?: CompactionOptions,
62
+ ): Promise<CompactionResult> {
63
+ const result = await CompactionAgent.compress(messages);
64
+ return {
65
+ compacted: true,
66
+ messages: result.messages,
67
+ summary: result.summary,
68
+ };
69
+ }
70
+
71
+ /**
72
+ * The compaction agent itself — a zero-tool agent that compresses context.
73
+ */
74
+ export const CompactionAgent = {
75
+ /**
76
+ * Compress the conversation history.
77
+ * In a real implementation, this would call an LLM with a compression prompt.
78
+ * For now, it returns a simplified structure.
79
+ */
80
+ async compress(messages: ChatMessage[]): Promise<{ messages: ChatMessage[]; summary: string }> {
81
+ // System prompt for the compaction agent
82
+ const systemPrompt =
83
+ "You are a context compression agent. Compress the following conversation into a concise summary preserving all critical facts, decisions, file paths, and state. Do not execute any tools.";
84
+
85
+ // In a real implementation, we would call the LLM here:
86
+ // const response = await backend.complete([
87
+ // { role: "system", content: systemPrompt },
88
+ // ...messages,
89
+ // ], []); // Zero tools
90
+
91
+ // For now, we return a placeholder that keeps the last few messages and a summary
92
+ const recentCount = 10;
93
+ const recentMessages = messages.slice(-recentCount);
94
+ const summary = `Context compressed. Preserved last ${recentCount} messages. Key facts and decisions retained.`;
95
+
96
+ return {
97
+ messages: [{ role: "system" as const, content: summary }, ...recentMessages],
98
+ summary,
99
+ };
100
+ },
101
+ };