@sema-agent/server 7.137.0 → 7.139.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 +600 -142
- package/README.md +7 -3
- package/README.zh-CN.md +6 -3
- package/USAGE.md +132 -41
- package/deploy/sema-up/README.md +1 -1
- package/deploy/sema-up/lib/lanes.json +3 -2
- package/dist/adoption/wire.d.ts +3 -3
- package/dist/approval-card.d.ts +23 -16
- package/dist/approval-card.js +1 -0
- package/dist/audit.js +1 -0
- package/dist/background-agent-name.d.ts +5 -0
- package/dist/background-agent-name.js +5 -0
- package/dist/bench/s1/arms.d.ts +1 -1
- package/dist/bench/s1/arms.js +1 -3
- package/dist/bench/s1/run-firm.js +2 -2
- package/dist/boot/budget-tracing.d.ts +1 -12
- package/dist/boot/deployment-mods.d.ts +46 -16
- package/dist/boot/deployment-mods.js +82 -6
- package/dist/boot/device-lane.d.ts +8 -3
- package/dist/boot/device-lane.js +7 -2
- package/dist/boot/execution-env.d.ts +4 -2
- package/dist/boot/execution-env.js +16 -24
- package/dist/boot/execution-lane.d.ts +1 -1
- package/dist/boot/governance-seams.d.ts +12 -18
- package/dist/boot/governance-seams.js +10 -24
- package/dist/boot/leader.d.ts +3 -0
- package/dist/boot/leader.js +1 -0
- package/dist/boot/memory-consolidation.js +2 -2
- package/dist/boot/org-delivery.js +15 -2
- package/dist/boot/resolve-spec.d.ts +4 -1
- package/dist/boot/resolve-spec.js +29 -19
- package/dist/boot/retention-lane.d.ts +14 -8
- package/dist/boot/retention-lane.js +2 -8
- package/dist/boot/runner-deps.d.ts +10 -4
- package/dist/boot/runner-deps.js +2 -0
- package/dist/boot/session-faces.d.ts +0 -3
- package/dist/boot/session-faces.js +15 -8
- package/dist/boot/stage-02-web-admin-pull.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -12
- package/dist/boot/stage-05-execution-env.d.ts +3 -12
- package/dist/boot/stage-05-execution-env.js +8 -5
- package/dist/boot/stage-06-runners.d.ts +3 -12
- package/dist/boot/stage-06-runners.js +5 -3
- package/dist/boot/stage-07-capability-layer.d.ts +3 -12
- package/dist/boot/stage-07-capability-layer.js +2 -2
- package/dist/boot/stage-08-reapers.d.ts +3 -12
- package/dist/boot/stage-09-leader.d.ts +3 -12
- package/dist/boot/stage-09-leader.js +2 -3
- package/dist/boot/stage-10-http-server.d.ts +3 -12
- package/dist/boot/stage-10-http-server.js +5 -3
- package/dist/boot/stores.js +4 -4
- package/dist/boot/web-admin.d.ts +5 -2
- package/dist/boot/web-admin.js +5 -5
- package/dist/brain.js +5 -5
- package/dist/budget.d.ts +17 -15
- package/dist/budget.js +2 -2
- package/dist/capabilities/mcp-probe.d.ts +36 -11
- package/dist/capabilities/mcp-probe.js +44 -5
- package/dist/capabilities/scenarios.d.ts +1 -1
- package/dist/capability-facts.d.ts +21 -7
- package/dist/capability-facts.js +13 -3
- package/dist/checkpoint-identity.d.ts +13 -6
- package/dist/config-catalog.js +14 -8
- package/dist/config-invariants.d.ts +23 -3
- package/dist/config-invariants.js +42 -0
- package/dist/config-provider.d.ts +19 -24
- package/dist/config-provider.js +27 -12
- package/dist/config-types.d.ts +25 -12
- package/dist/config.d.ts +33 -0
- package/dist/config.js +52 -20
- package/dist/delegated-session-owner.d.ts +2 -2
- package/dist/deployment-shape.d.ts +7 -7
- package/dist/device-enrollment.d.ts +41 -2
- package/dist/device-enrollment.js +27 -12
- package/dist/device-store.d.ts +58 -85
- package/dist/device-store.js +19 -49
- package/dist/device-ws-hub.js +2 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -4
- package/dist/exec-cut.d.ts +60 -0
- package/dist/exec-cut.js +36 -0
- package/dist/execution-lane-caps.d.ts +19 -0
- package/dist/execution-lane-caps.js +10 -0
- package/dist/execution-placement.d.ts +259 -0
- package/dist/execution-placement.js +199 -0
- package/dist/field-conflict.d.ts +3 -2
- package/dist/field-conflict.js +1 -0
- package/dist/gate-settlement.d.ts +71 -0
- package/dist/gate-settlement.js +40 -0
- package/dist/hooks/classic-stations.d.ts +1 -0
- package/dist/hooks/classic-stations.js +1 -0
- package/dist/hooks/command-spawn.d.ts +2 -2
- package/dist/hooks/hook-runner.js +14 -14
- package/dist/hosted-posture.d.ts +2 -2
- package/dist/http/admission.js +10 -19
- package/dist/http/checkpoint-ctx.d.ts +21 -12
- package/dist/http/checkpoint-ctx.js +4 -2
- package/dist/http/claimed-run.d.ts +1 -1
- package/dist/http/dispatch.d.ts +4 -0
- package/dist/http/dispatch.js +3 -0
- package/dist/http/durable-run-leg.js +12 -6
- package/dist/http/execution-context.d.ts +218 -0
- package/dist/http/execution-context.js +330 -0
- package/dist/http/memory-compliance-failure-reply.js +3 -0
- package/dist/http/resume-legs.d.ts +5 -11
- package/dist/http/resume-legs.js +179 -104
- package/dist/http/route-ctx.d.ts +44 -59
- package/dist/http/route-ctx.js +2 -5
- package/dist/http/routes/a2a-serve.js +10 -4
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +5 -1
- package/dist/http/routes/approvals-assistant.js +6 -6
- package/dist/http/routes/background.d.ts +29 -1
- package/dist/http/routes/background.js +29 -2
- package/dist/http/routes/capabilities.js +12 -10
- package/dist/http/routes/devices.d.ts +13 -19
- package/dist/http/routes/devices.js +21 -26
- package/dist/http/routes/mcp-reconnect.d.ts +3 -2
- package/dist/http/routes/mcp-reconnect.js +7 -5
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/rules.js +3 -3
- package/dist/http/routes/runs.js +11 -7
- package/dist/http/routes/session-sync.js +110 -15
- package/dist/http/routes/sessions.d.ts +6 -0
- package/dist/http/routes/sessions.js +119 -13
- package/dist/http/routes/side-query.d.ts +12 -4
- package/dist/http/routes/side-query.js +6 -8
- package/dist/http/routes/tasks.js +800 -782
- package/dist/http/server.d.ts +61 -39
- package/dist/http/server.js +11 -0
- package/dist/http/session-inherit-env.d.ts +3 -4
- package/dist/http/session-inherit-env.js +1 -1
- package/dist/http/wire-types.d.ts +22 -18
- package/dist/identity-source.d.ts +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/leader/wire.d.ts +7 -0
- package/dist/leader/wire.js +5 -4
- package/dist/mcp-assertion-header.d.ts +51 -40
- package/dist/mcp-assertion-header.js +10 -11
- package/dist/mcp-authorization-face.d.ts +27 -0
- package/dist/mcp-authorization-face.js +15 -0
- package/dist/memory-operator-faces.d.ts +13 -4
- package/dist/memory-operator-faces.js +1 -17
- package/dist/memory-sync-client.d.ts +53 -14
- package/dist/memory-sync-client.js +187 -92
- package/dist/memory-sync.d.ts +1 -1
- package/dist/memory-sync.js +3 -2
- package/dist/model-route-gap.d.ts +6 -22
- package/dist/model-route-gap.js +7 -5
- package/dist/mods-declaration.d.ts +110 -0
- package/dist/mods-declaration.js +109 -0
- package/dist/observability/cost-taxonomy.d.ts +2 -2
- package/dist/observability/err-text.d.ts +5 -0
- package/dist/observability/err-text.js +9 -0
- package/dist/observability/fail-open.d.ts +17 -1
- package/dist/observability/fail-open.js +17 -1
- package/dist/observability/run-terminal.js +0 -1
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/secret-env-scrub.js +1 -1
- package/dist/orchestration/workflow-notify-journal.js +4 -4
- package/dist/org-memory-admission.d.ts +4 -3
- package/dist/org-memory-admission.js +6 -6
- package/dist/parked-decide.d.ts +49 -11
- package/dist/parked-decide.js +25 -26
- package/dist/parked-revive-surface.d.ts +12 -15
- package/dist/parked-revive-surface.js +3 -6
- package/dist/peer-seat.d.ts +156 -0
- package/dist/peer-seat.js +273 -0
- package/dist/permission-rule-vocab.d.ts +7 -7
- package/dist/permission-rule-vocab.js +3 -3
- package/dist/plain-string-record.d.ts +38 -0
- package/dist/plain-string-record.js +38 -0
- package/dist/plugins/approval-ask-store-file.d.ts +7 -0
- package/dist/plugins/approval-ask-store-file.js +11 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +6 -0
- package/dist/plugins/approval-ask-store-memory.js +12 -0
- package/dist/plugins/approval-ask-store-sql.d.ts +22 -5
- package/dist/plugins/approval-ask-store-sql.js +30 -12
- package/dist/plugins/background-agent-store-sql.js +6 -3
- package/dist/plugins/caching-session-store.d.ts +11 -2
- package/dist/plugins/caching-session-store.js +15 -3
- package/dist/plugins/checkpoint-store-sql.d.ts +21 -25
- package/dist/plugins/checkpoint-store-sql.js +13 -15
- package/dist/plugins/device-store-sql.d.ts +25 -51
- package/dist/plugins/device-store-sql.js +49 -103
- package/dist/plugins/execution-placement-sql.d.ts +151 -0
- package/dist/plugins/execution-placement-sql.js +223 -0
- package/dist/plugins/file-history-store-sql.d.ts +7 -6
- package/dist/plugins/file-history-store-sql.js +8 -7
- package/dist/plugins/file-run-store.d.ts +6 -1
- package/dist/plugins/file-run-store.js +4 -0
- package/dist/plugins/fork-routing-session-store.d.ts +6 -0
- package/dist/plugins/fork-routing-session-store.js +16 -0
- package/dist/plugins/k8s-pod-reaper.d.ts +2 -8
- package/dist/plugins/k8s-pod-reaper.js +3 -3
- package/dist/plugins/local-checkpoint-store.d.ts +1 -11
- package/dist/plugins/local-checkpoint-store.js +0 -1
- package/dist/plugins/local-session-store.d.ts +183 -45
- package/dist/plugins/local-session-store.js +412 -105
- package/dist/plugins/mailbox-store-sql.d.ts +11 -3
- package/dist/plugins/mailbox-store-sql.js +103 -15
- package/dist/plugins/memory-key-guards.d.ts +4 -0
- package/dist/plugins/memory-key-guards.js +1 -0
- package/dist/plugins/memory-run-store.d.ts +1 -1
- package/dist/plugins/memory-sync-store-pg.d.ts +16 -5
- package/dist/plugins/memory-sync-store-tidb.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +117 -6
- package/dist/plugins/one-time-migrations.js +383 -14
- package/dist/plugins/outcome-ledger-sql.d.ts +2 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +13 -15
- package/dist/plugins/permission-rule-store-sql.js +34 -29
- package/dist/plugins/pg-pool.d.ts +7 -3
- package/dist/plugins/pg-session-storage.d.ts +41 -22
- package/dist/plugins/pg-session-storage.js +136 -55
- package/dist/plugins/remote-env-adb.d.ts +22 -4
- package/dist/plugins/remote-env-adb.js +70 -62
- package/dist/plugins/remote-env-device.d.ts +32 -12
- package/dist/plugins/remote-env-device.js +18 -17
- package/dist/plugins/remote-env-e2b.d.ts +19 -3
- package/dist/plugins/remote-env-e2b.js +41 -42
- package/dist/plugins/remote-env-file-error.d.ts +2 -0
- package/dist/plugins/remote-env-file-error.js +1 -1
- package/dist/plugins/remote-env-host.d.ts +23 -8
- package/dist/plugins/remote-env-host.js +66 -70
- package/dist/plugins/remote-env-k8s.d.ts +13 -16
- package/dist/plugins/remote-env-k8s.js +61 -54
- package/dist/plugins/remote-env-local-docker.d.ts +30 -5
- package/dist/plugins/remote-env-local-docker.js +46 -59
- package/dist/plugins/remote-env-ssh.d.ts +18 -4
- package/dist/plugins/remote-env-ssh.js +72 -56
- package/dist/plugins/remote-shell.d.ts +100 -3
- package/dist/plugins/remote-shell.js +166 -2
- package/dist/plugins/retention-store-sql.d.ts +23 -8
- package/dist/plugins/retention-store-sql.js +13 -1
- package/dist/plugins/run-store-sql.d.ts +13 -3
- package/dist/plugins/run-store-sql.js +5 -0
- package/dist/plugins/schema-consistency.d.ts +15 -5
- package/dist/plugins/schema-consistency.js +14 -8
- package/dist/plugins/schema-drift-sentence.d.ts +27 -0
- package/dist/plugins/schema-drift-sentence.js +38 -0
- package/dist/plugins/session-fork.d.ts +63 -12
- package/dist/plugins/session-fork.js +38 -21
- package/dist/plugins/session-ownership.d.ts +7 -0
- package/dist/plugins/session-ownership.js +5 -0
- package/dist/plugins/session-row-sql.d.ts +22 -0
- package/dist/plugins/session-row-sql.js +81 -0
- package/dist/plugins/session-store.d.ts +1 -1
- package/dist/plugins/session-workspace-cell.d.ts +17 -0
- package/dist/plugins/session-workspace-cell.js +38 -0
- package/dist/plugins/store-backend.d.ts +1 -1
- package/dist/plugins/store-backend.js +26 -14
- package/dist/plugins/store-contracts.d.ts +25 -5
- package/dist/plugins/tidb-pool.d.ts +12 -7
- package/dist/plugins/tidb-pool.js +15 -3
- package/dist/plugins/tidb-session-store.d.ts +74 -28
- package/dist/plugins/tidb-session-store.js +132 -53
- package/dist/plugins/tool-result-store-sql.d.ts +16 -8
- package/dist/plugins/tool-result-store-sql.js +26 -17
- package/dist/plugins/worktree-isolation.d.ts +3 -2
- package/dist/plugins/worktree-isolation.js +1 -7
- package/dist/project-identity.d.ts +1 -14
- package/dist/project-identity.js +0 -4
- package/dist/project-memory.d.ts +9 -15
- package/dist/project-memory.js +5 -4
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +6 -7
- package/dist/request-value-closure.js +1 -3
- package/dist/rules-consent.js +6 -4
- package/dist/run-local.d.ts +6 -0
- package/dist/run-local.js +36 -26
- package/dist/runs.d.ts +9 -2
- package/dist/runs.js +9 -2
- package/dist/sandbox-git-plane.d.ts +2 -2
- package/dist/security.d.ts +38 -12
- package/dist/security.js +8 -2
- package/dist/server-secret-env.d.ts +15 -8
- package/dist/server-secret-env.js +4 -2
- package/dist/session-children-retire.d.ts +27 -9
- package/dist/session-children-retire.js +9 -5
- package/dist/session-incarnation.d.ts +19 -10
- package/dist/session-incarnation.js +5 -3
- package/dist/session-row.d.ts +114 -5
- package/dist/session-row.js +55 -5
- package/dist/session-titler.d.ts +2 -2
- package/dist/session-workspace.d.ts +130 -0
- package/dist/session-workspace.js +83 -0
- package/dist/spec-fields.d.ts +1 -1
- package/dist/standing-answer-grant.d.ts +2 -13
- package/dist/standing-answer-grant.js +0 -7
- package/dist/task-a2a.d.ts +44 -14
- package/dist/task-a2a.js +46 -20
- package/dist/task-cwd.d.ts +6 -1
- package/dist/task-mcp.d.ts +33 -20
- package/dist/task-mcp.js +46 -22
- package/dist/tool-approval.d.ts +38 -8
- package/dist/tool-approval.js +57 -13
- package/dist/trace/core-keyset-guard.d.ts +33 -18
- 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 +20 -1
- package/dist/trace/exit-seat.js +3 -0
- package/dist/trace/extension-call-face.d.ts +33 -0
- package/dist/trace/extension-call-face.js +39 -0
- package/dist/trace/project.d.ts +26 -7
- package/dist/trace/project.js +30 -3
- package/dist/trace/redact.js +42 -13
- package/dist/trace/self-minted-wire.d.ts +240 -12
- package/dist/trace/self-minted-wire.js +100 -4
- package/dist/trace/wire-projection-faces.d.ts +6 -6
- package/dist/trace/wire-projection-faces.js +6 -5
- package/dist/url-refusal.d.ts +1 -1
- package/dist/user-authored-text.d.ts +2 -2
- package/dist/user-authored-text.js +16 -1
- package/dist/web-admin-client/apply-effective.d.ts +17 -3
- package/dist/web-admin-client/apply-effective.js +20 -10
- package/dist/web-admin-client/center-request.d.ts +3 -2
- package/dist/web-admin-client/center-request.js +2 -3
- package/dist/web-admin-client/skills-mcp.d.ts +8 -4
- package/dist/web-admin-client/skills-mcp.js +32 -18
- package/dist/web-admin-client/types.d.ts +11 -0
- package/package.json +3 -3
- package/wire-changes/server@7.138.0.json +446 -0
- package/wire-changes/server@7.139.0.json +348 -0
- package/dist/http/device-placement.d.ts +0 -175
- package/dist/http/device-placement.js +0 -145
- package/dist/http/mcp-remote-text.d.ts +0 -5
- package/dist/http/mcp-remote-text.js +0 -7
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
"env": {
|
|
31
31
|
"REMOTE_EXEC": "k8s",
|
|
32
32
|
"REQUIRE_EXECUTION_LANE": "true",
|
|
33
|
-
"K8S_SANDBOX_IMAGE": null
|
|
33
|
+
"K8S_SANDBOX_IMAGE": null,
|
|
34
|
+
"K8S_NAMESPACE": null
|
|
34
35
|
},
|
|
35
36
|
"isolation": "supported",
|
|
36
|
-
"note": "kube 路径**不选词**:runtime 由 kube-up.sh 按 runtimeClass `kata-qemu` 在不在自动定(在 ⇒ kata VM,不在 ⇒ runc 容器)
|
|
37
|
+
"note": "kube 路径**不选词**:runtime 由 kube-up.sh 按 runtimeClass `kata-qemu` 在不在自动定(在 ⇒ kata VM,不在 ⇒ runc 容器),沙箱镜像与沙箱命名空间由 chart/清单给。本行只为对表(能力表 / 必需键 / REQUIRE_EXECUTION_LANE 三面),不进 --sandbox 词表。"
|
|
37
38
|
}
|
|
38
39
|
],
|
|
39
40
|
"retired": [
|
package/dist/adoption/wire.d.ts
CHANGED
|
@@ -71,10 +71,10 @@ export declare const NOT_MIGRATED_FACES: readonly ["usage-window", "cost-quota",
|
|
|
71
71
|
export type NotMigratedFace = (typeof NOT_MIGRATED_FACES)[number];
|
|
72
72
|
export declare const AdoptionNotMigratedSchema: z.ZodObject<{
|
|
73
73
|
face: z.ZodEnum<{
|
|
74
|
+
"org-delivery-quota": "org-delivery-quota";
|
|
74
75
|
"usage-window": "usage-window";
|
|
75
76
|
"cost-quota": "cost-quota";
|
|
76
77
|
"rate-limit": "rate-limit";
|
|
77
|
-
"org-delivery-quota": "org-delivery-quota";
|
|
78
78
|
"approval-exemption-grantor": "approval-exemption-grantor";
|
|
79
79
|
"approval-ask-decision-actor": "approval-ask-decision-actor";
|
|
80
80
|
"image-bake-requested-by": "image-bake-requested-by";
|
|
@@ -120,10 +120,10 @@ export declare const AdoptionReportSchema: z.ZodObject<{
|
|
|
120
120
|
}, z.core.$strict>>;
|
|
121
121
|
notMigratedByDesign: z.ZodArray<z.ZodObject<{
|
|
122
122
|
face: z.ZodEnum<{
|
|
123
|
+
"org-delivery-quota": "org-delivery-quota";
|
|
123
124
|
"usage-window": "usage-window";
|
|
124
125
|
"cost-quota": "cost-quota";
|
|
125
126
|
"rate-limit": "rate-limit";
|
|
126
|
-
"org-delivery-quota": "org-delivery-quota";
|
|
127
127
|
"approval-exemption-grantor": "approval-exemption-grantor";
|
|
128
128
|
"approval-ask-decision-actor": "approval-ask-decision-actor";
|
|
129
129
|
"image-bake-requested-by": "image-bake-requested-by";
|
|
@@ -182,10 +182,10 @@ export declare const AdoptionReceiptSchema: z.ZodObject<{
|
|
|
182
182
|
}, z.core.$strict>>;
|
|
183
183
|
notMigratedByDesign: z.ZodArray<z.ZodObject<{
|
|
184
184
|
face: z.ZodEnum<{
|
|
185
|
+
"org-delivery-quota": "org-delivery-quota";
|
|
185
186
|
"usage-window": "usage-window";
|
|
186
187
|
"cost-quota": "cost-quota";
|
|
187
188
|
"rate-limit": "rate-limit";
|
|
188
|
-
"org-delivery-quota": "org-delivery-quota";
|
|
189
189
|
"approval-exemption-grantor": "approval-exemption-grantor";
|
|
190
190
|
"approval-ask-decision-actor": "approval-ask-decision-actor";
|
|
191
191
|
"image-bake-requested-by": "image-bake-requested-by";
|
package/dist/approval-card.d.ts
CHANGED
|
@@ -83,9 +83,10 @@ export declare const RuleOfferSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
83
83
|
kind: z.ZodLiteral<"single">;
|
|
84
84
|
rule: z.ZodString;
|
|
85
85
|
match: z.ZodEnum<{
|
|
86
|
-
name: "name";
|
|
87
86
|
host: "host";
|
|
87
|
+
name: "name";
|
|
88
88
|
path: "path";
|
|
89
|
+
tool: "tool";
|
|
89
90
|
exact: "exact";
|
|
90
91
|
pattern: "pattern";
|
|
91
92
|
prefix: "prefix";
|
|
@@ -101,9 +102,10 @@ export declare const RuleOfferSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
101
102
|
kind: z.ZodLiteral<"command">;
|
|
102
103
|
rule: z.ZodString;
|
|
103
104
|
match: z.ZodEnum<{
|
|
104
|
-
name: "name";
|
|
105
105
|
host: "host";
|
|
106
|
+
name: "name";
|
|
106
107
|
path: "path";
|
|
108
|
+
tool: "tool";
|
|
107
109
|
exact: "exact";
|
|
108
110
|
pattern: "pattern";
|
|
109
111
|
prefix: "prefix";
|
|
@@ -556,10 +558,10 @@ export declare const ApprovalCardSchema: z.ZodObject<{
|
|
|
556
558
|
skill: "skill";
|
|
557
559
|
shell: "shell";
|
|
558
560
|
workflow: "workflow";
|
|
559
|
-
|
|
561
|
+
fetch: "fetch";
|
|
560
562
|
"file-write": "file-write";
|
|
563
|
+
"file-edit": "file-edit";
|
|
561
564
|
"notebook-edit": "notebook-edit";
|
|
562
|
-
fetch: "fetch";
|
|
563
565
|
generic: "generic";
|
|
564
566
|
}>>;
|
|
565
567
|
inputHasBidi: z.ZodOptional<z.ZodLiteral<true>>;
|
|
@@ -578,9 +580,10 @@ export declare const ApprovalCardSchema: z.ZodObject<{
|
|
|
578
580
|
kind: z.ZodLiteral<"single">;
|
|
579
581
|
rule: z.ZodString;
|
|
580
582
|
match: z.ZodEnum<{
|
|
581
|
-
name: "name";
|
|
582
583
|
host: "host";
|
|
584
|
+
name: "name";
|
|
583
585
|
path: "path";
|
|
586
|
+
tool: "tool";
|
|
584
587
|
exact: "exact";
|
|
585
588
|
pattern: "pattern";
|
|
586
589
|
prefix: "prefix";
|
|
@@ -596,9 +599,10 @@ export declare const ApprovalCardSchema: z.ZodObject<{
|
|
|
596
599
|
kind: z.ZodLiteral<"command">;
|
|
597
600
|
rule: z.ZodString;
|
|
598
601
|
match: z.ZodEnum<{
|
|
599
|
-
name: "name";
|
|
600
602
|
host: "host";
|
|
603
|
+
name: "name";
|
|
601
604
|
path: "path";
|
|
605
|
+
tool: "tool";
|
|
602
606
|
exact: "exact";
|
|
603
607
|
pattern: "pattern";
|
|
604
608
|
prefix: "prefix";
|
|
@@ -665,8 +669,8 @@ export declare const ApprovalCardSchema: z.ZodObject<{
|
|
|
665
669
|
}, z.core.$strict>>>;
|
|
666
670
|
personalRuleDotsAbsent: z.ZodOptional<z.ZodCustom<AskEvidenceAbsence, AskEvidenceAbsence>>;
|
|
667
671
|
}, z.core.$strict>>;
|
|
668
|
-
askClass: z.ZodOptional<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>;
|
|
669
|
-
classes: z.ZodOptional<z.ZodArray<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>>;
|
|
672
|
+
askClass: z.ZodOptional<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>;
|
|
673
|
+
classes: z.ZodOptional<z.ZodArray<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>>;
|
|
670
674
|
fromSubagent: z.ZodOptional<z.ZodLiteral<true>>;
|
|
671
675
|
sourceTaskId: z.ZodOptional<z.ZodString>;
|
|
672
676
|
sourceAgentName: z.ZodOptional<z.ZodString>;
|
|
@@ -708,10 +712,10 @@ export declare const ApprovalCardEnvelopeSchema: z.ZodObject<{
|
|
|
708
712
|
skill: "skill";
|
|
709
713
|
shell: "shell";
|
|
710
714
|
workflow: "workflow";
|
|
711
|
-
|
|
715
|
+
fetch: "fetch";
|
|
712
716
|
"file-write": "file-write";
|
|
717
|
+
"file-edit": "file-edit";
|
|
713
718
|
"notebook-edit": "notebook-edit";
|
|
714
|
-
fetch: "fetch";
|
|
715
719
|
generic: "generic";
|
|
716
720
|
}>>;
|
|
717
721
|
inputHasBidi: z.ZodOptional<z.ZodLiteral<true>>;
|
|
@@ -730,9 +734,10 @@ export declare const ApprovalCardEnvelopeSchema: z.ZodObject<{
|
|
|
730
734
|
kind: z.ZodLiteral<"single">;
|
|
731
735
|
rule: z.ZodString;
|
|
732
736
|
match: z.ZodEnum<{
|
|
733
|
-
name: "name";
|
|
734
737
|
host: "host";
|
|
738
|
+
name: "name";
|
|
735
739
|
path: "path";
|
|
740
|
+
tool: "tool";
|
|
736
741
|
exact: "exact";
|
|
737
742
|
pattern: "pattern";
|
|
738
743
|
prefix: "prefix";
|
|
@@ -748,9 +753,10 @@ export declare const ApprovalCardEnvelopeSchema: z.ZodObject<{
|
|
|
748
753
|
kind: z.ZodLiteral<"command">;
|
|
749
754
|
rule: z.ZodString;
|
|
750
755
|
match: z.ZodEnum<{
|
|
751
|
-
name: "name";
|
|
752
756
|
host: "host";
|
|
757
|
+
name: "name";
|
|
753
758
|
path: "path";
|
|
759
|
+
tool: "tool";
|
|
754
760
|
exact: "exact";
|
|
755
761
|
pattern: "pattern";
|
|
756
762
|
prefix: "prefix";
|
|
@@ -817,8 +823,8 @@ export declare const ApprovalCardEnvelopeSchema: z.ZodObject<{
|
|
|
817
823
|
}, z.core.$strict>>>;
|
|
818
824
|
personalRuleDotsAbsent: z.ZodOptional<z.ZodCustom<AskEvidenceAbsence, AskEvidenceAbsence>>;
|
|
819
825
|
}, z.core.$strict>>;
|
|
820
|
-
askClass: z.ZodOptional<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>;
|
|
821
|
-
classes: z.ZodOptional<z.ZodArray<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>>;
|
|
826
|
+
askClass: z.ZodOptional<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>;
|
|
827
|
+
classes: z.ZodOptional<z.ZodArray<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>>;
|
|
822
828
|
fromSubagent: z.ZodOptional<z.ZodLiteral<true>>;
|
|
823
829
|
sourceTaskId: z.ZodOptional<z.ZodString>;
|
|
824
830
|
sourceAgentName: z.ZodOptional<z.ZodString>;
|
|
@@ -933,7 +939,8 @@ export declare function buildApprovalRequestFrame(input: {
|
|
|
933
939
|
/**
|
|
934
940
|
* 🔴 **呈卡帧的活面事实座**(呈卡腿上旧族退役之后,开卡帧的全部事实都由本族承载)。
|
|
935
941
|
*
|
|
936
|
-
*
|
|
942
|
+
* 这十一个座是活卡帧 `tool_approval` 上有、而卡(`ApprovalCardSchema`,`card_json` 的耐久信封)上**没有**的那几位(`approvalCard` 7.136.0 起也在卡上,见本注末段;
|
|
943
|
+
* `requestedBy` = 扩展经 `$.tool.call` 自己发起的调用是谁要的,部署座装运维声明的 mod 包之后可达):
|
|
937
944
|
* 卡外的事实此前只骑活卡帧,呈卡腿的消费方靠「两帧按 approvalId 合读」拿到它们。呈卡腿自此只发本族帧 ⇒ 它们挪到**活铸**的
|
|
938
945
|
* 呈卡帧顶层,同名同型同值 —— 值取自同一只帧对象(活卡帧的那一次铸定,`tool-approval.ts` 的 `askBroadcast`),本仓不另算一遍。
|
|
939
946
|
*
|
|
@@ -946,7 +953,7 @@ export declare function buildApprovalRequestFrame(input: {
|
|
|
946
953
|
* 同一次读定、同值)。按上一句的规矩它该离表(活铸帧顶层这一份退役 —— wire BREAKING,下游 sdk 的孪生表同改),本版按 additive 交付、未退役:
|
|
947
954
|
* 一个事实两处读,登记为待收的债,收法 = 离表 + 消费方改读 `card.approvalCard`,不是在这里加第三处。
|
|
948
955
|
*/
|
|
949
|
-
export declare const APPROVAL_REQUEST_LIVE_FACT_KEYS: readonly ["mandated", "mandate", "origin", "boundGrantDigest", "boundGrants", "classifierNoRuling", "boundGrantAbsence", "approvalCard", "readRootCandidate", "probeReason"];
|
|
956
|
+
export declare const APPROVAL_REQUEST_LIVE_FACT_KEYS: readonly ["mandated", "mandate", "origin", "boundGrantDigest", "boundGrants", "classifierNoRuling", "boundGrantAbsence", "approvalCard", "readRootCandidate", "probeReason", "requestedBy"];
|
|
950
957
|
/** 呈卡帧活面事实座的类型面 = 活卡帧同名座的 `Pick`(同型由构造保证,不手抄)。 */
|
|
951
958
|
export type ApprovalRequestLiveFacts = Pick<ToolApprovalFrame, (typeof APPROVAL_REQUEST_LIVE_FACT_KEYS)[number]>;
|
|
952
959
|
/**
|
package/dist/approval-card.js
CHANGED
package/dist/audit.js
CHANGED
|
@@ -126,6 +126,7 @@ const MESSAGE_READ_TREATMENT = {
|
|
|
126
126
|
user: {
|
|
127
127
|
role: "verbatim", content: "verbatim", timestamp: "verbatim", enginePrefixChars: "verbatim", engineSegments: "verbatim",
|
|
128
128
|
engineMinted: "verbatim", engineNoteKey: "verbatim", provenance: "verbatim", actor: "verbatim",
|
|
129
|
+
runOrigin: "verbatim",
|
|
129
130
|
taskId: "verbatim",
|
|
130
131
|
attachment: "verbatim",
|
|
131
132
|
},
|
package/dist/bench/s1/arms.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ export declare function bindingFromCheckpoint(cp: Checkpoint | null): {
|
|
|
95
95
|
boundInputHash: string;
|
|
96
96
|
} | undefined;
|
|
97
97
|
/** The non-optional C1 finance taxonomy the harness always emits (core's `CoreStatsSubset.costBreakdown` is
|
|
98
|
-
* OPTIONAL for back-compat, but the producer ALWAYS fills
|
|
98
|
+
* OPTIONAL for back-compat, but the producer ALWAYS fills its three required lines — this is that concrete shape). */
|
|
99
99
|
type CostBreakdown = NonNullable<CoreStatsSubset["costBreakdown"]>;
|
|
100
100
|
/** The s1.v1 `stats` the producer emits — a `CoreStatsSubset` with `costBreakdown` + `humanReview` ALWAYS present
|
|
101
101
|
* (core types them optional; the harness never omits them, so it works with concrete, non-undefined locals). */
|
package/dist/bench/s1/arms.js
CHANGED
|
@@ -24,7 +24,7 @@ export function bindingFromCheckpoint(cp) {
|
|
|
24
24
|
}
|
|
25
25
|
const ORACLE_UNDELIVERED = { delivered: false, hiddenTestsGreen: false, buildPassed: false, invariantsOk: false };
|
|
26
26
|
function emptyCostBreakdown() {
|
|
27
|
-
return { llmRootMicroUsd: 0, nestedSubagentMicroUsd: 0,
|
|
27
|
+
return { llmRootMicroUsd: 0, nestedSubagentMicroUsd: 0, compactionMicroUsd: 0 };
|
|
28
28
|
}
|
|
29
29
|
export function classifyRunStatus(input) {
|
|
30
30
|
if (input.status === "failed")
|
|
@@ -40,7 +40,6 @@ export function captureStats(stats) {
|
|
|
40
40
|
costBreakdown: {
|
|
41
41
|
llmRootMicroUsd: bd.llmRootMicroUsd,
|
|
42
42
|
nestedSubagentMicroUsd: bd.nestedSubagentMicroUsd,
|
|
43
|
-
memoryConsolidationMicroUsd: bd.memoryConsolidationMicroUsd,
|
|
44
43
|
compactionMicroUsd: bd.compactionMicroUsd,
|
|
45
44
|
},
|
|
46
45
|
humanReview: { count: hr.count, totalWaitMs: hr.totalWaitMs, gates: hr.gates },
|
|
@@ -55,7 +54,6 @@ export async function driveSupSuspendResume(initial, deps, implSpec, trap, advan
|
|
|
55
54
|
return;
|
|
56
55
|
c1Acc.llmRootMicroUsd += b.llmRootMicroUsd;
|
|
57
56
|
c1Acc.nestedSubagentMicroUsd += b.nestedSubagentMicroUsd;
|
|
58
|
-
c1Acc.memoryConsolidationMicroUsd += b.memoryConsolidationMicroUsd;
|
|
59
57
|
c1Acc.compactionMicroUsd += b.compactionMicroUsd;
|
|
60
58
|
};
|
|
61
59
|
let exitedViaBreak = false;
|
|
@@ -109,7 +109,7 @@ function infraFailedRow(cell, ctx) {
|
|
|
109
109
|
oracle: { delivered: false, hiddenTestsGreen: false, buildPassed: false, invariantsOk: false },
|
|
110
110
|
delivery: { withheld: false },
|
|
111
111
|
stats: {
|
|
112
|
-
costBreakdown: { llmRootMicroUsd: 0, nestedSubagentMicroUsd: 0,
|
|
112
|
+
costBreakdown: { llmRootMicroUsd: 0, nestedSubagentMicroUsd: 0, compactionMicroUsd: 0 },
|
|
113
113
|
humanReview: { count: 0, totalWaitMs: 0, gates: [] },
|
|
114
114
|
},
|
|
115
115
|
wallTimeSec: 0,
|
|
@@ -221,7 +221,7 @@ export function positiveIntArg(raw, def, flag) {
|
|
|
221
221
|
function dryRunMockFactory() {
|
|
222
222
|
return (trap, seed) => {
|
|
223
223
|
const stats = {
|
|
224
|
-
costBreakdown: { llmRootMicroUsd: 50_000, nestedSubagentMicroUsd: 0,
|
|
224
|
+
costBreakdown: { llmRootMicroUsd: 50_000, nestedSubagentMicroUsd: 0, compactionMicroUsd: 0 },
|
|
225
225
|
humanReview: { count: 0, totalWaitMs: 0, gates: [] },
|
|
226
226
|
};
|
|
227
227
|
const green = trap.id !== "C2-honest-bound";
|
|
@@ -28,18 +28,7 @@ export declare function createBudgetAndTracing(ctx: BudgetTracingCtx): {
|
|
|
28
28
|
fleetUsage: import("../fleet-client.js").FleetUsageBins | undefined;
|
|
29
29
|
fleetLease: import("../fleet-lease.js").FleetLeaseManager | undefined;
|
|
30
30
|
tracer: import("@sema-agent/core").TracerHook;
|
|
31
|
-
sideQueryAccounting: (
|
|
32
|
-
model: string;
|
|
33
|
-
usage?: {
|
|
34
|
-
input?: number;
|
|
35
|
-
output?: number;
|
|
36
|
-
cacheRead?: number;
|
|
37
|
-
cacheWrite?: number;
|
|
38
|
-
cost?: {
|
|
39
|
-
total?: number;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
}) => void;
|
|
31
|
+
sideQueryAccounting: import("../budget.js").SideQueryAccounting;
|
|
43
32
|
toolResultStore: import("../plugins/store-backend.js").ToolResultStoreFull | undefined;
|
|
44
33
|
sessionPolicyStore: import("@sema-agent/core").SessionPolicyStore | undefined;
|
|
45
34
|
fileHistoryStore: import("../plugins/store-backend.js").ServiceFileHistoryStore | undefined;
|
|
@@ -1,31 +1,61 @@
|
|
|
1
|
+
import { type EngineDollar, type ModAdmissionRecord, type ModRegistration } from "@sema-agent/core";
|
|
2
|
+
import { type ModsDeclaration } from "../mods-declaration.js";
|
|
3
|
+
import type { Logger } from "../observability/logger.js";
|
|
4
|
+
import type { Metrics } from "../observability/metrics.js";
|
|
1
5
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 起服自证(律三:拒形只有引擎一种读法,本仓只负责「不写」与「启动时自证」):
|
|
5
|
-
* 部署座上的注册是本仓自己铸的。它们坏了
|
|
6
|
-
* —— 坏名、坏档、缺 `uses.calls`、`on` 越出 `uses`、只选无站的名字、`register` 抛 —— 引擎在每条腿的 prepare 里拒
|
|
7
|
-
* (`config.mods_invalid`),那就是每个请求都失败。所以起服时让引擎的 admission 判一次:判官仍是引擎(`admitModChain`),
|
|
8
|
-
* 本函数不判形,只把它的拒折成一句起服错误、拒启。两个起服入口(server 第五段、本地 CLI)同调这一只。
|
|
6
|
+
* 部署座注册的**出处标签**(谁供的这张注册)—— 宿主自己的词,引擎原样携带、不判;**全仓唯一写点**。
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* ·
|
|
13
|
-
*
|
|
8
|
+
* `wiring_manifest.mods[]` 的一行上有两个词字段,各自一张闭集、互不相交:`seat` 是引擎的座词(`MOD_SEATS`:`deployment` | `task`,这张注册站在哪一座),
|
|
9
|
+
* `provenance` 是这张表的值(这张注册是谁供的)。两个字段不共用词 —— 同一个词不在一行里指两件事。
|
|
10
|
+
* · `minted` → `server`:本服务自己铸的(拒绝计量 / 工具追踪 / 品牌行);
|
|
11
|
+
* · `declared` → `operator`:运维在部署声明(`MODS_ROOT` / `MODS_PACKAGES`)里点名装进来的包。词取「谁供的」:与 `server` 同一个维度(供给方),
|
|
12
|
+
* 并沿用本仓对这件事的既有称呼「运维声明」。不用 `deployment`:它是座词,同一行上同形不同义。
|
|
13
|
+
* 加一种供给方 = 在这里加一行;取到的词与座词相交 ⇒ 下面的类型门编译红。
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export declare const MOD_PROVENANCE: {
|
|
16
|
+
readonly minted: "server";
|
|
17
|
+
readonly declared: "operator";
|
|
18
|
+
};
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* 本仓自铸的部署注册 —— 哪几张、什么顺序只写在这里(装配口 {@link assembleDeploymentMods} 把它们排在声明的包之前):
|
|
20
21
|
* · 拒绝计量恒挂、在前;工具追踪(`TOOL_TRACE=true`,交 `traceLogger`)在后。两张都是 `prepend` 档的观察者,引擎按「档 → 部署先于任务 → 座内顺序」
|
|
21
22
|
* 串行跑观察者、且都在链之前 ⇒ 同一次拒绝先计数、后写追踪行;
|
|
22
23
|
* · 品牌行(`brandIdentity`:品牌部署 = local / TOC)—— `prompt.compose` 上的一条部署类 overlay(`capabilities/brand-identity.ts`),与两只观察者
|
|
23
24
|
* 不在同一个事件上,顺序不影响它们。部署开不开品牌只在这一个入参表态。
|
|
25
|
+
* 出处标签:自铸的每一张都带宿主标签 {@link MOD_PROVENANCE}`.minted`,声明的包由装配口给 `.declared` —— 引擎把宿主给的标签原样记进准入记录与每条腿的
|
|
26
|
+
* `wiring_manifest.mods[]`,一条腿的部署座由此分得出「本服务自铸」与「运维声明」两种来源。
|
|
24
27
|
*/
|
|
25
28
|
export declare function createDeploymentMods(input: {
|
|
26
29
|
readonly metrics: Pick<Metrics, "inc">;
|
|
27
30
|
readonly traceLogger?: Logger | undefined;
|
|
28
31
|
readonly brandIdentity?: boolean | undefined;
|
|
29
32
|
}): readonly ModRegistration<EngineDollar>[];
|
|
30
|
-
|
|
33
|
+
/** 起服装上的一只声明包(起服日志行 `mods_package_loaded` 与 `/health` / `/v1/capabilities` 的读数都读这一份)。 */
|
|
34
|
+
export interface LoadedModPackage {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
/** 引擎准入记录里这只包站的档(准入判过的那一份,不是声明里写的)。 */
|
|
37
|
+
readonly tier: ModAdmissionRecord["tier"];
|
|
38
|
+
/** 读包者按相等判过的引擎契约号(包声明的 `contract` 与引擎的 `KERNEL_CONTRACT_VERSION` 相等才装得上)。 */
|
|
39
|
+
readonly contract: number;
|
|
40
|
+
/** 读包者交回的三件字节摘要(`ModPackageRegistration.digest`,按给值记)—— 认得出「装的是哪几份字节」,不是代码完整性凭据。 */
|
|
41
|
+
readonly digest: string;
|
|
42
|
+
}
|
|
43
|
+
/** 装配的结果:部署座的注册(自铸在前、声明在后,整列已过引擎准入)与装上的声明包(只数声明的包,自铸的不算)。 */
|
|
44
|
+
export interface DeploymentModsAssembly {
|
|
45
|
+
readonly registrations: readonly ModRegistration<EngineDollar>[];
|
|
46
|
+
readonly loaded: readonly LoadedModPackage[];
|
|
47
|
+
}
|
|
48
|
+
/** 部署座的唯一装配口(两只起服入口同调;三段与失败见文件头注)。 */
|
|
49
|
+
export declare function assembleDeploymentMods(input: {
|
|
50
|
+
readonly metrics: Pick<Metrics, "inc">;
|
|
51
|
+
readonly traceLogger?: Logger | undefined;
|
|
52
|
+
readonly brandIdentity?: boolean | undefined;
|
|
53
|
+
readonly declaration: ModsDeclaration;
|
|
54
|
+
readonly logger: Pick<Logger, "info">;
|
|
55
|
+
}): Promise<DeploymentModsAssembly>;
|
|
56
|
+
/**
|
|
57
|
+
* 第三段:整列交引擎准入判一次(判官是引擎;本函数不判形,只把它的拒、报告与判拒折成一句 `admission_refused`)。
|
|
58
|
+
* 过了 ⇒ 交回这一次准入的记录(每张注册一行,全部挂上了 —— 有一行被判拒就不会走到这里)。
|
|
59
|
+
*/
|
|
60
|
+
export declare function assertDeploymentModsAdmitted(mods: readonly ModRegistration<EngineDollar>[]): Promise<readonly ModAdmissionRecord[]>;
|
|
31
61
|
//# sourceMappingURL=deployment-mods.d.ts.map
|
|
@@ -1,26 +1,102 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { realpathSync, statSync } from "node:fs";
|
|
2
|
+
import { isAbsolute, relative, sep } from "node:path";
|
|
3
|
+
import { admitModChain, KERNEL_CONTRACT_VERSION, loadModPackage } from "@sema-agent/core";
|
|
2
4
|
import { createBrandIdentityRegistration } from "../capabilities/brand-identity.js";
|
|
3
5
|
import { createPermissionDeniedMeter, createToolTracer } from "../observability/tool-trace.js";
|
|
6
|
+
import { errorCodeOf, errorText } from "../observability/err-text.js";
|
|
7
|
+
import { sanitizeWireText } from "../trace/engine-notice-wire.js";
|
|
8
|
+
import { DeploymentModsRefusedError } from "../mods-declaration.js";
|
|
9
|
+
export const MOD_PROVENANCE = { minted: "server", declared: "operator" };
|
|
4
10
|
export function createDeploymentMods(input) {
|
|
5
11
|
return [
|
|
6
12
|
createPermissionDeniedMeter(input.metrics),
|
|
7
13
|
...(input.traceLogger !== undefined ? [createToolTracer(input.traceLogger)] : []),
|
|
8
14
|
...(input.brandIdentity === true ? [createBrandIdentityRegistration()] : []),
|
|
9
|
-
];
|
|
15
|
+
].map((registration) => ({ ...registration, provenance: MOD_PROVENANCE.minted }));
|
|
16
|
+
}
|
|
17
|
+
export async function assembleDeploymentMods(input) {
|
|
18
|
+
const minted = createDeploymentMods(input);
|
|
19
|
+
const resolved = resolveDeclaredPackages(input.declaration);
|
|
20
|
+
const declared = [];
|
|
21
|
+
for (const { pkg, realDir } of resolved)
|
|
22
|
+
declared.push(await loadDeclaredPackage(pkg, realDir));
|
|
23
|
+
const registrations = [...minted, ...declared];
|
|
24
|
+
const records = await assertDeploymentModsAdmitted(registrations);
|
|
25
|
+
const loaded = resolved.map(({ pkg }, i) => ({ name: pkg.name, tier: admittedRecordOf(records, pkg.name).tier, contract: KERNEL_CONTRACT_VERSION, digest: declared[i].digest }));
|
|
26
|
+
for (const row of loaded)
|
|
27
|
+
input.logger.info("mods_package_loaded", { name: sanitizeWireText(row.name), tier: row.tier, contract: row.contract, digest: row.digest });
|
|
28
|
+
return { registrations, loaded };
|
|
29
|
+
}
|
|
30
|
+
function fsCauseOf(e) {
|
|
31
|
+
const code = errorCodeOf(e);
|
|
32
|
+
return typeof code === "string" && /^E[A-Z0-9]{1,31}$/.test(code) ? code : "unknown";
|
|
33
|
+
}
|
|
34
|
+
function strictlyUnderRoot(root, child) {
|
|
35
|
+
const rel = relative(root, child);
|
|
36
|
+
return rel !== "" && rel.split(sep)[0] !== ".." && !isAbsolute(rel);
|
|
37
|
+
}
|
|
38
|
+
function resolveDeclaredPackages(declaration) {
|
|
39
|
+
if (declaration.packages === undefined)
|
|
40
|
+
return [];
|
|
41
|
+
let realRoot;
|
|
42
|
+
try {
|
|
43
|
+
realRoot = realpathSync(declaration.root);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
throw new DeploymentModsRefusedError({ word: "root_unreadable", cause: fsCauseOf(e) });
|
|
47
|
+
}
|
|
48
|
+
return declaration.packages.map((pkg, entry) => {
|
|
49
|
+
let realDir;
|
|
50
|
+
let isDirectory;
|
|
51
|
+
try {
|
|
52
|
+
realDir = realpathSync(pkg.dir);
|
|
53
|
+
isDirectory = statSync(realDir).isDirectory();
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
throw new DeploymentModsRefusedError({ word: "dir_unreadable", entry, cause: fsCauseOf(e) });
|
|
57
|
+
}
|
|
58
|
+
if (!strictlyUnderRoot(realRoot, realDir))
|
|
59
|
+
throw new DeploymentModsRefusedError({ word: "outside_root", entry });
|
|
60
|
+
if (!isDirectory)
|
|
61
|
+
throw new DeploymentModsRefusedError({ word: "not_a_directory", entry });
|
|
62
|
+
return { pkg, realDir };
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function machineCodeOf(e) {
|
|
66
|
+
const code = errorCodeOf(e);
|
|
67
|
+
return typeof code === "string" && /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(code) ? code : undefined;
|
|
68
|
+
}
|
|
69
|
+
async function loadDeclaredPackage(pkg, realDir) {
|
|
70
|
+
let registration;
|
|
71
|
+
try {
|
|
72
|
+
registration = await loadModPackage(realDir, { tier: pkg.tier, provenance: MOD_PROVENANCE.declared, ...("options" in pkg ? { options: pkg.options } : {}) });
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
throw new DeploymentModsRefusedError({ word: "package_refused", name: pkg.name, code: machineCodeOf(e), reason: errorText(e) });
|
|
76
|
+
}
|
|
77
|
+
if (registration.name !== pkg.name)
|
|
78
|
+
throw new DeploymentModsRefusedError({ word: "name_mismatch", name: pkg.name, packageName: registration.name });
|
|
79
|
+
return registration;
|
|
10
80
|
}
|
|
11
|
-
const REFUSED = "deployment extension registration refused";
|
|
12
81
|
export async function assertDeploymentModsAdmitted(mods) {
|
|
13
82
|
const reports = [];
|
|
14
83
|
let records;
|
|
15
84
|
try {
|
|
16
|
-
({ records } = await admitModChain({ deployment: mods }, (err) => void reports.push(err
|
|
85
|
+
({ records } = await admitModChain({ deployment: mods }, (err) => void reports.push(errorText(err))));
|
|
17
86
|
}
|
|
18
87
|
catch (e) {
|
|
19
|
-
throw new
|
|
88
|
+
throw new DeploymentModsRefusedError({ word: "admission_refused", code: machineCodeOf(e), reason: errorText(e) });
|
|
20
89
|
}
|
|
21
90
|
const refused = records.flatMap((r) => ("refusedBy" in r ? [`"${r.name}" refused by ${r.refusedBy}: ${r.reason}`] : []));
|
|
22
91
|
const problems = [...reports, ...refused];
|
|
23
92
|
if (problems.length > 0)
|
|
24
|
-
throw new
|
|
93
|
+
throw new DeploymentModsRefusedError({ word: "admission_refused", code: undefined, reason: problems.join("; ") });
|
|
94
|
+
return records;
|
|
95
|
+
}
|
|
96
|
+
function admittedRecordOf(records, name) {
|
|
97
|
+
const record = records.find((r) => r.seat === "deployment" && r.name === name);
|
|
98
|
+
if (record === undefined)
|
|
99
|
+
throw new DeploymentModsRefusedError({ word: "admission_refused", code: undefined, reason: `the engine's admission returned no record for ${JSON.stringify(name)}` });
|
|
100
|
+
return record;
|
|
25
101
|
}
|
|
26
102
|
//# sourceMappingURL=deployment-mods.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* [ref] A10 分段 —— **device lane 的装配件**(device-executor-lane-v2 §4.6/§4.7/§5,车A-4)。
|
|
3
3
|
*
|
|
4
|
-
* 一处建齐三件活对象:**店**(
|
|
4
|
+
* 一处建齐三件活对象:**店**(三表双库的 `DeviceStore`;绑定写在根会话行的执行格上)→ **准入链**(`DeviceEnrollment`,读会话店的执行席,含跨副本
|
|
5
5
|
* 限速座)→ **WS 汇聚端**(`DeviceWsHub`)。三件的依赖是单向的(hub 吃 store+enrollment),所以它们
|
|
6
6
|
* 必须在同一处按序建 —— 拆到三处装配点会让「hub 拿到的是不是同一只店」变成一个要读三个文件才答得出
|
|
7
7
|
* 的问题(而答错的后果是 presence 与租约各写各的)。
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { type DeviceEnrollment } from "../device-enrollment.js";
|
|
17
17
|
import type { DeviceStore } from "../device-store.js";
|
|
18
|
+
import type { ExecutionPlacementSeat } from "../execution-placement.js";
|
|
18
19
|
import { type DeviceWsHub } from "../device-ws-hub.js";
|
|
19
20
|
import type { ServiceConfig } from "../config.js";
|
|
20
21
|
import type { Logger } from "../observability/logger.js";
|
|
@@ -25,6 +26,8 @@ export interface DeviceLaneCtx {
|
|
|
25
26
|
logger: Logger;
|
|
26
27
|
metrics: Metrics;
|
|
27
28
|
backend: StoreBackend | undefined;
|
|
29
|
+
/** 会话店的执行席(`sessionStore.executionPlacement`):根会话 ↔ 设备绑定的唯一载体与唯一读。device 车道只在 SQL 后端 ⇒ 席恒在;缺 = 装配缝 ⇒ 本函数响亮抛。 */
|
|
30
|
+
seat: ExecutionPlacementSeat | undefined;
|
|
28
31
|
/** 本副本 id(写进连接租约行 —— §4.6 的跨副本排障面)。 */
|
|
29
32
|
replicaId: string;
|
|
30
33
|
}
|
|
@@ -32,6 +35,8 @@ export interface DeviceLane {
|
|
|
32
35
|
store: DeviceStore;
|
|
33
36
|
enrollment: DeviceEnrollment;
|
|
34
37
|
hub: DeviceWsHub;
|
|
38
|
+
/** 会话店的执行席(准入链、工厂、换绑门读的同一只)。 */
|
|
39
|
+
seat: ExecutionPlacementSeat;
|
|
35
40
|
}
|
|
36
41
|
/**
|
|
37
42
|
* 注册口(`POST /v1/devices/enroll`,pre-auth)的限速策略 —— **本车道自己的地板,不挂任何运维旋钮**。
|
|
@@ -49,7 +54,7 @@ export declare const DEVICE_ENROLL_RATE_POLICY: {
|
|
|
49
54
|
readonly windowMs: 60000;
|
|
50
55
|
};
|
|
51
56
|
/**
|
|
52
|
-
* 建齐 device lane 的三件。返回 `undefined` = **建不起来**(没有 SQL 后端 ⇒
|
|
57
|
+
* 建齐 device lane 的三件。返回 `undefined` = **建不起来**(没有 SQL 后端 ⇒ 没有设备店)。
|
|
53
58
|
*
|
|
54
59
|
* 只在调用方判定本部署是 device 车道时调用;非 device 车道调用它是纯浪费(会白建一只 WS server)。
|
|
55
60
|
*/
|
|
@@ -61,7 +66,7 @@ export declare function createDeviceLane(ctx: DeviceLaneCtx): DeviceLane | undef
|
|
|
61
66
|
* config 层的门①判的是「运维配没配 SQL 坐标」——那句话回答的是**意图**。它回答不了「这次启动**真的
|
|
62
67
|
* 拿到**了店吗」:`openStoreBackendWithFallback` 曾在 `SESSION_BACKEND=auto` 下,SQL 连不上 /
|
|
63
68
|
* 建表失败 ⇒ `backend=undefined` + 一条 warn 就继续启动(那条降级臂已退役:配了 DSN 的库窗内重试、到窗拒启,见 `plugins/store-open-wait.ts`;
|
|
64
|
-
* 仍走得到本门的形:`DB_BACKEND=mysql|pg` 声明了 SQL 而 `SESSION_BACKEND=memory`,刻意不持久 ⇒ 不开店)。那次启动里 device lane
|
|
69
|
+
* 仍走得到本门的形:`DB_BACKEND=mysql|pg` 声明了 SQL 而 `SESSION_BACKEND=memory`,刻意不持久 ⇒ 不开店)。那次启动里 device lane 的表整个不在,
|
|
65
70
|
* 而 `boot/execution-env.ts` 的第七臂拿不到三件 ⇒ `executionEnvFactory` 落 `undefined` ⇒ core 拿
|
|
66
71
|
* `StubExecutionEnv`:**一台自称在员工设备上执行的 worker 实际在自己进程里跑,而且回执同形**。
|
|
67
72
|
* 那正是 [ref]「执行车道禁静默降级」点名的样板病,也正是 A-1 那条临时门当初要拦的东西 —— 换执法点,
|
package/dist/boot/device-lane.js
CHANGED
|
@@ -2,13 +2,18 @@ import { createDeviceEnrollment, createFixedWindowRateLimiter } from "../device-
|
|
|
2
2
|
import { createDeviceWsHub } from "../device-ws-hub.js";
|
|
3
3
|
export const DEVICE_ENROLL_RATE_POLICY = { limit: 10, windowMs: 60_000 };
|
|
4
4
|
export function createDeviceLane(ctx) {
|
|
5
|
-
const { config, logger, metrics, backend, replicaId } = ctx;
|
|
5
|
+
const { config, logger, metrics, backend, replicaId, seat } = ctx;
|
|
6
6
|
const store = backend?.device?.();
|
|
7
7
|
if (!store)
|
|
8
8
|
return undefined;
|
|
9
|
+
if (seat === undefined) {
|
|
10
|
+
throw new Error("device lane: the device store is wired but the session store carries no execution placement seat — the session↔device binding lives on the " +
|
|
11
|
+
"root session row and is read only through that seat; refusing to start a device lane that could neither bind nor read a binding (assembly bug)");
|
|
12
|
+
}
|
|
9
13
|
const knobs = config.remoteExec?.provider === "device" ? config.remoteExec : undefined;
|
|
10
14
|
const enrollment = createDeviceEnrollment({
|
|
11
15
|
store,
|
|
16
|
+
seat,
|
|
12
17
|
rateLimiter: createFixedWindowRateLimiter(DEVICE_ENROLL_RATE_POLICY),
|
|
13
18
|
});
|
|
14
19
|
const hub = createDeviceWsHub({
|
|
@@ -33,7 +38,7 @@ export function createDeviceLane(ctx) {
|
|
|
33
38
|
maxPreAuthPerRemote: knobs?.maxPreAuthPerRemote ?? 8,
|
|
34
39
|
enrollRateLimit: `${DEVICE_ENROLL_RATE_POLICY.limit}/${DEVICE_ENROLL_RATE_POLICY.windowMs / 1000}s per caller identity (per replica; independent of RATE_LIMIT_RPM)`,
|
|
35
40
|
});
|
|
36
|
-
return { store, enrollment, hub };
|
|
41
|
+
return { store, enrollment, hub, seat };
|
|
37
42
|
}
|
|
38
43
|
export function assertDeviceLaneWired(isDeviceLane, lane, hasFactory) {
|
|
39
44
|
if (!isDeviceLane)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
|
|
2
2
|
import { SessionEnvironmentSelection } from "../capabilities/select-environment-tool.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type ServiceConfig } from "../config.js";
|
|
4
4
|
import type { Logger } from "../observability/logger.js";
|
|
5
5
|
import type { Metrics } from "../observability/metrics.js";
|
|
6
6
|
import { PerTaskImageRegistry } from "../per-task-image.js";
|
|
7
7
|
import type { DeviceEnrollment } from "../device-enrollment.js";
|
|
8
8
|
import type { DeviceStore } from "../device-store.js";
|
|
9
|
+
import type { ExecutionPlacementSeat } from "../execution-placement.js";
|
|
9
10
|
import type { DeviceWsHub } from "../device-ws-hub.js";
|
|
10
11
|
import { k8sExecutionEnvFactory, type K8sEnvConfig, type K8sEnvDeps, type SandboxSecretSeat } from "../plugins/remote-env-k8s.js";
|
|
11
12
|
import { type SandboxGitPlane, type SandboxGitRunRows } from "../sandbox-git-plane.js";
|
|
@@ -117,11 +118,12 @@ export declare function assertWorkspaceSpaceReadable(space: ReturnType<typeof fa
|
|
|
117
118
|
readonly headOf: HeadRead | undefined;
|
|
118
119
|
readonly spaceCommits: (() => SpaceCommitRows | undefined) | undefined;
|
|
119
120
|
}, cache: ReturnType<typeof facts.workspaceCache>, sessionStoreLabel: string): void;
|
|
120
|
-
/** device lane
|
|
121
|
+
/** device lane 的活对象(店 / 汇聚端 / 准入链 + 会话店的执行席 —— 绑定的唯一载体与唯一读,工厂与准入链读同一只)。缺席 = 本部署没有 device 车道。 */
|
|
121
122
|
export interface DeviceLaneWiring {
|
|
122
123
|
store: DeviceStore;
|
|
123
124
|
hub: DeviceWsHub;
|
|
124
125
|
enrollment: DeviceEnrollment;
|
|
126
|
+
seat: ExecutionPlacementSeat;
|
|
125
127
|
}
|
|
126
128
|
export interface ExecutionEnvCtx {
|
|
127
129
|
config: ServiceConfig;
|