@moxt-ai/mobius 0.0.60 → 0.0.61
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/session-manager.d.ts +0 -3
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +16 -36
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/agent-catalog/agents/deepseek-harness-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/deepseek-harness-agent.js +39 -8
- package/dist/agent-catalog/agents/deepseek-harness-agent.js.map +1 -1
- package/dist/agent-installation/deepseek-managed-package.js +2 -2
- package/dist/authorization/local-video.d.ts +1 -2
- package/dist/authorization/local-video.d.ts.map +1 -1
- package/dist/authorization/local-video.js.map +1 -1
- package/dist/cli.js +71 -465
- package/dist/cli.js.map +4 -4
- package/dist/index.js +73 -466
- package/dist/index.js.map +4 -4
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +2 -6
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +91 -484
- package/dist/runtime.js.map +4 -4
- package/package.json +1 -2
- package/dist/artifacts/runtime-artifact-uploader.d.ts +0 -12
- package/dist/artifacts/runtime-artifact-uploader.d.ts.map +0 -1
- package/dist/artifacts/runtime-artifact-uploader.js +0 -150
- package/dist/artifacts/runtime-artifact-uploader.js.map +0 -1
- package/dist/authorization/local-artifact.d.ts +0 -6
- package/dist/authorization/local-artifact.d.ts.map +0 -1
- package/dist/authorization/local-artifact.js +0 -2
- package/dist/authorization/local-artifact.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -6,12 +6,12 @@ var __export = (target, all2) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
|
-
import { mkdir as
|
|
9
|
+
import { mkdir as mkdir6 } from "node:fs/promises";
|
|
10
10
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@moxt-ai/mobius",
|
|
14
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.61",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -57,7 +57,6 @@ var package_default = {
|
|
|
57
57
|
},
|
|
58
58
|
devDependencies: {
|
|
59
59
|
"@moxt-ai/mobius-protocol": "workspace:*",
|
|
60
|
-
"@moxt-ai/mobius-sdk": "workspace:*",
|
|
61
60
|
"@types/mdast": "4.0.4",
|
|
62
61
|
"@types/node": "^24.13.4",
|
|
63
62
|
esbuild: "0.28.2"
|
|
@@ -1500,21 +1499,21 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1500
1499
|
};
|
|
1501
1500
|
|
|
1502
1501
|
// src/agent-catalog/agents/deepseek-harness-agent.ts
|
|
1503
|
-
import { realpath as realpath3, stat as stat3 } from "node:fs/promises";
|
|
1502
|
+
import { mkdir as mkdir2, realpath as realpath3, stat as stat3, writeFile } from "node:fs/promises";
|
|
1504
1503
|
import { isAbsolute as isAbsolute3, join as join6, normalize } from "node:path";
|
|
1505
1504
|
|
|
1506
1505
|
// src/agent-installation/deepseek-managed-package.ts
|
|
1507
1506
|
var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
|
|
1508
|
-
dependencyResolutionArguments = Object.freeze(["--before=2026-09-
|
|
1507
|
+
dependencyResolutionArguments = Object.freeze(["--before=2026-09-18T00:00:00.000Z"]);
|
|
1509
1508
|
includeOptionalDependencies = true;
|
|
1510
1509
|
verifyDependencyClosure = true;
|
|
1511
1510
|
};
|
|
1512
1511
|
var DEEPSEEK_HARNESS_PACKAGE = new DeepSeekHarnessManagedPackage(
|
|
1513
1512
|
"@deepseek-ai/dsh",
|
|
1514
|
-
"0.1.
|
|
1513
|
+
"0.1.5-rc.2",
|
|
1515
1514
|
"dsh",
|
|
1516
|
-
"sha512-
|
|
1517
|
-
"https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.
|
|
1515
|
+
"sha512-8Xc8hCQHcIWRmTCVU/xZdp6/qMsWMeAd2ObChKDEsfhUPJFXx6H0lgeb1DxUMD86HZrrVN+1bCvn1ppjZ/fOxw==",
|
|
1516
|
+
"https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.5-rc.2.tgz"
|
|
1518
1517
|
);
|
|
1519
1518
|
|
|
1520
1519
|
// src/storage/state-directory.ts
|
|
@@ -1529,16 +1528,30 @@ function readStateDirectory(environment = process.env) {
|
|
|
1529
1528
|
}
|
|
1530
1529
|
|
|
1531
1530
|
// src/agent-catalog/agents/deepseek-harness-agent.ts
|
|
1532
|
-
|
|
1531
|
+
var DEEPSEEK_HARNESS_IMAGE_PROMPT_PATCH = `# Managed by Mobius: pin the ACP bridge to an image-capable route.
|
|
1532
|
+
- id: acp
|
|
1533
|
+
config:
|
|
1534
|
+
provider: deepseek-official
|
|
1535
|
+
model: deepseek-v4-flash-vision-exp
|
|
1536
|
+
`;
|
|
1537
|
+
async function prepareAgentHome(path2, imagePrompts) {
|
|
1533
1538
|
if (!isAbsolute3(path2) || normalize(path2) !== path2) {
|
|
1534
1539
|
throw new AgentProbeError("agent_environment_invalid", "The configured Agent home is invalid");
|
|
1535
1540
|
}
|
|
1536
1541
|
try {
|
|
1542
|
+
if (imagePrompts) {
|
|
1543
|
+
await mkdir2(path2, { mode: 448, recursive: true });
|
|
1544
|
+
}
|
|
1537
1545
|
const resolved = await realpath3(path2);
|
|
1538
1546
|
const metadata = await stat3(resolved);
|
|
1539
1547
|
if (!metadata.isDirectory() || typeof process.getuid === "function" && metadata.uid !== process.getuid()) {
|
|
1540
1548
|
throw new Error("Agent home is not a user-owned directory");
|
|
1541
1549
|
}
|
|
1550
|
+
if (imagePrompts) {
|
|
1551
|
+
await writeFile(join6(resolved, "cordis.patch.yml"), DEEPSEEK_HARNESS_IMAGE_PROMPT_PATCH, {
|
|
1552
|
+
mode: 384
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1542
1555
|
return resolved;
|
|
1543
1556
|
} catch (error62) {
|
|
1544
1557
|
if (error62 instanceof AgentProbeError) {
|
|
@@ -1573,6 +1586,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1573
1586
|
}
|
|
1574
1587
|
createLaunchEnvironment = async (agent, context) => {
|
|
1575
1588
|
let selectedHome = context.environment["DSH_HOME"];
|
|
1589
|
+
let managedHome = false;
|
|
1576
1590
|
try {
|
|
1577
1591
|
const managed = await this.resolveManagedAgent(
|
|
1578
1592
|
readStateDirectory(context.environment),
|
|
@@ -1581,6 +1595,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1581
1595
|
);
|
|
1582
1596
|
if (managed.path === agent.path) {
|
|
1583
1597
|
selectedHome = join6(readStateDirectory(context.environment), "agents", this.id, "home");
|
|
1598
|
+
managedHome = true;
|
|
1584
1599
|
}
|
|
1585
1600
|
} catch {
|
|
1586
1601
|
context.signal.throwIfAborted();
|
|
@@ -1589,7 +1604,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1589
1604
|
return Object.freeze({});
|
|
1590
1605
|
}
|
|
1591
1606
|
return Object.freeze({
|
|
1592
|
-
DSH_HOME: await
|
|
1607
|
+
DSH_HOME: await prepareAgentHome(selectedHome, managedHome)
|
|
1593
1608
|
});
|
|
1594
1609
|
};
|
|
1595
1610
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
@@ -1604,8 +1619,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
1604
1619
|
verifyAcp = (_connection, initialized, _defaultWorkspace, _signal) => {
|
|
1605
1620
|
const capabilities = initialized.agentCapabilities ?? {};
|
|
1606
1621
|
const session = capabilities.sessionCapabilities;
|
|
1607
|
-
|
|
1608
|
-
if ((initialized.authMethods ?? []).length !== 0 || capabilities.loadSession === true || capabilities.mcpCapabilities?.http !== true || session?.close == null || session.list == null || session.resume == null || session.additionalDirectories != null || session.delete != null || session.fork != null || prompt?.audio === true || prompt?.embeddedContext === true || prompt?.image === true) {
|
|
1622
|
+
if ((initialized.authMethods ?? []).length !== 0 || capabilities.loadSession === true || capabilities.mcpCapabilities?.http !== true || session?.close == null || session.list == null || session.resume == null || session.additionalDirectories != null || session.delete != null || session.fork != null) {
|
|
1609
1623
|
throw new AgentProbeError(
|
|
1610
1624
|
"acp_incompatible",
|
|
1611
1625
|
"DeepSeek Harness reported an unsupported ACP capability set"
|
|
@@ -1816,7 +1830,7 @@ import { join as join9 } from "node:path";
|
|
|
1816
1830
|
// src/agent-installation/managed-agent-archive.ts
|
|
1817
1831
|
import { createHash } from "node:crypto";
|
|
1818
1832
|
import { createReadStream } from "node:fs";
|
|
1819
|
-
import { chmod, copyFile, mkdir as
|
|
1833
|
+
import { chmod, copyFile, mkdir as mkdir3, mkdtemp as mkdtemp2, open as open2, realpath as realpath5, rename as rename2, rm as rm2, stat as stat4, writeFile as writeFile2 } from "node:fs/promises";
|
|
1820
1834
|
import { delimiter as delimiter2, dirname as dirname2, isAbsolute as isAbsolute5, join as join8, relative as relative3, sep as sep3 } from "node:path";
|
|
1821
1835
|
|
|
1822
1836
|
// src/agent-installation/verified-download.ts
|
|
@@ -19477,8 +19491,8 @@ function rewriteKeyNames(ctx) {
|
|
|
19477
19491
|
bySchema.set(entry.schema, entry);
|
|
19478
19492
|
}
|
|
19479
19493
|
const rewrites = /* @__PURE__ */ new Map();
|
|
19480
|
-
for (const
|
|
19481
|
-
const seen = ctx.seen.get(
|
|
19494
|
+
for (const record2 of pendingRecords.get(ctx) ?? []) {
|
|
19495
|
+
const seen = ctx.seen.get(record2);
|
|
19482
19496
|
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
19483
19497
|
if (!names || names === true || rewrites.has(names))
|
|
19484
19498
|
continue;
|
|
@@ -24316,14 +24330,14 @@ function createDaemonConfig(connection, agents = [], installableAgents = [], loc
|
|
|
24316
24330
|
}
|
|
24317
24331
|
|
|
24318
24332
|
// src/pairing/pair-local-machine.ts
|
|
24319
|
-
import { mkdir as
|
|
24333
|
+
import { mkdir as mkdir5, realpath as realpath6, stat as stat5 } from "node:fs/promises";
|
|
24320
24334
|
import { hostname as hostname3 } from "node:os";
|
|
24321
24335
|
import { basename, resolve as resolve5 } from "node:path";
|
|
24322
24336
|
import { fetch as fetch2 } from "undici";
|
|
24323
24337
|
|
|
24324
24338
|
// src/storage/runtime-installation-store.ts
|
|
24325
24339
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
24326
|
-
import { mkdir as
|
|
24340
|
+
import { mkdir as mkdir4, open as open4, rename as rename3, unlink, writeFile as writeFile3 } from "node:fs/promises";
|
|
24327
24341
|
import { dirname as dirname3, join as join15, resolve as resolve4 } from "node:path";
|
|
24328
24342
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
24329
24343
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
@@ -24626,9 +24640,9 @@ async function writeJsonAtomically(path2, value, signal) {
|
|
|
24626
24640
|
const directory = dirname3(path2);
|
|
24627
24641
|
const temporaryPath = join15(directory, `.${randomUUID()}.tmp`);
|
|
24628
24642
|
try {
|
|
24629
|
-
await
|
|
24643
|
+
await mkdir4(directory, { mode: 448, recursive: true });
|
|
24630
24644
|
signal.throwIfAborted();
|
|
24631
|
-
await
|
|
24645
|
+
await writeFile3(temporaryPath, `${JSON.stringify(value, null, 2)}
|
|
24632
24646
|
`, { flag: "wx", mode: 384 });
|
|
24633
24647
|
signal.throwIfAborted();
|
|
24634
24648
|
await rename3(temporaryPath, path2);
|
|
@@ -24659,7 +24673,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
24659
24673
|
const rootDirectory = resolve4(options.stateDirectory);
|
|
24660
24674
|
const applicationDirectory = join15(rootDirectory, "installations", applicationId);
|
|
24661
24675
|
try {
|
|
24662
|
-
await
|
|
24676
|
+
await mkdir4(applicationDirectory, { mode: 448, recursive: true });
|
|
24663
24677
|
} catch (cause) {
|
|
24664
24678
|
throw new RuntimeInstallationStoreError(
|
|
24665
24679
|
"installation_unavailable",
|
|
@@ -24672,7 +24686,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
24672
24686
|
const storedInstallationId = await readOrCreateInstallationId(applicationDirectory, signal);
|
|
24673
24687
|
const stateDirectory = join15(applicationDirectory, storedInstallationId);
|
|
24674
24688
|
try {
|
|
24675
|
-
await
|
|
24689
|
+
await mkdir4(stateDirectory, { mode: 448, recursive: true });
|
|
24676
24690
|
} catch (cause) {
|
|
24677
24691
|
throw new RuntimeInstallationStoreError(
|
|
24678
24692
|
"installation_unavailable",
|
|
@@ -24828,7 +24842,7 @@ async function readOrCreateInstallationId(applicationDirectory, signal) {
|
|
|
24828
24842
|
}
|
|
24829
24843
|
const candidate = installationId();
|
|
24830
24844
|
try {
|
|
24831
|
-
await
|
|
24845
|
+
await writeFile3(pointerPath, `${JSON.stringify({ installationId: candidate, version: 1 })}
|
|
24832
24846
|
`, {
|
|
24833
24847
|
flag: "wx",
|
|
24834
24848
|
mode: 384
|
|
@@ -24992,7 +25006,7 @@ function parseResumeArgument(arguments_) {
|
|
|
24992
25006
|
async function resolveDefaultWorkspace(path2) {
|
|
24993
25007
|
const requestedWorkspace = resolve5(path2);
|
|
24994
25008
|
try {
|
|
24995
|
-
await
|
|
25009
|
+
await mkdir5(requestedWorkspace, { recursive: true, mode: 448 });
|
|
24996
25010
|
const defaultWorkspace = await realpath6(requestedWorkspace);
|
|
24997
25011
|
const metadata = await stat5(defaultWorkspace);
|
|
24998
25012
|
if (!metadata.isDirectory()) {
|
|
@@ -25206,7 +25220,7 @@ var AuditStore = class {
|
|
|
25206
25220
|
this.database.exec("ALTER TABLE audit_events ADD COLUMN details_json TEXT NOT NULL DEFAULT '{}'");
|
|
25207
25221
|
}
|
|
25208
25222
|
}
|
|
25209
|
-
record(
|
|
25223
|
+
record(record2) {
|
|
25210
25224
|
this.database.prepare(
|
|
25211
25225
|
`
|
|
25212
25226
|
INSERT INTO audit_events (
|
|
@@ -25219,10 +25233,10 @@ var AuditStore = class {
|
|
|
25219
25233
|
`
|
|
25220
25234
|
).run(
|
|
25221
25235
|
(/* @__PURE__ */ new Date()).toISOString(),
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
|
|
25225
|
-
JSON.stringify(
|
|
25236
|
+
record2.event,
|
|
25237
|
+
record2.commandId,
|
|
25238
|
+
record2.sessionId,
|
|
25239
|
+
JSON.stringify(record2.details ?? {})
|
|
25226
25240
|
);
|
|
25227
25241
|
}
|
|
25228
25242
|
close() {
|
|
@@ -25231,10 +25245,10 @@ var AuditStore = class {
|
|
|
25231
25245
|
};
|
|
25232
25246
|
|
|
25233
25247
|
// src/run-daemon.ts
|
|
25234
|
-
import { createHash as
|
|
25248
|
+
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
25235
25249
|
import { basename as basename7 } from "node:path";
|
|
25236
25250
|
import { styleText } from "node:util";
|
|
25237
|
-
import { fetch as
|
|
25251
|
+
import { fetch as fetch5, WebSocket as WebSocket2 } from "undici";
|
|
25238
25252
|
|
|
25239
25253
|
// src/acp/session-manager.ts
|
|
25240
25254
|
import { spawn as spawn3 } from "node:child_process";
|
|
@@ -33938,10 +33952,6 @@ var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
|
|
|
33938
33952
|
var SESSION_CONTROL_COMMAND_ID = "session-control";
|
|
33939
33953
|
var SESSION_CONTROL_TIMEOUT_MILLISECONDS = 3e4;
|
|
33940
33954
|
var NullAcpSessionObserver = class {
|
|
33941
|
-
importLocalArtifact = (_sessionId, _artifact, signal) => {
|
|
33942
|
-
signal.throwIfAborted();
|
|
33943
|
-
return Promise.resolve("");
|
|
33944
|
-
};
|
|
33945
33955
|
onCommands = () => Promise.resolve();
|
|
33946
33956
|
onConfig = () => Promise.resolve();
|
|
33947
33957
|
onContent = () => Promise.resolve();
|
|
@@ -34501,20 +34511,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
34501
34511
|
#agentName = "";
|
|
34502
34512
|
#agentVersion = "";
|
|
34503
34513
|
#bufferedAgentText = [];
|
|
34504
|
-
#capabilities =
|
|
34505
|
-
additionalDirectories: false,
|
|
34506
|
-
audioPrompt: false,
|
|
34507
|
-
closeSession: false,
|
|
34508
|
-
deleteSession: false,
|
|
34509
|
-
embeddedContextPrompt: false,
|
|
34510
|
-
imagePrompt: false,
|
|
34511
|
-
listSessions: false,
|
|
34512
|
-
loadSession: false,
|
|
34513
|
-
promptQueueing: false,
|
|
34514
|
-
resumeSession: false,
|
|
34515
|
-
steering: false,
|
|
34516
|
-
unstableForkSession: false
|
|
34517
|
-
};
|
|
34514
|
+
#capabilities = unsupportedSessionCapabilities();
|
|
34518
34515
|
#commands = [];
|
|
34519
34516
|
#configRevision = 0;
|
|
34520
34517
|
#configOptions = [];
|
|
@@ -34734,7 +34731,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
34734
34731
|
if (video === null) {
|
|
34735
34732
|
return { ...content3, data: "" };
|
|
34736
34733
|
}
|
|
34737
|
-
return
|
|
34734
|
+
return this.importVideo(video);
|
|
34738
34735
|
}
|
|
34739
34736
|
return content3;
|
|
34740
34737
|
};
|
|
@@ -34785,22 +34782,19 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
34785
34782
|
}
|
|
34786
34783
|
return imageDisplayContent(raster.mimeType, raster.name, await raster.base64(), "");
|
|
34787
34784
|
};
|
|
34788
|
-
importVideo =
|
|
34789
|
-
|
|
34790
|
-
|
|
34791
|
-
|
|
34792
|
-
|
|
34793
|
-
|
|
34794
|
-
|
|
34795
|
-
|
|
34796
|
-
|
|
34797
|
-
|
|
34798
|
-
|
|
34799
|
-
|
|
34800
|
-
|
|
34801
|
-
uri: ""
|
|
34802
|
-
};
|
|
34803
|
-
};
|
|
34785
|
+
importVideo = (video) => ({
|
|
34786
|
+
artifactId: "",
|
|
34787
|
+
data: video.base64(),
|
|
34788
|
+
mimeType: video.mimeType,
|
|
34789
|
+
name: video.name,
|
|
34790
|
+
newText: "",
|
|
34791
|
+
oldText: "",
|
|
34792
|
+
path: "",
|
|
34793
|
+
terminalId: "",
|
|
34794
|
+
text: "",
|
|
34795
|
+
type: "video",
|
|
34796
|
+
uri: ""
|
|
34797
|
+
});
|
|
34804
34798
|
async #initializeAgent(signal) {
|
|
34805
34799
|
await this.#metrics.measure("agent-initialize", async () => await this.#initializeAgentOperation(signal));
|
|
34806
34800
|
}
|
|
@@ -37622,391 +37616,6 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
37622
37616
|
});
|
|
37623
37617
|
}
|
|
37624
37618
|
|
|
37625
|
-
// src/artifacts/runtime-artifact-uploader.ts
|
|
37626
|
-
import { createHash as createHash3 } from "node:crypto";
|
|
37627
|
-
|
|
37628
|
-
// ../mobius-sdk/src/errors.ts
|
|
37629
|
-
var MobiusError = class extends Error {
|
|
37630
|
-
code;
|
|
37631
|
-
constructor(code, message, options = {}) {
|
|
37632
|
-
super(message, options);
|
|
37633
|
-
this.code = code;
|
|
37634
|
-
this.name = "MobiusError";
|
|
37635
|
-
}
|
|
37636
|
-
};
|
|
37637
|
-
var MobiusProtocolError = class extends MobiusError {
|
|
37638
|
-
constructor(message, options = {}) {
|
|
37639
|
-
super("invalid_service_response", message, options);
|
|
37640
|
-
this.name = "MobiusProtocolError";
|
|
37641
|
-
}
|
|
37642
|
-
};
|
|
37643
|
-
var MobiusValidationError = class extends MobiusError {
|
|
37644
|
-
constructor(message, options = {}) {
|
|
37645
|
-
super("invalid_request", message, options);
|
|
37646
|
-
this.name = "MobiusValidationError";
|
|
37647
|
-
}
|
|
37648
|
-
};
|
|
37649
|
-
|
|
37650
|
-
// ../mobius-sdk/src/resources.ts
|
|
37651
|
-
var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
37652
|
-
function invalidResponse(message) {
|
|
37653
|
-
return new MobiusProtocolError(message);
|
|
37654
|
-
}
|
|
37655
|
-
function isRecord11(value) {
|
|
37656
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37657
|
-
}
|
|
37658
|
-
function record2(value, name) {
|
|
37659
|
-
if (!isRecord11(value)) {
|
|
37660
|
-
throw invalidResponse(`The service returned an invalid ${name}`);
|
|
37661
|
-
}
|
|
37662
|
-
return value;
|
|
37663
|
-
}
|
|
37664
|
-
function stringField(value, field, maximumLength = 85e5) {
|
|
37665
|
-
const candidate = value[field];
|
|
37666
|
-
if (typeof candidate !== "string" || candidate.length > maximumLength) {
|
|
37667
|
-
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
37668
|
-
}
|
|
37669
|
-
return candidate;
|
|
37670
|
-
}
|
|
37671
|
-
function identifierField(value, field) {
|
|
37672
|
-
const candidate = stringField(value, field, 128);
|
|
37673
|
-
if (!IDENTIFIER_PATTERN6.test(candidate)) {
|
|
37674
|
-
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
37675
|
-
}
|
|
37676
|
-
return candidate;
|
|
37677
|
-
}
|
|
37678
|
-
function integerField(value, field) {
|
|
37679
|
-
const candidate = value[field];
|
|
37680
|
-
if (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0) {
|
|
37681
|
-
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
37682
|
-
}
|
|
37683
|
-
return candidate;
|
|
37684
|
-
}
|
|
37685
|
-
function validateTimestamp(value, field) {
|
|
37686
|
-
if (Number.isNaN(Date.parse(value))) {
|
|
37687
|
-
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
37688
|
-
}
|
|
37689
|
-
return value;
|
|
37690
|
-
}
|
|
37691
|
-
var MobiusArtifactUploadRequest = class {
|
|
37692
|
-
byteLength;
|
|
37693
|
-
mediaType;
|
|
37694
|
-
name;
|
|
37695
|
-
sha256;
|
|
37696
|
-
constructor(name, mediaType, byteLength, sha256) {
|
|
37697
|
-
if (name.length < 1 || name.length > 500 || name.includes("\0") || mediaType.length < 1 || mediaType.length > 255 || mediaType.includes("\r") || mediaType.includes("\n") || !Number.isSafeInteger(byteLength) || byteLength < 1 || !/^[a-f0-9]{64}$/.test(sha256)) {
|
|
37698
|
-
throw new MobiusValidationError("The artifact upload request is invalid");
|
|
37699
|
-
}
|
|
37700
|
-
this.byteLength = byteLength;
|
|
37701
|
-
this.mediaType = mediaType;
|
|
37702
|
-
this.name = name;
|
|
37703
|
-
this.sha256 = sha256;
|
|
37704
|
-
}
|
|
37705
|
-
};
|
|
37706
|
-
var MobiusArtifact = class {
|
|
37707
|
-
artifactId;
|
|
37708
|
-
byteLength;
|
|
37709
|
-
createdAt;
|
|
37710
|
-
mediaType;
|
|
37711
|
-
name;
|
|
37712
|
-
sessionId;
|
|
37713
|
-
sha256;
|
|
37714
|
-
constructor(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt) {
|
|
37715
|
-
this.artifactId = artifactId;
|
|
37716
|
-
this.byteLength = byteLength;
|
|
37717
|
-
this.createdAt = createdAt;
|
|
37718
|
-
this.mediaType = mediaType;
|
|
37719
|
-
this.name = name;
|
|
37720
|
-
this.sessionId = sessionId;
|
|
37721
|
-
this.sha256 = sha256;
|
|
37722
|
-
}
|
|
37723
|
-
};
|
|
37724
|
-
var MobiusUploadingArtifact = class extends MobiusArtifact {
|
|
37725
|
-
expiresAt;
|
|
37726
|
-
state = "uploading";
|
|
37727
|
-
constructor(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt, expiresAt) {
|
|
37728
|
-
super(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt);
|
|
37729
|
-
this.expiresAt = expiresAt;
|
|
37730
|
-
}
|
|
37731
|
-
};
|
|
37732
|
-
var MobiusArtifactUpload = class extends MobiusUploadingArtifact {
|
|
37733
|
-
uploadToken;
|
|
37734
|
-
constructor(artifact, uploadToken) {
|
|
37735
|
-
super(
|
|
37736
|
-
artifact.sessionId,
|
|
37737
|
-
artifact.artifactId,
|
|
37738
|
-
artifact.name,
|
|
37739
|
-
artifact.mediaType,
|
|
37740
|
-
artifact.byteLength,
|
|
37741
|
-
artifact.sha256,
|
|
37742
|
-
artifact.createdAt,
|
|
37743
|
-
artifact.expiresAt
|
|
37744
|
-
);
|
|
37745
|
-
this.uploadToken = uploadToken;
|
|
37746
|
-
}
|
|
37747
|
-
};
|
|
37748
|
-
var MobiusAvailableArtifact = class extends MobiusArtifact {
|
|
37749
|
-
availableAt;
|
|
37750
|
-
state = "available";
|
|
37751
|
-
constructor(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt, availableAt) {
|
|
37752
|
-
super(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt);
|
|
37753
|
-
this.availableAt = availableAt;
|
|
37754
|
-
}
|
|
37755
|
-
};
|
|
37756
|
-
var MobiusExpiredArtifact = class extends MobiusArtifact {
|
|
37757
|
-
expiredAt;
|
|
37758
|
-
state = "expired";
|
|
37759
|
-
constructor(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt, expiredAt) {
|
|
37760
|
-
super(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt);
|
|
37761
|
-
this.expiredAt = expiredAt;
|
|
37762
|
-
}
|
|
37763
|
-
};
|
|
37764
|
-
function artifactFields(value) {
|
|
37765
|
-
const sha256 = stringField(value, "sha256", 64);
|
|
37766
|
-
if (!/^[a-f0-9]{64}$/.test(sha256)) {
|
|
37767
|
-
throw invalidResponse("The service returned an invalid artifact digest");
|
|
37768
|
-
}
|
|
37769
|
-
return {
|
|
37770
|
-
artifactId: identifierField(value, "artifactId"),
|
|
37771
|
-
byteLength: integerField(value, "byteLength"),
|
|
37772
|
-
createdAt: validateTimestamp(stringField(value, "createdAt", 128), "createdAt"),
|
|
37773
|
-
mediaType: stringField(value, "mediaType", 255),
|
|
37774
|
-
name: stringField(value, "name", 500),
|
|
37775
|
-
sessionId: identifierField(value, "sessionId"),
|
|
37776
|
-
sha256
|
|
37777
|
-
};
|
|
37778
|
-
}
|
|
37779
|
-
function uploadingArtifact(value) {
|
|
37780
|
-
const fields = artifactFields(value);
|
|
37781
|
-
return new MobiusUploadingArtifact(
|
|
37782
|
-
fields.sessionId,
|
|
37783
|
-
fields.artifactId,
|
|
37784
|
-
fields.name,
|
|
37785
|
-
fields.mediaType,
|
|
37786
|
-
fields.byteLength,
|
|
37787
|
-
fields.sha256,
|
|
37788
|
-
fields.createdAt,
|
|
37789
|
-
validateTimestamp(stringField(value, "expiresAt", 128), "expiresAt")
|
|
37790
|
-
);
|
|
37791
|
-
}
|
|
37792
|
-
function decodeMobiusArtifactUpload(value) {
|
|
37793
|
-
const artifact = record2(value, "artifact upload authorization");
|
|
37794
|
-
return new MobiusArtifactUpload(uploadingArtifact(artifact), stringField(artifact, "uploadToken", 256));
|
|
37795
|
-
}
|
|
37796
|
-
function decodeMobiusArtifact(value) {
|
|
37797
|
-
const artifact = record2(value, "artifact");
|
|
37798
|
-
const state = stringField(artifact, "state", 32);
|
|
37799
|
-
if (state === "uploading") {
|
|
37800
|
-
return uploadingArtifact(artifact);
|
|
37801
|
-
}
|
|
37802
|
-
const fields = artifactFields(artifact);
|
|
37803
|
-
if (state === "available") {
|
|
37804
|
-
return new MobiusAvailableArtifact(
|
|
37805
|
-
fields.sessionId,
|
|
37806
|
-
fields.artifactId,
|
|
37807
|
-
fields.name,
|
|
37808
|
-
fields.mediaType,
|
|
37809
|
-
fields.byteLength,
|
|
37810
|
-
fields.sha256,
|
|
37811
|
-
fields.createdAt,
|
|
37812
|
-
validateTimestamp(stringField(artifact, "availableAt", 128), "availableAt")
|
|
37813
|
-
);
|
|
37814
|
-
}
|
|
37815
|
-
if (state === "expired") {
|
|
37816
|
-
return new MobiusExpiredArtifact(
|
|
37817
|
-
fields.sessionId,
|
|
37818
|
-
fields.artifactId,
|
|
37819
|
-
fields.name,
|
|
37820
|
-
fields.mediaType,
|
|
37821
|
-
fields.byteLength,
|
|
37822
|
-
fields.sha256,
|
|
37823
|
-
fields.createdAt,
|
|
37824
|
-
validateTimestamp(stringField(artifact, "expiredAt", 128), "expiredAt")
|
|
37825
|
-
);
|
|
37826
|
-
}
|
|
37827
|
-
throw invalidResponse("The service returned an invalid artifact state");
|
|
37828
|
-
}
|
|
37829
|
-
function decodeMobiusAvailableArtifact(value) {
|
|
37830
|
-
const artifact = decodeMobiusArtifact(value);
|
|
37831
|
-
if (!(artifact instanceof MobiusAvailableArtifact)) {
|
|
37832
|
-
throw invalidResponse("The service did not make the artifact available");
|
|
37833
|
-
}
|
|
37834
|
-
return artifact;
|
|
37835
|
-
}
|
|
37836
|
-
var MobiusRuntimePairingLifecycle = Object.freeze({
|
|
37837
|
-
Expired: "expired",
|
|
37838
|
-
Paired: "paired",
|
|
37839
|
-
Pending: "pending",
|
|
37840
|
-
Revoked: "revoked"
|
|
37841
|
-
});
|
|
37842
|
-
|
|
37843
|
-
// src/artifacts/runtime-artifact-uploader.ts
|
|
37844
|
-
import { fetch as fetch4 } from "undici";
|
|
37845
|
-
var UPLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
37846
|
-
var RuntimeArtifactUploadError = class extends Error {
|
|
37847
|
-
code;
|
|
37848
|
-
constructor(code, message, options = {}) {
|
|
37849
|
-
super(message, options);
|
|
37850
|
-
this.code = code;
|
|
37851
|
-
this.name = "RuntimeArtifactUploadError";
|
|
37852
|
-
}
|
|
37853
|
-
};
|
|
37854
|
-
var UploadedRuntimeArtifact = class {
|
|
37855
|
-
artifactId;
|
|
37856
|
-
byteLength;
|
|
37857
|
-
mimeType;
|
|
37858
|
-
name;
|
|
37859
|
-
sha256;
|
|
37860
|
-
constructor(artifactId, name, mimeType, byteLength, sha256) {
|
|
37861
|
-
this.artifactId = artifactId;
|
|
37862
|
-
this.byteLength = byteLength;
|
|
37863
|
-
this.mimeType = mimeType;
|
|
37864
|
-
this.name = name;
|
|
37865
|
-
this.sha256 = sha256;
|
|
37866
|
-
}
|
|
37867
|
-
};
|
|
37868
|
-
function channelOrigin(config2) {
|
|
37869
|
-
const url2 = new URL(config2.relayUrl);
|
|
37870
|
-
url2.protocol = url2.protocol === "wss:" ? "https:" : "http:";
|
|
37871
|
-
let channelPath = "";
|
|
37872
|
-
if (url2.pathname.endsWith("/daemon")) {
|
|
37873
|
-
channelPath = url2.pathname.slice(0, -"/daemon".length);
|
|
37874
|
-
} else {
|
|
37875
|
-
const runtimePath = `${MOBIUS_API_PREFIX}/v1/runtimes/connect`;
|
|
37876
|
-
if (!url2.pathname.endsWith("/v1/runtimes/connect") && !url2.pathname.endsWith(runtimePath)) {
|
|
37877
|
-
throw new RuntimeArtifactUploadError("artifact_endpoint_invalid", "The Relay artifact endpoint is invalid");
|
|
37878
|
-
}
|
|
37879
|
-
channelPath = `${url2.pathname.replace(/\/v1\/runtimes\/connect$/, "")}/channels/${encodeURIComponent(config2.channelId)}`;
|
|
37880
|
-
}
|
|
37881
|
-
url2.pathname = channelPath;
|
|
37882
|
-
url2.search = "";
|
|
37883
|
-
url2.hash = "";
|
|
37884
|
-
return url2;
|
|
37885
|
-
}
|
|
37886
|
-
function uploadError(code, message, cause) {
|
|
37887
|
-
return new RuntimeArtifactUploadError(code, message, cause === void 0 ? {} : { cause });
|
|
37888
|
-
}
|
|
37889
|
-
function translateSdkError(cause) {
|
|
37890
|
-
if (cause instanceof MobiusValidationError) {
|
|
37891
|
-
throw uploadError("artifact_upload_failed", cause.message, cause);
|
|
37892
|
-
}
|
|
37893
|
-
if (cause instanceof MobiusProtocolError) {
|
|
37894
|
-
throw uploadError("artifact_upload_failed", "The Relay returned an invalid upload response", cause);
|
|
37895
|
-
}
|
|
37896
|
-
throw cause;
|
|
37897
|
-
}
|
|
37898
|
-
async function readJson(response) {
|
|
37899
|
-
try {
|
|
37900
|
-
return await response.json();
|
|
37901
|
-
} catch (cause) {
|
|
37902
|
-
throw uploadError("artifact_upload_failed", "The Relay returned an invalid upload response", cause);
|
|
37903
|
-
}
|
|
37904
|
-
}
|
|
37905
|
-
async function readAuthorization(response) {
|
|
37906
|
-
try {
|
|
37907
|
-
return decodeMobiusArtifactUpload(await readJson(response));
|
|
37908
|
-
} catch (cause) {
|
|
37909
|
-
translateSdkError(cause);
|
|
37910
|
-
}
|
|
37911
|
-
}
|
|
37912
|
-
function sessionArtifactUrl(origin, sessionId, resourcePath) {
|
|
37913
|
-
return new URL(`${origin.pathname}/sessions/${encodeURIComponent(sessionId)}/${resourcePath}`, origin);
|
|
37914
|
-
}
|
|
37915
|
-
async function postLease(url2, headers, request, signal) {
|
|
37916
|
-
return await fetch4(url2, {
|
|
37917
|
-
dispatcher: environmentProxyDispatcher,
|
|
37918
|
-
headers: { ...headers, "content-type": "application/json" },
|
|
37919
|
-
method: "POST",
|
|
37920
|
-
body: JSON.stringify(request),
|
|
37921
|
-
signal
|
|
37922
|
-
});
|
|
37923
|
-
}
|
|
37924
|
-
async function putContent(url2, headers, authorization, bytes, signal) {
|
|
37925
|
-
return await fetch4(url2, {
|
|
37926
|
-
dispatcher: environmentProxyDispatcher,
|
|
37927
|
-
headers: {
|
|
37928
|
-
...headers,
|
|
37929
|
-
"content-type": authorization.mediaType,
|
|
37930
|
-
"x-mobius-upload-token": authorization.uploadToken
|
|
37931
|
-
},
|
|
37932
|
-
method: "PUT",
|
|
37933
|
-
body: bytes,
|
|
37934
|
-
signal
|
|
37935
|
-
});
|
|
37936
|
-
}
|
|
37937
|
-
async function uploadRuntimeArtifact(config2, sessionId, artifact, signal) {
|
|
37938
|
-
signal.throwIfAborted();
|
|
37939
|
-
let request;
|
|
37940
|
-
try {
|
|
37941
|
-
request = new MobiusArtifactUploadRequest(
|
|
37942
|
-
artifact.name,
|
|
37943
|
-
artifact.mimeType,
|
|
37944
|
-
artifact.bytes.byteLength,
|
|
37945
|
-
createHash3("sha256").update(artifact.bytes).digest("hex")
|
|
37946
|
-
);
|
|
37947
|
-
} catch (cause) {
|
|
37948
|
-
translateSdkError(cause);
|
|
37949
|
-
}
|
|
37950
|
-
const timeoutSignal = AbortSignal.timeout(UPLOAD_TIMEOUT_MILLISECONDS);
|
|
37951
|
-
const requestSignal = AbortSignal.any([signal, timeoutSignal]);
|
|
37952
|
-
const origin = channelOrigin(config2);
|
|
37953
|
-
const headers = runtimeAuthorization(config2.relayUrl);
|
|
37954
|
-
let created;
|
|
37955
|
-
try {
|
|
37956
|
-
created = await postLease(
|
|
37957
|
-
sessionArtifactUrl(origin, sessionId, "artifacts/uploads"),
|
|
37958
|
-
headers,
|
|
37959
|
-
request,
|
|
37960
|
-
requestSignal
|
|
37961
|
-
);
|
|
37962
|
-
} catch (cause) {
|
|
37963
|
-
signal.throwIfAborted();
|
|
37964
|
-
throw uploadError(
|
|
37965
|
-
timeoutSignal.aborted ? "artifact_upload_timeout" : "artifact_upload_failed",
|
|
37966
|
-
timeoutSignal.aborted ? "The artifact upload authorization timed out" : "The artifact upload could not start",
|
|
37967
|
-
cause
|
|
37968
|
-
);
|
|
37969
|
-
}
|
|
37970
|
-
if (!created.ok) {
|
|
37971
|
-
await created.body?.cancel();
|
|
37972
|
-
throw uploadError("artifact_upload_rejected", "The Relay rejected the artifact upload");
|
|
37973
|
-
}
|
|
37974
|
-
const authorization = await readAuthorization(created);
|
|
37975
|
-
let uploaded;
|
|
37976
|
-
try {
|
|
37977
|
-
uploaded = await putContent(
|
|
37978
|
-
sessionArtifactUrl(origin, sessionId, `artifacts/${encodeURIComponent(authorization.artifactId)}/content`),
|
|
37979
|
-
headers,
|
|
37980
|
-
authorization,
|
|
37981
|
-
artifact.bytes,
|
|
37982
|
-
requestSignal
|
|
37983
|
-
);
|
|
37984
|
-
} catch (cause) {
|
|
37985
|
-
signal.throwIfAborted();
|
|
37986
|
-
throw uploadError(
|
|
37987
|
-
timeoutSignal.aborted ? "artifact_upload_timeout" : "artifact_upload_failed",
|
|
37988
|
-
timeoutSignal.aborted ? "The artifact upload timed out" : "The artifact content could not be uploaded",
|
|
37989
|
-
cause
|
|
37990
|
-
);
|
|
37991
|
-
}
|
|
37992
|
-
if (!uploaded.ok) {
|
|
37993
|
-
await uploaded.body?.cancel();
|
|
37994
|
-
throw uploadError("artifact_upload_rejected", "The Relay rejected the artifact content");
|
|
37995
|
-
}
|
|
37996
|
-
try {
|
|
37997
|
-
const available = decodeMobiusAvailableArtifact(await readJson(uploaded));
|
|
37998
|
-
return new UploadedRuntimeArtifact(
|
|
37999
|
-
available.artifactId,
|
|
38000
|
-
available.name,
|
|
38001
|
-
available.mediaType,
|
|
38002
|
-
available.byteLength,
|
|
38003
|
-
available.sha256
|
|
38004
|
-
);
|
|
38005
|
-
} catch (cause) {
|
|
38006
|
-
translateSdkError(cause);
|
|
38007
|
-
}
|
|
38008
|
-
}
|
|
38009
|
-
|
|
38010
37619
|
// src/authorization/local-authorization-error.ts
|
|
38011
37620
|
var LocalAuthorizationError = class extends Error {
|
|
38012
37621
|
code = "local_authorization_failed";
|
|
@@ -38835,13 +38444,13 @@ var NativeSessionService = class {
|
|
|
38835
38444
|
};
|
|
38836
38445
|
|
|
38837
38446
|
// src/prompt-artifact-resolver.ts
|
|
38838
|
-
import { createHash as
|
|
38839
|
-
import { fetch as
|
|
38447
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
38448
|
+
import { fetch as fetch4 } from "undici";
|
|
38840
38449
|
var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
38841
38450
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
38842
38451
|
var MAX_AGENT_IMAGE_BASE64_LENGTH = 4e6;
|
|
38843
38452
|
var MAX_AGENT_RESOURCE_BYTE_LENGTH = 1e6;
|
|
38844
|
-
var
|
|
38453
|
+
var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
38845
38454
|
var PromptArtifactError = class extends Error {
|
|
38846
38455
|
code;
|
|
38847
38456
|
constructor(code, message, options = {}) {
|
|
@@ -38884,7 +38493,7 @@ function parseReference(resource) {
|
|
|
38884
38493
|
const encodedByteLength2 = url2.searchParams.get("byteLength") ?? "";
|
|
38885
38494
|
const sha256 = url2.searchParams.get("sha256") ?? "";
|
|
38886
38495
|
const byteLength = Number(encodedByteLength2);
|
|
38887
|
-
if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !
|
|
38496
|
+
if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !IDENTIFIER_PATTERN6.test(artifactId) || keys.length !== 2 || keys[0] !== "byteLength" || keys[1] !== "sha256" || !/^[1-9][0-9]*$/.test(encodedByteLength2) || !Number.isSafeInteger(byteLength) || !/^[a-f0-9]{64}$/.test(sha256)) {
|
|
38888
38497
|
throw new PromptArtifactError("artifact_reference_invalid", "The prompt artifact reference is invalid");
|
|
38889
38498
|
}
|
|
38890
38499
|
return new PromptArtifactReference(artifactId, byteLength, sha256, resource);
|
|
@@ -38950,7 +38559,7 @@ async function download(config2, command, reference, signal) {
|
|
|
38950
38559
|
const requestSignal = AbortSignal.any([signal, timeoutSignal]);
|
|
38951
38560
|
let response;
|
|
38952
38561
|
try {
|
|
38953
|
-
response = await
|
|
38562
|
+
response = await fetch4(downloadUrl(config2, command, reference), {
|
|
38954
38563
|
dispatcher: environmentProxyDispatcher,
|
|
38955
38564
|
headers: {
|
|
38956
38565
|
accept: reference.resource.mimeType,
|
|
@@ -38974,7 +38583,7 @@ async function download(config2, command, reference, signal) {
|
|
|
38974
38583
|
);
|
|
38975
38584
|
}
|
|
38976
38585
|
const bytes = await responseBytes(response, reference.byteLength, requestSignal);
|
|
38977
|
-
if (
|
|
38586
|
+
if (createHash3("sha256").update(bytes).digest("hex") !== reference.sha256) {
|
|
38978
38587
|
throw new PromptArtifactError(
|
|
38979
38588
|
"artifact_integrity_failed",
|
|
38980
38589
|
"The prompt artifact failed integrity validation"
|
|
@@ -40079,13 +39688,10 @@ var AGENT_TEXT_MAXIMUM_LENGTH = 1e5;
|
|
|
40079
39688
|
var ACTIVE_TURN_RECONCILIATION_TIMEOUT_MILLISECONDS = 2e4;
|
|
40080
39689
|
var ACTIVE_TURN_RECONCILIATION_CLOSE_CODE = 4009;
|
|
40081
39690
|
var DaemonAcpObserver = class {
|
|
40082
|
-
#config;
|
|
40083
39691
|
#record;
|
|
40084
|
-
constructor(
|
|
40085
|
-
this.#
|
|
40086
|
-
this.#record = record3;
|
|
39692
|
+
constructor(record2) {
|
|
39693
|
+
this.#record = record2;
|
|
40087
39694
|
}
|
|
40088
|
-
importLocalArtifact = async (sessionId, artifact, signal) => (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
40089
39695
|
onCommands = (event) => {
|
|
40090
39696
|
this.#record(event.sessionId, event);
|
|
40091
39697
|
return Promise.resolve();
|
|
@@ -40303,7 +39909,7 @@ async function reconcileActiveTurn(config2, turn, signal) {
|
|
|
40303
39909
|
const requestSignal = AbortSignal.any([signal, timeoutSignal]);
|
|
40304
39910
|
let response;
|
|
40305
39911
|
try {
|
|
40306
|
-
response = await
|
|
39912
|
+
response = await fetch5(activeTurnReconciliationEndpoint(config2, turn), {
|
|
40307
39913
|
body: JSON.stringify({ outcome: { kind: "running" } }),
|
|
40308
39914
|
dispatcher: environmentProxyDispatcher,
|
|
40309
39915
|
headers: { ...runtimeAuthorization(config2.relayUrl), "content-type": "application/json" },
|
|
@@ -40813,7 +40419,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
40813
40419
|
resolution: modelEffort.resolution,
|
|
40814
40420
|
valuesByModel: {}
|
|
40815
40421
|
};
|
|
40816
|
-
return
|
|
40422
|
+
return createHash4("sha256").update(
|
|
40817
40423
|
JSON.stringify({
|
|
40818
40424
|
adapterVersion: agent.adapterVersion,
|
|
40819
40425
|
agentId: agent.id,
|
|
@@ -42366,7 +41972,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42366
41972
|
}
|
|
42367
41973
|
publisher.recordAttempt(sessionId, event, attemptId);
|
|
42368
41974
|
};
|
|
42369
|
-
const sessions = new AcpSessionManager(new DaemonAcpObserver(
|
|
41975
|
+
const sessions = new AcpSessionManager(new DaemonAcpObserver(recordSessionEvent), sessionStore);
|
|
42370
41976
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|
|
42371
41977
|
const installationObserver = new DaemonInstallationObserver();
|
|
42372
41978
|
const diagnostics = new RelayConnectionDiagnostics(audit, config2.channelId, config2.relayUrl);
|
|
@@ -42600,7 +42206,7 @@ async function main() {
|
|
|
42600
42206
|
const installation = await openMobiusCliInstallation(shutdown.signal, process.env);
|
|
42601
42207
|
const localContext = new DaemonLocalContext(installation.stateDirectory, process.env);
|
|
42602
42208
|
const defaultWorkspace = loadDefaultWorkspace(localContext.environment);
|
|
42603
|
-
await
|
|
42209
|
+
await mkdir6(defaultWorkspace, { recursive: true, mode: 448 });
|
|
42604
42210
|
const inventory = await discoverLocalAgentInventory({
|
|
42605
42211
|
defaultWorkspace,
|
|
42606
42212
|
environment: localContext.environment,
|