@moxt-ai/mobius 0.0.172 → 0.0.173

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.
@@ -20,19 +20,6 @@ export declare class DaemonTurnRegistry {
20
20
  epoch: string;
21
21
  hasOlder: boolean;
22
22
  interaction: Readonly<{
23
- commandId: string;
24
- interactionId: string;
25
- kind: "session.permission.requested";
26
- options: readonly Readonly<{
27
- kind: "allow_always" | "allow_once" | "reject_always" | "reject_once";
28
- name: string;
29
- optionId: string;
30
- }>[];
31
- sessionId: string;
32
- title: string;
33
- toolCallId: string;
34
- toolKind: string;
35
- }> | Readonly<{
36
23
  accepted: boolean;
37
24
  commandId: string;
38
25
  elicitationId: string;
@@ -64,6 +51,19 @@ export declare class DaemonTurnRegistry {
64
51
  mode: "form" | "url";
65
52
  sessionId: string;
66
53
  url: string;
54
+ }> | Readonly<{
55
+ commandId: string;
56
+ interactionId: string;
57
+ kind: "session.permission.requested";
58
+ options: readonly Readonly<{
59
+ kind: "allow_always" | "allow_once" | "reject_always" | "reject_once";
60
+ name: string;
61
+ optionId: string;
62
+ }>[];
63
+ sessionId: string;
64
+ title: string;
65
+ toolCallId: string;
66
+ toolKind: string;
67
67
  }> | null;
68
68
  messages: readonly (Readonly<{
69
69
  id: string;
@@ -7,5 +7,8 @@ export declare const acpSessionStoreMigrations: readonly [{
7
7
  }, {
8
8
  readonly name: "0002_equal_black_queen.sql";
9
9
  readonly sql: "CREATE TABLE `session_event_v2` (\n\t`event_id` text PRIMARY KEY NOT NULL,\n\t`event_json` text NOT NULL,\n\t`position` integer NOT NULL,\n\t`session_id` text NOT NULL\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `session_event_v2_session_position_unique` ON `session_event_v2` (`session_id`,`position`);--> statement-breakpoint\nCREATE INDEX `session_event_v2_session_position_index` ON `session_event_v2` (`session_id`,`position`);";
10
+ }, {
11
+ readonly name: "0003_silky_ravenous.sql";
12
+ readonly sql: "DROP TABLE `session_event_v2`;";
10
13
  }];
11
14
  //# sourceMappingURL=acp-session-store-migrations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"acp-session-store-migrations.d.ts","sourceRoot":"","sources":["../../src/generated/acp-session-store-migrations.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB;aAE9B,IAAM,EAAE,iCAAiC;aACzC,GAAK,EAAE,2ZAA2Z;;aAGla,IAAM,EAAE,4BAA4B;aACpC,GAAK,EAAE,gEAAgE;;aAGvE,IAAM,EAAE,4BAA4B;aACpC,GAAK,EAAE,ybAAyb;EAE9b,CAAC"}
1
+ {"version":3,"file":"acp-session-store-migrations.d.ts","sourceRoot":"","sources":["../../src/generated/acp-session-store-migrations.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB;aAE9B,IAAM,EAAE,iCAAiC;aACzC,GAAK,EAAE,2ZAA2Z;;aAGla,IAAM,EAAE,4BAA4B;aACpC,GAAK,EAAE,gEAAgE;;aAGvE,IAAM,EAAE,4BAA4B;aACpC,GAAK,EAAE,ybAAyb;;aAGhc,IAAM,EAAE,yBAAyB;aACjC,GAAK,EAAE,gCAAgC;EAErC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  // Generated by scripts/generate-sql-modules.ts. Do not edit.
2
- // Sources: ../../migrations/acp-session-store/0000_slimy_captain_midlands.sql, ../../migrations/acp-session-store/0001_regular_ultimates.sql, ../../migrations/acp-session-store/0002_equal_black_queen.sql
2
+ // Sources: ../../migrations/acp-session-store/0000_slimy_captain_midlands.sql, ../../migrations/acp-session-store/0001_regular_ultimates.sql, ../../migrations/acp-session-store/0002_equal_black_queen.sql, ../../migrations/acp-session-store/0003_silky_ravenous.sql
3
3
  export const acpSessionStoreMigrations = [
4
4
  {
5
5
  "name": "0000_slimy_captain_midlands.sql",
@@ -12,6 +12,10 @@ export const acpSessionStoreMigrations = [
12
12
  {
13
13
  "name": "0002_equal_black_queen.sql",
14
14
  "sql": "CREATE TABLE `session_event_v2` (\n\t`event_id` text PRIMARY KEY NOT NULL,\n\t`event_json` text NOT NULL,\n\t`position` integer NOT NULL,\n\t`session_id` text NOT NULL\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `session_event_v2_session_position_unique` ON `session_event_v2` (`session_id`,`position`);--> statement-breakpoint\nCREATE INDEX `session_event_v2_session_position_index` ON `session_event_v2` (`session_id`,`position`);"
15
+ },
16
+ {
17
+ "name": "0003_silky_ravenous.sql",
18
+ "sql": "DROP TABLE `session_event_v2`;"
15
19
  }
16
20
  ];
17
21
  //# sourceMappingURL=acp-session-store-migrations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"acp-session-store-migrations.js","sourceRoot":"","sources":["../../src/generated/acp-session-store-migrations.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,4MAA4M;AAC5M,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC;QACI,MAAM,EAAE,iCAAiC;QACzC,KAAK,EAAE,2ZAA2Z;KACra;IACD;QACI,MAAM,EAAE,4BAA4B;QACpC,KAAK,EAAE,gEAAgE;KAC1E;IACD;QACI,MAAM,EAAE,4BAA4B;QACpC,KAAK,EAAE,ybAAyb;KACnc;CACK,CAAC"}
1
+ {"version":3,"file":"acp-session-store-migrations.js","sourceRoot":"","sources":["../../src/generated/acp-session-store-migrations.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,wQAAwQ;AACxQ,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC;QACI,MAAM,EAAE,iCAAiC;QACzC,KAAK,EAAE,2ZAA2Z;KACra;IACD;QACI,MAAM,EAAE,4BAA4B;QACpC,KAAK,EAAE,gEAAgE;KAC1E;IACD;QACI,MAAM,EAAE,4BAA4B;QACpC,KAAK,EAAE,ybAAyb;KACnc;IACD;QACI,MAAM,EAAE,yBAAyB;QACjC,KAAK,EAAE,gCAAgC;KAC1C;CACK,CAAC"}
package/dist/index.js CHANGED
@@ -3380,11 +3380,11 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
3380
3380
  return payload;
3381
3381
  };
3382
3382
  });
3383
- function handleArrayResult(result, final, index2) {
3383
+ function handleArrayResult(result, final, index) {
3384
3384
  if (result.issues.length) {
3385
- final.issues.push(...prefixIssues(index2, result.issues));
3385
+ final.issues.push(...prefixIssues(index, result.issues));
3386
3386
  }
3387
- final.value[index2] = result.value;
3387
+ final.value[index] = result.value;
3388
3388
  }
3389
3389
  var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3390
3390
  $ZodType.init(inst, def);
@@ -3995,14 +3995,14 @@ function mergeValues(a, b) {
3995
3995
  return { valid: false, mergeErrorPath: [] };
3996
3996
  }
3997
3997
  const newArray = [];
3998
- for (let index2 = 0; index2 < a.length; index2++) {
3999
- const itemA = a[index2];
4000
- const itemB = b[index2];
3998
+ for (let index = 0; index < a.length; index++) {
3999
+ const itemA = a[index];
4000
+ const itemB = b[index];
4001
4001
  const sharedValue = mergeValues(itemA, itemB);
4002
4002
  if (!sharedValue.valid) {
4003
4003
  return {
4004
4004
  valid: false,
4005
- mergeErrorPath: [index2, ...sharedValue.mergeErrorPath]
4005
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
4006
4006
  };
4007
4007
  }
4008
4008
  newArray.push(sharedValue.data);
@@ -4153,11 +4153,11 @@ function getTupleOptStart(items, key) {
4153
4153
  }
4154
4154
  return 0;
4155
4155
  }
4156
- function handleTupleResult(result, final, index2) {
4156
+ function handleTupleResult(result, final, index) {
4157
4157
  if (result.issues.length) {
4158
- final.issues.push(...prefixIssues(index2, result.issues));
4158
+ final.issues.push(...prefixIssues(index, result.issues));
4159
4159
  }
4160
- final.value[index2] = result.value;
4160
+ final.value[index] = result.value;
4161
4161
  }
4162
4162
  function handleTupleResults(itemResults, final, items, input2, optoutStart) {
4163
4163
  for (let i = 0; i < items.length; i++) {
@@ -18838,7 +18838,7 @@ function detectVersion(schema, defaultTarget) {
18838
18838
  return defaultTarget ?? "draft-2020-12";
18839
18839
  }
18840
18840
  function applyMinItems(items, minItems) {
18841
- return items.map((item, index2) => index2 < minItems ? item : item.optional());
18841
+ return items.map((item, index) => index < minItems ? item : item.optional());
18842
18842
  }
18843
18843
  function decodeJSONPointerSegment(segment) {
18844
18844
  return segment.replace(/~1/g, "/").replace(/~0/g, "~");
@@ -20040,12 +20040,12 @@ var DEFAULT_AGENT_EXECUTION_CONFIGURATION = Object.freeze({
20040
20040
  });
20041
20041
  var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigurationSelectionSchema).max(100).superRefine((selections, context) => {
20042
20042
  const identifiers = /* @__PURE__ */ new Set();
20043
- for (const [index2, selection] of selections.entries()) {
20043
+ for (const [index, selection] of selections.entries()) {
20044
20044
  if (identifiers.has(selection.configId)) {
20045
20045
  context.addIssue({
20046
20046
  code: "custom",
20047
20047
  message: "Session configuration identifiers must be unique",
20048
- path: [index2, "configId"]
20048
+ path: [index, "configId"]
20049
20049
  });
20050
20050
  }
20051
20051
  identifiers.add(selection.configId);
@@ -21589,12 +21589,12 @@ var sessionExportV2Schema = external_exports.object({
21589
21589
  }).readonly().superRefine((session, context) => {
21590
21590
  let previousPosition = 0n;
21591
21591
  const eventIds = /* @__PURE__ */ new Set();
21592
- for (const [index2, event] of session.events.entries()) {
21592
+ for (const [index, event] of session.events.entries()) {
21593
21593
  if (event.sessionId !== session.sessionId) {
21594
21594
  context.addIssue({
21595
21595
  code: "custom",
21596
21596
  message: "Exported event belongs to a different Session",
21597
- path: ["events", index2, "sessionId"]
21597
+ path: ["events", index, "sessionId"]
21598
21598
  });
21599
21599
  }
21600
21600
  const position = BigInt(event.position);
@@ -21602,14 +21602,14 @@ var sessionExportV2Schema = external_exports.object({
21602
21602
  context.addIssue({
21603
21603
  code: "custom",
21604
21604
  message: "Exported events are not in increasing position order",
21605
- path: ["events", index2, "position"]
21605
+ path: ["events", index, "position"]
21606
21606
  });
21607
21607
  }
21608
21608
  if (eventIds.has(event.eventId)) {
21609
21609
  context.addIssue({
21610
21610
  code: "custom",
21611
21611
  message: "Exported event identities are not unique",
21612
- path: ["events", index2, "eventId"]
21612
+ path: ["events", index, "eventId"]
21613
21613
  });
21614
21614
  }
21615
21615
  previousPosition = position;
@@ -23021,7 +23021,7 @@ function startsWith(bytes, signature, offset = 0) {
23021
23021
  if (bytes.byteLength < offset + signature.byteLength) {
23022
23022
  return false;
23023
23023
  }
23024
- return signature.every((value, index2) => bytes[offset + index2] === value);
23024
+ return signature.every((value, index) => bytes[offset + index] === value);
23025
23025
  }
23026
23026
  function sniffRasterMime(bytes) {
23027
23027
  if (startsWith(bytes, PNG_SIGNATURE)) {
@@ -23149,7 +23149,7 @@ function startsWith2(bytes, signature, offset = 0) {
23149
23149
  if (bytes.byteLength < offset + signature.byteLength) {
23150
23150
  return false;
23151
23151
  }
23152
- return signature.every((value, index2) => bytes[offset + index2] === value);
23152
+ return signature.every((value, index) => bytes[offset + index] === value);
23153
23153
  }
23154
23154
  function sniffVideoMime(bytes) {
23155
23155
  if (startsWith2(bytes, MP4_FILE_TYPE, 4)) {
@@ -23278,10 +23278,10 @@ async function replaceImageMarkers(text2, replace) {
23278
23278
  let cursor = 0;
23279
23279
  let rewritten = "";
23280
23280
  for (const match of matches) {
23281
- const index2 = match.index ?? 0;
23282
- rewritten += text2.slice(cursor, index2);
23281
+ const index = match.index ?? 0;
23282
+ rewritten += text2.slice(cursor, index);
23283
23283
  rewritten += await replace(match[1] ?? "");
23284
- cursor = index2 + match[0].length;
23284
+ cursor = index + match[0].length;
23285
23285
  }
23286
23286
  return `${rewritten}${text2.slice(cursor)}`;
23287
23287
  }
@@ -26490,7 +26490,7 @@ function haveSameKeys(left, right) {
26490
26490
  const leftKeys = Object.keys(left);
26491
26491
  const rightKeys = Object.keys(right);
26492
26492
  if (leftKeys.length !== rightKeys.length) return false;
26493
- for (const [index2, key] of leftKeys.entries()) if (key !== rightKeys[index2]) return false;
26493
+ for (const [index, key] of leftKeys.entries()) if (key !== rightKeys[index]) return false;
26494
26494
  return true;
26495
26495
  }
26496
26496
  function mapUpdateSet(table, values) {
@@ -27996,60 +27996,6 @@ function sqliteTableWithCasing(casing) {
27996
27996
  }
27997
27997
  var sqliteTable = sqliteTableWithCasing(void 0);
27998
27998
 
27999
- // ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20260918.1_@types+better-sqlite3@7.6_f872c171b7e1945bb1fa42180063dab2/node_modules/drizzle-orm/sqlite-core/indexes.js
28000
- var IndexBuilderOn = class {
28001
- static [entityKind] = "SQLiteIndexBuilderOn";
28002
- constructor(name2, unique) {
28003
- this.name = name2;
28004
- this.unique = unique;
28005
- }
28006
- on(...columns) {
28007
- return new IndexBuilder(this.name, columns, this.unique);
28008
- }
28009
- };
28010
- var IndexBuilder = class {
28011
- static [entityKind] = "SQLiteIndexBuilder";
28012
- /** @internal */
28013
- config;
28014
- constructor(name2, columns, unique) {
28015
- this.config = {
28016
- name: name2,
28017
- columns,
28018
- unique,
28019
- where: void 0
28020
- };
28021
- }
28022
- /**
28023
- * Condition for partial index.
28024
- */
28025
- where(condition) {
28026
- this.config.where = condition;
28027
- return this;
28028
- }
28029
- /** @internal */
28030
- build(table) {
28031
- return new Index(this.config, table);
28032
- }
28033
- };
28034
- var Index = class {
28035
- static [entityKind] = "SQLiteIndex";
28036
- config;
28037
- isNameExplicit;
28038
- constructor(config2, table) {
28039
- this.config = {
28040
- ...config2,
28041
- table
28042
- };
28043
- this.isNameExplicit = !!config2.name;
28044
- }
28045
- };
28046
- function index(name2) {
28047
- return new IndexBuilderOn(name2, false);
28048
- }
28049
- function uniqueIndex(name2) {
28050
- return new IndexBuilderOn(name2, true);
28051
- }
28052
-
28053
27999
  // ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20260918.1_@types+better-sqlite3@7.6_f872c171b7e1945bb1fa42180063dab2/node_modules/drizzle-orm/sqlite-core/utils.js
28054
28000
  function extractUsedTable(table) {
28055
28001
  if (is(table, SQLiteTable)) return [`${table[Table.Symbol.BaseName]}`];
@@ -28874,8 +28820,8 @@ var SQLiteDialect = class {
28874
28820
  buildJoins(joins) {
28875
28821
  if (!joins || joins.length === 0) return;
28876
28822
  const joinsArray = [];
28877
- if (joins) for (const [index2, joinMeta] of joins.entries()) {
28878
- if (index2 === 0) joinsArray.push(sql` `);
28823
+ if (joins) for (const [index, joinMeta] of joins.entries()) {
28824
+ if (index === 0) joinsArray.push(sql` `);
28879
28825
  const table = joinMeta.table;
28880
28826
  const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : void 0;
28881
28827
  if (is(table, SQLiteTable)) {
@@ -28885,7 +28831,7 @@ var SQLiteDialect = class {
28885
28831
  const alias = tableName === origTableName ? void 0 : joinMeta.alias;
28886
28832
  joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`);
28887
28833
  } else joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join ${table}${onSql}`);
28888
- if (index2 < joins.length - 1) joinsArray.push(sql` `);
28834
+ if (index < joins.length - 1) joinsArray.push(sql` `);
28889
28835
  }
28890
28836
  return sql.join(joinsArray);
28891
28837
  }
@@ -28894,9 +28840,9 @@ var SQLiteDialect = class {
28894
28840
  }
28895
28841
  buildOrderBy(orderBy) {
28896
28842
  const orderByList = [];
28897
- if (orderBy) for (const [index2, orderByValue] of orderBy.entries()) {
28843
+ if (orderBy) for (const [index, orderByValue] of orderBy.entries()) {
28898
28844
  orderByList.push(orderByValue);
28899
- if (index2 < orderBy.length - 1) orderByList.push(sql`, `);
28845
+ if (index < orderBy.length - 1) orderByList.push(sql`, `);
28900
28846
  }
28901
28847
  return orderByList.length > 0 ? sql` order by ${sql.join(orderByList)}` : void 0;
28902
28848
  }
@@ -28924,9 +28870,9 @@ var SQLiteDialect = class {
28924
28870
  const whereSql = where ? sql` where ${where}` : void 0;
28925
28871
  const havingSql = having ? sql` having ${having}` : void 0;
28926
28872
  const groupByList = [];
28927
- if (groupBy) for (const [index2, groupByValue] of groupBy.entries()) {
28873
+ if (groupBy) for (const [index, groupByValue] of groupBy.entries()) {
28928
28874
  groupByList.push(groupByValue);
28929
- if (index2 < groupBy.length - 1) groupByList.push(sql`, `);
28875
+ if (index < groupBy.length - 1) groupByList.push(sql`, `);
28930
28876
  }
28931
28877
  const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupByList.length > 0 ? sql` group by ${sql.join(groupByList)}` : void 0}${havingSql}${this.buildOrderBy(orderBy)}${this.buildLimit(limit)}${offset ? sql` offset ${offset}` : void 0}`;
28932
28878
  if (setOperators.length > 0) return this.buildSetOperations(finalQuery, setOperators);
@@ -30218,6 +30164,10 @@ var acpSessionStoreMigrations = [
30218
30164
  {
30219
30165
  "name": "0002_equal_black_queen.sql",
30220
30166
  "sql": "CREATE TABLE `session_event_v2` (\n `event_id` text PRIMARY KEY NOT NULL,\n `event_json` text NOT NULL,\n `position` integer NOT NULL,\n `session_id` text NOT NULL\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `session_event_v2_session_position_unique` ON `session_event_v2` (`session_id`,`position`);--> statement-breakpoint\nCREATE INDEX `session_event_v2_session_position_index` ON `session_event_v2` (`session_id`,`position`);"
30167
+ },
30168
+ {
30169
+ "name": "0003_silky_ravenous.sql",
30170
+ "sql": "DROP TABLE `session_event_v2`;"
30221
30171
  }
30222
30172
  ];
30223
30173
 
@@ -30239,21 +30189,6 @@ var deletedAcpSession = sqliteTable("deleted_acp_session", {
30239
30189
  sessionId: text("session_id").primaryKey()
30240
30190
  });
30241
30191
 
30242
- // src/schema/acp-session-store/session-event-v2.ts
30243
- var sessionEventV2 = sqliteTable(
30244
- "session_event_v2",
30245
- {
30246
- eventId: text("event_id").primaryKey(),
30247
- eventJson: text("event_json").notNull(),
30248
- position: integer2("position").notNull(),
30249
- sessionId: text("session_id").notNull()
30250
- },
30251
- (table) => [
30252
- uniqueIndex("session_event_v2_session_position_unique").on(table.sessionId, table.position),
30253
- index("session_event_v2_session_position_index").on(table.sessionId, table.position)
30254
- ]
30255
- );
30256
-
30257
30192
  // src/acp/session-store.ts
30258
30193
  var AcpStoredSession = class {
30259
30194
  additionalDirectories;
@@ -30370,15 +30305,15 @@ var SqliteAcpSessionStore = class {
30370
30305
  this.#sqliteDatabase.close();
30371
30306
  throw new Error("The ACP Session database was created by a newer Mobius version");
30372
30307
  }
30373
- for (let index2 = version2; index2 < acpSessionStoreMigrations.length; index2 += 1) {
30374
- const migration = acpSessionStoreMigrations[index2];
30308
+ for (let index = version2; index < acpSessionStoreMigrations.length; index += 1) {
30309
+ const migration = acpSessionStoreMigrations[index];
30375
30310
  if (migration === void 0) {
30376
30311
  throw new Error("The ACP Session migration is unavailable");
30377
30312
  }
30378
30313
  this.#sqliteDatabase.exec("BEGIN IMMEDIATE");
30379
30314
  try {
30380
30315
  this.#sqliteDatabase.exec(migration.sql);
30381
- this.#sqliteDatabase.exec(`PRAGMA user_version = ${index2 + 1}`);
30316
+ this.#sqliteDatabase.exec(`PRAGMA user_version = ${index + 1}`);
30382
30317
  this.#sqliteDatabase.exec("COMMIT");
30383
30318
  } catch (error62) {
30384
30319
  this.#sqliteDatabase.exec("ROLLBACK");
@@ -30454,7 +30389,7 @@ var RetryableAcpInitializationError = class extends AcpExecutionError {
30454
30389
  }
30455
30390
  };
30456
30391
  function arraysEqual(left, right) {
30457
- return left.length === right.length && left.every((value, index2) => value === right[index2]);
30392
+ return left.length === right.length && left.every((value, index) => value === right[index]);
30458
30393
  }
30459
30394
  function recordsEqual(left, right) {
30460
30395
  const leftEntries = Object.entries(left);
@@ -32251,9 +32186,9 @@ var AcpProcessCapacityLock = class {
32251
32186
  return await waiter.completion.promise;
32252
32187
  } finally {
32253
32188
  signal.removeEventListener("abort", waiter.cancel);
32254
- const index2 = this.#waiters.indexOf(waiter);
32255
- if (index2 >= 0) {
32256
- this.#waiters.splice(index2, 1);
32189
+ const index = this.#waiters.indexOf(waiter);
32190
+ if (index >= 0) {
32191
+ this.#waiters.splice(index, 1);
32257
32192
  }
32258
32193
  }
32259
32194
  };
@@ -36890,9 +36825,9 @@ function comparePrerelease(left, right) {
36890
36825
  if (left.length === 0 || right.length === 0) {
36891
36826
  return left.length === right.length ? 0 : left.length === 0 ? 1 : -1;
36892
36827
  }
36893
- for (let index2 = 0; index2 < Math.max(left.length, right.length); index2 += 1) {
36894
- const leftPart = left[index2];
36895
- const rightPart = right[index2];
36828
+ for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
36829
+ const leftPart = left[index];
36830
+ const rightPart = right[index];
36896
36831
  if (leftPart === void 0 || rightPart === void 0) {
36897
36832
  return leftPart === rightPart ? 0 : leftPart === void 0 ? -1 : 1;
36898
36833
  }
@@ -36917,8 +36852,8 @@ function compareAgentVersions(left, right) {
36917
36852
  if (parsedLeft === null || parsedRight === null) {
36918
36853
  return null;
36919
36854
  }
36920
- for (let index2 = 0; index2 < Math.max(parsedLeft.core.length, parsedRight.core.length); index2 += 1) {
36921
- const difference = (parsedLeft.core[index2] ?? 0) - (parsedRight.core[index2] ?? 0);
36855
+ for (let index = 0; index < Math.max(parsedLeft.core.length, parsedRight.core.length); index += 1) {
36856
+ const difference = (parsedLeft.core[index] ?? 0) - (parsedRight.core[index] ?? 0);
36922
36857
  if (difference !== 0) {
36923
36858
  return Math.sign(difference);
36924
36859
  }
@@ -37661,16 +37596,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
37661
37596
  };
37662
37597
  #readConnectionForChannel = async (channelId, signal) => {
37663
37598
  const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
37664
- const index2 = decodeChannelIndex(
37599
+ const index = decodeChannelIndex(
37665
37600
  await readJsonFile(this.channelIndexPath(normalizedChannelId), signal, "connection_not_found")
37666
37601
  );
37667
- if (index2.applicationId !== this.applicationId || index2.installationId !== this.installationId || index2.channelId !== normalizedChannelId) {
37602
+ if (index.applicationId !== this.applicationId || index.installationId !== this.installationId || index.channelId !== normalizedChannelId) {
37668
37603
  throw new RuntimeInstallationStoreError(
37669
37604
  "connection_owner_mismatch",
37670
37605
  "The saved Runtime connection belongs to another installation"
37671
37606
  );
37672
37607
  }
37673
- return await this.readConnection(index2.connectionId, signal);
37608
+ return await this.readConnection(index.connectionId, signal);
37674
37609
  };
37675
37610
  saveConnection = async (input2, signal) => {
37676
37611
  const stored = new VerifiedRuntimeConnection(
@@ -37865,16 +37800,16 @@ function hasExactKeys2(value, expectedKeys) {
37865
37800
  }
37866
37801
  function readSingleOption(arguments_, option) {
37867
37802
  const values = [];
37868
- for (let index2 = 0; index2 < arguments_.length; index2 += 1) {
37869
- if (arguments_[index2] !== option) {
37803
+ for (let index = 0; index < arguments_.length; index += 1) {
37804
+ if (arguments_[index] !== option) {
37870
37805
  continue;
37871
37806
  }
37872
- const value = arguments_[index2 + 1];
37807
+ const value = arguments_[index + 1];
37873
37808
  if (value === void 0 || value.startsWith("--")) {
37874
37809
  throw new PairingClientError("invalid_arguments", `${option} requires a value`);
37875
37810
  }
37876
37811
  values.push(value);
37877
- index2 += 1;
37812
+ index += 1;
37878
37813
  }
37879
37814
  if (values.length !== 1) {
37880
37815
  throw new PairingClientError("invalid_arguments", `${option} must be provided exactly once`);
@@ -37882,8 +37817,8 @@ function readSingleOption(arguments_, option) {
37882
37817
  return values[0] ?? "";
37883
37818
  }
37884
37819
  function assertKnownArguments(arguments_) {
37885
- for (let index2 = 0; index2 < arguments_.length; index2 += 2) {
37886
- const option = arguments_[index2];
37820
+ for (let index = 0; index < arguments_.length; index += 2) {
37821
+ const option = arguments_[index];
37887
37822
  if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace") {
37888
37823
  throw new PairingClientError("invalid_arguments", `Unknown pairing option: ${option ?? "missing option"}`);
37889
37824
  }
@@ -39395,8 +39330,8 @@ var ACTIVE_TURN_TEXT_CHUNK_LIMIT = Math.floor(SESSION_HISTORY_CHARACTER_LIMIT /
39395
39330
  function boundedRecoveryMessages(messages) {
39396
39331
  const selected = [];
39397
39332
  let remainingCharacters = SESSION_HISTORY_CHARACTER_LIMIT;
39398
- for (let index2 = messages.length - 1; index2 >= 0 && selected.length < SESSION_HISTORY_MESSAGE_LIMIT; index2 -= 1) {
39399
- const message = messages[index2];
39333
+ for (let index = messages.length - 1; index >= 0 && selected.length < SESSION_HISTORY_MESSAGE_LIMIT; index -= 1) {
39334
+ const message = messages[index];
39400
39335
  if (message === void 0) {
39401
39336
  break;
39402
39337
  }
@@ -39537,7 +39472,7 @@ var ActiveDaemonTurn = class {
39537
39472
  ];
39538
39473
  } else {
39539
39474
  this.#timeline = this.#timeline.map(
39540
- (entry, index2) => index2 === target && entry.kind === "message" ? { ...entry, content: new Map([...entry.content, [event.contentId, event.content]]) } : entry
39475
+ (entry, index) => index === target && entry.kind === "message" ? { ...entry, content: new Map([...entry.content, [event.contentId, event.content]]) } : entry
39541
39476
  );
39542
39477
  }
39543
39478
  } else if (event.kind === SESSION_PERMISSION_REQUESTED_KIND || event.kind === SESSION_ELICITATION_REQUESTED_KIND) {
@@ -40563,7 +40498,7 @@ async function readAcpHistory(sessions, directories, bindingId, options, nativeS
40563
40498
  async (directory) => await directories.identify(bindingId, directory, options.signal)
40564
40499
  )
40565
40500
  );
40566
- if (primary.path !== options.cwd || additional.length !== options.additionalDirectories.length || additional.some((directory, index2) => directory.path !== options.additionalDirectories[index2])) {
40501
+ if (primary.path !== options.cwd || additional.length !== options.additionalDirectories.length || additional.some((directory, index) => directory.path !== options.additionalDirectories[index])) {
40567
40502
  throw new AcpExecutionError(
40568
40503
  "The native Session belongs to another workspace.",
40569
40504
  {},
@@ -40696,7 +40631,7 @@ var NativeSessionService = class {
40696
40631
  "native_session_not_found"
40697
40632
  );
40698
40633
  }
40699
- if (source.agentId !== command.agentId || source.cwd !== cwd || source.additionalDirectories.length !== additionalDirectories.length || source.additionalDirectories.some((path2, index2) => path2 !== additionalDirectories[index2])) {
40634
+ if (source.agentId !== command.agentId || source.cwd !== cwd || source.additionalDirectories.length !== additionalDirectories.length || source.additionalDirectories.some((path2, index) => path2 !== additionalDirectories[index])) {
40700
40635
  throw new AcpExecutionError(
40701
40636
  "The source conversation execution target does not match the fork request",
40702
40637
  {},
@@ -40717,8 +40652,8 @@ var NativeSessionService = class {
40717
40652
  signal.throwIfAborted();
40718
40653
  const directory = await this.#directories.list(this.#config.bindingId, command.directoryId, signal);
40719
40654
  const ready2 = {
40720
- additionalDirectories: additionalDirectories.map((path2, index2) => ({
40721
- directoryId: command.additionalDirectoryIds[index2] ?? command.directoryId,
40655
+ additionalDirectories: additionalDirectories.map((path2, index) => ({
40656
+ directoryId: command.additionalDirectoryIds[index] ?? command.directoryId,
40722
40657
  name: basename5(path2) || path2
40723
40658
  })),
40724
40659
  agentId: command.agentId,
@@ -41051,7 +40986,7 @@ var NativeSessionService = class {
41051
40986
  resolveTarget = async (command, options, selected) => {
41052
40987
  let cursor = null;
41053
40988
  const visited = /* @__PURE__ */ new Set();
41054
- for (let index2 = 0; index2 < 100; index2 += 1) {
40989
+ for (let index = 0; index < 100; index += 1) {
41055
40990
  const page = await this.#sessions.listNativeSessions(options, cursor);
41056
40991
  const info = page.sessions.find((entry) => entry.sessionId === selected.nativeSessionId);
41057
40992
  if (info !== void 0) {
@@ -41059,7 +40994,7 @@ var NativeSessionService = class {
41059
40994
  if (target === null) {
41060
40995
  throw new LocalAuthorizationError("The selected native session is not authorized");
41061
40996
  }
41062
- if (target.cwd !== selected.cwd || target.additionalDirectories.length !== selected.additionalDirectories.length || target.additionalDirectories.some((path2, index3) => path2 !== selected.additionalDirectories[index3])) {
40997
+ if (target.cwd !== selected.cwd || target.additionalDirectories.length !== selected.additionalDirectories.length || target.additionalDirectories.some((path2, index2) => path2 !== selected.additionalDirectories[index2])) {
41063
40998
  throw new AcpExecutionError(
41064
40999
  "This session's directory changed. Refresh the list before continuing.",
41065
41000
  {},
@@ -42247,8 +42182,8 @@ function selectMessagesBefore(messages, endIndex, messageLimit, characterLimit)
42247
42182
  const selected = [];
42248
42183
  let remainingCharacters = characterLimit;
42249
42184
  let startIndex = endIndex;
42250
- for (let index2 = endIndex - 1; index2 >= 0 && selected.length < messageLimit; index2 -= 1) {
42251
- const message = messages[index2];
42185
+ for (let index = endIndex - 1; index >= 0 && selected.length < messageLimit; index -= 1) {
42186
+ const message = messages[index];
42252
42187
  if (message === void 0) {
42253
42188
  break;
42254
42189
  }
@@ -42258,7 +42193,7 @@ function selectMessagesBefore(messages, endIndex, messageLimit, characterLimit)
42258
42193
  }
42259
42194
  selected.unshift(message);
42260
42195
  remainingCharacters -= characters;
42261
- startIndex = index2;
42196
+ startIndex = index;
42262
42197
  }
42263
42198
  if (selected.length === 0 && endIndex > 0) {
42264
42199
  throw new AcpExecutionError(
@@ -42494,7 +42429,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
42494
42429
  const replay = await sessions.loadSessionEventsV2(loadOptions, command.eventLimit, command.cursor);
42495
42430
  signal.throwIfAborted();
42496
42431
  const events = replay.events.map(
42497
- (event, index2) => eventLogV2.event(command.sessionId, replay.startPosition + index2, event, "1970-01-01T00:00:00.000Z")
42432
+ (event, index) => eventLogV2.event(command.sessionId, replay.startPosition + index, event, "1970-01-01T00:00:00.000Z")
42498
42433
  );
42499
42434
  const tailCursor = events.at(-1)?.eventId ?? "";
42500
42435
  audit.record({
@@ -44184,7 +44119,7 @@ function promptContent(command) {
44184
44119
  }
44185
44120
  return content;
44186
44121
  }
44187
- function sessionEventV22(daemonGenerationId, sessionId, position, event, recordedAt) {
44122
+ function sessionEventV2(daemonGenerationId, sessionId, position, event, recordedAt) {
44188
44123
  const sessionPrefix = createHash7("sha256").update(sessionId).digest("hex").slice(0, 16);
44189
44124
  return {
44190
44125
  eventId: `event-${daemonGenerationId}-${sessionPrefix}-${position.toString().padStart(16, "0")}`,
@@ -44220,7 +44155,7 @@ var DaemonSessionEventLogV2 = class {
44220
44155
  record = (sessionId, event, position) => {
44221
44156
  this.#publisher.publishV2(this.event(sessionId, position, event, (/* @__PURE__ */ new Date()).toISOString()));
44222
44157
  };
44223
- event = (sessionId, position, event, recordedAt) => sessionEventV22(this.daemonGenerationId, sessionId, position, event, recordedAt);
44158
+ event = (sessionId, position, event, recordedAt) => sessionEventV2(this.daemonGenerationId, sessionId, position, event, recordedAt);
44224
44159
  queueChanged = (_sessionId) => void 0;
44225
44160
  completed = (sessionId, commandId, _stopReason) => {
44226
44161
  const request = this.#queued.get(commandId);
@@ -44357,7 +44292,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
44357
44292
  options2.signal
44358
44293
  );
44359
44294
  return cwd === options2.cwd && additionalDirectories.length === options2.additionalDirectories.length && additionalDirectories.every(
44360
- (directory, index2) => directory === options2.additionalDirectories[index2]
44295
+ (directory, index) => directory === options2.additionalDirectories[index]
44361
44296
  );
44362
44297
  });
44363
44298
  }