@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/cli.js
CHANGED
|
@@ -2340,11 +2340,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2340
2340
|
};
|
|
2341
2341
|
this._checkNumberOfArguments();
|
|
2342
2342
|
const processedArgs = [];
|
|
2343
|
-
this.registeredArguments.forEach((declaredArg,
|
|
2343
|
+
this.registeredArguments.forEach((declaredArg, index) => {
|
|
2344
2344
|
let value = declaredArg.defaultValue;
|
|
2345
2345
|
if (declaredArg.variadic) {
|
|
2346
|
-
if (
|
|
2347
|
-
value = this.args.slice(
|
|
2346
|
+
if (index < this.args.length) {
|
|
2347
|
+
value = this.args.slice(index);
|
|
2348
2348
|
if (declaredArg.parseArg) {
|
|
2349
2349
|
value = value.reduce((processed, v) => {
|
|
2350
2350
|
return myParseArg(declaredArg, v, processed);
|
|
@@ -2353,13 +2353,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2353
2353
|
} else if (value === void 0) {
|
|
2354
2354
|
value = [];
|
|
2355
2355
|
}
|
|
2356
|
-
} else if (
|
|
2357
|
-
value = this.args[
|
|
2356
|
+
} else if (index < this.args.length) {
|
|
2357
|
+
value = this.args[index];
|
|
2358
2358
|
if (declaredArg.parseArg) {
|
|
2359
2359
|
value = myParseArg(declaredArg, value, declaredArg.defaultValue);
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
2362
|
-
processedArgs[
|
|
2362
|
+
processedArgs[index] = value;
|
|
2363
2363
|
});
|
|
2364
2364
|
this.processedArgs = processedArgs;
|
|
2365
2365
|
}
|
|
@@ -2653,10 +2653,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2653
2653
|
}
|
|
2654
2654
|
}
|
|
2655
2655
|
if (/^--[^=]+=/.test(arg)) {
|
|
2656
|
-
const
|
|
2657
|
-
const option = this._findOption(arg.slice(0,
|
|
2656
|
+
const index = arg.indexOf("=");
|
|
2657
|
+
const option = this._findOption(arg.slice(0, index));
|
|
2658
2658
|
if (option && (option.required || option.optional)) {
|
|
2659
|
-
this.emit(`option:${option.name()}`, arg.slice(
|
|
2659
|
+
this.emit(`option:${option.name()}`, arg.slice(index + 1));
|
|
2660
2660
|
continue;
|
|
2661
2661
|
}
|
|
2662
2662
|
}
|
|
@@ -3381,7 +3381,7 @@ var program = new Command();
|
|
|
3381
3381
|
// package.json
|
|
3382
3382
|
var package_default = {
|
|
3383
3383
|
name: "@moxt-ai/mobius",
|
|
3384
|
-
version: "0.0.
|
|
3384
|
+
version: "0.0.173",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -8320,11 +8320,11 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
8320
8320
|
return payload;
|
|
8321
8321
|
};
|
|
8322
8322
|
});
|
|
8323
|
-
function handleArrayResult(result, final,
|
|
8323
|
+
function handleArrayResult(result, final, index) {
|
|
8324
8324
|
if (result.issues.length) {
|
|
8325
|
-
final.issues.push(...prefixIssues(
|
|
8325
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
8326
8326
|
}
|
|
8327
|
-
final.value[
|
|
8327
|
+
final.value[index] = result.value;
|
|
8328
8328
|
}
|
|
8329
8329
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
8330
8330
|
$ZodType.init(inst, def);
|
|
@@ -8935,14 +8935,14 @@ function mergeValues(a, b) {
|
|
|
8935
8935
|
return { valid: false, mergeErrorPath: [] };
|
|
8936
8936
|
}
|
|
8937
8937
|
const newArray = [];
|
|
8938
|
-
for (let
|
|
8939
|
-
const itemA = a[
|
|
8940
|
-
const itemB = b[
|
|
8938
|
+
for (let index = 0; index < a.length; index++) {
|
|
8939
|
+
const itemA = a[index];
|
|
8940
|
+
const itemB = b[index];
|
|
8941
8941
|
const sharedValue = mergeValues(itemA, itemB);
|
|
8942
8942
|
if (!sharedValue.valid) {
|
|
8943
8943
|
return {
|
|
8944
8944
|
valid: false,
|
|
8945
|
-
mergeErrorPath: [
|
|
8945
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
8946
8946
|
};
|
|
8947
8947
|
}
|
|
8948
8948
|
newArray.push(sharedValue.data);
|
|
@@ -9093,11 +9093,11 @@ function getTupleOptStart(items, key) {
|
|
|
9093
9093
|
}
|
|
9094
9094
|
return 0;
|
|
9095
9095
|
}
|
|
9096
|
-
function handleTupleResult(result, final,
|
|
9096
|
+
function handleTupleResult(result, final, index) {
|
|
9097
9097
|
if (result.issues.length) {
|
|
9098
|
-
final.issues.push(...prefixIssues(
|
|
9098
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
9099
9099
|
}
|
|
9100
|
-
final.value[
|
|
9100
|
+
final.value[index] = result.value;
|
|
9101
9101
|
}
|
|
9102
9102
|
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
9103
9103
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -23778,7 +23778,7 @@ function detectVersion(schema, defaultTarget) {
|
|
|
23778
23778
|
return defaultTarget ?? "draft-2020-12";
|
|
23779
23779
|
}
|
|
23780
23780
|
function applyMinItems(items, minItems) {
|
|
23781
|
-
return items.map((item,
|
|
23781
|
+
return items.map((item, index) => index < minItems ? item : item.optional());
|
|
23782
23782
|
}
|
|
23783
23783
|
function decodeJSONPointerSegment(segment) {
|
|
23784
23784
|
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
@@ -27852,9 +27852,9 @@ function comparePrerelease(left, right) {
|
|
|
27852
27852
|
if (left.length === 0 || right.length === 0) {
|
|
27853
27853
|
return left.length === right.length ? 0 : left.length === 0 ? 1 : -1;
|
|
27854
27854
|
}
|
|
27855
|
-
for (let
|
|
27856
|
-
const leftPart = left[
|
|
27857
|
-
const rightPart = right[
|
|
27855
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
27856
|
+
const leftPart = left[index];
|
|
27857
|
+
const rightPart = right[index];
|
|
27858
27858
|
if (leftPart === void 0 || rightPart === void 0) {
|
|
27859
27859
|
return leftPart === rightPart ? 0 : leftPart === void 0 ? -1 : 1;
|
|
27860
27860
|
}
|
|
@@ -27879,8 +27879,8 @@ function compareAgentVersions(left, right) {
|
|
|
27879
27879
|
if (parsedLeft === null || parsedRight === null) {
|
|
27880
27880
|
return null;
|
|
27881
27881
|
}
|
|
27882
|
-
for (let
|
|
27883
|
-
const difference = (parsedLeft.core[
|
|
27882
|
+
for (let index = 0; index < Math.max(parsedLeft.core.length, parsedRight.core.length); index += 1) {
|
|
27883
|
+
const difference = (parsedLeft.core[index] ?? 0) - (parsedRight.core[index] ?? 0);
|
|
27884
27884
|
if (difference !== 0) {
|
|
27885
27885
|
return Math.sign(difference);
|
|
27886
27886
|
}
|
|
@@ -28641,12 +28641,12 @@ var DEFAULT_AGENT_EXECUTION_CONFIGURATION = Object.freeze({
|
|
|
28641
28641
|
});
|
|
28642
28642
|
var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigurationSelectionSchema).max(100).superRefine((selections, context) => {
|
|
28643
28643
|
const identifiers = /* @__PURE__ */ new Set();
|
|
28644
|
-
for (const [
|
|
28644
|
+
for (const [index, selection] of selections.entries()) {
|
|
28645
28645
|
if (identifiers.has(selection.configId)) {
|
|
28646
28646
|
context.addIssue({
|
|
28647
28647
|
code: "custom",
|
|
28648
28648
|
message: "Session configuration identifiers must be unique",
|
|
28649
|
-
path: [
|
|
28649
|
+
path: [index, "configId"]
|
|
28650
28650
|
});
|
|
28651
28651
|
}
|
|
28652
28652
|
identifiers.add(selection.configId);
|
|
@@ -30190,12 +30190,12 @@ var sessionExportV2Schema = external_exports.object({
|
|
|
30190
30190
|
}).readonly().superRefine((session, context) => {
|
|
30191
30191
|
let previousPosition = 0n;
|
|
30192
30192
|
const eventIds = /* @__PURE__ */ new Set();
|
|
30193
|
-
for (const [
|
|
30193
|
+
for (const [index, event] of session.events.entries()) {
|
|
30194
30194
|
if (event.sessionId !== session.sessionId) {
|
|
30195
30195
|
context.addIssue({
|
|
30196
30196
|
code: "custom",
|
|
30197
30197
|
message: "Exported event belongs to a different Session",
|
|
30198
|
-
path: ["events",
|
|
30198
|
+
path: ["events", index, "sessionId"]
|
|
30199
30199
|
});
|
|
30200
30200
|
}
|
|
30201
30201
|
const position = BigInt(event.position);
|
|
@@ -30203,14 +30203,14 @@ var sessionExportV2Schema = external_exports.object({
|
|
|
30203
30203
|
context.addIssue({
|
|
30204
30204
|
code: "custom",
|
|
30205
30205
|
message: "Exported events are not in increasing position order",
|
|
30206
|
-
path: ["events",
|
|
30206
|
+
path: ["events", index, "position"]
|
|
30207
30207
|
});
|
|
30208
30208
|
}
|
|
30209
30209
|
if (eventIds.has(event.eventId)) {
|
|
30210
30210
|
context.addIssue({
|
|
30211
30211
|
code: "custom",
|
|
30212
30212
|
message: "Exported event identities are not unique",
|
|
30213
|
-
path: ["events",
|
|
30213
|
+
path: ["events", index, "eventId"]
|
|
30214
30214
|
});
|
|
30215
30215
|
}
|
|
30216
30216
|
previousPosition = position;
|
|
@@ -31052,16 +31052,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
31052
31052
|
};
|
|
31053
31053
|
#readConnectionForChannel = async (channelId, signal) => {
|
|
31054
31054
|
const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
|
|
31055
|
-
const
|
|
31055
|
+
const index = decodeChannelIndex(
|
|
31056
31056
|
await readJsonFile(this.channelIndexPath(normalizedChannelId), signal, "connection_not_found")
|
|
31057
31057
|
);
|
|
31058
|
-
if (
|
|
31058
|
+
if (index.applicationId !== this.applicationId || index.installationId !== this.installationId || index.channelId !== normalizedChannelId) {
|
|
31059
31059
|
throw new RuntimeInstallationStoreError(
|
|
31060
31060
|
"connection_owner_mismatch",
|
|
31061
31061
|
"The saved Runtime connection belongs to another installation"
|
|
31062
31062
|
);
|
|
31063
31063
|
}
|
|
31064
|
-
return await this.readConnection(
|
|
31064
|
+
return await this.readConnection(index.connectionId, signal);
|
|
31065
31065
|
};
|
|
31066
31066
|
saveConnection = async (input2, signal) => {
|
|
31067
31067
|
const stored = new VerifiedRuntimeConnection(
|
|
@@ -31256,16 +31256,16 @@ function hasExactKeys2(value, expectedKeys) {
|
|
|
31256
31256
|
}
|
|
31257
31257
|
function readSingleOption(arguments_, option) {
|
|
31258
31258
|
const values = [];
|
|
31259
|
-
for (let
|
|
31260
|
-
if (arguments_[
|
|
31259
|
+
for (let index = 0; index < arguments_.length; index += 1) {
|
|
31260
|
+
if (arguments_[index] !== option) {
|
|
31261
31261
|
continue;
|
|
31262
31262
|
}
|
|
31263
|
-
const value = arguments_[
|
|
31263
|
+
const value = arguments_[index + 1];
|
|
31264
31264
|
if (value === void 0 || value.startsWith("--")) {
|
|
31265
31265
|
throw new PairingClientError("invalid_arguments", `${option} requires a value`);
|
|
31266
31266
|
}
|
|
31267
31267
|
values.push(value);
|
|
31268
|
-
|
|
31268
|
+
index += 1;
|
|
31269
31269
|
}
|
|
31270
31270
|
if (values.length !== 1) {
|
|
31271
31271
|
throw new PairingClientError("invalid_arguments", `${option} must be provided exactly once`);
|
|
@@ -31273,8 +31273,8 @@ function readSingleOption(arguments_, option) {
|
|
|
31273
31273
|
return values[0] ?? "";
|
|
31274
31274
|
}
|
|
31275
31275
|
function assertKnownArguments(arguments_) {
|
|
31276
|
-
for (let
|
|
31277
|
-
const option = arguments_[
|
|
31276
|
+
for (let index = 0; index < arguments_.length; index += 2) {
|
|
31277
|
+
const option = arguments_[index];
|
|
31278
31278
|
if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace") {
|
|
31279
31279
|
throw new PairingClientError("invalid_arguments", `Unknown pairing option: ${option ?? "missing option"}`);
|
|
31280
31280
|
}
|
|
@@ -31674,7 +31674,7 @@ function startsWith(bytes, signature, offset = 0) {
|
|
|
31674
31674
|
if (bytes.byteLength < offset + signature.byteLength) {
|
|
31675
31675
|
return false;
|
|
31676
31676
|
}
|
|
31677
|
-
return signature.every((value,
|
|
31677
|
+
return signature.every((value, index) => bytes[offset + index] === value);
|
|
31678
31678
|
}
|
|
31679
31679
|
function sniffRasterMime(bytes) {
|
|
31680
31680
|
if (startsWith(bytes, PNG_SIGNATURE)) {
|
|
@@ -31802,7 +31802,7 @@ function startsWith2(bytes, signature, offset = 0) {
|
|
|
31802
31802
|
if (bytes.byteLength < offset + signature.byteLength) {
|
|
31803
31803
|
return false;
|
|
31804
31804
|
}
|
|
31805
|
-
return signature.every((value,
|
|
31805
|
+
return signature.every((value, index) => bytes[offset + index] === value);
|
|
31806
31806
|
}
|
|
31807
31807
|
function sniffVideoMime(bytes) {
|
|
31808
31808
|
if (startsWith2(bytes, MP4_FILE_TYPE, 4)) {
|
|
@@ -31931,10 +31931,10 @@ async function replaceImageMarkers(text2, replace) {
|
|
|
31931
31931
|
let cursor = 0;
|
|
31932
31932
|
let rewritten = "";
|
|
31933
31933
|
for (const match of matches) {
|
|
31934
|
-
const
|
|
31935
|
-
rewritten += text2.slice(cursor,
|
|
31934
|
+
const index = match.index ?? 0;
|
|
31935
|
+
rewritten += text2.slice(cursor, index);
|
|
31936
31936
|
rewritten += await replace(match[1] ?? "");
|
|
31937
|
-
cursor =
|
|
31937
|
+
cursor = index + match[0].length;
|
|
31938
31938
|
}
|
|
31939
31939
|
return `${rewritten}${text2.slice(cursor)}`;
|
|
31940
31940
|
}
|
|
@@ -35059,7 +35059,7 @@ function haveSameKeys(left, right) {
|
|
|
35059
35059
|
const leftKeys = Object.keys(left);
|
|
35060
35060
|
const rightKeys = Object.keys(right);
|
|
35061
35061
|
if (leftKeys.length !== rightKeys.length) return false;
|
|
35062
|
-
for (const [
|
|
35062
|
+
for (const [index, key] of leftKeys.entries()) if (key !== rightKeys[index]) return false;
|
|
35063
35063
|
return true;
|
|
35064
35064
|
}
|
|
35065
35065
|
function mapUpdateSet(table, values) {
|
|
@@ -36565,60 +36565,6 @@ function sqliteTableWithCasing(casing) {
|
|
|
36565
36565
|
}
|
|
36566
36566
|
var sqliteTable = sqliteTableWithCasing(void 0);
|
|
36567
36567
|
|
|
36568
|
-
// ../../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
|
|
36569
|
-
var IndexBuilderOn = class {
|
|
36570
|
-
static [entityKind] = "SQLiteIndexBuilderOn";
|
|
36571
|
-
constructor(name2, unique) {
|
|
36572
|
-
this.name = name2;
|
|
36573
|
-
this.unique = unique;
|
|
36574
|
-
}
|
|
36575
|
-
on(...columns) {
|
|
36576
|
-
return new IndexBuilder(this.name, columns, this.unique);
|
|
36577
|
-
}
|
|
36578
|
-
};
|
|
36579
|
-
var IndexBuilder = class {
|
|
36580
|
-
static [entityKind] = "SQLiteIndexBuilder";
|
|
36581
|
-
/** @internal */
|
|
36582
|
-
config;
|
|
36583
|
-
constructor(name2, columns, unique) {
|
|
36584
|
-
this.config = {
|
|
36585
|
-
name: name2,
|
|
36586
|
-
columns,
|
|
36587
|
-
unique,
|
|
36588
|
-
where: void 0
|
|
36589
|
-
};
|
|
36590
|
-
}
|
|
36591
|
-
/**
|
|
36592
|
-
* Condition for partial index.
|
|
36593
|
-
*/
|
|
36594
|
-
where(condition) {
|
|
36595
|
-
this.config.where = condition;
|
|
36596
|
-
return this;
|
|
36597
|
-
}
|
|
36598
|
-
/** @internal */
|
|
36599
|
-
build(table) {
|
|
36600
|
-
return new Index(this.config, table);
|
|
36601
|
-
}
|
|
36602
|
-
};
|
|
36603
|
-
var Index = class {
|
|
36604
|
-
static [entityKind] = "SQLiteIndex";
|
|
36605
|
-
config;
|
|
36606
|
-
isNameExplicit;
|
|
36607
|
-
constructor(config2, table) {
|
|
36608
|
-
this.config = {
|
|
36609
|
-
...config2,
|
|
36610
|
-
table
|
|
36611
|
-
};
|
|
36612
|
-
this.isNameExplicit = !!config2.name;
|
|
36613
|
-
}
|
|
36614
|
-
};
|
|
36615
|
-
function index(name2) {
|
|
36616
|
-
return new IndexBuilderOn(name2, false);
|
|
36617
|
-
}
|
|
36618
|
-
function uniqueIndex(name2) {
|
|
36619
|
-
return new IndexBuilderOn(name2, true);
|
|
36620
|
-
}
|
|
36621
|
-
|
|
36622
36568
|
// ../../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
|
|
36623
36569
|
function extractUsedTable(table) {
|
|
36624
36570
|
if (is(table, SQLiteTable)) return [`${table[Table.Symbol.BaseName]}`];
|
|
@@ -37443,8 +37389,8 @@ var SQLiteDialect = class {
|
|
|
37443
37389
|
buildJoins(joins) {
|
|
37444
37390
|
if (!joins || joins.length === 0) return;
|
|
37445
37391
|
const joinsArray = [];
|
|
37446
|
-
if (joins) for (const [
|
|
37447
|
-
if (
|
|
37392
|
+
if (joins) for (const [index, joinMeta] of joins.entries()) {
|
|
37393
|
+
if (index === 0) joinsArray.push(sql` `);
|
|
37448
37394
|
const table = joinMeta.table;
|
|
37449
37395
|
const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : void 0;
|
|
37450
37396
|
if (is(table, SQLiteTable)) {
|
|
@@ -37454,7 +37400,7 @@ var SQLiteDialect = class {
|
|
|
37454
37400
|
const alias = tableName === origTableName ? void 0 : joinMeta.alias;
|
|
37455
37401
|
joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`);
|
|
37456
37402
|
} else joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join ${table}${onSql}`);
|
|
37457
|
-
if (
|
|
37403
|
+
if (index < joins.length - 1) joinsArray.push(sql` `);
|
|
37458
37404
|
}
|
|
37459
37405
|
return sql.join(joinsArray);
|
|
37460
37406
|
}
|
|
@@ -37463,9 +37409,9 @@ var SQLiteDialect = class {
|
|
|
37463
37409
|
}
|
|
37464
37410
|
buildOrderBy(orderBy) {
|
|
37465
37411
|
const orderByList = [];
|
|
37466
|
-
if (orderBy) for (const [
|
|
37412
|
+
if (orderBy) for (const [index, orderByValue] of orderBy.entries()) {
|
|
37467
37413
|
orderByList.push(orderByValue);
|
|
37468
|
-
if (
|
|
37414
|
+
if (index < orderBy.length - 1) orderByList.push(sql`, `);
|
|
37469
37415
|
}
|
|
37470
37416
|
return orderByList.length > 0 ? sql` order by ${sql.join(orderByList)}` : void 0;
|
|
37471
37417
|
}
|
|
@@ -37493,9 +37439,9 @@ var SQLiteDialect = class {
|
|
|
37493
37439
|
const whereSql = where ? sql` where ${where}` : void 0;
|
|
37494
37440
|
const havingSql = having ? sql` having ${having}` : void 0;
|
|
37495
37441
|
const groupByList = [];
|
|
37496
|
-
if (groupBy) for (const [
|
|
37442
|
+
if (groupBy) for (const [index, groupByValue] of groupBy.entries()) {
|
|
37497
37443
|
groupByList.push(groupByValue);
|
|
37498
|
-
if (
|
|
37444
|
+
if (index < groupBy.length - 1) groupByList.push(sql`, `);
|
|
37499
37445
|
}
|
|
37500
37446
|
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}`;
|
|
37501
37447
|
if (setOperators.length > 0) return this.buildSetOperations(finalQuery, setOperators);
|
|
@@ -38787,6 +38733,10 @@ var acpSessionStoreMigrations = [
|
|
|
38787
38733
|
{
|
|
38788
38734
|
"name": "0002_equal_black_queen.sql",
|
|
38789
38735
|
"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`);"
|
|
38736
|
+
},
|
|
38737
|
+
{
|
|
38738
|
+
"name": "0003_silky_ravenous.sql",
|
|
38739
|
+
"sql": "DROP TABLE `session_event_v2`;"
|
|
38790
38740
|
}
|
|
38791
38741
|
];
|
|
38792
38742
|
|
|
@@ -38808,21 +38758,6 @@ var deletedAcpSession = sqliteTable("deleted_acp_session", {
|
|
|
38808
38758
|
sessionId: text("session_id").primaryKey()
|
|
38809
38759
|
});
|
|
38810
38760
|
|
|
38811
|
-
// src/schema/acp-session-store/session-event-v2.ts
|
|
38812
|
-
var sessionEventV2 = sqliteTable(
|
|
38813
|
-
"session_event_v2",
|
|
38814
|
-
{
|
|
38815
|
-
eventId: text("event_id").primaryKey(),
|
|
38816
|
-
eventJson: text("event_json").notNull(),
|
|
38817
|
-
position: integer2("position").notNull(),
|
|
38818
|
-
sessionId: text("session_id").notNull()
|
|
38819
|
-
},
|
|
38820
|
-
(table) => [
|
|
38821
|
-
uniqueIndex("session_event_v2_session_position_unique").on(table.sessionId, table.position),
|
|
38822
|
-
index("session_event_v2_session_position_index").on(table.sessionId, table.position)
|
|
38823
|
-
]
|
|
38824
|
-
);
|
|
38825
|
-
|
|
38826
38761
|
// src/acp/session-store.ts
|
|
38827
38762
|
var AcpStoredSession = class {
|
|
38828
38763
|
additionalDirectories;
|
|
@@ -38939,15 +38874,15 @@ var SqliteAcpSessionStore = class {
|
|
|
38939
38874
|
this.#sqliteDatabase.close();
|
|
38940
38875
|
throw new Error("The ACP Session database was created by a newer Mobius version");
|
|
38941
38876
|
}
|
|
38942
|
-
for (let
|
|
38943
|
-
const migration = acpSessionStoreMigrations[
|
|
38877
|
+
for (let index = version2; index < acpSessionStoreMigrations.length; index += 1) {
|
|
38878
|
+
const migration = acpSessionStoreMigrations[index];
|
|
38944
38879
|
if (migration === void 0) {
|
|
38945
38880
|
throw new Error("The ACP Session migration is unavailable");
|
|
38946
38881
|
}
|
|
38947
38882
|
this.#sqliteDatabase.exec("BEGIN IMMEDIATE");
|
|
38948
38883
|
try {
|
|
38949
38884
|
this.#sqliteDatabase.exec(migration.sql);
|
|
38950
|
-
this.#sqliteDatabase.exec(`PRAGMA user_version = ${
|
|
38885
|
+
this.#sqliteDatabase.exec(`PRAGMA user_version = ${index + 1}`);
|
|
38951
38886
|
this.#sqliteDatabase.exec("COMMIT");
|
|
38952
38887
|
} catch (error62) {
|
|
38953
38888
|
this.#sqliteDatabase.exec("ROLLBACK");
|
|
@@ -39023,7 +38958,7 @@ var RetryableAcpInitializationError = class extends AcpExecutionError {
|
|
|
39023
38958
|
}
|
|
39024
38959
|
};
|
|
39025
38960
|
function arraysEqual(left, right) {
|
|
39026
|
-
return left.length === right.length && left.every((value,
|
|
38961
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
39027
38962
|
}
|
|
39028
38963
|
function recordsEqual(left, right) {
|
|
39029
38964
|
const leftEntries = Object.entries(left);
|
|
@@ -40820,9 +40755,9 @@ var AcpProcessCapacityLock = class {
|
|
|
40820
40755
|
return await waiter.completion.promise;
|
|
40821
40756
|
} finally {
|
|
40822
40757
|
signal.removeEventListener("abort", waiter.cancel);
|
|
40823
|
-
const
|
|
40824
|
-
if (
|
|
40825
|
-
this.#waiters.splice(
|
|
40758
|
+
const index = this.#waiters.indexOf(waiter);
|
|
40759
|
+
if (index >= 0) {
|
|
40760
|
+
this.#waiters.splice(index, 1);
|
|
40826
40761
|
}
|
|
40827
40762
|
}
|
|
40828
40763
|
};
|
|
@@ -42876,8 +42811,8 @@ var ACTIVE_TURN_TEXT_CHUNK_LIMIT = Math.floor(SESSION_HISTORY_CHARACTER_LIMIT /
|
|
|
42876
42811
|
function boundedRecoveryMessages(messages) {
|
|
42877
42812
|
const selected = [];
|
|
42878
42813
|
let remainingCharacters = SESSION_HISTORY_CHARACTER_LIMIT;
|
|
42879
|
-
for (let
|
|
42880
|
-
const message = messages[
|
|
42814
|
+
for (let index = messages.length - 1; index >= 0 && selected.length < SESSION_HISTORY_MESSAGE_LIMIT; index -= 1) {
|
|
42815
|
+
const message = messages[index];
|
|
42881
42816
|
if (message === void 0) {
|
|
42882
42817
|
break;
|
|
42883
42818
|
}
|
|
@@ -43018,7 +42953,7 @@ var ActiveDaemonTurn = class {
|
|
|
43018
42953
|
];
|
|
43019
42954
|
} else {
|
|
43020
42955
|
this.#timeline = this.#timeline.map(
|
|
43021
|
-
(entry,
|
|
42956
|
+
(entry, index) => index === target && entry.kind === "message" ? { ...entry, content: new Map([...entry.content, [event.contentId, event.content]]) } : entry
|
|
43022
42957
|
);
|
|
43023
42958
|
}
|
|
43024
42959
|
} else if (event.kind === SESSION_PERMISSION_REQUESTED_KIND || event.kind === SESSION_ELICITATION_REQUESTED_KIND) {
|
|
@@ -44044,7 +43979,7 @@ async function readAcpHistory(sessions, directories, bindingId, options, nativeS
|
|
|
44044
43979
|
async (directory) => await directories.identify(bindingId, directory, options.signal)
|
|
44045
43980
|
)
|
|
44046
43981
|
);
|
|
44047
|
-
if (primary.path !== options.cwd || additional.length !== options.additionalDirectories.length || additional.some((directory,
|
|
43982
|
+
if (primary.path !== options.cwd || additional.length !== options.additionalDirectories.length || additional.some((directory, index) => directory.path !== options.additionalDirectories[index])) {
|
|
44048
43983
|
throw new AcpExecutionError(
|
|
44049
43984
|
"The native Session belongs to another workspace.",
|
|
44050
43985
|
{},
|
|
@@ -44177,7 +44112,7 @@ var NativeSessionService = class {
|
|
|
44177
44112
|
"native_session_not_found"
|
|
44178
44113
|
);
|
|
44179
44114
|
}
|
|
44180
|
-
if (source.agentId !== command.agentId || source.cwd !== cwd || source.additionalDirectories.length !== additionalDirectories.length || source.additionalDirectories.some((path3,
|
|
44115
|
+
if (source.agentId !== command.agentId || source.cwd !== cwd || source.additionalDirectories.length !== additionalDirectories.length || source.additionalDirectories.some((path3, index) => path3 !== additionalDirectories[index])) {
|
|
44181
44116
|
throw new AcpExecutionError(
|
|
44182
44117
|
"The source conversation execution target does not match the fork request",
|
|
44183
44118
|
{},
|
|
@@ -44198,8 +44133,8 @@ var NativeSessionService = class {
|
|
|
44198
44133
|
signal.throwIfAborted();
|
|
44199
44134
|
const directory = await this.#directories.list(this.#config.bindingId, command.directoryId, signal);
|
|
44200
44135
|
const ready2 = {
|
|
44201
|
-
additionalDirectories: additionalDirectories.map((path3,
|
|
44202
|
-
directoryId: command.additionalDirectoryIds[
|
|
44136
|
+
additionalDirectories: additionalDirectories.map((path3, index) => ({
|
|
44137
|
+
directoryId: command.additionalDirectoryIds[index] ?? command.directoryId,
|
|
44203
44138
|
name: basename5(path3) || path3
|
|
44204
44139
|
})),
|
|
44205
44140
|
agentId: command.agentId,
|
|
@@ -44532,7 +44467,7 @@ var NativeSessionService = class {
|
|
|
44532
44467
|
resolveTarget = async (command, options, selected) => {
|
|
44533
44468
|
let cursor = null;
|
|
44534
44469
|
const visited = /* @__PURE__ */ new Set();
|
|
44535
|
-
for (let
|
|
44470
|
+
for (let index = 0; index < 100; index += 1) {
|
|
44536
44471
|
const page = await this.#sessions.listNativeSessions(options, cursor);
|
|
44537
44472
|
const info = page.sessions.find((entry) => entry.sessionId === selected.nativeSessionId);
|
|
44538
44473
|
if (info !== void 0) {
|
|
@@ -44540,7 +44475,7 @@ var NativeSessionService = class {
|
|
|
44540
44475
|
if (target === null) {
|
|
44541
44476
|
throw new LocalAuthorizationError("The selected native session is not authorized");
|
|
44542
44477
|
}
|
|
44543
|
-
if (target.cwd !== selected.cwd || target.additionalDirectories.length !== selected.additionalDirectories.length || target.additionalDirectories.some((path3,
|
|
44478
|
+
if (target.cwd !== selected.cwd || target.additionalDirectories.length !== selected.additionalDirectories.length || target.additionalDirectories.some((path3, index2) => path3 !== selected.additionalDirectories[index2])) {
|
|
44544
44479
|
throw new AcpExecutionError(
|
|
44545
44480
|
"This session's directory changed. Refresh the list before continuing.",
|
|
44546
44481
|
{},
|
|
@@ -45728,8 +45663,8 @@ function selectMessagesBefore(messages, endIndex, messageLimit, characterLimit)
|
|
|
45728
45663
|
const selected = [];
|
|
45729
45664
|
let remainingCharacters = characterLimit;
|
|
45730
45665
|
let startIndex = endIndex;
|
|
45731
|
-
for (let
|
|
45732
|
-
const message = messages[
|
|
45666
|
+
for (let index = endIndex - 1; index >= 0 && selected.length < messageLimit; index -= 1) {
|
|
45667
|
+
const message = messages[index];
|
|
45733
45668
|
if (message === void 0) {
|
|
45734
45669
|
break;
|
|
45735
45670
|
}
|
|
@@ -45739,7 +45674,7 @@ function selectMessagesBefore(messages, endIndex, messageLimit, characterLimit)
|
|
|
45739
45674
|
}
|
|
45740
45675
|
selected.unshift(message);
|
|
45741
45676
|
remainingCharacters -= characters;
|
|
45742
|
-
startIndex =
|
|
45677
|
+
startIndex = index;
|
|
45743
45678
|
}
|
|
45744
45679
|
if (selected.length === 0 && endIndex > 0) {
|
|
45745
45680
|
throw new AcpExecutionError(
|
|
@@ -45975,7 +45910,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
45975
45910
|
const replay = await sessions.loadSessionEventsV2(loadOptions, command.eventLimit, command.cursor);
|
|
45976
45911
|
signal.throwIfAborted();
|
|
45977
45912
|
const events = replay.events.map(
|
|
45978
|
-
(event,
|
|
45913
|
+
(event, index) => eventLogV2.event(command.sessionId, replay.startPosition + index, event, "1970-01-01T00:00:00.000Z")
|
|
45979
45914
|
);
|
|
45980
45915
|
const tailCursor = events.at(-1)?.eventId ?? "";
|
|
45981
45916
|
audit.record({
|
|
@@ -47685,7 +47620,7 @@ function promptContent(command) {
|
|
|
47685
47620
|
}
|
|
47686
47621
|
return content;
|
|
47687
47622
|
}
|
|
47688
|
-
function
|
|
47623
|
+
function sessionEventV2(daemonGenerationId, sessionId, position, event, recordedAt) {
|
|
47689
47624
|
const sessionPrefix = createHash7("sha256").update(sessionId).digest("hex").slice(0, 16);
|
|
47690
47625
|
return {
|
|
47691
47626
|
eventId: `event-${daemonGenerationId}-${sessionPrefix}-${position.toString().padStart(16, "0")}`,
|
|
@@ -47721,7 +47656,7 @@ var DaemonSessionEventLogV2 = class {
|
|
|
47721
47656
|
record = (sessionId, event, position) => {
|
|
47722
47657
|
this.#publisher.publishV2(this.event(sessionId, position, event, (/* @__PURE__ */ new Date()).toISOString()));
|
|
47723
47658
|
};
|
|
47724
|
-
event = (sessionId, position, event, recordedAt) =>
|
|
47659
|
+
event = (sessionId, position, event, recordedAt) => sessionEventV2(this.daemonGenerationId, sessionId, position, event, recordedAt);
|
|
47725
47660
|
queueChanged = (_sessionId) => void 0;
|
|
47726
47661
|
completed = (sessionId, commandId, _stopReason) => {
|
|
47727
47662
|
const request = this.#queued.get(commandId);
|
|
@@ -47858,7 +47793,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
47858
47793
|
options2.signal
|
|
47859
47794
|
);
|
|
47860
47795
|
return cwd === options2.cwd && additionalDirectories.length === options2.additionalDirectories.length && additionalDirectories.every(
|
|
47861
|
-
(directory,
|
|
47796
|
+
(directory, index) => directory === options2.additionalDirectories[index]
|
|
47862
47797
|
);
|
|
47863
47798
|
});
|
|
47864
47799
|
}
|
|
@@ -48329,12 +48264,12 @@ var RuntimeSupervisor = class {
|
|
|
48329
48264
|
}
|
|
48330
48265
|
};
|
|
48331
48266
|
function pairingIdentifier(arguments_) {
|
|
48332
|
-
const indexes = arguments_.flatMap((argument,
|
|
48267
|
+
const indexes = arguments_.flatMap((argument, index2) => argument === "--pairing" ? [index2] : []);
|
|
48333
48268
|
if (indexes.length !== 1) {
|
|
48334
48269
|
return null;
|
|
48335
48270
|
}
|
|
48336
|
-
const
|
|
48337
|
-
return
|
|
48271
|
+
const index = indexes[0];
|
|
48272
|
+
return index === void 0 ? null : arguments_[index + 1] ?? null;
|
|
48338
48273
|
}
|
|
48339
48274
|
async function waitForReady(active, signal) {
|
|
48340
48275
|
if (active.status === "online") {
|
|
@@ -48629,9 +48564,9 @@ function formatPairTable(pairs) {
|
|
|
48629
48564
|
const headers = ["connection_id", "app_id", "runtime_id", "workspace", "status"];
|
|
48630
48565
|
const rows = pairs.map((pair) => [pair.connectionId, pair.appId, pair.runtimeId, pair.workspace, pair.status]);
|
|
48631
48566
|
const widths = headers.map(
|
|
48632
|
-
(header,
|
|
48567
|
+
(header, index) => Math.max(header.length, ...rows.map((row) => row[index]?.length ?? 0))
|
|
48633
48568
|
);
|
|
48634
|
-
const line = (row) => `| ${row.map((value,
|
|
48569
|
+
const line = (row) => `| ${row.map((value, index) => value.padEnd(widths[index] ?? value.length)).join(" | ")} |`;
|
|
48635
48570
|
const divider = `|-${widths.map((width) => "-".repeat(width)).join("-|-")}-|`;
|
|
48636
48571
|
return `${line(headers)}
|
|
48637
48572
|
${divider}
|