@moxt-ai/mobius 0.0.51 → 0.0.53

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.
Files changed (33) hide show
  1. package/dist/acp/session-config/grok-build-session-config.d.ts.map +1 -1
  2. package/dist/acp/session-config/grok-build-session-config.js +2 -2
  3. package/dist/acp/session-config/grok-build-session-config.js.map +1 -1
  4. package/dist/acp/session-config/session-config-protocol.d.ts +0 -2
  5. package/dist/acp/session-config/session-config-protocol.d.ts.map +1 -1
  6. package/dist/acp/session-config/session-config-protocol.js +8 -107
  7. package/dist/acp/session-config/session-config-protocol.js.map +1 -1
  8. package/dist/acp/session-manager.d.ts +1 -0
  9. package/dist/acp/session-manager.d.ts.map +1 -1
  10. package/dist/acp/session-manager.js +25 -39
  11. package/dist/acp/session-manager.js.map +1 -1
  12. package/dist/agent-catalog/agent-settings-adapter.d.ts +22 -0
  13. package/dist/agent-catalog/agent-settings-adapter.d.ts.map +1 -0
  14. package/dist/agent-catalog/agent-settings-adapter.js +191 -0
  15. package/dist/agent-catalog/agent-settings-adapter.js.map +1 -0
  16. package/dist/agent-catalog/local-agent.d.ts +2 -4
  17. package/dist/agent-catalog/local-agent.d.ts.map +1 -1
  18. package/dist/agent-catalog/local-agent.js +3 -12
  19. package/dist/agent-catalog/local-agent.js.map +1 -1
  20. package/dist/cli.js +22760 -22748
  21. package/dist/cli.js.map +4 -4
  22. package/dist/index.js +506 -496
  23. package/dist/index.js.map +4 -4
  24. package/dist/run-daemon.d.ts.map +1 -1
  25. package/dist/run-daemon.js +172 -64
  26. package/dist/run-daemon.js.map +1 -1
  27. package/dist/runtime.js +22636 -22624
  28. package/dist/runtime.js.map +4 -4
  29. package/package.json +1 -1
  30. package/dist/agent-catalog/agent-permission-profile.d.ts +0 -16
  31. package/dist/agent-catalog/agent-permission-profile.d.ts.map +0 -1
  32. package/dist/agent-catalog/agent-permission-profile.js +0 -194
  33. package/dist/agent-catalog/agent-permission-profile.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"run-daemon.d.ts","sourceRoot":"","sources":["../src/run-daemon.ts"],"names":[],"mappings":"AA2IA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAUhD,OAAO,EAA4B,KAAK,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAg3E5G,wBAAsB,SAAS,CAC3B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,EACnB,KAAK,GAAE,WAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAoJf"}
1
+ {"version":3,"file":"run-daemon.d.ts","sourceRoot":"","sources":["../src/run-daemon.ts"],"names":[],"mappings":"AAgJA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAUhD,OAAO,EAA4B,KAAK,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AA4/E5G,wBAAsB,SAAS,CAC3B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,EACnB,KAAK,GAAE,WAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAoJf"}
@@ -1,10 +1,11 @@
1
- import { randomUUID } from "node:crypto";
1
+ import { createHash, randomUUID } from "node:crypto";
2
2
  import { basename } from "node:path";
3
3
  import { styleText } from "node:util";
