@sema-agent/cli 1.0.129 → 1.0.130

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.
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@sema-agent/cli",
3
- "version": "1.0.129",
3
+ "version": "1.0.130",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sema-agent/cli",
9
- "version": "1.0.129",
9
+ "version": "1.0.130",
10
10
  "license": "BUSL-1.1",
11
11
  "dependencies": {
12
12
  "@sema-agent/sdk": "11.3.0",
13
- "@sema-agent/server": "7.93.3"
13
+ "@sema-agent/server": "7.93.5"
14
14
  },
15
15
  "bin": {
16
16
  "sema": "sema.js"
@@ -645,9 +645,9 @@
645
645
  }
646
646
  },
647
647
  "node_modules/@sema-agent/server": {
648
- "version": "7.93.3",
649
- "resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-7.93.3.tgz",
650
- "integrity": "sha512-pKBMMmCxO0dgQ5VamgFB3oaaD4eQgrT0+92yF5hh7/6E9ovskezacGJESi/zpptQ67pc0EhQf0WdvOkPahMo+A==",
648
+ "version": "7.93.5",
649
+ "resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-7.93.5.tgz",
650
+ "integrity": "sha512-wAZa/GoBjCT8K+cviFDleWOe1NHrhjYetdsTR9lB/avj2rg2EwloTVC5aNXmQmybVp/es9I7j8G35CVRUx3+Iw==",
651
651
  "license": "BUSL-1.1",
652
652
  "dependencies": {
653
653
  "@sema-agent/core": "7.26.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sema-agent/cli",
3
- "version": "1.0.129",
4
- "gitHead": "f0088d775748abee12ecead485d26d21ad82274a",
3
+ "version": "1.0.130",
4
+ "gitHead": "09da74e8ea0a82b0ffa2e48f6f8e877b112be7e5",
5
5
  "description": "Sema — your own Claude Code-grade coding agent, in the terminal.",
6
6
  "license": "BUSL-1.1",
7
7
  "bin": {
@@ -25,13 +25,13 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@sema-agent/sdk": "11.3.0",
28
- "@sema-agent/server": "7.93.3"
28
+ "@sema-agent/server": "7.93.5"
29
29
  },
30
30
  "overrides": {
31
31
  "@sema-agent/core": "7.26.2",
32
32
  "@sema-agent/settings-schema": "3.0.0"
33
33
  },
34
- "semaEngineVersion": "server 7.93.3 / core 7.26.2 / settings-schema 3.0.0",
34
+ "semaEngineVersion": "server 7.93.5 / core 7.26.2 / settings-schema 3.0.0",
35
35
  "engines": {
36
36
  "node": ">=20.3"
37
37
  }
package/sema-main.js CHANGED
@@ -15261,6 +15261,10 @@ function readRunCostFacts(stats3, observed) {
15261
15261
  reconcile
15262
15262
  };
15263
15263
  }
15264
+ function structuredOutputParts(r) {
15265
+ let so = r.structuredOutput;
15266
+ return so !== void 0 ? { structured_output: so, structuredOutput: so } : {};
15267
+ }
15264
15268
  function effectiveFactParts(rec) {
15265
15269
  let reasoning = readEffectiveReasoning(rec.effectiveReasoning), scopes = readEffectiveMemoryScopes(rec.effectiveMemoryScopes);
15266
15270
  return {
@@ -15475,10 +15479,7 @@ function doneToSdkResult(ev, ctx, observed) {
15475
15479
  is_error: !1,
15476
15480
  num_turns: stats3?.turns ?? 0,
15477
15481
  result: r.result ?? "",
15478
- ...(() => {
15479
- let so = r.structuredOutput;
15480
- return so !== void 0 ? { structuredOutput: so } : {};
15481
- })(),
15482
+ ...structuredOutputParts(r),
15482
15483
  ...degraded !== void 0 ? { degraded } : {},
15483
15484
  stop_reason: null,
15484
15485
  total_cost_usd: costOrNull(stats3),
@@ -16631,7 +16632,7 @@ var REQUEST_FIELD_MATRIX, LIVE_DEFAULT_FIELDS, TASK_REQUEST_OMISSION_CAUSES, TAS
16631
16632
  { field: "limits", lanes: ["print", "utility"], live: !0, why: "P2-3-b:`-p` \u7684\u9884\u7B97\u62A4\u680F(--max-* flag \u65CF),\u4EA4\u4E92 REPL \u7531\u4EBA\u968F\u65F6 Esc", whyUtilityLane: "\u6709\u5EA7:side-channel \u5FC5\u987B\u5E26\u9884\u7B97\u62A4\u680F(\u5899\u949F / \u8F93\u51FA token / \u8F6E\u6570)\u2014\u2014 \u5B83\u540C\u6837\u6CA1\u6709\u4EBA\u770B\u7740,\u800C\u4E14\u6CA1\u6709\u540E\u7EED\u56DE\u5408\u53EF\u4EE5\u4E2D\u65AD" },
16632
16633
  { field: "interactiveTools", lanes: ["print", "utility"], live: !0, why: "[909]B \u4EF63:\u65E0\u4EBA\u503C\u5B88 stamp false,\u4ECE roster \u6E90\u5934\u706D\u6389 AskUserQuestion/plan \u95E8\u3002\u4EA4\u4E92\u8F66\u9053 stamp false \u7B49\u4E8E\u81EA\u5E9F\u6B66\u529F", whyUtilityLane: "\u6709\u5EA7:side-channel \u7EDD\u4E0D\u8BE5\u5F39\u4EA4\u4E92\u95EE\u7B54 / plan \u95E8(\u6CA1\u6709\u4EBA\u5728\u770B\u8FD9\u6761\u63D0\u4EA4)\u3002\u5B83\u4E0E excludeAllTools \u662F**\u4E24\u6761\u72EC\u7ACB**\u7684\u6536\u7D27\u58F0\u660E\u3001\u5728\u8FD9\u6761\u8F66\u9053\u4E0A**\u5E76\u5B58**(\u672C\u8F66\u9053\u5F3A\u5236\u5E26\u5378\u8F7D\u58F0\u660E,\u89C1 `refuseUtilityWithoutToolUnload`;\u8FD9\u4E00\u4F4D\u662F\u5B83\u65C1\u8FB9\u90A3\u6761\u300C\u8FDE\u95EE\u90FD\u522B\u95EE\u300D\u7684\u58F0\u660E,\u4E0D\u662F\u5B83\u7684\u964D\u7EA7\u66FF\u8EAB)" },
16633
16634
  { field: "oneShot", lanes: ["print", "utility"], live: !0, why: "SDK TaskRequest.oneShot(server \u22657.12.0 \u6D88\u8D39):`-p` \u63D0\u4EA4\u662F\u4E00\u6B21\u6027\u7684\u2014\u2014\u6CA1\u6709\u540E\u7EED\u56DE\u5408\u63A5\u4F4F\u5F02\u6B65\u540E\u53F0\u901A\u77E5,core \u636E\u6B64\u628A\u300C\u7ED3\u675F\u56DE\u5408\u7B49\u901A\u77E5\u300D\u6307\u5F15\u6362\u6210 block-wait;\u4EA4\u4E92\u8F66\u9053\u6709\u540E\u7EED\u56DE\u5408,stamp true \u5C31\u662F\u8C0E\u62A5\u3002\u8001 worker \u9759\u9ED8\u5FFD\u7565(\u5F00\u96C6\u63D0\u4EA4\u4F53),\u6545\u53D1\u9001\u4FA7\u4E0D\u8BBE\u80FD\u529B\u4F4D\u524D\u7F6E\u95E8(oneShotWireCaps \u5934\u6CE8)", whyUtilityLane: "\u6709\u5EA7:side-channel \u5C31\u662F\u4E00\u6B21\u6027\u63D0\u4EA4 \u2014\u2014 \u6CA1\u6709\u540E\u7EED\u56DE\u5408\u63A5\u4F4F\u5F02\u6B65\u540E\u53F0\u901A\u77E5,\u5F15\u64CE\u636E\u6B64\u628A\u300C\u7ED3\u675F\u56DE\u5408\u7B49\u901A\u77E5\u300D\u6362\u6210 block-wait" },
16634
- { field: "outputSchema", lanes: ["print", "utility"], live: !0, why: "\u7ED3\u6784\u5316\u8F93\u51FA\u7EA6\u675F(sdk `TaskRequest.outputSchema`:\u6700\u7EC8\u7B54\u6848\u5FC5\u987B\u5339\u914D\u7684 JSON Schema)\u3002\u4E0A\u6E38\u53EA\u9A8C\u5F62\u72B6\u4E0E\u5E8F\u5217\u5316\u5C3A\u5BF8(\u574F\u5F62 400 \u54CD\u4EAE\u62D2)\u3001\u6DF1\u5C42\u5408\u6CD5\u6027\u5F52\u5F15\u64CE \u21D2 \u672C\u5C42\u539F\u6837\u900F\u4F20\u3001\u4E0D\u9884\u94F8\u7B2C\u4E8C\u5224\u5B98\u3002\u6765\u6E90\u53EA\u5728\u65E0\u4EBA\u503C\u5B88\u8F66\u9053(`--json-schema` \u4E00\u7C7B\u65D7);\u4EA4\u4E92\u9762\u4ECA\u5929\u6CA1\u6709\u5165\u53E3 \u21D2 \u7F3A\u5E2D\u662F**\u6CA1\u6709\u6765\u6E90**,\u4E0D\u662F\u6F0F\u3002\u26A0\uFE0F \u672C\u884C\u53EA\u7BA1**\u4E0A\u884C**\u8FD9\u4E00\u4F4D:\u7ED3\u679C\u4E00\u4FA7\u7684\u7ED3\u6784\u5316\u4EA7\u51FA\u843D\u4E0D\u843D CC \u5F62 result \u5E27\u662F\u4E0B\u884C\u6295\u5F71\u7684\u4E8B,\u4E0D\u5728\u672C\u8868", whyUtilityLane: "\u6709\u5EA7:side-channel \u7684\u5178\u578B\u5F62\u6B63\u662F\u300C\u8981\u4E00\u4E2A\u53EF\u673A\u8BFB\u7684\u5C0F\u7B54\u6848\u300D(\u5206\u7C7B / \u6458\u8981 / \u62BD\u53D6),\u7ED3\u6784\u5316\u8F93\u51FA\u7EA6\u675F\u662F\u5B83\u6700\u76F4\u63A5\u7684\u4F4D,\u800C schema \u7531\u58F3\u81EA\u5DF1\u7ED9 \u21D2 \u6709\u6765\u6E90" },
16635
+ { field: "outputSchema", lanes: ["print", "utility"], live: !0, why: "\u7ED3\u6784\u5316\u8F93\u51FA\u7EA6\u675F(sdk `TaskRequest.outputSchema`:\u6700\u7EC8\u7B54\u6848\u5FC5\u987B\u5339\u914D\u7684 JSON Schema)\u3002\u4E0A\u6E38\u53EA\u9A8C\u5F62\u72B6\u4E0E\u5E8F\u5217\u5316\u5C3A\u5BF8(\u574F\u5F62 400 \u54CD\u4EAE\u62D2)\u3001\u6DF1\u5C42\u5408\u6CD5\u6027\u5F52\u5F15\u64CE \u21D2 \u672C\u5C42\u539F\u6837\u900F\u4F20\u3001\u4E0D\u9884\u94F8\u7B2C\u4E8C\u5224\u5B98\u3002\u6765\u6E90\u53EA\u53EF\u80FD\u5728\u65E0\u4EBA\u503C\u5B88\u8F66\u9053(schema \u7531\u58F3\u7684\u65E0\u4EBA\u503C\u5B88\u5165\u53E3\u7ED9;\u54EA\u4E2A\u58F3\u4ECA\u5929\u771F\u7684\u63A5\u4E86\u90A3\u6761\u5165\u53E3\u662F\u58F3\u4FA7\u7684\u4E8B,\u672C\u8868\u53EA\u8BF4\u5EA7\u4F4D);\u4EA4\u4E92\u9762\u4ECA\u5929\u6CA1\u6709\u5165\u53E3 \u21D2 \u7F3A\u5E2D\u662F**\u6CA1\u6709\u6765\u6E90**,\u4E0D\u662F\u6F0F\u3002\u26A0\uFE0F \u672C\u884C\u53EA\u7BA1**\u4E0A\u884C**\u8FD9\u4E00\u4F4D:\u7ED3\u679C\u4E00\u4FA7\u7684\u7ED3\u6784\u5316\u4EA7\u51FA\u843D\u4E0D\u843D CC \u5F62 result \u5E27\u662F\u4E0B\u884C\u6295\u5F71\u7684\u4E8B,\u4E0D\u5728\u672C\u8868", whyUtilityLane: "\u6709\u5EA7:side-channel \u7684\u5178\u578B\u5F62\u6B63\u662F\u300C\u8981\u4E00\u4E2A\u53EF\u673A\u8BFB\u7684\u5C0F\u7B54\u6848\u300D(\u5206\u7C7B / \u6458\u8981 / \u62BD\u53D6),\u7ED3\u6784\u5316\u8F93\u51FA\u7EA6\u675F\u662F\u5B83\u6700\u76F4\u63A5\u7684\u4F4D,\u800C schema \u7531\u58F3\u81EA\u5DF1\u7ED9 \u21D2 \u6709\u6765\u6E90" },
16635
16636
  { field: "outputRetries", lanes: ["print", "utility"], live: !0, why: "\u7ED3\u6784\u5316\u8F93\u51FA\u7684\u91CD\u8BD5\u8F6E\u6570(sdk `TaskRequest.outputRetries`;\u4E0E `outputSchema` \u662F**\u6210\u5BF9\u65CB\u94AE** \u2014\u2014 \u6CA1\u6709 schema \u65F6\u5F15\u64CE\u5FFD\u7565\u5B83)\u3002\u{1F534} \u5EA7\u4F4D\u96C6\u4E0E `outputSchema` \u90A3\u4E00\u884C**\u9010\u5B57\u76F8\u540C**:\u4E00\u534A\u6709\u5EA7\u4E00\u534A\u6CA1\u5EA7 = \u7AEF\u8C03\u5F97\u52A8\u91CD\u8BD5\u8F6E\u6570\u5374\u8C03\u4E0D\u52A8\u5B83\u6240\u670D\u52A1\u7684\u7EA6\u675F(\u540C\u5EA7\u5B6A\u751F\u5206\u5F00\u5B9A\u5EA7,\u6B63\u662F\u300C\u4E3B\u8F74\u6539\u4E86\u3001\u5B6A\u751F\u6F0F\u4E86\u300D\u90A3\u4E00\u65CF)\u3002\u4E0A\u6E38\u63A5\u53D7\u57DF\u5F88\u7A84(\u6709\u9650\u3001\u22651\u3001\u5411\u4E0B\u53D6\u6574\u3001\u5C01\u9876 10),**\u8868\u5916\u4E00\u5F8B\u6574\u952E\u7701\u7565**\u5E76\u56DE\u843D\u5F15\u64CE\u7F3A\u7701 \u21D2 \u672C\u5C42\u5BF9\u574F\u503C**\u54CD\u4EAE\u62D2**(\u89C1 `refuseBadOutputRetries`),\u4F46**\u4E0D\u9884\u5939** [1,10]:\u5939\u662F\u4E0A\u6E38\u7684\u4E8B,\u672C\u5C42\u4E0D\u94F8\u7B2C\u4E8C\u5224\u5B98", whyUtilityLane: "\u6709\u5EA7:\u4E0E outputSchema \u540C\u5EA7\u5B6A\u751F \u2014\u2014 side-channel \u8981\u673A\u8BFB\u5C0F\u7B54\u6848\u65F6,\u91CD\u8BD5\u8F6E\u6570\u662F\u540C\u4E00\u4E2A\u65CB\u94AE\u7684\u53E6\u4E00\u534A" },
16636
16637
  { field: "maxCostUsd", lanes: ["print", "utility"], live: !0, why: "\u82B1\u8D39\u4E0A\u9650\u58F0\u660E(sdk `TaskRequest.maxCostUsd`,\u8BF7\u6C42\u4F53**\u9876\u5C42**\u4F4D;\u4E0A\u6E38\u5411\u4E0B\u5939\u5230\u90E8\u7F72\u4E0A\u9650 \u2014\u2014 \u53EA\u8BB8\u8981\u5F97\u66F4\u5C11)\u3002\u4E0E `limits` \u540C\u4E00\u6761\u7406\u7531\u53EA\u5728\u65E0\u4EBA\u503C\u5B88\u8F66\u9053:\u4EA4\u4E92\u9762\u7531\u4EBA\u968F\u65F6\u4E2D\u65AD\u3002\u{1F534} \u574F\u503C(\u975E\u6570 / \u975E\u6709\u9650 / \u975E\u6B63)\u5728\u672C\u5C42**\u54CD\u4EAE\u62D2**:\u4E0A\u6E38\u5BF9\u8FD9\u4E00\u4F4D\u7684\u574F\u503C\u662F\u5B89\u9759\u5FFD\u7565\u5E76\u56DE\u843D\u90E8\u7F72\u4E0A\u9650,\u4E0D\u662F 4xx(\u89C1 `refuseBadMaxCostUsd`)", whyUtilityLane: "\u6709\u5EA7:\u5C0F\u9884\u7B97\u662F\u672C\u8F66\u9053\u7684\u5B9A\u4E49\u4E4B\u4E00(\u4E0E limits \u540C\u4E00\u6761\u7406\u7531);\u4E0A\u6E38\u5411\u4E0B\u5939\u5230\u90E8\u7F72\u4E0A\u9650,\u53EA\u8BB8\u8981\u5F97\u66F4\u5C11" },
16637
16638
  { field: "maxTokens", lanes: ["print", "utility"], live: !0, why: "\u6574\u4EFB\u52A1 token \u9884\u7B97\u4E0A\u9650\u58F0\u660E(sdk `TaskRequest.maxTokens`,\u8BF7\u6C42\u4F53**\u9876\u5C42**\u4F4D,\u4E0E `maxCostUsd` \u540C\u5C5E\u4E0A\u6E38\u90A3\u4E00\u65CF\u300C\u8C03\u7528\u65B9\u8981\u6C42\u7684\u4E0A\u9650\u300D:\u5411\u4E0B\u5939\u5230\u90E8\u7F72\u4E0A\u9650 \u2014\u2014 \u53EA\u8BB8\u8981\u5F97\u66F4\u5C11)\u3002\u{1F534} \u5EA7\u4F4D\u96C6\u4E0E `maxCostUsd` \u90A3\u4E00\u884C**\u9010\u5B57\u76F8\u540C**:\u540C\u4E00\u6761\u9884\u7B97\u8F74\u7684\u4E24\u79CD\u8BA1\u4EF7\u5355\u4F4D,\u5206\u5F00\u5B9A\u5EA7\u5C31\u662F\u8BA9\u5176\u4E2D\u4E00\u6761\u9759\u9ED8\u6F02\u3002\u{1F534} \u574F\u503C(\u975E\u6570 / \u975E\u6709\u9650 / \u975E\u6B63 / \u975E\u6574)\u5728\u672C\u5C42**\u54CD\u4EAE\u62D2**:\u4E0A\u6E38\u5BF9\u8FD9\u4E00\u4F4D\u7684\u574F\u503C\u662F\u5B89\u9759\u6309\u300C\u8C03\u7528\u65B9\u6CA1\u7ED9\u300D\u5904\u7406\u5E76\u56DE\u843D\u90E8\u7F72\u4E0A\u9650,\u4E0D\u662F 4xx \u2014\u2014 \u90E8\u7F72\u6CA1\u8BBE\u4E0A\u9650\u65F6\u8FD9\u4E00\u6B21\u8FD0\u884C\u5C31\u6CA1\u6709 token \u95F8,\u800C\u58F0\u660E\u4EBA\u4E0D\u4F1A\u77E5\u9053(\u89C1 `refuseBadMaxTokens`)", whyUtilityLane: "\u6709\u5EA7:\u4E0E maxCostUsd \u540C\u8F74\u5B6A\u751F \u2014\u2014 \u5C0F\u9884\u7B97\u662F\u672C\u8F66\u9053\u7684\u5B9A\u4E49\u4E4B\u4E00,\u4E24\u79CD\u8BA1\u4EF7\u5355\u4F4D\u90FD\u8BE5\u80FD\u58F0\u660E" },
@@ -22165,8 +22166,11 @@ function isToolApprovalFrame(ev) {
22165
22166
  return !!e && (e.type === "tool_approval" || e.type === "tool_approval_complete") && typeof e.approvalId == "string" && e.approvalId.length > 0;
22166
22167
  }
22167
22168
  function pathFromGateMessage(message) {
22168
- if (typeof message == "string")
22169
- return FS_WRITE_GATE_ASK_PATTERN.exec(message)?.[1];
22169
+ if (typeof message != "string" || !message.startsWith(FS_WRITE_GATE_ASK_PREFIX))
22170
+ return;
22171
+ let body = message.slice(FS_WRITE_GATE_ASK_PREFIX.length), close = body.indexOf(FS_WRITE_GATE_ASK_PATH_CLOSE);
22172
+ if (!(close <= 0) && body.indexOf(FS_WRITE_GATE_ASK_PATH_CLOSE, close + 1) === -1)
22173
+ return body.slice(0, close);
22170
22174
  }
22171
22175
  function isNonNegativeFinite(v2) {
22172
22176
  return typeof v2 == "number" && Number.isFinite(v2) && v2 >= 0;
@@ -22388,7 +22392,7 @@ async function surfaceToolApprovalFrameAndRespond(frame, respond, streamArgs, si
22388
22392
  return hostLog("debug", `liveToolApprovalWire: respond(${decision}) failed for ${frame.approvalId} (status=${respondRefusal?.status ?? "none"} errorCode=${logSafeErrorCode(respondRefusal?.errorCode)} messageLen=${respondRefusal?.message?.length ?? 0}) \u2014 engine self-settles (TTL/abort); the refusal text is handed back on outcome.respondRefusal for the host to surface`), respondRefusal !== void 0 ? { decision: "unresolved", respondRefusal } : { decision: "unresolved" };
22389
22393
  }
22390
22394
  }
22391
- var APPROVAL_DENY_SETTLED_BY_WORDS, RETRACTED_CARD_DECISION_KIND, cardPortByKey, cardPortMissesByKey, TOOL_APPROVAL_FRAME_KEYS_MIRROR, MANDATED_ABSENCE_WORD, RESPOND_DECISIONS, USELESS_REFUSAL_TEXTS, MACHINE_CODE_SHAPE, FS_WRITE_GATE_ASK_PATTERN, MAX_RULE_OFFERS_TOLERATED, MAX_RULE_OFFER_BATCH_MEMBERS_TOLERATED, MAX_RULE_OFFER_UNCOVERED_DETAIL_TOLERATED, MAX_RESPOND_NOTE_CHARS, init_toolApprovalWire = __esm({
22395
+ var APPROVAL_DENY_SETTLED_BY_WORDS, RETRACTED_CARD_DECISION_KIND, cardPortByKey, cardPortMissesByKey, TOOL_APPROVAL_FRAME_KEYS_MIRROR, MANDATED_ABSENCE_WORD, RESPOND_DECISIONS, USELESS_REFUSAL_TEXTS, MACHINE_CODE_SHAPE, FS_WRITE_GATE_ASK_PREFIX, FS_WRITE_GATE_ASK_PATH_CLOSE, MAX_RULE_OFFERS_TOLERATED, MAX_RULE_OFFER_BATCH_MEMBERS_TOLERATED, MAX_RULE_OFFER_UNCOVERED_DETAIL_TOLERATED, MAX_RESPOND_NOTE_CHARS, init_toolApprovalWire = __esm({
22392
22396
  "node_modules/@sema-agent/client-core/dist/hitl/toolApprovalWire.js"() {
22393
22397
  init_hitlBridge();
22394
22398
  init_askParkRowRouting();
@@ -22436,7 +22440,7 @@ var APPROVAL_DENY_SETTLED_BY_WORDS, RETRACTED_CARD_DECISION_KIND, cardPortByKey,
22436
22440
  RESPOND_DECISIONS = ["allow", "allow_session", "deny"];
22437
22441
  USELESS_REFUSAL_TEXTS = /* @__PURE__ */ new Set(["[object Object]", "null", "undefined", ""]);
22438
22442
  MACHINE_CODE_SHAPE = /^[A-Za-z0-9._:-]{1,64}$/;
22439
- FS_WRITE_GATE_ASK_PATTERN = /^approve write to "([^"]+)"\?$/;
22443
+ FS_WRITE_GATE_ASK_PREFIX = 'approve write to "', FS_WRITE_GATE_ASK_PATH_CLOSE = '"?';
22440
22444
  MAX_RULE_OFFERS_TOLERATED = 8, MAX_RULE_OFFER_BATCH_MEMBERS_TOLERATED = 8, MAX_RULE_OFFER_UNCOVERED_DETAIL_TOLERATED = 32;
22441
22445
  MAX_RESPOND_NOTE_CHARS = 2048;
22442
22446
  }
@@ -70760,6 +70764,11 @@ Keep messages tight \u2014 the decision, the file:line, the PR number. Second pe
70760
70764
  function normalizeLegacyToolName(name) {
70761
70765
  return LEGACY_TOOL_NAME_ALIASES[name] ?? name;
70762
70766
  }
70767
+ function retiredToolNameInRule(rule) {
70768
+ for (let [legacy, canonical2] of Object.entries(LEGACY_TOOL_NAME_ALIASES))
70769
+ if (canonical2 !== legacy && (rule === legacy || rule.startsWith(`${legacy}(`)))
70770
+ return { legacy, canonical: canonical2 };
70771
+ }
70763
70772
  function getLegacyToolNames(canonicalName) {
70764
70773
  let result = [];
70765
70774
  for (let [legacy, canonical2] of Object.entries(LEGACY_TOOL_NAME_ALIASES))
@@ -72182,10 +72191,18 @@ function isDiagnosticValue(value) {
72182
72191
  let bare = value.replace(/[.,;:!?)\]}'"]{0,8}$/, "").toLowerCase();
72183
72192
  return bare === "" || DIAGNOSTIC_VALUE_WORDS.has(bare);
72184
72193
  }
72194
+ function isTokenCountLabel(text2, at, label) {
72195
+ if (label.toLowerCase() !== "tokens" || at === 0 || text2[at - 1] !== "_") return !1;
72196
+ let i = at - 1;
72197
+ for (; i > 0 && isIdentChar(text2[i - 1]); ) i--;
72198
+ let head = text2.slice(i, at - 1).toLowerCase();
72199
+ return TOKEN_COUNT_HEAD_WORDS.has(head.slice(head.lastIndexOf("_") + 1));
72200
+ }
72185
72201
  function redactByLabel(text2, re, exempt = !0) {
72186
72202
  let out6 = "", last4 = 0;
72187
72203
  re.lastIndex = 0;
72188
72204
  for (let m2 = re.exec(text2); m2 !== null; m2 = re.exec(text2)) {
72205
+ if (isTokenCountLabel(text2, m2.index, m2[1] ?? "")) continue;
72189
72206
  let v2 = scanSecretValue(text2, m2.index + m2[0].length);
72190
72207
  if (v2 === null) continue;
72191
72208
  let value = text2.slice(v2.start, v2.end);
@@ -72349,7 +72366,7 @@ function displaySafeMcpConfigForMachine(config4) {
72349
72366
  }
72350
72367
  return root2;
72351
72368
  }
72352
- var DISPLAY_REDACTION_MARKER_RE, REDACTED_USERINFO, REDACTED_QUERY, REDACTED_FRAGMENT, TOKEN_STOP, TRAILING_PUNCTUATION, VALUE_BOUNDARY_TAIL, isWhitespaceOrControl, isSchemeChar, isAlpha, isHexDigit2, SCHEMELESS_USERINFO, MAX_FREE_TEXT_WASH_PASSES, REDACTED_SECRET, DIAGNOSTIC_VALUE_WORDS, BARE_VALUE_STOP_CHARS, isBareValueStop, SECRET_SCHEME_WORD, SECRET_LABELLED_WORD, SECRET_OPTION_NAME, LONG_OPTION_NAME, SECRET_CONFIG_NAME, init_displaySafeUrl = __esm({
72369
+ var DISPLAY_REDACTION_MARKER_RE, REDACTED_USERINFO, REDACTED_QUERY, REDACTED_FRAGMENT, TOKEN_STOP, TRAILING_PUNCTUATION, VALUE_BOUNDARY_TAIL, isWhitespaceOrControl, isSchemeChar, isAlpha, isHexDigit2, SCHEMELESS_USERINFO, MAX_FREE_TEXT_WASH_PASSES, REDACTED_SECRET, DIAGNOSTIC_VALUE_WORDS, BARE_VALUE_STOP_CHARS, isBareValueStop, TOKEN_COUNT_HEAD_WORDS, isIdentChar, SECRET_SCHEME_WORD, SECRET_LABELLED_WORD, SECRET_OPTION_NAME, LONG_OPTION_NAME, SECRET_CONFIG_NAME, init_displaySafeUrl = __esm({
72353
72370
  "build-src/src/sema/displaySafeUrl.ts"() {
72354
72371
  DISPLAY_REDACTION_MARKER_RE = /^«redacted(?::[a-z-]{1,16}){0,2}»$/, REDACTED_USERINFO = "\xABredacted:userinfo\xBB", REDACTED_QUERY = "\xABredacted:query\xBB", REDACTED_FRAGMENT = "\xABredacted:fragment\xBB";
72355
72372
  TOKEN_STOP = /* @__PURE__ */ new Set(['"', "<", ">", "`", "|", "\\", "^", "{", "}"]), TRAILING_PUNCTUATION = /* @__PURE__ */ new Set([".", ",", ";", ":", "!", "?", "'"]), VALUE_BOUNDARY_TAIL = /[?#&=;]$/, isWhitespaceOrControl = (ch2) => {
@@ -72436,6 +72453,39 @@ var DISPLAY_REDACTION_MARKER_RE, REDACTED_USERINFO, REDACTED_QUERY, REDACTED_FRA
72436
72453
  "apikey",
72437
72454
  "api-key"
72438
72455
  ]), BARE_VALUE_STOP_CHARS = /* @__PURE__ */ new Set([",", ";", '"', "'", "\\", "(", ")", "[", "]", "{", "}", "<", ">"]), isBareValueStop = (ch2) => ch2 <= " " || BARE_VALUE_STOP_CHARS.has(ch2);
72456
+ TOKEN_COUNT_HEAD_WORDS = /* @__PURE__ */ new Set([
72457
+ "max",
72458
+ "min",
72459
+ "num",
72460
+ "n",
72461
+ "input",
72462
+ "output",
72463
+ "total",
72464
+ "prompt",
72465
+ "completion",
72466
+ "thinking",
72467
+ "reasoning",
72468
+ "cache",
72469
+ "cached",
72470
+ "context",
72471
+ "budget",
72472
+ "used",
72473
+ "remaining",
72474
+ "reserved",
72475
+ "new",
72476
+ "effective",
72477
+ "limit",
72478
+ "sampled",
72479
+ "generated",
72480
+ "response",
72481
+ "request",
72482
+ "cumulative",
72483
+ "image",
72484
+ "audio",
72485
+ "text",
72486
+ "tool"
72487
+ // 刻意不收 `system`:别的鉴权体系里「system token」是真凭据名(test [7938] 提醒),`system_tokens=` 计数形罕见 ⇒ 留在遮蔽一侧。
72488
+ ]), isIdentChar = (ch2) => ch2 >= "a" && ch2 <= "z" || ch2 >= "A" && ch2 <= "Z" || ch2 >= "0" && ch2 <= "9" || ch2 === "_";
72439
72489
  SECRET_SCHEME_WORD = /(?:\b|(?<=\\[A-Za-z"']))(bearer|basic)[\s:=\uFF1A\uFF1D]{1,8}/gi, SECRET_LABELLED_WORD = /(?:\b|(?<=_)|(?<=\\[A-Za-z"']))((?:access[-_ ]?|refresh[-_ ]?|id[-_ ]?|client[-_ ]?|api[-_ ]?|x[-_]api[-_ ]?|session[-_ ]?|auth[-_ ]?)?(?:token|key|secret|password|authorization|credential)s?)(?:\\{0,4}["'])?\s{0,4}[:=\uFF1A\uFF1D]\s{0,4}/gi;
72440
72490
  SECRET_OPTION_NAME = /^(?:access[-_]?|refresh[-_]?|id[-_]?|client[-_]?|api[-_]?|x[-_]api[-_]?|session[-_]?|auth[-_]?)?(?:token|key|secret|password|authorization|credential)s?$/i, LONG_OPTION_NAME = /^--[A-Za-z]/;
72441
72491
  SECRET_CONFIG_NAME = /(?:^|[-_.])(?:token|key|secret|password|authorization|credential|cookie)s?$/i;
@@ -129706,6 +129756,13 @@ var scenarioUserTurn, SESSION_ID, TASK_ID, READ_CALL_ID, BASH_CALL_ID, EDIT_CALL
129706
129756
  }
129707
129757
  });
129708
129758
 
129759
+ // build-src/src/sema/processTitle.ts
129760
+ var SEMA_PROCESS_TITLE, init_processTitle = __esm({
129761
+ "build-src/src/sema/processTitle.ts"() {
129762
+ SEMA_PROCESS_TITLE = "sema";
129763
+ }
129764
+ });
129765
+
129709
129766
  // build-src/src/sema/spawnNameRegistry.ts
129710
129767
  function subagentTypeForHooks(agentType) {
129711
129768
  return agentType !== void 0 && agentType !== "" ? agentType : ABSENT_SUBAGENT_TYPE;
@@ -252850,6 +252907,17 @@ var ENGINE_URL_ENV, TRUSTED_ENGINE_HOSTS_KEY, isLoopbackEngineUrl, isEngineTrans
252850
252907
  }
252851
252908
  });
252852
252909
 
252910
+ // node_modules/@sema-agent/client-core/dist/sdkRegistryTransit.js
252911
+ import { RegistryClient } from "@sema-agent/sdk/registry";
252912
+ import { getMeConfig, getScopeConfigDraft, getEffective } from "@sema-agent/sdk/registry";
252913
+ import { probeRegistryHealth, postFeedback } from "@sema-agent/sdk/registry";
252914
+ import { REGISTRY_AUTH_PATHS, skillContentAddress } from "@sema-agent/sdk/registry";
252915
+ import { RegistryApiError, OAuthFlowError } from "@sema-agent/sdk/registry";
252916
+ var init_sdkRegistryTransit = __esm({
252917
+ "node_modules/@sema-agent/client-core/dist/sdkRegistryTransit.js"() {
252918
+ }
252919
+ });
252920
+
252853
252921
  // build-src/src/sema/cloudProfile.ts
252854
252922
  import { existsSync as existsSync22, mkdirSync as mkdirSync17, readFileSync as readFileSync30, writeFileSync as writeFileSync18, chmodSync as chmodSync4, openSync as openSync13, fsyncSync as fsyncSync11, closeSync as closeSync13, renameSync as renameSync14, unlinkSync as unlinkSync12 } from "fs";
252855
252923
  import { join as join80, dirname as dirname39 } from "path";
@@ -252980,7 +253048,6 @@ var init_cloudProfile = __esm({
252980
253048
  });
252981
253049
 
252982
253050
  // build-src/src/sema/registrySdkClient.ts
252983
- import { RegistryClient } from "@sema-agent/sdk/registry";
252984
253051
  function lockedTokenProvider(profileName) {
252985
253052
  let lastIssuedRefreshToken, foreignRotationObserved = !1;
252986
253053
  return {
@@ -253033,6 +253100,7 @@ function registryClientForProfile(registryUrl, profileName, opts = {}) {
253033
253100
  }
253034
253101
  var REGISTRY_TIMEOUT_MS, toTokens, init_registrySdkClient = __esm({
253035
253102
  "build-src/src/sema/registrySdkClient.ts"() {
253103
+ init_sdkRegistryTransit();
253036
253104
  init_cloudProfile();
253037
253105
  REGISTRY_TIMEOUT_MS = 8e3, toTokens = (creds, profileName) => {
253038
253106
  let entry = creds[profileName];
@@ -253056,10 +253124,6 @@ __export(cloudAuth_exports, {
253056
253124
  switchScope: () => switchScope
253057
253125
  });
253058
253126
  import {
253059
- RegistryClient as RegistryClient2,
253060
- REGISTRY_AUTH_PATHS,
253061
- OAuthFlowError,
253062
- RegistryApiError,
253063
253127
  requestDeviceCode as sdkRequestDeviceCode,
253064
253128
  pollUntilApproved as sdkPollUntilApproved,
253065
253129
  refreshTokens as sdkRefreshTokens,
@@ -253150,7 +253214,7 @@ async function refreshTokens(registryUrl, refreshToken) {
253150
253214
  }
253151
253215
  }
253152
253216
  async function revokeGrant(registryUrl, refreshToken, accessToken) {
253153
- let client3 = new RegistryClient2({
253217
+ let client3 = new RegistryClient({
253154
253218
  baseUrl: normalizeRegistryUrl(registryUrl),
253155
253219
  tokens: ephemeralTokenProvider(accessToken ?? "", refreshToken)
253156
253220
  }), status3, json2;
@@ -253172,7 +253236,7 @@ async function revokeGrant(registryUrl, refreshToken, accessToken) {
253172
253236
  );
253173
253237
  }
253174
253238
  function scopeClient(registryUrl, accessToken) {
253175
- return new RegistryClient2({
253239
+ return new RegistryClient({
253176
253240
  baseUrl: normalizeRegistryUrl(registryUrl),
253177
253241
  tokens: ephemeralTokenProvider(accessToken)
253178
253242
  });
@@ -253330,6 +253394,7 @@ async function getValidAccessToken(profileName) {
253330
253394
  }
253331
253395
  var CloudAuthError, sdkStatus, isSdkError, REFRESH_SKEW_MS, init_cloudAuth = __esm({
253332
253396
  "build-src/src/sema/cloudAuth.ts"() {
253397
+ init_sdkRegistryTransit();
253333
253398
  init_registrySdkClient();
253334
253399
  init_cloudProfile();
253335
253400
  CloudAuthError = class extends Error {
@@ -396168,11 +396233,6 @@ __export(cloudConfigWire_exports, {
396168
396233
  });
396169
396234
  import { existsSync as existsSync26, mkdirSync as mkdirSync21, readFileSync as readFileSync41, writeFileSync as writeFileSync22 } from "node:fs";
396170
396235
  import { dirname as dirname53, join as join125 } from "node:path";
396171
- import {
396172
- getEffective,
396173
- getScopeConfigDraft,
396174
- skillContentAddress
396175
- } from "@sema-agent/sdk/registry";
396176
396236
  function cloudConfigEnabled() {
396177
396237
  try {
396178
396238
  let resolved = resolveProfile();
@@ -396337,6 +396397,7 @@ function shadowModelsExists(profileName) {
396337
396397
  }
396338
396398
  var lastState, inflight3, bannerPrinted, init_cloudConfigWire = __esm({
396339
396399
  "build-src/src/sema/cloudConfigWire.ts"() {
396400
+ init_sdkRegistryTransit();
396340
396401
  init_registrySdkClient();
396341
396402
  init_cloudProfile();
396342
396403
  init_dist();
@@ -423165,7 +423226,10 @@ var classifierDecisionModule, autoModeStateModule4, CLASSIFIER_FAIL_CLOSED_REFRE
423165
423226
  // build-src/src/utils/permissions/permissionSetup.ts
423166
423227
  var permissionSetup_exports = {};
423167
423228
  __export(permissionSetup_exports, {
423229
+ FACTORY_DEFAULT_AUTO_MODE_BODY: () => FACTORY_DEFAULT_AUTO_MODE_BODY,
423168
423230
  FACTORY_DEFAULT_AUTO_MODE_NOTICE: () => FACTORY_DEFAULT_AUTO_MODE_NOTICE,
423231
+ FACTORY_DEFAULT_AUTO_MODE_POINTER: () => FACTORY_DEFAULT_AUTO_MODE_POINTER,
423232
+ FACTORY_DEFAULT_AUTO_MODE_TITLE: () => FACTORY_DEFAULT_AUTO_MODE_TITLE,
423169
423233
  __resetFactoryDefaultAutoForTests: () => __resetFactoryDefaultAutoForTests,
423170
423234
  checkAndDisableBypassPermissions: () => checkAndDisableBypassPermissions,
423171
423235
  createDisabledBypassPermissionsContext: () => createDisabledBypassPermissionsContext,
@@ -423174,6 +423238,7 @@ __export(permissionSetup_exports, {
423174
423238
  findDangerousClassifierPermissions: () => findDangerousClassifierPermissions,
423175
423239
  findOverlyBroadBashPermissions: () => findOverlyBroadBashPermissions2,
423176
423240
  findOverlyBroadPowerShellPermissions: () => findOverlyBroadPowerShellPermissions,
423241
+ foldAdditionalWorkingDirectories: () => foldAdditionalWorkingDirectories,
423177
423242
  getAutoModeEnabledState: () => getAutoModeEnabledState,
423178
423243
  getAutoModeEnabledStateIfCached: () => getAutoModeEnabledStateIfCached,
423179
423244
  getAutoModeUnavailableNotification: () => getAutoModeUnavailableNotification,
@@ -423196,6 +423261,7 @@ __export(permissionSetup_exports, {
423196
423261
  prepareContextForPlanMode: () => prepareContextForPlanMode,
423197
423262
  removeDangerousPermissions: () => removeDangerousPermissions2,
423198
423263
  restoreDangerousPermissions: () => restoreDangerousPermissions,
423264
+ retiredToolNameNotices: () => retiredToolNameNotices,
423199
423265
  shouldDisableBypassPermissions: () => shouldDisableBypassPermissions,
423200
423266
  shouldPlanUseAutoMode: () => shouldPlanUseAutoMode,
423201
423267
  stripDangerousPermissionsForAutoMode: () => stripDangerousPermissionsForAutoMode,
@@ -423464,6 +423530,18 @@ function deriveCliArgDenyRules({
423464
423530
  }
423465
423531
  return parsed;
423466
423532
  }
423533
+ function retiredToolNameNotices(lists) {
423534
+ let seen2 = /* @__PURE__ */ new Set(), notices = [];
423535
+ for (let list of lists)
423536
+ if (!(!list || list.length === 0))
423537
+ for (let rule of parseToolListFromCLI([...list])) {
423538
+ let retired = retiredToolNameInRule(rule);
423539
+ retired === void 0 || seen2.has(retired.legacy) || (seen2.add(retired.legacy), notices.push(
423540
+ `Warning: "${retired.legacy}" is a retired tool name \u2014 treating it as "${retired.canonical}".`
423541
+ ));
423542
+ }
423543
+ return notices;
423544
+ }
423467
423545
  function parseBaseToolsFromCLI(baseTools) {
423468
423546
  let joinedInput = baseTools.join(" ").trim();
423469
423547
  return parseToolPreset(joinedInput) ? getToolsForDefaultPreset() : parseToolListFromCLI(baseTools);
@@ -423572,7 +423650,11 @@ async function initializeToolPermissionContext({
423572
423650
  }) {
423573
423651
  let parsedAllowedToolsCli = parseToolListFromCLI(allowedToolsCli).map(
423574
423652
  (rule) => permissionRuleValueToString(permissionRuleValueFromString(rule))
423575
- ), parsedDisallowedToolsCli = deriveCliArgDenyRules({ disallowedToolsCli, baseToolsCli }), warnings = [], additionalWorkingDirectories = /* @__PURE__ */ new Map(), processPwd = process.env.PWD;
423653
+ ), parsedDisallowedToolsCli = deriveCliArgDenyRules({ disallowedToolsCli, baseToolsCli }), warnings = [];
423654
+ warnings.push(
423655
+ ...retiredToolNameNotices([allowedToolsCli, disallowedToolsCli, baseToolsCli])
423656
+ );
423657
+ let additionalWorkingDirectories = /* @__PURE__ */ new Map(), processPwd = process.env.PWD;
423576
423658
  processPwd && processPwd !== getOriginalCwd() && isSymlinkTo({ originalCwd: getOriginalCwd(), processPwd }) && additionalWorkingDirectories.set(processPwd, {
423577
423659
  path: processPwd,
423578
423660
  source: "session"
@@ -423595,26 +423677,34 @@ async function initializeToolPermissionContext({
423595
423677
  isAutoModeAvailable: isAutoModeGateEnabled()
423596
423678
  },
423597
423679
  rulesFromDisk
423598
- ), allAdditionalDirectories = [
423599
- ...settings2.permissions?.additionalDirectories || [],
423600
- ...addDirs
423601
- ], validationResults = await Promise.all(
423602
- allAdditionalDirectories.map(
423603
- (dir) => validateDirectoryForWorkspace(dir, toolPermissionContext)
423604
- )
423680
+ ), folded = await foldAdditionalWorkingDirectories({
423681
+ toolPermissionContext,
423682
+ directories: [
423683
+ ...settings2.permissions?.additionalDirectories || [],
423684
+ ...addDirs
423685
+ ]
423686
+ });
423687
+ return toolPermissionContext = folded.toolPermissionContext, warnings.push(...folded.warnings), {
423688
+ toolPermissionContext,
423689
+ warnings,
423690
+ dangerousPermissions,
423691
+ overlyBroadBashPermissions
423692
+ };
423693
+ }
423694
+ async function foldAdditionalWorkingDirectories({
423695
+ toolPermissionContext,
423696
+ directories
423697
+ }) {
423698
+ let context3 = toolPermissionContext, warnings = [], validationResults = await Promise.all(
423699
+ directories.map((dir) => validateDirectoryForWorkspace(dir, context3))
423605
423700
  );
423606
423701
  for (let result of validationResults)
423607
- result.resultType === "success" ? toolPermissionContext = applyPermissionUpdate(toolPermissionContext, {
423702
+ result.resultType === "success" ? context3 = applyPermissionUpdate(context3, {
423608
423703
  type: "addDirectories",
423609
423704
  directories: [result.absolutePath],
423610
423705
  destination: "cliArg"
423611
423706
  }) : result.resultType !== "alreadyInWorkingDirectory" && result.resultType !== "pathNotFound" && warnings.push(addDirHelpMessage(result));
423612
- return {
423613
- toolPermissionContext,
423614
- warnings,
423615
- dangerousPermissions,
423616
- overlyBroadBashPermissions
423617
- };
423707
+ return { toolPermissionContext: context3, warnings };
423618
423708
  }
423619
423709
  function getAutoModeUnavailableNotification(reason) {
423620
423710
  let base;
@@ -423765,7 +423855,7 @@ function transitionPlanAutoMode(context3) {
423765
423855
  let want = shouldPlanUseAutoMode(), have = autoModeStateModule5?.isAutoModeActive() ?? !1;
423766
423856
  return want && have ? stripDangerousPermissionsForAutoMode(context3) : !want && !have ? context3 : want ? (autoModeStateModule5?.setAutoModeActive(!0), setNeedsAutoModeExitAttachment(!1), stripDangerousPermissionsForAutoMode(context3)) : (autoModeStateModule5?.setAutoModeActive(!1), setNeedsAutoModeExitAttachment(!0), restoreDangerousPermissions(context3));
423767
423857
  }
423768
- var autoModeStateModule5, factoryDefaultAutoActive, FACTORY_DEFAULT_AUTO_MODE_NOTICE, AUTO_MODE_ENABLED_DEFAULT, NO_CACHED_AUTO_MODE_CONFIG, init_permissionSetup = __esm({
423858
+ var autoModeStateModule5, factoryDefaultAutoActive, FACTORY_DEFAULT_AUTO_MODE_TITLE, FACTORY_DEFAULT_AUTO_MODE_BODY, FACTORY_DEFAULT_AUTO_MODE_POINTER, FACTORY_DEFAULT_AUTO_MODE_NOTICE, AUTO_MODE_ENABLED_DEFAULT, NO_CACHED_AUTO_MODE_CONFIG, init_permissionSetup = __esm({
423769
423859
  "build-src/src/utils/permissions/permissionSetup.ts"() {
423770
423860
  init_state();
423771
423861
  init_cwd();
@@ -423793,7 +423883,9 @@ var autoModeStateModule5, factoryDefaultAutoActive, FACTORY_DEFAULT_AUTO_MODE_NO
423793
423883
  init_permissionRuleParser();
423794
423884
  autoModeStateModule5 = (init_autoModeState(), __toCommonJS(autoModeState_exports));
423795
423885
  factoryDefaultAutoActive = !1;
423796
- FACTORY_DEFAULT_AUTO_MODE_NOTICE = "permission mode: auto (factory default) \u2014 shift+tab to change it";
423886
+ FACTORY_DEFAULT_AUTO_MODE_TITLE = "permission mode: auto (factory default) \u2014 shift+tab to change it", FACTORY_DEFAULT_AUTO_MODE_BODY = "Auto mode lets Sema handle permission prompts automatically. Sema checks each tool call for risky actions and prompt injection before executing, runs the ones it assesses as lower-risk, and blocks the rest.", FACTORY_DEFAULT_AUTO_MODE_POINTER = "Run /help to see this again, or shift+tab to switch modes.", FACTORY_DEFAULT_AUTO_MODE_NOTICE = `${FACTORY_DEFAULT_AUTO_MODE_TITLE}
423887
+ ${FACTORY_DEFAULT_AUTO_MODE_BODY}
423888
+ ${FACTORY_DEFAULT_AUTO_MODE_POINTER}`;
423797
423889
  AUTO_MODE_ENABLED_DEFAULT = "disabled";
423798
423890
  NO_CACHED_AUTO_MODE_CONFIG = /* @__PURE__ */ Symbol("no-cached-auto-mode-config");
423799
423891
  }
@@ -426313,7 +426405,6 @@ var init_feedbackCenterSinkCaps = __esm({
426313
426405
  });
426314
426406
 
426315
426407
  // build-src/src/sema/feedbackCenterSink.ts
426316
- import { postFeedback, RegistryApiError as RegistryApiError2 } from "@sema-agent/sdk/registry";
426317
426408
  function resolveFeedbackCenterGate() {
426318
426409
  let resolved = resolveProfile(), hasCredentials = !!(resolved && readCredentials()[resolved.name]);
426319
426410
  return feedbackCenterGateFromState(resolved?.profile, resolved?.name, hasCredentials);
@@ -426344,11 +426435,12 @@ async function submitFeedbackToCenter(data, signal) {
426344
426435
  let { id } = await postFeedback(client3, buildFeedbackCenterRequestBody(data), signal ? { signal } : {});
426345
426436
  return { success: !0, feedbackId: id };
426346
426437
  } catch (e) {
426347
- return e instanceof RegistryApiError2 ? e.status >= 200 && e.status < 300 ? { success: !1, error: "server_error", message: "Couldn't send feedback: response did not return an id." } : { success: !1, error: "server_error", message: `Couldn't send feedback (server returned ${e.status}).` } : { success: !1, error: "network_error", message: "Couldn't send feedback (couldn't reach the service)." };
426438
+ return e instanceof RegistryApiError ? e.status >= 200 && e.status < 300 ? { success: !1, error: "server_error", message: "Couldn't send feedback: response did not return an id." } : { success: !1, error: "server_error", message: `Couldn't send feedback (server returned ${e.status}).` } : { success: !1, error: "network_error", message: "Couldn't send feedback (couldn't reach the service)." };
426348
426439
  }
426349
426440
  }
426350
426441
  var init_feedbackCenterSink = __esm({
426351
426442
  "build-src/src/sema/feedbackCenterSink.ts"() {
426443
+ init_sdkRegistryTransit();
426352
426444
  init_cloudProfile();
426353
426445
  init_cloudAuth();
426354
426446
  init_registrySdkClient();
@@ -429151,31 +429243,23 @@ var sema_brand_default, init_sema_brand = __esm({
429151
429243
  _doc: "displayName/email \u7559 null = \u8FD0\u884C\u65F6\u56DE\u9000(\u540D\u5B57\u53D6\u672C\u673A OS \u7528\u6237\u540D,\u90AE\u7BB1\u4E0D\u663E\u793A)\u3002\u522B\u70E7\u4E2A\u4EBA\u4FE1\u606F\u8FDB\u54C1\u724C\u6587\u4EF6(F-S1-1:\u65B0\u7528\u6237\u66FE\u770B\u5230 Welcome back Clay!)\u3002"
429152
429244
  },
429153
429245
  whatsNew: {
429154
- version: "1.0.129",
429246
+ version: "1.0.130",
429155
429247
  notes: [
429156
- "Bundled engine 7.93.3 (core 7.26.2), client runtime 0.79.0 and client SDK 11.3.0. /doctor and the engine line report 7.93.3.",
429157
- "Quitting sema and starting it again right away no longer fails with an engine startup error while the previous engine is still shutting down: sema waits for it (and says so only when the wait takes more than a moment), then starts a fresh engine.",
429158
- "-p --model <name> is sent to the engine: a model that is not in the catalog is refused by name, and the init line shows the model that actually ran.",
429159
- "-p --agents definitions reach the model: agents declared on the command line are listed alongside the ones on disk, and a command-line definition overrides a same-named one on disk.",
429160
- "-p --json-schema constrains the answer: the result carries the structured output; a value that is not a JSON object is refused on one line with a non-zero exit instead of a stack trace.",
429161
- "--mcp-config and --strict-mcp-config work when starting the interactive session, not only with -p: the servers show up in /mcp and are reachable by the model.",
429162
- 'In the slash-command menu, Enter runs what you typed: if no listed command starts with it, the input is submitted as is and answered with "Unknown command: /x" plus a "Did you mean" hint for a close name, instead of running the first menu entry. Tab still completes.',
429163
- "In -p mode under the default permission mode, stderr says up front that tools needing approval will be denied and how to change that; the same sentence is in --help.",
429164
- "A tool denied by policy in a run with no approval prompt tells the model it was denied by policy, not that the user declined.",
429165
- 'Project writes are no longer folded into "scratchpad edit" rows just because a directory is named scratchpad; only the real scratchpad directory counts.',
429166
- `The onboarding wizard fits an 80\xD724 terminal: the "enter to start" line and the theme picker's hint stay on screen instead of being cut off.`,
429167
- "The interactive session prints a starting-up line immediately, and a second line when it starts or reuses the local engine, instead of staying blank until the engine answers.",
429168
- "/mcp server details show the engine's view of the server; a lost shell-side connection is noted as such instead of being shown as a failed server.",
429169
- "Deleting a rule from the Deny tab explains what removing it changes, and the panel stays on the Deny tab afterwards.",
429170
- "/tasks details show a delegated agent's report as plain text, with a note when the agent was stopped before finishing or produced no text.",
429171
- "--max-budget-usd rejects amounts it cannot read (exponent, hex, leading-dot, zero, negative, infinite) on one line with a non-zero exit.",
429172
- "Credentials pasted into error messages, MCP server URLs (including path parameters), plugin list --json, and the agents panel are redacted consistently; control characters and bidi marks in engine output cannot reach the terminal.",
429173
- "The webSearch section is taken from one settings source as a whole: a project's provider/endpoint can no longer borrow the user's key, and an untrusted workspace's webSearch section is ignored.",
429174
- "A background agent that finishes while the session is idle is announced on screen at once, not after the next message."
429248
+ "Bundled engine 7.93.5 (core 7.26.2), client runtime 0.79.1 and client SDK 11.3.0. /doctor and the engine line report 7.93.5.",
429249
+ "-p --json-schema: the structured output now arrives on the result line as structured_output (the older structuredOutput spelling is still present in this release); without --json-schema neither key is present.",
429250
+ "Write approval cards show the target path on engine deployments that do not provide guarded writes (previously the card could show an empty write).",
429251
+ "First screen in the factory auto permission mode explains what auto mode does and how to switch (three lines instead of one); /help has a Permission modes section with the same wording.",
429252
+ "--help marks --ax-screen-reader, --plugin-url, --exclude-dynamic-system-prompt-sections, --fallback-model and --remote-control-session-name-prefix as recognized for compatibility but not wired yet; the --scenario, --fallback-model and --file descriptions now match what the flags do.",
429253
+ "--add-dir works in the interactive session the same way as with -p (existing directories are added; a file path is skipped with a note).",
429254
+ "--agent-teams: the team_create tool description tells the model how to work with named background agents instead of describing an empty team.",
429255
+ "Slash-command typeahead: pressing Enter with stale text in the same input batch no longer runs a different command than the one on screen.",
429256
+ "stream-json: the system/init line lists the Agent tool under the same name the stream uses (no longer the retired Task name), so a consumer that builds its own allow/deny list from that line matches what actually runs; --disallowedTools Task is still honoured and says it was applied to Agent.",
429257
+ "The process name reported by ps is sema for -p runs and subcommands (doctor, mcp, plugin, auth), not only for the interactive session; CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 still leaves it untouched.",
429258
+ "Printed diagnostics: a token count such as max_tokens=7 or num_tokens = 1024 is no longer replaced by the credential placeholder; credential-looking labels (api_key=, access_tokens=, ANTHROPIC_AUTH_TOKEN=) are still replaced."
429175
429259
  ]
429176
429260
  },
429177
- productVersion: "1.0.129",
429178
- announcement: "sema 1.0.129 \u2014 engine 7.93.3 pickup (core 7.26.2), client runtime 0.79.0, client SDK 11.3.0. Restarting sema right after quitting waits for the old engine instead of failing; -p --model, --agents and --json-schema now reach the engine and --mcp-config works in the interactive session; a tool denied by policy in -p mode is reported as a policy denial; Enter in the slash-command menu no longer runs the first entry when your text matches nothing; the onboarding wizard fits 80\xD724; the session prints a starting-up line at once; /mcp details, the Deny tab's delete card and /tasks reports are clearer; credentials in errors, URLs and panels are redacted consistently.",
429261
+ productVersion: "1.0.130",
429262
+ announcement: "sema 1.0.130 \u2014 engine 7.93.5 pickup (core 7.26.2), client runtime 0.79.1, client SDK 11.3.0. Structured output from -p --json-schema arrives as structured_output; --add-dir works in the interactive session; the first screen explains the factory auto permission mode; --help says which compatibility flags have no effect yet; the stream-json init line names tools the same way the stream does; a max_tokens value is no longer hidden as a credential.",
429179
429263
  version: "1.0.91"
429180
429264
  };
429181
429265
  }
@@ -456519,31 +456603,23 @@ var require_sema_brand = __commonJS({
456519
456603
  _doc: "displayName/email \u7559 null = \u8FD0\u884C\u65F6\u56DE\u9000(\u540D\u5B57\u53D6\u672C\u673A OS \u7528\u6237\u540D,\u90AE\u7BB1\u4E0D\u663E\u793A)\u3002\u522B\u70E7\u4E2A\u4EBA\u4FE1\u606F\u8FDB\u54C1\u724C\u6587\u4EF6(F-S1-1:\u65B0\u7528\u6237\u66FE\u770B\u5230 Welcome back Clay!)\u3002"
456520
456604
  },
456521
456605
  whatsNew: {
456522
- version: "1.0.129",
456606
+ version: "1.0.130",
456523
456607
  notes: [
456524
- "Bundled engine 7.93.3 (core 7.26.2), client runtime 0.79.0 and client SDK 11.3.0. /doctor and the engine line report 7.93.3.",
456525
- "Quitting sema and starting it again right away no longer fails with an engine startup error while the previous engine is still shutting down: sema waits for it (and says so only when the wait takes more than a moment), then starts a fresh engine.",
456526
- "-p --model <name> is sent to the engine: a model that is not in the catalog is refused by name, and the init line shows the model that actually ran.",
456527
- "-p --agents definitions reach the model: agents declared on the command line are listed alongside the ones on disk, and a command-line definition overrides a same-named one on disk.",
456528
- "-p --json-schema constrains the answer: the result carries the structured output; a value that is not a JSON object is refused on one line with a non-zero exit instead of a stack trace.",
456529
- "--mcp-config and --strict-mcp-config work when starting the interactive session, not only with -p: the servers show up in /mcp and are reachable by the model.",
456530
- 'In the slash-command menu, Enter runs what you typed: if no listed command starts with it, the input is submitted as is and answered with "Unknown command: /x" plus a "Did you mean" hint for a close name, instead of running the first menu entry. Tab still completes.',
456531
- "In -p mode under the default permission mode, stderr says up front that tools needing approval will be denied and how to change that; the same sentence is in --help.",
456532
- "A tool denied by policy in a run with no approval prompt tells the model it was denied by policy, not that the user declined.",
456533
- 'Project writes are no longer folded into "scratchpad edit" rows just because a directory is named scratchpad; only the real scratchpad directory counts.',
456534
- `The onboarding wizard fits an 80\xD724 terminal: the "enter to start" line and the theme picker's hint stay on screen instead of being cut off.`,
456535
- "The interactive session prints a starting-up line immediately, and a second line when it starts or reuses the local engine, instead of staying blank until the engine answers.",
456536
- "/mcp server details show the engine's view of the server; a lost shell-side connection is noted as such instead of being shown as a failed server.",
456537
- "Deleting a rule from the Deny tab explains what removing it changes, and the panel stays on the Deny tab afterwards.",
456538
- "/tasks details show a delegated agent's report as plain text, with a note when the agent was stopped before finishing or produced no text.",
456539
- "--max-budget-usd rejects amounts it cannot read (exponent, hex, leading-dot, zero, negative, infinite) on one line with a non-zero exit.",
456540
- "Credentials pasted into error messages, MCP server URLs (including path parameters), plugin list --json, and the agents panel are redacted consistently; control characters and bidi marks in engine output cannot reach the terminal.",
456541
- "The webSearch section is taken from one settings source as a whole: a project's provider/endpoint can no longer borrow the user's key, and an untrusted workspace's webSearch section is ignored.",
456542
- "A background agent that finishes while the session is idle is announced on screen at once, not after the next message."
456608
+ "Bundled engine 7.93.5 (core 7.26.2), client runtime 0.79.1 and client SDK 11.3.0. /doctor and the engine line report 7.93.5.",
456609
+ "-p --json-schema: the structured output now arrives on the result line as structured_output (the older structuredOutput spelling is still present in this release); without --json-schema neither key is present.",
456610
+ "Write approval cards show the target path on engine deployments that do not provide guarded writes (previously the card could show an empty write).",
456611
+ "First screen in the factory auto permission mode explains what auto mode does and how to switch (three lines instead of one); /help has a Permission modes section with the same wording.",
456612
+ "--help marks --ax-screen-reader, --plugin-url, --exclude-dynamic-system-prompt-sections, --fallback-model and --remote-control-session-name-prefix as recognized for compatibility but not wired yet; the --scenario, --fallback-model and --file descriptions now match what the flags do.",
456613
+ "--add-dir works in the interactive session the same way as with -p (existing directories are added; a file path is skipped with a note).",
456614
+ "--agent-teams: the team_create tool description tells the model how to work with named background agents instead of describing an empty team.",
456615
+ "Slash-command typeahead: pressing Enter with stale text in the same input batch no longer runs a different command than the one on screen.",
456616
+ "stream-json: the system/init line lists the Agent tool under the same name the stream uses (no longer the retired Task name), so a consumer that builds its own allow/deny list from that line matches what actually runs; --disallowedTools Task is still honoured and says it was applied to Agent.",
456617
+ "The process name reported by ps is sema for -p runs and subcommands (doctor, mcp, plugin, auth), not only for the interactive session; CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 still leaves it untouched.",
456618
+ "Printed diagnostics: a token count such as max_tokens=7 or num_tokens = 1024 is no longer replaced by the credential placeholder; credential-looking labels (api_key=, access_tokens=, ANTHROPIC_AUTH_TOKEN=) are still replaced."
456543
456619
  ]
456544
456620
  },
456545
- productVersion: "1.0.129",
456546
- announcement: "sema 1.0.129 \u2014 engine 7.93.3 pickup (core 7.26.2), client runtime 0.79.0, client SDK 11.3.0. Restarting sema right after quitting waits for the old engine instead of failing; -p --model, --agents and --json-schema now reach the engine and --mcp-config works in the interactive session; a tool denied by policy in -p mode is reported as a policy denial; Enter in the slash-command menu no longer runs the first entry when your text matches nothing; the onboarding wizard fits 80\xD724; the session prints a starting-up line at once; /mcp details, the Deny tab's delete card and /tasks reports are clearer; credentials in errors, URLs and panels are redacted consistently.",
456621
+ productVersion: "1.0.130",
456622
+ announcement: "sema 1.0.130 \u2014 engine 7.93.5 pickup (core 7.26.2), client runtime 0.79.1, client SDK 11.3.0. Structured output from -p --json-schema arrives as structured_output; --add-dir works in the interactive session; the first screen explains the factory auto permission mode; --help says which compatibility flags have no effect yet; the stream-json init line names tools the same way the stream does; a max_tokens value is no longer hidden as a credential.",
456547
456623
  version: "1.0.91"
456548
456624
  };
456549
456625
  }
@@ -496270,23 +496346,20 @@ var init_teamMemPaths = __esm({
496270
496346
  var systemInit_exports = {};
496271
496347
  __export(systemInit_exports, {
496272
496348
  buildSystemInitMessage: () => buildSystemInitMessage,
496273
- localFastModeDisabledReason: () => localFastModeDisabledReason,
496274
- sdkCompatToolName: () => sdkCompatToolName
496349
+ localFastModeDisabledReason: () => localFastModeDisabledReason
496275
496350
  });
496276
496351
  import { randomUUID as randomUUID37 } from "crypto";
496277
496352
  function localFastModeDisabledReason() {
496278
496353
  return isFastModeEnabled() ? void 0 : "disabled_by_env";
496279
496354
  }
496280
- function sdkCompatToolName(name) {
496281
- return name === AGENT_TOOL_NAME ? LEGACY_AGENT_TOOL_NAME : name;
496282
- }
496283
496355
  function buildSystemInitMessage(inputs) {
496284
496356
  let outputStyle2 = inputs.outputStyle, initMessage = {
496285
496357
  type: "system",
496286
496358
  subtype: "init",
496287
496359
  cwd: getCwd(),
496288
496360
  session_id: getSessionId(),
496289
- tools: inputs.tools.map((tool) => sdkCompatToolName(tool.name)),
496361
+ // L-502:引擎 wire 上那个名字原样上报(修前过 sdkCompatToolName 翻成退休名;头注有取证与理由)
496362
+ tools: inputs.tools.map((tool) => tool.name),
496290
496363
  mcp_servers: inputs.mcpClients.map((client3) => ({
496291
496364
  name: client3.name,
496292
496365
  status: client3.type
@@ -496328,7 +496401,6 @@ function buildSystemInitMessage(inputs) {
496328
496401
  var init_systemInit = __esm({
496329
496402
  "build-src/src/utils/messages/systemInit.ts"() {
496330
496403
  init_state();
496331
- init_constants3();
496332
496404
  init_config5();
496333
496405
  init_policyLimits();
496334
496406
  init_paths();
@@ -513871,6 +513943,9 @@ function shouldAutoSelectCommandSuggestion(input, suggestions) {
513871
513943
  function unarmedEnterSubmitsVerbatim(suggestionType) {
513872
513944
  return suggestionType === "command" || suggestionType === "custom-title" || suggestionType === "file" || suggestionType === "slack-channel";
513873
513945
  }
513946
+ function resolveTypeaheadEnterPrelude(a) {
513947
+ return a.suggestionType === "command" && a.liveInput !== a.renderedInput ? { kind: "stale-command-input", value: a.liveInput } : a.selectedSuggestion < 0 || a.suggestionCount === 0 ? a.suggestionCount > 0 && unarmedEnterSubmitsVerbatim(a.suggestionType) ? { kind: "submit-verbatim", value: a.liveInput } : { kind: "swallow" } : { kind: "fall-through" };
513948
+ }
513874
513949
  function applyCommandSuggestion(suggestion, shouldExecute, commands, onInputChange, setCursorOffset, onSubmit) {
513875
513950
  if (typeof suggestion != "string") {
513876
513951
  let argReplacement = asCommandArgReplacement(suggestion.metadata);
@@ -514311,6 +514386,7 @@ function useTypeahead({
514311
514386
  onSubmit,
514312
514387
  setCursorOffset,
514313
514388
  input,
514389
+ liveInputRef,
514314
514390
  cursorOffset,
514315
514391
  mode,
514316
514392
  agents: agents3,
@@ -514740,14 +514816,47 @@ function useTypeahead({
514740
514816
  })), setSuggestionType(suggestionType2), setMaxColumnWidth(void 0));
514741
514817
  }
514742
514818
  }, [suggestions, selectedSuggestion, input, suggestionType, commands, mode, onInputChange, setCursorOffset, onSubmit, clearSuggestions, cursorOffset, updateSuggestions, mcpResources, setSuggestionsState, agents3, debouncedFetchFileSuggestions, debouncedFetchSlackChannels, effectiveGhostText]), handleEnter = (0, import_react251.useCallback)(() => {
514743
- if (selectedSuggestion < 0 || suggestions.length === 0) {
514744
- suggestions.length > 0 && unarmedEnterSubmitsVerbatim(suggestionType) && (debouncedFetchFileSuggestions.cancel(), debouncedFetchSlackChannels.cancel(), clearSuggestions(), onSubmit(
514745
- input,
514819
+ let liveInput = liveInputRef?.current ?? input, prelude = resolveTypeaheadEnterPrelude({
514820
+ renderedInput: input,
514821
+ liveInput,
514822
+ suggestionType,
514823
+ suggestionCount: suggestions.length,
514824
+ selectedSuggestion
514825
+ });
514826
+ if (prelude.kind === "stale-command-input") {
514827
+ debouncedFetchFileSuggestions.cancel(), debouncedFetchSlackChannels.cancel(), clearSuggestions();
514828
+ let value = prelude.value;
514829
+ if (mode === "prompt" && isCommandInput(value) && value.slice(1).trim() !== "") {
514830
+ let freshItems = generateCommandSuggestions(value, commands), freshFirst = freshItems[0];
514831
+ if (freshFirst && shouldAutoSelectCommandSuggestion(value, freshItems)) {
514832
+ applyCommandSuggestion(
514833
+ freshFirst,
514834
+ !0,
514835
+ // execute on return
514836
+ commands,
514837
+ onInputChange,
514838
+ setCursorOffset,
514839
+ onSubmit
514840
+ );
514841
+ return;
514842
+ }
514843
+ }
514844
+ onSubmit(
514845
+ value,
514746
514846
  /* isSubmittingSlashCommand */
514747
514847
  !0
514748
- ));
514848
+ );
514849
+ return;
514850
+ }
514851
+ if (prelude.kind === "submit-verbatim") {
514852
+ debouncedFetchFileSuggestions.cancel(), debouncedFetchSlackChannels.cancel(), clearSuggestions(), onSubmit(
514853
+ prelude.value,
514854
+ /* isSubmittingSlashCommand */
514855
+ !0
514856
+ );
514749
514857
  return;
514750
514858
  }
514859
+ if (prelude.kind === "swallow") return;
514751
514860
  let suggestion = suggestions[selectedSuggestion];
514752
514861
  if (suggestionType === "command" && selectedSuggestion < suggestions.length)
514753
514862
  suggestion && (applyCommandSuggestion(
@@ -514804,7 +514913,7 @@ function useTypeahead({
514804
514913
  }
514805
514914
  debouncedFetchFileSuggestions.cancel(), clearSuggestions();
514806
514915
  }
514807
- }, [suggestions, selectedSuggestion, suggestionType, commands, input, cursorOffset, mode, onInputChange, setCursorOffset, onSubmit, clearSuggestions, debouncedFetchFileSuggestions, debouncedFetchSlackChannels]), handleAutocompleteAccept = (0, import_react251.useCallback)(() => {
514916
+ }, [suggestions, selectedSuggestion, suggestionType, commands, input, liveInputRef, cursorOffset, mode, onInputChange, setCursorOffset, onSubmit, clearSuggestions, debouncedFetchFileSuggestions, debouncedFetchSlackChannels]), handleAutocompleteAccept = (0, import_react251.useCallback)(() => {
514808
514917
  handleTab();
514809
514918
  }, [handleTab]), handleAutocompleteDismiss = (0, import_react251.useCallback)(() => {
514810
514919
  debouncedFetchFileSuggestions.cancel(), debouncedFetchSlackChannels.cancel(), clearSuggestions(), dismissedForInputRef.current = input;
@@ -518669,10 +518778,10 @@ function PromptInput({
518669
518778
  show: !1
518670
518779
  }), [cursorOffset, setCursorOffset] = (0, import_react272.useState)(input.length), localBatchSyncRef = React164.useRef(null), batchTextSyncRef = batchTextSyncRefProp ?? localBatchSyncRef, onInputChange = React164.useCallback((value) => {
518671
518780
  batchTextSyncRef.current?.(value), onInputChangeProp(value);
518672
- }, [onInputChangeProp, batchTextSyncRef]), lastInternalInputRef = React164.useRef(input);
518673
- input !== lastInternalInputRef.current && (setCursorOffset(input.length), lastInternalInputRef.current = input);
518781
+ }, [onInputChangeProp, batchTextSyncRef]), lastInternalInputRef = React164.useRef(input), liveInputTextRef = React164.useRef(input);
518782
+ input !== lastInternalInputRef.current && (setCursorOffset(input.length), lastInternalInputRef.current = input, liveInputTextRef.current = input);
518674
518783
  let trackAndSetInput = React164.useCallback((value) => {
518675
- lastInternalInputRef.current = value, onInputChange(value);
518784
+ lastInternalInputRef.current = value, liveInputTextRef.current = value, onInputChange(value);
518676
518785
  }, [onInputChange]);
518677
518786
  insertTextRef && (insertTextRef.current = {
518678
518787
  cursorOffset,
@@ -518975,7 +519084,7 @@ function PromptInput({
518975
519084
  submitCount,
518976
519085
  viewingAgentName
518977
519086
  }), onChange = (0, import_react272.useCallback)((value) => {
518978
- if (value === "?") {
519087
+ if (liveInputTextRef.current = value, value === "?") {
518979
519088
  setHelpOpen((v2) => !v2);
518980
519089
  return;
518981
519090
  }
@@ -519132,6 +519241,8 @@ function PromptInput({
519132
519241
  onSubmit,
519133
519242
  setCursorOffset,
519134
519243
  input,
519244
+ // 见 liveInputTextRef 的头注:批内它就是输入框将要提交的那段文本,而 `input` prop 还差一拍。
519245
+ liveInputRef: liveInputTextRef,
519135
519246
  cursorOffset,
519136
519247
  mode,
519137
519248
  agents: agents3,
@@ -542230,6 +542341,7 @@ var ENTERPRISE_MCP_STRICT_REJECTION, ENTERPRISE_MCP_DYNAMIC_REJECTION, init_mcpC
542230
542341
  var unwiredFlagNotice_exports = {};
542231
542342
  __export(unwiredFlagNotice_exports, {
542232
542343
  UNWIRED_FLAGS: () => UNWIRED_FLAGS,
542344
+ UNWIRED_FLAG_HELP_SUFFIX: () => UNWIRED_FLAG_HELP_SUFFIX,
542233
542345
  flagUnwiredOnLane: () => flagUnwiredOnLane,
542234
542346
  resetUnwiredFlagNotices: () => resetUnwiredFlagNotices,
542235
542347
  takeUnwiredFlagNotice: () => takeUnwiredFlagNotice,
@@ -542259,7 +542371,7 @@ function flagUnwiredOnLane(spec, lane) {
542259
542371
  function resetUnwiredFlagNotices() {
542260
542372
  noticed2.clear();
542261
542373
  }
542262
- var UNWIRED_FLAGS, noticed2, init_unwiredFlagNotice = __esm({
542374
+ var UNWIRED_FLAGS, UNWIRED_FLAG_HELP_SUFFIX, noticed2, init_unwiredFlagNotice = __esm({
542263
542375
  "build-src/src/sema/unwiredFlagNotice.ts"() {
542264
542376
  UNWIRED_FLAGS = [
542265
542377
  { optionKey: "thinkingDisplay", flag: "--thinking-display", argvToken: "--thinking-display" },
@@ -542272,9 +542384,8 @@ var UNWIRED_FLAGS, noticed2, init_unwiredFlagNotice = __esm({
542272
542384
  { optionKey: "replyOnResume", flag: "--reply-on-resume", argvToken: "--reply-on-resume" },
542273
542385
  { optionKey: "pluginDirNoMcp", flag: "--plugin-dir-no-mcp", argvToken: "--plugin-dir-no-mcp" },
542274
542386
  { optionKey: "pluginUrl", flag: "--plugin-url", argvToken: "--plugin-url" },
542275
- { optionKey: "background", flag: "--bg/--background", argvToken: "--background" },
542276
- { optionKey: "bg", flag: "--bg/--background", argvToken: "--bg" },
542277
542387
  { optionKey: "axScreenReader", flag: "--ax-screen-reader", argvToken: "--ax-screen-reader" },
542388
+ { optionKey: "remoteControlSessionNamePrefix", flag: "--remote-control-session-name-prefix", argvToken: "--remote-control-session-name-prefix" },
542278
542389
  // L-433(1.0.125,活性普查)—— `-p` 车道上「解析了、传下去了、没人读」的那一族。
542279
542390
  // `--json-schema`:1.0.129 起 print 车道真上 wire(L-480),交互车道仍零消费点 —— 车道位理由
542280
542391
  // 与判据坐标见本文件头注「接线是按车道成立的」那一段(与 `--max-budget-usd` 同档)。
@@ -542287,7 +542398,7 @@ var UNWIRED_FLAGS, noticed2, init_unwiredFlagNotice = __esm({
542287
542398
  { optionKey: "maxBudgetUsd", flag: "--max-budget-usd", argvToken: "--max-budget-usd", lanes: ["interactive"] },
542288
542399
  { optionKey: "fallbackModel", flag: "--fallback-model", argvToken: "--fallback-model" },
542289
542400
  { optionKey: "permissionPromptTool", flag: "--permission-prompt-tool", argvToken: "--permission-prompt-tool" }
542290
- ];
542401
+ ], UNWIRED_FLAG_HELP_SUFFIX = " Recognized for CC compatibility but not wired in this sema build yet \u2014 it currently has no effect.";
542291
542402
  noticed2 = /* @__PURE__ */ new Set();
542292
542403
  }
542293
542404
  });
@@ -550397,7 +550508,6 @@ __export(cloudAdmin_exports, {
550397
550508
  imageFaceAbsence: () => imageFaceAbsence,
550398
550509
  imageFaceAbsenceLines: () => imageFaceAbsenceLines
550399
550510
  });
550400
- import { OAuthFlowError as OAuthFlowError2 } from "@sema-agent/sdk/registry";
550401
550511
  function fail3(e) {
550402
550512
  err4(`Error: ${e instanceof Error ? e.message : String(e)}`), process.exit(1);
550403
550513
  }
@@ -550430,7 +550540,7 @@ async function api(ctx, path28, init2) {
550430
550540
  });
550431
550541
  return { status: r.status, json: asRec2(r.body) ?? {} };
550432
550542
  } catch (e) {
550433
- throw e instanceof OAuthFlowError2 ? new CloudAuthError(
550543
+ throw e instanceof OAuthFlowError ? new CloudAuthError(
550434
550544
  `the registry rejected your session (${e.code}) \u2014 sign in again: sema cloud login`,
550435
550545
  e.code,
550436
550546
  401
@@ -551190,6 +551300,7 @@ async function cloudPublishWithdraw(options) {
551190
551300
  }
551191
551301
  var out2, err4, asRec2, asArr2, asStr3, asNum2, ROLES, pad, colWidth, fmtTime, AUDIT_KINDS, IMAGE_STATUSES, shortDigest, fmtSize, init_cloudAdmin = __esm({
551192
551302
  "build-src/src/cli/handlers/cloudAdmin.ts"() {
551303
+ init_sdkRegistryTransit();
551193
551304
  init_config_fns();
551194
551305
  init_cloudAuth();
551195
551306
  init_cloudProfile();
@@ -551961,7 +552072,6 @@ __export(cloudResources_exports, {
551961
552072
  import { createHash as createHash31 } from "node:crypto";
551962
552073
  import { existsSync as existsSync38, readdirSync as readdirSync15, readFileSync as readFileSync58, statSync as statSync18 } from "node:fs";
551963
552074
  import { basename as basename70, dirname as dirname92, isAbsolute as isAbsolute34, join as join202, resolve as resolve53 } from "node:path";
551964
- import { getEffective as getEffective2, getMeConfig, getScopeConfigDraft as getScopeConfigDraft2, OAuthFlowError as OAuthFlowError3, RegistryApiError as RegistryApiError3 } from "@sema-agent/sdk/registry";
551965
552075
  function fail5(e) {
551966
552076
  err6(`Error: ${e instanceof Error ? e.message : String(e)}`), process.exit(1);
551967
552077
  }
@@ -552028,7 +552138,7 @@ async function personalFetch(auth2, path28, init2) {
552028
552138
  });
552029
552139
  return { status: r.status, json: asRec3(r.body) ?? {} };
552030
552140
  } catch (e) {
552031
- throw e instanceof OAuthFlowError3 ? new CloudAuthError(`the registry rejected your session (${e.code}) \u2014 sign in again: sema cloud login`, e.code, 401) : new CloudAuthError(`cannot reach registry at ${auth2.registryUrl}: ${e instanceof Error ? e.message : String(e)}`);
552141
+ throw e instanceof OAuthFlowError ? new CloudAuthError(`the registry rejected your session (${e.code}) \u2014 sign in again: sema cloud login`, e.code, 401) : new CloudAuthError(`cannot reach registry at ${auth2.registryUrl}: ${e instanceof Error ? e.message : String(e)}`);
552032
552142
  }
552033
552143
  }
552034
552144
  async function meConfigGet(auth2, domain2, forUser) {
@@ -552036,9 +552146,9 @@ async function meConfigGet(auth2, domain2, forUser) {
552036
552146
  try {
552037
552147
  return await getMeConfig(client3, domain2, forUser ? { forUser } : {});
552038
552148
  } catch (e) {
552039
- if (e instanceof OAuthFlowError3)
552149
+ if (e instanceof OAuthFlowError)
552040
552150
  throw new CloudAuthError(`the registry rejected your session (${e.code}) \u2014 sign in again: sema cloud login`, e.code, 401);
552041
- if (e instanceof RegistryApiError3) {
552151
+ if (e instanceof RegistryApiError) {
552042
552152
  let json2 = asRec3(e.body) ?? {};
552043
552153
  if (forUser) {
552044
552154
  let managed = managedLaneError(forUser, e.status, json2);
@@ -552152,19 +552262,19 @@ async function teamFetch(ctx, path28, init2) {
552152
552262
  });
552153
552263
  return { status: r.status, json: asRec3(r.body) ?? {} };
552154
552264
  } catch (e) {
552155
- throw e instanceof OAuthFlowError3 ? new CloudAuthError(`the registry rejected your session (${e.code}) \u2014 sign in again: sema cloud login`, e.code, 401) : new CloudAuthError(`cannot reach registry at ${ctx.registryUrl}: ${e instanceof Error ? e.message : String(e)}`);
552265
+ throw e instanceof OAuthFlowError ? new CloudAuthError(`the registry rejected your session (${e.code}) \u2014 sign in again: sema cloud login`, e.code, 401) : new CloudAuthError(`cannot reach registry at ${ctx.registryUrl}: ${e instanceof Error ? e.message : String(e)}`);
552156
552266
  }
552157
552267
  }
552158
552268
  async function teamConfigGetDraft(ctx, domain2) {
552159
552269
  try {
552160
- let draft = await getScopeConfigDraft2(ctx.client, ctx.space, domain2);
552270
+ let draft = await getScopeConfigDraft(ctx.client, ctx.space, domain2);
552161
552271
  if (draft.version === null)
552162
552272
  throw new CloudAuthError(
552163
552273
  `the team ${domain2} config has no draft version yet (never published?) \u2014 publish once from the web console, then retry`
552164
552274
  );
552165
552275
  return { ...draft, version: draft.version };
552166
552276
  } catch (e) {
552167
- throw e instanceof OAuthFlowError3 ? new CloudAuthError(`the registry rejected your session (${e.code}) \u2014 sign in again: sema cloud login`, e.code, 401) : e instanceof RegistryApiError3 ? await teamHttpError(ctx, e.status, asRec3(e.body) ?? {}, `reading the team ${domain2} config`, "member (any role)") : new CloudAuthError(`cannot reach registry at ${ctx.registryUrl}: ${e instanceof Error ? e.message : String(e)}`);
552277
+ throw e instanceof OAuthFlowError ? new CloudAuthError(`the registry rejected your session (${e.code}) \u2014 sign in again: sema cloud login`, e.code, 401) : e instanceof RegistryApiError ? await teamHttpError(ctx, e.status, asRec3(e.body) ?? {}, `reading the team ${domain2} config`, "member (any role)") : new CloudAuthError(`cannot reach registry at ${ctx.registryUrl}: ${e instanceof Error ? e.message : String(e)}`);
552168
552278
  }
552169
552279
  }
552170
552280
  async function teamConfigGetPublished(ctx, domain2) {
@@ -552238,7 +552348,7 @@ function effectiveNames(kind, config4) {
552238
552348
  }
552239
552349
  async function reportCeiling(auth2, username, kind, names2) {
552240
552350
  try {
552241
- let client3 = registryClientForProfile(auth2.registryUrl, auth2.profileName, { timeoutMs: 3e4 }), res = await getEffective2(client3, { principal: username });
552351
+ let client3 = registryClientForProfile(auth2.registryUrl, auth2.profileName, { timeoutMs: 3e4 }), res = await getEffective(client3, { principal: username });
552242
552352
  if (res.status === 200) {
552243
552353
  let json2 = asRec3(res.body) ?? {}, visible = effectiveNames(kind, asRec3(json2.config));
552244
552354
  if (visible) {
@@ -552950,6 +553060,7 @@ async function cloudPublish(options) {
552950
553060
  }
552951
553061
  var out4, err6, asRec3, asArr3, asStr4, DOMAIN_NAME_RE, SECRET_SCAN_MAX_DEPTH, PEM_PRIVATE_KEY_RE, PATH_SEGMENT_MAX, personalPath, wantsTeam, TEAM_WRITE_ROLE, teamConfigPath, NOUN, ADD_VERB, REMOVE_VERB, DOMAIN, LIST_KEY, LOCAL_SOURCE, MODEL_FIELD_ALLOWLIST, INLINE_KEY_FIELDS, MODEL_ROLES2, GIT_SHA_RE, byName, init_cloudResources = __esm({
552952
553062
  "build-src/src/cli/handlers/cloudResources.ts"() {
553063
+ init_sdkRegistryTransit();
552953
553064
  init_types6();
552954
553065
  init_cloudAuth();
552955
553066
  init_cloudProfile();
@@ -553007,7 +553118,6 @@ import { existsSync as existsSync39, statSync as statSync19 } from "fs";
553007
553118
  import { createRequire as createRequire5 } from "module";
553008
553119
  import { createInterface as createInterface3 } from "readline";
553009
553120
  import { dirname as dirname93, join as join203, resolve as resolve54 } from "path";
553010
- import { getEffective as getEffective3, probeRegistryHealth } from "@sema-agent/sdk/registry";
553011
553121
  function fail6(e) {
553012
553122
  err7(`Error: ${e instanceof Error ? e.message : String(e)}`), process.exit(1);
553013
553123
  }
@@ -553179,7 +553289,7 @@ async function cloudSmoke(options) {
553179
553289
  try {
553180
553290
  await getValidAccessToken(resolved.name), effective = await probe2(async () => {
553181
553291
  let started3 = Date.now(), client3 = registryClientForProfile(registryUrl, resolved.name, { timeoutMs: 8e3 });
553182
- return { pass: !0, detail: `HTTP ${(await getEffective3(client3)).status}, ${Date.now() - started3}ms` };
553292
+ return { pass: !0, detail: `HTTP ${(await getEffective(client3)).status}, ${Date.now() - started3}ms` };
553183
553293
  }), effective.pass ? failures += 0 : failures++;
553184
553294
  } catch (e) {
553185
553295
  e instanceof CloudAuthError ? effective = { pass: !1, detail: "", skipped: `${e.message}` } : (effective = { pass: !1, detail: e instanceof Error ? e.message : String(e) }, failures++);
@@ -553227,6 +553337,7 @@ async function cloudBench(options) {
553227
553337
  }
553228
553338
  var out5, err7, ENGINE_NPM_PACKAGES, ENGINE_REL_PATH, AnswerReader, init_cloudOps = __esm({
553229
553339
  "build-src/src/cli/handlers/cloudOps.ts"() {
553340
+ init_sdkRegistryTransit();
553230
553341
  init_dist();
553231
553342
  init_cloudProfile();
553232
553343
  init_cloudAuth();
@@ -562579,7 +562690,7 @@ async function run() {
562579
562690
  }
562580
562691
  }
562581
562692
  }), profileCheckpoint("run_commander_initialized"), program2.hook("preAction", async (thisCommand) => {
562582
- profileCheckpoint("preAction_start"), await Promise.all([ensureMdmSettingsLoaded(), ensureKeychainPrefetchCompleted()]), profileCheckpoint("preAction_after_mdm"), await init(), profileCheckpoint("preAction_after_init"), isEnvTruthy(process.env.SEMA_CODE_DISABLE_TERMINAL_TITLE) || (process.title = "claude");
562693
+ profileCheckpoint("preAction_start"), await Promise.all([ensureMdmSettingsLoaded(), ensureKeychainPrefetchCompleted()]), profileCheckpoint("preAction_after_mdm"), await init(), profileCheckpoint("preAction_after_init"), isEnvTruthy(process.env.SEMA_CODE_DISABLE_TERMINAL_TITLE) || (process.title = SEMA_PROCESS_TITLE);
562583
562694
  let {
562584
562695
  initSinks: initSinks2
562585
562696
  } = await Promise.resolve().then(() => (init_sinks(), sinks_exports));
@@ -562601,7 +562712,7 @@ async function run() {
562601
562712
  if (!truthy.includes(value) && !falsy.includes(value))
562602
562713
  throw new InvalidArgumentError("Allowed choices are true, false, 1, 0, yes, no, on, off.");
562603
562714
  return truthy.includes(value);
562604
- })).addOption(new Option("--session-mirror", "Emit transcript_mirror frames on stdout (SDK-internal; set by ProcessTransport when sessionStore is configured)").hideHelp()).addOption(new Option("--enable-auth-status", "Enable auth status messages in SDK mode").default(!1).hideHelp()).option("--allowedTools, --allowed-tools <tools...>", 'Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")').option("--tools <tools...>", 'Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").').option("--disallowedTools, --disallowed-tools <tools...>", 'Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")').option("--mcp-config <configs...>", "Load MCP servers from JSON files or strings (space-separated)").addOption(new Option("--permission-prompt-tool <tool>", "MCP tool to use for permission prompts (only works with --print)").argParser(String).hideHelp()).addOption(new Option("--system-prompt <prompt>", "System prompt to use for the session").argParser(String)).addOption(new Option("--system-prompt-file <file>", "Read system prompt from a file").argParser(String).hideHelp()).addOption(new Option("--append-system-prompt <prompt>", "Append a system prompt to the default system prompt").argParser(String)).addOption(new Option("--append-system-prompt-file <file>", "Read system prompt from a file and append to the default system prompt").argParser(String).hideHelp()).addOption(new Option("--exclude-dynamic-system-prompt-sections", "Move per-machine sections (cwd, env info, memory paths, git status) from the system prompt into the first user message. Improves cross-user prompt-cache reuse. Only applies with the default system prompt (ignored with --system-prompt).").default(!1)).addOption(new Option("--permission-mode <mode>", 'Permission mode to use for the session. "manual" is an alias of "default" \u2014 the mode the footer badge shows as "manual mode"; they are the same mode, not two. With --print there is no approval channel: tools that need approval are denied under the default permission mode \u2014 pass acceptEdits or auto.').argParser(String).choices([...USER_ADDRESSABLE_PERMISSION_MODES])).option("-c, --continue", "Continue the most recent conversation in the current directory", () => !0).option("-r, --resume [value]", "Resume a conversation by session ID, or open interactive picker with optional search term", (value) => value || !0).option("--fork-session", "When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)", () => !0).addOption(new Option("--prefill <text>", "Pre-fill the prompt input with text without submitting it").hideHelp()).addOption(new Option("--deep-link-origin", "Signal that this session was launched from a deep link").hideHelp()).addOption(new Option("--deep-link-repo <slug>", "Repo slug the deep link ?repo= parameter resolved to the current cwd").hideHelp()).addOption(new Option("--deep-link-last-fetch <ms>", "FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline").argParser((v2) => {
562715
+ })).addOption(new Option("--session-mirror", "Emit transcript_mirror frames on stdout (SDK-internal; set by ProcessTransport when sessionStore is configured)").hideHelp()).addOption(new Option("--enable-auth-status", "Enable auth status messages in SDK mode").default(!1).hideHelp()).option("--allowedTools, --allowed-tools <tools...>", 'Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")').option("--tools <tools...>", 'Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").').option("--disallowedTools, --disallowed-tools <tools...>", 'Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")').option("--mcp-config <configs...>", "Load MCP servers from JSON files or strings (space-separated)").addOption(new Option("--permission-prompt-tool <tool>", "MCP tool to use for permission prompts (only works with --print)").argParser(String).hideHelp()).addOption(new Option("--system-prompt <prompt>", "System prompt to use for the session").argParser(String)).addOption(new Option("--system-prompt-file <file>", "Read system prompt from a file").argParser(String).hideHelp()).addOption(new Option("--append-system-prompt <prompt>", "Append a system prompt to the default system prompt").argParser(String)).addOption(new Option("--append-system-prompt-file <file>", "Read system prompt from a file and append to the default system prompt").argParser(String).hideHelp()).addOption(new Option("--exclude-dynamic-system-prompt-sections", "Move per-machine sections (cwd, env info, memory paths, git status) from the system prompt into the first user message. Improves cross-user prompt-cache reuse. Only applies with the default system prompt (ignored with --system-prompt)." + UNWIRED_FLAG_HELP_SUFFIX).default(!1)).addOption(new Option("--permission-mode <mode>", 'Permission mode to use for the session. "manual" is an alias of "default" \u2014 the mode the footer badge shows as "manual mode"; they are the same mode, not two. With --print there is no approval channel: tools that need approval are denied under the default permission mode \u2014 pass acceptEdits or auto.').argParser(String).choices([...USER_ADDRESSABLE_PERMISSION_MODES])).option("-c, --continue", "Continue the most recent conversation in the current directory", () => !0).option("-r, --resume [value]", "Resume a conversation by session ID, or open interactive picker with optional search term", (value) => value || !0).option("--fork-session", "When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)", () => !0).addOption(new Option("--prefill <text>", "Pre-fill the prompt input with text without submitting it").hideHelp()).addOption(new Option("--deep-link-origin", "Signal that this session was launched from a deep link").hideHelp()).addOption(new Option("--deep-link-repo <slug>", "Repo slug the deep link ?repo= parameter resolved to the current cwd").hideHelp()).addOption(new Option("--deep-link-last-fetch <ms>", "FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline").argParser((v2) => {
562605
562716
  let n2 = Number(v2);
562606
562717
  return Number.isFinite(n2) ? n2 : void 0;
562607
562718
  }).hideHelp()).option("--from-pr [value]", "Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term", (value) => value || !0).option("--no-session-persistence", "Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)").addOption(new Option("--resume-session-at <message id>", "When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)").argParser(String).hideHelp()).addOption(new Option("--rewind-files <user-message-id>", "Restore files to state at the specified user message and exit (requires --resume)").hideHelp()).addOption(new Option("--reply-on-resume", "When resuming, immediately query if the loaded transcript ends in a user-role message (set by /background mid-turn so the fork continues the in-flight turn).").hideHelp()).option("--model <model>", "Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').").addOption(new Option("--effort <level>", "Effort level for the current session (low, medium, high, xhigh, max)").argParser((rawValue) => {
@@ -562614,7 +562725,7 @@ async function run() {
562614
562725
  "--memory <mode>",
562615
562726
  "Run with no memory face at all for this session (sema superset \u2014 no upstream equivalent). Only 'off' is accepted: it declares on every submit that this run mounts no memory face (recall and remember are both absent), which is a different axis from /memory-capture off (that one keeps memory mounted and only stops this session's content from entering long-term memory). Requires an engine that accepts the request-level declaration; older engines answer 400."
562616
562727
  ).choices(["off"])
562617
- ).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>", "Per-request output-token cap for submitted runs (only works with --print; sema superset \u2014 no upstream equivalent). Caps each model response rather than the whole run: hitting the cap cuts generation mid-stream, and a cut inside tool-call arguments surfaces as a provider truncation error; 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", () => !0).option("--strict-mcp-config", "Only use MCP servers from --mcp-config, ignoring all other MCP configurations", () => !0).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", () => !0).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) => {
562728
+ ).option("--scenario <name>", "Engine scenario for submitted runs (only works with --print): route the run through a deployment-defined scenario (tool roster + system prompt). A name the deployment does not define is rejected by the engine and the run exits with an error \u2014 it is not silently replaced by the default. 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>", "Per-request output-token cap for submitted runs (only works with --print; sema superset \u2014 no upstream equivalent). Caps each model response rather than the whole run: hitting the cap cuts generation mid-stream, and a cut inside tool-call arguments surfaces as a provider truncation error; 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." + UNWIRED_FLAG_HELP_SUFFIX).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", () => !0).option("--strict-mcp-config", "Only use MCP servers from --mcp-config, ignoring all other MCP configurations", () => !0).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)." + UNWIRED_FLAG_HELP_SUFFIX, (val, prev) => [...prev, ...val.split(/\s+/).filter(Boolean)], []).option("--disable-slash-commands", "Disable all skills", () => !0).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). Requires the session ingress token in SEMA_CODE_SESSION_ACCESS_TOKEN; without it the launch exits with an error.").action(async (prompt, options) => {
562618
562729
  profileCheckpoint("action_handler_start");
562619
562730
  for (let spec of UNWIRED_FLAGS) {
562620
562731
  if (!flagUnwiredOnLane(spec, "print")) continue;
@@ -563614,7 +563725,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
563614
563725
  pendingHookMessages
563615
563726
  }, renderAndRun);
563616
563727
  }
563617
- }).version("sema 1.0.129", "-v, --version", "Output the version number"), program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)"), program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."), canUserConfigureAdvisor() && program2.addOption(new Option("--advisor <model>", "Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp()), program2.addOption(new Option("--bg, --background", "Start the session as a background agent and return immediately (manage with `sema agents`)")), program2.command("ps").description("List background sessions").action(async () => {
563728
+ }).version("sema 1.0.130", "-v, --version", "Output the version number"), program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)"), program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."), canUserConfigureAdvisor() && program2.addOption(new Option("--advisor <model>", "Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp()), program2.addOption(new Option("--bg, --background", "Start the session as a background agent and return immediately (manage with `sema agents`)")), program2.command("ps").description("List background sessions").action(async () => {
563618
563729
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).psHandler([]), process.exit(process.exitCode ?? 0);
563619
563730
  }), program2.command("logs [id]").description("Print a background session's recent terminal output").action(async (id) => {
563620
563731
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).logsHandler(id, []), process.exit(process.exitCode ?? 0);
@@ -563622,7 +563733,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
563622
563733
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).attachHandler(id, []), process.exit(process.exitCode ?? 0);
563623
563734
  }), program2.command("kill [id]").description("Terminate a background session").action(async (id) => {
563624
563735
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).killHandler(id, []), process.exit(process.exitCode ?? 0);
563625
- }), program2.addOption(new Option("--brief", "Enable SendUserMessage tool for agent-to-user communication")), program2.addOption(new Option("--ax-screen-reader", "Render screen-reader friendly output (flat text, no decorative borders or animations).")), program2.option("--agent-teams", "Enable agent teams: named persistent teammates with a shared task list (experimental, off by default)", () => !0), program2.addOption(new Option("--enable-auto-mode", "Opt in to auto mode").hideHelp()), program2.addOption(new Option("--agent-id <id>", "Teammate agent ID").hideHelp()), program2.addOption(new Option("--agent-name <name>", "Teammate display name").hideHelp()), program2.addOption(new Option("--team-name <name>", "Team name for swarm coordination").hideHelp()), program2.addOption(new Option("--agent-color <color>", "Teammate UI color").hideHelp()), program2.addOption(new Option("--plan-mode-required", "Require plan mode before implementation").hideHelp()), program2.addOption(new Option("--parent-session-id <id>", "Parent session ID for analytics correlation").hideHelp()), program2.addOption(new Option("--agent-type <type>", "Custom agent type for this teammate").hideHelp()), program2.addOption(new Option("--sdk-url <url>", "Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp()), program2.addOption(new Option("--teleport [session]", "Resume a teleport session, optionally specify session ID").hideHelp()), program2.addOption(new Option("--cloud [description|session_id|url]", "Create a cloud session with the given description, or attach to an existing one by session ID or claude.ai/code URL").hideHelp()), program2.addOption(new Option("--remote [description|session_id|url]", "Deprecated alias for --cloud").hideHelp()), program2.addOption(new Option("--remote-control [name]", "Start an interactive session with Remote Control enabled (optionally named)").argParser((value) => value || !0)), program2.addOption(new Option("--rc [name]", "Alias for --remote-control").argParser((value) => value || !0).hideHelp()), program2.option("--remote-control-session-name-prefix <prefix>", "Prefix for auto-generated Remote Control session names (default: hostname)"), profileCheckpoint("run_main_options_built");
563736
+ }), program2.addOption(new Option("--brief", "Enable SendUserMessage tool for agent-to-user communication")), program2.addOption(new Option("--ax-screen-reader", "Render screen-reader friendly output (flat text, no decorative borders or animations)." + UNWIRED_FLAG_HELP_SUFFIX)), program2.option("--agent-teams", "Enable the team-scoped task list for engine-spawned teammates (Agent({name}); experimental, off by default)", () => !0), program2.addOption(new Option("--enable-auto-mode", "Opt in to auto mode").hideHelp()), program2.addOption(new Option("--agent-id <id>", "Teammate agent ID").hideHelp()), program2.addOption(new Option("--agent-name <name>", "Teammate display name").hideHelp()), program2.addOption(new Option("--team-name <name>", "Team name for swarm coordination").hideHelp()), program2.addOption(new Option("--agent-color <color>", "Teammate UI color").hideHelp()), program2.addOption(new Option("--plan-mode-required", "Require plan mode before implementation").hideHelp()), program2.addOption(new Option("--parent-session-id <id>", "Parent session ID for analytics correlation").hideHelp()), program2.addOption(new Option("--agent-type <type>", "Custom agent type for this teammate").hideHelp()), program2.addOption(new Option("--sdk-url <url>", "Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp()), program2.addOption(new Option("--teleport [session]", "Resume a teleport session, optionally specify session ID").hideHelp()), program2.addOption(new Option("--cloud [description|session_id|url]", "Create a cloud session with the given description, or attach to an existing one by session ID or claude.ai/code URL").hideHelp()), program2.addOption(new Option("--remote [description|session_id|url]", "Deprecated alias for --cloud").hideHelp()), program2.addOption(new Option("--remote-control [name]", "Start an interactive session with Remote Control enabled (optionally named)").argParser((value) => value || !0)), program2.addOption(new Option("--rc [name]", "Alias for --remote-control").argParser((value) => value || !0).hideHelp()), program2.option("--remote-control-session-name-prefix <prefix>", "Prefix for auto-generated Remote Control session names (default: hostname)." + UNWIRED_FLAG_HELP_SUFFIX), profileCheckpoint("run_main_options_built");
563626
563737
  let isPrintMode = process.argv.includes("-p") || process.argv.includes("--print"), isCcUrl = process.argv.some((a) => a.startsWith("cc://") || a.startsWith("cc+unix://"));
563627
563738
  if (isPrintMode && !isCcUrl)
563628
563739
  return profileCheckpoint("run_before_parse"), await program2.parseAsync(process.argv), profileCheckpoint("run_after_parse"), program2;
@@ -564334,6 +564445,7 @@ var getTeammateUtils, getTeammatePromptAddendum, coordinatorModeModule, autoMode
564334
564445
  init_asciicast();
564335
564446
  init_auth4();
564336
564447
  init_config();
564448
+ init_processTitle();
564337
564449
  init_settings_187();
564338
564450
  init_earlyInput();
564339
564451
  init_effort();
@@ -566729,7 +566841,7 @@ function teamToolDefinitions() {
566729
566841
  return [
566730
566842
  {
566731
566843
  name: TEAM_MCP_CREATE_TOOL,
566732
- description: "Create a new team for coordinating multiple agents." + " NOTE: this build can create and delete the team container only. There is currently NO tool for adding teammates to a team, so a team you create stays empty \u2014 do not promise the user that work will be parallelized across teammates. Use it for the team-scoped task list, or say plainly that teammate spawning is unavailable.",
566844
+ description: "Create a new team for coordinating multiple agents." + " NOTE: this build can create and delete the team container only, and what it gives you is the team-scoped task list. There is NO tool for adding teammates to a team, so a team you create stays empty \u2014 do not promise the user that team_create parallelizes work across teammates. Named teammates in this build are engine-spawned subagents instead: start one with Agent({ name, run_in_background: true }), talk to it with SendMessage({ to: name }), and read its progress with TaskOutput(task_id). ListAgents exists only where the deployment has cross-session seats, so do not rely on it being mounted.",
566733
566845
  inputSchema: {
566734
566846
  type: "object",
566735
566847
  properties: {
@@ -568561,27 +568673,42 @@ var init_bootPermissionMode = __esm({
568561
568673
  // build-src/src/sema/cliToolFlagsArgv.ts
568562
568674
  var cliToolFlagsArgv_exports = {};
568563
568675
  __export(cliToolFlagsArgv_exports, {
568676
+ collectAddDirFlag: () => collectAddDirFlag,
568564
568677
  collectCliToolFlags: () => collectCliToolFlags
568565
568678
  });
568566
568679
  function collectCliToolFlags(argv) {
568567
568680
  let out6 = { tools: [], allowedTools: [], disallowedTools: [] };
568681
+ for (let [name, values2] of collectFlagValues(argv, new Set(FLAGS.keys())))
568682
+ out6[FLAGS.get(name)].push(...values2);
568683
+ return out6;
568684
+ }
568685
+ function collectAddDirFlag(argv) {
568686
+ return collectFlagValues(argv, /* @__PURE__ */ new Set(["--add-dir"])).get("--add-dir") ?? [];
568687
+ }
568688
+ function collectFlagValues(argv, names2) {
568689
+ let out6 = /* @__PURE__ */ new Map();
568568
568690
  for (let i = 0; i < argv.length; i++) {
568569
568691
  let a = argv[i];
568570
568692
  if (a === "--") break;
568571
- let eq2 = a.indexOf("="), name = eq2 > 0 ? a.slice(0, eq2) : a, key = FLAGS.get(name);
568572
- if (key === void 0) continue;
568693
+ let eq2 = a.indexOf("="), name = eq2 > 0 ? a.slice(0, eq2) : a;
568694
+ if (!names2.has(name)) {
568695
+ ROOT_VALUE_FLAGS.has(a) && i++;
568696
+ continue;
568697
+ }
568698
+ let bucket = out6.get(name) ?? (out6.set(name, []), out6.get(name));
568573
568699
  if (eq2 > 0) {
568574
568700
  let v2 = a.slice(eq2 + 1);
568575
- v2.length > 0 && out6[key].push(v2);
568701
+ v2.length > 0 && bucket.push(v2);
568576
568702
  continue;
568577
568703
  }
568578
568704
  let next = argv[i + 1];
568579
- next !== void 0 && !next.startsWith("-") && (out6[key].push(next), i++);
568705
+ next !== void 0 && !next.startsWith("-") && (bucket.push(next), i++);
568580
568706
  }
568581
568707
  return out6;
568582
568708
  }
568583
568709
  var FLAGS, init_cliToolFlagsArgv = __esm({
568584
568710
  "build-src/src/sema/cliToolFlagsArgv.ts"() {
568711
+ init_rootValueFlags();
568585
568712
  FLAGS = /* @__PURE__ */ new Map([
568586
568713
  ["--tools", "tools"],
568587
568714
  ["--allowedTools", "allowedTools"],
@@ -571159,7 +571286,7 @@ async function launchReplProduction() {
571159
571286
  let { setIsInteractive: setIsInteractive2 } = await Promise.resolve().then(() => (init_state(), state_exports));
571160
571287
  setIsInteractive2(!0);
571161
571288
  let { isEnvTruthy: isTitleDisableTruthy } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
571162
- isTitleDisableTruthy(process.env.SEMA_CODE_DISABLE_TERMINAL_TITLE) || (process.title = "sema");
571289
+ isTitleDisableTruthy(process.env.SEMA_CODE_DISABLE_TERMINAL_TITLE) || (process.title = SEMA_PROCESS_TITLE);
571163
571290
  try {
571164
571291
  let { applyOpenAiEnvAliases: applyOpenAiEnvAliases2 } = await Promise.resolve().then(() => (init_engineLifecycleManager(), engineLifecycleManager_exports));
571165
571292
  applyOpenAiEnvAliases2(process.env);
@@ -572158,6 +572285,24 @@ ${asm.validationError}
572158
572285
  } catch (e) {
572159
572286
  process.env.SEMA_DEBUG && console.error("[sema] permission-rule load soft-failed (rules stay empty):", e);
572160
572287
  }
572288
+ try {
572289
+ let { collectAddDirFlag: collectAddDirFlag2 } = await Promise.resolve().then(() => (init_cliToolFlagsArgv(), cliToolFlagsArgv_exports)), addDirs = collectAddDirFlag2(process.argv.slice(2));
572290
+ if (addDirs.length > 0) {
572291
+ let tpc = initialState.toolPermissionContext, { foldAdditionalWorkingDirectories: foldAdditionalWorkingDirectories2 } = await Promise.resolve().then(() => (init_permissionSetup(), permissionSetup_exports)), folded = await foldAdditionalWorkingDirectories2({
572292
+ toolPermissionContext: tpc,
572293
+ directories: addDirs
572294
+ });
572295
+ Object.assign(tpc, folded.toolPermissionContext);
572296
+ let { setBootAdditionalDirectories: setBootAdditionalDirectories2 } = await Promise.resolve().then(() => (init_appStateRef(), appStateRef_exports));
572297
+ setBootAdditionalDirectories2(Array.from(tpc.additionalWorkingDirectories.keys()));
572298
+ for (let w2 of folded.warnings) bootFailClosedNotices.push(w2);
572299
+ process.env.SEMA_DEBUG && console.error(
572300
+ `[sema] --add-dir folded: ${addDirs.length} requested, ${tpc.additionalWorkingDirectories.size} in context`
572301
+ );
572302
+ }
572303
+ } catch (e) {
572304
+ process.env.SEMA_DEBUG && console.error("[sema] --add-dir seeding soft-failed (no directories added):", e);
572305
+ }
572161
572306
  try {
572162
572307
  let { resolveBootEffortValue: resolveBootEffortValue2 } = await Promise.resolve().then(() => (init_bootEffort(), bootEffort_exports)), bootEffort = resolveBootEffortValue2(process.argv.slice(2));
572163
572308
  bootEffort !== void 0 && (initialState.effortValue = bootEffort), process.env.SEMA_DEBUG && console.error(`[sema] boot effort: ${bootEffort === void 0 ? "auto (none persisted)" : String(bootEffort)}`);
@@ -572672,6 +572817,7 @@ var React215, import_jsx_runtime538, isMain, COMMANDER_SUBCOMMANDS, replEntry_de
572672
572817
  init_ink2();
572673
572818
  init_adapter();
572674
572819
  init_scenario();
572820
+ init_processTitle();
572675
572821
  init_debugLine();
572676
572822
  init_upstreamBridge();
572677
572823
  init_settings5();
package/sema.js CHANGED
@@ -89,7 +89,7 @@ function installBootSignalTailFrame(argv2 = process.argv.slice(2)) {
89
89
  installBootSignalTailFrame();
90
90
 
91
91
  // build-src/src/sema/preludeEntry.ts
92
- var versionLine = "sema 1.0.129" ? "sema 1.0.129" : "";
92
+ var versionLine = "sema 1.0.130" ? "sema 1.0.130" : "";
93
93
  var argv = process.argv.slice(2);
94
94
  var wantsVersionFastPath = argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v");
95
95
  var EARLY_INPUT_PRELUDE_SLOT = /* @__PURE__ */ Symbol.for("sema.earlyInputPrelude");