@ivotoby/postgram-cli 1.2.0 → 1.4.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/README.md CHANGED
@@ -56,6 +56,9 @@ pgm task complete <task-id> --version 1
56
56
  # Sync markdown directory
57
57
  pgm sync ./notes --repo my-notes
58
58
 
59
+ # Check enrichment/extraction queue status
60
+ pgm queue
61
+
59
62
  # JSON output (all commands)
60
63
  pgm store "hello" --json
61
64
  ```
package/dist/client.js CHANGED
@@ -159,6 +159,9 @@ export function createPgmClient(options) {
159
159
  const query = qs.toString();
160
160
  return request(options, `/api/entities/${entityId}/edges${query ? `?${query}` : ''}`);
161
161
  },
162
+ getQueueStatus() {
163
+ return request(options, '/api/queue');
164
+ },
162
165
  expandGraph(entityId, params = {}) {
163
166
  const qs = new URLSearchParams();
164
167
  if (params.depth !== undefined)
package/dist/pgm.js CHANGED
@@ -29,6 +29,13 @@ function formatSearchResults(results) {
29
29
  if (result.entity.content && result.entity.content !== result.chunk_content) {
30
30
  lines.push(` entity: ${result.entity.content}`);
31
31
  }
32
+ if (result.related && result.related.length > 0) {
33
+ lines.push(` related (${result.related.length}):`);
34
+ for (const rel of result.related) {
35
+ const arrow = rel.direction === 'outgoing' ? '->' : '<-';
36
+ lines.push(` ${arrow} [${rel.relation}] ${rel.entity.type} ${shortId(rel.entity.id)}`);
37
+ }
38
+ }
32
39
  }
33
40
  return lines;
34
41
  }
@@ -237,6 +244,7 @@ program
237
244
  .option('--limit <limit>', 'result limit', '10')
238
245
  .option('--threshold <threshold>', 'similarity threshold', '0.35')
239
246
  .option('--recency-weight <recencyWeight>', 'recency weight', '0.1')
247
+ .option('--expand-graph', 'include graph-connected entities in results')
240
248
  .action(async (query, options, command) => {
241
249
  await runWithClient(command, async (client, json) => {
242
250
  const body = await client.searchEntities({
@@ -247,7 +255,8 @@ program
247
255
  owner: options.owner,
248
256
  limit: Number(options.limit),
249
257
  threshold: Number(options.threshold),
250
- recency_weight: Number(options.recencyWeight)
258
+ recency_weight: Number(options.recencyWeight),
259
+ expand_graph: options.expandGraph === true ? true : undefined
251
260
  });
252
261
  return json ? body : formatSearchResults(body.results);
253
262
  });
@@ -476,6 +485,29 @@ taskCommand
476
485
  });
477
486
  });
478
487
  });
488
+ program
489
+ .command('queue')
490
+ .description('Show enrichment and extraction queue status')
491
+ .action(async (_options, command) => {
492
+ await runWithClient(command, async (client, json) => {
493
+ const body = await client.getQueueStatus();
494
+ if (json)
495
+ return body;
496
+ const e = body.embedding;
497
+ const age = e.oldest_pending_secs !== null ? ` oldest_pending=${e.oldest_pending_secs}s` : '';
498
+ const lines = [
499
+ `embedding: pending=${e.pending} completed=${e.completed} failed=${e.failed} retry_eligible=${e.retry_eligible}${age}`
500
+ ];
501
+ if (body.extraction) {
502
+ const x = body.extraction;
503
+ lines.push(`extraction: pending=${x.pending} completed=${x.completed} failed=${x.failed}`);
504
+ }
505
+ else {
506
+ lines.push('extraction: disabled');
507
+ }
508
+ return lines;
509
+ });
510
+ });
479
511
  program
480
512
  .command('backup')
481
513
  .description('Create a database backup')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ivotoby/postgram-cli",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Postgram CLI — store, search, and manage entities from the command line",
5
5
  "type": "module",
6
6
  "bin": {