@sema-agent/server 7.123.0 → 7.124.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 +132 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/USAGE.md +53 -51
- package/dist/approval-ask-audit-store.d.ts +27 -32
- package/dist/approval-ask-audit-store.js +10 -9
- package/dist/approval-crash-convergence.d.ts +2 -2
- package/dist/approval-crash-convergence.js +5 -5
- package/dist/approval-deny-reasons.d.ts +163 -51
- package/dist/approval-deny-reasons.js +79 -8
- package/dist/approval-policy-settlement.d.ts +4 -1
- package/dist/approval-policy-settlement.js +3 -2
- package/dist/approval-reconciler.d.ts +3 -3
- package/dist/approval-reconciler.js +10 -10
- package/dist/approval.d.ts +1 -1
- package/dist/approval.js +1 -1
- package/dist/audit.js +1 -1
- package/dist/auth-bridge.d.ts +8 -8
- package/dist/auth-bridge.js +6 -6
- package/dist/auth-keys.d.ts +2 -2
- package/dist/auto-mode-face.d.ts +1 -1
- package/dist/boot/budget-tracing.js +1 -1
- package/dist/boot/execution-env.js +1 -0
- package/dist/boot/leader.d.ts +1 -1
- package/dist/boot/memory-consolidation.d.ts +4 -4
- package/dist/boot/org-memory.d.ts +3 -3
- package/dist/boot/org-memory.js +5 -5
- package/dist/boot/resolve-spec.js +7 -7
- package/dist/boot/runner-deps.d.ts +1 -1
- package/dist/boot/runtime-caps.d.ts +1 -1
- package/dist/boot/runtime-caps.js +10 -10
- package/dist/boot/shutdown.d.ts +2 -2
- package/dist/boot/shutdown.js +2 -2
- package/dist/boot/side-query-lane.d.ts +3 -3
- package/dist/boot/{stage-02-registry-pull.d.ts → stage-02-web-admin-pull.d.ts} +2 -2
- package/dist/boot/{stage-02-registry-pull.js → stage-02-web-admin-pull.js} +4 -4
- package/dist/boot/stage-03-store-backend.d.ts +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +1 -1
- package/dist/boot/stage-06-runners.d.ts +2 -2
- package/dist/boot/stage-06-runners.js +6 -6
- package/dist/boot/stage-07-capability-layer.d.ts +2 -2
- package/dist/boot/stage-07-capability-layer.js +6 -5
- package/dist/boot/stage-08-reapers.d.ts +3 -3
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +3 -3
- package/dist/boot/stage-09-leader.js +7 -7
- package/dist/boot/stage-10-http-server.d.ts +3 -3
- package/dist/boot/stage-10-http-server.js +19 -19
- package/dist/boot/unpriced-ceiling-verdict.d.ts +1 -1
- package/dist/boot/{config-center.d.ts → web-admin.d.ts} +11 -11
- package/dist/boot/{config-center.js → web-admin.js} +38 -22
- package/dist/boot/webfetch-summarize-lane.d.ts +2 -2
- package/dist/brain.d.ts +1 -1
- package/dist/brain.js +1 -1
- package/dist/budget.d.ts +3 -3
- package/dist/canonical-json.d.ts +2 -2
- package/dist/capabilities/center-plugins.d.ts +1 -1
- package/dist/capabilities/center-wiring.d.ts +12 -5
- package/dist/capabilities/center-wiring.js +11 -2
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/scenarios.js +2 -2
- package/dist/capabilities/team.d.ts +1 -1
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/center-credential-renewer.d.ts +1 -1
- package/dist/center-credential-renewer.js +7 -7
- package/dist/center-credential.d.ts +9 -9
- package/dist/center-credential.js +6 -6
- package/dist/config-catalog.d.ts +7 -10
- package/dist/config-catalog.js +15 -15
- package/dist/config-d-migration.d.ts +32 -0
- package/dist/config-d-migration.js +59 -0
- package/dist/config-invariants.d.ts +14 -4
- package/dist/config-invariants.js +31 -2
- package/dist/config-lkg.d.ts +26 -6
- package/dist/config-lkg.js +43 -14
- package/dist/config-provider.d.ts +23 -19
- package/dist/config-provider.js +24 -26
- package/dist/config-types.d.ts +52 -51
- package/dist/config.d.ts +9 -46
- package/dist/config.js +33 -92
- package/dist/execution-lane-caps.d.ts +1 -1
- package/dist/fleet/drain-entry.d.ts +1 -1
- package/dist/fleet/engine-signal.d.ts +8 -8
- package/dist/fleet/fleet-bus.d.ts +12 -3
- package/dist/fleet/fleet-bus.js +13 -9
- package/dist/fleet/serving-lease.d.ts +3 -3
- package/dist/fleet/serving-lease.js +1 -1
- package/dist/fleet-client.d.ts +7 -7
- package/dist/fleet-client.js +5 -4
- package/dist/fleet-lease.d.ts +3 -3
- package/dist/fleet-lease.js +2 -2
- package/dist/host-lsp-manager.d.ts +1 -1
- package/dist/hosted-posture.d.ts +4 -4
- package/dist/http/admission.js +4 -4
- package/dist/http/checkpoint-ctx.d.ts +20 -3
- package/dist/http/checkpoint-ctx.js +13 -5
- package/dist/http/dispatch.js +2 -2
- package/dist/http/durable-run-leg.js +2 -1
- package/dist/http/health-self-report.d.ts +4 -4
- package/dist/http/health-self-report.js +3 -3
- package/dist/http/idempotency.d.ts +1 -1
- package/dist/http/resume-legs.d.ts +4 -3
- package/dist/http/resume-legs.js +31 -18
- package/dist/http/route-ctx.d.ts +8 -0
- package/dist/http/routes/admin-config-refresh.d.ts +1 -1
- package/dist/http/routes/admin-config-refresh.js +1 -1
- package/dist/http/routes/admin-drain.d.ts +1 -1
- package/dist/http/routes/admin-drain.js +5 -4
- package/dist/http/routes/approvals-assistant.js +4 -4
- package/dist/http/routes/capabilities.js +5 -5
- package/dist/http/routes/config-catalog.js +2 -3
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/runs.js +8 -4
- package/dist/http/routes/sessions-list.js +2 -1
- package/dist/http/routes/sessions.js +1 -1
- package/dist/http/routes/side-query.js +3 -3
- package/dist/http/routes/tasks.js +3 -2
- package/dist/http/run-meta.d.ts +1 -1
- package/dist/http/run-meta.js +2 -2
- package/dist/http/server.d.ts +7 -7
- package/dist/http/server.js +1 -1
- package/dist/http/stored-body-replay.js +3 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/key-resolver.d.ts +1 -1
- package/dist/leader/wire.d.ts +2 -2
- package/dist/leader/wire.js +2 -1
- package/dist/main.js +1 -1
- package/dist/mcp-tool-faces.d.ts +2 -2
- package/dist/model-entry-refusal.d.ts +3 -3
- package/dist/model-entry-refusal.js +4 -4
- package/dist/model-provider.d.ts +2 -2
- package/dist/model-route-endpoint.d.ts +1 -1
- package/dist/model-route-url.d.ts +1 -1
- package/dist/model-route-url.js +2 -1
- package/dist/model-select.d.ts +24 -21
- package/dist/model-select.js +22 -17
- package/dist/observability/metrics.d.ts +1 -1
- package/dist/org-memory-admission.d.ts +1 -1
- package/dist/plugins/approval-ask-store-file.d.ts +4 -2
- package/dist/plugins/approval-ask-store-file.js +3 -3
- package/dist/plugins/approval-ask-store-memory.d.ts +4 -3
- package/dist/plugins/approval-ask-store-memory.js +10 -4
- package/dist/plugins/approval-ask-store-sql.d.ts +16 -2
- package/dist/plugins/approval-ask-store-sql.js +20 -13
- package/dist/plugins/caching-session-store.d.ts +0 -10
- package/dist/plugins/caching-session-store.js +0 -3
- package/dist/plugins/file-run-store.js +9 -3
- package/dist/plugins/leader-run-store-sql.d.ts +3 -2
- package/dist/plugins/leader-run-store-sql.js +3 -2
- package/dist/plugins/local-session-store.d.ts +20 -27
- package/dist/plugins/local-session-store.js +19 -17
- package/dist/plugins/memory-run-store.js +9 -3
- package/dist/plugins/one-time-migrations.js +26 -2
- package/dist/plugins/scheduler-support.d.ts +26 -7
- package/dist/plugins/scheduler-support.js +96 -53
- package/dist/plugins/store-backend.js +1 -1
- package/dist/plugins/store-contracts.d.ts +20 -4
- package/dist/plugins/web-search.d.ts +1 -1
- package/dist/plugins/web-search.js +2 -1
- package/dist/posture-source.d.ts +1 -1
- package/dist/read-face-posture.d.ts +3 -3
- package/dist/read-face-posture.js +1 -1
- package/dist/run-local.js +6 -3
- package/dist/runtime-caps-resolver.d.ts +4 -4
- package/dist/runtime-caps-resolver.js +2 -2
- package/dist/runtime-governance.d.ts +5 -5
- package/dist/sealed-key.d.ts +4 -4
- package/dist/sealed-key.js +3 -2
- package/dist/security.d.ts +3 -3
- package/dist/service-version.d.ts +1 -1
- package/dist/service-version.js +5 -0
- package/dist/session-titler.d.ts +0 -11
- package/dist/session-titler.js +3 -5
- package/dist/shared-memory-scope-authorizer.d.ts +4 -4
- package/dist/task-a2a.d.ts +1 -1
- package/dist/tool-approval.d.ts +43 -4
- package/dist/tool-approval.js +147 -98
- package/dist/trace/core-keyset-guard.d.ts +1 -1
- package/dist/trace/project.d.ts +3 -3
- package/dist/trace/redact.d.ts +2 -23
- package/dist/trace/redact.js +1 -6
- package/dist/trace/self-minted-wire.d.ts +147 -3
- package/dist/trace/self-minted-wire.js +50 -9
- package/dist/url-refusal.d.ts +35 -0
- package/dist/url-refusal.js +15 -0
- package/dist/user-authored-text.d.ts +31 -0
- package/dist/user-authored-text.js +18 -0
- package/dist/{config-center → web-admin-client}/apply-effective.d.ts +13 -70
- package/dist/{config-center → web-admin-client}/apply-effective.js +100 -119
- package/dist/{config-center → web-admin-client}/apply-ledger.d.ts +2 -2
- package/dist/{config-center → web-admin-client}/center-request.d.ts +7 -7
- package/dist/{config-center → web-admin-client}/center-request.js +5 -4
- package/dist/{config-center → web-admin-client}/effective-keys.d.ts +1 -3
- package/dist/{config-center → web-admin-client}/effective-keys.js +0 -9
- package/dist/{config-center → web-admin-client}/facade.d.ts +6 -6
- package/dist/{config-center → web-admin-client}/facade.js +2 -2
- package/dist/{config-center → web-admin-client}/http-client.d.ts +6 -10
- package/dist/{config-center → web-admin-client}/http-client.js +12 -12
- package/dist/{config-center → web-admin-client}/pull-state.d.ts +1 -1
- package/dist/{config-center → web-admin-client}/read-face.js +4 -4
- package/dist/{config-center → web-admin-client}/read-warnings.d.ts +23 -16
- package/dist/{config-center → web-admin-client}/read-warnings.js +33 -23
- package/dist/{config-center → web-admin-client}/restart-signal.d.ts +5 -3
- package/dist/{config-center → web-admin-client}/restart-signal.js +3 -4
- package/dist/{config-center → web-admin-client}/skills-mcp.d.ts +1 -1
- package/dist/{config-center → web-admin-client}/skills-mcp.js +13 -13
- package/dist/{config-center → web-admin-client}/stage-limits.d.ts +1 -7
- package/dist/{config-center → web-admin-client}/stage-limits.js +6 -7
- package/dist/{config-center → web-admin-client}/types.d.ts +12 -39
- package/package.json +2 -2
- package/skills/find-skills.md +2 -2
- package/dist/url-shape.d.ts +0 -31
- package/dist/url-shape.js +0 -41
- /package/dist/{config-center → web-admin-client}/apply-ledger.js +0 -0
- /package/dist/{config-center → web-admin-client}/hot-keys-registry.d.ts +0 -0
- /package/dist/{config-center → web-admin-client}/hot-keys-registry.js +0 -0
- /package/dist/{config-center → web-admin-client}/mcp-revocation.d.ts +0 -0
- /package/dist/{config-center → web-admin-client}/mcp-revocation.js +0 -0
- /package/dist/{config-center → web-admin-client}/pull-state.js +0 -0
- /package/dist/{config-center → web-admin-client}/read-face.d.ts +0 -0
- /package/dist/{config-center → web-admin-client}/types.js +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type DroppedConfigEntry } from "./
|
|
1
|
+
import { type DroppedConfigEntry } from "./web-admin-client/read-warnings.js";
|
|
2
2
|
import { FileConfigStore } from "@sema-agent/settings-schema/node";
|
|
3
3
|
import { type EffectiveConfig as AgentConfigEffective, type EffectiveReadWarning } from "@sema-agent/settings-schema";
|
|
4
|
-
import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent, type EffectiveConfig } from "./
|
|
5
|
-
import type { CenterEndpoint } from "./
|
|
4
|
+
import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent, type EffectiveConfig } from "./web-admin-client/facade.js";
|
|
5
|
+
import type { CenterEndpoint } from "./web-admin-client/center-request.js";
|
|
6
6
|
import type { ConfigProviderWord } from "./config-types.js";
|
|
7
|
-
/** Result of a `fetchEffective` — EXACTLY the
|
|
7
|
+
/** Result of a `fetchEffective` — EXACTLY the web-admin's return: the effective config + its etag, or
|
|
8
8
|
* `null` for "unchanged" (remote 304; local: the version matched the caller's prior etag).
|
|
9
9
|
* `domainErrors`([ref] registry-core 0.10.12 tolerant seam,local lane only):catalog 域坏文件不再
|
|
10
10
|
* 连坐全包回落 env——坏域按该域 schema default 落+错误单列,好域照常生效;caller(main.ts)对每条打
|
|
@@ -13,10 +13,8 @@ import type { ConfigProviderWord } from "./config-types.js";
|
|
|
13
13
|
/** 壳写在 `config.d/models.json` 条目上的装饰键(`sema*`)自 settings-schema 1.5.0 起是**声明过的扩展命名空间**
|
|
14
14
|
* (`EXTENSION_NAMESPACES`):schema 照旧 strip、但不再报「未知键」,所以本函数收到的每一个未知键都是拼错/越界 ⇒ 候选门错误。
|
|
15
15
|
* 此前把这类键当「通知」放行的整套下游机制(域豁免/键路径闭集/满额特判/单独的通知面)已全部撤回——意图在声明处说,消费方不猜。 */
|
|
16
|
-
/** `readWarnings`:契约 `onWarning` 流的**原值**(未折叠)
|
|
17
|
-
* `
|
|
18
|
-
* 兼容臂还开着,而契约铸出 `legacy-governance-lifted` 的理由正是「关窗的前提是有人知道它还开着」
|
|
19
|
-
* (`legacyGovernanceFromRuntime` SUNSET 注)。恒在场(空数组 = 这次读零告警),不用缺席表达「没有」
|
|
16
|
+
/** `readWarnings`:契约 `onWarning` 流的**原值**(未折叠),两条读腿同键同义 —— 读者是一致性门的读腿适配器(它要逐条对契约语料的
|
|
17
|
+
* 告警多重集,折叠后的诊断面带不回 `kind` / 坐标段)。恒在场(空数组 = 这次读零告警),不用缺席表达「没有」
|
|
20
18
|
* ——缺席/空两形并存就是又一处二义。
|
|
21
19
|
* 🔐 原流的 `error` 未经 {@link redactConfigError}(那道脱敏挂在真正进日志流的 `domainErrors` 产出边界上),
|
|
22
20
|
* 路由进日志/审计流的消费者必须自己先脱敏。 */
|
|
@@ -52,6 +50,12 @@ export type FetchEffectiveResult = {
|
|
|
52
50
|
* 不回声值(上游 settings-schema)。
|
|
53
51
|
*/
|
|
54
52
|
export declare function redactConfigError(text: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* 一个配置值的单向短指纹(`#` + 8 位十六进制;HMAC 的钥匙每进程一把 —— 只在同一条日志流里可对照,不是一份可查字典的摘要)。
|
|
55
|
+
* 句子由契约从**结构化操作数**铸的地方(settings-schema 11 的 `renderRefIssue(issue, show)`)把它当 `show` 传进去:值逐个换成指纹,
|
|
56
|
+
* 句子的固定词与坐标原样 —— 不需要 {@link redactConfigError} 那种从引号猜值边界的读法。
|
|
57
|
+
*/
|
|
58
|
+
export declare function fingerprintConfigOperand(operand: string): string;
|
|
55
59
|
/** Sentinel returned by {@link raceBootFetch} when the boot pull outlived its budget — the caller
|
|
56
60
|
* starts serving on the env fallback and the SAME promise settles in the background (never cancelled). */
|
|
57
61
|
export declare const BOOT_FETCH_DEFERRED: unique symbol;
|
|
@@ -71,7 +75,7 @@ export declare function raceBootFetch<T>(fetch: Promise<T>, budgetMs: number): P
|
|
|
71
75
|
* et al. (main.ts does not swap on this seam yet — see the NOT-YET-WIRED note at the top of this module).
|
|
72
76
|
*/
|
|
73
77
|
export interface ConfigProvider {
|
|
74
|
-
/** "remote" =
|
|
78
|
+
/** "remote" = web-admin HTTP; "local" = on-disk FileConfigStore. */
|
|
75
79
|
readonly kind: "remote" | "local";
|
|
76
80
|
/**
|
|
77
81
|
* Pull the effective config. `etag` is the caller's last-seen version token (`if-none-match` on remote;
|
|
@@ -90,10 +94,10 @@ export interface ConfigProvider {
|
|
|
90
94
|
/** The config-provider knobs read off ServiceConfig (a structural subset — avoids importing the whole
|
|
91
95
|
* ServiceConfig type and keeps this module testable with a plain object). */
|
|
92
96
|
export interface ConfigProviderInput {
|
|
93
|
-
/** Set when
|
|
97
|
+
/** Set when SEMA_WEB_ADMIN_URL is configured (config.ts `webAdmin`). `dryRun` is carried through so a
|
|
94
98
|
* remote↔local swap via this seam does NOT drop the dry-run posture main.ts branches on (config.ts
|
|
95
|
-
* `
|
|
96
|
-
|
|
99
|
+
* `webAdmin.dryRun`); the provider itself does not consume it (the caller still branches on it). */
|
|
100
|
+
webAdmin?: CenterEndpoint & {
|
|
97
101
|
worker?: string;
|
|
98
102
|
dryRun?: boolean;
|
|
99
103
|
};
|
|
@@ -108,10 +112,10 @@ export interface ConfigProviderInput {
|
|
|
108
112
|
localDir: string;
|
|
109
113
|
}
|
|
110
114
|
/**
|
|
111
|
-
* RemoteConfigProvider — DELEGATES to the exported
|
|
115
|
+
* RemoteConfigProvider — DELEGATES to the exported web-admin HTTP functions. No HTTP is reimplemented;
|
|
112
116
|
* the center endpoint (baseUrl + credential SOURCE — S-651: read per request, never a bound token) and worker
|
|
113
117
|
* are passed through. The two delegate fns are injectable (defaulting
|
|
114
|
-
* to the real
|
|
118
|
+
* to the real web-admin exports) so a unit test can assert delegation without module-mocking.
|
|
115
119
|
*/
|
|
116
120
|
export declare class RemoteConfigProvider implements ConfigProvider {
|
|
117
121
|
private readonly cc;
|
|
@@ -156,7 +160,7 @@ export declare class LocalConfigProvider implements ConfigProvider {
|
|
|
156
160
|
export declare function mapToServiceEffective(eff: AgentConfigEffective, version: number): EffectiveConfig;
|
|
157
161
|
/**
|
|
158
162
|
* Pick the backend off a CLOSED `provider` enum (`local` | `remote` | undefined): LOCAL when
|
|
159
|
-
* `CONFIG_PROVIDER=local`, OR when no
|
|
163
|
+
* `CONFIG_PROVIDER=local`, OR when no web-admin URL is configured (a lone box with config.d/ on disk
|
|
160
164
|
* and no control plane). REMOTE otherwise (a configured center URL, the default fleet posture). A
|
|
161
165
|
* `CONFIG_PROVIDER=remote` with no URL is a misconfiguration — we fall through to local rather than
|
|
162
166
|
* constructing a remote provider with no endpoint (the caller would have skipped the remote pull entirely
|
|
@@ -168,7 +172,7 @@ export declare function mapToServiceEffective(eff: AgentConfigEffective, version
|
|
|
168
172
|
export declare function createConfigProvider(input: ConfigProviderInput): ConfigProvider;
|
|
169
173
|
/**
|
|
170
174
|
* S-841 —— **本地配置根的唯一来源**:`CONFIG_LOCAL_DIR` → `AGENT_DATA_DIR` → `~/.ai-agent`。两个入口(HTTP 服务的第 1 段、
|
|
171
|
-
* run-local)各调一次,算出来的那一个值同时交给
|
|
175
|
+
* run-local)各调一次,算出来的那一个值同时交给 web-admin 工厂(`createConfigProvider` 的 `localDir`)与执行车道合成步
|
|
172
176
|
* (`composeExecutionLane` 的 `localRoot`)—— 修前两个入口各写一份这条链(run-local 还多一个与之等价的三元),工厂又在
|
|
173
177
|
* 字面 `"local"` 之外回落 `process.cwd()`。
|
|
174
178
|
*
|
|
@@ -185,14 +189,14 @@ export declare function configLocalRoot(config: {
|
|
|
185
189
|
*/
|
|
186
190
|
export declare function configProviderKind(input: {
|
|
187
191
|
readonly provider?: ConfigProviderWord | undefined;
|
|
188
|
-
readonly
|
|
192
|
+
readonly webAdmin?: unknown;
|
|
189
193
|
}): "local" | "remote";
|
|
190
194
|
/**
|
|
191
|
-
* HTTP 服务这一侧的配置源:
|
|
195
|
+
* HTTP 服务这一侧的配置源:web-admin 工厂**建不建** provider(`CONFIG_PROVIDER=local` 或配了中心才建)、建出来是哪一种。
|
|
192
196
|
* `undefined` = 纯 env 部署(没有配置源)。工厂与执行车道合成步读这同一只(车PI 修复轮 ①:合成步排在工厂之前)。
|
|
193
197
|
*/
|
|
194
198
|
export declare function serviceConfigSourceKind(config: {
|
|
195
199
|
readonly configProvider?: ConfigProviderWord | undefined;
|
|
196
|
-
readonly
|
|
200
|
+
readonly webAdmin?: unknown;
|
|
197
201
|
}): "local" | "remote" | undefined;
|
|
198
202
|
//# sourceMappingURL=config-provider.d.ts.map
|
package/dist/config-provider.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { readMcpSourceLabel } from "./mcp-source-label.js";
|
|
2
2
|
import { createHmac, randomBytes } from "node:crypto";
|
|
3
|
-
import { splitFoldedReadWarnings, withDroppedCatalogEntries } from "./
|
|
3
|
+
import { splitFoldedReadWarnings, withDroppedCatalogEntries } from "./web-admin-client/read-warnings.js";
|
|
4
4
|
import { FileConfigStore } from "@sema-agent/settings-schema/node";
|
|
5
|
-
import {
|
|
5
|
+
import { danglingRefs, findSkillContent, renderRefIssue, skillContentHash, } from "@sema-agent/settings-schema";
|
|
6
6
|
import { redactSecrets } from "./trace/redact.js";
|
|
7
|
-
import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent,
|
|
7
|
+
import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent, WebAdminHttpError, } from "./web-admin-client/facade.js";
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
const OPERAND_FINGERPRINT_KEY = randomBytes(16);
|
|
@@ -14,12 +14,16 @@ export function redactConfigError(text) {
|
|
|
14
14
|
if (first === -1)
|
|
15
15
|
return s;
|
|
16
16
|
const count = (q) => s.split(q).length - 1;
|
|
17
|
-
const fingerprint = (operand) => `"
|
|
17
|
+
const fingerprint = (operand) => `"${fingerprintConfigOperand(operand)}"`;
|
|
18
18
|
if (count('"') % 2 === 1 || count("'") % 2 === 1)
|
|
19
19
|
return `${s.slice(0, first)}${fingerprint(s.slice(first + 1))}`;
|
|
20
20
|
const last = Math.max(s.lastIndexOf('"'), s.lastIndexOf("'"));
|
|
21
21
|
return `${s.slice(0, first)}${fingerprint(s.slice(first + 1, last))}${s.slice(last + 1)}`;
|
|
22
22
|
}
|
|
23
|
+
export function fingerprintConfigOperand(operand) {
|
|
24
|
+
return `#${createHmac("sha256", OPERAND_FINGERPRINT_KEY).update(operand).digest("hex").slice(0, 8)}`;
|
|
25
|
+
}
|
|
26
|
+
const redactDroppedEntry = (d) => ({ ...d, error: redactSecrets(d.error) });
|
|
23
27
|
export const BOOT_FETCH_DEFERRED = Symbol("boot-fetch-deferred");
|
|
24
28
|
export function raceBootFetch(fetch, budgetMs) {
|
|
25
29
|
if (budgetMs <= 0)
|
|
@@ -47,7 +51,7 @@ export class RemoteConfigProvider {
|
|
|
47
51
|
return {
|
|
48
52
|
...r,
|
|
49
53
|
...(r.domainErrors !== undefined ? { domainErrors: r.domainErrors.map((de) => ({ domain: de.domain, error: redactConfigError(de.error) })) } : {}),
|
|
50
|
-
...(r.droppedEntries !== undefined ? { droppedEntries: r.droppedEntries.map(
|
|
54
|
+
...(r.droppedEntries !== undefined ? { droppedEntries: r.droppedEntries.map(redactDroppedEntry) } : {}),
|
|
51
55
|
};
|
|
52
56
|
}
|
|
53
57
|
async fetchSkillContent(contentHash) {
|
|
@@ -56,7 +60,7 @@ export class RemoteConfigProvider {
|
|
|
56
60
|
return await fn(this.cc, contentHash);
|
|
57
61
|
}
|
|
58
62
|
catch (err) {
|
|
59
|
-
if (err instanceof
|
|
63
|
+
if (err instanceof WebAdminHttpError && err.status === 404)
|
|
60
64
|
return undefined;
|
|
61
65
|
throw err;
|
|
62
66
|
}
|
|
@@ -85,15 +89,17 @@ export class LocalConfigProvider {
|
|
|
85
89
|
if (etag !== undefined && etag === tag)
|
|
86
90
|
return null;
|
|
87
91
|
const refErrors = [];
|
|
88
|
-
const
|
|
89
|
-
for (const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
const byReferrer = new Map();
|
|
93
|
+
for (const issue of danglingRefs(eff)) {
|
|
94
|
+
const rows = byReferrer.get(issue.referrer.domain) ?? [];
|
|
95
|
+
rows.push(renderRefIssue(issue, fingerprintConfigOperand));
|
|
96
|
+
byReferrer.set(issue.referrer.domain, rows);
|
|
93
97
|
}
|
|
98
|
+
for (const [domain, rows] of byReferrer)
|
|
99
|
+
refErrors.push({ domain, error: rows.join("; ") });
|
|
94
100
|
const folded = splitFoldedReadWarnings(readWarnings);
|
|
95
101
|
const parseErrors = folded.domainErrors.map((w) => ({ domain: w.domain, error: redactConfigError(w.error) }));
|
|
96
|
-
const droppedEntries = folded.droppedEntries.map(
|
|
102
|
+
const droppedEntries = folded.droppedEntries.map(redactDroppedEntry);
|
|
97
103
|
const errors = [...domainErrors.map((de) => ({ domain: de.domain, error: redactConfigError(de.error) })), ...parseErrors, ...refErrors];
|
|
98
104
|
return {
|
|
99
105
|
effective: withDroppedCatalogEntries(mapToServiceEffective(eff, eff.version), folded.droppedCatalogEntries),
|
|
@@ -139,8 +145,7 @@ export function mapToServiceEffective(eff, version) {
|
|
|
139
145
|
enabled: m.enabled,
|
|
140
146
|
})),
|
|
141
147
|
roles: eff.models.roles ?? {},
|
|
142
|
-
|
|
143
|
-
...(eff.models.atModelAllowlist !== undefined ? { atModelAllowlist: eff.models.atModelAllowlist } : {}),
|
|
148
|
+
atMention: eff.models.atMention,
|
|
144
149
|
...(eff.models.tierGroups !== undefined ? { tierGroups: eff.models.tierGroups } : {}),
|
|
145
150
|
...(eff.models.activeTierGroup !== undefined ? { activeTierGroup: eff.models.activeTierGroup } : {}),
|
|
146
151
|
},
|
|
@@ -199,13 +204,6 @@ export function mapToServiceEffective(eff, version) {
|
|
|
199
204
|
enabled: sc.enabled,
|
|
200
205
|
})),
|
|
201
206
|
},
|
|
202
|
-
runtime: {
|
|
203
|
-
...(eff.runtime.rateLimitPerMin !== undefined ? { rateLimitPerMin: eff.runtime.rateLimitPerMin } : {}),
|
|
204
|
-
...(eff.runtime.maxTaskCostUsd !== undefined ? { maxTaskCostUsd: eff.runtime.maxTaskCostUsd } : {}),
|
|
205
|
-
...(eff.runtime.maxTaskTokens !== undefined ? { maxTaskTokens: eff.runtime.maxTaskTokens } : {}),
|
|
206
|
-
...(eff.runtime.maxPrincipalCostUsd !== undefined ? { maxPrincipalCostUsd: eff.runtime.maxPrincipalCostUsd } : {}),
|
|
207
|
-
...(eff.runtime.costQuotaWindowSec !== undefined ? { costQuotaWindowSec: eff.runtime.costQuotaWindowSec } : {}),
|
|
208
|
-
},
|
|
209
207
|
...(eff.limits !== undefined ? { limits: eff.limits } : {}),
|
|
210
208
|
governance: {
|
|
211
209
|
...(eff.governance.autonomy !== undefined ? { autonomy: eff.governance.autonomy } : {}),
|
|
@@ -215,21 +213,21 @@ export function mapToServiceEffective(eff, version) {
|
|
|
215
213
|
};
|
|
216
214
|
}
|
|
217
215
|
export function createConfigProvider(input) {
|
|
218
|
-
return configProviderKind(input) === "remote" && input.
|
|
219
|
-
? new RemoteConfigProvider(input.
|
|
216
|
+
return configProviderKind(input) === "remote" && input.webAdmin !== undefined
|
|
217
|
+
? new RemoteConfigProvider(input.webAdmin)
|
|
220
218
|
: new LocalConfigProvider(input.localDir);
|
|
221
219
|
}
|
|
222
220
|
export function configLocalRoot(config) {
|
|
223
221
|
return config.configLocalDir ?? process.env.AGENT_DATA_DIR ?? join(homedir(), ".ai-agent");
|
|
224
222
|
}
|
|
225
223
|
export function configProviderKind(input) {
|
|
226
|
-
if (input.provider === "local" || input.
|
|
224
|
+
if (input.provider === "local" || input.webAdmin === undefined)
|
|
227
225
|
return "local";
|
|
228
226
|
return "remote";
|
|
229
227
|
}
|
|
230
228
|
export function serviceConfigSourceKind(config) {
|
|
231
|
-
if (config.
|
|
229
|
+
if (config.webAdmin === undefined && config.configProvider !== "local")
|
|
232
230
|
return undefined;
|
|
233
|
-
return configProviderKind({ provider: config.configProvider,
|
|
231
|
+
return configProviderKind({ provider: config.configProvider, webAdmin: config.webAdmin });
|
|
234
232
|
}
|
|
235
233
|
//# sourceMappingURL=config-provider.js.map
|
package/dist/config-types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** [ref] A1: the ServiceConfig TYPE face, split out of the 1.8k-line loader module (config.ts)
|
|
2
|
-
* so pure-type consumers (http/server, plugins/*, hooks/hook-llm, security, brain,
|
|
2
|
+
* so pure-type consumers (http/server, plugins/*, hooks/hook-llm, security, brain, web-admin)
|
|
3
3
|
* depend on a LEAF with zero runtime edges — this is the substantive step that dissolves the
|
|
4
4
|
* type-closed edges into config.ts (lens2 §A). TYPES ONLY: loadConfig and every runtime value stay
|
|
5
5
|
* in config.ts, which re-exports these names so existing `from "./config.js"` importers keep
|
|
@@ -9,7 +9,7 @@ import type { ReadFaceSource } from "./read-face-posture.js";
|
|
|
9
9
|
import type { PostureSource } from "./posture-source.js";
|
|
10
10
|
import type { SealedCustodyPoison } from "./key-resolver.js";
|
|
11
11
|
import type { ModelEntryRefusal } from "./model-entry-refusal.js";
|
|
12
|
-
import type { DroppedCatalogEntry } from "./
|
|
12
|
+
import type { DroppedCatalogEntry } from "./web-admin-client/read-warnings.js";
|
|
13
13
|
import type { A2aServerSpec, CompliancePosture, CrossSessionDialogExpiry, CrossSessionInboundSetting, FileHistoryRetentionPolicy, LockedKey, McpServerSpec, Model, ModelRoles, RetentionPolicy, ShellGateDoctrine, WriteProtectedEntry } from "@sema-agent/core";
|
|
14
14
|
import type { ApprovalHmacKey, PrincipalJwtKey } from "./auth-keys.js";
|
|
15
15
|
import type { ElicitationThrottle } from "./elicitation.js";
|
|
@@ -21,6 +21,7 @@ import type { CenterCredentialSource } from "./center-credential.js";
|
|
|
21
21
|
import type { GitApiKind } from "./git-api-kind.js";
|
|
22
22
|
import type { MemoryEngineBackend, StoreBackend as StoreBackendWord } from "@sema-agent/settings-schema/execution-lanes";
|
|
23
23
|
import { DRAIN_GRACE_FLOOR_MS } from "@sema-agent/settings-schema/fleet";
|
|
24
|
+
import type { AtMention } from "@sema-agent/settings-schema";
|
|
24
25
|
/** [ref]:记忆向量面的 embedder 坐标(env `MEMORY_EMBEDDER_*` 解析结果;单一属主 = 本类型,
|
|
25
26
|
* `plugins/memory-embedder.ts` 的工厂直接消费它,不复制形状)。语义与三问见
|
|
26
27
|
* {@link ServiceConfigFlat.memoryEmbedder}。纯数据 —— 端点原文照存(拼 `/embeddings` 是 transport
|
|
@@ -50,8 +51,8 @@ export type TaskWriteFaceEscalation = (typeof TASK_WRITE_FACE_ESCALATIONS)[numbe
|
|
|
50
51
|
export declare const RETENTION_MODES: readonly ["audit-only", "enforce"];
|
|
51
52
|
export type RetentionMode = (typeof RETENTION_MODES)[number];
|
|
52
53
|
/**
|
|
53
|
-
* S-841 —— `CONFIG_PROVIDER` 的词表闭集(**属主在此**:`loadConfig` 的唯一读点、
|
|
54
|
-
* 配置目录的 enum 行共读这一份)。缺席 / 空串 = 未表态(配了 `
|
|
54
|
+
* S-841 —— `CONFIG_PROVIDER` 的词表闭集(**属主在此**:`loadConfig` 的唯一读点、web-admin 工厂、执行车道合成步、
|
|
55
|
+
* 配置目录的 enum 行共读这一份)。缺席 / 空串 = 未表态(配了 `SEMA_WEB_ADMIN_URL` ⇒ 中心,否则纯 env);两词之外 ⇒ 拒启。
|
|
55
56
|
* 修前是开放词:认不出的词被配置源判官当 `local`、被隐式 host 臂当「不是 local」,一个旋钮在一个进程里有两种读法。
|
|
56
57
|
*/
|
|
57
58
|
export declare const CONFIG_PROVIDER_WORDS: readonly ["local", "remote"];
|
|
@@ -128,7 +129,7 @@ export declare const DRAIN_SECOND_SIGNAL_MIN_GAP_DEFAULT_MS = 250;
|
|
|
128
129
|
* 住在本叶(而不在 `fleet/drain-entry.ts`):`config.ts` 读它,而 drain-entry 值引 `plugins/store-contracts.ts`,config 不值引 plugins 层。
|
|
129
130
|
*/
|
|
130
131
|
export declare function fleetScopeOf(raw: string | undefined): string;
|
|
131
|
-
/** 中心基址三席(`
|
|
132
|
+
/** 中心基址三席(`SEMA_WEB_ADMIN_URL` / `SEMA_WEB_ADMIN_LIVE_URL` / `SEMA_WEB_ADMIN_WEB_URL`)与公告地址的形句 —— 判官 `web-admin-client/center-request.ts` `pathBaseUrlRefusal` 一只(形判 = settings-schema `httpUrlFlaws`),配置目录四行同读这一句。 */
|
|
132
133
|
export declare const CENTER_BASE_URL_RULE = "\u8BBE\u4E86\u5C31\u5FC5\u987B\u662F\u53EF\u89E3\u6790\u7684 http(s) URL,\u4E14\u4E0D\u5E26\u51ED\u636E / query / fragment(\u57FA\u5740\u540E\u9762\u8981\u62FC\u8DEF\u5F84);\u574F\u5F62\u62D2\u542F(\u6CA1\u63A5\u4E2D\u5FC3\u4E5F\u62D2),\u62D2\u53E5\u53EA\u70B9\u540D\u89C4\u5219,\u4E0D\u56DE\u663E scheme";
|
|
133
134
|
/** 编排器片 2:`FLEET_LEASE_OUTAGE_MAX_MS` 的缺省(24 h)—— 中心 / 库故障、中心降级在今天都靠 LKG 无限期容忍,10 分钟级的窗会把它们变成数据面停服。 */
|
|
134
135
|
export declare const FLEET_LEASE_OUTAGE_MAX_DEFAULT_MS = 86400000;
|
|
@@ -266,7 +267,7 @@ export interface MemoryConsolidationDriverConfig {
|
|
|
266
267
|
*/
|
|
267
268
|
autoRunOnRecommendation?: boolean;
|
|
268
269
|
}
|
|
269
|
-
/** A
|
|
270
|
+
/** A web-admin MCP server resolved to a core spec (env-NAME refs already → real values) plus the
|
|
270
271
|
* scenarios it applies to (empty = all). `resolveSpec` filters by scenario and passes `spec` to core. */
|
|
271
272
|
export interface ScopedMcpServer {
|
|
272
273
|
scenarios: string[];
|
|
@@ -532,7 +533,7 @@ export interface ServiceConfigFlat {
|
|
|
532
533
|
cooldownMs: number;
|
|
533
534
|
};
|
|
534
535
|
/** Default model the service runs tasks on. **活的** —— center 热应用会整只换掉它
|
|
535
|
-
* (`config.model = config.models.default!`,
|
|
536
|
+
* (`config.model = config.models.default!`,web-admin-client/apply-effective.ts 的 commit 段)。 */
|
|
536
537
|
model: Model;
|
|
537
538
|
/**
|
|
538
539
|
* S-188 —— **boot 期 env 派生的那只模型**,`loadConfig()` 铸一次,此后**永不换**(与 `model` 在 boot
|
|
@@ -552,7 +553,7 @@ export interface ServiceConfigFlat {
|
|
|
552
553
|
* Used to resolve roles and to allow-list `@-model` mentions. */
|
|
553
554
|
models: Record<string, Model>;
|
|
554
555
|
/** Per-model API-key override: catalog model NAME → the env var NAME holding that model's key (from
|
|
555
|
-
*
|
|
556
|
+
* web-admin `apiKeyEnv`). Drives the spec's `getApiKeyAndHeaders` so each model/rung authenticates
|
|
556
557
|
* with its own upstream account; a model absent here falls back to the gateway key. Env path: empty. */
|
|
557
558
|
modelApiKeyEnv: Record<string, string>;
|
|
558
559
|
/** sealed-box 托管密钥的解封产物:catalog model NAME → PLAINTEXT api key(`ModelEntry.
|
|
@@ -605,21 +606,21 @@ export interface ServiceConfigFlat {
|
|
|
605
606
|
/** Role → model map (1.24): `subagent`/`summarize` → the cheap model when `MODEL_CHEAP_ID` is set
|
|
606
607
|
* (council lenses + compaction get cheap), `default`/`team`/`synthesize` stay on the main model. */
|
|
607
608
|
roles: ModelRoles;
|
|
608
|
-
/** [ref] / [ref] ——
|
|
609
|
-
*
|
|
610
|
-
*
|
|
609
|
+
/** [ref] / [ref] —— **「`@` 能点名哪些模型」**(settings-schema 11 `models.atMention` 的服务端消费面;三态闭集
|
|
610
|
+
* `{mode:"all"}` / `{mode:"none"}` / `{mode:"only", models}`,形与缺省读法的属主是契约,本仓读法 = `model-select.ts`
|
|
611
|
+
* `readAtMention` / `DEFAULT_AT_MENTION`,判据 = `isAtMentionable`)。
|
|
611
612
|
*
|
|
612
613
|
* 辖域(设计稿 233 v2 终裁,施工侧成文):
|
|
613
614
|
* - **受限**=用户通道:`body.model` / `settings.model`(同属请求体,untrusted) / objective 内联
|
|
614
615
|
* `@name` / `body.compactionModel` / `POST /v1/side-query` 的 `body.model`;
|
|
615
|
-
* - **不受限**=operator 配置通道:`models.roles` /
|
|
616
|
-
*
|
|
616
|
+
* - **不受限**=operator 配置通道:`models.roles` / 档位绑定表 / side-query 的 `modelRole`(角色表选路)
|
|
617
|
+
* —— 它管「用户可点什么」,不管「operator 配什么」。
|
|
617
618
|
* - **提交时门**:core 运行时路由(degrade / cascade / roles 解析)**不在射程**——那些是引擎按配置
|
|
618
619
|
* 自己走的路,不是一次用户选择(诚实声明,非运行时执法)。
|
|
619
620
|
*
|
|
620
|
-
* NO env source —— env lane
|
|
621
|
-
* `
|
|
622
|
-
|
|
621
|
+
* NO env source —— env lane = 契约缺省(`{mode:"all"}`);只由 applyEffective 从 `models.atMention` 整只重算填充
|
|
622
|
+
* (**非粘**:中心改回 `all` ⇒ 本席回 `all`),`only` 的名在 stage 期按本世代可用目录收窄(settings-schema `narrowAtMention`)。 */
|
|
623
|
+
atMention: AtMention;
|
|
623
624
|
/**
|
|
624
625
|
* Session backend: in-memory (default), tidb (durable L1 event-log center), or `auto` — probe a
|
|
625
626
|
* configured DB at startup and fall back to in-memory if it's unreachable (for local/intranet binaries:
|
|
@@ -786,7 +787,7 @@ export interface ServiceConfigFlat {
|
|
|
786
787
|
* core 侧 `prepareConfigDoors` 另有同判门(`config.memory_capture_policy`),两道同向不冲突。
|
|
787
788
|
*
|
|
788
789
|
* 🔴 **`governed` 的半配置拒启**:该姿态要求本部署有 per-principal verdict 源。源**两条**(析取,[ref] 起):
|
|
789
|
-
* SQL 后端上的 `memory_optout_grant` 表(S-2),或非 dry-run 的
|
|
790
|
+
* SQL 后端上的 `memory_optout_grant` 表(S-2),或非 dry-run 的 web-admin 发 `EntitlementRuntimeCaps.allowMemoryOptOut`
|
|
790
791
|
* (settings-schema 1.4.0 到货)。两源皆无 ⇒ 每个 opt-out 声明都被 core 拒且没人知道为什么 ⇒
|
|
791
792
|
* `boot/runtime-caps.ts` 的 `assertMemoryCapturePolicyWirable` 在启动期拒启(与 consolidation 阀门 D1 同姿态)。
|
|
792
793
|
* ⚠️ [ref]:center 那一臂只证「源在场」,不证 center 会**发**这个可选键 —— center-only 的部署起动后仍可能次次拒,
|
|
@@ -819,7 +820,7 @@ export interface ServiceConfigFlat {
|
|
|
819
820
|
};
|
|
820
821
|
/** 件A 单机形目录:env `MEMORY_ORG_DIRECTORY_JSON` 原文(`Record<principal, Record<org:scope, {write?}>>`)。
|
|
821
822
|
* config 解析期即整段校验(parseOrgDirectoryStatic,fail-loud);此处存**原文**(config=纯数据,
|
|
822
|
-
* Map 在装配点重建)。与
|
|
823
|
+
* Map 在装配点重建)。与 web-admin 目录腿互斥的裁决在装配点(两者都在=center 腿胜,env 表忽略
|
|
823
824
|
* 并 warn——授权面不做双源合并)。 */
|
|
824
825
|
memoryOrgDirectoryJson?: string;
|
|
825
826
|
/** 件A 目录 granted(含负结果)缓存 TTL(ms)。新任务/新 resume 腿的准入判决滞后上限=此值(「TTL 即
|
|
@@ -983,15 +984,15 @@ export interface ServiceConfigFlat {
|
|
|
983
984
|
/** Base commit/ref for every worktree (default core's `HEAD` at creation time). */
|
|
984
985
|
commit?: string;
|
|
985
986
|
};
|
|
986
|
-
/** MCP servers from
|
|
987
|
-
* filtered per scenario in `resolveSpec`. Not env-derived — populated by the
|
|
987
|
+
/** MCP servers from web-admin (`/effective.mcp`), resolved at startup (env-NAME refs → values) and
|
|
988
|
+
* filtered per scenario in `resolveSpec`. Not env-derived — populated by the web-admin adapter when
|
|
988
989
|
* present (restart-to-apply, like models/roles); undefined = no center MCP (scenarios use no MCP).
|
|
989
990
|
* Carries both the mounted list and the full declared-name set — see {@link CenterMcp}. */
|
|
990
991
|
mcpServers?: CenterMcp;
|
|
991
|
-
/** DESIGN-269 §2.1 —— A2A peers from the
|
|
992
|
+
/** DESIGN-269 §2.1 —— A2A peers from the web-admin (`/effective.a2a`), resolved at startup
|
|
992
993
|
* (header-NAME refs → values) and filtered per scenario in `resolveSpec` (`a2aForScenario`). Same
|
|
993
994
|
* posture as {@link mcpServers}: not env-derived (no A2A_* env leg — a peer is a structured record,
|
|
994
|
-
* not a scalar), populated by the
|
|
995
|
+
* not a scalar), populated by the web-admin adapter when present, restart-to-apply.
|
|
995
996
|
* undefined = no center peers ⇒ **the whole leg does not exist** for a task (`TaskSpec.a2a` stays
|
|
996
997
|
* absent unless a single-user caller injects `body.a2aPeers`). */
|
|
997
998
|
a2aPeers?: ScopedA2aPeer[];
|
|
@@ -1012,7 +1013,7 @@ export interface ServiceConfigFlat {
|
|
|
1012
1013
|
* = any MySQL-protocol server — MySQL, TiDB, MariaDB — over the same mysql2 pool; `pg` (PostgreSQL
|
|
1013
1014
|
* dialect) reads `pg` below. [ref]/[ref]B-3(5.0.0):the env value `tidb` and the TIDB_* coord names
|
|
1014
1015
|
* are RETIRED — `tidb` is rejected by the enum and any TIDB_* env in place refuses to start with the
|
|
1015
|
-
* MYSQL_* replacement named (see RETIRED_ENVS
|
|
1016
|
+
* MYSQL_* replacement named (see settings-schema `RETIRED_ENVS`). `mysql` reads MYSQL_* coords only.
|
|
1016
1017
|
* TiDB itself stays fully supported (any MySQL-protocol engine works — memory no longer needs a VECTOR
|
|
1017
1018
|
* column since [ref] moved it onto the file engine). Env: DB_BACKEND. */
|
|
1018
1019
|
dbBackend: StoreBackendWord;
|
|
@@ -1162,11 +1163,11 @@ export interface ServiceConfigFlat {
|
|
|
1162
1163
|
* (半配置绕行=隐藏入口,刻意优先级)。 */
|
|
1163
1164
|
allowUnauthedWrites?: boolean;
|
|
1164
1165
|
/** Optional READ-ONLY token that ALSO authorizes GET /metrics + /metrics/summary (in addition to
|
|
1165
|
-
* authToken). Set the SAME value fleet-wide so a control plane (
|
|
1166
|
+
* authToken). Set the SAME value fleet-wide so a control plane (web-admin) can pull every worker's
|
|
1166
1167
|
* metrics with ONE token it holds — without ever holding each worker's full `authToken`. */
|
|
1167
1168
|
metricsToken?: string;
|
|
1168
1169
|
/** Read-only Task Trace API token (S1). Like `metricsToken` but for GET /v1/tasks[/:id/turns|/stream] — lets
|
|
1169
|
-
*
|
|
1170
|
+
* web-admin pull worker traces fleet-wide with ONE read-only token, never holding each worker's full
|
|
1170
1171
|
* `authToken`. Read-only: cannot run tasks or change config. `TRACE_TOKEN`. */
|
|
1171
1172
|
traceToken?: string;
|
|
1172
1173
|
/** CORS v2(2026-07-11):`CORS_ORIGIN` 接受 CSV **白名单**。单值=v1 兼容
|
|
@@ -1190,13 +1191,13 @@ export interface ServiceConfigFlat {
|
|
|
1190
1191
|
requirePrincipal: boolean;
|
|
1191
1192
|
/** Runtime governance "second baton" (center §10): operator autonomy mode, expanded TIGHTEN-ONLY onto each
|
|
1192
1193
|
* task's TaskSpec (`read-only`/`plan` → read-only hands, `ask` → shellGate always, `auto`/unset → no extra
|
|
1193
|
-
* tightening). Per-request HOT (read live in resolveSpec); primarily
|
|
1194
|
+
* tightening). Per-request HOT (read live in resolveSpec); primarily web-admin-managed, `AUTONOMY` env for
|
|
1194
1195
|
* the env/local path. See runtime-governance.ts. undefined = unmanaged. */
|
|
1195
1196
|
autonomy?: Autonomy;
|
|
1196
1197
|
/** Runtime governance "second baton" (center §10): per-command coarse name-level rules, compiled into a
|
|
1197
1198
|
* `combinePolicies`-layered ToolPolicy on top of the deployment baseline (deny-wins, tighten-only). COARSE
|
|
1198
1199
|
* filter, NOT a sandbox (sh -c/$()/pipes bypass argv[0] → fail toward ask). Per-request HOT; sourced from
|
|
1199
|
-
*
|
|
1200
|
+
* the `governance` domain of the effective config (structured config, not an env scalar). undefined = unmanaged. */
|
|
1200
1201
|
commandPolicy?: CommandRule[];
|
|
1201
1202
|
/**
|
|
1202
1203
|
* [ref] 件B —— 本部署的**合规档位**(core `RunnerDeps.compliancePostureResolver` 的供数)。
|
|
@@ -1354,16 +1355,16 @@ export interface ServiceConfigFlat {
|
|
|
1354
1355
|
* 三问(7.117.0 语义变宽):谁需要 = 没有请求体的腿(`run-local` / leader)上接了 MCP 服务器、或想一句话放掉自家某只工具的运维;谁受伤 = 表里写了内置工具名的部署
|
|
1355
1356
|
* (7.115.0–7.116.x 本键只回答「没人表态」,`Bash` / `Write` 写进来什么也不放;本版起这两只不再问);补偿 = 起服行 `approval_grant_in_force` 的 note 写着当前效果、
|
|
1356
1357
|
* `GET /v1/diagnostics/wiring` 的 `serverGates.approvalGrant`、`MIGRATION.md` 升级前必读一段;要某只工具必须问,用上面那几只本键清不掉的旋钮。
|
|
1357
|
-
* v1 只有 env 一个写入通道(无
|
|
1358
|
+
* v1 只有 env 一个写入通道(无 web-admin 座位,不进 settings-schema)= 进程常量,与 Runner 席位的寿命一致。空表 = 席位缺席(引擎读作「部署没有 allow 规则」)。
|
|
1358
1359
|
*/
|
|
1359
1360
|
approvalGrant: string[];
|
|
1360
1361
|
/** [ref] D-G (HMAC = integrity, not identity; ✅ WIRED — the "SCAFFOLD, not yet wired" note here was STALE,
|
|
1361
1362
|
* corrected 2026-07-25: consumed by `verifyDirectDoorProof` → `verifyApprovalHmac`, reached from the live decide
|
|
1362
1363
|
* routes — the two `verifyDirectDoorProof(` call sites in `http/routes/approvals-assistant.ts`): the
|
|
1363
|
-
*
|
|
1364
|
+
* web-admin-managed, ROTATING key-set used to verify an
|
|
1364
1365
|
* approval-decision envelope's integrity on a direct-connect door. Empty (unset `APPROVAL_HMAC_KEYS`) ⇒ D-G
|
|
1365
1366
|
* inactive (BFF-minted-principal is the only /decide door — back-compat), which is why "wired but off" is the
|
|
1366
|
-
* accurate description of every stock deployment.
|
|
1367
|
+
* accurate description of every stock deployment. web-admin mints + rotates the set; the shape is
|
|
1367
1368
|
* provisional (ASK-CENTER-2026-06-17). */
|
|
1368
1369
|
approvalHmacKeys: ApprovalHmacKey[];
|
|
1369
1370
|
/** [ref] D-G: open the DIRECT-connect /decide door (a CLI/desktop client without the BFF). When true, this
|
|
@@ -1379,7 +1380,7 @@ export interface ServiceConfigFlat {
|
|
|
1379
1380
|
principalJwtIss?: string;
|
|
1380
1381
|
principalJwtAud?: string;
|
|
1381
1382
|
/** S-591:registry SSO-JWT 的**显式** issuer(`AUTH_BRIDGE_ISSUER`)。
|
|
1382
|
-
* 🔴 **只是显式 env,不含 boot 期那条 `??
|
|
1383
|
+
* 🔴 **只是显式 env,不含 boot 期那条 `?? webAdmin.baseUrl` 回退**(回退仍在
|
|
1383
1384
|
* `boot/stage-09-leader.ts` 的桥装配处)。唯一消费方是桥;S-671([ref] ①)起它**不是**托管证据 ——
|
|
1384
1385
|
* 显式与回退 issuer 在租户轴上同判(理由见 `hosted-posture.ts`)。 */
|
|
1385
1386
|
authBridgeIssuer?: string;
|
|
@@ -1972,7 +1973,7 @@ export interface ServiceConfigFlat {
|
|
|
1972
1973
|
readFace?: "open" | "roots";
|
|
1973
1974
|
/** S-167:上面那一档**是谁定的**(闭集四词,见 `read-face-posture.ts`)。不变量:
|
|
1974
1975
|
* `readFace === undefined` ⟺ `readFaceSource === "engine-default"`。
|
|
1975
|
-
* 🔴 承重面**不是**装饰:`
|
|
1976
|
+
* 🔴 承重面**不是**装饰:`web-admin-client/read-face.ts` 的「env 恒赢」逐键判据读的就是它(修前读的是
|
|
1976
1977
|
* 「键在不在场」这个代理,posture 会铸键 ⇒ 代理当场失真,center 的 face 会被从没设过 env 的机器挡掉)。 */
|
|
1977
1978
|
readFaceSource: ReadFaceSource;
|
|
1978
1979
|
/** S-591(7.95.0,车LT):任务层**掀开写围栏**这条声明的**运维天花板档位**(`TASK_WRITE_FACE_ESCALATION`)。
|
|
@@ -2018,10 +2019,10 @@ export interface ServiceConfigFlat {
|
|
|
2018
2019
|
* ⇒ 引擎读字面 `~/.sema`(与 LKG / skill 缓存 / scheduler 店的缺省落点同一处)。读法单一属主 `sema-config-dir.ts`。 */
|
|
2019
2020
|
agentConfigDir?: string;
|
|
2020
2021
|
/** LKG 落盘路径的覆写(`CONFIG_LKG_PATH`,绝对路径;单一读法 `config-lkg.ts` `lkgPathOverrideOf`)。缺席 = LKG 落在配置根下按箱派生。
|
|
2021
|
-
* 读者:LKG 的落盘 / 读回(`boot/
|
|
2022
|
+
* 读者:LKG 的落盘 / 读回(`boot/web-admin.ts`)与读拒行(部署姿态座席族 —— LKG 在哪,读拒就守哪,`lkgReadDenyRows`)。 */
|
|
2022
2023
|
configLkgPath?: string;
|
|
2023
2024
|
/** 远程配置的 LKG(last-known-good)盘缓存读写开关(`CONFIG_LKG_ENABLED`,缺省开;只对远程 provider 有意义)。单一读法:`loadConfig` 铸这一席
|
|
2024
|
-
* (同时登记极性行),`boot/
|
|
2025
|
+
* (同时登记极性行),`boot/web-admin.ts` 的两个读点(boot 的 LKG 来源判定、skill 正文缓存目录)只读它 —— 起服之后改环境变量不影响。 */
|
|
2025
2026
|
configLkgEnabled: boolean;
|
|
2026
2027
|
/** Structured log level. */
|
|
2027
2028
|
logLevel: "debug" | "info" | "warn" | "error";
|
|
@@ -2102,22 +2103,22 @@ export interface ServiceConfigFlat {
|
|
|
2102
2103
|
defaultScenario: string;
|
|
2103
2104
|
/** Directory of baked-in skill Markdown files, loaded once at startup. */
|
|
2104
2105
|
skillsDir: string;
|
|
2105
|
-
/** Central
|
|
2106
|
+
/** Central web-admin (web-admin). When set, the service pulls the effective config
|
|
2106
2107
|
* on boot (and refreshes) and applies it OVER the env defaults — env is the fallback. Logical config
|
|
2107
2108
|
* only (model roster/roles/teams); secrets/gateways stay in this service's env.
|
|
2108
|
-
* `dryRun` (
|
|
2109
|
+
* `dryRun` (SEMA_WEB_ADMIN_DRY_RUN=true): pull + LOG what the registry would change vs the env-derived
|
|
2109
2110
|
* config, but do NOT apply it — a safe-rollout verification step before flipping to live.
|
|
2110
|
-
* `worker` (
|
|
2111
|
+
* `worker` (SEMA_WEB_ADMIN_WORKER=<name>; injected per-worker by the reconciler): scopes the pull to
|
|
2111
2112
|
* that worker's roster via `/effective?worker=<name>`. Unset → the global roster (backward compatible).
|
|
2112
2113
|
* `credential`(S-651,BREAKING:取代 7.98.0 及以前的 `token: string` 启动快照):凭证来源活对象
|
|
2113
|
-
* (`center-credential.ts`),每条出站请求经它取一次值 —— `
|
|
2114
|
-
* `
|
|
2115
|
-
* `
|
|
2116
|
-
* `liveBaseUrl`(编排器片 2,env `
|
|
2114
|
+
* (`center-credential.ts`),每条出站请求经它取一次值 —— `SEMA_WEB_ADMIN_TOKEN`(值)或
|
|
2115
|
+
* `SEMA_WEB_ADMIN_TOKEN_FILE`(每次读文件,轮换 / 换账号不重启)二选一(两键名与判官的属主 = settings-schema
|
|
2116
|
+
* `WEB_ADMIN_ENV` / `judgeWebAdminCredentialDeclaration`,S-742)。
|
|
2117
|
+
* `liveBaseUrl`(编排器片 2,env `SEMA_WEB_ADMIN_LIVE_URL`):fleet 活性组(心跳 / 注销、服务租约 —— settings-schema `FLEET_LIVE_PATHS`)的基址,
|
|
2117
2118
|
* 给「管理面在就绪门后、活性面另走一条不看就绪的入口」的部署;缺席 ⇒ 活性组也打 `baseUrl`(这条缺省只在 `centerFetch` 读)。
|
|
2118
|
-
* `webBaseUrl`(7.121.0,env `
|
|
2119
|
+
* `webBaseUrl`(7.121.0,env `SEMA_WEB_ADMIN_WEB_URL`):这个中心的 **web 面固定基址**,运维声明、引擎原样转述到 `/health.center.webBaseUrl`
|
|
2119
2120
|
* (壳按它拼会话深链;路径怎么拼归壳)。起服时判成「可拼路径的基址」:http(s)、不带凭据 / query / fragment,否则拒启;缺席即缺席,引擎不拼不猜。 */
|
|
2120
|
-
|
|
2121
|
+
webAdmin?: {
|
|
2121
2122
|
baseUrl: string;
|
|
2122
2123
|
liveBaseUrl?: string;
|
|
2123
2124
|
webBaseUrl?: string;
|
|
@@ -2150,14 +2151,14 @@ export interface ServiceConfigFlat {
|
|
|
2150
2151
|
* 不自停;中心恢复授予即恢复。② 排空口 `POST /v1/admin/drain` 的**期限准入上界**(`fleet/drain-entry.ts` 规则 2):`deadlineAt` 离此刻超过它 ⇒
|
|
2151
2152
|
* 400 `request.field_invalid`。 */
|
|
2152
2153
|
fleetLeaseOutageMaxMs: number;
|
|
2153
|
-
/** S-698(design-325 §2):中心凭证**续签提前量**(ms)—— `
|
|
2154
|
+
/** S-698(design-325 §2):中心凭证**续签提前量**(ms)—— `SEMA_WEB_ADMIN_TOKEN_FILE` 指向人的登录会话信封
|
|
2154
2155
|
* (`kind:"user-session"`)时,访问令牌离到期 ≤ 本值即由引擎续签并原子改写同一文件(`center-credential-renewer.ts`)。
|
|
2155
2156
|
* 缺省 5 min;`0` = 关续签、只读信封(壳负责续);其余必须是整数毫秒且落在 `CENTER_CREDENTIAL_RENEW_LEAD_MIN_MS`(一次续签请求的
|
|
2156
2157
|
* 传输上界)与 `CENTER_CREDENTIAL_RENEW_LEAD_MAX_MS`(访问令牌寿命之半)之间,坏值拒启(解析口 `parseCenterCredentialRenewLeadMs`)。
|
|
2157
|
-
* 裸行文件 / `
|
|
2158
|
+
* 裸行文件 / `SEMA_WEB_ADMIN_TOKEN` 值形不受它影响(不续签)。`CENTER_CREDENTIAL_RENEW_LEAD_MS`。 */
|
|
2158
2159
|
centerCredentialRenewLeadMs: number;
|
|
2159
|
-
/** Dual-mode config SOURCE (DUAL-MODE-DESIGN §4): "remote" (
|
|
2160
|
-
* via @sema-agent/settings-schema FileConfigStore) | unset → remote if
|
|
2160
|
+
/** Dual-mode config SOURCE (DUAL-MODE-DESIGN §4): "remote" (web-admin HTTP) | "local" (.env + config.d
|
|
2161
|
+
* via @sema-agent/settings-schema FileConfigStore) | unset → remote if SEMA_WEB_ADMIN_URL is set, else pure-env.
|
|
2161
2162
|
* Env: CONFIG_PROVIDER —— S-841 起闭集 {@link CONFIG_PROVIDER_WORDS}(认不出的词拒启;空串 = 未设)。
|
|
2162
2163
|
* The same resolver/EffectiveConfig either way (can't drift). */
|
|
2163
2164
|
configProvider?: ConfigProviderWord;
|
|
@@ -2167,13 +2168,13 @@ export interface ServiceConfigFlat {
|
|
|
2167
2168
|
/** 组:store(持久化)—— DB 引擎三态、session 后端、SQL coords、快照 BLOB / SendUserFile 对象存储。 */
|
|
2168
2169
|
export type ServiceStoreConfig = Pick<ServiceConfigFlat, "sessionBackend" | "sessionCacheTtlSec" | "storeProbeIntervalMs" | "storeLockWaitMs" | "dbBackend" | "dbBackendExplicit" | "localDataRoot" | "runStoreStrictHydrate" | "tidb" | "pg" | "dbQueryTimeoutMs" | "snapshotBlobStore" | "snapshotBlobSqlMaxBytes" | "snapshotBlobAllowSql" | "fileHistory" | "fileHistoryCapture" | "sendUserFile">;
|
|
2169
2170
|
/** 组:modelPlane(模型面)—— 网关坐标、Anthropic 路线、韧性旋钮、主/廉价 model entry、role 表、降级梯。 */
|
|
2170
|
-
export type ServiceModelPlaneConfig = Pick<ServiceConfigFlat, "gatewayBaseUrl" | "gatewayApiKey" | "gatewayFallbackUrls" | "gatewayMaxRetries" | "anthropic" | "resilience" | "model" | "envModel" | "models" | "modelApiKeyEnv" | "modelApiKeys" | "modelRefusals" | "droppedCatalogEntries" | "modelQuotaWeights" | "tiers" | "projects" | "roles" | "
|
|
2171
|
+
export type ServiceModelPlaneConfig = Pick<ServiceConfigFlat, "gatewayBaseUrl" | "gatewayApiKey" | "gatewayFallbackUrls" | "gatewayMaxRetries" | "anthropic" | "resilience" | "model" | "envModel" | "models" | "modelApiKeyEnv" | "modelApiKeys" | "modelRefusals" | "droppedCatalogEntries" | "modelQuotaWeights" | "tiers" | "projects" | "roles" | "atMention" | "cascadeLadder" | "degrade">;
|
|
2171
2172
|
/** 组:approval(审批 / HITL 门)。`directDoorActive` 无 env 解析腿(装配层三域合取的产物),但语义上
|
|
2172
2173
|
* 就是本组的门状态,故进组;`parseApprovalDomain` 的返回类型相应是 `Omit<…, "directDoorActive">`。 */
|
|
2173
2174
|
export type ServiceApprovalConfig = Pick<ServiceConfigFlat, "approvalRequire" | "approvalDeny" | "approvalTimeoutSec" | "approvalAutoBudget" | "approvalNeverAuto" | "approvalGrant" | "approvalHmacKeys" | "durableApproval" | "durableApprovalSource" | "streamAskWindowMsSource" | "directApprovalDoor" | "directDoorActive" | "resourceSuspend" | "resourceSuspendTtlSec" | "resourceSuspendTotalTokens" | "resourceSuspendTotalBudgetUsd" | "resourceSuspendMaxSlices" | "askQuestionEnabled" | "questionThrottle" | "toolApprovalEnabled" | "permissionRulesEnabled" | "permissionRulesEnabledExplicit" | "streamAskWindowMarginMs" | "streamApproval" | "unattendedApprovalPolicy" | "mcpElicitation" | "sensitiveWritePatterns" | "writeProtectedPaths" | "manualModeShellGate" | "permissionsDisableAutoMode" | "autoModeClassifierFallback" | "autoModeClassifierTimeoutMs" | "crossSessionInbound" | "crossSessionDialogExpiry">;
|
|
2174
2175
|
/** 组:memory(记忆面 + TOC 同步腿)。 */
|
|
2175
2176
|
export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled" | "memoryEngineDir" | "memoryEngineRemoteLaneAllowed" | "memoryEngineBackend" | "memoryScope" | "memoryPersistenceCapable" | "memorySync" | "memoryEmbedder" | "memoryOrgAdmissionMode" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "memoryConsolidationDriver" | "memoryOrgDirectoryJson" | "memoryOrgGrantTtlMs" | "memoryOrgUnavailableBackoffMs" | "projectMemoryEnabled" | "syncImportLeaseStaleSec">;
|
|
2176
|
-
/** 组:auth(鉴权 / 身份 / 治理棒)。`commandPolicy` 只有
|
|
2177
|
+
/** 组:auth(鉴权 / 身份 / 治理棒)。`commandPolicy` 只有 web-admin 腿(无 env 标量形),故 env 解析
|
|
2177
2178
|
* 函数不产出它,但它与 `autonomy` 是同一根治理棒的两半,归本组。
|
|
2178
2179
|
* [ref] 的三件部署治理声明(`compliancePosture`/`lockedConfigKeys`/`retentionPolicy`)同归本组:
|
|
2179
2180
|
* 三者都是 operator 在配置面写下的**治理声明**(与 autonomy/commandPolicy 同族),不是存储旋钮
|
|
@@ -2186,8 +2187,8 @@ export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "remoteExec" |
|
|
|
2186
2187
|
export type ServiceLimitsHttpConfig = Pick<ServiceConfigFlat, "port" | "attachmentOrphanGraceMs" | "workspaceFileMaxBytes" | "attachmentMaxBytes" | "attachmentMimeAllowlist" | "attachmentUnboundTtlMs" | "infraCostRates" | "drainGraceMs" | "drainSecondSignalMinGapMs" | "sighupIdleGraceMs" | "parentPid" | "engineAutoExit" | "engineLingerMs" | "engineOrphanLingerMs" | "rateLimitPerMin" | "maxTaskCostUsd" | "maxTaskTokens" | "maxPrincipalCostUsd" | "costQuotaWindowSec" | "reapIntervalSec" | "runStaleSec" | "toolResultTtlSec">;
|
|
2187
2188
|
/** 组:observability(可观测)。 */
|
|
2188
2189
|
export type ServiceObservabilityConfig = Pick<ServiceConfigFlat, "metricsToken" | "traceToken" | "toolTrace" | "traceThinking" | "logLevel" | "otel">;
|
|
2189
|
-
/** 组:integrations(外部集成)。`mcpServers` / `a2aPeers` 由
|
|
2190
|
-
export type ServiceIntegrationsConfig = Pick<ServiceConfigFlat, "pluginsAllowHosts" | "mcpServers" | "a2aPeers" | "a2aServe" | "configBootFetchBudgetMs" | "gitApiBaseUrl" | "gitApiToken" | "gitApiKind" | "defaultScenario" | "skillsDir" | "centerCredentialRenewLeadMs" | "
|
|
2190
|
+
/** 组:integrations(外部集成)。`mcpServers` / `a2aPeers` 由 web-admin 适配器填(无 env 腿),归本组。 */
|
|
2191
|
+
export type ServiceIntegrationsConfig = Pick<ServiceConfigFlat, "pluginsAllowHosts" | "mcpServers" | "a2aPeers" | "a2aServe" | "configBootFetchBudgetMs" | "gitApiBaseUrl" | "gitApiToken" | "gitApiKind" | "defaultScenario" | "skillsDir" | "centerCredentialRenewLeadMs" | "webAdmin" | "fleetLeaseFailClosed" | "fleetGeneration" | "fleetScope" | "fleetAdvertiseAddress" | "fleetLeaseOutageMaxMs" | "configProvider" | "configLocalDir">;
|
|
2191
2192
|
/** 九个组槽。每组恒在场(`loadConfig` / `attachConfigGroups` 装好才交出配置),故不可选——新代码写
|
|
2192
2193
|
* `config.modelPlane.model` 不需要 `?.`(可选组会把 `Model` 污染成 `Model | undefined`)。 */
|
|
2193
2194
|
export interface ServiceConfigGroups {
|