@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
package/dist/http/server.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import http from "node:http";
|
|
2
|
+
import type { MemoryComplianceFaces } from "../memory-operator-faces.js";
|
|
3
|
+
import type { SideQueryAccounting } from "../budget.js";
|
|
2
4
|
import type { IncomingMessage } from "node:http";
|
|
3
|
-
import { type Runner, type TaskSpec, type TaskResult, type WorkflowRunStore, type MemoryEntry, type MemoryExportBundle, type MemoryImportReport, type EntryProvenanceAccount, type
|
|
5
|
+
import { type Runner, type TaskSpec, type TaskResult, type WorkflowRunStore, type MemoryEntry, type MemoryExportBundle, type MemoryImportReport, type EntryProvenanceAccount, type MemoryEntryOrigin, type OriginClearanceRow, type SessionMemoryStatus, type ConsolidationRunReceipt, type ConsolidationDriverRunRow, type SideQuerySpec, type SideQueryResult, type Brain, type EngineNotice } from "@sema-agent/core";
|
|
4
6
|
import type { TaskRequestBody } from "./wire-types.js";
|
|
5
7
|
import type { ServiceConfig } from "../config-types.js";
|
|
6
8
|
import { type SessionMirrorRuling } from "../web-admin-client/facade.js";
|
|
7
9
|
import type { RestartSignal } from "@sema-agent/settings-schema/fleet";
|
|
8
10
|
import { type OwnerAwareSessionStore } from "../security.js";
|
|
11
|
+
import type { PeerDesk, PeerLease } from "../peer-seat.js";
|
|
12
|
+
import type { ExecutionRoot, ResolvedTaskSpec } from "./execution-context.js";
|
|
9
13
|
import type { RunStore, ImageIndex, ImageBake, CheckpointStoreFull, ResumeAnchorStore, ApprovalExemptionStore, ApprovalNonceStore, ServiceSessionPolicyStore, ServiceFileHistoryStore, ToolResultStoreFull, StoreBackend } from "../plugins/store-backend.js";
|
|
10
14
|
import type { RuleConsentLane } from "../rules-consent.js";
|
|
11
15
|
import { type MemorySyncRequest, type MemorySyncResponse } from "../memory-sync.js";
|
|
@@ -49,6 +53,8 @@ export interface RequestAuth {
|
|
|
49
53
|
* defaultScopes(memory.scopes 种子)。resume 腿(checkpoint 重建 auth)缺席 — 回落持久化的
|
|
50
54
|
* body.projectId(原始提交已验形),那条回落腿自己再折一次小写,两腿查同一个键。 */
|
|
51
55
|
resolvedProjectId?: string;
|
|
56
|
+
/** authorizer 判过的头(`security.ts` `createAuthorizer` 交出;语义见 `AuthContext.head`)⇒ fresh 执行上下文的 `judged`。自建 authorizer 不给 = 解析器不比住客。 */
|
|
57
|
+
head?: import("@sema-agent/core").SessionHead;
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
54
60
|
* [ref] A8 —— ServiceDeps 的**分组窄接口**。
|
|
@@ -57,7 +63,7 @@ export interface RequestAuth {
|
|
|
57
63
|
* 平铺形的直接后果 = main.ts 一个上千行的装配字面量,键与键之间没有任何「属于同一件事」的编译期表达,
|
|
58
64
|
* 键落错家/从未接线只能靠源码钉逐个盯(1.300/1.301/1.304/1.307/1.310 五起真缺陷都是这个病族)。
|
|
59
65
|
*
|
|
60
|
-
* 药:七个**窄**接口 +
|
|
66
|
+
* 药:七个**窄**接口 + 顶层必填八件。装配点按组构造(每组一个带类型标注的中间 const ⇒ 受 TS 多余
|
|
61
67
|
* 属性检查保护),键放错组当场编译红。
|
|
62
68
|
*
|
|
63
69
|
* 兼容形(本批**不动消费点**):`ServiceDeps` = 平铺视图 ∩ 组槽。旧的平铺构造(96 个测试文件 +
|
|
@@ -65,8 +71,8 @@ export interface RequestAuth {
|
|
|
65
71
|
* 入口摊平回平铺视图,server.ts 内的 ~700 处 `deps.x` 消费点原样保留。消费点迁移是后批的事——
|
|
66
72
|
* 一步到位需要同批改 ~700 处 src + ~800 处 test 键位,与「先立形、后搬家」相比没有额外收益。
|
|
67
73
|
*/
|
|
68
|
-
/** createHttpServer
|
|
69
|
-
*
|
|
74
|
+
/** createHttpServer 的**必填八件**——引擎、部署配置、提交的身份与根会话(authorizer)、请求→TaskSpec 的映射、选路席、side-query 执行席、读口场景门、对端座的 desk。
|
|
75
|
+
* 八者恒在场,故留在顶层(不进任何可选组):没有它们 server 根本起不来,包一层可选组只会把编译期
|
|
70
76
|
* 错误推迟到运行期(本仓 E-HIGH-1 病族的成因就是「可选键从未接线、编译期无声」)。 */
|
|
71
77
|
export interface ServiceCoreDeps {
|
|
72
78
|
runner: Runner;
|
|
@@ -80,9 +86,22 @@ export interface ServiceCoreDeps {
|
|
|
80
86
|
sideQuery: (spec: SideQuerySpec) => Promise<SideQueryResult>;
|
|
81
87
|
config: ServiceConfig;
|
|
82
88
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
89
|
+
* Resolve identity + the owned root session BEFORE the spec is built (S6). Throw `HttpError` to reject.
|
|
90
|
+
* 🔴 **必填**:它是一次提交的根会话**唯一**的来源与铸点(体里的 `sessionId` 只由它消费:有属主读的店判属主,单用户嵌入原样采用,
|
|
91
|
+
* 不带 ⇒ 现铸并登记)。省掉是编译错;绕过类型造的 deps 在 {@link createHttpServer} 入口拒启。单用户嵌入传
|
|
92
|
+
* `createAuthorizer(config, runner.sessions)`(包根导出)—— 店没有属主读时它退化为只派 principal 与会话 id。
|
|
93
|
+
*/
|
|
94
|
+
authorize: (ctx: {
|
|
95
|
+
req: IncomingMessage;
|
|
96
|
+
body: TaskRequestBody;
|
|
97
|
+
}) => Promise<RequestAuth>;
|
|
98
|
+
/**
|
|
99
|
+
* Map an inbound request body + resolved auth to a TaskSpec. The SERVICE/deployment owns model
|
|
100
|
+
* + tools + mcp here (callers only supply content). `auth` carries the principal-derived memory scope —
|
|
101
|
+
* prefer it over anything in the body.
|
|
102
|
+
* The root session is NOT the resolver's to write: the return type carries no `sessionId`
|
|
103
|
+
* (`ResolvedTaskSpec`); the server stamps the root the authorizer resolved onto every spec it executes
|
|
104
|
+
* (`http/execution-context.ts` `stampSpecRoot`). A resolver that needs the root reads `opts.execution.root`.
|
|
86
105
|
*/
|
|
87
106
|
/** `opts.leg` (codex R4, appendSystemPrompt 案): "fresh" ⇒ a NEW submit — resolveSpec may fail-loud 400 on
|
|
88
107
|
* combos that would silently discard caller payload (append rider / outputStyle on an append-less pack).
|
|
@@ -105,12 +124,19 @@ export interface ServiceCoreDeps {
|
|
|
105
124
|
* `opts.unattendedLeg`([ref] 候裁 18,codex r3 F1;[ref] ① 改形):续跑家族在 ctx 带无人值守标(`CheckpointCtx.unattendedLeg`)时递 `true` ——
|
|
106
125
|
* 装配器在**全部折叠之后**经首跑同一只合并口 `withUnattendedLeg` 重挂那条腿(`default` + 按类作答的 onAsk)。只由续跑腿
|
|
107
126
|
* 按服务端写的 ctx 位递,绝不从请求体读。 */
|
|
108
|
-
|
|
127
|
+
/** `opts.execution`(必填):这条腿的执行上下文(`http/execution-context.ts`;只 `fresh` / `continuation` 两形,`root` 恒在)。装配器要用这条腿的根会话
|
|
128
|
+
* (场景设施的分区键、受理见证)读 `opts.execution.root` —— 它与 server 随后盖进 spec 的根是同一个值,装配器自己不写根。 */
|
|
129
|
+
/** `opts.lease`(必填):这条腿的**宿主租约** —— 装配在它之下登记本腿交给引擎的对端声明(`peerDesk.declare(草稿, opts.lease)`)。
|
|
130
|
+
* 租约由两只漏斗(受理 `prepareSpec` / 续跑 `resolveResumeSpecOrBlocked`)在调用本函数**之前**开、由漏斗的失败出口或拿到产物的那段作用域放;
|
|
131
|
+
* 装配只借用,不放、不留。实现方自铸的声明归自己的 desk 时可以不理它。 */
|
|
132
|
+
resolveSpec: (body: TaskRequestBody, req: IncomingMessage | undefined, auth: RequestAuth | undefined, opts: {
|
|
109
133
|
leg?: "fresh" | "resume";
|
|
110
134
|
liveStream?: boolean;
|
|
111
135
|
onNotice?: (notice: EngineNotice) => void;
|
|
112
136
|
unattendedLeg?: true;
|
|
113
|
-
|
|
137
|
+
lease: PeerLease;
|
|
138
|
+
execution: ExecutionRoot;
|
|
139
|
+
}) => ResolvedTaskSpec | Promise<ResolvedTaskSpec>;
|
|
114
140
|
/**
|
|
115
141
|
* [ref] 场景 hands lane 选路:按 `resolveSpec` 刚产出的 TaskSpec 取本任务的执行 Runner。
|
|
116
142
|
* 装配点(`boot/stage-10-http-server.ts`)传的是 `createHandsRunnerSelector` —— 选路规则只有那一份实现,
|
|
@@ -134,6 +160,16 @@ export interface ServiceCoreDeps {
|
|
|
134
160
|
* `createScenarioGate` / `ScenarioGate` / `ScenarioGateLeg` / `ScenarioGateSources`)。
|
|
135
161
|
*/
|
|
136
162
|
scenarioGate: import("../capabilities/scenarios.js").ScenarioGate;
|
|
163
|
+
/**
|
|
164
|
+
* 对端座的 desk(`peer-seat.ts`):MCP http 请求的凭据头 / stdio 子进程的环境 / A2A 发送的头,发送时只有它一只作答者;登记一条活到它的 holder 都空。
|
|
165
|
+
* 本层用它开**宿主租约**:受理与续跑两只漏斗在装配之前各开一只(`lease("fresh")` / `lease("resume")`),经 `resolveSpec` 的 `opts.lease` 交给装配,
|
|
166
|
+
* 随产物(`PreparedTaskSubmission.peerLease` / 续跑结果)交给拿到它的那段作用域,在那段作用域的 `finally` 放;活过那段作用域的驱动经 `heldFor` 自持一只。
|
|
167
|
+
* 这只 desk 另有三处用法,不止这两只漏斗:① 探测口 `POST /v1/capabilities/mcp/probe` 的调用方臂在走查里开一只 `probe` 租约(三道前置拒之后开,拨号落地才放);
|
|
168
|
+
* ② 两张会话面板(`GET /v1/sessions/:id/mcp` · `…/a2a`)与探测走查拨名册声明时递它的座(`desk.seat`),不开租约;③ 名册声明在起服时登记在一只进程寿命的 `roster` 租约下
|
|
169
|
+
* (stage-07 / run-local 开,从不放),并且每只 Runner 的 `peerSeat` 是它的座。登记表的两个读数是 `/metrics` 的 `peer_registry_entries` / `peer_registry_holders`。
|
|
170
|
+
* 🔴 **必填**:没有 MCP / A2A 凭据的嵌入也给一只 `createPeerDesk()`(零 IO)—— 一个部署只有一张登记表,缺席不是「没有座」的另一种读法。
|
|
171
|
+
*/
|
|
172
|
+
peerDesk: PeerDesk;
|
|
137
173
|
}
|
|
138
174
|
/** **durable 持久面**:每个键 present ⇔ 对应路由/能力位在场,absent ⇒ 501(诚实缺席),
|
|
139
175
|
* 绝不静默降级。装配点 = main.ts 的 store backend 开箱段。 */
|
|
@@ -354,7 +390,7 @@ export interface ServiceSeamDeps {
|
|
|
354
390
|
deviceStore?: import("../device-store.js").DeviceStore;
|
|
355
391
|
/**
|
|
356
392
|
* [ref](车C 余件):device lane 的**准入链**(`createDeviceEnrollment`)—— 管理面三个写动词
|
|
357
|
-
* (签发 / 注册 / 吊销)与首绑写协议(`
|
|
393
|
+
* (签发 / 注册 / 吊销)与首绑写协议(`commitExecutionContext` 的设备那一支)的**唯一**判据属主。
|
|
358
394
|
*
|
|
359
395
|
* 🔴 为什么路由拿的是它而不是 {@link deviceStore}:enrollment 那一层持着两件路由造不出来的东西 ——
|
|
360
396
|
* ①跨副本限速座(`DeviceEnrollRateLimiter`,§7-T5 ⑤:端点车**必须**传一个,而它由 boot 从既有
|
|
@@ -471,12 +507,7 @@ export interface ServiceSeamDeps {
|
|
|
471
507
|
* 🔴 `erase` 的入参是 `unknown` 而不是 `EraseMemoryEntriesInput`:HTTP 层拿到的是一个**未校验**的对象,
|
|
472
508
|
* 三选一选择子的整体判决是 core 的单一属主面(`erasureRequestInvalid`)。写成具体类型就得在路由里断言
|
|
473
509
|
* 一次「它是合法输入」——那句断言是假的,而且正好把类型检查关灯。 */
|
|
474
|
-
memoryCompliance?:
|
|
475
|
-
provenanceOf: (entryId: string) => Promise<EntryProvenanceAccount>;
|
|
476
|
-
erase: (input: unknown, opts?: {
|
|
477
|
-
allowedScopes?: readonly string[];
|
|
478
|
-
}) => Promise<MemoryErasureAttestation>;
|
|
479
|
-
};
|
|
510
|
+
memoryCompliance?: MemoryComplianceFaces;
|
|
480
511
|
/** [ref] seam①([ref] §S-7,core 7.0.2 [ref] 件1):**会话记忆状态读面**。启用
|
|
481
512
|
* `GET /v1/sessions/:id/memory-status`(owner 门,tenant 自助读 —— 不是 operator 面)。
|
|
482
513
|
* main.ts 把它接到 `createSessionMemoryStatusFace` 的产物上(单实例引擎,SQL capture 店同座喂入)。
|
|
@@ -586,27 +617,20 @@ export interface ServiceSeamDeps {
|
|
|
586
617
|
* per-principal 查询走 caps client 的 executionRuling 同车(零额外 RTT);absent = 无 center(单用户/
|
|
587
618
|
* dry-run)⇒ 观测面不接线,零行为差。fail-open:观测失败绝不影响 sync 面本身。 */
|
|
588
619
|
sessionMirrorRuling?: (principal: string | undefined) => Promise<SessionMirrorRuling | undefined>;
|
|
620
|
+
/** 主体的执行车道裁定(caps client 的 `executionRuling`,与场景裁定同车零额外 RTT)—— 执行上下文解析器步 ③ 的唯一输入(`http/execution-context.ts`,
|
|
621
|
+
* 判据 `runtime-caps-resolver.ts` `gateExecutionLane`)。缺席 = 无中心(单用户 / dry-run / 嵌入方)⇒ 不判,与已发同。 */
|
|
622
|
+
executionRuling?: (principal: string | undefined) => Promise<import("../web-admin-client/facade.js").ExecutionRuling | undefined>;
|
|
589
623
|
/** Degenerate-output a/b instrument: on errorCode=output.degenerate, inspect the session's turns to
|
|
590
624
|
* classify where the salvageable answer was (counter + log). Fire-and-forget; no-op otherwise. */
|
|
591
625
|
instrumentDegenerate?: (result: TaskResult) => void;
|
|
592
626
|
/** [ref] side-query 记账 seam(budget.ts createSideQueryAccountant——与 createTracer 同一装配点、
|
|
593
627
|
* 同一组 sink 实例:costQuota/model_cost 指标/fleetUsage/fleetLease,四路同语义)。缺席=零记账
|
|
594
628
|
* (手搭测试 deps;生产 main.ts 恒传)。 */
|
|
595
|
-
sideQueryAccounting?:
|
|
596
|
-
model: string;
|
|
597
|
-
family?: "input-includes-cached" | "input-excludes-cached";
|
|
598
|
-
usage?: {
|
|
599
|
-
input?: number;
|
|
600
|
-
output?: number;
|
|
601
|
-
cacheRead?: number;
|
|
602
|
-
cacheWrite?: number;
|
|
603
|
-
cost?: {
|
|
604
|
-
total?: number;
|
|
605
|
-
};
|
|
606
|
-
};
|
|
607
|
-
}) => void;
|
|
629
|
+
sideQueryAccounting?: SideQueryAccounting;
|
|
608
630
|
/** [ref](core 7.32.0):parked 赎回面工厂(按行解析驱动哪只 Agent 工具 + 同出一张列表的继承座;属主 `parked-revive-surface.ts`)。
|
|
609
|
-
* 缺席 = 这台部署没有 park 底座(checkpointStore / backgroundAgentStore 任一缺席),bg 赎回臂不接线。
|
|
631
|
+
* 缺席 = 这台部署没有 park 底座(checkpointStore / backgroundAgentStore 任一缺席),bg 赎回臂不接线。
|
|
632
|
+
* 🔴 **在场 ⇒ `sessionStorage` 必须带执行席 `executionPlacement`**:认领之后对根会话住客的唯一判官是执行席上的写口;缺 ⇒ `createHttpServer` 拒启
|
|
633
|
+
* (句子 = `PARKED_REVIVE_EXECUTION_SEAT_REQUIRED`)。 */
|
|
610
634
|
parkedReviveSurface?: import("../parked-revive-surface.js").ParkedReviveSurfaceFactory;
|
|
611
635
|
/** 可选第三件:revive args 的 `subagent_type` roster 成员集([ref] Q1 成员性规则)。当前生产装配
|
|
612
636
|
* **恒缺席**(boot 内建 default 无自定义 agents roster,per-request 的 spec.agents 不进 boot 工具)
|
|
@@ -641,14 +665,6 @@ export interface ServiceObservabilityDeps {
|
|
|
641
665
|
/** **准入/治理面**:身份解析与配额/限流/租约。每一件都是**拒绝**的权力(400/403/429),
|
|
642
666
|
* 缺席 = 该道门不存在(不是「默认放行的门」——两者在事故复盘里语义完全不同)。 */
|
|
643
667
|
export interface ServiceGovernanceDeps {
|
|
644
|
-
/**
|
|
645
|
-
* Resolve identity + the owned session BEFORE the spec is built (S6). Throw `HttpError` to reject.
|
|
646
|
-
* Optional: when omitted, no principal/ownership enforcement (the body's sessionId is used as-is).
|
|
647
|
-
*/
|
|
648
|
-
authorize?: (ctx: {
|
|
649
|
-
req: IncomingMessage;
|
|
650
|
-
body: TaskRequestBody;
|
|
651
|
-
}) => Promise<RequestAuth>;
|
|
652
668
|
/** 鉴权桥(registry-core api/auth-bridge):registry 用户 JWT → principal。缺席=分支不存在
|
|
653
669
|
* (bearer 只认 SERVICE_AUTH_TOKEN(S),现状不变)。 */
|
|
654
670
|
webAdminJwtVerifier?: {
|
|
@@ -699,6 +715,12 @@ export interface ServiceDeploymentDeps {
|
|
|
699
715
|
* seat answer + the static patch judge). Caps `credentialPlane.sandboxGit` projects it as is. Absent = not built by the composition root
|
|
700
716
|
* (a fixture) ⇒ the same judge on config alone, the seat counted as not asked. */
|
|
701
717
|
sandboxGitPlane?: import("../sandbox-git-plane.js").SandboxGitPlane;
|
|
718
|
+
/**
|
|
719
|
+
* 本进程起服装上的**运维声明** mod 包数(部署座装配口 `assembleDeploymentMods` 的 `loaded.length`;本服务自铸的注册不算)。一个事实两个出口,同读这一格:
|
|
720
|
+
* `/health` 的 `mods: { deploymentPackages }` 与 `/v1/capabilities` 的 `modsDeploymentPackages: true` —— 都只在 > 0 时在场;0 / 缺席(没声明,或不是由
|
|
721
|
+
* composition root 装起来的夹具)⇒ 两键都缺席,两面与没有声明的部署逐字节同。
|
|
722
|
+
*/
|
|
723
|
+
deploymentModPackages?: number;
|
|
702
724
|
/**
|
|
703
725
|
* Graceful drain — shared mutable state between main.ts (flips `draining` on SIGTERM) and this server:
|
|
704
726
|
* • while `draining`, NEW model-running submissions (the billable submit paths) get 503 + Retry-After, so an
|
|
@@ -861,7 +883,7 @@ export interface ServiceDepGroups {
|
|
|
861
883
|
deployment?: ServiceDeploymentDeps;
|
|
862
884
|
knobs?: ServiceKnobDeps;
|
|
863
885
|
}
|
|
864
|
-
/** 平铺视图 =
|
|
886
|
+
/** 平铺视图 = 必填八件 + 其余七组的全可选并集。**派生**自组接口,故与分组形永不漂。 */
|
|
865
887
|
export type FlatServiceDeps = ServiceCoreDeps & Partial<ServiceStoreDeps & ServiceCoordinatorDeps & ServiceSeamDeps & ServiceObservabilityDeps & ServiceGovernanceDeps & ServiceDeploymentDeps & ServiceKnobDeps>;
|
|
866
888
|
/** createHttpServer 的入参:两形皆可(平铺=存量,分组=推荐)。同名键两形都给时,**顶层显式键赢**
|
|
867
889
|
* (含显式 `undefined`)——一处装配点只该用一形,混用时以肉眼最近的那个为准。 */
|
package/dist/http/server.js
CHANGED
|
@@ -4,6 +4,7 @@ import { validatePendingSteer } from "@sema-agent/core";
|
|
|
4
4
|
import {} from "../web-admin-client/facade.js";
|
|
5
5
|
import { describeValueShape } from "@sema-agent/settings-schema";
|
|
6
6
|
import { HttpError } from "../security.js";
|
|
7
|
+
import { SessionForkInProgressError } from "../execution-placement.js";
|
|
7
8
|
import {} from "../memory-sync.js";
|
|
8
9
|
import {} from "../orchestration/workflow-agent-steer.js";
|
|
9
10
|
import {} from "../orchestration/workflow-completion-inbox.js";
|
|
@@ -22,6 +23,7 @@ import { createRequestGuards } from "./request-guards.js";
|
|
|
22
23
|
import { sqlEngineSeatIssue } from "../sql-engine-posture.js";
|
|
23
24
|
import { parkDecisionStoreRefusal } from "../orchestration/workflow-park-decision.js";
|
|
24
25
|
import { CHECKPOINT_CTX_SEALING_REQUIRED } from "./checkpoint-ctx.js";
|
|
26
|
+
import { PARKED_REVIVE_EXECUTION_SEAT_REQUIRED } from "../parked-decide.js";
|
|
25
27
|
import { retiredServiceDepsRefusal } from "./retired-service-deps.js";
|
|
26
28
|
import { createAdmission, MAX_SKILL_CONTENT_CHARS, MAX_SYSTEM_PROMPT_CHARS, MAX_OUTPUT_SCHEMA_CHARS, validateUserSkills } from "./admission.js";
|
|
27
29
|
import { createResumeLegs } from "./resume-legs.js";
|
|
@@ -61,6 +63,9 @@ export function createHttpServer(rawDeps) {
|
|
|
61
63
|
if (typeof deps.runnerFor !== "function") {
|
|
62
64
|
throw new Error("createHttpServer: the runnerFor seat is required (it picks each task's Runner from its execution lane) — pass the hands-lane selector, or `runnerFor: () => runner` for a single-Runner embedding; refusing to start rather than run every task on the widest Runner");
|
|
63
65
|
}
|
|
66
|
+
if (typeof deps.authorize !== "function") {
|
|
67
|
+
throw new Error("createHttpServer: the authorize seat is required — it is the only resolver of a submission's root session; pass `createAuthorizer(config, runner.sessions)` for a single-user embedding; refusing to start rather than run submissions on a root nobody attested");
|
|
68
|
+
}
|
|
64
69
|
{
|
|
65
70
|
const retired = retiredServiceDepsRefusal(deps);
|
|
66
71
|
if (retired !== undefined)
|
|
@@ -88,6 +93,8 @@ export function createHttpServer(rawDeps) {
|
|
|
88
93
|
}
|
|
89
94
|
if (deps.checkpointStore !== undefined && deps.checkpointCtxSealing === undefined)
|
|
90
95
|
throw new Error(`createHttpServer: ${CHECKPOINT_CTX_SEALING_REQUIRED}`);
|
|
96
|
+
if (deps.parkedReviveSurface !== undefined && deps.sessionStorage?.executionPlacement === undefined)
|
|
97
|
+
throw new Error(`createHttpServer: ${PARKED_REVIVE_EXECUTION_SEAT_REQUIRED}`);
|
|
91
98
|
const idemCache = new IdempotencyCache();
|
|
92
99
|
const inflightRuns = new Map();
|
|
93
100
|
const preemptableRuns = new DrainYieldingPreemptBook(() => deps.drainState?.draining === true);
|
|
@@ -164,6 +171,10 @@ export function createHttpServer(rawDeps) {
|
|
|
164
171
|
}
|
|
165
172
|
if (sendSessionError(res, err, "open"))
|
|
166
173
|
return;
|
|
174
|
+
if (err instanceof SessionForkInProgressError) {
|
|
175
|
+
sendError(res, 409, err.code, err.message);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
167
178
|
sendError(res, 500, "internal.error", "internal error");
|
|
168
179
|
});
|
|
169
180
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* [ref] × 7.106.0 合并复审 X1(gpt-6 腿 A F1 [high],验证腿 B verified)—— 请求键 `inheritEnv` 的**会话绑定唯一提交点**。
|
|
3
3
|
*
|
|
4
|
-
* ── 分界(与 `
|
|
4
|
+
* ── 分界(与 `execution-context.ts` 认领之后的执行放置提交同一句判据)──────────────────────────────────────────────────
|
|
5
5
|
* 凡需要「这条会话此刻归我这条 run」才成立的事,排在 run 认领之后;其余全排在建任何东西之前。`inheritEnv` 的三道判
|
|
6
6
|
* (值形 / 车道 / 射程)是**读**,住在 `resolveSpec`(两腿同判,任何副作用之前);而「本会话的 host 工厂下一次造环境按哪个词」
|
|
7
7
|
* 是**写**,它只属于一条**被受理**的 run —— 修前它写在 `resolveSpec` 的最后一步,仍先于路由层的拒(`/v1/tasks/stream` 的
|
|
@@ -28,10 +28,9 @@ export interface SessionInheritEnvCommitCtx {
|
|
|
28
28
|
bindSessionInheritEnv?: ((sessionId: string, policy: TaskInheritEnv | undefined) => void) | undefined;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* 在 run 认领之后调用:把受理的那条请求的 `inheritEnv`(缺席 = 清)
|
|
32
|
-
* 不写 —— `"all"` 在那一形已被 `resolveSpec` 响亮拒,`"scrub"` / 缺席与工厂缺省同形。
|
|
31
|
+
* 在 run 认领之后调用:把受理的那条请求的 `inheritEnv`(缺席 = 清)写进本会话(这条 run 的根会话)的绑定。
|
|
33
32
|
*/
|
|
34
|
-
export declare function commitSessionInheritEnv(ctx: SessionInheritEnvCommitCtx, sessionId: string
|
|
33
|
+
export declare function commitSessionInheritEnv(ctx: SessionInheritEnvCommitCtx, sessionId: string, body: {
|
|
35
34
|
readonly inheritEnv?: TaskInheritEnv | undefined;
|
|
36
35
|
}): void;
|
|
37
36
|
//# sourceMappingURL=session-inherit-env.d.ts.map
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* cut: ONLY TaskRequestBody (its field types are inline or core imports — no other server.ts-local satellites);
|
|
7
7
|
* sibling request/response shapes can migrate here later on the same pattern.
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { AgentDefinition, ApprovalReach, PermissionMode, SkillSpec, TaskSpec } from "@sema-agent/core";
|
|
10
10
|
import type { RequestMcpServerSpec } from "../mcp-assertion-header.js";
|
|
11
|
+
import type { RequestA2aPeer } from "../task-a2a.js";
|
|
11
12
|
import type { wiringManifestFaceEventData } from "../trace/project.js";
|
|
12
13
|
import type { buildSyncSubmitBody } from "./sync-submit-body.js";
|
|
13
14
|
import type { EntryProblem } from "../entry-problems.js";
|
|
@@ -194,7 +195,7 @@ export interface TaskRequestBody {
|
|
|
194
195
|
* after it"). core enforces the "before" edges and the service passes its rejection codes through UNCHANGED for the
|
|
195
196
|
* shell to render: `resume_at.before_target_not_user` (only plain user-message targets),
|
|
196
197
|
* `resume_at.before_root_unsupported` (can't rewind past the session root — start a new session),
|
|
197
|
-
* `rewind_snapshot.unresolvable` (
|
|
198
|
+
* `rewind_snapshot.unresolvable` (restoreFiles: no snapshot at/above the "before" branch point). Only meaningful
|
|
198
199
|
* WITH `resumeAt` — sent alone it's a 400 (fail-loud, not a silent no-op). */
|
|
199
200
|
resumeAtMode?: string;
|
|
200
201
|
/** [ref] Phase3 (reuse-path warm-resume): require the `sessionId` to ALREADY exist. When `true` and the session
|
|
@@ -220,11 +221,6 @@ export interface TaskRequestBody {
|
|
|
220
221
|
/** DV-15: opt-in tolerance for a PARTIAL file restore (default = loud terminal failure carrying the per-file
|
|
221
222
|
* ledger; `true` = keep going and disclose the same ledger on the result's rewindNotes). */
|
|
222
223
|
acceptPartialRestore?: boolean;
|
|
223
|
-
/** RETIRED spelling (whole-tree epoch). Still accepted on the wire: its capture sense (true, no resumeAt) is
|
|
224
|
-
* a tolerated no-op with a deprecation disclosure; its restore sense (true + resumeAt) is a typed rejection
|
|
225
|
-
* naming `restoreFiles` — the restore semantics genuinely changed (whole tree ⇒ tracked set), so that
|
|
226
|
-
* migration is explicit by design (core adjudicates; the server never remaps it silently). */
|
|
227
|
-
rewindFiles?: boolean;
|
|
228
224
|
/** R8 code-only rewind (CC "Restore code" mode): converge the TRACKED set to the history boundary at a prior
|
|
229
225
|
* USER message WITHOUT forking the conversation (the session leaf is untouched — only the files move). The
|
|
230
226
|
* value is the same handle as `resumeAt` (the prompt's taskId); the service resolves it → the entry id. Honored ONLY
|
|
@@ -234,7 +230,7 @@ export interface TaskRequestBody {
|
|
|
234
230
|
* 与 `checkpointStore` 同;没有 `"enabled"` —— 缺席就是「部署说了算」的唯一形,声明只能单向收紧)。`"disabled"` ⇒
|
|
235
231
|
* 这条 run 零历史店调用:编辑照常落盘,但不做首次触碰备份、不铸回合边界、不做 fork 携带;委派出去的子代继承
|
|
236
232
|
* (core `ParentSpecSeat` 从本位铸,本仓零接线)。`wiring_manifest.fileHistory` 报 `"disabled"`。
|
|
237
|
-
* 同一个提交里再要还原(`restoreFiles` / `rewindFilesTo`
|
|
233
|
+
* 同一个提交里再要还原(`restoreFiles` / `rewindFilesTo`)= 体内矛盾 ⇒ **受理时** 400
|
|
238
234
|
* `request.field_conflict`(`request-value-closure.ts` 的 `FILE_HISTORY_DISABLED_NO_RESTORE`):立门时 core 的 `rewind.capture_disabled`
|
|
239
235
|
* 落在会话按 `resumeAt` 分叉之后、拒后不回滚,所以本层在副作用之前拒([ref] / core 7.35.0 [ref] 起 core 在分叉**之前**拒,
|
|
240
236
|
* 本层 400 照旧有效)。续跑腿不过这道门。
|
|
@@ -471,7 +467,7 @@ export interface TaskRequestBody {
|
|
|
471
467
|
* · 仅 `REMOTE_EXEC=device` 的部署接受;其它车道收到它 = **400 响亮拒**(不静默忽略 —— 调用方会
|
|
472
468
|
* 以为自己指定了执行设备,而那条声明从未存在);
|
|
473
469
|
* · 仅**根任务**提交携带(子代无条件继承根绑定,core 为 subagent/cascade/verify 另铸 sessionId);
|
|
474
|
-
* · 首绑 =
|
|
470
|
+
* · 首绑 = 根会话行执行格的 absent → writer(device, D)(按受理那一读的住客定址,并发单赢家);后续根提交:缺席 = 沿用绑定 / 携且同 = 幂等 /
|
|
475
471
|
* 携且异 = 403 `device.identity_mismatch`(**v1 无隐式重绑**,换设备走
|
|
476
472
|
* `POST /v1/devices/sessions/:rootSessionId/rebind`);
|
|
477
473
|
* · resume 家族(`/decide` / `/answer` / `/plan_review` / `/wake`)**不收**这个键:车道随树固定。
|
|
@@ -490,10 +486,11 @@ export interface TaskRequestBody {
|
|
|
490
486
|
/** [ref]⑧/[ref]/[ref] (core 5.23.0 `TaskSpec.oneShot`): this SUBMISSION is one-shot — no later turn exists
|
|
491
487
|
* in which an async background notification could land (the archetypal case is a headless `sema -p` whose
|
|
492
488
|
* process exits when the turn ends). PER-REQUEST on purpose: "does this submission expect to be continued" is
|
|
493
|
-
* a property of the submission, not of the connection it arrived on. core
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
489
|
+
* a property of the submission, not of the connection it arrived on. Since core 7.60.0 it changes when the
|
|
490
|
+
* submission ends: where a one-shot run would end, the engine waits for the background agents and workflow runs
|
|
491
|
+
* it started (a background command or Monitor watch is never waited for), bounded by the run's walltime, a cancel
|
|
492
|
+
* and a 600 s ceiling; a sync submission therefore returns after that background work. It grants nothing, so
|
|
493
|
+
* there is no tenancy gate. Sibling of `interactiveTools` (the same `-p` posture) and passed
|
|
497
494
|
* through the same way: a boolean rides, absent/garbage ⇒ key omitted (core's default = interactive). Rides the
|
|
498
495
|
* persisted body onto resume legs. */
|
|
499
496
|
oneShot?: boolean;
|
|
@@ -554,22 +551,29 @@ export interface TaskRequestBody {
|
|
|
554
551
|
* 与 `principalHeader` **互斥**:同设 ⇒ 新提交腿同步 400 `request.body_shape`(拒句与契约包解析期那一句逐字相同);值不是字符串 ⇒ 400
|
|
555
552
|
* `request.field_invalid`。耐久 resume 腿不拒(重放存量 body),也**不摘 server**(摘了,park 在它工具审批上的任务批准后撞 `resume.tool_unavailable`
|
|
556
553
|
* 且每次重试重放同一份 body):降级到升级前的读法 —— server 照挂、`principalHeader` 胜、`assertionHeader` 不生效,一行 warn `mcp_assertion_header_ignored`。
|
|
557
|
-
* ⚠️
|
|
558
|
-
* 声明被接收、server 照常挂载但不带断言头,并有一行运维 info `mcp_assertion_header_not_sent { server }
|
|
554
|
+
* ⚠️ **只承载、不发送**:引擎的断言头是固定的名、值由部署的对端座作答,本部署没有断言来源 ——
|
|
555
|
+
* 声明被接收、server 照常挂载但不带断言头,并有一行运维 info `mcp_assertion_header_not_sent { server }`。
|
|
556
|
+
*
|
|
557
|
+
* `transport.env`(stdio)/ `transport.headers`(http)是这台 server 的**件**:server 交给引擎的声明里不带它们,件由部署的对端座在起子进程 / 发请求时按原字节作答
|
|
558
|
+
* (只对胜出部署同名判的条目登记;件的名与值由引擎在每次发送时判,不合 ⇒ 那一台不连、兄弟照挂)。 */
|
|
559
559
|
mcpServers?: RequestMcpServerSpec[];
|
|
560
560
|
/** [DESIGN-269 车1] Caller-supplied per-request A2A peers (remote agents this task may call), aligned to
|
|
561
561
|
* core `A2aServerSpec`. 🔒 honored on a SINGLE-USER deployment (task-a2a.ts `a2aInjectionHonored`, the same
|
|
562
562
|
* predicate `capabilities.a2aInjection` advertises) — the requester is the super-admin of their OWN worker,
|
|
563
563
|
* on ANY execution lane (an A2A call is a plain outbound HTTPS request from the worker, so the lane where
|
|
564
564
|
* tool calls run is irrelevant); IGNORED on multi-tenant (a tenant can't point the shared worker at an
|
|
565
|
-
* agent of their choosing).
|
|
565
|
+
* agent of their choosing). The gate also closes under the operator lock `a2a` and under a compliance posture that denies `a2a_peers`
|
|
566
|
+
* (the engine refuses a task that declares a peer under either): under the lock a request that carries `a2aPeers` is refused
|
|
567
|
+
* 400 `config.locked_key` at the head of the request (the same code and status table as the MCP lock); on a multi-tenant
|
|
568
|
+
* deployment or under a compliance denial the list is ignored and said (`a2a_injection_ignored`). A new submission
|
|
566
569
|
* with a malformed list or entry is refused 400 (`assertRequestA2aEntries`: not an array / over the 32-entry
|
|
567
570
|
* cap / an entry that is not an object / a key outside {@link A2A_PEER_ENTRY_KEYS} / a key whose value is
|
|
568
571
|
* unusable / a url or cardUrl carrying a credential) — the same refusal shape as `mcpServers`, whatever the lane.
|
|
569
572
|
* 🔴 Every skill a peer advertises mounts `egress:true` + `effect:"write"` (core's ruling) — declaring a
|
|
570
573
|
* peer is declaring an outbound WRITE channel, not a data source. Validated + gated downstream; the
|
|
571
|
-
* center/config baseline wins on a name clash (the peer name IS the tool namespace).
|
|
572
|
-
|
|
574
|
+
* center/config baseline wins on a name clash (the peer name IS the tool namespace). `headers` are the peer's PIECES: the declaration the
|
|
575
|
+
* server hands the engine carries none of them — the deployment's peer seat answers them, as written, at each send to the declared origins. */
|
|
576
|
+
a2aPeers?: RequestA2aPeer[];
|
|
573
577
|
/** CC parity (Workflow super-set): per-task activation of the LLM-authored workflow engine (core `run_workflow`).
|
|
574
578
|
* `true` → `spec.selfOrchestration` (the engine mounts run_workflow), gated on the deployment's `selfOrchestrationEnabled`
|
|
575
579
|
* (else a harmless no-op) + core's `allowWorkflows` per-principal entitlement on multi-tenant (single-user honors
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* `ALLOW_UNAUTHED_WRITES`)、以及别人替属主按下的那一跑(受理请求验过的主体不是这一行的属主:唤醒 / 决定投递铸的新一跑)。读者一律按「不合格」处置
|
|
14
14
|
* (fail-closed),不分辨三种成因;存量行不回填(没有事实可回填)。
|
|
15
15
|
*
|
|
16
|
-
* 化身号 `principalInc`:令牌 `sub_inc` 声明原样,经契约包 `VerifiedIdentity.principalInc` 读(settings-schema 14.7.0
|
|
16
|
+
* 化身号 `principalInc`:令牌 `sub_inc` 声明原样,经契约包 `VerifiedIdentity.principalInc` 读(settings-schema 14.7.0 加的可选字段,已提货:验证腿随身份带出);本版接线未做 ⇒ 恒 `null`,
|
|
17
17
|
* 接线点在 `admitRunIdentity` 的 `sso` 臂(不在本仓另定一份读法)。
|
|
18
18
|
*/
|
|
19
19
|
/** 验过的身份来源的**闭集**(序 = 判定次序 = `/health.auth.kinds` 的出现序;加一个来源 = 加一个词,读它的各只穷举 `switch` 不接就编译红)。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ export type { TaskRequestBody } from "./http/wire-types.js";
|
|
|
26
26
|
export { ensureCheckpointCtxSealing } from "./sealed-key.js";
|
|
27
27
|
export type { CheckpointCtxSealing } from "./http/checkpoint-ctx.js";
|
|
28
28
|
export { createHttpServer, type ServiceDeps, type RequestAuth, type FlatServiceDeps, type ServiceDepGroups, type ServiceCoreDeps, type ServiceStoreDeps, type ServiceCoordinatorDeps, type ServiceSeamDeps, type ServiceObservabilityDeps, type ServiceGovernanceDeps, type ServiceDeploymentDeps, type ServiceKnobDeps, } from "./http/server.js";
|
|
29
|
+
export type { ExecutionContext, ResolvedTaskSpec, RootedTaskSpec } from "./http/execution-context.js";
|
|
30
|
+
export { createPeerDesk } from "./peer-seat.js";
|
|
31
|
+
export type { PeerDesk, PeerLease, McpDraft, A2aDraft } from "./peer-seat.js";
|
|
29
32
|
export { createSideQueryLane, type KeyResolver, type SideQueryLane, type SideQueryLaneCtx } from "./boot/side-query-lane.js";
|
|
30
33
|
export { createKeyResolver, resolveModelApiKey, type ModelKeyRef } from "./key-resolver.js";
|
|
31
34
|
export { isModelKeyPoison, ModelKeyPoisonedError, type ModelKeyPoison, type ModelKeyPoisonReason } from "./key-resolver.js";
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export { createAuthorizer, principalFrom, HttpError, } from "./security.js";
|
|
|
22
22
|
export { memoryScopeFor, memoryEngineBackendFor } from "./memory-scope.js";
|
|
23
23
|
export { ensureCheckpointCtxSealing } from "./sealed-key.js";
|
|
24
24
|
export { createHttpServer, } from "./http/server.js";
|
|
25
|
+
export { createPeerDesk } from "./peer-seat.js";
|
|
25
26
|
export { createSideQueryLane } from "./boot/side-query-lane.js";
|
|
26
27
|
export { createKeyResolver, resolveModelApiKey } from "./key-resolver.js";
|
|
27
28
|
export { isModelKeyPoison, ModelKeyPoisonedError } from "./key-resolver.js";
|
package/dist/leader/wire.d.ts
CHANGED
|
@@ -91,6 +91,13 @@ export interface LeaderWireConfig {
|
|
|
91
91
|
* 分租户,只补席不包裹 = 归因恒 undefined = 假绿。缺席 ⇒ 展开空对象(与接线前逐字相同)。
|
|
92
92
|
*/
|
|
93
93
|
tracer?: RunnerDeps["tracer"];
|
|
94
|
+
/**
|
|
95
|
+
* **部署座**(`RunnerDeps.mods`),原样递给本车道的每一只 Runner。唯一铸点 = 起服第 5 段的装配口 `assembleDeploymentMods`(本服务自铸的注册在前、
|
|
96
|
+
* 运维声明的 mod 包在后、整列过引擎准入);主 / 无手 / hook 代理 / 子代经共享基座吃的就是它,`boot/leader.ts` 搬的是**同一份**。
|
|
97
|
+
* leader 不自铸、不自己装配(一个进程两份部署注册 = 主车道与 leader 车道各按一套扩展跑)。缺失时整个部署座在这条车道上缺席:运维声明的守卫包
|
|
98
|
+
* 管不到 leader 派出的腿,拒绝计量 / 工具追踪也漏这条腿。缺席 ⇒ 展开空对象。
|
|
99
|
+
*/
|
|
100
|
+
mods?: RunnerDeps["mods"];
|
|
94
101
|
/**
|
|
95
102
|
* [ref]([ref],[ref]-T1)—— **部署级 token 治理窗**两键,**成对**递给本车道的每一只 Runner。
|
|
96
103
|
* 属主 = `config.usageWindows`(声明)+ `boot/stores.ts` 造的账本店(两者同真同假,与
|
package/dist/leader/wire.js
CHANGED
|
@@ -166,6 +166,7 @@ export function createLeaderRunner(cfg) {
|
|
|
166
166
|
const governanceSeat = cfg.governance ?? {};
|
|
167
167
|
const deploymentPostureSeat = () => cfg.deploymentPosture?.() ?? {};
|
|
168
168
|
const tracerSeat = cfg.tracer ? { tracer: cfg.tracer } : {};
|
|
169
|
+
const modsSeat = cfg.mods ? { mods: cfg.mods } : {};
|
|
169
170
|
const usageWindowSeat = cfg.usageWindows && cfg.usageWindowStore ? { usageWindows: cfg.usageWindows, usageWindowStore: cfg.usageWindowStore } : {};
|
|
170
171
|
const promptSourceSeat = cfg.promptSource ? { promptSource: cfg.promptSource } : {};
|
|
171
172
|
const onErrorSeat = cfg.onError ? { onError: cfg.onError } : {};
|
|
@@ -186,7 +187,7 @@ export function createLeaderRunner(cfg) {
|
|
|
186
187
|
throw new Error(`oracle still present after remove (${f.path}) — refusing repair (measurement integrity)`);
|
|
187
188
|
}
|
|
188
189
|
try {
|
|
189
|
-
const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
190
|
+
const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, executionEnv: rawEnv, rootPath: repoDir });
|
|
190
191
|
const objective = [
|
|
191
192
|
`The integrated project at ${repoDir} fails its build/test. Make the MINIMAL change to the working tree so this command exits 0 (cd into the repo and run it yourself to confirm):`,
|
|
192
193
|
` ${testCmd}`,
|
|
@@ -253,7 +254,7 @@ export function createLeaderRunner(cfg) {
|
|
|
253
254
|
if (Array.isArray(body.subtasks) && body.subtasks.length > 0) {
|
|
254
255
|
return validateSubtasks(body.subtasks);
|
|
255
256
|
}
|
|
256
|
-
const planRunner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat });
|
|
257
|
+
const planRunner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat });
|
|
257
258
|
const runRoute = async (prompt) => {
|
|
258
259
|
const res = await planRunner.runTaskStream({
|
|
259
260
|
objective: prompt,
|
|
@@ -347,7 +348,7 @@ export function createLeaderRunner(cfg) {
|
|
|
347
348
|
workerId: sub.workerId, sessionId, branch: sub.branch,
|
|
348
349
|
baseSha,
|
|
349
350
|
runner: keepCtxWarm(new Runner({
|
|
350
|
-
brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat,
|
|
351
|
+
brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat,
|
|
351
352
|
...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}),
|
|
352
353
|
...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}),
|
|
353
354
|
executionEnvFactory: async (ctx) => {
|
|
@@ -372,7 +373,7 @@ export function createLeaderRunner(cfg) {
|
|
|
372
373
|
const baseSha = await sh(env)(`cd ${repo} && git rev-parse HEAD`);
|
|
373
374
|
return {
|
|
374
375
|
workerId: sub.workerId, sessionId, branch: sub.branch, baseSha,
|
|
375
|
-
runner: keepCtxWarm(new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
|
|
376
|
+
runner: keepCtxWarm(new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat(), ...tracerSeat, ...usageWindowSeat, ...promptSourceSeat, ...onErrorSeat, ...modsSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
|
|
376
377
|
diffEnv: env,
|
|
377
378
|
destroy: () => env.destroy().then(() => { }),
|
|
378
379
|
spec: withLeaderLeg({ ...workerLimits, ...sub.spec, ...durableSpec, ...resourceSpec, ...principalSpec() }, resumeBody),
|