lody 0.80.0 → 0.81.0

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/index.js CHANGED
@@ -42,6 +42,7 @@ import require$$0$9 from "net";
42
42
  import require$$4$2 from "tls";
43
43
  import require$$7$2, { fileURLToPath as fileURLToPath$1, pathToFileURL as pathToFileURL$1 } from "url";
44
44
  import { i as imports, _ as __wbg_set_wasm$1, r as rawWasm, L as LoroDoc, E as EphemeralStoreWasm, U as UndoManager, c as callPendingEvents$3, a as LoroTree, b as LoroText, d as LoroMovableList, e as LoroList, f as LoroMap, V as VersionVector, g as __vite__initWasm, h as decodeImportBlobMeta, __tla as __tla_0 } from "./chunks/loro_wasm_bg-BPNKba8n.js";
45
+ import { D as DEEPSEEK_HARNESS_PERMISSION_MODES, a as DEEPSEEK_HARNESS_AGENT_PRESETS, b as DEEPSEEK_HARNESS_MODELS, c as DEEPSEEK_HARNESS_REASONING_OPTIONS, A as ACP_EXTENSION_DSH_CAPABILITY_SOURCE_VERSION, d as createDeepSeekHarnessCordisConfig, e as ACP_EXTENSION_DSH_VERSION, f as ACP_EXTENSION_DSH_PROFILE_REVISION, g as ACP_EXTENSION_DSH_QUERY_PATH_ENV, h as ACP_EXTENSION_DSH_SESSION_ROOT_ENV, i as DEEPSEEK_HARNESS_NPX_PACKAGES, j as DEEPSEEK_HARNESS_VERSION } from "./chunks/profile-DW2t9oI8.js";
45
46
  import assert from "assert";
46
47
  import * as fs$3 from "fs/promises";
47
48
  import fs__default$3 from "fs/promises";
@@ -61,9 +62,10 @@ import require$$1$6, { fileURLToPath, pathToFileURL } from "node:url";
61
62
  import require$$1$7 from "node:console";
62
63
  import require$$1$8 from "node:dns";
63
64
  import { C as CodeCollabV2OpenTextRequestSchema, a as CodeCollabV2RefreshTextRequestSchema, b as CodeCollabV2SaveTextRequestSchema, c as CodeCollabV2OpenCurrentDiffRequestSchema, d as CodeCollabV2OpenAllChangesDiffRequestSchema, e as CodeCollabV2OpenTurnDiffRequestSchema, f as CodeCollabV2InitDirectoryRequestSchema, g as CodeCollabV2OpenTextOkSchema, h as CodeCollabV2RefreshTextResponseSchema, i as CodeCollabV2SaveTextResponseSchema, j as CodeCollabV2OpenCurrentDiffResponseSchema, k as CodeCollabV2OpenAllChangesDiffResponseSchema, l as CodeCollabV2OpenTurnDiffResponseSchema, m as CodeCollabV2InitDirectoryOkSchema, n as CodeCollabV2LspUnsupportedSchema, o as CodeCollabV2ErrorSchema, p as CodeCollabV2RpcContentEnvelopeSchema, q as deriveCodeCollabV2ContentKeyId, r as CodeCollabV2ErrorCodeSchema, s as CodeCollabV2RpcResponseSchema, t as deriveCodeCollabV2ContentKeyBytes, u as readCodeCollabFileIndexSignalFromFlock, w as writeCodeCollabFileIndexSignalToFlock, v as writeCodeCollabFileIndexToFlock, x as buildCodeCollabFileIndexState, y as CODE_COLLAB_V2_TEXT_LIMITS, z as CODE_COLLAB_V2_ALL_CHANGES_DIFF_LIMITS, A as computeAllChanges, B as codeCollabFileIndexStatesEqual, D as scanGitDirectoryEntries, E as closeDirectoryQuietly } from "./chunks/directory-handle-OPjjCl3O.js";
64
- import { C as ClientSideConnection, P as PROTOCOL_VERSION, p as packageJson, n as ndJsonStream } from "./chunks/package-qnDHmQq4.js";
65
+ import { C as ClientSideConnection, P as PROTOCOL_VERSION, n as ndJsonStream } from "./chunks/acp-CrvzLY5A.js";
65
66
  import { StringDecoder } from "node:string_decoder";
66
67
  import { pipeline, finished } from "node:stream/promises";
68
+ import { p as packageJson } from "./chunks/package-Ce-NgzCA.js";
67
69
  import { r as runtimeManifest } from "./chunks/runtime-manifest-Fr5DEH54.js";
68
70
  import { AsyncLocalStorage as AsyncLocalStorage$1 } from "async_hooks";
69
71
  import { createRequire } from "module";
