@liberseek/boft-cli-win32-arm64 0.8.0 → 0.8.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.
@@ -4200,6 +4200,20 @@ import { zstdDecompressSync } from "node:zlib";
4200
4200
  // ../../harness-adapter/dist/usage-statistics.js
4201
4201
  var MAX_SESSION_ID_LENGTH = 512;
4202
4202
  var MAX_CWD_LENGTH = 4096;
4203
+ var MAX_SESSION_TITLE_LENGTH = 200;
4204
+ function usageSessionTitle(value) {
4205
+ if (typeof value !== "string")
4206
+ return void 0;
4207
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
4208
+ if (!normalized)
4209
+ return void 0;
4210
+ if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
4211
+ return normalized;
4212
+ const characters = [...normalized];
4213
+ if (characters.length <= MAX_SESSION_TITLE_LENGTH)
4214
+ return normalized;
4215
+ return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
4216
+ }
4203
4217
  function sessionIdOk(value) {
4204
4218
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
4205
4219
  }
@@ -4209,12 +4223,14 @@ function cwdOk(value) {
4209
4223
  function withUsageSession(entry, session) {
4210
4224
  const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
4211
4225
  const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
4226
+ const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
4212
4227
  if (sessionId === void 0 && cwd === void 0)
4213
4228
  return entry;
4214
4229
  return {
4215
4230
  ...entry,
4216
4231
  ...sessionId !== void 0 ? { sessionId } : {},
4217
- ...cwd !== void 0 ? { cwd } : {}
4232
+ ...cwd !== void 0 ? { cwd } : {},
4233
+ ...sessionTitle !== void 0 ? { sessionTitle } : {}
4218
4234
  };
4219
4235
  }
4220
4236
  function usageEntryFromRequest(request, occurredAtMs) {
@@ -18826,6 +18842,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
18826
18842
  initializeOnly: external_exports.boolean().optional()
18827
18843
  });
18828
18844
 
18845
+ // ../../shared-contracts/dist/harness-presentation.js
18846
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
18847
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
18848
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
18849
+ label: displayText(256).optional(),
18850
+ description: displayText(1024).optional()
18851
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
18852
+ var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
18853
+
18829
18854
  // ../../shared-contracts/dist/model-price-overrides.js
18830
18855
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
18831
18856
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -18904,6 +18929,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
18904
18929
  harness,
18905
18930
  sessionId: external_exports.string().min(1).max(512),
18906
18931
  project: project.nullable(),
18932
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
18933
+ title: external_exports.string().min(1).max(200).optional(),
18907
18934
  /** Models the session used, most requests first. */
18908
18935
  models: external_exports.array(model).max(16),
18909
18936
  firstAtMs: count,
@@ -18970,7 +18997,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
18970
18997
  * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
18971
18998
  * requests without a native session are not listed here but count everywhere else.
18972
18999
  */
18973
- sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
19000
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
19001
+ /**
19002
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
19003
+ * Hosts; missing is treated as no list rather than no sessions.
19004
+ */
19005
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
18974
19006
  });
18975
19007
 
18976
19008
  // ../../shared-contracts/dist/ids.js
@@ -19239,8 +19271,24 @@ var threadUsageSnapshotSchema = external_exports.object({
19239
19271
  }
19240
19272
  });
