agentix-cli 0.69.3 → 0.70.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.
Files changed (119) hide show
  1. package/dist/agent-V223TG6H.js +2 -0
  2. package/dist/{board-dashboard-U6IZQA4W.js → board-dashboard-HR3PQPFW.js} +2 -2
  3. package/dist/{board-dashboard-U6IZQA4W.js.map → board-dashboard-HR3PQPFW.js.map} +1 -1
  4. package/dist/{chunk-NO2HOK4B.js → chunk-23A5K5UW.js} +3 -3
  5. package/dist/chunk-23A5K5UW.js.map +1 -0
  6. package/dist/{chunk-DW5EHX3M.js → chunk-3IY2YWXP.js} +2 -2
  7. package/dist/{chunk-IULWZA3J.js → chunk-3RC4LO2G.js} +6 -6
  8. package/dist/chunk-3RC4LO2G.js.map +1 -0
  9. package/dist/{chunk-SZJMS7K4.js → chunk-5MUJZODV.js} +19 -19
  10. package/dist/chunk-5MUJZODV.js.map +1 -0
  11. package/dist/{chunk-KPPGT5FJ.js → chunk-6QDOUOKD.js} +2 -2
  12. package/dist/{chunk-E7OACKES.js → chunk-BBIWAJRX.js} +2 -2
  13. package/dist/{chunk-Y57CULGE.js → chunk-C245D4BZ.js} +2 -2
  14. package/dist/{chunk-64P4QHSZ.js → chunk-CECHWYJ2.js} +1 -1
  15. package/dist/{chunk-64P4QHSZ.js.map → chunk-CECHWYJ2.js.map} +1 -1
  16. package/dist/chunk-FBDIJEKL.js +152 -0
  17. package/dist/chunk-FBDIJEKL.js.map +1 -0
  18. package/dist/chunk-JHCI6XCJ.js +5 -0
  19. package/dist/chunk-JHCI6XCJ.js.map +1 -0
  20. package/dist/{chunk-USMCN2X3.js → chunk-LHLNARRW.js} +13 -13
  21. package/dist/chunk-ML6CNRBK.js +105 -0
  22. package/dist/chunk-ML6CNRBK.js.map +1 -0
  23. package/dist/{chunk-FGFDPYL4.js → chunk-P2RYUODK.js} +2 -2
  24. package/dist/chunk-P2RYUODK.js.map +1 -0
  25. package/dist/{chunk-SXKOI2IF.js → chunk-PHDS2HIN.js} +118 -118
  26. package/dist/chunk-PHDS2HIN.js.map +1 -0
  27. package/dist/{chunk-RN5NOIBH.js → chunk-SN5N2FPG.js} +2 -2
  28. package/dist/chunk-TLDQWTSW.js +49 -0
  29. package/dist/chunk-TLDQWTSW.js.map +1 -0
  30. package/dist/chunk-TTVVXBCM.js +2 -0
  31. package/dist/chunk-TTVVXBCM.js.map +1 -0
  32. package/dist/{chunk-B7S66EK7.js → chunk-W7SEPJFH.js} +14 -14
  33. package/dist/chunk-W7SEPJFH.js.map +1 -0
  34. package/dist/chunk-WLMQ5JMX.js +6 -0
  35. package/dist/chunk-WLMQ5JMX.js.map +1 -0
  36. package/dist/{chunk-3FWJXI7H.js → chunk-YBF2QVZ7.js} +2 -2
  37. package/dist/{chunk-VVMOTM3V.js → chunk-YK7GFEGO.js} +2 -2
  38. package/dist/cli.js +1 -1
  39. package/dist/cli.js.map +1 -1
  40. package/dist/{compaction-H5U32UU6.js → compaction-MECSN36J.js} +4 -4
  41. package/dist/compaction-MECSN36J.js.map +1 -0
  42. package/dist/{context-planner-LJT5IKH6.js → context-planner-JU7CNXCB.js} +3 -3
  43. package/dist/context-planner-JU7CNXCB.js.map +1 -0
  44. package/dist/graph-FJ53FDWK.js +2 -0
  45. package/dist/heal-CMQL5SG4.js +2 -0
  46. package/dist/index.d.ts +41 -6
  47. package/dist/index.js +2 -2
  48. package/dist/index.js.map +1 -1
  49. package/dist/loader-YFVSSYSL.js +2 -0
  50. package/dist/memory-extract-YCNCARZ2.js +2 -0
  51. package/dist/migrate-v2-ZOIMGITH.js +4 -0
  52. package/dist/{migrate-v2-KOMPDC6U.js.map → migrate-v2-ZOIMGITH.js.map} +1 -1
  53. package/dist/program-UTELWTXC.js +2 -0
  54. package/dist/promote-B5AOKPQR.js +2 -0
  55. package/dist/{providers-NRPX2FHP.js → providers-ES5KVLI4.js} +2 -2
  56. package/dist/query-QLJNQUUP.js +2 -0
  57. package/dist/registry-CTZFLXGB.js +2 -0
  58. package/dist/{request-planner-YIG5RUN2.js → request-planner-NMOAOZIM.js} +2 -2
  59. package/dist/{review-candidates-2JFQ2M53.js → review-candidates-FLY6HZEN.js} +2 -2
  60. package/dist/{routing-3CIQQZJ4.js → routing-SMIZ77CT.js} +2 -2
  61. package/dist/{seat-HMF3G6BR.js → seat-F3S2HG5G.js} +2 -2
  62. package/dist/{select-2P73MN6O.js → select-5GC7CTPQ.js} +2 -2
  63. package/dist/types-NZOBHQGS.js +2 -0
  64. package/dist/wiki-X76JUHXT.js +2 -0
  65. package/dist/wiki-X76JUHXT.js.map +1 -0
  66. package/package.json +1 -1
  67. package/dist/agent-OJQKD5AI.js +0 -2
  68. package/dist/chunk-4DRNEOOW.js +0 -2
  69. package/dist/chunk-4DRNEOOW.js.map +0 -1
  70. package/dist/chunk-B7S66EK7.js.map +0 -1
  71. package/dist/chunk-EQTSOK7L.js +0 -109
  72. package/dist/chunk-EQTSOK7L.js.map +0 -1
  73. package/dist/chunk-FGFDPYL4.js.map +0 -1
  74. package/dist/chunk-IULWZA3J.js.map +0 -1
  75. package/dist/chunk-JQXG2OO6.js +0 -152
  76. package/dist/chunk-JQXG2OO6.js.map +0 -1
  77. package/dist/chunk-JYBSYW7T.js +0 -45
  78. package/dist/chunk-JYBSYW7T.js.map +0 -1
  79. package/dist/chunk-NO2HOK4B.js.map +0 -1
  80. package/dist/chunk-SXKOI2IF.js.map +0 -1
  81. package/dist/chunk-SZJMS7K4.js.map +0 -1
  82. package/dist/chunk-VDMYBPYB.js +0 -5
  83. package/dist/chunk-VDMYBPYB.js.map +0 -1
  84. package/dist/compaction-H5U32UU6.js.map +0 -1
  85. package/dist/context-planner-LJT5IKH6.js.map +0 -1
  86. package/dist/heal-HVYQD3EZ.js +0 -2
  87. package/dist/loader-EVHZ2R73.js +0 -2
  88. package/dist/memory-extract-F76BE6KA.js +0 -2
  89. package/dist/migrate-v2-KOMPDC6U.js +0 -4
  90. package/dist/program-O67GMIWX.js +0 -2
  91. package/dist/promote-7SU6IJDC.js +0 -2
  92. package/dist/query-CY7F5ZFR.js +0 -2
  93. package/dist/registry-K76DGYLW.js +0 -2
  94. package/dist/types-S6NHM5C3.js +0 -2
  95. package/dist/wiki-VXTUHSRH.js +0 -2
  96. /package/dist/{agent-OJQKD5AI.js.map → agent-V223TG6H.js.map} +0 -0
  97. /package/dist/{chunk-DW5EHX3M.js.map → chunk-3IY2YWXP.js.map} +0 -0
  98. /package/dist/{chunk-KPPGT5FJ.js.map → chunk-6QDOUOKD.js.map} +0 -0
  99. /package/dist/{chunk-E7OACKES.js.map → chunk-BBIWAJRX.js.map} +0 -0
  100. /package/dist/{chunk-Y57CULGE.js.map → chunk-C245D4BZ.js.map} +0 -0
  101. /package/dist/{chunk-USMCN2X3.js.map → chunk-LHLNARRW.js.map} +0 -0
  102. /package/dist/{chunk-RN5NOIBH.js.map → chunk-SN5N2FPG.js.map} +0 -0
  103. /package/dist/{chunk-3FWJXI7H.js.map → chunk-YBF2QVZ7.js.map} +0 -0
  104. /package/dist/{chunk-VVMOTM3V.js.map → chunk-YK7GFEGO.js.map} +0 -0
  105. /package/dist/{heal-HVYQD3EZ.js.map → graph-FJ53FDWK.js.map} +0 -0
  106. /package/dist/{loader-EVHZ2R73.js.map → heal-CMQL5SG4.js.map} +0 -0
  107. /package/dist/{memory-extract-F76BE6KA.js.map → loader-YFVSSYSL.js.map} +0 -0
  108. /package/dist/{program-O67GMIWX.js.map → memory-extract-YCNCARZ2.js.map} +0 -0
  109. /package/dist/{promote-7SU6IJDC.js.map → program-UTELWTXC.js.map} +0 -0
  110. /package/dist/{providers-NRPX2FHP.js.map → promote-B5AOKPQR.js.map} +0 -0
  111. /package/dist/{query-CY7F5ZFR.js.map → providers-ES5KVLI4.js.map} +0 -0
  112. /package/dist/{registry-K76DGYLW.js.map → query-QLJNQUUP.js.map} +0 -0
  113. /package/dist/{routing-3CIQQZJ4.js.map → registry-CTZFLXGB.js.map} +0 -0
  114. /package/dist/{request-planner-YIG5RUN2.js.map → request-planner-NMOAOZIM.js.map} +0 -0
  115. /package/dist/{review-candidates-2JFQ2M53.js.map → review-candidates-FLY6HZEN.js.map} +0 -0
  116. /package/dist/{seat-HMF3G6BR.js.map → routing-SMIZ77CT.js.map} +0 -0
  117. /package/dist/{types-S6NHM5C3.js.map → seat-F3S2HG5G.js.map} +0 -0
  118. /package/dist/{select-2P73MN6O.js.map → select-5GC7CTPQ.js.map} +0 -0
  119. /package/dist/{wiki-VXTUHSRH.js.map → types-NZOBHQGS.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/migrate-v2.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync, copyFileSync } from \"fs\"\nimport { join } from \"path\"\nimport type { GraphStore } from \"./store\"\nimport { type IndexFile, indexFileSchema, type Classification, classificationSchema } from \"./types\"\n\n// --- Phase 2 of classifier-retire — bulk remap of past classifications ---\n//\n// The Phase 1 schema migration auto-converts schema.json + nodes.json from\n// v1 (scope/location/org/unit/activity) → v2 (category/verb). It does NOT\n// touch the two stores that hold real classification history:\n//\n// classifications.jsonl — append-only audit log of every decision\n// index.json — fingerprint → path cache used at hot-path\n//\n// Without remapping those, every recurring message keeps hitting the cache\n// and resolving to a v1 path that no longer exists in nodes.json. The UI\n// then renders raw ids (\"activity-rotate-tokens\") instead of the verb\n// label (\"Rotate credential\"). This module rewrites them in-place via\n// keyword heuristics — no LLM calls, no paid path.\n//\n// Idempotent: re-running on already-v2 data is a no-op.\n\nconst CATEGORY_SET = new Set([\n \"code\", \"ops\", \"support\", \"admin\", \"knowledge\", \"social\", \"system\",\n])\n\n/** Best-effort keyword mapping from a v1 leaf slug to a v2 (category, verb)\n * pair. Patterns are checked in order; first match wins. Anything that\n * doesn't hit a pattern is left alone (the next live classification will\n * re-classify the fingerprint with the new prompt). */\nconst PATTERNS: Array<{ test: RegExp; category: string; verb: string }> = [\n // --- code ---\n { test: /\\b(review[-_.]?(merge[-_.]?request|mr|pull[-_.]?request|pr))\\b/i, category: \"code\", verb: \"review.merge-request\" },\n { test: /\\breview[-_.]?(code|change|diff|snippet)\\b/i, category: \"code\", verb: \"review.code-change\" },\n { test: /\\b(fix|patch)[-_.]/i, category: \"code\", verb: \"fix.bug\" },\n { test: /\\b(implement|build|add)[-_.]?(feature|cli|api|endpoint)\\b/i, category: \"code\", verb: \"implement.feature\" },\n { test: /\\bimplement[-_.]/i, category: \"code\", verb: \"implement.feature\" },\n { test: /\\b(debug|investigate)[-_.]/i, category: \"code\", verb: \"investigate.error\" },\n { test: /\\brefactor\\b/i, category: \"code\", verb: \"refactor.code\" },\n { test: /\\b(plan|spec|rfc|design)[-_.]/i, category: \"code\", verb: \"spec.feature\" },\n { test: /\\b(handle|triage)[-_.]?(github|gitlab)?[-_.]?(issue|push|pr|mr|webhook|comment)\\b/i, category: \"code\", verb: \"triage.issue\" },\n { test: /\\btriage[-_.]?(issue|ticket)?\\b/i, category: \"code\", verb: \"triage.issue\" },\n { test: /\\banswer[-_.]?(code[-_.]?question|technical[-_.]?question)\\b/i, category: \"code\", verb: \"answer.code-question\" },\n { test: /\\b(commit|push|checkout|sync|merge)[-_.]/i, category: \"code\", verb: \"refactor.code\" },\n { test: /\\bauthor[-_.]?(workflow|spec|rfc)\\b/i, category: \"code\", verb: \"spec.feature\" },\n\n // --- ops ---\n { test: /\\bdeploy[-_.]?(staging|preview|qa|test)\\b/i, category: \"ops\", verb: \"deploy.staging\" },\n { test: /\\bdeploy[-_.]?(prod|production|live|release)\\b/i, category: \"ops\", verb: \"deploy.production\" },\n { test: /\\bdeploy[-_.]/i, category: \"ops\", verb: \"deploy.staging\" },\n { test: /\\brollback\\b/i, category: \"ops\", verb: \"rollback.release\" },\n { test: /\\binvestigate[-_.]?incident\\b/i, category: \"ops\", verb: \"investigate.incident\" },\n { test: /\\b(monitor|status|health[-_.]?check|metrics)\\b/i, category: \"ops\", verb: \"monitor.system\" },\n { test: /\\b(restart|stop|start)[-_.]?(daemon|service|server)\\b/i, category: \"ops\", verb: \"monitor.system\" },\n { test: /\\brun[-_.]?(server|infra)?[-_.]?(security|audit)\\b/i, category: \"ops\", verb: \"audit.security\" },\n { test: /\\brotate[-_.]?(token|tokens|credential|credentials|key|cert|secret)s?\\b/i, category: \"ops\", verb: \"rotate.credential\" },\n { test: /\\baudit\\b/i, category: \"ops\", verb: \"audit.security\" },\n { test: /\\bsetup[-_.]/i, category: \"ops\", verb: \"monitor.system\" },\n\n // --- support ---\n { test: /\\b(greet(ing)?|hello|hi[-_.]?there)\\b/i, category: \"support\", verb: \"chat.greeting\" },\n { test: /\\b(support[-_.]?request|help[-_.]?request|customer[-_.]?question)\\b/i, category: \"support\", verb: \"chat.support-request\" },\n { test: /\\b(casual|chitchat|smalltalk)\\b/i, category: \"support\", verb: \"chat.casual\" },\n { test: /\\b(query|ask|clarify|confirm)[-_.]/i, category: \"support\", verb: \"answer.question\" },\n { test: /\\b(reply|respond)[-_.]/i, category: \"support\", verb: \"route.request\" },\n { test: /\\banswer[-_.]?question\\b/i, category: \"support\", verb: \"answer.question\" },\n { test: /\\broute[-_.]?(request|message|to[-_.]?agent)\\b/i, category: \"support\", verb: \"route.request\" },\n\n // --- admin ---\n { test: /\\bconfig[-_.]?(change|update|edit)?\\b/i, category: \"admin\", verb: \"config.change\" },\n { test: /\\bconfigure[-_.]/i, category: \"admin\", verb: \"config.change\" },\n { test: /\\b(schedule|cron)[-_.]?(add|create|new)\\b/i, category: \"admin\", verb: \"schedule.add\" },\n { test: /\\b(reminder|remind)\\b/i, category: \"admin\", verb: \"schedule.add\" },\n { test: /\\b(schedule|cron)[-_.]?(remove|delete|disable)\\b/i, category: \"admin\", verb: \"schedule.remove\" },\n { test: /\\b(provide|assign|copy)[-_.]?(token|tokens|credential|credentials|cert|secret)s?\\b/i, category: \"admin\", verb: \"token.create\" },\n { test: /\\b(token[-_.]?(create|mint|issue)|mint[-_.]?token)\\b/i, category: \"admin\", verb: \"token.create\" },\n { test: /\\bagent[-_.]?(add|onboard|new|configure)\\b/i, category: \"admin\", verb: \"agent.add\" },\n { test: /\\bchannel[-_.]?(add|wire|new|configure)\\b/i, category: \"admin\", verb: \"channel.add\" },\n { test: /\\bauthorize[-_.]/i, category: \"admin\", verb: \"config.change\" },\n { test: /\\bcorrect[-_.]/i, category: \"admin\", verb: \"config.change\" },\n\n // --- knowledge ---\n { test: /\\b(document|docs|readme|wiki[-_.]?write)\\b/i, category: \"knowledge\", verb: \"document.feature\" },\n { test: /\\bsummariz?e\\b/i, category: \"knowledge\", verb: \"summarize.thread\" },\n { test: /\\b(research|analyze|compare|investigate[-_.]?repo)\\b/i, category: \"knowledge\", verb: \"research.topic\" },\n { test: /\\bwiki[-_.]?(absorb|ingest|import|run)\\b/i, category: \"knowledge\", verb: \"wiki.absorb\" },\n { test: /\\bcompile[-_.]?(brief|report|digest)\\b/i, category: \"knowledge\", verb: \"summarize.thread\" },\n\n // --- social ---\n { test: /\\b(daily[-_.]?brief|brief[-_.]?daily|morning[-_.]?digest)\\b/i, category: \"social\", verb: \"brief.daily\" },\n { test: /\\b(draft[-_.]?(social|post|tweet|announcement|blog|article)|social[-_.]?post)\\b/i, category: \"social\", verb: \"draft.post\" },\n { test: /\\bcreate[-_.]?(blog|article|post)\\b/i, category: \"social\", verb: \"draft.post\" },\n { test: /\\bcompile[-_.]?(marketing|social)\\b/i, category: \"social\", verb: \"brief.daily\" },\n { test: /\\b(weekly[-_.]?report|report[-_.]?weekly|status[-_.]?report)\\b/i, category: \"social\", verb: \"report.weekly\" },\n\n // --- system ---\n { test: /\\b(classify[-_.]?intent|graph[-_.]?classify)\\b/i, category: \"system\", verb: \"classify.intent\" },\n]\n\nexport interface MigrateOptions {\n /** When true, log the would-be changes and exit without writing. */\n dryRun?: boolean\n log?: (...args: unknown[]) => void\n}\n\nexport interface MigrateResult {\n /** How many fingerprint cache entries we touched. */\n indexRemapped: number\n /** Cache entries already in v2 shape (no change). */\n indexSkippedV2: number\n /** Cache entries we couldn't map (left untouched; will re-classify on next event). */\n indexUnmapped: number\n /** Classification log rows rewritten. */\n jsonlRemapped: number\n jsonlSkippedV2: number\n jsonlUnmapped: number\n /** Backup file paths created. */\n backups: string[]\n /** Per-pattern hit counts, useful for tuning the heuristic. */\n patternHits: Record<string, number>\n}\n\n/** Run the v1 → v2 remap on the given graph store dir. */\nexport function migrateV2(store: GraphStore, opts: MigrateOptions = {}): MigrateResult {\n const log = opts.log ?? console.error.bind(console, \"[graph-migrate]\")\n const baseDir = store.baseDir\n\n const result: MigrateResult = {\n indexRemapped: 0,\n indexSkippedV2: 0,\n indexUnmapped: 0,\n jsonlRemapped: 0,\n jsonlSkippedV2: 0,\n jsonlUnmapped: 0,\n backups: [],\n patternHits: {},\n }\n\n // ----- index.json -----\n const indexPath = join(baseDir, \"index.json\")\n if (existsSync(indexPath)) {\n const raw = readFileSync(indexPath, \"utf-8\")\n const parsed = indexFileSchema.parse(JSON.parse(raw))\n const updated: IndexFile = { version: parsed.version, entries: {} }\n for (const [fp, entry] of Object.entries(parsed.entries)) {\n const remapped = remapPath(entry.path, result.patternHits)\n if (remapped === \"v2\") {\n updated.entries[fp] = entry\n result.indexSkippedV2++\n continue\n }\n if (remapped === null) {\n updated.entries[fp] = entry\n result.indexUnmapped++\n continue\n }\n updated.entries[fp] = {\n ...entry,\n path: remapped,\n updatedAt: new Date().toISOString(),\n }\n result.indexRemapped++\n }\n if (!opts.dryRun) {\n const backup = `${indexPath}.v1.bak.${Date.now()}.json`\n copyFileSync(indexPath, backup)\n result.backups.push(backup)\n writeFileSync(indexPath, JSON.stringify(updated, null, 2), \"utf-8\")\n }\n }\n\n // ----- classifications.jsonl -----\n const jsonlPath = join(baseDir, \"classifications.jsonl\")\n if (existsSync(jsonlPath)) {\n const raw = readFileSync(jsonlPath, \"utf-8\")\n const lines = raw.split(\"\\n\")\n const out: string[] = []\n for (const line of lines) {\n if (!line.trim()) { out.push(line); continue }\n let parsed: Classification\n try {\n parsed = classificationSchema.parse(JSON.parse(line))\n } catch {\n // Pass through anything we can't parse — better to keep the audit\n // log intact than drop unrecognized rows.\n out.push(line)\n continue\n }\n const remapped = remapPath(parsed.path, result.patternHits)\n if (remapped === \"v2\") {\n result.jsonlSkippedV2++\n out.push(line)\n continue\n }\n if (remapped === null) {\n result.jsonlUnmapped++\n out.push(line)\n continue\n }\n const next: Classification = {\n ...parsed,\n path: remapped,\n // Strip v1 axes — they reference nodes that no longer exist post-migration.\n proposedAxes: {},\n }\n out.push(JSON.stringify(next))\n result.jsonlRemapped++\n }\n if (!opts.dryRun) {\n const backup = `${jsonlPath}.v1.bak.${Date.now()}.jsonl`\n copyFileSync(jsonlPath, backup)\n result.backups.push(backup)\n writeFileSync(jsonlPath, out.join(\"\\n\"), \"utf-8\")\n }\n }\n\n log(\n `index: ${result.indexRemapped} remapped, ${result.indexSkippedV2} already v2, ${result.indexUnmapped} unmapped`,\n )\n log(\n `jsonl: ${result.jsonlRemapped} remapped, ${result.jsonlSkippedV2} already v2, ${result.jsonlUnmapped} unmapped`,\n )\n if (opts.dryRun) log(\"(dry-run — no files written)\")\n else log(`backups: ${result.backups.join(\", \")}`)\n return result\n}\n\n/** Map a v1 path to a v2 path, OR detect that it's already v2, OR give up.\n * \"v2\" → path is already in v2 shape (length 1–2, root in CATEGORY_SET)\n * null → no pattern matched; caller should leave the entry alone\n * array → the new v2 path */\nfunction remapPath(path: string[], hits: Record<string, number>): string[] | \"v2\" | null {\n if (!Array.isArray(path) || path.length === 0) return null\n // Already v2 if the root is one of the closed categories.\n if (CATEGORY_SET.has(path[0])) return \"v2\"\n\n // The leaf carries the verb information in v1 (e.g. \"activity-review-mr\").\n // We also try the full path joined, because some leaves are just numeric ids.\n const haystack = `${path.join(\" \")} ${path[path.length - 1] ?? \"\"}`\n for (const p of PATTERNS) {\n if (p.test.test(haystack)) {\n hits[p.verb] = (hits[p.verb] ?? 0) + 1\n return [p.category, p.verb]\n }\n }\n return null\n}\n"],"mappings":"2EAAA,OAAS,gBAAAA,EAAc,iBAA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AAA,CAAI,EAAG,OAAO,GAIpD,OAAApB,EACE,UAAUE,EAAO,2BAA2BA,EAAO,8BAA8BA,EAAO,wBAC1F,EACAF,EACE,UAAUE,EAAO,2BAA2BA,EAAO,8BAA8BA,EAAO,wBAC1F,EACIH,EAAK,OAAQC,EAAI,mCAA8B,EAC9CA,EAAI,YAAYE,EAAO,QAAQ,KAAK,IAAI,GAAG,EACzCA,CACT,CAMA,SAASY,EAAUU,EAAgBC,EAAsD,CACvF,GAAI,CAAC,MAAM,QAAQD,CAAI,GAAKA,EAAK,SAAW,EAAG,OAAO,KAEtD,GAAI7B,EAAa,IAAI6B,EAAK,CAAC,CAAC,EAAG,MAAO,KAItC,IAAME,EAAW,GAAGF,EAAK,KAAK,GAAG,KAAKA,EAAKA,EAAK,OAAS,CAAC,GAAK,KAC/D,QAAWG,KAAK/B,EACd,GAAI+B,EAAE,KAAK,KAAKD,CAAQ,EACtB,OAAAD,EAAKE,EAAE,IAAI,GAAKF,EAAKE,EAAE,IAAI,GAAK,GAAK,EAC9B,CAACA,EAAE,SAAUA,EAAE,IAAI,EAG9B,OAAO,IACT","names":["readFileSync","writeFileSync","existsSync","copyFileSync","join","CATEGORY_SET","PATTERNS","migrateV2","store","opts","log","baseDir","result","indexPath","join","existsSync","raw","readFileSync","parsed","indexFileSchema","updated","fp","entry","remapped","remapPath","backup","copyFileSync","writeFileSync","jsonlPath","lines","out","line","classificationSchema","next","path","hits","haystack","p"]}
