@moxt-ai/mobius 0.0.65 → 0.0.67
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/run-prompt.d.ts +1 -2
- package/dist/acp/run-prompt.d.ts.map +1 -1
- package/dist/acp/run-prompt.js.map +1 -1
- 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 +257 -104
- package/dist/cli.js.map +3 -3
- package/dist/index.js +256 -103
- package/dist/index.js.map +3 -3
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +159 -70
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +256 -103
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
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.67",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -1285,8 +1285,8 @@ function normalizeVersionOutput(output2) {
|
|
|
1285
1285
|
}
|
|
1286
1286
|
|
|
1287
1287
|
// src/agent-catalog/agent-specification.ts
|
|
1288
|
-
var VERSION_PROBE_TIMEOUT_MILLISECONDS =
|
|
1289
|
-
var ACP_PROBE_TIMEOUT_MILLISECONDS =
|
|
1288
|
+
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e4;
|
|
1289
|
+
var ACP_PROBE_TIMEOUT_MILLISECONDS = 6e4;
|
|
1290
1290
|
var LocalAgentSpecification = class {
|
|
1291
1291
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
1292
1292
|
authenticationCommand = () => "";
|
|
@@ -2753,6 +2753,25 @@ function agentProbeFailure(specification, error62) {
|
|
|
2753
2753
|
}
|
|
2754
2754
|
return new AgentProbeFailed(specification, "agent_probe_failed", "Agent probe failed");
|
|
2755
2755
|
}
|
|
2756
|
+
function isRetryableProbeFailure(error62) {
|
|
2757
|
+
if (error62 instanceof ProcessExecutionError) {
|
|
2758
|
+
return error62.code === "process_timeout";
|
|
2759
|
+
}
|
|
2760
|
+
return error62 instanceof AgentProbeError && error62.code === "adapter_probe_timeout";
|
|
2761
|
+
}
|
|
2762
|
+
async function probeWithRetry(signal, probe) {
|
|
2763
|
+
try {
|
|
2764
|
+
return await probe();
|
|
2765
|
+
} catch (error62) {
|
|
2766
|
+
if (signal.aborted) {
|
|
2767
|
+
signal.throwIfAborted();
|
|
2768
|
+
}
|
|
2769
|
+
if (!isRetryableProbeFailure(error62)) {
|
|
2770
|
+
throw error62;
|
|
2771
|
+
}
|
|
2772
|
+
return await probe();
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2756
2775
|
function integrationProbeFailure(specification, agent, error62) {
|
|
2757
2776
|
if (error62 instanceof AgentProbeError) {
|
|
2758
2777
|
if (error62.code === "authentication_required") {
|
|
@@ -2779,14 +2798,17 @@ async function discoverAgent(specification, context) {
|
|
|
2779
2798
|
for (const agent of agents) {
|
|
2780
2799
|
let agentVersion = "";
|
|
2781
2800
|
try {
|
|
2782
|
-
agentVersion = await
|
|
2783
|
-
agent,
|
|
2784
|
-
specification.agentVersionArguments,
|
|
2785
|
-
context.environment,
|
|
2786
|
-
context.defaultWorkspace,
|
|
2801
|
+
agentVersion = await probeWithRetry(
|
|
2787
2802
|
context.signal,
|
|
2788
|
-
|
|
2789
|
-
|
|
2803
|
+
async () => await probeVersion(
|
|
2804
|
+
agent,
|
|
2805
|
+
specification.agentVersionArguments,
|
|
2806
|
+
context.environment,
|
|
2807
|
+
context.defaultWorkspace,
|
|
2808
|
+
context.signal,
|
|
2809
|
+
specification.versionProbeTimeoutMilliseconds,
|
|
2810
|
+
specification.normalizeAgentVersion
|
|
2811
|
+
)
|
|
2790
2812
|
);
|
|
2791
2813
|
} catch (error62) {
|
|
2792
2814
|
if (context.signal.aborted) {
|
|
@@ -2813,17 +2835,20 @@ async function discoverAgent(specification, context) {
|
|
|
2813
2835
|
try {
|
|
2814
2836
|
launchEnvironment = await specification.createLaunchEnvironment(agent, context);
|
|
2815
2837
|
if (specification.adapterVersionArguments.length > 0) {
|
|
2816
|
-
adapterVersion = await
|
|
2817
|
-
adapter,
|
|
2818
|
-
specification.adapterVersionArguments,
|
|
2819
|
-
{
|
|
2820
|
-
...context.environment,
|
|
2821
|
-
...launchEnvironment
|
|
2822
|
-
},
|
|
2823
|
-
context.defaultWorkspace,
|
|
2838
|
+
adapterVersion = await probeWithRetry(
|
|
2824
2839
|
context.signal,
|
|
2825
|
-
|
|
2826
|
-
|
|
2840
|
+
async () => await probeVersion(
|
|
2841
|
+
adapter,
|
|
2842
|
+
specification.adapterVersionArguments,
|
|
2843
|
+
{
|
|
2844
|
+
...context.environment,
|
|
2845
|
+
...launchEnvironment
|
|
2846
|
+
},
|
|
2847
|
+
context.defaultWorkspace,
|
|
2848
|
+
context.signal,
|
|
2849
|
+
specification.versionProbeTimeoutMilliseconds,
|
|
2850
|
+
specification.normalizeAdapterVersion
|
|
2851
|
+
)
|
|
2827
2852
|
);
|
|
2828
2853
|
}
|
|
2829
2854
|
} catch (error62) {
|
|
@@ -2845,12 +2870,15 @@ async function discoverAgent(specification, context) {
|
|
|
2845
2870
|
agent.identity
|
|
2846
2871
|
);
|
|
2847
2872
|
try {
|
|
2848
|
-
const readiness = await
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2873
|
+
const readiness = await probeWithRetry(
|
|
2874
|
+
context.signal,
|
|
2875
|
+
async () => await probeAcpReadiness(
|
|
2876
|
+
specification,
|
|
2877
|
+
definition2,
|
|
2878
|
+
context.environment,
|
|
2879
|
+
context.defaultWorkspace,
|
|
2880
|
+
context.signal
|
|
2881
|
+
)
|
|
2854
2882
|
);
|
|
2855
2883
|
const verifiedAdapterVersion = adapterVersion.length > 0 ? adapterVersion : readiness.adapterVersion;
|
|
2856
2884
|
if (verifiedAdapterVersion.length === 0) {
|
|
@@ -22768,6 +22796,7 @@ var agentModelEffortSchema = external_exports.strictObject({
|
|
|
22768
22796
|
effortSettingId: external_exports.string().max(128),
|
|
22769
22797
|
modelSettingId: external_exports.string().max(128),
|
|
22770
22798
|
resolution: agentModelEffortResolutionSchema,
|
|
22799
|
+
unsupportedModelIds: external_exports.array(external_exports.string().min(1).max(500)).max(500).readonly().default([]),
|
|
22771
22800
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
22772
22801
|
}).readonly();
|
|
22773
22802
|
var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
|
|
@@ -23760,21 +23789,30 @@ var historyMessage = external_exports.strictObject({
|
|
|
23760
23789
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT),
|
|
23761
23790
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
23762
23791
|
}).readonly();
|
|
23763
|
-
var
|
|
23764
|
-
external_exports.
|
|
23765
|
-
|
|
23766
|
-
|
|
23767
|
-
|
|
23768
|
-
|
|
23769
|
-
|
|
23770
|
-
|
|
23771
|
-
|
|
23772
|
-
|
|
23773
|
-
|
|
23792
|
+
var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
23793
|
+
status: external_exports.literal("available"),
|
|
23794
|
+
messages: external_exports.array(historyMessage).max(SESSION_HISTORY_MESSAGE_LIMIT).readonly(),
|
|
23795
|
+
truncated: external_exports.boolean(),
|
|
23796
|
+
coveredCommandIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/)).max(1e4).readonly(),
|
|
23797
|
+
coveredMessageIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}:(?:user|agent)$/)).max(2e4).readonly().default([])
|
|
23798
|
+
});
|
|
23799
|
+
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
23800
|
+
var unavailableSessionHistoryObjectSchema = external_exports.strictObject({ status: external_exports.literal("unavailable") });
|
|
23801
|
+
var unavailableSessionHistorySchema = unavailableSessionHistoryObjectSchema.readonly();
|
|
23802
|
+
function withinHistoryContentLimits(history) {
|
|
23803
|
+
if (history.status === "unavailable" || history.messages === void 0) {
|
|
23804
|
+
return true;
|
|
23805
|
+
}
|
|
23806
|
+
return history.messages.reduce((total, message) => total + message.text.length, 0) <= SESSION_HISTORY_CHARACTER_LIMIT && history.messages.reduce(
|
|
23774
23807
|
(total, message) => total + (message.images ?? []).reduce((size, image) => size + image.data.length, 0),
|
|
23775
23808
|
0
|
|
23776
|
-
) <= SESSION_HISTORY_IMAGE_CHARACTER_LIMIT
|
|
23777
|
-
|
|
23809
|
+
) <= SESSION_HISTORY_IMAGE_CHARACTER_LIMIT;
|
|
23810
|
+
}
|
|
23811
|
+
var sessionHistorySchema = external_exports.discriminatedUnion("status", [availableSessionHistorySchema, unavailableSessionHistorySchema]).refine(withinHistoryContentLimits);
|
|
23812
|
+
var sessionHistoryPageSchema = external_exports.discriminatedUnion("status", [
|
|
23813
|
+
availableSessionHistoryObjectSchema.extend({ nextCursor: external_exports.string().max(512).nullable() }).readonly(),
|
|
23814
|
+
unavailableSessionHistoryObjectSchema.extend({ nextCursor: external_exports.null() }).readonly()
|
|
23815
|
+
]).refine(withinHistoryContentLimits);
|
|
23778
23816
|
|
|
23779
23817
|
// ../protocol/src/native-sessions.ts
|
|
23780
23818
|
var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
@@ -34053,6 +34091,20 @@ var AcpExecutionError = class extends Error {
|
|
|
34053
34091
|
this.name = "AcpExecutionError";
|
|
34054
34092
|
}
|
|
34055
34093
|
};
|
|
34094
|
+
var AcpConfigurationValueUnavailableError = class extends AcpExecutionError {
|
|
34095
|
+
configId;
|
|
34096
|
+
offeredValueCount;
|
|
34097
|
+
offeredValues;
|
|
34098
|
+
requestedValue;
|
|
34099
|
+
constructor(configId, requestedValue, offeredValues) {
|
|
34100
|
+
super("The requested ACP configuration value is unavailable", {}, "invalid_session_configuration");
|
|
34101
|
+
this.name = "AcpConfigurationValueUnavailableError";
|
|
34102
|
+
this.configId = configId.slice(0, 128);
|
|
34103
|
+
this.requestedValue = requestedValue.slice(0, 128);
|
|
34104
|
+
this.offeredValueCount = offeredValues.length;
|
|
34105
|
+
this.offeredValues = Object.freeze(offeredValues.slice(0, 32).map((value) => value.slice(0, 128)));
|
|
34106
|
+
}
|
|
34107
|
+
};
|
|
34056
34108
|
var RetryableAcpInitializationError = class extends AcpExecutionError {
|
|
34057
34109
|
constructor(cause) {
|
|
34058
34110
|
super("ACP agent initialization failed", { cause });
|
|
@@ -35135,10 +35187,10 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
35135
35187
|
);
|
|
35136
35188
|
}
|
|
35137
35189
|
if (!existing.values.some((entry) => entry.value === options.value)) {
|
|
35138
|
-
throw new
|
|
35139
|
-
|
|
35140
|
-
|
|
35141
|
-
|
|
35190
|
+
throw new AcpConfigurationValueUnavailableError(
|
|
35191
|
+
options.configId,
|
|
35192
|
+
options.value,
|
|
35193
|
+
existing.values.map((entry) => entry.value)
|
|
35142
35194
|
);
|
|
35143
35195
|
}
|
|
35144
35196
|
}
|
|
@@ -40300,6 +40352,19 @@ function operationErrorMessage(error62) {
|
|
|
40300
40352
|
}
|
|
40301
40353
|
return "The local agent operation could not be completed";
|
|
40302
40354
|
}
|
|
40355
|
+
function agentSettingsFailureDetails(agentId, failure2) {
|
|
40356
|
+
const details = { agentId, code: operationErrorCode(failure2) };
|
|
40357
|
+
if (!(failure2 instanceof AcpConfigurationValueUnavailableError)) {
|
|
40358
|
+
return details;
|
|
40359
|
+
}
|
|
40360
|
+
return {
|
|
40361
|
+
...details,
|
|
40362
|
+
configId: failure2.configId,
|
|
40363
|
+
offeredValueCount: failure2.offeredValueCount.toString(),
|
|
40364
|
+
offeredValues: JSON.stringify(failure2.offeredValues),
|
|
40365
|
+
requestedValue: failure2.requestedValue
|
|
40366
|
+
};
|
|
40367
|
+
}
|
|
40303
40368
|
function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTimings = []) {
|
|
40304
40369
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
40305
40370
|
return;
|
|
@@ -40332,6 +40397,12 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
40332
40397
|
}
|
|
40333
40398
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
40334
40399
|
}
|
|
40400
|
+
function isUnavailableModel(cause, modelSettingId, requestedModel) {
|
|
40401
|
+
return cause instanceof AcpConfigurationValueUnavailableError && cause.configId === modelSettingId && cause.requestedValue === requestedModel;
|
|
40402
|
+
}
|
|
40403
|
+
function unsupportedModelIds(unsupportedModels) {
|
|
40404
|
+
return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
|
|
40405
|
+
}
|
|
40335
40406
|
async function discoverAgentSettings(command, config2, directories, sessions, signal) {
|
|
40336
40407
|
const agent = config2.catalog.find(command.agentId);
|
|
40337
40408
|
const cwd = await directories.resolve(config2.bindingId, "default", signal);
|
|
@@ -40341,35 +40412,70 @@ async function discoverAgentSettings(command, config2, directories, sessions, si
|
|
|
40341
40412
|
cwd,
|
|
40342
40413
|
signal
|
|
40343
40414
|
});
|
|
40344
|
-
const
|
|
40345
|
-
|
|
40346
|
-
|
|
40347
|
-
|
|
40348
|
-
|
|
40349
|
-
|
|
40350
|
-
|
|
40415
|
+
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
40416
|
+
const unsupportedModels = [];
|
|
40417
|
+
let selectedSnapshot = baseSnapshot;
|
|
40418
|
+
if (command.model !== void 0) {
|
|
40419
|
+
if (baseModel === void 0 || baseModel.type !== "select" || !baseModel.values.some((value) => value.value === command.model)) {
|
|
40420
|
+
unsupportedModels.push(
|
|
40421
|
+
new AcpConfigurationValueUnavailableError(
|
|
40422
|
+
baseModel?.id ?? "model",
|
|
40423
|
+
command.model,
|
|
40424
|
+
baseModel?.values.map((value) => value.value) ?? []
|
|
40425
|
+
)
|
|
40426
|
+
);
|
|
40427
|
+
} else {
|
|
40428
|
+
try {
|
|
40429
|
+
selectedSnapshot = await sessions.inspectAgentSettings({
|
|
40430
|
+
additionalDirectories: [],
|
|
40431
|
+
agent,
|
|
40432
|
+
cwd,
|
|
40433
|
+
model: command.model,
|
|
40434
|
+
signal
|
|
40435
|
+
});
|
|
40436
|
+
} catch (cause) {
|
|
40437
|
+
signal.throwIfAborted();
|
|
40438
|
+
if (!isUnavailableModel(cause, baseModel.id, command.model)) {
|
|
40439
|
+
throw cause;
|
|
40440
|
+
}
|
|
40441
|
+
unsupportedModels.push(cause);
|
|
40442
|
+
}
|
|
40443
|
+
}
|
|
40444
|
+
}
|
|
40351
40445
|
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
40352
|
-
const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
|
|
40353
|
-
const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
|
|
40354
40446
|
const modelEffort = await discoverModelEffort(
|
|
40355
40447
|
command,
|
|
40356
40448
|
agent,
|
|
40357
40449
|
adapter.modelEffortResolution,
|
|
40358
40450
|
baseSnapshot.configOptions,
|
|
40359
40451
|
selectedSnapshot.configOptions,
|
|
40452
|
+
unsupportedModels,
|
|
40360
40453
|
cwd,
|
|
40361
40454
|
sessions,
|
|
40362
40455
|
signal
|
|
40363
40456
|
);
|
|
40457
|
+
const baseSettings = withoutUnsupportedModels(
|
|
40458
|
+
settingsFromSnapshot(agent, baseSnapshot.configOptions),
|
|
40459
|
+
baseModel?.id ?? "",
|
|
40460
|
+
modelEffort.unsupportedModelIds
|
|
40461
|
+
);
|
|
40462
|
+
const settings = withoutUnsupportedModels(
|
|
40463
|
+
settingsFromSnapshot(agent, selectedSnapshot.configOptions),
|
|
40464
|
+
baseModel?.id ?? "",
|
|
40465
|
+
modelEffort.unsupportedModelIds
|
|
40466
|
+
);
|
|
40364
40467
|
return {
|
|
40365
|
-
|
|
40366
|
-
|
|
40367
|
-
|
|
40368
|
-
|
|
40369
|
-
|
|
40370
|
-
|
|
40371
|
-
|
|
40372
|
-
|
|
40468
|
+
event: {
|
|
40469
|
+
agentId: command.agentId,
|
|
40470
|
+
agentName: selectedSnapshot.agentName,
|
|
40471
|
+
agentVersion: selectedSnapshot.agentVersion,
|
|
40472
|
+
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
40473
|
+
modelEffort,
|
|
40474
|
+
requestId: command.requestId,
|
|
40475
|
+
settings,
|
|
40476
|
+
settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort)
|
|
40477
|
+
},
|
|
40478
|
+
unsupportedModels
|
|
40373
40479
|
};
|
|
40374
40480
|
}
|
|
40375
40481
|
function settingFromOption(option) {
|
|
@@ -40405,6 +40511,22 @@ function settingsFromSnapshot(agent, configOptions) {
|
|
|
40405
40511
|
}
|
|
40406
40512
|
return settings;
|
|
40407
40513
|
}
|
|
40514
|
+
function withoutUnsupportedModels(settings, modelSettingId, unsupportedModelIds2) {
|
|
40515
|
+
if (modelSettingId.length === 0 || unsupportedModelIds2.length === 0) {
|
|
40516
|
+
return settings;
|
|
40517
|
+
}
|
|
40518
|
+
const unsupported = new Set(unsupportedModelIds2);
|
|
40519
|
+
return settings.map((setting) => {
|
|
40520
|
+
if (setting.id !== modelSettingId || setting.type !== "select") {
|
|
40521
|
+
return setting;
|
|
40522
|
+
}
|
|
40523
|
+
return {
|
|
40524
|
+
...setting,
|
|
40525
|
+
defaultValue: unsupported.has(setting.defaultValue) ? "" : setting.defaultValue,
|
|
40526
|
+
values: setting.values.filter((value) => !unsupported.has(value.value))
|
|
40527
|
+
};
|
|
40528
|
+
});
|
|
40529
|
+
}
|
|
40408
40530
|
function modelOption(options) {
|
|
40409
40531
|
return options.find((option) => option.id === "model" || option.category === "model");
|
|
40410
40532
|
}
|
|
@@ -40416,16 +40538,18 @@ function unavailableModelEffort() {
|
|
|
40416
40538
|
effortSettingId: "",
|
|
40417
40539
|
modelSettingId: "",
|
|
40418
40540
|
resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
|
|
40541
|
+
unsupportedModelIds: [],
|
|
40419
40542
|
valuesByModel: {}
|
|
40420
40543
|
};
|
|
40421
40544
|
}
|
|
40422
|
-
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
|
|
40545
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
|
|
40423
40546
|
const model = modelOption(initialOptions);
|
|
40547
|
+
const unsupportedModels = initiallyUnsupportedModels;
|
|
40424
40548
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
40425
|
-
return unavailableModelEffort();
|
|
40549
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
40426
40550
|
}
|
|
40427
40551
|
if (model === void 0 || model.type !== "select" || model.values.length === 0) {
|
|
40428
|
-
return unavailableModelEffort();
|
|
40552
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
40429
40553
|
}
|
|
40430
40554
|
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
40431
40555
|
additionalDirectories: [],
|
|
@@ -40438,42 +40562,70 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
40438
40562
|
if (resolution === "complete") {
|
|
40439
40563
|
const effort = effortOption(initialOptions);
|
|
40440
40564
|
if (effort === void 0 || effort.type !== "select" || effort.values.length < 2) {
|
|
40441
|
-
return
|
|
40565
|
+
return {
|
|
40566
|
+
...unavailableModelEffort(),
|
|
40567
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels)
|
|
40568
|
+
};
|
|
40442
40569
|
}
|
|
40443
40570
|
for (const value of model.values) {
|
|
40444
|
-
|
|
40445
|
-
|
|
40571
|
+
if (unsupportedModels.some((diagnostic) => diagnostic.requestedValue === value.value)) {
|
|
40572
|
+
continue;
|
|
40573
|
+
}
|
|
40574
|
+
try {
|
|
40575
|
+
const selectedEffort2 = effortOption(await inspectModel(value.value));
|
|
40576
|
+
valuesByModel[value.value] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40577
|
+
} catch (cause) {
|
|
40578
|
+
signal.throwIfAborted();
|
|
40579
|
+
if (!isUnavailableModel(cause, model.id, value.value)) {
|
|
40580
|
+
throw cause;
|
|
40581
|
+
}
|
|
40582
|
+
unsupportedModels.push(cause);
|
|
40583
|
+
}
|
|
40446
40584
|
}
|
|
40447
40585
|
return {
|
|
40448
40586
|
effortSettingId: effort.id,
|
|
40449
40587
|
modelSettingId: model.id,
|
|
40450
40588
|
resolution: "complete",
|
|
40589
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40451
40590
|
valuesByModel
|
|
40452
40591
|
};
|
|
40453
40592
|
}
|
|
40454
40593
|
if (command.model !== void 0) {
|
|
40455
|
-
|
|
40456
|
-
throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
|
|
40457
|
-
}
|
|
40594
|
+
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command.model);
|
|
40458
40595
|
const selectedEffort2 = effortOption(selectedOptions);
|
|
40459
|
-
|
|
40596
|
+
if (!modelUnsupported) {
|
|
40597
|
+
valuesByModel[command.model] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40598
|
+
}
|
|
40460
40599
|
return {
|
|
40461
40600
|
effortSettingId: selectedEffort2?.id ?? "",
|
|
40462
40601
|
modelSettingId: model.id,
|
|
40463
40602
|
resolution: "on_model_selection",
|
|
40603
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40464
40604
|
valuesByModel
|
|
40465
40605
|
};
|
|
40466
40606
|
}
|
|
40467
40607
|
const defaultModel = model.type === "select" ? model.currentValue : "";
|
|
40468
40608
|
const reportedEffort = effortOption(selectedOptions);
|
|
40469
|
-
|
|
40470
|
-
if (defaultModel.length > 0) {
|
|
40609
|
+
let selectedEffort = reportedEffort;
|
|
40610
|
+
if (defaultModel.length > 0 && reportedEffort === void 0) {
|
|
40611
|
+
try {
|
|
40612
|
+
selectedEffort = effortOption(await inspectModel(defaultModel));
|
|
40613
|
+
} catch (cause) {
|
|
40614
|
+
signal.throwIfAborted();
|
|
40615
|
+
if (!isUnavailableModel(cause, model.id, defaultModel)) {
|
|
40616
|
+
throw cause;
|
|
40617
|
+
}
|
|
40618
|
+
unsupportedModels.push(cause);
|
|
40619
|
+
}
|
|
40620
|
+
}
|
|
40621
|
+
if (defaultModel.length > 0 && !unsupportedModels.some((diagnostic) => diagnostic.requestedValue === defaultModel)) {
|
|
40471
40622
|
valuesByModel[defaultModel] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
40472
40623
|
}
|
|
40473
40624
|
return {
|
|
40474
40625
|
effortSettingId: selectedEffort?.id ?? "",
|
|
40475
40626
|
modelSettingId: model.id,
|
|
40476
40627
|
resolution: "on_model_selection",
|
|
40628
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40477
40629
|
valuesByModel
|
|
40478
40630
|
};
|
|
40479
40631
|
}
|
|
@@ -40482,6 +40634,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
40482
40634
|
effortSettingId: "",
|
|
40483
40635
|
modelSettingId: modelEffort.modelSettingId,
|
|
40484
40636
|
resolution: modelEffort.resolution,
|
|
40637
|
+
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
40485
40638
|
valuesByModel: {}
|
|
40486
40639
|
};
|
|
40487
40640
|
return createHash4("sha256").update(
|
|
@@ -40589,9 +40742,11 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40589
40742
|
sessionId: command.sessionId,
|
|
40590
40743
|
runtimeTimings: metrics.snapshot()
|
|
40591
40744
|
};
|
|
40592
|
-
|
|
40593
|
-
|
|
40594
|
-
|
|
40745
|
+
if (command.transient !== true) {
|
|
40746
|
+
metrics.measureSync("readiness-commit", () => {
|
|
40747
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
40748
|
+
});
|
|
40749
|
+
}
|
|
40595
40750
|
return event;
|
|
40596
40751
|
});
|
|
40597
40752
|
send(socket, {
|
|
@@ -40746,7 +40901,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40746
40901
|
signal
|
|
40747
40902
|
});
|
|
40748
40903
|
if (command.disposition === SessionPromptDisposition.Steer) {
|
|
40749
|
-
|
|
40904
|
+
assertAppliedSessionConfiguration(prepared.configOptions, sessionConfigurations ?? []);
|
|
40750
40905
|
} else {
|
|
40751
40906
|
await applyCompleteSessionConfiguration(
|
|
40752
40907
|
sessions,
|
|
@@ -40884,21 +41039,6 @@ function validateSessionConfigurationSelection(option, selection) {
|
|
|
40884
41039
|
throw invalidSessionConfiguration(`The Agent setting ${selection.configId} has an unavailable value`);
|
|
40885
41040
|
}
|
|
40886
41041
|
}
|
|
40887
|
-
function assertSessionConfigurationSchema(options, selections) {
|
|
40888
|
-
if (options.length !== selections.length) {
|
|
40889
|
-
throw invalidSessionConfiguration("The Turn configuration does not match the Agent settings schema");
|
|
40890
|
-
}
|
|
40891
|
-
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40892
|
-
if (selectionsById.size !== selections.length) {
|
|
40893
|
-
throw invalidSessionConfiguration("The Turn configuration contains duplicate Agent settings");
|
|
40894
|
-
}
|
|
40895
|
-
for (const option of options) {
|
|
40896
|
-
const selection = selectionsById.get(option.id);
|
|
40897
|
-
if (selection === void 0 || selection.valueType !== option.type || option.type === "boolean" && selection.value.length > 0 || option.type === "select" && selection.booleanValue) {
|
|
40898
|
-
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
|
|
40899
|
-
}
|
|
40900
|
-
}
|
|
40901
|
-
}
|
|
40902
41042
|
function sessionConfigurationSelectionIsAvailable(option, selection) {
|
|
40903
41043
|
if (option.type !== selection.valueType) {
|
|
40904
41044
|
return false;
|
|
@@ -40925,16 +41065,6 @@ function sessionConfigurationPriority(selection, options) {
|
|
|
40925
41065
|
}
|
|
40926
41066
|
return 3;
|
|
40927
41067
|
}
|
|
40928
|
-
function assertCompleteSessionConfiguration(options, selections) {
|
|
40929
|
-
assertSessionConfigurationSchema(options, selections);
|
|
40930
|
-
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40931
|
-
for (const option of options) {
|
|
40932
|
-
const selection = selectionsById.get(option.id);
|
|
40933
|
-
if (selection === void 0 || !sessionConfigurationMatches(option, selection)) {
|
|
40934
|
-
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
|
|
40935
|
-
}
|
|
40936
|
-
}
|
|
40937
|
-
}
|
|
40938
41068
|
function assertAppliedSessionConfiguration(options, selections) {
|
|
40939
41069
|
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40940
41070
|
for (const option of options) {
|
|
@@ -41573,14 +41703,30 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41573
41703
|
sessions,
|
|
41574
41704
|
operationSignal
|
|
41575
41705
|
);
|
|
41706
|
+
for (const diagnostic of result.unsupportedModels) {
|
|
41707
|
+
const details = agentSettingsFailureDetails(command2.agentId, diagnostic);
|
|
41708
|
+
audit.record({
|
|
41709
|
+
commandId: command2.requestId,
|
|
41710
|
+
details,
|
|
41711
|
+
event: "agent_settings_model_unsupported",
|
|
41712
|
+
sessionId: `agent-settings:${command2.agentId}`
|
|
41713
|
+
});
|
|
41714
|
+
process.stderr.write(
|
|
41715
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command2.requestId, ...details })}
|
|
41716
|
+
`
|
|
41717
|
+
);
|
|
41718
|
+
}
|
|
41576
41719
|
audit.record({
|
|
41577
41720
|
commandId: command2.requestId,
|
|
41578
|
-
details: {
|
|
41721
|
+
details: {
|
|
41722
|
+
agentId: command2.agentId,
|
|
41723
|
+
unsupportedModelCount: result.unsupportedModels.length.toString()
|
|
41724
|
+
},
|
|
41579
41725
|
event: "agent_settings_discovered",
|
|
41580
41726
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41581
41727
|
});
|
|
41582
41728
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41583
|
-
send(socket, result);
|
|
41729
|
+
send(socket, result.event);
|
|
41584
41730
|
}
|
|
41585
41731
|
} catch (error62) {
|
|
41586
41732
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41588,12 +41734,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41588
41734
|
{},
|
|
41589
41735
|
"agent_settings_discovery_cancelled"
|
|
41590
41736
|
) : error62;
|
|
41737
|
+
const details = agentSettingsFailureDetails(command2.agentId, failure2);
|
|
41591
41738
|
audit.record({
|
|
41592
41739
|
commandId: command2.requestId,
|
|
41593
|
-
details
|
|
41740
|
+
details,
|
|
41594
41741
|
event: "agent_settings_discovery_failed",
|
|
41595
41742
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41596
41743
|
});
|
|
41744
|
+
if (failure2 instanceof AcpConfigurationValueUnavailableError) {
|
|
41745
|
+
process.stderr.write(
|
|
41746
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command2.requestId, ...details })}
|
|
41747
|
+
`
|
|
41748
|
+
);
|
|
41749
|
+
}
|
|
41597
41750
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41598
41751
|
send(socket, {
|
|
41599
41752
|
code: operationErrorCode(failure2),
|