@sema-agent/server 7.131.0 → 7.132.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 +309 -0
- package/README.md +5 -1
- package/README.zh-CN.md +3 -1
- package/USAGE.md +163 -54
- package/dist/approval-card.d.ts +3 -1
- package/dist/approval-card.js +2 -3
- package/dist/audit.d.ts +7 -10
- package/dist/auth-bridge.d.ts +4 -0
- package/dist/auth-bridge.js +10 -11
- package/dist/boot/deployment-mods.d.ts +31 -0
- package/dist/boot/deployment-mods.js +26 -0
- package/dist/boot/execution-env.d.ts +1 -1
- package/dist/boot/execution-env.js +19 -6
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/read-deny-anchor-audit.d.ts +17 -0
- package/dist/boot/read-deny-anchor-audit.js +36 -0
- package/dist/boot/resolve-spec.d.ts +1 -5
- package/dist/boot/resolve-spec.js +19 -47
- package/dist/boot/runner-deps.d.ts +19 -8
- package/dist/boot/runner-deps.js +14 -2
- package/dist/boot/session-faces.d.ts +1 -7
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +4 -4
- package/dist/boot/stage-05-execution-env.js +7 -10
- package/dist/boot/stage-06-runners.d.ts +2 -2
- package/dist/boot/stage-06-runners.js +5 -4
- package/dist/boot/stage-07-capability-layer.d.ts +2 -2
- package/dist/boot/stage-07-capability-layer.js +3 -3
- package/dist/boot/stage-08-reapers.d.ts +2 -2
- package/dist/boot/stage-09-leader.d.ts +3 -9
- package/dist/boot/stage-10-http-server.d.ts +3 -9
- package/dist/boot/stage-10-http-server.js +6 -7
- package/dist/boot/stores.d.ts +1 -1
- package/dist/boot/stores.js +5 -6
- package/dist/boot/web-admin.d.ts +0 -3
- package/dist/boot/web-admin.js +35 -35
- package/dist/brain.js +17 -22
- package/dist/budget.js +5 -4
- package/dist/caller-text-echo.d.ts +20 -0
- package/dist/caller-text-echo.js +24 -0
- package/dist/capabilities/brand-identity.d.ts +26 -0
- package/dist/capabilities/brand-identity.js +27 -0
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +32 -59
- package/dist/capabilities/center-prompts.js +18 -32
- package/dist/capabilities/engine-capabilities.js +2 -1
- package/dist/capabilities/hands-lane.d.ts +9 -6
- package/dist/capabilities/hands-lane.js +1 -1
- package/dist/capabilities/mcp-probe.d.ts +14 -1
- package/dist/capabilities/mcp-probe.js +22 -133
- package/dist/capabilities/scenarios.d.ts +34 -40
- package/dist/capabilities/scenarios.js +16 -33
- package/dist/capabilities/skills.d.ts +19 -4
- package/dist/capabilities/skills.js +30 -10
- package/dist/config-catalog.js +6 -6
- package/dist/config-lkg.d.ts +9 -9
- package/dist/config-lkg.js +20 -4
- package/dist/config-provider.d.ts +3 -1
- package/dist/config-provider.js +12 -4
- package/dist/config-types.d.ts +7 -9
- package/dist/config.js +17 -4
- package/dist/device-ws-protocol.d.ts +1 -1
- package/dist/device-ws-protocol.js +1 -0
- package/dist/env-name-allowlist-knobs.d.ts +12 -2
- package/dist/env-name-allowlist-knobs.js +5 -4
- package/dist/exec-bounds.d.ts +15 -3
- package/dist/exec-bounds.js +4 -0
- package/dist/execution-lane-caps.d.ts +9 -2
- package/dist/execution-lane-caps.js +11 -0
- package/dist/hooks/classic-stations.d.ts +86 -0
- package/dist/hooks/classic-stations.js +27 -0
- package/dist/hooks/hook-llm.d.ts +8 -5
- package/dist/hooks/hook-llm.js +78 -35
- package/dist/hooks/hook-runner.d.ts +232 -80
- package/dist/hooks/hook-runner.js +218 -312
- package/dist/http/admission.d.ts +8 -2
- package/dist/http/admission.js +101 -57
- package/dist/http/approval-sweeps.js +57 -16
- package/dist/http/checkpoint-ctx.d.ts +25 -8
- package/dist/http/checkpoint-ctx.js +11 -7
- package/dist/http/claimed-run.d.ts +13 -0
- package/dist/http/claimed-run.js +15 -0
- package/dist/http/device-placement.js +5 -10
- package/dist/http/dispatch.d.ts +0 -4
- package/dist/http/dispatch.js +5 -9
- package/dist/http/durable-run-leg.d.ts +2 -1
- package/dist/http/durable-run-leg.js +5 -3
- package/dist/http/health-self-report.d.ts +7 -5
- package/dist/http/health-self-report.js +4 -18
- package/dist/http/principal-gate.d.ts +23 -6
- package/dist/http/principal-gate.js +24 -5
- package/dist/http/refusal-body.d.ts +21 -0
- package/dist/http/refusal-body.js +4 -0
- package/dist/http/request-guards.d.ts +27 -0
- package/dist/http/request-guards.js +24 -3
- package/dist/http/resume-legs.d.ts +25 -0
- package/dist/http/resume-legs.js +43 -22
- package/dist/http/routes/capabilities.js +1 -1
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/rules.js +2 -2
- package/dist/http/routes/runs.js +7 -7
- package/dist/http/routes/session-sync.js +4 -2
- package/dist/http/routes/sessions.js +1 -1
- package/dist/http/routes/shared-memory.js +2 -13
- package/dist/http/routes/side-query.js +2 -3
- package/dist/http/routes/tasks.js +19 -9
- package/dist/http/send.d.ts +9 -7
- package/dist/http/send.js +7 -2
- package/dist/http/server.d.ts +21 -11
- package/dist/http/server.js +28 -2
- package/dist/http/submit-ctx.d.ts +25 -0
- package/dist/http/submit-ctx.js +39 -0
- package/dist/http/wire-types.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lane-home-probe.d.ts +43 -0
- package/dist/lane-home-probe.js +35 -0
- package/dist/limit-refusal.d.ts +47 -0
- package/dist/limit-refusal.js +12 -0
- package/dist/main.js +1 -1
- package/dist/mcp-assertion-header.d.ts +1 -9
- package/dist/mcp-assertion-header.js +0 -6
- package/dist/mcp-tool-faces.d.ts +5 -0
- package/dist/mcp-tool-faces.js +5 -1
- package/dist/memory-scope.d.ts +1 -1
- package/dist/model-provider.d.ts +39 -12
- package/dist/model-provider.js +19 -2
- package/dist/model-route-endpoint.d.ts +1 -1
- package/dist/model-route-endpoint.js +5 -5
- package/dist/observability/cost-taxonomy.d.ts +7 -7
- package/dist/observability/fail-open.d.ts +42 -6
- package/dist/observability/fail-open.js +42 -6
- package/dist/observability/metrics.js +3 -1
- package/dist/observability/prompt-manifest.d.ts +47 -82
- package/dist/observability/prompt-manifest.js +119 -17
- package/dist/observability/run-terminal.js +14 -6
- package/dist/observability/secret-env-scrub.d.ts +13 -1
- package/dist/observability/secret-env-scrub.js +13 -1
- package/dist/observability/tool-trace.d.ts +16 -21
- package/dist/observability/tool-trace.js +51 -42
- package/dist/per-task-image.d.ts +7 -1
- package/dist/per-task-image.js +3 -3
- package/dist/plain-string-record.d.ts +25 -0
- package/dist/plain-string-record.js +32 -0
- package/dist/plugins/blob-backend.d.ts +68 -13
- package/dist/plugins/blob-backend.js +53 -10
- package/dist/plugins/checkpoint-store-sql.d.ts +14 -4
- package/dist/plugins/checkpoint-store-sql.js +39 -26
- package/dist/plugins/k8s-bg-scripts.d.ts +11 -0
- package/dist/plugins/k8s-bg-scripts.js +22 -0
- package/dist/plugins/local-checkpoint-store.js +5 -2
- package/dist/plugins/local-session-store.js +1 -1
- package/dist/plugins/one-time-migrations.d.ts +137 -90
- package/dist/plugins/one-time-migrations.js +356 -207
- package/dist/plugins/permission-rule-store-sql.d.ts +13 -7
- package/dist/plugins/permission-rule-store-sql.js +4 -18
- package/dist/plugins/pg-session-storage.d.ts +4 -5
- package/dist/plugins/pg-session-storage.js +7 -17
- package/dist/plugins/remote-env-adb.d.ts +6 -0
- package/dist/plugins/remote-env-adb.js +9 -4
- package/dist/plugins/remote-env-device.js +3 -0
- package/dist/plugins/remote-env-e2b.d.ts +1 -1
- package/dist/plugins/remote-env-e2b.js +21 -9
- package/dist/plugins/remote-env-host.d.ts +9 -9
- package/dist/plugins/remote-env-host.js +10 -32
- package/dist/plugins/remote-env-k8s.d.ts +95 -26
- package/dist/plugins/remote-env-k8s.js +265 -90
- package/dist/plugins/remote-env-local-docker.d.ts +20 -1
- package/dist/plugins/remote-env-local-docker.js +77 -9
- package/dist/plugins/remote-env-ssh.d.ts +15 -0
- package/dist/plugins/remote-env-ssh.js +109 -3
- package/dist/plugins/remote-shell.d.ts +0 -1
- package/dist/plugins/remote-shell.js +1 -2
- package/dist/plugins/retention-store-sql.js +6 -2
- package/dist/plugins/schema-consistency.d.ts +54 -0
- package/dist/plugins/schema-consistency.js +52 -0
- package/dist/plugins/session-epoch-anchor.d.ts +13 -0
- package/dist/plugins/session-epoch-anchor.js +23 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +9 -3
- package/dist/plugins/shared-memory-store-sql.js +5 -16
- package/dist/plugins/sql-driver.d.ts +141 -0
- package/dist/plugins/sql-driver.js +115 -1
- package/dist/plugins/sql-errors.d.ts +41 -0
- package/dist/plugins/sql-errors.js +36 -0
- package/dist/plugins/store-backend.js +2 -1
- package/dist/plugins/tidb-session-storage.d.ts +7 -11
- package/dist/plugins/tidb-session-storage.js +6 -16
- package/dist/plugins/tidb-session-store.js +1 -1
- package/dist/prompts-domain-validate.d.ts +17 -61
- package/dist/prompts-domain-validate.js +9 -119
- package/dist/request-key-closure.d.ts +2 -2
- package/dist/request-key-closure.js +2 -4
- package/dist/rule-entry-list.d.ts +12 -9
- package/dist/rule-entry-list.js +37 -21
- package/dist/run-local.js +19 -19
- package/dist/runs.d.ts +6 -0
- package/dist/runs.js +16 -0
- package/dist/server-secret-env.d.ts +44 -18
- package/dist/server-secret-env.js +49 -8
- package/dist/session-incarnation.d.ts +15 -5
- package/dist/session-incarnation.js +16 -9
- package/dist/session-titler.js +12 -2
- package/dist/spec-fields.d.ts +28 -16
- package/dist/spec-fields.js +46 -53
- package/dist/sql-engine-posture.d.ts +29 -4
- package/dist/sql-engine-posture.js +36 -1
- package/dist/stored-request-tool-axes-m19.d.ts +19 -4
- package/dist/stored-request-tool-axes-m19.js +30 -2
- package/dist/task-a2a.d.ts +9 -1
- package/dist/task-a2a.js +73 -47
- package/dist/task-mcp.d.ts +46 -58
- package/dist/task-mcp.js +99 -65
- package/dist/task-settings.d.ts +7 -21
- package/dist/task-settings.js +7 -36
- package/dist/text-bidi.d.ts +3 -46
- package/dist/text-bidi.js +3 -3
- package/dist/tool-approval.d.ts +1 -1
- package/dist/trace/core-keyset-guard.d.ts +24 -4
- package/dist/trace/engine-notice-wire.d.ts +11 -3
- package/dist/trace/engine-notice-wire.js +8 -1
- package/dist/trace/ledger-events.d.ts +3 -1
- package/dist/trace/ledger-sink.js +4 -1
- package/dist/trace/model-segment.js +1 -1
- package/dist/trace/project.d.ts +19 -6
- package/dist/trace/project.js +57 -22
- package/dist/trace/wire-projection-faces.d.ts +79 -1
- package/dist/trace/wire-projection-faces.js +22 -0
- package/dist/web-admin-client/candidate-gate.d.ts +6 -6
- package/dist/web-admin-client/candidate-gate.js +3 -3
- package/dist/web-admin-client/http-client.js +0 -6
- package/dist/web-admin-client/read-warnings.d.ts +13 -0
- package/dist/web-admin-client/read-warnings.js +10 -0
- package/dist/web-admin-client/skills-mcp.d.ts +3 -0
- package/dist/web-admin-client/skills-mcp.js +9 -6
- package/dist/web-admin-client/types.d.ts +2 -3
- package/dist/workspace-cache.d.ts +35 -0
- package/dist/workspace-cache.js +36 -0
- package/dist/workspace-space.d.ts +3 -2
- package/dist/workspace-space.js +2 -0
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +8 -1
- package/package.json +4 -4
- package/scripts/drain-check-local.mjs +34 -1
- package/scripts/drain-check.mysql.sql +30 -2
- package/scripts/drain-check.pg.sql +29 -2
- package/dist/capabilities/memory-notice.d.ts +0 -138
- package/dist/capabilities/memory-notice.js +0 -64
- package/dist/capabilities/prompt.d.ts +0 -17
- package/dist/capabilities/prompt.js +0 -6
- package/dist/mcp-content-origin.d.ts +0 -34
- package/dist/mcp-content-origin.js +0 -10
- package/dist/tool-axis-words.d.ts +0 -27
- package/dist/tool-axis-words.js +0 -9
- package/dist/wire-name-bound.d.ts +0 -14
- package/dist/wire-name-bound.js +0 -13
|
@@ -56,13 +56,16 @@ import type { MailboxRecipientLifecycle } from "../plugins/mailbox-recipient-lif
|
|
|
56
56
|
export type RunnerDepsOnAsk = (req: Parameters<ToolApprovalCoordinator["ask"]>[0], signal?: AbortSignal) => Promise<AskOutcome>;
|
|
57
57
|
export declare function createRunnerDepsOnAsk(toolApproval: ToolApprovalCoordinator | undefined): RunnerDepsOnAsk | undefined;
|
|
58
58
|
/** [ref] 件⑤:core `onError(phase:"config")` 的 `classification` 已知词表。⚠️ core d.ts(`RunnerDeps.onError` 注)只登记了
|
|
59
|
-
* prompt-cache 相的五词,config 相的词**只在 dist js
|
|
60
|
-
* `
|
|
61
|
-
*
|
|
59
|
+
* prompt-cache 相的五词,config 相的词**只在 dist js 出现**,发射点有两种写法:字面量(`classification: "<词>"`)与经变量 / 表行发射
|
|
60
|
+
* (`classification: <变量>` 取自同文件的字面量初值,或 `classification: <表>.classification` 取自同文件的表行)。7.52.0 亲扫六词 ——
|
|
61
|
+
* `interaction-posture-refused`(prepare-config-doors,字面量)/ `sandbox-admission-unavailable`(prepare-policy-chain,字面量)/
|
|
62
|
+
* `memory-tools-not-mounted` / `shared-memory-not-mounted`(core 7.52.0 起一只铸点 `announceMemoryNotMounted`,词在
|
|
63
|
+
* announce-once-ledger 的表行)/ `file-history-no-store` / `file-history-no-env`(prepare-file-history 的 `livenessArm` 变量,core 7.30 起
|
|
64
|
+
* 就在 —— 只认字面量的旧扫描看不见它们,两词一直被标 `classificationKnown:false`、指标折 `unknown`,本版随扫描改读两种写法一并收进表)。
|
|
62
65
|
* S-877:第五词 `shell-gate-off` 随 core 7.34.0 的 off 车道一起退役(引擎侧零发射点),同批删 —— 它唯一的本仓消费者
|
|
63
66
|
* (「本 session 显式 bypass ⇒ 降级 info」那条回查腿与 `boot/session-shell-gate-registry.ts` 登记簿)一并删干净。所以这是「按实现亲读」的开集快照,不是 core 类型闭集——词表外的值原样进日志并标
|
|
64
67
|
* `classificationKnown:false`(指标标签折 `unknown`),不吞不编;与安装包的锁步由 test/boot-runner-deps-shared-base.test.ts
|
|
65
|
-
* 的 dist 扫描格钉住(core 加词/收进 d.ts 那天先红)。 */
|
|
68
|
+
* 的 dist 扫描格钉住(两种发射写法都读;读不出词的经变量发射点本身红;core 加词/收进 d.ts 那天先红)。 */
|
|
66
69
|
export declare const CONFIG_ADVISORY_CLASSIFICATIONS: ReadonlySet<string>;
|
|
67
70
|
/** S-386:core 的 [ref] 前缀缓存**断裂**探测器交给宿主的根因**闭集**,以及每个词的日志级别。
|
|
68
71
|
* 闭集**不抄词**:词源直接取 core 公开导出的 `CacheBreakFinding["cause"]`(`@sema-agent/core` 根导出,
|
|
@@ -218,14 +221,15 @@ export interface RunnerDepsCtx {
|
|
|
218
221
|
* 的「差异键」注释块逐条列了 sessionStore / checkpointStore / 四个座位,**都没提 hands**
|
|
219
222
|
* —— 也就是说它不是一次有理由的分歧,是漏配(与本函数头注记的 [ref]§三族A 同一个病族)。
|
|
220
223
|
* 由**调用方**给值(而不是在基座里按 `config` 现算):两条腿的判据本就不同(HTTP 腿按
|
|
221
|
-
*
|
|
224
|
+
* 品牌判官 `isBrandedDeployment`(`capabilities/brand-identity.ts`)分 branded/非 branded,run-local 恒是 Sema 本地形),
|
|
222
225
|
* 各自算一次、传进来一次,两只 Runner 自动同源。
|
|
223
226
|
*/
|
|
224
227
|
hands: RunnerDeps["hands"];
|
|
225
228
|
executionEnvFactory: RunnerDeps["executionEnvFactory"];
|
|
226
229
|
lspManager: RunnerDeps["lspManager"];
|
|
227
230
|
fleetBus: FleetEventBus;
|
|
228
|
-
|
|
231
|
+
/** 部署座的 mods 注册(stage-05 `createDeploymentMods` 铸、起服自证过)—— 共享基座 ⇒ 主 / handless / hookAgent / sub 每一只 Runner 同一份。 */
|
|
232
|
+
deploymentMods: NonNullable<RunnerDeps["mods"]>;
|
|
229
233
|
workflowRunStore: WorkflowRunStore | undefined;
|
|
230
234
|
workflowJournalStore: ServiceWorkflowJournalStore | undefined;
|
|
231
235
|
workflowAgentRegistry: WorkflowAgentRegistry | undefined;
|
|
@@ -237,7 +241,7 @@ export interface RunnerDepsCtx {
|
|
|
237
241
|
}
|
|
238
242
|
/** [ref] A10 留档发现②:main runner `RunnerDeps` 与 main.ts subRunner 字面量之间此前手工重复
|
|
239
243
|
* 的 ~15 个键,类型标注见 {@link createSharedRunnerDeps} 头注。 */
|
|
240
|
-
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" | "
|
|
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">;
|
|
241
245
|
/**
|
|
242
246
|
* [ref] A10 留档发现②(review 2026-07-29,[ref]§三族A 同源修补的延续):main runner 的
|
|
243
247
|
* `RunnerDeps` 字面量(下方 `createRunnerDeps`)与 `main.ts` 里 subRunner 的 `new Runner({...})`
|
|
@@ -264,7 +268,7 @@ export type SharedRunnerDeps = Pick<RunnerDeps, "brain" | "readFace" | "readDeny
|
|
|
264
268
|
* 属性,比再抽一层共享基座更强的同源保证),不重复收纳进这里。
|
|
265
269
|
*/
|
|
266
270
|
/** 基座真实消费的窄面(Pick)——subRunner 调用点(main.ts)只需凑这 13 个字段,不必造全量 ctx。 */
|
|
267
|
-
export type SharedRunnerDepsCtx = Pick<RunnerDepsCtx, "config" | "brain" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "
|
|
271
|
+
export type SharedRunnerDepsCtx = Pick<RunnerDepsCtx, "config" | "brain" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "deploymentMods" | "toolResultStore" | "checkpointStore" | "sessionPolicyStore" | "hands" | "usageWindowStore" | "orgMemoryAdmission" | "sharedMemoryStores" | "logger" | "governanceSeams" | "mcpRevocations" | "metrics" | "engineDataRoot">;
|
|
268
272
|
/** 转发席只需要 `inc` —— 刻意窄到这一个动词,免得把整只 Metrics 拖进这条纯转发腿。 */
|
|
269
273
|
export interface EngineNoticeMetricsSeat {
|
|
270
274
|
inc: (name: string, labels?: Record<string, string>) => void;
|
|
@@ -317,6 +321,13 @@ export type DeploymentPostureSeats = Pick<RunnerDeps, "readFace" | "readDenyPatt
|
|
|
317
321
|
* + LKG 覆写路径(`readDenyPatterns` 席并入它派生的读拒行,`lkgReadDenyRows`)。 */
|
|
318
322
|
export type DeploymentPostureConfig = Pick<ServiceConfig, Exclude<keyof DeploymentPostureSeats, "allowedTools"> | "approvalGrant" | "configLkgPath">;
|
|
319
323
|
export declare function buildDeploymentPostureSeats(config: DeploymentPostureConfig): DeploymentPostureSeats;
|
|
324
|
+
/**
|
|
325
|
+
* 部署读拒行**进场**的唯一告知点(非锚定行一行 `read_deny_unanchored_rows`;判据与行形在 `read-deny-anchor-audit.ts`)。律:**一份读拒行的值第一次装进 Runner 席时点名一次** ——
|
|
326
|
+
* 三条入口都经这里:server 起服与 run-local 经 {@link createSharedRunnerDeps}(server 的主 / 子 Runner 各展开一次共享基座、同一份 config ⇒ 只说一次),中心热换在换席成功之后
|
|
327
|
+
* (`boot/web-admin.ts` `applyLiveReadFace`;换席抛 ⇒ config 回滚、不到这里)。值没变 ⇒ 不重复说(只改 face 的热换、同一 config 的第二只 Runner);值变了(热换 A → B → A)⇒ 每次都说。
|
|
328
|
+
* 喂的是 `config.readDenyPatterns`(运维 ∪ 中心 read-face 的行),不是座席族并入 LKG 派生行之后的那一份 —— 派生行是根锚。绝不抛(纯诊断面)。
|
|
329
|
+
*/
|
|
330
|
+
export declare function announceReadDenyRows(config: Pick<ServiceConfig, "readDenyPatterns">, logger: Pick<Logger, "warn">): void;
|
|
320
331
|
export declare function createSharedRunnerDeps(ctx: SharedRunnerDepsCtx): SharedRunnerDeps;
|
|
321
332
|
export declare function createRunnerDeps(ctx: RunnerDepsCtx): RunnerDeps;
|
|
322
333
|
//# sourceMappingURL=runner-deps.d.ts.map
|
package/dist/boot/runner-deps.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createFileWorkflowScriptStore } from "@sema-agent/core";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { lkgReadDenyRows } from "../config-lkg.js";
|
|
4
|
+
import { auditReadDenyAnchoring } from "./read-deny-anchor-audit.js";
|
|
4
5
|
import { fleetBackgroundChildPublisher, FleetEventBus } from "../fleet/fleet-bus.js";
|
|
5
6
|
import { createMemoryEngineIncidentSink } from "../memory-incident-sink.js";
|
|
6
7
|
import { assertAutoConsolidationWirable } from "./memory-consolidation.js";
|
|
@@ -24,6 +25,8 @@ export function createRunnerDepsOnAsk(toolApproval) {
|
|
|
24
25
|
return (req, signal) => toolApproval.ask(req, signal);
|
|
25
26
|
}
|
|
26
27
|
export const CONFIG_ADVISORY_CLASSIFICATIONS = new Set([
|
|
28
|
+
"file-history-no-env",
|
|
29
|
+
"file-history-no-store",
|
|
27
30
|
"interaction-posture-refused",
|
|
28
31
|
"memory-tools-not-mounted",
|
|
29
32
|
"sandbox-admission-unavailable",
|
|
@@ -76,7 +79,16 @@ export function buildDeploymentPostureSeats(config) {
|
|
|
76
79
|
};
|
|
77
80
|
return seats;
|
|
78
81
|
}
|
|
82
|
+
const announcedReadDenyRows = new WeakMap();
|
|
83
|
+
export function announceReadDenyRows(config, logger) {
|
|
84
|
+
const key = JSON.stringify(config.readDenyPatterns ?? null);
|
|
85
|
+
if (announcedReadDenyRows.get(config) === key)
|
|
86
|
+
return;
|
|
87
|
+
announcedReadDenyRows.set(config, key);
|
|
88
|
+
auditReadDenyAnchoring({ rows: config.readDenyPatterns, logger });
|
|
89
|
+
}
|
|
79
90
|
export function createSharedRunnerDeps(ctx) {
|
|
91
|
+
announceReadDenyRows(ctx.config, ctx.logger);
|
|
80
92
|
const shared = {
|
|
81
93
|
brain: ctx.brain,
|
|
82
94
|
onNotice: createEngineNoticeForwarder(ctx.logger, defaultEngineNoticeRouter, ctx.metrics),
|
|
@@ -92,7 +104,7 @@ export function createSharedRunnerDeps(ctx) {
|
|
|
92
104
|
backgroundAgentStore: ctx.backgroundAgentStore ? ctx.backgroundAgentStore : undefined,
|
|
93
105
|
mailboxStore: ctx.mailboxStore ? ctx.mailboxStore : undefined,
|
|
94
106
|
rosterStore: ctx.rosterStore ? ctx.rosterStore : undefined,
|
|
95
|
-
|
|
107
|
+
mods: ctx.deploymentMods,
|
|
96
108
|
hands: ctx.hands,
|
|
97
109
|
toolResultStore: ctx.toolResultStore,
|
|
98
110
|
checkpointStore: ctx.checkpointStore ? ctx.checkpointStore : undefined,
|
|
@@ -226,7 +238,7 @@ export function createRunnerDeps(ctx) {
|
|
|
226
238
|
return;
|
|
227
239
|
}
|
|
228
240
|
if (ctx.phase === "prompt-constitution") {
|
|
229
|
-
logger.warn("
|
|
241
|
+
logger.warn("prompt_composition_warning", { sessionId: ctx.sessionId, info: String(err) });
|
|
230
242
|
return;
|
|
231
243
|
}
|
|
232
244
|
if (ctx.phase === "rewind") {
|
|
@@ -79,13 +79,7 @@ export declare function createSessionFaces(ctx: SessionFacesCtx): {
|
|
|
79
79
|
modelId: string;
|
|
80
80
|
} | null;
|
|
81
81
|
messages: unknown[];
|
|
82
|
-
promptEpoch?:
|
|
83
|
-
epoch: number;
|
|
84
|
-
artifactDigest: string;
|
|
85
|
-
packId: string;
|
|
86
|
-
assemblyApi: number;
|
|
87
|
-
activatedBy: "session_start" | "compaction" | "legacy_migration";
|
|
88
|
-
};
|
|
82
|
+
promptEpoch?: import("@sema-agent/core").StoredPromptEpoch;
|
|
89
83
|
} | undefined>) | undefined;
|
|
90
84
|
sessionWatchRegistry: SessionWatchRegistry | undefined;
|
|
91
85
|
purgeSession: ((sessionId: string, owner: string | null) => Promise<{
|
|
@@ -19,7 +19,7 @@ export declare function runStage03(ctx: Awaited<ReturnType<typeof runStage02>>):
|
|
|
19
19
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
20
20
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
21
21
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
22
|
-
|
|
22
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
23
23
|
storePosture: import("../store-posture.js").StorePosture;
|
|
24
24
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
25
25
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
@@ -2,10 +2,10 @@ import { uuidv7 } from "@sema-agent/core";
|
|
|
2
2
|
import { openStores } from "./stores.js";
|
|
3
3
|
export async function runStage03(ctx) {
|
|
4
4
|
const { config, localRoot, logger, metrics } = ctx;
|
|
5
|
-
const { backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, taskAttachmentStore, mailboxStore, mailboxRecipientLifecycle, memoryExportBackend, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane,
|
|
5
|
+
const { backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, taskAttachmentStore, mailboxStore, mailboxRecipientLifecycle, memoryExportBackend, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane, sqlEngine, } = await openStores({ config, logger, metrics, localRoot });
|
|
6
6
|
const instanceId = uuidv7();
|
|
7
7
|
const sessionCaptureRecords = backend?.sessionCaptureRecords();
|
|
8
8
|
const sessionCaptureRecordStore = sessionCaptureRecords?.();
|
|
9
|
-
return { ...ctx, backend, backgroundAgentStore, breakerState, engineDataRoot, instanceId, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memoryExportBackend, memoryPosture, memorySyncCursors, memorySyncRunner, rosterStore, sessionCaptureRecordStore, sessionCaptureRecords, sessionStore,
|
|
9
|
+
return { ...ctx, backend, backgroundAgentStore, breakerState, engineDataRoot, instanceId, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memoryExportBackend, memoryPosture, memorySyncCursors, memorySyncRunner, rosterStore, sessionCaptureRecordStore, sessionCaptureRecords, sessionStore, sqlEngine, storePosture, taskAttachmentStore, taskListLane, usageWindowStore };
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=stage-03-store-backend.js.map
|
|
@@ -60,7 +60,7 @@ export declare function runStage04(ctx: Awaited<ReturnType<typeof runStage03>>):
|
|
|
60
60
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
61
61
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
62
62
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
63
|
-
|
|
63
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
64
64
|
storePosture: import("../store-posture.js").StorePosture;
|
|
65
65
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
66
66
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { runStage04 } from "./stage-04-stores.js";
|
|
2
|
-
export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>): {
|
|
3
|
-
|
|
2
|
+
export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>): Promise<{
|
|
3
|
+
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
4
4
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
5
5
|
dropSessionScoped: (sid: string) => void;
|
|
6
6
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
@@ -75,7 +75,7 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
|
|
|
75
75
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
76
76
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
77
77
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
78
|
-
|
|
78
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
79
79
|
storePosture: import("../store-posture.js").StorePosture;
|
|
80
80
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
81
81
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
@@ -86,5 +86,5 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
|
|
|
86
86
|
localRoot: string;
|
|
87
87
|
logger: import("../index.js").Logger;
|
|
88
88
|
metrics: import("../index.js").Metrics;
|
|
89
|
-
}
|
|
89
|
+
}>;
|
|
90
90
|
//# sourceMappingURL=stage-05-execution-env.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { assertDeploymentModsAdmitted, createDeploymentMods } from "./deployment-mods.js";
|
|
2
|
+
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
3
3
|
import { assertDeviceLaneWired, createDeviceLane } from "./device-lane.js";
|
|
4
4
|
import { assertWorkspaceSpaceReadable, createExecutionEnv } from "./execution-env.js";
|
|
5
5
|
import { incarnationReadOf } from "../session-incarnation.js";
|
|
6
6
|
import * as facts from "../capability-facts.js";
|
|
7
7
|
import { sessionStoreLabelOf } from "../store-posture.js";
|
|
8
8
|
import { runStore } from "./late-binds.js";
|
|
9
|
-
export function runStage05(ctx) {
|
|
9
|
+
export async function runStage05(ctx) {
|
|
10
10
|
const { backend, config, instanceId, logger, metrics, sessionStore, taskAttachmentStore } = ctx;
|
|
11
11
|
const deviceLane = config.remoteExec?.provider === "device" ? createDeviceLane({ config, logger, metrics, backend, replicaId: instanceId }) : undefined;
|
|
12
12
|
const incarnationOf = incarnationReadOf(sessionStore);
|
|
@@ -14,13 +14,10 @@ export function runStage05(ctx) {
|
|
|
14
14
|
const { perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv, fenceSessionOwner, dropSessionScoped, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}), ...(spaceCommits !== undefined ? { spaceCommits } : {}), ...(incarnationOf !== undefined ? { incarnationOf } : {}) });
|
|
15
15
|
assertDeviceLaneWired(config.remoteExec?.provider === "device", deviceLane, executionEnvFactory !== undefined);
|
|
16
16
|
assertWorkspaceSpaceReadable(facts.workspaceSpace(config), { incarnationOf, spaceCommits }, facts.workspaceCache(config), sessionStoreLabelOf(config.sessionBackend, backend?.kind));
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
17
|
+
const deploymentMods = createDeploymentMods({ metrics, ...(config.toolTrace ? { traceLogger: logger } : {}), brandIdentity: isBrandedDeployment(config) });
|
|
18
|
+
if (config.toolTrace)
|
|
19
19
|
logger.info("tool_trace_enabled", {});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...(config.hooksTimeoutMs !== undefined ? { timeoutMs: config.hooksTimeoutMs } : {}),
|
|
23
|
-
};
|
|
24
|
-
return { ...ctx, deploymentHooks, deviceLane, dropSessionScoped, executionEnvFactory, fenceSessionOwner, lspManager, spaceReclaimer, perSessionCwd, perTaskImage, sendUserFileTaskEnvs, sessionEnvSelection, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, worktreeReap };
|
|
20
|
+
await assertDeploymentModsAdmitted(deploymentMods);
|
|
21
|
+
return { ...ctx, deploymentMods, deviceLane, dropSessionScoped, executionEnvFactory, fenceSessionOwner, lspManager, spaceReclaimer, perSessionCwd, perTaskImage, sendUserFileTaskEnvs, sessionEnvSelection, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, worktreeReap };
|
|
25
22
|
}
|
|
26
23
|
//# sourceMappingURL=stage-05-execution-env.js.map
|
|
@@ -60,7 +60,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
60
60
|
};
|
|
61
61
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
62
62
|
workflowsCapable: boolean;
|
|
63
|
-
|
|
63
|
+
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
64
64
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
65
65
|
dropSessionScoped: (sid: string) => void;
|
|
66
66
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
@@ -135,7 +135,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
135
135
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
136
136
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
137
137
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
138
|
-
|
|
138
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
139
139
|
storePosture: import("../store-posture.js").StorePosture;
|
|
140
140
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
141
141
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
@@ -4,6 +4,7 @@ import { createSessionTitler } from "../session-titler.js";
|
|
|
4
4
|
import { cardRuleScopeRoot } from "../task-cwd.js";
|
|
5
5
|
import { ForkRoutingSessionStore } from "../plugins/fork-routing-session-store.js";
|
|
6
6
|
import { withoutHands } from "../capabilities/hands-lane.js";
|
|
7
|
+
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
7
8
|
import { redactSecrets } from "../trace/redact.js";
|
|
8
9
|
import { hasServiceAuth } from "../http/server.js";
|
|
9
10
|
import { workflowModelAllowlistFor } from "../task-workflow.js";
|
|
@@ -23,7 +24,7 @@ import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-author
|
|
|
23
24
|
import { parkedAskRedeem, runStore } from "./late-binds.js";
|
|
24
25
|
import { withInternalRunEnvs } from "../internal-run-env.js";
|
|
25
26
|
export function runStage06(ctx) {
|
|
26
|
-
const { backend, backgroundAgentStore, brain, engineDataRoot, config, webAdmin, consolidationValve,
|
|
27
|
+
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;
|
|
27
28
|
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
|
|
28
29
|
const parkCommitted = backend?.checkpoint && config.durableApproval ? createParkCommitWatch(backend.checkpoint(logger)) : undefined;
|
|
29
30
|
const checkpointStore = parkCommitted?.store;
|
|
@@ -45,7 +46,7 @@ export function runStage06(ctx) {
|
|
|
45
46
|
if (sharedMemoryStore)
|
|
46
47
|
logger.info("shared_memory_stores_enabled", { backend: backend?.kind });
|
|
47
48
|
const runnerOffloadStore = toolResultStore ?? new InMemoryToolResultStore({ maxTotalChars: 64_000_000 });
|
|
48
|
-
const commitHands = config
|
|
49
|
+
const commitHands = isBrandedDeployment(config) ? { commitCoAuthor: "Sema <noreply@vivi-ai.com>" } : undefined;
|
|
49
50
|
const retentionExecutor = backend?.retention?.({ taskAttachmentTable: taskAttachmentStore !== undefined, taskListTables: taskListLane.backend !== "memory", logger });
|
|
50
51
|
const retentionLaneStore = backend?.retentionLane?.();
|
|
51
52
|
assertRetentionLaneWirable({
|
|
@@ -120,7 +121,7 @@ export function runStage06(ctx) {
|
|
|
120
121
|
sessionCaptureRecords,
|
|
121
122
|
memorySyncRunner, toolResultStore: runnerOffloadStore, checkpointStore, sessionPolicyStore, runtimeCapsResolver, fileHistoryStore,
|
|
122
123
|
permissionRuleStore: permissionRuleProvider,
|
|
123
|
-
executionEnvFactory, lspManager, fleetBus,
|
|
124
|
+
executionEnvFactory, lspManager, fleetBus, deploymentMods, workflowRunStore, workflowJournalStore,
|
|
124
125
|
workflowAgentRegistry, workflowNotifyGate, workflowCompletionInbox, deliverWorkflowCompletion, orgMemoryAdmission,
|
|
125
126
|
governanceSeams,
|
|
126
127
|
sharedMemoryStores: sharedMemoryStore ? sharedMemoryStore : undefined,
|
|
@@ -192,7 +193,7 @@ export function runStage06(ctx) {
|
|
|
192
193
|
backgroundAgentStore,
|
|
193
194
|
mailboxStore,
|
|
194
195
|
rosterStore,
|
|
195
|
-
|
|
196
|
+
deploymentMods,
|
|
196
197
|
toolResultStore: runnerOffloadStore,
|
|
197
198
|
checkpointStore,
|
|
198
199
|
sessionPolicyStore,
|
|
@@ -75,7 +75,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
75
75
|
};
|
|
76
76
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
77
77
|
workflowsCapable: boolean;
|
|
78
|
-
|
|
78
|
+
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
79
79
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
80
80
|
dropSessionScoped: (sid: string) => void;
|
|
81
81
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
@@ -150,7 +150,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
150
150
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
151
151
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
152
152
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
153
|
-
|
|
153
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
154
154
|
storePosture: import("../store-posture.js").StorePosture;
|
|
155
155
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
156
156
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
@@ -11,6 +11,7 @@ import { executionLaneOf } from "../execution-lane-caps.js";
|
|
|
11
11
|
import { loadDeploymentSkills } from "../capabilities/skills.js";
|
|
12
12
|
import { createRepoClient } from "../capabilities/repo-tools.js";
|
|
13
13
|
import { buildScenarios, builtinScenarioDetails, danglingScenarioRefusal } from "../capabilities/scenarios.js";
|
|
14
|
+
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
14
15
|
import { RateLimiter } from "../observability/rate-limit.js";
|
|
15
16
|
import { explicitOperatorOk } from "../http/server.js";
|
|
16
17
|
import { selfOrchestrationDenial } from "../task-workflow.js";
|
|
@@ -133,7 +134,7 @@ export async function runStage07(ctx) {
|
|
|
133
134
|
? backend.rateLimiter(config.rateLimitPerMin, counterDegradeHook).startRefresh()
|
|
134
135
|
: new RateLimiter(config.rateLimitPerMin);
|
|
135
136
|
bindRateLimiter(rateLimiter);
|
|
136
|
-
let skills = loadDeploymentSkills(config);
|
|
137
|
+
let skills = loadDeploymentSkills(config, logger);
|
|
137
138
|
skills = await webAdmin.applyCenterCapabilities(skills);
|
|
138
139
|
const repoClient = config.gitApiBaseUrl ? createRepoClient(config.gitApiKind, config.gitApiBaseUrl, config.gitApiToken) : undefined;
|
|
139
140
|
const webSearchCfg = webSearchConfigFromEnv();
|
|
@@ -159,7 +160,6 @@ export async function runStage07(ctx) {
|
|
|
159
160
|
checkpointStore: checkpointStore ? checkpointStore : undefined,
|
|
160
161
|
ensureChildSessionDurable: ensureChildSessionDurable ? ensureChildSessionDurable : undefined,
|
|
161
162
|
taskListStoreFor: taskListLane.storeFor,
|
|
162
|
-
brandIdentity: config.configProvider === "local",
|
|
163
163
|
subagentExtraTools: sendUserFileToolSpec ? subagentSendUserFileExtraTools({ spec: sendUserFileToolSpec }) : undefined,
|
|
164
164
|
};
|
|
165
165
|
const scenarios = buildScenarios(scenarioDeps);
|
|
@@ -174,7 +174,7 @@ export async function runStage07(ctx) {
|
|
|
174
174
|
autoModeSeatMounted: runnerDeps.autoMode !== undefined,
|
|
175
175
|
})
|
|
176
176
|
: undefined;
|
|
177
|
-
const scenarioDetails = builtinScenarioDetails(scenarios, scenarioDeps);
|
|
177
|
+
const scenarioDetails = builtinScenarioDetails(scenarios, scenarioDeps, isBrandedDeployment(config));
|
|
178
178
|
const builtinScenarioNames = Object.keys(scenarioDetails);
|
|
179
179
|
webAdmin.applyCenterScenarios({ scenarioDeps, scenarios, scenarioDetails, builtinScenarioNames });
|
|
180
180
|
const defaultScenarioRefusal = danglingScenarioRefusal(config.defaultScenario, "deployment", Object.keys(scenarios));
|
|
@@ -88,7 +88,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
88
88
|
};
|
|
89
89
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
90
90
|
workflowsCapable: boolean;
|
|
91
|
-
|
|
91
|
+
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
92
92
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
93
93
|
dropSessionScoped: (sid: string) => void;
|
|
94
94
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
@@ -163,7 +163,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
163
163
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
164
164
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
165
165
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
166
|
-
|
|
166
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
167
167
|
storePosture: import("../store-posture.js").StorePosture;
|
|
168
168
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
169
169
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
@@ -28,13 +28,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
28
28
|
modelId: string;
|
|
29
29
|
} | null;
|
|
30
30
|
messages: unknown[];
|
|
31
|
-
promptEpoch?:
|
|
32
|
-
epoch: number;
|
|
33
|
-
artifactDigest: string;
|
|
34
|
-
packId: string;
|
|
35
|
-
assemblyApi: number;
|
|
36
|
-
activatedBy: "session_start" | "compaction" | "legacy_migration";
|
|
37
|
-
};
|
|
31
|
+
promptEpoch?: import("@sema-agent/core").StoredPromptEpoch;
|
|
38
32
|
} | undefined>) | undefined;
|
|
39
33
|
sessionWatchRegistry: import("../session-watch.js").SessionWatchRegistry | undefined;
|
|
40
34
|
staticWiring: import("@sema-agent/core").WiringManifest;
|
|
@@ -117,7 +111,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
117
111
|
};
|
|
118
112
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
119
113
|
workflowsCapable: boolean;
|
|
120
|
-
|
|
114
|
+
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
121
115
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
122
116
|
dropSessionScoped: (sid: string) => void;
|
|
123
117
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
@@ -192,7 +186,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
192
186
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
193
187
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
194
188
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
195
|
-
|
|
189
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
196
190
|
storePosture: import("../store-posture.js").StorePosture;
|
|
197
191
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
198
192
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
@@ -27,13 +27,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
27
27
|
modelId: string;
|
|
28
28
|
} | null;
|
|
29
29
|
messages: unknown[];
|
|
30
|
-
promptEpoch?:
|
|
31
|
-
epoch: number;
|
|
32
|
-
artifactDigest: string;
|
|
33
|
-
packId: string;
|
|
34
|
-
assemblyApi: number;
|
|
35
|
-
activatedBy: "session_start" | "compaction" | "legacy_migration";
|
|
36
|
-
};
|
|
30
|
+
promptEpoch?: import("@sema-agent/core").StoredPromptEpoch;
|
|
37
31
|
} | undefined>) | undefined;
|
|
38
32
|
sessionWatchRegistry: import("../session-watch.js").SessionWatchRegistry | undefined;
|
|
39
33
|
staticWiring: import("@sema-agent/core").WiringManifest;
|
|
@@ -116,7 +110,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
116
110
|
};
|
|
117
111
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
118
112
|
workflowsCapable: boolean;
|
|
119
|
-
|
|
113
|
+
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
120
114
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
121
115
|
dropSessionScoped: (sid: string) => void;
|
|
122
116
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
@@ -191,7 +185,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
191
185
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
192
186
|
sessionCaptureRecords: import("../plugins/store-backend.js").SessionCaptureRecordSource | undefined;
|
|
193
187
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
194
|
-
|
|
188
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
195
189
|
storePosture: import("../store-posture.js").StorePosture;
|
|
196
190
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
197
191
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
@@ -9,7 +9,7 @@ import { createHttpServer } from "../http/server.js";
|
|
|
9
9
|
import { exportMemoryScope } from "../memory-export.js";
|
|
10
10
|
import { performMemorySync } from "../memory-sync.js";
|
|
11
11
|
import { backgroundAgentOutput, taskHandleOutput, taskHandleStop } from "../runs.js";
|
|
12
|
-
import {
|
|
12
|
+
import { sqlBlobCapOf } from "../plugins/blob-backend.js";
|
|
13
13
|
import { createStoreLiveProbe } from "../store-live-probe.js";
|
|
14
14
|
import { counterStoreLabel } from "../plugins/store-backend.js";
|
|
15
15
|
import { sessionStoreLabelOf } from "../store-posture.js";
|
|
@@ -30,7 +30,7 @@ import { bindServerLateSeats } from "./late-binds.js";
|
|
|
30
30
|
import { serviceVersion } from "../service-version.js";
|
|
31
31
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
32
32
|
export async function runStage10(ctx) {
|
|
33
|
-
const { approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, parkCommits, config, webAdmin, consolidationValve, costQuota,
|
|
33
|
+
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, 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, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable } = ctx;
|
|
34
34
|
const stores = {
|
|
35
35
|
runStore,
|
|
36
36
|
resumeAnchorStore: resumeAnchorStore ? resumeAnchorStore : undefined,
|
|
@@ -162,7 +162,7 @@ export async function runStage10(ctx) {
|
|
|
162
162
|
workflowModelAllowlist: workflowModelAllowlistSnapshot,
|
|
163
163
|
staticWiring,
|
|
164
164
|
memoryPosture,
|
|
165
|
-
|
|
165
|
+
sqlEngine,
|
|
166
166
|
writeProtection: buildWriteProtectionPosture(config),
|
|
167
167
|
webSearchProvider,
|
|
168
168
|
sealedKeyPublic: webAdmin.sealedKeyPublic,
|
|
@@ -191,19 +191,18 @@ export async function runStage10(ctx) {
|
|
|
191
191
|
storeLiveState: storeLiveProbe ? () => storeLiveProbe.state() : undefined,
|
|
192
192
|
};
|
|
193
193
|
const knobs = {
|
|
194
|
-
|
|
195
|
-
? (
|
|
194
|
+
snapshotBlobSqlCap: sqlEngine !== undefined && !config.snapshotBlobStore
|
|
195
|
+
? () => sqlBlobCapOf(config.snapshotBlobSqlMaxBytes, sqlEngine)
|
|
196
196
|
: undefined,
|
|
197
197
|
sessionEventsMaxConnections: sessionWatchRegistry ? posIntEnv(process.env.SESSION_EVENTS_MAX_CONNS, 256, 100_000) : undefined,
|
|
198
198
|
};
|
|
199
199
|
const resolveSpec = createResolveSpec({
|
|
200
200
|
config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver,
|
|
201
|
-
getCenterPrompts: () => webAdmin.getCenterPrompts(),
|
|
202
201
|
getKeyResolver: () => webAdmin.getKeyResolver(),
|
|
203
202
|
taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner,
|
|
204
203
|
hookLlm, hookAgent, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec,
|
|
205
204
|
selectEnvTool, sendUserFileToolSpec, memoryEngine, durableEnabled, approvalExemptionStore,
|
|
206
|
-
checkpointStore,
|
|
205
|
+
checkpointStore, imageIndex, perTaskImage,
|
|
207
206
|
sessionEnvSelection,
|
|
208
207
|
lockedKeys: governanceSeams.lockedKeys,
|
|
209
208
|
liveQuestionFace: question,
|
package/dist/boot/stores.d.ts
CHANGED
|
@@ -34,6 +34,6 @@ export declare function openStores(ctx: OpenStoresCtx): Promise<{
|
|
|
34
34
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
35
35
|
memoryPosture: import("../memory-posture.js").MemoryPosture;
|
|
36
36
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
37
|
-
|
|
37
|
+
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
38
38
|
}>;
|
|
39
39
|
//# sourceMappingURL=stores.d.ts.map
|
package/dist/boot/stores.js
CHANGED
|
@@ -37,7 +37,7 @@ import { assertFileHistorySchema } from "../plugins/file-history-store-sql.js";
|
|
|
37
37
|
import { resolveStreamApprovalGate } from "../tool-approval.js";
|
|
38
38
|
import { buildMemoryBoundaryLaneFacts, buildMemoryWriteBoundaryAudit, effectiveMemoryPersistenceCapable } from "./memory-boundary.js";
|
|
39
39
|
import { buildMemoryPosture } from "../memory-posture.js";
|
|
40
|
-
import { establishSqlEnginePosture } from "../sql-engine-posture.js";
|
|
40
|
+
import { establishSqlEnginePosture, sqlPoolsOf } from "../sql-engine-posture.js";
|
|
41
41
|
import { buildStorePosture } from "../store-posture.js";
|
|
42
42
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
43
43
|
const DARK_REASON_PROSE = {
|
|
@@ -393,11 +393,10 @@ export async function openStores(ctx) {
|
|
|
393
393
|
await ensureTiDBTaskListSchema(mysqlPool);
|
|
394
394
|
return createTaskListLane({ mysqlPool, pgPool, logger });
|
|
395
395
|
})();
|
|
396
|
-
let
|
|
396
|
+
let sqlEngine;
|
|
397
397
|
{
|
|
398
|
-
const mysqlPool = backend
|
|
399
|
-
|
|
400
|
-
sqlEngineFacts = await establishSqlEnginePosture({ mysqlPool, pgPool });
|
|
398
|
+
const { mysqlPool, pgPool } = sqlPoolsOf(backend);
|
|
399
|
+
sqlEngine = await establishSqlEnginePosture({ mysqlPool, pgPool });
|
|
401
400
|
if (pgPool)
|
|
402
401
|
await ensurePgDeviceSchema(async (text, params) => pgPool.query(text, params));
|
|
403
402
|
if (mysqlPool)
|
|
@@ -450,7 +449,7 @@ export async function openStores(ctx) {
|
|
|
450
449
|
return {
|
|
451
450
|
backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, mailboxRecipientLifecycle,
|
|
452
451
|
taskAttachmentStore, mailboxStore, memoryExportBackend, memorySyncRunner, sessionStore, breakerState,
|
|
453
|
-
usageWindowStore, memoryPosture, taskListLane,
|
|
452
|
+
usageWindowStore, memoryPosture, taskListLane, sqlEngine,
|
|
454
453
|
};
|
|
455
454
|
}
|
|
456
455
|
//# sourceMappingURL=stores.js.map
|
package/dist/boot/web-admin.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ModelRefusalsSignal } from "@sema-agent/settings-schema";
|
|
2
2
|
import { CenterPromptSource, type SwappableDeps } from "@sema-agent/core";
|
|
3
3
|
import { buildPricing } from "../budget.js";
|
|
4
|
-
import { type PromptsDomainFaces } from "../prompts-domain-validate.js";
|
|
5
4
|
import { type Scenario, type ScenarioDeps, type ScenarioDetail } from "../capabilities/scenarios.js";
|
|
6
5
|
import type { LoadedSkill } from "../capabilities/skills.js";
|
|
7
6
|
import { type ServiceConfig } from "../config.js";
|
|
@@ -96,8 +95,6 @@ export interface WebAdminRuntime {
|
|
|
96
95
|
getKeyResolver(): ((model: ModelKeyRef) => Promise<{
|
|
97
96
|
apiKey: string;
|
|
98
97
|
} | undefined>) | undefined;
|
|
99
|
-
/** 晚绑取值:center 提示词面(热采用,新任务边界生效)。 */
|
|
100
|
-
getCenterPrompts(): PromptsDomainFaces | undefined;
|
|
101
98
|
/** boot ready 门:布防(`CONFIG_REQUIRE_ROSTER=true`,远程 registry 非 dryRun)且 roster 未落地 =
|
|
102
99
|
* 计费提交 503 + /health ready:false。缺省未布防 ⇒ 恒 true。 */
|
|
103
100
|
modelReady(): boolean;
|