@opencorelabs/lucidity 0.8.0 → 0.9.6
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/README.md +46 -5
- package/bin/lucidity.js +9 -1
- package/dist/agentControls.d.ts +3 -3
- package/dist/agentControls.d.ts.map +1 -1
- package/dist/agentControls.js +9 -6
- package/dist/assets/speech/lucidity-speech +0 -0
- package/dist/automations/agent.d.ts.map +1 -1
- package/dist/automations/agent.js +8 -3
- package/dist/automations/githubIssues.d.ts +25 -0
- package/dist/automations/githubIssues.d.ts.map +1 -0
- package/dist/automations/githubIssues.js +48 -0
- package/dist/automations/service.d.ts +8 -0
- package/dist/automations/service.d.ts.map +1 -1
- package/dist/automations/service.js +84 -25
- package/dist/automations/skill.d.ts +1 -1
- package/dist/automations/skill.d.ts.map +1 -1
- package/dist/automations/skill.js +3 -25
- package/dist/automations/store.d.ts +9 -3
- package/dist/automations/store.d.ts.map +1 -1
- package/dist/automations/store.js +45 -32
- package/dist/automations/workflow.d.ts +14 -0
- package/dist/automations/workflow.d.ts.map +1 -0
- package/dist/automations/workflow.js +57 -0
- package/dist/automations/workflowCrash.integration.d.ts +2 -0
- package/dist/automations/workflowCrash.integration.d.ts.map +1 -0
- package/dist/automations/workflowCrash.integration.js +78 -0
- package/dist/chat/server.d.ts +18 -0
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +203 -84
- package/dist/coding/agentMessages.d.ts +37 -0
- package/dist/coding/agentMessages.d.ts.map +1 -0
- package/dist/coding/agentMessages.js +220 -0
- package/dist/coding/agentSettings.d.ts +9 -0
- package/dist/coding/agentSettings.d.ts.map +1 -0
- package/dist/coding/agentSettings.js +22 -0
- package/dist/coding/fileContext.d.ts +4 -0
- package/dist/coding/fileContext.d.ts.map +1 -0
- package/dist/coding/fileContext.js +61 -0
- package/dist/coding/listPrs.d.ts +6 -0
- package/dist/coding/listPrs.d.ts.map +1 -1
- package/dist/coding/listPrs.js +11 -1
- package/dist/coding/lucidRouting.d.ts +67 -0
- package/dist/coding/lucidRouting.d.ts.map +1 -0
- package/dist/coding/lucidRouting.js +216 -0
- package/dist/coding/overviewSources.d.ts +52 -0
- package/dist/coding/overviewSources.d.ts.map +1 -0
- package/dist/coding/overviewSources.js +78 -0
- package/dist/coding/progress.d.ts +27 -0
- package/dist/coding/progress.d.ts.map +1 -0
- package/dist/coding/progress.js +152 -0
- package/dist/coding/repositoryRequests.d.ts +38 -0
- package/dist/coding/repositoryRequests.d.ts.map +1 -0
- package/dist/coding/repositoryRequests.js +137 -0
- package/dist/coding/runCodeTurn.d.ts +28 -22
- package/dist/coding/runCodeTurn.d.ts.map +1 -1
- package/dist/coding/runCodeTurn.js +109 -158
- package/dist/coding/runReview.d.ts +10 -0
- package/dist/coding/runReview.d.ts.map +1 -0
- package/dist/coding/runReview.js +87 -0
- package/dist/coding/workspaceOverview.d.ts +106 -0
- package/dist/coding/workspaceOverview.d.ts.map +1 -0
- package/dist/coding/workspaceOverview.js +96 -0
- package/dist/coding/workspaceRegistry.d.ts +278 -4
- package/dist/coding/workspaceRegistry.d.ts.map +1 -1
- package/dist/coding/workspaceRegistry.js +1008 -27
- package/dist/coding/workspaceTitle.d.ts +14 -0
- package/dist/coding/workspaceTitle.d.ts.map +1 -0
- package/dist/coding/workspaceTitle.js +8 -0
- package/dist/coding/worktree.d.ts +62 -19
- package/dist/coding/worktree.d.ts.map +1 -1
- package/dist/coding/worktree.js +152 -19
- package/dist/coding/worktreeSetup.d.ts +7 -0
- package/dist/coding/worktreeSetup.d.ts.map +1 -0
- package/dist/coding/worktreeSetup.js +82 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +38 -3
- package/dist/editor/existingWorkspace.d.ts +3 -0
- package/dist/editor/existingWorkspace.d.ts.map +1 -0
- package/dist/editor/existingWorkspace.js +19 -0
- package/dist/editor/fileActions.d.ts +26 -0
- package/dist/editor/fileActions.d.ts.map +1 -0
- package/dist/editor/fileActions.js +134 -0
- package/dist/editor/files.d.ts +27 -0
- package/dist/editor/files.d.ts.map +1 -0
- package/dist/editor/files.js +279 -0
- package/dist/editor/gitActions.d.ts +18 -0
- package/dist/editor/gitActions.d.ts.map +1 -0
- package/dist/editor/gitActions.js +140 -0
- package/dist/editor/localEndpoint.d.ts +4 -0
- package/dist/editor/localEndpoint.d.ts.map +1 -0
- package/dist/editor/localEndpoint.js +35 -0
- package/dist/editor/service.d.ts +28 -0
- package/dist/editor/service.d.ts.map +1 -0
- package/dist/editor/service.js +101 -0
- package/dist/editor/shellCommands.d.ts +21 -0
- package/dist/editor/shellCommands.d.ts.map +1 -0
- package/dist/editor/shellCommands.js +165 -0
- package/dist/editor/terminals.d.ts +34 -0
- package/dist/editor/terminals.d.ts.map +1 -0
- package/dist/editor/terminals.js +161 -0
- package/dist/editor/types.d.ts +37 -0
- package/dist/editor/types.d.ts.map +1 -0
- package/dist/editor/types.js +1 -0
- package/dist/files/store.d.ts +13 -0
- package/dist/files/store.d.ts.map +1 -0
- package/dist/files/store.js +150 -0
- package/dist/goals/assessment.d.ts +6 -6
- package/dist/index.js +249 -80
- package/dist/install.d.ts +7 -0
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +5 -2
- package/dist/jobs/briefing.d.ts +2 -16
- package/dist/jobs/briefing.d.ts.map +1 -1
- package/dist/jobs/briefing.js +57 -102
- package/dist/jobs/extraction.d.ts +2 -1
- package/dist/jobs/extraction.d.ts.map +1 -1
- package/dist/jobs/extraction.js +2 -2
- package/dist/jobs/fastModeReview.d.ts +3 -1
- package/dist/jobs/fastModeReview.d.ts.map +1 -1
- package/dist/jobs/fastModeReview.js +20 -11
- package/dist/jobs/voiceReview.js +4 -4
- package/dist/jobs/weeklyReview.d.ts +1 -1
- package/dist/jobs/weeklyReview.d.ts.map +1 -1
- package/dist/jobs/weeklyReview.js +2 -5
- package/dist/logTimestamps.d.ts +10 -0
- package/dist/logTimestamps.d.ts.map +1 -0
- package/dist/logTimestamps.js +12 -0
- package/dist/lucidInvocations.d.ts +44 -0
- package/dist/lucidInvocations.d.ts.map +1 -0
- package/dist/lucidInvocations.js +164 -0
- package/dist/mcp/config.d.ts +8 -2
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +52 -10
- package/dist/mcp/paired.js +1 -0
- package/dist/providerFallbackContext.d.ts +5 -0
- package/dist/providerFallbackContext.d.ts.map +1 -0
- package/dist/providerFallbackContext.js +58 -0
- package/dist/providerRecovery.d.ts +65 -0
- package/dist/providerRecovery.d.ts.map +1 -0
- package/dist/providerRecovery.js +102 -0
- package/dist/providerRoles.d.ts +9 -0
- package/dist/providerRoles.d.ts.map +1 -0
- package/dist/providerRoles.js +25 -0
- package/dist/recall/command.d.ts +139 -0
- package/dist/recall/command.d.ts.map +1 -0
- package/dist/recall/command.js +35 -0
- package/dist/recall/context.d.ts +5 -0
- package/dist/recall/context.d.ts.map +1 -0
- package/dist/recall/context.js +66 -0
- package/dist/recall/conversations.d.ts +182 -0
- package/dist/recall/conversations.d.ts.map +1 -0
- package/dist/recall/conversations.js +58 -0
- package/dist/recall/documents.d.ts +76 -0
- package/dist/recall/documents.d.ts.map +1 -0
- package/dist/recall/documents.js +32 -0
- package/dist/recall/evaluation.d.ts +77 -0
- package/dist/recall/evaluation.d.ts.map +1 -0
- package/dist/recall/evaluation.js +88 -0
- package/dist/recall/factory.d.ts +6 -0
- package/dist/recall/factory.d.ts.map +1 -0
- package/dist/recall/factory.js +20 -0
- package/dist/recall/index.d.ts +13 -0
- package/dist/recall/index.d.ts.map +1 -0
- package/dist/recall/index.js +92 -0
- package/dist/recall/memories.d.ts +16 -0
- package/dist/recall/memories.d.ts.map +1 -0
- package/dist/recall/memories.js +136 -0
- package/dist/recall/memorySelection.d.ts +4 -0
- package/dist/recall/memorySelection.d.ts.map +1 -0
- package/dist/recall/memorySelection.js +16 -0
- package/dist/recall/memoryService.d.ts +22 -0
- package/dist/recall/memoryService.d.ts.map +1 -0
- package/dist/recall/memoryService.js +171 -0
- package/dist/recall/personal.d.ts +127 -0
- package/dist/recall/personal.d.ts.map +1 -0
- package/dist/recall/personal.js +125 -0
- package/dist/recall/projects.d.ts +67 -0
- package/dist/recall/projects.d.ts.map +1 -0
- package/dist/recall/projects.js +117 -0
- package/dist/recall/query.d.ts +5 -0
- package/dist/recall/query.d.ts.map +1 -0
- package/dist/recall/query.js +17 -0
- package/dist/recall/semanticEvaluation.d.ts +2 -0
- package/dist/recall/semanticEvaluation.d.ts.map +1 -0
- package/dist/recall/semanticEvaluation.js +123 -0
- package/dist/recall/service.d.ts +62 -0
- package/dist/recall/service.d.ts.map +1 -0
- package/dist/recall/service.js +94 -0
- package/dist/room/client.d.ts +43 -20
- package/dist/room/client.d.ts.map +1 -1
- package/dist/room/client.js +242 -54
- package/dist/room/codingActivity.d.ts +21 -0
- package/dist/room/codingActivity.d.ts.map +1 -0
- package/dist/room/codingActivity.js +86 -0
- package/dist/room/computer.d.ts.map +1 -1
- package/dist/room/computer.js +19 -4
- package/dist/room/context.d.ts +3 -2
- package/dist/room/context.d.ts.map +1 -1
- package/dist/room/context.js +5 -4
- package/dist/room/desktop-live.integration.d.ts +2 -0
- package/dist/room/desktop-live.integration.d.ts.map +1 -0
- package/dist/room/desktop-live.integration.js +219 -0
- package/dist/room/incidents.d.ts +3 -0
- package/dist/room/incidents.d.ts.map +1 -1
- package/dist/room/incidents.js +1 -0
- package/dist/room/turnQueue.d.ts +24 -2
- package/dist/room/turnQueue.d.ts.map +1 -1
- package/dist/room/turnQueue.js +123 -51
- package/dist/runtimeStore.d.ts +19 -0
- package/dist/runtimeStore.d.ts.map +1 -1
- package/dist/runtimeStore.js +49 -3
- package/dist/setup/page.d.ts +1 -1
- package/dist/setup/page.d.ts.map +1 -1
- package/dist/setup/page.js +15 -2
- package/dist/setup/server.d.ts +5 -1
- package/dist/setup/server.d.ts.map +1 -1
- package/dist/setup/server.js +37 -13
- package/dist/skills/install.d.ts +8 -0
- package/dist/skills/install.d.ts.map +1 -0
- package/dist/skills/install.js +82 -0
- package/dist/skills/lucidity/SKILL.md +65 -0
- package/dist/skills/lucidity-task-handoff/SKILL.md +122 -0
- package/dist/speech/captures.d.ts +4 -0
- package/dist/speech/captures.d.ts.map +1 -1
- package/dist/speech/captures.js +53 -41
- package/dist/updateCli.d.ts +2 -0
- package/dist/updateCli.d.ts.map +1 -0
- package/dist/updateCli.js +40 -0
- package/dist/updateService.d.ts +3 -0
- package/dist/updateService.d.ts.map +1 -0
- package/dist/updateService.js +23 -0
- package/dist/updates/admission.d.ts +23 -0
- package/dist/updates/admission.d.ts.map +1 -0
- package/dist/updates/admission.js +76 -0
- package/dist/updates/bootstrap.d.ts +23 -0
- package/dist/updates/bootstrap.d.ts.map +1 -0
- package/dist/updates/bootstrap.js +95 -0
- package/dist/updates/bootstrapConfig.d.ts +34 -0
- package/dist/updates/bootstrapConfig.d.ts.map +1 -0
- package/dist/updates/bootstrapConfig.js +35 -0
- package/dist/updates/connection.d.ts +20 -0
- package/dist/updates/connection.d.ts.map +1 -0
- package/dist/updates/connection.js +111 -0
- package/dist/updates/developmentAdmission.d.ts +29 -0
- package/dist/updates/developmentAdmission.d.ts.map +1 -0
- package/dist/updates/developmentAdmission.js +73 -0
- package/dist/updates/developmentCli.d.ts +2 -0
- package/dist/updates/developmentCli.d.ts.map +1 -0
- package/dist/updates/developmentCli.js +61 -0
- package/dist/updates/developmentRefresh.d.ts +73 -0
- package/dist/updates/developmentRefresh.d.ts.map +1 -0
- package/dist/updates/developmentRefresh.js +157 -0
- package/dist/updates/developmentService.d.ts +13 -0
- package/dist/updates/developmentService.d.ts.map +1 -0
- package/dist/updates/developmentService.js +217 -0
- package/dist/updates/download.d.ts +7 -0
- package/dist/updates/download.d.ts.map +1 -0
- package/dist/updates/download.js +52 -0
- package/dist/updates/feed.d.ts +7 -0
- package/dist/updates/feed.d.ts.map +1 -0
- package/dist/updates/feed.js +37 -0
- package/dist/updates/installService.d.ts +3 -0
- package/dist/updates/installService.d.ts.map +1 -0
- package/dist/updates/installService.js +78 -0
- package/dist/updates/installationReferences.d.ts +17 -0
- package/dist/updates/installationReferences.d.ts.map +1 -0
- package/dist/updates/installationReferences.js +104 -0
- package/dist/updates/installationStore.d.ts +49 -0
- package/dist/updates/installationStore.d.ts.map +1 -0
- package/dist/updates/installationStore.js +237 -0
- package/dist/updates/installer.d.ts +29 -0
- package/dist/updates/installer.d.ts.map +1 -0
- package/dist/updates/installer.js +205 -0
- package/dist/updates/journal.d.ts +228 -0
- package/dist/updates/journal.d.ts.map +1 -0
- package/dist/updates/journal.js +249 -0
- package/dist/updates/managedLifecycle.d.ts +26 -0
- package/dist/updates/managedLifecycle.d.ts.map +1 -0
- package/dist/updates/managedLifecycle.js +60 -0
- package/dist/updates/migrateService.d.ts +2 -0
- package/dist/updates/migrateService.d.ts.map +1 -0
- package/dist/updates/migrateService.js +44 -0
- package/dist/updates/migration.d.ts +15 -0
- package/dist/updates/migration.d.ts.map +1 -0
- package/dist/updates/migration.js +108 -0
- package/dist/updates/processControl.d.ts +47 -0
- package/dist/updates/processControl.d.ts.map +1 -0
- package/dist/updates/processControl.js +98 -0
- package/dist/updates/processHost.d.ts +52 -0
- package/dist/updates/processHost.d.ts.map +1 -0
- package/dist/updates/processHost.js +165 -0
- package/dist/updates/registerService.d.ts +4 -0
- package/dist/updates/registerService.d.ts.map +1 -0
- package/dist/updates/registerService.js +34 -0
- package/dist/updates/releases.d.ts +84 -0
- package/dist/updates/releases.d.ts.map +1 -0
- package/dist/updates/releases.js +51 -0
- package/dist/updates/retention.d.ts +32 -0
- package/dist/updates/retention.d.ts.map +1 -0
- package/dist/updates/retention.js +188 -0
- package/dist/updates/runner.d.ts +6 -0
- package/dist/updates/runner.d.ts.map +1 -0
- package/dist/updates/runner.js +117 -0
- package/dist/updates/service.d.ts +53 -0
- package/dist/updates/service.d.ts.map +1 -0
- package/dist/updates/service.js +268 -0
- package/dist/updates/servicePlan.d.ts +29 -0
- package/dist/updates/servicePlan.d.ts.map +1 -0
- package/dist/updates/servicePlan.js +58 -0
- package/dist/updates/signCatalog.d.ts +10 -0
- package/dist/updates/signCatalog.d.ts.map +1 -0
- package/dist/updates/signCatalog.js +44 -0
- package/dist/updates/supervisor.d.ts +27 -0
- package/dist/updates/supervisor.d.ts.map +1 -0
- package/dist/updates/supervisor.js +137 -0
- package/dist/updates/windowsService.d.ts +12 -0
- package/dist/updates/windowsService.d.ts.map +1 -0
- package/dist/updates/windowsService.js +51 -0
- package/dist/vault.d.ts +6 -3
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +18 -4
- package/dist/video/context.d.ts +4 -0
- package/dist/video/context.d.ts.map +1 -0
- package/dist/video/context.js +74 -0
- package/dist/video/store.d.ts +22 -0
- package/dist/video/store.d.ts.map +1 -0
- package/dist/video/store.js +184 -0
- package/npm-shrinkwrap.json +1792 -0
- package/package.json +4 -1
- package/src/agentControls.ts +11 -7
- package/src/automations/agent.ts +11 -2
- package/src/automations/githubIssues.ts +63 -0
- package/src/automations/service.ts +72 -24
- package/src/automations/skill.ts +5 -37
- package/src/automations/store.ts +41 -50
- package/src/automations/workflow.ts +49 -0
- package/src/automations/workflowCrash.integration.ts +70 -0
- package/src/chat/server.ts +162 -89
- package/src/coding/agentMessages.ts +217 -0
- package/src/coding/agentSettings.ts +22 -0
- package/src/coding/fileContext.ts +72 -0
- package/src/coding/listPrs.ts +15 -1
- package/src/coding/lucidRouting.ts +211 -0
- package/src/coding/overviewSources.ts +86 -0
- package/src/coding/progress.ts +146 -0
- package/src/coding/repositoryRequests.ts +117 -0
- package/src/coding/runCodeTurn.ts +127 -182
- package/src/coding/runReview.ts +83 -0
- package/src/coding/workspaceOverview.ts +99 -0
- package/src/coding/workspaceRegistry.ts +921 -28
- package/src/coding/workspaceTitle.ts +10 -0
- package/src/coding/worktree.ts +164 -22
- package/src/coding/worktreeSetup.ts +73 -0
- package/src/config.ts +37 -2
- package/src/editor/existingWorkspace.ts +17 -0
- package/src/editor/fileActions.ts +162 -0
- package/src/editor/files.ts +276 -0
- package/src/editor/gitActions.ts +150 -0
- package/src/editor/localEndpoint.ts +28 -0
- package/src/editor/service.ts +93 -0
- package/src/editor/shellCommands.ts +132 -0
- package/src/editor/terminals.ts +129 -0
- package/src/editor/types.ts +32 -0
- package/src/files/store.ts +131 -0
- package/src/index.ts +242 -77
- package/src/install.ts +4 -2
- package/src/jobs/briefing.ts +56 -114
- package/src/jobs/extraction.ts +5 -4
- package/src/jobs/fastModeReview.ts +22 -11
- package/src/jobs/voiceReview.ts +4 -4
- package/src/jobs/weeklyReview.ts +2 -4
- package/src/logTimestamps.ts +14 -0
- package/src/lucidInvocations.ts +152 -0
- package/src/mcp/config.ts +48 -10
- package/src/mcp/paired.ts +1 -0
- package/src/providerFallbackContext.ts +48 -0
- package/src/providerRecovery.ts +101 -0
- package/src/providerRoles.ts +35 -0
- package/src/recall/command.ts +42 -0
- package/src/recall/context.ts +64 -0
- package/src/recall/conversations.ts +53 -0
- package/src/recall/documents.ts +32 -0
- package/src/recall/evaluation.ts +89 -0
- package/src/recall/factory.ts +21 -0
- package/src/recall/index.ts +87 -0
- package/src/recall/memories.ts +123 -0
- package/src/recall/memorySelection.ts +17 -0
- package/src/recall/memoryService.ts +138 -0
- package/src/recall/personal.ts +97 -0
- package/src/recall/projects.ts +98 -0
- package/src/recall/query.ts +21 -0
- package/src/recall/semanticEvaluation.ts +101 -0
- package/src/recall/service.ts +85 -0
- package/src/room/client.ts +257 -85
- package/src/room/codingActivity.ts +70 -0
- package/src/room/computer.ts +19 -4
- package/src/room/context.ts +7 -2
- package/src/room/desktop-live.integration.ts +203 -0
- package/src/room/incidents.ts +4 -0
- package/src/room/turnQueue.ts +117 -62
- package/src/runtimeStore.ts +53 -4
- package/src/setup/page.ts +15 -2
- package/src/setup/server.ts +28 -5
- package/src/skills/install.ts +65 -0
- package/src/speech/captures.ts +56 -44
- package/src/updateCli.ts +37 -0
- package/src/updateService.ts +21 -0
- package/src/updates/admission.ts +70 -0
- package/src/updates/bootstrap.ts +77 -0
- package/src/updates/bootstrapConfig.ts +29 -0
- package/src/updates/connection.ts +84 -0
- package/src/updates/developmentAdmission.ts +56 -0
- package/src/updates/developmentCli.ts +47 -0
- package/src/updates/developmentRefresh.ts +130 -0
- package/src/updates/developmentService.ts +170 -0
- package/src/updates/download.ts +53 -0
- package/src/updates/feed.ts +34 -0
- package/src/updates/installService.ts +67 -0
- package/src/updates/installationReferences.ts +87 -0
- package/src/updates/installationStore.ts +196 -0
- package/src/updates/installer.ts +203 -0
- package/src/updates/journal.ts +250 -0
- package/src/updates/managedLifecycle.ts +64 -0
- package/src/updates/migrateService.ts +33 -0
- package/src/updates/migration.ts +92 -0
- package/src/updates/processControl.ts +96 -0
- package/src/updates/processHost.ts +159 -0
- package/src/updates/registerService.ts +27 -0
- package/src/updates/releases.ts +53 -0
- package/src/updates/retention.ts +154 -0
- package/src/updates/runner.ts +104 -0
- package/src/updates/service.ts +241 -0
- package/src/updates/servicePlan.ts +63 -0
- package/src/updates/signCatalog.ts +40 -0
- package/src/updates/supervisor.ts +114 -0
- package/src/updates/windowsService.ts +54 -0
- package/src/vault.ts +16 -7
- package/src/video/context.ts +101 -0
- package/src/video/store.ts +250 -0
- package/vendor/decisions/dist/followup.d.ts +14 -0
- package/vendor/decisions/dist/followup.js +86 -0
- package/vendor/decisions/dist/index.d.ts +3 -0
- package/vendor/decisions/dist/index.js +3 -0
- package/vendor/decisions/dist/repositoryReplay.d.ts +103 -0
- package/vendor/decisions/dist/repositoryReplay.js +177 -0
- package/vendor/decisions/dist/repositoryRouting.d.ts +21 -0
- package/vendor/decisions/dist/repositoryRouting.js +125 -0
- package/vendor/decisions/src/followup.ts +129 -0
- package/vendor/decisions/src/index.ts +3 -0
- package/vendor/decisions/src/repositoryReplay.ts +312 -0
- package/vendor/decisions/src/repositoryRouting.ts +167 -0
- package/vendor/mcp-server/README.md +6 -0
- package/vendor/mcp-server/dist/index.js +21 -7
- package/vendor/mcp-server/dist/localDaemon.d.ts +4 -0
- package/vendor/mcp-server/dist/localDaemon.d.ts.map +1 -0
- package/vendor/mcp-server/dist/localDaemon.js +41 -0
- package/vendor/mcp-server/dist/tools/agents.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/agents.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/agents.js +60 -0
- package/vendor/mcp-server/dist/tools/artifacts.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/artifacts.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/artifacts.js +22 -0
- package/vendor/mcp-server/dist/tools/automations.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/automations.js +7 -32
- package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts +1 -1
- package/vendor/mcp-server/dist/tools/commandEventFormat.js +2 -2
- package/vendor/mcp-server/dist/tools/commandEvents.js +1 -1
- package/vendor/mcp-server/dist/tools/comments.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/comments.js +5 -1
- package/vendor/mcp-server/dist/tools/journal.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/journal.js +1 -0
- package/vendor/mcp-server/dist/tools/memory.d.ts +0 -10
- package/vendor/mcp-server/dist/tools/memory.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/memory.js +28 -102
- package/vendor/mcp-server/dist/tools/notes.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/notes.js +38 -4
- package/vendor/mcp-server/dist/tools/recall.d.ts +6 -0
- package/vendor/mcp-server/dist/tools/recall.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/recall.js +78 -0
- package/vendor/mcp-server/dist/tools/summary.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/summary.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/summary.js +22 -0
- package/vendor/mcp-server/dist/tools/taskSheet.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/taskSheet.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/taskSheet.js +32 -0
- package/vendor/mcp-server/dist/tools/tasks.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/tasks.js +117 -24
- package/vendor/mcp-server/dist/tools/worktrees.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/worktrees.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/worktrees.js +51 -0
- package/vendor/mcp-server/package.json +1 -1
- package/vendor/mcp-server/src/index.ts +17 -7
- package/vendor/mcp-server/src/localDaemon.ts +56 -0
- package/vendor/mcp-server/src/tools/agents.ts +78 -0
- package/vendor/mcp-server/src/tools/artifacts.ts +26 -0
- package/vendor/mcp-server/src/tools/automations.ts +7 -47
- package/vendor/mcp-server/src/tools/commandEventFormat.ts +2 -2
- package/vendor/mcp-server/src/tools/commandEvents.ts +1 -1
- package/vendor/mcp-server/src/tools/comments.ts +4 -1
- package/vendor/mcp-server/src/tools/journal.ts +1 -0
- package/vendor/mcp-server/src/tools/memory.ts +37 -130
- package/vendor/mcp-server/src/tools/notes.ts +35 -5
- package/vendor/mcp-server/src/tools/recall.ts +89 -0
- package/vendor/mcp-server/src/tools/summary.ts +30 -0
- package/vendor/mcp-server/src/tools/taskSheet.ts +60 -0
- package/vendor/mcp-server/src/tools/tasks.ts +125 -24
- package/vendor/mcp-server/src/tools/worktrees.ts +61 -0
- package/vendor/notes/dist/artifacts.d.ts +8 -0
- package/vendor/notes/dist/artifacts.d.ts.map +1 -0
- package/vendor/notes/dist/artifacts.js +105 -0
- package/vendor/notes/dist/index.d.ts +1 -0
- package/vendor/notes/dist/index.d.ts.map +1 -1
- package/vendor/notes/dist/index.js +1 -0
- package/vendor/notes/dist/vault.d.ts.map +1 -1
- package/vendor/notes/dist/vault.js +2 -0
- package/vendor/notes/src/artifacts.ts +100 -0
- package/vendor/notes/src/index.ts +2 -0
- package/vendor/notes/src/vault.ts +1 -0
- package/vendor/runtime/README.md +42 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts +22 -1
- package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeAgent.js +199 -28
- package/vendor/runtime/dist/executor/claudeCode.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeCode.js +19 -2
- package/vendor/runtime/dist/executor/claudeSession.d.ts +32 -0
- package/vendor/runtime/dist/executor/claudeSession.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/claudeSession.js +154 -0
- package/vendor/runtime/dist/executor/codex.d.ts +25 -4
- package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codex.js +181 -22
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts +24 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts +14 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts +15 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts +29 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts +20 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts +11 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts +9 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts +4 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts +16 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts +4 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts +9 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts +100 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts +216 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts +11 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts +19 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts +36 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts +15 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.js +2 -0
- package/vendor/runtime/dist/executor/codexRpc.d.ts +3 -1
- package/vendor/runtime/dist/executor/codexRpc.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexRpc.js +3 -2
- package/vendor/runtime/dist/executor/codexSessions.d.ts +5 -10
- package/vendor/runtime/dist/executor/codexSessions.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexSessions.js +12 -78
- package/vendor/runtime/dist/executor/fallback.d.ts +27 -0
- package/vendor/runtime/dist/executor/fallback.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/fallback.js +45 -0
- package/vendor/runtime/dist/executor/health.d.ts +25 -2
- package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/health.js +23 -2
- package/vendor/runtime/dist/executor/integrations.d.ts +4 -0
- package/vendor/runtime/dist/executor/integrations.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/integrations.js +5 -0
- package/vendor/runtime/dist/executor/liveTurns.d.ts +2 -2
- package/vendor/runtime/dist/executor/liveTurns.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/liveTurns.js +3 -3
- package/vendor/runtime/dist/executor/ownership.d.ts +24 -2
- package/vendor/runtime/dist/executor/ownership.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/ownership.js +10 -1
- package/vendor/runtime/dist/executor/providerRouter.d.ts +13 -0
- package/vendor/runtime/dist/executor/providerRouter.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/providerRouter.js +91 -5
- package/vendor/runtime/dist/executor/sessionRetention.d.ts +34 -0
- package/vendor/runtime/dist/executor/sessionRetention.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/sessionRetention.js +126 -0
- package/vendor/runtime/dist/executor/types.d.ts +55 -7
- package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/usage.d.ts +5 -0
- package/vendor/runtime/dist/executor/usage.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/usage.js +56 -0
- package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.js +3 -5
- package/vendor/runtime/dist/harness/types.d.ts +3 -1
- package/vendor/runtime/dist/harness/types.d.ts.map +1 -1
- package/vendor/runtime/dist/index.d.ts +7 -2
- package/vendor/runtime/dist/index.d.ts.map +1 -1
- package/vendor/runtime/dist/index.js +3 -0
- package/vendor/runtime/dist/prompts/recall.d.ts +15 -0
- package/vendor/runtime/dist/prompts/recall.d.ts.map +1 -0
- package/vendor/runtime/dist/prompts/recall.js +71 -0
- package/vendor/runtime/src/executor/claudeAgent.ts +189 -31
- package/vendor/runtime/src/executor/claudeCode.ts +17 -3
- package/vendor/runtime/src/executor/claudeSession.ts +180 -0
- package/vendor/runtime/src/executor/codex.ts +187 -26
- package/vendor/runtime/src/executor/codexProtocol/AgentPath.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/ImageGenerationFailure.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/ImageGenerationItem.ts +7 -0
- package/vendor/runtime/src/executor/codexProtocol/LegacyAppPathString.ts +27 -0
- package/vendor/runtime/src/executor/codexProtocol/MessagePhase.ts +11 -0
- package/vendor/runtime/src/executor/codexProtocol/SleepItem.ts +8 -0
- package/vendor/runtime/src/executor/codexProtocol/SubAgentSource.ts +7 -0
- package/vendor/runtime/src/executor/codexProtocol/ThreadId.ts +10 -0
- package/vendor/runtime/src/executor/codexProtocol/WebSearchItem.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/AgentMessageDelivery.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/AsyncUserInputQuestion.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CodexErrorInfo.ts +12 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentState.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentTool.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandAction.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionSource.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/FileUpdateChange.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/GitInfo.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/HookPromptFragment.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpAppDisplayMode.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpAppUi.ts +9 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallAppContext.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallError.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallResult.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitation.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitationEntry.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentErrorDetails.ts +18 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentSteer.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/NonSteerableTurnKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/PatchApplyStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/PatchChangeKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SessionSource.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SubAgentActivityKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/Thread.ts +104 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadActiveFlag.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadHistoryMode.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadItem.ts +125 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadParams.ts +12 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadResponse.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSection.ts +21 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSectionAppearance.ts +8 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadStatus.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/Turn.ts +37 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnError.ts +11 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnItemsView.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/WebSearchAction.ts +5 -0
- package/vendor/runtime/src/executor/codexRpc.ts +4 -2
- package/vendor/runtime/src/executor/codexSessions.ts +18 -82
- package/vendor/runtime/src/executor/fallback.ts +63 -0
- package/vendor/runtime/src/executor/health.ts +21 -3
- package/vendor/runtime/src/executor/integrations.ts +7 -0
- package/vendor/runtime/src/executor/liveTurns.ts +5 -5
- package/vendor/runtime/src/executor/ownership.ts +11 -2
- package/vendor/runtime/src/executor/providerRouter.ts +85 -4
- package/vendor/runtime/src/executor/sessionRetention.ts +166 -0
- package/vendor/runtime/src/executor/types.ts +45 -8
- package/vendor/runtime/src/executor/usage.ts +58 -0
- package/vendor/runtime/src/harness/index.ts +3 -5
- package/vendor/runtime/src/harness/types.ts +3 -1
- package/vendor/runtime/src/index.ts +8 -2
- package/vendor/runtime/src/prompts/recall.ts +72 -0
- package/vendor/shared/dist/accountDevices.d.ts +62 -0
- package/vendor/shared/dist/accountDevices.d.ts.map +1 -0
- package/vendor/shared/dist/accountDevices.js +25 -0
- package/vendor/shared/dist/activityRecovery.d.ts +37 -0
- package/vendor/shared/dist/activityRecovery.d.ts.map +1 -0
- package/vendor/shared/dist/activityRecovery.js +39 -0
- package/vendor/shared/dist/agentMessages.d.ts +187 -0
- package/vendor/shared/dist/agentMessages.d.ts.map +1 -0
- package/vendor/shared/dist/agentMessages.js +70 -0
- package/vendor/shared/dist/aiUsage.d.ts +30 -0
- package/vendor/shared/dist/aiUsage.d.ts.map +1 -0
- package/vendor/shared/dist/aiUsage.js +14 -0
- package/vendor/shared/dist/artifacts.d.ts +28 -0
- package/vendor/shared/dist/artifacts.d.ts.map +1 -0
- package/vendor/shared/dist/artifacts.js +47 -0
- package/vendor/shared/dist/automationTemplates.d.ts.map +1 -1
- package/vendor/shared/dist/automationTemplates.js +1 -0
- package/vendor/shared/dist/automations.d.ts +95 -14
- package/vendor/shared/dist/automations.d.ts.map +1 -1
- package/vendor/shared/dist/automations.js +22 -3
- package/vendor/shared/dist/cardStudio.d.ts +31 -31
- package/vendor/shared/dist/chatActivity.d.ts +17 -0
- package/vendor/shared/dist/chatActivity.d.ts.map +1 -0
- package/vendor/shared/dist/chatActivity.js +47 -0
- package/vendor/shared/dist/codingActivity.d.ts +60 -0
- package/vendor/shared/dist/codingActivity.d.ts.map +1 -0
- package/vendor/shared/dist/codingActivity.js +33 -0
- package/vendor/shared/dist/commandLocal.d.ts +1 -1
- package/vendor/shared/dist/commandLocal.d.ts.map +1 -1
- package/vendor/shared/dist/commands.d.ts +32 -32
- package/vendor/shared/dist/commands.d.ts.map +1 -1
- package/vendor/shared/dist/commands.js +1 -1
- package/vendor/shared/dist/commentMentions.d.ts +20 -0
- package/vendor/shared/dist/commentMentions.d.ts.map +1 -0
- package/vendor/shared/dist/commentMentions.js +14 -0
- package/vendor/shared/dist/computer.d.ts +48 -8
- package/vendor/shared/dist/computer.d.ts.map +1 -1
- package/vendor/shared/dist/computer.js +26 -2
- package/vendor/shared/dist/constants.d.ts +1 -1
- package/vendor/shared/dist/constants.d.ts.map +1 -1
- package/vendor/shared/dist/constants.js +8 -10
- package/vendor/shared/dist/daemonUpdates.d.ts +123 -0
- package/vendor/shared/dist/daemonUpdates.d.ts.map +1 -0
- package/vendor/shared/dist/daemonUpdates.js +106 -0
- package/vendor/shared/dist/deviceInteraction.d.ts +23 -0
- package/vendor/shared/dist/deviceInteraction.d.ts.map +1 -0
- package/vendor/shared/dist/deviceInteraction.js +32 -0
- package/vendor/shared/dist/doctor.d.ts +50 -0
- package/vendor/shared/dist/doctor.d.ts.map +1 -0
- package/vendor/shared/dist/doctor.js +15 -0
- package/vendor/shared/dist/fileUploads.d.ts +39 -0
- package/vendor/shared/dist/fileUploads.d.ts.map +1 -0
- package/vendor/shared/dist/fileUploads.js +24 -0
- package/vendor/shared/dist/files.d.ts +11 -0
- package/vendor/shared/dist/files.d.ts.map +1 -0
- package/vendor/shared/dist/files.js +19 -0
- package/vendor/shared/dist/githubContributions.d.ts +1 -1
- package/vendor/shared/dist/goals.d.ts +7 -7
- package/vendor/shared/dist/index.d.ts +32 -3
- package/vendor/shared/dist/index.d.ts.map +1 -1
- package/vendor/shared/dist/index.js +28 -1
- package/vendor/shared/dist/journal-vault.d.ts +1 -1
- package/vendor/shared/dist/lucidFollowups.d.ts +95 -0
- package/vendor/shared/dist/lucidFollowups.d.ts.map +1 -0
- package/vendor/shared/dist/lucidFollowups.js +45 -0
- package/vendor/shared/dist/lucidInvocations.d.ts +82 -0
- package/vendor/shared/dist/lucidInvocations.d.ts.map +1 -0
- package/vendor/shared/dist/lucidInvocations.js +47 -0
- package/vendor/shared/dist/memory.d.ts +162 -0
- package/vendor/shared/dist/memory.d.ts.map +1 -0
- package/vendor/shared/dist/memory.js +26 -0
- package/vendor/shared/dist/messagingSafety.d.ts +64 -0
- package/vendor/shared/dist/messagingSafety.d.ts.map +1 -0
- package/vendor/shared/dist/messagingSafety.js +14 -0
- package/vendor/shared/dist/recall.d.ts +803 -0
- package/vendor/shared/dist/recall.d.ts.map +1 -0
- package/vendor/shared/dist/recall.js +56 -0
- package/vendor/shared/dist/releaseCompatibility.d.ts +228 -0
- package/vendor/shared/dist/releaseCompatibility.d.ts.map +1 -0
- package/vendor/shared/dist/releaseCompatibility.js +145 -0
- package/vendor/shared/dist/repositoryRequests.d.ts +173 -0
- package/vendor/shared/dist/repositoryRequests.d.ts.map +1 -0
- package/vendor/shared/dist/repositoryRequests.js +38 -0
- package/vendor/shared/dist/repositoryRouting.d.ts +169 -0
- package/vendor/shared/dist/repositoryRouting.d.ts.map +1 -0
- package/vendor/shared/dist/repositoryRouting.js +102 -0
- package/vendor/shared/dist/roomClient.d.ts +107 -0
- package/vendor/shared/dist/roomClient.d.ts.map +1 -0
- package/vendor/shared/dist/roomClient.js +371 -0
- package/vendor/shared/dist/schemas/comment.d.ts +46 -0
- package/vendor/shared/dist/schemas/comment.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/comment.js +10 -0
- package/vendor/shared/dist/schemas/conversation.d.ts +80 -1
- package/vendor/shared/dist/schemas/conversation.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/conversation.js +12 -1
- package/vendor/shared/dist/schemas/harness.d.ts +1724 -181
- package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/harness.js +125 -127
- package/vendor/shared/dist/schemas/notification.d.ts +3 -1
- package/vendor/shared/dist/schemas/notification.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/notification.js +2 -1
- package/vendor/shared/dist/schemas/organization.d.ts +2 -0
- package/vendor/shared/dist/schemas/organization.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/organization.js +2 -0
- package/vendor/shared/dist/schemas/project.d.ts +2 -2
- package/vendor/shared/dist/schemas/request.d.ts +1 -1
- package/vendor/shared/dist/schemas/task.d.ts +1 -1
- package/vendor/shared/dist/smartCapture.d.ts +24 -0
- package/vendor/shared/dist/smartCapture.d.ts.map +1 -1
- package/vendor/shared/dist/smartCapture.js +16 -1
- package/vendor/shared/dist/spokenNames.d.ts +1 -1
- package/vendor/shared/dist/spokenNames.js +1 -1
- package/vendor/shared/dist/taskActivity.d.ts +5 -5
- package/vendor/shared/dist/taskSharing.d.ts +8 -0
- package/vendor/shared/dist/taskSharing.d.ts.map +1 -0
- package/vendor/shared/dist/taskSharing.js +9 -0
- package/vendor/shared/dist/taskSync.d.ts +342 -0
- package/vendor/shared/dist/taskSync.d.ts.map +1 -0
- package/vendor/shared/dist/taskSync.js +111 -0
- package/vendor/shared/dist/thinking-orb/engine/core.d.ts +31 -0
- package/vendor/shared/dist/thinking-orb/engine/core.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/core.js +62 -0
- package/vendor/shared/dist/thinking-orb/engine/ctx.d.ts +9 -0
- package/vendor/shared/dist/thinking-orb/engine/ctx.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/ctx.js +1 -0
- package/vendor/shared/dist/thinking-orb/engine/lattice.d.ts +5 -0
- package/vendor/shared/dist/thinking-orb/engine/lattice.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/lattice.js +184 -0
- package/vendor/shared/dist/thinking-orb/engine/morph.d.ts +3 -0
- package/vendor/shared/dist/thinking-orb/engine/morph.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/morph.js +117 -0
- package/vendor/shared/dist/thinking-orb/engine/orbits.d.ts +3 -0
- package/vendor/shared/dist/thinking-orb/engine/orbits.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/orbits.js +66 -0
- package/vendor/shared/dist/thinking-orb/engine/profiles.d.ts +8 -0
- package/vendor/shared/dist/thinking-orb/engine/profiles.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/profiles.js +113 -0
- package/vendor/shared/dist/thinking-orb/engine/registry.d.ts +4 -0
- package/vendor/shared/dist/thinking-orb/engine/registry.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/registry.js +14 -0
- package/vendor/shared/dist/thinking-orb/engine/ribbon.d.ts +3 -0
- package/vendor/shared/dist/thinking-orb/engine/ribbon.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/ribbon.js +64 -0
- package/vendor/shared/dist/thinking-orb/engine/types.d.ts +6 -0
- package/vendor/shared/dist/thinking-orb/engine/types.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/engine/types.js +2 -0
- package/vendor/shared/dist/thinking-orb/index.d.ts +7 -0
- package/vendor/shared/dist/thinking-orb/index.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/index.js +2 -0
- package/vendor/shared/dist/thinking-orb/presets.d.ts +12 -0
- package/vendor/shared/dist/thinking-orb/presets.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/presets.js +67 -0
- package/vendor/shared/dist/thinking-orb/types.d.ts +24 -0
- package/vendor/shared/dist/thinking-orb/types.d.ts.map +1 -0
- package/vendor/shared/dist/thinking-orb/types.js +1 -0
- package/vendor/shared/dist/turnTiming.d.ts +13 -0
- package/vendor/shared/dist/turnTiming.d.ts.map +1 -0
- package/vendor/shared/dist/turnTiming.js +18 -0
- package/vendor/shared/dist/types.d.ts +4 -5
- package/vendor/shared/dist/types.d.ts.map +1 -1
- package/vendor/shared/dist/updateControl.d.ts +168 -0
- package/vendor/shared/dist/updateControl.d.ts.map +1 -0
- package/vendor/shared/dist/updateControl.js +43 -0
- package/vendor/shared/dist/videos.d.ts +31 -0
- package/vendor/shared/dist/videos.d.ts.map +1 -0
- package/vendor/shared/dist/videos.js +34 -0
- package/vendor/shared/dist/voiceCapture.d.ts +1 -1
- package/vendor/shared/dist/workspaceIO.d.ts +188 -0
- package/vendor/shared/dist/workspaceIO.d.ts.map +1 -0
- package/vendor/shared/dist/workspaceIO.js +50 -0
- package/vendor/shared/dist/workspaces.d.ts +857 -2
- package/vendor/shared/dist/workspaces.d.ts.map +1 -1
- package/vendor/shared/dist/workspaces.js +156 -1
- package/vendor/shared/package.json +12 -0
- package/vendor/shared/src/accountDevices.ts +28 -0
- package/vendor/shared/src/activityRecovery.ts +42 -0
- package/vendor/shared/src/agentMessages.ts +82 -0
- package/vendor/shared/src/aiUsage.ts +18 -0
- package/vendor/shared/src/artifacts.ts +48 -0
- package/vendor/shared/src/automationTemplates.ts +1 -0
- package/vendor/shared/src/automations.ts +22 -3
- package/vendor/shared/src/chatActivity.ts +56 -0
- package/vendor/shared/src/codingActivity.ts +40 -0
- package/vendor/shared/src/commandLocal.ts +1 -1
- package/vendor/shared/src/commands.ts +1 -1
- package/vendor/shared/src/commentMentions.ts +20 -0
- package/vendor/shared/src/computer.ts +43 -3
- package/vendor/shared/src/constants.ts +8 -10
- package/vendor/shared/src/daemonUpdates.ts +127 -0
- package/vendor/shared/src/deviceInteraction.ts +35 -0
- package/vendor/shared/src/doctor.ts +19 -0
- package/vendor/shared/src/fileUploads.ts +28 -0
- package/vendor/shared/src/files.ts +21 -0
- package/vendor/shared/src/index.ts +38 -7
- package/vendor/shared/src/lucidFollowups.ts +49 -0
- package/vendor/shared/src/lucidInvocations.ts +62 -0
- package/vendor/shared/src/memory.ts +30 -0
- package/vendor/shared/src/messagingSafety.ts +21 -0
- package/vendor/shared/src/recall.ts +69 -0
- package/vendor/shared/src/releaseCompatibility.ts +162 -0
- package/vendor/shared/src/repositoryRequests.ts +44 -0
- package/vendor/shared/src/repositoryRouting.ts +117 -0
- package/vendor/shared/src/roomClient.ts +351 -0
- package/vendor/shared/src/schemas/comment.ts +10 -0
- package/vendor/shared/src/schemas/conversation.ts +12 -1
- package/vendor/shared/src/schemas/harness.ts +138 -133
- package/vendor/shared/src/schemas/notification.ts +2 -1
- package/vendor/shared/src/schemas/organization.ts +2 -0
- package/vendor/shared/src/smartCapture.ts +28 -1
- package/vendor/shared/src/spokenNames.ts +1 -1
- package/vendor/shared/src/taskSharing.ts +13 -0
- package/vendor/shared/src/taskSync.ts +81 -0
- package/vendor/shared/src/thinking-orb/ATTRIBUTION.md +36 -0
- package/vendor/shared/src/thinking-orb/engine/core.ts +81 -0
- package/vendor/shared/src/thinking-orb/engine/ctx.ts +15 -0
- package/vendor/shared/src/thinking-orb/engine/lattice.ts +205 -0
- package/vendor/shared/src/thinking-orb/engine/morph.ts +130 -0
- package/vendor/shared/src/thinking-orb/engine/orbits.ts +80 -0
- package/vendor/shared/src/thinking-orb/engine/profiles.ts +119 -0
- package/vendor/shared/src/thinking-orb/engine/registry.ts +18 -0
- package/vendor/shared/src/thinking-orb/engine/ribbon.ts +71 -0
- package/vendor/shared/src/thinking-orb/engine/types.ts +15 -0
- package/vendor/shared/src/thinking-orb/index.ts +6 -0
- package/vendor/shared/src/thinking-orb/presets.ts +88 -0
- package/vendor/shared/src/thinking-orb/types.ts +25 -0
- package/vendor/shared/src/turnTiming.ts +20 -0
- package/vendor/shared/src/types.ts +1 -7
- package/vendor/shared/src/updateControl.ts +45 -0
- package/vendor/shared/src/videos.ts +37 -0
- package/vendor/shared/src/workspaceIO.ts +61 -0
- package/vendor/shared/src/workspaces.ts +173 -1
- package/dist/coding/conduct.d.ts +0 -48
- package/dist/coding/conduct.d.ts.map +0 -1
- package/dist/coding/conduct.js +0 -263
- package/dist/coding/fleetPlan.d.ts +0 -20
- package/dist/coding/fleetPlan.d.ts.map +0 -1
- package/dist/coding/fleetPlan.js +0 -125
- package/dist/coding/fleetTasks.d.ts +0 -33
- package/dist/coding/fleetTasks.d.ts.map +0 -1
- package/dist/coding/fleetTasks.js +0 -75
- package/src/coding/conduct.ts +0 -325
- package/src/coding/fleetPlan.ts +0 -135
- package/src/coding/fleetTasks.ts +0 -109
|
@@ -1,22 +1,271 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
1
|
+
import { existsSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
2
3
|
import { realpath } from 'node:fs/promises';
|
|
3
|
-
import { createHash } from 'node:crypto';
|
|
4
|
-
import { sessionProvider } from '@lucidity/shared';
|
|
4
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
5
|
+
import { CodeRequestSchema, RepoSettingsSchema, WorkspaceModelPreferencesSchema, sessionProvider } from '@lucidity/shared';
|
|
5
6
|
import { conversationKey } from '../runtimeStore.js';
|
|
6
7
|
import { LaneQueue } from '../queue.js';
|
|
7
8
|
import { resolveRepo } from './repos.js';
|
|
8
|
-
import { ensureWorkspace, sessionWorktreePath, workspaceBase, workspaceBranchExists } from './worktree.js';
|
|
9
|
-
|
|
9
|
+
import { archiveWorktree, archivedHead, deleteArchivedWorktree, ensureWorkspace, headSha, restoreArchivedFiles, sessionBranch, sessionWorktreePath, unmergedArchivedWork, workspaceBase, workspaceBranchExists } from './worktree.js';
|
|
10
|
+
import { copyIncludedFiles, matchedFiles, runSetupScript } from './worktreeSetup.js';
|
|
11
|
+
import { inspectRun, continuationRequest } from './runReview.js';
|
|
12
|
+
import { overviewMetadataRequestSchema } from './workspaceOverview.js';
|
|
13
|
+
import { overviewEntry, sourceKey, recallMessageId } from './overviewSources.js';
|
|
14
|
+
import { existingWorkspace } from '../editor/existingWorkspace.js';
|
|
15
|
+
import { isGreetingTitle, worktreeTitleSchema } from './workspaceTitle.js';
|
|
16
|
+
function imageMetadata(input) {
|
|
17
|
+
return input?.images?.length ? { imageCount: input.images.length,
|
|
18
|
+
...(input.images.some(image => image.name) ? { imageNames: input.images.map(image => image.name ?? null) } : {}),
|
|
19
|
+
...(input.imageOnly !== undefined ? { imageOnly: input.imageOnly } : {}) } : {};
|
|
20
|
+
}
|
|
21
|
+
/** "Worktree 3": the next number this repository has not used. */
|
|
22
|
+
export function nextWorkerTitle(titles) {
|
|
23
|
+
const used = titles.map((title) => (title.startsWith('Worktree ') ? Number(title.slice(9)) : 0));
|
|
24
|
+
return `Worktree ${Math.max(0, ...used.filter(Number.isInteger)) + 1}`;
|
|
25
|
+
}
|
|
26
|
+
// Two checkouts fighting over :3001 and :8081 is half of CLAUDE.md's gotchas. Every worktree
|
|
27
|
+
// gets ten ports of its own, kept for its lifetime, well away from those defaults and from the
|
|
28
|
+
// owner's phone Metro on 8090.
|
|
29
|
+
const PORT_BASE = 4100;
|
|
30
|
+
const PORT_BLOCK = 10;
|
|
31
|
+
/** The lowest block of ports no other worktree on this computer holds. */
|
|
32
|
+
export function nextPortBlock(taken) {
|
|
33
|
+
const used = new Set(taken);
|
|
34
|
+
let port = PORT_BASE;
|
|
35
|
+
while (used.has(port))
|
|
36
|
+
port += PORT_BLOCK;
|
|
37
|
+
return port;
|
|
38
|
+
}
|
|
10
39
|
/** Workspace lifetime is independent of runs, provider sessions, PRs, and phone storage. */
|
|
11
40
|
export class WorkspaceRegistry {
|
|
12
41
|
store;
|
|
13
42
|
repos;
|
|
14
43
|
baseDir;
|
|
44
|
+
overviews;
|
|
15
45
|
lanes = new LaneQueue();
|
|
16
|
-
|
|
46
|
+
setups = new Map();
|
|
47
|
+
listeners = new Set();
|
|
48
|
+
processing = false;
|
|
49
|
+
archiving = new Set();
|
|
50
|
+
editorGuards = new Set();
|
|
51
|
+
constructor(store, repos, baseDir, overviews) {
|
|
17
52
|
this.store = store;
|
|
18
53
|
this.repos = repos;
|
|
19
54
|
this.baseDir = baseDir;
|
|
55
|
+
this.overviews = overviews;
|
|
56
|
+
// Preserve existing numbered labels first; custom titles receive a stable unused number.
|
|
57
|
+
const workers = this.store.list('workers');
|
|
58
|
+
for (const worker of workers) {
|
|
59
|
+
if (!worker.shortName && /^Worktree [1-9]\d*$/.test(worker.title)) {
|
|
60
|
+
worker.shortName = worker.title;
|
|
61
|
+
this.store.set('workers', worker.workerId, worker);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (const worker of workers.sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.workerId.localeCompare(b.workerId))) {
|
|
65
|
+
if (!worker.shortName) {
|
|
66
|
+
worker.shortName = nextWorkerTitle(workers.filter(other => other.repoId === worker.repoId).map(other => other.shortName ?? other.title));
|
|
67
|
+
this.store.set('workers', worker.workerId, worker);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// An archive hook may have run before the crash. Never replay an uncertain mutation.
|
|
71
|
+
for (const operation of this.store.list('worktree-operations')) {
|
|
72
|
+
if (operation.state === 'running')
|
|
73
|
+
this.saveOperation({ ...operation, state: 'failed',
|
|
74
|
+
message: 'The computer restarted during this operation. Inspect the worktree before retrying.' });
|
|
75
|
+
}
|
|
76
|
+
for (const creation of this.store.list('agent-worktree-creations')) {
|
|
77
|
+
if (creation.state === 'creating')
|
|
78
|
+
this.store.set('agent-worktree-creations', creation.workerId, { ...creation, state: 'failed', message: 'The computer restarted during creation. Inspect the worktree before retrying setup.' });
|
|
79
|
+
}
|
|
80
|
+
for (const worker of workers)
|
|
81
|
+
this.nameWorktree(worker.workerId);
|
|
82
|
+
for (const id of this.overviews?.pendingRequests() ?? []) {
|
|
83
|
+
const request = this.store.command(id);
|
|
84
|
+
if (request?.kind === 'code' && this.store.status(id).terminated)
|
|
85
|
+
this.refreshOverview(request);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
subscribe(listener) {
|
|
89
|
+
this.listeners.add(listener);
|
|
90
|
+
return () => { this.listeners.delete(listener); };
|
|
91
|
+
}
|
|
92
|
+
changed() {
|
|
93
|
+
this.store.set('workspace-revision', 'current', this.revision() + 1);
|
|
94
|
+
for (const listener of this.listeners) {
|
|
95
|
+
try {
|
|
96
|
+
listener();
|
|
97
|
+
}
|
|
98
|
+
catch { /* Reconnect repairs a missed push. */ }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
revision() { return this.store.get('workspace-revision', 'current') ?? 0; }
|
|
102
|
+
snapshot(repoId) {
|
|
103
|
+
const repoIds = this.repos().map(r => r.id).filter(id => !repoId || id === repoId);
|
|
104
|
+
return { workers: this.list(repoId), scope: { repoIds, revision: this.revision() },
|
|
105
|
+
openedCheckouts: repoIds.filter(id => {
|
|
106
|
+
const conversation = conversationKey({ kind: 'code', repoId: id, mode: 'in-place' });
|
|
107
|
+
return this.store.get('opened-checkouts', conversation) || this.store.get('checkout-conversations', conversation) ||
|
|
108
|
+
this.store.lastCommand(conversation);
|
|
109
|
+
}),
|
|
110
|
+
operations: this.store.list('worktree-operations')
|
|
111
|
+
.filter(op => repoIds.includes(op.repoId)).filter((op, index, all) => op.state === 'waiting' || op.state === 'running' || index >= all.length - 100).map(({ force: _, ...op }) => op) };
|
|
112
|
+
}
|
|
113
|
+
/** Local tools can match the exact checkout without guessing IDs from branch names. */
|
|
114
|
+
locations() {
|
|
115
|
+
return this.store.list('workers').filter(w => this.repos().some(r => r.id === w.repoId))
|
|
116
|
+
.map(w => ({ workerId: w.workerId, repoId: w.repoId, path: w.path }));
|
|
117
|
+
}
|
|
118
|
+
/** Ready worktrees can receive their first turn; discovery itself never starts one. */
|
|
119
|
+
agentConversations() {
|
|
120
|
+
return this.repos().flatMap(repo => {
|
|
121
|
+
if (!resolveRepo(repo.id, this.repos()))
|
|
122
|
+
return [];
|
|
123
|
+
const scopes = [{ repoId: repo.id, workerId: undefined, title: 'Main checkout' },
|
|
124
|
+
...this.list(repo.id).filter(w => w.state === 'ready').map(w => ({ repoId: repo.id, workerId: w.workerId, title: w.title }))];
|
|
125
|
+
return scopes.flatMap(scope => {
|
|
126
|
+
try {
|
|
127
|
+
const workspace = this.editorWorkspace({ ...scope, checkout: !scope.workerId });
|
|
128
|
+
const mode = scope.workerId ? 'worktree' : 'in-place';
|
|
129
|
+
const conversationId = conversationKey({ ...scope, kind: 'code', mode });
|
|
130
|
+
const checkout = scope.workerId ? undefined : this.store.get('checkout-conversations', conversationId);
|
|
131
|
+
const resume = this.resume({ ...scope, mode, id: '', prompt: '' });
|
|
132
|
+
const lastRequestId = this.store.lastCommand(conversationId);
|
|
133
|
+
const started = Boolean(resume || (scope.workerId && lastRequestId) || this.store.unfinished(conversationId));
|
|
134
|
+
if (!started && !scope.workerId)
|
|
135
|
+
return [];
|
|
136
|
+
return [{ ...scope, mode, conversationId, revision: checkout?.revision ?? '0',
|
|
137
|
+
started,
|
|
138
|
+
path: workspace.path, provider: resume ? sessionProvider(resume) : undefined,
|
|
139
|
+
status: workspace.status, lastRequestId }];
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/** Read only the registered checkout; an editor request never creates one. */
|
|
148
|
+
editorWorkspace(scope, allowPending = false) {
|
|
149
|
+
const repo = this.repo(scope.repoId);
|
|
150
|
+
const worker = scope.workerId ? this.store.get('workers', scope.workerId) : undefined;
|
|
151
|
+
if (scope.workerId && (!worker || worker.repoId !== repo.id || worker.state !== 'ready' || !worker.path ||
|
|
152
|
+
worker.setup || this.setups.has(worker.workerId) || (!allowPending && this.pending(worker.workerId)) || this.archiving.has(worker.workerId)))
|
|
153
|
+
throw new Error('This worktree is not ready for editing. Restore it or finish its setup first.');
|
|
154
|
+
if (!scope.workerId && !scope.checkout)
|
|
155
|
+
throw new Error('Select Main checkout or a registered worktree.');
|
|
156
|
+
const conversation = conversationKey({ kind: 'code', repoId: scope.repoId, workerId: scope.workerId, mode: scope.checkout ? 'in-place' : 'worktree' });
|
|
157
|
+
return { path: realpathSync(worker?.path ?? repo.root), branch: worker?.branch ?? '',
|
|
158
|
+
revision: worker ? '0' : this.store.get('checkout-conversations', conversation)?.revision ?? '0',
|
|
159
|
+
status: this.store.unfinished(conversation) ? 'running' : 'idle' };
|
|
160
|
+
}
|
|
161
|
+
/** File/Git mutations cannot race worktree archive, restore, or deletion. */
|
|
162
|
+
withEditorWorkspace(scope, action, allowPending = false) {
|
|
163
|
+
const repo = this.repo(scope.repoId);
|
|
164
|
+
return this.lanes.run(repo.root, async () => { this.editorWorkspace(scope, allowPending); return action(); });
|
|
165
|
+
}
|
|
166
|
+
guardEditorLifetime(guard) {
|
|
167
|
+
this.editorGuards.add(guard);
|
|
168
|
+
return () => { this.editorGuards.delete(guard); };
|
|
169
|
+
}
|
|
170
|
+
editorActive(worker) { return [...this.editorGuards].some((guard) => guard(worker.repoId, worker.workerId)); }
|
|
171
|
+
saveOperation(operation) {
|
|
172
|
+
this.store.set('worktree-operations', operation.id, { ...operation, updatedAt: new Date().toISOString() });
|
|
173
|
+
this.changed();
|
|
174
|
+
}
|
|
175
|
+
pending(workerId) {
|
|
176
|
+
return this.store.list('worktree-operations').find(op => op.workerId === workerId &&
|
|
177
|
+
(op.state === 'waiting' || op.state === 'running'));
|
|
178
|
+
}
|
|
179
|
+
creations() {
|
|
180
|
+
return this.store.list('agent-worktree-creations').filter(c => this.repos().some(r => r.id === c.repoId));
|
|
181
|
+
}
|
|
182
|
+
requestCreation(request, run = work => work()) {
|
|
183
|
+
this.repo(request.repoId);
|
|
184
|
+
const previous = this.store.get('agent-worktree-creations', request.workerId);
|
|
185
|
+
if (previous) {
|
|
186
|
+
if (previous.repoId !== request.repoId || previous.title !== request.title)
|
|
187
|
+
throw new Error('This creation ID already belongs to another request. Retry with the original input.');
|
|
188
|
+
return previous;
|
|
189
|
+
}
|
|
190
|
+
if (this.store.get('workers', request.workerId) || this.store.get('deleted-workers', request.workerId))
|
|
191
|
+
throw new Error('This worktree ID is already in use. Select a new creation ID.');
|
|
192
|
+
const receipt = { ...request, state: 'creating' };
|
|
193
|
+
this.store.set('agent-worktree-creations', request.workerId, receipt);
|
|
194
|
+
void run(async () => {
|
|
195
|
+
const worker = await this.create(request.repoId, request.workerId, request.title);
|
|
196
|
+
this.store.set('agent-worktree-creations', request.workerId, { ...receipt, state: 'ready' });
|
|
197
|
+
this.changed();
|
|
198
|
+
return worker;
|
|
199
|
+
}).catch(error => {
|
|
200
|
+
this.store.set('agent-worktree-creations', request.workerId, { ...receipt, state: 'failed', message: String(error.message ?? error) });
|
|
201
|
+
this.changed();
|
|
202
|
+
});
|
|
203
|
+
return receipt;
|
|
204
|
+
}
|
|
205
|
+
requestLifecycle(request) {
|
|
206
|
+
this.repo(request.repoId);
|
|
207
|
+
const previous = this.store.get('worktree-operations', request.id);
|
|
208
|
+
if (previous) {
|
|
209
|
+
if (previous.repoId !== request.repoId || previous.workerId !== request.workerId ||
|
|
210
|
+
previous.action !== request.action || !!previous.force !== !!request.force)
|
|
211
|
+
throw new Error('This operation ID already belongs to a different request.');
|
|
212
|
+
return previous;
|
|
213
|
+
}
|
|
214
|
+
const worker = this.store.get('workers', request.workerId);
|
|
215
|
+
if (!worker || worker.repoId !== request.repoId)
|
|
216
|
+
throw new Error('This worktree is not registered in this repository.');
|
|
217
|
+
if (request.force && (request.action !== 'delete' || worker.state !== 'archived'))
|
|
218
|
+
throw new Error('Archive and inspect saved work before confirming its permanent deletion.');
|
|
219
|
+
if (worker.sessionCheckout)
|
|
220
|
+
throw new Error('The shared session checkout cannot be removed through an agent tool.');
|
|
221
|
+
const pending = this.pending(worker.workerId);
|
|
222
|
+
if (pending) {
|
|
223
|
+
if (pending.action !== request.action || !!pending.force !== !!request.force)
|
|
224
|
+
throw new Error('A different operation is already waiting for this worktree.');
|
|
225
|
+
return pending;
|
|
226
|
+
}
|
|
227
|
+
const operation = { ...request, title: worker.title, state: 'waiting',
|
|
228
|
+
message: 'Waiting for active work, queued messages and setup to finish.', updatedAt: new Date().toISOString() };
|
|
229
|
+
this.saveOperation(operation);
|
|
230
|
+
return operation;
|
|
231
|
+
}
|
|
232
|
+
/** Called by the daemon, independently of the agent's HTTP request or the phone connection. */
|
|
233
|
+
async processLifecycle() {
|
|
234
|
+
if (this.processing)
|
|
235
|
+
return;
|
|
236
|
+
this.processing = true;
|
|
237
|
+
try {
|
|
238
|
+
for (const operation of this.store.list('worktree-operations')) {
|
|
239
|
+
if (operation.state !== 'waiting')
|
|
240
|
+
continue;
|
|
241
|
+
const worker = this.store.get('workers', operation.workerId);
|
|
242
|
+
if (worker && (this.archiving.has(worker.workerId) || worker.state === 'creating' || this.setups.has(worker.workerId) || this.store.unfinished(worker.conversationId) || this.editorActive(worker)))
|
|
243
|
+
continue;
|
|
244
|
+
this.saveOperation({ ...operation, state: 'running',
|
|
245
|
+
message: operation.action === 'delete' ? 'Deleting worktree…' : 'Archiving worktree…' });
|
|
246
|
+
try {
|
|
247
|
+
if (worker && worker.state !== 'archived')
|
|
248
|
+
await this.archive(worker);
|
|
249
|
+
if (operation.action === 'delete') {
|
|
250
|
+
const unmerged = await this.delete(operation.repoId, operation.workerId, operation.force);
|
|
251
|
+
if (unmerged) {
|
|
252
|
+
this.saveOperation({ ...operation, state: 'blocked', message: `Worktree archived, but not deleted: ${unmerged.commits} unmerged commits${unmerged.uncommitted ? ' and uncommitted files' : ''}. Review its saved work before confirming deletion.` });
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else if (!worker)
|
|
257
|
+
throw new Error('This worktree no longer exists.');
|
|
258
|
+
this.saveOperation({ ...operation, state: 'done',
|
|
259
|
+
message: operation.action === 'delete' ? 'Worktree deleted' : 'Worktree archived' });
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
this.saveOperation({ ...operation, state: 'failed', message: error instanceof Error ? error.message : String(error) });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
this.processing = false;
|
|
268
|
+
}
|
|
20
269
|
}
|
|
21
270
|
repo(id) {
|
|
22
271
|
const repo = resolveRepo(id, this.repos());
|
|
@@ -25,16 +274,446 @@ export class WorkspaceRegistry {
|
|
|
25
274
|
return repo;
|
|
26
275
|
}
|
|
27
276
|
public(worker) {
|
|
28
|
-
const { path: _, legacyMessages: __, sessionCheckout: ___, legacy: ____, ...row } = worker;
|
|
29
|
-
return { ...row, resume: this.store.latestSession(worker.conversationId) ?? row.resume
|
|
277
|
+
const { path: _, legacyMessages: __, sessionCheckout: ___, legacy: ____, setupDeferred: _____, titleSuggestion: _suggestion, pendingTitleSuggestion: _pendingSuggestion, externalDesktop: _external, importContext: _context, titleSource: _titleSource, titleRequestId: _titleRequestId, titleDeferredThrough: _titleDeferredThrough, titleRevision: _titleRevision, ...row } = worker;
|
|
278
|
+
return { ...row, resume: this.store.latestSession(worker.conversationId) ?? row.resume,
|
|
279
|
+
overview: this.overviews?.peek(worker.conversationId),
|
|
280
|
+
...(this.setups.has(worker.workerId) ? { setup: 'running' } : {}) };
|
|
30
281
|
}
|
|
31
282
|
list(repoId) {
|
|
32
283
|
return this.store.list('workers')
|
|
33
284
|
.filter((w) => (!repoId || w.repoId === repoId) && this.repos().some((r) => r.id === w.repoId))
|
|
34
285
|
.map((w) => this.public(w));
|
|
35
286
|
}
|
|
287
|
+
overviewHistory(command) {
|
|
288
|
+
if (!command.repoId)
|
|
289
|
+
throw new Error('Select a repository.');
|
|
290
|
+
this.repo(command.repoId);
|
|
291
|
+
const worker = command.workerId ? this.store.get('workers', command.workerId) : undefined;
|
|
292
|
+
if (command.workerId && (!worker || worker.repoId !== command.repoId))
|
|
293
|
+
throw new Error('This worktree is not registered in this repository.');
|
|
294
|
+
const conversationId = worker?.conversationId ?? conversationKey({ kind: 'code', repoId: command.repoId, mode: 'in-place' });
|
|
295
|
+
const checkout = worker ? undefined : this.store.get('checkout-conversations', conversationId);
|
|
296
|
+
const key = worker ? conversationId : `${conversationId}:${checkout?.revision ?? '0'}`;
|
|
297
|
+
const legacy = worker?.legacyMessages ?? checkout?.legacyMessages ?? [];
|
|
298
|
+
const entries = legacy.filter(m => m.role !== 'notice' && m.text.trim()).map(m => overviewEntry({ conversationId: key, kind: 'legacy', messageId: m.id }, m.role === 'user' ? 'user' : 'assistant', m.text));
|
|
299
|
+
for (const run of this.store.completedText(conversationId, checkout?.clearedThrough)) {
|
|
300
|
+
if (run.queueAction === 'cancel')
|
|
301
|
+
continue;
|
|
302
|
+
const identity = { conversationId: key, requestId: run.id };
|
|
303
|
+
const savedAt = new Date(run.completedAt).toISOString();
|
|
304
|
+
entries.push({ ...overviewEntry({ ...identity, kind: 'prompt', messageId: run.id }, run.senderKind === 'agent' ? 'assistant' : 'user', run.prompt), savedAt });
|
|
305
|
+
const corrections = this.store.get('overview-steering', run.id) ?? {};
|
|
306
|
+
const times = this.store.get('overview-steering-times', run.id) ?? {};
|
|
307
|
+
for (const [id, text] of Object.entries(corrections))
|
|
308
|
+
entries.push({ ...overviewEntry({ ...identity,
|
|
309
|
+
kind: 'steering', messageId: id, ...(times[id] ? { recordedAt: times[id] } : {}) }, 'user', text), savedAt });
|
|
310
|
+
if (run.text.trim())
|
|
311
|
+
entries.push({ ...overviewEntry({ ...identity, kind: 'reply', messageId: run.id,
|
|
312
|
+
recordedAt: savedAt }, 'assistant', run.text, run.outcome), savedAt });
|
|
313
|
+
}
|
|
314
|
+
return { key, entries };
|
|
315
|
+
}
|
|
316
|
+
/** Current accessible history, including archived workers. Cleared/deleted scopes never enter recall. */
|
|
317
|
+
recallDocuments() {
|
|
318
|
+
const documents = [];
|
|
319
|
+
for (const repo of this.repos()) {
|
|
320
|
+
if (!resolveRepo(repo.id, this.repos()))
|
|
321
|
+
continue;
|
|
322
|
+
const scopes = [{ repoId: repo.id, workerId: undefined, title: 'Main' },
|
|
323
|
+
...this.list(repo.id).map(w => ({ repoId: repo.id, workerId: w.workerId, title: w.title }))];
|
|
324
|
+
for (const scope of scopes) {
|
|
325
|
+
const { key, entries } = this.overviewHistory(scope);
|
|
326
|
+
const title = `${repo.id} / ${scope.title}`;
|
|
327
|
+
const location = { repoId: repo.id, workerId: scope.workerId };
|
|
328
|
+
const sourceKeys = new Set(entries.map(e => sourceKey(e.source)));
|
|
329
|
+
for (const entry of entries) {
|
|
330
|
+
const source = entry.source;
|
|
331
|
+
const id = recallMessageId(source);
|
|
332
|
+
documents.push({ id, revision: source.revision, kind: 'message', authority: 'original',
|
|
333
|
+
title: `${title} / ${entry.role}`, text: entry.text, repoId: repo.id, conversationId: key,
|
|
334
|
+
speaker: entry.role, savedAt: entry.savedAt, recordedAt: source.recordedAt, location: { ...location, source } });
|
|
335
|
+
}
|
|
336
|
+
for (const topic of this.overviews?.peek(key)?.topics ?? []) {
|
|
337
|
+
// Stale derived summaries are never indexed after their evidence changes or disappears.
|
|
338
|
+
const supportingSources = [...(topic.sources ?? []), ...(topic.decisionSources ?? []).flat(), ...(topic.decisionCompletionSources ?? []).flat()];
|
|
339
|
+
if (!topic.id || !topic.sources?.length || supportingSources
|
|
340
|
+
.some(s => !sourceKeys.has(sourceKey(s))))
|
|
341
|
+
continue;
|
|
342
|
+
const text = [topic.summary, ...topic.decisions].join('\n');
|
|
343
|
+
documents.push({ id: `topic:${key}:${topic.id}`, revision: createHash('sha256').update(JSON.stringify(topic)).digest('hex'),
|
|
344
|
+
kind: 'topic', authority: 'derived', title: `${title} / ${topic.title}`, text,
|
|
345
|
+
repoId: repo.id, conversationId: key, recordedAt: topic.lastRecordedAt,
|
|
346
|
+
location, sources: topic.sources,
|
|
347
|
+
sourceIds: [...new Map(supportingSources.map(s => [recallMessageId(s), { id: recallMessageId(s), revision: s.revision }])).values()] });
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
// A memory may be saved before its turn finishes. Keep only the turn identity;
|
|
352
|
+
// derive text from the original command so clearing/deletion still revokes it.
|
|
353
|
+
const indexed = new Set(documents.map(doc => doc.id));
|
|
354
|
+
for (const { requestId } of this.store.list('memory-source-turns')) {
|
|
355
|
+
for (const doc of this.turnMemoryDocuments(requestId)) {
|
|
356
|
+
if (!indexed.has(doc.id)) {
|
|
357
|
+
documents.push(doc);
|
|
358
|
+
indexed.add(doc.id);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return documents;
|
|
363
|
+
}
|
|
364
|
+
turnMemoryDocuments(requestId) {
|
|
365
|
+
const request = this.store.command(requestId);
|
|
366
|
+
if (request?.kind !== 'code' || (!request.workerId && request.mode !== 'in-place') ||
|
|
367
|
+
!resolveRepo(request.repoId, this.repos()))
|
|
368
|
+
return [];
|
|
369
|
+
const worker = request.workerId ? this.store.get('workers', request.workerId) : undefined;
|
|
370
|
+
if (request.workerId && (!worker || worker.repoId !== request.repoId))
|
|
371
|
+
return [];
|
|
372
|
+
const conversation = worker?.conversationId ?? conversationKey(request);
|
|
373
|
+
const checkout = worker ? undefined : this.store.get('checkout-conversations', conversation);
|
|
374
|
+
if (checkout?.clearedThrough && request.id <= checkout.clearedThrough)
|
|
375
|
+
return [];
|
|
376
|
+
const key = worker ? conversation : `${conversation}:${checkout?.revision ?? '0'}`;
|
|
377
|
+
const entries = request.senderKind === 'agent' ? [] : [overviewEntry({ conversationId: key,
|
|
378
|
+
requestId, messageId: requestId, kind: 'prompt' }, 'user', request.prompt)];
|
|
379
|
+
const times = this.store.get('overview-steering-times', requestId) ?? {};
|
|
380
|
+
for (const [id, text] of Object.entries(this.store.get('overview-steering', requestId) ?? {}))
|
|
381
|
+
entries.push(overviewEntry({ conversationId: key, requestId, messageId: id, kind: 'steering',
|
|
382
|
+
...(times[id] ? { recordedAt: times[id] } : {}) }, 'user', text));
|
|
383
|
+
return entries.map(entry => ({ id: recallMessageId(entry.source), revision: entry.source.revision,
|
|
384
|
+
kind: 'message', authority: 'original', speaker: 'user', text: entry.text,
|
|
385
|
+
title: `${request.repoId} / ${worker?.title ?? 'Main'} / user`, repoId: request.repoId,
|
|
386
|
+
conversationId: key, recordedAt: entry.source.recordedAt,
|
|
387
|
+
location: { repoId: request.repoId, workerId: request.workerId, source: entry.source } }));
|
|
388
|
+
}
|
|
389
|
+
/** Called only with the current turn binding supplied by the scoped MCP transport. */
|
|
390
|
+
memoryTurnSources(requestId) {
|
|
391
|
+
const request = this.store.command(requestId);
|
|
392
|
+
if (!request || this.store.status(requestId).terminated)
|
|
393
|
+
return [];
|
|
394
|
+
const documents = this.turnMemoryDocuments(requestId);
|
|
395
|
+
if (documents.length)
|
|
396
|
+
this.store.set('memory-source-turns', requestId, { requestId });
|
|
397
|
+
return documents;
|
|
398
|
+
}
|
|
399
|
+
recallScope() { return JSON.stringify(this.repos().map(r => [r.id, r.path, !!resolveRepo(r.id, this.repos())]).sort()); }
|
|
400
|
+
overview(command) {
|
|
401
|
+
const { key, entries } = this.overviewHistory(command);
|
|
402
|
+
return { workers: [], overviewState: this.overviews?.read(key, entries) ?? { status: 'error' } };
|
|
403
|
+
}
|
|
404
|
+
overviewSource(command) {
|
|
405
|
+
const missing = { workers: [], sourceResult: { status: 'unavailable',
|
|
406
|
+
message: 'This original message is no longer available in this conversation.' } };
|
|
407
|
+
if (!command.source)
|
|
408
|
+
return missing;
|
|
409
|
+
// Resolve through the current repository/worktree and Main clear boundary, never by a global run ID.
|
|
410
|
+
const { key, entries } = this.overviewHistory(command);
|
|
411
|
+
if (command.source.conversationId !== key)
|
|
412
|
+
return missing;
|
|
413
|
+
const found = entries.find(e => e.source.kind === command.source.kind &&
|
|
414
|
+
e.source.messageId === command.source.messageId && e.source.requestId === command.source.requestId);
|
|
415
|
+
if (!found)
|
|
416
|
+
return missing;
|
|
417
|
+
if (sourceKey(found.source) !== sourceKey(command.source))
|
|
418
|
+
return { workers: [], sourceResult: {
|
|
419
|
+
status: 'changed', message: 'This message changed after the summary was written. Refresh the overview to read its current source.'
|
|
420
|
+
} };
|
|
421
|
+
return { workers: [], sourceResult: { status: 'available', ...found } };
|
|
422
|
+
}
|
|
423
|
+
replyHistory(command, messageId) {
|
|
424
|
+
const history = this.overviewHistory(command);
|
|
425
|
+
if (!messageId)
|
|
426
|
+
return history;
|
|
427
|
+
// Match the displayed assistant text, including partial output before steering or interruption.
|
|
428
|
+
for (const entry of [...history.entries]) {
|
|
429
|
+
if (entry.source.kind !== 'prompt' || !entry.source.requestId ||
|
|
430
|
+
(messageId !== entry.source.requestId && !messageId.startsWith(`${entry.source.requestId}:`)))
|
|
431
|
+
continue;
|
|
432
|
+
const request = this.store.command(entry.source.requestId);
|
|
433
|
+
if (!request)
|
|
434
|
+
continue;
|
|
435
|
+
const state = this.store.read(request.id);
|
|
436
|
+
const run = this.historyRuns([{ request, state }])[0];
|
|
437
|
+
const fallback = Number(run.frames.slice().reverse().find(f => !['done', 'error', 'cancelled'].includes(String(f.type)))?.seq ?? 0);
|
|
438
|
+
const steering = [...(run.steering ?? [])].sort((a, b) => (a.afterSeq ?? fallback) - (b.afterSeq ?? fallback));
|
|
439
|
+
let index = 0, text = '';
|
|
440
|
+
const split = (seq) => {
|
|
441
|
+
while (index < steering.length && (steering[index].afterSeq ?? fallback) < seq) {
|
|
442
|
+
const instruction = steering[index++];
|
|
443
|
+
if (text)
|
|
444
|
+
history.entries.push(overviewEntry({ conversationId: history.key, requestId: request.id,
|
|
445
|
+
kind: 'reply', messageId: `${request.id}:before:${instruction.id}` }, 'assistant', text));
|
|
446
|
+
text = '';
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
for (const frame of run.frames) {
|
|
450
|
+
split(Number(frame.seq));
|
|
451
|
+
if (frame.type === 'delta' && typeof frame.text === 'string')
|
|
452
|
+
text += frame.text;
|
|
453
|
+
if (frame.type === 'done' && typeof frame.text === 'string')
|
|
454
|
+
text = frame.text;
|
|
455
|
+
}
|
|
456
|
+
split(Infinity);
|
|
457
|
+
const previous = history.entries.find(e => e.source.kind === 'reply' && e.source.messageId === request.id);
|
|
458
|
+
history.entries = history.entries.filter(e => e !== previous);
|
|
459
|
+
if (text.trim())
|
|
460
|
+
history.entries.push(overviewEntry({ conversationId: history.key, requestId: request.id,
|
|
461
|
+
kind: 'reply', messageId: request.id, ...(previous?.source.recordedAt ? { recordedAt: previous.source.recordedAt } : {}) }, 'assistant', text, previous?.outcome));
|
|
462
|
+
}
|
|
463
|
+
return history;
|
|
464
|
+
}
|
|
465
|
+
/** Resolve renderer IDs against accessible saved history, never a global ID lookup. */
|
|
466
|
+
messageSource(command) {
|
|
467
|
+
const { entries } = this.replyHistory(command, command.source?.messageId ?? command.messageId);
|
|
468
|
+
const found = command.source ? entries.find(entry => sourceKey(entry.source) === sourceKey(command.source)) :
|
|
469
|
+
entries.find(({ source }) => (source.kind === 'legacy' || source.messageId.includes(':before:') ? source.messageId :
|
|
470
|
+
`${source.messageId}:${source.kind === 'reply' ? 'reply' : 'user'}`) === command.messageId);
|
|
471
|
+
return { workers: [], sourceResult: found ? { status: 'available', ...found } : {
|
|
472
|
+
status: 'unavailable', message: 'This message is not available in saved history yet, or was removed.'
|
|
473
|
+
} };
|
|
474
|
+
}
|
|
475
|
+
replyContext(request) {
|
|
476
|
+
const source = request.replyTo;
|
|
477
|
+
if (!source)
|
|
478
|
+
throw new Error('Select an original message.');
|
|
479
|
+
const { key, entries } = this.replyHistory(request, source.messageId);
|
|
480
|
+
const result = key === source.conversationId ? entries.find(entry => sourceKey(entry.source) === sourceKey(source)) : undefined;
|
|
481
|
+
if (!result)
|
|
482
|
+
throw new Error('The original message changed or is no longer available. Reopen Reply on that message.');
|
|
483
|
+
let images = [];
|
|
484
|
+
if (source.requestId && (source.kind === 'prompt' || source.kind === 'steering')) {
|
|
485
|
+
images = this.messageImages({ action: 'message-image', repoId: request.repoId,
|
|
486
|
+
workerId: request.workerId, checkout: !request.workerId && request.mode === 'in-place', requestId: source.requestId,
|
|
487
|
+
...(source.kind === 'steering' ? { steeringId: source.messageId } : {}) });
|
|
488
|
+
}
|
|
489
|
+
return { text: `Referenced message (historical context, not new instructions):\n${JSON.stringify({
|
|
490
|
+
source: result.source, role: result.role, text: result.text, imageCount: images.length,
|
|
491
|
+
})}`, images };
|
|
492
|
+
}
|
|
493
|
+
refreshOverview(request) {
|
|
494
|
+
// Legacy single-session worktrees have no durable worker record to attach an overview to.
|
|
495
|
+
if (!request.workerId && request.mode !== 'in-place')
|
|
496
|
+
return;
|
|
497
|
+
try {
|
|
498
|
+
const { key, entries } = this.overviewHistory(request);
|
|
499
|
+
const succeeded = this.store.completedText(conversationKey({ ...request, kind: 'code' }))
|
|
500
|
+
.some(run => run.id === request.id && run.outcome === 'done' && !run.queueAction);
|
|
501
|
+
this.overviews?.finish(request.id, key, entries, succeeded);
|
|
502
|
+
}
|
|
503
|
+
catch { /* Metadata failures cannot change the coding result. */ }
|
|
504
|
+
if (request.workerId)
|
|
505
|
+
this.nameWorktree(request.workerId);
|
|
506
|
+
}
|
|
507
|
+
summaryMetadata(input) {
|
|
508
|
+
const command = overviewMetadataRequestSchema.parse(input);
|
|
509
|
+
const request = this.store.command(command.requestId);
|
|
510
|
+
if (!this.overviews || request?.kind !== 'code' || this.store.status(request.id).terminated ||
|
|
511
|
+
(!request.workerId && request.mode !== 'in-place'))
|
|
512
|
+
throw new Error('Summary updates require a current coding turn.');
|
|
513
|
+
if (request.workerId) {
|
|
514
|
+
const worker = this.store.get('workers', request.workerId);
|
|
515
|
+
if (!worker || worker.state !== 'ready' || worker.repoId !== request.repoId ||
|
|
516
|
+
this.pending(request.workerId) || this.archiving.has(request.workerId))
|
|
517
|
+
throw new Error('This worktree is unavailable.');
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
const checkout = this.store.get('checkout-conversations', conversationKey(request));
|
|
521
|
+
if (checkout?.clearedThrough && request.id <= checkout.clearedThrough)
|
|
522
|
+
throw new Error('This conversation was cleared.');
|
|
523
|
+
}
|
|
524
|
+
const { key, entries } = this.overviewHistory(request);
|
|
525
|
+
entries.push(overviewEntry({ conversationId: key, requestId: request.id, kind: 'prompt', messageId: request.id }, request.senderKind === 'agent' ? 'assistant' : 'user', request.prompt));
|
|
526
|
+
const corrections = this.store.get('overview-steering', request.id) ?? {};
|
|
527
|
+
const times = this.store.get('overview-steering-times', request.id) ?? {};
|
|
528
|
+
for (const [id, text] of Object.entries(corrections))
|
|
529
|
+
entries.push(overviewEntry({ conversationId: key,
|
|
530
|
+
requestId: request.id, kind: 'steering', messageId: id, ...(times[id] ? { recordedAt: times[id] } : {}) }, 'user', text));
|
|
531
|
+
return command.action === 'summary-context'
|
|
532
|
+
? this.overviews.context(key, entries, command.offset)
|
|
533
|
+
: this.overviews.suggest(request.id, key, entries, command.revision, command.update);
|
|
534
|
+
}
|
|
535
|
+
suggestTitle(requestId, title) {
|
|
536
|
+
title = worktreeTitleSchema.parse(title);
|
|
537
|
+
const request = this.store.command(requestId);
|
|
538
|
+
const worker = request?.kind === 'code' && request.workerId
|
|
539
|
+
? this.store.get('workers', request.workerId) : undefined;
|
|
540
|
+
if (!worker || request?.kind !== 'code' || request.repoId !== worker.repoId ||
|
|
541
|
+
worker.state !== 'ready' || this.pending(worker.workerId) || this.archiving.has(worker.workerId) ||
|
|
542
|
+
this.store.status(requestId).terminated || this.store.get('memory-hidden-conversations', worker.conversationId))
|
|
543
|
+
throw new Error('Title suggestions require the current worktree turn.');
|
|
544
|
+
this.repo(worker.repoId);
|
|
545
|
+
// Persist privately. Only a successfully completed turn can publish its suggestion.
|
|
546
|
+
this.store.set('workers', worker.workerId, { ...worker,
|
|
547
|
+
pendingTitleSuggestion: { title, requestId, revision: worker.titleRevision } });
|
|
548
|
+
return { saved: true };
|
|
549
|
+
}
|
|
550
|
+
nameWorktree(workerId) {
|
|
551
|
+
let worker = this.store.get('workers', workerId);
|
|
552
|
+
if (!worker || worker.state !== 'ready' || this.pending(workerId) || this.archiving.has(workerId) ||
|
|
553
|
+
this.store.get('memory-hidden-conversations', worker.conversationId))
|
|
554
|
+
return;
|
|
555
|
+
const exchanges = this.store.completedText(worker.conversationId).filter(run => run.outcome === 'done' && !run.queueAction && run.prompt?.trim() && !/^\s*\/[a-z-]+(?:\s|$)/i.test(run.prompt) && run.text.trim());
|
|
556
|
+
const pending = worker.pendingTitleSuggestion;
|
|
557
|
+
if (pending && this.store.status(pending.requestId).terminated) {
|
|
558
|
+
const completed = exchanges.some(run => run.id === pending.requestId);
|
|
559
|
+
worker = { ...worker, pendingTitleSuggestion: undefined,
|
|
560
|
+
...(completed && pending.revision === worker.titleRevision ? { titleSuggestion: pending } : {}) };
|
|
561
|
+
this.store.set('workers', workerId, worker);
|
|
562
|
+
}
|
|
563
|
+
const suggestion = worker.titleSuggestion;
|
|
564
|
+
const unnamed = ((!worker.titleSource || worker.titleSource === 'default') && worker.title === worker.shortName) ||
|
|
565
|
+
(worker.titleSource === 'generated' && !worker.titleRevision && isGreetingTitle(worker.title));
|
|
566
|
+
if (exchanges.length >= 3 && unnamed && suggestion && suggestion.revision === worker.titleRevision) {
|
|
567
|
+
this.save({ ...worker, title: suggestion.title, titleSource: 'generated', titleRequestId: undefined, titleDeferredThrough: undefined });
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
async refreshTitle(repoId, workerId) {
|
|
571
|
+
let worker = this.store.get('workers', workerId);
|
|
572
|
+
if (!worker || worker.repoId !== repoId || worker.state !== 'ready' || this.pending(workerId) || this.archiving.has(workerId) ||
|
|
573
|
+
this.store.get('memory-hidden-conversations', worker.conversationId))
|
|
574
|
+
throw new Error('This worktree is unavailable.');
|
|
575
|
+
this.nameWorktree(workerId);
|
|
576
|
+
worker = this.store.get('workers', workerId);
|
|
577
|
+
const suggestion = worker.titleSuggestion;
|
|
578
|
+
if (!suggestion || suggestion.revision !== worker.titleRevision)
|
|
579
|
+
throw new Error('No name suggestion is ready yet. Try after the next completed reply.');
|
|
580
|
+
const titleRevision = randomUUID();
|
|
581
|
+
this.save({ ...worker, title: suggestion.title, titleSource: 'generated', titleRevision,
|
|
582
|
+
titleSuggestion: { ...suggestion, revision: titleRevision }, titleRequestId: undefined, titleDeferredThrough: undefined });
|
|
583
|
+
}
|
|
584
|
+
recordOverviewSteering(targetId, id, prompt, images, imageOnly) {
|
|
585
|
+
if (this.store.command(targetId)?.kind !== 'code')
|
|
586
|
+
return;
|
|
587
|
+
const previous = this.store.get('overview-steering', targetId) ?? {};
|
|
588
|
+
if (previous[id] === prompt)
|
|
589
|
+
return;
|
|
590
|
+
this.store.transaction(() => {
|
|
591
|
+
this.store.set('overview-steering', targetId, { ...previous, [id]: prompt });
|
|
592
|
+
if (images?.length)
|
|
593
|
+
this.store.set('steering-images', id, { images, imageOnly });
|
|
594
|
+
const times = this.store.get('overview-steering-times', targetId) ?? {};
|
|
595
|
+
this.store.set('overview-steering-times', targetId, { ...times, [id]: new Date().toISOString() });
|
|
596
|
+
const boundaries = this.store.get('steering-boundaries', targetId) ?? {};
|
|
597
|
+
const state = this.store.status(targetId);
|
|
598
|
+
// A turn can finish during acknowledgement; keep its final answer below the instruction.
|
|
599
|
+
this.store.set('steering-boundaries', targetId, { ...boundaries,
|
|
600
|
+
[id]: boundaries[id] ?? Math.max(0, state.maxSeq - Number(state.terminated)) });
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
recordQueuedSteering(targetId, id) {
|
|
604
|
+
const request = this.store.command(id);
|
|
605
|
+
if (request?.kind !== 'code' || this.store.command(targetId)?.kind !== 'code')
|
|
606
|
+
return;
|
|
607
|
+
// Queued prompts already have recall sources; save only their transcript placement here.
|
|
608
|
+
const previous = this.store.get('queued-steering', targetId) ?? {};
|
|
609
|
+
if (previous[id])
|
|
610
|
+
return;
|
|
611
|
+
const state = this.store.status(targetId);
|
|
612
|
+
this.store.set('queued-steering', targetId, { ...previous,
|
|
613
|
+
[id]: { prompt: request.prompt, afterSeq: Math.max(0, state.maxSeq - Number(state.terminated)) } });
|
|
614
|
+
}
|
|
615
|
+
/** How this repository's worktrees are prepared. Nothing is copied or run until the owner sets it. */
|
|
616
|
+
settings(repoId) {
|
|
617
|
+
return RepoSettingsSchema.parse(this.store.get('repo-settings', repoId) ?? {});
|
|
618
|
+
}
|
|
619
|
+
places(repoId) {
|
|
620
|
+
const root = this.repo(repoId).root;
|
|
621
|
+
return { root, worktrees: dirname(sessionWorktreePath(repoId, this.baseDir, 'x')),
|
|
622
|
+
copyMatches: matchedFiles(root, this.settings(repoId).copy) };
|
|
623
|
+
}
|
|
624
|
+
/** Run the archive command, then free the folder. Shared by the phone's Archive and archive-on-merge. */
|
|
625
|
+
async archive(worker) {
|
|
626
|
+
const { repoId, workerId } = worker;
|
|
627
|
+
if (this.archiving.has(workerId))
|
|
628
|
+
throw new Error('This worktree is already being archived.');
|
|
629
|
+
this.archiving.add(workerId);
|
|
630
|
+
try {
|
|
631
|
+
await this.lanes.run(this.repo(repoId).root, async () => {
|
|
632
|
+
if (worker.state === 'creating' || this.setups.has(workerId))
|
|
633
|
+
throw new Error('Wait for workspace setup to finish before archiving.');
|
|
634
|
+
if (this.editorActive(worker))
|
|
635
|
+
throw new Error('Exit this worktree’s terminal and stop its Run command before archiving.');
|
|
636
|
+
if (this.store.unfinished(worker.conversationId))
|
|
637
|
+
throw new Error('Stop this worker and its queued messages before archiving it.');
|
|
638
|
+
// The session checkout is shared with the classic single session, so its folder stays.
|
|
639
|
+
if (!worker.sessionCheckout && !worker.externalDesktop) {
|
|
640
|
+
const root = this.repo(repoId).root;
|
|
641
|
+
const settings = this.settings(repoId);
|
|
642
|
+
const path = sessionWorktreePath(repoId, this.baseDir, workerId);
|
|
643
|
+
if (settings.archiveScript && existsSync(path))
|
|
644
|
+
await runSetupScript(root, path, worker.title, settings.archiveScript, worker.port).catch((error) => {
|
|
645
|
+
const detail = String(error.stderr || error.message).trim().slice(-600);
|
|
646
|
+
throw new Error(`The archive command failed, so this worktree was kept. ${detail}`);
|
|
647
|
+
});
|
|
648
|
+
await archiveWorktree(root, { path, branch: worker.branch ?? sessionBranch(repoId, workerId), mode: 'worktree' }, workerId, { deleteBranch: settings.deleteBranchOnArchive });
|
|
649
|
+
}
|
|
650
|
+
this.save({ ...worker, state: 'archived' });
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
finally {
|
|
654
|
+
this.archiving.delete(workerId);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
/** Remove an archived worktree for good: its local branch, its snapshot and its record. Answers
|
|
658
|
+
* with the work that would be lost, deleting nothing, unless there is none or `force` is set. */
|
|
659
|
+
delete(repoId, workerId, force) {
|
|
660
|
+
const root = this.repo(repoId).root;
|
|
661
|
+
// Queued behind create, so a restore that is already under way finishes first and is seen here.
|
|
662
|
+
return this.lanes.run(root, async () => {
|
|
663
|
+
const worker = this.store.get('workers', workerId);
|
|
664
|
+
// Already gone: another device may still list a worktree that was deleted from this one.
|
|
665
|
+
if (!worker)
|
|
666
|
+
return undefined;
|
|
667
|
+
if (worker.repoId !== repoId)
|
|
668
|
+
throw new Error('This worker is not registered in this repository.');
|
|
669
|
+
if (worker.state !== 'archived')
|
|
670
|
+
throw new Error('Archive this worktree before deleting it.');
|
|
671
|
+
// The session checkout's branch and folder belong to the classic single session, so they stay.
|
|
672
|
+
if (!worker.sessionCheckout && !worker.externalDesktop) {
|
|
673
|
+
const branch = worker.branch ?? sessionBranch(repoId, workerId);
|
|
674
|
+
if (!force) {
|
|
675
|
+
const unmerged = await unmergedArchivedWork(root, workerId, branch, [worker.baseRef, this.settings(repoId).baseRef, this.repos().find((r) => r.id === repoId)?.baseRef]);
|
|
676
|
+
if (unmerged.commits || unmerged.uncommitted)
|
|
677
|
+
return unmerged;
|
|
678
|
+
}
|
|
679
|
+
await deleteArchivedWorktree(root, workerId, branch).catch((error) => {
|
|
680
|
+
const detail = String(error.stderr || error.message).trim().slice(-600);
|
|
681
|
+
throw new Error(`This worktree's branch could not be deleted, so it was kept. ${detail}`);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
// The conversation's runs stay: they are the receipts that stop a replayed request running twice.
|
|
685
|
+
this.store.transaction(() => {
|
|
686
|
+
this.store.set('deleted-workers', workerId, { repoId, deletedAt: new Date().toISOString() });
|
|
687
|
+
this.store.delete('workers', workerId);
|
|
688
|
+
this.store.delete('workspaces', worker.conversationId);
|
|
689
|
+
});
|
|
690
|
+
this.changed();
|
|
691
|
+
return undefined;
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
/** Archive ready worktrees whose pull request has merged, in repositories that asked for it.
|
|
695
|
+
* A worktree with commits past the merged head, or a turn in flight, is left alone. */
|
|
696
|
+
async archiveMerged(mergedHead) {
|
|
697
|
+
const archived = [];
|
|
698
|
+
for (const worker of this.store.list('workers')) {
|
|
699
|
+
if (this.pending(worker.workerId) || worker.state !== 'ready' || worker.sessionCheckout || !worker.path || !worker.branch)
|
|
700
|
+
continue;
|
|
701
|
+
try {
|
|
702
|
+
if (!this.settings(worker.repoId).archiveOnMerge || !existsSync(worker.path))
|
|
703
|
+
continue;
|
|
704
|
+
const merged = await mergedHead(this.repo(worker.repoId).root, worker.branch);
|
|
705
|
+
if (!merged || merged !== await headSha(worker.path))
|
|
706
|
+
continue;
|
|
707
|
+
await this.archive(worker);
|
|
708
|
+
archived.push(worker.workerId);
|
|
709
|
+
}
|
|
710
|
+
catch { /* busy, or the repository is gone: try again on the next sweep */ }
|
|
711
|
+
}
|
|
712
|
+
return archived;
|
|
713
|
+
}
|
|
36
714
|
save(worker) {
|
|
37
715
|
this.store.set('workers', worker.workerId, { ...worker, updatedAt: new Date().toISOString() });
|
|
716
|
+
this.changed();
|
|
38
717
|
}
|
|
39
718
|
resume(request) {
|
|
40
719
|
if (!request.workerId && request.mode === 'in-place' && !request.handoff) {
|
|
@@ -52,19 +731,90 @@ export class WorkspaceRegistry {
|
|
|
52
731
|
const resume = this.store.latestSession(worker.conversationId) ?? worker.resume ?? request.resume;
|
|
53
732
|
return request.provider && sessionProvider(resume) !== request.provider ? undefined : resume;
|
|
54
733
|
}
|
|
55
|
-
|
|
734
|
+
/** Only an explicit transcript import authorizes this one-time new-session
|
|
735
|
+
* context. A recorded session that fails to resume never takes this fallback. */
|
|
736
|
+
continuationFields(request) {
|
|
737
|
+
const resume = this.resume(request);
|
|
738
|
+
const conversation = conversationKey({ ...request, kind: 'code' });
|
|
739
|
+
const saved = request.workerId ? this.store.get('workers', request.workerId)
|
|
740
|
+
: this.store.get('checkout-conversations', conversation);
|
|
741
|
+
const context = saved?.importContext;
|
|
742
|
+
const after = request.workerId ? undefined : saved?.clearedThrough;
|
|
743
|
+
if (!resume && !request.handoff && context && !this.store.latestSession(conversation, after))
|
|
744
|
+
return {
|
|
745
|
+
resume: undefined, provider: request.provider ?? context.provider,
|
|
746
|
+
handoff: { from: context.provider, transcript: context.transcript },
|
|
747
|
+
};
|
|
748
|
+
return { resume };
|
|
749
|
+
}
|
|
750
|
+
/** The same conversation key is used for execution and the phone's model picker. */
|
|
751
|
+
modelKey(context, provider) {
|
|
752
|
+
return JSON.stringify([conversationKey({ ...context, kind: 'code' }), provider]);
|
|
753
|
+
}
|
|
754
|
+
modelPreferences(request, defaultProvider) {
|
|
755
|
+
const provider = sessionProvider(request.resume) ?? request.provider ?? defaultProvider;
|
|
756
|
+
return this.store.get('workspace-models', this.modelKey(request, provider));
|
|
757
|
+
}
|
|
758
|
+
/** Called only after initial-message admission and execution validation. */
|
|
759
|
+
initializeAgentSettings(request, preferences) {
|
|
760
|
+
if (!request.workerId || !request.agentMessage?.initialSettings || request.resume || request.handoff ||
|
|
761
|
+
this.store.commands(conversationKey({ ...request, kind: 'code' }), { before: request.id, limit: 1 }).length)
|
|
762
|
+
throw new Error('Initial settings require a new worktree conversation.');
|
|
763
|
+
this.store.set('workspace-models', this.modelKey(request, preferences.provider), WorkspaceModelPreferencesSchema.parse(preferences));
|
|
764
|
+
}
|
|
765
|
+
modelSettings(command) {
|
|
766
|
+
if (!command.repoId || !command.provider)
|
|
767
|
+
throw new Error('Select a repository and provider.');
|
|
768
|
+
this.repo(command.repoId);
|
|
769
|
+
if (command.workerId) {
|
|
770
|
+
const worker = this.store.get('workers', command.workerId);
|
|
771
|
+
if (!worker || worker.repoId !== command.repoId)
|
|
772
|
+
throw new Error('This worker is not registered in this repository.');
|
|
773
|
+
}
|
|
774
|
+
else if (!command.checkout)
|
|
775
|
+
throw new Error('Select a worktree or Main checkout.');
|
|
776
|
+
const key = this.modelKey({ repoId: command.repoId, workerId: command.workerId,
|
|
777
|
+
mode: command.checkout ? 'in-place' : 'worktree' }, command.provider);
|
|
778
|
+
if (command.action === 'save-model-settings') {
|
|
779
|
+
const preferences = WorkspaceModelPreferencesSchema.parse(command.modelPreferences);
|
|
780
|
+
if (preferences.provider !== command.provider)
|
|
781
|
+
throw new Error('Model settings must match the selected provider.');
|
|
782
|
+
this.store.set('workspace-models', key, preferences);
|
|
783
|
+
}
|
|
784
|
+
return { workers: [], modelPreferences: this.store.get('workspace-models', key) ?? null };
|
|
785
|
+
}
|
|
786
|
+
async create(repoId, workerId, title, brief = '', options = {}) {
|
|
56
787
|
const repo = this.repo(repoId);
|
|
57
788
|
return this.lanes.run(repo.root, async () => {
|
|
789
|
+
if (this.store.get('deleted-workers', workerId))
|
|
790
|
+
throw new Error('This worktree was deleted. Create a new worktree to continue.');
|
|
791
|
+
if (this.archiving.has(workerId) || this.pending(workerId)?.state === 'running')
|
|
792
|
+
throw new Error('This worktree is being archived or deleted.');
|
|
58
793
|
const previous = this.store.get('workers', workerId);
|
|
59
794
|
if (previous && previous.repoId !== repoId)
|
|
60
795
|
throw new Error('This worker belongs to another repository.');
|
|
61
796
|
if (previous?.state === 'archived')
|
|
62
797
|
throw new Error('Restore this worker before continuing.');
|
|
63
|
-
if (previous?.
|
|
798
|
+
if (previous?.externalDesktop) {
|
|
799
|
+
if (!previous.path)
|
|
800
|
+
throw new Error('The imported workspace folder is missing.');
|
|
801
|
+
await existingWorkspace(repo.root, previous.path, previous.branch ?? '');
|
|
802
|
+
if (previous.state !== 'ready')
|
|
803
|
+
this.save({ ...previous, state: 'ready', error: undefined });
|
|
804
|
+
return this.public({ ...previous, state: 'ready', error: undefined });
|
|
805
|
+
}
|
|
806
|
+
if (previous?.state === 'ready') {
|
|
807
|
+
if (previous.setupDeferred && !options.deferSetup) {
|
|
808
|
+
previous.setupDeferred = false;
|
|
809
|
+
this.save(previous);
|
|
810
|
+
this.setUp(repo.root, previous, options.signal);
|
|
811
|
+
}
|
|
64
812
|
return this.public(previous);
|
|
813
|
+
}
|
|
65
814
|
const now = new Date().toISOString();
|
|
815
|
+
const shortName = nextWorkerTitle(this.store.list('workers').filter(w => w.repoId === repoId).map(w => w.shortName ?? w.title));
|
|
66
816
|
const worker = previous ?? {
|
|
67
|
-
workerId, repoId, title: title ||
|
|
817
|
+
workerId, repoId, title: title || shortName, shortName, titleSource: title ? 'custom' : 'default', brief,
|
|
68
818
|
workspaceId: workerId, conversationId: conversationKey({ kind: 'code', repoId, workerId }),
|
|
69
819
|
state: 'creating', createdAt: now, updatedAt: now,
|
|
70
820
|
};
|
|
@@ -73,18 +823,26 @@ export class WorkspaceRegistry {
|
|
|
73
823
|
const gitWorkerId = worker.sessionCheckout ? undefined : workerId;
|
|
74
824
|
const path = sessionWorktreePath(repoId, this.baseDir, gitWorkerId);
|
|
75
825
|
const branchExists = await workspaceBranchExists(repo.root, repoId, gitWorkerId);
|
|
76
|
-
|
|
826
|
+
// A branch deleted on archive is re-created from the commit its snapshot was taken on.
|
|
827
|
+
const archivedTip = gitWorkerId && !branchExists && !existsSync(path) ? await archivedHead(repo.root, workerId) : undefined;
|
|
828
|
+
if (worker.legacy && !existsSync(path) && !branchExists && !archivedTip)
|
|
77
829
|
throw new Error('The original worker branch and files are missing. Its conversation is preserved; create a new worker for new work.');
|
|
78
830
|
// A known legacy directory is adopted without fetching or resetting it.
|
|
79
|
-
const base = existsSync(path) || branchExists || previous?.baseSha
|
|
831
|
+
const base = existsSync(path) || branchExists || archivedTip || previous?.baseSha
|
|
80
832
|
? previous?.baseSha ? { ref: previous.baseRef, sha: previous.baseSha } : undefined
|
|
81
|
-
: await workspaceBase(repo.root, this.repos().find((r) => r.id === repoId)?.baseRef);
|
|
833
|
+
: await workspaceBase(repo.root, this.settings(repoId).baseRef || this.repos().find((r) => r.id === repoId)?.baseRef);
|
|
82
834
|
if (base)
|
|
83
835
|
this.save({ ...worker, state: 'creating', baseRef: base.ref, baseSha: base.sha });
|
|
84
|
-
const
|
|
836
|
+
const fresh = !existsSync(path);
|
|
837
|
+
const workspace = await ensureWorkspace(repo.root, repoId, { workerId: gitWorkerId, baseDir: this.baseDir, startPoint: archivedTip ?? base?.sha });
|
|
838
|
+
if (gitWorkerId)
|
|
839
|
+
await restoreArchivedFiles(repo.root, workspace, workerId);
|
|
85
840
|
const ready = { ...worker, state: 'ready', error: undefined, path: await realpath(workspace.path),
|
|
86
|
-
branch: workspace.branch, ...(base ? { baseRef: base.ref, baseSha: base.sha } : {}) };
|
|
841
|
+
port: this.portOf(worker), branch: workspace.branch, ...(base ? { baseRef: base.ref, baseSha: base.sha } : {}) };
|
|
842
|
+
ready.setupDeferred = Boolean((fresh && gitWorkerId || worker.setupDeferred) && options.deferSetup);
|
|
87
843
|
this.save(ready);
|
|
844
|
+
if ((fresh && gitWorkerId || worker.setupDeferred) && !options.deferSetup)
|
|
845
|
+
this.setUp(repo.root, ready, options.signal);
|
|
88
846
|
return this.public(ready);
|
|
89
847
|
}
|
|
90
848
|
catch (error) {
|
|
@@ -94,12 +852,47 @@ export class WorkspaceRegistry {
|
|
|
94
852
|
}
|
|
95
853
|
});
|
|
96
854
|
}
|
|
97
|
-
|
|
855
|
+
/** A worktree's port block. Archived worktrees keep theirs so a restore comes back on the same ports. */
|
|
856
|
+
portOf(worker) {
|
|
857
|
+
return worker.port ?? nextPortBlock(this.store.list('workers').map((w) => w.port));
|
|
858
|
+
}
|
|
859
|
+
/** Fill in a worktree: the repository's listed files, then its setup command. This runs after the
|
|
860
|
+
* worktree is reported ready so the phone is not kept waiting; a turn waits for it in prepare().
|
|
861
|
+
* A failure is noted on the worker and never fails the worktree. */
|
|
862
|
+
setUp(repoRoot, worker, signal) {
|
|
863
|
+
const settings = this.settings(worker.repoId);
|
|
864
|
+
if (!settings.copy.length && !settings.setup)
|
|
865
|
+
return;
|
|
866
|
+
this.save({ ...worker, setup: undefined, error: undefined });
|
|
867
|
+
const run = (async () => {
|
|
868
|
+
signal?.throwIfAborted();
|
|
869
|
+
copyIncludedFiles(repoRoot, worker.path, settings.copy);
|
|
870
|
+
if (settings.setup)
|
|
871
|
+
await runSetupScript(repoRoot, worker.path, worker.title, settings.setup, worker.port, signal);
|
|
872
|
+
})().catch((error) => {
|
|
873
|
+
const detail = String(error.stderr || error.message).trim().slice(-600);
|
|
874
|
+
console.error(`[workspaces] setup failed for ${worker.workerId}: ${detail}`);
|
|
875
|
+
const current = this.store.get('workers', worker.workerId);
|
|
876
|
+
if (current?.state === 'ready')
|
|
877
|
+
this.save({ ...current, setup: 'failed', error: detail });
|
|
878
|
+
}).finally(() => { this.setups.delete(worker.workerId); this.changed(); });
|
|
879
|
+
this.setups.set(worker.workerId, run);
|
|
880
|
+
this.changed();
|
|
881
|
+
}
|
|
882
|
+
async prepare(request, options = {}) {
|
|
883
|
+
this.checkRecoveryWorkspace(request);
|
|
98
884
|
const repo = this.repo(request.repoId);
|
|
99
885
|
let gitWorkerId = request.workerId;
|
|
100
886
|
if (request.workerId) {
|
|
101
|
-
await this.create(request.repoId, request.workerId, undefined, request.prompt);
|
|
887
|
+
await this.create(request.repoId, request.workerId, undefined, request.prompt, options);
|
|
888
|
+
await this.setups.get(request.workerId);
|
|
102
889
|
const worker = this.store.get('workers', request.workerId);
|
|
890
|
+
if (worker.externalDesktop) {
|
|
891
|
+
const location = await existingWorkspace(repo.root, worker.path, worker.branch);
|
|
892
|
+
const workspace = { path: location, branch: worker.branch, mode: 'worktree' };
|
|
893
|
+
this.store.set('workspaces', worker.conversationId, { ...workspace, repoId: request.repoId });
|
|
894
|
+
return workspace;
|
|
895
|
+
}
|
|
103
896
|
if (worker.sessionCheckout)
|
|
104
897
|
gitWorkerId = undefined;
|
|
105
898
|
if (!worker.path || !existsSync(worker.path)) {
|
|
@@ -111,7 +904,14 @@ export class WorkspaceRegistry {
|
|
|
111
904
|
mode: request.workerId ? 'worktree' : request.mode, workerId: gitWorkerId, baseDir: this.baseDir,
|
|
112
905
|
});
|
|
113
906
|
this.store.set('workspaces', conversationKey({ ...request, kind: 'code' }), { ...workspace, repoId: request.repoId });
|
|
114
|
-
|
|
907
|
+
const worker = request.workerId ? this.store.get('workers', request.workerId) : undefined;
|
|
908
|
+
if (!worker || worker.sessionCheckout)
|
|
909
|
+
return workspace;
|
|
910
|
+
// Worktrees made before ports existed get their block on their next turn.
|
|
911
|
+
const port = this.portOf(worker);
|
|
912
|
+
if (worker.port !== port)
|
|
913
|
+
this.save({ ...worker, port });
|
|
914
|
+
return { ...workspace, env: { LUCIDITY_PORT: String(port), LUCIDITY_WORKTREE_NAME: worker.title } };
|
|
115
915
|
}
|
|
116
916
|
checkout(command, commandId) {
|
|
117
917
|
if (!command.repoId || command.workerId)
|
|
@@ -120,6 +920,10 @@ export class WorkspaceRegistry {
|
|
|
120
920
|
const conversationId = conversationKey({ kind: 'code', repoId: command.repoId, mode: 'in-place' });
|
|
121
921
|
if (!['history', 'import', 'clear-history'].includes(command.action))
|
|
122
922
|
throw new Error('Main checkout supports history, import and clear.');
|
|
923
|
+
if (command.action === 'history' && command.open && !command.before && !this.store.get('opened-checkouts', conversationId)) {
|
|
924
|
+
this.store.set('opened-checkouts', conversationId, true);
|
|
925
|
+
this.changed();
|
|
926
|
+
}
|
|
123
927
|
const saved = () => this.store.get('checkout-conversations', conversationId) ?? { revision: '0' };
|
|
124
928
|
if (command.action !== 'history') {
|
|
125
929
|
this.store.transaction(() => {
|
|
@@ -135,6 +939,8 @@ export class WorkspaceRegistry {
|
|
|
135
939
|
if (command.action === 'clear-history') {
|
|
136
940
|
if (this.store.unfinished(conversationId))
|
|
137
941
|
throw new Error('Finish or stop active and queued messages before clearing this conversation.');
|
|
942
|
+
if ([...this.editorGuards].some(guard => guard(command.repoId)))
|
|
943
|
+
throw new Error('Stop active terminals and shell commands before clearing this conversation.');
|
|
138
944
|
this.store.set('checkout-conversations', conversationId, {
|
|
139
945
|
revision: commandId ?? `${Date.now()}:${checkout.revision}`,
|
|
140
946
|
clearedThrough: this.store.lastCommand(conversationId),
|
|
@@ -158,17 +964,136 @@ export class WorkspaceRegistry {
|
|
|
158
964
|
return {
|
|
159
965
|
workers: [], checkout: { repoId: command.repoId, conversationId, revision: checkout.revision,
|
|
160
966
|
resume: this.store.latestSession(conversationId, checkout.clearedThrough) ?? checkout.resume },
|
|
967
|
+
continuationProvider: checkout.importContext?.provider,
|
|
161
968
|
legacyMessages: command.before ? [] : checkout.legacyMessages,
|
|
162
|
-
runs: this.historyRuns(page),
|
|
969
|
+
runs: this.historyRuns(this.includeActive(page, conversationId, command.before)),
|
|
163
970
|
...(page.length === 10 ? { nextBefore: page[0].request.id } : {}),
|
|
164
971
|
};
|
|
165
972
|
}
|
|
973
|
+
includeActive(page, conversation, before) {
|
|
974
|
+
if (before)
|
|
975
|
+
return page;
|
|
976
|
+
return this.store.withActiveCommands(conversation, page);
|
|
977
|
+
}
|
|
166
978
|
historyRuns(page) {
|
|
167
979
|
return page.map(({ request, state }) => ({ requestId: request.id, prompt: 'prompt' in request ? request.prompt : '',
|
|
980
|
+
...(request.kind === 'code' && request.senderKind === 'agent' && request.agentMessage
|
|
981
|
+
? { agentHandoff: { sender: request.agentMessage.dispatch?.source.title || 'Another agent', message: request.agentMessage.message,
|
|
982
|
+
...(request.agentMessage.dispatch?.source.conversationId ? { sourceConversationId: request.agentMessage.dispatch.source.conversationId } : {}),
|
|
983
|
+
...(request.agentMessage.dispatch?.owner ? { owner: request.agentMessage.dispatch.owner } : {}) } } : {}),
|
|
984
|
+
...(request.kind === 'code' && request.teamRequest ? { agentHandoff: { kind: 'team-request',
|
|
985
|
+
sender: request.teamRequest.sender.name, message: request.teamRequest.prompt, owner: request.teamRequest.sender,
|
|
986
|
+
approvedBy: request.teamRequest.recipient } } : {}),
|
|
987
|
+
...(request.kind === 'code' && request.replyTo ? { replyTo: request.replyTo } : {}),
|
|
988
|
+
...imageMetadata(request.kind === 'code' ? request : undefined),
|
|
989
|
+
...(request.kind === 'code' && request.files?.length ? { fileNames: request.files.map(file => file.name) } : {}),
|
|
990
|
+
steering: [...Object.entries(this.store.get('overview-steering', request.id) ?? {})
|
|
991
|
+
.map(([id, prompt]) => ({ id, prompt,
|
|
992
|
+
...imageMetadata(this.store.get('steering-images', id)),
|
|
993
|
+
afterSeq: this.store.get('steering-boundaries', request.id)?.[id] })),
|
|
994
|
+
...Object.entries(this.store.get('queued-steering', request.id) ?? {})
|
|
995
|
+
.map(([id, instruction]) => {
|
|
996
|
+
const queued = this.store.command(id);
|
|
997
|
+
return { id, ...instruction, ...imageMetadata(queued?.kind === 'code' ? queued : undefined) };
|
|
998
|
+
})],
|
|
999
|
+
...(this.store.get('run-reviews', request.id)?.continuedAt
|
|
1000
|
+
? { reviewedContinuationId: this.store.get('run-reviews', request.id).continuationId } : {}),
|
|
168
1001
|
...('handoff' in request && request.handoff && request.provider ? { handoff: { from: request.handoff.from, to: request.provider } } : {}),
|
|
169
1002
|
frames: state.frames, terminated: state.terminated }));
|
|
170
1003
|
}
|
|
1004
|
+
messageRequest(command) {
|
|
1005
|
+
if (!command.repoId || !command.requestId)
|
|
1006
|
+
throw new Error('Select a message attachment.');
|
|
1007
|
+
this.repo(command.repoId);
|
|
1008
|
+
const request = this.store.command(command.requestId);
|
|
1009
|
+
if (request?.kind !== 'code' || request.repoId !== command.repoId || request.workerId !== command.workerId ||
|
|
1010
|
+
(!command.workerId && (request.mode !== 'in-place' || !command.checkout)))
|
|
1011
|
+
throw new Error('This image is unavailable in this conversation.');
|
|
1012
|
+
if (command.workerId) {
|
|
1013
|
+
const worker = this.store.get('workers', command.workerId);
|
|
1014
|
+
if (!worker || worker.repoId !== command.repoId)
|
|
1015
|
+
throw new Error('This worktree is unavailable.');
|
|
1016
|
+
}
|
|
1017
|
+
else {
|
|
1018
|
+
const saved = this.store.get('checkout-conversations', conversationKey(request));
|
|
1019
|
+
if (saved?.clearedThrough && request.id <= saved.clearedThrough)
|
|
1020
|
+
throw new Error('This message was cleared.');
|
|
1021
|
+
}
|
|
1022
|
+
return request;
|
|
1023
|
+
}
|
|
1024
|
+
messageImages(command) {
|
|
1025
|
+
const request = this.messageRequest(command);
|
|
1026
|
+
let images = request.images;
|
|
1027
|
+
if (command.steeringId) {
|
|
1028
|
+
const id = command.steeringId;
|
|
1029
|
+
const direct = this.store.get('overview-steering', request.id);
|
|
1030
|
+
const queued = this.store.get('queued-steering', request.id);
|
|
1031
|
+
if (direct && Object.hasOwn(direct, id))
|
|
1032
|
+
images = this.store.get('steering-images', id)?.images;
|
|
1033
|
+
else if (queued && Object.hasOwn(queued, id)) {
|
|
1034
|
+
const instruction = this.store.command(id);
|
|
1035
|
+
images = instruction?.kind === 'code' ? instruction.images : undefined;
|
|
1036
|
+
}
|
|
1037
|
+
else
|
|
1038
|
+
throw new Error('This image is unavailable in this conversation.');
|
|
1039
|
+
}
|
|
1040
|
+
return images ?? [];
|
|
1041
|
+
}
|
|
1042
|
+
messageImage(command) {
|
|
1043
|
+
const images = this.messageImages(command);
|
|
1044
|
+
const image = command.imageIndex === undefined ? undefined : images[command.imageIndex];
|
|
1045
|
+
if (!image)
|
|
1046
|
+
throw new Error('This image is unavailable.');
|
|
1047
|
+
return { workers: [], messageImage: `data:${image.mediaType};base64,${image.dataBase64}` };
|
|
1048
|
+
}
|
|
1049
|
+
pastedText(command) {
|
|
1050
|
+
const request = this.messageRequest(command);
|
|
1051
|
+
const file = command.fileIndex === undefined ? undefined : request.files?.[command.fileIndex];
|
|
1052
|
+
if (command.steeringId || !file || file.mediaType !== 'text/plain' ||
|
|
1053
|
+
!/^Pasted text \(\d+ characters\)\.txt$/.test(file.name))
|
|
1054
|
+
throw new Error('This pasted text is unavailable.');
|
|
1055
|
+
const text = new TextDecoder('utf-8', { fatal: true }).decode(Buffer.from(file.dataBase64, 'base64'));
|
|
1056
|
+
const start = command.textOffset ?? 0;
|
|
1057
|
+
const end = Math.min(text.length, start + (command.textLimit ?? 2000));
|
|
1058
|
+
if (start > text.length)
|
|
1059
|
+
throw new Error('This text offset is unavailable.');
|
|
1060
|
+
return { workers: [], pastedText: { text: text.slice(start, end), ...(end < text.length ? { nextOffset: end } : {}) } };
|
|
1061
|
+
}
|
|
171
1062
|
async command(command, commandId) {
|
|
1063
|
+
if (command.action === 'delivery-status') {
|
|
1064
|
+
if (!command.repoId || !command.requestId)
|
|
1065
|
+
throw new Error('Select a conversation and message.');
|
|
1066
|
+
const scope = { repoId: command.repoId, workerId: command.workerId, checkout: command.checkout };
|
|
1067
|
+
const workspace = this.editorWorkspace(scope, true);
|
|
1068
|
+
const saved = this.store.command(command.requestId);
|
|
1069
|
+
if (saved && (saved.kind !== 'code' || saved.repoId !== command.repoId || saved.workerId !== command.workerId ||
|
|
1070
|
+
(saved.mode === 'in-place') !== !!command.checkout))
|
|
1071
|
+
throw new Error('This message belongs to another conversation.');
|
|
1072
|
+
const state = saved ? 'accepted' : this.store.status(command.requestId).exists ? 'unavailable' : 'missing';
|
|
1073
|
+
return { workers: [], delivery: { requestId: command.requestId, state, revision: workspace.revision,
|
|
1074
|
+
...(saved ? { requestDigest: createHash('sha256').update(JSON.stringify(CodeRequestSchema.parse(saved))).digest('hex') } : {}) } };
|
|
1075
|
+
}
|
|
1076
|
+
if (command.action === 'pasted-text')
|
|
1077
|
+
return this.pastedText(command);
|
|
1078
|
+
if (command.action === 'message-image')
|
|
1079
|
+
return this.messageImage(command);
|
|
1080
|
+
if (command.action === 'message-source')
|
|
1081
|
+
return this.messageSource(command);
|
|
1082
|
+
if (command.action === 'overview-source')
|
|
1083
|
+
return this.overviewSource(command);
|
|
1084
|
+
if (command.action === 'overview')
|
|
1085
|
+
return this.overview(command);
|
|
1086
|
+
if (command.action === 'model-settings' || command.action === 'save-model-settings')
|
|
1087
|
+
return this.modelSettings(command);
|
|
1088
|
+
if (command.action === 'inspect-run' || command.action === 'continue-run') {
|
|
1089
|
+
if (!command.repoId)
|
|
1090
|
+
throw new Error('Select a repository.');
|
|
1091
|
+
const repo = this.repo(command.repoId);
|
|
1092
|
+
const path = command.checkout ? repo.root : command.workerId ? this.store.get('workers', command.workerId)?.path : undefined;
|
|
1093
|
+
if (command.action === 'continue-run')
|
|
1094
|
+
return { workers: this.list(command.repoId), review: this.store.get('run-reviews', command.requestId) };
|
|
1095
|
+
return { workers: this.list(command.repoId), review: await inspectRun(this.store, command, path) };
|
|
1096
|
+
}
|
|
172
1097
|
if (command.checkout)
|
|
173
1098
|
return this.checkout(command, commandId);
|
|
174
1099
|
if (command.action === 'clear-history')
|
|
@@ -176,7 +1101,15 @@ export class WorkspaceRegistry {
|
|
|
176
1101
|
const { action, repoId } = command;
|
|
177
1102
|
let workerId = command.workerId;
|
|
178
1103
|
if (action === 'list')
|
|
179
|
-
return
|
|
1104
|
+
return this.snapshot(repoId);
|
|
1105
|
+
if (action === 'settings' || action === 'save-settings') {
|
|
1106
|
+
if (!repoId)
|
|
1107
|
+
throw new Error('Select a repository.');
|
|
1108
|
+
this.repo(repoId);
|
|
1109
|
+
if (action === 'save-settings')
|
|
1110
|
+
this.store.set('repo-settings', repoId, RepoSettingsSchema.parse(command.settings ?? {}));
|
|
1111
|
+
return { workers: this.list(repoId), settings: this.settings(repoId), places: this.places(repoId) };
|
|
1112
|
+
}
|
|
180
1113
|
if (action === 'import' && repoId && command.legacy?.sessionCheckout) {
|
|
181
1114
|
const key = createHash('sha256').update(this.repo(repoId).root).digest('hex');
|
|
182
1115
|
workerId = `${key.slice(0, 8)}-${key.slice(8, 12)}-7${key.slice(13, 16)}-8${key.slice(17, 20)}-${key.slice(20, 32)}`;
|
|
@@ -184,6 +1117,24 @@ export class WorkspaceRegistry {
|
|
|
184
1117
|
if (!repoId || !workerId)
|
|
185
1118
|
throw new Error('Select a repository and worker.');
|
|
186
1119
|
this.repo(repoId);
|
|
1120
|
+
if (action === 'rename') {
|
|
1121
|
+
const worker = this.store.get('workers', workerId);
|
|
1122
|
+
if (!worker || worker.repoId !== repoId || worker.state === 'archived')
|
|
1123
|
+
throw new Error('This worktree is unavailable.');
|
|
1124
|
+
const title = command.title?.trim();
|
|
1125
|
+
if (!title || title.length > 200 || /[\r\n\t]/.test(title))
|
|
1126
|
+
throw new Error('Enter a name of 1–200 characters on one line.');
|
|
1127
|
+
this.save({ ...worker, title, titleSource: 'custom', titleRequestId: undefined, titleRevision: randomUUID() });
|
|
1128
|
+
return this.snapshot(repoId);
|
|
1129
|
+
}
|
|
1130
|
+
if (action === 'refresh-title') {
|
|
1131
|
+
await this.refreshTitle(repoId, workerId);
|
|
1132
|
+
return this.snapshot(repoId);
|
|
1133
|
+
}
|
|
1134
|
+
if (['create', 'import', 'restore', 'setup'].includes(action) && this.store.get('deleted-workers', workerId))
|
|
1135
|
+
throw new Error('This worktree was deleted. Create a new worktree to continue.');
|
|
1136
|
+
if (['create', 'import', 'restore', 'archive', 'delete', 'setup'].includes(action) && (this.pending(workerId) || this.archiving.has(workerId)))
|
|
1137
|
+
throw new Error('A worktree archive or deletion is already pending. Wait for its result.');
|
|
187
1138
|
if (action === 'create')
|
|
188
1139
|
await this.create(repoId, workerId, command.title, command.brief);
|
|
189
1140
|
else if (action === 'import') {
|
|
@@ -200,6 +1151,10 @@ export class WorkspaceRegistry {
|
|
|
200
1151
|
await this.create(repoId, workerId).catch(() => { });
|
|
201
1152
|
}
|
|
202
1153
|
}
|
|
1154
|
+
else if (action === 'delete') {
|
|
1155
|
+
const unmerged = await this.delete(repoId, workerId, command.force);
|
|
1156
|
+
return { workers: this.list(repoId), ...(unmerged ? { unmerged } : {}) };
|
|
1157
|
+
}
|
|
203
1158
|
else {
|
|
204
1159
|
const worker = this.store.get('workers', workerId);
|
|
205
1160
|
if (!worker || worker.repoId !== repoId)
|
|
@@ -209,16 +1164,19 @@ export class WorkspaceRegistry {
|
|
|
209
1164
|
const frames = page.flatMap((r) => r.state.frames);
|
|
210
1165
|
const resume = [...frames].reverse().find((f) => typeof f.sessionId === 'string')?.sessionId;
|
|
211
1166
|
return { workers: [{ ...this.public(worker), ...(typeof resume === 'string' ? { resume } : {}) }],
|
|
1167
|
+
continuationProvider: worker.importContext?.provider,
|
|
212
1168
|
legacyMessages: command.before ? [] : worker.legacyMessages,
|
|
213
|
-
runs: this.historyRuns(page),
|
|
1169
|
+
runs: this.historyRuns(this.includeActive(page, worker.conversationId, command.before)),
|
|
214
1170
|
...(page.length === 10 ? { nextBefore: page[0].request.id } : {}) };
|
|
215
1171
|
}
|
|
216
1172
|
if (action === 'archive') {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
1173
|
+
await this.archive(worker);
|
|
1174
|
+
}
|
|
1175
|
+
else if (action === 'setup') {
|
|
1176
|
+
if (worker.state !== 'ready' || worker.sessionCheckout || !worker.path)
|
|
1177
|
+
throw new Error('This worktree is not ready for setup.');
|
|
1178
|
+
if (!this.setups.has(workerId))
|
|
1179
|
+
this.setUp(this.repo(repoId).root, worker);
|
|
222
1180
|
}
|
|
223
1181
|
else if (action === 'restore') {
|
|
224
1182
|
this.save({ ...worker, state: 'creating' });
|
|
@@ -227,4 +1185,27 @@ export class WorkspaceRegistry {
|
|
|
227
1185
|
}
|
|
228
1186
|
return { workers: this.list(repoId) };
|
|
229
1187
|
}
|
|
1188
|
+
continuation(command) {
|
|
1189
|
+
if (!command.repoId)
|
|
1190
|
+
throw new Error('Select a repository.');
|
|
1191
|
+
this.repo(command.repoId);
|
|
1192
|
+
if (command.workerId && this.store.get('workers', command.workerId)?.state !== 'ready')
|
|
1193
|
+
throw new Error('Restore this worker before continuing.');
|
|
1194
|
+
const request = continuationRequest(this.store, command);
|
|
1195
|
+
this.checkRecoveryWorkspace(request);
|
|
1196
|
+
return request;
|
|
1197
|
+
}
|
|
1198
|
+
recoveryContext(requestId) {
|
|
1199
|
+
return this.store.get('run-reviews', requestId);
|
|
1200
|
+
}
|
|
1201
|
+
checkRecoveryWorkspace(request) {
|
|
1202
|
+
if (!request.recoveryOf)
|
|
1203
|
+
return;
|
|
1204
|
+
const review = this.store.get('run-reviews', request.recoveryOf);
|
|
1205
|
+
const worker = request.workerId ? this.store.get('workers', request.workerId) : undefined;
|
|
1206
|
+
const path = !request.workerId && request.mode === 'in-place' ? this.repo(request.repoId).root :
|
|
1207
|
+
worker?.externalDesktop ? worker.path : sessionWorktreePath(request.repoId, this.baseDir, worker?.sessionCheckout ? undefined : request.workerId);
|
|
1208
|
+
if (!review?.workspace || !path || !existsSync(review.workspace) || !existsSync(path) || realpathSync(path) !== realpathSync(review.workspace))
|
|
1209
|
+
throw new Error('The configured workspace changed since this turn. Restore the reviewed workspace before continuing.');
|
|
1210
|
+
}
|
|
230
1211
|
}
|