@@ -4585,6 +4587,16 @@ Upgrade Node, then re-run: npx lody@latest`;
4585
4587
  displayName: "Codex"
4586
4588
  }
4587
4589
  ];
4590
+ const BUILTIN_AGENTS = [
4591
+ ...MANAGED_BUILTIN_RUNTIMES.map(({ agentType, displayName }) => ({
4592
+ agentType,
4593
+ displayName
4594
+ })),
4595
+ {
4596
+ agentType: "deepseek",
4597
+ displayName: "DeepSeek Harness"
4598
+ }
4599
+ ];
4588
4600
  const usesAcpProvidedSessionTitle = (cliType, agentType) => cliType === "builtin" && agentType === "claude";
4589
4601
  const isBuiltinRuntimeOverrides = (value) => {
4590
4602
  if (!value || typeof value !== "object" || Array.isArray(value)) {
@@ -4619,7 +4631,8 @@ Upgrade Node, then re-run: npx lody@latest`;
4619
4631
  const MODEL_THOUGHT_LEVEL_META_KEY = "lodyThoughtLevel";
4620
4632
  const ACP_CAPABILITY_CACHE_VERSION = 4;
4621
4633
  const getAcpCapabilityCacheKey = (configId) => configId;
4622
- const isBuiltinAgentType = (agentType) => MANAGED_BUILTIN_RUNTIMES.some((runtime) => runtime.agentType === agentType);
4634
+ const isBuiltinAgentType = (agentType) => BUILTIN_AGENTS.some((agent2) => agent2.agentType === agentType);
4635
+ const isManagedBuiltinAgentType = (agentType) => MANAGED_BUILTIN_RUNTIMES.some((runtime) => runtime.agentType === agentType);
4623
4636
  const getManagedBuiltinRuntimeByAgentType = (agentType) => MANAGED_BUILTIN_RUNTIMES.find((runtime) => runtime.agentType === agentType);
4624
4637
  const getManagedBuiltinRuntimeByRuntimeName = (runtimeName) => MANAGED_BUILTIN_RUNTIMES.find((runtime) => runtime.runtimeName === runtimeName);
4625
4638
  const CODEX_AUTO_REVIEW_MODE_ID = "agent-auto-review";
@@ -4627,9 +4640,60 @@ Upgrade Node, then re-run: npx lody@latest`;
4627
4640
  kimi: "auto",
4628
4641
  grok: "agent",
4629
4642
  claude: "auto",
4630
- codex: CODEX_AUTO_REVIEW_MODE_ID
4643
+ codex: CODEX_AUTO_REVIEW_MODE_ID,
4644
+ deepseek: "workspace-write"
4631
4645
  };
4632
4646
  const getBuiltinDefaultModeId = (cliType, agentType) => cliType === "builtin" && agentType && isBuiltinAgentType(agentType) ? BUILTIN_DEFAULT_MODE_IDS[agentType] : void 0;
4647
+ [
4648
+ {
4649
+ id: "mode",
4650
+ name: "Permission",
4651
+ description: "Sandbox and approval policy for the session",
4652
+ category: "mode",
4653
+ type: "select",
4654
+ currentValue: BUILTIN_DEFAULT_MODE_IDS.deepseek,
4655
+ options: DEEPSEEK_HARNESS_PERMISSION_MODES.map((mode2) => ({
4656
+ value: mode2.id,
4657
+ name: mode2.name,
4658
+ description: mode2.description
4659
+ }))
4660
+ },
4661
+ {
4662
+ id: "agent_preset",
4663
+ name: "Agent preset",
4664
+ description: "Tools, prompt, and capabilities composed for the session",
4665
+ category: "agent_preset",
4666
+ type: "select",
4667
+ currentValue: "standard",
4668
+ options: DEEPSEEK_HARNESS_AGENT_PRESETS.map((preset) => ({
4669
+ ...preset
4670
+ }))
4671
+ },
4672
+ {
4673
+ id: "model",
4674
+ name: "Model",
4675
+ description: "DeepSeek model used for the session",
4676
+ category: "model",
4677
+ type: "select",
4678
+ currentValue: "deepseek-v4-pro",
4679
+ options: DEEPSEEK_HARNESS_MODELS.map((model) => ({
4680
+ value: model.modelId,
4681
+ name: model.name,
4682
+ description: model.description
4683
+ }))
4684
+ },
4685
+ {
4686
+ id: "reasoning_effort",
4687
+ name: "Reasoning effort",
4688
+ description: "How much reasoning effort the model should use",
4689
+ category: "thought_level",
4690
+ type: "select",
4691
+ currentValue: "max",
4692
+ options: DEEPSEEK_HARNESS_REASONING_OPTIONS.map((option2) => ({
4693
+ ...option2
4694
+ }))
4695
+ }
4696
+ ];
4633
4697
  const CODEX_STATIC_MODES = [
4634
4698
  {
4635
4699
  id: "read-only",
@@ -4910,6 +4974,16 @@ Upgrade Node, then re-run: npx lody@latest`;
4910
4974
  }))
4911
4975
  }
4912
4976
  ];
