@moxt-ai/mobius 0.0.45 → 0.0.47
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/markdown-images.d.ts +2 -3
- package/dist/acp/markdown-images.d.ts.map +1 -1
- package/dist/acp/markdown-images.js +15 -7
- package/dist/acp/markdown-images.js.map +1 -1
- package/dist/acp/session-manager.d.ts +4 -2
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +40 -10
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/authorization/local-raster.d.ts +1 -1
- package/dist/authorization/local-raster.d.ts.map +1 -1
- package/dist/authorization/local-raster.js +2 -21
- package/dist/authorization/local-raster.js.map +1 -1
- package/dist/cli.js +112 -72
- package/dist/cli.js.map +3 -3
- package/dist/index.js +120 -80
- package/dist/index.js.map +3 -3
- package/dist/native-sessions/codex-history.js +1 -1
- package/dist/native-sessions/codex-history.js.map +1 -1
- package/dist/native-sessions/history-images.d.ts +1 -1
- package/dist/native-sessions/history-images.d.ts.map +1 -1
- package/dist/native-sessions/history-images.js +5 -5
- package/dist/native-sessions/history-images.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +30 -23
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +111 -71
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22328,7 +22328,7 @@ import {
|
|
|
22328
22328
|
|
|
22329
22329
|
// src/authorization/local-raster.ts
|
|
22330
22330
|
import { readFile as readFile2, realpath as realpath2, stat as stat2 } from "node:fs/promises";
|
|
22331
|
-
import { basename, isAbsolute, normalize
|
|
22331
|
+
import { basename, isAbsolute, normalize } from "node:path";
|
|
22332
22332
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
22333
22333
|
var MAX_LOCAL_RASTER_BYTES = 3e6;
|
|
22334
22334
|
var PNG_SIGNATURE = Uint8Array.of(137, 80, 78, 71);
|
|
@@ -22386,10 +22386,6 @@ function readInlineRaster(data, name = "Image") {
|
|
|
22386
22386
|
}
|
|
22387
22387
|
return new LocalRasterImage(basename(name) || "Image", mimeType, bytes);
|
|
22388
22388
|
}
|
|
22389
|
-
function isInsideRoot(root, target) {
|
|
22390
|
-
const relation = relative(root, target);
|
|
22391
|
-
return relation !== ".." && !relation.startsWith(`..${sep}`) && !isAbsolute(relation);
|
|
22392
|
-
}
|
|
22393
22389
|
async function resolveCanonicalPath(requested, signal) {
|
|
22394
22390
|
signal.throwIfAborted();
|
|
22395
22391
|
if (!isAbsolute(requested) || requested.includes("\0") || normalize(requested) !== requested) {
|
|
@@ -22434,7 +22430,7 @@ function parseLocalImageUri(uri) {
|
|
|
22434
22430
|
}
|
|
22435
22431
|
return trimmed;
|
|
22436
22432
|
}
|
|
22437
|
-
async function
|
|
22433
|
+
async function readLocalRaster(uri, signal) {
|
|
22438
22434
|
signal.throwIfAborted();
|
|
22439
22435
|
const requested = parseLocalImageUri(uri);
|
|
22440
22436
|
if (requested === null) {
|
|
@@ -22449,21 +22445,6 @@ async function readAuthorizedRaster(uri, roots, signal) {
|
|
|
22449
22445
|
if (!targetMetadata.isFile() || targetMetadata.size < 1 || targetMetadata.size > MAX_LOCAL_RASTER_BYTES) {
|
|
22450
22446
|
return null;
|
|
22451
22447
|
}
|
|
22452
|
-
const authorizedRoots = [];
|
|
22453
|
-
for (const root of roots) {
|
|
22454
|
-
const directory = await resolveCanonicalPath(root, signal);
|
|
22455
|
-
if (directory === null) {
|
|
22456
|
-
continue;
|
|
22457
|
-
}
|
|
22458
|
-
const metadata = await stat2(directory);
|
|
22459
|
-
signal.throwIfAborted();
|
|
22460
|
-
if (metadata.isDirectory()) {
|
|
22461
|
-
authorizedRoots.push(directory);
|
|
22462
|
-
}
|
|
22463
|
-
}
|
|
22464
|
-
if (!authorizedRoots.some((root) => isInsideRoot(root, target))) {
|
|
22465
|
-
return null;
|
|
22466
|
-
}
|
|
22467
22448
|
const bytes = new Uint8Array(await readFile2(target));
|
|
22468
22449
|
signal.throwIfAborted();
|
|
22469
22450
|
if (bytes.byteLength < 1 || bytes.byteLength > MAX_LOCAL_RASTER_BYTES) {
|
|
@@ -22562,7 +22543,7 @@ var unmeasuredOperationMetrics = Object.freeze({
|
|
|
22562
22543
|
|
|
22563
22544
|
// src/native-sessions/history-images.ts
|
|
22564
22545
|
var IMAGE_MARKER = /\[@image\]\(([^)\r\n]*)(?:\)|$)/g;
|
|
22565
|
-
async function embedLocalHistoryImages(history,
|
|
22546
|
+
async function embedLocalHistoryImages(history, signal) {
|
|
22566
22547
|
if (history.status !== "available") {
|
|
22567
22548
|
return history;
|
|
22568
22549
|
}
|
|
@@ -22570,7 +22551,7 @@ async function embedLocalHistoryImages(history, roots, signal) {
|
|
|
22570
22551
|
let imageCharacters = 0;
|
|
22571
22552
|
for (const message of history.messages) {
|
|
22572
22553
|
signal.throwIfAborted();
|
|
22573
|
-
const resolved = await resolveMessageImages(message,
|
|
22554
|
+
const resolved = await resolveMessageImages(message, imageCharacters, signal);
|
|
22574
22555
|
imageCharacters += (resolved.images ?? []).reduce((size, image) => size + image.data.length, 0);
|
|
22575
22556
|
messages.push(resolved);
|
|
22576
22557
|
}
|
|
@@ -22579,7 +22560,7 @@ async function embedLocalHistoryImages(history, roots, signal) {
|
|
|
22579
22560
|
messages
|
|
22580
22561
|
};
|
|
22581
22562
|
}
|
|
22582
|
-
async function resolveMessageImages(message,
|
|
22563
|
+
async function resolveMessageImages(message, usedCharacters, signal) {
|
|
22583
22564
|
const images = [...message.images ?? []];
|
|
22584
22565
|
let imageCharacters = images.reduce((size, image) => size + image.data.length, 0);
|
|
22585
22566
|
const text3 = await replaceImageMarkers(message.text, async (uri) => {
|
|
@@ -22595,7 +22576,7 @@ async function resolveMessageImages(message, roots, usedCharacters, signal) {
|
|
|
22595
22576
|
imageCharacters += embedded.data.length;
|
|
22596
22577
|
return "";
|
|
22597
22578
|
}
|
|
22598
|
-
const local = await
|
|
22579
|
+
const local = await readLocalRaster(uri, signal);
|
|
22599
22580
|
if (local === null) {
|
|
22600
22581
|
return "[Image unavailable]";
|
|
22601
22582
|
}
|
|
@@ -30327,16 +30308,24 @@ function parseMarkdownImages(markdown) {
|
|
|
30327
30308
|
});
|
|
30328
30309
|
return images.sort((left, right) => left.start - right.start);
|
|
30329
30310
|
}
|
|
30330
|
-
async function
|
|
30311
|
+
async function emitMarkdownChunksWithLocalImages(options) {
|
|
30312
|
+
const markdown = options.chunks.join("");
|
|
30313
|
+
const images = parseMarkdownImages(markdown);
|
|
30314
|
+
if (images.length === 0) {
|
|
30315
|
+
for (const chunk of options.chunks) {
|
|
30316
|
+
await options.onText(chunk);
|
|
30317
|
+
}
|
|
30318
|
+
return;
|
|
30319
|
+
}
|
|
30331
30320
|
let cursor = 0;
|
|
30332
|
-
for (const image of
|
|
30321
|
+
for (const image of images) {
|
|
30333
30322
|
if (image.start < cursor) {
|
|
30334
30323
|
continue;
|
|
30335
30324
|
}
|
|
30336
30325
|
if (image.start > cursor) {
|
|
30337
|
-
await options.onText(
|
|
30326
|
+
await options.onText(markdown.slice(cursor, image.start));
|
|
30338
30327
|
}
|
|
30339
|
-
const raster = await
|
|
30328
|
+
const raster = await readLocalRaster(image.uri, options.signal);
|
|
30340
30329
|
if (raster === null) {
|
|
30341
30330
|
await options.onText("[Image unavailable]");
|
|
30342
30331
|
} else {
|
|
@@ -30344,8 +30333,8 @@ async function emitMarkdownWithLocalImages(options) {
|
|
|
30344
30333
|
}
|
|
30345
30334
|
cursor = image.end;
|
|
30346
30335
|
}
|
|
30347
|
-
if (cursor <
|
|
30348
|
-
await options.onText(
|
|
30336
|
+
if (cursor < markdown.length) {
|
|
30337
|
+
await options.onText(markdown.slice(cursor));
|
|
30349
30338
|
}
|
|
30350
30339
|
}
|
|
30351
30340
|
|
|
@@ -31687,6 +31676,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31687
31676
|
#preSessionUpdateBytes = 0;
|
|
31688
31677
|
#agentName = "";
|
|
31689
31678
|
#agentVersion = "";
|
|
31679
|
+
#bufferedAgentText = [];
|
|
31690
31680
|
#capabilities = {
|
|
31691
31681
|
additionalDirectories: false,
|
|
31692
31682
|
audioPrompt: false,
|
|
@@ -31860,26 +31850,47 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31860
31850
|
);
|
|
31861
31851
|
await this.#updateTail;
|
|
31862
31852
|
signal.throwIfAborted();
|
|
31863
|
-
return await embedLocalHistoryImages(
|
|
31864
|
-
history.snapshot(),
|
|
31865
|
-
[this.#cwd, ...this.#additionalDirectories],
|
|
31866
|
-
signal
|
|
31867
|
-
);
|
|
31853
|
+
return await embedLocalHistoryImages(history.snapshot(), signal);
|
|
31868
31854
|
} finally {
|
|
31869
31855
|
this.#replay = { kind: "idle" };
|
|
31870
31856
|
}
|
|
31871
31857
|
};
|
|
31872
|
-
|
|
31873
|
-
emitAgentText = async (text3, messageId) => {
|
|
31858
|
+
emitAgentMessage = async (chunks, messageId) => {
|
|
31874
31859
|
const signal = AbortSignal.timeout(2e4);
|
|
31875
|
-
await
|
|
31876
|
-
|
|
31860
|
+
await emitMarkdownChunksWithLocalImages({
|
|
31861
|
+
chunks,
|
|
31877
31862
|
onImage: async (image) => await this.emitRaster(image, messageId, signal),
|
|
31878
31863
|
onText: async (content3) => await this.#turn.onText(content3, messageId),
|
|
31879
|
-
roots: this.imageRoots(),
|
|
31880
31864
|
signal
|
|
31881
31865
|
});
|
|
31882
31866
|
};
|
|
31867
|
+
bufferAgentText = async (text3, messageId) => {
|
|
31868
|
+
const previous2 = this.#bufferedAgentText.at(-1);
|
|
31869
|
+
if (previous2?.messageId === messageId) {
|
|
31870
|
+
this.#bufferedAgentText = [
|
|
31871
|
+
...this.#bufferedAgentText.slice(0, -1),
|
|
31872
|
+
{ chunks: [...previous2.chunks, text3], messageId }
|
|
31873
|
+
];
|
|
31874
|
+
return;
|
|
31875
|
+
}
|
|
31876
|
+
this.#bufferedAgentText = [...this.#bufferedAgentText, { chunks: [text3], messageId }];
|
|
31877
|
+
};
|
|
31878
|
+
flushAgentText = async () => {
|
|
31879
|
+
const buffered = this.#bufferedAgentText;
|
|
31880
|
+
this.#bufferedAgentText = [];
|
|
31881
|
+
for (const message of buffered) {
|
|
31882
|
+
await this.emitAgentMessage(message.chunks, message.messageId);
|
|
31883
|
+
}
|
|
31884
|
+
};
|
|
31885
|
+
recordBufferedAgentTextAsProgress = async () => {
|
|
31886
|
+
const buffered = this.#bufferedAgentText;
|
|
31887
|
+
this.#bufferedAgentText = [];
|
|
31888
|
+
for (const message of buffered) {
|
|
31889
|
+
for (const chunk of message.chunks) {
|
|
31890
|
+
await this.#turn.activities.recordNarrative("progress", message.messageId, chunk);
|
|
31891
|
+
}
|
|
31892
|
+
}
|
|
31893
|
+
};
|
|
31883
31894
|
prepareAgentContent = async (content3) => {
|
|
31884
31895
|
if (content3.type === "image" && content3.data.length > 0) {
|
|
31885
31896
|
const raster = readInlineRaster(content3.data, content3.name);
|
|
@@ -31889,7 +31900,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31889
31900
|
}
|
|
31890
31901
|
if (content3.type === "image" && content3.data.length === 0 && content3.uri.length > 0) {
|
|
31891
31902
|
const signal = AbortSignal.timeout(2e4);
|
|
31892
|
-
const raster = await
|
|
31903
|
+
const raster = await readLocalRaster(content3.uri, signal);
|
|
31893
31904
|
if (raster !== null) {
|
|
31894
31905
|
return await this.importRaster(raster, signal);
|
|
31895
31906
|
}
|
|
@@ -32359,6 +32370,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32359
32370
|
options.signal
|
|
32360
32371
|
);
|
|
32361
32372
|
await this.#updateTail;
|
|
32373
|
+
await this.flushAgentText();
|
|
32362
32374
|
await running.activities.finish();
|
|
32363
32375
|
let result;
|
|
32364
32376
|
try {
|
|
@@ -32390,6 +32402,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32390
32402
|
cause: error62
|
|
32391
32403
|
});
|
|
32392
32404
|
} finally {
|
|
32405
|
+
this.#bufferedAgentText = [];
|
|
32393
32406
|
this.#turn = new IdleAcpTurn();
|
|
32394
32407
|
}
|
|
32395
32408
|
};
|
|
@@ -32681,10 +32694,11 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32681
32694
|
);
|
|
32682
32695
|
} else {
|
|
32683
32696
|
await this.#turn.activities.finishNarrative();
|
|
32684
|
-
await this.
|
|
32697
|
+
await this.bufferAgentText(update.content.text, truncate3(update.messageId ?? "", 255));
|
|
32685
32698
|
}
|
|
32686
32699
|
} else {
|
|
32687
32700
|
await this.#turn.activities.finishNarrative();
|
|
32701
|
+
await this.flushAgentText();
|
|
32688
32702
|
await this.emitAgentContent(
|
|
32689
32703
|
normalizeContentBlock(update.content),
|
|
32690
32704
|
truncate3(update.messageId ?? "", 255)
|
|
@@ -32703,6 +32717,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32703
32717
|
return;
|
|
32704
32718
|
}
|
|
32705
32719
|
if (update.sessionUpdate === "tool_call") {
|
|
32720
|
+
await this.recordBufferedAgentTextAsProgress();
|
|
32706
32721
|
await this.#turn.activities.recordToolCall(update);
|
|
32707
32722
|
return;
|
|
32708
32723
|
}
|
|
@@ -34698,7 +34713,7 @@ var LocalAgentInventory = class {
|
|
|
34698
34713
|
|
|
34699
34714
|
// src/agent-installation/managed-npm-package.ts
|
|
34700
34715
|
import { mkdir as mkdir2, mkdtemp, open as open2, realpath as realpath3, rename, rm, stat as stat3 } from "node:fs/promises";
|
|
34701
|
-
import { delimiter, dirname as dirname4, isAbsolute as isAbsolute3, join as join4, relative
|
|
34716
|
+
import { delimiter, dirname as dirname4, isAbsolute as isAbsolute3, join as join4, relative, sep } from "node:path";
|
|
34702
34717
|
var INSTALL_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
|
|
34703
34718
|
var PACKAGE_METADATA_LIMIT_BYTES = 64 * 1024;
|
|
34704
34719
|
var PACKAGE_LOCK_LIMIT_BYTES = 8 * 1024 * 1024;
|
|
@@ -34752,8 +34767,8 @@ function packagePath(root, packageName) {
|
|
|
34752
34767
|
return join4(root, "node_modules", ...packageName.split("/"));
|
|
34753
34768
|
}
|
|
34754
34769
|
function isContainedPath(root, candidate) {
|
|
34755
|
-
const difference =
|
|
34756
|
-
return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${
|
|
34770
|
+
const difference = relative(root, candidate);
|
|
34771
|
+
return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep}`) && !isAbsolute3(difference);
|
|
34757
34772
|
}
|
|
34758
34773
|
async function readJsonRecord(path2, maximumBytes) {
|
|
34759
34774
|
try {
|
|
@@ -35379,7 +35394,7 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35379
35394
|
|
|
35380
35395
|
// src/agent-catalog/agents/grok-build-agent.ts
|
|
35381
35396
|
import { realpath as realpath5 } from "node:fs/promises";
|
|
35382
|
-
import { isAbsolute as isAbsolute6, join as join8, relative as
|
|
35397
|
+
import { isAbsolute as isAbsolute6, join as join8, relative as relative2, sep as sep2 } from "node:path";
|
|
35383
35398
|
import {
|
|
35384
35399
|
RequestError as RequestError2
|
|
35385
35400
|
} from "@agentclientprotocol/sdk";
|
|
@@ -35444,8 +35459,8 @@ function grokBuildManagedPackage(platform, architecture) {
|
|
|
35444
35459
|
|
|
35445
35460
|
// src/agent-catalog/agents/grok-build-agent.ts
|
|
35446
35461
|
function isContainedPath2(root, candidate) {
|
|
35447
|
-
const difference =
|
|
35448
|
-
return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${
|
|
35462
|
+
const difference = relative2(root, candidate);
|
|
35463
|
+
return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep2}`) && !isAbsolute6(difference);
|
|
35449
35464
|
}
|
|
35450
35465
|
var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
35451
35466
|
adapterVersion = GROK_BUILD_MANAGED_VERSION;
|
|
@@ -35547,7 +35562,7 @@ import { join as join10 } from "node:path";
|
|
|
35547
35562
|
import { createHash } from "node:crypto";
|
|
35548
35563
|
import { createReadStream } from "node:fs";
|
|
35549
35564
|
import { chmod as chmod2, copyFile, mkdir as mkdir3, mkdtemp as mkdtemp2, open as open3, realpath as realpath6, rename as rename2, rm as rm2, stat as stat5, writeFile } from "node:fs/promises";
|
|
35550
|
-
import { delimiter as delimiter2, dirname as dirname5, isAbsolute as isAbsolute7, join as join9, relative as
|
|
35565
|
+
import { delimiter as delimiter2, dirname as dirname5, isAbsolute as isAbsolute7, join as join9, relative as relative3, sep as sep3 } from "node:path";
|
|
35551
35566
|
|
|
35552
35567
|
// src/agent-installation/verified-download.ts
|
|
35553
35568
|
import { fetch as fetch2 } from "undici";
|
|
@@ -35652,8 +35667,8 @@ function isRecord10(value) {
|
|
|
35652
35667
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
35653
35668
|
}
|
|
35654
35669
|
function isContainedPath3(root, candidate) {
|
|
35655
|
-
const difference =
|
|
35656
|
-
return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${
|
|
35670
|
+
const difference = relative3(root, candidate);
|
|
35671
|
+
return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep3}`) && !isAbsolute7(difference);
|
|
35657
35672
|
}
|
|
35658
35673
|
async function hashFile(path2, signal) {
|
|
35659
35674
|
signal.throwIfAborted();
|
|
@@ -37874,7 +37889,7 @@ async function uploadRuntimeArtifact(config2, sessionId, artifact, signal) {
|
|
|
37874
37889
|
// src/authorization/workspace-directory.ts
|
|
37875
37890
|
import { readdir as readdir2, realpath as realpath8, stat as stat7 } from "node:fs/promises";
|
|
37876
37891
|
import { homedir as homedir2 } from "node:os";
|
|
37877
|
-
import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute10, join as join16, normalize as normalize3, relative as
|
|
37892
|
+
import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute10, join as join16, normalize as normalize3, relative as relative4 } from "node:path";
|
|
37878
37893
|
var WorkspaceDirectoryListing = class {
|
|
37879
37894
|
directoryId;
|
|
37880
37895
|
directoryLabel;
|
|
@@ -37957,7 +37972,7 @@ var WorkspaceDirectoryService = class {
|
|
|
37957
37972
|
}
|
|
37958
37973
|
};
|
|
37959
37974
|
label = (path2) => {
|
|
37960
|
-
const suffix =
|
|
37975
|
+
const suffix = relative4(homedir2(), path2);
|
|
37961
37976
|
return suffix === "" ? "~" : !isAbsolute10(suffix) && suffix !== ".." && !suffix.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) ? `~/${suffix.replaceAll("\\", "/")}` : path2;
|
|
37962
37977
|
};
|
|
37963
37978
|
identify = async (bindingId, requestedPath, signal) => {
|
|
@@ -38294,7 +38309,7 @@ async function readCodexHistory(agent, cwd, nativeSessionId, signal) {
|
|
|
38294
38309
|
const snapshot = await response.promise;
|
|
38295
38310
|
return {
|
|
38296
38311
|
...snapshot,
|
|
38297
|
-
history: await embedLocalHistoryImages(snapshot.history,
|
|
38312
|
+
history: await embedLocalHistoryImages(snapshot.history, signal)
|
|
38298
38313
|
};
|
|
38299
38314
|
} finally {
|
|
38300
38315
|
clearTimeout(timeout);
|
|
@@ -39891,17 +39906,7 @@ var DaemonAcpObserver = class {
|
|
|
39891
39906
|
this.#config = config2;
|
|
39892
39907
|
this.#record = record4;
|
|
39893
39908
|
}
|
|
39894
|
-
importLocalArtifact = async (sessionId, artifact, signal) =>
|
|
39895
|
-
try {
|
|
39896
|
-
return (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
39897
|
-
} catch (cause) {
|
|
39898
|
-
signal.throwIfAborted();
|
|
39899
|
-
if (cause instanceof Error && cause.name === "AbortError") {
|
|
39900
|
-
throw cause;
|
|
39901
|
-
}
|
|
39902
|
-
return "";
|
|
39903
|
-
}
|
|
39904
|
-
};
|
|
39909
|
+
importLocalArtifact = async (sessionId, artifact, signal) => (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
39905
39910
|
onCommands = (event) => {
|
|
39906
39911
|
this.#record(event.sessionId, encodeSessionCommandsUpdatedEvent(event));
|
|
39907
39912
|
return Promise.resolve();
|
|
@@ -40943,24 +40948,55 @@ function assertPreparedPermission(configOptions, permissionMode) {
|
|
|
40943
40948
|
);
|
|
40944
40949
|
}
|
|
40945
40950
|
}
|
|
40946
|
-
|
|
40951
|
+
function warnIgnoredExecutionSetting(audit, commandId, sessionId, agentId, selection, category, reason) {
|
|
40952
|
+
const details = {
|
|
40953
|
+
agentId,
|
|
40954
|
+
category,
|
|
40955
|
+
configId: selection.configId,
|
|
40956
|
+
reason,
|
|
40957
|
+
requestedValue: selection.value
|
|
40958
|
+
};
|
|
40959
|
+
const event = "bot_execution_setting_ignored";
|
|
40960
|
+
audit.record({ commandId, details, event, sessionId });
|
|
40961
|
+
process.stderr.write(`Mobius daemon warning ${JSON.stringify({ commandId, event, sessionId, ...details })}
|
|
40962
|
+
`);
|
|
40963
|
+
}
|
|
40964
|
+
async function applySupportedExecutionSelection(sessions, audit, configOptions, selection, category, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40965
|
+
if (selection.value === AGENT_DEFAULT_EXECUTION_SETTING) {
|
|
40966
|
+
return configOptions;
|
|
40967
|
+
}
|
|
40947
40968
|
const option2 = configOptions.find((candidate) => candidate.id === selection.configId);
|
|
40948
|
-
if (option2 === void 0
|
|
40949
|
-
|
|
40950
|
-
|
|
40951
|
-
|
|
40952
|
-
|
|
40969
|
+
if (option2 === void 0) {
|
|
40970
|
+
warnIgnoredExecutionSetting(audit, commandId, sessionId, agent.id, selection, category, "setting_unavailable");
|
|
40971
|
+
return configOptions;
|
|
40972
|
+
}
|
|
40973
|
+
if (option2.type !== "select" || option2.category !== category) {
|
|
40974
|
+
warnIgnoredExecutionSetting(
|
|
40975
|
+
audit,
|
|
40976
|
+
commandId,
|
|
40977
|
+
sessionId,
|
|
40978
|
+
agent.id,
|
|
40979
|
+
selection,
|
|
40980
|
+
category,
|
|
40981
|
+
"setting_schema_mismatch"
|
|
40953
40982
|
);
|
|
40983
|
+
return configOptions;
|
|
40954
40984
|
}
|
|
40955
|
-
if (selection.
|
|
40985
|
+
if (selection.valueType !== "select" || selection.booleanValue) {
|
|
40986
|
+
warnIgnoredExecutionSetting(
|
|
40987
|
+
audit,
|
|
40988
|
+
commandId,
|
|
40989
|
+
sessionId,
|
|
40990
|
+
agent.id,
|
|
40991
|
+
selection,
|
|
40992
|
+
category,
|
|
40993
|
+
"selection_schema_mismatch"
|
|
40994
|
+
);
|
|
40956
40995
|
return configOptions;
|
|
40957
40996
|
}
|
|
40958
40997
|
if (!option2.values.some((value) => value.value === selection.value)) {
|
|
40959
|
-
|
|
40960
|
-
|
|
40961
|
-
{},
|
|
40962
|
-
"invalid_session_configuration"
|
|
40963
|
-
);
|
|
40998
|
+
warnIgnoredExecutionSetting(audit, commandId, sessionId, agent.id, selection, category, "value_unavailable");
|
|
40999
|
+
return configOptions;
|
|
40964
41000
|
}
|
|
40965
41001
|
if (option2.currentValue === selection.value) {
|
|
40966
41002
|
return configOptions;
|
|
@@ -41059,25 +41095,29 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41059
41095
|
signal: executionSignal
|
|
41060
41096
|
});
|
|
41061
41097
|
assertPreparedPermission(prepared.configOptions, execution.executionConfiguration.permissionMode);
|
|
41062
|
-
let configOptions = await
|
|
41098
|
+
let configOptions = await applySupportedExecutionSelection(
|
|
41063
41099
|
sessions,
|
|
41100
|
+
audit,
|
|
41064
41101
|
prepared.configOptions,
|
|
41065
41102
|
execution.executionConfiguration.model,
|
|
41066
41103
|
"model",
|
|
41067
41104
|
agent,
|
|
41068
41105
|
resolved.cwd,
|
|
41069
41106
|
resolved.additionalDirectories,
|
|
41107
|
+
command.commandId,
|
|
41070
41108
|
command.sessionId,
|
|
41071
41109
|
executionSignal
|
|
41072
41110
|
);
|
|
41073
|
-
configOptions = await
|
|
41111
|
+
configOptions = await applySupportedExecutionSelection(
|
|
41074
41112
|
sessions,
|
|
41113
|
+
audit,
|
|
41075
41114
|
configOptions,
|
|
41076
41115
|
execution.executionConfiguration.reasoningEffort,
|
|
41077
41116
|
"thought_level",
|
|
41078
41117
|
agent,
|
|
41079
41118
|
resolved.cwd,
|
|
41080
41119
|
resolved.additionalDirectories,
|
|
41120
|
+
command.commandId,
|
|
41081
41121
|
command.sessionId,
|
|
41082
41122
|
executionSignal
|
|
41083
41123
|
);
|