@moxt-ai/mobius 0.0.66 → 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/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 +256 -78
- package/dist/cli.js.map +3 -3
- package/dist/index.js +255 -77
- package/dist/index.js.map +3 -3
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +154 -41
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +255 -77
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -1154,8 +1154,8 @@ function normalizeVersionOutput(output2) {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
|
|
1156
1156
|
// src/agent-catalog/agent-specification.ts
|
|
1157
|
-
var VERSION_PROBE_TIMEOUT_MILLISECONDS =
|
|
1158
|
-
var ACP_PROBE_TIMEOUT_MILLISECONDS =
|
|
1157
|
+
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e4;
|
|
1158
|
+
var ACP_PROBE_TIMEOUT_MILLISECONDS = 6e4;
|
|
1159
1159
|
var LocalAgentSpecification = class {
|
|
1160
1160
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
1161
1161
|
authenticationCommand = () => "";
|
|
@@ -2622,6 +2622,25 @@ function agentProbeFailure(specification, error62) {
|
|
|
2622
2622
|
}
|
|
2623
2623
|
return new AgentProbeFailed(specification, "agent_probe_failed", "Agent probe failed");
|
|
2624
2624
|
}
|
|
2625
|
+
function isRetryableProbeFailure(error62) {
|
|
2626
|
+
if (error62 instanceof ProcessExecutionError) {
|
|
2627
|
+
return error62.code === "process_timeout";
|
|
2628
|
+
}
|
|
2629
|
+
return error62 instanceof AgentProbeError && error62.code === "adapter_probe_timeout";
|
|
2630
|
+
}
|
|
2631
|
+
async function probeWithRetry(signal, probe) {
|
|
2632
|
+
try {
|
|
2633
|
+
return await probe();
|
|
2634
|
+
} catch (error62) {
|
|
2635
|
+
if (signal.aborted) {
|
|
2636
|
+
signal.throwIfAborted();
|
|
2637
|
+
}
|
|
2638
|
+
if (!isRetryableProbeFailure(error62)) {
|
|
2639
|
+
throw error62;
|
|
2640
|
+
}
|
|
2641
|
+
return await probe();
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2625
2644
|
function integrationProbeFailure(specification, agent, error62) {
|
|
2626
2645
|
if (error62 instanceof AgentProbeError) {
|
|
2627
2646
|
if (error62.code === "authentication_required") {
|
|
@@ -2648,14 +2667,17 @@ async function discoverAgent(specification, context) {
|
|
|
2648
2667
|
for (const agent of agents) {
|
|
2649
2668
|
let agentVersion = "";
|
|
2650
2669
|
try {
|
|
2651
|
-
agentVersion = await
|
|
2652
|
-
agent,
|
|
2653
|
-
specification.agentVersionArguments,
|
|
2654
|
-
context.environment,
|
|
2655
|
-
context.defaultWorkspace,
|
|
2670
|
+
agentVersion = await probeWithRetry(
|
|
2656
2671
|
context.signal,
|
|
2657
|
-
|
|
2658
|
-
|
|
2672
|
+
async () => await probeVersion(
|
|
2673
|
+
agent,
|
|
2674
|
+
specification.agentVersionArguments,
|
|
2675
|
+
context.environment,
|
|
2676
|
+
context.defaultWorkspace,
|
|
2677
|
+
context.signal,
|
|
2678
|
+
specification.versionProbeTimeoutMilliseconds,
|
|
2679
|
+
specification.normalizeAgentVersion
|
|
2680
|
+
)
|
|
2659
2681
|
);
|
|
2660
2682
|
} catch (error62) {
|
|
2661
2683
|
if (context.signal.aborted) {
|
|
@@ -2682,17 +2704,20 @@ async function discoverAgent(specification, context) {
|
|
|
2682
2704
|
try {
|
|
2683
2705
|
launchEnvironment = await specification.createLaunchEnvironment(agent, context);
|
|
2684
2706
|
if (specification.adapterVersionArguments.length > 0) {
|
|
2685
|
-
adapterVersion = await
|
|
2686
|
-
adapter,
|
|
2687
|
-
specification.adapterVersionArguments,
|
|
2688
|
-
{
|
|
2689
|
-
...context.environment,
|
|
2690
|
-
...launchEnvironment
|
|
2691
|
-
},
|
|
2692
|
-
context.defaultWorkspace,
|
|
2707
|
+
adapterVersion = await probeWithRetry(
|
|
2693
2708
|
context.signal,
|
|
2694
|
-
|
|
2695
|
-
|
|
2709
|
+
async () => await probeVersion(
|
|
2710
|
+
adapter,
|
|
2711
|
+
specification.adapterVersionArguments,
|
|
2712
|
+
{
|
|
2713
|
+
...context.environment,
|
|
2714
|
+
...launchEnvironment
|
|
2715
|
+
},
|
|
2716
|
+
context.defaultWorkspace,
|
|
2717
|
+
context.signal,
|
|
2718
|
+
specification.versionProbeTimeoutMilliseconds,
|
|
2719
|
+
specification.normalizeAdapterVersion
|
|
2720
|
+
)
|
|
2696
2721
|
);
|
|
2697
2722
|
}
|
|
2698
2723
|
} catch (error62) {
|
|
@@ -2714,12 +2739,15 @@ async function discoverAgent(specification, context) {
|
|
|
2714
2739
|
agent.identity
|
|
2715
2740
|
);
|
|
2716
2741
|
try {
|
|
2717
|
-
const readiness = await
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2742
|
+
const readiness = await probeWithRetry(
|
|
2743
|
+
context.signal,
|
|
2744
|
+
async () => await probeAcpReadiness(
|
|
2745
|
+
specification,
|
|
2746
|
+
definition2,
|
|
2747
|
+
context.environment,
|
|
2748
|
+
context.defaultWorkspace,
|
|
2749
|
+
context.signal
|
|
2750
|
+
)
|
|
2723
2751
|
);
|
|
2724
2752
|
const verifiedAdapterVersion = adapterVersion.length > 0 ? adapterVersion : readiness.adapterVersion;
|
|
2725
2753
|
if (verifiedAdapterVersion.length === 0) {
|
|
@@ -22685,6 +22713,7 @@ var agentModelEffortSchema = external_exports.strictObject({
|
|
|
22685
22713
|
effortSettingId: external_exports.string().max(128),
|
|
22686
22714
|
modelSettingId: external_exports.string().max(128),
|
|
22687
22715
|
resolution: agentModelEffortResolutionSchema,
|
|
22716
|
+
unsupportedModelIds: external_exports.array(external_exports.string().min(1).max(500)).max(500).readonly().default([]),
|
|
22688
22717
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
22689
22718
|
}).readonly();
|
|
22690
22719
|
var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
|
|
@@ -23677,21 +23706,30 @@ var historyMessage = external_exports.strictObject({
|
|
|
23677
23706
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT),
|
|
23678
23707
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
23679
23708
|
}).readonly();
|
|
23680
|
-
var
|
|
23681
|
-
external_exports.
|
|
23682
|
-
|
|
23683
|
-
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
|
|
23709
|
+
var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
23710
|
+
status: external_exports.literal("available"),
|
|
23711
|
+
messages: external_exports.array(historyMessage).max(SESSION_HISTORY_MESSAGE_LIMIT).readonly(),
|
|
23712
|
+
truncated: external_exports.boolean(),
|
|
23713
|
+
coveredCommandIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/)).max(1e4).readonly(),
|
|
23714
|
+
coveredMessageIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}:(?:user|agent)$/)).max(2e4).readonly().default([])
|
|
23715
|
+
});
|
|
23716
|
+
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
23717
|
+
var unavailableSessionHistoryObjectSchema = external_exports.strictObject({ status: external_exports.literal("unavailable") });
|
|
23718
|
+
var unavailableSessionHistorySchema = unavailableSessionHistoryObjectSchema.readonly();
|
|
23719
|
+
function withinHistoryContentLimits(history) {
|
|
23720
|
+
if (history.status === "unavailable" || history.messages === void 0) {
|
|
23721
|
+
return true;
|
|
23722
|
+
}
|
|
23723
|
+
return history.messages.reduce((total, message) => total + message.text.length, 0) <= SESSION_HISTORY_CHARACTER_LIMIT && history.messages.reduce(
|
|
23691
23724
|
(total, message) => total + (message.images ?? []).reduce((size, image) => size + image.data.length, 0),
|
|
23692
23725
|
0
|
|
23693
|
-
) <= SESSION_HISTORY_IMAGE_CHARACTER_LIMIT
|
|
23694
|
-
|
|
23726
|
+
) <= SESSION_HISTORY_IMAGE_CHARACTER_LIMIT;
|
|
23727
|
+
}
|
|
23728
|
+
var sessionHistorySchema = external_exports.discriminatedUnion("status", [availableSessionHistorySchema, unavailableSessionHistorySchema]).refine(withinHistoryContentLimits);
|
|
23729
|
+
var sessionHistoryPageSchema = external_exports.discriminatedUnion("status", [
|
|
23730
|
+
availableSessionHistoryObjectSchema.extend({ nextCursor: external_exports.string().max(512).nullable() }).readonly(),
|
|
23731
|
+
unavailableSessionHistoryObjectSchema.extend({ nextCursor: external_exports.null() }).readonly()
|
|
23732
|
+
]).refine(withinHistoryContentLimits);
|
|
23695
23733
|
|
|
23696
23734
|
// ../protocol/src/native-sessions.ts
|
|
23697
23735
|
var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
@@ -33055,6 +33093,20 @@ var AcpExecutionError = class extends Error {
|
|
|
33055
33093
|
this.name = "AcpExecutionError";
|
|
33056
33094
|
}
|
|
33057
33095
|
};
|
|
33096
|
+
var AcpConfigurationValueUnavailableError = class extends AcpExecutionError {
|
|
33097
|
+
configId;
|
|
33098
|
+
offeredValueCount;
|
|
33099
|
+
offeredValues;
|
|
33100
|
+
requestedValue;
|
|
33101
|
+
constructor(configId, requestedValue, offeredValues) {
|
|
33102
|
+
super("The requested ACP configuration value is unavailable", {}, "invalid_session_configuration");
|
|
33103
|
+
this.name = "AcpConfigurationValueUnavailableError";
|
|
33104
|
+
this.configId = configId.slice(0, 128);
|
|
33105
|
+
this.requestedValue = requestedValue.slice(0, 128);
|
|
33106
|
+
this.offeredValueCount = offeredValues.length;
|
|
33107
|
+
this.offeredValues = Object.freeze(offeredValues.slice(0, 32).map((value) => value.slice(0, 128)));
|
|
33108
|
+
}
|
|
33109
|
+
};
|
|
33058
33110
|
var RetryableAcpInitializationError = class extends AcpExecutionError {
|
|
33059
33111
|
constructor(cause) {
|
|
33060
33112
|
super("ACP agent initialization failed", { cause });
|
|
@@ -34137,10 +34189,10 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
34137
34189
|
);
|
|
34138
34190
|
}
|
|
34139
34191
|
if (!existing.values.some((entry) => entry.value === options.value)) {
|
|
34140
|
-
throw new
|
|
34141
|
-
|
|
34142
|
-
|
|
34143
|
-
|
|
34192
|
+
throw new AcpConfigurationValueUnavailableError(
|
|
34193
|
+
options.configId,
|
|
34194
|
+
options.value,
|
|
34195
|
+
existing.values.map((entry) => entry.value)
|
|
34144
34196
|
);
|
|
34145
34197
|
}
|
|
34146
34198
|
}
|
|
@@ -39302,6 +39354,19 @@ function operationErrorMessage(error62) {
|
|
|
39302
39354
|
}
|
|
39303
39355
|
return "The local agent operation could not be completed";
|
|
39304
39356
|
}
|
|
39357
|
+
function agentSettingsFailureDetails(agentId, failure2) {
|
|
39358
|
+
const details = { agentId, code: operationErrorCode(failure2) };
|
|
39359
|
+
if (!(failure2 instanceof AcpConfigurationValueUnavailableError)) {
|
|
39360
|
+
return details;
|
|
39361
|
+
}
|
|
39362
|
+
return {
|
|
39363
|
+
...details,
|
|
39364
|
+
configId: failure2.configId,
|
|
39365
|
+
offeredValueCount: failure2.offeredValueCount.toString(),
|
|
39366
|
+
offeredValues: JSON.stringify(failure2.offeredValues),
|
|
39367
|
+
requestedValue: failure2.requestedValue
|
|
39368
|
+
};
|
|
39369
|
+
}
|
|
39305
39370
|
function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTimings = []) {
|
|
39306
39371
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
39307
39372
|
return;
|
|
@@ -39334,6 +39399,12 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
39334
39399
|
}
|
|
39335
39400
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
39336
39401
|
}
|
|
39402
|
+
function isUnavailableModel(cause, modelSettingId, requestedModel) {
|
|
39403
|
+
return cause instanceof AcpConfigurationValueUnavailableError && cause.configId === modelSettingId && cause.requestedValue === requestedModel;
|
|
39404
|
+
}
|
|
39405
|
+
function unsupportedModelIds(unsupportedModels) {
|
|
39406
|
+
return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
|
|
39407
|
+
}
|
|
39337
39408
|
async function discoverAgentSettings(command, config2, directories, sessions, signal) {
|
|
39338
39409
|
const agent = config2.catalog.find(command.agentId);
|
|
39339
39410
|
const cwd = await directories.resolve(config2.bindingId, "default", signal);
|
|
@@ -39343,35 +39414,70 @@ async function discoverAgentSettings(command, config2, directories, sessions, si
|
|
|
39343
39414
|
cwd,
|
|
39344
39415
|
signal
|
|
39345
39416
|
});
|
|
39346
|
-
const
|
|
39347
|
-
|
|
39348
|
-
|
|
39349
|
-
|
|
39350
|
-
|
|
39351
|
-
|
|
39352
|
-
|
|
39417
|
+
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
39418
|
+
const unsupportedModels = [];
|
|
39419
|
+
let selectedSnapshot = baseSnapshot;
|
|
39420
|
+
if (command.model !== void 0) {
|
|
39421
|
+
if (baseModel === void 0 || baseModel.type !== "select" || !baseModel.values.some((value) => value.value === command.model)) {
|
|
39422
|
+
unsupportedModels.push(
|
|
39423
|
+
new AcpConfigurationValueUnavailableError(
|
|
39424
|
+
baseModel?.id ?? "model",
|
|
39425
|
+
command.model,
|
|
39426
|
+
baseModel?.values.map((value) => value.value) ?? []
|
|
39427
|
+
)
|
|
39428
|
+
);
|
|
39429
|
+
} else {
|
|
39430
|
+
try {
|
|
39431
|
+
selectedSnapshot = await sessions.inspectAgentSettings({
|
|
39432
|
+
additionalDirectories: [],
|
|
39433
|
+
agent,
|
|
39434
|
+
cwd,
|
|
39435
|
+
model: command.model,
|
|
39436
|
+
signal
|
|
39437
|
+
});
|
|
39438
|
+
} catch (cause) {
|
|
39439
|
+
signal.throwIfAborted();
|
|
39440
|
+
if (!isUnavailableModel(cause, baseModel.id, command.model)) {
|
|
39441
|
+
throw cause;
|
|
39442
|
+
}
|
|
39443
|
+
unsupportedModels.push(cause);
|
|
39444
|
+
}
|
|
39445
|
+
}
|
|
39446
|
+
}
|
|
39353
39447
|
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
39354
|
-
const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
|
|
39355
|
-
const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
|
|
39356
39448
|
const modelEffort = await discoverModelEffort(
|
|
39357
39449
|
command,
|
|
39358
39450
|
agent,
|
|
39359
39451
|
adapter.modelEffortResolution,
|
|
39360
39452
|
baseSnapshot.configOptions,
|
|
39361
39453
|
selectedSnapshot.configOptions,
|
|
39454
|
+
unsupportedModels,
|
|
39362
39455
|
cwd,
|
|
39363
39456
|
sessions,
|
|
39364
39457
|
signal
|
|
39365
39458
|
);
|
|
39459
|
+
const baseSettings = withoutUnsupportedModels(
|
|
39460
|
+
settingsFromSnapshot(agent, baseSnapshot.configOptions),
|
|
39461
|
+
baseModel?.id ?? "",
|
|
39462
|
+
modelEffort.unsupportedModelIds
|
|
39463
|
+
);
|
|
39464
|
+
const settings = withoutUnsupportedModels(
|
|
39465
|
+
settingsFromSnapshot(agent, selectedSnapshot.configOptions),
|
|
39466
|
+
baseModel?.id ?? "",
|
|
39467
|
+
modelEffort.unsupportedModelIds
|
|
39468
|
+
);
|
|
39366
39469
|
return {
|
|
39367
|
-
|
|
39368
|
-
|
|
39369
|
-
|
|
39370
|
-
|
|
39371
|
-
|
|
39372
|
-
|
|
39373
|
-
|
|
39374
|
-
|
|
39470
|
+
event: {
|
|
39471
|
+
agentId: command.agentId,
|
|
39472
|
+
agentName: selectedSnapshot.agentName,
|
|
39473
|
+
agentVersion: selectedSnapshot.agentVersion,
|
|
39474
|
+
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
39475
|
+
modelEffort,
|
|
39476
|
+
requestId: command.requestId,
|
|
39477
|
+
settings,
|
|
39478
|
+
settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort)
|
|
39479
|
+
},
|
|
39480
|
+
unsupportedModels
|
|
39375
39481
|
};
|
|
39376
39482
|
}
|
|
39377
39483
|
function settingFromOption(option) {
|
|
@@ -39407,6 +39513,22 @@ function settingsFromSnapshot(agent, configOptions) {
|
|
|
39407
39513
|
}
|
|
39408
39514
|
return settings;
|
|
39409
39515
|
}
|
|
39516
|
+
function withoutUnsupportedModels(settings, modelSettingId, unsupportedModelIds2) {
|
|
39517
|
+
if (modelSettingId.length === 0 || unsupportedModelIds2.length === 0) {
|
|
39518
|
+
return settings;
|
|
39519
|
+
}
|
|
39520
|
+
const unsupported = new Set(unsupportedModelIds2);
|
|
39521
|
+
return settings.map((setting) => {
|
|
39522
|
+
if (setting.id !== modelSettingId || setting.type !== "select") {
|
|
39523
|
+
return setting;
|
|
39524
|
+
}
|
|
39525
|
+
return {
|
|
39526
|
+
...setting,
|
|
39527
|
+
defaultValue: unsupported.has(setting.defaultValue) ? "" : setting.defaultValue,
|
|
39528
|
+
values: setting.values.filter((value) => !unsupported.has(value.value))
|
|
39529
|
+
};
|
|
39530
|
+
});
|
|
39531
|
+
}
|
|
39410
39532
|
function modelOption(options) {
|
|
39411
39533
|
return options.find((option) => option.id === "model" || option.category === "model");
|
|
39412
39534
|
}
|
|
@@ -39418,16 +39540,18 @@ function unavailableModelEffort() {
|
|
|
39418
39540
|
effortSettingId: "",
|
|
39419
39541
|
modelSettingId: "",
|
|
39420
39542
|
resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
|
|
39543
|
+
unsupportedModelIds: [],
|
|
39421
39544
|
valuesByModel: {}
|
|
39422
39545
|
};
|
|
39423
39546
|
}
|
|
39424
|
-
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
|
|
39547
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
|
|
39425
39548
|
const model = modelOption(initialOptions);
|
|
39549
|
+
const unsupportedModels = initiallyUnsupportedModels;
|
|
39426
39550
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
39427
|
-
return unavailableModelEffort();
|
|
39551
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
39428
39552
|
}
|
|
39429
39553
|
if (model === void 0 || model.type !== "select" || model.values.length === 0) {
|
|
39430
|
-
return unavailableModelEffort();
|
|
39554
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
39431
39555
|
}
|
|
39432
39556
|
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
39433
39557
|
additionalDirectories: [],
|
|
@@ -39440,42 +39564,70 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
39440
39564
|
if (resolution === "complete") {
|
|
39441
39565
|
const effort = effortOption(initialOptions);
|
|
39442
39566
|
if (effort === void 0 || effort.type !== "select" || effort.values.length < 2) {
|
|
39443
|
-
return
|
|
39567
|
+
return {
|
|
39568
|
+
...unavailableModelEffort(),
|
|
39569
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels)
|
|
39570
|
+
};
|
|
39444
39571
|
}
|
|
39445
39572
|
for (const value of model.values) {
|
|
39446
|
-
|
|
39447
|
-
|
|
39573
|
+
if (unsupportedModels.some((diagnostic) => diagnostic.requestedValue === value.value)) {
|
|
39574
|
+
continue;
|
|
39575
|
+
}
|
|
39576
|
+
try {
|
|
39577
|
+
const selectedEffort2 = effortOption(await inspectModel(value.value));
|
|
39578
|
+
valuesByModel[value.value] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
39579
|
+
} catch (cause) {
|
|
39580
|
+
signal.throwIfAborted();
|
|
39581
|
+
if (!isUnavailableModel(cause, model.id, value.value)) {
|
|
39582
|
+
throw cause;
|
|
39583
|
+
}
|
|
39584
|
+
unsupportedModels.push(cause);
|
|
39585
|
+
}
|
|
39448
39586
|
}
|
|
39449
39587
|
return {
|
|
39450
39588
|
effortSettingId: effort.id,
|
|
39451
39589
|
modelSettingId: model.id,
|
|
39452
39590
|
resolution: "complete",
|
|
39591
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
39453
39592
|
valuesByModel
|
|
39454
39593
|
};
|
|
39455
39594
|
}
|
|
39456
39595
|
if (command.model !== void 0) {
|
|
39457
|
-
|
|
39458
|
-
throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
|
|
39459
|
-
}
|
|
39596
|
+
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command.model);
|
|
39460
39597
|
const selectedEffort2 = effortOption(selectedOptions);
|
|
39461
|
-
|
|
39598
|
+
if (!modelUnsupported) {
|
|
39599
|
+
valuesByModel[command.model] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
39600
|
+
}
|
|
39462
39601
|
return {
|
|
39463
39602
|
effortSettingId: selectedEffort2?.id ?? "",
|
|
39464
39603
|
modelSettingId: model.id,
|
|
39465
39604
|
resolution: "on_model_selection",
|
|
39605
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
39466
39606
|
valuesByModel
|
|
39467
39607
|
};
|
|
39468
39608
|
}
|
|
39469
39609
|
const defaultModel = model.type === "select" ? model.currentValue : "";
|
|
39470
39610
|
const reportedEffort = effortOption(selectedOptions);
|
|
39471
|
-
|
|
39472
|
-
if (defaultModel.length > 0) {
|
|
39611
|
+
let selectedEffort = reportedEffort;
|
|
39612
|
+
if (defaultModel.length > 0 && reportedEffort === void 0) {
|
|
39613
|
+
try {
|
|
39614
|
+
selectedEffort = effortOption(await inspectModel(defaultModel));
|
|
39615
|
+
} catch (cause) {
|
|
39616
|
+
signal.throwIfAborted();
|
|
39617
|
+
if (!isUnavailableModel(cause, model.id, defaultModel)) {
|
|
39618
|
+
throw cause;
|
|
39619
|
+
}
|
|
39620
|
+
unsupportedModels.push(cause);
|
|
39621
|
+
}
|
|
39622
|
+
}
|
|
39623
|
+
if (defaultModel.length > 0 && !unsupportedModels.some((diagnostic) => diagnostic.requestedValue === defaultModel)) {
|
|
39473
39624
|
valuesByModel[defaultModel] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
39474
39625
|
}
|
|
39475
39626
|
return {
|
|
39476
39627
|
effortSettingId: selectedEffort?.id ?? "",
|
|
39477
39628
|
modelSettingId: model.id,
|
|
39478
39629
|
resolution: "on_model_selection",
|
|
39630
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
39479
39631
|
valuesByModel
|
|
39480
39632
|
};
|
|
39481
39633
|
}
|
|
@@ -39484,6 +39636,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
39484
39636
|
effortSettingId: "",
|
|
39485
39637
|
modelSettingId: modelEffort.modelSettingId,
|
|
39486
39638
|
resolution: modelEffort.resolution,
|
|
39639
|
+
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
39487
39640
|
valuesByModel: {}
|
|
39488
39641
|
};
|
|
39489
39642
|
return createHash3("sha256").update(
|
|
@@ -39591,9 +39744,11 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
39591
39744
|
sessionId: command.sessionId,
|
|
39592
39745
|
runtimeTimings: metrics.snapshot()
|
|
39593
39746
|
};
|
|
39594
|
-
|
|
39595
|
-
|
|
39596
|
-
|
|
39747
|
+
if (command.transient !== true) {
|
|
39748
|
+
metrics.measureSync("readiness-commit", () => {
|
|
39749
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
39750
|
+
});
|
|
39751
|
+
}
|
|
39597
39752
|
return event;
|
|
39598
39753
|
});
|
|
39599
39754
|
send(socket, {
|
|
@@ -40550,14 +40705,30 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40550
40705
|
sessions,
|
|
40551
40706
|
operationSignal
|
|
40552
40707
|
);
|
|
40708
|
+
for (const diagnostic of result.unsupportedModels) {
|
|
40709
|
+
const details = agentSettingsFailureDetails(command2.agentId, diagnostic);
|
|
40710
|
+
audit.record({
|
|
40711
|
+
commandId: command2.requestId,
|
|
40712
|
+
details,
|
|
40713
|
+
event: "agent_settings_model_unsupported",
|
|
40714
|
+
sessionId: `agent-settings:${command2.agentId}`
|
|
40715
|
+
});
|
|
40716
|
+
process.stderr.write(
|
|
40717
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command2.requestId, ...details })}
|
|
40718
|
+
`
|
|
40719
|
+
);
|
|
40720
|
+
}
|
|
40553
40721
|
audit.record({
|
|
40554
40722
|
commandId: command2.requestId,
|
|
40555
|
-
details: {
|
|
40723
|
+
details: {
|
|
40724
|
+
agentId: command2.agentId,
|
|
40725
|
+
unsupportedModelCount: result.unsupportedModels.length.toString()
|
|
40726
|
+
},
|
|
40556
40727
|
event: "agent_settings_discovered",
|
|
40557
40728
|
sessionId: `agent-settings:${command2.agentId}`
|
|
40558
40729
|
});
|
|
40559
40730
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
40560
|
-
send(socket, result);
|
|
40731
|
+
send(socket, result.event);
|
|
40561
40732
|
}
|
|
40562
40733
|
} catch (error62) {
|
|
40563
40734
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -40565,12 +40736,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40565
40736
|
{},
|
|
40566
40737
|
"agent_settings_discovery_cancelled"
|
|
40567
40738
|
) : error62;
|
|
40739
|
+
const details = agentSettingsFailureDetails(command2.agentId, failure2);
|
|
40568
40740
|
audit.record({
|
|
40569
40741
|
commandId: command2.requestId,
|
|
40570
|
-
details
|
|
40742
|
+
details,
|
|
40571
40743
|
event: "agent_settings_discovery_failed",
|
|
40572
40744
|
sessionId: `agent-settings:${command2.agentId}`
|
|
40573
40745
|
});
|
|
40746
|
+
if (failure2 instanceof AcpConfigurationValueUnavailableError) {
|
|
40747
|
+
process.stderr.write(
|
|
40748
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command2.requestId, ...details })}
|
|
40749
|
+
`
|
|
40750
|
+
);
|
|
40751
|
+
}
|
|
40574
40752
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
40575
40753
|
send(socket, {
|
|
40576
40754
|
code: operationErrorCode(failure2),
|