@sema-agent/server 7.123.0 → 7.124.1
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 +138 -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 +17 -15
- package/dist/trace/self-minted-wire.d.ts +134 -3
- package/dist/trace/self-minted-wire.js +46 -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
package/dist/trace/redact.d.ts
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* 这两条路径是「先脱敏、脱敏后的结果才给模型看」,与工具结果路径的方向相反,不要混淆。要让内容不出机器,
|
|
17
17
|
* 核对的是**该 run 实际选中的模型路由**——默认网关(`MODEL_GATEWAY_BASEURL`)只是其中一条:还有备用网关
|
|
18
18
|
* (`MODEL_GATEWAY_FALLBACK_URLS`)、`provider:"anthropic"` 的独立直连路由(缺省根
|
|
19
|
-
* `https://api.anthropic.com`,除非显式配 `ANTHROPIC_BASEURL`)
|
|
20
|
-
* per-model `baseUrl` 覆盖(见 `src/brain.ts` 的路由装配与 `src/
|
|
19
|
+
* `https://api.anthropic.com`,除非显式配 `ANTHROPIC_BASEURL`)、以及 web-admin 可对单个目录模型下发的
|
|
20
|
+
* per-model `baseUrl` 覆盖(见 `src/brain.ts` 的路由装配与 `src/web-admin-client/apply-effective.ts:416`)。
|
|
21
21
|
* 靠**读侧**敏感路径门与确保**全部**生效路由都指向自己控制的基础设施,不靠本模块、也不是设一根 env 就够。
|
|
22
22
|
*
|
|
23
23
|
* 🔴 **射程自 7.75.1 起含「模型自由文本」全族**(B-106 / S-268):本模块此前在结果面只管诊断/披露文本,
|
|
@@ -178,27 +178,6 @@ export declare function redactDeepWith(value: unknown, leaf: (s: string) => stri
|
|
|
178
178
|
* owner-scoped, so this preview is only ever shown to the ask's own principal (or an operator inspecting it).
|
|
179
179
|
*/
|
|
180
180
|
export declare function redactedPreview(value: unknown, cap?: number): string | null;
|
|
181
|
-
/**
|
|
182
|
-
* **这一位是不是一个层级式绝对 URL**(有 authority 的那一族)—— 本铸点与 `url-shape.ts` 的 http(s) 形判官
|
|
183
|
-
* (模型路由三键 / 中心基址三席 / 公告地址 / embedder / A2A 的拒启都经它问到这里)共用的**同一只**判据:两处曾各判各的,
|
|
184
|
-
* 而 `URL.canParse` 单独为真的**不透明** URL 恰好是「凭据位看不见」的那一形。
|
|
185
|
-
*
|
|
186
|
-
* ⚠️ **射程如实**(车JC 复审去幻觉轮:此处原文写的是「本仓唯一判据」,亲读证伪)—— 仓里**另有一处**仍用
|
|
187
|
-
* 裸 `URL.canParse` 回答同一个问题,且**刻意不在射程内**(改它是一次新的行为面拒启,按三问另开车):
|
|
188
|
-
* `config.ts` 的 `GIT_API_BASEURL`(`parseGitApiKind`):无协议闸 ⇒ 不透明形今天过门(拒因经本铸点,
|
|
189
|
-
* 所以不回显凭据;可用性由 `fetch` 那侧决定)。
|
|
190
|
-
* ✅ 原先列在这里的第二处(`config-catalog.ts` 的 `stripUrlUserinfo`:不透明形 `href === 原串` ⇒ 原样回显)
|
|
191
|
-
* 已在 7.90.0 随 core `displayUrlOf` 到货**闭环** —— 那只函数整只退役,url 型行的回显改走本铸点,
|
|
192
|
-
* 于是这道闸对它自动成立(catalog wire 行为面变更,CHANGELOG 已对外写明并点名 @web-admin)。
|
|
193
|
-
*
|
|
194
|
-
* 🔴 谓词写成 `URL.canParse` 而不是 try/catch:这一臂**不是兜底**(兜底才归静默降级那张表管),它是判据本身 ——
|
|
195
|
-
* 「不是一个层级式 URL」是一个可判的状态,用异常当控制流只会让它看起来像一次意外。
|
|
196
|
-
* 🔴 「解析得动」**不够**:`new URL("alice:hunter2@gw.internal:8000")` 是合法的**不透明** URL(`alice:` 当 scheme,
|
|
197
|
-
* 与 `mailto:` 同族)—— 它没有 authority,URL 律的锚(`scheme://`)对它不成立,`username`/`password` 恒空,
|
|
198
|
-
* 直接回原串就是密码明文(红先实测)。闸取「**层级式** URL」:`href` 以 `<protocol>//` 起头 ⇒ 有 authority
|
|
199
|
-
* ⇒ 三个凭据位都在律的射程内。
|
|
200
|
-
*/
|
|
201
|
-
export declare function isHierarchicalUrl(raw: string): boolean;
|
|
202
181
|
/**
|
|
203
182
|
* 🔴 **配置型 URL 上日志 / 诊断面的唯一 display-safe 铸点**(S-475 件B;`build*` = 返回纯数据的一只纯函数)。
|
|
204
183
|
*
|
package/dist/trace/redact.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { displayUrlOf, stripFormatCharacters } from "@sema-agent/core";
|
|
2
|
+
import { isHierarchicalUrl } from "@sema-agent/settings-schema";
|
|
2
3
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
3
4
|
export const normalizeForRedaction = stripFormatCharacters;
|
|
4
5
|
export const REDACTION_TOKEN_RE_SRC = String.raw `«redacted(?::[a-z-]{1,16}){0,2}»`;
|
|
@@ -209,19 +210,24 @@ function forgetEscapedSeparatorTails() {
|
|
|
209
210
|
escapedTailsText = undefined;
|
|
210
211
|
escapedTailsValue = undefined;
|
|
211
212
|
}
|
|
213
|
+
const UUID_SHAPE = "[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}";
|
|
214
|
+
const UUID_ALPHABET = "0123456789abcdefABCDEF-";
|
|
215
|
+
const notWholeUuid = (valueClass) => new RegExp(`^${valueClass}+$`).test(UUID_ALPHABET) ? `(?!${UUID_SHAPE}(?!${valueClass}))` : "";
|
|
212
216
|
const VALUE_ARM_STICKY = new Map();
|
|
213
217
|
const VALUE_ARM_BODIES = [];
|
|
214
218
|
const valueArm = (prefixSrc, valueClass, min, evidence) => {
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
const g = (() => {
|
|
219
|
+
const tail = `${twoStrongAhead(valueClass)}${atLeast(valueClass, min)}`;
|
|
220
|
+
const [body, g] = (() => {
|
|
218
221
|
switch (evidence) {
|
|
219
|
-
case "self-evident":
|
|
220
|
-
|
|
222
|
+
case "self-evident": {
|
|
223
|
+
const b = `${prefixSrc}${notWholeUuid(valueClass)}${tail}`;
|
|
224
|
+
return [b, new RegExp(b, "g")];
|
|
225
|
+
}
|
|
221
226
|
case "needs-left-boundary": {
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
const b = `${prefixSrc}${tail}`;
|
|
228
|
+
const re = new RegExp(`(?<!${WORD_INTERIOR_CLASS})${b}`, "g");
|
|
229
|
+
VALUE_ARM_STICKY.set(re, new RegExp(b, "y"));
|
|
230
|
+
return [b, re];
|
|
225
231
|
}
|
|
226
232
|
default: {
|
|
227
233
|
const unhandled = evidence;
|
|
@@ -229,6 +235,7 @@ const valueArm = (prefixSrc, valueClass, min, evidence) => {
|
|
|
229
235
|
}
|
|
230
236
|
}
|
|
231
237
|
})();
|
|
238
|
+
VALUE_ARM_BODIES.push(body);
|
|
232
239
|
return g;
|
|
233
240
|
};
|
|
234
241
|
let anyValueArm;
|
|
@@ -627,6 +634,7 @@ const KEYWORD_SECRET_PATTERNS = [
|
|
|
627
634
|
[keywordArm("Basic", "[A-Za-z0-9+/]", 16, "={0,2}"), "Basic «redacted»"],
|
|
628
635
|
[keywordArm("[Tt]oken", "[A-Za-z0-9._~+/-]", 20), "token «redacted»"],
|
|
629
636
|
];
|
|
637
|
+
const SK_FULL_ARM_MIN = 20;
|
|
630
638
|
const SHAPE_SECRET_PATTERNS = [
|
|
631
639
|
[new RegExp(String.raw `(?:ghp|gho|ghu|ghs|ghr)_${atLeast("[A-Za-z0-9]", 20)}`, "g"), "«redacted:gh-token»"],
|
|
632
640
|
[new RegExp(String.raw `github_pat_[A-Za-z0-9]{22}_${atLeast("[A-Za-z0-9]", 59)}`, "g"), "«redacted:gh-token»"],
|
|
@@ -635,7 +643,7 @@ const SHAPE_SECRET_PATTERNS = [
|
|
|
635
643
|
[new RegExp(String.raw `ASIA${atLeast("[0-9A-Z]", 16)}`, "g"), "«redacted:aws-key»"],
|
|
636
644
|
[new RegExp(String.raw `(?:gl(?:pat|dt|rt|rtr|cbt|ptt|oas|ft|imt|agent|wt|soat|ffct)-${atLeast("[A-Za-z0-9_-]", 20)}|(?:sk|rk)_(?:live|test|org)_${atLeast("[A-Za-z0-9]", 24)}|pypi-${atLeast("[A-Za-z0-9_-]", 85)})`, "g"), "«redacted:key»"],
|
|
637
645
|
[new RegExp(String.raw `xapp-\d-${atLeast("[A-Za-z0-9-]", 20)}`, "g"), "«redacted:slack-token»"],
|
|
638
|
-
[valueArm("sk-", "[A-Za-z0-9_-]",
|
|
646
|
+
[valueArm("sk-", "[A-Za-z0-9_-]", SK_FULL_ARM_MIN, "self-evident"), "«redacted:key»"],
|
|
639
647
|
];
|
|
640
648
|
const FULL_ARM_PATTERNS = [...STRUCTURAL_SECRET_PATTERNS, ...KEYWORD_SECRET_PATTERNS, ...SHAPE_SECRET_PATTERNS];
|
|
641
649
|
const PEM_HEADER_IDENT_MAX = 31;
|
|
@@ -1853,12 +1861,6 @@ export function redactedPreview(value, cap = 2000) {
|
|
|
1853
1861
|
s = redactSecrets(s, { json: true });
|
|
1854
1862
|
return s.length > cap ? `${s.slice(0, cap)}…[truncated]` : s;
|
|
1855
1863
|
}
|
|
1856
|
-
export function isHierarchicalUrl(raw) {
|
|
1857
|
-
if (!URL.canParse(raw))
|
|
1858
|
-
return false;
|
|
1859
|
-
const u = new URL(raw);
|
|
1860
|
-
return u.href.startsWith(`${u.protocol}//`);
|
|
1861
|
-
}
|
|
1862
1864
|
function decodeToFixedPoint(s, maxRounds = 3) {
|
|
1863
1865
|
let cur = s;
|
|
1864
1866
|
for (let round = 0; round < maxRounds; round += 1) {
|
|
@@ -3,6 +3,10 @@ export interface SelfMintedWireMember {
|
|
|
3
3
|
readonly attr: string | number;
|
|
4
4
|
readonly since: string;
|
|
5
5
|
}
|
|
6
|
+
/** 一个**退役**成员的登记:同 {@link SelfMintedWireMember},多一格 `until`(它退出 wire 的那一版;见文件头注 `retired`)。 */
|
|
7
|
+
export interface SelfMintedRetiredMember extends SelfMintedWireMember {
|
|
8
|
+
readonly until: string;
|
|
9
|
+
}
|
|
6
10
|
export declare const SELF_MINTED_WIRE: {
|
|
7
11
|
/** [ref](7.55.0)起的终态成因注;S-929(7.108.0)+`shutdown_before_park`。 */
|
|
8
12
|
readonly crashConvergedCause: {
|
|
@@ -128,12 +132,62 @@ export declare const SELF_MINTED_WIRE: {
|
|
|
128
132
|
};
|
|
129
133
|
};
|
|
130
134
|
/**
|
|
131
|
-
* 审批问的**无人决终态归因**:`POST /v1/tasks/:taskId/asks/:askId/decision` 410 `gone.ask` 体的 `
|
|
132
|
-
* 词表属主 = `approval-deny-reasons.ts` 的 `
|
|
135
|
+
* 审批问的**无人决终态归因**:`POST /v1/tasks/:taskId/asks/:askId/decision` 410 `gone.ask` 体的 `cause`(问账行 `denied_reason` 列原值)。
|
|
136
|
+
* 词表属主 = `approval-deny-reasons.ts` 的 `APPROVAL_ENDING_CAUSES`(落这一列的那一子集 `AskRowEndingCause`;`satisfies Record<AskRowEndingCause, …>`:表加词而本行没跟 ⇒ tsc 红)。
|
|
137
|
+
* 7.124.0:键名 `deniedReason` → `cause`(硬破坏,零别名;值域不变 + `run_exited` / `batch_sibling_withdrawn` 两个新词)—— 老成员的属性格因此从 `-` 变成 `key:cause`(清单记 `changed`)。
|
|
133
138
|
* 7.116.0 +2:启动收敛(承载它的进程没了)的两个词 —— 与 `crashConvergedCause` 同词(同一问在两个读面上一个成因)。
|
|
134
139
|
*/
|
|
135
140
|
readonly askTerminalReason: {
|
|
136
|
-
readonly at: "POST /v1/tasks/:taskId/asks/:askId/decision 410 gone.ask
|
|
141
|
+
readonly at: "POST /v1/tasks/:taskId/asks/:askId/decision 410 gone.ask cause";
|
|
142
|
+
readonly members: {
|
|
143
|
+
routing_failure_fail_closed: {
|
|
144
|
+
attr: string;
|
|
145
|
+
since: string;
|
|
146
|
+
};
|
|
147
|
+
run_cancelled: {
|
|
148
|
+
attr: string;
|
|
149
|
+
since: string;
|
|
150
|
+
};
|
|
151
|
+
run_exited: {
|
|
152
|
+
attr: string;
|
|
153
|
+
since: string;
|
|
154
|
+
};
|
|
155
|
+
batch_aborted: {
|
|
156
|
+
attr: string;
|
|
157
|
+
since: string;
|
|
158
|
+
};
|
|
159
|
+
batch_sibling_withdrawn: {
|
|
160
|
+
attr: string;
|
|
161
|
+
since: string;
|
|
162
|
+
};
|
|
163
|
+
batch_bound_elsewhere: {
|
|
164
|
+
attr: string;
|
|
165
|
+
since: string;
|
|
166
|
+
};
|
|
167
|
+
adhoc_leg_no_durable_domain: {
|
|
168
|
+
attr: string;
|
|
169
|
+
since: string;
|
|
170
|
+
};
|
|
171
|
+
orphan_ttl_exceeded: {
|
|
172
|
+
attr: string;
|
|
173
|
+
since: string;
|
|
174
|
+
};
|
|
175
|
+
crashed_before_park: {
|
|
176
|
+
attr: string;
|
|
177
|
+
since: string;
|
|
178
|
+
};
|
|
179
|
+
shutdown_before_park: {
|
|
180
|
+
attr: string;
|
|
181
|
+
since: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* 晚答 `POST /v1/tool-approvals/:id/respond` 的 `404 tool_approval.not_pending` 体的 `cause`:行 `VOID` / `DENIED` ⇒ 行上那个成因词(同决断口 410,同一列);
|
|
187
|
+
* 另有一个 404 专属词 `unknown_or_other_replica`(7.40.0 起,换副本 / 换端点重试才有意义)。7.124.0 起旧词 `voided` / `denied` 退役(被具体成因词取代,零别名)。
|
|
188
|
+
*/
|
|
189
|
+
readonly notPendingCause: {
|
|
190
|
+
readonly at: "POST /v1/tool-approvals/:id/respond 404 tool_approval.not_pending cause";
|
|
137
191
|
readonly members: {
|
|
138
192
|
routing_failure_fail_closed: {
|
|
139
193
|
attr: string;
|
|
@@ -143,10 +197,18 @@ export declare const SELF_MINTED_WIRE: {
|
|
|
143
197
|
attr: string;
|
|
144
198
|
since: string;
|
|
145
199
|
};
|
|
200
|
+
run_exited: {
|
|
201
|
+
attr: string;
|
|
202
|
+
since: string;
|
|
203
|
+
};
|
|
146
204
|
batch_aborted: {
|
|
147
205
|
attr: string;
|
|
148
206
|
since: string;
|
|
149
207
|
};
|
|
208
|
+
batch_sibling_withdrawn: {
|
|
209
|
+
attr: string;
|
|
210
|
+
since: string;
|
|
211
|
+
};
|
|
150
212
|
batch_bound_elsewhere: {
|
|
151
213
|
attr: string;
|
|
152
214
|
since: string;
|
|
@@ -167,6 +229,75 @@ export declare const SELF_MINTED_WIRE: {
|
|
|
167
229
|
attr: string;
|
|
168
230
|
since: string;
|
|
169
231
|
};
|
|
232
|
+
unknown_or_other_replica: {
|
|
233
|
+
attr: string;
|
|
234
|
+
since: string;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* 活卡结局帧 `tool_approval_complete` 的 additive `cause`(7.124.0):**非人结局在场、人答缺席**。值 = 审计 settle 行 `cause` 的同一个词(一个事实一个读法);
|
|
240
|
+
* 值域 = 非人结局的全部成因词(`SettleCause` = 闭集去掉决断口 409 的四个词)。键是本版新铸的 ⇒ 每个成员的属性格记 `key:cause`。
|
|
241
|
+
*/
|
|
242
|
+
readonly toolApprovalCompleteCause: {
|
|
243
|
+
readonly at: "tool_approval_complete frame cause";
|
|
244
|
+
readonly members: {
|
|
245
|
+
ttl_expired: {
|
|
246
|
+
attr: string;
|
|
247
|
+
since: string;
|
|
248
|
+
};
|
|
249
|
+
broadcast_lost: {
|
|
250
|
+
attr: string;
|
|
251
|
+
since: string;
|
|
252
|
+
};
|
|
253
|
+
stream_disconnected: {
|
|
254
|
+
attr: string;
|
|
255
|
+
since: string;
|
|
256
|
+
};
|
|
257
|
+
undeliverable: {
|
|
258
|
+
attr: string;
|
|
259
|
+
since: string;
|
|
260
|
+
};
|
|
261
|
+
run_cancelled: {
|
|
262
|
+
attr: string;
|
|
263
|
+
since: string;
|
|
264
|
+
};
|
|
265
|
+
run_exited: {
|
|
266
|
+
attr: string;
|
|
267
|
+
since: string;
|
|
268
|
+
};
|
|
269
|
+
batch_aborted: {
|
|
270
|
+
attr: string;
|
|
271
|
+
since: string;
|
|
272
|
+
};
|
|
273
|
+
batch_sibling_withdrawn: {
|
|
274
|
+
attr: string;
|
|
275
|
+
since: string;
|
|
276
|
+
};
|
|
277
|
+
batch_bound_elsewhere: {
|
|
278
|
+
attr: string;
|
|
279
|
+
since: string;
|
|
280
|
+
};
|
|
281
|
+
routing_failure_fail_closed: {
|
|
282
|
+
attr: string;
|
|
283
|
+
since: string;
|
|
284
|
+
};
|
|
285
|
+
crashed_before_park: {
|
|
286
|
+
attr: string;
|
|
287
|
+
since: string;
|
|
288
|
+
};
|
|
289
|
+
shutdown_before_park: {
|
|
290
|
+
attr: string;
|
|
291
|
+
since: string;
|
|
292
|
+
};
|
|
293
|
+
orphan_ttl_exceeded: {
|
|
294
|
+
attr: string;
|
|
295
|
+
since: string;
|
|
296
|
+
};
|
|
297
|
+
adhoc_leg_no_durable_domain: {
|
|
298
|
+
attr: string;
|
|
299
|
+
since: string;
|
|
300
|
+
};
|
|
170
301
|
};
|
|
171
302
|
};
|
|
172
303
|
/** 7.121.0:`GET /health` 自报位 `auth.kinds[]` 的成员(验过的身份来源闭集;这台部署的装配能回的那几个)。 */
|
|
@@ -48,16 +48,53 @@ export const SELF_MINTED_WIRE = {
|
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
askTerminalReason: {
|
|
51
|
-
at: "POST /v1/tasks/:taskId/asks/:askId/decision 410 gone.ask
|
|
51
|
+
at: "POST /v1/tasks/:taskId/asks/:askId/decision 410 gone.ask cause",
|
|
52
52
|
members: {
|
|
53
|
-
routing_failure_fail_closed: { attr: "
|
|
54
|
-
run_cancelled: { attr: "
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
routing_failure_fail_closed: { attr: "key:cause", since: "7.124.0" },
|
|
54
|
+
run_cancelled: { attr: "key:cause", since: "7.124.0" },
|
|
55
|
+
run_exited: { attr: "key:cause", since: "7.124.0" },
|
|
56
|
+
batch_aborted: { attr: "key:cause", since: "7.124.0" },
|
|
57
|
+
batch_sibling_withdrawn: { attr: "key:cause", since: "7.124.0" },
|
|
58
|
+
batch_bound_elsewhere: { attr: "key:cause", since: "7.124.0" },
|
|
59
|
+
adhoc_leg_no_durable_domain: { attr: "key:cause", since: "7.124.0" },
|
|
60
|
+
orphan_ttl_exceeded: { attr: "key:cause", since: "7.124.0" },
|
|
61
|
+
crashed_before_park: { attr: "key:cause", since: "7.124.0" },
|
|
62
|
+
shutdown_before_park: { attr: "key:cause", since: "7.124.0" },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
notPendingCause: {
|
|
66
|
+
at: "POST /v1/tool-approvals/:id/respond 404 tool_approval.not_pending cause",
|
|
67
|
+
members: {
|
|
68
|
+
routing_failure_fail_closed: { attr: "-", since: "7.124.0" },
|
|
69
|
+
run_cancelled: { attr: "-", since: "7.124.0" },
|
|
70
|
+
run_exited: { attr: "-", since: "7.124.0" },
|
|
71
|
+
batch_aborted: { attr: "-", since: "7.124.0" },
|
|
72
|
+
batch_sibling_withdrawn: { attr: "-", since: "7.124.0" },
|
|
73
|
+
batch_bound_elsewhere: { attr: "-", since: "7.124.0" },
|
|
74
|
+
adhoc_leg_no_durable_domain: { attr: "-", since: "7.124.0" },
|
|
75
|
+
orphan_ttl_exceeded: { attr: "-", since: "7.124.0" },
|
|
76
|
+
crashed_before_park: { attr: "-", since: "7.124.0" },
|
|
77
|
+
shutdown_before_park: { attr: "-", since: "7.124.0" },
|
|
78
|
+
unknown_or_other_replica: { attr: "-", since: "7.40.0" },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
toolApprovalCompleteCause: {
|
|
82
|
+
at: "tool_approval_complete frame cause",
|
|
83
|
+
members: {
|
|
84
|
+
ttl_expired: { attr: "key:cause", since: "7.124.0" },
|
|
85
|
+
broadcast_lost: { attr: "key:cause", since: "7.124.0" },
|
|
86
|
+
stream_disconnected: { attr: "key:cause", since: "7.124.0" },
|
|
87
|
+
undeliverable: { attr: "key:cause", since: "7.124.0" },
|
|
88
|
+
run_cancelled: { attr: "key:cause", since: "7.124.0" },
|
|
89
|
+
run_exited: { attr: "key:cause", since: "7.124.0" },
|
|
90
|
+
batch_aborted: { attr: "key:cause", since: "7.124.0" },
|
|
91
|
+
batch_sibling_withdrawn: { attr: "key:cause", since: "7.124.0" },
|
|
92
|
+
batch_bound_elsewhere: { attr: "key:cause", since: "7.124.0" },
|
|
93
|
+
routing_failure_fail_closed: { attr: "key:cause", since: "7.124.0" },
|
|
94
|
+
crashed_before_park: { attr: "key:cause", since: "7.124.0" },
|
|
95
|
+
shutdown_before_park: { attr: "key:cause", since: "7.124.0" },
|
|
96
|
+
orphan_ttl_exceeded: { attr: "key:cause", since: "7.124.0" },
|
|
97
|
+
adhoc_leg_no_durable_domain: { attr: "key:cause", since: "7.124.0" },
|
|
61
98
|
},
|
|
62
99
|
},
|
|
63
100
|
healthAuthKind: {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **「交给 `fetch` 的 http(s) URL」的拒句铸点**(S-1269 的展示半场)。判官本身 —— 这个值是不是层级式 http(s) URL、座位禁的部件
|
|
3
|
+
* (userinfo / query / fragment)在不在、每个拒因词的规则句 —— 是 settings-schema 的 URL 形判官(`httpUrlFlaws` / `httpUrlRule` /
|
|
4
|
+
* `HTTP_URL_SHAPE_RULE` / `isHierarchicalUrl`,11.0.0 由本仓的那一只 lift 过去、规则与拒因词闭集逐字搬);本仓**零第二份**形规则,
|
|
5
|
+
* 只留本仓自己的展示律:拒句里值的样子({@link buildRefusalShownUrl})与拒句的唯一铸点({@link buildHttpUrlRefusal})。
|
|
6
|
+
*
|
|
7
|
+
* ## 病(为什么拒句不回显 scheme)
|
|
8
|
+
* 值不带 `scheme://` 时 WHATWG 把冒号前那一段读成 scheme(不透明 URL,与 `mailto:` 同族):
|
|
9
|
+
* `registry-live.internal:8080` 的 scheme 是主机名,`<令牌>:<口令>@host:8080` 的 scheme 是**令牌**(字母开头、
|
|
10
|
+
* 只含 `[A-Za-z0-9+.-]` 的 48 位十六进制拉取令牌、`sk-…`、JWT 都满足),而且被小写化 —— 形状律
|
|
11
|
+
* (`redactSecrets`)因此认不出它。旧判官拒句里的 `(got "<scheme>")` 就把它整只写进了 fatal 行与 stderr。关掉它的唯一形是:
|
|
12
|
+
* 拒句从源头不含解析记号 —— 判官只给规则词,值只经本模块的展示律出现。
|
|
13
|
+
*
|
|
14
|
+
* ## 读者
|
|
15
|
+
* 中心基址三席 + 公告地址 + 请求期 `centerFetch`(`web-admin-client/center-request.ts` `pathBaseUrlRefusal`:禁 userinfo / query / fragment)·
|
|
16
|
+
* 续签 issuer(只问形)· 模型路由三键(`model-route-url.ts`:禁 userinfo / fragment,query 照收)· `MEMORY_EMBEDDER_ENDPOINT` 与
|
|
17
|
+
* `A2A_SERVE_URL`(禁 userinfo)。「scheme 只有判官与展示铸点读」由 `test/config-url-display-safe.test.ts` 的读者普查门钉住。
|
|
18
|
+
*/
|
|
19
|
+
import { type HttpUrlFlaw } from "@sema-agent/settings-schema";
|
|
20
|
+
/**
|
|
21
|
+
* 拒句里值的样子(纯函数):合格的 http(s) 形 ⇒ 只到 origin(`scheme://host[:port]`,过展示铸点),origin 之后还有东西(userinfo /
|
|
22
|
+
* 路径 / query / fragment)⇒ 接一枚 `/…`;其余(不透明 / 不可解析 / 层级式非 http(s))⇒ 展示铸点的占位 `«redacted:url»` ——
|
|
23
|
+
* 拒句里不出现非 http(s) 的 scheme 词(主会话增补裁:写成 scheme 的令牌 `<48hex>://host` 曾原样进 fatal 行)。
|
|
24
|
+
*
|
|
25
|
+
* 🔴 为什么只到 origin(车内 codex 对抗复审 r1 [high],亲跑复现):展示铸点的路径段**逐字**保留、只靠形状律认令牌形 ——
|
|
26
|
+
* 形状律认不出的令牌(48 位十六进制拉取令牌就是一例)放在路径上会原样进拒句。拒句落在 fatal 行、stderr、每一轮的请求失败日志,
|
|
27
|
+
* 这几处不赌形状律的覆盖面:座位名 + 规则词已经说清了哪一席错在哪,值只需要认得出是哪一台主机。
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildRefusalShownUrl(raw: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* 拒句的**唯一**铸点:`<subject> <规则句>[; <规则句>…]; got "<值的样子>"`(`build*` = 纯数据)。
|
|
32
|
+
* 值只经 {@link buildRefusalShownUrl} 出现;`flaws` 来自 settings-schema 的 `httpUrlFlaws`(调用方按首个拒因选自己的码与出路句)。
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildHttpUrlRefusal(subject: string, raw: string, flaws: readonly HttpUrlFlaw[]): string;
|
|
35
|
+
//# sourceMappingURL=url-refusal.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { httpUrlRule, isHierarchicalUrl } from "@sema-agent/settings-schema";
|
|
2
|
+
import { DISPLAY_SAFE_URL_TOKEN, buildDisplaySafeUrl } from "./trace/redact.js";
|
|
3
|
+
export function buildRefusalShownUrl(raw) {
|
|
4
|
+
if (!isHierarchicalUrl(raw))
|
|
5
|
+
return DISPLAY_SAFE_URL_TOKEN;
|
|
6
|
+
const u = new URL(raw);
|
|
7
|
+
if (u.protocol !== "http:" && u.protocol !== "https:")
|
|
8
|
+
return DISPLAY_SAFE_URL_TOKEN;
|
|
9
|
+
const origin = `${u.protocol}//${u.host}`;
|
|
10
|
+
return `${buildDisplaySafeUrl(origin)}${u.href === `${origin}/` ? "" : "/…"}`;
|
|
11
|
+
}
|
|
12
|
+
export function buildHttpUrlRefusal(subject, raw, flaws) {
|
|
13
|
+
return `${subject} ${flaws.map(httpUrlRule).join("; ")}; got ${JSON.stringify(buildRefusalShownUrl(raw))}`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=url-refusal.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** 非用户正文块的闭集标签(引擎 / 壳注入)。加一个标签 = 改这里一处:下面的正则由本表生成。 */
|
|
2
|
+
export declare const INJECTED_BLOCK_TAGS: readonly ["system-reminder", "task-notification", "attachment"];
|
|
3
|
+
/**
|
|
4
|
+
* 注入块的唯一一只正则(由 {@link INJECTED_BLOCK_TAGS} 生成)。**只配 `String.prototype.replace` 使用**(带 `g`,
|
|
5
|
+
* `lastIndex` 有状态,拿去 `.test` / `.exec` 会读到上一次的位置)。
|
|
6
|
+
*
|
|
7
|
+
* 属性位:引号感知 —— 引号内可以有 `>`(文件名的合法字符,XML 属性值也允许不转义),所以
|
|
8
|
+
* `<attachment path="a>b.ts" />` 的开标签在引号之后的 `/>` 才结束;引号外禁 `<` 与 `>`,引号内禁 `<`(XML 属性值本就须转义
|
|
9
|
+
* `<`;这条同时是线性的界:每个开标签的扫描最迟在下一个 `<` 处停)。引号不成对的开标签不算块,原样保留。
|
|
10
|
+
* 体位 `[\s\S]*?(?:<\/tag>|$)` 恒在末尾成功(未闭合形)。整串线性,没有二次方臂。
|
|
11
|
+
* 自闭合 `\/>` 排在体位 `>` 之前:`<attachment path="x" />` 不会被当成开标签吞到末尾。
|
|
12
|
+
*/
|
|
13
|
+
export declare const INJECTED_BLOCK_RE: RegExp;
|
|
14
|
+
/** 剥掉全部注入块(不 trim)。 */
|
|
15
|
+
export declare function stripInjectedBlocks(text: string): string;
|
|
16
|
+
/** 用户自己写的那部分:剥块 + trim。剥空 ⇒ `""`(调用方走各自「空 ⇒ 缺席 / 走下一条」的臂)。 */
|
|
17
|
+
export declare function userAuthoredText(text: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* 预览 = 用户正文 → 脱敏 → 截断(序固定)。`chars` 由调用面给(run 120 / leader 160 …,各面的长度常量仍在各自面)。
|
|
20
|
+
* 没有用户正文(剥空 / 全空白 / 空串)⇒ `""`:**建过预览、没有用户正文**是一件事实,落列就是空串;列上的 NULL 只说「没建过」
|
|
21
|
+
* (更早版本建的行 / 无列值)。两件事一个事实位,读面各按自己的契约分(展示名折成 `(notification turn)` / 展示位缺席 / 走上一条)。
|
|
22
|
+
*
|
|
23
|
+
* 序的理由:先剥 —— 注入块里的秘密形随块整块走掉,不靠脱敏;再脱敏 —— `redactSecrets` 只认已知凭据形,是尽力而为,
|
|
24
|
+
* 先截后脱会把一个被截断的凭据形漏出去;最后截。
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildObjectivePreview(text: string, chars: number): string;
|
|
27
|
+
/** run 行 `objective_preview` 的字符数(列宽 VARCHAR(160) 内留余量)。run 行的建行点(提交腿 `runMeta`、wake 续跑腿)与 run 名的取材共用这一个数。 */
|
|
28
|
+
export declare const RUN_OBJECTIVE_PREVIEW_CHARS = 120;
|
|
29
|
+
/** run 行的预览:用户写的那段 → 脱敏 → 截 {@link RUN_OBJECTIVE_PREVIEW_CHARS};没有用户正文 ⇒ `""`(列写空串 = 有记录、剥空)。 */
|
|
30
|
+
export declare function buildRunObjectivePreview(objective: string): string;
|
|
31
|
+
//# sourceMappingURL=user-authored-text.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { redactSecrets } from "./trace/redact.js";
|
|
2
|
+
export const INJECTED_BLOCK_TAGS = ["system-reminder", "task-notification", "attachment"];
|
|
3
|
+
export const INJECTED_BLOCK_RE = new RegExp(`<(${INJECTED_BLOCK_TAGS.join("|")})(?:\\s(?:[^<>"']|"[^"<]*"|'[^'<]*')*?)?(?:\\/>|>[\\s\\S]*?(?:<\\/\\1>|$))\\s*`, "g");
|
|
4
|
+
export function stripInjectedBlocks(text) {
|
|
5
|
+
return text.replace(INJECTED_BLOCK_RE, "");
|
|
6
|
+
}
|
|
7
|
+
export function userAuthoredText(text) {
|
|
8
|
+
return stripInjectedBlocks(text).trim();
|
|
9
|
+
}
|
|
10
|
+
export function buildObjectivePreview(text, chars) {
|
|
11
|
+
const own = userAuthoredText(text);
|
|
12
|
+
return own === "" ? "" : redactSecrets(own).slice(0, chars);
|
|
13
|
+
}
|
|
14
|
+
export const RUN_OBJECTIVE_PREVIEW_CHARS = 120;
|
|
15
|
+
export function buildRunObjectivePreview(objective) {
|
|
16
|
+
return buildObjectivePreview(objective, RUN_OBJECTIVE_PREVIEW_CHARS);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=user-authored-text.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* EffectiveConfig application — mutate the boot `ServiceConfig` OVER with a pulled `EffectiveConfig`
|
|
3
|
-
* (models/roles/tiers/projects `applyEffective`, the approval group +
|
|
4
|
-
* `applyRuntimeGates
|
|
5
|
-
* (`toModel`, `mutateInPlace`, `
|
|
3
|
+
* (models/roles/tiers/projects `applyEffective`, the approval group + the limits group
|
|
4
|
+
* `applyRuntimeGates` (governance approval + limits), the per-request-hot governance baton `applyRuntimeHot`) plus their shared helpers
|
|
5
|
+
* (`toModel`, `mutateInPlace`, `logEffectiveDiff`). Split out of `facade.ts`
|
|
6
6
|
* ([ref] A13, internal-lossless — the facade re-exports every symbol below unchanged).
|
|
7
7
|
*/
|
|
8
|
-
import type
|
|
8
|
+
import { type Model } from "@sema-agent/core";
|
|
9
9
|
import type { ServiceConfig } from "../config-types.js";
|
|
10
10
|
import type { SealedKeyOpener } from "../sealed-key.js";
|
|
11
11
|
import type { Logger } from "../observability/logger.js";
|
|
@@ -18,20 +18,6 @@ import { type ConfigApplyReport } from "./apply-ledger.js";
|
|
|
18
18
|
* `this.deps.models/roles/pricing` LIVE per-task and `/v1/models` reads `config.models` — both share the
|
|
19
19
|
* reference captured at boot, so mutating it (vs reassigning) updates both with no split, no Runner rebuild. */
|
|
20
20
|
export declare function mutateInPlace<V>(target: Record<string, V>, source: Record<string, V>): void;
|
|
21
|
-
/**
|
|
22
|
-
* [ref] / [ref] —— 无法解读的名单条目的**代表元**。
|
|
23
|
-
*
|
|
24
|
-
* 为什么需要它(codex 复审 R1 真 finding):把坏条目**丢掉**会让 `[7, null]` 这种「在场但一条都读不
|
|
25
|
-
* 懂」的名单塌成**空数组**,而空数组在消费端的语义恰恰是「治理关闭 = 全放行」—— 一个表达"我要限制"
|
|
26
|
-
* 的配置,因为写错了类型,反而把门整个打开。方向必须反过来:名单在场 = operator 意图限制;读不懂的
|
|
27
|
-
* 条目 ⇒ 换成一个**永不可能是 catalog name** 的代表元(前导 NUL,registry-core 的 name 词法不可能产
|
|
28
|
-
* 出),于是它在归一时解不到任何目录条目 ⇒ 谁都准不了。
|
|
29
|
-
*
|
|
30
|
-
* 后果是**有界的**:被拒的只有「用户逐 turn 显式点模型」这一件事;`default` / roles / 档位表照常,
|
|
31
|
-
* 任务照跑。写错配置的代价是"点不了模型"而不是"服务不可用",且 warn 当场点名成因。
|
|
32
|
-
* 🔴 只活在内存判定面:不进 wire(`/v1/models` 只发布尔)、不进日志(warn 打的是原始坏值的类型标记)。
|
|
33
|
-
*/
|
|
34
|
-
export declare const UNPARSABLE_AT_MODEL_ALLOWLIST_ENTRY = "\0<unparsable-at-model-allowlist-entry>";
|
|
35
21
|
/** 返回值=是否 COMMIT(false 两臂:[ref]③ 世代序 CAS 拒绝 / 7.10.0 swapPlane 换装拒绝——两臂都在
|
|
36
22
|
* commit 之前,活配置零触碰)。caller 收到 false 必须把**同一世代的旁路消费**(prompts 采用/pricing/
|
|
37
23
|
* keyResolver/etag 推进/LKG 落盘)一并跳过——否则 applyEffective 拒了主面、旁路却半应用同一个被拒
|
|
@@ -44,7 +30,7 @@ export interface ApplyReport extends ConfigApplyReport {
|
|
|
44
30
|
readonly fullyApplied: boolean;
|
|
45
31
|
/** S-768:本候选目录的模型拒因判决 —— 逐条(`entries`,stage 判出的那份候选的,键已过名筛)+ 组拒码(`plane`,模型面组被拒时在场,
|
|
46
32
|
* 判决那刻当数据带出)。落地与组拒同一只来源:两者都描述**这一份**候选(组拒时引擎自己的拒因表不换代,这里仍报被拒的那份)。
|
|
47
|
-
* 候选不管模型面(一条启用条目也没有 —— 幸存的与被丢的都算)⇒ `entries` 空、无 `plane`。`/health.modelRefusals` 与心跳的唯一数据源(
|
|
33
|
+
* 候选不管模型面(一条启用条目也没有 —— 幸存的与被丢的都算)⇒ `entries` 空、无 `plane`。`/health.modelRefusals` 与心跳的唯一数据源(web-admin 投影)。 */
|
|
48
34
|
readonly modelRefusals: ModelRefusalVerdict;
|
|
49
35
|
}
|
|
50
36
|
/**
|
|
@@ -81,7 +67,7 @@ export declare function applyEffective(config: ServiceConfig, eff: EffectiveConf
|
|
|
81
67
|
* 读者一律从这里派生,禁手抄:
|
|
82
68
|
* · stage:{@link stageModelPlane} 产出组内**每个**域的产物({@link ModelPlaneStages} 按本表映射),组被拒 ⇒ 一个域都没有;
|
|
83
69
|
* · 世代账:整组拒的 `keys` 与落地的 `applied` 都由 {@link MODEL_PLANE_SURFACES} 按本表派生({@link modelPlaneGroupReport});
|
|
84
|
-
* · boot 按组回落 LKG 的合成文档:{@link withModelPlaneOf}(`boot/
|
|
70
|
+
* · boot 按组回落 LKG 的合成文档:{@link withModelPlaneOf}(`boot/web-admin.ts`)。
|
|
85
71
|
* (与 `config.ts` 的配置组视图 `MODEL_PLANE_GROUP_KEYS` 不是一回事:那是 `ServiceConfig` 的分节视图;这里是「中心热应用的
|
|
86
72
|
* 模型面这一组包含哪些 effective 域」。)
|
|
87
73
|
*/
|
|
@@ -120,72 +106,29 @@ export declare const PLANE_REFUSAL_INVARIANT_OF: {
|
|
|
120
106
|
readonly "config.model_route_endpoint_missing": "model-route-endpoint";
|
|
121
107
|
readonly "config.gateway_fallback_without_primary": "model-route-endpoint";
|
|
122
108
|
};
|
|
123
|
-
/**
|
|
124
|
-
* UNIFORM presence semantics across the center gates (center `f95438a` adopted this from our sentinel flag —
|
|
125
|
-
* SERVICE-INTEGRATION「Runtime 治理/限额闸」): every gate field is center `.optional()`, so
|
|
126
|
-
* `undefined` = center isn't managing it → KEEP env;
|
|
127
|
-
* present (any value, INCLUDING an explicit 0 / [] = "publish the gate OFF") → OVERRIDE env.
|
|
128
|
-
* (Earlier center had `rateLimitPerMin`/`approvalRequire` as `.default(0/[])`, which would have let a default
|
|
129
|
-
* silently disable an env-set gate — we flagged it, center made them optional, so a plain presence rule is
|
|
130
|
-
* now both correct and uniform. No sentinel special-casing.)
|
|
131
|
-
*
|
|
132
|
-
* Only guard: `costQuotaWindowSec` must be `> 0` (a 0 window is nonsensical — core divides by it). Center's
|
|
133
|
-
* schema is `.positive()` so it can't send 0; this is belt-and-suspenders.
|
|
134
|
-
*
|
|
135
|
-
* Per-worker overrides ride the per-worker `/effective?worker=` response (center merges WorkerSpec.runtime over
|
|
136
|
-
* the fleet default server-side), so this single "effective beats env" rule already honors per-worker > fleet.
|
|
137
|
-
*/
|
|
138
|
-
/** `runtime` 域的限额五闸(= settings-schema `RuntimeConfig` 的全部键,[ref] 件3 对账门钉集合等式),ONE place:
|
|
139
|
-
* legacy 位的 presence 判据({@link runtimeGatePresent} → stage-limits 的 `legacyGates`)、config-catalog 的
|
|
140
|
-
* center 在管键、dry-run 现值快照都从这一张表派生。[ref] 批1 起五键**全热**(属主 stage-limits,boot+refresh
|
|
141
|
-
* 双腿),所以本表与 restart-to-apply 再无关系——审批闸不在这里:它住 governance 域({@link stageApprovalGate})。 */
|
|
142
|
-
export declare const RUNTIME_GATE_KEYS: readonly ["rateLimitPerMin", "maxTaskCostUsd", "maxTaskTokens", "maxPrincipalCostUsd", "costQuotaWindowSec"];
|
|
143
|
-
export type RuntimeGateKey = (typeof RUNTIME_GATE_KEYS)[number];
|
|
144
|
-
/** Uniform presence rule (center f95438a) for the `runtime` limit gates: "managed" when the field is present —
|
|
145
|
-
* any number (incl. 0). Sole guard: costQuotaWindowSec must be > 0 (a 0 window is nonsensical — core divides by
|
|
146
|
-
* it; center's `.positive()` already enforces, belt-and-suspenders here). The approval gate's presence rule
|
|
147
|
-
* (`Array.isArray`) lives with its owner, {@link stageApprovalGate}. */
|
|
148
109
|
/**
|
|
149
110
|
* DESIGN-278 §5 S2([ref])—— center 这份 effective **当前在管**哪些 `ServiceConfig` 键(配置目录端点
|
|
150
111
|
* `GET /v1/config/catalog` 判 `effectiveLane` 的 center 半场)。
|
|
151
112
|
*
|
|
152
113
|
* 判据与各消费腿**同源**,不自铸第二份:
|
|
153
114
|
* · limits 域 = `hasOwnProperty`(stage-limits 的 published 判据逐字——present 含显式 0);
|
|
154
|
-
* · 六闸 legacy 位 = {@link runtimeGatePresent}(旧位 presence 规则的唯一属主);
|
|
155
115
|
* · governance 三件(autonomy / commandPolicy / approvalRequire)= 键在场(applyRuntimeHot 与 stageApprovalGate
|
|
156
116
|
* 的 non-sticky presence 判据同门:`!== undefined`);
|
|
157
117
|
* · readFace 域成员 = 键在场(read-face.ts 的逐键 env-wins 合成看的就是成员在场性);
|
|
158
|
-
* · models 面 = 有启用行(markRosterLanded 同判据);
|
|
118
|
+
* · models 面 = 有启用行(markRosterLanded 同判据);atMention 单列(整只重算键;座位在场即在管 —— 11.x 的读腿恒物化它)。
|
|
159
119
|
* 纯投影零副作用;`undefined` eff(还没拉到 / 纯 env 形)⇒ 空集。
|
|
160
120
|
*/
|
|
161
121
|
export declare function centerManagedConfigKeys(eff: EffectiveConfig | undefined): ReadonlySet<string>;
|
|
162
|
-
export declare function runtimeGatePresent(rt: NonNullable<EffectiveConfig["runtime"]>, key: RuntimeGateKey): boolean;
|
|
163
122
|
/** 独立调用面的兼容壳(测试/外部):stage → 就地赋值 → 通知。applyEffective 不走这里——它把
|
|
164
|
-
* 赋值并进自己的 commit 段以保住整世代原子性([ref]②)。入参是 eff 的两个域(
|
|
165
|
-
*
|
|
166
|
-
* [ref]
|
|
167
|
-
* 的函数会静默漏掉五个限额键(比改名更坏的那种沉默)。S-668 波 2:审批组的判据依赖腿(④ 只在热腿判),
|
|
123
|
+
* 赋值并进自己的 commit 段以保住整世代原子性([ref]②)。入参是 eff 的两个域(审批闸住 governance,
|
|
124
|
+
* 限额键住 limits —— 各自的属主判据,这里不合成视图;settings-schema 11 退役了 `runtime` 域)。
|
|
125
|
+
* [ref]:限额键的属主是热腿,所以本壳**同样**要过 stage-limits。S-668 波 2:审批组的判据依赖腿(④ 只在热腿判),
|
|
168
126
|
* 所以本壳与 applyEffective 一样**必须**说是哪条腿。 */
|
|
169
|
-
export declare function applyRuntimeGates(config: ServiceConfig, eff: Pick<EffectiveConfig, "
|
|
127
|
+
export declare function applyRuntimeGates(config: ServiceConfig, eff: Pick<EffectiveConfig, "limits" | "governance"> | undefined, leg: ApplyLeg, logger?: Logger): void;
|
|
170
128
|
export declare function applyRuntimeHot(config: ServiceConfig, gov: EffectiveConfig["governance"], logger?: Logger): void;
|
|
171
129
|
/**
|
|
172
|
-
*
|
|
173
|
-
* (
|
|
174
|
-
* 1) eff.models.default 结构键 —— ✅ 既得路径([ref] registry-core 0.10.11 落 `default?: string` schema
|
|
175
|
-
* 键+per-worker /effective 直通;本地 lane 由 config-provider mapToServiceEffective 直通)。写面悬空 ref
|
|
176
|
-
* 由 registry-core superRefine fail-loud;存量/未经 schema 路径仍走本函数的 warn 降级(双层姿势与
|
|
177
|
-
* activeTierGroup 同构)。(1.200-1.202 期间此级恒空=当时如实的前行 seam,codex H2 注记已兑现。)
|
|
178
|
-
* 2) roles.default 的显式 {model} 绑定(现有 wire 真源)。
|
|
179
|
-
* 3) activeTierGroup 档绑定,按 {@link DEFAULT_ROLE_TIER_LADDER}(= core 对 "default" 角色的档语义)。
|
|
180
|
-
* 4) fallback(enabled[0]——原兜底,唯一不触发 onDangling 的落点)。
|
|
181
|
-
*/
|
|
182
|
-
export declare function resolveDefaultModelName(eff: EffectiveConfig, has: (name: string) => boolean, fallback: string, onDangling?: (source: string, name: string) => void): {
|
|
183
|
-
name: string;
|
|
184
|
-
source: string;
|
|
185
|
-
};
|
|
186
|
-
/**
|
|
187
|
-
* Read-only comparison (SEMA_REGISTRY_DRY_RUN): log what the center config WOULD change vs the current
|
|
188
|
-
* (env-derived) config, WITHOUT applying it. The safe-rollout step the config-center recommends — verify
|
|
130
|
+
* Read-only comparison (`WEB_ADMIN_ENV.dryRun`): log what the web-admin config WOULD change vs the current
|
|
131
|
+
* (env-derived) config, WITHOUT applying it. The safe-rollout step the web-admin recommends — verify
|
|
189
132
|
* the center's models/roles/collab match (or intentionally differ from) the env baseline before going live.
|
|
190
133
|
*/
|
|
191
134
|
export declare function logEffectiveDiff(config: ServiceConfig, eff: EffectiveConfig, logger?: Logger): void;
|