@sema-agent/server 7.122.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 +209 -0
- package/README.md +7 -2
- package/README.zh-CN.md +5 -2
- package/USAGE.md +76 -56
- 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.d.ts +1 -1
- package/dist/audit.js +53 -23
- 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 +13 -9
- package/dist/auto-mode-face.js +8 -7
- 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} +39 -20
- 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 +16 -16
- 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 +34 -11
- package/dist/config-lkg.js +76 -48
- package/dist/config-provider.d.ts +26 -21
- package/dist/config-provider.js +25 -27
- package/dist/config-types.d.ts +59 -50
- package/dist/config.d.ts +17 -54
- package/dist/config.js +99 -181
- 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 +61 -30
- package/dist/fleet/engine-signal.js +29 -5
- 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 +15 -13
- package/dist/fleet-client.js +9 -7
- 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 +7 -16
- package/dist/http/durable-run-leg.js +2 -1
- package/dist/http/health-self-report.d.ts +7 -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 +6 -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 +2 -5
- 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.d.ts +4 -3
- package/dist/http/stored-body-replay.js +5 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/key-resolver.d.ts +1 -1
- package/dist/leader/leader.d.ts +7 -6
- package/dist/leader/leader.js +3 -1
- package/dist/leader/run-entry.d.ts +2 -2
- package/dist/leader/run-entry.js +3 -3
- package/dist/leader/wire.d.ts +4 -4
- 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 +20 -11
- package/dist/model-entry-refusal.js +22 -17
- package/dist/model-provider.d.ts +2 -2
- package/dist/model-route-endpoint.d.ts +22 -2
- package/dist/model-route-endpoint.js +9 -3
- package/dist/model-route-gap.d.ts +103 -0
- package/dist/model-route-gap.js +80 -0
- 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/namespaced-rule-name.d.ts +16 -30
- package/dist/namespaced-rule-name.js +2 -20
- package/dist/observability/fail-open.d.ts +0 -4
- package/dist/observability/fail-open.js +0 -4
- 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 +51 -0
- package/dist/plugins/scheduler-support.d.ts +26 -7
- package/dist/plugins/scheduler-support.js +96 -53
- package/dist/plugins/session-policy-store-sql.js +1 -2
- 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/plugins/workflow-run-store-sql.d.ts +4 -2
- 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/rule-entry-list.d.ts +3 -13
- package/dist/rule-entry-list.js +1 -12
- package/dist/run-local.js +10 -7
- package/dist/runtime-caps-resolver.d.ts +4 -4
- package/dist/runtime-caps-resolver.js +2 -2
- package/dist/runtime-governance.d.ts +36 -13
- package/dist/runtime-governance.js +7 -2
- 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-policy-wire.d.ts +47 -49
- package/dist/session-policy-wire.js +41 -36
- package/dist/session-sync.d.ts +5 -1
- package/dist/session-sync.js +2 -1
- 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/spec-fields.d.ts +4 -4
- package/dist/spec-fields.js +1 -4
- package/dist/task-a2a.d.ts +1 -1
- package/dist/task-settings.d.ts +4 -5
- package/dist/task-settings.js +5 -8
- 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/unattended-permission-mode.d.ts +3 -3
- package/dist/unattended-permission-mode.js +2 -2
- 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 +104 -121
- 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 +15 -15
- 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/web-admin-client/read-warnings.d.ts +137 -0
- package/dist/web-admin-client/read-warnings.js +168 -0
- 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 +19 -47
- package/package.json +3 -3
- package/skills/find-skills.md +2 -2
- package/dist/config-center/read-warnings.d.ts +0 -109
- package/dist/config-center/read-warnings.js +0 -110
- 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
|
@@ -18,7 +18,7 @@ export async function applyCenterSkills(baseline, manifest, center, logger, fetc
|
|
|
18
18
|
const text = await fsp.readFile(joinPath(diskCacheDir, hex), "utf8");
|
|
19
19
|
if (skillContentHash(text) === hash)
|
|
20
20
|
return text;
|
|
21
|
-
logger?.warn("
|
|
21
|
+
logger?.warn("web_admin_skill_cache_corrupt", { hash, note: "on-disk body fails its own hash — ignored, refetching from center" });
|
|
22
22
|
}
|
|
23
23
|
catch {
|
|
24
24
|
}
|
|
@@ -34,7 +34,7 @@ export async function applyCenterSkills(baseline, manifest, center, logger, fetc
|
|
|
34
34
|
const tmp = joinPath(diskCacheDir, `${hex}.${Math.random().toString(36).slice(2, 8)}.tmp`);
|
|
35
35
|
await fsp.writeFile(tmp, content, { mode: 0o600 });
|
|
36
36
|
await fsp.rename(tmp, joinPath(diskCacheDir, hex));
|
|
37
|
-
})().catch((err) => logger?.warn("
|
|
37
|
+
})().catch((err) => logger?.warn("web_admin_skill_cache_write_failed", { hash, err: String(err) })));
|
|
38
38
|
};
|
|
39
39
|
const byName = new Map(baseline.map((s) => [s.spec.name, s]));
|
|
40
40
|
const contentCache = new Map();
|
|
@@ -43,7 +43,7 @@ export async function applyCenterSkills(baseline, manifest, center, logger, fetc
|
|
|
43
43
|
if (m.enabled === false)
|
|
44
44
|
continue;
|
|
45
45
|
if (seenNames.has(m.name))
|
|
46
|
-
logger?.warn("
|
|
46
|
+
logger?.warn("web_admin_skill_duplicate_name", { name: m.name, note: "duplicate name in center manifest — last entry wins" });
|
|
47
47
|
seenNames.add(m.name);
|
|
48
48
|
try {
|
|
49
49
|
let content = contentCache.get(m.contentHash);
|
|
@@ -56,16 +56,16 @@ export async function applyCenterSkills(baseline, manifest, center, logger, fetc
|
|
|
56
56
|
contentCache.set(m.contentHash, content);
|
|
57
57
|
const overrodeBuiltin = byName.has(m.name);
|
|
58
58
|
byName.set(m.name, { spec: { name: m.name, description: m.description, content }, scenarios: m.scenarios ?? [] });
|
|
59
|
-
logger?.info("
|
|
59
|
+
logger?.info("web_admin_skill", { name: m.name, hash: m.contentHash, scenarios: m.scenarios, overrodeBuiltin });
|
|
60
60
|
}
|
|
61
61
|
catch (err) {
|
|
62
|
-
logger?.warn("
|
|
62
|
+
logger?.warn("web_admin_skill_failed", { name: m.name, hash: m.contentHash, err: String(err), note: "keeping baseline if any; skipping center version" });
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
await Promise.all(pendingWrites);
|
|
66
66
|
return [...byName.values()];
|
|
67
67
|
}
|
|
68
|
-
function resolveRefs(refs, server, kind, logger, event = "
|
|
68
|
+
function resolveRefs(refs, server, kind, logger, event = "web_admin_mcp_env_missing", skipNote = "skipping this MCP server — referenced env var is unset in this service") {
|
|
69
69
|
if (!refs)
|
|
70
70
|
return {};
|
|
71
71
|
const out = {};
|
|
@@ -86,7 +86,7 @@ export function resolveMcpServers(mcp, logger) {
|
|
|
86
86
|
if (s.enabled === false)
|
|
87
87
|
continue;
|
|
88
88
|
if (!isUsableWireName(s.name)) {
|
|
89
|
-
logger?.warn("
|
|
89
|
+
logger?.warn("web_admin_mcp_name_unusable", {
|
|
90
90
|
server: describeBadWireName(s.name),
|
|
91
91
|
note: "server SKIPPED — an MCP server name is its identity (it becomes the tool namespace prefix) and core REFUSES an out-of-bound name at prepare, which would fail every task in this scenario. Shorten the name and republish; sibling servers are unaffected.",
|
|
92
92
|
});
|
|
@@ -99,7 +99,7 @@ export function resolveMcpServers(mcp, logger) {
|
|
|
99
99
|
if (isContentOriginWord(s.contentOrigin))
|
|
100
100
|
contentOrigin = { contentOrigin: s.contentOrigin };
|
|
101
101
|
else
|
|
102
|
-
logger?.warn("
|
|
102
|
+
logger?.warn("web_admin_mcp_content_class_invalid", {
|
|
103
103
|
server: s.name,
|
|
104
104
|
value: describeBadContentOrigin(s.contentOrigin),
|
|
105
105
|
allowed: CONTENT_ORIGIN_WORDS,
|
|
@@ -109,7 +109,7 @@ export function resolveMcpServers(mcp, logger) {
|
|
|
109
109
|
const source = readMcpSourceLabel(s.name, s.source);
|
|
110
110
|
const facesRead = readMcpToolFaces(s.toolFaces);
|
|
111
111
|
if (!facesRead.ok) {
|
|
112
|
-
logger?.warn("
|
|
112
|
+
logger?.warn("web_admin_mcp_tool_faces_invalid", {
|
|
113
113
|
server: s.name,
|
|
114
114
|
problem: facesRead.problem,
|
|
115
115
|
note: "server SKIPPED — a toolFaces overlay is a NARROWING declaration (its pathTarget is what the sensitive-path / write fences read); mounting the server without it would silently drop the protection you declared. Fix the entry and republish.",
|
|
@@ -137,7 +137,7 @@ export function resolveMcpServers(mcp, logger) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
if (out.length > 0)
|
|
140
|
-
logger?.info("
|
|
140
|
+
logger?.info("web_admin_mcp", { servers: out.map((s) => s.spec.name) });
|
|
141
141
|
return { servers: out, reservedNames };
|
|
142
142
|
}
|
|
143
143
|
export function mcpForScenario(center, scenario) {
|
|
@@ -153,13 +153,13 @@ export function resolveA2aPeers(a2a, logger) {
|
|
|
153
153
|
if (p.enabled === false)
|
|
154
154
|
continue;
|
|
155
155
|
if (!isUsableWireName(p.name)) {
|
|
156
|
-
logger?.warn("
|
|
156
|
+
logger?.warn("web_admin_a2a_name_unusable", {
|
|
157
157
|
peer: describeBadWireName(p.name),
|
|
158
158
|
note: "peer SKIPPED — an A2A peer name is its identity (it lands as the roster's `origin.peer`) and core REFUSES an out-of-bound name at prepare, which would fail every task in this scenario. Shorten the name and republish; sibling peers are unaffected.",
|
|
159
159
|
});
|
|
160
160
|
continue;
|
|
161
161
|
}
|
|
162
|
-
const headers = resolveRefs(p.headerRefs, p.name, "header", logger, "
|
|
162
|
+
const headers = resolveRefs(p.headerRefs, p.name, "header", logger, "web_admin_a2a_env_missing", "skipping this A2A peer — referenced env var is unset in this service");
|
|
163
163
|
if (headers === null)
|
|
164
164
|
continue;
|
|
165
165
|
out.push({
|
|
@@ -175,7 +175,7 @@ export function resolveA2aPeers(a2a, logger) {
|
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
if (out.length > 0)
|
|
178
|
-
logger?.info("
|
|
178
|
+
logger?.info("web_admin_a2a", { peers: out.map((p) => p.spec.name) });
|
|
179
179
|
return out;
|
|
180
180
|
}
|
|
181
181
|
export function a2aForScenario(peers, scenario) {
|
|
@@ -17,17 +17,11 @@ import type { Logger } from "../observability/logger.js";
|
|
|
17
17
|
import { type Batch1LimitKey } from "./hot-keys-registry.js";
|
|
18
18
|
import type { EffectiveLimits } from "./types.js";
|
|
19
19
|
/**
|
|
20
|
-
* stage
|
|
21
|
-
*
|
|
22
|
-
* 🔴 `legacyGates` 是**已过旧位 presence 判据**的闸值(判据属主 = `runtimeGatePresent`,调用方过一遍再传)。
|
|
23
|
-
* 两位刻意判据不同,不是疏忽:旧位(`runtime`)的容忍语义(例如 `costQuotaWindowSec: 0` 判「缺席」保 env)
|
|
24
|
-
* 是既有 center 的在营契约,收紧它会把一个存量发布变成整批拒;新位(`limits`)从第一天起就是严判
|
|
25
|
-
* (坏值 = 整批响亮拒)。判据属主各只有一个,谁都没有被复刻第二份。
|
|
20
|
+
* stage 的入参视图:`limits` 域是这些键的**唯一**发布位(settings-schema 11 退役了 `runtime` 域,它的旧位读法随之删)。
|
|
26
21
|
*/
|
|
27
22
|
export interface LimitsSource {
|
|
28
23
|
readonly version: number;
|
|
29
24
|
readonly limits?: EffectiveLimits;
|
|
30
|
-
readonly legacyGates?: Readonly<Record<string, unknown>>;
|
|
31
25
|
}
|
|
32
26
|
/** 逐键 defer 的铸因(codex R2-F2):值合法但这一键**不热**,变更只能重启生效。 */
|
|
33
27
|
export interface DeferredLimit {
|
|
@@ -69,7 +69,6 @@ function candidateView(config, assignments) {
|
|
|
69
69
|
}
|
|
70
70
|
export function stageLimits(config, eff, logger) {
|
|
71
71
|
const baseline = baselineOf(config);
|
|
72
|
-
const legacy = eff.legacyGates ?? {};
|
|
73
72
|
const assignments = [];
|
|
74
73
|
const deletions = [];
|
|
75
74
|
const changed = [];
|
|
@@ -79,7 +78,7 @@ export function stageLimits(config, eff, logger) {
|
|
|
79
78
|
const rawLimits = eff.limits;
|
|
80
79
|
if (rawLimits !== undefined && (rawLimits === null || typeof rawLimits !== "object" || Array.isArray(rawLimits))) {
|
|
81
80
|
const rejected = { keys: [...BATCH1_LIMIT_KEYS], reason: `the published limits domain must be a JSON object — got ${rawLimits === null ? "null" : Array.isArray(rawLimits) ? "array" : typeof rawLimits}` };
|
|
82
|
-
logger?.warn("
|
|
81
|
+
logger?.warn("web_admin_limits_invalid", {
|
|
83
82
|
...rejected,
|
|
84
83
|
version: eff.version,
|
|
85
84
|
kept: "the whole limits batch is refused — a malformed container must never read as 'the center manages none of these keys' (that would silently revert every published ceiling to the env baseline)",
|
|
@@ -91,7 +90,7 @@ export function stageLimits(config, eff, logger) {
|
|
|
91
90
|
const known = new Set([...BATCH1_LIMIT_KEYS, ...DEFERRED_LIMIT_KEYS.map((d) => d.key)]);
|
|
92
91
|
const unconsumed = Object.keys(limits).filter((k) => !known.has(k));
|
|
93
92
|
if (unconsumed.length > 0) {
|
|
94
|
-
logger?.warn("
|
|
93
|
+
logger?.warn("web_admin_limits_unconsumed_keys", {
|
|
95
94
|
keys: unconsumed,
|
|
96
95
|
version: eff.version,
|
|
97
96
|
note: "published in the limits domain but not consumed by this server build (misspelled, or a later-batch key) — the value is inert until a batch that owns it ships",
|
|
@@ -99,7 +98,7 @@ export function stageLimits(config, eff, logger) {
|
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
100
|
for (const key of BATCH1_LIMIT_KEYS) {
|
|
102
|
-
const published = limits !== undefined && Object.prototype.hasOwnProperty.call(limits, key) ? limits[key] :
|
|
101
|
+
const published = limits !== undefined && Object.prototype.hasOwnProperty.call(limits, key) ? limits[key] : undefined;
|
|
103
102
|
let next;
|
|
104
103
|
if (published === undefined) {
|
|
105
104
|
next = baseline[key];
|
|
@@ -129,7 +128,7 @@ export function stageLimits(config, eff, logger) {
|
|
|
129
128
|
}
|
|
130
129
|
if (badKeys.length > 0) {
|
|
131
130
|
const rejected = { keys: badKeys, reason: reason };
|
|
132
|
-
logger?.warn("
|
|
131
|
+
logger?.warn("web_admin_limits_invalid", {
|
|
133
132
|
...rejected,
|
|
134
133
|
version: eff.version,
|
|
135
134
|
kept: "the whole limits batch is refused — the prior values keep serving (a half-applied limit face means the published numbers and the live gate are different generations)",
|
|
@@ -140,7 +139,7 @@ export function stageLimits(config, eff, logger) {
|
|
|
140
139
|
if (!verdict.ok) {
|
|
141
140
|
const involved = changed.length > 0 ? changed : BATCH1_LIMIT_KEYS.slice();
|
|
142
141
|
const rejected = { keys: [...involved], reason: verdict.reason, restartReason: verdict.restartReason };
|
|
143
|
-
logger?.warn("
|
|
142
|
+
logger?.warn("web_admin_limits_invalid", {
|
|
144
143
|
...rejected,
|
|
145
144
|
invariant: verdict.id,
|
|
146
145
|
version: eff.version,
|
|
@@ -149,7 +148,7 @@ export function stageLimits(config, eff, logger) {
|
|
|
149
148
|
return { assignments: [], deletions: [], changed: [], deferred: [], rejected };
|
|
150
149
|
}
|
|
151
150
|
if (deferred.length > 0) {
|
|
152
|
-
logger?.warn("
|
|
151
|
+
logger?.warn("web_admin_limits_deferred", {
|
|
153
152
|
keys: deferred.map((d) => d.key),
|
|
154
153
|
version: eff.version,
|
|
155
154
|
reasons: [...new Set(DEFERRED_LIMIT_KEYS.filter((d) => deferred.some((x) => x.key === d.key)).map((d) => d.why))],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* web-admin wire types — the web-admin `/api/config/effective` payload shapes (`CenterModel`,
|
|
3
3
|
* `CenterSkillManifest`, `CenterMcpServer`, `CenterA2aPeer`, `EffectiveConfig`) plus the per-principal
|
|
4
4
|
* execution/session-mirror ruling shapes riding the caps view (`ExecutionRuling`/`SessionMirrorRuling`).
|
|
5
5
|
* Pure type/interface declarations — no runtime logic. Split out of `facade.ts` ([ref] A13,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { ToolContentOrigin } from "@sema-agent/core";
|
|
9
9
|
import type { CollabTemplateWire } from "../capabilities/collab-wire.js";
|
|
10
10
|
import type { Autonomy, CommandRule } from "../runtime-governance.js";
|
|
11
|
-
import type {
|
|
11
|
+
import type { DroppedCatalogEntry } from "./read-warnings.js";
|
|
12
12
|
export interface CenterModel {
|
|
13
13
|
name: string;
|
|
14
14
|
id: string;
|
|
@@ -134,7 +134,7 @@ export interface CenterMcpServer {
|
|
|
134
134
|
* 的 `McpServerSpec` 是默认 strip 的 zod object 且没有 `contentOrigin` 可选键,本地腿在 FileConfigStore 的
|
|
135
135
|
* `parseDomainLoud(DOMAIN_SCHEMAS.mcp)`、远端腿在消费端边界 `readEffectiveWire`([ref] 裁B)**各被剥一次**。
|
|
136
136
|
* 修在 sema-settings-schema(补同名可选枚举键 + 发包),本仓提货后 `config-provider.ts` 的映射加一行即通;
|
|
137
|
-
* 两条 `it.fails` 绊线(test/
|
|
137
|
+
* 两条 `it.fails` 绊线(test/web-admin-wire-read.test.ts + test/config-provider.test.ts)在上游到货时
|
|
138
138
|
* 自动翻红逼销账。
|
|
139
139
|
*/
|
|
140
140
|
contentOrigin?: ToolContentOrigin;
|
|
@@ -195,7 +195,7 @@ export interface CenterA2aPeer {
|
|
|
195
195
|
* #A4([ref] 窗三件批 件1;[ref]/[ref] 承诺件)—— READ 容纳面的 center 下发形(`CenterA2aPeer` 的
|
|
196
196
|
* 同族:一个 additive 顶层域,server 声明它才不会被静默丢弃)。四个成员逐一对应部署 env 的四键
|
|
197
197
|
* (`READ_FACE` / `READ_DENY_PATTERNS` / `READ_DENY_BUILTIN_TIERS` / `READ_DENY_BUILTIN_EXCLUDE`),
|
|
198
|
-
* 消费半场 = `
|
|
198
|
+
* 消费半场 = `web-admin-client/read-face.ts` `applyCenterReadFace`。
|
|
199
199
|
*
|
|
200
200
|
* 🔴 **env 显式恒赢**(operator-knob 律,消费侧执法):env 是这台机器的部署主权,center 是组织下发;
|
|
201
201
|
* 冲突时本机 env 原样保留 + 一条点名 warn。所以本类型描述的是「组织想要什么」,不是「这台机器最终是什么」。
|
|
@@ -267,17 +267,18 @@ export interface EffectiveConfig {
|
|
|
267
267
|
models: {
|
|
268
268
|
models: CenterModel[];
|
|
269
269
|
roles: Record<string, CenterRoleTarget>;
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
/** `models.atMention`(settings-schema 11)的**承载位**:类型是 `unknown` 而不是那个三态,理由与 {@link CenterModel.compat} 同 ——
|
|
271
|
+
* 本类型描述到货 JSON,形与缺省读法的单一属主是契约座位 schema(`model-select.ts` `readAtMention`,stage 在那一刻调它)。
|
|
272
|
+
* 两条读腿恒物化它;只有一份 11.0.0 之前写下、迁移后仍没有这一键的 LKG 载荷缺席它(缺席 = 契约缺省)。 */
|
|
273
|
+
atMention?: unknown;
|
|
272
274
|
tierGroups?: unknown;
|
|
273
275
|
activeTierGroup?: string;
|
|
274
|
-
/** 🔴 S-712 —— **本仓读腿铸的**载体(不是 wire 键:中心在模型域里写同名键会被 schema 当未知键剥掉并进候选门):这次读
|
|
275
|
-
* 被 schema
|
|
276
|
-
* `read-warnings.ts`
|
|
277
|
-
* 不变量 `refused-names-not-minted`
|
|
278
|
-
*
|
|
279
|
-
|
|
280
|
-
droppedIdentities?: DroppedModelIdentity[];
|
|
276
|
+
/** 🔴 S-712 / S-1295 —— **本仓读腿铸的**载体(不是 wire 键:中心在模型域里写同名键会被 schema 当未知键剥掉并进候选门):这次读
|
|
277
|
+
* 被 schema 逐条丢掉的**每一条**目录条目一行(下标 + settings-schema 闭集词 `reasonCode` + 告警自带的 `identity` + 字段诊断;形与律见
|
|
278
|
+
* `read-warnings.ts` {@link DroppedCatalogEntry})。读者各取所需:模型面 stage 把有名且启用的行铸成 `config.model_entry_invalid` 墓碑
|
|
279
|
+
* (不变量 `refused-names-not-minted` 据此判增广),每一行与 `models` 同 commit 进 `config.droppedCatalogEntries`(`GET /v1/models.droppedEntries` 的源)。
|
|
280
|
+
* 挂在 effective 上(而不是读结果旁边)是为了**随 effective 落 LKG**:重启从 LKG 起服时它还在。盘上形不对 ⇒ 模型面整组拒。 */
|
|
281
|
+
droppedCatalogEntries?: DroppedCatalogEntry[];
|
|
281
282
|
};
|
|
282
283
|
/** registry-core 0.7 collab domain (teams' successor) — consumed by the slice-1.5 projection
|
|
283
284
|
* (projectCollabToWorkflows → registerCollabWorkflows). Both lanes carry it: the remote worker /effective view
|
|
@@ -308,42 +309,13 @@ export interface EffectiveConfig {
|
|
|
308
309
|
enabled?: boolean;
|
|
309
310
|
}>;
|
|
310
311
|
};
|
|
311
|
-
/** `runtime` 域 = **限额残余五键**,与 settings-schema `RuntimeConfig` 的键集逐字相等([ref] 件3 对账门
|
|
312
|
-
* test/settings-schema-consumption-gates.test.ts 读 dist `RuntimeConfig.shape` 钉集合等式)。全部 center
|
|
313
|
-
* `.optional()`(center `f95438a`):缺席 = 不管 → 保 env;在场(含显式 0 = "publish OFF")= 覆盖。
|
|
314
|
-
* [ref] 批1 起五键全是**热**键(属主 stage-limits,boot+refresh 双腿);`limits` 域是它们的继任发布位
|
|
315
|
-
* (两处同现 ⇒ limits 赢,见 {@link EffectiveConfig.limits})。
|
|
316
|
-
*
|
|
317
|
-
* 🔴 治理三件(autonomy / commandPolicy / approvalRequire)**不在这里**([ref] 件3 退役键清除):它们自
|
|
318
|
-
* settings-schema 0.6 起住 `governance` 域,0.7.1 撤了 runtime 位的双写镜像;此后 `RuntimeConfig` 是 strip
|
|
319
|
-
* 的 zod object,两条腿(远端 `readEffectiveWire` / 本地 FileConfigStore→`buildEffective`)都把旧位 strip
|
|
320
|
-
* 掉、由 `legacyGovernanceFromRuntime` 抬进 governance ⇒ 本仓在 runtime 位上读它们的每一行都是死码。
|
|
321
|
-
* 旧类型面上留着这三键,让(已于 S-668 波 2 退役的)`runtime-gates` 重启片一直读着一个生产上恒缺席的位(审批闸收紧静默不生效)。 */
|
|
322
|
-
runtime?: {
|
|
323
|
-
rateLimitPerMin?: number;
|
|
324
|
-
maxTaskCostUsd?: number;
|
|
325
|
-
maxTaskTokens?: number;
|
|
326
|
-
maxPrincipalCostUsd?: number;
|
|
327
|
-
costQuotaWindowSec?: number;
|
|
328
|
-
};
|
|
329
312
|
/**
|
|
330
313
|
* [ref] 批1 —— **limitsHttp 组的热更新发布域**([ref] §6 批1)。
|
|
331
314
|
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* `
|
|
336
|
-
* `limits` 原样到手)——所以这是今天唯一能真的把这些键送到消费端的形,也与 governance 域当初从
|
|
337
|
-
* runtime 里拆出去的先例同族。
|
|
338
|
-
*
|
|
339
|
-
* 车道现状(如实):remote 腿即刻可用(center 发什么就到什么);**local 腿(config.d/)暂不可用** ——
|
|
340
|
-
* `FileConfigStore` 的域表是闭集,`config.d/limits.json` 根本不会被读进 effective。补法在 registry-core
|
|
341
|
-
* (加 `limits` 域 + PORTABLE_DOMAINS),与 `a2a`/`readFace` 当初的缺口同族;server 侧的消费半场(本键 +
|
|
342
|
-
* stage + commit)先落地,不在下游自建第二个读盘腿(源头修复纪律)。
|
|
343
|
-
*
|
|
344
|
-
* 与 `runtime` 的**优先级**:五个既有闸键(rateLimitPerMin/maxTaskCostUsd/maxTaskTokens/
|
|
345
|
-
* maxPrincipalCostUsd/costQuotaWindowSec)两处都可能出现 ⇒ `limits` 赢(新位是真值,旧位是过渡),
|
|
346
|
-
* 与 governance/runtime 的读取优先级契约同形。
|
|
315
|
+
* 限额五闸(rateLimitPerMin / maxTaskCostUsd / maxTaskTokens / maxPrincipalCostUsd / costQuotaWindowSec)与其余限额键的**唯一**发布位:
|
|
316
|
+
* settings-schema 11 退役了 `runtime` 域(它曾承载前五键;存量由一次性迁移 SS-M1 搬进本域,读腿对带事实的 `runtime` 整份拒),
|
|
317
|
+
* 本仓的旧位读法随之删 —— 一个键一个发布位,没有「两处同现谁赢」的优先级规则。两条腿都读它(本地腿:`config.d/limits.json`,
|
|
318
|
+
* `limits` 在 PORTABLE_DOMAINS 里)。
|
|
347
319
|
*/
|
|
348
320
|
limits?: EffectiveLimits;
|
|
349
321
|
/** 142-S4(registry-core 0.10.0 第 15 域):center 项目登记簿。wire 面 verbatim JSON —
|
|
@@ -388,7 +360,7 @@ export interface EffectiveConfig {
|
|
|
388
360
|
* `host` lane on purpose). ⚠️ Admins writing `required=true` policies must include `in-process` when such
|
|
389
361
|
* workers should stay admittable — center UI/doc 词表待补齐。
|
|
390
362
|
*
|
|
391
|
-
* 🔴 **`device` 是 per-principal 执行面上最需要写清的一条**(device-executor-lane-v2 §4.1 的
|
|
363
|
+
* 🔴 **`device` 是 per-principal 执行面上最需要写清的一条**(device-executor-lane-v2 §4.1 的 web-admin
|
|
392
364
|
* 行,车A-4 补):它是「在**员工自己的机器**上执行」的那条车道 —— 允许它 ≠ 允许一台云沙箱,而是允许
|
|
393
365
|
* 这个 principal 把裁决过的指令投到一台**受管设备**上。⚠️ 但**别把它当设备准入门用**:本 ruling 的
|
|
394
366
|
* 粒度是 lane 名,它表达不了 principal×device 绑定,而且 no-ruling 是 **fail-open** 的
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.124.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@sema-agent/core": "7.
|
|
68
|
-
"@sema-agent/settings-schema": "
|
|
67
|
+
"@sema-agent/core": "7.48.0",
|
|
68
|
+
"@sema-agent/settings-schema": "11.2.0",
|
|
69
69
|
"e2b": "^2.28.0",
|
|
70
70
|
"libsodium-wrappers": "^0.8.4",
|
|
71
71
|
"mysql2": "^3.22.4",
|
package/skills/find-skills.md
CHANGED
|
@@ -142,7 +142,7 @@ npx skills init my-xyz-skill
|
|
|
142
142
|
|
|
143
143
|
<!--
|
|
144
144
|
TODO (clay): add our own first-party skill sources here -
|
|
145
|
-
|
|
146
|
-
skills.sh ecosystem. Not every deployment ships a
|
|
145
|
+
web-admin / web-admin - as a discovery+install lane alongside the open
|
|
146
|
+
skills.sh ecosystem. Not every deployment ships a web-admin, so the section
|
|
147
147
|
must probe availability first and fall back to the public ecosystem cleanly.
|
|
148
148
|
-->
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `EffectiveReadWarning` → 候选门口径的**单点**折叠(本地腿 `config-provider.ts` 与远程腿 `http-client.ts` 共用;
|
|
3
|
-
* 两腿各抄一份映射正是漂移的成因——远程腿曾漏掉一次改动,版本超前的 center 多一个字段就整份远程 refresh 整拒)。
|
|
4
|
-
*
|
|
5
|
-
* **律只有一条:未知键 = 候选门错误,零特例。** 「别的写者按契约放的扩展键」(壳写在 models 条目上的 `sema*`)
|
|
6
|
-
* 不是本函数要分辨的事——那由 settings-schema 的 `EXTENSION_NAMESPACES` 在**声明处**说清(登记的键既不点名也不计数,
|
|
7
|
-
* 1.5.0 起);到了这里的每一个键都是「写了没生效」的拼错或越界,与 domain-defaulted 同级。此前本仓在下游按 kind/
|
|
8
|
-
* 按域/按键路径闭集/按 64 满额四层猜意图,每层都被下一轮复审打穿——意图只能在声明处说,消费方不猜。
|
|
9
|
-
*
|
|
10
|
-
* 截断:schema 的键列表有界(64),超界带 `truncatedFrom`(真实总数)——文案如实带上,消费方永远不把有界列表当穷举。
|
|
11
|
-
* 词表是闭集:`switch` 穷举 `kind`,schema 加新 kind 这里编译红,不会静默漏臂。
|
|
12
|
-
*
|
|
13
|
-
* **归族判据两问**(下游两个消费者:候选门 = 非空 ⇒ 这棵树整拒、保 LKG;逐条丢弃面 = 响亮点名、其余照用):
|
|
14
|
-
* ① 值**已被收编接受**(写了、生效了、只是换了个位置或被夹住)⇒ 不入诊断面(`null`);
|
|
15
|
-
* ② 写了没生效的,按**失效的颗粒**分:丢的是**一条条目**(`entry-dropped`)⇒ `scope:"entry"` —— 这条条目单独
|
|
16
|
-
* 不在,同域其余条目照用,候选**不**因它整拒;丢的是一个域 / 一组键 / 一个文件 ⇒ `scope:"domain"` —— 候选门错误。
|
|
17
|
-
*
|
|
18
|
-
* 🔴 S-704 ②(2026-09-24,凭据轴):此前 `entry-dropped` 归「候选门错误」(settings-schema 2.0.0 提货时的归族),于是
|
|
19
|
-
* schema 的**逐条容错**在本仓的 refresh / 迟到 boot 两条腿上被**还原成整份拒** —— 目录里一条 `contextWindow:"abc"`
|
|
20
|
-
* 就让整份目录停在上一代;而上一代若还是 env(boot 拉取失败 / 超窗且无 LKG),env 模型就一直服务、env 钥匙一直被送到
|
|
21
|
-
* 网关缺省端点(红先实测:`config_candidate_rejected` + env 模型继续服务)。粒度对了规则反而更少:颗粒是条目的失效
|
|
22
|
-
* 留在条目上,只有颗粒更粗的失效才动候选。
|
|
23
|
-
* `legacy-governance-lifted`(0.5 期 runtime 文档里的治理三闸被抬进 governance 域)归①——那几个键**生效了**
|
|
24
|
-
* (`buildEffective` 用抬升结果解析 governance),把它折成错误会让一份合法的 0.5 期存量配置每一次 refresh 都被
|
|
25
|
-
* 候选门整拒,而它在 1.10.0 上零告警零 domainErrors(亲验读数)。兼容臂的关窗观测归属主(settings-schema 的
|
|
26
|
-
* `onWarning` 流),不借候选门这条带副作用的通道传信息。
|
|
27
|
-
*/
|
|
28
|
-
import { type EffectiveReadWarning } from "@sema-agent/settings-schema";
|
|
29
|
-
/** 折叠产物:`scope` 决定消费方做什么 —— `"domain"` 进候选门(`domainErrors`),`"entry"` 进逐条丢弃面(`droppedEntries`)。 */
|
|
30
|
-
export type FoldedReadWarning = {
|
|
31
|
-
readonly scope: "domain";
|
|
32
|
-
readonly domain: string;
|
|
33
|
-
readonly error: string;
|
|
34
|
-
} | {
|
|
35
|
-
readonly scope: "entry";
|
|
36
|
-
readonly domain: string;
|
|
37
|
-
readonly entry: string;
|
|
38
|
-
readonly error: string;
|
|
39
|
-
};
|
|
40
|
-
/** 逐条丢弃面的一行(两条读腿的 `droppedEntries` 同形):`entry` = 被丢那条的出门形坐标(`models.1`),`error` = 哪些字段、为什么。 */
|
|
41
|
-
export type DroppedConfigEntry = {
|
|
42
|
-
readonly domain: string;
|
|
43
|
-
readonly entry: string;
|
|
44
|
-
readonly error: string;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* zod 形的错误 → 一行可读的字段诊断(`contextWindow: expected number, received string; api: custom`)。
|
|
48
|
-
* **只读**每条 issue 的 `path`(键名)与 `code`,`invalid_type` 臂另读 `expected` / `received`(两者都是**类型词**)——
|
|
49
|
-
* 刻意不读 `message`(自定义 refine 的 message 可以回声值)与 `invalid_enum_value` 等臂的 `received`(那是原值)。
|
|
50
|
-
* 读不出 issues 形 ⇒ `undefined`(调用方退回既有文案)。模型面 stage 的逐条判据与本折叠点共用这一只(一个刻度)。
|
|
51
|
-
*/
|
|
52
|
-
export declare function describeSchemaIssues(error: unknown): string | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* zod 形错误 → 坏字段的**键路径**(去重保序;`(entry)` = 整条)。与 {@link describeSchemaIssues} 同一只读法(只读 `path`),
|
|
55
|
-
* 不含值。模型面 stage 的逐条判据(`judgeCatalogEntry`)与本折叠点的被丢条目身份共用这一只 —— 一个刻度。
|
|
56
|
-
*/
|
|
57
|
-
export declare function describeSchemaIssueFields(error: unknown): string[];
|
|
58
|
-
/** null = 不入诊断面(`hosts-grandfathered` / `legacy-governance-lifted`:值已被收编接受,与本地店同口径)。 */
|
|
59
|
-
export declare function foldEffectiveReadWarning(w: EffectiveReadWarning): FoldedReadWarning | null;
|
|
60
|
-
/**
|
|
61
|
-
* 🔴 S-712 —— 一条被 schema 逐条丢掉的**启用**、**有名**目录条目的身份(模型面墓碑的来源;载体 = `EffectiveConfig.models.droppedIdentities`,
|
|
62
|
-
* 随 effective 走 —— 盘上 LKG 从同一个对象落盘,重启从 LKG 起服墓碑不丢)。
|
|
63
|
-
*
|
|
64
|
-
* 为什么要交出身份:条目被丢之后它的名字从目录里消失,而档位增广(core `expandTiers`)会把一个**空出来的**档位词 / CC 别名
|
|
65
|
-
* (条目恰好叫 `sonnet` / `pro` …)重新铸到另一条条目上 —— 显式点它的请求与点名它的角色绑定就这样被静默换了目的地
|
|
66
|
-
* (gpt-6 腿 F2 / F3,真复现)。身份进 `modelRefusals` 之后,不变量 `refused-names-not-minted` 才判得到它。
|
|
67
|
-
*
|
|
68
|
-
* 🔐 纯身份,不含值:`name` / `id` 取自告警的 `identity`(settings-schema 6.1.0:只取被丢条目原文里的字符串形,脱敏器会改动的串
|
|
69
|
-
* 整键扣下),`fields` 是坏字段的**键路径**,`issues` 是 {@link describeSchemaIssues} 的一行(键名 + 类型词)—— 被丢条目的原值
|
|
70
|
-
* (可能是一段贴错位置的凭据)绝不进载体、日志、LKG 与 400 拒因句。
|
|
71
|
-
*/
|
|
72
|
-
export interface DroppedModelIdentity {
|
|
73
|
-
/** 出门形坐标(`models.1`),与同一次读的 `droppedEntries[].entry` 同一串。 */
|
|
74
|
-
readonly entry: string;
|
|
75
|
-
/** 条目写的 `name`(读腿只为有名的行铸载体)。载体上缺了它 = 载体形不对(LKG 载体被改 / 手写 effective)⇒ 模型面整组拒,
|
|
76
|
-
* 判在 `model-entry-refusal.ts` `judgeCatalogEntries`。 */
|
|
77
|
-
readonly name: string;
|
|
78
|
-
readonly id?: string;
|
|
79
|
-
readonly fields: readonly string[];
|
|
80
|
-
readonly issues: string;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* 两条读腿(远端 `http-client.ts` / 本地 `config-provider.ts`)共用的**分面单点**:折叠产物按 `scope` 分进候选门
|
|
84
|
-
* (`domainErrors`)与逐条丢弃面(`droppedEntries`)。`switch` 穷举 —— 加一种 scope 不补臂 = 编译红,两腿不会各分各的。
|
|
85
|
-
* 文案**未脱敏**:进日志流之前各腿在自己的产出边界上过 `redactConfigError`(与 `domainErrors` 同一道)。
|
|
86
|
-
*
|
|
87
|
-
* 🔴 S-712 身份规则(一条,数据源 = 告警自带的 `identity`,settings-schema 6.1.0 在**同一次解析**里从被丢条目原文取 —— 本仓不再回读原文档):
|
|
88
|
-
* **`identity.name` 是字符串 ⇒ 有名;有名且 `identity.enabled !== false` ⇒ 墓碑(进载体);其余一律不进载体。**
|
|
89
|
-
* · 有名而停用 ⇒ 停用 = 不在目录(与 7.100.0 同义);
|
|
90
|
-
* · 没有字符串名 —— `identity` 在场而无 `name`,或 `identity` 整个缺席 ⇒ **无名可留**,与停用同处置。按 settings-schema 6.1.0 的铸点
|
|
91
|
-
* (`config-fns.ts` `readEntryIdentity`),「没有名」有两个成因、刻意不分:原文 `name` 不是字符串(`null` / 数 / 整行不是对象),
|
|
92
|
-
* 或是字符串但脱敏器会改动它(秘密形 —— 扣下不出门)。后者对本判据同样安全:档位增广只铸闭集词(`ultra` / `max` / `pro` /
|
|
93
|
-
* `flash` / `lite`、CC 别名、`best`),没有一个是秘密形,一个被扣下的名字无从被铸出;它的代价只是显式点它的请求拿到「未知模型」
|
|
94
|
-
* 而不是 `request.model_unavailable`(那个名字本来也不许进日志与拒因句)。
|
|
95
|
-
* 坏行本身照样走 `droppedEntries`(坐标 + 字段,不带值)。
|
|
96
|
-
*/
|
|
97
|
-
export declare function splitFoldedReadWarnings(warnings: readonly EffectiveReadWarning[]): {
|
|
98
|
-
domainErrors: Array<{
|
|
99
|
-
domain: string;
|
|
100
|
-
error: string;
|
|
101
|
-
}>;
|
|
102
|
-
droppedEntries: DroppedConfigEntry[];
|
|
103
|
-
droppedIdentities: DroppedModelIdentity[];
|
|
104
|
-
};
|
|
105
|
-
/** S-712:把本次读交出的被丢身份挂上 effective 的模型域(两腿同一只;空 ⇒ 不挂键)。 */
|
|
106
|
-
export declare function withDroppedIdentities<E extends {
|
|
107
|
-
models?: object;
|
|
108
|
-
}>(effective: E, droppedIdentities: readonly DroppedModelIdentity[]): E;
|
|
109
|
-
//# sourceMappingURL=read-warnings.d.ts.map
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { formatConfigPath } from "@sema-agent/settings-schema";
|
|
2
|
-
export function describeSchemaIssues(error) {
|
|
3
|
-
const issues = schemaIssuesOf(error);
|
|
4
|
-
if (issues === undefined)
|
|
5
|
-
return undefined;
|
|
6
|
-
return issues
|
|
7
|
-
.map((raw) => {
|
|
8
|
-
const i = (typeof raw === "object" && raw !== null ? raw : {});
|
|
9
|
-
const field = Array.isArray(i.path) && i.path.length > 0 ? i.path.map(String).join(".") : "(entry)";
|
|
10
|
-
const what = i.code === "invalid_type" && typeof i.expected === "string" && typeof i.received === "string"
|
|
11
|
-
? `expected ${i.expected}, received ${i.received}`
|
|
12
|
-
: typeof i.code === "string"
|
|
13
|
-
? i.code
|
|
14
|
-
: "invalid";
|
|
15
|
-
return `${field}: ${what}`;
|
|
16
|
-
})
|
|
17
|
-
.join("; ");
|
|
18
|
-
}
|
|
19
|
-
function schemaIssuesOf(error) {
|
|
20
|
-
const issues = typeof error === "object" && error !== null ? error.issues : undefined;
|
|
21
|
-
return Array.isArray(issues) && issues.length > 0 ? issues : undefined;
|
|
22
|
-
}
|
|
23
|
-
export function describeSchemaIssueFields(error) {
|
|
24
|
-
const issues = schemaIssuesOf(error) ?? [];
|
|
25
|
-
const fields = issues.map((raw) => {
|
|
26
|
-
const p = typeof raw === "object" && raw !== null ? raw.path : undefined;
|
|
27
|
-
return Array.isArray(p) && p.length > 0 ? p.map(String).join(".") : "(entry)";
|
|
28
|
-
});
|
|
29
|
-
return [...new Set(fields)];
|
|
30
|
-
}
|
|
31
|
-
const MAX_ERROR_CHARS = 600;
|
|
32
|
-
const cap = (s) => s.slice(0, MAX_ERROR_CHARS);
|
|
33
|
-
const errorText = (e) => (e instanceof Error ? e.message : String(e));
|
|
34
|
-
const keyList = (prefix, keys, truncatedFrom) => {
|
|
35
|
-
const total = truncatedFrom ?? keys.length;
|
|
36
|
-
const budget = MAX_ERROR_CHARS - prefix.length;
|
|
37
|
-
const shown = [];
|
|
38
|
-
let used = 0;
|
|
39
|
-
const suffixFor = (n) => (n < total ? ` (+${total - n} more, list truncated)` : "");
|
|
40
|
-
for (const k of keys) {
|
|
41
|
-
const rendered = formatConfigPath(k);
|
|
42
|
-
const piece = (shown.length > 0 ? ", " : "") + rendered;
|
|
43
|
-
if (used + piece.length + suffixFor(shown.length + 1).length > budget)
|
|
44
|
-
break;
|
|
45
|
-
shown.push(rendered);
|
|
46
|
-
used += piece.length;
|
|
47
|
-
}
|
|
48
|
-
return `${prefix}${shown.join(", ")}${suffixFor(shown.length)}`;
|
|
49
|
-
};
|
|
50
|
-
export function foldEffectiveReadWarning(w) {
|
|
51
|
-
switch (w.kind) {
|
|
52
|
-
case "hosts-grandfathered":
|
|
53
|
-
case "legacy-governance-lifted":
|
|
54
|
-
return null;
|
|
55
|
-
case "domain-defaulted":
|
|
56
|
-
return { scope: "domain", domain: w.domain, error: cap(errorText(w.error)) };
|
|
57
|
-
case "entry-dropped":
|
|
58
|
-
return { scope: "entry", domain: w.domain, entry: formatConfigPath(w.path), error: cap(`entry dropped by domain schema: ${describeSchemaIssues(w.error) ?? errorText(w.error)}`) };
|
|
59
|
-
case "unknown-keys-dropped":
|
|
60
|
-
return { scope: "domain", domain: w.domain, error: keyList("unknown keys dropped by domain schema: ", w.keys, w.truncatedFrom) };
|
|
61
|
-
case "unknown-keys-carried":
|
|
62
|
-
return { scope: "domain", domain: w.domain, error: keyList("unknown keys carried to consumer (spelling?): ", w.keys, w.truncatedFrom) };
|
|
63
|
-
case "unread-config-file":
|
|
64
|
-
return { scope: "domain", domain: w.domain ?? "config.d", error: cap(`unread config file ${w.file} (${w.why})`) };
|
|
65
|
-
default: {
|
|
66
|
-
const never = w;
|
|
67
|
-
throw new Error(`unhandled EffectiveReadWarning kind: ${JSON.stringify(never)}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function isModelEntryDrop(w) {
|
|
72
|
-
return w.kind === "entry-dropped" && w.domain === "models" && w.path.length === 2 && w.path[0] === "models" && typeof w.path[1] === "number";
|
|
73
|
-
}
|
|
74
|
-
export function splitFoldedReadWarnings(warnings) {
|
|
75
|
-
const domainErrors = [];
|
|
76
|
-
const droppedEntries = [];
|
|
77
|
-
for (const w of warnings) {
|
|
78
|
-
const f = foldEffectiveReadWarning(w);
|
|
79
|
-
if (f === null)
|
|
80
|
-
continue;
|
|
81
|
-
switch (f.scope) {
|
|
82
|
-
case "domain":
|
|
83
|
-
domainErrors.push({ domain: f.domain, error: f.error });
|
|
84
|
-
break;
|
|
85
|
-
case "entry":
|
|
86
|
-
droppedEntries.push({ domain: f.domain, entry: f.entry, error: f.error });
|
|
87
|
-
break;
|
|
88
|
-
default: {
|
|
89
|
-
const never = f;
|
|
90
|
-
throw new Error(`unhandled folded read-warning scope: ${JSON.stringify(never)}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const droppedIdentities = [];
|
|
95
|
-
for (const w of warnings) {
|
|
96
|
-
if (!isModelEntryDrop(w))
|
|
97
|
-
continue;
|
|
98
|
-
const identity = w.identity;
|
|
99
|
-
if (identity?.name === undefined || identity.enabled === false)
|
|
100
|
-
continue;
|
|
101
|
-
droppedIdentities.push({ entry: formatConfigPath(w.path), name: identity.name, ...(identity.id !== undefined ? { id: identity.id } : {}), fields: describeSchemaIssueFields(w.error), issues: describeSchemaIssues(w.error) ?? "(schema issues unreadable)" });
|
|
102
|
-
}
|
|
103
|
-
return { domainErrors, droppedEntries, droppedIdentities };
|
|
104
|
-
}
|
|
105
|
-
export function withDroppedIdentities(effective, droppedIdentities) {
|
|
106
|
-
if (droppedIdentities.length === 0 || effective.models === undefined)
|
|
107
|
-
return effective;
|
|
108
|
-
return { ...effective, models: { ...effective.models, droppedIdentities: [...droppedIdentities] } };
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=read-warnings.js.map
|
package/dist/url-shape.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** 座位可以禁掉的部件(闭集;判序 = 本数组序)。 */
|
|
2
|
-
export declare const HTTP_URL_PARTS: readonly ["userinfo", "query", "fragment"];
|
|
3
|
-
export type HttpUrlPart = (typeof HTTP_URL_PARTS)[number];
|
|
4
|
-
/** 判官的拒因词(闭集):形不对,或一件被禁的部件在场。 */
|
|
5
|
-
export type HttpUrlFlaw = "not-http-url" | HttpUrlPart;
|
|
6
|
-
/** 「不是一个 http(s) URL」的规则词 —— 不透明形、不可解析、层级式非 http(s) 同一句;只点名规则,不回显 scheme。钉读这一只,不手抄。 */
|
|
7
|
-
export declare const HTTP_URL_SHAPE_RULE = "is not a parseable http(s) URL (scheme must be http or https; it must look like http(s)://host[:port][/path])";
|
|
8
|
-
/**
|
|
9
|
-
* 判:合格 ⇒ `[]`;否则按判序交回规则词。形不对且不透明 ⇒ 只有 `not-http-url`(部件在不透明形上无从判,
|
|
10
|
-
* 也不需要判 —— 那一形整只不收);层级式非 http(s) ⇒ `not-http-url` 之后照判部件。
|
|
11
|
-
* 返回类型按 `forbid` 收窄:座位没禁的部件不会出现在答案里(调用方的穷举 switch 因此不需要一条「不可达」臂)。
|
|
12
|
-
*/
|
|
13
|
-
export declare function httpUrlFlaws<P extends HttpUrlPart>(raw: string, forbid: readonly P[]): ReadonlyArray<"not-http-url" | P>;
|
|
14
|
-
/** 一个拒因词的规则句(穷举;新词不补 = 编译红)。句子只说规则,不含值。 */
|
|
15
|
-
export declare function httpUrlRule(flaw: HttpUrlFlaw): string;
|
|
16
|
-
/**
|
|
17
|
-
* 拒句里值的样子(纯函数):合格的 http(s) 形 ⇒ 只到 origin(`scheme://host[:port]`,过展示铸点),origin 之后还有东西(userinfo /
|
|
18
|
-
* 路径 / query / fragment)⇒ 接一枚 `/…`;其余(不透明 / 不可解析 / 层级式非 http(s))⇒ 展示铸点的占位 `«redacted:url»` ——
|
|
19
|
-
* 拒句里不出现非 http(s) 的 scheme 词(主会话增补裁:写成 scheme 的令牌 `<48hex>://host` 曾原样进 fatal 行)。
|
|
20
|
-
*
|
|
21
|
-
* 🔴 为什么只到 origin(车内 codex 对抗复审 r1 [high],亲跑复现):展示铸点的路径段**逐字**保留、只靠形状律认令牌形 ——
|
|
22
|
-
* 形状律认不出的令牌(48 位十六进制拉取令牌就是一例)放在路径上会原样进拒句。拒句落在 fatal 行、stderr、每一轮的请求失败日志,
|
|
23
|
-
* 这几处不赌形状律的覆盖面:座位名 + 规则词已经说清了哪一席错在哪,值只需要认得出是哪一台主机。
|
|
24
|
-
*/
|
|
25
|
-
export declare function buildRefusalShownUrl(raw: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* 拒句的**唯一**铸点:`<subject> <规则句>[; <规则句>…]; got "<值的样子>"`(`build*` = 纯数据)。
|
|
28
|
-
* 值只经 {@link buildRefusalShownUrl} 出现;`flaws` 来自 {@link httpUrlFlaws}(调用方按首个拒因选自己的码与出路句)。
|
|
29
|
-
*/
|
|
30
|
-
export declare function buildHttpUrlRefusal(subject: string, raw: string, flaws: readonly HttpUrlFlaw[]): string;
|
|
31
|
-
//# sourceMappingURL=url-shape.d.ts.map
|
package/dist/url-shape.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { DISPLAY_SAFE_URL_TOKEN, buildDisplaySafeUrl, isHierarchicalUrl } from "./trace/redact.js";
|
|
2
|
-
export const HTTP_URL_PARTS = ["userinfo", "query", "fragment"];
|
|
3
|
-
export const HTTP_URL_SHAPE_RULE = "is not a parseable http(s) URL (scheme must be http or https; it must look like http(s)://host[:port][/path])";
|
|
4
|
-
export function httpUrlFlaws(raw, forbid) {
|
|
5
|
-
if (!isHierarchicalUrl(raw))
|
|
6
|
-
return ["not-http-url"];
|
|
7
|
-
const u = new URL(raw);
|
|
8
|
-
const hashAt = u.href.indexOf("#");
|
|
9
|
-
const present = {
|
|
10
|
-
userinfo: u.username !== "" || u.password !== "",
|
|
11
|
-
query: (hashAt < 0 ? u.href : u.href.slice(0, hashAt)).includes("?"),
|
|
12
|
-
fragment: hashAt >= 0,
|
|
13
|
-
};
|
|
14
|
-
const shape = u.protocol === "http:" || u.protocol === "https:" ? [] : ["not-http-url"];
|
|
15
|
-
return [...shape, ...HTTP_URL_PARTS.filter((p) => forbid.includes(p) && present[p])];
|
|
16
|
-
}
|
|
17
|
-
export function httpUrlRule(flaw) {
|
|
18
|
-
switch (flaw) {
|
|
19
|
-
case "not-http-url":
|
|
20
|
-
return HTTP_URL_SHAPE_RULE;
|
|
21
|
-
case "userinfo":
|
|
22
|
-
return "must not carry userinfo (credentials in the URL are logged, reported and handed to fetch; they belong in a credential setting)";
|
|
23
|
-
case "query":
|
|
24
|
-
return "must not carry a query (request paths are appended to this base)";
|
|
25
|
-
case "fragment":
|
|
26
|
-
return "must not carry a fragment (it is never sent, and anything appended after it is dropped with it)";
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export function buildRefusalShownUrl(raw) {
|
|
30
|
-
if (!isHierarchicalUrl(raw))
|
|
31
|
-
return DISPLAY_SAFE_URL_TOKEN;
|
|
32
|
-
const u = new URL(raw);
|
|
33
|
-
if (u.protocol !== "http:" && u.protocol !== "https:")
|
|
34
|
-
return DISPLAY_SAFE_URL_TOKEN;
|
|
35
|
-
const origin = `${u.protocol}//${u.host}`;
|
|
36
|
-
return `${buildDisplaySafeUrl(origin)}${u.href === `${origin}/` ? "" : "/…"}`;
|
|
37
|
-
}
|
|
38
|
-
export function buildHttpUrlRefusal(subject, raw, flaws) {
|
|
39
|
-
return `${subject} ${flaws.map(httpUrlRule).join("; ")}; got ${JSON.stringify(buildRefusalShownUrl(raw))}`;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=url-shape.js.map
|
|
File without changes
|