19241
19273
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
19274
+ var accountCreditsPeriodSchema = external_exports.enum([
19275
+ "weekly",
19276
+ "monthly",
19277
+ "five_hour",
19278
+ "seven_day",
19279
+ "unknown"
19280
+ ]);
19281
+ var accountCreditsScopeSchema = external_exports.object({
19282
+ id: external_exports.string().min(1).max(256),
19283
+ label: external_exports.string().min(1).max(256),
19284
+ localizations: harnessLocalizationsSchema.optional()
19285
+ }).strict();
19242
19286
  var accountCreditsProductUsageSchema = external_exports.object({
19243
19287
  product: external_exports.string().min(1),
19288
+ /** Native period and scope, never inferred from the display name. */
19289
+ periodType: accountCreditsPeriodSchema.optional(),
19290
+ scope: accountCreditsScopeSchema.optional(),
19291
+ localizations: harnessLocalizationsSchema.optional(),
19244
19292
  used: external_exports.number().finite().nonnegative().optional(),
19245
19293
  // Zero is a real empty cap, not an absent field.
19246
19294
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -19262,8 +19310,10 @@ var accountCreditsSnapshotSchema = external_exports.object({
19262
19310
  label: external_exports.string().min(1).optional(),
19263
19311
  usedPercent: usagePercentSchema.optional(),
19264
19312
  remaining: external_exports.number().finite().optional(),
19313
+ scope: accountCreditsScopeSchema.optional(),
19314
+ localizations: harnessLocalizationsSchema.optional(),
19265
19315
  resetsAt: external_exports.string().min(1).optional(),
19266
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
19316
+ periodType: accountCreditsPeriodSchema,
19267
19317
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
19268
19318
  resetCredits: accountResetCreditsSchema.optional()
19269
19319
  }).strict().superRefine((credits, context) => {
@@ -19288,7 +19338,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
19288
19338
  var threadUsageInspectionSchema = external_exports.object({
19289
19339
  threadId: hostThreadIdSchema,
19290
19340
  usage: threadUsageSnapshotSchema.nullable(),
19291
- accountCredits: accountCreditsSnapshotSchema.optional()
19341
+ accountCredits: accountCreditsSnapshotSchema.optional(),
19342
+ /** Whether this source can provide cached account quota independently of usage. */
19343
+ accountCreditsSupported: external_exports.boolean().optional()
19292
19344
  }).strict();
19293
19345
 
19294
19346
  // ../../shared-contracts/dist/harness-accounts.js
@@ -19415,7 +19467,8 @@ var harnessPermissionModeSchema = external_exports.object({
19415
19467
  id: harnessPermissionModeIdSchema,
19416
19468
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
19417
19469
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
19418
- dangerous: external_exports.boolean().optional()
19470
+ dangerous: external_exports.boolean().optional(),
19471
+ localizations: harnessLocalizationsSchema.optional()
19419
19472
  }).strict();
19420
19473
  var harnessPermissionModeCatalogSchema = external_exports.object({
19421
19474
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -19738,6 +19791,8 @@ var harnessInstallationStateSchema = external_exports.object({
19738
19791
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
19739
19792
  message: external_exports.string().max(2048).optional(),
19740
19793
  messageCode: external_exports.string().min(1).max(128).optional(),
19794
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
19795
+ notice: harnessLocalizedTextSchema.optional(),
19741
19796
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
19742
19797
  }).strict();
19743
19798
 
@@ -19880,6 +19935,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
19880
19935
  invocation: commandInvocationSchema,
19881
19936
  label: commandLabelSchema,
19882
19937
  description: commandDescriptionSchema.optional(),
19938
+ localizations: harnessLocalizationsSchema.optional(),
19883
19939
  argumentMode: external_exports.enum(["none", "text"]),
19884
19940
  /**
19885
19941
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -21920,7 +21976,7 @@ function validateV4Event(event) {
21920
21976
  break;
21921
21977
  case "subagent/catalog":
21922
21978
  requiredOptionalKeys(data, ["version", "childId", "childCreatedAt", "mode"], ["label"]);
21923
- if (data.version !== 0 || data.mode !== "one-shot" && data.mode !== "continuable")
21979
+ if (!(data.version === 0 && (data.mode === "one-shot" || data.mode === "continuable") || data.version === 2 && data.mode === "external"))
21924
21980
  throw invalid("subagent catalog");
21925
21981
  identifier(data.childId, "subagent catalog childId");
21926
21982
  nonNegativeInteger2(data.childCreatedAt, "subagent catalog childCreatedAt");
@@ -22170,9 +22226,11 @@ async function readDshUsage(file2) {
22170
22226
  if (entries.length === 0 && line.startsWith('{"type":"session"')) {
22171
22227
  try {
22172
22228
  const header = JSON.parse(line);
22229
+ const title = usageSessionTitle(header.title ?? header.name);
22173
22230
  session = {
22174
22231
  ...typeof header.id === "string" ? { sessionId: header.id } : {},
22175
- ...typeof header.cwd === "string" ? { cwd: header.cwd } : {}
22232
+ ...typeof header.cwd === "string" ? { cwd: header.cwd } : {},
22233
+ ...title ? { title } : {}
22176
22234
  };
22177
22235
  } catch {
22178
22236
  }
@@ -22223,6 +22281,7 @@ var commandDefinitions = [
22223
22281
  {
22224
22282
  id: "dsh.compact",
22225
22283
  invocation: "/compact",
22284
+ localizations: { "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" } },
22226
22285
  label: "Compact context",
22227
22286
  description: "Compact the current conversation context",
22228
22287
  argumentMode: "none"
@@ -22451,14 +22510,16 @@ var MAX_TIMER_MILLISECONDS = 2147483647;
22451
22510
  var NUMERIC_IDENTIFIER = String.raw`(?:0|[1-9]\d*)`;
22452
22511
  var PRERELEASE_IDENTIFIER = String.raw`(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)`;
22453
22512
  var SEMVER_PATTERN = new RegExp(String.raw`^${NUMERIC_IDENTIFIER}\.${NUMERIC_IDENTIFIER}\.${NUMERIC_IDENTIFIER}` + String.raw`(?:-${PRERELEASE_IDENTIFIER}(?:\.${PRERELEASE_IDENTIFIER})*)?` + String.raw`(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$`, "u");
22454
- var DEEPSEEK_NEWEST_VERIFIED_VERSION = "0.2.0-rc.2";
22513
+ var DEEPSEEK_NEWEST_VERIFIED_VERSION = "0.2.1-rc.2";
22455
22514
  var DEEPSEEK_VERIFIED_VERSIONS = [
22456
22515
  "0.1.7-rc.1",
22457
22516
  "0.1.7-rc.2",
22458
22517
  "0.2.0-rc.1",
22518
+ "0.2.0-rc.2",
22519
+ "0.2.1-rc.1",
22459
22520
  DEEPSEEK_NEWEST_VERIFIED_VERSION
22460
22521
  ];
22461
- var DEEPSEEK_UPGRADE_COMMAND = `npm install -g @deepseek-ai/dsh@${DEEPSEEK_NEWEST_VERIFIED_VERSION}`;
22522
+ var DEEPSEEK_UPGRADE_COMMAND = "npm install -g @deepseek-ai/dsh@latest";
22462
22523
  var DEFAULT_DEEPSEEK_ENDPOINT = "http://127.0.0.1:3080/";
22463
22524
  var MODERN_AUTHENTICATION_FINGERPRINT = Buffer.from("dsh web authentication required; reopen the URL printed by dsh web.\n");
22464
22525
  var MODERN_AUTHENTICATION_PROBE_TIMEOUT_MS = 1e3;
@@ -23508,14 +23569,20 @@ var ModernRemoteConnection = class {
23508
23569
  throw this.#protocolFailure(messageOf(error51));
23509
23570
  }
23510
23571
  }
23511
- #managedExit = () => {
23572
+ #managedExit = (exitCode, signal) => {
23512
23573
  if (this.#closing || this.#stoppingChild)
23513
23574
  return;
23514
23575
  const child = this.#child;
23515
23576
  if (child) {
23516
23577
  void this.#stopManagedProcess(child).catch(() => void 0);
23517
23578
  }
23518
- this.#publishFault(new ModernRemoteConnectionError("processExited", "DeepSeek Harness Web exited unexpectedly"));
23579
+ const details = [
23580
+ child?.pid === void 0 ? void 0 : `pid=${String(child.pid)}`,
23581
+ `exitCode=${String(exitCode)}`,
23582
+ `signal=${signal ?? "none"}`,
23583
+ this.#origin ? `endpoint=${this.#origin.origin}` : void 0
23584
+ ].filter((value) => value !== void 0);
23585
+ this.#publishFault(new ModernRemoteConnectionError("processExited", `DeepSeek Harness Web exited unexpectedly (${details.join(", ")})`));
23519
23586
  };
23520
23587
  #managedError = (error51) => {
23521
23588
  if (this.#closing || this.#stoppingChild)
@@ -24945,6 +25012,15 @@ var AUTO_PERMISSION_MODE_ID = "auto";
24945
25012
  var MAX_CATALOG_BYTES2 = 16 * 1024 * 1024;
24946
25013
  var MAX_CATALOG_DEPTH2 = 64;
24947
25014
  var MAX_CATALOG_NODES2 = 2e5;
25015
+ var presetLabels = /* @__PURE__ */ new Map([
25016
+ ["Auto", { en: "Auto", zh: "自动" }],
25017
+ ["read-only", { en: "Read only", zh: "只读" }],
25018
+ ["workspace-write", { en: "Workspace write", zh: "工作区写入" }],
25019
+ ["danger-full-access", { en: "Full access (dangerous)", zh: "完全访问(危险)" }],
25020
+ ["Read only", { en: "Read only", zh: "只读" }],
25021
+ ["Workspace write", { en: "Workspace write", zh: "工作区写入" }],
25022
+ ["Full access (dangerous)", { en: "Full access (dangerous)", zh: "完全访问(危险)" }]
25023
+ ]);
24948
25024
  var ModernPermissionModeError = class extends Error {
24949
25025
  code;
24950
25026
  nativeCode;
@@ -25046,9 +25122,11 @@ function presetOptions(value, area) {
25046
25122
  if (description !== void 0 && (typeof description !== "string" || description.length > HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH)) {
25047
25123
  throw permissionError("protocolError", "DeepSeek Harness returned an invalid permission option description");
25048
25124
  }
25125
+ const presentation = presetLabels.get(label);
25049
25126
  return {
25050
25127
  id: id.data,
25051
25128
  label,
25129
+ ...presentation ? { localizations: { en: { label: presentation.en }, "zh-CN": { label: presentation.zh } } } : {},
25052
25130
  ...description?.trim() ? { description } : {}
25053
25131
  };
25054
25132
  });
@@ -27039,6 +27117,8 @@ var KNOWN_EVENT_TYPES = /* @__PURE__ */ new Set([
27039
27117
  "hook/invoked",
27040
27118
  "hook/result",
27041
27119
  "image/offload",
27120
+ "job/registered",
27121
+ "job/settled",
27042
27122
  "llm/retry",
27043
27123
  "llm/retry-started",
27044
27124
  "model/selection",
@@ -27075,6 +27155,7 @@ var KNOWN_EVENT_TYPES = /* @__PURE__ */ new Set([
27075
27155
  "turn/start",
27076
27156
  "user/message",
27077
27157
  "web/deepseek-search-llm-request",
27158
+ "working-directory/change",
27078
27159
  "workspace/changes"
27079
27160
  ]);
27080
27161
  var SURFACE_EVENT_TYPES = /* @__PURE__ */ new Set([
@@ -27248,6 +27329,14 @@ var ModernEventValidator = class {
27248
27329
  return;
27249
27330
  case "workspace/changes":
27250
27331
  return;
27332
+ case "working-directory/change":
27333
+ exactKeys(data, ["cwd"]);
27334
+ requiredString(data.cwd, "working-directory/change cwd");
27335
+ return;
27336
+ case "job/registered":
27337
+ case "job/settled":
27338
+ validateJobLifecycle(event.type, data);
27339
+ return;
27251
27340
  case "agent-preset/selected":
27252
27341
  exactKeys(data, ["agentPreset"]);
27253
27342
  requiredString(data.agentPreset, "agent-preset/selected agentPreset");
@@ -28231,7 +28320,7 @@ function validateSessionTitle(data) {
28231
28320
  }
28232
28321
  }
28233
28322
  function validateSessionTitleRequest(data) {
28234
- exactKeys(data, ["titleProvider", "messageSeqs", "route", "system", "messages", "maxTokens"]);
28323
+ requiredOptionalKeys(data, ["titleProvider", "messageSeqs", "route", "system", "messages", "maxTokens"], ["reasoningEffort"]);
28235
28324
  requiredString(data.titleProvider, "session/title request provider");
28236
28325
  validateSeqArray(data.messageSeqs, "session/title request messageSeqs");
28237
28326
  validateModelRoute(data.route, "session/title request route");
@@ -28245,6 +28334,9 @@ function validateSessionTitleRequest(data) {
28245
28334
  }
28246
28335
  }
28247
28336
  positiveInteger(data.maxTokens, "session/title request maxTokens");
28337
+ if (data.reasoningEffort !== void 0 && !nonBlankString(data.reasoningEffort)) {
28338
+ fail("Modern history session/title request reasoningEffort is invalid");
28339
+ }
28248
28340
  }
28249
28341
  function validateTodoWrite(data) {
28250
28342
  exactKeys(data, ["todos"]);
@@ -28288,12 +28380,47 @@ function validateWorkflow(type, data) {
28288
28380
  requiredString(data.runId, "workflow runId");
28289
28381
  enumValue(data.stopReason, ["completed", "cancelled", "error"], "workflow stopReason");
28290
28382
  }
28383
+ function validateJobLifecycle(type, data) {
28384
+ const settled = type === "job/settled";
28385
+ requiredOptionalKeys(data, [
28386
+ "jobId",
28387
+ "owner",
28388
+ "kind",
28389
+ "label",
28390
+ "startedAt",
28391
+ ...settled ? ["finishedAt", "status", "cause", "producerReported"] : []
28392
+ ], settled ? ["toolCall", "detail"] : ["toolCall"]);
28393
+ requiredString(data.jobId, `${type} jobId`);
28394
+ requiredString(data.owner, `${type} owner`);
28395
+ requiredString(data.kind, `${type} kind`);
28396
+ if (typeof data.label !== "string")
28397
+ fail(`Modern history ${type} label is invalid`);
28398
+ nonNegativeInteger(data.startedAt, `${type} startedAt`);
28399
+ if (data.toolCall !== void 0) {
28400
+ if (!isRecord4(data.toolCall))
28401
+ fail(`Modern history ${type} toolCall is malformed`);
28402
+ exactKeys(data.toolCall, ["callId", "rootCallId"]);
28403
+ requiredString(data.toolCall.callId, `${type} toolCall callId`);
28404
+ requiredString(data.toolCall.rootCallId, `${type} toolCall rootCallId`);
28405
+ }
28406
+ if (!settled)
28407
+ return;
28408
+ nonNegativeInteger(data.finishedAt, "job/settled finishedAt");
28409
+ enumValue(data.status, ["completed", "killed", "failed"], "job/settled status");
28410
+ enumValue(data.cause, ["producer", "kill", "teardown"], "job/settled cause");
28411
+ if (typeof data.producerReported !== "boolean") {
28412
+ fail("Modern history job/settled producerReported is invalid");
28413
+ }
28414
+ if (data.detail !== void 0 && typeof data.detail !== "string") {
28415
+ fail("Modern history job/settled detail is invalid");
28416
+ }
28417
+ }
28291
28418
  function validatePtcDispatch(type, data, profile) {
28292
28419
  const settle = type === "tool/ptc-dispatch";
28293
28420
  const required2 = ["rootCallId", "parentCallId", "subCallId", "name", "arguments"];
28294
28421
  if (settle)
28295
28422
  required2.push("isError", "content");
28296
- requiredOptionalKeys(data, required2, settle ? ["error"] : []);
28423
+ requiredOptionalKeys(data, required2, settle ? ["error", "meta"] : []);
28297
28424
  for (const key of ["rootCallId", "parentCallId", "subCallId", "name"]) {
28298
28425
  requiredString(data[key], `tool/ptc-dispatch ${key}`);
28299
28426
  }
@@ -28442,12 +28569,20 @@ function validateSearchRequest(data) {
28442
28569
  requiredString(data.apiVersion, "search request apiVersion");
28443
28570
  if (!isRecord4(data.body))
28444
28571
  fail("Modern history search request body is malformed");
28445
- requiredOptionalKeys(data.body, ["model", "max_tokens", "messages", "tools"], []);
28572
+ requiredOptionalKeys(data.body, ["model", "max_tokens", "messages", "tools"], ["thinking"]);
28446
28573
  requiredString(data.body.model, "search request model");
28447
28574
  positiveInteger(data.body.max_tokens, "search request max_tokens");
28448
28575
  if (!Array.isArray(data.body.messages) || !Array.isArray(data.body.tools)) {
28449
28576
  fail("Modern history search request arrays are malformed");
28450
28577
  }
28578
+ if (data.body.thinking !== void 0) {
28579
+ const { thinking } = data.body;
28580
+ if (!isRecord4(thinking))
28581
+ fail("Modern history search request thinking is malformed");
28582
+ exactKeys(thinking, ["type"]);
28583
+ if (thinking.type !== "disabled")
28584
+ fail("Modern history search request thinking is invalid");
28585
+ }
28451
28586
  }
28452
28587
  function validateModelRoute(value, label) {
28453
28588
  if (!isRecord4(value))
@@ -31119,7 +31254,8 @@ function titleFromProjections(value) {
31119
31254
  return typeof title === "string" && title.trim().length > 0 && title.length <= DEEPSEEK_MODERN_SESSION_TITLE_MAX_LENGTH && !title.includes("\0") ? title : null;
31120
31255
  }
31121
31256
  function parseSummary(value) {
31122
- if (!isPlainRecord7(value) || !exactKeys5(value, ["sessionId", "updatedAt", "agentAvailable", "running", "blank"], ["parentSessionId", "origin", "cwd", "projections"]) || typeof value.running !== "boolean" || typeof value.blank !== "boolean" || typeof value.agentAvailable !== "boolean" || !validUpdatedAt(value.updatedAt)) {
31257
+ if (!isPlainRecord7(value) || !exactKeys5(value, ["sessionId", "updatedAt", "agentAvailable", "running", "blank"], ["parentSessionId", "origin", "cwd", "projections", "formatStatus"]) || // DSH 0.2.1 marks rows whose stored log still awaits migration on open.
31258
+ value.formatStatus !== void 0 && value.formatStatus !== "current" && value.formatStatus !== "migration-required" || typeof value.running !== "boolean" || typeof value.blank !== "boolean" || typeof value.agentAvailable !== "boolean" || !validUpdatedAt(value.updatedAt)) {
31123
31259
  throw sessionListError("protocolError", "DeepSeek Harness returned an invalid Session row");
31124
31260
  }
31125
31261
  const sessionId = boundedId(value.sessionId, "Session id");
@@ -32185,8 +32321,22 @@ var DeepSeekHarnessAdapter = class {
32185
32321
  async inspect(input = {}) {
32186
32322
  if (this.#closed)
32187
32323
  return { status: "unavailable", error: closedError2() };
32188
- if (this.#delegate)
32189
- return this.#delegate.adapter.inspect(input);
32324
+ if (this.#delegate) {
32325
+ const selected = this.#delegate;
32326
+ const inspection = await selected.adapter.inspect(input);
32327
+ if (!shouldRecoverDelegate(inspection))
32328
+ return inspection;
32329
+ await this.#retireFaultedDelegate(selected);
32330
+ try {
32331
+ return (await this.#select(true)).inspection;
32332
+ } catch (error51) {
32333
+ const failure = this.#selectionError(error51);
32334
+ return {
32335
+ status: failure.code === "notInstalled" ? "notInstalled" : "unavailable",
32336
+ error: failure
32337
+ };
32338
+ }
32339
+ }
32190
32340
  try {
32191
32341
  return (await this.#select(input.refresh === true)).inspection;
32192
32342
  } catch (error51) {
@@ -32202,7 +32352,12 @@ var DeepSeekHarnessAdapter = class {
32202
32352
  const selected = await this.#select(false);
32203
32353
  if (this.#closed)
32204
32354
  return { ok: false, error: closedError2() };
32205
- return selected.adapter.open(input);
32355
+ const opened = await selected.adapter.open(input);
32356
+ if (opened.ok || !shouldRecoverDelegate(opened))
32357
+ return opened;
32358
+ await this.#retireFaultedDelegate(selected);
32359
+ const replacement = await this.#select(true);
32360
+ return replacement.adapter.open(input);
32206
32361
  } catch (error51) {
32207
32362
  return { ok: false, error: this.#selectionError(error51) };
32208
32363
  }
@@ -32216,23 +32371,48 @@ var DeepSeekHarnessAdapter = class {
32216
32371
  const selected = await this.#select(false);
32217
32372
  if (this.#closed)
32218
32373
  return { ok: false, error: closedError2() };
32219
- return selected.adapter.sessionImport.listCandidates();
32374
+ const listed = await selected.adapter.sessionImport.listCandidates();
32375
+ if (listed.ok || !shouldRecoverDelegate(listed))
32376
+ return listed;
32377
+ await this.#retireFaultedDelegate(selected);
32378
+ const replacement = await this.#select(true);
32379
+ return replacement.adapter.sessionImport.listCandidates();
32220
32380
  } catch (error51) {
32221
32381
  return { ok: false, error: this.#selectionError(error51) };
32222
32382
  }
32223
32383
  }
32224
- #openWebUi() {
32384
+ async #openWebUi() {
32225
32385
  if (this.#closed)
32226
- return Promise.resolve({ ok: false, error: closedError2() });
32227
- const webUi = this.#delegate?.adapter.webUi;
32228
- return webUi ? webUi.open() : Promise.resolve({
32229
- ok: false,
32230
- error: {
32231
- code: "unsupported",
32232
- message: "DeepSeek Harness Web is not managed by this codexhost instance",
32233
- retryable: false
32386
+ return { ok: false, error: closedError2() };
32387
+ try {
32388
+ const selected = this.#delegate;
32389
+ const webUi = selected?.adapter.webUi;
32390
+ if (!selected || !webUi) {
32391
+ return {
32392
+ ok: false,
32393
+ error: {
32394
+ code: "unsupported",
32395
+ message: "DeepSeek Harness Web is not managed by this codexhost instance",
32396
+ retryable: false
32397
+ }
32398
+ };
32234
32399
  }
32235
- });
32400
+ const opened = await webUi.open();
32401
+ if (opened.ok || !shouldRecoverDelegate(opened))
32402
+ return opened;
32403
+ await this.#retireFaultedDelegate(selected);
32404
+ const replacement = await this.#select(true);
32405
+ return replacement.adapter.webUi ? replacement.adapter.webUi.open() : {
32406
+ ok: false,
32407
+ error: {
32408
+ code: "unsupported",
32409
+ message: "DeepSeek Harness Web is not managed by this codexhost instance",
32410
+ retryable: false
32411
+ }
32412
+ };
32413
+ } catch (error51) {
32414
+ return { ok: false, error: this.#selectionError(error51) };
32415
+ }
32236
32416
  }
32237
32417
  #select(refresh) {
32238
32418
  if (this.#closed)
@@ -32394,6 +32574,15 @@ var DeepSeekHarnessAdapter = class {
32394
32574
  owner.closePromise ??= owner.adapter.close();
32395
32575
  return owner.closePromise;
32396
32576
  }
32577
+ async #retireFaultedDelegate(owner) {
32578
+ if (this.#delegate !== owner)
32579
+ return;
32580
+ await this.#closeOwner(owner);
32581
+ if (this.#delegate === owner) {
32582
+ this.#delegate = void 0;
32583
+ this.#failure = void 0;
32584
+ }
32585
+ }
32397
32586
  async #closeFailedCandidate(owner) {
32398
32587
  try {
32399
32588
  await this.#closeOwner(owner);
@@ -32514,6 +32703,10 @@ function closedError2() {
32514
32703
  retryable: false
32515
32704
  };
32516
32705
  }
32706
+ function shouldRecoverDelegate(result) {
32707
+ const error51 = "ok" in result ? result.ok ? void 0 : result.error : result.status === "ready" ? void 0 : result.error;
32708
+ return error51?.code === "processExited" && error51.retryable;
32709
+ }
32517
32710
 
32518
32711
  // dist/installation.js
32519
32712
  function createDeepSeekInstallation(environment, command) {
@@ -32544,6 +32737,10 @@ function createDeepSeekInstallation(environment, command) {
32544
32737
  canUpdate,
32545
32738
  ...!canUpdate ? {
32546
32739
  messageCode: "deepseek-original-installer",
32740
+ notice: {
32741
+ en: "Update with the original installer. Python, desktop, and project-local installations are not upgraded through global npm.",
32742
+ "zh-CN": "请使用原安装方式更新。Python、桌面应用及项目内安装不会通过全局 npm 更新。"
32743
+ },
32547
32744
  message: "Update with the original installer. Python, desktop, and project-local installations are not upgraded through global npm."
32548
32745
  } : {}
32549
32746
  };