@sema-agent/server 7.126.0 → 7.127.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +38 -0
- package/USAGE.md +86 -8
- package/deploy/sema-up/chart/templates/networkpolicy-sandbox.yaml +15 -5
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +28 -1
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +1 -0
- package/deploy/sema-up/chart/templates/server.yaml +1 -0
- package/deploy/sema-up/chart/values.yaml +16 -6
- package/deploy/sema-up/kube-up.sh +10 -4
- package/deploy/sema-up/lib/node-addrs.sh +42 -0
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +20 -1
- package/dist/audit.js +1 -0
- package/dist/boot/execution-env.js +17 -4
- package/dist/boot/leader.d.ts +2 -1
- package/dist/boot/memory-consolidation.d.ts +37 -3
- package/dist/boot/memory-consolidation.js +18 -2
- package/dist/boot/runner-deps.d.ts +2 -1
- package/dist/boot/session-faces.d.ts +2 -1
- package/dist/boot/stage-06-runners.js +5 -2
- package/dist/config-catalog.js +3 -1
- package/dist/config-types.d.ts +5 -1
- package/dist/config.js +2 -0
- package/dist/execution-lane-caps.d.ts +12 -0
- package/dist/execution-lane-caps.js +16 -2
- package/dist/fleet/subagent-tail-bus.js +15 -5
- package/dist/http/admission.js +5 -1
- package/dist/http/durable-run-leg.js +1 -3
- package/dist/http/resume-legs.js +15 -6
- package/dist/http/route-ctx.d.ts +7 -1
- package/dist/http/routes/runs.js +23 -1
- package/dist/http/routes/tasks.js +17 -8
- package/dist/http/routes/workflows.js +8 -0
- package/dist/http/server.js +1 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lsp/manager.js +1 -1
- package/dist/observability/fail-open.d.ts +16 -0
- package/dist/observability/fail-open.js +16 -0
- package/dist/observability/metrics.js +1 -1
- package/dist/observability/run-terminal.js +3 -0
- package/dist/plugins/caching-session-store.d.ts +39 -22
- package/dist/plugins/caching-session-store.js +16 -9
- package/dist/plugins/host-platform.d.ts +18 -3
- package/dist/plugins/host-platform.js +23 -10
- package/dist/plugins/k8s-exec-protocol.js +3 -0
- package/dist/plugins/one-time-migrations.d.ts +28 -4
- package/dist/plugins/one-time-migrations.js +22 -4
- package/dist/plugins/remote-env-host.d.ts +23 -6
- package/dist/plugins/remote-env-host.js +21 -12
- package/dist/plugins/remote-env-k8s.d.ts +40 -5
- package/dist/plugins/remote-env-k8s.js +119 -25
- package/dist/plugins/session-store.d.ts +4 -3
- package/dist/plugins/session-store.js +1 -1
- package/dist/plugins/store-backend.d.ts +12 -5
- package/dist/plugins/store-backend.js +12 -3
- package/dist/plugins/store-contracts.d.ts +3 -0
- package/dist/plugins/store-open-wait.js +3 -0
- package/dist/request-key-closure.d.ts +20 -7
- package/dist/request-key-closure.js +22 -6
- package/dist/run-acceptance.d.ts +51 -0
- package/dist/run-acceptance.js +27 -0
- package/dist/runs.d.ts +7 -11
- package/dist/runs.js +5 -16
- package/dist/sandbox-egress-policy.d.ts +61 -0
- package/dist/sandbox-egress-policy.js +235 -0
- package/dist/session-error-wire.d.ts +2 -2
- package/dist/session-titler.d.ts +5 -3
- package/dist/trace/core-keyset-guard.d.ts +3 -2
- package/dist/trace/ledger-events.d.ts +9 -3
- package/dist/trace/ledger-sink.d.ts +7 -0
- package/dist/trace/ledger-sink.js +14 -4
- package/dist/trace/project.d.ts +49 -8
- package/dist/trace/project.js +39 -7
- package/dist/trace/self-minted-wire.d.ts +19 -29
- package/dist/trace/self-minted-wire.js +2 -9
- package/dist/trace/tool-output-media.d.ts +26 -0
- package/dist/trace/tool-output-media.js +57 -0
- package/dist/trace/wire-projection-faces.d.ts +7 -1
- package/dist/trace/wire-projection-faces.js +2 -1
- package/package.json +3 -3
package/dist/trace/project.js
CHANGED
|
@@ -3,6 +3,7 @@ import { isAskClass, isAskOrigin, isModeReleaseReason, isPermissionMode, isPersi
|
|
|
3
3
|
import { Value } from "typebox/value";
|
|
4
4
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
5
5
|
import { redactSecrets, redactDeep } from "./redact.js";
|
|
6
|
+
import { projectToolOutput } from "./tool-output-media.js";
|
|
6
7
|
import { injectionTierOrAbsent } from "./injection-tier.js";
|
|
7
8
|
import { semaProvenanceOrAbsent } from "./sema-provenance.js";
|
|
8
9
|
import { resupplyFields, terminalFrameFacetFields } from "./task-notification-facets.js";
|
|
@@ -133,22 +134,34 @@ function modeLedgerDefect(d) {
|
|
|
133
134
|
return "disposition.released.origin is outside the closed set";
|
|
134
135
|
if (o.mandate !== undefined && !isPersistedRuleMandate(o.mandate))
|
|
135
136
|
return "disposition.released.mandate is outside the closed set";
|
|
136
|
-
if (o.reason !== undefined && !isModeReleaseReason(o.reason))
|
|
137
|
-
return "disposition.released.reason is outside the closed set";
|
|
138
137
|
return false;
|
|
139
138
|
}
|
|
139
|
+
function withReleaseReasonTheEngineReads(g) {
|
|
140
|
+
const d = g.disposition;
|
|
141
|
+
if (d.kind !== "allowed" || d.released === undefined)
|
|
142
|
+
return g;
|
|
143
|
+
const r = d.released;
|
|
144
|
+
if (r === null || typeof r !== "object")
|
|
145
|
+
return g;
|
|
146
|
+
const reason = d.released.reason;
|
|
147
|
+
if (typeof reason !== "string" || isModeReleaseReason(reason))
|
|
148
|
+
return g;
|
|
149
|
+
const { reason: _unread, ...kept } = d.released;
|
|
150
|
+
return { ...g, disposition: { ...d, released: kept } };
|
|
151
|
+
}
|
|
140
152
|
function screenedGateOrThrow(v) {
|
|
141
153
|
if (v === null || typeof v !== "object") {
|
|
142
154
|
if (v !== undefined)
|
|
143
155
|
recordFailOpen("server.trace.gate-outcome-defective", "gate is not an object");
|
|
144
156
|
return undefined;
|
|
145
157
|
}
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
if (d === null || typeof d !== "object" || (d.kind !== "allowed" && d.kind !== "denied")) {
|
|
158
|
+
const stored = v;
|
|
159
|
+
if (stored.disposition === null || typeof stored.disposition !== "object" || (stored.disposition.kind !== "allowed" && stored.disposition.kind !== "denied")) {
|
|
149
160
|
recordFailOpen("server.trace.gate-outcome-defective", "disposition is not one of the two arms");
|
|
150
161
|
return undefined;
|
|
151
162
|
}
|
|
163
|
+
const g = withReleaseReasonTheEngineReads(stored);
|
|
164
|
+
const d = g.disposition;
|
|
152
165
|
const classifierFallbackRaw = d.classifier !== null && typeof d.classifier === "object" ? d.classifier.fallback : undefined;
|
|
153
166
|
const shapeDefect = (d.kind === "denied" && typeof d.deniedBy !== "string" && "disposition.deniedBy is not a string") ||
|
|
154
167
|
(d.kind === "denied" && d.cause !== undefined && typeof d.cause !== "string" && "disposition.cause is not a string") ||
|
|
@@ -273,7 +286,7 @@ export function toolEndEventData(ev) {
|
|
|
273
286
|
toolName: ev.toolName,
|
|
274
287
|
...(ev.label !== undefined ? { label: ev.label } : {}),
|
|
275
288
|
isError: ev.isError,
|
|
276
|
-
...(ev.output !== undefined ? { output:
|
|
289
|
+
...(ev.output !== undefined ? { output: projectToolOutput(ev.output) } : {}),
|
|
277
290
|
...(ev.truncated ? { truncated: true } : {}),
|
|
278
291
|
...(Number.isFinite(ev.totalChars) ? { totalChars: ev.totalChars } : {}),
|
|
279
292
|
...(ev.structured !== undefined ? { structured: redactDeep(ev.structured) } : {}),
|
|
@@ -297,7 +310,7 @@ export function toolProgressEventData(ev) {
|
|
|
297
310
|
toolCallId: id,
|
|
298
311
|
toolName: name,
|
|
299
312
|
...(n(ev.elapsedTimeSeconds) !== undefined ? { elapsedTimeSeconds: n(ev.elapsedTimeSeconds) } : {}),
|
|
300
|
-
...(hasOutput ? { output:
|
|
313
|
+
...(hasOutput ? { output: projectToolOutput(ev.output) } : {}),
|
|
301
314
|
...(hasOutput && n(ev.totalLines) !== undefined ? { totalLines: n(ev.totalLines) } : {}),
|
|
302
315
|
...(hasOutput && n(ev.totalBytes) !== undefined ? { totalBytes: n(ev.totalBytes) } : {}),
|
|
303
316
|
...identityFields(ev),
|
|
@@ -336,6 +349,25 @@ export function taskProgressEventData(ev) {
|
|
|
336
349
|
...identityFields(ev),
|
|
337
350
|
};
|
|
338
351
|
}
|
|
352
|
+
export function taskStartedEventData(ev) {
|
|
353
|
+
return {
|
|
354
|
+
taskId: ev.taskId,
|
|
355
|
+
sessionId: ev.sessionId,
|
|
356
|
+
...(typeof ev.taskType === "string" && ev.taskType.length > 0 ? { taskType: ev.taskType } : {}),
|
|
357
|
+
...(typeof ev.seq === "number" ? { seq: ev.seq } : {}),
|
|
358
|
+
...(ev.workflowRunId ? { workflowRunId: ev.workflowRunId } : {}),
|
|
359
|
+
...(ev.workflowAgentLabel ? { workflowAgentLabel: redactSecrets(ev.workflowAgentLabel) } : {}),
|
|
360
|
+
...(ev.parentTaskId ? { parentTaskId: ev.parentTaskId } : {}),
|
|
361
|
+
...(ev.parentSessionId ? { parentSessionId: ev.parentSessionId } : {}),
|
|
362
|
+
...(ev.rootSessionId ? { rootSessionId: ev.rootSessionId } : {}),
|
|
363
|
+
...(ev.name ? { name: redactSecrets(ev.name) } : {}),
|
|
364
|
+
...(ev.spawnName ? { spawnName: ev.spawnName } : {}),
|
|
365
|
+
...(ev.agentType ? { agentType: ev.agentType } : {}),
|
|
366
|
+
model: ev.model,
|
|
367
|
+
...(typeof ev.startedAt === "number" && Number.isFinite(ev.startedAt) ? { startedAt: ev.startedAt } : {}),
|
|
368
|
+
...identityFields(ev),
|
|
369
|
+
};
|
|
370
|
+
}
|
|
339
371
|
export function taskNotificationEventData(ev) {
|
|
340
372
|
const n = ev.notification;
|
|
341
373
|
return {
|
|
@@ -418,13 +418,6 @@ export declare const SELF_MINTED_WIRE: {
|
|
|
418
418
|
since: string;
|
|
419
419
|
};
|
|
420
420
|
};
|
|
421
|
-
readonly retired: {
|
|
422
|
-
readonly discuss: {
|
|
423
|
-
readonly attr: "-";
|
|
424
|
-
readonly since: "7.28.0";
|
|
425
|
-
readonly until: "7.126.0";
|
|
426
|
-
};
|
|
427
|
-
};
|
|
428
421
|
};
|
|
429
422
|
/**
|
|
430
423
|
* 提交体的场景透传键(受理门放行;`ScenarioRequest` 索引签名读)。7.126.0 只喂 discuss 场景与 code-review council 腿的四键退出 wire
|
|
@@ -438,28 +431,6 @@ export declare const SELF_MINTED_WIRE: {
|
|
|
438
431
|
since: string;
|
|
439
432
|
};
|
|
440
433
|
};
|
|
441
|
-
readonly retired: {
|
|
442
|
-
readonly businessContext: {
|
|
443
|
-
readonly attr: "-";
|
|
444
|
-
readonly since: "1.214.2";
|
|
445
|
-
readonly until: "7.126.0";
|
|
446
|
-
};
|
|
447
|
-
readonly lenses: {
|
|
448
|
-
readonly attr: "-";
|
|
449
|
-
readonly since: "1.214.2";
|
|
450
|
-
readonly until: "7.126.0";
|
|
451
|
-
};
|
|
452
|
-
readonly rounds: {
|
|
453
|
-
readonly attr: "-";
|
|
454
|
-
readonly since: "1.214.2";
|
|
455
|
-
readonly until: "7.126.0";
|
|
456
|
-
};
|
|
457
|
-
readonly team: {
|
|
458
|
-
readonly attr: "-";
|
|
459
|
-
readonly since: "1.214.2";
|
|
460
|
-
readonly until: "7.126.0";
|
|
461
|
-
};
|
|
462
|
-
};
|
|
463
434
|
};
|
|
464
435
|
/**
|
|
465
436
|
* `GET /v1/models` 应答体的顶层键(闭集;`src/http/routes/capabilities.ts` 的 `sendJson(res, 200, {…})` 字面量)。属性 = 在场律:`always` 恒在场(零条也出键),`present-iff` 条件成立才出键
|
|
@@ -519,6 +490,25 @@ export declare const SELF_MINTED_WIRE: {
|
|
|
519
490
|
readonly attr: "redactListEntry";
|
|
520
491
|
readonly since: "7.120.0";
|
|
521
492
|
};
|
|
493
|
+
/**
|
|
494
|
+
* 7.127.0(引擎 7.50.0:`tool_end.output` 按块带已准入的图像 / 文档):媒体块(image / document 且 `data` 是串)的 `data` 是字节编码 ——
|
|
495
|
+
* 活面 SSE 逐字过境,不跑文本脱敏(`trace/tool-output-media.ts` `projectToolOutput`;钉 test/tool-end-media-durable.test.ts);
|
|
496
|
+
* 唯一例外 = 连接积压:本帧媒体 + 这条连接 / 订阅者未送出的字节 > 64 MiB ⇒ 本帧媒体降描述符(`liveToolEndForBacklog`;钉 test/live-media-backlog.test.ts)。
|
|
497
|
+
*/
|
|
498
|
+
readonly "SSE tool_end#output[].data(\u5A92\u4F53\u5757)": {
|
|
499
|
+
readonly attr: "verbatim-bytes;backlog>64MiB⇒descriptor+totalChars";
|
|
500
|
+
readonly since: "7.127.0";
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* 7.127.0:同一媒体块在**持久面**(账本行与 `GET /v1/runs/:id/events` 回放)只存描述符 `{ type, mimeType?, bytes, truncated: true }`,
|
|
504
|
+
* 帧级 `truncated` 随之为真、帧级 `totalChars` 随之在场(core 不变量「Present iff truncated」:帧上已有 core 的值 ⇒ 原样保留,
|
|
505
|
+
* 没有 ⇒ 逐块真实大小求和;活面积压降级同一只函数)(账本汇点一处剥:`observability/run-terminal.ts` `redactLedgerEventData` →
|
|
506
|
+
* `toolEndMediaAsDescriptors`;钉同上)。
|
|
507
|
+
*/
|
|
508
|
+
readonly "GET /v1/runs/:id/events#tool_end.output[](\u5A92\u4F53\u5757)": {
|
|
509
|
+
readonly attr: "durableMediaDescriptor+totalChars";
|
|
510
|
+
readonly since: "7.127.0";
|
|
511
|
+
};
|
|
522
512
|
};
|
|
523
513
|
};
|
|
524
514
|
};
|
|
@@ -145,21 +145,12 @@ export const SELF_MINTED_WIRE = {
|
|
|
145
145
|
"code-review": { attr: "-", since: "1.214.2" },
|
|
146
146
|
scan: { attr: "-", since: "1.214.2" },
|
|
147
147
|
},
|
|
148
|
-
retired: {
|
|
149
|
-
discuss: { attr: "-", since: "7.28.0", until: "7.126.0" },
|
|
150
|
-
},
|
|
151
148
|
},
|
|
152
149
|
scenarioBodyKey: {
|
|
153
150
|
at: "POST /v1/tasks|/v1/tasks/stream|/v1/runs 体的场景透传键",
|
|
154
151
|
members: {
|
|
155
152
|
repo: { attr: "-", since: "1.214.2" },
|
|
156
153
|
},
|
|
157
|
-
retired: {
|
|
158
|
-
businessContext: { attr: "-", since: "1.214.2", until: "7.126.0" },
|
|
159
|
-
lenses: { attr: "-", since: "1.214.2", until: "7.126.0" },
|
|
160
|
-
rounds: { attr: "-", since: "1.214.2", until: "7.126.0" },
|
|
161
|
-
team: { attr: "-", since: "1.214.2", until: "7.126.0" },
|
|
162
|
-
},
|
|
163
154
|
},
|
|
164
155
|
modelsResponseKey: {
|
|
165
156
|
at: "GET /v1/models 应答体顶层键(<键> → 在场律)",
|
|
@@ -178,6 +169,8 @@ export const SELF_MINTED_WIRE = {
|
|
|
178
169
|
"POST /v1/side-query#errorMessage": { attr: "redactErrorMessage", since: "7.108.0" },
|
|
179
170
|
"engine_notice permission.allowed_tool_not_granted#detail.entries[].entry": { attr: "redactListEntry", since: "7.120.0" },
|
|
180
171
|
"engine_notice permission.rule_row_dropped#detail.rows[].rule": { attr: "redactListEntry", since: "7.120.0" },
|
|
172
|
+
"SSE tool_end#output[].data(媒体块)": { attr: "verbatim-bytes;backlog>64MiB⇒descriptor+totalChars", since: "7.127.0" },
|
|
173
|
+
"GET /v1/runs/:id/events#tool_end.output[](媒体块)": { attr: "durableMediaDescriptor+totalChars", since: "7.127.0" },
|
|
181
174
|
},
|
|
182
175
|
},
|
|
183
176
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 两面共用的 `output` 投影:串 / 文本块 / 其它块整只过 `redactDeep`;媒体块逐成员过,`data` 逐字。
|
|
3
|
+
* 保键序(逐键映射),不改入参。
|
|
4
|
+
*/
|
|
5
|
+
export declare function projectToolOutput(output: unknown): unknown;
|
|
6
|
+
/**
|
|
7
|
+
* `tool_end` 载荷的媒体降级(持久面恒用;活面只在连接积压时用):带 `data` 的媒体块换成描述符,有任何一块被换 ⇒ 帧级 `truncated: true`
|
|
8
|
+
* 且帧级 `totalChars` 在场 —— core 不变量「Present iff truncated」:被界之前那个值的真实大小。帧上已有 `totalChars`(core 已截断:
|
|
9
|
+
* 文本被切而媒体留着)⇒ **原样保留**(它说的是更早的原值,本仓手里的已是切过的值,重算只会低报);没有 ⇒ 按 {@link trueSizeOf}
|
|
10
|
+
* 逐块求和(core 没截,`output` 就是原值 —— 文本块是本服务脱敏后的字节,即本服务交付的内容)。
|
|
11
|
+
* 没有媒体块 ⇒ 原样返回同一引用(纯文本 / 串形 output 一个字节不变);已是描述符的块(无 `data`)原样 ⇒ 幂等。
|
|
12
|
+
*/
|
|
13
|
+
export declare function toolEndMediaAsDescriptors(data: Record<string, unknown>): Record<string, unknown>;
|
|
14
|
+
/** 活面一条连接允许压住的待发字节上界(含本帧媒体)。一帧媒体最大约为部署媒体预算的 4/3(缺省约 40 MiB),
|
|
15
|
+
* 上界取它之上一点:空闲连接上一整帧最大的图照样整块过,第二帧起只在读者跟上之后才整块。 */
|
|
16
|
+
export declare const LIVE_MEDIA_BACKLOG_BYTES: number;
|
|
17
|
+
/** 一帧 `tool_end` 载荷里媒体块 `data` 的字节数(base64 串长;没有媒体 = 0)。 */
|
|
18
|
+
export declare function liveMediaBytesOf(frame: Record<string, unknown>): number;
|
|
19
|
+
/**
|
|
20
|
+
* 活面的积压判据(一只):`backlogBytes` = 这条连接 / 这个订阅者此刻还没送出去的字节。本帧媒体 + 积压 > 上界 ⇒ 媒体降描述符,
|
|
21
|
+
* 否则原样(同一引用)。非 `tool_end` 载荷由调用方不送进来;没有媒体的 `tool_end` 恒原样。
|
|
22
|
+
* 降级是 F 类兜底(观众少见一张图),每降一帧在**这里**记一次 `server.tool-end-media.live-backlog-degraded` —— 三处写口都经这一只函数,
|
|
23
|
+
* 留痕因此只有一处;帧上它与引擎的媒体预算降级同形,计数是运维看出「多少观众丢了图」的唯一位。
|
|
24
|
+
*/
|
|
25
|
+
export declare function liveToolEndForBacklog(frame: Record<string, unknown>, backlogBytes: number): Record<string, unknown>;
|
|
26
|
+
//# sourceMappingURL=tool-output-media.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { redactDeep } from "./redact.js";
|
|
2
|
+
import { recordFailOpen } from "../observability/fail-open.js";
|
|
3
|
+
function isMediaBlock(b) {
|
|
4
|
+
if (b === null || typeof b !== "object" || Array.isArray(b))
|
|
5
|
+
return false;
|
|
6
|
+
const block = b;
|
|
7
|
+
return (block.type === "image" || block.type === "document") && typeof block.data === "string";
|
|
8
|
+
}
|
|
9
|
+
const MIME_ECHO_MAX = 255;
|
|
10
|
+
export function projectToolOutput(output) {
|
|
11
|
+
if (!Array.isArray(output))
|
|
12
|
+
return redactDeep(output);
|
|
13
|
+
return output.map((b) => (isMediaBlock(b) ? Object.fromEntries(Object.entries(b).map(([k, v]) => [k, k === "data" ? v : redactDeep(v)])) : redactDeep(b)));
|
|
14
|
+
}
|
|
15
|
+
function trueSizeOf(b) {
|
|
16
|
+
if (isMediaBlock(b))
|
|
17
|
+
return b.data.length;
|
|
18
|
+
if (b !== null && typeof b === "object" && !Array.isArray(b) && b.type === "text" && typeof b.text === "string") {
|
|
19
|
+
const { type: _type, text, ...rest } = b;
|
|
20
|
+
return text.length + Math.max(0, (JSON.stringify(rest)?.length ?? 2) - 2);
|
|
21
|
+
}
|
|
22
|
+
return JSON.stringify(b)?.length ?? 0;
|
|
23
|
+
}
|
|
24
|
+
export function toolEndMediaAsDescriptors(data) {
|
|
25
|
+
const output = data.output;
|
|
26
|
+
if (!Array.isArray(output) || !output.some(isMediaBlock))
|
|
27
|
+
return data;
|
|
28
|
+
const totalChars = typeof data.totalChars === "number" && Number.isFinite(data.totalChars) ? data.totalChars : output.reduce((n, b) => n + trueSizeOf(b), 0);
|
|
29
|
+
const stripped = output.map((b) => isMediaBlock(b)
|
|
30
|
+
? {
|
|
31
|
+
type: b.type,
|
|
32
|
+
...(typeof b.mimeType === "string" && b.mimeType.length <= MIME_ECHO_MAX ? { mimeType: b.mimeType } : {}),
|
|
33
|
+
bytes: Math.floor((b.data.length * 3) / 4),
|
|
34
|
+
truncated: true,
|
|
35
|
+
}
|
|
36
|
+
: b);
|
|
37
|
+
return { ...data, output: stripped, truncated: true, totalChars };
|
|
38
|
+
}
|
|
39
|
+
export const LIVE_MEDIA_BACKLOG_BYTES = 64 * 1024 * 1024;
|
|
40
|
+
export function liveMediaBytesOf(frame) {
|
|
41
|
+
const output = frame.output;
|
|
42
|
+
if (!Array.isArray(output))
|
|
43
|
+
return 0;
|
|
44
|
+
let n = 0;
|
|
45
|
+
for (const b of output)
|
|
46
|
+
if (isMediaBlock(b))
|
|
47
|
+
n += b.data.length;
|
|
48
|
+
return n;
|
|
49
|
+
}
|
|
50
|
+
export function liveToolEndForBacklog(frame, backlogBytes) {
|
|
51
|
+
const media = liveMediaBytesOf(frame);
|
|
52
|
+
if (media === 0 || backlogBytes + media <= LIVE_MEDIA_BACKLOG_BYTES)
|
|
53
|
+
return frame;
|
|
54
|
+
recordFailOpen("server.tool-end-media.live-backlog-degraded", `backlog=${backlogBytes} media=${media}`);
|
|
55
|
+
return toolEndMediaAsDescriptors(frame);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=tool-output-media.js.map
|
|
@@ -74,6 +74,12 @@ export declare const WIRE_PROJECTION_FACES: {
|
|
|
74
74
|
readonly excluded: readonly [];
|
|
75
75
|
readonly minted: readonly [];
|
|
76
76
|
};
|
|
77
|
+
readonly task_started: {
|
|
78
|
+
readonly projector: "taskStartedEventData";
|
|
79
|
+
readonly coreType: string;
|
|
80
|
+
readonly excluded: readonly [];
|
|
81
|
+
readonly minted: readonly [];
|
|
82
|
+
};
|
|
77
83
|
readonly tool_start: {
|
|
78
84
|
readonly projector: "toolStartEventData";
|
|
79
85
|
readonly coreType: string;
|
|
@@ -155,7 +161,7 @@ export declare const WIRE_PROJECTION_FACES: {
|
|
|
155
161
|
readonly human_input: {
|
|
156
162
|
readonly projector: "humanInputEventData";
|
|
157
163
|
readonly coreType: string;
|
|
158
|
-
readonly excluded: readonly ["principal"];
|
|
164
|
+
readonly excluded: readonly ["principal", "attachments"];
|
|
159
165
|
readonly minted: readonly [];
|
|
160
166
|
};
|
|
161
167
|
readonly task_notification: {
|
|
@@ -16,6 +16,7 @@ function withoutSections(all, drop) {
|
|
|
16
16
|
}
|
|
17
17
|
export const WIRE_PROJECTION_FACES = {
|
|
18
18
|
task_progress: { projector: "taskProgressEventData", coreType: arm("task_progress"), excluded: [], minted: [] },
|
|
19
|
+
task_started: { projector: "taskStartedEventData", coreType: arm("task_started"), excluded: [], minted: [] },
|
|
19
20
|
tool_start: { projector: "toolStartEventData", coreType: arm("tool_start"), excluded: [], minted: [] },
|
|
20
21
|
tool_end: { projector: "toolEndEventData", coreType: arm("tool_end"), excluded: [], minted: [] },
|
|
21
22
|
tool_progress: { projector: "toolProgressEventData", coreType: arm("tool_progress"), excluded: [], minted: [] },
|
|
@@ -29,7 +30,7 @@ export const WIRE_PROJECTION_FACES = {
|
|
|
29
30
|
context_usage: { projector: "contextUsageEventData", coreType: arm("context_usage"), excluded: [], minted: [] },
|
|
30
31
|
turn_end: { projector: "turnEndEventData", coreType: arm("turn_end"), excluded: [], minted: [] },
|
|
31
32
|
compaction_outcome: { projector: "compactionOutcomeEventData", coreType: arm("compaction_outcome"), excluded: [], minted: [] },
|
|
32
|
-
human_input: { projector: "humanInputEventData", coreType: arm("human_input"), excluded: ["principal"], minted: [] },
|
|
33
|
+
human_input: { projector: "humanInputEventData", coreType: arm("human_input"), excluded: ["principal", "attachments"], minted: [] },
|
|
33
34
|
task_notification: {
|
|
34
35
|
projector: "taskNotificationEventData",
|
|
35
36
|
coreType: `TaskNotificationPayload & ${arm("task_notification")}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.127.1",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@sema-agent/core": "7.
|
|
67
|
+
"@sema-agent/core": "7.50.2",
|
|
68
68
|
"@sema-agent/settings-schema": "12.2.1",
|
|
69
69
|
"e2b": "^2.28.0",
|
|
70
70
|
"libsodium-wrappers": "^0.8.4",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"sharp": "^0.35.3"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@sema-agent/sdk": "21.
|
|
83
|
+
"@sema-agent/sdk": "21.1.0",
|
|
84
84
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
85
85
|
"@types/node": "22.10.2",
|
|
86
86
|
"@types/pg": "^8.20.0",
|