4
- import { AGENT_ACTIVITY_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_PERMISSION_MODE_CONFIG_ID, AGENT_SETTINGS_DISCOVER_KIND, AGENT_SETTINGS_DISCOVERED_KIND, AGENT_SETTINGS_DISCOVERY_FAILED_KIND, decodeAgentInstallCancelCommand, decodeAgentInstallRequestCommand, decodeAgentSettingsDiscoverCommand, decodeFileReadCommand, decodeMessageKind, decodeNativeSessionCancel, decodeNativeSessionCommand, decodeNativeSessionTurnForkCommand, decodeRuntimeDelivery, decodeRuntimeDeliveryCommitted, decodeRuntimeHeartbeatAckEvent, decodeRuntimeLivenessReadyEvent, decodeSessionCancelCommand, decodeSessionConfigureCommand, decodeSessionElicitationRespondCommand, decodeSessionEventAcknowledgement, decodeSessionEventDeferred, decodeSessionEventEnvelope, decodeSessionEventRejection, decodeSessionPermissionRespondCommand, decodeSessionPrepareCommand, decodeSessionPromptCommand, decodeWorkspaceListCommand, encodeAgentActivityEvent, encodeAgentContentEvent, encodeAgentInstallCancelledEvent, encodeAgentInstallCompletedEvent, encodeAgentInstallFailedEvent, encodeAgentInstallProgressEvent, encodeAgentInstallStartedEvent, encodeAgentMessageDeltaEvent, encodeAgentSettingsDiscoveredEvent, encodeAgentSettingsDiscoveryFailedEvent, encodeFileFailedEvent, encodeNativeSessionResult, encodeRuntimeDeliveryReceived, encodeSessionCommandsUpdatedEvent, encodeSessionCompletedEvent, encodeSessionConfigUpdatedEvent, encodeSessionElicitationRequestedEvent, encodeSessionElicitationResolvedEvent, encodeSessionFailedEvent, encodeSessionInfoUpdatedEvent, encodeSessionOperationFailedEvent, encodeSessionPermissionRequestedEvent, encodeSessionPermissionResolvedEvent, encodeSessionReadyEvent, encodeSessionStartedEvent, encodeSessionUsageUpdatedEvent, encodeWorkspaceEntriesEvent, 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_PERMISSION_RESPOND_KIND, SESSION_PREPARE_KIND, SESSION_PROMPT_KIND, SESSION_STARTED_KIND, SessionPromptDisposition, WORKSPACE_LIST_KIND, } from "@moxt-ai/mobius-protocol";
4
+ import { AGENT_ACTIVITY_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, decodeAgentInstallCancelCommand, decodeAgentInstallRequestCommand, decodeAgentSettingsDiscoverCommand, decodeFileReadCommand, decodeMessageKind, decodeNativeSessionCancel, decodeNativeSessionCommand, decodeNativeSessionTurnForkCommand, decodeRuntimeDelivery, decodeRuntimeDeliveryCommitted, decodeRuntimeHeartbeatAckEvent, decodeRuntimeLivenessReadyEvent, decodeSessionCancelCommand, decodeSessionConfigureCommand, decodeSessionElicitationRespondCommand, decodeSessionEventAcknowledgement, decodeSessionEventDeferred, decodeSessionEventEnvelope, decodeSessionEventRejection, decodeSessionPermissionRespondCommand, decodeSessionPrepareCommand, decodeSessionPromptCommand, decodeWorkspaceListCommand, encodeAgentActivityEvent, encodeAgentContentEvent, encodeAgentInstallCancelledEvent, encodeAgentInstallCompletedEvent, encodeAgentInstallFailedEvent, encodeAgentInstallProgressEvent, encodeAgentInstallStartedEvent, encodeAgentMessageDeltaEvent, encodeAgentSettingsDiscoveredEvent, encodeAgentSettingsDiscoveryFailedEvent, encodeFileFailedEvent, encodeNativeSessionResult, encodeRuntimeDeliveryReceived, encodeSessionCommandsUpdatedEvent, encodeSessionCompletedEvent, encodeSessionConfigUpdatedEvent, encodeSessionElicitationRequestedEvent, encodeSessionElicitationResolvedEvent, encodeSessionFailedEvent, encodeSessionInfoUpdatedEvent, encodeSessionOperationFailedEvent, encodeSessionPermissionRequestedEvent, encodeSessionPermissionResolvedEvent, encodeSessionReadyEvent, encodeSessionStartedEvent, encodeSessionUsageUpdatedEvent, encodeWorkspaceEntriesEvent, 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_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
6
  import { AcpExecutionError, AcpSessionManager } from "./acp/session-manager.js";
7
7
  import { SqliteAcpSessionStore } from "./acp/session-store.js";
8
+ import { agentSettingsAdapterForAgent, applyAgentLaunchSettings } from "./agent-catalog/agent-settings-adapter.js";
8
9
  import { supportedLocalAgentSpecifications } from "./agent-catalog/discover-local-agents.js";
9
10
  import { AgentIntegrationDefinition, LocalAgentCatalogError, } from "./agent-catalog/local-agent.js";
10
11
  import { publishAgentCatalog } from "./agent-catalog/publish-agent-catalog.js";
@@ -584,24 +585,152 @@ async function resolveSessionDirectories(directories, bindingId, directoryId, ad
584
585
  return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
585
586
  }
586
587
  async function discoverAgentSettings(command, config, directories, sessions, signal) {
587
- const resolved = await resolveSessionDirectories(directories, config.bindingId, command.directoryId, command.additionalDirectoryIds, signal);
588
588
  const agent = config.catalog.find(command.agentId);
589
- const snapshot = await sessions.inspectAgentSettings({
590
- additionalDirectories: resolved.additionalDirectories,
589
+ const cwd = await directories.resolve(config.bindingId, "default", signal);
590
+ const baseSnapshot = await sessions.inspectAgentSettings({
591
+ additionalDirectories: [],
591
592
  agent,
592
- cwd: resolved.cwd,
593
+ cwd,
593
594
  signal,
594
595
  });
596
+ const selectedSnapshot = command.model === undefined
597
+ ? baseSnapshot
598
+ : await sessions.inspectAgentSettings({
599
+ additionalDirectories: [],
600
+ agent,
601
+ cwd,
602
+ model: command.model,
603
+ signal,
604
+ });
605
+ const adapter = agentSettingsAdapterForAgent(agent.id);
606
+ const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
607
+ const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
608
+ const modelEffort = await discoverModelEffort(command, agent, adapter.modelEffortResolution, baseSnapshot.configOptions, selectedSnapshot.configOptions, cwd, sessions, signal);
595
609
  return {
596
610
  agentId: command.agentId,
597
- agentName: snapshot.agentName,
598
- agentVersion: snapshot.agentVersion,
599
- configOptions: snapshot.configOptions,
600
- directoryId: command.directoryId,
611
+ agentName: selectedSnapshot.agentName,
612
+ agentVersion: selectedSnapshot.agentVersion,
601
613
  kind: AGENT_SETTINGS_DISCOVERED_KIND,
614
+ modelEffort,
602
615
  requestId: command.requestId,
616
+ settings,
617
+ settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort),
618
+ };
619
+ }
620
+ function settingFromOption(option) {
621
+ return {
622
+ booleanValue: option.booleanValue,
623
+ category: option.category,
624
+ defaultValue: option.type === "boolean" ? "" : option.currentValue,
625
+ description: option.description,
626
+ id: option.id,
627
+ name: option.name,
628
+ type: option.type,
629
+ values: option.values,
630
+ };
631
+ }
632
+ function settingsFromSnapshot(agent, configOptions) {
633
+ const settings = [
634
+ ...agentSettingsAdapterForAgent(agent.id).settings(agent).map(settingFromOption),
635
+ ...configOptions.map(settingFromOption),
636
+ ];
637
+ const identifiers = new Set();
638
+ for (const setting of settings) {
639
+ if (identifiers.has(setting.id)) {
640
+ throw new AcpExecutionError("The Agent returned duplicate setting identifiers", {}, "invalid_session_configuration");
641
+ }
642
+ identifiers.add(setting.id);
643
+ }
644
+ if (settings.length > 128) {
645
+ throw new AcpExecutionError("The Agent returned too many settings", {}, "invalid_session_configuration");
646
+ }
647
+ return settings;
648
+ }
649
+ function modelOption(options) {
650
+ return options.find((option) => option.id === "model" || option.category === "model");
651
+ }
652
+ function effortOption(options) {
653
+ return options.find((option) => option.id === "reasoning_effort" || option.category === "thought_level");
654
+ }
655
+ function unavailableModelEffort() {
656
+ return {
657
+ effortSettingId: "",
658
+ modelSettingId: "",
659
+ resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
660
+ valuesByModel: {},
661
+ };
662
+ }
663
+ async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
664
+ const model = modelOption(initialOptions);
665
+ if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE &&
666
+ resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
667
+ return unavailableModelEffort();
668
+ }
669
+ if (model === undefined || model.type !== "select" || model.values.length === 0) {
670
+ return unavailableModelEffort();
671
+ }
672
+ const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
673
+ additionalDirectories: [],
674
+ agent,
675
+ cwd,
676
+ model: modelValue,
677
+ signal,
678
+ })).configOptions;
679
+ const valuesByModel = {};
680
+ if (resolution === "complete") {
681
+ const effort = effortOption(initialOptions);
682
+ if (effort === undefined || effort.type !== "select" || effort.values.length < 2) {
683
+ return unavailableModelEffort();
684
+ }
685
+ for (const value of model.values) {
686
+ const selectedEffort = effortOption(await inspectModel(value.value));
687
+ valuesByModel[value.value] = selectedEffort?.type === "select" ? selectedEffort.values : [];
688
+ }
689
+ return {
690
+ effortSettingId: effort.id,
691
+ modelSettingId: model.id,
692
+ resolution: "complete",
693
+ valuesByModel,
694
+ };
695
+ }
696
+ if (command.model !== undefined) {
697
+ if (!model.values.some((value) => value.value === command.model)) {
698
+ throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
699
+ }
700
+ const selectedEffort = effortOption(selectedOptions);
701
+ valuesByModel[command.model] = selectedEffort?.type === "select" ? selectedEffort.values : [];
702
+ }
703
+ const selectedEffort = effortOption(selectedOptions);
704
+ return {
705
+ effortSettingId: selectedEffort?.id ?? "",
706
+ modelSettingId: model.id,
707
+ resolution: "on_model_selection",
708
+ valuesByModel,
603
709
  };
