synabun 1.3.0 → 2.0.0-beta
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/CHANGELOG.md +197 -662
- package/LICENSE-COMMERCIAL.md +33 -0
- package/NOTICE +17 -0
- package/README.md +175 -853
- package/THIRD-PARTY-LICENSES.md +131 -0
- package/benchmarks/browser-live-results.json +79 -0
- package/benchmarks/browser-v2-results.json +258 -0
- package/benchmarks/fixtures/browser/README.md +57 -0
- package/benchmarks/fixtures/browser/page-state.json +132 -0
- package/benchmarks/fixtures/browser/social.json +92 -0
- package/benchmarks/fixtures/browser/target.json +319 -0
- package/benchmarks/fixtures/desktop/README.md +58 -0
- package/benchmarks/fixtures/desktop/abstention.json +59 -0
- package/benchmarks/fixtures/desktop/adversarial.json +22 -0
- package/benchmarks/fixtures/desktop/forbidden.json +93 -0
- package/benchmarks/fixtures/desktop/generate.mjs +1023 -0
- package/benchmarks/fixtures/desktop/target.json +136 -0
- package/bin/synabun.js +30 -0
- package/docs/browser-v2.md +109 -0
- package/docs/hook-integrity.md +89 -0
- package/docs/judgments.md +182 -0
- package/docs/style-guide.md +246 -0
- package/docs/whatsapp.md +325 -0
- package/hooks/claude-code/post-plan.mjs +613 -391
- package/hooks/claude-code/post-remember.mjs +246 -122
- package/hooks/claude-code/pre-compact.mjs +171 -110
- package/hooks/claude-code/pre-task.mjs +133 -0
- package/hooks/claude-code/pre-websearch.mjs +15 -4
- package/hooks/claude-code/prompt-origin.mjs +94 -0
- package/hooks/claude-code/prompt-submit.mjs +1244 -861
- package/hooks/claude-code/session-start.mjs +114 -156
- package/hooks/claude-code/shared.mjs +1228 -368
- package/hooks/claude-code/state.mjs +167 -0
- package/hooks/claude-code/stop.mjs +515 -140
- package/hooks/claude-code/subagent-start.mjs +154 -0
- package/hooks/claude-code/subagent-stop.mjs +102 -0
- package/hooks/claude-code/task-gate.mjs +150 -0
- package/lib/claude-hooks.js +84 -0
- package/lib/claude-usage-audit.js +141 -0
- package/lib/client-config-repair.js +144 -0
- package/lib/data-home-migration.js +498 -0
- package/lib/first-launch-protection.js +240 -0
- package/lib/paths.d.ts +21 -0
- package/lib/paths.js +103 -0
- package/mcp-server/dist/config.d.ts +22 -0
- package/mcp-server/dist/config.d.ts.map +1 -0
- package/mcp-server/dist/config.js +109 -0
- package/mcp-server/dist/config.js.map +1 -0
- package/mcp-server/dist/http.d.ts +30 -0
- package/mcp-server/dist/http.d.ts.map +1 -0
- package/mcp-server/dist/http.js +276 -0
- package/mcp-server/dist/http.js.map +1 -0
- package/mcp-server/dist/index.d.ts +48 -0
- package/mcp-server/dist/index.d.ts.map +1 -0
- package/mcp-server/dist/index.js +538 -0
- package/mcp-server/dist/index.js.map +1 -0
- package/mcp-server/dist/preload-http.d.ts +3 -0
- package/mcp-server/dist/preload-http.d.ts.map +1 -0
- package/mcp-server/dist/preload-http.js +28 -0
- package/mcp-server/dist/preload-http.js.map +1 -0
- package/mcp-server/dist/preload.d.ts +3 -0
- package/mcp-server/dist/preload.d.ts.map +1 -0
- package/mcp-server/dist/preload.js +32 -0
- package/mcp-server/dist/preload.js.map +1 -0
- package/mcp-server/dist/scripts/migrate-qdrant-to-sqlite.d.ts +19 -0
- package/mcp-server/dist/scripts/migrate-qdrant-to-sqlite.d.ts.map +1 -0
- package/mcp-server/dist/scripts/migrate-qdrant-to-sqlite.js +403 -0
- package/mcp-server/dist/scripts/migrate-qdrant-to-sqlite.js.map +1 -0
- package/mcp-server/dist/scripts/setup-embeddings.d.ts +3 -0
- package/mcp-server/dist/scripts/setup-embeddings.d.ts.map +1 -0
- package/mcp-server/dist/scripts/setup-embeddings.js +15 -0
- package/mcp-server/dist/scripts/setup-embeddings.js.map +1 -0
- package/mcp-server/dist/services/assistant-judgments.d.ts +79 -0
- package/mcp-server/dist/services/assistant-judgments.d.ts.map +1 -0
- package/mcp-server/dist/services/assistant-judgments.js +128 -0
- package/mcp-server/dist/services/assistant-judgments.js.map +1 -0
- package/mcp-server/dist/services/browser-assist-gate.d.ts +314 -0
- package/mcp-server/dist/services/browser-assist-gate.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-assist-gate.js +344 -0
- package/mcp-server/dist/services/browser-assist-gate.js.map +1 -0
- package/mcp-server/dist/services/browser-assist.d.ts +104 -0
- package/mcp-server/dist/services/browser-assist.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-assist.js +282 -0
- package/mcp-server/dist/services/browser-assist.js.map +1 -0
- package/mcp-server/dist/services/browser-bench.d.ts +772 -0
- package/mcp-server/dist/services/browser-bench.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-bench.js +424 -0
- package/mcp-server/dist/services/browser-bench.js.map +1 -0
- package/mcp-server/dist/services/browser-judgments.d.ts +196 -0
- package/mcp-server/dist/services/browser-judgments.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-judgments.js +363 -0
- package/mcp-server/dist/services/browser-judgments.js.map +1 -0
- package/mcp-server/dist/services/browser-risk.d.ts +166 -0
- package/mcp-server/dist/services/browser-risk.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-risk.js +458 -0
- package/mcp-server/dist/services/browser-risk.js.map +1 -0
- package/mcp-server/dist/services/categories.d.ts +61 -0
- package/mcp-server/dist/services/categories.d.ts.map +1 -0
- package/mcp-server/dist/services/categories.js +377 -0
- package/mcp-server/dist/services/categories.js.map +1 -0
- package/mcp-server/dist/services/codex-config-heal.d.ts +49 -0
- package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -0
- package/mcp-server/dist/services/codex-config-heal.js +346 -0
- package/mcp-server/dist/services/codex-config-heal.js.map +1 -0
- package/mcp-server/dist/services/desktop-assist-gate.d.ts +198 -0
- package/mcp-server/dist/services/desktop-assist-gate.d.ts.map +1 -0
- package/mcp-server/dist/services/desktop-assist-gate.js +202 -0
- package/mcp-server/dist/services/desktop-assist-gate.js.map +1 -0
- package/mcp-server/dist/services/desktop-assist.d.ts +104 -0
- package/mcp-server/dist/services/desktop-assist.d.ts.map +1 -0
- package/mcp-server/dist/services/desktop-assist.js +266 -0
- package/mcp-server/dist/services/desktop-assist.js.map +1 -0
- package/mcp-server/dist/services/desktop-bench.d.ts +553 -0
- package/mcp-server/dist/services/desktop-bench.d.ts.map +1 -0
- package/mcp-server/dist/services/desktop-bench.js +311 -0
- package/mcp-server/dist/services/desktop-bench.js.map +1 -0
- package/mcp-server/dist/services/desktop-client.d.ts +23 -0
- package/mcp-server/dist/services/desktop-client.d.ts.map +1 -0
- package/mcp-server/dist/services/desktop-client.js +79 -0
- package/mcp-server/dist/services/desktop-client.js.map +1 -0
- package/mcp-server/dist/services/desktop-judgments.d.ts +125 -0
- package/mcp-server/dist/services/desktop-judgments.d.ts.map +1 -0
- package/mcp-server/dist/services/desktop-judgments.js +177 -0
- package/mcp-server/dist/services/desktop-judgments.js.map +1 -0
- package/mcp-server/dist/services/desktop-risk.d.ts +283 -0
- package/mcp-server/dist/services/desktop-risk.d.ts.map +1 -0
- package/mcp-server/dist/services/desktop-risk.js +605 -0
- package/mcp-server/dist/services/desktop-risk.js.map +1 -0
- package/mcp-server/dist/services/discord.d.ts +112 -0
- package/mcp-server/dist/services/discord.d.ts.map +1 -0
- package/mcp-server/dist/services/discord.js +477 -0
- package/mcp-server/dist/services/discord.js.map +1 -0
- package/mcp-server/dist/services/edit-stale.d.ts +81 -0
- package/mcp-server/dist/services/edit-stale.d.ts.map +1 -0
- package/mcp-server/dist/services/edit-stale.js +358 -0
- package/mcp-server/dist/services/edit-stale.js.map +1 -0
- package/mcp-server/dist/services/embedding-service.d.ts +16 -0
- package/mcp-server/dist/services/embedding-service.d.ts.map +1 -0
- package/mcp-server/dist/services/embedding-service.js +126 -0
- package/mcp-server/dist/services/embedding-service.js.map +1 -0
- package/mcp-server/dist/services/embedding-worker.d.ts +2 -0
- package/mcp-server/dist/services/embedding-worker.d.ts.map +1 -0
- package/mcp-server/dist/services/embedding-worker.js +52 -0
- package/mcp-server/dist/services/embedding-worker.js.map +1 -0
- package/mcp-server/dist/services/fb-regions.d.ts +71 -0
- package/mcp-server/dist/services/fb-regions.d.ts.map +1 -0
- package/mcp-server/dist/services/fb-regions.js +211 -0
- package/mcp-server/dist/services/fb-regions.js.map +1 -0
- package/mcp-server/dist/services/file-checksums.d.ts +22 -0
- package/mcp-server/dist/services/file-checksums.d.ts.map +1 -0
- package/mcp-server/dist/services/file-checksums.js +55 -0
- package/mcp-server/dist/services/file-checksums.js.map +1 -0
- package/mcp-server/dist/services/file-excerpt.d.ts +24 -0
- package/mcp-server/dist/services/file-excerpt.d.ts.map +1 -0
- package/mcp-server/dist/services/file-excerpt.js +65 -0
- package/mcp-server/dist/services/file-excerpt.js.map +1 -0
- package/mcp-server/dist/services/identity.d.ts +124 -0
- package/mcp-server/dist/services/identity.d.ts.map +1 -0
- package/mcp-server/dist/services/identity.js +241 -0
- package/mcp-server/dist/services/identity.js.map +1 -0
- package/mcp-server/dist/services/local-embeddings.d.ts +2 -0
- package/mcp-server/dist/services/local-embeddings.d.ts.map +1 -0
- package/mcp-server/dist/services/local-embeddings.js +3 -0
- package/mcp-server/dist/services/local-embeddings.js.map +1 -0
- package/mcp-server/dist/services/memory-client.d.ts +4 -0
- package/mcp-server/dist/services/memory-client.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-client.js +27 -0
- package/mcp-server/dist/services/memory-client.js.map +1 -0
- package/mcp-server/dist/services/memory-judge-backfill.d.ts +135 -0
- package/mcp-server/dist/services/memory-judge-backfill.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-judge-backfill.js +510 -0
- package/mcp-server/dist/services/memory-judge-backfill.js.map +1 -0
- package/mcp-server/dist/services/memory-judgments.d.ts +362 -0
- package/mcp-server/dist/services/memory-judgments.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-judgments.js +674 -0
- package/mcp-server/dist/services/memory-judgments.js.map +1 -0
- package/mcp-server/dist/services/memory-maintenance.d.ts +108 -0
- package/mcp-server/dist/services/memory-maintenance.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-maintenance.js +403 -0
- package/mcp-server/dist/services/memory-maintenance.js.map +1 -0
- package/mcp-server/dist/services/memory-retrieval.d.ts +66 -0
- package/mcp-server/dist/services/memory-retrieval.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-retrieval.js +412 -0
- package/mcp-server/dist/services/memory-retrieval.js.map +1 -0
- package/mcp-server/dist/services/memory-schema.d.ts +16 -0
- package/mcp-server/dist/services/memory-schema.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-schema.js +282 -0
- package/mcp-server/dist/services/memory-schema.js.map +1 -0
- package/mcp-server/dist/services/memory-sessions.d.ts +24 -0
- package/mcp-server/dist/services/memory-sessions.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-sessions.js +110 -0
- package/mcp-server/dist/services/memory-sessions.js.map +1 -0
- package/mcp-server/dist/services/memory-triage.d.ts +60 -0
- package/mcp-server/dist/services/memory-triage.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-triage.js +189 -0
- package/mcp-server/dist/services/memory-triage.js.map +1 -0
- package/mcp-server/dist/services/memory-verification.d.ts +24 -0
- package/mcp-server/dist/services/memory-verification.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-verification.js +92 -0
- package/mcp-server/dist/services/memory-verification.js.map +1 -0
- package/mcp-server/dist/services/memory-writer.d.ts +26 -0
- package/mcp-server/dist/services/memory-writer.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-writer.js +126 -0
- package/mcp-server/dist/services/memory-writer.js.map +1 -0
- package/mcp-server/dist/services/neural-interface.d.ts +439 -0
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -0
- package/mcp-server/dist/services/neural-interface.js +1135 -0
- package/mcp-server/dist/services/neural-interface.js.map +1 -0
- package/mcp-server/dist/services/profiles.d.ts +120 -0
- package/mcp-server/dist/services/profiles.d.ts.map +1 -0
- package/mcp-server/dist/services/profiles.js +387 -0
- package/mcp-server/dist/services/profiles.js.map +1 -0
- package/mcp-server/dist/services/secret-gate.d.ts +29 -0
- package/mcp-server/dist/services/secret-gate.d.ts.map +1 -0
- package/mcp-server/dist/services/secret-gate.js +43 -0
- package/mcp-server/dist/services/secret-gate.js.map +1 -0
- package/mcp-server/dist/services/server-instructions.d.ts +10 -0
- package/mcp-server/dist/services/server-instructions.d.ts.map +1 -0
- package/mcp-server/dist/services/server-instructions.js +101 -0
- package/mcp-server/dist/services/server-instructions.js.map +1 -0
- package/mcp-server/dist/services/sqlite.d.ts +235 -0
- package/mcp-server/dist/services/sqlite.d.ts.map +1 -0
- package/mcp-server/dist/services/sqlite.js +1185 -0
- package/mcp-server/dist/services/sqlite.js.map +1 -0
- package/mcp-server/dist/services/typesafe-bench.d.ts +99 -0
- package/mcp-server/dist/services/typesafe-bench.d.ts.map +1 -0
- package/mcp-server/dist/services/typesafe-bench.js +218 -0
- package/mcp-server/dist/services/typesafe-bench.js.map +1 -0
- package/mcp-server/dist/services/typesafe-config.d.ts +342 -0
- package/mcp-server/dist/services/typesafe-config.d.ts.map +1 -0
- package/mcp-server/dist/services/typesafe-config.js +746 -0
- package/mcp-server/dist/services/typesafe-config.js.map +1 -0
- package/mcp-server/dist/services/typesafe.d.ts +213 -0
- package/mcp-server/dist/services/typesafe.d.ts.map +1 -0
- package/mcp-server/dist/services/typesafe.js +330 -0
- package/mcp-server/dist/services/typesafe.js.map +1 -0
- package/mcp-server/dist/services/vector-cache.d.ts +68 -0
- package/mcp-server/dist/services/vector-cache.d.ts.map +1 -0
- package/mcp-server/dist/services/vector-cache.js +271 -0
- package/mcp-server/dist/services/vector-cache.js.map +1 -0
- package/mcp-server/dist/services/whiteboard-geometry.d.ts +305 -0
- package/mcp-server/dist/services/whiteboard-geometry.d.ts.map +1 -0
- package/mcp-server/dist/services/whiteboard-geometry.js +666 -0
- package/mcp-server/dist/services/whiteboard-geometry.js.map +1 -0
- package/mcp-server/dist/tools/agents.d.ts +212 -0
- package/mcp-server/dist/tools/agents.d.ts.map +1 -0
- package/mcp-server/dist/tools/agents.js +407 -0
- package/mcp-server/dist/tools/agents.js.map +1 -0
- package/mcp-server/dist/tools/bluesky.d.ts +39 -0
- package/mcp-server/dist/tools/bluesky.d.ts.map +1 -0
- package/mcp-server/dist/tools/bluesky.js +1144 -0
- package/mcp-server/dist/tools/bluesky.js.map +1 -0
- package/mcp-server/dist/tools/browser-advanced.d.ts +58 -0
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-advanced.js +106 -0
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -0
- package/mcp-server/dist/tools/browser-batch.d.ts +99 -0
- package/mcp-server/dist/tools/browser-batch.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-batch.js +187 -0
- package/mcp-server/dist/tools/browser-batch.js.map +1 -0
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts +21 -0
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-cheatsheet.js +144 -0
- package/mcp-server/dist/tools/browser-cheatsheet.js.map +1 -0
- package/mcp-server/dist/tools/browser-interact.d.ts +239 -0
- package/mcp-server/dist/tools/browser-interact.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-interact.js +300 -0
- package/mcp-server/dist/tools/browser-interact.js.map +1 -0
- package/mcp-server/dist/tools/browser-navigate.d.ts +90 -0
- package/mcp-server/dist/tools/browser-navigate.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-navigate.js +142 -0
- package/mcp-server/dist/tools/browser-navigate.js.map +1 -0
- package/mcp-server/dist/tools/browser-observe.d.ts +561 -0
- package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-observe.js +2009 -0
- package/mcp-server/dist/tools/browser-observe.js.map +1 -0
- package/mcp-server/dist/tools/browser.d.ts +34 -0
- package/mcp-server/dist/tools/browser.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser.js +112 -0
- package/mcp-server/dist/tools/browser.js.map +1 -0
- package/mcp-server/dist/tools/card-tools.d.ts +82 -0
- package/mcp-server/dist/tools/card-tools.d.ts.map +1 -0
- package/mcp-server/dist/tools/card-tools.js +137 -0
- package/mcp-server/dist/tools/card-tools.js.map +1 -0
- package/mcp-server/dist/tools/card.d.ts +8 -0
- package/mcp-server/dist/tools/card.d.ts.map +1 -0
- package/mcp-server/dist/tools/card.js +16 -0
- package/mcp-server/dist/tools/card.js.map +1 -0
- package/mcp-server/dist/tools/category.d.ts +32 -0
- package/mcp-server/dist/tools/category.d.ts.map +1 -0
- package/mcp-server/dist/tools/category.js +290 -0
- package/mcp-server/dist/tools/category.js.map +1 -0
- package/mcp-server/dist/tools/choice.d.ts +160 -0
- package/mcp-server/dist/tools/choice.d.ts.map +1 -0
- package/mcp-server/dist/tools/choice.js +80 -0
- package/mcp-server/dist/tools/choice.js.map +1 -0
- package/mcp-server/dist/tools/computer.d.ts +71 -0
- package/mcp-server/dist/tools/computer.d.ts.map +1 -0
- package/mcp-server/dist/tools/computer.js +174 -0
- package/mcp-server/dist/tools/computer.js.map +1 -0
- package/mcp-server/dist/tools/discord-channel.d.ts +44 -0
- package/mcp-server/dist/tools/discord-channel.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord-channel.js +236 -0
- package/mcp-server/dist/tools/discord-channel.js.map +1 -0
- package/mcp-server/dist/tools/discord-guild.d.ts +20 -0
- package/mcp-server/dist/tools/discord-guild.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord-guild.js +138 -0
- package/mcp-server/dist/tools/discord-guild.js.map +1 -0
- package/mcp-server/dist/tools/discord-member.d.ts +26 -0
- package/mcp-server/dist/tools/discord-member.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord-member.js +122 -0
- package/mcp-server/dist/tools/discord-member.js.map +1 -0
- package/mcp-server/dist/tools/discord-message.d.ts +36 -0
- package/mcp-server/dist/tools/discord-message.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord-message.js +184 -0
- package/mcp-server/dist/tools/discord-message.js.map +1 -0
- package/mcp-server/dist/tools/discord-onboarding.d.ts +32 -0
- package/mcp-server/dist/tools/discord-onboarding.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord-onboarding.js +179 -0
- package/mcp-server/dist/tools/discord-onboarding.js.map +1 -0
- package/mcp-server/dist/tools/discord-role.d.ts +34 -0
- package/mcp-server/dist/tools/discord-role.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord-role.js +178 -0
- package/mcp-server/dist/tools/discord-role.js.map +1 -0
- package/mcp-server/dist/tools/discord-thread.d.ts +28 -0
- package/mcp-server/dist/tools/discord-thread.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord-thread.js +88 -0
- package/mcp-server/dist/tools/discord-thread.js.map +1 -0
- package/mcp-server/dist/tools/discord-webhook.d.ts +32 -0
- package/mcp-server/dist/tools/discord-webhook.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord-webhook.js +154 -0
- package/mcp-server/dist/tools/discord-webhook.js.map +1 -0
- package/mcp-server/dist/tools/discord.d.ts +7 -0
- package/mcp-server/dist/tools/discord.d.ts.map +1 -0
- package/mcp-server/dist/tools/discord.js +25 -0
- package/mcp-server/dist/tools/discord.js.map +1 -0
- package/mcp-server/dist/tools/fb-groups.d.ts +98 -0
- package/mcp-server/dist/tools/fb-groups.d.ts.map +1 -0
- package/mcp-server/dist/tools/fb-groups.js +369 -0
- package/mcp-server/dist/tools/fb-groups.js.map +1 -0
- package/mcp-server/dist/tools/forget.d.ts +14 -0
- package/mcp-server/dist/tools/forget.d.ts.map +1 -0
- package/mcp-server/dist/tools/forget.js +26 -0
- package/mcp-server/dist/tools/forget.js.map +1 -0
- package/mcp-server/dist/tools/git-tools.d.ts +24 -0
- package/mcp-server/dist/tools/git-tools.d.ts.map +1 -0
- package/mcp-server/dist/tools/git-tools.js +107 -0
- package/mcp-server/dist/tools/git-tools.js.map +1 -0
- package/mcp-server/dist/tools/git.d.ts +7 -0
- package/mcp-server/dist/tools/git.d.ts.map +1 -0
- package/mcp-server/dist/tools/git.js +11 -0
- package/mcp-server/dist/tools/git.js.map +1 -0
- package/mcp-server/dist/tools/gsc/experience.d.ts +135 -0
- package/mcp-server/dist/tools/gsc/experience.d.ts.map +1 -0
- package/mcp-server/dist/tools/gsc/experience.js +351 -0
- package/mcp-server/dist/tools/gsc/experience.js.map +1 -0
- package/mcp-server/dist/tools/gsc/helpers.d.ts +78 -0
- package/mcp-server/dist/tools/gsc/helpers.d.ts.map +1 -0
- package/mcp-server/dist/tools/gsc/helpers.js +258 -0
- package/mcp-server/dist/tools/gsc/helpers.js.map +1 -0
- package/mcp-server/dist/tools/gsc/indexing.d.ts +121 -0
- package/mcp-server/dist/tools/gsc/indexing.d.ts.map +1 -0
- package/mcp-server/dist/tools/gsc/indexing.js +357 -0
- package/mcp-server/dist/tools/gsc/indexing.js.map +1 -0
- package/mcp-server/dist/tools/gsc/inspect.d.ts +78 -0
- package/mcp-server/dist/tools/gsc/inspect.d.ts.map +1 -0
- package/mcp-server/dist/tools/gsc/inspect.js +321 -0
- package/mcp-server/dist/tools/gsc/inspect.js.map +1 -0
- package/mcp-server/dist/tools/gsc/navigate.d.ts +44 -0
- package/mcp-server/dist/tools/gsc/navigate.d.ts.map +1 -0
- package/mcp-server/dist/tools/gsc/navigate.js +197 -0
- package/mcp-server/dist/tools/gsc/navigate.js.map +1 -0
- package/mcp-server/dist/tools/gsc/performance.d.ts +84 -0
- package/mcp-server/dist/tools/gsc/performance.d.ts.map +1 -0
- package/mcp-server/dist/tools/gsc/performance.js +274 -0
- package/mcp-server/dist/tools/gsc/performance.js.map +1 -0
- package/mcp-server/dist/tools/gsc/settings.d.ts +153 -0
- package/mcp-server/dist/tools/gsc/settings.d.ts.map +1 -0
- package/mcp-server/dist/tools/gsc/settings.js +425 -0
- package/mcp-server/dist/tools/gsc/settings.js.map +1 -0
- package/mcp-server/dist/tools/gsc.d.ts +7 -0
- package/mcp-server/dist/tools/gsc.d.ts.map +1 -0
- package/mcp-server/dist/tools/gsc.js +51 -0
- package/mcp-server/dist/tools/gsc.js.map +1 -0
- package/mcp-server/dist/tools/image-tools.d.ts +24 -0
- package/mcp-server/dist/tools/image-tools.d.ts.map +1 -0
- package/mcp-server/dist/tools/image-tools.js +80 -0
- package/mcp-server/dist/tools/image-tools.js.map +1 -0
- package/mcp-server/dist/tools/image.d.ts +10 -0
- package/mcp-server/dist/tools/image.d.ts.map +1 -0
- package/mcp-server/dist/tools/image.js +14 -0
- package/mcp-server/dist/tools/image.js.map +1 -0
- package/mcp-server/dist/tools/leonardo-browser-tools.d.ts +97 -0
- package/mcp-server/dist/tools/leonardo-browser-tools.d.ts.map +1 -0
- package/mcp-server/dist/tools/leonardo-browser-tools.js +228 -0
- package/mcp-server/dist/tools/leonardo-browser-tools.js.map +1 -0
- package/mcp-server/dist/tools/leonardo.d.ts +13 -0
- package/mcp-server/dist/tools/leonardo.d.ts.map +1 -0
- package/mcp-server/dist/tools/leonardo.js +21 -0
- package/mcp-server/dist/tools/leonardo.js.map +1 -0
- package/mcp-server/dist/tools/loop.d.ts +30 -0
- package/mcp-server/dist/tools/loop.d.ts.map +1 -0
- package/mcp-server/dist/tools/loop.js +401 -0
- package/mcp-server/dist/tools/loop.js.map +1 -0
- package/mcp-server/dist/tools/memories.d.ts +56 -0
- package/mcp-server/dist/tools/memories.d.ts.map +1 -0
- package/mcp-server/dist/tools/memories.js +171 -0
- package/mcp-server/dist/tools/memories.js.map +1 -0
- package/mcp-server/dist/tools/morelogin.d.ts +24 -0
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -0
- package/mcp-server/dist/tools/morelogin.js +79 -0
- package/mcp-server/dist/tools/morelogin.js.map +1 -0
- package/mcp-server/dist/tools/profile.d.ts +17 -0
- package/mcp-server/dist/tools/profile.d.ts.map +1 -0
- package/mcp-server/dist/tools/profile.js +114 -0
- package/mcp-server/dist/tools/profile.js.map +1 -0
- package/mcp-server/dist/tools/recall.d.ts +71 -0
- package/mcp-server/dist/tools/recall.d.ts.map +1 -0
- package/mcp-server/dist/tools/recall.js +147 -0
- package/mcp-server/dist/tools/recall.js.map +1 -0
- package/mcp-server/dist/tools/reflect.d.ts +56 -0
- package/mcp-server/dist/tools/reflect.d.ts.map +1 -0
- package/mcp-server/dist/tools/reflect.js +157 -0
- package/mcp-server/dist/tools/reflect.js.map +1 -0
- package/mcp-server/dist/tools/remember.d.ts +62 -0
- package/mcp-server/dist/tools/remember.d.ts.map +1 -0
- package/mcp-server/dist/tools/remember.js +201 -0
- package/mcp-server/dist/tools/remember.js.map +1 -0
- package/mcp-server/dist/tools/response.d.ts +23 -0
- package/mcp-server/dist/tools/response.d.ts.map +1 -0
- package/mcp-server/dist/tools/response.js +24 -0
- package/mcp-server/dist/tools/response.js.map +1 -0
- package/mcp-server/dist/tools/restore.d.ts +14 -0
- package/mcp-server/dist/tools/restore.d.ts.map +1 -0
- package/mcp-server/dist/tools/restore.js +23 -0
- package/mcp-server/dist/tools/restore.js.map +1 -0
- package/mcp-server/dist/tools/style-guide-tools.d.ts +51 -0
- package/mcp-server/dist/tools/style-guide-tools.d.ts.map +1 -0
- package/mcp-server/dist/tools/style-guide-tools.js +231 -0
- package/mcp-server/dist/tools/style-guide-tools.js.map +1 -0
- package/mcp-server/dist/tools/style-guide.d.ts +8 -0
- package/mcp-server/dist/tools/style-guide.d.ts.map +1 -0
- package/mcp-server/dist/tools/style-guide.js +12 -0
- package/mcp-server/dist/tools/style-guide.js.map +1 -0
- package/mcp-server/dist/tools/sync.d.ts +20 -0
- package/mcp-server/dist/tools/sync.d.ts.map +1 -0
- package/mcp-server/dist/tools/sync.js +156 -0
- package/mcp-server/dist/tools/sync.js.map +1 -0
- package/mcp-server/dist/tools/tictactoe-tools.d.ts +18 -0
- package/mcp-server/dist/tools/tictactoe-tools.d.ts.map +1 -0
- package/mcp-server/dist/tools/tictactoe-tools.js +78 -0
- package/mcp-server/dist/tools/tictactoe-tools.js.map +1 -0
- package/mcp-server/dist/tools/tictactoe.d.ts +7 -0
- package/mcp-server/dist/tools/tictactoe.d.ts.map +1 -0
- package/mcp-server/dist/tools/tictactoe.js +11 -0
- package/mcp-server/dist/tools/tictactoe.js.map +1 -0
- package/mcp-server/dist/tools/utils.d.ts +19 -0
- package/mcp-server/dist/tools/utils.d.ts.map +1 -0
- package/mcp-server/dist/tools/utils.js +54 -0
- package/mcp-server/dist/tools/utils.js.map +1 -0
- package/mcp-server/dist/tools/whiteboard-format.d.ts +88 -0
- package/mcp-server/dist/tools/whiteboard-format.d.ts.map +1 -0
- package/mcp-server/dist/tools/whiteboard-format.js +337 -0
- package/mcp-server/dist/tools/whiteboard-format.js.map +1 -0
- package/mcp-server/dist/tools/whiteboard-tools.d.ts +326 -0
- package/mcp-server/dist/tools/whiteboard-tools.d.ts.map +1 -0
- package/mcp-server/dist/tools/whiteboard-tools.js +222 -0
- package/mcp-server/dist/tools/whiteboard-tools.js.map +1 -0
- package/mcp-server/dist/tools/whiteboard.d.ts +8 -0
- package/mcp-server/dist/tools/whiteboard.d.ts.map +1 -0
- package/mcp-server/dist/tools/whiteboard.js +16 -0
- package/mcp-server/dist/tools/whiteboard.js.map +1 -0
- package/mcp-server/dist/tools/youtube/analytics.d.ts +46 -0
- package/mcp-server/dist/tools/youtube/analytics.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/analytics.js +83 -0
- package/mcp-server/dist/tools/youtube/analytics.js.map +1 -0
- package/mcp-server/dist/tools/youtube/dedup.d.ts +35 -0
- package/mcp-server/dist/tools/youtube/dedup.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/dedup.js +56 -0
- package/mcp-server/dist/tools/youtube/dedup.js.map +1 -0
- package/mcp-server/dist/tools/youtube/download.d.ts +31 -0
- package/mcp-server/dist/tools/youtube/download.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/download.js +30 -0
- package/mcp-server/dist/tools/youtube/download.js.map +1 -0
- package/mcp-server/dist/tools/youtube/helpers.d.ts +66 -0
- package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/helpers.js +143 -0
- package/mcp-server/dist/tools/youtube/helpers.js.map +1 -0
- package/mcp-server/dist/tools/youtube/media.d.ts +43 -0
- package/mcp-server/dist/tools/youtube/media.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/media.js +97 -0
- package/mcp-server/dist/tools/youtube/media.js.map +1 -0
- package/mcp-server/dist/tools/youtube/metadata.d.ts +33 -0
- package/mcp-server/dist/tools/youtube/metadata.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/metadata.js +106 -0
- package/mcp-server/dist/tools/youtube/metadata.js.map +1 -0
- package/mcp-server/dist/tools/youtube/navigate.d.ts +30 -0
- package/mcp-server/dist/tools/youtube/navigate.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/navigate.js +71 -0
- package/mcp-server/dist/tools/youtube/navigate.js.map +1 -0
- package/mcp-server/dist/tools/youtube/playlist.d.ts +29 -0
- package/mcp-server/dist/tools/youtube/playlist.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/playlist.js +128 -0
- package/mcp-server/dist/tools/youtube/playlist.js.map +1 -0
- package/mcp-server/dist/tools/youtube/schedule.d.ts +31 -0
- package/mcp-server/dist/tools/youtube/schedule.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/schedule.js +147 -0
- package/mcp-server/dist/tools/youtube/schedule.js.map +1 -0
- package/mcp-server/dist/tools/youtube/source.d.ts +36 -0
- package/mcp-server/dist/tools/youtube/source.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/source.js +85 -0
- package/mcp-server/dist/tools/youtube/source.js.map +1 -0
- package/mcp-server/dist/tools/youtube/upload.d.ts +53 -0
- package/mcp-server/dist/tools/youtube/upload.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube/upload.js +255 -0
- package/mcp-server/dist/tools/youtube/upload.js.map +1 -0
- package/mcp-server/dist/tools/youtube.d.ts +12 -0
- package/mcp-server/dist/tools/youtube.d.ts.map +1 -0
- package/mcp-server/dist/tools/youtube.js +38 -0
- package/mcp-server/dist/tools/youtube.js.map +1 -0
- package/mcp-server/dist/tui.d.ts +3 -0
- package/mcp-server/dist/tui.d.ts.map +1 -0
- package/mcp-server/dist/tui.js +806 -0
- package/mcp-server/dist/tui.js.map +1 -0
- package/mcp-server/dist/types.d.ts +77 -0
- package/mcp-server/dist/types.d.ts.map +1 -0
- package/mcp-server/dist/types.js +2 -0
- package/mcp-server/dist/types.js.map +1 -0
- package/mcp-server/package-lock.json +4798 -0
- package/mcp-server/package.json +55 -38
- package/mcp-server/run.mjs +12 -2
- package/mcp-server/src/config.ts +48 -3
- package/mcp-server/src/http.ts +296 -93
- package/mcp-server/src/index.ts +546 -203
- package/mcp-server/src/preload-http.ts +19 -18
- package/mcp-server/src/preload.ts +19 -18
- package/mcp-server/src/scripts/setup-embeddings.ts +9 -0
- package/mcp-server/src/services/assistant-judgments.ts +157 -0
- package/mcp-server/src/services/browser-assist-gate.ts +383 -0
- package/mcp-server/src/services/browser-assist.ts +267 -0
- package/mcp-server/src/services/browser-bench.ts +477 -0
- package/mcp-server/src/services/browser-judgments.ts +414 -0
- package/mcp-server/src/services/browser-risk.ts +484 -0
- package/mcp-server/src/services/categories.ts +36 -19
- package/mcp-server/src/services/codex-config-heal.ts +403 -0
- package/mcp-server/src/services/desktop-assist-gate.ts +251 -0
- package/mcp-server/src/services/desktop-assist.ts +308 -0
- package/mcp-server/src/services/desktop-bench.ts +372 -0
- package/mcp-server/src/services/desktop-client.ts +76 -0
- package/mcp-server/src/services/desktop-judgments.ts +218 -0
- package/mcp-server/src/services/desktop-risk.ts +743 -0
- package/mcp-server/src/services/edit-stale.ts +299 -0
- package/mcp-server/src/services/embedding-service.ts +108 -0
- package/mcp-server/src/services/embedding-worker.ts +46 -0
- package/mcp-server/src/services/fb-regions.ts +221 -0
- package/mcp-server/src/services/file-checksums.ts +26 -9
- package/mcp-server/src/services/file-excerpt.ts +59 -0
- package/mcp-server/src/services/identity.ts +291 -0
- package/mcp-server/src/services/local-embeddings.ts +2 -77
- package/mcp-server/src/services/memory-client.ts +23 -0
- package/mcp-server/src/services/memory-judge-backfill.ts +462 -0
- package/mcp-server/src/services/memory-judgments.ts +901 -0
- package/mcp-server/src/services/memory-maintenance.ts +360 -0
- package/mcp-server/src/services/memory-retrieval.ts +349 -0
- package/mcp-server/src/services/memory-schema.ts +280 -0
- package/mcp-server/src/services/memory-sessions.ts +87 -0
- package/mcp-server/src/services/memory-triage.ts +182 -0
- package/mcp-server/src/services/memory-verification.ts +68 -0
- package/mcp-server/src/services/memory-writer.ts +125 -0
- package/mcp-server/src/services/neural-interface.ts +1217 -73
- package/mcp-server/src/services/profiles.ts +428 -0
- package/mcp-server/src/services/secret-gate.ts +52 -0
- package/mcp-server/src/services/server-instructions.ts +122 -0
- package/mcp-server/src/services/sqlite.ts +1456 -823
- package/mcp-server/src/services/typesafe-bench.ts +247 -0
- package/mcp-server/src/services/typesafe-config.ts +790 -0
- package/mcp-server/src/services/typesafe.ts +390 -0
- package/mcp-server/src/services/vector-cache.ts +255 -0
- package/mcp-server/src/services/whiteboard-geometry.ts +711 -0
- package/mcp-server/src/tools/agents.ts +539 -0
- package/mcp-server/src/tools/bluesky.ts +1186 -0
- package/mcp-server/src/tools/browser-advanced.ts +15 -6
- package/mcp-server/src/tools/browser-batch.ts +178 -0
- package/mcp-server/src/tools/browser-cheatsheet.ts +155 -0
- package/mcp-server/src/tools/browser-interact.ts +362 -255
- package/mcp-server/src/tools/browser-navigate.ts +164 -77
- package/mcp-server/src/tools/browser-observe.ts +2222 -1330
- package/mcp-server/src/tools/browser.ts +181 -107
- package/mcp-server/src/tools/card.ts +7 -5
- package/mcp-server/src/tools/choice.ts +103 -0
- package/mcp-server/src/tools/computer.ts +190 -0
- package/mcp-server/src/tools/discord.ts +10 -23
- package/mcp-server/src/tools/fb-groups.ts +387 -0
- package/mcp-server/src/tools/forget.ts +1 -1
- package/mcp-server/src/tools/git.ts +3 -1
- package/mcp-server/src/tools/gsc/experience.ts +440 -0
- package/mcp-server/src/tools/gsc/helpers.ts +288 -0
- package/mcp-server/src/tools/gsc/indexing.ts +495 -0
- package/mcp-server/src/tools/gsc/inspect.ts +391 -0
- package/mcp-server/src/tools/gsc/navigate.ts +236 -0
- package/mcp-server/src/tools/gsc/performance.ts +352 -0
- package/mcp-server/src/tools/gsc/settings.ts +564 -0
- package/mcp-server/src/tools/gsc.ts +95 -0
- package/mcp-server/src/tools/image.ts +3 -1
- package/mcp-server/src/tools/leonardo-browser-tools.ts +47 -37
- package/mcp-server/src/tools/leonardo.ts +7 -5
- package/mcp-server/src/tools/loop.ts +118 -25
- package/mcp-server/src/tools/memories.ts +65 -5
- package/mcp-server/src/tools/morelogin.ts +81 -0
- package/mcp-server/src/tools/profile.ts +122 -0
- package/mcp-server/src/tools/recall.ts +105 -261
- package/mcp-server/src/tools/reflect.ts +171 -145
- package/mcp-server/src/tools/remember.ts +223 -115
- package/mcp-server/src/tools/style-guide-tools.ts +250 -0
- package/mcp-server/src/tools/style-guide.ts +16 -0
- package/mcp-server/src/tools/sync.ts +66 -9
- package/mcp-server/src/tools/tictactoe.ts +3 -1
- package/mcp-server/src/tools/utils.ts +22 -0
- package/mcp-server/src/tools/whiteboard-format.ts +394 -0
- package/mcp-server/src/tools/whiteboard-tools.ts +191 -183
- package/mcp-server/src/tools/whiteboard.ts +7 -5
- package/mcp-server/src/tools/youtube/analytics.ts +106 -0
- package/mcp-server/src/tools/youtube/dedup.ts +57 -0
- package/mcp-server/src/tools/youtube/download.ts +41 -0
- package/mcp-server/src/tools/youtube/helpers.ts +183 -0
- package/mcp-server/src/tools/youtube/media.ts +109 -0
- package/mcp-server/src/tools/youtube/metadata.ts +112 -0
- package/mcp-server/src/tools/youtube/navigate.ts +81 -0
- package/mcp-server/src/tools/youtube/playlist.ts +134 -0
- package/mcp-server/src/tools/youtube/schedule.ts +158 -0
- package/mcp-server/src/tools/youtube/source.ts +101 -0
- package/mcp-server/src/tools/youtube/upload.ts +296 -0
- package/mcp-server/src/tools/youtube.ts +47 -0
- package/mcp-server/src/tui.ts +8 -9
- package/neural-interface/games/TicTacToe/1.svg +1 -0
- package/neural-interface/games/TicTacToe/2.svg +1 -0
- package/neural-interface/games/TicTacToe/3.svg +1 -0
- package/neural-interface/games/TicTacToe/4.svg +1 -0
- package/neural-interface/games/TicTacToe/5.svg +1 -0
- package/neural-interface/games/TicTacToe/6.svg +1 -0
- package/neural-interface/games/TicTacToe/7.svg +1 -0
- package/neural-interface/games/TicTacToe/8.svg +1 -0
- package/neural-interface/games/TicTacToe/9.svg +1 -0
- package/neural-interface/games/TicTacToe/Board.svg +1 -0
- package/neural-interface/games/TicTacToe/Circle.svg +1 -0
- package/neural-interface/games/TicTacToe/Cross.svg +1 -0
- package/neural-interface/i18n/en.json +6983 -0
- package/neural-interface/i18n/pt-BR.json +6987 -0
- package/neural-interface/lib/assistant-api.js +1005 -0
- package/neural-interface/lib/assistant-attachments.js +121 -0
- package/neural-interface/lib/assistant-brains/claude.js +207 -0
- package/neural-interface/lib/assistant-brains/codex-browser-policy-hook.mjs +43 -0
- package/neural-interface/lib/assistant-brains/codex-route-gate-hook.mjs +56 -0
- package/neural-interface/lib/assistant-brains/codex.js +213 -0
- package/neural-interface/lib/assistant-brains/opencode-browser-policy.js +47 -0
- package/neural-interface/lib/assistant-brains/opencode-route-gate.js +62 -0
- package/neural-interface/lib/assistant-brains/opencode.js +320 -0
- package/neural-interface/lib/assistant-budget.js +318 -0
- package/neural-interface/lib/assistant-catalog.js +731 -0
- package/neural-interface/lib/assistant-clarify.js +664 -0
- package/neural-interface/lib/assistant-config.js +232 -0
- package/neural-interface/lib/assistant-dispatch.js +2744 -0
- package/neural-interface/lib/assistant-envelope.js +579 -0
- package/neural-interface/lib/assistant-evidence.js +236 -0
- package/neural-interface/lib/assistant-hidden-models.js +272 -0
- package/neural-interface/lib/assistant-jev.js +117 -0
- package/neural-interface/lib/assistant-judgments.js +111 -0
- package/neural-interface/lib/assistant-media.js +335 -0
- package/neural-interface/lib/assistant-memory.js +398 -0
- package/neural-interface/lib/assistant-persona.js +444 -0
- package/neural-interface/lib/assistant-plan-permissions.js +448 -0
- package/neural-interface/lib/assistant-playbooks/design.md +87 -0
- package/neural-interface/lib/assistant-playbooks.js +72 -0
- package/neural-interface/lib/assistant-pricing.js +159 -0
- package/neural-interface/lib/assistant-route-gate-codex.js +163 -0
- package/neural-interface/lib/assistant-route-gate.js +212 -0
- package/neural-interface/lib/assistant-router.js +1324 -0
- package/neural-interface/lib/assistant-runtime.js +3337 -0
- package/neural-interface/lib/assistant-task-prompt.js +472 -0
- package/neural-interface/lib/assistant-usage.js +1688 -0
- package/neural-interface/lib/augmented-path.js +50 -0
- package/neural-interface/lib/automation-storage-migration.js +54 -0
- package/neural-interface/lib/backup-service.js +851 -0
- package/neural-interface/lib/backup-zip-reader.js +262 -0
- package/neural-interface/lib/browser-assist-api.js +41 -0
- package/neural-interface/lib/browser-console.js +176 -0
- package/neural-interface/lib/browser-execution.js +241 -0
- package/neural-interface/lib/browser-extraction.js +191 -0
- package/neural-interface/lib/browser-screenshot.js +399 -0
- package/neural-interface/lib/browser-semantic-context.js +639 -0
- package/neural-interface/lib/browser-snapshots.js +192 -0
- package/neural-interface/lib/browser-tab-recovery.js +119 -0
- package/neural-interface/lib/browser-targets.js +70 -0
- package/neural-interface/lib/browser-tool-policy.js +926 -0
- package/neural-interface/lib/claude-accounts.js +230 -0
- package/neural-interface/lib/claude-agent-bridge.js +3296 -0
- package/neural-interface/lib/claude-bypass-policy.js +99 -0
- package/neural-interface/lib/claude-history.js +429 -0
- package/neural-interface/lib/claude-model-catalog.js +483 -0
- package/neural-interface/lib/claude-panel-requests.js +165 -0
- package/neural-interface/lib/claude-panel-session.js +272 -0
- package/neural-interface/lib/claude-permission-rules.js +153 -0
- package/neural-interface/lib/claude-session-cleanup.js +71 -0
- package/neural-interface/lib/claude-session-list.js +82 -0
- package/neural-interface/lib/claude-session-ops.js +140 -0
- package/neural-interface/lib/claude-settings-view.js +51 -0
- package/neural-interface/lib/claude-skin-connect.js +79 -0
- package/neural-interface/lib/claude-stall-policy.js +7 -0
- package/neural-interface/lib/claude-temporary.js +435 -0
- package/neural-interface/lib/cli-update-planner.js +312 -0
- package/neural-interface/lib/codex-capabilities.d.ts +41 -0
- package/neural-interface/lib/codex-capabilities.js +148 -0
- package/neural-interface/lib/codex-collaboration-mode.js +17 -0
- package/neural-interface/lib/codex-compat-rpc.js +241 -0
- package/neural-interface/lib/codex-mcp-approvals.js +56 -0
- package/neural-interface/lib/codex-mcp-apps.js +47 -0
- package/neural-interface/lib/codex-model-context.js +202 -0
- package/neural-interface/lib/codex-plan-store.js +71 -0
- package/neural-interface/lib/codex-request-journal.js +242 -0
- package/neural-interface/lib/codex-runtime-path.js +213 -0
- package/neural-interface/lib/codex-session-catalog.js +231 -0
- package/neural-interface/lib/codex-session-settings.js +46 -0
- package/neural-interface/lib/codex-sidepanel-permissions.js +110 -0
- package/neural-interface/lib/codex-thread-history.js +165 -0
- package/neural-interface/lib/codex-user-verification.js +34 -0
- package/neural-interface/lib/codex-writer-lifecycle.js +152 -0
- package/neural-interface/lib/confined-fs.js +256 -0
- package/neural-interface/lib/db.js +922 -0
- package/neural-interface/lib/design-md.js +9 -0
- package/neural-interface/lib/desktop/api.js +92 -0
- package/neural-interface/lib/desktop/audit.js +62 -0
- package/neural-interface/lib/desktop/build.js +423 -0
- package/neural-interface/lib/desktop/config.js +606 -0
- package/neural-interface/lib/desktop/coords.js +76 -0
- package/neural-interface/lib/desktop/fake-helper.js +1192 -0
- package/neural-interface/lib/desktop/frames.js +77 -0
- package/neural-interface/lib/desktop/grants.js +84 -0
- package/neural-interface/lib/desktop/guards.js +170 -0
- package/neural-interface/lib/desktop/helper/SynabunDesktop.swift +3056 -0
- package/neural-interface/lib/desktop/lease.js +51 -0
- package/neural-interface/lib/desktop/manager.js +545 -0
- package/neural-interface/lib/desktop/press-contexts.js +103 -0
- package/neural-interface/lib/desktop/protocol.js +495 -0
- package/neural-interface/lib/desktop/service.js +1202 -0
- package/neural-interface/lib/effort-levels.js +148 -0
- package/neural-interface/lib/event-loop-monitor.js +67 -0
- package/neural-interface/lib/exec-loop-command.js +209 -0
- package/neural-interface/lib/folder-picker.ps1 +77 -0
- package/neural-interface/lib/http-guards.js +287 -0
- package/neural-interface/lib/jsonl-lines.js +94 -0
- package/neural-interface/lib/loop-logger.js +127 -0
- package/neural-interface/lib/mcp-client-config.js +133 -0
- package/neural-interface/lib/mcp-installer.js +487 -0
- package/neural-interface/lib/mcp-profile-refresh-coordinator.js +78 -0
- package/neural-interface/lib/mcp-profile-servers.js +120 -0
- package/neural-interface/lib/memo-cache.js +84 -0
- package/neural-interface/lib/memory-api.js +758 -0
- package/neural-interface/lib/memory-map-api.js +1150 -0
- package/neural-interface/lib/memory-map-layout.js +872 -0
- package/neural-interface/lib/memory-map-worker.js +165 -0
- package/neural-interface/lib/memory-session-capture.js +81 -0
- package/neural-interface/lib/memory-timers.js +62 -0
- package/neural-interface/lib/morelogin.js +301 -0
- package/neural-interface/lib/native-binary-runtime.js +650 -0
- package/neural-interface/lib/native-loop-goal.js +33 -0
- package/neural-interface/lib/native-loop-providers.js +1016 -0
- package/neural-interface/lib/native-loop-runtime.js +747 -0
- package/neural-interface/lib/opencode-hidden-models.js +113 -0
- package/neural-interface/lib/opencode-history.js +253 -0
- package/neural-interface/lib/opencode-runtime-config.js +58 -0
- package/neural-interface/lib/opencode-v2-client.js +486 -0
- package/neural-interface/lib/opencode-v2-ws-requests.js +955 -0
- package/neural-interface/lib/path-confine.js +213 -0
- package/neural-interface/lib/plugin-installer.js +264 -0
- package/neural-interface/lib/project-storage.js +766 -0
- package/neural-interface/lib/pty-host/core.js +603 -0
- package/neural-interface/lib/pty-host/flow.js +43 -0
- package/neural-interface/lib/pty-host/host.js +47 -0
- package/neural-interface/lib/pty-host/manager.js +360 -0
- package/neural-interface/lib/pty-host/protocol.js +81 -0
- package/neural-interface/lib/pty-host/snapshot.js +133 -0
- package/neural-interface/lib/remote-policy.js +582 -0
- package/neural-interface/lib/rulesets/api.js +175 -0
- package/neural-interface/lib/rulesets/fs-safe.js +245 -0
- package/neural-interface/lib/rulesets/installer.js +1453 -0
- package/neural-interface/lib/rulesets/json-edit.js +186 -0
- package/neural-interface/lib/rulesets/lock.js +170 -0
- package/neural-interface/lib/rulesets/managed-text.js +314 -0
- package/neural-interface/lib/rulesets/normalise.js +24 -0
- package/neural-interface/lib/rulesets/render.js +84 -0
- package/neural-interface/lib/schedule-launch-intent.js +40 -0
- package/neural-interface/lib/session-cache-builder.js +524 -0
- package/neural-interface/lib/session-chunker.js +344 -0
- package/neural-interface/lib/session-indexer.js +327 -0
- package/neural-interface/lib/session-title-generator.js +227 -0
- package/neural-interface/lib/skill-prompt-bridge.js +11 -0
- package/neural-interface/lib/style-guide/api.js +375 -0
- package/neural-interface/lib/style-guide/color.js +352 -0
- package/neural-interface/lib/style-guide/export-css.js +99 -0
- package/neural-interface/lib/style-guide/export-dtcg.js +209 -0
- package/neural-interface/lib/style-guide/export-tailwind.js +102 -0
- package/neural-interface/lib/style-guide/fonts.json +227 -0
- package/neural-interface/lib/style-guide/import.js +1268 -0
- package/neural-interface/lib/style-guide/pointers.js +103 -0
- package/neural-interface/lib/style-guide/presets.js +232 -0
- package/neural-interface/lib/style-guide/render-design-md.js +319 -0
- package/neural-interface/lib/style-guide/schema.js +848 -0
- package/neural-interface/lib/style-guide/security.js +43 -0
- package/neural-interface/lib/style-guide/store.js +491 -0
- package/neural-interface/lib/style-guide/summary.js +106 -0
- package/neural-interface/lib/style-guide/tokens.js +170 -0
- package/neural-interface/lib/synabun-update-plan.js +305 -0
- package/neural-interface/lib/synabun-version.js +179 -0
- package/neural-interface/lib/system-restore.js +99 -0
- package/neural-interface/lib/terminal-env.js +86 -0
- package/neural-interface/lib/ui-blob-store.js +106 -0
- package/neural-interface/lib/vector-cache.js +2 -0
- package/neural-interface/lib/virtual-socket.js +60 -0
- package/neural-interface/lib/whatsapp/api.js +146 -0
- package/neural-interface/lib/whatsapp/auth-store.js +389 -0
- package/neural-interface/lib/whatsapp/baileys-adapter.js +457 -0
- package/neural-interface/lib/whatsapp/brain.js +128 -0
- package/neural-interface/lib/whatsapp/bridge.js +1499 -0
- package/neural-interface/lib/whatsapp/cards.js +519 -0
- package/neural-interface/lib/whatsapp/commands.js +92 -0
- package/neural-interface/lib/whatsapp/config.js +291 -0
- package/neural-interface/lib/whatsapp/connector/entry.mjs +25 -0
- package/neural-interface/lib/whatsapp/connector/manifest.json +6 -0
- package/neural-interface/lib/whatsapp/connector/npm-shrinkwrap.json +717 -0
- package/neural-interface/lib/whatsapp/connector/package.json +8 -0
- package/neural-interface/lib/whatsapp/fake-baileys.js +444 -0
- package/neural-interface/lib/whatsapp/format.js +552 -0
- package/neural-interface/lib/whatsapp/host-core.js +1225 -0
- package/neural-interface/lib/whatsapp/host.js +119 -0
- package/neural-interface/lib/whatsapp/identity.js +288 -0
- package/neural-interface/lib/whatsapp/inbound.js +149 -0
- package/neural-interface/lib/whatsapp/installer.js +562 -0
- package/neural-interface/lib/whatsapp/manager.js +638 -0
- package/neural-interface/lib/whatsapp/paths.js +81 -0
- package/neural-interface/lib/whatsapp/protocol.js +327 -0
- package/neural-interface/lib/whatsapp/qr-svg.js +57 -0
- package/neural-interface/lib/whatsapp/redact.js +130 -0
- package/neural-interface/lib/whatsapp/service.js +1305 -0
- package/neural-interface/lib/whatsapp/vendor/qrcodegen.js +848 -0
- package/neural-interface/package-lock.json +4682 -0
- package/neural-interface/package.json +58 -27
- package/neural-interface/public/apple-touch-icon.png +0 -0
- package/neural-interface/public/category-logos/synabun.png +0 -0
- package/neural-interface/public/claude.svg +1 -0
- package/neural-interface/public/favicon-16x16.png +0 -0
- package/neural-interface/public/favicon-32x32.png +0 -0
- package/neural-interface/public/icon-192.png +0 -0
- package/neural-interface/public/icon-512.png +0 -0
- package/neural-interface/public/index.html +32 -182
- package/neural-interface/public/index2d.html +2 -2
- package/neural-interface/public/logo-synabun.png +0 -0
- package/neural-interface/public/logoHD.png +0 -0
- package/neural-interface/public/mcp.svg +4 -0
- package/neural-interface/public/offline.html +335 -299
- package/neural-interface/public/onboarding.html +692 -155
- package/neural-interface/public/opencode-logo-dark-square.svg +1 -0
- package/neural-interface/public/shared/agent-runtime-options.js +596 -0
- package/neural-interface/public/shared/api.js +339 -28
- package/neural-interface/public/shared/assistant/asst-accounts.js +318 -0
- package/neural-interface/public/shared/assistant/asst-agents-dock.js +296 -0
- package/neural-interface/public/shared/assistant/asst-api.js +270 -0
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +744 -0
- package/neural-interface/public/shared/assistant/asst-budget.js +333 -0
- package/neural-interface/public/shared/assistant/asst-composer.js +656 -0
- package/neural-interface/public/shared/assistant/asst-computer.js +803 -0
- package/neural-interface/public/shared/assistant/asst-control.js +1018 -0
- package/neural-interface/public/shared/assistant/asst-hosts.js +262 -0
- package/neural-interface/public/shared/assistant/asst-mascot.js +311 -0
- package/neural-interface/public/shared/assistant/asst-menu.js +375 -0
- package/neural-interface/public/shared/assistant/asst-panel.js +1845 -0
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +589 -0
- package/neural-interface/public/shared/assistant/asst-render.js +3296 -0
- package/neural-interface/public/shared/assistant/asst-route.js +1653 -0
- package/neural-interface/public/shared/assistant/asst-roving.js +75 -0
- package/neural-interface/public/shared/assistant/asst-sanitize.js +117 -0
- package/neural-interface/public/shared/assistant/asst-sidepanel-styles.js +488 -0
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +675 -0
- package/neural-interface/public/shared/assistant/asst-slash.js +258 -0
- package/neural-interface/public/shared/assistant/asst-state.js +727 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +1684 -0
- package/neural-interface/public/shared/assistant/asst-tool-kinds.js +1017 -0
- package/neural-interface/public/shared/assistant/asst-usage.js +444 -0
- package/neural-interface/public/shared/assistant/asst-ws.js +175 -0
- package/neural-interface/public/shared/automation-context.js +75 -0
- package/neural-interface/public/shared/blob-store.js +99 -0
- package/neural-interface/public/shared/cdx/cdx-capabilities.js +118 -0
- package/neural-interface/public/shared/cdx/cdx-cards.js +37 -0
- package/neural-interface/public/shared/cdx/cdx-commands.js +171 -0
- package/neural-interface/public/shared/cdx/cdx-context-menu.js +402 -0
- package/neural-interface/public/shared/cdx/cdx-context-model.js +220 -0
- package/neural-interface/public/shared/cdx/cdx-features.js +408 -0
- package/neural-interface/public/shared/cdx/cdx-icons.js +89 -0
- package/neural-interface/public/shared/cdx/cdx-mcp-app-host.js +414 -0
- package/neural-interface/public/shared/cdx/cdx-mcp-app-proxy.html +6 -0
- package/neural-interface/public/shared/cdx/cdx-mcp-app-proxy.js +56 -0
- package/neural-interface/public/shared/cdx/cdx-mcp-app.js +178 -0
- package/neural-interface/public/shared/cdx/cdx-model-catalog.js +120 -0
- package/neural-interface/public/shared/cdx/cdx-output-model.js +261 -0
- package/neural-interface/public/shared/cdx/cdx-output.js +382 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +1372 -0
- package/neural-interface/public/shared/cdx/cdx-plan.js +266 -0
- package/neural-interface/public/shared/cdx/cdx-protocol.js +682 -0
- package/neural-interface/public/shared/cdx/cdx-render.js +3381 -0
- package/neural-interface/public/shared/cdx/cdx-requests.js +1136 -0
- package/neural-interface/public/shared/cdx/cdx-styles.js +3251 -0
- package/neural-interface/public/shared/cdx/cdx-tabs.js +7992 -0
- package/neural-interface/public/shared/cdx/cdx-ws.js +363 -0
- package/neural-interface/public/shared/cli-status.js +169 -0
- package/neural-interface/public/shared/constants.js +22 -5
- package/neural-interface/public/shared/cp/cp-agents.js +186 -0
- package/neural-interface/public/shared/cp/cp-bash.js +252 -0
- package/neural-interface/public/shared/cp/cp-compose.js +159 -0
- package/neural-interface/public/shared/cp/cp-context-menu.js +309 -0
- package/neural-interface/public/shared/cp/cp-context-model.js +157 -0
- package/neural-interface/public/shared/cp/cp-context-window.js +80 -0
- package/neural-interface/public/shared/cp/cp-ctx.js +11 -0
- package/neural-interface/public/shared/cp/cp-diff.js +255 -0
- package/neural-interface/public/shared/cp/cp-event-rows.js +637 -0
- package/neural-interface/public/shared/cp/cp-events.js +846 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +104 -0
- package/neural-interface/public/shared/cp/cp-permission-model.js +905 -0
- package/neural-interface/public/shared/cp/cp-permissions.js +626 -0
- package/neural-interface/public/shared/cp/cp-rehydrate.js +113 -0
- package/neural-interface/public/shared/cp/cp-restore.js +224 -0
- package/neural-interface/public/shared/cp/cp-session-model.js +338 -0
- package/neural-interface/public/shared/cp/cp-session-settings.js +254 -0
- package/neural-interface/public/shared/cp/cp-sessions.js +227 -0
- package/neural-interface/public/shared/cp/cp-statusline.js +153 -0
- package/neural-interface/public/shared/cp/cp-styles.js +349 -0
- package/neural-interface/public/shared/cp/cp-tasks-model.js +282 -0
- package/neural-interface/public/shared/cp/cp-tasks.js +107 -0
- package/neural-interface/public/shared/cp/cp-temporary-view.js +56 -0
- package/neural-interface/public/shared/cp/cp-temporary.js +231 -0
- package/neural-interface/public/shared/cp/cp-tool-cards.js +326 -0
- package/neural-interface/public/shared/cp/cp-tool-results.js +618 -0
- package/neural-interface/public/shared/cp/cp-usage-model.js +124 -0
- package/neural-interface/public/shared/graph-activity.js +68 -0
- package/neural-interface/public/shared/html-shell.js +107 -12
- package/neural-interface/public/shared/i18n.js +132 -34
- package/neural-interface/public/shared/node-positions-store.js +44 -0
- package/neural-interface/public/shared/ocp-hidden-models.js +116 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-approvals.js +355 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-autoaccept-button.js +35 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +72 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-binding.js +280 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-caps.js +67 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-changes-logic.js +179 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-changes.js +164 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +725 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-compact-button.js +75 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-composer-logic.js +1204 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-confirm-logic.js +117 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-confirm.js +59 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-context-gauge.js +252 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-context-menu.js +478 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-context-model.js +179 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +233 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-icons.js +30 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +1065 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-mention-hints.js +182 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-modelpicker.js +655 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +2636 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-plan.js +601 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-profile-inheritance.js +78 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +649 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-providers.js +35 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-rehydrate.js +357 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render-logic.js +189 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +1869 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-select.js +42 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +117 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +1714 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-session-actions.js +468 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-session-widgets.js +63 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +366 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-settings-link.js +19 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-slash-hints.js +343 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-state.js +746 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-status-logic.js +347 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-status.js +338 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +3543 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-subagents-logic.js +482 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-tools-logic.js +351 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-tools.js +168 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-variantpicker.js +315 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +545 -0
- package/neural-interface/public/shared/provider-icons.js +30 -0
- package/neural-interface/public/shared/session-title.js +100 -0
- package/neural-interface/public/shared/settings/settings-ia.js +389 -0
- package/neural-interface/public/shared/settings/settings-kit.js +234 -0
- package/neural-interface/public/shared/settings/settings-search.js +463 -0
- package/neural-interface/public/shared/settings/settings-shell.js +570 -0
- package/neural-interface/public/shared/state.js +5 -0
- package/neural-interface/public/shared/storage.js +50 -7
- package/neural-interface/public/shared/styleguide/sg-agents.js +42 -0
- package/neural-interface/public/shared/styleguide/sg-brand.js +4 -0
- package/neural-interface/public/shared/styleguide/sg-color-client.js +388 -0
- package/neural-interface/public/shared/styleguide/sg-colors.js +148 -0
- package/neural-interface/public/shared/styleguide/sg-components.js +35 -0
- package/neural-interface/public/shared/styleguide/sg-history.js +41 -0
- package/neural-interface/public/shared/styleguide/sg-icons-logo.js +38 -0
- package/neural-interface/public/shared/styleguide/sg-imagery.js +4 -0
- package/neural-interface/public/shared/styleguide/sg-import-export.js +47 -0
- package/neural-interface/public/shared/styleguide/sg-kit.js +281 -0
- package/neural-interface/public/shared/styleguide/sg-labels.js +318 -0
- package/neural-interface/public/shared/styleguide/sg-layout.js +4 -0
- package/neural-interface/public/shared/styleguide/sg-motion.js +5 -0
- package/neural-interface/public/shared/styleguide/sg-panel.js +229 -0
- package/neural-interface/public/shared/styleguide/sg-preview.js +138 -0
- package/neural-interface/public/shared/styleguide/sg-rules.js +9 -0
- package/neural-interface/public/shared/styleguide/sg-shape.js +24 -0
- package/neural-interface/public/shared/styleguide/sg-state.js +132 -0
- package/neural-interface/public/shared/styleguide/sg-typography.js +124 -0
- package/neural-interface/public/shared/styles.css +7883 -1155
- package/neural-interface/public/shared/synabun-mascot.js +1625 -0
- package/neural-interface/public/shared/synabun-ticker.js +376 -0
- package/neural-interface/public/shared/term-renderer.js +343 -0
- package/neural-interface/public/shared/ui-assistant-panel.js +10 -0
- package/neural-interface/public/shared/ui-assistant.js +77 -0
- package/neural-interface/public/shared/ui-automation-studio.js +5105 -3573
- package/neural-interface/public/shared/ui-claude-panel.js +11685 -6333
- package/neural-interface/public/shared/ui-codex-panel.js +12 -0
- package/neural-interface/public/shared/ui-cost-widget.js +55 -34
- package/neural-interface/public/shared/ui-detail.js +77 -14
- package/neural-interface/public/shared/ui-explorer.js +360 -181
- package/neural-interface/public/shared/ui-file-explorer.js +485 -107
- package/neural-interface/public/shared/ui-help.js +2 -2
- package/neural-interface/public/shared/ui-image-gallery.js +45 -21
- package/neural-interface/public/shared/ui-judgments.js +1346 -0
- package/neural-interface/public/shared/ui-keybinds.js +3 -2
- package/neural-interface/public/shared/ui-link.js +105 -51
- package/neural-interface/public/shared/ui-loading.js +4 -4
- package/neural-interface/public/shared/ui-memory-maintenance.js +111 -0
- package/neural-interface/public/shared/ui-menubar.js +89 -4
- package/neural-interface/public/shared/ui-native-loop-router-state.js +94 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +493 -0
- package/neural-interface/public/shared/ui-native-window-id.js +7 -0
- package/neural-interface/public/shared/ui-navbar.js +357 -222
- package/neural-interface/public/shared/ui-notifications.js +58 -12
- package/neural-interface/public/shared/ui-opencode-panel-v2.js +17 -0
- package/neural-interface/public/shared/ui-panels.js +15 -7
- package/neural-interface/public/shared/ui-resume.js +823 -653
- package/neural-interface/public/shared/ui-schedule-queue.js +172 -0
- package/neural-interface/public/shared/ui-schedules-studio.js +1882 -0
- package/neural-interface/public/shared/ui-scroll-follow.js +194 -0
- package/neural-interface/public/shared/ui-sessions.js +789 -34
- package/neural-interface/public/shared/ui-settings.js +5793 -2190
- package/neural-interface/public/shared/ui-sidepanel-layout.js +109 -0
- package/neural-interface/public/shared/ui-sidepanel-runtime.js +19 -0
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +40 -0
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +221 -0
- package/neural-interface/public/shared/ui-sidepanel-state.js +131 -0
- package/neural-interface/public/shared/ui-sidepanel-tray.js +547 -0
- package/neural-interface/public/shared/ui-sidepanel-windows.js +387 -0
- package/neural-interface/public/shared/ui-skills.js +18 -32
- package/neural-interface/public/shared/ui-styleguide.js +35 -0
- package/neural-interface/public/shared/ui-sync.js +87 -0
- package/neural-interface/public/shared/ui-terminal.js +7877 -6385
- package/neural-interface/public/shared/ui-tool-updates.js +292 -0
- package/neural-interface/public/shared/ui-tooltip.js +156 -15
- package/neural-interface/public/shared/ui-tutorial-draw.js +119 -683
- package/neural-interface/public/shared/ui-tutorial-layout.js +135 -0
- package/neural-interface/public/shared/ui-tutorial-steps.js +59 -2209
- package/neural-interface/public/shared/ui-tutorial.css +102 -0
- package/neural-interface/public/shared/ui-tutorial.js +557 -1076
- package/neural-interface/public/shared/ui-update.js +420 -68
- package/neural-interface/public/shared/ui-whatsapp.js +941 -0
- package/neural-interface/public/shared/ui-whiteboard.js +1076 -233
- package/neural-interface/public/shared/ui-workspaces.js +2 -1
- package/neural-interface/public/shared/utils.js +58 -0
- package/neural-interface/public/shared/vterm-buffer.js +15 -5
- package/neural-interface/public/shared/whatsapp/wa-phone.js +65 -0
- package/neural-interface/public/shared/whatsapp/wa-view.js +411 -0
- package/neural-interface/public/sidepanel-session.html +18 -0
- package/neural-interface/public/sw.js +8 -2
- package/neural-interface/public/synabun.png +0 -0
- package/neural-interface/public/variant/2d/graph.js +1707 -1635
- package/neural-interface/public/variant/2d/lasso.js +2 -1
- package/neural-interface/public/variant/2d/layout.js +595 -594
- package/neural-interface/public/variant/2d/main.js +556 -521
- package/neural-interface/public/variant/2d/settings-gfx.js +18 -24
- package/neural-interface/public/variant/3d/main.js +516 -500
- package/neural-interface/public/variant/3d/map-controls.js +144 -0
- package/neural-interface/public/variant/3d/map-data.js +251 -0
- package/neural-interface/public/variant/3d/map-labels.js +241 -0
- package/neural-interface/public/variant/3d/map-pick.js +90 -0
- package/neural-interface/public/variant/3d/map-renderer.js +521 -0
- package/neural-interface/public/variant/3d/map-shaders.js +158 -0
- package/neural-interface/public/variant/3d/map-view.js +618 -0
- package/neural-interface/public/vendor/three/manifest.json +3 -0
- package/neural-interface/public/vendor/three/three-0.169.0.min.js +3844 -0
- package/neural-interface/public/vendor/xterm/manifest.json +3 -0
- package/neural-interface/public/vendor/xterm/xterm-6.0.0.css +285 -0
- package/neural-interface/public/vendor/xterm/xterm-6.0.0.min.js +192 -0
- package/neural-interface/scripts/build-vendor.mjs +64 -0
- package/neural-interface/scripts/codex-protocol-fixture.mjs +83 -0
- package/neural-interface/scripts/rebuild-pty.js +37 -23
- package/neural-interface/scripts/vendor-three-entry.js +24 -0
- package/neural-interface/scripts/vendor-xterm-entry.js +8 -0
- package/neural-interface/server.js +33948 -15000
- package/neural-interface/skins/default/skin.css +90 -0
- package/neural-interface/skins/default/skin.json +8 -0
- package/neural-interface/templates/rulesets/README.md +9 -0
- package/neural-interface/templates/rulesets/claude.md +3 -0
- package/neural-interface/templates/rulesets/codex.md +2 -0
- package/neural-interface/templates/rulesets/coexistence.md +6 -0
- package/neural-interface/templates/rulesets/core.md +26 -0
- package/neural-interface/templates/rulesets/cursor.md +2 -0
- package/neural-interface/templates/rulesets/gemini.md +2 -0
- package/neural-interface/templates/rulesets/legacy-hashes.json +227 -0
- package/neural-interface/templates/rulesets/manifest.json +12 -0
- package/neural-interface/templates/rulesets/opencode.md +2 -0
- package/package.json +119 -53
- package/postinstall.js +125 -26
- package/preuninstall.js +187 -0
- package/scripts/audit-claude-hook-usage.mjs +12 -0
- package/scripts/audit-memory-duplicates.mjs +44 -0
- package/scripts/measure-claude-hook-overhead.mjs +77 -0
- package/scripts/recover-user-config.mjs +254 -0
- package/scripts/restore-data-home-from-backup.mjs +239 -0
- package/setup.js +804 -260
- package/skills/leonardo/SKILL.md +19 -10
- package/skills/leonardo/modules/image-prompter.md +18 -12
- package/skills/leonardo/modules/video-prompter.md +19 -13
- package/skills/synabun/SKILL.md +209 -185
- package/skills/synabun/icon.png +0 -0
- package/skills/synabun/modules/audit.md +380 -374
- package/skills/synabun/modules/changelog.md +15 -6
- package/skills/synabun/modules/idea.md +148 -144
- package/skills/synabun/modules/memorize.md +13 -4
- package/skills/synabun/modules/schedule.md +198 -0
- package/skills/synabun/synabunicon.png +0 -0
- package/updater.cmd +31 -0
- package/updater.mjs +382 -0
- package/updater.sh +29 -0
- package/hooks/claude-code/test-user-learning.mjs +0 -531
- package/neural-interface/public/claude-chat.css +0 -878
- package/neural-interface/public/claude-chat.html +0 -92
- package/neural-interface/public/claude-chat.js +0 -1168
- package/neural-interface/public/index-legacy.html +0 -14677
- package/neural-interface/public/index2d-legacy.html +0 -8193
- package/neural-interface/public/shared/html-term-renderer.js +0 -1022
- package/neural-interface/public/variant/3d/background.js +0 -884
- package/neural-interface/public/variant/3d/camera.js +0 -661
- package/neural-interface/public/variant/3d/gfx.js +0 -116
- package/neural-interface/public/variant/3d/graph.js +0 -2399
- package/neural-interface/public/variant/3d/settings-gfx.js +0 -228
- package/neural-interface/templates/CLAUDE-template.md +0 -211
|
@@ -0,0 +1,905 @@
|
|
|
1
|
+
// ── Permission prompts: what they say and what an answer grants (DOM-free) ──
|
|
2
|
+
// The CLI sends a permission request with its own wording (title, reason, the
|
|
3
|
+
// path or MCP server involved) and with `suggestions`: the exact rule changes
|
|
4
|
+
// that would stop it asking again. "Always" returns those suggestions, to the
|
|
5
|
+
// destination the user picked, instead of a blanket allow for the whole tool.
|
|
6
|
+
// cp-permissions.js renders; tests import this file directly.
|
|
7
|
+
|
|
8
|
+
const clip = (s, n) => {
|
|
9
|
+
const t = String(s ?? '');
|
|
10
|
+
return t.length > n ? `${t.slice(0, n - 1)}…` : t;
|
|
11
|
+
};
|
|
12
|
+
// eslint-disable-next-line no-control-regex
|
|
13
|
+
const plain = (s) => String(s ?? '').replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, '').trim();
|
|
14
|
+
|
|
15
|
+
// ── Modes ──
|
|
16
|
+
|
|
17
|
+
export const ALL_PERMISSION_MODES = ['default', 'acceptEdits', 'plan', 'bypassPermissions', 'dontAsk', 'auto'];
|
|
18
|
+
const CLASSIC_MODES = ['default', 'acceptEdits', 'plan', 'bypassPermissions'];
|
|
19
|
+
|
|
20
|
+
export const MODE_LABELS = {
|
|
21
|
+
default: 'Default',
|
|
22
|
+
acceptEdits: 'Accept Edits',
|
|
23
|
+
plan: 'Plan',
|
|
24
|
+
bypassPermissions: 'Bypass',
|
|
25
|
+
dontAsk: "Don't Ask",
|
|
26
|
+
auto: 'Auto',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const MODE_HINTS = {
|
|
30
|
+
default: 'Ask before edits and commands',
|
|
31
|
+
acceptEdits: 'File edits run without asking',
|
|
32
|
+
plan: 'Read and plan only, then ask to proceed',
|
|
33
|
+
bypassPermissions: 'Run everything without asking',
|
|
34
|
+
dontAsk: 'Never ask: anything not already allowed is denied',
|
|
35
|
+
auto: 'A classifier approves safe actions and asks about the rest',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The modes the dropdown offers. `dontAsk` and `auto` need a bridge that accepts
|
|
40
|
+
* them; `auto` also needs a model that supports it. The mode a tab is already
|
|
41
|
+
* in is always listed, so the dropdown can show it.
|
|
42
|
+
*/
|
|
43
|
+
export function permissionModesFor({ extended = false, autoSupported = false, current = '' } = {}) {
|
|
44
|
+
const modes = [...CLASSIC_MODES];
|
|
45
|
+
if (extended) {
|
|
46
|
+
modes.push('dontAsk');
|
|
47
|
+
if (autoSupported) modes.push('auto');
|
|
48
|
+
}
|
|
49
|
+
if (current && ALL_PERMISSION_MODES.includes(current) && !modes.includes(current)) modes.push(current);
|
|
50
|
+
return modes;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A mode new tabs may start in. Plan is per tab; Auto and Don't Ask are never a
|
|
55
|
+
* default; and Bypass is a choice made for one tab, in its mode control: a new
|
|
56
|
+
* tab starts in it only when the user's own Claude Code settings say so
|
|
57
|
+
* (permissions.defaultMode).
|
|
58
|
+
*/
|
|
59
|
+
export function isDefaultableMode(mode) {
|
|
60
|
+
return mode === 'default' || mode === 'acceptEdits';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ── Bypass and auto-approve: what the mode control offers and says ──
|
|
64
|
+
|
|
65
|
+
export const BYPASS_MODE = 'bypassPermissions';
|
|
66
|
+
const BYPASS_NEEDS_RESTART = 'Bypass needs the SynaBun server restart: until then choosing it here does nothing.';
|
|
67
|
+
const BYPASS_OFF = 'Bypass is turned off by your Claude Code settings.';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Whether a tab can be put in Bypass, and the sentence to show when it cannot.
|
|
71
|
+
* `real`: the bridge runs Bypass as the SDK's bypassPermissions (capability
|
|
72
|
+
* `bypass_mode`). `policy`: what GET /api/claude-code/bypass-policy answered for
|
|
73
|
+
* the tab's project and account, when it was asked.
|
|
74
|
+
* @returns {{ available: boolean, reason: string, note: string }}
|
|
75
|
+
*/
|
|
76
|
+
export function bypassOffer({ real = false, policy = null } = {}) {
|
|
77
|
+
if (!real) return { available: false, reason: BYPASS_NEEDS_RESTART, note: 'needs the server restart' };
|
|
78
|
+
if (policy && policy.available === false) {
|
|
79
|
+
return { available: false, reason: clip(plain(policy.reason) || BYPASS_OFF, 300), note: policy.source === 'root' ? 'not available as root' : 'off in your settings' };
|
|
80
|
+
}
|
|
81
|
+
return { available: true, reason: '', note: '' };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* What the mode control shows. A tab in Bypass, and every tab while the global
|
|
86
|
+
* Auto-approve toggle is on, runs tools without asking: the control says so, in
|
|
87
|
+
* its warning style, whatever the mode is called. (A tab saved in Bypass is
|
|
88
|
+
* shown as that against any server: the warning is never the thing left out.)
|
|
89
|
+
* `follows`: the tab never picked a mode and follows the user's Claude Code
|
|
90
|
+
* settings; `known` says whether the page knows which mode that is. `leaving`:
|
|
91
|
+
* the tab's own mode is another one and its session may be in Bypass (the tab
|
|
92
|
+
* stated Bypass, or the bridge says so, and no report at or after the tab's
|
|
93
|
+
* latest statement says it is out of it): the control says Bypass until one
|
|
94
|
+
* does. `waiting`: the tab's pick is Bypass and the bridge cannot run it (it
|
|
95
|
+
* was not restarted): the pick waits, shown as unavailable.
|
|
96
|
+
* controlFacts(tab) reads those off a tab.
|
|
97
|
+
* `keep` is the start of `text` that the control never cuts when the bar is
|
|
98
|
+
* short of room: "Bypass", the mode after the arrow, else the mode's name. Only
|
|
99
|
+
* the suffixes after it (" · from settings", " · auto-approve", " ·
|
|
100
|
+
* unavailable") may go under the ellipsis; modeTooltip() has the text in full.
|
|
101
|
+
* @returns {{ text: string, keep: string, title: string, state: '' | 'bypass' | 'autoapprove' }}
|
|
102
|
+
*/
|
|
103
|
+
export function modeControl({ mode = 'default', autoApprove = false, follows = false, known = true, leaving = false, waiting = false } = {}) {
|
|
104
|
+
const label = MODE_LABELS[mode] || String(mode || '');
|
|
105
|
+
const name = follows ? (known ? `${label} · from settings` : 'From settings') : label;
|
|
106
|
+
const head = follows && !known ? name : label;
|
|
107
|
+
if (waiting) {
|
|
108
|
+
return { text: 'Bypass · unavailable', keep: 'Bypass', state: 'bypass', title: 'Bypass needs the SynaBun server restart: this tab\'s Bypass pick waits for it, and until then the tab runs in Default.' };
|
|
109
|
+
}
|
|
110
|
+
if (leaving) {
|
|
111
|
+
return { text: `Bypass → ${name}`, keep: `Bypass → ${head}`, state: 'bypass', title: 'This tab\'s session may still be in Bypass: its switch to another mode is not confirmed yet. Until it is, tools can run without asking.' };
|
|
112
|
+
}
|
|
113
|
+
if (mode === BYPASS_MODE && (known || !follows)) {
|
|
114
|
+
return {
|
|
115
|
+
text: name,
|
|
116
|
+
keep: head,
|
|
117
|
+
state: 'bypass',
|
|
118
|
+
title: follows
|
|
119
|
+
? 'Bypass, from your Claude Code settings (permissions.defaultMode): every tool runs without asking in this tab, until you pick another mode.'
|
|
120
|
+
: 'Bypass: every tool runs without asking in this tab, until you pick another mode.',
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
if (autoApprove) {
|
|
124
|
+
return { text: `${name} · auto-approve`, keep: head, state: 'autoapprove', title: 'Auto-approve is on: permission requests are answered Allow without a card, in every tab. Turn it off with the Auto-approve toggle.' };
|
|
125
|
+
}
|
|
126
|
+
return { text: name, keep: head, state: '', title: follows ? 'This tab follows your Claude Code settings (permissions.defaultMode). Pick a mode here to choose one for this tab.' : '' };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The mode control's tooltip: its label in full (the control may cut the end
|
|
131
|
+
* of it), what that means (`fallback` when the state has no sentence of its
|
|
132
|
+
* own), and `note` (settingsModeNote()).
|
|
133
|
+
*/
|
|
134
|
+
export function modeTooltip(shown, { fallback = '', note = '' } = {}) {
|
|
135
|
+
return [shown?.text, shown?.title || fallback, note].filter(Boolean).map(part => `${String(part).replace(/[.\s]+$/, '')}.`).join(' ');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ── The mode the settings ask for, and the one the session got ──
|
|
139
|
+
// A tab that never picked a mode starts in the mode Claude Code takes from the
|
|
140
|
+
// user's settings (permissions.defaultMode). Claude Code can decline it: auto
|
|
141
|
+
// mode is not available for every model, plan or setting, and the session then
|
|
142
|
+
// starts in Default. The control shows the mode the session is in; these say
|
|
143
|
+
// that the settings asked for another.
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The mode the settings files name (GET /api/claude-code/permission-rules):
|
|
147
|
+
* the nearest scope that names one, as Claude Code reads them (this project
|
|
148
|
+
* only me, this project shared, all my projects). '' when none does.
|
|
149
|
+
*/
|
|
150
|
+
export function settingsDefaultMode(rules) {
|
|
151
|
+
for (const scope of ['local', 'project', 'user']) {
|
|
152
|
+
const s = rules?.[scope];
|
|
153
|
+
if (s?.exists && !s.error && isMode(s.defaultMode)) return s.defaultMode;
|
|
154
|
+
}
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The sentence for a tab that follows the settings and whose session is in
|
|
160
|
+
* another mode than the one they ask for (`facts`: controlFacts(tab); `asked`:
|
|
161
|
+
* settingsDefaultMode()). '' when there is nothing to say.
|
|
162
|
+
*/
|
|
163
|
+
export function settingsModeNote(facts, asked) {
|
|
164
|
+
if (!facts?.follows || !facts.known || !isMode(asked) || !isMode(facts.mode) || asked === facts.mode) return '';
|
|
165
|
+
return `Your Claude Code settings ask for ${MODE_LABELS[asked]} (permissions.defaultMode) and this session is in ${MODE_LABELS[facts.mode]}: Claude Code starts a session in another mode when it cannot give the one asked for${asked === 'auto' ? ' (auto mode is not available for every model, plan or setting)' : ''}.`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// ── A tab's mode: one model ──
|
|
169
|
+
// Two facts, one owner each.
|
|
170
|
+
// The page owns the tab's CHOSEN mode: a pick, or none. A pick is
|
|
171
|
+
// `modeChosen` with the mode in `permissionMode` (and `bypassChosen` when it
|
|
172
|
+
// is Bypass: the record a saved Bypass needs to come back). A tab without a
|
|
173
|
+
// pick follows the user's Claude Code settings (permissions.defaultMode);
|
|
174
|
+
// `permissionMode` then only holds what its session last reported, to show.
|
|
175
|
+
// The bridge owns the session's ACTUAL mode. The page keeps the latest report
|
|
176
|
+
// of it (`actualMode`, `actualSeq`) to show it and to warn, never to state it.
|
|
177
|
+
// Order is decided by numbers, not by time. `modeSeq` grows whenever the page
|
|
178
|
+
// changes the tab's mode itself (a pick, a plan card answer, entering or
|
|
179
|
+
// leaving plan mode), and every statement the page sends carries it. The
|
|
180
|
+
// bridge returns the number of the latest statement it applied with every
|
|
181
|
+
// report (capability `mode_statements`). A report with an older number changes
|
|
182
|
+
// nothing of the tab's own; one with the latest number and another mode is the
|
|
183
|
+
// bridge or the CLI deciding otherwise, and the tab then shows that mode.
|
|
184
|
+
// Plan mode is one fact: `permissionMode === 'plan'` and `planMode` are written
|
|
185
|
+
// together, by setMode() alone, and `planFrom` holds what the tab was before it
|
|
186
|
+
// entered plan mode: where an exit that names no mode goes back to.
|
|
187
|
+
// A tab is in Bypass only because the user chose that for it: in the mode
|
|
188
|
+
// control, on the plan card, in a saved tab with the record of such a pick, or
|
|
189
|
+
// through their settings for a tab that never picked a mode. Nothing an
|
|
190
|
+
// automation run says or does is written here (runEvent()).
|
|
191
|
+
// Never under-warn. "May be in Bypass" is a fact of its own (`mayBypass`), and
|
|
192
|
+
// it errs toward warning. A tab may be in Bypass from the moment the page sends
|
|
193
|
+
// a statement of Bypass (statementSent), or a report says so, until a report
|
|
194
|
+
// that carries a number at or after the tab's latest statement says the session
|
|
195
|
+
// is not (`mayBypass: false` from a bridge that keeps the same fact). A report
|
|
196
|
+
// with an older number can set it, never clear it; nothing else clears it; and
|
|
197
|
+
// it is saved with the tab whenever it changes. The control warns whenever the
|
|
198
|
+
// tab's pick is Bypass or this fact is set (controlFacts).
|
|
199
|
+
// Bypass exists only against a bridge that runs it and numbers statements
|
|
200
|
+
// (`bypass` and `numbered` below: capabilities `bypass_mode` and
|
|
201
|
+
// `mode_statements`). Against any other the page states no Bypass, a saved
|
|
202
|
+
// Bypass pick waits, and a report without a number is never about Bypass.
|
|
203
|
+
// The bridge's reports have an order of their own. The statement number orders
|
|
204
|
+
// what the page says; between two statements the bridge sends several reports
|
|
205
|
+
// with the same number, and a report can be handled long after it was written
|
|
206
|
+
// (it waited in a detached session's buffer and was replayed after the answer
|
|
207
|
+
// to reattach, or it waited here behind a card). So every report carries a
|
|
208
|
+
// revision that only grows for the bridge session that wrote it (`modeRev`,
|
|
209
|
+
// with that session's id, `modeRevOf`). The tab remembers the highest one it
|
|
210
|
+
// handled; a report with a lower revision of the same bridge session can set
|
|
211
|
+
// `mayBypass` and does nothing else: it clears nothing and replaces neither
|
|
212
|
+
// the tab's mode nor the mode shown for its session. Another id means another
|
|
213
|
+
// bridge session (a server restart, a session created anew), whose revisions
|
|
214
|
+
// start again: its reports are taken, and the tab counts with it from there.
|
|
215
|
+
// A report written by a bridge session the tab's socket has since left (noted
|
|
216
|
+
// when a message arrives: reportReceived) is older than everything of the one
|
|
217
|
+
// it talks to now. The revision is not saved: the first thing a reloaded page
|
|
218
|
+
// hears from a session is its answer to reattach, which carries the current
|
|
219
|
+
// one. A bridge that sends no revision is ordered by the number alone.
|
|
220
|
+
|
|
221
|
+
const isMode = (mode) => typeof mode === 'string' && ALL_PERMISSION_MODES.includes(mode);
|
|
222
|
+
const seqOf = (tab) => (Number.isSafeInteger(tab?.modeSeq) && tab.modeSeq > 0 ? tab.modeSeq : 0);
|
|
223
|
+
|
|
224
|
+
/** The one writer of the pair `permissionMode` / `planMode`. */
|
|
225
|
+
function setMode(tab, mode) {
|
|
226
|
+
tab.permissionMode = mode;
|
|
227
|
+
tab.planMode = mode === 'plan';
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** The page changed the tab's mode itself: its statements carry a new number from here. */
|
|
231
|
+
function nextStatement(tab) {
|
|
232
|
+
tab.modeSeq = seqOf(tab) + 1;
|
|
233
|
+
return tab.modeSeq;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** What a tab is outside plan mode: its pick, or '' when it follows the settings. */
|
|
237
|
+
function baseOf(tab) {
|
|
238
|
+
if (tab.modeChosen !== true) return { mode: '' };
|
|
239
|
+
if (tab.permissionMode === BYPASS_MODE) return tab.bypassChosen === true ? { mode: BYPASS_MODE, bypassChosen: true } : { mode: '' };
|
|
240
|
+
return { mode: isMode(tab.permissionMode) ? tab.permissionMode : 'default' };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function enterPlan(tab) {
|
|
244
|
+
if (tab.permissionMode !== 'plan') tab.planFrom = baseOf(tab);
|
|
245
|
+
setMode(tab, 'plan');
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The user picked `mode` for this tab: the mode control (the dropdown, also for
|
|
250
|
+
* the mode it already shows; Shift+Tab; the plan toggle switching plan mode on)
|
|
251
|
+
* or a button of the plan card. Returns the number of the statement.
|
|
252
|
+
*/
|
|
253
|
+
export function pickMode(tab, mode) {
|
|
254
|
+
if (mode === 'plan') {
|
|
255
|
+
enterPlan(tab);
|
|
256
|
+
} else {
|
|
257
|
+
tab.planFrom = null;
|
|
258
|
+
setMode(tab, mode);
|
|
259
|
+
tab.modeChosen = true;
|
|
260
|
+
}
|
|
261
|
+
tab.bypassChosen = mode === BYPASS_MODE;
|
|
262
|
+
return nextStatement(tab);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The tab leaves plan mode without naming a mode (the plan toggle, /plan, the
|
|
267
|
+
* post-plan card): back to what it was before it entered plan mode, the user's
|
|
268
|
+
* pick or following their settings. A tab with no record of that (saved by an
|
|
269
|
+
* older build) goes on in Default. Returns the number of the statement, 0 when
|
|
270
|
+
* the tab was not in plan mode.
|
|
271
|
+
*/
|
|
272
|
+
export function leavePlanMode(tab) {
|
|
273
|
+
if (tab.permissionMode !== 'plan') { tab.planMode = false; return 0; }
|
|
274
|
+
const from = tab.planFrom && typeof tab.planFrom === 'object' ? tab.planFrom : null;
|
|
275
|
+
tab.planFrom = null;
|
|
276
|
+
if (from && from.mode === BYPASS_MODE && from.bypassChosen === true) {
|
|
277
|
+
setMode(tab, BYPASS_MODE); tab.modeChosen = true; tab.bypassChosen = true;
|
|
278
|
+
} else if (from && from.mode && from.mode !== BYPASS_MODE && from.mode !== 'plan' && isMode(from.mode)) {
|
|
279
|
+
setMode(tab, from.mode); tab.modeChosen = true; tab.bypassChosen = false;
|
|
280
|
+
} else if (from) {
|
|
281
|
+
// It followed the settings, and does again: which mode that is, its session says.
|
|
282
|
+
setMode(tab, 'default'); tab.modeChosen = false; tab.bypassChosen = false;
|
|
283
|
+
} else {
|
|
284
|
+
setMode(tab, 'default'); tab.bypassChosen = false;
|
|
285
|
+
}
|
|
286
|
+
return nextStatement(tab);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The tab's own session entered plan mode and the page saw the tool call
|
|
291
|
+
* (EnterPlanMode), against a bridge that does not number statements: with one
|
|
292
|
+
* that does, the session's own report says so (sessionReport). Never for an
|
|
293
|
+
* event of an automation run. Returns whether the tab entered plan mode.
|
|
294
|
+
*/
|
|
295
|
+
export function sessionEnteredPlan(tab) {
|
|
296
|
+
if (tab._runEvent || tab.permissionMode === 'plan') return false;
|
|
297
|
+
enterPlan(tab);
|
|
298
|
+
nextStatement(tab);
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* The mode a tab calls its own: 'plan' in plan mode, its pick, or '' when it
|
|
304
|
+
* never picked one (the user's Claude Code settings then pick the mode a
|
|
305
|
+
* session starts in). Bypass is the tab's own only as the user's recorded
|
|
306
|
+
* pick: a Bypass the tab merely shows (its session started in it from the
|
|
307
|
+
* user's settings) is not.
|
|
308
|
+
*/
|
|
309
|
+
export function ownMode(tab) {
|
|
310
|
+
if (tab?.permissionMode === 'plan') return 'plan';
|
|
311
|
+
if (tab?.modeChosen !== true) return '';
|
|
312
|
+
const mode = tab.permissionMode || 'default';
|
|
313
|
+
if (mode === BYPASS_MODE) return tab.bypassChosen === true ? BYPASS_MODE : '';
|
|
314
|
+
return mode;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// The mode a statement names for a tab: its own, except a Bypass pick against a
|
|
318
|
+
// bridge that cannot run Bypass (`real` false), which waits: Default is stated.
|
|
319
|
+
function statable(tab, real) {
|
|
320
|
+
const own = ownMode(tab);
|
|
321
|
+
return own === BYPASS_MODE && !real ? 'default' : own;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* What a query, a warm start or a starting control says about the tab's mode:
|
|
326
|
+
* `{ permissionMode }`, or `{ modeFromSettings: true }` for a tab that never
|
|
327
|
+
* picked one, where the bridge can leave the choice to the user's settings
|
|
328
|
+
* (`settingsPick`: capability `permission_modes_v2`). With `numbered`
|
|
329
|
+
* (capability `mode_statements`) the statement carries its number.
|
|
330
|
+
*/
|
|
331
|
+
export function statedMode(tab, { settingsPick = false, numbered = false, bypass = false } = {}) {
|
|
332
|
+
const own = statable(tab, numbered && bypass);
|
|
333
|
+
const out = own ? { permissionMode: own } : (settingsPick ? { modeFromSettings: true } : { permissionMode: 'default' });
|
|
334
|
+
if (numbered) out.modeSeq = seqOf(tab) || nextStatement(tab);
|
|
335
|
+
return out;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The same statement as the fields of a `set_permission_mode`: said to a live
|
|
340
|
+
* session at once (a pick, leaving plan mode, the tab saying its mode again).
|
|
341
|
+
* A tab that never picked a mode goes back to the mode its settings name:
|
|
342
|
+
* `{ fromSettings: true }` where the bridge can do that (`numbered`); an older
|
|
343
|
+
* bridge is told the mode the session was last seen in from the settings
|
|
344
|
+
* (never Bypass), else Default.
|
|
345
|
+
*/
|
|
346
|
+
export function modeStatement(tab, { numbered = false, bypass = false } = {}) {
|
|
347
|
+
const own = statable(tab, numbered && bypass);
|
|
348
|
+
if (numbered) return { ...(own ? { mode: own } : { fromSettings: true }), modeSeq: seqOf(tab) || nextStatement(tab) };
|
|
349
|
+
if (own) return { mode: own };
|
|
350
|
+
const seen = tab?.settingsMode;
|
|
351
|
+
return { mode: isMode(seen) && seen !== BYPASS_MODE && seen !== 'plan' ? seen : 'default' };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Where an approved plan leaves to when the answer names no mode of its own
|
|
356
|
+
* (the post-plan card answering a pending approval): what the tab was before
|
|
357
|
+
* plan mode. `planDecision` is what every bridge reads; `planExit` says it
|
|
358
|
+
* exactly to one that numbers statements. Call before leavePlanMode().
|
|
359
|
+
*/
|
|
360
|
+
export function planExitTarget(tab, { bypass = false } = {}) {
|
|
361
|
+
const from = tab?.planFrom && typeof tab.planFrom === 'object' ? tab.planFrom : null;
|
|
362
|
+
const mode = from?.mode === BYPASS_MODE ? (from.bypassChosen === true && bypass ? BYPASS_MODE : 'default') : (from?.mode && isMode(from.mode) && from.mode !== 'plan' ? from.mode : '');
|
|
363
|
+
if (!mode) return { planDecision: 'default', planExit: from ? 'settings' : 'default' };
|
|
364
|
+
return { planDecision: mode === 'acceptEdits' || mode === BYPASS_MODE ? mode : 'default', planExit: mode };
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// A report the bridge did not number: what the tab's session says is followed.
|
|
368
|
+
// Bypass is not part of it: such a bridge cannot run Bypass and the page states
|
|
369
|
+
// none to it, so a Bypass it names is nobody's mode, and a tab whose Bypass
|
|
370
|
+
// pick waits for a bridge that can is left as it is.
|
|
371
|
+
function unnumberedReport(tab, mode) {
|
|
372
|
+
if (mode === BYPASS_MODE || ownMode(tab) === BYPASS_MODE) return false;
|
|
373
|
+
if (mode === 'plan') enterPlan(tab);
|
|
374
|
+
else { tab.planFrom = null; setMode(tab, mode); }
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// A numbered report that carries the page's latest number: the bridge's word on
|
|
379
|
+
// the session as of the tab's latest statement.
|
|
380
|
+
function currentReport(tab, mode) {
|
|
381
|
+
const own = ownMode(tab);
|
|
382
|
+
if (mode === own) return { taken: true, changed: false };
|
|
383
|
+
if (mode === BYPASS_MODE) {
|
|
384
|
+
// The user's settings started the session of a tab that never picked a mode in it: shown, not picked.
|
|
385
|
+
if (own !== '') return { taken: false, changed: false };
|
|
386
|
+
setMode(tab, mode);
|
|
387
|
+
return { taken: true, changed: true };
|
|
388
|
+
}
|
|
389
|
+
if (mode === 'plan') {
|
|
390
|
+
// The session entered plan mode itself (the model's EnterPlanMode).
|
|
391
|
+
enterPlan(tab);
|
|
392
|
+
return { taken: true, changed: true };
|
|
393
|
+
}
|
|
394
|
+
if (own === 'plan') {
|
|
395
|
+
// The session left plan mode: to what the tab was before when that is the mode, else to the mode it says.
|
|
396
|
+
const from = tab.planFrom && typeof tab.planFrom === 'object' ? tab.planFrom : null;
|
|
397
|
+
tab.planFrom = null;
|
|
398
|
+
setMode(tab, mode);
|
|
399
|
+
if (from) tab.modeChosen = from.mode !== '';
|
|
400
|
+
tab.bypassChosen = false;
|
|
401
|
+
return { taken: true, changed: true };
|
|
402
|
+
}
|
|
403
|
+
// The bridge or the CLI decided otherwise (refused, switched, a policy): the
|
|
404
|
+
// tab shows the mode its session is in. A pick stays a pick, of that mode.
|
|
405
|
+
setMode(tab, mode);
|
|
406
|
+
tab.bypassChosen = false;
|
|
407
|
+
return { taken: true, changed: true, decided: own !== '' };
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* The tab's session says which mode it is in: a turn's `init`, a `status`, the
|
|
412
|
+
* bridge's `mode_changed` or `mode_state`, the answer to `reattach`. `seq` is
|
|
413
|
+
* the number the bridge returned with it; `numbered` whether the bridge numbers
|
|
414
|
+
* at all. `mode` is the mode the CLI is in; `switching` the mode a switch is
|
|
415
|
+
* under way to, `failed` the one a switch failed for (either is the session's
|
|
416
|
+
* record of what the tab stated); `mayBypass` the bridge's own fact.
|
|
417
|
+
* Returns:
|
|
418
|
+
* warned whether the tab may be in Bypass changed (the caller saves the tab)
|
|
419
|
+
* stale the report is older than the tab's latest statement: nothing of
|
|
420
|
+
* the tab's own changed
|
|
421
|
+
* taken the tab is (now) in the mode reported
|
|
422
|
+
* changed the tab's own mode changed
|
|
423
|
+
* decided the bridge or the CLI put a tab with a pick in another mode
|
|
424
|
+
* restate the caller says the tab's own mode to the session again: a Bypass
|
|
425
|
+
* that is not the tab's was reported, or the session is behind a
|
|
426
|
+
* statement that was not sent to it on this connection
|
|
427
|
+
* Nothing of an automation run comes through here (runEvent strips its mode;
|
|
428
|
+
* a call made while one of its events is handled changes nothing).
|
|
429
|
+
*/
|
|
430
|
+
export function sessionReport(tab, mode, from, { seq, numbered = false, mayBypass, switching, failed, rev, revOf } = {}) {
|
|
431
|
+
const none = { stale: false, taken: false, changed: false, decided: false, restate: false, warned: false };
|
|
432
|
+
if (typeof mode !== 'string' || tab._runEvent) return none;
|
|
433
|
+
if (!numbered) {
|
|
434
|
+
if (!mode) return none;
|
|
435
|
+
const before = `${tab.permissionMode}|${tab.planMode}`;
|
|
436
|
+
if (!unnumberedReport(tab, mode)) return none;
|
|
437
|
+
tab.actualMode = mode;
|
|
438
|
+
tab.actualSeq = undefined;
|
|
439
|
+
if (ownMode(tab) === '') tab.settingsMode = mode;
|
|
440
|
+
return { ...none, taken: true, changed: before !== `${tab.permissionMode}|${tab.planMode}` };
|
|
441
|
+
}
|
|
442
|
+
const mine = seqOf(tab);
|
|
443
|
+
const n = Number.isSafeInteger(seq) ? seq : -1;
|
|
444
|
+
// Older than a report the tab already handled, by the bridge's own count.
|
|
445
|
+
const older = olderReport(tab, rev, revOf);
|
|
446
|
+
// Whether the tab may be in Bypass. Any report that says so sets it, whatever
|
|
447
|
+
// its number or its revision; only one numbered at or after the tab's latest
|
|
448
|
+
// statement, from a bridge that keeps the fact itself, and not older than a
|
|
449
|
+
// report already handled, clears it.
|
|
450
|
+
const was = tab.mayBypass === true;
|
|
451
|
+
if (mode === BYPASS_MODE || mayBypass === true || switching === BYPASS_MODE || failed === BYPASS_MODE) tab.mayBypass = true;
|
|
452
|
+
else if (!older && n >= mine && mayBypass === false) tab.mayBypass = false;
|
|
453
|
+
const out = { ...none, warned: was !== (tab.mayBypass === true) };
|
|
454
|
+
// (An older report changes nothing else: a newer one already said where the session is.)
|
|
455
|
+
if (older) return { ...out, stale: true };
|
|
456
|
+
// What the page knows of the session's actual mode: the report with the highest number.
|
|
457
|
+
if (!Number.isSafeInteger(tab.actualSeq) || n >= tab.actualSeq) { tab.actualSeq = n; tab.actualMode = mode; }
|
|
458
|
+
if (n < mine) return { ...out, stale: true, restate: (tab.modeSent || 0) < mine };
|
|
459
|
+
if (n > mine) {
|
|
460
|
+
// The counter only grows: the session applied a statement this page does not
|
|
461
|
+
// remember making (its saved number was lost). A statement this page made on
|
|
462
|
+
// this connection is newer than that all the same, whether it could not be
|
|
463
|
+
// sent yet or was sent with the lower number (the bridge drops that one):
|
|
464
|
+
// it is said again with a number the bridge takes, not replaced.
|
|
465
|
+
tab.modeSeq = n;
|
|
466
|
+
if (tab.modeUnsent === true || (mine > 0 && tab.modeSent === mine)) { nextStatement(tab); return { ...out, stale: true, restate: true }; }
|
|
467
|
+
}
|
|
468
|
+
if (!mode) return { ...out, taken: true }; // no process yet: only the number is confirmed
|
|
469
|
+
// The session's record of what the tab stated: the mode a switch is under way
|
|
470
|
+
// to or failed for, else the mode it is in. The tab's own mode is judged
|
|
471
|
+
// against that; what the CLI is in meanwhile is only shown, and warned of.
|
|
472
|
+
const stated = (isMode(switching) && switching) || (isMode(failed) && failed) || mode;
|
|
473
|
+
const result = { ...out, ...currentReport(tab, stated) };
|
|
474
|
+
if (result.taken && ownMode(tab) === '') tab.settingsMode = stated;
|
|
475
|
+
// (A switch that failed was already made for the tab's statement: saying it again would only fail again.)
|
|
476
|
+
if (!result.taken) result.restate = !failed;
|
|
477
|
+
return result;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Whether a report is older than one the tab already handled, by the revision
|
|
481
|
+
// the bridge gave it (see "The bridge's reports have an order of their own"
|
|
482
|
+
// above). Remembers the highest revision handled, per bridge session.
|
|
483
|
+
function olderReport(tab, rev, revOf) {
|
|
484
|
+
// A bridge that sends no revision: the statement number orders alone, as it did.
|
|
485
|
+
if (!Number.isSafeInteger(rev) || typeof revOf !== 'string' || !revOf) return false;
|
|
486
|
+
// Written by a bridge session the tab's socket has left since.
|
|
487
|
+
if (tab.modeRevNow && tab.modeRevNow !== revOf) return true;
|
|
488
|
+
// Another bridge session: its revisions start again, and the tab counts with it.
|
|
489
|
+
if (tab.modeRevOf !== revOf) { tab.modeRevOf = revOf; tab.modeRev = rev; return false; }
|
|
490
|
+
if (rev < tab.modeRev) return true;
|
|
491
|
+
tab.modeRev = rev;
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* A message arrived on the tab's socket (before it may wait in the page's
|
|
497
|
+
* buffer): the bridge session that wrote its mode report is the one the tab
|
|
498
|
+
* talks to now. Messages arrive in the order written, so a report of another
|
|
499
|
+
* bridge session that is handled later was written before this one.
|
|
500
|
+
*/
|
|
501
|
+
export function reportReceived(tab, msg) {
|
|
502
|
+
const of = msg?.type === 'reattach_result' ? msg.modeRevOf : (msg?.type === 'event' ? msg.event?.modeRevOf : undefined);
|
|
503
|
+
if (tab && typeof of === 'string' && of) tab.modeRevNow = of;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/** The older name of sessionReport() for a bridge that does not number: whether the report was taken. */
|
|
507
|
+
export function sessionMode(tab, mode, from) {
|
|
508
|
+
if (typeof mode !== 'string' || !mode) return false;
|
|
509
|
+
return sessionReport(tab, mode, from).taken;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* A statement of the tab's mode was written to its socket. Reports that are
|
|
514
|
+
* behind it are on their way, not lost (`counted`: not for the `config` of a
|
|
515
|
+
* starting control, which is no statement the session answers). And from the
|
|
516
|
+
* moment the page sends a statement of Bypass the tab may be in Bypass: returns
|
|
517
|
+
* whether that changed, for the caller to save the tab.
|
|
518
|
+
*/
|
|
519
|
+
export function statementSent(tab, { numbered = false, bypass = false, counted = true } = {}) {
|
|
520
|
+
if (counted) tab.modeSent = seqOf(tab);
|
|
521
|
+
if (!(numbered && bypass) || ownMode(tab) !== BYPASS_MODE || tab.mayBypass === true) return false;
|
|
522
|
+
tab.mayBypass = true;
|
|
523
|
+
return true;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* The bridge dropped a statement of this tab's because its number is older than
|
|
528
|
+
* the one the session holds (`seq`: the page's saved number was lost). The tab
|
|
529
|
+
* takes that number and its next statement goes beyond it. Returns whether the
|
|
530
|
+
* tab has to say its mode again.
|
|
531
|
+
*/
|
|
532
|
+
export function statementDropped(tab, seq) {
|
|
533
|
+
if (!Number.isSafeInteger(seq) || seq <= seqOf(tab)) return false;
|
|
534
|
+
tab.modeSeq = seq;
|
|
535
|
+
nextStatement(tab);
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/** A new socket: nothing was said on it yet. */
|
|
540
|
+
export function connectionOpened(tab) {
|
|
541
|
+
tab.modeSent = 0;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* The tab holds another conversation (New chat, the session menu), or its
|
|
546
|
+
* session is gone: what was known of the old session's actual mode, and of the
|
|
547
|
+
* mode the settings gave it, is not about this one. The tab's own mode, its
|
|
548
|
+
* pick, stays. So does whether the tab may be in Bypass: the process of the
|
|
549
|
+
* conversation it left is still there until the next message replaces it, and
|
|
550
|
+
* only a report ends that.
|
|
551
|
+
*/
|
|
552
|
+
export function sessionForgotten(tab) {
|
|
553
|
+
tab.actualMode = '';
|
|
554
|
+
tab.actualSeq = undefined;
|
|
555
|
+
tab.settingsMode = '';
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* What the mode control has to say about a tab (the arguments of modeControl()).
|
|
560
|
+
* A tab with a pick shows it; one that never picked shows that it follows the
|
|
561
|
+
* settings, and the mode its session reported for them once the page knows.
|
|
562
|
+
* Whenever the tab may be in Bypass (it stated Bypass, or a report said so, and
|
|
563
|
+
* no report at or after its latest statement says it is out of it) and the mode
|
|
564
|
+
* shown is another one: `leaving`. A Bypass pick against a bridge that cannot
|
|
565
|
+
* run Bypass (`numbered` and `bypass`: it announces both capabilities) waits:
|
|
566
|
+
* `waiting`.
|
|
567
|
+
*/
|
|
568
|
+
export function controlFacts(tab, { settingsPick = true, numbered = false, bypass = false } = {}) {
|
|
569
|
+
const own = ownMode(tab);
|
|
570
|
+
const actual = tab?.actualMode || '';
|
|
571
|
+
const may = tab?.mayBypass === true || actual === BYPASS_MODE;
|
|
572
|
+
if (own === BYPASS_MODE) return { mode: own, follows: false, known: true, leaving: false, ...(numbered && bypass ? {} : { waiting: true }) };
|
|
573
|
+
if (own) return { mode: own, follows: false, known: true, leaving: may };
|
|
574
|
+
// A bridge that cannot leave the mode to the settings is told Default (statedMode): that is what the tab runs in.
|
|
575
|
+
if (!settingsPick) return { mode: 'default', follows: false, known: true, leaving: may };
|
|
576
|
+
const current = !Number.isSafeInteger(tab?.actualSeq) || tab.actualSeq >= seqOf(tab);
|
|
577
|
+
const mode = (current && isMode(actual) ? actual : '') || (isMode(tab?.settingsMode) ? tab.settingsMode : '');
|
|
578
|
+
return { mode: mode || 'default', follows: true, known: !!mode, leaving: may && mode !== BYPASS_MODE };
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/** Whether what was typed is exactly the local, read-only /permissions command (it opens while an automation run owns the tab). */
|
|
582
|
+
export function isPermissionsCommand(text) {
|
|
583
|
+
return typeof text === 'string' && /^\/permissions$/i.test(text.trim());
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* An event of an automation run shown in a tab, as the tab may handle it. What
|
|
588
|
+
* the run says about its own mode (its init, a status) is information about the
|
|
589
|
+
* run: it is kept as `tab.runMode` and taken out of the event, and a
|
|
590
|
+
* `mode_changed` is dropped. So nothing downstream can store the run's mode as
|
|
591
|
+
* the tab's: the tab keeps the user's own pick, or none. (What the run does,
|
|
592
|
+
* its EnterPlanMode call, is kept out of the tab's plan state by the caller's
|
|
593
|
+
* `tab._runEvent` mark: sessionEnteredPlan() and sessionReport() change nothing
|
|
594
|
+
* while it is set.)
|
|
595
|
+
*/
|
|
596
|
+
export function runEvent(tab, ev) {
|
|
597
|
+
if (!ev || typeof ev !== 'object') return ev;
|
|
598
|
+
if (ev.type === 'mode_changed' || ev.type === 'mode_state' || ev.type === 'mode_behind') return null;
|
|
599
|
+
if (!('permissionMode' in ev)) return ev;
|
|
600
|
+
if (typeof ev.permissionMode === 'string' && ev.permissionMode) tab.runMode = ev.permissionMode;
|
|
601
|
+
return { ...ev, permissionMode: '' };
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* What is saved for a tab: its own mode, never one it only shows. A tab without
|
|
606
|
+
* a pick is saved as that (a Bypass or an Auto its session started in from the
|
|
607
|
+
* settings is not written down as the tab's), plan mode with what it goes back
|
|
608
|
+
* to, and the number of its latest statement, which must survive a reload.
|
|
609
|
+
*/
|
|
610
|
+
export function savedMode(tab) {
|
|
611
|
+
// (`sessionBypass`: the tab may be in Bypass. Saved whatever the tab's own mode is, so a reloaded page warns from the start, until a report says the session is out of it; never the tab's mode.)
|
|
612
|
+
const seq = { ...(seqOf(tab) ? { modeSeq: seqOf(tab) } : {}), ...(tab?.mayBypass === true || tab?.actualMode === BYPASS_MODE ? { sessionBypass: true } : {}) };
|
|
613
|
+
const mode = tab?.permissionMode || 'default';
|
|
614
|
+
if (mode === 'plan') {
|
|
615
|
+
const from = tab.planFrom && typeof tab.planFrom === 'object' ? { planFrom: { mode: String(tab.planFrom.mode || ''), ...(tab.planFrom.bypassChosen === true ? { bypassChosen: true } : {}) } } : {};
|
|
616
|
+
return { permissionMode: 'plan', modeChosen: tab?.modeChosen === true, bypassChosen: false, ...from, ...seq };
|
|
617
|
+
}
|
|
618
|
+
if (tab?.modeChosen !== true || (mode === BYPASS_MODE && tab?.bypassChosen !== true)) return { permissionMode: 'default', modeChosen: false, bypassChosen: false, ...seq };
|
|
619
|
+
return { permissionMode: mode, modeChosen: true, bypassChosen: mode === BYPASS_MODE, ...seq };
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* The mode a saved tab comes back in. `fresh` is what a new tab gets
|
|
624
|
+
* (`permissionMode`, `modeChosen`). A saved Bypass comes back as Bypass only
|
|
625
|
+
* with the record that the user picked it (`bypassChosen`, written by this
|
|
626
|
+
* build when they did). Any other Bypass in storage (the old Auto-approve
|
|
627
|
+
* toggle wrote it, an automation run's mode was saved as the tab's, an older
|
|
628
|
+
* build stored it) comes back as the mode of a tab that never picked one. A
|
|
629
|
+
* mode saved with the record that it was not picked (`modeChosen: false`: the
|
|
630
|
+
* session reported it from the settings) is not the tab's either; one saved
|
|
631
|
+
* before that record existed was the user's pick.
|
|
632
|
+
*/
|
|
633
|
+
export function restoredMode(saved, fresh = {}) {
|
|
634
|
+
const s = saved && typeof saved === 'object' ? saved : {};
|
|
635
|
+
const out = {
|
|
636
|
+
permissionMode: fresh.permissionMode || 'default',
|
|
637
|
+
planMode: false,
|
|
638
|
+
modeChosen: fresh.modeChosen === true,
|
|
639
|
+
bypassChosen: false,
|
|
640
|
+
planFrom: null,
|
|
641
|
+
modeSeq: Number.isSafeInteger(s.modeSeq) && s.modeSeq > 0 ? s.modeSeq : 0,
|
|
642
|
+
// Whether the tab may be in Bypass comes back as saved: only a report ends it.
|
|
643
|
+
mayBypass: s.sessionBypass === true,
|
|
644
|
+
actualMode: '',
|
|
645
|
+
actualSeq: undefined,
|
|
646
|
+
};
|
|
647
|
+
const mode = s.permissionMode || (s.planMode ? 'plan' : '');
|
|
648
|
+
if (s.planMode === true && mode !== 'plan' && !s.planFrom) {
|
|
649
|
+
// An older build's /plan set the flag and left the mode: the tab was in plan mode, over that mode.
|
|
650
|
+
const picked = mode === BYPASS_MODE ? s.bypassChosen === true : (isMode(mode) && (s.modeChosen === true || (typeof s.modeChosen !== 'boolean' && mode !== 'default')));
|
|
651
|
+
out.permissionMode = 'plan';
|
|
652
|
+
out.planMode = true;
|
|
653
|
+
if (picked) out.modeChosen = true; else if (s.modeChosen === false) out.modeChosen = false;
|
|
654
|
+
out.planFrom = picked ? (mode === BYPASS_MODE ? { mode: BYPASS_MODE, bypassChosen: true } : { mode }) : (out.modeChosen ? null : { mode: '' });
|
|
655
|
+
return out;
|
|
656
|
+
}
|
|
657
|
+
if (mode === BYPASS_MODE) {
|
|
658
|
+
if (s.bypassChosen === true) { out.permissionMode = BYPASS_MODE; out.modeChosen = true; out.bypassChosen = true; }
|
|
659
|
+
return out;
|
|
660
|
+
}
|
|
661
|
+
if (!ALL_PERMISSION_MODES.includes(mode)) return out;
|
|
662
|
+
if (mode === 'plan') {
|
|
663
|
+
out.permissionMode = 'plan';
|
|
664
|
+
out.planMode = true;
|
|
665
|
+
if (typeof s.modeChosen === 'boolean') out.modeChosen = s.modeChosen;
|
|
666
|
+
const from = s.planFrom && typeof s.planFrom === 'object' ? s.planFrom : null;
|
|
667
|
+
if (from) {
|
|
668
|
+
if (from.mode === BYPASS_MODE) out.planFrom = from.bypassChosen === true ? { mode: BYPASS_MODE, bypassChosen: true } : { mode: '' };
|
|
669
|
+
else out.planFrom = { mode: isMode(from.mode) && from.mode !== 'plan' ? from.mode : '' };
|
|
670
|
+
}
|
|
671
|
+
return out;
|
|
672
|
+
}
|
|
673
|
+
if (s.modeChosen === false) { out.permissionMode = 'default'; out.modeChosen = false; return out; }
|
|
674
|
+
out.permissionMode = mode;
|
|
675
|
+
out.modeChosen = s.modeChosen === true || mode !== 'default' || out.modeChosen;
|
|
676
|
+
return out;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/** Whether a model list from the session says the model in use supports auto mode. */
|
|
680
|
+
export function autoModeSupported(models, modelId) {
|
|
681
|
+
const list = Array.isArray(models) ? models : [];
|
|
682
|
+
if (!list.length) return false;
|
|
683
|
+
const id = String(modelId || '').toLowerCase();
|
|
684
|
+
// Rows come from the session (`value`) or from the catalog (`id`).
|
|
685
|
+
const exact = id ? list.find(m => String(m?.value || m?.id || '').toLowerCase() === id) : null;
|
|
686
|
+
if (exact) return exact.supportsAutoMode === true;
|
|
687
|
+
// No exact row (an alias, or the default model): offered if any model has it;
|
|
688
|
+
// the CLI refuses the switch when the one in use does not.
|
|
689
|
+
return list.some(m => m?.supportsAutoMode === true);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// ── Rule suggestions ──
|
|
693
|
+
|
|
694
|
+
export const DESTINATIONS = [
|
|
695
|
+
{ id: 'session', label: 'This session' },
|
|
696
|
+
{ id: 'localSettings', label: 'This project, only me' },
|
|
697
|
+
{ id: 'projectSettings', label: 'This project, shared' },
|
|
698
|
+
{ id: 'userSettings', label: 'All my projects' },
|
|
699
|
+
];
|
|
700
|
+
const DESTINATION_IDS = new Set(DESTINATIONS.map(d => d.id));
|
|
701
|
+
const DESTINATION_TEXT = { session: 'this session', localSettings: 'this project (only you)', projectSettings: 'this project (shared settings)', userSettings: 'all your projects', cliArg: 'this run' };
|
|
702
|
+
|
|
703
|
+
export function ruleText(rule) {
|
|
704
|
+
if (!rule?.toolName) return '';
|
|
705
|
+
return `${rule.toolName}${rule.ruleContent ? `(${rule.ruleContent})` : ''}`;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
const BEHAVIOR_VERB = { allow: 'Allow', deny: 'Deny', ask: 'Ask before' };
|
|
709
|
+
|
|
710
|
+
/** One PermissionUpdate in plain words, with the verb its behavior implies. */
|
|
711
|
+
export function describeSuggestion(s) {
|
|
712
|
+
if (!s || typeof s !== 'object') return '';
|
|
713
|
+
const rules = (Array.isArray(s.rules) ? s.rules : []).map(ruleText).filter(Boolean).join(', ');
|
|
714
|
+
const verb = BEHAVIOR_VERB[s.behavior] || 'Allow';
|
|
715
|
+
switch (s.type) {
|
|
716
|
+
case 'addRules': return rules ? `${verb} ${rules}` : '';
|
|
717
|
+
case 'replaceRules': return rules ? `Replace the ${String(s.behavior || 'allow')} rules with ${rules}` : `Clear the ${String(s.behavior || 'allow')} rules`;
|
|
718
|
+
case 'removeRules': return rules ? `Remove the ${String(s.behavior || 'allow')} rule ${rules}` : '';
|
|
719
|
+
case 'setMode': return s.mode ? `Switch to ${MODE_LABELS[s.mode] || s.mode} mode` : '';
|
|
720
|
+
case 'addDirectories': return Array.isArray(s.directories) && s.directories.length ? `Allow access to ${s.directories.join(', ')}` : '';
|
|
721
|
+
case 'removeDirectories': return Array.isArray(s.directories) && s.directories.length ? `Remove access to ${s.directories.join(', ')}` : '';
|
|
722
|
+
default: return clip(JSON.stringify(s), 120);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* What "Always" sends as updatedPermissions: the CLI's own suggestions, written
|
|
728
|
+
* to the chosen destination. With no suggestion there is nothing narrow to
|
|
729
|
+
* grant, except for an MCP tool, whose exact name is a rule of its own.
|
|
730
|
+
*/
|
|
731
|
+
export function alwaysUpdates(req, destination = 'session') {
|
|
732
|
+
if (req?.suppress_always) return [];
|
|
733
|
+
const dest = DESTINATION_IDS.has(destination) ? destination : 'session';
|
|
734
|
+
const suggestions = (Array.isArray(req?.suggestions) ? req.suggestions : []).filter(s => s && typeof s === 'object' && describeSuggestion(s));
|
|
735
|
+
if (suggestions.length) return suggestions.map(s => ({ ...s, destination: dest }));
|
|
736
|
+
const tool = String(req?.tool_name || '');
|
|
737
|
+
if (tool.startsWith('mcp__')) return [{ type: 'addRules', rules: [{ toolName: tool }], behavior: 'allow', destination: dest }];
|
|
738
|
+
return [];
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/** A granted update as a line of the /permissions view. */
|
|
742
|
+
export function grantedRuleLine(update) {
|
|
743
|
+
const text = describeSuggestion(update);
|
|
744
|
+
if (!text) return '';
|
|
745
|
+
return `${text} · ${DESTINATION_TEXT[update.destination] || update.destination || 'this session'}`;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// ── The /permissions view ──
|
|
749
|
+
|
|
750
|
+
const SCOPE_TITLES = [['user', 'All my projects'], ['project', 'This project, shared'], ['local', 'This project, only me']];
|
|
751
|
+
const RULE_LIST_LABELS = [['allow', 'Allow'], ['ask', 'Ask'], ['deny', 'Deny'], ['additionalDirectories', 'Directory']];
|
|
752
|
+
const MAX_RULE_ROWS = 80;
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* The rules of the settings files (GET /api/claude-code/permission-rules) as
|
|
756
|
+
* sections of the card: one row per rule, so each can be removed by itself.
|
|
757
|
+
* @returns [{ scope, title, error, defaultMode, items: [{ list, label, rule }], more }]
|
|
758
|
+
*/
|
|
759
|
+
export function permissionRuleSections(rules) {
|
|
760
|
+
const out = [];
|
|
761
|
+
for (const [scope, title] of SCOPE_TITLES) {
|
|
762
|
+
const s = rules?.[scope];
|
|
763
|
+
if (!s?.exists) continue;
|
|
764
|
+
const items = [];
|
|
765
|
+
if (!s.error) {
|
|
766
|
+
for (const [list, label] of RULE_LIST_LABELS) {
|
|
767
|
+
for (const rule of Array.isArray(s[list]) ? s[list] : []) if (typeof rule === 'string' && rule) items.push({ list, label, rule });
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
out.push({ scope, title, error: s.error || '', defaultMode: s.error ? '' : (s.defaultMode || ''), items: items.slice(0, MAX_RULE_ROWS), more: Math.max(0, items.length - MAX_RULE_ROWS) });
|
|
771
|
+
}
|
|
772
|
+
return out;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/** True when a granted update lives only in the running session (it has no settings file to be removed from). */
|
|
776
|
+
export function hasSessionRules(granted) {
|
|
777
|
+
return (Array.isArray(granted) ? granted : []).some(u => u && typeof u === 'object' && (!u.destination || u.destination === 'session'));
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// ── The prompt's context ──
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* What the CLI said about a permission request, ready for the card.
|
|
784
|
+
* `rows` are [label, text]; every string is display text from the CLI or from
|
|
785
|
+
* configuration (an MCP server's name is untrusted) and must be set as text.
|
|
786
|
+
*/
|
|
787
|
+
export function permissionContext(req) {
|
|
788
|
+
const r = req && typeof req === 'object' ? req : {};
|
|
789
|
+
const rows = [];
|
|
790
|
+
if (r.decision_reason) rows.push(['Why', clip(plain(r.decision_reason), 400)]);
|
|
791
|
+
if (r.blocked_path) rows.push(['Path', clip(plain(r.blocked_path), 300)]);
|
|
792
|
+
if (r.mcp_server?.name) rows.push(['MCP server', `${clip(plain(r.mcp_server.name), 80)}${r.mcp_server.source ? ` (${plain(r.mcp_server.source)})` : ''}`]);
|
|
793
|
+
if (r.matched_ask_rule) {
|
|
794
|
+
const rule = ruleText({ toolName: r.matched_ask_rule.toolName, ruleContent: r.matched_ask_rule.ruleContent });
|
|
795
|
+
rows.push(['Asked because', `your ask rule ${rule || '(unnamed)'}${r.matched_ask_rule.source ? ` in ${plain(r.matched_ask_rule.source)}` : ''}`]);
|
|
796
|
+
}
|
|
797
|
+
if (r.agent_id) rows.push(['From', `subagent ${clip(plain(r.agent_id), 40)}`]);
|
|
798
|
+
return {
|
|
799
|
+
title: clip(plain(r.title), 300),
|
|
800
|
+
displayName: clip(plain(r.display_name), 80),
|
|
801
|
+
description: clip(plain(r.description), 400),
|
|
802
|
+
rows,
|
|
803
|
+
defaultToNo: r.default_to_no === true,
|
|
804
|
+
canAlways: r.suppress_always !== true && alwaysUpdates(r).length > 0,
|
|
805
|
+
toolUseId: r.tool_use_id || '',
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
// ── MCP elicitation ──
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* The fields of an elicitation form, from the server's requestedSchema (a flat
|
|
813
|
+
* object of primitive properties, per the MCP spec).
|
|
814
|
+
*/
|
|
815
|
+
export function elicitationFields(schema) {
|
|
816
|
+
const props = schema && typeof schema === 'object' && schema.properties && typeof schema.properties === 'object' ? schema.properties : {};
|
|
817
|
+
const required = new Set(Array.isArray(schema?.required) ? schema.required : []);
|
|
818
|
+
const fields = [];
|
|
819
|
+
for (const [name, raw] of Object.entries(props)) {
|
|
820
|
+
const p = raw && typeof raw === 'object' ? raw : {};
|
|
821
|
+
const options = Array.isArray(p.enum)
|
|
822
|
+
? p.enum.map((v, i) => ({ value: v, label: String(Array.isArray(p.enumNames) && p.enumNames[i] != null ? p.enumNames[i] : v) }))
|
|
823
|
+
: (Array.isArray(p.oneOf) ? p.oneOf.filter(o => o && 'const' in o).map(o => ({ value: o.const, label: String(o.title ?? o.const) })) : null);
|
|
824
|
+
const type = options?.length ? 'choice'
|
|
825
|
+
: p.type === 'boolean' ? 'boolean'
|
|
826
|
+
: (p.type === 'number' || p.type === 'integer') ? 'number'
|
|
827
|
+
: 'text';
|
|
828
|
+
fields.push({
|
|
829
|
+
name,
|
|
830
|
+
type,
|
|
831
|
+
integer: p.type === 'integer',
|
|
832
|
+
label: clip(plain(p.title || name), 80),
|
|
833
|
+
description: clip(plain(p.description), 300),
|
|
834
|
+
required: required.has(name),
|
|
835
|
+
options: options?.length ? options : null,
|
|
836
|
+
format: typeof p.format === 'string' ? p.format : '',
|
|
837
|
+
default: p.default,
|
|
838
|
+
min: Number.isFinite(p.minimum) ? p.minimum : null,
|
|
839
|
+
max: Number.isFinite(p.maximum) ? p.maximum : null,
|
|
840
|
+
minLength: Number.isFinite(p.minLength) ? p.minLength : null,
|
|
841
|
+
maxLength: Number.isFinite(p.maxLength) ? p.maxLength : null,
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
return fields;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* Typed content from what the form holds. `values` maps field name to the raw
|
|
849
|
+
* control value (string, or boolean for a checkbox).
|
|
850
|
+
* @returns {{ ok: boolean, content: object, errors: Record<string, string> }}
|
|
851
|
+
*/
|
|
852
|
+
export function collectElicitation(fields, values) {
|
|
853
|
+
const content = {};
|
|
854
|
+
const errors = {};
|
|
855
|
+
for (const f of Array.isArray(fields) ? fields : []) {
|
|
856
|
+
const raw = values?.[f.name];
|
|
857
|
+
if (f.type === 'boolean') { content[f.name] = raw === true || raw === 'true'; continue; }
|
|
858
|
+
const text = raw == null ? '' : String(raw).trim();
|
|
859
|
+
if (!text) {
|
|
860
|
+
if (f.required) errors[f.name] = 'Required';
|
|
861
|
+
continue;
|
|
862
|
+
}
|
|
863
|
+
if (f.type === 'number') {
|
|
864
|
+
const n = Number(text);
|
|
865
|
+
if (!Number.isFinite(n) || (f.integer && !Number.isInteger(n))) { errors[f.name] = f.integer ? 'Enter a whole number' : 'Enter a number'; continue; }
|
|
866
|
+
if (f.min != null && n < f.min) { errors[f.name] = `At least ${f.min}`; continue; }
|
|
867
|
+
if (f.max != null && n > f.max) { errors[f.name] = `At most ${f.max}`; continue; }
|
|
868
|
+
content[f.name] = n;
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
if (f.type === 'choice') {
|
|
872
|
+
const opt = f.options.find(o => String(o.value) === text);
|
|
873
|
+
if (!opt) { errors[f.name] = 'Pick one of the options'; continue; }
|
|
874
|
+
content[f.name] = opt.value;
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
877
|
+
if (f.minLength != null && text.length < f.minLength) { errors[f.name] = `At least ${f.minLength} characters`; continue; }
|
|
878
|
+
if (f.maxLength != null && text.length > f.maxLength) { errors[f.name] = `At most ${f.maxLength} characters`; continue; }
|
|
879
|
+
if (f.format === 'email' && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text)) { errors[f.name] = 'Enter an email address'; continue; }
|
|
880
|
+
if (f.format === 'uri' && !/^[a-z][a-z0-9+.-]*:\S+$/i.test(text)) { errors[f.name] = 'Enter a URL'; continue; }
|
|
881
|
+
content[f.name] = text;
|
|
882
|
+
}
|
|
883
|
+
return { ok: Object.keys(errors).length === 0, content, errors };
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/** The address a URL-mode elicitation sends the user to, when it is safe to open. */
|
|
887
|
+
export function elicitationUrl(request) {
|
|
888
|
+
const url = String(request?.url || '');
|
|
889
|
+
return /^https?:\/\//i.test(url) ? url : '';
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// ── Tool policy ──
|
|
893
|
+
|
|
894
|
+
export const TOOL_POLICIES = {
|
|
895
|
+
full: { label: 'All tools', hint: 'No tool is removed' },
|
|
896
|
+
'read-only': { label: 'Read only', hint: 'No edits, no commands: Edit, Write, NotebookEdit and Bash are removed' },
|
|
897
|
+
'no-web': { label: 'No web', hint: 'WebFetch and WebSearch are removed' },
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
export function toolPolicyId(value) {
|
|
901
|
+
const v = String(value || '').trim().toLowerCase().replace(/[\s_]+/g, '-');
|
|
902
|
+
if (v === 'readonly') return 'read-only';
|
|
903
|
+
if (v === 'noweb' || v === 'no-network' || v === 'offline') return 'no-web';
|
|
904
|
+
return TOOL_POLICIES[v] ? v : '';
|
|
905
|
+
}
|