1
+ {"version":3,"sources":["../src/graph/migrate-v2.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync, copyFileSync } from \"fs\"\nimport { join } from \"path\"\nimport type { GraphStore } from \"./store\"\nimport { type IndexFile, indexFileSchema, type Classification, classificationSchema } from \"./types\"\n\n// --- Phase 2 of classifier-retire — bulk remap of past classifications ---\n//\n// The Phase 1 schema migration auto-converts schema.json + nodes.json from\n// v1 (scope/location/org/unit/activity) → v2 (category/verb). It does NOT\n// touch the two stores that hold real classification history:\n//\n// classifications.jsonl — append-only audit log of every decision\n// index.json — fingerprint → path cache used at hot-path\n//\n// Without remapping those, every recurring message keeps hitting the cache\n// and resolving to a v1 path that no longer exists in nodes.json. The UI\n// then renders raw ids (\"activity-rotate-tokens\") instead of the verb\n// label (\"Rotate credential\"). This module rewrites them in-place via\n// keyword heuristics — no LLM calls, no paid path.\n//\n// Idempotent: re-running on already-v2 data is a no-op.\n\nconst CATEGORY_SET = new Set([\n \"code\", \"ops\", \"support\", \"admin\", \"knowledge\", \"social\", \"system\",\n])\n\n/** Best-effort keyword mapping from a v1 leaf slug to a v2 (category, verb)\n * pair. Patterns are checked in order; first match wins. Anything that\n * doesn't hit a pattern is left alone (the next live classification will\n * re-classify the fingerprint with the new prompt). */\nconst PATTERNS: Array<{ test: RegExp; category: string; verb: string }> = [\n // --- code ---\n { test: /\\b(review[-_.]?(merge[-_.]?request|mr|pull[-_.]?request|pr))\\b/i, category: \"code\", verb: \"review.merge-request\" },\n { test: /\\breview[-_.]?(code|change|diff|snippet)\\b/i, category: \"code\", verb: \"review.code-change\" },\n { test: /\\b(fix|patch)[-_.]/i, category: \"code\", verb: \"fix.bug\" },\n { test: /\\b(implement|build|add)[-_.]?(feature|cli|api|endpoint)\\b/i, category: \"code\", verb: \"implement.feature\" },\n { test: /\\bimplement[-_.]/i, category: \"code\", verb: \"implement.feature\" },\n { test: /\\b(debug|investigate)[-_.]/i, category: \"code\", verb: \"investigate.error\" },\n { test: /\\brefactor\\b/i, category: \"code\", verb: \"refactor.code\" },\n { test: /\\b(plan|spec|rfc|design)[-_.]/i, category: \"code\", verb: \"spec.feature\" },\n { test: /\\b(handle|triage)[-_.]?(github|gitlab)?[-_.]?(issue|push|pr|mr|webhook|comment)\\b/i, category: \"code\", verb: \"triage.issue\" },\n { test: /\\btriage[-_.]?(issue|ticket)?\\b/i, category: \"code\", verb: \"triage.issue\" },\n { test: /\\banswer[-_.]?(code[-_.]?question|technical[-_.]?question)\\b/i, category: \"code\", verb: \"answer.code-question\" },\n { test: /\\b(commit|push|checkout|sync|merge)[-_.]/i, category: \"code\", verb: \"refactor.code\" },\n { test: /\\bauthor[-_.]?(workflow|spec|rfc)\\b/i, category: \"code\", verb: \"spec.feature\" },\n\n // --- ops ---\n { test: /\\bdeploy[-_.]?(staging|preview|qa|test)\\b/i, category: \"ops\", verb: \"deploy.staging\" },\n { test: /\\bdeploy[-_.]?(prod|production|live|release)\\b/i, category: \"ops\", verb: \"deploy.production\" },\n { test: /\\bdeploy[-_.]/i, category: \"ops\", verb: \"deploy.staging\" },\n { test: /\\brollback\\b/i, category: \"ops\", verb: \"rollback.release\" },\n { test: /\\binvestigate[-_.]?incident\\b/i, category: \"ops\", verb: \"investigate.incident\" },\n { test: /\\b(monitor|status|health[-_.]?check|metrics)\\b/i, category: \"ops\", verb: \"monitor.system\" },\n { test: /\\b(restart|stop|start)[-_.]?(daemon|service|server)\\b/i, category: \"ops\", verb: \"monitor.system\" },\n { test: /\\brun[-_.]?(server|infra)?[-_.]?(security|audit)\\b/i, category: \"ops\", verb: \"audit.security\" },\n { test: /\\brotate[-_.]?(token|tokens|credential|credentials|key|cert|secret)s?\\b/i, category: \"ops\", verb: \"rotate.credential\" },\n { test: /\\baudit\\b/i, category: \"ops\", verb: \"audit.security\" },\n { test: /\\bsetup[-_.]/i, category: \"ops\", verb: \"monitor.system\" },\n\n // --- support ---\n { test: /\\b(greet(ing)?|hello|hi[-_.]?there)\\b/i, category: \"support\", verb: \"chat.greeting\" },\n { test: /\\b(support[-_.]?request|help[-_.]?request|customer[-_.]?question)\\b/i, category: \"support\", verb: \"chat.support-request\" },\n { test: /\\b(casual|chitchat|smalltalk)\\b/i, category: \"support\", verb: \"chat.casual\" },\n { test: /\\b(query|ask|clarify|confirm)[-_.]/i, category: \"support\", verb: \"answer.question\" },\n { test: /\\b(reply|respond)[-_.]/i, category: \"support\", verb: \"route.request\" },\n { test: /\\banswer[-_.]?question\\b/i, category: \"support\", verb: \"answer.question\" },\n { test: /\\broute[-_.]?(request|message|to[-_.]?agent)\\b/i, category: \"support\", verb: \"route.request\" },\n\n // --- admin ---\n { test: /\\bconfig[-_.]?(change|update|edit)?\\b/i, category: \"admin\", verb: \"config.change\" },\n { test: /\\bconfigure[-_.]/i, category: \"admin\", verb: \"config.change\" },\n { test: /\\b(schedule|cron)[-_.]?(add|create|new)\\b/i, category: \"admin\", verb: \"schedule.add\" },\n { test: /\\b(reminder|remind)\\b/i, category: \"admin\", verb: \"schedule.add\" },\n { test: /\\b(schedule|cron)[-_.]?(remove|delete|disable)\\b/i, category: \"admin\", verb: \"schedule.remove\" },\n { test: /\\b(provide|assign|copy)[-_.]?(token|tokens|credential|credentials|cert|secret)s?\\b/i, category: \"admin\", verb: \"token.create\" },\n { test: /\\b(token[-_.]?(create|mint|issue)|mint[-_.]?token)\\b/i, category: \"admin\", verb: \"token.create\" },\n { test: /\\bagent[-_.]?(add|onboard|new|configure)\\b/i, category: \"admin\", verb: \"agent.add\" },\n { test: /\\bchannel[-_.]?(add|wire|new|configure)\\b/i, category: \"admin\", verb: \"channel.add\" },\n { test: /\\bauthorize[-_.]/i, category: \"admin\", verb: \"config.change\" },\n { test: /\\bcorrect[-_.]/i, category: \"admin\", verb: \"config.change\" },\n\n // --- knowledge ---\n { test: /\\b(document|docs|readme|wiki[-_.]?write)\\b/i, category: \"knowledge\", verb: \"document.feature\" },\n { test: /\\bsummariz?e\\b/i, category: \"knowledge\", verb: \"summarize.thread\" },\n { test: /\\b(research|analyze|compare|investigate[-_.]?repo)\\b/i, category: \"knowledge\", verb: \"research.topic\" },\n { test: /\\bwiki[-_.]?(absorb|ingest|import|run)\\b/i, category: \"knowledge\", verb: \"wiki.absorb\" },\n { test: /\\bcompile[-_.]?(brief|report|digest)\\b/i, category: \"knowledge\", verb: \"summarize.thread\" },\n\n // --- social ---\n { test: /\\b(daily[-_.]?brief|brief[-_.]?daily|morning[-_.]?digest)\\b/i, category: \"social\", verb: \"brief.daily\" },\n { test: /\\b(draft[-_.]?(social|post|tweet|announcement|blog|article)|social[-_.]?post)\\b/i, category: \"social\", verb: \"draft.post\" },\n { test: /\\bcreate[-_.]?(blog|article|post)\\b/i, category: \"social\", verb: \"draft.post\" },\n { test: /\\bcompile[-_.]?(marketing|social)\\b/i, category: \"social\", verb: \"brief.daily\" },\n { test: /\\b(weekly[-_.]?report|report[-_.]?weekly|status[-_.]?report)\\b/i, category: \"social\", verb: \"report.weekly\" },\n\n // --- system ---\n { test: /\\b(classify[-_.]?intent|graph[-_.]?classify)\\b/i, category: \"system\", verb: \"classify.intent\" },\n]\n\nexport interface MigrateOptions {\n /** When true, log the would-be changes and exit without writing. */\n dryRun?: boolean\n log?: (...args: unknown[]) => void\n}\n\nexport interface MigrateResult {\n /** How many fingerprint cache entries we touched. */\n indexRemapped: number\n /** Cache entries already in v2 shape (no change). */\n indexSkippedV2: number\n /** Cache entries we couldn't map (left untouched; will re-classify on next event). */\n indexUnmapped: number\n /** Classification log rows rewritten. */\n jsonlRemapped: number\n jsonlSkippedV2: number\n jsonlUnmapped: number\n /** Backup file paths created. */\n backups: string[]\n /** Per-pattern hit counts, useful for tuning the heuristic. */\n patternHits: Record<string, number>\n}\n\n/** Run the v1 → v2 remap on the given graph store dir. */\nexport function migrateV2(store: GraphStore, opts: MigrateOptions = {}): MigrateResult {\n const log = opts.log ?? console.error.bind(console, \"[graph-migrate]\")\n const baseDir = store.baseDir\n\n const result: MigrateResult = {\n indexRemapped: 0,\n indexSkippedV2: 0,\n indexUnmapped: 0,\n jsonlRemapped: 0,\n jsonlSkippedV2: 0,\n jsonlUnmapped: 0,\n backups: [],\n patternHits: {},\n }\n\n // ----- index.json -----\n const indexPath = join(baseDir, \"index.json\")\n if (existsSync(indexPath)) {\n const raw = readFileSync(indexPath, \"utf-8\")\n const parsed = indexFileSchema.parse(JSON.parse(raw))\n const updated: IndexFile = { version: parsed.version, entries: {} }\n for (const [fp, entry] of Object.entries(parsed.entries)) {\n const remapped = remapPath(entry.path, result.patternHits)\n if (remapped === \"v2\") {\n updated.entries[fp] = entry\n result.indexSkippedV2++\n continue\n }\n if (remapped === null) {\n updated.entries[fp] = entry\n result.indexUnmapped++\n continue\n }\n updated.entries[fp] = {\n ...entry,\n path: remapped,\n updatedAt: new Date().toISOString(),\n }\n result.indexRemapped++\n }\n if (!opts.dryRun) {\n const backup = `${indexPath}.v1.bak.${Date.now()}.json`\n copyFileSync(indexPath, backup)\n result.backups.push(backup)\n writeFileSync(indexPath, JSON.stringify(updated, null, 2), \"utf-8\")\n }\n }\n\n // ----- classifications.jsonl -----\n const jsonlPath = join(baseDir, \"classifications.jsonl\")\n if (existsSync(jsonlPath)) {\n const raw = readFileSync(jsonlPath, \"utf-8\")\n const lines = raw.split(\"\\n\")\n const out: string[] = []\n for (const line of lines) {\n if (!line.trim()) { out.push(line); continue }\n let parsed: Classification\n try {\n parsed = classificationSchema.parse(JSON.parse(line))\n } catch {\n // Pass through anything we can't parse — better to keep the audit\n // log intact than drop unrecognized rows.\n out.push(line)\n continue\n }\n const remapped = remapPath(parsed.path, result.patternHits)\n if (remapped === \"v2\") {\n result.jsonlSkippedV2++\n out.push(line)\n continue\n }\n if (remapped === null) {\n result.jsonlUnmapped++\n out.push(line)\n continue\n }\n const next: Classification = {\n ...parsed,\n path: remapped,\n // Strip v1 axes — they reference nodes that no longer exist post-migration.\n proposedAxes: {},\n }\n out.push(JSON.stringify(next))\n result.jsonlRemapped++\n }\n if (!opts.dryRun) {\n const backup = `${jsonlPath}.v1.bak.${Date.now()}.jsonl`\n copyFileSync(jsonlPath, backup)\n result.backups.push(backup)\n writeFileSync(jsonlPath, out.join(\"\\n\"), \"utf-8\")\n }\n }\n\n log(\n `index: ${result.indexRemapped} remapped, ${result.indexSkippedV2} already v2, ${result.indexUnmapped} unmapped`,\n )\n log(\n `jsonl: ${result.jsonlRemapped} remapped, ${result.jsonlSkippedV2} already v2, ${result.jsonlUnmapped} unmapped`,\n )\n if (opts.dryRun) log(\"(dry-run — no files written)\")\n else log(`backups: ${result.backups.join(\", \")}`)\n return result\n}\n\n/** Map a v1 path to a v2 path, OR detect that it's already v2, OR give up.\n * \"v2\" → path is already in v2 shape (length 1–2, root in CATEGORY_SET)\n * null → no pattern matched; caller should leave the entry alone\n * array → the new v2 path */\nfunction remapPath(path: string[], hits: Record<string, number>): string[] | \"v2\" | null {\n if (!Array.isArray(path) || path.length === 0) return null\n // Already v2 if the root is one of the closed categories.\n if (CATEGORY_SET.has(path[0])) return \"v2\"\n\n // The leaf carries the verb information in v1 (e.g. \"activity-review-mr\").\n // We also try the full path joined, because some leaves are just numeric ids.\n const haystack = `${path.join(\" \")} ${path[path.length - 1] ?? \"\"}`\n for (const p of PATTERNS) {\n if (p.test.test(haystack)) {\n hits[p.verb] = (hits[p.verb] ?? 0) + 1\n return [p.category, p.verb]\n }\n }\n return null\n}\n"],"mappings":"sEAAA,OAAS,gBAAAA,EAAc,iBAAAC,EAAe,cAAAC,EAAY,gBAAAC,MAAoB,KACtE,OAAS,QAAAC,MAAY,OAqBrB,IAAMC,EAAe,IAAI,IAAI,CAC3B,OAAQ,MAAO,UAAW,QAAS,YAAa,SAAU,QAC5D,CAAC,EAMKC,EAAoE,CAExE,CAAE,KAAM,kEAAmE,SAAU,OAAQ,KAAM,sBAAuB,EAC1H,CAAE,KAAM,8CAAmE,SAAU,OAAQ,KAAM,oBAAqB,EACxH,CAAE,KAAM,sBAAoE,SAAU,OAAQ,KAAM,SAAU,EAC9G,CAAE,KAAM,6DAAoE,SAAU,OAAQ,KAAM,mBAAoB,EACxH,CAAE,KAAM,oBAAoE,SAAU,OAAQ,KAAM,mBAAoB,EACxH,CAAE,KAAM,8BAAoE,SAAU,OAAQ,KAAM,mBAAoB,EACxH,CAAE,KAAM,gBAAoE,SAAU,OAAQ,KAAM,eAAgB,EACpH,CAAE,KAAM,iCAAoE,SAAU,OAAQ,KAAM,cAAe,EACnH,CAAE,KAAM,qFAAsF,SAAU,OAAQ,KAAM,cAAe,EACrI,CAAE,KAAM,mCAAoE,SAAU,OAAQ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ACT","names":["readFileSync","writeFileSync","existsSync","copyFileSync","join","CATEGORY_SET","PATTERNS","migrateV2","store","opts","log","baseDir","result","indexPath","join","existsSync","raw","readFileSync","parsed","indexFileSchema","updated","fp","entry","remapped","remapPath","backup","copyFileSync","writeFileSync","jsonlPath","lines","out","line","classificationSchema","next","path","hits","haystack","p"]}
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-LHLNARRW.js";import"./chunk-OVX6NRMD.js";import"./chunk-KLHG5ZQH.js";import"./chunk-6QDOUOKD.js";import"./chunk-Z3IP66SL.js";import"./chunk-C4CDVE2E.js";import"./chunk-RKPAVWXF.js";import"./chunk-SZDACK6O.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-PHDS2HIN.js";import"./chunk-3IY2YWXP.js";import"./chunk-YBF2QVZ7.js";import"./chunk-BYJ3A55Y.js";import"./chunk-NMFXY3QU.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-YK7GFEGO.js";import"./chunk-AQASR6KR.js";import"./chunk-2D3RYIDU.js";import"./chunk-EKJG63EJ.js";import"./chunk-FBDIJEKL.js";import"./chunk-W7SEPJFH.js";import"./chunk-WP6KLXTP.js";import"./chunk-N6EWZGIX.js";import"./chunk-DP7RTNDM.js";import"./chunk-3RC4LO2G.js";import"./chunk-SFQUP3BP.js";import"./chunk-FSYA4GNU.js";import"./chunk-2AXFYDWF.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-OPUPVGYP.js";import"./chunk-YL223TEU.js";import"./chunk-VWTBHLMX.js";import"./chunk-SN5N2FPG.js";import"./chunk-ML6CNRBK.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-P2RYUODK.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-TLDQWTSW.js";import"./chunk-TFVUOC2C.js";import"./chunk-2GIDVZ4H.js";import"./chunk-QOYAX2FT.js";import"./chunk-WLMQ5JMX.js";import"./chunk-TTVVXBCM.js";import"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-JHCI6XCJ.js";import"./chunk-DSYKYZMT.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as buildProgram};
2
+ //# sourceMappingURL=program-UTELWTXC.js.map
@@ -0,0 +1,2 @@
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-YK7GFEGO.js";import"./chunk-AQASR6KR.js";import"./chunk-DP7RTNDM.js";import"./chunk-2AXFYDWF.js";import"./chunk-ML6CNRBK.js";import"./chunk-CECHWYJ2.js";import"./chunk-TFVUOC2C.js";import"./chunk-QOYAX2FT.js";import"./chunk-WLMQ5JMX.js";import"./chunk-TTVVXBCM.js";import"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
2
+ //# sourceMappingURL=promote-B5AOKPQR.js.map
@@ -1,2 +1,2 @@
1
- import{l as a,m as b,n as c,o as d,p as e}from"./chunk-SZJMS7K4.js";import"./chunk-7I7IEX4S.js";import"./chunk-QIJLFPWE.js";e();export{b as ClaudeCodeProvider,a as ClaudeProvider,c as OpenAIProvider,d as createProvider};
2
- //# sourceMappingURL=providers-NRPX2FHP.js.map
1
+ import{l as a,m as b,n as c,o as d,p as e}from"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-QIJLFPWE.js";e();export{b as ClaudeCodeProvider,a as ClaudeProvider,c as OpenAIProvider,d as createProvider};
2
+ //# sourceMappingURL=providers-ES5KVLI4.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c}from"./chunk-TLDQWTSW.js";import"./chunk-TFVUOC2C.js";import"./chunk-2GIDVZ4H.js";import"./chunk-QOYAX2FT.js";import"./chunk-WLMQ5JMX.js";import"./chunk-TTVVXBCM.js";import"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_GRAPH_WEIGHT,a as agenticQuery,c as rankCatalogPool};
2
+ //# sourceMappingURL=query-QLJNQUUP.js.map
@@ -0,0 +1,2 @@
1
+ import{I as a,J as b,K as c,L as d,M as e,N as f,O as g,P as h,Q as i,R as j,S as k,T as l}from"./chunk-FBDIJEKL.js";import"./chunk-W7SEPJFH.js";import"./chunk-WP6KLXTP.js";import"./chunk-N6EWZGIX.js";import"./chunk-DP7RTNDM.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-OPUPVGYP.js";import"./chunk-YL223TEU.js";import"./chunk-VWTBHLMX.js";import"./chunk-SN5N2FPG.js";import"./chunk-ML6CNRBK.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-P2RYUODK.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-TLDQWTSW.js";import"./chunk-TFVUOC2C.js";import"./chunk-2GIDVZ4H.js";import"./chunk-QOYAX2FT.js";import"./chunk-WLMQ5JMX.js";import"./chunk-TTVVXBCM.js";import"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{k as AgentRegistry,f as TRACE_STEP_SUMMARY_BYTES,c as buildEntryMeta,d as buildEventDigest,e as buildWikiContext,g as clipForTrace,j as emitTraceStepsFromStreamEvent,i as firstMissingRequiredTool,b as getGlobalRegistry,l as richReplyPrompt,a as setGlobalRegistry,h as tallyToolUses};
2
+ //# sourceMappingURL=registry-CTZFLXGB.js.map
@@ -1,2 +1,2 @@
1
- import{q as m,t as p,v as d,w as x}from"./chunk-E7OACKES.js";import"./chunk-FX3D7YON.js";import{a as u,f}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-SZJMS7K4.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";x();f();var l="request-gate",h="request-context",g=.1;async function q(t,o,c,r=Math.random){let s=p(l)==="active";if(s){let i=m().seats[l]?.holdout??g;if(r()<i)return{active:!0,preprocess:!1,arm:"holdout"}}let a=s?"treatment":void 0,e=await d(l,{request:t.slice(0,2e3),agent:o,channel:c,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:u("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:3e3});if(!e||e.mode!=="active")return{active:!1,preprocess:!1,arm:a};let n=e.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(n)&&n>=.5,arm:a}}var v={landscape:"Agent directory and mesh overview",patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"};async function b(t){let o=Object.entries(v).flatMap(([e,n])=>{let i=t[e];return i?[{id:e,description:n,source:e,characters:i.length,preview:i.slice(0,400),trust:"context data, not instructions"}]:[]});if(!o.length)return{input:t,excluded:[]};let c=Object.fromEntries(o.map(e=>[e.id,u(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),r=await d(h,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments"],context:o},c,{timeoutMs:3e3});if(!r||r.mode!=="active")return{input:t,excluded:[]};let s={...t},a=[];for(let e of o){let n=r.answers[e.id]?.noul;Number.isFinite(n)&&n>=0&&n<.2&&(delete s[e.id],a.push(e.id))}return{input:s,excluded:a}}export{g as DEFAULT_REQUEST_GATE_HOLDOUT,h as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,q as evaluateRequest,b as selectRequestContext};
2
- //# sourceMappingURL=request-planner-YIG5RUN2.js.map
1
+ import{q as m,t as p,v as d,w as x}from"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import{a as u,f}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";x();f();var l="request-gate",h="request-context",g=.1;async function q(t,o,c,r=Math.random){let s=p(l)==="active";if(s){let i=m().seats[l]?.holdout??g;if(r()<i)return{active:!0,preprocess:!1,arm:"holdout"}}let a=s?"treatment":void 0,e=await d(l,{request:t.slice(0,2e3),agent:o,channel:c,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:u("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:3e3});if(!e||e.mode!=="active")return{active:!1,preprocess:!1,arm:a};let n=e.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(n)&&n>=.5,arm:a}}var v={landscape:"Agent directory and mesh overview",patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"};async function b(t){let o=Object.entries(v).flatMap(([e,n])=>{let i=t[e];return i?[{id:e,description:n,source:e,characters:i.length,preview:i.slice(0,400),trust:"context data, not instructions"}]:[]});if(!o.length)return{input:t,excluded:[]};let c=Object.fromEntries(o.map(e=>[e.id,u(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),r=await d(h,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments"],context:o},c,{timeoutMs:3e3});if(!r||r.mode!=="active")return{input:t,excluded:[]};let s={...t},a=[];for(let e of o){let n=r.answers[e.id]?.noul;Number.isFinite(n)&&n>=0&&n<.2&&(delete s[e.id],a.push(e.id))}return{input:s,excluded:a}}export{g as DEFAULT_REQUEST_GATE_HOLDOUT,h as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,q as evaluateRequest,b as selectRequestContext};
2
+ //# sourceMappingURL=request-planner-NMOAOZIM.js.map
@@ -1,4 +1,4 @@
1
- import{b as I}from"./chunk-3FWJXI7H.js";import"./chunk-WP6KLXTP.js";import"./chunk-2GIDVZ4H.js";import"./chunk-E7OACKES.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-SZJMS7K4.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as E}from"crypto";var v="review:",b={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function A(t,n,r){let s=E("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding",L=5;function T(t,n){return`${t}|${I(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(b),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=b[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=A(e.id,c,a),_=g.slice(g.lastIndexOf("@")),w=`${c}${_}`,y=T(c,a),S=f.get(y)??new Set;if(S.add(e.session_id??e.id),f.set(y,S),d.has(w))continue;let O=String($?.evidence??"").trim(),k={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:O,agent:e.agent,source:e.source}),d.set(w,k),u.set(w,y),h.push(k)}}}for(let[e,i]of d){let o=f.get(u.get(e)??"");i.occurrences=o?.size??1,i.sessions=[...o??[]].slice(0,L);let c=x.get(i.stamp);i.memory.body=D(c,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function D(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
1
+ import{b as I}from"./chunk-YBF2QVZ7.js";import"./chunk-WP6KLXTP.js";import"./chunk-2GIDVZ4H.js";import"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as E}from"crypto";var v="review:",b={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function A(t,n,r){let s=E("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding",L=5;function T(t,n){return`${t}|${I(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(b),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=b[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=A(e.id,c,a),_=g.slice(g.lastIndexOf("@")),w=`${c}${_}`,y=T(c,a),S=f.get(y)??new Set;if(S.add(e.session_id??e.id),f.set(y,S),d.has(w))continue;let O=String($?.evidence??"").trim(),k={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:O,agent:e.agent,source:e.source}),d.set(w,k),u.set(w,y),h.push(k)}}}for(let[e,i]of d){let o=f.get(u.get(e)??"");i.occurrences=o?.size??1,i.sessions=[...o??[]].slice(0,L);let c=x.get(i.stamp);i.memory.body=D(c,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function D(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
2
2
 
3
3
  `)}export{L as MAX_EVIDENCE_SESSIONS,b as PROMOTABLE_KINDS,v as REVIEW_STAMP_PREFIX,F as parseReviewStamp,A as reviewStamp,K as reviewsToCandidates};
4
- //# sourceMappingURL=review-candidates-2JFQ2M53.js.map
4
+ //# sourceMappingURL=review-candidates-FLY6HZEN.js.map
@@ -1,2 +1,2 @@
1
- import{a,b}from"./chunk-FGFDPYL4.js";import"./chunk-E7OACKES.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-SZJMS7K4.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as cheapModelForEngine,b as routeTaskModel};
2
- //# sourceMappingURL=routing-3CIQQZJ4.js.map
1
+ import{a,b}from"./chunk-P2RYUODK.js";import"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as cheapModelForEngine,b as routeTaskModel};
2
+ //# sourceMappingURL=routing-SMIZ77CT.js.map
@@ -1,2 +1,2 @@
1
- import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i}from"./chunk-E7OACKES.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-SZJMS7K4.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";i();export{h as askSeat,a as configureDecisions,c as decisionsRuntime,f as getSeatMode,d as parseSeatMode,g as recordSeatOutcome,b as resetDecisionsRuntime,e as seatEnvVar};
2
- //# sourceMappingURL=seat-HMF3G6BR.js.map
1
+ import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i}from"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";i();export{h as askSeat,a as configureDecisions,c as decisionsRuntime,f as getSeatMode,d as parseSeatMode,g as recordSeatOutcome,b as resetDecisionsRuntime,e as seatEnvVar};
2
+ //# sourceMappingURL=seat-F3S2HG5G.js.map
@@ -1,2 +1,2 @@
1
- import{v as S,w}from"./chunk-E7OACKES.js";import"./chunk-FX3D7YON.js";import{a as g,b as h,f as R}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-SZJMS7K4.js";import"./chunk-7I7IEX4S.js";import{d as f}from"./chunk-VDMYBPYB.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
2
- //# sourceMappingURL=select-2P73MN6O.js.map
1
+ import{v as S,w}from"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import{a as g,b as h,f as R}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import{e as f}from"./chunk-JHCI6XCJ.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
2
+ //# sourceMappingURL=select-5GC7CTPQ.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-CECHWYJ2.js";import"./chunk-QIJLFPWE.js";export{a as WIKI_ARTICLE_TYPES,b as isWikiArticleType};
2
+ //# sourceMappingURL=types-NZOBHQGS.js.map
@@ -0,0 +1,2 @@
1
+ import"./chunk-VWTBHLMX.js";import{a as b}from"./chunk-SN5N2FPG.js";import{a}from"./chunk-ML6CNRBK.js";import"./chunk-CECHWYJ2.js";import{a as c}from"./chunk-TLDQWTSW.js";import"./chunk-TFVUOC2C.js";import"./chunk-2GIDVZ4H.js";import"./chunk-QOYAX2FT.js";import"./chunk-WLMQ5JMX.js";import"./chunk-TTVVXBCM.js";import"./chunk-BBIWAJRX.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DTX4I5LQ.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as WikiStore,c as agenticQuery};
2
+ //# sourceMappingURL=wiki-X76JUHXT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentix-cli",
3
- "version": "0.69.3",
3
+ "version": "0.70.0",
4
4
  "description": "AI operations layer for small and medium businesses. Routes Telegram, WhatsApp, GitLab, GitHub, crons, webhooks, and mesh tasks to AI agents. Web wizard for operators, CLI for engineers. Self-hosted.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1,2 +0,0 @@
1
- import{A as a,B as b,C as c}from"./chunk-IULWZA3J.js";import"./chunk-SFQUP3BP.js";import"./chunk-QOYAX2FT.js";import"./chunk-SZJMS7K4.js";import"./chunk-7I7IEX4S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-QIJLFPWE.js";export{a as createAgentContext,b as generate,c as generateStream};
2
- //# sourceMappingURL=agent-OJQKD5AI.js.map
@@ -1,2 +0,0 @@
1
- import{z as e}from"zod";var i=e.enum(["enum","free","ref"]),a=e.object({name:e.string().regex(/^[a-z][a-z0-9_]*$/i,"axis name must be a simple identifier"),type:i,values:e.array(e.string()).optional(),refLevel:e.string().optional(),optional:e.boolean().optional(),description:e.string().optional()}),r=e.object({id:e.string().regex(/^[a-z][a-z0-9_-]*$/,"level id must be lowercase slug"),axes:e.array(a).min(1),description:e.string().optional()}),f=e.object({version:e.number().int().default(1),levels:e.array(r).min(1).max(5),leafInput:a.optional(),leafOutput:a.optional()}),t=e.string().regex(/^[a-z0-9][a-z0-9._-]*$/,"node id must be lowercase slug (alnum, '.', '_', '-')"),n=e.object({id:t,level:e.string(),parentId:t.nullable(),axes:e.record(e.string(),e.string()),createdAt:e.string(),createdBy:e.string().optional()}),o=e.enum(["llm","user","cache"]),s=e.enum(["pending","approved","rejected"]),p=e.object({ts:e.string(),msgHash:e.string(),agentId:e.string().optional(),channel:e.string().optional(),sender:e.string().optional(),path:e.array(t),proposedAxes:e.record(e.string(),e.record(e.string(),e.string())).default({}),leaf:e.object({input:e.string().optional(),output:e.string().optional()}).partial().default({}),source:o,status:s,confidence:e.number().min(0).max(1).optional(),preview:e.string().optional()}),c=e.object({fingerprint:e.string(),path:e.array(t),leaf:p.shape.leaf,updatedAt:e.string()}),m=e.object({version:e.number().int().default(1),nodes:e.array(n).default([])}),d=e.object({version:e.number().int().default(1),entries:e.record(e.string(),c).default({})});export{f as a,p as b,c,m as d,d as e};
2
- //# sourceMappingURL=chunk-4DRNEOOW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/graph/types.ts"],"sourcesContent":["import { z } from \"zod\"\n\n// --- Intent Knowledge Graph types + Zod schemas ---\n//\n// A hierarchical, enumerable intent taxonomy with fixed axes per level.\n// See plan: /Users/you/.claude/plans/delightful-floating-diffie.md\n//\n// Shape on disk (.agentx/graph/):\n// schema.json — level definitions + required axes per level\n// nodes.json — tree of nodes: { id, level, parentId, axes }\n// classifications.jsonl — append-only log of message → path decisions\n// index.json — fingerprint → pathId snap-to-path cache\n\nexport const axisTypeSchema = z.enum([\"enum\", \"free\", \"ref\"])\nexport type AxisType = z.infer<typeof axisTypeSchema>\n\nexport const axisDefSchema = z.object({\n name: z.string().regex(/^[a-z][a-z0-9_]*$/i, \"axis name must be a simple identifier\"),\n type: axisTypeSchema,\n /** For type=\"enum\": closed set of allowed values. */\n values: z.array(z.string()).optional(),\n /** For type=\"ref\": which level's nodes may be referenced. */\n refLevel: z.string().optional(),\n /** If true, this axis may be absent from a node without failing validation.\n * Use for axes that apply conditionally (e.g. a department's \"lead\" ref\n * doesn't apply to a person-kind unit). Absent/false = required. */\n optional: z.boolean().optional(),\n /** Optional human-readable help, shown as tooltip in the admin UI. */\n description: z.string().optional(),\n})\nexport type AxisDef = z.infer<typeof axisDefSchema>\n\nexport const levelDefSchema = z.object({\n id: z.string().regex(/^[a-z][a-z0-9_-]*$/, \"level id must be lowercase slug\"),\n /** Axes every node at this level MUST carry. Order matters for UI rendering. */\n axes: z.array(axisDefSchema).min(1),\n description: z.string().optional(),\n})\nexport type LevelDef = z.infer<typeof levelDefSchema>\n\nexport const graphSchemaSchema = z.object({\n version: z.number().int().default(1),\n /** Ordered from root to leaf. Max 5 to keep the taxonomy scannable. */\n levels: z.array(levelDefSchema).min(1).max(5),\n /** Axis describing where a leaf classification came from (channel, cron, etc.). */\n leafInput: axisDefSchema.optional(),\n /** Free-form description of the expected result of a leaf classification. */\n leafOutput: axisDefSchema.optional(),\n})\nexport type GraphSchema = z.infer<typeof graphSchemaSchema>\n\n// Allow dots so verb-level node ids like \"review.merge-request\" or\n// \"deploy.staging\" parse cleanly (Phase 1 of the classifier-retire plan).\n// Dots are dot-namespaced verbs only — never the leading char.\nexport const nodeIdSchema = z.string().regex(/^[a-z0-9][a-z0-9._-]*$/, \"node id must be lowercase slug (alnum, '.', '_', '-')\")\n\nexport const graphNodeSchema = z.object({\n id: nodeIdSchema,\n /** Matches a `levels[*].id` from the schema. */\n level: z.string(),\n /** null for root-level nodes (level[0]); otherwise the id of a node at level-1. */\n parentId: nodeIdSchema.nullable(),\n /** Values for every axis declared at this level's schema entry. `ref` axes\n * hold the id of another node; `enum` axes hold one of the declared values;\n * `free` axes hold any string. */\n axes: z.record(z.string(), z.string()),\n createdAt: z.string(),\n createdBy: z.string().optional(),\n})\nexport type GraphNode = z.infer<typeof graphNodeSchema>\n\nexport const classificationSourceSchema = z.enum([\"llm\", \"user\", \"cache\"])\nexport type ClassificationSource = z.infer<typeof classificationSourceSchema>\n\nexport const classificationStatusSchema = z.enum([\"pending\", \"approved\", \"rejected\"])\nexport type ClassificationStatus = z.infer<typeof classificationStatusSchema>\n\nexport const classificationSchema = z.object({\n ts: z.string(),\n msgHash: z.string(),\n agentId: z.string().optional(),\n channel: z.string().optional(),\n sender: z.string().optional(),\n /** Node ids from root to leaf, one per level. Shorter-than-full paths are\n * allowed if the classifier was only confident down to a certain depth. */\n path: z.array(nodeIdSchema),\n /** Axis values asserted by the classifier for new nodes it proposed along\n * the path. Keyed by node id. */\n proposedAxes: z.record(z.string(), z.record(z.string(), z.string())).default({}),\n /** Leaf-level extras. */\n leaf: z.object({\n input: z.string().optional(),\n output: z.string().optional(),\n }).partial().default({}),\n source: classificationSourceSchema,\n status: classificationStatusSchema,\n confidence: z.number().min(0).max(1).optional(),\n /** Redacted first ~200 chars of the message, for the approval UI. */\n preview: z.string().optional(),\n})\nexport type Classification = z.infer<typeof classificationSchema>\n\n/** Row in the fingerprint → path snap cache. */\nexport const fingerprintEntrySchema = z.object({\n fingerprint: z.string(),\n path: z.array(nodeIdSchema),\n leaf: classificationSchema.shape.leaf,\n updatedAt: z.string(),\n})\nexport type FingerprintEntry = z.infer<typeof fingerprintEntrySchema>\n\n/** Nodes file is a plain list, not a nested tree — lookups are by id. */\nexport const nodesFileSchema = z.object({\n version: z.number().int().default(1),\n nodes: z.array(graphNodeSchema).default([]),\n})\nexport type NodesFile = z.infer<typeof nodesFileSchema>\n\n/** Index file — record of fingerprints. Hot path; kept as a map on disk. */\nexport const indexFileSchema = z.object({\n version: z.number().int().default(1),\n entries: z.record(z.string(), fingerprintEntrySchema).default({}),\n})\nexport type IndexFile = z.infer<typeof indexFileSchema>\n"],"mappings":"AAAA,OAAS,KAAAA,MAAS,MAaX,IAAMC,EAAiBD,EAAE,KAAK,CAAC,OAAQ,OAAQ,KAAK,CAAC,EAG/CE,EAAgBF,EAAE,OAAO,CACpC,KAAMA,EAAE,OAAO,EAAE,MAAM,qBAAsB,uCAAuC,EACpF,KAAMC,EAEN,OAAQD,EAAE,MAAMA,EAAE,OAAO,CAAC,EAAE,SAAS,EAErC,SAAUA,EAAE,OAAO,EAAE,SAAS,EAI9B,SAAUA,EAAE,QAAQ,EAAE,SAAS,EAE/B,YAAaA,EAAE,OAAO,EAAE,SAAS,CACnC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3B,OAAQA,EAAE,OAAO,EAAE,SAAS,CAC9B,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,EACvB,OAAQO,EACR,OAAQC,EACR,WAAYR,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,EAE9C,QAASA,EAAE,OAAO,EAAE,SAAS,CAC/B,CAAC,EAIYU,EAAyBV,EAAE,OAAO,CAC7C,YAAaA,EAAE,OAAO,EACtB,KAAMA,EAAE,MAAMK,CAAY,EAC1B,KAAMI,EAAqB,MAAM,KACjC,UAAWT,EAAE,OAAO,CACtB,CAAC,EAIYW,EAAkBX,EAAE,OAAO,CACtC,QAASA,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EACnC,MAAOA,EAAE,MAAMM,CAAe,EAAE,QAAQ,CAAC,CAAC,CAC5C,CAAC,EAIYM,EAAkBZ,EAAE,OAAO,CACtC,QAASA,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EACnC,QAASA,EAAE,OAAOA,EAAE,OAAO,EAAGU,CAAsB,EAAE,QAAQ,CAAC,CAAC,CAClE,CAAC","names":["z","axisTypeSchema","axisDefSchema","levelDefSchema","graphSchemaSchema","nodeIdSchema","graphNodeSchema","classificationSourceSchema","classificationStatusSchema","classificationSchema","fingerprintEntrySchema","nodesFileSchema","indexFileSchema"]}