konoha-mcp 2.1.16 → 2.1.17
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/.agents/SOUL.md +1 -1
- package/.agents/skills/konoha/SKILL.md +30 -1
- package/.agents/skills.fingerprint +1 -1
- package/README.md +186 -219
- package/apps/web/build/adapter-node.js +1 -1
- package/apps/web/build/client/_app/immutable/assets/0.BGEsEaMd.css +2 -0
- package/apps/web/build/client/_app/immutable/assets/0.BGEsEaMd.css.br +0 -0
- package/apps/web/build/client/_app/immutable/assets/0.BGEsEaMd.css.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/{D-Kujhko.js → 2WlqNq2Q.js} +1 -1
- package/apps/web/build/client/_app/immutable/chunks/2WlqNq2Q.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/2WlqNq2Q.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/B9vY64pH.js +1 -0
- package/apps/web/build/client/_app/immutable/chunks/B9vY64pH.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/B9vY64pH.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/{Dzm74gVd.js → BPX4jQ9l.js} +1 -1
- package/apps/web/build/client/_app/immutable/chunks/BPX4jQ9l.js.br +2 -0
- package/apps/web/build/client/_app/immutable/chunks/BPX4jQ9l.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/{fbrtLByB.js → BXssplIZ.js} +1 -1
- package/apps/web/build/client/_app/immutable/chunks/BXssplIZ.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/BXssplIZ.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/C-3vSv0T.js +1 -0
- package/apps/web/build/client/_app/immutable/chunks/C-3vSv0T.js.br +2 -0
- package/apps/web/build/client/_app/immutable/chunks/C-3vSv0T.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/{PrdhfbrQ.js → C7jhkUmC.js} +1 -1
- package/apps/web/build/client/_app/immutable/chunks/C7jhkUmC.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/{PrdhfbrQ.js.gz → C7jhkUmC.js.gz} +0 -0
- package/apps/web/build/client/_app/immutable/chunks/{7LmsTWIo.js → CfrhQlXt.js} +1 -1
- package/apps/web/build/client/_app/immutable/chunks/CfrhQlXt.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/CfrhQlXt.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/CgzsRqh3.js +1 -0
- package/apps/web/build/client/_app/immutable/chunks/CgzsRqh3.js.br +1 -0
- package/apps/web/build/client/_app/immutable/chunks/CgzsRqh3.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/ChmznE4L.js +2 -0
- package/apps/web/build/client/_app/immutable/chunks/ChmznE4L.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/ChmznE4L.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/entry/app.cdLMQHsN.js +2 -0
- package/apps/web/build/client/_app/immutable/entry/app.cdLMQHsN.js.br +0 -0
- package/apps/web/build/client/_app/immutable/entry/app.cdLMQHsN.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/entry/{start.CNV5BTCO.js → start.CJ1ccVCA.js} +2 -2
- package/apps/web/build/client/_app/immutable/entry/start.CJ1ccVCA.js.br +0 -0
- package/apps/web/build/client/_app/immutable/entry/start.CJ1ccVCA.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/0.ijG9ltjt.js +2 -0
- package/apps/web/build/client/_app/immutable/nodes/0.ijG9ltjt.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/0.ijG9ltjt.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/1.i6MXc2Yb.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/1.i6MXc2Yb.js.br +2 -0
- package/apps/web/build/client/_app/immutable/nodes/1.i6MXc2Yb.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/10.B0F7UoZ4.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/10.B0F7UoZ4.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/10.B0F7UoZ4.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/{11.4dBWH00t.js → 11.BuH1S-Sa.js} +2 -2
- package/apps/web/build/client/_app/immutable/nodes/11.BuH1S-Sa.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/11.BuH1S-Sa.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/12.DVFmb_G-.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/12.DVFmb_G-.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/12.DVFmb_G-.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/13.0PJQyjqs.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/13.0PJQyjqs.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/13.0PJQyjqs.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/14.ljEGDzwO.js +3 -0
- package/apps/web/build/client/_app/immutable/nodes/14.ljEGDzwO.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/14.ljEGDzwO.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/15.DpXDNTPX.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/15.DpXDNTPX.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/15.DpXDNTPX.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/16.qIEBxyps.js +17 -0
- package/apps/web/build/client/_app/immutable/nodes/16.qIEBxyps.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/16.qIEBxyps.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/17.CmVvQa7x.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/17.CmVvQa7x.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/17.CmVvQa7x.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/{2.Dr646Vs5.js → 2.lx602Ou_.js} +1 -1
- package/apps/web/build/client/_app/immutable/nodes/2.lx602Ou_.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/2.lx602Ou_.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/3.B-axtlUy.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/3.B-axtlUy.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/3.B-axtlUy.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/4.Cp9WmMgk.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/4.Cp9WmMgk.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/4.Cp9WmMgk.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/5.CQxJe2vk.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/5.CQxJe2vk.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/5.CQxJe2vk.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/6.5S6pozqG.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/6.5S6pozqG.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/6.5S6pozqG.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/{7.CmbiPMU3.js → 7.B5ZeCLvS.js} +1 -1
- package/apps/web/build/client/_app/immutable/nodes/7.B5ZeCLvS.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/7.B5ZeCLvS.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/8.M3fxLxa9.js +1 -0
- package/apps/web/build/client/_app/immutable/nodes/8.M3fxLxa9.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/8.M3fxLxa9.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/9.CYkQmFMJ.js +21 -0
- package/apps/web/build/client/_app/immutable/nodes/9.CYkQmFMJ.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/9.CYkQmFMJ.js.gz +0 -0
- package/apps/web/build/client/_app/version.json +1 -1
- package/apps/web/build/client/_app/version.json.br +0 -0
- package/apps/web/build/client/_app/version.json.gz +0 -0
- package/apps/web/build/server/.vite/manifest.json +15 -1
- package/apps/web/build/server/_app/immutable/assets/_layout.BGEsEaMd.css +2 -0
- package/apps/web/build/server/chunks/api.js +4 -0
- package/apps/web/build/server/chunks/api.js.map +1 -1
- package/apps/web/build/server/chunks/instance.js +3 -3
- package/apps/web/build/server/chunks/internal.js +1 -1
- package/apps/web/build/server/entries/pages/_layout.svelte.js +7 -0
- package/apps/web/build/server/entries/pages/_layout.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/agents/_page.svelte.js +6 -2
- package/apps/web/build/server/entries/pages/agents/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/docs/_page.svelte.js +86 -2
- package/apps/web/build/server/entries/pages/docs/_page.svelte.js.map +1 -1
- package/apps/web/build/server/entries/pages/remote/_page.svelte.js +73 -0
- package/apps/web/build/server/entries/pages/remote/_page.svelte.js.map +1 -0
- package/apps/web/build/server/manifest-full.js +15 -7
- package/apps/web/build/server/manifest.js +15 -7
- package/apps/web/build/server/nodes/0.js +2 -2
- package/apps/web/build/server/nodes/1.js +1 -1
- package/apps/web/build/server/nodes/10.js +1 -1
- package/apps/web/build/server/nodes/11.js +1 -1
- package/apps/web/build/server/nodes/12.js +2 -2
- package/apps/web/build/server/nodes/13.js +2 -2
- package/apps/web/build/server/nodes/14.js +2 -2
- package/apps/web/build/server/nodes/15.js +2 -2
- package/apps/web/build/server/nodes/16.js +2 -2
- package/apps/web/build/server/nodes/17.js +8 -0
- package/apps/web/build/server/nodes/2.js +1 -1
- package/apps/web/build/server/nodes/3.js +1 -1
- package/apps/web/build/server/nodes/4.js +1 -1
- package/apps/web/build/server/nodes/5.js +1 -1
- package/apps/web/build/server/nodes/6.js +1 -1
- package/apps/web/build/server/nodes/7.js +1 -1
- package/apps/web/build/server/nodes/8.js +1 -1
- package/apps/web/build/server/nodes/9.js +1 -1
- package/apps/web/build/server/server.js +15 -7
- package/apps/web/package.json +1 -1
- package/bin/cli.js +397 -33
- package/docs/ALL-WORKFLOW-DIAGRAMS.md +135 -0
- package/docs/ARCHITECTURE.md +23 -1
- package/docs/BENCHMARK.md +53 -33
- package/docs/CLOUDFLARE_TUNNEL_GUIDE.md +119 -0
- package/docs/SecurityCompliance/security_compliance_report_google_policy_2.1.17_2026-10-08.md +87 -0
- package/docs/TELEGRAM_INTEGRATION_GUIDE.md +146 -0
- package/docs/diagrams/README.md +6 -2
- package/docs/diagrams/konoha-architecture.drawio +121 -0
- package/docs/diagrams/konoha-enterprise-architecture.drawio +121 -0
- package/package.json +1 -1
- package/src/agent_manager.js +75 -8
- package/src/crypto_vault.js +157 -0
- package/src/db.js +186 -65
- package/src/db_agents.js +1 -1
- package/src/mcp/memory_reporting.js +19 -0
- package/src/mcp/skills.js +17 -15
- package/src/mcp/workflow.js +38 -0
- package/src/migrate.js +74 -6
- package/src/persona_memory.js +1 -1
- package/src/prompt_hook.js +40 -1
- package/src/queue/inbox.js +243 -0
- package/src/queue/worker.js +413 -0
- package/src/telegram/config.js +101 -0
- package/src/telegram/notifier.js +359 -0
- package/src/telegram/poller.js +548 -0
- package/src/telegram/session_manager.js +583 -0
- package/src/templates/SOUL.md +1 -1
- package/src/templates/skills/konoha/SKILL.md +30 -1
- package/src/tunnel/config.js +89 -0
- package/src/tunnel/manager.js +216 -0
- package/src/tunnel/security.js +225 -0
- package/src/vector_search.js +21 -11
- package/src/web_server.js +358 -10
- package/apps/web/build/client/_app/immutable/assets/0.Ch0v37a-.css +0 -2
- package/apps/web/build/client/_app/immutable/assets/0.Ch0v37a-.css.br +0 -0
- package/apps/web/build/client/_app/immutable/assets/0.Ch0v37a-.css.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/7LmsTWIo.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/7LmsTWIo.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/BH86Md_X.js +0 -1
- package/apps/web/build/client/_app/immutable/chunks/BH86Md_X.js.br +0 -2
- package/apps/web/build/client/_app/immutable/chunks/BH86Md_X.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/C3-t9btS.js +0 -1
- package/apps/web/build/client/_app/immutable/chunks/C3-t9btS.js.br +0 -1
- package/apps/web/build/client/_app/immutable/chunks/C3-t9btS.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/CBY268r4.js +0 -1
- package/apps/web/build/client/_app/immutable/chunks/CBY268r4.js.br +0 -3
- package/apps/web/build/client/_app/immutable/chunks/CBY268r4.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/D-Kujhko.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/D-Kujhko.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/Dzm74gVd.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/Dzm74gVd.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/Lb3VuXoN.js +0 -2
- package/apps/web/build/client/_app/immutable/chunks/Lb3VuXoN.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/Lb3VuXoN.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/chunks/PrdhfbrQ.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/fbrtLByB.js.br +0 -0
- package/apps/web/build/client/_app/immutable/chunks/fbrtLByB.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/entry/app.BeU4olDP.js +0 -2
- package/apps/web/build/client/_app/immutable/entry/app.BeU4olDP.js.br +0 -0
- package/apps/web/build/client/_app/immutable/entry/app.BeU4olDP.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/entry/start.CNV5BTCO.js.br +0 -0
- package/apps/web/build/client/_app/immutable/entry/start.CNV5BTCO.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/0.CdOP7y9P.js +0 -2
- package/apps/web/build/client/_app/immutable/nodes/0.CdOP7y9P.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/0.CdOP7y9P.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/1.BZu6jsAH.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/1.BZu6jsAH.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/1.BZu6jsAH.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/10.CZKScTFN.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/10.CZKScTFN.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/10.CZKScTFN.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/11.4dBWH00t.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/11.4dBWH00t.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/12.CSShcv5z.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/12.CSShcv5z.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/12.CSShcv5z.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/13.jWUWoBcs.js +0 -3
- package/apps/web/build/client/_app/immutable/nodes/13.jWUWoBcs.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/13.jWUWoBcs.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/14.H-jSqqen.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/14.H-jSqqen.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/14.H-jSqqen.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/15.CpAoyhzV.js +0 -17
- package/apps/web/build/client/_app/immutable/nodes/15.CpAoyhzV.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/15.CpAoyhzV.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/16.DT_-MxCT.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/16.DT_-MxCT.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/16.DT_-MxCT.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/2.Dr646Vs5.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/2.Dr646Vs5.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/3.Cgc-xN3x.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/3.Cgc-xN3x.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/3.Cgc-xN3x.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/4.CYJQ4bWz.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/4.CYJQ4bWz.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/4.CYJQ4bWz.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/5.DbHL-3Es.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/5.DbHL-3Es.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/5.DbHL-3Es.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/6.BvWH2qas.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/6.BvWH2qas.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/6.BvWH2qas.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/7.CmbiPMU3.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/7.CmbiPMU3.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/8.B9897Zm9.js +0 -1
- package/apps/web/build/client/_app/immutable/nodes/8.B9897Zm9.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/8.B9897Zm9.js.gz +0 -0
- package/apps/web/build/client/_app/immutable/nodes/9.CGMmeMVC.js +0 -14
- package/apps/web/build/client/_app/immutable/nodes/9.CGMmeMVC.js.br +0 -0
- package/apps/web/build/client/_app/immutable/nodes/9.CGMmeMVC.js.gz +0 -0
- package/apps/web/build/server/_app/immutable/assets/_layout.Ch0v37a-.css +0 -2
package/src/migrate.js
CHANGED
|
@@ -296,6 +296,70 @@ function migrateSkill(conn, skillName, skillsOnly = false, skillsDir = SKILLS_DI
|
|
|
296
296
|
log(` ✓ references/${refNameRaw}.md (${rawSize.toLocaleString()} → ${byteSize.toLocaleString()} bytes, optimized ${pct.toFixed(1)}%)`);
|
|
297
297
|
count += 1;
|
|
298
298
|
}
|
|
299
|
+
|
|
300
|
+
// 2b. Migrate anthropic-cybersecurity-skills-assets if present under references/
|
|
301
|
+
const cyberSkillsDir = path.join(refsDir, "anthropic-cybersecurity-skills-assets", "skills");
|
|
302
|
+
if (!skillsOnly && fs.existsSync(cyberSkillsDir) && fs.statSync(cyberSkillsDir).isDirectory()) {
|
|
303
|
+
const subSkills = fs.readdirSync(cyberSkillsDir).sort();
|
|
304
|
+
let cyberCount = 0;
|
|
305
|
+
let totalCyberBytes = 0;
|
|
306
|
+
|
|
307
|
+
const deleteSkill = conn.prepare("DELETE FROM skills WHERE name = ?");
|
|
308
|
+
const insertSkill = conn.prepare(
|
|
309
|
+
"INSERT INTO skills (name, skill_name, type, tags, content, file_path, byte_size, line_count) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
|
310
|
+
);
|
|
311
|
+
|
|
312
|
+
const cyberBatch = conn.transaction((list) => {
|
|
313
|
+
for (const sub of list) {
|
|
314
|
+
const subSkillMd = path.join(cyberSkillsDir, sub, "SKILL.md");
|
|
315
|
+
if (!fs.existsSync(subSkillMd)) continue;
|
|
316
|
+
|
|
317
|
+
const rawContent = fs.readFileSync(subSkillMd, 'utf8');
|
|
318
|
+
const refKey = `${skillName}/${sub}`;
|
|
319
|
+
|
|
320
|
+
let extraTags = [];
|
|
321
|
+
if (rawContent.startsWith('---')) {
|
|
322
|
+
const endIdx = rawContent.indexOf('---', 3);
|
|
323
|
+
if (endIdx > 3) {
|
|
324
|
+
const fm = rawContent.slice(3, endIdx);
|
|
325
|
+
const tagMatches = fm.match(/tags:\s*([\s\S]*?)(?=\n[a-z_]+:|$)/i);
|
|
326
|
+
if (tagMatches) {
|
|
327
|
+
const lines = tagMatches[1].split('\n').map(l => l.replace(/^\s*-\s*/, '').trim()).filter(Boolean);
|
|
328
|
+
extraTags.push(...lines);
|
|
329
|
+
}
|
|
330
|
+
const mitreMatches = fm.match(/mitre_attack:\s*([\s\S]*?)(?=\n[a-z_]+:|$)/i);
|
|
331
|
+
if (mitreMatches) {
|
|
332
|
+
const mLines = mitreMatches[1].split('\n').map(l => l.replace(/^\s*-\s*/, '').trim()).filter(Boolean);
|
|
333
|
+
extraTags.push(...mLines);
|
|
334
|
+
}
|
|
335
|
+
const domainMatch = fm.match(/domain:\s*["']?(.*?)["']?\s*$/m);
|
|
336
|
+
if (domainMatch && domainMatch[1]) extraTags.push(domainMatch[1]);
|
|
337
|
+
const subDomainMatch = fm.match(/subdomain:\s*["']?(.*?)["']?\s*$/m);
|
|
338
|
+
if (subDomainMatch && subDomainMatch[1]) extraTags.push(subDomainMatch[1]);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const baseTags = [skillName, 'cybersecurity', 'pentest', 'red-team', sub.replace(/-/g, ' ')];
|
|
343
|
+
const allTags = Array.from(new Set([...baseTags, ...extraTags])).join(',');
|
|
344
|
+
|
|
345
|
+
const content = optimizeContent(rawContent);
|
|
346
|
+
const byteSize = Buffer.byteLength(content, 'utf8');
|
|
347
|
+
const lineCount = (content.match(/\n/g) || []).length + 1;
|
|
348
|
+
|
|
349
|
+
try {
|
|
350
|
+
conn.prepare("DELETE FROM skill_chunks WHERE skill_name = ?").run(refKey);
|
|
351
|
+
} catch (_) { /* best-effort cleanup */ }
|
|
352
|
+
deleteSkill.run(refKey);
|
|
353
|
+
insertSkill.run(refKey, skillName, "reference", allTags, content, subSkillMd, byteSize, lineCount);
|
|
354
|
+
cyberCount += 1;
|
|
355
|
+
totalCyberBytes += byteSize;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
cyberBatch(subSkills);
|
|
360
|
+
log(` ✓ anthropic-cybersecurity-skills-assets: ${cyberCount} structured cybersecurity skills migrated & indexed (${(totalCyberBytes / 1024 / 1024).toFixed(2)} MB)`);
|
|
361
|
+
count += cyberCount;
|
|
362
|
+
}
|
|
299
363
|
}
|
|
300
364
|
|
|
301
365
|
// 3. Migrate other .md files in root of skill directory
|
|
@@ -704,12 +768,16 @@ async function runMigration(options = {}) {
|
|
|
704
768
|
|
|
705
769
|
// Verify FTS index
|
|
706
770
|
log("\n🔍 Verifying FTS index...");
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
771
|
+
if (db.hasFts5Support && !db.hasFts5Support(conn)) {
|
|
772
|
+
log(" FTS5 module not available on this platform. Fallback keyword search enabled.");
|
|
773
|
+
} else {
|
|
774
|
+
for (const testWord of ['security', 'terraform', 'svelte']) {
|
|
775
|
+
try {
|
|
776
|
+
const result = conn.prepare("SELECT COUNT(*) as cnt FROM skills_fts WHERE skills_fts MATCH ?").get(testWord);
|
|
777
|
+
log(` FTS test query '${testWord}': ${result ? result.cnt : 0} matches`);
|
|
778
|
+
} catch (_) {
|
|
779
|
+
log(` FTS test query '${testWord}': skipped (no matches)`);
|
|
780
|
+
}
|
|
713
781
|
}
|
|
714
782
|
}
|
|
715
783
|
|
package/src/persona_memory.js
CHANGED
|
@@ -488,7 +488,7 @@ function queryMemories(
|
|
|
488
488
|
if (query && query.trim()) {
|
|
489
489
|
const cleanQ = query.replace(/[^\p{L}\p{N}\s]/gu, ' ');
|
|
490
490
|
const tokens = cleanQ.split(/\s+/).filter(t => t.length > 1 && !['and', 'or', 'not'].includes(t.toLowerCase()));
|
|
491
|
-
if (tokens.length) {
|
|
491
|
+
if (tokens.length && (!db.hasFts5Support || db.hasFts5Support(conn))) {
|
|
492
492
|
const ftsExpr = tokens.map(t => `"${t}"`).join(" OR ");
|
|
493
493
|
try {
|
|
494
494
|
let sql;
|
package/src/prompt_hook.js
CHANGED
|
@@ -186,14 +186,53 @@ async function main() {
|
|
|
186
186
|
const { transcriptPath, artifactDirectoryPath } = context;
|
|
187
187
|
if (!transcriptPath) process.exit(0);
|
|
188
188
|
|
|
189
|
+
async function appendPendingInboxPrompts(artifactDirectoryPath) {
|
|
190
|
+
if (!artifactDirectoryPath) return null;
|
|
191
|
+
try {
|
|
192
|
+
const inbox = require('./queue/inbox');
|
|
193
|
+
const sessionId = path.basename(artifactDirectoryPath);
|
|
194
|
+
const pending = inbox.claimNextPendingPrompt({ client: 'antigravity', session_id: sessionId });
|
|
195
|
+
if (!pending) return null;
|
|
196
|
+
const promptFilePath = path.join(artifactDirectoryPath, 'prompt.md');
|
|
197
|
+
if (!fs.existsSync(promptFilePath)) return null;
|
|
198
|
+
const existing = fs.readFileSync(promptFilePath, 'utf-8');
|
|
199
|
+
if (existing.includes(pending.id)) return null;
|
|
200
|
+
const followUpCount = (existing.match(/^## Follow-up /gm) || []).length;
|
|
201
|
+
const stamp = new Date().toISOString();
|
|
202
|
+
const content = `\n\n## Follow-up ${followUpCount + 1} (${stamp}) [Inbound Queue: ${pending.id} from ${pending.source}]\n\n<USER_REQUEST>\n${pending.prompt}\n</USER_REQUEST>\n`;
|
|
203
|
+
fs.appendFileSync(promptFilePath, content, 'utf-8');
|
|
204
|
+
return pending;
|
|
205
|
+
} catch (_) {
|
|
206
|
+
/* intentional fallback: queue file append error must not crash prompt hook */
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
189
211
|
const { lastInput, isNewInput } = await getLastUserInput(transcriptPath);
|
|
190
212
|
await writePromptFile(lastInput, artifactDirectoryPath);
|
|
213
|
+
const queuedTask = await appendPendingInboxPrompts(artifactDirectoryPath);
|
|
214
|
+
|
|
215
|
+
// Inject pending inbox/telegram prompt notification if queued
|
|
216
|
+
let pendingInboxMsg = null;
|
|
217
|
+
try {
|
|
218
|
+
const inbox = require('./queue/inbox');
|
|
219
|
+
const pending = queuedTask || inbox.getNextPendingPrompt();
|
|
220
|
+
if (pending) {
|
|
221
|
+
pendingInboxMsg = `[INBOUND PROMPT QUEUE] Task #${pending.id} waiting from ${pending.source}: "${pending.prompt}". Execute via Konoha subagents.`;
|
|
222
|
+
}
|
|
223
|
+
} catch (_) {
|
|
224
|
+
/* intentional fallback: queue failure must never crash prompt hook */
|
|
225
|
+
}
|
|
191
226
|
|
|
192
227
|
// ONLY inject the self ephemeral for CONFIRMED self sessions
|
|
193
228
|
// AND only when this is a NEW user input awaiting its initial response.
|
|
194
229
|
// Suppresses repetitive nudges on subsequent tool calls and steps within the turn.
|
|
195
230
|
if (isNewInput && isConfirmedSelf(transcriptPath)) {
|
|
196
|
-
|
|
231
|
+
const nudge = JSON.parse(JSON.stringify(SELF_NUDGE));
|
|
232
|
+
if (pendingInboxMsg) {
|
|
233
|
+
nudge.injectSteps.push({ ephemeralMessage: pendingInboxMsg });
|
|
234
|
+
}
|
|
235
|
+
console.log(JSON.stringify(nudge));
|
|
197
236
|
}
|
|
198
237
|
} catch {
|
|
199
238
|
process.exit(0);
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Inbound Prompt Queue & Inbox Engine.
|
|
3
|
+
* Synchronizes SQLite prompt_queue records with local filesystem mirrors in ~/.konoha/inbox/.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const os = require('os');
|
|
11
|
+
const dbModule = require('../db');
|
|
12
|
+
|
|
13
|
+
function getInboxDir() {
|
|
14
|
+
const dir = path.join(os.homedir(), '.konoha', 'inbox');
|
|
15
|
+
if (!fs.existsSync(dir)) {
|
|
16
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
return dir;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function generateTaskId() {
|
|
22
|
+
const ts = Date.now().toString(36);
|
|
23
|
+
const rand = Math.random().toString(36).substring(2, 7);
|
|
24
|
+
return `task_${ts}_${rand}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Enqueue a new prompt into SQLite and update filesystem mirror.
|
|
29
|
+
*/
|
|
30
|
+
function enqueuePrompt({ prompt, source = 'web_ui', sender_info = '', session_id = 'default', workspace_root = '', client = '' }) {
|
|
31
|
+
if (!prompt || typeof prompt !== 'string' || !prompt.trim()) {
|
|
32
|
+
throw new Error('Prompt cannot be empty');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const conn = dbModule.getConnection();
|
|
36
|
+
const id = generateTaskId();
|
|
37
|
+
const now = new Date().toISOString();
|
|
38
|
+
const cleanPrompt = prompt.trim();
|
|
39
|
+
const cleanSession = session_id || 'default';
|
|
40
|
+
const cleanWs = workspace_root || '';
|
|
41
|
+
const cleanClient = client || '';
|
|
42
|
+
|
|
43
|
+
conn.prepare(`
|
|
44
|
+
INSERT INTO prompt_queue (
|
|
45
|
+
id, source, sender_info, prompt, status, session_id, workspace_root, client, created_at
|
|
46
|
+
) VALUES (?, ?, ?, ?, 'pending', ?, ?, ?, ?)
|
|
47
|
+
`).run(id, source, String(sender_info || ''), cleanPrompt, cleanSession, cleanWs, cleanClient, now);
|
|
48
|
+
|
|
49
|
+
// Write filesystem mirror
|
|
50
|
+
try {
|
|
51
|
+
const inboxDir = getInboxDir();
|
|
52
|
+
const payload = JSON.stringify({
|
|
53
|
+
id,
|
|
54
|
+
prompt: cleanPrompt,
|
|
55
|
+
source,
|
|
56
|
+
sender_info,
|
|
57
|
+
session_id: cleanSession,
|
|
58
|
+
workspace_root: cleanWs,
|
|
59
|
+
client: cleanClient,
|
|
60
|
+
status: 'pending',
|
|
61
|
+
created_at: now
|
|
62
|
+
}, null, 2);
|
|
63
|
+
|
|
64
|
+
fs.writeFileSync(path.join(inboxDir, `${cleanSession}.json`), payload, 'utf8');
|
|
65
|
+
fs.writeFileSync(path.join(inboxDir, 'latest.json'), payload, 'utf8');
|
|
66
|
+
} catch (_) { /* best-effort filesystem mirror */ }
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
id,
|
|
70
|
+
source,
|
|
71
|
+
prompt: cleanPrompt,
|
|
72
|
+
status: 'pending',
|
|
73
|
+
session_id: cleanSession,
|
|
74
|
+
workspace_root: cleanWs,
|
|
75
|
+
client: cleanClient,
|
|
76
|
+
created_at: now
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get next pending prompt from queue.
|
|
82
|
+
*/
|
|
83
|
+
function getNextPendingPrompt(session_id = null) {
|
|
84
|
+
const conn = dbModule.getConnection();
|
|
85
|
+
if (session_id) {
|
|
86
|
+
return conn.prepare(`
|
|
87
|
+
SELECT * FROM prompt_queue
|
|
88
|
+
WHERE status = 'pending' AND session_id = ?
|
|
89
|
+
ORDER BY created_at ASC LIMIT 1
|
|
90
|
+
`).get(session_id) || null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return conn.prepare(`
|
|
94
|
+
SELECT * FROM prompt_queue
|
|
95
|
+
WHERE status = 'pending'
|
|
96
|
+
ORDER BY created_at ASC LIMIT 1
|
|
97
|
+
`).get() || null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Atomically claim next pending prompt for execution.
|
|
102
|
+
* Prevents conflicts and race conditions when multiple client sessions run concurrently
|
|
103
|
+
* (e.g. 2 Antigravity sessions or 1 Antigravity + 1 Claude Code).
|
|
104
|
+
*/
|
|
105
|
+
function claimNextPendingPrompt({ client = 'default', session_id = null } = {}) {
|
|
106
|
+
const conn = dbModule.getConnection();
|
|
107
|
+
const now = new Date().toISOString();
|
|
108
|
+
let claimed = null;
|
|
109
|
+
|
|
110
|
+
const tx = conn.transaction(() => {
|
|
111
|
+
let row = null;
|
|
112
|
+
if (session_id) {
|
|
113
|
+
row = conn.prepare(`
|
|
114
|
+
SELECT * FROM prompt_queue
|
|
115
|
+
WHERE status = 'pending' AND (session_id = ? OR session_id = 'default' OR session_id = '')
|
|
116
|
+
ORDER BY created_at ASC LIMIT 1
|
|
117
|
+
`).get(session_id);
|
|
118
|
+
}
|
|
119
|
+
if (!row) {
|
|
120
|
+
row = conn.prepare(`
|
|
121
|
+
SELECT * FROM prompt_queue
|
|
122
|
+
WHERE status = 'pending'
|
|
123
|
+
ORDER BY created_at ASC LIMIT 1
|
|
124
|
+
`).get();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (row) {
|
|
128
|
+
conn.prepare(`
|
|
129
|
+
UPDATE prompt_queue
|
|
130
|
+
SET status = 'processing', processed_at = ?, session_id = ?
|
|
131
|
+
WHERE id = ? AND status = 'pending'
|
|
132
|
+
`).run(now, session_id || row.session_id || client, row.id);
|
|
133
|
+
claimed = { ...row, status: 'processing', processed_at: now, session_id: session_id || row.session_id };
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
tx();
|
|
138
|
+
return claimed;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Mark prompt as processing.
|
|
143
|
+
*/
|
|
144
|
+
function markPromptProcessing(id) {
|
|
145
|
+
const conn = dbModule.getConnection();
|
|
146
|
+
const now = new Date().toISOString();
|
|
147
|
+
conn.prepare(`
|
|
148
|
+
UPDATE prompt_queue
|
|
149
|
+
SET status = 'processing', processed_at = ?
|
|
150
|
+
WHERE id = ?
|
|
151
|
+
`).run(now, id);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Mark prompt as completed or failed and clean up mirror.
|
|
156
|
+
*/
|
|
157
|
+
function completePrompt(id, {
|
|
158
|
+
result_summary = '',
|
|
159
|
+
token_savings_percent = 0,
|
|
160
|
+
kage_confidence_score = 0,
|
|
161
|
+
status = 'completed'
|
|
162
|
+
} = {}) {
|
|
163
|
+
const conn = dbModule.getConnection();
|
|
164
|
+
const now = new Date().toISOString();
|
|
165
|
+
const cleanStatus = ['completed', 'failed', 'cancelled'].includes(status) ? status : 'completed';
|
|
166
|
+
|
|
167
|
+
conn.prepare(`
|
|
168
|
+
UPDATE prompt_queue
|
|
169
|
+
SET status = ?,
|
|
170
|
+
result_summary = ?,
|
|
171
|
+
token_savings_percent = ?,
|
|
172
|
+
kage_confidence_score = ?,
|
|
173
|
+
completed_at = ?
|
|
174
|
+
WHERE id = ?
|
|
175
|
+
`).run(
|
|
176
|
+
cleanStatus,
|
|
177
|
+
String(result_summary || ''),
|
|
178
|
+
Number(token_savings_percent) || 0,
|
|
179
|
+
Number(kage_confidence_score) || 0,
|
|
180
|
+
now,
|
|
181
|
+
id
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
// Clean up session mirror if present
|
|
185
|
+
try {
|
|
186
|
+
const row = conn.prepare('SELECT session_id FROM prompt_queue WHERE id = ?').get(id);
|
|
187
|
+
if (row && row.session_id) {
|
|
188
|
+
const inboxFile = path.join(getInboxDir(), `${row.session_id}.json`);
|
|
189
|
+
if (fs.existsSync(inboxFile)) {
|
|
190
|
+
try {
|
|
191
|
+
const current = JSON.parse(fs.readFileSync(inboxFile, 'utf8'));
|
|
192
|
+
if (current.id === id) {
|
|
193
|
+
fs.unlinkSync(inboxFile);
|
|
194
|
+
}
|
|
195
|
+
} catch (_fileErr) {
|
|
196
|
+
/* ignore unlinking error */
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
} catch (_dbErr) {
|
|
201
|
+
/* ignore session lookup error */
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* List recent prompts for API/dashboard.
|
|
207
|
+
*/
|
|
208
|
+
function listPrompts({ limit = 20, status = null } = {}) {
|
|
209
|
+
const conn = dbModule.getConnection();
|
|
210
|
+
const max = Math.max(1, Math.min(100, Number(limit) || 20));
|
|
211
|
+
|
|
212
|
+
if (status) {
|
|
213
|
+
return conn.prepare(`
|
|
214
|
+
SELECT * FROM prompt_queue
|
|
215
|
+
WHERE status = ?
|
|
216
|
+
ORDER BY created_at DESC LIMIT ?
|
|
217
|
+
`).all(status, max);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return conn.prepare(`
|
|
221
|
+
SELECT * FROM prompt_queue
|
|
222
|
+
ORDER BY created_at DESC LIMIT ?
|
|
223
|
+
`).all(max);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Retrieve single prompt by ID.
|
|
228
|
+
*/
|
|
229
|
+
function getPromptById(id) {
|
|
230
|
+
const conn = dbModule.getConnection();
|
|
231
|
+
return conn.prepare('SELECT * FROM prompt_queue WHERE id = ?').get(id) || null;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
module.exports = {
|
|
235
|
+
getInboxDir,
|
|
236
|
+
enqueuePrompt,
|
|
237
|
+
getNextPendingPrompt,
|
|
238
|
+
claimNextPendingPrompt,
|
|
239
|
+
markPromptProcessing,
|
|
240
|
+
completePrompt,
|
|
241
|
+
listPrompts,
|
|
242
|
+
getPromptById
|
|
243
|
+
};
|