@karlorz/codexhost-cli-darwin-x64 0.13.3-7 → 0.14.0-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.
@@ -15202,10 +15202,19 @@ var model = external_exports.string().min(1).max(512);
15202
15202
  var project = external_exports.string().min(1).max(4096);
15203
15203
  var usageStatisticsParamsSchema = external_exports.strictObject({
15204
15204
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
15205
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
15206
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
15207
+ try {
15208
+ new Intl.DateTimeFormat("en", { timeZone: value });
15209
+ return true;
15210
+ } catch {
15211
+ return false;
15212
+ }
15213
+ }, "Unsupported usage statistics timezone").optional(),
15205
15214
  harness: harness.optional(),
15206
15215
  model: model.nullable().optional(),
15207
15216
  project: project.nullable().optional(),
15208
- /** One local date inside the range. */
15217
+ /** One date in the query timezone inside the range. */
15209
15218
  date: localDate.optional()
15210
15219
  });
15211
15220
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -15241,7 +15250,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
15241
15250
  });
15242
15251
  var usageStatisticsResultSchema = external_exports.strictObject({
15243
15252
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
15244
- /** First local date of the range; null for all time. */
15253
+ /** First date in the query timezone (Host local when omitted); null for all time. */
15245
15254
  from: localDate.nullable(),
15246
15255
  to: localDate,
15247
15256
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -15281,7 +15290,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15281
15290
  totals: usageStatisticsTotalsSchema,
15282
15291
  /** Each date and Harness of the range: every filter except the day. */
15283
15292
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
15284
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
15293
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
15285
15294
  hourly: external_exports.array(external_exports.strictObject({
15286
15295
  weekday: external_exports.number().int().min(0).max(6),
15287
15296
  hour: external_exports.number().int().min(0).max(23),
@@ -15372,6 +15381,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
15372
15381
  "codexhost/harness/display-settings/set",
15373
15382
  "codexhost/harness/inspect",
15374
15383
  "codexhost/harness/installation",
15384
+ "codexhost/harness/installation/start",
15385
+ "codexhost/harness/installation/status",
15375
15386
  "codexhost/harness/launch-settings/get",
15376
15387
  "codexhost/harness/launch-settings/set",
15377
15388
  "codexhost/harness/grok-computer-use/get",
@@ -15449,7 +15460,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
15449
15460
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15450
15461
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15451
15462
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15463
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
15464
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
15465
+ kind: external_exports.literal("countdown"),
15466
+ id: external_exports.string().min(1).max(64),
15467
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
15468
+ label: indicatorTextSchema(256).optional(),
15469
+ tooltip: indicatorTextSchema(1024).optional()
15470
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
15471
+ message: "Composer indicator IDs must be unique"
15472
+ });
15452
15473
  var threadUsageSnapshotSchema = external_exports.object({
15474
+ composerIndicators: composerIndicatorsSchema.optional(),
15453
15475
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
15454
15476
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
15455
15477
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15857,7 +15879,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
15857
15879
  }).strict().optional(),
15858
15880
  autonomousTurns: external_exports.object({
15859
15881
  observe: external_exports.boolean()
15860
- }).strict().optional()
15882
+ }).strict().optional(),
15883
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15884
+ steer: external_exports.boolean().optional()
15861
15885
  }).strict();
