@sema-agent/cli 1.0.66 → 1.0.67
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/npm-shrinkwrap.json +26 -26
- package/package.json +5 -5
- package/sema-main.js +945 -665
- package/sema.js +1 -1
package/sema-main.js
CHANGED
|
@@ -69214,6 +69214,64 @@ var init_patch = __esm({
|
|
|
69214
69214
|
}
|
|
69215
69215
|
});
|
|
69216
69216
|
|
|
69217
|
+
// node_modules/@sema-agent/client-core/dist/engineErrorCodes.js
|
|
69218
|
+
function isConfigRefusalCode(code2) {
|
|
69219
|
+
return typeof code2 === "string" && code2.startsWith("config.");
|
|
69220
|
+
}
|
|
69221
|
+
function isInterruptedToolEndCode(code2) {
|
|
69222
|
+
return typeof code2 === "string" && TOOL_END_INTERRUPTED_CODES.has(code2);
|
|
69223
|
+
}
|
|
69224
|
+
function isRewindFamilyCode(code2) {
|
|
69225
|
+
return typeof code2 === "string" && REWIND_ERROR_CODE_PREFIXES.some((p) => code2.startsWith(p));
|
|
69226
|
+
}
|
|
69227
|
+
function asModelFallbackReason(v2) {
|
|
69228
|
+
return v2 === MODEL_FALLBACK_INHERIT_NO_TIER_BINDING ? MODEL_FALLBACK_INHERIT_NO_TIER_BINDING : void 0;
|
|
69229
|
+
}
|
|
69230
|
+
var LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, USAGE_WINDOW_EXHAUSTED, ENV_LIFETIME_EXPIRED, CONFIG_LIMIT_INVALID, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_REFUSAL_CODES, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, TOOL_END_INTERRUPTED_CODES, ACTIVE_RUN_BUSY_ERROR_CODE, STOP_PARK_ARBITER_UNREACHABLE, STOP_PARK_RESUME_WON, STOP_NOT_LANDED, STOP_NOT_LOCAL, STOP_PARKED, STOP_CONFLICT_CODES, OUTPUT_INVALID, REWIND_ERROR_CODE_PREFIXES, STREAM_MAX_DURATION, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING;
|
|
69231
|
+
var init_engineErrorCodes = __esm({
|
|
69232
|
+
"node_modules/@sema-agent/client-core/dist/engineErrorCodes.js"() {
|
|
69233
|
+
LIMITS_MAX_TOKENS_EXCEEDED = "limits.max_tokens_exceeded";
|
|
69234
|
+
LIMITS_MAX_COST_EXCEEDED = "limits.max_cost_exceeded";
|
|
69235
|
+
LIMITS_MAX_TURNS_EXCEEDED = "limits.max_turns_exceeded";
|
|
69236
|
+
LIMITS_MAX_WALLTIME_EXCEEDED = "limits.max_walltime_exceeded";
|
|
69237
|
+
USAGE_WINDOW_EXHAUSTED = "usage.window_exhausted";
|
|
69238
|
+
ENV_LIFETIME_EXPIRED = "env.lifetime_expired";
|
|
69239
|
+
CONFIG_LIMIT_INVALID = "config.limit_invalid";
|
|
69240
|
+
CONFIG_STRATEGY_FIND_LIMIT_INVALID = "config.strategy_find_limit_invalid";
|
|
69241
|
+
CONFIG_STRATEGY_MAX_SIZE_INVALID = "config.strategy_max_size_invalid";
|
|
69242
|
+
CONFIG_LIMIT_UNKNOWN_KEY = "config.limit_unknown_key";
|
|
69243
|
+
CONFIG_REFUSAL_CODES = /* @__PURE__ */ new Set([
|
|
69244
|
+
CONFIG_LIMIT_INVALID,
|
|
69245
|
+
CONFIG_STRATEGY_FIND_LIMIT_INVALID,
|
|
69246
|
+
CONFIG_STRATEGY_MAX_SIZE_INVALID,
|
|
69247
|
+
CONFIG_LIMIT_UNKNOWN_KEY
|
|
69248
|
+
]);
|
|
69249
|
+
TOOL_END_INTERRUPTED_NEVER_STARTED = "interrupted_never_started";
|
|
69250
|
+
TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN = "interrupted_outcome_unknown";
|
|
69251
|
+
TOOL_END_INTERRUPTED_CODES = /* @__PURE__ */ new Set([
|
|
69252
|
+
TOOL_END_INTERRUPTED_NEVER_STARTED,
|
|
69253
|
+
TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN
|
|
69254
|
+
]);
|
|
69255
|
+
ACTIVE_RUN_BUSY_ERROR_CODE = "conflict.session_active_run";
|
|
69256
|
+
STOP_PARK_ARBITER_UNREACHABLE = "stop.park_arbiter_unreachable";
|
|
69257
|
+
STOP_PARK_RESUME_WON = "stop.park_resume_won";
|
|
69258
|
+
STOP_NOT_LANDED = "stop.not_landed";
|
|
69259
|
+
STOP_NOT_LOCAL = "stop.not_local";
|
|
69260
|
+
STOP_PARKED = "stop.parked";
|
|
69261
|
+
STOP_CONFLICT_CODES = [
|
|
69262
|
+
STOP_PARK_ARBITER_UNREACHABLE,
|
|
69263
|
+
STOP_PARK_RESUME_WON,
|
|
69264
|
+
STOP_NOT_LANDED,
|
|
69265
|
+
STOP_NOT_LOCAL,
|
|
69266
|
+
STOP_PARKED
|
|
69267
|
+
];
|
|
69268
|
+
OUTPUT_INVALID = "output.invalid";
|
|
69269
|
+
REWIND_ERROR_CODE_PREFIXES = ["resume_at.", "rewind_snapshot."];
|
|
69270
|
+
STREAM_MAX_DURATION = "STREAM_MAX_DURATION";
|
|
69271
|
+
MODEL_FALLBACK_INHERIT_NO_TIER_BINDING = "inherit_no_tier_binding";
|
|
69272
|
+
}
|
|
69273
|
+
});
|
|
69274
|
+
|
|
69217
69275
|
// node_modules/@sema-agent/client-core/dist/toolResult.js
|
|
69218
69276
|
function structuredDetailType(structured) {
|
|
69219
69277
|
if (typeof structured !== "object" || structured === null)
|
|
@@ -69752,15 +69810,54 @@ function reportFindingsToolUseResult(structured, rawInput) {
|
|
|
69752
69810
|
}
|
|
69753
69811
|
};
|
|
69754
69812
|
}
|
|
69813
|
+
function readCompletedAgentCard(structured) {
|
|
69814
|
+
if (structured === null || typeof structured !== "object")
|
|
69815
|
+
return null;
|
|
69816
|
+
const s = structured;
|
|
69817
|
+
if (s.type !== "agent")
|
|
69818
|
+
return null;
|
|
69819
|
+
const status3 = s.status;
|
|
69820
|
+
if (typeof status3 !== "string" || status3.length === 0 || status3 === "async_launched")
|
|
69821
|
+
return null;
|
|
69822
|
+
const taskId = s.taskId;
|
|
69823
|
+
if (typeof taskId !== "string" || taskId.length === 0)
|
|
69824
|
+
return null;
|
|
69825
|
+
const str3 = (v2) => typeof v2 === "string" && v2.length > 0 ? v2 : void 0;
|
|
69826
|
+
const num = (v2) => typeof v2 === "number" && Number.isFinite(v2) ? v2 : void 0;
|
|
69827
|
+
return {
|
|
69828
|
+
status: status3,
|
|
69829
|
+
taskId,
|
|
69830
|
+
...str3(s.sessionId) !== void 0 ? { sessionId: str3(s.sessionId) } : {},
|
|
69831
|
+
...str3(s.subagent_type) !== void 0 ? { subagentType: str3(s.subagent_type) } : {},
|
|
69832
|
+
// `result` 允许空串(子代没产出正文是一个诚实的事实),故这里不用 `str` 的非空过滤。
|
|
69833
|
+
...typeof s.result === "string" ? { result: s.result } : {},
|
|
69834
|
+
...typeof s.salvagedOutput === "string" ? { salvagedOutput: s.salvagedOutput } : {},
|
|
69835
|
+
...s.structuredOutput !== void 0 ? { structuredOutput: s.structuredOutput } : {},
|
|
69836
|
+
...str3(s.blockedReason) !== void 0 ? { blockedReason: str3(s.blockedReason) } : {},
|
|
69837
|
+
...str3(s.errorMessage) !== void 0 ? { errorMessage: str3(s.errorMessage) } : {},
|
|
69838
|
+
...str3(s.errorCode) !== void 0 ? { errorCode: str3(s.errorCode) } : {},
|
|
69839
|
+
...num(s.retryAfterMs) !== void 0 ? { retryAfterMs: num(s.retryAfterMs) } : {},
|
|
69840
|
+
// 对象守卫(与 terminalToSdkResult.degradedOf 同姿势):非对象/null 一律当缺席,不硬塞。
|
|
69841
|
+
...typeof s.degraded === "object" && s.degraded !== null ? { degraded: s.degraded } : {},
|
|
69842
|
+
...str3(s.error_kind) !== void 0 ? { errorKind: str3(s.error_kind) } : {},
|
|
69843
|
+
...typeof s.retryable === "boolean" ? { retryable: s.retryable } : {},
|
|
69844
|
+
...typeof s.stats === "object" && s.stats !== null ? { stats: s.stats } : {},
|
|
69845
|
+
...str3(s.model) !== void 0 ? { model: str3(s.model) } : {},
|
|
69846
|
+
...str3(s.resolvedModel) !== void 0 ? { resolvedModel: str3(s.resolvedModel) } : {},
|
|
69847
|
+
...asModelFallbackReason(s.modelFallback) !== void 0 ? { modelFallback: asModelFallbackReason(s.modelFallback) } : {},
|
|
69848
|
+
...str3(s.worktreePath) !== void 0 ? { worktreePath: str3(s.worktreePath) } : {},
|
|
69849
|
+
...s.toolStats !== void 0 ? { toolStats: s.toolStats } : {}
|
|
69850
|
+
};
|
|
69851
|
+
}
|
|
69755
69852
|
var STRUCTURED_DETAIL_TYPES, MAX_STRUCTURED_FIELD_CHARS, WF_TERMINAL_STATUSES, PROTOCOL_MARKERS, modelFacingParseCount, THREE_GEN_BG_RECEIPT_RE, backgroundReceiptParseCount, TOOL_RESULT_DEGRADED_WIRE_NO_OUTPUT;
|
|
69756
69853
|
var init_toolResult = __esm({
|
|
69757
69854
|
"node_modules/@sema-agent/client-core/dist/toolResult.js"() {
|
|
69758
69855
|
init_patch();
|
|
69759
69856
|
init_notifications();
|
|
69760
69857
|
init_workflow();
|
|
69858
|
+
init_engineErrorCodes();
|
|
69761
69859
|
STRUCTURED_DETAIL_TYPES = /* @__PURE__ */ new Set([
|
|
69762
69860
|
"edit",
|
|
69763
|
-
"multiedit",
|
|
69764
69861
|
"create",
|
|
69765
69862
|
"update",
|
|
69766
69863
|
"bash",
|
|
@@ -69778,7 +69875,6 @@ var init_toolResult = __esm({
|
|
|
69778
69875
|
"task",
|
|
69779
69876
|
"task-list",
|
|
69780
69877
|
"task-output",
|
|
69781
|
-
"memory-saved",
|
|
69782
69878
|
"workflow-run",
|
|
69783
69879
|
"web-fetch",
|
|
69784
69880
|
"web-search",
|
|
@@ -69789,7 +69885,6 @@ var init_toolResult = __esm({
|
|
|
69789
69885
|
"image",
|
|
69790
69886
|
"task-stop",
|
|
69791
69887
|
"tool-search",
|
|
69792
|
-
"memory-recall",
|
|
69793
69888
|
"repo-map",
|
|
69794
69889
|
"fork",
|
|
69795
69890
|
"enter-plan-mode",
|
|
@@ -69800,7 +69895,22 @@ var init_toolResult = __esm({
|
|
|
69800
69895
|
"file_unchanged",
|
|
69801
69896
|
"worktree",
|
|
69802
69897
|
"monitor-start",
|
|
69803
|
-
"path_not_in_root"
|
|
69898
|
+
"path_not_in_root",
|
|
69899
|
+
// ── core 5.10.0 词表换代(2026-08-04 提货批;engine-vocab 等值门对 5.10.0 实装物直证)──────
|
|
69900
|
+
// 5.10.0 的 structured-card 审计把这张表变成**双向契约**(每个铸点都登记 / 每个登记词都真被产出)。
|
|
69901
|
+
// 新登记 7 词 —— 它们的工具**一直**在铸卡,漏的只是登记,于是这 7 类卡从来没上过 wire:
|
|
69902
|
+
// · `report-findings` 最坏(ReportFindings 的模型面被**故意**压成「N findings reported.」,
|
|
69903
|
+
// 卡又丢了 ⇒ findings 模型看不到、宿主也看不到,两头落空);
|
|
69904
|
+
// · `readonly_out_of_root` 与既有 `path_not_in_root` 是同一份「按字段数拒绝次数」契约的两半
|
|
69905
|
+
// (一个在 shell 面、一个在 fs 面);
|
|
69906
|
+
// · `schedule-wakeup` / `send-message` / `agent-transcript` / `a2a` / `document` 同理。
|
|
69907
|
+
"readonly_out_of_root",
|
|
69908
|
+
"report-findings",
|
|
69909
|
+
"schedule-wakeup",
|
|
69910
|
+
"send-message",
|
|
69911
|
+
"agent-transcript",
|
|
69912
|
+
"a2a",
|
|
69913
|
+
"document"
|
|
69804
69914
|
]);
|
|
69805
69915
|
MAX_STRUCTURED_FIELD_CHARS = 1e6;
|
|
69806
69916
|
WF_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -73326,18 +73436,27 @@ function streamEventArm2(ctx, event) {
|
|
|
73326
73436
|
function assertNeverArm(_ev) {
|
|
73327
73437
|
}
|
|
73328
73438
|
function eventToSdkMessage(ev, ctx) {
|
|
73329
|
-
const raw2 = ev;
|
|
73330
|
-
if (raw2.type === "workflow_complete") {
|
|
73331
|
-
if (typeof raw2.runId !== "string")
|
|
73332
|
-
return dropped("malformed", "workflow_complete");
|
|
73333
|
-
return projected(stamp(ctx, armBody({
|
|
73334
|
-
type: "workflow_complete",
|
|
73335
|
-
runId: raw2.runId,
|
|
73336
|
-
status: raw2.status === "failed" ? "failed" : "completed",
|
|
73337
|
-
summary: typeof raw2.summary === "string" ? raw2.summary : ""
|
|
73338
|
-
})));
|
|
73339
|
-
}
|
|
73340
73439
|
switch (ev.type) {
|
|
73440
|
+
// service 1.75 — `workflow_complete`: an out-of-band background-workflow completion push, ridden onto
|
|
73441
|
+
// the session's next stream open (BEFORE the run's own events). Projects to a NEUTRAL internal arm;
|
|
73442
|
+
// the upstream bridge turns it into CC's `<task-notification>` injection.
|
|
73443
|
+
// 🔴 **到期复核已兑现(sdk 6.2.0 提货批,2026-08-04)**:本臂此前是 switch 之前的**唯一** raw
|
|
73444
|
+
// 预分派臂,理由写着「`workflow_complete` 至今不在 union 里……入 union 当天搬进 switch」。
|
|
73445
|
+
// sdk 6.2.0 的 TR-7 批把它连同 question/elicitation 族一并加进了 `AgentEvent` union
|
|
73446
|
+
// (判据 = `dist/events.d.ts` 出现 `type: "workflow_complete"`),故按原定计划搬进来 ——
|
|
73447
|
+
// raw 预分派臂与 `raw` 变量一并退役,本函数从此**每一条臂都受 B5 编译期穷举保护**。
|
|
73448
|
+
// 语义不变:至少一次投递(两条腿同开可能双发),消费方按 `runId` 去重(notifications 台账干这件事)。
|
|
73449
|
+
case "workflow_complete": {
|
|
73450
|
+
if (typeof ev.runId !== "string" || ev.runId.length === 0) {
|
|
73451
|
+
return dropped("malformed", "workflow_complete");
|
|
73452
|
+
}
|
|
73453
|
+
return projected(stamp(ctx, armBody({
|
|
73454
|
+
type: "workflow_complete",
|
|
73455
|
+
runId: ev.runId,
|
|
73456
|
+
status: ev.status === "failed" ? "failed" : "completed",
|
|
73457
|
+
summary: typeof ev.summary === "string" ? ev.summary : ""
|
|
73458
|
+
})));
|
|
73459
|
+
}
|
|
73341
73460
|
// CS-1 §2.2 — turn-aggregated answer text (durable). Drop raw block array.
|
|
73342
73461
|
case "text":
|
|
73343
73462
|
return projected(assistantArm2(ctx, [{ type: "text", text: ev.text }]));
|
|
@@ -73397,11 +73516,13 @@ function eventToSdkMessage(ev, ctx) {
|
|
|
73397
73516
|
// a side-channel arm `sdkMessagesToCcEvents` reads; CC's own renderer never sees it.
|
|
73398
73517
|
case "tool_end": {
|
|
73399
73518
|
const structured = ev.structured;
|
|
73519
|
+
const toolEndErrorCode = ev.errorCode;
|
|
73400
73520
|
return projected(stamp(ctx, armBody({
|
|
73401
73521
|
type: "tool_end_result",
|
|
73402
73522
|
toolCallId: ev.toolCallId,
|
|
73403
73523
|
toolName: ev.toolName,
|
|
73404
73524
|
isError: ev.isError,
|
|
73525
|
+
...typeof toolEndErrorCode === "string" && toolEndErrorCode.length > 0 ? { errorCode: toolEndErrorCode } : {},
|
|
73405
73526
|
// P0-2([1725] 清单A)— `tool_end.label` 同 tool_start 待遇(server trace/project.js:61 白名单
|
|
73406
73527
|
// 本体产出)。此臂是壳内部侧信道(不进 transcript),所以这里带着无 provider 风险;
|
|
73407
73528
|
// tool_start 先到时 bridge 已登记过,这条是补位(只有 tool_end 带 label 的场景)。
|
|
@@ -73550,7 +73671,35 @@ function eventToSdkMessage(ev, ctx) {
|
|
|
73550
73671
|
return nothing("usage_only");
|
|
73551
73672
|
// §2.9 — suspended 的 HITL 登记是 run driver 的活(hitlBridge.observe),本层不投影。
|
|
73552
73673
|
case "suspended":
|
|
73674
|
+
// ── sdk 6.2.0 TR-7 新入 union 的 HITL 带外族(2026-08-04 提货批)────────────────────────
|
|
73675
|
+
// `question` / `question_complete`(AskUserQuestion 的开问/收尾)与 `elicitation` /
|
|
73676
|
+
// `elicitation_complete`(入站 MCP server 向用户要输入)是**对话框覆盖层**的词汇,不是
|
|
73677
|
+
// transcript 的。它们此前只走 live 腿的 SSE `event:` 名分派(`liveQuestionStore.ts` 的 demux
|
|
73678
|
+
// 口),6.2.0 把 durable 腿的重放形也纳入了 union —— 于是它们第一次**流经本函数**。
|
|
73679
|
+
// 🔴 处置理由与 `suspended` 同族、也与本包既有分工一致:HITL 的挂起/应答由
|
|
73680
|
+
// `hitl/hitlBridge.ts` 的 `observe()` 与 `liveQuestionStore` 负责,本切片(CC transcript
|
|
73681
|
+
// 投影)对它们**没有对位渲染物** —— 硬投一个 transcript 形就是替覆盖层编一条假消息。
|
|
73682
|
+
// 所以走 `hitl_out_of_slice`(可分辨的三态之一),不是 `dropped`(那是「我看不懂」)。
|
|
73683
|
+
// 🔴 记档给下一棒(诚实缺席,不是无事发生):durable 重放腿上,一条被重放的 `question` 今天
|
|
73684
|
+
// **不会**再打开覆盖层 —— 覆盖层的入口是 liveQuestionStore 的 live demux 写口,而不是本函数。
|
|
73685
|
+
// 这在交互 REPL 上无损(live 腿原路不变),在「断线后按 Last-Event-ID 续读」的场景下是一个
|
|
73686
|
+
// 真缺口。补它属**行为面**改动(要先答「重放一条已经过期 5min TTL 的问题该不该弹窗」),
|
|
73687
|
+
// 按宪法三问单独走,不在本提货批里顺手加 —— 但缺口写在这里,不留白。
|
|
73688
|
+
case "question":
|
|
73689
|
+
case "question_complete":
|
|
73690
|
+
case "elicitation":
|
|
73691
|
+
case "elicitation_complete":
|
|
73553
73692
|
return nothing("hitl_out_of_slice");
|
|
73693
|
+
// ── sdk 6.2.0 CB-1/TR-6 `error` 臂(2026-08-04 提货批)──────────────────────────────────
|
|
73694
|
+
// 🔴 **名字骗人,别当终态**:这是流的 15 分钟帽帧(server `sse-log.ts`),帧自己就说
|
|
73695
|
+
// 「run 仍然活着」。终态臂只有 `done` / `failed`。把它渲成终态 = 把一条还在跑的任务判死。
|
|
73696
|
+
// 正确处置 = 按 `Last-Event-ID` 重连续读,而那件事 SDK 的 `runs.events` 车道内部就做了
|
|
73697
|
+
// (本包侧的坐标 = `headlessReconnectWire.ts` 的 STREAM_MAX_DURATION 段)。
|
|
73698
|
+
// ⇒ 本切片无对位渲染物,也**绝不终止**调用方的循环(返回 none,不是 terminal)。
|
|
73699
|
+
// 🔴 `errorCode` 开集(已知 `STREAM_MAX_DURATION`):未知码同样按「可重连的流控信号」降级,
|
|
73700
|
+
// 不要按成员判死 —— 词表见 `engineErrorCodes.ts`。
|
|
73701
|
+
case "error":
|
|
73702
|
+
return nothing("not_in_slice");
|
|
73554
73703
|
// CS-10 / CS-11 — terminals are projected by terminalToSdkResult.
|
|
73555
73704
|
case "done":
|
|
73556
73705
|
case "failed":
|
|
@@ -73668,7 +73817,7 @@ function subtypeForErrorCode(code2) {
|
|
|
73668
73817
|
return "error_max_budget_usd";
|
|
73669
73818
|
if (TURNS_EXCEEDED_CODES.has(code2))
|
|
73670
73819
|
return "error_max_turns";
|
|
73671
|
-
if (code2 ===
|
|
73820
|
+
if (code2 === OUTPUT_INVALID)
|
|
73672
73821
|
return "error_max_structured_output_retries";
|
|
73673
73822
|
return "error_during_execution";
|
|
73674
73823
|
}
|
|
@@ -73738,7 +73887,7 @@ function doneToSdkResult(ev, ctx) {
|
|
|
73738
73887
|
return errorResult(ctx, {
|
|
73739
73888
|
...errorBase,
|
|
73740
73889
|
subtype: failedSubtype,
|
|
73741
|
-
...cutoffParts(r, rr.errorMessage, rr.errorCode ===
|
|
73890
|
+
...cutoffParts(r, rr.errorMessage, rr.errorCode === LIMITS_MAX_TOKENS_EXCEEDED ? "run exhausted its token budget" : "run hit its wall-clock limit", rr.errorCode)
|
|
73742
73891
|
});
|
|
73743
73892
|
}
|
|
73744
73893
|
return errorResult(ctx, {
|
|
@@ -73748,7 +73897,7 @@ function doneToSdkResult(ev, ctx) {
|
|
|
73748
73897
|
// rewind_snapshot.unresolvable 骑在 done{status:"failed"} 帧的 errorCode 上,非 `failed` 帧)——
|
|
73749
73898
|
// 与 failedToSdkResult 的同款 append 对齐,message 后附 code 便于对账。
|
|
73750
73899
|
errors: [
|
|
73751
|
-
|
|
73900
|
+
isRewindFamilyCode(rr.errorCode) && rr.errorMessage ? `${rr.errorMessage} (${rr.errorCode})` : rr.errorMessage ?? "run failed"
|
|
73752
73901
|
]
|
|
73753
73902
|
});
|
|
73754
73903
|
}
|
|
@@ -73832,7 +73981,7 @@ function failedToSdkResult(ev, ctx) {
|
|
|
73832
73981
|
// resume_at.before_root_unsupported / rewind_snapshot.unresolvable)透传给用户 —— 这些是
|
|
73833
73982
|
// 用户可自解的操作性错误(选错目标/回退过根/快照缺失),code 附在 message 后便于对账。
|
|
73834
73983
|
errors: [
|
|
73835
|
-
|
|
73984
|
+
isRewindFamilyCode(ev.errorCode) && ev.errorMessage ? `${ev.errorMessage} (${ev.errorCode})` : ev.errorMessage ?? ev.errorCode ?? "run failed"
|
|
73836
73985
|
]
|
|
73837
73986
|
});
|
|
73838
73987
|
}
|
|
@@ -73844,15 +73993,12 @@ var init_terminalToSdkResult = __esm({
|
|
|
73844
73993
|
"node_modules/@sema-agent/client-core/dist/adapter/downstream/terminalToSdkResult.js"() {
|
|
73845
73994
|
init_types4();
|
|
73846
73995
|
init_turnUsageToModelUsage();
|
|
73847
|
-
|
|
73848
|
-
|
|
73849
|
-
]);
|
|
73850
|
-
TURNS_EXCEEDED_CODES = /* @__PURE__ */ new Set([
|
|
73851
|
-
"limits.max_turns_exceeded"
|
|
73852
|
-
]);
|
|
73996
|
+
init_engineErrorCodes();
|
|
73997
|
+
COST_EXCEEDED_CODES = /* @__PURE__ */ new Set([LIMITS_MAX_COST_EXCEEDED]);
|
|
73998
|
+
TURNS_EXCEEDED_CODES = /* @__PURE__ */ new Set([LIMITS_MAX_TURNS_EXCEEDED]);
|
|
73853
73999
|
CUTOFF_EXCEEDED_CODES = /* @__PURE__ */ new Set([
|
|
73854
|
-
|
|
73855
|
-
|
|
74000
|
+
LIMITS_MAX_TOKENS_EXCEEDED,
|
|
74001
|
+
LIMITS_MAX_WALLTIME_EXCEEDED
|
|
73856
74002
|
]);
|
|
73857
74003
|
}
|
|
73858
74004
|
});
|
|
@@ -74039,15 +74185,15 @@ async function* runStreamInner(events3, ctx, handle2 = {}) {
|
|
|
74039
74185
|
reportDroppedFrame(projection.why, projection.type, ctx);
|
|
74040
74186
|
}
|
|
74041
74187
|
}
|
|
74042
|
-
var MAIN2,
|
|
74188
|
+
var MAIN2, reportedDroppedTypes, DROPPED_TYPE_MEMO_CAP, DROPPED_TYPE_DISPLAY_CAP, inFlightTurns;
|
|
74043
74189
|
var init_runStream = __esm({
|
|
74044
74190
|
"node_modules/@sema-agent/client-core/dist/adapter/runStream.js"() {
|
|
74045
74191
|
init_types4();
|
|
74046
74192
|
init_eventToSdkMessage();
|
|
74047
74193
|
init_terminalToSdkResult();
|
|
74048
74194
|
init_subagentContentStore();
|
|
74195
|
+
init_engineErrorCodes();
|
|
74049
74196
|
MAIN2 = { lane: "main" };
|
|
74050
|
-
ACTIVE_RUN_BUSY_ERROR_CODE = "conflict.session_active_run";
|
|
74051
74197
|
reportedDroppedTypes = /* @__PURE__ */ new Set();
|
|
74052
74198
|
DROPPED_TYPE_MEMO_CAP = 64;
|
|
74053
74199
|
DROPPED_TYPE_DISPLAY_CAP = 60;
|
|
@@ -74568,6 +74714,15 @@ function parseNoFinalVerifyArgv(argv) {
|
|
|
74568
74714
|
}
|
|
74569
74715
|
return false;
|
|
74570
74716
|
}
|
|
74717
|
+
function parseFinalVerifyArgv(argv) {
|
|
74718
|
+
for (const a of argv) {
|
|
74719
|
+
if (a === "--")
|
|
74720
|
+
break;
|
|
74721
|
+
if (a === "--final-verify")
|
|
74722
|
+
return true;
|
|
74723
|
+
}
|
|
74724
|
+
return false;
|
|
74725
|
+
}
|
|
74571
74726
|
function headlessFinalVerifyDisabledByEnv(env5 = hostEnv()) {
|
|
74572
74727
|
return envFlagOff(env5[HEADLESS_FINAL_VERIFY_ENV]);
|
|
74573
74728
|
}
|
|
@@ -74583,9 +74738,13 @@ function resolveHeadlessFinalVerifyDetail(argv, env5 = hostEnv(), wireHooks) {
|
|
|
74583
74738
|
return { on: false, offReason: "flag" };
|
|
74584
74739
|
if (headlessFinalVerifyDisabledByEnv(env5))
|
|
74585
74740
|
return { on: false, offReason: "env" };
|
|
74586
|
-
|
|
74587
|
-
|
|
74588
|
-
|
|
74741
|
+
const explicitOn = parseFinalVerifyArgv(argv) || envFlagOn(env5[HEADLESS_FINAL_VERIFY_ENV]);
|
|
74742
|
+
if (explicitOn) {
|
|
74743
|
+
if (hasUserStopHook(wireHooks))
|
|
74744
|
+
return { on: false, offReason: "stop-hook" };
|
|
74745
|
+
return { on: true };
|
|
74746
|
+
}
|
|
74747
|
+
return { on: false };
|
|
74589
74748
|
}
|
|
74590
74749
|
var HEADLESS_FINAL_VERIFY_ENV, FINAL_VERIFY_YIELD_NOTICE;
|
|
74591
74750
|
var init_finalVerifyWire = __esm({
|
|
@@ -74608,7 +74767,7 @@ function parseIntInDomain(raw2, min, max2) {
|
|
|
74608
74767
|
return n2;
|
|
74609
74768
|
}
|
|
74610
74769
|
function hasAnyLimit(l3) {
|
|
74611
|
-
return l3.maxWalltimeMs !== void 0 || l3.maxTurns !== void 0 || l3.
|
|
74770
|
+
return l3.maxWalltimeMs !== void 0 || l3.maxTurns !== void 0 || l3.maxOutputTokens !== void 0;
|
|
74612
74771
|
}
|
|
74613
74772
|
function parseLimitsArgv(argv) {
|
|
74614
74773
|
const limits = {};
|
|
@@ -74634,7 +74793,7 @@ function parseLimitsArgv(argv) {
|
|
|
74634
74793
|
const n2 = mk.raw !== void 0 ? parseIntInDomain(mk.raw, MAX_TOKENS_MIN, MAX_TOKENS_MAX) : null;
|
|
74635
74794
|
if (n2 === null)
|
|
74636
74795
|
return { ok: false, error: MAX_TOKENS_USAGE };
|
|
74637
|
-
limits.
|
|
74796
|
+
limits.maxOutputTokens = n2;
|
|
74638
74797
|
flaggedFlags.push("--max-tokens");
|
|
74639
74798
|
}
|
|
74640
74799
|
return {
|
|
@@ -74670,7 +74829,7 @@ function headlessLimitsFromEnv(env5 = hostEnv()) {
|
|
|
74670
74829
|
if (n2 === null) {
|
|
74671
74830
|
return { ok: false, error: `Error: ${HEADLESS_MAX_TOKENS_ENV}="${mk}" is not a positive integer. Fix or unset it.` };
|
|
74672
74831
|
}
|
|
74673
|
-
out6.
|
|
74832
|
+
out6.maxOutputTokens = n2;
|
|
74674
74833
|
}
|
|
74675
74834
|
return { ok: true, limits: hasAnyLimit(out6) ? out6 : void 0 };
|
|
74676
74835
|
}
|
|
@@ -75700,15 +75859,15 @@ function classifyTaskStopConflict(e) {
|
|
|
75700
75859
|
const raw2 = e?.errorCode;
|
|
75701
75860
|
const code2 = typeof raw2 === "string" ? raw2 : STOP_CONFLICT_CODES.find((c2) => detail.includes(c2)) ?? "";
|
|
75702
75861
|
switch (code2) {
|
|
75703
|
-
case
|
|
75862
|
+
case STOP_NOT_LOCAL:
|
|
75704
75863
|
return { ok: false, reason: "not_local", detail };
|
|
75705
|
-
case
|
|
75864
|
+
case STOP_PARKED:
|
|
75706
75865
|
return { ok: false, reason: "parked", detail };
|
|
75707
|
-
case
|
|
75866
|
+
case STOP_PARK_RESUME_WON:
|
|
75708
75867
|
return { ok: false, reason: "park_resume_won", detail };
|
|
75709
|
-
case
|
|
75868
|
+
case STOP_PARK_ARBITER_UNREACHABLE:
|
|
75710
75869
|
return { ok: false, reason: "park_arbiter_unreachable", detail };
|
|
75711
|
-
case
|
|
75870
|
+
case STOP_NOT_LANDED:
|
|
75712
75871
|
return { ok: false, reason: "not_landed", detail };
|
|
75713
75872
|
default:
|
|
75714
75873
|
return { ok: false, reason: "unknown_conflict", detail };
|
|
@@ -75752,7 +75911,7 @@ async function stopEngineTask(handle2, opts) {
|
|
|
75752
75911
|
return { ok: false, reason: "error", detail };
|
|
75753
75912
|
}
|
|
75754
75913
|
}
|
|
75755
|
-
var accumulated
|
|
75914
|
+
var accumulated;
|
|
75756
75915
|
var init_engineTaskHandleWire = __esm({
|
|
75757
75916
|
"node_modules/@sema-agent/client-core/dist/subagent/engineTaskHandleWire.js"() {
|
|
75758
75917
|
init_host();
|
|
@@ -75762,14 +75921,8 @@ var init_engineTaskHandleWire = __esm({
|
|
|
75762
75921
|
init_subagentContentStore();
|
|
75763
75922
|
init_engineRowStopGate();
|
|
75764
75923
|
init_toolResult();
|
|
75924
|
+
init_engineErrorCodes();
|
|
75765
75925
|
accumulated = /* @__PURE__ */ new Map();
|
|
75766
|
-
STOP_CONFLICT_CODES = [
|
|
75767
|
-
"stop.park_arbiter_unreachable",
|
|
75768
|
-
"stop.park_resume_won",
|
|
75769
|
-
"stop.not_landed",
|
|
75770
|
-
"stop.not_local",
|
|
75771
|
-
"stop.parked"
|
|
75772
|
-
];
|
|
75773
75926
|
}
|
|
75774
75927
|
});
|
|
75775
75928
|
|
|
@@ -78855,124 +79008,6 @@ var init_toolApprovalWire = __esm({
|
|
|
78855
79008
|
}
|
|
78856
79009
|
});
|
|
78857
79010
|
|
|
78858
|
-
// node_modules/@sema-agent/client-core/dist/hitl/gateLedger.js
|
|
78859
|
-
function createGateLedger() {
|
|
78860
|
-
const startedCalls = /* @__PURE__ */ new Set();
|
|
78861
|
-
const endedCalls = /* @__PURE__ */ new Set();
|
|
78862
|
-
const heldAskEnds = /* @__PURE__ */ new Map();
|
|
78863
|
-
const gatedStartArgsByCall = /* @__PURE__ */ new Map();
|
|
78864
|
-
const deniedCalls = /* @__PURE__ */ new Set();
|
|
78865
|
-
const pendingFsCalls = [];
|
|
78866
|
-
const resolvedAnswers = /* @__PURE__ */ new Map();
|
|
78867
|
-
const decidedGates = /* @__PURE__ */ new Set();
|
|
78868
|
-
let lastFsOrShellGatedCall;
|
|
78869
|
-
let denyStampNextFsEnd = false;
|
|
78870
|
-
let seq;
|
|
78871
|
-
return {
|
|
78872
|
-
noteSeq(ev) {
|
|
78873
|
-
const rawSeq = ev.id ?? ev.seq;
|
|
78874
|
-
if (typeof rawSeq === "string" && rawSeq.length > 0)
|
|
78875
|
-
seq = rawSeq;
|
|
78876
|
-
else if (typeof rawSeq === "number" && Number.isFinite(rawSeq))
|
|
78877
|
-
seq = String(rawSeq);
|
|
78878
|
-
},
|
|
78879
|
-
lastSeq() {
|
|
78880
|
-
return seq;
|
|
78881
|
-
},
|
|
78882
|
-
markStarted(callId) {
|
|
78883
|
-
if (startedCalls.has(callId))
|
|
78884
|
-
return false;
|
|
78885
|
-
startedCalls.add(callId);
|
|
78886
|
-
return true;
|
|
78887
|
-
},
|
|
78888
|
-
noteGatedStart(callId, ev) {
|
|
78889
|
-
gatedStartArgsByCall.set(callId, ev.args);
|
|
78890
|
-
},
|
|
78891
|
-
gatedStartArgs() {
|
|
78892
|
-
return gatedStartArgsByCall;
|
|
78893
|
-
},
|
|
78894
|
-
isEnded(callId) {
|
|
78895
|
-
return endedCalls.has(callId);
|
|
78896
|
-
},
|
|
78897
|
-
markEnded(callId) {
|
|
78898
|
-
endedCalls.add(callId);
|
|
78899
|
-
},
|
|
78900
|
-
hold(callId, ev) {
|
|
78901
|
-
heldAskEnds.set(callId, ev);
|
|
78902
|
-
},
|
|
78903
|
-
dropHeld(callId) {
|
|
78904
|
-
heldAskEnds.delete(callId);
|
|
78905
|
-
},
|
|
78906
|
-
heldCount() {
|
|
78907
|
-
return heldAskEnds.size;
|
|
78908
|
-
},
|
|
78909
|
-
*flushHeld() {
|
|
78910
|
-
for (const [callId, held] of heldAskEnds) {
|
|
78911
|
-
endedCalls.add(callId);
|
|
78912
|
-
yield held;
|
|
78913
|
-
}
|
|
78914
|
-
heldAskEnds.clear();
|
|
78915
|
-
},
|
|
78916
|
-
markDenied(callId) {
|
|
78917
|
-
deniedCalls.add(callId);
|
|
78918
|
-
},
|
|
78919
|
-
isDenied(callId) {
|
|
78920
|
-
return deniedCalls.has(callId);
|
|
78921
|
-
},
|
|
78922
|
-
takeDenied(callId) {
|
|
78923
|
-
return deniedCalls.delete(callId);
|
|
78924
|
-
},
|
|
78925
|
-
armDenyStamp() {
|
|
78926
|
-
denyStampNextFsEnd = true;
|
|
78927
|
-
},
|
|
78928
|
-
takeDenyStamp() {
|
|
78929
|
-
if (!denyStampNextFsEnd)
|
|
78930
|
-
return false;
|
|
78931
|
-
denyStampNextFsEnd = false;
|
|
78932
|
-
return true;
|
|
78933
|
-
},
|
|
78934
|
-
pushFsCall(callId) {
|
|
78935
|
-
pendingFsCalls.push(callId);
|
|
78936
|
-
},
|
|
78937
|
-
dropFsCall(callId) {
|
|
78938
|
-
const at = pendingFsCalls.indexOf(callId);
|
|
78939
|
-
if (at !== -1)
|
|
78940
|
-
pendingFsCalls.splice(at, 1);
|
|
78941
|
-
},
|
|
78942
|
-
lastPendingFsCall() {
|
|
78943
|
-
return pendingFsCalls.length > 0 ? pendingFsCalls[pendingFsCalls.length - 1] : void 0;
|
|
78944
|
-
},
|
|
78945
|
-
noteFsOrShellGate(callId) {
|
|
78946
|
-
lastFsOrShellGatedCall = callId;
|
|
78947
|
-
},
|
|
78948
|
-
lastFsOrShellGatedCallId() {
|
|
78949
|
-
return lastFsOrShellGatedCall;
|
|
78950
|
-
},
|
|
78951
|
-
rememberAnswer(callId, answered) {
|
|
78952
|
-
resolvedAnswers.set(callId, answered);
|
|
78953
|
-
},
|
|
78954
|
-
answerFor(callId) {
|
|
78955
|
-
return resolvedAnswers.get(callId);
|
|
78956
|
-
},
|
|
78957
|
-
dropAnswer(callId) {
|
|
78958
|
-
resolvedAnswers.delete(callId);
|
|
78959
|
-
},
|
|
78960
|
-
markDecided(callId) {
|
|
78961
|
-
decidedGates.add(callId);
|
|
78962
|
-
},
|
|
78963
|
-
takeDecided(callId) {
|
|
78964
|
-
return decidedGates.delete(callId);
|
|
78965
|
-
},
|
|
78966
|
-
decidedCount() {
|
|
78967
|
-
return decidedGates.size;
|
|
78968
|
-
}
|
|
78969
|
-
};
|
|
78970
|
-
}
|
|
78971
|
-
var init_gateLedger = __esm({
|
|
78972
|
-
"node_modules/@sema-agent/client-core/dist/hitl/gateLedger.js"() {
|
|
78973
|
-
}
|
|
78974
|
-
});
|
|
78975
|
-
|
|
78976
79011
|
// node_modules/@sema-agent/client-core/dist/hitl/frameRouter.js
|
|
78977
79012
|
function rejectMessageForRender() {
|
|
78978
79013
|
return HITL_REJECT_MESSAGE;
|
|
@@ -79230,6 +79265,124 @@ var init_frameRouter = __esm({
|
|
|
79230
79265
|
}
|
|
79231
79266
|
});
|
|
79232
79267
|
|
|
79268
|
+
// node_modules/@sema-agent/client-core/dist/hitl/gateLedger.js
|
|
79269
|
+
function createGateLedger() {
|
|
79270
|
+
const startedCalls = /* @__PURE__ */ new Set();
|
|
79271
|
+
const endedCalls = /* @__PURE__ */ new Set();
|
|
79272
|
+
const heldAskEnds = /* @__PURE__ */ new Map();
|
|
79273
|
+
const gatedStartArgsByCall = /* @__PURE__ */ new Map();
|
|
79274
|
+
const deniedCalls = /* @__PURE__ */ new Set();
|
|
79275
|
+
const pendingFsCalls = [];
|
|
79276
|
+
const resolvedAnswers = /* @__PURE__ */ new Map();
|
|
79277
|
+
const decidedGates = /* @__PURE__ */ new Set();
|
|
79278
|
+
let lastFsOrShellGatedCall;
|
|
79279
|
+
let denyStampNextFsEnd = false;
|
|
79280
|
+
let seq;
|
|
79281
|
+
return {
|
|
79282
|
+
noteSeq(ev) {
|
|
79283
|
+
const rawSeq = ev.id ?? ev.seq;
|
|
79284
|
+
if (typeof rawSeq === "string" && rawSeq.length > 0)
|
|
79285
|
+
seq = rawSeq;
|
|
79286
|
+
else if (typeof rawSeq === "number" && Number.isFinite(rawSeq))
|
|
79287
|
+
seq = String(rawSeq);
|
|
79288
|
+
},
|
|
79289
|
+
lastSeq() {
|
|
79290
|
+
return seq;
|
|
79291
|
+
},
|
|
79292
|
+
markStarted(callId) {
|
|
79293
|
+
if (startedCalls.has(callId))
|
|
79294
|
+
return false;
|
|
79295
|
+
startedCalls.add(callId);
|
|
79296
|
+
return true;
|
|
79297
|
+
},
|
|
79298
|
+
noteGatedStart(callId, ev) {
|
|
79299
|
+
gatedStartArgsByCall.set(callId, ev.args);
|
|
79300
|
+
},
|
|
79301
|
+
gatedStartArgs() {
|
|
79302
|
+
return gatedStartArgsByCall;
|
|
79303
|
+
},
|
|
79304
|
+
isEnded(callId) {
|
|
79305
|
+
return endedCalls.has(callId);
|
|
79306
|
+
},
|
|
79307
|
+
markEnded(callId) {
|
|
79308
|
+
endedCalls.add(callId);
|
|
79309
|
+
},
|
|
79310
|
+
hold(callId, ev) {
|
|
79311
|
+
heldAskEnds.set(callId, ev);
|
|
79312
|
+
},
|
|
79313
|
+
dropHeld(callId) {
|
|
79314
|
+
heldAskEnds.delete(callId);
|
|
79315
|
+
},
|
|
79316
|
+
heldCount() {
|
|
79317
|
+
return heldAskEnds.size;
|
|
79318
|
+
},
|
|
79319
|
+
*flushHeld() {
|
|
79320
|
+
for (const [callId, held] of heldAskEnds) {
|
|
79321
|
+
endedCalls.add(callId);
|
|
79322
|
+
yield held;
|
|
79323
|
+
}
|
|
79324
|
+
heldAskEnds.clear();
|
|
79325
|
+
},
|
|
79326
|
+
markDenied(callId) {
|
|
79327
|
+
deniedCalls.add(callId);
|
|
79328
|
+
},
|
|
79329
|
+
isDenied(callId) {
|
|
79330
|
+
return deniedCalls.has(callId);
|
|
79331
|
+
},
|
|
79332
|
+
takeDenied(callId) {
|
|
79333
|
+
return deniedCalls.delete(callId);
|
|
79334
|
+
},
|
|
79335
|
+
armDenyStamp() {
|
|
79336
|
+
denyStampNextFsEnd = true;
|
|
79337
|
+
},
|
|
79338
|
+
takeDenyStamp() {
|
|
79339
|
+
if (!denyStampNextFsEnd)
|
|
79340
|
+
return false;
|
|
79341
|
+
denyStampNextFsEnd = false;
|
|
79342
|
+
return true;
|
|
79343
|
+
},
|
|
79344
|
+
pushFsCall(callId) {
|
|
79345
|
+
pendingFsCalls.push(callId);
|
|
79346
|
+
},
|
|
79347
|
+
dropFsCall(callId) {
|
|
79348
|
+
const at = pendingFsCalls.indexOf(callId);
|
|
79349
|
+
if (at !== -1)
|
|
79350
|
+
pendingFsCalls.splice(at, 1);
|
|
79351
|
+
},
|
|
79352
|
+
lastPendingFsCall() {
|
|
79353
|
+
return pendingFsCalls.length > 0 ? pendingFsCalls[pendingFsCalls.length - 1] : void 0;
|
|
79354
|
+
},
|
|
79355
|
+
noteFsOrShellGate(callId) {
|
|
79356
|
+
lastFsOrShellGatedCall = callId;
|
|
79357
|
+
},
|
|
79358
|
+
lastFsOrShellGatedCallId() {
|
|
79359
|
+
return lastFsOrShellGatedCall;
|
|
79360
|
+
},
|
|
79361
|
+
rememberAnswer(callId, answered) {
|
|
79362
|
+
resolvedAnswers.set(callId, answered);
|
|
79363
|
+
},
|
|
79364
|
+
answerFor(callId) {
|
|
79365
|
+
return resolvedAnswers.get(callId);
|
|
79366
|
+
},
|
|
79367
|
+
dropAnswer(callId) {
|
|
79368
|
+
resolvedAnswers.delete(callId);
|
|
79369
|
+
},
|
|
79370
|
+
markDecided(callId) {
|
|
79371
|
+
decidedGates.add(callId);
|
|
79372
|
+
},
|
|
79373
|
+
takeDecided(callId) {
|
|
79374
|
+
return decidedGates.delete(callId);
|
|
79375
|
+
},
|
|
79376
|
+
decidedCount() {
|
|
79377
|
+
return decidedGates.size;
|
|
79378
|
+
}
|
|
79379
|
+
};
|
|
79380
|
+
}
|
|
79381
|
+
var init_gateLedger = __esm({
|
|
79382
|
+
"node_modules/@sema-agent/client-core/dist/hitl/gateLedger.js"() {
|
|
79383
|
+
}
|
|
79384
|
+
});
|
|
79385
|
+
|
|
79233
79386
|
// node_modules/@sema-agent/client-core/dist/hitl/parkResolver.js
|
|
79234
79387
|
function isGateFailureCode(v2) {
|
|
79235
79388
|
return v2 === "no_pending" || v2 === "binding_mismatch" || v2 === "wrong_gate" || v2 === "bad_plan_edit";
|
|
@@ -81717,6 +81870,7 @@ var init_localeGeo = __esm({
|
|
|
81717
81870
|
var dist_exports = {};
|
|
81718
81871
|
__export(dist_exports, {
|
|
81719
81872
|
ABSENT_SETTLE_MS: () => ABSENT_SETTLE_MS,
|
|
81873
|
+
ACTIVE_RUN_BUSY_ERROR_CODE: () => ACTIVE_RUN_BUSY_ERROR_CODE,
|
|
81720
81874
|
ADAPTER_COVERAGE: () => ADAPTER_COVERAGE,
|
|
81721
81875
|
ADAPTER_DIVERGENCES: () => ADAPTER_DIVERGENCES,
|
|
81722
81876
|
ATTACHMENTS_ENV: () => ATTACHMENTS_ENV,
|
|
@@ -81737,6 +81891,11 @@ __export(dist_exports, {
|
|
|
81737
81891
|
CHROME_EVENT_KINDS: () => CHROME_EVENT_KINDS,
|
|
81738
81892
|
CLASSIFIER_DENY_SIGNATURE: () => CLASSIFIER_DENY_SIGNATURE,
|
|
81739
81893
|
CLIENT_VERBS: () => CLIENT_VERBS,
|
|
81894
|
+
CONFIG_LIMIT_INVALID: () => CONFIG_LIMIT_INVALID,
|
|
81895
|
+
CONFIG_LIMIT_UNKNOWN_KEY: () => CONFIG_LIMIT_UNKNOWN_KEY,
|
|
81896
|
+
CONFIG_REFUSAL_CODES: () => CONFIG_REFUSAL_CODES,
|
|
81897
|
+
CONFIG_STRATEGY_FIND_LIMIT_INVALID: () => CONFIG_STRATEGY_FIND_LIMIT_INVALID,
|
|
81898
|
+
CONFIG_STRATEGY_MAX_SIZE_INVALID: () => CONFIG_STRATEGY_MAX_SIZE_INVALID,
|
|
81740
81899
|
CONTEXT_LINES: () => CONTEXT_LINES,
|
|
81741
81900
|
CONTROL_TOOL_VERBS: () => CONTROL_TOOL_VERBS,
|
|
81742
81901
|
ControlRouter: () => ControlRouter,
|
|
@@ -81763,6 +81922,7 @@ __export(dist_exports, {
|
|
|
81763
81922
|
ENGINE_HANDS_BAND: () => ENGINE_HANDS_BAND,
|
|
81764
81923
|
ENGINE_RUNNER_FACE: () => ENGINE_RUNNER_FACE,
|
|
81765
81924
|
ENGINE_SCENARIO_EXTRAS_DEFAULT: () => ENGINE_SCENARIO_EXTRAS_DEFAULT,
|
|
81925
|
+
ENV_LIFETIME_EXPIRED: () => ENV_LIFETIME_EXPIRED,
|
|
81766
81926
|
FALLBACK_CONTEXT_WINDOW: () => FALLBACK_CONTEXT_WINDOW,
|
|
81767
81927
|
FINAL_VERIFY_YIELD_NOTICE: () => FINAL_VERIFY_YIELD_NOTICE,
|
|
81768
81928
|
FLEET_TASK_ROW_KEYS_NOT_PROJECTED: () => FLEET_TASK_ROW_KEYS_NOT_PROJECTED,
|
|
@@ -81790,6 +81950,10 @@ __export(dist_exports, {
|
|
|
81790
81950
|
HitlBridge: () => HitlBridge,
|
|
81791
81951
|
HitlSafetyError: () => HitlSafetyError,
|
|
81792
81952
|
IDLE_FLUSH_MS: () => IDLE_FLUSH_MS,
|
|
81953
|
+
LIMITS_MAX_COST_EXCEEDED: () => LIMITS_MAX_COST_EXCEEDED,
|
|
81954
|
+
LIMITS_MAX_TOKENS_EXCEEDED: () => LIMITS_MAX_TOKENS_EXCEEDED,
|
|
81955
|
+
LIMITS_MAX_TURNS_EXCEEDED: () => LIMITS_MAX_TURNS_EXCEEDED,
|
|
81956
|
+
LIMITS_MAX_WALLTIME_EXCEEDED: () => LIMITS_MAX_WALLTIME_EXCEEDED,
|
|
81793
81957
|
LIMITS_WIRE_MIN_ENGINE: () => LIMITS_WIRE_MIN_ENGINE,
|
|
81794
81958
|
LIVE_DEFAULT_FIELDS: () => LIVE_DEFAULT_FIELDS,
|
|
81795
81959
|
LOCAL_SESSIONS_SPEC: () => LOCAL_SESSIONS_SPEC,
|
|
@@ -81811,7 +81975,9 @@ __export(dist_exports, {
|
|
|
81811
81975
|
MAX_TURNS_MIN: () => MAX_TURNS_MIN,
|
|
81812
81976
|
MCP_CAPS: () => MCP_CAPS,
|
|
81813
81977
|
MIGRATED_COMPENSATIONS: () => MIGRATED_COMPENSATIONS,
|
|
81978
|
+
MODEL_FALLBACK_INHERIT_NO_TIER_BINDING: () => MODEL_FALLBACK_INHERIT_NO_TIER_BINDING,
|
|
81814
81979
|
MODEL_FAMILIES: () => MODEL_FAMILIES,
|
|
81980
|
+
OUTPUT_INVALID: () => OUTPUT_INVALID,
|
|
81815
81981
|
PANEL_TOOLUSES_LANE_POLICY: () => PANEL_TOOLUSES_LANE_POLICY,
|
|
81816
81982
|
PERMISSION_MODE_INTENTS: () => PERMISSION_MODE_INTENTS,
|
|
81817
81983
|
PLAN_REVIEW_APPROVE_LABEL: () => PLAN_REVIEW_APPROVE_LABEL,
|
|
@@ -81824,6 +81990,7 @@ __export(dist_exports, {
|
|
|
81824
81990
|
REJECT_MESSAGE: () => REJECT_MESSAGE,
|
|
81825
81991
|
REQUEST_FIELD_MATRIX: () => REQUEST_FIELD_MATRIX,
|
|
81826
81992
|
RETAIN_BACKGROUND_ENV: () => RETAIN_BACKGROUND_ENV,
|
|
81993
|
+
REWIND_ERROR_CODE_PREFIXES: () => REWIND_ERROR_CODE_PREFIXES,
|
|
81827
81994
|
SANDBOX_CASCADE_CONFLICT_400_ANCHOR: () => SANDBOX_CASCADE_CONFLICT_400_ANCHOR,
|
|
81828
81995
|
SANDBOX_K8S_ONLY_400_ANCHOR: () => SANDBOX_K8S_ONLY_400_ANCHOR,
|
|
81829
81996
|
SANDBOX_NO_IMAGE_INDEX_400_ANCHOR: () => SANDBOX_NO_IMAGE_INDEX_400_ANCHOR,
|
|
@@ -81848,6 +82015,13 @@ __export(dist_exports, {
|
|
|
81848
82015
|
SSE_GRACE_MIN_MS: () => SSE_GRACE_MIN_MS,
|
|
81849
82016
|
SSE_HEARTBEAT_GRACE_ENV: () => SSE_HEARTBEAT_GRACE_ENV,
|
|
81850
82017
|
START_SESSION_OPTION_KEYS: () => START_SESSION_OPTION_KEYS,
|
|
82018
|
+
STOP_CONFLICT_CODES: () => STOP_CONFLICT_CODES,
|
|
82019
|
+
STOP_NOT_LANDED: () => STOP_NOT_LANDED,
|
|
82020
|
+
STOP_NOT_LOCAL: () => STOP_NOT_LOCAL,
|
|
82021
|
+
STOP_PARKED: () => STOP_PARKED,
|
|
82022
|
+
STOP_PARK_ARBITER_UNREACHABLE: () => STOP_PARK_ARBITER_UNREACHABLE,
|
|
82023
|
+
STOP_PARK_RESUME_WON: () => STOP_PARK_RESUME_WON,
|
|
82024
|
+
STREAM_MAX_DURATION: () => STREAM_MAX_DURATION,
|
|
81851
82025
|
STRUCTURED_DETAIL_TYPES: () => STRUCTURED_DETAIL_TYPES,
|
|
81852
82026
|
SUBAGENT_TOOL_NAMES: () => SUBAGENT_TOOL_NAMES,
|
|
81853
82027
|
TASK_AGENT_WIRE_FIELDS: () => TASK_AGENT_WIRE_FIELDS,
|
|
@@ -81855,9 +82029,13 @@ __export(dist_exports, {
|
|
|
81855
82029
|
TERMINAL_RETAIN_MS: () => TERMINAL_RETAIN_MS,
|
|
81856
82030
|
TOCTOU_BINDING_KEYS: () => TOCTOU_BINDING_KEYS,
|
|
81857
82031
|
TOOL_APPROVAL_FRAME_KEYS_MIRROR: () => TOOL_APPROVAL_FRAME_KEYS_MIRROR,
|
|
82032
|
+
TOOL_END_INTERRUPTED_CODES: () => TOOL_END_INTERRUPTED_CODES,
|
|
82033
|
+
TOOL_END_INTERRUPTED_NEVER_STARTED: () => TOOL_END_INTERRUPTED_NEVER_STARTED,
|
|
82034
|
+
TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN: () => TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN,
|
|
81858
82035
|
TOOL_PERMISSION_DECISION_KEYS: () => TOOL_PERMISSION_DECISION_KEYS,
|
|
81859
82036
|
TOOL_PERMISSION_REQUEST_KEYS: () => TOOL_PERMISSION_REQUEST_KEYS,
|
|
81860
82037
|
TOOL_RESULT_DEGRADED_WIRE_NO_OUTPUT: () => TOOL_RESULT_DEGRADED_WIRE_NO_OUTPUT,
|
|
82038
|
+
USAGE_WINDOW_EXHAUSTED: () => USAGE_WINDOW_EXHAUSTED,
|
|
81861
82039
|
USER_EMAIL_ENV: () => USER_EMAIL_ENV,
|
|
81862
82040
|
WEBSEARCH_ENV: () => WEBSEARCH_ENV,
|
|
81863
82041
|
WEB_SEARCH_ENGINE_DEFAULTS: () => WEB_SEARCH_ENGINE_DEFAULTS,
|
|
@@ -81906,6 +82084,7 @@ __export(dist_exports, {
|
|
|
81906
82084
|
approvalCardPortMissesFor: () => approvalCardPortMissesFor,
|
|
81907
82085
|
armDetachCancel: () => armDetachCancel,
|
|
81908
82086
|
armPlanReviewApproval: () => armPlanReviewApproval,
|
|
82087
|
+
asModelFallbackReason: () => asModelFallbackReason,
|
|
81909
82088
|
assistantTaskToBackgroundRow: () => assistantTaskToBackgroundRow,
|
|
81910
82089
|
attachmentsForRequest: () => attachmentsForRequest,
|
|
81911
82090
|
awaitTaskAgentsWire: () => awaitTaskAgentsWire,
|
|
@@ -82067,6 +82246,7 @@ __export(dist_exports, {
|
|
|
82067
82246
|
isAllowedCatalogUrl: () => isAllowedCatalogUrl,
|
|
82068
82247
|
isAlreadyResolvedGateReason: () => isAlreadyResolvedGateReason,
|
|
82069
82248
|
isAttachmentUploadReceipt: () => isAttachmentUploadReceipt,
|
|
82249
|
+
isConfigRefusalCode: () => isConfigRefusalCode,
|
|
82070
82250
|
isDetachArmed: () => isDetachArmed,
|
|
82071
82251
|
isEngineCompactPending: () => isEngineCompactPending,
|
|
82072
82252
|
isEnginePanelTaskResident: () => isEnginePanelTaskResident,
|
|
@@ -82079,6 +82259,7 @@ __export(dist_exports, {
|
|
|
82079
82259
|
isFsApprovalGate: () => isFsApprovalGate,
|
|
82080
82260
|
isGoalStopHookWireArmed: () => isGoalStopHookWireArmed,
|
|
82081
82261
|
isHookNoticeFrame: () => isHookNoticeFrame,
|
|
82262
|
+
isInterruptedToolEndCode: () => isInterruptedToolEndCode,
|
|
82082
82263
|
isKnownWorkflowAgentTaskId: () => isKnownWorkflowAgentTaskId,
|
|
82083
82264
|
isLocalSessionEvent: () => isLocalSessionEvent,
|
|
82084
82265
|
isLocalSessionRecord: () => isLocalSessionRecord,
|
|
@@ -82086,6 +82267,7 @@ __export(dist_exports, {
|
|
|
82086
82267
|
isOwnEngineRun: () => isOwnEngineRun,
|
|
82087
82268
|
isOwnWorkflowRun: () => isOwnWorkflowRun,
|
|
82088
82269
|
isPlanReviewPark: () => isPlanReviewPark,
|
|
82270
|
+
isRewindFamilyCode: () => isRewindFamilyCode,
|
|
82089
82271
|
isRunStreamActive: () => isRunStreamActive,
|
|
82090
82272
|
isSeatModelCatalog: () => isSeatModelCatalog,
|
|
82091
82273
|
isSendMessageAck: () => isSendMessageAck,
|
|
@@ -82136,6 +82318,7 @@ __export(dist_exports, {
|
|
|
82136
82318
|
parentToolCallIdOf: () => parentToolCallIdOf,
|
|
82137
82319
|
parseBackgroundReceipt: () => parseBackgroundReceipt,
|
|
82138
82320
|
parseCatalogSources: () => parseCatalogSources,
|
|
82321
|
+
parseFinalVerifyArgv: () => parseFinalVerifyArgv,
|
|
82139
82322
|
parseLimitsArgv: () => parseLimitsArgv,
|
|
82140
82323
|
parseModelFacingBash: () => parseModelFacingBash,
|
|
82141
82324
|
parseModelFacingTaskOutput: () => parseModelFacingTaskOutput,
|
|
@@ -82174,6 +82357,7 @@ __export(dist_exports, {
|
|
|
82174
82357
|
publishQuestionFrameFor: () => publishQuestionFrameFor,
|
|
82175
82358
|
publishSubagentContentEvent: () => publishSubagentContentEvent,
|
|
82176
82359
|
pushSubagentLocalEcho: () => pushSubagentLocalEcho,
|
|
82360
|
+
readCompletedAgentCard: () => readCompletedAgentCard,
|
|
82177
82361
|
readEngineActiveBgTasks: () => readEngineActiveBgTasks,
|
|
82178
82362
|
readEngineActiveBgTasksFor: () => readEngineActiveBgTasksFor,
|
|
82179
82363
|
recordBgParentRun: () => recordBgParentRun,
|
|
@@ -82266,6 +82450,7 @@ __export(dist_exports, {
|
|
|
82266
82450
|
toCappedSpec: () => toCappedSpec,
|
|
82267
82451
|
toCcModelUsage: () => toCcModelUsage,
|
|
82268
82452
|
todoWriteToolUseResult: () => todoWriteToolUseResult,
|
|
82453
|
+
toolEndOutputText: () => toolEndOutputText,
|
|
82269
82454
|
toolEndResultToUserFrame: () => toolEndResultToUserFrame,
|
|
82270
82455
|
toolNameIsFsWrite: () => toolNameIsFsWrite,
|
|
82271
82456
|
toolNameIsShellExec: () => toolNameIsShellExec,
|
|
@@ -82324,6 +82509,7 @@ var init_dist = __esm({
|
|
|
82324
82509
|
init_sseIdleTriage();
|
|
82325
82510
|
init_engineWireSdk();
|
|
82326
82511
|
init_classifierVerdictWire();
|
|
82512
|
+
init_engineErrorCodes();
|
|
82327
82513
|
init_agentsWireCaps();
|
|
82328
82514
|
init_attachmentsWireCaps();
|
|
82329
82515
|
init_clientContextWireCaps();
|
|
@@ -82381,6 +82567,7 @@ var init_dist = __esm({
|
|
|
82381
82567
|
init_liveInitToolFace();
|
|
82382
82568
|
init_providerPresets2();
|
|
82383
82569
|
init_hitlBridge();
|
|
82570
|
+
init_frameRouter();
|
|
82384
82571
|
init_hitlHostSurface();
|
|
82385
82572
|
init_toolApprovalWire();
|
|
82386
82573
|
init_askGateWire();
|
|
@@ -136121,7 +136308,7 @@ function activeRunBusySignal2(ev) {
|
|
|
136121
136308
|
const activeTaskId = "activeTaskId" in carrier ? carrier.activeTaskId : void 0;
|
|
136122
136309
|
const activeTaskStatus = "activeTaskStatus" in carrier ? carrier.activeTaskStatus : void 0;
|
|
136123
136310
|
const rawGate = "pendingGate" in carrier ? carrier.pendingGate : void 0;
|
|
136124
|
-
const codeHit = errorCode ===
|
|
136311
|
+
const codeHit = errorCode === ACTIVE_RUN_BUSY_ERROR_CODE;
|
|
136125
136312
|
const handle2 = typeof activeTaskId === "string" && activeTaskId.length > 0 ? activeTaskId : null;
|
|
136126
136313
|
if (!codeHit && handle2 === null) return null;
|
|
136127
136314
|
let pendingGate = null;
|
|
@@ -136203,15 +136390,42 @@ async function attemptActiveRunSelfHeal(signal, runs, deps2) {
|
|
|
136203
136390
|
}
|
|
136204
136391
|
return { kind: "healed", taskId, status: status3 };
|
|
136205
136392
|
}
|
|
136206
|
-
function
|
|
136207
|
-
return
|
|
136393
|
+
function gateKindPhrase(kind) {
|
|
136394
|
+
return kind ? `a ${kind} decision` : "a decision";
|
|
136395
|
+
}
|
|
136396
|
+
function decidePathClause(signal) {
|
|
136397
|
+
const decidePath = signal?.pendingGate?.decidePath;
|
|
136398
|
+
if (!decidePath) return "";
|
|
136399
|
+
return ` The engine says that run is waiting on ${gateKindPhrase(signal?.pendingGate?.kind)} and that it is decided at POST ${decidePath} \u2014 deciding it releases the session.`;
|
|
136400
|
+
}
|
|
136401
|
+
function healedCostClause(signal) {
|
|
136402
|
+
const gate = signal?.pendingGate;
|
|
136403
|
+
if (gate) return `it was waiting on ${gateKindPhrase(gate.kind)}, so that decision was declined`;
|
|
136404
|
+
if (signal?.activeTaskStatus)
|
|
136405
|
+
return "the engine reported no decision pending on it (a stale park), so nothing was decided on your behalf";
|
|
136406
|
+
return "the engine did not report what it was waiting on, so anything still pending on it is now gone";
|
|
136407
|
+
}
|
|
136408
|
+
function activeRunSelfHealRow(outcome, signal) {
|
|
136409
|
+
const base = activeRunSelfHealBaseRow(outcome, signal);
|
|
136410
|
+
switch (outcome.kind) {
|
|
136411
|
+
// 这四条是「用户此刻卡住了、而且没有别的把手」的结局 —— wire 给的 decide 入口在这里才有用。
|
|
136412
|
+
case "not-parked":
|
|
136413
|
+
case "state-unknown":
|
|
136414
|
+
case "cancel-failed":
|
|
136415
|
+
case "budget-exhausted":
|
|
136416
|
+
return base + decidePathClause(signal);
|
|
136417
|
+
// healed = 已经解开了;两条 plan-review 臂与 decision-pending 手上都另有一张更好的把手
|
|
136418
|
+
// (重开的卡 / 已开的卡 / 基句自己渲的 decidePath)—— 再叠一条引擎路由只会稀释那一个动作。
|
|
136419
|
+
default:
|
|
136420
|
+
return base;
|
|
136421
|
+
}
|
|
136208
136422
|
}
|
|
136209
|
-
function activeRunSelfHealBaseRow(outcome) {
|
|
136423
|
+
function activeRunSelfHealBaseRow(outcome, signal) {
|
|
136210
136424
|
switch (outcome.kind) {
|
|
136211
136425
|
case "decision-pending":
|
|
136212
136426
|
return `This session is held by an earlier turn${outcome.taskId ? ` (run ${outcome.taskId})` : ""} that is waiting on a decision you have not made yet, and there is a decision card open for it. sema did NOT cancel it \u2014 answering that card is what releases the session, and cancelling would decide it for you. Your message was NOT sent; answer the open card and send it again.`;
|
|
136213
136427
|
case "healed": {
|
|
136214
|
-
const cost2 =
|
|
136428
|
+
const cost2 = healedCostClause(signal);
|
|
136215
136429
|
void outcome.status;
|
|
136216
136430
|
return `Your previous turn was parked (run ${outcome.taskId}) and was still holding this session, so nothing new could start \u2014 ${cost2}. sema cancelled that parked run and re-sent this message.`;
|
|
136217
136431
|
}
|
|
@@ -136222,6 +136436,9 @@ function activeRunSelfHealBaseRow(outcome) {
|
|
|
136222
136436
|
return `The previous turn is parked waiting for a plan review (run ${outcome.taskId}) and sema could not reopen that approval card. It did NOT cancel the run \u2014 that would have discarded the plan for you. Your message was NOT sent; ${INTERACTIVE_WAY_OUT} if you no longer want that plan.${viaEngine}`;
|
|
136223
136437
|
}
|
|
136224
136438
|
case "not-parked":
|
|
136439
|
+
if (signal?.pendingGate) {
|
|
136440
|
+
return `This session is held by an earlier run (run ${outcome.taskId}, status ${outcome.status}) that is waiting on ${gateKindPhrase(signal.pendingGate.kind)} \u2014 it will not finish on its own. sema did NOT cancel it, because cancelling would decide that item for you. Your message was NOT sent; ${INTERACTIVE_WAY_OUT} if you no longer want it.`;
|
|
136441
|
+
}
|
|
136225
136442
|
return `This session already has a run in flight (run ${outcome.taskId}, status ${outcome.status}) \u2014 most likely a turn you sent to the background. sema did NOT cancel it, because that would throw away work you asked for. Wait for it to finish, or ${INTERACTIVE_WAY_OUT}.`;
|
|
136226
136443
|
case "state-unknown":
|
|
136227
136444
|
return `This session is locked by an earlier run${outcome.taskId ? ` (run ${outcome.taskId})` : ""} and sema could not read that run's state, so it did not touch it (${outcome.detail}). Your message was NOT sent. This session cannot start a new turn until that run settles \u2014 ${INTERACTIVE_WAY_OUT}.`;
|
|
@@ -136231,14 +136448,25 @@ function activeRunSelfHealBaseRow(outcome) {
|
|
|
136231
136448
|
return `This session is still locked${outcome.taskId ? ` by run ${outcome.taskId}` : ""} after sema already cancelled one parked run for this message. Not retrying again (a second automatic cancel would only spin). Your message was NOT sent \u2014 ${INTERACTIVE_WAY_OUT}.`;
|
|
136232
136449
|
}
|
|
136233
136450
|
}
|
|
136234
|
-
function activeRunBusyHeadlessRow(
|
|
136451
|
+
function activeRunBusyHeadlessRow(signal) {
|
|
136452
|
+
const activeTaskId = signal.activeTaskId;
|
|
136235
136453
|
const handle2 = activeTaskId ? ` (run ${activeTaskId})` : "";
|
|
136236
|
-
|
|
136454
|
+
const cancelPath = `POST /v1/runs/${activeTaskId ?? "<id>"}/cancel`;
|
|
136455
|
+
const status3 = signal.activeTaskStatus;
|
|
136456
|
+
const decidePath = signal.pendingGate?.decidePath ?? null;
|
|
136457
|
+
const freshSession = "start a new session (drop --resume/--continue)";
|
|
136458
|
+
if (decidePath) {
|
|
136459
|
+
return `This session is held by an earlier run${handle2}${status3 ? ` (status ${status3})` : ""} that is parked waiting on ${gateKindPhrase(signal.pendingGate?.kind)}, so this message was NOT sent. Decide it and the session unlocks: POST ${decidePath}. Cancelling instead (${cancelPath}) also unlocks it, but it decides that item against you. Or ${freshSession}.`;
|
|
136460
|
+
}
|
|
136461
|
+
if (status3) {
|
|
136462
|
+
return `This session is held by an earlier run${handle2} with status ${status3}, so this message was NOT sent. The engine reported no decision pending on that run: if it is still working, wait for it to finish; if it will never settle, release it with ${cancelPath} (that discards whatever it was doing). Or ${freshSession}.`;
|
|
136463
|
+
}
|
|
136464
|
+
return `This session is locked by an earlier run${handle2} that was never released, so this message was NOT sent. Nothing here clears on its own. Start a new session (drop --resume/--continue), or release the run on the engine: ${cancelPath}`;
|
|
136237
136465
|
}
|
|
136238
|
-
var
|
|
136466
|
+
var PLAN_REVIEW_STATES, ASK_PARK_STATES, ACTIVE_RUN_SELF_HEAL_MAX_ATTEMPTS, INTERACTIVE_WAY_OUT;
|
|
136239
136467
|
var init_activeRunSelfHeal = __esm({
|
|
136240
136468
|
"build-src/src/sema/activeRunSelfHeal.ts"() {
|
|
136241
|
-
|
|
136469
|
+
init_dist();
|
|
136242
136470
|
PLAN_REVIEW_STATES = ["needs_review"];
|
|
136243
136471
|
ASK_PARK_STATES = ["suspended"];
|
|
136244
136472
|
ACTIVE_RUN_SELF_HEAL_MAX_ATTEMPTS = 1;
|
|
@@ -136300,7 +136528,7 @@ function rewriteActiveRunBusyRow(msgs, seen2) {
|
|
|
136300
136528
|
...m2,
|
|
136301
136529
|
message: {
|
|
136302
136530
|
...envelope,
|
|
136303
|
-
content: [{ type: "text", text: activeRunBusyHeadlessRow(busy
|
|
136531
|
+
content: [{ type: "text", text: activeRunBusyHeadlessRow(busy) }]
|
|
136304
136532
|
}
|
|
136305
136533
|
};
|
|
136306
136534
|
continue;
|
|
@@ -137682,79 +137910,6 @@ var init_textModeError = __esm({
|
|
|
137682
137910
|
}
|
|
137683
137911
|
});
|
|
137684
137912
|
|
|
137685
|
-
// build-src/src/sema/subagentDurablePause.ts
|
|
137686
|
-
function detectDurablePauseReport(text2) {
|
|
137687
|
-
const m2 = DURABLE_PAUSE_RE.exec(text2);
|
|
137688
|
-
if (m2 === null) return null;
|
|
137689
|
-
return {
|
|
137690
|
-
status: m2[1],
|
|
137691
|
-
checkpointToken: m2[2] ?? "?",
|
|
137692
|
-
lane: m2[3] === "fork" ? "fork" : "delegation"
|
|
137693
|
-
};
|
|
137694
|
-
}
|
|
137695
|
-
function honestDurablePauseReport(text2, facts) {
|
|
137696
|
-
const what = facts.lane === "fork" ? "fork" : "delegation";
|
|
137697
|
-
return text2.replace(
|
|
137698
|
-
DURABLE_PAUSE_RE,
|
|
137699
|
-
`status: paused
|
|
137700
|
-
paused: the sub-agent stopped at an approval gate and durably paused (${facts.status}). It is waiting for a human decision \u2014 this is NOT a task failure and NOT a tool error.
|
|
137701
|
-
checkpoint: ${facts.checkpointToken}
|
|
137702
|
-
what to do: a nested (sub-agent) durable pause cannot be adjudicated from inside this ${what}, so re-issuing the same approval-gated action will park again. Tell the user the gate is waiting (quote the checkpoint above), and either have the action pre-approved / the permission mode widened before re-running the ${what}, or take a route that does not need that gate. Do NOT report this to the user as a plain failure.`
|
|
137703
|
-
);
|
|
137704
|
-
}
|
|
137705
|
-
function toolResultText(content) {
|
|
137706
|
-
if (typeof content === "string") return content;
|
|
137707
|
-
if (!Array.isArray(content)) return null;
|
|
137708
|
-
const parts = [];
|
|
137709
|
-
for (const b3 of content) {
|
|
137710
|
-
const bb = b3;
|
|
137711
|
-
if (bb?.type === "text" && typeof bb.text === "string") parts.push(bb.text);
|
|
137712
|
-
}
|
|
137713
|
-
return parts.length > 0 ? parts.join("") : null;
|
|
137714
|
-
}
|
|
137715
|
-
function rewriteToolResultContent(content, next) {
|
|
137716
|
-
if (typeof content === "string") return next;
|
|
137717
|
-
if (!Array.isArray(content)) return content;
|
|
137718
|
-
let done = false;
|
|
137719
|
-
return content.map((b3) => {
|
|
137720
|
-
const bb = b3;
|
|
137721
|
-
if (done || bb?.type !== "text" || typeof bb.text !== "string") return b3;
|
|
137722
|
-
done = true;
|
|
137723
|
-
return { ...bb, text: next };
|
|
137724
|
-
});
|
|
137725
|
-
}
|
|
137726
|
-
function reduceSubagentDurablePauseEnvelope(msg) {
|
|
137727
|
-
if (msg.type !== "user") return msg;
|
|
137728
|
-
const message = msg.message;
|
|
137729
|
-
const content = message?.content;
|
|
137730
|
-
if (!Array.isArray(content)) return msg;
|
|
137731
|
-
let changed = false;
|
|
137732
|
-
const next = content.map((block2) => {
|
|
137733
|
-
const b3 = block2;
|
|
137734
|
-
if (b3?.type !== "tool_result") return block2;
|
|
137735
|
-
const text2 = toolResultText(b3.content);
|
|
137736
|
-
if (text2 === null) return block2;
|
|
137737
|
-
const facts = detectDurablePauseReport(text2);
|
|
137738
|
-
if (facts === null) return block2;
|
|
137739
|
-
changed = true;
|
|
137740
|
-
return {
|
|
137741
|
-
...b3,
|
|
137742
|
-
content: rewriteToolResultContent(b3.content, honestDurablePauseReport(text2, facts)),
|
|
137743
|
-
// 🔴 承重位:这是把 park 接回「UserToolResultMessage 的 `if (param.is_error)` →
|
|
137744
|
-
// renderToolUseErrorMessage」那条真会上屏的臂的唯一开关。删了它 = 退回零渲染(病象复发)。
|
|
137745
|
-
is_error: true
|
|
137746
|
-
};
|
|
137747
|
-
});
|
|
137748
|
-
if (!changed) return msg;
|
|
137749
|
-
return { ...msg, message: { ...message, content: next } };
|
|
137750
|
-
}
|
|
137751
|
-
var DURABLE_PAUSE_RE;
|
|
137752
|
-
var init_subagentDurablePause = __esm({
|
|
137753
|
-
"build-src/src/sema/subagentDurablePause.ts"() {
|
|
137754
|
-
DURABLE_PAUSE_RE = /\bstatus: failed\n(?:error: )?unexpected durable pause \((suspended|needs_review), checkpoint ([^)]*)\) — treat this (delegation|fork) as failed; do not retry (?:with )?the same (?:approval-)?gated action\./;
|
|
137755
|
-
}
|
|
137756
|
-
});
|
|
137757
|
-
|
|
137758
137913
|
// build-src/src/sema/appStateRef.ts
|
|
137759
137914
|
var appStateRef_exports = {};
|
|
137760
137915
|
__export(appStateRef_exports, {
|
|
@@ -224758,6 +224913,38 @@ var init_apiErrorSupplement = __esm({
|
|
|
224758
224913
|
}
|
|
224759
224914
|
});
|
|
224760
224915
|
|
|
224916
|
+
// build-src/src/sema/atMentionAttachmentWire.ts
|
|
224917
|
+
function collectSubmissionAttachmentTexts(msgs, submitted, normalize20) {
|
|
224918
|
+
const anchorIdx = msgs.lastIndexOf(submitted);
|
|
224919
|
+
if (anchorIdx < 0) return { ok: true, texts: [] };
|
|
224920
|
+
const out6 = [];
|
|
224921
|
+
for (let i = anchorIdx + 1; i < msgs.length; i++) {
|
|
224922
|
+
const m2 = msgs[i];
|
|
224923
|
+
if (m2?.type === "assistant") break;
|
|
224924
|
+
if (m2?.type !== "attachment" || !m2.attachment) continue;
|
|
224925
|
+
let projected2;
|
|
224926
|
+
try {
|
|
224927
|
+
projected2 = normalize20(m2.attachment);
|
|
224928
|
+
} catch (e) {
|
|
224929
|
+
return { ok: false, reason: `malformed attachment payload: ${String(e)}` };
|
|
224930
|
+
}
|
|
224931
|
+
for (const am of projected2) {
|
|
224932
|
+
const c2 = am?.message?.content;
|
|
224933
|
+
if (typeof c2 === "string") out6.push(c2);
|
|
224934
|
+
else if (Array.isArray(c2)) {
|
|
224935
|
+
for (const b3 of c2) {
|
|
224936
|
+
if (b3?.type === "text" && typeof b3.text === "string" && b3.text.trim().length > 0) out6.push(b3.text);
|
|
224937
|
+
}
|
|
224938
|
+
}
|
|
224939
|
+
}
|
|
224940
|
+
}
|
|
224941
|
+
return { ok: true, texts: out6 };
|
|
224942
|
+
}
|
|
224943
|
+
var init_atMentionAttachmentWire = __esm({
|
|
224944
|
+
"build-src/src/sema/atMentionAttachmentWire.ts"() {
|
|
224945
|
+
}
|
|
224946
|
+
});
|
|
224947
|
+
|
|
224761
224948
|
// build-src/src/sema/engineRuntimeStatus.ts
|
|
224762
224949
|
var engineRuntimeStatus_exports = {};
|
|
224763
224950
|
__export(engineRuntimeStatus_exports, {
|
|
@@ -226808,6 +226995,8 @@ function resetDeadRespawnStateForTests() {
|
|
|
226808
226995
|
recentDeathTimestamps = [];
|
|
226809
226996
|
cooldownRetryPending = false;
|
|
226810
226997
|
cooldownRetryLevel = 0;
|
|
226998
|
+
cooldownRetriesUsed = 0;
|
|
226999
|
+
cooldownSpentMs = 0;
|
|
226811
227000
|
cooldownRetryFire = void 0;
|
|
226812
227001
|
cooldownRetryAt = 0;
|
|
226813
227002
|
lastRespawnOkAt = null;
|
|
@@ -226826,18 +227015,8 @@ function stampFailedNextRetryAt() {
|
|
|
226826
227015
|
} catch {
|
|
226827
227016
|
}
|
|
226828
227017
|
}
|
|
226829
|
-
function
|
|
226830
|
-
|
|
226831
|
-
stampFailedNextRetryAt();
|
|
226832
|
-
return;
|
|
226833
|
-
}
|
|
226834
|
-
cooldownRetryPending = true;
|
|
226835
|
-
const delay = nextCooldownDelayMs();
|
|
226836
|
-
cooldownRetryLevel++;
|
|
226837
|
-
logForDebugging(
|
|
226838
|
-
`[engine-lifecycle] engine auto-restart parked \u2014 cooldown retry scheduled in ${Math.round(delay / 1e3)}s`
|
|
226839
|
-
);
|
|
226840
|
-
const fire = () => {
|
|
227018
|
+
function makeCooldownFire(deps2) {
|
|
227019
|
+
return () => {
|
|
226841
227020
|
cooldownRetryPending = false;
|
|
226842
227021
|
cooldownRetryFire = void 0;
|
|
226843
227022
|
cooldownRetryAt = 0;
|
|
@@ -226850,6 +227029,33 @@ function scheduleCooldownRetry(deps2) {
|
|
|
226850
227029
|
void runEngineDeadRespawn(deps2).catch(() => {
|
|
226851
227030
|
});
|
|
226852
227031
|
};
|
|
227032
|
+
}
|
|
227033
|
+
function giveUpOnAutoRestart(deps2) {
|
|
227034
|
+
cooldownRetryAt = 0;
|
|
227035
|
+
cooldownRetryFire = makeCooldownFire(deps2);
|
|
227036
|
+
const spentMin = Math.max(1, Math.round(cooldownSpentMs / 6e4));
|
|
227037
|
+
const detail = `automatic engine restart gave up after ${cooldownRetriesUsed} cooldown attempts over ~${spentMin} minutes \u2014 sema is not retrying on its own any more. Send a message to retry now, run sema doctor, or restart sema.`;
|
|
227038
|
+
logForDebugging(`[engine-lifecycle] ${detail}`);
|
|
227039
|
+
setEngineRuntimeStatus({ phase: "failed", detail });
|
|
227040
|
+
}
|
|
227041
|
+
function scheduleCooldownRetry(deps2) {
|
|
227042
|
+
if (cooldownRetryPending) {
|
|
227043
|
+
stampFailedNextRetryAt();
|
|
227044
|
+
return;
|
|
227045
|
+
}
|
|
227046
|
+
if (cooldownRetriesUsed >= CRASH_LOOP_COOLDOWN_MAX_RETRIES) {
|
|
227047
|
+
giveUpOnAutoRestart(deps2);
|
|
227048
|
+
return;
|
|
227049
|
+
}
|
|
227050
|
+
cooldownRetryPending = true;
|
|
227051
|
+
const delay = nextCooldownDelayMs();
|
|
227052
|
+
cooldownRetryLevel++;
|
|
227053
|
+
cooldownRetriesUsed++;
|
|
227054
|
+
cooldownSpentMs += delay;
|
|
227055
|
+
logForDebugging(
|
|
227056
|
+
`[engine-lifecycle] engine auto-restart parked \u2014 cooldown retry ${cooldownRetriesUsed}/${CRASH_LOOP_COOLDOWN_MAX_RETRIES} scheduled in ${Math.round(delay / 1e3)}s`
|
|
227057
|
+
);
|
|
227058
|
+
const fire = makeCooldownFire(deps2);
|
|
226853
227059
|
cooldownRetryFire = fire;
|
|
226854
227060
|
cooldownRetryAt = Date.now() + delay;
|
|
226855
227061
|
stampFailedNextRetryAt();
|
|
@@ -226861,9 +227067,11 @@ function scheduleCooldownRetry(deps2) {
|
|
|
226861
227067
|
if (typeof cooldownRetryTimer.unref === "function") cooldownRetryTimer.unref();
|
|
226862
227068
|
}
|
|
226863
227069
|
function requestEngineRetryNow() {
|
|
226864
|
-
if (!
|
|
227070
|
+
if (!cooldownRetryFire) return false;
|
|
226865
227071
|
if (deadRespawnInFlight) return false;
|
|
226866
227072
|
logForDebugging("[engine-lifecycle] manual retry-now requested \u2014 firing the parked cooldown retry immediately");
|
|
227073
|
+
cooldownRetriesUsed = 0;
|
|
227074
|
+
cooldownSpentMs = 0;
|
|
226867
227075
|
cooldownRetryFire();
|
|
226868
227076
|
return true;
|
|
226869
227077
|
}
|
|
@@ -226884,6 +227092,8 @@ async function runEngineDeadRespawn(deps2) {
|
|
|
226884
227092
|
const t2 = now2();
|
|
226885
227093
|
if (lastRespawnOkAt !== null && t2 - lastRespawnOkAt >= CRASH_LOOP_WINDOW_MS) {
|
|
226886
227094
|
cooldownRetryLevel = 0;
|
|
227095
|
+
cooldownRetriesUsed = 0;
|
|
227096
|
+
cooldownSpentMs = 0;
|
|
226887
227097
|
}
|
|
226888
227098
|
recentDeathTimestamps = recentDeathTimestamps.filter((d4) => t2 - d4 < CRASH_LOOP_WINDOW_MS);
|
|
226889
227099
|
recentDeathTimestamps.push(t2);
|
|
@@ -227164,7 +227374,7 @@ async function waitForExit(pid, timeoutMs) {
|
|
|
227164
227374
|
}
|
|
227165
227375
|
return !isProcessAlive(pid);
|
|
227166
227376
|
}
|
|
227167
|
-
var PORT_FILE_VERSION, HEALTH_POLL_INTERVAL_MS, HEALTH_POLL_MAX_ATTEMPTS, HEALTH_FETCH_TIMEOUT_MS, HEARTBEAT_INTERVAL_MS, HEARTBEAT_MAX_MISSES, SHUTDOWN_GRACE_MS, SHUTDOWN_SECOND_TERM_GRACE_MS, LOCK_OPTS2, ENGINE_LOCK_WAIT_MS_DEFAULT, ENGINE_LOCK_WAIT_POLL_MS, WORKFLOW_SIZE_GUIDELINE_VALUES, RETIRED_ENV_RENAMES, lastServiceAuthToken, lastInitFailureReason, lastInitFailureDetail, localEngineActive, DERIVED_PORT_PROBE_MAX, expectedExitPids, onOwnedEngineExitCb, deadRespawnInFlight, CRASH_LOOP_WINDOW_MS, CRASH_LOOP_MAX_DEATHS, recentDeathTimestamps, CRASH_LOOP_COOLDOWN_BASE_MS, CRASH_LOOP_COOLDOWN_CAP_MS, cooldownRetryPending, cooldownRetryLevel, cooldownRetryFire, cooldownRetryTimer, cooldownRetryAt, lastRespawnOkAt, teardownGetInstance, teardownInstalled, teardownDone;
|
|
227377
|
+
var PORT_FILE_VERSION, HEALTH_POLL_INTERVAL_MS, HEALTH_POLL_MAX_ATTEMPTS, HEALTH_FETCH_TIMEOUT_MS, HEARTBEAT_INTERVAL_MS, HEARTBEAT_MAX_MISSES, SHUTDOWN_GRACE_MS, SHUTDOWN_SECOND_TERM_GRACE_MS, LOCK_OPTS2, ENGINE_LOCK_WAIT_MS_DEFAULT, ENGINE_LOCK_WAIT_POLL_MS, WORKFLOW_SIZE_GUIDELINE_VALUES, RETIRED_ENV_RENAMES, lastServiceAuthToken, lastInitFailureReason, lastInitFailureDetail, localEngineActive, DERIVED_PORT_PROBE_MAX, expectedExitPids, onOwnedEngineExitCb, deadRespawnInFlight, CRASH_LOOP_WINDOW_MS, CRASH_LOOP_MAX_DEATHS, recentDeathTimestamps, CRASH_LOOP_COOLDOWN_BASE_MS, CRASH_LOOP_COOLDOWN_CAP_MS, CRASH_LOOP_COOLDOWN_MAX_RETRIES, cooldownRetryPending, cooldownRetryLevel, cooldownRetriesUsed, cooldownSpentMs, cooldownRetryFire, cooldownRetryTimer, cooldownRetryAt, lastRespawnOkAt, teardownGetInstance, teardownInstalled, teardownDone;
|
|
227168
227378
|
var init_engineLifecycleManager = __esm({
|
|
227169
227379
|
"build-src/src/sema/engineLifecycleManager.ts"() {
|
|
227170
227380
|
init_state2();
|
|
@@ -227205,8 +227415,11 @@ var init_engineLifecycleManager = __esm({
|
|
|
227205
227415
|
recentDeathTimestamps = [];
|
|
227206
227416
|
CRASH_LOOP_COOLDOWN_BASE_MS = 6e4;
|
|
227207
227417
|
CRASH_LOOP_COOLDOWN_CAP_MS = 10 * 6e4;
|
|
227418
|
+
CRASH_LOOP_COOLDOWN_MAX_RETRIES = 6;
|
|
227208
227419
|
cooldownRetryPending = false;
|
|
227209
227420
|
cooldownRetryLevel = 0;
|
|
227421
|
+
cooldownRetriesUsed = 0;
|
|
227422
|
+
cooldownSpentMs = 0;
|
|
227210
227423
|
cooldownRetryAt = 0;
|
|
227211
227424
|
lastRespawnOkAt = null;
|
|
227212
227425
|
teardownGetInstance = null;
|
|
@@ -228228,6 +228441,18 @@ function toTaskRequest(params) {
|
|
|
228228
228441
|
}
|
|
228229
228442
|
}
|
|
228230
228443
|
}
|
|
228444
|
+
if (submitted) {
|
|
228445
|
+
const collected = collectSubmissionAttachmentTexts(msgs, submitted, normalizeAttachmentForAPI);
|
|
228446
|
+
if (!collected.ok) {
|
|
228447
|
+
process.stderr.write(`[sema] @-mention attachment could not be included in the message \u2014 ${collected.reason}
|
|
228448
|
+
`);
|
|
228449
|
+
} else if (collected.texts.length > 0) {
|
|
228450
|
+
objective = [...collected.texts, objective].join("\n\n");
|
|
228451
|
+
if (process.env.SEMA_DEBUG) {
|
|
228452
|
+
console.error(`[sema][seamQuery] at-mention attachments wire: ${collected.texts.length} block(s) \u2192 objective prefix`);
|
|
228453
|
+
}
|
|
228454
|
+
}
|
|
228455
|
+
}
|
|
228231
228456
|
const standaloneMeta = trailingStandaloneMetaUserMessages(msgs);
|
|
228232
228457
|
let metaIsSubmission = false;
|
|
228233
228458
|
if (standaloneMeta.length > 0) {
|
|
@@ -228666,7 +228891,7 @@ Setup looks unfinished (no model was saved). Run \`sema onboard\` to finish setu
|
|
|
228666
228891
|
reopenPlanReview: reopenPlanReviewCard
|
|
228667
228892
|
})
|
|
228668
228893
|
) : { kind: "budget-exhausted", taskId: detectedBusy.activeTaskId };
|
|
228669
|
-
yield apiErrorRow(activeRunSelfHealRow(outcome));
|
|
228894
|
+
yield apiErrorRow(activeRunSelfHealRow(outcome, detectedBusy));
|
|
228670
228895
|
if (outcome.kind === "healed") {
|
|
228671
228896
|
selfHealAttempts++;
|
|
228672
228897
|
retryStream = true;
|
|
@@ -228852,6 +229077,7 @@ var init_seamQuery = __esm({
|
|
|
228852
229077
|
init_controlRouterStore();
|
|
228853
229078
|
init_apiErrorSupplement();
|
|
228854
229079
|
init_messages4();
|
|
229080
|
+
init_atMentionAttachmentWire();
|
|
228855
229081
|
init_dist();
|
|
228856
229082
|
init_log2();
|
|
228857
229083
|
init_engineRuntimeStatus();
|
|
@@ -309861,9 +310087,9 @@ function copyTextOf(msg) {
|
|
|
309861
310087
|
return tc ? PRIMARY_INPUT[tc.name]?.extract(tc.input) ?? "" : "";
|
|
309862
310088
|
}
|
|
309863
310089
|
case "grouped_tool_use":
|
|
309864
|
-
return msg.results.map(
|
|
310090
|
+
return msg.results.map(toolResultText).filter(Boolean).join("\n\n");
|
|
309865
310091
|
case "collapsed_read_search":
|
|
309866
|
-
return msg.messages.flatMap((m2) => m2.type === "user" ? [
|
|
310092
|
+
return msg.messages.flatMap((m2) => m2.type === "user" ? [toolResultText(m2)] : m2.type === "grouped_tool_use" ? m2.results.map(toolResultText) : []).filter(Boolean).join("\n\n");
|
|
309867
310093
|
case "system":
|
|
309868
310094
|
if ("content" in msg) return msg.content;
|
|
309869
310095
|
if ("error" in msg) return String(msg.error);
|
|
@@ -309879,7 +310105,7 @@ function copyTextOf(msg) {
|
|
|
309879
310105
|
}
|
|
309880
310106
|
return "";
|
|
309881
310107
|
}
|
|
309882
|
-
function
|
|
310108
|
+
function toolResultText(r) {
|
|
309883
310109
|
const b3 = r.message.content[0];
|
|
309884
310110
|
if (b3?.type !== "tool_result") return "";
|
|
309885
310111
|
const c2 = b3.content;
|
|
@@ -501752,8 +501978,8 @@ var init_sema_brand = __esm({
|
|
|
501752
501978
|
"Bulk stop now lists the rows it could not stop with a named reason, and quota/scenario refusals carry a plain-language line next to the machine-readable error"
|
|
501753
501979
|
]
|
|
501754
501980
|
},
|
|
501755
|
-
productVersion: "1.0.
|
|
501756
|
-
announcement: 'sema 1.0.
|
|
501981
|
+
productVersion: "1.0.67",
|
|
501982
|
+
announcement: 'sema 1.0.67 \u2014 Final verification is now OFF by default for -p runs: it could overwrite a correct result while re-checking it; opt in with --final-verify or SEMA_HEADLESS_FINAL_VERIFY=true. --max-tokens now actually enforces a token budget (the old wire key was never adopted by the engine \u2014 requests silently ran unbounded; the run now fails loudly with partial output when the budget is hit). A sub-agent that pauses at an approval gate is reported honestly end-to-end (engine-side fix; the shell-side workaround was removed), and when the session is locked by an active run, every message now shows the concrete way out instead of a bare busy error. Engine crash recovery is bounded: after ~35 minutes of automatic retries sema stops, tells you how long it tried, and leaves a working manual retry. Workflow agent details now show "requested <model> \u2192 running on <model>" when a delegated agent ran on a different model than asked. Engine 6.4.0, core 5.10.0, SDK 6.3.0, client-core 0.17.1, registry-core 0.14.0.'
|
|
501757
501983
|
};
|
|
501758
501984
|
}
|
|
501759
501985
|
});
|
|
@@ -508087,8 +508313,8 @@ var require_sema_brand = __commonJS({
|
|
|
508087
508313
|
"Bulk stop now lists the rows it could not stop with a named reason, and quota/scenario refusals carry a plain-language line next to the machine-readable error"
|
|
508088
508314
|
]
|
|
508089
508315
|
},
|
|
508090
|
-
productVersion: "1.0.
|
|
508091
|
-
announcement: 'sema 1.0.
|
|
508316
|
+
productVersion: "1.0.67",
|
|
508317
|
+
announcement: 'sema 1.0.67 \u2014 Final verification is now OFF by default for -p runs: it could overwrite a correct result while re-checking it; opt in with --final-verify or SEMA_HEADLESS_FINAL_VERIFY=true. --max-tokens now actually enforces a token budget (the old wire key was never adopted by the engine \u2014 requests silently ran unbounded; the run now fails loudly with partial output when the budget is hit). A sub-agent that pauses at an approval gate is reported honestly end-to-end (engine-side fix; the shell-side workaround was removed), and when the session is locked by an active run, every message now shows the concrete way out instead of a bare busy error. Engine crash recovery is bounded: after ~35 minutes of automatic retries sema stops, tells you how long it tried, and leaves a working manual retry. Workflow agent details now show "requested <model> \u2192 running on <model>" when a delegated agent ran on a different model than asked. Engine 6.4.0, core 5.10.0, SDK 6.3.0, client-core 0.17.1, registry-core 0.14.0.'
|
|
508092
508318
|
};
|
|
508093
508319
|
}
|
|
508094
508320
|
});
|
|
@@ -553640,9 +553866,7 @@ async function* sdkMessagesToCcEvents(sdk, meta3) {
|
|
|
553640
553866
|
macrotaskPending = false;
|
|
553641
553867
|
}
|
|
553642
553868
|
if (out6.plane === "transcript") {
|
|
553643
|
-
const msg =
|
|
553644
|
-
reduceApiErrorEnvelope(out6.message)
|
|
553645
|
-
);
|
|
553869
|
+
const msg = reduceApiErrorEnvelope(out6.message);
|
|
553646
553870
|
noteModelEvidenceFrom(msg);
|
|
553647
553871
|
const w2 = notifWatch.get(seenFrameNo);
|
|
553648
553872
|
if (w2 !== void 0 && !w2.rowYielded && isTaskNotificationRow(msg)) w2.rowYielded = true;
|
|
@@ -553660,7 +553884,6 @@ var init_upstreamBridge = __esm({
|
|
|
553660
553884
|
init_dist();
|
|
553661
553885
|
init_bridgeAdapter();
|
|
553662
553886
|
init_textModeError();
|
|
553663
|
-
init_subagentDurablePause();
|
|
553664
553887
|
init_appStateRef();
|
|
553665
553888
|
init_modelVerificationStore();
|
|
553666
553889
|
init_retryStatusStore();
|
|
@@ -568577,144 +568800,6 @@ var init_a2a = __esm({
|
|
|
568577
568800
|
}
|
|
568578
568801
|
});
|
|
568579
568802
|
|
|
568580
|
-
// node_modules/@sema-agent/core/dist/agents/tool-filter.js
|
|
568581
|
-
var init_tool_filter = __esm({
|
|
568582
|
-
"node_modules/@sema-agent/core/dist/agents/tool-filter.js"() {
|
|
568583
|
-
}
|
|
568584
|
-
});
|
|
568585
|
-
|
|
568586
|
-
// node_modules/@sema-agent/core/dist/agents/builtin-agents.js
|
|
568587
|
-
var init_builtin_agents = __esm({
|
|
568588
|
-
"node_modules/@sema-agent/core/dist/agents/builtin-agents.js"() {
|
|
568589
|
-
}
|
|
568590
|
-
});
|
|
568591
|
-
|
|
568592
|
-
// node_modules/@sema-agent/core/dist/agents/suspend-guard.js
|
|
568593
|
-
var init_suspend_guard = __esm({
|
|
568594
|
-
"node_modules/@sema-agent/core/dist/agents/suspend-guard.js"() {
|
|
568595
|
-
}
|
|
568596
|
-
});
|
|
568597
|
-
|
|
568598
|
-
// node_modules/@sema-agent/core/dist/core/untrusted-egress.js
|
|
568599
|
-
function redactUserinfo2(scheme, userinfoWithAt) {
|
|
568600
|
-
const userinfo = userinfoWithAt.slice(0, -1);
|
|
568601
|
-
if (userinfo.includes("@"))
|
|
568602
|
-
return `${scheme}[redacted-credentials]@`;
|
|
568603
|
-
const colonIdx = userinfo.indexOf(":");
|
|
568604
|
-
if (colonIdx === -1) {
|
|
568605
|
-
return userinfo.length >= BARE_USERNAME_MAX_LEN ? `${scheme}[redacted-credentials]@` : `${scheme}${userinfo}@`;
|
|
568606
|
-
}
|
|
568607
|
-
return `${scheme}${userinfo.slice(0, colonIdx)}:[redacted-credentials]@`;
|
|
568608
|
-
}
|
|
568609
|
-
function redactSecrets3(s, report) {
|
|
568610
|
-
return runRedactionPasses(s, SECRET_TIER_PASSES, report);
|
|
568611
|
-
}
|
|
568612
|
-
function countRedactionMarkers(s) {
|
|
568613
|
-
return (s.match(REDACTION_MARKER_RE) ?? []).length;
|
|
568614
|
-
}
|
|
568615
|
-
function safeEllipsisTruncate(s, max2) {
|
|
568616
|
-
if (max2 < 1)
|
|
568617
|
-
return "";
|
|
568618
|
-
const budget = max2 - 1;
|
|
568619
|
-
let out6 = "";
|
|
568620
|
-
for (const codePoint of s) {
|
|
568621
|
-
if (out6.length + codePoint.length > budget)
|
|
568622
|
-
break;
|
|
568623
|
-
out6 += codePoint;
|
|
568624
|
-
}
|
|
568625
|
-
return out6 + "\u2026";
|
|
568626
|
-
}
|
|
568627
|
-
function boundedString(value, max2, redact) {
|
|
568628
|
-
let s;
|
|
568629
|
-
try {
|
|
568630
|
-
s = typeof value === "string" ? value : JSON.stringify(value) ?? String(value);
|
|
568631
|
-
} catch {
|
|
568632
|
-
s = "[unserializable result]";
|
|
568633
|
-
}
|
|
568634
|
-
s = redact(s);
|
|
568635
|
-
if (s.length <= max2)
|
|
568636
|
-
return s;
|
|
568637
|
-
const totalMarkers = countRedactionMarkers(s);
|
|
568638
|
-
const plainSuffix = (kept) => `\u2026[+${s.length - kept.length} chars]`;
|
|
568639
|
-
const enrichedSuffix = (kept) => {
|
|
568640
|
-
const lost = totalMarkers - countRedactionMarkers(kept);
|
|
568641
|
-
return lost > 0 ? `\u2026[+${s.length - kept.length} chars, ${lost} redaction marker(s) among them]` : plainSuffix(kept);
|
|
568642
|
-
};
|
|
568643
|
-
const converge = (suffixFor) => {
|
|
568644
|
-
let keep = max2;
|
|
568645
|
-
let out7 = "";
|
|
568646
|
-
for (let i = 0; i < 4; i++) {
|
|
568647
|
-
const kept = sliceHeadSafe(s, keep);
|
|
568648
|
-
out7 = `${kept}${suffixFor(kept)}`;
|
|
568649
|
-
if (out7.length <= max2)
|
|
568650
|
-
return out7;
|
|
568651
|
-
if (keep === 0)
|
|
568652
|
-
return void 0;
|
|
568653
|
-
keep = Math.max(0, keep - (out7.length - max2));
|
|
568654
|
-
}
|
|
568655
|
-
return out7.length <= max2 ? out7 : void 0;
|
|
568656
|
-
};
|
|
568657
|
-
const out6 = (totalMarkers > 0 ? converge(enrichedSuffix) : void 0) ?? converge(plainSuffix);
|
|
568658
|
-
if (out6 === void 0) {
|
|
568659
|
-
return safeEllipsisTruncate(s, max2);
|
|
568660
|
-
}
|
|
568661
|
-
if (out6.length >= s.length)
|
|
568662
|
-
return s;
|
|
568663
|
-
return out6;
|
|
568664
|
-
}
|
|
568665
|
-
function boundedRedactedSummary(value, max2) {
|
|
568666
|
-
return boundedString(value, max2, redactSecrets3);
|
|
568667
|
-
}
|
|
568668
|
-
var URI_SCHEME, CREDENTIALS_IN_AUTHORITY, URL_OF_ANY_PROTOCOL, BARE_USERNAME_MAX_LEN, SECRET_TIER_PASSES, HOST_LEAK_PASSES, REDACTION_MARKER_RE;
|
|
568669
|
-
var init_untrusted_egress = __esm({
|
|
568670
|
-
"node_modules/@sema-agent/core/dist/core/untrusted-egress.js"() {
|
|
568671
|
-
init_untrusted_text();
|
|
568672
|
-
init_arg_summary();
|
|
568673
|
-
init_surrogate_safe_slice();
|
|
568674
|
-
init_arg_summary();
|
|
568675
|
-
URI_SCHEME = String.raw`[A-Za-z][A-Za-z0-9+.\-_]{0,63}`;
|
|
568676
|
-
CREDENTIALS_IN_AUTHORITY = new RegExp(String.raw`(${URI_SCHEME}:\/\/)((?:[^/\s"'@]*@)+)`, "gi");
|
|
568677
|
-
URL_OF_ANY_PROTOCOL = new RegExp(String.raw`${URI_SCHEME}:\/\/[^\s"'\`]+`, "gi");
|
|
568678
|
-
BARE_USERNAME_MAX_LEN = 20;
|
|
568679
|
-
SECRET_TIER_PASSES = [
|
|
568680
|
-
...SECRET_PASSES,
|
|
568681
|
-
{
|
|
568682
|
-
kind: "url-credentials",
|
|
568683
|
-
confidence: "medium",
|
|
568684
|
-
marker: "[redacted-credentials]",
|
|
568685
|
-
source: "untrusted-egress",
|
|
568686
|
-
re: CREDENTIALS_IN_AUTHORITY,
|
|
568687
|
-
replace: (_m, scheme, userinfo) => redactUserinfo2(scheme, userinfo)
|
|
568688
|
-
},
|
|
568689
|
-
{ kind: "signed-url-param", confidence: "high", marker: "[redacted]", source: "untrusted-egress", re: /([?&#](?:sig|signature|sas|code)=)[^&\s"'#]+/gi, replace: "$1[redacted]" }
|
|
568690
|
-
];
|
|
568691
|
-
HOST_LEAK_PASSES = [
|
|
568692
|
-
...SECRET_TIER_PASSES,
|
|
568693
|
-
{ kind: "url", confidence: "medium", marker: "[redacted-url]", source: "untrusted-egress", re: URL_OF_ANY_PROTOCOL, replace: "[redacted-url]" },
|
|
568694
|
-
{ kind: "fs-path", confidence: "low", marker: "[redacted-path]", source: "untrusted-egress", re: /(?:\/[A-Za-z0-9_.-]+){2,}/g, replace: "[redacted-path]" }
|
|
568695
|
-
];
|
|
568696
|
-
REDACTION_MARKER_RE = /\[redacted(?:-[a-z]+)?\]/g;
|
|
568697
|
-
}
|
|
568698
|
-
});
|
|
568699
|
-
|
|
568700
|
-
// node_modules/@sema-agent/core/dist/core/git-worktree-env.js
|
|
568701
|
-
var WORKTREE_PARENT;
|
|
568702
|
-
var init_git_worktree_env = __esm({
|
|
568703
|
-
"node_modules/@sema-agent/core/dist/core/git-worktree-env.js"() {
|
|
568704
|
-
WORKTREE_PARENT = ".sema-worktrees";
|
|
568705
|
-
}
|
|
568706
|
-
});
|
|
568707
|
-
|
|
568708
|
-
// node_modules/@sema-agent/core/dist/tools/fs/search.js
|
|
568709
|
-
var FILE_MAX_BYTES;
|
|
568710
|
-
var init_search = __esm({
|
|
568711
|
-
"node_modules/@sema-agent/core/dist/tools/fs/search.js"() {
|
|
568712
|
-
init_untrusted_text();
|
|
568713
|
-
init_safety();
|
|
568714
|
-
FILE_MAX_BYTES = 5 * 1024 * 1024;
|
|
568715
|
-
}
|
|
568716
|
-
});
|
|
568717
|
-
|
|
568718
568803
|
// node_modules/@sema-agent/core/dist/core/background-agent-store.js
|
|
568719
568804
|
var background_agent_store_exports = {};
|
|
568720
568805
|
__export(background_agent_store_exports, {
|
|
@@ -569047,6 +569132,108 @@ var init_workflow_run_store = __esm({
|
|
|
569047
569132
|
}
|
|
569048
569133
|
});
|
|
569049
569134
|
|
|
569135
|
+
// node_modules/@sema-agent/core/dist/core/untrusted-egress.js
|
|
569136
|
+
function redactUserinfo2(scheme, userinfoWithAt) {
|
|
569137
|
+
const userinfo = userinfoWithAt.slice(0, -1);
|
|
569138
|
+
if (userinfo.includes("@"))
|
|
569139
|
+
return `${scheme}[redacted-credentials]@`;
|
|
569140
|
+
const colonIdx = userinfo.indexOf(":");
|
|
569141
|
+
if (colonIdx === -1) {
|
|
569142
|
+
return userinfo.length >= BARE_USERNAME_MAX_LEN ? `${scheme}[redacted-credentials]@` : `${scheme}${userinfo}@`;
|
|
569143
|
+
}
|
|
569144
|
+
return `${scheme}${userinfo.slice(0, colonIdx)}:[redacted-credentials]@`;
|
|
569145
|
+
}
|
|
569146
|
+
function redactSecrets3(s, report) {
|
|
569147
|
+
return runRedactionPasses(s, SECRET_TIER_PASSES, report);
|
|
569148
|
+
}
|
|
569149
|
+
function countRedactionMarkers(s) {
|
|
569150
|
+
return (s.match(REDACTION_MARKER_RE) ?? []).length;
|
|
569151
|
+
}
|
|
569152
|
+
function safeEllipsisTruncate(s, max2) {
|
|
569153
|
+
if (max2 < 1)
|
|
569154
|
+
return "";
|
|
569155
|
+
const budget = max2 - 1;
|
|
569156
|
+
let out6 = "";
|
|
569157
|
+
for (const codePoint of s) {
|
|
569158
|
+
if (out6.length + codePoint.length > budget)
|
|
569159
|
+
break;
|
|
569160
|
+
out6 += codePoint;
|
|
569161
|
+
}
|
|
569162
|
+
return out6 + "\u2026";
|
|
569163
|
+
}
|
|
569164
|
+
function boundedString(value, max2, redact) {
|
|
569165
|
+
let s;
|
|
569166
|
+
try {
|
|
569167
|
+
s = typeof value === "string" ? value : JSON.stringify(value) ?? String(value);
|
|
569168
|
+
} catch {
|
|
569169
|
+
s = "[unserializable result]";
|
|
569170
|
+
}
|
|
569171
|
+
s = redact(s);
|
|
569172
|
+
if (s.length <= max2)
|
|
569173
|
+
return s;
|
|
569174
|
+
const totalMarkers = countRedactionMarkers(s);
|
|
569175
|
+
const plainSuffix = (kept) => `\u2026[+${s.length - kept.length} chars]`;
|
|
569176
|
+
const enrichedSuffix = (kept) => {
|
|
569177
|
+
const lost = totalMarkers - countRedactionMarkers(kept);
|
|
569178
|
+
return lost > 0 ? `\u2026[+${s.length - kept.length} chars, ${lost} redaction marker(s) among them]` : plainSuffix(kept);
|
|
569179
|
+
};
|
|
569180
|
+
const converge = (suffixFor) => {
|
|
569181
|
+
let keep = max2;
|
|
569182
|
+
let out7 = "";
|
|
569183
|
+
for (let i = 0; i < 4; i++) {
|
|
569184
|
+
const kept = sliceHeadSafe(s, keep);
|
|
569185
|
+
out7 = `${kept}${suffixFor(kept)}`;
|
|
569186
|
+
if (out7.length <= max2)
|
|
569187
|
+
return out7;
|
|
569188
|
+
if (keep === 0)
|
|
569189
|
+
return void 0;
|
|
569190
|
+
keep = Math.max(0, keep - (out7.length - max2));
|
|
569191
|
+
}
|
|
569192
|
+
return out7.length <= max2 ? out7 : void 0;
|
|
569193
|
+
};
|
|
569194
|
+
const out6 = (totalMarkers > 0 ? converge(enrichedSuffix) : void 0) ?? converge(plainSuffix);
|
|
569195
|
+
if (out6 === void 0) {
|
|
569196
|
+
return safeEllipsisTruncate(s, max2);
|
|
569197
|
+
}
|
|
569198
|
+
if (out6.length >= s.length)
|
|
569199
|
+
return s;
|
|
569200
|
+
return out6;
|
|
569201
|
+
}
|
|
569202
|
+
function boundedRedactedSummary(value, max2) {
|
|
569203
|
+
return boundedString(value, max2, redactSecrets3);
|
|
569204
|
+
}
|
|
569205
|
+
var URI_SCHEME, CREDENTIALS_IN_AUTHORITY, URL_OF_ANY_PROTOCOL, BARE_USERNAME_MAX_LEN, SECRET_TIER_PASSES, HOST_LEAK_PASSES, REDACTION_MARKER_RE;
|
|
569206
|
+
var init_untrusted_egress = __esm({
|
|
569207
|
+
"node_modules/@sema-agent/core/dist/core/untrusted-egress.js"() {
|
|
569208
|
+
init_untrusted_text();
|
|
569209
|
+
init_arg_summary();
|
|
569210
|
+
init_surrogate_safe_slice();
|
|
569211
|
+
init_arg_summary();
|
|
569212
|
+
URI_SCHEME = String.raw`[A-Za-z][A-Za-z0-9+.\-_]{0,63}`;
|
|
569213
|
+
CREDENTIALS_IN_AUTHORITY = new RegExp(String.raw`(${URI_SCHEME}:\/\/)((?:[^/\s"'@]*@)+)`, "gi");
|
|
569214
|
+
URL_OF_ANY_PROTOCOL = new RegExp(String.raw`${URI_SCHEME}:\/\/[^\s"'\`]+`, "gi");
|
|
569215
|
+
BARE_USERNAME_MAX_LEN = 20;
|
|
569216
|
+
SECRET_TIER_PASSES = [
|
|
569217
|
+
...SECRET_PASSES,
|
|
569218
|
+
{
|
|
569219
|
+
kind: "url-credentials",
|
|
569220
|
+
confidence: "medium",
|
|
569221
|
+
marker: "[redacted-credentials]",
|
|
569222
|
+
source: "untrusted-egress",
|
|
569223
|
+
re: CREDENTIALS_IN_AUTHORITY,
|
|
569224
|
+
replace: (_m, scheme, userinfo) => redactUserinfo2(scheme, userinfo)
|
|
569225
|
+
},
|
|
569226
|
+
{ kind: "signed-url-param", confidence: "high", marker: "[redacted]", source: "untrusted-egress", re: /([?&#](?:sig|signature|sas|code)=)[^&\s"'#]+/gi, replace: "$1[redacted]" }
|
|
569227
|
+
];
|
|
569228
|
+
HOST_LEAK_PASSES = [
|
|
569229
|
+
...SECRET_TIER_PASSES,
|
|
569230
|
+
{ kind: "url", confidence: "medium", marker: "[redacted-url]", source: "untrusted-egress", re: URL_OF_ANY_PROTOCOL, replace: "[redacted-url]" },
|
|
569231
|
+
{ kind: "fs-path", confidence: "low", marker: "[redacted-path]", source: "untrusted-egress", re: /(?:\/[A-Za-z0-9_.-]+){2,}/g, replace: "[redacted-path]" }
|
|
569232
|
+
];
|
|
569233
|
+
REDACTION_MARKER_RE = /\[redacted(?:-[a-z]+)?\]/g;
|
|
569234
|
+
}
|
|
569235
|
+
});
|
|
569236
|
+
|
|
569050
569237
|
// node_modules/@sema-agent/core/dist/core/task-registry-shared.js
|
|
569051
569238
|
function mintCompletionId(target) {
|
|
569052
569239
|
if (target.completionId === void 0)
|
|
@@ -572382,6 +572569,283 @@ ${shape(stderr) || "(none)"}`;
|
|
|
572382
572569
|
}
|
|
572383
572570
|
});
|
|
572384
572571
|
|
|
572572
|
+
// node_modules/@sema-agent/core/dist/tools/fs/search.js
|
|
572573
|
+
var FILE_MAX_BYTES;
|
|
572574
|
+
var init_search = __esm({
|
|
572575
|
+
"node_modules/@sema-agent/core/dist/tools/fs/search.js"() {
|
|
572576
|
+
init_untrusted_text();
|
|
572577
|
+
init_safety();
|
|
572578
|
+
FILE_MAX_BYTES = 5 * 1024 * 1024;
|
|
572579
|
+
}
|
|
572580
|
+
});
|
|
572581
|
+
|
|
572582
|
+
// node_modules/@sema-agent/core/dist/tools/fs/repo-map.js
|
|
572583
|
+
var FILE_SCAN_MAX_BYTES;
|
|
572584
|
+
var init_repo_map = __esm({
|
|
572585
|
+
"node_modules/@sema-agent/core/dist/tools/fs/repo-map.js"() {
|
|
572586
|
+
init_build3();
|
|
572587
|
+
init_tools3();
|
|
572588
|
+
init_safety();
|
|
572589
|
+
init_search();
|
|
572590
|
+
FILE_SCAN_MAX_BYTES = 256 * 1024;
|
|
572591
|
+
}
|
|
572592
|
+
});
|
|
572593
|
+
|
|
572594
|
+
// node_modules/@sema-agent/core/dist/tools/fs/encoding.js
|
|
572595
|
+
var init_encoding = __esm({
|
|
572596
|
+
"node_modules/@sema-agent/core/dist/tools/fs/encoding.js"() {
|
|
572597
|
+
}
|
|
572598
|
+
});
|
|
572599
|
+
|
|
572600
|
+
// node_modules/@sema-agent/core/dist/tools/fs/notebook.js
|
|
572601
|
+
var init_notebook2 = __esm({
|
|
572602
|
+
"node_modules/@sema-agent/core/dist/tools/fs/notebook.js"() {
|
|
572603
|
+
init_safety();
|
|
572604
|
+
}
|
|
572605
|
+
});
|
|
572606
|
+
|
|
572607
|
+
// node_modules/@sema-agent/core/dist/tools/fs/fs-shared.js
|
|
572608
|
+
var MAX_READ_BYTES2, SLICED_READ_MAX_BYTES, MAX_EDIT_BYTES, MAX_IMAGE_READ_BYTES, MAX_IMAGE_DOWNSAMPLE_INPUT_BYTES, NO_DOWNSAMPLER_IMAGE_CAP_HINT, BASH_DEFAULT_TIMEOUT_SEC, BASH_MAX_TIMEOUT_SEC, BASH_DEFAULT_TIMEOUT_MS2, BASH_MAX_TIMEOUT_MS, FILE_PATH_PARAMS;
|
|
572609
|
+
var init_fs_shared = __esm({
|
|
572610
|
+
"node_modules/@sema-agent/core/dist/tools/fs/fs-shared.js"() {
|
|
572611
|
+
init_build3();
|
|
572612
|
+
init_tool_errors();
|
|
572613
|
+
init_safety();
|
|
572614
|
+
init_encoding();
|
|
572615
|
+
init_search();
|
|
572616
|
+
init_notebook2();
|
|
572617
|
+
init_mcp4();
|
|
572618
|
+
MAX_READ_BYTES2 = 256 * 1024;
|
|
572619
|
+
SLICED_READ_MAX_BYTES = 64 * 1024 * 1024;
|
|
572620
|
+
MAX_EDIT_BYTES = 1024 * 1024 * 1024;
|
|
572621
|
+
MAX_IMAGE_READ_BYTES = 5 * 1024 * 1024;
|
|
572622
|
+
MAX_IMAGE_DOWNSAMPLE_INPUT_BYTES = 64 * 1024 * 1024;
|
|
572623
|
+
NO_DOWNSAMPLER_IMAGE_CAP_HINT = `Install the optional "sharp" dependency (declared in this package's optionalDependencies) to read images up to ${MAX_IMAGE_DOWNSAMPLE_INPUT_BYTES} bytes \u2014 it downsamples them to fit the API image limit.`;
|
|
572624
|
+
BASH_DEFAULT_TIMEOUT_SEC = 120;
|
|
572625
|
+
BASH_MAX_TIMEOUT_SEC = 600;
|
|
572626
|
+
BASH_DEFAULT_TIMEOUT_MS2 = BASH_DEFAULT_TIMEOUT_SEC * 1e3;
|
|
572627
|
+
BASH_MAX_TIMEOUT_MS = BASH_MAX_TIMEOUT_SEC * 1e3;
|
|
572628
|
+
FILE_PATH_PARAMS = {
|
|
572629
|
+
file_path: typebox_exports.String({ description: "File path (within the configured root)." })
|
|
572630
|
+
};
|
|
572631
|
+
}
|
|
572632
|
+
});
|
|
572633
|
+
|
|
572634
|
+
// node_modules/@sema-agent/core/dist/tools/fs/pdf.js
|
|
572635
|
+
var PDF_TARGET_RAW_SIZE2, PDF_MAX_EXTRACT_SIZE2;
|
|
572636
|
+
var init_pdf2 = __esm({
|
|
572637
|
+
"node_modules/@sema-agent/core/dist/tools/fs/pdf.js"() {
|
|
572638
|
+
PDF_TARGET_RAW_SIZE2 = 20 * 1024 * 1024;
|
|
572639
|
+
PDF_MAX_EXTRACT_SIZE2 = 100 * 1024 * 1024;
|
|
572640
|
+
}
|
|
572641
|
+
});
|
|
572642
|
+
|
|
572643
|
+
// node_modules/@sema-agent/core/dist/tools/fs/fs-pdf.js
|
|
572644
|
+
var init_fs_pdf = __esm({
|
|
572645
|
+
"node_modules/@sema-agent/core/dist/tools/fs/fs-pdf.js"() {
|
|
572646
|
+
init_tools3();
|
|
572647
|
+
init_untrusted_text();
|
|
572648
|
+
init_mcp4();
|
|
572649
|
+
init_pdf2();
|
|
572650
|
+
init_fs_shared();
|
|
572651
|
+
init_pdf2();
|
|
572652
|
+
}
|
|
572653
|
+
});
|
|
572654
|
+
|
|
572655
|
+
// node_modules/@sema-agent/core/dist/tools/fs/fs-read.js
|
|
572656
|
+
var init_fs_read = __esm({
|
|
572657
|
+
"node_modules/@sema-agent/core/dist/tools/fs/fs-read.js"() {
|
|
572658
|
+
init_build3();
|
|
572659
|
+
init_tools3();
|
|
572660
|
+
init_safety();
|
|
572661
|
+
init_encoding();
|
|
572662
|
+
init_notebook2();
|
|
572663
|
+
init_mcp4();
|
|
572664
|
+
init_pdf2();
|
|
572665
|
+
init_fs_shared();
|
|
572666
|
+
init_fs_pdf();
|
|
572667
|
+
}
|
|
572668
|
+
});
|
|
572669
|
+
|
|
572670
|
+
// node_modules/@sema-agent/core/dist/tools/fs/fs-write.js
|
|
572671
|
+
var init_fs_write = __esm({
|
|
572672
|
+
"node_modules/@sema-agent/core/dist/tools/fs/fs-write.js"() {
|
|
572673
|
+
init_build3();
|
|
572674
|
+
init_tools3();
|
|
572675
|
+
init_safety();
|
|
572676
|
+
init_encoding();
|
|
572677
|
+
init_fs_shared();
|
|
572678
|
+
}
|
|
572679
|
+
});
|
|
572680
|
+
|
|
572681
|
+
// node_modules/@sema-agent/core/dist/tools/fs/fs-search-tools.js
|
|
572682
|
+
var init_fs_search_tools = __esm({
|
|
572683
|
+
"node_modules/@sema-agent/core/dist/tools/fs/fs-search-tools.js"() {
|
|
572684
|
+
init_build3();
|
|
572685
|
+
init_tools3();
|
|
572686
|
+
init_safety();
|
|
572687
|
+
init_search();
|
|
572688
|
+
}
|
|
572689
|
+
});
|
|
572690
|
+
|
|
572691
|
+
// node_modules/@sema-agent/core/dist/tools/fs/bash-readonly-classifier.js
|
|
572692
|
+
var init_bash_readonly_classifier = __esm({
|
|
572693
|
+
"node_modules/@sema-agent/core/dist/tools/fs/bash-readonly-classifier.js"() {
|
|
572694
|
+
init_safety();
|
|
572695
|
+
}
|
|
572696
|
+
});
|
|
572697
|
+
|
|
572698
|
+
// node_modules/@sema-agent/core/dist/core/remote-env.js
|
|
572699
|
+
var init_remote_env3 = __esm({
|
|
572700
|
+
"node_modules/@sema-agent/core/dist/core/remote-env.js"() {
|
|
572701
|
+
}
|
|
572702
|
+
});
|
|
572703
|
+
|
|
572704
|
+
// node_modules/@sema-agent/core/dist/tools/fs/gh-rate-limit.js
|
|
572705
|
+
var init_gh_rate_limit = __esm({
|
|
572706
|
+
"node_modules/@sema-agent/core/dist/tools/fs/gh-rate-limit.js"() {
|
|
572707
|
+
}
|
|
572708
|
+
});
|
|
572709
|
+
|
|
572710
|
+
// node_modules/@sema-agent/core/dist/tools/fs/fs-bash.js
|
|
572711
|
+
var init_fs_bash = __esm({
|
|
572712
|
+
"node_modules/@sema-agent/core/dist/tools/fs/fs-bash.js"() {
|
|
572713
|
+
init_build3();
|
|
572714
|
+
init_tools3();
|
|
572715
|
+
init_task_registry();
|
|
572716
|
+
init_task_registry_shared();
|
|
572717
|
+
init_task_tool_shape();
|
|
572718
|
+
init_background_shell();
|
|
572719
|
+
init_untrusted_text();
|
|
572720
|
+
init_mcp4();
|
|
572721
|
+
init_safety();
|
|
572722
|
+
init_remote_env3();
|
|
572723
|
+
init_gh_rate_limit();
|
|
572724
|
+
init_fs_shared();
|
|
572725
|
+
init_bash_readonly_classifier();
|
|
572726
|
+
}
|
|
572727
|
+
});
|
|
572728
|
+
|
|
572729
|
+
// node_modules/@sema-agent/core/dist/tools/fs/index.js
|
|
572730
|
+
var init_fs = __esm({
|
|
572731
|
+
"node_modules/@sema-agent/core/dist/tools/fs/index.js"() {
|
|
572732
|
+
init_task_registry();
|
|
572733
|
+
init_background_shell();
|
|
572734
|
+
init_safety();
|
|
572735
|
+
init_repo_map();
|
|
572736
|
+
init_fs_shared();
|
|
572737
|
+
init_fs_pdf();
|
|
572738
|
+
init_fs_read();
|
|
572739
|
+
init_fs_write();
|
|
572740
|
+
init_fs_search_tools();
|
|
572741
|
+
init_bash_readonly_classifier();
|
|
572742
|
+
init_fs_bash();
|
|
572743
|
+
init_bash_readonly_classifier();
|
|
572744
|
+
init_fs_shared();
|
|
572745
|
+
init_fs_read();
|
|
572746
|
+
init_fs_write();
|
|
572747
|
+
init_fs_search_tools();
|
|
572748
|
+
init_fs_bash();
|
|
572749
|
+
}
|
|
572750
|
+
});
|
|
572751
|
+
|
|
572752
|
+
// node_modules/@sema-agent/core/dist/core/tool-policy.js
|
|
572753
|
+
function refuseOutOfContractDecision(d4) {
|
|
572754
|
+
if (typeof d4 !== "object" || d4 === null)
|
|
572755
|
+
return d4;
|
|
572756
|
+
if (!Object.prototype.hasOwnProperty.call(d4, RETIRED_TEXT_FIELD))
|
|
572757
|
+
return d4;
|
|
572758
|
+
return { action: "deny", message: RETIRED_TEXT_FIELD_DENY_MESSAGE, decisionReason: "rule" };
|
|
572759
|
+
}
|
|
572760
|
+
function toolPolicyNameSets(p) {
|
|
572761
|
+
const sets = p?.nameSets;
|
|
572762
|
+
return Array.isArray(sets) ? sets : [];
|
|
572763
|
+
}
|
|
572764
|
+
function createAllowDenyPolicy(opts) {
|
|
572765
|
+
const allow = opts.allow ? new Set(opts.allow) : void 0;
|
|
572766
|
+
const deny2 = new Set(opts.deny ?? []);
|
|
572767
|
+
return {
|
|
572768
|
+
nameSets: [{ ...opts.allow ? { allow: [...opts.allow] } : {}, ...opts.deny ? { deny: [...opts.deny] } : {} }],
|
|
572769
|
+
check(req) {
|
|
572770
|
+
const toolName2 = req.toolName;
|
|
572771
|
+
if (deny2.has(toolName2)) {
|
|
572772
|
+
return { action: "deny", message: `tool "${req.toolName}" is denied by policy` };
|
|
572773
|
+
}
|
|
572774
|
+
if (allow && !allow.has(toolName2)) {
|
|
572775
|
+
return { action: "deny", message: `tool "${req.toolName}" is not in the allowlist` };
|
|
572776
|
+
}
|
|
572777
|
+
return ALLOW;
|
|
572778
|
+
}
|
|
572779
|
+
};
|
|
572780
|
+
}
|
|
572781
|
+
function combinePolicies(...policies) {
|
|
572782
|
+
const nameSets = policies.flatMap(toolPolicyNameSets);
|
|
572783
|
+
return {
|
|
572784
|
+
...nameSets.length > 0 ? { nameSets } : {},
|
|
572785
|
+
async check(req, signal) {
|
|
572786
|
+
let asked;
|
|
572787
|
+
let current5 = req;
|
|
572788
|
+
let rewrite;
|
|
572789
|
+
for (const p of policies) {
|
|
572790
|
+
const d4 = refuseOutOfContractDecision(await p.check(current5, signal));
|
|
572791
|
+
if (d4.action === "deny") {
|
|
572792
|
+
return rewrite?.updatedInput !== void 0 ? { ...d4, updatedInput: rewrite.updatedInput } : d4;
|
|
572793
|
+
}
|
|
572794
|
+
if (d4.updatedInput !== void 0) {
|
|
572795
|
+
current5 = { ...current5, args: d4.updatedInput };
|
|
572796
|
+
rewrite = d4;
|
|
572797
|
+
}
|
|
572798
|
+
if (d4.action === "ask" && (asked === void 0 || d4.requiresRealApproval === true && asked.requiresRealApproval !== true)) {
|
|
572799
|
+
asked = d4;
|
|
572800
|
+
}
|
|
572801
|
+
}
|
|
572802
|
+
if (asked) {
|
|
572803
|
+
const merged = rewrite?.updatedInput;
|
|
572804
|
+
return merged !== void 0 ? { ...asked, updatedInput: merged } : asked;
|
|
572805
|
+
}
|
|
572806
|
+
return rewrite ?? ALLOW;
|
|
572807
|
+
}
|
|
572808
|
+
};
|
|
572809
|
+
}
|
|
572810
|
+
var ALLOW, RETIRED_TEXT_FIELD, RETIRED_TEXT_FIELD_DENY_MESSAGE, COARSE_SHELL_TOOLS, CASE_INSENSITIVE_FS;
|
|
572811
|
+
var init_tool_policy = __esm({
|
|
572812
|
+
"node_modules/@sema-agent/core/dist/core/tool-policy.js"() {
|
|
572813
|
+
init_fs();
|
|
572814
|
+
init_safety();
|
|
572815
|
+
ALLOW = { action: "allow" };
|
|
572816
|
+
RETIRED_TEXT_FIELD = "reason";
|
|
572817
|
+
RETIRED_TEXT_FIELD_DENY_MESSAGE = `a permission decision carries the retired "${RETIRED_TEXT_FIELD}" field \u2014 rename it to "message" (the one text field a decision carries); denied fail-closed rather than executing a decision whose text this layer cannot read`;
|
|
572818
|
+
COARSE_SHELL_TOOLS = ["Bash", "Monitor"];
|
|
572819
|
+
CASE_INSENSITIVE_FS = process.platform === "darwin" || process.platform === "win32";
|
|
572820
|
+
}
|
|
572821
|
+
});
|
|
572822
|
+
|
|
572823
|
+
// node_modules/@sema-agent/core/dist/agents/tool-filter.js
|
|
572824
|
+
var init_tool_filter = __esm({
|
|
572825
|
+
"node_modules/@sema-agent/core/dist/agents/tool-filter.js"() {
|
|
572826
|
+
}
|
|
572827
|
+
});
|
|
572828
|
+
|
|
572829
|
+
// node_modules/@sema-agent/core/dist/agents/builtin-agents.js
|
|
572830
|
+
var init_builtin_agents = __esm({
|
|
572831
|
+
"node_modules/@sema-agent/core/dist/agents/builtin-agents.js"() {
|
|
572832
|
+
}
|
|
572833
|
+
});
|
|
572834
|
+
|
|
572835
|
+
// node_modules/@sema-agent/core/dist/agents/suspend-guard.js
|
|
572836
|
+
var init_suspend_guard = __esm({
|
|
572837
|
+
"node_modules/@sema-agent/core/dist/agents/suspend-guard.js"() {
|
|
572838
|
+
}
|
|
572839
|
+
});
|
|
572840
|
+
|
|
572841
|
+
// node_modules/@sema-agent/core/dist/core/git-worktree-env.js
|
|
572842
|
+
var WORKTREE_PARENT;
|
|
572843
|
+
var init_git_worktree_env = __esm({
|
|
572844
|
+
"node_modules/@sema-agent/core/dist/core/git-worktree-env.js"() {
|
|
572845
|
+
WORKTREE_PARENT = ".sema-worktrees";
|
|
572846
|
+
}
|
|
572847
|
+
});
|
|
572848
|
+
|
|
572385
572849
|
// node_modules/@sema-agent/core/dist/agents/retain-ledger.js
|
|
572386
572850
|
var init_retain_ledger = __esm({
|
|
572387
572851
|
"node_modules/@sema-agent/core/dist/agents/retain-ledger.js"() {
|
|
@@ -572630,6 +573094,7 @@ var EXTRA_TOOLS_MAX_FACTORY_CALLS_PER_TREE, EXTRA_TOOLS_BUDGET_NOTE, FAILED_SESS
|
|
|
572630
573094
|
var init_subagent = __esm({
|
|
572631
573095
|
"node_modules/@sema-agent/core/dist/agents/subagent.js"() {
|
|
572632
573096
|
init_build3();
|
|
573097
|
+
init_tool_policy();
|
|
572633
573098
|
init_roles();
|
|
572634
573099
|
init_synthetic_tools();
|
|
572635
573100
|
init_tool_disclosure();
|
|
@@ -572687,253 +573152,15 @@ var init_send_message_tool = __esm({
|
|
|
572687
573152
|
}
|
|
572688
573153
|
});
|
|
572689
573154
|
|
|
572690
|
-
// node_modules/@sema-agent/core/dist/tools/fs/repo-map.js
|
|
572691
|
-
var FILE_SCAN_MAX_BYTES;
|
|
572692
|
-
var init_repo_map = __esm({
|
|
572693
|
-
"node_modules/@sema-agent/core/dist/tools/fs/repo-map.js"() {
|
|
572694
|
-
init_build3();
|
|
572695
|
-
init_tools3();
|
|
572696
|
-
init_safety();
|
|
572697
|
-
init_search();
|
|
572698
|
-
FILE_SCAN_MAX_BYTES = 256 * 1024;
|
|
572699
|
-
}
|
|
572700
|
-
});
|
|
572701
|
-
|
|
572702
|
-
// node_modules/@sema-agent/core/dist/tools/fs/encoding.js
|
|
572703
|
-
var init_encoding = __esm({
|
|
572704
|
-
"node_modules/@sema-agent/core/dist/tools/fs/encoding.js"() {
|
|
572705
|
-
}
|
|
572706
|
-
});
|
|
572707
|
-
|
|
572708
|
-
// node_modules/@sema-agent/core/dist/tools/fs/notebook.js
|
|
572709
|
-
var init_notebook2 = __esm({
|
|
572710
|
-
"node_modules/@sema-agent/core/dist/tools/fs/notebook.js"() {
|
|
572711
|
-
init_safety();
|
|
572712
|
-
}
|
|
572713
|
-
});
|
|
572714
|
-
|
|
572715
|
-
// node_modules/@sema-agent/core/dist/tools/fs/fs-shared.js
|
|
572716
|
-
var MAX_READ_BYTES2, SLICED_READ_MAX_BYTES, MAX_EDIT_BYTES, MAX_IMAGE_READ_BYTES, MAX_IMAGE_DOWNSAMPLE_INPUT_BYTES, NO_DOWNSAMPLER_IMAGE_CAP_HINT, BASH_DEFAULT_TIMEOUT_SEC, BASH_MAX_TIMEOUT_SEC, BASH_DEFAULT_TIMEOUT_MS2, BASH_MAX_TIMEOUT_MS, FILE_PATH_PARAMS;
|
|
572717
|
-
var init_fs_shared = __esm({
|
|
572718
|
-
"node_modules/@sema-agent/core/dist/tools/fs/fs-shared.js"() {
|
|
572719
|
-
init_build3();
|
|
572720
|
-
init_tool_errors();
|
|
572721
|
-
init_safety();
|
|
572722
|
-
init_encoding();
|
|
572723
|
-
init_search();
|
|
572724
|
-
init_notebook2();
|
|
572725
|
-
init_mcp4();
|
|
572726
|
-
MAX_READ_BYTES2 = 256 * 1024;
|
|
572727
|
-
SLICED_READ_MAX_BYTES = 64 * 1024 * 1024;
|
|
572728
|
-
MAX_EDIT_BYTES = 1024 * 1024 * 1024;
|
|
572729
|
-
MAX_IMAGE_READ_BYTES = 5 * 1024 * 1024;
|
|
572730
|
-
MAX_IMAGE_DOWNSAMPLE_INPUT_BYTES = 64 * 1024 * 1024;
|
|
572731
|
-
NO_DOWNSAMPLER_IMAGE_CAP_HINT = `Install the optional "sharp" dependency (declared in this package's optionalDependencies) to read images up to ${MAX_IMAGE_DOWNSAMPLE_INPUT_BYTES} bytes \u2014 it downsamples them to fit the API image limit.`;
|
|
572732
|
-
BASH_DEFAULT_TIMEOUT_SEC = 120;
|
|
572733
|
-
BASH_MAX_TIMEOUT_SEC = 600;
|
|
572734
|
-
BASH_DEFAULT_TIMEOUT_MS2 = BASH_DEFAULT_TIMEOUT_SEC * 1e3;
|
|
572735
|
-
BASH_MAX_TIMEOUT_MS = BASH_MAX_TIMEOUT_SEC * 1e3;
|
|
572736
|
-
FILE_PATH_PARAMS = {
|
|
572737
|
-
file_path: typebox_exports.String({ description: "File path (within the configured root)." })
|
|
572738
|
-
};
|
|
572739
|
-
}
|
|
572740
|
-
});
|
|
572741
|
-
|
|
572742
|
-
// node_modules/@sema-agent/core/dist/tools/fs/pdf.js
|
|
572743
|
-
var PDF_TARGET_RAW_SIZE2, PDF_MAX_EXTRACT_SIZE2;
|
|
572744
|
-
var init_pdf2 = __esm({
|
|
572745
|
-
"node_modules/@sema-agent/core/dist/tools/fs/pdf.js"() {
|
|
572746
|
-
PDF_TARGET_RAW_SIZE2 = 20 * 1024 * 1024;
|
|
572747
|
-
PDF_MAX_EXTRACT_SIZE2 = 100 * 1024 * 1024;
|
|
572748
|
-
}
|
|
572749
|
-
});
|
|
572750
|
-
|
|
572751
|
-
// node_modules/@sema-agent/core/dist/tools/fs/fs-pdf.js
|
|
572752
|
-
var init_fs_pdf = __esm({
|
|
572753
|
-
"node_modules/@sema-agent/core/dist/tools/fs/fs-pdf.js"() {
|
|
572754
|
-
init_tools3();
|
|
572755
|
-
init_untrusted_text();
|
|
572756
|
-
init_mcp4();
|
|
572757
|
-
init_pdf2();
|
|
572758
|
-
init_fs_shared();
|
|
572759
|
-
init_pdf2();
|
|
572760
|
-
}
|
|
572761
|
-
});
|
|
572762
|
-
|
|
572763
|
-
// node_modules/@sema-agent/core/dist/tools/fs/fs-read.js
|
|
572764
|
-
var init_fs_read = __esm({
|
|
572765
|
-
"node_modules/@sema-agent/core/dist/tools/fs/fs-read.js"() {
|
|
572766
|
-
init_build3();
|
|
572767
|
-
init_tools3();
|
|
572768
|
-
init_safety();
|
|
572769
|
-
init_encoding();
|
|
572770
|
-
init_notebook2();
|
|
572771
|
-
init_mcp4();
|
|
572772
|
-
init_pdf2();
|
|
572773
|
-
init_fs_shared();
|
|
572774
|
-
init_fs_pdf();
|
|
572775
|
-
}
|
|
572776
|
-
});
|
|
572777
|
-
|
|
572778
|
-
// node_modules/@sema-agent/core/dist/tools/fs/fs-write.js
|
|
572779
|
-
var init_fs_write = __esm({
|
|
572780
|
-
"node_modules/@sema-agent/core/dist/tools/fs/fs-write.js"() {
|
|
572781
|
-
init_build3();
|
|
572782
|
-
init_tools3();
|
|
572783
|
-
init_safety();
|
|
572784
|
-
init_encoding();
|
|
572785
|
-
init_fs_shared();
|
|
572786
|
-
}
|
|
572787
|
-
});
|
|
572788
|
-
|
|
572789
|
-
// node_modules/@sema-agent/core/dist/tools/fs/fs-search-tools.js
|
|
572790
|
-
var init_fs_search_tools = __esm({
|
|
572791
|
-
"node_modules/@sema-agent/core/dist/tools/fs/fs-search-tools.js"() {
|
|
572792
|
-
init_build3();
|
|
572793
|
-
init_tools3();
|
|
572794
|
-
init_safety();
|
|
572795
|
-
init_search();
|
|
572796
|
-
}
|
|
572797
|
-
});
|
|
572798
|
-
|
|
572799
|
-
// node_modules/@sema-agent/core/dist/tools/fs/bash-readonly-classifier.js
|
|
572800
|
-
var init_bash_readonly_classifier = __esm({
|
|
572801
|
-
"node_modules/@sema-agent/core/dist/tools/fs/bash-readonly-classifier.js"() {
|
|
572802
|
-
init_safety();
|
|
572803
|
-
}
|
|
572804
|
-
});
|
|
572805
|
-
|
|
572806
|
-
// node_modules/@sema-agent/core/dist/core/remote-env.js
|
|
572807
|
-
var init_remote_env3 = __esm({
|
|
572808
|
-
"node_modules/@sema-agent/core/dist/core/remote-env.js"() {
|
|
572809
|
-
}
|
|
572810
|
-
});
|
|
572811
|
-
|
|
572812
|
-
// node_modules/@sema-agent/core/dist/tools/fs/gh-rate-limit.js
|
|
572813
|
-
var init_gh_rate_limit = __esm({
|
|
572814
|
-
"node_modules/@sema-agent/core/dist/tools/fs/gh-rate-limit.js"() {
|
|
572815
|
-
}
|
|
572816
|
-
});
|
|
572817
|
-
|
|
572818
|
-
// node_modules/@sema-agent/core/dist/tools/fs/fs-bash.js
|
|
572819
|
-
var init_fs_bash = __esm({
|
|
572820
|
-
"node_modules/@sema-agent/core/dist/tools/fs/fs-bash.js"() {
|
|
572821
|
-
init_build3();
|
|
572822
|
-
init_tools3();
|
|
572823
|
-
init_task_registry();
|
|
572824
|
-
init_task_registry_shared();
|
|
572825
|
-
init_task_tool_shape();
|
|
572826
|
-
init_background_shell();
|
|
572827
|
-
init_untrusted_text();
|
|
572828
|
-
init_mcp4();
|
|
572829
|
-
init_safety();
|
|
572830
|
-
init_remote_env3();
|
|
572831
|
-
init_gh_rate_limit();
|
|
572832
|
-
init_fs_shared();
|
|
572833
|
-
init_bash_readonly_classifier();
|
|
572834
|
-
}
|
|
572835
|
-
});
|
|
572836
|
-
|
|
572837
|
-
// node_modules/@sema-agent/core/dist/tools/fs/index.js
|
|
572838
|
-
var init_fs = __esm({
|
|
572839
|
-
"node_modules/@sema-agent/core/dist/tools/fs/index.js"() {
|
|
572840
|
-
init_task_registry();
|
|
572841
|
-
init_background_shell();
|
|
572842
|
-
init_safety();
|
|
572843
|
-
init_repo_map();
|
|
572844
|
-
init_fs_shared();
|
|
572845
|
-
init_fs_pdf();
|
|
572846
|
-
init_fs_read();
|
|
572847
|
-
init_fs_write();
|
|
572848
|
-
init_fs_search_tools();
|
|
572849
|
-
init_bash_readonly_classifier();
|
|
572850
|
-
init_fs_bash();
|
|
572851
|
-
init_bash_readonly_classifier();
|
|
572852
|
-
init_fs_shared();
|
|
572853
|
-
init_fs_read();
|
|
572854
|
-
init_fs_write();
|
|
572855
|
-
init_fs_search_tools();
|
|
572856
|
-
init_fs_bash();
|
|
572857
|
-
}
|
|
572858
|
-
});
|
|
572859
|
-
|
|
572860
|
-
// node_modules/@sema-agent/core/dist/core/tool-policy.js
|
|
572861
|
-
function refuseOutOfContractDecision(d4) {
|
|
572862
|
-
if (typeof d4 !== "object" || d4 === null)
|
|
572863
|
-
return d4;
|
|
572864
|
-
if (!Object.prototype.hasOwnProperty.call(d4, RETIRED_TEXT_FIELD))
|
|
572865
|
-
return d4;
|
|
572866
|
-
return { action: "deny", message: RETIRED_TEXT_FIELD_DENY_MESSAGE, decisionReason: "rule" };
|
|
572867
|
-
}
|
|
572868
|
-
function toolPolicyNameSets(p) {
|
|
572869
|
-
const sets = p?.nameSets;
|
|
572870
|
-
return Array.isArray(sets) ? sets : [];
|
|
572871
|
-
}
|
|
572872
|
-
function createAllowDenyPolicy(opts) {
|
|
572873
|
-
const allow = opts.allow ? new Set(opts.allow) : void 0;
|
|
572874
|
-
const deny2 = new Set(opts.deny ?? []);
|
|
572875
|
-
return {
|
|
572876
|
-
nameSets: [{ ...opts.allow ? { allow: [...opts.allow] } : {}, ...opts.deny ? { deny: [...opts.deny] } : {} }],
|
|
572877
|
-
check(req) {
|
|
572878
|
-
const toolName2 = req.toolName;
|
|
572879
|
-
if (deny2.has(toolName2)) {
|
|
572880
|
-
return { action: "deny", message: `tool "${req.toolName}" is denied by policy` };
|
|
572881
|
-
}
|
|
572882
|
-
if (allow && !allow.has(toolName2)) {
|
|
572883
|
-
return { action: "deny", message: `tool "${req.toolName}" is not in the allowlist` };
|
|
572884
|
-
}
|
|
572885
|
-
return ALLOW;
|
|
572886
|
-
}
|
|
572887
|
-
};
|
|
572888
|
-
}
|
|
572889
|
-
function combinePolicies(...policies) {
|
|
572890
|
-
const nameSets = policies.flatMap(toolPolicyNameSets);
|
|
572891
|
-
return {
|
|
572892
|
-
...nameSets.length > 0 ? { nameSets } : {},
|
|
572893
|
-
async check(req, signal) {
|
|
572894
|
-
let asked;
|
|
572895
|
-
let current5 = req;
|
|
572896
|
-
let rewrite;
|
|
572897
|
-
for (const p of policies) {
|
|
572898
|
-
const d4 = refuseOutOfContractDecision(await p.check(current5, signal));
|
|
572899
|
-
if (d4.action === "deny") {
|
|
572900
|
-
return rewrite?.updatedInput !== void 0 ? { ...d4, updatedInput: rewrite.updatedInput } : d4;
|
|
572901
|
-
}
|
|
572902
|
-
if (d4.updatedInput !== void 0) {
|
|
572903
|
-
current5 = { ...current5, args: d4.updatedInput };
|
|
572904
|
-
rewrite = d4;
|
|
572905
|
-
}
|
|
572906
|
-
if (d4.action === "ask" && (asked === void 0 || d4.requiresRealApproval === true && asked.requiresRealApproval !== true)) {
|
|
572907
|
-
asked = d4;
|
|
572908
|
-
}
|
|
572909
|
-
}
|
|
572910
|
-
if (asked) {
|
|
572911
|
-
const merged = rewrite?.updatedInput;
|
|
572912
|
-
return merged !== void 0 ? { ...asked, updatedInput: merged } : asked;
|
|
572913
|
-
}
|
|
572914
|
-
return rewrite ?? ALLOW;
|
|
572915
|
-
}
|
|
572916
|
-
};
|
|
572917
|
-
}
|
|
572918
|
-
var ALLOW, RETIRED_TEXT_FIELD, RETIRED_TEXT_FIELD_DENY_MESSAGE, COARSE_SHELL_TOOLS, CASE_INSENSITIVE_FS;
|
|
572919
|
-
var init_tool_policy = __esm({
|
|
572920
|
-
"node_modules/@sema-agent/core/dist/core/tool-policy.js"() {
|
|
572921
|
-
init_fs();
|
|
572922
|
-
init_safety();
|
|
572923
|
-
ALLOW = { action: "allow" };
|
|
572924
|
-
RETIRED_TEXT_FIELD = "reason";
|
|
572925
|
-
RETIRED_TEXT_FIELD_DENY_MESSAGE = `a permission decision carries the retired "${RETIRED_TEXT_FIELD}" field \u2014 rename it to "message" (the one text field a decision carries); denied fail-closed rather than executing a decision whose text this layer cannot read`;
|
|
572926
|
-
COARSE_SHELL_TOOLS = ["Bash", "Monitor"];
|
|
572927
|
-
CASE_INSENSITIVE_FS = process.platform === "darwin" || process.platform === "win32";
|
|
572928
|
-
}
|
|
572929
|
-
});
|
|
572930
|
-
|
|
572931
573155
|
// node_modules/@sema-agent/core/dist/core/runner/session-rule-policy.js
|
|
573156
|
+
var PATH_WRITE_TOOLS, PATH_CONFINABLE_WRITE_TOOLS;
|
|
572932
573157
|
var init_session_rule_policy = __esm({
|
|
572933
573158
|
"node_modules/@sema-agent/core/dist/core/runner/session-rule-policy.js"() {
|
|
572934
573159
|
init_safety();
|
|
572935
573160
|
init_safety();
|
|
572936
573161
|
init_tool_policy();
|
|
573162
|
+
PATH_WRITE_TOOLS = /* @__PURE__ */ new Set(["Write", "Edit", "MultiEdit"]);
|
|
573163
|
+
PATH_CONFINABLE_WRITE_TOOLS = /* @__PURE__ */ new Set([...PATH_WRITE_TOOLS, "NotebookEdit"]);
|
|
572937
573164
|
}
|
|
572938
573165
|
});
|
|
572939
573166
|
|
|
@@ -573437,6 +573664,13 @@ var init_lsp = __esm({
|
|
|
573437
573664
|
}
|
|
573438
573665
|
});
|
|
573439
573666
|
|
|
573667
|
+
// node_modules/@sema-agent/core/dist/core/runner/session-file-state-replay.js
|
|
573668
|
+
var init_session_file_state_replay = __esm({
|
|
573669
|
+
"node_modules/@sema-agent/core/dist/core/runner/session-file-state-replay.js"() {
|
|
573670
|
+
init_safety();
|
|
573671
|
+
}
|
|
573672
|
+
});
|
|
573673
|
+
|
|
573440
573674
|
// node_modules/@sema-agent/core/dist/core/usage-window-store.js
|
|
573441
573675
|
var EMPTY_USAGE_WINDOW_RECORD;
|
|
573442
573676
|
var init_usage_window_store = __esm({
|
|
@@ -573518,6 +573752,7 @@ var init_prepare_task = __esm({
|
|
|
573518
573752
|
init_workflow_size_guideline();
|
|
573519
573753
|
init_lsp();
|
|
573520
573754
|
init_safety();
|
|
573755
|
+
init_session_file_state_replay();
|
|
573521
573756
|
init_checkpoint_store();
|
|
573522
573757
|
init_canonical_json();
|
|
573523
573758
|
init_usage_window_store();
|
|
@@ -573653,6 +573888,8 @@ var init_web = __esm({
|
|
|
573653
573888
|
init_untrusted_text();
|
|
573654
573889
|
init_untrusted_egress();
|
|
573655
573890
|
init_image();
|
|
573891
|
+
init_safety();
|
|
573892
|
+
init_pdf2();
|
|
573656
573893
|
DEFAULT_MAX_BYTES = 2 * 1024 * 1024;
|
|
573657
573894
|
ERROR_BODY_CONVERT_MAX_CHARS = 64 * 1024;
|
|
573658
573895
|
HTML_CONVERT_MAX_CHARS = 256 * 1024;
|
|
@@ -574942,6 +575179,22 @@ var init_anthropic = __esm({
|
|
|
574942
575179
|
}
|
|
574943
575180
|
});
|
|
574944
575181
|
|
|
575182
|
+
// node_modules/@sema-agent/core/dist/brain/open-responses.js
|
|
575183
|
+
var init_open_responses = __esm({
|
|
575184
|
+
"node_modules/@sema-agent/core/dist/brain/open-responses.js"() {
|
|
575185
|
+
init_llm2();
|
|
575186
|
+
init_errors12();
|
|
575187
|
+
init_repetition();
|
|
575188
|
+
init_stream_shared();
|
|
575189
|
+
init_tool_call_id();
|
|
575190
|
+
init_status_sink();
|
|
575191
|
+
init_media_degrade();
|
|
575192
|
+
init_request_params();
|
|
575193
|
+
init_reasoning();
|
|
575194
|
+
init_stream_engine();
|
|
575195
|
+
}
|
|
575196
|
+
});
|
|
575197
|
+
|
|
574945
575198
|
// node_modules/@sema-agent/core/dist/brain/model-presets.js
|
|
574946
575199
|
var init_model_presets = __esm({
|
|
574947
575200
|
"node_modules/@sema-agent/core/dist/brain/model-presets.js"() {
|
|
@@ -575157,6 +575410,7 @@ var init_dist10 = __esm({
|
|
|
575157
575410
|
init_context_edit();
|
|
575158
575411
|
init_openai();
|
|
575159
575412
|
init_anthropic();
|
|
575413
|
+
init_open_responses();
|
|
575160
575414
|
init_model_presets();
|
|
575161
575415
|
init_failover();
|
|
575162
575416
|
init_routing();
|
|
@@ -576280,6 +576534,7 @@ __export(workflow_detail_dialog_exports, {
|
|
|
576280
576534
|
WorkflowDetailDialog: () => WorkflowDetailDialog2,
|
|
576281
576535
|
activityLine: () => activityLine,
|
|
576282
576536
|
agentDisplayStatus: () => agentDisplayStatus,
|
|
576537
|
+
agentStats: () => agentStats,
|
|
576283
576538
|
buildAgentDetailLines: () => buildAgentDetailLines,
|
|
576284
576539
|
computeVisibleWindow: () => computeVisibleWindow,
|
|
576285
576540
|
default: () => workflow_detail_dialog_default
|
|
@@ -576547,7 +576802,9 @@ function buildAgentDetailLines({
|
|
|
576547
576802
|
const wrapWidth = Math.max(8, width - 2);
|
|
576548
576803
|
const { glyph, color: color4 } = statusGlyph(status3);
|
|
576549
576804
|
const meta3 = [];
|
|
576550
|
-
if (agent.model != null
|
|
576805
|
+
if (agent.model != null && agent.fallbackModel != null && agent.fallbackModel !== agent.model)
|
|
576806
|
+
meta3.push(`requested ${agent.model} \u2192 running on ${agent.fallbackModel}`);
|
|
576807
|
+
else if (agent.model != null) meta3.push(agent.model);
|
|
576551
576808
|
else if (agent.fallbackModel != null) meta3.push(agent.fallbackModel);
|
|
576552
576809
|
if (agent.agentType != null) meta3.push(agent.agentType);
|
|
576553
576810
|
if (agent.isolation != null)
|
|
@@ -593000,7 +593257,7 @@ var init_resumeModelRestore = __esm({
|
|
|
593000
593257
|
init_dist();
|
|
593001
593258
|
init_dist();
|
|
593002
593259
|
RESUME_DECLINE_REASONS = {
|
|
593003
|
-
unknown_family: "not
|
|
593260
|
+
unknown_family: "not in this session's configured model pool \u2014 pick one with /model or add it in settings"
|
|
593004
593261
|
};
|
|
593005
593262
|
}
|
|
593006
593263
|
});
|
|
@@ -632634,8 +632891,8 @@ function _temp159() {
|
|
|
632634
632891
|
var import_compiler_runtime309, import_react312, SETTINGS_ERRORS_NOTIFICATION_KEY;
|
|
632635
632892
|
var init_useSettingsErrors = __esm({
|
|
632636
632893
|
"build-src/src/hooks/notifs/useSettingsErrors.tsx"() {
|
|
632637
|
-
import_compiler_runtime309 = __toESM(require_compiler_runtime()
|
|
632638
|
-
import_react312 = __toESM(require_react()
|
|
632894
|
+
import_compiler_runtime309 = __toESM(require_compiler_runtime());
|
|
632895
|
+
import_react312 = __toESM(require_react());
|
|
632639
632896
|
init_notifications2();
|
|
632640
632897
|
init_state();
|
|
632641
632898
|
init_allErrors();
|
|
@@ -638498,7 +638755,7 @@ Error: sandbox required but unavailable: ${reason}
|
|
|
638498
638755
|
helpers.setCursorOffset(stashedPrompt.cursorOffset);
|
|
638499
638756
|
setPastedContents(stashedPrompt.pastedContents);
|
|
638500
638757
|
setStashedPrompt(void 0);
|
|
638501
|
-
} else
|
|
638758
|
+
} else {
|
|
638502
638759
|
if (!options?.fromKeybinding) {
|
|
638503
638760
|
setInputValue("");
|
|
638504
638761
|
helpers.setCursorOffset(0);
|
|
@@ -651839,8 +652096,8 @@ __export(printStreamJsonContract_exports, {
|
|
|
651839
652096
|
import { randomUUID as randomUUID55 } from "crypto";
|
|
651840
652097
|
function terminalReasonForResult(msg) {
|
|
651841
652098
|
const code2 = msg.errorCode;
|
|
651842
|
-
if (code2 === "
|
|
651843
|
-
if (code2 === "
|
|
652099
|
+
if (code2 === "limits.max_turns_exceeded") return "max_turns";
|
|
652100
|
+
if (code2 === "limits.max_cost_exceeded") return "budget_exhausted";
|
|
651844
652101
|
if (code2 === "output.invalid") return "structured_output_retry_exhausted";
|
|
651845
652102
|
if (msg.is_error !== true && msg.subtype === "success") {
|
|
651846
652103
|
return "completed";
|
|
@@ -674986,7 +675243,7 @@ async function run() {
|
|
|
674986
675243
|
throw new InvalidArgumentError(`It must be one of: ${allowed.join(", ")}`);
|
|
674987
675244
|
}
|
|
674988
675245
|
return value;
|
|
674989
|
-
})).option("--sandbox <profile>", `Sandbox image profile for submitted runs: a profile name (explicit; k8s-lane workers only \u2014 list with 'sema cloud images list'), or 'auto' to let the model pick via its SelectEnvironment tool (advisory; choice + reason are echoed in the reply). Omit for the worker default image.`).option("--scenario <name>", `Engine scenario for submitted runs (only works with --print): route the run through a deployment-defined scenario (tool roster + system prompt). Unknown names fall back to the default scenario. Omit for the default scenario; a persistent default can be set via SEMA_HEADLESS_SCENARIO in the settings.json env block.`).option("--
|
|
675246
|
+
})).option("--sandbox <profile>", `Sandbox image profile for submitted runs: a profile name (explicit; k8s-lane workers only \u2014 list with 'sema cloud images list'), or 'auto' to let the model pick via its SelectEnvironment tool (advisory; choice + reason are echoed in the reply). Omit for the worker default image.`).option("--scenario <name>", `Engine scenario for submitted runs (only works with --print): route the run through a deployment-defined scenario (tool roster + system prompt). Unknown names fall back to the default scenario. Omit for the default scenario; a persistent default can be set via SEMA_HEADLESS_SCENARIO in the settings.json env block.`).option("--final-verify", `Enable a final-verification pass for submitted runs (only works with --print; off by default). When enabled, headless -p runs that write files get up to two extra verification turns before finishing. A persistent default can be set via SEMA_HEADLESS_FINAL_VERIFY=true in the settings.json env block. Yields automatically (with a notice) when a Stop hook is configured.`).option("--no-final-verify", `Explicitly disable the final-verification pass for submitted runs (only works with --print). Verification is off by default, so this flag only matters to override --final-verify or a persistent SEMA_HEADLESS_FINAL_VERIFY=true default; it always wins.`).option("--deadline <sec>", `Wall-clock limit in seconds for submitted runs (only works with --print; sema superset \u2014 no upstream equivalent). The run fails loudly with its partial output when the limit is hit; integer between 30 and 86400. A persistent default can be set via SEMA_HEADLESS_DEADLINE_SEC in the settings.json env block.`).option("--max-tokens <n>", `Total token budget for submitted runs (only works with --print; sema superset \u2014 no upstream equivalent). The primary recommended limit: the run fails loudly with its partial output when the budget is exhausted; positive integer. A persistent default can be set via SEMA_HEADLESS_MAX_TOKENS in the settings.json env block.`).option("--agent <agent>", `Agent for the current session. Overrides the 'agent' setting.`).option("--betas <betas...>", "Beta headers to include in API requests (API key users only)").option("--fallback-model <model>", "Enable automatic fallback to specified model when default model is overloaded (only works with --print)").addOption(new Option("--workload <tag>", "Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)").hideHelp()).option("--settings <file-or-json>", "Path to a settings JSON file or a JSON string to load additional settings from").option("--add-dir <directories...>", "Additional directories to allow tool access to").option("--ide", "Automatically connect to IDE on startup if exactly one valid IDE is available", () => true).option("--strict-mcp-config", "Only use MCP servers from --mcp-config, ignoring all other MCP configurations", () => true).option("--session-id <uuid>", "Use a specific session ID for the conversation (must be a valid UUID)").option("-n, --name <name>", "Set a display name for this session (shown in /resume and terminal title)").option("--agents <json>", `JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option("--setting-sources <sources>", "Comma-separated list of setting sources to load (user, project, local).").option("--plugin-dir <path>", "Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)", (val, prev) => [...prev, val], []).addOption(new Option("--plugin-dir-no-mcp <path>", "Like --plugin-dir but the engine will not read this plugin's .mcp.json (caller owns its MCP connections)").argParser((val, prev) => [...prev, val]).default([]).hideHelp()).option("--plugin-url <url>", "Fetch a plugin .zip from a URL for this session only (repeatable: --plugin-url A --plugin-url B)", (val, prev) => [...prev, ...val.split(/\s+/).filter(Boolean)], []).option("--disable-slash-commands", "Disable all skills", () => true).option("--chrome", "Enable Claude in Chrome integration").option("--no-chrome", "Disable Claude in Chrome integration").option("--file <specs...>", "File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)").action(async (prompt, options) => {
|
|
674990
675247
|
profileCheckpoint("action_handler_start");
|
|
674991
675248
|
{
|
|
674992
675249
|
const UNWIRED_FLAGS = [
|
|
@@ -677125,7 +677382,7 @@ Auth: unix socket -R \u2192 local proxy`, "info");
|
|
|
677125
677382
|
pendingHookMessages
|
|
677126
677383
|
}, renderAndRun);
|
|
677127
677384
|
}
|
|
677128
|
-
}).version("sema 1.0.
|
|
677385
|
+
}).version("sema 1.0.67", "-v, --version", "Output the version number");
|
|
677129
677386
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
677130
677387
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
677131
677388
|
if (canUserConfigureAdvisor()) {
|
|
@@ -682052,6 +682309,7 @@ var init_engineWireInjection = __esm({
|
|
|
682052
682309
|
// build-src/src/sema/workflowLiveActivity.ts
|
|
682053
682310
|
var workflowLiveActivity_exports = {};
|
|
682054
682311
|
__export(workflowLiveActivity_exports, {
|
|
682312
|
+
__feedWorkflowActivityFrameForTests: () => __feedWorkflowActivityFrameForTests,
|
|
682055
682313
|
ensureWorkflowActivityLedger: () => ensureWorkflowActivityLedger,
|
|
682056
682314
|
resetWorkflowActivityLedgers: () => resetWorkflowActivityLedgers,
|
|
682057
682315
|
stopWorkflowActivityLedger: () => stopWorkflowActivityLedger,
|
|
@@ -682079,13 +682337,17 @@ function onFrame(ledger, frame) {
|
|
|
682079
682337
|
const n2 = (ledger.startedLabels.get(label) ?? 0) + 1;
|
|
682080
682338
|
ledger.startedLabels.set(label, n2);
|
|
682081
682339
|
if (n2 > 1 && frame.data.replayed !== true) ledger.ambiguous.add(label);
|
|
682340
|
+
const requested = frame.data.model;
|
|
682341
|
+
if (typeof requested === "string" && requested) accFor(label).requestedModel = requested;
|
|
682082
682342
|
}
|
|
682083
682343
|
return;
|
|
682084
682344
|
}
|
|
682085
682345
|
if (frame.event === "agent_end") {
|
|
682086
682346
|
const label = frame.data.label;
|
|
682087
|
-
if (typeof label === "string" && label
|
|
682088
|
-
accFor(label).endedToolCalls = frame.data.toolCalls;
|
|
682347
|
+
if (typeof label === "string" && label) {
|
|
682348
|
+
if (typeof frame.data.toolCalls === "number") accFor(label).endedToolCalls = frame.data.toolCalls;
|
|
682349
|
+
const resolved = frame.data.modelResolved;
|
|
682350
|
+
if (typeof resolved === "string" && resolved) accFor(label).resolvedModel = resolved;
|
|
682089
682351
|
}
|
|
682090
682352
|
return;
|
|
682091
682353
|
}
|
|
@@ -682179,6 +682441,20 @@ function resetWorkflowActivityLedgers() {
|
|
|
682179
682441
|
for (const l3 of ledgers.values()) l3.abort.abort();
|
|
682180
682442
|
ledgers.clear();
|
|
682181
682443
|
}
|
|
682444
|
+
function __feedWorkflowActivityFrameForTests(workflowId, frame) {
|
|
682445
|
+
let ledger = ledgers.get(workflowId);
|
|
682446
|
+
if (!ledger) {
|
|
682447
|
+
ledger = {
|
|
682448
|
+
byLabel: /* @__PURE__ */ new Map(),
|
|
682449
|
+
startedLabels: /* @__PURE__ */ new Map(),
|
|
682450
|
+
ambiguous: /* @__PURE__ */ new Set(),
|
|
682451
|
+
closed: true,
|
|
682452
|
+
abort: new AbortController()
|
|
682453
|
+
};
|
|
682454
|
+
ledgers.set(workflowId, ledger);
|
|
682455
|
+
}
|
|
682456
|
+
onFrame(ledger, frame);
|
|
682457
|
+
}
|
|
682182
682458
|
function wrapWorkflowDetailWithLiveActivity(base, opts) {
|
|
682183
682459
|
ensureWorkflowActivityLedger(opts);
|
|
682184
682460
|
const baseSubscribe = base.subscribe?.bind(base);
|
|
@@ -682205,6 +682481,10 @@ function wrapWorkflowDetailWithLiveActivity(base, opts) {
|
|
|
682205
682481
|
if (tail.summary) patch2.lastToolSummary = tail.summary;
|
|
682206
682482
|
}
|
|
682207
682483
|
}
|
|
682484
|
+
if (a.model == null && acc.requestedModel !== void 0) patch2.model = acc.requestedModel;
|
|
682485
|
+
if (a.fallbackModel == null && acc.resolvedModel !== void 0) {
|
|
682486
|
+
patch2.fallbackModel = acc.resolvedModel;
|
|
682487
|
+
}
|
|
682208
682488
|
if (acc.lastTs !== void 0 && (a.lastProgressAt == null || acc.lastTs > a.lastProgressAt)) {
|
|
682209
682489
|
patch2.lastProgressAt = acc.lastTs;
|
|
682210
682490
|
}
|