@codexhost/cli-linux-arm64 0.8.0 → 0.9.1-test.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.
@@ -15046,6 +15046,46 @@ config(en_default());
15046
15046
  // ../../shared-contracts/dist/version.js
15047
15047
  var WORKSPACE_CONTRACT_VERSION = 1;
15048
15048
 
15049
+ // ../../shared-contracts/dist/idle-release.js
15050
+ var IDLE_RELEASE_TIMEOUT_MINUTES_MIN = 5;
15051
+ var IDLE_RELEASE_TIMEOUT_MINUTES_MAX = 1440;
15052
+ var idleReleaseSettingsSchema = external_exports.strictObject({
15053
+ enabled: external_exports.boolean(),
15054
+ timeoutMinutes: external_exports.number().int().min(IDLE_RELEASE_TIMEOUT_MINUTES_MIN).max(IDLE_RELEASE_TIMEOUT_MINUTES_MAX)
15055
+ });
15056
+ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
15057
+ enabled: false,
15058
+ timeoutMinutes: 30
15059
+ });
15060
+
15061
+ // ../../shared-contracts/dist/loaded-sessions.js
15062
+ var loadedSessionStateSchema = external_exports.enum([
15063
+ "idle",
15064
+ "running",
15065
+ "busy",
15066
+ "closing",
15067
+ "failed",
15068
+ "blocked"
15069
+ ]);
15070
+ var loadedSessionReasonSchema = external_exports.enum([
15071
+ "none",
15072
+ "disabled",
15073
+ "timeout",
15074
+ "operation",
15075
+ "background",
15076
+ "identity",
15077
+ "persistence",
15078
+ "closeFailed"
15079
+ ]);
15080
+ var loadedSessionsSchema = external_exports.array(external_exports.strictObject({
15081
+ threadId: external_exports.string(),
15082
+ title: external_exports.string(),
15083
+ harnessId: external_exports.string(),
15084
+ state: loadedSessionStateSchema,
15085
+ reason: loadedSessionReasonSchema,
15086
+ inactiveMs: external_exports.number().nonnegative()
15087
+ }));
15088
+
15049
15089
  // ../../shared-contracts/dist/ids.js
15050
15090
  var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
15051
15091
  message: "Identifier must not be empty or whitespace"
@@ -15596,75 +15636,15 @@ var codexAccountSchema = external_exports.object({
15596
15636
  email: external_exports.string().email().max(320).optional(),
15597
15637
  planType: codexAccountPlanTypeSchema.optional()
15598
15638
  }).strict();
15599
- var codexAccountPhaseSchema = external_exports.enum(["ready", "changing", "unavailable"]);
15600
- var codexAccountPendingOperationSchema = external_exports.object({
15601
- operationId: nonBlankTextSchema3.max(1024),
15602
- kind: external_exports.enum(["login", "switch", "logout", "recovery"])
15603
- }).strict();
15604
- var codexAccountCapabilitiesSchema = external_exports.object({
15605
- manage: external_exports.boolean(),
15606
- switch: external_exports.boolean(),
15607
- login: external_exports.boolean(),
15608
- delete: external_exports.boolean(),
15609
- recover: external_exports.boolean().optional(),
15610
- logout: external_exports.boolean().optional(),
15611
- reason: external_exports.enum([
15612
- "ssh-single-account",
15613
- "unsupported-storage",
15614
- "unsupported-version",
15615
- "recovery-required",
15616
- "keyring-unavailable",
15617
- "migration-required"
15618
- ]).optional()
15619
- }).strict();
15639
+ var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
15620
15640
  var codexAccountListResultSchema = external_exports.object({
15621
15641
  version: external_exports.literal(2),
15622
15642
  currentAccountId: accountIdSchema.nullable(),
15623
15643
  phase: codexAccountPhaseSchema,
15624
15644
  revision: external_exports.number().int().nonnegative(),
15625
15645
  instanceId: nonBlankTextSchema3.max(1024).optional(),
15626
- cleanupRequired: external_exports.boolean().optional(),
15627
- /** Credentials were adopted; other native homes/history remain unmerged. */
15628
- legacyHistoryPreserved: external_exports.boolean().optional(),
15629
- pendingOperation: codexAccountPendingOperationSchema.optional(),
15630
- capabilities: codexAccountCapabilitiesSchema,
15631
- accounts: external_exports.array(codexAccountSchema).max(128)
15632
- }).strict();
15633
- var codexAccountActivateParamsSchema = external_exports.object({ accountId: accountIdSchema }).strict();
15634
- var codexAccountSwitchParamsSchema = external_exports.object({ accountId: accountIdSchema }).strict();
15635
- var codexAccountReadyMutationResultShape = {
15636
- phase: external_exports.literal("ready"),
15637
- revision: external_exports.number().int().nonnegative()
15638
- };
15639
- var codexAccountSwitchResultSchema = external_exports.object({
15640
- currentAccountId: accountIdSchema,
15641
- ...codexAccountReadyMutationResultShape
15646
+ accounts: external_exports.array(codexAccountSchema).max(1)
15642
15647
  }).strict();
