@karlorz/codexhost-cli-win32-x64 0.15.0-1 → 0.16.1-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.
@@ -4705,8 +4705,8 @@ function az_default() {
4705
4705
  }
4706
4706
 
4707
4707
  // ../../../node_modules/zod/v4/locales/be.js
4708
- function getBelarusianPlural(count2, one, few, many) {
4709
- const absCount = Math.abs(count2);
4708
+ function getBelarusianPlural(count3, one, few, many) {
4709
+ const absCount = Math.abs(count3);
4710
4710
  const lastDigit = absCount % 10;
4711
4711
  const lastTwoDigits = absCount % 100;
4712
4712
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -6784,8 +6784,8 @@ function hu_default() {
6784
6784
  }
6785
6785
 
6786
6786
  // ../../../node_modules/zod/v4/locales/hy.js
6787
- function getArmenianPlural(count2, one, many) {
6788
- return Math.abs(count2) === 1 ? one : many;
6787
+ function getArmenianPlural(count3, one, many) {
6788
+ return Math.abs(count3) === 1 ? one : many;
6789
6789
  }
6790
6790
  function withDefiniteArticle(word) {
6791
6791
  if (!word)
@@ -8913,8 +8913,8 @@ function ro_default() {
8913
8913
  }
8914
8914
 
8915
8915
  // ../../../node_modules/zod/v4/locales/ru.js
8916
- function getRussianPlural(count2, one, few, many) {
8917
- const absCount = Math.abs(count2);
8916
+ function getRussianPlural(count3, one, few, many) {
8917
+ const absCount = Math.abs(count3);
8918
8918
  const lastDigit = absCount % 10;
8919
8919
  const lastTwoDigits = absCount % 100;
8920
8920
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -14711,6 +14711,33 @@ function text(value) {
14711
14711
  return typeof value === "string" ? value : "";
14712
14712
  }
14713
14713
 
14714
+ // ../../shared-contracts/dist/goals.js
14715
+ var harnessGoalStatusSchema = external_exports.enum([
14716
+ "active",
14717
+ "paused",
14718
+ "blocked",
14719
+ "usageLimited",
14720
+ "budgetLimited",
14721
+ "complete"
14722
+ ]);
14723
+ var count = external_exports.number().int().nonnegative().safe();
14724
+ var harnessGoalSchema = external_exports.object({
14725
+ objective: external_exports.string().min(1),
14726
+ status: harnessGoalStatusSchema,
14727
+ tokenBudget: count.positive().nullable(),
14728
+ tokensUsed: count,
14729
+ timeUsedSeconds: count,
14730
+ createdAt: count,
14731
+ updatedAt: count
14732
+ });
14733
+ var goalOriginSchema = external_exports.enum(["user", "automatic"]).nullable();
14734
+ var harnessGoalSetSchema = external_exports.object({
14735
+ objective: external_exports.string().min(1).optional(),
14736
+ status: external_exports.enum(["active", "paused"]).optional(),
14737
+ tokenBudget: count.positive().nullable().optional(),
14738
+ origin: goalOriginSchema
14739
+ });
14740
+
14714
14741
  // ../../shared-contracts/dist/delegation-read.js
14715
14742
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
14716
14743
  var delegationReadParamsSchema = external_exports.strictObject({
@@ -14841,7 +14868,7 @@ var modelPriceDefaultResultSchema = external_exports.strictObject({
14841
14868
 
14842
14869
  // ../../shared-contracts/dist/usage-statistics.js
14843
14870
  var USAGE_STATISTICS_RANGES = ["today", "7d", "30d", "90d", "all"];
14844
- var count = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
14871
+ var count2 = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
14845
14872
  var localDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/u);
14846
14873
  var harness = external_exports.string().min(1).max(128);
14847
14874
  var model = external_exports.string().min(1).max(512);
@@ -14864,22 +14891,24 @@ var usageStatisticsParamsSchema = external_exports.strictObject({
14864
14891
  date: localDate.optional()
14865
14892
  });
14866
14893
  var usageStatisticsTotalsSchema = external_exports.strictObject({
14867
- requests: count,
14868
- inputTokens: count,
14869
- cachedInputTokens: count,
14870
- cacheWriteInputTokens: count,
14871
- cacheKnownInputTokens: count,
14872
- outputTokens: count,
14873
- reasoningOutputTokens: count,
14894
+ requests: count2,
14895
+ inputTokens: count2,
14896
+ cachedInputTokens: count2,
14897
+ cacheWriteInputTokens: count2,
14898
+ cacheKnownInputTokens: count2,
14899
+ cacheHitCachedInputTokens: count2,
14900
+ cacheHitInputTokens: count2,
14901
+ outputTokens: count2,
14902
+ reasoningOutputTokens: count2,
14874
14903
  /** USD at the public price, summed over the priced requests only. */
14875
14904
  costUsd: external_exports.number().finite().min(0),
14876
14905
  /** Requests without a price (or the cache data the price needs); not in `costUsd`. */
14877
- unpricedRequests: count,
14906
+ unpricedRequests: count2,
14878
14907
  /**
14879
14908
  * Requests whose storage gave no token counts: counted as requests, with neither tokens nor
14880
14909
  * cost, and not as unpriced.
14881
14910
  */
14882
- unmeteredRequests: count
14911
+ unmeteredRequests: count2
14883
14912
  });
14884
14913
  var totals = usageStatisticsTotalsSchema.shape;
14885
14914
  var usageStatisticsSessionSchema = external_exports.strictObject({
@@ -14890,8 +14919,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
14890
14919
  title: external_exports.string().min(1).max(200).optional(),
14891
14920
  /** Models the session used, most requests first. */
14892
14921
  models: external_exports.array(model).max(16),
14893
- firstAtMs: count,
14894
- lastAtMs: count,
14922
+ firstAtMs: count2,
14923
+ lastAtMs: count2,
14895
14924
  ...totals
14896
14925
  });
14897
14926
  var usageStatisticsResultSchema = external_exports.strictObject({
@@ -14909,7 +14938,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14909
14938
  date: localDate.nullable()
14910
14939
  }),
14911
14940
  /** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
14912
- reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
14941
+ reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count2, read: count2 }),
14913
14942
  /** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
14914
14943
  failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
14915
14944
  /** Every value seen in the range, ignoring the filters, to choose filters from. */
@@ -14929,8 +14958,8 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14929
14958
  harness,
14930
14959
  model: model.nullable(),
14931
14960
  credits: external_exports.number().finite().min(0),
14932
- reportedRequests: count,
14933
- requests: count
14961
+ reportedRequests: count2,
14962
+ requests: count2
14934
14963
  })).max(4096).optional(),
14935
14964
  /** All filters applied. */
14936
14965
  totals: usageStatisticsTotalsSchema,
@@ -14947,7 +14976,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14947
14976
  model: model.nullable(),
14948
14977
  ...totals,
14949
14978
  /** Requests priced by what the Harness recorded they cost, not by a price list. */
14950
- harnessPricedRequests: count
14979
+ harnessPricedRequests: count2
14951
14980
  })).max(4096),
14952
14981
  byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
14953
14982
  /**
@@ -15561,7 +15590,9 @@ var harnessModelCatalogSchema = external_exports.object({
15561
15590
  var harnessHistoryCapabilitiesSchema = external_exports.object({
15562
15591
  fork: external_exports.boolean(),
15563
15592
  forkAcrossCwd: external_exports.boolean(),
15564
- rollbackLastTurn: external_exports.boolean()
15593
+ rollbackLastTurn: external_exports.boolean(),
15594
+ /** Remove the selected checkpoint's Turn and every later Turn, without restoring files. */
15595
+ rollbackToCheckpoint: external_exports.boolean().optional()
15565
15596
  }).strict().refine((history2) => history2.fork || !history2.forkAcrossCwd, {
15566
15597
  path: ["forkAcrossCwd"],
15567
15598
  message: "Cross-cwd Fork requires exact history Fork support"
@@ -15799,7 +15830,10 @@ var harnessPluginRouteSchema = external_exports.object({
15799
15830
  harnessId: harnessPluginIdSchema,
15800
15831
  model: harnessModelRefSchema.optional(),
15801
15832
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15802
- permissionModeId: harnessPermissionModeIdSchema.optional()
15833
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
15834
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
15835
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
15836
+ prewarm: external_exports.literal(true).optional()
15803
15837
  }).strict();
15804
15838
 
15805
15839
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -19698,6 +19732,8 @@ var ZcodeSession = class {
19698
19732
  #faulted = false;
19699
19733
  #configuring = false;
19700
19734
  #goalActive = false;
19735
+ #goalControl = false;
19736
+ #goalMessages = [];
19701
19737
  #lastSeq = 0;
19702
19738
  #closePromise;
19703
19739
  #terminalTask;
@@ -19721,8 +19757,11 @@ var ZcodeSession = class {
19721
19757
  get sessionId() {
19722
19758
  return this.#snapshot.session.sessionId;
19723
19759
  }
19760
+ hasBackgroundWork() {
19761
+ return this.#goalActive;
19762
+ }
19724
19763
  get busy() {
19725
- return Boolean(this.#active || this.#configuring || this.isLocked());
19764
+ return Boolean(this.#active || this.#configuring || this.#goalControl || this.isLocked());
19726
19765
  }
19727
19766
  #emit(event) {
19728
19767
  this.#channel.emit({ kind: "event", event });
@@ -19919,17 +19958,75 @@ var ZcodeSession = class {
19919
19958
  return failure("invalidRequest", "ZCode command arguments must contain only text");
19920
19959
  try {
19921
19960
  const argument = text(command.arguments?.text);
19922
- return await this.#start(command.turnId, command.commandId === "compact" ? "compactSession" : "goalSession", command.commandId === "compact" ? { inputId: command.turnId, ...argument ? { instructions: argument } : {} } : { inputId: command.turnId, ...goalArguments(argument) });
19961
+ if (command.commandId === "goal")
19962
+ return await this.#controlGoal(command, argument);
19963
+ return await this.#start(command.turnId, "compactSession", {
19964
+ inputId: command.turnId,
19965
+ ...argument ? { instructions: argument } : {}
19966
+ });
19923
19967
  } catch (error51) {
19924
19968
  return { ok: false, error: nativeError(error51) };
19925
19969
  }
19926
19970
  }
19971
+ async #controlGoal(command, argument) {
19972
+ if (this.busy)
19973
+ return failure("sessionBusy", "ZCode goal control is already running", true);
19974
+ this.#goalControl = true;
19975
+ const params = goalArguments(argument);
19976
+ const previous = this.#goalActive;
19977
+ if (["set", "replace", "resume"].includes(params.action ?? ""))
19978
+ this.#goalActive = true;
19979
+ this.#emit({ type: "turn.started", turnId: command.turnId });
19980
+ try {
19981
+ const result = record2(await this.transport.request("goalSession", {
19982
+ sessionId: this.sessionId,
19983
+ inputId: command.turnId,
19984
+ ...params
19985
+ }));
19986
+ if (this.#closed || this.#faulted)
19987
+ throw new ZcodeError("invalidState", "ZCode closed during goal control");
19988
+ if (result.snapshot)
19989
+ this.#apply(snapshotSchema.parse(result.snapshot));
19990
+ const response = text(result.response);
19991
+ if (response) {
19992
+ const item = {
19993
+ type: "agentMessage",
19994
+ itemId: hostItemIdSchema.parse(`command:${command.turnId}`),
19995
+ text: response
19996
+ };
19997
+ this.#emit({ type: "item.started", turnId: command.turnId, item });
19998
+ this.#emit({
19999
+ type: "item.completed",
20000
+ turnId: command.turnId,
20001
+ snapshot: { item, outcome: { status: "succeeded" } }
20002
+ });
20003
+ }
20004
+ this.#emit({
20005
+ type: "turn.completed",
20006
+ turnId: command.turnId,
20007
+ ephemeral: true,
20008
+ outcome: { status: "succeeded" }
20009
+ });
20010
+ return { ok: true, value: { turnId: command.turnId } };
20011
+ } catch (error51) {
20012
+ this.#goalActive = previous;
20013
+ const normalized = nativeError(error51);
20014
+ this.#emit({
20015
+ type: "turn.completed",
20016
+ turnId: command.turnId,
20017
+ ephemeral: true,
20018
+ outcome: { status: "failed", error: normalized }
20019
+ });
20020
+ return { ok: true, value: { turnId: command.turnId } };
20021
+ } finally {
20022
+ this.#goalControl = false;
20023
+ for (const message of this.#goalMessages.splice(0))
20024
+ this.#message(message);
20025
+ }
20026
+ }
19927
20027
  async #start(id, method, params) {
