@sema-agent/core 7.47.0 → 7.49.0
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 +472 -0
- package/README.md +2 -2
- package/dist/agents/cascade.d.ts +2 -5
- package/dist/agents/child-failure.d.ts +20 -0
- package/dist/agents/child-failure.js +28 -0
- package/dist/agents/cross-session-ref.d.ts +11 -3
- package/dist/agents/cross-session-ref.js +6 -0
- package/dist/agents/cumulative-stats.d.ts +12 -15
- package/dist/agents/cumulative-stats.js +1 -1
- package/dist/agents/extra-tool-names.js +1 -1
- package/dist/agents/inherited-tool-pool.d.ts +17 -13
- package/dist/agents/inherited-tool-pool.js +4 -3
- package/dist/agents/peer-session-drain.d.ts +3 -2
- package/dist/agents/peer-session-drain.js +5 -4
- package/dist/agents/send-message-tool.js +2 -9
- package/dist/agents/subagent.d.ts +10 -29
- package/dist/agents/subagent.js +65 -53
- package/dist/agents/suspend-guard.d.ts +1 -1
- package/dist/agents/tool-filter.d.ts +76 -65
- package/dist/agents/tool-filter.js +122 -92
- package/dist/agents/verify.d.ts +4 -7
- package/dist/agents/verify.js +6 -7
- package/dist/bench/metrics.d.ts +1 -2
- package/dist/brain/anthropic.js +133 -79
- package/dist/brain/errors.d.ts +53 -6
- package/dist/brain/errors.js +22 -2
- package/dist/brain/input-too-long.d.ts +40 -19
- package/dist/brain/input-too-long.js +3 -16
- package/dist/brain/open-responses.js +19 -10
- package/dist/brain/openai.js +123 -32
- package/dist/brain/provider-dialect.d.ts +214 -0
- package/dist/brain/provider-dialect.js +186 -0
- package/dist/brain/request-params.d.ts +27 -8
- package/dist/brain/request-params.js +7 -12
- package/dist/brain/request-route.d.ts +84 -0
- package/dist/brain/request-route.js +41 -0
- package/dist/brain/retry.d.ts +8 -0
- package/dist/brain/retry.js +10 -4
- package/dist/brain/route-adjudicator.d.ts +7 -0
- package/dist/brain/route-adjudicator.js +5 -1
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +11 -0
- package/dist/brain/stream-engine.d.ts +52 -1
- package/dist/brain/stream-engine.js +81 -24
- package/dist/brain/stream-shared.d.ts +57 -11
- package/dist/brain/stream-shared.js +28 -2
- package/dist/core/a2a.d.ts +1 -0
- package/dist/core/agent-config-dir.js +3 -2
- package/dist/core/allow-entry.d.ts +21 -12
- package/dist/core/allow-entry.js +39 -32
- package/dist/core/arg-summary.d.ts +17 -24
- package/dist/core/arg-summary.js +169 -68
- package/dist/core/ask-origin.d.ts +42 -24
- package/dist/core/ask-origin.js +18 -13
- package/dist/core/auto-mode-prompt-assets.d.ts +2 -2
- package/dist/core/auto-mode-prompt-assets.js +1 -1
- package/dist/core/auto-mode-prompt.d.ts +11 -1
- package/dist/core/auto-mode-prompt.js +13 -10
- package/dist/core/auto-mode-rebuild.d.ts +7 -0
- package/dist/core/auto-mode-rebuild.js +4 -1
- package/dist/core/canonical-json.d.ts +3 -0
- package/dist/core/canonical-json.js +2 -1
- package/dist/core/checkpoint-requirements.d.ts +892 -0
- package/dist/core/checkpoint-requirements.js +333 -0
- package/dist/core/checkpoint-store.d.ts +95 -66
- package/dist/core/checkpoint-store.js +14 -26
- package/dist/core/child-clamp-seats.d.ts +228 -69
- package/dist/core/child-clamp-seats.js +211 -17
- package/dist/core/classifier-unavailable-arm.d.ts +5 -1
- package/dist/core/classifier-unavailable-arm.js +3 -3
- package/dist/core/compliance.d.ts +3 -0
- package/dist/core/compliance.js +9 -4
- package/dist/core/credential-vocabulary.d.ts +140 -0
- package/dist/core/credential-vocabulary.js +131 -0
- package/dist/core/decision-receipt.js +1 -1
- package/dist/core/effective-path-target.d.ts +73 -16
- package/dist/core/effective-path-target.js +63 -33
- package/dist/core/engine-notice.d.ts +32 -7
- package/dist/core/file-history-store.js +2 -2
- package/dist/core/fs-write-gate-policy.d.ts +4 -0
- package/dist/core/fs-write-gate-policy.js +22 -5
- package/dist/core/gate-bounded-await.d.ts +28 -13
- package/dist/core/gate-bounded-await.js +41 -4
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -25
- package/dist/core/gate-lanes.js +16 -15
- package/dist/core/gate-outcome.d.ts +20 -5
- package/dist/core/gate-outcome.js +5 -0
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +14 -3
- package/dist/core/hooks.d.ts +4 -0
- package/dist/core/locked-config.d.ts +8 -0
- package/dist/core/locked-config.js +14 -2
- package/dist/core/lsp.js +3 -5
- package/dist/core/mailbox-store.d.ts +3 -4
- package/dist/core/mcp-connection-pool.d.ts +75 -0
- package/dist/core/mcp-connection-pool.js +128 -0
- package/dist/core/mcp-failure.d.ts +2 -1
- package/dist/core/mcp-failure.js +13 -2
- package/dist/core/mcp-server-spec.d.ts +1 -1
- package/dist/core/mcp.d.ts +4 -0
- package/dist/core/mcp.js +70 -43
- package/dist/core/memory-engine/content-origin.js +2 -14
- package/dist/core/memory-engine/engine.d.ts +32 -22
- package/dist/core/memory-engine/engine.js +103 -55
- package/dist/core/memory-engine/file-backend.d.ts +13 -30
- package/dist/core/memory-engine/file-backend.js +37 -252
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layout.d.ts +139 -9
- package/dist/core/memory-engine/layout.js +350 -7
- package/dist/core/memory-engine/scope-contract.d.ts +10 -0
- package/dist/core/memory-engine/scope-contract.js +8 -0
- package/dist/core/memory-engine/session-incarnation.d.ts +14 -4
- package/dist/core/memory-engine/session-incarnation.js +5 -2
- package/dist/core/memory-engine/types.d.ts +10 -1
- package/dist/core/memory.js +5 -17
- package/dist/core/model-seat.d.ts +4 -4
- package/dist/core/model-seat.js +1 -1
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +19 -0
- package/dist/core/namespaced-rule-name.d.ts +29 -0
- package/dist/core/namespaced-rule-name.js +52 -0
- package/dist/core/park-selfcheck.d.ts +1 -1
- package/dist/core/park-selfcheck.js +16 -6
- package/dist/core/path-guard-rows.d.ts +99 -0
- package/dist/core/path-guard-rows.js +45 -0
- package/dist/core/path-identity.d.ts +22 -16
- package/dist/core/path-identity.js +10 -10
- package/dist/core/path-rule-binding.d.ts +2 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/pause-registry.d.ts +16 -2
- package/dist/core/pause-registry.js +6 -0
- package/dist/core/permission-rule-consent.js +0 -7
- package/dist/core/permission-rule-model.d.ts +68 -24
- package/dist/core/permission-rule-model.js +105 -24
- package/dist/core/permission-rule-store.js +2 -2
- package/dist/core/permission-rules.d.ts +3 -30
- package/dist/core/permission-rules.js +4 -54
- package/dist/core/read-root-candidate.d.ts +1 -3
- package/dist/core/read-root-candidate.js +4 -15
- package/dist/core/real-approval.d.ts +4 -3
- package/dist/core/retired-keys.d.ts +13 -0
- package/dist/core/retired-keys.js +14 -0
- package/dist/core/roles.d.ts +2 -3
- package/dist/core/roles.js +15 -6
- package/dist/core/runner/assemble-result.d.ts +0 -7
- package/dist/core/runner/assemble-result.js +19 -31
- package/dist/core/runner/caller-roster.d.ts +78 -0
- package/dist/core/runner/caller-roster.js +219 -0
- package/dist/core/runner/checkpoint-scope.d.ts +16 -16
- package/dist/core/runner/checkpoint-scope.js +2 -2
- package/dist/core/runner/child-tree.js +2 -2
- package/dist/core/runner/contracts.d.ts +68 -35
- package/dist/core/runner/decide-continuation.d.ts +51 -3
- package/dist/core/runner/decide-continuation.js +76 -21
- package/dist/core/runner/denial-limit-arms.d.ts +17 -5
- package/dist/core/runner/denial-limit-arms.js +11 -9
- package/dist/core/runner/extra-body-dropped-seat.d.ts +8 -0
- package/dist/core/runner/extra-body-dropped-seat.js +22 -0
- package/dist/core/runner/finish-reason-seat.d.ts +9 -0
- package/dist/core/runner/finish-reason-seat.js +40 -0
- package/dist/core/runner/gate-exit.d.ts +44 -32
- package/dist/core/runner/gate-exit.js +112 -25
- package/dist/core/runner/inherited-ask-grants.js +6 -4
- package/dist/core/runner/mcp-redial.d.ts +3 -3
- package/dist/core/runner/mcp-redial.js +3 -4
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +1 -2
- package/dist/core/runner/permission-rule-lanes.js +5 -4
- package/dist/core/runner/prepare-artifact.d.ts +4 -0
- package/dist/core/runner/prepare-artifact.js +2 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -0
- package/dist/core/runner/prepare-ask-lane.js +12 -6
- package/dist/core/runner/prepare-boundary-parks.d.ts +5 -8
- package/dist/core/runner/prepare-boundary-parks.js +4 -7
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +11 -15
- package/dist/core/runner/prepare-caps-and-workflow.js +19 -27
- package/dist/core/runner/prepare-config-doors.d.ts +9 -9
- package/dist/core/runner/prepare-config-doors.js +10 -5
- package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
- package/dist/core/runner/prepare-defer-classify.js +5 -3
- package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
- package/dist/core/runner/prepare-delegation-surface.js +3 -3
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -4
- package/dist/core/runner/prepare-gate-stations.js +9 -7
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -7
- package/dist/core/runner/prepare-hands-readface.js +7 -7
- package/dist/core/runner/prepare-inherited-gate.d.ts +7 -6
- package/dist/core/runner/prepare-inherited-gate.js +14 -15
- package/dist/core/runner/prepare-listings.d.ts +7 -24
- package/dist/core/runner/prepare-listings.js +4 -5
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -0
- package/dist/core/runner/prepare-memory-engine-session.js +4 -3
- package/dist/core/runner/prepare-memory.d.ts +6 -0
- package/dist/core/runner/prepare-memory.js +13 -13
- package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -0
- package/dist/core/runner/prepare-offload-wrappers.js +3 -3
- package/dist/core/runner/prepare-park-ask.d.ts +7 -8
- package/dist/core/runner/prepare-park-ask.js +17 -10
- package/dist/core/runner/prepare-policy-chain.js +24 -44
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +3 -4
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -3
- package/dist/core/runner/prepare-protocol-tools.js +3 -4
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -1
- package/dist/core/runner/prepare-safety-scan.d.ts +4 -8
- package/dist/core/runner/prepare-safety-scan.js +1 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
- package/dist/core/runner/prepare-suspend-saga.js +28 -12
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +67 -56
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -10
- package/dist/core/runner/prepare-wiring-manifest.js +5 -8
- package/dist/core/runner/resume-apply.js +7 -14
- package/dist/core/runner/resume-checkpoint-screen.js +11 -4
- package/dist/core/runner/resume-internals-and-config.js +2 -2
- package/dist/core/runner/resume-policy-outcome.js +5 -32
- package/dist/core/runner/resume-review-outcome.js +4 -1
- package/dist/core/runner/retired-runner-deps.d.ts +6 -0
- package/dist/core/runner/retired-runner-deps.js +10 -1
- package/dist/core/runner/run-brain-sinks.d.ts +4 -0
- package/dist/core/runner/run-brain-sinks.js +5 -2
- package/dist/core/runner/run-harness-handlers.js +27 -34
- package/dist/core/runner/run-leg.d.ts +0 -2
- package/dist/core/runner/run-leg.js +32 -33
- package/dist/core/runner/run-terminal-adoption.js +4 -3
- package/dist/core/runner/runtask.js +8 -8
- package/dist/core/runner/session-rule-policy.js +5 -5
- package/dist/core/runner/stream-settle-backstop.js +7 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +51 -12
- package/dist/core/runner/sub-agent-deny-lists.js +111 -80
- package/dist/core/runner/terminal-account.d.ts +48 -0
- package/dist/core/runner/terminal-account.js +186 -0
- package/dist/core/runner/tool-end-body.d.ts +54 -17
- package/dist/core/runner/tool-end-body.js +27 -2
- package/dist/core/runner/tool-face-overlay.d.ts +3 -1
- package/dist/core/runner/tool-face-overlay.js +6 -4
- package/dist/core/runner/tool-occurrence.d.ts +106 -0
- package/dist/core/runner/tool-occurrence.js +123 -0
- package/dist/core/runner/tool-progress-lane.d.ts +16 -8
- package/dist/core/runner/tool-progress-lane.js +25 -34
- package/dist/core/runner/turn-attachments.d.ts +1 -1
- package/dist/core/runner/write-protection-station.d.ts +21 -9
- package/dist/core/runner/write-protection-station.js +20 -17
- package/dist/core/runner-deps.d.ts +12 -22
- package/dist/core/safety-axis-vocab.d.ts +1 -1
- package/dist/core/safety-merge-corpus.d.ts +1 -1
- package/dist/core/secret-env.d.ts +16 -5
- package/dist/core/secret-env.js +23 -63
- package/dist/core/sensitive-path-policy.d.ts +19 -18
- package/dist/core/sensitive-path-policy.js +73 -49
- package/dist/core/session-policy-store.d.ts +6 -3
- package/dist/core/session-policy-store.js +28 -10
- package/dist/core/session-reconcile.d.ts +3 -0
- package/dist/core/session-reconcile.js +5 -4
- package/dist/core/session-store.d.ts +5 -0
- package/dist/core/session-store.js +12 -0
- package/dist/core/session.d.ts +13 -0
- package/dist/core/shared-memory/normalize.d.ts +17 -4
- package/dist/core/shared-memory/normalize.js +7 -7
- package/dist/core/shell-lexer.js +5 -4
- package/dist/core/shell-wrapper-table.d.ts +2 -2
- package/dist/core/shell-wrapper-table.js +1 -1
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +13 -0
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +7 -14
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +27 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.js +92 -0
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.js +2 -2
- package/dist/core/task-event.d.ts +59 -5
- package/dist/core/task-result.d.ts +1 -1
- package/dist/core/task-spec.d.ts +42 -9
- package/dist/core/terminal-cause.d.ts +94 -11
- package/dist/core/tighten-task-spec.d.ts +5 -4
- package/dist/core/tighten-task-spec.js +20 -25
- package/dist/core/tool-catalog-entries.d.ts +5 -7
- package/dist/core/tool-catalog-entries.js +14 -15
- package/dist/core/tool-face.d.ts +47 -0
- package/dist/core/tool-face.js +5 -0
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +35 -10
- package/dist/core/tool-name-aliases.js +15 -0
- package/dist/core/tool-name-list.d.ts +30 -0
- package/dist/core/tool-name-list.js +55 -0
- package/dist/core/tool-name-readings.d.ts +1 -9
- package/dist/core/tool-name-readings.js +1 -3
- package/dist/core/tool-policy.d.ts +195 -85
- package/dist/core/tool-policy.js +165 -381
- package/dist/core/tool-registry.d.ts +44 -1
- package/dist/core/tool-registry.js +26 -0
- package/dist/core/tool-roster.d.ts +19 -1
- package/dist/core/tool-roster.js +21 -2
- package/dist/core/tool-spec-members.d.ts +45 -0
- package/dist/core/tool-spec-members.js +169 -0
- package/dist/core/tool-spec.d.ts +46 -8
- package/dist/core/tools.d.ts +6 -2
- package/dist/core/tools.js +8 -4
- package/dist/core/untrusted-egress.js +29 -26
- package/dist/core/untrusted-text.d.ts +13 -10
- package/dist/core/untrusted-text.js +6 -44
- package/dist/core/workflow-journal-store.d.ts +4 -1
- package/dist/core/write-protect.d.ts +65 -29
- package/dist/core/write-protect.js +235 -177
- package/dist/engine/compaction/compaction.d.ts +2 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +5 -23
- package/dist/engine/execution-env/node-execution-env.js +16 -38
- package/dist/engine/execution-env/symlink-chain.d.ts +23 -0
- package/dist/engine/execution-env/symlink-chain.js +32 -0
- package/dist/engine/harness/types.d.ts +7 -0
- package/dist/engine/llm/tool-turns.d.ts +3 -0
- package/dist/engine/llm/tool-turns.js +1 -0
- package/dist/engine/llm/types.d.ts +59 -23
- package/dist/engine/loop/agent-loop.js +16 -2
- package/dist/engine/session/memory-repo.js +11 -3
- package/dist/engine/session/repo-utils.d.ts +8 -0
- package/dist/engine/session/repo-utils.js +13 -0
- package/dist/index.d.ts +20 -23
- package/dist/index.js +17 -20
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/governance-baseline-validity.js +1 -1
- package/dist/orchestration/run-spec.js +3 -3
- package/dist/orchestration/run-workflow-tool.d.ts +16 -35
- package/dist/orchestration/run-workflow-tool.js +38 -78
- package/dist/orchestration/workflow-governance.d.ts +21 -25
- package/dist/orchestration/workflow-governance.js +38 -78
- package/dist/orchestration/workflow-primitives.d.ts +7 -22
- package/dist/orchestration/workflow-primitives.js +5 -12
- package/dist/orchestration/workflow-types.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +61 -11
- package/dist/orchestration/workflow.js +191 -119
- package/dist/prompt-assembly/types.d.ts +1 -1
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/shell/lex.d.ts +0 -21
- package/dist/shell/lex.js +278 -70
- package/dist/shell/shell-words.d.ts +35 -0
- package/dist/shell/shell-words.js +65 -0
- package/dist/stores/file/checkpoint-store.d.ts +5 -5
- package/dist/stores/file/checkpoint-store.js +5 -2
- package/dist/stores/file/index.d.ts +0 -8
- package/dist/stores/file/index.js +0 -12
- package/dist/stores/file/session-store.d.ts +3 -0
- package/dist/stores/file/session-store.js +44 -19
- package/dist/tools/artifact/artifact-tool.js +2 -0
- package/dist/tools/fs/bash-program-position.d.ts +17 -3
- package/dist/tools/fs/bash-program-position.js +25 -10
- package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
- package/dist/tools/fs/bash-readonly-classifier.js +8 -7
- package/dist/tools/fs/containment-face.d.ts +4 -0
- package/dist/tools/fs/containment-face.js +3 -0
- package/dist/tools/fs/fs-shared.d.ts +10 -0
- package/dist/tools/fs/fs-shared.js +18 -0
- package/dist/tools/fs/fs-write.js +4 -2
- package/dist/tools/fs/index.d.ts +3 -2
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/program-read-model.d.ts +99 -23
- package/dist/tools/fs/program-read-model.js +129 -55
- package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
- package/dist/tools/fs/program-read-model.rows.js +18 -10
- package/dist/tools/fs/read-deny-home.d.ts +35 -30
- package/dist/tools/fs/read-deny-home.js +45 -38
- package/dist/tools/fs/read-deny.d.ts +35 -27
- package/dist/tools/fs/read-deny.js +126 -92
- package/dist/tools/fs/removal-targets.d.ts +56 -23
- package/dist/tools/fs/removal-targets.js +74 -87
- package/dist/tools/fs/safety.d.ts +29 -22
- package/dist/tools/fs/safety.js +17 -11
- package/dist/tools/fs/search.js +10 -8
- package/dist/tools/fs/shell-read-argv.d.ts +4 -7
- package/dist/tools/fs/shell-read-argv.js +6 -8
- package/dist/tools/fs/shell-read-bindings.d.ts +203 -46
- package/dist/tools/fs/shell-read-bindings.js +488 -144
- package/dist/tools/fs/shell-read-builtins.d.ts +35 -0
- package/dist/tools/fs/shell-read-builtins.js +43 -0
- package/dist/tools/fs/shell-read-check.d.ts +15 -1
- package/dist/tools/fs/shell-read-check.js +51 -42
- package/dist/tools/fs/shell-read-establish.js +9 -10
- package/dist/tools/fs/shell-read-functions.d.ts +22 -0
- package/dist/tools/fs/shell-read-functions.js +29 -0
- package/dist/tools/fs/shell-read-judge.d.ts +48 -18
- package/dist/tools/fs/shell-read-judge.js +33 -4
- package/dist/tools/fs/shell-read-plan.d.ts +13 -20
- package/dist/tools/fs/shell-read-plan.js +200 -194
- package/dist/tools/fs/shell-read-start.d.ts +80 -0
- package/dist/tools/fs/shell-read-start.js +99 -0
- package/dist/tools/fs/shell-read-word.d.ts +35 -6
- package/dist/tools/fs/shell-read-word.js +89 -9
- package/dist/tools/fs/shell-read-workdir.d.ts +156 -0
- package/dist/tools/fs/shell-read-workdir.js +281 -0
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -2
- package/dist/tools/fs/shell-read-write-targets.js +14 -5
- package/dist/tools/fs/shell-reentry-text.d.ts +26 -26
- package/dist/tools/fs/shell-reentry-text.js +31 -34
- package/dist/tools/task-list.d.ts +1 -2
- package/dist/tools/web.js +1 -1
- package/package.json +4 -1
- package/test/export-surface.snapshot.json +107 -143
- package/wire-changes/core@7.48.0.json +252 -0
- package/wire-changes/core@7.49.0.json +4765 -0
- package/dist/agents/teacher.d.ts +0 -159
- package/dist/agents/teacher.js +0 -577
- package/dist/agents/team.d.ts +0 -226
- package/dist/agents/team.js +0 -257
- package/dist/core/strategy-store.d.ts +0 -238
- package/dist/core/strategy-store.js +0 -253
- package/dist/orchestration/builtin-workflows.d.ts +0 -133
- package/dist/orchestration/builtin-workflows.js +0 -159
- package/dist/scenarios/env.d.ts +0 -40
- package/dist/scenarios/env.js +0 -39
- package/dist/scenarios/scenario-registry.d.ts +0 -110
- package/dist/scenarios/scenario-registry.js +0 -140
- package/dist/scenarios/teacher-quickstart.d.ts +0 -40
- package/dist/scenarios/teacher-quickstart.js +0 -12
- package/dist/stores/cc/lockfile.d.ts +0 -10
- package/dist/stores/cc/lockfile.js +0 -98
- package/dist/stores/cc/mailbox-store.d.ts +0 -20
- package/dist/stores/cc/mailbox-store.js +0 -255
- package/dist/stores/cc/roster-adapter.d.ts +0 -12
- package/dist/stores/cc/roster-adapter.js +0 -117
- package/dist/stores/cc/sidecar-transcript.d.ts +0 -97
- package/dist/stores/cc/sidecar-transcript.js +0 -264
- package/dist/stores/cc/task-list-store.d.ts +0 -2
- package/dist/stores/cc/task-list-store.js +0 -125
- package/dist/stores/file/strategy-store.d.ts +0 -97
- package/dist/stores/file/strategy-store.js +0 -341
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
* here-document `${`), and resets every name to the state it starts the text in (a function body: it runs at its
|
|
13
13
|
* call, against that table);
|
|
14
14
|
* · {@link BindingThread} — the effects threaded through the segments the way the plan threads the working directory
|
|
15
|
-
* (`shell-read-plan.ts`)
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* (`shell-read-plan.ts`), in their ORDERED state: a binding is one for a reader only where it may run before the
|
|
16
|
+
* reader in the same shell — not one written after it, inside a subshell the reader is not in (a closed `( … )`, a
|
|
17
|
+
* pipeline member that is not the last, a background job) or in a function body (it runs at a call: a call the plan
|
|
18
|
+
* sees makes every name a body binds unknown from there). A value bound in a segment that may not have run before
|
|
19
|
+
* a reader (an `&&` / `||` run, a branch, a loop body, the last pipeline member) joins the values the name held
|
|
20
|
+
* before instead of replacing them. A reader in a function body loses every name another body binds — unless the
|
|
21
|
+
* body declared it with a plain `local`. `PWD` / `OLDPWD` start from what the working-directory thread says.
|
|
20
22
|
* An attribute and a name reference hold for every segment they may RUN before: a later one, one in a function body
|
|
21
23
|
* (it runs at its call), one in the same loop body (a later beat).
|
|
22
24
|
*
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
*/
|
|
27
29
|
import { type LexedRedirect, type LexedSegment, type LexedToken, type LexedWord } from "../../shell/lex.js";
|
|
28
30
|
import { type DeclaredAttribute } from "./program-read-model.js";
|
|
31
|
+
import { type BuiltinState } from "./shell-read-builtins.js";
|
|
29
32
|
/** A value a name may hold — the text the program receives ({@link spelled}: what a shell re-parsing it reads), literal
|
|
30
33
|
* throughout, or a PATTERN whose matches are the values (a `for` list word the shell globs before the loop binds it;
|
|
31
34
|
* `spelled` is then the pattern as the program receives it where it matches nothing): `glob`, with its `parts` — the
|
|
@@ -36,10 +39,12 @@ export type BoundValue = {
|
|
|
36
39
|
readonly spelled: string;
|
|
37
40
|
readonly glob?: never;
|
|
38
41
|
readonly parts?: never;
|
|
42
|
+
readonly fields?: readonly string[];
|
|
39
43
|
} | {
|
|
40
44
|
readonly spelled: string;
|
|
41
45
|
readonly glob: true;
|
|
42
46
|
readonly parts: readonly ValuePart[];
|
|
47
|
+
readonly fields?: never;
|
|
43
48
|
};
|
|
44
49
|
/** One run of a pattern {@link BoundValue}: literal text, or a pattern — the shell expands its characters — `text` as
|
|
45
50
|
* written (what a shell re-reading it matches by), `judged` as a reader judges the names it matches. */
|
|
@@ -56,9 +61,20 @@ export type ValuePart = {
|
|
|
56
61
|
export interface FloorValue {
|
|
57
62
|
readonly spelled: string;
|
|
58
63
|
readonly glob?: true;
|
|
64
|
+
/** A pattern's spelling as a reader judges the names it matches, where it is not `spelled` ({@link judgedSpellingOf}). */
|
|
65
|
+
readonly pattern?: string;
|
|
59
66
|
}
|
|
60
|
-
/**
|
|
61
|
-
|
|
67
|
+
/** A pattern value's names as a reader judges them, where that is not its spelling: its runs, a class the judge widens
|
|
68
|
+
* as `?` (the lexer's `WordExpansion.pattern.judged`), a leading `~` the literal tilde it is. */
|
|
69
|
+
export declare function judgedSpellingOf(v: BoundValue): string | undefined;
|
|
70
|
+
/** A value as a deny-floor spelling, its judged spelling with it. */
|
|
71
|
+
export declare function floorOf(v: BoundValue): FloorValue;
|
|
72
|
+
/** The values a name may hold where the text settles it. */
|
|
73
|
+
export type NameValues = readonly BoundValue[];
|
|
74
|
+
/** What a name holds at one point of a text: its possible values, or `"unknown"`. (The values are a NAMED arm: the
|
|
75
|
+
* release manifest reads a union that spells a word as a vocabulary, and a `readonly …[]` arm beside the word is a shape
|
|
76
|
+
* it cannot enumerate — it would then publish the set unreadable.) */
|
|
77
|
+
export type NameState = NameValues | "unknown";
|
|
62
78
|
/**
|
|
63
79
|
* The variables bash keeps itself — it sets them (`PWD`, `REPLY`, `OPTARG`, `BASH_REMATCH`, …), holds them read-only
|
|
64
80
|
* (`SHELLOPTS`, `BASHOPTS`, `BASH_VERSINFO`: an assignment to one is refused), or evaluates every value assigned to them
|
|
@@ -67,11 +83,32 @@ type NameState = readonly BoundValue[] | "unknown";
|
|
|
67
83
|
* question, never a read). Their value is never the text that bound it.
|
|
68
84
|
*/
|
|
69
85
|
export declare const SHELL_INTEGER_VARIABLES: ReadonlySet<string>;
|
|
70
|
-
/** Is this a variable bash keeps itself ({@link SHELL_INTEGER_VARIABLES}, or one it sets)?
|
|
86
|
+
/** Is this a variable bash keeps itself ({@link SHELL_INTEGER_VARIABLES}, or one it sets)? The working-directory names
|
|
87
|
+
* ({@link WORKING_DIRECTORY_NAMES}) are not: their value is the working-directory thread's ({@link WorkingDirectoryState}). */
|
|
71
88
|
export declare function shellKeepsName(name: string): boolean;
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
|
|
89
|
+
/** The names bash sets when the working directory moves: `PWD` (where the shell stands, as the move spelled it) and
|
|
90
|
+
* `OLDPWD` (the `PWD` it stood in before the last move — `cd -` goes there). A text may assign them too. */
|
|
91
|
+
export declare const WORKING_DIRECTORY_NAMES: readonly ["PWD", "OLDPWD"];
|
|
92
|
+
export type WorkingDirectoryName = (typeof WORKING_DIRECTORY_NAMES)[number];
|
|
93
|
+
/** What the working-directory thread (`shell-read-plan.ts`) says the two names hold at one segment, before anything the
|
|
94
|
+
* text assigns them: the bases it may stand in (`PWD`) and the ones it stood in before its last move (`OLDPWD`) —
|
|
95
|
+
* `unknown` where it lost track, the move's spelling is not the base (a physical move), or the shell inherited it. */
|
|
96
|
+
export type WorkingDirectoryState = {
|
|
97
|
+
readonly [K in WorkingDirectoryName]: NameState;
|
|
98
|
+
} & {
|
|
99
|
+
/** The last segment before the reader whose move the thread applied or lost track at (-1: none in this text). */
|
|
100
|
+
readonly movedAt: number;
|
|
101
|
+
};
|
|
102
|
+
/** The POSIX special builtins: a prefix assignment to one stays after it, and one runs before a function of its name
|
|
103
|
+
* (in POSIX mode, which an inherited environment can turn on unseen). */
|
|
104
|
+
export declare const SPECIAL_BUILTINS: ReadonlySet<string>;
|
|
105
|
+
export declare const functionKey: (name: string) => string;
|
|
106
|
+
/** What a function name is at a reader: `defined` — it certainly is one; `absent` — it certainly is not; `maybe` — a branch,
|
|
107
|
+
* a loop, a body that may not have run, a removal that may not have found it. */
|
|
108
|
+
export type FunctionState = "defined" | "maybe" | "absent";
|
|
109
|
+
/** One binding a segment makes: a name and what it now holds (`unknown` = made unknown). `prefix`: a binding that may or
|
|
110
|
+
* may not take effect (a prefix assignment to a special builtin, which may or may not outlive its command; an `unset` of a
|
|
111
|
+
* function, which a read-only function refuses). `loopVar`: a `for` loop's variable, held through its body. */
|
|
75
112
|
export interface Binding {
|
|
76
113
|
readonly name: string;
|
|
77
114
|
readonly state: NameState;
|
|
@@ -107,9 +144,9 @@ export interface BindingEffect {
|
|
|
107
144
|
/** How one value word reads against the table, the earlier assignments of the same segment applied (bash assigns left
|
|
108
145
|
* to right): its possible values, or `unknown`. */
|
|
109
146
|
export type ValueReader = (word: Pick<LexedWord, "pieces">, quoted: boolean, overlay: ReadonlyMap<string, NameState>) => NameState;
|
|
110
|
-
/** The segment's shape the effect needs beside its words:
|
|
147
|
+
/** The segment's shape the effect needs beside its words: the functions whose definition heads were dropped from it. */
|
|
111
148
|
export interface SegmentShape {
|
|
112
|
-
readonly
|
|
149
|
+
readonly defines: readonly string[];
|
|
113
150
|
}
|
|
114
151
|
/** The argv projection of a lexed segment: structure that names nothing that runs here is dropped — a subshell
|
|
115
152
|
* parenthesis, a bare `{` / `}`, a function definition's head (`NAME ()`, and `function NAME [()]` with a name of
|
|
@@ -125,38 +162,53 @@ export declare function projectSegment(segment: LexedSegment): ProjectedSegment;
|
|
|
125
162
|
* `NAME ( )` ({@link isDefinitionName}), and `function NAME [( )]` — a bare `function` at command position, a name of any
|
|
126
163
|
* spelling. The lexer puts the body's compound command back at command position after the head, so a definition
|
|
127
164
|
* nested in a body is dropped the same way; after a drop the token that moved up is looked at again. Answers where the
|
|
128
|
-
* heads stood: entry `k`
|
|
129
|
-
* token, a head whose body opens in a later segment). */
|
|
130
|
-
export declare function dropDefinitionHeads(tokens: LexedToken[]): readonly
|
|
165
|
+
* heads stood: entry `k` names the functions whose heads were dropped right before the token now at `k` (the last entry,
|
|
166
|
+
* past the last token, a head whose body opens in a later segment). */
|
|
167
|
+
export declare function dropDefinitionHeads(tokens: LexedToken[]): readonly (readonly string[])[];
|
|
131
168
|
/**
|
|
132
169
|
* What a word holds through the names it refers to — `$NAME`, `${NAME}`, a leading `~` (the value of `HOME`): `undefined`
|
|
133
170
|
* where it refers to no name (it reads as written), else {@link valueOf}. `table.stateOf` is read after `overlay` (the
|
|
134
171
|
* names the same segment bound earlier).
|
|
135
172
|
*/
|
|
136
|
-
export declare function wordValues(word: Pick<LexedWord, "pieces">, table: BindingTable | undefined, quoted: boolean, overlay?: ReadonlyMap<string, NameState
|
|
173
|
+
export declare function wordValues(word: Pick<LexedWord, "pieces">, table: BindingTable | undefined, quoted: boolean, overlay?: ReadonlyMap<string, NameState>, split?: boolean): readonly BoundValue[] | "unknown" | undefined;
|
|
174
|
+
/** The names a word's expansions read as values — a bare `$NAME` / `${NAME}`, and one written inside a bracket the shell
|
|
175
|
+
* forms its class from after expanding it ({@link valueOf}) — in the order they stand. */
|
|
176
|
+
export declare function namesIn(word: Pick<LexedWord, "pieces">): string[];
|
|
137
177
|
/**
|
|
138
178
|
* What a VALUE word holds (an assignment's value, a `for` list word, a word handed to a program) — THE piece walk, the one
|
|
139
|
-
* producer of {@link BoundValue}s: every combination of the values its pieces take
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
179
|
+
* producer of {@link BoundValue}s: every combination of the values its pieces take, each field's pattern formed once the
|
|
180
|
+
* whole field has expanded ({@link formedField}) — a literal piece its text, a glob piece its pattern as written (a bracket
|
|
181
|
+
* holding an expansion its brackets and its body, the body's names substituted in place), `~` and `$NAME` the values the
|
|
182
|
+
* table gives:
|
|
183
|
+
* · its values — a field the shell globs makes the value a pattern;
|
|
143
184
|
* · `"unknown"` — a name it refers to is not settled here, it carries an expansion no name answers (a modifier, a
|
|
144
|
-
* substitution, a brace list, `~user
|
|
145
|
-
*
|
|
146
|
-
* split), or it would list more than
|
|
185
|
+
* substitution, a brace list, `~user`), an UNQUOTED expansion's value is no {@link READABLE_VALUE} (or holds
|
|
186
|
+
* whitespace outside `split`), `IFS` may have changed (`quoted` = the whole word is read as one value: an assignment's
|
|
187
|
+
* value, which is never split), a field is not formed or a split one forms a pattern, or it would list more than
|
|
188
|
+
* {@link WORD_VALUES_MAX} values.
|
|
189
|
+
* `split` = the word is read as the ARGUMENTS it becomes: an unquoted value is split into its words on the default `IFS`
|
|
190
|
+
* (a value then carries its {@link BoundValue} `fields`).
|
|
147
191
|
*/
|
|
148
|
-
export declare function valueOf(word: Pick<LexedWord, "pieces">, table: BindingTable | undefined, quoted: boolean, overlay?: ReadonlyMap<string, NameState
|
|
192
|
+
export declare function valueOf(word: Pick<LexedWord, "pieces">, table: BindingTable | undefined, quoted: boolean, overlay?: ReadonlyMap<string, NameState>, split?: boolean): NameState;
|
|
149
193
|
/**
|
|
150
194
|
* The spellings a word the table leaves unknown may still take through the deny floors of the names it refers to
|
|
151
195
|
* ({@link BindingTable.floorOf}) — `${A[k]}`, `${A[@]}`, `$A` reading an array's elements — or through their values where
|
|
152
196
|
* known: for the deny judge alone. Empty where some name it refers to leaves neither.
|
|
153
197
|
*/
|
|
154
198
|
export declare function wordFloorValues(word: Pick<LexedWord, "pieces">, table: BindingTable | undefined): readonly FloorValue[];
|
|
199
|
+
/** Where a segment's argv heads a `for` / `select` loop: the index of that bare word, at the segment's start or past the
|
|
200
|
+
* bare control words in front of it (`do for x in …`, `then for …` — a loop nested in a body or a branch); `undefined`
|
|
201
|
+
* for any other segment. */
|
|
202
|
+
export declare function loopListHeadAt(argv: readonly LexedWord[]): number | undefined;
|
|
155
203
|
/**
|
|
156
204
|
* What ONE segment does to the names (see the module header). `argv` = the segment's argv projection (structure
|
|
157
205
|
* dropped); `readValue` folds a value word against the table (a reader that answers `unknown` gives the names alone).
|
|
206
|
+
* `shadow`: the word the shell looks up first is a function of the text where the segment stands (`named`: it is one, the
|
|
207
|
+
* builtin of its name does not run — the call's effect is the body's; `maybe`: it may be one, so what the builtin binds is one
|
|
208
|
+
* more value its names may hold). `availability`: whether the builtin of a name runs by it where the segment stands
|
|
209
|
+
* ({@link BuiltinState}) — `disabled`: the word finds no command and binds nothing, `maybe`: as a function that may stand.
|
|
158
210
|
*/
|
|
159
|
-
export declare function bindingEffectOf(segment: LexedSegment, argv: readonly LexedWord[], shape: SegmentShape, readValue: ValueReader): BindingEffect;
|
|
211
|
+
export declare function bindingEffectOf(segment: LexedSegment, argv: readonly LexedWord[], shape: SegmentShape, readValue: ValueReader, shadow?: "named" | "maybe", availability?: (builtin: string) => BuiltinState): BindingEffect;
|
|
160
212
|
/**
|
|
161
213
|
* The names an ARITHMETIC text may assign: every identifier in a text that carries an assignment operator (`=` that is no
|
|
162
214
|
* comparison, `+=` and its kin, `++`, `--`) — read whole, not parsed: a name only compared there is made unknown too.
|
|
@@ -180,7 +232,22 @@ export type NameReader = (name: string) => NameState;
|
|
|
180
232
|
export interface InheritedNames {
|
|
181
233
|
readonly attributes: readonly NameAttribute[];
|
|
182
234
|
readonly references: boolean;
|
|
235
|
+
/** The deny floors a name starts the text with ({@link BindingTable.floorOf}): what the words handing it this text as
|
|
236
|
+
* written may name there — or, for a substitution body, the floors its segment reads. */
|
|
237
|
+
readonly floors?: ReadonlyMap<string, readonly FloorValue[]>;
|
|
238
|
+
/** The names something before the nested text may have changed — a change that can reach where it starts, and the
|
|
239
|
+
* names its own segment's command environment sets (`TMPDIR=… bash -c …`): there such a name no longer holds what the
|
|
240
|
+
* shell provides ({@link BindingTable.providedByShell}). `all`: any name. Absent: none. */
|
|
241
|
+
readonly rebound?: ReadonlySet<string> | "all";
|
|
242
|
+
}
|
|
243
|
+
/** The function and builtin keys of the shell a text runs in — a literal `eval` text, a substitution body (a fork): what each key
|
|
244
|
+
* holds where the text starts (the outer table's answer for it), and the names a call to one of the outer functions may change. */
|
|
245
|
+
export interface InheritedFunctions {
|
|
246
|
+
readonly start: (key: string) => NameState;
|
|
247
|
+
readonly bound: ReadonlySet<string> | "all";
|
|
183
248
|
}
|
|
249
|
+
/** Two rebound sets as one. */
|
|
250
|
+
export declare function joinRebound(a: ReadonlySet<string> | "all" | undefined, b: Iterable<string> | "all" | undefined): ReadonlySet<string> | "all";
|
|
184
251
|
/** What the thread answers for one reader: what a name may hold, and whether a name carries the integer attribute. */
|
|
185
252
|
export interface BindingTable {
|
|
186
253
|
stateOf(name: string): NameState;
|
|
@@ -194,6 +261,16 @@ export interface BindingTable {
|
|
|
194
261
|
floorOf(name: string): readonly FloorValue[];
|
|
195
262
|
/** What a substitution body here starts with. */
|
|
196
263
|
readonly inherited: InheritedNames;
|
|
264
|
+
/** The names a change that can reach this point touched — a binding, or a name made unknown, that may run before it in
|
|
265
|
+
* this shell (the thread's order: {@link BindingThread}) — and the names its start says were rebound; `all`: any. */
|
|
266
|
+
readonly rebound: ReadonlySet<string> | "all";
|
|
267
|
+
/** Does this name still hold what the shell provides here: no change that can reach this point touched it? */
|
|
268
|
+
providedByShell(name: string): boolean;
|
|
269
|
+
/** What a function of this name is here: the one ordered rule that answers a variable's value answers it
|
|
270
|
+
* ({@link FunctionState}). A name the text never defines is `absent` to the caller's own filter, not to this thread. */
|
|
271
|
+
functionState(name: string): FunctionState;
|
|
272
|
+
/** Whether the builtin of this name runs by it here: the same ordered rule ({@link BuiltinState}). */
|
|
273
|
+
builtinState(name: string): BuiltinState;
|
|
197
274
|
}
|
|
198
275
|
/**
|
|
199
276
|
* The effects of a text's segments, threaded the way the plan threads its working directory: a reader at segment `j`
|
|
@@ -203,11 +280,16 @@ export interface BindingTable {
|
|
|
203
280
|
* assignment, and — reached through `&&` / `||` — it lies in `j`'s own `&&` run (`andRunStart`: the same index the
|
|
204
281
|
* working-directory thread reads).
|
|
205
282
|
*
|
|
206
|
-
* A
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
283
|
+
* A binding exists for a reader only where it may run before the reader IN THE SAME SHELL — the ordered state: one
|
|
284
|
+
* written after the reader, one inside a subshell the reader is not in (a `( … )` group that closed before it, a
|
|
285
|
+
* pipeline member that is not the last, a background job — a substitution body is a text of its own) and one in a
|
|
286
|
+
* function body is NOT a binding for it. A function body runs at its call: a call the plan can see (a program word
|
|
287
|
+
* naming one of the text's functions, a code body a builtin runs later, which may name one) makes every name a body
|
|
288
|
+
* binds unknown from that segment on ({@link functionBound}); a text the plan does not read (`eval`, `source`, a
|
|
289
|
+
* computed program word) already makes every name unknown. The last member of a pipeline may or may not run in this
|
|
290
|
+
* shell: its bindings join the values before them. A body's own readers follow its own order; a reader in another body
|
|
291
|
+
* loses a name any other body binds ({@link Unreadable}). A name the body declares with a plain `local` (before the
|
|
292
|
+
* binding, where the declaration certainly ran) never leaves it.
|
|
211
293
|
*
|
|
212
294
|
* An attribute ({@link NameAttribute}) and a name reference hold for every segment they may RUN before — a later one,
|
|
213
295
|
* one in a function body, one in the same loop body: an assignment there binds something other than its text.
|
|
@@ -225,7 +307,11 @@ export declare class BindingThread {
|
|
|
225
307
|
/** `HOME` may already hold something other than the declared home where the text starts (a substitution body
|
|
226
308
|
* inside a text that bound it). */
|
|
227
309
|
private readonly homeStartsTouched;
|
|
310
|
+
/** The functions the shell that runs this text (a literal `eval` text) already holds. */
|
|
311
|
+
private readonly inheritedFunctions?;
|
|
228
312
|
private readonly entries;
|
|
313
|
+
/** The `local` declarations the walk applied as certain ({@link apply}), each where it stands. */
|
|
314
|
+
private readonly localDeclarations;
|
|
229
315
|
/** The attributes the text gives ({@link BindingEffect.attributes}), and where — read off its names alone, before any
|
|
230
316
|
* reader: one given later in the text may run first. */
|
|
231
317
|
private readonly attributesAt;
|
|
@@ -233,8 +319,15 @@ export declare class BindingThread {
|
|
|
233
319
|
private readonly unreadable;
|
|
234
320
|
/** The block nesting each segment moves ({@link blockStructure}). */
|
|
235
321
|
private readonly blocks;
|
|
236
|
-
/** Segments that
|
|
237
|
-
|
|
322
|
+
/** Segments that END in a pipe or a `&`: the command that closes them is a pipeline member that is not the last, or a
|
|
323
|
+
* background job — a subshell of its own ({@link ownSubshellAt}: which of the segment's bindings that is). */
|
|
324
|
+
private readonly ownSubshell;
|
|
325
|
+
/** The floors the names start the text with ({@link InheritedNames.floors}). */
|
|
326
|
+
private readonly startFloors;
|
|
327
|
+
/** The names rebound where the text starts ({@link InheritedNames.rebound}). */
|
|
328
|
+
private readonly startRebound;
|
|
329
|
+
/** Where a function body runs ({@link runsBodies}): the last segment that can call one, and the command environment of each call. */
|
|
330
|
+
private bodyRuns;
|
|
238
331
|
constructor(segments: readonly LexedSegment[],
|
|
239
332
|
/** What each segment binds, its names alone (a value is the reader's to read). */
|
|
240
333
|
named: readonly BindingEffect[],
|
|
@@ -248,31 +341,96 @@ export declare class BindingThread {
|
|
|
248
341
|
* inside a text that bound it). */
|
|
249
342
|
homeStartsTouched?: boolean,
|
|
250
343
|
/** What holds where the text starts: given before its first segment. */
|
|
251
|
-
inherited?: InheritedNames
|
|
344
|
+
inherited?: InheritedNames,
|
|
345
|
+
/** The functions the shell that runs this text (a literal `eval` text) already holds. */
|
|
346
|
+
inheritedFunctions?: InheritedFunctions | undefined);
|
|
252
347
|
/** What a text nested at segment `j` starts with ({@link InheritedNames}) — `j` absent: a text run later, which every
|
|
253
|
-
* segment may run before
|
|
348
|
+
* segment may run before (in whatever shell: a later text may run inside a subshell or a body, so every change
|
|
349
|
+
* counts). */
|
|
254
350
|
inheritedAt(j?: number): InheritedNames;
|
|
255
|
-
/** What
|
|
256
|
-
*
|
|
351
|
+
/** What a name holds where the text starts: a function name unbound, a builtin enabled (what the shell around an `eval` text, a
|
|
352
|
+
* substitution body or a text run later holds, if it says); a variable as the plan says. */
|
|
353
|
+
private startOf;
|
|
354
|
+
/** Does any segment of this text bind the name (or every name)? */
|
|
355
|
+
private bindsInText;
|
|
356
|
+
/** What a text this one runs at some later point (a `trap` action) finds each function and builtin key: the point is not ordered
|
|
357
|
+
* against the segments (it may fire after any of them, inside any body or subshell), so a key holds what the text starts it with
|
|
358
|
+
* and every value any segment binds it ({@link InheritedFunctions}). */
|
|
359
|
+
heldAnywhere(): InheritedFunctions;
|
|
360
|
+
/** Tell the thread where function bodies run: `runs[si]` — segment `si` may run one (a call, a text the plan does not
|
|
361
|
+
* read); `atEnd` — a code body may run at the text's end or at any point (`trap`); `environment[si]` — what a call's own
|
|
362
|
+
* command environment sets. A call inside a loop may run again after a later segment of the loop. The last run point
|
|
363
|
+
* bounds what can precede a body: a binding after it never does. A name a body that makes a call binds — `local` too:
|
|
364
|
+
* the shell's scope is dynamic, the callee runs inside it — is unreadable to a reader in any other body. */
|
|
365
|
+
runsBodies(runs: readonly boolean[], atEnd: boolean, environment: readonly (ReadonlySet<string> | "all" | undefined)[]): void;
|
|
366
|
+
/** The names a reader that runs LATER than it stands may find rebound by segments after it: a reader in a function body
|
|
367
|
+
* runs at each call, so every segment up to the last run point (and a call's own command environment) may run before it;
|
|
368
|
+
* a text handed to run later (`j` absent) at any point. A reader that runs where it stands has none: the effects the walk
|
|
369
|
+
* has applied so far are the ones that precede it. A `local` counts like any binding: it shortens a name's life, not the
|
|
370
|
+
* view of a reader that runs inside its extent (a body called from there, a `trap` text it sets). */
|
|
371
|
+
private boundLater;
|
|
372
|
+
/** Does a binding segment `at` makes, standing at `standing`, run in a subshell of its own — a pipeline member that is
|
|
373
|
+
* not the last, a background job? A segment's closing pipe or `&` ends ITS LAST command, at the depth that command
|
|
374
|
+
* stands: a binding that stands shallower (a function definition's head, in front of the block its body opens in the
|
|
375
|
+
* same segment: `f(){ ls | head; … }`) is not that member — the pipe closes a command inside the body, and the
|
|
376
|
+
* definition is the shell's own. */
|
|
377
|
+
private ownSubshellAt;
|
|
378
|
+
/** Is a binding segment `at` makes one no later reader may count on as certain: made in a pipeline member (it follows a
|
|
379
|
+
* `|`, or it is {@link ownSubshellAt}) or a background job? */
|
|
380
|
+
private detachedAt;
|
|
381
|
+
/** Can a binding segment `at` makes exist for a reader at segment `j` (`j` absent: a reader at the text's end, outside
|
|
382
|
+
* every body and subshell)? Not where `at` stands in a function body the reader is not in (the body runs at its call),
|
|
383
|
+
* runs in a subshell of its own (a pipeline member that is not the last, a background job), or stands in a `( … )`
|
|
384
|
+
* group the reader is not in. */
|
|
385
|
+
private visible;
|
|
386
|
+
/** Where the binding `name` of segment `at` is made: the segment's own place, or — a function definition — where its head
|
|
387
|
+
* stands. */
|
|
388
|
+
private standingOf;
|
|
389
|
+
/** The names any of the text's function bodies binds — what a call to one of them may change — or `all` where a body
|
|
390
|
+
* may bind any name. A name the body keeps `local` ({@link leavesBody}) stays in it. */
|
|
391
|
+
functionBound(): ReadonlySet<string> | "all";
|
|
392
|
+
/** The function body a binding segment `at` makes belongs to, where the name can outlive it: the body it stands in — a
|
|
393
|
+
* plain `local NAME` is the body's own and never leaves it (an optioned declaration, `declare -g` / `local -p`, reads no
|
|
394
|
+
* scope, so it can). What a reader in ANOTHER body loses ({@link unreadableBy}); a call to the body changes it unless a
|
|
395
|
+
* declaration the body certainly ran covers the name ({@link functionBound}). */
|
|
396
|
+
private bodyBinding;
|
|
397
|
+
/** Does segment `at` stand in a function body (it runs at a call, not here)? */
|
|
398
|
+
inFunctionBody(at: number): boolean;
|
|
399
|
+
/** Does segment `at` run in a subshell (a `( … )` group, a pipeline member that is not the last, a background job) or a
|
|
400
|
+
* function body — whatever it changes, the shell that runs the next segment may not see? */
|
|
401
|
+
runsApart(at: number): boolean;
|
|
402
|
+
/** Segment `at` hands this shell a body it runs at ANY later point (a `trap` action, an alias value): every name the
|
|
403
|
+
* body may bind (`all`: any) is unreadable to every reader after `at`, whatever is assigned to it in between. */
|
|
404
|
+
runsLater(at: number, names: ReadonlySet<string> | "all"): void;
|
|
405
|
+
/** What segment `at` makes unreadable: in a function body, the names it binds (a plain `local` stays in it) — every name
|
|
406
|
+
* where it may bind any; a name reference, every name. Read before any segment is applied, so it does not ask which
|
|
407
|
+
* declarations certainly ran: a name a body assigns after its own `local` is lost to a reader in another body all the same
|
|
408
|
+
* (more questions, never fewer). */
|
|
257
409
|
private unreadableBy;
|
|
258
410
|
/** May segment `x` run before segment `e` runs (`x` being `e`: before a later run of it): `x` comes first in the text,
|
|
259
411
|
* `e` stands in a function body (the body runs at its call, after any segment, and may run again), or both stand in
|
|
260
412
|
* one loop's body (a later beat runs `x` again first). */
|
|
261
413
|
private mayRunBefore;
|
|
262
|
-
/** Did the body certainly declare this name `local` before segment `at`: an earlier segment of the body, run on its
|
|
263
|
-
*
|
|
414
|
+
/** Did the body certainly declare this name `local` before segment `at`: an earlier segment of the body, run on its own
|
|
415
|
+
* (no `&&` / `||`, no pipeline member or background job), in a block still open at `at`, whose declaration the walk
|
|
416
|
+
* APPLIED as certain — the shell ran its word as the builtin: no function of that name standing, no launcher, path or
|
|
417
|
+
* redirection in the way, and the builtin enabled where the body runs (what {@link bindingEffectOf} concluded, the ordered
|
|
418
|
+
* state of {@link BindingTable.functionState} and {@link BindingTable.builtinState}; recorded by {@link apply}). */
|
|
264
419
|
private declaredLocal;
|
|
265
|
-
/** Does the block that holds
|
|
420
|
+
/** Does the block that holds a binding's words stay open (no closing word, no switch of branch) through `j`? */
|
|
266
421
|
private heldThrough;
|
|
267
422
|
/** Apply segment `at`'s effect. `andRun`: the segment was reached through `&&` / `||`. `loopEnd`: for a loop variable,
|
|
268
423
|
* the index of the loop's end. */
|
|
269
424
|
apply(at: number, effect: BindingEffect, andRun: boolean, loopEnd?: number): void;
|
|
270
|
-
/**
|
|
271
|
-
|
|
272
|
-
|
|
425
|
+
/** Does a reader at segment `j` lose the name `u` makes unreadable: past a name reference it may run after, or in a
|
|
426
|
+
* function body other than the one that binds it? */
|
|
427
|
+
private lostAt;
|
|
428
|
+
/** Make these names unknown from segment `at` on (a loop body that binds them may have run before any of its beats; a
|
|
429
|
+
* call runs a body that binds them). */
|
|
273
430
|
kill(at: number, names: Iterable<string> | "all"): void;
|
|
274
|
-
/** The table a reader at segment `j` sees; `andRunStart` = the first segment of `j`'s `&&` run
|
|
275
|
-
|
|
431
|
+
/** The table a reader at segment `j` sees; `andRunStart` = the first segment of `j`'s `&&` run; `where` = what the
|
|
432
|
+
* working-directory thread says `PWD` / `OLDPWD` hold there (absent: it does not say — both unknown). */
|
|
433
|
+
tableAt(j: number, andRunStart: number, where?: WorkingDirectoryState): BindingTable;
|
|
276
434
|
}
|
|
277
435
|
/** A segment that opens with `((`: an arithmetic command (or a subshell in a subshell — the tokens are the same). */
|
|
278
436
|
export declare function isArithmeticCommand(segment: LexedSegment): boolean;
|
|
@@ -297,4 +455,3 @@ export declare function arithmeticSubstitutions(text: string, table: BindingTabl
|
|
|
297
455
|
}): string[];
|
|
298
456
|
/** The text of every `[…]` subscript in an arithmetic text (nested brackets balanced; an unclosed one runs to the end). */
|
|
299
457
|
export declare function subscriptsOf(text: string): string[];
|
|
300
|
-
export {};
|