4977
+ ({
4978
+ deepseek: {
4979
+ modes: DEEPSEEK_HARNESS_PERMISSION_MODES.map((mode2) => ({
4980
+ ...mode2
4981
+ })),
4982
+ models: DEEPSEEK_HARNESS_MODELS.map((model) => ({
4983
+ ...model
4984
+ }))
4985
+ }
4986
+ });
4913
4987
  const leastPermissionModeRank = (value, name2) => {
4914
4988
  const normalized = `${value} ${name2}`.toLowerCase().replace(/[\s_-]+/g, "-");
4915
4989
  if (normalized.includes("read-only") || normalized.includes("readonly")) return 0;
@@ -24772,14 +24846,14 @@ ${peerId}`;
24772
24846
  const getSessionIdFromRoomId = (roomId) => isSessionDocRoomId(roomId) ? roomId.slice(SESSION_DOC_PREFIX.length) : null;
24773
24847
  const isMachineDocRoomId = (roomId) => roomId.startsWith(MACHINE_DOC_PREFIX);
24774
24848
  const name$1 = "@lody/cli-cloud";
24775
- const version$7 = "0.80.0";
24849
+ const version$7 = "0.81.0";
24776
24850
  const type$2 = "module";
24777
24851
  const scripts = {
24778
24852
  "dev": "node dev.mjs",
24779
24853
  "dev:staging": "LODY_ENV=staging NODE_ENV=production node dev.mjs",
24780
24854
  "build": "node build.mjs",
24781
24855
  "prepare:publish": "node prepare-publish.js",
24782
- "test": "node --test pnpm-runner.test.mjs"
24856
+ "test": "node --test pnpm-runner.test.mjs vite-config.test.mjs"
24783
24857
  };
24784
24858
  const devDependencies = {
24785
24859
  "dotenv": "^16.6.1",
@@ -123956,6 +124030,64 @@ ${error2.message}` : execaMessage;
123956
124030
  }
123957
124031
  return sharedManager;
123958
124032
  }
124033
+ const DEEPSEEK_HARNESS_CAPABILITY_SOURCE_VERSION = ACP_EXTENSION_DSH_CAPABILITY_SOURCE_VERSION;
124034
+ const DEEPSEEK_HARNESS_HOME_ENV = "DSH_HOME";
124035
+ const DEEPSEEK_HARNESS_CONFIG_FILE_PREFIX = `cordis-${DEEPSEEK_HARNESS_VERSION.replaceAll(".", "-")}-acp-extension-dsh-${ACP_EXTENSION_DSH_VERSION}-${ACP_EXTENSION_DSH_PROFILE_REVISION}`;
124036
+ function resolveDeepSeekHarnessHome(env2 = process.env, homeDir = homedir()) {
124037
+ const configuredHome = env2[DEEPSEEK_HARNESS_HOME_ENV]?.trim();
124038
+ if (!configuredHome) return resolve$1(homeDir, ".dsh");
124039
+ if (configuredHome === "~") return resolve$1(homeDir);
124040
+ if (configuredHome.startsWith("~/") || configuredHome.startsWith("~\\")) {
124041
+ return resolve$1(homeDir, configuredHome.slice(2));
124042
+ }
124043
+ return resolve$1(configuredHome);
124044
+ }
124045
+ async function publishConfigAtomically(configPath, config2) {
124046
+ const temporaryPath = `${configPath}.${process.pid}.${randomUUID()}.tmp`;
124047
+ await writeFile(temporaryPath, config2, {
124048
+ mode: 384
124049
+ });
124050
+ try {
124051
+ await rename(temporaryPath, configPath);
124052
+ } catch (error2) {
124053
+ if (error2.code !== "EEXIST") throw error2;
124054
+ await rm(temporaryPath, {
124055
+ force: true
124056
+ });
124057
+ }
124058
+ }
124059
+ async function resolveDeepSeekHarnessProcessLaunch(options) {
124060
+ const rootDir = options.rootDir ?? resolveDeepSeekHarnessHome();
124061
+ const sessionsRoot = join$2(rootDir, "sessions");
124062
+ const presetRoot = join$2(dirname$1(options.adapterPath), "deepseek-agent-presets");
124063
+ const config2 = createDeepSeekHarnessCordisConfig(options.adapterPath, presetRoot);
124064
+ const configHash = createHash("sha256").update(config2).digest("hex").slice(0, 12);
124065
+ const configPath = join$2(rootDir, `${DEEPSEEK_HARNESS_CONFIG_FILE_PREFIX}-${configHash}.yml`);
124066
+ await mkdir$1(sessionsRoot, {
124067
+ recursive: true
124068
+ });
124069
+ await publishConfigAtomically(configPath, config2);
124070
+ return {
124071
+ command: "npx",
124072
+ args: [
124073
+ "--prefer-offline",
124074
+ "-y",
124075
+ ...DEEPSEEK_HARNESS_NPX_PACKAGES.flatMap((packageName) => [
124076
+ "--package",
124077
+ `${packageName}@${DEEPSEEK_HARNESS_VERSION}`
124078
+ ]),
124079
+ "dsh-acp-demo",
124080
+ "--config",
124081
+ configPath,
124082
+ ...options.extraArgs ?? []
124083
+ ],
124084
+ env: {
124085
+ [DEEPSEEK_HARNESS_HOME_ENV]: rootDir,
124086
+ [ACP_EXTENSION_DSH_SESSION_ROOT_ENV]: sessionsRoot,
124087
+ [ACP_EXTENSION_DSH_QUERY_PATH_ENV]: join$2(sessionsRoot, "session-query.db")
124088
+ }
124089
+ };
124090
+ }
123959
124091
  const BuiltinACPSetting = {
123960
124092
  claude: {},
123961
124093
  codex: {
@@ -123986,7 +124118,7 @@ ${error2.message}` : execaMessage;
123986
124118
  throw new Error(`Unsupported builtin ACP type: ${agentType}`);
123987
124119
  }
123988
124120
  const builtinType = agentType;
123989
- throw new Error(`Builtin ${builtinType} requires resolveACPProcessLaunchAsync because it may install a managed runtime`);
124121
+ throw new Error(`Builtin ${builtinType} requires resolveACPProcessLaunchAsync because launch preparation is asynchronous`);
123990
124122
  }
123991
124123
  function getAcpCapabilitySourceVersion(input2) {
123992
124124
  if (input2.cliType === "custom") {
@@ -124007,6 +124139,9 @@ ${error2.message}` : execaMessage;
124007
124139
  if (input2.agentType === "grok") {
124008
124140
  return `${BUILTIN_GROK_CAPABILITY_SOURCE_VERSION}${runtimeOverrideSuffix}`;
124009
124141
  }
124142
+ if (input2.agentType === "deepseek") {
124143
+ return DEEPSEEK_HARNESS_CAPABILITY_SOURCE_VERSION;
124144
+ }
124010
124145
  }
124011
124146
  return `builtin:${input2.agentType}:unknown`;
124012
124147
  }
