@karlorz/codexhost-cli-win32-x64 0.13.2-3 → 0.13.3-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.
@@ -16797,6 +16797,27 @@ function nativeError(error51, profile = CODEBUDDY_RUNTIME_PROFILE) {
16797
16797
  function failure(code, message, profile = CODEBUDDY_RUNTIME_PROFILE) {
16798
16798
  return { ok: false, error: nativeError(new CodeBuddyError(code, message), profile) };
16799
16799
  }
16800
+ function nativeTurnError(stopReason, meta3, profile) {
16801
+ const fallback = `Native Turn stopped: ${text(stopReason) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`;
16802
+ const raw = text(meta3["codebuddy.ai/errorMessage"]).trim();
16803
+ let diagnostic = "";
16804
+ let category;
16805
+ if (raw) {
16806
+ try {
16807
+ const error51 = record2(JSON.parse(raw));
16808
+ const data = record2(error51.data);
16809
+ diagnostic = text(data.details).trim() || text(error51.message).trim();
16810
+ category = data.category;
16811
+ } catch {
16812
+ diagnostic = raw;
16813
+ }
16814
+ }
16815
+ return nativeError(new CodeBuddyError(
16816
+ // -32000 is shared by native refusals; the category identifies authentication failures.
16817
+ category === "auth" ? "authenticationRequired" : "nativeFailure",
16818
+ diagnostic ? `${fallback}: ${diagnostic}` : fallback
16819
+ ), profile);
16820
+ }
16800
16821
  async function bounded(operation, milliseconds, label, onTimeout) {
16801
16822
  let timer;
16802
16823
  try {
@@ -24828,7 +24849,7 @@ var CodeBuddySession = class {
24828
24849
  // Those remain visible on individual Items; they do not fail the completed Turn.
24829
24850
  (!meta3["codebuddy.ai/outcome"] || meta3["codebuddy.ai/outcome"] === "SUCCESS" || meta3["codebuddy.ai/outcome"] === "PARTIAL_SUCCESS") ? { status: "succeeded" } : {
24830
24851
  status: "failed",
24831
- error: nativeError(new CodeBuddyError("nativeFailure", `Native Turn stopped: ${text(stop) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`), this.profile)
24852
+ error: nativeTurnError(stop, meta3, this.profile)
24832
24853
  };
24833
24854
  const snapshot = await this.#snapshot();
24834
24855
  const added = snapshot.turns.filter((turn) => !active.before.has(turn.nativeTurnRef.nativeTurnKey));
@@ -31,8 +31,8 @@
31
31
  }
32
32
  },
33
33
  "notice": {
34
- "en": "Requires DSH 0.1.7-rc.1 or later and the V4 protocol. Verified with 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1 and 0.2.0-rc.2; other versions require native protocol validation.",
35
- "zh-CN": "需要 DSH 0.1.7-rc.1 或更高版本及 V4 协议。已验证 0.1.7-rc.1、0.1.7-rc.2、0.2.0-rc.1 和 0.2.0-rc.2;其他版本仍需通过原生协议校验。"
34
+ "en": "Requires DSH 0.1.7-rc.1 or later and the V4 protocol. Verified with 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1 and 0.2.1-rc.2; other versions require native protocol validation.",
35
+ "zh-CN": "需要 DSH 0.1.7-rc.1 或更高版本及 V4 协议。已验证 0.1.7-rc.1、0.1.7-rc.2、0.2.0-rc.1、0.2.0-rc.2、0.2.1-rc.1 和 0.2.1-rc.2;其他版本仍需通过原生协议校验。"
36
36
  },
37
37
  "links": {
38
38
  "website": "https://github.com/deepseek-ai/deepseek-harness",
@@ -21923,7 +21923,7 @@ function validateV4Event(event) {
21923
21923
  break;
21924
21924
  case "subagent/catalog":
21925
21925
  requiredOptionalKeys(data, ["version", "childId", "childCreatedAt", "mode"], ["label"]);
21926
- if (data.version !== 0 || data.mode !== "one-shot" && data.mode !== "continuable")
21926
+ if (!(data.version === 0 && (data.mode === "one-shot" || data.mode === "continuable") || data.version === 2 && data.mode === "external"))
21927
21927
  throw invalid("subagent catalog");
21928
21928
  identifier(data.childId, "subagent catalog childId");
21929
21929
  nonNegativeInteger2(data.childCreatedAt, "subagent catalog childCreatedAt");
@@ -22457,14 +22457,16 @@ var MAX_TIMER_MILLISECONDS = 2147483647;
22457
22457
  var NUMERIC_IDENTIFIER = String.raw`(?:0|[1-9]\d*)`;
22458
22458
  var PRERELEASE_IDENTIFIER = String.raw`(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)`;
22459
22459
  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");
22460
- var DEEPSEEK_NEWEST_VERIFIED_VERSION = "0.2.0-rc.2";
22460
+ var DEEPSEEK_NEWEST_VERIFIED_VERSION = "0.2.1-rc.2";
22461
22461
  var DEEPSEEK_VERIFIED_VERSIONS = [
22462
22462
  "0.1.7-rc.1",
22463
22463
  "0.1.7-rc.2",
22464
22464
  "0.2.0-rc.1",
22465
+ "0.2.0-rc.2",
22466
+ "0.2.1-rc.1",
22465
22467
  DEEPSEEK_NEWEST_VERIFIED_VERSION
22466
22468
  ];
22467
- var DEEPSEEK_UPGRADE_COMMAND = `npm install -g @deepseek-ai/dsh@${DEEPSEEK_NEWEST_VERIFIED_VERSION}`;
22469
+ var DEEPSEEK_UPGRADE_COMMAND = "npm install -g @deepseek-ai/dsh@latest";
22468
22470
  var DEFAULT_DEEPSEEK_ENDPOINT = "http://127.0.0.1:3080/";
22469
22471
  var MODERN_AUTHENTICATION_FINGERPRINT = Buffer.from("dsh web authentication required; reopen the URL printed by dsh web.\n");
22470
22472
  var MODERN_AUTHENTICATION_PROBE_TIMEOUT_MS = 1e3;
@@ -27056,6 +27058,8 @@ var KNOWN_EVENT_TYPES = /* @__PURE__ */ new Set([
27056
27058
  "hook/invoked",
27057
27059
  "hook/result",
27058
27060
  "image/offload",
27061
+ "job/registered",
27062
+ "job/settled",
27059
27063
  "llm/retry",
27060
27064
  "llm/retry-started",
27061
27065
  "model/selection",
@@ -27092,6 +27096,7 @@ var KNOWN_EVENT_TYPES = /* @__PURE__ */ new Set([
27092
27096
  "turn/start",
27093
27097
  "user/message",
27094
27098
  "web/deepseek-search-llm-request",
27099
+ "working-directory/change",
27095
27100
  "workspace/changes"
27096
27101
  ]);
27097
27102
  var SURFACE_EVENT_TYPES = /* @__PURE__ */ new Set([
@@ -27265,6 +27270,14 @@ var ModernEventValidator = class {
27265
27270
  return;
27266
27271
  case "workspace/changes":
27267
27272
  return;
27273
+ case "working-directory/change":
27274
+ exactKeys(data, ["cwd"]);
27275
+ requiredString(data.cwd, "working-directory/change cwd");
27276
+ return;
27277
+ case "job/registered":
27278
+ case "job/settled":
27279
+ validateJobLifecycle(event.type, data);
27280
+ return;
27268
27281
  case "agent-preset/selected":
27269
27282
  exactKeys(data, ["agentPreset"]);
27270
27283
  requiredString(data.agentPreset, "agent-preset/selected agentPreset");
@@ -28248,7 +28261,7 @@ function validateSessionTitle(data) {
28248
28261
  }
28249
28262
  }
28250
28263
  function validateSessionTitleRequest(data) {
28251
- exactKeys(data, ["titleProvider", "messageSeqs", "route", "system", "messages", "maxTokens"]);
28264
+ requiredOptionalKeys(data, ["titleProvider", "messageSeqs", "route", "system", "messages", "maxTokens"], ["reasoningEffort"]);
28252
28265
  requiredString(data.titleProvider, "session/title request provider");
28253
28266
  validateSeqArray(data.messageSeqs, "session/title request messageSeqs");
28254
28267
  validateModelRoute(data.route, "session/title request route");
@@ -28262,6 +28275,9 @@ function validateSessionTitleRequest(data) {
28262
28275
  }
28263
28276
  }
28264
28277
  positiveInteger(data.maxTokens, "session/title request maxTokens");
28278
+ if (data.reasoningEffort !== void 0 && !nonBlankString(data.reasoningEffort)) {
28279
+ fail("Modern history session/title request reasoningEffort is invalid");
28280
+ }
28265
28281
  }
28266
28282
  function validateTodoWrite(data) {
28267
28283
  exactKeys(data, ["todos"]);
@@ -28305,12 +28321,47 @@ function validateWorkflow(type, data) {
28305
28321
  requiredString(data.runId, "workflow runId");
28306
28322
  enumValue(data.stopReason, ["completed", "cancelled", "error"], "workflow stopReason");
28307
28323
  }
28324
+ function validateJobLifecycle(type, data) {
28325
+ const settled = type === "job/settled";
28326
+ requiredOptionalKeys(data, [
28327
+ "jobId",
28328
+ "owner",
28329
+ "kind",
28330
+ "label",
28331
+ "startedAt",
28332
+ ...settled ? ["finishedAt", "status", "cause", "producerReported"] : []
28333
+ ], settled ? ["toolCall", "detail"] : ["toolCall"]);
28334
+ requiredString(data.jobId, `${type} jobId`);
28335
+ requiredString(data.owner, `${type} owner`);
28336
+ requiredString(data.kind, `${type} kind`);
28337
+ if (typeof data.label !== "string")
28338
+ fail(`Modern history ${type} label is invalid`);
28339
+ nonNegativeInteger(data.startedAt, `${type} startedAt`);
28340
+ if (data.toolCall !== void 0) {
28341
+ if (!isRecord4(data.toolCall))
28342
+ fail(`Modern history ${type} toolCall is malformed`);
28343
+ exactKeys(data.toolCall, ["callId", "rootCallId"]);
28344
+ requiredString(data.toolCall.callId, `${type} toolCall callId`);
28345
+ requiredString(data.toolCall.rootCallId, `${type} toolCall rootCallId`);
28346
+ }
28347
+ if (!settled)
28348
+ return;
28349
+ nonNegativeInteger(data.finishedAt, "job/settled finishedAt");
28350
+ enumValue(data.status, ["completed", "killed", "failed"], "job/settled status");
28351
+ enumValue(data.cause, ["producer", "kill", "teardown"], "job/settled cause");
28352
+ if (typeof data.producerReported !== "boolean") {
28353
+ fail("Modern history job/settled producerReported is invalid");
28354
+ }
28355
+ if (data.detail !== void 0 && typeof data.detail !== "string") {
28356
+ fail("Modern history job/settled detail is invalid");
28357
+ }
28358
+ }
28308
28359
  function validatePtcDispatch(type, data, profile) {
28309
28360
  const settle = type === "tool/ptc-dispatch";
28310
28361
  const required2 = ["rootCallId", "parentCallId", "subCallId", "name", "arguments"];
28311
28362
  if (settle)
28312
28363
  required2.push("isError", "content");
28313
- requiredOptionalKeys(data, required2, settle ? ["error"] : []);
28364
+ requiredOptionalKeys(data, required2, settle ? ["error", "meta"] : []);
28314
28365
  for (const key of ["rootCallId", "parentCallId", "subCallId", "name"]) {
28315
28366
  requiredString(data[key], `tool/ptc-dispatch ${key}`);
28316
28367
  }
@@ -28459,12 +28510,20 @@ function validateSearchRequest(data) {
28459
28510
  requiredString(data.apiVersion, "search request apiVersion");
28460
28511
  if (!isRecord4(data.body))
28461
28512
  fail("Modern history search request body is malformed");
28462
- requiredOptionalKeys(data.body, ["model", "max_tokens", "messages", "tools"], []);
28513
+ requiredOptionalKeys(data.body, ["model", "max_tokens", "messages", "tools"], ["thinking"]);
28463
28514
  requiredString(data.body.model, "search request model");
28464
28515
  positiveInteger(data.body.max_tokens, "search request max_tokens");
28465
28516
  if (!Array.isArray(data.body.messages) || !Array.isArray(data.body.tools)) {
28466
28517
  fail("Modern history search request arrays are malformed");
28467
28518
  }
28519
+ if (data.body.thinking !== void 0) {
28520
+ const { thinking } = data.body;
28521
+ if (!isRecord4(thinking))
28522
+ fail("Modern history search request thinking is malformed");
28523
+ exactKeys(thinking, ["type"]);
28524
+ if (thinking.type !== "disabled")
28525
+ fail("Modern history search request thinking is invalid");
28526
+ }
28468
28527
  }
28469
28528
  function validateModelRoute(value, label) {
28470
28529
  if (!isRecord4(value))
@@ -31100,7 +31159,8 @@ function titleFromProjections(value) {
31100
31159
  return typeof title === "string" && title.trim().length > 0 && title.length <= DEEPSEEK_MODERN_SESSION_TITLE_MAX_LENGTH && !title.includes("\0") ? title : null;
31101
31160
  }
31102
31161
  function parseSummary(value) {
31103
- 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)) {
31162
+ 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.
31163
+ 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)) {
31104
31164
  throw sessionListError("protocolError", "DeepSeek Harness returned an invalid Session row");
31105
31165
  }
31106
31166
  const sessionId = boundedId(value.sessionId, "Session id");
@@ -24218,7 +24218,7 @@ var OpenCodeHarnessSession = class {
24218
24218
  }
24219
24219
  #projectPart(active, part) {
24220
24220
  if (part.type === "text" || part.type === "reasoning") {
24221
- if (part.type === "text" && part.ignored || !part.text)
24221
+ if (part.type === "text" && part.ignored)
24222
24222
  return;
24223
24223
  const existing = active.items.get(part.id);
24224
24224
  if (!existing) {
@@ -25092,11 +25092,15 @@ function v2State(session, catalog, policy) {
25092
25092
  ...entry ? {
25093
25093
  resolvedModelLabel: entry.resolvedModelLabel ?? entry.label,
25094
25094
  availableThinkingOptions: catalog.thinkingOptions.filter((v) => entry.supportedThinkingOptionIds?.includes(v.id)),
25095
- effectiveThinkingOptionId: encodeOpenCodeVariant(session.model?.variant)
25095
+ effectiveThinkingOptionId: effectiveVariant(session.model?.variant, entry)
25096
25096
  } : {},
25097
25097
  effectivePermissionModeId: decodeMode(mode?.effect)
25098
25098
  };
25099
25099
  }
25100
+ function effectiveVariant(variant, entry) {
25101
+ const id = encodeOpenCodeVariant(variant);
25102
+ return variant === "default" && !entry.supportedThinkingOptionIds?.includes(id) ? encodeOpenCodeVariant(void 0) : id;
25103
+ }
25100
25104
  function decodeMode(effect) {
25101
25105
  return effect === "allow" || effect === "ask" ? harnessPermissionModeIdSchema.parse(effect) : harnessPermissionModeIdSchema.parse("default");
25102
25106
  }
@@ -17523,6 +17523,27 @@ function nativeError(error51, profile = CODEBUDDY_RUNTIME_PROFILE) {
17523
17523
  function failure(code, message, profile = CODEBUDDY_RUNTIME_PROFILE) {
17524
17524
  return { ok: false, error: nativeError(new CodeBuddyError(code, message), profile) };
17525
17525
  }
17526
+ function nativeTurnError(stopReason, meta3, profile) {
17527
+ const fallback = `Native Turn stopped: ${text(stopReason) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`;
17528
+ const raw = text(meta3["codebuddy.ai/errorMessage"]).trim();
17529
+ let diagnostic = "";
17530
+ let category;
17531
+ if (raw) {
17532
+ try {
17533
+ const error51 = record2(JSON.parse(raw));
17534
+ const data = record2(error51.data);
17535
+ diagnostic = text(data.details).trim() || text(error51.message).trim();
17536
+ category = data.category;
17537
+ } catch {
17538
+ diagnostic = raw;
17539
+ }
17540
+ }
17541
+ return nativeError(new CodeBuddyError(
17542
+ // -32000 is shared by native refusals; the category identifies authentication failures.
17543
+ category === "auth" ? "authenticationRequired" : "nativeFailure",
17544
+ diagnostic ? `${fallback}: ${diagnostic}` : fallback
17545
+ ), profile);
17546
+ }
17526
17547
  async function bounded(operation, milliseconds, label, onTimeout) {
17527
17548
  let timer;
17528
17549
  try {
@@ -25682,7 +25703,7 @@ var CodeBuddySession = class {
25682
25703
  // Those remain visible on individual Items; they do not fail the completed Turn.
25683
25704
  (!meta3["codebuddy.ai/outcome"] || meta3["codebuddy.ai/outcome"] === "SUCCESS" || meta3["codebuddy.ai/outcome"] === "PARTIAL_SUCCESS") ? { status: "succeeded" } : {
25684
25705
  status: "failed",
25685
- error: nativeError(new CodeBuddyError("nativeFailure", `Native Turn stopped: ${text(stop) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`), this.profile)
25706
+ error: nativeTurnError(stop, meta3, this.profile)
25686
25707
  };
25687
25708
  const snapshot = await this.#snapshot();
25688
25709
  const added = snapshot.turns.filter((turn) => !active.before.has(turn.nativeTurnRef.nativeTurnKey));
@@ -25989,6 +26010,121 @@ function workBuddyDelegationArguments(environment, ephemeral) {
25989
26010
  return ["--append-system-prompt", WORKBUDDY_DELEGATION_INSTRUCTIONS];
25990
26011
  }
25991
26012
 
26013
+ // dist/credential-bootstrap.js
26014
+ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
26015
+ (() => {
26016
+ const env = process.env;
26017
+ const bootstrapEnvironment = [
26018
+ "CODEBUDDY_SIDECAR_CREDENTIAL_BOOTSTRAP_SOCKET",
26019
+ "CODEBUDDY_SIDECAR_READY_SOCKET",
26020
+ "CODEBUDDY_SIDECAR_READY_TOKEN",
26021
+ "CODEBUDDY_SIDECAR_READY_SESSION_ID",
26022
+ ];
26023
+ if (bootstrapEnvironment.some(name => env[name] !== undefined)) {
26024
+ if (!["WORKBUDDY_AT_REST_ENCRYPTION", ...bootstrapEnvironment].every(name => env[name]?.trim())) {
26025
+ throw Error("WorkBuddy credential bootstrap environment is incomplete");
26026
+ }
26027
+ return;
26028
+ }
26029
+ const policy = env.WORKBUDDY_AT_REST_ENCRYPTION?.trim();
26030
+ // Other explicit policies remain owned by the native CLI.
26031
+ if (policy && policy !== "fields") return;
26032
+
26033
+ let provider;
26034
+ try {
26035
+ provider = process._linkedBinding("electron_browser_workbuddy_storage");
26036
+ } catch {
26037
+ // Older app runtimes predate encrypted credential fields.
26038
+ return;
26039
+ }
26040
+ const crypto = require("node:crypto");
26041
+ const net = require("node:net");
26042
+ const fs = require("node:fs");
26043
+ const path = require("node:path");
26044
+ let payload;
26045
+ try { payload = JSON.parse(provider.loggerGet()); }
26046
+ catch { throw Error("WorkBuddy credential key provider is unavailable"); }
26047
+ let secret = payload && payload.atRestSecretKey;
26048
+ const decoded = typeof secret === "string" ? Buffer.from(secret, "base64") : Buffer.alloc(0);
26049
+ const valid = payload && payload.version === 1 && decoded.length === 32 &&
26050
+ decoded.toString("base64") === secret && !decoded.every(byte => byte === 0);
26051
+ decoded.fill(0);
26052
+ if (!valid) throw Error("WorkBuddy credential key payload is unsupported");
26053
+ // Match the native normalizeAtRestKeyPayload; the base64 text is hashed, not its decoded bytes.
26054
+ const key = crypto.createHash("sha256").update(secret, "utf8").digest();
26055
+ secret = undefined;
26056
+ payload = undefined;
26057
+ const token = crypto.randomBytes(24).toString("hex");
26058
+ const sessionId = crypto.randomUUID();
26059
+ let directory;
26060
+ let socketPath;
26061
+ if (process.platform === "win32") {
26062
+ socketPath = "\\\\.\\pipe\\codexhost-wb-" + process.pid + "-" + token;
26063
+ } else {
26064
+ let root = require("node:os").tmpdir();
26065
+ if (Buffer.byteLength(root) > 65) root = "/tmp";
26066
+ directory = fs.mkdtempSync(path.join(root, "ch-wb-"));
26067
+ fs.chmodSync(directory, 0o700);
26068
+ socketPath = path.join(directory, "c");
26069
+ }
26070
+ const cleanup = () => {
26071
+ if (directory) try { fs.rmSync(directory, {recursive:true,force:true}); } catch {}
26072
+ };
26073
+ process.once("exit", cleanup);
26074
+ Object.assign(env, {
26075
+ WORKBUDDY_AT_REST_ENCRYPTION: "fields",
26076
+ CODEBUDDY_SIDECAR_CREDENTIAL_BOOTSTRAP_SOCKET: socketPath,
26077
+ CODEBUDDY_SIDECAR_READY_SOCKET: socketPath + "-ready",
26078
+ CODEBUDDY_SIDECAR_READY_TOKEN: token,
26079
+ CODEBUDDY_SIDECAR_READY_SESSION_ID: sessionId,
26080
+ });
26081
+ let message = JSON.stringify({version:1,sessionId,token,pid:process.pid,bootstrap:{
26082
+ version:1,policy:"fields",
26083
+ symmetricKey:{keyId:crypto.createHash("sha256").update(key).digest("hex").slice(0,16),keyBase64:key.toString("base64")},
26084
+ asymmetricUnavailable:"missing-key",
26085
+ }}) + "\n";
26086
+ key.fill(0);
26087
+ let done = false;
26088
+ let socket;
26089
+ const finish = success => {
26090
+ if (done) return;
26091
+ done = true;
26092
+ clearTimeout(timer);
26093
+ socket && socket.destroy();
26094
+ message = "";
26095
+ cleanup();
26096
+ process.removeListener("exit", cleanup);
26097
+ if (!success) {
26098
+ process.stderr.write("WorkBuddy credential bootstrap failed\n");
26099
+ process.exit(1);
26100
+ }
26101
+ };
26102
+ const timer = setTimeout(() => finish(false), 4500);
26103
+ const connect = () => {
26104
+ if (done) return;
26105
+ socket = net.createConnection(socketPath);
26106
+ let reply = "";
26107
+ socket.once("connect", () => socket.end(message, () => { message = ""; }));
26108
+ socket.on("data", chunk => {
26109
+ reply += chunk;
26110
+ if (reply.length > 1024) return finish(false);
26111
+ if (!reply.includes("\n")) return;
26112
+ try {
26113
+ const result = JSON.parse(reply.slice(0, reply.indexOf("\n")));
26114
+ finish(result.ok === true && result.policy === "fields");
26115
+ } catch { finish(false); }
26116
+ });
26117
+ socket.once("end", () => { if (!done) finish(false); });
26118
+ socket.once("error", error => {
26119
+ socket.destroy();
26120
+ if (error.code === "ENOENT" || error.code === "ECONNREFUSED") setTimeout(connect, 20);
26121
+ else finish(false);
26122
+ });
26123
+ };
26124
+ setImmediate(connect);
26125
+ })();
26126
+ `;
26127
+
25992
26128
  // dist/discovery.js
25993
26129
  var WORKBUDDY_MACOS_ELECTRON = "/Applications/WorkBuddy AI.app/Contents/MacOS/Electron";
25994
26130
  var windowsRoots = [
@@ -26133,7 +26269,8 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
26133
26269
  } : configuredEnvironment;
26134
26270
  return {
26135
26271
  ...commandInvocation(executable, [
26136
- ...bundle ? [bundle.cli] : [],
26272
+ ...bundle ? ["--eval", `${WORKBUDDY_CREDENTIAL_PRELOAD}
26273
+ require(process.argv[1]);`, bundle.cli] : [],
26137
26274
  ...nativeArguments ?? [
26138
26275
  "--acp",
26139
26276
  ...ephemeral ? ["--no-session-persistence"] : [],