@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 @@
|
|
|
1
|
+
{"version":3,"file":"native-session.d.ts","sourceRoot":"","sources":["../../src/tool/native-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS;QACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,SAAS;YACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YACtB,QAAQ,CAAC,SAAS,CAAC,EAAE;gBACnB,QAAQ,CAAC,OAAO,EAAE,SAAS;oBAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;oBAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA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AA;SAAE,EAAE,CAAC;KACpD,EACD,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC;QAAE,QAAQ,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IAC/B,MAAM,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,YAAY,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1C,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACzE,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACzE,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxF,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC/E,SAAS,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC3E;AAkCD,wFAAwF;AACxF,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,GAAG,uBAAuB,CAoOnF"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
/** Native reads stay cold; model routing is installed only on a newly created Agent. */
|
|
54
|
+
export function createWorktreeToolSessionPort(ctx) {
|
|
55
|
+
const native = ctx;
|
|
56
|
+
const controller = ctx.get('sessionController');
|
|
57
|
+
const errors = new Map();
|
|
58
|
+
const hooks = new Map();
|
|
59
|
+
const questions = new Map();
|
|
60
|
+
const listeners = new Set();
|
|
61
|
+
const notify = (id) => {
|
|
62
|
+
for (const listener of listeners)
|
|
63
|
+
if (listener.ids.has(id))
|
|
64
|
+
listener.changed();
|
|
65
|
+
};
|
|
66
|
+
const disposeQuestions = native.on('user-questions/request', (async (request, next) => {
|
|
67
|
+
const id = request.agent?.session.id;
|
|
68
|
+
if (id === undefined)
|
|
69
|
+
return next();
|
|
70
|
+
questions.set(id, (questions.get(id) ?? 0) + 1);
|
|
71
|
+
notify(id);
|
|
72
|
+
try {
|
|
73
|
+
return await next();
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
const remaining = (questions.get(id) ?? 1) - 1;
|
|
77
|
+
if (remaining === 0)
|
|
78
|
+
questions.delete(id);
|
|
79
|
+
else
|
|
80
|
+
questions.set(id, remaining);
|
|
81
|
+
notify(id);
|
|
82
|
+
}
|
|
83
|
+
}), { global: true });
|
|
84
|
+
const disposeError = native.on('api-session/error', ((id, message) => {
|
|
85
|
+
if (errors.size >= 128)
|
|
86
|
+
errors.delete(errors.keys().next().value);
|
|
87
|
+
errors.set(id, message);
|
|
88
|
+
}), { global: true });
|
|
89
|
+
const disposeStart = native.on('session/event', ((session, event) => {
|
|
90
|
+
if (event.type === 'turn/start')
|
|
91
|
+
errors.delete(session.id);
|
|
92
|
+
}), { global: true });
|
|
93
|
+
ctx.effect(() => () => {
|
|
94
|
+
disposeError();
|
|
95
|
+
disposeStart();
|
|
96
|
+
disposeQuestions();
|
|
97
|
+
for (const dispose of hooks.values())
|
|
98
|
+
dispose();
|
|
99
|
+
hooks.clear();
|
|
100
|
+
errors.clear();
|
|
101
|
+
questions.clear();
|
|
102
|
+
listeners.clear();
|
|
103
|
+
}, 'clutch-dsh-worktree: Session tool routing cleanup');
|
|
104
|
+
const snapshot = async (sessionId, signal) => {
|
|
105
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
106
|
+
try {
|
|
107
|
+
signal.throwIfAborted();
|
|
108
|
+
const observed = __addDisposableResource(env_1, await native.sessionQuery.observeSession(sessionId, { signal }), false);
|
|
109
|
+
signal.throwIfAborted();
|
|
110
|
+
return {
|
|
111
|
+
events: observed.events,
|
|
112
|
+
values: {
|
|
113
|
+
...observed.projections?.values,
|
|
114
|
+
worktreeToolWaitingForUser: questions.has(sessionId),
|
|
115
|
+
},
|
|
116
|
+
running: native.agents.get(sessionId)?.status === 'running',
|
|
117
|
+
...(errors.has(sessionId) ? { error: errors.get(sessionId) } : {}),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (e_1) {
|
|
121
|
+
env_1.error = e_1;
|
|
122
|
+
env_1.hasError = true;
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
__disposeResources(env_1);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
resolveAgent: async (sessionId, signal) => {
|
|
130
|
+
signal.throwIfAborted();
|
|
131
|
+
const result = await controller.resolveAgent(sessionId);
|
|
132
|
+
if ('error' in result)
|
|
133
|
+
throw result.error;
|
|
134
|
+
signal.throwIfAborted();
|
|
135
|
+
return result.agent;
|
|
136
|
+
},
|
|
137
|
+
create: (input) => controller.create(input),
|
|
138
|
+
prompt: (input, signal) => controller.prompt(input, signal),
|
|
139
|
+
rename: (input) => controller.rename(input),
|
|
140
|
+
modelCatalog: () => controller.modelCatalog(),
|
|
141
|
+
snapshot,
|
|
142
|
+
currentModel: async (sessionId, signal) => {
|
|
143
|
+
const value = await snapshot(sessionId, signal);
|
|
144
|
+
const selection = value.values.modelSelection;
|
|
145
|
+
if (selection?.next)
|
|
146
|
+
return { ...selection.next };
|
|
147
|
+
const header = native.agents.get(sessionId)?.session.requestHeader();
|
|
148
|
+
if (header) {
|
|
149
|
+
const { reasoningEffort, ...route } = header.config;
|
|
150
|
+
return {
|
|
151
|
+
provider: route.provider,
|
|
152
|
+
model: route.model,
|
|
153
|
+
...(reasoningEffort === undefined || header.adapterDefaults?.reasoningEffort
|
|
154
|
+
? {}
|
|
155
|
+
: { reasoningEffort }),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return { ...(await controller.modelCatalog()).default };
|
|
159
|
+
},
|
|
160
|
+
validateModel: async (model, signal) => {
|
|
161
|
+
signal.throwIfAborted();
|
|
162
|
+
const catalog = await controller.modelCatalog();
|
|
163
|
+
const entry = catalog.groups
|
|
164
|
+
.find((group) => group.id === model.provider)
|
|
165
|
+
?.models.find((item) => item.id === model.model);
|
|
166
|
+
if (!entry ||
|
|
167
|
+
(model.reasoningEffort !== undefined &&
|
|
168
|
+
!entry.reasoning?.efforts.some((effort) => effort.id === model.reasoningEffort))) {
|
|
169
|
+
throw new Error('Requested model or reasoning effort is unavailable; use clutch_list_models');
|
|
170
|
+
}
|
|
171
|
+
const resolved = await native.llm.resolveCallConfig(model, signal);
|
|
172
|
+
signal.throwIfAborted();
|
|
173
|
+
return {
|
|
174
|
+
provider: resolved.provider,
|
|
175
|
+
model: resolved.model,
|
|
176
|
+
...(resolved.reasoningEffort === undefined
|
|
177
|
+
? {}
|
|
178
|
+
: { reasoningEffort: resolved.reasoningEffort }),
|
|
179
|
+
};
|
|
180
|
+
},
|
|
181
|
+
configureModel: async (sessionId, model, signal) => {
|
|
182
|
+
signal.throwIfAborted();
|
|
183
|
+
const result = await controller.resolveAgent(sessionId);
|
|
184
|
+
if ('error' in result)
|
|
185
|
+
throw result.error;
|
|
186
|
+
signal.throwIfAborted();
|
|
187
|
+
const { agent } = result;
|
|
188
|
+
hooks.get(sessionId)?.();
|
|
189
|
+
// Prepend makes these outer waterfalls: the native model listeners run
|
|
190
|
+
// first, then this creation-only route wins consistently on both surfaces.
|
|
191
|
+
// DSH records the resulting request/header and restores it on cold resume.
|
|
192
|
+
const scoped = agent.ctx;
|
|
193
|
+
const assembly = scoped.on('system-prompt/assemble', (async (_assembly, _context, next) => {
|
|
194
|
+
const assembled = await next();
|
|
195
|
+
return {
|
|
196
|
+
...assembled,
|
|
197
|
+
variables: { ...assembled.variables, provider: model.provider, model: model.model },
|
|
198
|
+
};
|
|
199
|
+
}), { prepend: true });
|
|
200
|
+
const request = scoped.on('agent/request', (async (_payload, next) => {
|
|
201
|
+
const { reasoningEffort: _effort, ...config } = await next();
|
|
202
|
+
void _effort;
|
|
203
|
+
return { ...config, ...model };
|
|
204
|
+
}), { prepend: true });
|
|
205
|
+
const dispose = () => {
|
|
206
|
+
assembly();
|
|
207
|
+
request();
|
|
208
|
+
event();
|
|
209
|
+
disposed();
|
|
210
|
+
hooks.delete(sessionId);
|
|
211
|
+
};
|
|
212
|
+
const event = native.on('session/event', ((session, value) => {
|
|
213
|
+
if (session.id === sessionId &&
|
|
214
|
+
(value.type === 'request/header' || value.type === 'model/selection'))
|
|
215
|
+
dispose();
|
|
216
|
+
}), { global: true });
|
|
217
|
+
const disposed = native.on('agent/disposed', ((value) => {
|
|
218
|
+
if (value.agent === agent || value.agent.session.id === sessionId)
|
|
219
|
+
dispose();
|
|
220
|
+
}), { global: true });
|
|
221
|
+
hooks.set(sessionId, dispose);
|
|
222
|
+
},
|
|
223
|
+
subscribe: (sessionIds, changed) => {
|
|
224
|
+
const ids = new Set(sessionIds);
|
|
225
|
+
const listener = { ids, changed };
|
|
226
|
+
listeners.add(listener);
|
|
227
|
+
const event = native.on('session/event', ((session) => {
|
|
228
|
+
if (ids.has(session.id))
|
|
229
|
+
changed();
|
|
230
|
+
}), { global: true });
|
|
231
|
+
const status = native.on('agent/status', ((value) => {
|
|
232
|
+
if (ids.has(value.agent.session.id))
|
|
233
|
+
changed();
|
|
234
|
+
}), { global: true });
|
|
235
|
+
const error = native.on('api-session/error', ((id) => {
|
|
236
|
+
if (ids.has(id))
|
|
237
|
+
changed();
|
|
238
|
+
}), { global: true });
|
|
239
|
+
return () => {
|
|
240
|
+
event();
|
|
241
|
+
status();
|
|
242
|
+
error();
|
|
243
|
+
listeners.delete(listener);
|
|
244
|
+
};
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=native-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-session.js","sourceRoot":"","sources":["../../src/tool/native-session.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,wFAAwF;AACxF,MAAM,UAAU,6BAA6B,CAAC,GAAY;IACxD,MAAM,MAAM,GAAG,GAA+B,CAAC;IAC/C,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAA4B,CAAC;IAC3E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAiD,CAAC;IAC3E,MAAM,MAAM,GAAG,CAAC,EAAU,EAAE,EAAE;QAC5B,KAAK,MAAM,QAAQ,IAAI,SAAS;YAAE,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACjF,CAAC,CAAC;IACF,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAChC,wBAAwB,EACxB,CAAC,KAAK,EAAE,OAAgC,EAAE,IAA4B,EAAE,EAAE;QACxE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QACrC,IAAI,EAAE,KAAK,SAAS;YAAE,O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zod';
|
|
2
|
+
import { text } from './inputs.js';
|
|
3
|
+
import * as output from './outputs.js';
|
|
4
|
+
import { defaultBase, errorText } from './context.js';
|
|
5
|
+
const newArgs = z
|
|
6
|
+
.object({
|
|
7
|
+
name: text.describe('Required NEW Git branch name, for example feature/demo; not a path or existing Worktree id.'),
|
|
8
|
+
baseBranch: text
|
|
9
|
+
.optional()
|
|
10
|
+
.describe('Existing local branch override. Omit to inherit the caller checkout’s committed HEAD; do not assume main.'),
|
|
11
|
+
instructions: z
|
|
12
|
+
.string()
|
|
13
|
+
.max(32000)
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Optional shared instructions saved for this Worktree; max 32000 characters.'),
|
|
16
|
+
})
|
|
17
|
+
.strict();
|
|
18
|
+
export function registerNewWorktree(context) {
|
|
19
|
+
const { add, agent, options, check, scope } = context;
|
|
20
|
+
add('clutch_new_worktree', 'Create a managed Worktree with a new branch. By default captures the calling Session’s healthy Worktree HEAD, or its Workspace root HEAD (including detached HEAD). An explicit local baseBranch overrides this. Uncommitted files are not copied. Returns acquisition baseCommit and baseBranch when branch-attached. Does not create a Session or start the requested work. When the user asks to create a Worktree and implement/fix something, follow with clutch_span_worktree using the returned worktreeId if delegation is enabled; let that Session implement and verify the task.', newArgs, output.object({
|
|
21
|
+
workspaceId: output.string,
|
|
22
|
+
worktreeId: output.string,
|
|
23
|
+
name: output.string,
|
|
24
|
+
absolutePath: output.string,
|
|
25
|
+
baseBranch: output.string,
|
|
26
|
+
baseCommit: output.string,
|
|
27
|
+
instructionsSaved: output.boolean,
|
|
28
|
+
error: output.string,
|
|
29
|
+
correction: output.string,
|
|
30
|
+
}, ['workspaceId', 'worktreeId', 'name', 'absolutePath', 'instructionsSaved']), async ({ name, baseBranch, instructions = '' }, exec) => {
|
|
31
|
+
const workspaceId = await scope();
|
|
32
|
+
const base = baseBranch === undefined
|
|
33
|
+
? await defaultBase(agent.session.id, workspaceId, options)
|
|
34
|
+
: undefined;
|
|
35
|
+
check(exec);
|
|
36
|
+
const record = base === undefined
|
|
37
|
+
? await options.manager.createWorktree({
|
|
38
|
+
workspaceId,
|
|
39
|
+
branch: baseBranch,
|
|
40
|
+
newBranch: name,
|
|
41
|
+
})
|
|
42
|
+
: await options.manager.createWorktreeAtCommit({
|
|
43
|
+
workspaceId,
|
|
44
|
+
baseBranch: base.branch,
|
|
45
|
+
baseCommit: base.commit,
|
|
46
|
+
newBranch: name,
|
|
47
|
+
});
|
|
48
|
+
let error;
|
|
49
|
+
try {
|
|
50
|
+
check(exec);
|
|
51
|
+
if (instructions)
|
|
52
|
+
await options.manager.updateWorktreeInstructions({
|
|
53
|
+
workspaceId,
|
|
54
|
+
worktreeId: record.worktreeId,
|
|
55
|
+
instructions,
|
|
56
|
+
expectedInstructions: '',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (cause) {
|
|
60
|
+
exec.signal.throwIfAborted();
|
|
61
|
+
error = errorText(cause).slice(0, 700);
|
|
62
|
+
}
|
|
63
|
+
options.changed(workspaceId, record.worktreeId);
|
|
64
|
+
return {
|
|
65
|
+
workspaceId,
|
|
66
|
+
worktreeId: record.worktreeId,
|
|
67
|
+
name: record.branch,
|
|
68
|
+
absolutePath: record.absolutePath,
|
|
69
|
+
baseBranch: record.baseBranch,
|
|
70
|
+
baseCommit: record.baseCommit,
|
|
71
|
+
instructionsSaved: error === undefined,
|
|
72
|
+
...(error === undefined
|
|
73
|
+
? {}
|
|
74
|
+
: {
|
|
75
|
+
error,
|
|
76
|
+
correction: 'The Worktree already exists. Save its instructions through Worktree management using this worktreeId; do not create the branch again.',
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=new-worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-worktree.js","sourceRoot":"","sources":["../../src/tool/new-worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,C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nB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,iBAAiB,EAAE,KAAK,KAAK,SAAS;YACtC,GAAG,CAAC,KAAK,KAAK,SAAS;gBACrB,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC;oBACE,KAAK;oBACL,UAAU,EACR,uIAAuI;iBAC1I,CAAC;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const string: {
|
|
2
|
+
type: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const boolean: {
|
|
5
|
+
type: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const integer: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const array: (items: unknown) => {
|
|
11
|
+
type: string;
|
|
12
|
+
items: unknown;
|
|
13
|
+
};
|
|
14
|
+
export declare const object: (properties: Record<string, unknown>, required?: string[]) => {
|
|
15
|
+
type: string;
|
|
16
|
+
properties: Record<string, unknown>;
|
|
17
|
+
required: string[];
|
|
18
|
+
additionalProperties: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const model: {
|
|
21
|
+
type: string;
|
|
22
|
+
properties: Record<string, unknown>;
|
|
23
|
+
required: string[];
|
|
24
|
+
additionalProperties: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare const worktree: {
|
|
27
|
+
type: string;
|
|
28
|
+
properties: Record<string, unknown>;
|
|
29
|
+
required: string[];
|
|
30
|
+
additionalProperties: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare const entry: {
|
|
33
|
+
type: string;
|
|
34
|
+
properties: Record<string, unknown>;
|
|
35
|
+
required: string[];
|
|
36
|
+
additionalProperties: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare const read: {
|
|
39
|
+
type: string;
|
|
40
|
+
properties: Record<string, unknown>;
|
|
41
|
+
required: string[];
|
|
42
|
+
additionalProperties: boolean;
|
|
43
|
+
};
|
|
44
|
+
export declare const catalogModel: {
|
|
45
|
+
type: string;
|
|
46
|
+
properties: Record<string, unknown>;
|
|
47
|
+
required: string[];
|
|
48
|
+
additionalProperties: boolean;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=outputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputs.d.ts","sourceRoot":"","sources":["../../src/tool/outputs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;CAAqB,CAAC;AACzC,eAAO,MAAM,OAAO;;CAAsB,CAAC;AAC3C,eAAO,MAAM,OAAO;;CAAsB,CAAC;AAC3C,eAAO,MAAM,KAAK,GAAI,OAAO,OAAO;;;CAA+B,CAAC;AACpE,eAAO,MAAM,MAAM,GAAI,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAU,MAAM,EAAO;;;;;CAKjF,CAAC;AACH,eAAO,MAAM,KAAK;;;;;CAGhB,CAAC;AACH,eAAO,MAAM,QAAQ;;;;;CAYpB,CAAC;AACF,eAAO,MAAM,KAAK;;;;;CAWjB,CAAC;AACF,eAAO,MAAM,IAAI;;;;;CAwBhB,CAAC;AACF,eAAO,MAAM,YAAY;;;;;CAcxB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const string = { type: 'string' };
|
|
2
|
+
export const boolean = { type: 'boolean' };
|
|
3
|
+
export const integer = { type: 'integer' };
|
|
4
|
+
export const array = (items) => ({ type: 'array', items });
|
|
5
|
+
export const object = (properties, required = []) => ({
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties,
|
|
8
|
+
required,
|
|
9
|
+
additionalProperties: false,
|
|
10
|
+
});
|
|
11
|
+
export const model = object({ provider: string, model: string, reasoningEffort: string }, [
|
|
12
|
+
'provider',
|
|
13
|
+
'model',
|
|
14
|
+
]);
|
|
15
|
+
export const worktree = object({
|
|
16
|
+
worktreeId: string,
|
|
17
|
+
branch: string,
|
|
18
|
+
absolutePath: string,
|
|
19
|
+
status: string,
|
|
20
|
+
health: string,
|
|
21
|
+
diskCleanup: string,
|
|
22
|
+
baseBranch: string,
|
|
23
|
+
baseCommit: string,
|
|
24
|
+
}, ['worktreeId', 'branch', 'absolutePath', 'status']);
|
|
25
|
+
export const entry = object({
|
|
26
|
+
seq: integer,
|
|
27
|
+
time: integer,
|
|
28
|
+
type: string,
|
|
29
|
+
text: string,
|
|
30
|
+
textOffset: integer,
|
|
31
|
+
continued: boolean,
|
|
32
|
+
reason: string,
|
|
33
|
+
}, ['seq', 'time', 'type']);
|
|
34
|
+
export const read = object({
|
|
35
|
+
workspaceId: string,
|
|
36
|
+
sessionId: string,
|
|
37
|
+
status: string,
|
|
38
|
+
running: boolean,
|
|
39
|
+
entries: array(entry),
|
|
40
|
+
cursor: string,
|
|
41
|
+
hasMore: boolean,
|
|
42
|
+
historyOmitted: boolean,
|
|
43
|
+
statusChanged: boolean,
|
|
44
|
+
error: string,
|
|
45
|
+
}, [
|
|
46
|
+
'workspaceId',
|
|
47
|
+
'sessionId',
|
|
48
|
+
'status',
|
|
49
|
+
'running',
|
|
50
|
+
'entries',
|
|
51
|
+
'cursor',
|
|
52
|
+
'hasMore',
|
|
53
|
+
'historyOmitted',
|
|
54
|
+
'statusChanged',
|
|
55
|
+
]);
|
|
56
|
+
export const catalogModel = object({
|
|
57
|
+
id: string,
|
|
58
|
+
name: string,
|
|
59
|
+
description: string,
|
|
60
|
+
reasoning: object({
|
|
61
|
+
efforts: array(object({ id: string, name: string, description: string }, ['id', 'name'])),
|
|
62
|
+
defaultEffort: string,
|
|
63
|
+
}, ['efforts']),
|
|
64
|
+
}, ['id', 'name']);
|
|
65
|
+
//# sourceMappingURL=outputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/tool/outputs.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,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AAK,EAAE,MAAM,EAAE,MAAM,CAAC,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CACxB;IACE,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC;IACrB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;IAChB,cAAc,EAAE,OAAO;IACvB,aAAa,EAAE,OAAO;IACtB,KAAK,EAAE,MAAM;CACd,EACD;IACE,aAAa;IACb,WAAW;IACX,QAAQ;IACR,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,gBAAgB;IAChB,eAAe;CAChB,CACF,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAChC;IACE,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM,CACf;QACE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACzF,aAAa,EAAE,MAAM;KACtB,EACD,CAAC,SAAS,CAAC,CACZ;CACF,EACD,CAAC,IAAI,EAAE,MAAM,CAAC,CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-result.d.ts","sourceRoot":"","sources":["../../src/tool/report-result.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgC9C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,IAAI,CAqErE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { text } from './inputs.js';
|
|
4
|
+
import { authorize, errorText } from './context.js';
|
|
5
|
+
import * as output from './outputs.js';
|
|
6
|
+
const reportArgs = z
|
|
7
|
+
.object({
|
|
8
|
+
status: z
|
|
9
|
+
.enum(['completed', 'blocked', 'failed'])
|
|
10
|
+
.describe('Your task outcome. completed requires finished work and verification; blocked requires help; failed means the task could not be fulfilled.'),
|
|
11
|
+
summary: text
|
|
12
|
+
.max(2000)
|
|
13
|
+
.describe('Concise outcome, changed files or the specific blocker. Do not include conversation history or intermediate steps.'),
|
|
14
|
+
evidence: text
|
|
15
|
+
.max(2000)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Verification commands and results, artifact paths, remaining risks, or what help is required.'),
|
|
18
|
+
requestId: text
|
|
19
|
+
.max(200)
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Omit for a new report. Reuse the returned id only to retry the identical report after uncertain admission.'),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
export function registerReportResult(context) {
|
|
25
|
+
const { add, agent, options, check, scope, delegation } = context;
|
|
26
|
+
return add('clutch_report_result', 'Push one concise result or blocker only when the Host holds an active in-memory report token for this delegated task. Successful completed, blocked or failed admission consumes the token. The tool stays available but calls without a token are rejected; later user work must not report to the former parent. Only an explicit new parent dispatch grants another token. Required fields: status and summary; optional evidence and retry requestId. On uncertain admission retry only the identical report with its returned requestId. The Host fixes the destination. Include verification evidence. This is your claim, not automatic proof of success. Returns message admission, not a reply.', reportArgs, output.object({
|
|
27
|
+
workspaceId: output.string,
|
|
28
|
+
sessionId: output.string,
|
|
29
|
+
parentSessionId: output.string,
|
|
30
|
+
requestId: output.string,
|
|
31
|
+
status: { type: 'string', enum: ['admitted', 'prompt-failed'] },
|
|
32
|
+
error: output.string,
|
|
33
|
+
correction: output.string,
|
|
34
|
+
}, ['workspaceId', 'sessionId', 'parentSessionId', 'requestId', 'status']), async (args, exec) => {
|
|
35
|
+
const reportTask = delegation.assertReport(agent);
|
|
36
|
+
const { parentSessionId } = reportTask;
|
|
37
|
+
const workspaceId = await scope();
|
|
38
|
+
await authorize(agent.session.id, workspaceId, options, true);
|
|
39
|
+
await authorize(parentSessionId, workspaceId, options, true);
|
|
40
|
+
check(exec);
|
|
41
|
+
const requestId = args.requestId ?? `clutch-worktree-report:${randomUUID()}`;
|
|
42
|
+
if (args.requestId !== undefined && !reportTask.attempt)
|
|
43
|
+
throw Object.assign(new Error('A report requestId must come from this token’s previous uncertain admission.'), { code: 'REPORT_RETRY_REQUIRED' });
|
|
44
|
+
const identity = { workspaceId, sessionId: agent.session.id, parentSessionId, requestId };
|
|
45
|
+
const message = JSON.stringify({
|
|
46
|
+
kind: 'worktree-task-report',
|
|
47
|
+
fromSessionId: agent.session.id,
|
|
48
|
+
status: args.status,
|
|
49
|
+
summary: args.summary,
|
|
50
|
+
...(args.evidence === undefined ? {} : { evidence: args.evidence }),
|
|
51
|
+
});
|
|
52
|
+
delegation.claimReport(agent, reportTask, requestId, message);
|
|
53
|
+
const attempt = reportTask.attempt;
|
|
54
|
+
try {
|
|
55
|
+
await options.sessions.prompt({
|
|
56
|
+
sessionId: parentSessionId,
|
|
57
|
+
requestId,
|
|
58
|
+
mode: 'queue',
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: 'text',
|
|
62
|
+
text: `Delegated Session report (claims require verification; no automatic reply needed):\n${message}`,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
}, exec.signal);
|
|
66
|
+
delegation.close(reportTask);
|
|
67
|
+
return { ...identity, status: 'admitted' };
|
|
68
|
+
}
|
|
69
|
+
catch (cause) {
|
|
70
|
+
exec.signal.throwIfAborted();
|
|
71
|
+
return {
|
|
72
|
+
...identity,
|
|
73
|
+
status: 'prompt-failed',
|
|
74
|
+
error: errorText(cause).slice(0, 700),
|
|
75
|
+
correction: 'Admission may have succeeded. Retry this identical report using the returned requestId; do not send a new report id for the same attempt.',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
attempt.pending = false;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=report-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-result.js","sourceRoot":"","sources":["../../src/tool/report-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,MAAM,UAAU,GAAG,CAAC;KACjB,MAAM,CAAC;IACN,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;SACxC,QAAQ,CACP,4IAA4I,CAC7I;IACH,OAAO,EAAE,IAAI;SACV,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CACP,oHAAoH,CACrH;IACH,QAAQ,EAAE,IAAI;SACX,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,+FAA+F,CAChG;IACH,SAAS,EAAE,IAAI;SACZ,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,4GAA4G,CAC7G;CACJ,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACvD,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAClE,OAAO,GAAG,CACR,sBAAsB,EACtB,0qBAA0qB,EAC1qB,UAAU,EACV,MAAM,CAAC,MAAM,CACX;QACE,WAAW,EAAE,MAAM,CAAC,MAAM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|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** DSH's native/PTC catalog uses a smaller schema vocabulary than Zod emits.
|
|
3
|
+
* Length constraints remain enforced by the original Zod parser at execution.
|
|
4
|
+
* Unsupported future constructs fail registration instead of hiding fields as unknown.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toolParameters(schema: z.ZodType): Record<string, unknown>;
|
|
7
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/tool/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4FxB;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|