@bastani/atomic 0.9.78 → 0.9.79-alpha.1
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 +39 -0
- package/dist/builtin/intercom/CHANGELOG.md +12 -0
- package/dist/builtin/intercom/broker/broker.ts +198 -72
- package/dist/builtin/intercom/broker/client-message-validation.ts +38 -0
- package/dist/builtin/intercom/broker/client.ts +150 -11
- package/dist/builtin/intercom/broker/delivery-failure-reason.ts +1 -0
- package/dist/builtin/intercom/broker/departed-children.ts +23 -0
- package/dist/builtin/intercom/broker/hosted-session-errors.ts +188 -0
- package/dist/builtin/intercom/broker/hosted-sessions.ts +113 -0
- package/dist/builtin/intercom/broker/multinode-router.ts +7 -2
- package/dist/builtin/intercom/broker/presence-handler.ts +2 -1
- package/dist/builtin/intercom/broker/protocol-version.ts +6 -1
- package/dist/builtin/intercom/broker/recipient-gone-errors.ts +46 -5
- package/dist/builtin/intercom/broker/released-reply-errors.ts +1 -1
- package/dist/builtin/intercom/broker/send-handler.ts +19 -3
- package/dist/builtin/intercom/broker/socket-writes.ts +20 -1
- package/dist/builtin/intercom/hosted-session-timeout-error.ts +59 -0
- package/dist/builtin/intercom/index.bundle.mjs +634 -125
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +41 -3
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +8 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +90 -34
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +9 -0
- package/dist/builtin/workflows/builtin/{chunk-89we7r4p.js → chunk-5hrzxynt.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-8yfssw01.js → chunk-m56qhe4b.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-wh2p4qjg.js → chunk-x8m4t2jy.js} +182 -33
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +1243 -230
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +854 -170
- package/dist/builtin/workflows/src/index.js +854 -170
- package/dist/builtin/workflows/src/local-worker-entry.mjs +854 -170
- package/dist/cli/startup-progress.d.ts +30 -0
- package/dist/cli/startup-progress.d.ts.map +1 -0
- package/dist/cli/startup-progress.js +78 -0
- package/dist/cli/startup-progress.js.map +1 -0
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +3 -0
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +2 -0
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +2 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-state.d.ts +12 -4
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +82 -15
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +3 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/builtin-resource-loader.d.ts.map +1 -1
- package/dist/core/builtin-resource-loader.js +3 -0
- package/dist/core/builtin-resource-loader.js.map +1 -1
- package/dist/core/debug.d.ts +2 -0
- package/dist/core/debug.d.ts.map +1 -1
- package/dist/core/debug.js +13 -0
- package/dist/core/debug.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts +5 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +57 -20
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/template.js +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/workflow-activity-hub.d.ts +7 -0
- package/dist/core/extensions/workflow-activity-hub.d.ts.map +1 -1
- package/dist/core/extensions/workflow-activity-hub.js +104 -6
- package/dist/core/extensions/workflow-activity-hub.js.map +1 -1
- package/dist/core/keybindings.d.ts +0 -8
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mandatory-resource-loader.d.ts.map +1 -1
- package/dist/core/mandatory-resource-loader.js +3 -0
- package/dist/core/mandatory-resource-loader.js.map +1 -1
- package/dist/core/resume/session-resume.d.ts +7 -1
- package/dist/core/resume/session-resume.d.ts.map +1 -1
- package/dist/core/resume/session-resume.js +136 -16
- package/dist/core/resume/session-resume.js.map +1 -1
- package/dist/core/session-history-index.d.ts +31 -0
- package/dist/core/session-history-index.d.ts.map +1 -0
- package/dist/core/session-history-index.js +82 -0
- package/dist/core/session-history-index.js.map +1 -0
- package/dist/core/session-manager-core.d.ts +3 -0
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +22 -17
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +3 -3
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +6 -5
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/storage/session/history-load-observer.d.ts +11 -0
- package/dist/core/storage/session/history-load-observer.d.ts.map +1 -0
- package/dist/core/storage/session/history-load-observer.js +25 -0
- package/dist/core/storage/session/history-load-observer.js.map +1 -0
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/sql-session-store.js +6 -0
- package/dist/core/storage/session/sql-session-store.js.map +1 -1
- package/dist/core/tool-deactivation.d.ts +11 -0
- package/dist/core/tool-deactivation.d.ts.map +1 -0
- package/dist/core/tool-deactivation.js +13 -0
- package/dist/core/tool-deactivation.js.map +1 -0
- package/dist/core/tool-status.d.ts +6 -1
- package/dist/core/tool-status.d.ts.map +1 -1
- package/dist/core/tool-status.js +11 -3
- package/dist/core/tool-status.js.map +1 -1
- package/dist/extensions/llama/errors.js +1 -1
- package/dist/extensions/llama/errors.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.js +1 -1
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/main-session.d.ts +14 -2
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +42 -9
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -2
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +13 -4
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/task-detail.d.ts +1 -1
- package/dist/modes/interactive/components/task-detail.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-detail.js +1 -3
- package/dist/modes/interactive/components/task-detail.js.map +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +1 -7
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-navigation.d.ts +0 -1
- package/dist/modes/interactive/components/task-navigation.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-navigation.js +1 -3
- package/dist/modes/interactive/components/task-navigation.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +5 -9
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +8 -5
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +16 -10
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +2 -0
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-unavailable-tools.d.ts +20 -0
- package/dist/modes/interactive/interactive-unavailable-tools.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-unavailable-tools.js +40 -0
- package/dist/modes/interactive/interactive-unavailable-tools.js.map +1 -0
- package/dist/modes/interactive-engine/remote-component.js +1 -1
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/docs/background-tasks.md +1 -1
- package/docs/extensions/api-reference.md +1 -1
- package/docs/extensions/events.md +2 -0
- package/docs/intercom/operations.md +2 -2
- package/docs/intercom/reference.md +12 -1
- package/docs/keybindings.md +2 -3
- package/docs/llama-cpp.md +9 -10
- package/docs/models/reference.md +1 -1
- package/docs/models-configuration.md +1 -1
- package/docs/sessions.md +6 -2
- package/docs/subagents.md +3 -1
- package/docs/usage.md +1 -1
- package/docs/workflows/operations.md +2 -2
- package/docs/worktree-snapshots.md +3 -1
- package/npm-shrinkwrap.json +32 -32
- package/package.json +4 -4
- package/schemas/keybindings.schema.json +0 -4
- package/schemas/models.schema.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keybindings.js","sourceRoot":"","sources":["../../src/core/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,eAAe,EACf,kBAAkB,IAAI,qBAAqB,GAC3C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,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CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,MAAM,OAAO,kBAAmB,SAAQ,qBAAqB;IACpD,UAAU,CAAqB;IAEvC,YAAY,YAAY,GAAsB,EAAE,EAAE,UAAmB;QACpE,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAW,WAAW,EAAE;QAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QACtD,MAAM,YAAY,GAAG,kBAAkB,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACjE,OAAO,IAAI,kBAAkB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,MAAM;QACL,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAC7B,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,kBAAkB;QACjB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACnC,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,IAAY;QACvC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS;YAAE,OAAO,EAAE,CAAC;QAC1B,OAAO,mBAAmB,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;CACD","sourcesContent":["import {\n\ttype Keybinding,\n\ttype KeybindingDefinitions,\n\ttype KeybindingsConfig,\n\ttype KeyId,\n\tTUI_KEYBINDINGS,\n\tKeybindingsManager as TuiKeybindingsManager,\n} from \"@earendil-works/pi-tui\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getAgentDir } from \"../config.js\";\nimport { stripBom } from \"../utils/text.ts\";\n\nexport function useWindowsKeybindings(\n\tplatform: NodeJS.Platform = process.platform,\n\tenv: NodeJS.ProcessEnv = process.env,\n): boolean {\n\treturn platform === \"win32\" || (platform === \"linux\" && Boolean(env.WSL_DISTRO_NAME || env.WSL_INTEROP));\n}\n\nconst windowsKeybindings = useWindowsKeybindings();\n\nconst APP_KEYBINDINGS = {\n\t\"app.workflows.scrollUp\": { defaultKeys: [\"alt+k\", \"alt+pageUp\"], description: \"Scroll workflows up\" },\n\t\"app.workflows.scrollDown\": { defaultKeys: [\"alt+j\", \"alt+pageDown\"], description: \"Scroll workflows down\" },\n\t\"app.interrupt\": { defaultKeys: \"escape\", description: \"Cancel or abort\" },\n\t\"app.clear\": { defaultKeys: \"ctrl+c\", description: \"Clear editor\" },\n\t\"app.exit\": { defaultKeys: \"ctrl+d\", description: \"Exit when editor is empty\" },\n\t\"app.suspend\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? \"alt+z\" : \"ctrl+z\",\n\t\tdescription: process.platform === \"win32\" ? \"Open PowerShell subshell\" : \"Suspend to background\",\n\t},\n\t\"app.thinking.cycle\": {\n\t\tdefaultKeys: \"shift+tab\",\n\t\tdescription: \"Cycle thinking level\",\n\t},\n\t\"app.model.cycleForward\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Cycle to next model\",\n\t},\n\t\"app.model.cycleBackward\": {\n\t\tdefaultKeys: windowsKeybindings ? \"alt+p\" : \"shift+ctrl+p\",\n\t\tdescription: \"Cycle to previous model\",\n\t},\n\t\"app.model.select\": { defaultKeys: \"ctrl+l\", description: \"Open model selector\" },\n\t\"app.tools.expand\": { defaultKeys: \"ctrl+o\", description: \"Toggle tool output\" },\n\t\"app.tasks.open\": { defaultKeys: [], description: \"Open task list\" },\n\t\"app.tasks.inspect\": { defaultKeys: \"enter\", description: \"Inspect selected task\" },\n\t\"app.tasks.foreground\": { defaultKeys: [], description: \"Wait for selected task\" },\n\t\"app.tasks.cancel\": { defaultKeys: [], description: \"Cancel selected task with confirmation\" },\n\t\"app.tasks.input\": { defaultKeys: [], description: \"Input to selected task\" },\n\t\"app.thinking.toggle\": {\n\t\tdefaultKeys: \"ctrl+t\",\n\t\tdescription: \"Toggle thinking blocks\",\n\t},\n\t\"app.session.toggleNamedFilter\": {\n\t\tdefaultKeys: \"ctrl+n\",\n\t\tdescription: \"Toggle named session filter\",\n\t},\n\t\"app.editor.external\": {\n\t\tdefaultKeys: \"ctrl+g\",\n\t\tdescription: \"Open external editor\",\n\t},\n\t\"app.auth.copyUrl\": { defaultKeys: \"ctrl+x\", description: \"Copy OAuth sign-in URL\" },\n\t\"app.message.followUp\": {\n\t\tdefaultKeys: windowsKeybindings ? \"ctrl+q\" : \"alt+enter\",\n\t\tdescription: \"Queue follow-up message\",\n\t},\n\t\"app.message.dequeue\": {\n\t\tdefaultKeys: windowsKeybindings ? \"alt+q\" : \"alt+up\",\n\t\tdescription: \"Restore queued messages\",\n\t},\n\t\"app.clipboard.pasteImage\": {\n\t\tdefaultKeys: windowsKeybindings ? [\"alt+v\", \"ctrl+v\"] : \"ctrl+v\",\n\t\tdescription: \"Paste files on macOS, images, or text from clipboard\",\n\t},\n\t\"app.session.new\": { defaultKeys: [], description: \"Start a new session\" },\n\t\"app.session.tree\": { defaultKeys: [], description: \"Open session tree\" },\n\t\"app.session.fork\": { defaultKeys: [], description: \"Fork current session\" },\n\t\"app.session.resume\": { defaultKeys: [], description: \"Resume a session\" },\n\t\"app.tree.foldOrUp\": {\n\t\tdefaultKeys: [\"ctrl+left\", \"alt+left\"],\n\t\tdescription: \"Fold tree branch or move up\",\n\t},\n\t\"app.tree.unfoldOrDown\": {\n\t\tdefaultKeys: [\"ctrl+right\", \"alt+right\"],\n\t\tdescription: \"Unfold tree branch or move down\",\n\t},\n\t\"app.tree.editLabel\": {\n\t\tdefaultKeys: \"shift+l\",\n\t\tdescription: \"Edit tree label\",\n\t},\n\t\"app.tree.toggleLabelTimestamp\": {\n\t\tdefaultKeys: \"shift+t\",\n\t\tdescription: \"Toggle tree label timestamps\",\n\t},\n\t\"app.session.togglePath\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Toggle session path display\",\n\t},\n\t\"app.session.toggleSort\": {\n\t\tdefaultKeys: \"ctrl+s\",\n\t\tdescription: \"Toggle session sort mode\",\n\t},\n\t\"app.session.rename\": {\n\t\tdefaultKeys: \"ctrl+r\",\n\t\tdescription: \"Rename session\",\n\t},\n\t\"app.session.delete\": {\n\t\tdefaultKeys: \"ctrl+d\",\n\t\tdescription: \"Delete session\",\n\t},\n\t\"app.session.deleteNoninvasive\": {\n\t\tdefaultKeys: \"ctrl+backspace\",\n\t\tdescription: \"Delete session when query is empty\",\n\t},\n\t\"app.models.enableAll\": {\n\t\tdefaultKeys: \"ctrl+a\",\n\t\tdescription: \"Enable all models\",\n\t},\n\t\"app.models.clearAll\": {\n\t\tdefaultKeys: \"ctrl+x\",\n\t\tdescription: \"Clear all models\",\n\t},\n\t\"app.models.toggleProvider\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Toggle all models for provider\",\n\t},\n\t\"app.models.reorderUp\": {\n\t\tdefaultKeys: windowsKeybindings ? \"alt+q\" : \"alt+up\",\n\t\tdescription: \"Move model up in order\",\n\t},\n\t\"app.models.reorderDown\": {\n\t\tdefaultKeys: \"alt+down\",\n\t\tdescription: \"Move model down in order\",\n\t},\n\t\"app.tree.filter.default\": {\n\t\tdefaultKeys: \"ctrl+d\",\n\t\tdescription: \"Tree filter: default view\",\n\t},\n\t\"app.tree.filter.noTools\": {\n\t\tdefaultKeys: \"ctrl+t\",\n\t\tdescription: \"Tree filter: hide tool results\",\n\t},\n\t\"app.tree.filter.userOnly\": {\n\t\tdefaultKeys: \"ctrl+u\",\n\t\tdescription: \"Tree filter: user messages only\",\n\t},\n\t\"app.tree.filter.labeledOnly\": {\n\t\tdefaultKeys: \"ctrl+l\",\n\t\tdescription: \"Tree filter: labeled entries only\",\n\t},\n\t\"app.tree.filter.all\": {\n\t\tdefaultKeys: \"ctrl+a\",\n\t\tdescription: \"Tree filter: show all entries\",\n\t},\n\t\"app.tree.filter.cycleForward\": {\n\t\tdefaultKeys: \"ctrl+o\",\n\t\tdescription: \"Tree filter: cycle forward\",\n\t},\n\t\"app.tree.filter.cycleBackward\": {\n\t\tdefaultKeys: \"shift+ctrl+o\",\n\t\tdescription: \"Tree filter: cycle backward\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nexport type AppKeybinding = keyof typeof APP_KEYBINDINGS;\nexport type AppKeybindings = { [K in AppKeybinding]: true };\n\ndeclare module \"@earendil-works/pi-tui\" {\n\tinterface Keybindings extends AppKeybindings {}\n}\n\nexport const KEYBINDINGS = {\n\t...TUI_KEYBINDINGS,\n\t\"tui.editor.undo\": {\n\t\t...TUI_KEYBINDINGS[\"tui.editor.undo\"],\n\t\tdefaultKeys: process.platform === \"win32\" ? \"ctrl+z\" : windowsKeybindings ? \"alt+z\" : \"ctrl+-\",\n\t},\n\t\"tui.altScreen.previousPrompt\": {\n\t\t...TUI_KEYBINDINGS[\"tui.altScreen.previousPrompt\"],\n\t\tdefaultKeys: windowsKeybindings ? \"ctrl+up\" : [\"ctrl+shift+up\", \"ctrl+up\"],\n\t},\n\t\"tui.altScreen.nextPrompt\": {\n\t\t...TUI_KEYBINDINGS[\"tui.altScreen.nextPrompt\"],\n\t\tdefaultKeys: windowsKeybindings ? \"ctrl+down\" : [\"ctrl+shift+down\", \"ctrl+down\"],\n\t},\n\t// Unbind pi-tui 0.84.2's transcript-search defaults. Atomic no longer\n\t// exposes a find box over the transcript or an attached stage chat.\n\t\"tui.altScreen.search\": { defaultKeys: [], description: \"Search the rendered transcript (disabled)\" },\n\t\"tui.altScreen.searchNext\": { defaultKeys: [], description: \"Select the next search match (disabled)\" },\n\t\"tui.altScreen.searchPrevious\": { defaultKeys: [], description: \"Select the previous search match (disabled)\" },\n\t\"tui.altScreen.searchClose\": { defaultKeys: [], description: \"Close transcript search (disabled)\" },\n\t...APP_KEYBINDINGS,\n} as const satisfies KeybindingDefinitions;\n\nconst KEYBINDING_NAME_MIGRATIONS = {\n\tcursorUp: \"tui.editor.cursorUp\",\n\tcursorDown: \"tui.editor.cursorDown\",\n\tcursorLeft: \"tui.editor.cursorLeft\",\n\tcursorRight: \"tui.editor.cursorRight\",\n\tcursorWordLeft: \"tui.editor.cursorWordLeft\",\n\tcursorWordRight: \"tui.editor.cursorWordRight\",\n\tcursorLineStart: \"tui.editor.cursorLineStart\",\n\tcursorLineEnd: \"tui.editor.cursorLineEnd\",\n\tjumpForward: \"tui.editor.jumpForward\",\n\tjumpBackward: \"tui.editor.jumpBackward\",\n\tpageUp: \"tui.editor.pageUp\",\n\tpageDown: \"tui.editor.pageDown\",\n\tdeleteCharBackward: \"tui.editor.deleteCharBackward\",\n\tdeleteCharForward: \"tui.editor.deleteCharForward\",\n\tdeleteWordBackward: \"tui.editor.deleteWordBackward\",\n\tdeleteWordForward: \"tui.editor.deleteWordForward\",\n\tdeleteToLineStart: \"tui.editor.deleteToLineStart\",\n\tdeleteToLineEnd: \"tui.editor.deleteToLineEnd\",\n\tyank: \"tui.editor.yank\",\n\tyankPop: \"tui.editor.yankPop\",\n\tundo: \"tui.editor.undo\",\n\tnewLine: \"tui.input.newLine\",\n\tsubmit: \"tui.input.submit\",\n\ttab: \"tui.input.tab\",\n\tcopy: \"tui.input.copy\",\n\tselectUp: \"tui.select.up\",\n\tselectDown: \"tui.select.down\",\n\tselectPageUp: \"tui.select.pageUp\",\n\tselectPageDown: \"tui.select.pageDown\",\n\tselectConfirm: \"tui.select.confirm\",\n\tselectCancel: \"tui.select.cancel\",\n\tinterrupt: \"app.interrupt\",\n\tclear: \"app.clear\",\n\texit: \"app.exit\",\n\tsuspend: \"app.suspend\",\n\tcycleThinkingLevel: \"app.thinking.cycle\",\n\tcycleModelForward: \"app.model.cycleForward\",\n\tcycleModelBackward: \"app.model.cycleBackward\",\n\tselectModel: \"app.model.select\",\n\texpandTools: \"app.tools.expand\",\n\ttoggleThinking: \"app.thinking.toggle\",\n\ttoggleSessionNamedFilter: \"app.session.toggleNamedFilter\",\n\texternalEditor: \"app.editor.external\",\n\tfollowUp: \"app.message.followUp\",\n\tdequeue: \"app.message.dequeue\",\n\tpasteImage: \"app.clipboard.pasteImage\",\n\tnewSession: \"app.session.new\",\n\ttree: \"app.session.tree\",\n\tfork: \"app.session.fork\",\n\tresume: \"app.session.resume\",\n\ttreeFoldOrUp: \"app.tree.foldOrUp\",\n\ttreeUnfoldOrDown: \"app.tree.unfoldOrDown\",\n\ttreeEditLabel: \"app.tree.editLabel\",\n\ttreeToggleLabelTimestamp: \"app.tree.toggleLabelTimestamp\",\n\ttoggleSessionPath: \"app.session.togglePath\",\n\ttoggleSessionSort: \"app.session.toggleSort\",\n\trenameSession: \"app.session.rename\",\n\tdeleteSession: \"app.session.delete\",\n\tdeleteSessionNoninvasive: \"app.session.deleteNoninvasive\",\n} as const satisfies Record<string, Keybinding>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isLegacyKeybindingName(key: string): key is keyof typeof KEYBINDING_NAME_MIGRATIONS {\n\treturn key in KEYBINDING_NAME_MIGRATIONS;\n}\n\nfunction toKeybindingsConfig(value: unknown): KeybindingsConfig {\n\tif (!isRecord(value)) return {};\n\n\tconst config: KeybindingsConfig = {};\n\tfor (const [key, binding] of Object.entries(value)) {\n\t\tif (key === \"$schema\") continue;\n\t\tif (typeof binding === \"string\") {\n\t\t\tconfig[key] = binding as KeyId;\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(binding) && binding.every((entry) => typeof entry === \"string\")) {\n\t\t\tconfig[key] = binding as KeyId[];\n\t\t}\n\t}\n\treturn config;\n}\n\nexport function migrateKeybindingsConfig(rawConfig: Record<string, unknown>): {\n\tconfig: Record<string, unknown>;\n\tmigrated: boolean;\n} {\n\tconst config: Record<string, unknown> = {};\n\tlet migrated = false;\n\n\tfor (const [key, value] of Object.entries(rawConfig)) {\n\t\tconst nextKey = isLegacyKeybindingName(key) ? KEYBINDING_NAME_MIGRATIONS[key] : key;\n\t\tif (nextKey !== key) {\n\t\t\tmigrated = true;\n\t\t}\n\t\tif (key !== nextKey && Object.hasOwn(rawConfig, nextKey)) {\n\t\t\tmigrated = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconfig[nextKey] = value;\n\t}\n\n\treturn { config: orderKeybindingsConfig(config), migrated };\n}\n\nfunction orderKeybindingsConfig(config: Record<string, unknown>): Record<string, unknown> {\n\tconst ordered: Record<string, unknown> = {};\n\tfor (const keybinding of Object.keys(KEYBINDINGS)) {\n\t\tif (Object.hasOwn(config, keybinding)) {\n\t\t\tordered[keybinding] = config[keybinding];\n\t\t}\n\t}\n\n\tconst extras = Object.keys(config)\n\t\t.filter((key) => !Object.hasOwn(ordered, key))\n\t\t.sort();\n\tfor (const key of extras) {\n\t\tordered[key] = config[key];\n\t}\n\n\treturn ordered;\n}\n\nfunction loadRawConfig(path: string): Record<string, unknown> | undefined {\n\tif (!existsSync(path)) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(stripBom(readFileSync(path, \"utf-8\"))) as unknown;\n\t\treturn isRecord(parsed) ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport class KeybindingsManager extends TuiKeybindingsManager {\n\tprivate configPath: string | undefined;\n\n\tconstructor(userBindings: KeybindingsConfig = {}, configPath?: string) {\n\t\tsuper(KEYBINDINGS, userBindings);\n\t\tthis.configPath = configPath;\n\t}\n\n\tstatic create(agentDir: string = getAgentDir()): KeybindingsManager {\n\t\tconst configPath = join(agentDir, \"keybindings.json\");\n\t\tconst userBindings = KeybindingsManager.loadFromFile(configPath);\n\t\treturn new KeybindingsManager(userBindings, configPath);\n\t}\n\n\treload(): void {\n\t\tif (!this.configPath) return;\n\t\tthis.setUserBindings(KeybindingsManager.loadFromFile(this.configPath));\n\t}\n\n\tgetEffectiveConfig(): KeybindingsConfig {\n\t\treturn this.getResolvedBindings();\n\t}\n\n\tprivate static loadFromFile(path: string): KeybindingsConfig {\n\t\tconst rawConfig = loadRawConfig(path);\n\t\tif (!rawConfig) return {};\n\t\treturn toKeybindingsConfig(migrateKeybindingsConfig(rawConfig).config);\n\t}\n}\n\nexport type { Keybinding, KeybindingsConfig, KeyId };\n"]}
|
|
1
|
+
{"version":3,"file":"keybindings.js","sourceRoot":"","sources":["../../src/core/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,eAAe,EACf,kBAAkB,IAAI,qBAAqB,GAC3C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,UAAU,qBAAqB,CACpC,QAAQ,GAAoB,OAAO,CAAC,QAAQ,EAC5C,GAAG,GAAsB,OAAO,CAAC,GAAG;IAEpC,OAAO,QAAQ,KAAK,OAAO,IAAI,CAAC,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1G,CAAC;AAED,MAAM,kBAAkB,GAAG,qBAAqB,EAAE,CAAC;AAEnD,MAAM,eAAe,GAAG;IACvB,wBAAwB,EAAE,EAAE,WAAW,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACtG,0BAA0B,EAAE,EAAE,WAAW,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE;IAC5G,eAAe,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,WA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AC,UAAU,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,kBAAkB;QACjB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACnC,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,IAAY;QACvC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS;YAAE,OAAO,EAAE,CAAC;QAC1B,OAAO,mBAAmB,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;CACD","sourcesContent":["import {\n\ttype Keybinding,\n\ttype KeybindingDefinitions,\n\ttype KeybindingsConfig,\n\ttype KeyId,\n\tTUI_KEYBINDINGS,\n\tKeybindingsManager as TuiKeybindingsManager,\n} from \"@earendil-works/pi-tui\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getAgentDir } from \"../config.js\";\nimport { stripBom } from \"../utils/text.ts\";\n\nexport function useWindowsKeybindings(\n\tplatform: NodeJS.Platform = process.platform,\n\tenv: NodeJS.ProcessEnv = process.env,\n): boolean {\n\treturn platform === \"win32\" || (platform === \"linux\" && Boolean(env.WSL_DISTRO_NAME || env.WSL_INTEROP));\n}\n\nconst windowsKeybindings = useWindowsKeybindings();\n\nconst APP_KEYBINDINGS = {\n\t\"app.workflows.scrollUp\": { defaultKeys: [\"alt+k\", \"alt+pageUp\"], description: \"Scroll workflows up\" },\n\t\"app.workflows.scrollDown\": { defaultKeys: [\"alt+j\", \"alt+pageDown\"], description: \"Scroll workflows down\" },\n\t\"app.interrupt\": { defaultKeys: \"escape\", description: \"Cancel or abort\" },\n\t\"app.clear\": { defaultKeys: \"ctrl+c\", description: \"Clear editor\" },\n\t\"app.exit\": { defaultKeys: \"ctrl+d\", description: \"Exit when editor is empty\" },\n\t\"app.suspend\": {\n\t\tdefaultKeys: process.platform === \"win32\" ? \"alt+z\" : \"ctrl+z\",\n\t\tdescription: process.platform === \"win32\" ? \"Open PowerShell subshell\" : \"Suspend to background\",\n\t},\n\t\"app.thinking.cycle\": {\n\t\tdefaultKeys: \"shift+tab\",\n\t\tdescription: \"Cycle thinking level\",\n\t},\n\t\"app.model.cycleForward\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Cycle to next model\",\n\t},\n\t\"app.model.cycleBackward\": {\n\t\tdefaultKeys: windowsKeybindings ? \"alt+p\" : \"shift+ctrl+p\",\n\t\tdescription: \"Cycle to previous model\",\n\t},\n\t\"app.model.select\": { defaultKeys: \"ctrl+l\", description: \"Open model selector\" },\n\t\"app.tools.expand\": { defaultKeys: \"ctrl+o\", description: \"Toggle tool output\" },\n\t\"app.tasks.open\": { defaultKeys: [], description: \"Open task list\" },\n\t\"app.tasks.inspect\": { defaultKeys: \"enter\", description: \"Inspect selected task\" },\n\t\"app.tasks.cancel\": { defaultKeys: [], description: \"Cancel selected task with confirmation\" },\n\t\"app.tasks.input\": { defaultKeys: [], description: \"Input to selected task\" },\n\t\"app.thinking.toggle\": {\n\t\tdefaultKeys: \"ctrl+t\",\n\t\tdescription: \"Toggle thinking blocks\",\n\t},\n\t\"app.session.toggleNamedFilter\": {\n\t\tdefaultKeys: \"ctrl+n\",\n\t\tdescription: \"Toggle named session filter\",\n\t},\n\t\"app.editor.external\": {\n\t\tdefaultKeys: \"ctrl+g\",\n\t\tdescription: \"Open external editor\",\n\t},\n\t\"app.auth.copyUrl\": { defaultKeys: \"ctrl+x\", description: \"Copy OAuth sign-in URL\" },\n\t\"app.message.followUp\": {\n\t\tdefaultKeys: windowsKeybindings ? \"ctrl+q\" : \"alt+enter\",\n\t\tdescription: \"Queue follow-up message\",\n\t},\n\t\"app.message.dequeue\": {\n\t\tdefaultKeys: windowsKeybindings ? \"alt+q\" : \"alt+up\",\n\t\tdescription: \"Restore queued messages\",\n\t},\n\t\"app.clipboard.pasteImage\": {\n\t\tdefaultKeys: windowsKeybindings ? [\"alt+v\", \"ctrl+v\"] : \"ctrl+v\",\n\t\tdescription: \"Paste files on macOS, images, or text from clipboard\",\n\t},\n\t\"app.session.new\": { defaultKeys: [], description: \"Start a new session\" },\n\t\"app.session.tree\": { defaultKeys: [], description: \"Open session tree\" },\n\t\"app.session.fork\": { defaultKeys: [], description: \"Fork current session\" },\n\t\"app.session.resume\": { defaultKeys: [], description: \"Resume a session\" },\n\t\"app.tree.foldOrUp\": {\n\t\tdefaultKeys: [\"ctrl+left\", \"alt+left\"],\n\t\tdescription: \"Fold tree branch or move up\",\n\t},\n\t\"app.tree.unfoldOrDown\": {\n\t\tdefaultKeys: [\"ctrl+right\", \"alt+right\"],\n\t\tdescription: \"Unfold tree branch or move down\",\n\t},\n\t\"app.tree.editLabel\": {\n\t\tdefaultKeys: \"shift+l\",\n\t\tdescription: \"Edit tree label\",\n\t},\n\t\"app.tree.toggleLabelTimestamp\": {\n\t\tdefaultKeys: \"shift+t\",\n\t\tdescription: \"Toggle tree label timestamps\",\n\t},\n\t\"app.session.togglePath\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Toggle session path display\",\n\t},\n\t\"app.session.toggleSort\": {\n\t\tdefaultKeys: \"ctrl+s\",\n\t\tdescription: \"Toggle session sort mode\",\n\t},\n\t\"app.session.rename\": {\n\t\tdefaultKeys: \"ctrl+r\",\n\t\tdescription: \"Rename session\",\n\t},\n\t\"app.session.delete\": {\n\t\tdefaultKeys: \"ctrl+d\",\n\t\tdescription: \"Delete session\",\n\t},\n\t\"app.session.deleteNoninvasive\": {\n\t\tdefaultKeys: \"ctrl+backspace\",\n\t\tdescription: \"Delete session when query is empty\",\n\t},\n\t\"app.models.enableAll\": {\n\t\tdefaultKeys: \"ctrl+a\",\n\t\tdescription: \"Enable all models\",\n\t},\n\t\"app.models.clearAll\": {\n\t\tdefaultKeys: \"ctrl+x\",\n\t\tdescription: \"Clear all models\",\n\t},\n\t\"app.models.toggleProvider\": {\n\t\tdefaultKeys: \"ctrl+p\",\n\t\tdescription: \"Toggle all models for provider\",\n\t},\n\t\"app.models.reorderUp\": {\n\t\tdefaultKeys: windowsKeybindings ? \"alt+q\" : \"alt+up\",\n\t\tdescription: \"Move model up in order\",\n\t},\n\t\"app.models.reorderDown\": {\n\t\tdefaultKeys: \"alt+down\",\n\t\tdescription: \"Move model down in order\",\n\t},\n\t\"app.tree.filter.default\": {\n\t\tdefaultKeys: \"ctrl+d\",\n\t\tdescription: \"Tree filter: default view\",\n\t},\n\t\"app.tree.filter.noTools\": {\n\t\tdefaultKeys: \"ctrl+t\",\n\t\tdescription: \"Tree filter: hide tool results\",\n\t},\n\t\"app.tree.filter.userOnly\": {\n\t\tdefaultKeys: \"ctrl+u\",\n\t\tdescription: \"Tree filter: user messages only\",\n\t},\n\t\"app.tree.filter.labeledOnly\": {\n\t\tdefaultKeys: \"ctrl+l\",\n\t\tdescription: \"Tree filter: labeled entries only\",\n\t},\n\t\"app.tree.filter.all\": {\n\t\tdefaultKeys: \"ctrl+a\",\n\t\tdescription: \"Tree filter: show all entries\",\n\t},\n\t\"app.tree.filter.cycleForward\": {\n\t\tdefaultKeys: \"ctrl+o\",\n\t\tdescription: \"Tree filter: cycle forward\",\n\t},\n\t\"app.tree.filter.cycleBackward\": {\n\t\tdefaultKeys: \"shift+ctrl+o\",\n\t\tdescription: \"Tree filter: cycle backward\",\n\t},\n} as const satisfies KeybindingDefinitions;\n\nexport type AppKeybinding = keyof typeof APP_KEYBINDINGS;\nexport type AppKeybindings = { [K in AppKeybinding]: true };\n\ndeclare module \"@earendil-works/pi-tui\" {\n\tinterface Keybindings extends AppKeybindings {}\n}\n\nexport const KEYBINDINGS = {\n\t...TUI_KEYBINDINGS,\n\t\"tui.editor.undo\": {\n\t\t...TUI_KEYBINDINGS[\"tui.editor.undo\"],\n\t\tdefaultKeys: process.platform === \"win32\" ? \"ctrl+z\" : windowsKeybindings ? \"alt+z\" : \"ctrl+-\",\n\t},\n\t\"tui.altScreen.previousPrompt\": {\n\t\t...TUI_KEYBINDINGS[\"tui.altScreen.previousPrompt\"],\n\t\tdefaultKeys: windowsKeybindings ? \"ctrl+up\" : [\"ctrl+shift+up\", \"ctrl+up\"],\n\t},\n\t\"tui.altScreen.nextPrompt\": {\n\t\t...TUI_KEYBINDINGS[\"tui.altScreen.nextPrompt\"],\n\t\tdefaultKeys: windowsKeybindings ? \"ctrl+down\" : [\"ctrl+shift+down\", \"ctrl+down\"],\n\t},\n\t// Unbind pi-tui 0.84.2's transcript-search defaults. Atomic no longer\n\t// exposes a find box over the transcript or an attached stage chat.\n\t\"tui.altScreen.search\": { defaultKeys: [], description: \"Search the rendered transcript (disabled)\" },\n\t\"tui.altScreen.searchNext\": { defaultKeys: [], description: \"Select the next search match (disabled)\" },\n\t\"tui.altScreen.searchPrevious\": { defaultKeys: [], description: \"Select the previous search match (disabled)\" },\n\t\"tui.altScreen.searchClose\": { defaultKeys: [], description: \"Close transcript search (disabled)\" },\n\t...APP_KEYBINDINGS,\n} as const satisfies KeybindingDefinitions;\n\nconst KEYBINDING_NAME_MIGRATIONS = {\n\tcursorUp: \"tui.editor.cursorUp\",\n\tcursorDown: \"tui.editor.cursorDown\",\n\tcursorLeft: \"tui.editor.cursorLeft\",\n\tcursorRight: \"tui.editor.cursorRight\",\n\tcursorWordLeft: \"tui.editor.cursorWordLeft\",\n\tcursorWordRight: \"tui.editor.cursorWordRight\",\n\tcursorLineStart: \"tui.editor.cursorLineStart\",\n\tcursorLineEnd: \"tui.editor.cursorLineEnd\",\n\tjumpForward: \"tui.editor.jumpForward\",\n\tjumpBackward: \"tui.editor.jumpBackward\",\n\tpageUp: \"tui.editor.pageUp\",\n\tpageDown: \"tui.editor.pageDown\",\n\tdeleteCharBackward: \"tui.editor.deleteCharBackward\",\n\tdeleteCharForward: \"tui.editor.deleteCharForward\",\n\tdeleteWordBackward: \"tui.editor.deleteWordBackward\",\n\tdeleteWordForward: \"tui.editor.deleteWordForward\",\n\tdeleteToLineStart: \"tui.editor.deleteToLineStart\",\n\tdeleteToLineEnd: \"tui.editor.deleteToLineEnd\",\n\tyank: \"tui.editor.yank\",\n\tyankPop: \"tui.editor.yankPop\",\n\tundo: \"tui.editor.undo\",\n\tnewLine: \"tui.input.newLine\",\n\tsubmit: \"tui.input.submit\",\n\ttab: \"tui.input.tab\",\n\tcopy: \"tui.input.copy\",\n\tselectUp: \"tui.select.up\",\n\tselectDown: \"tui.select.down\",\n\tselectPageUp: \"tui.select.pageUp\",\n\tselectPageDown: \"tui.select.pageDown\",\n\tselectConfirm: \"tui.select.confirm\",\n\tselectCancel: \"tui.select.cancel\",\n\tinterrupt: \"app.interrupt\",\n\tclear: \"app.clear\",\n\texit: \"app.exit\",\n\tsuspend: \"app.suspend\",\n\tcycleThinkingLevel: \"app.thinking.cycle\",\n\tcycleModelForward: \"app.model.cycleForward\",\n\tcycleModelBackward: \"app.model.cycleBackward\",\n\tselectModel: \"app.model.select\",\n\texpandTools: \"app.tools.expand\",\n\ttoggleThinking: \"app.thinking.toggle\",\n\ttoggleSessionNamedFilter: \"app.session.toggleNamedFilter\",\n\texternalEditor: \"app.editor.external\",\n\tfollowUp: \"app.message.followUp\",\n\tdequeue: \"app.message.dequeue\",\n\tpasteImage: \"app.clipboard.pasteImage\",\n\tnewSession: \"app.session.new\",\n\ttree: \"app.session.tree\",\n\tfork: \"app.session.fork\",\n\tresume: \"app.session.resume\",\n\ttreeFoldOrUp: \"app.tree.foldOrUp\",\n\ttreeUnfoldOrDown: \"app.tree.unfoldOrDown\",\n\ttreeEditLabel: \"app.tree.editLabel\",\n\ttreeToggleLabelTimestamp: \"app.tree.toggleLabelTimestamp\",\n\ttoggleSessionPath: \"app.session.togglePath\",\n\ttoggleSessionSort: \"app.session.toggleSort\",\n\trenameSession: \"app.session.rename\",\n\tdeleteSession: \"app.session.delete\",\n\tdeleteSessionNoninvasive: \"app.session.deleteNoninvasive\",\n} as const satisfies Record<string, Keybinding>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isLegacyKeybindingName(key: string): key is keyof typeof KEYBINDING_NAME_MIGRATIONS {\n\treturn key in KEYBINDING_NAME_MIGRATIONS;\n}\n\nfunction toKeybindingsConfig(value: unknown): KeybindingsConfig {\n\tif (!isRecord(value)) return {};\n\n\tconst config: KeybindingsConfig = {};\n\tfor (const [key, binding] of Object.entries(value)) {\n\t\tif (key === \"$schema\") continue;\n\t\tif (typeof binding === \"string\") {\n\t\t\tconfig[key] = binding as KeyId;\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(binding) && binding.every((entry) => typeof entry === \"string\")) {\n\t\t\tconfig[key] = binding as KeyId[];\n\t\t}\n\t}\n\treturn config;\n}\n\nexport function migrateKeybindingsConfig(rawConfig: Record<string, unknown>): {\n\tconfig: Record<string, unknown>;\n\tmigrated: boolean;\n} {\n\tconst config: Record<string, unknown> = {};\n\tlet migrated = false;\n\n\tfor (const [key, value] of Object.entries(rawConfig)) {\n\t\tconst nextKey = isLegacyKeybindingName(key) ? KEYBINDING_NAME_MIGRATIONS[key] : key;\n\t\tif (nextKey !== key) {\n\t\t\tmigrated = true;\n\t\t}\n\t\tif (key !== nextKey && Object.hasOwn(rawConfig, nextKey)) {\n\t\t\tmigrated = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconfig[nextKey] = value;\n\t}\n\n\treturn { config: orderKeybindingsConfig(config), migrated };\n}\n\nfunction orderKeybindingsConfig(config: Record<string, unknown>): Record<string, unknown> {\n\tconst ordered: Record<string, unknown> = {};\n\tfor (const keybinding of Object.keys(KEYBINDINGS)) {\n\t\tif (Object.hasOwn(config, keybinding)) {\n\t\t\tordered[keybinding] = config[keybinding];\n\t\t}\n\t}\n\n\tconst extras = Object.keys(config)\n\t\t.filter((key) => !Object.hasOwn(ordered, key))\n\t\t.sort();\n\tfor (const key of extras) {\n\t\tordered[key] = config[key];\n\t}\n\n\treturn ordered;\n}\n\nfunction loadRawConfig(path: string): Record<string, unknown> | undefined {\n\tif (!existsSync(path)) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(stripBom(readFileSync(path, \"utf-8\"))) as unknown;\n\t\treturn isRecord(parsed) ? parsed : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport class KeybindingsManager extends TuiKeybindingsManager {\n\tprivate configPath: string | undefined;\n\n\tconstructor(userBindings: KeybindingsConfig = {}, configPath?: string) {\n\t\tsuper(KEYBINDINGS, userBindings);\n\t\tthis.configPath = configPath;\n\t}\n\n\tstatic create(agentDir: string = getAgentDir()): KeybindingsManager {\n\t\tconst configPath = join(agentDir, \"keybindings.json\");\n\t\tconst userBindings = KeybindingsManager.loadFromFile(configPath);\n\t\treturn new KeybindingsManager(userBindings, configPath);\n\t}\n\n\treload(): void {\n\t\tif (!this.configPath) return;\n\t\tthis.setUserBindings(KeybindingsManager.loadFromFile(this.configPath));\n\t}\n\n\tgetEffectiveConfig(): KeybindingsConfig {\n\t\treturn this.getResolvedBindings();\n\t}\n\n\tprivate static loadFromFile(path: string): KeybindingsConfig {\n\t\tconst rawConfig = loadRawConfig(path);\n\t\tif (!rawConfig) return {};\n\t\treturn toKeybindingsConfig(migrateKeybindingsConfig(rawConfig).config);\n\t}\n}\n\nexport type { Keybinding, KeybindingsConfig, KeyId };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mandatory-resource-loader.d.ts","sourceRoot":"","sources":["../../src/core/mandatory-resource-loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEX,cAAc,EAGd,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"mandatory-resource-loader.d.ts","sourceRoot":"","sources":["../../src/core/mandatory-resource-loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEX,cAAc,EAGd,MAAM,4BAA4B,CAAC;AA2LpC,4FAA4F;AAC5F,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAI9G;AAED,kGAAkG;AAClG,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAEzE;AAED,sFAAsF;AACtF,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEzE;AAED,6EAA6E;AAC7E,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAE9F"}
|
|
@@ -47,6 +47,9 @@ class MandatoryResourceLoader {
|
|
|
47
47
|
getExtensions() {
|
|
48
48
|
return this.extensionsResult;
|
|
49
49
|
}
|
|
50
|
+
getInheritanceSnapshot() {
|
|
51
|
+
return this.delegate.getInheritanceSnapshot?.() ?? {};
|
|
52
|
+
}
|
|
50
53
|
getWorkflowResources() {
|
|
51
54
|
return this.delegate.getWorkflowResources?.() ?? [];
|
|
52
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mandatory-resource-loader.js","sourceRoot":"","sources":["../../src/core/mandatory-resource-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE5G,OAAO,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,8BAA8B,CAAC;AACnH,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAOxE,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEhG,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,SAAS,kBAAkB,CAAC,SAAoB;IAC/C,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACrD,OAAO,YAAY,KAAK,SAAS,IAAI,6BAA6B,CAAC,YAAY,CAAC,CAAC;AAClF,CAAC;AAED,KAAK,UA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,OAAO,IAAI,uBAAuB,CAAC,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;AACnE,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,4BAA4B,CAAC,MAAsB;IAClE,IAAI,MAAM,YAAY,uBAAuB;QAAE,MAAM,CAAC,WAAW,EAAE,CAAC;AACrE,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,yBAAyB,CAAC,MAAsB;IAC/D,OAAO,MAAM,YAAY,uBAAuB,CAAC;AAClD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,8BAA8B,CAAC,MAAsB;IACpE,OAAO,MAAM,YAAY,uBAAuB,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3G,CAAC","sourcesContent":["import { getMandatoryBuiltinExtensionPaths } from \"./builtin-packages.ts\";\nimport { getExtensionRuntimeEventBus, instantiateExtensions, loadExtensions } from \"./extensions/loader.ts\";\nimport type { Extension, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport { isTrustedMandatoryRuntimeTool, markTrustedMandatoryRuntimeExtension } from \"./mandatory-runtime-tools.ts\";\nimport { canCloneDefaultResourceDiscovery } from \"./resource-loader.ts\";\nimport type {\n\tResourceExtensionPaths,\n\tResourceLoader,\n\tResourceLoaderReloadOptions,\n\tResourceLoaderReloadTransaction,\n} from \"./resource-loader-types.ts\";\nimport { sessionLifecycleCreation, sessionLifecycleScopes } from \"./session-lifecycle-scope.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport { buildSkillCatalog } from \"./skill-catalog.ts\";\n\nfunction hasTrustedIntercom(extension: Extension): boolean {\n\tconst registration = extension.tools.get(\"intercom\");\n\treturn registration !== undefined && isTrustedMandatoryRuntimeTool(registration);\n}\n\nasync function restoreMandatoryExtensions(target: LoadExtensionsResult, cwd: string): Promise<LoadExtensionsResult> {\n\tif (target.extensions.some(hasTrustedIntercom)) return target;\n\n\tconst loaded = await loadExtensions(\n\t\tgetMandatoryBuiltinExtensionPaths(),\n\t\tcwd,\n\t\tgetExtensionRuntimeEventBus(target.runtime),\n\t\tundefined,\n\t\ttarget.runtime,\n\t);\n\tfor (const extension of loaded.extensions) markTrustedMandatoryRuntimeExtension(extension);\n\tconst restored: LoadExtensionsResult = {\n\t\t...target,\n\t\textensions: [...target.extensions, ...loaded.extensions],\n\t\terrors: [...target.errors, ...loaded.errors],\n\t};\n\tif (!restored.extensions.some(hasTrustedIntercom)) {\n\t\tconst detail = loaded.errors.map(({ error }) => error).join(\"; \") || \"extension did not register intercom\";\n\t\tthrow new Error(`Mandatory bundled Intercom is unavailable: ${detail}`);\n\t}\n\treturn restored;\n}\n\nclass MandatoryResourceLoader implements ResourceLoader {\n\tprivate delegate: ResourceLoader;\n\tprivate readonly cwd: string;\n\tprivate extensionsResult: LoadExtensionsResult;\n\tprivate toolOnly = false;\n\n\tconstructor(delegate: ResourceLoader, cwd: string, extensionsResult: LoadExtensionsResult) {\n\t\tthis.delegate = delegate;\n\t\tthis.cwd = cwd;\n\t\tthis.extensionsResult = extensionsResult;\n\t}\n\n\tlimitToTool(): void {\n\t\tthis.toolOnly = true;\n\t\tthis.removeLocalInteractionSurfaces();\n\t}\n\n\tprivate removeLocalInteractionSurfaces(): void {\n\t\tconst extension = this.extensionsResult.extensions.find(hasTrustedIntercom);\n\t\textension?.commands.delete(\"intercom\");\n\t\textension?.shortcuts.delete(\"alt+m\");\n\t}\n\n\tgetExtensions(): LoadExtensionsResult {\n\t\treturn this.extensionsResult;\n\t}\n\n\tgetWorkflowResources() {\n\t\treturn this.delegate.getWorkflowResources?.() ?? [];\n\t}\n\n\tasync refreshWorkflowResources() {\n\t\treturn (await this.delegate.refreshWorkflowResources?.()) ?? this.getWorkflowResources();\n\t}\n\n\tgetMcpServerContributions() {\n\t\treturn this.delegate.getMcpServerContributions?.() ?? [];\n\t}\n\n\tasync createSessionLoader(): Promise<ResourceLoader> {\n\t\tconst scope = sessionLifecycleCreation.getStore()!.scope;\n\t\tif (sessionLifecycleScopes.get(this.extensionsResult.runtime) === scope) return this;\n\t\tconst delegate = canCloneDefaultResourceDiscovery(this.delegate)\n\t\t\t? await this.delegate.createSessionLoader(scope)\n\t\t\t: this.delegate;\n\t\tconst discovery =\n\t\t\tdelegate === this.delegate\n\t\t\t\t? this.extensionsResult\n\t\t\t\t: await restoreMandatoryExtensions(delegate.getExtensions(), this.cwd);\n\t\tconst extensions =\n\t\t\tsessionLifecycleScopes.get(discovery.runtime) === scope\n\t\t\t\t? discovery\n\t\t\t\t: await instantiateExtensions(discovery, this.cwd);\n\t\tconst candidate = new MandatoryResourceLoader(delegate, this.cwd, extensions);\n\t\tif (this.toolOnly) candidate.limitToTool();\n\t\treturn candidate;\n\t}\n\n\tgetSkills(): ReturnType<ResourceLoader[\"getSkills\"]> {\n\t\treturn this.delegate.getSkills();\n\t}\n\n\tgetSkillCatalog(): ReturnType<NonNullable<ResourceLoader[\"getSkillCatalog\"]>> {\n\t\treturn this.delegate.getSkillCatalog?.() ?? buildSkillCatalog(this.delegate.getSkills().skills);\n\t}\n\n\tgetPrompts(): ReturnType<ResourceLoader[\"getPrompts\"]> {\n\t\treturn this.delegate.getPrompts();\n\t}\n\n\tgetThemes(): ReturnType<ResourceLoader[\"getThemes\"]> {\n\t\treturn this.delegate.getThemes();\n\t}\n\n\tgetAgentsFiles(): ReturnType<ResourceLoader[\"getAgentsFiles\"]> {\n\t\treturn this.delegate.getAgentsFiles();\n\t}\n\n\tgetSystemPrompt(): ReturnType<ResourceLoader[\"getSystemPrompt\"]> {\n\t\treturn this.delegate.getSystemPrompt();\n\t}\n\n\tgetSystemPromptSource(): ReturnType<ResourceLoader[\"getSystemPromptSource\"]> {\n\t\treturn this.delegate.getSystemPromptSource();\n\t}\n\n\tgetAppendSystemPrompt(): ReturnType<ResourceLoader[\"getAppendSystemPrompt\"]> {\n\t\treturn this.delegate.getAppendSystemPrompt();\n\t}\n\n\tgetAppendSystemPromptSources(): ReturnType<ResourceLoader[\"getAppendSystemPromptSources\"]> {\n\t\treturn this.delegate.getAppendSystemPromptSources();\n\t}\n\n\textendResources(paths: ResourceExtensionPaths): Promise<void> {\n\t\treturn this.delegate.extendResources(paths);\n\t}\n\n\tasync reload(options?: ResourceLoaderReloadOptions): Promise<void> {\n\t\tawait this.delegate.reload(options);\n\t\tthis.extensionsResult = await restoreMandatoryExtensions(this.delegate.getExtensions(), this.cwd);\n\t\tif (this.toolOnly) this.removeLocalInteractionSurfaces();\n\t}\n\n\tsupportsTransactionalReload(): boolean {\n\t\treturn this.delegate.prepareReload !== undefined && this.delegate.supportsTransactionalReload?.() !== false;\n\t}\n\n\tasync prepareReload(\n\t\tsettingsManager: SettingsManager,\n\t\toptions?: ResourceLoaderReloadOptions,\n\t): Promise<ResourceLoaderReloadTransaction> {\n\t\tif (!this.delegate.prepareReload) {\n\t\t\tthrow new Error(\"Resource loader does not support transactional reload\");\n\t\t}\n\t\tconst delegateTransaction = await this.delegate.prepareReload(settingsManager, options);\n\t\tconst extensionsResult = await restoreMandatoryExtensions(delegateTransaction.loader.getExtensions(), this.cwd);\n\t\tconst candidate = new MandatoryResourceLoader(delegateTransaction.loader, this.cwd, extensionsResult);\n\t\tif (this.toolOnly) candidate.limitToTool();\n\t\tconst prepareCommit = delegateTransaction.prepareCommit\n\t\t\t? () => {\n\t\t\t\t\tconst delegateCommit = delegateTransaction.prepareCommit!();\n\t\t\t\t\tlet settled = false;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcommit: () => {\n\t\t\t\t\t\t\tif (settled) return;\n\t\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\t\tdelegateCommit.commit();\n\t\t\t\t\t\t\tthis.extensionsResult = candidate.extensionsResult;\n\t\t\t\t\t\t},\n\t\t\t\t\t\trollback: () => {\n\t\t\t\t\t\t\tif (settled) return;\n\t\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\t\tdelegateCommit.rollback();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tloader: candidate,\n\t\t\tactivate: (liveSettingsManager) => delegateTransaction.activate(liveSettingsManager),\n\t\t\t...(prepareCommit ? { prepareCommit } : {}),\n\t\t\tcommit: () => {\n\t\t\t\tdelegateTransaction.commit();\n\t\t\t\tthis.extensionsResult = candidate.extensionsResult;\n\t\t\t},\n\t\t};\n\t}\n}\n\n/** Preserve caller-owned resources while restoring Atomic's mandatory bundled extension. */\nexport async function withMandatoryResourceLoader(loader: ResourceLoader, cwd: string): Promise<ResourceLoader> {\n\tif (loader instanceof MandatoryResourceLoader) return loader;\n\tconst extensionsResult = await restoreMandatoryExtensions(loader.getExtensions(), cwd);\n\treturn new MandatoryResourceLoader(loader, cwd, extensionsResult);\n}\n\n/** Keep a non-model interactive host from shadowing the engine's command and shortcut proxies. */\nexport function limitMandatoryIntercomToTool(loader: ResourceLoader): void {\n\tif (loader instanceof MandatoryResourceLoader) loader.limitToTool();\n}\n\n/** Services have already selected their resources, including deferred CLI startup. */\nexport function isMandatoryResourceLoader(loader: ResourceLoader): boolean {\n\treturn loader instanceof MandatoryResourceLoader;\n}\n\n/** Service discovery is borrowed too, including deferred CLI generations. */\nexport function isolateMandatoryResourceLoader(loader: ResourceLoader): Promise<ResourceLoader> {\n\treturn loader instanceof MandatoryResourceLoader ? loader.createSessionLoader() : Promise.resolve(loader);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mandatory-resource-loader.js","sourceRoot":"","sources":["../../src/core/mandatory-resource-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE5G,OAAO,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,8BAA8B,CAAC;AACnH,OAAO,EAAE,gCAAgC,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AC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,MAAM,EAAE,GAAG,EAAE;gBACZ,mBAAmB,CAAC,MAAM,EAAE,CAAC;gBAC7B,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,CAAC;YACpD,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAED,4FAA4F;AAC5F,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,MAAsB,EAAE,GAAW;IACpF,IAAI,MAAM,YAAY,uBAAuB;QAAE,OAAO,MAAM,CAAC;IAC7D,MAAM,gBAAgB,GAAG,MAAM,0BAA0B,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,GAAG,CAAC,CAAC;IACvF,OAAO,IAAI,uBAAuB,CAAC,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;AACnE,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,4BAA4B,CAAC,MAAsB;IAClE,IAAI,MAAM,YAAY,uBAAuB;QAAE,MAAM,CAAC,WAAW,EAAE,CAAC;AACrE,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,yBAAyB,CAAC,MAAsB;IAC/D,OAAO,MAAM,YAAY,uBAAuB,CAAC;AAClD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,8BAA8B,CAAC,MAAsB;IACpE,OAAO,MAAM,YAAY,uBAAuB,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3G,CAAC","sourcesContent":["import { getMandatoryBuiltinExtensionPaths } from \"./builtin-packages.ts\";\nimport { getExtensionRuntimeEventBus, instantiateExtensions, loadExtensions } from \"./extensions/loader.ts\";\nimport type { Extension, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport { isTrustedMandatoryRuntimeTool, markTrustedMandatoryRuntimeExtension } from \"./mandatory-runtime-tools.ts\";\nimport { canCloneDefaultResourceDiscovery } from \"./resource-loader.ts\";\nimport type {\n\tResourceExtensionPaths,\n\tResourceLoader,\n\tResourceLoaderReloadOptions,\n\tResourceLoaderReloadTransaction,\n} from \"./resource-loader-types.ts\";\nimport { sessionLifecycleCreation, sessionLifecycleScopes } from \"./session-lifecycle-scope.ts\";\nimport type { SettingsManager } from \"./settings-manager.ts\";\nimport { buildSkillCatalog } from \"./skill-catalog.ts\";\n\nfunction hasTrustedIntercom(extension: Extension): boolean {\n\tconst registration = extension.tools.get(\"intercom\");\n\treturn registration !== undefined && isTrustedMandatoryRuntimeTool(registration);\n}\n\nasync function restoreMandatoryExtensions(target: LoadExtensionsResult, cwd: string): Promise<LoadExtensionsResult> {\n\tif (target.extensions.some(hasTrustedIntercom)) return target;\n\n\tconst loaded = await loadExtensions(\n\t\tgetMandatoryBuiltinExtensionPaths(),\n\t\tcwd,\n\t\tgetExtensionRuntimeEventBus(target.runtime),\n\t\tundefined,\n\t\ttarget.runtime,\n\t);\n\tfor (const extension of loaded.extensions) markTrustedMandatoryRuntimeExtension(extension);\n\tconst restored: LoadExtensionsResult = {\n\t\t...target,\n\t\textensions: [...target.extensions, ...loaded.extensions],\n\t\terrors: [...target.errors, ...loaded.errors],\n\t};\n\tif (!restored.extensions.some(hasTrustedIntercom)) {\n\t\tconst detail = loaded.errors.map(({ error }) => error).join(\"; \") || \"extension did not register intercom\";\n\t\tthrow new Error(`Mandatory bundled Intercom is unavailable: ${detail}`);\n\t}\n\treturn restored;\n}\n\nclass MandatoryResourceLoader implements ResourceLoader {\n\tprivate delegate: ResourceLoader;\n\tprivate readonly cwd: string;\n\tprivate extensionsResult: LoadExtensionsResult;\n\tprivate toolOnly = false;\n\n\tconstructor(delegate: ResourceLoader, cwd: string, extensionsResult: LoadExtensionsResult) {\n\t\tthis.delegate = delegate;\n\t\tthis.cwd = cwd;\n\t\tthis.extensionsResult = extensionsResult;\n\t}\n\n\tlimitToTool(): void {\n\t\tthis.toolOnly = true;\n\t\tthis.removeLocalInteractionSurfaces();\n\t}\n\n\tprivate removeLocalInteractionSurfaces(): void {\n\t\tconst extension = this.extensionsResult.extensions.find(hasTrustedIntercom);\n\t\textension?.commands.delete(\"intercom\");\n\t\textension?.shortcuts.delete(\"alt+m\");\n\t}\n\n\tgetExtensions(): LoadExtensionsResult {\n\t\treturn this.extensionsResult;\n\t}\n\n\tgetInheritanceSnapshot() {\n\t\treturn this.delegate.getInheritanceSnapshot?.() ?? {};\n\t}\n\n\tgetWorkflowResources() {\n\t\treturn this.delegate.getWorkflowResources?.() ?? [];\n\t}\n\n\tasync refreshWorkflowResources() {\n\t\treturn (await this.delegate.refreshWorkflowResources?.()) ?? this.getWorkflowResources();\n\t}\n\n\tgetMcpServerContributions() {\n\t\treturn this.delegate.getMcpServerContributions?.() ?? [];\n\t}\n\n\tasync createSessionLoader(): Promise<ResourceLoader> {\n\t\tconst scope = sessionLifecycleCreation.getStore()!.scope;\n\t\tif (sessionLifecycleScopes.get(this.extensionsResult.runtime) === scope) return this;\n\t\tconst delegate = canCloneDefaultResourceDiscovery(this.delegate)\n\t\t\t? await this.delegate.createSessionLoader(scope)\n\t\t\t: this.delegate;\n\t\tconst discovery =\n\t\t\tdelegate === this.delegate\n\t\t\t\t? this.extensionsResult\n\t\t\t\t: await restoreMandatoryExtensions(delegate.getExtensions(), this.cwd);\n\t\tconst extensions =\n\t\t\tsessionLifecycleScopes.get(discovery.runtime) === scope\n\t\t\t\t? discovery\n\t\t\t\t: await instantiateExtensions(discovery, this.cwd);\n\t\tconst candidate = new MandatoryResourceLoader(delegate, this.cwd, extensions);\n\t\tif (this.toolOnly) candidate.limitToTool();\n\t\treturn candidate;\n\t}\n\n\tgetSkills(): ReturnType<ResourceLoader[\"getSkills\"]> {\n\t\treturn this.delegate.getSkills();\n\t}\n\n\tgetSkillCatalog(): ReturnType<NonNullable<ResourceLoader[\"getSkillCatalog\"]>> {\n\t\treturn this.delegate.getSkillCatalog?.() ?? buildSkillCatalog(this.delegate.getSkills().skills);\n\t}\n\n\tgetPrompts(): ReturnType<ResourceLoader[\"getPrompts\"]> {\n\t\treturn this.delegate.getPrompts();\n\t}\n\n\tgetThemes(): ReturnType<ResourceLoader[\"getThemes\"]> {\n\t\treturn this.delegate.getThemes();\n\t}\n\n\tgetAgentsFiles(): ReturnType<ResourceLoader[\"getAgentsFiles\"]> {\n\t\treturn this.delegate.getAgentsFiles();\n\t}\n\n\tgetSystemPrompt(): ReturnType<ResourceLoader[\"getSystemPrompt\"]> {\n\t\treturn this.delegate.getSystemPrompt();\n\t}\n\n\tgetSystemPromptSource(): ReturnType<ResourceLoader[\"getSystemPromptSource\"]> {\n\t\treturn this.delegate.getSystemPromptSource();\n\t}\n\n\tgetAppendSystemPrompt(): ReturnType<ResourceLoader[\"getAppendSystemPrompt\"]> {\n\t\treturn this.delegate.getAppendSystemPrompt();\n\t}\n\n\tgetAppendSystemPromptSources(): ReturnType<ResourceLoader[\"getAppendSystemPromptSources\"]> {\n\t\treturn this.delegate.getAppendSystemPromptSources();\n\t}\n\n\textendResources(paths: ResourceExtensionPaths): Promise<void> {\n\t\treturn this.delegate.extendResources(paths);\n\t}\n\n\tasync reload(options?: ResourceLoaderReloadOptions): Promise<void> {\n\t\tawait this.delegate.reload(options);\n\t\tthis.extensionsResult = await restoreMandatoryExtensions(this.delegate.getExtensions(), this.cwd);\n\t\tif (this.toolOnly) this.removeLocalInteractionSurfaces();\n\t}\n\n\tsupportsTransactionalReload(): boolean {\n\t\treturn this.delegate.prepareReload !== undefined && this.delegate.supportsTransactionalReload?.() !== false;\n\t}\n\n\tasync prepareReload(\n\t\tsettingsManager: SettingsManager,\n\t\toptions?: ResourceLoaderReloadOptions,\n\t): Promise<ResourceLoaderReloadTransaction> {\n\t\tif (!this.delegate.prepareReload) {\n\t\t\tthrow new Error(\"Resource loader does not support transactional reload\");\n\t\t}\n\t\tconst delegateTransaction = await this.delegate.prepareReload(settingsManager, options);\n\t\tconst extensionsResult = await restoreMandatoryExtensions(delegateTransaction.loader.getExtensions(), this.cwd);\n\t\tconst candidate = new MandatoryResourceLoader(delegateTransaction.loader, this.cwd, extensionsResult);\n\t\tif (this.toolOnly) candidate.limitToTool();\n\t\tconst prepareCommit = delegateTransaction.prepareCommit\n\t\t\t? () => {\n\t\t\t\t\tconst delegateCommit = delegateTransaction.prepareCommit!();\n\t\t\t\t\tlet settled = false;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcommit: () => {\n\t\t\t\t\t\t\tif (settled) return;\n\t\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\t\tdelegateCommit.commit();\n\t\t\t\t\t\t\tthis.extensionsResult = candidate.extensionsResult;\n\t\t\t\t\t\t},\n\t\t\t\t\t\trollback: () => {\n\t\t\t\t\t\t\tif (settled) return;\n\t\t\t\t\t\t\tsettled = true;\n\t\t\t\t\t\t\tdelegateCommit.rollback();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tloader: candidate,\n\t\t\tactivate: (liveSettingsManager) => delegateTransaction.activate(liveSettingsManager),\n\t\t\t...(prepareCommit ? { prepareCommit } : {}),\n\t\t\tcommit: () => {\n\t\t\t\tdelegateTransaction.commit();\n\t\t\t\tthis.extensionsResult = candidate.extensionsResult;\n\t\t\t},\n\t\t};\n\t}\n}\n\n/** Preserve caller-owned resources while restoring Atomic's mandatory bundled extension. */\nexport async function withMandatoryResourceLoader(loader: ResourceLoader, cwd: string): Promise<ResourceLoader> {\n\tif (loader instanceof MandatoryResourceLoader) return loader;\n\tconst extensionsResult = await restoreMandatoryExtensions(loader.getExtensions(), cwd);\n\treturn new MandatoryResourceLoader(loader, cwd, extensionsResult);\n}\n\n/** Keep a non-model interactive host from shadowing the engine's command and shortcut proxies. */\nexport function limitMandatoryIntercomToTool(loader: ResourceLoader): void {\n\tif (loader instanceof MandatoryResourceLoader) loader.limitToTool();\n}\n\n/** Services have already selected their resources, including deferred CLI startup. */\nexport function isMandatoryResourceLoader(loader: ResourceLoader): boolean {\n\treturn loader instanceof MandatoryResourceLoader;\n}\n\n/** Service discovery is borrowed too, including deferred CLI generations. */\nexport function isolateMandatoryResourceLoader(loader: ResourceLoader): Promise<ResourceLoader> {\n\treturn loader instanceof MandatoryResourceLoader ? loader.createSessionLoader() : Promise.resolve(loader);\n}\n"]}
|
|
@@ -49,6 +49,8 @@ export interface PrepareSessionResumeOptions {
|
|
|
49
49
|
* released session is woken ({@link continueSessionWhereItWorked}).
|
|
50
50
|
*/
|
|
51
51
|
readonly onNotices?: (notices: readonly ResumeNotice[]) => void;
|
|
52
|
+
/** Told each slow step the resume starts (checking checkouts, restoring one, building blueprints), for a progress line. */
|
|
53
|
+
readonly onProgress?: (message: string) => void;
|
|
52
54
|
}
|
|
53
55
|
export type PreparedSessionResume = {
|
|
54
56
|
readonly status: "cancelled";
|
|
@@ -72,7 +74,11 @@ export interface SessionSnapshotMatch {
|
|
|
72
74
|
export declare function latestSessionSnapshot(sessionManager: Pick<SessionManager, "getCwd" | "getWorktreeRootMappings" | "getLatestWorktreeSnapshots">): SessionSnapshotMatch | undefined;
|
|
73
75
|
/**
|
|
74
76
|
* Gets a resumed session's checkouts ready on this node before its runtime starts, and returns the session opened
|
|
75
|
-
* where it continues. When the checkout the session works in
|
|
77
|
+
* where it continues. When the checkout the session works in changed here but is still the one it worked in (its
|
|
78
|
+
* repository holds the snapshot's commit, or Atomic restored it here), the session continues in it as it is, silently
|
|
79
|
+
* (#4660). A session a resume moved into a restored worktree, and that has not worked in it since, returns to
|
|
80
|
+
* the checkout it was restored from when that checkout is here. When the checkout the session works in is missing or
|
|
81
|
+
* belongs to another clone here, a checkout of the same
|
|
76
82
|
* repository the resume started in is used as-is if it matches (and, if it differs, only when the user chooses it).
|
|
77
83
|
* The checkout the session works in is the only one the resume cannot go without: when it must be restored, the
|
|
78
84
|
* precondition of restoring the recorded checkouts, that Git can run, is checked first, and an unmet one refuses the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-resume.d.ts","sourceRoot":"","sources":["../../../src/core/resume/session-resume.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-resume.d.ts","sourceRoot":"","sources":["../../../src/core/resume/session-resume.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAU9D,OAAO,EAEN,KAAK,qBAAqB,EAE1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAuB,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACrH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAUjE,OAAO,EAA6B,KAAK,gBAAgB,EAA2B,MAAM,aAAa,CAAC;AAGxG,OAAO,EAAmD,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEzG,oHAAoH;AACpH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,4GAA4G;IAC5G,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,yGAAyG;IACzG,QAAQ,CAAC,SAAS,EAAE,IAA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AAU,EAAE,gBAAgB,EAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,6BAA6B,GAAG,uBAAuB,CAAC,EAC/F,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GACpC,2BAA2B,CAQ7B"}
|
|
@@ -2,6 +2,7 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { stat } from "node:fs/promises";
|
|
3
3
|
import { join, relative, resolve } from "node:path";
|
|
4
4
|
import { isGitUnavailableError } from "../../utils/git-errors.js";
|
|
5
|
+
import { failureDebugFields, reportDebug } from "../debug.js";
|
|
5
6
|
import { currentWorktreeSnapshots, mapRestoredPath, openResumedSession, resumeSessionWorktree, } from "../session-worktree-snapshots.js";
|
|
6
7
|
import { ProjectTrustStore } from "../trust-manager.js";
|
|
7
8
|
import { locateCheckout, readRepositoryConfig } from "../worktree-snapshot/capture.js";
|
|
@@ -100,13 +101,78 @@ async function reuseLaunchCheckout(match, options) {
|
|
|
100
101
|
},
|
|
101
102
|
};
|
|
102
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Moves a session that a resume restored into a worktree, and that has not worked in it since, back to the checkout it
|
|
106
|
+
* was restored from, when that checkout is on this node and its repository holds the snapshot's commit (#4660). The
|
|
107
|
+
* session continues there as the checkout is now, even when it changed since the snapshot. Undefined keeps the session
|
|
108
|
+
* in its worktree: the worktree is not one Atomic restored, it changed or recorded another snapshot since, or the
|
|
109
|
+
* checkout it came from is gone or is another clone.
|
|
110
|
+
*/
|
|
111
|
+
async function returnToStartingCheckout(sessionManager, match, storeDir, options) {
|
|
112
|
+
if (!isInside(storeDir, match.root))
|
|
113
|
+
return undefined;
|
|
114
|
+
const restore = [...sessionManager.getWorktreeRootMappings()]
|
|
115
|
+
.reverse()
|
|
116
|
+
.find((mapping) => resolve(mapping.to) === resolve(match.root));
|
|
117
|
+
if (restore === undefined || restore.snapshotId !== match.snapshot.id)
|
|
118
|
+
return undefined;
|
|
119
|
+
const checkout = resolve(restore.from);
|
|
120
|
+
const cwd = resolve(checkout, relative(match.root, match.cwd));
|
|
121
|
+
if (isInside(storeDir, checkout) || !existsSync(cwd))
|
|
122
|
+
return undefined;
|
|
123
|
+
// When the checkout cannot be examined, the project the session started in is still where it goes back to.
|
|
124
|
+
const examined = await orFallBack(options, "return-to-checkout-verify", undefined, async () => ({
|
|
125
|
+
holdsCommit: await holdsSnapshotCommit(match.snapshot, checkout, options.signal),
|
|
126
|
+
matches: !(await worktreeNeedsRestore(match.snapshot, checkout, options)),
|
|
127
|
+
}));
|
|
128
|
+
if (examined !== undefined && !examined.holdsCommit)
|
|
129
|
+
return undefined;
|
|
130
|
+
const matches = examined?.matches;
|
|
131
|
+
const snapshotId = match.snapshot.id.slice(0, 12);
|
|
132
|
+
return {
|
|
133
|
+
kind: "reused",
|
|
134
|
+
cwd,
|
|
135
|
+
matches: matches ?? false,
|
|
136
|
+
mapping: {
|
|
137
|
+
from: match.root,
|
|
138
|
+
to: checkout,
|
|
139
|
+
snapshotId: match.snapshot.id,
|
|
140
|
+
tree: match.snapshot.tree,
|
|
141
|
+
restoredAt: new Date().toISOString(),
|
|
142
|
+
},
|
|
143
|
+
notice: {
|
|
144
|
+
type: "info",
|
|
145
|
+
message: `Resuming in ${checkout}, the checkout this session was restored from, instead of the worktree ${match.root}.${matches === undefined ? "" : matches ? ` It matches snapshot ${snapshotId}.` : ` It has changed since snapshot ${snapshotId}; that snapshot was not restored.`}`,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Runs an optional improvement of where a resume continues. When it fails on a checkout, with a typed resume,
|
|
151
|
+
* workspace or Git failure, the resume goes on with `fallback`, the behaviour it had without the improvement; the
|
|
152
|
+
* reason goes to the debug log. A cancellation, and any failure that is not about a checkout, still end the resume.
|
|
153
|
+
*/
|
|
154
|
+
async function orFallBack(options, step, fallback, attempt) {
|
|
155
|
+
try {
|
|
156
|
+
return await attempt();
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (options.signal?.aborted || !isCheckoutFailure(error))
|
|
160
|
+
throw error;
|
|
161
|
+
reportDebug("storage", "resume-checkout-fallback", { step, ...failureDebugFields(error) });
|
|
162
|
+
return fallback;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
103
165
|
/** Whether the checkout at `root` has uncommitted or untracked changes, which a resume must not overwrite unasked. */
|
|
104
166
|
async function hasLocalChanges(root, signal) {
|
|
105
167
|
return (await gitText(["status", "--porcelain"], { cwd: root, signal })).length > 0;
|
|
106
168
|
}
|
|
107
169
|
/**
|
|
108
170
|
* Gets a resumed session's checkouts ready on this node before its runtime starts, and returns the session opened
|
|
109
|
-
* where it continues. When the checkout the session works in
|
|
171
|
+
* where it continues. When the checkout the session works in changed here but is still the one it worked in (its
|
|
172
|
+
* repository holds the snapshot's commit, or Atomic restored it here), the session continues in it as it is, silently
|
|
173
|
+
* (#4660). A session a resume moved into a restored worktree, and that has not worked in it since, returns to
|
|
174
|
+
* the checkout it was restored from when that checkout is here. When the checkout the session works in is missing or
|
|
175
|
+
* belongs to another clone here, a checkout of the same
|
|
110
176
|
* repository the resume started in is used as-is if it matches (and, if it differs, only when the user chooses it).
|
|
111
177
|
* The checkout the session works in is the only one the resume cannot go without: when it must be restored, the
|
|
112
178
|
* precondition of restoring the recorded checkouts, that Git can run, is checked first, and an unmet one refuses the
|
|
@@ -126,12 +192,40 @@ export async function prepareSessionResume(sessionManager, options) {
|
|
|
126
192
|
return { status: "ready", sessionManager, notices: [], blueprintNotices: [], blueprintContext: unchanged };
|
|
127
193
|
}
|
|
128
194
|
const notices = [];
|
|
195
|
+
const checkoutCount = currentWorktreeSnapshots(sessionManager).size;
|
|
196
|
+
options.onProgress?.(`Checking ${checkoutCount === 1 ? "1 checkout" : `${checkoutCount} checkouts`} against the session's snapshots`);
|
|
197
|
+
const verified = new Map();
|
|
198
|
+
const verifyOnce = (snapshot, root) => {
|
|
199
|
+
const key = `${snapshot.id}\0${resolve(root)}`;
|
|
200
|
+
let verification = verified.get(key);
|
|
201
|
+
if (verification === undefined) {
|
|
202
|
+
verification = worktreeNeedsRestore(snapshot, root, options);
|
|
203
|
+
verified.set(key, verification);
|
|
204
|
+
}
|
|
205
|
+
return verification;
|
|
206
|
+
};
|
|
129
207
|
const match = latestSessionSnapshot(sessionManager);
|
|
130
208
|
let git;
|
|
131
209
|
let reused;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
210
|
+
const needsRestore = match !== undefined && !options.keepInPlace?.has(match.root) && (await verifyOnce(match.snapshot, match.root));
|
|
211
|
+
const project = match !== undefined && !needsRestore && !options.keepInPlace?.has(match.root)
|
|
212
|
+
? await orFallBack(options, "return-to-checkout", undefined, () => returnToStartingCheckout(sessionManager, match, storeDir, options))
|
|
213
|
+
: undefined;
|
|
214
|
+
if (project !== undefined) {
|
|
215
|
+
await recordReuse(sessionManager, project.mapping);
|
|
216
|
+
notices.push(project.notice);
|
|
217
|
+
}
|
|
218
|
+
const keepsOwnCheckout = match !== undefined &&
|
|
219
|
+
project === undefined &&
|
|
220
|
+
needsRestore &&
|
|
221
|
+
(await isDirectory(match.root)) &&
|
|
222
|
+
(await orFallBack(options, "own-checkout", new Set([match.root]), () => checkoutsWorkedHere(new Map([[match.root, match.snapshot]]), match.cwd, options)).then((worked) => worked.has(match.root)));
|
|
223
|
+
// The checkout the session returned to stays as it is, whatever it changed since: only the others are restored.
|
|
224
|
+
const kept = [...(keepsOwnCheckout && match !== undefined ? [match.root] : [])];
|
|
225
|
+
if (project !== undefined && match !== undefined)
|
|
226
|
+
kept.push(match.root, project.mapping.to);
|
|
227
|
+
const resume = kept.length > 0 ? { ...options, keepInPlace: new Set([...(options.keepInPlace ?? []), ...kept]) } : options;
|
|
228
|
+
if (match !== undefined && !keepsOwnCheckout && needsRestore) {
|
|
135
229
|
git = { unavailable: await io.probeGit(options.signal) };
|
|
136
230
|
const reuse = git.unavailable === undefined ? await reuseLaunchCheckout(match, options) : undefined;
|
|
137
231
|
if (reuse?.kind === "cancelled")
|
|
@@ -146,13 +240,13 @@ export async function prepareSessionResume(sessionManager, options) {
|
|
|
146
240
|
}
|
|
147
241
|
}
|
|
148
242
|
const checkouts = withMapping(sessionManager, reused);
|
|
149
|
-
const candidates = await restoreCandidates(checkouts, mapRestoredPath(sessionManager.getCwd(), checkouts.getWorktreeRootMappings()),
|
|
243
|
+
const candidates = await restoreCandidates(checkouts, mapRestoredPath(sessionManager.getCwd(), checkouts.getWorktreeRootMappings()), resume, verifyOnce);
|
|
150
244
|
if (candidates.targets.length > 0)
|
|
151
245
|
git ??= { unavailable: await io.probeGit(options.signal) };
|
|
152
|
-
const plan = planRestores(sessionManager, candidates,
|
|
246
|
+
const plan = planRestores(sessionManager, candidates, resume, git?.unavailable);
|
|
153
247
|
notices.push(...plan.left.values());
|
|
154
248
|
const recordedBefore = sessionManager.getWorktreeRootMappings().length;
|
|
155
|
-
const resumed = await restorePlanned(sessionManager, plan, reused, storeDir,
|
|
249
|
+
const resumed = await restorePlanned(sessionManager, plan, reused, storeDir, resume);
|
|
156
250
|
const cwd = mapRestoredPath(sessionManager.getCwd(), sessionManager.getWorktreeRootMappings());
|
|
157
251
|
const opened = await openResumedSession(sessionManager, cwd, resumed.restored, options.sessionDirectory);
|
|
158
252
|
notices.push(...opened.notices, ...resumed.failed);
|
|
@@ -161,6 +255,9 @@ export async function prepareSessionResume(sessionManager, options) {
|
|
|
161
255
|
.slice(recordedBefore)
|
|
162
256
|
.map((mapping) => resolve(mapping.to))
|
|
163
257
|
.filter((root) => isInside(storeDir, root)));
|
|
258
|
+
if (restoredNow.size > 0 && options.blueprints !== "skip") {
|
|
259
|
+
options.onProgress?.("Setting up the blueprints of restored worktrees");
|
|
260
|
+
}
|
|
164
261
|
const blueprints = await setUpCheckoutBlueprints(opened.sessionManager, restoredNow, storeDir, options);
|
|
165
262
|
notices.push(...blueprints.notices);
|
|
166
263
|
await recordBlueprintContext(opened.sessionManager, blueprints.context);
|
|
@@ -280,23 +377,23 @@ function describeFailure(error) {
|
|
|
280
377
|
* with a warning, when it cannot be compared with its snapshot, or when it is here and the session worked in it on this
|
|
281
378
|
* node, so it continues as it is.
|
|
282
379
|
*/
|
|
283
|
-
async function restoreCandidates(sessionManager, cwd, options) {
|
|
380
|
+
async function restoreCandidates(sessionManager, cwd, options, needsRestore) {
|
|
284
381
|
const targets = [];
|
|
285
382
|
const left = new Map();
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
383
|
+
const checkouts = [...currentWorktreeSnapshots(sessionManager)].filter(([root]) => !options.keepInPlace?.has(root));
|
|
384
|
+
const comparisons = await settleBounded(checkouts, VERIFY_CONCURRENCY, ([root, snapshot]) => needsRestore(snapshot, root));
|
|
385
|
+
for (const [index, [root, snapshot]] of checkouts.entries()) {
|
|
289
386
|
const runsHere = isInside(root, cwd);
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
catch (error) {
|
|
387
|
+
const comparison = comparisons[index];
|
|
388
|
+
if (comparison.status === "rejected") {
|
|
389
|
+
const error = comparison.reason;
|
|
295
390
|
if (runsHere || options.signal?.aborted || !isCheckoutFailure(error))
|
|
296
391
|
throw error;
|
|
297
392
|
left.set(root, notRestored(root, snapshot, `it could not be compared with the snapshot: ${error.message}`));
|
|
298
393
|
continue;
|
|
299
394
|
}
|
|
395
|
+
if (!comparison.value)
|
|
396
|
+
continue;
|
|
300
397
|
const absent = !(await isDirectory(root));
|
|
301
398
|
if (!runsHere && !absent && (await checkoutsWorkedHere(new Map([[root, snapshot]]), cwd, options)).has(root)) {
|
|
302
399
|
left.set(root, notRestored(root, snapshot, "it changed since the snapshot, and the session worked in it on this node, so it stays as it is"));
|
|
@@ -306,6 +403,26 @@ async function restoreCandidates(sessionManager, cwd, options) {
|
|
|
306
403
|
}
|
|
307
404
|
return { targets, left };
|
|
308
405
|
}
|
|
406
|
+
/** How many recorded checkouts a resume compares with their snapshots at once. */
|
|
407
|
+
const VERIFY_CONCURRENCY = 4;
|
|
408
|
+
/** `map` over `items`, at most `limit` at a time, each outcome settled in the order of `items`. */
|
|
409
|
+
async function settleBounded(items, limit, map) {
|
|
410
|
+
const outcomes = [];
|
|
411
|
+
let next = 0;
|
|
412
|
+
const work = async () => {
|
|
413
|
+
while (next < items.length) {
|
|
414
|
+
const index = next++;
|
|
415
|
+
try {
|
|
416
|
+
outcomes[index] = { status: "fulfilled", value: await map(items[index]) };
|
|
417
|
+
}
|
|
418
|
+
catch (reason) {
|
|
419
|
+
outcomes[index] = { status: "rejected", reason };
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, work));
|
|
424
|
+
return outcomes;
|
|
425
|
+
}
|
|
309
426
|
/**
|
|
310
427
|
* Restores what `plan` says into fresh worktrees with #4245's {@link resumeSessionWorktree}, recording each restore on
|
|
311
428
|
* `sessionManager`, and returns the mappings it recorded. The checkouts the session works in are restored together,
|
|
@@ -315,6 +432,9 @@ async function restoreCandidates(sessionManager, cwd, options) {
|
|
|
315
432
|
async function restorePlanned(sessionManager, plan, reused, storeDir, options) {
|
|
316
433
|
const outcome = { restored: [], failed: [] };
|
|
317
434
|
const restore = async (targets, pending) => {
|
|
435
|
+
for (const target of targets) {
|
|
436
|
+
options.onProgress?.(`Restoring ${target.root} from snapshot ${target.snapshot.id.slice(0, 12)}`);
|
|
437
|
+
}
|
|
318
438
|
const restoring = new Set(targets.map((target) => target.root));
|
|
319
439
|
const resumed = await resumeSessionWorktree(sessionManager, {
|
|
320
440
|
settings: options.settings,
|