@slayzone/computer 0.37.0 → 0.37.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.cjs CHANGED
@@ -27977,7 +27977,7 @@ var require_ignore = __commonJS({
27977
27977
  var SPACE = " ";
27978
27978
  var ESCAPE = "\\";
27979
27979
  var REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
27980
- var REGEX_TEST_BLANK_LINE = /^\uFEFF? *$/;
27980
+ var BOM = "\uFEFF";
27981
27981
  var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
27982
27982
  var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
27983
27983
  var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
@@ -28102,6 +28102,7 @@ var require_ignore = __commonJS({
28102
28102
  "g"
28103
28103
  );
28104
28104
  var TRAILING_WILDCARD = "\uE000";
28105
+ var TRAILING_DOUBLESTAR = "\uE001";
28105
28106
  var extractBrackets = (pattern) => {
28106
28107
  const sources = [];
28107
28108
  const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
@@ -28112,7 +28113,9 @@ var require_ignore = __commonJS({
28112
28113
  const char = pattern[index];
28113
28114
  if (char === ESCAPE) {
28114
28115
  const escaped = pattern[index + 1];
28115
- if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
28116
+ if (escaped === UNDEFINED || escaped === SLASH && index + 2 === length) {
28117
+ out += hold(NEVER_MATCH);
28118
+ } else if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
28116
28119
  out += pattern.slice(index, index + 2);
28117
28120
  } else {
28118
28121
  out += hold(
@@ -28145,35 +28148,6 @@ var require_ignore = __commonJS({
28145
28148
  var DIRECT = null;
28146
28149
  var REGEX_INNER_SLASH = /\/(?!$)/;
28147
28150
  var REPLACERS = [
28148
- [
28149
- // Remove BOM
28150
- // TODO:
28151
- // Other similar zero-width characters?
28152
- /^\uFEFF/,
28153
- () => EMPTY,
28154
- "\uFEFF"
28155
- ],
28156
- [
28157
- // A trailing line terminator, left on when a whole file's contents are
28158
- // added as one pattern rather than split into lines. git never sees one
28159
- // -- it reads a `.gitignore` line by line -- so it is not part of the
28160
- // pattern and is dropped here, apart from the trailing-space trimming,
28161
- // which follows git in touching spaces and nothing else.
28162
- /[\r\n]+$/,
28163
- () => EMPTY
28164
- ],
28165
- // > Trailing spaces are ignored unless they are quoted with backslash ("\")
28166
- [
28167
- // Only spaces, never tabs or other whitespace: git trims a trailing run
28168
- // of `' '` and nothing else (dir.c, `trim_trailing_spaces`, a single
28169
- // `case ' '`), so a pattern ending in a tab keeps it as a literal.
28170
- // (a\ ) -> (a )
28171
- // (a ) -> (a)
28172
- // (a ) -> (a)
28173
- // (a \ ) -> (a )
28174
- /((?:\\\\)*?)(\\? +)$/,
28175
- (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
28176
- ],
28177
28151
  // Replace (\ ) with ' '
28178
28152
  // Only a space: an escaped tab or other whitespace is already a literal by
28179
28153
  // the time it reaches here, and a bare tab must be left as one, not turned
@@ -28182,11 +28156,12 @@ var require_ignore = __commonJS({
28182
28156
  // (\\ ) -> '\\ '
28183
28157
  // (\\\ ) -> '\\ '
28184
28158
  [
28185
- /(\\+?) /g,
28186
- (_, m1) => {
28187
- const { length } = m1;
28188
- return m1.slice(0, length - length % 2) + SPACE;
28189
- }
28159
+ // A run of backslashes is taken whole, from its first one, so no match
28160
+ // ever starts again inside it -- `(\\+?) ` did, which made a long run
28161
+ // quadratic.
28162
+ /(\\+)( ?)/g,
28163
+ (_, run, space) => space ? run.slice(0, run.length - run.length % 2) + SPACE : run,
28164
+ ESCAPE + SPACE
28190
28165
  ],
28191
28166
  // Escape metacharacters
28192
28167
  // which is written down by users but means special for regular expressions.
@@ -28262,7 +28237,7 @@ var require_ignore = __commonJS({
28262
28237
  // Zero, one or several directories
28263
28238
  // should not use '*', or it will be replaced by the next replacer
28264
28239
  // Check if it is not the last `'/**'`
28265
- (_, index, str6) => index + 6 < str6.length ? str6.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : "\\/.+",
28240
+ (_, index, str6) => index + 6 < str6.length ? str6.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
28266
28241
  "*"
28267
28242
  ],
28268
28243
  // normal intermediate wildcards
@@ -28340,7 +28315,7 @@ var require_ignore = __commonJS({
28340
28315
  // 'js' will match 'a.js' and 'a.js/'
28341
28316
  (source) => {
28342
28317
  const last = source[source.length - 1];
28343
- if (!last || last === TRAILING_WILDCARD) {
28318
+ if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) {
28344
28319
  return source;
28345
28320
  }
28346
28321
  return last === SLASH ? `${source}$` : `${source}(?=$|\\/$)`;
@@ -28351,16 +28326,12 @@ var require_ignore = __commonJS({
28351
28326
  var MODE_IGNORE = "regex";
28352
28327
  var MODE_CHECK_IGNORE = "checkRegex";
28353
28328
  var UNDERSCORE = "_";
28354
- var TRAILING_WILD_CARD_REPLACERS = {
28355
- [MODE_IGNORE](_, p1) {
28356
- const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
28357
- return `${prefix}(?=$|\\/$)`;
28358
- },
28359
- [MODE_CHECK_IGNORE](_, p1) {
28360
- const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
28361
- return `${prefix}(?=$|\\/$)`;
28362
- }
28329
+ var replaceTrailingWildcard = (_, p1) => {
28330
+ const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
28331
+ return `${prefix}(?=$|\\/$)`;
28363
28332
  };
28333
+ var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
28334
+ var replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
28364
28335
  var WILDCARD = "[^\\/]*";
28365
28336
  var separatorAfter = (run, at) => {
28366
28337
  let separator = EMPTY;
@@ -28476,6 +28447,14 @@ var require_ignore = __commonJS({
28476
28447
  (match, index) => sources[index]
28477
28448
  ) : replaced;
28478
28449
  };
28450
+ var checkSourceOf = (body, prefix) => {
28451
+ if (body[body.length - 1] === SLASH) {
28452
+ prefix = makeRegexPrefix(body.slice(0, -1));
28453
+ }
28454
+ const head = prefix.slice(0, -1);
28455
+ const last = prefix[prefix.length - 1];
28456
+ return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
28457
+ };
28479
28458
  var matchesBasename = (body) => {
28480
28459
  const index = body.indexOf(SLASH);
28481
28460
  return index < 0 || index === body.length - 1;
@@ -28502,7 +28481,7 @@ var require_ignore = __commonJS({
28502
28481
  return cut < 0 ? EMPTY : path26.slice(0, cut + 1);
28503
28482
  };
28504
28483
  var isString2 = (subject) => typeof subject === "string";
28505
- var checkPattern = (pattern) => pattern && isString2(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
28484
+ var checkPattern = (pattern) => pattern && isString2(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
28506
28485
  var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
28507
28486
  var IgnoreRule = class {
28508
28487
  constructor(pattern, mark, body, ignoreCase, negative, prefix) {
@@ -28536,24 +28515,51 @@ var require_ignore = __commonJS({
28536
28515
  return this._make(MODE_CHECK_IGNORE, key);
28537
28516
  }
28538
28517
  _make(mode, key) {
28539
- const str6 = pinWildcards(this.regexPrefix.replace(
28540
- REGEX_REPLACE_TRAILING_WILDCARD,
28541
- // It does not need to bind pattern
28542
- TRAILING_WILD_CARD_REPLACERS[mode]
28543
- ));
28518
+ const str6 = pinWildcards(
28519
+ mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix)
28520
+ );
28544
28521
  const regex = this.ignoreCase ? new RegExp(str6, "i") : new RegExp(str6);
28545
28522
  return define(this, key, regex);
28546
28523
  }
28547
28524
  };
28525
+ var isLineEnd = (char) => char === "\r" || char === "\n";
28526
+ var trimEnd = (body) => {
28527
+ let end = body.length;
28528
+ while (end && isLineEnd(body[end - 1])) {
28529
+ end--;
28530
+ }
28531
+ const lineEnd = end;
28532
+ while (end && body[end - 1] === SPACE) {
28533
+ end--;
28534
+ }
28535
+ if (end === lineEnd) {
28536
+ return body.slice(0, end);
28537
+ }
28538
+ let backslashes = 0;
28539
+ while (backslashes < end && body[end - backslashes - 1] === ESCAPE) {
28540
+ backslashes++;
28541
+ }
28542
+ return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
28543
+ };
28548
28544
  var createRule = ({
28549
28545
  pattern,
28550
28546
  mark
28551
28547
  }, ignoreCase) => {
28548
+ let body = pattern[0] === BOM ? pattern.slice(1) : pattern;
28549
+ if (body[0] === "#") {
28550
+ return;
28551
+ }
28552
28552
  let negative = false;
28553
- let body = pattern;
28554
- if (body.indexOf("!") === 0) {
28553
+ if (body[0] === "!") {
28555
28554
  negative = true;
28556
- body = body.substr(1);
28555
+ body = body.slice(1);
28556
+ }
28557
+ const last = body[body.length - 1];
28558
+ if (last === SPACE || last === "\r" || last === "\n") {
28559
+ body = trimEnd(body);
28560
+ }
28561
+ if (!body) {
28562
+ return;
28557
28563
  }
28558
28564
  body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
28559
28565
  const regexPrefix = makeRegexPrefix(body);
@@ -28584,8 +28590,8 @@ var require_ignore = __commonJS({
28584
28590
  pattern
28585
28591
  };
28586
28592
  }
28587
- if (checkPattern(pattern.pattern)) {
28588
- const rule = createRule(pattern, this._ignoreCase);
28593
+ const rule = checkPattern(pattern.pattern) && createRule(pattern, this._ignoreCase);
28594
+ if (rule) {
28589
28595
  this._added = true;
28590
28596
  this._rules.push(rule);
28591
28597
  if (matchesBasename(rule.body)) {
@@ -28599,8 +28605,39 @@ var require_ignore = __commonJS({
28599
28605
  makeArray(
28600
28606
  isString2(pattern) ? splitPattern(pattern) : pattern
28601
28607
  ).forEach(this._add, this);
28608
+ if (this._added) {
28609
+ this._literalRules = UNDEFINED;
28610
+ }
28602
28611
  return this._added;
28603
28612
  }
28613
+ // Match the literal 'abc/' for `checkIgnore`, last rule wins. Only a rule
28614
+ // ending in a wildcard can match it (see `checkSourceOf`), so the rest
28615
+ // are left out once, rather than tested or compiled for every path.
28616
+ testLiteral(path26) {
28617
+ const rules = this._literalRules || (this._literalRules = this._rules.filter(
28618
+ ({ body }) => body[body.length - (body[body.length - 1] === SLASH ? 2 : 1)] === "*"
28619
+ ));
28620
+ let ignored = false;
28621
+ let unignored = false;
28622
+ let matchedRule;
28623
+ for (let index = rules.length - 1; index >= 0; index--) {
28624
+ const rule = rules[index];
28625
+ if (rule.checkRegex.test(path26)) {
28626
+ ignored = !rule.negative;
28627
+ unignored = rule.negative;
28628
+ matchedRule = rule.negative ? UNDEFINED : rule;
28629
+ break;
28630
+ }
28631
+ }
28632
+ const ret = {
28633
+ ignored,
28634
+ unignored
28635
+ };
28636
+ if (matchedRule) {
28637
+ ret.rule = matchedRule;
28638
+ }
28639
+ return ret;
28640
+ }
28604
28641
  // Test one single path without recursively checking parent directories
28605
28642
  //
28606
28643
  // - checkUnignored `boolean` whether should check if the path is unignored,
@@ -28721,14 +28758,12 @@ var require_ignore = __commonJS({
28721
28758
  if (path26.charCodeAt(path26.length - 1) !== SLASH_CODE) {
28722
28759
  return this.test(path26);
28723
28760
  }
28724
- const parentPath = parentOf(path26);
28725
- if (parentPath) {
28726
- const parent = this._t(parentPath, this._testCache, true);
28727
- if (parent.ignored) {
28728
- return parent;
28729
- }
28761
+ const dir = this._t(path26, this._testCache, true);
28762
+ if (dir.ignored) {
28763
+ return dir;
28730
28764
  }
28731
- return this._rules.test(path26, false, MODE_CHECK_IGNORE);
28765
+ const literal2 = this._rules.testLiteral(path26);
28766
+ return literal2.ignored || literal2.unignored ? literal2 : dir;
28732
28767
  }
28733
28768
  _t(path26, cache, checkUnignored) {
28734
28769
  if (path26 in cache) {
@@ -29311,10 +29346,10 @@ var init_agent_hooks = __esm({
29311
29346
  }
29312
29347
  });
29313
29348
 
29314
- // raw-import:/tmp/slz-publish-wt.u1lB0o/packages/shared/hooks/src/notify.sh
29349
+ // raw-import:/tmp/slz-publish-wt.cVSKE7/packages/shared/hooks/src/notify.sh
29315
29350
  var notify_default;
29316
29351
  var init_notify = __esm({
29317
- "raw-import:/tmp/slz-publish-wt.u1lB0o/packages/shared/hooks/src/notify.sh"() {
29352
+ "raw-import:/tmp/slz-publish-wt.cVSKE7/packages/shared/hooks/src/notify.sh"() {
29318
29353
  notify_default = `#!/bin/sh
29319
29354
  # SlayZone agent lifecycle hook \u2014 BENIGN DUMB FORWARDER.
29320
29355
  #
@@ -29476,10 +29511,10 @@ exit 0
29476
29511
  }
29477
29512
  });
29478
29513
 
29479
- // raw-import:/tmp/slz-publish-wt.u1lB0o/packages/shared/hooks/src/opencode-plugin.js
29514
+ // raw-import:/tmp/slz-publish-wt.cVSKE7/packages/shared/hooks/src/opencode-plugin.js
29480
29515
  var opencode_plugin_default;
29481
29516
  var init_opencode_plugin = __esm({
29482
- "raw-import:/tmp/slz-publish-wt.u1lB0o/packages/shared/hooks/src/opencode-plugin.js"() {
29517
+ "raw-import:/tmp/slz-publish-wt.cVSKE7/packages/shared/hooks/src/opencode-plugin.js"() {
29483
29518
  opencode_plugin_default = "// SlayZone opencode plugin v1\n//\n// Forwards OpenCode SDK session lifecycle events to the SlayZone agent-hook\n// notify script over a local shell exec. Plugin is loaded by OpenCode from\n// ${XDG_CONFIG_HOME:-~/.config}/opencode/plugin/slayzone-notify.js\n//\n// The {{NOTIFY_PATH}} placeholder is substituted by the SlayZone installer\n// (packages/apps/app/src/main/agent-hooks/opencode-plugin-installer.ts) at\n// install time with the absolute path to `~/.slayzone/hooks/notify.sh`.\n//\n// Behavior:\n// - No-op when SLAYZONE_TASK_ID is unset (plugin only fires inside SlayZone PTYs).\n// - Subagent (child session) events are suppressed \u2014 oh-my-opencode + similar\n// tools spawn many child sessions and would otherwise flap Start/Stop.\n// - On client.session.list() error, sessions are assumed CHILD (safer to\n// suppress than emit a false-positive Start/Stop).\n// - Handles both modern (session.status w/ nested type) and legacy\n// (session.busy / session.idle) event shapes for forward compat.\n// - Singleton guard prevents double-load if OpenCode re-imports the plugin.\n\nexport const SlayzoneNotifyPlugin = async ({ $, client }) => {\n if (globalThis.__slayzoneOpencodePluginV1) return {}\n globalThis.__slayzoneOpencodePluginV1 = true\n if (!process?.env?.SLAYZONE_TASK_ID) return {}\n\n const notifyPath = '{{NOTIFY_PATH}}'\n let currentState = 'idle' // 'idle' | 'busy'\n let rootSessionID = null // first non-child session we see\n let stopSent = false // dedup Stop emits\n const childSessionCache = new Map() // sessionID -> isChild bool\n\n const notify = async (eventName) => {\n const payload = JSON.stringify({ hook_event_name: eventName })\n try {\n await $`bash ${notifyPath} ${payload}`\n } catch {\n // Hook failures must never bubble into the OpenCode TUI.\n }\n }\n\n const isChildSession = async (sessionID) => {\n if (!sessionID) return true\n if (!client?.session?.list) return true\n if (childSessionCache.has(sessionID)) return childSessionCache.get(sessionID)\n try {\n const sessions = await client.session.list()\n const session = sessions.data?.find((s) => s.id === sessionID)\n const isChild = !!session?.parentID\n childSessionCache.set(sessionID, isChild)\n return isChild\n } catch {\n // On error, assume CHILD \u2014 safer than emitting a false-positive Start/Stop.\n return true\n }\n }\n\n const handleBusy = async (sessionID) => {\n if (!rootSessionID) rootSessionID = sessionID\n if (sessionID !== rootSessionID) return\n if (currentState === 'idle') {\n currentState = 'busy'\n stopSent = false\n await notify('Start')\n }\n }\n\n const handleStop = async (sessionID) => {\n if (rootSessionID && sessionID !== rootSessionID) return\n if (currentState === 'busy' && !stopSent) {\n currentState = 'idle'\n stopSent = true\n await notify('Stop')\n rootSessionID = null // reset for next session\n }\n }\n\n return {\n event: async ({ event }) => {\n const sessionID = event.properties?.sessionID ?? event.properties?.info?.id ?? null\n\n if (event.type === 'session.created') {\n const isChild = Boolean(event.properties?.info?.parentID)\n if (sessionID) childSessionCache.set(sessionID, isChild)\n if (!isChild) await notify('SessionStart')\n return\n }\n\n if (event.type === 'session.deleted') {\n const cached = sessionID ? childSessionCache.get(sessionID) : undefined\n const isChild = cached !== undefined ? cached : await isChildSession(sessionID)\n if (!isChild) await notify('SessionEnd')\n if (sessionID) childSessionCache.delete(sessionID)\n return\n }\n\n if (await isChildSession(sessionID)) return\n\n if (event.type === 'session.status') {\n const status = event.properties?.status\n if (status?.type === 'busy') await handleBusy(sessionID)\n else if (status?.type === 'idle') await handleStop(sessionID)\n }\n // Backwards-compat: some OpenCode versions emit busy/idle as top-level events.\n if (event.type === 'session.busy') await handleBusy(sessionID)\n if (event.type === 'session.idle') await handleStop(sessionID)\n if (event.type === 'session.error') await handleStop(sessionID)\n },\n 'permission.ask': async (_permission, output) => {\n if (output.status === 'ask') await notify('PermissionRequest')\n }\n }\n}\n";
29484
29519
  }
29485
29520
  });
@@ -30643,7 +30678,8 @@ var NONE2 = {
30643
30678
  sideQuestions: false,
30644
30679
  steerQueued: false,
30645
30680
  withdrawSteered: false,
30646
- agentStartedTurns: false
30681
+ agentStartedTurns: false,
30682
+ stopSubAgent: false
30647
30683
  };
30648
30684
  var CAPABILITIES = {
30649
30685
  "claude-chat": {
@@ -30668,7 +30704,8 @@ var CAPABILITIES = {
30668
30704
  sideQuestions: true,
30669
30705
  steerQueued: true,
30670
30706
  withdrawSteered: true,
30671
- agentStartedTurns: true
30707
+ agentStartedTurns: true,
30708
+ stopSubAgent: true
30672
30709
  },
30673
30710
  "codex-chat": {
30674
30711
  ...NONE2,
@@ -30700,7 +30737,9 @@ var CAPABILITIES = {
30700
30737
  // An ephemeral `thread/fork` + one turn on it, answered and dropped (the driver).
30701
30738
  sideQuestions: true,
30702
30739
  // `turn/steer` into the running turn; no way to take it back.
30703
- steerQueued: true
30740
+ steerQueued: true,
30741
+ // `turn/interrupt` on the sub-agent's own thread.
30742
+ stopSubAgent: true
30704
30743
  }
30705
30744
  };
30706
30745
  function chatCapabilitiesForMode(mode) {
@@ -31243,6 +31282,7 @@ var chatOperationSchemas = {
31243
31282
  commandTaskOutput: external_exports.tuple([id, id]),
31244
31283
  stopCommandTask: external_exports.tuple([id, id]),
31245
31284
  backgroundCommandTask: external_exports.tuple([id, id]),
31285
+ stopSubAgent: external_exports.tuple([id, id]),
31246
31286
  getWorkspaceChanges: external_exports.tuple([id, id]),
31247
31287
  getWorkspaceFileDiff: external_exports.tuple([id, id, external_exports.string().max(1e4)]),
31248
31288
  inspectPermissions: taskMode,
@@ -32527,6 +32567,9 @@ function chatStorageMode(mode) {
32527
32567
  function terminalStorageAgentId(mode) {
32528
32568
  return mode === "claude-chat" ? "claude-code" : mode === "codex-chat" ? "codex" : mode;
32529
32569
  }
32570
+ function isStorageOnlyChatOwner(owner) {
32571
+ return owner.tabId.startsWith("artifact-store:") || owner.tabId === `task-content:${owner.taskId}`;
32572
+ }
32530
32573
 
32531
32574
  // ../../domains/chat-runtime/src/server/retention.ts
32532
32575
  var DAY = 864e5;
@@ -37381,6 +37424,7 @@ var tabOperations = /* @__PURE__ */ new Set([
37381
37424
  "commandTaskOutput",
37382
37425
  "stopCommandTask",
37383
37426
  "backgroundCommandTask",
37427
+ "stopSubAgent",
37384
37428
  "getWorkspaceChanges",
37385
37429
  "getWorkspaceFileDiff",
37386
37430
  "getTabState",
@@ -39397,10 +39441,12 @@ function applyEvent(state, event, ts) {
39397
39441
  }
39398
39442
  }
39399
39443
  const phase = endedSubAgentPhase(event.status) ?? incomingPhase;
39444
+ const spawnedInTurn = openTurn(state);
39400
39445
  const item = {
39401
39446
  kind: "sub-agent",
39402
39447
  toolUseId: id3,
39403
39448
  phase,
39449
+ ...spawnedInTurn !== null ? { spawnedInTurn } : {},
39404
39450
  description: event.description,
39405
39451
  status: event.status,
39406
39452
  summary: event.summary,
@@ -40261,7 +40307,7 @@ function findShellByShellId(state, shellId) {
40261
40307
  }
40262
40308
 
40263
40309
  // ../../domains/terminal/src/shared/chat-timeline-checkpoint.ts
40264
- var CHAT_TIMELINE_VERSION = "15";
40310
+ var CHAT_TIMELINE_VERSION = "16";
40265
40311
  var TIMELINE_PROJECTION_FORMAT = 1;
40266
40312
  var TIMELINE_PROJECTION_VERSION = `${CHAT_TIMELINE_VERSION}.${TIMELINE_PROJECTION_FORMAT}`;
40267
40313
  function encodeTimelineState(state, tailFrom) {
@@ -41498,6 +41544,8 @@ var ClaudeCommandTasks = class {
41498
41544
  callStarts = /* @__PURE__ */ new Map();
41499
41545
  inflight = /* @__PURE__ */ new Map();
41500
41546
  lastOutput = /* @__PURE__ */ new Map();
41547
+ /** Running sub-agents: tool_use_id of the call that started it → its task id. */
41548
+ subAgents = /* @__PURE__ */ new Map();
41501
41549
  disposed = false;
41502
41550
  /** The agent called a tool: a command it runs starts about now. */
41503
41551
  noteToolCall(toolUseId) {
@@ -41511,10 +41559,14 @@ var ClaudeCommandTasks = class {
41511
41559
  route(ev) {
41512
41560
  if (ev.subtype === "started") {
41513
41561
  if (ev.taskType === "local_bash" && ev.toolUseId) return this.startCommand(ev, ev.toolUseId);
41562
+ if (ev.toolUseId) this.subAgents.set(ev.toolUseId, ev.taskId);
41514
41563
  return subAgent(ev);
41515
41564
  }
41516
41565
  const command = this.commands.get(ev.taskId);
41517
41566
  if (!command) {
41567
+ if (ev.subtype === "notification" && ev.toolUseId && endedSubAgentPhase(ev.status)) {
41568
+ this.subAgents.delete(ev.toolUseId);
41569
+ }
41518
41570
  return ev.subtype === "notification" && ev.toolUseId ? subAgent(ev) : null;
41519
41571
  }
41520
41572
  const prev = command.snapshot;
@@ -41569,6 +41621,12 @@ var ClaudeCommandTasks = class {
41569
41621
  }
41570
41622
  await this.io.request({ subtype: "stop_task", task_id: taskId }, TASK_REQUEST_TIMEOUT_MS);
41571
41623
  }
41624
+ /** `stop_task`: stop a running sub-agent, named by the tool call that started it. */
41625
+ async stopSubAgent(toolUseId) {
41626
+ const taskId = this.disposed ? void 0 : this.subAgents.get(toolUseId);
41627
+ if (!taskId) throw new Error(`sub-agent ${toolUseId} is not running`);
41628
+ await this.io.request({ subtype: "stop_task", task_id: taskId }, TASK_REQUEST_TIMEOUT_MS);
41629
+ }
41572
41630
  /** `background_tasks`: move a running foreground command to the background (Ctrl+B). */
41573
41631
  async background(toolUseId) {
41574
41632
  if (this.disposed) return false;
@@ -41585,6 +41643,7 @@ var ClaudeCommandTasks = class {
41585
41643
  dispose() {
41586
41644
  this.disposed = true;
41587
41645
  this.commands.clear();
41646
+ this.subAgents.clear();
41588
41647
  this.inflight.clear();
41589
41648
  this.lastOutput.clear();
41590
41649
  }
@@ -42339,6 +42398,9 @@ var ClaudeSessionDriver = class {
42339
42398
  backgroundCommandTask(toolUseId) {
42340
42399
  return this.tasks.background(toolUseId);
42341
42400
  }
42401
+ stopSubAgent(toolUseId) {
42402
+ return this.tasks.stopSubAgent(toolUseId);
42403
+ }
42342
42404
  dispose() {
42343
42405
  this.tasks.dispose();
42344
42406
  this.notifications?.dispose();
@@ -42578,6 +42640,29 @@ var CodexSubAgents = class {
42578
42640
  }
42579
42641
  return out;
42580
42642
  }
42643
+ /**
42644
+ * Stop the child whose row this is: its running turn to interrupt, or
42645
+ * `queued` when it runs none yet (before its first turn, between turns) — its
42646
+ * next turn is interrupted as it starts ({@link takeQueuedStop}). Null: no
42647
+ * such child, or it ended.
42648
+ */
42649
+ requestStop(rowId) {
42650
+ for (const [threadId, child] of this.threads) {
42651
+ if (child.row.id !== rowId) continue;
42652
+ if (child.row.ended) return null;
42653
+ if (child.turnId) return { threadId, turnId: child.turnId };
42654
+ child.stopQueued = true;
42655
+ return "queued";
42656
+ }
42657
+ return null;
42658
+ }
42659
+ /** A child's turn started: the turn a queued Stop interrupts now, once. */
42660
+ takeQueuedStop(threadId) {
42661
+ const child = this.threads.get(threadId);
42662
+ if (!child?.stopQueued || !child.turnId || child.row.ended) return null;
42663
+ delete child.stopQueued;
42664
+ return { threadId, turnId: child.turnId };
42665
+ }
42581
42666
  /** End every row still open (a past conversation: its children are gone). */
42582
42667
  endOpen(status) {
42583
42668
  const out = [];
@@ -43773,6 +43858,16 @@ var CodexChatSession = class {
43773
43858
  client.request("turn/interrupt", { threadId, turnId }).catch((err) => console.warn("[codex-chat] sub-agent interrupt failed:", err));
43774
43859
  }
43775
43860
  }
43861
+ /**
43862
+ * Stop one sub-agent: interrupt its own running turn (its row ends
43863
+ * `interrupted`); between its turns, the next one as it starts.
43864
+ */
43865
+ async stopSubAgent(toolUseId) {
43866
+ const stop = this.disposed || !this.client ? null : this.subAgents.requestStop(toolUseId);
43867
+ if (!this.client || !stop) throw new Error(`sub-agent ${toolUseId} is not running`);
43868
+ if (stop === "queued") return;
43869
+ await this.client.request("turn/interrupt", stop, 5e3);
43870
+ }
43776
43871
  async interruptAndWait(timeoutMs) {
43777
43872
  let timer;
43778
43873
  const stopped = async () => {
@@ -44074,6 +44169,10 @@ var CodexChatSession = class {
44074
44169
  if (method !== "serverRequest/resolved" && typeof thread === "string" && this.threadId && thread !== this.threadId) {
44075
44170
  for (const event of this.subAgents.onThreadNotification(thread, method, params))
44076
44171
  this.emit(ctx, event);
44172
+ const queued = method === "turn/started" ? this.subAgents.takeQueuedStop(thread) : null;
44173
+ if (queued && this.client) {
44174
+ this.client.request("turn/interrupt", queued, 5e3).catch((err) => console.warn("[codex-chat] sub-agent stop failed:", err));
44175
+ }
44077
44176
  return;
44078
44177
  }
44079
44178
  switch (method) {
@@ -49907,6 +50006,14 @@ function createChatTransport(initialDeps = {}, conversations = createConversatio
49907
50006
  }
49908
50007
  return proc.driver.stopCommandTask(taskId);
49909
50008
  }
50009
+ function stopSubAgent2(tabId, toolUseId) {
50010
+ const proc = liveProcess(tabId);
50011
+ if (!proc) return Promise.reject(new ChatTransportError("no live session"));
50012
+ if (!proc.driver.stopSubAgent) {
50013
+ return Promise.reject(new ChatTransportError("this agent cannot stop a sub-agent"));
50014
+ }
50015
+ return proc.driver.stopSubAgent(toolUseId);
50016
+ }
49910
50017
  function backgroundCommandTask2(tabId, toolUseId) {
49911
50018
  const proc = liveProcess(tabId);
49912
50019
  if (!proc || !proc.driver.backgroundCommandTask) return Promise.resolve(false);
@@ -50795,6 +50902,7 @@ function createChatTransport(initialDeps = {}, conversations = createConversatio
50795
50902
  getCommandTaskOutput: getCommandTaskOutput2,
50796
50903
  stopCommandTask: stopCommandTask2,
50797
50904
  backgroundCommandTask: backgroundCommandTask2,
50905
+ stopSubAgent: stopSubAgent2,
50798
50906
  updateSessionChatMode: updateSessionChatMode2,
50799
50907
  updateSessionChatModel: updateSessionChatModel2,
50800
50908
  updateSessionChatEffort: updateSessionChatEffort2,
@@ -50866,6 +50974,7 @@ var {
50866
50974
  getCommandTaskOutput,
50867
50975
  stopCommandTask,
50868
50976
  backgroundCommandTask,
50977
+ stopSubAgent,
50869
50978
  updateSessionChatMode,
50870
50979
  updateSessionChatModel,
50871
50980
  updateSessionChatEffort,
@@ -51076,18 +51185,23 @@ var USABLE_PLACEMENT_STATUSES = ["pending", "ready"];
51076
51185
 
51077
51186
  // ../../domains/computers/src/shared/upgrade-status.ts
51078
51187
  init_zod();
51188
+
51189
+ // ../../domains/computers/src/shared/computer-labels.ts
51190
+ var COMPUTER_UPGRADE_PHASES = [
51191
+ "checking",
51192
+ "installing",
51193
+ "waiting-for-idle",
51194
+ "restarting",
51195
+ "probation",
51196
+ "connected",
51197
+ "rollback",
51198
+ "failed",
51199
+ "maintenance-required"
51200
+ ];
51201
+
51202
+ // ../../domains/computers/src/shared/upgrade-status.ts
51079
51203
  var computerUpgradeStatusSchema = external_exports.object({
51080
- phase: external_exports.enum([
51081
- "checking",
51082
- "installing",
51083
- "waiting-for-idle",
51084
- "restarting",
51085
- "probation",
51086
- "connected",
51087
- "rollback",
51088
- "failed",
51089
- "maintenance-required"
51090
- ]),
51204
+ phase: external_exports.enum(COMPUTER_UPGRADE_PHASES),
51091
51205
  currentVersion: external_exports.string().max(100),
51092
51206
  hostVersion: external_exports.string().max(100),
51093
51207
  version: external_exports.string().max(100).optional(),
@@ -54042,6 +54156,7 @@ function createChatOps(opts) {
54042
54156
  getCommandTaskOutput: getCommandTaskOutput2,
54043
54157
  stopCommandTask: stopCommandTask2,
54044
54158
  backgroundCommandTask: backgroundCommandTask2,
54159
+ stopSubAgent: stopSubAgent2,
54045
54160
  sendToolResult: sendToolResult2,
54046
54161
  sendControlRequest: sendControlRequest2,
54047
54162
  respondToPermissionRequest: respondToPermissionRequest2,
@@ -54267,6 +54382,8 @@ function createChatOps(opts) {
54267
54382
  stopCommandTask: (tabId, taskId) => stopCommandTask2(tabId, taskId),
54268
54383
  /** Move a running foreground command to the background (`background_tasks`). */
54269
54384
  backgroundCommandTask: (tabId, toolUseId) => backgroundCommandTask2(tabId, toolUseId),
54385
+ /** Stop one running sub-agent, by its row's tool_use_id (`stop_task` / Codex `turn/interrupt`). */
54386
+ stopSubAgent: (tabId, toolUseId) => stopSubAgent2(tabId, toolUseId),
54270
54387
  /**
54271
54388
  * Eager spawn entrypoint. Used by the renderer's "Restart" button after a
54272
54389
  * session ended — user wants a live subprocess immediately, not on the next
@@ -55161,7 +55278,7 @@ function createLocalChatData(store, notify = () => void 0) {
55161
55278
  store.removeRecord(previous2.identity.id, previous2.identity.epoch, "draft", inherited.id);
55162
55279
  }
55163
55280
  }
55164
- if (value.identity.tabId.startsWith("artifact-store:") || value.identity.tabId === `task-content:${value.identity.taskId}`)
55281
+ if (isStorageOnlyChatOwner(value.identity))
55165
55282
  set2(value.identity.tabId, "settings", "inbox", true);
55166
55283
  store.transaction(() => {
55167
55284
  const previous2 = get(
@@ -55907,7 +56024,7 @@ function createLocalChatData(store, notify = () => void 0) {
55907
56024
  legacyJsonField: (v.mode ?? i.mode).endsWith("-chat") ? "chatConversationId" : "conversationId"
55908
56025
  });
55909
56026
  }
55910
- if (i.tabId !== `task-content:${i.taskId}` && r.kind === "settings" && (r.id === "provider" || r.id.startsWith("provider:"))) {
56027
+ if (!isStorageOnlyChatOwner(i) && r.kind === "settings" && (r.id === "provider" || r.id.startsWith("provider:"))) {
55911
56028
  const mode = r.id === "provider" ? i.mode : r.id.slice(9), current = providerState(i.taskId, mode), cfg = current.value;
55912
56029
  for (const key of [
55913
56030
  "chatMode",
@@ -61678,7 +61795,7 @@ async function createProjectPathStore(hubHost, options = {}) {
61678
61795
  }
61679
61796
 
61680
61797
  // src/main.ts
61681
- var COMPUTER_VERSION = true ? "0.37.0" : "0.0.0";
61798
+ var COMPUTER_VERSION = true ? "0.37.2" : "0.0.0";
61682
61799
  function createHubRequestHandler(deps4) {
61683
61800
  const log = deps4.log ?? (() => {
61684
61801
  });
@@ -62294,7 +62411,7 @@ var import_node_os13 = require("node:os");
62294
62411
  init_client();
62295
62412
 
62296
62413
  // src/build-identity.ts
62297
- var COMPUTER_BUILD_ID = true ? "457a1910-dcb0-4841-9c4a-10bb411cba0d" : void 0;
62414
+ var COMPUTER_BUILD_ID = true ? "d5a18e93-f42f-424b-900c-06374867127b" : void 0;
62298
62415
 
62299
62416
  // src/session-host.ts
62300
62417
  function runtimeDir(root) {