opentasks 0.0.9 → 0.1.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/dist/cli.js CHANGED
File without changes
@@ -77,6 +77,10 @@ declare const METHODS: {
77
77
  readonly ANNOTATE_RESPONSE: "opentasks/annotate.response";
78
78
  readonly TASK_REQUEST: "opentasks/task.request";
79
79
  readonly TASK_RESPONSE: "opentasks/task.response";
80
+ readonly GRAPH_CREATE_REQUEST: "opentasks/graph.create.request";
81
+ readonly GRAPH_CREATE_RESPONSE: "opentasks/graph.create.response";
82
+ readonly GRAPH_UPDATE_REQUEST: "opentasks/graph.update.request";
83
+ readonly GRAPH_UPDATE_RESPONSE: "opentasks/graph.update.response";
80
84
  };
81
85
  export { METHODS as MAP_CONNECTOR_METHODS };
82
86
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"map-connector.d.ts","sourceRoot":"","sources":["../../src/providers/map-connector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAO3D;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;AAE9F;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,MAAM,EAAE,eAAe,CAAC;IAExB,kEAAkE;IAClE,IAAI,EAAE,qBAAqB,CAAC;IAE5B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE1E,mCAAmC;I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AkB,GAAG,YAAY,CAwJ3E"}
@@ -48,6 +48,10 @@ const METHODS = {
48
48
  ANNOTATE_RESPONSE: 'opentasks/annotate.response',
49
49
  TASK_REQUEST: 'opentasks/task.request',
50
50
  TASK_RESPONSE: 'opentasks/task.response',
51
+ GRAPH_CREATE_REQUEST: 'opentasks/graph.create.request',
52
+ GRAPH_CREATE_RESPONSE: 'opentasks/graph.create.response',
53
+ GRAPH_UPDATE_REQUEST: 'opentasks/graph.update.request',
54
+ GRAPH_UPDATE_RESPONSE: 'opentasks/graph.update.response',
51
55
  };
52
56
  export { METHODS as MAP_CONNECTOR_METHODS };
53
57
  // ============================================================================
@@ -123,6 +127,44 @@ export function createMAPConnector(config) {
123
127
  });
124
128
  }
125
129
  }
