@psiclawops/hypermem 0.8.4 → 0.9.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 +33 -0
- package/INSTALL.md +203 -23
- package/README.md +139 -216
- package/bench/README.md +42 -0
- package/bench/data-access-bench.mjs +380 -0
- package/bin/hypermem-bench.mjs +2 -0
- package/bin/hypermem-doctor.mjs +412 -0
- package/bin/hypermem-model-audit.mjs +339 -0
- package/bin/hypermem-status.mjs +491 -70
- package/dist/adaptive-lifecycle.d.ts +81 -0
- package/dist/adaptive-lifecycle.d.ts.map +1 -0
- package/dist/adaptive-lifecycle.js +190 -0
- package/dist/background-indexer.js +9 -9
- package/dist/budget-policy.d.ts +1 -1
- package/dist/budget-policy.d.ts.map +1 -1
- package/dist/budget-policy.js +10 -5
- package/dist/cache.d.ts +4 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +2 -0
- package/dist/composition-snapshot-integrity.d.ts +36 -0
- package/dist/composition-snapshot-integrity.d.ts.map +1 -0
- package/dist/composition-snapshot-integrity.js +131 -0
- package/dist/composition-snapshot-runtime.d.ts +59 -0
- package/dist/composition-snapshot-runtime.d.ts.map +1 -0
- package/dist/composition-snapshot-runtime.js +250 -0
- package/dist/composition-snapshot-store.d.ts +44 -0
- package/dist/composition-snapshot-store.d.ts.map +1 -0
- package/dist/composition-snapshot-store.js +117 -0
- package/dist/compositor.d.ts +125 -1
- package/dist/compositor.d.ts.map +1 -1
- package/dist/compositor.js +692 -44
- package/dist/cross-agent.d.ts +1 -1
- package/dist/cross-agent.js +17 -17
- package/dist/doc-chunk-store.d.ts +19 -0
- package/dist/doc-chunk-store.d.ts.map +1 -1
- package/dist/doc-chunk-store.js +56 -6
- package/dist/dreaming-promoter.d.ts +1 -1
- package/dist/dreaming-promoter.js +2 -2
- package/dist/hybrid-retrieval.d.ts +38 -0
- package/dist/hybrid-retrieval.d.ts.map +1 -1
- package/dist/hybrid-retrieval.js +86 -1
- package/dist/index.d.ts +15 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -7
- package/dist/knowledge-store.d.ts +4 -1
- package/dist/knowledge-store.d.ts.map +1 -1
- package/dist/knowledge-store.js +27 -4
- package/dist/library-schema.d.ts +12 -8
- package/dist/library-schema.d.ts.map +1 -1
- package/dist/library-schema.js +22 -8
- package/dist/message-store.d.ts.map +1 -1
- package/dist/message-store.js +7 -3
- package/dist/metrics-dashboard.d.ts +18 -1
- package/dist/metrics-dashboard.d.ts.map +1 -1
- package/dist/metrics-dashboard.js +52 -14
- package/dist/reranker.d.ts +1 -1
- package/dist/reranker.js +2 -2
- package/dist/schema.d.ts +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +28 -1
- package/dist/seed.d.ts +1 -1
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +3 -1
- package/dist/session-flusher.d.ts +2 -2
- package/dist/session-flusher.js +2 -2
- package/dist/spawn-context.d.ts +1 -1
- package/dist/spawn-context.js +1 -1
- package/dist/topic-store.js +5 -5
- package/dist/topic-synthesizer.d.ts +20 -0
- package/dist/topic-synthesizer.d.ts.map +1 -1
- package/dist/topic-synthesizer.js +114 -4
- package/dist/trigger-registry.d.ts +1 -1
- package/dist/trigger-registry.d.ts.map +1 -1
- package/dist/trigger-registry.js +14 -6
- package/dist/types.d.ts +273 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +7 -7
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +17 -7
- package/docs/DIAGNOSTICS.md +205 -0
- package/docs/INTEGRATION_VALIDATION.md +186 -0
- package/docs/MIGRATION.md +9 -6
- package/docs/MIGRATION_GUIDE.md +125 -101
- package/docs/ROADMAP.md +238 -20
- package/docs/TUNING.md +30 -6
- package/install.sh +159 -408
- package/memory-plugin/LICENSE +190 -0
- package/memory-plugin/README.md +20 -0
- package/memory-plugin/dist/index.js +50 -0
- package/memory-plugin/package.json +2 -2
- package/package.json +18 -4
- package/plugin/LICENSE +190 -0
- package/plugin/README.md +20 -0
- package/plugin/dist/index.d.ts +55 -0
- package/plugin/dist/index.d.ts.map +1 -1
- package/plugin/dist/index.js +362 -42
- package/plugin/dist/index.js.map +1 -1
- package/plugin/package.json +2 -2
- package/scripts/install-runtime.mjs +13 -3
package/dist/seed.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
8
|
* const seeder = new WorkspaceSeeder(hypermem);
|
|
9
|
-
* const result = await seeder.seedWorkspace('/path/to/workspace', { agentId: '
|
|
9
|
+
* const result = await seeder.seedWorkspace('/path/to/workspace', { agentId: 'alice' });
|
|
10
10
|
*
|
|
11
11
|
* Idempotent: skips files whose source hash hasn't changed since last index.
|
|
12
12
|
* Atomic: each file's chunks are swapped in a single transaction.
|
|
@@ -47,6 +47,8 @@ export class WorkspaceSeeder {
|
|
|
47
47
|
reindexed: 0,
|
|
48
48
|
errors: [],
|
|
49
49
|
};
|
|
50
|
+
const gcResult = this.chunkStore.garbageCollectMissingSources({ sourcePathPrefix: workspaceDir });
|
|
51
|
+
result.totalDeleted += gcResult.chunksDeleted;
|
|
50
52
|
const filesToProcess = this.discoverFiles(workspaceDir, opts);
|
|
51
53
|
for (const { filePath, collectionDef } of filesToProcess) {
|
|
52
54
|
// Skip if collection filter provided
|
|
@@ -33,8 +33,8 @@ export interface FlushSessionResult {
|
|
|
33
33
|
* from those stores naturally.
|
|
34
34
|
*
|
|
35
35
|
* @param cache Connected CacheLayer instance
|
|
36
|
-
* @param agentId Agent identifier (e.g. "
|
|
37
|
-
* @param sessionKey Full session key (e.g. "agent:
|
|
36
|
+
* @param agentId Agent identifier (e.g. "alice")
|
|
37
|
+
* @param sessionKey Full session key (e.g. "agent:alice:webchat:scratchpad")
|
|
38
38
|
* @param opts Optional flags
|
|
39
39
|
*/
|
|
40
40
|
export declare function flushSession(cache: CacheLayer, agentId: string, sessionKey: string, opts?: FlushSessionOptions): Promise<FlushSessionResult>;
|
package/dist/session-flusher.js
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* from those stores naturally.
|
|
19
19
|
*
|
|
20
20
|
* @param cache Connected CacheLayer instance
|
|
21
|
-
* @param agentId Agent identifier (e.g. "
|
|
22
|
-
* @param sessionKey Full session key (e.g. "agent:
|
|
21
|
+
* @param agentId Agent identifier (e.g. "alice")
|
|
22
|
+
* @param sessionKey Full session key (e.g. "agent:alice:webchat:scratchpad")
|
|
23
23
|
* @param opts Optional flags
|
|
24
24
|
*/
|
|
25
25
|
export async function flushSession(cache, agentId, sessionKey, opts = {}) {
|
package/dist/spawn-context.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
8
|
* const ctx = await buildSpawnContext(messageStore, docChunkStore, agentId, {
|
|
9
|
-
* parentSessionKey: 'agent:
|
|
9
|
+
* parentSessionKey: 'agent:alice:webchat:main',
|
|
10
10
|
* workingSnapshot: 10,
|
|
11
11
|
* documents: ['/path/to/spec.md'],
|
|
12
12
|
* });
|
package/dist/spawn-context.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
8
|
* const ctx = await buildSpawnContext(messageStore, docChunkStore, agentId, {
|
|
9
|
-
* parentSessionKey: 'agent:
|
|
9
|
+
* parentSessionKey: 'agent:alice:webchat:main',
|
|
10
10
|
* workingSnapshot: 10,
|
|
11
11
|
* documents: ['/path/to/spec.md'],
|
|
12
12
|
* });
|
package/dist/topic-store.js
CHANGED
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
const KNOWN_NAMES = {
|
|
13
13
|
hypermem: 'HyperMem',
|
|
14
14
|
hyperbuilder: 'HyperBuilder',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
canvas: 'canvas',
|
|
16
|
+
dashboard: 'dashboard',
|
|
17
|
+
dispatch: 'dispatch',
|
|
18
18
|
clawtext: 'ClawText',
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
automation: 'automation',
|
|
20
|
+
council: 'council',
|
|
21
21
|
openclaw: 'OpenClaw',
|
|
22
22
|
clawhub: 'ClawHub',
|
|
23
23
|
};
|
|
@@ -31,6 +31,9 @@ export interface SynthesisResult {
|
|
|
31
31
|
topicsSynthesized: number;
|
|
32
32
|
topicsSkipped: number;
|
|
33
33
|
knowledgeEntriesWritten: number;
|
|
34
|
+
topicIdsResolved: number;
|
|
35
|
+
topicsWithoutResolvedIds: number;
|
|
36
|
+
topicsWithoutMessages: number;
|
|
34
37
|
}
|
|
35
38
|
export declare class TopicSynthesizer {
|
|
36
39
|
private readonly libraryDb;
|
|
@@ -43,6 +46,23 @@ export declare class TopicSynthesizer {
|
|
|
43
46
|
* Finds stale topics, synthesizes wiki pages, writes to knowledge table.
|
|
44
47
|
*/
|
|
45
48
|
tick(agentId: string): SynthesisResult;
|
|
49
|
+
/**
|
|
50
|
+
* Resolve a library topic to message-db topic ids.
|
|
51
|
+
*
|
|
52
|
+
* Library topics use integer ids and aggregate per agent/name. Message DBs
|
|
53
|
+
* use UUID topic ids scoped to sessions. Preserve the legacy direct-id path
|
|
54
|
+
* for older data, then bridge current data by case-insensitive topic name.
|
|
55
|
+
*/
|
|
56
|
+
private resolveMessageTopicIds;
|
|
57
|
+
/**
|
|
58
|
+
* Load source messages for a library topic.
|
|
59
|
+
*
|
|
60
|
+
* Primary path uses session topic ids. Fallback path mirrors the background
|
|
61
|
+
* indexer's topic detector because library topics are created from message
|
|
62
|
+
* content, not from SessionTopicMap UUID names.
|
|
63
|
+
*/
|
|
64
|
+
private loadTopicMessages;
|
|
65
|
+
private loadMessagesByDetectedTopic;
|
|
46
66
|
/**
|
|
47
67
|
* Synthesize a wiki page for a topic from its messages.
|
|
48
68
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic-synthesizer.d.ts","sourceRoot":"","sources":["../src/topic-synthesizer.ts"],"names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;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA2BzB,OAAO,CAAC,2BAA2B;IAgDnC;;OAEG;IACH,OAAO,CAAC,eAAe;CA+GxB"}
|
|
@@ -35,7 +35,7 @@ function keystoneScore(msg) {
|
|
|
35
35
|
const backtickMatches = text.match(/`[^`]+`/g) || [];
|
|
36
36
|
score += backtickMatches.length * 0.2;
|
|
37
37
|
// Agent mentions (known patterns)
|
|
38
|
-
const agentMentions = text.match(/\b(
|
|
38
|
+
const agentMentions = text.match(/\b(alice|bob|agent4|dave|oscar|carol|director1|director2|director7|specialist2|specialist1)\b/gi) || [];
|
|
39
39
|
score += agentMentions.length * 0.25;
|
|
40
40
|
// Quoted content
|
|
41
41
|
const quotedMatches = text.match(/"[^"]{10,}"/g) || [];
|
|
@@ -114,6 +114,9 @@ function parseStoredMessageCount(sourceRef) {
|
|
|
114
114
|
const match = sourceRef.match(/:mc:(\d+)$/);
|
|
115
115
|
return match ? parseInt(match[1], 10) : 0;
|
|
116
116
|
}
|
|
117
|
+
function escapeLike(value) {
|
|
118
|
+
return value.replace(/[\\%_]/g, match => `\\${match}`);
|
|
119
|
+
}
|
|
117
120
|
// ─── TopicSynthesizer ───────────────────────────────────────────
|
|
118
121
|
export class TopicSynthesizer {
|
|
119
122
|
libraryDb;
|
|
@@ -144,6 +147,9 @@ export class TopicSynthesizer {
|
|
|
144
147
|
topicsSynthesized: 0,
|
|
145
148
|
topicsSkipped: 0,
|
|
146
149
|
knowledgeEntriesWritten: 0,
|
|
150
|
+
topicIdsResolved: 0,
|
|
151
|
+
topicsWithoutResolvedIds: 0,
|
|
152
|
+
topicsWithoutMessages: 0,
|
|
147
153
|
};
|
|
148
154
|
const cfg = this.effectiveConfig;
|
|
149
155
|
const staleThresholdMinutes = cfg.SYNTHESIS_STALE_MINUTES;
|
|
@@ -184,17 +190,23 @@ export class TopicSynthesizer {
|
|
|
184
190
|
result.topicsSkipped++;
|
|
185
191
|
continue;
|
|
186
192
|
}
|
|
193
|
+
const resolvedTopicIds = this.resolveMessageTopicIds(messageDb, topic);
|
|
194
|
+
result.topicIdsResolved += resolvedTopicIds.length;
|
|
195
|
+
if (resolvedTopicIds.length === 0) {
|
|
196
|
+
result.topicsWithoutResolvedIds++;
|
|
197
|
+
result.topicsSkipped++;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
187
200
|
let messages;
|
|
188
201
|
try {
|
|
189
|
-
messages =
|
|
190
|
-
SELECT * FROM messages WHERE topic_id = ? ORDER BY created_at ASC
|
|
191
|
-
`).all(String(topic.id));
|
|
202
|
+
messages = this.loadTopicMessages(messageDb, topic, resolvedTopicIds);
|
|
192
203
|
}
|
|
193
204
|
catch {
|
|
194
205
|
result.topicsSkipped++;
|
|
195
206
|
continue;
|
|
196
207
|
}
|
|
197
208
|
if (messages.length === 0) {
|
|
209
|
+
result.topicsWithoutMessages++;
|
|
198
210
|
result.topicsSkipped++;
|
|
199
211
|
continue;
|
|
200
212
|
}
|
|
@@ -211,6 +223,104 @@ export class TopicSynthesizer {
|
|
|
211
223
|
}
|
|
212
224
|
return result;
|
|
213
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Resolve a library topic to message-db topic ids.
|
|
228
|
+
*
|
|
229
|
+
* Library topics use integer ids and aggregate per agent/name. Message DBs
|
|
230
|
+
* use UUID topic ids scoped to sessions. Preserve the legacy direct-id path
|
|
231
|
+
* for older data, then bridge current data by case-insensitive topic name.
|
|
232
|
+
*/
|
|
233
|
+
resolveMessageTopicIds(messageDb, topic) {
|
|
234
|
+
const ids = new Set([String(topic.id)]);
|
|
235
|
+
try {
|
|
236
|
+
const rows = messageDb.prepare(`
|
|
237
|
+
SELECT id FROM topics WHERE lower(name) = lower(?) ORDER BY last_active_at ASC
|
|
238
|
+
`).all(topic.name);
|
|
239
|
+
for (const row of rows) {
|
|
240
|
+
if (row.id)
|
|
241
|
+
ids.add(String(row.id));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
// Older message DBs may not have the per-session topics table. In that
|
|
246
|
+
// case the legacy direct-id fallback above is the only valid resolver.
|
|
247
|
+
}
|
|
248
|
+
return [...ids];
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Load source messages for a library topic.
|
|
252
|
+
*
|
|
253
|
+
* Primary path uses session topic ids. Fallback path mirrors the background
|
|
254
|
+
* indexer's topic detector because library topics are created from message
|
|
255
|
+
* content, not from SessionTopicMap UUID names.
|
|
256
|
+
*/
|
|
257
|
+
loadTopicMessages(messageDb, topic, resolvedTopicIds) {
|
|
258
|
+
const byId = (() => {
|
|
259
|
+
try {
|
|
260
|
+
const placeholders = resolvedTopicIds.map(() => '?').join(', ');
|
|
261
|
+
return messageDb.prepare(`
|
|
262
|
+
SELECT * FROM messages WHERE topic_id IN (${placeholders}) ORDER BY created_at ASC
|
|
263
|
+
`).all(...resolvedTopicIds);
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
})();
|
|
269
|
+
const byContent = this.loadMessagesByDetectedTopic(messageDb, topic);
|
|
270
|
+
const seen = new Set();
|
|
271
|
+
const merged = [];
|
|
272
|
+
for (const msg of [...byId, ...byContent]) {
|
|
273
|
+
if (seen.has(msg.id))
|
|
274
|
+
continue;
|
|
275
|
+
seen.add(msg.id);
|
|
276
|
+
merged.push(msg);
|
|
277
|
+
}
|
|
278
|
+
return merged.sort((a, b) => String(a.created_at).localeCompare(String(b.created_at)));
|
|
279
|
+
}
|
|
280
|
+
loadMessagesByDetectedTopic(messageDb, topic) {
|
|
281
|
+
const topicName = topic.name.toLowerCase();
|
|
282
|
+
const limit = Math.max(topic.message_count * 3, topic.message_count, this.effectiveConfig.SYNTHESIS_MIN_MESSAGES);
|
|
283
|
+
if (topicName === 'infrastructure') {
|
|
284
|
+
return messageDb.prepare(`
|
|
285
|
+
SELECT * FROM messages
|
|
286
|
+
WHERE text_content IS NOT NULL
|
|
287
|
+
AND (
|
|
288
|
+
lower(text_content) LIKE '%redis%'
|
|
289
|
+
OR lower(text_content) LIKE '%sqlite%'
|
|
290
|
+
OR lower(text_content) LIKE '%database%'
|
|
291
|
+
OR lower(text_content) LIKE '%migration%'
|
|
292
|
+
OR lower(text_content) LIKE '%deployment%'
|
|
293
|
+
OR lower(text_content) LIKE '%docker%'
|
|
294
|
+
OR lower(text_content) LIKE '%nginx%'
|
|
295
|
+
)
|
|
296
|
+
ORDER BY created_at ASC
|
|
297
|
+
LIMIT ?
|
|
298
|
+
`).all(limit);
|
|
299
|
+
}
|
|
300
|
+
if (topicName === 'security') {
|
|
301
|
+
return messageDb.prepare(`
|
|
302
|
+
SELECT * FROM messages
|
|
303
|
+
WHERE text_content IS NOT NULL
|
|
304
|
+
AND (
|
|
305
|
+
lower(text_content) LIKE '%security%'
|
|
306
|
+
OR lower(text_content) LIKE '%auth%'
|
|
307
|
+
OR lower(text_content) LIKE '%permission%'
|
|
308
|
+
OR lower(text_content) LIKE '%access%'
|
|
309
|
+
OR lower(text_content) LIKE '%token%'
|
|
310
|
+
OR lower(text_content) LIKE '%credential%'
|
|
311
|
+
)
|
|
312
|
+
ORDER BY created_at ASC
|
|
313
|
+
LIMIT ?
|
|
314
|
+
`).all(limit);
|
|
315
|
+
}
|
|
316
|
+
return messageDb.prepare(`
|
|
317
|
+
SELECT * FROM messages
|
|
318
|
+
WHERE text_content IS NOT NULL
|
|
319
|
+
AND lower(text_content) LIKE ? ESCAPE '\\'
|
|
320
|
+
ORDER BY created_at ASC
|
|
321
|
+
LIMIT ?
|
|
322
|
+
`).all(`%${escapeLike(topicName)}%`, limit);
|
|
323
|
+
}
|
|
214
324
|
/**
|
|
215
325
|
* Synthesize a wiki page for a topic from its messages.
|
|
216
326
|
*/
|
|
@@ -39,7 +39,7 @@ export interface CollectionTrigger {
|
|
|
39
39
|
export declare const TRIGGER_REGISTRY_VERSION = "1.0.0";
|
|
40
40
|
/**
|
|
41
41
|
* Default trigger registry for standard ACA collections.
|
|
42
|
-
* Covers the core ACA offload use case from
|
|
42
|
+
* Covers the core ACA offload use case from carol's spec.
|
|
43
43
|
*/
|
|
44
44
|
export declare const TRIGGER_REGISTRY: CollectionTrigger[];
|
|
45
45
|
/** Backward-compat alias — same reference as TRIGGER_REGISTRY */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-registry.d.ts","sourceRoot":"","sources":["../src/trigger-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"trigger-registry.d.ts","sourceRoot":"","sources":["../src/trigger-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,EAyH/C,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,qBAAmB,CAAC;AAIjD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAGrB,CAAC;AAIhB;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,iBAAiB,EAAE,CAMrB;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC"}
|
package/dist/trigger-registry.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createHash } from 'node:crypto';
|
|
|
13
13
|
export const TRIGGER_REGISTRY_VERSION = '1.0.0';
|
|
14
14
|
/**
|
|
15
15
|
* Default trigger registry for standard ACA collections.
|
|
16
|
-
* Covers the core ACA offload use case from
|
|
16
|
+
* Covers the core ACA offload use case from carol's spec.
|
|
17
17
|
*/
|
|
18
18
|
export const TRIGGER_REGISTRY = [
|
|
19
19
|
{
|
|
@@ -21,7 +21,10 @@ export const TRIGGER_REGISTRY = [
|
|
|
21
21
|
keywords: [
|
|
22
22
|
'escalat', 'policy', 'decision state', 'green', 'yellow', 'red',
|
|
23
23
|
'council procedure', 'naming', 'mandate', 'compliance', 'governance',
|
|
24
|
-
'override', 'human review', 'irreversible',
|
|
24
|
+
'override', 'human review', 'irreversible', 'turn protocol',
|
|
25
|
+
'response contract', 'red lines', 'external action', 'public action',
|
|
26
|
+
'approval', 'authorization', 'single-name', 'single name',
|
|
27
|
+
'config change', 'infra change', 'backup', 'rollback', 'credential',
|
|
25
28
|
],
|
|
26
29
|
maxTokens: 1500,
|
|
27
30
|
maxChunks: 3,
|
|
@@ -33,7 +36,9 @@ export const TRIGGER_REGISTRY = [
|
|
|
33
36
|
collection: 'governance/charter',
|
|
34
37
|
keywords: [
|
|
35
38
|
'charter', 'mission', 'director', 'org', 'reporting', 'boundary',
|
|
36
|
-
'delegation', 'authority', 'jurisdiction',
|
|
39
|
+
'delegation', 'authority', 'jurisdiction', 'authority ceiling',
|
|
40
|
+
'scope ceiling', 'cross-charter', 'scaffolding', 'new agent',
|
|
41
|
+
'new role', 'operator authority',
|
|
37
42
|
],
|
|
38
43
|
maxTokens: 1000,
|
|
39
44
|
maxChunks: 2,
|
|
@@ -46,6 +51,7 @@ export const TRIGGER_REGISTRY = [
|
|
|
46
51
|
keywords: [
|
|
47
52
|
'message', 'send', 'tier 1', 'tier 2', 'tier 3', 'async', 'dispatch',
|
|
48
53
|
'sessions_send', 'inter-agent', 'protocol', 'comms', 'ping', 'notify',
|
|
54
|
+
'communication tiers', 'reply_to', 'steer', 'broadcast', 'no reply needed',
|
|
49
55
|
],
|
|
50
56
|
maxTokens: 800,
|
|
51
57
|
maxChunks: 2,
|
|
@@ -58,10 +64,12 @@ export const TRIGGER_REGISTRY = [
|
|
|
58
64
|
keywords: [
|
|
59
65
|
'boot', 'startup', 'bootstrap', 'heartbeat', 'workqueue', 'checkpoint',
|
|
60
66
|
'session start', 'roll call', 'memory recall', 'dispatch inbox',
|
|
67
|
+
'static context', 'dynamic context', 'prompt file', 'context split',
|
|
68
|
+
'hypermem context',
|
|
61
69
|
],
|
|
62
70
|
maxTokens: 800,
|
|
63
71
|
maxChunks: 2,
|
|
64
|
-
owner: '
|
|
72
|
+
owner: 'alice',
|
|
65
73
|
category: 'operations',
|
|
66
74
|
description: 'Agent operational procedures: boot sequence, heartbeat, work queue, session startup',
|
|
67
75
|
},
|
|
@@ -98,7 +106,7 @@ export const TRIGGER_REGISTRY = [
|
|
|
98
106
|
],
|
|
99
107
|
maxTokens: 1500,
|
|
100
108
|
maxChunks: 4,
|
|
101
|
-
owner: '
|
|
109
|
+
owner: 'alice',
|
|
102
110
|
category: 'memory',
|
|
103
111
|
description: 'Decision history: past choices, previously agreed approaches, recalled context',
|
|
104
112
|
},
|
|
@@ -124,7 +132,7 @@ export const TRIGGER_REGISTRY = [
|
|
|
124
132
|
],
|
|
125
133
|
maxTokens: 1200,
|
|
126
134
|
maxChunks: 3,
|
|
127
|
-
owner: '
|
|
135
|
+
owner: 'alice',
|
|
128
136
|
category: 'operations',
|
|
129
137
|
description: 'Agent tooling reference: CLI commands, config paths, deployment procedures, quick reference',
|
|
130
138
|
},
|