mindgraph 0.1.2 → 0.1.8

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/index.js CHANGED
@@ -93,8 +93,8 @@ var MindGraph = class {
93
93
  return this.get("/stats");
94
94
  }
95
95
  // ---- Reality Layer ----
96
- async ingest(req) {
97
- return this.post("/reality/ingest", req);
96
+ async capture(req) {
97
+ return this.post("/reality/capture", req);
98
98
  }
99
99
  async entity(req) {
100
100
  return this.post("/reality/entity", req);
@@ -108,6 +108,29 @@ var MindGraph = class {
108
108
  agent_id: agentId
109
109
  });
110
110
  }
111
+ /**
112
+ * Resolve text to an existing entity via alias matching.
113
+ * Returns `{ uid: string | null }`.
114
+ */
115
+ async resolveEntity(text, agentId) {
116
+ return this.post("/reality/entity", {
117
+ action: "resolve",
118
+ text,
119
+ agent_id: agentId
120
+ });
121
+ }
122
+ /**
123
+ * Fuzzy-match text against existing entities.
124
+ * Returns `{ matches: [{ uid, label, score }] }`.
125
+ */
126
+ async fuzzyResolveEntity(text, limit = 5, agentId) {
127
+ return this.post("/reality/entity", {
128
+ action: "fuzzy_resolve",
129
+ text,
130
+ limit,
131
+ agent_id: agentId
132
+ });
133
+ }
111
134
  // ---- Epistemic Layer ----