15643
- var codexAccountDeleteParamsSchema = external_exports.object({ accountId: accountIdSchema }).strict();
15644
- var codexAccountDeleteResultSchema = external_exports.object({ deletedAccountId: accountIdSchema }).strict();
15645
- var codexAccountLoginStartParamsSchema = external_exports.object({ accountId: accountIdSchema.optional() }).strict();
15646
- var codexAccountLoginStartResultSchema = external_exports.object({
15647
- accountId: accountIdSchema,
15648
- loginId: nonBlankTextSchema3.max(1024),
15649
- verificationUrl: external_exports.string().url().max(16384),
15650
- userCode: nonBlankTextSchema3.max(1024)
15651
- }).strict();
15652
- var codexAccountLoginCancelParamsSchema = external_exports.object({ loginId: nonBlankTextSchema3.max(1024) }).strict();
15653
- var codexAccountLoginCancelResultSchema = external_exports.object({ cancelled: external_exports.boolean() }).strict();
15654
- var codexAccountLoginCompletedSchema = external_exports.object({
15655
- accountId: accountIdSchema,
15656
- loginId: nonBlankTextSchema3.max(1024),
15657
- success: external_exports.boolean(),
15658
- error: external_exports.string().max(4096).nullable(),
15659
- saved: external_exports.boolean().optional(),
15660
- cleanupRequired: external_exports.boolean().optional()
15661
- }).strict();
15662
- var codexAccountLogoutParamsSchema = external_exports.object({}).strict();
15663
- var codexAccountLogoutResultSchema = external_exports.object({
15664
- currentAccountId: external_exports.null(),
15665
- ...codexAccountReadyMutationResultShape
15666
- }).strict();
15667
- var codexAccountRecoverParamsSchema = external_exports.object({}).strict();
15668
15648
  var codexAccountUsageParamsSchema = external_exports.object({ accountId: accountIdSchema, refresh: external_exports.boolean().optional() }).strict();
15669
15649
  var codexAccountUsageResultSchema = external_exports.object({
15670
15650
  accountId: accountIdSchema,
@@ -15673,21 +15653,6 @@ var codexAccountUsageResultSchema = external_exports.object({
15673
15653
  freshness: external_exports.enum(["live", "cached"]),
15674
15654
  observedAt: external_exports.string().datetime().nullable()
15675
15655
  }).strict();
15676
- var codexAccountResetCreditConsumeParamsSchema = external_exports.object({
15677
- accountId: accountIdSchema,
15678
- idempotencyKey: external_exports.string().uuid().optional()
15679
- }).strict();
15680
- var codexAccountResetCreditConsumeOutcomeSchema = external_exports.enum([
15681
- "reset",
15682
- "nothingToReset",
15683
- "noCredit",
15684
- "alreadyRedeemed"
15685
- ]);
15686
- var codexAccountResetCreditConsumeResultSchema = external_exports.object({
15687
- accountId: accountIdSchema,
15688
- outcome: codexAccountResetCreditConsumeOutcomeSchema,
15689
- accountCredits: accountCreditsSnapshotSchema.optional()
15690
- }).strict();
15691
15656
 
15692
15657
  // ../../shared-contracts/dist/harness-session-import.js
15693
15658
  var HARNESS_SESSION_IMPORT_ID_MAX_LENGTH = 1024;
@@ -18644,7 +18609,8 @@ function synthesizeFileChange(kind, args, cwd) {
18644
18609
  {
18645
18610
  path: displayed.path,
18646
18611
  kind: "add",
18647
- unifiedDiff: createTwoFilesPatch(oldHeader2, newHeader2, "", content, "", "", { context: 3 })
18612
+ unifiedDiff: createTwoFilesPatch(oldHeader2, newHeader2, "", content, "", "", { context: 3 }),
18613
+ diffScope: "fragment"
18648
18614
  }
18649
18615
  ];
18650
18616
  }
@@ -18666,7 +18632,8 @@ function synthesizeFileChange(kind, args, cwd) {
18666
18632
  kind: "update",
18667
18633
  unifiedDiff: createTwoFilesPatch(oldHeader, newHeader, oldText, newText, "", "", {
18668
18634
  context: 3
18669
- })
18635
+ }),
18636
+ diffScope: "fragment"
18670
18637
  }
