@moxt-ai/mobius 0.0.349 → 0.0.351
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 +54 -11
- package/dist/cli.js.map +2 -2
- package/dist/engine/generated/acp-session-store-migrations.d.ts +3 -0
- package/dist/engine/generated/acp-session-store-migrations.d.ts.map +1 -1
- package/dist/engine/generated/acp-session-store-migrations.js +5 -1
- package/dist/engine/generated/acp-session-store-migrations.js.map +1 -1
- package/dist/engine/runtime/runtime-loop.d.ts +2 -0
- package/dist/engine/runtime/runtime-loop.d.ts.map +1 -1
- package/dist/engine/runtime/runtime-loop.js +4 -1
- package/dist/engine/runtime/runtime-loop.js.map +1 -1
- package/dist/engine/schema/acp-session-store/execution-receipt.d.ts +16 -0
- package/dist/engine/schema/acp-session-store/execution-receipt.d.ts.map +1 -1
- package/dist/engine/schema/acp-session-store/execution-receipt.js +2 -0
- package/dist/engine/schema/acp-session-store/execution-receipt.js.map +1 -1
- package/dist/engine/session/turn/execution-receipts.d.ts +3 -4
- package/dist/engine/session/turn/execution-receipts.d.ts.map +1 -1
- package/dist/engine/session/turn/execution-receipts.js +15 -5
- package/dist/engine/session/turn/execution-receipts.js.map +1 -1
- package/dist/engine/storage/session/execution-receipt-table.d.ts +1 -0
- package/dist/engine/storage/session/execution-receipt-table.d.ts.map +1 -1
- package/dist/engine/storage/session/execution-receipt-table.js +25 -7
- package/dist/engine/storage/session/execution-receipt-table.js.map +1 -1
- package/dist/engine/storage/sqlite/local-databases.d.ts.map +1 -1
- package/dist/engine/storage/sqlite/local-databases.js +6 -1
- package/dist/engine/storage/sqlite/local-databases.js.map +1 -1
- package/dist/engine/storage/sqlite/local-sqlite-database.d.ts +5 -0
- package/dist/engine/storage/sqlite/local-sqlite-database.d.ts.map +1 -1
- package/dist/engine/storage/sqlite/local-sqlite-database.js +9 -0
- package/dist/engine/storage/sqlite/local-sqlite-database.js.map +1 -1
- package/dist/engine.js +54 -11
- package/dist/engine.js.map +2 -2
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2086,7 +2086,7 @@ var init_package = __esm({
|
|
|
2086
2086
|
"package.json"() {
|
|
2087
2087
|
package_default = {
|
|
2088
2088
|
name: "@moxt-ai/mobius",
|
|
2089
|
-
version: "0.0.
|
|
2089
|
+
version: "0.0.351",
|
|
2090
2090
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
2091
2091
|
type: "module",
|
|
2092
2092
|
bin: {
|
|
@@ -84688,6 +84688,10 @@ var init_acp_session_store_migrations = __esm({
|
|
|
84688
84688
|
{
|
|
84689
84689
|
"name": "0008_execution_identity.sql",
|
|
84690
84690
|
"sql": "CREATE TABLE `execution_identity` (\n `command_id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `command_hash` text NOT NULL\n);\n"
|
|
84691
|
+
},
|
|
84692
|
+
{
|
|
84693
|
+
"name": "0009_receipt_admission_order.sql",
|
|
84694
|
+
"sql": "ALTER TABLE `execution_receipt` ADD `admission_order` integer;"
|
|
84691
84695
|
}
|
|
84692
84696
|
];
|
|
84693
84697
|
}
|
|
@@ -90137,6 +90141,13 @@ var init_local_sqlite_database = __esm({
|
|
|
90137
90141
|
throw new Error(`The ${label} migration is unavailable`);
|
|
90138
90142
|
}
|
|
90139
90143
|
this.transaction(() => {
|
|
90144
|
+
if (migration.compatibleColumn !== void 0) {
|
|
90145
|
+
const { table, column } = migration.compatibleColumn;
|
|
90146
|
+
if (this.#sqlite.prepare("SELECT name FROM pragma_table_info(?) WHERE name = ?").get(table, column) === void 0) {
|
|
90147
|
+
this.#sqlite.exec(migration.sql);
|
|
90148
|
+
}
|
|
90149
|
+
return;
|
|
90150
|
+
}
|
|
90140
90151
|
this.#sqlite.exec(migration.sql);
|
|
90141
90152
|
this.#sqlite.exec(`PRAGMA user_version = ${index2 + 1}`);
|
|
90142
90153
|
});
|
|
@@ -90182,7 +90193,16 @@ var init_local_databases = __esm({
|
|
|
90182
90193
|
init_acp_session_store_migrations();
|
|
90183
90194
|
init_session_event_cache_migrations();
|
|
90184
90195
|
init_local_sqlite_database();
|
|
90185
|
-
openAcpSessionDatabase = (path8) => new LocalSqliteDatabase(
|
|
90196
|
+
openAcpSessionDatabase = (path8) => new LocalSqliteDatabase(
|
|
90197
|
+
path8,
|
|
90198
|
+
"ACP Session database",
|
|
90199
|
+
acpSessionStoreMigrations.map(
|
|
90200
|
+
(migration) => migration.name === "0009_receipt_admission_order.sql" ? {
|
|
90201
|
+
...migration,
|
|
90202
|
+
compatibleColumn: { table: "execution_receipt", column: "admission_order" }
|
|
90203
|
+
} : migration
|
|
90204
|
+
)
|
|
90205
|
+
);
|
|
90186
90206
|
openSessionEventCacheDatabase = (path8) => new LocalSqliteDatabase(path8, "V2 Session event cache", sessionEventCacheMigrations, [
|
|
90187
90207
|
"PRAGMA journal_mode = WAL",
|
|
90188
90208
|
"PRAGMA synchronous = OFF",
|
|
@@ -91693,6 +91713,8 @@ var init_execution_receipt = __esm({
|
|
|
91693
91713
|
sessionId: text("session_id").notNull(),
|
|
91694
91714
|
commandHash: text("command_hash").notNull(),
|
|
91695
91715
|
attemptId: text("attempt_id").notNull(),
|
|
91716
|
+
// Nullable only for receipts written by older Runtimes; assigned before recovery.
|
|
91717
|
+
admissionOrder: integer2("admission_order"),
|
|
91696
91718
|
// Compatibility projection for older Runtimes; started and outcome own the facts.
|
|
91697
91719
|
state: text("state").notNull(),
|
|
91698
91720
|
started: integer2("started", { mode: "boolean" }).notNull(),
|
|
@@ -91794,6 +91816,7 @@ var init_execution_receipt_table = __esm({
|
|
|
91794
91816
|
sessionId: external_exports.string(),
|
|
91795
91817
|
commandHash: external_exports.string(),
|
|
91796
91818
|
attemptId: external_exports.string(),
|
|
91819
|
+
admissionOrder: external_exports.number().int().positive().safe(),
|
|
91797
91820
|
updatedAt: external_exports.string(),
|
|
91798
91821
|
started: external_exports.boolean(),
|
|
91799
91822
|
outcome: external_exports.string().nullable()
|
|
@@ -91808,9 +91831,18 @@ var init_execution_receipt_table = __esm({
|
|
|
91808
91831
|
const row = this.#database.orm.select({ sessionId: executionIdentity.sessionId, commandHash: executionIdentity.commandHash }).from(executionIdentity).where(eq2(executionIdentity.commandId, commandId)).get();
|
|
91809
91832
|
return row === void 0 ? void 0 : identitySchema.parse(row);
|
|
91810
91833
|
};
|
|
91811
|
-
list = () =>
|
|
91812
|
-
this.#database.orm.select().from(executionReceipt).orderBy(asc(executionReceipt.updatedAt), asc(executionReceipt.commandId)).all()
|
|
91813
|
-
|
|
91834
|
+
list = () => this.#database.transaction(() => {
|
|
91835
|
+
const rows = this.#database.orm.select().from(executionReceipt).orderBy(asc(executionReceipt.updatedAt), asc(executionReceipt.commandId)).all();
|
|
91836
|
+
let latestOrder = rows.reduce((latest, row) => Math.max(latest, row.admissionOrder ?? 0), 0);
|
|
91837
|
+
return rows.map((row) => {
|
|
91838
|
+
if (row.admissionOrder !== null) {
|
|
91839
|
+
return receiptSchema.parse(row);
|
|
91840
|
+
}
|
|
91841
|
+
const admissionOrder = ++latestOrder;
|
|
91842
|
+
this.#database.orm.update(executionReceipt).set({ admissionOrder }).where(eq2(executionReceipt.commandId, row.commandId)).run();
|
|
91843
|
+
return receiptSchema.parse({ ...row, admissionOrder });
|
|
91844
|
+
}).sort((left, right) => left.admissionOrder - right.admissionOrder);
|
|
91845
|
+
});
|
|
91814
91846
|
save = (receipt, terminalLimit) => this.#database.transaction(() => {
|
|
91815
91847
|
const row = { ...receipt, state: legacyState(receipt) };
|
|
91816
91848
|
this.#database.orm.insert(executionReceipt).values(row).onConflictDoUpdate({ target: executionReceipt.commandId, set: row }).run();
|
|
@@ -95447,6 +95479,13 @@ var init_execution_receipts = __esm({
|
|
|
95447
95479
|
this.#activeCount += Number(receipt.outcome === null) - Number(wasActive);
|
|
95448
95480
|
this.#onCount(this.#activeCount);
|
|
95449
95481
|
};
|
|
95482
|
+
#nextAdmissionOrder = () => {
|
|
95483
|
+
let latest = 0;
|
|
95484
|
+
for (const receipt of this.#executions.values()) {
|
|
95485
|
+
latest = Math.max(latest, receipt.admissionOrder);
|
|
95486
|
+
}
|
|
95487
|
+
return latest + 1;
|
|
95488
|
+
};
|
|
95450
95489
|
beginShutdown = () => {
|
|
95451
95490
|
this.#closing = true;
|
|
95452
95491
|
};
|
|
@@ -95481,21 +95520,22 @@ var init_execution_receipts = __esm({
|
|
|
95481
95520
|
}
|
|
95482
95521
|
};
|
|
95483
95522
|
/**
|
|
95484
|
-
* How the Session's most
|
|
95485
|
-
*
|
|
95486
|
-
*
|
|
95487
|
-
* while that command still runs, or when no turn is retained.
|
|
95523
|
+
* How the Session's most recently admitted turn ended. Admission order survives updates and
|
|
95524
|
+
* restarts. Commands that never started (queued, or reserved for cancellation) are not turns,
|
|
95525
|
+
* unless they failed before starting. Undefined while the latest turn runs or none is retained.
|
|
95488
95526
|
*/
|
|
95489
95527
|
lastTurn = (sessionId) => {
|
|
95490
95528
|
let last;
|
|
95529
|
+
let latestOrder = 0;
|
|
95491
95530
|
for (const [commandId, receipt] of this.#executions) {
|
|
95492
95531
|
if (receipt.sessionId !== sessionId) {
|
|
95493
95532
|
continue;
|
|
95494
95533
|
}
|
|
95495
95534
|
const outcome2 = receipt.outcome === null ? void 0 : this.outcome(commandId);
|
|
95496
95535
|
const failedBeforeStart = outcome2?.type === "lifecycle-metadata" && outcome2.payload.kind === "prompt.failed-before-start";
|
|
95497
|
-
if (receipt.started || failedBeforeStart) {
|
|
95536
|
+
if ((receipt.started || failedBeforeStart) && receipt.admissionOrder > latestOrder) {
|
|
95498
95537
|
last = commandId;
|
|
95538
|
+
latestOrder = receipt.admissionOrder;
|
|
95499
95539
|
}
|
|
95500
95540
|
}
|
|
95501
95541
|
const outcome = last === void 0 ? void 0 : this.outcome(last);
|
|
@@ -95535,6 +95575,7 @@ var init_execution_receipts = __esm({
|
|
|
95535
95575
|
})
|
|
95536
95576
|
).digest("hex");
|
|
95537
95577
|
this.#save(commandId, {
|
|
95578
|
+
admissionOrder: this.#nextAdmissionOrder(),
|
|
95538
95579
|
attemptId: randomUUID15(),
|
|
95539
95580
|
commandHash,
|
|
95540
95581
|
sessionId,
|
|
@@ -95619,6 +95660,7 @@ var init_execution_receipts = __esm({
|
|
|
95619
95660
|
}
|
|
95620
95661
|
const attemptId = randomUUID15();
|
|
95621
95662
|
this.#save(commandId, {
|
|
95663
|
+
admissionOrder: this.#nextAdmissionOrder(),
|
|
95622
95664
|
attemptId,
|
|
95623
95665
|
commandHash,
|
|
95624
95666
|
sessionId,
|
|
@@ -100752,8 +100794,9 @@ var init_runtime_loop = __esm({
|
|
|
100752
100794
|
signal.throwIfAborted();
|
|
100753
100795
|
this.#state = { kind: "preparing" };
|
|
100754
100796
|
try {
|
|
100755
|
-
const
|
|
100797
|
+
const prepared = await this.#prepare(signal);
|
|
100756
100798
|
signal.throwIfAborted();
|
|
100799
|
+
const config2 = this.#options.sessionEnvironment === void 0 ? prepared : { ...prepared, sessionEnvironment: this.#options.sessionEnvironment };
|
|
100757
100800
|
validateRuntimeConfiguration(config2);
|
|
100758
100801
|
this.#state = { kind: "running", config: config2 };
|
|
100759
100802
|
await runRuntime(config2, signal, void 0, {
|