130
+ async function handleGraphCreate(requestId, params) {
131
+ try {
132
+ const node = await client.createNode(params);
133
+ send(METHODS.GRAPH_CREATE_RESPONSE, {
134
+ request_id: requestId,
135
+ node,
136
+ });
137
+ }
138
+ catch (err) {
139
+ send(METHODS.GRAPH_CREATE_RESPONSE, {
140
+ request_id: requestId,
141
+ error: err.message,
142
+ });
143
+ }
144
+ }
145
+ async function handleGraphUpdate(requestId, params) {
146
+ try {
147
+ const { id, ...updates } = params;
148
+ if (!id) {
149
+ send(METHODS.GRAPH_UPDATE_RESPONSE, {
150
+ request_id: requestId,
151
+ error: 'Missing id',
152
+ });
153
+ return;
154
+ }
155
+ const node = await client.updateNode(id, updates);
156
+ send(METHODS.GRAPH_UPDATE_RESPONSE, {
157
+ request_id: requestId,
158
+ node,
159
+ });
160
+ }
161
+ catch (err) {
162
+ send(METHODS.GRAPH_UPDATE_RESPONSE, {
163
+ request_id: requestId,
164
+ error: err.message,
165
+ });
166
+ }
167
+ }
126
168
  return {
127
169
  handleNotification(method, params) {
128
170
  if (!active)
@@ -145,6 +187,12 @@ export function createMAPConnector(config) {
145
187
  case METHODS.TASK_REQUEST:
146
188
  handleTask(requestId, (params.task ?? params)).catch(() => { });
147
189
  break;
190
+ case METHODS.GRAPH_CREATE_REQUEST:
191
+ handleGraphCreate(requestId, (params.create ?? params)).catch(() => { });
192
+ break;
193
+ case METHODS.GRAPH_UPDATE_REQUEST:
194
+ handleGraphUpdate(requestId, (params.update ?? params)).catch(() => { });
195
+ break;
148
196
  // Ignore unknown methods
149
197
  }
150
198
  },
@@ -1 +1 @@
1
- {"version":3,"file":"map-connector.js","sourceRoot":"","sources":["../../src/providers/map-connector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AA+CH,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,MAAM,OAAO,GAAG;IACd,aAAa,EAAE,yBAAyB;IACxC,cAAc,EAAE,0BAA0B;IAC1C,YAAY,EAAE,wBAAwB;IACtC,aAAa,EAAE,yBAAyB;IACxC,gBAAgB,EAAE,4BAA4B;IAC9C,iBAAiB,EAAE,6BAA6B;IAChD,YAAY,EAAE,wBAAwB;IACtC,aAAa,EAAE,yBAAyB;CAChC,CAAC;AAEX,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,CAAC;AAE5C,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA0B;IAC3D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACzC,IAAI,MAAM,GAAG,IAAI,CAAC;IAElB,KAAK,UAAU,WAAW,CAAC,SAAiB,EAAE,KAAkB;QAC9D,IAAI,CAAC;YACH,MAAM,MAAM,GAAgB,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;gBAC3B,UAAU,EAAE,SAAS;gBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,cAAc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AM;gBACR,KAAK,OAAO,CAAC,oBAAoB;oBAC/B,iBAAiB,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAoB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;oBAC3F,MAAM;gBACR,KAAK,OAAO,CAAC,oBAAoB;oBAC/B,iBAAiB,CACf,SAAS,EACT,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAqC,CAC9D,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;oBAClB,MAAM;gBACR,yBAAyB;YAC3B,CAAC;QACH,CAAC;QAED,IAAI;YACF,MAAM,GAAG,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,MAAM;YACR,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opentasks",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "description": "Universal task graph data structure",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,71 +0,0 @@
1
- /**
2
- * Entire Auto-Linker
3
- *
4
- * Correlation engine that automatically creates edges between OpenTasks
5
- * tasks and Entire sessions/checkpoints. Matches sessions to tasks via
6
- * claims, in-progress status, and branch association.
7
- */
8
- import type { GraphStore } from '../graph/store.js';
9
- import type { DaemonFlushManager } from './flush.js';
10
- import type { EntireSessionEvent, EntireSessionState } from './entire-watcher.js';
11
- import type { MaterializationArchiver } from '../materialization/types.js';
12
- import type { SkillTrackerRegistry } from '../tracking/skill-tracker.js';
13
- /**
14
- * Correlation confidence level
15
- */
16
- export type CorrelationConfidence = 'high' | 'medium' | 'low';
17
- /**
18
- * How a task was matched to a session
19
- */
20
- export type CorrelationStrategy = 'claimed-task' | 'in-progress-branch' | 'in-progress-any';
21
- /**
22
- * A task matched to an Entire session
23
- */
24
- export interface MatchedTask {
25
- nodeId: string;
26
- uri?: string;
27
- matchReason: CorrelationStrategy;
28
- confidence: CorrelationConfidence;
29
- }
30
- /**
31
- * Result of correlating a session with tasks
32
- */
33
- export interface CorrelationResult {
34
- sessionId: string;
35
- matchedTasks: MatchedTask[];
36
- edgesCreated: string[];
37
- nodesCreated: string[];
38
- strategy: CorrelationStrategy | 'none';
39
- timestamp: string;
40
- }
41
- /**
42
- * Configuration for the auto-linker
43
- */
44
- export interface EntireAutoLinkerConfig {
45
- /** Graph store for creating nodes and edges */
46
- store: GraphStore;
47
- /** Flush manager for scheduling persistence */
48
- flushManager: DaemonFlushManager;
49
- /** Minimum confidence for auto-linking (default: 'medium') */
50
- minConfidence?: CorrelationConfidence;
51
- /** Optional archiver for durable session snapshots */
52
- archiver?: MaterializationArchiver;
53
- /** Skill tracker registry for embedding skill usage in session nodes */
54
- skillTrackerRegistry?: SkillTrackerRegistry;
55
- }
56
- /**
57
- * Auto-linker interface
58
- */
59
- export interface EntireAutoLinker {
60
- /** Handle a session event from the watcher */
61
- handleSessionEvent(event: EntireSessionEvent): Promise<void>;
62
- /** Manually trigger correlation for a session */
63
- correlate(sessionId: string, session: EntireSessionState): Promise<CorrelationResult>;
64
- /** Get correlation history */
65
- getCorrelations(): Map<string, CorrelationResult>;
66
- }
67
- /**
68
- * Create an Entire auto-linker
69
- */
70
- export declare function createEntireAutoLinker(config: EntireAutoLinkerConfig): EntireAutoLinker;
71
- //# sourceMappingURL=entire-linker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entire-linker.d.ts","sourceRoot":"","sources":["../../src/daemon/entire-linker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,KAAK,EAAE,uBAA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,CAAC,CAAC;IAEtF,8BAA8B;IAC9B,eAAe,IAAI,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CACnD;AAuBD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,gBAAgB,CAofvF"}
@@ -1,466 +0,0 @@
1
- /**
2
- * Entire Auto-Linker
3
- *
4
- * Correlation engine that automatically creates edges between OpenTasks
5
- * tasks and Entire sessions/checkpoints. Matches sessions to tasks via
6
- * claims, in-progress status, and branch association.
7
- */
8
- // ============================================================================
9
- // Confidence Ordering
10
- // ============================================================================
11
- const CONFIDENCE_ORDER = {
12
- high: 3,
13
- medium: 2,
14
- low: 1,
15
- };
16
- function meetsConfidenceThreshold(confidence, minimum) {
17
- return CONFIDENCE_ORDER[confidence] >= CONFIDENCE_ORDER[minimum];
18
- }
19
- // ============================================================================
20
- // Implementation
21
- // ============================================================================
22
- /**
23
- * Create an Entire auto-linker
24
- */
25
- export function createEntireAutoLinker(config) {
26
- const { store, flushManager, archiver, skillTrackerRegistry } = config;
27
- const minConfidence = config.minConfidence ?? 'medium';
28
- // Track which sessions have been linked to avoid duplicates
29
- const correlations = new Map();
30
- // Track created external nodes: URI → node ID mapping
31
- const createdNodes = new Map();
32
- /**
33
- * Find tasks correlated with a session
34
- */
35
- async function findCorrelatedTasks(session) {
36
- const matched = [];
37
- // Strategy 1: Claimed tasks (high confidence)
38
- try {
39
- const allIssues = await store.query.nodes({
40
- type: 'task',
41
- status: 'in_progress',
42
- archived: false,
43
- });
44
- for (const issue of allIssues) {
45
- const raw = issue;
46
- const claimedBy = raw.claimed_by;
47
- const lockUntil = raw.lock_until;
48
- if (claimedBy && (!lockUntil || new Date(lockUntil) > new Date())) {
49
- matched.push({
50
- nodeId: issue.id,
51
- uri: raw.uri,
52
- matchReason: 'claimed-task',
53
- confidence: 'high',
54
- });
55
- }
56
- }
57
- }
58
- catch {
59
- // Continue to next strategy
60
- }
61
- if (matched.length > 0)
62
- return matched;
63
- // Strategy 2: In-progress tasks on same branch (medium confidence)
64
- if (session.branch) {
65
- try {
66
- const allIssues = await store.query.nodes({
67
- type: 'task',
68
- status: 'in_progress',
69
- archived: false,
70
- });
71
- for (const issue of allIssues) {
72
- const raw = issue;
73
- if (raw.branch === session.branch) {
74
- matched.push({
75
- nodeId: issue.id,
76
- uri: raw.uri,
77
- matchReason: 'in-progress-branch',
78
- confidence: 'medium',
79
- });
80
- }
81
- }
82
- }
83
- catch {
84
- // Continue to next strategy
85
- }
86
- }
87
- if (matched.length > 0)
88
- return matched;
89
- // Strategy 3: Any in-progress task (low confidence)
90
- // Only if exactly one in-progress task exists (ambiguity guard)
91
- try {
92
- const allInProgress = await store.query.nodes({
93
- type: 'task',
94
- status: 'in_progress',
95
- archived: false,
96
- });
97
- if (allInProgress.length === 1) {
98
- const raw = allInProgress[0];
99
- matched.push({
100
- nodeId: allInProgress[0].id,
101
- uri: raw.uri,
102
- matchReason: 'in-progress-any',
103
- confidence: 'low',
104
- });
105
- }
106
- }
107
- catch {
108
- // No matches
109
- }
110
- return matched;
111
- }
112
- /**
113
- * Ensure an external node exists for an Entire session.
114
- * Returns the node's actual graph ID (not the URI).
115
- */
116
- async function ensureSessionNode(session) {
117
- const uri = `entire://session/${session.id}`;
118
- const cachedId = createdNodes.get(uri);
119
- if (cachedId)
120
- return cachedId;
121
- // Check if node already exists
122
- const existing = await store.query.nodes({
123
- type: 'external',
124
- search: uri,
125
- limit: 1,
126
- });
127
- if (existing.length > 0) {
128
- const nodeId = existing[0].id;
129
- createdNodes.set(uri, nodeId);
130
- return nodeId;
131
- }
132
- try {
133
- const node = await store.createNode({
134
- type: 'external',
135
- title: `Session: ${session.id}`,
136
- uri,
137
- source: 'entire',
138
- metadata: {
139
- entityType: 'session',
140
- agent: session.agent,
141
- phase: session.phase,
142
- baseCommit: session.baseCommit,
143
- branch: session.branch,
144
- startedAt: session.startedAt,
145
- },
146
- });
147
- const nodeId = node.id;
148
- createdNodes.set(uri, nodeId);
149
- flushManager.markDirty(nodeId);
150
- flushManager.schedule();
151
- return nodeId;
152
- }
153
- catch {
154
- // Node may already exist from a concurrent operation — re-query
155
- const retryExisting = await store.query.nodes({
156
- type: 'external',
157
- search: uri,
158
- limit: 1,
159
- });
160
- if (retryExisting.length > 0) {
161
- const nodeId = retryExisting[0].id;
162
- createdNodes.set(uri, nodeId);
163
- return nodeId;
164
- }
165
- // Fallback: use URI as ID (should not happen in practice)
166
- createdNodes.set(uri, uri);
167
- return uri;
168
- }
169
- }
170
- /**
171
- * Ensure an external node exists for an Entire checkpoint.
172
- * Returns the node's actual graph ID (not the URI).
173
- */
174
- async function ensureCheckpointNode(checkpointId, session) {
175
- const uri = `entire://checkpoint/${checkpointId}`;
176
- const cachedId = createdNodes.get(uri);
177
- if (cachedId)
178
- return cachedId;
179
- // Check if node already exists
180
- const existing = await store.query.nodes({
181
- type: 'external',
182
- search: uri,
183
- limit: 1,
184
- });
185
- if (existing.length > 0) {
186
- const nodeId = existing[0].id;
187
- createdNodes.set(uri, nodeId);
188
- return nodeId;
189
- }
190
- try {
191
- const node = await store.createNode({
192
- type: 'external',
193
- title: `Checkpoint: ${checkpointId}`,
194
- uri,
195
- source: 'entire',
196
- metadata: {
197
- entityType: 'checkpoint',
198
- sessionId: session.id,
199
- },
200
- });
201
- const nodeId = node.id;
202
- createdNodes.set(uri, nodeId);
203
- flushManager.markDirty(nodeId);
204
- flushManager.schedule();
205
- return nodeId;
206
- }
207
- catch {
208
- // Re-query in case of concurrent creation
209
- const retryExisting = await store.query.nodes({
210
- type: 'external',
211
- search: uri,
212
- limit: 1,
213
- });
214
- if (retryExisting.length > 0) {
215
- const nodeId = retryExisting[0].id;
216
- createdNodes.set(uri, nodeId);
217
- return nodeId;
218
- }
219
- createdNodes.set(uri, uri);
220
- return uri;
221
- }
222
- }
223
- /**
224
- * Create an edge if it doesn't already exist
225
- */
226
- async function createEdgeIfNotExists(fromId, toId, type, metadata) {
227
- // Check for existing edge
228
- try {
229
- const existingEdges = await store.query.edges({
230
- from_id: fromId,
231
- to_id: toId,
232
- type,
233
- });
234
- if (existingEdges.length > 0) {
235
- return existingEdges[0].id;
236
- }
237
- }
238
- catch {
239
- // Continue to create
240
- }
241
- try {
242
- const edge = await store.createEdge({
243
- from_id: fromId,
244
- to_id: toId,
245
- type,
246
- metadata: {
247
- ...metadata,
248
- _context: {
249
- source: 'entire-auto-linker',
250
- timestamp: new Date().toISOString(),
251
- ...metadata?._context,
252
- },
253
- },
254
- });
255
- flushManager.markDirty(fromId);
256
- flushManager.markDirty(toId);
257
- flushManager.schedule();
258
- return edge.id;
259
- }
260
- catch {
261
- return null;
262
- }
263
- }
264
- return {
265
- async handleSessionEvent(event) {
266
- const { type, sessionId, session } = event;
267
- switch (type) {
268
- case 'started': {
269
- // Create session node — returns the node's graph ID
270
- const sessionNodeId = await ensureSessionNode(session);
271
- // Correlate with tasks
272
- const tasks = await findCorrelatedTasks(session);
273
- const edgesCreated = [];
274
- const matchedForResult = [];
275
- for (const task of tasks) {
276
- if (!meetsConfidenceThreshold(task.confidence, minConfidence))
277
- continue;
278
- matchedForResult.push(task);
279
- const edgeId = await createEdgeIfNotExists(task.nodeId, sessionNodeId, 'worked-on', {
280
- _context: {
281
- correlation: task.matchReason,
282
- confidence: task.confidence,
283
- sessionAgent: session.agent,
284
- },
285
- });
286
- if (edgeId)
287
- edgesCreated.push(edgeId);
288
- }
289
- correlations.set(sessionId, {
290
- sessionId,
291
- matchedTasks: matchedForResult,
292
- edgesCreated,
293
- nodesCreated: [sessionNodeId],
294
- strategy: matchedForResult[0]?.matchReason ?? 'none',
295
- timestamp: new Date().toISOString(),
296
- });
297
- // Archive if configured
298
- if (archiver) {
299
- const sessionUri = `entire://session/${session.id}`;
300
- void archiver.onSessionEvent('started', sessionUri, store).catch(() => { });
301
- }
302
- break;
303
- }
304
- case 'checkpoint': {
305
- if (!event.checkpointId)
306
- break;
307
- // Ensure session and checkpoint nodes exist — returns graph IDs
308
- const sessionNodeId = await ensureSessionNode(session);
309
- const checkpointNodeId = await ensureCheckpointNode(event.checkpointId, session);
310
- const edgesCreated = [];
311
- // Create contains edge (session → checkpoint)
312
- const containsId = await createEdgeIfNotExists(sessionNodeId, checkpointNodeId, 'contains');
313
- if (containsId)
314
- edgesCreated.push(containsId);
315
- // Create implemented-by edges (tasks → checkpoint)
316
- const tasks = await findCorrelatedTasks(session);
317
- const matchedForResult = [];
318
- for (const task of tasks) {
319
- if (!meetsConfidenceThreshold(task.confidence, minConfidence))
320
- continue;
321
- matchedForResult.push(task);
322
- const edgeId = await createEdgeIfNotExists(task.nodeId, checkpointNodeId, 'implemented-by', {
323
- _context: {
324
- correlation: task.matchReason,
325
- confidence: task.confidence,
326
- checkpointId: event.checkpointId,
327
- },
328
- });
329
- if (edgeId)
330
- edgesCreated.push(edgeId);
331
- }
332
- // Update existing correlation record
333
- const existing = correlations.get(sessionId);
334
- if (existing) {
335
- existing.edgesCreated.push(...edgesCreated);
336
- existing.nodesCreated.push(checkpointNodeId);
337
- }
338
- // Archive checkpoint if configured
339
- if (archiver) {
340
- const sessionUri = `entire://session/${session.id}`;
341
- void archiver.onSessionEvent('checkpoint', sessionUri, store).catch(() => { });
342
- }
343
- break;
344
- }
345
- case 'ended': {
346
- // Update session node status if it exists
347
- try {
348
- const nodes = await store.query.nodes({
349
- type: 'external',
350
- search: `entire://session/${sessionId}`,
351
- limit: 1,
352
- });
353
- if (nodes.length > 0) {
354
- // Pull skill usage from the tracker registry (if available)
355
- const updateMetadata = {
356
- phase: 'ENDED',
357
- endedAt: session.endedAt,
358
- };
359
- if (skillTrackerRegistry) {
360
- // Finalize the tracker: remove it and get the final summary
361
- const skillSummary = skillTrackerRegistry.remove(sessionId);
362
- if (skillSummary && skillSummary.totalInvocations > 0) {
363
- // Build the compact skillsUsed structure for the session node
364
- const counts = {};
365
- const outcomes = {};
366
- for (const stat of skillSummary.stats) {
367
- counts[stat.skill] = stat.count;
368
- outcomes[stat.skill] = {
369
- success: stat.successCount,
370
- failure: stat.failureCount,
371
- };
372
- }
373
- updateMetadata.skillsUsed = {
374
- skills: skillSummary.skillsUsed,
375
- totalInvocations: skillSummary.totalInvocations,
376
- counts,
377
- outcomes,
378
- };
379
- }
380
- }
381
- await store.updateNode(nodes[0].id, {
382
- status: 'closed',
383
- metadata: updateMetadata,
384
- });
385
- flushManager.markDirty(nodes[0].id);
386
- flushManager.schedule();
387
- // Archive final session state if configured
388
- if (archiver) {
389
- const sessionUri = `entire://session/${sessionId}`;
390
- void archiver.onSessionEvent('ended', sessionUri, store).catch(() => { });
391
- }
392
- }
393
- }
394
- catch {
395
- // Best-effort update
396
- }
397
- break;
398
- }
399
- case 'updated': {
400
- // Update session node metadata if it exists
401
- try {
402
- const nodes = await store.query.nodes({
403
- type: 'external',
404
- search: `entire://session/${sessionId}`,
405
- limit: 1,
406
- });
407
- if (nodes.length > 0) {
408
- await store.updateNode(nodes[0].id, {
409
- metadata: {
410
- phase: session.phase,
411
- lastPromptAt: session.lastPromptAt,
412
- },
413
- });
414
- flushManager.markDirty(nodes[0].id);
415
- flushManager.schedule();
416
- }
417
- }
418
- catch {
419
- // Best-effort update
420
- }
421
- break;
422
- }
423
- case 'deleted': {
424
- // Preserve history — don't delete nodes or edges
425
- break;
426
- }
427
- }
428
- },
429
- async correlate(sessionId, session) {
430
- // Create session node
431
- const sessionNodeId = await ensureSessionNode(session);
432
- // Correlate with tasks
433
- const tasks = await findCorrelatedTasks(session);
434
- const edgesCreated = [];
435
- const matchedForResult = [];
436
- for (const task of tasks) {
437
- if (!meetsConfidenceThreshold(task.confidence, minConfidence))
438
- continue;
439
- matchedForResult.push(task);
440
- const edgeId = await createEdgeIfNotExists(task.nodeId, sessionNodeId, 'worked-on', {
441
- _context: {
442
- correlation: task.matchReason,
443
- confidence: task.confidence,
444
- sessionAgent: session.agent,
445
- },
446
- });
447
- if (edgeId)
448
- edgesCreated.push(edgeId);
449
- }
450
- const result = {
451
- sessionId,
452
- matchedTasks: matchedForResult,
453
- edgesCreated,
454
- nodesCreated: [sessionNodeId],
455
- strategy: matchedForResult[0]?.matchReason ?? 'none',
456
- timestamp: new Date().toISOString(),
457
- };
458
- correlations.set(sessionId, result);
459
- return result;
460
- },
461
- getCorrelations() {
462
- return new Map(correlations);
463
- },
464
- };
465
- }
466
- //# sourceMappingURL=entire-linker.js.map