@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/index.js
CHANGED
|
@@ -16628,8 +16628,8 @@ function rewriteKeyNames(ctx) {
|
|
|
16628
16628
|
bySchema.set(entry.schema, entry);
|
|
16629
16629
|
}
|
|
16630
16630
|
const rewrites = /* @__PURE__ */ new Map();
|
|
16631
|
-
for (const
|
|
16632
|
-
const seen = ctx.seen.get(
|
|
16631
|
+
for (const record2 of pendingRecords.get(ctx) ?? []) {
|
|
16632
|
+
const seen = ctx.seen.get(record2);
|
|
16633
16633
|
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
16634
16634
|
if (!names || names === true || rewrites.has(names))
|
|
16635
16635
|
continue;
|
|
@@ -30909,10 +30909,6 @@ var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
|
|
|
30909
30909
|
var SESSION_CONTROL_COMMAND_ID = "session-control";
|
|
30910
30910
|
var SESSION_CONTROL_TIMEOUT_MILLISECONDS = 3e4;
|
|
30911
30911
|
var NullAcpSessionObserver = class {
|
|
30912
|
-
importLocalArtifact = (_sessionId, _artifact, signal) => {
|
|
30913
|
-
signal.throwIfAborted();
|
|
30914
|
-
return Promise.resolve("");
|
|
30915
|
-
};
|
|
30916
30912
|
onCommands = () => Promise.resolve();
|
|
30917
30913
|
onConfig = () => Promise.resolve();
|
|
30918
30914
|
onContent = () => Promise.resolve();
|
|
@@ -31472,20 +31468,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31472
31468
|
#agentName = "";
|
|
31473
31469
|
#agentVersion = "";
|
|
31474
31470
|
#bufferedAgentText = [];
|
|
31475
|
-
#capabilities =
|
|
31476
|
-
additionalDirectories: false,
|
|
31477
|
-
audioPrompt: false,
|
|
31478
|
-
closeSession: false,
|
|
31479
|
-
deleteSession: false,
|
|
31480
|
-
embeddedContextPrompt: false,
|
|
31481
|
-
imagePrompt: false,
|
|
31482
|
-
listSessions: false,
|
|
31483
|
-
loadSession: false,
|
|
31484
|
-
promptQueueing: false,
|
|
31485
|
-
resumeSession: false,
|
|
31486
|
-
steering: false,
|
|
31487
|
-
unstableForkSession: false
|
|
31488
|
-
};
|
|
31471
|
+
#capabilities = unsupportedSessionCapabilities();
|
|
31489
31472
|
#commands = [];
|
|
31490
31473
|
#configRevision = 0;
|
|
31491
31474
|
#configOptions = [];
|
|
@@ -31705,7 +31688,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31705
31688
|
if (video === null) {
|
|
31706
31689
|
return { ...content3, data: "" };
|
|
31707
31690
|
}
|
|
31708
|
-
return
|
|
31691
|
+
return this.importVideo(video);
|
|
31709
31692
|
}
|
|
31710
31693
|
return content3;
|
|
31711
31694
|
};
|
|
@@ -31756,22 +31739,19 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31756
31739
|
}
|
|
31757
31740
|
return imageDisplayContent(raster.mimeType, raster.name, await raster.base64(), "");
|
|
31758
31741
|
};
|
|
31759
|
-
importVideo =
|
|
31760
|
-
|
|
31761
|
-
|
|
31762
|
-
|
|
31763
|
-
|
|
31764
|
-
|
|
31765
|
-
|
|
31766
|
-
|
|
31767
|
-
|
|
31768
|
-
|
|
31769
|
-
|
|
31770
|
-
|
|
31771
|
-
|
|
31772
|
-
uri: ""
|
|
31773
|
-
};
|
|
31774
|
-
};
|
|
31742
|
+
importVideo = (video) => ({
|
|
31743
|
+
artifactId: "",
|
|
31744
|
+
data: video.base64(),
|
|
31745
|
+
mimeType: video.mimeType,
|
|
31746
|
+
name: video.name,
|
|
31747
|
+
newText: "",
|
|
31748
|
+
oldText: "",
|
|
31749
|
+
path: "",
|
|
31750
|
+
terminalId: "",
|
|
31751
|
+
text: "",
|
|
31752
|
+
type: "video",
|
|
31753
|
+
uri: ""
|
|
31754
|
+
});
|
|
31775
31755
|
async #initializeAgent(signal) {
|
|
31776
31756
|
await this.#metrics.measure("agent-initialize", async () => await this.#initializeAgentOperation(signal));
|
|
31777
31757
|
}
|
|
@@ -33783,7 +33763,7 @@ var AuditStore = class {
|
|
|
33783
33763
|
this.database.exec("ALTER TABLE audit_events ADD COLUMN details_json TEXT NOT NULL DEFAULT '{}'");
|
|
33784
33764
|
}
|
|
33785
33765
|
}
|
|
33786
|
-
record(
|
|
33766
|
+
record(record2) {
|
|
33787
33767
|
this.database.prepare(
|
|
33788
33768
|
`
|
|
33789
33769
|
INSERT INTO audit_events (
|
|
@@ -33796,10 +33776,10 @@ var AuditStore = class {
|
|
|
33796
33776
|
`
|
|
33797
33777
|
).run(
|
|
33798
33778
|
(/* @__PURE__ */ new Date()).toISOString(),
|
|
33799
|
-
|
|
33800
|
-
|
|
33801
|
-
|
|
33802
|
-
JSON.stringify(
|
|
33779
|
+
record2.event,
|
|
33780
|
+
record2.commandId,
|
|
33781
|
+
record2.sessionId,
|
|
33782
|
+
JSON.stringify(record2.details ?? {})
|
|
33803
33783
|
);
|
|
33804
33784
|
}
|
|
33805
33785
|
close() {
|
|
@@ -33817,7 +33797,7 @@ var LocalAuthorizationError = class extends Error {
|
|
|
33817
33797
|
};
|
|
33818
33798
|
|
|
33819
33799
|
// src/pairing/pair-local-machine.ts
|
|
33820
|
-
import { mkdir as
|
|
33800
|
+
import { mkdir as mkdir5, realpath as realpath7, stat as stat6 } from "node:fs/promises";
|
|
33821
33801
|
import { hostname as hostname3 } from "node:os";
|
|
33822
33802
|
import { basename as basename3, resolve as resolve5 } from "node:path";
|
|
33823
33803
|
import { fetch as fetch2 } from "undici";
|
|
@@ -34471,34 +34451,48 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
34471
34451
|
};
|
|
34472
34452
|
|
|
34473
34453
|
// src/agent-catalog/agents/deepseek-harness-agent.ts
|
|
34474
|
-
import { realpath as realpath4, stat as stat4 } from "node:fs/promises";
|
|
34454
|
+
import { mkdir as mkdir2, realpath as realpath4, stat as stat4, writeFile } from "node:fs/promises";
|
|
34475
34455
|
import { isAbsolute as isAbsolute4, join as join7, normalize as normalize2 } from "node:path";
|
|
34476
34456
|
|
|
34477
34457
|
// src/agent-installation/deepseek-managed-package.ts
|
|
34478
34458
|
var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
|
|
34479
|
-
dependencyResolutionArguments = Object.freeze(["--before=2026-09-
|
|
34459
|
+
dependencyResolutionArguments = Object.freeze(["--before=2026-09-18T00:00:00.000Z"]);
|
|
34480
34460
|
includeOptionalDependencies = true;
|
|
34481
34461
|
verifyDependencyClosure = true;
|
|
34482
34462
|
};
|
|
34483
34463
|
var DEEPSEEK_HARNESS_PACKAGE = new DeepSeekHarnessManagedPackage(
|
|
34484
34464
|
"@deepseek-ai/dsh",
|
|
34485
|
-
"0.1.
|
|
34465
|
+
"0.1.5-rc.2",
|
|
34486
34466
|
"dsh",
|
|
34487
|
-
"sha512-
|
|
34488
|
-
"https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.
|
|
34467
|
+
"sha512-8Xc8hCQHcIWRmTCVU/xZdp6/qMsWMeAd2ObChKDEsfhUPJFXx6H0lgeb1DxUMD86HZrrVN+1bCvn1ppjZ/fOxw==",
|
|
34468
|
+
"https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.1.5-rc.2.tgz"
|
|
34489
34469
|
);
|
|
34490
34470
|
|
|
34491
34471
|
// src/agent-catalog/agents/deepseek-harness-agent.ts
|
|
34492
|
-
|
|
34472
|
+
var DEEPSEEK_HARNESS_IMAGE_PROMPT_PATCH = `# Managed by Mobius: pin the ACP bridge to an image-capable route.
|
|
34473
|
+
- id: acp
|
|
34474
|
+
config:
|
|
34475
|
+
provider: deepseek-official
|
|
34476
|
+
model: deepseek-v4-flash-vision-exp
|
|
34477
|
+
`;
|
|
34478
|
+
async function prepareAgentHome(path2, imagePrompts) {
|
|
34493
34479
|
if (!isAbsolute4(path2) || normalize2(path2) !== path2) {
|
|
34494
34480
|
throw new AgentProbeError("agent_environment_invalid", "The configured Agent home is invalid");
|
|
34495
34481
|
}
|
|
34496
34482
|
try {
|
|
34483
|
+
if (imagePrompts) {
|
|
34484
|
+
await mkdir2(path2, { mode: 448, recursive: true });
|
|
34485
|
+
}
|
|
34497
34486
|
const resolved = await realpath4(path2);
|
|
34498
34487
|
const metadata = await stat4(resolved);
|
|
34499
34488
|
if (!metadata.isDirectory() || typeof process.getuid === "function" && metadata.uid !== process.getuid()) {
|
|
34500
34489
|
throw new Error("Agent home is not a user-owned directory");
|
|
34501
34490
|
}
|
|
34491
|
+
if (imagePrompts) {
|
|
34492
|
+
await writeFile(join7(resolved, "cordis.patch.yml"), DEEPSEEK_HARNESS_IMAGE_PROMPT_PATCH, {
|
|
34493
|
+
mode: 384
|
|
34494
|
+
});
|
|
34495
|
+
}
|
|
34502
34496
|
return resolved;
|
|
34503
34497
|
} catch (error62) {
|
|
34504
34498
|
if (error62 instanceof AgentProbeError) {
|
|
@@ -34533,6 +34527,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
34533
34527
|
}
|
|
34534
34528
|
createLaunchEnvironment = async (agent, context) => {
|
|
34535
34529
|
let selectedHome = context.environment["DSH_HOME"];
|
|
34530
|
+
let managedHome = false;
|
|
34536
34531
|
try {
|
|
34537
34532
|
const managed = await this.resolveManagedAgent(
|
|
34538
34533
|
readStateDirectory(context.environment),
|
|
@@ -34541,6 +34536,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
34541
34536
|
);
|
|
34542
34537
|
if (managed.path === agent.path) {
|
|
34543
34538
|
selectedHome = join7(readStateDirectory(context.environment), "agents", this.id, "home");
|
|
34539
|
+
managedHome = true;
|
|
34544
34540
|
}
|
|
34545
34541
|
} catch {
|
|
34546
34542
|
context.signal.throwIfAborted();
|
|
@@ -34549,7 +34545,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
34549
34545
|
return Object.freeze({});
|
|
34550
34546
|
}
|
|
34551
34547
|
return Object.freeze({
|
|
34552
|
-
DSH_HOME: await
|
|
34548
|
+
DSH_HOME: await prepareAgentHome(selectedHome, managedHome)
|
|
34553
34549
|
});
|
|
34554
34550
|
};
|
|
34555
34551
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
@@ -34564,8 +34560,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
34564
34560
|
verifyAcp = (_connection, initialized, _defaultWorkspace, _signal) => {
|
|
34565
34561
|
const capabilities = initialized.agentCapabilities ?? {};
|
|
34566
34562
|
const session = capabilities.sessionCapabilities;
|
|
34567
|
-
|
|
34568
|
-
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) {
|
|
34563
|
+
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) {
|
|
34569
34564
|
throw new AgentProbeError(
|
|
34570
34565
|
"acp_incompatible",
|
|
34571
34566
|
"DeepSeek Harness reported an unsupported ACP capability set"
|
|
@@ -34776,7 +34771,7 @@ import { join as join10 } from "node:path";
|
|
|
34776
34771
|
// src/agent-installation/managed-agent-archive.ts
|
|
34777
34772
|
import { createHash } from "node:crypto";
|
|
34778
34773
|
import { createReadStream } from "node:fs";
|
|
34779
|
-
import { chmod, copyFile, mkdir as
|
|
34774
|
+
import { chmod, copyFile, mkdir as mkdir3, mkdtemp as mkdtemp2, open as open4, realpath as realpath6, rename as rename2, rm as rm2, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
|
|
34780
34775
|
import { delimiter as delimiter2, dirname as dirname4, isAbsolute as isAbsolute6, join as join9, relative as relative3, sep as sep3 } from "node:path";
|
|
34781
34776
|
|
|
34782
34777
|
// src/agent-installation/verified-download.ts
|
|
@@ -35814,7 +35809,7 @@ async function discoverLocalAgentInventory(options) {
|
|
|
35814
35809
|
|
|
35815
35810
|
// src/storage/runtime-installation-store.ts
|
|
35816
35811
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
35817
|
-
import { mkdir as
|
|
35812
|
+
import { mkdir as mkdir4, open as open5, rename as rename3, unlink, writeFile as writeFile3 } from "node:fs/promises";
|
|
35818
35813
|
import { dirname as dirname5, join as join15, resolve as resolve4 } from "node:path";
|
|
35819
35814
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
35820
35815
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
@@ -36117,9 +36112,9 @@ async function writeJsonAtomically(path2, value, signal) {
|
|
|
36117
36112
|
const directory = dirname5(path2);
|
|
36118
36113
|
const temporaryPath = join15(directory, `.${randomUUID()}.tmp`);
|
|
36119
36114
|
try {
|
|
36120
|
-
await
|
|
36115
|
+
await mkdir4(directory, { mode: 448, recursive: true });
|
|
36121
36116
|
signal.throwIfAborted();
|
|
36122
|
-
await
|
|
36117
|
+
await writeFile3(temporaryPath, `${JSON.stringify(value, null, 2)}
|
|
36123
36118
|
`, { flag: "wx", mode: 384 });
|
|
36124
36119
|
signal.throwIfAborted();
|
|
36125
36120
|
await rename3(temporaryPath, path2);
|
|
@@ -36150,7 +36145,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
36150
36145
|
const rootDirectory = resolve4(options.stateDirectory);
|
|
36151
36146
|
const applicationDirectory = join15(rootDirectory, "installations", applicationId);
|
|
36152
36147
|
try {
|
|
36153
|
-
await
|
|
36148
|
+
await mkdir4(applicationDirectory, { mode: 448, recursive: true });
|
|
36154
36149
|
} catch (cause) {
|
|
36155
36150
|
throw new RuntimeInstallationStoreError(
|
|
36156
36151
|
"installation_unavailable",
|
|
@@ -36163,7 +36158,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
36163
36158
|
const storedInstallationId = await readOrCreateInstallationId(applicationDirectory, signal);
|
|
36164
36159
|
const stateDirectory = join15(applicationDirectory, storedInstallationId);
|
|
36165
36160
|
try {
|
|
36166
|
-
await
|
|
36161
|
+
await mkdir4(stateDirectory, { mode: 448, recursive: true });
|
|
36167
36162
|
} catch (cause) {
|
|
36168
36163
|
throw new RuntimeInstallationStoreError(
|
|
36169
36164
|
"installation_unavailable",
|
|
@@ -36319,7 +36314,7 @@ async function readOrCreateInstallationId(applicationDirectory, signal) {
|
|
|
36319
36314
|
}
|
|
36320
36315
|
const candidate = installationId();
|
|
36321
36316
|
try {
|
|
36322
|
-
await
|
|
36317
|
+
await writeFile3(pointerPath, `${JSON.stringify({ installationId: candidate, version: 1 })}
|
|
36323
36318
|
`, {
|
|
36324
36319
|
flag: "wx",
|
|
36325
36320
|
mode: 384
|
|
@@ -36483,7 +36478,7 @@ function parseResumeArgument(arguments_) {
|
|
|
36483
36478
|
async function resolveDefaultWorkspace(path2) {
|
|
36484
36479
|
const requestedWorkspace = resolve5(path2);
|
|
36485
36480
|
try {
|
|
36486
|
-
await
|
|
36481
|
+
await mkdir5(requestedWorkspace, { recursive: true, mode: 448 });
|
|
36487
36482
|
const defaultWorkspace = await realpath7(requestedWorkspace);
|
|
36488
36483
|
const metadata = await stat6(defaultWorkspace);
|
|
36489
36484
|
if (!metadata.isDirectory()) {
|
|
@@ -36705,10 +36700,10 @@ function isRuntimeRelayRevocation(closeCode, closeReason) {
|
|
|
36705
36700
|
}
|
|
36706
36701
|
|
|
36707
36702
|
// src/run-daemon.ts
|
|
36708
|
-
import { createHash as
|
|
36703
|
+
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
36709
36704
|
import { basename as basename7 } from "node:path";
|
|
36710
36705
|
import { styleText } from "node:util";
|
|
36711
|
-
import { fetch as
|
|
36706
|
+
import { fetch as fetch5, WebSocket as WebSocket2 } from "undici";
|
|
36712
36707
|
|
|
36713
36708
|
// src/agent-catalog/agent-settings-adapter.ts
|
|
36714
36709
|
var AGENT_DEFAULT_VALUE = "agent_default";
|
|
@@ -37566,391 +37561,6 @@ async function streamLocalFile(command, send2, signal) {
|
|
|
37566
37561
|
});
|
|
37567
37562
|
}
|
|
37568
37563
|
|
|
37569
|
-
// src/artifacts/runtime-artifact-uploader.ts
|
|
37570
|
-
import { createHash as createHash3 } from "node:crypto";
|
|
37571
|
-
|
|
37572
|
-
// ../mobius-sdk/src/errors.ts
|
|
37573
|
-
var MobiusError = class extends Error {
|
|
37574
|
-
code;
|
|
37575
|
-
constructor(code, message, options = {}) {
|
|
37576
|
-
super(message, options);
|
|
37577
|
-
this.code = code;
|
|
37578
|
-
this.name = "MobiusError";
|
|
37579
|
-
}
|
|
37580
|
-
};
|
|
37581
|
-
var MobiusProtocolError = class extends MobiusError {
|
|
37582
|
-
constructor(message, options = {}) {
|
|
37583
|
-
super("invalid_service_response", message, options);
|
|
37584
|
-
this.name = "MobiusProtocolError";
|
|
37585
|
-
}
|
|
37586
|
-
};
|
|
37587
|
-
var MobiusValidationError = class extends MobiusError {
|
|
37588
|
-
constructor(message, options = {}) {
|
|
37589
|
-
super("invalid_request", message, options);
|
|
37590
|
-
this.name = "MobiusValidationError";
|
|
37591
|
-
}
|
|
37592
|
-
};
|
|
37593
|
-
|
|
37594
|
-
// ../mobius-sdk/src/resources.ts
|
|
37595
|
-
var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
37596
|
-
function invalidResponse(message) {
|
|
37597
|
-
return new MobiusProtocolError(message);
|
|
37598
|
-
}
|
|
37599
|
-
function isRecord11(value) {
|
|
37600
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37601
|
-
}
|
|
37602
|
-
function record2(value, name) {
|
|
37603
|
-
if (!isRecord11(value)) {
|
|
37604
|
-
throw invalidResponse(`The service returned an invalid ${name}`);
|
|
37605
|
-
}
|
|
37606
|
-
return value;
|
|
37607
|
-
}
|
|
37608
|
-
function stringField(value, field, maximumLength = 85e5) {
|
|
37609
|
-
const candidate = value[field];
|
|
37610
|
-
if (typeof candidate !== "string" || candidate.length > maximumLength) {
|
|
37611
|
-
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
37612
|
-
}
|
|
37613
|
-
return candidate;
|
|
37614
|
-
}
|
|
37615
|
-
function identifierField(value, field) {
|
|
37616
|
-
const candidate = stringField(value, field, 128);
|
|
37617
|
-
if (!IDENTIFIER_PATTERN6.test(candidate)) {
|
|
37618
|
-
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
37619
|
-
}
|
|
37620
|
-
return candidate;
|
|
37621
|
-
}
|
|
37622
|
-
function integerField(value, field) {
|
|
37623
|
-
const candidate = value[field];
|
|
37624
|
-
if (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0) {
|
|
37625
|
-
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
37626
|
-
}
|
|
37627
|
-
return candidate;
|
|
37628
|
-
}
|
|
37629
|
-
function validateTimestamp(value, field) {
|
|
37630
|
-
if (Number.isNaN(Date.parse(value))) {
|
|
37631
|
-
throw invalidResponse(`The service returned an invalid ${field}`);
|
|
37632
|
-
}
|
|
37633
|
-
return value;
|
|
37634
|
-
}
|
|
37635
|
-
var MobiusArtifactUploadRequest = class {
|
|
37636
|
-
byteLength;
|
|
37637
|
-
mediaType;
|
|
37638
|
-
name;
|
|
37639
|
-
sha256;
|
|
37640
|
-
constructor(name, mediaType, byteLength, sha256) {
|
|
37641
|
-
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)) {
|
|
37642
|
-
throw new MobiusValidationError("The artifact upload request is invalid");
|
|
37643
|
-
}
|
|
37644
|
-
this.byteLength = byteLength;
|
|
37645
|
-
this.mediaType = mediaType;
|
|
37646
|
-
this.name = name;
|
|
37647
|
-
this.sha256 = sha256;
|
|
37648
|
-
}
|
|
37649
|
-
};
|
|
37650
|
-
var MobiusArtifact = class {
|
|
37651
|
-
artifactId;
|
|
37652
|
-
byteLength;
|
|
37653
|
-
createdAt;
|
|
37654
|
-
mediaType;
|
|
37655
|
-
name;
|
|
37656
|
-
sessionId;
|
|
37657
|
-
sha256;
|
|
37658
|
-
constructor(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt) {
|
|
37659
|
-
this.artifactId = artifactId;
|
|
37660
|
-
this.byteLength = byteLength;
|
|
37661
|
-
this.createdAt = createdAt;
|
|
37662
|
-
this.mediaType = mediaType;
|
|
37663
|
-
this.name = name;
|
|
37664
|
-
this.sessionId = sessionId;
|
|
37665
|
-
this.sha256 = sha256;
|
|
37666
|
-
}
|
|
37667
|
-
};
|
|
37668
|
-
var MobiusUploadingArtifact = class extends MobiusArtifact {
|
|
37669
|
-
expiresAt;
|
|
37670
|
-
state = "uploading";
|
|
37671
|
-
constructor(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt, expiresAt) {
|
|
37672
|
-
super(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt);
|
|
37673
|
-
this.expiresAt = expiresAt;
|
|
37674
|
-
}
|
|
37675
|
-
};
|
|
37676
|
-
var MobiusArtifactUpload = class extends MobiusUploadingArtifact {
|
|
37677
|
-
uploadToken;
|
|
37678
|
-
constructor(artifact, uploadToken) {
|
|
37679
|
-
super(
|
|
37680
|
-
artifact.sessionId,
|
|
37681
|
-
artifact.artifactId,
|
|
37682
|
-
artifact.name,
|
|
37683
|
-
artifact.mediaType,
|
|
37684
|
-
artifact.byteLength,
|
|
37685
|
-
artifact.sha256,
|
|
37686
|
-
artifact.createdAt,
|
|
37687
|
-
artifact.expiresAt
|
|
37688
|
-
);
|
|
37689
|
-
this.uploadToken = uploadToken;
|
|
37690
|
-
}
|
|
37691
|
-
};
|
|
37692
|
-
var MobiusAvailableArtifact = class extends MobiusArtifact {
|
|
37693
|
-
availableAt;
|
|
37694
|
-
state = "available";
|
|
37695
|
-
constructor(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt, availableAt) {
|
|
37696
|
-
super(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt);
|
|
37697
|
-
this.availableAt = availableAt;
|
|
37698
|
-
}
|
|
37699
|
-
};
|
|
37700
|
-
var MobiusExpiredArtifact = class extends MobiusArtifact {
|
|
37701
|
-
expiredAt;
|
|
37702
|
-
state = "expired";
|
|
37703
|
-
constructor(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt, expiredAt) {
|
|
37704
|
-
super(sessionId, artifactId, name, mediaType, byteLength, sha256, createdAt);
|
|
37705
|
-
this.expiredAt = expiredAt;
|
|
37706
|
-
}
|
|
37707
|
-
};
|
|
37708
|
-
function artifactFields(value) {
|
|
37709
|
-
const sha256 = stringField(value, "sha256", 64);
|
|
37710
|
-
if (!/^[a-f0-9]{64}$/.test(sha256)) {
|
|
37711
|
-
throw invalidResponse("The service returned an invalid artifact digest");
|
|
37712
|
-
}
|
|
37713
|
-
return {
|
|
37714
|
-
artifactId: identifierField(value, "artifactId"),
|
|
37715
|
-
byteLength: integerField(value, "byteLength"),
|
|
37716
|
-
createdAt: validateTimestamp(stringField(value, "createdAt", 128), "createdAt"),
|
|
37717
|
-
mediaType: stringField(value, "mediaType", 255),
|
|
37718
|
-
name: stringField(value, "name", 500),
|
|
37719
|
-
sessionId: identifierField(value, "sessionId"),
|
|
37720
|
-
sha256
|
|
37721
|
-
};
|
|
37722
|
-
}
|
|
37723
|
-
function uploadingArtifact(value) {
|
|
37724
|
-
const fields = artifactFields(value);
|
|
37725
|
-
return new MobiusUploadingArtifact(
|
|
37726
|
-
fields.sessionId,
|
|
37727
|
-
fields.artifactId,
|
|
37728
|
-
fields.name,
|
|
37729
|
-
fields.mediaType,
|
|
37730
|
-
fields.byteLength,
|
|
37731
|
-
fields.sha256,
|
|
37732
|
-
fields.createdAt,
|
|
37733
|
-
validateTimestamp(stringField(value, "expiresAt", 128), "expiresAt")
|
|
37734
|
-
);
|
|
37735
|
-
}
|
|
37736
|
-
function decodeMobiusArtifactUpload(value) {
|
|
37737
|
-
const artifact = record2(value, "artifact upload authorization");
|
|
37738
|
-
return new MobiusArtifactUpload(uploadingArtifact(artifact), stringField(artifact, "uploadToken", 256));
|
|
37739
|
-
}
|
|
37740
|
-
function decodeMobiusArtifact(value) {
|
|
37741
|
-
const artifact = record2(value, "artifact");
|
|
37742
|
-
const state = stringField(artifact, "state", 32);
|
|
37743
|
-
if (state === "uploading") {
|
|
37744
|
-
return uploadingArtifact(artifact);
|
|
37745
|
-
}
|
|
37746
|
-
const fields = artifactFields(artifact);
|
|
37747
|
-
if (state === "available") {
|
|
37748
|
-
return new MobiusAvailableArtifact(
|
|
37749
|
-
fields.sessionId,
|
|
37750
|
-
fields.artifactId,
|
|
37751
|
-
fields.name,
|
|
37752
|
-
fields.mediaType,
|
|
37753
|
-
fields.byteLength,
|
|
37754
|
-
fields.sha256,
|
|
37755
|
-
fields.createdAt,
|
|
37756
|
-
validateTimestamp(stringField(artifact, "availableAt", 128), "availableAt")
|
|
37757
|
-
);
|
|
37758
|
-
}
|
|
37759
|
-
if (state === "expired") {
|
|
37760
|
-
return new MobiusExpiredArtifact(
|
|
37761
|
-
fields.sessionId,
|
|
37762
|
-
fields.artifactId,
|
|
37763
|
-
fields.name,
|
|
37764
|
-
fields.mediaType,
|
|
37765
|
-
fields.byteLength,
|
|
37766
|
-
fields.sha256,
|
|
37767
|
-
fields.createdAt,
|
|
37768
|
-
validateTimestamp(stringField(artifact, "expiredAt", 128), "expiredAt")
|
|
37769
|
-
);
|
|
37770
|
-
}
|
|
37771
|
-
throw invalidResponse("The service returned an invalid artifact state");
|
|
37772
|
-
}
|
|
37773
|
-
function decodeMobiusAvailableArtifact(value) {
|
|
37774
|
-
const artifact = decodeMobiusArtifact(value);
|
|
37775
|
-
if (!(artifact instanceof MobiusAvailableArtifact)) {
|
|
37776
|
-
throw invalidResponse("The service did not make the artifact available");
|
|
37777
|
-
}
|
|
37778
|
-
return artifact;
|
|
37779
|
-
}
|
|
37780
|
-
var MobiusRuntimePairingLifecycle = Object.freeze({
|
|
37781
|
-
Expired: "expired",
|
|
37782
|
-
Paired: "paired",
|
|
37783
|
-
Pending: "pending",
|
|
37784
|
-
Revoked: "revoked"
|
|
37785
|
-
});
|
|
37786
|
-
|
|
37787
|
-
// src/artifacts/runtime-artifact-uploader.ts
|
|
37788
|
-
import { fetch as fetch4 } from "undici";
|
|
37789
|
-
var UPLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
37790
|
-
var RuntimeArtifactUploadError = class extends Error {
|
|
37791
|
-
code;
|
|
37792
|
-
constructor(code, message, options = {}) {
|
|
37793
|
-
super(message, options);
|
|
37794
|
-
this.code = code;
|
|
37795
|
-
this.name = "RuntimeArtifactUploadError";
|
|
37796
|
-
}
|
|
37797
|
-
};
|
|
37798
|
-
var UploadedRuntimeArtifact = class {
|
|
37799
|
-
artifactId;
|
|
37800
|
-
byteLength;
|
|
37801
|
-
mimeType;
|
|
37802
|
-
name;
|
|
37803
|
-
sha256;
|
|
37804
|
-
constructor(artifactId, name, mimeType, byteLength, sha256) {
|
|
37805
|
-
this.artifactId = artifactId;
|
|
37806
|
-
this.byteLength = byteLength;
|
|
37807
|
-
this.mimeType = mimeType;
|
|
37808
|
-
this.name = name;
|
|
37809
|
-
this.sha256 = sha256;
|
|
37810
|
-
}
|
|
37811
|
-
};
|
|
37812
|
-
function channelOrigin(config2) {
|
|
37813
|
-
const url2 = new URL(config2.relayUrl);
|
|
37814
|
-
url2.protocol = url2.protocol === "wss:" ? "https:" : "http:";
|
|
37815
|
-
let channelPath = "";
|
|
37816
|
-
if (url2.pathname.endsWith("/daemon")) {
|
|
37817
|
-
channelPath = url2.pathname.slice(0, -"/daemon".length);
|
|
37818
|
-
} else {
|
|
37819
|
-
const runtimePath = `${MOBIUS_API_PREFIX}/v1/runtimes/connect`;
|
|
37820
|
-
if (!url2.pathname.endsWith("/v1/runtimes/connect") && !url2.pathname.endsWith(runtimePath)) {
|
|
37821
|
-
throw new RuntimeArtifactUploadError("artifact_endpoint_invalid", "The Relay artifact endpoint is invalid");
|
|
37822
|
-
}
|
|
37823
|
-
channelPath = `${url2.pathname.replace(/\/v1\/runtimes\/connect$/, "")}/channels/${encodeURIComponent(config2.channelId)}`;
|
|
37824
|
-
}
|
|
37825
|
-
url2.pathname = channelPath;
|
|
37826
|
-
url2.search = "";
|
|
37827
|
-
url2.hash = "";
|
|
37828
|
-
return url2;
|
|
37829
|
-
}
|
|
37830
|
-
function uploadError(code, message, cause) {
|
|
37831
|
-
return new RuntimeArtifactUploadError(code, message, cause === void 0 ? {} : { cause });
|
|
37832
|
-
}
|
|
37833
|
-
function translateSdkError(cause) {
|
|
37834
|
-
if (cause instanceof MobiusValidationError) {
|
|
37835
|
-
throw uploadError("artifact_upload_failed", cause.message, cause);
|
|
37836
|
-
}
|
|
37837
|
-
if (cause instanceof MobiusProtocolError) {
|
|
37838
|
-
throw uploadError("artifact_upload_failed", "The Relay returned an invalid upload response", cause);
|
|
37839
|
-
}
|
|
37840
|
-
throw cause;
|
|
37841
|
-
}
|
|
37842
|
-
async function readJson(response) {
|
|
37843
|
-
try {
|
|
37844
|
-
return await response.json();
|
|
37845
|
-
} catch (cause) {
|
|
37846
|
-
throw uploadError("artifact_upload_failed", "The Relay returned an invalid upload response", cause);
|
|
37847
|
-
}
|
|
37848
|
-
}
|
|
37849
|
-
async function readAuthorization(response) {
|
|
37850
|
-
try {
|
|
37851
|
-
return decodeMobiusArtifactUpload(await readJson(response));
|
|
37852
|
-
} catch (cause) {
|
|
37853
|
-
translateSdkError(cause);
|
|
37854
|
-
}
|
|
37855
|
-
}
|
|
37856
|
-
function sessionArtifactUrl(origin, sessionId, resourcePath) {
|
|
37857
|
-
return new URL(`${origin.pathname}/sessions/${encodeURIComponent(sessionId)}/${resourcePath}`, origin);
|
|
37858
|
-
}
|
|
37859
|
-
async function postLease(url2, headers, request, signal) {
|
|
37860
|
-
return await fetch4(url2, {
|
|
37861
|
-
dispatcher: environmentProxyDispatcher,
|
|
37862
|
-
headers: { ...headers, "content-type": "application/json" },
|
|
37863
|
-
method: "POST",
|
|
37864
|
-
body: JSON.stringify(request),
|
|
37865
|
-
signal
|
|
37866
|
-
});
|
|
37867
|
-
}
|
|
37868
|
-
async function putContent(url2, headers, authorization, bytes, signal) {
|
|
37869
|
-
return await fetch4(url2, {
|
|
37870
|
-
dispatcher: environmentProxyDispatcher,
|
|
37871
|
-
headers: {
|
|
37872
|
-
...headers,
|
|
37873
|
-
"content-type": authorization.mediaType,
|
|
37874
|
-
"x-mobius-upload-token": authorization.uploadToken
|
|
37875
|
-
},
|
|
37876
|
-
method: "PUT",
|
|
37877
|
-
body: bytes,
|
|
37878
|
-
signal
|
|
37879
|
-
});
|
|
37880
|
-
}
|
|
37881
|
-
async function uploadRuntimeArtifact(config2, sessionId, artifact, signal) {
|
|
37882
|
-
signal.throwIfAborted();
|
|
37883
|
-
let request;
|
|
37884
|
-
try {
|
|
37885
|
-
request = new MobiusArtifactUploadRequest(
|
|
37886
|
-
artifact.name,
|
|
37887
|
-
artifact.mimeType,
|
|
37888
|
-
artifact.bytes.byteLength,
|
|
37889
|
-
createHash3("sha256").update(artifact.bytes).digest("hex")
|
|
37890
|
-
);
|
|
37891
|
-
} catch (cause) {
|
|
37892
|
-
translateSdkError(cause);
|
|
37893
|
-
}
|
|
37894
|
-
const timeoutSignal = AbortSignal.timeout(UPLOAD_TIMEOUT_MILLISECONDS);
|
|
37895
|
-
const requestSignal = AbortSignal.any([signal, timeoutSignal]);
|
|
37896
|
-
const origin = channelOrigin(config2);
|
|
37897
|
-
const headers = runtimeAuthorization(config2.relayUrl);
|
|
37898
|
-
let created;
|
|
37899
|
-
try {
|
|
37900
|
-
created = await postLease(
|
|
37901
|
-
sessionArtifactUrl(origin, sessionId, "artifacts/uploads"),
|
|
37902
|
-
headers,
|
|
37903
|
-
request,
|
|
37904
|
-
requestSignal
|
|
37905
|
-
);
|
|
37906
|
-
} catch (cause) {
|
|
37907
|
-
signal.throwIfAborted();
|
|
37908
|
-
throw uploadError(
|
|
37909
|
-
timeoutSignal.aborted ? "artifact_upload_timeout" : "artifact_upload_failed",
|
|
37910
|
-
timeoutSignal.aborted ? "The artifact upload authorization timed out" : "The artifact upload could not start",
|
|
37911
|
-
cause
|
|
37912
|
-
);
|
|
37913
|
-
}
|
|
37914
|
-
if (!created.ok) {
|
|
37915
|
-
await created.body?.cancel();
|
|
37916
|
-
throw uploadError("artifact_upload_rejected", "The Relay rejected the artifact upload");
|
|
37917
|
-
}
|
|
37918
|
-
const authorization = await readAuthorization(created);
|
|
37919
|
-
let uploaded;
|
|
37920
|
-
try {
|
|
37921
|
-
uploaded = await putContent(
|
|
37922
|
-
sessionArtifactUrl(origin, sessionId, `artifacts/${encodeURIComponent(authorization.artifactId)}/content`),
|
|
37923
|
-
headers,
|
|
37924
|
-
authorization,
|
|
37925
|
-
artifact.bytes,
|
|
37926
|
-
requestSignal
|
|
37927
|
-
);
|
|
37928
|
-
} catch (cause) {
|
|
37929
|
-
signal.throwIfAborted();
|
|
37930
|
-
throw uploadError(
|
|
37931
|
-
timeoutSignal.aborted ? "artifact_upload_timeout" : "artifact_upload_failed",
|
|
37932
|
-
timeoutSignal.aborted ? "The artifact upload timed out" : "The artifact content could not be uploaded",
|
|
37933
|
-
cause
|
|
37934
|
-
);
|
|
37935
|
-
}
|
|
37936
|
-
if (!uploaded.ok) {
|
|
37937
|
-
await uploaded.body?.cancel();
|
|
37938
|
-
throw uploadError("artifact_upload_rejected", "The Relay rejected the artifact content");
|
|
37939
|
-
}
|
|
37940
|
-
try {
|
|
37941
|
-
const available = decodeMobiusAvailableArtifact(await readJson(uploaded));
|
|
37942
|
-
return new UploadedRuntimeArtifact(
|
|
37943
|
-
available.artifactId,
|
|
37944
|
-
available.name,
|
|
37945
|
-
available.mediaType,
|
|
37946
|
-
available.byteLength,
|
|
37947
|
-
available.sha256
|
|
37948
|
-
);
|
|
37949
|
-
} catch (cause) {
|
|
37950
|
-
translateSdkError(cause);
|
|
37951
|
-
}
|
|
37952
|
-
}
|
|
37953
|
-
|
|
37954
37564
|
// src/authorization/workspace-directory.ts
|
|
37955
37565
|
import { readdir as readdir2, realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
37956
37566
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -38770,13 +38380,13 @@ var NativeSessionService = class {
|
|
|
38770
38380
|
};
|
|
38771
38381
|
|
|
38772
38382
|
// src/prompt-artifact-resolver.ts
|
|
38773
|
-
import { createHash as
|
|
38774
|
-
import { fetch as
|
|
38383
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
38384
|
+
import { fetch as fetch4 } from "undici";
|
|
38775
38385
|
var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
38776
38386
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
38777
38387
|
var MAX_AGENT_IMAGE_BASE64_LENGTH = 4e6;
|
|
38778
38388
|
var MAX_AGENT_RESOURCE_BYTE_LENGTH = 1e6;
|
|
38779
|
-
var
|
|
38389
|
+
var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
38780
38390
|
var PromptArtifactError = class extends Error {
|
|
38781
38391
|
code;
|
|
38782
38392
|
constructor(code, message, options = {}) {
|
|
@@ -38819,7 +38429,7 @@ function parseReference(resource) {
|
|
|
38819
38429
|
const encodedByteLength2 = url2.searchParams.get("byteLength") ?? "";
|
|
38820
38430
|
const sha256 = url2.searchParams.get("sha256") ?? "";
|
|
38821
38431
|
const byteLength = Number(encodedByteLength2);
|
|
38822
|
-
if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !
|
|
38432
|
+
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)) {
|
|
38823
38433
|
throw new PromptArtifactError("artifact_reference_invalid", "The prompt artifact reference is invalid");
|
|
38824
38434
|
}
|
|
38825
38435
|
return new PromptArtifactReference(artifactId, byteLength, sha256, resource);
|
|
@@ -38885,7 +38495,7 @@ async function download(config2, command, reference, signal) {
|
|
|
38885
38495
|
const requestSignal = AbortSignal.any([signal, timeoutSignal]);
|
|
38886
38496
|
let response;
|
|
38887
38497
|
try {
|
|
38888
|
-
response = await
|
|
38498
|
+
response = await fetch4(downloadUrl(config2, command, reference), {
|
|
38889
38499
|
dispatcher: environmentProxyDispatcher,
|
|
38890
38500
|
headers: {
|
|
38891
38501
|
accept: reference.resource.mimeType,
|
|
@@ -38909,7 +38519,7 @@ async function download(config2, command, reference, signal) {
|
|
|
38909
38519
|
);
|
|
38910
38520
|
}
|
|
38911
38521
|
const bytes = await responseBytes(response, reference.byteLength, requestSignal);
|
|
38912
|
-
if (
|
|
38522
|
+
if (createHash3("sha256").update(bytes).digest("hex") !== reference.sha256) {
|
|
38913
38523
|
throw new PromptArtifactError(
|
|
38914
38524
|
"artifact_integrity_failed",
|
|
38915
38525
|
"The prompt artifact failed integrity validation"
|
|
@@ -39994,13 +39604,10 @@ var AGENT_TEXT_MAXIMUM_LENGTH = 1e5;
|
|
|
39994
39604
|
var ACTIVE_TURN_RECONCILIATION_TIMEOUT_MILLISECONDS = 2e4;
|
|
39995
39605
|
var ACTIVE_TURN_RECONCILIATION_CLOSE_CODE = 4009;
|
|
39996
39606
|
var DaemonAcpObserver = class {
|
|
39997
|
-
#config;
|
|
39998
39607
|
#record;
|
|
39999
|
-
constructor(
|
|
40000
|
-
this.#
|
|
40001
|
-
this.#record = record3;
|
|
39608
|
+
constructor(record2) {
|
|
39609
|
+
this.#record = record2;
|
|
40002
39610
|
}
|
|
40003
|
-
importLocalArtifact = async (sessionId, artifact, signal) => (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
40004
39611
|
onCommands = (event) => {
|
|
40005
39612
|
this.#record(event.sessionId, event);
|
|
40006
39613
|
return Promise.resolve();
|
|
@@ -40218,7 +39825,7 @@ async function reconcileActiveTurn(config2, turn, signal) {
|
|
|
40218
39825
|
const requestSignal = AbortSignal.any([signal, timeoutSignal]);
|
|
40219
39826
|
let response;
|
|
40220
39827
|
try {
|
|
40221
|
-
response = await
|
|
39828
|
+
response = await fetch5(activeTurnReconciliationEndpoint(config2, turn), {
|
|
40222
39829
|
body: JSON.stringify({ outcome: { kind: "running" } }),
|
|
40223
39830
|
dispatcher: environmentProxyDispatcher,
|
|
40224
39831
|
headers: { ...runtimeAuthorization(config2.relayUrl), "content-type": "application/json" },
|
|
@@ -40728,7 +40335,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
40728
40335
|
resolution: modelEffort.resolution,
|
|
40729
40336
|
valuesByModel: {}
|
|
40730
40337
|
};
|
|
40731
|
-
return
|
|
40338
|
+
return createHash4("sha256").update(
|
|
40732
40339
|
JSON.stringify({
|
|
40733
40340
|
adapterVersion: agent.adapterVersion,
|
|
40734
40341
|
agentId: agent.id,
|
|
@@ -42281,7 +41888,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42281
41888
|
}
|
|
42282
41889
|
publisher.recordAttempt(sessionId, event, attemptId);
|
|
42283
41890
|
};
|
|
42284
|
-
const sessions = new AcpSessionManager(new DaemonAcpObserver(
|
|
41891
|
+
const sessions = new AcpSessionManager(new DaemonAcpObserver(recordSessionEvent), sessionStore);
|
|
42285
41892
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|
|
42286
41893
|
const installationObserver = new DaemonInstallationObserver();
|
|
42287
41894
|
const diagnostics = new RelayConnectionDiagnostics(audit, config2.channelId, config2.relayUrl);
|
|
@@ -42416,9 +42023,9 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42416
42023
|
}
|
|
42417
42024
|
|
|
42418
42025
|
// src/runtime.ts
|
|
42419
|
-
import { mkdir as
|
|
42026
|
+
import { mkdir as mkdir6, realpath as realpath10, stat as stat9 } from "node:fs/promises";
|
|
42420
42027
|
import { dirname as dirname8, join as join17, resolve as resolve7 } from "node:path";
|
|
42421
|
-
var
|
|
42028
|
+
var IDENTIFIER_PATTERN7 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
42422
42029
|
var RUNTIME_CREDENTIAL_PATTERN2 = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
42423
42030
|
var MobiusRuntimeConfigurationError = class extends Error {
|
|
42424
42031
|
code = "runtime_configuration_invalid";
|
|
@@ -42470,7 +42077,7 @@ function relayUrlFromConnection(connection) {
|
|
|
42470
42077
|
}
|
|
42471
42078
|
function loadMobiusRuntimeConnection(environment = process.env) {
|
|
42472
42079
|
const channelId = requiredEnvironmentValue(environment, "MOBIUS_CHANNEL_ID");
|
|
42473
|
-
if (!
|
|
42080
|
+
if (!IDENTIFIER_PATTERN7.test(channelId)) {
|
|
42474
42081
|
throw new MobiusRuntimeConfigurationError("MOBIUS_CHANNEL_ID is invalid");
|
|
42475
42082
|
}
|
|
42476
42083
|
return Object.freeze({
|
|
@@ -42484,7 +42091,7 @@ function loadMobiusRuntimeConnection(environment = process.env) {
|
|
|
42484
42091
|
async function resolveWorkspace(path2) {
|
|
42485
42092
|
const requested = resolve7(path2);
|
|
42486
42093
|
try {
|
|
42487
|
-
await
|
|
42094
|
+
await mkdir6(requested, { recursive: true, mode: 448 });
|
|
42488
42095
|
const resolved = await realpath10(requested);
|
|
42489
42096
|
const metadata = await stat9(resolved);
|
|
42490
42097
|
if (!metadata.isDirectory()) {
|
|
@@ -42504,7 +42111,7 @@ async function createMobiusRuntimeEngine(connection, signal, environment = proce
|
|
|
42504
42111
|
const relayUrl = relayUrlFromConnection(connection);
|
|
42505
42112
|
const defaultWorkspace = await resolveWorkspace(connection.defaultWorkspace);
|
|
42506
42113
|
const auditDatabasePath = resolve7(connection.auditDatabasePath);
|
|
42507
|
-
await
|
|
42114
|
+
await mkdir6(dirname8(auditDatabasePath), { recursive: true, mode: 448 });
|
|
42508
42115
|
const inventory = await discoverLocalAgentInventory({
|
|
42509
42116
|
defaultWorkspace,
|
|
42510
42117
|
environment: localContext.environment,
|