agentix-cli 0.70.0 → 0.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/mac-voice/Sources/AgentXVoice/CallModel.swift +55 -0
- package/apps/mac-voice/Sources/AgentXVoice/Calls.swift +172 -0
- package/apps/mac-voice/Sources/AgentXVoice/Panel.swift +28 -3
- package/apps/mac-voice/Sources/AgentXVoice/StatusMenu.swift +2 -0
- package/apps/mac-voice/Sources/AgentXVoice/main.swift +108 -4
- package/dist/{App-Z66ABY7H.js → App-PRD5JNO4.js} +2 -2
- package/dist/{ChatApp-Z2LZ7IM3.js → ChatApp-BKS6OJ3L.js} +2 -2
- package/dist/{agent-V223TG6H.js → agent-QF2JQ72Z.js} +2 -2
- package/dist/{board-dashboard-HR3PQPFW.js → board-dashboard-AROMOAKS.js} +4 -4
- package/dist/{board-dashboard-HR3PQPFW.js.map → board-dashboard-AROMOAKS.js.map} +1 -1
- package/dist/{chunk-PHDS2HIN.js → chunk-3C2SQDIH.js} +240 -229
- package/dist/chunk-3C2SQDIH.js.map +1 -0
- package/dist/{chunk-YBF2QVZ7.js → chunk-4XBYHKYG.js} +2 -2
- package/dist/{chunk-OPUPVGYP.js → chunk-5Y7QRFSL.js} +2 -2
- package/dist/{chunk-W7SEPJFH.js → chunk-6LTD7XL5.js} +2 -2
- package/dist/chunk-AAA6NGY5.js +6 -0
- package/dist/chunk-AAA6NGY5.js.map +1 -0
- package/dist/chunk-AHOGFVHA.js +15 -0
- package/dist/{chunk-DTX4I5LQ.js.map → chunk-AHOGFVHA.js.map} +1 -1
- package/dist/{chunk-OVX6NRMD.js → chunk-BO4WLXXC.js} +2 -2
- package/dist/{chunk-6QDOUOKD.js → chunk-D233M73Q.js} +2 -2
- package/dist/{chunk-BBIWAJRX.js → chunk-DJMUP6TK.js} +2 -2
- package/dist/{chunk-ML6CNRBK.js → chunk-EMRQ6W5J.js} +2 -2
- package/dist/{chunk-ML6CNRBK.js.map → chunk-EMRQ6W5J.js.map} +1 -1
- package/dist/{chunk-3RC4LO2G.js → chunk-HXW4NAWF.js} +2 -2
- package/dist/{chunk-KLHG5ZQH.js → chunk-IK2XG65P.js} +2 -2
- package/dist/{chunk-YK7GFEGO.js → chunk-JBVABB26.js} +2 -2
- package/dist/{chunk-3IY2YWXP.js → chunk-JU67IZLC.js} +3 -3
- package/dist/chunk-JU67IZLC.js.map +1 -0
- package/dist/{chunk-P2RYUODK.js → chunk-K6CHA6JJ.js} +2 -2
- package/dist/{chunk-LHLNARRW.js → chunk-MT3BD6WG.js} +186 -184
- package/dist/chunk-MT3BD6WG.js.map +1 -0
- package/dist/{chunk-FBDIJEKL.js → chunk-OTMDMGHE.js} +9 -9
- package/dist/chunk-OTMDMGHE.js.map +1 -0
- package/dist/{chunk-SN5N2FPG.js → chunk-RCKICCTT.js} +2 -2
- package/dist/{chunk-FSYA4GNU.js → chunk-SELIVR6U.js} +2 -2
- package/dist/{chunk-FUR3T3IN.js → chunk-SFWA67GQ.js} +2 -2
- package/dist/{chunk-YL223TEU.js → chunk-WLX4766Y.js} +2 -2
- package/dist/{chunk-TTVVXBCM.js → chunk-WPNRDEHW.js} +2 -2
- package/dist/chunk-XJQNIFZ4.js +49 -0
- package/dist/chunk-XJQNIFZ4.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client-UPBQVXYM.js +2 -0
- package/dist/config-UY5K6SCL.js +2 -0
- package/dist/config-mutator-7KOSRAQF.js +2 -0
- package/dist/doctor-GFPSIJGB.js +2 -0
- package/dist/index.d.ts +106 -9
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/migrate-v2-W7RRFM24.js +4 -0
- package/dist/{migrate-v2-ZOIMGITH.js.map → migrate-v2-W7RRFM24.js.map} +1 -1
- package/dist/program-XMGZOYX3.js +2 -0
- package/dist/promote-YLKNYYIU.js +2 -0
- package/dist/query-CVRXEG43.js +2 -0
- package/dist/registry-HZL363TA.js +2 -0
- package/dist/{request-planner-NMOAOZIM.js → request-planner-76NCBYBW.js} +2 -2
- package/dist/{review-candidates-FLY6HZEN.js → review-candidates-ZUXMX6BJ.js} +2 -2
- package/dist/{routing-SMIZ77CT.js → routing-EIGWDKH7.js} +2 -2
- package/dist/schedule-tool-PSZMP7C4.js +2 -0
- package/dist/scheduler-S24PXNB6.js +2 -0
- package/dist/{seat-F3S2HG5G.js → seat-QOY6FA4N.js} +2 -2
- package/dist/{select-5GC7CTPQ.js → select-JHKHO5BO.js} +2 -2
- package/dist/{set-enabled-53ZPZ5GR.js → set-enabled-DVJIUOKX.js} +2 -2
- package/dist/{tool-FRTZS4TT.js → tool-WKSLNQ6H.js} +2 -2
- package/dist/wiki-PTXUMSIR.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-3IY2YWXP.js.map +0 -1
- package/dist/chunk-DTX4I5LQ.js +0 -15
- package/dist/chunk-FBDIJEKL.js.map +0 -1
- package/dist/chunk-LHLNARRW.js.map +0 -1
- package/dist/chunk-PHDS2HIN.js.map +0 -1
- package/dist/chunk-TFVUOC2C.js +0 -2
- package/dist/chunk-TFVUOC2C.js.map +0 -1
- package/dist/chunk-TLDQWTSW.js +0 -49
- package/dist/chunk-TLDQWTSW.js.map +0 -1
- package/dist/chunk-WLMQ5JMX.js +0 -6
- package/dist/chunk-WLMQ5JMX.js.map +0 -1
- package/dist/client-GDTX6LFH.js +0 -2
- package/dist/config-FZ4D4EAV.js +0 -2
- package/dist/config-mutator-ETG5V4C5.js +0 -2
- package/dist/doctor-JBIRBRLB.js +0 -2
- package/dist/graph-FJ53FDWK.js +0 -2
- package/dist/migrate-v2-ZOIMGITH.js +0 -4
- package/dist/program-UTELWTXC.js +0 -2
- package/dist/promote-B5AOKPQR.js +0 -2
- package/dist/query-QLJNQUUP.js +0 -2
- package/dist/registry-CTZFLXGB.js +0 -2
- package/dist/schedule-tool-NJFROYKY.js +0 -2
- package/dist/scheduler-5N4FC2FQ.js +0 -2
- package/dist/wiki-X76JUHXT.js +0 -2
- package/dist/wiki-X76JUHXT.js.map +0 -1
- /package/dist/{App-Z66ABY7H.js.map → App-PRD5JNO4.js.map} +0 -0
- /package/dist/{ChatApp-Z2LZ7IM3.js.map → ChatApp-BKS6OJ3L.js.map} +0 -0
- /package/dist/{agent-V223TG6H.js.map → agent-QF2JQ72Z.js.map} +0 -0
- /package/dist/{chunk-YBF2QVZ7.js.map → chunk-4XBYHKYG.js.map} +0 -0
- /package/dist/{chunk-OPUPVGYP.js.map → chunk-5Y7QRFSL.js.map} +0 -0
- /package/dist/{chunk-W7SEPJFH.js.map → chunk-6LTD7XL5.js.map} +0 -0
- /package/dist/{chunk-OVX6NRMD.js.map → chunk-BO4WLXXC.js.map} +0 -0
- /package/dist/{chunk-6QDOUOKD.js.map → chunk-D233M73Q.js.map} +0 -0
- /package/dist/{chunk-BBIWAJRX.js.map → chunk-DJMUP6TK.js.map} +0 -0
- /package/dist/{chunk-3RC4LO2G.js.map → chunk-HXW4NAWF.js.map} +0 -0
- /package/dist/{chunk-KLHG5ZQH.js.map → chunk-IK2XG65P.js.map} +0 -0
- /package/dist/{chunk-YK7GFEGO.js.map → chunk-JBVABB26.js.map} +0 -0
- /package/dist/{chunk-P2RYUODK.js.map → chunk-K6CHA6JJ.js.map} +0 -0
- /package/dist/{chunk-SN5N2FPG.js.map → chunk-RCKICCTT.js.map} +0 -0
- /package/dist/{chunk-FSYA4GNU.js.map → chunk-SELIVR6U.js.map} +0 -0
- /package/dist/{chunk-FUR3T3IN.js.map → chunk-SFWA67GQ.js.map} +0 -0
- /package/dist/{chunk-YL223TEU.js.map → chunk-WLX4766Y.js.map} +0 -0
- /package/dist/{chunk-TTVVXBCM.js.map → chunk-WPNRDEHW.js.map} +0 -0
- /package/dist/{client-GDTX6LFH.js.map → client-UPBQVXYM.js.map} +0 -0
- /package/dist/{config-FZ4D4EAV.js.map → config-UY5K6SCL.js.map} +0 -0
- /package/dist/{config-mutator-ETG5V4C5.js.map → config-mutator-7KOSRAQF.js.map} +0 -0
- /package/dist/{doctor-JBIRBRLB.js.map → doctor-GFPSIJGB.js.map} +0 -0
- /package/dist/{graph-FJ53FDWK.js.map → program-XMGZOYX3.js.map} +0 -0
- /package/dist/{program-UTELWTXC.js.map → promote-YLKNYYIU.js.map} +0 -0
- /package/dist/{promote-B5AOKPQR.js.map → query-CVRXEG43.js.map} +0 -0
- /package/dist/{query-QLJNQUUP.js.map → registry-HZL363TA.js.map} +0 -0
- /package/dist/{request-planner-NMOAOZIM.js.map → request-planner-76NCBYBW.js.map} +0 -0
- /package/dist/{review-candidates-FLY6HZEN.js.map → review-candidates-ZUXMX6BJ.js.map} +0 -0
- /package/dist/{registry-CTZFLXGB.js.map → routing-EIGWDKH7.js.map} +0 -0
- /package/dist/{routing-SMIZ77CT.js.map → schedule-tool-PSZMP7C4.js.map} +0 -0
- /package/dist/{schedule-tool-NJFROYKY.js.map → scheduler-S24PXNB6.js.map} +0 -0
- /package/dist/{scheduler-5N4FC2FQ.js.map → seat-QOY6FA4N.js.map} +0 -0
- /package/dist/{select-5GC7CTPQ.js.map → select-JHKHO5BO.js.map} +0 -0
- /package/dist/{set-enabled-53ZPZ5GR.js.map → set-enabled-DVJIUOKX.js.map} +0 -0
- /package/dist/{tool-FRTZS4TT.js.map → tool-WKSLNQ6H.js.map} +0 -0
- /package/dist/{seat-F3S2HG5G.js.map → wiki-PTXUMSIR.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":"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,S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9B,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":"2EAAA,OAAS,gBAAAA,EAAc,iBAAAC,EAAe,cAAAC,EAAY,gBAAAC,MAAoB,KACtE,OAAS,QAAAC,MAAY,OAqBrB,IAAMC,EAAe,IAAI,IAAI,CAC3B,OAAQ,MAAO,UAAW,QAAS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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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-MT3BD6WG.js";import"./chunk-BO4WLXXC.js";import"./chunk-IK2XG65P.js";import"./chunk-D233M73Q.js";import"./chunk-Z3IP66SL.js";import"./chunk-C4CDVE2E.js";import"./chunk-RKPAVWXF.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-3C2SQDIH.js";import"./chunk-JU67IZLC.js";import"./chunk-BYJ3A55Y.js";import"./chunk-NMFXY3QU.js";import"./chunk-4XBYHKYG.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-JBVABB26.js";import"./chunk-2D3RYIDU.js";import"./chunk-EKJG63EJ.js";import"./chunk-OTMDMGHE.js";import"./chunk-6LTD7XL5.js";import"./chunk-N6EWZGIX.js";import"./chunk-WP6KLXTP.js";import"./chunk-DP7RTNDM.js";import"./chunk-HXW4NAWF.js";import"./chunk-SFQUP3BP.js";import"./chunk-SELIVR6U.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-5Y7QRFSL.js";import"./chunk-WLX4766Y.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-K6CHA6JJ.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-VWTBHLMX.js";import"./chunk-RCKICCTT.js";import"./chunk-EMRQ6W5J.js";import"./chunk-CECHWYJ2.js";import"./chunk-XJQNIFZ4.js";import"./chunk-AAA6NGY5.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-JHCI6XCJ.js";import"./chunk-DSYKYZMT.js";import"./chunk-AHOGFVHA.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as buildProgram};
|
|
2
|
+
//# sourceMappingURL=program-XMGZOYX3.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-JBVABB26.js";import"./chunk-DP7RTNDM.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-EMRQ6W5J.js";import"./chunk-CECHWYJ2.js";import"./chunk-AAA6NGY5.js";import"./chunk-WPNRDEHW.js";import"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.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-YLKNYYIU.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk-XJQNIFZ4.js";import"./chunk-AAA6NGY5.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_GRAPH_WEIGHT,a as agenticQuery,c as rankCatalogPool};
|
|
2
|
+
//# sourceMappingURL=query-CVRXEG43.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-OTMDMGHE.js";import"./chunk-6LTD7XL5.js";import"./chunk-N6EWZGIX.js";import"./chunk-WP6KLXTP.js";import"./chunk-DP7RTNDM.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-5Y7QRFSL.js";import"./chunk-WLX4766Y.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-K6CHA6JJ.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-VWTBHLMX.js";import"./chunk-RCKICCTT.js";import"./chunk-EMRQ6W5J.js";import"./chunk-CECHWYJ2.js";import"./chunk-XJQNIFZ4.js";import"./chunk-AAA6NGY5.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-AHOGFVHA.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-HZL363TA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as m,t as p,v as d,w as x}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=request-planner-
|
|
1
|
+
import{q as m,t as p,v as d,w as x}from"./chunk-DJMUP6TK.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-AHOGFVHA.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-76NCBYBW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as I}from"./chunk-
|
|
1
|
+
import{b as I}from"./chunk-4XBYHKYG.js";import"./chunk-WP6KLXTP.js";import"./chunk-2GIDVZ4H.js";import"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.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-
|
|
4
|
+
//# sourceMappingURL=review-candidates-ZUXMX6BJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=routing-
|
|
1
|
+
import{a,b}from"./chunk-K6CHA6JJ.js";import"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as cheapModelForEngine,b as routeTaskModel};
|
|
2
|
+
//# sourceMappingURL=routing-EIGWDKH7.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-SFWA67GQ.js";import"./chunk-RKPAVWXF.js";import"./chunk-SELIVR6U.js";import"./chunk-5Y7QRFSL.js";import"./chunk-WLX4766Y.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.js";import"./chunk-QIJLFPWE.js";export{b as resolveScheduleCaller,a as runScheduleTool};
|
|
2
|
+
//# sourceMappingURL=schedule-tool-PSZMP7C4.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as a,o as b,p as c,q as d,r as e,s as f}from"./chunk-5Y7QRFSL.js";import"./chunk-WLX4766Y.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.js";import"./chunk-QIJLFPWE.js";export{a as AGENT_RUN_TIMEOUT_FLOOR,f as CronScheduler,b as agentRunTimeout,e as cronRunId,d as getNextCronDate,c as runLinkIds};
|
|
2
|
+
//# sourceMappingURL=scheduler-S24PXNB6.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-
|
|
2
|
-
//# sourceMappingURL=seat-
|
|
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-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.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-QOY6FA4N.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as S,w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=select-
|
|
1
|
+
import{v as S,w}from"./chunk-DJMUP6TK.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-AHOGFVHA.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-JHKHO5BO.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=set-enabled-
|
|
1
|
+
import{b as a}from"./chunk-WLX4766Y.js";import"./chunk-AHOGFVHA.js";import"./chunk-QIJLFPWE.js";async function i(o,r,s={}){let e=null,n=await a(l=>{let t=l.crons?.[o];if(t?r&&t.approval?.action==="create"?e={ok:!1,status:409,error:`schedule "${o}" is waiting for approval: agentx schedule approve ${o}`}:t.enabled===r&&(e={ok:!0,id:o,enabled:r,changed:!1}):e={ok:!1,status:404,error:`no schedule "${o}"`},e)throw new Error("no write");t.enabled=r,e={ok:!0,id:o,enabled:r,changed:!0}},{configPath:s.configPath,reload:!1});return e&&(!e.ok||!e.changed)?e:n.success?e??{ok:!1,status:500,error:"mutation did not run"}:{ok:!1,status:500,error:n.error||"could not write agentx.json"}}export{i as setCronEnabled};
|
|
2
|
+
//# sourceMappingURL=set-enabled-DVJIUOKX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=tool-
|
|
1
|
+
import{b as p}from"./chunk-SFWA67GQ.js";import"./chunk-RKPAVWXF.js";import"./chunk-SELIVR6U.js";import"./chunk-5Y7QRFSL.js";import"./chunk-WLX4766Y.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.js";import"./chunk-QIJLFPWE.js";var f=new Set(["cron","heartbeat","api","a2a","mesh","approvals"]);function u(t){return typeof t=="string"?t.trim():""}async function y(t,i){let c=i.fetch??fetch,d=i.daemonUrl.replace(/\/$/,""),s=(u(t.action)||"create").toLowerCase(),r=p(t,i.env??process.env);if(s==="status"){let o=u(t.id);if(!o)return"Error: `id` is required for status (the card id you got when you raised it).";try{let n=await c(`${d}/approvals/${encodeURIComponent(o)}`,{signal:AbortSignal.timeout(1e4)}),a=await n.json().catch(()=>({}));if(!n.ok)return`Error: ${a?.error||`HTTP ${n.status}`}`;let e=a.card;return r&&e.raised_by!==r.agentId?`Error: card "${o}" was raised by another agent.`:e.status==="pending"?`Card ${e.id} is still waiting for the operator. It expires ${e.expires}; then "${e.if_silent}" applies.`:e.status==="decided"?`Card ${e.id}: the operator said ${String(e.verdict).toUpperCase()}.${e.note?` Note: ${e.note}`:""}`:`Card ${e.id} expired unanswered; the default applied: ${e.outcome??e.if_silent}.`}catch(n){return`Error: couldn't reach the daemon (${n?.message??n}).`}}if(s!=="create")return`Error: unknown action "${s}". Use create or status.`;if(!r)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=r.channel&&r.chatId&&!f.has(r.channel)?{channel:r.channel,chatId:r.chatId,...r.accountId?{accountId:r.accountId}:{}}:void 0,h={title:t.title,ask:t.ask,recommend:t.recommend,if_silent:t.if_silent,expires:t.expires,source:t.source,raised_by:r.agentId,...l?{reply:l}:{}};try{let o=await c(`${d}/approvals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(1e4)}),n=await o.json().catch(()=>({}));if(!o.ok)return`Error: ${n?.error||`HTTP ${o.status}`}`;let a=n.card;return[`Decision card ${a.id} is in the operator's Approvals inbox.`,`If nobody answers by ${a.expires}, "${a.if_silent}" applies.`,"You will get a message with the result. Tell the requester it is waiting for approval; don't ask the operator again in chat."].join(" ")}catch(o){return`Error: couldn't reach the daemon (${o?.message??o}).`}}export{y as runApprovalTool};
|
|
2
|
+
//# sourceMappingURL=tool-WKSLNQ6H.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./chunk-VWTBHLMX.js";import{a as b}from"./chunk-RCKICCTT.js";import{a}from"./chunk-EMRQ6W5J.js";import"./chunk-CECHWYJ2.js";import{a as c}from"./chunk-XJQNIFZ4.js";import"./chunk-AAA6NGY5.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-AHOGFVHA.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as WikiStore,c as agenticQuery};
|
|
2
|
+
//# sourceMappingURL=wiki-PTXUMSIR.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentix-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.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": {
|