@sema-agent/server 7.133.0 → 7.134.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 +87 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/USAGE.md +129 -11
- package/deploy/sema-up/README.md +16 -0
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +15 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +129 -0
- package/deploy/sema-up/chart/templates/sealed-key.yaml +24 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +14 -0
- package/deploy/sema-up/chart/templates/server.yaml +14 -0
- package/deploy/sema-up/chart/values-full-single.yaml +5 -1
- package/deploy/sema-up/chart/values.yaml +34 -0
- package/dist/approval-ask-audit-store.d.ts +1 -1
- package/dist/approval-card.d.ts +4 -4
- package/dist/approval-card.js +1 -2
- package/dist/approval-content-kind.d.ts +5 -2
- package/dist/approval-content-kind.js +16 -3
- package/dist/approval-gate-currency.d.ts +72 -0
- package/dist/approval-gate-currency.js +94 -0
- package/dist/approval.d.ts +6 -0
- package/dist/approval.js +31 -14
- package/dist/boot/coordinators.d.ts +6 -1
- package/dist/boot/coordinators.js +6 -3
- package/dist/boot/leader.d.ts +2 -0
- package/dist/boot/leader.js +2 -1
- package/dist/boot/read-deny-anchor-audit.js +2 -2
- package/dist/boot/runner-deps.d.ts +18 -5
- package/dist/boot/runner-deps.js +9 -0
- package/dist/boot/stage-06-runners.d.ts +4 -3
- package/dist/boot/stage-06-runners.js +15 -2
- package/dist/boot/stage-07-capability-layer.d.ts +2 -1
- package/dist/boot/stage-08-reapers.d.ts +2 -1
- package/dist/boot/stage-09-leader.d.ts +2 -1
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +2 -1
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +8 -0
- package/dist/boot/stores.js +8 -12
- package/dist/boot/web-admin.d.ts +6 -0
- package/dist/boot/web-admin.js +11 -2
- package/dist/budget.js +5 -1
- package/dist/caller-text-echo.d.ts +2 -0
- package/dist/caller-text-echo.js +2 -1
- package/dist/canonical-json.d.ts +2 -41
- package/dist/canonical-json.js +2 -13
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/mcp-probe.js +2 -2
- package/dist/capability-facts.d.ts +2 -0
- package/dist/capability-facts.js +4 -4
- package/dist/checkpoint-ctx-seal-m28.d.ts +42 -0
- package/dist/checkpoint-ctx-seal-m28.js +19 -0
- package/dist/field-conflict.d.ts +2 -1
- package/dist/field-conflict.js +1 -0
- package/dist/file-history-disclosure.d.ts +34 -5
- package/dist/file-history-disclosure.js +2 -2
- package/dist/fleet/fleet-bus.d.ts +4 -0
- package/dist/fleet/fleet-bus.js +1 -0
- package/dist/hooks/hook-runner.js +2 -2
- package/dist/http/admission.js +8 -0
- package/dist/http/approval-sweeps.js +3 -1
- package/dist/http/checkpoint-ctx.d.ts +157 -2
- package/dist/http/checkpoint-ctx.js +158 -2
- package/dist/http/dispatch.js +3 -3
- package/dist/http/durable-run-leg.js +3 -2
- package/dist/http/idempotency.d.ts +2 -2
- package/dist/http/idempotency.js +2 -2
- package/dist/http/principal-gate.d.ts +32 -6
- package/dist/http/principal-gate.js +27 -4
- package/dist/http/refusal-body.d.ts +12 -0
- package/dist/http/refusal-body.js +11 -0
- package/dist/http/request-guards.d.ts +0 -9
- package/dist/http/request-guards.js +2 -16
- package/dist/http/resume-ctx-read.d.ts +48 -1
- package/dist/http/resume-ctx-read.js +26 -3
- package/dist/http/resume-legs.d.ts +2 -1
- package/dist/http/resume-legs.js +37 -22
- package/dist/http/route-ctx.d.ts +0 -9
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.js +43 -9
- package/dist/http/routes/capabilities.js +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/fleet.js +4 -4
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/rules.js +4 -4
- package/dist/http/routes/runs.js +30 -9
- package/dist/http/routes/session-sync.d.ts +3 -2
- package/dist/http/routes/session-sync.js +38 -20
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions-list.js +3 -4
- package/dist/http/routes/sessions.js +4 -4
- package/dist/http/routes/tasks.js +21 -16
- package/dist/http/routes/trace-usage.js +7 -9
- package/dist/http/run-declared-families.d.ts +16 -0
- package/dist/http/run-declared-families.js +12 -0
- package/dist/http/server.d.ts +6 -0
- package/dist/http/server.js +5 -2
- package/dist/http/submit-ctx.d.ts +4 -3
- package/dist/http/submit-ctx.js +19 -3
- package/dist/http/wire-types.d.ts +7 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/leader/wire.d.ts +4 -0
- package/dist/leader/wire.js +8 -7
- package/dist/main.js +1 -1
- package/dist/memory-origin-fence.js +2 -2
- package/dist/model-compat.d.ts +1 -1
- package/dist/observability/prompt-manifest.d.ts +19 -8
- package/dist/observability/prompt-manifest.js +9 -8
- package/dist/observability/tool-trace.js +8 -9
- package/dist/orchestration/workflow-park-decision.d.ts +1 -1
- package/dist/orchestration/workflow-park-decision.js +1 -0
- package/dist/parked-decide.d.ts +4 -5
- package/dist/parked-decide.js +3 -1
- package/dist/permission-rule-vocab.d.ts +1 -23
- package/dist/permission-rule-vocab.js +0 -13
- package/dist/plugins/approval-payload-fingerprint.d.ts +14 -6
- package/dist/plugins/approval-payload-fingerprint.js +1 -1
- package/dist/plugins/caching-session-store.d.ts +1 -1
- package/dist/plugins/caching-session-store.js +4 -3
- package/dist/plugins/checkpoint-store-sql.d.ts +22 -1
- package/dist/plugins/checkpoint-store-sql.js +45 -1
- package/dist/plugins/local-checkpoint-store.d.ts +13 -2
- package/dist/plugins/local-checkpoint-store.js +26 -0
- package/dist/plugins/local-session-store.d.ts +12 -9
- package/dist/plugins/local-session-store.js +23 -14
- package/dist/plugins/local-session-window.d.ts +12 -6
- package/dist/plugins/local-session-window.js +1 -17
- package/dist/plugins/one-time-migrations.d.ts +11 -0
- package/dist/plugins/one-time-migrations.js +12 -0
- package/dist/plugins/permission-rule-store-file.js +10 -6
- package/dist/plugins/permission-rule-store-sql.js +8 -8
- package/dist/plugins/pg-session-storage.d.ts +1 -1
- package/dist/plugins/pg-session-storage.js +39 -17
- package/dist/plugins/remote-env-device.d.ts +14 -7
- package/dist/plugins/remote-env-device.js +23 -15
- package/dist/plugins/session-ownership.d.ts +11 -0
- package/dist/plugins/session-ownership.js +11 -0
- package/dist/plugins/session-placement.d.ts +12 -14
- package/dist/plugins/session-placement.js +2 -15
- package/dist/plugins/tidb-session-store.d.ts +1 -1
- package/dist/plugins/tidb-session-store.js +39 -17
- package/dist/request-tool-axes.d.ts +12 -0
- package/dist/request-tool-axes.js +20 -0
- package/dist/run-local.js +1 -0
- package/dist/runs.d.ts +2 -1
- package/dist/runs.js +4 -3
- package/dist/sealed-key.d.ts +32 -0
- package/dist/sealed-key.js +55 -1
- package/dist/security.d.ts +9 -7
- package/dist/session-error-wire.d.ts +12 -5
- package/dist/session-error-wire.js +4 -1
- package/dist/session-sync-kernel.d.ts +37 -10
- package/dist/session-sync-kernel.js +10 -0
- package/dist/task-a2a.js +4 -3
- package/dist/task-mcp.d.ts +2 -2
- package/dist/task-mcp.js +20 -8
- package/dist/task-settings.d.ts +5 -1
- package/dist/task-settings.js +1 -1
- package/dist/tool-approval.d.ts +151 -52
- package/dist/tool-approval.js +113 -20
- package/dist/tool-rule-names.d.ts +6 -0
- package/dist/trace/core-keyset-guard.d.ts +4 -3
- package/dist/trace/exit-seat.d.ts +13 -1
- package/dist/trace/exit-seat.js +55 -1
- package/dist/trace/ledger-events.d.ts +3 -1
- package/dist/trace/project.d.ts +18 -1
- package/dist/trace/project.js +16 -4
- package/dist/trace/redact.d.ts +6 -3
- package/dist/trace/redact.js +191 -23
- package/dist/trace/self-minted-wire.d.ts +4 -0
- package/dist/trace/self-minted-wire.js +1 -0
- package/dist/trace/wire-projection-faces.d.ts +6 -0
- package/dist/trace/wire-projection-faces.js +6 -0
- package/dist/web-admin-client/skills-mcp.d.ts +1 -1
- package/dist/web-admin-client/skills-mcp.js +2 -3
- package/dist/web-admin-client/types.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/drain-check-local.mjs +34 -2
- package/scripts/drain-check.mysql.sql +20 -2
- package/scripts/drain-check.pg.sql +20 -2
- package/dist/mcp-tool-faces.d.ts +0 -69
- package/dist/mcp-tool-faces.js +0 -104
package/dist/approval.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isNamespacedCoveringRuleName, namespacedRuleNameCovers } from "@sema-agent/core";
|
|
1
|
+
import { createApprovalPolicy, isNamespacedCoveringRuleName, namespacedRuleNameCovers } from "@sema-agent/core";
|
|
2
2
|
import { operatorAlwaysHumanAsk, operatorAsk, requestAlwaysHumanAsk } from "./operator-ask.js";
|
|
3
3
|
import { ASK_USER_QUESTION_TOOL_NAME } from "./approval-content-kind.js";
|
|
4
4
|
import { isExplicitPosture } from "./posture-source.js";
|
|
@@ -119,8 +119,17 @@ function createNameSetMatcher(names) {
|
|
|
119
119
|
return (toolName) => exact.has(toolName);
|
|
120
120
|
return (toolName) => exact.has(toolName) || covering.some((rule) => namespacedRuleNameCovers(rule, toolName));
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
export const AUTO_APPROVE_BUDGET_APPROVER = "auto_approve_budget";
|
|
123
|
+
function budgetSeatAnswer(req, requireHit, signal) {
|
|
124
|
+
let answered = false;
|
|
125
|
+
const seat = createApprovalPolicy({
|
|
126
|
+
requireApproval: [requireHit],
|
|
127
|
+
approve: () => {
|
|
128
|
+
answered = true;
|
|
129
|
+
return { allow: true, settledBy: "policy", approver: AUTO_APPROVE_BUDGET_APPROVER };
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
return { answered: () => answered, verdict: Promise.resolve(seat.check(req, signal)) };
|
|
124
133
|
}
|
|
125
134
|
export function createRequestNeverAutoPolicy(names, source) {
|
|
126
135
|
const verdictOf = createApprovalListVerdict({ requireApproval: [], neverAuto: names });
|
|
@@ -149,7 +158,7 @@ export function createDurableAskPolicy(opts) {
|
|
|
149
158
|
let autoApproved = 0;
|
|
150
159
|
const isQuestionTool = (name) => name === ASK_USER_QUESTION_TOOL_NAME;
|
|
151
160
|
return {
|
|
152
|
-
check: (req) => {
|
|
161
|
+
check: (req, signal) => {
|
|
153
162
|
const verdict = verdictOf(req);
|
|
154
163
|
switch (verdict.list) {
|
|
155
164
|
case "deny":
|
|
@@ -157,7 +166,7 @@ export function createDurableAskPolicy(opts) {
|
|
|
157
166
|
case "never_auto":
|
|
158
167
|
return operatorAlwaysHumanAsk(`APPROVAL_NEVER_AUTO(${verdict.hit})`, `human approval required to run "${req.toolName}"`);
|
|
159
168
|
case "require":
|
|
160
|
-
return decideRequired(req, verdict.hit);
|
|
169
|
+
return decideRequired(req, verdict.hit, signal);
|
|
161
170
|
case "none":
|
|
162
171
|
return { action: "allow" };
|
|
163
172
|
default: {
|
|
@@ -167,7 +176,7 @@ export function createDurableAskPolicy(opts) {
|
|
|
167
176
|
}
|
|
168
177
|
},
|
|
169
178
|
};
|
|
170
|
-
function decideRequired(req, requireHit) {
|
|
179
|
+
function decideRequired(req, requireHit, signal) {
|
|
171
180
|
const rem = req.budget?.resourceRemainingMicroUsd;
|
|
172
181
|
if (rem !== undefined && rem <= 0) {
|
|
173
182
|
return operatorAlwaysHumanAsk("RESOURCE_SUSPEND budget exhausted", `durable resource budget exhausted — human approval required to run "${req.toolName}"`);
|
|
@@ -180,17 +189,25 @@ export function createDurableAskPolicy(opts) {
|
|
|
180
189
|
exemption.onExempted(req.toolName);
|
|
181
190
|
return { action: "allow" };
|
|
182
191
|
}
|
|
183
|
-
return budgetOrAsk(req, ask);
|
|
192
|
+
return budgetOrAsk(req, ask, requireHit, signal);
|
|
184
193
|
})();
|
|
185
194
|
}
|
|
186
|
-
return budgetOrAsk(req, ask);
|
|
195
|
+
return budgetOrAsk(req, ask, requireHit, signal);
|
|
187
196
|
}
|
|
188
|
-
function budgetOrAsk(req, ask) {
|
|
189
|
-
if (heldRuleName(req, isQuestionTool)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
return
|
|
197
|
+
function budgetOrAsk(req, ask, requireHit, signal) {
|
|
198
|
+
if (heldRuleName(req, isQuestionTool) !== undefined || budget <= 0 || autoApproved >= budget)
|
|
199
|
+
return ask;
|
|
200
|
+
autoApproved++;
|
|
201
|
+
const { answered, verdict } = budgetSeatAnswer(req, requireHit, signal);
|
|
202
|
+
return verdict.then((d) => {
|
|
203
|
+
if (answered() && d.action === "allow")
|
|
204
|
+
return d;
|
|
205
|
+
autoApproved--;
|
|
206
|
+
return ask;
|
|
207
|
+
}, (err) => {
|
|
208
|
+
autoApproved--;
|
|
209
|
+
throw err;
|
|
210
|
+
});
|
|
194
211
|
}
|
|
195
212
|
}
|
|
196
213
|
//# sourceMappingURL=approval.js.map
|
|
@@ -14,6 +14,7 @@ import { QuestionCoordinator } from "../question.js";
|
|
|
14
14
|
import { ToolApprovalCoordinator, type ParkedAskRedeem } from "../tool-approval.js";
|
|
15
15
|
import { FileApprovalAskAuditStore } from "../approval-ask-audit-store.js";
|
|
16
16
|
import type { ParkCommitWatch } from "../plugins/park-commit-watch.js";
|
|
17
|
+
import { type GateCurrencyStore } from "../approval-gate-currency.js";
|
|
17
18
|
import { SendUserFileEmitter } from "../capabilities/send-user-file-tool.js";
|
|
18
19
|
import { TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
|
|
19
20
|
import type { StoreBackend } from "../plugins/store-backend.js";
|
|
@@ -36,13 +37,17 @@ export interface LiveCoordinatorsCtx {
|
|
|
36
37
|
/** S-929 F1:checkpoint 店的 park 提交观察层(stage-06 与店同一处铸;在场 ⇔ 有 checkpoint 店)。协调器据它判「有序关停下的 park 路由
|
|
37
38
|
* 提交了没有」—— 审计 settle 行等 park 提交落定才写。缺席 = 没有 park 设施(core 在 ask 回调处就收场,没有提交这一步)。 */
|
|
38
39
|
parkCommits?: ParkCommitWatch;
|
|
40
|
+
/** S-1915:checkpoint 店(stage-06 的**同一只**,与 `parkCommits` 同源;在场 ⇔ 有 park 设施)。协调器的按问读口据它判一张 `PARKED` 卡的门此刻还是不是该会话当前待决的审批门
|
|
41
|
+
* (判官 = `approval-gate-currency.ts`,应答口判 `approval_stale` 读的同一只)。缺席 ⇒ 读口只能说行说的话(`parked`)。
|
|
42
|
+
* 也是流内审批协议上场门的 park 设施位:在场性与实例是一个事实 —— 门的 `active` 臂交出去的就是这一只,缺席 ⇒ 协议不上场(`no_park_facility`)。 */
|
|
43
|
+
checkpointStore?: GateCurrencyStore;
|
|
39
44
|
}
|
|
40
45
|
export declare function createLiveCoordinators(ctx: LiveCoordinatorsCtx): {
|
|
41
46
|
elicitation: ElicitationCoordinator | undefined;
|
|
42
47
|
question: QuestionCoordinator | undefined;
|
|
43
48
|
toolApproval: ToolApprovalCoordinator | undefined;
|
|
44
49
|
durableEnabled: boolean;
|
|
45
|
-
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate
|
|
50
|
+
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<GateCurrencyStore>;
|
|
46
51
|
approvalAskAudit: FileApprovalAskAuditStore | undefined;
|
|
47
52
|
approvalExemptionStore: import("../plugins/approval-exemption-store.js").ApprovalExemptionStore | undefined;
|
|
48
53
|
sendUserFileEmitter: SendUserFileEmitter | undefined;
|
|
@@ -3,6 +3,7 @@ import { QuestionCoordinator } from "../question.js";
|
|
|
3
3
|
import { ToolApprovalCoordinator, resolveStreamApprovalGate } from "../tool-approval.js";
|
|
4
4
|
import { deploymentListAsks } from "../approval.js";
|
|
5
5
|
import { FileApprovalAskAuditStore } from "../approval-ask-audit-store.js";
|
|
6
|
+
import { createParkedGateRead } from "../approval-gate-currency.js";
|
|
6
7
|
import { SendUserFileEmitter, SEND_USER_FILE_MAX_BYTES, sendUserFileTool } from "../capabilities/send-user-file-tool.js";
|
|
7
8
|
import { createSandboxFileSend, TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
|
|
8
9
|
import { createSendUserFileIssuer } from "../plugins/send-user-file.js";
|
|
@@ -11,15 +12,16 @@ import { basename, resolve } from "node:path";
|
|
|
11
12
|
import { toolsRunOnThisHost } from "../task-cwd.js";
|
|
12
13
|
import { stat as fsStat, readFile as fsReadFile } from "node:fs/promises";
|
|
13
14
|
export function createLiveCoordinators(ctx) {
|
|
14
|
-
const { config, logger, backend, sendUserFileTaskEnvs, ruleConsent, ruleScopeRootFor, getParkedRedeem, parkCommits } = ctx;
|
|
15
|
+
const { config, logger, backend, sendUserFileTaskEnvs, ruleConsent, ruleScopeRootFor, getParkedRedeem, parkCommits, checkpointStore } = ctx;
|
|
15
16
|
const elicitation = config.mcpElicitation.enabled ? new ElicitationCoordinator(config.mcpElicitation.throttle) : undefined;
|
|
16
17
|
const question = config.askQuestionEnabled ? new QuestionCoordinator(config.questionThrottle) : undefined;
|
|
17
|
-
const
|
|
18
|
+
const parkStore = checkpointStore;
|
|
19
|
+
const durableEnabled = parkStore !== undefined;
|
|
18
20
|
const streamApprovalGate = resolveStreamApprovalGate({
|
|
19
21
|
toolApprovalEnabled: config.toolApprovalEnabled === true,
|
|
20
22
|
streamApprovalEnabled: config.streamApproval.enabled,
|
|
21
23
|
backend,
|
|
22
|
-
|
|
24
|
+
checkpointStore: parkStore,
|
|
23
25
|
});
|
|
24
26
|
if (config.streamApproval.enabled && !streamApprovalGate.active) {
|
|
25
27
|
logger.info("stream_approval_disabled", {
|
|
@@ -58,6 +60,7 @@ export function createLiveCoordinators(ctx) {
|
|
|
58
60
|
...(ruleScopeRootFor !== undefined ? { ruleScopeRootFor } : {}),
|
|
59
61
|
unattendedPolicy: config.unattendedApprovalPolicy,
|
|
60
62
|
...(getParkedRedeem !== undefined ? { parkedRedeem: getParkedRedeem } : {}),
|
|
63
|
+
...(checkpointStore !== undefined ? { parkedGate: createParkedGateRead(checkpointStore) } : {}),
|
|
61
64
|
...(approvalAskAudit !== undefined ? { askAudit: approvalAskAudit } : {}),
|
|
62
65
|
...(approvalExemptionStore !== undefined
|
|
63
66
|
? { sessionGrants: approvalExemptionStore, deploymentListAsks: (call) => deploymentListAsks(config, call) }
|
package/dist/boot/leader.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface LeaderCtx {
|
|
|
23
23
|
toolResultStore: ToolResultStoreFull | undefined;
|
|
24
24
|
sessionStore: ReturnType<typeof createSessionStore>;
|
|
25
25
|
checkpointStore: CheckpointStoreFull | undefined;
|
|
26
|
+
/** S-1907:停驻行凭据的封签器(与 HTTP 面 `ServiceDeps.checkpointCtxSealing` 同一只;起服第 6 段已对「店在、它不在」拒启)。必填键,值可为 undefined。 */
|
|
27
|
+
checkpointCtxSealing: import("../http/checkpoint-ctx.js").CheckpointCtxSealing | undefined;
|
|
26
28
|
/** [ref] 件B/C/D([ref],codex R2-F1):部署治理三座席 —— leader 车道的每一只 Runner 都要带上它,
|
|
27
29
|
* 否则开了 leader 端点的部署就有一条在部署治理**之外**的执行面(合规否决/锁都够不着)。 */
|
|
28
30
|
governanceSeams: import("./governance-seams.js").GovernanceSeams;
|
package/dist/boot/leader.js
CHANGED
|
@@ -22,7 +22,7 @@ export function assertLeaderDurableStore(leaderEnabled, hasLeaderRunStore) {
|
|
|
22
22
|
"(#193 车4 件2 capability gate; the DB_BACKEND literal check in config.ts is the intent half of the same rule)");
|
|
23
23
|
}
|
|
24
24
|
export function createLeaderFace(ctx) {
|
|
25
|
-
const { config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, governanceSeams } = ctx;
|
|
25
|
+
const { config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, checkpointCtxSealing, governanceSeams } = ctx;
|
|
26
26
|
const leaderMinio = process.env.MINIO_ENDPOINT && process.env.MINIO_ACCESS_KEY && process.env.MINIO_SECRET_KEY
|
|
27
27
|
? {
|
|
28
28
|
s3: {
|
|
@@ -74,6 +74,7 @@ export function createLeaderFace(ctx) {
|
|
|
74
74
|
durable: () => hasApprovalListIntent(config)
|
|
75
75
|
? {
|
|
76
76
|
checkpointStore,
|
|
77
|
+
ctxSealer: checkpointCtxSealing,
|
|
77
78
|
requireApproval: config.approvalRequire,
|
|
78
79
|
deny: config.approvalDeny,
|
|
79
80
|
autoBudget: config.approvalAutoBudget,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { compileReadDeny,
|
|
1
|
+
import { compileReadDeny, readDenyRowAnchor } from "@sema-agent/core";
|
|
2
2
|
import { echoCallerText } from "../caller-text-echo.js";
|
|
3
3
|
export const READ_DENY_AUDIT_MAX_NAMED_ROWS = 20;
|
|
4
4
|
const NAMED_ROW_ECHO_CHARS = 200;
|
|
5
5
|
function isAnchoredCanonicalRow(canonical) {
|
|
6
|
-
return
|
|
6
|
+
return readDenyRowAnchor(canonical) !== "none";
|
|
7
7
|
}
|
|
8
8
|
export function auditReadDenyAnchoring(ctx) {
|
|
9
9
|
if (ctx.rows === undefined || ctx.rows.length === 0)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* `Runner.swapDeps` 换进,见 boot/stage-08-reapers.ts)。
|
|
10
10
|
* `getRunStore()` 是唯一的晚绑取值(runStore 在本段之后才构造),原文靠同作用域前向引用。
|
|
11
11
|
*/
|
|
12
|
-
import { type CacheBreakFinding, type RunnerDeps, type WorkflowRunStore, type AskOutcome } from "@sema-agent/core";
|
|
12
|
+
import { type CacheBreakFinding, type CrossBoundaryPosture, type RunnerDeps, type WorkflowRunStore, type AskOutcome } from "@sema-agent/core";
|
|
13
13
|
import type { createBrain } from "../brain.js";
|
|
14
14
|
import type { buildPricing, createTracer } from "../budget.js";
|
|
15
15
|
import type { ServiceConfig } from "../config.js";
|
|
@@ -241,7 +241,7 @@ export interface RunnerDepsCtx {
|
|
|
241
241
|
}
|
|
242
242
|
/** [ref] A10 留档发现②:main runner `RunnerDeps` 与 main.ts subRunner 字面量之间此前手工重复
|
|
243
243
|
* 的 ~15 个键,类型标注见 {@link createSharedRunnerDeps} 头注。 */
|
|
244
|
-
export type SharedRunnerDeps = Pick<RunnerDeps, "brain" | "readFace" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "delegationEntryCaps" | "crossSessionInbound" | "crossSessionDialogExpiry" | "writeProtectedPaths" | "memoryEngineDir" | "allowedTools" | "models" | "roles" | "tiers" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "mods" | "toolResultStore" | "checkpointStore" | "hands" | "sessionPolicyStore" | "usageWindows" | "usageWindowStore" | "memoryScopeAdmission" | "deploymentMemoryScopes" | "sharedMemoryStores" | "compliancePostureResolver" | "lockedConfig" | "retentionPolicy" | "onNotice" | "mcpRevocations">;
|
|
244
|
+
export type SharedRunnerDeps = Pick<RunnerDeps, "brain" | "readFace" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "delegationEntryCaps" | "crossSessionInbound" | "crossSessionDialogExpiry" | "writeProtectedPaths" | "memoryEngineDir" | "allowedTools" | "crossBoundaryPosture" | "models" | "roles" | "tiers" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "mods" | "toolResultStore" | "checkpointStore" | "hands" | "sessionPolicyStore" | "usageWindows" | "usageWindowStore" | "memoryScopeAdmission" | "deploymentMemoryScopes" | "sharedMemoryStores" | "compliancePostureResolver" | "lockedConfig" | "retentionPolicy" | "onNotice" | "mcpRevocations">;
|
|
245
245
|
/**
|
|
246
246
|
* [ref] A10 留档发现②(review 2026-07-29,[ref]§三族A 同源修补的延续):main runner 的
|
|
247
247
|
* `RunnerDeps` 字面量(下方 `createRunnerDeps`)与 `main.ts` 里 subRunner 的 `new Runner({...})`
|
|
@@ -316,10 +316,23 @@ export declare function createEngineNoticeSeat(logger: {
|
|
|
316
316
|
* 「键为 undefined」与「键缺席」对引擎逐字等价)。**不复制引擎缺省**(`roots`/`static-face`/`carry`/`open`/
|
|
317
317
|
* CC parity 20/200 一个都不抄):上游改缺省之日起本仓不会成为第二份真源。
|
|
318
318
|
*/
|
|
319
|
-
export type DeploymentPostureSeats = Pick<RunnerDeps, "readFace" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "delegationEntryCaps" | "crossSessionInbound" | "crossSessionDialogExpiry" | "writeProtectedPaths" | "allowedTools" | "agentConfigDir">;
|
|
319
|
+
export type DeploymentPostureSeats = Pick<RunnerDeps, "readFace" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "delegationEntryCaps" | "crossSessionInbound" | "crossSessionDialogExpiry" | "writeProtectedPaths" | "allowedTools" | "agentConfigDir" | "crossBoundaryPosture">;
|
|
320
320
|
/** 本族读的配置切面:席名与 config 键同名的那几席 + 运维 allow 表(席 `allowedTools` ← config `approvalGrant`,env 名 `APPROVAL_GRANT` 不改)
|
|
321
|
-
* + LKG 覆写路径(`readDenyPatterns` 席并入它派生的读拒行,`lkgReadDenyRows`)。 */
|
|
322
|
-
export type DeploymentPostureConfig = Pick<ServiceConfig, Exclude<keyof DeploymentPostureSeats, "allowedTools"> | "approvalGrant" | "configLkgPath">;
|
|
321
|
+
* + LKG 覆写路径(`readDenyPatterns` 席并入它派生的读拒行,`lkgReadDenyRows`)+ 主体门(席 `crossBoundaryPosture` ← config `requirePrincipal`)。 */
|
|
322
|
+
export type DeploymentPostureConfig = Pick<ServiceConfig, Exclude<keyof DeploymentPostureSeats, "allowedTools" | "crossBoundaryPosture"> | "approvalGrant" | "configLkgPath" | "requirePrincipal">;
|
|
323
|
+
/**
|
|
324
|
+
* 设备车道发射闸的**部署姿态**(core 7.54.0 [ref] O9b:`RunnerDeps.crossBoundaryPosture`)—— 由主体门派生,不是第二根旋钮:
|
|
325
|
+
* `REQUIRE_PRINCIPAL=true`(每个请求带一个经认证的主体 = 多个租户共用这台 worker)⇒ `"multi_tenant"`;否则 ⇒ `"single_user"`。
|
|
326
|
+
* 映射是一张以 core 闭集为键的表 {@link CROSS_BOUNDARY_POSTURE_REQUIRES_PRINCIPAL}(`satisfies Record<CrossBoundaryPosture, boolean>`):core 给姿态加第三个词 ⇒ 表缺键、编译红,
|
|
327
|
+
* 由人判它对应哪种部署 —— 不会被一个 `? :` 静默吞掉。
|
|
328
|
+
* 律:**每一台 worker 显式声明、同一舰队同值**(主体门本就是舰队级配置)—— 缺席时 core 对宿主父腿不启站,并在每条武装腿铸 operator 通告
|
|
329
|
+
* `config.cross_boundary_posture_undeclared`;本仓因此从不留空。取值点只有 {@link buildDeploymentPostureSeats} 一处。
|
|
330
|
+
*/
|
|
331
|
+
export declare const CROSS_BOUNDARY_POSTURE_REQUIRES_PRINCIPAL: {
|
|
332
|
+
readonly multi_tenant: true;
|
|
333
|
+
readonly single_user: false;
|
|
334
|
+
};
|
|
335
|
+
export declare function crossBoundaryPostureOf(requirePrincipal: boolean): CrossBoundaryPosture;
|
|
323
336
|
export declare function buildDeploymentPostureSeats(config: DeploymentPostureConfig): DeploymentPostureSeats;
|
|
324
337
|
/**
|
|
325
338
|
* 部署读拒行**进场**的唯一告知点(非锚定行一行 `read_deny_unanchored_rows`;判据与行形在 `read-deny-anchor-audit.ts`)。律:**一份读拒行的值第一次装进 Runner 席时点名一次** ——
|
package/dist/boot/runner-deps.js
CHANGED
|
@@ -58,6 +58,14 @@ export function createEngineNoticeSeat(logger, router = defaultEngineNoticeRoute
|
|
|
58
58
|
const warn = logger?.warn?.bind(logger);
|
|
59
59
|
return warn ? { onNotice: createEngineNoticeForwarder({ warn }, router) } : {};
|
|
60
60
|
}
|
|
61
|
+
export const CROSS_BOUNDARY_POSTURE_REQUIRES_PRINCIPAL = { multi_tenant: true, single_user: false };
|
|
62
|
+
export function crossBoundaryPostureOf(requirePrincipal) {
|
|
63
|
+
for (const w of Object.keys(CROSS_BOUNDARY_POSTURE_REQUIRES_PRINCIPAL)) {
|
|
64
|
+
if (CROSS_BOUNDARY_POSTURE_REQUIRES_PRINCIPAL[w] === requirePrincipal)
|
|
65
|
+
return w;
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`cross-boundary posture table has no word for requirePrincipal=${requirePrincipal} (the table must map both values)`);
|
|
68
|
+
}
|
|
61
69
|
export function buildDeploymentPostureSeats(config) {
|
|
62
70
|
const crossSessionLayers = buildCrossSessionInboundLayers(config);
|
|
63
71
|
const lkgRows = lkgReadDenyRows(config.configLkgPath);
|
|
@@ -76,6 +84,7 @@ export function buildDeploymentPostureSeats(config) {
|
|
|
76
84
|
crossSessionDialogExpiry: crossSessionDialogExpiryOf(config),
|
|
77
85
|
writeProtectedPaths: config.writeProtectedPaths?.entries,
|
|
78
86
|
allowedTools: config.approvalGrant.length > 0 ? config.approvalGrant : undefined,
|
|
87
|
+
crossBoundaryPosture: crossBoundaryPostureOf(config.requirePrincipal),
|
|
79
88
|
};
|
|
80
89
|
return seats;
|
|
81
90
|
}
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
import { Runner } from "@sema-agent/core";
|
|
10
10
|
import { ForkRoutingSessionStore } from "../plugins/fork-routing-session-store.js";
|
|
11
11
|
import type { runStage05 } from "./stage-05-execution-env.js";
|
|
12
|
-
export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>): {
|
|
12
|
+
export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>): Promise<{
|
|
13
13
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
14
14
|
approvalExemptionStore: import("../plugins/approval-exemption-store.js").ApprovalExemptionStore | undefined;
|
|
15
15
|
centerRuntimeCapsResolver: ((principal: string | undefined) => Promise<import("@sema-agent/core").RuntimeCaps | undefined>) | undefined;
|
|
16
16
|
checkpointStore: import("../plugins/store-backend.js").CheckpointStoreFull | undefined;
|
|
17
|
+
checkpointCtxSealing: import("../http/checkpoint-ctx.js").CheckpointCtxSealing | undefined;
|
|
17
18
|
parkCommits: import("../plugins/park-commit-watch.js").ParkCommitWatch | undefined;
|
|
18
19
|
durableEnabled: boolean;
|
|
19
20
|
elicitation: import("../elicitation.js").ElicitationCoordinator | undefined;
|
|
@@ -41,7 +42,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
41
42
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
42
43
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
43
44
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
44
|
-
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate
|
|
45
|
+
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
45
46
|
subRunner: Runner;
|
|
46
47
|
subRunnerSessions: ForkRoutingSessionStore;
|
|
47
48
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -148,5 +149,5 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
148
149
|
localRoot: string;
|
|
149
150
|
logger: import("../index.js").Logger;
|
|
150
151
|
metrics: import("../index.js").Metrics;
|
|
151
|
-
}
|
|
152
|
+
}>;
|
|
152
153
|
//# sourceMappingURL=stage-06-runners.d.ts.map
|
|
@@ -15,7 +15,10 @@ import { buildConsolidationValveAudit, createMemoryConsolidationFaces, createOpe
|
|
|
15
15
|
import { createPerModelAuthSeat } from "./side-query-lane.js";
|
|
16
16
|
import { createWorkflowOrchestration } from "./workflow-orchestration.js";
|
|
17
17
|
import { createLiveCoordinators } from "./coordinators.js";
|
|
18
|
+
import { assertApprovalAskRuleMaterialOnBackend } from "./stores.js";
|
|
18
19
|
import { createParkCommitWatch } from "../plugins/park-commit-watch.js";
|
|
20
|
+
import { CHECKPOINT_CTX_SEALING_REQUIRED } from "../http/checkpoint-ctx.js";
|
|
21
|
+
import { sealCheckpointCtxCredentialsM28 } from "../checkpoint-ctx-seal-m28.js";
|
|
19
22
|
import { createRuntimeCaps } from "./runtime-caps.js";
|
|
20
23
|
import { createEngineNoticeForwarder, createRunnerDeps, createSharedRunnerDeps } from "./runner-deps.js";
|
|
21
24
|
import { defaultEngineNoticeRouter } from "../trace/engine-notice-wire.js";
|
|
@@ -25,17 +28,27 @@ import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-author
|
|
|
25
28
|
import { mountOrgDeliveryGate } from "./org-delivery.js";
|
|
26
29
|
import { parkedAskRedeem, runStore } from "./late-binds.js";
|
|
27
30
|
import { withInternalRunEnvs } from "../internal-run-env.js";
|
|
28
|
-
export function runStage06(ctx) {
|
|
31
|
+
export async function runStage06(ctx) {
|
|
29
32
|
const { backend, backgroundAgentStore, brain, engineDataRoot, config, webAdmin, consolidationValve, deploymentMods, executionEnvFactory, fileHistoryStore, localRoot, logger, lspManager, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memorySyncRunner, metrics, perSessionCwd, permissionRuleProvider, pricing, rosterStore, ruleConsent, sendUserFileTaskEnvs, sessionCaptureRecordStore, sessionCaptureRecords, sessionPolicyStore, sessionStore, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore } = ctx;
|
|
30
33
|
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, workflowParkDecisions, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
|
|
31
34
|
const parkCommitted = backend?.checkpoint && config.durableApproval ? createParkCommitWatch(backend.checkpoint(logger)) : undefined;
|
|
32
35
|
const checkpointStore = parkCommitted?.store;
|
|
33
36
|
const parkCommits = parkCommitted?.watch;
|
|
37
|
+
const checkpointCtxSealing = webAdmin.checkpointCtxSealing;
|
|
38
|
+
if (checkpointStore !== undefined) {
|
|
39
|
+
if (checkpointCtxSealing === undefined)
|
|
40
|
+
throw new Error(CHECKPOINT_CTX_SEALING_REQUIRED);
|
|
41
|
+
const m28 = await sealCheckpointCtxCredentialsM28(checkpointStore, checkpointCtxSealing, { today: new Date().toISOString().slice(0, 10) });
|
|
42
|
+
logger.info("checkpoint_ctx_credentials_sealed", { ...m28, note: "one-time migration M28: plaintext request credentials in suspended tasks' resume contexts sealed in place" });
|
|
43
|
+
}
|
|
34
44
|
const { elicitation, question, toolApproval, durableEnabled, streamApprovalGate, approvalAskAudit, approvalExemptionStore, sendUserFileEmitter, sendFileLedger, sendUserFileToolSpec } = createLiveCoordinators({
|
|
35
45
|
config, logger, backend, sendUserFileTaskEnvs, ruleConsent, parkCommits,
|
|
46
|
+
...(checkpointStore !== undefined ? { checkpointStore } : {}),
|
|
36
47
|
getParkedRedeem: () => parkedAskRedeem,
|
|
37
48
|
ruleScopeRootFor: (sessionId) => cardRuleScopeRoot(sessionId !== undefined ? perSessionCwd.get(sessionId) : undefined, config),
|
|
38
49
|
});
|
|
50
|
+
if (streamApprovalGate.active)
|
|
51
|
+
await assertApprovalAskRuleMaterialOnBackend(backend);
|
|
39
52
|
const memoryOptOutGrantStore = backend?.memoryOptOutGrant();
|
|
40
53
|
const { principalCaps, centerRuntimeCapsResolver, runtimeCapsResolver, runtimeCapsPeekResolver } = createRuntimeCaps({ config, logger, memoryOptOutGrant: memoryOptOutGrantStore });
|
|
41
54
|
const orgMemoryAdmission = createOrgMemoryAdmissionWiring({ config, logger, metrics });
|
|
@@ -213,6 +226,6 @@ export function runStage06(ctx) {
|
|
|
213
226
|
onError: runnerDeps.onError ? runnerDeps.onError : undefined,
|
|
214
227
|
};
|
|
215
228
|
const subRunner = new Runner(subRunnerDeps);
|
|
216
|
-
return { ...ctx, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, parkCommits, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekResolver, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subRunnerSessions, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowParkDecisions, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate };
|
|
229
|
+
return { ...ctx, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, checkpointCtxSealing, parkCommits, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekResolver, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subRunnerSessions, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowParkDecisions, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate };
|
|
217
230
|
}
|
|
218
231
|
//# sourceMappingURL=stage-06-runners.js.map
|
|
@@ -29,6 +29,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
29
29
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
30
30
|
centerRuntimeCapsResolver: ((principal: string | undefined) => Promise<import("@sema-agent/core").RuntimeCaps | undefined>) | undefined;
|
|
31
31
|
checkpointStore: import("../plugins/store-backend.js").CheckpointStoreFull | undefined;
|
|
32
|
+
checkpointCtxSealing: import("../index.js").CheckpointCtxSealing | undefined;
|
|
32
33
|
parkCommits: import("../plugins/park-commit-watch.js").ParkCommitWatch | undefined;
|
|
33
34
|
durableEnabled: boolean;
|
|
34
35
|
elicitation: import("../elicitation.js").ElicitationCoordinator | undefined;
|
|
@@ -56,7 +57,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
56
57
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
57
58
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
58
59
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
59
|
-
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate
|
|
60
|
+
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
60
61
|
subRunner: import("@sema-agent/core").Runner;
|
|
61
62
|
subRunnerSessions: import("../plugins/fork-routing-session-store.js").ForkRoutingSessionStore;
|
|
62
63
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -42,6 +42,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
42
42
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
43
43
|
centerRuntimeCapsResolver: ((principal: string | undefined) => Promise<import("@sema-agent/core").RuntimeCaps | undefined>) | undefined;
|
|
44
44
|
checkpointStore: import("../plugins/store-backend.js").CheckpointStoreFull | undefined;
|
|
45
|
+
checkpointCtxSealing: import("../index.js").CheckpointCtxSealing | undefined;
|
|
45
46
|
parkCommits: import("../plugins/park-commit-watch.js").ParkCommitWatch | undefined;
|
|
46
47
|
durableEnabled: boolean;
|
|
47
48
|
elicitation: import("../elicitation.js").ElicitationCoordinator | undefined;
|
|
@@ -69,7 +70,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
69
70
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
70
71
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
71
72
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
72
|
-
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate
|
|
73
|
+
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
73
74
|
subRunner: Runner;
|
|
74
75
|
subRunnerSessions: import("../plugins/fork-routing-session-store.js").ForkRoutingSessionStore;
|
|
75
76
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -66,6 +66,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
66
66
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
67
67
|
centerRuntimeCapsResolver: ((principal: string | undefined) => Promise<import("@sema-agent/core").RuntimeCaps | undefined>) | undefined;
|
|
68
68
|
checkpointStore: import("../plugins/store-backend.js").CheckpointStoreFull | undefined;
|
|
69
|
+
checkpointCtxSealing: import("../index.js").CheckpointCtxSealing | undefined;
|
|
69
70
|
parkCommits: import("../plugins/park-commit-watch.js").ParkCommitWatch | undefined;
|
|
70
71
|
durableEnabled: boolean;
|
|
71
72
|
elicitation: import("../elicitation.js").ElicitationCoordinator | undefined;
|
|
@@ -93,7 +94,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
93
94
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
94
95
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
95
96
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
96
|
-
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate
|
|
97
|
+
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
97
98
|
subRunner: import("@sema-agent/core").Runner;
|
|
98
99
|
subRunnerSessions: import("../plugins/fork-routing-session-store.js").ForkRoutingSessionStore;
|
|
99
100
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -6,7 +6,7 @@ import { createLeaderFace } from "./leader.js";
|
|
|
6
6
|
import { assertStaticWiringConsistent } from "../http/routes/diagnostics.js";
|
|
7
7
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
8
8
|
export function runStage09(ctx) {
|
|
9
|
-
const { approvalExemptionStore, backend, backgroundAgentStore, brain, checkpointStore, config, webAdmin, deviceLane, dropSessionScoped, durableEnabled, executionEnvFactory, fileHistoryErasure, governanceSeams, localRoot, logger, mailboxRecipientLifecycle, mailboxStore, metrics, pricing, resumeAnchorStore, runStore, runnerDeps, sessionPolicyStore, sessionStore, streamApprovalGate, taskAttachmentStore, spaceReclaimer, taskListLane, toolResultStore, tracer, usageWindowStore, userInputLedgerStore, workflowCompletionInbox } = ctx;
|
|
9
|
+
const { approvalExemptionStore, backend, backgroundAgentStore, brain, checkpointStore, checkpointCtxSealing, config, webAdmin, deviceLane, dropSessionScoped, durableEnabled, executionEnvFactory, fileHistoryErasure, governanceSeams, localRoot, logger, mailboxRecipientLifecycle, mailboxStore, metrics, pricing, resumeAnchorStore, runStore, runnerDeps, sessionPolicyStore, sessionStore, streamApprovalGate, taskAttachmentStore, spaceReclaimer, taskListLane, toolResultStore, tracer, usageWindowStore, userInputLedgerStore, workflowCompletionInbox } = ctx;
|
|
10
10
|
const { ownerAware, sessionAudit, sessionWatchRegistry, purgeSession, instrumentDegenerate, planCacheProbe } = createSessionFaces({
|
|
11
11
|
deviceStore: deviceLane?.store,
|
|
12
12
|
dropSessionScoped,
|
|
@@ -17,7 +17,7 @@ export function runStage09(ctx) {
|
|
|
17
17
|
userInputLedgerStore,
|
|
18
18
|
...(spaceReclaimer !== undefined ? { spaceReclaimer } : {}),
|
|
19
19
|
});
|
|
20
|
-
const leaderEndpoint = createLeaderFace({ config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, governanceSeams, backend, tracer, usageWindowStore, promptSource: webAdmin.promptSource, onError: runnerDeps.onError });
|
|
20
|
+
const leaderEndpoint = createLeaderFace({ config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, checkpointCtxSealing, governanceSeams, backend, tracer, usageWindowStore, promptSource: webAdmin.promptSource, onError: runnerDeps.onError });
|
|
21
21
|
const drainState = { draining: false };
|
|
22
22
|
const authBridgeIssuer = authBridgeIssuerOf(config)?.issuer;
|
|
23
23
|
const webAdminJwtVerifier = authBridgeIssuer
|
|
@@ -65,6 +65,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
65
65
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
66
66
|
centerRuntimeCapsResolver: ((principal: string | undefined) => Promise<import("@sema-agent/core").RuntimeCaps | undefined>) | undefined;
|
|
67
67
|
checkpointStore: import("../plugins/store-backend.js").CheckpointStoreFull | undefined;
|
|
68
|
+
checkpointCtxSealing: import("../index.js").CheckpointCtxSealing | undefined;
|
|
68
69
|
parkCommits: import("../plugins/park-commit-watch.js").ParkCommitWatch | undefined;
|
|
69
70
|
durableEnabled: boolean;
|
|
70
71
|
elicitation: import("../elicitation.js").ElicitationCoordinator | undefined;
|
|
@@ -92,7 +93,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
92
93
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
93
94
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
94
95
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
95
|
-
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate
|
|
96
|
+
streamApprovalGate: import("../tool-approval.js").StreamApprovalGate<import("../approval-gate-currency.js").GateCurrencyStore>;
|
|
96
97
|
subRunner: import("@sema-agent/core").Runner;
|
|
97
98
|
subRunnerSessions: import("../plugins/fork-routing-session-store.js").ForkRoutingSessionStore;
|
|
98
99
|
subagentSteerRegistry: import("../orchestration/subagent-steer.js").SubagentSteerRegistry;
|
|
@@ -29,13 +29,14 @@ import { bindServerLateSeats } from "./late-binds.js";
|
|
|
29
29
|
import { serviceVersion } from "../service-version.js";
|
|
30
30
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
31
31
|
export async function runStage10(ctx) {
|
|
32
|
-
const { approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, parkCommits, config, webAdmin, consolidationValve, costQuota, deviceLane, drainState, durableEnabled, elicitation, fenceSessionOwner, fileHistoryStore, fleetBus, fleetLease, fleetUsage, governanceSeams, handslessRunner, hookAgent, hookLlm, hookWakeBus, imageBakes, imageIndex, instanceId, instrumentDegenerate, leaderEndpoint, localRoot, logger, lspManager, mcpRevocations, memoryBundleFaces, memoryComplianceFaces, memoryConsolidationFaces, memoryEngine, memoryExportBackend, memoryOptOutGrantStore, memoryOriginFaces, memoryPosture, memorySyncCursors, memorySyncRunner, metrics, modelUsageTracker, orgMemoryAdmission, otelExporter, outcomeSink, ownerAware, parkedReviveInheritedGate, parkedReviveSurface, perSessionCwd, perTaskImage, planCacheProbe, pricing, principalCaps, promptManifestTracker, purgeSession, question, rateLimiter, reaper, webAdminJwtVerifier, resumeAnchorStore, retentionLaneStarted, retentionLaneStore, ruleConsent, runStore, runner, runnerDeps, runtimeCapsPeekResolver, scenarioDetails, scenarios, selectEnvTool, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionAudit, sessionEnvSelection, sessionMemoryStatusFace, sessionPolicyStore, sessionTitler, sessionWatchRegistry, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, sharedMemoryStore, sideQueryAccounting, sqlEngine, sqlWorkflowRunStore, staticWiring, storePosture, subRunner, subagentSteerRegistry, taskAttachmentStore, taskLimitCaps, taskTimeoutSec, toolApproval, toolResultStore, usageWindowStore, userInputLedger, webSearchProvider, workflowAgentRegistry, workflowAgentSessionIndex, workflowParkDecisions, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate } = ctx;
|
|
32
|
+
const { approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, checkpointCtxSealing, parkCommits, config, webAdmin, consolidationValve, costQuota, deviceLane, drainState, durableEnabled, elicitation, fenceSessionOwner, fileHistoryStore, fleetBus, fleetLease, fleetUsage, governanceSeams, handslessRunner, hookAgent, hookLlm, hookWakeBus, imageBakes, imageIndex, instanceId, instrumentDegenerate, leaderEndpoint, localRoot, logger, lspManager, mcpRevocations, memoryBundleFaces, memoryComplianceFaces, memoryConsolidationFaces, memoryEngine, memoryExportBackend, memoryOptOutGrantStore, memoryOriginFaces, memoryPosture, memorySyncCursors, memorySyncRunner, metrics, modelUsageTracker, orgMemoryAdmission, otelExporter, outcomeSink, ownerAware, parkedReviveInheritedGate, parkedReviveSurface, perSessionCwd, perTaskImage, planCacheProbe, pricing, principalCaps, promptManifestTracker, purgeSession, question, rateLimiter, reaper, webAdminJwtVerifier, resumeAnchorStore, retentionLaneStarted, retentionLaneStore, ruleConsent, runStore, runner, runnerDeps, runtimeCapsPeekResolver, scenarioDetails, scenarios, selectEnvTool, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionAudit, sessionEnvSelection, sessionMemoryStatusFace, sessionPolicyStore, sessionTitler, sessionWatchRegistry, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, sharedMemoryStore, sideQueryAccounting, sqlEngine, sqlWorkflowRunStore, staticWiring, storePosture, subRunner, subagentSteerRegistry, taskAttachmentStore, taskLimitCaps, taskTimeoutSec, toolApproval, toolResultStore, usageWindowStore, userInputLedger, webSearchProvider, workflowAgentRegistry, workflowAgentSessionIndex, workflowParkDecisions, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate } = ctx;
|
|
33
33
|
const stores = {
|
|
34
34
|
runStore,
|
|
35
35
|
resumeAnchorStore: resumeAnchorStore ? resumeAnchorStore : undefined,
|
|
36
36
|
approvalExemptionStore: approvalExemptionStore ? approvalExemptionStore : undefined,
|
|
37
37
|
approvalNonceStore: approvalNonceStore ? approvalNonceStore : undefined,
|
|
38
38
|
checkpointStore,
|
|
39
|
+
checkpointCtxSealing,
|
|
39
40
|
sessionPolicyStore: sessionPolicyStore ? sessionPolicyStore : undefined,
|
|
40
41
|
ruleConsent,
|
|
41
42
|
fileHistoryStore: fileHistoryStore ? fileHistoryStore : undefined,
|
package/dist/boot/stores.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export interface OpenStoresCtx {
|
|
|
13
13
|
metrics: Metrics;
|
|
14
14
|
localRoot: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* durable 回决腿的规则位给 `approval_ask` 加了 `rule_command`/`rule_scope_root` 两列,而 `ensureAsk` 的 INSERT 与每一条读**无条件**引用它们 ⇒ 存量表上整条流内审批协议
|
|
18
|
+
* 静默塌掉(卡不落库、重放面恒空、迟到决议恒 404),而 `/v1/capabilities` 仍报 streamApproval active。判据与恢复动作见 `assertApprovalAskRuleMaterialSchema` 的头注。
|
|
19
|
+
*
|
|
20
|
+
* 🔴 **只在协议真会上场时探**(与卡编辑面那道探针同一条纪律),调用方只在 `streamApprovalGate.active` 为真时调本函数 —— 谓词是**协调器装配点那一次求值**的结果(`resolveStreamApprovalGate`),
|
|
21
|
+
* 不在这里手抄一份,也不在别处再求一遍(手抄的判据会漂,漂的方向要么是拒启误伤、要么是该拒不拒;再求一遍的 park 设施位手上没有那只店)。本函数只做探:有 SQL 池就探,local 后端无池则无事。
|
|
22
|
+
*/
|
|
23
|
+
export declare function assertApprovalAskRuleMaterialOnBackend(backend: StoreBackend | undefined): Promise<void>;
|
|
16
24
|
export declare function openStores(ctx: OpenStoresCtx): Promise<{
|
|
17
25
|
backend: StoreBackend | undefined;
|
|
18
26
|
storePosture: import("../store-posture.js").StorePosture;
|
package/dist/boot/stores.js
CHANGED
|
@@ -34,7 +34,6 @@ import { assertApprovalAskRuleMaterialSchema } from "../plugins/approval-ask-sto
|
|
|
34
34
|
import { assertSchemaMatchesCode } from "../plugins/schema-consistency.js";
|
|
35
35
|
import { assertCheckpointColumnSchema } from "../plugins/checkpoint-store-sql.js";
|
|
36
36
|
import { assertFileHistorySchema } from "../plugins/file-history-store-sql.js";
|
|
37
|
-
import { resolveStreamApprovalGate } from "../tool-approval.js";
|
|
38
37
|
import { buildMemoryBoundaryLaneFacts, buildMemoryWriteBoundaryAudit, effectiveMemoryPersistenceCapable } from "./memory-boundary.js";
|
|
39
38
|
import { buildMemoryPosture } from "../memory-posture.js";
|
|
40
39
|
import { establishSqlEnginePosture, sqlPoolsOf } from "../sql-engine-posture.js";
|
|
@@ -45,6 +44,14 @@ const DARK_REASON_PROSE = {
|
|
|
45
44
|
multi_tenant_file_backend: () => "multi-tenant on the FILE backend (no tenant isolation; set MEMORY_ENGINE_BACKEND=pg|tidb to light up)",
|
|
46
45
|
remote_lane_split: (lane) => `remote exec lane "${lane}" (worker/sandbox file planes split; MEMORY_ENGINE_REMOTE_LANE=allow overrides)`,
|
|
47
46
|
};
|
|
47
|
+
export async function assertApprovalAskRuleMaterialOnBackend(backend) {
|
|
48
|
+
const mysqlPool = backend?.mysqlPool?.();
|
|
49
|
+
const pgPool = backend?.pgPool?.();
|
|
50
|
+
if (pgPool)
|
|
51
|
+
await assertApprovalAskRuleMaterialSchema(async (sql) => ({ rows: (await pgPool.query(sql)).rows }), "pg");
|
|
52
|
+
else if (mysqlPool)
|
|
53
|
+
await assertApprovalAskRuleMaterialSchema(async (sql) => ({ rows: (await mysqlPool.query(sql))[0] }), "tidb");
|
|
54
|
+
}
|
|
48
55
|
export async function openStores(ctx) {
|
|
49
56
|
const { config, logger, metrics, localRoot } = ctx;
|
|
50
57
|
let backend;
|
|
@@ -83,17 +90,6 @@ export async function openStores(ctx) {
|
|
|
83
90
|
else if (mysqlPool)
|
|
84
91
|
await assertPermissionRuleTicketSchema(async (sql) => ({ rows: (await mysqlPool.query(sql))[0] }), "tidb");
|
|
85
92
|
}
|
|
86
|
-
if (resolveStreamApprovalGate({
|
|
87
|
-
toolApprovalEnabled: config.toolApprovalEnabled === true,
|
|
88
|
-
streamApprovalEnabled: config.streamApproval.enabled,
|
|
89
|
-
backend,
|
|
90
|
-
parkFacility: backend?.checkpoint !== undefined && config.durableApproval === true,
|
|
91
|
-
}).active) {
|
|
92
|
-
if (pgPool)
|
|
93
|
-
await assertApprovalAskRuleMaterialSchema(async (sql) => ({ rows: (await pgPool.query(sql)).rows }), "pg");
|
|
94
|
-
else if (mysqlPool)
|
|
95
|
-
await assertApprovalAskRuleMaterialSchema(async (sql) => ({ rows: (await mysqlPool.query(sql))[0] }), "tidb");
|
|
96
|
-
}
|
|
97
93
|
if (pgPool)
|
|
98
94
|
await assertFileHistorySchema(async (sql) => ({ rows: (await pgPool.query(sql)).rows }), "pg");
|
|
99
95
|
else if (mysqlPool)
|
package/dist/boot/web-admin.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { type ModelKeyRef } from "../key-resolver.js";
|
|
|
10
10
|
import type { Logger } from "../observability/logger.js";
|
|
11
11
|
import type { Metrics } from "../observability/metrics.js";
|
|
12
12
|
import { type SealedKeyPublicFace } from "../sealed-key.js";
|
|
13
|
+
import type { CheckpointCtxSealing } from "../http/checkpoint-ctx.js";
|
|
13
14
|
import type { UnpricedCeilingVerdict } from "./unpriced-ceiling-verdict.js";
|
|
14
15
|
import type { ConsolidationSeatWatch } from "./memory-consolidation.js";
|
|
15
16
|
import type { DegradeRouteWatch } from "../brain.js";
|
|
@@ -45,6 +46,11 @@ export interface WebAdminRuntime {
|
|
|
45
46
|
* 三形都建),失败 ⇒ `undefined`(`sealed_key_store_unavailable` 那一行已响亮告警)。店只在 boot 建一次、进程内不换钥匙,
|
|
46
47
|
* 所以这是一个值,不是 getter。唯一读者 = `GET /v1/capabilities` 的 `sealedKey` 段(stage-10 经 deps 交过去)。 */
|
|
47
48
|
readonly sealedKeyPublic: SealedKeyPublicFace | undefined;
|
|
49
|
+
/** S-1907:**停驻行凭据封签器**(`sealed-key.ts` `ensureCheckpointCtxSealing`:这一域自己的保管店 `<数据根>/sealed-key/checkpoint-ctx-keys/` —— 一个域一对钥匙,
|
|
50
|
+
* 与模型钥匙那只店不共用;封 = 最新公钥;开 = 按封签上的 id 精确选私钥、只认绑着本行会话的停驻行信封)。present-iff 这一域建店并自检成功(与模型钥匙店各自成败)。
|
|
51
|
+
* 读者:HTTP 面(`ServiceDeps.checkpointCtxSealing`,stage-10)、leader worker 的续跑上下文(stage-09)与一次性迁移 M28(stage-06);起服第 6 段对
|
|
52
|
+
* 「checkpoint 店在、它不在」拒启。私钥、保管目录、持有 id 列表照旧够不着(S-737 的结构性那一半不变)。 */
|
|
53
|
+
readonly checkpointCtxSealing: CheckpointCtxSealing | undefined;
|
|
48
54
|
/** core `CenterPromptSource`(RunnerDeps / subRunner 必须同实例)。 */
|
|
49
55
|
readonly promptSource: CenterPromptSource;
|
|
50
56
|
/** center skills overlay → plugins 消费 → boot LKG 落盘/skill-stale 判定 → mcp 解析。返回新的 skills 表。 */
|
package/dist/boot/web-admin.js
CHANGED
|
@@ -20,7 +20,7 @@ import { centerManagedConfigKeys } from "../web-admin-client/apply-effective.js"
|
|
|
20
20
|
import { createConfigProvider, raceBootFetch, serviceConfigSourceKind, BOOT_FETCH_DEFERRED } from "../config-provider.js";
|
|
21
21
|
import { ConfigDirUntrustedError } from "../config-dir-trust.js";
|
|
22
22
|
import { createKeyResolver } from "../key-resolver.js";
|
|
23
|
-
import { buildSealedKeyPublicFace, ensureSealedKeyStore, reportExecutionPublicKey } from "../sealed-key.js";
|
|
23
|
+
import { buildSealedKeyPublicFace, ensureCheckpointCtxSealing, ensureSealedKeyStore, reportExecutionPublicKey } from "../sealed-key.js";
|
|
24
24
|
import { applyEffective, applyCenterReadFace, buildReadFaceBaseline, buildReadFaceSwapCandidate, restoreReadFaceBaseline, mutateInPlace, logEffectiveDiff, applySkillsManifest, resolveMcpServers, resolveA2aPeers, restartReasons, modelPlaneChanged, withModelPlaneOf, fullyLandedForLkg, NO_CENTER_EFFECTIVE, isNoCenterEffective, fetchPromptArtifact } from "../web-admin-client/facade.js";
|
|
25
25
|
import { buildConfigHandoff, buildRestartSignal, configHandoffMissing } from "../fleet/engine-signal.js";
|
|
26
26
|
import { createMcpRevocationLedger, enabledMcpEntries } from "../web-admin-client/mcp-revocation.js";
|
|
@@ -133,9 +133,10 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
133
133
|
}
|
|
134
134
|
return r;
|
|
135
135
|
};
|
|
136
|
+
const sealedKeyDir = join(config.localDataRoot ?? localRoot, "sealed-key");
|
|
136
137
|
let sealedKeys;
|
|
137
138
|
try {
|
|
138
|
-
sealedKeys = await ensureSealedKeyStore(
|
|
139
|
+
sealedKeys = await ensureSealedKeyStore(sealedKeyDir, logger);
|
|
139
140
|
void reportExecutionPublicKey({
|
|
140
141
|
baseUrl: cc?.baseUrl,
|
|
141
142
|
adminToken: process.env[WEB_ADMIN_ENV.adminToken],
|
|
@@ -147,6 +148,13 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
147
148
|
catch (err) {
|
|
148
149
|
logger.warn("sealed_key_store_unavailable", { err: String(err), note: "sealed api keys cannot be unsealed on this host — models carrying sealedApiKey will fail loud per-model" });
|
|
149
150
|
}
|
|
151
|
+
let checkpointCtxSealing;
|
|
152
|
+
try {
|
|
153
|
+
checkpointCtxSealing = await ensureCheckpointCtxSealing(sealedKeyDir, logger);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
logger.warn("checkpoint_ctx_sealing_unavailable", { err: err instanceof Error ? err.message : String(err), note: "suspended tasks' request credentials cannot be sealed on this host; with durable approvals on the boot refuses — make <data root>/sealed-key/checkpoint-ctx-keys/ creatable and chmod-able by the service, or repair / remove a key file there whose public and private halves do not belong together" });
|
|
157
|
+
}
|
|
150
158
|
const configProvider = serviceConfigSourceKind(config) !== undefined
|
|
151
159
|
? createConfigProvider({
|
|
152
160
|
...(config.configProvider ? { provider: config.configProvider } : {}),
|
|
@@ -705,6 +713,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
705
713
|
return {
|
|
706
714
|
providerKind: configProvider?.kind,
|
|
707
715
|
sealedKeyPublic: sealedKeys === undefined ? undefined : buildSealedKeyPublicFace(sealedKeys),
|
|
716
|
+
checkpointCtxSealing,
|
|
708
717
|
promptSource,
|
|
709
718
|
takeMcpRevocations: () => {
|
|
710
719
|
mcpRevocationWired = true;
|
package/dist/budget.js
CHANGED
|
@@ -2,6 +2,7 @@ import { isModelPriced, modelCostToPricing } from "@sema-agent/core";
|
|
|
2
2
|
import { currentPrincipal } from "./observability/principal-context.js";
|
|
3
3
|
import { isPermissionRuleEventKind, permissionRuleEventWordOf } from "./observability/permission-rule-events.js";
|
|
4
4
|
import { promptManifestRecordOf, configAssembledRecordOf } from "./observability/prompt-manifest.js";
|
|
5
|
+
import { crossBoundaryTaintEventData } from "./trace/project.js";
|
|
5
6
|
export function buildPricing(models) {
|
|
6
7
|
const pricing = {};
|
|
7
8
|
for (const m of Object.values(models))
|
|
@@ -114,7 +115,10 @@ export function createTracer(metrics, costQuota, modelUsage, fleetUsage, fleetLe
|
|
|
114
115
|
else if (e.kind === "config.assembled") {
|
|
115
116
|
const rec = configAssembledRecordOf(e);
|
|
116
117
|
if (rec)
|
|
117
|
-
promptManifests?.
|
|
118
|
+
promptManifests?.recordCompanion(e.taskId, "config_assembled", rec);
|
|
119
|
+
}
|
|
120
|
+
else if (e.kind === "permission.cross_boundary_taint") {
|
|
121
|
+
promptManifests?.recordCompanion(e.taskId, "cross_boundary_taint", crossBoundaryTaintEventData(e));
|
|
118
122
|
}
|
|
119
123
|
else if (e.kind === "compaction.phase_timings") {
|
|
120
124
|
const d = e.durationMs;
|