112
135
  async argue(req) {
113
136
  return this.post("/epistemic/argument", req);
@@ -125,6 +148,35 @@ var MindGraph = class {
125
148
  async deliberate(req) {
126
149
  return this.post("/intent/deliberation", req);
127
150
  }
151
+ /** Open a new decision for deliberation. Returns the Decision node. */
152
+ async openDecision(label, opts) {
153
+ return this.post("/intent/deliberation", {
154
+ action: "open_decision",
155
+ label,
156
+ ...opts
157
+ });
158
+ }
159
+ /** Add an option to an open decision. Returns the Option node. */
160
+ async addOption(decisionUid, label, opts) {
161
+ return this.post("/intent/deliberation", {
162
+ action: "add_option",
163
+ decision_uid: decisionUid,
164
+ label,
165
+ ...opts
166
+ });
167
+ }
168
+ /**
169
+ * Resolve a decision by choosing an option.
170
+ * `chosenOptionUid` must be the uid of an option added via `addOption()`.
171
+ */
172
+ async resolveDecision(decisionUid, chosenOptionUid, opts) {
173
+ return this.post("/intent/deliberation", {
174
+ action: "resolve",
175
+ decision_uid: decisionUid,
176
+ chosen_option_uid: chosenOptionUid,
177
+ ...opts
178
+ });
179
+ }
128
180
  // ---- Action Layer ----
129
181
  async procedure(req) {
130
182
  return this.post("/action/procedure", req);
@@ -161,6 +213,7 @@ var MindGraph = class {
161
213
  return this.post("/agent/execution", req);
162
214
  }
163
215
  // ---- Cross-cutting ----
216
+ /** Returns an array of results. Shape varies by action. */
164
217
  async retrieve(req) {
165
218
  return this.post("/retrieve", req);
166
219
  }
@@ -174,8 +227,19 @@ var MindGraph = class {
174
227
  async getNode(uid) {
175
228
  return this.get(`/node/${uid}`);
176
229
  }
230
+ /**
231
+ * Create a node via the low-level CRUD endpoint.
232
+ *
233
+ * The server requires `props._type` to determine the node variant.
234
+ * If `node_type` is provided and `_type` is not already in `props`,
235
+ * it is injected automatically.
236
+ */
177
237
  async addNode(body) {
178
- return this.post("/node", body);
238
+ const props = { ...body.props };
239
+ if (body.node_type && !("_type" in props)) {
240
+ props._type = body.node_type;
241
+ }
242
+ return this.post("/node", { ...body, props });
179
243
  }
180
244
  async updateNode(uid, body) {
181
245
  return this.patch(`/node/${uid}`, body);
@@ -183,16 +247,60 @@ var MindGraph = class {
183
247
  async deleteNode(uid) {
184
248
  await this.del(`/node/${uid}`);
185
249
  }
250
+ async getNodeHistory(uid) {
251
+ return this.get(`/node/${uid}/history`);
252
+ }
253
+ async getNodeAtVersion(uid, version) {
254
+ return this.get(`/node/${uid}/history/${version}`);
255
+ }
186
256
  // ---- Edge CRUD ----
187
257
  async addLink(body) {
188
258
  return this.post("/link", body);
189
259
  }
260
+ /**
261
+ * Create an edge via the low-level CRUD endpoint.
262
+ *
263
+ * The server requires `props._type` to determine the edge variant.
264
+ * If `edge_type` is provided and `_type` is not already in `props`,
265
+ * it is injected automatically.
266
+ */
267
+ async addEdge(body) {
268
+ const props = { ...body.props };
269
+ if (body.edge_type && !("_type" in props)) {
270
+ props._type = body.edge_type;
271
+ }
272
+ return this.post("/edge", { ...body, props });
273
+ }
274
+ async updateEdge(uid, body) {
275
+ return this.patch(`/edge/${uid}`, body);
276
+ }
277
+ async deleteEdge(uid) {
278
+ await this.del(`/edge/${uid}`);
279
+ }
280
+ async getEdgeHistory(uid) {
281
+ return this.get(`/edge/${uid}/history`);
282
+ }
283
+ /**
284
+ * List edges filtered by source and/or target node.
285
+ * At least one of `from_uid` or `to_uid` is **required** —
286
+ * the server returns 400 if neither is provided.
287
+ */
190
288
  async getEdges(params) {
289
+ if (!params.from_uid && !params.to_uid) {
290
+ throw new Error("at least one of from_uid or to_uid is required");
291
+ }
191
292
  const qs = new URLSearchParams();
192
293
  if (params.from_uid) qs.set("from_uid", params.from_uid);
193
294
  if (params.to_uid) qs.set("to_uid", params.to_uid);
194
295
  return this.get(`/edges?${qs}`);
195
296
  }
297
+ async getEdgeBetween(params) {
298
+ const qs = new URLSearchParams();
299
+ qs.set("from_uid", params.from_uid);
300
+ qs.set("to_uid", params.to_uid);
301
+ if (params.edge_type) qs.set("edge_type", params.edge_type);
302
+ return this.get(`/edge/between?${qs}`);
303
+ }
196
304
  // ---- Search ----
197
305
  async search(query, opts) {
198
306
  return this.post("/search", { query, ...opts });
@@ -205,20 +313,95 @@ var MindGraph = class {
205
313
  ...opts
206
314
  });
207
315
  }
316
+ // ---- Nodes listing ----
317
+ async getNodes(params) {
318
+ const qs = new URLSearchParams();
319
+ if (params?.node_type) qs.set("node_type", params.node_type);
320
+ if (params?.layer) qs.set("layer", params.layer);
321
+ if (params?.limit != null) qs.set("limit", String(params.limit));
322
+ if (params?.offset != null) qs.set("offset", String(params.offset));
323
+ return this.get(`/nodes?${qs}`);
324
+ }
325
+ async getAgentNodes(agentId) {
326
+ return this.get(`/agent/${agentId}/nodes`);
327
+ }
328
+ // ---- Batch ----
329
+ async batch(req) {
330
+ return this.post("/batch", req);
331
+ }
332
+ /** Fetch multiple nodes by UID in a single request. */
333
+ async getNodesBatch(uids) {
334
+ return this.post("/nodes/batch", { uids });
335
+ }
336
+ /** Fetch all edges between a set of node UIDs. */
337
+ async getEdgesBatch(uids) {
338
+ return this.post("/edges/batch", { uids });
339
+ }
340
+ // ---- Embeddings ----
341
+ async configureEmbeddings(body) {
342
+ return this.post("/embeddings/configure", body);
343
+ }
344
+ async embeddingSearch(body) {
345
+ return this.post("/embeddings/search", body);
346
+ }
347
+ async embeddingSearchText(body) {
348
+ return this.post("/embeddings/search-text", body);
349
+ }
350
+ async getEmbedding(uid) {
351
+ return this.get(`/node/${uid}/embedding`);
352
+ }
353
+ async setEmbedding(uid, vector) {
354
+ await this.request("PUT", `/node/${uid}/embedding`, { vector });
355
+ }
356
+ async deleteEmbedding(uid) {
357
+ await this.del(`/node/${uid}/embedding`);
358
+ }
359
+ // ---- Entity resolution ----
360
+ async mergeEntities(body) {
361
+ return this.post("/entities/merge", body);
362
+ }
363
+ async addAlias(body) {
364
+ return this.post("/alias", body);
365
+ }
366
+ async getAliases(uid) {
367
+ return this.get(`/aliases/${uid}`);
368
+ }
369
+ async resolveAlias(text) {
370
+ return this.get(`/resolve?text=${encodeURIComponent(text)}`);
371
+ }
372
+ // ---- Export / Import ----
373
+ async exportGraph() {
374
+ return this.get("/export");
375
+ }
376
+ async importGraph(data) {
377
+ return this.post("/import", data);
378
+ }
379
+ // ---- Lifecycle ----
380
+ async decay(req) {
381
+ return this.post("/decay", req);
382
+ }
383
+ async purge(req) {
384
+ return this.post("/purge", req ?? {});
385
+ }
208
386
  // ---- Traversal shortcuts ----
209
387
  async reasoningChain(uid, maxDepth = 5) {
210
- return this.post("/traverse", {
388
+ const r = await this.post("/traverse", {
211
389
  action: "chain",
212
390
  start_uid: uid,
213
391
  max_depth: maxDepth
214
392
  });
393
+ return r?.steps ?? r;
215
394
  }
216
395
  async neighborhood(uid, maxDepth = 1) {
217
- return this.post("/traverse", {
396
+ const r = await this.post("/traverse", {
218
397
  action: "neighborhood",
219
398
  start_uid: uid,
220
399
  max_depth: maxDepth
221
400
  });
401
+ return r?.steps ?? r;
402
+ }
403
+ async subgraph(uid, opts) {
404
+ return this.post("/subgraph", { start_uids: [uid], ...opts });
222
405
  }
223
406
  // ---- Lifecycle shortcuts ----
224
407
  async tombstone(uid, reason, agentId) {
@@ -236,24 +419,63 @@ var MindGraph = class {
236
419
  agent_id: agentId
237
420
  });
238
421
  }
239
- // ---- Management (Cloud only) ----
240
- async signup(email, password) {
241
- return this.post("/v1/auth/signup", { email, password });
422
+ // ---- Epistemic queries ----
423
+ async getGoals() {
424
+ return this.get("/goals");
425
+ }
426
+ async getOpenDecisions() {
427
+ return this.get("/decisions");
428
+ }
429
+ async getOpenQuestions() {
430
+ return this.get("/questions");
431
+ }
432
+ async getWeakClaims() {
433
+ return this.get("/claims/weak");
434
+ }
435
+ async getContradictions() {
436
+ return this.get("/contradictions");
437
+ }
438
+ async getPendingApprovals() {
439
+ return this.get("/approvals/pending");
440
+ }
441
+ // ---- Ingestion & Retrieval ----
442
+ async ingestChunk(req) {
443
+ return this.post("/ingest/chunk", req);
444
+ }
445
+ async ingestDocument(req) {
446
+ return this.post("/ingest/document", req);
447
+ }
448
+ async ingestSession(req) {
449
+ return this.post("/ingest/session", req);
450
+ }
451
+ async retrieveContext(req) {
452
+ return this.post("/retrieve/context", req);
453
+ }
454
+ async listJobs() {
455
+ return this.get("/jobs");
456
+ }
457
+ async getJob(id) {
458
+ return this.get(`/jobs/${id}`);
459
+ }
460
+ async cancelJob(id) {
461
+ return this.post(`/jobs/${id}/cancel`, {});
242
462
  }
243
- async login(email, password) {
244
- return this.post("/v1/auth/login", { email, password });
463
+ /** Resume ingestion of a document that has failed chunks. */
464
+ async resumeDocument(docUid, opts) {
465
+ return this.post(`/ingest/resume/${docUid}`, opts ?? {});
245
466
  }
246
- async createApiKey(name = "default") {
247
- return this.post("/v1/api-keys", { name });
467
+ /** Delete a document and all its chunks and extracted nodes. */
468
+ async deleteDocument(uid) {
469
+ return this.del(`/ingest/document/${uid}`);
248
470
  }
249
- async listApiKeys() {
250
- return this.get("/v1/api-keys");
471
+ async cleanupOrphans() {
472
+ return this.post("/ingest/cleanup", {});
251
473
  }
252
- async revokeApiKey(id) {
253
- await this.del(`/v1/api-keys/${id}`);
474
+ async embedAll() {
475
+ return this.post("/ingest/embed-all", {});
254
476
  }
255
- async getUsage() {
256
- return this.get("/v1/usage");
477
+ async clearGraph() {
478
+ return this.post("/clear", {});
257
479
  }
258
480
  };
259
481
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -66,8 +66,8 @@ var MindGraph = class {
66
66
  return this.get("/stats");
67
67
  }
68
68
  // ---- Reality Layer ----
69
- async ingest(req) {
70
- return this.post("/reality/ingest", req);
69
+ async capture(req) {
70
+ return this.post("/reality/capture", req);
71
71
  }
72
72
  async entity(req) {
73
73
  return this.post("/reality/entity", req);
@@ -81,6 +81,29 @@ var MindGraph = class {
81
81
  agent_id: agentId
82
82
  });
83
83
  }
84
+ /**
85
+ * Resolve text to an existing entity via alias matching.
86
+ * Returns `{ uid: string | null }`.
87
+ */
88
+ async resolveEntity(text, agentId) {
89
+ return this.post("/reality/entity", {
90
+ action: "resolve",
91
+ text,
92
+ agent_id: agentId
93
+ });
94
+ }
95
+ /**
96
+ * Fuzzy-match text against existing entities.
97
+ * Returns `{ matches: [{ uid, label, score }] }`.
98
+ */
99
+ async fuzzyResolveEntity(text, limit = 5, agentId) {
100
+ return this.post("/reality/entity", {
101
+ action: "fuzzy_resolve",
102
+ text,
103
+ limit,
104
+ agent_id: agentId
105
+ });
106
+ }
84
107
  // ---- Epistemic Layer ----
85
108
  async argue(req) {
86
109
  return this.post("/epistemic/argument", req);
@@ -98,6 +121,35 @@ var MindGraph = class {
98
121
  async deliberate(req) {
99
122
  return this.post("/intent/deliberation", req);
100
123
  }
124
+ /** Open a new decision for deliberation. Returns the Decision node. */
125
+ async openDecision(label, opts) {
126
+ return this.post("/intent/deliberation", {
127
+ action: "open_decision",
128
+ label,
129
+ ...opts
130
+ });
131
+ }
132
+ /** Add an option to an open decision. Returns the Option node. */
133
+ async addOption(decisionUid, label, opts) {
134
+ return this.post("/intent/deliberation", {
135
+ action: "add_option",
136
+ decision_uid: decisionUid,
137
+ label,
138
+ ...opts
139
+ });
140
+ }
141
+ /**
142
+ * Resolve a decision by choosing an option.
143
+ * `chosenOptionUid` must be the uid of an option added via `addOption()`.
144
+ */
145
+ async resolveDecision(decisionUid, chosenOptionUid, opts) {
146
+ return this.post("/intent/deliberation", {
147
+ action: "resolve",
148
+ decision_uid: decisionUid,
149
+ chosen_option_uid: chosenOptionUid,
150
+ ...opts
151
+ });
152
+ }
101
153
  // ---- Action Layer ----
102
154
  async procedure(req) {
103
155
  return this.post("/action/procedure", req);
@@ -134,6 +186,7 @@ var MindGraph = class {
134
186
  return this.post("/agent/execution", req);
135
187
  }
136
188
  // ---- Cross-cutting ----
189
+ /** Returns an array of results. Shape varies by action. */
137
190
  async retrieve(req) {
138
191
  return this.post("/retrieve", req);
139
192
  }
@@ -147,8 +200,19 @@ var MindGraph = class {
147
200
  async getNode(uid) {
148
201
  return this.get(`/node/${uid}`);
149
202
  }
203
+ /**
204
+ * Create a node via the low-level CRUD endpoint.
205
+ *
206
+ * The server requires `props._type` to determine the node variant.
207
+ * If `node_type` is provided and `_type` is not already in `props`,
208
+ * it is injected automatically.
209
+ */
150
210
  async addNode(body) {
151
- return this.post("/node", body);
211
+ const props = { ...body.props };
212
+ if (body.node_type && !("_type" in props)) {
213
+ props._type = body.node_type;
214
+ }
215
+ return this.post("/node", { ...body, props });
152
216
  }
153
217
  async updateNode(uid, body) {
154
218
  return this.patch(`/node/${uid}`, body);
@@ -156,16 +220,60 @@ var MindGraph = class {
156
220
  async deleteNode(uid) {
157
221
  await this.del(`/node/${uid}`);
158
222
  }
223
+ async getNodeHistory(uid) {
224
+ return this.get(`/node/${uid}/history`);
225
+ }
226
+ async getNodeAtVersion(uid, version) {
227
+ return this.get(`/node/${uid}/history/${version}`);
228
+ }
159
229
  // ---- Edge CRUD ----
160
230
  async addLink(body) {
161
231
  return this.post("/link", body);
162
232
  }
233
+ /**
234
+ * Create an edge via the low-level CRUD endpoint.
235
+ *
236
+ * The server requires `props._type` to determine the edge variant.
237
+ * If `edge_type` is provided and `_type` is not already in `props`,
238
+ * it is injected automatically.
239
+ */
240
+ async addEdge(body) {
241
+ const props = { ...body.props };
242
+ if (body.edge_type && !("_type" in props)) {
243
+ props._type = body.edge_type;
244
+ }
245
+ return this.post("/edge", { ...body, props });
246
+ }
247
+ async updateEdge(uid, body) {
248
+ return this.patch(`/edge/${uid}`, body);
249
+ }
250
+ async deleteEdge(uid) {
251
+ await this.del(`/edge/${uid}`);
252
+ }
253
+ async getEdgeHistory(uid) {
254
+ return this.get(`/edge/${uid}/history`);
255
+ }
256
+ /**
257
+ * List edges filtered by source and/or target node.
258
+ * At least one of `from_uid` or `to_uid` is **required** —
259
+ * the server returns 400 if neither is provided.
260
+ */
163
261
  async getEdges(params) {
262
+ if (!params.from_uid && !params.to_uid) {
263
+ throw new Error("at least one of from_uid or to_uid is required");
264
+ }
164
265
  const qs = new URLSearchParams();
165
266
  if (params.from_uid) qs.set("from_uid", params.from_uid);
166
267
  if (params.to_uid) qs.set("to_uid", params.to_uid);
167
268
  return this.get(`/edges?${qs}`);
168
269
  }
270
+ async getEdgeBetween(params) {
271
+ const qs = new URLSearchParams();
272
+ qs.set("from_uid", params.from_uid);
273
+ qs.set("to_uid", params.to_uid);
274
+ if (params.edge_type) qs.set("edge_type", params.edge_type);
275
+ return this.get(`/edge/between?${qs}`);
276
+ }
169
277
  // ---- Search ----
170
278
  async search(query, opts) {
171
279
  return this.post("/search", { query, ...opts });
@@ -178,20 +286,95 @@ var MindGraph = class {
178
286
  ...opts
179
287
  });
180
288
  }
289
+ // ---- Nodes listing ----
290
+ async getNodes(params) {
291
+ const qs = new URLSearchParams();
292
+ if (params?.node_type) qs.set("node_type", params.node_type);
293
+ if (params?.layer) qs.set("layer", params.layer);
294
+ if (params?.limit != null) qs.set("limit", String(params.limit));
295
+ if (params?.offset != null) qs.set("offset", String(params.offset));
296
+ return this.get(`/nodes?${qs}`);
297
+ }
298
+ async getAgentNodes(agentId) {
299
+ return this.get(`/agent/${agentId}/nodes`);
300
+ }
301
+ // ---- Batch ----
302
+ async batch(req) {
303
+ return this.post("/batch", req);
304
+ }
305
+ /** Fetch multiple nodes by UID in a single request. */
306
+ async getNodesBatch(uids) {
307
+ return this.post("/nodes/batch", { uids });
308
+ }
309
+ /** Fetch all edges between a set of node UIDs. */
310
+ async getEdgesBatch(uids) {
311
+ return this.post("/edges/batch", { uids });
312
+ }
313
+ // ---- Embeddings ----
314
+ async configureEmbeddings(body) {
315
+ return this.post("/embeddings/configure", body);
316
+ }
317
+ async embeddingSearch(body) {
318
+ return this.post("/embeddings/search", body);
319
+ }
320
+ async embeddingSearchText(body) {
321
+ return this.post("/embeddings/search-text", body);
322
+ }
323
+ async getEmbedding(uid) {
324
+ return this.get(`/node/${uid}/embedding`);
325
+ }
326
+ async setEmbedding(uid, vector) {
327
+ await this.request("PUT", `/node/${uid}/embedding`, { vector });
328
+ }
329
+ async deleteEmbedding(uid) {
330
+ await this.del(`/node/${uid}/embedding`);
331
+ }
332
+ // ---- Entity resolution ----
333
+ async mergeEntities(body) {
334
+ return this.post("/entities/merge", body);
335
+ }
336
+ async addAlias(body) {
337
+ return this.post("/alias", body);
338
+ }
339
+ async getAliases(uid) {
340
+ return this.get(`/aliases/${uid}`);
341
+ }
342
+ async resolveAlias(text) {
343
+ return this.get(`/resolve?text=${encodeURIComponent(text)}`);
344
+ }
345
+ // ---- Export / Import ----
346
+ async exportGraph() {
347
+ return this.get("/export");
348
+ }
349
+ async importGraph(data) {
350
+ return this.post("/import", data);
351
+ }
352
+ // ---- Lifecycle ----
353
+ async decay(req) {
354
+ return this.post("/decay", req);
355
+ }
356
+ async purge(req) {
357
+ return this.post("/purge", req ?? {});
358
+ }
181
359
  // ---- Traversal shortcuts ----
182
360
  async reasoningChain(uid, maxDepth = 5) {
183
- return this.post("/traverse", {
361
+ const r = await this.post("/traverse", {
184
362
  action: "chain",
185
363
  start_uid: uid,
186
364
  max_depth: maxDepth
187
365
  });
366
+ return r?.steps ?? r;
188
367
  }
189
368
  async neighborhood(uid, maxDepth = 1) {
190
- return this.post("/traverse", {
369
+ const r = await this.post("/traverse", {
191
370
  action: "neighborhood",
192
371
  start_uid: uid,
193
372
  max_depth: maxDepth
194
373
  });
374
+ return r?.steps ?? r;
375
+ }
376
+ async subgraph(uid, opts) {
377
+ return this.post("/subgraph", { start_uids: [uid], ...opts });
195
378
  }
196
379
  // ---- Lifecycle shortcuts ----
197
380
  async tombstone(uid, reason, agentId) {
@@ -209,24 +392,63 @@ var MindGraph = class {
209
392
  agent_id: agentId
210
393
  });
211
394
  }
212
- // ---- Management (Cloud only) ----
213
- async signup(email, password) {
214
- return this.post("/v1/auth/signup", { email, password });
395
+ // ---- Epistemic queries ----
396
+ async getGoals() {
397
+ return this.get("/goals");
398
+ }
399
+ async getOpenDecisions() {
400
+ return this.get("/decisions");
401
+ }
402
+ async getOpenQuestions() {
403
+ return this.get("/questions");
404
+ }
405
+ async getWeakClaims() {
406
+ return this.get("/claims/weak");
407
+ }
408
+ async getContradictions() {
409
+ return this.get("/contradictions");
410
+ }
411
+ async getPendingApprovals() {
412
+ return this.get("/approvals/pending");
413
+ }
414
+ // ---- Ingestion & Retrieval ----
415
+ async ingestChunk(req) {
416
+ return this.post("/ingest/chunk", req);
417
+ }
418
+ async ingestDocument(req) {
419
+ return this.post("/ingest/document", req);
420
+ }
421
+ async ingestSession(req) {
422
+ return this.post("/ingest/session", req);
423
+ }
424
+ async retrieveContext(req) {
425
+ return this.post("/retrieve/context", req);
426
+ }
427
+ async listJobs() {
428
+ return this.get("/jobs");
429
+ }
430
+ async getJob(id) {
431
+ return this.get(`/jobs/${id}`);
432
+ }
433
+ async cancelJob(id) {
434
+ return this.post(`/jobs/${id}/cancel`, {});
215
435
  }
216
- async login(email, password) {
217
- return this.post("/v1/auth/login", { email, password });
436
+ /** Resume ingestion of a document that has failed chunks. */
437
+ async resumeDocument(docUid, opts) {
438
+ return this.post(`/ingest/resume/${docUid}`, opts ?? {});
218
439
  }
219
- async createApiKey(name = "default") {
220
- return this.post("/v1/api-keys", { name });
440
+ /** Delete a document and all its chunks and extracted nodes. */
441
+ async deleteDocument(uid) {
442
+ return this.del(`/ingest/document/${uid}`);
221
443
  }
222
- async listApiKeys() {
223
- return this.get("/v1/api-keys");
444
+ async cleanupOrphans() {
445
+ return this.post("/ingest/cleanup", {});
224
446
  }
225
- async revokeApiKey(id) {
226
- await this.del(`/v1/api-keys/${id}`);
447
+ async embedAll() {
448
+ return this.post("/ingest/embed-all", {});
227
449
  }
228
- async getUsage() {
229
- return this.get("/v1/usage");
450
+ async clearGraph() {
451
+ return this.post("/clear", {});
230
452
  }
231
453
  };
232
454
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.1.2",
3
+ "version": "0.1.8",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -14,6 +14,7 @@
14
14
  "keywords": ["mindgraph", "knowledge-graph", "cognitive", "ai", "agent"],
15
15
  "license": "MIT",
16
16
  "devDependencies": {
17
+ "@types/node": "^25.4.0",
17
18
  "tsup": "^8.0.0",
18
19
  "typescript": "^5.7.0",
19
20
  "vitest": "^3.0.0"