@moxt-ai/mobius 0.0.329 → 0.0.331
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/acp/adapter/pi/agent-connection.d.ts.map +1 -1
- package/dist/acp/adapter/pi/agent-connection.js +5 -0
- package/dist/acp/adapter/pi/agent-connection.js.map +1 -1
- package/dist/acp/harness/pi/endpoint.d.ts +1 -0
- package/dist/acp/harness/pi/endpoint.d.ts.map +1 -1
- package/dist/acp/harness/pi/endpoint.js +1 -1
- package/dist/acp/harness/pi/endpoint.js.map +1 -1
- package/dist/cli.js +258 -234
- package/dist/cli.js.map +4 -4
- package/dist/daemon/control/local-client.d.ts +3 -2
- package/dist/daemon/control/local-client.d.ts.map +1 -1
- package/dist/daemon/control/local-client.js.map +1 -1
- package/dist/daemon/control/local-server.d.ts +2 -1
- package/dist/daemon/control/local-server.d.ts.map +1 -1
- package/dist/daemon/control/local-server.js.map +1 -1
- package/dist/daemon/control/switch-status.d.ts +2 -1
- package/dist/daemon/control/switch-status.d.ts.map +1 -1
- package/dist/daemon/control/switch-status.js.map +1 -1
- package/dist/daemon/lifecycle/manager-client.d.ts +4 -3
- package/dist/daemon/lifecycle/manager-client.d.ts.map +1 -1
- package/dist/daemon/lifecycle/manager-client.js.map +1 -1
- package/dist/daemon/lifecycle/manager.d.ts +2 -1
- package/dist/daemon/lifecycle/manager.d.ts.map +1 -1
- package/dist/daemon/lifecycle/manager.js.map +1 -1
- package/dist/daemon/lifecycle/unhandled-rejection.d.ts +2 -1
- package/dist/daemon/lifecycle/unhandled-rejection.d.ts.map +1 -1
- package/dist/daemon/lifecycle/unhandled-rejection.js.map +1 -1
- package/dist/daemon/lifecycle/worker-lifecycle-log.d.ts +2 -1
- package/dist/daemon/lifecycle/worker-lifecycle-log.d.ts.map +1 -1
- package/dist/daemon/lifecycle/worker-lifecycle-log.js.map +1 -1
- package/dist/daemon/lifecycle/worker.d.ts +2 -1
- package/dist/daemon/lifecycle/worker.d.ts.map +1 -1
- package/dist/daemon/lifecycle/worker.js.map +1 -1
- package/dist/daemon/upgrades/data.d.ts +2 -1
- package/dist/daemon/upgrades/data.d.ts.map +1 -1
- package/dist/daemon/upgrades/data.js.map +1 -1
- package/dist/daemon/upgrades/upgrade.d.ts +3 -2
- package/dist/daemon/upgrades/upgrade.d.ts.map +1 -1
- package/dist/daemon/upgrades/upgrade.js.map +1 -1
- package/dist/runtime/command/registry/session.d.ts +1 -1
- package/dist/runtime/command/registry/session.d.ts.map +1 -1
- package/dist/runtime/command/registry/session.js +14 -3
- package/dist/runtime/command/registry/session.js.map +1 -1
- package/dist/runtime/connection/runtime-installation-store.d.ts +2 -1
- package/dist/runtime/connection/runtime-installation-store.d.ts.map +1 -1
- package/dist/runtime/connection/runtime-installation-store.js.map +1 -1
- package/dist/runtime.js +79 -58
- package/dist/runtime.js.map +3 -3
- package/dist/session/manager/session-manager.d.ts +5 -5
- package/dist/session/manager/session-manager.d.ts.map +1 -1
- package/dist/session/manager/session-manager.js +10 -12
- package/dist/session/manager/session-manager.js.map +1 -1
- package/dist/session/prompt/apply-session-configuration.d.ts +0 -1
- package/dist/session/prompt/apply-session-configuration.d.ts.map +1 -1
- package/dist/session/prompt/apply-session-configuration.js +1 -1
- package/dist/session/prompt/apply-session-configuration.js.map +1 -1
- package/dist/session/prompt/execute-prompt.d.ts.map +1 -1
- package/dist/session/prompt/execute-prompt.js +9 -13
- package/dist/session/prompt/execute-prompt.js.map +1 -1
- package/dist/storage/daemon/control-token.d.ts +2 -1
- package/dist/storage/daemon/control-token.d.ts.map +1 -1
- package/dist/storage/daemon/control-token.js.map +1 -1
- package/dist/storage/daemon/manager-lock.d.ts +3 -2
- package/dist/storage/daemon/manager-lock.d.ts.map +1 -1
- package/dist/storage/daemon/manager-lock.js.map +1 -1
- package/dist/storage/daemon/version-data.d.ts +6 -5
- package/dist/storage/daemon/version-data.d.ts.map +1 -1
- package/dist/storage/daemon/version-data.js.map +1 -1
- package/dist/storage/installation/installation-files.d.ts +6 -1
- package/dist/storage/installation/installation-files.d.ts.map +1 -1
- package/dist/storage/installation/installation-files.js +3 -1
- package/dist/storage/installation/installation-files.js.map +1 -1
- package/dist/storage/state-directory.d.ts +9 -1
- package/dist/storage/state-directory.d.ts.map +1 -1
- package/dist/storage/state-directory.js +3 -4
- package/dist/storage/state-directory.js.map +1 -1
- package/package.json +1 -1
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.331",
|
|
2090
2090
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
2091
2091
|
type: "module",
|
|
2092
2092
|
bin: {
|
|
@@ -5605,182 +5605,6 @@ var init_commander = __esm({
|
|
|
5605
5605
|
}
|
|
5606
5606
|
});
|
|
5607
5607
|
|
|
5608
|
-
// src/util/node-error.ts
|
|
5609
|
-
function isNodeError(error62, code) {
|
|
5610
|
-
return typeof error62 === "object" && error62 !== null && "code" in error62 && error62.code === code;
|
|
5611
|
-
}
|
|
5612
|
-
var init_node_error = __esm({
|
|
5613
|
-
"src/util/node-error.ts"() {
|
|
5614
|
-
"use strict";
|
|
5615
|
-
}
|
|
5616
|
-
});
|
|
5617
|
-
|
|
5618
|
-
// src/storage/state-root-layout.ts
|
|
5619
|
-
var STATE_ROOT_LAYOUT, STATE_ROOT_ENTRY_NAMES;
|
|
5620
|
-
var init_state_root_layout = __esm({
|
|
5621
|
-
"src/storage/state-root-layout.ts"() {
|
|
5622
|
-
"use strict";
|
|
5623
|
-
STATE_ROOT_LAYOUT = Object.freeze({
|
|
5624
|
-
/** Names the version whose data is current. */
|
|
5625
|
-
currentData: "current-data.txt",
|
|
5626
|
-
/** Applications' installations: `installations/<application>/<installation>`. */
|
|
5627
|
-
installations: "installations",
|
|
5628
|
-
/** Managed CLI releases: `npm/<version>`. */
|
|
5629
|
-
releases: "npm",
|
|
5630
|
-
/** Each CLI version's data: `versions/<version>`. */
|
|
5631
|
-
versions: "versions"
|
|
5632
|
-
});
|
|
5633
|
-
STATE_ROOT_ENTRY_NAMES = new Set(Object.values(STATE_ROOT_LAYOUT));
|
|
5634
|
-
}
|
|
5635
|
-
});
|
|
5636
|
-
|
|
5637
|
-
// src/storage/installation/installation-files.ts
|
|
5638
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
5639
|
-
import { mkdir, open, readdir, rename, unlink, writeFile } from "node:fs/promises";
|
|
5640
|
-
import { dirname, join } from "node:path";
|
|
5641
|
-
function applicationDirectory(root, applicationId) {
|
|
5642
|
-
return join(root, STATE_ROOT_LAYOUT.installations, applicationId);
|
|
5643
|
-
}
|
|
5644
|
-
function installationPointerPath(applicationDirectory2) {
|
|
5645
|
-
return join(applicationDirectory2, "current.json");
|
|
5646
|
-
}
|
|
5647
|
-
function installationDirectory(applicationDirectory2, installationId2) {
|
|
5648
|
-
return join(applicationDirectory2, installationId2);
|
|
5649
|
-
}
|
|
5650
|
-
function connectionDirectory(installationDirectory2) {
|
|
5651
|
-
return join(installationDirectory2, "connections");
|
|
5652
|
-
}
|
|
5653
|
-
function connectionFilePath(connectionDirectory2, connectionId2) {
|
|
5654
|
-
return join(connectionDirectory2, `${connectionId2}.json`);
|
|
5655
|
-
}
|
|
5656
|
-
function channelIndexFilePath(installationDirectory2, channelId) {
|
|
5657
|
-
return join(installationDirectory2, "channels", `mci_${createHash("sha256").update(channelId).digest("hex")}.json`);
|
|
5658
|
-
}
|
|
5659
|
-
async function readInstallationFile(path8) {
|
|
5660
|
-
let handle;
|
|
5661
|
-
try {
|
|
5662
|
-
handle = await open(path8, "r");
|
|
5663
|
-
} catch (cause) {
|
|
5664
|
-
return isNodeError(cause, "ENOENT") ? { kind: "missing", cause } : { kind: "unopenable", cause };
|
|
5665
|
-
}
|
|
5666
|
-
try {
|
|
5667
|
-
const metadata = await handle.stat();
|
|
5668
|
-
if (!metadata.isFile() || metadata.size > MAXIMUM_FILE_BYTES) {
|
|
5669
|
-
return { kind: "not-a-small-file" };
|
|
5670
|
-
}
|
|
5671
|
-
return { kind: "read", text: await handle.readFile({ encoding: "utf8" }) };
|
|
5672
|
-
} finally {
|
|
5673
|
-
await handle.close();
|
|
5674
|
-
}
|
|
5675
|
-
}
|
|
5676
|
-
async function writeInstallationFile(path8, text2, signal) {
|
|
5677
|
-
signal.throwIfAborted();
|
|
5678
|
-
const directory = dirname(path8);
|
|
5679
|
-
const temporaryPath = join(directory, `.${randomUUID()}.tmp`);
|
|
5680
|
-
try {
|
|
5681
|
-
await mkdir(directory, { mode: 448, recursive: true });
|
|
5682
|
-
signal.throwIfAborted();
|
|
5683
|
-
await writeFile(temporaryPath, text2, { flag: "wx", mode: 384 });
|
|
5684
|
-
signal.throwIfAborted();
|
|
5685
|
-
await rename(temporaryPath, path8);
|
|
5686
|
-
} catch (cause) {
|
|
5687
|
-
await unlink(temporaryPath).catch(() => void 0);
|
|
5688
|
-
throw cause;
|
|
5689
|
-
}
|
|
5690
|
-
}
|
|
5691
|
-
async function createInstallationFile(path8, text2) {
|
|
5692
|
-
await writeFile(path8, text2, { flag: "wx", mode: 384 });
|
|
5693
|
-
}
|
|
5694
|
-
async function listInstallationFiles(directory) {
|
|
5695
|
-
return await readdir(directory);
|
|
5696
|
-
}
|
|
5697
|
-
async function removeInstallationFile(path8) {
|
|
5698
|
-
await unlink(path8);
|
|
5699
|
-
}
|
|
5700
|
-
var MAXIMUM_FILE_BYTES;
|
|
5701
|
-
var init_installation_files = __esm({
|
|
5702
|
-
"src/storage/installation/installation-files.ts"() {
|
|
5703
|
-
"use strict";
|
|
5704
|
-
init_node_error();
|
|
5705
|
-
init_state_root_layout();
|
|
5706
|
-
MAXIMUM_FILE_BYTES = 16 * 1024;
|
|
5707
|
-
}
|
|
5708
|
-
});
|
|
5709
|
-
|
|
5710
|
-
// src/storage/state-directory.ts
|
|
5711
|
-
import { homedir } from "node:os";
|
|
5712
|
-
import { join as join2, resolve } from "node:path";
|
|
5713
|
-
function readStateDirectory(environment = process.env) {
|
|
5714
|
-
const configured = environment["MOBIUS_STATE_DIRECTORY"]?.trim();
|
|
5715
|
-
if (configured !== void 0 && configured.length > 0) {
|
|
5716
|
-
return resolve(configured);
|
|
5717
|
-
}
|
|
5718
|
-
return join2(homedir(), ".mobius");
|
|
5719
|
-
}
|
|
5720
|
-
var init_state_directory = __esm({
|
|
5721
|
-
"src/storage/state-directory.ts"() {
|
|
5722
|
-
"use strict";
|
|
5723
|
-
}
|
|
5724
|
-
});
|
|
5725
|
-
|
|
5726
|
-
// src/storage/state-root.ts
|
|
5727
|
-
import { readFile, stat } from "node:fs/promises";
|
|
5728
|
-
import { basename, dirname as dirname2, join as join3 } from "node:path";
|
|
5729
|
-
async function exists(path8) {
|
|
5730
|
-
return await stat(path8).then(
|
|
5731
|
-
() => true,
|
|
5732
|
-
() => false
|
|
5733
|
-
);
|
|
5734
|
-
}
|
|
5735
|
-
async function owningRoot(directory) {
|
|
5736
|
-
const application = dirname2(directory);
|
|
5737
|
-
const installations = dirname2(application);
|
|
5738
|
-
if (basename(installations) !== STATE_ROOT_LAYOUT.installations) {
|
|
5739
|
-
return null;
|
|
5740
|
-
}
|
|
5741
|
-
let pointer;
|
|
5742
|
-
try {
|
|
5743
|
-
pointer = JSON.parse(await readFile(installationPointerPath(application), "utf8"));
|
|
5744
|
-
} catch {
|
|
5745
|
-
return null;
|
|
5746
|
-
}
|
|
5747
|
-
if (typeof pointer !== "object" || pointer === null || !("installationId" in pointer) || pointer.installationId !== basename(directory)) {
|
|
5748
|
-
return null;
|
|
5749
|
-
}
|
|
5750
|
-
const container = dirname2(installations);
|
|
5751
|
-
return basename(dirname2(container)) === STATE_ROOT_LAYOUT.versions ? dirname2(dirname2(container)) : container;
|
|
5752
|
-
}
|
|
5753
|
-
async function validateStateRoot(environment) {
|
|
5754
|
-
const directory = readStateDirectory(environment);
|
|
5755
|
-
if (await exists(join3(directory, STATE_ROOT_LAYOUT.currentData)) || await exists(join3(directory, STATE_ROOT_LAYOUT.versions))) {
|
|
5756
|
-
return;
|
|
5757
|
-
}
|
|
5758
|
-
const root = await owningRoot(directory);
|
|
5759
|
-
if (root !== null) {
|
|
5760
|
-
throw new StateRootError(directory, root);
|
|
5761
|
-
}
|
|
5762
|
-
}
|
|
5763
|
-
var StateRootError;
|
|
5764
|
-
var init_state_root = __esm({
|
|
5765
|
-
"src/storage/state-root.ts"() {
|
|
5766
|
-
"use strict";
|
|
5767
|
-
init_installation_files();
|
|
5768
|
-
init_state_directory();
|
|
5769
|
-
init_state_root_layout();
|
|
5770
|
-
StateRootError = class extends Error {
|
|
5771
|
-
code = "state_root_is_installation_data";
|
|
5772
|
-
owningRoot;
|
|
5773
|
-
constructor(stateDirectory, owningRoot2) {
|
|
5774
|
-
super(
|
|
5775
|
-
`MOBIUS_STATE_DIRECTORY (${stateDirectory}) is Mobius installation data, not a state root. Use the state root that owns it: MOBIUS_STATE_DIRECTORY=${owningRoot2}`
|
|
5776
|
-
);
|
|
5777
|
-
this.name = "StateRootError";
|
|
5778
|
-
this.owningRoot = owningRoot2;
|
|
5779
|
-
}
|
|
5780
|
-
};
|
|
5781
|
-
}
|
|
5782
|
-
});
|
|
5783
|
-
|
|
5784
5608
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
|
|
5785
5609
|
var util_exports = {};
|
|
5786
5610
|
__export(util_exports, {
|
|
@@ -10432,7 +10256,7 @@ function isBackEdge(ctx, value) {
|
|
|
10432
10256
|
const backEdges = ctx[STATE]?.backEdges;
|
|
10433
10257
|
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
10434
10258
|
}
|
|
10435
|
-
var $ZodCyclicError, STATE, NO_ISSUES, recursive, NONE, ASSUMED, PROVEN, handoff,
|
|
10259
|
+
var $ZodCyclicError, STATE, NO_ISSUES, recursive, NONE, ASSUMED, PROVEN, handoff, open, memo;
|
|
10436
10260
|
var init_memoizer = __esm({
|
|
10437
10261
|
"../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js"() {
|
|
10438
10262
|
init_util();
|
|
@@ -10448,7 +10272,7 @@ var init_memoizer = __esm({
|
|
|
10448
10272
|
NONE = 0;
|
|
10449
10273
|
ASSUMED = 1;
|
|
10450
10274
|
PROVEN = 2;
|
|
10451
|
-
|
|
10275
|
+
open = [];
|
|
10452
10276
|
memo = {
|
|
10453
10277
|
alloc(_inst, payload, empty) {
|
|
10454
10278
|
const bucket = handoff;
|
|
@@ -10457,7 +10281,7 @@ var init_memoizer = __esm({
|
|
|
10457
10281
|
handoff = void 0;
|
|
10458
10282
|
const entry = { value: empty, issues: null };
|
|
10459
10283
|
bucket.set(payload.value, entry);
|
|
10460
|
-
|
|
10284
|
+
open.push(entry);
|
|
10461
10285
|
return empty;
|
|
10462
10286
|
},
|
|
10463
10287
|
guard(inst) {
|
|
@@ -10528,10 +10352,10 @@ var init_memoizer = __esm({
|
|
|
10528
10352
|
return payload;
|
|
10529
10353
|
}
|
|
10530
10354
|
handoff = bucket;
|
|
10531
|
-
const depth =
|
|
10355
|
+
const depth = open.length;
|
|
10532
10356
|
const result = base(payload, ctx);
|
|
10533
10357
|
handoff = void 0;
|
|
10534
|
-
const entry =
|
|
10358
|
+
const entry = open.length > depth ? open.pop() : void 0;
|
|
10535
10359
|
if (result instanceof Promise) {
|
|
10536
10360
|
return result.then((r) => {
|
|
10537
10361
|
if (entry)
|
|
@@ -26140,6 +25964,186 @@ var init_zod = __esm({
|
|
|
26140
25964
|
}
|
|
26141
25965
|
});
|
|
26142
25966
|
|
|
25967
|
+
// src/util/node-error.ts
|
|
25968
|
+
function isNodeError(error62, code) {
|
|
25969
|
+
return typeof error62 === "object" && error62 !== null && "code" in error62 && error62.code === code;
|
|
25970
|
+
}
|
|
25971
|
+
var init_node_error = __esm({
|
|
25972
|
+
"src/util/node-error.ts"() {
|
|
25973
|
+
"use strict";
|
|
25974
|
+
}
|
|
25975
|
+
});
|
|
25976
|
+
|
|
25977
|
+
// src/storage/state-root-layout.ts
|
|
25978
|
+
var STATE_ROOT_LAYOUT, STATE_ROOT_ENTRY_NAMES;
|
|
25979
|
+
var init_state_root_layout = __esm({
|
|
25980
|
+
"src/storage/state-root-layout.ts"() {
|
|
25981
|
+
"use strict";
|
|
25982
|
+
STATE_ROOT_LAYOUT = Object.freeze({
|
|
25983
|
+
/** Names the version whose data is current. */
|
|
25984
|
+
currentData: "current-data.txt",
|
|
25985
|
+
/** Applications' installations: `installations/<application>/<installation>`. */
|
|
25986
|
+
installations: "installations",
|
|
25987
|
+
/** Managed CLI releases: `npm/<version>`. */
|
|
25988
|
+
releases: "npm",
|
|
25989
|
+
/** Each CLI version's data: `versions/<version>`. */
|
|
25990
|
+
versions: "versions"
|
|
25991
|
+
});
|
|
25992
|
+
STATE_ROOT_ENTRY_NAMES = new Set(Object.values(STATE_ROOT_LAYOUT));
|
|
25993
|
+
}
|
|
25994
|
+
});
|
|
25995
|
+
|
|
25996
|
+
// src/storage/installation/installation-files.ts
|
|
25997
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
25998
|
+
import { mkdir, open as open2, readdir, rename, unlink, writeFile } from "node:fs/promises";
|
|
25999
|
+
import { dirname, join } from "node:path";
|
|
26000
|
+
function applicationDirectory(root, applicationId) {
|
|
26001
|
+
return join(root, STATE_ROOT_LAYOUT.installations, applicationId);
|
|
26002
|
+
}
|
|
26003
|
+
function installationPointerPath(applicationDirectory2) {
|
|
26004
|
+
return join(applicationDirectory2, "current.json");
|
|
26005
|
+
}
|
|
26006
|
+
function installationDirectory(applicationDirectory2, installationId2) {
|
|
26007
|
+
return installationDirectorySchema.parse(join(applicationDirectory2, installationId2));
|
|
26008
|
+
}
|
|
26009
|
+
function connectionDirectory(installationDirectory2) {
|
|
26010
|
+
return join(installationDirectory2, "connections");
|
|
26011
|
+
}
|
|
26012
|
+
function connectionFilePath(connectionDirectory2, connectionId2) {
|
|
26013
|
+
return join(connectionDirectory2, `${connectionId2}.json`);
|
|
26014
|
+
}
|
|
26015
|
+
function channelIndexFilePath(installationDirectory2, channelId) {
|
|
26016
|
+
return join(installationDirectory2, "channels", `mci_${createHash("sha256").update(channelId).digest("hex")}.json`);
|
|
26017
|
+
}
|
|
26018
|
+
async function readInstallationFile(path8) {
|
|
26019
|
+
let handle;
|
|
26020
|
+
try {
|
|
26021
|
+
handle = await open2(path8, "r");
|
|
26022
|
+
} catch (cause) {
|
|
26023
|
+
return isNodeError(cause, "ENOENT") ? { kind: "missing", cause } : { kind: "unopenable", cause };
|
|
26024
|
+
}
|
|
26025
|
+
try {
|
|
26026
|
+
const metadata = await handle.stat();
|
|
26027
|
+
if (!metadata.isFile() || metadata.size > MAXIMUM_FILE_BYTES) {
|
|
26028
|
+
return { kind: "not-a-small-file" };
|
|
26029
|
+
}
|
|
26030
|
+
return { kind: "read", text: await handle.readFile({ encoding: "utf8" }) };
|
|
26031
|
+
} finally {
|
|
26032
|
+
await handle.close();
|
|
26033
|
+
}
|
|
26034
|
+
}
|
|
26035
|
+
async function writeInstallationFile(path8, text2, signal) {
|
|
26036
|
+
signal.throwIfAborted();
|
|
26037
|
+
const directory = dirname(path8);
|
|
26038
|
+
const temporaryPath = join(directory, `.${randomUUID()}.tmp`);
|
|
26039
|
+
try {
|
|
26040
|
+
await mkdir(directory, { mode: 448, recursive: true });
|
|
26041
|
+
signal.throwIfAborted();
|
|
26042
|
+
await writeFile(temporaryPath, text2, { flag: "wx", mode: 384 });
|
|
26043
|
+
signal.throwIfAborted();
|
|
26044
|
+
await rename(temporaryPath, path8);
|
|
26045
|
+
} catch (cause) {
|
|
26046
|
+
await unlink(temporaryPath).catch(() => void 0);
|
|
26047
|
+
throw cause;
|
|
26048
|
+
}
|
|
26049
|
+
}
|
|
26050
|
+
async function createInstallationFile(path8, text2) {
|
|
26051
|
+
await writeFile(path8, text2, { flag: "wx", mode: 384 });
|
|
26052
|
+
}
|
|
26053
|
+
async function listInstallationFiles(directory) {
|
|
26054
|
+
return await readdir(directory);
|
|
26055
|
+
}
|
|
26056
|
+
async function removeInstallationFile(path8) {
|
|
26057
|
+
await unlink(path8);
|
|
26058
|
+
}
|
|
26059
|
+
var MAXIMUM_FILE_BYTES, installationDirectorySchema;
|
|
26060
|
+
var init_installation_files = __esm({
|
|
26061
|
+
"src/storage/installation/installation-files.ts"() {
|
|
26062
|
+
"use strict";
|
|
26063
|
+
init_zod();
|
|
26064
|
+
init_node_error();
|
|
26065
|
+
init_state_root_layout();
|
|
26066
|
+
MAXIMUM_FILE_BYTES = 16 * 1024;
|
|
26067
|
+
installationDirectorySchema = external_exports.string().brand();
|
|
26068
|
+
}
|
|
26069
|
+
});
|
|
26070
|
+
|
|
26071
|
+
// src/storage/state-directory.ts
|
|
26072
|
+
import { homedir } from "node:os";
|
|
26073
|
+
import { join as join2, resolve } from "node:path";
|
|
26074
|
+
function readStateDirectory(environment = process.env) {
|
|
26075
|
+
const configured = environment["MOBIUS_STATE_DIRECTORY"]?.trim();
|
|
26076
|
+
return stateRootSchema.parse(
|
|
26077
|
+
configured !== void 0 && configured.length > 0 ? resolve(configured) : join2(homedir(), ".mobius")
|
|
26078
|
+
);
|
|
26079
|
+
}
|
|
26080
|
+
var stateRootSchema;
|
|
26081
|
+
var init_state_directory = __esm({
|
|
26082
|
+
"src/storage/state-directory.ts"() {
|
|
26083
|
+
"use strict";
|
|
26084
|
+
init_zod();
|
|
26085
|
+
stateRootSchema = external_exports.string().brand();
|
|
26086
|
+
}
|
|
26087
|
+
});
|
|
26088
|
+
|
|
26089
|
+
// src/storage/state-root.ts
|
|
26090
|
+
import { readFile, stat } from "node:fs/promises";
|
|
26091
|
+
import { basename, dirname as dirname2, join as join3 } from "node:path";
|
|
26092
|
+
async function exists(path8) {
|
|
26093
|
+
return await stat(path8).then(
|
|
26094
|
+
() => true,
|
|
26095
|
+
() => false
|
|
26096
|
+
);
|
|
26097
|
+
}
|
|
26098
|
+
async function owningRoot(directory) {
|
|
26099
|
+
const application = dirname2(directory);
|
|
26100
|
+
const installations = dirname2(application);
|
|
26101
|
+
if (basename(installations) !== STATE_ROOT_LAYOUT.installations) {
|
|
26102
|
+
return null;
|
|
26103
|
+
}
|
|
26104
|
+
let pointer;
|
|
26105
|
+
try {
|
|
26106
|
+
pointer = JSON.parse(await readFile(installationPointerPath(application), "utf8"));
|
|
26107
|
+
} catch {
|
|
26108
|
+
return null;
|
|
26109
|
+
}
|
|
26110
|
+
if (typeof pointer !== "object" || pointer === null || !("installationId" in pointer) || pointer.installationId !== basename(directory)) {
|
|
26111
|
+
return null;
|
|
26112
|
+
}
|
|
26113
|
+
const container = dirname2(installations);
|
|
26114
|
+
return basename(dirname2(container)) === STATE_ROOT_LAYOUT.versions ? dirname2(dirname2(container)) : container;
|
|
26115
|
+
}
|
|
26116
|
+
async function validateStateRoot(environment) {
|
|
26117
|
+
const directory = readStateDirectory(environment);
|
|
26118
|
+
if (await exists(join3(directory, STATE_ROOT_LAYOUT.currentData)) || await exists(join3(directory, STATE_ROOT_LAYOUT.versions))) {
|
|
26119
|
+
return;
|
|
26120
|
+
}
|
|
26121
|
+
const root = await owningRoot(directory);
|
|
26122
|
+
if (root !== null) {
|
|
26123
|
+
throw new StateRootError(directory, root);
|
|
26124
|
+
}
|
|
26125
|
+
}
|
|
26126
|
+
var StateRootError;
|
|
26127
|
+
var init_state_root = __esm({
|
|
26128
|
+
"src/storage/state-root.ts"() {
|
|
26129
|
+
"use strict";
|
|
26130
|
+
init_installation_files();
|
|
26131
|
+
init_state_directory();
|
|
26132
|
+
init_state_root_layout();
|
|
26133
|
+
StateRootError = class extends Error {
|
|
26134
|
+
code = "state_root_is_installation_data";
|
|
26135
|
+
owningRoot;
|
|
26136
|
+
constructor(stateDirectory, owningRoot2) {
|
|
26137
|
+
super(
|
|
26138
|
+
`MOBIUS_STATE_DIRECTORY (${stateDirectory}) is Mobius installation data, not a state root. Use the state root that owns it: MOBIUS_STATE_DIRECTORY=${owningRoot2}`
|
|
26139
|
+
);
|
|
26140
|
+
this.name = "StateRootError";
|
|
26141
|
+
this.owningRoot = owningRoot2;
|
|
26142
|
+
}
|
|
26143
|
+
};
|
|
26144
|
+
}
|
|
26145
|
+
});
|
|
26146
|
+
|
|
26143
26147
|
// src/util/value-utils.ts
|
|
26144
26148
|
function truncate(value, maximumLength) {
|
|
26145
26149
|
return value.length <= maximumLength ? value : `${value.slice(0, Math.max(0, maximumLength - 1))}\u2026`;
|
|
@@ -80382,6 +80386,7 @@ var init_agent2 = __esm({
|
|
|
80382
80386
|
}
|
|
80383
80387
|
async promptSubmission(params, submission) {
|
|
80384
80388
|
const session = await this.restoreSession(params.sessionId);
|
|
80389
|
+
this.conn.startUserMessage();
|
|
80385
80390
|
for (const content of params.prompt) {
|
|
80386
80391
|
if (submission.aborted) {
|
|
80387
80392
|
return { stopReason: "cancelled" };
|
|
@@ -80841,6 +80846,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80841
80846
|
case "idle":
|
|
80842
80847
|
return { outcome: "promptRequired", reason: "noRunningTurn" };
|
|
80843
80848
|
case "injected": {
|
|
80849
|
+
this.conn.startUserMessage();
|
|
80844
80850
|
for (const content of parsed.data.prompt) {
|
|
80845
80851
|
signal.throwIfAborted();
|
|
80846
80852
|
await this.conn.sessionUpdate({
|
|
@@ -81235,11 +81241,12 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
81235
81241
|
|
|
81236
81242
|
// src/acp/harness/pi/upstream/dist/acp/client.js
|
|
81237
81243
|
import { methods as methods5 } from "@agentclientprotocol/sdk";
|
|
81238
|
-
function createPiAcpClient(connection, onSessionUpdate) {
|
|
81244
|
+
function createPiAcpClient(connection, onSessionUpdate, onUserMessageStart = () => void 0) {
|
|
81239
81245
|
return {
|
|
81240
81246
|
requestElicitation: async (request, signal) => await connection.client.request(methods5.client.elicitation.create, request, { cancellationSignal: signal }),
|
|
81241
81247
|
requestPermission: async (request) => await connection.client.request(methods5.client.session.requestPermission, request),
|
|
81242
|
-
sessionUpdate: onSessionUpdate
|
|
81248
|
+
sessionUpdate: onSessionUpdate,
|
|
81249
|
+
startUserMessage: onUserMessageStart
|
|
81243
81250
|
};
|
|
81244
81251
|
}
|
|
81245
81252
|
var init_client = __esm({
|
|
@@ -81284,7 +81291,10 @@ var init_endpoint2 = __esm({
|
|
|
81284
81291
|
let piAgent = null;
|
|
81285
81292
|
this.#app = createAgentApp2({ name: "mobius-pi" }).onConnect((connection) => {
|
|
81286
81293
|
this.#connection = connection;
|
|
81287
|
-
piAgent = new PiAcpAgent(
|
|
81294
|
+
piAgent = new PiAcpAgent(
|
|
81295
|
+
createPiAcpClient(connection, options.onSessionUpdate, options.onUserMessageStart),
|
|
81296
|
+
{ environment }
|
|
81297
|
+
);
|
|
81288
81298
|
this.#agent = piAgent;
|
|
81289
81299
|
}).onRequest(
|
|
81290
81300
|
methods6.agent.initialize,
|
|
@@ -81371,6 +81381,11 @@ var init_agent_connection3 = __esm({
|
|
|
81371
81381
|
command: options.command,
|
|
81372
81382
|
cwd: options.cwd,
|
|
81373
81383
|
environment: options.environment,
|
|
81384
|
+
// Raw Pi owns submission boundaries, while synthetic identity stays here.
|
|
81385
|
+
// Adjacent blocks within one submission still share the allocated ID.
|
|
81386
|
+
onUserMessageStart: () => {
|
|
81387
|
+
message = { kind: "none" };
|
|
81388
|
+
},
|
|
81374
81389
|
onSessionUpdate: async (notification) => {
|
|
81375
81390
|
const update = notification.update;
|
|
81376
81391
|
switch (update.sessionUpdate) {
|
|
@@ -96256,34 +96271,18 @@ var init_session_manager = __esm({
|
|
|
96256
96271
|
return await runtime.configure(options2);
|
|
96257
96272
|
});
|
|
96258
96273
|
});
|
|
96259
|
-
renameSession = async (
|
|
96260
|
-
sessionId,
|
|
96261
|
-
async () => this.#operations.run(
|
|
96262
|
-
this.#assertOpen(
|
|
96263
|
-
|
|
96264
|
-
|
|
96265
|
-
|
|
96266
|
-
|
|
96267
|
-
|
|
96268
|
-
|
|
96269
|
-
|
|
96270
|
-
|
|
96271
|
-
const normalized = title2.slice(0, 500);
|
|
96272
|
-
const updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
96273
|
-
this.#store.write(
|
|
96274
|
-
new StoredSession(
|
|
96275
|
-
stored.session.sessionId,
|
|
96276
|
-
stored.session.agentId,
|
|
96277
|
-
stored.session.nativeSessionId,
|
|
96278
|
-
stored.session.cwd,
|
|
96279
|
-
stored.session.additionalDirectories,
|
|
96280
|
-
stored.session.prompted,
|
|
96281
|
-
normalized,
|
|
96282
|
-
updatedAt,
|
|
96283
|
-
stored.session.configurations
|
|
96284
|
-
)
|
|
96285
|
-
);
|
|
96286
|
-
return { title: normalized, updatedAt };
|
|
96274
|
+
renameSession = async (options, title2) => await this.#executionProcesses.use(
|
|
96275
|
+
options.sessionId,
|
|
96276
|
+
async () => this.#operations.run(options, async (options2) => {
|
|
96277
|
+
this.#assertOpen(options2.sessionId);
|
|
96278
|
+
if (this.#executionProcesses.get(options2.sessionId) === void 0) {
|
|
96279
|
+
await this.#prepareSession(options2, { kind: "interactive-only" }, "keep-closed");
|
|
96280
|
+
}
|
|
96281
|
+
const runtime = this.#executionProcesses.get(options2.sessionId);
|
|
96282
|
+
if (runtime === void 0) {
|
|
96283
|
+
throw new AcpExecutionError("ACP session did not start");
|
|
96284
|
+
}
|
|
96285
|
+
return await runtime.renameSession(title2, options2.signal);
|
|
96287
96286
|
})
|
|
96288
96287
|
);
|
|
96289
96288
|
cancelPrompt = async (sessionId, signal = AbortSignal.timeout(3e4)) => this.#operations.run({ signal }, async ({ signal: signal2 }) => {
|
|
@@ -100722,24 +100721,20 @@ async function executePrompt({
|
|
|
100722
100721
|
recovery
|
|
100723
100722
|
};
|
|
100724
100723
|
let prepared = await sessions.prepareExecutionSession(preparation);
|
|
100725
|
-
if (command.sessionConfigurations !== void 0) {
|
|
100726
|
-
|
|
100727
|
-
|
|
100728
|
-
|
|
100729
|
-
|
|
100730
|
-
|
|
100731
|
-
|
|
100732
|
-
|
|
100733
|
-
|
|
100734
|
-
|
|
100735
|
-
|
|
100736
|
-
|
|
100737
|
-
|
|
100738
|
-
|
|
100739
|
-
signal
|
|
100740
|
-
);
|
|
100741
|
-
prepared = await sessions.prepareExecutionSession(preparation);
|
|
100742
|
-
}
|
|
100724
|
+
if (command.sessionConfigurations !== void 0 && availability.disposition !== SessionPromptDisposition.Steer) {
|
|
100725
|
+
await applyCompleteSessionConfiguration(
|
|
100726
|
+
sessions,
|
|
100727
|
+
prepared.configOptions,
|
|
100728
|
+
sessionConfigurations ?? [],
|
|
100729
|
+
executionAgent,
|
|
100730
|
+
adapter,
|
|
100731
|
+
resolved.cwd,
|
|
100732
|
+
resolved.additionalDirectories,
|
|
100733
|
+
command.commandId,
|
|
100734
|
+
command.sessionId,
|
|
100735
|
+
signal
|
|
100736
|
+
);
|
|
100737
|
+
prepared = await sessions.prepareExecutionSession(preparation);
|
|
100743
100738
|
}
|
|
100744
100739
|
operations.transitionExecution(command.commandId, "running");
|
|
100745
100740
|
if (availability.disposition === SessionPromptDisposition.Steer) {
|
|
@@ -101129,9 +101124,29 @@ async function executeSessionRestore(socket, command, config2, resolveAgent, dir
|
|
|
101129
101124
|
reportOperationFailure(socket, command.requestId, command.sessionId, error62, metrics.snapshot());
|
|
101130
101125
|
}
|
|
101131
101126
|
}
|
|
101132
|
-
async function executeSessionRename(socket, command, sessions, signal) {
|
|
101127
|
+
async function executeSessionRename(socket, command, config2, resolveAgent, directories, sessions, nativeSessions, signal) {
|
|
101133
101128
|
try {
|
|
101134
|
-
const
|
|
101129
|
+
const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
|
|
101130
|
+
if (entry === void 0) {
|
|
101131
|
+
throw new SessionError("session_not_found", "The Session was not found");
|
|
101132
|
+
}
|
|
101133
|
+
const resolved = await resolveSessionDirectories(
|
|
101134
|
+
directories,
|
|
101135
|
+
config2.bindingId,
|
|
101136
|
+
entry.directoryId,
|
|
101137
|
+
entry.additionalDirectories.map((directory) => directory.directoryId),
|
|
101138
|
+
signal
|
|
101139
|
+
);
|
|
101140
|
+
const renamed = await sessions.renameSession(
|
|
101141
|
+
{
|
|
101142
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
101143
|
+
...await resolveAgent(entry.agentId, signal, command.sessionId),
|
|
101144
|
+
cwd: resolved.cwd,
|
|
101145
|
+
sessionId: command.sessionId,
|
|
101146
|
+
signal
|
|
101147
|
+
},
|
|
101148
|
+
command.title
|
|
101149
|
+
);
|
|
101135
101150
|
send(socket, {
|
|
101136
101151
|
kind: "session.renamed",
|
|
101137
101152
|
requestId: command.requestId,
|
|
@@ -101314,7 +101329,16 @@ var init_session5 = __esm({
|
|
|
101314
101329
|
if (message.kind !== SESSION_RENAME_KIND) {
|
|
101315
101330
|
throw new Error("Command kind mismatch");
|
|
101316
101331
|
}
|
|
101317
|
-
void executeSessionRename(
|
|
101332
|
+
void executeSessionRename(
|
|
101333
|
+
context.socket,
|
|
101334
|
+
message,
|
|
101335
|
+
context.config,
|
|
101336
|
+
context.resolveAgent,
|
|
101337
|
+
context.directories,
|
|
101338
|
+
context.sessions,
|
|
101339
|
+
context.nativeSessions,
|
|
101340
|
+
context.signal
|
|
101341
|
+
);
|
|
101318
101342
|
}
|
|
101319
101343
|
};
|
|
101320
101344
|
sessionConfigReadCommand = {
|