@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.
- package/dist/acp/session-config/grok-build-session-config.d.ts.map +1 -1
- package/dist/acp/session-config/grok-build-session-config.js +2 -2
- package/dist/acp/session-config/grok-build-session-config.js.map +1 -1
- package/dist/acp/session-config/session-config-protocol.d.ts +0 -2
- package/dist/acp/session-config/session-config-protocol.d.ts.map +1 -1
- package/dist/acp/session-config/session-config-protocol.js +8 -107
- package/dist/acp/session-config/session-config-protocol.js.map +1 -1
- package/dist/acp/session-manager.d.ts +1 -0
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +25 -39
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/agent-catalog/agent-settings-adapter.d.ts +22 -0
- package/dist/agent-catalog/agent-settings-adapter.d.ts.map +1 -0
- package/dist/agent-catalog/agent-settings-adapter.js +191 -0
- package/dist/agent-catalog/agent-settings-adapter.js.map +1 -0
- package/dist/agent-catalog/local-agent.d.ts +2 -4
- package/dist/agent-catalog/local-agent.d.ts.map +1 -1
- package/dist/agent-catalog/local-agent.js +3 -12
- package/dist/agent-catalog/local-agent.js.map +1 -1
- package/dist/cli.js +22760 -22748
- package/dist/cli.js.map +4 -4
- package/dist/index.js +506 -496
- package/dist/index.js.map +4 -4
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +172 -64
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +22636 -22624
- package/dist/runtime.js.map +4 -4
- package/package.json +1 -1
- package/dist/agent-catalog/agent-permission-profile.d.ts +0 -16
- package/dist/agent-catalog/agent-permission-profile.d.ts.map +0 -1
- package/dist/agent-catalog/agent-permission-profile.js +0 -194
- package/dist/agent-catalog/agent-permission-profile.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -16628,8 +16628,8 @@ function rewriteKeyNames(ctx) {
|
|
|
16628
16628
|
bySchema.set(entry.schema, entry);
|
|
16629
16629
|
}
|
|
16630
16630
|
const rewrites = /* @__PURE__ */ new Map();
|
|
16631
|
-
for (const
|
|
16632
|
-
const seen = ctx.seen.get(
|
|
16631
|
+
for (const record3 of pendingRecords.get(ctx) ?? []) {
|
|
16632
|
+
const seen = ctx.seen.get(record3);
|
|
16633
16633
|
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
16634
16634
|
if (!names || names === true || rewrites.has(names))
|
|
16635
16635
|
continue;
|
|
@@ -19875,21 +19875,46 @@ var sessionConfigOptionSchema = external_exports.strictObject({
|
|
|
19875
19875
|
values: external_exports.array(configValueSchema).max(500).readonly()
|
|
19876
19876
|
}).readonly();
|
|
19877
19877
|
var sessionConfigOptionsSchema = external_exports.array(sessionConfigOptionSchema).max(100).readonly();
|
|
19878
|
+
var agentSettingSchema = external_exports.strictObject({
|
|
19879
|
+
booleanValue: external_exports.boolean(),
|
|
19880
|
+
category: external_exports.string().max(128),
|
|
19881
|
+
defaultValue: external_exports.string().max(500),
|
|
19882
|
+
description: SHORT_TEXT,
|
|
19883
|
+
id: external_exports.string().min(1).max(128),
|
|
19884
|
+
name: external_exports.string().min(1).max(255),
|
|
19885
|
+
type: external_exports.enum(["boolean", "select"]),
|
|
19886
|
+
values: external_exports.array(configValueSchema).max(500).readonly()
|
|
19887
|
+
}).readonly();
|
|
19888
|
+
var agentSettingsSchema = external_exports.array(agentSettingSchema).max(128).readonly();
|
|
19889
|
+
var AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE = "complete";
|
|
19890
|
+
var AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION = "on_model_selection";
|
|
19891
|
+
var AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE = "unavailable";
|
|
19892
|
+
var agentModelEffortResolutionSchema = external_exports.enum([
|
|
19893
|
+
AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE,
|
|
19894
|
+
AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION,
|
|
19895
|
+
AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE
|
|
19896
|
+
]);
|
|
19897
|
+
var agentModelEffortSchema = external_exports.strictObject({
|
|
19898
|
+
effortSettingId: external_exports.string().max(128),
|
|
19899
|
+
modelSettingId: external_exports.string().max(128),
|
|
19900
|
+
resolution: agentModelEffortResolutionSchema,
|
|
19901
|
+
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
19902
|
+
}).readonly();
|
|
19878
19903
|
var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
|
|
19879
|
-
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
19880
19904
|
agentId: IDENTIFIER,
|
|
19881
|
-
directoryId: DIRECTORY_IDENTIFIER,
|
|
19882
19905
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVER_KIND),
|
|
19906
|
+
model: external_exports.string().min(1).max(500).optional(),
|
|
19883
19907
|
requestId: IDENTIFIER
|
|
19884
19908
|
}).readonly();
|
|
19885
19909
|
var agentSettingsDiscoveredEventSchema = external_exports.strictObject({
|
|
19886
19910
|
agentId: IDENTIFIER,
|
|
19887
19911
|
agentName: external_exports.string().max(255),
|
|
19888
19912
|
agentVersion: external_exports.string().max(128),
|
|
19889
|
-
configOptions: sessionConfigOptionsSchema,
|
|
19890
|
-
directoryId: DIRECTORY_IDENTIFIER,
|
|
19891
19913
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVERED_KIND),
|
|
19892
|
-
|
|
19914
|
+
modelEffort: agentModelEffortSchema,
|
|
19915
|
+
requestId: IDENTIFIER,
|
|
19916
|
+
settings: agentSettingsSchema,
|
|
19917
|
+
settingsRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
|
|
19893
19918
|
}).readonly();
|
|
19894
19919
|
var agentSettingsDiscoveryFailedEventSchema = external_exports.strictObject({
|
|
19895
19920
|
code: IDENTIFIER,
|
|
@@ -21660,199 +21685,6 @@ async function runBoundedProcess(options) {
|
|
|
21660
21685
|
}
|
|
21661
21686
|
}
|
|
21662
21687
|
|
|
21663
|
-
// src/agent-catalog/agent-permission-profile.ts
|
|
21664
|
-
var AGENT_DEFAULT_PERMISSION_MODE = AGENT_DEFAULT_EXECUTION_SETTING;
|
|
21665
|
-
var READ_ONLY_PERMISSION_MODE = "read-only";
|
|
21666
|
-
var WORKSPACE_WRITE_PERMISSION_MODE = "workspace-write";
|
|
21667
|
-
var DANGER_FULL_ACCESS_PERMISSION_MODE = "danger-full-access";
|
|
21668
|
-
var PERMISSION_MODE_CONFIG_ID = AGENT_PERMISSION_MODE_CONFIG_ID;
|
|
21669
|
-
var PERMISSION_MODE_MARKER = "MOBIUS_AGENT_PERMISSION_MODE";
|
|
21670
|
-
var AgentPermissionConfigurationError = class extends Error {
|
|
21671
|
-
code = "invalid_agent_permission_configuration";
|
|
21672
|
-
constructor(message, options = {}) {
|
|
21673
|
-
super(message, options);
|
|
21674
|
-
this.name = "AgentPermissionConfigurationError";
|
|
21675
|
-
}
|
|
21676
|
-
};
|
|
21677
|
-
var AgentPermissionProfile = class {
|
|
21678
|
-
option = (environment) => ({
|
|
21679
|
-
booleanValue: false,
|
|
21680
|
-
category: "_mobius_permission",
|
|
21681
|
-
currentValue: this.currentMode(environment),
|
|
21682
|
-
description: this.description,
|
|
21683
|
-
id: PERMISSION_MODE_CONFIG_ID,
|
|
21684
|
-
name: "Permissions",
|
|
21685
|
-
type: "select",
|
|
21686
|
-
values: this.values
|
|
21687
|
-
});
|
|
21688
|
-
};
|
|
21689
|
-
var AgentManagedPermissionProfile = class extends AgentPermissionProfile {
|
|
21690
|
-
description = "This Agent manages its own local permissions.";
|
|
21691
|
-
values = Object.freeze([
|
|
21692
|
-
{
|
|
21693
|
-
description: "Managed by the Agent",
|
|
21694
|
-
groupId: "",
|
|
21695
|
-
groupName: "",
|
|
21696
|
-
name: "Agent default",
|
|
21697
|
-
value: AGENT_DEFAULT_PERMISSION_MODE
|
|
21698
|
-
}
|
|
21699
|
-
]);
|
|
21700
|
-
currentMode = () => AGENT_DEFAULT_PERMISSION_MODE;
|
|
21701
|
-
apply = (environment, permissionMode) => {
|
|
21702
|
-
if (permissionMode !== AGENT_DEFAULT_PERMISSION_MODE) {
|
|
21703
|
-
throw new AgentPermissionConfigurationError("The selected Agent does not support this permission mode");
|
|
21704
|
-
}
|
|
21705
|
-
return Object.freeze({ ...environment });
|
|
21706
|
-
};
|
|
21707
|
-
};
|
|
21708
|
-
var PiPermissionProfile = class extends AgentPermissionProfile {
|
|
21709
|
-
description = "Pi has no built-in sandbox and runs with the local Runtime user's authority.";
|
|
21710
|
-
values = Object.freeze([
|
|
21711
|
-
{
|
|
21712
|
-
description: "Pi default; unrestricted local execution with the Runtime user's authority",
|
|
21713
|
-
groupId: "",
|
|
21714
|
-
groupName: "",
|
|
21715
|
-
name: "Full access (Pi default)",
|
|
21716
|
-
value: DANGER_FULL_ACCESS_PERMISSION_MODE
|
|
21717
|
-
}
|
|
21718
|
-
]);
|
|
21719
|
-
currentMode = () => DANGER_FULL_ACCESS_PERMISSION_MODE;
|
|
21720
|
-
apply = (environment, permissionMode) => {
|
|
21721
|
-
if (permissionMode !== DANGER_FULL_ACCESS_PERMISSION_MODE) {
|
|
21722
|
-
throw new AgentPermissionConfigurationError("Pi only supports its default full-access permission mode");
|
|
21723
|
-
}
|
|
21724
|
-
return Object.freeze({ ...environment });
|
|
21725
|
-
};
|
|
21726
|
-
};
|
|
21727
|
-
var adjustablePermissionValues = Object.freeze([
|
|
21728
|
-
{
|
|
21729
|
-
description: "Keep the Agent's existing permission policy",
|
|
21730
|
-
groupId: "",
|
|
21731
|
-
groupName: "",
|
|
21732
|
-
name: "Agent default",
|
|
21733
|
-
value: AGENT_DEFAULT_PERMISSION_MODE
|
|
21734
|
-
},
|
|
21735
|
-
{
|
|
21736
|
-
description: "Allow inspection without local writes or commands that can change state",
|
|
21737
|
-
groupId: "",
|
|
21738
|
-
groupName: "",
|
|
21739
|
-
name: "Read only",
|
|
21740
|
-
value: READ_ONLY_PERMISSION_MODE
|
|
21741
|
-
},
|
|
21742
|
-
{
|
|
21743
|
-
description: "Allow changes inside the selected workspace while protecting external paths",
|
|
21744
|
-
groupId: "",
|
|
21745
|
-
groupName: "",
|
|
21746
|
-
name: "Workspace write",
|
|
21747
|
-
value: WORKSPACE_WRITE_PERMISSION_MODE
|
|
21748
|
-
},
|
|
21749
|
-
{
|
|
21750
|
-
description: "Allow unrestricted local execution with the Runtime user's authority",
|
|
21751
|
-
groupId: "",
|
|
21752
|
-
groupName: "",
|
|
21753
|
-
name: "Full access",
|
|
21754
|
-
value: DANGER_FULL_ACCESS_PERMISSION_MODE
|
|
21755
|
-
}
|
|
21756
|
-
]);
|
|
21757
|
-
function validateAdjustableMode(permissionMode) {
|
|
21758
|
-
if (!adjustablePermissionValues.some((value) => value.value === permissionMode)) {
|
|
21759
|
-
throw new AgentPermissionConfigurationError("The selected permission mode is unavailable");
|
|
21760
|
-
}
|
|
21761
|
-
return permissionMode;
|
|
21762
|
-
}
|
|
21763
|
-
var DeepSeekHarnessPermissionProfile = class extends AgentPermissionProfile {
|
|
21764
|
-
description = "Controls the local side effects allowed for this Agent session.";
|
|
21765
|
-
values = adjustablePermissionValues;
|
|
21766
|
-
currentMode = (environment) => validateAdjustableMode(environment["DSH_PERMISSION_MODE"] ?? WORKSPACE_WRITE_PERMISSION_MODE);
|
|
21767
|
-
apply = (environment, permissionMode) => {
|
|
21768
|
-
if (permissionMode === AGENT_DEFAULT_PERMISSION_MODE) {
|
|
21769
|
-
return Object.freeze({ ...environment });
|
|
21770
|
-
}
|
|
21771
|
-
return Object.freeze({
|
|
21772
|
-
...environment,
|
|
21773
|
-
DSH_PERMISSION_MODE: validateAdjustableMode(permissionMode),
|
|
21774
|
-
[PERMISSION_MODE_MARKER]: permissionMode
|
|
21775
|
-
});
|
|
21776
|
-
};
|
|
21777
|
-
};
|
|
21778
|
-
function record2(value) {
|
|
21779
|
-
if (value === void 0) {
|
|
21780
|
-
return {};
|
|
21781
|
-
}
|
|
21782
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
21783
|
-
throw new AgentPermissionConfigurationError("The OpenCode inline configuration is invalid");
|
|
21784
|
-
}
|
|
21785
|
-
return Object.fromEntries(Object.entries(value));
|
|
21786
|
-
}
|
|
21787
|
-
function openCodeConfiguration(environment) {
|
|
21788
|
-
const encoded = environment["OPENCODE_CONFIG_CONTENT"];
|
|
21789
|
-
if (encoded === void 0 || encoded.length === 0) {
|
|
21790
|
-
return {};
|
|
21791
|
-
}
|
|
21792
|
-
try {
|
|
21793
|
-
return record2(JSON.parse(encoded));
|
|
21794
|
-
} catch (cause) {
|
|
21795
|
-
if (cause instanceof AgentPermissionConfigurationError) {
|
|
21796
|
-
throw cause;
|
|
21797
|
-
}
|
|
21798
|
-
throw new AgentPermissionConfigurationError("The OpenCode inline configuration is invalid", { cause });
|
|
21799
|
-
}
|
|
21800
|
-
}
|
|
21801
|
-
function openCodePermission(permissionMode) {
|
|
21802
|
-
if (permissionMode === READ_ONLY_PERMISSION_MODE) {
|
|
21803
|
-
return {
|
|
21804
|
-
"*": "deny",
|
|
21805
|
-
glob: "allow",
|
|
21806
|
-
grep: "allow",
|
|
21807
|
-
lsp: "allow",
|
|
21808
|
-
read: "allow",
|
|
21809
|
-
skill: "allow"
|
|
21810
|
-
};
|
|
21811
|
-
}
|
|
21812
|
-
if (permissionMode === WORKSPACE_WRITE_PERMISSION_MODE) {
|
|
21813
|
-
return {
|
|
21814
|
-
"*": "allow",
|
|
21815
|
-
external_directory: "ask"
|
|
21816
|
-
};
|
|
21817
|
-
}
|
|
21818
|
-
return "allow";
|
|
21819
|
-
}
|
|
21820
|
-
var OpenCodePermissionProfile = class extends AgentPermissionProfile {
|
|
21821
|
-
description = "Controls the local side effects allowed for this Agent session.";
|
|
21822
|
-
values = adjustablePermissionValues;
|
|
21823
|
-
currentMode = (environment) => validateAdjustableMode(environment[PERMISSION_MODE_MARKER] ?? AGENT_DEFAULT_PERMISSION_MODE);
|
|
21824
|
-
apply = (environment, permissionMode) => {
|
|
21825
|
-
const validated = validateAdjustableMode(permissionMode);
|
|
21826
|
-
if (validated === AGENT_DEFAULT_PERMISSION_MODE) {
|
|
21827
|
-
return Object.freeze({ ...environment });
|
|
21828
|
-
}
|
|
21829
|
-
return Object.freeze({
|
|
21830
|
-
...environment,
|
|
21831
|
-
OPENCODE_CONFIG_CONTENT: JSON.stringify({
|
|
21832
|
-
...openCodeConfiguration(environment),
|
|
21833
|
-
permission: openCodePermission(validated)
|
|
21834
|
-
}),
|
|
21835
|
-
[PERMISSION_MODE_MARKER]: validated
|
|
21836
|
-
});
|
|
21837
|
-
};
|
|
21838
|
-
};
|
|
21839
|
-
var agentManagedPermissionProfile = new AgentManagedPermissionProfile();
|
|
21840
|
-
var deepSeekHarnessPermissionProfile = new DeepSeekHarnessPermissionProfile();
|
|
21841
|
-
var openCodePermissionProfile = new OpenCodePermissionProfile();
|
|
21842
|
-
var piPermissionProfile = new PiPermissionProfile();
|
|
21843
|
-
function permissionProfileForAgent(agentId) {
|
|
21844
|
-
if (agentId === "deepseek-harness") {
|
|
21845
|
-
return deepSeekHarnessPermissionProfile;
|
|
21846
|
-
}
|
|
21847
|
-
if (agentId === "opencode") {
|
|
21848
|
-
return openCodePermissionProfile;
|
|
21849
|
-
}
|
|
21850
|
-
if (agentId === "pi") {
|
|
21851
|
-
return piPermissionProfile;
|
|
21852
|
-
}
|
|
21853
|
-
return agentManagedPermissionProfile;
|
|
21854
|
-
}
|
|
21855
|
-
|
|
21856
21688
|
// src/agent-catalog/local-agent.ts
|
|
21857
21689
|
function readTrustedIdentity(path2) {
|
|
21858
21690
|
const resolvedPath = realpathSync(path2);
|
|
@@ -21878,8 +21710,7 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
21878
21710
|
environment;
|
|
21879
21711
|
id;
|
|
21880
21712
|
label;
|
|
21881
|
-
|
|
21882
|
-
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, capabilities = unsupportedSessionCapabilities(), permissionProfile = permissionProfileForAgent(id)) {
|
|
21713
|
+
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, capabilities = unsupportedSessionCapabilities()) {
|
|
21883
21714
|
this.adapterIdentity = adapterIdentity;
|
|
21884
21715
|
this.adapterPath = adapterIdentity.realPath;
|
|
21885
21716
|
this.adapterVersion = adapterVersion;
|
|
@@ -21888,29 +21719,22 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
21888
21719
|
this.capabilities = Object.freeze({ ...capabilities });
|
|
21889
21720
|
this.id = id;
|
|
21890
21721
|
this.label = label;
|
|
21891
|
-
this.permissionProfile = permissionProfile;
|
|
21892
21722
|
this.command = adapterIdentity.realPath;
|
|
21893
21723
|
this.arguments = Object.freeze([...arguments_]);
|
|
21894
|
-
this.environment =
|
|
21724
|
+
this.environment = Object.freeze({ ...environment });
|
|
21895
21725
|
}
|
|
21896
|
-
|
|
21897
|
-
|
|
21898
|
-
|
|
21899
|
-
|
|
21900
|
-
|
|
21901
|
-
|
|
21902
|
-
|
|
21903
|
-
|
|
21904
|
-
|
|
21905
|
-
|
|
21906
|
-
|
|
21907
|
-
|
|
21908
|
-
this.adapterIdentity,
|
|
21909
|
-
this.agentIdentity,
|
|
21910
|
-
this.capabilities,
|
|
21911
|
-
this.permissionProfile
|
|
21912
|
-
);
|
|
21913
|
-
};
|
|
21726
|
+
withEnvironment = (environment) => new _LocalAgentDefinition(
|
|
21727
|
+
this.id,
|
|
21728
|
+
this.label,
|
|
21729
|
+
this.command,
|
|
21730
|
+
this.arguments,
|
|
21731
|
+
environment,
|
|
21732
|
+
this.adapterVersion,
|
|
21733
|
+
this.agentVersion,
|
|
21734
|
+
this.adapterIdentity,
|
|
21735
|
+
this.agentIdentity,
|
|
21736
|
+
this.capabilities
|
|
21737
|
+
);
|
|
21914
21738
|
};
|
|
21915
21739
|
var InstallableAgentDefinition = class {
|
|
21916
21740
|
id;
|
|
@@ -30177,13 +30001,14 @@ function normalizeConfigOptions(value, modes) {
|
|
|
30177
30001
|
}
|
|
30178
30002
|
const id = truncate2(readString2(option["id"]), 128);
|
|
30179
30003
|
const name = truncate2(readString2(option["name"], id), 255);
|
|
30180
|
-
|
|
30004
|
+
const category = truncate2(readString2(option["category"]), 128);
|
|
30005
|
+
if (id.length === 0 || name.length === 0 || category === "_mobius_permission") {
|
|
30181
30006
|
continue;
|
|
30182
30007
|
}
|
|
30183
30008
|
if (option["type"] === "boolean") {
|
|
30184
30009
|
normalized.push({
|
|
30185
30010
|
booleanValue: readBoolean(option["currentValue"]),
|
|
30186
|
-
category
|
|
30011
|
+
category,
|
|
30187
30012
|
currentValue: "",
|
|
30188
30013
|
description: truncate2(readString2(option["description"]), 500),
|
|
30189
30014
|
id,
|
|
@@ -30199,7 +30024,7 @@ function normalizeConfigOptions(value, modes) {
|
|
|
30199
30024
|
if (currentValue.length > 0 && values.some((entry) => entry.value === currentValue)) {
|
|
30200
30025
|
normalized.push({
|
|
30201
30026
|
booleanValue: false,
|
|
30202
|
-
category
|
|
30027
|
+
category,
|
|
30203
30028
|
currentValue,
|
|
30204
30029
|
description: truncate2(readString2(option["description"]), 500),
|
|
30205
30030
|
id,
|
|
@@ -30246,122 +30071,16 @@ function normalizeConfigOptions(value, modes) {
|
|
|
30246
30071
|
});
|
|
30247
30072
|
}
|
|
30248
30073
|
}
|
|
30249
|
-
return normalized.slice(0,
|
|
30250
|
-
}
|
|
30251
|
-
function insertRequiredOption(current, required2, afterCategory = "") {
|
|
30252
|
-
if (current.some((option) => option.id === required2.id || option.category === required2.category)) {
|
|
30253
|
-
return current;
|
|
30254
|
-
}
|
|
30255
|
-
if (current.length < MAXIMUM_CONFIG_OPTIONS) {
|
|
30256
|
-
if (afterCategory.length === 0) {
|
|
30257
|
-
return [required2, ...current];
|
|
30258
|
-
}
|
|
30259
|
-
const index3 = current.findIndex((option) => option.category === afterCategory);
|
|
30260
|
-
if (index3 < 0) {
|
|
30261
|
-
return [...current, required2];
|
|
30262
|
-
}
|
|
30263
|
-
return [...current.slice(0, index3 + 1), required2, ...current.slice(index3 + 1)];
|
|
30264
|
-
}
|
|
30265
|
-
if (afterCategory.length === 0) {
|
|
30266
|
-
return [required2, ...current.slice(0, MAXIMUM_CONFIG_OPTIONS - 1)];
|
|
30267
|
-
}
|
|
30268
|
-
const index2 = current.findIndex((option) => option.category === afterCategory);
|
|
30269
|
-
if (index2 < 0) {
|
|
30270
|
-
return [...current.slice(0, MAXIMUM_CONFIG_OPTIONS - 1), required2];
|
|
30271
|
-
}
|
|
30272
|
-
if (index2 < MAXIMUM_CONFIG_OPTIONS - 1) {
|
|
30273
|
-
return [...current.slice(0, index2 + 1), required2, ...current.slice(index2 + 1, MAXIMUM_CONFIG_OPTIONS - 1)];
|
|
30274
|
-
}
|
|
30275
|
-
const anchor2 = current[index2];
|
|
30276
|
-
if (anchor2 === void 0) {
|
|
30277
|
-
throw new SessionConfigProtocolError("The required Agent execution setting is unavailable");
|
|
30278
|
-
}
|
|
30279
|
-
return [...current.slice(0, MAXIMUM_CONFIG_OPTIONS - 2), anchor2, required2];
|
|
30280
|
-
}
|
|
30281
|
-
function validRequiredSelect(option) {
|
|
30282
|
-
return option.type === "select" && option.currentValue.length > 0 && option.values.some((value) => value.value === option.currentValue);
|
|
30283
|
-
}
|
|
30284
|
-
function ensureModelOption(current) {
|
|
30285
|
-
const existing = current.find((option) => option.id === "model" || option.category === "model");
|
|
30286
|
-
if (existing !== void 0 && validRequiredSelect(existing)) {
|
|
30287
|
-
return current;
|
|
30288
|
-
}
|
|
30289
|
-
const unavailable = {
|
|
30290
|
-
booleanValue: false,
|
|
30291
|
-
category: "model",
|
|
30292
|
-
currentValue: AGENT_DEFAULT_REASONING_EFFORT,
|
|
30293
|
-
description: "This Agent does not expose an adjustable model.",
|
|
30294
|
-
id: "model",
|
|
30295
|
-
name: "Model",
|
|
30296
|
-
type: "select",
|
|
30297
|
-
values: [
|
|
30298
|
-
{
|
|
30299
|
-
description: "Selected by the Agent",
|
|
30300
|
-
groupId: "",
|
|
30301
|
-
groupName: "",
|
|
30302
|
-
name: "Agent default",
|
|
30303
|
-
value: AGENT_DEFAULT_REASONING_EFFORT
|
|
30304
|
-
}
|
|
30305
|
-
]
|
|
30306
|
-
};
|
|
30307
|
-
return insertRequiredOption(
|
|
30308
|
-
current.filter((option) => option.id !== "model" && option.category !== "model"),
|
|
30309
|
-
unavailable
|
|
30310
|
-
);
|
|
30311
|
-
}
|
|
30312
|
-
function ensureReasoningEffortOption(current) {
|
|
30313
|
-
const existing = current.find((option) => option.id === "reasoning_effort" || option.category === "thought_level");
|
|
30314
|
-
if (existing !== void 0 && validRequiredSelect(existing)) {
|
|
30315
|
-
return current;
|
|
30316
|
-
}
|
|
30317
|
-
const unavailable = {
|
|
30318
|
-
booleanValue: false,
|
|
30319
|
-
category: "thought_level",
|
|
30320
|
-
currentValue: AGENT_DEFAULT_REASONING_EFFORT,
|
|
30321
|
-
description: "This Agent does not expose adjustable reasoning effort for the selected model.",
|
|
30322
|
-
id: "reasoning_effort",
|
|
30323
|
-
name: "Reasoning effort",
|
|
30324
|
-
type: "select",
|
|
30325
|
-
values: [
|
|
30326
|
-
{
|
|
30327
|
-
description: "Selected by the Agent",
|
|
30328
|
-
groupId: "",
|
|
30329
|
-
groupName: "",
|
|
30330
|
-
name: "Agent default",
|
|
30331
|
-
value: AGENT_DEFAULT_REASONING_EFFORT
|
|
30332
|
-
}
|
|
30333
|
-
]
|
|
30334
|
-
};
|
|
30335
|
-
return insertRequiredOption(
|
|
30336
|
-
current.filter((option) => option.id !== "reasoning_effort" && option.category !== "thought_level"),
|
|
30337
|
-
unavailable,
|
|
30338
|
-
"model"
|
|
30339
|
-
);
|
|
30340
|
-
}
|
|
30341
|
-
function ensureRequiredExecutionOptions(current, permission) {
|
|
30342
|
-
const normalized = ensureReasoningEffortOption(ensureModelOption(current));
|
|
30343
|
-
const model = normalized.find(
|
|
30344
|
-
(option) => (option.id === "model" || option.category === "model") && validRequiredSelect(option)
|
|
30345
|
-
);
|
|
30346
|
-
const reasoningEffort = normalized.find(
|
|
30347
|
-
(option) => (option.id === "reasoning_effort" || option.category === "thought_level") && validRequiredSelect(option)
|
|
30348
|
-
);
|
|
30349
|
-
if (model === void 0 || reasoningEffort === void 0) {
|
|
30350
|
-
throw new SessionConfigProtocolError("The required Agent execution settings are unavailable");
|
|
30351
|
-
}
|
|
30352
|
-
const optional2 = normalized.filter(
|
|
30353
|
-
(option) => option.id !== permission.id && option.category !== permission.category && option.id !== "model" && option.category !== "model" && option.id !== "reasoning_effort" && option.category !== "thought_level"
|
|
30354
|
-
);
|
|
30355
|
-
return [permission, model, reasoningEffort, ...optional2].slice(0, MAXIMUM_CONFIG_OPTIONS);
|
|
30074
|
+
return normalized.slice(0, MAXIMUM_CONFIG_OPTIONS);
|
|
30356
30075
|
}
|
|
30357
30076
|
function normalizeStandardLifecycle(response) {
|
|
30358
30077
|
const lifecycle = isRecord4(response) ? response : {};
|
|
30359
|
-
return
|
|
30078
|
+
return normalizeConfigOptions(lifecycle["configOptions"], lifecycle["modes"]);
|
|
30360
30079
|
}
|
|
30361
30080
|
function replaceStandardConfigOptions(current, value) {
|
|
30362
30081
|
const next = normalizeConfigOptions(value, void 0);
|
|
30363
|
-
const withMode = next.some((option) => option.category === "mode") ? next : [...current.filter((option) => option.category === "mode"), ...next].slice(0,
|
|
30364
|
-
return
|
|
30082
|
+
const withMode = next.some((option) => option.category === "mode") ? next : [...current.filter((option) => option.category === "mode"), ...next].slice(0, MAXIMUM_CONFIG_OPTIONS);
|
|
30083
|
+
return withMode;
|
|
30365
30084
|
}
|
|
30366
30085
|
function updateCurrentValue(current, configId, value) {
|
|
30367
30086
|
return current.map((option) => option.id === configId ? { ...option, currentValue: value } : option);
|
|
@@ -30547,7 +30266,7 @@ function normalizeGrokLifecycle(response) {
|
|
|
30547
30266
|
normalized.splice(modelIndex < 0 ? normalized.length : modelIndex + 1, 0, ...efforts);
|
|
30548
30267
|
}
|
|
30549
30268
|
}
|
|
30550
|
-
return
|
|
30269
|
+
return normalized.slice(0, 100);
|
|
30551
30270
|
}
|
|
30552
30271
|
function updateCurrentValue2(current, category, value) {
|
|
30553
30272
|
return current.map((option) => option.category === category ? { ...option, currentValue: value } : option);
|
|
@@ -31428,7 +31147,6 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31428
31147
|
#preSessionUpdates = [];
|
|
31429
31148
|
#processExit;
|
|
31430
31149
|
#metrics;
|
|
31431
|
-
#permissionProfile;
|
|
31432
31150
|
#sessionConfigProtocol;
|
|
31433
31151
|
#store;
|
|
31434
31152
|
#emittedToolImages = /* @__PURE__ */ new Set();
|
|
@@ -31472,7 +31190,6 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31472
31190
|
this.#getObserver = getObserver;
|
|
31473
31191
|
this.#mobiusSessionId = mobiusSessionId;
|
|
31474
31192
|
this.#metrics = metrics;
|
|
31475
|
-
this.#permissionProfile = agent.permissionProfile;
|
|
31476
31193
|
this.#sessionConfigProtocol = sessionConfigProtocolForAgent(agent.id);
|
|
31477
31194
|
this.#store = store;
|
|
31478
31195
|
this.#verifiedAgentVersion = agent.agentVersion;
|
|
@@ -31943,10 +31660,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31943
31660
|
this.selectNativeSession(created.sessionId);
|
|
31944
31661
|
lifecycleResponse = created;
|
|
31945
31662
|
}
|
|
31946
|
-
this.#configOptions =
|
|
31947
|
-
this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse),
|
|
31948
|
-
this.#permissionProfile.option(this.#environment)
|
|
31949
|
-
);
|
|
31663
|
+
this.#configOptions = this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse);
|
|
31950
31664
|
await this.#updateTail;
|
|
31951
31665
|
signal.throwIfAborted();
|
|
31952
31666
|
if (this.#prompted) {
|
|
@@ -32047,12 +31761,17 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32047
31761
|
)
|
|
32048
31762
|
}
|
|
32049
31763
|
);
|
|
31764
|
+
const applied = configured.find((option) => option.id === options.configId);
|
|
31765
|
+
if (applied === void 0 || applied.type !== options.valueType || applied.type === "boolean" && applied.booleanValue !== options.booleanValue || applied.type === "select" && applied.currentValue !== options.value) {
|
|
31766
|
+
throw new AcpExecutionError(
|
|
31767
|
+
"The Agent did not apply the requested session configuration",
|
|
31768
|
+
{},
|
|
31769
|
+
"invalid_session_configuration"
|
|
31770
|
+
);
|
|
31771
|
+
}
|
|
32050
31772
|
await this.#updateTail;
|
|
32051
31773
|
if (this.#configRevision === configRevision) {
|
|
32052
|
-
this.#configOptions =
|
|
32053
|
-
configured,
|
|
32054
|
-
this.#permissionProfile.option(this.#environment)
|
|
32055
|
-
);
|
|
31774
|
+
this.#configOptions = configured;
|
|
32056
31775
|
}
|
|
32057
31776
|
} catch (error62) {
|
|
32058
31777
|
if (error62 instanceof SessionConfigProtocolError) {
|
|
@@ -32530,9 +32249,9 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32530
32249
|
return;
|
|
32531
32250
|
}
|
|
32532
32251
|
if (update.sessionUpdate === "config_option_update") {
|
|
32533
|
-
this.#configOptions =
|
|
32534
|
-
this.#
|
|
32535
|
-
|
|
32252
|
+
this.#configOptions = this.#sessionConfigProtocol.normalizeUpdate(
|
|
32253
|
+
this.#configOptions,
|
|
32254
|
+
update.configOptions
|
|
32536
32255
|
);
|
|
32537
32256
|
this.#configRevision += 1;
|
|
32538
32257
|
await this.emitConfigUpdate();
|
|
@@ -33069,9 +32788,6 @@ var AcpSessionManager = class {
|
|
|
33069
32788
|
);
|
|
33070
32789
|
try {
|
|
33071
32790
|
for (const desired of desiredConfigOptions) {
|
|
33072
|
-
if (desired.id === PERMISSION_MODE_CONFIG_ID) {
|
|
33073
|
-
continue;
|
|
33074
|
-
}
|
|
33075
32791
|
const current = runtime.prepared().configOptions.find((option) => option.id === desired.id);
|
|
33076
32792
|
if (current === void 0 || current.type !== desired.type) {
|
|
33077
32793
|
continue;
|
|
@@ -33168,11 +32884,21 @@ var AcpSessionManager = class {
|
|
|
33168
32884
|
() => this.#agentSettingsObserver,
|
|
33169
32885
|
new MemoryAcpSessionStore()
|
|
33170
32886
|
),
|
|
33171
|
-
(runtime) => {
|
|
32887
|
+
async (runtime) => {
|
|
33172
32888
|
const prepared = runtime.prepared();
|
|
33173
|
-
|
|
33174
|
-
|
|
33175
|
-
|
|
32889
|
+
const model = options.model;
|
|
32890
|
+
const configOptions = model === void 0 ? prepared.configOptions : await runtime.configure({
|
|
32891
|
+
...options,
|
|
32892
|
+
booleanValue: false,
|
|
32893
|
+
configId: prepared.configOptions.find(
|
|
32894
|
+
(option) => option.id === "model" || option.category === "model"
|
|
32895
|
+
)?.id ?? "model",
|
|
32896
|
+
requestId: "agent-settings-model",
|
|
32897
|
+
sessionId: `agent-settings-${crypto.randomUUID()}`,
|
|
32898
|
+
value: model,
|
|
32899
|
+
valueType: "select"
|
|
32900
|
+
});
|
|
32901
|
+
return new AcpAgentSettingsSnapshot(prepared.agentName, prepared.agentVersion, configOptions);
|
|
33176
32902
|
},
|
|
33177
32903
|
async (runtime) => await runtime.close()
|
|
33178
32904
|
);
|
|
@@ -33263,30 +32989,6 @@ var AcpSessionManager = class {
|
|
|
33263
32989
|
this.#beginSessionUse(options.sessionId);
|
|
33264
32990
|
try {
|
|
33265
32991
|
const runtime = await this.ensureSession(options);
|
|
33266
|
-
if (options.configId === PERMISSION_MODE_CONFIG_ID) {
|
|
33267
|
-
const permission = runtime.prepared().configOptions.find((candidate) => candidate.id === PERMISSION_MODE_CONFIG_ID);
|
|
33268
|
-
if (permission === void 0 || permission.type !== "select" || options.valueType !== "select" || permission.values.length < 2 || !permission.values.some((value) => value.value === options.value)) {
|
|
33269
|
-
throw new AcpExecutionError(
|
|
33270
|
-
"The requested Agent permission mode is unavailable",
|
|
33271
|
-
{},
|
|
33272
|
-
"invalid_session_configuration"
|
|
33273
|
-
);
|
|
33274
|
-
}
|
|
33275
|
-
if (permission.currentValue === options.value) {
|
|
33276
|
-
return runtime.prepared().configOptions;
|
|
33277
|
-
}
|
|
33278
|
-
try {
|
|
33279
|
-
return (await this.prepareExecutionSession({
|
|
33280
|
-
...options,
|
|
33281
|
-
agent: options.agent.withPermissionMode(options.value)
|
|
33282
|
-
})).configOptions;
|
|
33283
|
-
} catch (error62) {
|
|
33284
|
-
if (error62 instanceof AgentPermissionConfigurationError) {
|
|
33285
|
-
throw new AcpExecutionError(error62.message, { cause: error62 }, error62.code);
|
|
33286
|
-
}
|
|
33287
|
-
throw error62;
|
|
33288
|
-
}
|
|
33289
|
-
}
|
|
33290
32992
|
return await runtime.configure(options);
|
|
33291
32993
|
} finally {
|
|
33292
32994
|
this.#endSessionUse(options.sessionId);
|
|
@@ -33764,7 +33466,7 @@ var AuditStore = class {
|
|
|
33764
33466
|
this.database.exec("ALTER TABLE audit_events ADD COLUMN details_json TEXT NOT NULL DEFAULT '{}'");
|
|
33765
33467
|
}
|
|
33766
33468
|
}
|
|
33767
|
-
record(
|
|
33469
|
+
record(record3) {
|
|
33768
33470
|
this.database.prepare(
|
|
33769
33471
|
`
|
|
33770
33472
|
INSERT INTO audit_events (
|
|
@@ -33777,10 +33479,10 @@ var AuditStore = class {
|
|
|
33777
33479
|
`
|
|
33778
33480
|
).run(
|
|
33779
33481
|
(/* @__PURE__ */ new Date()).toISOString(),
|
|
33780
|
-
|
|
33781
|
-
|
|
33782
|
-
|
|
33783
|
-
JSON.stringify(
|
|
33482
|
+
record3.event,
|
|
33483
|
+
record3.commandId,
|
|
33484
|
+
record3.sessionId,
|
|
33485
|
+
JSON.stringify(record3.details ?? {})
|
|
33784
33486
|
);
|
|
33785
33487
|
}
|
|
33786
33488
|
close() {
|
|
@@ -36668,11 +36370,216 @@ async function resumeLocalMachine(arguments_, signal = new AbortController().sig
|
|
|
36668
36370
|
}
|
|
36669
36371
|
|
|
36670
36372
|
// src/run-daemon.ts
|
|
36671
|
-
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
36373
|
+
import { createHash as createHash5, randomUUID as randomUUID4 } from "node:crypto";
|
|
36672
36374
|
import { basename as basename7 } from "node:path";
|
|
36673
36375
|
import { styleText } from "node:util";
|
|
36674
36376
|
import { fetch as fetch6, WebSocket as WebSocket2 } from "undici";
|
|
36675
36377
|
|
|
36378
|
+
// src/agent-catalog/agent-settings-adapter.ts
|
|
36379
|
+
var AGENT_DEFAULT_VALUE = "agent_default";
|
|
36380
|
+
var READ_ONLY_VALUE = "read-only";
|
|
36381
|
+
var WORKSPACE_WRITE_VALUE = "workspace-write";
|
|
36382
|
+
var DANGER_FULL_ACCESS_VALUE = "danger-full-access";
|
|
36383
|
+
var DEEPSEEK_HARNESS_ACCESS_MODE_SETTING_ID = "dsh_access_mode";
|
|
36384
|
+
var OPENCODE_PERMISSION_SETTING_ID = "opencode_permission";
|
|
36385
|
+
var AgentSettingsConfigurationError = class extends Error {
|
|
36386
|
+
code = "invalid_session_configuration";
|
|
36387
|
+
constructor(message, options = {}) {
|
|
36388
|
+
super(message, options);
|
|
36389
|
+
this.name = "AgentSettingsConfigurationError";
|
|
36390
|
+
}
|
|
36391
|
+
};
|
|
36392
|
+
var AgentSettingsLaunchSelectionResult = class {
|
|
36393
|
+
agent;
|
|
36394
|
+
handled;
|
|
36395
|
+
constructor(agent, handled) {
|
|
36396
|
+
this.agent = agent;
|
|
36397
|
+
this.handled = handled;
|
|
36398
|
+
}
|
|
36399
|
+
};
|
|
36400
|
+
var AppliedAgentLaunchSettings = class {
|
|
36401
|
+
agent;
|
|
36402
|
+
sessionConfigurations;
|
|
36403
|
+
constructor(agent, sessionConfigurations) {
|
|
36404
|
+
this.agent = agent;
|
|
36405
|
+
this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
|
|
36406
|
+
}
|
|
36407
|
+
};
|
|
36408
|
+
var AgentSettingsAdapter = class {
|
|
36409
|
+
modelEffortResolution = AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION;
|
|
36410
|
+
applyLaunchSelection = (agent, _selection) => new AgentSettingsLaunchSelectionResult(agent, false);
|
|
36411
|
+
settings = (_agent) => [];
|
|
36412
|
+
};
|
|
36413
|
+
function selectValue(name, value, description) {
|
|
36414
|
+
return {
|
|
36415
|
+
description,
|
|
36416
|
+
groupId: "",
|
|
36417
|
+
groupName: "",
|
|
36418
|
+
name,
|
|
36419
|
+
value
|
|
36420
|
+
};
|
|
36421
|
+
}
|
|
36422
|
+
function selectSetting(id, name, description, currentValue, values) {
|
|
36423
|
+
return {
|
|
36424
|
+
booleanValue: false,
|
|
36425
|
+
category: "execution",
|
|
36426
|
+
currentValue,
|
|
36427
|
+
description,
|
|
36428
|
+
id,
|
|
36429
|
+
name,
|
|
36430
|
+
type: "select",
|
|
36431
|
+
values
|
|
36432
|
+
};
|
|
36433
|
+
}
|
|
36434
|
+
function selectedValue(selection, configId) {
|
|
36435
|
+
if (selection.configId !== configId || selection.valueType !== "select" || selection.booleanValue || selection.value.length === 0) {
|
|
36436
|
+
throw new AgentSettingsConfigurationError("The requested Agent setting is invalid");
|
|
36437
|
+
}
|
|
36438
|
+
return selection.value;
|
|
36439
|
+
}
|
|
36440
|
+
function validValue(values, value) {
|
|
36441
|
+
if (!values.some((candidate) => candidate.value === value)) {
|
|
36442
|
+
throw new AgentSettingsConfigurationError("The requested Agent setting is unavailable");
|
|
36443
|
+
}
|
|
36444
|
+
return value;
|
|
36445
|
+
}
|
|
36446
|
+
var dshAccessModes = Object.freeze([
|
|
36447
|
+
selectValue("Read only", READ_ONLY_VALUE, "Allow inspection without local writes."),
|
|
36448
|
+
selectValue("Workspace write", WORKSPACE_WRITE_VALUE, "Allow changes in the selected workspace."),
|
|
36449
|
+
selectValue("Full access", DANGER_FULL_ACCESS_VALUE, "Allow unrestricted local execution.")
|
|
36450
|
+
]);
|
|
36451
|
+
var DeepSeekHarnessSettingsAdapter = class extends AgentSettingsAdapter {
|
|
36452
|
+
settings = (agent) => {
|
|
36453
|
+
const configured = agent.environment["DSH_PERMISSION_MODE"] ?? WORKSPACE_WRITE_VALUE;
|
|
36454
|
+
return [
|
|
36455
|
+
selectSetting(
|
|
36456
|
+
DEEPSEEK_HARNESS_ACCESS_MODE_SETTING_ID,
|
|
36457
|
+
"Access mode",
|
|
36458
|
+
"Controls the local side effects allowed for this DeepSeek Harness session.",
|
|
36459
|
+
validValue(dshAccessModes, configured),
|
|
36460
|
+
dshAccessModes
|
|
36461
|
+
)
|
|
36462
|
+
];
|
|
36463
|
+
};
|
|
36464
|
+
applyLaunchSelection = (agent, selection) => {
|
|
36465
|
+
if (selection.configId !== DEEPSEEK_HARNESS_ACCESS_MODE_SETTING_ID) {
|
|
36466
|
+
return new AgentSettingsLaunchSelectionResult(agent, false);
|
|
36467
|
+
}
|
|
36468
|
+
const value = validValue(dshAccessModes, selectedValue(selection, DEEPSEEK_HARNESS_ACCESS_MODE_SETTING_ID));
|
|
36469
|
+
return new AgentSettingsLaunchSelectionResult(
|
|
36470
|
+
agent.withEnvironment({ ...agent.environment, DSH_PERMISSION_MODE: value }),
|
|
36471
|
+
true
|
|
36472
|
+
);
|
|
36473
|
+
};
|
|
36474
|
+
};
|
|
36475
|
+
var openCodePermissionModes = Object.freeze([
|
|
36476
|
+
selectValue("Agent default", AGENT_DEFAULT_VALUE, "Keep OpenCode's existing permission policy."),
|
|
36477
|
+
selectValue("Read only", READ_ONLY_VALUE, "Allow inspection without local writes."),
|
|
36478
|
+
selectValue("Workspace write", WORKSPACE_WRITE_VALUE, "Allow changes in the selected workspace."),
|
|
36479
|
+
selectValue("Full access", DANGER_FULL_ACCESS_VALUE, "Allow unrestricted local execution.")
|
|
36480
|
+
]);
|
|
36481
|
+
function openCodeConfiguration(environment) {
|
|
36482
|
+
const encoded = environment["OPENCODE_CONFIG_CONTENT"];
|
|
36483
|
+
if (encoded === void 0 || encoded.length === 0) {
|
|
36484
|
+
return {};
|
|
36485
|
+
}
|
|
36486
|
+
let parsed;
|
|
36487
|
+
try {
|
|
36488
|
+
parsed = JSON.parse(encoded);
|
|
36489
|
+
} catch (cause) {
|
|
36490
|
+
throw new AgentSettingsConfigurationError("The OpenCode configuration is invalid", { cause });
|
|
36491
|
+
}
|
|
36492
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
36493
|
+
throw new AgentSettingsConfigurationError("The OpenCode configuration is invalid");
|
|
36494
|
+
}
|
|
36495
|
+
return Object.freeze({ ...parsed });
|
|
36496
|
+
}
|
|
36497
|
+
function openCodePermission(value) {
|
|
36498
|
+
if (value === READ_ONLY_VALUE) {
|
|
36499
|
+
return {
|
|
36500
|
+
"*": "deny",
|
|
36501
|
+
glob: "allow",
|
|
36502
|
+
grep: "allow",
|
|
36503
|
+
lsp: "allow",
|
|
36504
|
+
read: "allow",
|
|
36505
|
+
skill: "allow"
|
|
36506
|
+
};
|
|
36507
|
+
}
|
|
36508
|
+
if (value === WORKSPACE_WRITE_VALUE) {
|
|
36509
|
+
return {
|
|
36510
|
+
"*": "allow",
|
|
36511
|
+
external_directory: "ask"
|
|
36512
|
+
};
|
|
36513
|
+
}
|
|
36514
|
+
return "allow";
|
|
36515
|
+
}
|
|
36516
|
+
var OpenCodeSettingsAdapter = class extends AgentSettingsAdapter {
|
|
36517
|
+
settings = (agent) => {
|
|
36518
|
+
const currentValue = agent.environment["MOBIUS_OPENCODE_PERMISSION"] ?? AGENT_DEFAULT_VALUE;
|
|
36519
|
+
return [
|
|
36520
|
+
selectSetting(
|
|
36521
|
+
OPENCODE_PERMISSION_SETTING_ID,
|
|
36522
|
+
"Permissions",
|
|
36523
|
+
"Controls OpenCode's local permission policy.",
|
|
36524
|
+
validValue(openCodePermissionModes, currentValue),
|
|
36525
|
+
openCodePermissionModes
|
|
36526
|
+
)
|
|
36527
|
+
];
|
|
36528
|
+
};
|
|
36529
|
+
applyLaunchSelection = (agent, selection) => {
|
|
36530
|
+
if (selection.configId !== OPENCODE_PERMISSION_SETTING_ID) {
|
|
36531
|
+
return new AgentSettingsLaunchSelectionResult(agent, false);
|
|
36532
|
+
}
|
|
36533
|
+
const value = validValue(openCodePermissionModes, selectedValue(selection, OPENCODE_PERMISSION_SETTING_ID));
|
|
36534
|
+
if (value === AGENT_DEFAULT_VALUE) {
|
|
36535
|
+
return new AgentSettingsLaunchSelectionResult(agent, true);
|
|
36536
|
+
}
|
|
36537
|
+
return new AgentSettingsLaunchSelectionResult(
|
|
36538
|
+
agent.withEnvironment({
|
|
36539
|
+
...agent.environment,
|
|
36540
|
+
MOBIUS_OPENCODE_PERMISSION: value,
|
|
36541
|
+
OPENCODE_CONFIG_CONTENT: JSON.stringify({
|
|
36542
|
+
...openCodeConfiguration(agent.environment),
|
|
36543
|
+
permission: openCodePermission(value)
|
|
36544
|
+
})
|
|
36545
|
+
}),
|
|
36546
|
+
true
|
|
36547
|
+
);
|
|
36548
|
+
};
|
|
36549
|
+
};
|
|
36550
|
+
var CodexSettingsAdapter = class extends AgentSettingsAdapter {
|
|
36551
|
+
modelEffortResolution = AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE;
|
|
36552
|
+
};
|
|
36553
|
+
var genericAdapter = new AgentSettingsAdapter();
|
|
36554
|
+
var codexAdapter = new CodexSettingsAdapter();
|
|
36555
|
+
var deepSeekHarnessAdapter = new DeepSeekHarnessSettingsAdapter();
|
|
36556
|
+
var openCodeAdapter = new OpenCodeSettingsAdapter();
|
|
36557
|
+
function agentSettingsAdapterForAgent(agentId) {
|
|
36558
|
+
if (agentId === "codex") {
|
|
36559
|
+
return codexAdapter;
|
|
36560
|
+
}
|
|
36561
|
+
if (agentId === "deepseek-harness") {
|
|
36562
|
+
return deepSeekHarnessAdapter;
|
|
36563
|
+
}
|
|
36564
|
+
if (agentId === "opencode") {
|
|
36565
|
+
return openCodeAdapter;
|
|
36566
|
+
}
|
|
36567
|
+
return genericAdapter;
|
|
36568
|
+
}
|
|
36569
|
+
function applyAgentLaunchSettings(agent, selections) {
|
|
36570
|
+
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
36571
|
+
let selectedAgent = agent;
|
|
36572
|
+
const sessionConfigurations = [];
|
|
36573
|
+
for (const selection of selections) {
|
|
36574
|
+
const applied = adapter.applyLaunchSelection(selectedAgent, selection);
|
|
36575
|
+
selectedAgent = applied.agent;
|
|
36576
|
+
if (!applied.handled) {
|
|
36577
|
+
sessionConfigurations.push(selection);
|
|
36578
|
+
}
|
|
36579
|
+
}
|
|
36580
|
+
return new AppliedAgentLaunchSettings(selectedAgent, sessionConfigurations);
|
|
36581
|
+
}
|
|
36582
|
+
|
|
36676
36583
|
// src/agent-catalog/publish-agent-catalog.ts
|
|
36677
36584
|
import { fetch as fetch3 } from "undici";
|
|
36678
36585
|
|
|
@@ -37330,7 +37237,7 @@ function invalidResponse(message) {
|
|
|
37330
37237
|
function isRecord10(value) {
|
|
37331
37238
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37332
37239
|
}
|
|
37333
|
-
function
|
|
37240
|
+
function record2(value, name) {
|
|
37334
37241
|
if (!isRecord10(value)) {
|
|
37335
37242
|
throw invalidResponse(`The service returned an invalid ${name}`);
|
|
37336
37243
|
}
|
|
@@ -37465,11 +37372,11 @@ function uploadingArtifact(value) {
|
|
|
37465
37372
|
);
|
|
37466
37373
|
}
|
|
37467
37374
|
function decodeMobiusArtifactUpload(value) {
|
|
37468
|
-
const artifact =
|
|
37375
|
+
const artifact = record2(value, "artifact upload authorization");
|
|
37469
37376
|
return new MobiusArtifactUpload(uploadingArtifact(artifact), stringField(artifact, "uploadToken", 256));
|
|
37470
37377
|
}
|
|
37471
37378
|
function decodeMobiusArtifact(value) {
|
|
37472
|
-
const artifact =
|
|
37379
|
+
const artifact = record2(value, "artifact");
|
|
37473
37380
|
const state = stringField(artifact, "state", 32);
|
|
37474
37381
|
if (state === "uploading") {
|
|
37475
37382
|
return uploadingArtifact(artifact);
|
|
@@ -39656,9 +39563,9 @@ var ACTIVE_TURN_RECONCILIATION_CLOSE_CODE = 4009;
|
|
|
39656
39563
|
var DaemonAcpObserver = class {
|
|
39657
39564
|
#config;
|
|
39658
39565
|
#record;
|
|
39659
|
-
constructor(config2,
|
|
39566
|
+
constructor(config2, record3) {
|
|
39660
39567
|
this.#config = config2;
|
|
39661
|
-
this.#record =
|
|
39568
|
+
this.#record = record3;
|
|
39662
39569
|
}
|
|
39663
39570
|
importLocalArtifact = async (sessionId, artifact, signal) => (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
39664
39571
|
onCommands = (event) => {
|
|
@@ -40229,30 +40136,157 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
40229
40136
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
40230
40137
|
}
|
|
40231
40138
|
async function discoverAgentSettings(command, config2, directories, sessions, signal) {
|
|
40232
|
-
const resolved = await resolveSessionDirectories(
|
|
40233
|
-
directories,
|
|
40234
|
-
config2.bindingId,
|
|
40235
|
-
command.directoryId,
|
|
40236
|
-
command.additionalDirectoryIds,
|
|
40237
|
-
signal
|
|
40238
|
-
);
|
|
40239
40139
|
const agent = config2.catalog.find(command.agentId);
|
|
40240
|
-
const
|
|
40241
|
-
|
|
40140
|
+
const cwd = await directories.resolve(config2.bindingId, "default", signal);
|
|
40141
|
+
const baseSnapshot = await sessions.inspectAgentSettings({
|
|
40142
|
+
additionalDirectories: [],
|
|
40242
40143
|
agent,
|
|
40243
|
-
cwd
|
|
40144
|
+
cwd,
|
|
40244
40145
|
signal
|
|
40245
40146
|
});
|
|
40147
|
+
const selectedSnapshot = command.model === void 0 ? baseSnapshot : await sessions.inspectAgentSettings({
|
|
40148
|
+
additionalDirectories: [],
|
|
40149
|
+
agent,
|
|
40150
|
+
cwd,
|
|
40151
|
+
model: command.model,
|
|
40152
|
+
signal
|
|
40153
|
+
});
|
|
40154
|
+
const adapter = agentSettingsAdapterForAgent(agent.id);
|
|
40155
|
+
const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
|
|
40156
|
+
const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
|
|
40157
|
+
const modelEffort = await discoverModelEffort(
|
|
40158
|
+
command,
|
|
40159
|
+
agent,
|
|
40160
|
+
adapter.modelEffortResolution,
|
|
40161
|
+
baseSnapshot.configOptions,
|
|
40162
|
+
selectedSnapshot.configOptions,
|
|
40163
|
+
cwd,
|
|
40164
|
+
sessions,
|
|
40165
|
+
signal
|
|
40166
|
+
);
|
|
40246
40167
|
return {
|
|
40247
40168
|
agentId: command.agentId,
|
|
40248
|
-
agentName:
|
|
40249
|
-
agentVersion:
|
|
40250
|
-
configOptions: snapshot.configOptions,
|
|
40251
|
-
directoryId: command.directoryId,
|
|
40169
|
+
agentName: selectedSnapshot.agentName,
|
|
40170
|
+
agentVersion: selectedSnapshot.agentVersion,
|
|
40252
40171
|
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
40253
|
-
|
|
40172
|
+
modelEffort,
|
|
40173
|
+
requestId: command.requestId,
|
|
40174
|
+
settings,
|
|
40175
|
+
settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort)
|
|
40254
40176
|
};
|
|
40255
40177
|
}
|
|
40178
|
+
function settingFromOption(option) {
|
|
40179
|
+
return {
|
|
40180
|
+
booleanValue: option.booleanValue,
|
|
40181
|
+
category: option.category,
|
|
40182
|
+
defaultValue: option.type === "boolean" ? "" : option.currentValue,
|
|
40183
|
+
description: option.description,
|
|
40184
|
+
id: option.id,
|
|
40185
|
+
name: option.name,
|
|
40186
|
+
type: option.type,
|
|
40187
|
+
values: option.values
|
|
40188
|
+
};
|
|
40189
|
+
}
|
|
40190
|
+
function settingsFromSnapshot(agent, configOptions) {
|
|
40191
|
+
const settings = [
|
|
40192
|
+
...agentSettingsAdapterForAgent(agent.id).settings(agent).map(settingFromOption),
|
|
40193
|
+
...configOptions.map(settingFromOption)
|
|
40194
|
+
];
|
|
40195
|
+
const identifiers = /* @__PURE__ */ new Set();
|
|
40196
|
+
for (const setting of settings) {
|
|
40197
|
+
if (identifiers.has(setting.id)) {
|
|
40198
|
+
throw new AcpExecutionError(
|
|
40199
|
+
"The Agent returned duplicate setting identifiers",
|
|
40200
|
+
{},
|
|
40201
|
+
"invalid_session_configuration"
|
|
40202
|
+
);
|
|
40203
|
+
}
|
|
40204
|
+
identifiers.add(setting.id);
|
|
40205
|
+
}
|
|
40206
|
+
if (settings.length > 128) {
|
|
40207
|
+
throw new AcpExecutionError("The Agent returned too many settings", {}, "invalid_session_configuration");
|
|
40208
|
+
}
|
|
40209
|
+
return settings;
|
|
40210
|
+
}
|
|
40211
|
+
function modelOption(options) {
|
|
40212
|
+
return options.find((option) => option.id === "model" || option.category === "model");
|
|
40213
|
+
}
|
|
40214
|
+
function effortOption(options) {
|
|
40215
|
+
return options.find((option) => option.id === "reasoning_effort" || option.category === "thought_level");
|
|
40216
|
+
}
|
|
40217
|
+
function unavailableModelEffort() {
|
|
40218
|
+
return {
|
|
40219
|
+
effortSettingId: "",
|
|
40220
|
+
modelSettingId: "",
|
|
40221
|
+
resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
|
|
40222
|
+
valuesByModel: {}
|
|
40223
|
+
};
|
|
40224
|
+
}
|
|
40225
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
|
|
40226
|
+
const model = modelOption(initialOptions);
|
|
40227
|
+
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
40228
|
+
return unavailableModelEffort();
|
|
40229
|
+
}
|
|
40230
|
+
if (model === void 0 || model.type !== "select" || model.values.length === 0) {
|
|
40231
|
+
return unavailableModelEffort();
|
|
40232
|
+
}
|
|
40233
|
+
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
40234
|
+
additionalDirectories: [],
|
|
40235
|
+
agent,
|
|
40236
|
+
cwd,
|
|
40237
|
+
model: modelValue,
|
|
40238
|
+
signal
|
|
40239
|
+
})).configOptions;
|
|
40240
|
+
const valuesByModel = {};
|
|
40241
|
+
if (resolution === "complete") {
|
|
40242
|
+
const effort = effortOption(initialOptions);
|
|
40243
|
+
if (effort === void 0 || effort.type !== "select" || effort.values.length < 2) {
|
|
40244
|
+
return unavailableModelEffort();
|
|
40245
|
+
}
|
|
40246
|
+
for (const value of model.values) {
|
|
40247
|
+
const selectedEffort2 = effortOption(await inspectModel(value.value));
|
|
40248
|
+
valuesByModel[value.value] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40249
|
+
}
|
|
40250
|
+
return {
|
|
40251
|
+
effortSettingId: effort.id,
|
|
40252
|
+
modelSettingId: model.id,
|
|
40253
|
+
resolution: "complete",
|
|
40254
|
+
valuesByModel
|
|
40255
|
+
};
|
|
40256
|
+
}
|
|
40257
|
+
if (command.model !== void 0) {
|
|
40258
|
+
if (!model.values.some((value) => value.value === command.model)) {
|
|
40259
|
+
throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
|
|
40260
|
+
}
|
|
40261
|
+
const selectedEffort2 = effortOption(selectedOptions);
|
|
40262
|
+
valuesByModel[command.model] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
40263
|
+
}
|
|
40264
|
+
const selectedEffort = effortOption(selectedOptions);
|
|
40265
|
+
return {
|
|
40266
|
+
effortSettingId: selectedEffort?.id ?? "",
|
|
40267
|
+
modelSettingId: model.id,
|
|
40268
|
+
resolution: "on_model_selection",
|
|
40269
|
+
valuesByModel
|
|
40270
|
+
};
|
|
40271
|
+
}
|
|
40272
|
+
function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
40273
|
+
const revisionModelEffort = modelEffort.resolution === AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE ? modelEffort : {
|
|
40274
|
+
effortSettingId: "",
|
|
40275
|
+
modelSettingId: modelEffort.modelSettingId,
|
|
40276
|
+
resolution: modelEffort.resolution,
|
|
40277
|
+
valuesByModel: {}
|
|
40278
|
+
};
|
|
40279
|
+
return createHash5("sha256").update(
|
|
40280
|
+
JSON.stringify({
|
|
40281
|
+
adapterVersion: agent.adapterVersion,
|
|
40282
|
+
agentId: agent.id,
|
|
40283
|
+
agentVersion: agent.agentVersion,
|
|
40284
|
+
modelEffort: revisionModelEffort,
|
|
40285
|
+
reportedAgentVersion,
|
|
40286
|
+
settings
|
|
40287
|
+
})
|
|
40288
|
+
).digest("hex");
|
|
40289
|
+
}
|
|
40256
40290
|
async function executeWorkspaceList(socket, command, directories, audit, signal) {
|
|
40257
40291
|
try {
|
|
40258
40292
|
const listing = await directories.list(command.bindingId, command.directoryId, signal);
|
|
@@ -40440,7 +40474,9 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40440
40474
|
"prompt_queue_target_unavailable"
|
|
40441
40475
|
);
|
|
40442
40476
|
}
|
|
40443
|
-
const
|
|
40477
|
+
const appliedSettings = command.sessionConfigurations === void 0 ? void 0 : agentForSessionConfiguration(agent, command.sessionConfigurations);
|
|
40478
|
+
const executionAgent = appliedSettings?.agent ?? agent;
|
|
40479
|
+
const sessionConfigurations = appliedSettings?.sessionConfigurations;
|
|
40444
40480
|
if (command.sessionConfigurations !== void 0) {
|
|
40445
40481
|
const prepared = await sessions.prepareExecutionSession({
|
|
40446
40482
|
additionalDirectories: resolved.additionalDirectories,
|
|
@@ -40450,13 +40486,13 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40450
40486
|
signal
|
|
40451
40487
|
});
|
|
40452
40488
|
if (command.disposition === SessionPromptDisposition.Steer) {
|
|
40453
|
-
assertCompleteSessionConfiguration(prepared.configOptions,
|
|
40489
|
+
assertCompleteSessionConfiguration(prepared.configOptions, sessionConfigurations ?? []);
|
|
40454
40490
|
} else {
|
|
40455
40491
|
await applyCompleteSessionConfiguration(
|
|
40456
40492
|
sessions,
|
|
40457
40493
|
audit,
|
|
40458
40494
|
prepared.configOptions,
|
|
40459
|
-
|
|
40495
|
+
sessionConfigurations ?? [],
|
|
40460
40496
|
executionAgent,
|
|
40461
40497
|
resolved.cwd,
|
|
40462
40498
|
resolved.additionalDirectories,
|
|
@@ -40570,14 +40606,14 @@ function invalidSessionConfiguration(message) {
|
|
|
40570
40606
|
return new AcpExecutionError(message, {}, "invalid_session_configuration");
|
|
40571
40607
|
}
|
|
40572
40608
|
function agentForSessionConfiguration(agent, selections) {
|
|
40573
|
-
|
|
40574
|
-
|
|
40575
|
-
|
|
40576
|
-
|
|
40577
|
-
|
|
40609
|
+
try {
|
|
40610
|
+
return applyAgentLaunchSettings(agent, selections);
|
|
40611
|
+
} catch (error62) {
|
|
40612
|
+
if (error62 instanceof Error) {
|
|
40613
|
+
throw invalidSessionConfiguration(error62.message);
|
|
40614
|
+
}
|
|
40615
|
+
throw error62;
|
|
40578
40616
|
}
|
|
40579
|
-
validateSessionConfigurationSelection(agent.permissionProfile.option(agent.environment), permission);
|
|
40580
|
-
return agent.withPermissionMode(permission.value);
|
|
40581
40617
|
}
|
|
40582
40618
|
function validateSessionConfigurationSelection(option, selection) {
|
|
40583
40619
|
if (option.type !== selection.valueType) {
|
|
@@ -40611,17 +40647,6 @@ function assertSessionConfigurationSchema(options, selections) {
|
|
|
40611
40647
|
}
|
|
40612
40648
|
}
|
|
40613
40649
|
}
|
|
40614
|
-
function assertSessionConfigurationCoverage(options, selections) {
|
|
40615
|
-
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40616
|
-
if (selectionsById.size !== selections.length) {
|
|
40617
|
-
throw invalidSessionConfiguration("The Turn configuration contains duplicate Agent settings");
|
|
40618
|
-
}
|
|
40619
|
-
for (const option of options) {
|
|
40620
|
-
if (!selectionsById.has(option.id)) {
|
|
40621
|
-
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
|
|
40622
|
-
}
|
|
40623
|
-
}
|
|
40624
|
-
}
|
|
40625
40650
|
function sessionConfigurationSelectionIsAvailable(option, selection) {
|
|
40626
40651
|
if (option.type !== selection.valueType) {
|
|
40627
40652
|
return false;
|
|
@@ -40636,20 +40661,17 @@ function sessionConfigurationMatches(option, selection) {
|
|
|
40636
40661
|
return option.type === "boolean" ? option.booleanValue === selection.booleanValue : option.currentValue === selection.value;
|
|
40637
40662
|
}
|
|
40638
40663
|
function sessionConfigurationPriority(selection, options) {
|
|
40639
|
-
if (selection.configId === "permission_mode") {
|
|
40640
|
-
return 0;
|
|
40641
|
-
}
|
|
40642
40664
|
const option = options.find((candidate) => candidate.id === selection.configId);
|
|
40643
40665
|
if (selection.configId === "model" || option?.category === "model") {
|
|
40644
|
-
return
|
|
40666
|
+
return 0;
|
|
40645
40667
|
}
|
|
40646
40668
|
if (selection.configId === "reasoning_effort" || option?.category === "thought_level") {
|
|
40647
|
-
return
|
|
40669
|
+
return 1;
|
|
40648
40670
|
}
|
|
40649
40671
|
if (option?.category === "model_config") {
|
|
40650
|
-
return
|
|
40672
|
+
return 2;
|
|
40651
40673
|
}
|
|
40652
|
-
return
|
|
40674
|
+
return 3;
|
|
40653
40675
|
}
|
|
40654
40676
|
function assertCompleteSessionConfiguration(options, selections) {
|
|
40655
40677
|
assertSessionConfigurationSchema(options, selections);
|
|
@@ -40665,12 +40687,6 @@ function assertAppliedSessionConfiguration(options, selections) {
|
|
|
40665
40687
|
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40666
40688
|
for (const option of options) {
|
|
40667
40689
|
const selection = selectionsById.get(option.id);
|
|
40668
|
-
if (option.id === AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40669
|
-
if (selection === void 0 || !sessionConfigurationMatches(option, selection)) {
|
|
40670
|
-
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
|
|
40671
|
-
}
|
|
40672
|
-
continue;
|
|
40673
|
-
}
|
|
40674
40690
|
if (selection === void 0 || !sessionConfigurationSelectionIsAvailable(option, selection)) {
|
|
40675
40691
|
continue;
|
|
40676
40692
|
}
|
|
@@ -40691,61 +40707,56 @@ function unavailableSessionConfigurationCategory(selection) {
|
|
|
40691
40707
|
async function applySessionConfigurationSelection(sessions, audit, options, selection, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40692
40708
|
const option = options.find((candidate) => candidate.id === selection.configId);
|
|
40693
40709
|
if (option === void 0) {
|
|
40694
|
-
|
|
40695
|
-
|
|
40696
|
-
|
|
40697
|
-
|
|
40698
|
-
|
|
40699
|
-
|
|
40700
|
-
|
|
40701
|
-
|
|
40702
|
-
|
|
40703
|
-
|
|
40704
|
-
|
|
40705
|
-
return options;
|
|
40706
|
-
}
|
|
40707
|
-
throw invalidSessionConfiguration(`The Agent setting ${selection.configId} is unavailable`);
|
|
40710
|
+
warnIgnoredSetting(
|
|
40711
|
+
audit,
|
|
40712
|
+
"session_configuration_setting_ignored",
|
|
40713
|
+
commandId,
|
|
40714
|
+
sessionId,
|
|
40715
|
+
agent.id,
|
|
40716
|
+
selection,
|
|
40717
|
+
unavailableSessionConfigurationCategory(selection),
|
|
40718
|
+
"setting_unavailable"
|
|
40719
|
+
);
|
|
40720
|
+
return options;
|
|
40708
40721
|
}
|
|
40709
|
-
if (
|
|
40710
|
-
|
|
40711
|
-
|
|
40712
|
-
|
|
40713
|
-
|
|
40714
|
-
|
|
40715
|
-
|
|
40716
|
-
|
|
40717
|
-
|
|
40718
|
-
|
|
40719
|
-
|
|
40720
|
-
|
|
40721
|
-
|
|
40722
|
-
|
|
40723
|
-
|
|
40724
|
-
|
|
40725
|
-
|
|
40726
|
-
|
|
40727
|
-
|
|
40728
|
-
|
|
40729
|
-
|
|
40730
|
-
|
|
40731
|
-
|
|
40732
|
-
|
|
40733
|
-
|
|
40734
|
-
|
|
40735
|
-
|
|
40736
|
-
|
|
40737
|
-
|
|
40738
|
-
|
|
40739
|
-
|
|
40740
|
-
|
|
40741
|
-
|
|
40742
|
-
|
|
40743
|
-
|
|
40744
|
-
|
|
40745
|
-
|
|
40746
|
-
|
|
40747
|
-
return options;
|
|
40748
|
-
}
|
|
40722
|
+
if (option.type !== selection.valueType) {
|
|
40723
|
+
warnIgnoredSetting(
|
|
40724
|
+
audit,
|
|
40725
|
+
"session_configuration_setting_ignored",
|
|
40726
|
+
commandId,
|
|
40727
|
+
sessionId,
|
|
40728
|
+
agent.id,
|
|
40729
|
+
selection,
|
|
40730
|
+
option.category,
|
|
40731
|
+
"setting_schema_mismatch"
|
|
40732
|
+
);
|
|
40733
|
+
return options;
|
|
40734
|
+
}
|
|
40735
|
+
if (option.type === "boolean" && selection.value.length > 0 || option.type === "select" && selection.booleanValue) {
|
|
40736
|
+
warnIgnoredSetting(
|
|
40737
|
+
audit,
|
|
40738
|
+
"session_configuration_setting_ignored",
|
|
40739
|
+
commandId,
|
|
40740
|
+
sessionId,
|
|
40741
|
+
agent.id,
|
|
40742
|
+
selection,
|
|
40743
|
+
option.category,
|
|
40744
|
+
"selection_schema_mismatch"
|
|
40745
|
+
);
|
|
40746
|
+
return options;
|
|
40747
|
+
}
|
|
40748
|
+
if (option.type === "select" && !option.values.some((value) => value.value === selection.value)) {
|
|
40749
|
+
warnIgnoredSetting(
|
|
40750
|
+
audit,
|
|
40751
|
+
"session_configuration_setting_ignored",
|
|
40752
|
+
commandId,
|
|
40753
|
+
sessionId,
|
|
40754
|
+
agent.id,
|
|
40755
|
+
selection,
|
|
40756
|
+
option.category,
|
|
40757
|
+
"value_unavailable"
|
|
40758
|
+
);
|
|
40759
|
+
return options;
|
|
40749
40760
|
}
|
|
40750
40761
|
if (sessionConfigurationMatches(option, selection)) {
|
|
40751
40762
|
return options;
|
|
@@ -40764,7 +40775,6 @@ async function applySessionConfigurationSelection(sessions, audit, options, sele
|
|
|
40764
40775
|
});
|
|
40765
40776
|
}
|
|
40766
40777
|
async function applyCompleteSessionConfiguration(sessions, audit, initialOptions, selections, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40767
|
-
assertSessionConfigurationCoverage(initialOptions, selections);
|
|
40768
40778
|
let options = initialOptions;
|
|
40769
40779
|
const orderedSelections = selections.toSorted((left, right) => {
|
|
40770
40780
|
const priority = sessionConfigurationPriority(left, initialOptions) - sessionConfigurationPriority(right, initialOptions);
|
|
@@ -41252,7 +41262,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41252
41262
|
);
|
|
41253
41263
|
audit.record({
|
|
41254
41264
|
commandId: command2.requestId,
|
|
41255
|
-
details: { agentId: command2.agentId
|
|
41265
|
+
details: { agentId: command2.agentId },
|
|
41256
41266
|
event: "agent_settings_discovered",
|
|
41257
41267
|
sessionId: `agent-settings:${command2.agentId}`
|
|
41258
41268
|
});
|