19928
20028
  if (this.busy)
19929
20029
  return failure("sessionBusy", "ZCode already has an active operation", true);
19930
- const previousGoalActive = this.#goalActive;
19931
- if (method === "goalSession" && ["set", "replace", "resume"].includes(text(params.action)))
19932
- this.#goalActive = true;
19933
20030
  const active = {
19934
20031
  id,
19935
20032
  accepted: false,
@@ -19938,13 +20035,14 @@ var ZcodeSession = class {
19938
20035
  projection: new TurnProjection(id, this.transport.options.cwd, (event) => this.#emit(event))
19939
20036
  };
19940
20037
  this.#active = active;
19941
- let result;
19942
20038
  try {
19943
- result = record2(method === "sendText" ? await this.transport.command(this.sessionId, "sendText", params, id) : await this.transport.request(method, { sessionId: this.sessionId, ...params }));
20039
+ if (method === "sendText")
20040
+ await this.transport.command(this.sessionId, "sendText", params, id);
20041
+ else
20042
+ await this.transport.request(method, { sessionId: this.sessionId, ...params });
19944
20043
  } catch (error51) {
19945
20044
  if (this.#active === active)
19946
20045
  this.#active = void 0;
19947
- this.#goalActive = previousGoalActive;
19948
20046
  throw error51;
19949
20047
  }
19950
20048
  if (this.#closed || this.#faulted)
@@ -19953,26 +20051,15 @@ var ZcodeSession = class {
19953
20051
  this.#emit({ type: "turn.started", turnId: id });
19954
20052
  for (const message of active.pending.splice(0))
19955
20053
  this.#message(message);
19956
- if (method === "goalSession" && result.startedTurn !== true) {
19957
- const response = text(result.response);
19958
- if (response)
19959
- active.projection.complete({
19960
- item: {
19961
- type: "agentMessage",
19962
- itemId: hostItemIdSchema.parse(`command:${id}`),
19963
- text: response
19964
- },
19965
- outcome: { status: "succeeded" }
19966
- });
19967
- if (result.snapshot)
19968
- this.#apply(snapshotSchema.parse(result.snapshot));
19969
- this.#finish(active, { status: "succeeded" });
19970
- }
19971
20054
  return { ok: true, value: { turnId: id } };
19972
20055
  }
19973
20056
  #message(message) {
19974
20057
  if (this.#closed || this.#faulted)
19975
20058
  return;
20059
+ if (this.#goalControl && !this.#active) {
20060
+ this.#goalMessages.push(message);
20061
+ return;
20062
+ }
19976
20063
  const p = record2(message.params);
19977
20064
  if (message.requestId !== void 0) {
19978
20065
  if (!this.#active || p.sessionId !== this.sessionId) {
@@ -20280,6 +20367,16 @@ var ZcodeAdapter = class {
20280
20367
  }
20281
20368
  }
20282
20369
  async open(input) {
20370
+ if (input.kind === "rollbackToCheckpoint") {
20371
+ return {
20372
+ ok: false,
20373
+ error: {
20374
+ code: "unsupported",
20375
+ message: "Checkpoint rollback is not supported by this Adapter",
20376
+ retryable: false
20377
+ }
20378
+ };
20379
+ }
20283
20380
  if (input.kind === "fork" || input.kind === "rollbackLastTurn")
20284
20381
  return failure("unsupported", "ZCode history derivation is not enabled for the ZCode Adapter");
20285
20382
  const parsedRef = input.kind === "resume" ? nativeSessionRefSchema.safeParse(input.nativeRef) : void 0;