18671
18638
  ];
18672
18639
  }
@@ -19060,7 +19027,7 @@ var OmpHarnessSession = class {
19060
19027
  return this.#closePromise;
19061
19028
  }
19062
19029
  async #selectModel(command) {
19063
- if (this.#acceptingTurn || this.#active || this.#configuring) {
19030
+ if (this.#acceptingTurn || this.#configuring) {
19064
19031
  return {
19065
19032
  ok: false,
19066
19033
  error: {
@@ -19132,7 +19099,7 @@ var OmpHarnessSession = class {
19132
19099
  }
19133
19100
  };
19134
19101
  }
19135
- if (this.#acceptingTurn || this.#active || this.#configuring) {
19102
+ if (this.#acceptingTurn || this.#configuring) {
19136
19103
  return {
19137
19104
  ok: false,
19138
19105
  error: {
@@ -19917,12 +19884,17 @@ var OmpHarnessSession = class {
19917
19884
  try {
19918
19885
  const kind = fileMutatingKind(event.toolName);
19919
19886
  const args = tool.arguments;
19920
- if (kind && synthesizeFileChange(kind, args, this.#cwd)) {
19887
+ if (kind && !patchFromResult(event.result) && synthesizeFileChange(kind, args, this.#cwd)) {
19921
19888
  return;
19922
19889
  }
19923
19890
  const changes = reliableFileChange(event.toolName, args, event.result, this.#cwd);
19924
19891
  if (changes) {
19925
- const fileItem = { type: "fileChange", itemId: this.#newItemId(), changes };
19892
+ const fileItem = {
19893
+ type: "fileChange",
19894
+ itemId: this.#newItemId(),
19895
+ sourceItemIds: [tool.item.itemId],
19896
+ changes
19897
+ };
19926
19898
  this.#event({ type: "item.started", turnId: active.command.turnId, item: fileItem });
19927
19899
  this.#completeItem(active, fileItem, { status: "succeeded" });
19928
19900
  }
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  // dist/opencode-adapter.js
9
9
  import { randomUUID } from "node:crypto";
10
10
  import fs4 from "node:fs";
11
- import path5 from "node:path";
11
+ import path6 from "node:path";
12
12
 
13
13
  // ../../../node_modules/zod/v4/classic/external.js
14
14
  var external_exports = {};
@@ -776,10 +776,10 @@ function mergeDefs(...defs) {
776
776
  function cloneDef(schema) {
777
777
  return mergeDefs(schema._zod.def);
778
778
  }
779
- function getElementAtPath(obj, path6) {
780
- if (!path6)
779
+ function getElementAtPath(obj, path7) {
780
+ if (!path7)
781
781
  return obj;
782
- return path6.reduce((acc, key) => acc?.[key], obj);
782
+ return path7.reduce((acc, key) => acc?.[key], obj);
783
783
  }
784
784
  function promiseAllObject(promisesObj) {
785
785
  const keys = Object.keys(promisesObj);
@@ -1188,11 +1188,11 @@ function explicitlyAborted(x, startIndex = 0) {
1188
1188
  }
1189
1189
  return false;
1190
1190
  }
1191
- function prefixIssues(path6, issues) {
1191
+ function prefixIssues(path7, issues) {
1192
1192
  return issues.map((iss) => {
1193
1193
  var _a3;
1194
1194
  (_a3 = iss).path ?? (_a3.path = []);
1195
- iss.path.unshift(path6);
1195
+ iss.path.unshift(path7);
1196
1196
  return iss;
1197
1197
  });
1198
1198
  }
@@ -1339,16 +1339,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1339
1339
  }
1340
1340
  function formatError(error51, mapper = (issue2) => issue2.message) {
1341
1341
  const fieldErrors = { _errors: [] };
1342
- const processError = (error52, path6 = []) => {
1342
+ const processError = (error52, path7 = []) => {
1343
1343
  for (const issue2 of error52.issues) {
1344
1344
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1345
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
1345
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1346
1346
  } else if (issue2.code === "invalid_key") {
1347
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1347
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1348
1348
  } else if (issue2.code === "invalid_element") {
1349
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1349
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1350
1350
  } else {
1351
- const fullpath = [...path6, ...issue2.path];
1351
+ const fullpath = [...path7, ...issue2.path];
1352
1352
  if (fullpath.length === 0) {
1353
1353
  fieldErrors._errors.push(mapper(issue2));
1354
1354
  } else {
@@ -1375,17 +1375,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1375
1375
  }
1376
1376
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1377
1377
  const result = { errors: [] };
1378
- const processError = (error52, path6 = []) => {
1378
+ const processError = (error52, path7 = []) => {
1379
1379
  var _a3, _b;
1380
1380
  for (const issue2 of error52.issues) {
1381
1381
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1382
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
1382
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1383
1383
  } else if (issue2.code === "invalid_key") {
1384
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1384
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1385
1385
  } else if (issue2.code === "invalid_element") {
1386
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
1386
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1387
1387
  } else {
1388
- const fullpath = [...path6, ...issue2.path];
1388
+ const fullpath = [...path7, ...issue2.path];
1389
1389
  if (fullpath.length === 0) {
1390
1390
  result.errors.push(mapper(issue2));
1391
1391
  continue;
@@ -1417,8 +1417,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1417
1417
  }
1418
1418
  function toDotPath(_path) {
1419
1419
  const segs = [];
1420
- const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1421
- for (const seg of path6) {
1420
+ const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1421
+ for (const seg of path7) {
1422
1422
  if (typeof seg === "number")
1423
1423
  segs.push(`[${seg}]`);
1424
1424
  else if (typeof seg === "symbol")
@@ -14110,13 +14110,13 @@ function resolveRef(ref, ctx) {
14110
14110
  if (!ref.startsWith("#")) {
14111
14111
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14112
14112
  }
14113
- const path6 = ref.slice(1).split("/").filter(Boolean);
14114
- if (path6.length === 0) {
14113
+ const path7 = ref.slice(1).split("/").filter(Boolean);
14114
+ if (path7.length === 0) {
14115
14115
  return ctx.rootSchema;
14116
14116
  }
14117
14117
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14118
- if (path6[0] === defsKey) {
14119
- const key = path6[1];
14118
+ if (path7[0] === defsKey) {
14119
+ const key = path7[1];
14120
14120
  if (!key || !ctx.defs[key]) {
14121
14121
  throw new Error(`Reference not found: ${ref}`);
14122
14122
  }
@@ -14527,6 +14527,46 @@ config(en_default());
14527
14527
  // ../../shared-contracts/dist/version.js
14528
14528
  var WORKSPACE_CONTRACT_VERSION = 1;
14529
14529
 
14530
+ // ../../shared-contracts/dist/idle-release.js
14531
+ var IDLE_RELEASE_TIMEOUT_MINUTES_MIN = 5;
14532
+ var IDLE_RELEASE_TIMEOUT_MINUTES_MAX = 1440;
14533
+ var idleReleaseSettingsSchema = external_exports.strictObject({
14534
+ enabled: external_exports.boolean(),
14535
+ timeoutMinutes: external_exports.number().int().min(IDLE_RELEASE_TIMEOUT_MINUTES_MIN).max(IDLE_RELEASE_TIMEOUT_MINUTES_MAX)
14536
+ });
14537
+ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
14538
+ enabled: false,
14539
+ timeoutMinutes: 30
14540
+ });
14541
+
14542
+ // ../../shared-contracts/dist/loaded-sessions.js
14543
+ var loadedSessionStateSchema = external_exports.enum([
14544
+ "idle",
14545
+ "running",
14546
+ "busy",
14547
+ "closing",
14548
+ "failed",
14549
+ "blocked"
14550
+ ]);
14551
+ var loadedSessionReasonSchema = external_exports.enum([
14552
+ "none",
14553
+ "disabled",
14554
+ "timeout",
14555
+ "operation",
14556
+ "background",
14557
+ "identity",
14558
+ "persistence",
14559
+ "closeFailed"
14560
+ ]);
14561
+ var loadedSessionsSchema = external_exports.array(external_exports.strictObject({
14562
+ threadId: external_exports.string(),
14563
+ title: external_exports.string(),
14564
+ harnessId: external_exports.string(),
14565
+ state: loadedSessionStateSchema,
14566
+ reason: loadedSessionReasonSchema,
14567
+ inactiveMs: external_exports.number().nonnegative()
14568
+ }));
14569
+
14530
14570
  // ../../shared-contracts/dist/ids.js
14531
14571
  var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14532
14572
  message: "Identifier must not be empty or whitespace"
@@ -15077,75 +15117,15 @@ var codexAccountSchema = external_exports.object({
15077
15117
  email: external_exports.string().email().max(320).optional(),
15078
15118
  planType: codexAccountPlanTypeSchema.optional()
15079
15119
  }).strict();
15080
- var codexAccountPhaseSchema = external_exports.enum(["ready", "changing", "unavailable"]);
15081
- var codexAccountPendingOperationSchema = external_exports.object({
15082
- operationId: nonBlankTextSchema3.max(1024),
15083
- kind: external_exports.enum(["login", "switch", "logout", "recovery"])
15084
- }).strict();
15085
- var codexAccountCapabilitiesSchema = external_exports.object({
15086
- manage: external_exports.boolean(),
15087
- switch: external_exports.boolean(),
15088
- login: external_exports.boolean(),
15089
- delete: external_exports.boolean(),
15090
- recover: external_exports.boolean().optional(),
15091
- logout: external_exports.boolean().optional(),
15092
- reason: external_exports.enum([
15093
- "ssh-single-account",
15094
- "unsupported-storage",
15095
- "unsupported-version",
15096
- "recovery-required",
15097
- "keyring-unavailable",
15098
- "migration-required"
15099
- ]).optional()
15100
- }).strict();
15120
+ var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
15101
15121
  var codexAccountListResultSchema = external_exports.object({
15102
15122
  version: external_exports.literal(2),
15103
15123
  currentAccountId: accountIdSchema.nullable(),
15104
15124
  phase: codexAccountPhaseSchema,
15105
15125
  revision: external_exports.number().int().nonnegative(),
15106
15126
  instanceId: nonBlankTextSchema3.max(1024).optional(),
15107
- cleanupRequired: external_exports.boolean().optional(),
15108
- /** Credentials were adopted; other native homes/history remain unmerged. */
15109
- legacyHistoryPreserved: external_exports.boolean().optional(),
15110
- pendingOperation: codexAccountPendingOperationSchema.optional(),
15111
- capabilities: codexAccountCapabilitiesSchema,
15112
- accounts: external_exports.array(codexAccountSchema).max(128)
15113
- }).strict();
15114
- var codexAccountActivateParamsSchema = external_exports.object({ accountId: accountIdSchema }).strict();
15115
- var codexAccountSwitchParamsSchema = external_exports.object({ accountId: accountIdSchema }).strict();
15116
- var codexAccountReadyMutationResultShape = {
15117
- phase: external_exports.literal("ready"),
15118
- revision: external_exports.number().int().nonnegative()
15119
- };
15120
- var codexAccountSwitchResultSchema = external_exports.object({
15121
- currentAccountId: accountIdSchema,
15122
- ...codexAccountReadyMutationResultShape
15123
- }).strict();
15124
- var codexAccountDeleteParamsSchema = external_exports.object({ accountId: accountIdSchema }).strict();
15125
- var codexAccountDeleteResultSchema = external_exports.object({ deletedAccountId: accountIdSchema }).strict();
15126
- var codexAccountLoginStartParamsSchema = external_exports.object({ accountId: accountIdSchema.optional() }).strict();
15127
- var codexAccountLoginStartResultSchema = external_exports.object({
15128
- accountId: accountIdSchema,
15129
- loginId: nonBlankTextSchema3.max(1024),
15130
- verificationUrl: external_exports.string().url().max(16384),
15131
- userCode: nonBlankTextSchema3.max(1024)
15132
- }).strict();
15133
- var codexAccountLoginCancelParamsSchema = external_exports.object({ loginId: nonBlankTextSchema3.max(1024) }).strict();
15134
- var codexAccountLoginCancelResultSchema = external_exports.object({ cancelled: external_exports.boolean() }).strict();
15135
- var codexAccountLoginCompletedSchema = external_exports.object({
15136
- accountId: accountIdSchema,
15137
- loginId: nonBlankTextSchema3.max(1024),
15138
- success: external_exports.boolean(),
15139
- error: external_exports.string().max(4096).nullable(),
15140
- saved: external_exports.boolean().optional(),
15141
- cleanupRequired: external_exports.boolean().optional()
15142
- }).strict();
15143
- var codexAccountLogoutParamsSchema = external_exports.object({}).strict();
15144
- var codexAccountLogoutResultSchema = external_exports.object({
15145
- currentAccountId: external_exports.null(),
15146
- ...codexAccountReadyMutationResultShape
15127
+ accounts: external_exports.array(codexAccountSchema).max(1)
15147
15128
  }).strict();
15148
- var codexAccountRecoverParamsSchema = external_exports.object({}).strict();
15149
15129
  var codexAccountUsageParamsSchema = external_exports.object({ accountId: accountIdSchema, refresh: external_exports.boolean().optional() }).strict();
15150
15130
  var codexAccountUsageResultSchema = external_exports.object({
15151
15131
  accountId: accountIdSchema,
@@ -15154,21 +15134,6 @@ var codexAccountUsageResultSchema = external_exports.object({
15154
15134
  freshness: external_exports.enum(["live", "cached"]),
15155
15135
  observedAt: external_exports.string().datetime().nullable()
15156
15136
  }).strict();
15157
- var codexAccountResetCreditConsumeParamsSchema = external_exports.object({
15158
- accountId: accountIdSchema,
15159
- idempotencyKey: external_exports.string().uuid().optional()
15160
- }).strict();
15161
- var codexAccountResetCreditConsumeOutcomeSchema = external_exports.enum([
15162
- "reset",
15163
- "nothingToReset",
15164
- "noCredit",
15165
- "alreadyRedeemed"
15166
- ]);
15167
- var codexAccountResetCreditConsumeResultSchema = external_exports.object({
15168
- accountId: accountIdSchema,
15169
- outcome: codexAccountResetCreditConsumeOutcomeSchema,
15170
- accountCredits: accountCreditsSnapshotSchema.optional()
15171
- }).strict();
15172
15137
 
15173
15138
  // ../../shared-contracts/dist/harness-session-import.js
15174
15139
  var HARNESS_SESSION_IMPORT_ID_MAX_LENGTH = 1024;
@@ -15906,6 +15871,7 @@ function projectOpenCodeHistory(input) {
15906
15871
  const item = {
15907
15872
  type: "fileChange",
15908
15873
  itemId: itemId(`opencode-diff:${userEntry.info.id}`),
15874
+ sourceItemIds: items.map(({ item: item2 }) => item2.itemId),
15909
15875
  changes
15910
15876
  };
15911
15877
  items.push({ item, outcome: { status: "succeeded" } });
@@ -16027,6 +15993,7 @@ import { randomBytes } from "node:crypto";
16027
15993
  import { spawn, spawnSync } from "node:child_process";
16028
15994
  import fs2 from "node:fs";
16029
15995
  import { homedir, tmpdir } from "node:os";
15996
+ import path4 from "node:path";
16030
15997
 
16031
15998
  // ../../../node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js
16032
15999
  var createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url2, ...options }) => {
@@ -16252,7 +16219,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
16252
16219
 
16253
16220
  // ../../../node_modules/@opencode-ai/sdk/dist/v2/gen/core/utils.gen.js
16254
16221
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
16255
- var defaultPathSerializer = ({ path: path6, url: _url2 }) => {
16222
+ var defaultPathSerializer = ({ path: path7, url: _url2 }) => {
16256
16223
  let url2 = _url2;
16257
16224
  const matches = _url2.match(PATH_PARAM_RE);
16258
16225
  if (matches) {
@@ -16271,7 +16238,7 @@ var defaultPathSerializer = ({ path: path6, url: _url2 }) => {
16271
16238
  name = name.substring(1);
16272
16239
  style = "matrix";
16273
16240
  }
16274
- const value = path6[name];
16241
+ const value = path7[name];
16275
16242
  if (value === void 0 || value === null) {
16276
16243
  continue;
16277
16244
  }
@@ -16302,11 +16269,11 @@ var defaultPathSerializer = ({ path: path6, url: _url2 }) => {
16302
16269
  }
16303
16270
  return url2;
16304
16271
  };
16305
- var getUrl = ({ baseUrl, path: path6, query, querySerializer, url: _url2 }) => {
16272
+ var getUrl = ({ baseUrl, path: path7, query, querySerializer, url: _url2 }) => {
16306
16273
  const pathUrl = _url2.startsWith("/") ? _url2 : `/${_url2}`;
16307
16274
  let url2 = (baseUrl ?? "") + pathUrl;
16308
- if (path6) {
16309
- url2 = defaultPathSerializer({ path: path6, url: url2 });
16275
+ if (path7) {
16276
+ url2 = defaultPathSerializer({ path: path7, url: url2 });
16310
16277
  }
16311
16278
  let search = query ? querySerializer(query) : "";
16312
16279
  if (search.startsWith("?")) {
@@ -21769,7 +21736,7 @@ function signalProcessTree(child, signal) {
21769
21736
  function safeOpenCodeServerCwd(environment) {
21770
21737
  const candidates = [environment.USERPROFILE, environment.HOME, homedir(), tmpdir()];
21771
21738
  for (const candidate of candidates) {
21772
- if (!candidate)
21739
+ if (!candidate || !path4.isAbsolute(candidate))
21773
21740
  continue;
21774
21741
  try {
21775
21742
  if (!fs2.statSync(candidate).isDirectory())
@@ -21878,7 +21845,10 @@ var OpenCodeServerConnection = class {
21878
21845
  OPENCODE_SERVER_PASSWORD: password
21879
21846
  };
21880
21847
  const invocation = openCodeServerInvocation(executable, environment);
21881
- const serverCwd = safeOpenCodeServerCwd(environment);
21848
+ const serverCwd = (this.#dependencies.resolveServerCwd ?? safeOpenCodeServerCwd)(environment);
21849
+ if (!serverCwd) {
21850
+ throw new OpenCodeTransportError("unavailable", "OpenCode Server requires a writable startup directory");
21851
+ }
21882
21852
  let child;
21883
21853
  try {
21884
21854
  child = this.#dependencies.spawn(invocation.command, invocation.arguments, {
@@ -21887,7 +21857,7 @@ var OpenCodeServerConnection = class {
21887
21857
  detached: process.platform !== "win32",
21888
21858
  windowsHide: true,
21889
21859
  windowsVerbatimArguments: invocation.windowsVerbatimArguments,
21890
- ...serverCwd ? { cwd: serverCwd } : {}
21860
+ cwd: serverCwd
21891
21861
  });
21892
21862
  } catch (error51) {
21893
21863
  throw new OpenCodeTransportError(isMissingExecutable(error51) ? "notInstalled" : "unavailable", isMissingExecutable(error51) ? "OpenCode CLI is not installed" : "OpenCode Server failed to start", { cause: error51 });
@@ -22199,7 +22169,7 @@ var SdkOpenCodeTransport = class {
22199
22169
 
22200
22170
  // dist/file-change-verification.js
22201
22171
  import fs3 from "node:fs";
22202
- import path4 from "node:path";
22172
+ import path5 from "node:path";
22203
22173
  function missingPath(error51) {
22204
22174
  if (!error51 || typeof error51 !== "object")
22205
22175
  return false;
@@ -22211,33 +22181,33 @@ function hasDotPathSegment(value) {
22211
22181
  return segments.some((segment) => segment === "." || segment === "..");
22212
22182
  }
22213
22183
  function canonicalDirectoryPath(value) {
22214
- let candidate = path4.resolve(value);
22184
+ let candidate = path5.resolve(value);
22215
22185
  const missingSegments = [];
22216
22186
  for (; ; ) {
22217
22187
  try {
22218
- return path4.join(fs3.realpathSync.native(candidate), ...missingSegments);
22188
+ return path5.join(fs3.realpathSync.native(candidate), ...missingSegments);
22219
22189
  } catch (error51) {
22220
22190
  if (!missingPath(error51))
22221
22191
  return void 0;
22222
- const parent = path4.dirname(candidate);
22192
+ const parent = path5.dirname(candidate);
22223
22193
  if (parent === candidate)
22224
22194
  return void 0;
22225
- missingSegments.unshift(path4.basename(candidate));
22195
+ missingSegments.unshift(path5.basename(candidate));
22226
22196
  candidate = parent;
22227
22197
  }
22228
22198
  }
22229
22199
  }
22230
22200
  function canonicalFilePath(value) {
22231
- const absolute = path4.resolve(value);
22232
- const parent = canonicalDirectoryPath(path4.dirname(absolute));
22233
- return parent ? path4.join(parent, path4.basename(absolute)) : void 0;
22201
+ const absolute = path5.resolve(value);
22202
+ const parent = canonicalDirectoryPath(path5.dirname(absolute));
22203
+ return parent ? path5.join(parent, path5.basename(absolute)) : void 0;
22234
22204
  }
22235
22205
  function pathIsWithin(root, candidate, allowRoot) {
22236
- const relative = path4.relative(root, candidate);
22237
- return allowRoot && relative === "" || relative !== "" && relative !== ".." && !relative.startsWith(`..${path4.sep}`) && !path4.isAbsolute(relative);
22206
+ const relative = path5.relative(root, candidate);
22207
+ return allowRoot && relative === "" || relative !== "" && relative !== ".." && !relative.startsWith(`..${path5.sep}`) && !path5.isAbsolute(relative);
22238
22208
  }
22239
22209
  function verifiedOpenCodeWorktree(sessionDirectory, paths) {
22240
- if (!paths || typeof paths !== "object" || typeof sessionDirectory !== "string" || typeof paths.directory !== "string" || typeof paths.worktree !== "string" || hasDotPathSegment(sessionDirectory) || hasDotPathSegment(paths.directory) || hasDotPathSegment(paths.worktree) || !path4.isAbsolute(sessionDirectory) || !path4.isAbsolute(paths.directory) || !path4.isAbsolute(paths.worktree)) {
22210
+ if (!paths || typeof paths !== "object" || typeof sessionDirectory !== "string" || typeof paths.directory !== "string" || typeof paths.worktree !== "string" || hasDotPathSegment(sessionDirectory) || hasDotPathSegment(paths.directory) || hasDotPathSegment(paths.worktree) || !path5.isAbsolute(sessionDirectory) || !path5.isAbsolute(paths.directory) || !path5.isAbsolute(paths.worktree)) {
22241
22211
  return void 0;
22242
22212
  }
22243
22213
  const session = canonicalDirectoryPath(sessionDirectory);
@@ -22249,10 +22219,10 @@ function verifiedOpenCodeWorktree(sessionDirectory, paths) {
22249
22219
  return worktree;
22250
22220
  }
22251
22221
  function openCodeFileIdentity(file2, worktree) {
22252
- if (typeof file2 !== "string" || typeof worktree !== "string" || hasDotPathSegment(file2) || hasDotPathSegment(worktree) || !path4.isAbsolute(worktree) || !file2 || file2.includes("\0") || file2.includes("\n") || file2.includes("\r")) {
22222
+ if (typeof file2 !== "string" || typeof worktree !== "string" || hasDotPathSegment(file2) || hasDotPathSegment(worktree) || !path5.isAbsolute(worktree) || !file2 || file2.includes("\0") || file2.includes("\n") || file2.includes("\r")) {
22253
22223
  return void 0;
22254
22224
  }
22255
- const candidate = canonicalFilePath(path4.isAbsolute(file2) ? file2 : path4.resolve(worktree, file2));
22225
+ const candidate = canonicalFilePath(path5.isAbsolute(file2) ? file2 : path5.resolve(worktree, file2));
22256
22226
  return candidate && pathIsWithin(worktree, candidate, false) ? candidate : void 0;
22257
22227
  }
22258
22228
 
@@ -22542,7 +22512,7 @@ function sameCwd(left, right) {
22542
22512
  try {
22543
22513
  return fs4.realpathSync.native(value);
22544
22514
  } catch {
22545
- return path5.resolve(value);
22515
+ return path6.resolve(value);
22546
22516
  }
22547
22517
  };
22548
22518
  return canonical(left) === canonical(right);
@@ -22895,7 +22865,7 @@ var OpenCodeHarnessSession = class {
22895
22865
  }
22896
22866
  }
22897
22867
  async #selectModel(command) {
22898
- if (this.#active || this.#configuring) {
22868
+ if (this.#configuring) {
22899
22869
  return {
22900
22870
  ok: false,
22901
22871
  error: {
@@ -22939,7 +22909,7 @@ var OpenCodeHarnessSession = class {
22939
22909
  if (!this.capabilities.configuration.selectThinkingOption) {
22940
22910
  return { ok: false, error: unsupported("OpenCode Model variants are unavailable") };
22941
22911
  }
22942
- if (this.#active || this.#configuring) {
22912
+ if (this.#configuring) {
22943
22913
  return {
22944
22914
  ok: false,
22945
22915
  error: {
@@ -23394,6 +23364,7 @@ var OpenCodeHarnessSession = class {
23394
23364
  const item = {
23395
23365
  type: "fileChange",
23396
23366
  itemId: hostItemIdSchema.parse(id),
23367
+ sourceItemIds: [...active.items.values()].map(({ item: item2 }) => item2.itemId),
23397
23368
  changes
23398
23369
  };
23399
23370
  active.items.set(id, { item, completed: false });