@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/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,44 +39399,103 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
39334
39399
|
}
|
|
39335
39400
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
39336
39401
|
}
|
|
39337
|
-
|
|
39402
|
+
var OPENCODE_PROVIDER_SETTLEMENT_MILLISECONDS = 1e3;
|
|
39403
|
+
async function waitForAgentSettingsReadiness(agentId, signal, timer) {
|
|
39404
|
+
if (agentId !== "opencode") {
|
|
39405
|
+
return;
|
|
39406
|
+
}
|
|
39407
|
+
signal.throwIfAborted();
|
|
39408
|
+
await new Promise((resolve8) => {
|
|
39409
|
+
const readiness = timer.schedule(finish, OPENCODE_PROVIDER_SETTLEMENT_MILLISECONDS);
|
|
39410
|
+
function finish() {
|
|
39411
|
+
readiness.cancel();
|
|
39412
|
+
signal.removeEventListener("abort", finish);
|
|
39413
|
+
resolve8();
|
|
39414
|
+
}
|
|
39415
|
+
signal.addEventListener("abort", finish, { once: true });
|
|
39416
|
+
});
|
|
39417
|
+
signal.throwIfAborted();
|
|
39418
|
+
}
|
|
39419
|
+
function isUnavailableModel(cause, modelSettingId, requestedModel) {
|
|
39420
|
+
return cause instanceof AcpConfigurationValueUnavailableError && cause.configId === modelSettingId && cause.requestedValue === requestedModel;
|
|
39421
|
+
}
|
|
39422
|
+
function unsupportedModelIds(unsupportedModels) {
|
|
39423
|
+
return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
|
|
39424
|
+
}
|
|
39425
|
+
async function discoverAgentSettings(command, config2, directories, sessions, signal, timer) {
|
|
39338
39426
|
const agent = config2.catalog.find(command.agentId);
|
|
39339
39427
|
const cwd = await directories.resolve(config2.bindingId, "default", signal);
|
|
39428
|
+
await waitForAgentSettingsReadiness(agent.id, signal, timer);
|
|
39340
39429
|
const baseSnapshot = await sessions.inspectAgentSettings({
|
|
39341
39430
|
additionalDirectories: [],
|
|
39342
39431
|
agent,
|
|
39343
39432
|
cwd,
|
|
39344
39433
|
signal
|
|
39345
39434
|
});
|
|
39346
|
-
const
|
|
39347
|
-
|
|
39348
|
-
|
|
39349
|
-
|
|
39350
|
-
|
|
39351
|
-
|
|
39352
|
-
|
|
39435
|
+
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
39436
|
+
const unsupportedModels = [];
|
|
39437
|
+
let selectedSnapshot = baseSnapshot;
|
|
39438
|
+
if (command.model !== void 0) {
|
|
39439
|
+
if (baseModel === void 0 || baseModel.type !== "select" || !baseModel.values.some((value) => value.value === command.model)) {
|
|
39440
|
+
unsupportedModels.push(
|
|
39441
|
+
new AcpConfigurationValueUnavailableError(
|
|
39442
|
+
baseModel?.id ?? "model",
|
|
39443
|
+
command.model,
|
|
39444
|
+
baseModel?.values.map((value) => value.value) ?? []
|
|
39445
|
+
)
|
|
39446
|
+
);
|
|
39447
|
+
} else {
|
|
39448
|
+
try {
|
|
39449
|
+
selectedSnapshot = await sessions.inspectAgentSettings({
|
|
39450
|
+
additionalDirectories: [],
|
|
39451
|
+
agent,
|
|
39452
|
+
cwd,
|
|
39453
|
+
model: command.model,
|
|
39454
|
+
signal
|
|
39455
|
+
});
|
|
39456
|
+
} catch (cause) {
|
|
39457
|
+
signal.throwIfAborted();
|
|
39458
|
+
if (!isUnavailableModel(cause, baseModel.id, command.model)) {
|
|
39459
|
+
throw cause;
|
|
39460
|
+
}
|
|
39461
|
+
unsupportedModels.push(cause);
|
|
39462
|
+
}
|
|
39463
|
+
}
|
|
39464
|
+
}
|
|
39353
39465
|
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
39354
|
-
const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
|
|
39355
|
-
const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
|
|
39356
39466
|
const modelEffort = await discoverModelEffort(
|
|
39357
39467
|
command,
|
|
39358
39468
|
agent,
|
|
39359
39469
|
adapter.modelEffortResolution,
|
|
39360
39470
|
baseSnapshot.configOptions,
|
|
39361
39471
|
selectedSnapshot.configOptions,
|
|
39472
|
+
unsupportedModels,
|
|
39362
39473
|
cwd,
|
|
39363
39474
|
sessions,
|
|
39364
39475
|
signal
|
|
39365
39476
|
);
|
|
39477
|
+
const baseSettings = withoutUnsupportedModels(
|
|
39478
|
+
settingsFromSnapshot(agent, baseSnapshot.configOptions),
|
|
39479
|
+
baseModel?.id ?? "",
|
|
39480
|
+
modelEffort.unsupportedModelIds
|
|
39481
|
+
);
|
|
39482
|
+
const settings = withoutUnsupportedModels(
|
|
39483
|
+
settingsFromSnapshot(agent, selectedSnapshot.configOptions),
|
|
39484
|
+
baseModel?.id ?? "",
|
|
39485
|
+
modelEffort.unsupportedModelIds
|
|
39486
|
+
);
|
|
39366
39487
|
return {
|
|
39367
|
-
|
|
39368
|
-
|
|
39369
|
-
|
|
39370
|
-
|
|
39371
|
-
|
|
39372
|
-
|
|
39373
|
-
|
|
39374
|
-
|
|
39488
|
+
event: {
|
|
39489
|
+
agentId: command.agentId,
|
|
39490
|
+
agentName: selectedSnapshot.agentName,
|
|
39491
|
+
agentVersion: selectedSnapshot.agentVersion,
|
|
39492
|
+
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
39493
|
+
modelEffort,
|
|
39494
|
+
requestId: command.requestId,
|
|
39495
|
+
settings,
|
|
39496
|
+
settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort)
|
|
39497
|
+
},
|
|
39498
|
+
unsupportedModels
|
|
39375
39499
|
};
|
|
39376
39500
|
}
|
|
39377
39501
|
function settingFromOption(option) {
|
|
@@ -39407,6 +39531,22 @@ function settingsFromSnapshot(agent, configOptions) {
|
|
|
39407
39531
|
}
|
|
39408
39532
|
return settings;
|
|
39409
39533
|
}
|
|
39534
|
+
function withoutUnsupportedModels(settings, modelSettingId, unsupportedModelIds2) {
|
|
39535
|
+
if (modelSettingId.length === 0 || unsupportedModelIds2.length === 0) {
|
|
39536
|
+
return settings;
|
|
39537
|
+
}
|
|
39538
|
+
const unsupported = new Set(unsupportedModelIds2);
|
|
39539
|
+
return settings.map((setting) => {
|
|
39540
|
+
if (setting.id !== modelSettingId || setting.type !== "select") {
|
|
39541
|
+
return setting;
|
|
39542
|
+
}
|
|
39543
|
+
return {
|
|
39544
|
+
...setting,
|
|
39545
|
+
defaultValue: unsupported.has(setting.defaultValue) ? "" : setting.defaultValue,
|
|
39546
|
+
values: setting.values.filter((value) => !unsupported.has(value.value))
|
|
39547
|
+
};
|
|
39548
|
+
});
|
|
39549
|
+
}
|
|
39410
39550
|
function modelOption(options) {
|
|
39411
39551
|
return options.find((option) => option.id === "model" || option.category === "model");
|
|
39412
39552
|
}
|
|
@@ -39418,16 +39558,18 @@ function unavailableModelEffort() {
|
|
|
39418
39558
|
effortSettingId: "",
|
|
39419
39559
|
modelSettingId: "",
|
|
39420
39560
|
resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
|
|
39561
|
+
unsupportedModelIds: [],
|
|
39421
39562
|
valuesByModel: {}
|
|
39422
39563
|
};
|
|
39423
39564
|
}
|
|
39424
|
-
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
|
|
39565
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
|
|
39425
39566
|
const model = modelOption(initialOptions);
|
|
39567
|
+
const unsupportedModels = initiallyUnsupportedModels;
|
|
39426
39568
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
39427
|
-
return unavailableModelEffort();
|
|
39569
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
39428
39570
|
}
|
|
39429
39571
|
if (model === void 0 || model.type !== "select" || model.values.length === 0) {
|
|
39430
|
-
return unavailableModelEffort();
|
|
39572
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
39431
39573
|
}
|
|
39432
39574
|
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
39433
39575
|
additionalDirectories: [],
|
|
@@ -39440,42 +39582,70 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
39440
39582
|
if (resolution === "complete") {
|
|
39441
39583
|
const effort = effortOption(initialOptions);
|
|
39442
39584
|
if (effort === void 0 || effort.type !== "select" || effort.values.length < 2) {
|
|
39443
|
-
return
|
|
39585
|
+
return {
|
|
39586
|
+
...unavailableModelEffort(),
|
|
39587
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels)
|
|
39588
|
+
};
|
|
39444
39589
|
}
|
|
39445
39590
|
for (const value of model.values) {
|
|
39446
|
-
|
|
39447
|
-
|
|
39591
|
+
if (unsupportedModels.some((diagnostic) => diagnostic.requestedValue === value.value)) {
|
|
39592
|
+
continue;
|
|
39593
|
+
}
|
|
39594
|
+
try {
|
|
39595
|
+
const selectedEffort2 = effortOption(await inspectModel(value.value));
|
|
39596
|
+
valuesByModel[value.value] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
39597
|
+
} catch (cause) {
|
|
39598
|
+
signal.throwIfAborted();
|
|
39599
|
+
if (!isUnavailableModel(cause, model.id, value.value)) {
|
|
39600
|
+
throw cause;
|
|
39601
|
+
}
|
|
39602
|
+
unsupportedModels.push(cause);
|
|
39603
|
+
}
|
|
39448
39604
|
}
|
|
39449
39605
|
return {
|
|
39450
39606
|
effortSettingId: effort.id,
|
|
39451
39607
|
modelSettingId: model.id,
|
|
39452
39608
|
resolution: "complete",
|
|
39609
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
39453
39610
|
valuesByModel
|
|
39454
39611
|
};
|
|
39455
39612
|
}
|
|
39456
39613
|
if (command.model !== void 0) {
|
|
39457
|
-
|
|
39458
|
-
throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
|
|
39459
|
-
}
|
|
39614
|
+
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command.model);
|
|
39460
39615
|
const selectedEffort2 = effortOption(selectedOptions);
|
|
39461
|
-
|
|
39616
|
+
if (!modelUnsupported) {
|
|
39617
|
+
valuesByModel[command.model] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
39618
|
+
}
|
|
39462
39619
|
return {
|
|
39463
39620
|
effortSettingId: selectedEffort2?.id ?? "",
|
|
39464
39621
|
modelSettingId: model.id,
|
|
39465
39622
|
resolution: "on_model_selection",
|
|
39623
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
39466
39624
|
valuesByModel
|
|
39467
39625
|
};
|
|
39468
39626
|
}
|
|
39469
39627
|
const defaultModel = model.type === "select" ? model.currentValue : "";
|
|
39470
39628
|
const reportedEffort = effortOption(selectedOptions);
|
|
39471
|
-
|
|
39472
|
-
if (defaultModel.length > 0) {
|
|
39629
|
+
let selectedEffort = reportedEffort;
|
|
39630
|
+
if (defaultModel.length > 0 && reportedEffort === void 0) {
|
|
39631
|
+
try {
|
|
39632
|
+
selectedEffort = effortOption(await inspectModel(defaultModel));
|
|
39633
|
+
} catch (cause) {
|
|
39634
|
+
signal.throwIfAborted();
|
|
39635
|
+
if (!isUnavailableModel(cause, model.id, defaultModel)) {
|
|
39636
|
+
throw cause;
|
|
39637
|
+
}
|
|
39638
|
+
unsupportedModels.push(cause);
|
|
39639
|
+
}
|
|
39640
|
+
}
|
|
39641
|
+
if (defaultModel.length > 0 && !unsupportedModels.some((diagnostic) => diagnostic.requestedValue === defaultModel)) {
|
|
39473
39642
|
valuesByModel[defaultModel] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
39474
39643
|
}
|
|
39475
39644
|
return {
|
|
39476
39645
|
effortSettingId: selectedEffort?.id ?? "",
|
|
39477
39646
|
modelSettingId: model.id,
|
|
39478
39647
|
resolution: "on_model_selection",
|
|
39648
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
39479
39649
|
valuesByModel
|
|
39480
39650
|
};
|
|
39481
39651
|
}
|
|
@@ -39484,6 +39654,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
39484
39654
|
effortSettingId: "",
|
|
39485
39655
|
modelSettingId: modelEffort.modelSettingId,
|
|
39486
39656
|
resolution: modelEffort.resolution,
|
|
39657
|
+
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
39487
39658
|
valuesByModel: {}
|
|
39488
39659
|
};
|
|
39489
39660
|
return createHash3("sha256").update(
|
|
@@ -39591,9 +39762,11 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
39591
39762
|
sessionId: command.sessionId,
|
|
39592
39763
|
runtimeTimings: metrics.snapshot()
|
|
39593
39764
|
};
|
|
39594
|
-
|
|
39595
|
-
|
|
39596
|
-
|
|
39765
|
+
if (command.transient !== true) {
|
|
39766
|
+
metrics.measureSync("readiness-commit", () => {
|
|
39767
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
39768
|
+
});
|
|
39769
|
+
}
|
|
39597
39770
|
return event;
|
|
39598
39771
|
});
|
|
39599
39772
|
send(socket, {
|
|
@@ -40548,16 +40721,33 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40548
40721
|
config2,
|
|
40549
40722
|
directories,
|
|
40550
40723
|
sessions,
|
|
40551
|
-
operationSignal
|
|
40724
|
+
operationSignal,
|
|
40725
|
+
timer
|
|
40552
40726
|
);
|
|
40727
|
+
for (const diagnostic of result.unsupportedModels) {
|
|
40728
|
+
const details = agentSettingsFailureDetails(command2.agentId, diagnostic);
|
|
40729
|
+
audit.record({
|
|
40730
|
+
commandId: command2.requestId,
|
|
40731
|
+
details,
|
|
40732
|
+
event: "agent_settings_model_unsupported",
|
|
40733
|
+
sessionId: `agent-settings:${command2.agentId}`
|
|
40734
|
+
});
|
|
40735
|
+
process.stderr.write(
|
|
40736
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command2.requestId, ...details })}
|
|
40737
|
+
`
|
|
40738
|
+
);
|
|
40739
|
+
}
|
|
40553
40740
|
audit.record({
|
|
40554
40741
|
commandId: command2.requestId,
|
|
40555
|
-
details: {
|
|
40742
|
+
details: {
|
|
40743
|
+
agentId: command2.agentId,
|
|
40744
|
+
unsupportedModelCount: result.unsupportedModels.length.toString()
|
|
40745
|
+
},
|
|
40556
40746
|
event: "agent_settings_discovered",
|
|
40557
40747
|
sessionId: `agent-settings:${command2.agentId}`
|
|
40558
40748
|
});
|
|
40559
40749
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
40560
|
-
send(socket, result);
|
|
40750
|
+
send(socket, result.event);
|
|
40561
40751
|
}
|
|
40562
40752
|
} catch (error62) {
|
|
40563
40753
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -40565,12 +40755,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40565
40755
|
{},
|
|
40566
40756
|
"agent_settings_discovery_cancelled"
|
|
40567
40757
|
) : error62;
|
|
40758
|
+
const details = agentSettingsFailureDetails(command2.agentId, failure2);
|
|
40568
40759
|
audit.record({
|
|
40569
40760
|
commandId: command2.requestId,
|
|
40570
|
-
details
|
|
40761
|
+
details,
|
|
40571
40762
|
event: "agent_settings_discovery_failed",
|
|
40572
40763
|
sessionId: `agent-settings:${command2.agentId}`
|
|
40573
40764
|
});
|
|
40765
|
+
if (failure2 instanceof AcpConfigurationValueUnavailableError) {
|
|
40766
|
+
process.stderr.write(
|
|
40767
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command2.requestId, ...details })}
|
|
40768
|
+
`
|
|
40769
|
+
);
|
|
40770
|
+
}
|
|
40574
40771
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
40575
40772
|
send(socket, {
|
|
40576
40773
|
code: operationErrorCode(failure2),
|