@moxt-ai/mobius 0.0.66 → 0.0.68
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 +7 -0
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +15 -1
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/agent-catalog/agent-specification.d.ts.map +1 -1
- package/dist/agent-catalog/agent-specification.js +7 -2
- package/dist/agent-catalog/agent-specification.js.map +1 -1
- package/dist/agent-catalog/discover-agent.d.ts.map +1 -1
- package/dist/agent-catalog/discover-agent.js +28 -4
- package/dist/agent-catalog/discover-agent.js.map +1 -1
- package/dist/cli.js +277 -83
- package/dist/cli.js.map +3 -3
- package/dist/index.js +276 -79
- package/dist/index.js.map +3 -3
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +175 -43
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +276 -79
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -4
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { mkdir as mkdir6 } from "node:fs/promises";
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@moxt-ai/mobius",
|
|
14
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.68",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -62,9 +62,6 @@ var package_default = {
|
|
|
62
62
|
esbuild: "0.28.2"
|
|
63
63
|
},
|
|
64
64
|
main: "dist/index.js",
|
|
65
|
-
directories: {
|
|
66
|
-
test: "tests"
|
|
67
|
-
},
|
|
68
65
|
keywords: [],
|
|
69
66
|
author: "",
|
|
70
67
|
license: "ISC",
|
|
@@ -1285,8 +1282,8 @@ function normalizeVersionOutput(output2) {
|
|
|
1285
1282
|
}
|
|
1286
1283
|
|
|
1287
1284
|
// src/agent-catalog/agent-specification.ts
|
|
1288
|
-
var VERSION_PROBE_TIMEOUT_MILLISECONDS =
|
|
1289
|
-
var ACP_PROBE_TIMEOUT_MILLISECONDS =
|
|
1285
|
+
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e4;
|
|
1286
|
+
var ACP_PROBE_TIMEOUT_MILLISECONDS = 6e4;
|
|
1290
1287
|
var LocalAgentSpecification = class {
|
|
1291
1288
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
1292
1289
|
authenticationCommand = () => "";
|
|
@@ -2753,6 +2750,25 @@ function agentProbeFailure(specification, error62) {
|
|
|
2753
2750
|
}
|
|
2754
2751
|
return new AgentProbeFailed(specification, "agent_probe_failed", "Agent probe failed");
|
|
2755
2752
|
}
|
|
2753
|
+
function isRetryableProbeFailure(error62) {
|
|
2754
|
+
if (error62 instanceof ProcessExecutionError) {
|
|
2755
|
+
return error62.code === "process_timeout";
|
|
2756
|
+
}
|
|
2757
|
+
return error62 instanceof AgentProbeError && error62.code === "adapter_probe_timeout";
|
|
2758
|
+
}
|
|
2759
|
+
async function probeWithRetry(signal, probe) {
|
|
2760
|
+
try {
|
|
2761
|
+
return await probe();
|
|
2762
|
+
} catch (error62) {
|
|
2763
|
+
if (signal.aborted) {
|
|
2764
|
+
signal.throwIfAborted();
|
|
2765
|
+
}
|
|
2766
|
+
if (!isRetryableProbeFailure(error62)) {
|
|
2767
|
+
throw error62;
|
|
2768
|
+
}
|
|
2769
|
+
return await probe();
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2756
2772
|
function integrationProbeFailure(specification, agent, error62) {
|
|
2757
2773
|
if (error62 instanceof AgentProbeError) {
|
|
2758
2774
|
if (error62.code === "authentication_required") {
|
|
@@ -2779,14 +2795,17 @@ async function discoverAgent(specification, context) {
|
|
|
2779
2795
|
for (const agent of agents) {
|
|
2780
2796
|
let agentVersion = "";
|
|
2781
2797
|
try {
|
|
2782
|
-
agentVersion = await
|
|
2783
|
-
agent,
|
|
2784
|
-
specification.agentVersionArguments,
|
|
2785
|
-
context.environment,
|
|
2786
|
-
context.defaultWorkspace,
|
|
2798
|
+
agentVersion = await probeWithRetry(
|
|
2787
2799
|
context.signal,
|
|
2788
|
-
|
|
2789
|
-
|
|
2800
|
+
async () => await probeVersion(
|
|
2801
|
+
agent,
|
|
2802
|
+
specification.agentVersionArguments,
|
|
2803
|
+
context.environment,
|
|
2804
|
+
context.defaultWorkspace,
|
|
2805
|
+
context.signal,
|
|
2806
|
+
specification.versionProbeTimeoutMilliseconds,
|
|
2807
|
+
specification.normalizeAgentVersion
|
|
2808
|
+
)
|
|
2790
2809
|
);
|
|
2791
2810
|
} catch (error62) {
|
|
2792
2811
|
if (context.signal.aborted) {
|
|
@@ -2813,17 +2832,20 @@ async function discoverAgent(specification, context) {
|
|
|
2813
2832
|
try {
|
|
2814
2833
|
launchEnvironment = await specification.createLaunchEnvironment(agent, context);
|
|
2815
2834
|
if (specification.adapterVersionArguments.length > 0) {
|
|
2816
|
-
adapterVersion = await
|
|
2817
|
-
adapter,
|
|
2818
|
-
specification.adapterVersionArguments,
|
|
2819
|
-
{
|
|
2820
|
-
...context.environment,
|
|
2821
|
-
...launchEnvironment
|
|
2822
|
-
},
|
|
2823
|
-
context.defaultWorkspace,
|
|
2835
|
+
adapterVersion = await probeWithRetry(
|
|
2824
2836
|
context.signal,
|
|
2825
|
-
|
|
2826
|
-
|
|
2837
|
+
async () => await probeVersion(
|
|
2838
|
+
adapter,
|
|
2839
|
+
specification.adapterVersionArguments,
|
|
2840
|
+
{
|
|
2841
|
+
...context.environment,
|
|
2842
|
+
...launchEnvironment
|
|
2843
|
+
},
|
|
2844
|
+
context.defaultWorkspace,
|
|
2845
|
+
context.signal,
|
|
2846
|
+
specification.versionProbeTimeoutMilliseconds,
|
|
2847
|
+
specification.normalizeAdapterVersion
|
|
2848
|
+
)
|
|
2827
2849
|
);
|
|
2828
2850
|
}
|
|
2829
2851
|
} catch (error62) {
|
|
@@ -2845,12 +2867,15 @@ async function discoverAgent(specification, context) {
|
|
|
2845
2867
|
agent.identity
|
|
2846
2868
|
);
|
|
2847
2869
|
try {
|
|
2848
|
-
const readiness = await
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2870
|
+
const readiness = await probeWithRetry(
|
|
2871
|
+
context.signal,
|
|
2872
|
+
async () => await probeAcpReadiness(
|
|
2873
|
+
specification,
|
|
2874
|
+
definition2,
|
|
2875
|
+
context.environment,
|
|
2876
|
+
context.defaultWorkspace,
|
|
2877
|
+
context.signal
|
|
2878
|
+
)
|
|
2854
2879
|
);
|
|
2855
2880
|
const verifiedAdapterVersion = adapterVersion.length > 0 ? adapterVersion : readiness.adapterVersion;
|
|
2856
2881
|
if (verifiedAdapterVersion.length === 0) {
|
|
@@ -22768,6 +22793,7 @@ var agentModelEffortSchema = external_exports.strictObject({
|
|
|
22768
22793
|
effortSettingId: external_exports.string().max(128),
|
|
22769
22794
|
modelSettingId: external_exports.string().max(128),
|
|
22770
22795
|
resolution: agentModelEffortResolutionSchema,
|
|
22796
|
+
unsupportedModelIds: external_exports.array(external_exports.string().min(1).max(500)).max(500).readonly().default([]),
|
|
22771
22797
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
22772
22798
|
}).readonly();
|
|
22773
22799
|
var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
|
|
@@ -23760,21 +23786,30 @@ var historyMessage = external_exports.strictObject({
|
|
|
23760
23786
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT),
|
|
23761
23787
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
23762
23788
|
}).readonly();
|
|
23763
|
-
var
|
|
23764
|
-
external_exports.
|
|
23765
|
-
|
|
23766
|
-
|
|
23767
|
-
|
|
23768
|
-
|
|
23769
|
-
|
|
23770
|
-
|
|
23771
|
-
|
|
23772
|
-
|
|
23773
|
-
|
|
23789
|
+
var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
23790
|
+
status: external_exports.literal("available"),
|
|
23791
|
+
messages: external_exports.array(historyMessage).max(SESSION_HISTORY_MESSAGE_LIMIT).readonly(),
|
|
23792
|
+
truncated: external_exports.boolean(),
|
|
23793
|
+
coveredCommandIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/)).max(1e4).readonly(),
|
|
23794
|
+
coveredMessageIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}:(?:user|agent)$/)).max(2e4).readonly().default([])
|
|
23795
|
+
});
|
|
23796
|
+
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
23797
|
+
var unavailableSessionHistoryObjectSchema = external_exports.strictObject({ status: external_exports.literal("unavailable") });
|
|
23798
|
+
var unavailableSessionHistorySchema = unavailableSessionHistoryObjectSchema.readonly();
|
|
23799
|
+
function withinHistoryContentLimits(history) {
|
|
23800
|
+
if (history.status === "unavailable" || history.messages === void 0) {
|
|
23801
|
+
return true;
|
|
23802
|
+
}
|
|
23803
|
+
return history.messages.reduce((total, message) => total + message.text.length, 0) <= SESSION_HISTORY_CHARACTER_LIMIT && history.messages.reduce(
|
|
23774
23804
|
(total, message) => total + (message.images ?? []).reduce((size, image) => size + image.data.length, 0),
|
|
23775
23805
|
0
|
|
23776
|
-
) <= SESSION_HISTORY_IMAGE_CHARACTER_LIMIT
|
|
23777
|
-
|
|
23806
|
+
) <= SESSION_HISTORY_IMAGE_CHARACTER_LIMIT;
|
|
23807
|
+
}
|
|
23808
|
+
var sessionHistorySchema = external_exports.discriminatedUnion("status", [availableSessionHistorySchema, unavailableSessionHistorySchema]).refine(withinHistoryContentLimits);
|
|
23809
|
+
var sessionHistoryPageSchema = external_exports.discriminatedUnion("status", [
|
|
23810
|
+
availableSessionHistoryObjectSchema.extend({ nextCursor: external_exports.string().max(512).nullable() }).readonly(),
|
|
23811
|
+
unavailableSessionHistoryObjectSchema.extend({ nextCursor: external_exports.null() }).readonly()
|
|
23812
|
+
]).refine(withinHistoryContentLimits);
|
|
23778
23813
|
|
|
23779
23814
|
// ../protocol/src/native-sessions.ts
|
|
23780
23815
|
var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
@@ -34053,6 +34088,20 @@ var AcpExecutionError = class extends Error {
|
|
|
34053
34088
|
this.name = "AcpExecutionError";
|
|
34054
34089
|
}
|
|
34055
34090
|
};
|
|
34091
|
+
var AcpConfigurationValueUnavailableError = class extends AcpExecutionError {
|
|
34092
|
+
configId;
|
|
34093
|
+
offeredValueCount;
|
|
34094
|
+
offeredValues;
|
|
34095
|
+
requestedValue;
|
|
34096
|
+
constructor(configId, requestedValue, offeredValues) {
|
|
34097
|
+
super("The requested ACP configuration value is unavailable", {}, "invalid_session_configuration");
|
|
34098
|
+
this.name = "AcpConfigurationValueUnavailableError";
|
|
34099
|
+
this.configId = configId.slice(0, 128);
|
|
34100
|
+
this.requestedValue = requestedValue.slice(0, 128);
|
|
34101
|
+
this.offeredValueCount = offeredValues.length;
|
|
34102
|
+
this.offeredValues = Object.freeze(offeredValues.slice(0, 32).map((value) => value.slice(0, 128)));
|
|
34103
|
+
}
|
|
34104
|
+
};
|
|
34056
34105
|
var RetryableAcpInitializationError = class extends AcpExecutionError {
|
|
34057
34106
|
constructor(cause) {
|
|
34058
34107
|
super("ACP agent initialization failed", { cause });
|
|
@@ -35135,10 +35184,10 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
35135
35184
|
);
|
|
35136
35185
|
}
|
|
35137
35186
|
if (!existing.values.some((entry) => entry.value === options.value)) {
|
|
35138
|
-
throw new
|
|
35139
|
-
|
|
35140
|
-
|
|
35141
|
-
|
|
35187
|
+
throw new AcpConfigurationValueUnavailableError(
|
|
35188
|
+
options.configId,
|
|
35189
|
+
options.value,
|
|
35190
|
+
existing.values.map((entry) => entry.value)
|
|
35142
35191
|
);
|
|
35143
35192
|
}
|
|
35144
35193
|
}
|
|
@@ -40300,6 +40349,19 @@ function operationErrorMessage(error62) {
|
|
|
40300
40349
|
}
|
|
40301
40350
|
return "The local agent operation could not be completed";
|
|
40302
40351
|
}
|
|
40352
|
+
function agentSettingsFailureDetails(agentId, failure2) {
|
|
40353
|
+
const details = { agentId, code: operationErrorCode(failure2) };
|
|
40354
|
+
if (!(failure2 instanceof AcpConfigurationValueUnavailableError)) {
|
|
40355
|
+
return details;
|
|
40356
|
+
}
|
|
40357
|
+
return {
|
|
40358
|
+
...details,
|
|
40359
|
+
configId: failure2.configId,
|
|
40360
|
+
offeredValueCount: failure2.offeredValueCount.toString(),
|
|
40361
|
+
offeredValues: JSON.stringify(failure2.offeredValues),
|
|
40362
|
+
requestedValue: failure2.requestedValue
|
|
40363
|
+
};
|
|
40364
|
+
}
|
|
40303
40365
|
function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTimings = []) {
|
|
40304
40366
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
40305
40367
|
return;
|
|
@@ -40332,44 +40394,103 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
40332
40394
|
}
|
|
40333
40395
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
40334
40396
|
}
|
|
40335
|
-
|
|
40397
|
+
var OPENCODE_PROVIDER_SETTLEMENT_MILLISECONDS = 1e3;
|
|
40398
|
+
async function waitForAgentSettingsReadiness(agentId, signal, timer) {
|
|
40399
|
+
if (agentId !== "opencode") {
|
|
40400
|
+
return;
|
|
40401
|
+
}
|
|
40402
|
+
signal.throwIfAborted();
|
|
40403
|
+
await new Promise((resolve7) => {
|
|
40404
|
+
const readiness = timer.schedule(finish, OPENCODE_PROVIDER_SETTLEMENT_MILLISECONDS);
|
|
40405
|
+
function finish() {
|
|
40406
|
+
readiness.cancel();
|
|
40407
|
+
signal.removeEventListener("abort", finish);
|
|
40408
|
+
resolve7();
|
|
40409
|
+
}
|
|
40410
|
+
signal.addEventListener("abort", finish, { once: true });
|
|
40411
|
+
});
|
|
40412
|
+
signal.throwIfAborted();
|
|
40413
|
+
}
|
|
40414
|
+
function isUnavailableModel(cause, modelSettingId, requestedModel) {
|
|
40415
|
+
return cause instanceof AcpConfigurationValueUnavailableError && cause.configId === modelSettingId && cause.requestedValue === requestedModel;
|
|
40416
|
+
}
|
|
40417
|
+
function unsupportedModelIds(unsupportedModels) {
|
|
40418
|
+
return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
|
|
40419
|
+
}
|
|
40420
|
+
async function discoverAgentSettings(command, config2, directories, sessions, signal, timer) {
|
|
40336
40421
|
const agent = config2.catalog.find(command.agentId);
|
|
40337
40422
|
const cwd = await directories.resolve(config2.bindingId, "default", signal);
|
|
40423
|
+
await waitForAgentSettingsReadiness(agent.id, signal, timer);
|
|
40338
40424
|
const baseSnapshot = await sessions.inspectAgentSettings({
|
|
40339
40425
|
additionalDirectories: [],
|
|
40340
40426
|
agent,
|
|
40341
40427
|
cwd,
|
|
40342
40428
|
signal
|
|
40343
40429
|
});
|
|
40344
|
-
const
|
|
40345
|
-
|
|
40346
|
-
|
|
40347
|
-
|
|
40348
|
-
|
|
40349
|
-
|
|
40350
|
-
|
|
40430
|
+
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
40431
|
+
const unsupportedModels = [];
|
|
40432
|
+
let selectedSnapshot = baseSnapshot;
|
|
40433
|
+
if (command.model !== void 0) {
|
|
40434
|
+
if (baseModel === void 0 || baseModel.type !== "select" || !baseModel.values.some((value) => value.value === command.model)) {
|
|
40435
|
+
unsupportedModels.push(
|
|
40436
|
+
new AcpConfigurationValueUnavailableError(
|
|
40437
|
+
baseModel?.id ?? "model",
|
|
40438
|
+
command.model,
|
|
40439
|
+
baseModel?.values.map((value) => value.value) ?? []
|
|
40440
|
+
)
|
|
40441
|
+
);
|
|
40442
|
+
} else {
|
|
40443
|
+
try {
|
|
40444
|
+
selectedSnapshot = await sessions.inspectAgentSettings({
|
|
40445
|
+
additionalDirectories: [],
|
|
40446
|
+
agent,
|
|
40447
|
+
cwd,
|
|
40448
|
+
model: command.model,
|
|
40449
|
+
signal
|
|
40450
|
+
});
|
|
40451
|
+
} catch (cause) {
|
|
40452
|
+
signal.throwIfAborted();
|
|
40453
|
+
if (!isUnavailableModel(cause, baseModel.id, command.model)) {
|
|
40454
|
+
throw cause;
|
|
40455
|
+
}
|
|
40456
|
+
unsupportedModels.push(cause);
|
|
40457
|
+
}
|
|
40458
|
+
}
|
|
40459
|
+
}
|
|
40351
40460
|
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
40352
|
-
const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
|
|
40353
|
-
const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
|
|
40354
40461
|
const modelEffort = await discoverModelEffort(
|
|
40355
40462
|
command,
|
|
40356
40463
|
agent,
|
|
40357
40464
|
adapter.modelEffortResolution,
|
|
40358
40465
|
baseSnapshot.configOptions,
|
|
40359
40466
|
selectedSnapshot.configOptions,
|
|
40467
|
+
unsupportedModels,
|
|
40360
40468
|
cwd,
|
|
40361
40469
|
sessions,
|
|
40362
40470
|
signal
|
|
40363
40471
|
);
|
|
40472
|
+
const baseSettings = withoutUnsupportedModels(
|
|
40473
|
+
settingsFromSnapshot(agent, baseSnapshot.configOptions),
|
|
40474
|
+
baseModel?.id ?? "",
|
|
40475
|
+
modelEffort.unsupportedModelIds
|
|
40476
|
+
);
|
|
40477
|
+
const settings = withoutUnsupportedModels(
|
|
40478
|
+
settingsFromSnapshot(agent, selectedSnapshot.configOptions),
|
|
40479
|
+
baseModel?.id ?? "",
|
|
40480
|
+
modelEffort.unsupportedModelIds
|
|
40481
|
+
);
|
|
40364
40482
|
return {
|
|
40365
|
-
|
|
40366
|
-
|
|
40367
|
-
|
|
40368
|
-
|
|
40369
|
-
|
|
40370
|
-
|
|
40371
|
-
|
|
40372
|
-
|
|
40483
|
+
event: {
|
|
40484
|
+
agentId: command.agentId,
|
|
40485
|
+
agentName: selectedSnapshot.agentName,
|
|
40486
|
+
agentVersion: selectedSnapshot.agentVersion,
|
|
40487
|
+
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
40488
|
+
modelEffort,
|
|
40489
|
+
requestId: command.requestId,
|
|
40490
|
+
settings,
|
|
40491
|
+
settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort)
|
|
40492
|
+
},
|
|
40493
|
+
unsupportedModels
|
|
40373
40494
|
};
|
|
40374
40495
|
}
|
|
40375
40496
|
function settingFromOption(option) {
|
|
@@ -40405,6 +40526,22 @@ function settingsFromSnapshot(agent, configOptions) {
|
|
|
40405
40526
|
}
|
|
40406
40527
|
return settings;
|
|
40407
40528
|
}
|
|
40529
|
+
function withoutUnsupportedModels(settings, modelSettingId, unsupportedModelIds2) {
|
|
40530
|
+
if (modelSettingId.length === 0 || unsupportedModelIds2.length === 0) {
|
|
40531
|
+
return settings;
|
|
40532
|
+
}
|
|
40533
|
+
const unsupported = new Set(unsupportedModelIds2);
|
|
40534
|
+
return settings.map((setting) => {
|
|
40535
|
+
if (setting.id !== modelSettingId || setting.type !== "select") {
|
|
40536
|
+
return setting;
|
|
40537
|
+
}
|
|
40538
|
+
return {
|
|
40539
|
+
...setting,
|
|
40540
|
+
defaultValue: unsupported.has(setting.defaultValue) ? "" : setting.defaultValue,
|
|
40541
|
+
values: setting.values.filter((value) => !unsupported.has(value.value))
|
|
40542
|
+
};
|
|
40543
|
+
});
|
|
40544
|
+
}
|
|
40408
40545
|
function modelOption(options) {
|
|
40409
40546
|
return options.find((option) => option.id === "model" || option.category === "model");
|
|
40410
40547
|
}
|
|
@@ -40416,16 +40553,18 @@ function unavailableModelEffort() {
|
|
|
40416
40553
|
effortSettingId: "",
|
|
40417
40554
|
modelSettingId: "",
|
|
40418
40555
|
resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
|
|
40556
|
+
unsupportedModelIds: [],
|
|
40419
40557
|
valuesByModel: {}
|
|
40420
40558
|
};
|
|
40421
40559
|
}
|
|
40422
|
-
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
|
|
40560
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
|
|
40423
40561
|
const model = modelOption(initialOptions);
|
|
40562
|
+
const unsupportedModels = initiallyUnsupportedModels;
|
|
40424
40563
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
40425
|
-
return unavailableModelEffort();
|
|
40564
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
40426
40565
|
}
|
|
40427
40566
|
if (model === void 0 || model.type !== "select" || model.values.length === 0) {
|
|
40428
|
-
return unavailableModelEffort();
|
|
40567
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
40429
40568
|
}
|
|
40430
40569
|
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
40431
40570
|
additionalDirectories: [],
|
|
@@ -40438,42 +40577,70 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
40438
40577
|
if (resolution === "complete") {
|
|
40439
40578
|
const effort = effortOption(initialOptions);
|
|
40440
40579
|
if (effort === void 0 || effort.type !== "select" || effort.values.length < 2) {
|
|
40441
|
-
return
|
|
40580
|
+
return {
|
|
40581
|
+
...unavailableModelEffort(),
|
|
40582
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels)
|
|
40583
|
+
};
|
|
40442
40584
|
}
|
|
40443
40585
|
for (const value of model.values) {
|
|
40444
|
-
|
|
40445
|
-
|
|
40586
|
+
if (unsupportedModels.some((diagnostic) => diagnostic.requestedValue === value.value)) {
|
|
40587
|
+
continue;
|
|
40588
|
+
}
|
|
40589
|
+
try {
|
|
40590
|
+
const selectedEffort2 = effortOption(await inspectModel(value.value));
|
|
40591
|
+
valuesByModel[value.value] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40592
|
+
} catch (cause) {
|
|
40593
|
+
signal.throwIfAborted();
|
|
40594
|
+
if (!isUnavailableModel(cause, model.id, value.value)) {
|
|
40595
|
+
throw cause;
|
|
40596
|
+
}
|
|
40597
|
+
unsupportedModels.push(cause);
|
|
40598
|
+
}
|
|
40446
40599
|
}
|
|
40447
40600
|
return {
|
|
40448
40601
|
effortSettingId: effort.id,
|
|
40449
40602
|
modelSettingId: model.id,
|
|
40450
40603
|
resolution: "complete",
|
|
40604
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40451
40605
|
valuesByModel
|
|
40452
40606
|
};
|
|
40453
40607
|
}
|
|
40454
40608
|
if (command.model !== void 0) {
|
|
40455
|
-
|
|
40456
|
-
throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
|
|
40457
|
-
}
|
|
40609
|
+
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command.model);
|
|
40458
40610
|
const selectedEffort2 = effortOption(selectedOptions);
|
|
40459
|
-
|
|
40611
|
+
if (!modelUnsupported) {
|
|
40612
|
+
valuesByModel[command.model] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40613
|
+
}
|
|
40460
40614
|
return {
|
|
40461
40615
|
effortSettingId: selectedEffort2?.id ?? "",
|
|
40462
40616
|
modelSettingId: model.id,
|
|
40463
40617
|
resolution: "on_model_selection",
|
|
40618
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40464
40619
|
valuesByModel
|
|
40465
40620
|
};
|
|
40466
40621
|
}
|
|
40467
40622
|
const defaultModel = model.type === "select" ? model.currentValue : "";
|
|
40468
40623
|
const reportedEffort = effortOption(selectedOptions);
|
|
40469
|
-
|
|
40470
|
-
if (defaultModel.length > 0) {
|
|
40624
|
+
let selectedEffort = reportedEffort;
|
|
40625
|
+
if (defaultModel.length > 0 && reportedEffort === void 0) {
|
|
40626
|
+
try {
|
|
40627
|
+
selectedEffort = effortOption(await inspectModel(defaultModel));
|
|
40628
|
+
} catch (cause) {
|
|
40629
|
+
signal.throwIfAborted();
|
|
40630
|
+
if (!isUnavailableModel(cause, model.id, defaultModel)) {
|
|
40631
|
+
throw cause;
|
|
40632
|
+
}
|
|
40633
|
+
unsupportedModels.push(cause);
|
|
40634
|
+
}
|
|
40635
|
+
}
|
|
40636
|
+
if (defaultModel.length > 0 && !unsupportedModels.some((diagnostic) => diagnostic.requestedValue === defaultModel)) {
|
|
40471
40637
|
valuesByModel[defaultModel] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
40472
40638
|
}
|
|
40473
40639
|
return {
|
|
40474
40640
|
effortSettingId: selectedEffort?.id ?? "",
|
|
40475
40641
|
modelSettingId: model.id,
|
|
40476
40642
|
resolution: "on_model_selection",
|
|
40643
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40477
40644
|
valuesByModel
|
|
40478
40645
|
};
|
|
40479
40646
|
}
|
|
@@ -40482,6 +40649,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
40482
40649
|
effortSettingId: "",
|
|
40483
40650
|
modelSettingId: modelEffort.modelSettingId,
|
|
40484
40651
|
resolution: modelEffort.resolution,
|
|
40652
|
+
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
40485
40653
|
valuesByModel: {}
|
|
40486
40654
|
};
|
|
40487
40655
|
return createHash4("sha256").update(
|
|
@@ -40589,9 +40757,11 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40589
40757
|
sessionId: command.sessionId,
|
|
40590
40758
|
runtimeTimings: metrics.snapshot()
|
|
40591
40759
|
};
|
|
40592
|
-
|
|
40593
|
-
|
|
40594
|
-
|
|
40760
|
+
if (command.transient !== true) {
|
|
40761
|
+
metrics.measureSync("readiness-commit", () => {
|
|
40762
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
40763
|
+
});
|
|
40764
|
+
}
|
|
40595
40765
|
return event;
|
|
40596
40766
|
});
|
|
40597
40767
|
send(socket, {
|
|
@@ -41546,16 +41716,33 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41546
41716
|
config2,
|
|
41547
41717
|
directories,
|
|
41548
41718
|
sessions,
|
|
41549
|
-
operationSignal
|
|
41719
|
+
operationSignal,
|
|
41720
|
+
timer
|
|
41550
41721
|
);
|
|
41722
|
+
for (const diagnostic of result.unsupportedModels) {
|
|
41723
|
+
const details = agentSettingsFailureDetails(command2.agentId, diagnostic);
|
|
41724
|
+
audit.record({
|
|
41725
|
+
commandId: command2.requestId,
|
|
41726
|
+
details,
|
|
41727
|
+
event: "agent_settings_model_unsupported",
|
|
41728
|
+
sessionId: `agent-settings:${command2.agentId}`
|
|
41729
|
+
});
|
|
41730
|
+
process.stderr.write(
|
|
41731
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command2.requestId, ...details })}
|
|
41732
|
+
`
|
|
41733
|
+
);
|
|
41734
|
+
}
|
|
41551
41735
|
audit.record({
|
|
41552
41736
|
commandId: command2.requestId,
|
|
41553
|
-
details: {
|
|
41737
|
+
details: {
|
|
41738
|
+
agentId: command2.agentId,
|
|
41739
|
+
unsupportedModelCount: result.unsupportedModels.length.toString()
|
|
41740
|
+
},
|
|
41554
41741
|
event: "agent_settings_discovered",
|
|
41555
41742
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41556
41743
|
});
|
|
41557
41744
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41558
|
-
send(socket, result);
|
|
41745
|
+
send(socket, result.event);
|
|
41559
41746
|
}
|
|
41560
41747
|
} catch (error62) {
|
|
41561
41748
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41563,12 +41750,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41563
41750
|
{},
|
|
41564
41751
|
"agent_settings_discovery_cancelled"
|
|
41565
41752
|
) : error62;
|
|
41753
|
+
const details = agentSettingsFailureDetails(command2.agentId, failure2);
|
|
41566
41754
|
audit.record({
|
|
41567
41755
|
commandId: command2.requestId,
|
|
41568
|
-
details
|
|
41756
|
+
details,
|
|
41569
41757
|
event: "agent_settings_discovery_failed",
|
|
41570
41758
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41571
41759
|
});
|
|
41760
|
+
if (failure2 instanceof AcpConfigurationValueUnavailableError) {
|
|
41761
|
+
process.stderr.write(
|
|
41762
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command2.requestId, ...details })}
|
|
41763
|
+
`
|
|
41764
|
+
);
|
|
41765
|
+
}
|
|
41572
41766
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41573
41767
|
send(socket, {
|
|
41574
41768
|
code: operationErrorCode(failure2),
|