@moxt-ai/mobius 0.0.315 → 0.0.317
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/agent/discovery/agent-discovery-context.d.ts +2 -0
- package/dist/agent/discovery/agent-discovery-context.d.ts.map +1 -1
- package/dist/agent/specification/vendors/pi-agent.d.ts.map +1 -1
- package/dist/agent/specification/vendors/pi-agent.js +1 -2
- package/dist/agent/specification/vendors/pi-agent.js.map +1 -1
- package/dist/cli/handler/agents/index.d.ts.map +1 -1
- package/dist/cli/handler/agents/index.js +2 -1
- package/dist/cli/handler/agents/index.js.map +1 -1
- package/dist/cli.js +98 -52
- package/dist/cli.js.map +4 -4
- package/dist/daemon/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/daemon/pairing/pair-local-machine.js +5 -1
- package/dist/daemon/pairing/pair-local-machine.js.map +1 -1
- package/dist/daemon/upgrades/data.d.ts.map +1 -1
- package/dist/daemon/upgrades/data.js +4 -1
- package/dist/daemon/upgrades/data.js.map +1 -1
- package/dist/runtime/command/registry/history.js +2 -2
- package/dist/runtime/command/registry/history.js.map +1 -1
- package/dist/runtime/command/registry/session.js +2 -2
- package/dist/runtime/command/registry/session.js.map +1 -1
- package/dist/runtime/config.d.ts +12 -1
- package/dist/runtime/config.d.ts.map +1 -1
- package/dist/runtime/config.js +9 -3
- package/dist/runtime/config.js.map +1 -1
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -1
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +6 -2
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime.js +58 -39
- package/dist/runtime.js.map +4 -4
- package/dist/session/api/session-api.d.ts +1 -1
- package/dist/session/api/session-api.d.ts.map +1 -1
- package/dist/session/manager/session-manager.d.ts +2 -2
- package/dist/session/manager/session-manager.d.ts.map +1 -1
- package/dist/session/manager/session-manager.js +10 -6
- package/dist/session/manager/session-manager.js.map +1 -1
- package/dist/session/native/native-session-browser.d.ts.map +1 -1
- package/dist/session/native/native-session-browser.js +1 -1
- package/dist/session/native/native-session-browser.js.map +1 -1
- package/dist/session/prompt/execute-prompt.js +1 -1
- package/dist/session/prompt/execute-prompt.js.map +1 -1
- package/dist/storage/daemon/release-files.d.ts.map +1 -1
- package/dist/storage/daemon/release-files.js +2 -1
- package/dist/storage/daemon/release-files.js.map +1 -1
- package/dist/storage/daemon/version-data.d.ts +5 -2
- package/dist/storage/daemon/version-data.d.ts.map +1 -1
- package/dist/storage/daemon/version-data.js +30 -7
- package/dist/storage/daemon/version-data.js.map +1 -1
- package/dist/storage/installation/installation-files.d.ts.map +1 -1
- package/dist/storage/installation/installation-files.js +2 -1
- package/dist/storage/installation/installation-files.js.map +1 -1
- package/dist/storage/state-root-layout.d.ts +16 -0
- package/dist/storage/state-root-layout.d.ts.map +1 -0
- package/dist/storage/state-root-layout.js +16 -0
- package/dist/storage/state-root-layout.js.map +1 -0
- package/dist/storage/state-root.d.ts.map +1 -1
- package/dist/storage/state-root.js +5 -3
- package/dist/storage/state-root.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -32453,7 +32453,7 @@ import { fetch as fetch3 } from "undici";
|
|
|
32453
32453
|
// package.json
|
|
32454
32454
|
var package_default = {
|
|
32455
32455
|
name: "@moxt-ai/mobius",
|
|
32456
|
-
version: "0.0.
|
|
32456
|
+
version: "0.0.317",
|
|
32457
32457
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
32458
32458
|
type: "module",
|
|
32459
32459
|
bin: {
|
|
@@ -77739,7 +77739,7 @@ var CodexAgentSpecification = class extends InProcessAcpAgentSpecification {
|
|
|
77739
77739
|
|
|
77740
77740
|
// src/agent/specification/vendors/pi-agent.ts
|
|
77741
77741
|
import { createHash as createHash4 } from "node:crypto";
|
|
77742
|
-
import { join as
|
|
77742
|
+
import { join as join20 } from "node:path";
|
|
77743
77743
|
import {
|
|
77744
77744
|
methods as methods11
|
|
77745
77745
|
} from "@agentclientprotocol/sdk";
|
|
@@ -81588,17 +81588,6 @@ function piAgentOrThrow(agent) {
|
|
|
81588
81588
|
return agent;
|
|
81589
81589
|
}
|
|
81590
81590
|
|
|
81591
|
-
// src/storage/state-directory.ts
|
|
81592
|
-
import { homedir as homedir3 } from "node:os";
|
|
81593
|
-
import { join as join20, resolve as resolve13 } from "node:path";
|
|
81594
|
-
function readStateDirectory(environment = process.env) {
|
|
81595
|
-
const configured = environment["MOBIUS_STATE_DIRECTORY"]?.trim();
|
|
81596
|
-
if (configured !== void 0 && configured.length > 0) {
|
|
81597
|
-
return resolve13(configured);
|
|
81598
|
-
}
|
|
81599
|
-
return join20(homedir3(), ".mobius");
|
|
81600
|
-
}
|
|
81601
|
-
|
|
81602
81591
|
// src/agent/discovery/agent-probe-error.ts
|
|
81603
81592
|
var AgentProbeError = class extends Error {
|
|
81604
81593
|
code;
|
|
@@ -81619,13 +81608,7 @@ var PiAgentSpecification = class extends InProcessAcpAgentSpecification {
|
|
|
81619
81608
|
// keeps the adapter's opt-in capability flag enabled for every launch it owns.
|
|
81620
81609
|
createLaunchEnvironment = async (_agent, context) => {
|
|
81621
81610
|
const workspaceHash = createHash4("sha256").update(context.defaultWorkspace).digest("hex").slice(0, 24);
|
|
81622
|
-
const sessionDirectory =
|
|
81623
|
-
readStateDirectory(context.environment),
|
|
81624
|
-
"agents",
|
|
81625
|
-
"pi",
|
|
81626
|
-
"sessions",
|
|
81627
|
-
workspaceHash
|
|
81628
|
-
);
|
|
81611
|
+
const sessionDirectory = join20(context.dataDirectory, "agents", "pi", "sessions", workspaceHash);
|
|
81629
81612
|
return Object.freeze({
|
|
81630
81613
|
PI_ACP_ENABLE_EMBEDDED_CONTEXT: "true",
|
|
81631
81614
|
MOBIUS_PI_SESSION_DIR: sessionDirectory
|
|
@@ -82599,17 +82582,28 @@ var LocalAgentCatalog = class {
|
|
|
82599
82582
|
};
|
|
82600
82583
|
};
|
|
82601
82584
|
|
|
82585
|
+
// src/storage/state-directory.ts
|
|
82586
|
+
import { homedir as homedir3 } from "node:os";
|
|
82587
|
+
import { join as join21, resolve as resolve13 } from "node:path";
|
|
82588
|
+
function readStateDirectory(environment = process.env) {
|
|
82589
|
+
const configured = environment["MOBIUS_STATE_DIRECTORY"]?.trim();
|
|
82590
|
+
if (configured !== void 0 && configured.length > 0) {
|
|
82591
|
+
return resolve13(configured);
|
|
82592
|
+
}
|
|
82593
|
+
return join21(homedir3(), ".mobius");
|
|
82594
|
+
}
|
|
82595
|
+
|
|
82602
82596
|
// src/runtime/config.ts
|
|
82603
|
-
function loadDefaultWorkspace(environment = process.env) {
|
|
82597
|
+
function loadDefaultWorkspace(dataDirectory, environment = process.env) {
|
|
82604
82598
|
const { MOBIUS_DEFAULT_WORKSPACE: configuredWorkspace } = environment;
|
|
82605
|
-
return configuredWorkspace ?? join22(
|
|
82599
|
+
return configuredWorkspace ?? join22(dataDirectory, "workspace");
|
|
82606
82600
|
}
|
|
82607
82601
|
var RuntimeLocalContext = class {
|
|
82608
82602
|
environment;
|
|
82609
82603
|
stateDirectory;
|
|
82610
82604
|
constructor(stateDirectory, environment = process.env) {
|
|
82611
82605
|
this.stateDirectory = resolve14(stateDirectory);
|
|
82612
|
-
this.environment = Object.freeze({ ...environment
|
|
82606
|
+
this.environment = Object.freeze({ ...environment });
|
|
82613
82607
|
}
|
|
82614
82608
|
};
|
|
82615
82609
|
function withRuntimeEnvironment(agent, environment) {
|
|
@@ -82715,10 +82709,23 @@ function isNodeError(error62, code) {
|
|
|
82715
82709
|
return typeof error62 === "object" && error62 !== null && "code" in error62 && error62.code === code;
|
|
82716
82710
|
}
|
|
82717
82711
|
|
|
82712
|
+
// src/storage/state-root-layout.ts
|
|
82713
|
+
var STATE_ROOT_LAYOUT = Object.freeze({
|
|
82714
|
+
/** Names the version whose data is current. */
|
|
82715
|
+
currentData: "current-data.txt",
|
|
82716
|
+
/** Applications' installations: `installations/<application>/<installation>`. */
|
|
82717
|
+
installations: "installations",
|
|
82718
|
+
/** Managed CLI releases: `npm/<version>`. */
|
|
82719
|
+
releases: "npm",
|
|
82720
|
+
/** Each CLI version's data: `versions/<version>`. */
|
|
82721
|
+
versions: "versions"
|
|
82722
|
+
});
|
|
82723
|
+
var STATE_ROOT_ENTRY_NAMES = new Set(Object.values(STATE_ROOT_LAYOUT));
|
|
82724
|
+
|
|
82718
82725
|
// src/storage/installation/installation-files.ts
|
|
82719
82726
|
var MAXIMUM_FILE_BYTES = 16 * 1024;
|
|
82720
82727
|
function applicationDirectory(root, applicationId) {
|
|
82721
|
-
return join23(root,
|
|
82728
|
+
return join23(root, STATE_ROOT_LAYOUT.installations, applicationId);
|
|
82722
82729
|
}
|
|
82723
82730
|
function installationPointerPath(applicationDirectory2) {
|
|
82724
82731
|
return join23(applicationDirectory2, "current.json");
|
|
@@ -83477,6 +83484,7 @@ function buildPairedRuntime(installation, connection, defaultWorkspace, inventor
|
|
|
83477
83484
|
createCatalogAgentResolver(
|
|
83478
83485
|
(refreshSignal) => discoverLocalAgentInventory({
|
|
83479
83486
|
defaultWorkspace,
|
|
83487
|
+
dataDirectory: localContext.stateDirectory,
|
|
83480
83488
|
environment: localContext.environment,
|
|
83481
83489
|
signal: refreshSignal
|
|
83482
83490
|
}),
|
|
@@ -83485,6 +83493,7 @@ function buildPairedRuntime(installation, connection, defaultWorkspace, inventor
|
|
|
83485
83493
|
),
|
|
83486
83494
|
(refreshSignal) => discoverLocalAgentInventory({
|
|
83487
83495
|
defaultWorkspace,
|
|
83496
|
+
dataDirectory: localContext.stateDirectory,
|
|
83488
83497
|
environment: localContext.environment,
|
|
83489
83498
|
signal: refreshSignal
|
|
83490
83499
|
}).then((inventory2) => inventory2.readyAgents())
|
|
@@ -83501,6 +83510,7 @@ async function pairRuntime(installation, options, signal, environment) {
|
|
|
83501
83510
|
const defaultWorkspace = await resolveDefaultWorkspace(options.workspace);
|
|
83502
83511
|
const inventory = await discoverLocalAgentInventory({
|
|
83503
83512
|
defaultWorkspace,
|
|
83513
|
+
dataDirectory: localContext.stateDirectory,
|
|
83504
83514
|
environment: localContext.environment,
|
|
83505
83515
|
signal
|
|
83506
83516
|
});
|
|
@@ -83537,6 +83547,7 @@ async function resumeRuntimeConnection(installation, connection, signal, environ
|
|
|
83537
83547
|
const defaultWorkspace = await resolveDefaultWorkspace(connection.defaultWorkspace);
|
|
83538
83548
|
const inventory = await discoverLocalAgentInventory({
|
|
83539
83549
|
defaultWorkspace,
|
|
83550
|
+
dataDirectory: localContext.stateDirectory,
|
|
83540
83551
|
environment: localContext.environment,
|
|
83541
83552
|
signal
|
|
83542
83553
|
});
|
|
@@ -86237,7 +86248,12 @@ var SessionManager2 = class {
|
|
|
86237
86248
|
return await runtime.loadHistoryEvents(eventLimit, cursor, options2.signal);
|
|
86238
86249
|
});
|
|
86239
86250
|
});
|
|
86240
|
-
|
|
86251
|
+
async #nativeTargetOptions(options, sessionId, resolveAgent) {
|
|
86252
|
+
const resolved = await resolveAgent(options.agent.id, options.signal, sessionId);
|
|
86253
|
+
options.signal.throwIfAborted();
|
|
86254
|
+
return { ...options, ...resolved, sessionId };
|
|
86255
|
+
}
|
|
86256
|
+
openNativeSession = async (options, origin, resolveAgent) => this.#operations.run(options, async (options2) => {
|
|
86241
86257
|
const key = `${options2.agent.id}:${origin.nativeSessionId}`;
|
|
86242
86258
|
if (this.#nativeOperations.has(key)) {
|
|
86243
86259
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
@@ -86256,10 +86272,8 @@ var SessionManager2 = class {
|
|
|
86256
86272
|
if (origin.kind === "import" && existing !== void 0) {
|
|
86257
86273
|
return await this.#executionProcesses.use(existing.sessionId, async () => {
|
|
86258
86274
|
this.#closedSessions.delete(existing.sessionId);
|
|
86259
|
-
const
|
|
86260
|
-
|
|
86261
|
-
sessionId: existing.sessionId
|
|
86262
|
-
});
|
|
86275
|
+
const target2 = await this.#nativeTargetOptions(options2, existing.sessionId, resolveAgent);
|
|
86276
|
+
const runtime = await this.ensureSession(target2);
|
|
86263
86277
|
if (this.#executions.command(existing.sessionId) !== void 0 || this.#nativeOperations.has(key)) {
|
|
86264
86278
|
throw new AcpExecutionError(
|
|
86265
86279
|
"Wait for the native session's running operation to finish",
|
|
@@ -86279,6 +86293,7 @@ var SessionManager2 = class {
|
|
|
86279
86293
|
}
|
|
86280
86294
|
});
|
|
86281
86295
|
}
|
|
86296
|
+
const target = await this.#nativeTargetOptions(options2, options2.sessionId, resolveAgent);
|
|
86282
86297
|
if (this.#executionProcesses.get(options2.sessionId) !== void 0 || this.#executionProcesses.pending(options2.sessionId) !== void 0 || this.#store.read(options2.sessionId) instanceof FoundStoredSession) {
|
|
86283
86298
|
throw new AcpExecutionError(
|
|
86284
86299
|
"The destination conversation already exists",
|
|
@@ -86289,7 +86304,7 @@ var SessionManager2 = class {
|
|
|
86289
86304
|
return await this.#executionProcesses.use(options2.sessionId, async () => {
|
|
86290
86305
|
this.#nativeOperations.add(key);
|
|
86291
86306
|
try {
|
|
86292
|
-
const runtime = await this.#startPreparation({ ...
|
|
86307
|
+
const runtime = await this.#startPreparation({ ...target, origin }, { kind: "interactive-only" });
|
|
86293
86308
|
const openedKey = `${options2.agent.id}:${runtime.nativeSessionId()}`;
|
|
86294
86309
|
this.#nativeOperations.add(openedKey);
|
|
86295
86310
|
try {
|
|
@@ -86557,7 +86572,8 @@ var NativeSessionService = class {
|
|
|
86557
86572
|
sessionId: command.targetSessionId,
|
|
86558
86573
|
additionalDirectories: target.additionalDirectories
|
|
86559
86574
|
},
|
|
86560
|
-
action === "fork" ? { kind: "fork", nativeSessionId: target.info.sessionId, title: title2 } : { kind: "import", nativeSessionId: target.info.sessionId, title: title2 }
|
|
86575
|
+
action === "fork" ? { kind: "fork", nativeSessionId: target.info.sessionId, title: title2 } : { kind: "import", nativeSessionId: target.info.sessionId, title: title2 },
|
|
86576
|
+
this.#resolveAgent
|
|
86561
86577
|
);
|
|
86562
86578
|
signal.throwIfAborted();
|
|
86563
86579
|
const ready = {
|
|
@@ -89337,7 +89353,7 @@ async function executeSessionHistoryPageLoad(socket, command, config2, resolveAg
|
|
|
89337
89353
|
);
|
|
89338
89354
|
const loadOptions = {
|
|
89339
89355
|
additionalDirectories: resolved.additionalDirectories,
|
|
89340
|
-
...await resolveAgent(entry.agentId, signal),
|
|
89356
|
+
...await resolveAgent(entry.agentId, signal, command.sessionId),
|
|
89341
89357
|
cwd: resolved.cwd,
|
|
89342
89358
|
sessionId: command.sessionId,
|
|
89343
89359
|
signal
|
|
@@ -89384,7 +89400,7 @@ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, re
|
|
|
89384
89400
|
);
|
|
89385
89401
|
const loadOptions = {
|
|
89386
89402
|
additionalDirectories: resolved.additionalDirectories,
|
|
89387
|
-
...await resolveAgent(command.agentId, signal),
|
|
89403
|
+
...await resolveAgent(command.agentId, signal, command.sessionId),
|
|
89388
89404
|
cwd: resolved.cwd,
|
|
89389
89405
|
sessionId: command.sessionId,
|
|
89390
89406
|
signal
|
|
@@ -90001,7 +90017,7 @@ async function executePrompt({
|
|
|
90001
90017
|
command.additionalDirectoryIds,
|
|
90002
90018
|
signal
|
|
90003
90019
|
);
|
|
90004
|
-
const { agent, adapter } = await resolveAgent(command.agentId, signal);
|
|
90020
|
+
const { agent, adapter } = await resolveAgent(command.agentId, signal, command.sessionId);
|
|
90005
90021
|
const availability = await waitForSessionAvailability(signal);
|
|
90006
90022
|
if (availability.kind === "busy") {
|
|
90007
90023
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
@@ -90358,7 +90374,7 @@ async function prepareSession(command, recovery, closed, config2, resolveAgent,
|
|
|
90358
90374
|
signal
|
|
90359
90375
|
)
|
|
90360
90376
|
);
|
|
90361
|
-
const resolvedAgent = await resolveAgent(command.agentId, signal);
|
|
90377
|
+
const resolvedAgent = await resolveAgent(command.agentId, signal, command.sessionId);
|
|
90362
90378
|
const preparation = {
|
|
90363
90379
|
additionalDirectories: resolved.additionalDirectories,
|
|
90364
90380
|
...resolvedAgent,
|
|
@@ -90521,7 +90537,7 @@ async function executeSessionConfigure(socket, command, config2, resolveAgent, d
|
|
|
90521
90537
|
);
|
|
90522
90538
|
const configOptions = await sessions.configureSession({
|
|
90523
90539
|
additionalDirectories: resolved.additionalDirectories,
|
|
90524
|
-
...await resolveAgent(command.agentId, signal),
|
|
90540
|
+
...await resolveAgent(command.agentId, signal, command.sessionId),
|
|
90525
90541
|
booleanValue: command.booleanValue,
|
|
90526
90542
|
configId: command.configId,
|
|
90527
90543
|
cwd: resolved.cwd,
|
|
@@ -91446,8 +91462,10 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
|
|
|
91446
91462
|
processes,
|
|
91447
91463
|
(sessionId, content, contentSignal) => externalContent.put({ ...content, sessionId, signal: contentSignal })
|
|
91448
91464
|
);
|
|
91449
|
-
const resolveAgent = async (agentId, resolveSignal) => {
|
|
91450
|
-
const
|
|
91465
|
+
const resolveAgent = async (agentId, resolveSignal, sessionId) => {
|
|
91466
|
+
const catalogAgent = await resolveCatalogAgent(config2, agentId, resolveSignal);
|
|
91467
|
+
const environment = sessionId === void 0 ? void 0 : config2.sessionEnvironment?.({ sessionId, agentId });
|
|
91468
|
+
const agent = environment === void 0 ? catalogAgent : catalogAgent.withEnvironment({ ...catalogAgent.environment, ...environment });
|
|
91451
91469
|
return { agent, adapter: adapters.resolve(agent) };
|
|
91452
91470
|
};
|
|
91453
91471
|
const layer = buildSessionLayer({
|
|
@@ -91630,7 +91648,7 @@ function loadMobiusRuntimeConnection(environment = process.env) {
|
|
|
91630
91648
|
}
|
|
91631
91649
|
return Object.freeze({
|
|
91632
91650
|
channelId,
|
|
91633
|
-
defaultWorkspace: loadDefaultWorkspace(environment),
|
|
91651
|
+
defaultWorkspace: loadDefaultWorkspace(readStateDirectory(environment), environment),
|
|
91634
91652
|
relayUrl: requiredEnvironmentValue(environment, "MOBIUS_RELAY_URL"),
|
|
91635
91653
|
runtimeCredential: requiredEnvironmentValue(environment, "MOBIUS_RELAY_TOKEN")
|
|
91636
91654
|
});
|
|
@@ -91657,6 +91675,7 @@ async function createMobiusRuntimeEngine(connection, signal, environment = proce
|
|
|
91657
91675
|
const discoveryEnvironment = localContext.environment;
|
|
91658
91676
|
const discover = async (refreshSignal) => await discoverLocalAgentInventory({
|
|
91659
91677
|
defaultWorkspace,
|
|
91678
|
+
dataDirectory: localContext.stateDirectory,
|
|
91660
91679
|
environment: discoveryEnvironment,
|
|
91661
91680
|
signal: refreshSignal,
|
|
91662
91681
|
specifications
|