@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,249 @@
|
|
|
1
|
+
import { FileWakeRegistry, } from "./wake.js";
|
|
2
|
+
export const RECONCILE_INTERVAL_MS = 4_800;
|
|
3
|
+
export const POLLING_INTERVAL_MS = 1_000;
|
|
4
|
+
const BATCH_UNHEALTHY_MS = 5_000;
|
|
5
|
+
const ABORT_MESSAGE = "Aborted while waiting for subagent to finish";
|
|
6
|
+
const UNREGISTERED_MESSAGE = "Supervision registration was unregistered";
|
|
7
|
+
const CONCURRENT_WAIT_MESSAGE = "Supervision registration already has a parked wait";
|
|
8
|
+
/** A runtime-owned coordinator for file wake-ups and shared pane snapshots. */
|
|
9
|
+
export class SupervisionCoordinator {
|
|
10
|
+
entries = new Set();
|
|
11
|
+
listPanes;
|
|
12
|
+
inspectFallback;
|
|
13
|
+
forcePolling;
|
|
14
|
+
wakeRegistry;
|
|
15
|
+
timers;
|
|
16
|
+
timer;
|
|
17
|
+
unhealthyTimer;
|
|
18
|
+
reconciling = false;
|
|
19
|
+
unhealthyUntil = 0;
|
|
20
|
+
nextGeneration = 0;
|
|
21
|
+
closed = false;
|
|
22
|
+
constructor(listPanes, inspectFallback, forcePolling = false, wakeRegistry = new FileWakeRegistry(), timers = { setTimeout, clearTimeout }) {
|
|
23
|
+
this.listPanes = listPanes;
|
|
24
|
+
this.inspectFallback = inspectFallback;
|
|
25
|
+
this.forcePolling = forcePolling;
|
|
26
|
+
this.wakeRegistry = wakeRegistry;
|
|
27
|
+
this.timers = timers;
|
|
28
|
+
}
|
|
29
|
+
register(sessionFile, surface) {
|
|
30
|
+
const entry = {
|
|
31
|
+
sessionFile,
|
|
32
|
+
surface,
|
|
33
|
+
generation: this.nextGeneration++,
|
|
34
|
+
fallback: this.forcePolling,
|
|
35
|
+
fileFallback: this.forcePolling,
|
|
36
|
+
};
|
|
37
|
+
this.entries.add(entry);
|
|
38
|
+
this.configureEntry(entry);
|
|
39
|
+
// Forced polling retains the legacy immediate probe, then 1s cadence.
|
|
40
|
+
if (entry.fileFallback)
|
|
41
|
+
entry.pending = "reconcile";
|
|
42
|
+
this.ensureTimer();
|
|
43
|
+
if (!this.forcePolling)
|
|
44
|
+
this.reconcile();
|
|
45
|
+
return {
|
|
46
|
+
wait: (signal) => this.wait(entry, signal),
|
|
47
|
+
inspectPane: () => this.inspect(entry),
|
|
48
|
+
unregister: () => this.unregister(entry),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Reconfigure the live owner; registration handles and its shared timer survive. */
|
|
52
|
+
setForcePolling(forcePolling) {
|
|
53
|
+
if (this.forcePolling === forcePolling)
|
|
54
|
+
return;
|
|
55
|
+
if (this.closed)
|
|
56
|
+
throw new Error("Supervision coordinator is closed");
|
|
57
|
+
this.forcePolling = forcePolling;
|
|
58
|
+
for (const entry of this.entries) {
|
|
59
|
+
entry.wakeRegistration?.unregister();
|
|
60
|
+
entry.wakeRegistration = undefined;
|
|
61
|
+
entry.inspection = undefined;
|
|
62
|
+
this.configureEntry(entry);
|
|
63
|
+
// Finish the old transport's wait (and release its ref/timer). The
|
|
64
|
+
// existing consumer probes evidence once, then waits on the new mode.
|
|
65
|
+
if (entry.parked)
|
|
66
|
+
entry.parked.resolve("reconcile");
|
|
67
|
+
else
|
|
68
|
+
this.signal(entry, "reconcile");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
configureEntry(entry) {
|
|
72
|
+
entry.fileFallback = true;
|
|
73
|
+
if (!this.forcePolling && process.platform !== "win32") {
|
|
74
|
+
entry.wakeRegistration = this.wakeRegistry.register(entry.sessionFile, () => this.signal(entry, "wake"), () => this.enterFallback(entry));
|
|
75
|
+
entry.fileFallback = !entry.wakeRegistration.watching;
|
|
76
|
+
}
|
|
77
|
+
entry.fallback = entry.fileFallback || Date.now() < this.unhealthyUntil;
|
|
78
|
+
}
|
|
79
|
+
diagnostics() {
|
|
80
|
+
const mode = this.forcePolling
|
|
81
|
+
? "polling(forced)"
|
|
82
|
+
: [...this.entries].some((entry) => entry.fallback)
|
|
83
|
+
? "polling(fallback)"
|
|
84
|
+
: "wake+batch";
|
|
85
|
+
return { mode, watcherCount: this.wakeRegistry.watcherCount };
|
|
86
|
+
}
|
|
87
|
+
close() {
|
|
88
|
+
this.closed = true;
|
|
89
|
+
if (this.timer)
|
|
90
|
+
clearInterval(this.timer);
|
|
91
|
+
this.timer = undefined;
|
|
92
|
+
if (this.unhealthyTimer)
|
|
93
|
+
this.timers.clearTimeout(this.unhealthyTimer);
|
|
94
|
+
this.unhealthyTimer = undefined;
|
|
95
|
+
for (const entry of this.entries)
|
|
96
|
+
this.unregister(entry);
|
|
97
|
+
this.entries.clear();
|
|
98
|
+
this.wakeRegistry.close();
|
|
99
|
+
}
|
|
100
|
+
ensureTimer() {
|
|
101
|
+
if (this.timer)
|
|
102
|
+
return;
|
|
103
|
+
this.timer = setInterval(() => this.reconcile(), RECONCILE_INTERVAL_MS);
|
|
104
|
+
this.timer.unref?.();
|
|
105
|
+
}
|
|
106
|
+
unregister(entry) {
|
|
107
|
+
entry.unregistered = true;
|
|
108
|
+
entry.wakeRegistration?.unregister();
|
|
109
|
+
this.entries.delete(entry);
|
|
110
|
+
if (this.entries.size === 0 && this.timer) {
|
|
111
|
+
clearInterval(this.timer);
|
|
112
|
+
this.timer = undefined;
|
|
113
|
+
}
|
|
114
|
+
// Nothing can wake a parked wait now; settle it so its retain is released.
|
|
115
|
+
entry.parked?.reject(new Error(UNREGISTERED_MESSAGE));
|
|
116
|
+
}
|
|
117
|
+
enterFallback(entry) {
|
|
118
|
+
if (this.closed)
|
|
119
|
+
return;
|
|
120
|
+
entry.fileFallback = true;
|
|
121
|
+
entry.fallback = true;
|
|
122
|
+
entry.inspection = undefined;
|
|
123
|
+
this.signal(entry, "reconcile");
|
|
124
|
+
}
|
|
125
|
+
wait(entry, signal) {
|
|
126
|
+
if (signal.aborted)
|
|
127
|
+
return Promise.reject(new Error(ABORT_MESSAGE));
|
|
128
|
+
if (entry.unregistered)
|
|
129
|
+
return Promise.reject(new Error(UNREGISTERED_MESSAGE));
|
|
130
|
+
// One completion loop consumes a registration: `pending` queues a single
|
|
131
|
+
// reason for a single waiter, so a second concurrent wait is a caller bug.
|
|
132
|
+
if (entry.parked)
|
|
133
|
+
return Promise.reject(new Error(CONCURRENT_WAIT_MESSAGE));
|
|
134
|
+
if (entry.pending) {
|
|
135
|
+
const reason = entry.pending;
|
|
136
|
+
entry.pending = undefined;
|
|
137
|
+
return Promise.resolve(reason);
|
|
138
|
+
}
|
|
139
|
+
return new Promise((resolve, reject) => {
|
|
140
|
+
// Both transports have one owned wait, so a mode change can release
|
|
141
|
+
// the old timer or watch retain without replacing the registration.
|
|
142
|
+
const release = entry.fallback ? undefined : this.wakeRegistry.retain();
|
|
143
|
+
let timer;
|
|
144
|
+
let settled = false;
|
|
145
|
+
const finish = (settle) => {
|
|
146
|
+
if (settled)
|
|
147
|
+
return;
|
|
148
|
+
settled = true;
|
|
149
|
+
signal.removeEventListener("abort", onAbort);
|
|
150
|
+
entry.parked = undefined;
|
|
151
|
+
if (timer)
|
|
152
|
+
this.timers.clearTimeout(timer);
|
|
153
|
+
release?.();
|
|
154
|
+
settle();
|
|
155
|
+
};
|
|
156
|
+
const onAbort = () => {
|
|
157
|
+
finish(() => reject(new Error(ABORT_MESSAGE)));
|
|
158
|
+
};
|
|
159
|
+
entry.parked = {
|
|
160
|
+
polling: entry.fallback,
|
|
161
|
+
resolve: (reason) => finish(() => resolve(reason)),
|
|
162
|
+
reject: (error) => finish(() => reject(error)),
|
|
163
|
+
};
|
|
164
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
165
|
+
if (entry.fallback)
|
|
166
|
+
timer = this.timers.setTimeout(() => entry.parked?.resolve("reconcile"), POLLING_INTERVAL_MS);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
signal(entry, reason) {
|
|
170
|
+
if (this.closed)
|
|
171
|
+
return;
|
|
172
|
+
if (reason === "wake")
|
|
173
|
+
entry.inspection = undefined;
|
|
174
|
+
// Ordinary signals queue behind a poll's 1s cadence. Only a transport
|
|
175
|
+
// change explicitly settles that timer early.
|
|
176
|
+
if (entry.parked && !entry.parked.polling)
|
|
177
|
+
entry.parked.resolve(reason);
|
|
178
|
+
// A wake must never downgrade a queued reconciliation: the reconcile
|
|
179
|
+
// reason carries the epoch's pane inspection, and skipping it would
|
|
180
|
+
// defer pane-disappearance detection past the documented 5s bound.
|
|
181
|
+
else if (entry.pending !== "reconcile")
|
|
182
|
+
entry.pending = reason;
|
|
183
|
+
}
|
|
184
|
+
async reconcile() {
|
|
185
|
+
if (this.closed || this.reconciling || this.entries.size === 0)
|
|
186
|
+
return;
|
|
187
|
+
this.reconciling = true;
|
|
188
|
+
const snapshotGeneration = this.nextGeneration - 1;
|
|
189
|
+
try {
|
|
190
|
+
const snapshot = await this.listPanes();
|
|
191
|
+
if (this.closed)
|
|
192
|
+
return;
|
|
193
|
+
if (!snapshot.complete)
|
|
194
|
+
throw new Error("malformed pane list");
|
|
195
|
+
const bySurface = new Set(snapshot.panes.map((pane) => pane.paneId));
|
|
196
|
+
for (const entry of this.entries) {
|
|
197
|
+
entry.fallback = entry.fileFallback;
|
|
198
|
+
if (entry.fallback || entry.generation > snapshotGeneration) {
|
|
199
|
+
// Legacy polling and later registrants always inspect their own pane.
|
|
200
|
+
entry.inspection = undefined;
|
|
201
|
+
}
|
|
202
|
+
else if (bySurface.has(entry.surface)) {
|
|
203
|
+
entry.inspection = {
|
|
204
|
+
kind: "present",
|
|
205
|
+
agentStatus: "unknown",
|
|
206
|
+
observedAt: Date.now(),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
// A complete list can establish presence, not absence. Only pane get
|
|
211
|
+
// may establish a missing pane before completion acts on it.
|
|
212
|
+
entry.inspection = undefined;
|
|
213
|
+
}
|
|
214
|
+
this.signal(entry, "reconcile");
|
|
215
|
+
}
|
|
216
|
+
this.unhealthyUntil = 0;
|
|
217
|
+
if (this.unhealthyTimer)
|
|
218
|
+
this.timers.clearTimeout(this.unhealthyTimer);
|
|
219
|
+
this.unhealthyTimer = undefined;
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
if (this.closed)
|
|
223
|
+
return;
|
|
224
|
+
this.unhealthyUntil = Date.now() + BATCH_UNHEALTHY_MS;
|
|
225
|
+
for (const entry of this.entries) {
|
|
226
|
+
entry.fallback = true;
|
|
227
|
+
entry.inspection = undefined;
|
|
228
|
+
this.signal(entry, "reconcile");
|
|
229
|
+
}
|
|
230
|
+
if (this.unhealthyTimer)
|
|
231
|
+
this.timers.clearTimeout(this.unhealthyTimer);
|
|
232
|
+
this.unhealthyTimer = this.timers.setTimeout(() => {
|
|
233
|
+
this.unhealthyTimer = undefined;
|
|
234
|
+
if (!this.closed && Date.now() >= this.unhealthyUntil)
|
|
235
|
+
this.reconcile();
|
|
236
|
+
}, BATCH_UNHEALTHY_MS);
|
|
237
|
+
this.unhealthyTimer.unref?.();
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
this.reconciling = false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
async inspect(entry) {
|
|
244
|
+
if (entry.inspection)
|
|
245
|
+
return entry.inspection;
|
|
246
|
+
return this.inspectFallback(entry.surface);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=supervision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervision.js","sourceRoot":"","sources":["../../../maestro/core/supervision.ts"],"names":[],"mappings":"AACA,OAAO,EACN,gBAAgB,GAGhB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AACzC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,aAAa,GAAG,8CAA8C,CAAC;AACrE,MAAM,oBAAoB,GAAG,2CAA2C,CAAC;AACzE,MAAM,uBAAuB,GAC5B,oDAAoD,CAAC;AAkDtD,+EAA+E;AAC/E,MAAM,OAAO,sBAAsB;IACjB,OAAO,GAAG,IAAI,GAAG,EAAS,CAAC;IAC3B,SAAS,CAAkC;IAC3C,eAAe,CAEH;IACrB,YAAY,CAAU;IACb,YAAY,CAAmB;IAC/B,MAAM,CAAoB;IACnC,KAAK,CAA6C;IAClD,cAAc,CAA4C;IAC1D,WAAW,GAAG,KAAK,CAAC;IACpB,cAAc,GAAG,CAAC,CAAC;IACnB,cAAc,GAAG,CAAC,CAAC;IACnB,MAAM,GAAG,KAAK,CAAC;IAEvB,YACC,SAA0C,EAC1C,eAA6D,EAC7D,YAAY,GAAG,KAAK,EACpB,YAAY,GAAG,IAAI,gBAAgB,EAAE,EACrC,SAA4B,EAAE,UAAU,EAAE,YAAY,EAAE;QAExD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,QAAQ,CAAC,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I,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC;QAC/B,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC1B,CAAC;IACF,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,KAAY;QACjC,IAAI,KAAK,CAAC,UAAU;YAAE,OAAO,KAAK,CAAC,UAAU,CAAC;QAC9C,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CACD","sourcesContent":["import type { PaneInspection } from \"./types.ts\";\nimport {\n\tFileWakeRegistry,\n\ttype WakeRegistration,\n\ttype WakeReason,\n} from \"./wake.ts\";\n\nexport const RECONCILE_INTERVAL_MS = 4_800;\nexport const POLLING_INTERVAL_MS = 1_000;\nconst BATCH_UNHEALTHY_MS = 5_000;\nconst ABORT_MESSAGE = \"Aborted while waiting for subagent to finish\";\nconst UNREGISTERED_MESSAGE = \"Supervision registration was unregistered\";\nconst CONCURRENT_WAIT_MESSAGE =\n\t\"Supervision registration already has a parked wait\";\n\nexport interface PaneListEntry {\n\tpaneId: string;\n\tworkspaceId: string;\n}\n\nexport interface PaneListSnapshot {\n\tcomplete: boolean;\n\tpanes: PaneListEntry[];\n}\n\nexport interface SupervisionRegistration {\n\twait(signal: AbortSignal): Promise<WakeReason>;\n\tinspectPane(): Promise<PaneInspection>;\n\tunregister(): void;\n}\n\ninterface Entry {\n\tsessionFile: string;\n\tsurface: string;\n\tgeneration: number;\n\twakeRegistration?: WakeRegistration;\n\tpending?: WakeReason;\n\tparked?: ParkedWait;\n\tunregistered?: boolean;\n\tinspection?: PaneInspection;\n\tfallback: boolean;\n\tfileFallback: boolean;\n}\n\ninterface ParkedWait {\n\tpolling: boolean;\n\tresolve(reason: WakeReason): void;\n\treject(error: Error): void;\n}\n\nexport interface SupervisionDiagnostics {\n\tmode: \"wake+batch\" | \"polling(forced)\" | \"polling(fallback)\";\n\twatcherCount: number;\n}\n\ninterface SupervisionTimers {\n\tsetTimeout(\n\t\tcallback: () => void,\n\t\tmilliseconds: number,\n\t): ReturnType<typeof setTimeout>;\n\tclearTimeout(timer: ReturnType<typeof setTimeout>): void;\n}\n\n/** A runtime-owned coordinator for file wake-ups and shared pane snapshots. */\nexport class SupervisionCoordinator {\n\tprivate readonly entries = new Set<Entry>();\n\tprivate readonly listPanes: () => Promise<PaneListSnapshot>;\n\tprivate readonly inspectFallback: (\n\t\tsurface: string,\n\t) => Promise<PaneInspection>;\n\tprivate forcePolling: boolean;\n\tprivate readonly wakeRegistry: FileWakeRegistry;\n\tprivate readonly timers: SupervisionTimers;\n\tprivate timer: ReturnType<typeof setInterval> | undefined;\n\tprivate unhealthyTimer: ReturnType<typeof setTimeout> | undefined;\n\tprivate reconciling = false;\n\tprivate unhealthyUntil = 0;\n\tprivate nextGeneration = 0;\n\tprivate closed = false;\n\n\tconstructor(\n\t\tlistPanes: () => Promise<PaneListSnapshot>,\n\t\tinspectFallback: (surface: string) => Promise<PaneInspection>,\n\t\tforcePolling = false,\n\t\twakeRegistry = new FileWakeRegistry(),\n\t\ttimers: SupervisionTimers = { setTimeout, clearTimeout },\n\t) {\n\t\tthis.listPanes = listPanes;\n\t\tthis.inspectFallback = inspectFallback;\n\t\tthis.forcePolling = forcePolling;\n\t\tthis.wakeRegistry = wakeRegistry;\n\t\tthis.timers = timers;\n\t}\n\n\tregister(sessionFile: string, surface: string): SupervisionRegistration {\n\t\tconst entry: Entry = {\n\t\t\tsessionFile,\n\t\t\tsurface,\n\t\t\tgeneration: this.nextGeneration++,\n\t\t\tfallback: this.forcePolling,\n\t\t\tfileFallback: this.forcePolling,\n\t\t};\n\t\tthis.entries.add(entry);\n\t\tthis.configureEntry(entry);\n\t\t// Forced polling retains the legacy immediate probe, then 1s cadence.\n\t\tif (entry.fileFallback) entry.pending = \"reconcile\";\n\t\tthis.ensureTimer();\n\t\tif (!this.forcePolling) this.reconcile();\n\t\treturn {\n\t\t\twait: (signal) => this.wait(entry, signal),\n\t\t\tinspectPane: () => this.inspect(entry),\n\t\t\tunregister: () => this.unregister(entry),\n\t\t};\n\t}\n\n\t/** Reconfigure the live owner; registration handles and its shared timer survive. */\n\tsetForcePolling(forcePolling: boolean): void {\n\t\tif (this.forcePolling === forcePolling) return;\n\t\tif (this.closed) throw new Error(\"Supervision coordinator is closed\");\n\t\tthis.forcePolling = forcePolling;\n\t\tfor (const entry of this.entries) {\n\t\t\tentry.wakeRegistration?.unregister();\n\t\t\tentry.wakeRegistration = undefined;\n\t\t\tentry.inspection = undefined;\n\t\t\tthis.configureEntry(entry);\n\t\t\t// Finish the old transport's wait (and release its ref/timer). The\n\t\t\t// existing consumer probes evidence once, then waits on the new mode.\n\t\t\tif (entry.parked) entry.parked.resolve(\"reconcile\");\n\t\t\telse this.signal(entry, \"reconcile\");\n\t\t}\n\t}\n\n\tprivate configureEntry(entry: Entry): void {\n\t\tentry.fileFallback = true;\n\t\tif (!this.forcePolling && process.platform !== \"win32\") {\n\t\t\tentry.wakeRegistration = this.wakeRegistry.register(\n\t\t\t\tentry.sessionFile,\n\t\t\t\t() => this.signal(entry, \"wake\"),\n\t\t\t\t() => this.enterFallback(entry),\n\t\t\t);\n\t\t\tentry.fileFallback = !entry.wakeRegistration.watching;\n\t\t}\n\t\tentry.fallback = entry.fileFallback || Date.now() < this.unhealthyUntil;\n\t}\n\n\tdiagnostics(): SupervisionDiagnostics {\n\t\tconst mode = this.forcePolling\n\t\t\t? \"polling(forced)\"\n\t\t\t: [...this.entries].some((entry) => entry.fallback)\n\t\t\t\t? \"polling(fallback)\"\n\t\t\t\t: \"wake+batch\";\n\t\treturn { mode, watcherCount: this.wakeRegistry.watcherCount };\n\t}\n\n\tclose(): void {\n\t\tthis.closed = true;\n\t\tif (this.timer) clearInterval(this.timer);\n\t\tthis.timer = undefined;\n\t\tif (this.unhealthyTimer) this.timers.clearTimeout(this.unhealthyTimer);\n\t\tthis.unhealthyTimer = undefined;\n\t\tfor (const entry of this.entries) this.unregister(entry);\n\t\tthis.entries.clear();\n\t\tthis.wakeRegistry.close();\n\t}\n\n\tprivate ensureTimer(): void {\n\t\tif (this.timer) return;\n\t\tthis.timer = setInterval(() => this.reconcile(), RECONCILE_INTERVAL_MS);\n\t\tthis.timer.unref?.();\n\t}\n\n\tprivate unregister(entry: Entry): void {\n\t\tentry.unregistered = true;\n\t\tentry.wakeRegistration?.unregister();\n\t\tthis.entries.delete(entry);\n\t\tif (this.entries.size === 0 && this.timer) {\n\t\t\tclearInterval(this.timer);\n\t\t\tthis.timer = undefined;\n\t\t}\n\t\t// Nothing can wake a parked wait now; settle it so its retain is released.\n\t\tentry.parked?.reject(new Error(UNREGISTERED_MESSAGE));\n\t}\n\n\tprivate enterFallback(entry: Entry): void {\n\t\tif (this.closed) return;\n\t\tentry.fileFallback = true;\n\t\tentry.fallback = true;\n\t\tentry.inspection = undefined;\n\t\tthis.signal(entry, \"reconcile\");\n\t}\n\n\tprivate wait(entry: Entry, signal: AbortSignal): Promise<WakeReason> {\n\t\tif (signal.aborted) return Promise.reject(new Error(ABORT_MESSAGE));\n\t\tif (entry.unregistered)\n\t\t\treturn Promise.reject(new Error(UNREGISTERED_MESSAGE));\n\t\t// One completion loop consumes a registration: `pending` queues a single\n\t\t// reason for a single waiter, so a second concurrent wait is a caller bug.\n\t\tif (entry.parked) return Promise.reject(new Error(CONCURRENT_WAIT_MESSAGE));\n\t\tif (entry.pending) {\n\t\t\tconst reason = entry.pending;\n\t\t\tentry.pending = undefined;\n\t\t\treturn Promise.resolve(reason);\n\t\t}\n\t\treturn new Promise((resolve, reject) => {\n\t\t\t// Both transports have one owned wait, so a mode change can release\n\t\t\t// the old timer or watch retain without replacing the registration.\n\t\t\tconst release = entry.fallback ? undefined : this.wakeRegistry.retain();\n\t\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\t\tlet settled = false;\n\t\t\tconst finish = (settle: () => void) => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\tentry.parked = undefined;\n\t\t\t\tif (timer) this.timers.clearTimeout(timer);\n\t\t\t\trelease?.();\n\t\t\t\tsettle();\n\t\t\t};\n\t\t\tconst onAbort = () => {\n\t\t\t\tfinish(() => reject(new Error(ABORT_MESSAGE)));\n\t\t\t};\n\t\t\tentry.parked = {\n\t\t\t\tpolling: entry.fallback,\n\t\t\t\tresolve: (reason) => finish(() => resolve(reason)),\n\t\t\t\treject: (error) => finish(() => reject(error)),\n\t\t\t};\n\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\tif (entry.fallback)\n\t\t\t\ttimer = this.timers.setTimeout(\n\t\t\t\t\t() => entry.parked?.resolve(\"reconcile\"),\n\t\t\t\t\tPOLLING_INTERVAL_MS,\n\t\t\t\t);\n\t\t});\n\t}\n\n\tprivate signal(entry: Entry, reason: WakeReason): void {\n\t\tif (this.closed) return;\n\t\tif (reason === \"wake\") entry.inspection = undefined;\n\t\t// Ordinary signals queue behind a poll's 1s cadence. Only a transport\n\t\t// change explicitly settles that timer early.\n\t\tif (entry.parked && !entry.parked.polling) entry.parked.resolve(reason);\n\t\t// A wake must never downgrade a queued reconciliation: the reconcile\n\t\t// reason carries the epoch's pane inspection, and skipping it would\n\t\t// defer pane-disappearance detection past the documented 5s bound.\n\t\telse if (entry.pending !== \"reconcile\") entry.pending = reason;\n\t}\n\n\tprivate async reconcile(): Promise<void> {\n\t\tif (this.closed || this.reconciling || this.entries.size === 0) return;\n\t\tthis.reconciling = true;\n\t\tconst snapshotGeneration = this.nextGeneration - 1;\n\t\ttry {\n\t\t\tconst snapshot = await this.listPanes();\n\t\t\tif (this.closed) return;\n\t\t\tif (!snapshot.complete) throw new Error(\"malformed pane list\");\n\t\t\tconst bySurface = new Set(snapshot.panes.map((pane) => pane.paneId));\n\t\t\tfor (const entry of this.entries) {\n\t\t\t\tentry.fallback = entry.fileFallback;\n\t\t\t\tif (entry.fallback || entry.generation > snapshotGeneration) {\n\t\t\t\t\t// Legacy polling and later registrants always inspect their own pane.\n\t\t\t\t\tentry.inspection = undefined;\n\t\t\t\t} else if (bySurface.has(entry.surface)) {\n\t\t\t\t\tentry.inspection = {\n\t\t\t\t\t\tkind: \"present\",\n\t\t\t\t\t\tagentStatus: \"unknown\",\n\t\t\t\t\t\tobservedAt: Date.now(),\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\t// A complete list can establish presence, not absence. Only pane get\n\t\t\t\t\t// may establish a missing pane before completion acts on it.\n\t\t\t\t\tentry.inspection = undefined;\n\t\t\t\t}\n\t\t\t\tthis.signal(entry, \"reconcile\");\n\t\t\t}\n\t\t\tthis.unhealthyUntil = 0;\n\t\t\tif (this.unhealthyTimer) this.timers.clearTimeout(this.unhealthyTimer);\n\t\t\tthis.unhealthyTimer = undefined;\n\t\t} catch {\n\t\t\tif (this.closed) return;\n\t\t\tthis.unhealthyUntil = Date.now() + BATCH_UNHEALTHY_MS;\n\t\t\tfor (const entry of this.entries) {\n\t\t\t\tentry.fallback = true;\n\t\t\t\tentry.inspection = undefined;\n\t\t\t\tthis.signal(entry, \"reconcile\");\n\t\t\t}\n\t\t\tif (this.unhealthyTimer) this.timers.clearTimeout(this.unhealthyTimer);\n\t\t\tthis.unhealthyTimer = this.timers.setTimeout(() => {\n\t\t\t\tthis.unhealthyTimer = undefined;\n\t\t\t\tif (!this.closed && Date.now() >= this.unhealthyUntil) this.reconcile();\n\t\t\t}, BATCH_UNHEALTHY_MS);\n\t\t\tthis.unhealthyTimer.unref?.();\n\t\t} finally {\n\t\t\tthis.reconciling = false;\n\t\t}\n\t}\n\n\tprivate async inspect(entry: Entry): Promise<PaneInspection> {\n\t\tif (entry.inspection) return entry.inspection;\n\t\treturn this.inspectFallback(entry.surface);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SurfaceProvider seam: the multiplexer is swappable infrastructure, not
|
|
3
|
+
* a foundation. pi-herdr-agents hard-requires Herdr; here Herdr is one
|
|
4
|
+
* provider among many, behind this interface.
|
|
5
|
+
*
|
|
6
|
+
* Methods may be sync or async; providers choose. The CLI is the only place
|
|
7
|
+
* that wires a provider to an adapter (via core's SurfaceHandle).
|
|
8
|
+
*/
|
|
9
|
+
import type { OpenedPrimaryWorkspaceReport, PrimaryWorkspaceClaim } from "./opened-primary-workspace.ts";
|
|
10
|
+
import type { PaneInspection, SurfaceHandle } from "./types.ts";
|
|
11
|
+
export type SurfacePlacement = {
|
|
12
|
+
kind: "grouped";
|
|
13
|
+
} | {
|
|
14
|
+
kind: "split";
|
|
15
|
+
direction: "right" | "down";
|
|
16
|
+
} | {
|
|
17
|
+
kind: "tab";
|
|
18
|
+
};
|
|
19
|
+
export interface SurfaceInfo {
|
|
20
|
+
id: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
cwd?: string;
|
|
23
|
+
/** Tab or window the surface belongs to. */
|
|
24
|
+
group?: string;
|
|
25
|
+
/** Provider-native workspace/container id when the provider reports one. */
|
|
26
|
+
workspaceId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface AcquisitionControl {
|
|
29
|
+
/** Admission intent only; abort does not cancel a remote mutation. */
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}
|
|
32
|
+
export type UncertainAcquisition = {
|
|
33
|
+
kind: "surface-create";
|
|
34
|
+
placement: "tab" | "split";
|
|
35
|
+
workspaceId?: string;
|
|
36
|
+
anchorSurfaceId?: string;
|
|
37
|
+
observedSurfaceId?: string;
|
|
38
|
+
} | {
|
|
39
|
+
kind: "worktree-create";
|
|
40
|
+
sourceCwd: string;
|
|
41
|
+
branch: string;
|
|
42
|
+
recovered?: RecoveredWorktreeProvisioning;
|
|
43
|
+
} | {
|
|
44
|
+
kind: "command-dispatch";
|
|
45
|
+
surfaceId: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "execution-start";
|
|
48
|
+
observedSurfaceId?: string;
|
|
49
|
+
/** Set only when the provider reserved this ID for this launch. */
|
|
50
|
+
acquiredSurfaceId?: string;
|
|
51
|
+
};
|
|
52
|
+
/** A started mutating request has no proven outcome. Never retry it. */
|
|
53
|
+
export declare class AcquisitionUncertainError extends Error {
|
|
54
|
+
readonly code = "PIHA_ACQUISITION_UNCERTAIN";
|
|
55
|
+
readonly uncertainty: UncertainAcquisition;
|
|
56
|
+
constructor(message: string, uncertainty: UncertainAcquisition, options?: ErrorOptions);
|
|
57
|
+
}
|
|
58
|
+
/** Structural so errors from an earlier extension load remain recognizable. */
|
|
59
|
+
export declare function isAcquisitionUncertainError(error: unknown): error is AcquisitionUncertainError;
|
|
60
|
+
export interface CreateSurfaceOptions extends AcquisitionControl {
|
|
61
|
+
name: string;
|
|
62
|
+
cwd: string;
|
|
63
|
+
/** Default: { kind: "grouped" }. */
|
|
64
|
+
placement?: SurfacePlacement;
|
|
65
|
+
}
|
|
66
|
+
export interface CreateWorktreeSurfaceOptions extends AcquisitionControl {
|
|
67
|
+
name: string;
|
|
68
|
+
cwd: string;
|
|
69
|
+
branch: string;
|
|
70
|
+
/** Base git ref or SHA the worktree starts from. */
|
|
71
|
+
base: string;
|
|
72
|
+
}
|
|
73
|
+
export interface WorktreeSurface {
|
|
74
|
+
path: string;
|
|
75
|
+
branch: string;
|
|
76
|
+
/** Provider-native workspace/container id for later removal. */
|
|
77
|
+
workspaceId: string;
|
|
78
|
+
surfaceId: string;
|
|
79
|
+
/** Non-fatal provisioning problems the parent should see, such as a failed snapshot. */
|
|
80
|
+
diagnostics?: string[];
|
|
81
|
+
}
|
|
82
|
+
export interface ReportOpenedPrimaryWorkspaceInput {
|
|
83
|
+
sourceRepo: string;
|
|
84
|
+
claims: readonly PrimaryWorkspaceClaim[];
|
|
85
|
+
}
|
|
86
|
+
export type RecoveredWorktreeProvisioning = Pick<WorktreeSurfaceInfo, "path" | "branch" | "workspaceId"> & {
|
|
87
|
+
paneId?: string;
|
|
88
|
+
};
|
|
89
|
+
export declare class WorktreeProvisioningError extends Error {
|
|
90
|
+
readonly recoveredWorktree: RecoveredWorktreeProvisioning;
|
|
91
|
+
constructor(message: string, recoveredWorktree: RecoveredWorktreeProvisioning);
|
|
92
|
+
}
|
|
93
|
+
export interface WorktreeSurfaceInfo {
|
|
94
|
+
/** Empty for detached HEAD. */
|
|
95
|
+
branch: string;
|
|
96
|
+
path: string;
|
|
97
|
+
label?: string;
|
|
98
|
+
workspaceId?: string;
|
|
99
|
+
isLinkedWorktree: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface SurfaceForegroundProcess {
|
|
102
|
+
pid: number;
|
|
103
|
+
name?: string;
|
|
104
|
+
argv0?: string;
|
|
105
|
+
argv?: string[];
|
|
106
|
+
cwd?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface SurfaceProcessInfo {
|
|
109
|
+
shellPid?: number;
|
|
110
|
+
foregroundProcessGroupId?: number;
|
|
111
|
+
pids: number[];
|
|
112
|
+
foregroundProcesses: SurfaceForegroundProcess[];
|
|
113
|
+
}
|
|
114
|
+
export type NativeExecutionInspection = {
|
|
115
|
+
kind: "live";
|
|
116
|
+
} | {
|
|
117
|
+
kind: "finished";
|
|
118
|
+
exitCode?: number;
|
|
119
|
+
} | {
|
|
120
|
+
kind: "missing";
|
|
121
|
+
} | {
|
|
122
|
+
kind: "unavailable";
|
|
123
|
+
error?: string;
|
|
124
|
+
};
|
|
125
|
+
/** Atomic program execution; no intermediate shell or surface acquisition. */
|
|
126
|
+
export interface NativeExecution {
|
|
127
|
+
start(input: {
|
|
128
|
+
cwd: string;
|
|
129
|
+
command: string;
|
|
130
|
+
scriptPath: string;
|
|
131
|
+
scriptPreamble: string;
|
|
132
|
+
signal?: AbortSignal;
|
|
133
|
+
}): Promise<string>;
|
|
134
|
+
inspect(id: string): Promise<NativeExecutionInspection>;
|
|
135
|
+
/** Confirmation of exit, never merely an acknowledgement of a signal. */
|
|
136
|
+
terminate(id: string): Promise<void>;
|
|
137
|
+
}
|
|
138
|
+
export interface SurfaceProvider {
|
|
139
|
+
readonly nativeExecution?: NativeExecution;
|
|
140
|
+
/** Stable provider name, e.g. "herdr". */
|
|
141
|
+
readonly name: string;
|
|
142
|
+
/** False when the multiplexer is not installed/usable. Never throws. */
|
|
143
|
+
isAvailable(): boolean;
|
|
144
|
+
/** Create a new surface (tab/pane/window). Returns the surface id. */
|
|
145
|
+
createSurface(opts: CreateSurfaceOptions): string | Promise<string>;
|
|
146
|
+
/** Run a shell command in the surface (sends text + Enter). */
|
|
147
|
+
runCommand(surfaceId: string, command: string): void | Promise<void>;
|
|
148
|
+
/** Read visible screen text, most recent `lines` lines. */
|
|
149
|
+
readScreen(surfaceId: string, lines?: number): string | Promise<string>;
|
|
150
|
+
/** Close and discard a surface. */
|
|
151
|
+
closeSurface(surfaceId: string): void | Promise<void>;
|
|
152
|
+
listSurfaces(opts?: {
|
|
153
|
+
timeoutMs?: number;
|
|
154
|
+
}): SurfaceInfo[] | Promise<SurfaceInfo[]>;
|
|
155
|
+
/**
|
|
156
|
+
* Wrap an already-existing surface id as a SurfaceHandle (for adapters and
|
|
157
|
+
* for `maestro kill`). Works because provider CLIs address surfaces by id.
|
|
158
|
+
*/
|
|
159
|
+
attachSurface(id: string): SurfaceHandle;
|
|
160
|
+
/** Create a worktree-backed surface: isolated checkout + hosting surface. */
|
|
161
|
+
createWorktreeSurface(opts: CreateWorktreeSurfaceOptions): WorktreeSurface | Promise<WorktreeSurface>;
|
|
162
|
+
/** Remove a worktree-backed surface created by createWorktreeSurface. */
|
|
163
|
+
removeWorktreeSurface(workspaceId: string, opts?: {
|
|
164
|
+
timeoutMs?: number;
|
|
165
|
+
}): void | Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Suggest closing a claimed primary workspace that still looks untouched.
|
|
168
|
+
* Never closes it. Unsupported providers return undefined.
|
|
169
|
+
*/
|
|
170
|
+
reportOpenedPrimaryWorkspace(input: ReportOpenedPrimaryWorkspaceInput): OpenedPrimaryWorkspaceReport | undefined | Promise<OpenedPrimaryWorkspaceReport | undefined>;
|
|
171
|
+
/** Human-readable hint when isAvailable() is false; today's terminalSetupHint(). */
|
|
172
|
+
setupHint(): string;
|
|
173
|
+
/**
|
|
174
|
+
* Write a script file and run it in the surface; today's runScriptInPane (terminal.ts:115).
|
|
175
|
+
* Rejects with a command-dispatch {@link AcquisitionUncertainError} when the
|
|
176
|
+
* command may have reached the surface; any other rejection dispatched nothing.
|
|
177
|
+
*/
|
|
178
|
+
runScript(surfaceId: string, command: string, options: {
|
|
179
|
+
scriptPath: string;
|
|
180
|
+
scriptPreamble: string;
|
|
181
|
+
}): string | Promise<string>;
|
|
182
|
+
inspectSurface(surfaceId: string): Promise<PaneInspection>;
|
|
183
|
+
sendKeys(surfaceId: string, keys: string): void | Promise<void>;
|
|
184
|
+
getProcessInfo(surfaceId: string, opts?: {
|
|
185
|
+
timeoutMs?: number;
|
|
186
|
+
}): SurfaceProcessInfo | Promise<SurfaceProcessInfo>;
|
|
187
|
+
waitForShellReady(surfaceId: string, opts?: {
|
|
188
|
+
timeoutMs?: number;
|
|
189
|
+
}): Promise<void>;
|
|
190
|
+
waitForSurfaceAbsence(surfaceId: string, opts?: {
|
|
191
|
+
timeoutMs?: number;
|
|
192
|
+
}): Promise<void>;
|
|
193
|
+
listWorktreeSurfaces(opts?: {
|
|
194
|
+
cwd?: string;
|
|
195
|
+
timeoutMs?: number;
|
|
196
|
+
}): Promise<WorktreeSurfaceInfo[]>;
|
|
197
|
+
focusWorkspace(workspaceId: string): void | Promise<void>;
|
|
198
|
+
setTitle(target: "tab" | "workspace", title: string): void | Promise<void>;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=surface-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-provider.d.ts","sourceRoot":"","sources":["../../../maestro/core/surface-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EACX,4BAA4B,EAC5B,qBAAqB,EACrB,MAAM,+BAA+B,CA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AAC,MAAM,EAAE,KAAK,GAAG,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** A started mutating request has no proven outcome. Never retry it. */
|
|
2
|
+
export class AcquisitionUncertainError extends Error {
|
|
3
|
+
code = "PIHA_ACQUISITION_UNCERTAIN";
|
|
4
|
+
uncertainty;
|
|
5
|
+
constructor(message, uncertainty, options) {
|
|
6
|
+
super(message, options);
|
|
7
|
+
this.name = "AcquisitionUncertainError";
|
|
8
|
+
this.uncertainty = uncertainty;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/* oxlint-disable anti-slop/no-unknown-parameters, anti-slop/no-runtime-typeof, anti-slop/no-unsafe-dictionary-type -- This harness-neutral error boundary validates unknown cross-load values without an SDK/schema dependency. */
|
|
12
|
+
function isAcquisitionRecord(value) {
|
|
13
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
/** Structural so errors from an earlier extension load remain recognizable. */
|
|
16
|
+
export function isAcquisitionUncertainError(error) {
|
|
17
|
+
if (!isAcquisitionRecord(error) ||
|
|
18
|
+
error.code !== "PIHA_ACQUISITION_UNCERTAIN" ||
|
|
19
|
+
typeof error.name !== "string" ||
|
|
20
|
+
typeof error.message !== "string" ||
|
|
21
|
+
(error.stack !== undefined && typeof error.stack !== "string") ||
|
|
22
|
+
typeof error.toString !== "function")
|
|
23
|
+
return false;
|
|
24
|
+
const value = error.uncertainty;
|
|
25
|
+
if (!isAcquisitionRecord(value))
|
|
26
|
+
return false;
|
|
27
|
+
switch (value.kind) {
|
|
28
|
+
case "surface-create":
|
|
29
|
+
return ((value.placement === "tab" || value.placement === "split") &&
|
|
30
|
+
(value.workspaceId === undefined ||
|
|
31
|
+
typeof value.workspaceId === "string") &&
|
|
32
|
+
(value.anchorSurfaceId === undefined ||
|
|
33
|
+
typeof value.anchorSurfaceId === "string") &&
|
|
34
|
+
(value.observedSurfaceId === undefined ||
|
|
35
|
+
typeof value.observedSurfaceId === "string"));
|
|
36
|
+
case "worktree-create": {
|
|
37
|
+
if (typeof value.sourceCwd !== "string" ||
|
|
38
|
+
typeof value.branch !== "string")
|
|
39
|
+
return false;
|
|
40
|
+
const recovered = value.recovered;
|
|
41
|
+
return (recovered === undefined ||
|
|
42
|
+
(isAcquisitionRecord(recovered) &&
|
|
43
|
+
typeof recovered.path === "string" &&
|
|
44
|
+
typeof recovered.branch === "string" &&
|
|
45
|
+
(recovered.workspaceId === undefined ||
|
|
46
|
+
typeof recovered.workspaceId === "string") &&
|
|
47
|
+
(recovered.paneId === undefined ||
|
|
48
|
+
typeof recovered.paneId === "string")));
|
|
49
|
+
}
|
|
50
|
+
case "command-dispatch":
|
|
51
|
+
return typeof value.surfaceId === "string";
|
|
52
|
+
case "execution-start":
|
|
53
|
+
return ((value.observedSurfaceId === undefined ||
|
|
54
|
+
(typeof value.observedSurfaceId === "string" &&
|
|
55
|
+
/^t[0-9a-z]+$/.test(value.observedSurfaceId))) &&
|
|
56
|
+
(value.acquiredSurfaceId === undefined ||
|
|
57
|
+
(typeof value.acquiredSurfaceId === "string" &&
|
|
58
|
+
value.acquiredSurfaceId === value.observedSurfaceId)));
|
|
59
|
+
default:
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export class WorktreeProvisioningError extends Error {
|
|
64
|
+
recoveredWorktree;
|
|
65
|
+
constructor(message, recoveredWorktree) {
|
|
66
|
+
super(message);
|
|
67
|
+
this.name = "WorktreeProvisioningError";
|
|
68
|
+
this.recoveredWorktree = recoveredWorktree;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=surface-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-provider.js","sourceRoot":"","sources":["../../../maestro/core/surface-provider.ts"],"names":[],"mappings":"AA2DA,wEA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CACvD,CAAC;QACH;YACC,OAAO,KAAK,CAAC;IACf,CAAC;AACF,CAAC;AAuCD,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAC1C,iBAAiB,CAAgC;IAE1D,YACC,OAAe,EACf,iBAAgD;QAEhD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/**\n * The SurfaceProvider seam: the multiplexer is swappable infrastructure, not\n * a foundation. pi-herdr-agents hard-requires Herdr; here Herdr is one\n * provider among many, behind this interface.\n *\n * Methods may be sync or async; providers choose. The CLI is the only place\n * that wires a provider to an adapter (via core's SurfaceHandle).\n */\nimport type {\n\tOpenedPrimaryWorkspaceReport,\n\tPrimaryWorkspaceClaim,\n} from \"./opened-primary-workspace.ts\";\nimport type { PaneInspection, SurfaceHandle } from \"./types.ts\";\n\n// pi-herdr-agents extension\nexport type SurfacePlacement =\n\t| { kind: \"grouped\" }\n\t| { kind: \"split\"; direction: \"right\" | \"down\" }\n\t| { kind: \"tab\" };\n\nexport interface SurfaceInfo {\n\tid: string;\n\tname?: string;\n\tcwd?: string;\n\t/** Tab or window the surface belongs to. */\n\t// pi-herdr-agents extension\n\tgroup?: string;\n\t/** Provider-native workspace/container id when the provider reports one. */\n\t// pi-herdr-agents extension\n\tworkspaceId?: string;\n}\n\nexport interface AcquisitionControl {\n\t/** Admission intent only; abort does not cancel a remote mutation. */\n\tsignal?: AbortSignal;\n}\n\nexport type UncertainAcquisition =\n\t| {\n\t\t\tkind: \"surface-create\";\n\t\t\tplacement: \"tab\" | \"split\";\n\t\t\tworkspaceId?: string;\n\t\t\tanchorSurfaceId?: string;\n\t\t\tobservedSurfaceId?: string;\n\t }\n\t| {\n\t\t\tkind: \"worktree-create\";\n\t\t\tsourceCwd: string;\n\t\t\tbranch: string;\n\t\t\trecovered?: RecoveredWorktreeProvisioning;\n\t }\n\t| { kind: \"command-dispatch\"; surfaceId: string }\n\t| {\n\t\t\tkind: \"execution-start\";\n\t\t\tobservedSurfaceId?: string;\n\t\t\t/** Set only when the provider reserved this ID for this launch. */\n\t\t\tacquiredSurfaceId?: string;\n\t };\n\n/** A started mutating request has no proven outcome. Never retry it. */\nexport class AcquisitionUncertainError extends Error {\n\treadonly code = \"PIHA_ACQUISITION_UNCERTAIN\";\n\treadonly uncertainty: UncertainAcquisition;\n\tconstructor(\n\t\tmessage: string,\n\t\tuncertainty: UncertainAcquisition,\n\t\toptions?: ErrorOptions,\n\t) {\n\t\tsuper(message, options);\n\t\tthis.name = \"AcquisitionUncertainError\";\n\t\tthis.uncertainty = uncertainty;\n\t}\n}\n\n/* oxlint-disable anti-slop/no-unknown-parameters, anti-slop/no-runtime-typeof, anti-slop/no-unsafe-dictionary-type -- This harness-neutral error boundary validates unknown cross-load values without an SDK/schema dependency. */\nfunction isAcquisitionRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Structural so errors from an earlier extension load remain recognizable. */\nexport function isAcquisitionUncertainError(\n\terror: unknown,\n): error is AcquisitionUncertainError {\n\tif (\n\t\t!isAcquisitionRecord(error) ||\n\t\terror.code !== \"PIHA_ACQUISITION_UNCERTAIN\" ||\n\t\ttypeof error.name !== \"string\" ||\n\t\ttypeof error.message !== \"string\" ||\n\t\t(error.stack !== undefined && typeof error.stack !== \"string\") ||\n\t\ttypeof error.toString !== \"function\"\n\t)\n\t\treturn false;\n\tconst value = error.uncertainty;\n\tif (!isAcquisitionRecord(value)) return false;\n\tswitch (value.kind) {\n\t\tcase \"surface-create\":\n\t\t\treturn (\n\t\t\t\t(value.placement === \"tab\" || value.placement === \"split\") &&\n\t\t\t\t(value.workspaceId === undefined ||\n\t\t\t\t\ttypeof value.workspaceId === \"string\") &&\n\t\t\t\t(value.anchorSurfaceId === undefined ||\n\t\t\t\t\ttypeof value.anchorSurfaceId === \"string\") &&\n\t\t\t\t(value.observedSurfaceId === undefined ||\n\t\t\t\t\ttypeof value.observedSurfaceId === \"string\")\n\t\t\t);\n\t\tcase \"worktree-create\": {\n\t\t\tif (\n\t\t\t\ttypeof value.sourceCwd !== \"string\" ||\n\t\t\t\ttypeof value.branch !== \"string\"\n\t\t\t)\n\t\t\t\treturn false;\n\t\t\tconst recovered = value.recovered;\n\t\t\treturn (\n\t\t\t\trecovered === undefined ||\n\t\t\t\t(isAcquisitionRecord(recovered) &&\n\t\t\t\t\ttypeof recovered.path === \"string\" &&\n\t\t\t\t\ttypeof recovered.branch === \"string\" &&\n\t\t\t\t\t(recovered.workspaceId === undefined ||\n\t\t\t\t\t\ttypeof recovered.workspaceId === \"string\") &&\n\t\t\t\t\t(recovered.paneId === undefined ||\n\t\t\t\t\t\ttypeof recovered.paneId === \"string\"))\n\t\t\t);\n\t\t}\n\t\tcase \"command-dispatch\":\n\t\t\treturn typeof value.surfaceId === \"string\";\n\t\tcase \"execution-start\":\n\t\t\treturn (\n\t\t\t\t(value.observedSurfaceId === undefined ||\n\t\t\t\t\t(typeof value.observedSurfaceId === \"string\" &&\n\t\t\t\t\t\t/^t[0-9a-z]+$/.test(value.observedSurfaceId))) &&\n\t\t\t\t(value.acquiredSurfaceId === undefined ||\n\t\t\t\t\t(typeof value.acquiredSurfaceId === \"string\" &&\n\t\t\t\t\t\tvalue.acquiredSurfaceId === value.observedSurfaceId))\n\t\t\t);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n/* oxlint-enable anti-slop/no-unknown-parameters, anti-slop/no-runtime-typeof, anti-slop/no-unsafe-dictionary-type */\n\nexport interface CreateSurfaceOptions extends AcquisitionControl {\n\tname: string;\n\tcwd: string;\n\t/** Default: { kind: \"grouped\" }. */\n\t// pi-herdr-agents extension\n\tplacement?: SurfacePlacement;\n}\n\nexport interface CreateWorktreeSurfaceOptions extends AcquisitionControl {\n\tname: string;\n\tcwd: string;\n\tbranch: string;\n\t/** Base git ref or SHA the worktree starts from. */\n\tbase: string;\n}\n\nexport interface WorktreeSurface {\n\tpath: string;\n\tbranch: string;\n\t/** Provider-native workspace/container id for later removal. */\n\tworkspaceId: string;\n\tsurfaceId: string;\n\t/** Non-fatal provisioning problems the parent should see, such as a failed snapshot. */\n\tdiagnostics?: string[];\n}\n\nexport interface ReportOpenedPrimaryWorkspaceInput {\n\tsourceRepo: string;\n\tclaims: readonly PrimaryWorkspaceClaim[];\n}\n\nexport type RecoveredWorktreeProvisioning = Pick<\n\tWorktreeSurfaceInfo,\n\t\"path\" | \"branch\" | \"workspaceId\"\n> & { paneId?: string };\n\nexport class WorktreeProvisioningError extends Error {\n\treadonly recoveredWorktree: RecoveredWorktreeProvisioning;\n\n\tconstructor(\n\t\tmessage: string,\n\t\trecoveredWorktree: RecoveredWorktreeProvisioning,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"WorktreeProvisioningError\";\n\t\tthis.recoveredWorktree = recoveredWorktree;\n\t}\n}\n\n// pi-herdr-agents extension\nexport interface WorktreeSurfaceInfo {\n\t/** Empty for detached HEAD. */\n\tbranch: string;\n\tpath: string;\n\tlabel?: string;\n\tworkspaceId?: string;\n\tisLinkedWorktree: boolean;\n}\n\n// pi-herdr-agents extension\nexport interface SurfaceForegroundProcess {\n\tpid: number;\n\tname?: string;\n\targv0?: string;\n\targv?: string[];\n\tcwd?: string;\n}\n\n// pi-herdr-agents extension\nexport interface SurfaceProcessInfo {\n\tshellPid?: number;\n\tforegroundProcessGroupId?: number;\n\tpids: number[];\n\tforegroundProcesses: SurfaceForegroundProcess[];\n}\n\nexport type NativeExecutionInspection =\n\t| { kind: \"live\" }\n\t| { kind: \"finished\"; exitCode?: number }\n\t| { kind: \"missing\" }\n\t| { kind: \"unavailable\"; error?: string };\n\n/** Atomic program execution; no intermediate shell or surface acquisition. */\nexport interface NativeExecution {\n\tstart(input: {\n\t\tcwd: string;\n\t\tcommand: string;\n\t\tscriptPath: string;\n\t\tscriptPreamble: string;\n\t\tsignal?: AbortSignal;\n\t}): Promise<string>;\n\tinspect(id: string): Promise<NativeExecutionInspection>;\n\t/** Confirmation of exit, never merely an acknowledgement of a signal. */\n\tterminate(id: string): Promise<void>;\n}\n\nexport interface SurfaceProvider {\n\treadonly nativeExecution?: NativeExecution;\n\t/** Stable provider name, e.g. \"herdr\". */\n\treadonly name: string;\n\n\t/** False when the multiplexer is not installed/usable. Never throws. */\n\tisAvailable(): boolean;\n\n\t/** Create a new surface (tab/pane/window). Returns the surface id. */\n\tcreateSurface(opts: CreateSurfaceOptions): string | Promise<string>;\n\n\t/** Run a shell command in the surface (sends text + Enter). */\n\trunCommand(surfaceId: string, command: string): void | Promise<void>;\n\n\t/** Read visible screen text, most recent `lines` lines. */\n\treadScreen(surfaceId: string, lines?: number): string | Promise<string>;\n\n\t/** Close and discard a surface. */\n\tcloseSurface(surfaceId: string): void | Promise<void>;\n\n\tlistSurfaces(opts?: {\n\t\ttimeoutMs?: number;\n\t}): SurfaceInfo[] | Promise<SurfaceInfo[]>;\n\n\t/**\n\t * Wrap an already-existing surface id as a SurfaceHandle (for adapters and\n\t * for `maestro kill`). Works because provider CLIs address surfaces by id.\n\t */\n\tattachSurface(id: string): SurfaceHandle;\n\n\t/** Create a worktree-backed surface: isolated checkout + hosting surface. */\n\tcreateWorktreeSurface(\n\t\topts: CreateWorktreeSurfaceOptions,\n\t): WorktreeSurface | Promise<WorktreeSurface>;\n\n\t/** Remove a worktree-backed surface created by createWorktreeSurface. */\n\tremoveWorktreeSurface(\n\t\tworkspaceId: string,\n\t\topts?: { timeoutMs?: number },\n\t): void | Promise<void>;\n\n\t/**\n\t * Suggest closing a claimed primary workspace that still looks untouched.\n\t * Never closes it. Unsupported providers return undefined.\n\t */\n\treportOpenedPrimaryWorkspace(\n\t\tinput: ReportOpenedPrimaryWorkspaceInput,\n\t):\n\t\t| OpenedPrimaryWorkspaceReport\n\t\t| undefined\n\t\t| Promise<OpenedPrimaryWorkspaceReport | undefined>;\n\n\t/** Human-readable hint when isAvailable() is false; today's terminalSetupHint(). */\n\t// pi-herdr-agents extension\n\tsetupHint(): string;\n\n\t/**\n\t * Write a script file and run it in the surface; today's runScriptInPane (terminal.ts:115).\n\t * Rejects with a command-dispatch {@link AcquisitionUncertainError} when the\n\t * command may have reached the surface; any other rejection dispatched nothing.\n\t */\n\t// pi-herdr-agents extension\n\trunScript(\n\t\tsurfaceId: string,\n\t\tcommand: string,\n\t\toptions: { scriptPath: string; scriptPreamble: string },\n\t): string | Promise<string>;\n\n\t// pi-herdr-agents extension\n\tinspectSurface(surfaceId: string): Promise<PaneInspection>;\n\n\t// pi-herdr-agents extension\n\tsendKeys(surfaceId: string, keys: string): void | Promise<void>;\n\n\t// pi-herdr-agents extension\n\tgetProcessInfo(\n\t\tsurfaceId: string,\n\t\topts?: { timeoutMs?: number },\n\t): SurfaceProcessInfo | Promise<SurfaceProcessInfo>;\n\n\t// pi-herdr-agents extension\n\twaitForShellReady(\n\t\tsurfaceId: string,\n\t\topts?: { timeoutMs?: number },\n\t): Promise<void>;\n\n\t// pi-herdr-agents extension\n\twaitForSurfaceAbsence(\n\t\tsurfaceId: string,\n\t\topts?: { timeoutMs?: number },\n\t): Promise<void>;\n\n\t// pi-herdr-agents extension\n\tlistWorktreeSurfaces(opts?: {\n\t\tcwd?: string;\n\t\ttimeoutMs?: number;\n\t}): Promise<WorktreeSurfaceInfo[]>;\n\n\t// pi-herdr-agents extension\n\tfocusWorkspace(workspaceId: string): void | Promise<void>;\n\n\t// pi-herdr-agents extension\n\tsetTitle(target: \"tab\" | \"workspace\", title: string): void | Promise<void>;\n}\n"]}
|