@@ -124152,6 +124287,16 @@ ${error2.message}` : execaMessage;
124152
124287
  if (!isBuiltinAgentType(input2.agentType)) {
124153
124288
  throw new Error(`Unsupported builtin ACP type: ${input2.agentType}`);
124154
124289
  }
124290
+ if (input2.agentType === "deepseek") {
124291
+ const [adapterPath] = resolveCliAdapterEntry("deepseek-acp");
124292
+ return await resolveDeepSeekHarnessProcessLaunch({
124293
+ adapterPath,
124294
+ extraArgs: input2.extraArgs
124295
+ });
124296
+ }
124297
+ if (!isManagedBuiltinAgentType(input2.agentType)) {
124298
+ throw new Error(`Unsupported managed builtin ACP type: ${input2.agentType}`);
124299
+ }
124155
124300
  if (input2.agentType === "kimi") {
124156
124301
  const overridePath2 = trimRuntimeOverride(input2.runtimeOverrides?.kimiPath);
124157
124302
  const kimiPath = overridePath2 ?? await getManagedAgentRuntimeManager().ensureRuntime("kimi-code", {
@@ -124227,7 +124372,7 @@ ${error2.message}` : execaMessage;
124227
124372
  };
124228
124373
  }
124229
124374
  async function resolveBuiltinAuthenticationProcessLaunch(input2) {
124230
- if (input2.cliType !== "builtin" || !isBuiltinAgentType(input2.agentType)) {
124375
+ if (input2.cliType !== "builtin" || !isManagedBuiltinAgentType(input2.agentType)) {
124231
124376
  throw new Error(`Unsupported builtin authentication type: ${input2.agentType}`);
124232
124377
  }
124233
124378
  if (input2.agentType === "kimi") {
@@ -125006,7 +125151,24 @@ ${error2.message}` : execaMessage;
125006
125151
  if (yesIndex === -1) {
125007
125152
  return void 0;
125008
125153
  }
125009
- return parseNpxPackageSpec(args2[yesIndex + 1]);
125154
+ const directSpec = parseNpxPackageSpec(args2[yesIndex + 1]);
125155
+ if (directSpec) {
125156
+ return directSpec;
125157
+ }
125158
+ for (let index = 0; index < args2.length; index += 1) {
125159
+ const arg = args2[index];
125160
+ if (arg === "--package" || arg === "-p") {
125161
+ const packageSpec = parseNpxPackageSpec(args2[index + 1]);
125162
+ if (packageSpec) return packageSpec;
125163
+ index += 1;
125164
+ continue;
125165
+ }
125166
+ if (arg?.startsWith("--package=")) {
125167
+ const packageSpec = parseNpxPackageSpec(arg.slice("--package=".length));
125168
+ if (packageSpec) return packageSpec;
125169
+ }
125170
+ }
125171
+ return void 0;
125010
125172
  }
125011
125173
  const COLD_NPX_INIT_TIMEOUT_MS = 3e5;
125012
125174
  function describeStartupError(error2, stderrTail) {
@@ -125832,7 +125994,7 @@ ${fallbackStderrTail}` : errorMessage2;
125832
125994
  }
125833
125995
  async function probeBuiltinAuthentication(options) {
125834
125996
  options.signal?.throwIfAborted();
125835
- if (options.cliType !== "builtin" || !isBuiltinAgentType(options.agentType)) {
125997
+ if (options.cliType !== "builtin" || !isManagedBuiltinAgentType(options.agentType)) {
125836
125998
  return {
125837
125999
  status: "unknown"
125838
126000
  };
@@ -125952,7 +126114,7 @@ ${fallbackStderrTail}` : errorMessage2;
125952
126114
  spawnProcess;
125953
126115
  resolveLoginShellEnv;
125954
126116
  async authenticate(options) {
125955
- if (options.cliType !== "builtin" || !isBuiltinAgentType(options.agentType)) {
126117
+ if (options.cliType !== "builtin" || !isManagedBuiltinAgentType(options.agentType)) {
125956
126118
  return {
125957
126119
  success: false,
125958
126120
  disposition: "error",
@@ -150517,6 +150679,15 @@ ${entry.text}`).join("\n\n");
150517
150679
  function resolveCreateCurrentSessionId(options, env2 = process.env) {
150518
150680
  return normalizeCliValue(options.currentSessionId) ?? normalizeCliValue(env2.LODY_SESSION_ID);
150519
150681
  }
150682
+ function resolveOpenedBySessionRelation(currentSession) {
150683
+ if (!currentSession) return {};
150684
+ return {
150685
+ openedBySessionId: currentSession.id,
150686
+ ...currentSession.parentSessionId ? {
150687
+ openedByRootSessionId: currentSession.parentSessionId
150688
+ } : {}
150689
+ };
150690
+ }
150520
150691
  function assertSupportedParentDepth(parentSession) {
150521
150692
  if (parentSession?.parentSessionId) {
150522
150693
  throw new Error(`Nested child sessions are not supported. Use the root parent session ${parentSession.parentSessionId}.`);
@@ -150630,9 +150801,7 @@ ${entry.text}`).join("\n\n");
150630
150801
  ...parentSessionId ? {
150631
150802
  parentSessionId
150632
150803
  } : {},
150633
- ...currentSession ? {
150634
- openedBySessionId: currentSession.id
150635
- } : {},
150804
+ ...resolveOpenedBySessionRelation(currentSession),
150636
150805
  ...taskId ? {
150637
150806
  taskId
150638
150807
  } : {}
@@ -150750,7 +150919,7 @@ ${entry.text}`).join("\n\n");
150750
150919
  manager,
150751
150920
  options
150752
150921
  });
150753
- const { targetMachine, agentConfig, project, parentSessionId, openedBySessionId, taskId } = resolved;
150922
+ const { targetMachine, agentConfig, project, parentSessionId, openedBySessionId, openedByRootSessionId, taskId } = resolved;
150754
150923
  const effectiveDispatchConfig = await resolveEffectiveSessionCreateDispatchConfig({
150755
150924
  manager,
150756
150925
  workspaceId: workspace.id,
@@ -150794,6 +150963,9 @@ ${entry.text}`).join("\n\n");
150794
150963
  ...openedBySessionId ? {
150795
150964
  openedBySessionId
150796
150965
  } : {},
150966
+ ...openedByRootSessionId ? {
150967
+ openedByRootSessionId
150968
+ } : {},
150797
150969
  ...taskId ? {
150798
150970
  taskId
150799
150971
  } : {}
@@ -150881,6 +151053,9 @@ ${entry.text}`).join("\n\n");
150881
151053
  ...openedBySessionId ? {
150882
151054
  openedBySessionId
150883
151055
  } : {},
151056
+ ...openedByRootSessionId ? {
151057
+ openedByRootSessionId
151058
+ } : {},
150884
151059
  ...taskId ? {
150885
151060
  taskId
150886
151061
  } : {},
@@ -151204,6 +151379,9 @@ ${entry.text}`).join("\n\n");
151204
151379
  ...session2.openedBySessionId ? {
151205
151380
  openedBySessionId: session2.openedBySessionId
151206
151381
  } : {},
151382
+ ...session2.openedByRootSessionId ? {
151383
+ openedByRootSessionId: session2.openedByRootSessionId
151384
+ } : {},
151207
151385
  ...session2.parentSessionId ? {
151208
151386
  parentSessionId: session2.parentSessionId
151209
151387
  } : {},
@@ -151259,6 +151437,7 @@ ${entry.text}`).join("\n\n");
151259
151437
  console.log(`agentConfigId: ${session2.agentConfigId ?? "-"}`);
151260
151438
  console.log(`parentSessionId: ${session2.parentSessionId ?? "-"}`);
151261
151439
  console.log(`openedBySessionId: ${session2.openedBySessionId ?? "-"}`);
151440
+ console.log(`openedByRootSessionId: ${session2.openedByRootSessionId ?? "-"}`);
151262
151441
  console.log(`repo: ${normalizeCliValue(session2.repoFullName) ?? "-"}`);
151263
151442
  console.log(`baseBranch: ${session2.baseBranch ?? "-"}`);
151264
151443
  console.log(`branch: ${session2.branchName ?? "-"}`);
@@ -151279,6 +151458,7 @@ ${entry.text}`).join("\n\n");
151279
151458
  console.log(`agentConfigId: ${result.agent.agentConfigId ?? "-"}`);
151280
151459
  console.log(`activeTurn: ${result.activeTurn?.assistantTurnId ?? "-"}`);
151281
151460
  console.log(`openedBySessionId: ${result.openedBySessionId ?? "-"}`);
151461
+ console.log(`openedByRootSessionId: ${result.openedByRootSessionId ?? "-"}`);
151282
151462
  console.log(`parentSessionId: ${result.parentSessionId ?? "-"}`);
151283
151463
  }
151284
151464
  async function runSessionCommand(options, action) {
@@ -151374,6 +151554,9 @@ ${entry.text}`).join("\n\n");
151374
151554
  } : {},
151375
151555
  ...result.openedBySessionId ? {
151376
151556
  openedBySessionId: result.openedBySessionId
151557
+ } : {},
151558
+ ...result.openedByRootSessionId ? {
151559
+ openedByRootSessionId: result.openedByRootSessionId
151377
151560
  } : {}
151378
151561
  };
