@nubl/maestro 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -2
- package/dist/config.json.example +30 -0
- package/dist/maestro/adapters/fake/fake-harness-adapter.d.ts +24 -0
- package/dist/maestro/adapters/fake/fake-harness-adapter.d.ts.map +1 -0
- package/dist/maestro/adapters/fake/fake-harness-adapter.js +210 -0
- package/dist/maestro/adapters/fake/fake-harness-adapter.js.map +1 -0
- package/dist/maestro/adapters/pi/accept-groups.d.ts +35 -0
- package/dist/maestro/adapters/pi/accept-groups.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/accept-groups.js +70 -0
- package/dist/maestro/adapters/pi/accept-groups.js.map +1 -0
- package/dist/maestro/adapters/pi/accept-runner.d.ts +37 -0
- package/dist/maestro/adapters/pi/accept-runner.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/accept-runner.js +161 -0
- package/dist/maestro/adapters/pi/accept-runner.js.map +1 -0
- package/dist/maestro/adapters/pi/activity-file.d.ts +39 -0
- package/dist/maestro/adapters/pi/activity-file.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/activity-file.js +454 -0
- package/dist/maestro/adapters/pi/activity-file.js.map +1 -0
- package/dist/maestro/adapters/pi/child/accept-check.d.ts +24 -0
- package/dist/maestro/adapters/pi/child/accept-check.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/child/accept-check.js +82 -0
- package/dist/maestro/adapters/pi/child/accept-check.js.map +1 -0
- package/dist/maestro/adapters/pi/child/declared-skills.d.ts +51 -0
- package/dist/maestro/adapters/pi/child/declared-skills.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/child/declared-skills.js +148 -0
- package/dist/maestro/adapters/pi/child/declared-skills.js.map +1 -0
- package/dist/maestro/adapters/pi/child/done-nudge.d.ts +38 -0
- package/dist/maestro/adapters/pi/child/done-nudge.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/child/done-nudge.js +77 -0
- package/dist/maestro/adapters/pi/child/done-nudge.js.map +1 -0
- package/dist/maestro/adapters/pi/child/entry.d.ts +3 -0
- package/dist/maestro/adapters/pi/child/entry.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/child/entry.js +3 -0
- package/dist/maestro/adapters/pi/child/entry.js.map +1 -0
- package/dist/maestro/adapters/pi/child/protocol.d.ts +56 -0
- package/dist/maestro/adapters/pi/child/protocol.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/child/protocol.js +510 -0
- package/dist/maestro/adapters/pi/child/protocol.js.map +1 -0
- package/dist/maestro/adapters/pi/completion.d.ts +45 -0
- package/dist/maestro/adapters/pi/completion.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/completion.js +295 -0
- package/dist/maestro/adapters/pi/completion.js.map +1 -0
- package/dist/maestro/adapters/pi/launch-command.d.ts +27 -0
- package/dist/maestro/adapters/pi/launch-command.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/launch-command.js +75 -0
- package/dist/maestro/adapters/pi/launch-command.js.map +1 -0
- package/dist/maestro/adapters/pi/launch-operations.d.ts +78 -0
- package/dist/maestro/adapters/pi/launch-operations.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/launch-operations.js +270 -0
- package/dist/maestro/adapters/pi/launch-operations.js.map +1 -0
- package/dist/maestro/adapters/pi/launch-resume.d.ts +4 -0
- package/dist/maestro/adapters/pi/launch-resume.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/launch-resume.js +183 -0
- package/dist/maestro/adapters/pi/launch-resume.js.map +1 -0
- package/dist/maestro/adapters/pi/launch.d.ts +148 -0
- package/dist/maestro/adapters/pi/launch.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/launch.js +655 -0
- package/dist/maestro/adapters/pi/launch.js.map +1 -0
- package/dist/maestro/adapters/pi/model-registry.d.ts +3 -0
- package/dist/maestro/adapters/pi/model-registry.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/model-registry.js +29 -0
- package/dist/maestro/adapters/pi/model-registry.js.map +1 -0
- package/dist/maestro/adapters/pi/pi-harness-adapter.d.ts +95 -0
- package/dist/maestro/adapters/pi/pi-harness-adapter.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/pi-harness-adapter.js +549 -0
- package/dist/maestro/adapters/pi/pi-harness-adapter.js.map +1 -0
- package/dist/maestro/adapters/pi/process-identity.d.ts +92 -0
- package/dist/maestro/adapters/pi/process-identity.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/process-identity.js +248 -0
- package/dist/maestro/adapters/pi/process-identity.js.map +1 -0
- package/dist/maestro/adapters/pi/process-tree.d.ts +48 -0
- package/dist/maestro/adapters/pi/process-tree.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/process-tree.js +69 -0
- package/dist/maestro/adapters/pi/process-tree.js.map +1 -0
- package/dist/maestro/adapters/pi/script-shell.d.ts +40 -0
- package/dist/maestro/adapters/pi/script-shell.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/script-shell.js +43 -0
- package/dist/maestro/adapters/pi/script-shell.js.map +1 -0
- package/dist/maestro/adapters/pi/session.d.ts +207 -0
- package/dist/maestro/adapters/pi/session.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/session.js +714 -0
- package/dist/maestro/adapters/pi/session.js.map +1 -0
- package/dist/maestro/adapters/pi/task-model-init.d.ts +4 -0
- package/dist/maestro/adapters/pi/task-model-init.d.ts.map +1 -0
- package/dist/maestro/adapters/pi/task-model-init.js +47 -0
- package/dist/maestro/adapters/pi/task-model-init.js.map +1 -0
- package/dist/maestro/core/accept.d.ts +150 -0
- package/dist/maestro/core/accept.d.ts.map +1 -0
- package/dist/maestro/core/accept.js +243 -0
- package/dist/maestro/core/accept.js.map +1 -0
- package/dist/maestro/core/activity.d.ts +4 -0
- package/dist/maestro/core/activity.d.ts.map +1 -0
- package/dist/maestro/core/activity.js +18 -0
- package/dist/maestro/core/activity.js.map +1 -0
- package/dist/maestro/core/child-busy.d.ts +14 -0
- package/dist/maestro/core/child-busy.d.ts.map +1 -0
- package/dist/maestro/core/child-busy.js +14 -0
- package/dist/maestro/core/child-busy.js.map +1 -0
- package/dist/maestro/core/config/guidelines-config.d.ts +8 -0
- package/dist/maestro/core/config/guidelines-config.d.ts.map +1 -0
- package/dist/maestro/core/config/guidelines-config.js +60 -0
- package/dist/maestro/core/config/guidelines-config.js.map +1 -0
- package/dist/maestro/core/config/herdr-config.d.ts +13 -0
- package/dist/maestro/core/config/herdr-config.d.ts.map +1 -0
- package/dist/maestro/core/config/herdr-config.js +65 -0
- package/dist/maestro/core/config/herdr-config.js.map +1 -0
- package/dist/maestro/core/config/model-config.d.ts +92 -0
- package/dist/maestro/core/config/model-config.d.ts.map +1 -0
- package/dist/maestro/core/config/model-config.js +522 -0
- package/dist/maestro/core/config/model-config.js.map +1 -0
- package/dist/maestro/core/config/outcome-ledger-config.d.ts +8 -0
- package/dist/maestro/core/config/outcome-ledger-config.d.ts.map +1 -0
- package/dist/maestro/core/config/outcome-ledger-config.js +49 -0
- package/dist/maestro/core/config/outcome-ledger-config.js.map +1 -0
- package/dist/maestro/core/config/pane-config.d.ts +15 -0
- package/dist/maestro/core/config/pane-config.d.ts.map +1 -0
- package/dist/maestro/core/config/pane-config.js +101 -0
- package/dist/maestro/core/config/pane-config.js.map +1 -0
- package/dist/maestro/core/config/persistent-config.d.ts +7 -0
- package/dist/maestro/core/config/persistent-config.d.ts.map +1 -0
- package/dist/maestro/core/config/persistent-config.js +72 -0
- package/dist/maestro/core/config/persistent-config.js.map +1 -0
- package/dist/maestro/core/config/role-config.d.ts +7 -0
- package/dist/maestro/core/config/role-config.d.ts.map +1 -0
- package/dist/maestro/core/config/role-config.js +74 -0
- package/dist/maestro/core/config/role-config.js.map +1 -0
- package/dist/maestro/core/config/spawning-config.d.ts +7 -0
- package/dist/maestro/core/config/spawning-config.d.ts.map +1 -0
- package/dist/maestro/core/config/spawning-config.js +65 -0
- package/dist/maestro/core/config/spawning-config.js.map +1 -0
- package/dist/maestro/core/config/supervision-config.d.ts +7 -0
- package/dist/maestro/core/config/supervision-config.d.ts.map +1 -0
- package/dist/maestro/core/config/supervision-config.js +69 -0
- package/dist/maestro/core/config/supervision-config.js.map +1 -0
- package/dist/maestro/core/config/task-model-init.d.ts +118 -0
- package/dist/maestro/core/config/task-model-init.d.ts.map +1 -0
- package/dist/maestro/core/config/task-model-init.js +168 -0
- package/dist/maestro/core/config/task-model-init.js.map +1 -0
- package/dist/maestro/core/config/task-model-types.d.ts +36 -0
- package/dist/maestro/core/config/task-model-types.d.ts.map +1 -0
- package/dist/maestro/core/config/task-model-types.js +17 -0
- package/dist/maestro/core/config/task-model-types.js.map +1 -0
- package/dist/maestro/core/config/type-guards.d.ts +22 -0
- package/dist/maestro/core/config/type-guards.d.ts.map +1 -0
- package/dist/maestro/core/config/type-guards.js +31 -0
- package/dist/maestro/core/config/type-guards.js.map +1 -0
- package/dist/maestro/core/deadline.d.ts +11 -0
- package/dist/maestro/core/deadline.d.ts.map +1 -0
- package/dist/maestro/core/deadline.js +30 -0
- package/dist/maestro/core/deadline.js.map +1 -0
- package/dist/maestro/core/declared-skills.d.ts +16 -0
- package/dist/maestro/core/declared-skills.d.ts.map +1 -0
- package/dist/maestro/core/declared-skills.js +52 -0
- package/dist/maestro/core/declared-skills.js.map +1 -0
- package/dist/maestro/core/delegation-depth.d.ts +38 -0
- package/dist/maestro/core/delegation-depth.d.ts.map +1 -0
- package/dist/maestro/core/delegation-depth.js +59 -0
- package/dist/maestro/core/delegation-depth.js.map +1 -0
- package/dist/maestro/core/git-environment.d.ts +3 -0
- package/dist/maestro/core/git-environment.d.ts.map +1 -0
- package/dist/maestro/core/git-environment.js +29 -0
- package/dist/maestro/core/git-environment.js.map +1 -0
- package/dist/maestro/core/harness-adapter.d.ts +89 -0
- package/dist/maestro/core/harness-adapter.d.ts.map +1 -0
- package/dist/maestro/core/harness-adapter.js +2 -0
- package/dist/maestro/core/harness-adapter.js.map +1 -0
- package/dist/maestro/core/host-text.d.ts +49 -0
- package/dist/maestro/core/host-text.d.ts.map +1 -0
- package/dist/maestro/core/host-text.js +106 -0
- package/dist/maestro/core/host-text.js.map +1 -0
- package/dist/maestro/core/index.d.ts +4 -0
- package/dist/maestro/core/index.d.ts.map +1 -0
- package/dist/maestro/core/index.js +2 -0
- package/dist/maestro/core/index.js.map +1 -0
- package/dist/maestro/core/lifecycle.d.ts +16 -0
- package/dist/maestro/core/lifecycle.d.ts.map +1 -0
- package/dist/maestro/core/lifecycle.js +429 -0
- package/dist/maestro/core/lifecycle.js.map +1 -0
- package/dist/maestro/core/opened-primary-workspace.d.ts +31 -0
- package/dist/maestro/core/opened-primary-workspace.d.ts.map +1 -0
- package/dist/maestro/core/opened-primary-workspace.js +49 -0
- package/dist/maestro/core/opened-primary-workspace.js.map +1 -0
- package/dist/maestro/core/platform-support.d.ts +15 -0
- package/dist/maestro/core/platform-support.d.ts.map +1 -0
- package/dist/maestro/core/platform-support.js +23 -0
- package/dist/maestro/core/platform-support.js.map +1 -0
- package/dist/maestro/core/realpath-without-opening.d.ts +9 -0
- package/dist/maestro/core/realpath-without-opening.d.ts.map +1 -0
- package/dist/maestro/core/realpath-without-opening.js +45 -0
- package/dist/maestro/core/realpath-without-opening.js.map +1 -0
- package/dist/maestro/core/roles/discovery.d.ts +64 -0
- package/dist/maestro/core/roles/discovery.d.ts.map +1 -0
- package/dist/maestro/core/roles/discovery.js +422 -0
- package/dist/maestro/core/roles/discovery.js.map +1 -0
- package/dist/maestro/core/routing.d.ts +115 -0
- package/dist/maestro/core/routing.d.ts.map +1 -0
- package/dist/maestro/core/routing.js +449 -0
- package/dist/maestro/core/routing.js.map +1 -0
- package/dist/maestro/core/script-launch.d.ts +47 -0
- package/dist/maestro/core/script-launch.d.ts.map +1 -0
- package/dist/maestro/core/script-launch.js +102 -0
- package/dist/maestro/core/script-launch.js.map +1 -0
- package/dist/maestro/core/shell.d.ts +2 -0
- package/dist/maestro/core/shell.d.ts.map +1 -0
- package/dist/maestro/core/shell.js +4 -0
- package/dist/maestro/core/shell.js.map +1 -0
- package/dist/maestro/core/specialist-notice.d.ts +36 -0
- package/dist/maestro/core/specialist-notice.d.ts.map +1 -0
- package/dist/maestro/core/specialist-notice.js +41 -0
- package/dist/maestro/core/specialist-notice.js.map +1 -0
- package/dist/maestro/core/status.d.ts +87 -0
- package/dist/maestro/core/status.d.ts.map +1 -0
- package/dist/maestro/core/status.js +369 -0
- package/dist/maestro/core/status.js.map +1 -0
- package/dist/maestro/core/supervision.d.ts +56 -0
- package/dist/maestro/core/supervision.d.ts.map +1 -0
- package/dist/maestro/core/supervision.js +249 -0
- package/dist/maestro/core/supervision.js.map +1 -0
- package/dist/maestro/core/surface-provider.d.ts +200 -0
- package/dist/maestro/core/surface-provider.d.ts.map +1 -0
- package/dist/maestro/core/surface-provider.js +71 -0
- package/dist/maestro/core/surface-provider.js.map +1 -0
- package/dist/maestro/core/types.d.ts +388 -0
- package/dist/maestro/core/types.d.ts.map +1 -0
- package/dist/maestro/core/types.js +2 -0
- package/dist/maestro/core/types.js.map +1 -0
- package/dist/maestro/core/undelivered-children.d.ts +27 -0
- package/dist/maestro/core/undelivered-children.d.ts.map +1 -0
- package/dist/maestro/core/undelivered-children.js +31 -0
- package/dist/maestro/core/undelivered-children.js.map +1 -0
- package/dist/maestro/core/wake.d.ts +32 -0
- package/dist/maestro/core/wake.d.ts.map +1 -0
- package/dist/maestro/core/wake.js +125 -0
- package/dist/maestro/core/wake.js.map +1 -0
- package/dist/maestro/core/worktree-cleanup.d.ts +75 -0
- package/dist/maestro/core/worktree-cleanup.d.ts.map +1 -0
- package/dist/maestro/core/worktree-cleanup.js +278 -0
- package/dist/maestro/core/worktree-cleanup.js.map +1 -0
- package/dist/maestro/core/worktree.d.ts +50 -0
- package/dist/maestro/core/worktree.d.ts.map +1 -0
- package/dist/maestro/core/worktree.js +23 -0
- package/dist/maestro/core/worktree.js.map +1 -0
- package/dist/maestro/engine.d.ts +5 -0
- package/dist/maestro/engine.d.ts.map +1 -0
- package/dist/maestro/engine.js +5 -0
- package/dist/maestro/engine.js.map +1 -0
- package/dist/maestro/pi/child.d.ts +8 -0
- package/dist/maestro/pi/child.d.ts.map +1 -0
- package/dist/maestro/pi/child.js +8 -0
- package/dist/maestro/pi/child.js.map +1 -0
- package/dist/maestro/pi/extension.d.ts +10 -0
- package/dist/maestro/pi/extension.d.ts.map +1 -0
- package/dist/maestro/pi/extension.js +8 -0
- package/dist/maestro/pi/extension.js.map +1 -0
- package/dist/maestro/pi/subagents-index.d.ts +9 -0
- package/dist/maestro/pi/subagents-index.d.ts.map +1 -0
- package/dist/maestro/pi/subagents-index.js +9 -0
- package/dist/maestro/pi/subagents-index.js.map +1 -0
- package/dist/maestro/pi.d.ts +9 -0
- package/dist/maestro/pi.d.ts.map +1 -0
- package/dist/maestro/pi.js +7 -0
- package/dist/maestro/pi.js.map +1 -0
- package/dist/maestro/runtime/accept-recheck.d.ts +32 -0
- package/dist/maestro/runtime/accept-recheck.d.ts.map +1 -0
- package/dist/maestro/runtime/accept-recheck.js +92 -0
- package/dist/maestro/runtime/accept-recheck.js.map +1 -0
- package/dist/maestro/runtime/delegated-marker.d.ts +112 -0
- package/dist/maestro/runtime/delegated-marker.d.ts.map +1 -0
- package/dist/maestro/runtime/delegated-marker.js +200 -0
- package/dist/maestro/runtime/delegated-marker.js.map +1 -0
- package/dist/maestro/runtime/host-surface-binding.d.ts +25 -0
- package/dist/maestro/runtime/host-surface-binding.d.ts.map +1 -0
- package/dist/maestro/runtime/host-surface-binding.js +2 -0
- package/dist/maestro/runtime/host-surface-binding.js.map +1 -0
- package/dist/maestro/runtime/index.d.ts +10 -0
- package/dist/maestro/runtime/index.d.ts.map +1 -0
- package/dist/maestro/runtime/index.js +6 -0
- package/dist/maestro/runtime/index.js.map +1 -0
- package/dist/maestro/runtime/pi-persistent-io.d.ts +7 -0
- package/dist/maestro/runtime/pi-persistent-io.d.ts.map +1 -0
- package/dist/maestro/runtime/pi-persistent-io.js +64 -0
- package/dist/maestro/runtime/pi-persistent-io.js.map +1 -0
- package/dist/maestro/runtime/pi-run-session-types.d.ts +328 -0
- package/dist/maestro/runtime/pi-run-session-types.d.ts.map +1 -0
- package/dist/maestro/runtime/pi-run-session-types.js +2 -0
- package/dist/maestro/runtime/pi-run-session-types.js.map +1 -0
- package/dist/maestro/runtime/pi-run-session.d.ts +12 -0
- package/dist/maestro/runtime/pi-run-session.d.ts.map +1 -0
- package/dist/maestro/runtime/pi-run-session.js +809 -0
- package/dist/maestro/runtime/pi-run-session.js.map +1 -0
- package/dist/maestro/runtime/run-session.d.ts +129 -0
- package/dist/maestro/runtime/run-session.d.ts.map +1 -0
- package/dist/maestro/runtime/run-session.js +680 -0
- package/dist/maestro/runtime/run-session.js.map +1 -0
- package/dist/maestro/runtime/surface-retention.d.ts +3 -0
- package/dist/maestro/runtime/surface-retention.d.ts.map +1 -0
- package/dist/maestro/runtime/surface-retention.js +5 -0
- package/dist/maestro/runtime/surface-retention.js.map +1 -0
- package/dist/maestro/runtime/task-model-init.d.ts +34 -0
- package/dist/maestro/runtime/task-model-init.d.ts.map +1 -0
- package/dist/maestro/runtime/task-model-init.js +78 -0
- package/dist/maestro/runtime/task-model-init.js.map +1 -0
- package/dist/maestro/runtime/worktree-operations.d.ts +31 -0
- package/dist/maestro/runtime/worktree-operations.d.ts.map +1 -0
- package/dist/maestro/runtime/worktree-operations.js +633 -0
- package/dist/maestro/runtime/worktree-operations.js.map +1 -0
- package/dist/maestro/surfaces/fake/fake-surface-provider.d.ts +54 -0
- package/dist/maestro/surfaces/fake/fake-surface-provider.d.ts.map +1 -0
- package/dist/maestro/surfaces/fake/fake-surface-provider.js +231 -0
- package/dist/maestro/surfaces/fake/fake-surface-provider.js.map +1 -0
- package/dist/maestro/testing/harness-adapter.conformance.d.ts +31 -0
- package/dist/maestro/testing/harness-adapter.conformance.d.ts.map +1 -0
- package/dist/maestro/testing/harness-adapter.conformance.js +181 -0
- package/dist/maestro/testing/harness-adapter.conformance.js.map +1 -0
- package/dist/maestro/testing/index.d.ts +5 -0
- package/dist/maestro/testing/index.d.ts.map +1 -0
- package/dist/maestro/testing/index.js +5 -0
- package/dist/maestro/testing/index.js.map +1 -0
- package/dist/maestro/testing/surface-provider.conformance.d.ts +20 -0
- package/dist/maestro/testing/surface-provider.conformance.d.ts.map +1 -0
- package/dist/maestro/testing/surface-provider.conformance.js +167 -0
- package/dist/maestro/testing/surface-provider.conformance.js.map +1 -0
- package/dist/pi-extension/subagents/catalog.d.ts +70 -0
- package/dist/pi-extension/subagents/catalog.d.ts.map +1 -0
- package/dist/pi-extension/subagents/catalog.js +231 -0
- package/dist/pi-extension/subagents/catalog.js.map +1 -0
- package/dist/pi-extension/subagents/config-path.d.ts +6 -0
- package/dist/pi-extension/subagents/config-path.d.ts.map +1 -0
- package/dist/pi-extension/subagents/config-path.js +21 -0
- package/dist/pi-extension/subagents/config-path.js.map +1 -0
- package/dist/pi-extension/subagents/control-tools.d.ts +21 -0
- package/dist/pi-extension/subagents/control-tools.d.ts.map +1 -0
- package/dist/pi-extension/subagents/control-tools.js +150 -0
- package/dist/pi-extension/subagents/control-tools.js.map +1 -0
- package/dist/pi-extension/subagents/controls.d.ts +52 -0
- package/dist/pi-extension/subagents/controls.d.ts.map +1 -0
- package/dist/pi-extension/subagents/controls.js +173 -0
- package/dist/pi-extension/subagents/controls.js.map +1 -0
- package/dist/pi-extension/subagents/deferred-tools.d.ts +43 -0
- package/dist/pi-extension/subagents/deferred-tools.d.ts.map +1 -0
- package/dist/pi-extension/subagents/deferred-tools.js +67 -0
- package/dist/pi-extension/subagents/deferred-tools.js.map +1 -0
- package/dist/pi-extension/subagents/delivery.d.ts +22 -0
- package/dist/pi-extension/subagents/delivery.d.ts.map +1 -0
- package/dist/pi-extension/subagents/delivery.js +365 -0
- package/dist/pi-extension/subagents/delivery.js.map +1 -0
- package/dist/pi-extension/subagents/extension.d.ts +100 -0
- package/dist/pi-extension/subagents/extension.d.ts.map +1 -0
- package/dist/pi-extension/subagents/extension.js +367 -0
- package/dist/pi-extension/subagents/extension.js.map +1 -0
- package/dist/pi-extension/subagents/launch-tools.d.ts +33 -0
- package/dist/pi-extension/subagents/launch-tools.d.ts.map +1 -0
- package/dist/pi-extension/subagents/launch-tools.js +373 -0
- package/dist/pi-extension/subagents/launch-tools.js.map +1 -0
- package/dist/pi-extension/subagents/launch.d.ts +86 -0
- package/dist/pi-extension/subagents/launch.d.ts.map +1 -0
- package/dist/pi-extension/subagents/launch.js +133 -0
- package/dist/pi-extension/subagents/launch.js.map +1 -0
- package/dist/pi-extension/subagents/model-registry.d.ts +13 -0
- package/dist/pi-extension/subagents/model-registry.d.ts.map +1 -0
- package/dist/pi-extension/subagents/model-registry.js +52 -0
- package/dist/pi-extension/subagents/model-registry.js.map +1 -0
- package/dist/pi-extension/subagents/observation.d.ts +38 -0
- package/dist/pi-extension/subagents/observation.d.ts.map +1 -0
- package/dist/pi-extension/subagents/observation.js +168 -0
- package/dist/pi-extension/subagents/observation.js.map +1 -0
- package/dist/pi-extension/subagents/persistent.d.ts +72 -0
- package/dist/pi-extension/subagents/persistent.d.ts.map +1 -0
- package/dist/pi-extension/subagents/persistent.js +322 -0
- package/dist/pi-extension/subagents/persistent.js.map +1 -0
- package/dist/pi-extension/subagents/presentation-hooks.d.ts +25 -0
- package/dist/pi-extension/subagents/presentation-hooks.d.ts.map +1 -0
- package/dist/pi-extension/subagents/presentation-hooks.js +2 -0
- package/dist/pi-extension/subagents/presentation-hooks.js.map +1 -0
- package/dist/pi-extension/subagents/presentation.d.ts +149 -0
- package/dist/pi-extension/subagents/presentation.d.ts.map +1 -0
- package/dist/pi-extension/subagents/presentation.js +419 -0
- package/dist/pi-extension/subagents/presentation.js.map +1 -0
- package/dist/pi-extension/subagents/state.d.ts +183 -0
- package/dist/pi-extension/subagents/state.d.ts.map +1 -0
- package/dist/pi-extension/subagents/state.js +92 -0
- package/dist/pi-extension/subagents/state.js.map +1 -0
- package/dist/pi-extension/subagents/task-models.d.ts +9 -0
- package/dist/pi-extension/subagents/task-models.d.ts.map +1 -0
- package/dist/pi-extension/subagents/task-models.js +293 -0
- package/dist/pi-extension/subagents/task-models.js.map +1 -0
- package/dist/pi-extension/subagents/tool-boundary.d.ts +16 -0
- package/dist/pi-extension/subagents/tool-boundary.d.ts.map +1 -0
- package/dist/pi-extension/subagents/tool-boundary.js +53 -0
- package/dist/pi-extension/subagents/tool-boundary.js.map +1 -0
- package/dist/pi-extension/subagents/worktree-tools.d.ts +16 -0
- package/dist/pi-extension/subagents/worktree-tools.d.ts.map +1 -0
- package/dist/pi-extension/subagents/worktree-tools.js +185 -0
- package/dist/pi-extension/subagents/worktree-tools.js.map +1 -0
- package/dist/provenance.json +5 -0
- package/package.json +540 -27
- package/index.d.ts +0 -1
- package/index.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-operations.js","sourceRoot":"","sources":["../../../maestro/runtime/worktree-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACN,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAmB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAO7E,OAAO,EACN,kBAAkB,EAClB,qBAAqB,GAKrB,MAAM,qBAAqB,CAAC;AAE7B,S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AC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB;IACvC,OAAO;QACN,gBAAgB;QAChB,2BAA2B;QAC3B,qBAAqB;QACrB,sBAAsB;QACtB,qBAAqB;KACrB,CAAC;AACH,CAAC","sourcesContent":["import { execFileSync, spawn } from \"node:child_process\";\nimport {\n\texistsSync,\n\tmkdirSync,\n\trenameSync,\n\tlstatSync,\n\treaddirSync,\n\treadFileSync,\n\twriteFileSync,\n\tunlinkSync,\n} from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { isRecord, type JsonObject } from \"../core/config/type-guards.ts\";\nimport { gitEnvironment } from \"../core/git-environment.ts\";\nimport { Deadline } from \"../core/deadline.ts\";\nimport { realpathWithoutOpening } from \"../core/realpath-without-opening.ts\";\nimport type { SurfaceProvider } from \"../core/surface-provider.ts\";\nimport type {\n\tCleanupGitState,\n\tHolderInspection,\n\tWorktreeCleanupOperations,\n} from \"../core/worktree-cleanup.ts\";\nimport {\n\tisWorktreeManifest,\n\tmergeWorktreeManifest,\n\ttype WorktreeLaunch,\n\ttype WorktreeHandoff,\n\ttype WorktreeResultState,\n\ttype WorktreeOperations,\n} from \"../core/worktree.ts\";\n\nfunction message(error: any): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\nfunction contained(root: string, path: string): boolean {\n\tconst rel = relative(root, path);\n\treturn (\n\t\trel === \"\" ||\n\t\t(rel !== \"..\" && !rel.startsWith(`..${sep}`) && !isAbsolute(rel))\n\t);\n}\n\nexport const GIT_BASE_TIMEOUT_MS = 10_000;\nexport const GIT_SOURCE_TIMEOUT_MS = 15_000;\nexport const GIT_HANDOFF_TIMEOUT_MS = 15_000;\nconst GIT_OUTPUT_BYTES = 1024 * 1024;\n\n/** One owned read client; expiry bounds the wait even if descendants hold pipes. */\nasync function gitRead(\n\tcwd: string,\n\targs: string[],\n\tdeadline: Deadline,\n): Promise<string> {\n\tconst timeout = deadline.remainingMs();\n\treturn new Promise((resolve, reject) => {\n\t\tconst child = spawn(\"git\", args, {\n\t\t\tcwd,\n\t\t\tenv: gitEnvironment(),\n\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\tdetached: process.platform !== \"win32\",\n\t\t});\n\t\tlet settled = false,\n\t\t\tbytes = 0,\n\t\t\terrorBytes = 0;\n\t\tconst output: Buffer[] = [],\n\t\t\terrors: Buffer[] = [];\n\t\tconst fail = (error: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tclearTimeout(timer);\n\t\t\ttry {\n\t\t\t\tif (process.platform !== \"win32\" && child.pid)\n\t\t\t\t\tprocess.kill(-child.pid, \"SIGKILL\");\n\t\t\t\telse child.kill(\"SIGKILL\");\n\t\t\t} catch {\n\t\t\t\t/* already exited */\n\t\t\t}\n\t\t\tchild.stdout.destroy();\n\t\t\tchild.stderr.destroy();\n\t\t\tchild.unref();\n\t\t\treject(error);\n\t\t};\n\t\tconst timer = setTimeout(\n\t\t\t() => fail(new Error(\"Git inspection deadline exceeded\")),\n\t\t\ttimeout,\n\t\t);\n\t\tchild.on(\"error\", fail);\n\t\tchild.stdout.on(\"data\", (chunk: Buffer) => {\n\t\t\tbytes += chunk.length;\n\t\t\tif (bytes > GIT_OUTPUT_BYTES)\n\t\t\t\tfail(new Error(\"Git output limit exceeded\"));\n\t\t\telse output.push(chunk);\n\t\t});\n\t\tchild.stderr.on(\"data\", (chunk: Buffer) => {\n\t\t\terrorBytes += chunk.length;\n\t\t\tif (errorBytes > GIT_OUTPUT_BYTES)\n\t\t\t\tfail(new Error(\"Git error output limit exceeded\"));\n\t\t\telse errors.push(chunk);\n\t\t});\n\t\tchild.on(\"close\", (code, signal) => {\n\t\t\tif (settled) return;\n\t\t\tif (deadline.expired())\n\t\t\t\treturn fail(new Error(\"Git inspection deadline exceeded\"));\n\t\t\tif (code !== 0)\n\t\t\t\treturn fail(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Git exited ${code ?? signal}: ${Buffer.concat(errors).toString(\"utf8\")}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\tsettled = true;\n\t\t\tclearTimeout(timer);\n\t\t\tresolve(Buffer.concat(output).toString(\"utf8\"));\n\t\t});\n\t});\n}\n\nfunction gitSha(output: string): string {\n\tconst sha = output.trim();\n\tif (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(sha))\n\t\tthrow new Error(\"Git returned an invalid commit SHA\");\n\treturn sha;\n}\n\nexport async function resolveGitCommit(\n\tcwd: string,\n\tref: string,\n): Promise<string> {\n\treturn gitSha(\n\t\tawait gitRead(\n\t\t\tcwd,\n\t\t\t[\"rev-parse\", \"--verify\", `${ref}^{commit}`],\n\t\t\tDeadline.after(GIT_BASE_TIMEOUT_MS),\n\t\t),\n\t);\n}\n\nexport async function resolveWorktreeProvisionCwd(\n\tsourceCwd: string,\n): Promise<string> {\n\tconst deadline = Deadline.after(GIT_SOURCE_TIMEOUT_MS);\n\tlet gitDir: string;\n\tlet commonDir: string;\n\ttry {\n\t\tgitDir = await resolveGitPath(sourceCwd, \"--git-dir\", deadline);\n\t\tcommonDir = await resolveGitPath(sourceCwd, \"--git-common-dir\", deadline);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Unable to identify the Git checkout for worktree provisioning from ${sourceCwd}: ${errorMessage(error)}`,\n\t\t);\n\t}\n\tif (gitDir === commonDir) return sourceCwd;\n\n\ttry {\n\t\tconst output = await gitRead(\n\t\t\tsourceCwd,\n\t\t\t[\"worktree\", \"list\", \"--porcelain\", \"-z\"],\n\t\t\tdeadline,\n\t\t);\n\t\tconst principal = output\n\t\t\t.split(\"\\0\")\n\t\t\t.find((record) => record.startsWith(\"worktree \"))\n\t\t\t?.slice(\"worktree \".length);\n\t\tif (!principal) throw new Error(\"Git returned no principal worktree\");\n\t\treturn principal;\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Unable to determine the principal Git checkout for linked worktree ${sourceCwd}: ${errorMessage(error)}`,\n\t\t);\n\t}\n}\n\nasync function resolveGitPath(\n\tcwd: string,\n\tflag: \"--git-dir\" | \"--git-common-dir\",\n\tdeadline: Deadline,\n): Promise<string> {\n\tconst output = await gitRead(\n\t\tcwd,\n\t\t[\"rev-parse\", \"--path-format=absolute\", flag],\n\t\tdeadline,\n\t);\n\tif (!output || output === \"\\n\")\n\t\tthrow new Error(\"Git returned no checkout path\");\n\treturn output.endsWith(\"\\n\") ? output.slice(0, -1) : output;\n}\n\nexport function readWorktreeManifest(path: string): JsonObject | undefined {\n\ttry {\n\t\tconst value: unknown = JSON.parse(readFileSync(path, \"utf8\"));\n\t\tif (isRecord(value) && isWorktreeManifest(value)) return value;\n\t} catch {\n\t\t// Unreachable or malformed manifests do not establish ownership.\n\t}\n\treturn undefined;\n}\n\nexport function writeWorktreeManifest(path: string, value: JsonObject): void {\n\tmkdirSync(dirname(path), { recursive: true });\n\tlet existing: JsonObject = {};\n\tif (existsSync(path)) {\n\t\ttry {\n\t\t\texisting = JSON.parse(readFileSync(path, \"utf8\"));\n\t\t} catch {\n\t\t\texisting = {};\n\t\t}\n\t}\n\tconst tempPath = `${path}.tmp`;\n\twriteFileSync(\n\t\ttempPath,\n\t\t`${JSON.stringify(\n\t\t\tmergeWorktreeManifest(existing, value, Date.now()),\n\t\t\tnull,\n\t\t\t2,\n\t\t)}\\n`,\n\t);\n\trenameSync(tempPath, path);\n}\n\nasync function gitPathList(\n\tcwd: string,\n\targs: string[],\n\tdeadline: Deadline,\n): Promise<string[]> {\n\tconst output = await gitRead(cwd, args, deadline);\n\tif (output && !output.endsWith(\"\\0\"))\n\t\tthrow new Error(\"Git returned an incomplete NUL filename list\");\n\treturn output.split(\"\\0\").filter(Boolean);\n}\n\nexport async function captureWorktreeHandoff(\n\tworktree: WorktreeLaunch,\n\ttimeoutMs = GIT_HANDOFF_TIMEOUT_MS,\n): Promise<WorktreeHandoff> {\n\tconst deadline = Deadline.after(timeoutMs);\n\ttry {\n\t\tconst headSha = gitSha(\n\t\t\tawait gitRead(\n\t\t\t\tworktree.path,\n\t\t\t\t[\"rev-parse\", \"--verify\", \"HEAD^{commit}\"],\n\t\t\t\tdeadline,\n\t\t\t),\n\t\t);\n\t\tconst status = await gitRead(\n\t\t\tworktree.path,\n\t\t\t[\"status\", \"--porcelain=v1\", \"--untracked-files=all\", \"-z\"],\n\t\t\tdeadline,\n\t\t);\n\t\tif (status && !status.endsWith(\"\\0\"))\n\t\t\tthrow new Error(\"Git returned incomplete status\");\n\t\tconst untrackedFiles = await gitPathList(\n\t\t\tworktree.path,\n\t\t\t[\"ls-files\", \"--others\", \"--exclude-standard\", \"-z\"],\n\t\t\tdeadline,\n\t\t);\n\t\tconst conflictedFiles = await gitPathList(\n\t\t\tworktree.path,\n\t\t\t[\"diff\", \"--name-only\", \"--diff-filter=U\", \"-z\"],\n\t\t\tdeadline,\n\t\t);\n\t\tconst changedFiles = new Set([\n\t\t\t...(await gitPathList(\n\t\t\t\tworktree.path,\n\t\t\t\t[\"diff\", \"--name-only\", \"-z\", `${worktree.baseSha}...HEAD`],\n\t\t\t\tdeadline,\n\t\t\t)),\n\t\t\t...(await gitPathList(\n\t\t\t\tworktree.path,\n\t\t\t\t[\"diff\", \"--name-only\", \"-z\"],\n\t\t\t\tdeadline,\n\t\t\t)),\n\t\t\t...(await gitPathList(\n\t\t\t\tworktree.path,\n\t\t\t\t[\"diff\", \"--cached\", \"--name-only\", \"-z\"],\n\t\t\t\tdeadline,\n\t\t\t)),\n\t\t\t...untrackedFiles,\n\t\t]);\n\t\tconst count = (\n\t\t\tawait gitRead(\n\t\t\t\tworktree.path,\n\t\t\t\t[\"rev-list\", \"--count\", `${worktree.baseSha}..HEAD`],\n\t\t\t\tdeadline,\n\t\t\t)\n\t\t).trim();\n\t\tconst commitsAhead = Number(count);\n\t\tif (!/^(0|[1-9][0-9]*)$/.test(count) || !Number.isSafeInteger(commitsAhead))\n\t\t\tthrow new Error(\"Git returned an invalid commit count\");\n\t\treturn {\n\t\t\t...worktree,\n\t\t\theadSha,\n\t\t\tcommitsAhead,\n\t\t\tclean: status.length === 0,\n\t\t\tconflicted: conflictedFiles.length > 0,\n\t\t\tchangedFiles: [...changedFiles].sort(),\n\t\t\tuntrackedFiles: untrackedFiles.sort(),\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\t...worktree,\n\t\t\theadSha: null,\n\t\t\tcommitsAhead: null,\n\t\t\tclean: null,\n\t\t\tconflicted: null,\n\t\t\tchangedFiles: null,\n\t\t\tuntrackedFiles: null,\n\t\t\tgitError: errorMessage(error),\n\t\t};\n\t}\n}\n\nexport function persistWorktreeResult(\n\tworktree: WorktreeLaunch,\n\tstate: WorktreeResultState,\n\thandoff?: WorktreeHandoff,\n): void {\n\twriteWorktreeManifest(worktree.manifestFile, {\n\t\tstate,\n\t\t...worktree,\n\t\t...handoff,\n\t});\n}\n\nfunction errorMessage(error: any): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n\nconst CLEANUP_TIMEOUT_MS = 30_000;\n\nfunction git(cwd: string, args: string[]): string {\n\treturn execFileSync(\"git\", args, {\n\t\tcwd,\n\t\tenv: gitEnvironment(),\n\t\tencoding: \"utf8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\ttimeout: CLEANUP_TIMEOUT_MS,\n\t\tkillSignal: \"SIGKILL\",\n\t});\n}\nfunction exists(path: string): boolean {\n\ttry {\n\t\tlstatSync(path);\n\t\treturn true;\n\t} catch (error) {\n\t\t// SAFETY: filesystem calls throw Node errors with an optional errno code.\n\t\tif ((error as NodeJS.ErrnoException).code === \"ENOENT\") return false;\n\t\tthrow error;\n\t}\n}\nfunction directories(path: string): string[] {\n\tif (!exists(path)) return [];\n\treturn readdirSync(path, { withFileTypes: true })\n\t\t.filter((item) => item.isDirectory() || item.isSymbolicLink())\n\t\t.map((item) => join(path, item.name));\n}\n\n/** Source identity is resolved independently of status so Git failures remain visible. */\nfunction resolveSource(path: string): string {\n\tconst common = realpathWithoutOpening(\n\t\tgit(path, [\n\t\t\t\"rev-parse\",\n\t\t\t\"--path-format=absolute\",\n\t\t\t\"--git-common-dir\",\n\t\t]).trim(),\n\t);\n\t// A submodule's common directory lives under the superproject's\n\t// .git/modules; only core.worktree, including included config, names its checkout.\n\tconst configured = git(common, [\n\t\t`--git-dir=${common}`,\n\t\t\"config\",\n\t\t\"--default\",\n\t\t\"\",\n\t\t\"--get\",\n\t\t\"core.worktree\",\n\t]).trim();\n\tconst root = realpathWithoutOpening(\n\t\tconfigured ? resolve(common, configured) : dirname(common),\n\t);\n\tif (\n\t\trealpathWithoutOpening(\n\t\t\tgit(root, [\"rev-parse\", \"--show-toplevel\"]).trim(),\n\t\t) !== root\n\t)\n\t\tthrow new Error(\"Cannot prove source repository root\");\n\tif (\n\t\trealpathWithoutOpening(\n\t\t\tgit(root, [\n\t\t\t\t\"rev-parse\",\n\t\t\t\t\"--path-format=absolute\",\n\t\t\t\t\"--git-common-dir\",\n\t\t\t]).trim(),\n\t\t) !== common\n\t)\n\t\tthrow new Error(\"Source Git directory mismatch\");\n\treturn root;\n}\n/** Count NUL-delimited file paths without retaining the ignored-file listing. */\nfunction countIgnoredFiles(cwd: string): Promise<number> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst child = spawn(\n\t\t\t\"git\",\n\t\t\t[\"ls-files\", \"--others\", \"--ignored\", \"--exclude-standard\", \"-z\"],\n\t\t\t{\n\t\t\t\tcwd,\n\t\t\t\tenv: gitEnvironment(),\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\t\ttimeout: CLEANUP_TIMEOUT_MS,\n\t\t\t\tkillSignal: \"SIGKILL\",\n\t\t\t},\n\t\t);\n\t\tlet count = 0;\n\t\tchild.stdout.on(\"data\", (chunk: Buffer) => {\n\t\t\tfor (const byte of chunk) if (byte === 0) count++;\n\t\t});\n\t\tchild.on(\"error\", reject);\n\t\tchild.on(\"close\", (code, signal) => {\n\t\t\tif (code === 0) resolve(count);\n\t\t\telse\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Ignored-file inspection failed (${signal ?? `exit ${code}`})`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t});\n\t});\n}\n\nasync function inspectGit(\n\tpath: string,\n\tsourceRepo: string,\n): Promise<CleanupGitState> {\n\tconst records = git(sourceRepo, [\"worktree\", \"list\", \"--porcelain\", \"-z\"])\n\t\t.split(\"\\0\\0\")\n\t\t.map((record) => record.split(\"\\0\"));\n\tconst record = records.find((fields) => {\n\t\tif (!fields[0]?.startsWith(\"worktree \")) return false;\n\t\tconst registeredPath = fields[0].slice(\"worktree \".length);\n\t\treturn (\n\t\t\texists(registeredPath) && realpathWithoutOpening(registeredPath) === path\n\t\t);\n\t});\n\t// rev-parse returns HEAD for a detached checkout, without treating a valid\n\t// detached state as an inspection error. Only named refs may be preserved.\n\tconst headRef = git(path, [\n\t\t\"rev-parse\",\n\t\t\"--symbolic-full-name\",\n\t\t\"HEAD\",\n\t]).trim();\n\tconst branch = headRef.startsWith(\"refs/heads/\")\n\t\t? headRef.slice(\"refs/heads/\".length)\n\t\t: \"\";\n\tconst status = git(path, [\n\t\t\"status\",\n\t\t\"--porcelain=v1\",\n\t\t\"--untracked-files=all\",\n\t\t\"-z\",\n\t]);\n\tlet dirtyFiles = 0;\n\tconst fields = status.split(\"\\0\");\n\tfor (let i = 0; i < fields.length; i++) {\n\t\tif (!fields[i]) continue;\n\t\tdirtyFiles++;\n\t\tif (/^[RC]|^.[RC]/.test(fields[i])) i++;\n\t}\n\treturn {\n\t\tbranch,\n\t\theadSha: git(path, [\"rev-parse\", \"HEAD\"]).trim(),\n\t\tregistered:\n\t\t\t!!record &&\n\t\t\tpath !== sourceRepo &&\n\t\t\t(branch\n\t\t\t\t? record.includes(`branch refs/heads/${branch}`)\n\t\t\t\t: record.includes(\"detached\")),\n\t\tlocked: !!record?.some(\n\t\t\t(field) => field === \"locked\" || field.startsWith(\"locked \"),\n\t\t),\n\t\tdirtyFiles,\n\t\tuntrackedFiles: git(path, [\n\t\t\t\"ls-files\",\n\t\t\t\"--others\",\n\t\t\t\"--exclude-standard\",\n\t\t\t\"-z\",\n\t\t])\n\t\t\t.split(\"\\0\")\n\t\t\t.filter(Boolean).length,\n\t\tignoredFiles: await countIgnoredFiles(path),\n\t\tconflicts: git(path, [\"diff\", \"--name-only\", \"--diff-filter=U\", \"-z\"])\n\t\t\t.split(\"\\0\")\n\t\t\t.filter(Boolean).length,\n\t\tsubmodules: git(path, [\"submodule\", \"status\", \"--recursive\"])\n\t\t\t.split(\"\\n\")\n\t\t\t.some((line) => line.length > 0 && !line.startsWith(\"-\")),\n\t};\n}\n\n/** Individual visibility gaps warn; failed enumeration still blocks cleanup. */\nfunction processHolders(\n\tpath: string,\n\tidleShellPids = new Set<number>(),\n\tprocRoot = \"/proc\",\n\tplatform: NodeJS.Platform = process.platform,\n): HolderInspection {\n\tconst blockers: string[] = [];\n\tconst unreadable = new Set<string>();\n\tconst shellNames = new Set([\"bash\", \"zsh\", \"fish\", \"sh\", \"dash\"]);\n\tconst checkout =\n\t\tplatform === \"linux\" || platform === \"darwin\"\n\t\t\t? realpathWithoutOpening(path)\n\t\t\t: path;\n\tif (!process.getuid) throw new Error(\"Process user identity unavailable\");\n\tconst uid = process.getuid();\n\tif (platform === \"linux\") {\n\t\t// Keep enumeration outside the per-process guard: total failure is a blocker.\n\t\tconst pids = readdirSync(procRoot).filter((name) => /^\\d+$/.test(name));\n\t\tif (!pids.length) throw new Error(\"Process enumeration returned no PIDs\");\n\t\tfor (const pid of pids) {\n\t\t\ttry {\n\t\t\t\tif (lstatSync(`${procRoot}/${pid}`).uid !== uid) continue;\n\t\t\t\tlet command = \"\";\n\t\t\t\ttry {\n\t\t\t\t\tcommand = readFileSync(`${procRoot}/${pid}/comm`, \"utf8\").trim();\n\t\t\t\t} catch {\n\t\t\t\t\t// An unreadable name cannot exempt a runtime or hide a readable cwd.\n\t\t\t\t\tunreadable.add(pid);\n\t\t\t\t}\n\t\t\t\t// A shell can exec a runtime without changing PID/process group.\n\t\t\t\tif (idleShellPids.has(Number(pid)) && shellNames.has(command)) continue;\n\t\t\t\tlet cwd: string;\n\t\t\t\ttry {\n\t\t\t\t\tcwd = realpathWithoutOpening(`${procRoot}/${pid}/cwd`);\n\t\t\t\t} catch (cwdError) {\n\t\t\t\t\t// SAFETY: filesystem probes throw Node errors with an optional errno code.\n\t\t\t\t\tconst code = (cwdError as NodeJS.ErrnoException).code ?? \"\";\n\t\t\t\t\tif ([\"ENOENT\", \"ESRCH\"].includes(code)) throw cwdError;\n\t\t\t\t\t// Same-uid agents can deny stat and readlink here while staying live.\n\t\t\t\t\tunreadable.add(pid);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (contained(checkout, cwd))\n\t\t\t\t\tblockers.push(`Live process ${pid} holds the checkout`);\n\t\t\t} catch (error) {\n\t\t\t\t// SAFETY: filesystem probes throw Node errors with an optional errno code.\n\t\t\t\tif (\n\t\t\t\t\t[\"ENOENT\", \"ESRCH\"].includes(\n\t\t\t\t\t\t(error as NodeJS.ErrnoException).code ?? \"\",\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Confirm disappearance without opening: a dangling /proc\n\t\t\t\t\t\t// entry must not look like a live holder.\n\t\t\t\t\t\trealpathWithoutOpening(`${procRoot}/${pid}`);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t/^State:\\s+[ZX]/m.test(\n\t\t\t\t\t\t\t\treadFileSync(`${procRoot}/${pid}/status`, \"utf8\"),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tunreadable.delete(pid);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Missing status alone is not proof of process disappearance.\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\trealpathWithoutOpening(`${procRoot}/${pid}`);\n\t\t\t\t\t\t} catch (presenceError) {\n\t\t\t\t\t\t\t// SAFETY: these are Node filesystem errors.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"ENOENT\", \"ESRCH\"].includes(\n\t\t\t\t\t\t\t\t\t(presenceError as NodeJS.ErrnoException).code ?? \"\",\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tunreadable.delete(pid);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tunreadable.add(pid);\n\t\t\t}\n\t\t}\n\t} else if (platform === \"darwin\") {\n\t\t// A nonzero lsof exit is a global failure, even if partial stdout exists.\n\t\tlet output: string;\n\t\ttry {\n\t\t\toutput = execFileSync(\n\t\t\t\t\"lsof\",\n\t\t\t\t[\"-n\", \"-P\", \"-a\", \"-u\", String(uid), \"-d\", \"cwd\", \"-Fpcn\"],\n\t\t\t\t{\n\t\t\t\t\tencoding: \"utf8\",\n\t\t\t\t\ttimeout: CLEANUP_TIMEOUT_MS,\n\t\t\t\t\tkillSignal: \"SIGKILL\",\n\t\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\t},\n\t\t\t);\n\t\t} catch {\n\t\t\t// Command errors may embed partial process output; never disclose it.\n\t\t\tthrow new Error(\"lsof failed to enumerate processes\");\n\t\t}\n\t\tconst records = output.split(/^p/m).slice(1);\n\t\tif (!records.length)\n\t\t\tthrow new Error(\"Process enumeration returned no PIDs\");\n\t\tfor (const record of records) {\n\t\t\tconst [pid, ...fields] = record.split(\"\\n\");\n\t\t\tif (!/^\\d+$/.test(pid))\n\t\t\t\tthrow new Error(\"Invalid process enumeration record\");\n\t\t\tconst command = fields.find((line) => line.startsWith(\"c\"))?.slice(1);\n\t\t\tif (idleShellPids.has(Number(pid)) && command && shellNames.has(command))\n\t\t\t\tcontinue;\n\t\t\tconst cwd = fields.find((line) => line.startsWith(\"n\"))?.slice(1);\n\t\t\tif (!command) unreadable.add(pid);\n\t\t\ttry {\n\t\t\t\tif (!cwd || !isAbsolute(cwd))\n\t\t\t\t\tthrow new Error(\"Process cwd unavailable\");\n\t\t\t\t// Every same-user cwd is resolved, so this must never open a path.\n\t\t\t\tif (contained(checkout, realpathWithoutOpening(cwd)))\n\t\t\t\t\tblockers.push(`Live process ${pid} holds the checkout`);\n\t\t\t} catch {\n\t\t\t\tunreadable.add(pid);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tthrow new Error(`Process inspection unsupported on ${platform}`);\n\t}\n\tconst warnings = [\n\t\t\"Incomplete process coverage: same-user inspection is permission-limited; other-user processes are not inspected. A protected process could hold the checkout undetected.\",\n\t];\n\tif (unreadable.size)\n\t\twarnings.push(\n\t\t\t`${unreadable.size} process(es) (PIDs ${[...unreadable].slice(0, 10).join(\", \")}${unreadable.size > 10 ? \", …\" : \"\"}) have unreadable details; not proven unrelated to the checkout.`,\n\t\t);\n\treturn { blockers, warnings };\n}\n\nexport const __worktreeCleanupTest__ = {\n\tprocessHolders,\n\trealpathWithoutOpening,\n};\n\nexport function createWorktreeCleanupOperations(\n\tprovider: SurfaceProvider,\n\tinput: {\n\t\tmanifestDir: string;\n\t\tliveHolders: () => { path: string; persistent?: boolean }[];\n\t\tmanagedRoot?: string;\n\t},\n): WorktreeCleanupOperations {\n\tconst root = input.managedRoot ?? join(homedir(), \".herdr\", \"worktrees\");\n\tlet canonicalRoot: string;\n\treturn {\n\t\tmanagedRoot: () => canonicalRoot ?? realpathWithoutOpening(root),\n\t\tscan: () => {\n\t\t\tif (!exists(root)) return [];\n\t\t\tcanonicalRoot = realpathWithoutOpening(root);\n\t\t\tconst checkouts: string[] = [];\n\t\t\tfor (const repo of directories(canonicalRoot)) {\n\t\t\t\tlet resolvedRepo: string;\n\t\t\t\ttry {\n\t\t\t\t\tresolvedRepo = realpathWithoutOpening(repo);\n\t\t\t\t} catch {\n\t\t\t\t\t// Unresolvable residue stays out of the inventory rather than\n\t\t\t\t\t// blocking the whole scan; callers never see it as eligible.\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// Never readdir a managed entry until containment is proven without\n\t\t\t\t// opening: a symlink to a protected directory would freeze Pi.\n\t\t\t\tif (!contained(canonicalRoot, resolvedRepo)) continue;\n\t\t\t\tcheckouts.push(...directories(resolvedRepo));\n\t\t\t}\n\t\t\treturn checkouts;\n\t\t},\n\t\trealpath: realpathWithoutOpening,\n\t\tresolveSource,\n\t\tinspectGit,\n\t\tlistWorktrees: (source) =>\n\t\t\tprovider.listWorktreeSurfaces({\n\t\t\t\tcwd: source,\n\t\t\t\ttimeoutMs: CLEANUP_TIMEOUT_MS,\n\t\t\t}),\n\t\treadManifests: () => {\n\t\t\tif (!exists(input.manifestDir)) return [];\n\t\t\treturn readdirSync(input.manifestDir)\n\t\t\t\t.filter((name) => name.endsWith(\".json\"))\n\t\t\t\t.flatMap((name) => {\n\t\t\t\t\tconst file = join(input.manifestDir, name);\n\t\t\t\t\tconst value = readWorktreeManifest(file);\n\t\t\t\t\treturn value ? [{ file, value }] : [];\n\t\t\t\t});\n\t\t},\n\t\tholders: async (entry) => {\n\t\t\tconst blockers: string[] = input\n\t\t\t\t.liveHolders()\n\t\t\t\t.filter((holder) => realpathWithoutOpening(holder.path) === entry.path)\n\t\t\t\t.map((holder) =>\n\t\t\t\t\tholder.persistent\n\t\t\t\t\t\t? \"Persistent-specialist lease holds the worktree\"\n\t\t\t\t\t\t: \"Live child holds the worktree\",\n\t\t\t\t);\n\t\t\tconst idleShellPids = new Set<number>();\n\t\t\tif (entry.workspaceId) {\n\t\t\t\tconst panes = await provider.listSurfaces({\n\t\t\t\t\ttimeoutMs: CLEANUP_TIMEOUT_MS,\n\t\t\t\t});\n\t\t\t\tif (!panes) throw new Error(\"Herdr pane snapshot unavailable\");\n\t\t\t\tconst owned = panes.filter(\n\t\t\t\t\t(pane) => pane.workspaceId === entry.workspaceId,\n\t\t\t\t);\n\t\t\t\tif (!owned.length)\n\t\t\t\t\tthrow new Error(\"Open workspace has no observable panes\");\n\t\t\t\tfor (const pane of owned) {\n\t\t\t\t\tconst info = await provider.getProcessInfo(pane.id, {\n\t\t\t\t\t\ttimeoutMs: CLEANUP_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\tif (!info.shellPid || !info.foregroundProcessGroupId)\n\t\t\t\t\t\tthrow new Error(`Process state unknown for pane ${pane.id}`);\n\t\t\t\t\t// Exempt only Herdr's observed idle retained shell, never a runtime\n\t\t\t\t\t// name or a shell running a foreground command.\n\t\t\t\t\tif (info.foregroundProcessGroupId === info.shellPid)\n\t\t\t\t\t\tidleShellPids.add(info.shellPid);\n\t\t\t\t\telse\n\t\t\t\t\t\tblockers.push(\n\t\t\t\t\t\t\t`Live child or foreground process in pane ${pane.id}`,\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst inspection = processHolders(entry.path, idleShellPids);\n\t\t\t\treturn {\n\t\t\t\t\tblockers: [...blockers, ...inspection.blockers],\n\t\t\t\t\twarnings: inspection.warnings,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\t// Preserve known children and leases even when global inspection fails.\n\t\t\t\treturn {\n\t\t\t\t\tblockers: [\n\t\t\t\t\t\t...blockers,\n\t\t\t\t\t\t`Process inspection unavailable: ${message(error)}`,\n\t\t\t\t\t],\n\t\t\t\t\twarnings: [],\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\texists,\n\t\tpreserve: (entry) => {\n\t\t\tif (\n\t\t\t\t!entry.branch ||\n\t\t\t\tgit(entry.path, [\"symbolic-ref\", \"--short\", \"HEAD\"]).trim() !==\n\t\t\t\t\tentry.branch\n\t\t\t)\n\t\t\t\tthrow new Error(\"Retained branch changed before preservation\");\n\t\t\tconst index = git(entry.path, [\n\t\t\t\t\"rev-parse\",\n\t\t\t\t\"--path-format=absolute\",\n\t\t\t\t\"--git-path\",\n\t\t\t\t\"index\",\n\t\t\t]).trim();\n\t\t\tconst originalIndex = exists(index) ? readFileSync(index) : undefined;\n\t\t\ttry {\n\t\t\t\tgit(entry.path, [\"add\", \"-A\"]);\n\t\t\t\tgit(entry.path, [\n\t\t\t\t\t\"commit\",\n\t\t\t\t\t\"-m\",\n\t\t\t\t\t\"WIP: preserve worktree before explicit cleanup\",\n\t\t\t\t]);\n\t\t\t} catch (error) {\n\t\t\t\tif (originalIndex) writeFileSync(index, originalIndex);\n\t\t\t\telse if (exists(index)) unlinkSync(index);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn git(entry.path, [\"rev-parse\", \"HEAD\"]).trim();\n\t\t},\n\t\tremoveWorkspace: (id) =>\n\t\t\tprovider.removeWorktreeSurface(id, { timeoutMs: CLEANUP_TIMEOUT_MS }),\n\t\treportOpenedPrimaryWorkspace: (sourceRepo, claims) =>\n\t\t\tprovider.reportOpenedPrimaryWorkspace({ sourceRepo, claims }),\n\t\tremoveCheckout: (source, path) => {\n\t\t\tgit(source, [\"worktree\", \"remove\", \"--\", path]);\n\t\t},\n\t\tprune: (source) => {\n\t\t\tgit(source, [\"worktree\", \"prune\"]);\n\t\t},\n\t\twriteManifest: (file, value) => {\n\t\t\tif (!readWorktreeManifest(file))\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Manifest ownership became unavailable; checkout removed but manifest unchanged\",\n\t\t\t\t);\n\t\t\twriteWorktreeManifest(file, value);\n\t\t},\n\t};\n}\n\nexport function createWorktreeOperations(): WorktreeOperations {\n\treturn {\n\t\tresolveGitCommit,\n\t\tresolveWorktreeProvisionCwd,\n\t\twriteWorktreeManifest,\n\t\tcaptureWorktreeHandoff,\n\t\tpersistWorktreeResult,\n\t};\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { OpenedPrimaryWorkspaceReport } from "../../core/opened-primary-workspace.ts";
|
|
2
|
+
import type { CreateSurfaceOptions, CreateWorktreeSurfaceOptions, ReportOpenedPrimaryWorkspaceInput, SurfaceInfo, SurfaceProcessInfo, SurfaceProvider, WorktreeSurface, WorktreeSurfaceInfo } from "../../core/surface-provider.ts";
|
|
3
|
+
import type { PaneInspection, SurfaceHandle } from "../../core/types.ts";
|
|
4
|
+
interface FakeSurfaceProviderOptions {
|
|
5
|
+
maxPerTab?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class FakeSurfaceProvider implements SurfaceProvider {
|
|
8
|
+
#private;
|
|
9
|
+
readonly name = "fake";
|
|
10
|
+
constructor(options?: FakeSurfaceProviderOptions);
|
|
11
|
+
isAvailable(): boolean;
|
|
12
|
+
createSurface(opts: CreateSurfaceOptions): string;
|
|
13
|
+
runCommand(surfaceId: string, command: string): void;
|
|
14
|
+
readScreen(surfaceId: string, lines?: number): string;
|
|
15
|
+
closeSurface(surfaceId: string): void;
|
|
16
|
+
listSurfaces(_opts?: {
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}): SurfaceInfo[];
|
|
19
|
+
attachSurface(id: string): SurfaceHandle;
|
|
20
|
+
createWorktreeSurface(opts: CreateWorktreeSurfaceOptions): WorktreeSurface;
|
|
21
|
+
removeWorktreeSurface(workspaceId: string, _opts?: {
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
}): void;
|
|
24
|
+
reportOpenedPrimaryWorkspace(_input: ReportOpenedPrimaryWorkspaceInput): OpenedPrimaryWorkspaceReport | undefined;
|
|
25
|
+
setupHint(): string;
|
|
26
|
+
runScript(surfaceId: string, command: string, options: {
|
|
27
|
+
scriptPath: string;
|
|
28
|
+
scriptPreamble: string;
|
|
29
|
+
}): string;
|
|
30
|
+
inspectSurface(surfaceId: string): Promise<PaneInspection>;
|
|
31
|
+
sendKeys(surfaceId: string, keys: string): void;
|
|
32
|
+
getProcessInfo(surfaceId: string, _opts?: {
|
|
33
|
+
timeoutMs?: number;
|
|
34
|
+
}): SurfaceProcessInfo;
|
|
35
|
+
waitForShellReady(surfaceId: string): Promise<void>;
|
|
36
|
+
waitForSurfaceAbsence(surfaceId: string, opts?: {
|
|
37
|
+
timeoutMs?: number;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
listWorktreeSurfaces(opts?: {
|
|
40
|
+
cwd?: string;
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
}): Promise<WorktreeSurfaceInfo[]>;
|
|
43
|
+
focusWorkspace(workspaceId: string): void;
|
|
44
|
+
setTitle(target: "tab" | "workspace", title: string): void;
|
|
45
|
+
scriptInspection(surfaceId: string, inspection: PaneInspection): void;
|
|
46
|
+
appendScreen(surfaceId: string, text: string): void;
|
|
47
|
+
commands(surfaceId: string): string[];
|
|
48
|
+
recordWorktreeInfo(info: WorktreeSurfaceInfo, opts?: {
|
|
49
|
+
cwd?: string;
|
|
50
|
+
}): void;
|
|
51
|
+
removeSurface(surfaceId: string): void;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=fake-surface-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-surface-provider.d.ts","sourceRoot":"","sources":["../../../../maestro/surfaces/fake/fake-surface-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,KAAK,EACX,oBAAoB,EACpB,4BAA4B,EAC5B,iCAAiC,EACjC,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAczE,UAAU,0BAA0B;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,mBAAoB,YAAW,eAAe;;IAC1D,QAAQ,CAAC,IAAI,UAAU;gBAWX,OAAO,GAAE,0BAA+B;IAIpD,WAAW,IAAI,OAAO;IAItB,aAAa,C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AO,GAC/B,OAAO,CAAC,IAAI,CAAC;IAOV,oBAAoB,CAAC,IAAI,CAAC,EAAE;QACjC,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAalC,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIzC,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1D,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,GAAG,IAAI;IAIrE,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAInD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAIrC,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAI5E,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CA0CtC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
export class FakeSurfaceProvider {
|
|
3
|
+
name = "fake";
|
|
4
|
+
#nextSurface = 1;
|
|
5
|
+
#nextWorkspace = 1;
|
|
6
|
+
#nextWorkspaceGroup = 1;
|
|
7
|
+
#maxPerTab;
|
|
8
|
+
#surfaces = new Map();
|
|
9
|
+
#worktrees = new Map();
|
|
10
|
+
#worktreeInfo = [];
|
|
11
|
+
#titles = new Map();
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
this.#maxPerTab = options.maxPerTab ?? 4;
|
|
14
|
+
}
|
|
15
|
+
isAvailable() {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
createSurface(opts) {
|
|
19
|
+
const id = `fake-surface-${this.#nextSurface}`;
|
|
20
|
+
this.#nextSurface += 1;
|
|
21
|
+
const group = this.#groupFor(opts.placement?.kind ?? "grouped");
|
|
22
|
+
this.#surfaces.set(id, {
|
|
23
|
+
id,
|
|
24
|
+
name: opts.name,
|
|
25
|
+
cwd: opts.cwd,
|
|
26
|
+
group,
|
|
27
|
+
screen: [],
|
|
28
|
+
commands: [],
|
|
29
|
+
keys: [],
|
|
30
|
+
processInfo: { pids: [], foregroundProcesses: [] },
|
|
31
|
+
});
|
|
32
|
+
return id;
|
|
33
|
+
}
|
|
34
|
+
runCommand(surfaceId, command) {
|
|
35
|
+
const surface = this.#surface(surfaceId);
|
|
36
|
+
surface.commands.push(command);
|
|
37
|
+
surface.screen.push(`$ ${command}`);
|
|
38
|
+
const echoText = echoOutput(command);
|
|
39
|
+
if (echoText !== null) {
|
|
40
|
+
surface.screen.push(echoText);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
readScreen(surfaceId, lines) {
|
|
44
|
+
const surface = this.#surface(surfaceId);
|
|
45
|
+
const screen = lines === undefined ? surface.screen : surface.screen.slice(-lines);
|
|
46
|
+
return screen.join("\n");
|
|
47
|
+
}
|
|
48
|
+
closeSurface(surfaceId) {
|
|
49
|
+
this.removeSurface(surfaceId);
|
|
50
|
+
}
|
|
51
|
+
listSurfaces(_opts) {
|
|
52
|
+
return Array.from(this.#surfaces.values(), ({ id, name, cwd, group, workspaceId }) => {
|
|
53
|
+
const info = { id, name, cwd, group };
|
|
54
|
+
if (workspaceId)
|
|
55
|
+
info.workspaceId = workspaceId;
|
|
56
|
+
return info;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
attachSurface(id) {
|
|
60
|
+
this.#surface(id);
|
|
61
|
+
return {
|
|
62
|
+
id,
|
|
63
|
+
runCommand: (command) => this.runCommand(id, command),
|
|
64
|
+
readScreen: (lines) => this.readScreen(id, lines),
|
|
65
|
+
sendKeys: (keys) => this.sendKeys(id, keys),
|
|
66
|
+
close: () => this.closeSurface(id),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
createWorktreeSurface(opts) {
|
|
70
|
+
const workspaceId = `fake-workspace-${this.#nextWorkspace}`;
|
|
71
|
+
this.#nextWorkspace += 1;
|
|
72
|
+
const worktreePath = path.join(opts.cwd, sanitizePathPart(opts.branch));
|
|
73
|
+
const surfaceId = this.createSurface({
|
|
74
|
+
name: opts.name,
|
|
75
|
+
cwd: worktreePath,
|
|
76
|
+
placement: { kind: "tab" },
|
|
77
|
+
});
|
|
78
|
+
const surface = this.#surface(surfaceId);
|
|
79
|
+
surface.workspaceId = workspaceId;
|
|
80
|
+
const worktree = {
|
|
81
|
+
path: worktreePath,
|
|
82
|
+
branch: opts.branch,
|
|
83
|
+
workspaceId,
|
|
84
|
+
surfaceId,
|
|
85
|
+
};
|
|
86
|
+
this.#worktrees.set(workspaceId, worktree);
|
|
87
|
+
this.#worktreeInfo.push({
|
|
88
|
+
path: worktree.path,
|
|
89
|
+
branch: worktree.branch,
|
|
90
|
+
workspaceId,
|
|
91
|
+
isLinkedWorktree: true,
|
|
92
|
+
sourceCwd: opts.cwd,
|
|
93
|
+
});
|
|
94
|
+
return worktree;
|
|
95
|
+
}
|
|
96
|
+
removeWorktreeSurface(workspaceId, _opts) {
|
|
97
|
+
const worktree = this.#worktrees.get(workspaceId);
|
|
98
|
+
if (!worktree)
|
|
99
|
+
return;
|
|
100
|
+
this.#worktrees.delete(workspaceId);
|
|
101
|
+
this.#worktreeInfo = this.#worktreeInfo.filter((info) => info.workspaceId !== workspaceId);
|
|
102
|
+
this.removeSurface(worktree.surfaceId);
|
|
103
|
+
}
|
|
104
|
+
reportOpenedPrimaryWorkspace(_input) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
setupHint() {
|
|
108
|
+
return "Fake surface provider is always available in memory.";
|
|
109
|
+
}
|
|
110
|
+
runScript(surfaceId, command, options) {
|
|
111
|
+
const surface = this.#surface(surfaceId);
|
|
112
|
+
surface.commands.push(command);
|
|
113
|
+
surface.screen.push(`$ ${options.scriptPath}`);
|
|
114
|
+
if (options.scriptPreamble.length > 0) {
|
|
115
|
+
surface.screen.push(options.scriptPreamble);
|
|
116
|
+
}
|
|
117
|
+
const echoText = echoOutput(command);
|
|
118
|
+
if (echoText !== null) {
|
|
119
|
+
surface.screen.push(echoText);
|
|
120
|
+
}
|
|
121
|
+
return options.scriptPath;
|
|
122
|
+
}
|
|
123
|
+
async inspectSurface(surfaceId) {
|
|
124
|
+
const surface = this.#surfaces.get(surfaceId);
|
|
125
|
+
if (!surface) {
|
|
126
|
+
return { kind: "missing", error: `surface not found: ${surfaceId}` };
|
|
127
|
+
}
|
|
128
|
+
return (surface.inspection ?? {
|
|
129
|
+
kind: "present",
|
|
130
|
+
agentStatus: "idle",
|
|
131
|
+
observedAt: Date.now(),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
sendKeys(surfaceId, keys) {
|
|
135
|
+
this.#surface(surfaceId).keys.push(keys);
|
|
136
|
+
}
|
|
137
|
+
getProcessInfo(surfaceId, _opts) {
|
|
138
|
+
const processInfo = this.#surface(surfaceId).processInfo;
|
|
139
|
+
return {
|
|
140
|
+
shellPid: processInfo.shellPid,
|
|
141
|
+
foregroundProcessGroupId: processInfo.foregroundProcessGroupId,
|
|
142
|
+
pids: [...processInfo.pids],
|
|
143
|
+
foregroundProcesses: processInfo.foregroundProcesses.map((process) => ({
|
|
144
|
+
...process,
|
|
145
|
+
argv: process.argv ? [...process.argv] : undefined,
|
|
146
|
+
})),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
async waitForShellReady(surfaceId) {
|
|
150
|
+
this.#surface(surfaceId);
|
|
151
|
+
}
|
|
152
|
+
async waitForSurfaceAbsence(surfaceId, opts = {}) {
|
|
153
|
+
if (!this.#surfaces.has(surfaceId))
|
|
154
|
+
return;
|
|
155
|
+
throw new Error(`surface still present after ${opts.timeoutMs ?? 0}ms: ${surfaceId}`);
|
|
156
|
+
}
|
|
157
|
+
async listWorktreeSurfaces(opts) {
|
|
158
|
+
void opts?.timeoutMs;
|
|
159
|
+
return this.#worktreeInfo
|
|
160
|
+
.filter((worktree) => opts?.cwd === undefined || worktree.sourceCwd === opts.cwd)
|
|
161
|
+
.map(({ sourceCwd, ...worktree }) => {
|
|
162
|
+
void sourceCwd;
|
|
163
|
+
return { ...worktree };
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
focusWorkspace(workspaceId) {
|
|
167
|
+
void workspaceId;
|
|
168
|
+
}
|
|
169
|
+
setTitle(target, title) {
|
|
170
|
+
this.#titles.set(target, title);
|
|
171
|
+
}
|
|
172
|
+
scriptInspection(surfaceId, inspection) {
|
|
173
|
+
this.#surface(surfaceId).inspection = inspection;
|
|
174
|
+
}
|
|
175
|
+
appendScreen(surfaceId, text) {
|
|
176
|
+
this.#surface(surfaceId).screen.push(...text.split("\n"));
|
|
177
|
+
}
|
|
178
|
+
commands(surfaceId) {
|
|
179
|
+
return [...this.#surface(surfaceId).commands];
|
|
180
|
+
}
|
|
181
|
+
recordWorktreeInfo(info, opts) {
|
|
182
|
+
this.#worktreeInfo.push({ ...info, sourceCwd: opts?.cwd });
|
|
183
|
+
}
|
|
184
|
+
removeSurface(surfaceId) {
|
|
185
|
+
this.#surfaces.delete(surfaceId);
|
|
186
|
+
for (const [workspaceId, worktree] of this.#worktrees) {
|
|
187
|
+
if (worktree.surfaceId === surfaceId) {
|
|
188
|
+
this.#worktrees.delete(workspaceId);
|
|
189
|
+
this.#worktreeInfo = this.#worktreeInfo.filter((info) => info.workspaceId !== workspaceId);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
#surface(surfaceId) {
|
|
194
|
+
const surface = this.#surfaces.get(surfaceId);
|
|
195
|
+
if (!surface) {
|
|
196
|
+
throw new Error(`surface not found: ${surfaceId}`);
|
|
197
|
+
}
|
|
198
|
+
return surface;
|
|
199
|
+
}
|
|
200
|
+
#groupFor(kind) {
|
|
201
|
+
if (kind === "tab") {
|
|
202
|
+
const group = `fake-tab-group-${this.#nextWorkspaceGroup}`;
|
|
203
|
+
this.#nextWorkspaceGroup += 1;
|
|
204
|
+
return group;
|
|
205
|
+
}
|
|
206
|
+
if (kind === "split") {
|
|
207
|
+
return "fake-split-group";
|
|
208
|
+
}
|
|
209
|
+
const groupCounts = new Map();
|
|
210
|
+
for (const surface of this.#surfaces.values()) {
|
|
211
|
+
const match = /^fake-agents-(\d+)$/.exec(surface.group ?? "");
|
|
212
|
+
if (!match)
|
|
213
|
+
continue;
|
|
214
|
+
const groupIndex = Number(match[1]);
|
|
215
|
+
groupCounts.set(groupIndex, (groupCounts.get(groupIndex) ?? 0) + 1);
|
|
216
|
+
}
|
|
217
|
+
for (let groupIndex = 1;; groupIndex += 1) {
|
|
218
|
+
if ((groupCounts.get(groupIndex) ?? 0) < this.#maxPerTab) {
|
|
219
|
+
return `fake-agents-${groupIndex}`;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function echoOutput(command) {
|
|
225
|
+
const match = /^echo(?:\s+(.+))?$/.exec(command.trim());
|
|
226
|
+
return match ? (match[1] ?? "") : null;
|
|
227
|
+
}
|
|
228
|
+
function sanitizePathPart(value) {
|
|
229
|
+
return value.replaceAll(/[^A-Za-z0-9._-]/g, "-");
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=fake-surface-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-surface-provider.js","sourceRoot":"","sources":["../../../../maestro/surfaces/fake/fake-surface-provider.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AA8B7B,MAAM,OAAO,mBAAmB;IACtB,IAAI,GAAG,MAAM,CAAC;IAEvB,YAAY,GAAG,CAAC,CAAC;IACjB,cAAc,GAAG,CAAC,CAAC;IACnB,mBAAmB,GAAG,CAAC,CAAC;IACxB,UAAU,CAAS;IACnB,SAAS,GAAG,IAAI,GAAG,EAA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AG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,KAAK,IAAI,UAAU,GAAG,CAAC,GAAI,UAAU,IAAI,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;gBAC1D,OAAO,eAAe,UAAU,EAAE,CAAC;YACpC,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAED,SAAS,UAAU,CAAC,OAAe;IAClC,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACxC,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,UAAU,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC","sourcesContent":["import path from \"node:path\";\nimport type { OpenedPrimaryWorkspaceReport } from \"../../core/opened-primary-workspace.ts\";\nimport type {\n\tCreateSurfaceOptions,\n\tCreateWorktreeSurfaceOptions,\n\tReportOpenedPrimaryWorkspaceInput,\n\tSurfaceInfo,\n\tSurfaceProcessInfo,\n\tSurfaceProvider,\n\tWorktreeSurface,\n\tWorktreeSurfaceInfo,\n} from \"../../core/surface-provider.ts\";\nimport type { PaneInspection, SurfaceHandle } from \"../../core/types.ts\";\n\ninterface FakeSurfaceRecord extends SurfaceInfo {\n\tscreen: string[];\n\tcommands: string[];\n\tkeys: string[];\n\tprocessInfo: SurfaceProcessInfo;\n\tinspection?: PaneInspection;\n}\n\ninterface FakeWorktreeInfoRecord extends WorktreeSurfaceInfo {\n\tsourceCwd?: string;\n}\n\ninterface FakeSurfaceProviderOptions {\n\tmaxPerTab?: number;\n}\n\nexport class FakeSurfaceProvider implements SurfaceProvider {\n\treadonly name = \"fake\";\n\n\t#nextSurface = 1;\n\t#nextWorkspace = 1;\n\t#nextWorkspaceGroup = 1;\n\t#maxPerTab: number;\n\t#surfaces = new Map<string, FakeSurfaceRecord>();\n\t#worktrees = new Map<string, WorktreeSurface>();\n\t#worktreeInfo: FakeWorktreeInfoRecord[] = [];\n\t#titles = new Map<\"tab\" | \"workspace\", string>();\n\n\tconstructor(options: FakeSurfaceProviderOptions = {}) {\n\t\tthis.#maxPerTab = options.maxPerTab ?? 4;\n\t}\n\n\tisAvailable(): boolean {\n\t\treturn true;\n\t}\n\n\tcreateSurface(opts: CreateSurfaceOptions): string {\n\t\tconst id = `fake-surface-${this.#nextSurface}`;\n\t\tthis.#nextSurface += 1;\n\t\tconst group = this.#groupFor(opts.placement?.kind ?? \"grouped\");\n\t\tthis.#surfaces.set(id, {\n\t\t\tid,\n\t\t\tname: opts.name,\n\t\t\tcwd: opts.cwd,\n\t\t\tgroup,\n\t\t\tscreen: [],\n\t\t\tcommands: [],\n\t\t\tkeys: [],\n\t\t\tprocessInfo: { pids: [], foregroundProcesses: [] },\n\t\t});\n\t\treturn id;\n\t}\n\n\trunCommand(surfaceId: string, command: string): void {\n\t\tconst surface = this.#surface(surfaceId);\n\t\tsurface.commands.push(command);\n\t\tsurface.screen.push(`$ ${command}`);\n\t\tconst echoText = echoOutput(command);\n\t\tif (echoText !== null) {\n\t\t\tsurface.screen.push(echoText);\n\t\t}\n\t}\n\n\treadScreen(surfaceId: string, lines?: number): string {\n\t\tconst surface = this.#surface(surfaceId);\n\t\tconst screen =\n\t\t\tlines === undefined ? surface.screen : surface.screen.slice(-lines);\n\t\treturn screen.join(\"\\n\");\n\t}\n\n\tcloseSurface(surfaceId: string): void {\n\t\tthis.removeSurface(surfaceId);\n\t}\n\n\tlistSurfaces(_opts?: { timeoutMs?: number }): SurfaceInfo[] {\n\t\treturn Array.from(\n\t\t\tthis.#surfaces.values(),\n\t\t\t({ id, name, cwd, group, workspaceId }) => {\n\t\t\t\tconst info: SurfaceInfo = { id, name, cwd, group };\n\t\t\t\tif (workspaceId) info.workspaceId = workspaceId;\n\t\t\t\treturn info;\n\t\t\t},\n\t\t);\n\t}\n\n\tattachSurface(id: string): SurfaceHandle {\n\t\tthis.#surface(id);\n\t\treturn {\n\t\t\tid,\n\t\t\trunCommand: (command) => this.runCommand(id, command),\n\t\t\treadScreen: (lines) => this.readScreen(id, lines),\n\t\t\tsendKeys: (keys) => this.sendKeys(id, keys),\n\t\t\tclose: () => this.closeSurface(id),\n\t\t};\n\t}\n\n\tcreateWorktreeSurface(opts: CreateWorktreeSurfaceOptions): WorktreeSurface {\n\t\tconst workspaceId = `fake-workspace-${this.#nextWorkspace}`;\n\t\tthis.#nextWorkspace += 1;\n\t\tconst worktreePath = path.join(opts.cwd, sanitizePathPart(opts.branch));\n\t\tconst surfaceId = this.createSurface({\n\t\t\tname: opts.name,\n\t\t\tcwd: worktreePath,\n\t\t\tplacement: { kind: \"tab\" },\n\t\t});\n\t\tconst surface = this.#surface(surfaceId);\n\t\tsurface.workspaceId = workspaceId;\n\t\tconst worktree = {\n\t\t\tpath: worktreePath,\n\t\t\tbranch: opts.branch,\n\t\t\tworkspaceId,\n\t\t\tsurfaceId,\n\t\t};\n\t\tthis.#worktrees.set(workspaceId, worktree);\n\t\tthis.#worktreeInfo.push({\n\t\t\tpath: worktree.path,\n\t\t\tbranch: worktree.branch,\n\t\t\tworkspaceId,\n\t\t\tisLinkedWorktree: true,\n\t\t\tsourceCwd: opts.cwd,\n\t\t});\n\t\treturn worktree;\n\t}\n\n\tremoveWorktreeSurface(\n\t\tworkspaceId: string,\n\t\t_opts?: { timeoutMs?: number },\n\t): void {\n\t\tconst worktree = this.#worktrees.get(workspaceId);\n\t\tif (!worktree) return;\n\t\tthis.#worktrees.delete(workspaceId);\n\t\tthis.#worktreeInfo = this.#worktreeInfo.filter(\n\t\t\t(info) => info.workspaceId !== workspaceId,\n\t\t);\n\t\tthis.removeSurface(worktree.surfaceId);\n\t}\n\n\treportOpenedPrimaryWorkspace(\n\t\t_input: ReportOpenedPrimaryWorkspaceInput,\n\t): OpenedPrimaryWorkspaceReport | undefined {\n\t\treturn undefined;\n\t}\n\n\tsetupHint(): string {\n\t\treturn \"Fake surface provider is always available in memory.\";\n\t}\n\n\trunScript(\n\t\tsurfaceId: string,\n\t\tcommand: string,\n\t\toptions: { scriptPath: string; scriptPreamble: string },\n\t): string {\n\t\tconst surface = this.#surface(surfaceId);\n\t\tsurface.commands.push(command);\n\t\tsurface.screen.push(`$ ${options.scriptPath}`);\n\t\tif (options.scriptPreamble.length > 0) {\n\t\t\tsurface.screen.push(options.scriptPreamble);\n\t\t}\n\t\tconst echoText = echoOutput(command);\n\t\tif (echoText !== null) {\n\t\t\tsurface.screen.push(echoText);\n\t\t}\n\t\treturn options.scriptPath;\n\t}\n\n\tasync inspectSurface(surfaceId: string): Promise<PaneInspection> {\n\t\tconst surface = this.#surfaces.get(surfaceId);\n\t\tif (!surface) {\n\t\t\treturn { kind: \"missing\", error: `surface not found: ${surfaceId}` };\n\t\t}\n\t\treturn (\n\t\t\tsurface.inspection ?? {\n\t\t\t\tkind: \"present\",\n\t\t\t\tagentStatus: \"idle\",\n\t\t\t\tobservedAt: Date.now(),\n\t\t\t}\n\t\t);\n\t}\n\n\tsendKeys(surfaceId: string, keys: string): void {\n\t\tthis.#surface(surfaceId).keys.push(keys);\n\t}\n\n\tgetProcessInfo(\n\t\tsurfaceId: string,\n\t\t_opts?: { timeoutMs?: number },\n\t): SurfaceProcessInfo {\n\t\tconst processInfo = this.#surface(surfaceId).processInfo;\n\t\treturn {\n\t\t\tshellPid: processInfo.shellPid,\n\t\t\tforegroundProcessGroupId: processInfo.foregroundProcessGroupId,\n\t\t\tpids: [...processInfo.pids],\n\t\t\tforegroundProcesses: processInfo.foregroundProcesses.map((process) => ({\n\t\t\t\t...process,\n\t\t\t\targv: process.argv ? [...process.argv] : undefined,\n\t\t\t})),\n\t\t};\n\t}\n\n\tasync waitForShellReady(surfaceId: string): Promise<void> {\n\t\tthis.#surface(surfaceId);\n\t}\n\n\tasync waitForSurfaceAbsence(\n\t\tsurfaceId: string,\n\t\topts: { timeoutMs?: number } = {},\n\t): Promise<void> {\n\t\tif (!this.#surfaces.has(surfaceId)) return;\n\t\tthrow new Error(\n\t\t\t`surface still present after ${opts.timeoutMs ?? 0}ms: ${surfaceId}`,\n\t\t);\n\t}\n\n\tasync listWorktreeSurfaces(opts?: {\n\t\tcwd?: string;\n\t\ttimeoutMs?: number;\n\t}): Promise<WorktreeSurfaceInfo[]> {\n\t\tvoid opts?.timeoutMs;\n\t\treturn this.#worktreeInfo\n\t\t\t.filter(\n\t\t\t\t(worktree) =>\n\t\t\t\t\topts?.cwd === undefined || worktree.sourceCwd === opts.cwd,\n\t\t\t)\n\t\t\t.map(({ sourceCwd, ...worktree }) => {\n\t\t\t\tvoid sourceCwd;\n\t\t\t\treturn { ...worktree };\n\t\t\t});\n\t}\n\n\tfocusWorkspace(workspaceId: string): void {\n\t\tvoid workspaceId;\n\t}\n\n\tsetTitle(target: \"tab\" | \"workspace\", title: string): void {\n\t\tthis.#titles.set(target, title);\n\t}\n\n\tscriptInspection(surfaceId: string, inspection: PaneInspection): void {\n\t\tthis.#surface(surfaceId).inspection = inspection;\n\t}\n\n\tappendScreen(surfaceId: string, text: string): void {\n\t\tthis.#surface(surfaceId).screen.push(...text.split(\"\\n\"));\n\t}\n\n\tcommands(surfaceId: string): string[] {\n\t\treturn [...this.#surface(surfaceId).commands];\n\t}\n\n\trecordWorktreeInfo(info: WorktreeSurfaceInfo, opts?: { cwd?: string }): void {\n\t\tthis.#worktreeInfo.push({ ...info, sourceCwd: opts?.cwd });\n\t}\n\n\tremoveSurface(surfaceId: string): void {\n\t\tthis.#surfaces.delete(surfaceId);\n\t\tfor (const [workspaceId, worktree] of this.#worktrees) {\n\t\t\tif (worktree.surfaceId === surfaceId) {\n\t\t\t\tthis.#worktrees.delete(workspaceId);\n\t\t\t\tthis.#worktreeInfo = this.#worktreeInfo.filter(\n\t\t\t\t\t(info) => info.workspaceId !== workspaceId,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t#surface(surfaceId: string): FakeSurfaceRecord {\n\t\tconst surface = this.#surfaces.get(surfaceId);\n\t\tif (!surface) {\n\t\t\tthrow new Error(`surface not found: ${surfaceId}`);\n\t\t}\n\t\treturn surface;\n\t}\n\n\t#groupFor(kind: \"grouped\" | \"split\" | \"tab\"): string {\n\t\tif (kind === \"tab\") {\n\t\t\tconst group = `fake-tab-group-${this.#nextWorkspaceGroup}`;\n\t\t\tthis.#nextWorkspaceGroup += 1;\n\t\t\treturn group;\n\t\t}\n\t\tif (kind === \"split\") {\n\t\t\treturn \"fake-split-group\";\n\t\t}\n\t\tconst groupCounts = new Map<number, number>();\n\t\tfor (const surface of this.#surfaces.values()) {\n\t\t\tconst match = /^fake-agents-(\\d+)$/.exec(surface.group ?? \"\");\n\t\t\tif (!match) continue;\n\t\t\tconst groupIndex = Number(match[1]);\n\t\t\tgroupCounts.set(groupIndex, (groupCounts.get(groupIndex) ?? 0) + 1);\n\t\t}\n\t\tfor (let groupIndex = 1; ; groupIndex += 1) {\n\t\t\tif ((groupCounts.get(groupIndex) ?? 0) < this.#maxPerTab) {\n\t\t\t\treturn `fake-agents-${groupIndex}`;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction echoOutput(command: string): string | null {\n\tconst match = /^echo(?:\\s+(.+))?$/.exec(command.trim());\n\treturn match ? (match[1] ?? \"\") : null;\n}\n\nfunction sanitizePathPart(value: string): string {\n\treturn value.replaceAll(/[^A-Za-z0-9._-]/g, \"-\");\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { describe as nodeDescribe, it as nodeIt } from "node:test";
|
|
2
|
+
import type { HarnessAdapter, SpawnOptions } from "../../maestro/core/harness-adapter.ts";
|
|
3
|
+
import type { AgentHandle } from "../../maestro/core/types.ts";
|
|
4
|
+
interface TestRunner {
|
|
5
|
+
describe: typeof nodeDescribe;
|
|
6
|
+
it: typeof nodeIt;
|
|
7
|
+
}
|
|
8
|
+
export interface HarnessAdapterFixture {
|
|
9
|
+
adapter: HarnessAdapter;
|
|
10
|
+
/** Fake fixtures retain the tight default; real process fixtures choose a bounded budget. */
|
|
11
|
+
waitTimeoutMs?: number;
|
|
12
|
+
/** Raw provider errors need not contain the literal word "error". */
|
|
13
|
+
errorMessagePattern?: RegExp;
|
|
14
|
+
/** Explicit saved-session policy expectation, not an arbitrary rejection allowance. */
|
|
15
|
+
managedSessionResume?: {
|
|
16
|
+
kind: "refused";
|
|
17
|
+
message: RegExp;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "detached";
|
|
20
|
+
};
|
|
21
|
+
spawnOptions(): SpawnOptions;
|
|
22
|
+
finish(handle: AgentHandle, kind: "done" | "ping" | "error"): Promise<void>;
|
|
23
|
+
/** Optional implementation-specific simulation of delayed sidecar evidence after pane absence. */
|
|
24
|
+
lateSidecar?(handle: AgentHandle): Promise<void>;
|
|
25
|
+
/** Optional hook for implementations that need provider-specific worktree setup before spawn. */
|
|
26
|
+
worktreeSpawnOptions?(base: SpawnOptions): Promise<SpawnOptions>;
|
|
27
|
+
dispose(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export declare function registerHarnessAdapterConformance(runner: TestRunner, name: string, factory: () => Promise<HarnessAdapterFixture>): void;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=harness-adapter.conformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-adapter.conformance.d.ts","sourceRoot":"","sources":["../../../maestro/testing/harness-adapter.conformance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,YAA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