@liberseek/boft-cli-win32-arm64 0.8.2 → 0.8.4

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 (34) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +58 -5
  4. package/app/console-web.js +436 -67
  5. package/app/desktop-controller.mjs +72 -9
  6. package/app/host-runtime.mjs +772 -218
  7. package/app/plugins/antigravity/plugin.mjs +91 -13
  8. package/app/plugins/claude-code/plugin.mjs +404 -26
  9. package/app/plugins/codebuddy/plugin.mjs +117 -22
  10. package/app/plugins/codex-usage/plugin.mjs +176 -74
  11. package/app/plugins/copilot/assets/icon.png +0 -0
  12. package/app/plugins/copilot/manifest.json +26 -0
  13. package/app/plugins/copilot/plugin.mjs +34601 -0
  14. package/app/plugins/cursor-cli/plugin.mjs +20794 -44912
  15. package/app/plugins/deepseek-harness/plugin.mjs +83 -11
  16. package/app/plugins/enabled.json +1 -0
  17. package/app/plugins/grok/plugin.mjs +250 -40
  18. package/app/plugins/hermes/plugin.mjs +80 -9
  19. package/app/plugins/kimi-code/plugin.mjs +76 -7
  20. package/app/plugins/kiro-cli/plugin.mjs +76 -7
  21. package/app/plugins/muse/plugin.mjs +73 -5
  22. package/app/plugins/omp/plugin.mjs +2155 -2000
  23. package/app/plugins/opencode/plugin.mjs +85 -11
  24. package/app/plugins/pi/plugin.mjs +2515 -2298
  25. package/app/plugins/qoder/plugin.mjs +83 -11
  26. package/app/plugins/qoder-cn/plugin.mjs +83 -11
  27. package/app/plugins/workbuddy/plugin.mjs +378 -46
  28. package/app/plugins/zcode/plugin.mjs +84 -11
  29. package/app/renderer-extension.js +833 -162
  30. package/bin/boft.exe +0 -0
  31. package/libexec/boft-node-repl.exe +0 -0
  32. package/libexec/boft-shim.exe +0 -0
  33. package/libexec/boft-updater.exe +0 -0
  34. package/package.json +1 -1
@@ -14662,10 +14662,19 @@ var model = external_exports.string().min(1).max(512);
14662
14662
  var project = external_exports.string().min(1).max(4096);
14663
14663
  var usageStatisticsParamsSchema = external_exports.strictObject({
14664
14664
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
14665
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
14666
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
14667
+ try {
14668
+ new Intl.DateTimeFormat("en", { timeZone: value });
14669
+ return true;
14670
+ } catch {
14671
+ return false;
14672
+ }
14673
+ }, "Unsupported usage statistics timezone").optional(),
14665
14674
  harness: harness.optional(),
14666
14675
  model: model.nullable().optional(),
14667
14676
  project: project.nullable().optional(),
14668
- /** One local date inside the range. */
14677
+ /** One date in the query timezone inside the range. */
14669
14678
  date: localDate.optional()
14670
14679
  });
14671
14680
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -14701,7 +14710,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
14701
14710
  });
14702
14711
  var usageStatisticsResultSchema = external_exports.strictObject({
14703
14712
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
14704
- /** First local date of the range; null for all time. */
14713
+ /** First date in the query timezone (Host local when omitted); null for all time. */
14705
14714
  from: localDate.nullable(),
14706
14715
  to: localDate,
14707
14716
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -14741,7 +14750,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14741
14750
  totals: usageStatisticsTotalsSchema,
14742
14751
  /** Each date and Harness of the range: every filter except the day. */
14743
14752
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
14744
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
14753
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
14745
14754
  hourly: external_exports.array(external_exports.strictObject({
14746
14755
  weekday: external_exports.number().int().min(0).max(6),
14747
14756
  hour: external_exports.number().int().min(0).max(23),
@@ -14883,6 +14892,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
14883
14892
  "codexhost/harness/display-settings/set",
14884
14893
  "codexhost/harness/inspect",
14885
14894
  "codexhost/harness/installation",
14895
+ "codexhost/harness/installation/start",
14896
+ "codexhost/harness/installation/status",
14886
14897
  "codexhost/harness/launch-settings/get",
14887
14898
  "codexhost/harness/launch-settings/set",
14888
14899
  HARNESS_LONG_CONTEXT_GET_METHOD,
@@ -14960,7 +14971,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
14960
14971
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14961
14972
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
14962
14973
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
14974
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
14975
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
14976
+ kind: external_exports.literal("countdown"),
14977
+ id: external_exports.string().min(1).max(64),
14978
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
14979
+ label: indicatorTextSchema(256).optional(),
14980
+ tooltip: indicatorTextSchema(1024).optional()
14981
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
14982
+ message: "Composer indicator IDs must be unique"
14983
+ });
14963
14984
  var threadUsageSnapshotSchema = external_exports.object({
14985
+ composerIndicators: composerIndicatorsSchema.optional(),
14964
14986
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
14965
14987
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
14966
14988
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15386,7 +15408,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
15386
15408
  }).strict().optional(),
15387
15409
  input: external_exports.object({
15388
15410
  image: external_exports.boolean()
15389
- }).strict().optional()
15411
+ }).strict().optional(),
15412
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15413
+ steer: external_exports.boolean().optional()
15390
15414
  }).strict();
