@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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { describeStaticWiring } from "@sema-agent/core";
|
|
2
2
|
import { encodeCheckpointScope } from "../security.js";
|
|
3
|
-
import { authBridgeIssuerOf,
|
|
3
|
+
import { authBridgeIssuerOf, createWebAdminJwtVerifier } from "../auth-bridge.js";
|
|
4
4
|
import { createSessionFaces } from "./session-faces.js";
|
|
5
5
|
import { createLeaderFace } from "./leader.js";
|
|
6
6
|
import { assertStaticWiringConsistent } from "../http/routes/diagnostics.js";
|
|
7
7
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
8
8
|
export function runStage09(ctx) {
|
|
9
|
-
const { approvalExemptionStore, backend, backgroundAgentStore, brain, checkpointStore, config,
|
|
9
|
+
const { approvalExemptionStore, backend, backgroundAgentStore, brain, checkpointStore, config, webAdmin, deviceLane, dropSessionScoped, durableEnabled, executionEnvFactory, fileHistoryErasure, governanceSeams, localRoot, logger, mailboxRecipientLifecycle, mailboxStore, metrics, pricing, resumeAnchorStore, runStore, runnerDeps, sessionPolicyStore, sessionStore, streamApprovalGate, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore, userInputLedgerStore, workflowCompletionInbox } = ctx;
|
|
10
10
|
const { ownerAware, sessionAudit, sessionWatchRegistry, purgeSession, instrumentDegenerate, planCacheProbe } = createSessionFaces({
|
|
11
11
|
deviceStore: deviceLane?.store,
|
|
12
12
|
dropSessionScoped,
|
|
@@ -16,11 +16,11 @@ export function runStage09(ctx) {
|
|
|
16
16
|
backgroundAgentStore,
|
|
17
17
|
userInputLedgerStore,
|
|
18
18
|
});
|
|
19
|
-
const leaderEndpoint = createLeaderFace({ config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, governanceSeams, backend, tracer, usageWindowStore, promptSource:
|
|
19
|
+
const leaderEndpoint = createLeaderFace({ config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, governanceSeams, backend, tracer, usageWindowStore, promptSource: webAdmin.promptSource, onError: runnerDeps.onError });
|
|
20
20
|
const drainState = { draining: false };
|
|
21
21
|
const authBridgeIssuer = authBridgeIssuerOf(config)?.issuer;
|
|
22
|
-
const
|
|
23
|
-
?
|
|
22
|
+
const webAdminJwtVerifier = authBridgeIssuer
|
|
23
|
+
? createWebAdminJwtVerifier({
|
|
24
24
|
issuer: authBridgeIssuer,
|
|
25
25
|
...(process.env.AUTH_BRIDGE_JWKS_URL ? { jwksUrl: process.env.AUTH_BRIDGE_JWKS_URL } : {}),
|
|
26
26
|
...(process.env.AUTH_BRIDGE_AUDIENCE ? { audience: process.env.AUTH_BRIDGE_AUDIENCE } : {}),
|
|
@@ -28,7 +28,7 @@ export function runStage09(ctx) {
|
|
|
28
28
|
metrics,
|
|
29
29
|
})
|
|
30
30
|
: undefined;
|
|
31
|
-
if (
|
|
31
|
+
if (webAdminJwtVerifier)
|
|
32
32
|
logger.info("auth_bridge_enabled", { issuer: buildDisplaySafeUrl(authBridgeIssuer ?? "") });
|
|
33
33
|
const hookWakeBus = {};
|
|
34
34
|
const wiringSpecTemplate = durableEnabled
|
|
@@ -45,6 +45,6 @@ export function runStage09(ctx) {
|
|
|
45
45
|
subagentTranscripts: staticWiring.fleet.subagentTranscripts,
|
|
46
46
|
subagentTranscriptRetentionMs: config.backgroundAgentRetentionMs,
|
|
47
47
|
});
|
|
48
|
-
return { ...ctx, drainState, hookWakeBus, instrumentDegenerate, leaderEndpoint, ownerAware, planCacheProbe, purgeSession,
|
|
48
|
+
return { ...ctx, drainState, hookWakeBus, instrumentDegenerate, leaderEndpoint, ownerAware, planCacheProbe, purgeSession, webAdminJwtVerifier, sessionAudit, sessionWatchRegistry, staticWiring };
|
|
49
49
|
}
|
|
50
50
|
//# sourceMappingURL=stage-09-leader.js.map
|
|
@@ -15,7 +15,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
15
15
|
} | {
|
|
16
16
|
childrenAlive: readonly string[];
|
|
17
17
|
}>) | undefined;
|
|
18
|
-
|
|
18
|
+
webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
|
|
19
19
|
sessionAudit: ((sessionId: string) => Promise<{
|
|
20
20
|
owner: string | null;
|
|
21
21
|
sessionId: string;
|
|
@@ -80,7 +80,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
80
80
|
hookAgent: import("../hooks/hook-runner.js").HookLlmCall;
|
|
81
81
|
hookAgentRunner: import("@sema-agent/core").Runner;
|
|
82
82
|
hookLlm: import("../hooks/hook-runner.js").HookLlmCall;
|
|
83
|
-
mcpRevocations: import("../
|
|
83
|
+
mcpRevocations: import("../web-admin-client/mcp-revocation.js").McpRevocationLedger;
|
|
84
84
|
memoryConsolidationFaces: import("./memory-consolidation.js").MemoryConsolidationFaces | undefined;
|
|
85
85
|
memoryOptOutGrantStore: import("../plugins/memory-optout-grant-store-sql.js").MemoryOptOutGrantStore | undefined;
|
|
86
86
|
orgMemoryAdmission: import("./org-memory.js").OrgMemoryAdmissionWiring;
|
|
@@ -198,7 +198,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
198
198
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
199
199
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
200
200
|
ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
|
|
201
|
-
|
|
201
|
+
webAdmin: import("./web-admin.js").WebAdminRuntime;
|
|
202
202
|
config: import("../config-types.js").ServiceConfig;
|
|
203
203
|
localRoot: string;
|
|
204
204
|
logger: import("../index.js").Logger;
|
|
@@ -29,7 +29,7 @@ import { bindServerLateSeats } from "./late-binds.js";
|
|
|
29
29
|
import { serviceVersion } from "../service-version.js";
|
|
30
30
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
31
31
|
export async function runStage10(ctx) {
|
|
32
|
-
const { approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, parkCommits, config,
|
|
32
|
+
const { approvalAskAudit, approvalExemptionStore, approvalNonceStore, authorize, backend, backgroundAgentStore, brain, breakerState, centerRuntimeCapsResolver, checkpointStore, parkCommits, config, webAdmin, consolidationValve, costQuota, deploymentHooks, deviceLane, drainState, durableEnabled, elicitation, fenceSessionOwner, noteSessionIncarnation, fileHistoryStore, fleetBus, fleetLease, fleetUsage, governanceSeams, handslessRunner, hookAgent, hookLlm, hookWakeBus, imageBakes, imageIndex, instanceId, instrumentDegenerate, leaderEndpoint, localRoot, logger, lspManager, mcpRevocations, memoryBundleFaces, memoryComplianceFaces, memoryConsolidationFaces, memoryEngine, memoryExportBackend, memoryOptOutGrantStore, memoryOriginFaces, memoryPosture, memorySyncCursors, metrics, modelUsageTracker, orgMemoryAdmission, otelExporter, outcomeSink, ownerAware, parkedReviveInheritedGate, parkedReviveSurface, perSessionCwd, perTaskImage, planCacheProbe, pricing, principalCaps, promptManifestTracker, purgeSession, question, rateLimiter, reaper, webAdminJwtVerifier, resumeAnchorStore, retentionLaneStarted, retentionLaneStore, ruleConsent, runStore, runner, runnerDeps, runtimeCapsPeekResolver, scenarioDetails, scenarios, selectEnvTool, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionAudit, sessionEnvSelection, sessionMemoryStatusFace, sessionPolicyStore, sessionTitler, sessionWatchRegistry, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, sharedMemoryStore, sideQueryAccounting, sqlEngineFacts, sqlWorkflowRunStore, staticWiring, storePosture, subRunner, subagentSteerRegistry, taskAttachmentStore, taskLimitCaps, taskTimeoutSec, toolApproval, toolResultStore, usageWindowStore, userInputLedger, webSearchProvider, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable } = ctx;
|
|
33
33
|
const stores = {
|
|
34
34
|
runStore,
|
|
35
35
|
resumeAnchorStore: resumeAnchorStore ? resumeAnchorStore : undefined,
|
|
@@ -116,7 +116,7 @@ export async function runStage10(ctx) {
|
|
|
116
116
|
};
|
|
117
117
|
const governance = {
|
|
118
118
|
authorize,
|
|
119
|
-
|
|
119
|
+
webAdminJwtVerifier: webAdminJwtVerifier ? webAdminJwtVerifier : undefined,
|
|
120
120
|
rateLimiter,
|
|
121
121
|
costQuota,
|
|
122
122
|
fleetLease: fleetLease ? fleetLease : undefined,
|
|
@@ -155,7 +155,7 @@ export async function runStage10(ctx) {
|
|
|
155
155
|
: undefined;
|
|
156
156
|
const deployment = {
|
|
157
157
|
sessionStoreLabel: sessionStoreLabelOf(config.sessionBackend, backend?.kind),
|
|
158
|
-
modelReady: () =>
|
|
158
|
+
modelReady: () => webAdmin.modelReady(),
|
|
159
159
|
scenarioDetails,
|
|
160
160
|
workflowsCapable,
|
|
161
161
|
workflowModelAllowlist: workflowModelAllowlistSnapshot,
|
|
@@ -164,7 +164,7 @@ export async function runStage10(ctx) {
|
|
|
164
164
|
sqlEngineFacts,
|
|
165
165
|
writeProtection: buildWriteProtectionPosture(config),
|
|
166
166
|
webSearchProvider,
|
|
167
|
-
sealedKeyPublic:
|
|
167
|
+
sealedKeyPublic: webAdmin.sealedKeyPublic,
|
|
168
168
|
instanceId,
|
|
169
169
|
capabilities: {
|
|
170
170
|
version: serviceVersion(),
|
|
@@ -173,19 +173,19 @@ export async function runStage10(ctx) {
|
|
|
173
173
|
return isPricingConfigured(pricing);
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
|
-
restartState: () =>
|
|
177
|
-
configApplyState: () =>
|
|
178
|
-
centerCredentialState: () =>
|
|
179
|
-
modelRefusalsState: () =>
|
|
180
|
-
configHandoffState: () =>
|
|
176
|
+
restartState: () => webAdmin.restartState(),
|
|
177
|
+
configApplyState: () => webAdmin.configApplyState(),
|
|
178
|
+
centerCredentialState: () => webAdmin.centerCredentialState(),
|
|
179
|
+
modelRefusalsState: () => webAdmin.modelRefusalsState(),
|
|
180
|
+
configHandoffState: () => webAdmin.configHandoffState(),
|
|
181
181
|
mcpRevocations,
|
|
182
|
-
mcpRevocationState: () =>
|
|
183
|
-
configRefreshNow: () =>
|
|
184
|
-
|
|
182
|
+
mcpRevocationState: () => webAdmin.mcpRevocationState(),
|
|
183
|
+
configRefreshNow: () => webAdmin.refreshNow(),
|
|
184
|
+
webAdminManagedKeys: () => webAdmin.centerManagedKeys(),
|
|
185
185
|
drainState,
|
|
186
186
|
servingLease: servingLease ? () => servingLease.view() : undefined,
|
|
187
187
|
storePosture,
|
|
188
|
-
centerWiring: createCenterWiringReader({ config, pullState: () =>
|
|
188
|
+
centerWiring: createCenterWiringReader({ config, pullState: () => webAdmin.centerPullState(), fleetLease, usageReport: fleetUsage !== undefined }),
|
|
189
189
|
storeLiveState: storeLiveProbe ? () => storeLiveProbe.state() : undefined,
|
|
190
190
|
};
|
|
191
191
|
const knobs = {
|
|
@@ -196,8 +196,8 @@ export async function runStage10(ctx) {
|
|
|
196
196
|
};
|
|
197
197
|
const resolveSpec = createResolveSpec({
|
|
198
198
|
config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver,
|
|
199
|
-
getCenterPrompts: () =>
|
|
200
|
-
getKeyResolver: () =>
|
|
199
|
+
getCenterPrompts: () => webAdmin.getCenterPrompts(),
|
|
200
|
+
getKeyResolver: () => webAdmin.getKeyResolver(),
|
|
201
201
|
taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner,
|
|
202
202
|
noteSessionIncarnation,
|
|
203
203
|
hookLlm, hookAgent, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec,
|
|
@@ -209,7 +209,7 @@ export async function runStage10(ctx) {
|
|
|
209
209
|
approverSeat: createRunnerDepsOnAsk(toolApproval),
|
|
210
210
|
});
|
|
211
211
|
const runnerFor = createHandsRunnerSelector({ full: runner, handsless: handslessRunner });
|
|
212
|
-
const sideQuery = createSideQueryLane({ brain, config, getKeyResolver: () =>
|
|
212
|
+
const sideQuery = createSideQueryLane({ brain, config, getKeyResolver: () => webAdmin.getKeyResolver() });
|
|
213
213
|
const server = createHttpServer({ runner, runnerFor, sideQuery, config, resolveSpec, stores, coordinators, seams, observability, governance, deployment, knobs });
|
|
214
214
|
bindServerLateSeats({ config, logger, server });
|
|
215
215
|
const fleetReconcile = startFleetReconciler({
|
|
@@ -274,10 +274,10 @@ export async function runStage10(ctx) {
|
|
|
274
274
|
...(fleetUsage ? { usage: fleetUsage } : {}),
|
|
275
275
|
logger: { info: (m, d) => logger.info(m, d ?? {}), warn: (m, d) => logger.warn(m, d ?? {}) },
|
|
276
276
|
});
|
|
277
|
-
|
|
277
|
+
webAdmin.onSelfReportChange(() => void fleetClient?.announceNow());
|
|
278
278
|
if (fleetClient) {
|
|
279
279
|
const advertised = config.fleetAdvertiseAddress;
|
|
280
|
-
logger.info("fleet_client_started", { worker: config.
|
|
280
|
+
logger.info("fleet_client_started", { worker: config.webAdmin?.worker, usageReport: fleetUsage !== undefined, announce: advertised !== undefined, ...(advertised !== undefined ? { address: buildDisplaySafeUrl(advertised) } : {}) });
|
|
281
281
|
}
|
|
282
282
|
const failoverFirstByte = buildFailoverFirstByteNotice(config);
|
|
283
283
|
if (failoverFirstByte)
|
|
@@ -325,7 +325,7 @@ export async function runStage10(ctx) {
|
|
|
325
325
|
config, logger, server, reaper, fleetReconcile, otelExporter, breakerState, costQuota, rateLimiter,
|
|
326
326
|
version: serviceVersion(),
|
|
327
327
|
runner, subRunner, lspManager, workflowNotifyJournal, fleetClient, backend, drainState,
|
|
328
|
-
storeLiveProbe,
|
|
328
|
+
storeLiveProbe, webAdmin,
|
|
329
329
|
toolApproval,
|
|
330
330
|
parkCommits,
|
|
331
331
|
deviceHub: deviceLane?.hub,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ServiceConfig } from "../config-types.js";
|
|
2
2
|
import type { Logger } from "../observability/logger.js";
|
|
3
3
|
export interface UnpricedCeilingVerdictCtx {
|
|
4
|
-
/** 活配置(
|
|
4
|
+
/** 活配置(web-admin 热应用就地改写的**同一个**对象——所以每次 `judge()` 读到的是当代值)。 */
|
|
5
5
|
readonly config: Pick<ServiceConfig, "models" | "maxTaskCostUsd" | "maxPrincipalCostUsd">;
|
|
6
6
|
readonly logger?: Logger;
|
|
7
7
|
}
|
|
@@ -13,12 +13,12 @@ import { type SealedKeyPublicFace } from "../sealed-key.js";
|
|
|
13
13
|
import type { UnpricedCeilingVerdict } from "./unpriced-ceiling-verdict.js";
|
|
14
14
|
import type { ConsolidationSeatWatch } from "./memory-consolidation.js";
|
|
15
15
|
import type { DegradeRouteWatch } from "../brain.js";
|
|
16
|
-
import { type EngineRestartSignal } from "../
|
|
16
|
+
import { type EngineRestartSignal } from "../web-admin-client/facade.js";
|
|
17
17
|
import { type ConfigHandoff } from "../fleet/engine-signal.js";
|
|
18
|
-
import { type ConfigApplyLedgerView } from "../
|
|
19
|
-
import type { CenterPullView } from "../
|
|
18
|
+
import { type ConfigApplyLedgerView } from "../web-admin-client/apply-ledger.js";
|
|
19
|
+
import type { CenterPullView } from "../web-admin-client/pull-state.js";
|
|
20
20
|
import type { LimitSync } from "./limit-sync.js";
|
|
21
|
-
export interface
|
|
21
|
+
export interface WebAdminRuntimeCtx {
|
|
22
22
|
config: ServiceConfig;
|
|
23
23
|
logger: Logger;
|
|
24
24
|
metrics: Metrics;
|
|
@@ -33,10 +33,10 @@ export interface CenterScenarioOverlayTargets {
|
|
|
33
33
|
/** overlay 前捕获的六内建名(centerScenarioDetails 的 shadow 判据)。 */
|
|
34
34
|
builtinScenarioNames: string[];
|
|
35
35
|
}
|
|
36
|
-
/** S-740 / S-741 / S-768:
|
|
36
|
+
/** S-740 / S-741 / S-768:web-admin 持有的三样自报状态(fleet 心跳读它们)—— 闭集:加一样 = 写口与订阅方一起表态。 */
|
|
37
37
|
export type SelfReportChange = "roster_landed" | "restart_signal" | "model_refusals";
|
|
38
38
|
/** 跨段可变状态的**唯一**对外读口 + 三个原位动作。字段语义见各方法上的注释。 */
|
|
39
|
-
export interface
|
|
39
|
+
export interface WebAdminRuntime {
|
|
40
40
|
/** 配置源形态;`undefined` = 纯 env 部署(本运行时的所有分支不存在)。 */
|
|
41
41
|
readonly providerKind: "remote" | "local" | undefined;
|
|
42
42
|
/** S-737:本进程模型钥匙保管店的**公钥面**(只有最新那把公钥;私钥 / 持有 id 列表 / 开箱口结构上够不着,见
|
|
@@ -86,7 +86,7 @@ export interface ConfigCenterRuntime {
|
|
|
86
86
|
/** [ref](core 5.50 [ref]):mid-turn MCP 撤销台账读口,喂 `RunnerDeps.mcpRevocations` 席。
|
|
87
87
|
* **取走即声明接线**——调用本方法后,restart 信号的 mcp 片对纯删除向豁免(台账即时承接);
|
|
88
88
|
* 不取 ⇒ 旧 restart 语义逐字保留(fail-closed)。 */
|
|
89
|
-
takeMcpRevocations(): import("../
|
|
89
|
+
takeMcpRevocations(): import("../web-admin-client/mcp-revocation.js").McpRevocationLedger;
|
|
90
90
|
/** [ref] 诊断投影:当前被撤销的 MCP 服务器名单;纯 env 部署(无配置管道)= undefined(additive 纪律)。 */
|
|
91
91
|
mcpRevocationState(): {
|
|
92
92
|
revoked: string[];
|
|
@@ -100,7 +100,7 @@ export interface ConfigCenterRuntime {
|
|
|
100
100
|
/** boot ready 门:布防(`CONFIG_REQUIRE_ROSTER=true`,远程 registry 非 dryRun)且 roster 未落地 =
|
|
101
101
|
* 计费提交 503 + /health ready:false。缺省未布防 ⇒ 恒 true。 */
|
|
102
102
|
modelReady(): boolean;
|
|
103
|
-
/** S-740 / S-741:本副本**自报状态**里由
|
|
103
|
+
/** S-740 / S-741:本副本**自报状态**里由 web-admin 持有的那两样 —— roster 落地(`modelReady` 翻真,one-way latch)与
|
|
104
104
|
* restart 信号(`restartState()` 出现 / 消失 / 变)—— 任一翻转的那一拍通知订阅者。装配层接 fleet 心跳的 `announceNow`,
|
|
105
105
|
* 让中心在翻转当刻就知道本副本可路由 / 要重启(不等下一拍心跳;draining 那一样由收尾链直调 `announceNow`,同一个触发)。
|
|
106
106
|
* 在状态**写定之后**调用,同步、逐个,入参 = 这一次翻的是哪一样(闭集 {@link SelfReportChange});不回放(订阅方在订阅前已读过
|
|
@@ -121,7 +121,7 @@ export interface ConfigCenterRuntime {
|
|
|
121
121
|
* `undefined` = 本部署没有配置管道(纯 env worker)⇒ 两个读面的形状**逐字不变**(additive 纪律)。 */
|
|
122
122
|
configApplyState(): ConfigApplyLedgerView | undefined;
|
|
123
123
|
/** S-866 ②:caps `centerWiring.effectivePull` / `effectiveRevision` 的取值口 —— `lastPull`(新状态,只此一枚:boot 实拉 / 迟到 boot 到货 /
|
|
124
|
-
* refresh 拍收尾写)+ 与 `configApplyState()` **同一只** ledger 视图的已应用修订号。形与词表见 `
|
|
124
|
+
* refresh 拍收尾写)+ 与 `configApplyState()` **同一只** ledger 视图的已应用修订号。形与词表见 `web-admin-client/pull-state.ts`。 */
|
|
125
125
|
centerPullState(): CenterPullView;
|
|
126
126
|
/** DESIGN-278 §5 S2([ref]):center **当前在管**的 ServiceConfig 键集 —— `GET /v1/config/catalog` 判
|
|
127
127
|
* `effectiveLane` 的 center 半场。投影自最近一次成功应用的候选(`latestEffective`,LKG/refresh 同一
|
|
@@ -142,5 +142,5 @@ export interface ConfigCenterRuntime {
|
|
|
142
142
|
*/
|
|
143
143
|
refreshNow(): Promise<"triggered" | "not-wired" | "failed">;
|
|
144
144
|
}
|
|
145
|
-
export declare function
|
|
146
|
-
//# sourceMappingURL=
|
|
145
|
+
export declare function createWebAdminRuntime(ctx: WebAdminRuntimeCtx): Promise<WebAdminRuntime>;
|
|
146
|
+
//# sourceMappingURL=web-admin.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { readFile as fsReadFile } from "node:fs/promises";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { WEB_ADMIN_ENV, formatConfigPath, skillContentHash } from "@sema-agent/settings-schema";
|
|
6
6
|
import { stableStringify } from "@sema-agent/settings-schema/hash";
|
|
7
7
|
import { buildModelRefusalsSignal } from "../model-entry-refusal.js";
|
|
8
8
|
import { CenterPromptSource, FilePromptArtifactStore, FilePromptSourceStateStore, MemoryPromptArtifactStore, MemoryPromptSourceStateStore, } from "@sema-agent/core";
|
|
@@ -15,15 +15,16 @@ import { isRosterGateArmed } from "../config.js";
|
|
|
15
15
|
import { defaultLkgPath, defaultSkillCacheDir, saveLkg, loadLkg, legacyV1LkgPath, migrateV1Lkg } from "../config-lkg.js";
|
|
16
16
|
import { answerStillCurrent, centerStateBin, credentialIdentityNow, judgeCenterCredentialAtBoot } from "../center-credential.js";
|
|
17
17
|
import { buildCenterCredentialHealthView, createCenterCredentialRenewer } from "../center-credential-renewer.js";
|
|
18
|
-
import { centerManagedConfigKeys } from "../
|
|
18
|
+
import { centerManagedConfigKeys } from "../web-admin-client/apply-effective.js";
|
|
19
|
+
import { logConfigDirMigration, migrateLocalConfigDirectory } from "../config-d-migration.js";
|
|
19
20
|
import { createConfigProvider, raceBootFetch, serviceConfigSourceKind, BOOT_FETCH_DEFERRED } from "../config-provider.js";
|
|
20
21
|
import { createKeyResolver } from "../key-resolver.js";
|
|
21
22
|
import { buildSealedKeyPublicFace, ensureSealedKeyStore, reportExecutionPublicKey } from "../sealed-key.js";
|
|
22
|
-
import { applyEffective, applyCenterReadFace, mutateInPlace, logEffectiveDiff, applyCenterSkills, resolveMcpServers, resolveA2aPeers, restartReasons, modelPlaneChanged, withModelPlaneOf, fullyLandedForLkg, fetchPromptArtifact } from "../
|
|
23
|
+
import { applyEffective, applyCenterReadFace, mutateInPlace, logEffectiveDiff, applyCenterSkills, resolveMcpServers, resolveA2aPeers, restartReasons, modelPlaneChanged, withModelPlaneOf, fullyLandedForLkg, fetchPromptArtifact } from "../web-admin-client/facade.js";
|
|
23
24
|
import { buildConfigHandoff, buildRestartSignal, configHandoffMissing } from "../fleet/engine-signal.js";
|
|
24
|
-
import { createMcpRevocationLedger, enabledMcpEntries } from "../
|
|
25
|
+
import { createMcpRevocationLedger, enabledMcpEntries } from "../web-admin-client/mcp-revocation.js";
|
|
25
26
|
import { SHA256_HEX_RE } from "../digest-form.js";
|
|
26
|
-
import { BOOT_REJUDGE_OF_REFUSED_GROUP, createConfigApplyLedger, modelPlaneCommitted, refusedGroups } from "../
|
|
27
|
+
import { BOOT_REJUDGE_OF_REFUSED_GROUP, createConfigApplyLedger, modelPlaneCommitted, refusedGroups } from "../web-admin-client/apply-ledger.js";
|
|
27
28
|
function lkgReadNote(scope) {
|
|
28
29
|
switch (scope) {
|
|
29
30
|
case "whole":
|
|
@@ -32,7 +33,7 @@ function lkgReadNote(scope) {
|
|
|
32
33
|
return "the live candidate's model plane was refused at boot — the persisted last-known-good supplies the model plane only (catalog and the collab templates that reference it); every other group and every restart-to-apply face stays the live candidate's";
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
export async function
|
|
36
|
+
export async function createWebAdminRuntime(ctx) {
|
|
36
37
|
const { config, logger, metrics, localRoot } = ctx;
|
|
37
38
|
let ccEtag;
|
|
38
39
|
let effective;
|
|
@@ -65,13 +66,13 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
65
66
|
let bootSkillStale = false;
|
|
66
67
|
let pendingRestart;
|
|
67
68
|
let modelRefusals;
|
|
68
|
-
const cc = config.
|
|
69
|
+
const cc = config.webAdmin;
|
|
69
70
|
const bootCredential = cc?.credential.read();
|
|
70
71
|
const bootVerdict = bootCredential === undefined ? undefined : judgeCenterCredentialAtBoot(bootCredential);
|
|
71
72
|
if (bootVerdict?.verdict === "refuse")
|
|
72
73
|
throw new Error(bootVerdict.sentence);
|
|
73
74
|
if (bootVerdict?.verdict === "loud") {
|
|
74
|
-
logger.error("center_credential_unreadable", { key:
|
|
75
|
+
logger.error("center_credential_unreadable", { key: WEB_ADMIN_ENV.tokenFile, failure: bootVerdict.failure, reason: bootVerdict.reason, effect: bootVerdict.effect });
|
|
75
76
|
}
|
|
76
77
|
const credentialRenewer = cc !== undefined && cc.credential.origin.from === "file"
|
|
77
78
|
? createCenterCredentialRenewer({ source: cc.credential, centerUrl: cc.baseUrl, leadMs: config.centerCredentialRenewLeadMs, logger })
|
|
@@ -110,7 +111,7 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
110
111
|
sealedKeys = await ensureSealedKeyStore(join(config.localDataRoot ?? localRoot, "sealed-key"), logger);
|
|
111
112
|
void reportExecutionPublicKey({
|
|
112
113
|
baseUrl: cc?.baseUrl,
|
|
113
|
-
adminToken: process.env.
|
|
114
|
+
adminToken: process.env[WEB_ADMIN_ENV.adminToken],
|
|
114
115
|
key: sealedKeys.latest,
|
|
115
116
|
...(cc?.worker ? { notes: `worker ${cc.worker}` } : {}),
|
|
116
117
|
logger,
|
|
@@ -122,10 +123,12 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
122
123
|
const configProvider = serviceConfigSourceKind(config) !== undefined
|
|
123
124
|
? createConfigProvider({
|
|
124
125
|
...(config.configProvider ? { provider: config.configProvider } : {}),
|
|
125
|
-
...(cc ? {
|
|
126
|
+
...(cc ? { webAdmin: { baseUrl: cc.baseUrl, credential: cc.credential, worker: cc.worker, dryRun: cc.dryRun } } : {}),
|
|
126
127
|
localDir: localRoot,
|
|
127
128
|
})
|
|
128
129
|
: undefined;
|
|
130
|
+
if (configProvider?.kind === "local")
|
|
131
|
+
logConfigDirMigration(logger, await migrateLocalConfigDirectory(localRoot));
|
|
129
132
|
const rosterGateArmed = isRosterGateArmed(cc);
|
|
130
133
|
const modelReadyState = { ready: !rosterGateArmed };
|
|
131
134
|
const warnDroppedEntries = (r, phase) => {
|
|
@@ -354,8 +357,8 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
354
357
|
}
|
|
355
358
|
const lkgPath = lkgPathFor(identity);
|
|
356
359
|
try {
|
|
357
|
-
if (effectiveObj.skills && config.
|
|
358
|
-
await applyCenterSkills([], effectiveObj.skills, config.
|
|
360
|
+
if (effectiveObj.skills && config.webAdmin) {
|
|
361
|
+
await applyCenterSkills([], effectiveObj.skills, config.webAdmin, logger, undefined, defaultSkillCacheDir(config));
|
|
359
362
|
}
|
|
360
363
|
const enabledSkills = (effectiveObj.skills?.skills ?? []).filter((m) => m.enabled !== false);
|
|
361
364
|
const cacheDir = defaultSkillCacheDir(config);
|
|
@@ -420,8 +423,21 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
420
423
|
logger.warn("config_lkg_unusable", { path: lkgPath, reason: "center credential identity changed while the LKG was being read — not used", note: "env fallback serves; the current identity's next pull re-establishes its own LKG" });
|
|
421
424
|
return null;
|
|
422
425
|
}
|
|
423
|
-
if (read.migrated !== undefined)
|
|
424
|
-
|
|
426
|
+
if (read.migrated !== undefined) {
|
|
427
|
+
const m = read.migrated;
|
|
428
|
+
logger.info("config_lkg_migrated", {
|
|
429
|
+
to: lkgPath,
|
|
430
|
+
fromFormat: m.fromFormat,
|
|
431
|
+
...(m.note !== undefined ? { note: m.note } : {}),
|
|
432
|
+
receipts: m.receipts.map((r) => ({ migration: r.migration, document: r.document, path: formatConfigPath(r.path), appliedAs: r.appliedAs })),
|
|
433
|
+
});
|
|
434
|
+
try {
|
|
435
|
+
await saveLkg(lkgPath, cc?.worker, identity, read.lkg.effective, read.lkg.etag);
|
|
436
|
+
}
|
|
437
|
+
catch (err) {
|
|
438
|
+
logger.warn("config_lkg_save_failed", { path: lkgPath, err: String(err), note: "the migrated LKG is used from memory this boot; the on-disk copy is migrated again on the next read-back and replaced by the next clean candidate" });
|
|
439
|
+
}
|
|
440
|
+
}
|
|
425
441
|
logger.info("config_loaded_lkg", { path: lkgPath, savedAt: read.lkg.savedAt, why, scope, note: lkgReadNote(scope) });
|
|
426
442
|
const lkgEffective = read.lkg.effective;
|
|
427
443
|
candidateIdentity.set(lkgEffective, identity);
|
|
@@ -648,8 +664,8 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
648
664
|
return (await manualRefresh()) === "failed" ? "failed" : "triggered";
|
|
649
665
|
},
|
|
650
666
|
async applyCenterCapabilities(skills) {
|
|
651
|
-
if (effective?.skills && config.
|
|
652
|
-
skills = await applyCenterSkills(skills, effective.skills, config.
|
|
667
|
+
if (effective?.skills && config.webAdmin) {
|
|
668
|
+
skills = await applyCenterSkills(skills, effective.skills, config.webAdmin, logger, undefined, config.configLkgEnabled ? defaultSkillCacheDir(config) : undefined);
|
|
653
669
|
}
|
|
654
670
|
if (effective?.plugins !== undefined) {
|
|
655
671
|
const pluginOut = await applyCenterPlugins(skills, effective, {
|
|
@@ -705,7 +721,7 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
705
721
|
Object.assign(scenarios, overlay);
|
|
706
722
|
Object.assign(scenarioDetails, centerScenarioDetails(effective.scenarios.scenarios, builtinScenarioNames, scenarioDeps));
|
|
707
723
|
if (Object.keys(overlay).length > 0)
|
|
708
|
-
logger.info("
|
|
724
|
+
logger.info("web_admin_scenarios", { scenarios: Object.keys(overlay), ...(shadows.length > 0 ? { shadowsBuiltin: shadows } : {}) });
|
|
709
725
|
}
|
|
710
726
|
},
|
|
711
727
|
initKeyResolver() {
|
|
@@ -785,7 +801,7 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
785
801
|
};
|
|
786
802
|
const restartLogFields = (signal) => signal ? { restartRequired: true, restartReasons: signal.reasons } : {};
|
|
787
803
|
if (configProvider) {
|
|
788
|
-
const ccRef = config.
|
|
804
|
+
const ccRef = config.webAdmin;
|
|
789
805
|
let refreshInFlight = false;
|
|
790
806
|
const refreshTick = async (arrival) => {
|
|
791
807
|
if (refreshInFlight)
|
|
@@ -895,7 +911,7 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
895
911
|
note: "a group of this candidate was refused — the live config keeps serving the prior values for it; the LKG and the ETag stay on the last FULLY applied generation (this tree is re-judged next tick)",
|
|
896
912
|
});
|
|
897
913
|
const partialSignal = signalRestart({ applied: "partial", effective: r.effective, baseline: effective, refused: refused.map((g) => g.group) });
|
|
898
|
-
logger.info("
|
|
914
|
+
logger.info("web_admin_refreshed", {
|
|
899
915
|
version: r.effective.version,
|
|
900
916
|
note: "partially applied — the refused group(s) keep their prior values (see config_candidate_partially_applied); the other groups hot-applied; restart fields as on a complete tick",
|
|
901
917
|
...restartLogFields(partialSignal),
|
|
@@ -904,7 +920,7 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
904
920
|
}
|
|
905
921
|
const lkgPersisted = await persistLkgDurable(r.effective, r.etag);
|
|
906
922
|
const signal = signalRestart({ applied: "complete", effective: r.effective, ...(r.etag !== undefined ? { etag: r.etag } : {}), baseline: effective, lkgPersisted });
|
|
907
|
-
logger.info("
|
|
923
|
+
logger.info("web_admin_refreshed", {
|
|
908
924
|
version: r.effective.version,
|
|
909
925
|
note: "collab + runtime governance (incl. approvalRequire) + limits + models/roles/roster hot-applied; skills/mcp/a2a/scenarios are restart-to-apply",
|
|
910
926
|
...restartLogFields(signal),
|
|
@@ -915,7 +931,7 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
915
931
|
}
|
|
916
932
|
}
|
|
917
933
|
catch (err) {
|
|
918
|
-
logger.warn("
|
|
934
|
+
logger.warn("web_admin_refresh_failed", { err: String(err), note: "etag NOT advanced — the same candidate is re-fetched and re-applied next poll" });
|
|
919
935
|
return "failed";
|
|
920
936
|
}
|
|
921
937
|
finally {
|
|
@@ -1044,4 +1060,4 @@ export async function createConfigCenterRuntime(ctx) {
|
|
|
1044
1060
|
},
|
|
1045
1061
|
};
|
|
1046
1062
|
}
|
|
1047
|
-
//# sourceMappingURL=
|
|
1063
|
+
//# sourceMappingURL=web-admin.js.map
|
|
@@ -51,9 +51,9 @@ export type WebFetchSummarizeLane = NonNullable<NonNullable<WebFetchConfig["summ
|
|
|
51
51
|
export interface WebFetchSummarizeLaneCtx {
|
|
52
52
|
/** 与 `RunnerDeps.brain` **同一只**实例(wrapper 在外面包,不改这只)。 */
|
|
53
53
|
brain: Brain;
|
|
54
|
-
/** 活配置引用:目录/角色表被
|
|
54
|
+
/** 活配置引用:目录/角色表被 web-admin 就地热应用(`mutateInPlace`),按调用取值才跟得上。 */
|
|
55
55
|
config: ServiceConfig;
|
|
56
|
-
/** 活引用取值 —— registry 热应用整个换 resolver 引用(`boot/
|
|
56
|
+
/** 活引用取值 —— registry 热应用整个换 resolver 引用(`boot/web-admin.ts` 每次 apply 重铸)。 */
|
|
57
57
|
getKeyResolver: () => KeyResolver;
|
|
58
58
|
logger: Logger;
|
|
59
59
|
}
|
package/dist/brain.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Brain, type BreakerState, type Model } from "@sema-agent/core";
|
|
2
2
|
import type { ServiceConfig } from "./config-types.js";
|
|
3
3
|
import { type SealedCustodyPoison } from "./key-resolver.js";
|
|
4
|
-
import { type RestartSliceCtx } from "./
|
|
4
|
+
import { type RestartSliceCtx } from "./web-admin-client/restart-signal.js";
|
|
5
5
|
/**
|
|
6
6
|
* 配了快切层(failover ≥2 路 / 断路器)时,**每路**的重试上限。
|
|
7
7
|
*
|
package/dist/brain.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createHash } from "node:crypto";
|
|
|
6
6
|
import { isModelKeyPoison, modelKeyPoisonIdentity } from "./key-resolver.js";
|
|
7
7
|
import { dispatchBrainLane } from "./model-provider.js";
|
|
8
8
|
import { openaiRouteBaseUrl } from "./model-route-endpoint.js";
|
|
9
|
-
import { catalogEntryFingerprint } from "./
|
|
9
|
+
import { catalogEntryFingerprint } from "./web-admin-client/restart-signal.js";
|
|
10
10
|
import { buildDisplaySafeRefusal, buildDisplaySafeUrl } from "./trace/redact.js";
|
|
11
11
|
import { createModelReachBrain } from "./model-unreachable-notice.js";
|
|
12
12
|
function isOffDeploymentRoot(baseUrl, config) {
|
package/dist/budget.d.ts
CHANGED
|
@@ -23,13 +23,13 @@ import { type PromptManifestTracker } from "./observability/prompt-manifest.js";
|
|
|
23
23
|
export declare function buildPricing(models: Record<string, Model>): Record<string, ModelPricing>;
|
|
24
24
|
/**
|
|
25
25
|
* 缝合审 M3:`capabilities.pricingConfigured` 的判据 —— 提成函数放在 pricing 自己的文件里,因为
|
|
26
|
-
* **这个表是热变的**(`boot/
|
|
26
|
+
* **这个表是热变的**(`boot/web-admin.ts` 的 `mutateInPlace(pricing, buildPricing(config.models))`,
|
|
27
27
|
* 那行注释自己写着 `hot: cost/model changes`)。旧码在 `main.ts` 的 capabilities 字面量里把它算成一个
|
|
28
|
-
* **boot 时的布尔快照**,于是运维在
|
|
28
|
+
* **boot 时的布尔快照**,于是运维在 web-admin 里加上/撤掉价目表之后,`/v1/capabilities` 还报旧值 ——
|
|
29
29
|
* 而这个键的**全部用途**就是给消费端消歧「costMicroUsd=0 是免费跑,还是根本没配价目表」,报错了就是
|
|
30
30
|
* 把消歧信号变成误导信号。main.ts 侧改用 getter(读时求值)。
|
|
31
31
|
*
|
|
32
|
-
* 同一条论证在同一个字面量里**已经执行过一次**:紧邻的 `restartState: () =>
|
|
32
|
+
* 同一条论证在同一个字面量里**已经执行过一次**:紧邻的 `restartState: () => webAdmin.restartState()`
|
|
33
33
|
* 带着注释「A live getter (not a snapshot) so /health always reads current」—— 兄弟键漏了。本仓第 7 例同形。
|
|
34
34
|
*
|
|
35
35
|
* 🔴 B-089(判据本身,同一条「0 不是缺席」的病):此前判的是「**有没有一项正价**」
|
package/dist/canonical-json.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* ## 为什么只能有一个
|
|
6
6
|
* 合并前本仓有 **5 处**手写复刻(memory-origin-fence / permission-rule-store-sql / bench-l8 artifact /
|
|
7
|
-
*
|
|
7
|
+
* web-admin restart-signal / mcp-revocation),每处一份「排 key、递归、拼串」——同一个算法五份实现,
|
|
8
8
|
* 语义在边缘(undefined 值键、函数成员、非有限数)各自漂了一点。指纹型代码的病灶恰恰在边缘:同一份内容算出
|
|
9
9
|
* 两个指纹 = 落库 checksum 失配 / 误签 restart / 包完整性自校验对不上。
|
|
10
10
|
*
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* · `bigint`:`JSON.stringify` 抛 TypeError,原样上抛。
|
|
30
30
|
*
|
|
31
31
|
* ## 不在本文件里的第二形(如实登记)
|
|
32
|
-
* `src/
|
|
32
|
+
* `src/web-admin-client/restart-signal.ts#stableStringify`(mcp-revocation 同源改调)是**另一个语义**:undefined 值键
|
|
33
33
|
* **保留为 `"k":null`**。两族在 JSON 形输入上逐字节相同(golden 交叉读数已证),分歧只在进程内构造的
|
|
34
34
|
* `{k: undefined}` 形——restart 指纹的输入正是进程内切片对象,该形原则上可达,而 `{k:undefined}` 与 `{}` 是否
|
|
35
35
|
* 同指纹是 restart-signal 轴上的**行为**(多签/少签一次 fleet 滚动重启),不是序列化器的私事 ⇒ 本批不并
|
|
@@ -85,7 +85,7 @@ export interface ApplyPluginsResult {
|
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* 装载器**会物化**的插件(按声明序)—— 每条声明过**同一只**判定 {@link validatePluginDecl},只留 `ok` 的
|
|
88
|
-
* `{name, url, sha?}`。restart 指纹(`
|
|
88
|
+
* `{name, url, sha?}`。restart 指纹(`web-admin-client/restart-signal.ts` 的 skills 片,S-668 波 0)读的就是它:
|
|
89
89
|
* 装载器不读的字段(notes / version)、整条跳过的声明(`enabled:false` / marketplace 源 / 白名单外 host / 坏形)
|
|
90
90
|
* 在这里一并消失,于是「重启之后什么都不会变」的发布不签重启(codex 对抗复审 r1 [medium]);顺序保留 ——
|
|
91
91
|
* 撞名让位按声明序,对调两条是真变化。`allowHosts` 与装载时同一份(部署事实 `PLUGINS_ALLOW_HOSTS`)。
|
|
@@ -5,16 +5,20 @@
|
|
|
5
5
|
* 与运维面板都读不出「额度现在没人在判」。本键把它们收成一个读面(调用方面;运维面仍是 `/health` 与 `GET /v1/diagnostics/wiring`)。
|
|
6
6
|
*
|
|
7
7
|
* ## 形与 present-iff
|
|
8
|
-
* 整个键只在接了中心(`config.
|
|
8
|
+
* 整个键只在接了中心(`config.webAdmin` 在场)时出现;`lease:"absent"`(中心三件不齐 ⇒ 没装租约管理器)时 `leaseHealth` /
|
|
9
9
|
* `failMode` / `caller` 三键缺席。「键缺席」于是两义:老 worker / 没接中心 —— 同一体的 `version` 能分。
|
|
10
10
|
* · `effectivePull` = 最近一次实拉成功(`lastPull === "ok"`;LKG 起服 / 从未成功 / 最近一拍失败 = false);
|
|
11
|
-
* · `effectiveRevision` = 与 `/health.configAppliedVersion` 同一只 ledger 视图(`
|
|
11
|
+
* · `effectiveRevision` = 与 `/health.configAppliedVersion` 同一只 ledger 视图(`web-admin-client/pull-state.ts`);
|
|
12
12
|
* · `lease` / `leaseHealth` / `failMode` / `caller` = 租约管理器的 `snapshot()` 与生效姿态(与执行的那一只同源);
|
|
13
13
|
* · `usageReport` = 用量环装没装(装配事实:累加器与环同一只谓词 `centerLaneConfigured`);
|
|
14
|
-
* · `issuer` = 鉴权桥 issuer 显式 / 回退(`authBridgeIssuerOf`;接了中心 ⇒ 桥恒装 ⇒ 没有 `none` 这一词)
|
|
14
|
+
* · `issuer` = 鉴权桥 issuer 显式 / 回退(`authBridgeIssuerOf`;接了中心 ⇒ 桥恒装 ⇒ 没有 `none` 这一词);
|
|
15
|
+
* · `worker` = 引擎向中心登记用的 worker 名(取值口 = `config.webAdmin.worker`,排空口身份四元读的同一只)。**present-iff 配了名且名可披露**:
|
|
16
|
+
* 没配 ⇒ 缺席(不拼不猜);配了但不是标识符形 / 是秘密形(契约 `isDisclosableIdentity`,「引擎要不要把一个名字写出去」问的那一只)⇒ 按无名处置,
|
|
17
|
+
* 键缺席,不打码。它住在这张**有鉴权**的能力面、不住无鉴权 `/health`(`http/health-self-report.ts` 头注:worker 名刻意不上无鉴权面)——
|
|
18
|
+
* 壳附着后用它拼网页会话链接(`<webBaseUrl>/chat?agent=<worker>&session=<id>`)。
|
|
15
19
|
* caps 路由自己**不 admit**(不打中心):读的是最近一次谈判留下的状态。
|
|
16
20
|
*/
|
|
17
|
-
import type { CenterPullView } from "../
|
|
21
|
+
import type { CenterPullView } from "../web-admin-client/pull-state.js";
|
|
18
22
|
import type { CallerLease, FleetLeaseManager, LeaseFailMode, LeaseHealth, LeaseSnapshot } from "../fleet-lease.js";
|
|
19
23
|
import type { ServiceConfig } from "../config.js";
|
|
20
24
|
/** `issuer` 的词表(两词:接了中心 ⇒ 桥恒装,`none` 结构上到不了,闭集里不留死词)。 */
|
|
@@ -32,6 +36,7 @@ export interface CenterWiring {
|
|
|
32
36
|
readonly failMode?: LeaseFailMode;
|
|
33
37
|
readonly usageReport: boolean;
|
|
34
38
|
readonly issuer: CenterIssuer;
|
|
39
|
+
readonly worker?: string;
|
|
35
40
|
readonly caller?: {
|
|
36
41
|
readonly lease: CallerLease;
|
|
37
42
|
readonly retryAfterSec?: number;
|
|
@@ -47,6 +52,8 @@ export interface CenterWiringFacts {
|
|
|
47
52
|
} | undefined;
|
|
48
53
|
readonly usageReport: boolean;
|
|
49
54
|
readonly issuer: CenterIssuer;
|
|
55
|
+
/** 配置里的 worker 名(`config.webAdmin.worker`;缺席 = 没配)。可披露性在投影里判,不在取值处判。 */
|
|
56
|
+
readonly worker: string | undefined;
|
|
50
57
|
}
|
|
51
58
|
/** 输入 → caps 投影(纯函数,`build*` = 纯数据)。 */
|
|
52
59
|
export declare function buildCenterWiring(f: CenterWiringFacts): CenterWiring;
|
|
@@ -55,7 +62,7 @@ export declare function buildCenterWiring(f: CenterWiringFacts): CenterWiring;
|
|
|
55
62
|
* 没接中心 ⇒ `undefined`(键整个缺席)。`now` 注入只给测试(与租约管理器同钟才判得出过期);生产缺省 `Date.now`。
|
|
56
63
|
*/
|
|
57
64
|
export declare function createCenterWiringReader(a: {
|
|
58
|
-
readonly config: Pick<ServiceConfig, "
|
|
65
|
+
readonly config: Pick<ServiceConfig, "webAdmin" | "authBridgeIssuer">;
|
|
59
66
|
readonly pullState: () => CenterPullView;
|
|
60
67
|
readonly fleetLease: Pick<FleetLeaseManager, "snapshot" | "failMode"> | undefined;
|
|
61
68
|
readonly usageReport: boolean;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { authBridgeIssuerOf } from "../auth-bridge.js";
|
|
2
|
+
import { isDisclosableIdentity } from "@sema-agent/settings-schema";
|
|
2
3
|
export const CENTER_ISSUER_WORDS = ["explicit", "fallback"];
|
|
3
4
|
export function buildCenterWiring(f) {
|
|
4
|
-
const base = {
|
|
5
|
+
const base = {
|
|
6
|
+
effectivePull: f.pull.lastPull === "ok",
|
|
7
|
+
effectiveRevision: f.pull.effectiveRevision,
|
|
8
|
+
usageReport: f.usageReport,
|
|
9
|
+
issuer: f.issuer,
|
|
10
|
+
...(f.worker !== undefined && isDisclosableIdentity(f.worker) ? { worker: f.worker } : {}),
|
|
11
|
+
};
|
|
5
12
|
if (f.lease === undefined)
|
|
6
13
|
return { ...base, lease: "absent" };
|
|
7
14
|
return { ...base, lease: "configured", leaseHealth: f.lease.snapshot.leaseHealth, failMode: f.lease.failMode, caller: f.lease.snapshot.caller };
|
|
8
15
|
}
|
|
9
16
|
export function createCenterWiringReader(a) {
|
|
10
|
-
|
|
17
|
+
const webAdmin = a.config.webAdmin;
|
|
18
|
+
if (webAdmin === undefined)
|
|
11
19
|
return undefined;
|
|
12
20
|
const issuer = authBridgeIssuerOf(a.config);
|
|
13
21
|
if (issuer === undefined)
|
|
@@ -19,6 +27,7 @@ export function createCenterWiringReader(a) {
|
|
|
19
27
|
lease: lease === undefined ? undefined : { failMode: lease.failMode, snapshot: lease.snapshot(principal, now()) },
|
|
20
28
|
usageReport: a.usageReport,
|
|
21
29
|
issuer: issuer.source,
|
|
30
|
+
worker: webAdmin.worker,
|
|
22
31
|
});
|
|
23
32
|
}
|
|
24
33
|
//# sourceMappingURL=center-wiring.js.map
|
|
@@ -42,7 +42,7 @@ export declare const COMPOSITE_CAPABILITY_MEMBERS: {
|
|
|
42
42
|
readonly fleet: readonly ["stream", "sessionScope", "observe", "resume", "bgNotifyFailClosed", "steerPriority", "hookFailureNotice", "leaseClient", "generationEcho"];
|
|
43
43
|
readonly memoryEngine: readonly ["backend", "vectorMode"];
|
|
44
44
|
readonly store: readonly ["declared", "backend", "durable", "degradedReason", "sql"];
|
|
45
|
-
readonly centerWiring: readonly ["effectivePull", "effectiveRevision", "lease", "leaseHealth", "failMode", "usageReport", "issuer", "caller"];
|
|
45
|
+
readonly centerWiring: readonly ["effectivePull", "effectiveRevision", "lease", "leaseHealth", "failMode", "usageReport", "issuer", "worker", "caller"];
|
|
46
46
|
readonly webSearch: readonly ["backend"];
|
|
47
47
|
readonly background: readonly ["listFace", "exitFaces"];
|
|
48
48
|
readonly taskSettings: readonly ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks"];
|