@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/run-daemon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-daemon.d.ts","sourceRoot":"","sources":["../src/run-daemon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-daemon.d.ts","sourceRoot":"","sources":["../src/run-daemon.ts"],"names":[],"mappings":"AAoHA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,KAAK,YAAY,EAA6C,MAAM,aAAa,CAAC;AAa3F,OAAO,EAA4B,KAAK,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AA6zD5G,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,8BAA8B,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;CAC3G;AA6kCD,wBAAsB,SAAS,CAC3B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,EACnB,KAAK,GAAE,WAA+B,EACtC,OAAO,GAAE,gBAAqB,GAC/B,OAAO,CAAC,IAAI,CAAC,CA8Jf"}
|
package/dist/run-daemon.js
CHANGED
|
@@ -3,7 +3,7 @@ import { basename } from "node:path";
|
|
|
3
3
|
import { styleText } from "node:util";
|
|
4
4
|
import { AGENT_ACTIVITY_KIND, AGENT_CATALOG_REFRESH_FAILED_KIND, AGENT_CATALOG_REFRESH_KIND, AGENT_CATALOG_REFRESHED_KIND, AGENT_INSTALL_CANCEL_KIND, AGENT_INSTALL_CANCELLED_KIND, AGENT_INSTALL_COMPLETED_KIND, AGENT_INSTALL_FAILED_KIND, AGENT_INSTALL_PROGRESS_KIND, AGENT_INSTALL_REQUEST_KIND, AGENT_INSTALL_STARTED_KIND, AGENT_MESSAGE_DELTA_KIND, AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE, AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION, AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE, AGENT_SETTINGS_DISCOVER_KIND, AGENT_SETTINGS_DISCOVERED_KIND, AGENT_SETTINGS_DISCOVERY_FAILED_KIND, decodeServiceToDaemonMessage, decodeSessionEventEnvelope, decodeSessionLiveHistoryLoad, encodeDaemonToServiceMessage, encodeRecordedSessionEvent, FILE_FAILED_KIND, FILE_READ_KIND, NATIVE_SESSION_CANCEL_KIND, NATIVE_SESSION_REQUEST_KIND, NATIVE_SESSION_TURN_FORK_KIND, RUNTIME_DELIVERY_COMMITTED_KIND, RUNTIME_DELIVERY_KIND, RUNTIME_DELIVERY_RECEIVED_KIND, RUNTIME_HEARTBEAT_ACK_KIND, RUNTIME_LIVENESS_READY_KIND, SESSION_CANCEL_KIND, SESSION_COMPLETED_KIND, SESSION_CONFIGURE_KIND, SESSION_ELICITATION_RESPOND_KIND, SESSION_EVENT_ACK_KIND, SESSION_EVENT_DEFERRED_KIND, SESSION_EVENT_REJECTED_KIND, SESSION_FAILED_KIND, SESSION_LIVE_HISTORY_LOAD_KIND, SESSION_PERMISSION_RESPOND_KIND, SESSION_PREPARE_KIND, SESSION_PROMPT_KIND, SESSION_STARTED_KIND, SessionPromptDisposition, WORKSPACE_LIST_KIND, } from "@moxt-ai/mobius-protocol";
|
|
5
5
|
import { fetch, WebSocket } from "undici";
|
|
6
|
-
import { AcpExecutionError, AcpSessionManager } from "./acp/session-manager.js";
|
|
6
|
+
import { AcpConfigurationValueUnavailableError, AcpExecutionError, AcpSessionManager, } from "./acp/session-manager.js";
|
|
7
7
|
import { SqliteAcpSessionStore } from "./acp/session-store.js";
|
|
8
8
|
import { agentSettingsAdapterForAgent, applyAgentLaunchSettings } from "./agent-catalog/agent-settings-adapter.js";
|
|
9
9
|
import { discoverLocalAgentInventory, supportedLocalAgentSpecifications, } from "./agent-catalog/discover-local-agents.js";
|
|
@@ -589,6 +589,19 @@ function operationErrorMessage(error) {
|
|
|
589
589
|
}
|
|
590
590
|
return "The local agent operation could not be completed";
|
|
591
591
|
}
|
|
592
|
+
function agentSettingsFailureDetails(agentId, failure) {
|
|
593
|
+
const details = { agentId, code: operationErrorCode(failure) };
|
|
594
|
+
if (!(failure instanceof AcpConfigurationValueUnavailableError)) {
|
|
595
|
+
return details;
|
|
596
|
+
}
|
|
597
|
+
return {
|
|
598
|
+
...details,
|
|
599
|
+
configId: failure.configId,
|
|
600
|
+
offeredValueCount: failure.offeredValueCount.toString(),
|
|
601
|
+
offeredValues: JSON.stringify(failure.offeredValues),
|
|
602
|
+
requestedValue: failure.requestedValue,
|
|
603
|
+
};
|
|
604
|
+
}
|
|
592
605
|
function reportOperationFailure(socket, requestId, sessionId, error, runtimeTimings = []) {
|
|
593
606
|
if (socket.readyState !== WebSocket.OPEN) {
|
|
594
607
|
return;
|
|
@@ -621,37 +634,86 @@ async function resolveSessionDirectories(directories, bindingId, directoryId, ad
|
|
|
621
634
|
}
|
|
622
635
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
623
636
|
}
|
|
624
|
-
|
|
637
|
+
const OPENCODE_PROVIDER_SETTLEMENT_MILLISECONDS = 1_000;
|
|
638
|
+
async function waitForAgentSettingsReadiness(agentId, signal, timer) {
|
|
639
|
+
if (agentId !== "opencode") {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
// OpenCode ACP snapshots the first non-empty model catalog, before asynchronously loaded custom providers settle.
|
|
643
|
+
signal.throwIfAborted();
|
|
644
|
+
await new Promise((resolve) => {
|
|
645
|
+
const readiness = timer.schedule(finish, OPENCODE_PROVIDER_SETTLEMENT_MILLISECONDS);
|
|
646
|
+
function finish() {
|
|
647
|
+
readiness.cancel();
|
|
648
|
+
signal.removeEventListener("abort", finish);
|
|
649
|
+
resolve();
|
|
650
|
+
}
|
|
651
|
+
signal.addEventListener("abort", finish, { once: true });
|
|
652
|
+
});
|
|
653
|
+
signal.throwIfAborted();
|
|
654
|
+
}
|
|
655
|
+
function isUnavailableModel(cause, modelSettingId, requestedModel) {
|
|
656
|
+
return (cause instanceof AcpConfigurationValueUnavailableError &&
|
|
657
|
+
cause.configId === modelSettingId &&
|
|
658
|
+
cause.requestedValue === requestedModel);
|
|
659
|
+
}
|
|
660
|
+
function unsupportedModelIds(unsupportedModels) {
|
|
661
|
+
return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
|
|
662
|
+
}
|
|
663
|
+
async function discoverAgentSettings(command, config, directories, sessions, signal, timer) {
|
|
625
664
|
const agent = config.catalog.find(command.agentId);
|
|
626
665
|
const cwd = await directories.resolve(config.bindingId, "default", signal);
|
|
666
|
+
await waitForAgentSettingsReadiness(agent.id, signal, timer);
|
|
627
667
|
const baseSnapshot = await sessions.inspectAgentSettings({
|
|
628
668
|
additionalDirectories: [],
|
|
629
669
|
agent,
|
|
630
670
|
cwd,
|
|
631
671
|
signal,
|
|
632
672
|
});
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
673
|
+
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
674
|
+
const unsupportedModels = [];
|
|
675
|
+
let selectedSnapshot = baseSnapshot;
|
|
676
|
+
if (command.model !== undefined) {
|
|
677
|
+
if (baseModel === undefined ||
|
|
678
|
+
baseModel.type !== "select" ||
|
|
679
|
+
!baseModel.values.some((value) => value.value === command.model)) {
|
|
680
|
+
unsupportedModels.push(new AcpConfigurationValueUnavailableError(baseModel?.id ?? "model", command.model, baseModel?.values.map((value) => value.value) ?? []));
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
try {
|
|
684
|
+
selectedSnapshot = await sessions.inspectAgentSettings({
|
|
685
|
+
additionalDirectories: [],
|
|
686
|
+
agent,
|
|
687
|
+
cwd,
|
|
688
|
+
model: command.model,
|
|
689
|
+
signal,
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
catch (cause) {
|
|
693
|
+
signal.throwIfAborted();
|
|
694
|
+
if (!isUnavailableModel(cause, baseModel.id, command.model)) {
|
|
695
|
+
throw cause;
|
|
696
|
+
}
|
|
697
|
+
unsupportedModels.push(cause);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
642
701
|
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
643
|
-
const
|
|
644
|
-
const
|
|
645
|
-
const
|
|
702
|
+
const modelEffort = await discoverModelEffort(command, agent, adapter.modelEffortResolution, baseSnapshot.configOptions, selectedSnapshot.configOptions, unsupportedModels, cwd, sessions, signal);
|
|
703
|
+
const baseSettings = withoutUnsupportedModels(settingsFromSnapshot(agent, baseSnapshot.configOptions), baseModel?.id ?? "", modelEffort.unsupportedModelIds);
|
|
704
|
+
const settings = withoutUnsupportedModels(settingsFromSnapshot(agent, selectedSnapshot.configOptions), baseModel?.id ?? "", modelEffort.unsupportedModelIds);
|
|
646
705
|
return {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
706
|
+
event: {
|
|
707
|
+
agentId: command.agentId,
|
|
708
|
+
agentName: selectedSnapshot.agentName,
|
|
709
|
+
agentVersion: selectedSnapshot.agentVersion,
|
|
710
|
+
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
711
|
+
modelEffort,
|
|
712
|
+
requestId: command.requestId,
|
|
713
|
+
settings,
|
|
714
|
+
settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort),
|
|
715
|
+
},
|
|
716
|
+
unsupportedModels,
|
|
655
717
|
};
|
|
656
718
|
}
|
|
657
719
|
function settingFromOption(option) {
|
|
@@ -683,6 +745,22 @@ function settingsFromSnapshot(agent, configOptions) {
|
|
|
683
745
|
}
|
|
684
746
|
return settings;
|
|
685
747
|
}
|
|
748
|
+
function withoutUnsupportedModels(settings, modelSettingId, unsupportedModelIds) {
|
|
749
|
+
if (modelSettingId.length === 0 || unsupportedModelIds.length === 0) {
|
|
750
|
+
return settings;
|
|
751
|
+
}
|
|
752
|
+
const unsupported = new Set(unsupportedModelIds);
|
|
753
|
+
return settings.map((setting) => {
|
|
754
|
+
if (setting.id !== modelSettingId || setting.type !== "select") {
|
|
755
|
+
return setting;
|
|
756
|
+
}
|
|
757
|
+
return {
|
|
758
|
+
...setting,
|
|
759
|
+
defaultValue: unsupported.has(setting.defaultValue) ? "" : setting.defaultValue,
|
|
760
|
+
values: setting.values.filter((value) => !unsupported.has(value.value)),
|
|
761
|
+
};
|
|
762
|
+
});
|
|
763
|
+
}
|
|
686
764
|
function modelOption(options) {
|
|
687
765
|
return options.find((option) => option.id === "model" || option.category === "model");
|
|
688
766
|
}
|
|
@@ -694,17 +772,19 @@ function unavailableModelEffort() {
|
|
|
694
772
|
effortSettingId: "",
|
|
695
773
|
modelSettingId: "",
|
|
696
774
|
resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
|
|
775
|
+
unsupportedModelIds: [],
|
|
697
776
|
valuesByModel: {},
|
|
698
777
|
};
|
|
699
778
|
}
|
|
700
|
-
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
|
|
779
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
|
|
701
780
|
const model = modelOption(initialOptions);
|
|
781
|
+
const unsupportedModels = initiallyUnsupportedModels;
|
|
702
782
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE &&
|
|
703
783
|
resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
704
|
-
return unavailableModelEffort();
|
|
784
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
705
785
|
}
|
|
706
786
|
if (model === undefined || model.type !== "select" || model.values.length === 0) {
|
|
707
|
-
return unavailableModelEffort();
|
|
787
|
+
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
708
788
|
}
|
|
709
789
|
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
710
790
|
additionalDirectories: [],
|
|
@@ -717,29 +797,46 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
717
797
|
if (resolution === "complete") {
|
|
718
798
|
const effort = effortOption(initialOptions);
|
|
719
799
|
if (effort === undefined || effort.type !== "select" || effort.values.length < 2) {
|
|
720
|
-
return
|
|
800
|
+
return {
|
|
801
|
+
...unavailableModelEffort(),
|
|
802
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
803
|
+
};
|
|
721
804
|
}
|
|
722
805
|
for (const value of model.values) {
|
|
723
|
-
|
|
724
|
-
|
|
806
|
+
if (unsupportedModels.some((diagnostic) => diagnostic.requestedValue === value.value)) {
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
try {
|
|
810
|
+
const selectedEffort = effortOption(await inspectModel(value.value));
|
|
811
|
+
valuesByModel[value.value] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
812
|
+
}
|
|
813
|
+
catch (cause) {
|
|
814
|
+
signal.throwIfAborted();
|
|
815
|
+
if (!isUnavailableModel(cause, model.id, value.value)) {
|
|
816
|
+
throw cause;
|
|
817
|
+
}
|
|
818
|
+
unsupportedModels.push(cause);
|
|
819
|
+
}
|
|
725
820
|
}
|
|
726
821
|
return {
|
|
727
822
|
effortSettingId: effort.id,
|
|
728
823
|
modelSettingId: model.id,
|
|
729
824
|
resolution: "complete",
|
|
825
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
730
826
|
valuesByModel,
|
|
731
827
|
};
|
|
732
828
|
}
|
|
733
829
|
if (command.model !== undefined) {
|
|
734
|
-
|
|
735
|
-
throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
|
|
736
|
-
}
|
|
830
|
+
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command.model);
|
|
737
831
|
const selectedEffort = effortOption(selectedOptions);
|
|
738
|
-
|
|
832
|
+
if (!modelUnsupported) {
|
|
833
|
+
valuesByModel[command.model] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
834
|
+
}
|
|
739
835
|
return {
|
|
740
836
|
effortSettingId: selectedEffort?.id ?? "",
|
|
741
837
|
modelSettingId: model.id,
|
|
742
838
|
resolution: "on_model_selection",
|
|
839
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
743
840
|
valuesByModel,
|
|
744
841
|
};
|
|
745
842
|
}
|
|
@@ -748,16 +845,28 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
748
845
|
// too, or a session that never switches models can never offer an effort.
|
|
749
846
|
const defaultModel = model.type === "select" ? model.currentValue : "";
|
|
750
847
|
const reportedEffort = effortOption(selectedOptions);
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
848
|
+
let selectedEffort = reportedEffort;
|
|
849
|
+
if (defaultModel.length > 0 && reportedEffort === undefined) {
|
|
850
|
+
try {
|
|
851
|
+
selectedEffort = effortOption(await inspectModel(defaultModel));
|
|
852
|
+
}
|
|
853
|
+
catch (cause) {
|
|
854
|
+
signal.throwIfAborted();
|
|
855
|
+
if (!isUnavailableModel(cause, model.id, defaultModel)) {
|
|
856
|
+
throw cause;
|
|
857
|
+
}
|
|
858
|
+
unsupportedModels.push(cause);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
if (defaultModel.length > 0 &&
|
|
862
|
+
!unsupportedModels.some((diagnostic) => diagnostic.requestedValue === defaultModel)) {
|
|
755
863
|
valuesByModel[defaultModel] = selectedEffort?.type === "select" ? selectedEffort.values : [];
|
|
756
864
|
}
|
|
757
865
|
return {
|
|
758
866
|
effortSettingId: selectedEffort?.id ?? "",
|
|
759
867
|
modelSettingId: model.id,
|
|
760
868
|
resolution: "on_model_selection",
|
|
869
|
+
unsupportedModelIds: unsupportedModelIds(unsupportedModels),
|
|
761
870
|
valuesByModel,
|
|
762
871
|
};
|
|
763
872
|
}
|
|
@@ -771,6 +880,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
771
880
|
effortSettingId: "",
|
|
772
881
|
modelSettingId: modelEffort.modelSettingId,
|
|
773
882
|
resolution: modelEffort.resolution,
|
|
883
|
+
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
774
884
|
valuesByModel: {},
|
|
775
885
|
};
|
|
776
886
|
return createHash("sha256")
|
|
@@ -868,9 +978,14 @@ async function executeSessionPrepare(publisher, socket, command, config, directo
|
|
|
868
978
|
sessionId: command.sessionId,
|
|
869
979
|
runtimeTimings: metrics.snapshot(),
|
|
870
980
|
};
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
981
|
+
// An inspection-only preparation has no Session on the Relay, so this readiness is a reply
|
|
982
|
+
// rather than a record: committing it would be rejected as an unknown Session and quarantine
|
|
983
|
+
// an event that can never be replayed. The direct send below still delivers it.
|
|
984
|
+
if (command.transient !== true) {
|
|
985
|
+
metrics.measureSync("readiness-commit", () => {
|
|
986
|
+
publisher.recordRuntime(command.sessionId, event);
|
|
987
|
+
});
|
|
988
|
+
}
|
|
874
989
|
return event;
|
|
875
990
|
});
|
|
876
991
|
send(socket, {
|
|
@@ -1684,15 +1799,28 @@ async function runRelayConnection(config, directories, audit, sessions, installa
|
|
|
1684
1799
|
const timeout = timer.schedule(() => controller.abort(new AcpExecutionError("Agent settings discovery timed out", {}, "agent_settings_discovery_timeout")), 90_000);
|
|
1685
1800
|
const completion = (async () => {
|
|
1686
1801
|
try {
|
|
1687
|
-
const result = await discoverAgentSettings(command, config, directories, sessions, operationSignal);
|
|
1802
|
+
const result = await discoverAgentSettings(command, config, directories, sessions, operationSignal, timer);
|
|
1803
|
+
for (const diagnostic of result.unsupportedModels) {
|
|
1804
|
+
const details = agentSettingsFailureDetails(command.agentId, diagnostic);
|
|
1805
|
+
audit.record({
|
|
1806
|
+
commandId: command.requestId,
|
|
1807
|
+
details,
|
|
1808
|
+
event: "agent_settings_model_unsupported",
|
|
1809
|
+
sessionId: `agent-settings:${command.agentId}`,
|
|
1810
|
+
});
|
|
1811
|
+
process.stderr.write(`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command.requestId, ...details })}\n`);
|
|
1812
|
+
}
|
|
1688
1813
|
audit.record({
|
|
1689
1814
|
commandId: command.requestId,
|
|
1690
|
-
details: {
|
|
1815
|
+
details: {
|
|
1816
|
+
agentId: command.agentId,
|
|
1817
|
+
unsupportedModelCount: result.unsupportedModels.length.toString(),
|
|
1818
|
+
},
|
|
1691
1819
|
event: "agent_settings_discovered",
|
|
1692
1820
|
sessionId: `agent-settings:${command.agentId}`,
|
|
1693
1821
|
});
|
|
1694
1822
|
if (socket.readyState === WebSocket.OPEN) {
|
|
1695
|
-
send(socket, result);
|
|
1823
|
+
send(socket, result.event);
|
|
1696
1824
|
}
|
|
1697
1825
|
}
|
|
1698
1826
|
catch (error) {
|
|
@@ -1700,12 +1828,16 @@ async function runRelayConnection(config, directories, audit, sessions, installa
|
|
|
1700
1828
|
? (controller.signal.reason ??
|
|
1701
1829
|
new AcpExecutionError("Agent settings discovery cancelled", {}, "agent_settings_discovery_cancelled"))
|
|
1702
1830
|
: error;
|
|
1831
|
+
const details = agentSettingsFailureDetails(command.agentId, failure);
|
|
1703
1832
|
audit.record({
|
|
1704
1833
|
commandId: command.requestId,
|
|
1705
|
-
details
|
|
1834
|
+
details,
|
|
1706
1835
|
event: "agent_settings_discovery_failed",
|
|
1707
1836
|
sessionId: `agent-settings:${command.agentId}`,
|
|
1708
1837
|
});
|
|
1838
|
+
if (failure instanceof AcpConfigurationValueUnavailableError) {
|
|
1839
|
+
process.stderr.write(`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command.requestId, ...details })}\n`);
|
|
1840
|
+
}
|
|
1709
1841
|
if (socket.readyState === WebSocket.OPEN) {
|
|
1710
1842
|
send(socket, {
|
|
1711
1843
|
code: operationErrorCode(failure),
|