@super-one/cli 0.50.5-alpha → 0.50.7-alpha

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.
Files changed (3) hide show
  1. package/MANIFEST.json +2 -2
  2. package/lib/cli.mjs +329 -123
  3. package/package.json +1 -1
package/MANIFEST.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@super-one/cli",
3
- "version": "0.50.5-alpha",
3
+ "version": "0.50.7-alpha",
4
4
  "kind": "npm",
5
5
  "minNodeMajor": 20,
6
- "builtAt": "2026-08-07T07:57:09.216Z"
6
+ "builtAt": "2026-08-08T03:37:34.425Z"
7
7
  }
package/lib/cli.mjs CHANGED
@@ -256,7 +256,7 @@ var init_host_action_superone_descriptors = __esm({
256
256
  },
257
257
  "worktree": {
258
258
  "type": "object",
259
- "description": 'Request a host-managed worktree for same-repo isolation while cwd stays omitted or at the project root. Set enabled, baseBranch, and mode; use a unique branchName with branch. See read_manual({ domain: "product", topic: "collaboration" }) for implementer and reviewer recipes.',
259
+ "description": 'Request a host-managed worktree for same-repo isolation while cwd stays omitted or at the project root. Use for parallel implementers (mode branch + unique branchName), not for default read-only review of the current shared checkout. Use mode detach only when reviewing a feature branch another implementer already has checked out. See read_manual({ domain: "product", topic: "collaboration" }).',
260
260
  "properties": {
261
261
  "enabled": {
262
262
  "type": "boolean"
@@ -12027,8 +12027,11 @@ var init_session_runtime = __esm({
12027
12027
  const s2 = this.live.get(sessionId);
12028
12028
  return s2 ? this.clone(s2) : null;
12029
12029
  }
12030
- list(projectId) {
12031
- return [...this.live.values()].filter((s2) => !projectId || s2.projectId === projectId).map((s2) => this.clone(s2));
12030
+ list(projectId, options) {
12031
+ const rows = [...this.live.values()].filter((s2) => !projectId || s2.projectId === projectId).sort((a, b2) => (b2.updatedAt ?? 0) - (a.updatedAt ?? 0) || (b2.createdAt ?? 0) - (a.createdAt ?? 0));
12032
+ const offset = Math.max(0, options?.offset ?? 0);
12033
+ const limited = options?.limit != null && options.limit >= 0 ? rows.slice(offset, offset + options.limit) : offset > 0 ? rows.slice(offset) : rows;
12034
+ return limited.map((s2) => this.clone(s2));
12032
12035
  }
12033
12036
  snapshotSequence() {
12034
12037
  return this.events.headSequence();
@@ -13837,6 +13840,19 @@ function parseSimpleFrontmatter(content) {
13837
13840
  }
13838
13841
  return result;
13839
13842
  }
13843
+ function resolveArgumentHint(fm) {
13844
+ if (!fm) return "";
13845
+ const fromArguments = (fm.arguments ?? "").trim();
13846
+ if (fromArguments) return fromArguments;
13847
+ return (fm["argument-hint"] ?? "").trim();
13848
+ }
13849
+ function readArgumentHintFromMarkdownFile(filePath) {
13850
+ try {
13851
+ return resolveArgumentHint(parseSimpleFrontmatter(safeReadText(filePath)));
13852
+ } catch {
13853
+ return "";
13854
+ }
13855
+ }
13840
13856
  function firstMarkdownHeading(content) {
13841
13857
  for (const line of content.split("\n")) {
13842
13858
  const m2 = line.match(/^#\s+(.+)$/);
@@ -13867,7 +13883,7 @@ function discoverClaudeSkillsAndCommands(projectRoot2, opts) {
13867
13883
  skills.push({
13868
13884
  name: ent.name,
13869
13885
  description: fm.description ?? "",
13870
- argumentHint: fm.arguments ?? fm["argument-hint"] ?? "",
13886
+ argumentHint: resolveArgumentHint(fm),
13871
13887
  isSkill: true,
13872
13888
  scope
13873
13889
  });
@@ -13891,7 +13907,7 @@ function discoverClaudeSkillsAndCommands(projectRoot2, opts) {
13891
13907
  commands.push({
13892
13908
  name,
13893
13909
  description: fm.description ?? firstMarkdownHeading(content),
13894
- argumentHint: fm["argument-hint"] ?? "",
13910
+ argumentHint: resolveArgumentHint(fm),
13895
13911
  isSkill: false,
13896
13912
  scope
13897
13913
  });
@@ -14124,7 +14140,7 @@ function discoverCodexUserPrompts(opts) {
14124
14140
  out.push({
14125
14141
  name,
14126
14142
  description: fm.description ?? "",
14127
- argumentHint: fm["argument-hint"] ?? "",
14143
+ argumentHint: resolveArgumentHint(fm),
14128
14144
  isSkill: false
14129
14145
  });
14130
14146
  }
@@ -18529,9 +18545,23 @@ var init_turn_attachments = __esm({
18529
18545
  }
18530
18546
  });
18531
18547
 
18548
+ // ../../packages/shared/src/agent-transcript-path.ts
18549
+ function isAgentTranscriptAbsolutePath(filePath) {
18550
+ if (!filePath || filePath.includes("\0")) return false;
18551
+ const norm = filePath.replace(/\\/g, "/");
18552
+ if (!norm.startsWith("/") && !/^[A-Za-z]:\//.test(norm)) return false;
18553
+ return norm.includes("/.grok/sessions/") || norm.includes("/.claude/projects/") || /\/\.grok\/sessions\/?$/.test(norm) || /\/\.claude\/projects\/?$/.test(norm);
18554
+ }
18555
+ var init_agent_transcript_path = __esm({
18556
+ "../../packages/shared/src/agent-transcript-path.ts"() {
18557
+ "use strict";
18558
+ }
18559
+ });
18560
+
18532
18561
  // ../../packages/runtime/src/fs/path-security.ts
18533
18562
  import { realpathSync as realpathSync2, existsSync as existsSync11, lstatSync, statSync } from "node:fs";
18534
- import { isAbsolute, join as join9, normalize, resolve, sep } from "node:path";
18563
+ import { homedir as homedir3 } from "node:os";
18564
+ import { dirname as dirname5, isAbsolute, join as join9, normalize, resolve, sep } from "node:path";
18535
18565
  function resolveProjectPath(projectRoot2, relativePath) {
18536
18566
  if (relativePath.includes("\0")) {
18537
18567
  return { ok: false, reason: "null byte in path" };
@@ -18600,6 +18630,41 @@ function isToolOutputRelativePath(relativePath) {
18600
18630
  if (n === "." || n === "" || n === ".." || n.startsWith("../")) return false;
18601
18631
  return n === "temp" || n.startsWith(TOOL_OUTPUT_REL_PREFIX);
18602
18632
  }
18633
+ function getAgentTranscriptRoots(opts) {
18634
+ const homeDir = opts?.homeDir ?? homedir3();
18635
+ return [
18636
+ join9(homeDir, ".grok", "sessions"),
18637
+ join9(homeDir, ".claude", "projects")
18638
+ ];
18639
+ }
18640
+ function assertAgentTranscriptAbsolutePath(filePath, opts) {
18641
+ if (!isAgentTranscriptAbsolutePath(filePath)) return false;
18642
+ if (!isAbsolute(filePath) && !filePath.replace(/\\/g, "/").startsWith("/")) return false;
18643
+ const candidate = normalizeSep(resolve(filePath));
18644
+ const roots = getAgentTranscriptRoots(opts).map((root) => {
18645
+ const resolved = normalizeSep(resolve(root));
18646
+ const real = existsSync11(resolved) ? normalizeSep(resolveRealPath(resolved)) : resolved;
18647
+ return { resolved, real };
18648
+ });
18649
+ const underAnyRoot = (abs) => {
18650
+ const n = normalizeSep(abs);
18651
+ return roots.some(
18652
+ (r) => n === r.resolved || n.startsWith(r.resolved + sep) || n === r.real || n.startsWith(r.real + sep)
18653
+ );
18654
+ };
18655
+ if (!underAnyRoot(candidate)) return false;
18656
+ if (existsSync11(candidate)) {
18657
+ return underAnyRoot(resolveRealPath(candidate));
18658
+ }
18659
+ let existing = candidate;
18660
+ while (!existsSync11(existing)) {
18661
+ const parent = dirname5(existing);
18662
+ if (parent === existing) return true;
18663
+ if (!underAnyRoot(parent)) return true;
18664
+ existing = parent;
18665
+ }
18666
+ return underAnyRoot(resolveRealPath(existing));
18667
+ }
18603
18668
  function pathKind(absolutePath) {
18604
18669
  try {
18605
18670
  const st = lstatSync(absolutePath);
@@ -18644,6 +18709,8 @@ var TOOL_OUTPUT_REL_PREFIX;
18644
18709
  var init_path_security = __esm({
18645
18710
  "../../packages/runtime/src/fs/path-security.ts"() {
18646
18711
  "use strict";
18712
+ init_agent_transcript_path();
18713
+ init_agent_transcript_path();
18647
18714
  TOOL_OUTPUT_REL_PREFIX = "temp/";
18648
18715
  }
18649
18716
  });
@@ -18734,7 +18801,7 @@ import {
18734
18801
  statSync as statSync3,
18735
18802
  writeFileSync as writeFileSync4
18736
18803
  } from "node:fs";
18737
- import { basename, dirname as dirname5, join as join11, resolve as resolve2, sep as sep2 } from "node:path";
18804
+ import { basename, dirname as dirname6, join as join11, resolve as resolve2, sep as sep2 } from "node:path";
18738
18805
  import { homedir as osHomedir3 } from "node:os";
18739
18806
  function homeOf2(opts) {
18740
18807
  return opts?.homeDir ?? osHomedir3();
@@ -18771,7 +18838,7 @@ function parseFrontmatterFile(filePath) {
18771
18838
  return {
18772
18839
  name: fm.name ?? "",
18773
18840
  description,
18774
- argumentHint: fm.arguments ?? fm["argument-hint"] ?? ""
18841
+ argumentHint: resolveArgumentHint(fm)
18775
18842
  };
18776
18843
  } catch {
18777
18844
  return { name: "", description: "", argumentHint: "" };
@@ -19068,7 +19135,7 @@ function installManagedSkill(provider, cwd, input, opts) {
19068
19135
  code: "invalid_argument"
19069
19136
  });
19070
19137
  }
19071
- mkdirSync6(dirname5(abs), { recursive: true });
19138
+ mkdirSync6(dirname6(abs), { recursive: true });
19072
19139
  writeFileSync4(abs, content, "utf8");
19073
19140
  }
19074
19141
  } catch (err) {
@@ -19100,7 +19167,7 @@ var init_skills_manage = __esm({
19100
19167
 
19101
19168
  // ../../packages/runtime/src/fs/mcp-config-claude.ts
19102
19169
  import { existsSync as existsSync14, mkdirSync as mkdirSync7, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "node:fs";
19103
- import { dirname as dirname6, join as join12 } from "node:path";
19170
+ import { dirname as dirname7, join as join12 } from "node:path";
19104
19171
  import { homedir as osHomedir4 } from "node:os";
19105
19172
  function homeOf3(opts) {
19106
19173
  return opts?.homeDir ?? osHomedir4();
@@ -19123,7 +19190,7 @@ function readJsonFile(filePath) {
19123
19190
  }
19124
19191
  }
19125
19192
  function writeJsonFile(filePath, data) {
19126
- mkdirSync7(dirname6(filePath), { recursive: true });
19193
+ mkdirSync7(dirname7(filePath), { recursive: true });
19127
19194
  writeFileSync5(filePath, JSON.stringify(data, null, 2) + "\n", "utf8");
19128
19195
  }
19129
19196
  function extractServers(config2, scope) {
@@ -20154,7 +20221,7 @@ var init_dist = __esm({
20154
20221
 
20155
20222
  // ../../packages/runtime/src/fs/mcp-config-codex.ts
20156
20223
  import { existsSync as existsSync15, mkdirSync as mkdirSync8, readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "node:fs";
20157
- import { dirname as dirname7, join as join13 } from "node:path";
20224
+ import { dirname as dirname8, join as join13 } from "node:path";
20158
20225
  import { homedir as osHomedir5 } from "node:os";
20159
20226
  function homeOf4(opts) {
20160
20227
  return opts?.homeDir ?? osHomedir5();
@@ -20176,7 +20243,7 @@ function readConfigFile2(filePath) {
20176
20243
  }
20177
20244
  }
20178
20245
  function writeConfigFile(filePath, data) {
20179
- mkdirSync8(dirname7(filePath), { recursive: true });
20246
+ mkdirSync8(dirname8(filePath), { recursive: true });
20180
20247
  writeFileSync6(filePath, stringify(data), "utf8");
20181
20248
  }
20182
20249
  function parseConfigFile(filePath, scope) {
@@ -20434,7 +20501,7 @@ import {
20434
20501
  statSync as statSync4,
20435
20502
  writeFileSync as writeFileSync7
20436
20503
  } from "node:fs";
20437
- import { dirname as dirname8, join as join14, resolve as resolve3 } from "node:path";
20504
+ import { dirname as dirname9, join as join14, resolve as resolve3 } from "node:path";
20438
20505
  import { homedir as osHomedir6 } from "node:os";
20439
20506
  function homeOf5(opts) {
20440
20507
  return opts?.homeDir ?? osHomedir6();
@@ -20491,7 +20558,7 @@ function getMarketplaceScopeMap(cwd, opts) {
20491
20558
  return map2;
20492
20559
  }
20493
20560
  function writeSettingsJson(filePath, data) {
20494
- mkdirSync9(dirname8(filePath), { recursive: true });
20561
+ mkdirSync9(dirname9(filePath), { recursive: true });
20495
20562
  writeFileSync7(filePath, JSON.stringify(data, null, 2) + "\n");
20496
20563
  }
20497
20564
  function removeMarketplaceFromSettings(filePath, name) {
@@ -21030,7 +21097,7 @@ var init_plugins_manage = __esm({
21030
21097
 
21031
21098
  // ../../packages/runtime/src/fs/hooks-config.ts
21032
21099
  import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync12, writeFileSync as writeFileSync8 } from "node:fs";
21033
- import { dirname as dirname9, join as join15 } from "node:path";
21100
+ import { dirname as dirname10, join as join15 } from "node:path";
21034
21101
  import { homedir as osHomedir7 } from "node:os";
21035
21102
  function homeOf6(opts) {
21036
21103
  return opts?.homeDir ?? osHomedir7();
@@ -21058,7 +21125,7 @@ function readJsonFile2(filePath) {
21058
21125
  }
21059
21126
  }
21060
21127
  function writeJsonFile2(filePath, data) {
21061
- mkdirSync10(dirname9(filePath), { recursive: true });
21128
+ mkdirSync10(dirname10(filePath), { recursive: true });
21062
21129
  writeFileSync8(filePath, JSON.stringify(data, null, 2));
21063
21130
  }
21064
21131
  function getHooksMap(data) {
@@ -40991,8 +41058,11 @@ var init_tool_result_map = __esm({
40991
41058
  });
40992
41059
 
40993
41060
  // ../../packages/acp/src/xai-state.ts
40994
- function createXaiCorrelationState() {
41061
+ import { homedir as homedir4 } from "node:os";
41062
+ import { join as join16 } from "node:path";
41063
+ function createXaiCorrelationState(opts) {
40995
41064
  return {
41065
+ ...opts?.cwd ? { cwd: opts.cwd } : {},
40996
41066
  workflowToolByRunId: /* @__PURE__ */ new Map(),
40997
41067
  workflowRevision: /* @__PURE__ */ new Map(),
40998
41068
  workflowStarted: /* @__PURE__ */ new Set(),
@@ -41000,6 +41070,7 @@ function createXaiCorrelationState() {
41000
41070
  smokeWorkflowToolIds: /* @__PURE__ */ new Set(),
41001
41071
  pendingToolNamesById: /* @__PURE__ */ new Map(),
41002
41072
  subagentToolById: /* @__PURE__ */ new Map(),
41073
+ subagentOutputById: /* @__PURE__ */ new Map(),
41003
41074
  subagentStarted: /* @__PURE__ */ new Set(),
41004
41075
  bgTaskById: /* @__PURE__ */ new Map(),
41005
41076
  goalStarted: /* @__PURE__ */ new Set(),
@@ -41008,6 +41079,17 @@ function createXaiCorrelationState() {
41008
41079
  lastMessageId: null
41009
41080
  };
41010
41081
  }
41082
+ function resolveGrokChildChatHistoryPath(cwd, childSessionId) {
41083
+ if (!cwd || !childSessionId) return void 0;
41084
+ return join16(homedir4(), ".grok", "sessions", encodeURIComponent(cwd), childSessionId, "chat_history.jsonl");
41085
+ }
41086
+ function noteSubagentOutputFile(state, subagentId, childSessionId) {
41087
+ const existing = state.subagentOutputById.get(subagentId);
41088
+ if (existing) return existing;
41089
+ const path = resolveGrokChildChatHistoryPath(state.cwd, childSessionId || subagentId);
41090
+ if (path) state.subagentOutputById.set(subagentId, path);
41091
+ return path;
41092
+ }
41011
41093
  function isSubagentLaunchToolName(name) {
41012
41094
  if (!name) return false;
41013
41095
  const n = name.toLowerCase();
@@ -41270,6 +41352,12 @@ function mapXaiSessionUpdate(update, state, ctx = {}) {
41270
41352
  return mapAutoRecoveryStarted(update);
41271
41353
  case "auto_recovery_exhausted":
41272
41354
  return mapAutoRecoveryExhausted(update);
41355
+ case "last_turn_summary":
41356
+ return mapLastTurnSummary(update, ctx);
41357
+ case "session_recap":
41358
+ return mapSessionRecap(update);
41359
+ case "session_recap_unavailable":
41360
+ return [];
41273
41361
  case "unknown":
41274
41362
  return [];
41275
41363
  default:
@@ -41469,18 +41557,23 @@ function mapSubagentSpawned(u, state) {
41469
41557
  state.subagentToolById.delete(id);
41470
41558
  }
41471
41559
  const toolUseId = workflowRunId ? void 0 : state.subagentToolById.get(id);
41560
+ const childSessionId = strField(u, "child_session_id", "childSessionId") ?? id;
41561
+ const outputFile = workflowRunId ? void 0 : noteSubagentOutputFile(state, id, childSessionId);
41472
41562
  return [{
41473
41563
  type: "task_started",
41474
41564
  taskId: id,
41475
41565
  ...toolUseId ? { toolUseId } : {},
41476
41566
  description,
41477
- ...subagentType ? { taskType: subagentType } : {}
41567
+ ...subagentType ? { taskType: subagentType } : {},
41568
+ ...outputFile ? { outputFile } : {}
41478
41569
  }];
41479
41570
  }
41480
41571
  function mapSubagentProgress(u, state) {
41481
41572
  const id = strField(u, "subagent_id", "subagentId");
41482
41573
  if (!id) return [];
41483
41574
  if (state.workflowOwnedSubagents.has(id)) return [];
41575
+ const childSessionId = strField(u, "child_session_id", "childSessionId") ?? id;
41576
+ const outputFile = noteSubagentOutputFile(state, id, childSessionId);
41484
41577
  const events = [];
41485
41578
  if (!state.subagentStarted.has(id)) {
41486
41579
  state.subagentStarted.add(id);
@@ -41488,28 +41581,26 @@ function mapSubagentProgress(u, state) {
41488
41581
  type: "task_started",
41489
41582
  taskId: id,
41490
41583
  ...state.subagentToolById.get(id) ? { toolUseId: state.subagentToolById.get(id) } : {},
41491
- description: id
41584
+ description: id,
41585
+ ...outputFile ? { outputFile } : {}
41492
41586
  });
41493
41587
  }
41494
41588
  const durationMs = numField(u, "duration_ms", "durationMs") ?? 0;
41495
41589
  const toolCalls = numField(u, "tool_call_count", "toolCallCount") ?? 0;
41496
41590
  const tokens = numField(u, "tokens_used", "tokensUsed") ?? 0;
41497
41591
  const toolsUsed = (arrField(u, "tools_used", "toolsUsed") ?? []).filter((t) => typeof t === "string" && t.length > 0);
41498
- const recent = toolsUsed.slice(-8);
41499
- const lastTool = recent[recent.length - 1];
41500
- const activityText = recent.length ? recent.join(", ") : void 0;
41501
- const toolEntries = recent.map((toolName) => ({ toolName, description: "" }));
41592
+ const activityText = toolsUsed.length ? toolsUsed.join(", ") : void 0;
41502
41593
  const toolUseId = state.subagentToolById.get(id);
41503
41594
  events.push({
41504
41595
  type: "task_progress",
41505
41596
  taskId: id,
41506
41597
  ...toolUseId ? { toolUseId } : {},
41507
- // Prefer last tool name as description so reducer toolHistory advances.
41508
- description: lastTool ?? id,
41509
- ...lastTool ? { lastToolName: lastTool } : {},
41598
+ // Keep a stable non-tool description so reducer does not invent history from
41599
+ // description transitions when no transcript path is available.
41600
+ description: id,
41510
41601
  usage: { totalTokens: tokens, toolUses: toolCalls, durationMs },
41511
41602
  ...activityText ? { activityText } : {},
41512
- ...toolEntries.length ? { toolEntries } : {}
41603
+ ...outputFile ? { outputFile } : {}
41513
41604
  });
41514
41605
  return events;
41515
41606
  }
@@ -41525,6 +41616,8 @@ function mapSubagentFinished(u, state) {
41525
41616
  const durationMs = numField(u, "duration_ms", "durationMs") ?? 0;
41526
41617
  const toolCalls = numField(u, "tool_calls", "toolCalls") ?? 0;
41527
41618
  const tokens = numField(u, "tokens_used", "tokensUsed") ?? 0;
41619
+ const childSessionId = strField(u, "child_session_id", "childSessionId") ?? id;
41620
+ const outputFile = noteSubagentOutputFile(state, id, childSessionId) ?? "";
41528
41621
  const events = [];
41529
41622
  if (!state.subagentStarted.has(id)) {
41530
41623
  state.subagentStarted.add(id);
@@ -41532,7 +41625,8 @@ function mapSubagentFinished(u, state) {
41532
41625
  type: "task_started",
41533
41626
  taskId: id,
41534
41627
  ...toolUseId ? { toolUseId } : {},
41535
- description: id
41628
+ description: id,
41629
+ ...outputFile ? { outputFile } : {}
41536
41630
  });
41537
41631
  }
41538
41632
  events.push({
@@ -41540,7 +41634,7 @@ function mapSubagentFinished(u, state) {
41540
41634
  taskId: id,
41541
41635
  ...toolUseId ? { toolUseId } : {},
41542
41636
  taskStatus,
41543
- outputFile: "",
41637
+ outputFile,
41544
41638
  summary: error51 ?? status,
41545
41639
  usage: { totalTokens: tokens, toolUses: toolCalls, durationMs },
41546
41640
  ...output ? { resultText: output } : error51 ? { resultText: error51 } : {}
@@ -41873,6 +41967,27 @@ function mapAutoCompactFailed(u) {
41873
41967
  compactError: error51
41874
41968
  }];
41875
41969
  }
41970
+ function mapLastTurnSummary(u, ctx) {
41971
+ const summary = strField(u, "summary")?.trim();
41972
+ if (!summary) return [];
41973
+ const promptId = strField(u, "prompt_id", "promptId");
41974
+ return [{
41975
+ type: "turn_summary",
41976
+ summary,
41977
+ ...promptId ? { promptId } : {},
41978
+ ...ctx.messageId ? { messageId: ctx.messageId } : {}
41979
+ }];
41980
+ }
41981
+ function mapSessionRecap(u) {
41982
+ const summary = strField(u, "summary")?.trim();
41983
+ if (!summary) return [];
41984
+ const auto = boolField(u, "auto");
41985
+ return [{
41986
+ type: "session_recap",
41987
+ summary,
41988
+ ...auto != null ? { auto } : {}
41989
+ }];
41990
+ }
41876
41991
  function mapModelChanged(u) {
41877
41992
  const modelId = strField(u, "model_id", "modelId");
41878
41993
  if (!modelId) return [];
@@ -42189,12 +42304,18 @@ function mapSessionUpdate(update, ctx, opts) {
42189
42304
  const name = c.name.replace(/^\//, "").trim();
42190
42305
  if (!name) continue;
42191
42306
  if (isHiddenAcpPermissionSlashCommand(name)) continue;
42192
- const hint = c.input && typeof c.input === "object" && typeof c.input.hint === "string" ? c.input.hint : "";
42307
+ let hint = c.input && typeof c.input === "object" && typeof c.input.hint === "string" ? c.input.hint.trim() : "";
42308
+ if (!hint && c._meta && typeof c._meta === "object" && typeof c._meta.path === "string") {
42309
+ hint = readArgumentHintFromMarkdownFile(c._meta.path);
42310
+ }
42311
+ const isSkill = Boolean(
42312
+ c._meta && typeof c._meta === "object" && typeof c._meta.path === "string" && /SKILL\.md$/i.test(c._meta.path)
42313
+ );
42193
42314
  commands.push({
42194
42315
  name,
42195
42316
  description: typeof c.description === "string" ? c.description : "",
42196
42317
  argumentHint: hint,
42197
- isSkill: false
42318
+ isSkill
42198
42319
  });
42199
42320
  }
42200
42321
  return [{ type: "acp_commands", commands }];
@@ -42259,7 +42380,9 @@ function createAcpAgentEventMapper(options) {
42259
42380
  const nativeToLocal = /* @__PURE__ */ new Map();
42260
42381
  const localMessageIds = /* @__PURE__ */ new Set([options.messageId]);
42261
42382
  const openTools = /* @__PURE__ */ new Set();
42262
- const xaiCorrelation = createXaiCorrelationState();
42383
+ const xaiCorrelation = createXaiCorrelationState(
42384
+ options.cwd ? { cwd: options.cwd } : void 0
42385
+ );
42263
42386
  let currentMessageId = options.messageId;
42264
42387
  let started = false;
42265
42388
  let terminal = false;
@@ -42377,6 +42500,7 @@ function createAcpAgentEventMapper(options) {
42377
42500
  var init_agent_event_mapper3 = __esm({
42378
42501
  "../../packages/acp/src/agent-event-mapper.ts"() {
42379
42502
  "use strict";
42503
+ init_fs();
42380
42504
  init_config_map();
42381
42505
  init_slash_filter();
42382
42506
  init_tool_normalization();
@@ -42579,7 +42703,8 @@ function createAcpAgentTurnRunner(opts = {}) {
42579
42703
  const blockId = `acp-${sessionId}`;
42580
42704
  agentEventMapper = input.onAgentEvent ? createAcpAgentEventMapper({
42581
42705
  messageId: input.messageId ?? blockId,
42582
- emit: input.onAgentEvent
42706
+ emit: input.onAgentEvent,
42707
+ cwd
42583
42708
  }) : null;
42584
42709
  agentEventMapper?.start(sessionId);
42585
42710
  if (agentEventMapper) {
@@ -49109,23 +49234,23 @@ var init_parse4 = __esm({
49109
49234
  // ../../packages/opencode/src/server.ts
49110
49235
  import { spawn as spawn3 } from "node:child_process";
49111
49236
  import { existsSync as existsSync20 } from "node:fs";
49112
- import { homedir as homedir3 } from "node:os";
49113
- import { delimiter, join as join16 } from "node:path";
49237
+ import { homedir as homedir5 } from "node:os";
49238
+ import { delimiter, join as join17 } from "node:path";
49114
49239
  function appendOutput(current, chunk) {
49115
49240
  const next = current + chunk.toString();
49116
49241
  return next.length <= maxServerOutput ? next : next.slice(-maxServerOutput);
49117
49242
  }
49118
49243
  function defaultOpenCodeBinaryPath() {
49119
49244
  const filename = process.platform === "win32" ? "opencode.exe" : "opencode";
49120
- const installed = join16(homedir3(), ".opencode", "bin", filename);
49245
+ const installed = join17(homedir5(), ".opencode", "bin", filename);
49121
49246
  return existsSync20(installed) ? installed : filename;
49122
49247
  }
49123
49248
  function openCodePath(pathEnv) {
49124
- const home = homedir3();
49249
+ const home = homedir5();
49125
49250
  const paths = [
49126
- join16(home, ".opencode", "bin"),
49127
- join16(home, ".local", "bin"),
49128
- join16(home, ".bun", "bin"),
49251
+ join17(home, ".opencode", "bin"),
49252
+ join17(home, ".local", "bin"),
49253
+ join17(home, ".bun", "bin"),
49129
49254
  "/opt/homebrew/bin",
49130
49255
  "/usr/local/bin",
49131
49256
  ...(pathEnv ?? "").split(delimiter)
@@ -49944,7 +50069,7 @@ __export(managed_harness_official_exports, {
49944
50069
  });
49945
50070
  import { existsSync as existsSync24, mkdirSync as mkdirSync12, readFileSync as readFileSync14, readdirSync as readdirSync8, statSync as statSync6 } from "node:fs";
49946
50071
  import { arch as osArch2, platform as osPlatform2 } from "node:os";
49947
- import { join as join18, resolve as resolve5 } from "node:path";
50072
+ import { join as join19, resolve as resolve5 } from "node:path";
49948
50073
  import { spawn as spawn4 } from "node:child_process";
49949
50074
  function managedNpmPrefix(nodeHome, harnessId) {
49950
50075
  return resolve5(nodeHome, "managed-npm", harnessId);
@@ -49990,29 +50115,29 @@ function officialPackageSpecs(harnessId) {
49990
50115
  function resolveOfficialInstallBinary(harnessId, prefix) {
49991
50116
  if (harnessId === "codex") {
49992
50117
  const candidates = [
49993
- join18(prefix, "bin", "codex"),
49994
- join18(prefix, "bin", "codex.cmd"),
49995
- join18(prefix, "lib", "node_modules", "@openai", "codex", "bin", "codex.js")
50118
+ join19(prefix, "bin", "codex"),
50119
+ join19(prefix, "bin", "codex.cmd"),
50120
+ join19(prefix, "lib", "node_modules", "@openai", "codex", "bin", "codex.js")
49996
50121
  ];
49997
50122
  for (const c of candidates) {
49998
50123
  if (existsSync24(c) && (c.endsWith(".js") || isExecutableFile(c))) return c;
49999
50124
  }
50000
50125
  return null;
50001
50126
  }
50002
- const nm = join18(prefix, "lib", "node_modules");
50003
- const scoped = join18(nm, "@anthropic-ai");
50127
+ const nm = join19(prefix, "lib", "node_modules");
50128
+ const scoped = join19(nm, "@anthropic-ai");
50004
50129
  try {
50005
50130
  if (existsSync24(scoped)) {
50006
50131
  const names = readdirSync8(scoped).filter((n) => n.startsWith("claude-agent-sdk-"));
50007
50132
  for (const n of names) {
50008
50133
  const ext = process.platform === "win32" ? ".exe" : "";
50009
- const bin = join18(scoped, n, `claude${ext}`);
50134
+ const bin = join19(scoped, n, `claude${ext}`);
50010
50135
  if (existsSync24(bin)) return bin;
50011
50136
  }
50012
50137
  }
50013
50138
  } catch {
50014
50139
  }
50015
- const direct = join18(
50140
+ const direct = join19(
50016
50141
  nm,
50017
50142
  ...claudePlatformPackageName().split("/"),
50018
50143
  process.platform === "win32" ? "claude.exe" : "claude"
@@ -50067,7 +50192,7 @@ async function installManagedFromOfficialNpm(opts) {
50067
50192
  }
50068
50193
  function readInstalledVersion(prefix, harnessId) {
50069
50194
  try {
50070
- const pkgPath = harnessId === "claude" ? join18(prefix, "lib", "node_modules", "@anthropic-ai", "claude-agent-sdk", "package.json") : join18(prefix, "lib", "node_modules", "@openai", "codex", "package.json");
50195
+ const pkgPath = harnessId === "claude" ? join19(prefix, "lib", "node_modules", "@anthropic-ai", "claude-agent-sdk", "package.json") : join19(prefix, "lib", "node_modules", "@openai", "codex", "package.json");
50071
50196
  if (!existsSync24(pkgPath)) return null;
50072
50197
  const raw = JSON.parse(readFileSync14(pkgPath, "utf8"));
50073
50198
  return raw.version?.trim() || null;
@@ -57259,7 +57384,7 @@ var require_dist = __commonJS({
57259
57384
  });
57260
57385
 
57261
57386
  // src/cli.ts
57262
- import { homedir as homedir7 } from "node:os";
57387
+ import { homedir as homedir9 } from "node:os";
57263
57388
  import { resolve as resolve12 } from "node:path";
57264
57389
 
57265
57390
  // src/config.ts
@@ -57301,8 +57426,8 @@ import { fileURLToPath } from "node:url";
57301
57426
  function resolveCliReleaseVersion() {
57302
57427
  const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
57303
57428
  if (fromEnv) return fromEnv;
57304
- if ("0.50.5-alpha".trim()) {
57305
- return "0.50.5-alpha".trim();
57429
+ if ("0.50.7-alpha".trim()) {
57430
+ return "0.50.7-alpha".trim();
57306
57431
  }
57307
57432
  const fromDist = readDistManifestVersion();
57308
57433
  if (fromDist) return fromDist;
@@ -58918,7 +59043,7 @@ import {
58918
59043
  writeFileSync as writeFileSync9
58919
59044
  } from "node:fs";
58920
59045
  import { createHash as createHash4, randomBytes as randomBytes3 } from "node:crypto";
58921
- import { dirname as dirname10, join as join17, relative, resolve as resolve4, sep as sep3 } from "node:path";
59046
+ import { dirname as dirname11, join as join18, relative, resolve as resolve4, sep as sep3 } from "node:path";
58922
59047
  import { arch as osArch, platform as osPlatform } from "node:os";
58923
59048
  var MANAGED_PAYLOAD_BASENAME = "payload.bin";
58924
59049
  var MANAGED_META_BASENAME = "artifact.json";
@@ -59037,7 +59162,7 @@ function loadHarnessReleaseManifest(nodeHome) {
59037
59162
  }
59038
59163
  return parseHarnessReleaseManifest(JSON.parse(readFileSync13(fromEnv, "utf8")));
59039
59164
  }
59040
- const local = join17(nodeHome, "release-manifest.json");
59165
+ const local = join18(nodeHome, "release-manifest.json");
59041
59166
  if (existsSync23(local)) {
59042
59167
  return parseHarnessReleaseManifest(JSON.parse(readFileSync13(local, "utf8")));
59043
59168
  }
@@ -59125,8 +59250,8 @@ async function installManagedArtifactFromFile(opts) {
59125
59250
  opts.harnessId,
59126
59251
  pin.artifactVersion
59127
59252
  );
59128
- const finalFile = join17(destDir, MANAGED_PAYLOAD_BASENAME);
59129
- const metaPath = join17(destDir, MANAGED_META_BASENAME);
59253
+ const finalFile = join18(destDir, MANAGED_PAYLOAD_BASENAME);
59254
+ const metaPath = join18(destDir, MANAGED_META_BASENAME);
59130
59255
  assertStrictChild(finalFile, destDir, "payload path");
59131
59256
  assertStrictChild(metaPath, destDir, "meta path");
59132
59257
  const metaBody = JSON.stringify(
@@ -59165,15 +59290,15 @@ async function installManagedArtifactFromFile(opts) {
59165
59290
  );
59166
59291
  }
59167
59292
  } else {
59168
- const harnessRoot2 = dirname10(destDir);
59293
+ const harnessRoot2 = dirname11(destDir);
59169
59294
  mkdirSync11(harnessRoot2, { recursive: true });
59170
59295
  assertPathInside(destDir, harnessRoot2, "version dir");
59171
59296
  const stagingDir = mkdtempSync(
59172
- join17(harnessRoot2, `.staging-${opts.harnessId}-${randomBytes3(8).toString("hex")}-`)
59297
+ join18(harnessRoot2, `.staging-${opts.harnessId}-${randomBytes3(8).toString("hex")}-`)
59173
59298
  );
59174
59299
  assertPathInside(stagingDir, harnessRoot2, "staging dir");
59175
- const stagingFile = join17(stagingDir, MANAGED_PAYLOAD_BASENAME);
59176
- const stagingMeta = join17(stagingDir, MANAGED_META_BASENAME);
59300
+ const stagingFile = join18(stagingDir, MANAGED_PAYLOAD_BASENAME);
59301
+ const stagingMeta = join18(stagingDir, MANAGED_META_BASENAME);
59177
59302
  try {
59178
59303
  copyFileSync(opts.artifactPath, stagingFile);
59179
59304
  const stagedDigest = await sha256File(stagingFile);
@@ -59209,7 +59334,7 @@ async function installManagedArtifactFromFile(opts) {
59209
59334
  if (finalDigest !== art.digestSha256) {
59210
59335
  throw new Error(`final payload digest mismatch for ${opts.harnessId}`);
59211
59336
  }
59212
- const harnessRoot = join17(
59337
+ const harnessRoot = join18(
59213
59338
  releasesRoot(opts.nodeHome),
59214
59339
  opts.manifest.cliVersion,
59215
59340
  "harnesses",
@@ -59217,8 +59342,8 @@ async function installManagedArtifactFromFile(opts) {
59217
59342
  );
59218
59343
  assertPathInside(harnessRoot, releasesRoot(opts.nodeHome), "harness root");
59219
59344
  mkdirSync11(harnessRoot, { recursive: true });
59220
- const currentPath = join17(harnessRoot, MANAGED_CURRENT_BASENAME);
59221
- const currentTmp = join17(
59345
+ const currentPath = join18(harnessRoot, MANAGED_CURRENT_BASENAME);
59346
+ const currentTmp = join18(
59222
59347
  harnessRoot,
59223
59348
  `.${MANAGED_CURRENT_BASENAME}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`
59224
59349
  );
@@ -59257,8 +59382,8 @@ async function installManagedArtifactFromFile(opts) {
59257
59382
  async function replacePayloadAtomically(opts) {
59258
59383
  mkdirSync11(opts.destDir, { recursive: true });
59259
59384
  const nonce = randomBytes3(8).toString("hex");
59260
- const payloadTmp = join17(opts.destDir, `.${MANAGED_PAYLOAD_BASENAME}.${nonce}.tmp`);
59261
- const metaTmp = join17(opts.destDir, `.${MANAGED_META_BASENAME}.${nonce}.tmp`);
59385
+ const payloadTmp = join18(opts.destDir, `.${MANAGED_PAYLOAD_BASENAME}.${nonce}.tmp`);
59386
+ const metaTmp = join18(opts.destDir, `.${MANAGED_META_BASENAME}.${nonce}.tmp`);
59262
59387
  assertStrictChild(payloadTmp, opts.destDir, "payload temp");
59263
59388
  assertStrictChild(metaTmp, opts.destDir, "meta temp");
59264
59389
  try {
@@ -59566,7 +59691,7 @@ function looksLikeSecretArg(value) {
59566
59691
  // ../../packages/shared/src/git-clone.ts
59567
59692
  import { execFile as execFile2 } from "node:child_process";
59568
59693
  import { existsSync as existsSync26, mkdirSync as mkdirSync13 } from "node:fs";
59569
- import { isAbsolute as isAbsolute3, join as join19, resolve as resolve7 } from "node:path";
59694
+ import { isAbsolute as isAbsolute3, join as join20, resolve as resolve7 } from "node:path";
59570
59695
 
59571
59696
  // ../../packages/shared/src/git-remote.ts
59572
59697
  function repoNameFromGitUrl(url2) {
@@ -59631,7 +59756,7 @@ function resolveCloneDestination(input) {
59631
59756
  if (name.includes("/") || name.includes("\\") || name === "." || name === "..") {
59632
59757
  throw invalid(`invalid folder name: ${name}`);
59633
59758
  }
59634
- return { path: join19(resolve7(parent), name), name };
59759
+ return { path: join20(resolve7(parent), name), name };
59635
59760
  }
59636
59761
  async function cloneRepository(input) {
59637
59762
  const destination = resolveCloneDestination(input);
@@ -59681,7 +59806,7 @@ async function cloneRepository(input) {
59681
59806
  init_resolve_service();
59682
59807
  import { existsSync as existsSync27, mkdirSync as mkdirSync14, readdirSync as readdirSync9, statSync as statSync8 } from "node:fs";
59683
59808
  import { join as pathJoin, resolve as pathResolve } from "node:path";
59684
- import { arch, cpus, freemem, homedir as homedir4, hostname as hostname4, platform, totalmem, uptime } from "node:os";
59809
+ import { arch, cpus, freemem, homedir as homedir6, hostname as hostname4, platform, totalmem, uptime } from "node:os";
59685
59810
 
59686
59811
  // src/rpc/resource-handlers.ts
59687
59812
  init_environment();
@@ -62286,9 +62411,9 @@ function handleProjectGet(payload, ctx) {
62286
62411
  function expandHostPath(path) {
62287
62412
  const trimmed = path.trim();
62288
62413
  if (!trimmed) return trimmed;
62289
- if (trimmed === "~") return homedir4();
62414
+ if (trimmed === "~") return homedir6();
62290
62415
  if (trimmed.startsWith("~/") || trimmed.startsWith("~\\")) {
62291
- return pathResolve(pathJoin(homedir4(), trimmed.slice(2)));
62416
+ return pathResolve(pathJoin(homedir6(), trimmed.slice(2)));
62292
62417
  }
62293
62418
  return pathResolve(trimmed);
62294
62419
  }
@@ -62571,10 +62696,12 @@ function handleWorkspaceTailWatchStart(payload, ctx) {
62571
62696
  const p2 = asRecord14(payload);
62572
62697
  try {
62573
62698
  const offset = typeof p2.offset === "number" ? p2.offset : void 0;
62699
+ const absolutePath = typeof p2.absolutePath === "string" ? p2.absolutePath : void 0;
62574
62700
  return {
62575
62701
  result: ctx.workspaceTailWatch.start(String(p2.projectId ?? ""), String(p2.relativePath ?? ""), {
62576
62702
  offset,
62577
- ownerClientId: ctx.client.clientSessionId
62703
+ ownerClientId: ctx.client.clientSessionId,
62704
+ ...absolutePath ? { absolutePath } : {}
62578
62705
  })
62579
62706
  };
62580
62707
  } catch (err) {
@@ -63062,8 +63189,33 @@ function handleSessionList(payload, ctx) {
63062
63189
  const denied = requireScopes6(ctx.client, OPERATION_SCOPES.readSession);
63063
63190
  if (denied) return denied;
63064
63191
  const p2 = asRecord14(payload);
63192
+ const projectId = typeof p2.projectId === "string" ? p2.projectId : void 0;
63193
+ if (typeof p2.limit !== "number" || !Number.isFinite(p2.limit)) {
63194
+ return { error: { code: "invalid_argument", message: "session.list requires finite limit" } };
63195
+ }
63196
+ if (typeof p2.offset !== "number" || !Number.isFinite(p2.offset)) {
63197
+ return { error: { code: "invalid_argument", message: "session.list requires finite offset" } };
63198
+ }
63199
+ const limit = Math.min(Math.max(Math.floor(p2.limit), 0), 500);
63200
+ const offset = Math.max(Math.floor(p2.offset), 0);
63201
+ const rows = ctx.sessions.list(projectId, { limit, offset });
63065
63202
  return {
63066
- result: ctx.sessions.list(typeof p2.projectId === "string" ? p2.projectId : void 0)
63203
+ result: rows.map((s2) => ({
63204
+ sessionId: s2.sessionId,
63205
+ projectId: s2.projectId,
63206
+ harnessId: s2.harnessId,
63207
+ providerId: s2.providerId,
63208
+ title: s2.title,
63209
+ status: s2.status,
63210
+ messageCount: Array.isArray(s2.transcript) ? s2.transcript.length : 0,
63211
+ cwd: s2.cwd,
63212
+ createdAt: s2.createdAt,
63213
+ updatedAt: s2.updatedAt,
63214
+ isPinned: s2.isPinned,
63215
+ isHidden: s2.isHidden,
63216
+ isAutomation: s2.isAutomation === true,
63217
+ automationId: s2.automationId ?? null
63218
+ }))
63067
63219
  };
63068
63220
  }
63069
63221
  function handleSessionAcquireControl(payload, ctx) {
@@ -64311,7 +64463,7 @@ import {
64311
64463
  unlinkSync,
64312
64464
  writeFileSync as writeFileSync10
64313
64465
  } from "node:fs";
64314
- import { dirname as dirname11, join as join20, relative as relative2 } from "node:path";
64466
+ import { dirname as dirname12, join as join21, relative as relative2 } from "node:path";
64315
64467
  import { createHash as createHash6 } from "node:crypto";
64316
64468
  function normalizeRel(path) {
64317
64469
  return path.replace(/\\/g, "/").replace(/\/+$/, "") || ".";
@@ -64367,7 +64519,7 @@ var WorkspaceFsService = class {
64367
64519
  this.projects.touch(projectId);
64368
64520
  const ents = readdirSync10(resolved.absolutePath, { withFileTypes: true });
64369
64521
  return ents.map((ent) => {
64370
- const abs = join20(resolved.absolutePath, ent.name);
64522
+ const abs = join21(resolved.absolutePath, ent.name);
64371
64523
  let size;
64372
64524
  let mtimeMs;
64373
64525
  try {
@@ -64444,7 +64596,7 @@ var WorkspaceFsService = class {
64444
64596
  throw Object.assign(new Error("content hash mismatch"), { code: "conflict" });
64445
64597
  }
64446
64598
  }
64447
- mkdirSync15(dirname11(resolved.absolutePath), { recursive: true });
64599
+ mkdirSync15(dirname12(resolved.absolutePath), { recursive: true });
64448
64600
  const data = typeof content === "string" ? Buffer.from(content, "utf8") : Buffer.from(content);
64449
64601
  if (data.length > MAX_READ_BYTES) {
64450
64602
  throw Object.assign(new Error("write payload too large"), { code: "invalid_argument" });
@@ -64520,7 +64672,7 @@ var WorkspaceFsService = class {
64520
64672
  for (const ent of ents) {
64521
64673
  if (hits.length >= MAX_SEARCH_HITS) return;
64522
64674
  if (ent.name === ".git" || ent.name === "node_modules") continue;
64523
- const abs = join20(dir, ent.name);
64675
+ const abs = join21(dir, ent.name);
64524
64676
  const rel = relative2(root, abs).split("\\").join("/");
64525
64677
  const check2 = resolveProjectPath(root, rel);
64526
64678
  if (!check2.ok) continue;
@@ -64653,7 +64805,7 @@ var WorkspaceFsService = class {
64653
64805
  code: "conflict"
64654
64806
  });
64655
64807
  }
64656
- mkdirSync15(dirname11(to.absolutePath), { recursive: true });
64808
+ mkdirSync15(dirname12(to.absolutePath), { recursive: true });
64657
64809
  renameSync3(from.absolutePath, to.absolutePath);
64658
64810
  this.projects.touch(projectId);
64659
64811
  return { from: fromN, to: toN };
@@ -64679,7 +64831,7 @@ function hashFileBounded(absolutePath, size) {
64679
64831
 
64680
64832
  // src/workspace/git-service.ts
64681
64833
  import { existsSync as existsSync31, mkdirSync as mkdirSync16, realpathSync as realpathSync5, rmSync as rmSync4, writeFileSync as writeFileSync11 } from "node:fs";
64682
- import { join as join22, resolve as resolve10 } from "node:path";
64834
+ import { join as join23, resolve as resolve10 } from "node:path";
64683
64835
  import { tmpdir as tmpdir2 } from "node:os";
64684
64836
  import { randomUUID as randomUUID8 } from "node:crypto";
64685
64837
 
@@ -64874,19 +65026,19 @@ function gitRunSync(folderPath, args, env) {
64874
65026
  }
64875
65027
 
64876
65028
  // ../../packages/runtime/src/git/worktree-plan.ts
64877
- import { basename as basename3, dirname as dirname12, join as join21, resolve as resolve9, sep as sep4 } from "node:path";
64878
- import { homedir as homedir5 } from "node:os";
65029
+ import { basename as basename3, dirname as dirname13, join as join22, resolve as resolve9, sep as sep4 } from "node:path";
65030
+ import { homedir as homedir7 } from "node:os";
64879
65031
  function resolveMainDirFromCommonDir(folderPath, gitCommonDir) {
64880
65032
  const repoRoot = resolve9(folderPath, gitCommonDir.trim());
64881
- return repoRoot.endsWith(`${sep4}.git`) || repoRoot.endsWith("/.git") ? dirname12(repoRoot) : repoRoot;
65033
+ return repoRoot.endsWith(`${sep4}.git`) || repoRoot.endsWith("/.git") ? dirname13(repoRoot) : repoRoot;
64882
65034
  }
64883
65035
  function planNewWorktreePaths(input) {
64884
- const home = input.homeDir ?? homedir5();
65036
+ const home = input.homeDir ?? homedir7();
64885
65037
  const repoName = basename3(input.mainDir);
64886
65038
  const epoch = Math.floor((input.nowMs ?? Date.now()) / 1e3).toString(36);
64887
65039
  const short = input.shortHash.slice(0, 7);
64888
- const wtDir = join21(home, ".worktrees", repoName);
64889
- const wtPath = join21(wtDir, `${epoch}-${short}`);
65040
+ const wtDir = join22(home, ".worktrees", repoName);
65041
+ const wtPath = join22(wtDir, `${epoch}-${short}`);
64890
65042
  return { wtDir, wtPath };
64891
65043
  }
64892
65044
  function worktreeAddArgs(mode, wtPath, baseRef, branchName) {
@@ -64978,7 +65130,7 @@ var WorkspaceGitService = class {
64978
65130
  * --ignored walks the whole tree of ignored paths and dominates remote latency.
64979
65131
  */
64980
65132
  statusForCwd(cwd) {
64981
- if (!existsSync31(join22(cwd, ".git")) && !isGitWorktree(cwd)) {
65133
+ if (!existsSync31(join23(cwd, ".git")) && !isGitWorktree(cwd)) {
64982
65134
  return { isRepo: false, branch: null, dirty: false, ahead: 0, behind: 0, porcelain: "" };
64983
65135
  }
64984
65136
  try {
@@ -65233,7 +65385,7 @@ var WorkspaceGitService = class {
65233
65385
  const mainStatus = git(diff.mainDir, ["status", "--porcelain"]).trim();
65234
65386
  if (mainStatus) return { ok: false, reason: "main-dirty" };
65235
65387
  const patch = git(diff.worktreePath, ["diff", "--binary", diff.base, diff.tree]);
65236
- const patchFile = join22(tmpdir2(), `s1-handoff-${randomUUID8()}.patch`);
65388
+ const patchFile = join23(tmpdir2(), `s1-handoff-${randomUUID8()}.patch`);
65237
65389
  writeFileSync11(patchFile, `${patch}
65238
65390
  `);
65239
65391
  if (git(diff.mainDir, ["status", "--porcelain"]).trim()) {
@@ -65295,7 +65447,7 @@ var WorkspaceGitService = class {
65295
65447
  };
65296
65448
  }
65297
65449
  writeWorkingTree(worktreePath) {
65298
- const tmpIndex = join22(tmpdir2(), `s1-handoff-${randomUUID8()}.index`);
65450
+ const tmpIndex = join23(tmpdir2(), `s1-handoff-${randomUUID8()}.index`);
65299
65451
  const env = { GIT_INDEX_FILE: tmpIndex };
65300
65452
  try {
65301
65453
  git(worktreePath, ["read-tree", "HEAD"], env);
@@ -66503,7 +66655,7 @@ var CollaborationService = class {
66503
66655
 
66504
66656
  // src/provider/secret-crypto.ts
66505
66657
  import { existsSync as existsSync33, mkdirSync as mkdirSync17, readFileSync as readFileSync16, writeFileSync as writeFileSync12, chmodSync as chmodSync2 } from "node:fs";
66506
- import { dirname as dirname13 } from "node:path";
66658
+ import { dirname as dirname14 } from "node:path";
66507
66659
  import { createCipheriv, createDecipheriv, randomBytes as randomBytes5 } from "node:crypto";
66508
66660
  var ENC_PREFIX = "enc:v1:";
66509
66661
  var KEY_BYTES = 32;
@@ -66515,7 +66667,7 @@ function ensureKeyFile(keyPath) {
66515
66667
  const raw = readFileSync16(keyPath);
66516
66668
  if (raw.length === KEY_BYTES) return raw;
66517
66669
  }
66518
- mkdirSync17(dirname13(keyPath), { recursive: true, mode: 448 });
66670
+ mkdirSync17(dirname14(keyPath), { recursive: true, mode: 448 });
66519
66671
  const key = randomBytes5(KEY_BYTES);
66520
66672
  writeFileSync12(keyPath, key, { mode: 384 });
66521
66673
  try {
@@ -66659,7 +66811,7 @@ var WorkspaceWatchService = class {
66659
66811
 
66660
66812
  // src/workspace/tail-watch-service.ts
66661
66813
  init_fs();
66662
- import { existsSync as existsSync34, fstatSync as fstatSync2, openSync as openSync2, closeSync as closeSync2, statSync as statSync12 } from "node:fs";
66814
+ import { existsSync as existsSync34, fstatSync as fstatSync2, openSync as openSync2, closeSync as closeSync2, statSync as statSync12, readSync as readSync2, realpathSync as realpathSync6 } from "node:fs";
66663
66815
  var MAX_POLL_BYTES = 10 * 1024 * 1024;
66664
66816
  var WorkspaceTailWatchService = class {
66665
66817
  constructor(projects, fs) {
@@ -66670,16 +66822,41 @@ var WorkspaceTailWatchService = class {
66670
66822
  start(projectId, relativePath, opts) {
66671
66823
  const project = this.projects.get(projectId);
66672
66824
  if (!project) throw Object.assign(new Error("project not found"), { code: "not_found" });
66673
- const rel = normalizeProjectRelativePath(relativePath || "");
66674
- if (!isToolOutputRelativePath(rel)) {
66675
- throw Object.assign(
66676
- new Error("tail watch is limited to project-relative paths under temp/"),
66677
- { code: "invalid_argument" }
66678
- );
66679
- }
66680
- const resolved = resolveProjectPath(project.path, rel);
66681
- if (!resolved.ok) {
66682
- throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
66825
+ const absolutePath = typeof opts?.absolutePath === "string" && opts.absolutePath ? opts.absolutePath : void 0;
66826
+ let rel = "";
66827
+ let resolvedAbs = "";
66828
+ if (absolutePath) {
66829
+ if (!assertAgentTranscriptAbsolutePath(absolutePath)) {
66830
+ throw Object.assign(
66831
+ new Error("absolute tail watch is limited to agent transcript roots (~/.grok/sessions, ~/.claude/projects)"),
66832
+ { code: "invalid_argument" }
66833
+ );
66834
+ }
66835
+ try {
66836
+ resolvedAbs = existsSync34(absolutePath) ? realpathSync6(absolutePath) : absolutePath;
66837
+ } catch {
66838
+ resolvedAbs = absolutePath;
66839
+ }
66840
+ if (!assertAgentTranscriptAbsolutePath(resolvedAbs)) {
66841
+ throw Object.assign(
66842
+ new Error("absolute tail watch resolved outside agent transcript roots"),
66843
+ { code: "invalid_argument" }
66844
+ );
66845
+ }
66846
+ rel = absolutePath;
66847
+ } else {
66848
+ rel = normalizeProjectRelativePath(relativePath || "");
66849
+ if (!isToolOutputRelativePath(rel)) {
66850
+ throw Object.assign(
66851
+ new Error("tail watch is limited to project-relative paths under temp/"),
66852
+ { code: "invalid_argument" }
66853
+ );
66854
+ }
66855
+ const resolved = resolveProjectPath(project.path, rel);
66856
+ if (!resolved.ok) {
66857
+ throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
66858
+ }
66859
+ resolvedAbs = resolved.absolutePath;
66683
66860
  }
66684
66861
  let offset = opts?.offset ?? 0;
66685
66862
  if (!Number.isSafeInteger(offset) || offset < 0) {
@@ -66687,9 +66864,9 @@ var WorkspaceTailWatchService = class {
66687
66864
  code: "invalid_argument"
66688
66865
  });
66689
66866
  }
66690
- if (existsSync34(resolved.absolutePath)) {
66867
+ if (existsSync34(resolvedAbs)) {
66691
66868
  try {
66692
- const st = statSync12(resolved.absolutePath);
66869
+ const st = statSync12(resolvedAbs);
66693
66870
  if (!st.isFile()) {
66694
66871
  throw Object.assign(new Error("not a file"), { code: "invalid_argument" });
66695
66872
  }
@@ -66702,12 +66879,19 @@ var WorkspaceTailWatchService = class {
66702
66879
  const watchId = crypto.randomUUID();
66703
66880
  this.entries.set(watchId, {
66704
66881
  projectId,
66705
- relativePath: rel,
66882
+ relativePath: absolutePath ? "" : rel,
66883
+ // Store resolved path so poll opens the verified target, not a swapped symlink.
66884
+ ...absolutePath ? { absolutePath: resolvedAbs } : {},
66706
66885
  offset,
66707
66886
  owner: opts?.ownerClientId ?? ""
66708
66887
  });
66709
66888
  this.projects.touch(projectId);
66710
- return { watchId, offset, relativePath: rel };
66889
+ return {
66890
+ watchId,
66891
+ offset,
66892
+ relativePath: absolutePath ? "" : rel,
66893
+ ...absolutePath ? { absolutePath: resolvedAbs } : {}
66894
+ };
66711
66895
  }
66712
66896
  poll(watchId, ownerClientId) {
66713
66897
  const entry = this.entries.get(watchId);
@@ -66718,11 +66902,20 @@ var WorkspaceTailWatchService = class {
66718
66902
  if (!project) {
66719
66903
  throw Object.assign(new Error("project not found"), { code: "not_found" });
66720
66904
  }
66721
- const resolved = resolveProjectPath(project.path, entry.relativePath);
66722
- if (!resolved.ok) {
66723
- throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
66905
+ let absolutePath = entry.absolutePath;
66906
+ if (!absolutePath) {
66907
+ const resolved = resolveProjectPath(project.path, entry.relativePath);
66908
+ if (!resolved.ok) {
66909
+ throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
66910
+ }
66911
+ absolutePath = resolved.absolutePath;
66912
+ } else if (!assertAgentTranscriptAbsolutePath(absolutePath)) {
66913
+ throw Object.assign(
66914
+ new Error("absolute tail watch resolved outside agent transcript roots"),
66915
+ { code: "invalid_argument" }
66916
+ );
66724
66917
  }
66725
- if (!existsSync34(resolved.absolutePath)) {
66918
+ if (!existsSync34(absolutePath)) {
66726
66919
  return {
66727
66920
  content: "",
66728
66921
  encoding: "base64",
@@ -66733,7 +66926,7 @@ var WorkspaceTailWatchService = class {
66733
66926
  }
66734
66927
  let size = 0;
66735
66928
  try {
66736
- const fd = openSync2(resolved.absolutePath, "r");
66929
+ const fd = openSync2(absolutePath, "r");
66737
66930
  try {
66738
66931
  size = fstatSync2(fd).size;
66739
66932
  } finally {
@@ -66755,14 +66948,27 @@ var WorkspaceTailWatchService = class {
66755
66948
  return { content: "", encoding: "base64", offset: entry.offset, size };
66756
66949
  }
66757
66950
  const toRead = Math.min(MAX_POLL_BYTES, size - entry.offset);
66758
- const slice = this.fs.readFile(entry.projectId, entry.relativePath, {
66759
- offset: entry.offset,
66760
- limit: toRead
66761
- });
66951
+ let contentB64;
66952
+ if (entry.absolutePath) {
66953
+ const buf = Buffer.alloc(toRead);
66954
+ const fd = openSync2(absolutePath, "r");
66955
+ try {
66956
+ const n = readSync2(fd, buf, 0, toRead, entry.offset);
66957
+ contentB64 = buf.subarray(0, n).toString("base64");
66958
+ } finally {
66959
+ closeSync2(fd);
66960
+ }
66961
+ } else {
66962
+ const slice = this.fs.readFile(entry.projectId, entry.relativePath, {
66963
+ offset: entry.offset,
66964
+ limit: toRead
66965
+ });
66966
+ contentB64 = slice.content;
66967
+ }
66762
66968
  entry.offset = entry.offset + toRead;
66763
66969
  this.projects.touch(entry.projectId);
66764
66970
  return {
66765
- content: slice.content,
66971
+ content: contentB64,
66766
66972
  encoding: "base64",
66767
66973
  offset: entry.offset,
66768
66974
  size
@@ -79693,7 +79899,7 @@ function readRuntimeStatus(nodeHome) {
79693
79899
  // src/systemd/install.ts
79694
79900
  import { spawnSync as spawnSync2 } from "node:child_process";
79695
79901
  import { chmodSync as chmodSync3, existsSync as existsSync36, mkdirSync as mkdirSync18, unlinkSync as unlinkSync2, writeFileSync as writeFileSync14 } from "node:fs";
79696
- import { dirname as dirname14 } from "node:path";
79902
+ import { dirname as dirname15 } from "node:path";
79697
79903
 
79698
79904
  // src/systemd/unit.ts
79699
79905
  function renderSystemdUserUnit(opts) {
@@ -79750,7 +79956,7 @@ function checkLinger(user) {
79750
79956
  return { enabled: null, raw };
79751
79957
  }
79752
79958
  function writeSystemdUserUnit(opts, unitPath = systemdUserUnitPath()) {
79753
- mkdirSync18(dirname14(unitPath), { recursive: true });
79959
+ mkdirSync18(dirname15(unitPath), { recursive: true });
79754
79960
  writeFileSync14(unitPath, renderSystemdUserUnit(opts), { encoding: "utf8", mode: 420 });
79755
79961
  try {
79756
79962
  chmodSync3(unitPath, 420);
@@ -79827,9 +80033,9 @@ function systemdUserStatus() {
79827
80033
 
79828
80034
  // src/session/harness-cli.ts
79829
80035
  init_environment();
79830
- import { accessSync as accessSync2, constants as constants2, existsSync as existsSync37, realpathSync as realpathSync6, statSync as statSync13 } from "node:fs";
80036
+ import { accessSync as accessSync2, constants as constants2, existsSync as existsSync37, realpathSync as realpathSync7, statSync as statSync13 } from "node:fs";
79831
80037
  import { isAbsolute as isAbsolute4, resolve as resolve11 } from "node:path";
79832
- import { homedir as homedir6 } from "node:os";
80038
+ import { homedir as homedir8 } from "node:os";
79833
80039
  var DEFERRED_FLAGS = /* @__PURE__ */ new Set([
79834
80040
  "--env-file",
79835
80041
  "--server-password-stdin",
@@ -80345,7 +80551,7 @@ function resolveExternalCommand2(explicit, pathCandidates) {
80345
80551
  }
80346
80552
  const pathEnv = process.env.PATH || "";
80347
80553
  const dirs = pathEnv.split(":").filter(Boolean);
80348
- const home = process.env.HOME || homedir6();
80554
+ const home = process.env.HOME || homedir8();
80349
80555
  const extra = [
80350
80556
  `${home}/.local/bin`,
80351
80557
  `${home}/.npm-global/bin`,
@@ -80376,7 +80582,7 @@ function isUsableExecutable(path) {
80376
80582
  return null;
80377
80583
  }
80378
80584
  try {
80379
- return realpathSync6(path);
80585
+ return realpathSync7(path);
80380
80586
  } catch {
80381
80587
  return path;
80382
80588
  }
@@ -80744,7 +80950,7 @@ async function main() {
80744
80950
  const result = installSystemdUserService({
80745
80951
  execStart: `${process.execPath} ${execStart}`,
80746
80952
  nodeHome,
80747
- home: process.env.HOME || homedir7(),
80953
+ home: process.env.HOME || homedir9(),
80748
80954
  bindHost: host,
80749
80955
  bindPort: port
80750
80956
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-one/cli",
3
- "version": "0.50.5-alpha",
3
+ "version": "0.50.7-alpha",
4
4
  "description": "SuperOne headless node CLI — remote execution environment (RPC, workspaces, sessions).",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",