@sema-agent/server 7.85.0 → 7.86.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/USAGE.md +18 -0
- package/dist/approval-hmac.d.ts +28 -1
- package/dist/approval-hmac.js +2 -1
- package/dist/capabilities/execution-lane.d.ts +22 -0
- package/dist/capabilities/execution-lane.js +8 -0
- package/dist/capabilities/memory-notice.d.ts +4 -1
- package/dist/config-catalog.js +2 -1
- package/dist/execution-lane-caps.d.ts +13 -0
- package/dist/execution-lane-caps.js +1 -0
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/http/resume-legs.d.ts +2 -1
- package/dist/http/resume-legs.js +21 -6
- package/dist/http/route-ctx.d.ts +51 -17
- package/dist/http/route-ctx.js +0 -3
- package/dist/http/routes/approvals-assistant.d.ts +11 -0
- package/dist/http/routes/approvals-assistant.js +61 -16
- package/dist/http/routes/capabilities.js +2 -0
- package/dist/http/routes/images.js +38 -8
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +2 -2
- package/dist/http/routes/memory-policy.js +3 -6
- package/dist/http/routes/notify-wake.js +11 -3
- package/dist/http/routes/run-memory-capture.js +3 -5
- package/dist/http/routes/runs.js +19 -21
- package/dist/http/routes/sessions.js +10 -2
- package/dist/http/routes/shared-memory.js +5 -1
- package/dist/memory-scope.d.ts +16 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +8 -2
- package/dist/plugins/store-contracts.d.ts +23 -0
- package/dist/plugins/store-contracts.js +3 -0
- package/dist/principal-jwt.d.ts +15 -7
- package/dist/principal-jwt.js +1 -1
- package/dist/task-settings.d.ts +35 -0
- package/dist/task-settings.js +7 -0
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ import { projectMemoryEngineCapability } from "../../memory-posture.js";
|
|
|
13
13
|
import { projectWriteProtectionCapability } from "../../write-protection.js";
|
|
14
14
|
import { projectSqlEngineCapability } from "../../sql-engine-posture.js";
|
|
15
15
|
import { projectWebSearchCapability } from "../../plugins/web-search.js";
|
|
16
|
+
import { projectExecutionLaneCapability } from "../../capabilities/execution-lane.js";
|
|
16
17
|
import { workflowModelAllowlistFor, selfOrchestrationDenial } from "../../task-workflow.js";
|
|
17
18
|
import { centerEntitlementSourceWired } from "../../runtime-caps-resolver.js";
|
|
18
19
|
import { judgeAutoModeArming } from "../../auto-mode-face.js";
|
|
@@ -126,6 +127,7 @@ export async function handleCapabilities(req, res, match, ctx) {
|
|
|
126
127
|
interactiveTools: true,
|
|
127
128
|
projectContext: cwdHonored(deps.config),
|
|
128
129
|
callerCwd: cwdHonored(deps.config) || deviceCwdHonored(deps.config),
|
|
130
|
+
executionLane: projectExecutionLaneCapability(deps.config),
|
|
129
131
|
mcpInjection: mcpInjectionHonored(deps.config),
|
|
130
132
|
a2a: true,
|
|
131
133
|
a2aInjection: a2aInjectionHonored(deps.config),
|
|
@@ -41,7 +41,7 @@ const RUNNER_ERROR_CODES = new Set(["band-conflict", "duplicate", "disk", "timeo
|
|
|
41
41
|
const SANDBOX_BASE_PROFILE = "sandbox-base";
|
|
42
42
|
export async function handleImages(req, res, match, ctx) {
|
|
43
43
|
const { deps } = ctx;
|
|
44
|
-
const { readJson } = ctx.helpers;
|
|
44
|
+
const { readJson, safeDecode } = ctx.helpers;
|
|
45
45
|
const { source } = ctx.req;
|
|
46
46
|
const { bakeSubmitLimiter } = ctx.local.images;
|
|
47
47
|
if (deps.imageBakes && isBakeRouteId(match.decl.id)) {
|
|
@@ -128,7 +128,11 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
128
128
|
sendError(res, 403, "auth.operator_only", "operator only");
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
|
-
const bakeId =
|
|
131
|
+
const bakeId = safeDecode(match.params.bakeId);
|
|
132
|
+
if (bakeId === null) {
|
|
133
|
+
sendError(res, 400, "request.path_malformed", "malformed id (invalid percent-encoding)");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
132
136
|
const bake = await bakes.getBake(bakeId);
|
|
133
137
|
if (!bake) {
|
|
134
138
|
sendError(res, 404, "not_found.bake", "bake not found");
|
|
@@ -142,7 +146,11 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
142
146
|
sendError(res, 403, "auth.operator_only", "operator only");
|
|
143
147
|
return;
|
|
144
148
|
}
|
|
145
|
-
const bakeId =
|
|
149
|
+
const bakeId = safeDecode(match.params.bakeId);
|
|
150
|
+
if (bakeId === null) {
|
|
151
|
+
sendError(res, 400, "request.path_malformed", "malformed id (invalid percent-encoding)");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
146
154
|
const bake = await bakes.getBake(bakeId);
|
|
147
155
|
if (!bake) {
|
|
148
156
|
sendError(res, 404, "not_found.bake", "bake not found");
|
|
@@ -178,7 +186,11 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
178
186
|
sendError(res, 403, "auth.bake_runner_only", "bake-runner only");
|
|
179
187
|
return;
|
|
180
188
|
}
|
|
181
|
-
const bakeId =
|
|
189
|
+
const bakeId = safeDecode(match.params.bakeId);
|
|
190
|
+
if (bakeId === null) {
|
|
191
|
+
sendError(res, 400, "request.path_malformed", "malformed id (invalid percent-encoding)");
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
182
194
|
const body = (await readJson(req));
|
|
183
195
|
const runnerId = typeof body.runnerId === "string" && body.runnerId.length > 0 ? body.runnerId : (principal ?? source ?? cfg.runnerPrincipal);
|
|
184
196
|
const claimed = await bakes.claimBake(bakeId, runnerId, cfg.leaseMs);
|
|
@@ -194,7 +206,11 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
194
206
|
sendError(res, 403, "auth.bake_runner_only", "bake-runner only");
|
|
195
207
|
return;
|
|
196
208
|
}
|
|
197
|
-
const bakeId =
|
|
209
|
+
const bakeId = safeDecode(match.params.bakeId);
|
|
210
|
+
if (bakeId === null) {
|
|
211
|
+
sendError(res, 400, "request.path_malformed", "malformed id (invalid percent-encoding)");
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
198
214
|
const bake = await bakes.getBake(bakeId);
|
|
199
215
|
if (!bake) {
|
|
200
216
|
sendError(res, 404, "not_found.bake", "bake not found");
|
|
@@ -238,7 +254,11 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
238
254
|
sendError(res, 403, "auth.operator_only", "operator only");
|
|
239
255
|
return;
|
|
240
256
|
}
|
|
241
|
-
const bakeId =
|
|
257
|
+
const bakeId = safeDecode(match.params.bakeId);
|
|
258
|
+
if (bakeId === null) {
|
|
259
|
+
sendError(res, 400, "request.path_malformed", "malformed id (invalid percent-encoding)");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
242
262
|
const bake = await bakes.getBake(bakeId);
|
|
243
263
|
if (!bake) {
|
|
244
264
|
sendError(res, 404, "not_found.bake", "bake not found");
|
|
@@ -335,7 +355,12 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
335
355
|
return;
|
|
336
356
|
}
|
|
337
357
|
if (match.decl.id === "image-by-digest") {
|
|
338
|
-
const
|
|
358
|
+
const digest = safeDecode(match.params.digest);
|
|
359
|
+
if (digest === null) {
|
|
360
|
+
sendError(res, 400, "request.path_malformed", "malformed id (invalid percent-encoding)");
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
const entry = await idx.getByDigest(digest);
|
|
339
364
|
if (!entry || (!viewer.operator && entry.visibility === "tenant" && entry.tenantId !== viewer.tenantId)) {
|
|
340
365
|
sendError(res, 404, "not_found.image", "not found");
|
|
341
366
|
return;
|
|
@@ -344,7 +369,12 @@ export async function handleImages(req, res, match, ctx) {
|
|
|
344
369
|
return;
|
|
345
370
|
}
|
|
346
371
|
if (match.decl.id === "image-by-profile") {
|
|
347
|
-
const
|
|
372
|
+
const profile = safeDecode(match.params.profile);
|
|
373
|
+
if (profile === null) {
|
|
374
|
+
sendError(res, 400, "request.path_malformed", "malformed id (invalid percent-encoding)");
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const entry = await idx.latestPublished(profile, viewer);
|
|
348
378
|
if (!entry) {
|
|
349
379
|
sendError(res, 404, "not_found.image", "not found");
|
|
350
380
|
return;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* 路径是 session,动词挂在 **run 句柄**上 ⇒ 会话属主门(`sessionStorage.ownerOf`,未知与他人**同码同串**
|
|
34
34
|
* 404 无 oracle,与 `POST /v1/sessions/:id/notify` 逐字同形)→ `getActiveTaskId` 取本会话的活 run →
|
|
35
35
|
* `steerableRuns` 取本副本活流。非 live 的四臂一码 409 `steering.not_running`,判据取词表属主
|
|
36
|
-
* (`isParkedRunStatus` / `isTerminalRunStatus`)与 `runProvenElsewhere`(
|
|
36
|
+
* (`isParkedRunStatus` / `isTerminalRunStatus`)与 `runProvenElsewhere`(手抄已收编成一只谓词,S-430 起同住 `plugins/store-contracts.ts`)。
|
|
37
37
|
* 显式 operator 可重拨任何租户的会话(监督动作,与 notify / steer 同臂;**不是** bare `isOperator`)。
|
|
38
38
|
*
|
|
39
39
|
* ── 计费/门 ─────────────────────────────────────────────────────────────────────────────────────
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { isParkedRunStatus, isTerminalRunStatus } from "../../plugins/store-contracts.js";
|
|
2
|
+
import { isParkedRunStatus, isTerminalRunStatus, runProvenElsewhere } from "../../plugins/store-contracts.js";
|
|
3
3
|
import { redactSecrets } from "../../trace/redact.js";
|
|
4
4
|
import { sendJson, sendError } from "../send.js";
|
|
5
5
|
import { gatedPrincipal, explicitOperatorOk, sendPrincipalRefusal } from "../principal-gate.js";
|
|
6
|
-
import {
|
|
6
|
+
import {} from "../route-ctx.js";
|
|
7
7
|
import { assertNever } from "../route-ctx.js";
|
|
8
8
|
const BodySchema = z.object({ server: z.string().min(1).max(190) }).strict();
|
|
9
9
|
const NEUTRALIZED_TEXT_MAX = 200;
|
|
@@ -63,7 +63,7 @@ function sendScopeGateRefusal(res, gate) {
|
|
|
63
63
|
}
|
|
64
64
|
export async function handleMemoryPolicy(req, res, match, ctx) {
|
|
65
65
|
const { deps } = ctx;
|
|
66
|
-
const { readJson } = ctx.helpers;
|
|
66
|
+
const { readJson, safeDecode } = ctx.helpers;
|
|
67
67
|
switch (match.decl.id) {
|
|
68
68
|
case "memory-export": {
|
|
69
69
|
const principal = gatedPrincipal(req, deps.config);
|
|
@@ -135,11 +135,8 @@ export async function handleMemoryPolicy(req, res, match, ctx) {
|
|
|
135
135
|
sendError(res, 501, "capability.memory_store_required", "memory sync requires a DB memory backend (MEMORY_ENGINE_BACKEND=pg|tidb)");
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
scope = decodeURIComponent(match.params.scope);
|
|
141
|
-
}
|
|
142
|
-
catch {
|
|
138
|
+
const scope = safeDecode(match.params.scope);
|
|
139
|
+
if (scope === null) {
|
|
143
140
|
sendError(res, 400, "memory_sync_invalid_scope", "malformed percent-encoding in :scope");
|
|
144
141
|
return;
|
|
145
142
|
}
|
|
@@ -6,7 +6,7 @@ import { assertNever } from "../route-ctx.js";
|
|
|
6
6
|
export async function handleNotifyWake(req, res, match, ctx) {
|
|
7
7
|
const { deps } = ctx;
|
|
8
8
|
const { steerableRuns } = ctx.registry;
|
|
9
|
-
const { readJson, rateLimited, quotaExceeded, leaseDenied } = ctx.helpers;
|
|
9
|
+
const { readJson, rateLimited, quotaExceeded, leaseDenied, safeDecode } = ctx.helpers;
|
|
10
10
|
const { resumeWake } = ctx.legs;
|
|
11
11
|
switch (match.decl.id) {
|
|
12
12
|
case "session-notify": {
|
|
@@ -17,7 +17,11 @@ export async function handleNotifyWake(req, res, match, ctx) {
|
|
|
17
17
|
sendPrincipalRefusal(res, req, deps.config);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const notifySession =
|
|
20
|
+
const notifySession = safeDecode(match.params.sessionId);
|
|
21
|
+
if (notifySession === null) {
|
|
22
|
+
sendError(res, 400, "request.path_malformed", "session id segment is not valid percent-encoding");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
21
25
|
let nb;
|
|
22
26
|
try {
|
|
23
27
|
nb = (await readJson(req));
|
|
@@ -111,7 +115,11 @@ export async function handleNotifyWake(req, res, match, ctx) {
|
|
|
111
115
|
sendPrincipalRefusal(res, req, deps.config);
|
|
112
116
|
return;
|
|
113
117
|
}
|
|
114
|
-
const wakeSession =
|
|
118
|
+
const wakeSession = safeDecode(match.params.sessionId);
|
|
119
|
+
if (wakeSession === null) {
|
|
120
|
+
sendError(res, 400, "request.path_malformed", "session id segment is not valid percent-encoding");
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
115
123
|
let wakeBody;
|
|
116
124
|
try {
|
|
117
125
|
wakeBody = (await readJson(req));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { isParkedRunStatus, isTerminalRunStatus } from "../../plugins/store-contracts.js";
|
|
2
|
+
import { isParkedRunStatus, isTerminalRunStatus, runProvenElsewhere } from "../../plugins/store-contracts.js";
|
|
3
3
|
import { sendJson, sendError } from "../send.js";
|
|
4
4
|
import { gatedPrincipal, sendPrincipalRefusal } from "../principal-gate.js";
|
|
5
|
-
import { RUN_NOT_FOUND_MESSAGE, runNotFoundMessage
|
|
5
|
+
import { RUN_NOT_FOUND_MESSAGE, runNotFoundMessage } from "../route-ctx.js";
|
|
6
6
|
import { assertNever } from "../route-ctx.js";
|
|
7
7
|
const BodySchema = z.object({ reason: z.string().min(1).max(500).optional() }).strict();
|
|
8
8
|
export async function handleRunMemoryCapture(req, res, match, ctx) {
|
|
@@ -31,10 +31,8 @@ export async function handleRunMemoryCapture(req, res, match, ctx) {
|
|
|
31
31
|
sendError(res, 404, "not_found.run", runNotFoundMessage(taskId));
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
35
|
-
sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE);
|
|
34
|
+
if (!ctx.helpers.runOwnerOk(req, res, run.owner))
|
|
36
35
|
return;
|
|
37
|
-
}
|
|
38
36
|
const live = ctx.registry.steerableRuns.get(taskId);
|
|
39
37
|
if (live) {
|
|
40
38
|
try {
|
package/dist/http/routes/runs.js
CHANGED
|
@@ -3,7 +3,7 @@ import { memoRedactedRead, memoRedactTerminalResult, redactErrorMessage, redactH
|
|
|
3
3
|
import { isModelTextLedgerEventType } from "../../trace/ledger-events.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { uuidv7, mintCheckpointToken, CheckpointError, validatePendingSteer } from "@sema-agent/core";
|
|
6
|
-
import { isTerminalRunStatus, isParkedRunStatus } from "../../plugins/store-contracts.js";
|
|
6
|
+
import { isTerminalRunStatus, isParkedRunStatus, runProvenElsewhere } from "../../plugins/store-contracts.js";
|
|
7
7
|
import { LIVE_RUN_GATE_KINDS, TERMINAL_PARK_GATE_KINDS } from "../../plugins/checkpoint-store-sql.js";
|
|
8
8
|
import { redactSecrets } from "../../trace/redact.js";
|
|
9
9
|
import { HttpError, verifiedPrincipal, isUuidV7, encodeCheckpointScope } from "../../security.js";
|
|
@@ -27,7 +27,7 @@ import { headerStr, gatedPrincipal, explicitOperatorOk, sendPrincipalRefusal } f
|
|
|
27
27
|
import { ActorAssertionWire } from "@sema-agent/settings-schema";
|
|
28
28
|
import { assertNever } from "../route-ctx.js";
|
|
29
29
|
import { mintAndDriveDurableRun } from "../durable-run-leg.js";
|
|
30
|
-
import { RUN_NOT_FOUND_MESSAGE, runNotFoundMessage
|
|
30
|
+
import { RUN_NOT_FOUND_MESSAGE, runNotFoundMessage } from "../route-ctx.js";
|
|
31
31
|
import { withPrincipal } from "../../observability/principal-context.js";
|
|
32
32
|
const ASK_PARKING_RETRY_AFTER_SEC = 2;
|
|
33
33
|
const ASK_ACTOR_LABEL_MAX = 256;
|
|
@@ -64,7 +64,8 @@ export function projectDecisionActor(raw) {
|
|
|
64
64
|
const parsed = AskDecisionActorSchema.safeParse(raw);
|
|
65
65
|
return parsed.success ? parsed.data : undefined;
|
|
66
66
|
}
|
|
67
|
-
async function subagentReadGate(req, res,
|
|
67
|
+
async function subagentReadGate(req, res, ctx, runId, search) {
|
|
68
|
+
const { deps } = ctx;
|
|
68
69
|
const principal = gatedPrincipal(req, deps.config);
|
|
69
70
|
if (deps.config.requirePrincipal && principal === undefined) {
|
|
70
71
|
sendPrincipalRefusal(res, req, deps.config);
|
|
@@ -72,10 +73,13 @@ async function subagentReadGate(req, res, deps, runId, search) {
|
|
|
72
73
|
}
|
|
73
74
|
const trusted = explicitOperatorOk(principal, deps.config.operatorPrincipals);
|
|
74
75
|
const run = await deps.runStore.getRun(runId);
|
|
75
|
-
if (!run
|
|
76
|
+
if (!run) {
|
|
76
77
|
sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE);
|
|
77
78
|
return null;
|
|
78
79
|
}
|
|
80
|
+
if (!trusted && !ctx.helpers.runOwnerOk(req, res, run.owner)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
79
83
|
const callerSession = new URLSearchParams(search).get("session");
|
|
80
84
|
if (!trusted && run.sessionId && callerSession !== run.sessionId) {
|
|
81
85
|
sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE);
|
|
@@ -429,10 +433,8 @@ export async function handleRuns(req, res, match, ctx) {
|
|
|
429
433
|
sendError(res, 404, "not_found.run", runNotFoundMessage(taskId));
|
|
430
434
|
return;
|
|
431
435
|
}
|
|
432
|
-
if (!trusted &&
|
|
433
|
-
sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE);
|
|
436
|
+
if (!trusted && !runOwnerOk(req, res, run.owner))
|
|
434
437
|
return;
|
|
435
|
-
}
|
|
436
438
|
if (!runSessionAcceptOk(req, res, run, "run.steer"))
|
|
437
439
|
return;
|
|
438
440
|
let parkQueueFull;
|
|
@@ -714,10 +716,8 @@ export async function handleRuns(req, res, match, ctx) {
|
|
|
714
716
|
sendError(res, 404, "not_found.run", runNotFoundMessage(taskId));
|
|
715
717
|
return;
|
|
716
718
|
}
|
|
717
|
-
if (!trusted &&
|
|
718
|
-
sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE);
|
|
719
|
+
if (!trusted && !runOwnerOk(req, res, run.owner))
|
|
719
720
|
return;
|
|
720
|
-
}
|
|
721
721
|
if (!runSessionAcceptOk(req, res, run, "run.interrupt"))
|
|
722
722
|
return;
|
|
723
723
|
const sendInterruptNotRunning = (error) => sendError(res, 409, "steering.not_running", error);
|
|
@@ -812,10 +812,8 @@ export async function handleRuns(req, res, match, ctx) {
|
|
|
812
812
|
return;
|
|
813
813
|
}
|
|
814
814
|
const operator = explicitOperatorOk(principal, deps.config.operatorPrincipals);
|
|
815
|
-
if (!operator &&
|
|
816
|
-
sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE);
|
|
815
|
+
if (!operator && !runOwnerOk(req, res, run.owner))
|
|
817
816
|
return;
|
|
818
|
-
}
|
|
819
817
|
if (!runSessionAcceptOk(req, res, run, "run.compact"))
|
|
820
818
|
return;
|
|
821
819
|
let compactBody;
|
|
@@ -894,10 +892,8 @@ export async function handleRuns(req, res, match, ctx) {
|
|
|
894
892
|
return;
|
|
895
893
|
}
|
|
896
894
|
const operator = explicitOperatorOk(principal, deps.config.operatorPrincipals);
|
|
897
|
-
if (!operator &&
|
|
898
|
-
sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE);
|
|
895
|
+
if (!operator && !runOwnerOk(req, res, run.owner))
|
|
899
896
|
return;
|
|
900
|
-
}
|
|
901
897
|
if (!runSessionAcceptOk(req, res, run, "run.detach"))
|
|
902
898
|
return;
|
|
903
899
|
const live = steerableRuns.get(taskId);
|
|
@@ -913,7 +909,7 @@ export async function handleRuns(req, res, match, ctx) {
|
|
|
913
909
|
}
|
|
914
910
|
export async function handleRunVerbs(req, res, match, ctx) {
|
|
915
911
|
const { deps } = ctx;
|
|
916
|
-
const { readJson, rateLimited, quotaExceeded, ownerQuotaDenied, leaseDenied, ownerLeaseDenied, safeDecode, runSessionAcceptOk } = ctx.helpers;
|
|
912
|
+
const { readJson, rateLimited, quotaExceeded, ownerQuotaDenied, leaseDenied, ownerLeaseDenied, safeDecode, runOwnerOk, runSessionAcceptOk } = ctx.helpers;
|
|
917
913
|
if (match.decl.id === "run-subagent-output") {
|
|
918
914
|
if (!deps.runStore || !deps.subagentTaskOutput) {
|
|
919
915
|
sendError(res, 501, "capability.run_store_required", "subagent output reads require the run store");
|
|
@@ -925,7 +921,7 @@ export async function handleRunVerbs(req, res, match, ctx) {
|
|
|
925
921
|
sendError(res, 400, "request.path_malformed", "malformed subagent path (invalid percent-encoding)");
|
|
926
922
|
return;
|
|
927
923
|
}
|
|
928
|
-
const gated = await subagentReadGate(req, res,
|
|
924
|
+
const gated = await subagentReadGate(req, res, ctx, runId, match.search);
|
|
929
925
|
if (!gated)
|
|
930
926
|
return;
|
|
931
927
|
const { run } = gated;
|
|
@@ -950,7 +946,7 @@ export async function handleRunVerbs(req, res, match, ctx) {
|
|
|
950
946
|
sendError(res, 400, "request.path_malformed", "malformed subagent path (invalid percent-encoding)");
|
|
951
947
|
return;
|
|
952
948
|
}
|
|
953
|
-
const gatedTail = await subagentReadGate(req, res,
|
|
949
|
+
const gatedTail = await subagentReadGate(req, res, ctx, runId, match.search);
|
|
954
950
|
if (!gatedTail)
|
|
955
951
|
return;
|
|
956
952
|
const { run } = gatedTail;
|
|
@@ -1015,7 +1011,7 @@ export async function handleRunVerbs(req, res, match, ctx) {
|
|
|
1015
1011
|
sendError(res, 400, "request.path_malformed", "malformed task path (invalid percent-encoding)");
|
|
1016
1012
|
return;
|
|
1017
1013
|
}
|
|
1018
|
-
const gatedB = await subagentReadGate(req, res,
|
|
1014
|
+
const gatedB = await subagentReadGate(req, res, ctx, runId, match.search);
|
|
1019
1015
|
if (!gatedB)
|
|
1020
1016
|
return;
|
|
1021
1017
|
const { run } = gatedB;
|
|
@@ -1113,10 +1109,12 @@ export async function handleRunVerbs(req, res, match, ctx) {
|
|
|
1113
1109
|
}
|
|
1114
1110
|
const trusted = explicitOperatorOk(principal, deps.config.operatorPrincipals);
|
|
1115
1111
|
const run = await deps.runStore.getRun(runId);
|
|
1116
|
-
if (!run
|
|
1112
|
+
if (!run) {
|
|
1117
1113
|
sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE);
|
|
1118
1114
|
return;
|
|
1119
1115
|
}
|
|
1116
|
+
if (!trusted && !runOwnerOk(req, res, run.owner))
|
|
1117
|
+
return;
|
|
1120
1118
|
if (!runSessionAcceptOk(req, res, run, `subagent.${verb}`))
|
|
1121
1119
|
return;
|
|
1122
1120
|
const send409 = (errorCode, error) => sendError(res, 409, errorCode, error);
|
|
@@ -219,7 +219,11 @@ export async function handleSessions(req, res, match, ctx) {
|
|
|
219
219
|
sendError(res, 501, "capability.session_store_required", "session head probe requires a durable session store (DB_BACKEND=mysql|pg|local)");
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
const headSession =
|
|
222
|
+
const headSession = safeDecode(match.params.sessionId);
|
|
223
|
+
if (headSession === null) {
|
|
224
|
+
sendError(res, 400, "request.path_malformed", "session id segment is not valid percent-encoding");
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
223
227
|
const getHead = deps.sessionStorage?.getHead?.bind(deps.sessionStorage);
|
|
224
228
|
let owner;
|
|
225
229
|
let leafId;
|
|
@@ -262,7 +266,11 @@ export async function handleSessions(req, res, match, ctx) {
|
|
|
262
266
|
sendError(res, 501, "capability.session_store_required", "session events require a durable session store (DB_BACKEND=mysql|pg|local)");
|
|
263
267
|
return;
|
|
264
268
|
}
|
|
265
|
-
const evSession =
|
|
269
|
+
const evSession = safeDecode(match.params.sessionId);
|
|
270
|
+
if (evSession === null) {
|
|
271
|
+
sendError(res, 400, "request.path_malformed", "session id segment is not valid percent-encoding");
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
266
274
|
if (sse.sseConnections >= (deps.sessionEventsMaxConnections ?? 256)) {
|
|
267
275
|
res.setHeader("retry-after", "5");
|
|
268
276
|
sendError(res, 503, "state.sse_connection_cap", "session-events connection cap reached — fall back to /head polling");
|
|
@@ -90,7 +90,11 @@ export async function handleSharedMemory(req, res, match, ctx) {
|
|
|
90
90
|
}
|
|
91
91
|
case "shared-memory-store-documents":
|
|
92
92
|
case "shared-memory-store-document": {
|
|
93
|
-
const storeId =
|
|
93
|
+
const storeId = ctx.helpers.safeDecode(match.params.store);
|
|
94
|
+
if (storeId === null) {
|
|
95
|
+
sendError(res, 400, "request.path_malformed", "malformed id (invalid percent-encoding)");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
94
98
|
const query = new URLSearchParams(match.search);
|
|
95
99
|
const snapshot = await bindSnapshot(req, res, ctx);
|
|
96
100
|
if (!snapshot)
|
package/dist/memory-scope.d.ts
CHANGED
|
@@ -221,6 +221,22 @@ declarations?: {
|
|
|
221
221
|
* `normalizeMemorySpec(spec)?.enabled === true`。S-405 之后 `memory:"off"` 铸的是「键在场 + `enabled:false`」(保留事实),
|
|
222
222
|
* 任何按「键在不在场」判挂没挂的读者从那一天起都读错(改前 `memory-notice` 正是那样,把无记忆面的披露一起吞掉)。
|
|
223
223
|
* 消费方拿本函数的布尔,不拿 `spec.memory` 自己判。
|
|
224
|
+
*
|
|
225
|
+
* ⚠️ **本函数会抛,而「抛」本身就是一条判据**(S-424 补注)。`normalizeMemorySpec` 对两形直接 throw
|
|
226
|
+
* (亲核安装态 core 7.22.0 `dist/core/memory.js:367-372` 与 `:373-385`):
|
|
227
|
+
* · 单数 `scope` 键在场 ⇒ `code:"config.memory_scope_spelling"`(core 已删的旧拼写;它的报错原话
|
|
228
|
+
* 是「Refusing to start with memory silently off」—— 静默关闭正是那次 HIGH 的伤害面);
|
|
229
|
+
* · `capture` 在场且不是字面 `"off"` ⇒ `code:"config.memory_capture_spelling"`。
|
|
230
|
+
*
|
|
231
|
+
* 这两形在本仓的 wire 面上**都到不了这里**,各有属主:
|
|
232
|
+
* · 请求体侧 = 值闭包门 `singleMemberOffFieldIssue`(`src/request-value-closure.ts`;fresh 400 与 resume
|
|
233
|
+
* 重放共用的同一只)—— 到得了下游的 `memory`/`memoryCapture` 只可能是字面 `"off"` 或缺席;
|
|
234
|
+
* · spec 侧 = 唯一铸点 {@link memorySpecForRequest}(本文件)—— 它恒产 `scopes: [scope, ...extras]`,
|
|
235
|
+
* 从不产单数 `scope`,`capture` 也只在声明为 `"off"` 时才铸。
|
|
236
|
+
*
|
|
237
|
+
* 所以这里抛 = **调用方没先过值闭包门**(手搓 spec、或绕过铸点直接喂一份 `TaskSpec.memory`),不是这一腿
|
|
238
|
+
* 的运行期异常,**不要在本函数里加吞异常的臂**:吞掉就退回「memory 静默整体关闭」,即上面那条报错原话
|
|
239
|
+
* 拒绝的那件事。要放宽/收紧值域,改上面两个属主。
|
|
224
240
|
*/
|
|
225
241
|
export declare function memoryFaceMounted(memory: TaskSpec["memory"]): boolean;
|
|
226
242
|
//# sourceMappingURL=memory-scope.d.ts.map
|
|
@@ -754,7 +754,9 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
754
754
|
*/
|
|
755
755
|
peekScopeByToken(token: CheckpointToken): Promise<string | null | undefined>;
|
|
756
756
|
peekPendingScope(sessionId: string, binding?: PendingRowBinding): Promise<string | null | undefined>;
|
|
757
|
-
/** Upsert the resume rebuild inputs for a session
|
|
757
|
+
/** Upsert the resume rebuild inputs for a session — written at SUBMIT (durable mode on) and, since S-433 F2,
|
|
758
|
+
* once per resume leg at its CAS win point (`DriveResumeArgs.resumeCtx`). Unconditional per `session_id`:
|
|
759
|
+
* the ordering fence lives at the CALLER's CAS win, not in a version column here. */
|
|
758
760
|
putCtx(sessionId: string, ctx: unknown): Promise<void>;
|
|
759
761
|
getCtx<T = unknown>(sessionId: string): Promise<T | null>;
|
|
760
762
|
/**
|
|
@@ -763,7 +765,11 @@ export declare class SqlCheckpointStore implements CheckpointStore {
|
|
|
763
765
|
*
|
|
764
766
|
* The extra `task_active` guard closes a multi-gate window: between a resume's CAS (pending→resolved) and
|
|
765
767
|
* the task hitting its NEXT gate (writing a new pending checkpoint), the session has no pending checkpoint —
|
|
766
|
-
* yet `putCtx`
|
|
768
|
+
* yet `putCtx` stamps `updated_at_ms` at submit and — since S-433 F2 (server 7.86.0) — once more on EVERY
|
|
769
|
+
* resume leg, at the moment that leg wins the resume CAS (`DriveResumeArgs.resumeCtx`; before that fix only
|
|
770
|
+
* the plan approval's mode write-back re-stamped it, and it did so AFTER acceptance). Both extra writes only
|
|
771
|
+
* ever REFRESH the stamp, so they lengthen a ctx's life and touch none of the three guards — the direction is
|
|
772
|
+
* "keep it longer", never "reap it sooner". So the ctx could be older than `cutoff` and was being
|
|
767
773
|
* reaped, making the next resume 409 ("resume context missing"). `task_active` holds the session lock for
|
|
768
774
|
* the WHOLE submit→last-resume-complete span (running OR suspended), so excluding sessions with an active
|
|
769
775
|
* claim keeps the ctx exactly as long as a run still needs it, while still GC'ing it once the run is terminal.
|
|
@@ -240,6 +240,29 @@ export declare function isUnsuccessfulRunStatus(status: RunRecord["status"]): bo
|
|
|
240
240
|
* 动作(cancel 的恢复把手会 CAS-expire 一张 checkpoint);对一个本进程读不懂的状态,少动一次远好过错杀。
|
|
241
241
|
*/
|
|
242
242
|
export declare function isParkedRunStatus(status: RunRecord["status"]): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* 「**证得出**这条 run 活在别的副本上」——「他副本」那一句话的**唯一判据**(S-381 收编;S-430 迁居)。
|
|
245
|
+
*
|
|
246
|
+
* 成案:这个合取式此前在四处**逐字手抄**(`http/routes/runs.ts` 的 steer 臂与 interrupt 臂、同文件
|
|
247
|
+
* `sendHandleMiss`、`http/routes/run-memory-capture.ts`),`POST /v1/sessions/:id/mcp/reconnect` 是第五处、`fleet/fleet-reconciler.ts` 是第六处 ——
|
|
248
|
+
* 而它的每一个合取项都是一条**被复审逐条挣出来的**纪律,不是随手的判空:
|
|
249
|
+
* · {@link RunRecord.instanceId} 缺席(`null` / 建列之前的行 / 替身行的 `undefined`)= **不知道它在哪**,
|
|
250
|
+
* 不是「在别处」;
|
|
251
|
+
* · `thisInstanceId` 缺席 = 本副本连自己是谁都说不上,更不能断言别人;
|
|
252
|
+
* · 两者都在场且**不等**才够格说「他副本」(`markResuming` 认领后该列语义 = **当前持有副本**)。
|
|
253
|
+
* 抄一份 = 多一个写者;收成一只谓词之后,纪律改一次就处处同改。**`status` 不进本谓词**:
|
|
254
|
+
* `sendHandleMiss` 只对 `running` 行说这句话,而 steer 族在 park/终态两臂之后才走到这里 —— 各调用点
|
|
255
|
+
* 的前置臂不同族,合进来会让某一处悄悄改判。
|
|
256
|
+
*
|
|
257
|
+
* 🔴 **为什么住在这里而不是 `http/route-ctx.ts`**(S-430):`src/fleet/fleet-reconciler.ts` 是第六个手抄点,
|
|
258
|
+
* 而 `src/fleet/` 今天对 `src/http/` **零依赖**(边向恒是 http → fleet)。把消费方拉去 http 取一只纯谓词
|
|
259
|
+
* 会凭空造一条反向装载边;而本文件正是 {@link RunRecord} 与它的兄弟谓词({@link isTerminalRunStatus} /
|
|
260
|
+
* {@link isParkedRunStatus})的所在 —— 「关于 run 行的判词」本来就该在行的属主这里,http 与 fleet 都已经
|
|
261
|
+
* 依赖它。**无别名、无再导出**:旧拼法删干净,消费方的 tsc 红就是通知。
|
|
262
|
+
*/
|
|
263
|
+
export declare function runProvenElsewhere(run: {
|
|
264
|
+
instanceId?: string | null;
|
|
265
|
+
}, thisInstanceId: string | undefined): boolean;
|
|
243
266
|
/** One row of the GET /v1/sessions list (CC /resume picker): a DISTINCT session (sessionId) aggregated from its
|
|
244
267
|
* task_run rows — newest-first by last activity. The preview/status are the LATEST run's ("continue where I left
|
|
245
268
|
* off"); the counts/timestamps span the whole session. Owner included so a fleet-wide (ops) listing is attributable. */
|
|
@@ -23,6 +23,9 @@ export function isUnsuccessfulRunStatus(status) {
|
|
|
23
23
|
export function isParkedRunStatus(status) {
|
|
24
24
|
return runStatusClassOf(status) === "parked";
|
|
25
25
|
}
|
|
26
|
+
export function runProvenElsewhere(run, thisInstanceId) {
|
|
27
|
+
return typeof run.instanceId === "string" && run.instanceId.length > 0 && thisInstanceId !== undefined && run.instanceId !== thisInstanceId;
|
|
28
|
+
}
|
|
26
29
|
export function mapBakeRow(r) {
|
|
27
30
|
return {
|
|
28
31
|
bakeId: r.bake_id,
|
package/dist/principal-jwt.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ApprovalHmacKey, PrincipalJwtKey } from "./auth-keys.js";
|
|
2
|
+
import { type ApprovalEnvelope } from "./approval-hmac.js";
|
|
2
3
|
/**
|
|
3
4
|
* 验签允许的**时钟不一致容差**(秒)—— 本仓这条轴上的单一来源。
|
|
4
5
|
*
|
|
@@ -47,6 +48,14 @@ export declare function verifyPrincipalJwt(token: string, keys: PrincipalJwtKey[
|
|
|
47
48
|
/** 良构 Unicode(无孤立代理项)。`u` 旗下配对代理项是一个码点、不匹配 `\p{Surrogate}`;只有孤立的才命中。 */
|
|
48
49
|
export declare function isWellFormedUnicode(s: string): boolean;
|
|
49
50
|
export declare function editedPlanBinding(editedPlan: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* JWT `cnf.bnd` = **「这份身份凭据被签发去决哪一张卡」**(动作身份),故只哈希前三位。
|
|
53
|
+
*
|
|
54
|
+
* 🔴 **与 HMAC 信封的分工**(S-433 F1 立此,属主注在 `approval-hmac.ts` 顶):HMAC 绑的是**「决了什么」**
|
|
55
|
+
* —— `decision` / `reason` / `permissionModeAfter` 这些**会改变后果**的字段全在那一把里。所以「同一张卡上
|
|
56
|
+
* 把 approve 的档偷偷调宽」只由 HMAC 拦;本函数**刻意不跟着加位**:决定内容改了 `cnf.bnd` 不该变(否则
|
|
57
|
+
* 一份合法 JWT 会被绑死在一个它签发时还不知道的值上,而 `permissionModeAfter` 恰恰是决裁那一刻才定的)。
|
|
58
|
+
*/
|
|
50
59
|
export declare function approvalBnd(env: {
|
|
51
60
|
sessionId: string;
|
|
52
61
|
boundCallId?: string | null;
|
|
@@ -109,13 +118,12 @@ export declare function verifyDirectDoorProof(proof: {
|
|
|
109
118
|
jwt?: string;
|
|
110
119
|
mac?: string;
|
|
111
120
|
kid?: string;
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}, config: {
|
|
121
|
+
},
|
|
122
|
+
/** 🔴 **命名类型,不是结构等价的内联字面**(S-433 F1 [high] 的**根因**,验真后修):本位此前是一份手抄的
|
|
123
|
+
* 五字段内联形 —— 结构类型让**多带一个字段的调用方**照样编译通过,而下面那次手抄再把它**丢掉**,于是
|
|
124
|
+
* `approval-hmac.ts` 上新增的签名位在这条唯一的真实验签链上**静默失效**,tsc 一个字都不响。
|
|
125
|
+
* 用 {@link ApprovalEnvelope} 之后,信封的形只有**一个**声明点,新增一位自动到达验签器。 */
|
|
126
|
+
envelope: ApprovalEnvelope, config: {
|
|
119
127
|
principalJwtPubkeys: PrincipalJwtKey[];
|
|
120
128
|
principalJwtIss?: string;
|
|
121
129
|
principalJwtAud?: string;
|
package/dist/principal-jwt.js
CHANGED
|
@@ -101,7 +101,7 @@ export function verifyDirectDoorProof(proof, envelope, config, opts) {
|
|
|
101
101
|
return { ok: false, status: 401, errorCode: "principal_unbound", error: "principal token is not bound to this decision (cnf.bnd mismatch)" };
|
|
102
102
|
if (!proof.mac)
|
|
103
103
|
return { ok: false, status: 401, errorCode: "approval_mac_required", error: "direct door requires an approval MAC (X-Approval-Mac)" };
|
|
104
|
-
const ok = verifyApprovalHmac(
|
|
104
|
+
const ok = verifyApprovalHmac(envelope, proof.mac, proof.kid, config.approvalHmacKeys);
|
|
105
105
|
if (!ok)
|
|
106
106
|
return { ok: false, status: 401, errorCode: "approval_mac_invalid", error: "approval envelope MAC invalid" };
|
|
107
107
|
return actionBinding
|
package/dist/task-settings.d.ts
CHANGED
|
@@ -70,6 +70,41 @@ export declare function coercePermissionMode(raw: unknown): SettingsPermissionMo
|
|
|
70
70
|
/** 五模式闭集的**严格**读法([ref] ④:`/v1/capabilities?permissionMode=` 查询串用它 —— 读面对词表外的值 400,
|
|
71
71
|
* 不走上面那条给 resume 重放留的 `default` 宽臂)。上面的宽读只是本函数外再包一层折叠,词表单点在此。 */
|
|
72
72
|
export declare function coercePermissionModeStrict(raw: unknown): SettingsPermissionMode | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* S-433 —— 一份**被批准的计划**之后,这条会话继续用的 permission mode(`plan_review` 决裁体的
|
|
75
|
+
* `permissionModeAfter`)。core 的契约句是 `present-plan-tool.js`:「If the plan is approved, the run
|
|
76
|
+
* continues (and any read-only restriction is lifted)」—— 而 core 顶层 resume 把宿主的续跑配置**整体**
|
|
77
|
+
* 展开成新一段 spec、不继承停靠点的 `handsReadOnly` / `enablePlanMode`(`runtask.ts`),所以「松开」这
|
|
78
|
+
* 件事的属主在**本仓装配续跑配置的那一处**。批准者要说的正是「松到哪一档」。
|
|
79
|
+
*
|
|
80
|
+
* 🔴 **闭集为什么只有这两个词**:它是 CC `ExitPlanMode` 三选卡上那两张 Yes 卡(「Yes, and auto-accept
|
|
81
|
+
* edits」/「Yes, and manually approve edits」)的对位;`plan` 自己(= 不松开)由 `edit`/`reject` 两个
|
|
82
|
+
* 决裁表达,`bypassPermissions` / `auto` 不在这张卡上 —— 一个批准动作不该顺带把部署的 ask 面整个关掉。
|
|
83
|
+
*
|
|
84
|
+
* 🔴 **不手抄词表**:`satisfies readonly SettingsPermissionMode[]` 让「本表的成员必须仍是本仓受理的
|
|
85
|
+
* 模式词」成为**编译期**事实 —— 五词表某天改名/删词,这里就是红的,而不是静默留一个没人认的词。
|
|
86
|
+
*/
|
|
87
|
+
export declare const PLAN_APPROVE_PERMISSION_MODES_AFTER: readonly ["default", "acceptEdits"];
|
|
88
|
+
/** {@link PLAN_APPROVE_PERMISSION_MODES_AFTER} 的类型形(值表单点,类型从值派生 —— 两处各写一份就会漂)。 */
|
|
89
|
+
export type PlanApprovePermissionModeAfter = (typeof PLAN_APPROVE_PERMISSION_MODES_AFTER)[number];
|
|
90
|
+
/** S-433 值闭集判据(wire 门用)。**宽臂一个都没有**:词表外的值 400 响亮拒 —— 这一位选的是批准之后
|
|
91
|
+
* 模型有没有手,把一个拼错的词折成任何一档都是安全轴上的静默降级([ref]「无静默 fail-open」)。 */
|
|
92
|
+
export declare function isPlanApprovePermissionModeAfter(raw: unknown): raw is PlanApprovePermissionModeAfter;
|
|
93
|
+
/**
|
|
94
|
+
* S-433 —— **一条已持久化的提交体的生效 permission mode**,单点。
|
|
95
|
+
*
|
|
96
|
+
* 它只是把 {@link effectivePermissionMode} 与「拿哪一份 settings 去问」这**一对**绑在一起:后者是
|
|
97
|
+
* `parseTaskSettings(body.settings)`(resume 重放共用的宽容解析层)。两处各写一遍这一对,就会在
|
|
98
|
+
* 「某天改成用别的 settings 去算生效模式」的那一拍静默分家 —— 而分家在这条轴上的形态是「wire 门说
|
|
99
|
+
* 这条任务不是只读起步、装配腿却按只读起步重建」,两个 4xx/行为各说各话,tsc 一声不响。
|
|
100
|
+
*
|
|
101
|
+
* ⚠️ 射程:**只管持久化体这一路**。首跑那一路的生效模式在 `boot/resolve-spec.ts` 单点算(它吃的是
|
|
102
|
+
* 场景折叠后的 settings),本函数刻意不去冒充那一处的属主。
|
|
103
|
+
*/
|
|
104
|
+
export declare function storedBodyPermissionMode(body: {
|
|
105
|
+
permissionMode?: unknown;
|
|
106
|
+
settings?: unknown;
|
|
107
|
+
}): SettingsPermissionMode | undefined;
|
|
73
108
|
/** L2 ultracode ([ref]): the effective `thinking` level given the explicit `reasoningEffort` and the ultracode
|
|
74
109
|
* preset. ultracode FLOORS at the "ultra" tier — core's single source `resolveReasoningProfile("ultra").thinking`
|
|
75
110
|
* (= "max"), never a hardcoded literal — so an explicit higher tier still wins (none exists above max today;
|
package/dist/task-settings.js
CHANGED
|
@@ -16,6 +16,13 @@ export function coercePermissionModeStrict(raw) {
|
|
|
16
16
|
return raw;
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
|
+
export const PLAN_APPROVE_PERMISSION_MODES_AFTER = ["default", "acceptEdits"];
|
|
20
|
+
export function isPlanApprovePermissionModeAfter(raw) {
|
|
21
|
+
return PLAN_APPROVE_PERMISSION_MODES_AFTER.includes(raw);
|
|
22
|
+
}
|
|
23
|
+
export function storedBodyPermissionMode(body) {
|
|
24
|
+
return effectivePermissionMode(body, parseTaskSettings(body.settings).settings);
|
|
25
|
+
}
|
|
19
26
|
export function effectiveThinking(reasoningEffort, ultracode) {
|
|
20
27
|
const explicit = isThinkingLevel(reasoningEffort) ? reasoningEffort : undefined;
|
|
21
28
|
if (!ultracode)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.86.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|