151379
151562
  if (!shouldWaitForCompletion) {
@@ -152013,6 +152196,7 @@ ${entry.text}`).join("\n\n");
152013
152196
  resolveCreateCurrentSessionId,
152014
152197
  resolveLocalProjectBranchForCreate,
152015
152198
  resolveLocalProjectRefOrThrow,
152199
+ resolveOpenedBySessionRelation,
152016
152200
  resolvePromptCandidate,
152017
152201
  resolveRenameArgs,
152018
152202
  resolveSessionCommandRequesterUserId,
@@ -154747,7 +154931,7 @@ ${entry.text}`).join("\n\n");
154747
154931
  }
154748
154932
  directoryEntries.push({
154749
154933
  entry,
154750
- comparisonKey: pathSegmentComparisonKey(entry.name)
154934
+ comparisonKey: pathSegmentComparisonKey$1(entry.name)
154751
154935
  });
154752
154936
  }
154753
154937
  return directoryEntries.sort((left2, right2) => {
@@ -154820,8 +155004,8 @@ ${entry.text}`).join("\n\n");
154820
155004
  if (entries === null) {
154821
155005
  return null;
154822
155006
  }
154823
- const comparisonKey = pathSegmentComparisonKey(segment);
154824
- const matchingEntries = entries.filter((entry) => pathSegmentComparisonKey(entry.name) === comparisonKey);
155007
+ const comparisonKey = pathSegmentComparisonKey$1(segment);
155008
+ const matchingEntries = entries.filter((entry) => pathSegmentComparisonKey$1(entry.name) === comparisonKey);
154825
155009
  const uniqueNames = new Set(matchingEntries.map((entry) => entry.name));
154826
155010
  if (uniqueNames.size > 1) {
154827
155011
  throw new CodeCollabV2ServiceError("path_conflict", "Path is ambiguous because multiple filesystem entries differ only by case or Unicode normalization.", {
@@ -154836,7 +155020,7 @@ ${entry.text}`).join("\n\n");
154836
155020
  }
