@cerbur/clutch-dsh-worktree 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +214 -15
- package/README.zh.md +175 -12
- package/assets/screenshots/screenshots-dashboard.png +0 -0
- package/assets/screenshots/screenshots-en.png +0 -0
- package/assets/screenshots/screenshots-git-reviewer.png +0 -0
- package/assets/screenshots/screenshots-import.png +0 -0
- package/assets/screenshots/screenshots-worktree-tool.png +0 -0
- package/assets/screenshots/screenshots-zh.png +0 -0
- package/cordis.patch.yml +6 -19
- package/lib/client/WorktreeSurface.d.ts.map +1 -1
- package/lib/client/WorktreeSurface.js +5 -4
- package/lib/client/WorktreeSurface.js.map +1 -1
- package/lib/client/command-activity.d.ts +11 -0
- package/lib/client/command-activity.d.ts.map +1 -0
- package/lib/client/command-activity.js +71 -0
- package/lib/client/command-activity.js.map +1 -0
- package/lib/client/dashboard/DashboardRequest.d.ts +2 -1
- package/lib/client/dashboard/DashboardRequest.d.ts.map +1 -1
- package/lib/client/dashboard/DashboardRequest.js +3 -3
- package/lib/client/dashboard/DashboardRequest.js.map +1 -1
- package/lib/client/dashboard/WorktreeDashboard.d.ts +2 -1
- package/lib/client/dashboard/WorktreeDashboard.d.ts.map +1 -1
- package/lib/client/dashboard/WorktreeDashboard.js +48 -24
- package/lib/client/dashboard/WorktreeDashboard.js.map +1 -1
- package/lib/client/dashboard/WorktreeInstructions.d.ts +2 -1
- package/lib/client/dashboard/WorktreeInstructions.d.ts.map +1 -1
- package/lib/client/dashboard/WorktreeInstructions.js +27 -8
- package/lib/client/dashboard/WorktreeInstructions.js.map +1 -1
- package/lib/client/dashboard/dashboard-overlay.d.ts.map +1 -1
- package/lib/client/dashboard/dashboard-overlay.js +38 -52
- package/lib/client/dashboard/dashboard-overlay.js.map +1 -1
- package/lib/client/dashboard/dashboard-selection.d.ts +1 -0
- package/lib/client/dashboard/dashboard-selection.d.ts.map +1 -1
- package/lib/client/dashboard/dashboard-selection.js.map +1 -1
- package/lib/client/dashboard/git/WorktreeGitPanel.d.ts +2 -1
- package/lib/client/dashboard/git/WorktreeGitPanel.d.ts.map +1 -1
- package/lib/client/dashboard/git/WorktreeGitPanel.js +54 -8
- package/lib/client/dashboard/git/WorktreeGitPanel.js.map +1 -1
- package/lib/client/dashboard/git/file-address.d.ts +2 -1
- package/lib/client/dashboard/git/file-address.d.ts.map +1 -1
- package/lib/client/dashboard/git/file-address.js +8 -13
- package/lib/client/dashboard/git/file-address.js.map +1 -1
- package/lib/client/dashboard/git/useWorktreeGitState.d.ts.map +1 -1
- package/lib/client/dashboard/git/useWorktreeGitState.js +4 -1
- package/lib/client/dashboard/git/useWorktreeGitState.js.map +1 -1
- package/lib/client/dsh-icons.d.ts +2 -0
- package/lib/client/dsh-icons.d.ts.map +1 -1
- package/lib/client/dsh-icons.js +3 -1
- package/lib/client/dsh-icons.js.map +1 -1
- package/lib/client/dsh-slot-contract.d.ts +9 -1
- package/lib/client/dsh-slot-contract.d.ts.map +1 -1
- package/lib/client/entry.d.ts.map +1 -1
- package/lib/client/entry.js +39 -2
- package/lib/client/entry.js.map +1 -1
- package/lib/client/layout/app-frame.d.ts +12 -0
- package/lib/client/layout/app-frame.d.ts.map +1 -0
- package/lib/client/layout/app-frame.js +82 -0
- package/lib/client/layout/app-frame.js.map +1 -0
- package/lib/client/locales.d.ts +144 -0
- package/lib/client/locales.d.ts.map +1 -1
- package/lib/client/locales.js +204 -60
- package/lib/client/locales.js.map +1 -1
- package/lib/client/overlay/overlay-bounds.d.ts.map +1 -1
- package/lib/client/overlay/overlay-bounds.js +8 -3
- package/lib/client/overlay/overlay-bounds.js.map +1 -1
- package/lib/client/overlay/sidebar-overlay-geometry.d.ts +3 -1
- package/lib/client/overlay/sidebar-overlay-geometry.d.ts.map +1 -1
- package/lib/client/overlay/sidebar-overlay-geometry.js +94 -34
- package/lib/client/overlay/sidebar-overlay-geometry.js.map +1 -1
- package/lib/client/restart-notice.d.ts +10 -3
- package/lib/client/restart-notice.d.ts.map +1 -1
- package/lib/client/restart-notice.js +44 -11
- package/lib/client/restart-notice.js.map +1 -1
- package/lib/client/session/session-view.d.ts +16 -2
- package/lib/client/session/session-view.d.ts.map +1 -1
- package/lib/client/session/session-view.js +24 -10
- package/lib/client/session/session-view.js.map +1 -1
- package/lib/client/session/worktree-session.d.ts +1 -0
- package/lib/client/session/worktree-session.d.ts.map +1 -1
- package/lib/client/session/worktree-session.js +3 -1
- package/lib/client/session/worktree-session.js.map +1 -1
- package/lib/client/settings/ToolSettings.d.ts +9 -0
- package/lib/client/settings/ToolSettings.d.ts.map +1 -0
- package/lib/client/settings/ToolSettings.js +77 -0
- package/lib/client/settings/ToolSettings.js.map +1 -0
- package/lib/client/settings/WorktreeSettings.d.ts +8 -0
- package/lib/client/settings/WorktreeSettings.d.ts.map +1 -0
- package/lib/client/settings/WorktreeSettings.js +46 -0
- package/lib/client/settings/WorktreeSettings.js.map +1 -0
- package/lib/client/settings/WorktreeSettingsNavIcon.d.ts +6 -0
- package/lib/client/settings/WorktreeSettingsNavIcon.d.ts.map +1 -0
- package/lib/client/settings/WorktreeSettingsNavIcon.js +51 -0
- package/lib/client/settings/WorktreeSettingsNavIcon.js.map +1 -0
- package/lib/client/settings/diagnostics.d.ts +24 -0
- package/lib/client/settings/diagnostics.d.ts.map +1 -0
- package/lib/client/settings/diagnostics.js +63 -0
- package/lib/client/settings/diagnostics.js.map +1 -0
- package/lib/client/settings/settings-navigation.d.ts +7 -0
- package/lib/client/settings/settings-navigation.d.ts.map +1 -0
- package/lib/client/settings/settings-navigation.js +12 -0
- package/lib/client/settings/settings-navigation.js.map +1 -0
- package/lib/client/surface/actions/useLifecycleActions.d.ts +2 -1
- package/lib/client/surface/actions/useLifecycleActions.d.ts.map +1 -1
- package/lib/client/surface/actions/useLifecycleActions.js +14 -5
- package/lib/client/surface/actions/useLifecycleActions.js.map +1 -1
- package/lib/client/surface/actions/useSessionActions.d.ts.map +1 -1
- package/lib/client/surface/actions/useSessionActions.js +6 -6
- package/lib/client/surface/actions/useSessionActions.js.map +1 -1
- package/lib/client/surface/actions/useWorktreeRegistration.d.ts.map +1 -1
- package/lib/client/surface/actions/useWorktreeRegistration.js +4 -2
- package/lib/client/surface/actions/useWorktreeRegistration.js.map +1 -1
- package/lib/client/surface/components/NotificationToasts.d.ts +19 -3
- package/lib/client/surface/components/NotificationToasts.d.ts.map +1 -1
- package/lib/client/surface/components/NotificationToasts.js +73 -7
- package/lib/client/surface/components/NotificationToasts.js.map +1 -1
- package/lib/client/surface/components/OverlayScrollbar.d.ts +6 -0
- package/lib/client/surface/components/OverlayScrollbar.d.ts.map +1 -0
- package/lib/client/surface/components/OverlayScrollbar.js +84 -0
- package/lib/client/surface/components/OverlayScrollbar.js.map +1 -0
- package/lib/client/surface/components/RestartToast.d.ts.map +1 -1
- package/lib/client/surface/components/RestartToast.js +4 -3
- package/lib/client/surface/components/RestartToast.js.map +1 -1
- package/lib/client/surface/components/SurfaceContent.d.ts.map +1 -1
- package/lib/client/surface/components/SurfaceContent.js +110 -39
- package/lib/client/surface/components/SurfaceContent.js.map +1 -1
- package/lib/client/surface/components/WorkspaceTree.d.ts.map +1 -1
- package/lib/client/surface/components/WorkspaceTree.js +2 -1
- package/lib/client/surface/components/WorkspaceTree.js.map +1 -1
- package/lib/client/surface/components/dialogs.d.ts.map +1 -1
- package/lib/client/surface/components/dialogs.js +14 -10
- package/lib/client/surface/components/dialogs.js.map +1 -1
- package/lib/client/surface/components/rows.d.ts +1 -1
- package/lib/client/surface/components/rows.d.ts.map +1 -1
- package/lib/client/surface/components/rows.js +15 -97
- package/lib/client/surface/components/rows.js.map +1 -1
- package/lib/client/surface/notification-queue.d.ts +15 -0
- package/lib/client/surface/notification-queue.d.ts.map +1 -1
- package/lib/client/surface/notification-queue.js +13 -2
- package/lib/client/surface/notification-queue.js.map +1 -1
- package/lib/client/surface/state/useSurfaceRefresh.d.ts +1 -1
- package/lib/client/surface/state/useSurfaceRefresh.d.ts.map +1 -1
- package/lib/client/surface/state/useSurfaceRefresh.js +13 -1
- package/lib/client/surface/state/useSurfaceRefresh.js.map +1 -1
- package/lib/client/surface/state/useSurfaceSources.d.ts +1 -1
- package/lib/client/surface/state/useSurfaceSources.d.ts.map +1 -1
- package/lib/client/surface/state/useSurfaceSources.js +4 -2
- package/lib/client/surface/state/useSurfaceSources.js.map +1 -1
- package/lib/client/surface/state/useTitleMarquee.d.ts +7 -0
- package/lib/client/surface/state/useTitleMarquee.d.ts.map +1 -0
- package/lib/client/surface/state/useTitleMarquee.js +60 -0
- package/lib/client/surface/state/useTitleMarquee.js.map +1 -0
- package/lib/client/surface/types.d.ts +8 -1
- package/lib/client/surface/types.d.ts.map +1 -1
- package/lib/client/view/worktree-error-copy.d.ts.map +1 -1
- package/lib/client/view/worktree-error-copy.js +69 -14
- package/lib/client/view/worktree-error-copy.js.map +1 -1
- package/lib/client/view/worktree-view-errors.d.ts.map +1 -1
- package/lib/client/view/worktree-view-errors.js +13 -5
- package/lib/client/view/worktree-view-errors.js.map +1 -1
- package/lib/client/worktree-connection.d.ts +6 -2
- package/lib/client/worktree-connection.d.ts.map +1 -1
- package/lib/client/worktree-connection.js +6 -0
- package/lib/client/worktree-connection.js.map +1 -1
- package/lib/client/worktree-tool-changes.d.ts +13 -0
- package/lib/client/worktree-tool-changes.d.ts.map +1 -0
- package/lib/client/worktree-tool-changes.js +64 -0
- package/lib/client/worktree-tool-changes.js.map +1 -0
- package/lib/client.js +2188 -947
- package/lib/client.js.map +1 -1
- package/lib/contract/index.d.ts +11 -1
- package/lib/contract/index.d.ts.map +1 -1
- package/lib/contract/index.js +9 -0
- package/lib/contract/index.js.map +1 -1
- package/lib/contract/tool-settings.d.ts +28 -0
- package/lib/contract/tool-settings.d.ts.map +1 -0
- package/lib/contract/tool-settings.js +10 -0
- package/lib/contract/tool-settings.js.map +1 -0
- package/lib/contract/worktree-tool-changes.d.ts +10 -0
- package/lib/contract/worktree-tool-changes.d.ts.map +1 -0
- package/lib/contract/worktree-tool-changes.js +2 -0
- package/lib/contract/worktree-tool-changes.js.map +1 -0
- package/lib/host/permission-preset-append.d.ts +15 -0
- package/lib/host/permission-preset-append.d.ts.map +1 -0
- package/lib/host/permission-preset-append.js +63 -0
- package/lib/host/permission-preset-append.js.map +1 -0
- package/lib/host/service.d.ts +17 -0
- package/lib/host/service.d.ts.map +1 -1
- package/lib/host/service.js +67 -11
- package/lib/host/service.js.map +1 -1
- package/lib/host/tool-settings.d.ts +14 -0
- package/lib/host/tool-settings.d.ts.map +1 -0
- package/lib/host/tool-settings.js +98 -0
- package/lib/host/tool-settings.js.map +1 -0
- package/lib/host/worktree-permission-manager.d.ts.map +1 -1
- package/lib/host/worktree-permission-manager.js +2 -4
- package/lib/host/worktree-permission-manager.js.map +1 -1
- package/lib/host/worktree-tool-changes.d.ts +12 -0
- package/lib/host/worktree-tool-changes.d.ts.map +1 -0
- package/lib/host/worktree-tool-changes.js +60 -0
- package/lib/host/worktree-tool-changes.js.map +1 -0
- package/lib/manage/manager-git-history.d.ts.map +1 -1
- package/lib/manage/manager-git-history.js +29 -28
- package/lib/manage/manager-git-history.js.map +1 -1
- package/lib/manage/manager-sessions.d.ts +5 -0
- package/lib/manage/manager-sessions.d.ts.map +1 -1
- package/lib/manage/manager-sessions.js +34 -11
- package/lib/manage/manager-sessions.js.map +1 -1
- package/lib/manage/manager-support.d.ts +3 -1
- package/lib/manage/manager-support.d.ts.map +1 -1
- package/lib/manage/manager-support.js +17 -0
- package/lib/manage/manager-support.js.map +1 -1
- package/lib/manage/manager-worktree-lifecycle.d.ts.map +1 -1
- package/lib/manage/manager-worktree-lifecycle.js +5 -4
- package/lib/manage/manager-worktree-lifecycle.js.map +1 -1
- package/lib/manage/manager-worktrees.d.ts +1 -0
- package/lib/manage/manager-worktrees.d.ts.map +1 -1
- package/lib/manage/manager-worktrees.js +74 -22
- package/lib/manage/manager-worktrees.js.map +1 -1
- package/lib/manage/manager.d.ts +10 -0
- package/lib/manage/manager.d.ts.map +1 -1
- package/lib/manage/manager.js +12 -1
- package/lib/manage/manager.js.map +1 -1
- package/lib/manage/types.d.ts +10 -1
- package/lib/manage/types.d.ts.map +1 -1
- package/lib/provider/generated-name.d.ts.map +1 -1
- package/lib/provider/generated-name.js +5 -4
- package/lib/provider/generated-name.js.map +1 -1
- package/lib/provider/git/adapter.d.ts.map +1 -1
- package/lib/provider/git/adapter.js +5 -2
- package/lib/provider/git/adapter.js.map +1 -1
- package/lib/provider/mutation-token.d.ts +1 -1
- package/lib/provider/mutation-token.d.ts.map +1 -1
- package/lib/provider/mutation-token.js +1 -0
- package/lib/provider/mutation-token.js.map +1 -1
- package/lib/provider/sidecar/repository.d.ts.map +1 -1
- package/lib/provider/sidecar/repository.js +1 -0
- package/lib/provider/sidecar/repository.js.map +1 -1
- package/lib/provider/sidecar/sidecar-schema.d.ts.map +1 -1
- package/lib/provider/sidecar/sidecar-schema.js +24 -4
- package/lib/provider/sidecar/sidecar-schema.js.map +1 -1
- package/lib/provider/transaction/operations/adopt-branch.d.ts.map +1 -1
- package/lib/provider/transaction/operations/adopt-branch.js +6 -5
- package/lib/provider/transaction/operations/adopt-branch.js.map +1 -1
- package/lib/provider/transaction/operations/clean.d.ts.map +1 -1
- package/lib/provider/transaction/operations/clean.js +20 -19
- package/lib/provider/transaction/operations/clean.js.map +1 -1
- package/lib/provider/transaction/operations/create.d.ts +1 -1
- package/lib/provider/transaction/operations/create.d.ts.map +1 -1
- package/lib/provider/transaction/operations/create.js +23 -13
- package/lib/provider/transaction/operations/create.js.map +1 -1
- package/lib/provider/transaction/operations/import.d.ts.map +1 -1
- package/lib/provider/transaction/operations/import.js +7 -1
- package/lib/provider/transaction/operations/import.js.map +1 -1
- package/lib/provider/transaction/operations/remove.d.ts.map +1 -1
- package/lib/provider/transaction/operations/remove.js +20 -19
- package/lib/provider/transaction/operations/remove.js.map +1 -1
- package/lib/provider/transaction/recovery/failure-recovery.d.ts.map +1 -1
- package/lib/provider/transaction/recovery/failure-recovery.js +19 -18
- package/lib/provider/transaction/recovery/failure-recovery.js.map +1 -1
- package/lib/provider/transaction/recovery/recover.d.ts.map +1 -1
- package/lib/provider/transaction/recovery/recover.js +6 -2
- package/lib/provider/transaction/recovery/recover.js.map +1 -1
- package/lib/provider/transaction/support/inspection.d.ts.map +1 -1
- package/lib/provider/transaction/support/inspection.js +3 -2
- package/lib/provider/transaction/support/inspection.js.map +1 -1
- package/lib/provider/transaction/support/journal.d.ts.map +1 -1
- package/lib/provider/transaction/support/journal.js +8 -5
- package/lib/provider/transaction/support/journal.js.map +1 -1
- package/lib/provider/transaction/support/path-safety.d.ts.map +1 -1
- package/lib/provider/transaction/support/path-safety.js +4 -3
- package/lib/provider/transaction/support/path-safety.js.map +1 -1
- package/lib/provider/transaction/types.d.ts +2 -1
- package/lib/provider/transaction/types.d.ts.map +1 -1
- package/lib/provider/types.d.ts +3 -1
- package/lib/provider/types.d.ts.map +1 -1
- package/lib/provider/types.js +1 -1
- package/lib/provider/types.js.map +1 -1
- package/lib/provider/worktree-path.d.ts +10 -0
- package/lib/provider/worktree-path.d.ts.map +1 -0
- package/lib/provider/worktree-path.js +47 -0
- package/lib/provider/worktree-path.js.map +1 -0
- package/lib/tool/context.d.ts +14 -0
- package/lib/tool/context.d.ts.map +1 -0
- package/lib/tool/context.js +95 -0
- package/lib/tool/context.js.map +1 -0
- package/lib/tool/delegation.d.ts +41 -0
- package/lib/tool/delegation.d.ts.map +1 -0
- package/lib/tool/delegation.js +196 -0
- package/lib/tool/delegation.js.map +1 -0
- package/lib/tool/errors.d.ts +3 -0
- package/lib/tool/errors.d.ts.map +1 -0
- package/lib/tool/errors.js +63 -0
- package/lib/tool/errors.js.map +1 -0
- package/lib/tool/guidance.d.ts +5 -0
- package/lib/tool/guidance.d.ts.map +1 -0
- package/lib/tool/guidance.js +48 -0
- package/lib/tool/guidance.js.map +1 -0
- package/lib/tool/history.d.ts +27 -0
- package/lib/tool/history.d.ts.map +1 -0
- package/lib/tool/history.js +157 -0
- package/lib/tool/history.js.map +1 -0
- package/lib/tool/index.d.ts +8 -0
- package/lib/tool/index.d.ts.map +1 -0
- package/lib/tool/index.js +296 -0
- package/lib/tool/index.js.map +1 -0
- package/lib/tool/inputs.d.ts +12 -0
- package/lib/tool/inputs.d.ts.map +1 -0
- package/lib/tool/inputs.js +24 -0
- package/lib/tool/inputs.js.map +1 -0
- package/lib/tool/list-models.d.ts +3 -0
- package/lib/tool/list-models.d.ts.map +1 -0
- package/lib/tool/list-models.js +38 -0
- package/lib/tool/list-models.js.map +1 -0
- package/lib/tool/list-sessions.d.ts +3 -0
- package/lib/tool/list-sessions.d.ts.map +1 -0
- package/lib/tool/list-sessions.js +70 -0
- package/lib/tool/list-sessions.js.map +1 -0
- package/lib/tool/list-worktrees.d.ts +3 -0
- package/lib/tool/list-worktrees.d.ts.map +1 -0
- package/lib/tool/list-worktrees.js +39 -0
- package/lib/tool/list-worktrees.js.map +1 -0
- package/lib/tool/native-session.d.ts +74 -0
- package/lib/tool/native-session.d.ts.map +1 -0
- package/lib/tool/native-session.js +248 -0
- package/lib/tool/native-session.js.map +1 -0
- package/lib/tool/new-worktree.d.ts +3 -0
- package/lib/tool/new-worktree.d.ts.map +1 -0
- package/lib/tool/new-worktree.js +81 -0
- package/lib/tool/new-worktree.js.map +1 -0
- package/lib/tool/outputs.d.ts +50 -0
- package/lib/tool/outputs.d.ts.map +1 -0
- package/lib/tool/outputs.js +65 -0
- package/lib/tool/outputs.js.map +1 -0
- package/lib/tool/report-result.d.ts +3 -0
- package/lib/tool/report-result.d.ts.map +1 -0
- package/lib/tool/report-result.js +83 -0
- package/lib/tool/report-result.js.map +1 -0
- package/lib/tool/schema.d.ts +7 -0
- package/lib/tool/schema.d.ts.map +1 -0
- package/lib/tool/schema.js +92 -0
- package/lib/tool/schema.js.map +1 -0
- package/lib/tool/send-message.d.ts +3 -0
- package/lib/tool/send-message.d.ts.map +1 -0
- package/lib/tool/send-message.js +64 -0
- package/lib/tool/send-message.js.map +1 -0
- package/lib/tool/span-worktree.d.ts +3 -0
- package/lib/tool/span-worktree.d.ts.map +1 -0
- package/lib/tool/span-worktree.js +114 -0
- package/lib/tool/span-worktree.js.map +1 -0
- package/lib/tool/types.d.ts +54 -0
- package/lib/tool/types.d.ts.map +1 -0
- package/lib/tool/types.js +2 -0
- package/lib/tool/types.js.map +1 -0
- package/lib/typert.host.js +215 -44
- package/lib/typert.remote-client.d.ts +7 -1
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +215 -44
- package/package.json +14 -2
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { CommandDefinitionId } from '@deepseek-ai/dsh-commands/brand';
|
|
2
|
+
import { WORKTREE_TOOL_IDS } from '../contract/tool-settings.js';
|
|
3
|
+
import { authorize, available } from './context.js';
|
|
4
|
+
import { toolWorkspace, createToolContext } from './context.js';
|
|
5
|
+
import { registerNewWorktree } from './new-worktree.js';
|
|
6
|
+
import { registerListWorktrees } from './list-worktrees.js';
|
|
7
|
+
import { registerSpanWorktree } from './span-worktree.js';
|
|
8
|
+
import { registerListModels } from './list-models.js';
|
|
9
|
+
import { registerListSessions } from './list-sessions.js';
|
|
10
|
+
import { registerSendMessage } from './send-message.js';
|
|
11
|
+
import { registerReportResult } from './report-result.js';
|
|
12
|
+
import { registerToolGuidance } from './guidance.js';
|
|
13
|
+
import { actionableError } from './errors.js';
|
|
14
|
+
import { toolParameters } from './schema.js';
|
|
15
|
+
import { DelegationControl } from './delegation.js';
|
|
16
|
+
const jsonProjection = (value) => JSON.parse(JSON.stringify(value));
|
|
17
|
+
export { createWorktreeToolSessionPort } from './native-session.js';
|
|
18
|
+
export { readToolSession } from './history.js';
|
|
19
|
+
/** Registrations and reporting destinations are runtime-only and Agent-scoped. */
|
|
20
|
+
export async function registerWorktreeTools(ctx, options) {
|
|
21
|
+
const enabled = new Map();
|
|
22
|
+
const delegation = new DelegationControl();
|
|
23
|
+
const lifetime = new AbortController();
|
|
24
|
+
ctx.effect(() => async () => {
|
|
25
|
+
lifetime.abort(new Error('Worktree plugin is disposed'));
|
|
26
|
+
delegation.clear();
|
|
27
|
+
await Promise.all([...enabled.values()].map(({ fiber }) => fiber.dispose()));
|
|
28
|
+
enabled.clear();
|
|
29
|
+
}, 'clutch-dsh-worktree: scoped tool cleanup');
|
|
30
|
+
ctx.on('agent/disposed', async ({ agent }) => {
|
|
31
|
+
const state = enabled.get(agent);
|
|
32
|
+
delegation.dispose(agent);
|
|
33
|
+
enabled.delete(agent);
|
|
34
|
+
await state?.fiber.dispose();
|
|
35
|
+
}, { global: true });
|
|
36
|
+
ctx.on('session/event', (session, event) => delegation.event(session.id, event), { global: true });
|
|
37
|
+
const enable = async (agent, signal, names, parentSessionId) => {
|
|
38
|
+
signal.throwIfAborted();
|
|
39
|
+
delegation.assertAlive(agent);
|
|
40
|
+
if (lifetime.signal.aborted || options.isDisposed())
|
|
41
|
+
throw new Error('Worktree plugin is disposed');
|
|
42
|
+
await toolWorkspace(agent.session.id, options);
|
|
43
|
+
signal.throwIfAborted();
|
|
44
|
+
delegation.assertAlive(agent);
|
|
45
|
+
const existing = enabled.get(agent);
|
|
46
|
+
if (existing) {
|
|
47
|
+
await existing.fiber;
|
|
48
|
+
signal.throwIfAborted();
|
|
49
|
+
lifetime.signal.throwIfAborted();
|
|
50
|
+
delegation.assertAlive(agent);
|
|
51
|
+
return existing.add(names, parentSessionId);
|
|
52
|
+
}
|
|
53
|
+
const state = { names: new Set(), parentSessionId };
|
|
54
|
+
const fiber = agent.ctx.inject(['tools', 'systemPrompt'], (scoped) => {
|
|
55
|
+
const scopeLifetime = new AbortController();
|
|
56
|
+
scoped.effect(() => () => scopeLifetime.abort(new Error('Calling Agent is disposed')), 'clutch-dsh-worktree: scoped cancellation');
|
|
57
|
+
const registry = scoped.get('tools');
|
|
58
|
+
const check = (exec) => {
|
|
59
|
+
exec.signal.throwIfAborted();
|
|
60
|
+
if (lifetime.signal.aborted || scopeLifetime.signal.aborted || options.isDisposed())
|
|
61
|
+
throw new Error('Worktree plugin or calling Agent is disposed');
|
|
62
|
+
if (exec.agent !== agent)
|
|
63
|
+
throw new Error('Use /cluworktree in the calling Session first');
|
|
64
|
+
};
|
|
65
|
+
let transaction = [];
|
|
66
|
+
const add = (name, description, schema, outputSchema, execute) => {
|
|
67
|
+
const dispose = registry.register({
|
|
68
|
+
name,
|
|
69
|
+
description,
|
|
70
|
+
parameters: jsonProjection(toolParameters(schema)),
|
|
71
|
+
output: {
|
|
72
|
+
schema: outputSchema,
|
|
73
|
+
render: (_args, value) => [{ type: 'text', text: JSON.stringify(value) }],
|
|
74
|
+
},
|
|
75
|
+
execute: async (args, exec) => {
|
|
76
|
+
const execution = {
|
|
77
|
+
...exec,
|
|
78
|
+
signal: AbortSignal.any([exec.signal, lifetime.signal, scopeLifetime.signal]),
|
|
79
|
+
};
|
|
80
|
+
try {
|
|
81
|
+
check(execution);
|
|
82
|
+
return jsonProjection(await execute(schema.parse(args), execution));
|
|
83
|
+
}
|
|
84
|
+
catch (cause) {
|
|
85
|
+
execution.signal.throwIfAborted();
|
|
86
|
+
throw actionableError(name, cause);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
transaction.push(dispose);
|
|
91
|
+
return dispose;
|
|
92
|
+
};
|
|
93
|
+
const context = createToolContext(agent, options, check, add, delegation);
|
|
94
|
+
delegation.register(agent);
|
|
95
|
+
scoped.effect(() => () => {
|
|
96
|
+
delegation.release(agent);
|
|
97
|
+
if (enabled.get(agent) === state)
|
|
98
|
+
enabled.delete(agent);
|
|
99
|
+
}, 'clutch-dsh-worktree: token cleanup');
|
|
100
|
+
context.enableChild = async (sessionId, requestId, prompt, mode, exec) => {
|
|
101
|
+
check(exec);
|
|
102
|
+
const child = await options.sessions.resolveAgent(sessionId, exec.signal);
|
|
103
|
+
// Initialize the scope before installing a task-bound reporting handler.
|
|
104
|
+
await enable(child, exec.signal, []);
|
|
105
|
+
delegation.prepareTask(agent, child, requestId, prompt, mode);
|
|
106
|
+
await enable(child, exec.signal, ['clutch_report_result'], agent.session.id);
|
|
107
|
+
await autoEnable(child, exec.signal);
|
|
108
|
+
check(exec);
|
|
109
|
+
};
|
|
110
|
+
context.prepareMessage = async (sessionId, requestId, prompt, mode, exec, retry) => {
|
|
111
|
+
delegation.assertDispatch(agent, sessionId);
|
|
112
|
+
if (retry)
|
|
113
|
+
delegation.assertRetry(requestId);
|
|
114
|
+
if (delegation.child(agent, sessionId))
|
|
115
|
+
await context.enableChild(sessionId, requestId, prompt, mode, exec);
|
|
116
|
+
else {
|
|
117
|
+
const target = await options.sessions.resolveAgent(sessionId, exec.signal);
|
|
118
|
+
await enable(target, exec.signal, []);
|
|
119
|
+
delegation.trackMessage(agent, sessionId, requestId, prompt, mode);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const registrations = {
|
|
123
|
+
clutch_new_worktree: registerNewWorktree,
|
|
124
|
+
clutch_list_worktrees: registerListWorktrees,
|
|
125
|
+
clutch_span_worktree: registerSpanWorktree,
|
|
126
|
+
clutch_list_models: registerListModels,
|
|
127
|
+
clutch_list_sessions: registerListSessions,
|
|
128
|
+
clutch_send_message: registerSendMessage,
|
|
129
|
+
};
|
|
130
|
+
registerToolGuidance(scoped, () => state.names, () => state.parentSessionId);
|
|
131
|
+
state.add = (requested, parent) => {
|
|
132
|
+
const missing = requested.filter((name) => !state.names.has(name));
|
|
133
|
+
if (!missing.length)
|
|
134
|
+
return 0;
|
|
135
|
+
transaction = [];
|
|
136
|
+
const previousParent = state.parentSessionId;
|
|
137
|
+
try {
|
|
138
|
+
if (parent !== undefined)
|
|
139
|
+
state.parentSessionId = parent;
|
|
140
|
+
for (const name of missing) {
|
|
141
|
+
if (name === 'clutch_report_result')
|
|
142
|
+
registerReportResult(context);
|
|
143
|
+
else
|
|
144
|
+
registrations[name](context);
|
|
145
|
+
}
|
|
146
|
+
for (const name of missing)
|
|
147
|
+
state.names.add(name);
|
|
148
|
+
return missing.length;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
for (const dispose of transaction.reverse())
|
|
152
|
+
dispose();
|
|
153
|
+
state.parentSessionId = previousParent;
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
state.fiber = fiber;
|
|
159
|
+
enabled.set(agent, state);
|
|
160
|
+
try {
|
|
161
|
+
await fiber;
|
|
162
|
+
signal.throwIfAborted();
|
|
163
|
+
if (lifetime.signal.aborted || options.isDisposed())
|
|
164
|
+
throw new Error('Worktree plugin is disposed');
|
|
165
|
+
delegation.assertAlive(agent);
|
|
166
|
+
return state.add(names, parentSessionId);
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
enabled.delete(agent);
|
|
170
|
+
delegation.release(agent);
|
|
171
|
+
await fiber.dispose();
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
/** Bindings may follow agent creation; resolve preferences at prompt assembly. */
|
|
176
|
+
const autoEnable = async (agent, signal) => {
|
|
177
|
+
if (!options.settings)
|
|
178
|
+
return 0;
|
|
179
|
+
const workspaceId = await toolWorkspace(agent.session.id, options);
|
|
180
|
+
const bindings = (await options.manager.listBindings({ workspaceId })).filter((binding) => binding.sessionId === agent.session.id);
|
|
181
|
+
if (bindings.length > 1)
|
|
182
|
+
return 0;
|
|
183
|
+
const binding = bindings[0];
|
|
184
|
+
let scope;
|
|
185
|
+
if (binding) {
|
|
186
|
+
if (binding.status !== 'active')
|
|
187
|
+
return 0;
|
|
188
|
+
const record = (await options.manager.listWorktrees({ workspaceId })).find((item) => item.worktreeId === binding.worktreeId);
|
|
189
|
+
if (!record || !available(record))
|
|
190
|
+
return 0;
|
|
191
|
+
scope = { kind: 'worktree', workspaceId, worktreeId: record.worktreeId };
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
scope = { kind: 'local', workspaceId };
|
|
195
|
+
}
|
|
196
|
+
let selection;
|
|
197
|
+
try {
|
|
198
|
+
selection = await options.settings.read(scope);
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
// Damaged preferences must not block ordinary native Session execution.
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
if (!selection.enabled)
|
|
205
|
+
return 0;
|
|
206
|
+
await authorize(agent.session.id, workspaceId, options, true);
|
|
207
|
+
return enable(agent, signal, selection.tools);
|
|
208
|
+
};
|
|
209
|
+
const freshAssembly = Symbol('clutch-worktree: fresh prompt assembly');
|
|
210
|
+
ctx.on('system-prompt/assemble', async (_assembly, context, next) => {
|
|
211
|
+
if (context[freshAssembly] || !options.settings ||
|
|
212
|
+
lifetime.signal.aborted || options.isDisposed())
|
|
213
|
+
return next();
|
|
214
|
+
const candidate = context.agent ?? context.scope;
|
|
215
|
+
if (candidate === null || typeof candidate !== 'object' ||
|
|
216
|
+
!('session' in candidate) || !('ctx' in candidate) ||
|
|
217
|
+
context.scope !== candidate)
|
|
218
|
+
return next();
|
|
219
|
+
const agent = candidate;
|
|
220
|
+
const before = enabled.get(agent)?.names.size ?? 0;
|
|
221
|
+
let workspaceId;
|
|
222
|
+
try {
|
|
223
|
+
workspaceId = await toolWorkspace(agent.session.id, options);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
/* Global and unowned Agent assemblies retain their native catalog. */
|
|
227
|
+
}
|
|
228
|
+
if (workspaceId === undefined)
|
|
229
|
+
return next();
|
|
230
|
+
const added = await autoEnable(agent, context.signal ?? lifetime.signal);
|
|
231
|
+
if (!added && (enabled.get(agent)?.names.size ?? 0) === before)
|
|
232
|
+
return next();
|
|
233
|
+
// DSH collects registered providers before this waterfall, and pre-step runs
|
|
234
|
+
// after assemble(). Rebuild once so both the SDK and guidance reach request 1.
|
|
235
|
+
// The marker belongs to this invocation; concurrent assemblies are independent.
|
|
236
|
+
const prompt = ctx.get('systemPrompt');
|
|
237
|
+
return prompt.assemble({ ...context, [freshAssembly]: true });
|
|
238
|
+
}, { prepend: true });
|
|
239
|
+
const commands = ctx.get('commands');
|
|
240
|
+
let unregister;
|
|
241
|
+
const syncCommand = (active) => {
|
|
242
|
+
if (lifetime.signal.aborted || options.isDisposed())
|
|
243
|
+
return;
|
|
244
|
+
if (!active) {
|
|
245
|
+
unregister?.();
|
|
246
|
+
unregister = undefined;
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (unregister)
|
|
250
|
+
return;
|
|
251
|
+
unregister = commands.register({
|
|
252
|
+
definitionId: CommandDefinitionId('@cerbur/clutch-dsh-worktree:cluworktree'),
|
|
253
|
+
name: 'cluworktree',
|
|
254
|
+
description: 'Enable the Worktree capabilities selected in Settings for this conversation',
|
|
255
|
+
handler: async ({ agent, rawInput, signal }) => {
|
|
256
|
+
if (rawInput.trim())
|
|
257
|
+
return { kind: 'error', text: 'Usage: /cluworktree' };
|
|
258
|
+
const selection = options.settings
|
|
259
|
+
? await options.settings.read({ kind: 'general' })
|
|
260
|
+
: { enabled: true, tools: WORKTREE_TOOL_IDS };
|
|
261
|
+
if (!selection.enabled || !selection.tools.length)
|
|
262
|
+
return {
|
|
263
|
+
kind: 'error',
|
|
264
|
+
text: 'Enable Worktree tools in Settings → Worktree → General first.',
|
|
265
|
+
};
|
|
266
|
+
await autoEnable(agent, signal);
|
|
267
|
+
const added = await enable(agent, signal, selection.tools);
|
|
268
|
+
const count = [...enabled.get(agent).names].filter((name) => name !== 'clutch_report_result').length;
|
|
269
|
+
return {
|
|
270
|
+
kind: 'success',
|
|
271
|
+
text: added
|
|
272
|
+
? `Worktree tools enabled for this conversation: ${added} added, ${count} available. Describe the task you want to delegate or isolate.`
|
|
273
|
+
: `Worktree tools are already enabled for this conversation: ${count} available.`,
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
ctx.effect(() => () => unregister?.(), 'clutch-dsh-worktree: command cleanup');
|
|
279
|
+
if (options.settings) {
|
|
280
|
+
ctx.effect(() => options.settings.subscribe((scope, selection) => {
|
|
281
|
+
if (scope.kind === 'general')
|
|
282
|
+
syncCommand(selection.enabled);
|
|
283
|
+
}), 'clutch-dsh-worktree: preferences subscription');
|
|
284
|
+
}
|
|
285
|
+
let active = !options.settings;
|
|
286
|
+
if (options.settings) {
|
|
287
|
+
try {
|
|
288
|
+
active = (await options.settings.read({ kind: 'general' })).enabled;
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
/* Keep command unavailable; native Sessions and result reporting stay usable. */
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
syncCommand(active);
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAuD,MAAM,8BAA8B,CAAC;AACtH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC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,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACtE,CAAC;QAAC,MAAM,CAAC;YACP,iFAAiF;QACnF,CAAC;IACH,CAAC;IACD,WAAW,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const text: z.ZodString;
|
|
3
|
+
export declare const prompt: z.ZodString;
|
|
4
|
+
export declare const model: z.ZodObject<{
|
|
5
|
+
provider: z.ZodString;
|
|
6
|
+
model: z.ZodString;
|
|
7
|
+
reasoningEffort: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export declare const workspace: z.ZodObject<{
|
|
10
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
//# sourceMappingURL=inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/tool/inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,eAAO,MAAM,IAAI,aAA2B,CAAC;AAC7C,eAAO,MAAM,MAAM,aAKhB,CAAC;AACJ,eAAO,MAAM,KAAK;;;;kBAaf,CAAC;AACJ,eAAO,MAAM,SAAS;;kBAQX,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const text = z.string().trim().min(1);
|
|
3
|
+
export const prompt = z
|
|
4
|
+
.string()
|
|
5
|
+
.refine((value) => value.trim().length > 0, 'prompt must not be empty')
|
|
6
|
+
.describe('Required nonempty task/message text, preserved exactly. For delegation include goal, scope, acceptance criteria and checks.');
|
|
7
|
+
export const model = z
|
|
8
|
+
.object({
|
|
9
|
+
provider: text.describe('Exact provider group id returned by clutch_list_models, not its display name.'),
|
|
10
|
+
model: text.describe('Exact model id within that provider, returned by clutch_list_models.'),
|
|
11
|
+
reasoningEffort: text
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Exact supported reasoning effort id for that model; omit to use its default.'),
|
|
14
|
+
})
|
|
15
|
+
.strict()
|
|
16
|
+
.describe('Optional model override as an object {provider, model, reasoningEffort?}, never a string. Omit to inherit the calling Session model and effort.');
|
|
17
|
+
export const workspace = z
|
|
18
|
+
.object({
|
|
19
|
+
workspaceId: text
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Omit to use the calling Session Workspace. If supplied it must be that same Workspace id, not a directory path.'),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
//# sourceMappingURL=inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../src/tool/inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,0BAA0B,CAAC;KACtE,QAAQ,CACP,6HAA6H,CAC9H,CAAC;AACJ,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC;KACnB,MAAM,CAAC;IACN,QAAQ,EAAE,IAAI,CAAC,QAAQ,CACrB,+EAA+E,CAChF;IACD,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,sEAAsE,CAAC;IAC5F,eAAe,EAAE,IAAI;SAClB,QAAQ,EAAE;SACV,QAAQ,CAAC,8EAA8E,CAAC;CAC5F,CAAC;KACD,MAAM,EAAE;KACR,QAAQ,CACP,iJAAiJ,CAClJ,CAAC;AACJ,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC;KACvB,MAAM,CAAC;IACN,WAAW,EAAE,IAAI;SACd,QAAQ,EAAE;SACV,QAAQ,CACP,iHAAiH,CAClH;CACJ,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-models.d.ts","sourceRoot":"","sources":["../../src/tool/list-models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAchD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAgD7D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { text } from './inputs.js';
|
|
3
|
+
import * as output from './outputs.js';
|
|
4
|
+
const listModelsArgs = z
|
|
5
|
+
.object({
|
|
6
|
+
provider: text
|
|
7
|
+
.optional()
|
|
8
|
+
.describe('Optional exact provider group id. Omit to discover available providers; not a model id or display name.'),
|
|
9
|
+
})
|
|
10
|
+
.strict();
|
|
11
|
+
export function registerListModels(context) {
|
|
12
|
+
const { add, agent, options, check, scope } = context;
|
|
13
|
+
add('clutch_list_models', 'Discover native models grouped by provider, with reasoning efforts and provider failures. Optional provider filters the catalog. Returns the current Session model separately from the deployment default.', listModelsArgs, output.object({
|
|
14
|
+
current: output.model,
|
|
15
|
+
default: output.model,
|
|
16
|
+
groups: output.array(output.object({ id: output.string, name: output.string, models: output.array(output.catalogModel) }, ['id', 'name', 'models'])),
|
|
17
|
+
failures: output.array(output.object({ id: output.string, name: output.string, message: output.string }, [
|
|
18
|
+
'id',
|
|
19
|
+
'message',
|
|
20
|
+
])),
|
|
21
|
+
}, ['current', 'default', 'groups', 'failures']), async (args, exec) => {
|
|
22
|
+
await scope();
|
|
23
|
+
const catalog = await options.sessions.modelCatalog();
|
|
24
|
+
const current = await options.sessions.currentModel(agent.session.id, exec.signal);
|
|
25
|
+
check(exec);
|
|
26
|
+
if (args.provider &&
|
|
27
|
+
!catalog.groups.some((group) => group.id === args.provider) &&
|
|
28
|
+
!catalog.failures.some((failure) => failure.id === args.provider))
|
|
29
|
+
throw new Error('Unknown model provider');
|
|
30
|
+
return {
|
|
31
|
+
current,
|
|
32
|
+
default: catalog.default,
|
|
33
|
+
groups: catalog.groups.filter((group) => args.provider === undefined || group.id === args.provider),
|
|
34
|
+
failures: catalog.failures.filter((failure) => args.provider === undefined || failure.id === args.provider),
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=list-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-models.js","sourceRoot":"","sources":["../../src/tool/list-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,CAAC;IACN,QAAQ,EAAE,IAAI;SACX,QAAQ,EAAE;SACV,QAAQ,CACP,yGAAyG,CAC1G;CACJ,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACrD,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IACtD,GAAG,CACD,oBAAoB,EACpB,4MAA4M,EAC5M,cAAc,EACd,MAAM,CAAC,MAAM,CACX;QACE,OAAO,EAAE,MAAM,CAAC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AI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,OAAO;YACL,OAAO;YACP,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAC3B,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,CACrE;YACD,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAC/B,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,CACzE;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-sessions.d.ts","sourceRoot":"","sources":["../../src/tool/list-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAgBhD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAgF/D"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { text, workspace } from './inputs.js';
|
|
2
|
+
import * as output from './outputs.js';
|
|
3
|
+
import { authorize, errorText } from './context.js';
|
|
4
|
+
import { latestToolSessionCursor, readToolSession } from './history.js';
|
|
5
|
+
const listSessionsArgs = workspace
|
|
6
|
+
.extend({
|
|
7
|
+
worktreeId: text
|
|
8
|
+
.optional()
|
|
9
|
+
.describe('Optional stable Worktree id from new/list. Prefer this filter when locating a task’s Sessions.'),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
12
|
+
export function registerListSessions(context) {
|
|
13
|
+
const { add, options, check, scope } = context;
|
|
14
|
+
add('clutch_list_sessions', 'Discover existing Sessions in the calling Workspace, optionally filtered by worktreeId. Returns stable ids, binding state, status and title. These are ordinary Sessions, not a parent/subagent task catalog.', listSessionsArgs, output.object({
|
|
15
|
+
workspaceId: output.string,
|
|
16
|
+
sessions: output.array(output.object({
|
|
17
|
+
sessionId: output.string,
|
|
18
|
+
worktreeId: output.string,
|
|
19
|
+
bindingStatus: output.string,
|
|
20
|
+
cwd: output.string,
|
|
21
|
+
status: output.string,
|
|
22
|
+
title: output.string,
|
|
23
|
+
diagnostic: output.string,
|
|
24
|
+
}, ['sessionId', 'bindingStatus', 'status'])),
|
|
25
|
+
}, ['workspaceId', 'sessions']), async (args, exec) => {
|
|
26
|
+
const workspaceId = await scope(args.workspaceId);
|
|
27
|
+
const bindings = await options.manager.listBindings({ workspaceId });
|
|
28
|
+
if (args.worktreeId !== undefined &&
|
|
29
|
+
!(await options.manager.listWorktrees({ workspaceId })).some((item) => item.worktreeId === args.worktreeId))
|
|
30
|
+
throw new Error('Worktree not found in the calling Workspace');
|
|
31
|
+
const candidates = (await options.dsh.listSessions()).filter((session) => {
|
|
32
|
+
const binding = bindings.find((item) => item.sessionId === session.sessionId);
|
|
33
|
+
return ((session.workspaceId === workspaceId || binding !== undefined) &&
|
|
34
|
+
(session.workspaceId === undefined || session.workspaceId === workspaceId) &&
|
|
35
|
+
(args.worktreeId === undefined || binding?.worktreeId === args.worktreeId));
|
|
36
|
+
});
|
|
37
|
+
const items = [];
|
|
38
|
+
for (const session of candidates) {
|
|
39
|
+
check(exec);
|
|
40
|
+
const binding = bindings.find((item) => item.sessionId === session.sessionId);
|
|
41
|
+
try {
|
|
42
|
+
await authorize(session.sessionId, workspaceId, options);
|
|
43
|
+
const snapshot = await options.sessions.snapshot(session.sessionId, exec.signal);
|
|
44
|
+
check(exec);
|
|
45
|
+
const value = readToolSession(session.sessionId, snapshot, latestToolSessionCursor(session.sessionId, snapshot));
|
|
46
|
+
items.push({
|
|
47
|
+
sessionId: session.sessionId,
|
|
48
|
+
worktreeId: binding?.worktreeId,
|
|
49
|
+
bindingStatus: binding?.status ?? 'main',
|
|
50
|
+
cwd: session.cwd,
|
|
51
|
+
status: value.status,
|
|
52
|
+
title: typeof snapshot.values.title === 'string' ? snapshot.values.title : undefined,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
check(exec);
|
|
57
|
+
items.push({
|
|
58
|
+
sessionId: session.sessionId,
|
|
59
|
+
worktreeId: binding?.worktreeId,
|
|
60
|
+
bindingStatus: binding?.status ?? 'main',
|
|
61
|
+
status: 'unavailable',
|
|
62
|
+
diagnostic: `Cannot inspect this Session: ${errorText(error).slice(0, 500)}. Other Sessions remain available. Repair this Session in DSH; do not repeatedly query the whole list to retry its history migration.`,
|
|
63
|
+
});
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { workspaceId, sessions: items };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=list-sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-sessions.js","sourceRoot":"","sources":["../../src/tool/list-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAExE,MAAM,gBAAgB,GAAG,SAAS;KAC/B,MAAM,CAAC;IACN,UAAU,EAAE,IAAI;SACb,QAAQ,EAAE;SACV,QAAQ,CACP,gGAAgG,CACjG;CACJ,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACvD,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC/C,GAAG,CACD,sBAAsB,EACtB,+MAA+M,EAC/M,gBAAgB,EAChB,MAAM,CA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,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;iBACrF,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,CAAC;gBACZ,KAAK,CAAC,IAAI,CAAC;oBACT,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,UAAU,EAAE,OAAO,EAAE,UAAU;oBAC/B,aAAa,EAAE,OAAO,EAAE,MAAM,IAAI,MAAM;oBACxC,MAAM,EAAE,aAAa;oBACrB,UAAU,EAAE,gCAAgC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,uIAAuI;iBAClN,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;QACH,CAAC;QACD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-worktrees.d.ts","sourceRoot":"","sources":["../../src/tool/list-worktrees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CA+ChE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { workspace } from './inputs.js';
|
|
2
|
+
import * as output from './outputs.js';
|
|
3
|
+
import { errorText } from './context.js';
|
|
4
|
+
export function registerListWorktrees(context) {
|
|
5
|
+
const { add, options, check, scope } = context;
|
|
6
|
+
add('clutch_list_worktrees', 'List managed Worktrees and local base branches in workspaceId, defaulting to the calling Workspace. Returns stable ids, branch, path, lifecycle and health. Another Workspace is rejected.', workspace, output.object({
|
|
7
|
+
workspaceId: output.string,
|
|
8
|
+
worktrees: output.array(output.worktree),
|
|
9
|
+
branches: output.array(output.object({ name: output.string, isCurrent: output.boolean, checkedOut: output.boolean }, ['name', 'isCurrent', 'checkedOut'])),
|
|
10
|
+
branchesUnavailable: output.string,
|
|
11
|
+
}, ['workspaceId', 'worktrees']), async (args, exec) => {
|
|
12
|
+
const workspaceId = await scope(args.workspaceId);
|
|
13
|
+
const records = await options.manager.listWorktrees({ workspaceId });
|
|
14
|
+
let branchFacts;
|
|
15
|
+
try {
|
|
16
|
+
branchFacts = { branches: await options.manager.listBranches({ workspaceId }) };
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
check(exec);
|
|
20
|
+
branchFacts = { branchesUnavailable: errorText(error) };
|
|
21
|
+
}
|
|
22
|
+
check(exec);
|
|
23
|
+
return {
|
|
24
|
+
workspaceId,
|
|
25
|
+
...branchFacts,
|
|
26
|
+
worktrees: records.map((record) => ({
|
|
27
|
+
worktreeId: record.worktreeId,
|
|
28
|
+
branch: record.branch,
|
|
29
|
+
absolutePath: record.absolutePath,
|
|
30
|
+
status: record.status,
|
|
31
|
+
health: record.health,
|
|
32
|
+
diskCleanup: record.diskCleanup,
|
|
33
|
+
baseBranch: record.baseBranch,
|
|
34
|
+
baseCommit: record.baseCommit,
|
|
35
|
+
})),
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=list-worktrees.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-worktrees.js","sourceRoot":"","sources":["../../src/tool/list-worktrees.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,qBAAqB,CAAC,OAAoB;IACxD,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC/C,GAAG,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MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;aAC9B,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { CallingAgent } from './types.js';
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
export interface ToolModel {
|
|
4
|
+
readonly provider: string;
|
|
5
|
+
readonly model: string;
|
|
6
|
+
readonly reasoningEffort?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ToolModelCatalog {
|
|
9
|
+
readonly default: ToolModel;
|
|
10
|
+
readonly groups: readonly {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly models: readonly {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly reasoning?: {
|
|
17
|
+
readonly efforts: readonly {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
}[];
|
|
21
|
+
readonly defaultEffort?: string;
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
}[];
|
|
25
|
+
readonly failures: readonly {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly message: string;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
export interface ToolSessionEvent {
|
|
31
|
+
readonly seq: number;
|
|
32
|
+
readonly time: number;
|
|
33
|
+
readonly type: string;
|
|
34
|
+
readonly data: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface ToolSessionSnapshot {
|
|
37
|
+
readonly events: readonly ToolSessionEvent[];
|
|
38
|
+
readonly running: boolean;
|
|
39
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
40
|
+
readonly error?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Host-only native capabilities; never added to the Provider's read adapter. */
|
|
43
|
+
export interface WorktreeToolSessionPort {
|
|
44
|
+
resolveAgent(sessionId: string, signal: AbortSignal): Promise<CallingAgent>;
|
|
45
|
+
create(input: {
|
|
46
|
+
cwd: string;
|
|
47
|
+
}): Promise<{
|
|
48
|
+
sessionId: string;
|
|
49
|
+
}>;
|
|
50
|
+
prompt(input: {
|
|
51
|
+
sessionId: string;
|
|
52
|
+
requestId: string;
|
|
53
|
+
mode: 'queue' | 'steer';
|
|
54
|
+
content: readonly {
|
|
55
|
+
type: 'text';
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
}, signal: AbortSignal): Promise<{
|
|
59
|
+
accepted: true;
|
|
60
|
+
}>;
|
|
61
|
+
rename(input: {
|
|
62
|
+
sessionId: string;
|
|
63
|
+
title: string;
|
|
64
|
+
}): Promise<unknown>;
|
|
65
|
+
modelCatalog(): Promise<ToolModelCatalog>;
|
|
66
|
+
currentModel(sessionId: string, signal: AbortSignal): Promise<ToolModel>;
|
|
67
|
+
validateModel(model: ToolModel, signal: AbortSignal): Promise<ToolModel>;
|
|
68
|
+
configureModel(sessionId: string, model: ToolModel, signal: AbortSignal): Promise<void>;
|
|
69
|
+
snapshot(sessionId: string, signal: AbortSignal): Promise<ToolSessionSnapshot>;
|
|
70
|
+
subscribe(sessionIds: readonly string[], changed: () => void): () => void;
|
|
71
|
+
}
|
|
72
|
+
/** Native reads stay cold; model routing is installed only on a newly created Agent. */
|
|
73
|
+
export declare function createWorktreeToolSessionPort(ctx: Context): WorktreeToolSessionPort;
|
|
74
|
+
//# sourceMappingURL=native-session.d.ts.map
|