@caupulican/pi-adaptative 0.81.37 → 0.81.39
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/CHANGELOG.md +91 -0
- package/README.md +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/README.md +18 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +131 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +196 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +308 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +22 -2
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +585 -24
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +749 -27
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/__init__.py +43 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/fs.py +270 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/search.py +252 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/strings.py +399 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/text.py +575 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/context.py +52 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/errors.py +49 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +734 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/expand.py +238 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/main.py +132 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/nodes.py +116 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/parser.py +287 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/proc.py +137 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/state.py +100 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +579 -0
- package/dist/bundled-resources/skills/tool-call-repair/SKILL.md +19 -9
- package/dist/bundled-resources/skills/tool-call-repair/references/failure-grammar.md +22 -5
- package/dist/bundled-resources/skills/tool-call-repair/references/repair-catalogue.md +5 -5
- package/dist/bundled-resources/skills/tool-call-repair/references/text-protocol-grammar.md +28 -7
- package/dist/cli/args.d.ts +3 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +15 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-paths.d.ts +49 -0
- package/dist/core/agent-paths.d.ts.map +1 -0
- package/dist/core/agent-paths.js +107 -0
- package/dist/core/agent-paths.js.map +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +3 -3
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +234 -17
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +484 -62
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/contracts.d.ts +9 -0
- package/dist/core/autonomy/contracts.d.ts.map +1 -1
- package/dist/core/autonomy/contracts.js.map +1 -1
- package/dist/core/autonomy/lane-tracker.d.ts +10 -1
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tracker.js +5 -1
- package/dist/core/autonomy/lane-tracker.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +122 -6
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +447 -90
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bash-execution-controller.d.ts +4 -0
- package/dist/core/bash-execution-controller.d.ts.map +1 -1
- package/dist/core/bash-execution-controller.js +7 -1
- package/dist/core/bash-execution-controller.js.map +1 -1
- package/dist/core/compaction-support.d.ts +13 -3
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +43 -7
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/context-audit.d.ts +33 -1
- package/dist/core/context/context-audit.d.ts.map +1 -1
- package/dist/core/context/context-audit.js +31 -5
- package/dist/core/context/context-audit.js.map +1 -1
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
- package/dist/core/context/sqlite-runtime-index.js +13 -7
- package/dist/core/context/sqlite-runtime-index.js.map +1 -1
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +16 -1
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +26 -4
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +137 -14
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost-guard.d.ts +19 -3
- package/dist/core/cost-guard.d.ts.map +1 -1
- package/dist/core/cost-guard.js +18 -3
- package/dist/core/cost-guard.js.map +1 -1
- package/dist/core/delegation/session-worker-result.d.ts +34 -4
- package/dist/core/delegation/session-worker-result.d.ts.map +1 -1
- package/dist/core/delegation/session-worker-result.js +64 -4
- package/dist/core/delegation/session-worker-result.js.map +1 -1
- package/dist/core/delegation/worker-actions.d.ts.map +1 -1
- package/dist/core/delegation/worker-actions.js +1 -1
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/worker-result.d.ts +42 -1
- package/dist/core/delegation/worker-result.d.ts.map +1 -1
- package/dist/core/delegation/worker-result.js +68 -0
- package/dist/core/delegation/worker-result.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +23 -7
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +51 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts +17 -1
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +79 -11
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-controller.d.ts +48 -2
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-controller.js +77 -0
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.d.ts +39 -0
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.js +42 -0
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts +4 -0
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.js +51 -10
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.d.ts +101 -2
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js +87 -4
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/goal-state.d.ts +89 -1
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +71 -5
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +56 -2
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +111 -5
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/session-goal-state.d.ts +11 -2
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js +32 -17
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/keybindings.d.ts +10 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +10 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/learning/observation-store.d.ts +12 -3
- package/dist/core/learning/observation-store.d.ts.map +1 -1
- package/dist/core/learning/observation-store.js +30 -15
- package/dist/core/learning/observation-store.js.map +1 -1
- package/dist/core/learning/skill-curator.d.ts +5 -1
- package/dist/core/learning/skill-curator.d.ts.map +1 -1
- package/dist/core/learning/skill-curator.js +21 -19
- package/dist/core/learning/skill-curator.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts +65 -3
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js +186 -26
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/memory/providers/file-store.d.ts +1 -1
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +6 -6
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/model-capability.d.ts +34 -0
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +42 -1
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-router/tool-escalation.d.ts +15 -0
- package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
- package/dist/core/model-router/tool-escalation.js +23 -1
- package/dist/core/model-router/tool-escalation.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +34 -7
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +95 -16
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/models/adaptation-store.d.ts +7 -0
- package/dist/core/models/adaptation-store.d.ts.map +1 -1
- package/dist/core/models/adaptation-store.js +47 -11
- package/dist/core/models/adaptation-store.js.map +1 -1
- package/dist/core/models/default-model-suggestions.d.ts.map +1 -1
- package/dist/core/models/default-model-suggestions.js +17 -0
- package/dist/core/models/default-model-suggestions.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +3 -0
- package/dist/core/models/fitness-store.d.ts.map +1 -1
- package/dist/core/models/fitness-store.js +11 -2
- package/dist/core/models/fitness-store.js.map +1 -1
- package/dist/core/models/llamacpp-runtime.d.ts +180 -0
- package/dist/core/models/llamacpp-runtime.d.ts.map +1 -0
- package/dist/core/models/llamacpp-runtime.js +475 -0
- package/dist/core/models/llamacpp-runtime.js.map +1 -0
- package/dist/core/models/local-registration.d.ts +40 -0
- package/dist/core/models/local-registration.d.ts.map +1 -1
- package/dist/core/models/local-registration.js +94 -5
- package/dist/core/models/local-registration.js.map +1 -1
- package/dist/core/models/local-runtime.d.ts.map +1 -1
- package/dist/core/models/local-runtime.js +9 -7
- package/dist/core/models/local-runtime.js.map +1 -1
- package/dist/core/models/model-ref.d.ts +7 -0
- package/dist/core/models/model-ref.d.ts.map +1 -1
- package/dist/core/models/model-ref.js +26 -0
- package/dist/core/models/model-ref.js.map +1 -1
- package/dist/core/models/needle-runtime.d.ts +257 -0
- package/dist/core/models/needle-runtime.d.ts.map +1 -0
- package/dist/core/models/needle-runtime.js +519 -0
- package/dist/core/models/needle-runtime.js.map +1 -0
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts +89 -0
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts.map +1 -0
- package/dist/core/models/prism-llamacpp-lifecycle.js +121 -0
- package/dist/core/models/prism-llamacpp-lifecycle.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +11 -10
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/process-matrix/codes.d.ts +72 -0
- package/dist/core/process-matrix/codes.d.ts.map +1 -0
- package/dist/core/process-matrix/codes.js +15 -0
- package/dist/core/process-matrix/codes.js.map +1 -0
- package/dist/core/process-matrix/runtime.d.ts +63 -0
- package/dist/core/process-matrix/runtime.d.ts.map +1 -0
- package/dist/core/process-matrix/runtime.js +310 -0
- package/dist/core/process-matrix/runtime.js.map +1 -0
- package/dist/core/process-matrix/store.d.ts +22 -0
- package/dist/core/process-matrix/store.d.ts.map +1 -0
- package/dist/core/process-matrix/store.js +80 -0
- package/dist/core/process-matrix/store.js.map +1 -0
- package/dist/core/process-matrix/supervisor.d.ts +72 -0
- package/dist/core/process-matrix/supervisor.d.ts.map +1 -0
- package/dist/core/process-matrix/supervisor.js +130 -0
- package/dist/core/process-matrix/supervisor.js.map +1 -0
- package/dist/core/profile-registry.d.ts +7 -0
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +20 -0
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/python-runtime.d.ts.map +1 -1
- package/dist/core/python-runtime.js +3 -3
- package/dist/core/python-runtime.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +29 -5
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +215 -126
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/reload-blockers.d.ts +36 -0
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +44 -0
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +8 -7
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +58 -5
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +209 -25
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/scout-controller.d.ts +6 -0
- package/dist/core/scout-controller.d.ts.map +1 -1
- package/dist/core/scout-controller.js +66 -52
- package/dist/core/scout-controller.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-role.d.ts +31 -0
- package/dist/core/session-role.d.ts.map +1 -0
- package/dist/core/session-role.js +52 -0
- package/dist/core/session-role.js.map +1 -0
- package/dist/core/settings-manager.d.ts +42 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +94 -60
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +12 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +6 -0
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.d.ts +14 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +20 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/session-task-state.d.ts +11 -2
- package/dist/core/tasks/session-task-state.d.ts.map +1 -1
- package/dist/core/tasks/session-task-state.js +27 -11
- package/dist/core/tasks/session-task-state.js.map +1 -1
- package/dist/core/tasks/task-contract-monitor.d.ts +45 -0
- package/dist/core/tasks/task-contract-monitor.d.ts.map +1 -0
- package/dist/core/tasks/task-contract-monitor.js +56 -0
- package/dist/core/tasks/task-contract-monitor.js.map +1 -0
- package/dist/core/tasks/task-state.d.ts +8 -0
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js +28 -1
- package/dist/core/tasks/task-state.js.map +1 -1
- package/dist/core/tool-gate-controller.d.ts.map +1 -1
- package/dist/core/tool-gate-controller.js +5 -0
- package/dist/core/tool-gate-controller.js.map +1 -1
- package/dist/core/tool-recovery-log-records.d.ts +7 -0
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js +14 -6
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-selection/promotion.d.ts +54 -0
- package/dist/core/tool-selection/promotion.d.ts.map +1 -0
- package/dist/core/tool-selection/promotion.js +81 -0
- package/dist/core/tool-selection/promotion.js.map +1 -0
- package/dist/core/tool-selection/tool-performance-store.d.ts +37 -0
- package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.js +87 -3
- package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
- package/dist/core/tool-selection/tool-selection-controller.d.ts +45 -0
- package/dist/core/tool-selection/tool-selection-controller.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-selection-controller.js +96 -0
- package/dist/core/tool-selection/tool-selection-controller.js.map +1 -1
- package/dist/core/tools/bash.d.ts +18 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +97 -18
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts +14 -0
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +82 -7
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +25 -8
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +52 -44
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/goal.d.ts +94 -3
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +165 -15
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +5 -4
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts +7 -0
- package/dist/core/tools/model-fitness.d.ts.map +1 -1
- package/dist/core/tools/model-fitness.js +2 -2
- package/dist/core/tools/model-fitness.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/shell-contract-router.d.ts +6 -1
- package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
- package/dist/core/tools/shell-contract-router.js +69 -13
- package/dist/core/tools/shell-contract-router.js.map +1 -1
- package/dist/core/tools/shell-session.d.ts +89 -0
- package/dist/core/tools/shell-session.d.ts.map +1 -0
- package/dist/core/tools/shell-session.js +432 -0
- package/dist/core/tools/shell-session.js.map +1 -0
- package/dist/core/tools/task-steps.d.ts +4 -0
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +63 -8
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +86 -0
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -0
- package/dist/core/tools/tmux-dispatch.js +91 -0
- package/dist/core/tools/tmux-dispatch.js.map +1 -0
- package/dist/core/tools/windows-shell-engine.d.ts +42 -0
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -0
- package/dist/core/tools/windows-shell-engine.js +153 -0
- package/dist/core/tools/windows-shell-engine.js.map +1 -0
- package/dist/core/tools/windows-shell-state.d.ts +40 -0
- package/dist/core/tools/windows-shell-state.d.ts.map +1 -0
- package/dist/core/tools/windows-shell-state.js +59 -0
- package/dist/core/tools/windows-shell-state.js.map +1 -0
- package/dist/core/tools/worktree-sync.d.ts +24 -0
- package/dist/core/tools/worktree-sync.d.ts.map +1 -0
- package/dist/core/tools/worktree-sync.js +338 -0
- package/dist/core/tools/worktree-sync.js.map +1 -0
- package/dist/core/trust-manager.d.ts +4 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +20 -2
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts +55 -0
- package/dist/core/util/atomic-file.d.ts.map +1 -0
- package/dist/core/util/atomic-file.js +255 -0
- package/dist/core/util/atomic-file.js.map +1 -0
- package/dist/core/util/minimatch-cache.d.ts +33 -0
- package/dist/core/util/minimatch-cache.d.ts.map +1 -0
- package/dist/core/util/minimatch-cache.js +0 -0
- package/dist/core/util/minimatch-cache.js.map +1 -0
- package/dist/core/worktree-sync/codes.d.ts +227 -0
- package/dist/core/worktree-sync/codes.d.ts.map +1 -0
- package/dist/core/worktree-sync/codes.js +14 -0
- package/dist/core/worktree-sync/codes.js.map +1 -0
- package/dist/core/worktree-sync/git-engine.d.ts +156 -0
- package/dist/core/worktree-sync/git-engine.d.ts.map +1 -0
- package/dist/core/worktree-sync/git-engine.js +1191 -0
- package/dist/core/worktree-sync/git-engine.js.map +1 -0
- package/dist/core/worktree-sync/lane-gate.d.ts +75 -0
- package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -0
- package/dist/core/worktree-sync/lane-gate.js +360 -0
- package/dist/core/worktree-sync/lane-gate.js.map +1 -0
- package/dist/core/worktree-sync/runtime.d.ts +47 -0
- package/dist/core/worktree-sync/runtime.d.ts.map +1 -0
- package/dist/core/worktree-sync/runtime.js +96 -0
- package/dist/core/worktree-sync/runtime.js.map +1 -0
- package/dist/core/worktree-sync/store.d.ts +69 -0
- package/dist/core/worktree-sync/store.d.ts.map +1 -0
- package/dist/core/worktree-sync/store.js +247 -0
- package/dist/core/worktree-sync/store.js.map +1 -0
- package/dist/core/worktree-sync/watcher.d.ts +29 -0
- package/dist/core/worktree-sync/watcher.d.ts.map +1 -0
- package/dist/core/worktree-sync/watcher.js +93 -0
- package/dist/core/worktree-sync/watcher.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +94 -0
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +9 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +38 -0
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts +16 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +50 -8
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.js +23 -1
- package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +4 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts +43 -0
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
- package/dist/modes/interactive/local-model-commands.js +290 -3
- package/dist/modes/interactive/local-model-commands.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +24 -4
- package/dist/modes/interactive/session-flow-commands.js.map +1 -1
- package/dist/utils/fs-watch.d.ts +11 -0
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js +20 -2
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/highlight-js-languages.d.ts +4 -0
- package/dist/utils/highlight-js-languages.d.ts.map +1 -0
- package/dist/utils/highlight-js-languages.js +573 -0
- package/dist/utils/highlight-js-languages.js.map +1 -0
- package/dist/utils/shell.d.ts +7 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +39 -9
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +53 -5
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +112 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/development.md +2 -0
- package/docs/packages.md +1 -1
- package/docs/process-matrix.md +120 -0
- package/docs/settings.md +5 -2
- package/docs/tmux-agent-manager.md +85 -2
- package/docs/windows.md +52 -3
- package/docs/work-directory.md +29 -0
- package/docs/worktree-sync.md +250 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +10 -4
- package/docs/integration-sweep-builder-blueprint-2026-07-09.md +0 -365
- package/docs/integration-sweep-resume-2026-07-09.md +0 -407
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"""Word expansion for the pi shell engine.
|
|
2
|
+
|
|
3
|
+
Implements `expand_word(word, ctx) -> list[str]`: quoting, tilde, `$VAR`/`${...}`,
|
|
4
|
+
`$(...)`/backtick command substitution, globbing, and word-splitting, per
|
|
5
|
+
windows-shell-workpackages-2026-07-19.md §1.5/§2.1/WP-B.
|
|
6
|
+
|
|
7
|
+
Never imports exec. Command substitution goes through the injected
|
|
8
|
+
`ctx.run_command_substitution` callable.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import fnmatch
|
|
14
|
+
from typing import TYPE_CHECKING
|
|
15
|
+
|
|
16
|
+
from errors import UnsupportedConstruct
|
|
17
|
+
from nodes import CmdSub, DQ, Lit, Param, Raw, Tilde, Word
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from context import ExecContext
|
|
21
|
+
|
|
22
|
+
_IFS_WHITESPACE = " \t\n"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _split_ifs(text: str) -> list[str]:
|
|
26
|
+
return text.split()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _glob_sort_key(path: str) -> tuple[str, ...]:
|
|
30
|
+
# Ordinal (LC_ALL=C) sort, per code point.
|
|
31
|
+
return tuple(path)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _escape_glob_literals(text: str) -> str:
|
|
35
|
+
"""Quote glob metacharacters contributed by a quoted/literal word segment."""
|
|
36
|
+
return text.replace("[", "[[]").replace("*", "[*]").replace("?", "[?]")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _expand_glob(pattern: str, cwd: str, literal_fallback: str) -> list[str]:
|
|
40
|
+
import os
|
|
41
|
+
|
|
42
|
+
if not any(ch in pattern for ch in "*?["):
|
|
43
|
+
return [literal_fallback]
|
|
44
|
+
|
|
45
|
+
# Support a single path separator component: match directory portion literally,
|
|
46
|
+
# glob only the final segment (sufficient for the frozen matrix: *, ?, [...]).
|
|
47
|
+
normalized = pattern.replace("\\", "/")
|
|
48
|
+
display = literal_fallback.replace("\\", "/")
|
|
49
|
+
if "/" in normalized:
|
|
50
|
+
dir_part, _, name_part = normalized.rpartition("/")
|
|
51
|
+
display_dir_part, _, _ = display.rpartition("/")
|
|
52
|
+
search_dir = dir_part if dir_part else "/"
|
|
53
|
+
base_dir = search_dir if os.path.isabs(search_dir) else os.path.join(cwd, search_dir)
|
|
54
|
+
prefix = display_dir_part + "/"
|
|
55
|
+
else:
|
|
56
|
+
name_part = normalized
|
|
57
|
+
base_dir = cwd
|
|
58
|
+
prefix = ""
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
entries = os.listdir(base_dir)
|
|
62
|
+
except OSError:
|
|
63
|
+
return [literal_fallback]
|
|
64
|
+
|
|
65
|
+
# Bash does not let * / ? match a leading dot unless the pattern component
|
|
66
|
+
# itself starts with a dot.
|
|
67
|
+
matches = [
|
|
68
|
+
name
|
|
69
|
+
for name in entries
|
|
70
|
+
if not (name.startswith(".") and not name_part.startswith("."))
|
|
71
|
+
and fnmatch.fnmatchcase(name, name_part)
|
|
72
|
+
]
|
|
73
|
+
if not matches:
|
|
74
|
+
return [literal_fallback]
|
|
75
|
+
|
|
76
|
+
matches.sort(key=_glob_sort_key)
|
|
77
|
+
return [(prefix + name).replace("\\", "/") for name in matches]
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class ParamExpansionError(Exception):
|
|
81
|
+
"""Raised for `${V:?word}` against an unset-or-empty parameter.
|
|
82
|
+
|
|
83
|
+
Bash-level runtime error (not a grammar refusal): prints `word` and aborts the
|
|
84
|
+
command. Not an `UnsupportedConstruct` — the construct itself is fully supported.
|
|
85
|
+
exec.py (WP-C) is free to catch this and surface it as a non-zero exit + message.
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
def __init__(self, name: str, message: str) -> None:
|
|
89
|
+
super().__init__(message)
|
|
90
|
+
self.name = name
|
|
91
|
+
self.message = message
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _resolve_param(name: str, op: str | None, arg: Word | None, ctx: "ExecContext") -> tuple[str, bool]:
|
|
95
|
+
"""Resolve a Param segment. Returns (text, split_and_glob_eligible).
|
|
96
|
+
|
|
97
|
+
split_and_glob_eligible is False here always; callers decide splitting based on
|
|
98
|
+
quoting context (Raw vs DQ), not on the parameter's own nature.
|
|
99
|
+
"""
|
|
100
|
+
env = ctx.state.env
|
|
101
|
+
if op == "#len":
|
|
102
|
+
value = env.get(name, "")
|
|
103
|
+
return str(len(value)), False
|
|
104
|
+
|
|
105
|
+
is_unset = name not in env
|
|
106
|
+
is_empty = is_unset or env.get(name, "") == ""
|
|
107
|
+
|
|
108
|
+
if op is None:
|
|
109
|
+
return env.get(name, ""), False
|
|
110
|
+
|
|
111
|
+
if op == ":-":
|
|
112
|
+
if is_empty:
|
|
113
|
+
return _expand_arg_word(arg, ctx) if arg is not None else "", False
|
|
114
|
+
return env[name], False
|
|
115
|
+
|
|
116
|
+
if op == ":=":
|
|
117
|
+
if is_empty:
|
|
118
|
+
value = _expand_arg_word(arg, ctx) if arg is not None else ""
|
|
119
|
+
ctx.state.env[name] = value
|
|
120
|
+
return value, False
|
|
121
|
+
return env[name], False
|
|
122
|
+
|
|
123
|
+
if op == ":+":
|
|
124
|
+
if is_empty:
|
|
125
|
+
return "", False
|
|
126
|
+
return _expand_arg_word(arg, ctx) if arg is not None else "", False
|
|
127
|
+
|
|
128
|
+
if op == ":?":
|
|
129
|
+
if is_empty:
|
|
130
|
+
message = _expand_arg_word(arg, ctx) if arg is not None else f"{name}: parameter null or not set"
|
|
131
|
+
raise ParamExpansionError(name, message)
|
|
132
|
+
return env[name], False
|
|
133
|
+
|
|
134
|
+
raise UnsupportedConstruct("parameter-expansion", f"unsupported parameter expansion operator: {op}")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _expand_arg_word(word: Word, ctx: "ExecContext") -> str:
|
|
138
|
+
fields = expand_word(word, ctx)
|
|
139
|
+
return " ".join(fields)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def _expand_segment_as_field(segment, ctx: "ExecContext") -> str:
|
|
143
|
+
"""Expand one segment into exactly one contributing string (no split/glob)."""
|
|
144
|
+
if isinstance(segment, Lit):
|
|
145
|
+
return segment.text
|
|
146
|
+
if isinstance(segment, Raw):
|
|
147
|
+
return segment.text
|
|
148
|
+
if isinstance(segment, DQ):
|
|
149
|
+
return "".join(_expand_segment_as_field(inner, ctx) for inner in segment.segments)
|
|
150
|
+
if isinstance(segment, Param):
|
|
151
|
+
text, _ = _resolve_param(segment.name, segment.op, segment.arg, ctx)
|
|
152
|
+
return text
|
|
153
|
+
if isinstance(segment, CmdSub):
|
|
154
|
+
text, _exit_code = ctx.run_command_substitution(segment.src, ctx)
|
|
155
|
+
return text.rstrip("\n")
|
|
156
|
+
if isinstance(segment, Tilde):
|
|
157
|
+
if segment.user:
|
|
158
|
+
raise UnsupportedConstruct("tilde-user", f"unsupported tilde expansion: ~{segment.user}")
|
|
159
|
+
return ctx.state.env.get("HOME", "")
|
|
160
|
+
raise UnsupportedConstruct("malformed-syntax", f"unrecognized word segment: {type(segment).__name__}")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def expand_word(word: Word, ctx: "ExecContext") -> list[str]:
|
|
164
|
+
"""Expand one Word into 0..N argv strings, honoring quoting/splitting/globbing.
|
|
165
|
+
|
|
166
|
+
Glob eligibility is tracked per segment. Quoted wildcards stay literal even when
|
|
167
|
+
an adjacent unquoted segment contributes a real wildcard.
|
|
168
|
+
"""
|
|
169
|
+
fields: list[tuple[str, str | None]] = []
|
|
170
|
+
current_parts: list[tuple[str, bool]] = []
|
|
171
|
+
current_active = False
|
|
172
|
+
|
|
173
|
+
def flush() -> None:
|
|
174
|
+
nonlocal current_parts, current_active
|
|
175
|
+
if current_active:
|
|
176
|
+
text = "".join(part for part, _raw in current_parts)
|
|
177
|
+
has_glob = any(raw and any(ch in part for ch in "*?[") for part, raw in current_parts)
|
|
178
|
+
pattern = "".join(part if raw else _escape_glob_literals(part) for part, raw in current_parts)
|
|
179
|
+
fields.append((text, pattern if has_glob else None))
|
|
180
|
+
current_parts, current_active = [], False
|
|
181
|
+
|
|
182
|
+
def append_literal(text: str) -> None:
|
|
183
|
+
nonlocal current_active
|
|
184
|
+
current_parts.append((text, False))
|
|
185
|
+
current_active = True
|
|
186
|
+
|
|
187
|
+
def append_splittable(text: str, raw: bool) -> None:
|
|
188
|
+
nonlocal current_active
|
|
189
|
+
if text == "":
|
|
190
|
+
return
|
|
191
|
+
leading_ws = text[0] in _IFS_WHITESPACE
|
|
192
|
+
trailing_ws = text[-1] in _IFS_WHITESPACE
|
|
193
|
+
parts = text.split()
|
|
194
|
+
if not parts:
|
|
195
|
+
# Purely whitespace: acts as a field separator only.
|
|
196
|
+
flush()
|
|
197
|
+
return
|
|
198
|
+
if leading_ws and current_active:
|
|
199
|
+
flush()
|
|
200
|
+
for i, part in enumerate(parts):
|
|
201
|
+
if i > 0:
|
|
202
|
+
flush()
|
|
203
|
+
current_parts.append((part, raw))
|
|
204
|
+
current_active = True
|
|
205
|
+
if trailing_ws:
|
|
206
|
+
flush()
|
|
207
|
+
|
|
208
|
+
for segment in word.segments:
|
|
209
|
+
if isinstance(segment, Lit):
|
|
210
|
+
append_literal(segment.text)
|
|
211
|
+
elif isinstance(segment, Raw):
|
|
212
|
+
append_splittable(segment.text, raw=True)
|
|
213
|
+
elif isinstance(segment, DQ):
|
|
214
|
+
text = "".join(_expand_segment_as_field(inner, ctx) for inner in segment.segments)
|
|
215
|
+
append_literal(text)
|
|
216
|
+
elif isinstance(segment, Param):
|
|
217
|
+
text, _ = _resolve_param(segment.name, segment.op, segment.arg, ctx)
|
|
218
|
+
append_splittable(text, raw=True)
|
|
219
|
+
elif isinstance(segment, CmdSub):
|
|
220
|
+
text, _exit_code = ctx.run_command_substitution(segment.src, ctx)
|
|
221
|
+
text = text.rstrip("\n")
|
|
222
|
+
append_splittable(text, raw=True)
|
|
223
|
+
elif isinstance(segment, Tilde):
|
|
224
|
+
if segment.user:
|
|
225
|
+
raise UnsupportedConstruct("tilde-user", f"unsupported tilde expansion: ~{segment.user}")
|
|
226
|
+
append_literal(ctx.state.env.get("HOME", ""))
|
|
227
|
+
else:
|
|
228
|
+
raise UnsupportedConstruct("malformed-syntax", f"unrecognized word segment: {type(segment).__name__}")
|
|
229
|
+
|
|
230
|
+
flush()
|
|
231
|
+
|
|
232
|
+
result: list[str] = []
|
|
233
|
+
for text, pattern in fields:
|
|
234
|
+
if pattern is not None:
|
|
235
|
+
result.extend(_expand_glob(pattern, ctx.state.cwd, text))
|
|
236
|
+
else:
|
|
237
|
+
result.append(text)
|
|
238
|
+
return result
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""Entrypoint: read the JSON request, run the AST, emit merged output + control frame.
|
|
2
|
+
|
|
3
|
+
The sole composition root — wires the real expander (`expand.expand_word`), the real
|
|
4
|
+
command-substitution runner (`exec.run_command_substitution`), and the real builtin
|
|
5
|
+
registry (`commands.REGISTRY`) into an `ExecContext`. See
|
|
6
|
+
windows-shell-workpackages-2026-07-19.md §1.2/§1.3/§3.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
import time
|
|
15
|
+
|
|
16
|
+
import exec as exec_module
|
|
17
|
+
import parser as parser_module
|
|
18
|
+
import tokens as tokens_module
|
|
19
|
+
from context import ExecContext
|
|
20
|
+
from errors import UnsupportedConstruct
|
|
21
|
+
from expand import ParamExpansionError
|
|
22
|
+
from state import ShellState
|
|
23
|
+
|
|
24
|
+
RECORD_SEPARATOR = b"\x1e"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _read_request() -> dict:
|
|
28
|
+
raw = sys.stdin.buffer.read()
|
|
29
|
+
return json.loads(raw.decode("utf-8"))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class _OutputSink:
|
|
33
|
+
"""Binary sink that streams command output without retaining the whole result."""
|
|
34
|
+
|
|
35
|
+
def write(self, data: bytes) -> int:
|
|
36
|
+
written = sys.stdout.buffer.write(data)
|
|
37
|
+
sys.stdout.buffer.flush()
|
|
38
|
+
return written
|
|
39
|
+
|
|
40
|
+
def flush(self) -> None:
|
|
41
|
+
sys.stdout.buffer.flush()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _write_frame(exit_code: int, cwd: str, env_delta: dict, unsupported: dict | None) -> None:
|
|
45
|
+
frame = {
|
|
46
|
+
"exitCode": exit_code,
|
|
47
|
+
"cwd": cwd,
|
|
48
|
+
"envDelta": env_delta,
|
|
49
|
+
"unsupported": unsupported,
|
|
50
|
+
}
|
|
51
|
+
# stderr is the control channel. Command stderr is explicitly merged into
|
|
52
|
+
# the command-output sink by ExecContext, so this frame cannot collide with
|
|
53
|
+
# arbitrary command bytes (including RECORD_SEPARATOR).
|
|
54
|
+
sys.stderr.buffer.write(RECORD_SEPARATOR)
|
|
55
|
+
sys.stderr.buffer.write(json.dumps(frame, separators=(",", ":")).encode("utf-8"))
|
|
56
|
+
sys.stderr.buffer.write(RECORD_SEPARATOR)
|
|
57
|
+
sys.stderr.buffer.flush()
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def main() -> int:
|
|
61
|
+
request = _read_request()
|
|
62
|
+
command: str = request["command"]
|
|
63
|
+
cwd: str = request["cwd"]
|
|
64
|
+
env: dict[str, str] = dict(request.get("env") or {})
|
|
65
|
+
timeout_ms = request.get("timeoutMs")
|
|
66
|
+
|
|
67
|
+
original_env = dict(env)
|
|
68
|
+
|
|
69
|
+
if not os.path.isdir(cwd):
|
|
70
|
+
message = f"cwd does not exist: {cwd}"
|
|
71
|
+
sys.stdout.buffer.write(message.encode("utf-8"))
|
|
72
|
+
_write_frame(2, cwd, {}, {"code": "unsupported", "construct": "cwd-missing", "message": message})
|
|
73
|
+
return 0
|
|
74
|
+
|
|
75
|
+
state = ShellState(cwd=cwd, env=env)
|
|
76
|
+
output = _OutputSink()
|
|
77
|
+
|
|
78
|
+
deadline = None
|
|
79
|
+
if isinstance(timeout_ms, (int, float)) and timeout_ms > 0:
|
|
80
|
+
deadline = time.monotonic() + (timeout_ms / 1000.0)
|
|
81
|
+
|
|
82
|
+
from commands import REGISTRY # noqa: PLC0415 - deferred so WP-C is testable without commands/
|
|
83
|
+
from expand import expand_word # noqa: PLC0415 - deferred so WP-C is testable without expand.py
|
|
84
|
+
|
|
85
|
+
ctx = ExecContext(
|
|
86
|
+
state=state,
|
|
87
|
+
stdin=sys.stdin.buffer,
|
|
88
|
+
stdout=output,
|
|
89
|
+
expand_word=expand_word,
|
|
90
|
+
run_command_substitution=exec_module.run_command_substitution,
|
|
91
|
+
builtins=REGISTRY,
|
|
92
|
+
deadline=deadline,
|
|
93
|
+
stderr=output,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
tokens = tokens_module.tokenize(command)
|
|
98
|
+
ast = parser_module.parse(tokens)
|
|
99
|
+
exit_code = exec_module.execute(ast, ctx)
|
|
100
|
+
except UnsupportedConstruct as exc:
|
|
101
|
+
output.write(exc.message.encode("utf-8", errors="replace"))
|
|
102
|
+
_write_frame(
|
|
103
|
+
2,
|
|
104
|
+
state.cwd,
|
|
105
|
+
state.delta(original_env),
|
|
106
|
+
{"code": exc.code, "construct": exc.construct, "message": exc.message},
|
|
107
|
+
)
|
|
108
|
+
return 0
|
|
109
|
+
except ParamExpansionError as exc:
|
|
110
|
+
output.write(f"bash: {exc.name}: {exc.message}\n".encode("utf-8", errors="replace"))
|
|
111
|
+
_write_frame(1, state.cwd, state.delta(original_env), None)
|
|
112
|
+
return 0
|
|
113
|
+
except (OSError, ValueError, UnicodeError) as exc:
|
|
114
|
+
# Expected command/builtin failures must remain framed and must never
|
|
115
|
+
# leak a Python traceback into the host shell protocol.
|
|
116
|
+
output.write(f"shell: {exc}\n".encode("utf-8", errors="replace"))
|
|
117
|
+
_write_frame(1, state.cwd, state.delta(original_env), None)
|
|
118
|
+
return 0
|
|
119
|
+
except Exception as exc:
|
|
120
|
+
# Last-resort protocol boundary: preserve a bounded, actionable error
|
|
121
|
+
# while keeping the control frame parseable.
|
|
122
|
+
output.write(f"shell engine internal error: {type(exc).__name__}: {exc}\n".encode("utf-8", errors="replace"))
|
|
123
|
+
_write_frame(1, state.cwd, state.delta(original_env), None)
|
|
124
|
+
return 0
|
|
125
|
+
|
|
126
|
+
output.flush()
|
|
127
|
+
_write_frame(exit_code, state.cwd, state.delta(original_env), None)
|
|
128
|
+
return 0
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
if __name__ == "__main__":
|
|
132
|
+
sys.exit(main())
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""Frozen AST dataclasses for the pi shell engine: word segments + command structure.
|
|
2
|
+
|
|
3
|
+
Transcribed verbatim from windows-shell-workpackages-2026-07-19.md §1.4. Type tags for
|
|
4
|
+
tests come from `type(node).__name__`; do NOT add a `kind` field to any node.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
|
|
11
|
+
# --- Word tier: segments (the expander's input) -----------------------------------
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class Lit:
|
|
16
|
+
"""Single-quoted / backslash-escaped text: no expansion, no glob, no split."""
|
|
17
|
+
|
|
18
|
+
text: str
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class Raw:
|
|
23
|
+
"""Unquoted literal run: subject to glob + (post-expansion) word-splitting."""
|
|
24
|
+
|
|
25
|
+
text: str
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass
|
|
29
|
+
class DQ:
|
|
30
|
+
"""Double-quoted region: $-expansion yes; glob/split NO."""
|
|
31
|
+
|
|
32
|
+
segments: list["Segment"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass
|
|
36
|
+
class Param:
|
|
37
|
+
"""$VAR / ${VAR} / ${VAR:-word} ... op in {None, ':-', ':=', ':+', ':?', '#len'}."""
|
|
38
|
+
|
|
39
|
+
name: str
|
|
40
|
+
op: str | None
|
|
41
|
+
arg: "Word | None"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class CmdSub:
|
|
46
|
+
"""$(...) or `...` - raw inner source, re-parsed+run by exec."""
|
|
47
|
+
|
|
48
|
+
src: str
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass
|
|
52
|
+
class Tilde:
|
|
53
|
+
"""Leading ~ (word-start, unquoted only); "" = current user -> $HOME."""
|
|
54
|
+
|
|
55
|
+
user: str
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Segment = Lit | Raw | DQ | Param | CmdSub | Tilde
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass
|
|
62
|
+
class Word:
|
|
63
|
+
segments: list[Segment]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# --- Command tier: the parser's output ---------------------------------------------
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class Redirect:
|
|
71
|
+
"""fd source, operator, and target (or dup fd)."""
|
|
72
|
+
|
|
73
|
+
op: str
|
|
74
|
+
fd: int | None
|
|
75
|
+
target: "Word | None"
|
|
76
|
+
dup_fd: int | None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass
|
|
80
|
+
class SimpleCommand:
|
|
81
|
+
assignments: list[tuple[str, "Word"]]
|
|
82
|
+
words: list["Word"]
|
|
83
|
+
redirects: list["Redirect"]
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@dataclass
|
|
87
|
+
class Subshell:
|
|
88
|
+
body: "CommandList"
|
|
89
|
+
redirects: list["Redirect"]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@dataclass
|
|
93
|
+
class BraceGroup:
|
|
94
|
+
body: "CommandList"
|
|
95
|
+
redirects: list["Redirect"]
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
PipelineElement = SimpleCommand | Subshell | BraceGroup
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@dataclass
|
|
102
|
+
class Pipeline:
|
|
103
|
+
elements: list[PipelineElement]
|
|
104
|
+
negated: bool
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@dataclass
|
|
108
|
+
class AndOr:
|
|
109
|
+
pipelines: list["Pipeline"]
|
|
110
|
+
operators: list[str]
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@dataclass
|
|
114
|
+
class CommandList:
|
|
115
|
+
entries: list["AndOr"]
|
|
116
|
+
separators: list[str]
|