@sema-agent/server 7.104.0 → 7.106.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 +114 -0
- package/USAGE.md +193 -52
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +2 -0
- package/deploy/sema-up/cluster-up.sh +15 -2
- package/deploy/sema-up/kube-up.sh +8 -3
- package/deploy/sema-up/lib/flagshape.sh +29 -0
- package/deploy/sema-up/lib/parse-machines.py +4 -1
- package/deploy/sema-up/sema-up.sh +11 -9
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +3 -1
- package/dist/approval-card.d.ts +1 -1
- package/dist/approval.d.ts +6 -1
- package/dist/approval.js +4 -4
- package/dist/auth-bridge.d.ts +14 -0
- package/dist/auth-bridge.js +7 -0
- package/dist/auto-mode-face.d.ts +49 -40
- package/dist/auto-mode-face.js +6 -68
- package/dist/bench/s1/live-deps.d.ts +9 -2
- package/dist/bench/s1/live-deps.js +13 -8
- package/dist/boot/budget-tracing.js +3 -2
- package/dist/boot/config-center.d.ts +4 -0
- package/dist/boot/config-center.js +95 -37
- package/dist/boot/coordinators.d.ts +1 -0
- package/dist/boot/coordinators.js +3 -1
- package/dist/boot/device-lane.d.ts +2 -1
- package/dist/boot/execution-env.d.ts +11 -0
- package/dist/boot/execution-env.js +30 -6
- package/dist/boot/execution-lane.js +2 -3
- package/dist/boot/leader.d.ts +2 -1
- package/dist/boot/leader.js +2 -0
- package/dist/boot/parked-revive-gate.d.ts +10 -7
- package/dist/boot/parked-revive-gate.js +4 -11
- package/dist/boot/resolve-spec.d.ts +1 -4
- package/dist/boot/resolve-spec.js +44 -21
- package/dist/boot/runner-deps.d.ts +5 -8
- package/dist/boot/runner-deps.js +5 -10
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +2 -1
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +3 -2
- package/dist/boot/stage-06-runners.js +2 -5
- package/dist/boot/stage-07-capability-layer.d.ts +2 -2
- package/dist/boot/stage-07-capability-layer.js +1 -2
- package/dist/boot/stage-08-reapers.d.ts +2 -2
- package/dist/boot/stage-09-leader.d.ts +2 -2
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +2 -2
- package/dist/boot/stage-10-http-server.js +11 -7
- package/dist/boot/stores.d.ts +1 -1
- package/dist/boot/stores.js +6 -4
- package/dist/brain.d.ts +24 -2
- package/dist/brain.js +29 -10
- package/dist/budget.js +3 -0
- package/dist/capabilities/center-wiring.d.ts +64 -0
- package/dist/capabilities/center-wiring.js +24 -0
- package/dist/capabilities/composite-members.d.ts +89 -0
- package/dist/capabilities/composite-members.js +20 -0
- package/dist/capabilities/execution-lane.d.ts +3 -0
- package/dist/capabilities/execution-lane.js +5 -2
- package/dist/config-catalog.d.ts +30 -5
- package/dist/config-catalog.js +75 -26
- package/dist/config-center/apply-effective.d.ts +1 -1
- package/dist/config-center/apply-effective.js +7 -8
- package/dist/config-center/apply-ledger.d.ts +17 -0
- package/dist/config-center/apply-ledger.js +5 -0
- package/dist/config-center/center-request.d.ts +17 -0
- package/dist/config-center/center-request.js +4 -0
- package/dist/config-center/pull-state.d.ts +29 -0
- package/dist/config-center/pull-state.js +2 -0
- package/dist/config-types.d.ts +41 -14
- package/dist/config-types.js +1 -0
- package/dist/config.d.ts +50 -2
- package/dist/config.js +111 -23
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/deployment-governance.d.ts +12 -1
- package/dist/deployment-governance.js +2 -0
- package/dist/execution-lane-caps.d.ts +30 -2
- package/dist/execution-lane-caps.js +12 -0
- package/dist/file-history-disclosure.d.ts +7 -31
- package/dist/file-history-disclosure.js +12 -0
- package/dist/fleet/fleet-bus.d.ts +5 -1
- package/dist/fleet-client.d.ts +18 -13
- package/dist/fleet-client.js +32 -22
- package/dist/fleet-lease.d.ts +72 -47
- package/dist/fleet-lease.js +66 -14
- package/dist/governance-http-status.d.ts +0 -1
- package/dist/governance-http-status.js +0 -1
- package/dist/hosted-posture.d.ts +6 -17
- package/dist/hosted-posture.js +11 -6
- package/dist/http/admission.d.ts +1 -1
- package/dist/http/admission.js +14 -9
- package/dist/http/approval-sweeps.js +13 -1
- package/dist/http/dispatch.d.ts +18 -0
- package/dist/http/dispatch.js +18 -5
- package/dist/http/durable-run-leg.js +2 -0
- package/dist/http/request-guards.d.ts +25 -0
- package/dist/http/request-guards.js +25 -5
- package/dist/http/resume-legs.d.ts +1 -1
- package/dist/http/resume-legs.js +19 -11
- package/dist/http/route-ctx.d.ts +9 -0
- package/dist/http/route-table.d.ts +15 -4
- package/dist/http/route-table.js +6 -5
- package/dist/http/routes/approvals-assistant.js +0 -1
- package/dist/http/routes/capabilities.js +12 -11
- package/dist/http/routes/config-catalog.js +2 -1
- package/dist/http/routes/diagnostics.js +2 -0
- package/dist/http/routes/fleet.d.ts +3 -2
- package/dist/http/routes/images.js +0 -1
- package/dist/http/routes/runs.js +2 -8
- package/dist/http/routes/session-sync.js +6 -1
- package/dist/http/routes/sessions.js +5 -2
- package/dist/http/routes/side-query.js +8 -1
- package/dist/http/routes/tasks.js +4 -1
- package/dist/http/routes/trace-usage.d.ts +2 -0
- package/dist/http/routes/trace-usage.js +4 -9
- package/dist/http/server.d.ts +29 -8
- package/dist/http/server.js +4 -1
- package/dist/http/session-inherit-env.d.ts +37 -0
- package/dist/http/session-inherit-env.js +6 -0
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +12 -9
- package/dist/http/sse-log.js +1 -8
- package/dist/http/wire-types.d.ts +19 -28
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/key-resolver.d.ts +74 -19
- package/dist/key-resolver.js +65 -7
- package/dist/leader/leader.d.ts +6 -0
- package/dist/leader/leader.js +2 -1
- package/dist/leader/repair-wire.js +2 -1
- package/dist/leader/wire.d.ts +9 -1
- package/dist/leader/wire.js +10 -6
- package/dist/observability/fail-open.d.ts +9 -1
- package/dist/observability/fail-open.js +9 -1
- package/dist/observability/metrics.js +3 -1
- package/dist/observability/permission-rule-events.d.ts +1 -1
- package/dist/observability/permission-rule-events.js +1 -1
- package/dist/observability/run-terminal.d.ts +82 -9
- package/dist/observability/run-terminal.js +112 -9
- package/dist/observability/secret-env-scrub.js +1 -1
- package/dist/observability/tool-trace.d.ts +2 -0
- package/dist/operator-ask.d.ts +29 -1
- package/dist/operator-ask.js +6 -0
- package/dist/parked-decide.d.ts +14 -1
- package/dist/parked-decide.js +8 -1
- package/dist/plugins/image-bake-store-sql.d.ts +0 -2
- package/dist/plugins/image-bake-store-sql.js +0 -5
- package/dist/plugins/retention-store-sql.js +1 -0
- package/dist/plugins/run-store-sql.d.ts +3 -2
- package/dist/plugins/schema-indexes.js +1 -0
- package/dist/plugins/session-policy-store-sql.d.ts +38 -7
- package/dist/plugins/session-policy-store-sql.js +73 -18
- package/dist/plugins/sql-driver.d.ts +1 -1
- package/dist/plugins/store-backend.d.ts +17 -6
- package/dist/plugins/store-backend.js +16 -5
- package/dist/plugins/tidb-pool.js +5 -4
- package/dist/read-face-posture.d.ts +25 -4
- package/dist/read-face-posture.js +9 -0
- package/dist/request-key-closure.js +2 -2
- package/dist/request-value-closure.d.ts +17 -5
- package/dist/request-value-closure.js +12 -0
- package/dist/router/route-orchestration.d.ts +11 -0
- package/dist/router/route-orchestration.js +7 -6
- package/dist/rules-consent.js +0 -11
- package/dist/run-local.js +4 -2
- package/dist/runs.d.ts +2 -1
- package/dist/runs.js +4 -4
- package/dist/runtime-caps-resolver.d.ts +4 -10
- package/dist/runtime-governance.d.ts +8 -11
- package/dist/runtime-governance.js +10 -41
- package/dist/sealed-key.d.ts +0 -40
- package/dist/sealed-key.js +0 -20
- package/dist/server-secret-env.d.ts +11 -12
- package/dist/session-policy-wire.d.ts +100 -12
- package/dist/session-policy-wire.js +71 -8
- package/dist/session-titler.d.ts +11 -0
- package/dist/session-titler.js +6 -2
- package/dist/sql-engine-posture.d.ts +2 -2
- package/dist/store-posture.d.ts +53 -0
- package/dist/store-posture.js +32 -0
- package/dist/task-settings.d.ts +34 -45
- package/dist/task-settings.js +46 -25
- package/dist/tool-approval.d.ts +51 -22
- package/dist/tool-approval.js +44 -8
- package/dist/tool-declaration-http-status.d.ts +12 -0
- package/dist/tool-declaration-http-status.js +12 -0
- package/dist/trace/core-keyset-guard.d.ts +7 -7
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +5 -0
- package/dist/trace/project.d.ts +13 -7
- package/dist/trace/project.js +54 -6
- package/dist/trace/redact.d.ts +7 -0
- package/dist/trace/redact.js +153 -61
- package/dist/trace/wire-projection-faces.d.ts +1 -1
- package/dist/trace/wire-projection-faces.js +1 -1
- package/dist/unattended-permission-mode.d.ts +110 -0
- package/dist/unattended-permission-mode.js +65 -0
- package/package.json +3 -3
- package/dist/boot/session-shell-gate-registry.d.ts +0 -39
- package/dist/boot/session-shell-gate-registry.js +0 -21
- package/dist/plugins/memory-session-policy-store.d.ts +0 -46
- package/dist/plugins/memory-session-policy-store.js +0 -52
- package/dist/roster-bound-http-status.d.ts +0 -6
- package/dist/roster-bound-http-status.js +0 -6
|
@@ -17,7 +17,7 @@ import type { StoreBackend } from "../plugins/store-backend.js";
|
|
|
17
17
|
import { type TaskAttachmentStore } from "../plugins/task-attachment-store.js";
|
|
18
18
|
import { type createPrincipalEntitlementsClient } from "../runtime-caps-resolver.js";
|
|
19
19
|
import { type OwnerAwareSessionStore } from "../security.js";
|
|
20
|
-
import type
|
|
20
|
+
import { type RunnerDepsOnAsk } from "./runner-deps.js";
|
|
21
21
|
type PrincipalCaps = ReturnType<typeof createPrincipalEntitlementsClient>;
|
|
22
22
|
/** `resolveSpec` 原先从 `main()` 闭包里拿到的全部 boot 局部量。 */
|
|
23
23
|
export interface ResolveSpecCtx {
|
|
@@ -47,9 +47,6 @@ export interface ResolveSpecCtx {
|
|
|
47
47
|
hookWakeBus: {
|
|
48
48
|
deliver?: (sessionId: string, text: string) => Promise<boolean>;
|
|
49
49
|
};
|
|
50
|
-
/** [ref] 件⑤:per-session「显式 bypassPermissions」登记簿的写腿(`boot/session-shell-gate-registry.ts`);
|
|
51
|
-
* 阶段④ 算出 effMode 的那一行登记,runner-deps 的 config 忠告汇点按 sessionId 回查定级。缺席(桩)= 不登记。 */
|
|
52
|
-
noteSessionShellGate?: ((sessionId: string | undefined, explicitOff: boolean) => void) | undefined;
|
|
53
50
|
resumeAnchorStore: ReturnType<StoreBackend["resumeAnchor"]> | undefined;
|
|
54
51
|
ownerAware: OwnerAwareSessionStore;
|
|
55
52
|
taskLimitCaps: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { realpathSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { NodeExecutionEnv, QUESTION_AWAITS_RESUME, WRITE_EXEMPT_DIR_COVERS_ROOT_CODE, deriveAskEffective, expandTiers, resolveAskSeamForm, tightenTaskSpec } from "@sema-agent/core";
|
|
3
|
+
import { NodeExecutionEnv, QUESTION_AWAITS_RESUME, WRITE_EXEMPT_DIR_COVERS_ROOT_CODE, deriveAskEffective, expandTiers, modePolicyOf, resolveAskSeamForm, tightenTaskSpec } from "@sema-agent/core";
|
|
4
4
|
import { cappedCeiling } from "../budget.js";
|
|
5
5
|
import { centerPromptProvider, centerIdentityAssembled } from "../capabilities/center-prompts.js";
|
|
6
6
|
import { SessionEnvironmentSelection, selectEnvironmentTool } from "../capabilities/select-environment-tool.js";
|
|
@@ -14,7 +14,7 @@ import { singleUserAutoAcceptBaselineApplies } from "../approval.js";
|
|
|
14
14
|
import { acceptShellScratchpadDir, buildEnvFacts, egressForRemoteExec, ensureScratchpadDir, resumeFactsForLane, scratchpadCoveringTaskRoot } from "../env-facts.js";
|
|
15
15
|
import { FleetEventBus } from "../fleet/fleet-bus.js";
|
|
16
16
|
import { composeHooks, createTaskHooks } from "../hooks/hook-runner.js";
|
|
17
|
-
import { HOST_POSTURE_REFUSED_CODE,
|
|
17
|
+
import { HOST_POSTURE_REFUSED_CODE, taskInheritEnvRefusal, taskWriteFaceRefusal } from "../hosted-posture.js";
|
|
18
18
|
import { headerStr } from "../http/principal-gate.js";
|
|
19
19
|
import { explicitOperatorOk } from "../http/server.js";
|
|
20
20
|
import { isModelAllowlisted, matchCatalogModel, modelSupportsImages, refusedCatalogEntry, resolveTaskModel, selectableCatalog, terminalCatalogName } from "../model-select.js";
|
|
@@ -28,22 +28,24 @@ import { gateExecutionLane } from "../runtime-caps-resolver.js";
|
|
|
28
28
|
import { applyRuntimeGovernance, stripDelegationTools } from "../runtime-governance.js";
|
|
29
29
|
import { HttpError, encodeCheckpointScope } from "../security.js";
|
|
30
30
|
import { memoryProjectKeyFor, memorySpecForRequest } from "../memory-scope.js";
|
|
31
|
-
import { singleMemberOffFieldIssue } from "../request-value-closure.js";
|
|
31
|
+
import { inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
|
|
32
32
|
import { a2aForScenario, mcpForScenario } from "../config-center/facade.js";
|
|
33
33
|
import { normalizeAttachments, normalizeResilience, normalizeResumeAtMode, normalizeSuggestNextPrompts, promptProfileFromBody, resolveTaskLimits, retainBackgroundProcessesFromBody, taskAgentsSpecFragment, toolMaterializeStrategyFromBody, toolNameListFromBody } from "../spec-fields.js";
|
|
34
34
|
import { cwdHonored, deviceCwdHonored, effectiveHostWorkspace, inProcessSingleUserLane, isValidCwd, parseAdditionalDirectories, satisfiedByProcessCwd, shellEnvMismatchCount } from "../task-cwd.js";
|
|
35
35
|
import { assertRequestA2aUnlocked, resolveRequestA2a } from "../task-a2a.js";
|
|
36
36
|
import { assertRequestMcpContentOrigin, assertRequestMcpUnlocked, resolveRequestMcp } from "../task-mcp.js";
|
|
37
|
-
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, acceptAppendSystemPrompt, applyTaskSettings,
|
|
37
|
+
import { ENGINE_ABSENT_PERMISSION_MODE, MAX_SETTINGS_OUTPUT_STYLE_CHARS, acceptAppendSystemPrompt, applyTaskSettings, effectivePermissionMode, effectiveThinking, hasConstitutionAnchors, parseTaskSettings, providerDropsAppend, settingsPermissionBucketIssue, withPermissionMode } from "../task-settings.js";
|
|
38
38
|
import { enableForkFromBody, normalizeRetainSubagentSessions, selfOrchestrationFromBody } from "../task-workflow.js";
|
|
39
39
|
import { redactSecrets } from "../trace/redact.js";
|
|
40
40
|
import { DeferredSandboxPathEnv, isSandboxPathAdjudicationLane, sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
|
|
41
41
|
import { executionLaneCaps, executionLaneHomeDir, executionLaneOf } from "../execution-lane-caps.js";
|
|
42
42
|
import { effectiveMemoryPersistenceCapable } from "./memory-boundary.js";
|
|
43
|
+
import { buildDeploymentPostureSeats } from "./runner-deps.js";
|
|
44
|
+
import { createUnattendedLeg, unattendedPermissionMode, withUnattendedLeg } from "../unattended-permission-mode.js";
|
|
43
45
|
import { memoryFaceMounted } from "../memory-scope.js";
|
|
44
46
|
import { createAssemblyIncarnationRead, sessionFaceReaderOf } from "./session-incarnation-seat.js";
|
|
45
47
|
export function createResolveSpec(ctx) {
|
|
46
|
-
const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getCenterPrompts, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, noteSessionIncarnation, hookLlm, hookAgent, fleetBus, hookWakeBus,
|
|
48
|
+
const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getCenterPrompts, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, noteSessionIncarnation, hookLlm, hookAgent, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, durableEnabled, approvalExemptionStore, checkpointStore, deploymentHooks, imageIndex, perTaskImage, sessionEnvSelection, liveQuestionFace, approverSeat, lockedKeys, } = ctx;
|
|
47
49
|
assertGuardPatternsUsable(config);
|
|
48
50
|
const assemblyIncarnationRead = createAssemblyIncarnationRead(sessionFaceReaderOf(ownerAware), (e, f) => logger.warn(e, f));
|
|
49
51
|
const onlySensitiveBaseline = buildOnlySensitiveBaselineWarning(config, {
|
|
@@ -79,15 +81,35 @@ export function createResolveSpec(ctx) {
|
|
|
79
81
|
if (offFieldIssue) {
|
|
80
82
|
throw new HttpError(400, offFieldIssue.message, { code: "request.field_invalid" });
|
|
81
83
|
}
|
|
84
|
+
{
|
|
85
|
+
const inheritEnvIssue = inheritEnvFieldIssue(body);
|
|
86
|
+
if (inheritEnvIssue)
|
|
87
|
+
throw new HttpError(400, inheritEnvIssue, { code: "request.field_invalid" });
|
|
88
|
+
if (body.inheritEnv === "all") {
|
|
89
|
+
const lane = executionLaneOf(config.remoteExec?.provider);
|
|
90
|
+
if (lane !== "host") {
|
|
91
|
+
throw new HttpError(400, `inheritEnv:"all" applies to the host lane only (this deployment runs ${lane}) — only the host lane builds the model-driven shell's environment from this machine's own, so the declaration has no effect here; omit it (or send "scrub", the default, which every lane accepts)`, { code: "request.field_invalid" });
|
|
92
|
+
}
|
|
93
|
+
const why = taskInheritEnvRefusal(config);
|
|
94
|
+
if (why !== undefined)
|
|
95
|
+
throw new HttpError(422, why, { code: HOST_POSTURE_REFUSED_CODE });
|
|
96
|
+
if (!auth?.sessionId)
|
|
97
|
+
throw new HttpError(400, `inheritEnv:"all" requires a session-resolving deployment (no authorizer session) — the host shell's environment is bound per session`, { code: "request.field_invalid" });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
{
|
|
101
|
+
const bucketIssue = settingsPermissionBucketIssue(body.settings?.permissions);
|
|
102
|
+
if (bucketIssue)
|
|
103
|
+
throw new HttpError(400, bucketIssue.message, { code: "request.field_invalid", extra: bucketIssue.fields });
|
|
104
|
+
}
|
|
82
105
|
assertRequestA2aUnlocked(body.a2aPeers, lockedKeys);
|
|
83
106
|
const gated = await gateScenarioAndAppend(body, auth, opts);
|
|
84
107
|
const effMode = effectivePermissionMode(body, gated.parsedSettings.settings);
|
|
85
|
-
if (effMode !== undefined &&
|
|
108
|
+
if (effMode !== undefined && modePolicyOf(effMode).writeFace === "open") {
|
|
86
109
|
const why = taskWriteFaceRefusal(config);
|
|
87
110
|
if (why !== undefined)
|
|
88
111
|
throw new HttpError(422, why, { code: HOST_POSTURE_REFUSED_CODE });
|
|
89
112
|
}
|
|
90
|
-
noteSessionShellGate?.(auth?.sessionId, effMode !== undefined && shellGateForMode(effMode) === "off");
|
|
91
113
|
const lane = bindSettingsCwdEnvAndModel(body, auth, gated, effMode, opts);
|
|
92
114
|
if (auth?.sessionId && assemblyIncarnationRead)
|
|
93
115
|
noteSessionIncarnation(auth.sessionId, await assemblyIncarnationRead(auth.sessionId));
|
|
@@ -99,7 +121,8 @@ export function createResolveSpec(ctx) {
|
|
|
99
121
|
scratchpadDir: folded.scratchpadDir,
|
|
100
122
|
hostSemanticsLane: folded.hostSemanticsLane,
|
|
101
123
|
});
|
|
102
|
-
|
|
124
|
+
const stamped = stampHandsLane(final, gated.hands);
|
|
125
|
+
return stamped;
|
|
103
126
|
};
|
|
104
127
|
const gateScenarioAndAppend = async (body, auth, opts) => {
|
|
105
128
|
const requested = gateScenarioRequest(await principalCaps?.scenarioRuling(auth?.principal), body.scenario, config.defaultScenario, Object.keys(scenarios), logger);
|
|
@@ -196,7 +219,7 @@ export function createResolveSpec(ctx) {
|
|
|
196
219
|
logger,
|
|
197
220
|
sessionId: auth?.sessionId ?? "",
|
|
198
221
|
cwd: (auth?.sessionId ? perSessionCwd.get(auth.sessionId) : undefined) ?? process.cwd(),
|
|
199
|
-
|
|
222
|
+
permissionMode: effMode ?? ENGINE_ABSENT_PERMISSION_MODE,
|
|
200
223
|
...(parsedSettings.settings?.shellEnv ? { shellEnv: parsedSettings.settings.shellEnv } : {}),
|
|
201
224
|
hookLlm,
|
|
202
225
|
hookAgent,
|
|
@@ -323,17 +346,7 @@ export function createResolveSpec(ctx) {
|
|
|
323
346
|
additionalDirectories,
|
|
324
347
|
additionalReadDirectories,
|
|
325
348
|
enablePlanMode: config.planModeEnabled ? true : undefined,
|
|
326
|
-
...(effMode ? {
|
|
327
|
-
...((f) => (f !== undefined ? { writeFace: f } : {}))(effMode !== undefined ? writeFaceForMode(effMode) : undefined),
|
|
328
|
-
...((f) => (f !== undefined ? { autoModeRequested: f } : {}))(effMode !== undefined ? autoModeRequestedForMode(effMode) : undefined),
|
|
329
|
-
...(() => {
|
|
330
|
-
if (body.approverPosture === undefined)
|
|
331
|
-
return {};
|
|
332
|
-
if (taskApproverPostureHonored(config))
|
|
333
|
-
return { approverPosture: body.approverPosture };
|
|
334
|
-
logger.warn("task_approver_posture_ignored", { honored: false, sessionId: auth?.sessionId ?? null });
|
|
335
|
-
return {};
|
|
336
|
-
})(),
|
|
349
|
+
...(effMode !== undefined ? { permissionMode: effMode } : {}),
|
|
337
350
|
selfOrchestration: selfOrchestrationFromBody({ selfOrchestration: body.selfOrchestration === true || parsedSettings.settings?.ultracode === true }, config, Boolean(centerRuntimeCapsResolver)),
|
|
338
351
|
forwardSubagentEvents: body.forwardSubagentEvents === true ? true : undefined,
|
|
339
352
|
retainSubagentSessions: normalizeRetainSubagentSessions(body.retainSubagentSessions),
|
|
@@ -657,6 +670,16 @@ export function createResolveSpec(ctx) {
|
|
|
657
670
|
}
|
|
658
671
|
return governed;
|
|
659
672
|
};
|
|
660
|
-
|
|
673
|
+
const resumeRunnerSeats = () => ({
|
|
674
|
+
...buildDeploymentPostureSeats(config),
|
|
675
|
+
...(memoryEngine !== undefined ? { memoryEngineDir: memoryEngine.root } : {}),
|
|
676
|
+
});
|
|
677
|
+
const resolveSpecForLeg = async (body, req, auth, opts) => {
|
|
678
|
+
const spec = await resolveSpec(body, req, auth, opts);
|
|
679
|
+
if (opts?.unattendedLeg !== true)
|
|
680
|
+
return spec;
|
|
681
|
+
return withUnattendedLeg(spec, createUnattendedLeg(unattendedPermissionMode(config), resumeRunnerSeats()));
|
|
682
|
+
};
|
|
683
|
+
return resolveSpecForLeg;
|
|
661
684
|
}
|
|
662
685
|
//# sourceMappingURL=resolve-spec.js.map
|
|
@@ -55,10 +55,11 @@ import type { MailboxRecipientLifecycle } from "../plugins/mailbox-recipient-lif
|
|
|
55
55
|
export type RunnerDepsOnAsk = (req: Parameters<ToolApprovalCoordinator["ask"]>[0], signal?: AbortSignal) => Promise<AskOutcome>;
|
|
56
56
|
export declare function createRunnerDepsOnAsk(toolApproval: ToolApprovalCoordinator | undefined): RunnerDepsOnAsk | undefined;
|
|
57
57
|
/** [ref] 件⑤:core `onError(phase:"config")` 的 `classification` 已知词表。⚠️ core d.ts(`RunnerDeps.onError` 注)只登记了
|
|
58
|
-
* prompt-cache 相的五词,config 相的词**只在 dist js 出现**(7.
|
|
59
|
-
* `interaction-posture-refused`(prepare-config-doors)/ `memory-tools-not-mounted` / `
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* prompt-cache 相的五词,config 相的词**只在 dist js 出现**(7.35.0 亲扫 dist 下全部 js 的 `phase: "config"` 发射点:四词——
|
|
59
|
+
* `interaction-posture-refused`(prepare-config-doors)/ `memory-tools-not-mounted` / `shared-memory-not-mounted`
|
|
60
|
+
* (prepare-defer-classify / prepare-project-context)/ `sandbox-admission-unavailable`(prepare-policy-chain));
|
|
61
|
+
* S-877:第五词 `shell-gate-off` 随 core 7.34.0 的 off 车道一起退役(引擎侧零发射点),同批删 —— 它唯一的本仓消费者
|
|
62
|
+
* (「本 session 显式 bypass ⇒ 降级 info」那条回查腿与 `boot/session-shell-gate-registry.ts` 登记簿)一并删干净。所以这是「按实现亲读」的开集快照,不是 core 类型闭集——词表外的值原样进日志并标
|
|
62
63
|
* `classificationKnown:false`(指标标签折 `unknown`),不吞不编;与安装包的锁步由 test/boot-runner-deps-shared-base.test.ts
|
|
63
64
|
* 的 dist 扫描格钉住(core 加词/收进 d.ts 那天先红)。 */
|
|
64
65
|
export declare const CONFIG_ADVISORY_CLASSIFICATIONS: ReadonlySet<string>;
|
|
@@ -206,10 +207,6 @@ export interface RunnerDepsCtx {
|
|
|
206
207
|
* 来源=configCenter.takeMcpRevocations()(取走即声明接线,restart 豁免与承接绑同一动作)。
|
|
207
208
|
* 缺席=undefined=pre-338 语义(纯 env 部署无中心撤销面)。 */
|
|
208
209
|
mcpRevocations: RunnerDeps["mcpRevocations"];
|
|
209
|
-
/** [ref] 件⑤([ref] server ③):per-session「显式 bypassPermissions」登记簿的读腿 —— `onError(phase:"config",
|
|
210
|
-
* classification:"shell-gate-off")` 在本 session 显式声明 bypass 时降级 info(正常态不打 warn)。缺席(桩 /
|
|
211
|
-
* run-local)= 照 warn(退化方向=多一条告警)。 */
|
|
212
|
-
sessionShellGateExplicitlyOff?: ((sessionId: string) => boolean) | undefined;
|
|
213
210
|
/**
|
|
214
211
|
* 交接件⑤ —— commit 尾注的署名座(`RunnerDeps.hands.commitCoAuthor`)。
|
|
215
212
|
*
|
package/dist/boot/runner-deps.js
CHANGED
|
@@ -18,6 +18,7 @@ import { buildCrossSessionInboundLayers, crossSessionDialogExpiryOf } from "../c
|
|
|
18
18
|
import { createPeerDirectory } from "../peer-directory.js";
|
|
19
19
|
import { targetOutsideStoreInIncident } from "../memory-store-refusal.js";
|
|
20
20
|
import { coreFileHistoryCaptureSeat } from "../file-history-capture.js";
|
|
21
|
+
import { rewindFailureCode } from "../file-history-disclosure.js";
|
|
21
22
|
export function createRunnerDepsOnAsk(toolApproval) {
|
|
22
23
|
if (!toolApproval)
|
|
23
24
|
return undefined;
|
|
@@ -28,7 +29,6 @@ export const CONFIG_ADVISORY_CLASSIFICATIONS = new Set([
|
|
|
28
29
|
"memory-tools-not-mounted",
|
|
29
30
|
"sandbox-admission-unavailable",
|
|
30
31
|
"shared-memory-not-mounted",
|
|
31
|
-
"shell-gate-off",
|
|
32
32
|
]);
|
|
33
33
|
export const PROMPT_CACHE_BREAK_CAUSE_LEVEL = {
|
|
34
34
|
"model-switch": "error",
|
|
@@ -105,7 +105,7 @@ export function createSharedRunnerDeps(ctx) {
|
|
|
105
105
|
return shared;
|
|
106
106
|
}
|
|
107
107
|
export function createRunnerDeps(ctx) {
|
|
108
|
-
const { config, logger, metrics, localRoot, outcomeSink, elicitation, question, toolApproval, sessionStore, memoryEngine, sessionCaptureRecords, memorySyncRunner, runtimeCapsResolver, fileHistoryStore, permissionRuleStore, fleetBus, workflowRunStore, workflowJournalStore, workflowAgentRegistry, workflowNotifyGate, workflowCompletionInbox, deliverWorkflowCompletion, getRunStore,
|
|
108
|
+
const { config, logger, metrics, localRoot, outcomeSink, elicitation, question, toolApproval, sessionStore, memoryEngine, sessionCaptureRecords, memorySyncRunner, runtimeCapsResolver, fileHistoryStore, permissionRuleStore, fleetBus, workflowRunStore, workflowJournalStore, workflowAgentRegistry, workflowNotifyGate, workflowCompletionInbox, deliverWorkflowCompletion, getRunStore, } = ctx;
|
|
109
109
|
const peerSessionLister = sessionStore.listSessions?.bind(sessionStore);
|
|
110
110
|
const memoryEngineIncident = createMemoryEngineIncidentSink({ logger, metrics });
|
|
111
111
|
const sharedRunnerDeps = createSharedRunnerDeps(ctx);
|
|
@@ -235,7 +235,7 @@ export function createRunnerDeps(ctx) {
|
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
if (ctx.phase === "rewind") {
|
|
238
|
-
const code =
|
|
238
|
+
const code = rewindFailureCode(err);
|
|
239
239
|
logger.warn("rewind_snapshot_failed", { sessionId: ctx.sessionId, code, info: String(err) });
|
|
240
240
|
metrics.inc("rewind_snapshot_failed_total", { code });
|
|
241
241
|
return;
|
|
@@ -278,22 +278,17 @@ export function createRunnerDeps(ctx) {
|
|
|
278
278
|
const code = typeof err?.code === "string" ? err.code : undefined;
|
|
279
279
|
const classification = ctx.classification;
|
|
280
280
|
const classificationKnown = classification === undefined ? undefined : CONFIG_ADVISORY_CLASSIFICATIONS.has(classification);
|
|
281
|
-
const expectedShellGateOff = classification === "shell-gate-off" && sessionShellGateExplicitlyOff?.(ctx.sessionId) === true;
|
|
282
281
|
const fields = {
|
|
283
282
|
sessionId: ctx.sessionId,
|
|
284
283
|
...(code !== undefined ? { code } : {}),
|
|
285
284
|
...(classification !== undefined ? { classification, classificationKnown } : {}),
|
|
286
|
-
...(expectedShellGateOff ? { expected: "bypassPermissions declared by the caller for this session — shell gate off is the requested posture, not a misconfiguration" } : {}),
|
|
287
285
|
info: String(err),
|
|
288
286
|
};
|
|
289
|
-
|
|
290
|
-
logger.info("runner_config_advisory", fields);
|
|
291
|
-
else
|
|
292
|
-
logger.warn("runner_config_advisory", fields);
|
|
287
|
+
logger.warn("runner_config_advisory", fields);
|
|
293
288
|
metrics.inc("runner_config_advisory_total", {
|
|
294
289
|
...(code !== undefined ? { code } : {}),
|
|
295
290
|
...(classification !== undefined ? { classification: classificationKnown ? classification : "unknown" } : {}),
|
|
296
|
-
level:
|
|
291
|
+
level: "warn",
|
|
297
292
|
});
|
|
298
293
|
return;
|
|
299
294
|
}
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
* key plane —— core 的 `WebFetchSummarizerOptions` 至今只有 `maxContentChars`,那一面没有座位可换
|
|
31
31
|
* (亲验 core 5.46.0 `dist/tools/web.d.ts`)。
|
|
32
32
|
*
|
|
33
|
-
* 🔴 **poison(
|
|
34
|
-
* `
|
|
33
|
+
* 🔴 **poison(声明的钥匙拿不到)上抛,绝不静默回落网关 key** —— `resolveModelApiKey` 抛
|
|
34
|
+
* `ModelKeyPoisonedError` 是「这个模型配了自己的钥匙(托管密钥解不开 / S-896 起 `apiKeyEnv` 变量缺席)却拿不到」的响亮态;吞成 undefined 等于用共享
|
|
35
35
|
* 网关账号去打这只模型的上游,正是毒丸机制存在的理由(CLAUDE.md [ref] 安全轴 fail-closed)。换装后
|
|
36
36
|
* 这条语义由 core 承载得更彻底:座位抛 ⇒ `runSideQuery` 的 `await` 直接上抛,brain 一个字节都没发。
|
|
37
37
|
*
|
|
@@ -19,7 +19,7 @@ export declare function runStage03(ctx: Awaited<ReturnType<typeof runStage02>>):
|
|
|
19
19
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
20
20
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
21
21
|
sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
|
|
22
|
-
|
|
22
|
+
storePosture: import("../store-posture.js").StorePosture;
|
|
23
23
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
24
24
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
25
25
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
@@ -2,10 +2,10 @@ import { uuidv7 } from "@sema-agent/core";
|
|
|
2
2
|
import { openStores } from "./stores.js";
|
|
3
3
|
export async function runStage03(ctx) {
|
|
4
4
|
const { config, localRoot, logger, metrics } = ctx;
|
|
5
|
-
const { backend,
|
|
5
|
+
const { backend, storePosture, memoryEngine, memorySyncCursors, rosterStore, backgroundAgentStore, taskAttachmentStore, mailboxStore, mailboxRecipientLifecycle, memoryExportBackend, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane, sqlEngineFacts, } = await openStores({ config, logger, metrics, localRoot });
|
|
6
6
|
const instanceId = uuidv7();
|
|
7
7
|
const sessionCaptureRecords = backend?.sessionCaptureRecords();
|
|
8
8
|
const sessionCaptureRecordStore = sessionCaptureRecords?.();
|
|
9
|
-
return { ...ctx, backend, backgroundAgentStore, breakerState, instanceId, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memoryExportBackend, memoryPosture, memorySyncCursors, memorySyncRunner, rosterStore, sessionCaptureRecordStore, sessionCaptureRecords, sessionStore, sqlEngineFacts,
|
|
9
|
+
return { ...ctx, backend, backgroundAgentStore, breakerState, instanceId, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memoryExportBackend, memoryPosture, memorySyncCursors, memorySyncRunner, rosterStore, sessionCaptureRecordStore, sessionCaptureRecords, sessionStore, sqlEngineFacts, storePosture, taskAttachmentStore, taskListLane, usageWindowStore };
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=stage-03-store-backend.js.map
|
|
@@ -60,7 +60,7 @@ export declare function runStage04(ctx: Awaited<ReturnType<typeof runStage03>>):
|
|
|
60
60
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
61
61
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
62
62
|
sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
|
|
63
|
-
|
|
63
|
+
storePosture: import("../store-posture.js").StorePosture;
|
|
64
64
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
65
65
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
66
66
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
@@ -13,6 +13,7 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
|
|
|
13
13
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
14
14
|
sessionIncarnationOf: (sid: string) => string | undefined;
|
|
15
15
|
setSessionCwd: (sid: string, cwd: string) => void;
|
|
16
|
+
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
16
17
|
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
17
18
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
18
19
|
brain: import("@sema-agent/core").Brain;
|
|
@@ -75,7 +76,7 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
|
|
|
75
76
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
76
77
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
77
78
|
sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
|
|
78
|
-
|
|
79
|
+
storePosture: import("../store-posture.js").StorePosture;
|
|
79
80
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
80
81
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
81
82
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
@@ -5,7 +5,7 @@ import { createExecutionEnv } from "./execution-env.js";
|
|
|
5
5
|
export function runStage05(ctx) {
|
|
6
6
|
const { backend, config, instanceId, logger, metrics, taskAttachmentStore } = ctx;
|
|
7
7
|
const deviceLane = config.remoteExec?.provider === "device" ? createDeviceLane({ config, logger, metrics, backend, replicaId: instanceId }) : undefined;
|
|
8
|
-
const { perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, dropSessionScoped, noteSessionIncarnation, sessionIncarnationOf, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}) });
|
|
8
|
+
const { perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv, fenceSessionOwner, dropSessionScoped, noteSessionIncarnation, sessionIncarnationOf, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}) });
|
|
9
9
|
assertDeviceLaneWired(config.remoteExec?.provider === "device", deviceLane, executionEnvFactory !== undefined);
|
|
10
10
|
const toolTracer = config.toolTrace ? createToolTracer(logger) : undefined;
|
|
11
11
|
if (toolTracer)
|
|
@@ -14,6 +14,6 @@ export function runStage05(ctx) {
|
|
|
14
14
|
...(toolTracer ? composeHooks(createPermissionDeniedMeter(metrics), toolTracer) : createPermissionDeniedMeter(metrics)),
|
|
15
15
|
...(config.hooksTimeoutMs !== undefined ? { timeoutMs: config.hooksTimeoutMs } : {}),
|
|
16
16
|
};
|
|
17
|
-
return { ...ctx, deploymentHooks, deviceLane, dropSessionScoped, executionEnvFactory, fenceSessionOwner, lspManager, noteSessionIncarnation, perSessionCwd, perTaskImage, sendUserFileTaskEnvs, sessionEnvSelection, sessionIncarnationOf, setSessionCwd, setSessionShellEnv, worktreeReap };
|
|
17
|
+
return { ...ctx, deploymentHooks, deviceLane, dropSessionScoped, executionEnvFactory, fenceSessionOwner, lspManager, noteSessionIncarnation, perSessionCwd, perTaskImage, sendUserFileTaskEnvs, sessionEnvSelection, sessionIncarnationOf, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, worktreeReap };
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=stage-05-execution-env.js.map
|
|
@@ -11,6 +11,7 @@ import { ForkRoutingSessionStore } from "../plugins/fork-routing-session-store.j
|
|
|
11
11
|
import type { runStage05 } from "./stage-05-execution-env.js";
|
|
12
12
|
export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>): {
|
|
13
13
|
approvalAskAudit: import("../approval-ask-audit-store.js").FileApprovalAskAuditStore | undefined;
|
|
14
|
+
approvalExemptionStore: import("../plugins/approval-exemption-store.js").ApprovalExemptionStore | undefined;
|
|
14
15
|
centerRuntimeCapsResolver: ((principal: string | undefined) => Promise<import("@sema-agent/core").RuntimeCaps | undefined>) | undefined;
|
|
15
16
|
checkpointStore: import("../plugins/store-backend.js").CheckpointStoreFull | undefined;
|
|
16
17
|
durableEnabled: boolean;
|
|
@@ -37,7 +38,6 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
37
38
|
sendFileLedger: import("../plugins/send-file-ledger.js").SendFileLedger | undefined;
|
|
38
39
|
sendUserFileEmitter: import("../capabilities/send-user-file-tool.js").SendUserFileEmitter | undefined;
|
|
39
40
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
40
|
-
sessionShellGateRegistry: import("./session-shell-gate-registry.js").SessionShellGateRegistry;
|
|
41
41
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
42
42
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
43
43
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
@@ -73,6 +73,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
73
73
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
74
74
|
sessionIncarnationOf: (sid: string) => string | undefined;
|
|
75
75
|
setSessionCwd: (sid: string, cwd: string) => void;
|
|
76
|
+
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
76
77
|
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
77
78
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
78
79
|
brain: import("@sema-agent/core").Brain;
|
|
@@ -135,7 +136,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
135
136
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
136
137
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
137
138
|
sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
|
|
138
|
-
|
|
139
|
+
storePosture: import("../store-posture.js").StorePosture;
|
|
139
140
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
140
141
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
141
142
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
@@ -14,7 +14,6 @@ import { createPerModelAuthSeat } from "./side-query-lane.js";
|
|
|
14
14
|
import { createWorkflowOrchestration } from "./workflow-orchestration.js";
|
|
15
15
|
import { createLiveCoordinators } from "./coordinators.js";
|
|
16
16
|
import { createRuntimeCaps } from "./runtime-caps.js";
|
|
17
|
-
import { createSessionShellGateRegistry } from "./session-shell-gate-registry.js";
|
|
18
17
|
import { createRunnerDeps, createSharedRunnerDeps } from "./runner-deps.js";
|
|
19
18
|
import { createOrgMemoryAdmissionWiring } from "./org-memory.js";
|
|
20
19
|
import { createGovernanceSeams } from "./governance-seams.js";
|
|
@@ -23,7 +22,7 @@ import { parkedAskRedeem, runStore } from "./late-binds.js";
|
|
|
23
22
|
export function runStage06(ctx) {
|
|
24
23
|
const { backend, backgroundAgentStore, brain, sessionIncarnationOf, config, configCenter, consolidationValve, deploymentHooks, executionEnvFactory, fileHistoryStore, localRoot, logger, lspManager, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memorySyncRunner, metrics, perSessionCwd, permissionRuleProvider, pricing, rosterStore, ruleConsent, sendUserFileTaskEnvs, sessionCaptureRecordStore, sessionCaptureRecords, sessionPolicyStore, sessionStore, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore } = ctx;
|
|
25
24
|
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
|
|
26
|
-
const { elicitation, question, toolApproval, durableEnabled, streamApprovalGate, approvalAskAudit, sendUserFileEmitter, sendFileLedger, sendUserFileToolSpec } = createLiveCoordinators({
|
|
25
|
+
const { elicitation, question, toolApproval, durableEnabled, streamApprovalGate, approvalAskAudit, approvalExemptionStore, sendUserFileEmitter, sendFileLedger, sendUserFileToolSpec } = createLiveCoordinators({
|
|
27
26
|
config, logger, backend, sendUserFileTaskEnvs, ruleConsent,
|
|
28
27
|
getParkedRedeem: () => parkedAskRedeem,
|
|
29
28
|
ruleScopeRootFor: (sessionId) => cardRuleScopeRoot(sessionId !== undefined ? perSessionCwd.get(sessionId) : undefined, config),
|
|
@@ -104,12 +103,10 @@ export function runStage06(ctx) {
|
|
|
104
103
|
});
|
|
105
104
|
const mcpRevocations = configCenter.takeMcpRevocations();
|
|
106
105
|
const workflowModelAllowlistSnapshot = workflowModelAllowlistFor(config) ?? [];
|
|
107
|
-
const sessionShellGateRegistry = createSessionShellGateRegistry();
|
|
108
106
|
const runnerDeps = createRunnerDeps({
|
|
109
107
|
consolidationSeat,
|
|
110
108
|
hands: commitHands,
|
|
111
109
|
mcpRevocations,
|
|
112
|
-
sessionShellGateExplicitlyOff: sessionShellGateRegistry.explicitlyOff,
|
|
113
110
|
sessionIncarnationOf,
|
|
114
111
|
config, logger, metrics, localRoot, promptSource: configCenter.promptSource, rosterStore, backgroundAgentStore, mailboxStore, mailboxRecipientLifecycle, usageWindowStore, brain,
|
|
115
112
|
pricing, tracer, outcomeSink, elicitation, question, toolApproval, sessionStore, memoryEngine,
|
|
@@ -205,6 +202,6 @@ export function runStage06(ctx) {
|
|
|
205
202
|
};
|
|
206
203
|
const subRunner = new Runner(subRunnerDeps);
|
|
207
204
|
const handslessSubRunner = new Runner(withoutExecutionEnv(subRunnerDeps));
|
|
208
|
-
return { ...ctx, approvalAskAudit, centerRuntimeCapsResolver, checkpointStore, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, handslessSubRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekResolver, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec,
|
|
205
|
+
return { ...ctx, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, handslessSubRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekResolver, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subRunnerSessions, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable };
|
|
209
206
|
}
|
|
210
207
|
//# sourceMappingURL=stage-06-runners.js.map
|
|
@@ -51,7 +51,6 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
51
51
|
sendFileLedger: import("../plugins/send-file-ledger.js").SendFileLedger | undefined;
|
|
52
52
|
sendUserFileEmitter: import("../capabilities/send-user-file-tool.js").SendUserFileEmitter | undefined;
|
|
53
53
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
54
|
-
sessionShellGateRegistry: import("./session-shell-gate-registry.js").SessionShellGateRegistry;
|
|
55
54
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
56
55
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
57
56
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
@@ -87,6 +86,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
87
86
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
88
87
|
sessionIncarnationOf: (sid: string) => string | undefined;
|
|
89
88
|
setSessionCwd: (sid: string, cwd: string) => void;
|
|
89
|
+
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
90
90
|
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
91
91
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
92
92
|
brain: import("@sema-agent/core").Brain;
|
|
@@ -149,7 +149,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
149
149
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
150
150
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
151
151
|
sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
|
|
152
|
-
|
|
152
|
+
storePosture: import("../store-posture.js").StorePosture;
|
|
153
153
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
154
154
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
155
155
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
@@ -23,12 +23,11 @@ import { createRunnerDepsOnAsk } from "./runner-deps.js";
|
|
|
23
23
|
import { bindRateLimiter, bindRunStore } from "./late-binds.js";
|
|
24
24
|
import { buildDisplaySafeUrl } from "../trace/redact.js";
|
|
25
25
|
export async function runStage07(ctx) {
|
|
26
|
-
const { backend, backgroundAgentStore, brain, checkpointStore, config, configCenter, counterDegradeHook, durableEnabled, handslessSubRunner, localRoot, logger, memoryEngine, metrics, question, runner, runnerDeps, sendUserFileToolSpec, sessionEnvSelection, sessionStore, subRunner, subRunnerSessions, taskListLane, toolApproval } = ctx;
|
|
26
|
+
const { approvalExemptionStore, backend, backgroundAgentStore, brain, checkpointStore, config, configCenter, counterDegradeHook, durableEnabled, handslessSubRunner, localRoot, logger, memoryEngine, metrics, question, runner, runnerDeps, sendUserFileToolSpec, sessionEnvSelection, sessionStore, subRunner, subRunnerSessions, taskListLane, toolApproval } = ctx;
|
|
27
27
|
const authorize = createAuthorizer(config, sessionStore);
|
|
28
28
|
const runStore = backend ? backend.run() : undefined;
|
|
29
29
|
bindRunStore(runStore);
|
|
30
30
|
const resumeAnchorStore = backend ? backend.resumeAnchor() : undefined;
|
|
31
|
-
const approvalExemptionStore = backend ? backend.approvalExemption() : undefined;
|
|
32
31
|
const approvalNonceStore = backend ? backend.approvalNonce() : undefined;
|
|
33
32
|
const taskTimeoutSec = Math.floor(parseNumOrFailNonNegative("TASK_TIMEOUT_SEC", process.env.TASK_TIMEOUT_SEC || "0"));
|
|
34
33
|
const capEnv = (name) => {
|
|
@@ -64,7 +64,6 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
64
64
|
sendFileLedger: import("../plugins/send-file-ledger.js").SendFileLedger | undefined;
|
|
65
65
|
sendUserFileEmitter: import("../capabilities/send-user-file-tool.js").SendUserFileEmitter | undefined;
|
|
66
66
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
67
|
-
sessionShellGateRegistry: import("./session-shell-gate-registry.js").SessionShellGateRegistry;
|
|
68
67
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
69
68
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
70
69
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
@@ -100,6 +99,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
100
99
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
101
100
|
sessionIncarnationOf: (sid: string) => string | undefined;
|
|
102
101
|
setSessionCwd: (sid: string, cwd: string) => void;
|
|
102
|
+
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
103
103
|
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
104
104
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
105
105
|
brain: import("@sema-agent/core").Brain;
|
|
@@ -162,7 +162,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
162
162
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
163
163
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
164
164
|
sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
|
|
165
|
-
|
|
165
|
+
storePosture: import("../store-posture.js").StorePosture;
|
|
166
166
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
167
167
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
168
168
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
@@ -100,7 +100,6 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
100
100
|
sendFileLedger: import("../plugins/send-file-ledger.js").SendFileLedger | undefined;
|
|
101
101
|
sendUserFileEmitter: import("../capabilities/send-user-file-tool.js").SendUserFileEmitter | undefined;
|
|
102
102
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
103
|
-
sessionShellGateRegistry: import("./session-shell-gate-registry.js").SessionShellGateRegistry;
|
|
104
103
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
105
104
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
106
105
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
@@ -136,6 +135,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
136
135
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
137
136
|
sessionIncarnationOf: (sid: string) => string | undefined;
|
|
138
137
|
setSessionCwd: (sid: string, cwd: string) => void;
|
|
138
|
+
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
139
139
|
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
140
140
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
141
141
|
brain: import("@sema-agent/core").Brain;
|
|
@@ -198,7 +198,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
198
198
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
199
199
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
200
200
|
sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
|
|
201
|
-
|
|
201
|
+
storePosture: import("../store-posture.js").StorePosture;
|
|
202
202
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
203
203
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
204
204
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describeStaticWiring } from "@sema-agent/core";
|
|
2
2
|
import { encodeCheckpointScope } from "../security.js";
|
|
3
|
-
import { createRegistryJwtVerifier } from "../auth-bridge.js";
|
|
3
|
+
import { authBridgeIssuerOf, createRegistryJwtVerifier } 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";
|
|
@@ -17,7 +17,7 @@ export function runStage09(ctx) {
|
|
|
17
17
|
});
|
|
18
18
|
const leaderEndpoint = createLeaderFace({ config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, governanceSeams, backend, tracer, usageWindowStore, promptSource: configCenter.promptSource, onError: runnerDeps.onError });
|
|
19
19
|
const drainState = { draining: false };
|
|
20
|
-
const authBridgeIssuer = config
|
|
20
|
+
const authBridgeIssuer = authBridgeIssuerOf(config)?.issuer;
|
|
21
21
|
const registryJwtVerifier = authBridgeIssuer
|
|
22
22
|
? createRegistryJwtVerifier({
|
|
23
23
|
issuer: authBridgeIssuer,
|
|
@@ -100,7 +100,6 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
100
100
|
sendFileLedger: import("../plugins/send-file-ledger.js").SendFileLedger | undefined;
|
|
101
101
|
sendUserFileEmitter: import("../capabilities/send-user-file-tool.js").SendUserFileEmitter | undefined;
|
|
102
102
|
sendUserFileToolSpec: import("@sema-agent/core").ToolSpec<import("@sema-agent/core").TSchema> | undefined;
|
|
103
|
-
sessionShellGateRegistry: import("./session-shell-gate-registry.js").SessionShellGateRegistry;
|
|
104
103
|
sessionTitler: import("../session-titler.js").SessionTitler | undefined;
|
|
105
104
|
sharedMemoryStore: import("../plugins/shared-memory-store-sql.js").SqlSharedMemoryStore | undefined;
|
|
106
105
|
sqlWorkflowRunStore: import("@sema-agent/core").WorkflowRunStore | undefined;
|
|
@@ -136,6 +135,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
136
135
|
sessionEnvSelection: import("../capabilities/select-environment-tool.js").SessionEnvironmentSelection;
|
|
137
136
|
sessionIncarnationOf: (sid: string) => string | undefined;
|
|
138
137
|
setSessionCwd: (sid: string, cwd: string) => void;
|
|
138
|
+
setSessionInheritEnv: (sid: string, policy: import("../request-value-closure.js").TaskInheritEnv | undefined) => void;
|
|
139
139
|
setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
|
|
140
140
|
worktreeReap: (() => Promise<void>) | undefined;
|
|
141
141
|
brain: import("@sema-agent/core").Brain;
|
|
@@ -198,7 +198,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
|
|
|
198
198
|
sessionCaptureRecords: import("../plugins/store-backend.js").SessionCaptureRecordSource | undefined;
|
|
199
199
|
sessionStore: import("@sema-agent/core").SessionStore;
|
|
200
200
|
sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
|
|
201
|
-
|
|
201
|
+
storePosture: import("../store-posture.js").StorePosture;
|
|
202
202
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
203
203
|
taskListLane: import("./task-list-lane.js").TaskListLane;
|
|
204
204
|
usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
|