154837
155021
  return absolutePath;
154838
155022
  }
154839
- function pathSegmentComparisonKey(segment) {
155023
+ function pathSegmentComparisonKey$1(segment) {
154840
155024
  return segment.normalize("NFC").toLocaleLowerCase("en-US");
154841
155025
  }
154842
155026
  function findDirectoryEntryCollisionKeys(entries) {
@@ -155256,6 +155440,16 @@ ${entry.text}`).join("\n\n");
155256
155440
  }
155257
155441
  }
155258
155442
  const FILE_PREVIEW_EXTRA_ROOTS_ENV_VAR = "LODY_FILE_PREVIEW_EXTRA_ROOTS";
155443
+ const NODE_DIRECTORY_READER = {
155444
+ exists: (candidatePath) => fs__default$1.existsSync(candidatePath),
155445
+ readNames: (directoryPath) => {
155446
+ try {
155447
+ return fs__default$1.readdirSync(directoryPath);
155448
+ } catch {
155449
+ return null;
155450
+ }
155451
+ }
155452
+ };
155259
155453
  function getDefaultFilePreviewExtraRoots(options = {}) {
155260
155454
  const env2 = options.env ?? process.env;
155261
155455
  const configured = (env2[FILE_PREVIEW_EXTRA_ROOTS_ENV_VAR] ?? "").split(path__default.delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0).map((entry) => path__default.resolve(entry));
@@ -155289,6 +155483,57 @@ ${entry.text}`).join("\n\n");
155289
155483
  }
155290
155484
  return input2;
155291
155485
  }
