@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/index.js
CHANGED
|
@@ -19905,6 +19905,7 @@ var agentModelEffortSchema = external_exports.strictObject({
|
|
|
19905
19905
|
effortSettingId: external_exports.string().max(128),
|
|
19906
19906
|
modelSettingId: external_exports.string().max(128),
|
|
19907
19907
|
resolution: agentModelEffortResolutionSchema,
|
|
19908
|
+
unsupportedModelIds: external_exports.array(external_exports.string().min(1).max(500)).max(500).readonly().default([]),
|
|
19908
19909
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
19909
19910
|
}).readonly();
|
|
19910
19911
|
var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
|
|
@@ -20897,21 +20898,30 @@ var historyMessage = external_exports.strictObject({
|
|
|
20897
20898
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT),
|
|
20898
20899
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
20899
20900
|
}).readonly();
|
|
20900
|
-
var
|
|
20901
|
-
external_exports.
|
|
20902
|
-
|
|
20903
|
-
|
|
20904
|
-
|
|
20905
|
-
|
|
20906
|
-
|
|
20907
|
-
|
|
20908
|
-
|
|
20909
|
-
|
|
20910
|
-
|
|
20901
|
+
var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
20902
|
+
status: external_exports.literal("available"),
|
|
20903
|
+
messages: external_exports.array(historyMessage).max(SESSION_HISTORY_MESSAGE_LIMIT).readonly(),
|
|
20904
|
+
truncated: external_exports.boolean(),
|
|
20905
|
+
coveredCommandIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/)).max(1e4).readonly(),
|
|
20906
|
+
coveredMessageIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}:(?:user|agent)$/)).max(2e4).readonly().default([])
|
|
20907
|
+
});
|
|
20908
|
+
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
20909
|
+
var unavailableSessionHistoryObjectSchema = external_exports.strictObject({ status: external_exports.literal("unavailable") });
|
|
20910
|
+
var unavailableSessionHistorySchema = unavailableSessionHistoryObjectSchema.readonly();
|
|
20911
|
+
function withinHistoryContentLimits(history) {
|
|
20912
|
+
if (history.status === "unavailable" || history.messages === void 0) {
|
|
20913
|
+
return true;
|
|
20914
|
+
}
|
|
20915
|
+
return history.messages.reduce((total, message) => total + message.text.length, 0) <= SESSION_HISTORY_CHARACTER_LIMIT && history.messages.reduce(
|
|
20911
20916
|
(total, message) => total + (message.images ?? []).reduce((size, image) => size + image.data.length, 0),
|
|
20912
20917
|
0
|
|
20913
|
-
) <= SESSION_HISTORY_IMAGE_CHARACTER_LIMIT
|
|
20914
|
-
|
|
20918
|
+
) <= SESSION_HISTORY_IMAGE_CHARACTER_LIMIT;
|
|
20919
|
+
}
|
|
20920
|
+
var sessionHistorySchema = external_exports.discriminatedUnion("status", [availableSessionHistorySchema, unavailableSessionHistorySchema]).refine(withinHistoryContentLimits);
|
|
20921
|
+
var sessionHistoryPageSchema = external_exports.discriminatedUnion("status", [
|
|
20922
|
+
availableSessionHistoryObjectSchema.extend({ nextCursor: external_exports.string().max(512).nullable() }).readonly(),
|
|
20923
|
+
unavailableSessionHistoryObjectSchema.extend({ nextCursor: external_exports.null() }).readonly()
|
|
20924
|
+
]).refine(withinHistoryContentLimits);
|
|
20915
20925
|
|
|
20916
20926
|
// ../protocol/src/native-sessions.ts
|
|
20917
20927
|
var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
@@ -31010,6 +31020,20 @@ var AcpExecutionError = class extends Error {
|
|
|
31010
31020
|
this.name = "AcpExecutionError";
|
|
31011
31021
|
}
|
|
31012
31022
|
};
|
|
31023
|
+
var AcpConfigurationValueUnavailableError = class extends AcpExecutionError {
|
|
31024
|
+
configId;
|
|
31025
|
+
offeredValueCount;
|
|
31026
|
+
offeredValues;
|
|
31027
|
+
requestedValue;
|
|
31028
|
+
constructor(configId, requestedValue, offeredValues) {
|
|
31029
|
+
super("The requested ACP configuration value is unavailable", {}, "invalid_session_configuration");
|
|
31030
|
+
this.name = "AcpConfigurationValueUnavailableError";
|
|
31031
|
+
this.configId = configId.slice(0, 128);
|
|
31032
|
+
this.requestedValue = requestedValue.slice(0, 128);
|
|
31033
|
+
this.offeredValueCount = offeredValues.length;
|
|
31034
|
+
this.offeredValues = Object.freeze(offeredValues.slice(0, 32).map((value) => value.slice(0, 128)));
|
|
31035
|
+
}
|
|
31036
|
+
};
|
|
31013
31037
|
var RetryableAcpInitializationError = class extends AcpExecutionError {
|
|
31014
31038
|
constructor(cause) {
|
|
31015
31039
|
super("ACP agent initialization failed", { cause });
|
|
@@ -32092,10 +32116,10 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32092
32116
|
);
|
|
32093
32117
|
}
|
|
32094
32118
|
if (!existing.values.some((entry) => entry.value === options.value)) {
|
|
32095
|
-
throw new
|
|
32096
|
-
|
|
32097
|
-
|
|
32098
|
-
|
|
32119
|
+
throw new AcpConfigurationValueUnavailableError(
|
|
32120
|
+
options.configId,
|
|
32121
|
+
options.value,
|
|
32122
|
+
existing.values.map((entry) => entry.value)
|
|
32099
32123
|
);
|
|
32100
32124
|
}
|
|
32101
32125
|
}
|
|
@@ -34302,8 +34326,8 @@ function normalizeVersionOutput(output2) {
|
|
|
34302
34326
|
}
|
|
34303
34327
|
|
|
34304
34328
|
// src/agent-catalog/agent-specification.ts
|
|
34305
|
-
var VERSION_PROBE_TIMEOUT_MILLISECONDS =
|
|
34306
|
-
var ACP_PROBE_TIMEOUT_MILLISECONDS =
|
|
34329
|
+
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e4;
|
|
34330
|
+
var ACP_PROBE_TIMEOUT_MILLISECONDS = 6e4;
|
|
34307
34331
|
var LocalAgentSpecification = class {
|
|
34308
34332
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
34309
34333
|
authenticationCommand = () => "";
|
|
@@ -35730,6 +35754,25 @@ function agentProbeFailure(specification, error62) {
|
|
|
35730
35754
|
}
|
|
35731
35755
|
return new AgentProbeFailed(specification, "agent_probe_failed", "Agent probe failed");
|
|
35732
35756
|
}
|
|
35757
|
+
function isRetryableProbeFailure(error62) {
|
|
35758
|
+
if (error62 instanceof ProcessExecutionError) {
|
|
35759
|
+
return error62.code === "process_timeout";
|
|
35760
|
+
}
|
|
35761
|
+
return error62 instanceof AgentProbeError && error62.code === "adapter_probe_timeout";
|
|
35762
|
+
}
|
|
35763
|
+
async function probeWithRetry(signal, probe) {
|
|
35764
|
+
try {
|
|
35765
|
+
return await probe();
|
|
35766
|
+
} catch (error62) {
|
|
35767
|
+
if (signal.aborted) {
|
|
35768
|
+
signal.throwIfAborted();
|
|
35769
|
+
}
|
|
35770
|
+
if (!isRetryableProbeFailure(error62)) {
|
|
35771
|
+
throw error62;
|
|
35772
|
+
}
|
|
35773
|
+
return await probe();
|
|
35774
|
+
}
|
|
35775
|
+
}
|
|
35733
35776
|
function integrationProbeFailure(specification, agent, error62) {
|
|
35734
35777
|
if (error62 instanceof AgentProbeError) {
|
|
35735
35778
|
if (error62.code === "authentication_required") {
|
|
@@ -35756,14 +35799,17 @@ async function discoverAgent(specification, context) {
|
|
|
35756
35799
|
for (const agent of agents) {
|
|
35757
35800
|
let agentVersion = "";
|
|
35758
35801
|
try {
|
|
35759
|
-
agentVersion = await
|
|
35760
|
-
agent,
|
|
35761
|
-
specification.agentVersionArguments,
|
|
35762
|
-
context.environment,
|
|
35763
|
-
context.defaultWorkspace,
|
|
35802
|
+
agentVersion = await probeWithRetry(
|
|
35764
35803
|
context.signal,
|
|
35765
|
-
|
|
35766
|
-
|
|
35804
|
+
async () => await probeVersion(
|
|
35805
|
+
agent,
|
|
35806
|
+
specification.agentVersionArguments,
|
|
35807
|
+
context.environment,
|
|
35808
|
+
context.defaultWorkspace,
|
|
35809
|
+
context.signal,
|
|
35810
|
+
specification.versionProbeTimeoutMilliseconds,
|
|
35811
|
+
specification.normalizeAgentVersion
|
|
35812
|
+
)
|
|
35767
35813
|
);
|
|
35768
35814
|
} catch (error62) {
|
|
35769
35815
|
if (context.signal.aborted) {
|
|
@@ -35790,17 +35836,20 @@ async function discoverAgent(specification, context) {
|
|
|
35790
35836
|
try {
|
|
35791
35837
|
launchEnvironment = await specification.createLaunchEnvironment(agent, context);
|
|
35792
35838
|
if (specification.adapterVersionArguments.length > 0) {
|
|
35793
|
-
adapterVersion = await
|
|
35794
|
-
adapter,
|
|
35795
|
-
specification.adapterVersionArguments,
|
|
35796
|
-
{
|
|
35797
|
-
...context.environment,
|
|
35798
|
-
...launchEnvironment
|
|
35799
|
-
},
|
|
35800
|
-
context.defaultWorkspace,
|
|
35839
|
+
adapterVersion = await probeWithRetry(
|
|
35801
35840
|
context.signal,
|
|
35802
|
-
|
|
35803
|
-
|
|
35841
|
+
async () => await probeVersion(
|
|
35842
|
+
adapter,
|
|
35843
|
+
specification.adapterVersionArguments,
|
|
35844
|
+
{
|
|
35845
|
+
...context.environment,
|
|
35846
|
+
...launchEnvironment
|
|
35847
|
+
},
|
|
35848
|
+
context.defaultWorkspace,
|
|
35849
|
+
context.signal,
|
|
35850
|
+
specification.versionProbeTimeoutMilliseconds,
|
|
35851
|
+
specification.normalizeAdapterVersion
|
|
35852
|
+
)
|
|
35804
35853
|
);
|
|
35805
35854
|
}
|
|
35806
35855
|
} catch (error62) {
|
|
@@ -35822,12 +35871,15 @@ async function discoverAgent(specification, context) {
|
|
|
35822
35871
|
agent.identity
|
|
35823
35872
|
);
|
|
35824
35873
|
try {
|
|
35825
|
-
const readiness = await
|
|
35826
|
-
|
|
35827
|
-
|
|
35828
|
-
|
|
35829
|
-
|
|
35830
|
-
|
|
35874
|
+
const readiness = await probeWithRetry(
|
|
35875
|
+
context.signal,
|
|
35876
|
+
async () => await probeAcpReadiness(
|
|
35877
|
+
specification,
|
|
35878
|
+
definition2,
|
|
35879
|
+
context.environment,
|
|
35880
|
+
context.defaultWorkspace,
|
|
35881
|
+
context.signal
|
|
35882
|
+
)
|
|
35831
35883
|
);
|
|
35832
35884
|
const verifiedAdapterVersion = adapterVersion.length > 0 ? adapterVersion : readiness.adapterVersion;
|
|
35833
35885
|
if (verifiedAdapterVersion.length === 0) {
|
|
@@ -40216,6 +40268,19 @@ function operationErrorMessage(error62) {
|
|
|
40216
40268
|
}
|
|
40217
40269
|
return "The local agent operation could not be completed";
|
|
40218
40270
|
}
|
|
40271
|
+
function agentSettingsFailureDetails(agentId, failure2) {
|
|
40272
|
+
const details = { agentId, code: operationErrorCode(failure2) };
|
|
40273
|
+
if (!(failure2 instanceof AcpConfigurationValueUnavailableError)) {
|
|
40274
|
+
return details;
|
|
40275
|
+
}
|
|
40276
|
+
return {
|
|
40277
|
+
...details,
|
|
40278
|
+
configId: failure2.configId,
|
|
40279
|
+
offeredValueCount: failure2.offeredValueCount.toString(),
|
|
40280
|
+
offeredValues: JSON.stringify(failure2.offeredValues),
|
|
40281
|
+
requestedValue: failure2.requestedValue
|
|
40282
|
+
};
|
|
40283
|
+
}
|
|
40219
40284
|
function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTimings = []) {
|
|
40220
40285
|
if (socket.readyState !== WebSocket2.OPEN) {
|
|
40221
40286
|
return;
|
|
@@ -40248,6 +40313,12 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
40248
40313
|
}
|
|
40249
40314
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
40250
40315
|
}
|
|
40316
|
+
function isUnavailableModel(cause, modelSettingId, requestedModel) {
|
|
40317
|
+
return cause instanceof AcpConfigurationValueUnavailableError && cause.configId === modelSettingId && cause.requestedValue === requestedModel;
|
|
40318
|
+
}
|
|
40319
|
+
function unsupportedModelIds(unsupportedModels) {
|
|
40320
|
+
return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
|
|
40321
|
+
}
|
|
40251
40322
|
async function discoverAgentSettings(command, config2, directories, sessions, signal) {
|
|
40252
40323
|
const agent = config2.catalog.find(command.agentId);
|
|
40253
40324
|
const cwd = await directories.resolve(config2.bindingId, "default", signal);
|
|
@@ -40257,35 +40328,70 @@ async function discoverAgentSettings(command, config2, directories, sessions, si
|
|
|
40257
40328
|
cwd,
|
|
40258
40329
|
signal
|
|
40259
40330
|
});
|
|
40260
|
-
const
|
|
40261
|
-
|
|
40262
|
-
|
|
40263
|
-
|
|
40264
|
-
|
|
40265
|
-
|
|
40266
|
-
|
|
40331
|
+
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
40332
|
+
const unsupportedModels = [];
|
|
40333
|
+
let selectedSnapshot = baseSnapshot;
|
|
40334
|
+
if (command.model !== void 0) {
|
|
40335
|
+
if (baseModel === void 0 || baseModel.type !== "select" || !baseModel.values.some((value) => value.value === command.model)) {
|
|
40336
|
+
unsupportedModels.push(
|
|
40337
|
+
new AcpConfigurationValueUnavailableError(
|
|
40338
|
+
baseModel?.id ?? "model",
|
|
40339
|
+
command.model,
|
|
40340
|
+
baseModel?.values.map((value) => value.value) ?? []
|
|
40341
|
+
)
|
|
40342
|
+
);
|
|
40343
|
+
} else {
|
|
40344
|
+
try {
|
|
40345
|
+
selectedSnapshot = await sessions.inspectAgentSettings({
|
|
40346
|
+
additionalDirectories: [],
|
|
40347
|
+
agent,
|
|
40348
|
+
cwd,
|
|
40349
|
+
model: command.model,
|
|
40350
|
+
signal
|
|
40351
|
+
});
|
|
40352
|
+
} catch (cause) {
|
|
40353
|
+
signal.throwIfAborted();
|
|
40354
|
+
if (!isUnavailableModel(cause, baseModel.id, command.model)) {
|
|
40355
|
+
throw cause;
|
|
40356
|
+
}
|
|
40357
|
+
unsupportedModels.push(cause);
|
|
40358
|
+
}
|
|
40359
|
+
}
|
|
40360
|
+
}
|
|
40267
40361
|
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
40268
|
-
const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
|
|
40269
|
-
const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
|
|
40270
40362
|
const modelEffort = await discoverModelEffort(
|
|
40271
40363
|
command,
|
|
40272
40364
|
agent,
|
|
40273
40365
|
adapter.modelEffortResolution,
|
|
40274
40366
|
baseSnapshot.configOptions,
|
|
40275
40367
|
selectedSnapshot.configOptions,
|
|
40368
|
+
unsupportedModels,
|
|
40276
40369
|
cwd,
|
|
40277
40370
|
sessions,
|
|
40278
40371
|
signal
|
|
40279
40372
|
);
|
|
40373
|
+
const baseSettings = withoutUnsupportedModels(
|
|
40374
|
+
settingsFromSnapshot(agent, baseSnapshot.configOptions),
|
|
40375
|
+
baseModel?.id ?? "",
|
|
40376
|
+
modelEffort.unsupportedModelIds
|
|
40377
|
+
);
|
|
40378
|
+
const settings = withoutUnsupportedModels(
|
|
40379
|
+
settingsFromSnapshot(agent, selectedSnapshot.configOptions),
|
|
40380
|
+
baseModel?.id ?? "",
|
|
40381
|
+
modelEffort.unsupportedModelIds
|
|
40382
|
+
);
|
|
40280
40383
|
return {
|
|
40281
|
-
|
|
40282
|
-
|
|
40283
|
-
|
|
40284
|
-
|
|
40285
|
-
|
|
40286
|
-
|
|
40287
|
-
|
|
40288
|
-
|
|
40384
|
+
event: {
|
|
40385
|
+
agentId: command.agentId,
|
|
40386
|
+
agentName: selectedSnapshot.agentName,
|
|
40387
|
+
agentVersion: selectedSnapshot.agentVersion,
|
|
40388
|
+
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
40389
|
+
modelEffort,
|
|
40390
|
+
requestId: command.requestId,
|
|
40391
|
+
settings,
|
|
40392
|
+
settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort)
|
|
40393
|
+
},
|
|
40394
|
+
unsupportedModels
|
|
40289
40395
|
};
|
|
40290
40396
|
}
|
|
40291
40397
|
function settingFromOption(option) {
|
|
@@ -40321,6 +40427,22 @@ function settingsFromSnapshot(agent, configOptions) {
|
|
|
40321
40427
|
}
|
|
40322
40428
|
return settings;
|
|
40323
40429
|
}
|
|
40430
|
+
function withoutUnsupportedModels(settings, modelSettingId, unsupportedModelIds2) {
|
|
40431
|
+
if (modelSettingId.length === 0 || unsupportedModelIds2.length === 0) {
|
|
40432
|
+
return settings;
|
|
40433
|
+
}
|
|
40434
|
+
const unsupported = new Set(unsupportedModelIds2);
|
|
40435
|
+
return settings.map((setting) => {
|
|
40436
|
+
if (setting.id !== modelSettingId || setting.type !== "select") {
|
|
40437
|
+
return setting;
|
|
40438
|
+
}
|
|
40439
|
+
return {
|
|
40440
|
+
...setting,
|
|
40441
|
+
defaultValue: unsupported.has(setting.defaultValue) ? "" : setting.defaultValue,
|
|
40442
|
+
values: setting.values.filter((value) => !unsupported.has(value.value))
|
|
40443
|
+
};
|
|
40444
|
+
});
|
|
40445
|
+
}
|
|
40324
40446
|
function modelOption(options) {
|
|
40325
40447
|
return options.find((option) => option.id === "model" || option.category === "model");
|
|
40326
40448
|
}
|
|
@@ -40332,16 +40454,18 @@ function unavailableModelEffort() {
|
|
|
40332
40454
|
effortSettingId: "",
|
|
40333
40455
|
modelSettingId: "",
|
|
40334
40456
|
resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
|
|
40457
|
+
unsupportedModelIds: [],
|
|
40335
40458
|
valuesByModel: {}
|
|
40336
40459
|
};
|
|
40337
40460
|
}
|
|
40338
|
-
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
|
|
40461
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
|
|
40339
40462
|
const model = modelOption(initialOptions);
|
|
40463
|
+
const unsupportedModels = initiallyUnsupportedModels;
|
|
40340
40464
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
40341
|
-
return unavailableModelEffort();
|
|
40465
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
40342
40466
|
}
|
|
40343
40467
|
if (model === void 0 || model.type !== "select" || model.values.length === 0) {
|
|
40344
|
-
return unavailableModelEffort();
|
|
40468
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
40345
40469
|
}
|
|
40346
40470
|
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
40347
40471
|
additionalDirectories: [],
|
|
@@ -40354,42 +40478,70 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
40354
40478
|
if (resolution === "complete") {
|
|
40355
40479
|
const effort = effortOption(initialOptions);
|
|
40356
40480
|
if (effort === void 0 || effort.type !== "select" || effort.values.length < 2) {
|
|
40357
|
-
return
|
|
40481
|
+
return {
|
|
40482
|
+
...unavailableModelEffort(),
|
|
40483
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels)
|
|
40484
|
+
};
|
|
40358
40485
|
}
|
|
40359
40486
|
for (const value of model.values) {
|
|
40360
|
-
|
|
40361
|
-
|
|
40487
|
+
if (unsupportedModels.some((diagnostic) => diagnostic.requestedValue === value.value)) {
|
|
40488
|
+
continue;
|
|
40489
|
+
}
|
|
40490
|
+
try {
|
|
40491
|
+
const selectedEffort2 = effortOption(await inspectModel(value.value));
|
|
40492
|
+
valuesByModel[value.value] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40493
|
+
} catch (cause) {
|
|
40494
|
+
signal.throwIfAborted();
|
|
40495
|
+
if (!isUnavailableModel(cause, model.id, value.value)) {
|
|
40496
|
+
throw cause;
|
|
40497
|
+
}
|
|
40498
|
+
unsupportedModels.push(cause);
|
|
40499
|
+
}
|
|
40362
40500
|
}
|
|
40363
40501
|
return {
|
|
40364
40502
|
effortSettingId: effort.id,
|
|
40365
40503
|
modelSettingId: model.id,
|
|
40366
40504
|
resolution: "complete",
|
|
40505
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40367
40506
|
valuesByModel
|
|
40368
40507
|
};
|
|
40369
40508
|
}
|
|
40370
40509
|
if (command.model !== void 0) {
|
|
40371
|
-
|
|
40372
|
-
throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
|
|
40373
|
-
}
|
|
40510
|
+
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command.model);
|
|
40374
40511
|
const selectedEffort2 = effortOption(selectedOptions);
|
|
40375
|
-
|
|
40512
|
+
if (!modelUnsupported) {
|
|
40513
|
+
valuesByModel[command.model] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40514
|
+
}
|
|
40376
40515
|
return {
|
|
40377
40516
|
effortSettingId: selectedEffort2?.id ?? "",
|
|
40378
40517
|
modelSettingId: model.id,
|
|
40379
40518
|
resolution: "on_model_selection",
|
|
40519
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40380
40520
|
valuesByModel
|
|
40381
40521
|
};
|
|
40382
40522
|
}
|
|
40383
40523
|
const defaultModel = model.type === "select" ? model.currentValue : "";
|
|
40384
40524
|
const reportedEffort = effortOption(selectedOptions);
|
|
40385
|
-
|
|
40386
|
-
if (defaultModel.length > 0) {
|
|
40525
|
+
let selectedEffort = reportedEffort;
|
|
40526
|
+
if (defaultModel.length > 0 && reportedEffort === void 0) {
|
|
40527
|
+
try {
|
|
40528
|
+
selectedEffort = effortOption(await inspectModel(defaultModel));
|
|
40529
|
+
} catch (cause) {
|
|
40530
|
+
signal.throwIfAborted();
|
|
40531
|
+
if (!isUnavailableModel(cause, model.id, defaultModel)) {
|
|
40532
|
+
throw cause;
|
|
40533
|
+
}
|
|
40534
|
+
unsupportedModels.push(cause);
|
|
40535
|
+
}
|
|
40536
|
+
}
|
|
40537
|
+
if (defaultModel.length > 0 && !unsupportedModels.some((diagnostic) => diagnostic.requestedValue === defaultModel)) {
|
|
40387
40538
|
valuesByModel[defaultModel] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
40388
40539
|
}
|
|
40389
40540
|
return {
|
|
40390
40541
|
effortSettingId: selectedEffort?.id ?? "",
|
|
40391
40542
|
modelSettingId: model.id,
|
|
40392
40543
|
resolution: "on_model_selection",
|
|
40544
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40393
40545
|
valuesByModel
|
|
40394
40546
|
};
|
|
40395
40547
|
}
|
|
@@ -40398,6 +40550,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
40398
40550
|
effortSettingId: "",
|
|
40399
40551
|
modelSettingId: modelEffort.modelSettingId,
|
|
40400
40552
|
resolution: modelEffort.resolution,
|
|
40553
|
+
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
40401
40554
|
valuesByModel: {}
|
|
40402
40555
|
};
|
|
40403
40556
|
return createHash4("sha256").update(
|
|
@@ -40505,9 +40658,11 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40505
40658
|
sessionId: command.sessionId,
|
|
40506
40659
|
runtimeTimings: metrics.snapshot()
|
|
40507
40660
|
};
|
|
40508
|
-
|
|
40509
|
-
|
|
40510
|
-
|
|
40661
|
+
if (command.transient !== true) {
|
|
40662
|
+
metrics.measureSync("readiness-commit", () => {
|
|
40663
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
40664
|
+
});
|
|
40665
|
+
}
|
|
40511
40666
|
return event;
|
|
40512
40667
|
});
|
|
40513
40668
|
send(socket, {
|
|
@@ -41464,14 +41619,30 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41464
41619
|
sessions,
|
|
41465
41620
|
operationSignal
|
|
41466
41621
|
);
|
|
41622
|
+
for (const diagnostic of result.unsupportedModels) {
|
|
41623
|
+
const details = agentSettingsFailureDetails(command2.agentId, diagnostic);
|
|
41624
|
+
audit.record({
|
|
41625
|
+
commandId: command2.requestId,
|
|
41626
|
+
details,
|
|
41627
|
+
event: "agent_settings_model_unsupported",
|
|
41628
|
+
sessionId: `agent-settings:${command2.agentId}`
|
|
41629
|
+
});
|
|
41630
|
+
process.stderr.write(
|
|
41631
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command2.requestId, ...details })}
|
|
41632
|
+
`
|
|
41633
|
+
);
|
|
41634
|
+
}
|
|
41467
41635
|
audit.record({
|
|
41468
41636
|
commandId: command2.requestId,
|
|
41469
|
-
details: {
|
|
41637
|
+
details: {
|
|
41638
|
+
agentId: command2.agentId,
|
|
41639
|
+
unsupportedModelCount: result.unsupportedModels.length.toString()
|
|
41640
|
+
},
|
|
41470
41641
|
event: "agent_settings_discovered",
|
|
41471
41642
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41472
41643
|
});
|
|
41473
41644
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41474
|
-
send(socket, result);
|
|
41645
|
+
send(socket, result.event);
|
|
41475
41646
|
}
|
|
41476
41647
|
} catch (error62) {
|
|
41477
41648
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41479,12 +41650,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41479
41650
|
{},
|
|
41480
41651
|
"agent_settings_discovery_cancelled"
|
|
41481
41652
|
) : error62;
|
|
41653
|
+
const details = agentSettingsFailureDetails(command2.agentId, failure2);
|
|
41482
41654
|
audit.record({
|
|
41483
41655
|
commandId: command2.requestId,
|
|
41484
|
-
details
|
|
41656
|
+
details,
|
|
41485
41657
|
event: "agent_settings_discovery_failed",
|
|
41486
41658
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41487
41659
|
});
|
|
41660
|
+
if (failure2 instanceof AcpConfigurationValueUnavailableError) {
|
|
41661
|
+
process.stderr.write(
|
|
41662
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command2.requestId, ...details })}
|
|
41663
|
+
`
|
|
41664
|
+
);
|
|
41665
|
+
}
|
|
41488
41666
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41489
41667
|
send(socket, {
|
|
41490
41668
|
code: operationErrorCode(failure2),
|