604
710
  }
711
+ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
712
+ // A dynamic effort lookup adds one model's settings and values to an
713
+ // otherwise stable Agent capability document. It must not look like the
714
+ // Agent's settings changed each time a caller switches models.
715
+ const revisionModelEffort = modelEffort.resolution === AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE
716
+ ? modelEffort
717
+ : {
718
+ effortSettingId: "",
719
+ modelSettingId: modelEffort.modelSettingId,
720
+ resolution: modelEffort.resolution,
721
+ valuesByModel: {},
722
+ };
723
+ return createHash("sha256")
724
+ .update(JSON.stringify({
725
+ adapterVersion: agent.adapterVersion,
726
+ agentId: agent.id,
727
+ agentVersion: agent.agentVersion,
728
+ modelEffort: revisionModelEffort,
729
+ reportedAgentVersion,
730
+ settings,
731
+ }))
732
+ .digest("hex");
733
+ }
605
734
  async function executeWorkspaceList(socket, command, directories, audit, signal) {
606
735
  try {
607
736
  const listing = await directories.list(command.bindingId, command.directoryId, signal);
@@ -754,9 +883,11 @@ async function executePrompt(outbox, publisher, command, config, directories, au
754
883
  !outbox.isTerminalExecution(command.targetCommandId, command.sessionId)) {
755
884
  throw new AcpExecutionError("The queued prompt target is unavailable", {}, "prompt_queue_target_unavailable");
756
885
  }
757
- const executionAgent = command.sessionConfigurations === undefined
758
- ? agent
886
+ const appliedSettings = command.sessionConfigurations === undefined
887
+ ? undefined
759
888
  : agentForSessionConfiguration(agent, command.sessionConfigurations);
889
+ const executionAgent = appliedSettings?.agent ?? agent;
890
+ const sessionConfigurations = appliedSettings?.sessionConfigurations;
760
891
  if (command.sessionConfigurations !== undefined) {
761
892
  const prepared = await sessions.prepareExecutionSession({
762
893
  additionalDirectories: resolved.additionalDirectories,
@@ -766,10 +897,10 @@ async function executePrompt(outbox, publisher, command, config, directories, au
766
897
  signal,
767
898
  });
768
899
  if (command.disposition === SessionPromptDisposition.Steer) {
769
- assertCompleteSessionConfiguration(prepared.configOptions, command.sessionConfigurations);
900
+ assertCompleteSessionConfiguration(prepared.configOptions, sessionConfigurations ?? []);
770
901
  }
771
902
  else {
772
- await applyCompleteSessionConfiguration(sessions, audit, prepared.configOptions, command.sessionConfigurations, executionAgent, resolved.cwd, resolved.additionalDirectories, command.commandId, command.sessionId, signal);
903
+ await applyCompleteSessionConfiguration(sessions, audit, prepared.configOptions, sessionConfigurations ?? [], executionAgent, resolved.cwd, resolved.additionalDirectories, command.commandId, command.sessionId, signal);
773
904
  }
774
905
  }
775
906
  audit.record({
@@ -862,12 +993,15 @@ function invalidSessionConfiguration(message) {
862
993
  return new AcpExecutionError(message, {}, "invalid_session_configuration");
863
994
  }
864
995
  function agentForSessionConfiguration(agent, selections) {
865
- const permission = selections.find((selection) => selection.configId === AGENT_PERMISSION_MODE_CONFIG_ID);
866
- if (permission === undefined) {
867
- throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${AGENT_PERMISSION_MODE_CONFIG_ID}`);
996
+ try {
997
+ return applyAgentLaunchSettings(agent, selections);
998
+ }
999
+ catch (error) {
1000
+ if (error instanceof Error) {
1001
+ throw invalidSessionConfiguration(error.message);
1002
+ }
1003
+ throw error;
868
1004
  }
869
- validateSessionConfigurationSelection(agent.permissionProfile.option(agent.environment), permission);
870
- return agent.withPermissionMode(permission.value);
871
1005
  }
872
1006
  function validateSessionConfigurationSelection(option, selection) {
873
1007
  if (option.type !== selection.valueType) {
@@ -904,17 +1038,6 @@ function assertSessionConfigurationSchema(options, selections) {
904
1038
  }
905
1039
  }
906
1040
  }
907
- function assertSessionConfigurationCoverage(options, selections) {
908
- const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
909
- if (selectionsById.size !== selections.length) {
910
- throw invalidSessionConfiguration("The Turn configuration contains duplicate Agent settings");
911
- }
912
- for (const option of options) {
913
- if (!selectionsById.has(option.id)) {
914
- throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
915
- }
916
- }
917
- }
918
1041
  function sessionConfigurationSelectionIsAvailable(option, selection) {
919
1042
  if (option.type !== selection.valueType) {
920
1043
  return false;
@@ -931,20 +1054,17 @@ function sessionConfigurationMatches(option, selection) {
931
1054
  : option.currentValue === selection.value;
932
1055
  }
933
1056
  function sessionConfigurationPriority(selection, options) {
934
- if (selection.configId === "permission_mode") {
935
- return 0;
936
- }
937
1057
  const option = options.find((candidate) => candidate.id === selection.configId);
938
1058
  if (selection.configId === "model" || option?.category === "model") {
939
- return 1;
1059
+ return 0;
940
1060
  }
941
1061
  if (selection.configId === "reasoning_effort" || option?.category === "thought_level") {
942
- return 2;
1062
+ return 1;
943
1063
  }
944
1064
  if (option?.category === "model_config") {
945
- return 3;
1065
+ return 2;
946
1066
  }
947
- return 4;
1067
+ return 3;
948
1068
  }
949
1069
  function assertCompleteSessionConfiguration(options, selections) {
950
1070
  assertSessionConfigurationSchema(options, selections);
@@ -960,12 +1080,6 @@ function assertAppliedSessionConfiguration(options, selections) {
960
1080
  const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
961
1081
  for (const option of options) {
962
1082
  const selection = selectionsById.get(option.id);
963
- if (option.id === AGENT_PERMISSION_MODE_CONFIG_ID) {
964
- if (selection === undefined || !sessionConfigurationMatches(option, selection)) {
965
- throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
966
- }
967
- continue;
968
- }
969
1083
  if (selection === undefined || !sessionConfigurationSelectionIsAvailable(option, selection)) {
970
1084
  continue;
971
1085
  }
@@ -986,26 +1100,21 @@ function unavailableSessionConfigurationCategory(selection) {
986
1100
  async function applySessionConfigurationSelection(sessions, audit, options, selection, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
987
1101
  const option = options.find((candidate) => candidate.id === selection.configId);
988
1102
  if (option === undefined) {
989
- if (selection.configId !== AGENT_PERMISSION_MODE_CONFIG_ID) {
990
- warnIgnoredSetting(audit, "session_configuration_setting_ignored", commandId, sessionId, agent.id, selection, unavailableSessionConfigurationCategory(selection), "setting_unavailable");
991
- return options;
992
- }
993
- throw invalidSessionConfiguration(`The Agent setting ${selection.configId} is unavailable`);
1103
+ warnIgnoredSetting(audit, "session_configuration_setting_ignored", commandId, sessionId, agent.id, selection, unavailableSessionConfigurationCategory(selection), "setting_unavailable");
1104
+ return options;
994
1105
  }
995
- if (selection.configId !== AGENT_PERMISSION_MODE_CONFIG_ID) {
996
- if (option.type !== selection.valueType) {
997
- warnIgnoredSetting(audit, "session_configuration_setting_ignored", commandId, sessionId, agent.id, selection, option.category, "setting_schema_mismatch");
998
- return options;
999
- }
1000
- if ((option.type === "boolean" && selection.value.length > 0) ||
1001
- (option.type === "select" && selection.booleanValue)) {
1002
- warnIgnoredSetting(audit, "session_configuration_setting_ignored", commandId, sessionId, agent.id, selection, option.category, "selection_schema_mismatch");
1003
- return options;
1004
- }
1005
- if (option.type === "select" && !option.values.some((value) => value.value === selection.value)) {
1006
- warnIgnoredSetting(audit, "session_configuration_setting_ignored", commandId, sessionId, agent.id, selection, option.category, "value_unavailable");
1007
- return options;
1008
- }
1106
+ if (option.type !== selection.valueType) {
1107
+ warnIgnoredSetting(audit, "session_configuration_setting_ignored", commandId, sessionId, agent.id, selection, option.category, "setting_schema_mismatch");
1108
+ return options;
1109
+ }
1110
+ if ((option.type === "boolean" && selection.value.length > 0) ||
1111
+ (option.type === "select" && selection.booleanValue)) {
1112
+ warnIgnoredSetting(audit, "session_configuration_setting_ignored", commandId, sessionId, agent.id, selection, option.category, "selection_schema_mismatch");
1113
+ return options;
1114
+ }
1115
+ if (option.type === "select" && !option.values.some((value) => value.value === selection.value)) {
1116
+ warnIgnoredSetting(audit, "session_configuration_setting_ignored", commandId, sessionId, agent.id, selection, option.category, "value_unavailable");
1117
+ return options;
1009
1118
  }
1010
1119
  if (sessionConfigurationMatches(option, selection)) {
1011
1120
  return options;
@@ -1024,7 +1133,6 @@ async function applySessionConfigurationSelection(sessions, audit, options, sele
1024
1133
  });
1025
1134
  }
1026
1135
  async function applyCompleteSessionConfiguration(sessions, audit, initialOptions, selections, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
1027
- assertSessionConfigurationCoverage(initialOptions, selections);
1028
1136
  let options = initialOptions;
1029
1137
  const orderedSelections = selections.toSorted((left, right) => {
1030
1138
  const priority = sessionConfigurationPriority(left, initialOptions) - sessionConfigurationPriority(right, initialOptions);
@@ -1434,7 +1542,7 @@ async function runRelayConnection(config, directories, audit, sessions, installa
1434
1542
  const result = await discoverAgentSettings(command, config, directories, sessions, operationSignal);
1435
1543
  audit.record({
1436
1544
  commandId: command.requestId,
1437
- details: { agentId: command.agentId, directoryId: command.directoryId },
1545
+ details: { agentId: command.agentId },
1438
1546
  event: "agent_settings_discovered",
1439
1547
  sessionId: `agent-settings:${command.agentId}`,
1440
1548
  });