155486
+ function toLexicalPath(input2, workspaceRoot, homeDir) {
155487
+ const expanded = expandHome(input2, homeDir);
155488
+ return path__default.isAbsolute(expanded) ? path__default.resolve(expanded) : path__default.resolve(workspaceRoot, expanded);
155489
+ }
155490
+ function buildLexicalCandidates(requested, workspaceRoot, homeDir) {
155491
+ const spellings = requested.trim() === requested ? [
155492
+ requested
155493
+ ] : [
155494
+ requested,
155495
+ requested.trim()
155496
+ ];
155497
+ const candidates = [];
155498
+ for (const spelling of spellings) {
155499
+ const lexicalPath = toLexicalPath(spelling, workspaceRoot, homeDir);
155500
+ if (!candidates.includes(lexicalPath)) candidates.push(lexicalPath);
155501
+ }
155502
+ return candidates;
155503
+ }
155504
+ function pathSegmentComparisonKey(segment) {
155505
+ return segment.normalize("NFC").toLocaleLowerCase("en-US");
155506
+ }
155507
+ function resolveExistingPathIgnoringCaseAndNormalization(rootPath, relativePath, reader = NODE_DIRECTORY_READER) {
155508
+ const segments = relativePath.split(path__default.sep).filter((segment) => segment.length > 0);
155509
+ if (segments.length === 0) return null;
155510
+ if (segments.some((segment) => segment === "." || segment === "..")) return null;
155511
+ let currentPath = rootPath;
155512
+ for (const segment of segments) {
155513
+ const exactPath = path__default.join(currentPath, segment);
155514
+ if (reader.exists(exactPath)) {
155515
+ currentPath = exactPath;
155516
+ continue;
155517
+ }
155518
+ const entryNames = reader.readNames(currentPath);
155519
+ if (entryNames === null) return null;
155520
+ const comparisonKey = pathSegmentComparisonKey(segment);
155521
+ const matches = entryNames.filter((name2) => pathSegmentComparisonKey(name2) === comparisonKey);
155522
+ if (matches.length !== 1) return null;
155523
+ currentPath = path__default.join(currentPath, matches[0]);
155524
+ }
155525
+ return currentPath;
155526
+ }
155527
+ function resolveWorkspacePathTolerantly(lexicalPath, workspaceRoots, reader) {
155528
+ for (const root of workspaceRoots) {
155529
+ if (!isWithinRoot(root, lexicalPath)) continue;
155530
+ const relativePath = path__default.relative(root, lexicalPath);
155531
+ if (!relativePath) continue;
155532
+ const resolved = resolveExistingPathIgnoringCaseAndNormalization(root, relativePath, reader);
155533
+ if (resolved !== null) return resolved;
155534
+ }
155535
+ return null;
155536
+ }
155292
155537
  function resolveFilePreviewPath(args2) {
155293
155538
  const requested = args2.requestedPath;
155294
155539
  if (requested.includes("\0")) {
@@ -155312,8 +155557,7 @@ ${entry.text}`).join("\n\n");
155312
155557
  }
155313
155558
  const homeDir = args2.options?.homeDir ?? os__default.homedir();
155314
155559
  const workspaceRoot = path__default.resolve(args2.workspaceRoot);
155315
- const expanded = expandHome(trimmed2, homeDir);
155316
- const lexicalPath = path__default.isAbsolute(expanded) ? path__default.resolve(expanded) : path__default.resolve(workspaceRoot, expanded);
155560
+ const lexicalCandidates = buildLexicalCandidates(requested, workspaceRoot, homeDir);
155317
155561
  const extraRoots = args2.extraRoots ?? getDefaultFilePreviewExtraRoots(args2.options);
155318
155562
  const realWorkspaceRoot = resolveRealPathOrNull(workspaceRoot) ?? workspaceRoot;
155319
155563
  const realRoots = [
@@ -155332,9 +155576,29 @@ ${entry.text}`).join("\n\n");
155332
155576
  message: "File is outside the workspace: preview is limited to this session\u2019s workspace and Lody temporary directories."
155333
155577
  }
155334
155578
  };
