@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.
- package/dist/cli.js +86 -151
- package/dist/cli.js.map +4 -4
- package/dist/daemon-turn-registry.d.ts +13 -13
- package/dist/generated/acp-session-store-migrations.d.ts +3 -0
- package/dist/generated/acp-session-store-migrations.d.ts.map +1 -1
- package/dist/generated/acp-session-store-migrations.js +5 -1
- package/dist/generated/acp-session-store-migrations.js.map +1 -1
- package/dist/index.js +71 -136
- package/dist/index.js.map +4 -4
- package/dist/runtime.js +65 -130
- package/dist/runtime.js.map +4 -4
- package/dist/schema/acp-session-store/index.d.ts +0 -1
- package/dist/schema/acp-session-store/index.d.ts.map +1 -1
- package/dist/schema/acp-session-store/index.js +0 -1
- package/dist/schema/acp-session-store/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/schema/acp-session-store/session-event-v2.d.ts +0 -72
- package/dist/schema/acp-session-store/session-event-v2.d.ts.map +0 -1
- package/dist/schema/acp-session-store/session-event-v2.js +0 -11
- package/dist/schema/acp-session-store/session-event-v2.js.map +0 -1
package/dist/runtime.js
CHANGED
|
@@ -3354,11 +3354,11 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
3354
3354
|
return payload;
|
|
3355
3355
|
};
|
|
3356
3356
|
});
|
|
3357
|
-
function handleArrayResult(result, final,
|
|
3357
|
+
function handleArrayResult(result, final, index) {
|
|
3358
3358
|
if (result.issues.length) {
|
|
3359
|
-
final.issues.push(...prefixIssues(
|
|
3359
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
3360
3360
|
}
|
|
3361
|
-
final.value[
|
|
3361
|
+
final.value[index] = result.value;
|
|
3362
3362
|
}
|
|
3363
3363
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
3364
3364
|
$ZodType.init(inst, def);
|
|
@@ -3969,14 +3969,14 @@ function mergeValues(a, b) {
|
|
|
3969
3969
|
return { valid: false, mergeErrorPath: [] };
|
|
3970
3970
|
}
|
|
3971
3971
|
const newArray = [];
|
|
3972
|
-
for (let
|
|
3973
|
-
const itemA = a[
|
|
3974
|
-
const itemB = b[
|
|
3972
|
+
for (let index = 0; index < a.length; index++) {
|
|
3973
|
+
const itemA = a[index];
|
|
3974
|
+
const itemB = b[index];
|
|
3975
3975
|
const sharedValue = mergeValues(itemA, itemB);
|
|
3976
3976
|
if (!sharedValue.valid) {
|
|
3977
3977
|
return {
|
|
3978
3978
|
valid: false,
|
|
3979
|
-
mergeErrorPath: [
|
|
3979
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
3980
3980
|
};
|
|
3981
3981
|
}
|
|
3982
3982
|
newArray.push(sharedValue.data);
|
|
@@ -4127,11 +4127,11 @@ function getTupleOptStart(items, key) {
|
|
|
4127
4127
|
}
|
|
4128
4128
|
return 0;
|
|
4129
4129
|
}
|
|
4130
|
-
function handleTupleResult(result, final,
|
|
4130
|
+
function handleTupleResult(result, final, index) {
|
|
4131
4131
|
if (result.issues.length) {
|
|
4132
|
-
final.issues.push(...prefixIssues(
|
|
4132
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
4133
4133
|
}
|
|
4134
|
-
final.value[
|
|
4134
|
+
final.value[index] = result.value;
|
|
4135
4135
|
}
|
|
4136
4136
|
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
4137
4137
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -18812,7 +18812,7 @@ function detectVersion(schema, defaultTarget) {
|
|
|
18812
18812
|
return defaultTarget ?? "draft-2020-12";
|
|
18813
18813
|
}
|
|
18814
18814
|
function applyMinItems(items, minItems) {
|
|
18815
|
-
return items.map((item,
|
|
18815
|
+
return items.map((item, index) => index < minItems ? item : item.optional());
|
|
18816
18816
|
}
|
|
18817
18817
|
function decodeJSONPointerSegment(segment) {
|
|
18818
18818
|
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
@@ -20014,12 +20014,12 @@ var DEFAULT_AGENT_EXECUTION_CONFIGURATION = Object.freeze({
|
|
|
20014
20014
|
});
|
|
20015
20015
|
var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigurationSelectionSchema).max(100).superRefine((selections, context) => {
|
|
20016
20016
|
const identifiers = /* @__PURE__ */ new Set();
|
|
20017
|
-
for (const [
|
|
20017
|
+
for (const [index, selection] of selections.entries()) {
|
|
20018
20018
|
if (identifiers.has(selection.configId)) {
|
|
20019
20019
|
context.addIssue({
|
|
20020
20020
|
code: "custom",
|
|
20021
20021
|
message: "Session configuration identifiers must be unique",
|
|
20022
|
-
path: [
|
|
20022
|
+
path: [index, "configId"]
|
|
20023
20023
|
});
|
|
20024
20024
|
}
|
|
20025
20025
|
identifiers.add(selection.configId);
|
|
@@ -21563,12 +21563,12 @@ var sessionExportV2Schema = external_exports.object({
|
|
|
21563
21563
|
}).readonly().superRefine((session, context) => {
|
|
21564
21564
|
let previousPosition = 0n;
|
|
21565
21565
|
const eventIds = /* @__PURE__ */ new Set();
|
|
21566
|
-
for (const [
|
|
21566
|
+
for (const [index, event] of session.events.entries()) {
|
|
21567
21567
|
if (event.sessionId !== session.sessionId) {
|
|
21568
21568
|
context.addIssue({
|
|
21569
21569
|
code: "custom",
|
|
21570
21570
|
message: "Exported event belongs to a different Session",
|
|
21571
|
-
path: ["events",
|
|
21571
|
+
path: ["events", index, "sessionId"]
|
|
21572
21572
|
});
|
|
21573
21573
|
}
|
|
21574
21574
|
const position = BigInt(event.position);
|
|
@@ -21576,14 +21576,14 @@ var sessionExportV2Schema = external_exports.object({
|
|
|
21576
21576
|
context.addIssue({
|
|
21577
21577
|
code: "custom",
|
|
21578
21578
|
message: "Exported events are not in increasing position order",
|
|
21579
|
-
path: ["events",
|
|
21579
|
+
path: ["events", index, "position"]
|
|
21580
21580
|
});
|
|
21581
21581
|
}
|
|
21582
21582
|
if (eventIds.has(event.eventId)) {
|
|
21583
21583
|
context.addIssue({
|
|
21584
21584
|
code: "custom",
|
|
21585
21585
|
message: "Exported event identities are not unique",
|
|
21586
|
-
path: ["events",
|
|
21586
|
+
path: ["events", index, "eventId"]
|
|
21587
21587
|
});
|
|
21588
21588
|
}
|
|
21589
21589
|
previousPosition = position;
|
|
@@ -26671,9 +26671,9 @@ function comparePrerelease(left, right) {
|
|
|
26671
26671
|
if (left.length === 0 || right.length === 0) {
|
|
26672
26672
|
return left.length === right.length ? 0 : left.length === 0 ? 1 : -1;
|
|
26673
26673
|
}
|
|
26674
|
-
for (let
|
|
26675
|
-
const leftPart = left[
|
|
26676
|
-
const rightPart = right[
|
|
26674
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
26675
|
+
const leftPart = left[index];
|
|
26676
|
+
const rightPart = right[index];
|
|
26677
26677
|
if (leftPart === void 0 || rightPart === void 0) {
|
|
26678
26678
|
return leftPart === rightPart ? 0 : leftPart === void 0 ? -1 : 1;
|
|
26679
26679
|
}
|
|
@@ -26698,8 +26698,8 @@ function compareAgentVersions(left, right) {
|
|
|
26698
26698
|
if (parsedLeft === null || parsedRight === null) {
|
|
26699
26699
|
return null;
|
|
26700
26700
|
}
|
|
26701
|
-
for (let
|
|
26702
|
-
const difference = (parsedLeft.core[
|
|
26701
|
+
for (let index = 0; index < Math.max(parsedLeft.core.length, parsedRight.core.length); index += 1) {
|
|
26702
|
+
const difference = (parsedLeft.core[index] ?? 0) - (parsedRight.core[index] ?? 0);
|
|
26703
26703
|
if (difference !== 0) {
|
|
26704
26704
|
return Math.sign(difference);
|
|
26705
26705
|
}
|
|
@@ -27309,7 +27309,7 @@ function startsWith(bytes, signature, offset = 0) {
|
|
|
27309
27309
|
if (bytes.byteLength < offset + signature.byteLength) {
|
|
27310
27310
|
return false;
|
|
27311
27311
|
}
|
|
27312
|
-
return signature.every((value,
|
|
27312
|
+
return signature.every((value, index) => bytes[offset + index] === value);
|
|
27313
27313
|
}
|
|
27314
27314
|
function sniffRasterMime(bytes) {
|
|
27315
27315
|
if (startsWith(bytes, PNG_SIGNATURE)) {
|
|
@@ -27437,7 +27437,7 @@ function startsWith2(bytes, signature, offset = 0) {
|
|
|
27437
27437
|
if (bytes.byteLength < offset + signature.byteLength) {
|
|
27438
27438
|
return false;
|
|
27439
27439
|
}
|
|
27440
|
-
return signature.every((value,
|
|
27440
|
+
return signature.every((value, index) => bytes[offset + index] === value);
|
|
27441
27441
|
}
|
|
27442
27442
|
function sniffVideoMime(bytes) {
|
|
27443
27443
|
if (startsWith2(bytes, MP4_FILE_TYPE, 4)) {
|
|
@@ -27566,10 +27566,10 @@ async function replaceImageMarkers(text2, replace) {
|
|
|
27566
27566
|
let cursor = 0;
|
|
27567
27567
|
let rewritten = "";
|
|
27568
27568
|
for (const match of matches) {
|
|
27569
|
-
const
|
|
27570
|
-
rewritten += text2.slice(cursor,
|
|
27569
|
+
const index = match.index ?? 0;
|
|
27570
|
+
rewritten += text2.slice(cursor, index);
|
|
27571
27571
|
rewritten += await replace(match[1] ?? "");
|
|
27572
|
-
cursor =
|
|
27572
|
+
cursor = index + match[0].length;
|
|
27573
27573
|
}
|
|
27574
27574
|
return `${rewritten}${text2.slice(cursor)}`;
|
|
27575
27575
|
}
|
|
@@ -30694,7 +30694,7 @@ function haveSameKeys(left, right) {
|
|
|
30694
30694
|
const leftKeys = Object.keys(left);
|
|
30695
30695
|
const rightKeys = Object.keys(right);
|
|
30696
30696
|
if (leftKeys.length !== rightKeys.length) return false;
|
|
30697
|
-
for (const [
|
|
30697
|
+
for (const [index, key] of leftKeys.entries()) if (key !== rightKeys[index]) return false;
|
|
30698
30698
|
return true;
|
|
30699
30699
|
}
|
|
30700
30700
|
function mapUpdateSet(table, values) {
|
|
@@ -32200,60 +32200,6 @@ function sqliteTableWithCasing(casing) {
|
|
|
32200
32200
|
}
|
|
32201
32201
|
var sqliteTable = sqliteTableWithCasing(void 0);
|
|
32202
32202
|
|
|
32203
|
-
// ../../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
|
|
32204
|
-
var IndexBuilderOn = class {
|
|
32205
|
-
static [entityKind] = "SQLiteIndexBuilderOn";
|
|
32206
|
-
constructor(name2, unique) {
|
|
32207
|
-
this.name = name2;
|
|
32208
|
-
this.unique = unique;
|
|
32209
|
-
}
|
|
32210
|
-
on(...columns) {
|
|
32211
|
-
return new IndexBuilder(this.name, columns, this.unique);
|
|
32212
|
-
}
|
|
32213
|
-
};
|
|
32214
|
-
var IndexBuilder = class {
|
|
32215
|
-
static [entityKind] = "SQLiteIndexBuilder";
|
|
32216
|
-
/** @internal */
|
|
32217
|
-
config;
|
|
32218
|
-
constructor(name2, columns, unique) {
|
|
32219
|
-
this.config = {
|
|
32220
|
-
name: name2,
|
|
32221
|
-
columns,
|
|
32222
|
-
unique,
|
|
32223
|
-
where: void 0
|
|
32224
|
-
};
|
|
32225
|
-
}
|
|
32226
|
-
/**
|
|
32227
|
-
* Condition for partial index.
|
|
32228
|
-
*/
|
|
32229
|
-
where(condition) {
|
|
32230
|
-
this.config.where = condition;
|
|
32231
|
-
return this;
|
|
32232
|
-
}
|
|
32233
|
-
/** @internal */
|
|
32234
|
-
build(table) {
|
|
32235
|
-
return new Index(this.config, table);
|
|
32236
|
-
}
|
|
32237
|
-
};
|
|
32238
|
-
var Index = class {
|
|
32239
|
-
static [entityKind] = "SQLiteIndex";
|
|
32240
|
-
config;
|
|
32241
|
-
isNameExplicit;
|
|
32242
|
-
constructor(config2, table) {
|
|
32243
|
-
this.config = {
|
|
32244
|
-
...config2,
|
|
32245
|
-
table
|
|
32246
|
-
};
|
|
32247
|
-
this.isNameExplicit = !!config2.name;
|
|
32248
|
-
}
|
|
32249
|
-
};
|
|
32250
|
-
function index(name2) {
|
|
32251
|
-
return new IndexBuilderOn(name2, false);
|
|
32252
|
-
}
|
|
32253
|
-
function uniqueIndex(name2) {
|
|
32254
|
-
return new IndexBuilderOn(name2, true);
|
|
32255
|
-
}
|
|
32256
|
-
|
|
32257
32203
|
// ../../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
|
|
32258
32204
|
function extractUsedTable(table) {
|
|
32259
32205
|
if (is(table, SQLiteTable)) return [`${table[Table.Symbol.BaseName]}`];
|
|
@@ -33078,8 +33024,8 @@ var SQLiteDialect = class {
|
|
|
33078
33024
|
buildJoins(joins) {
|
|
33079
33025
|
if (!joins || joins.length === 0) return;
|
|
33080
33026
|
const joinsArray = [];
|
|
33081
|
-
if (joins) for (const [
|
|
33082
|
-
if (
|
|
33027
|
+
if (joins) for (const [index, joinMeta] of joins.entries()) {
|
|
33028
|
+
if (index === 0) joinsArray.push(sql` `);
|
|
33083
33029
|
const table = joinMeta.table;
|
|
33084
33030
|
const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : void 0;
|
|
33085
33031
|
if (is(table, SQLiteTable)) {
|
|
@@ -33089,7 +33035,7 @@ var SQLiteDialect = class {
|
|
|
33089
33035
|
const alias = tableName === origTableName ? void 0 : joinMeta.alias;
|
|
33090
33036
|
joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`);
|
|
33091
33037
|
} else joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join ${table}${onSql}`);
|
|
33092
|
-
if (
|
|
33038
|
+
if (index < joins.length - 1) joinsArray.push(sql` `);
|
|
33093
33039
|
}
|
|
33094
33040
|
return sql.join(joinsArray);
|
|
33095
33041
|
}
|
|
@@ -33098,9 +33044,9 @@ var SQLiteDialect = class {
|
|
|
33098
33044
|
}
|
|
33099
33045
|
buildOrderBy(orderBy) {
|
|
33100
33046
|
const orderByList = [];
|
|
33101
|
-
if (orderBy) for (const [
|
|
33047
|
+
if (orderBy) for (const [index, orderByValue] of orderBy.entries()) {
|
|
33102
33048
|
orderByList.push(orderByValue);
|
|
33103
|
-
if (
|
|
33049
|
+
if (index < orderBy.length - 1) orderByList.push(sql`, `);
|
|
33104
33050
|
}
|
|
33105
33051
|
return orderByList.length > 0 ? sql` order by ${sql.join(orderByList)}` : void 0;
|
|
33106
33052
|
}
|
|
@@ -33128,9 +33074,9 @@ var SQLiteDialect = class {
|
|
|
33128
33074
|
const whereSql = where ? sql` where ${where}` : void 0;
|
|
33129
33075
|
const havingSql = having ? sql` having ${having}` : void 0;
|
|
33130
33076
|
const groupByList = [];
|
|
33131
|
-
if (groupBy) for (const [
|
|
33077
|
+
if (groupBy) for (const [index, groupByValue] of groupBy.entries()) {
|
|
33132
33078
|
groupByList.push(groupByValue);
|
|
33133
|
-
if (
|
|
33079
|
+
if (index < groupBy.length - 1) groupByList.push(sql`, `);
|
|
33134
33080
|
}
|
|
33135
33081
|
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}`;
|
|
33136
33082
|
if (setOperators.length > 0) return this.buildSetOperations(finalQuery, setOperators);
|
|
@@ -34422,6 +34368,10 @@ var acpSessionStoreMigrations = [
|
|
|
34422
34368
|
{
|
|
34423
34369
|
"name": "0002_equal_black_queen.sql",
|
|
34424
34370
|
"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`);"
|
|
34371
|
+
},
|
|
34372
|
+
{
|
|
34373
|
+
"name": "0003_silky_ravenous.sql",
|
|
34374
|
+
"sql": "DROP TABLE `session_event_v2`;"
|
|
34425
34375
|
}
|
|
34426
34376
|
];
|
|
34427
34377
|
|
|
@@ -34443,21 +34393,6 @@ var deletedAcpSession = sqliteTable("deleted_acp_session", {
|
|
|
34443
34393
|
sessionId: text("session_id").primaryKey()
|
|
34444
34394
|
});
|
|
34445
34395
|
|
|
34446
|
-
// src/schema/acp-session-store/session-event-v2.ts
|
|
34447
|
-
var sessionEventV2 = sqliteTable(
|
|
34448
|
-
"session_event_v2",
|
|
34449
|
-
{
|
|
34450
|
-
eventId: text("event_id").primaryKey(),
|
|
34451
|
-
eventJson: text("event_json").notNull(),
|
|
34452
|
-
position: integer2("position").notNull(),
|
|
34453
|
-
sessionId: text("session_id").notNull()
|
|
34454
|
-
},
|
|
34455
|
-
(table) => [
|
|
34456
|
-
uniqueIndex("session_event_v2_session_position_unique").on(table.sessionId, table.position),
|
|
34457
|
-
index("session_event_v2_session_position_index").on(table.sessionId, table.position)
|
|
34458
|
-
]
|
|
34459
|
-
);
|
|
34460
|
-
|
|
34461
34396
|
// src/acp/session-store.ts
|
|
34462
34397
|
var AcpStoredSession = class {
|
|
34463
34398
|
additionalDirectories;
|
|
@@ -34574,15 +34509,15 @@ var SqliteAcpSessionStore = class {
|
|
|
34574
34509
|
this.#sqliteDatabase.close();
|
|
34575
34510
|
throw new Error("The ACP Session database was created by a newer Mobius version");
|
|
34576
34511
|
}
|
|
34577
|
-
for (let
|
|
34578
|
-
const migration = acpSessionStoreMigrations[
|
|
34512
|
+
for (let index = version2; index < acpSessionStoreMigrations.length; index += 1) {
|
|
34513
|
+
const migration = acpSessionStoreMigrations[index];
|
|
34579
34514
|
if (migration === void 0) {
|
|
34580
34515
|
throw new Error("The ACP Session migration is unavailable");
|
|
34581
34516
|
}
|
|
34582
34517
|
this.#sqliteDatabase.exec("BEGIN IMMEDIATE");
|
|
34583
34518
|
try {
|
|
34584
34519
|
this.#sqliteDatabase.exec(migration.sql);
|
|
34585
|
-
this.#sqliteDatabase.exec(`PRAGMA user_version = ${
|
|
34520
|
+
this.#sqliteDatabase.exec(`PRAGMA user_version = ${index + 1}`);
|
|
34586
34521
|
this.#sqliteDatabase.exec("COMMIT");
|
|
34587
34522
|
} catch (error62) {
|
|
34588
34523
|
this.#sqliteDatabase.exec("ROLLBACK");
|
|
@@ -34658,7 +34593,7 @@ var RetryableAcpInitializationError = class extends AcpExecutionError {
|
|
|
34658
34593
|
}
|
|
34659
34594
|
};
|
|
34660
34595
|
function arraysEqual(left, right) {
|
|
34661
|
-
return left.length === right.length && left.every((value,
|
|
34596
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
34662
34597
|
}
|
|
34663
34598
|
function recordsEqual(left, right) {
|
|
34664
34599
|
const leftEntries = Object.entries(left);
|
|
@@ -36455,9 +36390,9 @@ var AcpProcessCapacityLock = class {
|
|
|
36455
36390
|
return await waiter.completion.promise;
|
|
36456
36391
|
} finally {
|
|
36457
36392
|
signal.removeEventListener("abort", waiter.cancel);
|
|
36458
|
-
const
|
|
36459
|
-
if (
|
|
36460
|
-
this.#waiters.splice(
|
|
36393
|
+
const index = this.#waiters.indexOf(waiter);
|
|
36394
|
+
if (index >= 0) {
|
|
36395
|
+
this.#waiters.splice(index, 1);
|
|
36461
36396
|
}
|
|
36462
36397
|
}
|
|
36463
36398
|
};
|
|
@@ -38511,8 +38446,8 @@ var ACTIVE_TURN_TEXT_CHUNK_LIMIT = Math.floor(SESSION_HISTORY_CHARACTER_LIMIT /
|
|
|
38511
38446
|
function boundedRecoveryMessages(messages) {
|
|
38512
38447
|
const selected = [];
|
|
38513
38448
|
let remainingCharacters = SESSION_HISTORY_CHARACTER_LIMIT;
|
|
38514
|
-
for (let
|
|
38515
|
-
const message = messages[
|
|
38449
|
+
for (let index = messages.length - 1; index >= 0 && selected.length < SESSION_HISTORY_MESSAGE_LIMIT; index -= 1) {
|
|
38450
|
+
const message = messages[index];
|
|
38516
38451
|
if (message === void 0) {
|
|
38517
38452
|
break;
|
|
38518
38453
|
}
|
|
@@ -38653,7 +38588,7 @@ var ActiveDaemonTurn = class {
|
|
|
38653
38588
|
];
|
|
38654
38589
|
} else {
|
|
38655
38590
|
this.#timeline = this.#timeline.map(
|
|
38656
|
-
(entry,
|
|
38591
|
+
(entry, index) => index === target && entry.kind === "message" ? { ...entry, content: new Map([...entry.content, [event.contentId, event.content]]) } : entry
|
|
38657
38592
|
);
|
|
38658
38593
|
}
|
|
38659
38594
|
} else if (event.kind === SESSION_PERMISSION_REQUESTED_KIND || event.kind === SESSION_ELICITATION_REQUESTED_KIND) {
|
|
@@ -39679,7 +39614,7 @@ async function readAcpHistory(sessions, directories, bindingId, options, nativeS
|
|
|
39679
39614
|
async (directory) => await directories.identify(bindingId, directory, options.signal)
|
|
39680
39615
|
)
|
|
39681
39616
|
);
|
|
39682
|
-
if (primary.path !== options.cwd || additional.length !== options.additionalDirectories.length || additional.some((directory,
|
|
39617
|
+
if (primary.path !== options.cwd || additional.length !== options.additionalDirectories.length || additional.some((directory, index) => directory.path !== options.additionalDirectories[index])) {
|
|
39683
39618
|
throw new AcpExecutionError(
|
|
39684
39619
|
"The native Session belongs to another workspace.",
|
|
39685
39620
|
{},
|
|
@@ -39812,7 +39747,7 @@ var NativeSessionService = class {
|
|
|
39812
39747
|
"native_session_not_found"
|
|
39813
39748
|
);
|
|
39814
39749
|
}
|
|
39815
|
-
if (source.agentId !== command.agentId || source.cwd !== cwd || source.additionalDirectories.length !== additionalDirectories.length || source.additionalDirectories.some((path2,
|
|
39750
|
+
if (source.agentId !== command.agentId || source.cwd !== cwd || source.additionalDirectories.length !== additionalDirectories.length || source.additionalDirectories.some((path2, index) => path2 !== additionalDirectories[index])) {
|
|
39816
39751
|
throw new AcpExecutionError(
|
|
39817
39752
|
"The source conversation execution target does not match the fork request",
|
|
39818
39753
|
{},
|
|
@@ -39833,8 +39768,8 @@ var NativeSessionService = class {
|
|
|
39833
39768
|
signal.throwIfAborted();
|
|
39834
39769
|
const directory = await this.#directories.list(this.#config.bindingId, command.directoryId, signal);
|
|
39835
39770
|
const ready2 = {
|
|
39836
|
-
additionalDirectories: additionalDirectories.map((path2,
|
|
39837
|
-
directoryId: command.additionalDirectoryIds[
|
|
39771
|
+
additionalDirectories: additionalDirectories.map((path2, index) => ({
|
|
39772
|
+
directoryId: command.additionalDirectoryIds[index] ?? command.directoryId,
|
|
39838
39773
|
name: basename4(path2) || path2
|
|
39839
39774
|
})),
|
|
39840
39775
|
agentId: command.agentId,
|
|
@@ -40167,7 +40102,7 @@ var NativeSessionService = class {
|
|
|
40167
40102
|
resolveTarget = async (command, options, selected) => {
|
|
40168
40103
|
let cursor = null;
|
|
40169
40104
|
const visited = /* @__PURE__ */ new Set();
|
|
40170
|
-
for (let
|
|
40105
|
+
for (let index = 0; index < 100; index += 1) {
|
|
40171
40106
|
const page = await this.#sessions.listNativeSessions(options, cursor);
|
|
40172
40107
|
const info = page.sessions.find((entry) => entry.sessionId === selected.nativeSessionId);
|
|
40173
40108
|
if (info !== void 0) {
|
|
@@ -40175,7 +40110,7 @@ var NativeSessionService = class {
|
|
|
40175
40110
|
if (target === null) {
|
|
40176
40111
|
throw new LocalAuthorizationError("The selected native session is not authorized");
|
|
40177
40112
|
}
|
|
40178
|
-
if (target.cwd !== selected.cwd || target.additionalDirectories.length !== selected.additionalDirectories.length || target.additionalDirectories.some((path2,
|
|
40113
|
+
if (target.cwd !== selected.cwd || target.additionalDirectories.length !== selected.additionalDirectories.length || target.additionalDirectories.some((path2, index2) => path2 !== selected.additionalDirectories[index2])) {
|
|
40179
40114
|
throw new AcpExecutionError(
|
|
40180
40115
|
"This session's directory changed. Refresh the list before continuing.",
|
|
40181
40116
|
{},
|
|
@@ -41363,8 +41298,8 @@ function selectMessagesBefore(messages, endIndex, messageLimit, characterLimit)
|
|
|
41363
41298
|
const selected = [];
|
|
41364
41299
|
let remainingCharacters = characterLimit;
|
|
41365
41300
|
let startIndex = endIndex;
|
|
41366
|
-
for (let
|
|
41367
|
-
const message = messages[
|
|
41301
|
+
for (let index = endIndex - 1; index >= 0 && selected.length < messageLimit; index -= 1) {
|
|
41302
|
+
const message = messages[index];
|
|
41368
41303
|
if (message === void 0) {
|
|
41369
41304
|
break;
|
|
41370
41305
|
}
|
|
@@ -41374,7 +41309,7 @@ function selectMessagesBefore(messages, endIndex, messageLimit, characterLimit)
|
|
|
41374
41309
|
}
|
|
41375
41310
|
selected.unshift(message);
|
|
41376
41311
|
remainingCharacters -= characters;
|
|
41377
|
-
startIndex =
|
|
41312
|
+
startIndex = index;
|
|
41378
41313
|
}
|
|
41379
41314
|
if (selected.length === 0 && endIndex > 0) {
|
|
41380
41315
|
throw new AcpExecutionError(
|
|
@@ -41610,7 +41545,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
41610
41545
|
const replay = await sessions.loadSessionEventsV2(loadOptions, command.eventLimit, command.cursor);
|
|
41611
41546
|
signal.throwIfAborted();
|
|
41612
41547
|
const events = replay.events.map(
|
|
41613
|
-
(event,
|
|
41548
|
+
(event, index) => eventLogV2.event(command.sessionId, replay.startPosition + index, event, "1970-01-01T00:00:00.000Z")
|
|
41614
41549
|
);
|
|
41615
41550
|
const tailCursor = events.at(-1)?.eventId ?? "";
|
|
41616
41551
|
audit.record({
|
|
@@ -43320,7 +43255,7 @@ function promptContent(command) {
|
|
|
43320
43255
|
}
|
|
43321
43256
|
return content;
|
|
43322
43257
|
}
|
|
43323
|
-
function
|
|
43258
|
+
function sessionEventV2(daemonGenerationId, sessionId, position, event, recordedAt) {
|
|
43324
43259
|
const sessionPrefix = createHash6("sha256").update(sessionId).digest("hex").slice(0, 16);
|
|
43325
43260
|
return {
|
|
43326
43261
|
eventId: `event-${daemonGenerationId}-${sessionPrefix}-${position.toString().padStart(16, "0")}`,
|
|
@@ -43356,7 +43291,7 @@ var DaemonSessionEventLogV2 = class {
|
|
|
43356
43291
|
record = (sessionId, event, position) => {
|
|
43357
43292
|
this.#publisher.publishV2(this.event(sessionId, position, event, (/* @__PURE__ */ new Date()).toISOString()));
|
|
43358
43293
|
};
|
|
43359
|
-
event = (sessionId, position, event, recordedAt) =>
|
|
43294
|
+
event = (sessionId, position, event, recordedAt) => sessionEventV2(this.daemonGenerationId, sessionId, position, event, recordedAt);
|
|
43360
43295
|
queueChanged = (_sessionId) => void 0;
|
|
43361
43296
|
completed = (sessionId, commandId, _stopReason) => {
|
|
43362
43297
|
const request = this.#queued.get(commandId);
|
|
@@ -43493,7 +43428,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
43493
43428
|
options2.signal
|
|
43494
43429
|
);
|
|
43495
43430
|
return cwd === options2.cwd && additionalDirectories.length === options2.additionalDirectories.length && additionalDirectories.every(
|
|
43496
|
-
(directory,
|
|
43431
|
+
(directory, index) => directory === options2.additionalDirectories[index]
|
|
43497
43432
|
);
|
|
43498
43433
|
});
|
|
43499
43434
|
}
|
|
@@ -43965,16 +43900,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
43965
43900
|
};
|
|
43966
43901
|
#readConnectionForChannel = async (channelId, signal) => {
|
|
43967
43902
|
const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
|
|
43968
|
-
const
|
|
43903
|
+
const index = decodeChannelIndex(
|
|
43969
43904
|
await readJsonFile(this.channelIndexPath(normalizedChannelId), signal, "connection_not_found")
|
|
43970
43905
|
);
|
|
43971
|
-
if (
|
|
43906
|
+
if (index.applicationId !== this.applicationId || index.installationId !== this.installationId || index.channelId !== normalizedChannelId) {
|
|
43972
43907
|
throw new RuntimeInstallationStoreError(
|
|
43973
43908
|
"connection_owner_mismatch",
|
|
43974
43909
|
"The saved Runtime connection belongs to another installation"
|
|
43975
43910
|
);
|
|
43976
43911
|
}
|
|
43977
|
-
return await this.readConnection(
|
|
43912
|
+
return await this.readConnection(index.connectionId, signal);
|
|
43978
43913
|
};
|
|
43979
43914
|
saveConnection = async (input2, signal) => {
|
|
43980
43915
|
const stored = new VerifiedRuntimeConnection(
|