@sema-agent/server 7.146.0 → 7.147.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/MIGRATION.md +384 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +170 -66
- package/deploy/facts/lanes.json +7 -0
- package/deploy/sema-up/README.md +2 -2
- package/deploy/sema-up/chart/templates/_helpers.tpl +22 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -4
- package/deploy/sema-up/chart/templates/server.yaml +5 -4
- package/deploy/sema-up/chart/values.yaml +1 -1
- package/deploy/sema-up/cluster-up.sh +2 -1
- package/deploy/sema-up/lib/flagshape.sh +4 -0
- package/deploy/sema-up/lib/lanes.json +2 -5
- package/deploy/sema-up/sema-up.sh +12 -9
- package/deploy/sema-up/stack/compose.yaml +5 -4
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -3
- package/dist/approval-card.d.ts +4 -4
- package/dist/approval.d.ts +3 -3
- package/dist/audit.js +2 -2
- package/dist/bench/s1/live-deps.js +3 -1
- package/dist/boot/crash-last.js +2 -1
- package/dist/boot/device-lane.js +5 -5
- package/dist/boot/engine-lease.d.ts +12 -11
- package/dist/boot/execution-env.d.ts +2 -1
- package/dist/boot/execution-env.js +45 -33
- package/dist/boot/execution-lane.d.ts +37 -9
- package/dist/boot/execution-lane.js +74 -20
- package/dist/boot/exit-boundary.d.ts +1 -1
- package/dist/boot/exit-last.js +2 -1
- package/dist/boot/governance-seams.d.ts +2 -2
- package/dist/boot/leader.js +1 -1
- package/dist/boot/memory-boundary.d.ts +11 -11
- package/dist/boot/memory-boundary.js +3 -3
- package/dist/boot/memory-consolidation.d.ts +13 -24
- package/dist/boot/memory-consolidation.js +0 -13
- package/dist/boot/org-memory.js +3 -2
- package/dist/boot/parked-revive-gate.d.ts +1 -1
- package/dist/boot/parked-revive-gate.js +1 -1
- package/dist/boot/reapers.js +1 -1
- package/dist/boot/resolve-spec.js +91 -111
- package/dist/boot/retention-lane.d.ts +4 -42
- package/dist/boot/session-faces.d.ts +1 -0
- package/dist/boot/session-faces.js +8 -2
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +6 -2
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -1
- package/dist/boot/stage-02-web-admin-pull.js +10 -8
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +3 -3
- package/dist/boot/stage-06-runners.d.ts +3 -3
- package/dist/boot/stage-06-runners.js +1 -3
- package/dist/boot/stage-07-capability-layer.d.ts +3 -3
- package/dist/boot/stage-07-capability-layer.js +4 -9
- package/dist/boot/stage-08-reapers.d.ts +3 -3
- package/dist/boot/stage-09-leader.d.ts +4 -3
- package/dist/boot/stage-10-http-server.d.ts +4 -3
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +9 -0
- package/dist/boot/stores.js +18 -7
- package/dist/boot/web-admin.js +3 -3
- package/dist/capabilities/center-plugins.d.ts +2 -0
- package/dist/capabilities/center-plugins.js +6 -2
- package/dist/capabilities/composite-members.d.ts +1 -0
- package/dist/capabilities/composite-members.js +1 -0
- package/dist/capabilities/execution-lane.d.ts +7 -7
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +1 -1
- package/dist/capabilities/scenarios.d.ts +32 -18
- package/dist/capabilities/scenarios.js +13 -9
- package/dist/capabilities/settings-contract.d.ts +29 -0
- package/dist/capabilities/settings-contract.js +14 -0
- package/dist/capabilities/skills.d.ts +5 -5
- package/dist/capability-facts.d.ts +38 -0
- package/dist/capability-facts.js +34 -1
- package/dist/center-credential-renewer.js +3 -2
- package/dist/config-catalog.js +6 -5
- package/dist/config-invariants.d.ts +18 -3
- package/dist/config-invariants.js +36 -19
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-lkg.js +5 -6
- package/dist/config-provider.js +2 -0
- package/dist/config-types.d.ts +190 -186
- package/dist/config.d.ts +68 -5
- package/dist/config.js +80 -54
- package/dist/degenerate-instrument.js +1 -1
- package/dist/deploy-facts.js +3 -2
- package/dist/deployment-shape.d.ts +21 -12
- package/dist/deployment-shape.js +24 -6
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +10 -6
- package/dist/execution-config-root.d.ts +5 -5
- package/dist/execution-config-root.js +5 -5
- package/dist/execution-env-purpose.d.ts +14 -0
- package/dist/execution-env-purpose.js +29 -0
- package/dist/execution-lane-caps.d.ts +49 -86
- package/dist/execution-lane-caps.js +52 -62
- package/dist/execution-placement.d.ts +18 -2
- package/dist/execution-placement.js +19 -0
- package/dist/file-history-disclosure.d.ts +2 -2
- package/dist/fleet/drain-entry.d.ts +17 -10
- package/dist/fleet/drain-entry.js +1 -1
- package/dist/fleet/serving-lease.js +3 -4
- package/dist/history-anchor.d.ts +22 -0
- package/dist/history-anchor.js +14 -0
- package/dist/hooks/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-runner.d.ts +52 -8
- package/dist/hooks/hook-runner.js +160 -36
- package/dist/http/approval-sweeps.d.ts +2 -5
- package/dist/http/approval-sweeps.js +3 -2
- package/dist/http/checkpoint-ctx.d.ts +17 -0
- package/dist/http/checkpoint-ctx.js +6 -0
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/dispatch.js +1 -1
- package/dist/http/durable-run-leg.js +2 -1
- package/dist/http/execution-context.d.ts +3 -1
- package/dist/http/execution-context.js +4 -0
- package/dist/http/memory-compliance-failure-reply.d.ts +1 -1
- package/dist/http/memory-compliance-failure-reply.js +3 -0
- package/dist/http/memory-store-refusal-reply.d.ts +3 -3
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +11 -0
- package/dist/http/owner-access.js +7 -4
- package/dist/http/principal-gate.d.ts +3 -14
- package/dist/http/principal-gate.js +0 -13
- package/dist/http/request-guards.d.ts +1 -1
- package/dist/http/resume-legs.d.ts +7 -10
- package/dist/http/resume-legs.js +79 -50
- package/dist/http/rewind-files-reply.d.ts +34 -0
- package/dist/http/rewind-files-reply.js +36 -0
- package/dist/http/route-ctx.d.ts +32 -16
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/approvals-assistant.js +5 -25
- package/dist/http/routes/capabilities.js +8 -2
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -1
- package/dist/http/routes/projects.d.ts +70 -0
- package/dist/http/routes/projects.js +86 -0
- package/dist/http/routes/rules.js +30 -2
- package/dist/http/routes/runs.js +8 -8
- package/dist/http/routes/session-sync.js +27 -10
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +104 -2
- package/dist/http/routes/tasks.js +9 -3
- package/dist/http/server.d.ts +24 -10
- package/dist/http/server.js +17 -6
- package/dist/http/stored-body-replay.d.ts +5 -3
- package/dist/http/stored-body-replay.js +10 -1
- package/dist/http/wire-types.d.ts +19 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- package/dist/memory-embedder-reembed.d.ts +38 -0
- package/dist/memory-embedder-reembed.js +20 -0
- package/dist/memory-incident-sink.d.ts +0 -28
- package/dist/memory-incident-sink.js +5 -0
- package/dist/memory-scope.d.ts +2 -2
- package/dist/memory-scope.js +1 -1
- package/dist/memory-store-refusal.d.ts +17 -4
- package/dist/memory-store-refusal.js +1 -1
- package/dist/memory-sync-client.d.ts +2 -0
- package/dist/memory-sync-client.js +13 -11
- package/dist/memory-sync.js +1 -1
- package/dist/model-compat.d.ts +35 -21
- package/dist/model-compat.js +49 -21
- package/dist/model-entry-refusal.d.ts +11 -1
- package/dist/model-entry-refusal.js +7 -0
- package/dist/namespaced-rule-name.d.ts +18 -1
- package/dist/namespaced-rule-name.js +12 -0
- package/dist/observability/fail-open.d.ts +17 -9
- package/dist/observability/fail-open.js +17 -9
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +2 -0
- package/dist/observability/secret-env-scrub.d.ts +30 -4
- package/dist/observability/secret-env-scrub.js +15 -3
- package/dist/orchestration/workflow-agent-session-index.d.ts +7 -12
- package/dist/orchestration/workflow-agent-session-index.js +1 -6
- package/dist/orchestration/workflow-completion-inbox.d.ts +26 -6
- package/dist/orchestration/workflow-completion-inbox.js +63 -45
- package/dist/org-memory-admission.d.ts +5 -2
- package/dist/org-memory-admission.js +25 -10
- package/dist/parked-decide.d.ts +33 -26
- package/dist/parked-decide.js +36 -44
- package/dist/plugins/approval-ask-store-file.d.ts +10 -2
- package/dist/plugins/approval-ask-store-file.js +37 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +5 -3
- package/dist/plugins/approval-ask-store-memory.js +11 -2
- package/dist/plugins/approval-ask-store-sql.d.ts +3 -0
- package/dist/plugins/approval-ask-store-sql.js +3 -1
- package/dist/plugins/blob-backend.d.ts +38 -195
- package/dist/plugins/blob-backend.js +33 -229
- package/dist/plugins/caching-session-store.d.ts +9 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +1 -1
- package/dist/plugins/checkpoint-index-columns.js +3 -2
- package/dist/plugins/checkpoint-store-face.d.ts +1 -1
- package/dist/plugins/device-store-sql.d.ts +2 -2
- package/dist/plugins/device-store-sql.js +5 -10
- package/dist/plugins/execution-lane-rename-m40.d.ts +20 -0
- package/dist/plugins/execution-lane-rename-m40.js +10 -0
- package/dist/plugins/execution-placement-sql.d.ts +63 -88
- package/dist/plugins/execution-placement-sql.js +94 -54
- package/dist/plugins/file-run-store.d.ts +26 -12
- package/dist/plugins/file-run-store.js +63 -63
- package/dist/plugins/imported-layer-root-retirement.d.ts +17 -8
- package/dist/plugins/imported-layer-root-retirement.js +4 -8
- package/dist/plugins/inbox-payload-column.d.ts +14 -0
- package/dist/plugins/inbox-payload-column.js +13 -0
- package/dist/plugins/local-checkpoint-store.d.ts +5 -0
- package/dist/plugins/local-checkpoint-store.js +11 -7
- package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
- package/dist/plugins/local-data-dir-modes-m39.js +182 -0
- package/dist/plugins/local-engine-high-water.d.ts +11 -0
- package/dist/plugins/local-engine-high-water.js +59 -0
- package/dist/plugins/local-session-store.d.ts +91 -25
- package/dist/plugins/local-session-store.js +124 -45
- package/dist/plugins/local-task-attachment-store.d.ts +2 -0
- package/dist/plugins/local-task-attachment-store.js +10 -11
- package/dist/plugins/memory-embedder-fingerprint.d.ts +33 -10
- package/dist/plugins/memory-embedder-fingerprint.js +52 -12
- package/dist/plugins/memory-embedder.d.ts +1 -1
- package/dist/plugins/memory-embedder.js +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +4 -3
- package/dist/plugins/memory-engine-pg.js +4 -4
- package/dist/plugins/memory-engine-sql-apply.d.ts +13 -4
- package/dist/plugins/memory-engine-sql-apply.js +1 -1
- package/dist/plugins/memory-engine-tidb.d.ts +8 -5
- package/dist/plugins/memory-engine-tidb.js +7 -8
- package/dist/plugins/one-time-migrations.d.ts +145 -35
- package/dist/plugins/one-time-migrations.js +272 -120
- package/dist/plugins/owner-only-file-mode.d.ts +29 -0
- package/dist/plugins/owner-only-file-mode.js +141 -0
- package/dist/plugins/permission-rule-store-file.d.ts +8 -8
- package/dist/plugins/permission-rule-store-file.js +14 -2
- package/dist/plugins/pg-pool.d.ts +2 -1
- package/dist/plugins/pg-pool.js +11 -4
- package/dist/plugins/release-version.d.ts +20 -0
- package/dist/plugins/release-version.js +28 -0
- package/dist/plugins/remote-env-adb.d.ts +20 -4
- package/dist/plugins/remote-env-adb.js +39 -11
- package/dist/plugins/remote-env-e2b.d.ts +12 -3
- package/dist/plugins/remote-env-e2b.js +6 -4
- package/dist/plugins/remote-env-host.d.ts +9 -1
- package/dist/plugins/remote-env-host.js +6 -5
- package/dist/plugins/remote-env-k8s.d.ts +5 -2
- package/dist/plugins/remote-env-k8s.js +15 -4
- package/dist/plugins/remote-env-local-docker.d.ts +4 -1
- package/dist/plugins/remote-env-local-docker.js +3 -3
- package/dist/plugins/remote-env-ssh.d.ts +8 -2
- package/dist/plugins/remote-env-ssh.js +26 -24
- package/dist/plugins/remote-shell.d.ts +59 -30
- package/dist/plugins/remote-shell.js +175 -62
- package/dist/plugins/retention-declaration.d.ts +37 -0
- package/dist/plugins/retention-declaration.js +9 -0
- package/dist/plugins/retention-deployment.d.ts +126 -0
- package/dist/plugins/retention-deployment.js +88 -0
- package/dist/plugins/retention-lane-store-sql.d.ts +74 -4
- package/dist/plugins/retention-lane-store-sql.js +103 -1
- package/dist/plugins/retention-sql.d.ts +29 -0
- package/dist/plugins/retention-sql.js +8 -0
- package/dist/plugins/schema-consistency.d.ts +0 -6
- package/dist/plugins/schema-consistency.js +1 -2
- package/dist/plugins/schema-ensure-legs.d.ts +1 -1
- package/dist/plugins/schema-ensure-legs.js +11 -1
- package/dist/plugins/session-ext-table.d.ts +74 -0
- package/dist/plugins/session-ext-table.js +121 -0
- package/dist/plugins/session-fork.d.ts +1 -1
- package/dist/plugins/session-row-sql.d.ts +8 -7
- package/dist/plugins/session-row-sql.js +15 -7
- package/dist/plugins/session-store-sql.d.ts +131 -0
- package/dist/plugins/session-store-sql.js +298 -0
- package/dist/plugins/session-workspace-cell.d.ts +2 -2
- package/dist/plugins/session-workspace-cell.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +10 -0
- package/dist/plugins/shared-memory-store-sql.js +13 -13
- package/dist/plugins/snapshot-bucket-presence.js +1 -1
- package/dist/plugins/sql-driver.d.ts +23 -7
- package/dist/plugins/sql-driver.js +41 -8
- package/dist/plugins/sql-errors.d.ts +5 -2
- package/dist/plugins/sql-errors.js +4 -0
- package/dist/plugins/store-backend.d.ts +35 -8
- package/dist/plugins/store-backend.js +184 -62
- package/dist/plugins/store-contracts.d.ts +9 -2
- package/dist/plugins/store-contracts.js +1 -0
- package/dist/plugins/task-attachment-store.d.ts +6 -8
- package/dist/plugins/task-attachment-store.js +15 -10
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/text-column-capacity.d.ts +21 -0
- package/dist/plugins/text-column-capacity.js +5 -0
- package/dist/plugins/tidb-pool.d.ts +3 -2
- package/dist/plugins/tidb-pool.js +19 -31
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- package/dist/read-face-posture.d.ts +6 -6
- package/dist/read-face-posture.js +2 -2
- package/dist/request-value-closure.d.ts +5 -5
- package/dist/request-value-closure.js +1 -1
- package/dist/rules-consent.d.ts +41 -13
- package/dist/rules-consent.js +101 -53
- package/dist/run-local.js +17 -13
- package/dist/runs.d.ts +48 -30
- package/dist/runs.js +26 -16
- package/dist/runtime-caps-resolver.d.ts +15 -8
- package/dist/runtime-caps-resolver.js +14 -10
- package/dist/sealed-key-layout.d.ts +2 -3
- package/dist/sealed-key-layout.js +0 -1
- package/dist/sealed-key.js +7 -5
- package/dist/security.d.ts +5 -3
- package/dist/sema-config-dir.js +2 -2
- package/dist/server-secret-env.d.ts +2 -0
- package/dist/service-version.d.ts +2 -1
- package/dist/service-version.js +2 -2
- package/dist/session-error-wire.d.ts +1 -1
- package/dist/session-incarnation.d.ts +8 -5
- package/dist/session-resident-background.d.ts +85 -32
- package/dist/session-resident-background.js +75 -7
- package/dist/session-row.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +1 -1
- package/dist/session-workspace.d.ts +11 -2
- package/dist/session-workspace.js +5 -0
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/store-posture.d.ts +2 -1
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +19 -14
- package/dist/stores-sql/blob-index-sql.d.ts +148 -0
- package/dist/stores-sql/blob-index-sql.js +154 -0
- package/dist/stores-sql/checkpoint-store-sql.d.ts +1 -1
- package/dist/stores-sql/checkpoint-store-sql.js +11 -27
- package/dist/{plugins → stores-sql}/file-history-store-sql.d.ts +23 -11
- package/dist/{plugins → stores-sql}/file-history-store-sql.js +23 -18
- package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +23 -76
- package/dist/{plugins → stores-sql}/pg-session-storage.js +80 -209
- package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +123 -217
- package/dist/{plugins → stores-sql}/retention-store-sql.js +66 -190
- package/dist/{plugins → stores-sql}/session-event-payload.d.ts +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.js +1 -1
- package/dist/stores-sql/session-policy-store-sql.d.ts +1 -1
- package/dist/stores-sql/session-write-hooks.d.ts +59 -0
- package/dist/stores-sql/session-write-hooks.js +2 -0
- package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +10 -11
- package/dist/{plugins → stores-sql}/tidb-session-storage.js +10 -21
- package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +32 -122
- package/dist/{plugins → stores-sql}/tidb-session-store.js +71 -171
- package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
- package/dist/stores-sql/tool-result-store-sql.js +1 -1
- package/dist/stores-sql/windowed-session-storage.d.ts +56 -0
- package/dist/stores-sql/windowed-session-storage.js +61 -0
- package/dist/task-a2a.d.ts +7 -1
- package/dist/task-a2a.js +15 -14
- package/dist/task-cwd.d.ts +11 -3
- package/dist/task-cwd.js +17 -1
- package/dist/task-mcp.d.ts +10 -2
- package/dist/task-mcp.js +13 -16
- package/dist/task-settings.d.ts +9 -4
- package/dist/task-settings.js +17 -6
- package/dist/tool-approval.d.ts +21 -8
- package/dist/tool-approval.js +10 -6
- package/dist/trace/core-keyset-guard.d.ts +9 -3
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +2 -0
- package/dist/trace/exit-seat.d.ts +23 -1
- package/dist/trace/exit-seat.js +3 -0
- package/dist/trace/project.d.ts +33 -16
- package/dist/trace/project.js +12 -9
- package/dist/trace/redact.d.ts +1 -1
- package/dist/trace/redact.js +61 -73
- package/dist/trace/self-minted-wire.d.ts +263 -10
- package/dist/trace/self-minted-wire.js +90 -2
- package/dist/trace/sema-provenance.d.ts +45 -41
- package/dist/trace/sema-provenance.js +81 -10
- package/dist/trace/task-notification-facets.d.ts +70 -2
- package/dist/trace/task-notification-facets.js +71 -1
- package/dist/trace/wire-projection-faces.d.ts +38 -2
- package/dist/trace/wire-projection-faces.js +26 -1
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -0
- package/dist/user-input-ledger.d.ts +2 -2
- package/dist/web-admin-client/apply-effective.js +22 -26
- package/dist/web-admin-client/candidate-gate.d.ts +35 -3
- package/dist/web-admin-client/candidate-gate.js +53 -5
- package/dist/web-admin-client/center-request.d.ts +4 -1
- package/dist/web-admin-client/center-request.js +2 -1
- package/dist/web-admin-client/effective-keys.js +0 -1
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/http-client.d.ts +1 -0
- package/dist/web-admin-client/http-client.js +17 -9
- package/dist/web-admin-client/restart-signal.js +5 -2
- package/dist/web-admin-client/skills-mcp.d.ts +20 -6
- package/dist/web-admin-client/skills-mcp.js +26 -21
- package/dist/web-admin-client/types.d.ts +34 -49
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +2 -2
- package/package.json +13 -12
- package/scripts/drain-check-local.mjs +2 -28
- package/scripts/drain-check.mysql.sql +2 -18
- package/scripts/drain-check.pg.sql +2 -18
- package/wire-changes/server@7.147.0.json +813 -0
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import type { TaskNotificationPayload, SemaProvenance, BackgroundChildEvent, RosterEntry, AskRequest, CheckpointSummary, PendingAction, TaskEvent, TraceEvent, MailboxMessage, MailboxAppendMessage, TaskSpec, TaskResult, SideQueryResult, WiringManifest, PermissionModeReceipt, GateOutcome, GateDisposition, Settlement, PausedCause, TerminalCause, CheckpointGate, CheckpointToken, VerificationResult, CascadeRunResult, WorkflowRun, ReadRootGrantCandidate, McpReconnectResult, McpServerStatus, NodeLspManagerOptions, RunnerDeps, SessionMemoryStatus, DeploymentSessionMemoryStatus, PromptManifestIdentity, PromptIdentityLayers, PromptManifestSelectors, PromptManifestSection, PromptChainLink, SupersededOverlay, ToolDisclosureManifest } from "@sema-agent/core";
|
|
21
21
|
import type { ToolApprovalFrame } from "../tool-approval.js";
|
|
22
22
|
import type { TableCoreKeys } from "./projection-table.js";
|
|
23
|
+
import type { ProjectRegistration } from "@sema-agent/settings-schema";
|
|
23
24
|
import type { PauseSeat } from "../terminal.js";
|
|
24
25
|
/** 编译期断言:T 必须收敛到 never(有残余键 = tsc 红)。
|
|
25
26
|
* 🔴 **导出**([ref] U1/U2):本仓「词表闭集,未处置成员=编译红」的钉法只许有**一个**形 ——
|
|
@@ -27,12 +28,12 @@ import type { PauseSeat } from "../terminal.js";
|
|
|
27
28
|
* `type X<T extends never> = T`(抄一份就是第二个写者,两处哪天分岔谁都发现不了)。
|
|
28
29
|
* 本文件只有类型、不产 JS,所以被 `import type` 引用不新增任何运行期边。 */
|
|
29
30
|
export type AssertAllKeysHandled<T extends never> = T;
|
|
30
|
-
type NotificationProjected = "task_id" | "task_type" | "toolUseId" | "status" | "summary" | "result" | "output_file" | "usage" | "sessionId" | "seq" | "lines" | "stoppedBy" | "source" | "exitCode" | "partial" | "diagnostics" | "recentSteps" | "editedFiles" | "resumable" | "completionId" | "error" | "errorCode" | "apiFailure" | "agentMessage" | "_sema_provenance" | "spawnName" | "handback" | "compaction" | "resupplied" | "attempt";
|
|
31
|
+
type NotificationProjected = "task_id" | "task_type" | "toolUseId" | "status" | "summary" | "result" | "output_file" | "usage" | "sessionId" | "seq" | "lines" | "stoppedBy" | "source" | "exitCode" | "partial" | "diagnostics" | "recentSteps" | "editedFiles" | "resumable" | "completionId" | "error" | "errorCode" | "apiFailure" | "agentMessage" | "_sema_provenance" | "spawnName" | "handback" | "compaction" | "resupplied" | "attempt" | "crossSessionMessage" | "crossSessionNotice" | "inboxNotice";
|
|
31
32
|
type NotificationExcluded = (typeof import("./wire-projection-faces.js").WIRE_PROJECTION_FACES)["task_notification"]["excluded"][number];
|
|
32
33
|
type _GuardNotification = AssertAllKeysHandled<Exclude<keyof TaskNotificationPayload, NotificationProjected | NotificationExcluded>>;
|
|
33
34
|
type _GuardNotificationReverse = AssertAllKeysHandled<Exclude<NotificationProjected | NotificationExcluded, keyof TaskNotificationPayload>>;
|
|
34
|
-
type ProvenanceProjected = "kind" | "from" | "taskId" | "seq" | "agentType";
|
|
35
|
-
type ProvenanceExcluded = "
|
|
35
|
+
type ProvenanceProjected = "kind" | "from" | "taskId" | "seq" | "agentType" | "peerMeta";
|
|
36
|
+
type ProvenanceExcluded = (typeof import("./wire-projection-faces.js").WIRE_PROJECTION_FACES)["task_notification_provenance"]["excluded"][number];
|
|
36
37
|
type _GuardProvenance = AssertAllKeysHandled<Exclude<keyof SemaProvenance, ProvenanceProjected | ProvenanceExcluded>>;
|
|
37
38
|
type _GuardProvenanceReverse = AssertAllKeysHandled<Exclude<ProvenanceProjected | ProvenanceExcluded, keyof SemaProvenance>>;
|
|
38
39
|
type AgentMessageProjected = "from" | "body";
|
|
@@ -522,6 +523,9 @@ type WorkspaceChangedArm = Extract<TaskEvent, {
|
|
|
522
523
|
}>;
|
|
523
524
|
type _GuardSessionWorkspace = AssertAllKeysHandled<Exclude<keyof WorkspaceChangedArm, TableCoreKeys<SessionWorkspaceTables["SESSION_WORKSPACE_DISPOSITIONS"]>>>;
|
|
524
525
|
type _GuardSessionWorkspaceReverse = AssertAllKeysHandled<Exclude<TableCoreKeys<SessionWorkspaceTables["SESSION_WORKSPACE_DISPOSITIONS"]>, keyof WorkspaceChangedArm>>;
|
|
526
|
+
type ProjectRegistryTables = typeof import("../http/routes/projects.js");
|
|
527
|
+
type _GuardProjectRow = AssertAllKeysHandled<Exclude<keyof ProjectRegistration, TableCoreKeys<ProjectRegistryTables["PROJECT_ROW_DISPOSITIONS"]>>>;
|
|
528
|
+
type _GuardProjectRowReverse = AssertAllKeysHandled<Exclude<TableCoreKeys<ProjectRegistryTables["PROJECT_ROW_DISPOSITIONS"]>, keyof ProjectRegistration>>;
|
|
525
529
|
export type CoreKeysetGuards = [
|
|
526
530
|
_GuardNotification,
|
|
527
531
|
_GuardTerminalArm,
|
|
@@ -668,6 +672,8 @@ export type CoreKeysetGuards = [
|
|
|
668
672
|
_GuardLedgerRunnerDepsReverse,
|
|
669
673
|
_GuardSessionWorkspace,
|
|
670
674
|
_GuardSessionWorkspaceReverse,
|
|
675
|
+
_GuardProjectRow,
|
|
676
|
+
_GuardProjectRowReverse,
|
|
671
677
|
_GuardTokenSeats,
|
|
672
678
|
_GuardTokenSeatsReverse,
|
|
673
679
|
_GuardGateSeats,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* 同文件 G1 e2e 的全码扇出夹具、以及契约文档附录 D.3 那张表(含**小节标题里的码数** —— 那道门本批
|
|
17
17
|
* 刚立,立完就在下一次加码时自己咬住了)。
|
|
18
18
|
*/
|
|
19
|
-
export declare const ENGINE_NOTICE_WIRE_CODES: readonly ["memory.session_polluted", "memory.harvest_quarantined", "memory.delegation_static_mark_waived", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "task.turn_interrupted", "steering.parked_input_blocked", "task.user_steer_undrained", "task.user_followup_undrained", "memory.capture_opted_out", "memory.capture_optout_unpersisted", "task.halt_unconsumed", "task.late_approval", "config.durable_gate_unavailable", "peer.inbound_disposition", "peer.held_settled", "peer.idle_subscription", "classifier.denial_limit", "mcp.injection_dropped", "delegation.ask_unresolvable", "task.interrupt_unconsumed", "approval.read_root_granted", "approval.read_root_grant_rejected", "instructions.source_changed", "session.lineage_rerooted", "server.model_unreachable", "permission.entry_mode_clamped", "classifier.unavailable", "config.permission_mode_unavailable", "permission.ask_released_by_mode", "permission.read_deny_unapplied", "permission.rule_store_unavailable", "permission.rule_row_dropped", "permission.allowed_tool_not_granted", "task.tool_turn_incomplete", "route.finish_reason_unknown", "route.stream_end_ignored", "route.credential_origin_mismatch", "mods.registration_refused", "config.session_rules_earlier_grammar", "advisor.not_attached", "inherit_env.names_withheld", "model.capability_downgraded", "context.media_removed", "mcp.authorization_required", "classifier.seat_rate_limited", "context.tool_schema_removed", "memory.harvest_refused", "memory.harvest_conflict"];
|
|
19
|
+
export declare const ENGINE_NOTICE_WIRE_CODES: readonly ["memory.session_polluted", "memory.harvest_quarantined", "memory.delegation_static_mark_waived", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "task.turn_interrupted", "steering.parked_input_blocked", "task.user_steer_undrained", "task.user_followup_undrained", "memory.capture_opted_out", "memory.capture_optout_unpersisted", "task.halt_unconsumed", "task.late_approval", "config.durable_gate_unavailable", "peer.inbound_disposition", "peer.held_settled", "peer.idle_subscription", "classifier.denial_limit", "mcp.injection_dropped", "delegation.ask_unresolvable", "task.interrupt_unconsumed", "approval.read_root_granted", "approval.read_root_grant_rejected", "instructions.source_changed", "session.lineage_rerooted", "server.model_unreachable", "permission.entry_mode_clamped", "classifier.unavailable", "config.permission_mode_unavailable", "permission.ask_released_by_mode", "permission.read_deny_unapplied", "permission.rule_store_unavailable", "permission.rule_row_dropped", "permission.allowed_tool_not_granted", "task.tool_turn_incomplete", "route.finish_reason_unknown", "route.stream_end_ignored", "route.credential_origin_mismatch", "mods.registration_refused", "config.session_rules_earlier_grammar", "advisor.not_attached", "inherit_env.names_withheld", "model.capability_downgraded", "context.media_removed", "mcp.authorization_required", "classifier.seat_rate_limited", "context.tool_schema_removed", "memory.harvest_refused", "memory.harvest_conflict", "config.legacy_tool_name"];
|
|
20
20
|
export type EngineNoticeWireCode = (typeof ENGINE_NOTICE_WIRE_CODES)[number];
|
|
21
21
|
/** 白名单谓词(单点):路由与门都读这一个,不许第二处手抄码串。 */
|
|
22
22
|
export declare function isEngineNoticeWireCode(code: string): code is EngineNoticeWireCode;
|
|
@@ -53,6 +53,7 @@ export const ENGINE_NOTICE_WIRE_CODES = [
|
|
|
53
53
|
"context.tool_schema_removed",
|
|
54
54
|
"memory.harvest_refused",
|
|
55
55
|
"memory.harvest_conflict",
|
|
56
|
+
"config.legacy_tool_name",
|
|
56
57
|
];
|
|
57
58
|
const WIRE_CODES = new Set(ENGINE_NOTICE_WIRE_CODES);
|
|
58
59
|
export function isEngineNoticeWireCode(code) {
|
|
@@ -116,6 +117,7 @@ export const RULE_TEXT_DETAIL_FIELDS = {
|
|
|
116
117
|
"permission.allowed_tool_not_granted": { array: "entries", field: "entry" },
|
|
117
118
|
"permission.rule_row_dropped": { array: "rows", field: "rule" },
|
|
118
119
|
"config.session_rules_earlier_grammar": { array: "entries", field: "entry" },
|
|
120
|
+
"config.legacy_tool_name": { array: "entries", field: "entry" },
|
|
119
121
|
};
|
|
120
122
|
export function redactNoticeMessage(message) {
|
|
121
123
|
return redactSecrets(String(message));
|
|
@@ -22,7 +22,14 @@ export type SafeText = string & {
|
|
|
22
22
|
* 进请求面 400 拒句、续跑重放的丢弃行与重读行、名册的跳过行,以及能力读面 `GET /v1/capabilities/mcp` 上引擎整集拒(两台撞同一工具命名空间前缀)的拒句 —— 读者是调用方与运维,句子已是一行;不设界(拒句要说全判官的话),原样出门。
|
|
23
23
|
* · `inbox-diagnostics-text`:`workflow_complete` 补投帧上的诊断教学文本(`diagnostics`)—— 引擎在 workflow 完成通知上铸的「读哪里 / 怎么续跑」文本,入会话收件时洗一次,
|
|
24
24
|
* 店里(`payload` 列)只放出门安全的字节,drain 逐字带出。洗法与 live `task_notification.diagnostics` 同一个 scope(`free-text`);
|
|
25
|
-
* 这一行比 `trace-frame-text` 多一条界(4000 码元,与同族条目的文本位同额)
|
|
25
|
+
* 这一行比 `trace-frame-text` 多一条界(4000 码元,与同族条目的文本位同额),原样出门:逐成员的粗截;整条 `payload` 装不装得下由条目编码座按字节预算终判
|
|
26
|
+
* (`orchestration/workflow-completion-inbox.ts` 的 `encodeInboxBody`,预算 = 最窄后端的 `payload` 列容量,超 ⇒ 最小形 + `payloadTruncated`)。
|
|
27
|
+
* · `inbox-frame-text`:`task_notification` 补投帧(停驻收件、下一次开流 drain)上会话箱车道的自由文本位 —— 三只载体的 `crossSessionMessage.fromName` /
|
|
28
|
+
* `.body`、`crossSessionNotice.text` 与侧记 `_sema_provenance.peerMeta.notice` 的 `recipient` / `target` / `detail` / `dropReason`(别的会话写的或引擎嵌着
|
|
29
|
+
* 别的会话文本渲的句子);入会话收件时经与 live 腿同一只判据(`task-notification-facets.ts` / `sema-provenance.ts`)洗一次,店里(`payload` 列)只放
|
|
30
|
+
* 出门安全的字节,drain 逐字带出。scope 与 live 的 `trace-frame-text` 同(`free-text`),多一条界(4000 码元,与同族条目既有文本位 `result` /
|
|
31
|
+
* `agentMessage.body` 同额),原样出门。这条界是**逐成员**的粗截:多枚文本位相加、JSON 转义放大(控制字符一枚 6 字节)后的总和由条目编码座按
|
|
32
|
+
* 整条字节预算终判(`encodeInboxBody`;同上行),本行只挡一枚文本独自变长。
|
|
26
33
|
* · `boot-refusal-line`:起服拒启的一行拒句 —— 部署座装配的拒句(`mods-declaration.ts`:声明的席名、包名、读包者 / 引擎准入交回的话);它经进程级 fatal 出口原样多行进 stderr,
|
|
27
34
|
* 所以必须在这里先压成一行(一句拒因里的换行会在运维的终端里伪造出第二条日志行);界 512 码元(含截断记号)。
|
|
28
35
|
* · `workflow-recovery-summary`:workflow 完成通知在崩溃恢复路径上由 run 行的错误文本合成的摘要(`summary`;`orchestration/workflow-notify-journal.ts` 的 `recoverySummary`)——
|
|
@@ -31,6 +38,10 @@ export type SafeText = string & {
|
|
|
31
38
|
* · `peer-inbound-card-text`:运维审批队列 `peer_inbound` 行(`GET /v1/approvals` 的 `pending[]` 与 `/v1/approvals/stream` 的 `pending` 帧)上被扣跨会话来信的
|
|
32
39
|
* 存储正文(`content`,core 的规范存储形 `[summary] message`)与发信方显示名(`fromName`)—— 别的会话写的自由文本,读者是收信方本人;不设界(core 存的那一份就是
|
|
33
40
|
* 收信方要审的全文,截了就审不全),原样出门(JSON 串值,消费方自己渲染)。
|
|
41
|
+
* · `rewind-ledger-path`:run 外回退口(`POST /v1/sessions/:id/rewind-files`)200 体上被跟踪文件的路径(台账与预览的 `filesChanged` / `identicalSkipped` /
|
|
42
|
+
* `refused[].path` / `failed[].path`;源头是模型交的路径参数)—— 不设界(截过的路径就不是那个文件了,消费方要拿它去对文件),原样出门。
|
|
43
|
+
* · `rewind-ledger-reason`:同一口台账上的拒因 / 故障句(`refused[].reason` / `failed[].reason` / `error.message`;引擎与文件历史店写的、可能带着抛出物原文)——
|
|
44
|
+
* 界 500 码元,原样出门(JSON 串值,消费方自己渲染)。
|
|
34
45
|
*/
|
|
35
46
|
declare const EXIT_SEATS: {
|
|
36
47
|
readonly "trace-frame-text": {
|
|
@@ -76,6 +87,10 @@ declare const EXIT_SEATS: {
|
|
|
76
87
|
readonly scope: "free-text";
|
|
77
88
|
readonly maxChars: 4000;
|
|
78
89
|
};
|
|
90
|
+
readonly "inbox-frame-text": {
|
|
91
|
+
readonly scope: "free-text";
|
|
92
|
+
readonly maxChars: 4000;
|
|
93
|
+
};
|
|
79
94
|
readonly "boot-refusal-line": {
|
|
80
95
|
readonly scope: "free-text";
|
|
81
96
|
readonly maxChars: 512;
|
|
@@ -87,6 +102,13 @@ declare const EXIT_SEATS: {
|
|
|
87
102
|
readonly "workflow-recovery-summary": {
|
|
88
103
|
readonly scope: "diagnostic";
|
|
89
104
|
};
|
|
105
|
+
readonly "rewind-ledger-path": {
|
|
106
|
+
readonly scope: "free-text";
|
|
107
|
+
};
|
|
108
|
+
readonly "rewind-ledger-reason": {
|
|
109
|
+
readonly scope: "free-text";
|
|
110
|
+
readonly maxChars: 500;
|
|
111
|
+
};
|
|
90
112
|
};
|
|
91
113
|
export type ExitSeat = keyof typeof EXIT_SEATS;
|
|
92
114
|
/** 设了界的座名。 */
|
package/dist/trace/exit-seat.js
CHANGED
|
@@ -15,9 +15,12 @@ const EXIT_SEATS = {
|
|
|
15
15
|
"mcp-remote-text": { scope: "free-text", maxChars: 200 },
|
|
16
16
|
"peer-declaration-sentence": { scope: "free-text" },
|
|
17
17
|
"inbox-diagnostics-text": { scope: "free-text", maxChars: 4000 },
|
|
18
|
+
"inbox-frame-text": { scope: "free-text", maxChars: 4000 },
|
|
18
19
|
"boot-refusal-line": { scope: "free-text", maxChars: 512, emit: "log-line" },
|
|
19
20
|
"peer-inbound-card-text": { scope: "free-text" },
|
|
20
21
|
"workflow-recovery-summary": { scope: "diagnostic" },
|
|
22
|
+
"rewind-ledger-path": { scope: "free-text" },
|
|
23
|
+
"rewind-ledger-reason": { scope: "free-text", maxChars: 500 },
|
|
21
24
|
};
|
|
22
25
|
export function seatMaxChars(seat) {
|
|
23
26
|
return EXIT_SEATS[seat].maxChars;
|
package/dist/trace/project.d.ts
CHANGED
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import type { GateOutcome, McpDelivered, TaskResult, SystemInjectionPriority } from "@sema-agent/core";
|
|
27
27
|
import type { RunEvent, RunRecord } from "../plugins/store-contracts.js";
|
|
28
|
-
import type { ModelUsageDelta, ModelUsageTracker,
|
|
29
|
-
import type { RunCompanionRecord } from "../observability/prompt-manifest.js";
|
|
28
|
+
import type { ModelUsageDelta, ModelUsageTracker, PromptManifestTracker } from "../budget.js";
|
|
30
29
|
import { type SafeText } from "./exit-seat.js";
|
|
31
|
-
import { type
|
|
30
|
+
import { type SemaProvenanceWire } from "./sema-provenance.js";
|
|
31
|
+
import { type CrossSessionMessageWire, type CrossSessionNoticeWire } from "./task-notification-facets.js";
|
|
32
32
|
import { type ExtensionRequesterFace, type ToolInputRewriteFace } from "./extension-call-face.js";
|
|
33
33
|
import type { LedgerEventType, ParkLedgerEventType } from "./ledger-events.js";
|
|
34
34
|
import type { InstructionsSegment } from "../instruction-selection.js";
|
|
@@ -47,15 +47,23 @@ type GetEventsFn = (taskId: string, afterSeq: number) => Promise<RunEvent[]>;
|
|
|
47
47
|
* apart rows written under the current component semantics from older rows (pre-dating this label) when it
|
|
48
48
|
* sums across a run's whole event log. */
|
|
49
49
|
export declare function appendModelUsageDelta(append: AppendFn, modelUsage: ModelUsageTracker | undefined, taskId: string): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
/** 一条腿在 run 级清单 / 伴随记录队列上的那一席(产物带方法 ⇒ `create*`)。 */
|
|
51
|
+
export interface PromptManifestSeat {
|
|
52
|
+
/** 把这条腿已排队的清单行与伴随记录(按发射序)落进**这条腿的**账本写口;无待落 ⇒ 零 I/O(一次 Map 读),所以腿可以在每一帧之前调。 */
|
|
53
|
+
drain(append: AppendFn): Promise<void>;
|
|
54
|
+
/** 收摊:只在本席仍持租约时注销并丢弃未排空的记录(B-3 窗:一条快的兄弟续跑腿可能已经以同一 taskId 重新登记,那一席归它)。幂等。 */
|
|
55
|
+
release(): void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* **写账本的腿登记 run 级清单 / 伴随记录队列的唯一一只登记器**(`prompt_assembled` / `config_assembled` / `cross_boundary_taint` 三种行同一只队列)。
|
|
59
|
+
*
|
|
60
|
+
* 一条律:**有账本的腿就有这一席** —— bg 首跑(`runs.ts`)、续跑两径(`http/resume-legs.ts`)、同步流腿(`http/routes/tasks.ts`,有 durable run 行即有账本)
|
|
61
|
+
* 都经这一只:建席 = 登记(tracer 的 `record` / `recordCompanion` 只收已登记的顶层 run,子代永不登记)、`drain` = 落本腿账本、`release` = 带租约收摊。
|
|
62
|
+
* 腿只决定**在哪几拍排空**(每一帧之前 / 终局行之前),不再各写一份「登记 → 排空 → 租约清」—— 7.147.0 之前同步流腿漏了这一席,
|
|
63
|
+
* 它的账本因此一行清单 / 伴随记录都没有。非流式 `POST /v1/tasks` 结构上没有账本(契约 KL),没有这一席。
|
|
64
|
+
* `tracker` 缺席(部署没接)⇒ 席是空操作。
|
|
65
|
+
*/
|
|
66
|
+
export declare function createPromptManifestSeat(tracker: PromptManifestTracker | undefined, taskId: string): PromptManifestSeat;
|
|
59
67
|
/** E8: at a TERMINAL done — flush the final delta, then SUM all `model_usage` events (every process leg) into the
|
|
60
68
|
* result's `stats.modelUsage` echo. Returns the result unchanged when no usage was tracked (shell soft-degrades). */
|
|
61
69
|
export declare function attachModelUsage<T extends TaskResult>(result: T, ctx: {
|
|
@@ -538,9 +546,12 @@ export declare function taskNotificationEventData(ev: {
|
|
|
538
546
|
body: string;
|
|
539
547
|
};
|
|
540
548
|
/** 同批:typed 归因侧记(wire 键;core 契约「a host projects it, the model never sees it」)。成员逐个挑取,
|
|
541
|
-
* `kind`
|
|
542
|
-
|
|
543
|
-
|
|
549
|
+
* `kind` 过闭集、`peerMeta` 逐成员(`trace/sema-provenance.ts` 单点,park 半场同一判据;入参按 `unknown` 收、判过形才成 typed)。 */
|
|
550
|
+
_sema_provenance?: unknown;
|
|
551
|
+
/** [ref]:会话箱车道的三只载体 —— 判据单点在 `trace/task-notification-facets.ts`(与 park 半场同一只;入参按 `unknown` 收)。 */
|
|
552
|
+
crossSessionMessage?: unknown;
|
|
553
|
+
crossSessionNotice?: unknown;
|
|
554
|
+
inboxNotice?: unknown;
|
|
544
555
|
/** core 7.30.0 [ref] S1 / [ref] / [ref]([ref]):委派终态帧三枚 facet + 重供两键 —— 判据单点在
|
|
545
556
|
* `trace/task-notification-facets.ts`(与 park 半场同一只;入参按 `unknown` 收、判过形才成 typed)。 */
|
|
546
557
|
spawnName?: string;
|
|
@@ -580,6 +591,9 @@ export declare function taskNotificationEventData(ev: {
|
|
|
580
591
|
from: string;
|
|
581
592
|
body: SafeText;
|
|
582
593
|
};
|
|
594
|
+
_sema_provenance?: SemaProvenanceWire;
|
|
595
|
+
crossSessionMessage?: CrossSessionMessageWire;
|
|
596
|
+
crossSessionNotice?: CrossSessionNoticeWire;
|
|
583
597
|
}>;
|
|
584
598
|
/** The `compacted` payload — EXPLICIT WHITELIST shared by all three legs (bg runs.ts + resume append + the sync
|
|
585
599
|
* live SSE frame; the 1.72 task_progress lesson: never `{...ev}`). trigger/tokensBefore (MF-18) verbatim;
|
|
@@ -1166,7 +1180,10 @@ export declare function contextUsageEventData(ev: {
|
|
|
1166
1180
|
* trace SSE `GET /v1/tasks/:id/stream` 上是 `cross-boundary-taint` 帧,按存下的行原样交出)。帧只在**执行于目标设备的树**上发(武装腿 prepare / 续跑腿 resume 各一帧,离目标读第一次放进树时 observed 一帧),
|
|
1167
1181
|
* 宿主车道零帧 ⇒ 本行在宿主车道上永不出现。纯元数据(core 逐字「Metadata only」):树的污染位(`taint`,core `CROSS_BOUNDARY_TAINT_BITS` 的子集)、
|
|
1168
1182
|
* 树是否受治理(`governed`)、阶段(`phase`)、腿的 `runId`,observed 时那一只调用(`toolName` / `toolCallId`)。
|
|
1169
|
-
* 信封(`kind` / `version` / `taskId` / `ts`)
|
|
1183
|
+
* 信封(`kind` / `version` / `taskId` / `ts`)不上行:账本行自带 seq / ts(`RunEvent`),行种类由账本行名说;`taskId` 不上行,是因为落进来的帧都是已登记的顶层 run 发的 ——
|
|
1184
|
+
* 落账处 `PromptManifestTracker.recordCompanion` 只收已登记的 `taskId`(与清单行同一只登记门;`createPromptManifestSeat` 建席即登记,子代永不登记),行落进的就是这条 `taskId` 自己的账本,
|
|
1185
|
+
* 所以根腿发的帧它就是 run;委派子代腿发的帧 `taskId` 是**子代腿自己的 id**(不是根 run)、未登记 ⇒ 落账处不收,这类帧今天落不进根 run 的账本
|
|
1186
|
+
* (契约 §4a-cbt「读法」的限定;根归属候引擎给帧加根地址键)。登记表 `cross_boundary_taint` 行(`trace/wire-projection-faces.ts`)是同一句读法。
|
|
1170
1187
|
* 值:`taint` 交一份数组副本(只收串);`toolName` / `toolCallId` 在场才铸。词按开集串过境(属主是引擎的闭集;本仓不判词表)。
|
|
1171
1188
|
*/
|
|
1172
1189
|
export declare function crossBoundaryTaintEventData(ev: {
|
package/dist/trace/project.js
CHANGED
|
@@ -7,8 +7,8 @@ import { seatText } from "./exit-seat.js";
|
|
|
7
7
|
import { sanitizeWireText } from "./engine-notice-wire.js";
|
|
8
8
|
import { projectToolOutput, projectToolStructured } from "./tool-output-media.js";
|
|
9
9
|
import { injectionTierOrAbsent } from "./injection-tier.js";
|
|
10
|
-
import {
|
|
11
|
-
import { resupplyFields, terminalFrameFacetFields } from "./task-notification-facets.js";
|
|
10
|
+
import { semaProvenanceFields } from "./sema-provenance.js";
|
|
11
|
+
import { resupplyFields, sessionBoxCarrierFields, terminalFrameFacetFields } from "./task-notification-facets.js";
|
|
12
12
|
import { dropProjectedFace } from "./projection-drop.js";
|
|
13
13
|
import { extensionAnswererOf, extensionRequesterOf, toolInputRewriteOf } from "./extension-call-face.js";
|
|
14
14
|
import { projectByTable } from "./projection-table.js";
|
|
@@ -23,7 +23,7 @@ export async function appendModelUsageDelta(append, modelUsage, taskId) {
|
|
|
23
23
|
await append("model_usage", { usage: tagged });
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
async function appendPromptManifest(append, tracker, taskId) {
|
|
27
27
|
const records = tracker?.drain(taskId);
|
|
28
28
|
if (records)
|
|
29
29
|
for (const m of records)
|
|
@@ -33,6 +33,13 @@ export async function appendPromptManifest(append, tracker, taskId) {
|
|
|
33
33
|
for (const c of companions)
|
|
34
34
|
await append(c.type, c.data);
|
|
35
35
|
}
|
|
36
|
+
export function createPromptManifestSeat(tracker, taskId) {
|
|
37
|
+
const lease = tracker?.register(taskId) ?? 0;
|
|
38
|
+
return {
|
|
39
|
+
drain: (append) => appendPromptManifest(append, tracker, taskId),
|
|
40
|
+
release: () => tracker?.clear(taskId, lease),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
36
43
|
export async function attachModelUsage(result, ctx) {
|
|
37
44
|
if (!ctx.modelUsage)
|
|
38
45
|
return result;
|
|
@@ -398,14 +405,10 @@ export function taskNotificationEventData(ev) {
|
|
|
398
405
|
...(n.output_file !== undefined ? { output_file: seatText("trace-frame-text", n.output_file) } : {}),
|
|
399
406
|
...(n.usage !== undefined ? { usage: n.usage } : {}),
|
|
400
407
|
...(n.agentMessage !== undefined ? { agentMessage: { from: n.agentMessage.from, body: seatText("trace-frame-text", n.agentMessage.body) } } : {}),
|
|
401
|
-
...(
|
|
402
|
-
if (n._sema_provenance === undefined)
|
|
403
|
-
return {};
|
|
404
|
-
const p = semaProvenanceOrAbsent(n._sema_provenance);
|
|
405
|
-
return p !== undefined ? { _sema_provenance: p } : {};
|
|
406
|
-
})(),
|
|
408
|
+
...semaProvenanceFields(n, "trace-frame-text"),
|
|
407
409
|
...terminalFrameFacetFields(n),
|
|
408
410
|
...resupplyFields(n),
|
|
411
|
+
...sessionBoxCarrierFields(n, "trace-frame-text"),
|
|
409
412
|
...(() => {
|
|
410
413
|
const tier = injectionTierOrAbsent(ev.priority);
|
|
411
414
|
return tier !== undefined ? { priority: tier } : {};
|
package/dist/trace/redact.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare function resetArmPoolBudgetForTest(): void;
|
|
|
58
58
|
* 自由文本语法」这条**判据**上它们本就不该被排除(踢掉是另一条理由),不是因为它们在这里还起作用。
|
|
59
59
|
*
|
|
60
60
|
* · `"diagnostic"`:诊断面 —— 由错误文本合成、给人读的失败句(workflow 恢复摘要)。多遮一个字只是一句诊断少一截,少遮一个字是凭据明文,
|
|
61
|
-
* 所以这一档 = 自由文本档**全员** + 只在这一档在场的**诊断值位臂**({@link collectDiagnosticValueSpans}
|
|
61
|
+
* 所以这一档 = 自由文本档**全员** + 只在这一档在场的**诊断值位臂**({@link collectDiagnosticValueSpans}:凭据名 / `Basic`·`Bearer` 方案词后面的值,
|
|
62
62
|
* 不设强度门)。它是诊断面的那一读归进同一只脱敏器的落点:读的是同一张名表、同一个候选池、同一条并集律,出口经出口座的诊断行。
|
|
63
63
|
*
|
|
64
64
|
* 闭集:加一个档而不在 {@link armPool} 的档表里处置 ⇒ **编译**红。
|
package/dist/trace/redact.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { REDACTION_MARK, displayUrlOf, stripFormatCharacters } from "@sema-agent/core";
|
|
2
|
-
import { CONTROL_AND_BIDI_CHARS, CREDENTIAL_PARAM_NAMES, isHierarchicalUrl } from "@sema-agent/settings-schema";
|
|
2
|
+
import { CONTROL_AND_BIDI_CHARS, CREDENTIAL_PARAM_NAMES, credentialParamWordOf, isHierarchicalUrl } from "@sema-agent/settings-schema";
|
|
3
3
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
4
4
|
const normalizeForRedaction = stripFormatCharacters;
|
|
5
5
|
export function mapNormalizedToOriginal(text, normalized) {
|
|
@@ -1070,14 +1070,9 @@ const CREDENTIAL_NAME_ANCHORS = {
|
|
|
1070
1070
|
"x-amz-signature": "declarative", "x-amz-security-token": "declarative", "x-amz-credential": "declarative",
|
|
1071
1071
|
sas: "structure-only",
|
|
1072
1072
|
};
|
|
1073
|
-
const CREDENTIAL_NAME_ALT = (() => {
|
|
1074
|
-
for (const w of CREDENTIAL_PARAM_NAMES) {
|
|
1075
|
-
if (!/^[a-z][a-z0-9_-]*$/.test(w))
|
|
1076
|
-
throw new Error(`redact: credential name ${JSON.stringify(w)} must be lowercase [a-z0-9_-] (the alternation is built without escaping)`);
|
|
1077
|
-
}
|
|
1078
|
-
return [...CREDENTIAL_PARAM_NAMES].sort((a, b) => b.length - a.length || (a < b ? -1 : 1)).join("|");
|
|
1079
|
-
})();
|
|
1080
1073
|
const CREDENTIAL_NAME_MAX = Math.max(...CREDENTIAL_PARAM_NAMES.map((w) => w.length));
|
|
1074
|
+
const JSON_FIELD_NAME_CLASS = "[A-Za-z0-9_.-]";
|
|
1075
|
+
const isJsonFieldNameCode = (c) => isAsciiAlnumCode(c) || c === CH_UNDERSCORE || c === CH_MINUS || c === CH_DOT;
|
|
1081
1076
|
const JSON_FIELD_QUOTE_FORMS = ['"', '\\"', '\\\\\\"'];
|
|
1082
1077
|
for (let d = 0; d < JSON_FIELD_QUOTE_FORMS.length; d++) {
|
|
1083
1078
|
if (JSON_FIELD_QUOTE_FORMS[d] !== "\\".repeat(2 ** d - 1) + '"')
|
|
@@ -1096,15 +1091,26 @@ function buildJsonSecretFieldSource() {
|
|
|
1096
1091
|
q = b + q;
|
|
1097
1092
|
b = b + b;
|
|
1098
1093
|
}
|
|
1099
|
-
alts.push(String.raw `(${q}(
|
|
1094
|
+
alts.push(String.raw `(${q}(${JSON_FIELD_NAME_CLASS}+)${q}\s*:\s*)${q}(?:${o}|${l}|${b}(?:${o}|${b}|${q}))*${q}`);
|
|
1100
1095
|
}
|
|
1101
1096
|
return alts.join("|");
|
|
1102
1097
|
}
|
|
1103
1098
|
const asciiLower = (s) => s.replace(/[A-Z]/g, (c) => c.toLowerCase());
|
|
1104
1099
|
function credentialNameAnchor(name) {
|
|
1105
|
-
|
|
1100
|
+
let word = CREDENTIAL_WORD_MEMO.get(name);
|
|
1101
|
+
if (word === undefined) {
|
|
1102
|
+
word = credentialParamWordOf(name) ?? null;
|
|
1103
|
+
if (name.length <= CREDENTIAL_WORD_MEMO_NAME_MAX) {
|
|
1104
|
+
if (CREDENTIAL_WORD_MEMO.size >= CREDENTIAL_WORD_MEMO_SIZE)
|
|
1105
|
+
CREDENTIAL_WORD_MEMO.clear();
|
|
1106
|
+
CREDENTIAL_WORD_MEMO.set(name, word);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
return word === null ? undefined : CREDENTIAL_NAME_ANCHORS[word];
|
|
1106
1110
|
}
|
|
1107
|
-
const
|
|
1111
|
+
const CREDENTIAL_WORD_MEMO = new Map();
|
|
1112
|
+
const CREDENTIAL_WORD_MEMO_SIZE = 1024;
|
|
1113
|
+
const CREDENTIAL_WORD_MEMO_NAME_MAX = 64;
|
|
1108
1114
|
const BARE_WORD_READINGS = {
|
|
1109
1115
|
null: "absent-or-boolean", nil: "absent-or-boolean", none: "absent-or-boolean", undefined: "absent-or-boolean",
|
|
1110
1116
|
true: "absent-or-boolean", false: "absent-or-boolean", yes: "absent-or-boolean", no: "absent-or-boolean",
|
|
@@ -1882,46 +1888,26 @@ const isRegexSpace = (c) => c === 32 || (c >= 9 && c <= 13) || c === 0xa0 || c =
|
|
|
1882
1888
|
const isLineTerminator = (c) => c === 10 || c === 13 || c === 0x2028 || c === 0x2029;
|
|
1883
1889
|
const isControlCode = (c) => c < 0x20 || c === 0x7f;
|
|
1884
1890
|
const TOKEN_UNIT_Y = new RegExp(REDACTION_TOKEN_RE_SRC, "y");
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
let
|
|
1888
|
-
for (let i = 0; i < name.length; i++) {
|
|
1889
|
-
const c = name.charCodeAt(i);
|
|
1890
|
-
if (c !== 37) {
|
|
1891
|
-
out += name[i];
|
|
1892
|
-
continue;
|
|
1893
|
-
}
|
|
1894
|
-
const hex = name.slice(i + 1, i + 3);
|
|
1895
|
-
if (hex.length !== 2 || !/^[0-9A-Fa-f]{2}$/.test(hex))
|
|
1896
|
-
return undefined;
|
|
1897
|
-
const b = Number.parseInt(hex, 16);
|
|
1898
|
-
if (b >= 0x80)
|
|
1899
|
-
return undefined;
|
|
1900
|
-
out += String.fromCharCode(b);
|
|
1901
|
-
i += 2;
|
|
1902
|
-
}
|
|
1903
|
-
return out;
|
|
1904
|
-
}
|
|
1905
|
-
function credentialParamValueStart(text, p) {
|
|
1906
|
-
const limit = Math.min(text.length, p + CREDENTIAL_NAME_SCAN_MAX);
|
|
1907
|
-
let hasPct = false;
|
|
1908
|
-
for (let i = p; i < limit; i++) {
|
|
1891
|
+
function credentialParamValueStart(text, p, json) {
|
|
1892
|
+
let encoded = false;
|
|
1893
|
+
for (let i = p; i < text.length; i++) {
|
|
1909
1894
|
const c = text.charCodeAt(i);
|
|
1910
|
-
if (c === 37) {
|
|
1911
|
-
hasPct = true;
|
|
1912
|
-
continue;
|
|
1913
|
-
}
|
|
1914
1895
|
if (c === CH_EQ) {
|
|
1915
1896
|
if (i === p)
|
|
1916
1897
|
return -1;
|
|
1917
|
-
const
|
|
1918
|
-
return
|
|
1898
|
+
const raw = text.slice(p, i);
|
|
1899
|
+
return credentialNameAnchor(encoded ? receiverParamName(raw) : raw) !== undefined ? i + 1 : -1;
|
|
1919
1900
|
}
|
|
1920
|
-
if (
|
|
1901
|
+
if (c === 63 || c === 38 || c === 35 || isRegexSpace(c) || isControlCode(c) || (json && c === 34))
|
|
1921
1902
|
return -1;
|
|
1903
|
+
if (c === 37 || c === 43)
|
|
1904
|
+
encoded = true;
|
|
1922
1905
|
}
|
|
1923
1906
|
return -1;
|
|
1924
1907
|
}
|
|
1908
|
+
function receiverParamName(raw) {
|
|
1909
|
+
return new URLSearchParams(`${raw}=`).keys().next().value ?? raw;
|
|
1910
|
+
}
|
|
1925
1911
|
function tokenUnitEnd(text, p) {
|
|
1926
1912
|
TOKEN_UNIT_Y.lastIndex = p;
|
|
1927
1913
|
return TOKEN_UNIT_Y.test(text) ? TOKEN_UNIT_Y.lastIndex : -1;
|
|
@@ -2975,7 +2961,7 @@ function collectUrlCredentialSpans(scan, text, json, span, isHead) {
|
|
|
2975
2961
|
const c = text.charCodeAt(i);
|
|
2976
2962
|
if (c !== 63 && c !== 38 && c !== 35)
|
|
2977
2963
|
continue;
|
|
2978
|
-
const valueStart = credentialParamValueStart(text, i + 1);
|
|
2964
|
+
const valueStart = credentialParamValueStart(text, i + 1, json);
|
|
2979
2965
|
if (valueStart < 0)
|
|
2980
2966
|
continue;
|
|
2981
2967
|
while (qc < ppn && pp[qc] < i)
|
|
@@ -3024,7 +3010,7 @@ function collectUrlCredentialSpans(scan, text, json, span, isHead) {
|
|
|
3024
3010
|
scan.footHi = armHi;
|
|
3025
3011
|
}
|
|
3026
3012
|
const JSON_FIELD_ANCHOR = '"';
|
|
3027
|
-
const
|
|
3013
|
+
const JSON_FIELD_HEAD_MAX = Math.max(...JSON_FIELD_QUOTE_FORMS.map((f) => f.length));
|
|
3028
3014
|
function jsonSecretFieldValueQuoteAt(text, p, depth) {
|
|
3029
3015
|
const form = JSON_FIELD_QUOTE_FORMS[depth];
|
|
3030
3016
|
const n = text.length;
|
|
@@ -3032,10 +3018,8 @@ function jsonSecretFieldValueQuoteAt(text, p, depth) {
|
|
|
3032
3018
|
let i = nameFrom;
|
|
3033
3019
|
for (; i < n; i++) {
|
|
3034
3020
|
const c = text.charCodeAt(i);
|
|
3035
|
-
if (!(
|
|
3021
|
+
if (!isJsonFieldNameCode(c))
|
|
3036
3022
|
break;
|
|
3037
|
-
if (i - nameFrom >= CREDENTIAL_NAME_MAX)
|
|
3038
|
-
return -1;
|
|
3039
3023
|
}
|
|
3040
3024
|
if (i === nameFrom || !text.startsWith(form, i) || credentialNameAnchor(text.slice(nameFrom, i)) === undefined)
|
|
3041
3025
|
return -1;
|
|
@@ -3119,7 +3103,7 @@ function collectJsonSecretFieldSpans(text, span, isHead) {
|
|
|
3119
3103
|
let from = 0;
|
|
3120
3104
|
for (let p = text.indexOf(JSON_FIELD_ANCHOR); p >= 0;) {
|
|
3121
3105
|
let run = 0;
|
|
3122
|
-
while (run <
|
|
3106
|
+
while (run < JSON_FIELD_HEAD_MAX - 1 && p - run - 1 >= from && text.charCodeAt(p - run - 1) === CH_BACKSLASH)
|
|
3123
3107
|
run += 1;
|
|
3124
3108
|
let next = -1;
|
|
3125
3109
|
for (let d = JSON_FIELD_QUOTE_FORMS.length - 1; d >= 0 && next < 0; d--) {
|
|
@@ -3134,7 +3118,7 @@ function collectJsonSecretFieldSpans(text, span, isHead) {
|
|
|
3134
3118
|
const open = found === STRING_OPEN;
|
|
3135
3119
|
const end = open ? text.length : found;
|
|
3136
3120
|
span(q, end, q, open ? NOT_CLOSED : end - form.length, open, JSON_FIELD_VALUE_REPLS[d]);
|
|
3137
|
-
from = scanResumeAfterHit(start, end,
|
|
3121
|
+
from = scanResumeAfterHit(start, end, end - q);
|
|
3138
3122
|
next = text.indexOf(JSON_FIELD_ANCHOR, from);
|
|
3139
3123
|
if (next < 0)
|
|
3140
3124
|
return;
|
|
@@ -3245,16 +3229,13 @@ function anchorHeadAt(scan, text, op, json) {
|
|
|
3245
3229
|
i -= quoteLen;
|
|
3246
3230
|
}
|
|
3247
3231
|
const nameEnd = i + 1;
|
|
3248
|
-
const floor = Math.max(-1, i - (CREDENTIAL_NAME_MAX + 2));
|
|
3249
3232
|
let j = i;
|
|
3250
|
-
while (j
|
|
3233
|
+
while (j >= 0 && isIdentCode(text.charCodeAt(j)))
|
|
3251
3234
|
j -= 1;
|
|
3252
3235
|
anchoredScanUnits += nameEnd - (j + 1);
|
|
3253
3236
|
const bound = j + 1 < nameEnd ? nameBoundAt(scan, Math.max(j, 0), nameEnd) : -1;
|
|
3254
3237
|
if (bound > j)
|
|
3255
3238
|
j = bound - 1;
|
|
3256
|
-
else if (j === floor && j >= 0 && isIdentCode(text.charCodeAt(j)))
|
|
3257
|
-
return undefined;
|
|
3258
3239
|
let nameStart = j + 1;
|
|
3259
3240
|
let afterEscape = false;
|
|
3260
3241
|
if (j >= 0 && text.charCodeAt(j) === CH_BACKSLASH && escapedAt(text, j + 1)) {
|
|
@@ -3763,6 +3744,7 @@ function collectDiagnosticValueSpans(text, json, span, isHead, deletedAt) {
|
|
|
3763
3744
|
};
|
|
3764
3745
|
const skipBlank = (from) => readRun(from, isRegexSpace);
|
|
3765
3746
|
let valueEnd = 0;
|
|
3747
|
+
let plainEnd = 0;
|
|
3766
3748
|
let nextEq = text.indexOf("=");
|
|
3767
3749
|
let nextColon = text.indexOf(":");
|
|
3768
3750
|
while (nextEq >= 0 || nextColon >= 0) {
|
|
@@ -3775,26 +3757,23 @@ function collectDiagnosticValueSpans(text, json, span, isHead, deletedAt) {
|
|
|
3775
3757
|
op = nextColon;
|
|
3776
3758
|
nextColon = text.indexOf(":", op + 1);
|
|
3777
3759
|
}
|
|
3778
|
-
|
|
3779
|
-
continue;
|
|
3760
|
+
const inValue = op + 1 < plainEnd;
|
|
3780
3761
|
let e = op;
|
|
3781
3762
|
while (e > 0 && isRegexSpace(text.charCodeAt(e - 1)))
|
|
3782
3763
|
e -= 1;
|
|
3783
3764
|
diagnosticScanUnits += op - e;
|
|
3784
3765
|
if (e === 0 || !isRegexWordCode(text.charCodeAt(e - 1)))
|
|
3785
3766
|
continue;
|
|
3786
|
-
const floor = Math.max(0, e - CREDENTIAL_NAME_MAX - 1);
|
|
3787
3767
|
let runStart = e;
|
|
3788
|
-
while (runStart >
|
|
3768
|
+
while (runStart > 0 && isDiagnosticNameCode(text.charCodeAt(runStart - 1)))
|
|
3789
3769
|
runStart -= 1;
|
|
3790
3770
|
diagnosticScanUnits += e - runStart;
|
|
3791
|
-
const runOpen = runStart === floor && floor > 0 && isDiagnosticNameCode(text.charCodeAt(floor - 1));
|
|
3792
3771
|
let nameStart = -1;
|
|
3793
3772
|
let nameTier;
|
|
3794
|
-
for (let q = runStart; q < e && nameStart < 0; q
|
|
3795
|
-
if (
|
|
3773
|
+
for (let q = runStart; q < e && nameStart < 0; q = q === runStart ? Math.max(runStart + 1, e - CREDENTIAL_NAME_MAX) : q + 1) {
|
|
3774
|
+
if (!isRegexWordCode(text.charCodeAt(q)))
|
|
3796
3775
|
continue;
|
|
3797
|
-
const bounded =
|
|
3776
|
+
const bounded = q === runStart || text.charCodeAt(q - 1) === CH_MINUS || deletedAt(q) !== "none";
|
|
3798
3777
|
const tier = bounded ? credentialNameAnchor(text.slice(q, e)) : undefined;
|
|
3799
3778
|
if (tier !== undefined && diagnosticNameSlot(tier)) {
|
|
3800
3779
|
nameStart = q;
|
|
@@ -3803,18 +3782,27 @@ function collectDiagnosticValueSpans(text, json, span, isHead, deletedAt) {
|
|
|
3803
3782
|
}
|
|
3804
3783
|
if (nameStart < 0)
|
|
3805
3784
|
continue;
|
|
3806
|
-
let s
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3785
|
+
let s;
|
|
3786
|
+
let end;
|
|
3787
|
+
if (inValue) {
|
|
3788
|
+
s = op + 1;
|
|
3789
|
+
end = plainEnd;
|
|
3811
3790
|
}
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3791
|
+
else {
|
|
3792
|
+
s = skipBlank(op + 1);
|
|
3793
|
+
if (s < n) {
|
|
3794
|
+
const unit = readTextUnit(text, s, json);
|
|
3795
|
+
if (unitChOf(unit) === CH_QUOTE)
|
|
3796
|
+
s += unitLenOf(unit);
|
|
3797
|
+
}
|
|
3798
|
+
if (s >= n) {
|
|
3799
|
+
if (isHead)
|
|
3800
|
+
span(nameStart, n, op, NOT_CLOSED, true);
|
|
3801
|
+
continue;
|
|
3802
|
+
}
|
|
3803
|
+
end = readRun(s, isDiagnosticValueUnit);
|
|
3804
|
+
plainEnd = end;
|
|
3816
3805
|
}
|
|
3817
|
-
let end = readRun(s, isDiagnosticValueUnit);
|
|
3818
3806
|
if (end > s && nameTier === "auth-scheme" && readRun(s, isAsciiLetterCode) === end) {
|
|
3819
3807
|
const k = skipBlank(end);
|
|
3820
3808
|
if (k > end && k >= n && isHead) {
|
|
@@ -3827,7 +3815,7 @@ function collectDiagnosticValueSpans(text, json, span, isHead, deletedAt) {
|
|
|
3827
3815
|
end = credEnd;
|
|
3828
3816
|
}
|
|
3829
3817
|
}
|
|
3830
|
-
if (end > s) {
|
|
3818
|
+
if (end > s && end > valueEnd) {
|
|
3831
3819
|
span(s, end, op, NOT_CLOSED);
|
|
3832
3820
|
valueEnd = end;
|
|
3833
3821
|
}
|
|
@@ -4079,7 +4067,7 @@ const armPool = (() => {
|
|
|
4079
4067
|
if (row === URL_CREDENTIAL_PATTERN)
|
|
4080
4068
|
return forensicMember(row[1], order, (scan, text, json, _eat, span, isHead) => collectUrlCredentialSpans(scan, text, json, span, isHead), "://".length, "url", { kind: "bounded", gap: NO_GAP });
|
|
4081
4069
|
if (row === JSON_SECRET_FIELD_PATTERN)
|
|
4082
|
-
return scannerMember(row[1], order, (text, _json, _eat, span, isHead) => collectJsonSecretFieldSpans(text, span, isHead),
|
|
4070
|
+
return scannerMember(row[1], order, (text, _json, _eat, span, isHead) => collectJsonSecretFieldSpans(text, span, isHead), JSON_FIELD_HEAD_MAX, "json-field", { kind: "bounded", gap: isRegexSpace });
|
|
4083
4071
|
throw new Error(`redact: structural row /${row[0].source}/ has no hand-written scanner — structural grammars are declared as regexes but never executed as one (S-102 / S-265)`);
|
|
4084
4072
|
};
|
|
4085
4073
|
const members = [];
|