total-recall-brain 3.41.5 ā 3.41.6
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/bin/total-recall.mjs +7 -4
- package/frontend/dist/assets/index-4tGQfTa2.js +5605 -0
- package/frontend/dist/assets/index-DtwsDyFM.css +1 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/package.json +11 -0
- package/frontend/src/App.tsx +47 -122
- package/frontend/src/components/plugins/plugin-frame.ts +1 -0
- package/frontend/src/index.css +152 -86
- package/frontend/src/pages/HelpPage.tsx +13 -10
- package/frontend/src/pages/MemoryPage.tsx +28 -30
- package/frontend/src/pages/NetworkPage.tsx +3 -3
- package/frontend/src/pages/PluginsPage.tsx +6 -5
- package/frontend/src/pages/RulesPage.tsx +16 -12
- package/package.json +3 -2
- package/scaffold/.agent/skills/total-recall/plugins/code-quality/package-lock.json +8 -8
- package/scaffold/.agent/skills/total-recall/plugins/code-quality/package.json +3 -0
- package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package-lock.json +8 -8
- package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package.json +3 -0
- package/scaffold/.agent/skills/total-recall/plugins/embeddings/package-lock.json +8 -8
- package/scaffold/.agent/skills/total-recall/plugins/embeddings/package.json +3 -0
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package-lock.json +8 -8
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package.json +3 -0
- package/scaffold/.agent/skills/total-recall/plugins/mesh/package-lock.json +8 -8
- package/scaffold/.agent/skills/total-recall/plugins/mesh/package.json +4 -1
- package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh.mjs +1 -1
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/capability/index.mjs +136 -7
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/cli.mjs +135 -26
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/package-lock.json +8 -8
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/package.json +4 -1
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/plugin.json +228 -9
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/skills/meta-harness/SKILL.md +24 -30
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/alerts.mjs +29 -16
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/cascade.mjs +73 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/coordinator.mjs +182 -365
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/dispatch.mjs +33 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/documentation.mjs +9 -3
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/executor.mjs +4 -4
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/agy.mjs +187 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/claude.mjs +275 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/cline.mjs +132 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/codex.mjs +187 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/cursor.mjs +158 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/devin.mjs +157 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/dsh.mjs +183 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/grok.mjs +132 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/hermes.mjs +173 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/index.mjs +87 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/openclaw.mjs +173 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/pi.mjs +129 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate.mjs +12 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/json-reply.mjs +22 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/learner.mjs +72 -70
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/model-catalog.mjs +195 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/paths.mjs +11 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/pool.mjs +36 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/review.mjs +169 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/router.mjs +136 -346
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/runtime.mjs +1 -1
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/ssss-store.mjs +20 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/telemetry.mjs +43 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/threads.mjs +156 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/worker.mjs +117 -35
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/worktree.mjs +51 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/ui/card.js +398 -57
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/cli.mjs +10 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/package-lock.json +3 -3
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/package.json +3 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/plugin.json +42 -190
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/openwiki.mjs +1 -1
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/skills/mermaid-diagrams/SKILL.md +44 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/skills/write-connector/SKILL.md +56 -0
- package/scaffold/.agent/skills/total-recall/plugins/security/package-lock.json +8 -8
- package/scaffold/.agent/skills/total-recall/plugins/security/package.json +3 -0
- package/src/cli/agent.mjs +12 -1
- package/src/cli/compact.mjs +2 -2
- package/src/cli/connect.mjs +56 -1
- package/src/cli/context.mjs +10 -7
- package/src/cli/doctor.mjs +5 -2
- package/src/cli/harness.mjs +62 -50
- package/src/cli/memory-entry.mjs +2 -2
- package/src/cli/preflight.mjs +152 -16
- package/src/cli/remember.mjs +19 -1
- package/src/cli/rules.mjs +54 -12
- package/src/cli/startup.mjs +1 -1
- package/src/cli/status.mjs +12 -2
- package/src/core/claude-hooks.mjs +41 -3
- package/src/core/cli-semantic-index.mjs +3 -2
- package/src/core/conflict-detector.mjs +23 -12
- package/src/core/context-compactor.mjs +2 -0
- package/src/core/context-policy.mjs +20 -0
- package/src/core/duplicate-guard.mjs +350 -0
- package/src/core/meta-harness.mjs +31 -11
- package/src/core/preflight-gate.mjs +2 -2
- package/src/core/preflight-receipt.mjs +28 -0
- package/src/core/scaffold-plugins.mjs +7 -0
- package/src/core/stdio-flush.mjs +23 -0
- package/src/core/surface.mjs +33 -10
- package/src/server/routes/plugins.mjs +2 -2
- package/frontend/dist/assets/index-BIQmqDKP.css +0 -1
- package/frontend/dist/assets/index-WT3gs-x6.js +0 -5631
- package/frontend/src/components/DaemonLogsTab.tsx +0 -54
- package/frontend/src/components/ResearchAgendaTab.tsx +0 -712
- package/frontend/src/components/TaskQueueTab.tsx +0 -193
- package/frontend/src/components/VoiceInput.tsx +0 -112
- package/frontend/src/pages/ChatPage.tsx +0 -1059
- package/frontend/src/pages/CollabPage.tsx +0 -470
- package/frontend/src/pages/DesignDocsPage.tsx +0 -621
- package/frontend/src/pages/FilesPage.tsx +0 -393
- package/frontend/src/pages/HealthPage.tsx +0 -359
- package/frontend/src/pages/InboxPage.tsx +0 -83
- package/frontend/src/pages/InstructionsPage.tsx +0 -583
- package/frontend/src/pages/IntegrationsPage.tsx +0 -761
- package/frontend/src/pages/MeshPage.css +0 -58
- package/frontend/src/pages/MeshPage.tsx +0 -1219
- package/frontend/src/pages/OkfPage.tsx +0 -535
- package/frontend/src/pages/SandboxPage.tsx +0 -113
- package/frontend/src/pages/SkillsPage.tsx +0 -1994
- package/frontend/src/pages/TasksPage.tsx +0 -427
- package/frontend/src/pages/UsagePage.tsx +0 -702
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/README.md +0 -65
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/cli.mjs +0 -76
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/package.json +0 -19
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/plugin.json +0 -266
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/adapters/dsh.mjs +0 -446
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/documentation.mjs +0 -152
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/executor.mjs +0 -71
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/runtime.mjs +0 -36
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/setup.mjs +0 -35
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/worker.mjs +0 -175
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/ui/DESIGN.md +0 -32
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/ui/card.js +0 -575
|
@@ -1590,9 +1590,9 @@
|
|
|
1590
1590
|
},
|
|
1591
1591
|
"node_modules/@ssss/cli": {
|
|
1592
1592
|
"name": "@gregiteen/ssss-cli",
|
|
1593
|
-
"version": "0.14.
|
|
1594
|
-
"resolved": "https://registry.npmjs.org/@gregiteen/ssss-cli/-/ssss-cli-0.14.
|
|
1595
|
-
"integrity": "sha512-
|
|
1593
|
+
"version": "0.14.4",
|
|
1594
|
+
"resolved": "https://registry.npmjs.org/@gregiteen/ssss-cli/-/ssss-cli-0.14.4.tgz",
|
|
1595
|
+
"integrity": "sha512-R6JIgPRvS9xXp0xb6BYO3rauv+72r35GIiDrJcvbjPdTSHFZXr8/jRxFOgoF8yTed/5xyGFF3ey3DI9bOjmHVA==",
|
|
1596
1596
|
"dev": true,
|
|
1597
1597
|
"license": "ISC",
|
|
1598
1598
|
"bin": {
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"intent": "Watch upstream OpenWiki repository and announce/propagate updates",
|
|
11
11
|
"schedule": "0 */4 * * *",
|
|
12
12
|
"command": "watch"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"intent": "Auto-refresh OpenWiki documentation for repositories with new commits",
|
|
16
|
+
"schedule": "*/30 * * * *",
|
|
17
|
+
"command": "auto-refresh",
|
|
18
|
+
"timeout_ms": 600000
|
|
13
19
|
}
|
|
14
20
|
],
|
|
15
21
|
"branding": {
|
|
@@ -31,31 +37,23 @@
|
|
|
31
37
|
}
|
|
32
38
|
],
|
|
33
39
|
"card_face": {
|
|
34
|
-
"headline": "OpenWiki
|
|
40
|
+
"headline": "OpenWiki Control Deck",
|
|
35
41
|
"quick_actions": [
|
|
36
42
|
{
|
|
37
|
-
"subcommand": "
|
|
38
|
-
"label": "
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"subcommand": "search",
|
|
42
|
-
"label": "SEARCH"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"subcommand": "graph",
|
|
46
|
-
"label": "GRAPH"
|
|
43
|
+
"subcommand": "status",
|
|
44
|
+
"label": "STATUS"
|
|
47
45
|
},
|
|
48
46
|
{
|
|
49
|
-
"subcommand": "
|
|
50
|
-
"label": "
|
|
47
|
+
"subcommand": "hubs",
|
|
48
|
+
"label": "HUBS"
|
|
51
49
|
},
|
|
52
50
|
{
|
|
53
|
-
"subcommand": "
|
|
54
|
-
"label": "
|
|
51
|
+
"subcommand": "ingest",
|
|
52
|
+
"label": "INGEST"
|
|
55
53
|
},
|
|
56
54
|
{
|
|
57
|
-
"subcommand": "
|
|
58
|
-
"label": "
|
|
55
|
+
"subcommand": "probe",
|
|
56
|
+
"label": "200 PROBE"
|
|
59
57
|
}
|
|
60
58
|
],
|
|
61
59
|
"touch_layout": "comfortable",
|
|
@@ -236,6 +234,33 @@
|
|
|
236
234
|
}
|
|
237
235
|
]
|
|
238
236
|
},
|
|
237
|
+
{
|
|
238
|
+
"name": "auto-refresh",
|
|
239
|
+
"description": "Daemon automated check and regeneration for stale OpenWiki documentation across registered repositories",
|
|
240
|
+
"timeout_ms": 600000,
|
|
241
|
+
"effect": "write",
|
|
242
|
+
"output": "json",
|
|
243
|
+
"args": [
|
|
244
|
+
{
|
|
245
|
+
"name": "repo",
|
|
246
|
+
"flag": "--repo",
|
|
247
|
+
"label": "Target repository",
|
|
248
|
+
"type": "string"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"name": "force",
|
|
252
|
+
"flag": "--force",
|
|
253
|
+
"label": "Force regeneration",
|
|
254
|
+
"type": "boolean"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"name": "json",
|
|
258
|
+
"flag": "--json",
|
|
259
|
+
"label": "JSON output",
|
|
260
|
+
"type": "boolean"
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
},
|
|
239
264
|
{
|
|
240
265
|
"name": "watch",
|
|
241
266
|
"description": "Watch upstream OpenWiki repository, announce new releases, and trigger propagation",
|
|
@@ -332,179 +357,6 @@
|
|
|
332
357
|
"type": "boolean"
|
|
333
358
|
}
|
|
334
359
|
]
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
"name": "search",
|
|
338
|
-
"description": "Evidence passage search across knowledge hubs, all vaults, and mesh nodes",
|
|
339
|
-
"effect": "read",
|
|
340
|
-
"output": "json",
|
|
341
|
-
"args": [
|
|
342
|
-
{
|
|
343
|
-
"name": "query",
|
|
344
|
-
"label": "Search query terms",
|
|
345
|
-
"type": "string",
|
|
346
|
-
"positional": true,
|
|
347
|
-
"required": true
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
"name": "allVaults",
|
|
351
|
-
"flag": "--all-vaults",
|
|
352
|
-
"label": "Search across all registered project vaults and global vault",
|
|
353
|
-
"type": "boolean"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"name": "node",
|
|
357
|
-
"flag": "--node",
|
|
358
|
-
"label": "Remote mesh node to query",
|
|
359
|
-
"type": "string"
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
"name": "json",
|
|
363
|
-
"flag": "--json",
|
|
364
|
-
"label": "JSON output",
|
|
365
|
-
"type": "boolean"
|
|
366
|
-
}
|
|
367
|
-
]
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
"name": "graph",
|
|
371
|
-
"description": "Extract knowledge graph topology, inter-hub links, and concept dependencies",
|
|
372
|
-
"effect": "read",
|
|
373
|
-
"output": "json",
|
|
374
|
-
"args": [
|
|
375
|
-
{
|
|
376
|
-
"name": "allVaults",
|
|
377
|
-
"flag": "--all-vaults",
|
|
378
|
-
"label": "Extract topology across all vaults",
|
|
379
|
-
"type": "boolean"
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
"name": "node",
|
|
383
|
-
"flag": "--node",
|
|
384
|
-
"label": "Remote mesh node",
|
|
385
|
-
"type": "string"
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
"name": "format",
|
|
389
|
-
"flag": "--format",
|
|
390
|
-
"label": "Output format: json, mermaid, dot",
|
|
391
|
-
"type": "string"
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
"name": "json",
|
|
395
|
-
"flag": "--json",
|
|
396
|
-
"label": "JSON output",
|
|
397
|
-
"type": "boolean"
|
|
398
|
-
}
|
|
399
|
-
]
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"name": "token",
|
|
403
|
-
"description": "Check or set OpenWiki credentials in Total Recall auth secrets store",
|
|
404
|
-
"effect": "write",
|
|
405
|
-
"output": "json",
|
|
406
|
-
"args": [
|
|
407
|
-
{
|
|
408
|
-
"name": "action",
|
|
409
|
-
"label": "Action: status or set",
|
|
410
|
-
"type": "string",
|
|
411
|
-
"positional": true
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
"name": "provider",
|
|
415
|
-
"label": "Provider (openrouter or google)",
|
|
416
|
-
"type": "string",
|
|
417
|
-
"positional": true
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
"name": "value",
|
|
421
|
-
"label": "API Key token value",
|
|
422
|
-
"type": "string",
|
|
423
|
-
"positional": true
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
"name": "stdin",
|
|
427
|
-
"flag": "--stdin",
|
|
428
|
-
"label": "Read secret from standard input",
|
|
429
|
-
"type": "boolean"
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
"name": "json",
|
|
433
|
-
"flag": "--json",
|
|
434
|
-
"label": "JSON output",
|
|
435
|
-
"type": "boolean"
|
|
436
|
-
}
|
|
437
|
-
]
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
"name": "lint",
|
|
441
|
-
"description": "Validate link integrity, broken references, and orphaned documentation hubs",
|
|
442
|
-
"effect": "read",
|
|
443
|
-
"output": "json",
|
|
444
|
-
"args": [
|
|
445
|
-
{
|
|
446
|
-
"name": "allVaults",
|
|
447
|
-
"flag": "--all-vaults",
|
|
448
|
-
"label": "Lint across all project vaults",
|
|
449
|
-
"type": "boolean"
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
"name": "node",
|
|
453
|
-
"flag": "--node",
|
|
454
|
-
"label": "Remote mesh node",
|
|
455
|
-
"type": "string"
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
"name": "json",
|
|
459
|
-
"flag": "--json",
|
|
460
|
-
"label": "JSON output",
|
|
461
|
-
"type": "boolean"
|
|
462
|
-
}
|
|
463
|
-
]
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
"name": "generate",
|
|
467
|
-
"description": "Targeted on-demand documentation generation for any repository or workspace",
|
|
468
|
-
"effect": "write",
|
|
469
|
-
"output": "json",
|
|
470
|
-
"args": [
|
|
471
|
-
{
|
|
472
|
-
"name": "repo",
|
|
473
|
-
"flag": "--repo",
|
|
474
|
-
"label": "Registered project name or root path",
|
|
475
|
-
"type": "string"
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
"name": "path",
|
|
479
|
-
"flag": "--path",
|
|
480
|
-
"label": "Explicit directory path",
|
|
481
|
-
"type": "string"
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
"name": "force",
|
|
485
|
-
"flag": "--force",
|
|
486
|
-
"label": "Force re-generation",
|
|
487
|
-
"type": "boolean"
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
"name": "dryRun",
|
|
491
|
-
"flag": "--dry-run",
|
|
492
|
-
"label": "Preview without writing",
|
|
493
|
-
"type": "boolean"
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
"name": "node",
|
|
497
|
-
"flag": "--node",
|
|
498
|
-
"label": "Remote mesh node",
|
|
499
|
-
"type": "string"
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
"name": "json",
|
|
503
|
-
"flag": "--json",
|
|
504
|
-
"label": "JSON output",
|
|
505
|
-
"type": "boolean"
|
|
506
|
-
}
|
|
507
|
-
]
|
|
508
360
|
}
|
|
509
361
|
]
|
|
510
362
|
},
|
|
@@ -7510,7 +7510,7 @@ Runtime note:
|
|
|
7510
7510
|
- ${Noh(t)}
|
|
7511
7511
|
- Do not pass host absolute paths to filesystem tools. A host absolute path will be treated as a virtual path and will write to the wrong location.
|
|
7512
7512
|
- ${t==="local-wiki"?"Shell execution is disabled in personal mode. Read connector evidence with openwiki_list_raw_items and openwiki_read_raw_item.":"Shell execute is restricted because the local backend cannot confine arbitrary host commands. Use ls, read_file, glob, and grep for repository inspection."}
|
|
7513
|
-
- Do not search parent directories or unrelated directories.`}import{chmod as Qoh,cp as Hoh,lstat as Woh,mkdir as zoh,mkdtemp as qoh,readdir as x1u,rename as C1u,rm as Goh,stat as Koh}from"node:fs/promises";import{fileURLToPath as Yoh}from"node:url";import nNt from"node:path";var Voh=Yoh(new URL("
|
|
7513
|
+
- Do not search parent directories or unrelated directories.`}import{chmod as Qoh,cp as Hoh,lstat as Woh,mkdir as zoh,mkdtemp as qoh,readdir as x1u,rename as C1u,rm as Goh,stat as Koh}from"node:fs/promises";import{fileURLToPath as Yoh}from"node:url";import nNt from"node:path";var Voh=Yoh(new URL("./skills",import.meta.url));async function T1u(){await xAe(),await Joh(Voh,_Ut)}async function Joh(e,t){let r=[];try{r=(await x1u(e,{withFileTypes:!0})).filter(n=>n.isDirectory())}catch{}await zoh(t,{recursive:!0}),await Promise.all(r.map(({name:n})=>Xoh(e,t,n)))}async function Xoh(e,t,r){let n=nNt.join(t,r),s=await qoh(nNt.join(t,`.${r}-staging-`)),i=nNt.join(s,"staged"),o=nNt.join(s,"displaced");try{await Hoh(nNt.join(e,r),i,{recursive:!0}),await I1u(i);try{await C1u(n,o)}catch(d){if(d.code!=="ENOENT")throw d}let l;for(let d=0;d<3;d+=1)try{await C1u(i,n),l=void 0;break}catch(f){if(l=f,await Koh(n).then(m=>m.isDirectory(),()=>!1)){l=void 0;break}}if(l!==void 0)throw l}finally{await Goh(s,{force:!0,recursive:!0})}}async function I1u(e){let t=await Woh(e);if(!t.isSymbolicLink()&&(await Qoh(e,t.mode|128),t.isDirectory())){let r=await x1u(e);await Promise.all(r.map(n=>I1u(nNt.join(e,n))))}}var fws="/conversation_history/",Zoh=100;function joh(e){let t=0,r=!1;for(let n of e){if(r){r=!1;continue}if(n==="\\"){r=!0;continue}if(n==="{"){if(t+=1,t>Zoh)return!0}else n==="}"&&t>0&&(t-=1)}return!1}var u$e=[{operations:["write"],paths:["/skills/**"],mode:"deny"},{operations:["write"],paths:[`${fws}**`],mode:"deny"}];function Xmr(e,{historyDir:t=pWn,skillsDir:r=_Ut}={}){return new dws(e,{[fws]:new yer({rootDir:t,virtualMode:!0}),"/skills/":new yer({rootDir:r,virtualMode:!0})})}var dws=class extends her{async glob(t,r="/"){if(joh(t))return{error:"Glob pattern nesting is too deep. Retry with a simpler pattern."};try{return await super.glob(t,r)}catch(n){if(n instanceof RangeError&&n.message==="Maximum call stack size exceeded")return{error:"Glob search was too broad. Retry with a narrower path or pattern."};throw n}}};nu();p1();import{scheduler as Oyu}from"node:timers/promises";var hu=class extends Error{code;constructor(t,r){super(r),this.name="RepositoryRunError",this.code=t}};import{randomUUID as Hlh}from"node:crypto";import{cp as pws,lstat as k1u,mkdir as eah,mkdtemp as tah,rm as DEn}from"node:fs/promises";import{tmpdir as rah}from"node:os";import Tat from"node:path";var hws="INSTRUCTIONS.md",nah={SIGINT:130,SIGTERM:143};async function b1u(e){if(!Tat.isAbsolute(e))throw new Error("Repository wiki replacement requires an absolute root.");let t=Tat.resolve(e),r=Tat.join(t,WI),n=await k1u(r).catch(C=>{if(_E(C))return null;throw C});if(n===null)return iah();if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`Refusing to replace ${WI}: expected a real directory below the repository root.`);let s=await tah(Tat.join(rah(),"openwiki-init-")),i=Tat.join(s,WI),o=!1,l,d=Promise.resolve(),f=()=>{process.removeListener("SIGINT",w),process.removeListener("SIGTERM",S)},h=async()=>{await DEn(r,{force:!0,recursive:!0}),await pws(i,r,{preserveTimestamps:!0,recursive:!0,verbatimSymlinks:!0})},m=C=>l||(l=(async()=>{try{if(await d.catch(()=>{}),o)return;C==="rollback"&&await h(),await DEn(s,{force:!0,recursive:!0}),o=!0}finally{f()}})(),l),A={commit:()=>m("commit"),async rollback(){try{await m("rollback")}catch(C){throw new Error(`Could not restore the previous repository wiki; the backup remains at ${i}.`,{cause:C})}}},v=C=>{f(),A.rollback().catch(I=>{let k=I instanceof Error?I.message:String(I);process.stderr.write(`${k}
|
|
7514
7514
|
`)}).finally(()=>{setImmediate(()=>process.exit(nah[C]))})};function w(){v("SIGINT")}function S(){v("SIGTERM")}try{await pws(r,i,{preserveTimestamps:!0,recursive:!0,verbatimSymlinks:!0})}catch(C){throw await DEn(s,{force:!0,recursive:!0}).catch(()=>{}),C}process.once("SIGINT",w),process.once("SIGTERM",S),d=(async()=>{await DEn(r,{force:!0,recursive:!0}),await eah(r,{recursive:!0});let C=Tat.join(i,hws),I=await k1u(C).catch(k=>{if(_E(k))return null;throw k});if(I){if(!I.isFile()||I.isSymbolicLink())throw new Error(`Refusing to preserve ${WI}/${hws}: expected a regular file.`);await pws(C,Tat.join(r,hws),{preserveTimestamps:!0})}})();try{await d}catch(C){try{await A.rollback()}catch(I){throw new AggregateError([C,I],`Repository wiki replacement failed and rollback was incomplete; the backup remains at ${i}.`,{cause:I})}throw C}return A}function iah(){return{commit:()=>Promise.resolve(),rollback:()=>Promise.resolve()}}import{isDeepStrictEqual as sah}from"node:util";async function R1u(e,t){let r=new Map;for(let n of await e.discoverPages()){let s=await e.readMarkdown(n),i=p0e(s,n).content,o=oah(i),l=o.filter(m=>!lah(m.by)),d=t.get(n),f=d?[...l,{...d}]:l,h=sah(o,f)&&aah(i)?i:p0e(DTi(i,f),n).content;h!==s&&(await e.writeMarkdown(n,h),r.set(n,s))}return r}async function D1u(e,t,r){for(let n of r){let s=t.get(n);s!==void 0&&await e.writeMarkdown(n,s)}}function oah(e){let t=ZN(e)?.verified;return(Array.isArray(t)?t:t===void 0?[]:[t]).filter(n=>uah(n)&&typeof n.by=="string"&&n.by.trim()!==""&&(n.at===void 0||typeof n.at=="string"&&n.at.trim()!==""))}function aah(e){let t=ZN(e);return t?.verified===void 0||Array.isArray(t.verified)}function lah(e){return/^openwiki\//u.test(e)}function uah(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}import{createHash as cah}from"node:crypto";import{lstat as dah,readFile as fah,realpath as B1u}from"node:fs/promises";import kEe from"node:path";var BEn=3,gws="repo-lines-v1:sha256:",pah=7,NEn=class{rootDir;realRootDirPromise;openWikiIgnore;constructor(t){if(!kEe.isAbsolute(t.rootDir))throw new E3("Repository evidence root must be absolute.");this.rootDir=kEe.resolve(t.rootDir),this.openWikiIgnore=t.openWikiIgnore??new MR([])}async resolve(t,r){let n=ZBt(t),s=Kpr(n);if(this.openWikiIgnore.ignores(n.path))throw new E3(`Evidence path is excluded by .openwikiignore: ${n.path}`);let i=this.resolveSafePath(n.path),o;try{let l=await dah(i);if(l.isSymbolicLink())throw new dEe(`Evidence cannot reference a symbolic link: ${n.path}`);if(!l.isFile())return null;let d=await this.getRealRootDir(),f=await B1u(i),h=kEe.resolve(d,n.path);if(!Cah(d,f)||f!==h)throw new dEe(`Evidence path traverses a symbolic link or filesystem alias: ${n.path}`);o=await fah(f,"utf8")}catch(l){if(Tah(l))return null;throw l instanceof XBt?l:new XBt(`Unable to read evidence ${n.path}: ${M1u(l)}`)}return n.range?hah({resource:s,source:o,startLine:n.range.startLine,endLine:n.range.endLine,previousVersion:r}):_ah(s,o)}resolveSafePath(t){let r=kEe.resolve(this.rootDir,t),n=kEe.relative(this.rootDir,r);if(n===".."||n.startsWith(`..${kEe.sep}`)||kEe.isAbsolute(n))throw new E3(`Evidence path escapes the repository: ${t}`);return r}async getRealRootDir(){return this.realRootDirPromise??=B1u(this.rootDir).catch(t=>{throw new dEe(`Unable to resolve repository root ${this.rootDir}: ${M1u(t)}`)}),this.realRootDirPromise}};function hah(e){let t=mah(e.source),r=gah(e.startLine,e.endLine,t.length),n=e.previousVersion,s=Eah(n);if(!s||!n)return r?N1u(e.resource,t,r):null;let i=Aah(t,r,s);if(i)return{evidence:{resource:F1u(e.resource,i),version:n},content:PEn(t,i)};let o=yah(t,s.metadata);return o?N1u(e.resource,t,o):null}function mah(e){let t=[],r=0;for(;r<e.length;){let n=e.indexOf(`
|
|
7515
7515
|
`,r),s=n===-1?e.length:n+1;t.push(e.slice(r,s)),r=s}return t}function gah(e,t,r){return t<=r?{startIndex:e-1,endIndexExclusive:t}:null}function N1u(e,t,r){let n=PEn(t,r);return{evidence:{resource:F1u(e,r),version:wah(n,t,r)},content:n}}function F1u(e,t){return Kpr({path:ZBt(e).path,range:{startLine:t.startIndex+1,endLine:t.endIndexExclusive}})}function Aah(e,t,r){let{metadata:n}=r;if(t&&t.endIndexExclusive-t.startIndex===n.selectedLineCount&&moe(PEn(e,t))===r.contentHash)return t;let s=[],i=e.map(l=>moe(l));for(let l=0;l+n.selectedLineCount<=e.length;l+=1){let d=l+n.selectedLineCount;if(i[l]!==n.firstSelectedLineHash||i[d-1]!==n.lastSelectedLineHash)continue;let f={startIndex:l,endIndexExclusive:d};moe(PEn(e,f))===r.contentHash&&s.push(f)}if(s.length===1)return s[0];let o=s.filter(l=>vah(e,l,n));return o.length===1?o[0]:null}function yah(e,t){let r=P1u(e,t.precedingContextLineCount,t.precedingContextHash,"before"),n=P1u(e,t.followingContextLineCount,t.followingContextHash,"after"),s=[];for(let i of r)for(let o of n)if(o>i&&(s.push({startIndex:i,endIndexExclusive:o}),s.length>1))return null;return s[0]??null}function P1u(e,t,r,n){if(t===0)return[n==="before"?0:e.length];let s=[];for(let i=0;i+t<=e.length;i+=1)moe(e.slice(i,i+t).join(""))===r&&s.push(n==="before"?i+t:i);return s}function vah(e,t,r){let n=r.precedingContextLineCount===0?t.startIndex===0:t.startIndex>=r.precedingContextLineCount&&moe(e.slice(t.startIndex-r.precedingContextLineCount,t.startIndex).join(""))===r.precedingContextHash,s=r.followingContextLineCount===0?t.endIndexExclusive===e.length:t.endIndexExclusive+r.followingContextLineCount<=e.length&&moe(e.slice(t.endIndexExclusive,t.endIndexExclusive+r.followingContextLineCount).join(""))===r.followingContextHash;return n&&s}function PEn(e,t){return e.slice(t.startIndex,t.endIndexExclusive).join("")}function wah(e,t,r){let n=Math.max(0,r.startIndex-BEn),s=Math.min(t.length,r.endIndexExclusive+BEn),i={selectedLineCount:r.endIndexExclusive-r.startIndex,firstSelectedLineHash:moe(t[r.startIndex]),lastSelectedLineHash:moe(t[r.endIndexExclusive-1]),precedingContextLineCount:r.startIndex-n,precedingContextHash:moe(t.slice(n,r.startIndex).join("")),followingContextLineCount:s-r.endIndexExclusive,followingContextHash:moe(t.slice(r.endIndexExclusive,s).join(""))},o=Buffer.from(JSON.stringify(i),"utf8").toString("base64url");return`${gws}${moe(e)}:${o}`}function Eah(e){if(!e?.startsWith(gws))return null;let t=e.slice(gws.length),r=t.indexOf(":");if(r===-1)return null;let n=t.slice(0,r);if(!Zmr(n))return null;try{let s=JSON.parse(Buffer.from(t.slice(r+1),"base64url").toString("utf8"));return Sah(s)?{contentHash:n,metadata:s}:null}catch{return null}}function Sah(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return Object.keys(t).length===pah&&mws(t.selectedLineCount,1,Number.MAX_SAFE_INTEGER)&&mws(t.precedingContextLineCount,0,BEn)&&mws(t.followingContextLineCount,0,BEn)&&Zmr(t.firstSelectedLineHash)&&Zmr(t.lastSelectedLineHash)&&Zmr(t.precedingContextHash)&&Zmr(t.followingContextHash)}function mws(e,t,r){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=t&&e<=r}function _ah(e,t){return{evidence:{resource:e,version:xah("repo-file-v1",t)},content:t}}function Cah(e,t){let r=kEe.relative(e,t);return r.length>0&&r!==".."&&!r.startsWith(`..${kEe.sep}`)&&!kEe.isAbsolute(r)}function xah(e,t){return`${e}:sha256:${moe(t)}`}function moe(e){return cah("sha256").update(e).digest("hex")}function Zmr(e){return typeof e=="string"&&/^[a-f0-9]{64}$/u.test(e)}function Tah(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}function M1u(e){return e instanceof Error?e.message:String(e)}function iNt(e){let t=new Map;return{resolve(r,n){let s=JSON.stringify([r,n]),i=t.get(s);if(i)return i;let o=e.resolve(r,n);return t.set(s,o),o}}}async function L1u(e,t){let r=await e.discoverPages(),n=await e.loadPages(r),s=new Set(r),i=(await e.discoverSidecarPages()).filter(d=>!s.has(d)),o=[],l=iNt(t);for(let d of r){let f=n.get(d);if(f)for(let h of f.claims){let m=[],A=[];for(let v of h.evidence){let w;try{w=await l.resolve(v.resource,v.version)}catch(S){if(!(S instanceof dEe))throw S;w=null}w?w.evidence.version!==v.version&&m.push(v.resource):A.push(v.resource)}A.length>0?o.push({page:d,kind:"unresolved",claimId:h.id,resources:A.sort()}):m.length>0&&o.push({page:d,kind:"stale",claimId:h.id,resources:m.sort()})}}return o.sort(Iah),i.sort((d,f)=>d.localeCompare(f)),{issues:o,persisted:n,orphanPages:i}}function Iah(e,t){return e.page.localeCompare(t.page)||e.kind.localeCompare(t.kind)||(e.claimId??"").localeCompare(t.claimId??"")}import{randomUUID as Pah}from"node:crypto";import{randomUUID as kah}from"node:crypto";async function U1u(e){if(e.operations.length===0)throw new _A("A claim mutation requires at least one operation.");let t=e.createClaimId??(()=>`claim_${kah().replaceAll("-","")}`);bah(e.claims);let r=sNt(e.claims),n=new Set(e.claims.map(l=>l.id)),s=new Set,i=new Map,o=iNt(e.resolver);for(let l of e.operations)if(Rah(l),l.op!=="add"){if(s.has(l.id))throw new _A(`Claim ${l.id} is targeted more than once in one batch.`);if(s.add(l.id),!n.has(l.id))throw new _A(`Unknown claim id: ${l.id}`)}for(let[l,d]of e.operations.entries()){if(d.op==="add"){i.set(l,await $1u(d.evidence,o));continue}if(d.op==="confirm"||d.op==="update"){let f=r.find(m=>m.id===d.id);if(!f)throw new _A(`Unknown claim id: ${d.id}`);let h=d.op==="update"&&d.evidence!==void 0?d.evidence:f.evidence;i.set(l,await $1u(h,o))}}for(let[l,d]of e.operations.entries()){if(d.op==="add"){r.push({id:Dah(n,t),statement:d.statement.trim(),evidence:O1u(i,l)});continue}let f=r.findIndex(m=>m.id===d.id);if(f===-1)throw new _A(`Unknown claim id: ${d.id}`);if(d.op==="retract"){r.splice(f,1);continue}let h=r[f];r[f]={id:d.id,statement:d.op==="update"&&d.statement!==void 0?d.statement.trim():h.statement,evidence:O1u(i,l)}}return sNt(r)}async function $1u(e,t){let r=[],n=new Set,s=new Set;for(let i of e){if(n.has(i.resource))throw new _A(`Claim evidence repeats ${i.resource}`);n.add(i.resource);let o="version"in i?i.version:void 0,l=await t.resolve(i.resource,o);if(!l)throw new _A(`Evidence does not resolve: ${i.resource}`);if(Q1u(l.evidence,"Resolved evidence"),s.has(l.evidence.resource))throw new _A(`Claim evidence resolves to duplicate resource ${l.evidence.resource}`);s.add(l.evidence.resource),r.push(l.evidence)}return r}function bah(e){let t=new Set;for(let r of e){if(_3e(r.id,"Claim id"),t.has(r.id))throw new _A(`Duplicate claim id: ${r.id}`);if(t.add(r.id),_3e(r.statement,`Claim ${r.id} statement`),r.evidence.length===0)throw new _A(`Claim ${r.id} requires at least one evidence resource.`);let n=new Set;for(let s of r.evidence){if(Q1u(s,`Claim ${r.id} evidence`),n.has(s.resource))throw new _A(`Claim ${r.id} repeats evidence ${s.resource}`);n.add(s.resource)}}}function Q1u(e,t){_3e(e.resource,`${t} resource`),_3e(e.version,`${t} version`)}function O1u(e,t){let r=e.get(t);if(!r)throw new _A("Resolved claim evidence is missing.");return r}function Rah(e){if(e.op==="retract"){_3e(e.id,"Retract claim id");return}if(e.op==="confirm"){_3e(e.id,"Confirm claim id");return}if(e.op==="update"&&(_3e(e.id,"Update claim id"),e.statement===void 0&&e.evidence===void 0))throw new _A("An update requires a statement or evidence change.");if(e.op!=="add"&&e.op!=="update")throw new _A("Unsupported claim operation.");if(e.statement!==void 0&&!e.statement.trim())throw new _A("Claim statement cannot be empty.");if(e.evidence!==void 0&&e.evidence.length===0)throw new _A("A claim requires at least one evidence resource.");for(let t of e.evidence??[])_3e(t.resource,"Proposed evidence resource")}function _3e(e,t){if(!e.trim())throw new _A(`${t} cannot be empty.`);if(e!==e.trim())throw new _A(`${t} cannot contain surrounding whitespace.`)}function Dah(e,t){for(let r=0;r<10;r+=1){let n=t();if(_3e(n,"Generated claim id"),!e.has(n))return e.add(n),n}throw new _A("Unable to allocate a unique claim identifier.")}function sNt(e){return e.map(t=>({...t,evidence:t.evidence.map(r=>({...r}))}))}import MEn from"node:path";var jmr=".claims",Bah=new Set(["index.md","log.md","instructions.md"]);function x1(e){let t=e.trim().replace(/\\/gu,"/");if(Aws(t))throw new _A(`Claim page cannot contain traversal segments: ${e}`);let r=MEn.posix.normalize(`/${t.replace(/^\/+/,"")}`);if(!r.startsWith("/openwiki/")||!r.endsWith(".md"))throw new _A(`Claim page must be a Markdown file below /openwiki: ${e}`);if(!FEn(r))throw new _A(`Claim page is reserved or structural: ${e}`);return r}function H1u(e){return x1(Nah(e))}function Nah(e){let t=e.trim().replace(/\\/gu,"/");if(Aws(t))throw new _A(`Wiki page cannot contain traversal segments: ${e}`);let r=t.replace(/^\/+/,""),n=r==="openwiki"||r.startsWith("openwiki/")?r:`openwiki/${r}`,s=MEn.posix.normalize(`/${n}`),i=s.toLowerCase().split("/");if(!s.startsWith("/openwiki/")||!s.endsWith(".md")||i.includes(jmr))throw new _A(`Wiki page must be a Markdown file below /openwiki: ${e}`);return s}function FEn(e){let t=e.replace(/\\/gu,"/");if(Aws(t))return!1;let r=MEn.posix.normalize(`/${t.replace(/^\/+/,"")}`),n=r.toLowerCase(),s=MEn.posix.basename(n),i=n.split("/");return r.startsWith("/openwiki/")&&r.endsWith(".md")&&!i.includes(jmr)&&!Bah.has(s)}function Aws(e){return e.split("/").some(t=>t==="."||t==="..")}function LEn(e){return x1(e).replace(/^\//u,"")}function W1u(e){return x1(e).slice(10).replace(/\.md$/u,".json")}var egr=class{resolver;pages=new Map;claimOwners=new Map;orphanPages;createClaimId;constructor(t){this.resolver=t.resolver,this.orphanPages=[...new Set(t.orphanPages.map(x1))].sort((r,n)=>r.localeCompare(n)),this.createClaimId=t.createClaimId??(()=>`claim_${Pah().replaceAll("-","")}`);for(let[r,n]of t.persisted){let s=x1(r);if(this.pages.has(s))throw new _A(`Duplicate persisted claim page: ${s}`);this.assertClaimOwnershipAvailable(s,n.claims);for(let i of n.claims)this.claimOwners.set(i.id,s);this.pages.set(s,{claims:sNt(n.claims),...n.verification?{verification:{...n.verification}}:{},persisted:!0,pendingMutation:Promise.resolve(),dirty:!1,deleted:!1,issues:t.issues.filter(i=>x1(i.page)===s).map(Fah)})}}async resolveClaims(t){let r=x1(t.page),n=this.getOrCreatePage(r),s=n.pendingMutation,i=()=>{};n.pendingMutation=new Promise(o=>{i=o}),await s;try{let o=new Set(n.claims.map(({id:v})=>v)),l=n.claims,d=await U1u({claims:n.claims,operations:t.operations,resolver:this.resolver,createClaimId:()=>this.allocateClaimId()});this.assertClaimOwnershipAvailable(r,d),this.replaceClaimOwnership(r,l,d),n.claims=d;let f=d.map(({id:v})=>v).filter(v=>!o.has(v)),h=0,m=t.operations.map(v=>({op:v.op,id:v.op==="add"?f[h++]:v.id}));n.dirty=!0,n.deleted=!1;let A=new Set(m.map(({id:v})=>v));return n.issues=n.issues.filter(v=>!A.has(v.claimId)),{page:r,results:m}}finally{i()}}inspectClaims(t){let r=x1(t),n=this.getOrCreatePage(r);return n.deleted?[]:n.claims.map(s=>Mah(s,n.issues))}hasClaim(t){return this.claimOwners.has(t)}getEvidenceResourcesByPage(){let t=new Map,r=[...this.pages.entries()].sort(([n],[s])=>n.localeCompare(s));for(let[n,s]of r){if(s.deleted)continue;let i=s.claims.flatMap(o=>o.evidence.map(({resource:l})=>l));t.set(n,[...new Set(i)].sort((o,l)=>o.localeCompare(l)))}return t}async recordDeletion(t){let r=x1(t),n=this.getOrCreatePage(r);await n.pendingMutation,this.replaceClaimOwnership(r,n.claims,[]),n.deleted=!0,n.dirty=!1,n.issues=[]}async finalize(t,r,n=new Set){let s=iNt(this.resolver),i=[],o=new Map,l=[],d=[];for(let[f,h]of this.pages)if(!n.has(f)&&(await h.pendingMutation,!(h.deleted||!h.dirty)))try{if(h.issues.length>0)throw new _A(`Unresolved evidence debt remains for ${f}`);await this.assertEvidenceStillCurrent(f,h.claims,s),d.push({page:f,state:h,hash:await t.hashPage(f)})}catch(m){if(!oNt(m))throw m;m instanceof cEe?(l.push(f),i.push(`Could not verify Claims for ${f} because its Markdown disappeared; its sidecar will be removed: ${m.message}`)):i.push(aNt(f,"verify",m))}for(let f of this.orphanPages)if(!n.has(f))try{await t.deletePage(f)}catch(h){if(!oNt(h))throw h;i.push(aNt(f,"clean up",h))}for(let f of l)if(!n.has(f))try{await t.deletePage(f)}catch(h){if(!oNt(h))throw h;i.push(aNt(f,"remove",h))}for(let[f,h]of this.pages)if(!n.has(f)&&h.deleted)try{await t.deletePage(f)}catch(m){if(!oNt(m))throw m;i.push(aNt(f,"remove",m))}for(let{page:f,state:h,hash:m}of d){let A=h.claims.length>0?{...r}:void 0;try{await t.writePage(f,{schemaVersion:1,pageVersion:m,claims:sNt(h.claims),...A?{verification:A}:{}}),h.verification=A,h.persisted=!0,h.dirty=!1}catch(v){if(!oNt(v))throw v;i.push(aNt(f,"persist",v))}}for(let[f,h]of this.pages){if(n.has(f)||h.deleted)continue;let m=h.persisted&&!h.dirty&&h.claims.length>0&&h.issues.length===0&&h.verification!==void 0;o.set(f,m?{...h.verification}:null)}return{verificationByPage:o,warnings:i}}async refreshPageVersions(t,r){let n=[],s=[];for(let i of[...new Set(r)].sort((o,l)=>o.localeCompare(l))){let o=x1(i),l=this.pages.get(o);if(!(!l||!l.persisted||l.deleted||l.dirty))try{await t.writePage(o,{schemaVersion:1,pageVersion:await t.hashPage(o),claims:sNt(l.claims),...l.verification?{verification:{...l.verification}}:{}})}catch(d){if(!oNt(d))throw d;s.push(o),n.push(aNt(o,"synchronize",d))}}return{failedPages:s,warnings:n}}async assertEvidenceStillCurrent(t,r,n){for(let s of r)for(let i of s.evidence){let o=await n.resolve(i.resource,i.version);if(!o)throw new _A(`Evidence disappeared before finalizing ${t}: ${i.resource}`);if(o.evidence.version!==i.version)throw new _A(`Evidence changed before finalizing ${t}: ${i.resource}`)}}getOrCreatePage(t){let r=this.pages.get(t);if(r)return r;let n={claims:[],persisted:!1,pendingMutation:Promise.resolve(),dirty:!1,deleted:!1,issues:[]};return this.pages.set(t,n),n}allocateClaimId(){for(let t=0;t<32;t+=1){let r=this.createClaimId();if(!this.claimOwners.has(r))return r}throw new _A("Unable to allocate a globally unique claim identifier.")}assertClaimOwnershipAvailable(t,r){let n=new Set;for(let s of r){if(n.has(s.id))throw new _A(`Duplicate claim id ${s.id} within ${t}`);n.add(s.id);let i=this.claimOwners.get(s.id);if(i&&i!==t)throw new _A(`Duplicate claim id ${s.id} across ${i} and ${t}`)}}replaceClaimOwnership(t,r,n){let s=new Set(n.map(({id:i})=>i));for(let{id:i}of r)!s.has(i)&&this.claimOwners.get(i)===t&&this.claimOwners.delete(i);for(let{id:i}of n)this.claimOwners.set(i,t)}};function Mah(e,t){let r=t.find(n=>n.claimId===e.id);return{id:e.id,statement:e.statement,evidence:e.evidence.map(({resource:n})=>n),...r?{issue:{kind:r.kind,resources:[...r.resources]}}:{}}}function Fah(e){return{...e,resources:[...e.resources]}}function oNt(e){return e instanceof uEe&&!(e instanceof Fpe)&&!(e instanceof dEe)}function aNt(e,t,r){return`Could not ${t} Claims for ${e}; its Claims sidecar was left unchanged: ${r.message}`}import{createHash as Lah,randomUUID as $ah}from"node:crypto";import{lstat as OEn,mkdir as Oah,readFile as yws,readdir as Uah,realpath as z1u,rename as Qah,rm as q1u,writeFile as G1u}from"node:fs/promises";import OE from"node:path";var uNt=Tt.string().min(1).refine(e=>e===e.trim(),{message:"Must not contain surrounding whitespace"}),Hah=Tt.object({resource:uNt,version:uNt}).strict(),Wah=Tt.object({id:uNt,statement:uNt,evidence:Tt.array(Hah).min(1)}).strict(),zah=Tt.object({by:uNt,at:uNt}).strict(),qah=Tt.object({schemaVersion:Tt.literal(1),pageVersion:Tt.string().regex(/^sha256:[a-f0-9]{64}$/u),claims:Tt.array(Wah),verification:zah.optional()}).strict(),B4=class{rootDir;realRootDirPromise;wikiDir;claimsDir;constructor(t){if(!OE.isAbsolute(t))throw new ew("Claims store root must be an absolute path.");this.rootDir=OE.resolve(t),this.wikiDir=OE.join(this.rootDir,"openwiki"),this.claimsDir=OE.join(this.wikiDir,jmr)}async discoverPages(){let t=await this.resolveExistingDirectory(this.wikiDir);return t?(await Y1u(t,!1)).map(n=>`/openwiki/${n.replace(/\\/gu,"/")}`).filter(FEn).sort((n,s)=>n.localeCompare(s)):[]}async discoverSidecarPages(){let t=await this.resolveExistingDirectory(this.claimsDir);return t?(await Y1u(t,!0)).filter(n=>n.endsWith(".json")).map(n=>`/openwiki/${n.replace(/\\/gu,"/").replace(/\.json$/u,".md")}`).filter(FEn).sort((n,s)=>n.localeCompare(s)):[]}async loadPage(t){let r=this.sidecarPath(t),n=await this.resolveExistingRegularFile(r);if(!n)return null;let s;try{s=await yws(n,"utf8")}catch(o){if(lNt(o))return null;throw new ew(`Unable to read ${this.displayPath(r)}: ${PH(o)}`)}let i;try{i=JSON.parse(s)}catch(o){throw new ew(`Invalid JSON in ${this.displayPath(r)}: ${PH(o)}`)}return K1u(i,`claim sidecar ${this.displayPath(r)}`)}async loadPages(t){let r=new Map;for(let n of t){let s=await this.loadPage(n);s&&r.set(x1(n),s)}return r}async hashPage(t){let r=OE.join(this.rootDir,LEn(t)),n=await this.resolveExistingRegularFile(r);if(!n)throw new cEe(`Unable to hash ${x1(t)}: file does not exist`);try{let s=await yws(n);return`sha256:${Lah("sha256").update(s).digest("hex")}`}catch(s){throw new ew(`Unable to hash ${x1(t)}: ${PH(s)}`)}}async readMarkdown(t){let r=x1(t),n=OE.join(this.rootDir,LEn(t)),s=await this.resolveExistingRegularFile(n);if(!s)throw new cEe(`Unable to read ${r}: file does not exist`);try{return await yws(s,"utf8")}catch(i){throw new ew(`Unable to read ${r}: ${PH(i)}`)}}async writeMarkdown(t,r){let n=x1(t),s=OE.join(this.rootDir,LEn(t)),i=await this.resolveExistingRegularFile(s);if(!i)throw new cEe(`Unable to write ${n}: file does not exist`);try{await G1u(i,r,"utf8")}catch(o){throw new ew(`Unable to write ${n}: ${PH(o)}`)}}async writePage(t,r){let n=x1(t),s=K1u(r,`claims for ${n}`),i=this.sidecarPath(t),o=OE.dirname(i),l=await this.ensureContainedDirectory(o),d=OE.join(l,OE.basename(i)),f=OE.join(l,`.${OE.basename(i)}.${$ah()}.tmp`);try{await G1u(f,`${JSON.stringify(s,null,2)}
|
|
7516
7516
|
`,"utf8"),await Qah(f,d)}catch(h){throw await q1u(f,{force:!0}).catch(()=>{}),new ew(`Unable to persist ${this.displayPath(i)}: ${PH(h)}`)}}async deletePage(t){let r=this.sidecarPath(t),n=await this.resolveExistingDirectory(OE.dirname(r));if(n)try{await q1u(OE.join(n,OE.basename(r)),{force:!0})}catch(s){throw new ew(`Unable to remove claims for ${x1(t)}: ${PH(s)}`)}}sidecarPath(t){return OE.join(this.claimsDir,W1u(t))}displayPath(t){return OE.relative(this.rootDir,t).replace(/\\/gu,"/")}async resolveExistingRegularFile(t){let r;try{r=await OEn(t)}catch(s){if(lNt(s))return null;throw new ew(`Unable to inspect ${this.displayPath(t)}: ${PH(s)}`)}if(r.isSymbolicLink())throw new Fpe(`Claims path cannot be a symbolic link: ${this.displayPath(t)}`);if(!r.isFile())throw new ew(`Claims path is not a regular file: ${this.displayPath(t)}`);return await this.resolvePhysicalPath(t)}async resolveExistingDirectory(t){let r;try{r=await OEn(t)}catch(n){if(lNt(n))return null;throw new ew(`Unable to inspect ${this.displayPath(t)}: ${PH(n)}`)}if(r.isSymbolicLink())throw new Fpe(`Claims path cannot be a symbolic link: ${this.displayPath(t)}`);if(!r.isDirectory())throw new ew(`Claims path is not a directory: ${this.displayPath(t)}`);return this.resolvePhysicalPath(t)}async ensureContainedDirectory(t){let r=OE.relative(this.rootDir,t);if(!V1u(this.rootDir,t))throw new Fpe(`Claims directory escapes the repository: ${r}`);let n=this.rootDir;for(let i of r.split(OE.sep).filter(Boolean)){n=OE.join(n,i);let o;try{o=await OEn(n)}catch(l){if(lNt(l))break;throw new ew(`Unable to inspect ${this.displayPath(n)}: ${PH(l)}`)}if(o.isSymbolicLink())throw new Fpe(`Claims path cannot be a symbolic link: ${this.displayPath(n)}`);if(!o.isDirectory())throw new ew(`Claims path is not a directory: ${this.displayPath(n)}`);await this.resolvePhysicalPath(n)}try{await Oah(t,{recursive:!0})}catch(i){throw new ew(`Unable to create ${this.displayPath(t)}: ${PH(i)}`)}let s=await this.resolveExistingDirectory(t);if(!s)throw new ew(`Claims directory disappeared while being created: ${this.displayPath(t)}`);return s}async resolvePhysicalPath(t){let r;try{r=await z1u(t)}catch(i){throw new ew(`Unable to resolve ${this.displayPath(t)}: ${PH(i)}`)}let n=await this.getRealRootDir(),s=OE.resolve(n,OE.relative(this.rootDir,t));if(!V1u(n,r)||r!==s)throw new Fpe(`Claims path traverses a symbolic link or filesystem alias: ${this.displayPath(t)}`);return r}async getRealRootDir(){return this.realRootDirPromise??=z1u(this.rootDir).catch(t=>{throw new Fpe(`Unable to resolve claims root ${this.rootDir}: ${PH(t)}`)}),this.realRootDirPromise}};function K1u(e,t){let r=qah.safeParse(e);if(!r.success)throw new ew(`Invalid ${t}: ${r.error.issues.map(s=>`${s.path.join(".")||"root"}: ${s.message}`).join("; ")}`);let n=new Set;for(let s of r.data.claims){if(n.has(s.id))throw new ew(`Duplicate claim id ${s.id} in ${t}`);n.add(s.id);let i=new Set;for(let o of s.evidence){if(i.has(o.resource))throw new ew(`Duplicate evidence resource ${o.resource} for claim ${s.id} in ${t}`);i.add(o.resource)}}return r.data}async function Y1u(e,t){let r=[];async function n(s,i){let o;try{o=await Uah(s,{withFileTypes:!0})}catch(l){if(lNt(l))return;throw new ew(`Unable to enumerate ${s}: ${PH(l)}`)}for(let l of o.sort((d,f)=>d.name.localeCompare(f.name))){let d=OE.join(i,l.name),f=OE.join(s,l.name),h;try{h=await OEn(f)}catch(m){if(lNt(m))continue;throw new ew(`Unable to inspect ${f}: ${PH(m)}`)}if(!h.isSymbolicLink())if(h.isDirectory()){if(!t&&l.name.toLowerCase()===jmr)continue;await n(f,d)}else h.isFile()&&r.push(d)}}return await n(e,""),r}function V1u(e,t){let r=OE.relative(e,t);return r.length>0&&r!==".."&&!r.startsWith(`..${OE.sep}`)&&!OE.isAbsolute(r)}function lNt(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}function PH(e){return e instanceof Error?e.message:String(e)}async function UEn(e,t,r,n,s=()=>{},i={}){if(t!=="repository"||e==="chat")return;let o=new B4(r),l=new NEn({rootDir:r,openWikiIgnore:n});if(e==="init"&&i.resumeInit!==!0){let m=new egr({resolver:l,persisted:new Map,issues:[],orphanPages:await o.discoverSidecarPages()});return J1u(m,[],o,s)}let f=await L1u(o,l),h=new egr({resolver:l,persisted:f.persisted,issues:f.issues,orphanPages:f.orphanPages});return J1u(h,f.issues,o,s)}function J1u(e,t,r,n){return{session:e,issueCount:t.length,issues:[...t],finalize:async(s=new Date().toISOString(),i=new Set)=>{let o=await e.finalize(r,{by:oht,at:s},i),l=[...o.warnings];l.push(...await Gah(e,r,o.verificationByPage));for(let d of l)n(d);if(l.length>0)throw new ew(`Claims finalization was not fully durable: ${l.join("; ")}`)}}}async function Gah(e,t,r){let n=await R1u(t,r),s=await e.refreshPageVersions(t,[...r.keys()]),i=s.failedPages.filter(o=>r.get(o)!==null&&r.get(o)!==void 0);return i.length>0&&await D1u(t,n,i),[...s.warnings]}import{mkdir as Kah,readFile as tgr,stat as X1u,writeFile as j1u}from"node:fs/promises";import d$e from"node:path";var cNt="<!-- OPENWIKI:START -->",c$e="<!-- OPENWIKI:END -->",Yah="0 8 * * *",Vah="## OpenWiki",eyu="This repository has documentation located in the /openwiki directory.",Jah=["Start here:","- [OpenWiki quickstart](openwiki/quickstart.md)","OpenWiki includes repository overview, architecture notes, workflows, domain concepts, operations, integrations, testing guidance, and source maps.","When working in this repository, read the OpenWiki quickstart first, then follow its links to the relevant architecture, workflow, domain, operation, and testing notes."],Xah=["AGENTS.md","CLAUDE.md"],vws="@AGENTS.md",Zah=5,jah=.5,elh=.99;async function dNt(e,t={}){t.createWorkflow&&await tlh(e,t.cronExpression??Yah,t.env??process.env),await slh(e)}async function tlh(e,t,r){let n=d$e.join(e,".github","workflows","openwiki-update.yml");try{await tgr(n,"utf8");return}catch(s){if(!_E(s))throw s}await Kah(d$e.dirname(n),{recursive:!0}),await j1u(n,flh(t,r),"utf8")}async function QEn(e,t,r){let n=rlh(await nlh(e)),s=[];for(let l of Object.values(UCe())){if(l.mode!=="code")continue;wws(r,`Ingesting from ${l.displayName}\u2026
|
package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/skills/mermaid-diagrams/SKILL.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mermaid-diagrams
|
|
3
|
+
description: Embed Mermaid diagrams in generated wiki pages. Use whenever documenting a runtime or request flow, a call sequence, a state machine or lifecycle, a data model or entity relationships, or non-trivial control flow, since these are clearer as a diagram than as prose. Also use when an update run touches a page that already contains a mermaid fence, or a page that contains a text fence a previous run degraded.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Mermaid Diagrams In Generated Wiki Pages
|
|
7
|
+
|
|
8
|
+
Diagrams are part of high-quality wiki generation, not decoration. Where a flow,
|
|
9
|
+
lifecycle, or data model is easier to grasp visually, embed a Mermaid diagram in
|
|
10
|
+
a fenced ```mermaid block on the most relevant page.
|
|
11
|
+
|
|
12
|
+
## Choosing a diagram type
|
|
13
|
+
|
|
14
|
+
- `sequenceDiagram` for runtime and request flows across components (auth flows, request lifecycles, agent tool loops).
|
|
15
|
+
- `stateDiagram-v2` for lifecycles and state machines (job states, connection states, run phases).
|
|
16
|
+
- `erDiagram` for the data model: entities and their relationships.
|
|
17
|
+
- `flowchart TD` for branching control flow and decision logic.
|
|
18
|
+
|
|
19
|
+
## Discipline
|
|
20
|
+
|
|
21
|
+
- Ground every diagram in inspected source. Do not invent participants, states, entities, or relationships the code does not support.
|
|
22
|
+
- Cover the high-value cases: add a diagram wherever a page documents a request or runtime flow, a call sequence, a lifecycle or state machine, or a data model. A repository wiki usually has several such diagrams, not one overall. Skip pages that are navigation, reference tables, or pure configuration.
|
|
23
|
+
- Still prefer a few strong diagrams over decorating every page: one accurate diagram on the page that needs it beats a diagram forced onto every page.
|
|
24
|
+
- Give each diagram a one-line caption directly below it stating what it shows.
|
|
25
|
+
- OpenWiki validates every mermaid fence after your run and converts fences that fail to parse into plain text fences. A degraded diagram is a quality failure; follow the syntax rules below so it does not happen.
|
|
26
|
+
|
|
27
|
+
## Syntax safety
|
|
28
|
+
|
|
29
|
+
These rules prevent the most common render breakages. When in doubt, rephrase the label.
|
|
30
|
+
|
|
31
|
+
- Never place semicolons or pipes inside node, message, or edge labels.
|
|
32
|
+
- Never place unescaped angle brackets in labels; write "returns Promise of User" instead of "returns Promise<User>".
|
|
33
|
+
- In `flowchart`, wrap any label containing parentheses, brackets, or other punctuation in double quotes: `A["calls foo(bar)"]`.
|
|
34
|
+
- In `flowchart`, never use the bare word `end` as a node id, and never start a node id with `o` or `x` followed by a dash (both are edge-marker syntax); rename the node.
|
|
35
|
+
- In `sequenceDiagram`, participant names with spaces or punctuation need an alias: `participant AS as Auth Service`.
|
|
36
|
+
- Never use a Mermaid reserved word as a participant name, alias, or node id: `note`, `end`, `loop`, `alt`, `opt`, `par`, `and`, `else`, `activate`, `deactivate`, `class`, `state`, `click`, `link`. For example a notification participant must be `Notifier`, not `Note` (which collides with the `note` keyword).
|
|
37
|
+
- In `erDiagram`, entity and attribute names must be single identifier-like tokens; put human phrasing in the relationship label.
|
|
38
|
+
- Keep labels short. Move explanation into the surrounding prose or the caption, not the diagram.
|
|
39
|
+
|
|
40
|
+
## Update runs
|
|
41
|
+
|
|
42
|
+
- A wrong diagram is a stale claim, not existing structure to preserve. If a source change makes a diagram inaccurate, update the diagram in the same edit as the surrounding prose.
|
|
43
|
+
- Do not rewrite a diagram that is still accurate. Regenerating unchanged diagrams creates diff noise.
|
|
44
|
+
- If a page contains a text fence preceded by an HTML comment starting with "openwiki: mermaid parse failed", that is a diagram a previous run degraded. Fix the syntax using the parser error in the comment, restore the ```mermaid fence, and delete the comment.
|
package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/skills/write-connector/SKILL.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-connector
|
|
3
|
+
description: Add a new built-in OpenWiki source connector. Use when a user asks to create or implement an OpenWiki connector.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Write An OpenWiki Connector
|
|
7
|
+
|
|
8
|
+
OpenWiki connectors are built-in TypeScript modules in the OSS repository. Do not create a plugin marketplace, dynamic connector package, or runtime-loaded untrusted connector. Add normal source files and tests.
|
|
9
|
+
|
|
10
|
+
## Prefer Custom MCP For Arbitrary Servers
|
|
11
|
+
|
|
12
|
+
If the knowledge source already exposes a read-only MCP server (HTTP or stdio), use the built-in `custom-mcp` connector instead of adding a new ConnectorId:
|
|
13
|
+
|
|
14
|
+
- Configure `~/.openwiki/connectors/custom-mcp/config.json` with `enabled`, `transport`, optional `allowedTools`, and optional `readOnlyOperations`.
|
|
15
|
+
- Put secrets in `~/.openwiki/.env` and reference them as `${ENV_NAME}` in transport headers/env.
|
|
16
|
+
- Agent tools `openwiki_list_mcp_tools` / `openwiki_call_mcp_tool` accept `custom-mcp`.
|
|
17
|
+
|
|
18
|
+
Add a dedicated built-in connector only when you need provider-specific auth, scoping UI, or deterministic API pulls that MCP cannot express.
|
|
19
|
+
|
|
20
|
+
## Required Shape
|
|
21
|
+
|
|
22
|
+
- Add the connector to src/connectors/types.ts and src/connectors/registry.ts.
|
|
23
|
+
- Implement the connector under src/connectors/sources/<connector>.ts.
|
|
24
|
+
- The connector must expose a ConnectorRuntime with id, displayName, description, backend, requiredEnv, supportsAgenticDiscovery, and ingest().
|
|
25
|
+
- Ingestion writes raw JSON/manifests under ~/.openwiki/connectors/<id>/raw/<run-id>/.
|
|
26
|
+
- State lives in ~/.openwiki/connectors/<id>/state.json.
|
|
27
|
+
- Config lives in ~/.openwiki/connectors/<id>/config.json.
|
|
28
|
+
- Secrets live in ~/.openwiki/.env and are referenced only by env var name.
|
|
29
|
+
|
|
30
|
+
## Security Rules
|
|
31
|
+
|
|
32
|
+
- Never read, print, log, return, or hardcode secret values.
|
|
33
|
+
- Do not store credentials in connector config, raw files, state, logs, or tests.
|
|
34
|
+
- Validate connector IDs and raw file paths so reads and writes stay inside ~/.openwiki/connectors/<id>/.
|
|
35
|
+
- Use deterministic ingestion code for credentialed external fetching.
|
|
36
|
+
- If wrapping MCP, treat the MCP server as read-only and call only allowlisted read/dump operations from connector config.
|
|
37
|
+
- Do not let untrusted connector manifests instantiate arbitrary commands or arbitrary network endpoints without explicit built-in code review.
|
|
38
|
+
- For `custom-mcp`, users configure a reviewed built-in wrapper; still require allowedTools and/or MCP readOnlyHint before agentic tool calls (no mutating-tool heuristics beyond Notion's hosted endpoint).
|
|
39
|
+
|
|
40
|
+
## Ingestion Rules
|
|
41
|
+
|
|
42
|
+
- Git/local repos should write compact manifests and let the agent inspect the local repo as the source of truth.
|
|
43
|
+
- Sources with timestamps should store per-stream cursors.
|
|
44
|
+
- Sources with object metadata should store IDs, last edited timestamps, and content hashes.
|
|
45
|
+
- Sources with pagination should store enough state to continue without refetching everything.
|
|
46
|
+
- Raw dumps should preserve source IDs, timestamps, URLs, authors, and enough provenance for citations.
|
|
47
|
+
|
|
48
|
+
## User-Facing Finish
|
|
49
|
+
|
|
50
|
+
When done, tell the user:
|
|
51
|
+
|
|
52
|
+
- which connector files changed,
|
|
53
|
+
- which env vars to set in ~/.openwiki/.env,
|
|
54
|
+
- what config file to create or edit,
|
|
55
|
+
- how to run openwiki personal --update to trigger ingestion,
|
|
56
|
+
- which scopes/permissions the source provider requires.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"jsdom": "^26.1.0",
|
|
16
|
-
"total-recall-brain": "3.41.
|
|
16
|
+
"total-recall-brain": "3.41.5"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"node_modules/@alcalzone/ansi-tokenize": {
|
|
@@ -1686,9 +1686,9 @@
|
|
|
1686
1686
|
},
|
|
1687
1687
|
"node_modules/@ssss/cli": {
|
|
1688
1688
|
"name": "@gregiteen/ssss-cli",
|
|
1689
|
-
"version": "0.14.
|
|
1690
|
-
"resolved": "https://registry.npmjs.org/@gregiteen/ssss-cli/-/ssss-cli-0.14.
|
|
1691
|
-
"integrity": "sha512-
|
|
1689
|
+
"version": "0.14.4",
|
|
1690
|
+
"resolved": "https://registry.npmjs.org/@gregiteen/ssss-cli/-/ssss-cli-0.14.4.tgz",
|
|
1691
|
+
"integrity": "sha512-R6JIgPRvS9xXp0xb6BYO3rauv+72r35GIiDrJcvbjPdTSHFZXr8/jRxFOgoF8yTed/5xyGFF3ey3DI9bOjmHVA==",
|
|
1692
1692
|
"dev": true,
|
|
1693
1693
|
"license": "ISC",
|
|
1694
1694
|
"bin": {
|
|
@@ -5698,9 +5698,9 @@
|
|
|
5698
5698
|
}
|
|
5699
5699
|
},
|
|
5700
5700
|
"node_modules/total-recall-brain": {
|
|
5701
|
-
"version": "3.41.
|
|
5702
|
-
"resolved": "https://registry.npmjs.org/total-recall-brain/-/total-recall-brain-3.41.
|
|
5703
|
-
"integrity": "sha512-
|
|
5701
|
+
"version": "3.41.5",
|
|
5702
|
+
"resolved": "https://registry.npmjs.org/total-recall-brain/-/total-recall-brain-3.41.5.tgz",
|
|
5703
|
+
"integrity": "sha512-gaW46xAtnFf+zfkv8LHYQLMzt27JjelyFggc8zAZafCnCJRbNSP8D02cbbcx49f3a70t/hkgA9RhJOY8HTqRFg==",
|
|
5704
5704
|
"dev": true,
|
|
5705
5705
|
"license": "MIT",
|
|
5706
5706
|
"workspaces": [
|
|
@@ -5708,7 +5708,7 @@
|
|
|
5708
5708
|
],
|
|
5709
5709
|
"dependencies": {
|
|
5710
5710
|
"@simplewebauthn/server": "^13.3.2",
|
|
5711
|
-
"@ssss/cli": "npm:@gregiteen/ssss-cli@0.14.
|
|
5711
|
+
"@ssss/cli": "npm:@gregiteen/ssss-cli@0.14.4",
|
|
5712
5712
|
"bcrypt": "^6.0.0",
|
|
5713
5713
|
"better-sqlite3": "^12.11.1",
|
|
5714
5714
|
"cookie-parser": "^1.4.7",
|
package/src/cli/agent.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { listAgents, spawnAgent, killAgent, getAgentLogs } from '../core/agent-manager.mjs';
|
|
4
4
|
import { detectHarnesses } from '../core/meta-harness.mjs';
|
|
5
|
+
import { checkReceipt, findRoot, ACK_COMMAND } from '../core/preflight-receipt.mjs';
|
|
5
6
|
|
|
6
7
|
function printHelp() {
|
|
7
8
|
console.log(`
|
|
@@ -33,7 +34,7 @@ Auth:
|
|
|
33
34
|
else from the Total Recall secret store, so SSH/launchd sessions without a login keychain work.
|
|
34
35
|
|
|
35
36
|
Available Harnesses:
|
|
36
|
-
agy, claude, codex,
|
|
37
|
+
agy, claude, codex, dsh, hermes, openclaw
|
|
37
38
|
|
|
38
39
|
Examples:
|
|
39
40
|
npx total-recall agent list
|
|
@@ -144,6 +145,16 @@ export async function run(argv) {
|
|
|
144
145
|
process.exit(1);
|
|
145
146
|
}
|
|
146
147
|
|
|
148
|
+
if (!targetNode) {
|
|
149
|
+
const root = findRoot(cwd || process.cwd());
|
|
150
|
+
const receipt = checkReceipt(root);
|
|
151
|
+
if (!receipt.ok) {
|
|
152
|
+
console.error(`\nā Agent spawn refused by TR-PREFLIGHT gate: ${receipt.problems[0] || 'check failed'} (directory: ${root}).`);
|
|
153
|
+
console.error(` Read the complete context capsule, then run: ${ACK_COMMAND}\n`);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
147
158
|
const nodeStr = targetNode ? ` on mesh node \x1b[1;33m${targetNode}\x1b[0m` : '';
|
|
148
159
|
if (!isJson) console.log(`\nš Spawning agent on harness: \x1b[1;36m${harness}\x1b[0m${nodeStr}...`);
|
|
149
160
|
try {
|
package/src/cli/compact.mjs
CHANGED
|
@@ -55,10 +55,10 @@ function lexicalScore(terms, text) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/** Rank the applicable rules against the task and fit them into `budget`. Shared by `compact` and `context`. */
|
|
58
|
-
export async function compactNodes({ task, actions = [], budget, expand = [], complete = false, nodes, skillsDir, derivedDirs, header }) {
|
|
58
|
+
export async function compactNodes({ task, actions = [], budget, expand = [], complete = false, rank = true, nodes, skillsDir, derivedDirs, header }) {
|
|
59
59
|
const rules = selectRules(curatedRules(nodes), { actions, projectRoot: process.cwd() });
|
|
60
60
|
const vectors = loadVectors(derivedDirs);
|
|
61
|
-
const taskVector = await embedTask(task);
|
|
61
|
+
const taskVector = rank ? await embedTask(task) : null;
|
|
62
62
|
const terms = String(task).toLowerCase().match(/[\p{L}\p{N}_-]{3,}/gu) || [];
|
|
63
63
|
const semantic = Boolean(taskVector);
|
|
64
64
|
|