@sema-agent/core 7.64.0 → 7.65.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.
- package/CHANGELOG.md +317 -0
- package/dist/agents/peer-held-queue.js +1 -1
- package/dist/agents/peer-idle.js +1 -1
- package/dist/agents/peer-session-drain.js +3 -3
- package/dist/agents/subagent.js +5 -2
- package/dist/core/auto-promote.d.ts +3 -2
- package/dist/core/background-agent-store.d.ts +7 -0
- package/dist/core/checkpoint-store.d.ts +2 -3
- package/dist/core/context-settings.d.ts +1 -2
- package/dist/core/context-settings.js +1 -1
- package/dist/core/engine-attestation.d.ts +2 -2
- package/dist/core/engine-notice.d.ts +13 -1
- package/dist/core/engine-notice.js +3 -1
- package/dist/core/file-history-store.d.ts +2 -2
- package/dist/core/file-history-store.js +0 -4
- package/dist/core/gate-fold.js +3 -1
- package/dist/core/governance-codes.d.ts +6 -4
- package/dist/core/governance-codes.js +4 -3
- package/dist/core/leg-identity.d.ts +18 -2
- package/dist/core/leg-identity.js +5 -7
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.d.ts +10 -4
- package/dist/core/memory-engine/consolidation.js +11 -1
- package/dist/core/memory-engine/control-objects.d.ts +36 -3
- package/dist/core/memory-engine/control-objects.js +134 -12
- package/dist/core/memory-engine/control-plane-adoption.d.ts +5 -2
- package/dist/core/memory-engine/control-plane-adoption.js +5 -3
- package/dist/core/memory-engine/delegation-settlement.d.ts +59 -42
- package/dist/core/memory-engine/delegation-settlement.js +175 -202
- package/dist/core/memory-engine/dual-root.d.ts +3 -2
- package/dist/core/memory-engine/dual-root.js +5 -1
- package/dist/core/memory-engine/engine.d.ts +16 -10
- package/dist/core/memory-engine/engine.js +138 -145
- package/dist/core/memory-engine/file-backend.d.ts +17 -11
- package/dist/core/memory-engine/file-backend.js +53 -103
- package/dist/core/memory-engine/layout.d.ts +129 -49
- package/dist/core/memory-engine/layout.js +202 -82
- package/dist/core/memory-engine/memory-age.d.ts +12 -0
- package/dist/core/memory-engine/memory-age.js +17 -0
- package/dist/core/memory-engine/memory-backend-contract.js +5 -4
- package/dist/core/memory-engine/memory-deployment.d.ts +1 -1
- package/dist/core/memory-engine/origin-clearance.js +1 -5
- package/dist/core/memory-engine/tools.d.ts +2 -2
- package/dist/core/memory-engine/tools.js +7 -7
- package/dist/core/memory-engine/types.d.ts +16 -10
- package/dist/core/memory-vector.d.ts +6 -14
- package/dist/core/memory.d.ts +0 -462
- package/dist/core/memory.js +0 -333
- package/dist/core/permission-rule-consent.d.ts +49 -18
- package/dist/core/permission-rule-consent.js +59 -38
- package/dist/core/permission-rule-store.d.ts +24 -14
- package/dist/core/retention.d.ts +2 -7
- package/dist/core/retention.js +0 -1
- package/dist/core/runner/classifier-ladder.d.ts +3 -1
- package/dist/core/runner/classifier-ladder.js +2 -2
- package/dist/core/runner/contracts.d.ts +9 -9
- package/dist/core/runner/delegation-owner.d.ts +0 -8
- package/dist/core/runner/delegation-owner.js +1 -3
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -5
- package/dist/core/runner/prepare-gate-stations.js +13 -5
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.js +9 -9
- package/dist/core/runner/prepare-policy-chain.js +11 -3
- package/dist/core/runner/prepare-task.d.ts +5 -1
- package/dist/core/runner/prepare-task.js +3 -3
- package/dist/core/runner/run-notification-lane.js +1 -1
- package/dist/core/runner/sub-agent-deny-lists.d.ts +19 -0
- package/dist/core/runner/sub-agent-deny-lists.js +25 -0
- package/dist/core/secret-env.d.ts +2 -2
- package/dist/core/secret-env.js +6 -20
- package/dist/core/session-store.d.ts +6 -6
- package/dist/core/session-store.js +3 -3
- package/dist/core/store-contracts/background-agent-store-contract.js +13 -0
- package/dist/core/task-notification.d.ts +35 -8
- package/dist/core/task-notification.js +31 -13
- package/dist/core/task-registry-agent.js +1 -0
- package/dist/core/task-registry-shared.d.ts +4 -0
- package/dist/core/tool-errors.d.ts +3 -3
- package/dist/core/tool-spec.d.ts +7 -7
- package/dist/core/write-protect.d.ts +16 -0
- package/dist/core/write-protect.js +10 -0
- package/dist/engine/session/repo-utils.d.ts +14 -4
- package/dist/engine/session/repo-utils.js +5 -4
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/prompts/default.d.ts +1 -2
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/stores/file/adoption/adopt.d.ts +1 -1
- package/dist/stores/file/index.d.ts +1 -15
- package/dist/stores/file/index.js +1 -15
- package/dist/stores/file/permission-rule-store.d.ts +12 -1
- package/dist/stores/file/permission-rule-store.js +31 -4
- package/dist/stores/file/session-store.js +1 -1
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +9 -73
- package/wire-changes/core-stores-sql@7.65.0.json +30 -0
- package/wire-changes/core@7.65.0.json +1650 -0
- package/wire-changes/mods-kernel@7.65.0.json +30 -0
- package/wire-changes/primitives@7.65.0.json +337 -0
- package/dist/core/memory-recall.d.ts +0 -208
- package/dist/core/memory-recall.js +0 -136
- package/dist/stores/file/memory-store.d.ts +0 -124
- package/dist/stores/file/memory-store.js +0 -353
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "core",
|
|
3
|
+
"package": "@sema-agent/mods-kernel",
|
|
4
|
+
"version": "7.65.0",
|
|
5
|
+
"from": "29e59bdc3537c17524e49692f2487e2b0fba88cd",
|
|
6
|
+
"to": "v7.65.0",
|
|
7
|
+
"added": [],
|
|
8
|
+
"removed": [],
|
|
9
|
+
"changed": [],
|
|
10
|
+
"narrowed": [],
|
|
11
|
+
"closedSetMembers": [],
|
|
12
|
+
"closedSetsUnreadable": [],
|
|
13
|
+
"typeKeys": [],
|
|
14
|
+
"typeKeysUnreadableArms": [],
|
|
15
|
+
"typeKeysFlattenedCount": 1,
|
|
16
|
+
"signatures": [],
|
|
17
|
+
"versionLiterals": [],
|
|
18
|
+
"declarationMoves": [],
|
|
19
|
+
"mintMoves": [],
|
|
20
|
+
"criteriaObserves": [],
|
|
21
|
+
"consumersHint": {
|
|
22
|
+
"cli": [],
|
|
23
|
+
"server": [],
|
|
24
|
+
"sdk": [],
|
|
25
|
+
"note": "scanned cli@86000d8f server@96a91d82 sdk@d5aed66 — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
|
|
26
|
+
},
|
|
27
|
+
"breakingCount": 0,
|
|
28
|
+
"breakingItems": [],
|
|
29
|
+
"toResolvedAt": "8a3311b3db51d5386a490e1aac287b1f59eb2aee"
|
|
30
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "core",
|
|
3
|
+
"package": "@sema-agent/primitives",
|
|
4
|
+
"version": "7.65.0",
|
|
5
|
+
"from": "29e59bdc3537c17524e49692f2487e2b0fba88cd",
|
|
6
|
+
"to": "v7.65.0",
|
|
7
|
+
"added": [
|
|
8
|
+
{
|
|
9
|
+
"name": "CredentialNamePlace",
|
|
10
|
+
"kind": "type",
|
|
11
|
+
"tier": null,
|
|
12
|
+
"at": [
|
|
13
|
+
"src/index.ts:30",
|
|
14
|
+
"src/secret-vocabulary.ts:71"
|
|
15
|
+
],
|
|
16
|
+
"criteriaCovered": false,
|
|
17
|
+
"breaking": false
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "CredentialNameRow",
|
|
21
|
+
"kind": "interface",
|
|
22
|
+
"tier": null,
|
|
23
|
+
"at": [
|
|
24
|
+
"src/index.ts:29",
|
|
25
|
+
"src/secret-vocabulary.ts:74"
|
|
26
|
+
],
|
|
27
|
+
"criteriaCovered": false,
|
|
28
|
+
"breaking": false
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "EnvValueView",
|
|
32
|
+
"kind": "interface",
|
|
33
|
+
"tier": null,
|
|
34
|
+
"at": [
|
|
35
|
+
"src/index.ts:32",
|
|
36
|
+
"src/secret-vocabulary.ts:577"
|
|
37
|
+
],
|
|
38
|
+
"criteriaCovered": false,
|
|
39
|
+
"breaking": false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "SecretReadingKind",
|
|
43
|
+
"kind": "type",
|
|
44
|
+
"tier": null,
|
|
45
|
+
"at": [
|
|
46
|
+
"src/index.ts:41",
|
|
47
|
+
"src/secret-readings.ts:18"
|
|
48
|
+
],
|
|
49
|
+
"criteriaCovered": false,
|
|
50
|
+
"breaking": false
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "SecretReadingView",
|
|
54
|
+
"kind": "interface",
|
|
55
|
+
"tier": null,
|
|
56
|
+
"at": [
|
|
57
|
+
"src/index.ts:42",
|
|
58
|
+
"src/secret-readings.ts:76"
|
|
59
|
+
],
|
|
60
|
+
"criteriaCovered": false,
|
|
61
|
+
"breaking": false
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "SecretReadingViews",
|
|
65
|
+
"kind": "interface",
|
|
66
|
+
"tier": null,
|
|
67
|
+
"at": [
|
|
68
|
+
"src/index.ts:43",
|
|
69
|
+
"src/secret-readings.ts:86"
|
|
70
|
+
],
|
|
71
|
+
"criteriaCovered": false,
|
|
72
|
+
"breaking": false
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "envValueView",
|
|
76
|
+
"kind": "function",
|
|
77
|
+
"tier": null,
|
|
78
|
+
"at": [
|
|
79
|
+
"src/index.ts:21",
|
|
80
|
+
"src/secret-vocabulary.ts:589"
|
|
81
|
+
],
|
|
82
|
+
"criteriaCovered": false,
|
|
83
|
+
"breaking": false
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "secretReadingViews",
|
|
87
|
+
"kind": "function",
|
|
88
|
+
"tier": null,
|
|
89
|
+
"at": [
|
|
90
|
+
"src/index.ts:39",
|
|
91
|
+
"src/secret-readings.ts:261"
|
|
92
|
+
],
|
|
93
|
+
"criteriaCovered": false,
|
|
94
|
+
"breaking": false
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"removed": [],
|
|
98
|
+
"changed": [],
|
|
99
|
+
"narrowed": [],
|
|
100
|
+
"closedSetMembers": [
|
|
101
|
+
{
|
|
102
|
+
"set": "CredentialNamePlace",
|
|
103
|
+
"at": [
|
|
104
|
+
"src/secret-vocabulary.ts:71"
|
|
105
|
+
],
|
|
106
|
+
"newSet": true,
|
|
107
|
+
"added": [
|
|
108
|
+
"assignment",
|
|
109
|
+
"url-param"
|
|
110
|
+
],
|
|
111
|
+
"removed": [],
|
|
112
|
+
"breaking": false,
|
|
113
|
+
"criteriaCovered": false
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"set": "SECRET_READING_KINDS",
|
|
117
|
+
"at": [
|
|
118
|
+
"src/secret-readings.ts:16"
|
|
119
|
+
],
|
|
120
|
+
"newSet": false,
|
|
121
|
+
"added": [
|
|
122
|
+
"form-plus",
|
|
123
|
+
"percent-boundary",
|
|
124
|
+
"percent-layers"
|
|
125
|
+
],
|
|
126
|
+
"removed": [],
|
|
127
|
+
"breaking": false,
|
|
128
|
+
"criteriaCovered": false
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"set": "SecretGrade",
|
|
132
|
+
"at": [
|
|
133
|
+
"src/secret-scan.ts:611"
|
|
134
|
+
],
|
|
135
|
+
"newSet": false,
|
|
136
|
+
"added": [
|
|
137
|
+
"fragment"
|
|
138
|
+
],
|
|
139
|
+
"removed": [],
|
|
140
|
+
"breaking": false,
|
|
141
|
+
"criteriaCovered": false
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"set": "SecretReading.kind",
|
|
145
|
+
"at": [
|
|
146
|
+
"src/secret-readings.ts:22",
|
|
147
|
+
"src/secret-readings.ts:23",
|
|
148
|
+
"src/secret-readings.ts:24",
|
|
149
|
+
"src/secret-readings.ts:25",
|
|
150
|
+
"src/secret-readings.ts:26"
|
|
151
|
+
],
|
|
152
|
+
"newSet": false,
|
|
153
|
+
"added": [
|
|
154
|
+
"form-plus",
|
|
155
|
+
"percent-boundary",
|
|
156
|
+
"percent-layers"
|
|
157
|
+
],
|
|
158
|
+
"removed": [],
|
|
159
|
+
"breaking": false,
|
|
160
|
+
"criteriaCovered": false
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"set": "SecretReadingKind",
|
|
164
|
+
"at": [
|
|
165
|
+
"src/index.ts:41",
|
|
166
|
+
"src/secret-readings.ts:18"
|
|
167
|
+
],
|
|
168
|
+
"newSet": true,
|
|
169
|
+
"added": [
|
|
170
|
+
"form-plus",
|
|
171
|
+
"format-free",
|
|
172
|
+
"percent-boundary",
|
|
173
|
+
"percent-layers",
|
|
174
|
+
"raw"
|
|
175
|
+
],
|
|
176
|
+
"removed": [],
|
|
177
|
+
"breaking": false,
|
|
178
|
+
"criteriaCovered": false
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"closedSetsUnreadable": [],
|
|
182
|
+
"typeKeys": [
|
|
183
|
+
{
|
|
184
|
+
"type": "CredentialVocabulary",
|
|
185
|
+
"at": [
|
|
186
|
+
"src/secret-vocabulary.ts:99"
|
|
187
|
+
],
|
|
188
|
+
"added": [
|
|
189
|
+
"flagWords",
|
|
190
|
+
"names"
|
|
191
|
+
],
|
|
192
|
+
"addedDetail": [
|
|
193
|
+
{
|
|
194
|
+
"key": "flagWords",
|
|
195
|
+
"optional": false
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"key": "names",
|
|
199
|
+
"optional": false
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
"addedRequired": [
|
|
203
|
+
"flagWords",
|
|
204
|
+
"names"
|
|
205
|
+
],
|
|
206
|
+
"removed": [
|
|
207
|
+
"tokenPrefix"
|
|
208
|
+
],
|
|
209
|
+
"breaking": true,
|
|
210
|
+
"criteriaCovered": false
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"type": "EnvNameView",
|
|
214
|
+
"at": [
|
|
215
|
+
"src/secret-vocabulary.ts:531"
|
|
216
|
+
],
|
|
217
|
+
"added": [],
|
|
218
|
+
"addedDetail": [],
|
|
219
|
+
"addedRequired": [],
|
|
220
|
+
"removed": [
|
|
221
|
+
"tokenPrefix"
|
|
222
|
+
],
|
|
223
|
+
"breaking": true,
|
|
224
|
+
"criteriaCovered": false
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"type": "SecretReading",
|
|
228
|
+
"at": [
|
|
229
|
+
"src/secret-readings.ts:21"
|
|
230
|
+
],
|
|
231
|
+
"added": [
|
|
232
|
+
"form-plus.kind",
|
|
233
|
+
"percent-boundary.kind",
|
|
234
|
+
"percent-layers.depth",
|
|
235
|
+
"percent-layers.kind"
|
|
236
|
+
],
|
|
237
|
+
"addedDetail": [
|
|
238
|
+
{
|
|
239
|
+
"key": "form-plus.kind",
|
|
240
|
+
"optional": false
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"key": "percent-boundary.kind",
|
|
244
|
+
"optional": false
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"key": "percent-layers.depth",
|
|
248
|
+
"optional": false
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"key": "percent-layers.kind",
|
|
252
|
+
"optional": false
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"addedRequired": [],
|
|
256
|
+
"removed": [],
|
|
257
|
+
"breaking": false,
|
|
258
|
+
"criteriaCovered": false
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"type": "ValueFamilyRow",
|
|
262
|
+
"at": [
|
|
263
|
+
"src/secret-vocabulary.ts:37"
|
|
264
|
+
],
|
|
265
|
+
"added": [
|
|
266
|
+
"envValue",
|
|
267
|
+
"envValueHead",
|
|
268
|
+
"fragment"
|
|
269
|
+
],
|
|
270
|
+
"addedDetail": [
|
|
271
|
+
{
|
|
272
|
+
"key": "envValue",
|
|
273
|
+
"optional": true
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"key": "envValueHead",
|
|
277
|
+
"optional": true
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"key": "fragment",
|
|
281
|
+
"optional": true
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"addedRequired": [],
|
|
285
|
+
"removed": [],
|
|
286
|
+
"breaking": false,
|
|
287
|
+
"criteriaCovered": false
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"typeKeysUnreadableArms": [],
|
|
291
|
+
"typeKeysFlattenedCount": 5,
|
|
292
|
+
"signatures": [],
|
|
293
|
+
"versionLiterals": [],
|
|
294
|
+
"declarationMoves": [
|
|
295
|
+
{
|
|
296
|
+
"name": "SECRET_READING_KINDS",
|
|
297
|
+
"kind": "variable",
|
|
298
|
+
"onSurface": true,
|
|
299
|
+
"from": [
|
|
300
|
+
"src/index.ts",
|
|
301
|
+
"src/secret-scan.ts"
|
|
302
|
+
],
|
|
303
|
+
"to": [
|
|
304
|
+
"src/index.ts",
|
|
305
|
+
"src/secret-readings.ts"
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"name": "SecretReading",
|
|
310
|
+
"kind": "type",
|
|
311
|
+
"onSurface": true,
|
|
312
|
+
"from": [
|
|
313
|
+
"src/index.ts",
|
|
314
|
+
"src/secret-scan.ts"
|
|
315
|
+
],
|
|
316
|
+
"to": [
|
|
317
|
+
"src/index.ts",
|
|
318
|
+
"src/secret-readings.ts"
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"mintMoves": [],
|
|
323
|
+
"criteriaObserves": [],
|
|
324
|
+
"consumersHint": {
|
|
325
|
+
"cli": [],
|
|
326
|
+
"server": [],
|
|
327
|
+
"sdk": [],
|
|
328
|
+
"note": "scanned cli@86000d8f server@96a91d82 sdk@d5aed66 — a name listed is MENTIONED there today, which is evidence of consumption, not proof of it"
|
|
329
|
+
},
|
|
330
|
+
"breakingCount": 3,
|
|
331
|
+
"breakingItems": [
|
|
332
|
+
"type gained required keys: CredentialVocabulary +flagWords,names",
|
|
333
|
+
"type lost keys: CredentialVocabulary -tokenPrefix",
|
|
334
|
+
"type lost keys: EnvNameView -tokenPrefix"
|
|
335
|
+
],
|
|
336
|
+
"toResolvedAt": "8a3311b3db51d5386a490e1aac287b1f59eb2aee"
|
|
337
|
+
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import type { MemoryNoteHeader, MemoryNoteRecord, MemoryStore } from "./memory.js";
|
|
2
|
-
/**
|
|
3
|
-
* Selective memory recall (design/65 §2.2 — port of CC `findRelevantMemories`). For a LARGE memory scope,
|
|
4
|
-
* instead of injecting the whole `<user_memory>` block (inject-all), we inject a compact **manifest** (one
|
|
5
|
-
* header line per note) + a side-query that picks the ≤K relevant note ids + only those bodies. Small
|
|
6
|
-
* scopes keep inject-all (the common case after consolidation) — this path is threshold-gated, so most
|
|
7
|
-
* tasks pay nothing.
|
|
8
|
-
*
|
|
9
|
-
* ⚠️ WHAT IS ACTUALLY IN THIS FILE (RB-446, corrected 2026-07-31 — the text below used to describe a
|
|
10
|
-
* DRIVER that no longer exists here, in the present tense). The 2.0.0 B19 export sweep removed the
|
|
11
|
-
* function that ran the pipeline; what remains, and what the rest of core consumes, is the set of PURE
|
|
12
|
-
* HELPERS plus the declared shape of that pipeline:
|
|
13
|
-
* · helpers, all live and in use: {@link formatMemoryAge}, {@link RECALL_CAVEAT},
|
|
14
|
-
* {@link buildManifestText}, {@link validateSelectedIds}, {@link resolveLinkedIds},
|
|
15
|
-
* {@link composeSelectiveBody}, {@link encodeSurfacedKey};
|
|
16
|
-
* · seam DECLARATIONS with no in-tree caller: {@link MemorySelector} /
|
|
17
|
-
* {@link SelectiveRecallOptions} / {@link SelectiveRecallResult} / {@link LayeredRecallOptions} /
|
|
18
|
-
* {@link LayeredRecallResult}. They stay exported because they are the published contract a
|
|
19
|
-
* deployment implements its own driver against — the helpers above are exactly the pieces such a
|
|
20
|
-
* driver assembles — but nothing under `src/` calls them today. Read them as a specification, not
|
|
21
|
-
* as a description of code that runs.
|
|
22
|
-
*
|
|
23
|
-
* The pipeline those declarations specify: pure + deterministic given a selector — validate the returned
|
|
24
|
-
* ids against the manifest (reject hallucinated ids, council #5), cap at K, apply a hard timeout
|
|
25
|
-
* (council #12), and on ANY selector failure/timeout DEGRADE to inject-all (council #4 — never silently
|
|
26
|
-
* drop knowledge). Output goes in the variable tail (manifest + selected bodies are per-user/volatile,
|
|
27
|
-
* like the current memory block). `validateSelectedIds` is the one rung of it that IS implemented here.
|
|
28
|
-
*/
|
|
29
|
-
/** Default max notes the side-query may select (CC `findRelevantMemories` ≤5). */
|
|
30
|
-
export declare const DEFAULT_MAX_SELECTED = 5;
|
|
31
|
-
/** Default max 1-hop link-followed notes appended after the selected ones (design/65 P3). */
|
|
32
|
-
export declare const DEFAULT_MAX_LINKED = 3;
|
|
33
|
-
/** Default side-query hard timeout (ms) — council #12; on timeout we degrade to inject-all. */
|
|
34
|
-
export declare const DEFAULT_SELECT_TIMEOUT_MS = 5000;
|
|
35
|
-
/**
|
|
36
|
-
* Render a memory note's age as a natural-language phrase (CC-parity P0-1, design/65). CC's eval found
|
|
37
|
-
* models reason about memory age much better from natural language ("3 days ago") than from a boolean
|
|
38
|
-
* "older note" flag (verify-claims 0/2 → 3/3 once the age was spelled out), because the model can weigh
|
|
39
|
-
* staleness proportionally instead of as a single cliff. This is the relative phrase only; the
|
|
40
|
-
* point-in-time / verify-before-trust discipline still lives in {@link RECALL_CAVEAT} + the per-note
|
|
41
|
-
* "verify it's still current" hint (the age is ADDITIONAL signal, not a replacement).
|
|
42
|
-
*
|
|
43
|
-
* Buckets (each chooses the coarsest unit that's ≥1): `today` (<1 day, incl. future mtime / clock skew →
|
|
44
|
-
* clamped to today, never a negative age), `yesterday` (1–2 days), `N days ago` (2–7 days),
|
|
45
|
-
* `N weeks ago` (1 week – ~1 month), `N months ago` (≥ ~1 month). N is floored to the whole unit.
|
|
46
|
-
*/
|
|
47
|
-
export declare function formatMemoryAge(ageMs: number): string;
|
|
48
|
-
/**
|
|
49
|
-
* Read-side recall caveat (design/65 §8#2 / §9#1 — ported from CC's MEMORY_DRIFT_CAVEAT +
|
|
50
|
-
* TRUSTING_RECALL_SECTION). The council found CC's two-section form is **eval-validated** (verify-claims
|
|
51
|
-
* 0/2→3/3) and that the structure carries the effect: the precise decision-point heading
|
|
52
|
-
* "## Before recommending from memory" scored 3/3 while an abstract heading or a buried bullet scored 0/3.
|
|
53
|
-
* So this is deliberately TWO sections — a drift bullet + a titled action section with the frame-shift
|
|
54
|
-
* sentence and concrete verify actions — NOT one merged paragraph (same semantics, 3× worse eval).
|
|
55
|
-
* MEMORY_SAFETY already carries the authority hierarchy; this adds the point-in-time / verify-before-trust
|
|
56
|
-
* discipline selective recall specifically needs.
|
|
57
|
-
*/
|
|
58
|
-
export declare const RECALL_CAVEAT: string;
|
|
59
|
-
export interface MemorySelectRequest {
|
|
60
|
-
/** The task objective the recall is for. */
|
|
61
|
-
objective: string;
|
|
62
|
-
/** The manifest the selector chooses from (id + description [+ type]). */
|
|
63
|
-
manifest: MemoryNoteHeader[];
|
|
64
|
-
/** Tools the task will use — for these, keep gotchas/warnings, skip pure usage notes (design/65 §2.2). */
|
|
65
|
-
recentTools?: string[];
|
|
66
|
-
}
|
|
67
|
-
/** The side-query seam: pick the relevant note ids from the manifest. MUST be fail-fast (throw → degrade). */
|
|
68
|
-
export type MemorySelector = (req: MemorySelectRequest, signal?: AbortSignal) => Promise<string[]>;
|
|
69
|
-
export interface SelectiveRecallOptions {
|
|
70
|
-
store: MemoryStore;
|
|
71
|
-
scope: string;
|
|
72
|
-
objective: string;
|
|
73
|
-
selector: MemorySelector;
|
|
74
|
-
recentTools?: string[];
|
|
75
|
-
/** Absolute time for the freshness caveat (default Date.now()). */
|
|
76
|
-
nowMs?: number;
|
|
77
|
-
maxSelected?: number;
|
|
78
|
-
/** Max 1-hop `[[name]]` link-followed notes appended after the selected ones (design/65 P3).
|
|
79
|
-
* `0` disables link-following. Default {@link DEFAULT_MAX_LINKED}. */
|
|
80
|
-
maxLinked?: number;
|
|
81
|
-
timeoutMs?: number;
|
|
82
|
-
signal?: AbortSignal;
|
|
83
|
-
/**
|
|
84
|
-
* CC-parity P1 (durable cross-worker recall de-dup). Note ids ALREADY surfaced to this logical
|
|
85
|
-
* conversation in earlier turns/runs (CC's in-process `alreadySurfaced`/readFileState filter, lifted
|
|
86
|
-
* to a **durable, caller-owned** set so it survives task hops, resume, and multi-worker fan-out). When
|
|
87
|
-
* provided, these ids are **filtered out of the manifest BEFORE the selector sees it** — the selector
|
|
88
|
-
* never sees an already-shown note, so it cannot re-select it, so a long/resumed/multi-worker session
|
|
89
|
-
* does not re-inject the same bodies. core does NOT store this set (like {@link CheckpointStore}, the
|
|
90
|
-
* durable store is the caller's): the caller persists {@link surfacedIds} from one call and feeds it
|
|
91
|
-
* back here as `priorSurfacedIds` on the next. Omitted ⇒ no filtering (the prior, non-de-duped behavior).
|
|
92
|
-
*/
|
|
93
|
-
priorSurfacedIds?: ReadonlySet<string>;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Result of a single-scope selective-recall pass. `surfacedIds` (CC-parity P1) is the set of note ids whose
|
|
97
|
-
* BODIES this call injected into the prompt — the caller appends them to its durable surfaced-set and
|
|
98
|
-
* feeds that back as {@link SelectiveRecallOptions.priorSurfacedIds} next time, so a long/resumed/
|
|
99
|
-
* multi-worker session does not re-inject the same notes. THREE shapes (all carry `surfacedIds`):
|
|
100
|
-
*
|
|
101
|
-
* - **block branch** (`{ block: string }`): a selective-recall block was rendered. `surfacedIds` = the
|
|
102
|
-
* validated selection + the 1-hop linked notes (everything whose body was rendered). The caller injects
|
|
103
|
-
* `block` verbatim.
|
|
104
|
-
*
|
|
105
|
-
* - **no-new branch** (`{ block: undefined }`): a SUCCESS, NOT a degrade. Every selectable candidate was
|
|
106
|
-
* already surfaced earlier (filtered out by {@link SelectiveRecallOptions.priorSurfacedIds}), so there is
|
|
107
|
-
* NOTHING NEW to inject. The caller injects NOTHING (no block) — it must NOT fall back to inject-all,
|
|
108
|
-
* because inject-all would re-dump the WHOLE scope including the already-shown notes, defeating the
|
|
109
|
-
* de-dup. `surfacedIds` is `[]` (this call added no new note to the durable set; the prior ids are
|
|
110
|
-
* already in the caller's store). Distinguished from `degrade` precisely so the caller does not
|
|
111
|
-
* re-inject (the bug this branch fixes). `"block" in result` is TRUE here (the key is present, value
|
|
112
|
-
* `undefined`), so the caller's `"degrade" in result` narrow routes this to the non-degrade path.
|
|
113
|
-
*
|
|
114
|
-
* - **degrade branch** (`{ degrade: true }`): a true FALLBACK — the store can't do selective recall
|
|
115
|
-
* (missing manifest/getByIds), the scope is empty, OR the selector failed/timed out. The caller falls
|
|
116
|
-
* back to inject-all (never drops knowledge, council #4), a best-effort FULL DUMP that
|
|
117
|
-
* `composeMemoryBlock` hard-truncates to a head slice (so it does NOT reliably render every body), and
|
|
118
|
-
* the caller already holds the prior surfaced ids. Degrade is therefore not a precise per-id surface that
|
|
119
|
-
* can be de-duped: `surfacedIds` is ALWAYS `[]` and degrade does **not** advance the durable surfaced-set.
|
|
120
|
-
* (Reporting the full header id list here would over-claim the truncated tail as surfaced → permanent
|
|
121
|
-
* silent under-recall on the next turn.)
|
|
122
|
-
*/
|
|
123
|
-
export type SelectiveRecallResult = {
|
|
124
|
-
block: string;
|
|
125
|
-
surfacedIds: string[];
|
|
126
|
-
} | {
|
|
127
|
-
block: undefined;
|
|
128
|
-
surfacedIds: string[];
|
|
129
|
-
} | {
|
|
130
|
-
degrade: true;
|
|
131
|
-
surfacedIds: string[];
|
|
132
|
-
};
|
|
133
|
-
export declare function resolveLinkedIds(headers: MemoryNoteHeader[], selected: MemoryNoteRecord[], max: number): string[];
|
|
134
|
-
/** Render the manifest as compact lines, double-capped (council #7). One line per note, guaranteed. */
|
|
135
|
-
export declare function buildManifestText(headers: MemoryNoteHeader[]): string;
|
|
136
|
-
/** Keep only ids present in the manifest (reject hallucinated, council #5), de-duped, capped at `max`. */
|
|
137
|
-
export declare function validateSelectedIds(headers: MemoryNoteHeader[], ids: string[], max: number): string[];
|
|
138
|
-
/**
|
|
139
|
-
* Render the BODY of a selective-recall block: the optional `recall` manifest index + the selected note
|
|
140
|
-
* bodies (+ 1-hop linked notes), WITHOUT the outer `<user_memory>` wrapper and WITHOUT {@link RECALL_CAVEAT}.
|
|
141
|
-
* The wrapper + caveat are the caller's job — a single-scope caller places ONE caveat
|
|
142
|
-
* inside ONE `<user_memory scope=… mode="selective">`, and the layered renderer places ONE caveat inside ONE
|
|
143
|
-
* `<user_memory mode="selective">` ahead of N `<scope>` subsections (MAJOR fix: no nested fences, no per-scope
|
|
144
|
-
* caveat duplication).
|
|
145
|
-
*
|
|
146
|
-
* `recallable` controls the "Memory index — load in full …" affordance (MAJOR fix): the on-demand recall
|
|
147
|
-
* tool is bound to a SINGLE scope, so the "load in full" instruction is only TRUE for that scope. Pass
|
|
148
|
-
* `false` for non-recallable layers — the selected bodies are already rendered inline, so the index is just a
|
|
149
|
-
* false affordance that wastes a tool call (model searches the wrong scope → "No memory matches").
|
|
150
|
-
*
|
|
151
|
-
* `recallToolName` (#181-F1, additive) is the WIRE name of the host-mounted recall tool the affordance
|
|
152
|
-
* teaches. Core mounts no such tool ("Recall" is a RETIRED name — tool-name-aliases.ts), so a hard-coded
|
|
153
|
-
* name here can only ever be stale; the host that mounted the tool passes the name it mounted it under.
|
|
154
|
-
* Omitted ⇒ a name-free "search the memory-recall tool" wording (honest without inventing a name).
|
|
155
|
-
*
|
|
156
|
-
* Notes are tagged with their natural-language age (CC-parity P0-1, design/65; >1-day-old ones keep the
|
|
157
|
-
* "verify it's still current" hint, council #8). `linked` (design/65 P3) are 1-hop `[[name]]`-followed notes,
|
|
158
|
-
* rendered in their own clearly-labeled subsection AFTER the selected ones — expanded as DATA under the same
|
|
159
|
-
* fence/sanitize/byte-cap discipline (design/65 §8#9: a followed link must not become markup or escalate authority).
|
|
160
|
-
*
|
|
161
|
-
* SEAT (test B14/B15): this is a HOST-side recall-pipeline API — a BYOM host
|
|
162
|
-
* that builds its own selective-recall lane composes the injected block through it. The engine's
|
|
163
|
-
* own `inject()` path deliberately does NOT route here (it assembles instruction+index+announcements
|
|
164
|
-
* only; live recall is the model-driven memory_search tool with its own caps). Public export with
|
|
165
|
-
* no in-engine consumer is the intended shape, not dead code.
|
|
166
|
-
*/
|
|
167
|
-
export declare function composeSelectiveBody(manifestText: string, selected: MemoryNoteRecord[], nowMs: number, linked?: MemoryNoteRecord[], recallable?: boolean, recallToolName?: string): string;
|
|
168
|
-
/** A `(scope, id)` composite key for the multi-scope durable de-dup (design/84 Seam A decision 5). Note ids
|
|
169
|
-
* are only unique WITHIN a scope, so the cross-scope `priorSurfacedKeys`/`surfacedKeys` set MUST be keyed on
|
|
170
|
-
* both. Core owns the FORMAT so a caller can't drift the wire format (decision 7) — the encoding is OPAQUE
|
|
171
|
-
* and length-prefixes the scope so a scope/id containing the separator cannot self-declare a collision.
|
|
172
|
-
*
|
|
173
|
-
* ONE-WAY by design ((d)): the key is only ever PRODUCED here (`surfacedKeys`) and compared by
|
|
174
|
-
* STRING EQUALITY against the caller's persisted set ({@link LayeredRecallOptions.priorSurfacedKeys}, applied
|
|
175
|
-
* at memory-recall.ts via `priorSurfacedKeys.has(encodeSurfacedKey(h.scope, h.id))`). Nothing ever needs the
|
|
176
|
-
* `(scope, id)` BACK out of a key, so there is intentionally NO `decodeSurfacedKey` — adding a decode would
|
|
177
|
-
* widen the public surface (and invite callers to parse the opaque format) for zero consumer. Treat the key
|
|
178
|
-
* as an opaque token: persist it, feed it back, compare for equality — never split it. */
|
|
179
|
-
export declare function encodeSurfacedKey(scope: string, id: string): string;
|
|
180
|
-
export interface LayeredRecallOptions {
|
|
181
|
-
store: MemoryStore;
|
|
182
|
-
/** Ordered scopes (design/84 Seam A): list order = priority; the last is highest. */
|
|
183
|
-
scopes: ReadonlyArray<string>;
|
|
184
|
-
objective: string;
|
|
185
|
-
selector: MemorySelector;
|
|
186
|
-
recentTools?: string[];
|
|
187
|
-
nowMs?: number;
|
|
188
|
-
maxSelected?: number;
|
|
189
|
-
maxLinked?: number;
|
|
190
|
-
timeoutMs?: number;
|
|
191
|
-
signal?: AbortSignal;
|
|
192
|
-
/** CC-parity P1, multi-scope: `(scope,id)` composite keys ({@link encodeSurfacedKey}) already surfaced to
|
|
193
|
-
* this logical conversation. Filtered out of the merged manifest BEFORE the selector sees it. */
|
|
194
|
-
priorSurfacedKeys?: ReadonlySet<string>;
|
|
195
|
-
}
|
|
196
|
-
/** Result of a multi-scope (layered) selective-recall pass. `surfacedKeys` are `(scope,id)` composite keys
|
|
197
|
-
* ({@link encodeSurfacedKey}) — the caller appends them to its durable set and feeds them back as
|
|
198
|
-
* {@link LayeredRecallOptions.priorSurfacedKeys}. Mirrors {@link SelectiveRecallResult}'s three shapes. */
|
|
199
|
-
export type LayeredRecallResult = {
|
|
200
|
-
block: string;
|
|
201
|
-
surfacedKeys: string[];
|
|
202
|
-
} | {
|
|
203
|
-
block: undefined;
|
|
204
|
-
surfacedKeys: string[];
|
|
205
|
-
} | {
|
|
206
|
-
degrade: true;
|
|
207
|
-
surfacedKeys: string[];
|
|
208
|
-
};
|