@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/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,44 +40313,103 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
40248
40313
|
}
|
|
40249
40314
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
40250
40315
|
}
|
|
40251
|
-
|
|
40316
|
+
var OPENCODE_PROVIDER_SETTLEMENT_MILLISECONDS = 1e3;
|
|
40317
|
+
async function waitForAgentSettingsReadiness(agentId, signal, timer) {
|
|
40318
|
+
if (agentId !== "opencode") {
|
|
40319
|
+
return;
|
|
40320
|
+
}
|
|
40321
|
+
signal.throwIfAborted();
|
|
40322
|
+
await new Promise((resolve8) => {
|
|
40323
|
+
const readiness = timer.schedule(finish, OPENCODE_PROVIDER_SETTLEMENT_MILLISECONDS);
|
|
40324
|
+
function finish() {
|
|
40325
|
+
readiness.cancel();
|
|
40326
|
+
signal.removeEventListener("abort", finish);
|
|
40327
|
+
resolve8();
|
|
40328
|
+
}
|
|
40329
|
+
signal.addEventListener("abort", finish, { once: true });
|
|
40330
|
+
});
|
|
40331
|
+
signal.throwIfAborted();
|
|
40332
|
+
}
|
|
40333
|
+
function isUnavailableModel(cause, modelSettingId, requestedModel) {
|
|
40334
|
+
return cause instanceof AcpConfigurationValueUnavailableError && cause.configId === modelSettingId && cause.requestedValue === requestedModel;
|
|
40335
|
+
}
|
|
40336
|
+
function unsupportedModelIds(unsupportedModels) {
|
|
40337
|
+
return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
|
|
40338
|
+
}
|
|
40339
|
+
async function discoverAgentSettings(command, config2, directories, sessions, signal, timer) {
|
|
40252
40340
|
const agent = config2.catalog.find(command.agentId);
|
|
40253
40341
|
const cwd = await directories.resolve(config2.bindingId, "default", signal);
|
|
40342
|
+
await waitForAgentSettingsReadiness(agent.id, signal, timer);
|
|
40254
40343
|
const baseSnapshot = await sessions.inspectAgentSettings({
|
|
40255
40344
|
additionalDirectories: [],
|
|
40256
40345
|
agent,
|
|
40257
40346
|
cwd,
|
|
40258
40347
|
signal
|
|
40259
40348
|
});
|
|
40260
|
-
const
|
|
40261
|
-
|
|
40262
|
-
|
|
40263
|
-
|
|
40264
|
-
|
|
40265
|
-
|
|
40266
|
-
|
|
40349
|
+
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
40350
|
+
const unsupportedModels = [];
|
|
40351
|
+
let selectedSnapshot = baseSnapshot;
|
|
40352
|
+
if (command.model !== void 0) {
|
|
40353
|
+
if (baseModel === void 0 || baseModel.type !== "select" || !baseModel.values.some((value) => value.value === command.model)) {
|
|
40354
|
+
unsupportedModels.push(
|
|
40355
|
+
new AcpConfigurationValueUnavailableError(
|
|
40356
|
+
baseModel?.id ?? "model",
|
|
40357
|
+
command.model,
|
|
40358
|
+
baseModel?.values.map((value) => value.value) ?? []
|
|
40359
|
+
)
|
|
40360
|
+
);
|
|
40361
|
+
} else {
|
|
40362
|
+
try {
|
|
40363
|
+
selectedSnapshot = await sessions.inspectAgentSettings({
|
|
40364
|
+
additionalDirectories: [],
|
|
40365
|
+
agent,
|
|
40366
|
+
cwd,
|
|
40367
|
+
model: command.model,
|
|
40368
|
+
signal
|
|
40369
|
+
});
|
|
40370
|
+
} catch (cause) {
|
|
40371
|
+
signal.throwIfAborted();
|
|
40372
|
+
if (!isUnavailableModel(cause, baseModel.id, command.model)) {
|
|
40373
|
+
throw cause;
|
|
40374
|
+
}
|
|
40375
|
+
unsupportedModels.push(cause);
|
|
40376
|
+
}
|
|
40377
|
+
}
|
|
40378
|
+
}
|
|
40267
40379
|
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
40268
|
-
const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
|
|
40269
|
-
const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
|
|
40270
40380
|
const modelEffort = await discoverModelEffort(
|
|
40271
40381
|
command,
|
|
40272
40382
|
agent,
|
|
40273
40383
|
adapter.modelEffortResolution,
|
|
40274
40384
|
baseSnapshot.configOptions,
|
|
40275
40385
|
selectedSnapshot.configOptions,
|
|
40386
|
+
unsupportedModels,
|
|
40276
40387
|
cwd,
|
|
40277
40388
|
sessions,
|
|
40278
40389
|
signal
|
|
40279
40390
|
);
|
|
40391
|
+
const baseSettings = withoutUnsupportedModels(
|
|
40392
|
+
settingsFromSnapshot(agent, baseSnapshot.configOptions),
|
|
40393
|
+
baseModel?.id ?? "",
|
|
40394
|
+
modelEffort.unsupportedModelIds
|
|
40395
|
+
);
|
|
40396
|
+
const settings = withoutUnsupportedModels(
|
|
40397
|
+
settingsFromSnapshot(agent, selectedSnapshot.configOptions),
|
|
40398
|
+
baseModel?.id ?? "",
|
|
40399
|
+
modelEffort.unsupportedModelIds
|
|
40400
|
+
);
|
|
40280
40401
|
return {
|
|
40281
|
-
|
|
40282
|
-
|
|
40283
|
-
|
|
40284
|
-
|
|
40285
|
-
|
|
40286
|
-
|
|
40287
|
-
|
|
40288
|
-
|
|
40402
|
+
event: {
|
|
40403
|
+
agentId: command.agentId,
|
|
40404
|
+
agentName: selectedSnapshot.agentName,
|
|
40405
|
+
agentVersion: selectedSnapshot.agentVersion,
|
|
40406
|
+
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
40407
|
+
modelEffort,
|
|
40408
|
+
requestId: command.requestId,
|
|
40409
|
+
settings,
|
|
40410
|
+
settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort)
|
|
40411
|
+
},
|
|
40412
|
+
unsupportedModels
|
|
40289
40413
|
};
|
|
40290
40414
|
}
|
|
40291
40415
|
function settingFromOption(option) {
|
|
@@ -40321,6 +40445,22 @@ function settingsFromSnapshot(agent, configOptions) {
|
|
|
40321
40445
|
}
|
|
40322
40446
|
return settings;
|
|
40323
40447
|
}
|
|
40448
|
+
function withoutUnsupportedModels(settings, modelSettingId, unsupportedModelIds2) {
|
|
40449
|
+
if (modelSettingId.length === 0 || unsupportedModelIds2.length === 0) {
|
|
40450
|
+
return settings;
|
|
40451
|
+
}
|
|
40452
|
+
const unsupported = new Set(unsupportedModelIds2);
|
|
40453
|
+
return settings.map((setting) => {
|
|
40454
|
+
if (setting.id !== modelSettingId || setting.type !== "select") {
|
|
40455
|
+
return setting;
|
|
40456
|
+
}
|
|
40457
|
+
return {
|
|
40458
|
+
...setting,
|
|
40459
|
+
defaultValue: unsupported.has(setting.defaultValue) ? "" : setting.defaultValue,
|
|
40460
|
+
values: setting.values.filter((value) => !unsupported.has(value.value))
|
|
40461
|
+
};
|
|
40462
|
+
});
|
|
40463
|
+
}
|
|
40324
40464
|
function modelOption(options) {
|
|
40325
40465
|
return options.find((option) => option.id === "model" || option.category === "model");
|
|
40326
40466
|
}
|
|
@@ -40332,16 +40472,18 @@ function unavailableModelEffort() {
|
|
|
40332
40472
|
effortSettingId: "",
|
|
40333
40473
|
modelSettingId: "",
|
|
40334
40474
|
resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
|
|
40475
|
+
unsupportedModelIds: [],
|
|
40335
40476
|
valuesByModel: {}
|
|
40336
40477
|
};
|
|
40337
40478
|
}
|
|
40338
|
-
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
|
|
40479
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
|
|
40339
40480
|
const model = modelOption(initialOptions);
|
|
40481
|
+
const unsupportedModels = initiallyUnsupportedModels;
|
|
40340
40482
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
40341
|
-
return unavailableModelEffort();
|
|
40483
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
40342
40484
|
}
|
|
40343
40485
|
if (model === void 0 || model.type !== "select" || model.values.length === 0) {
|
|
40344
|
-
return unavailableModelEffort();
|
|
40486
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
40345
40487
|
}
|
|
40346
40488
|
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
40347
40489
|
additionalDirectories: [],
|
|
@@ -40354,42 +40496,70 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
40354
40496
|
if (resolution === "complete") {
|
|
40355
40497
|
const effort = effortOption(initialOptions);
|
|
40356
40498
|
if (effort === void 0 || effort.type !== "select" || effort.values.length < 2) {
|
|
40357
|
-
return
|
|
40499
|
+
return {
|
|
40500
|
+
...unavailableModelEffort(),
|
|
40501
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels)
|
|
40502
|
+
};
|
|
40358
40503
|
}
|
|
40359
40504
|
for (const value of model.values) {
|
|
40360
|
-
|
|
40361
|
-
|
|
40505
|
+
if (unsupportedModels.some((diagnostic) => diagnostic.requestedValue === value.value)) {
|
|
40506
|
+
continue;
|
|
40507
|
+
}
|
|
40508
|
+
try {
|
|
40509
|
+
const selectedEffort2 = effortOption(await inspectModel(value.value));
|
|
40510
|
+
valuesByModel[value.value] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40511
|
+
} catch (cause) {
|
|
40512
|
+
signal.throwIfAborted();
|
|
40513
|
+
if (!isUnavailableModel(cause, model.id, value.value)) {
|
|
40514
|
+
throw cause;
|
|
40515
|
+
}
|
|
40516
|
+
unsupportedModels.push(cause);
|
|
40517
|
+
}
|
|
40362
40518
|
}
|
|
40363
40519
|
return {
|
|
40364
40520
|
effortSettingId: effort.id,
|
|
40365
40521
|
modelSettingId: model.id,
|
|
40366
40522
|
resolution: "complete",
|
|
40523
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40367
40524
|
valuesByModel
|
|
40368
40525
|
};
|
|
40369
40526
|
}
|
|
40370
40527
|
if (command.model !== void 0) {
|
|
40371
|
-
|
|
40372
|
-
throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
|
|
40373
|
-
}
|
|
40528
|
+
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command.model);
|
|
40374
40529
|
const selectedEffort2 = effortOption(selectedOptions);
|
|
40375
|
-
|
|
40530
|
+
if (!modelUnsupported) {
|
|
40531
|
+
valuesByModel[command.model] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40532
|
+
}
|
|
40376
40533
|
return {
|
|
40377
40534
|
effortSettingId: selectedEffort2?.id ?? "",
|
|
40378
40535
|
modelSettingId: model.id,
|
|
40379
40536
|
resolution: "on_model_selection",
|
|
40537
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40380
40538
|
valuesByModel
|
|
40381
40539
|
};
|
|
40382
40540
|
}
|
|
40383
40541
|
const defaultModel = model.type === "select" ? model.currentValue : "";
|
|
40384
40542
|
const reportedEffort = effortOption(selectedOptions);
|
|
40385
|
-
|
|
40386
|
-
if (defaultModel.length > 0) {
|
|
40543
|
+
let selectedEffort = reportedEffort;
|
|
40544
|
+
if (defaultModel.length > 0 && reportedEffort === void 0) {
|
|
40545
|
+
try {
|
|
40546
|
+
selectedEffort = effortOption(await inspectModel(defaultModel));
|
|
40547
|
+
} catch (cause) {
|
|
40548
|
+
signal.throwIfAborted();
|
|
40549
|
+
if (!isUnavailableModel(cause, model.id, defaultModel)) {
|
|
40550
|
+
throw cause;
|
|
40551
|
+
}
|
|
40552
|
+
unsupportedModels.push(cause);
|
|
40553
|
+
}
|
|
40554
|
+
}
|
|
40555
|
+
if (defaultModel.length > 0 && !unsupportedModels.some((diagnostic) => diagnostic.requestedValue === defaultModel)) {
|
|
40387
40556
|
valuesByModel[defaultModel] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
40388
40557
|
}
|
|
40389
40558
|
return {
|
|
40390
40559
|
effortSettingId: selectedEffort?.id ?? "",
|
|
40391
40560
|
modelSettingId: model.id,
|
|
40392
40561
|
resolution: "on_model_selection",
|
|
40562
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
40393
40563
|
valuesByModel
|
|
40394
40564
|
};
|
|
40395
40565
|
}
|
|
@@ -40398,6 +40568,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
40398
40568
|
effortSettingId: "",
|
|
40399
40569
|
modelSettingId: modelEffort.modelSettingId,
|
|
40400
40570
|
resolution: modelEffort.resolution,
|
|
40571
|
+
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
40401
40572
|
valuesByModel: {}
|
|
40402
40573
|
};
|
|
40403
40574
|
return createHash4("sha256").update(
|
|
@@ -40505,9 +40676,11 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
40505
40676
|
sessionId: command.sessionId,
|
|
40506
40677
|
runtimeTimings: metrics.snapshot()
|
|
40507
40678
|
};
|
|
40508
|
-
|
|
40509
|
-
|
|
40510
|
-
|
|
40679
|
+
if (command.transient !== true) {
|
|
40680
|
+
metrics.measureSync("readiness-commit", () => {
|
|
40681
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
40682
|
+
});
|
|
40683
|
+
}
|
|
40511
40684
|
return event;
|
|
40512
40685
|
});
|
|
40513
40686
|
send(socket, {
|
|
@@ -41462,16 +41635,33 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41462
41635
|
config2,
|
|
41463
41636
|
directories,
|
|
41464
41637
|
sessions,
|
|
41465
|
-
operationSignal
|
|
41638
|
+
operationSignal,
|
|
41639
|
+
timer
|
|
41466
41640
|
);
|
|
41641
|
+
for (const diagnostic of result.unsupportedModels) {
|
|
41642
|
+
const details = agentSettingsFailureDetails(command2.agentId, diagnostic);
|
|
41643
|
+
audit.record({
|
|
41644
|
+
commandId: command2.requestId,
|
|
41645
|
+
details,
|
|
41646
|
+
event: "agent_settings_model_unsupported",
|
|
41647
|
+
sessionId: `agent-settings:${command2.agentId}`
|
|
41648
|
+
});
|
|
41649
|
+
process.stderr.write(
|
|
41650
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command2.requestId, ...details })}
|
|
41651
|
+
`
|
|
41652
|
+
);
|
|
41653
|
+
}
|
|
41467
41654
|
audit.record({
|
|
41468
41655
|
commandId: command2.requestId,
|
|
41469
|
-
details: {
|
|
41656
|
+
details: {
|
|
41657
|
+
agentId: command2.agentId,
|
|
41658
|
+
unsupportedModelCount: result.unsupportedModels.length.toString()
|
|
41659
|
+
},
|
|
41470
41660
|
event: "agent_settings_discovered",
|
|
41471
41661
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41472
41662
|
});
|
|
41473
41663
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41474
|
-
send(socket, result);
|
|
41664
|
+
send(socket, result.event);
|
|
41475
41665
|
}
|
|
41476
41666
|
} catch (error62) {
|
|
41477
41667
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new AcpExecutionError(
|
|
@@ -41479,12 +41669,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41479
41669
|
{},
|
|
41480
41670
|
"agent_settings_discovery_cancelled"
|
|
41481
41671
|
) : error62;
|
|
41672
|
+
const details = agentSettingsFailureDetails(command2.agentId, failure2);
|
|
41482
41673
|
audit.record({
|
|
41483
41674
|
commandId: command2.requestId,
|
|
41484
|
-
details
|
|
41675
|
+
details,
|
|
41485
41676
|
event: "agent_settings_discovery_failed",
|
|
41486
41677
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41487
41678
|
});
|
|
41679
|
+
if (failure2 instanceof AcpConfigurationValueUnavailableError) {
|
|
41680
|
+
process.stderr.write(
|
|
41681
|
+
`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command2.requestId, ...details })}
|
|
41682
|
+
`
|
|
41683
|
+
);
|
|
41684
|
+
}
|
|
41488
41685
|
if (socket.readyState === WebSocket2.OPEN) {
|
|
41489
41686
|
send(socket, {
|
|
41490
41687
|
code: operationErrorCode(failure2),
|