155335
- const realTarget = resolveRealPathOrNull(lexicalPath);
155579
+ let realTarget = null;
155580
+ for (const candidate of lexicalCandidates) {
155581
+ realTarget = resolveRealPathOrNull(candidate);
155582
+ if (realTarget !== null) break;
155583
+ }
155584
+ if (realTarget === null) {
155585
+ const tolerantRoots = realWorkspaceRoot === workspaceRoot ? [
155586
+ workspaceRoot
155587
+ ] : [
155588
+ realWorkspaceRoot,
155589
+ workspaceRoot
155590
+ ];
155591
+ const reader = args2.options?.directoryReader ?? NODE_DIRECTORY_READER;
155592
+ for (const candidate of lexicalCandidates) {
155593
+ const tolerant = resolveWorkspacePathTolerantly(candidate, tolerantRoots, reader);
155594
+ if (tolerant !== null) {
155595
+ realTarget = resolveRealPathOrNull(tolerant);
155596
+ if (realTarget !== null) break;
155597
+ }
155598
+ }
155599
+ }
155336
155600
  if (realTarget === null) {
155337
- return classificationRoots.some((root) => isWithinRoot(root, lexicalPath)) ? {
155601
+ return lexicalCandidates.every((candidate) => classificationRoots.some((root) => isWithinRoot(root, candidate))) ? {
155338
155602
  ok: false,
155339
155603
  rejection: {
155340
155604
  code: "file_not_found",
@@ -163097,7 +163361,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
163097
163361
  const sessionDoc = await this.workspaceDocument.getOrCreateSessionDoc(sessionId);
163098
163362
  const meta = await sessionDoc.getMetaState();
163099
163363
  if (!meta) return;
163100
- if (meta.cliType !== "builtin" || !isBuiltinAgentType(meta.agentType)) {
163364
+ if (meta.cliType !== "builtin" || !isManagedBuiltinAgentType(meta.agentType)) {
163101
163365
  return;
163102
163366
  }
163103
163367
  const cliType = meta.agentType;
@@ -179078,7 +179342,7 @@ export PATH=${toSingleQuotedShellString(ghShimBinDir)}:"$PATH"
179078
179342
  },
179079
179343
  onRateLimitUpdate: (limits) => {
179080
179344
  dispatchEvent(() => {
179081
- if (config2.agentCliType === "builtin" && isBuiltinAgentType(config2.agentType)) {
179345
+ if (config2.agentCliType === "builtin" && isManagedBuiltinAgentType(config2.agentType)) {
179082
179346
  this.emit("onRateLimitUpdate", this.machineId, config2.agentType, limits);
179083
179347
  }
179084
179348
  });
@@ -216160,7 +216424,7 @@ ${page}${helpTipBottom}${choiceDescription}${ansiEscapes.cursorHide}`;
216160
216424
  data = createReviewBundleSnapshot(bundle);
216161
216425
  }
216162
216426
  const { injectReviewSnapshot } = await import("./chunks/index-VoI6Ds2-.js");
216163
- const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-C2u1XVWr.js").then(async (m) => {
216427
+ const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-CfESl-8M.js").then(async (m) => {
216164
216428
  await m.__tla;
216165
216429
  return m;
216166
216430
  });
@@ -235002,6 +235266,9 @@ ${result.stdout ?? ""}`;
235002
235266
  ...session2.openedBySessionId ? {
235003
235267
  openedBySessionId: session2.openedBySessionId
235004
235268
  } : {},
235269
+ ...session2.openedByRootSessionId ? {
235270
+ openedByRootSessionId: session2.openedByRootSessionId
235271
+ } : {},
235005
235272
  ...session2.parentSessionId ? {
235006
235273
  parentSessionId: session2.parentSessionId
235007
235274
  } : {},
@@ -235541,6 +235808,9 @@ ${result.stdout ?? ""}`;
235541
235808
  ...session2.openedBySessionId ? {
235542
235809
  openedBySessionId: session2.openedBySessionId
235543
235810
  } : {},
235811
+ ...session2.openedByRootSessionId ? {
235812
+ openedByRootSessionId: session2.openedByRootSessionId
235813
+ } : {},
235544
235814
  workContext: await buildSessionWorkContext(manager, workspaceId, session2),
235545
235815
  git: {
235546
235816
  ...session2.branchName ? {
@@ -236637,6 +236907,9 @@ ${lines2.join("\n")}` : ""}${suffix}`);
236637
236907
  } : {},
236638
236908
  ...result.openedBySessionId ? {
236639
236909
  openedBySessionId: result.openedBySessionId
236910
+ } : {},
236911
+ ...result.openedByRootSessionId ? {
236912
+ openedByRootSessionId: result.openedByRootSessionId
236640
236913
  } : {}
236641
236914
  };
236642
236915
  if (args2.wait === true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lody",
3
- "version": "0.80.0",
3
+ "version": "0.81.0",
4
4
  "description": "Lody Agent CLI tool for managing remote command execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -94,12 +94,13 @@
94
94
  "scripts": {
95
95
  "dev": "pnpm run prepare:acp-adapters && node scripts/dev-build.mjs && node --enable-source-maps dist-dev/index.js",
96
96
  "dev:build": "node scripts/dev-build.mjs",
97
- "build": "pnpm run clean && pnpm run prepare:acp-adapters && pnpm run typecheck && pnpm run build:bundle && pnpm run check:published-bundle-imports && pnpm run copy:wasm",
97
+ "build": "pnpm run clean && pnpm run prepare:acp-adapters && pnpm run typecheck && pnpm run build:bundle && pnpm run copy:dsh-presets && pnpm run check:published-bundle-imports && pnpm run copy:wasm",
98
98
  "build:watch": "pnpm run prepare:review-assets && vite build --watch",
99
99
  "build:bundle": "pnpm run prepare:review-assets && vite build",
100
- "prepare:acp-adapters": "corepack pnpm --dir ../.. --filter acp-extension-claude build && corepack pnpm --dir ../.. --filter acp-extension-codex build && corepack pnpm --dir ../.. --filter acp-extension-grok build",
100
+ "prepare:acp-adapters": "corepack pnpm --dir ../.. --filter acp-extension-claude build && corepack pnpm --dir ../.. --filter acp-extension-codex build && corepack pnpm --dir ../.. --filter acp-extension-grok build && corepack pnpm --dir ../.. --filter acp-extension-dsh build",
101
101
  "prepare:review-assets": "pnpm --dir ../.. --filter lody-code-review-viewer build",
102
102
  "check:published-bundle-imports": "node scripts/check-published-bundle-imports.js",
103
+ "copy:dsh-presets": "node scripts/copy-deepseek-presets.js",
103
104
  "copy:wasm": "node scripts/copy-loro-wasm.js",
104
105
  "clean": "rimraf dist dist-dev",
105
106
  "format": "prettier --write src/**/*.ts",