@sema-agent/core 7.51.2 → 7.53.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 +698 -2
- package/README.md +3 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/cascade.js +4 -0
- package/dist/agents/cross-session-envelope.d.ts +8 -0
- package/dist/agents/cross-session-envelope.js +6 -0
- package/dist/agents/cross-session-judge.d.ts +21 -1
- package/dist/agents/cross-session-judge.js +8 -0
- package/dist/agents/cross-session-ref.d.ts +5 -0
- package/dist/agents/cross-session-ref.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +3 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/org-delivery-gate.d.ts +122 -0
- package/dist/agents/org-delivery-gate.js +69 -0
- package/dist/agents/peer-held-queue.d.ts +9 -4
- package/dist/agents/peer-held-queue.js +6 -5
- package/dist/agents/peer-session-drain.d.ts +35 -5
- package/dist/agents/peer-session-drain.js +271 -180
- package/dist/agents/read-inbox-tool.d.ts +8 -1
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/repair-loop.js +4 -0
- package/dist/agents/send-message-tool.d.ts +11 -16
- package/dist/agents/send-message-tool.js +11 -13
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +105 -76
- package/dist/agents/tool-filter.d.ts +58 -13
- package/dist/agents/tool-filter.js +34 -14
- package/dist/bench/metrics.d.ts +1 -0
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +17 -13
- package/dist/brain/model-presets.d.ts +4 -5
- package/dist/brain/model-presets.js +6 -5
- package/dist/brain/open-responses.js +16 -12
- package/dist/brain/openai.js +16 -12
- package/dist/brain/request-params.d.ts +12 -33
- package/dist/brain/request-params.js +5 -2
- package/dist/brain/request-route.d.ts +9 -8
- package/dist/brain/request-route.js +1 -0
- package/dist/brain/route-adjudicator.d.ts +123 -47
- package/dist/brain/route-adjudicator.js +171 -42
- package/dist/brain/route-conformance.js +2 -2
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/status-sink.d.ts +18 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +30 -13
- package/dist/core/allow-entry.d.ts +42 -9
- package/dist/core/allow-entry.js +25 -18
- package/dist/core/auto-compaction.d.ts +80 -20
- package/dist/core/auto-compaction.js +65 -18
- package/dist/core/auto-promote.d.ts +2 -1
- package/dist/core/auto-promote.js +2 -2
- package/dist/core/caller-tool-name.d.ts +9 -0
- package/dist/core/caller-tool-name.js +13 -0
- package/dist/core/checkpoint-requirements.d.ts +7 -1
- package/dist/core/checkpoint-requirements.js +2 -0
- package/dist/core/checkpoint-store.d.ts +57 -24
- package/dist/core/checkpoint-store.js +3 -3
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +2 -1
- package/dist/core/compliance.js +3 -1
- package/dist/core/credential-vocabulary.d.ts +33 -8
- package/dist/core/credential-vocabulary.js +32 -7
- package/dist/core/decision-receipt.d.ts +2 -2
- package/dist/core/delegation-frames.d.ts +9 -2
- package/dist/core/delegation-name.d.ts +18 -0
- package/dist/core/delegation-name.js +47 -0
- package/dist/core/effective-path-target.d.ts +25 -6
- package/dist/core/effective-path-target.js +24 -2
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +49 -21
- package/dist/core/frontmatter-fence.d.ts +10 -0
- package/dist/core/frontmatter-fence.js +6 -0
- package/dist/core/gate-fold.js +8 -25
- package/dist/core/gate-lanes.js +358 -274
- package/dist/core/gate-outcome.d.ts +11 -6
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +12 -3
- package/dist/core/hands-band-screen.d.ts +7 -0
- package/dist/core/hands-band-screen.js +32 -0
- package/dist/core/hooks.d.ts +283 -739
- package/dist/core/hooks.js +100 -193
- package/dist/{tools/fs → core}/image-admission.d.ts +21 -3
- package/dist/{tools/fs → core}/image-admission.js +24 -6
- package/dist/core/locked-config.d.ts +84 -32
- package/dist/core/locked-config.js +128 -42
- package/dist/core/mcp-connection-pool.d.ts +4 -1
- package/dist/core/mcp-connection-pool.js +7 -2
- package/dist/core/mcp-probe.d.ts +12 -9
- package/dist/core/mcp-probe.js +3 -3
- package/dist/core/mcp-server-spec.d.ts +104 -10
- package/dist/core/mcp-server-spec.js +183 -33
- package/dist/core/mcp.d.ts +31 -20
- package/dist/core/mcp.js +66 -56
- package/dist/core/memory-engine/data-plane.js +5 -1
- package/dist/core/memory-engine/distiller.js +16 -2
- package/dist/core/memory-engine/engine.d.ts +22 -30
- package/dist/core/memory-engine/engine.js +16 -10
- package/dist/core/memory-engine/frontmatter.d.ts +6 -0
- package/dist/core/memory-engine/frontmatter.js +19 -16
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/mode-policy.d.ts +5 -16
- package/dist/core/mode-policy.js +7 -19
- package/dist/core/model-seat.d.ts +4 -1
- package/dist/core/mods/dollar.d.ts +109 -0
- package/dist/core/mods/dollar.js +154 -0
- package/dist/core/mods/host.d.ts +23 -0
- package/dist/core/mods/host.js +21 -0
- package/dist/core/mods/kernel/budget.d.ts +43 -0
- package/dist/core/mods/kernel/budget.js +83 -0
- package/dist/core/mods/kernel/dispatch.d.ts +100 -0
- package/dist/core/mods/kernel/dispatch.js +699 -0
- package/dist/core/mods/kernel/events.d.ts +245 -0
- package/dist/core/mods/kernel/events.js +210 -0
- package/dist/core/mods/kernel/index.d.ts +6 -0
- package/dist/core/mods/kernel/index.js +5 -0
- package/dist/core/mods/kernel/receive.d.ts +94 -0
- package/dist/core/mods/kernel/receive.js +188 -0
- package/dist/core/mods/kernel/registration.d.ts +131 -0
- package/dist/core/mods/kernel/registration.js +102 -0
- package/dist/core/mods/kernel/site-rules.d.ts +149 -0
- package/dist/core/mods/kernel/site-rules.js +296 -0
- package/dist/core/mods/stations.d.ts +344 -0
- package/dist/core/mods/stations.js +437 -0
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +71 -2
- package/dist/core/own-property-receipt.d.ts +13 -0
- package/dist/core/own-property-receipt.js +13 -23
- package/dist/core/parent-spec-seat.d.ts +18 -7
- package/dist/core/parent-spec-seat.js +6 -2
- package/dist/core/path-identity.js +2 -1
- package/dist/core/permission-rule-model.d.ts +58 -9
- package/dist/core/permission-rule-model.js +81 -7
- package/dist/core/permission-rule-org.d.ts +163 -33
- package/dist/core/permission-rule-org.js +205 -71
- package/dist/core/permission-rule-syntax.d.ts +15 -0
- package/dist/core/permission-rule-syntax.js +24 -16
- package/dist/core/permission-rules.d.ts +14 -2
- package/dist/core/permission-rules.js +63 -23
- package/dist/core/prompt-section-seat.d.ts +15 -27
- package/dist/core/prompt-section-seat.js +73 -40
- package/dist/core/protocol-http-auth.d.ts +3 -1
- package/dist/core/protocol-http-auth.js +2 -0
- package/dist/core/reminder-mint.d.ts +2 -2
- package/dist/core/remote-env.d.ts +24 -12
- package/dist/core/remote-env.js +1 -0
- package/dist/core/resume-startup-cause.d.ts +16 -1
- package/dist/core/resume-startup-cause.js +4 -1
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +12 -2
- package/dist/core/retired-keys.js +15 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/announce-once-ledger.d.ts +31 -1
- package/dist/core/runner/announce-once-ledger.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +9 -0
- package/dist/core/runner/assemble-result.js +3 -1
- package/dist/core/runner/call-hook-stations.d.ts +23 -27
- package/dist/core/runner/call-hook-stations.js +58 -42
- package/dist/core/runner/caller-stop-gate.d.ts +25 -0
- package/dist/core/runner/caller-stop-gate.js +7 -0
- package/dist/core/runner/compaction-seams.d.ts +8 -22
- package/dist/core/runner/compaction-seams.js +28 -53
- package/dist/core/runner/construction-doors.js +11 -1
- package/dist/core/runner/contracts.d.ts +86 -83
- package/dist/core/runner/credential-origin-seat.d.ts +2 -0
- package/dist/core/runner/credential-origin-seat.js +19 -0
- package/dist/core/runner/extra-body-dropped-seat.d.ts +2 -6
- package/dist/core/runner/gate-exit.d.ts +47 -36
- package/dist/core/runner/gate-exit.js +12 -5
- package/dist/core/runner/image.js +1 -2
- package/dist/core/runner/inline-image.js +1 -1
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- package/dist/core/runner/notice-seat-input.d.ts +11 -0
- package/dist/core/runner/notice-seat-input.js +1 -0
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
- package/dist/core/runner/permission-rule-lanes.js +22 -10
- package/dist/core/runner/person-path-rows.d.ts +3 -1
- package/dist/core/runner/person-path-rows.js +3 -2
- package/dist/core/runner/prepare-acquire-reconcile.js +5 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +5 -7
- package/dist/core/runner/prepare-ask-lane.js +6 -15
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +25 -8
- package/dist/core/runner/prepare-config-doors.d.ts +52 -1
- package/dist/core/runner/prepare-config-doors.js +168 -143
- package/dist/core/runner/prepare-defer-classify.js +7 -11
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +7 -5
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -11
- package/dist/core/runner/prepare-gate-stations.js +11 -10
- package/dist/core/runner/prepare-hands-readface.d.ts +1 -1
- package/dist/core/runner/prepare-hands-readface.js +2 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -12
- package/dist/core/runner/prepare-inherited-gate.js +10 -23
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
- package/dist/core/runner/prepare-memory-engine-session.js +20 -7
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +6 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
- package/dist/core/runner/prepare-offload-wrappers.js +2 -1
- package/dist/core/runner/prepare-park-ask.js +10 -14
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -15
- package/dist/core/runner/prepare-policy-chain.js +104 -109
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +11 -12
- package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
- package/dist/core/runner/prepare-prompt-assembly.js +138 -101
- package/dist/core/runner/prepare-prompt-inputs.d.ts +28 -23
- package/dist/core/runner/prepare-prompt-inputs.js +11 -10
- package/dist/core/runner/prepare-protocol-tools.d.ts +11 -7
- package/dist/core/runner/prepare-protocol-tools.js +20 -13
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-question-face.js +4 -3
- package/dist/core/runner/prepare-safety-scan.js +6 -10
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -0
- package/dist/core/runner/prepare-suspend-saga.js +7 -5
- package/dist/core/runner/prepare-task.js +41 -23
- package/dist/core/runner/prepare-turn-wiring.d.ts +13 -15
- package/dist/core/runner/prepare-turn-wiring.js +29 -27
- package/dist/core/runner/prepare-wiring-manifest.d.ts +13 -9
- package/dist/core/runner/prepare-wiring-manifest.js +14 -11
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +7 -5
- package/dist/core/runner/resume-apply.d.ts +5 -2
- package/dist/core/runner/resume-apply.js +24 -42
- package/dist/core/runner/resume-checkpoint-screen.d.ts +1 -0
- package/dist/core/runner/resume-checkpoint-screen.js +9 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
- package/dist/core/runner/resume-internals-and-config.js +3 -8
- package/dist/core/runner/resume-preflight.js +38 -16
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +4 -5
- package/dist/core/runner/run-brain-sinks.d.ts +3 -2
- package/dist/core/runner/run-brain-sinks.js +5 -1
- package/dist/core/runner/run-compaction-machinery.d.ts +7 -1
- package/dist/core/runner/run-compaction-machinery.js +7 -33
- package/dist/core/runner/run-harness-handlers.js +4 -2
- package/dist/core/runner/run-identity-wiring.d.ts +3 -1
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +103 -95
- package/dist/core/runner/run-notification-lane.js +1 -0
- package/dist/core/runner/run-recovery-lanes.d.ts +3 -0
- package/dist/core/runner/run-recovery-lanes.js +14 -11
- package/dist/core/runner/run-settle-and-teardown.js +9 -28
- package/dist/core/runner/run-stop-and-final-verify.js +18 -25
- package/dist/core/runner/run-terminal-adoption.d.ts +3 -0
- package/dist/core/runner/run-terminal-adoption.js +34 -22
- package/dist/core/runner/run-tool-mount-facts.js +5 -3
- package/dist/core/runner/run-turn-boundary.js +32 -37
- package/dist/core/runner/runtask.d.ts +6 -7
- package/dist/core/runner/runtask.js +15 -73
- package/dist/core/runner/session-rule-policy.d.ts +5 -5
- package/dist/core/runner/session-rule-policy.js +13 -8
- package/dist/core/runner/side-call-account.d.ts +68 -0
- package/dist/core/runner/side-call-account.js +61 -0
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-halt-verbs.js +12 -17
- package/dist/core/runner/stream-lifecycle-verbs.js +8 -5
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +20 -38
- package/dist/core/runner/sub-agent-deny-lists.d.ts +124 -23
- package/dist/core/runner/sub-agent-deny-lists.js +230 -71
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-end-body.d.ts +5 -6
- package/dist/core/runner/tool-end-body.js +6 -4
- package/dist/core/runner/tool-not-executed.d.ts +15 -0
- package/dist/core/runner/tool-not-executed.js +30 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -7
- package/dist/core/runner/tool-occurrence.js +5 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +1 -1
- package/dist/core/runner-deps.d.ts +43 -36
- package/dist/core/safety-merge-corpus.js +18 -2
- package/dist/core/secret-env.d.ts +88 -20
- package/dist/core/secret-env.js +192 -38
- package/dist/core/session-policy-store.d.ts +71 -16
- package/dist/core/session-policy-store.js +138 -28
- package/dist/core/session-reconcile.d.ts +4 -0
- package/dist/core/session-reconcile.js +2 -1
- package/dist/core/shell-read-silence.js +3 -32
- package/dist/core/side-query.d.ts +5 -3
- package/dist/core/skill-grant.d.ts +3 -2
- package/dist/core/skill-grant.js +17 -9
- package/dist/core/skills-directory.d.ts +31 -11
- package/dist/core/skills-directory.js +655 -104
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/task-event.d.ts +49 -3
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-result.d.ts +8 -0
- package/dist/core/task-spec.d.ts +20 -19
- package/dist/core/task-stream.d.ts +14 -4
- package/dist/core/tighten-task-spec.d.ts +4 -3
- package/dist/core/tighten-task-spec.js +2 -4
- package/dist/core/tool-check-reading.d.ts +74 -0
- package/dist/core/tool-check-reading.js +80 -0
- package/dist/core/tool-policy.d.ts +62 -18
- package/dist/core/tool-policy.js +86 -15
- package/dist/core/tool-registry.d.ts +20 -0
- package/dist/core/tool-registry.js +4 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +51 -32
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/unc-spelling.d.ts +10 -0
- package/dist/core/unc-spelling.js +3 -0
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-egress.js +4 -1
- package/dist/core/untrusted-text.d.ts +16 -0
- package/dist/core/untrusted-text.js +7 -2
- package/dist/core/user-attachment.d.ts +25 -4
- package/dist/core/user-attachment.js +63 -42
- package/dist/core/wiring-manifest.d.ts +18 -15
- package/dist/core/wiring-manifest.js +2 -2
- package/dist/engine/compaction/utils.js +1 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
- package/dist/engine/execution-env/symlink-chain.js +1 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -1
- package/dist/engine/harness/agent-harness.js +5 -4
- package/dist/engine/harness/types.d.ts +20 -16
- package/dist/engine/harness/types.js +7 -1
- package/dist/engine/llm/types.d.ts +12 -7
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +18 -6
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.js +3 -10
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/engine/session/session.js +4 -4
- package/dist/index.d.ts +33 -23
- package/dist/index.js +23 -15
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +2 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-spec.d.ts +4 -6
- package/dist/orchestration/run-spec.js +39 -63
- package/dist/orchestration/run-workflow-tool.js +1 -2
- package/dist/orchestration/workflow.d.ts +11 -3
- package/dist/orchestration/workflow.js +11 -2
- package/dist/prompt-assembly/artifact-store.d.ts +72 -56
- package/dist/prompt-assembly/artifact-store.js +60 -52
- package/dist/prompt-assembly/artifact.d.ts +90 -76
- package/dist/prompt-assembly/artifact.js +197 -145
- package/dist/prompt-assembly/assemble.d.ts +36 -29
- package/dist/prompt-assembly/assemble.js +34 -220
- package/dist/prompt-assembly/bands.d.ts +20 -0
- package/dist/prompt-assembly/bands.js +18 -0
- package/dist/prompt-assembly/catalog/constitution.d.ts +23 -0
- package/dist/prompt-assembly/catalog/constitution.js +69 -0
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +9 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +85 -0
- package/dist/prompt-assembly/catalog/index.d.ts +11 -0
- package/dist/prompt-assembly/catalog/index.js +60 -0
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/modes.d.ts +15 -0
- package/dist/prompt-assembly/catalog/modes.js +137 -0
- package/dist/prompt-assembly/catalog/role.d.ts +10 -0
- package/dist/prompt-assembly/catalog/role.js +157 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +138 -0
- package/dist/prompt-assembly/catalog/schema.js +25 -0
- package/dist/prompt-assembly/catalog/sections.d.ts +9 -0
- package/dist/prompt-assembly/catalog/sections.js +98 -0
- package/dist/prompt-assembly/catalog/team.d.ts +4 -0
- package/dist/prompt-assembly/catalog/team.js +258 -0
- package/dist/prompt-assembly/composer.d.ts +26 -28
- package/dist/prompt-assembly/composer.js +124 -46
- package/dist/prompt-assembly/epoch.d.ts +89 -79
- package/dist/prompt-assembly/epoch.js +115 -142
- package/dist/prompt-assembly/explain.d.ts +58 -34
- package/dist/prompt-assembly/explain.js +21 -24
- package/dist/prompt-assembly/overlay.d.ts +137 -0
- package/dist/prompt-assembly/overlay.js +339 -0
- package/dist/prompt-assembly/renderers.d.ts +21 -0
- package/dist/prompt-assembly/renderers.js +39 -0
- package/dist/prompt-assembly/section-usage.d.ts +3 -3
- package/dist/prompt-assembly/section-usage.js +1 -1
- package/dist/prompt-assembly/select.d.ts +71 -0
- package/dist/prompt-assembly/select.js +106 -0
- package/dist/prompt-assembly/sugar.d.ts +31 -0
- package/dist/prompt-assembly/sugar.js +20 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +3 -2
- package/dist/prompt-assembly/types.d.ts +45 -148
- package/dist/prompts/coordinator.d.ts +2 -21
- package/dist/prompts/coordinator.js +3 -255
- package/dist/prompts/cowork.d.ts +27 -16
- package/dist/prompts/cowork.js +2 -23
- package/dist/prompts/default.d.ts +38 -511
- package/dist/prompts/default.js +20 -288
- package/dist/prompts/supervisor.d.ts +6 -71
- package/dist/prompts/supervisor.js +6 -117
- package/dist/stores/file/permission-rule-store.d.ts +1 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/tools/artifact/artifact-tool.js +4 -3
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -5
- package/dist/tools/fs/dir-entries.d.ts +4 -2
- package/dist/tools/fs/dir-entries.js +16 -4
- package/dist/tools/fs/fs-bash.d.ts +1 -1
- package/dist/tools/fs/fs-bash.js +22 -11
- package/dist/tools/fs/fs-pdf.js +17 -13
- package/dist/tools/fs/fs-read.js +4 -3
- package/dist/tools/fs/fs-shared.d.ts +1 -10
- package/dist/tools/fs/fs-shared.js +3 -4
- package/dist/tools/fs/fs-write.js +2 -1
- package/dist/tools/fs/notebook.js +1 -1
- package/dist/tools/fs/pdf.d.ts +20 -10
- package/dist/tools/fs/pdf.js +19 -10
- package/dist/tools/fs/program-read-model.d.ts +68 -8
- package/dist/tools/fs/program-read-model.js +112 -33
- package/dist/tools/fs/program-read-model.rows.js +30 -10
- package/dist/tools/fs/read-deny-home.d.ts +25 -9
- package/dist/tools/fs/read-deny-home.js +28 -27
- package/dist/tools/fs/read-deny.d.ts +41 -11
- package/dist/tools/fs/read-deny.js +51 -5
- package/dist/tools/fs/safety.d.ts +4 -26
- package/dist/tools/fs/safety.js +10 -32
- package/dist/tools/fs/search.js +15 -10
- package/dist/tools/fs/shell-read-argv.d.ts +3 -2
- package/dist/tools/fs/shell-read-argv.js +118 -38
- package/dist/tools/fs/shell-read-establish.d.ts +5 -5
- package/dist/tools/fs/shell-read-establish.js +11 -61
- package/dist/tools/fs/shell-read-identity.js +6 -3
- package/dist/tools/fs/shell-read-judge.d.ts +13 -15
- package/dist/tools/fs/shell-read-judge.js +18 -4
- package/dist/tools/fs/shell-read-plan.d.ts +2 -2
- package/dist/tools/web.js +1 -1
- package/package.json +13 -1
- package/test/export-surface.snapshot.json +306 -103
- package/wire-changes/core@7.52.0.json +5859 -0
- package/wire-changes/core@7.53.0.json +1946 -0
- package/dist/core/hook-seats.d.ts +0 -66
- package/dist/core/hook-seats.js +0 -37
- package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
- package/dist/prompt-assembly/packs/sema-default.js +0 -147
- package/dist/prompts/simple-sections.d.ts +0 -58
- package/dist/prompts/simple-sections.js +0 -43
|
@@ -172,9 +172,18 @@ export interface OptionSpec {
|
|
|
172
172
|
* `date -s`), `executes` a command (`find -exec`), or `none` — neither, which the binary gate witnesses for every
|
|
173
173
|
* option that states it (the read-only form of a program admits only such options). Absent: not stated. */
|
|
174
174
|
readonly effect?: "writes" | "executes" | "none";
|
|
175
|
-
/** The option's value names a FILE the program reads its OPERANDS from (`find -files0-from`, `tar -T`)
|
|
176
|
-
* or opens is not in the command line
|
|
175
|
+
/** The option's value names a FILE the program reads its OPERANDS from (`find -files0-from`, `tar -T`) — or, a switch, says they
|
|
176
|
+
* arrive on its standard input (`ack -x`): what it walks or opens is not in the command line, so a segment that selects it has
|
|
177
|
+
* reads the station cannot establish ({@link deliversOperands}); the list file itself is a read like any other and meets the deny
|
|
178
|
+
* rows as itself. */
|
|
177
179
|
readonly delivers?: "operands";
|
|
180
|
+
/** The option's value is a PLACE the program's walk works in or compares (`tar -C DIR`, `diff --from-file=DIR`): a root of a
|
|
181
|
+
* recursive form, whichever way the value is spelled. Absent: a path value is a file the program READS (a config, ignore or
|
|
182
|
+
* exclusion file, an archive, a pattern file) or an entry it examines — judged as itself, never a root, so it does not count
|
|
183
|
+
* as the root the walk was given (`rg --ignore-file ig pat` walks `.`). A list the operands come from ({@link delivers}) is a
|
|
184
|
+
* root of a recursive form too, in either spelling: the program works on what the list names, not on the working directory
|
|
185
|
+
* (and, the names not being in the text, the segment is not vouched: {@link deliversOperands}). */
|
|
186
|
+
readonly walks?: true;
|
|
178
187
|
/** The option's value bounds the program's output, in bytes or in lines (`head -c` / `head -n`). */
|
|
179
188
|
readonly bounds?: "bytes" | "lines";
|
|
180
189
|
/** The option's value is what the row's LAST operand would otherwise be (`cp -t <dir>`), so every operand is an
|
|
@@ -236,6 +245,12 @@ export interface Grammar {
|
|
|
236
245
|
/** With no operand, this implementation walks the working directory (`grep -r pat`); absent, it walks nothing (it
|
|
237
246
|
* reads its standard input, or refuses to run). */
|
|
238
247
|
readonly walksCwdWithoutOperand?: true;
|
|
248
|
+
/** Whether this implementation reads an unambiguous PREFIX of a long option's name as that option (`getopt_long`, Perl's
|
|
249
|
+
* Getopt::Long: `grep --max 1`, `tar --dir d`). Absent = it does; `false` = only the exact name is an option and a prefix
|
|
250
|
+
* is an unrecognised flag that runs nothing (ripgrep's parser: `rg --ignore-f x` is an error while `rg --ignore` is the
|
|
251
|
+
* switch). Every reader that matches a long name against the table asks this one fact, so a name a row leaves undeclared is
|
|
252
|
+
* never read as the abbreviation of a declared one in a program that does not take abbreviations. */
|
|
253
|
+
readonly acceptsAbbreviations?: boolean;
|
|
239
254
|
/** The traditional FIRST-argument form `<sign><number><letters>` (`tail +0f`, `tail -1f`): the signs this
|
|
240
255
|
* implementation reads it with, and the option each letter names. */
|
|
241
256
|
readonly obsoleteFirst?: {
|
|
@@ -412,9 +427,11 @@ export declare function movesBaseByStack(name: string): boolean;
|
|
|
412
427
|
/** The LONG-OPTION name carried by a token (`--file=p` → `file`, `--reg` → `reg`); `undefined` for anything that is
|
|
413
428
|
* not a long option with a non-empty name (`--`, `--=x`, a short option). */
|
|
414
429
|
export declare function longOptionNameOf(tok: string): string | undefined;
|
|
415
|
-
/** Is `name` a spelling
|
|
416
|
-
*
|
|
417
|
-
|
|
430
|
+
/** Is `name` a spelling of the long option `full`? The exact name always; a proper prefix — an abbreviation — only where the
|
|
431
|
+
* program takes them (`accepts`: {@link Grammar.acceptsAbbreviations}, or {@link Merged.abbreviable} of a merged name). Every
|
|
432
|
+
* prefix counts there — `getopt_long`'s ambiguity is not modelled, and each caller makes that over-approximation land on its
|
|
433
|
+
* own safe side. This is the one place a long name is matched against another. */
|
|
434
|
+
export declare function isLongOptionSpellingOf(name: string, full: string, accepts: boolean): boolean;
|
|
418
435
|
/** The languages whose program text the read station parses (the rest is program text it does not read). */
|
|
419
436
|
export declare const READ_LANGUAGES: ReadonlySet<string>;
|
|
420
437
|
/**
|
|
@@ -472,6 +489,8 @@ export interface FirstOperandSlot {
|
|
|
472
489
|
readonly role: ArgRole;
|
|
473
490
|
readonly suppliedByLetters: string;
|
|
474
491
|
readonly suppliedByLongNames: readonly string[];
|
|
492
|
+
/** The long names of {@link suppliedByLongNames} a prefix of which supplies it too ({@link Grammar.acceptsAbbreviations}). */
|
|
493
|
+
readonly abbreviableLongNames: readonly string[];
|
|
475
494
|
/** The other letters that take a value in every implementation: in a cluster, the rest of the token is theirs. */
|
|
476
495
|
readonly valueLetters: string;
|
|
477
496
|
}
|
|
@@ -480,7 +499,7 @@ export declare function firstOperandSlot(row: ProgramRow | undefined, view?: Vie
|
|
|
480
499
|
* a letter that delivers the slot supplies it, and the first OTHER letter that takes a value owns the rest of the
|
|
481
500
|
* token (`grep -Dread x f`: `read` is `-D`'s value, its `e` delivers nothing); a letter the row does not declare is
|
|
482
501
|
* stepped over (it may be a switch), as digits are (grep's obsolete numeric context spec: `-2ebeta`). A long option
|
|
483
|
-
* supplies it by
|
|
502
|
+
* supplies it by its name, or by a prefix of it where the program takes abbreviations. Over-triggering makes the first operand a CHECKED path candidate, the safe side. */
|
|
484
503
|
export declare function suppliesFirstOperandSlot(slot: FirstOperandSlot, tok: string): boolean;
|
|
485
504
|
/** The row's options stand anywhere in its argv in every implementation (`find`'s predicates past its paths), so the
|
|
486
505
|
* "is a dash-word past the first operand still an option" ambiguity does not exist for it. */
|
|
@@ -544,6 +563,7 @@ type Event<R> =
|
|
|
544
563
|
readonly role: R;
|
|
545
564
|
readonly consumed: boolean;
|
|
546
565
|
readonly spec?: OptionSpec;
|
|
566
|
+
readonly unsettled?: true;
|
|
547
567
|
}
|
|
548
568
|
/** An operand, the `ordinal`-th. `slot` = the first-operand slot's role when the slot applies; `role` = the role the
|
|
549
569
|
* row declares for an operand at this position past the slot (a URL, a name it only examines); `dash` = the word is
|
|
@@ -559,13 +579,25 @@ type Event<R> =
|
|
|
559
579
|
export type ArgEvent = Event<ArgRole>;
|
|
560
580
|
export type ArgRoleEvent = Event<ArgRole | undefined>;
|
|
561
581
|
/** The candidate extraction's walk (the program word excluded). `firstOperandSlot: false` reads every operand as an
|
|
562
|
-
* ordinary one.
|
|
582
|
+
* ordinary one. `ownedValues`: a bare option of a traversing program that may take the NEXT word as its value
|
|
583
|
+
* ({@link bareOptionValueOf}) hands that word over as a value read both ways (`consumed: false`) — what the roots of a
|
|
584
|
+
* recursive form are read from. */
|
|
563
585
|
export declare function readArgs(row: ProgramRow | undefined, words: readonly ArgWord[], opts: {
|
|
564
586
|
readonly firstOperandSlot: boolean | "program-text";
|
|
587
|
+
readonly ownedValues?: true;
|
|
565
588
|
}): ArgEvent[];
|
|
566
589
|
/** The role walk: the SAME walk, every declared option read by its declared arity and role. What the binary gate
|
|
567
590
|
* predicts a binary opens is read off these events. */
|
|
568
591
|
export declare function readArgRoles(row: ProgramRow, args: readonly string[]): ArgRoleEvent[];
|
|
592
|
+
/**
|
|
593
|
+
* Does this invocation take the program's OPERANDS from a list file ({@link OptionSpec.delivers}: `ack --files-from LIST`,
|
|
594
|
+
* `tar -T LIST`, `find -files0-from LIST`)? What the program then walks or opens is written in a file this reading does not
|
|
595
|
+
* open — no root of it is in the command. The reading of a check that only ever refuses or asks ({@link selectedOptions} over the
|
|
596
|
+
* merged row: a word spelled as the option counts, an abbreviation that reaches it counts, a value spelled like it counts). The
|
|
597
|
+
* traditional key word is every letter of it an option — each value-taking letter takes one of the arguments that follow, in
|
|
598
|
+
* order, so none owns the rest of the word (`tar cfT out.tar list` takes `list` for `T`).
|
|
599
|
+
*/
|
|
600
|
+
export declare function deliversOperands(row: ProgramRow | undefined, args: readonly string[]): boolean;
|
|
569
601
|
/**
|
|
570
602
|
* Does this invocation walk its operands' subtrees AND hand back their CONTENTS? Detection over-approximates: a flag
|
|
571
603
|
* misread as recursive costs one ask, an under-read hides a traversal. A value-taking letter owns its value only where
|
|
@@ -596,6 +628,33 @@ export declare function declaresOption(row: ProgramRow, pred: (spec: OptionSpec)
|
|
|
596
628
|
* count must still see. getopt's cluster rule: the FIRST value-taking letter owns the rest of the token.
|
|
597
629
|
*/
|
|
598
630
|
export declare function takesSeparatedDatum(row: ProgramRow | undefined, tok: string): boolean;
|
|
631
|
+
/**
|
|
632
|
+
* The value the NEXT word may be, for an option token written BARE (no value attached) — the one place the "which word does this
|
|
633
|
+
* option own" question of a cluster or an optional count is answered. Each grammar of the row reads the token as getopt does (a
|
|
634
|
+
* cluster: a letter the row does not declare is a switch, the first value-taking letter owns the rest of the token, so the next
|
|
635
|
+
* word only when it ends the token; a long name: the name or, where the grammar takes abbreviations, any name it abbreviates,
|
|
636
|
+
* `--name=` carries its own value):
|
|
637
|
+
* · a REQUIRED value is the next word wherever the option is read — the extraction's slot reading fails to see it where the token
|
|
638
|
+
* is a cluster with a letter the row leaves undeclared (`rg -nA 2 pat`: rg / ag / ack declare no switches), and `tok` is then
|
|
639
|
+
* read the speculative way;
|
|
640
|
+
* · an OPTIONAL count (the value only attached) is the next word to a parser that reads an optional integer (Getopt::Long's `:i`:
|
|
641
|
+
* ack's `-A` / `-B` / `-C`) or a required one (GNU grep's `--context`) when that word is spelled like a count, and an operand to
|
|
642
|
+
* a parser that reads it attached-only (getopt_long's optional argument: ag's long names, BSD grep) — the row files it
|
|
643
|
+
* attached-only, the reading that consumes nothing.
|
|
644
|
+
* · a long name the row declares NOWHERE (not as a name, nor — in a grammar that takes abbreviations — as the abbreviation of one)
|
|
645
|
+
* may take the next word: the row cannot say it does not (`rg --hostname-bin x pat`, whose option runs a program, is left
|
|
646
|
+
* undeclared on purpose; `rg --ignore pat sub`, a switch of rg that is no abbreviation of `--ignore-file` there) — the word's value role is
|
|
647
|
+
* {@link UNDECLARED_VALUE}, no more than "names no file", as it is also read as whatever it is on its own. A long name with its
|
|
648
|
+
* value attached owns nothing, and one the row declares as a switch owns nothing.
|
|
649
|
+
* A SHORT letter the row leaves undeclared owns no word: the rows of rg / ag / ack declare no switches, so every word behind `-i`
|
|
650
|
+
* would otherwise be one — the letter is read as the switch it is in rg (whose table of value letters is complete). The extraction
|
|
651
|
+
* reads the word both ways (`consumed: false` — as the value, and as whatever it is on its own). Served to the contents walkers
|
|
652
|
+
* (`readArgs` `ownedValues`), whose rows carry no single-dash WORD options (`find -name`): a cluster here is always letters.
|
|
653
|
+
*/
|
|
654
|
+
export declare function bareOptionValueOf(row: ProgramRow, tok: string, next: string | undefined): {
|
|
655
|
+
readonly role: ArgRole;
|
|
656
|
+
readonly spec?: OptionSpec;
|
|
657
|
+
} | undefined;
|
|
599
658
|
/**
|
|
600
659
|
* Does this option word carry, ATTACHED, the value `-` for an option whose value is a file the program opens or names
|
|
601
660
|
* (`grep -f-`, `diff --from-file=-`, `diff -X-`) — or for a spelling the row does not account for? Such a word makes the
|
|
@@ -623,7 +682,8 @@ interface OptionScan {
|
|
|
623
682
|
* Every option spec an argv selects. A short cluster is read as getopt reads it, scanning left to right: a declared
|
|
624
683
|
* letter is selected; a value-taking letter owns the rest of the token (and the next word, when it ends the token); a
|
|
625
684
|
* letter the row does not declare is read as a switch and the scan goes on. A long option is every name its spelling
|
|
626
|
-
* can abbreviate (the exact name alone where there is one
|
|
685
|
+
* can abbreviate where the grammar takes abbreviations (the exact name alone where there is one, and always in a grammar
|
|
686
|
+
* that takes none); a dash word its exact name. Two readings:
|
|
627
687
|
* · over ONE implementation's view ({@link implementationsOf}): what that program selects — a separated value is
|
|
628
688
|
* stepped over, `--` ends the options, and so does the first operand where the grammar stops there;
|
|
629
689
|
* · over the row (every implementation merged): every word is read as the option it SPELLS — a value spelled like an
|
|
@@ -77,8 +77,9 @@ export function longOptionNameOf(tok) {
|
|
|
77
77
|
const name = eq >= 0 ? body.slice(0, eq) : body;
|
|
78
78
|
return name.length > 0 ? name : undefined;
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const abbreviates = (g) => g.acceptsAbbreviations !== false;
|
|
81
|
+
export function isLongOptionSpellingOf(name, full, accepts) {
|
|
82
|
+
return full === name || (accepts && full.startsWith(name));
|
|
82
83
|
}
|
|
83
84
|
const MERGED = new WeakMap();
|
|
84
85
|
function mergedTable(row, table) {
|
|
@@ -93,10 +94,11 @@ function mergedTable(row, table) {
|
|
|
93
94
|
const out = new Map();
|
|
94
95
|
const names = new Set(row.grammars.flatMap((g) => Object.keys(g[table] ?? {})));
|
|
95
96
|
for (const name of names) {
|
|
96
|
-
const
|
|
97
|
+
const declaring = row.grammars.filter((g) => g[table]?.[name] !== undefined);
|
|
98
|
+
const specs = declaring.map((g) => g[table][name]);
|
|
97
99
|
const arities = new Set(specs.map((s) => s.arity));
|
|
98
100
|
const widest = specs.reduce((a, b) => (roleRank(b.value) > roleRank(a.value) ? b : a));
|
|
99
|
-
out.set(name, { arity: arities.size === 1 ? specs[0].arity : "disputed", spec: widest, takesValueEverywhere: specs.every((s) => s.arity === 1), ownsRestEverywhere: specs.every((s) => s.arity !== 0), takesValueSomewhere: specs.some((s) => s.arity === 1) });
|
|
101
|
+
out.set(name, { arity: arities.size === 1 ? specs[0].arity : "disputed", spec: widest, takesValueEverywhere: specs.every((s) => s.arity === 1), ownsRestEverywhere: specs.every((s) => s.arity !== 0), takesValueSomewhere: specs.some((s) => s.arity === 1), abbreviable: declaring.some(abbreviates) });
|
|
100
102
|
}
|
|
101
103
|
byTable.set(table, out);
|
|
102
104
|
return out;
|
|
@@ -141,27 +143,28 @@ function viewTable(row, table, view) {
|
|
|
141
143
|
for (const [name, m] of mergedTable(row, table)) {
|
|
142
144
|
const role = m.spec.value;
|
|
143
145
|
const spec = m.spec;
|
|
146
|
+
const abbreviable = m.abbreviable;
|
|
144
147
|
if (view === "roles") {
|
|
145
148
|
if (m.arity === 0)
|
|
146
|
-
out.set(name, { arity: 0, spec });
|
|
149
|
+
out.set(name, { arity: 0, spec, abbreviable });
|
|
147
150
|
else if (m.arity === 1)
|
|
148
|
-
out.set(name, { arity: 1, spec, ...(role !== undefined ? { role } : {}) });
|
|
151
|
+
out.set(name, { arity: 1, spec, abbreviable, ...(role !== undefined ? { role } : {}) });
|
|
149
152
|
else if (m.arity === "suffix")
|
|
150
|
-
out.set(name, { arity: "suffix", spec, ...(role !== undefined ? { role } : {}) });
|
|
153
|
+
out.set(name, { arity: "suffix", spec, abbreviable, ...(role !== undefined ? { role } : {}) });
|
|
151
154
|
else if (m.arity === "attached" || (m.arity === "disputed" && table === "long"))
|
|
152
|
-
out.set(name, { arity: "attached", spec, ...(role !== undefined ? { role } : {}) });
|
|
155
|
+
out.set(name, { arity: "attached", spec, abbreviable, ...(role !== undefined ? { role } : {}) });
|
|
153
156
|
continue;
|
|
154
157
|
}
|
|
155
158
|
if (m.arity === 0)
|
|
156
|
-
out.set(name, { arity: 0, spec });
|
|
159
|
+
out.set(name, { arity: 0, spec, abbreviable });
|
|
157
160
|
else if (m.arity === "disputed") {
|
|
158
161
|
if (table === "long" && preciseRole(role))
|
|
159
|
-
out.set(name, { arity: "attached", role: role, spec });
|
|
162
|
+
out.set(name, { arity: "attached", role: role, spec, abbreviable });
|
|
160
163
|
}
|
|
161
164
|
else if (m.arity === 1 && preciseRole(role))
|
|
162
|
-
out.set(name, { arity: 1, role: role, spec });
|
|
165
|
+
out.set(name, { arity: 1, role: role, spec, abbreviable });
|
|
163
166
|
else if (m.arity === "attached" && table === "long" && preciseRole(role))
|
|
164
|
-
out.set(name, { arity: "attached", role: role, spec });
|
|
167
|
+
out.set(name, { arity: "attached", role: role, spec, abbreviable });
|
|
165
168
|
}
|
|
166
169
|
return out;
|
|
167
170
|
}
|
|
@@ -184,7 +187,7 @@ function readOptionIn(row, tok, view, next) {
|
|
|
184
187
|
return attached !== undefined ? { form: "attached", value: attached, role: exact.role, spec: exact.spec } : { form: "no-value" };
|
|
185
188
|
return attached === undefined ? { form: "no-value" } : { form: "unexplained" };
|
|
186
189
|
}
|
|
187
|
-
const reach = [...longs.entries()].filter(([full]) =>
|
|
190
|
+
const reach = [...longs.entries()].filter(([full, s]) => isLongOptionSpellingOf(long, full, s.abbreviable));
|
|
188
191
|
const valueNames = reach.filter(([, s]) => s.arity === 1 || (attached !== undefined && s.arity === "attached"));
|
|
189
192
|
const plainNames = reach.filter(([, s]) => s.arity === 0 || (attached === undefined && s.arity === "attached"));
|
|
190
193
|
if (valueNames.length === 0)
|
|
@@ -247,13 +250,13 @@ export function firstOperandSlot(row, view = "candidates") {
|
|
|
247
250
|
const shorts = [...mergedTable(row, "short")];
|
|
248
251
|
const letters = shorts.filter(([, m]) => m.spec.fillsSlot === true).map(([l]) => l).join("");
|
|
249
252
|
const valueLetters = shorts.filter(([, m]) => m.spec.fillsSlot !== true && m.ownsRestEverywhere).map(([l]) => l).join("");
|
|
250
|
-
const
|
|
251
|
-
return { role, suppliedByLetters: letters, suppliedByLongNames:
|
|
253
|
+
const supplying = [...mergedTable(row, "long")].filter(([, m]) => m.spec.fillsSlot === true);
|
|
254
|
+
return { role, suppliedByLetters: letters, suppliedByLongNames: supplying.map(([n]) => n), abbreviableLongNames: supplying.filter(([, m]) => m.abbreviable).map(([n]) => n), valueLetters };
|
|
252
255
|
}
|
|
253
256
|
export function suppliesFirstOperandSlot(slot, tok) {
|
|
254
257
|
if (tok.startsWith("--")) {
|
|
255
258
|
const long = longOptionNameOf(tok);
|
|
256
|
-
return long !== undefined && slot.suppliedByLongNames.some((full) =>
|
|
259
|
+
return long !== undefined && slot.suppliedByLongNames.some((full) => isLongOptionSpellingOf(long, full, slot.abbreviableLongNames.includes(full)));
|
|
257
260
|
}
|
|
258
261
|
if (!tok.startsWith("-"))
|
|
259
262
|
return false;
|
|
@@ -442,11 +445,16 @@ export function objectPathsOf(value) {
|
|
|
442
445
|
}
|
|
443
446
|
return out;
|
|
444
447
|
}
|
|
445
|
-
function walkArgs(row, words, readOption, slot, readsRole) {
|
|
448
|
+
function walkArgs(row, words, readOption, slot, readsRole, ownedValue) {
|
|
446
449
|
const out = [];
|
|
450
|
+
const valueAt = new Set();
|
|
447
451
|
const folded = words.map((w) => w.folded);
|
|
448
|
-
const
|
|
449
|
-
const
|
|
452
|
+
const unsettling = (at, anyOption) => (folded[at] === "--" || (anyOption && folded[at].startsWith("-") && folded[at] !== "-") ? { unsettled: true } : {});
|
|
453
|
+
const plain = slot === undefined ? [] : walkArgs(row, words, readOption, undefined, readsRole);
|
|
454
|
+
const eoo = plain.find((e) => e.kind === "end-of-options")?.at ?? -1;
|
|
455
|
+
const operandsPast = new Set(plain.flatMap((e) => (e.kind === "dash-word-operand" ? [e.at] : [])));
|
|
456
|
+
const notOptions = new Set(plain.flatMap((e) => (e.kind === "value" && (e.consumed || operandsPast.has(e.of)) ? [e.at] : [])));
|
|
457
|
+
const slotSupplied = slot !== undefined && folded.some((t, k) => (eoo === -1 || k < eoo) && !notOptions.has(k) && suppliesFirstOperandSlot(slot, t));
|
|
450
458
|
const permutes = !optionsStandAnywhere(row);
|
|
451
459
|
const dashRead = row?.operands?.dash === "file" ? "file" : "stdin";
|
|
452
460
|
const plus = row?.grammars.some((g) => g.plusOptions === true) === true;
|
|
@@ -467,11 +475,21 @@ function walkArgs(row, words, readOption, slot, readsRole) {
|
|
|
467
475
|
const both = sawOperand && permutes;
|
|
468
476
|
if (both) {
|
|
469
477
|
out.push({ kind: "dash-word-operand", at: k });
|
|
470
|
-
if (r.form === "separated" && k + 1 < words.length)
|
|
471
|
-
out.push({ kind: "value", at: k + 1, of: k, role: r.role, consumed: false, ...(r.spec !== undefined ? { spec: r.spec } : {}) });
|
|
478
|
+
if (r.form === "separated" && k + 1 < words.length) {
|
|
479
|
+
out.push({ kind: "value", at: k + 1, of: k, role: r.role, consumed: false, ...(r.spec !== undefined ? { spec: r.spec } : {}), ...unsettling(k + 1, false) });
|
|
480
|
+
valueAt.add(k + 1);
|
|
481
|
+
}
|
|
472
482
|
}
|
|
483
|
+
const owned = r.form === "no-value" || r.form === "unexplained" ? (valueAt.has(k) ? undefined : ownedValue?.(t, folded[k + 1])) : undefined;
|
|
484
|
+
const maybeValue = () => {
|
|
485
|
+
if (owned !== undefined && k + 1 < words.length) {
|
|
486
|
+
out.push({ kind: "value", at: k + 1, of: k, role: owned.role, consumed: false, ...(owned.spec !== undefined ? { spec: owned.spec } : {}), ...unsettling(k + 1, true) });
|
|
487
|
+
valueAt.add(k + 1);
|
|
488
|
+
}
|
|
489
|
+
};
|
|
473
490
|
if (r.form === "no-value") {
|
|
474
491
|
out.push({ kind: "option", at: k, reading: "no-value" });
|
|
492
|
+
maybeValue();
|
|
475
493
|
continue;
|
|
476
494
|
}
|
|
477
495
|
if (r.form === "attached") {
|
|
@@ -485,6 +503,7 @@ function walkArgs(row, words, readOption, slot, readsRole) {
|
|
|
485
503
|
continue;
|
|
486
504
|
}
|
|
487
505
|
out.push({ kind: "option", at: k, reading: "speculative" });
|
|
506
|
+
maybeValue();
|
|
488
507
|
continue;
|
|
489
508
|
}
|
|
490
509
|
const inSlot = slot !== undefined && !slotSupplied && !sawOperand;
|
|
@@ -497,11 +516,34 @@ function walkArgs(row, words, readOption, slot, readsRole) {
|
|
|
497
516
|
}
|
|
498
517
|
export function readArgs(row, words, opts) {
|
|
499
518
|
const slot = opts.firstOperandSlot === false ? undefined : firstOperandSlot(row);
|
|
500
|
-
|
|
519
|
+
const owned = opts.ownedValues === true && row?.traversal?.discloses === "contents"
|
|
520
|
+
? (tok, next) => {
|
|
521
|
+
const v = bareOptionValueOf(row, tok, next);
|
|
522
|
+
return v !== undefined && preciseRole(v.role) ? v : undefined;
|
|
523
|
+
}
|
|
524
|
+
: undefined;
|
|
525
|
+
return walkArgs(row, words, (tok) => readOptionSlot(row, tok), opts.firstOperandSlot === "program-text" && slot?.role.kind !== "program-text" ? undefined : slot, preciseRole, owned);
|
|
501
526
|
}
|
|
502
527
|
export function readArgRoles(row, args) {
|
|
503
528
|
return walkArgs(row, args.map((folded) => ({ folded })), (tok, next) => readOptionRole(row, tok, next), firstOperandSlot(row, "roles"), () => true);
|
|
504
529
|
}
|
|
530
|
+
function keyWordIndex(row, args) {
|
|
531
|
+
if (row.traversal?.keyWordLetters === undefined)
|
|
532
|
+
return undefined;
|
|
533
|
+
const at = args.findIndex((t) => t.length > 0);
|
|
534
|
+
return at >= 0 && /^[A-Za-z]+$/.test(args[at]) ? at : undefined;
|
|
535
|
+
}
|
|
536
|
+
export function deliversOperands(row, args) {
|
|
537
|
+
if (row === undefined)
|
|
538
|
+
return false;
|
|
539
|
+
const key = keyWordIndex(row, args);
|
|
540
|
+
if (key !== undefined) {
|
|
541
|
+
const shorts = mergedTable(row, "short");
|
|
542
|
+
if ([...args[key]].some((ch) => shorts.get(ch)?.spec.delivers === "operands"))
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
return selectedOptions(row, key === undefined ? args : args.filter((_, k) => k !== key)).some((s) => s.delivers === "operands");
|
|
546
|
+
}
|
|
505
547
|
export function selectsContentsTraversal(row, args) {
|
|
506
548
|
const model = row?.traversal;
|
|
507
549
|
if (row === undefined || model === undefined || model.discloses !== "contents")
|
|
@@ -509,8 +551,8 @@ export function selectsContentsTraversal(row, args) {
|
|
|
509
551
|
if (model.always === true)
|
|
510
552
|
return true;
|
|
511
553
|
if (model.keyWordLetters !== undefined) {
|
|
512
|
-
const
|
|
513
|
-
if (
|
|
554
|
+
const at = keyWordIndex(row, args);
|
|
555
|
+
if (at !== undefined && [...args[at]].some((ch) => model.keyWordLetters.includes(ch)))
|
|
514
556
|
return true;
|
|
515
557
|
}
|
|
516
558
|
const shorts = mergedTable(row, "short");
|
|
@@ -531,11 +573,11 @@ export function selectsContentsTraversal(row, args) {
|
|
|
531
573
|
const long = longOptionNameOf(t);
|
|
532
574
|
if (long === undefined)
|
|
533
575
|
continue;
|
|
534
|
-
if ([...longs].some(([full, m]) => m.spec.selects === "traversal" &&
|
|
576
|
+
if ([...longs].some(([full, m]) => m.spec.selects === "traversal" && isLongOptionSpellingOf(long, full, m.abbreviable)))
|
|
535
577
|
return true;
|
|
536
578
|
for (const [full, m] of longs) {
|
|
537
579
|
const recursive = m.spec.selectsWhenValue;
|
|
538
|
-
if (recursive === undefined || !
|
|
580
|
+
if (recursive === undefined || !isLongOptionSpellingOf(long, full, m.abbreviable))
|
|
539
581
|
continue;
|
|
540
582
|
const eq = t.indexOf("=");
|
|
541
583
|
const v = eq >= 0 ? t.slice(eq + 1) : args[k + 1];
|
|
@@ -580,7 +622,7 @@ export function valuesAreLiteral(row, args) {
|
|
|
580
622
|
const longs = mergedTable(row, "long");
|
|
581
623
|
const negates = (t) => {
|
|
582
624
|
const name = t.startsWith("--no-") ? longOptionNameOf(t)?.slice(3) : undefined;
|
|
583
|
-
return name !== undefined && name.length > 0 && [...longs].some(([full, m]) => m.spec.literalValues === true &&
|
|
625
|
+
return name !== undefined && name.length > 0 && [...longs].some(([full, m]) => m.spec.literalValues === true && isLongOptionSpellingOf(name, full, m.abbreviable));
|
|
584
626
|
};
|
|
585
627
|
if (args.some(negates))
|
|
586
628
|
return false;
|
|
@@ -599,7 +641,7 @@ export function valuesAreLiteral(row, args) {
|
|
|
599
641
|
if (long === undefined || t.includes("="))
|
|
600
642
|
continue;
|
|
601
643
|
const exact = longs.get(long);
|
|
602
|
-
const hits = exact !== undefined ? [exact] : [...longs].filter(([full]) =>
|
|
644
|
+
const hits = exact !== undefined ? [exact] : [...longs].filter(([full, m]) => isLongOptionSpellingOf(long, full, m.abbreviable)).map(([, m]) => m);
|
|
603
645
|
if (hits.length === 1 && hits[0].spec.literalValues === true)
|
|
604
646
|
return true;
|
|
605
647
|
continue;
|
|
@@ -629,7 +671,7 @@ export function takesSeparatedDatum(row, tok) {
|
|
|
629
671
|
if (tok.includes("="))
|
|
630
672
|
return false;
|
|
631
673
|
const name = longOptionNameOf(tok);
|
|
632
|
-
return name !== undefined && [...mergedTable(row, "long")].some(([full, m]) =>
|
|
674
|
+
return name !== undefined && [...mergedTable(row, "long")].some(([full, m]) => isLongOptionSpellingOf(name, full, m.abbreviable) && m.takesValueSomewhere && isDatumValue(m));
|
|
633
675
|
}
|
|
634
676
|
if (!/^-[A-Za-z0-9]/.test(tok))
|
|
635
677
|
return false;
|
|
@@ -644,6 +686,43 @@ export function takesSeparatedDatum(row, tok) {
|
|
|
644
686
|
}
|
|
645
687
|
return false;
|
|
646
688
|
}
|
|
689
|
+
const COUNT_SPELLING = /^[+-]?[0-9_]+$/;
|
|
690
|
+
const UNDECLARED_VALUE = { kind: "datum", form: "label" };
|
|
691
|
+
export function bareOptionValueOf(row, tok, next) {
|
|
692
|
+
if (next === undefined || !tok.startsWith("-") || tok === "-" || tok === "--")
|
|
693
|
+
return undefined;
|
|
694
|
+
if (tok.startsWith("--") && !tok.includes("=")) {
|
|
695
|
+
const name = longOptionNameOf(tok);
|
|
696
|
+
if (name !== undefined && ![...mergedTable(row, "long")].some(([full, m]) => isLongOptionSpellingOf(name, full, m.abbreviable)))
|
|
697
|
+
return { role: UNDECLARED_VALUE };
|
|
698
|
+
}
|
|
699
|
+
const owns = (s) => s.value !== undefined && (s.arity === 1 || (s.arity === "attached" && s.value.kind === "datum" && s.value.form === "count" && COUNT_SPELLING.test(next)));
|
|
700
|
+
for (const g of row.grammars) {
|
|
701
|
+
let found;
|
|
702
|
+
if (tok.startsWith("--")) {
|
|
703
|
+
const name = longOptionNameOf(tok);
|
|
704
|
+
if (name === undefined || tok.includes("="))
|
|
705
|
+
continue;
|
|
706
|
+
const exact = g.long[name];
|
|
707
|
+
const reach = exact !== undefined ? [exact] : Object.entries(g.long).filter(([full]) => isLongOptionSpellingOf(name, full, abbreviates(g))).map(([, s]) => s);
|
|
708
|
+
if (reach.length > 0 && reach.every(owns))
|
|
709
|
+
found = reach[0];
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
for (let i = 1; i < tok.length; i++) {
|
|
713
|
+
const spec = g.short[tok[i]];
|
|
714
|
+
if (spec === undefined || spec.arity === 0)
|
|
715
|
+
continue;
|
|
716
|
+
if (i === tok.length - 1 && owns(spec))
|
|
717
|
+
found = spec;
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
if (found?.value !== undefined)
|
|
722
|
+
return { role: found.value, spec: found };
|
|
723
|
+
}
|
|
724
|
+
return undefined;
|
|
725
|
+
}
|
|
647
726
|
export function attachedStdinFile(row, tok) {
|
|
648
727
|
if (row === undefined)
|
|
649
728
|
return false;
|
|
@@ -654,7 +733,7 @@ export function attachedStdinFile(row, tok) {
|
|
|
654
733
|
return false;
|
|
655
734
|
const longs = mergedTable(row, "long");
|
|
656
735
|
const exact = longs.get(name);
|
|
657
|
-
const reach = exact !== undefined ? [exact] : [...longs].filter(([full]) =>
|
|
736
|
+
const reach = exact !== undefined ? [exact] : [...longs].filter(([full, m]) => isLongOptionSpellingOf(name, full, m.abbreviable)).map(([, m]) => m);
|
|
658
737
|
return reach.length === 0 || reach.some((m) => m.arity !== 0 && isFileValue(m.spec));
|
|
659
738
|
}
|
|
660
739
|
if (!/^-[A-Za-z0-9]/.test(tok))
|
|
@@ -747,7 +826,7 @@ function scanOptions(row, args, one) {
|
|
|
747
826
|
continue;
|
|
748
827
|
const eq = t.indexOf("=");
|
|
749
828
|
const exact = longs.get(name);
|
|
750
|
-
const hits = exact !== undefined ? [[name, exact]] : [...longs].filter(([full]) =>
|
|
829
|
+
const hits = exact !== undefined ? [[name, exact]] : [...longs].filter(([full, m]) => isLongOptionSpellingOf(name, full, m.abbreviable));
|
|
751
830
|
for (const [full, m] of hits)
|
|
752
831
|
select(m.spec, `--${full}`);
|
|
753
832
|
const [full, only] = hits[0] ?? [];
|
|
@@ -1173,7 +1252,7 @@ function programTextUnder(g, args) {
|
|
|
1173
1252
|
let endOfOptions = false;
|
|
1174
1253
|
let firstOperand;
|
|
1175
1254
|
const longs = Object.entries(g.long);
|
|
1176
|
-
const reach = (long, pick) => longs.some(([full, s]) => pick(s) &&
|
|
1255
|
+
const reach = (long, pick) => longs.some(([full, s]) => pick(s) && isLongOptionSpellingOf(long, full, abbreviates(g)));
|
|
1177
1256
|
for (let k = 0; k < args.length; k++) {
|
|
1178
1257
|
const tok = args[k];
|
|
1179
1258
|
if (!endOfOptions && tok === "--") {
|
|
@@ -1318,7 +1397,7 @@ export function messageWords(program, words, programIndex) {
|
|
|
1318
1397
|
if (w.startsWith("--")) {
|
|
1319
1398
|
const eq = w.indexOf("=");
|
|
1320
1399
|
const name = w.slice(2, eq < 0 ? undefined : eq);
|
|
1321
|
-
const takers = longValues.filter(([n]) => n
|
|
1400
|
+
const takers = longValues.filter(([n]) => isLongOptionSpellingOf(name, n, abbreviates(sub)));
|
|
1322
1401
|
const message = (name.length > 0 && takers.length > 0 && takers.every(([, s]) => isMessage(s))) || isMessage(sub.long[name]);
|
|
1323
1402
|
if (eq >= 0) {
|
|
1324
1403
|
if (message)
|
|
@@ -32,6 +32,7 @@ const MOUNT = { kind: "mount-source", form: "mount" };
|
|
|
32
32
|
const OBJECT_PATH = { kind: "object-path" };
|
|
33
33
|
const text = (language) => ({ kind: "program-text", language });
|
|
34
34
|
const file = (language) => ({ kind: "program-file", language });
|
|
35
|
+
const WALKS = { walks: true };
|
|
35
36
|
const SWITCH = { arity: 0 };
|
|
36
37
|
const QUERY = { arity: 0, mode: "queries" };
|
|
37
38
|
const val = (value, extra = {}) => ({ arity: 1, ...(value !== undefined ? { value } : {}), ...extra });
|
|
@@ -114,9 +115,9 @@ const grepRow = (key) => ({
|
|
|
114
115
|
});
|
|
115
116
|
const diff = {
|
|
116
117
|
key: "diff",
|
|
117
|
-
grammars: implementations(grammar({ C: val(COUNT), D: val(LABEL), F: val(PATTERN), I: val(PATTERN), L: val(LABEL), S: val(
|
|
118
|
-
exclude: val(NAME_PATTERN), "exclude-from": val(READ), "from-file": val(READ), "horizon-lines": val(COUNT), ifdef: val(LABEL), "ignore-matching-lines": val(PATTERN),
|
|
119
|
-
label: val(LABEL), "show-function-line": val(PATTERN), "starting-file": val(
|
|
118
|
+
grammars: implementations(grammar({ C: val(COUNT), D: val(LABEL), F: val(PATTERN), I: val(PATTERN), L: val(LABEL), S: val(NAME_PATTERN), U: val(COUNT), W: val(COUNT), X: val(READ), x: val(NAME_PATTERN), ...switches("abBcdeEHilnNpqstTuvwyZ"), ...switches("r", { selects: "traversal" }) }, {
|
|
119
|
+
exclude: val(NAME_PATTERN), "exclude-from": val(READ), "from-file": val(READ, WALKS), "horizon-lines": val(COUNT), ifdef: val(LABEL), "ignore-matching-lines": val(PATTERN),
|
|
120
|
+
label: val(LABEL), "show-function-line": val(PATTERN), "starting-file": val(NAME_PATTERN), tabsize: val(COUNT), "to-file": val(READ, WALKS), width: val(COUNT),
|
|
120
121
|
color: optional(LABEL), context: optional(COUNT), unified: optional(COUNT),
|
|
121
122
|
...longSwitches(["brief", "ed", "expand-tabs", "ignore-all-space", "ignore-blank-lines", "ignore-case", "ignore-space-change", "ignore-tab-expansion", "ignore-trailing-space", "initial-tab", "minimal", "new-file", "normal", "paginate", "report-identical-files", "rcs", "show-c-function", "side-by-side", "speed-large-files", "suppress-blank-empty", "text"]), ...BANNERS,
|
|
122
123
|
...longSwitches(["recursive"], { selects: "traversal" }),
|
|
@@ -163,8 +164,8 @@ const date = {
|
|
|
163
164
|
};
|
|
164
165
|
const tar = {
|
|
165
166
|
key: "tar",
|
|
166
|
-
grammars: [grammar({ b: val(COUNT), C: val(NAMES), f: val(READ), T: val(READ, { delivers: "operands" }), X: val(READ), g: val(), ...switches("adhjJkmOpPStvwWxzZ"), ...switches("cru", { selects: "traversal" }) }, {
|
|
167
|
-
"blocking-factor": val(COUNT), directory: val(NAMES), exclude: val(NAME_PATTERN), "exclude-from": val(READ), file: val(READ), "files-from": val(READ, { delivers: "operands" }), "strip-components": val(COUNT),
|
|
167
|
+
grammars: [grammar({ b: val(COUNT), C: val(NAMES, WALKS), f: val(READ), T: val(READ, { delivers: "operands" }), X: val(READ), g: val(), ...switches("adhjJkmOpPStvwWxzZ"), ...switches("cru", { selects: "traversal" }) }, {
|
|
168
|
+
"blocking-factor": val(COUNT), directory: val(NAMES, WALKS), exclude: val(NAME_PATTERN), "exclude-from": val(READ), file: val(READ), "files-from": val(READ, { delivers: "operands" }), "strip-components": val(COUNT),
|
|
168
169
|
...longSwitches(["absolute-names", "dereference", "extract", "get", "interactive", "keep-old-files", "list", "preserve-permissions", "sparse", "to-stdout", "touch", "verbose", "verify"]), ...BANNERS,
|
|
169
170
|
...longSwitches(["append", "create", "update"], { selects: "traversal" }),
|
|
170
171
|
})],
|
|
@@ -230,13 +231,32 @@ const ls = {
|
|
|
230
231
|
traversal: { discloses: "names" },
|
|
231
232
|
witness: BINARY,
|
|
232
233
|
};
|
|
233
|
-
const
|
|
234
|
+
const namesWalker = (key) => ({ key, grammars: [], operands: { dash: "file", rest: NAMES }, traversal: { discloses: "names", always: true }, witness: BINARY });
|
|
235
|
+
const contentsWalker = (key, short, long, extra = {}) => ({
|
|
234
236
|
key,
|
|
235
|
-
grammars:
|
|
236
|
-
|
|
237
|
-
traversal: { discloses, always: true },
|
|
237
|
+
grammars: [grammar(short, long, { walksCwdWithoutOperand: true, ...extra })],
|
|
238
|
+
operands: { positional: [PATTERN] },
|
|
239
|
+
traversal: { discloses: "contents", always: true },
|
|
238
240
|
witness: BINARY,
|
|
239
241
|
});
|
|
242
|
+
const rg = contentsWalker("rg", { e: val(PATTERN, { fillsSlot: true }), f: val(READ, { fillsSlot: true }), ...values("ABCdjmM", COUNT), ...values("ErtT", LABEL), g: val(NAME_PATTERN) }, {
|
|
243
|
+
regexp: val(PATTERN, { fillsSlot: true }), file: val(READ, { fillsSlot: true }),
|
|
244
|
+
files: { arity: 0, fillsSlot: true },
|
|
245
|
+
...Object.fromEntries(["after-context", "before-context", "context", "max-count", "max-depth", "max-columns", "threads"].map((n) => [n, val(COUNT)])),
|
|
246
|
+
...Object.fromEntries(["color", "colors", "context-separator", "dfa-size-limit", "encoding", "engine", "field-context-separator", "field-match-separator", "generate", "hyperlink-format", "max-filesize", "path-separator", "regex-size-limit", "replace", "sort", "sortr", "type", "type-add", "type-clear", "type-not"].map((n) => [n, val(LABEL)])),
|
|
247
|
+
glob: val(NAME_PATTERN), iglob: val(NAME_PATTERN), "pre-glob": val(NAME_PATTERN), "ignore-file": val(READ),
|
|
248
|
+
...BANNERS,
|
|
249
|
+
}, { acceptsAbbreviations: false });
|
|
250
|
+
const ag = contentsWalker("ag", { g: val(PATTERN, { fillsSlot: true }), G: val(PATTERN), m: val(COUNT), p: val(READ), A: val(COUNT), B: val(COUNT), C: val(COUNT) }, {
|
|
251
|
+
"file-search-regex": val(PATTERN), "max-count": val(COUNT), "path-to-ignore": val(READ),
|
|
252
|
+
after: optional(COUNT), before: optional(COUNT), context: optional(COUNT),
|
|
253
|
+
...BANNERS,
|
|
254
|
+
});
|
|
255
|
+
const ack = contentsWalker("ack", { f: { arity: 0, fillsSlot: true }, m: val(COUNT), A: optional(COUNT), B: optional(COUNT), C: optional(COUNT), x: { arity: 0, delivers: "operands" } }, {
|
|
256
|
+
match: val(PATTERN, { fillsSlot: true }), "max-count": val(COUNT), ackrc: val(READ), "files-from": val(READ, { delivers: "operands" }),
|
|
257
|
+
"after-context": optional(COUNT), "before-context": optional(COUNT), context: optional(COUNT),
|
|
258
|
+
...BANNERS,
|
|
259
|
+
});
|
|
240
260
|
const BANNER_LONGS = ["--version", "--help", "--usage", "-version", "-help"];
|
|
241
261
|
function interpreterGrammar(language, g) {
|
|
242
262
|
const short = {};
|
|
@@ -591,7 +611,7 @@ const block = (key, g = []) => ({ key, grammars: g, syntax: "block", witness: SY
|
|
|
591
611
|
const BLOCK_GRAMMARS = { "[[": [grammar({ v: val(BINDS_NAME) })] };
|
|
592
612
|
export const PROGRAM_ROWS = [
|
|
593
613
|
head, tail, cut, grepRow("grep"), grepRow("egrep"), grepRow("fgrep"), diff, cmp, sed, date, tar, find, curl,
|
|
594
|
-
ls,
|
|
614
|
+
ls, namesWalker("du"), rg, namesWalker("tree"), ag, ack,
|
|
595
615
|
interpreter("perl", "perl", PERL, "file", true),
|
|
596
616
|
interpreter("ruby", "ruby", RUBY, "file", true),
|
|
597
617
|
interpreter("python", "python", PYTHON, "file", true, { modules: { timeit: text("python") } }),
|
|
@@ -95,18 +95,34 @@ export interface HomeViewSource {
|
|
|
95
95
|
* once and shared by every path below it. */
|
|
96
96
|
views(signal?: AbortSignal, env?: HomeViewEnv): HomeViews;
|
|
97
97
|
}
|
|
98
|
-
/** A judgment's views. `of` answers
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* `leaf: "file"` skips the path's own identity (a file is never a directory
|
|
98
|
+
/** A judgment's views. `of` answers one path's {@link HomeView}: no view where there is nothing to read (no `fileIdentity`
|
|
99
|
+
* seat, no home, a seat that declares the surface absent — the path is judged as spelled); the view where it differs from
|
|
100
|
+
* the path as spelled; and `unread` wherever a lookup the view stands on gave no answer. A level that does not exist (a
|
|
101
|
+
* write's missing tail) takes its parent's view. `leaf: "file"` skips the path's own identity (a file is never a directory
|
|
102
|
+
* on the chain). */
|
|
102
103
|
export interface HomeViews {
|
|
103
104
|
of(path: string, opts?: {
|
|
104
105
|
readonly leaf?: "file";
|
|
105
|
-
}): Promise<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
}): Promise<HomeView>;
|
|
107
|
+
}
|
|
108
|
+
/** One path's home view as a judge reads it:
|
|
109
|
+
* · `view` — the path respelled through a home's own directory chain, present only where it differs from the spelling;
|
|
110
|
+
* · `unread` — the first lookup the view stands on that gave no answer (an identity lookup that threw, timed out or failed
|
|
111
|
+
* with an error that is no conclusive "not there": a level of a home's chain — the index of every path is then partial —
|
|
112
|
+
* or a level of the path itself), present wherever one did, and inherited by every path below it.
|
|
113
|
+
* An `unread` answer is no reading: the path's view is not "none", it is unknown, so a judge that places the home-anchored
|
|
114
|
+
* rows by the view has not finished — every judge refuses to vouch past it ({@link homeViewUnreadSentence}). */
|
|
115
|
+
export interface HomeView {
|
|
116
|
+
readonly view?: string;
|
|
117
|
+
readonly unread?: string;
|
|
118
|
+
}
|
|
119
|
+
/** The one sentence a judgment that met an unread home view ({@link HomeView.unread}) refuses with — `subject` the path the
|
|
120
|
+
* call judged, `face` the deny table it was judged against. */
|
|
121
|
+
export declare function homeViewUnreadSentence(subject: string, unread: string, face?: "read" | "write"): string;
|
|
122
|
+
/** The refusal a traversal raises when an entry it walks met an unread home view: the whole call is refused (what the walk
|
|
123
|
+
* would serve was not judged), with the one sentence. */
|
|
124
|
+
export declare class HomeViewUnreadError extends Error {
|
|
125
|
+
constructor(subject: string, unread: string);
|
|
110
126
|
}
|
|
111
127
|
/** A judge that carries the home views of the placement its rows were compiled at. */
|
|
112
128
|
export interface HomeViewsCarrier {
|