@sema-agent/core 7.58.0 → 7.60.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 +1340 -0
- package/README.md +6 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +9 -4
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +32 -50
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +150 -112
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +90 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +65 -6
- package/dist/brain/timeout.js +111 -11
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +20 -6
- package/dist/core/allow-entry.js +17 -7
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +26 -4
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +66 -25
- package/dist/core/checkpoint-store.js +22 -9
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +3 -3
- package/dist/core/compliance.js +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +156 -23
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +8 -6
- package/dist/core/gate-lanes.js +47 -12
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +17 -1
- package/dist/core/governance-codes.js +25 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +70 -59
- package/dist/core/hooks.js +125 -80
- package/dist/core/image-admission.d.ts +106 -52
- package/dist/core/image-admission.js +184 -56
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +59 -5
- package/dist/core/locked-config.js +82 -50
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +122 -20
- package/dist/core/mcp-failure.js +73 -5
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +27 -12
- package/dist/core/mcp.js +105 -76
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +51 -9
- package/dist/core/memory-engine/sync-client.js +107 -13
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +8 -1
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +6 -5
- package/dist/core/mods/kernel/events.d.ts +11 -4
- package/dist/core/mods/kernel/events.js +11 -7
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +73 -60
- package/dist/core/mods/stations.js +64 -40
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +14 -8
- package/dist/core/peer-seat.d.ts +133 -16
- package/dist/core/peer-seat.js +319 -42
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +11 -6
- package/dist/core/permission-rule-model.d.ts +20 -2
- package/dist/core/permission-rule-model.js +8 -7
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +13 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +69 -3
- package/dist/core/roles.js +167 -80
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +23 -12
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +82 -57
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +87 -11
- package/dist/core/runner/gate-exit.js +30 -8
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +5 -5
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +16 -9
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
- package/dist/core/runner/prepare-delegation-surface.js +5 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
- package/dist/core/runner/prepare-hands-readface.js +19 -6
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
- package/dist/core/runner/prepare-inherited-gate.js +22 -31
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +12 -19
- package/dist/core/runner/prepare-park-ask.d.ts +4 -6
- package/dist/core/runner/prepare-park-ask.js +5 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
- package/dist/core/runner/prepare-policy-chain.js +136 -121
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +10 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
- package/dist/core/runner/prepare-prompt-inputs.js +10 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +17 -2
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +44 -28
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +3 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -5
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +63 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +14 -6
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +89 -77
- package/dist/core/runner/runtask.d.ts +8 -5
- package/dist/core/runner/runtask.js +21 -13
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +20 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-end-body.js +2 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +29 -27
- package/dist/core/runner/turn-attachments.js +27 -42
- package/dist/core/runner-deps.d.ts +32 -19
- package/dist/core/secret-env.d.ts +35 -4
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +12 -3
- package/dist/core/session-policy-store.js +29 -10
- package/dist/core/session-store.d.ts +5 -7
- package/dist/core/session-store.js +50 -11
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +17 -5
- package/dist/core/skill-grant.js +24 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +50 -10
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +146 -17
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +19 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +43 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +15 -7
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +21 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +23 -5
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +15 -7
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
- package/dist/engine/execution-env/node-execution-env.js +21 -13
- package/dist/engine/harness/agent-harness.d.ts +26 -3
- package/dist/engine/harness/agent-harness.js +49 -16
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +119 -28
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +18 -7
- package/dist/engine/loop/agent-loop.d.ts +20 -12
- package/dist/engine/loop/agent-loop.js +205 -36
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +35 -21
- package/dist/index.js +26 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +762 -491
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +9 -11
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +14 -4
- package/dist/tools/fs/fs-bash.js +29 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +13 -5
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +62 -0
- package/dist/tools/fs/read-floor.js +58 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +9 -4
- package/dist/tools/monitor.js +17 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +161 -21
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
|
@@ -7,7 +7,10 @@ import { isErrorLike, readMember, readOwnMembers, thrownMarksOf } from "../../co
|
|
|
7
7
|
import { egressThrownText, egressValue } from "../../core/untrusted-egress.js";
|
|
8
8
|
import { remoteWords } from "../../core/protocol-http-auth.js";
|
|
9
9
|
import { types } from "node:util";
|
|
10
|
-
import {
|
|
10
|
+
import { admitToolResultMediaBlocks, firstUnprocessedOverTarget, toolResultMediaBlocks } from "../../core/image-admission.js";
|
|
11
|
+
import { resolveImageProcessor } from "../../core/image-downsample.js";
|
|
12
|
+
import { IMAGE_REFUSAL_KIND, imageRefusalRemoves } from "../llm/rejected-images.js";
|
|
13
|
+
const IMAGE_REFUSAL_RETRIES = 3;
|
|
11
14
|
function appendTextDeltaToAssistantMessage(message, contentIndex, delta) {
|
|
12
15
|
const content = [...message.content];
|
|
13
16
|
const currentContent = content[contentIndex];
|
|
@@ -366,6 +369,30 @@ async function runTurnPhases(state, signal, turnController, publishSeat, retract
|
|
|
366
369
|
}
|
|
367
370
|
raiseFatalCancellation(executor);
|
|
368
371
|
let interruptedInRecovery = false;
|
|
372
|
+
let imageRetries = 0;
|
|
373
|
+
const resendWithoutRefusedImages = async () => {
|
|
374
|
+
while (message.stopReason === "error" &&
|
|
375
|
+
message.errorKind === IMAGE_REFUSAL_KIND &&
|
|
376
|
+
!signal?.aborted &&
|
|
377
|
+
!turnController.signal.aborted &&
|
|
378
|
+
isBlankFailureContent(message) &&
|
|
379
|
+
executor.admittedCount === 0 &&
|
|
380
|
+
imageRetries < IMAGE_REFUSAL_RETRIES &&
|
|
381
|
+
state.context.messages[state.context.messages.length - 1] === message &&
|
|
382
|
+
imageRefusalRemoves(state.context.messages, message)) {
|
|
383
|
+
imageRetries++;
|
|
384
|
+
trace?.({ kind: "continue", reason: "image_refusal_retry" });
|
|
385
|
+
executor = new StreamToolExecutor(state.context, state.config, turnController.signal, emit);
|
|
386
|
+
try {
|
|
387
|
+
({ message, cutAtSettle: cutAtFinalSettle } = await streamAssistantResponse(state.context, state.config, turnController.signal, withhold?.sink ?? emit, streamFn, runtime, executor, staticReasoningCutDowngrade));
|
|
388
|
+
}
|
|
389
|
+
finally {
|
|
390
|
+
await executor.settle();
|
|
391
|
+
}
|
|
392
|
+
raiseFatalCancellation(executor);
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
await resendWithoutRefusedImages();
|
|
369
396
|
{
|
|
370
397
|
if (ptl) {
|
|
371
398
|
const detect = ptlDetect;
|
|
@@ -418,6 +445,7 @@ async function runTurnPhases(state, signal, turnController, publishSeat, retract
|
|
|
418
445
|
}
|
|
419
446
|
}
|
|
420
447
|
}
|
|
448
|
+
await resendWithoutRefusedImages();
|
|
421
449
|
const unrecoveredPtlFailureUnderInterrupt = ptl !== undefined &&
|
|
422
450
|
message.stopReason === "error" &&
|
|
423
451
|
ptlDetect(message) &&
|
|
@@ -432,6 +460,8 @@ async function runTurnPhases(state, signal, turnController, publishSeat, retract
|
|
|
432
460
|
withhold?.discard();
|
|
433
461
|
await withhold?.flush();
|
|
434
462
|
state.newMessages.push(message);
|
|
463
|
+
if (message.content.some((c) => c.type === "toolCall"))
|
|
464
|
+
state.malformedToolUseRetries = 0;
|
|
435
465
|
if (message.staticReasoningCut === true)
|
|
436
466
|
state.staticReasoningCutRecoveries++;
|
|
437
467
|
if (interruptOwnsTurn) {
|
|
@@ -538,7 +568,7 @@ async function runTurnPhases(state, signal, turnController, publishSeat, retract
|
|
|
538
568
|
}
|
|
539
569
|
const malformed = state.config.recovery?.malformedToolUse;
|
|
540
570
|
if (malformed && message.stopReason === "toolUse" && toolCalls.length === 0 && state.pendingMessages.length === 0) {
|
|
541
|
-
if (state.malformedToolUseRetries < (malformed.maxRetries ??
|
|
571
|
+
if (state.malformedToolUseRetries < (malformed.maxRetries ?? 2)) {
|
|
542
572
|
state.malformedToolUseRetries++;
|
|
543
573
|
state.pendingMessages = [createMalformedToolUseNudge()];
|
|
544
574
|
return { kind: "ran", recovered: "malformed_tool_use_retry" };
|
|
@@ -696,30 +726,20 @@ async function streamAssistantResponse(context, config, signal, emit, streamFn,
|
|
|
696
726
|
const perCallMaxTokens = config.maxTokensPerCall?.();
|
|
697
727
|
const perCallStallTimeouts = config.stallTimeoutsPerCall?.();
|
|
698
728
|
if (signal?.aborted) {
|
|
699
|
-
const abortedBeforeDispatch =
|
|
700
|
-
role: "assistant",
|
|
701
|
-
content: [{ type: "text", text: "" }],
|
|
702
|
-
api: config.model.api,
|
|
703
|
-
provider: config.model.provider,
|
|
704
|
-
model: config.model.id,
|
|
705
|
-
stopReason: "aborted",
|
|
706
|
-
timestamp: Date.now(),
|
|
707
|
-
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
|
|
708
|
-
usageMissing: true,
|
|
709
|
-
};
|
|
729
|
+
const abortedBeforeDispatch = engineAbortedFinal(config.model);
|
|
710
730
|
context.messages.push(abortedBeforeDispatch);
|
|
711
731
|
await emit({ type: "message_start", message: { ...abortedBeforeDispatch } });
|
|
712
732
|
await emit({ type: "message_end", message: abortedBeforeDispatch });
|
|
713
733
|
return { message: abortedBeforeDispatch, cutAtSettle: true };
|
|
714
734
|
}
|
|
715
|
-
const response =
|
|
735
|
+
const response = cutByTurnSignal(() => streamFunction(config.model, llmContext, {
|
|
716
736
|
...config,
|
|
717
737
|
...(perCallMaxTokens !== undefined ? { maxTokens: perCallMaxTokens, maxTokensDynamic: true } : {}),
|
|
718
738
|
...(perCallStallTimeouts !== undefined ? { stallTimeouts: perCallStallTimeouts } : {}),
|
|
719
739
|
...(staticReasoningCutDowngrade === true ? { staticReasoningCutDowngrade: true } : {}),
|
|
720
740
|
apiKey: resolvedApiKey,
|
|
721
741
|
signal,
|
|
722
|
-
});
|
|
742
|
+
}), signal, config.model);
|
|
723
743
|
let partialMessage = null;
|
|
724
744
|
let addedPartial = false;
|
|
725
745
|
for await (const event of response) {
|
|
@@ -791,6 +811,136 @@ async function streamAssistantResponse(context, config, signal, emit, streamFn,
|
|
|
791
811
|
await emit({ type: "message_end", message: finalMessage });
|
|
792
812
|
return { message: finalMessage, cutAtSettle };
|
|
793
813
|
}
|
|
814
|
+
function engineAbortedFinal(model) {
|
|
815
|
+
return {
|
|
816
|
+
role: "assistant",
|
|
817
|
+
content: [{ type: "text", text: "" }],
|
|
818
|
+
api: model.api,
|
|
819
|
+
provider: model.provider,
|
|
820
|
+
model: model.id,
|
|
821
|
+
stopReason: "aborted",
|
|
822
|
+
timestamp: Date.now(),
|
|
823
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
|
|
824
|
+
usageMissing: true,
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
function cutByTurnSignal(open, signal, model) {
|
|
828
|
+
const steps = [];
|
|
829
|
+
let wake;
|
|
830
|
+
let answered = false;
|
|
831
|
+
let settled = false;
|
|
832
|
+
let resolveFinal;
|
|
833
|
+
let rejectFinal;
|
|
834
|
+
const final = new Promise((resolve, reject) => ((resolveFinal = resolve), (rejectFinal = reject)));
|
|
835
|
+
final.catch(() => undefined);
|
|
836
|
+
const deliver = (step) => {
|
|
837
|
+
steps.push(step);
|
|
838
|
+
wake?.();
|
|
839
|
+
};
|
|
840
|
+
let iterator;
|
|
841
|
+
let letGo = false;
|
|
842
|
+
const release = () => {
|
|
843
|
+
letGo = true;
|
|
844
|
+
const it = iterator;
|
|
845
|
+
iterator = undefined;
|
|
846
|
+
if (it?.return !== undefined)
|
|
847
|
+
void Promise.resolve(it).then((held) => held.return?.()).catch(() => undefined);
|
|
848
|
+
};
|
|
849
|
+
const settle = (outcome) => {
|
|
850
|
+
if (settled)
|
|
851
|
+
return;
|
|
852
|
+
settled = true;
|
|
853
|
+
signal?.removeEventListener("abort", onAbort);
|
|
854
|
+
if ("message" in outcome)
|
|
855
|
+
resolveFinal(outcome.message);
|
|
856
|
+
else
|
|
857
|
+
rejectFinal(outcome.error);
|
|
858
|
+
};
|
|
859
|
+
const onAbort = () => void setImmediate(() => {
|
|
860
|
+
if (settled)
|
|
861
|
+
return;
|
|
862
|
+
const shell = engineAbortedFinal(model);
|
|
863
|
+
if (!answered) {
|
|
864
|
+
answered = true;
|
|
865
|
+
deliver({ event: { type: "error", reason: "aborted", error: shell } });
|
|
866
|
+
deliver("end");
|
|
867
|
+
}
|
|
868
|
+
settle({ message: shell });
|
|
869
|
+
release();
|
|
870
|
+
});
|
|
871
|
+
if (signal?.aborted)
|
|
872
|
+
onAbort();
|
|
873
|
+
else
|
|
874
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
875
|
+
void (async () => {
|
|
876
|
+
try {
|
|
877
|
+
const inner = await open();
|
|
878
|
+
const it = (iterator = inner[Symbol.asyncIterator]());
|
|
879
|
+
if (letGo)
|
|
880
|
+
return release();
|
|
881
|
+
for (;;) {
|
|
882
|
+
const step = await it.next();
|
|
883
|
+
if (letGo)
|
|
884
|
+
return;
|
|
885
|
+
if (step.done === true)
|
|
886
|
+
break;
|
|
887
|
+
const event = step.value;
|
|
888
|
+
deliver({ event });
|
|
889
|
+
if (event.type !== "done" && event.type !== "error")
|
|
890
|
+
continue;
|
|
891
|
+
answered = true;
|
|
892
|
+
settle({ message: await inner.result() });
|
|
893
|
+
return release();
|
|
894
|
+
}
|
|
895
|
+
iterator = undefined;
|
|
896
|
+
if (!answered) {
|
|
897
|
+
answered = true;
|
|
898
|
+
deliver("end");
|
|
899
|
+
settle({ message: await inner.result() });
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
catch (error) {
|
|
903
|
+
if (!answered) {
|
|
904
|
+
iterator = undefined;
|
|
905
|
+
answered = true;
|
|
906
|
+
deliver({ error });
|
|
907
|
+
}
|
|
908
|
+
else
|
|
909
|
+
release();
|
|
910
|
+
settle({ error });
|
|
911
|
+
}
|
|
912
|
+
finally {
|
|
913
|
+
deliver("end");
|
|
914
|
+
}
|
|
915
|
+
})();
|
|
916
|
+
return {
|
|
917
|
+
async *[Symbol.asyncIterator]() {
|
|
918
|
+
let readToEnd = false;
|
|
919
|
+
try {
|
|
920
|
+
for (;;) {
|
|
921
|
+
const step = steps.shift();
|
|
922
|
+
if (step === undefined) {
|
|
923
|
+
await new Promise((resolve) => (wake = resolve));
|
|
924
|
+
wake = undefined;
|
|
925
|
+
continue;
|
|
926
|
+
}
|
|
927
|
+
if (step === "end")
|
|
928
|
+
return void (readToEnd = true);
|
|
929
|
+
if ("error" in step)
|
|
930
|
+
throw step.error;
|
|
931
|
+
yield step.event;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
finally {
|
|
935
|
+
if (!readToEnd) {
|
|
936
|
+
signal?.removeEventListener("abort", onAbort);
|
|
937
|
+
release();
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
result: () => final,
|
|
942
|
+
};
|
|
943
|
+
}
|
|
794
944
|
async function executeToolCalls(currentContext, assistantMessage, config, signal, emit, executor) {
|
|
795
945
|
const toolCalls = assistantMessage.content.filter((c) => c.type === "toolCall");
|
|
796
946
|
if (config.toolExecution === "sequential") {
|
|
@@ -831,7 +981,7 @@ export async function runToolCall(currentContext, assistantMessage, toolCall, co
|
|
|
831
981
|
await emit({ type: "tool_execution_start", toolCallId: toolCall.id, toolName: toolCall.name, args: toolCall.arguments });
|
|
832
982
|
const preparation = await prepareToolCall(currentContext, assistantMessage, toolCall, config, signal);
|
|
833
983
|
const finalized = preparation.kind === "immediate"
|
|
834
|
-
? { toolCall, result: preparation.result, isError: preparation.isError }
|
|
984
|
+
? { toolCall, result: preparation.result, isError: preparation.isError, ...(preparation.notExecuted === true ? { notExecuted: true } : {}) }
|
|
835
985
|
: await executePreparedWithDisclosure(currentContext, assistantMessage, preparation, config, signal, emit);
|
|
836
986
|
await emitToolExecutionEnd(finalized, emit);
|
|
837
987
|
return { finalized, ...(preparation.kind === "immediate" && preparation.halt !== undefined ? { halt: preparation.halt } : {}) };
|
|
@@ -973,7 +1123,7 @@ async function executeToolCallsPartitioned(currentContext, assistantMessage, too
|
|
|
973
1123
|
});
|
|
974
1124
|
const preparation = await prepareToolCall(currentContext, assistantMessage, toolCall, config, signal);
|
|
975
1125
|
if (preparation.kind === "immediate") {
|
|
976
|
-
const finalized = { toolCall, result: preparation.result, isError: preparation.isError };
|
|
1126
|
+
const finalized = { toolCall, result: preparation.result, isError: preparation.isError, ...(preparation.notExecuted === true ? { notExecuted: true } : {}) };
|
|
977
1127
|
await emitToolExecutionEnd(finalized, emit);
|
|
978
1128
|
entries.push({ finalized, toolCall });
|
|
979
1129
|
if (preparation.halt !== undefined) {
|
|
@@ -1147,7 +1297,7 @@ async function finalizeStreamEntry(currentContext, assistantMessage, entry, conf
|
|
|
1147
1297
|
result: createErrorToolResult("in-stream execution produced no outcome"),
|
|
1148
1298
|
isError: true,
|
|
1149
1299
|
};
|
|
1150
|
-
return { toolCall: entry.toolCall, result: immediate.result, isError: immediate.isError };
|
|
1300
|
+
return { toolCall: entry.toolCall, result: immediate.result, isError: immediate.isError, ...(immediate.notExecuted === true ? { notExecuted: true } : {}) };
|
|
1151
1301
|
}
|
|
1152
1302
|
async function closeOrphanedStreamEntry(entry, emit) {
|
|
1153
1303
|
await emit({
|
|
@@ -1320,6 +1470,9 @@ function validationRefusedOutcome(tool, refusal) {
|
|
|
1320
1470
|
isError: true,
|
|
1321
1471
|
};
|
|
1322
1472
|
}
|
|
1473
|
+
function neverStartedIf(neverStarted, outcome) {
|
|
1474
|
+
return neverStarted ? { ...outcome, notExecuted: true } : outcome;
|
|
1475
|
+
}
|
|
1323
1476
|
async function prepareToolCall(currentContext, assistantMessage, toolCall, config, signal) {
|
|
1324
1477
|
const tool = findToolByName(currentContext.tools, toolCall.name);
|
|
1325
1478
|
if (!tool) {
|
|
@@ -1341,6 +1494,7 @@ async function prepareToolCall(currentContext, assistantMessage, toolCall, confi
|
|
|
1341
1494
|
isError: true,
|
|
1342
1495
|
};
|
|
1343
1496
|
}
|
|
1497
|
+
let gateLetGo = false;
|
|
1344
1498
|
try {
|
|
1345
1499
|
const preparedToolCall = prepareToolCallArguments(tool, toolCall);
|
|
1346
1500
|
let finalArgs = validateToolArguments(tool, preparedToolCall);
|
|
@@ -1370,6 +1524,7 @@ async function prepareToolCall(currentContext, assistantMessage, toolCall, confi
|
|
|
1370
1524
|
}
|
|
1371
1525
|
return { kind: "immediate", result: blocked, isError: true };
|
|
1372
1526
|
}
|
|
1527
|
+
gateLetGo = true;
|
|
1373
1528
|
const rewritten = beforeResult?.updatedInput;
|
|
1374
1529
|
if (rewritten !== undefined) {
|
|
1375
1530
|
const judged = structuredClone(rewritten);
|
|
@@ -1380,16 +1535,16 @@ async function prepareToolCall(currentContext, assistantMessage, toolCall, confi
|
|
|
1380
1535
|
if (!sameToolArgs(validatedArgs, finalArgs)) {
|
|
1381
1536
|
const rewrittenRefusal = await runInputValidation(tool, finalArgs, toolCall.id, signal, config.onToolInputValidationFault);
|
|
1382
1537
|
if (rewrittenRefusal !== undefined)
|
|
1383
|
-
return validationRefusedOutcome(tool, rewrittenRefusal);
|
|
1538
|
+
return neverStartedIf(true, validationRefusedOutcome(tool, rewrittenRefusal));
|
|
1384
1539
|
}
|
|
1385
1540
|
}
|
|
1386
1541
|
}
|
|
1387
1542
|
if (signal?.aborted) {
|
|
1388
|
-
return {
|
|
1543
|
+
return neverStartedIf(gateLetGo, {
|
|
1389
1544
|
kind: "immediate",
|
|
1390
1545
|
result: createErrorToolResult("Operation aborted"),
|
|
1391
1546
|
isError: true,
|
|
1392
|
-
};
|
|
1547
|
+
});
|
|
1393
1548
|
}
|
|
1394
1549
|
return {
|
|
1395
1550
|
kind: "prepared",
|
|
@@ -1399,21 +1554,22 @@ async function prepareToolCall(currentContext, assistantMessage, toolCall, confi
|
|
|
1399
1554
|
};
|
|
1400
1555
|
}
|
|
1401
1556
|
catch (error) {
|
|
1402
|
-
return {
|
|
1557
|
+
return neverStartedIf(gateLetGo, {
|
|
1403
1558
|
kind: "immediate",
|
|
1404
1559
|
result: thrownErrorToolResult(error),
|
|
1405
1560
|
isError: true,
|
|
1406
|
-
};
|
|
1561
|
+
});
|
|
1407
1562
|
}
|
|
1408
1563
|
}
|
|
1409
1564
|
async function executePreparedToolCall(prepared, signal, emit, executeTool, abortResultDetails, onLateCancellation) {
|
|
1410
1565
|
const updateEvents = [];
|
|
1411
1566
|
let acceptingUpdates = true;
|
|
1412
1567
|
if (signal?.aborted) {
|
|
1413
|
-
return { result: createErrorToolResult("operation aborted before execution", { details: safeAbortDetails(abortResultDetails) }), isError: true };
|
|
1568
|
+
return { result: createErrorToolResult("operation aborted before execution", { details: safeAbortDetails(abortResultDetails) }), isError: true, notExecuted: true };
|
|
1414
1569
|
}
|
|
1415
1570
|
const work = (async () => {
|
|
1416
1571
|
let outcome;
|
|
1572
|
+
let bodyStarted = false, bodyClosed = false;
|
|
1417
1573
|
try {
|
|
1418
1574
|
const body = () => prepared.tool.execute(prepared.toolCall.id, prepared.args, signal, (partialResult) => {
|
|
1419
1575
|
if (!acceptingUpdates) {
|
|
@@ -1438,14 +1594,17 @@ async function executePreparedToolCall(prepared, signal, emit, executeTool, abor
|
|
|
1438
1594
|
});
|
|
1439
1595
|
updateEvents.push(delivery);
|
|
1440
1596
|
});
|
|
1441
|
-
const
|
|
1442
|
-
|
|
1597
|
+
const startBody = () => (bodyClosed ? Promise.resolve(Object.assign(createErrorToolResult("operation not executed: the execution station had already settled this call without running its body"), { isError: true })) : ((bodyStarted = true), body()));
|
|
1598
|
+
const result = executeTool !== undefined ? await executeTool({ toolCall: prepared.toolCall, tool: prepared.tool, args: prepared.args }, startBody, signal) : await body();
|
|
1599
|
+
bodyClosed = !bodyStarted;
|
|
1600
|
+
outcome = neverStartedIf(executeTool !== undefined && !bodyStarted, { result, isError: result.isError === true });
|
|
1443
1601
|
}
|
|
1444
1602
|
catch (error) {
|
|
1445
|
-
|
|
1603
|
+
bodyClosed = !bodyStarted;
|
|
1604
|
+
outcome = neverStartedIf(executeTool !== undefined && !bodyStarted, {
|
|
1446
1605
|
result: thrownErrorToolResult(error),
|
|
1447
1606
|
isError: true,
|
|
1448
|
-
};
|
|
1607
|
+
});
|
|
1449
1608
|
}
|
|
1450
1609
|
acceptingUpdates = false;
|
|
1451
1610
|
const deliveryFailure = await settleUpdateDeliveries(updateEvents);
|
|
@@ -1455,7 +1614,7 @@ async function executePreparedToolCall(prepared, signal, emit, executeTool, abor
|
|
|
1455
1614
|
const details = annotateDeliveryFailure(outcome.result, {
|
|
1456
1615
|
message: egressThrownText("same-principal", reason),
|
|
1457
1616
|
});
|
|
1458
|
-
return details === UNANNOTATED ? outcome : { result: { ...outcome.result, details }
|
|
1617
|
+
return details === UNANNOTATED ? outcome : { ...outcome, result: { ...outcome.result, details } };
|
|
1459
1618
|
})();
|
|
1460
1619
|
return work;
|
|
1461
1620
|
}
|
|
@@ -1534,9 +1693,9 @@ async function executePreparedWithDisclosure(currentContext, assistantMessage, p
|
|
|
1534
1693
|
function finalizeExecutedToolCall(currentContext, assistantMessage, prepared, executed, config, signal) {
|
|
1535
1694
|
return finalizeToolOutcome(prepared.toolCall, executed, config.afterToolCall === undefined
|
|
1536
1695
|
? undefined
|
|
1537
|
-
: (result, isError) => config.afterToolCall({ assistantMessage, toolCall: prepared.toolCall, args: prepared.args, result, isError, context: currentContext }, signal), config
|
|
1696
|
+
: (result, isError) => config.afterToolCall({ assistantMessage, toolCall: prepared.toolCall, args: prepared.args, result, isError, context: currentContext }, signal), config);
|
|
1538
1697
|
}
|
|
1539
|
-
export async function finalizeToolOutcome(toolCall, executed, after,
|
|
1698
|
+
export async function finalizeToolOutcome(toolCall, executed, after, media) {
|
|
1540
1699
|
let result = executed.result;
|
|
1541
1700
|
let isError = executed.isError;
|
|
1542
1701
|
const deliveryMark = readDeliveryFailureMark(executed.result.details);
|
|
@@ -1562,19 +1721,28 @@ export async function finalizeToolOutcome(toolCall, executed, after, onMediaRefu
|
|
|
1562
1721
|
result = { ...result, details };
|
|
1563
1722
|
}
|
|
1564
1723
|
}
|
|
1565
|
-
const
|
|
1566
|
-
if (
|
|
1567
|
-
const
|
|
1724
|
+
const mediaBlocks = toolResultMediaBlocks(result.content);
|
|
1725
|
+
if (mediaBlocks !== undefined) {
|
|
1726
|
+
const processor = await resolveImageProcessor(media?.imageProcessor);
|
|
1727
|
+
const admitted = await admitToolResultMediaBlocks(mediaBlocks, toolCall.name, processor);
|
|
1568
1728
|
result = { ...result, content: admitted.content };
|
|
1729
|
+
const unprocessed = firstUnprocessedOverTarget(admitted.content, processor);
|
|
1569
1730
|
if (admitted.refused.length > 0) {
|
|
1570
1731
|
try {
|
|
1571
|
-
|
|
1732
|
+
media?.onToolMediaRefused?.({ toolName: toolCall.name, toolCallId: toolCall.id, refused: admitted.refused });
|
|
1733
|
+
}
|
|
1734
|
+
catch {
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
if (unprocessed !== undefined) {
|
|
1738
|
+
try {
|
|
1739
|
+
media?.onImageUnprocessed?.(unprocessed);
|
|
1572
1740
|
}
|
|
1573
1741
|
catch {
|
|
1574
1742
|
}
|
|
1575
1743
|
}
|
|
1576
1744
|
}
|
|
1577
|
-
return { toolCall, result, isError };
|
|
1745
|
+
return { toolCall, result, isError, ...(executed.notExecuted === true ? { notExecuted: true } : {}) };
|
|
1578
1746
|
}
|
|
1579
1747
|
function safeAbortDetails(fn) {
|
|
1580
1748
|
try {
|
|
@@ -1613,6 +1781,7 @@ async function emitToolExecutionEnd(finalized, emit) {
|
|
|
1613
1781
|
toolName: finalized.toolCall.name,
|
|
1614
1782
|
result: finalized.result,
|
|
1615
1783
|
isError: finalized.isError,
|
|
1784
|
+
...(finalized.notExecuted === true ? { notExecuted: true } : {}),
|
|
1616
1785
|
});
|
|
1617
1786
|
}
|
|
1618
1787
|
function createToolResultMessage(finalized) {
|
|
@@ -244,10 +244,11 @@ export interface LoopTruncatedOutputRecovery {
|
|
|
244
244
|
* Malformed-tool-use retry (design/119 S2). A turn that stops with
|
|
245
245
|
* `toolUse` but carries ZERO parseable tool calls (the brain dropped truncated/invalid ones) used to
|
|
246
246
|
* end the run silently mid-task. When enabled, inject a synthetic retry nudge and run another turn,
|
|
247
|
-
* up to `maxRetries`
|
|
247
|
+
* up to `maxRetries` times IN A ROW (a turn whose tool calls parsed clears the count; CC: up to twice).
|
|
248
|
+
* Absent ⇒ OFF (pre-S2 behavior).
|
|
248
249
|
*/
|
|
249
250
|
export interface LoopMalformedToolUseRecovery {
|
|
250
|
-
/** Max retries
|
|
251
|
+
/** Max consecutive retries. Default: 2. */
|
|
251
252
|
maxRetries?: number;
|
|
252
253
|
}
|
|
253
254
|
/**
|
|
@@ -594,6 +595,12 @@ export interface AgentLoopConfig extends SimpleStreamOptions {
|
|
|
594
595
|
toolCallId: string;
|
|
595
596
|
refused: readonly import("../../core/image-admission.js").ToolResultMediaRefusal[];
|
|
596
597
|
}) => void;
|
|
598
|
+
/** The run's image processor seat (`RunnerDeps.imageProcessor`, read through `resolveImageProcessor`): the tool-result seat
|
|
599
|
+
* admits every result's images with it. Absent ⇒ detect sharp, as on the deployment seat. */
|
|
600
|
+
imageProcessor?: import("../../core/image-downsample.js").ImageDownsampler | false;
|
|
601
|
+
/** Told the decoded size of an admitted result image that goes to the model over the soft target with no processor
|
|
602
|
+
* (`firstUnprocessedOverTarget`) — the run's once-per-run operator account. Advisory: a throwing sink changes nothing. */
|
|
603
|
+
onImageUnprocessed?: (bytes: number) => void;
|
|
597
604
|
/**
|
|
598
605
|
* Called after a tool finishes executing, before `tool_execution_end` and tool-result message events are emitted.
|
|
599
606
|
*
|
|
@@ -884,7 +891,9 @@ export type AgentEvent = {
|
|
|
884
891
|
/**
|
|
885
892
|
* Present (`true`) exactly when this end frame closes a call the loop settled WITHOUT
|
|
886
893
|
* executing it — a never-started sibling under a batch-halt directive (see
|
|
887
|
-
* {@link BeforeToolCallResult.haltRemaining})
|
|
894
|
+
* {@link BeforeToolCallResult.haltRemaining}), or a call the loop itself refused after `beforeToolCall` had let it go and
|
|
895
|
+
* before its body started (the arguments the gate cleared failed the loop's own re-validation or re-reading, or the run
|
|
896
|
+
* was aborted in that gap). LOOP-AUTHORED: it rides the event, never the
|
|
888
897
|
* tool result, so a tool cannot claim it about itself; a consumer that scopes
|
|
889
898
|
* post-execution machinery to executed calls (batch observers, execution audits) keys on
|
|
890
899
|
* this the way it keys on its own blocked-call records. Absent on every executed call.
|
|
@@ -29,8 +29,8 @@ export interface NodeLspManagerOptions {
|
|
|
29
29
|
onNotice?: (notice: EngineNotice) => void;
|
|
30
30
|
/** Read a file's CURRENT text for the session's didOpen/didChange re-sync (default = local `fs.readFile` utf8). */
|
|
31
31
|
readText?: LspReadText;
|
|
32
|
-
/** Resolve the server `cwd`/`rootUri` for a file
|
|
33
|
-
resolveRoot?: (filePath: string, env?: ExecutionEnv) => string;
|
|
32
|
+
/** Resolve the server `cwd`/`rootUri` for a file; `undefined` = no root, no server (default: see `defaultResolveRoot`). */
|
|
33
|
+
resolveRoot?: (filePath: string, env?: ExecutionEnv) => string | undefined;
|
|
34
34
|
/** Observability hook (open/heal/degrade/evict events). */
|
|
35
35
|
log?: (event: string, fields: Record<string, unknown>) => void;
|
|
36
36
|
/** Warm-up window override (see {@link TransportLspSession}); default 10s/1s. */
|
|
@@ -99,7 +99,7 @@ export declare class NodeLspManager implements LspServerManager {
|
|
|
99
99
|
* Evict + kill every cached language server rooted at `root`. Call this at TASK-END for an ephemeral/worktree
|
|
100
100
|
* cwd so a heavyweight server (e.g. a jdtls JVM) doesn't outlive the task that spawned it — the deterministic
|
|
101
101
|
* complement to the LRU cap. `root` must match what `resolveRoot` produced for the task (the host lane uses the
|
|
102
|
-
* task's `env.cwd
|
|
102
|
+
* task's `env.cwd`, the default root when it holds a project marker). Best-effort + idempotent (an unknown root is a no-op).
|
|
103
103
|
*/
|
|
104
104
|
evict(root: string): Promise<void>;
|
|
105
105
|
/**
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { killProcessTree } from "../execution-env/kill-tree.js";
|
|
3
3
|
import { open, readFile, stat } from "node:fs/promises";
|
|
4
|
-
import { basename, dirname, extname, resolve as resolvePath } from "node:path";
|
|
4
|
+
import { basename, dirname, extname, isAbsolute, relative, resolve as resolvePath } from "node:path";
|
|
5
5
|
import { constants as fsConstants, existsSync } from "node:fs";
|
|
6
|
+
import { physicalPathOf } from "../../core/physical-path.js";
|
|
7
|
+
import { homedir } from "node:os";
|
|
6
8
|
import { pathToUri } from "../../core/lsp-protocol.js";
|
|
7
9
|
import { LspDiagnosticsRegistry } from "../../core/lsp-diagnostics.js";
|
|
8
10
|
import { TransportLspSession } from "../../core/lsp-session.js";
|
|
@@ -99,6 +101,10 @@ export class NodeLspManager {
|
|
|
99
101
|
if (!language || !this.serverCmd(language))
|
|
100
102
|
return undefined;
|
|
101
103
|
const root = this.resolveRootFn(filePath, env);
|
|
104
|
+
if (root === undefined) {
|
|
105
|
+
this.log("lsp_root_refused", { language, filePath });
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
102
108
|
const key = `${language} ${root}`;
|
|
103
109
|
const cached = this.cache.get(key);
|
|
104
110
|
if (cached && !cached.session.closed) {
|
|
@@ -214,7 +220,10 @@ export class NodeLspManager {
|
|
|
214
220
|
const cmd = this.serverCmd(language);
|
|
215
221
|
if (!cmd)
|
|
216
222
|
return `no ${language} language server is configured in this environment`;
|
|
217
|
-
const
|
|
223
|
+
const root = this.resolveRootFn(filePath, env);
|
|
224
|
+
if (root === undefined)
|
|
225
|
+
return NO_PROJECT_ROOT;
|
|
226
|
+
const e = this.failed.get(`${language} ${root}`);
|
|
218
227
|
if (e?.kind === "missing_binary")
|
|
219
228
|
return `the ${language} language server ("${e.command}") is not installed on this host`;
|
|
220
229
|
if (e?.kind === "initialize")
|
|
@@ -289,20 +298,30 @@ export function languageFor(filePath) {
|
|
|
289
298
|
return EXT_LANG[extname(filePath).toLowerCase()];
|
|
290
299
|
}
|
|
291
300
|
function defaultResolveRoot(filePath, env) {
|
|
292
|
-
|
|
301
|
+
const home = identityOf(env?.homeDir ?? homedir());
|
|
302
|
+
const project = (dir) => !atOrAbove(identityOf(dir), home) && ROOT_MARKERS.some((m) => existsSync(resolvePath(dir, m)));
|
|
303
|
+
if (env?.cwd && project(resolvePath(env.cwd)))
|
|
293
304
|
return env.cwd;
|
|
294
|
-
let dir = dirname(resolvePath(filePath))
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const parent = dirname(dir);
|
|
300
|
-
if (parent === dir)
|
|
301
|
-
break;
|
|
302
|
-
dir = parent;
|
|
305
|
+
for (let dir = dirname(resolvePath(filePath));; dir = dirname(dir)) {
|
|
306
|
+
if (project(dir))
|
|
307
|
+
return dir;
|
|
308
|
+
if (dirname(dir) === dir)
|
|
309
|
+
return undefined;
|
|
303
310
|
}
|
|
304
|
-
return dirname(resolvePath(filePath));
|
|
305
311
|
}
|
|
312
|
+
function identityOf(dir) {
|
|
313
|
+
try {
|
|
314
|
+
return physicalPathOf(dir);
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
return resolvePath(dir);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function atOrAbove(dir, home) {
|
|
321
|
+
const rel = relative(dir, home);
|
|
322
|
+
return rel === "" || (!rel.startsWith("..") && !isAbsolute(rel));
|
|
323
|
+
}
|
|
324
|
+
const NO_PROJECT_ROOT = "no project root: no project marker (.git, package.json, go.mod, Cargo.toml, pyproject.toml, …) in a directory between the file and the home directory, and the home directory is never a language server's root";
|
|
306
325
|
export { MAX_LSP_FILE_BYTES } from "../../core/lsp.js";
|
|
307
326
|
export const defaultLspReadText = async (fp, signal) => {
|
|
308
327
|
const st = await stat(fp);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The fork point a store copies up to: `{}` is the whole log, `{ entryId, position: "at" }` the path from the root down to that entry. It is the answer
|
|
2
|
+
* `settledForkOptions` gives, and the question `selectForkRows` takes. */
|
|
3
|
+
export interface ForkPoint {
|
|
4
|
+
entryId?: string;
|
|
5
|
+
position?: "at";
|
|
6
|
+
}
|
|
7
|
+
/** How the walk reads a log: the row an id names (`undefined` = the log holds none), a row's own id, and the id of its parent (`null` or `undefined` = it has none). */
|
|
8
|
+
export interface ParentLinks<T> {
|
|
9
|
+
read(id: string): T | undefined;
|
|
10
|
+
idOf(row: T): string;
|
|
11
|
+
parentOf(row: T): string | null | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The one walk up a log's parent chain: the rows from the root down to `start`, root first. The chain ends at a row with no parent, or at `floorId`
|
|
15
|
+
* (a bounded window's root — its parent is not required to exist). A parent the log does not hold is `invalid_session` naming it, a chain that
|
|
16
|
+
* returns to a row it already stood on is refused by the shared guard; neither is followed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function pathToRoot<T>(start: T, links: ParentLinks<T>, floorId?: string | null): T[];
|
|
19
|
+
/** How a log row is read by `selectForkRows`: its entry id and its parent's (`null` = a root). */
|
|
20
|
+
export interface ForkRowShape<R> {
|
|
21
|
+
idOf(row: R): string;
|
|
22
|
+
parentOf(row: R): string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Picks the rows a fork copies out of a whole log (oldest first) and the new session's leaf — for a store that moves rows as bytes and has no
|
|
26
|
+
* `SessionRepo.fork` to hand the answer to. `point` is `settledForkOptions`' answer: `{}` copies every row (other branches too) and keeps
|
|
27
|
+
* `sourceLeafId`; `{ entryId, position: "at" }` copies the rows on the path from the root to that entry (the path, not a prefix of the log: other
|
|
28
|
+
* branches stay behind) and the leaf is that entry. The rows keep their order.
|
|
29
|
+
*
|
|
30
|
+
* Refusals are the engine's, word for word: a fork point the log does not hold is `invalid_fork_target`, a parent missing part-way up the path (an empty
|
|
31
|
+
* parent id included) or a chain that returns to a row it stood on is `invalid_session` (the sentence `getPathToRoot` gives), and a fork point that
|
|
32
|
+
* names an entry with a `position` other than `at` is refused `invalid_fork_target` — rows are copied only for the point the judge answers. A point with
|
|
33
|
+
* no entry id is the whole-log form whatever else it carries, as `getEntriesToFork` reads it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function selectForkRows<R>(rows: readonly R[], sourceLeafId: string | null, point: ForkPoint, shape: ForkRowShape<R>): {
|
|
36
|
+
rows: R[];
|
|
37
|
+
leafId: string | null;
|
|
38
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SessionError } from "../harness/types.js";
|
|
2
|
+
import { ParentChainGuard } from "./parent-chain-guard.js";
|
|
3
|
+
export function pathToRoot(start, links, floorId) {
|
|
4
|
+
const path = [];
|
|
5
|
+
const chain = new ParentChainGuard();
|
|
6
|
+
let current = start;
|
|
7
|
+
while (current !== undefined) {
|
|
8
|
+
const id = links.idOf(current);
|
|
9
|
+
chain.stepOnto(id);
|
|
10
|
+
path.push(current);
|
|
11
|
+
if (id === floorId)
|
|
12
|
+
break;
|
|
13
|
+
const parentId = links.parentOf(current);
|
|
14
|
+
if (parentId === null || parentId === undefined)
|
|
15
|
+
break;
|
|
16
|
+
const parent = parentId === "" ? undefined : links.read(parentId);
|
|
17
|
+
if (parent === undefined) {
|
|
18
|
+
throw new SessionError("invalid_session", `Entry ${parentId} not found`);
|
|
19
|
+
}
|
|
20
|
+
current = parent;
|
|
21
|
+
}
|
|
22
|
+
return path.reverse();
|
|
23
|
+
}
|
|
24
|
+
export function selectForkRows(rows, sourceLeafId, point, shape) {
|
|
25
|
+
if (point.entryId === undefined)
|
|
26
|
+
return { rows: [...rows], leafId: sourceLeafId };
|
|
27
|
+
if (point.position !== "at") {
|
|
28
|
+
throw new SessionError("invalid_fork_target", `fork point ${point.entryId} comes with a position the copy does not select rows for (${String(point.position)}) — only "at" is`);
|
|
29
|
+
}
|
|
30
|
+
const byId = new Map();
|
|
31
|
+
for (const row of rows)
|
|
32
|
+
byId.set(shape.idOf(row), row);
|
|
33
|
+
const target = byId.get(point.entryId);
|
|
34
|
+
if (target === undefined)
|
|
35
|
+
throw new SessionError("invalid_fork_target", `Entry ${point.entryId} not found`);
|
|
36
|
+
const links = { read: (id) => byId.get(id), idOf: (row) => shape.idOf(row), parentOf: (row) => shape.parentOf(row) };
|
|
37
|
+
const onPath = new Set(pathToRoot(target, links).map((row) => shape.idOf(row)));
|
|
38
|
+
return { rows: rows.filter((row) => onPath.has(shape.idOf(row))), leafId: point.entryId };
|
|
39
|
+
}
|