15391
15415
  var harnessConfigurationStateSchema = external_exports.object({
15392
15416
  effectiveModel: harnessModelRefSchema.optional(),
@@ -15433,7 +15457,9 @@ var harnessInspectionSchema = external_exports.union([
15433
15457
  var harnessInspectParamsSchema = external_exports.object({
15434
15458
  harnessId: harnessIdSchema,
15435
15459
  cwd: nonBlankTextSchema2.max(16384).optional(),
15436
- refresh: external_exports.boolean().optional()
15460
+ refresh: external_exports.boolean().optional(),
15461
+ /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15462
+ purpose: external_exports.literal("availability").optional()
15437
15463
  }).strict();
15438
15464
  var harnessWebUiOpenParamsSchema = external_exports.object({
15439
15465
  harnessId: harnessIdSchema
@@ -15518,6 +15544,15 @@ var threadOwnershipListResultSchema = external_exports.object({
15518
15544
  seen.add(thread.threadId);
15519
15545
  }
15520
15546
  });
15547
+ var threadSteeringInspectParamsSchema = external_exports.object({
15548
+ threadId: hostThreadIdSchema,
15549
+ /** The text about to be steered; a Harness command always stops and restarts. */
15550
+ text: external_exports.string().optional()
15551
+ }).strict();
15552
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15553
+ var threadSteeringInspectResultSchema = external_exports.object({
15554
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15555
+ }).strict();
15521
15556
 
15522
15557
  // ../../shared-contracts/dist/harness-route.js
15523
15558
  var harnessPluginRouteSchema = external_exports.object({
@@ -15550,6 +15585,10 @@ var harnessInstallationStateSchema = external_exports.object({
15550
15585
  latestVersion: external_exports.string().min(1).max(128),
15551
15586
  updateAvailable: external_exports.boolean(),
15552
15587
  canUpdate: external_exports.boolean(),
15588
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
15589
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
15590
+ /** Official download opened by the user; does not imply an automatic installation. */
15591
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
15553
15592
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15554
15593
  message: external_exports.string().max(2048).optional(),
15555
15594
  messageCode: external_exports.string().min(1).max(128).optional(),
@@ -15557,6 +15596,20 @@ var harnessInstallationStateSchema = external_exports.object({
15557
15596
  notice: harnessLocalizedTextSchema.optional(),
15558
15597
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15559
15598
  }).strict();
15599
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
15600
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
15601
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
15602
+ external_exports.object({
15603
+ taskId: external_exports.string().uuid(),
15604
+ status: external_exports.literal("succeeded"),
15605
+ result: harnessInstallationStateSchema
15606
+ }).strict(),
15607
+ external_exports.object({
15608
+ taskId: external_exports.string().uuid(),
15609
+ status: external_exports.literal("failed"),
15610
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
15611
+ }).strict()
15612
+ ]);
15560
15613
 
15561
15614
  // ../../shared-contracts/dist/codex-accounts.js
15562
15615
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -16071,6 +16124,18 @@ function sanitizeDiagnosticTail(value) {
16071
16124
  return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
16072
16125
  }
16073
16126
 
16127
+ // ../../harness-adapter/dist/steer.js
16128
+ function unsupportedSteer(harnessLabel) {
16129
+ return {
16130
+ ok: false,
16131
+ error: {
16132
+ code: "unsupported",
16133
+ message: `${harnessLabel} cannot steer an active Turn natively`,
16134
+ retryable: false
16135
+ }
16136
+ };
16137
+ }
16138
+
16074
16139
  // ../../harness-adapter/dist/usage.js
16075
16140
  var tokenFields = [
16076
16141
  "inputTokens",
@@ -16098,6 +16163,7 @@ var usageFields = /* @__PURE__ */ new Set([
16098
16163
  ...safeIntegerFields,
16099
16164
  ...percentFields,
16100
16165
  "sessionCacheUsage",
16166
+ "composerIndicators",
16101
16167
  "totalCostUsd",
16102
16168
  "totalCredits",
16103
16169
  "contextUsagePercent",
@@ -16120,6 +16186,7 @@ function parseHostUsage(value) {
16120
16186
  throw new Error(`Harness Usage contains unknown field '${key}'`);
16121
16187
  }
16122
16188
  }
16189
+ const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16123
16190
  for (const field of [
16124
16191
  "totalCredits",
16125
16192
  "contextUsagePercent",
@@ -16196,9 +16263,9 @@ function parseHostUsage(value) {
16196
16263
  if (value.costSource !== "publicPrice") {
16197
16264
  throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
16198
16265
  }
16199
- return { ...value, unpricedModels: [...models] };
16266
+ return { ...value, ...indicators, unpricedModels: [...models] };
16200
16267
  }
16201
- return { ...value };
16268
+ return { ...value, ...indicators };
16202
16269
  }
16203
16270
  var requestTokenFields = [
16204
16271
  "inputTokens",
@@ -16358,6 +16425,7 @@ var harnessBrokerMethodSchema = external_exports.enum([
16358
16425
  "adapter.sessionImport.resolve",
16359
16426
  "adapter.subagent.readSnapshot",
16360
16427
  "session.readSnapshot",
16428
+ "session.readCapabilities",
16361
16429
  "session.refreshUsage",
16362
16430
  "session.execute",
16363
16431
  "session.commands.list",
@@ -16559,6 +16627,11 @@ var turnStartSchema = external_exports.object({
16559
16627
  turnId: hostTurnIdSchema,
16560
16628
  input: external_exports.array(textInputSchema)
16561
16629
  }).strict();
16630
+ var turnSteerSchema = external_exports.object({
16631
+ type: external_exports.literal("turn.steer"),
16632
+ turnId: hostTurnIdSchema,
16633
+ input: external_exports.array(textInputSchema)
16634
+ }).strict();
16562
16635
  var turnCancelSchema = external_exports.object({ type: external_exports.literal("turn.cancel"), turnId: hostTurnIdSchema }).strict();
16563
16636
  var interactionResponseSchema = external_exports.union([
16564
16637
  external_exports.object({
@@ -16584,6 +16657,7 @@ var permissionSelectSchema = external_exports.object({
16584
16657
  }).strict();
16585
16658
  var brokerHostCommandSchema = external_exports.discriminatedUnion("type", [
16586
16659
  turnStartSchema,
16660
+ turnSteerSchema,
16587
16661
  turnCancelSchema,
16588
16662
  interactionRespondSchema,
16589
16663
  modelSelectSchema,
@@ -16776,6 +16850,7 @@ function parseSessionMetadata(value) {
16776
16850
  sessionId: candidate.sessionId,
16777
16851
  sessionGeneration: candidate.sessionGeneration,
16778
16852
  capabilities: harnessSessionCapabilitiesSchema.parse(candidate.capabilities),
16853
+ readCapabilities: candidate.readCapabilities === true,
16779
16854
  initialState: state,
16780
16855
  initialUsage: candidate.initialUsage === null ? null : parseHostUsage(candidate.initialUsage),
16781
16856
  commands: candidate.commands === true
@@ -17127,6 +17202,11 @@ var BrokeredHarnessSession = class {
17127
17202
  event: { type: "session.faulted", error: unavailable(error51.message) }
17128
17203
  });
17129
17204
  }
17205
+ async readCapabilities() {
17206
+ if (!this.#metadata.readCapabilities)
17207
+ return { ...this.capabilities, steer: false };
17208
+ return harnessSessionCapabilitiesSchema.parse(await this.#request("session.readCapabilities", {}));
17209
+ }
17130
17210
  async refreshUsage() {
17131
17211
  await this.#request("session.refreshUsage", {});
17132
17212
  }
@@ -17158,6 +17238,8 @@ var BrokeredHarnessSession = class {
17158
17238
  try {
17159
17239
  return parseHarnessResult(await this.#request("session.execute", { command }));
17160
17240
  } catch (error51) {
17241
+ if (command.type === "turn.steer")
17242
+ throw error51;
17161
17243
  return {
17162
17244
  ok: false,
17163
17245
  error: unavailable(error51 instanceof Error ? error51.message : String(error51))
@@ -17547,10 +17629,13 @@ function usageSessionTitle(value) {
17547
17629
  return void 0;
17548
17630
  if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
17549
17631
  return normalized;
17550
- const characters = [...normalized];
17551
- if (characters.length <= MAX_SESSION_TITLE_LENGTH)
17552
- return normalized;
17553
- return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
17632
+ let title = "";
17633
+ for (const character of normalized) {
17634
+ if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
17635
+ break;
17636
+ title += character;
17637
+ }
17638
+ return `${title.trimEnd()}…`;
17554
17639
  }
17555
17640
  function sessionIdOk(value) {
17556
17641
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
@@ -19192,7 +19277,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
19192
19277
  import { stat as stat3 } from "node:fs/promises";
19193
19278
 
19194
19279
  // ../codebuddy/dist/acp-client.js
19195
- import { execFile as execFile2, spawn } from "node:child_process";
19280
+ import { execFile as execFile3, spawn } from "node:child_process";
19196
19281
  import { Readable as Readable2, Writable } from "node:stream";
19197
19282
 
19198
19283
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -23357,9 +23442,23 @@ var ClientSideConnection = class {
23357
23442
 
23358
23443
  // ../codebuddy/dist/copy-cleanup.js
23359
23444
  import { randomBytes } from "node:crypto";
23445
+
23446
+ // ../codebuddy/dist/acp-stdio.js
23360
23447
  import { createInterface as createInterface2 } from "node:readline";
23361
- import { stripVTControlCharacters } from "node:util";
23362
23448
  import { Readable } from "node:stream";
23449
+ import { stripVTControlCharacters } from "node:util";
23450
+ function codeBuddyAcpOutput(stdout, onLine) {
23451
+ return Readable.from((async function* () {
23452
+ for await (const line of createInterface2({ input: stdout })) {
23453
+ onLine?.(stripVTControlCharacters(line));
23454
+ if (line.trimStart().startsWith("{"))
23455
+ yield Buffer.from(`${line}
23456
+ `);
23457
+ }
23458
+ })());
23459
+ }
23460
+
23461
+ // ../codebuddy/dist/copy-cleanup.js
23363
23462
  var CodeBuddyCopyCleanup = class {
23364
23463
  copyId;
23365
23464
  cwd;
@@ -23389,17 +23488,11 @@ var CodeBuddyCopyCleanup = class {
23389
23488
  }
23390
23489
  /** Native --serve banners include its password; never pass them to the ACP parser/logs. */
23391
23490
  protocolOutput(stdout) {
23392
- return Readable.from(this.#protocolLines(stdout));
23393
- }
23394
- async *#protocolLines(stdout) {
23395
- for await (const line of createInterface2({ input: stdout })) {
23396
- const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(stripVTControlCharacters(line));
23491
+ return codeBuddyAcpOutput(stdout, (line) => {
23492
+ const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(line);
23397
23493
  if (endpoint)
23398
23494
  this.#endpoint = endpoint[1];
23399
- if (line.trimStart().startsWith("{"))
23400
- yield Buffer.from(`${line}
23401
- `);
23402
- }
23495
+ });
23403
23496
  }
23404
23497
  async remove() {
23405
23498
  if (!this.#endpoint)
@@ -23664,6 +23757,88 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
23664
23757
  return void 0;
23665
23758
  }
23666
23759
 
23760
+ // ../../harness-discovery/dist/installation.js
23761
+ import { execFile as execFile2 } from "node:child_process";
23762
+ import { homedir as homedir2 } from "node:os";
23763
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
23764
+ const env = withNodeRuntimeOnPath(environment);
23765
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
23766
+ return new Promise((resolve, reject) => {
23767
+ const child = execFile2(invocation.command, invocation.arguments, {
23768
+ env,
23769
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir2(),
23770
+ encoding: "utf8",
23771
+ timeout,
23772
+ killSignal: "SIGKILL",
23773
+ maxBuffer: 1024 * 1024,
23774
+ windowsHide: true,
23775
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
23776
+ }, (error51, stdout, stderr) => {
23777
+ if (error51)
23778
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
23779
+ else
23780
+ resolve((stdout || stderr).trim());
23781
+ });
23782
+ child.stdin?.end();
23783
+ });
23784
+ }
23785
+ function installationVersion(value) {
23786
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
23787
+ throw new Error("Harness returned an invalid version");
23788
+ return value.trim().replace(/^v/, "");
23789
+ }
23790
+ function versionFromOutput(output) {
23791
+ return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
23792
+ }
23793
+ function newerInstallationVersion(current, latest) {
23794
+ const a = installationVersion(current).replace(/\+.*/, "");
23795
+ const b = installationVersion(latest).replace(/\+.*/, "");
23796
+ const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
23797
+ const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
23798
+ for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
23799
+ if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
23800
+ return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
23801
+ }
23802
+ const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
23803
+ const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
23804
+ if (!preA.length || !preB.length)
23805
+ return !!preA.length && !preB.length;
23806
+ for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
23807
+ const x = preA[i];
23808
+ const y = preB[i];
23809
+ if (x === y)
23810
+ continue;
23811
+ if (x === void 0 || y === void 0)
23812
+ return x === void 0;
23813
+ const numericX = /^\d+$/.test(x);
23814
+ const numericY = /^\d+$/.test(y);
23815
+ if (numericX && numericY) {
23816
+ if (BigInt(x) === BigInt(y))
23817
+ continue;
23818
+ return BigInt(y) > BigInt(x);
23819
+ }
23820
+ if (numericX !== numericY)
23821
+ return numericX;
23822
+ return y > x;
23823
+ }
23824
+ return false;
23825
+ }
23826
+ async function fetchInstallationText(url2) {
23827
+ const request = async () => {
23828
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
23829
+ if (!response.ok)
23830
+ throw new Error("Could not check the latest Harness version");
23831
+ return response.text();
23832
+ };
23833
+ try {
23834
+ return await request();
23835
+ } catch (error51) {
23836
+ if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
23837
+ throw error51;
23838
+ return request();
23839
+ }
23840
+ }
23841
+
23667
23842
  // ../codebuddy/dist/command.js
23668
23843
  var codeBuddyDiscoverySpec = {
23669
23844
  id: "codebuddy",
@@ -23763,7 +23938,7 @@ var CodeBuddyAcpClient = class {
23763
23938
  return { outcome: "cancelled" };
23764
23939
  return options.handlers.question(params);
23765
23940
  }
23766
- }), ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? this.#child.stdout)));
23941
+ }), ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? (invocation.arguments.includes("--serve") ? codeBuddyAcpOutput(this.#child.stdout) : this.#child.stdout))));
23767
23942
  void this.#connection.closed.then(() => {
23768
23943
  this.#fault(new CodeBuddyError("processExited", "ACP connection closed"));
23769
23944
  }).catch((error51) => {
@@ -23856,7 +24031,7 @@ var CodeBuddyAcpClient = class {
23856
24031
  }
23857
24032
  const pid = this.#child.pid;
23858
24033
  if (pid && process.platform === "win32") {
23859
- await new Promise((resolve) => execFile2("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve()));
24034
+ await new Promise((resolve) => execFile3("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve()));
23860
24035
  } else if (pid) {
23861
24036
  try {
23862
24037
  process.kill(-pid, "SIGKILL");
@@ -23869,7 +24044,7 @@ var CodeBuddyAcpClient = class {
23869
24044
 
23870
24045
  // ../codebuddy/dist/derivation.js
23871
24046
  import { randomUUID as randomUUID3 } from "node:crypto";
23872
- import { execFile as execFile3, spawn as spawn2 } from "node:child_process";
24047
+ import { execFile as execFile4, spawn as spawn2 } from "node:child_process";
23873
24048
  import { lstat as lstat3, mkdir, readFile as readFile3, realpath as realpath4, unlink, writeFile } from "node:fs/promises";
23874
24049
  import path8 from "node:path";
23875
24050
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
@@ -24119,7 +24294,7 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
24119
24294
  child.stderr.destroy();
24120
24295
  } else if (process.platform === "win32" && child.pid) {
24121
24296
  termination = new Promise((done) => {
24122
- execFile3("taskkill", ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => {
24297
+ execFile4("taskkill", ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => {
24123
24298
  child.kill();
24124
24299
  done();
24125
24300
  });
@@ -25790,6 +25965,8 @@ var CodeBuddySession = class {
25790
25965
  async #execute(command, nativeCommand = false) {
25791
25966
  if (this.#closed || this.#fault)
25792
25967
  return failure("invalidState", "Session is closed or faulted", this.profile);
25968
+ if (command.type === "turn.steer")
25969
+ return unsupportedSteer(this.profile.displayName);
25793
25970
  if (command.type === "interaction.respond")
25794
25971
  return this.#interactions.respond(command);
25795
25972
  if (command.type === "turn.cancel") {
@@ -26149,8 +26326,9 @@ var CodeBuddyAdapter = class {
26149
26326
  };
26150
26327
 
26151
26328
  // dist/command.js
26152
- import { lstatSync } from "node:fs";
26153
- import { homedir as homedir2 } from "node:os";
26329
+ import { lstatSync, statSync } from "node:fs";
26330
+ import { randomBytes as randomBytes2 } from "node:crypto";
26331
+ import { homedir as homedir3 } from "node:os";
26154
26332
 
26155
26333
  // dist/delegation.js
26156
26334
  var DELEGATION_ENVIRONMENT_KEYS = [
@@ -26225,8 +26403,57 @@ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
26225
26403
  socketPath = path.join(directory, "c");
26226
26404
  }
26227
26405
  const cleanup = () => {
26406
+ clearTimeout(readyTimer);
26407
+ readyServer && readyServer.close();
26408
+ for (const connection of readyConnections) connection.destroy();
26228
26409
  if (directory) try { fs.rmSync(directory, {recursive:true,force:true}); } catch {}
26229
26410
  };
26411
+ const needsReady = process.argv.includes("--serve");
26412
+ let credentialReady = false;
26413
+ let runtimeReady = !needsReady;
26414
+ let readyTimer;
26415
+ let readyServer;
26416
+ const readyConnections = new Set();
26417
+ const cleanupWhenReady = () => {
26418
+ if (!credentialReady || !runtimeReady) return;
26419
+ cleanup();
26420
+ process.removeListener("exit", cleanup);
26421
+ };
26422
+ if (needsReady) {
26423
+ readyServer = net.createServer(connection => {
26424
+ readyConnections.add(connection);
26425
+ connection.once("close", () => readyConnections.delete(connection));
26426
+ connection.on("error", () => connection.destroy());
26427
+ let input = "";
26428
+ connection.on("data", chunk => {
26429
+ input += chunk;
26430
+ if (input.length > 4096) return connection.destroy();
26431
+ if (!input.includes("\n")) return;
26432
+ try {
26433
+ const request = JSON.parse(input.slice(0, input.indexOf("\n")));
26434
+ const params = request.params;
26435
+ if (request.jsonrpc !== "2.0" || request.method !== "session.ready" ||
26436
+ typeof request.id !== "string" || params?.protocolVersion !== 1 ||
26437
+ params.token !== token || params.sessionId !== sessionId || params.pid !== process.pid ||
26438
+ !Number.isInteger(params.port) || params.port < 1 || params.port > 65535) {
26439
+ connection.destroy();
26440
+ return;
26441
+ }
26442
+ runtimeReady = true;
26443
+ connection.end(JSON.stringify({jsonrpc:"2.0",id:request.id,result:{ok:true}}) + "\n", cleanupWhenReady);
26444
+ } catch { connection.destroy(); }
26445
+ });
26446
+ });
26447
+ readyServer.once("error", () => {
26448
+ process.stderr.write("WorkBuddy runtime readiness listener failed\n");
26449
+ process.exit(1);
26450
+ });
26451
+ readyServer.listen(socketPath + "-ready");
26452
+ readyTimer = setTimeout(() => {
26453
+ process.stderr.write("WorkBuddy runtime readiness timed out\n");
26454
+ process.exit(1);
26455
+ }, 15000);
26456
+ }
26230
26457
  process.once("exit", cleanup);
26231
26458
  Object.assign(env, {
26232
26459
  WORKBUDDY_AT_REST_ENCRYPTION: "fields",
@@ -26249,8 +26476,8 @@ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
26249
26476
  clearTimeout(timer);
26250
26477
  socket && socket.destroy();
26251
26478
  message = "";
26252
- cleanup();
26253
- process.removeListener("exit", cleanup);
26479
+ credentialReady = success;
26480
+ if (success) cleanupWhenReady();
26254
26481
  if (!success) {
26255
26482
  process.stderr.write("WorkBuddy credential bootstrap failed\n");
26256
26483
  process.exit(1);
@@ -26389,7 +26616,7 @@ function bundledProductConfigPath(environment, platform, dependencies) {
26389
26616
  function workBuddyEnvironment(environment, platform = process.platform) {
26390
26617
  const paths = targetPath(platform);
26391
26618
  const configuredRoot = environment.WORKBUDDY_CONFIG_DIR;
26392
- const root = paths.resolve(configuredRoot?.trim() ? configuredRoot : paths.join(environment.HOME || environment.USERPROFILE || homedir2(), ".workbuddy-ai"));
26619
+ const root = paths.resolve(configuredRoot?.trim() ? configuredRoot : paths.join(environment.HOME || environment.USERPROFILE || homedir3(), ".workbuddy-ai"));
26393
26620
  return {
26394
26621
  ...environment,
26395
26622
  // The bundled core reads CODEBUDDY_CONFIG_DIR. Force both names to one
@@ -26399,9 +26626,7 @@ function workBuddyEnvironment(environment, platform = process.platform) {
26399
26626
  DISABLE_AUTOUPDATER: environment.DISABLE_AUTOUPDATER ?? "1"
26400
26627
  };
26401
26628
  }
26402
- function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {}, argumentsOverride) {
26403
- const dependencies = Array.isArray(dependenciesOrArguments) ? {} : dependenciesOrArguments;
26404
- const nativeArguments = Array.isArray(dependenciesOrArguments) ? dependenciesOrArguments : argumentsOverride;
26629
+ function resolveWorkBuddyLaunch(environment, dependencies = {}) {
26405
26630
  const platform = dependencies.platform ?? process.platform;
26406
26631
  const configured = environmentValue(environment, "CODEXHOST_WORKBUDDY_COMMAND")?.trim() || void 0;
26407
26632
  if (!configured && platform !== "darwin" && platform !== "win32")
@@ -26414,6 +26639,29 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
26414
26639
  const executable = configured && !explicitDesktop && !configuredDirectory ? explicitExecutable : bundle?.executable;
26415
26640
  if (!executable)
26416
26641
  throw new CodeBuddyError("notInstalled", "WorkBuddy AI app or its bundled CLI is unavailable");
26642
+ return { executable, bundle };
26643
+ }
26644
+ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {}, argumentsOverride) {
26645
+ const dependencies = Array.isArray(dependenciesOrArguments) ? {} : dependenciesOrArguments;
26646
+ const nativeArguments = Array.isArray(dependenciesOrArguments) ? dependenciesOrArguments : argumentsOverride;
26647
+ const platform = dependencies.platform ?? process.platform;
26648
+ const { executable, bundle } = resolveWorkBuddyLaunch(environment, dependencies);
26649
+ const paths = targetPath(platform);
26650
+ const cliDist = bundle && paths.join(paths.dirname(paths.dirname(bundle.cli)), "dist");
26651
+ const isFile = dependencies.isFile ?? ((candidate) => {
26652
+ try {
26653
+ return statSync(candidate).isFile();
26654
+ } catch {
26655
+ return false;
26656
+ }
26657
+ });
26658
+ const liteOnly = Boolean(cliDist && isFile(paths.join(cliDist, "codebuddy-lite-wb.mjs")) && !isFile(paths.join(cliDist, "codebuddy.js")) && !isFile(paths.join(cliDist, "codebuddy-headless.js")));
26659
+ const acpArguments = nativeArguments ?? [
26660
+ "--acp",
26661
+ ...ephemeral ? ["--no-session-persistence"] : [],
26662
+ ...workBuddyDelegationArguments(environment, ephemeral)
26663
+ ];
26664
+ const serve = liteOnly && acpArguments.includes("--acp") && !acpArguments.includes("--serve");
26417
26665
  const configuredEnvironment = withNodeRuntimeOnPath(workBuddyEnvironment(environment, platform), process.execPath, platform);
26418
26666
  const productConfigPath = bundle ? bundledProductConfigPath(configuredEnvironment, platform, dependencies) : void 0;
26419
26667
  const childEnvironment = bundle ? {
@@ -26422,17 +26670,20 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
26422
26670
  // waits for its telemetry channel before copying; normal ACP keeps its policy.
26423
26671
  ...nativeArguments?.includes("--print") && nativeArguments.includes("--fork-session") && configuredEnvironment.DISABLE_TELEMETRY === void 0 ? { DISABLE_TELEMETRY: "1" } : {},
26424
26672
  ...productConfigPath ? { [WORKBUDDY_PRODUCT_CONFIG_PATH_ENV]: productConfigPath } : {},
26673
+ ...liteOnly ? { CODEBUDDY_FORCE_LITE_WB_BUNDLE: "1" } : {},
26674
+ ...serve ? {
26675
+ CODEBUDDY_GATEWAY_AUTH: "password",
26676
+ CODEBUDDY_GATEWAY_PASSWORD: randomBytes2(32).toString("base64url"),
26677
+ CODEBUDDY_GATEWAY_BASE_PATH: ""
26678
+ } : {},
26425
26679
  ELECTRON_RUN_AS_NODE: "1"
26426
26680
  } : configuredEnvironment;
26427
26681
  return {
26428
26682
  ...commandInvocation(executable, [
26429
26683
  ...bundle ? ["--eval", `${WORKBUDDY_CREDENTIAL_PRELOAD}
26430
26684
  require(process.argv[1]);`, bundle.cli] : [],
26431
- ...nativeArguments ?? [
26432
- "--acp",
26433
- ...ephemeral ? ["--no-session-persistence"] : [],
26434
- ...workBuddyDelegationArguments(childEnvironment, ephemeral)
26435
- ]
26685
+ ...acpArguments,
26686
+ ...serve ? ["--serve", "--host", "127.0.0.1", "--port", "0", "--auth", "password"] : []
26436
26687
  ], childEnvironment, platform),
26437
26688
  environment: childEnvironment
26438
26689
  };
@@ -26637,10 +26888,90 @@ var WorkBuddyAdapter = class extends CodeBuddyAdapter {
26637
26888
  }
26638
26889
  };
26639
26890
 
26891
+ // dist/installation.js
26892
+ import { readFile as readFile6, stat as stat5 } from "node:fs/promises";
26893
+ var applicationNotice = {
26894
+ en: "These are WorkBuddy desktop app versions. Its bundled CLI updates with the app. Download the official installer, complete installation, then reopen Connections to verify the version. Existing sessions keep their running CLI.",
26895
+ "zh-CN": "此处显示 WorkBuddy 桌面应用版本,内置 CLI 随应用更新。请下载官方安装包并完成安装,再重新打开连接页确认版本。已有会话继续使用运行中的 CLI。"
26896
+ };
26897
+ function appVersion(value) {
26898
+ const version2 = installationVersion(value);
26899
+ return version2.replace(/^(\d+\.\d+\.\d+)\.\d+$/u, "$1");
26900
+ }
26901
+ async function readProduct(file2) {
26902
+ const metadata = await stat5(file2);
26903
+ if (!metadata.isFile() || metadata.size <= 0 || metadata.size > 8 * 1024 * 1024)
26904
+ throw new Error("WorkBuddy product metadata is unavailable");
26905
+ return JSON.parse(await readFile6(file2, "utf8"));
26906
+ }
26907
+ function createWorkBuddyInstallation(environment, dependencies = {}) {
26908
+ const platform = dependencies.platform ?? process.platform;
26909
+ const arch = dependencies.arch ?? process.arch;
26910
+ return async (action) => {
26911
+ if (action === "update")
26912
+ throw new Error("Complete the update with WorkBuddy's official desktop installer");
26913
+ const { executable, bundle } = resolveWorkBuddyLaunch(environment, { platform });
26914
+ if (!bundle)
26915
+ return {
26916
+ currentVersion: versionFromOutput(await runInstallationCommand(executable, ["--version"], environment)),
26917
+ latestVersion: "Unknown",
26918
+ latestVersionKind: "unknown",
26919
+ updateAvailable: false,
26920
+ canUpdate: false,
26921
+ notice: {
26922
+ en: "This is a custom CLI. Use its original installer to update; WorkBuddy desktop releases do not identify this CLI's latest version.",
26923
+ "zh-CN": "当前使用自定义 CLI,请通过原安装方式更新;WorkBuddy 桌面应用版本不代表此 CLI 的最新版本。"
26924
+ }
26925
+ };
26926
+ const paths = targetPath(platform);
26927
+ const product = await (dependencies.readProduct ?? readProduct)(paths.join(paths.dirname(paths.dirname(bundle.cli)), "product.json"));
26928
+ const currentVersion = appVersion(product.genieVersion);
26929
+ const unknown2 = {
26930
+ currentVersion,
26931
+ versionKind: "application",
26932
+ latestVersion: "Unknown",
26933
+ latestVersionKind: "unknown",
26934
+ updateAvailable: false,
26935
+ canUpdate: false,
26936
+ notice: {
26937
+ en: "The installed WorkBuddy desktop app version is shown. Check and install updates in WorkBuddy itself; this installation's update channel could not be checked here.",
26938
+ "zh-CN": "此处显示已安装的 WorkBuddy 桌面应用版本。当前无法查询此安装的更新渠道,请在 WorkBuddy 应用内检查并安装更新。"
26939
+ }
26940
+ };
26941
+ const root = product.applicationName === "workbuddy-ai" && product.updateUrl === "https://www.workbuddy.ai" ? "https://www.workbuddy.ai" : product.applicationName === "workbuddy" && product.updateUrl === "https://www.workbuddy.cn" ? "https://www.workbuddy.cn" : void 0;
26942
+ const target = platform === "darwin" && (arch === "arm64" || arch === "x64") ? `darwin-${arch}` : platform === "win32" && arch === "x64" ? "win32-x64-user" : void 0;
26943
+ if (!root || !target || environment.WORKBUDDY_UPDATE_URL?.trim() && environment.WORKBUDDY_UPDATE_URL.trim() !== root)
26944
+ return unknown2;
26945
+ try {
26946
+ const feed = JSON.parse(await (dependencies.fetchText ?? fetchInstallationText)(`${root}/v2/update?platform=workbuddy-${target}`));
26947
+ const feedVersion = installationVersion(feed.version);
26948
+ const latestVersion = appVersion(feedVersion);
26949
+ const download = new URL(typeof feed.url === "string" ? feed.url : "");
26950
+ const downloadHost = root.endsWith(".ai") ? "download.codebuddy.ai" : "download.codebuddy.cn";
26951
+ if (download.origin !== `https://${downloadHost}` || download.username || download.password || download.search || download.hash || !download.pathname.startsWith(`/workbuddy/saas/${target}/WorkBuddy-${target}-${feedVersion}-`) || !download.pathname.endsWith(platform === "darwin" ? ".zip" : ".exe"))
26952
+ throw new Error("WorkBuddy update feed returned an invalid installer URL");
26953
+ if (platform === "darwin")
26954
+ download.pathname = download.pathname.replace(/\.zip$/u, ".dmg");
26955
+ const updateAvailable = newerInstallationVersion(currentVersion, latestVersion);
26956
+ return {
26957
+ currentVersion,
26958
+ versionKind: "application",
26959
+ latestVersion,
26960
+ updateAvailable,
26961
+ canUpdate: false,
26962
+ ...updateAvailable ? { manualUpdateUrl: download.href } : {},
26963
+ notice: applicationNotice
26964
+ };
26965
+ } catch {
26966
+ return unknown2;
26967
+ }
26968
+ };
26969
+ }
26970
+
26640
26971
  // dist/plugin.js
26641
26972
  function createHarnessAdapter(context) {
26642
26973
  if (context.platform === "darwin" && context.managedRemoteHost) {
26643
- const environment = {
26974
+ const environment2 = {
26644
26975
  ...context.environment,
26645
26976
  ...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
26646
26977
  };
@@ -26652,7 +26983,7 @@ function createHarnessAdapter(context) {
26652
26983
  environment: { ...context.environment },
26653
26984
  isInstalled: () => {
26654
26985
  try {
26655
- workBuddyInvocation(environment, true);
26986
+ workBuddyInvocation(environment2, true);
26656
26987
  return true;
26657
26988
  } catch (error51) {
26658
26989
  return !(error51 instanceof CodeBuddyError && error51.code === "notInstalled");
@@ -26661,11 +26992,12 @@ function createHarnessAdapter(context) {
26661
26992
  ...context.brokerDescriptorPath ? { descriptorPath: context.brokerDescriptorPath } : {}
26662
26993
  });
26663
26994
  }
26664
- return new WorkBuddyAdapter({
26665
- environment: {
26666
- ...context.environment,
26667
- ...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
26668
- }
26995
+ const environment = {
26996
+ ...context.environment,
26997
+ ...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
26998
+ };
26999
+ return Object.assign(new WorkBuddyAdapter({ environment }), {
27000
+ installation: createWorkBuddyInstallation(environment)
26669
27001
  });
26670
27002
  }
26671
27003
  export {