@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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export interface LocalAgentDiscoveryContext {
|
|
2
2
|
readonly architecture?: NodeJS.Architecture;
|
|
3
|
+
/** The Runtime's local data directory, where Agents that Mobius configures keep their Mobius-owned state. */
|
|
4
|
+
readonly dataDirectory: string;
|
|
3
5
|
readonly defaultWorkspace: string;
|
|
4
6
|
readonly environment: Readonly<NodeJS.ProcessEnv>;
|
|
5
7
|
readonly platform?: NodeJS.Platform;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-discovery-context.d.ts","sourceRoot":"","sources":["../../../src/agent/discovery/agent-discovery-context.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAChC"}
|
|
1
|
+
{"version":3,"file":"agent-discovery-context.d.ts","sourceRoot":"","sources":["../../../src/agent/discovery/agent-discovery-context.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IAC5C,6GAA6G;IAC7G,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi-agent.d.ts","sourceRoot":"","sources":["../../../../src/agent/specification/vendors/pi-agent.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAE1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"pi-agent.d.ts","sourceRoot":"","sources":["../../../../src/agent/specification/vendors/pi-agent.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAE1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAE7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAI3E,qBAAa,oBAAqB,SAAQ,8BAA8B;IACpE,SAAkB,2BAA2B,SAAkC;IAC/E,QAAQ,CAAC,eAAe,QAAQ;IAChC,QAAQ,CAAC,cAAc,EAAE,2BAA2B,CAA2C;IAG/F,SAAkB,uBAAuB,WAC7B,kBAAkB,WACjB,0BAA0B,KACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAU1C;IACF,QAAQ,CAAC,EAAE,QAAQ;IACnB,QAAQ,CAAC,KAAK,QAAQ;IACtB,SAAkB,4BAA4B,YAAY;IAC1D,SAAkB,yBAAyB,WAAW;IACtD,SAAkB,qBAAqB,QAAO,MAAM,CAAS;IAC7D,cAEC;IAED,SAAkB,SAAS,eACX,gBAAgB,eACf,kBAAkB,oBACb,MAAM,UAChB,WAAW,KACpB,OAAO,CAAC,IAAI,CAAC,CA4Bd;CACL"}
|
|
@@ -2,7 +2,6 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { methods, } from "@agentclientprotocol/sdk";
|
|
4
4
|
import { PiAcpEndpoint } from "../../../acp/harness/pi/endpoint.js";
|
|
5
|
-
import { readStateDirectory } from "../../../storage/state-directory.js";
|
|
6
5
|
import { AgentProbeError } from "../../discovery/agent-probe-error.js";
|
|
7
6
|
import { InProcessAcpAgentSpecification } from "../agent-specification.js";
|
|
8
7
|
const ACP_PROBE_TIMEOUT_MILLISECONDS = 30_000;
|
|
@@ -17,7 +16,7 @@ export class PiAgentSpecification extends InProcessAcpAgentSpecification {
|
|
|
17
16
|
// workspaces therefore exceed filesystem name limits before Mobius can run a readiness turn.
|
|
18
17
|
// Keep persistence, but derive a bounded, stable directory from the resolved workspace.
|
|
19
18
|
const workspaceHash = createHash("sha256").update(context.defaultWorkspace).digest("hex").slice(0, 24);
|
|
20
|
-
const sessionDirectory = join(
|
|
19
|
+
const sessionDirectory = join(context.dataDirectory, "agents", "pi", "sessions", workspaceHash);
|
|
21
20
|
return Object.freeze({
|
|
22
21
|
PI_ACP_ENABLE_EMBEDDED_CONTEXT: "true",
|
|
23
22
|
MOBIUS_PI_SESSION_DIR: sessionDirectory,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi-agent.js","sourceRoot":"","sources":["../../../../src/agent/specification/vendors/pi-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAIH,OAAO,GACV,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"pi-agent.js","sourceRoot":"","sources":["../../../../src/agent/specification/vendors/pi-agent.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/handler/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAUnD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/handler/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAUnD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CA6BjF"}
|
|
@@ -15,10 +15,11 @@ export function registerAgentsHandler(program, context) {
|
|
|
15
15
|
.action(async (options) => {
|
|
16
16
|
const installation = await openMobiusCliInstallation(context.shutdownSignal, process.env);
|
|
17
17
|
const localContext = new RuntimeLocalContext(installation.stateDirectory, process.env);
|
|
18
|
-
const defaultWorkspace = loadDefaultWorkspace(localContext.environment);
|
|
18
|
+
const defaultWorkspace = loadDefaultWorkspace(localContext.stateDirectory, localContext.environment);
|
|
19
19
|
await ensurePrivateDirectory(defaultWorkspace);
|
|
20
20
|
const inventory = await discoverLocalAgentInventory({
|
|
21
21
|
defaultWorkspace,
|
|
22
|
+
dataDirectory: localContext.stateDirectory,
|
|
22
23
|
environment: localContext.environment,
|
|
23
24
|
signal: context.shutdownSignal,
|
|
24
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/handler/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAChG,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAQ7F,MAAM,UAAU,qBAAqB,CAAC,OAAgB,EAAE,OAAmB;IACvE,OAAO;SACF,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,sDAAsD,CAAC;SACnE,MAAM,CAAC,QAAQ,EAAE,mCAAmC,CAAC;SACrD,SAAS,CAAC,WAAW,CAAC,oCAAoC,EAAE,8CAA8C,CAAC,CAAC;SAC5G,MAAM,CAAC,WAAW,EAAE,oCAAoC,CAAC;SACzD,MAAM,CAAC,KAAK,EAAE,OAAqB,EAAE,EAAE;QACpC,MAAM,YAAY,GAAG,MAAM,yBAAyB,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1F,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACvF,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/handler/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAChG,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAQ7F,MAAM,UAAU,qBAAqB,CAAC,OAAgB,EAAE,OAAmB;IACvE,OAAO;SACF,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,sDAAsD,CAAC;SACnE,MAAM,CAAC,QAAQ,EAAE,mCAAmC,CAAC;SACrD,SAAS,CAAC,WAAW,CAAC,oCAAoC,EAAE,8CAA8C,CAAC,CAAC;SAC5G,MAAM,CAAC,WAAW,EAAE,oCAAoC,CAAC;SACzD,MAAM,CAAC,KAAK,EAAE,OAAqB,EAAE,EAAE;QACpC,MAAM,YAAY,GAAG,MAAM,yBAAyB,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1F,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACvF,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,YAAY,CAAC,cAAc,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QACrG,MAAM,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;QAC/C,MAAM,SAAS,GAAG,MAAM,2BAA2B,CAAC;YAChD,gBAAgB;YAChB,aAAa,EAAE,YAAY,CAAC,cAAc;YAC1C,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,MAAM,EAAE,OAAO,CAAC,cAAc;SACjC,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACnC,MAAM,qBAAqB,CACvB,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAC3B,SAAS,EACT,OAAO,CAAC,OAAO,KAAK,IAAI,EACxB,OAAO,CAAC,cAAc,CACzB,CAAC;YACF,OAAO;QACX,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC;IAC7G,CAAC,CAAC,CAAC;AACX,CAAC"}
|
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.317",
|
|
2090
2090
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
2091
2091
|
type: "module",
|
|
2092
2092
|
bin: {
|
|
@@ -5615,12 +5615,31 @@ var init_node_error = __esm({
|
|
|
5615
5615
|
}
|
|
5616
5616
|
});
|
|
5617
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
|
+
|
|
5618
5637
|
// src/storage/installation/installation-files.ts
|
|
5619
5638
|
import { createHash, randomUUID } from "node:crypto";
|
|
5620
5639
|
import { mkdir, open, readdir, rename, unlink, writeFile } from "node:fs/promises";
|
|
5621
5640
|
import { dirname, join } from "node:path";
|
|
5622
5641
|
function applicationDirectory(root, applicationId) {
|
|
5623
|
-
return join(root,
|
|
5642
|
+
return join(root, STATE_ROOT_LAYOUT.installations, applicationId);
|
|
5624
5643
|
}
|
|
5625
5644
|
function installationPointerPath(applicationDirectory2) {
|
|
5626
5645
|
return join(applicationDirectory2, "current.json");
|
|
@@ -5683,6 +5702,7 @@ var init_installation_files = __esm({
|
|
|
5683
5702
|
"src/storage/installation/installation-files.ts"() {
|
|
5684
5703
|
"use strict";
|
|
5685
5704
|
init_node_error();
|
|
5705
|
+
init_state_root_layout();
|
|
5686
5706
|
MAXIMUM_FILE_BYTES = 16 * 1024;
|
|
5687
5707
|
}
|
|
5688
5708
|
});
|
|
@@ -5715,7 +5735,7 @@ async function exists(path8) {
|
|
|
5715
5735
|
async function owningRoot(directory) {
|
|
5716
5736
|
const application = dirname2(directory);
|
|
5717
5737
|
const installations = dirname2(application);
|
|
5718
|
-
if (basename(installations) !==
|
|
5738
|
+
if (basename(installations) !== STATE_ROOT_LAYOUT.installations) {
|
|
5719
5739
|
return null;
|
|
5720
5740
|
}
|
|
5721
5741
|
let pointer;
|
|
@@ -5728,11 +5748,11 @@ async function owningRoot(directory) {
|
|
|
5728
5748
|
return null;
|
|
5729
5749
|
}
|
|
5730
5750
|
const container = dirname2(installations);
|
|
5731
|
-
return basename(dirname2(container)) ===
|
|
5751
|
+
return basename(dirname2(container)) === STATE_ROOT_LAYOUT.versions ? dirname2(dirname2(container)) : container;
|
|
5732
5752
|
}
|
|
5733
5753
|
async function validateStateRoot(environment) {
|
|
5734
5754
|
const directory = readStateDirectory(environment);
|
|
5735
|
-
if (await exists(join3(directory,
|
|
5755
|
+
if (await exists(join3(directory, STATE_ROOT_LAYOUT.currentData)) || await exists(join3(directory, STATE_ROOT_LAYOUT.versions))) {
|
|
5736
5756
|
return;
|
|
5737
5757
|
}
|
|
5738
5758
|
const root = await owningRoot(directory);
|
|
@@ -5746,6 +5766,7 @@ var init_state_root = __esm({
|
|
|
5746
5766
|
"use strict";
|
|
5747
5767
|
init_installation_files();
|
|
5748
5768
|
init_state_directory();
|
|
5769
|
+
init_state_root_layout();
|
|
5749
5770
|
StateRootError = class extends Error {
|
|
5750
5771
|
code = "state_root_is_installation_data";
|
|
5751
5772
|
owningRoot;
|
|
@@ -42773,8 +42794,8 @@ function inputPath(context, key) {
|
|
|
42773
42794
|
return plainString(context.input[key]);
|
|
42774
42795
|
}
|
|
42775
42796
|
function isInside(directory, candidate) {
|
|
42776
|
-
const
|
|
42777
|
-
return
|
|
42797
|
+
const relative7 = path2.relative(path2.resolve(directory), path2.resolve(candidate));
|
|
42798
|
+
return relative7 === "" || !relative7.startsWith(`..${path2.sep}`) && relative7 !== "..";
|
|
42778
42799
|
}
|
|
42779
42800
|
function hasSessionAllowRuleFor(changeSet, toolName) {
|
|
42780
42801
|
return !!changeSet?.updates.some((update) => update.type === "addRules" && update.destination === "session" && update.behavior === "allow" && update.rules.some((rule) => rule.toolName === toolName));
|
|
@@ -80707,7 +80728,6 @@ var init_pi_agent = __esm({
|
|
|
80707
80728
|
"src/agent/specification/vendors/pi-agent.ts"() {
|
|
80708
80729
|
"use strict";
|
|
80709
80730
|
init_endpoint2();
|
|
80710
|
-
init_state_directory();
|
|
80711
80731
|
init_agent_probe_error();
|
|
80712
80732
|
init_agent_specification();
|
|
80713
80733
|
ACP_PROBE_TIMEOUT_MILLISECONDS2 = 3e4;
|
|
@@ -80719,13 +80739,7 @@ var init_pi_agent = __esm({
|
|
|
80719
80739
|
// keeps the adapter's opt-in capability flag enabled for every launch it owns.
|
|
80720
80740
|
createLaunchEnvironment = async (_agent, context) => {
|
|
80721
80741
|
const workspaceHash = createHash3("sha256").update(context.defaultWorkspace).digest("hex").slice(0, 24);
|
|
80722
|
-
const sessionDirectory = join21(
|
|
80723
|
-
readStateDirectory(context.environment),
|
|
80724
|
-
"agents",
|
|
80725
|
-
"pi",
|
|
80726
|
-
"sessions",
|
|
80727
|
-
workspaceHash
|
|
80728
|
-
);
|
|
80742
|
+
const sessionDirectory = join21(context.dataDirectory, "agents", "pi", "sessions", workspaceHash);
|
|
80729
80743
|
return Object.freeze({
|
|
80730
80744
|
PI_ACP_ENABLE_EMBEDDED_CONTEXT: "true",
|
|
80731
80745
|
MOBIUS_PI_SESSION_DIR: sessionDirectory
|
|
@@ -90686,9 +90700,9 @@ var init_catalog2 = __esm({
|
|
|
90686
90700
|
|
|
90687
90701
|
// src/runtime/config.ts
|
|
90688
90702
|
import { join as join24, resolve as resolve14 } from "node:path";
|
|
90689
|
-
function loadDefaultWorkspace(environment = process.env) {
|
|
90703
|
+
function loadDefaultWorkspace(dataDirectory, environment = process.env) {
|
|
90690
90704
|
const { MOBIUS_DEFAULT_WORKSPACE: configuredWorkspace } = environment;
|
|
90691
|
-
return configuredWorkspace ?? join24(
|
|
90705
|
+
return configuredWorkspace ?? join24(dataDirectory, "workspace");
|
|
90692
90706
|
}
|
|
90693
90707
|
function withRuntimeEnvironment(agent, environment) {
|
|
90694
90708
|
const launchEnvironment = {};
|
|
@@ -90728,7 +90742,7 @@ var init_config = __esm({
|
|
|
90728
90742
|
stateDirectory;
|
|
90729
90743
|
constructor(stateDirectory, environment = process.env) {
|
|
90730
90744
|
this.stateDirectory = resolve14(stateDirectory);
|
|
90731
|
-
this.environment = Object.freeze({ ...environment
|
|
90745
|
+
this.environment = Object.freeze({ ...environment });
|
|
90732
90746
|
}
|
|
90733
90747
|
};
|
|
90734
90748
|
RuntimeReconnectTarget = class {
|
|
@@ -91322,9 +91336,9 @@ var init_runtime_installation_store = __esm({
|
|
|
91322
91336
|
// src/storage/daemon/version-data.ts
|
|
91323
91337
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
91324
91338
|
import { cp as cp2, lstat as lstat4, mkdtemp, readFile as readFile7, rename as rename4, rm as rm3, writeFile as writeFile2 } from "node:fs/promises";
|
|
91325
|
-
import { join as join25 } from "node:path";
|
|
91339
|
+
import { join as join25, relative as relative2, sep as sep5 } from "node:path";
|
|
91326
91340
|
async function readCurrentDataVersion(root, signal) {
|
|
91327
|
-
const pointer = join25(root,
|
|
91341
|
+
const pointer = join25(root, STATE_ROOT_LAYOUT.currentData);
|
|
91328
91342
|
try {
|
|
91329
91343
|
await validateLocalPath(pointer, false, true, signal);
|
|
91330
91344
|
const value = (await readFile7(pointer, { encoding: "utf8", signal })).trim();
|
|
@@ -91341,7 +91355,7 @@ async function readCurrentDataVersion(root, signal) {
|
|
|
91341
91355
|
}
|
|
91342
91356
|
async function versionDataExists(root, version2, signal) {
|
|
91343
91357
|
try {
|
|
91344
|
-
await validateLocalPath(join25(root,
|
|
91358
|
+
await validateLocalPath(join25(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
|
|
91345
91359
|
return true;
|
|
91346
91360
|
} catch (cause) {
|
|
91347
91361
|
if (!isNodeError(cause, "ENOENT")) {
|
|
@@ -91350,8 +91364,12 @@ async function versionDataExists(root, version2, signal) {
|
|
|
91350
91364
|
return false;
|
|
91351
91365
|
}
|
|
91352
91366
|
}
|
|
91367
|
+
function nestedRootEntry(segments) {
|
|
91368
|
+
return segments.length >= 4 && segments[0] === STATE_ROOT_LAYOUT.installations && STATE_ROOT_ENTRY_NAMES.has(segments[3] ?? "");
|
|
91369
|
+
}
|
|
91353
91370
|
async function copyVersionData(root, sourceVersion, targetVersion, signal) {
|
|
91354
|
-
const
|
|
91371
|
+
const leftBehind = [];
|
|
91372
|
+
const versions = join25(root, STATE_ROOT_LAYOUT.versions);
|
|
91355
91373
|
const source = join25(versions, sourceVersion);
|
|
91356
91374
|
const target = join25(versions, targetVersion);
|
|
91357
91375
|
await validateLocalPath(root, true, true, signal);
|
|
@@ -91363,6 +91381,13 @@ async function copyVersionData(root, sourceVersion, targetVersion, signal) {
|
|
|
91363
91381
|
recursive: true,
|
|
91364
91382
|
filter: async (path8) => {
|
|
91365
91383
|
signal.throwIfAborted();
|
|
91384
|
+
const segments = relative2(source, path8).split(sep5);
|
|
91385
|
+
if (nestedRootEntry(segments)) {
|
|
91386
|
+
if (segments.length === 4) {
|
|
91387
|
+
leftBehind.push(segments.join("/"));
|
|
91388
|
+
}
|
|
91389
|
+
return false;
|
|
91390
|
+
}
|
|
91366
91391
|
if ((await lstat4(path8)).isSymbolicLink()) {
|
|
91367
91392
|
throw new DataInheritanceError("The inherited data contains a symbolic link");
|
|
91368
91393
|
}
|
|
@@ -91378,19 +91403,20 @@ async function copyVersionData(root, sourceVersion, targetVersion, signal) {
|
|
|
91378
91403
|
}
|
|
91379
91404
|
await validateLocalPath(target, true, true, signal);
|
|
91380
91405
|
}
|
|
91406
|
+
return leftBehind;
|
|
91381
91407
|
} finally {
|
|
91382
91408
|
await rm3(staging, { recursive: true, force: true });
|
|
91383
91409
|
}
|
|
91384
91410
|
}
|
|
91385
91411
|
async function writeCurrentDataVersion(root, version2, signal) {
|
|
91386
91412
|
await validateLocalPath(root, true, true, signal);
|
|
91387
|
-
await validateLocalPath(join25(root,
|
|
91413
|
+
await validateLocalPath(join25(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
|
|
91388
91414
|
const temporary = join25(root, `.current-data-${randomUUID11()}.txt`);
|
|
91389
91415
|
try {
|
|
91390
91416
|
await writeFile2(temporary, `versions/${version2}
|
|
91391
91417
|
`, { mode: 384, flag: "wx", signal });
|
|
91392
91418
|
signal.throwIfAborted();
|
|
91393
|
-
await rename4(temporary, join25(root,
|
|
91419
|
+
await rename4(temporary, join25(root, STATE_ROOT_LAYOUT.currentData));
|
|
91394
91420
|
} finally {
|
|
91395
91421
|
await rm3(temporary, { force: true });
|
|
91396
91422
|
}
|
|
@@ -91402,6 +91428,7 @@ var init_version_data = __esm({
|
|
|
91402
91428
|
init_protocol();
|
|
91403
91429
|
init_private_path();
|
|
91404
91430
|
init_node_error();
|
|
91431
|
+
init_state_root_layout();
|
|
91405
91432
|
DataInheritanceError = class extends Error {
|
|
91406
91433
|
code = "data_inheritance_failed";
|
|
91407
91434
|
};
|
|
@@ -91613,7 +91640,13 @@ async function prepareVersionData(version2, signal, environment = process.env, f
|
|
|
91613
91640
|
if (previous === null) {
|
|
91614
91641
|
return;
|
|
91615
91642
|
}
|
|
91616
|
-
await copyVersionData(root, runtimeUpgradeVersionSchema.parse(previous), targetVersion, signal);
|
|
91643
|
+
const leftBehind = await copyVersionData(root, runtimeUpgradeVersionSchema.parse(previous), targetVersion, signal);
|
|
91644
|
+
for (const entry of leftBehind) {
|
|
91645
|
+
process.stderr.write(
|
|
91646
|
+
`Mobius did not carry ${entry} into version ${targetVersion}: an earlier Mobius ran with that installation as its state root.
|
|
91647
|
+
`
|
|
91648
|
+
);
|
|
91649
|
+
}
|
|
91617
91650
|
}
|
|
91618
91651
|
async function recordCurrentData(version2, signal) {
|
|
91619
91652
|
await writeCurrentDataVersion(readStateDirectory(), runtimeUpgradeVersionSchema.parse(version2), signal);
|
|
@@ -91818,6 +91851,7 @@ function buildPairedRuntime(installation, connection, defaultWorkspace, inventor
|
|
|
91818
91851
|
createCatalogAgentResolver(
|
|
91819
91852
|
(refreshSignal) => discoverLocalAgentInventory({
|
|
91820
91853
|
defaultWorkspace,
|
|
91854
|
+
dataDirectory: localContext.stateDirectory,
|
|
91821
91855
|
environment: localContext.environment,
|
|
91822
91856
|
signal: refreshSignal
|
|
91823
91857
|
}),
|
|
@@ -91826,6 +91860,7 @@ function buildPairedRuntime(installation, connection, defaultWorkspace, inventor
|
|
|
91826
91860
|
),
|
|
91827
91861
|
(refreshSignal) => discoverLocalAgentInventory({
|
|
91828
91862
|
defaultWorkspace,
|
|
91863
|
+
dataDirectory: localContext.stateDirectory,
|
|
91829
91864
|
environment: localContext.environment,
|
|
91830
91865
|
signal: refreshSignal
|
|
91831
91866
|
}).then((inventory2) => inventory2.readyAgents())
|
|
@@ -91842,6 +91877,7 @@ async function pairRuntime(installation, options, signal, environment) {
|
|
|
91842
91877
|
const defaultWorkspace = await resolveDefaultWorkspace(options.workspace);
|
|
91843
91878
|
const inventory = await discoverLocalAgentInventory({
|
|
91844
91879
|
defaultWorkspace,
|
|
91880
|
+
dataDirectory: localContext.stateDirectory,
|
|
91845
91881
|
environment: localContext.environment,
|
|
91846
91882
|
signal
|
|
91847
91883
|
});
|
|
@@ -91865,6 +91901,7 @@ async function resumeRuntimeConnection(installation, connection, signal, environ
|
|
|
91865
91901
|
const defaultWorkspace = await resolveDefaultWorkspace(connection.defaultWorkspace);
|
|
91866
91902
|
const inventory = await discoverLocalAgentInventory({
|
|
91867
91903
|
defaultWorkspace,
|
|
91904
|
+
dataDirectory: localContext.stateDirectory,
|
|
91868
91905
|
environment: localContext.environment,
|
|
91869
91906
|
signal
|
|
91870
91907
|
});
|
|
@@ -91909,7 +91946,7 @@ async function pairLocalMachine(arguments_, signal = new AbortController().signa
|
|
|
91909
91946
|
code: requested.code,
|
|
91910
91947
|
pairingId: requested.pairingId,
|
|
91911
91948
|
relayOrigin: requested.relayOrigin,
|
|
91912
|
-
workspace: arguments_.includes("--workspace") ? requested.workspace : loadDefaultWorkspace(localContext.environment)
|
|
91949
|
+
workspace: arguments_.includes("--workspace") ? requested.workspace : loadDefaultWorkspace(localContext.stateDirectory, localContext.environment)
|
|
91913
91950
|
},
|
|
91914
91951
|
signal,
|
|
91915
91952
|
process.env
|
|
@@ -92127,10 +92164,11 @@ function registerAgentsHandler(program2, context) {
|
|
|
92127
92164
|
program2.command("agents").description("show detected, missing, and integration-ready Agents").option("--json", "write the Agent inventory as JSON").addOption(valueOption("--output-json <existing-file.json>", "write the JSON inventory to an existing file")).option("--verbose", "include per-Agent detection timing").action(async (options) => {
|
|
92128
92165
|
const installation = await openMobiusCliInstallation(context.shutdownSignal, process.env);
|
|
92129
92166
|
const localContext = new RuntimeLocalContext(installation.stateDirectory, process.env);
|
|
92130
|
-
const defaultWorkspace = loadDefaultWorkspace(localContext.environment);
|
|
92167
|
+
const defaultWorkspace = loadDefaultWorkspace(localContext.stateDirectory, localContext.environment);
|
|
92131
92168
|
await ensurePrivateDirectory(defaultWorkspace);
|
|
92132
92169
|
const inventory = await discoverLocalAgentInventory({
|
|
92133
92170
|
defaultWorkspace,
|
|
92171
|
+
dataDirectory: localContext.stateDirectory,
|
|
92134
92172
|
environment: localContext.environment,
|
|
92135
92173
|
signal: context.shutdownSignal
|
|
92136
92174
|
});
|
|
@@ -92346,7 +92384,7 @@ var init_bounded_log = __esm({
|
|
|
92346
92384
|
// src/storage/logs/log-files.ts
|
|
92347
92385
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
92348
92386
|
import { lstat as lstat5, readdir as readdir6, readFile as readFile10 } from "node:fs/promises";
|
|
92349
|
-
import { join as join30, relative as
|
|
92387
|
+
import { join as join30, relative as relative3 } from "node:path";
|
|
92350
92388
|
function unhandledRejectionLogFilename(role) {
|
|
92351
92389
|
return `unhandled-rejections-${role}.log`;
|
|
92352
92390
|
}
|
|
@@ -92386,7 +92424,7 @@ async function findLogDirectories(root, unreadable, signal) {
|
|
|
92386
92424
|
if (status === "listed") {
|
|
92387
92425
|
found.push(logs);
|
|
92388
92426
|
} else if (status === "unreadable") {
|
|
92389
|
-
unreadable.push(
|
|
92427
|
+
unreadable.push(relative3(root, logs));
|
|
92390
92428
|
}
|
|
92391
92429
|
}
|
|
92392
92430
|
}
|
|
@@ -92400,7 +92438,7 @@ async function listDirectories(path8, root, unreadable, signal) {
|
|
|
92400
92438
|
return entries.filter((entry) => entry.isDirectory() && !entry.isSymbolicLink()).map((entry) => entry.name);
|
|
92401
92439
|
} catch (cause) {
|
|
92402
92440
|
if (!isAbsent(cause)) {
|
|
92403
|
-
unreadable.push(
|
|
92441
|
+
unreadable.push(relative3(root, path8));
|
|
92404
92442
|
}
|
|
92405
92443
|
return [];
|
|
92406
92444
|
}
|
|
@@ -92411,7 +92449,7 @@ async function listLogFiles(directory, root, unreadable) {
|
|
|
92411
92449
|
return entries.filter((entry) => entry.isFile() && !entry.isSymbolicLink() && LOG_FILE_NAME_PATTERN.test(entry.name)).map((entry) => entry.name).sort();
|
|
92412
92450
|
} catch (cause) {
|
|
92413
92451
|
if (!isAbsent(cause)) {
|
|
92414
|
-
unreadable.push(
|
|
92452
|
+
unreadable.push(relative3(root, directory));
|
|
92415
92453
|
}
|
|
92416
92454
|
return [];
|
|
92417
92455
|
}
|
|
@@ -92994,7 +93032,7 @@ var init_manager2 = __esm({
|
|
|
92994
93032
|
import { readFile as readFile11, realpath as realpath8 } from "node:fs/promises";
|
|
92995
93033
|
import { join as join31 } from "node:path";
|
|
92996
93034
|
function releasePrefix(version2) {
|
|
92997
|
-
return join31(readStateDirectory(),
|
|
93035
|
+
return join31(readStateDirectory(), STATE_ROOT_LAYOUT.releases, version2);
|
|
92998
93036
|
}
|
|
92999
93037
|
async function readInstalledRelease(prefix) {
|
|
93000
93038
|
const packageRoot = await realpath8(join31(prefix, "node_modules", "@moxt-ai", "mobius"));
|
|
@@ -93004,11 +93042,12 @@ var init_release_files = __esm({
|
|
|
93004
93042
|
"src/storage/daemon/release-files.ts"() {
|
|
93005
93043
|
"use strict";
|
|
93006
93044
|
init_state_directory();
|
|
93045
|
+
init_state_root_layout();
|
|
93007
93046
|
}
|
|
93008
93047
|
});
|
|
93009
93048
|
|
|
93010
93049
|
// src/daemon/upgrades/package.ts
|
|
93011
|
-
import { isAbsolute as isAbsolute16, join as join32, relative as
|
|
93050
|
+
import { isAbsolute as isAbsolute16, join as join32, relative as relative4 } from "node:path";
|
|
93012
93051
|
async function prepareDaemonReleaseVersion(version2, signal) {
|
|
93013
93052
|
runtimeUpgradeVersionSchema.parse(version2);
|
|
93014
93053
|
signal.throwIfAborted();
|
|
@@ -93090,7 +93129,7 @@ async function verifyInstalledDaemonRelease(installed, prefix, version2, signal)
|
|
|
93090
93129
|
engines: external_exports.object({ node: external_exports.string().refine((value) => (0, import_semver.validRange)(value) !== null) })
|
|
93091
93130
|
}).parse(JSON.parse(installed.manifest));
|
|
93092
93131
|
const entry = await canonicalPath(join32(installed.packageRoot, metadata.bin.mobius));
|
|
93093
|
-
const resolved =
|
|
93132
|
+
const resolved = relative4(await canonicalPath(prefix), entry);
|
|
93094
93133
|
if (resolved.startsWith("..") || isAbsolute16(resolved)) {
|
|
93095
93134
|
throw new Error("Installed entry escaped npm prefix");
|
|
93096
93135
|
}
|
|
@@ -96208,7 +96247,12 @@ var init_session_manager = __esm({
|
|
|
96208
96247
|
return await runtime.loadHistoryEvents(eventLimit, cursor, options2.signal);
|
|
96209
96248
|
});
|
|
96210
96249
|
});
|
|
96211
|
-
|
|
96250
|
+
async #nativeTargetOptions(options, sessionId, resolveAgent) {
|
|
96251
|
+
const resolved = await resolveAgent(options.agent.id, options.signal, sessionId);
|
|
96252
|
+
options.signal.throwIfAborted();
|
|
96253
|
+
return { ...options, ...resolved, sessionId };
|
|
96254
|
+
}
|
|
96255
|
+
openNativeSession = async (options, origin, resolveAgent) => this.#operations.run(options, async (options2) => {
|
|
96212
96256
|
const key = `${options2.agent.id}:${origin.nativeSessionId}`;
|
|
96213
96257
|
if (this.#nativeOperations.has(key)) {
|
|
96214
96258
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
@@ -96227,10 +96271,8 @@ var init_session_manager = __esm({
|
|
|
96227
96271
|
if (origin.kind === "import" && existing !== void 0) {
|
|
96228
96272
|
return await this.#executionProcesses.use(existing.sessionId, async () => {
|
|
96229
96273
|
this.#closedSessions.delete(existing.sessionId);
|
|
96230
|
-
const
|
|
96231
|
-
|
|
96232
|
-
sessionId: existing.sessionId
|
|
96233
|
-
});
|
|
96274
|
+
const target2 = await this.#nativeTargetOptions(options2, existing.sessionId, resolveAgent);
|
|
96275
|
+
const runtime = await this.ensureSession(target2);
|
|
96234
96276
|
if (this.#executions.command(existing.sessionId) !== void 0 || this.#nativeOperations.has(key)) {
|
|
96235
96277
|
throw new AcpExecutionError(
|
|
96236
96278
|
"Wait for the native session's running operation to finish",
|
|
@@ -96250,6 +96292,7 @@ var init_session_manager = __esm({
|
|
|
96250
96292
|
}
|
|
96251
96293
|
});
|
|
96252
96294
|
}
|
|
96295
|
+
const target = await this.#nativeTargetOptions(options2, options2.sessionId, resolveAgent);
|
|
96253
96296
|
if (this.#executionProcesses.get(options2.sessionId) !== void 0 || this.#executionProcesses.pending(options2.sessionId) !== void 0 || this.#store.read(options2.sessionId) instanceof FoundStoredSession) {
|
|
96254
96297
|
throw new AcpExecutionError(
|
|
96255
96298
|
"The destination conversation already exists",
|
|
@@ -96260,7 +96303,7 @@ var init_session_manager = __esm({
|
|
|
96260
96303
|
return await this.#executionProcesses.use(options2.sessionId, async () => {
|
|
96261
96304
|
this.#nativeOperations.add(key);
|
|
96262
96305
|
try {
|
|
96263
|
-
const runtime = await this.#startPreparation({ ...
|
|
96306
|
+
const runtime = await this.#startPreparation({ ...target, origin }, { kind: "interactive-only" });
|
|
96264
96307
|
const openedKey = `${options2.agent.id}:${runtime.nativeSessionId()}`;
|
|
96265
96308
|
this.#nativeOperations.add(openedKey);
|
|
96266
96309
|
try {
|
|
@@ -96544,7 +96587,8 @@ var init_native_session_browser = __esm({
|
|
|
96544
96587
|
sessionId: command.targetSessionId,
|
|
96545
96588
|
additionalDirectories: target.additionalDirectories
|
|
96546
96589
|
},
|
|
96547
|
-
action === "fork" ? { kind: "fork", nativeSessionId: target.info.sessionId, title: title2 } : { kind: "import", nativeSessionId: target.info.sessionId, title: title2 }
|
|
96590
|
+
action === "fork" ? { kind: "fork", nativeSessionId: target.info.sessionId, title: title2 } : { kind: "import", nativeSessionId: target.info.sessionId, title: title2 },
|
|
96591
|
+
this.#resolveAgent
|
|
96548
96592
|
);
|
|
96549
96593
|
signal.throwIfAborted();
|
|
96550
96594
|
const ready = {
|
|
@@ -97426,7 +97470,7 @@ var init_session_turns = __esm({
|
|
|
97426
97470
|
|
|
97427
97471
|
// src/session/workspace/workspace-directory.ts
|
|
97428
97472
|
import { homedir as homedir4 } from "node:os";
|
|
97429
|
-
import { basename as basename8, dirname as dirname11, isAbsolute as isAbsolute17, join as join33, normalize as normalize2, relative as
|
|
97473
|
+
import { basename as basename8, dirname as dirname11, isAbsolute as isAbsolute17, join as join33, normalize as normalize2, relative as relative5 } from "node:path";
|
|
97430
97474
|
function encodePath(path8) {
|
|
97431
97475
|
const encoded = Buffer.from(path8, "utf8").toString("base64url");
|
|
97432
97476
|
if (path8.length === 0 || path8.length > MAX_WORKSPACE_PATH_LENGTH || encoded.length + "path-".length > MAX_DIRECTORY_IDENTIFIER_LENGTH) {
|
|
@@ -97520,7 +97564,7 @@ var init_workspace_directory = __esm({
|
|
|
97520
97564
|
}
|
|
97521
97565
|
};
|
|
97522
97566
|
label = (path8) => {
|
|
97523
|
-
const suffix =
|
|
97567
|
+
const suffix = relative5(homedir4(), path8);
|
|
97524
97568
|
return suffix === "" ? "~" : !isAbsolute17(suffix) && suffix !== ".." && !suffix.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) ? `~/${suffix.replaceAll("\\", "/")}` : path8;
|
|
97525
97569
|
};
|
|
97526
97570
|
identify = async (bindingId, requestedPath2, signal) => {
|
|
@@ -99443,7 +99487,7 @@ async function executeSessionHistoryPageLoad(socket, command, config2, resolveAg
|
|
|
99443
99487
|
);
|
|
99444
99488
|
const loadOptions = {
|
|
99445
99489
|
additionalDirectories: resolved.additionalDirectories,
|
|
99446
|
-
...await resolveAgent(entry.agentId, signal),
|
|
99490
|
+
...await resolveAgent(entry.agentId, signal, command.sessionId),
|
|
99447
99491
|
cwd: resolved.cwd,
|
|
99448
99492
|
sessionId: command.sessionId,
|
|
99449
99493
|
signal
|
|
@@ -99490,7 +99534,7 @@ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, re
|
|
|
99490
99534
|
);
|
|
99491
99535
|
const loadOptions = {
|
|
99492
99536
|
additionalDirectories: resolved.additionalDirectories,
|
|
99493
|
-
...await resolveAgent(command.agentId, signal),
|
|
99537
|
+
...await resolveAgent(command.agentId, signal, command.sessionId),
|
|
99494
99538
|
cwd: resolved.cwd,
|
|
99495
99539
|
sessionId: command.sessionId,
|
|
99496
99540
|
signal
|
|
@@ -100158,7 +100202,7 @@ async function executePrompt({
|
|
|
100158
100202
|
command.additionalDirectoryIds,
|
|
100159
100203
|
signal
|
|
100160
100204
|
);
|
|
100161
|
-
const { agent, adapter } = await resolveAgent(command.agentId, signal);
|
|
100205
|
+
const { agent, adapter } = await resolveAgent(command.agentId, signal, command.sessionId);
|
|
100162
100206
|
const availability = await waitForSessionAvailability(signal);
|
|
100163
100207
|
if (availability.kind === "busy") {
|
|
100164
100208
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
@@ -100554,7 +100598,7 @@ async function prepareSession(command, recovery, closed, config2, resolveAgent,
|
|
|
100554
100598
|
signal
|
|
100555
100599
|
)
|
|
100556
100600
|
);
|
|
100557
|
-
const resolvedAgent = await resolveAgent(command.agentId, signal);
|
|
100601
|
+
const resolvedAgent = await resolveAgent(command.agentId, signal, command.sessionId);
|
|
100558
100602
|
const preparation = {
|
|
100559
100603
|
additionalDirectories: resolved.additionalDirectories,
|
|
100560
100604
|
...resolvedAgent,
|
|
@@ -100717,7 +100761,7 @@ async function executeSessionConfigure(socket, command, config2, resolveAgent, d
|
|
|
100717
100761
|
);
|
|
100718
100762
|
const configOptions = await sessions.configureSession({
|
|
100719
100763
|
additionalDirectories: resolved.additionalDirectories,
|
|
100720
|
-
...await resolveAgent(command.agentId, signal),
|
|
100764
|
+
...await resolveAgent(command.agentId, signal, command.sessionId),
|
|
100721
100765
|
booleanValue: command.booleanValue,
|
|
100722
100766
|
configId: command.configId,
|
|
100723
100767
|
cwd: resolved.cwd,
|
|
@@ -101712,8 +101756,10 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
|
|
|
101712
101756
|
processes,
|
|
101713
101757
|
(sessionId, content, contentSignal) => externalContent.put({ ...content, sessionId, signal: contentSignal })
|
|
101714
101758
|
);
|
|
101715
|
-
const resolveAgent = async (agentId, resolveSignal) => {
|
|
101716
|
-
const
|
|
101759
|
+
const resolveAgent = async (agentId, resolveSignal, sessionId) => {
|
|
101760
|
+
const catalogAgent = await resolveCatalogAgent(config2, agentId, resolveSignal);
|
|
101761
|
+
const environment = sessionId === void 0 ? void 0 : config2.sessionEnvironment?.({ sessionId, agentId });
|
|
101762
|
+
const agent = environment === void 0 ? catalogAgent : catalogAgent.withEnvironment({ ...catalogAgent.environment, ...environment });
|
|
101717
101763
|
return { agent, adapter: adapters.resolve(agent) };
|
|
101718
101764
|
};
|
|
101719
101765
|
const layer = buildSessionLayer({
|
|
@@ -102385,7 +102431,7 @@ var init_daemon = __esm({
|
|
|
102385
102431
|
});
|
|
102386
102432
|
|
|
102387
102433
|
// src/cli/handler/logs/logic/collect-local-logs.ts
|
|
102388
|
-
import { join as join38, relative as
|
|
102434
|
+
import { join as join38, relative as relative6, resolve as resolve19 } from "node:path";
|
|
102389
102435
|
async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
102390
102436
|
signal.throwIfAborted();
|
|
102391
102437
|
const root = resolve19(stateDirectory);
|
|
@@ -102396,7 +102442,7 @@ async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
|
102396
102442
|
const names = await listLogFiles(directory, root, unreadable);
|
|
102397
102443
|
for (const name2 of names) {
|
|
102398
102444
|
const path8 = join38(directory, name2);
|
|
102399
|
-
const reported =
|
|
102445
|
+
const reported = relative6(root, path8);
|
|
102400
102446
|
const read = await readOwnedLogFile(path8, signal);
|
|
102401
102447
|
if (read.kind === "unreadable") {
|
|
102402
102448
|
unreadable.push(reported);
|