15862
15886
  var harnessConfigurationStateSchema = external_exports.object({
15863
15887
  effectiveModel: harnessModelRefSchema.optional(),
@@ -15989,6 +16013,15 @@ var threadOwnershipListResultSchema = external_exports.object({
15989
16013
  seen.add(thread.threadId);
15990
16014
  }
15991
16015
  });
16016
+ var threadSteeringInspectParamsSchema = external_exports.object({
16017
+ threadId: hostThreadIdSchema,
16018
+ /** The text about to be steered; a Harness command always stops and restarts. */
16019
+ text: external_exports.string().optional()
16020
+ }).strict();
16021
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
16022
+ var threadSteeringInspectResultSchema = external_exports.object({
16023
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
16024
+ }).strict();
15992
16025
 
15993
16026
  // ../../shared-contracts/dist/harness-plugins.js
15994
16027
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
@@ -16110,6 +16143,10 @@ var harnessInstallationStateSchema = external_exports.object({
16110
16143
  latestVersion: external_exports.string().min(1).max(128),
16111
16144
  updateAvailable: external_exports.boolean(),
16112
16145
  canUpdate: external_exports.boolean(),
16146
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
16147
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
16148
+ /** Official download opened by the user; does not imply an automatic installation. */
16149
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
16113
16150
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
16114
16151
  message: external_exports.string().max(2048).optional(),
16115
16152
  messageCode: external_exports.string().min(1).max(128).optional(),
@@ -16117,6 +16154,20 @@ var harnessInstallationStateSchema = external_exports.object({
16117
16154
  notice: harnessLocalizedTextSchema.optional(),
16118
16155
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
16119
16156
  }).strict();
16157
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
16158
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
16159
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
16160
+ external_exports.object({
16161
+ taskId: external_exports.string().uuid(),
16162
+ status: external_exports.literal("succeeded"),
16163
+ result: harnessInstallationStateSchema
16164
+ }).strict(),
16165
+ external_exports.object({
16166
+ taskId: external_exports.string().uuid(),
16167
+ status: external_exports.literal("failed"),
16168
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
16169
+ }).strict()
16170
+ ]);
16120
16171
 
16121
16172
  // ../../shared-contracts/dist/codex-accounts.js
16122
16173
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -16948,6 +16999,18 @@ function sanitizeDiagnosticTail(value) {
16948
16999
  return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
16949
17000
  }
16950
17001
 
17002
+ // ../../harness-adapter/dist/steer.js
17003
+ function unsupportedSteer(harnessLabel) {
17004
+ return {
17005
+ ok: false,
17006
+ error: {
17007
+ code: "unsupported",
17008
+ message: `${harnessLabel} cannot steer an active Turn natively`,
17009
+ retryable: false
17010
+ }
17011
+ };
17012
+ }
17013
+
16951
17014
  // ../../harness-adapter/dist/usage.js
16952
17015
  var tokenFields = [
16953
17016
  "inputTokens",
@@ -16975,6 +17038,7 @@ var usageFields = /* @__PURE__ */ new Set([
16975
17038
  ...safeIntegerFields,
16976
17039
  ...percentFields,
16977
17040
  "sessionCacheUsage",
17041
+ "composerIndicators",
16978
17042
  "totalCostUsd",
16979
17043
  "totalCredits",
16980
17044
  "contextUsagePercent",
@@ -16997,6 +17061,7 @@ function parseHostUsage(value) {
16997
17061
  throw new Error(`Harness Usage contains unknown field '${key}'`);
16998
17062
  }
16999
17063
  }
17064
+ const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
17000
17065
  for (const field of [
17001
17066
  "totalCredits",
17002
17067
  "contextUsagePercent",
@@ -17067,9 +17132,9 @@ function parseHostUsage(value) {
17067
17132
  if (value.costSource !== "publicPrice") {
17068
17133
  throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
17069
17134
  }
17070
- return { ...value, unpricedModels: [...models] };
17135
+ return { ...value, ...indicators, unpricedModels: [...models] };
17071
17136
  }
17072
- return { ...value };
17137
+ return { ...value, ...indicators };
17073
17138
  }
17074
17139
  var requestTokenFields = [
17075
17140
  "inputTokens",
@@ -18732,9 +18797,32 @@ function snapshotItems(entries, outcome, subagents, cwd) {
18732
18797
  function modelChange(entry) {
18733
18798
  return entry.type === "model_change" && typeof entry.provider === "string" && typeof entry.modelId === "string" ? { provider: entry.provider, id: entry.modelId } : null;
18734
18799
  }
18800
+ function turnStarts(active) {
18801
+ const starts = [];
18802
+ let terminal = true;
18803
+ let pending = null;
18804
+ for (const [index, entry] of active.entries()) {
18805
+ const role = messageRole(entry);
18806
+ if (role === "user") {
18807
+ starts.push({ entry, index });
18808
+ pending = null;
18809
+ terminal = false;
18810
+ } else if ((entry.type === "custom_message" || role === "custom") && terminal) {
18811
+ pending ??= { entry, index };
18812
+ } else if (role === "assistant") {
18813
+ if (pending)
18814
+ starts.push(pending);
18815
+ pending = null;
18816
+ terminal = ["stop", "aborted", "error"].includes(String(message(entry)?.stopReason));
18817
+ }
18818
+ }
18819
+ return starts;
18820
+ }
18735
18821
  function mapPiSnapshot(history, state2, subagents = new PiSubagents(() => void 0)) {
18736
18822
  const active = activePiEntries(history);
18737
18823
  const turns = [];
18824
+ const starts = turnStarts(active);
18825
+ const byIndex = new Map(starts.map((start, ordinal) => [start.index, ordinal]));
18738
18826
  let effectiveModel = state2.model;
18739
18827
  for (let index = 0; index < active.length; ) {
18740
18828
  const model2 = modelChange(active[index]);
@@ -18744,13 +18832,13 @@ function mapPiSnapshot(history, state2, subagents = new PiSubagents(() => void 0
18744
18832
  continue;
18745
18833
  }
18746
18834
  const user = active[index];
18747
- if (messageRole(user) !== "user") {
18835
+ const ordinal = byIndex.get(index);
18836
+ if (ordinal === void 0) {
18748
18837
  index += 1;
18749
18838
  continue;
18750
18839
  }
18751
- let end = index + 1;
18752
- while (end < active.length && messageRole(active[end]) !== "user")
18753
- end += 1;
18840
+ const next = starts[ordinal + 1];
18841
+ const end = next?.index ?? active.length;
18754
18842
  const entries = active.slice(index, end);
18755
18843
  const outcome = assistantOutcome(entries);
18756
18844
  const userText = textContent(message(user)?.content);
@@ -18768,8 +18856,8 @@ function mapPiSnapshot(history, state2, subagents = new PiSubagents(() => void 0
18768
18856
  });
18769
18857
  turns.push({
18770
18858
  nativeTurnRef,
18771
- checkpoint,
18772
- input: [{ type: "text", text: userText }],
18859
+ ...!next || messageRole(next.entry) === "user" ? { checkpoint } : {},
18860
+ input: messageRole(user) === "user" ? [{ type: "text", text: userText }] : [],
18773
18861
  items: snapshotItems(entries, outcome, subagents, state2.cwd),
18774
18862
  outcome,
18775
18863
  ...effectiveModel ? { model: encodePiModelRef(effectiveModel) } : {}
@@ -18784,20 +18872,24 @@ function mapPiSnapshot(history, state2, subagents = new PiSubagents(() => void 0
18784
18872
  return { turns };
18785
18873
  }
18786
18874
  function resolvePiLastTurnBoundary(history) {
18787
- const users = activePiEntries(history).filter((entry) => messageRole(entry) === "user");
18788
- const last = users.at(-1);
18789
- return last ? { lastUserEntryId: last.id, sourceTurnCount: users.length } : null;
18875
+ const starts = turnStarts(activePiEntries(history));
18876
+ const last = starts.at(-1)?.entry;
18877
+ return last ? {
18878
+ lastUserEntryId: messageRole(last) === "user" ? last.id : null,
18879
+ sourceTurnCount: starts.length
18880
+ } : null;
18790
18881
  }
18791
18882
  function resolvePiForkBoundary(history, checkpointId) {
18792
18883
  const active = activePiEntries(history);
18793
- const users = active.filter((entry) => messageRole(entry) === "user");
18794
- const targetTurnIndex = users.findIndex((entry) => entry.id === checkpointId);
18884
+ const starts = turnStarts(active);
18885
+ const targetTurnIndex = starts.findIndex(({ entry }) => entry.id === checkpointId);
18795
18886
  if (targetTurnIndex < 0)
18796
18887
  throw new Error("Pi Checkpoint is not on the active branch");
18797
- return {
18798
- targetTurnIndex,
18799
- nextUserEntryId: users[targetTurnIndex + 1]?.id ?? null
18800
- };
18888
+ const next = starts[targetTurnIndex + 1]?.entry;
18889
+ if (next && messageRole(next) !== "user") {
18890
+ throw new Error("Pi cannot Fork immediately before a custom-triggered Turn");
18891
+ }
18892
+ return { targetTurnIndex, nextUserEntryId: next?.id ?? null };
18801
18893
  }
18802
18894
 
18803
18895
  // dist/pi-usage.js
@@ -19133,6 +19225,8 @@ import { pathToFileURL } from "node:url";
19133
19225
  import fs2 from "node:fs";
19134
19226
  import { homedir as homedir3, tmpdir as tmpdir2 } from "node:os";
19135
19227
  import path8 from "node:path";
19228
+ var PI_PACKAGE_NAME = "@earendil-works/pi-coding-agent";
19229
+ var PI_PACKAGE_PATH = path8.join("node_modules", "@earendil-works", "pi-coding-agent");
19136
19230
  var piDiscoverySpec = {
19137
19231
  id: "pi",
19138
19232
  command: "pi",
@@ -19157,6 +19251,43 @@ function resolvePiExecutable(input, dependencies = {}) {
19157
19251
  }, { ...dependencies.isExecutable ? { isExecutable: dependencies.isExecutable } : {} });
19158
19252
  return resolution?.executable ?? input.command ?? input.environment.PI_COMMAND ?? "pi";
19159
19253
  }
19254
+ function findPiPackageDirectory(executable) {
19255
+ let directory = path8.dirname(executable);
19256
+ while (true) {
19257
+ for (const candidate of [directory, path8.join(directory, PI_PACKAGE_PATH)]) {
19258
+ try {
19259
+ const manifest = JSON.parse(fs2.readFileSync(path8.join(candidate, "package.json"), "utf8"));
19260
+ if (typeof manifest === "object" && manifest !== null && "name" in manifest && manifest.name === PI_PACKAGE_NAME) {
19261
+ return candidate;
19262
+ }
19263
+ } catch {
19264
+ }
19265
+ }
19266
+ const parent = path8.dirname(directory);
19267
+ if (parent === directory)
19268
+ return void 0;
19269
+ directory = parent;
19270
+ }
19271
+ }
19272
+ function findPiCliEntry(packageDirectory) {
19273
+ try {
19274
+ const manifest = JSON.parse(fs2.readFileSync(path8.join(packageDirectory, "package.json"), "utf8"));
19275
+ if (typeof manifest !== "object" || manifest === null || !("bin" in manifest))
19276
+ return void 0;
19277
+ const bin = manifest.bin;
19278
+ const entry = typeof bin === "string" ? bin : typeof bin === "object" && bin !== null && "pi" in bin ? bin.pi : void 0;
19279
+ if (typeof entry !== "string" || !entry.trim())
19280
+ return void 0;
19281
+ const resolved = path8.resolve(packageDirectory, entry);
19282
+ const relative = path8.relative(packageDirectory, resolved);
19283
+ if (relative === ".." || relative.startsWith(`..${path8.sep}`) || path8.isAbsolute(relative) || !fs2.statSync(resolved).isFile()) {
19284
+ return void 0;
19285
+ }
19286
+ return resolved;
19287
+ } catch {
19288
+ return void 0;
19289
+ }
19290
+ }
19160
19291
  function isFilesystemRoot(cwd) {
19161
19292
  const resolved = path8.resolve(cwd);
19162
19293
  return resolved === path8.parse(resolved).root;
@@ -19246,19 +19377,10 @@ function removeOwnedFiles(dir) {
19246
19377
  }
19247
19378
  async function installation(command, environment, authPath) {
19248
19379
  const executable = await realpath2(resolvePiExecutable({ ...command ? { command } : {}, environment }));
19249
- let directory = path9.dirname(executable);
19250
- while (true) {
19251
- const manifest = path9.join(directory, "package.json");
19252
- if (existsSync(manifest)) {
19253
- const pkg = JSON.parse(readFileSync(manifest, "utf8"));
19254
- if (pkg.name === "@earendil-works/pi-coding-agent")
19255
- break;
19256
- }
19257
- const parent = path9.dirname(directory);
19258
- if (parent === directory)
19259
- throw new Error("Pi credential import requires a supported npm Pi installation");
19260
- directory = parent;
19261
- }
19380
+ const directory = findPiPackageDirectory(executable);
19381
+ const cliEntry = directory ? findPiCliEntry(directory) : void 0;
19382
+ if (!directory || !cliEntry)
19383
+ throw new Error("Pi credential import requires a supported npm Pi installation");
19262
19384
  const storage = await import(pathToFileURL(path9.join(directory, "dist/core/auth-storage.js")).href);
19263
19385
  const ai = path9.join(directory, "node_modules/@earendil-works/pi-ai/dist");
19264
19386
  const all = await import(pathToFileURL(path9.join(ai, "providers/all.js")).href);
@@ -19278,7 +19400,7 @@ async function installation(command, environment, authPath) {
19278
19400
  providerModules,
19279
19401
  reservedNames: providers.map((p) => typeof p === "string" ? p : p.id),
19280
19402
  async configuredProviderNames() {
19281
- const { stdout } = await promisify(execFile2)(process.execPath, [executable, "--offline", "--no-approve", "--list-models"], {
19403
+ const { stdout } = await promisify(execFile2)(process.execPath, [cliEntry, "--offline", "--no-approve", "--list-models"], {
19282
19404
  cwd: existsSync(path9.dirname(authPath)) ? path9.dirname(authPath) : os4.homedir(),
19283
19405
  env: { ...environment, PI_CODING_AGENT_DIR: path9.dirname(authPath), PI_OFFLINE: "1" },
19284
19406
  timeout: 15e3,
@@ -19943,6 +20065,8 @@ async function rollbackPiLastTurn(transport, sourceSessionId, cwd) {
19943
20065
  const boundary = resolvePiLastTurnBoundary(copiedHistory);
19944
20066
  if (!boundary)
19945
20067
  return { ok: false, reason: "empty" };
20068
+ if (!boundary.lastUserEntryId)
20069
+ return { ok: false, reason: "unsupported" };
19946
20070
  const sourceSnapshot = mapPiSnapshot(copiedHistory, {
19947
20071
  sessionId: startupSessionId,
19948
20072
  model: currentModel
@@ -20909,7 +21033,8 @@ var PiRpcSession = class {
20909
21033
  const active = {
20910
21034
  origin: "autonomous",
20911
21035
  autonomousEvents: events,
20912
- nativeTurnKey: assistantMessageId(value) ?? randomUUID5(),
21036
+ ...isRecord8(value) ? { autonomousMessage: value } : {},
21037
+ nativeTurnKey: null,
20913
21038
  nativeCancellationObserved: false,
20914
21039
  text: "",
20915
21040
  assistantMessageId: null,
@@ -20935,7 +21060,7 @@ var PiRpcSession = class {
20935
21060
  }
20936
21061
  #emitAutonomousTurn(active, result) {
20937
21062
  const handler = this.#autonomousTurnHandler;
20938
- if (active.origin !== "autonomous" || !active.nativeTurnKey || !active.autonomousEvents || !handler) {
21063
+ if (active.origin !== "autonomous" || !active.autonomousEvents || !handler) {
20939
21064
  return;
20940
21065
  }
20941
21066
  try {
@@ -21095,6 +21220,23 @@ var PiRpcSession = class {
21095
21220
  if (parseSessionStreaming(response)) {
21096
21221
  throw new PiRpcFaultError("protocolError", "Pi RPC agent_settled state is still Streaming");
21097
21222
  }
21223
+ if (this.#activeTurn !== active)
21224
+ return;
21225
+ if (active.origin === "autonomous") {
21226
+ const history = await this.getEntries();
21227
+ const snapshot = mapPiSnapshot(history, { sessionId: state2.sessionId, model: null });
21228
+ const turn = snapshot.turns.at(-1);
21229
+ const entries = activePiEntries(history);
21230
+ const start = entries.findIndex((entry) => entry.id === turn?.nativeTurnRef.nativeTurnKey);
21231
+ const firstAssistant = entries.slice(start + 1).find((entry) => isRecord8(entry.message) && entry.message.role === "assistant")?.message;
21232
+ const live = active.autonomousMessage;
21233
+ const responseId = assistantMessageId(live);
21234
+ const matches = isRecord8(firstAssistant) && (responseId ? assistantMessageId(firstAssistant) === responseId : typeof live?.timestamp === "number" && firstAssistant.timestamp === live.timestamp);
21235
+ if (!turn || turn.input.length !== 0 || !matches) {
21236
+ throw new PiRpcFaultError("protocolError", "Pi autonomous Turn has no matching persisted custom Entry");
21237
+ }
21238
+ active.nativeTurnKey = turn.nativeTurnRef.nativeTurnKey;
21239
+ }
21098
21240
  if (this.#activeTurn !== active)
21099
21241
  return;
21100
21242
  this.#state = state2;
@@ -21634,6 +21776,8 @@ var PiHarnessSession = class {
21634
21776
  if (this.#phase !== "open") {
21635
21777
  return { ok: false, error: invalidState("Pi Session is not open") };
21636
21778
  }
21779
+ if (command.type === "turn.steer")
21780
+ return unsupportedSteer("Pi");
21637
21781
  if (command.type === "turn.cancel")
21638
21782
  return this.#cancel(command);
21639
21783
  if (command.type === "interaction.respond")
@@ -22253,12 +22397,18 @@ var PiHarnessSession = class {
22253
22397
  completion,
22254
22398
  resolveCompletion
22255
22399
  };
22256
- const nativeTurnRef = nativeTurnRefSchema.parse({
22400
+ const nativeTurnRef = turn.nativeTurnKey ? nativeTurnRefSchema.parse({
22257
22401
  harnessId: this.harnessId,
22258
22402
  nativeSessionId: transport.state.sessionId,
22259
22403
  nativeTurnKey: turn.nativeTurnKey,
22260
22404
  formatVersion: 1
22261
- });
22405
+ }) : void 0;
22406
+ const checkpoint = nativeTurnRef ? nativeCheckpointRefSchema.parse({
22407
+ harnessId: this.harnessId,
22408
+ nativeSessionId: transport.state.sessionId,
22409
+ checkpointId: nativeTurnRef.nativeTurnKey,
22410
+ formatVersion: 1
22411
+ }) : void 0;
22262
22412
  this.#active = active;
22263
22413
  this.#event({ type: "turn.autonomous.started", turnId, input: [] });
22264
22414
  this.#event({ type: "turn.started", turnId });
@@ -22267,11 +22417,21 @@ var PiHarnessSession = class {
22267
22417
  for (const event of turn.events)
22268
22418
  this.#handleTurnEvent(active, event);
22269
22419
  if (turn.result.status === "succeeded") {
22270
- this.#completeTurn(active, { status: "succeeded" }, turn.result.text, nativeTurnRef);
22420
+ if (!nativeTurnRef)
22421
+ throw new Error("Pi autonomous Turn has no native identity");
22422
+ this.#completeTurn(active, { status: "succeeded", ...checkpoint ? { checkpoint } : {} }, turn.result.text, nativeTurnRef);
22271
22423
  } else if (turn.result.status === "cancelled") {
22272
- this.#completeTurn(active, { status: "cancelled", reason: turn.result.reason }, turn.result.text, nativeTurnRef);
22424
+ this.#completeTurn(active, {
22425
+ status: "cancelled",
22426
+ reason: turn.result.reason,
22427
+ ...checkpoint ? { checkpoint } : {}
22428
+ }, turn.result.text, nativeTurnRef);
22273
22429
  } else {
22274
- this.#completeTurn(active, { status: "failed", error: normalizedError(turn.result.error, "nativeFailure") }, turn.result.text, nativeTurnRef);
22430
+ this.#completeTurn(active, {
22431
+ status: "failed",
22432
+ error: normalizedError(turn.result.error, "nativeFailure"),
22433
+ ...checkpoint ? { checkpoint } : {}
22434
+ }, turn.result.text, nativeTurnRef);
22275
22435
  }
22276
22436
  } catch (error51) {
22277
22437
  const normalized = normalizedError(error51, "protocolError");
@@ -23081,8 +23241,8 @@ var PiAdapter = class {
23081
23241
  const rolledBack = await rollbackPiLastTurn(transport, sourceRef.nativeSessionId, input.cwd);
23082
23242
  if (!rolledBack.ok) {
23083
23243
  throw new PiAdapterFaultError({
23084
- code: "invalidState",
23085
- message: "Pi Native Session has no Turn to roll back",
23244
+ code: rolledBack.reason === "unsupported" ? "unsupported" : "invalidState",
23245
+ message: rolledBack.reason === "unsupported" ? "Pi cannot roll back a custom-triggered Turn at an exact native boundary" : "Pi Native Session has no Turn to roll back",
23086
23246
  retryable: false
23087
23247
  });
23088
23248
  }
@@ -27648,10 +27648,19 @@ var model = external_exports.string().min(1).max(512);
27648
27648
  var project = external_exports.string().min(1).max(4096);
27649
27649
  var usageStatisticsParamsSchema = external_exports.strictObject({
27650
27650
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
27651
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
27652
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
27653
+ try {
27654
+ new Intl.DateTimeFormat("en", { timeZone: value });
27655
+ return true;
27656
+ } catch {
27657
+ return false;
27658
+ }
27659
+ }, "Unsupported usage statistics timezone").optional(),
27651
27660
  harness: harness.optional(),
27652
27661
  model: model.nullable().optional(),
27653
27662
  project: project.nullable().optional(),
27654
- /** One local date inside the range. */
27663
+ /** One date in the query timezone inside the range. */
27655
27664
  date: localDate.optional()
27656
27665
  });
27657
27666
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -27687,7 +27696,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
27687
27696
  });
27688
27697
  var usageStatisticsResultSchema = external_exports.strictObject({
27689
27698
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
27690
- /** First local date of the range; null for all time. */
27699
+ /** First date in the query timezone (Host local when omitted); null for all time. */
27691
27700
  from: localDate.nullable(),
27692
27701
  to: localDate,
27693
27702
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -27727,7 +27736,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
27727
27736
  totals: usageStatisticsTotalsSchema,
27728
27737
  /** Each date and Harness of the range: every filter except the day. */
27729
27738
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
27730
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
27739
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
27731
27740
  hourly: external_exports.array(external_exports.strictObject({
27732
27741
  weekday: external_exports.number().int().min(0).max(6),
27733
27742
  hour: external_exports.number().int().min(0).max(23),
@@ -27818,6 +27827,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
27818
27827
  "codexhost/harness/display-settings/set",
27819
27828
  "codexhost/harness/inspect",
27820
27829
  "codexhost/harness/installation",
27830
+ "codexhost/harness/installation/start",
27831
+ "codexhost/harness/installation/status",
27821
27832
  "codexhost/harness/launch-settings/get",
27822
27833
  "codexhost/harness/launch-settings/set",
27823
27834
  "codexhost/harness/grok-computer-use/get",
@@ -27895,7 +27906,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
27895
27906
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
27896
27907
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
27897
27908
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
27909
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
27910
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
27911
+ kind: external_exports.literal("countdown"),
27912
+ id: external_exports.string().min(1).max(64),
27913
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
27914
+ label: indicatorTextSchema(256).optional(),
27915
+ tooltip: indicatorTextSchema(1024).optional()
27916
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
27917
+ message: "Composer indicator IDs must be unique"
27918
+ });
27898
27919
  var threadUsageSnapshotSchema = external_exports.object({
27920
+ composerIndicators: composerIndicatorsSchema.optional(),
27899
27921
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
27900
27922
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
27901
27923
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -28303,7 +28325,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
28303
28325
  }).strict().optional(),
28304
28326
  autonomousTurns: external_exports.object({
28305
28327
  observe: external_exports.boolean()
28306
- }).strict().optional()
28328
+ }).strict().optional(),
28329
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
28330
+ steer: external_exports.boolean().optional()
28307
28331
  }).strict();
28308
28332
  var harnessConfigurationStateSchema = external_exports.object({
28309
28333
  effectiveModel: harnessModelRefSchema.optional(),
@@ -28435,6 +28459,15 @@ var threadOwnershipListResultSchema = external_exports.object({
28435
28459
  seen.add(thread.threadId);
28436
28460
  }
28437
28461
  });
28462
+ var threadSteeringInspectParamsSchema = external_exports.object({
28463
+ threadId: hostThreadIdSchema,
28464
+ /** The text about to be steered; a Harness command always stops and restarts. */
28465
+ text: external_exports.string().optional()
28466
+ }).strict();
28467
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
28468
+ var threadSteeringInspectResultSchema = external_exports.object({
28469
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
28470
+ }).strict();
28438
28471
 
28439
28472
  // ../../shared-contracts/dist/harness-plugins.js
28440
28473
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
@@ -28556,6 +28589,10 @@ var harnessInstallationStateSchema = external_exports.object({
28556
28589
  latestVersion: external_exports.string().min(1).max(128),
28557
28590
  updateAvailable: external_exports.boolean(),
28558
28591
  canUpdate: external_exports.boolean(),
28592
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
28593
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
28594
+ /** Official download opened by the user; does not imply an automatic installation. */
28595
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
28559
28596
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
28560
28597
  message: external_exports.string().max(2048).optional(),
28561
28598
  messageCode: external_exports.string().min(1).max(128).optional(),
@@ -28563,6 +28600,20 @@ var harnessInstallationStateSchema = external_exports.object({
28563
28600
  notice: harnessLocalizedTextSchema.optional(),
28564
28601
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
28565
28602
  }).strict();
28603
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
28604
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
28605
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
28606
+ external_exports.object({
28607
+ taskId: external_exports.string().uuid(),
28608
+ status: external_exports.literal("succeeded"),
28609
+ result: harnessInstallationStateSchema
28610
+ }).strict(),
28611
+ external_exports.object({
28612
+ taskId: external_exports.string().uuid(),
28613
+ status: external_exports.literal("failed"),
28614
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
28615
+ }).strict()
28616
+ ]);
28566
28617
 
28567
28618
  // ../../shared-contracts/dist/codex-accounts.js
28568
28619
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -29362,6 +29413,18 @@ var HarnessOutputChannel = class {
29362
29413
  }
29363
29414
  };
29364
29415
 
29416
+ // ../../harness-adapter/dist/steer.js
29417
+ function unsupportedSteer(harnessLabel) {
29418
+ return {
29419
+ ok: false,
29420
+ error: {
29421
+ code: "unsupported",
29422
+ message: `${harnessLabel} cannot steer an active Turn natively`,
29423
+ retryable: false
29424
+ }
29425
+ };
29426
+ }
29427
+
29365
29428
  // ../../harness-adapter/dist/usage.js
29366
29429
  var tokenFields = [
29367
29430
  "inputTokens",
@@ -29389,6 +29452,7 @@ var usageFields = /* @__PURE__ */ new Set([
29389
29452
  ...safeIntegerFields,
29390
29453
  ...percentFields,
29391
29454
  "sessionCacheUsage",
29455
+ "composerIndicators",
29392
29456
  "totalCostUsd",
29393
29457
  "totalCredits",
29394
29458
  "contextUsagePercent",
@@ -29411,6 +29475,7 @@ function parseHostUsage(value) {
29411
29475
  throw new Error(`Harness Usage contains unknown field '${key}'`);
29412
29476
  }
29413
29477
  }
29478
+ const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
29414
29479
  for (const field of [
29415
29480
  "totalCredits",
29416
29481
  "contextUsagePercent",
@@ -29481,9 +29546,9 @@ function parseHostUsage(value) {
29481
29546
  if (value.costSource !== "publicPrice") {
29482
29547
  throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
29483
29548
  }
29484
- return { ...value, unpricedModels: [...models] };
29549
+ return { ...value, ...indicators, unpricedModels: [...models] };
29485
29550
  }
29486
- return { ...value };
29551
+ return { ...value, ...indicators };
29487
29552
  }
29488
29553
  var requestTokenFields = [
29489
29554
  "inputTokens",
@@ -52371,6 +52436,8 @@ var QoderSession = class {
52371
52436
  };
52372
52437
  }
52373
52438
  switch (command.type) {
52439
+ case "turn.steer":
52440
+ return unsupportedSteer("Qoder");
52374
52441
  case "turn.start": {
52375
52442
  if (this.#activeTurn) {
52376
52443
  return {