@moxt-ai/mobius 0.0.41 → 0.0.43
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/activity.d.ts.map +1 -1
- package/dist/acp/activity.js +52 -8
- package/dist/acp/activity.js.map +1 -1
- package/dist/acp/session-config/session-config-protocol.d.ts +1 -0
- package/dist/acp/session-config/session-config-protocol.d.ts.map +1 -1
- package/dist/acp/session-config/session-config-protocol.js +77 -22
- package/dist/acp/session-config/session-config-protocol.js.map +1 -1
- package/dist/acp/session-manager.d.ts +4 -3
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +63 -6
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/agent-catalog/agent-permission-profile.d.ts +16 -0
- package/dist/agent-catalog/agent-permission-profile.d.ts.map +1 -0
- package/dist/agent-catalog/agent-permission-profile.js +194 -0
- package/dist/agent-catalog/agent-permission-profile.js.map +1 -0
- package/dist/agent-catalog/agents/cursor-cli-agent.d.ts +1 -1
- package/dist/agent-catalog/agents/cursor-cli-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/cursor-cli-agent.js +2 -4
- package/dist/agent-catalog/agents/cursor-cli-agent.js.map +1 -1
- package/dist/agent-catalog/agents/deepseek-harness-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/deepseek-harness-agent.js +1 -2
- package/dist/agent-catalog/agents/deepseek-harness-agent.js.map +1 -1
- package/dist/agent-catalog/agents/opencode-agent.d.ts +1 -1
- package/dist/agent-catalog/agents/opencode-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/opencode-agent.js +8 -1
- package/dist/agent-catalog/agents/opencode-agent.js.map +1 -1
- package/dist/agent-catalog/discover-local-agents.d.ts +0 -2
- package/dist/agent-catalog/discover-local-agents.d.ts.map +1 -1
- package/dist/agent-catalog/discover-local-agents.js +0 -2
- package/dist/agent-catalog/discover-local-agents.js.map +1 -1
- package/dist/agent-catalog/local-agent.d.ts +4 -1
- package/dist/agent-catalog/local-agent.d.ts.map +1 -1
- package/dist/agent-catalog/local-agent.js +12 -2
- package/dist/agent-catalog/local-agent.js.map +1 -1
- package/dist/artifacts/runtime-artifact-uploader.d.ts +2 -2
- package/dist/artifacts/runtime-artifact-uploader.d.ts.map +1 -1
- package/dist/artifacts/runtime-artifact-uploader.js +3 -3
- package/dist/artifacts/runtime-artifact-uploader.js.map +1 -1
- package/dist/authorization/local-artifact.d.ts +6 -0
- package/dist/authorization/local-artifact.d.ts.map +1 -0
- package/dist/authorization/local-artifact.js +2 -0
- package/dist/authorization/local-artifact.js.map +1 -0
- package/dist/authorization/local-video.d.ts +11 -0
- package/dist/authorization/local-video.d.ts.map +1 -0
- package/dist/authorization/local-video.js +48 -0
- package/dist/authorization/local-video.js.map +1 -0
- package/dist/bots/local-bot-grant-store.d.ts +3 -2
- package/dist/bots/local-bot-grant-store.d.ts.map +1 -1
- package/dist/bots/local-bot-grant-store.js +52 -7
- package/dist/bots/local-bot-grant-store.js.map +1 -1
- package/dist/cli.js +6577 -5969
- package/dist/cli.js.map +4 -4
- package/dist/index.js +692 -82
- package/dist/index.js.map +4 -4
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +47 -5
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +5983 -5375
- package/dist/runtime.js.map +4 -4
- package/package.json +1 -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 record4 of pendingRecords.get(ctx) ?? []) {
|
|
16632
|
+
const seen = ctx.seen.get(record4);
|
|
16633
16633
|
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
16634
16634
|
if (!names || names === true || rewrites.has(names))
|
|
16635
16635
|
continue;
|
|
@@ -19863,6 +19863,45 @@ var sessionConfigurationSelectionSchema = external_exports.strictObject({
|
|
|
19863
19863
|
value: external_exports.string().max(500),
|
|
19864
19864
|
valueType: external_exports.enum(["boolean", "select"])
|
|
19865
19865
|
}).readonly();
|
|
19866
|
+
var AGENT_DEFAULT_EXECUTION_SETTING = "agent_default";
|
|
19867
|
+
var AGENT_PERMISSION_MODE_CONFIG_ID = "permission_mode";
|
|
19868
|
+
var AGENT_PERMISSION_MODES = Object.freeze([
|
|
19869
|
+
AGENT_DEFAULT_EXECUTION_SETTING,
|
|
19870
|
+
"read-only",
|
|
19871
|
+
"workspace-write",
|
|
19872
|
+
"danger-full-access"
|
|
19873
|
+
]);
|
|
19874
|
+
var agentExecutionConfigurationSchema = external_exports.strictObject({
|
|
19875
|
+
model: sessionConfigurationSelectionSchema,
|
|
19876
|
+
permissionMode: external_exports.string().refine((value) => AGENT_PERMISSION_MODES.includes(value)),
|
|
19877
|
+
reasoningEffort: sessionConfigurationSelectionSchema
|
|
19878
|
+
}).superRefine((configuration, context) => {
|
|
19879
|
+
if (configuration.model.valueType !== "select" || configuration.model.booleanValue || configuration.model.value.length === 0 || configuration.reasoningEffort.valueType !== "select" || configuration.reasoningEffort.booleanValue || configuration.reasoningEffort.value.length === 0) {
|
|
19880
|
+
context.addIssue({
|
|
19881
|
+
code: "custom",
|
|
19882
|
+
message: "Model and reasoning effort must be explicit select configurations"
|
|
19883
|
+
});
|
|
19884
|
+
}
|
|
19885
|
+
if (configuration.model.configId === configuration.reasoningEffort.configId || configuration.model.configId === AGENT_PERMISSION_MODE_CONFIG_ID || configuration.reasoningEffort.configId === AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
19886
|
+
context.addIssue({
|
|
19887
|
+
code: "custom",
|
|
19888
|
+
message: "Required execution setting identifiers must differ"
|
|
19889
|
+
});
|
|
19890
|
+
}
|
|
19891
|
+
}).readonly();
|
|
19892
|
+
function agentDefaultSelection(configId) {
|
|
19893
|
+
return Object.freeze({
|
|
19894
|
+
booleanValue: false,
|
|
19895
|
+
configId,
|
|
19896
|
+
value: AGENT_DEFAULT_EXECUTION_SETTING,
|
|
19897
|
+
valueType: "select"
|
|
19898
|
+
});
|
|
19899
|
+
}
|
|
19900
|
+
var DEFAULT_AGENT_EXECUTION_CONFIGURATION = Object.freeze({
|
|
19901
|
+
model: agentDefaultSelection("model"),
|
|
19902
|
+
permissionMode: AGENT_DEFAULT_EXECUTION_SETTING,
|
|
19903
|
+
reasoningEffort: agentDefaultSelection("reasoning_effort")
|
|
19904
|
+
});
|
|
19866
19905
|
var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigurationSelectionSchema).max(100).superRefine((selections, context) => {
|
|
19867
19906
|
const identifiers = /* @__PURE__ */ new Set();
|
|
19868
19907
|
for (const [index2, selection] of selections.entries()) {
|
|
@@ -19933,7 +19972,7 @@ var displayContentSchema = external_exports.strictObject({
|
|
|
19933
19972
|
path: external_exports.string().max(2048),
|
|
19934
19973
|
terminalId: external_exports.string().max(255),
|
|
19935
19974
|
text: LONG_TEXT,
|
|
19936
|
-
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text"]),
|
|
19975
|
+
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text", "video"]),
|
|
19937
19976
|
uri: external_exports.string().max(4096)
|
|
19938
19977
|
}).readonly();
|
|
19939
19978
|
var recordedDisplayContentSchema = external_exports.strictObject({
|
|
@@ -19946,7 +19985,7 @@ var recordedDisplayContentSchema = external_exports.strictObject({
|
|
|
19946
19985
|
path: external_exports.string().max(2048),
|
|
19947
19986
|
terminalId: external_exports.string().max(255),
|
|
19948
19987
|
text: external_exports.string().max(4e6),
|
|
19949
|
-
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text"]),
|
|
19988
|
+
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text", "video"]),
|
|
19950
19989
|
uri: external_exports.string().max(4096)
|
|
19951
19990
|
}).readonly();
|
|
19952
19991
|
var promptImageSchema = external_exports.strictObject({
|
|
@@ -19993,8 +20032,17 @@ var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
|
19993
20032
|
}).readonly().optional(),
|
|
19994
20033
|
kind: external_exports.literal(SESSION_PREPARE_KIND),
|
|
19995
20034
|
requestId: IDENTIFIER,
|
|
20035
|
+
sessionState: external_exports.literal("provisioned").optional(),
|
|
19996
20036
|
/** @deprecated Reserved for the legacy Bot Agent-configuration endpoint. */
|
|
19997
20037
|
transient: external_exports.boolean().optional()
|
|
20038
|
+
}).superRefine((command, context) => {
|
|
20039
|
+
if (command.transient === true && command.sessionState === "provisioned") {
|
|
20040
|
+
context.addIssue({
|
|
20041
|
+
code: "custom",
|
|
20042
|
+
message: "A transient Session cannot already be provisioned",
|
|
20043
|
+
path: ["sessionState"]
|
|
20044
|
+
});
|
|
20045
|
+
}
|
|
19998
20046
|
}).readonly();
|
|
19999
20047
|
var runtimeTimingsSchema = external_exports.array(
|
|
20000
20048
|
external_exports.strictObject({
|
|
@@ -20206,6 +20254,7 @@ var decodeRecordedAgentContentValue = (value) => decodeValue(value, recordedDisp
|
|
|
20206
20254
|
var decodePromptImagesValue = (value) => decodeValue(value, external_exports.array(promptImageSchema).max(8).readonly());
|
|
20207
20255
|
var decodePromptResourcesValue = (value) => decodeValue(value, external_exports.array(promptResourceSchema).max(16).readonly());
|
|
20208
20256
|
var decodeSessionConfigurationSelections = (value) => decodeValue(value, sessionConfigurationSelectionsSchema);
|
|
20257
|
+
var decodeAgentExecutionConfiguration = (value) => decodeValue(value, agentExecutionConfigurationSchema);
|
|
20209
20258
|
var encode3 = (message, schema) => JSON.stringify(decodeValue(message, schema));
|
|
20210
20259
|
var decodeAgentSettingsDiscoverCommand = (encoded) => decode3(encoded, agentSettingsDiscoverCommandSchema);
|
|
20211
20260
|
var encodeAgentSettingsDiscoveredEvent = (message) => encode3(message, agentSettingsDiscoveredEventSchema);
|
|
@@ -20741,13 +20790,14 @@ var BotExecutionBindingApprovalRequest = class {
|
|
|
20741
20790
|
bindingRevision;
|
|
20742
20791
|
botId;
|
|
20743
20792
|
completionPolicy;
|
|
20793
|
+
executionConfiguration;
|
|
20744
20794
|
kind = BOT_BINDING_APPROVAL_REQUEST_KIND;
|
|
20745
20795
|
requestId;
|
|
20746
20796
|
requiredCapabilities;
|
|
20747
20797
|
runtimeId;
|
|
20748
20798
|
sessionConfigurations;
|
|
20749
20799
|
workspaceRef;
|
|
20750
|
-
constructor(requestId, botId, behaviorRevisionId, bindingId, bindingRevision, runtimeId, agentRef, workspaceRef, agentConfigRevision, behaviorInstructions, behaviorDigest, requiredCapabilities, allowedDeliveryTargets, completionPolicy, sessionConfigurations = []) {
|
|
20800
|
+
constructor(requestId, botId, behaviorRevisionId, bindingId, bindingRevision, runtimeId, agentRef, workspaceRef, agentConfigRevision, behaviorInstructions, behaviorDigest, requiredCapabilities, allowedDeliveryTargets, completionPolicy, executionConfiguration, sessionConfigurations = []) {
|
|
20751
20801
|
this.requestId = requestId;
|
|
20752
20802
|
this.botId = botId;
|
|
20753
20803
|
this.behaviorRevisionId = behaviorRevisionId;
|
|
@@ -20767,6 +20817,7 @@ var BotExecutionBindingApprovalRequest = class {
|
|
|
20767
20817
|
)
|
|
20768
20818
|
);
|
|
20769
20819
|
this.completionPolicy = completionPolicy;
|
|
20820
|
+
this.executionConfiguration = decodeAgentExecutionConfiguration(executionConfiguration);
|
|
20770
20821
|
}
|
|
20771
20822
|
toJSON() {
|
|
20772
20823
|
const { sessionConfigurations, ...request } = this;
|
|
@@ -20834,6 +20885,7 @@ var BotSessionPromptCommand = class {
|
|
|
20834
20885
|
executionCapabilitySecret;
|
|
20835
20886
|
executionDeadlineAt;
|
|
20836
20887
|
executionId;
|
|
20888
|
+
executionConfiguration;
|
|
20837
20889
|
images;
|
|
20838
20890
|
kind = BOT_SESSION_PROMPT_KIND;
|
|
20839
20891
|
localGrantId;
|
|
@@ -20844,7 +20896,7 @@ var BotSessionPromptCommand = class {
|
|
|
20844
20896
|
sessionId;
|
|
20845
20897
|
targetCommandId;
|
|
20846
20898
|
turnId;
|
|
20847
|
-
constructor(sessionId, commandId, agentId, bindingId, directoryId2, additionalDirectoryIds, images, resources, prompt, executionId, executionCapabilityId, executionCapabilitySecret, executionDeadlineAt, botId, conversationId, turnId, behaviorRevisionId, bindingRevision, localGrantId, behaviorInstructions, behaviorDigest, allowedDeliveryTargets, replyRoute, sessionConfigurations = [], disposition = SessionPromptDisposition.Reject, targetCommandId = "") {
|
|
20899
|
+
constructor(sessionId, commandId, agentId, bindingId, directoryId2, additionalDirectoryIds, images, resources, prompt, executionId, executionCapabilityId, executionCapabilitySecret, executionDeadlineAt, botId, conversationId, turnId, behaviorRevisionId, bindingRevision, localGrantId, behaviorInstructions, behaviorDigest, allowedDeliveryTargets, replyRoute, executionConfiguration, sessionConfigurations = [], disposition = SessionPromptDisposition.Reject, targetCommandId = "") {
|
|
20848
20900
|
this.sessionId = sessionId;
|
|
20849
20901
|
this.commandId = commandId;
|
|
20850
20902
|
this.agentId = agentId;
|
|
@@ -20873,6 +20925,7 @@ var BotSessionPromptCommand = class {
|
|
|
20873
20925
|
)
|
|
20874
20926
|
);
|
|
20875
20927
|
this.replyRoute = replyRoute;
|
|
20928
|
+
this.executionConfiguration = decodeAgentExecutionConfiguration(executionConfiguration);
|
|
20876
20929
|
this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
|
|
20877
20930
|
this.targetCommandId = targetCommandId;
|
|
20878
20931
|
}
|
|
@@ -21058,6 +21111,7 @@ function decodeBotExecutionBindingApprovalRequest(encoded) {
|
|
|
21058
21111
|
"bindingRevision",
|
|
21059
21112
|
"botId",
|
|
21060
21113
|
"completionPolicy",
|
|
21114
|
+
"executionConfiguration",
|
|
21061
21115
|
"kind",
|
|
21062
21116
|
"requestId",
|
|
21063
21117
|
"requiredCapabilities",
|
|
@@ -21084,6 +21138,7 @@ function decodeBotExecutionBindingApprovalRequest(encoded) {
|
|
|
21084
21138
|
readIdentifiers(value, "requiredCapabilities", 32),
|
|
21085
21139
|
readTargets(value, "allowedDeliveryTargets"),
|
|
21086
21140
|
readCompletionPolicy(value["completionPolicy"]),
|
|
21141
|
+
decodeAgentExecutionConfiguration(value["executionConfiguration"]),
|
|
21087
21142
|
readSessionConfigurations(value)
|
|
21088
21143
|
);
|
|
21089
21144
|
}
|
|
@@ -21166,6 +21221,7 @@ function decodeBotSessionPromptCommand(encoded) {
|
|
|
21166
21221
|
"executionCapabilitySecret",
|
|
21167
21222
|
"executionDeadlineAt",
|
|
21168
21223
|
"executionId",
|
|
21224
|
+
"executionConfiguration",
|
|
21169
21225
|
"images",
|
|
21170
21226
|
"kind",
|
|
21171
21227
|
"localGrantId",
|
|
@@ -21219,6 +21275,7 @@ function decodeBotSessionPromptCommand(encoded) {
|
|
|
21219
21275
|
readDigest(value, "behaviorDigest"),
|
|
21220
21276
|
readTargets(value, "allowedDeliveryTargets"),
|
|
21221
21277
|
readReplyRoute(value["replyRoute"]),
|
|
21278
|
+
decodeAgentExecutionConfiguration(value["executionConfiguration"]),
|
|
21222
21279
|
readSessionConfigurations(value),
|
|
21223
21280
|
disposition,
|
|
21224
21281
|
targetCommandId
|
|
@@ -22103,6 +22160,199 @@ async function runBoundedProcess(options) {
|
|
|
22103
22160
|
}
|
|
22104
22161
|
}
|
|
22105
22162
|
|
|
22163
|
+
// src/agent-catalog/agent-permission-profile.ts
|
|
22164
|
+
var AGENT_DEFAULT_PERMISSION_MODE = AGENT_DEFAULT_EXECUTION_SETTING;
|
|
22165
|
+
var READ_ONLY_PERMISSION_MODE = "read-only";
|
|
22166
|
+
var WORKSPACE_WRITE_PERMISSION_MODE = "workspace-write";
|
|
22167
|
+
var DANGER_FULL_ACCESS_PERMISSION_MODE = "danger-full-access";
|
|
22168
|
+
var PERMISSION_MODE_CONFIG_ID = AGENT_PERMISSION_MODE_CONFIG_ID;
|
|
22169
|
+
var PERMISSION_MODE_MARKER = "MOBIUS_AGENT_PERMISSION_MODE";
|
|
22170
|
+
var AgentPermissionConfigurationError = class extends Error {
|
|
22171
|
+
code = "invalid_agent_permission_configuration";
|
|
22172
|
+
constructor(message, options = {}) {
|
|
22173
|
+
super(message, options);
|
|
22174
|
+
this.name = "AgentPermissionConfigurationError";
|
|
22175
|
+
}
|
|
22176
|
+
};
|
|
22177
|
+
var AgentPermissionProfile = class {
|
|
22178
|
+
option = (environment) => ({
|
|
22179
|
+
booleanValue: false,
|
|
22180
|
+
category: "_mobius_permission",
|
|
22181
|
+
currentValue: this.currentMode(environment),
|
|
22182
|
+
description: this.description,
|
|
22183
|
+
id: PERMISSION_MODE_CONFIG_ID,
|
|
22184
|
+
name: "Permissions",
|
|
22185
|
+
type: "select",
|
|
22186
|
+
values: this.values
|
|
22187
|
+
});
|
|
22188
|
+
};
|
|
22189
|
+
var AgentManagedPermissionProfile = class extends AgentPermissionProfile {
|
|
22190
|
+
description = "This Agent manages its own local permissions.";
|
|
22191
|
+
values = Object.freeze([
|
|
22192
|
+
{
|
|
22193
|
+
description: "Managed by the Agent",
|
|
22194
|
+
groupId: "",
|
|
22195
|
+
groupName: "",
|
|
22196
|
+
name: "Agent default",
|
|
22197
|
+
value: AGENT_DEFAULT_PERMISSION_MODE
|
|
22198
|
+
}
|
|
22199
|
+
]);
|
|
22200
|
+
currentMode = () => AGENT_DEFAULT_PERMISSION_MODE;
|
|
22201
|
+
apply = (environment, permissionMode) => {
|
|
22202
|
+
if (permissionMode !== AGENT_DEFAULT_PERMISSION_MODE) {
|
|
22203
|
+
throw new AgentPermissionConfigurationError("The selected Agent does not support this permission mode");
|
|
22204
|
+
}
|
|
22205
|
+
return Object.freeze({ ...environment });
|
|
22206
|
+
};
|
|
22207
|
+
};
|
|
22208
|
+
var PiPermissionProfile = class extends AgentPermissionProfile {
|
|
22209
|
+
description = "Pi has no built-in sandbox and runs with the local Runtime user's authority.";
|
|
22210
|
+
values = Object.freeze([
|
|
22211
|
+
{
|
|
22212
|
+
description: "Pi default; unrestricted local execution with the Runtime user's authority",
|
|
22213
|
+
groupId: "",
|
|
22214
|
+
groupName: "",
|
|
22215
|
+
name: "Full access (Pi default)",
|
|
22216
|
+
value: DANGER_FULL_ACCESS_PERMISSION_MODE
|
|
22217
|
+
}
|
|
22218
|
+
]);
|
|
22219
|
+
currentMode = () => DANGER_FULL_ACCESS_PERMISSION_MODE;
|
|
22220
|
+
apply = (environment, permissionMode) => {
|
|
22221
|
+
if (permissionMode !== DANGER_FULL_ACCESS_PERMISSION_MODE) {
|
|
22222
|
+
throw new AgentPermissionConfigurationError("Pi only supports its default full-access permission mode");
|
|
22223
|
+
}
|
|
22224
|
+
return Object.freeze({ ...environment });
|
|
22225
|
+
};
|
|
22226
|
+
};
|
|
22227
|
+
var adjustablePermissionValues = Object.freeze([
|
|
22228
|
+
{
|
|
22229
|
+
description: "Keep the Agent's existing permission policy",
|
|
22230
|
+
groupId: "",
|
|
22231
|
+
groupName: "",
|
|
22232
|
+
name: "Agent default",
|
|
22233
|
+
value: AGENT_DEFAULT_PERMISSION_MODE
|
|
22234
|
+
},
|
|
22235
|
+
{
|
|
22236
|
+
description: "Allow inspection without local writes or commands that can change state",
|
|
22237
|
+
groupId: "",
|
|
22238
|
+
groupName: "",
|
|
22239
|
+
name: "Read only",
|
|
22240
|
+
value: READ_ONLY_PERMISSION_MODE
|
|
22241
|
+
},
|
|
22242
|
+
{
|
|
22243
|
+
description: "Allow changes inside the selected workspace while protecting external paths",
|
|
22244
|
+
groupId: "",
|
|
22245
|
+
groupName: "",
|
|
22246
|
+
name: "Workspace write",
|
|
22247
|
+
value: WORKSPACE_WRITE_PERMISSION_MODE
|
|
22248
|
+
},
|
|
22249
|
+
{
|
|
22250
|
+
description: "Allow unrestricted local execution with the Runtime user's authority",
|
|
22251
|
+
groupId: "",
|
|
22252
|
+
groupName: "",
|
|
22253
|
+
name: "Full access",
|
|
22254
|
+
value: DANGER_FULL_ACCESS_PERMISSION_MODE
|
|
22255
|
+
}
|
|
22256
|
+
]);
|
|
22257
|
+
function validateAdjustableMode(permissionMode) {
|
|
22258
|
+
if (!adjustablePermissionValues.some((value) => value.value === permissionMode)) {
|
|
22259
|
+
throw new AgentPermissionConfigurationError("The selected permission mode is unavailable");
|
|
22260
|
+
}
|
|
22261
|
+
return permissionMode;
|
|
22262
|
+
}
|
|
22263
|
+
var DeepSeekHarnessPermissionProfile = class extends AgentPermissionProfile {
|
|
22264
|
+
description = "Controls the local side effects allowed for this Agent session.";
|
|
22265
|
+
values = adjustablePermissionValues;
|
|
22266
|
+
currentMode = (environment) => validateAdjustableMode(environment["DSH_PERMISSION_MODE"] ?? WORKSPACE_WRITE_PERMISSION_MODE);
|
|
22267
|
+
apply = (environment, permissionMode) => {
|
|
22268
|
+
if (permissionMode === AGENT_DEFAULT_PERMISSION_MODE) {
|
|
22269
|
+
return Object.freeze({ ...environment });
|
|
22270
|
+
}
|
|
22271
|
+
return Object.freeze({
|
|
22272
|
+
...environment,
|
|
22273
|
+
DSH_PERMISSION_MODE: validateAdjustableMode(permissionMode),
|
|
22274
|
+
[PERMISSION_MODE_MARKER]: permissionMode
|
|
22275
|
+
});
|
|
22276
|
+
};
|
|
22277
|
+
};
|
|
22278
|
+
function record2(value) {
|
|
22279
|
+
if (value === void 0) {
|
|
22280
|
+
return {};
|
|
22281
|
+
}
|
|
22282
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
22283
|
+
throw new AgentPermissionConfigurationError("The OpenCode inline configuration is invalid");
|
|
22284
|
+
}
|
|
22285
|
+
return Object.fromEntries(Object.entries(value));
|
|
22286
|
+
}
|
|
22287
|
+
function openCodeConfiguration(environment) {
|
|
22288
|
+
const encoded = environment["OPENCODE_CONFIG_CONTENT"];
|
|
22289
|
+
if (encoded === void 0 || encoded.length === 0) {
|
|
22290
|
+
return {};
|
|
22291
|
+
}
|
|
22292
|
+
try {
|
|
22293
|
+
return record2(JSON.parse(encoded));
|
|
22294
|
+
} catch (cause) {
|
|
22295
|
+
if (cause instanceof AgentPermissionConfigurationError) {
|
|
22296
|
+
throw cause;
|
|
22297
|
+
}
|
|
22298
|
+
throw new AgentPermissionConfigurationError("The OpenCode inline configuration is invalid", { cause });
|
|
22299
|
+
}
|
|
22300
|
+
}
|
|
22301
|
+
function openCodePermission(permissionMode) {
|
|
22302
|
+
if (permissionMode === READ_ONLY_PERMISSION_MODE) {
|
|
22303
|
+
return {
|
|
22304
|
+
"*": "deny",
|
|
22305
|
+
glob: "allow",
|
|
22306
|
+
grep: "allow",
|
|
22307
|
+
lsp: "allow",
|
|
22308
|
+
read: "allow",
|
|
22309
|
+
skill: "allow"
|
|
22310
|
+
};
|
|
22311
|
+
}
|
|
22312
|
+
if (permissionMode === WORKSPACE_WRITE_PERMISSION_MODE) {
|
|
22313
|
+
return {
|
|
22314
|
+
"*": "allow",
|
|
22315
|
+
external_directory: "ask"
|
|
22316
|
+
};
|
|
22317
|
+
}
|
|
22318
|
+
return "allow";
|
|
22319
|
+
}
|
|
22320
|
+
var OpenCodePermissionProfile = class extends AgentPermissionProfile {
|
|
22321
|
+
description = "Controls the local side effects allowed for this Agent session.";
|
|
22322
|
+
values = adjustablePermissionValues;
|
|
22323
|
+
currentMode = (environment) => validateAdjustableMode(environment[PERMISSION_MODE_MARKER] ?? AGENT_DEFAULT_PERMISSION_MODE);
|
|
22324
|
+
apply = (environment, permissionMode) => {
|
|
22325
|
+
const validated = validateAdjustableMode(permissionMode);
|
|
22326
|
+
if (validated === AGENT_DEFAULT_PERMISSION_MODE) {
|
|
22327
|
+
return Object.freeze({ ...environment });
|
|
22328
|
+
}
|
|
22329
|
+
return Object.freeze({
|
|
22330
|
+
...environment,
|
|
22331
|
+
OPENCODE_CONFIG_CONTENT: JSON.stringify({
|
|
22332
|
+
...openCodeConfiguration(environment),
|
|
22333
|
+
permission: openCodePermission(validated)
|
|
22334
|
+
}),
|
|
22335
|
+
[PERMISSION_MODE_MARKER]: validated
|
|
22336
|
+
});
|
|
22337
|
+
};
|
|
22338
|
+
};
|
|
22339
|
+
var agentManagedPermissionProfile = new AgentManagedPermissionProfile();
|
|
22340
|
+
var deepSeekHarnessPermissionProfile = new DeepSeekHarnessPermissionProfile();
|
|
22341
|
+
var openCodePermissionProfile = new OpenCodePermissionProfile();
|
|
22342
|
+
var piPermissionProfile = new PiPermissionProfile();
|
|
22343
|
+
function permissionProfileForAgent(agentId) {
|
|
22344
|
+
if (agentId === "deepseek-harness") {
|
|
22345
|
+
return deepSeekHarnessPermissionProfile;
|
|
22346
|
+
}
|
|
22347
|
+
if (agentId === "opencode") {
|
|
22348
|
+
return openCodePermissionProfile;
|
|
22349
|
+
}
|
|
22350
|
+
if (agentId === "pi") {
|
|
22351
|
+
return piPermissionProfile;
|
|
22352
|
+
}
|
|
22353
|
+
return agentManagedPermissionProfile;
|
|
22354
|
+
}
|
|
22355
|
+
|
|
22106
22356
|
// src/agent-catalog/local-agent.ts
|
|
22107
22357
|
function readTrustedIdentity(path2) {
|
|
22108
22358
|
const resolvedPath = realpathSync(path2);
|
|
@@ -22116,7 +22366,7 @@ function readTrustedIdentity(path2) {
|
|
|
22116
22366
|
metadata.ctimeMs
|
|
22117
22367
|
);
|
|
22118
22368
|
}
|
|
22119
|
-
var LocalAgentDefinition = class {
|
|
22369
|
+
var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
22120
22370
|
adapterIdentity;
|
|
22121
22371
|
adapterPath;
|
|
22122
22372
|
adapterVersion;
|
|
@@ -22128,8 +22378,9 @@ var LocalAgentDefinition = class {
|
|
|
22128
22378
|
environment;
|
|
22129
22379
|
id;
|
|
22130
22380
|
label;
|
|
22381
|
+
permissionProfile;
|
|
22131
22382
|
promptTimeoutMilliseconds;
|
|
22132
|
-
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, promptTimeoutMilliseconds = 30 * 60 * 1e3, capabilities = unsupportedSessionCapabilities()) {
|
|
22383
|
+
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, promptTimeoutMilliseconds = 30 * 60 * 1e3, capabilities = unsupportedSessionCapabilities(), permissionProfile = permissionProfileForAgent(id)) {
|
|
22133
22384
|
if (!Number.isSafeInteger(promptTimeoutMilliseconds) || promptTimeoutMilliseconds < 1) {
|
|
22134
22385
|
throw new Error("The local Agent prompt deadline is invalid");
|
|
22135
22386
|
}
|
|
@@ -22141,11 +22392,31 @@ var LocalAgentDefinition = class {
|
|
|
22141
22392
|
this.capabilities = Object.freeze({ ...capabilities });
|
|
22142
22393
|
this.id = id;
|
|
22143
22394
|
this.label = label;
|
|
22395
|
+
this.permissionProfile = permissionProfile;
|
|
22144
22396
|
this.promptTimeoutMilliseconds = promptTimeoutMilliseconds;
|
|
22145
22397
|
this.command = adapterIdentity.realPath;
|
|
22146
22398
|
this.arguments = Object.freeze([...arguments_]);
|
|
22147
|
-
this.environment =
|
|
22399
|
+
this.environment = permissionProfile.apply(environment, permissionProfile.currentMode(environment));
|
|
22148
22400
|
}
|
|
22401
|
+
withPermissionMode = (permissionMode) => {
|
|
22402
|
+
if (permissionMode === AGENT_DEFAULT_PERMISSION_MODE && this.permissionProfile.currentMode(this.environment) === AGENT_DEFAULT_PERMISSION_MODE) {
|
|
22403
|
+
return this;
|
|
22404
|
+
}
|
|
22405
|
+
return new _LocalAgentDefinition(
|
|
22406
|
+
this.id,
|
|
22407
|
+
this.label,
|
|
22408
|
+
this.command,
|
|
22409
|
+
this.arguments,
|
|
22410
|
+
this.permissionProfile.apply(this.environment, permissionMode),
|
|
22411
|
+
this.adapterVersion,
|
|
22412
|
+
this.agentVersion,
|
|
22413
|
+
this.adapterIdentity,
|
|
22414
|
+
this.agentIdentity,
|
|
22415
|
+
this.promptTimeoutMilliseconds,
|
|
22416
|
+
this.capabilities,
|
|
22417
|
+
this.permissionProfile
|
|
22418
|
+
);
|
|
22419
|
+
};
|
|
22149
22420
|
};
|
|
22150
22421
|
var InstallableAgentDefinition = class {
|
|
22151
22422
|
id;
|
|
@@ -22430,6 +22701,55 @@ async function readAuthorizedRaster(uri, roots, signal) {
|
|
|
22430
22701
|
return new LocalRasterImage(basename(target) || "Image", mimeType, bytes);
|
|
22431
22702
|
}
|
|
22432
22703
|
|
|
22704
|
+
// src/authorization/local-video.ts
|
|
22705
|
+
import { basename as basename2 } from "node:path";
|
|
22706
|
+
var MAX_INLINE_VIDEO_BYTES = 3e6;
|
|
22707
|
+
var MP4_FILE_TYPE = new TextEncoder().encode("ftyp");
|
|
22708
|
+
var WEBM_SIGNATURE = Uint8Array.of(26, 69, 223, 163);
|
|
22709
|
+
var LocalVideo = class {
|
|
22710
|
+
bytes;
|
|
22711
|
+
mimeType;
|
|
22712
|
+
name;
|
|
22713
|
+
constructor(name, mimeType, bytes) {
|
|
22714
|
+
this.bytes = bytes;
|
|
22715
|
+
this.mimeType = mimeType;
|
|
22716
|
+
this.name = name;
|
|
22717
|
+
}
|
|
22718
|
+
base64 = () => Buffer.from(this.bytes).toString("base64");
|
|
22719
|
+
};
|
|
22720
|
+
function startsWith2(bytes, signature, offset = 0) {
|
|
22721
|
+
if (bytes.byteLength < offset + signature.byteLength) {
|
|
22722
|
+
return false;
|
|
22723
|
+
}
|
|
22724
|
+
return signature.every((value, index2) => bytes[offset + index2] === value);
|
|
22725
|
+
}
|
|
22726
|
+
function sniffVideoMime(bytes) {
|
|
22727
|
+
if (startsWith2(bytes, MP4_FILE_TYPE, 4)) {
|
|
22728
|
+
return "video/mp4";
|
|
22729
|
+
}
|
|
22730
|
+
if (startsWith2(bytes, WEBM_SIGNATURE)) {
|
|
22731
|
+
return "video/webm";
|
|
22732
|
+
}
|
|
22733
|
+
return null;
|
|
22734
|
+
}
|
|
22735
|
+
function readInlineVideo(data, declaredMimeType, name = "Video") {
|
|
22736
|
+
if (data.length === 0 || data.length > Math.ceil(MAX_INLINE_VIDEO_BYTES / 3) * 4 || data.length % 4 !== 0) {
|
|
22737
|
+
return null;
|
|
22738
|
+
}
|
|
22739
|
+
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(data)) {
|
|
22740
|
+
return null;
|
|
22741
|
+
}
|
|
22742
|
+
const bytes = new Uint8Array(Buffer.from(data, "base64"));
|
|
22743
|
+
if (bytes.byteLength < 1 || bytes.byteLength > MAX_INLINE_VIDEO_BYTES) {
|
|
22744
|
+
return null;
|
|
22745
|
+
}
|
|
22746
|
+
const mimeType = sniffVideoMime(bytes);
|
|
22747
|
+
if (mimeType === null || mimeType !== declaredMimeType) {
|
|
22748
|
+
return null;
|
|
22749
|
+
}
|
|
22750
|
+
return new LocalVideo(basename2(name) || "Video", mimeType, bytes);
|
|
22751
|
+
}
|
|
22752
|
+
|
|
22433
22753
|
// src/infra/operation-metrics.ts
|
|
22434
22754
|
var AccumulatingOperationMetrics = class {
|
|
22435
22755
|
#durations = /* @__PURE__ */ new Map();
|
|
@@ -22687,6 +23007,14 @@ function emptyDisplayContent(type) {
|
|
|
22687
23007
|
uri: ""
|
|
22688
23008
|
};
|
|
22689
23009
|
}
|
|
23010
|
+
function resourceName(uri) {
|
|
23011
|
+
try {
|
|
23012
|
+
const pathname = new URL(uri).pathname;
|
|
23013
|
+
return decodeURIComponent(pathname.slice(pathname.lastIndexOf("/") + 1));
|
|
23014
|
+
} catch {
|
|
23015
|
+
return "";
|
|
23016
|
+
}
|
|
23017
|
+
}
|
|
22690
23018
|
function imageDisplayContent(mimeType, name, data, artifactId = "", uri = "") {
|
|
22691
23019
|
return {
|
|
22692
23020
|
...emptyDisplayContent("image"),
|
|
@@ -22718,18 +23046,21 @@ function normalizeContentBlock(content3) {
|
|
|
22718
23046
|
};
|
|
22719
23047
|
}
|
|
22720
23048
|
if (content3.type === "resource") {
|
|
23049
|
+
const type = content3.resource.mimeType?.startsWith("video/") === true ? "video" : "resource";
|
|
22721
23050
|
if ("text" in content3.resource) {
|
|
22722
23051
|
return {
|
|
22723
|
-
...emptyDisplayContent(
|
|
23052
|
+
...emptyDisplayContent(type),
|
|
22724
23053
|
mimeType: content3.resource.mimeType ?? "",
|
|
23054
|
+
name: resourceName(content3.resource.uri),
|
|
22725
23055
|
text: content3.resource.text,
|
|
22726
23056
|
uri: content3.resource.uri
|
|
22727
23057
|
};
|
|
22728
23058
|
}
|
|
22729
23059
|
return {
|
|
22730
|
-
...emptyDisplayContent(
|
|
23060
|
+
...emptyDisplayContent(type),
|
|
22731
23061
|
data: content3.resource.blob,
|
|
22732
23062
|
mimeType: content3.resource.mimeType ?? "",
|
|
23063
|
+
name: resourceName(content3.resource.uri),
|
|
22733
23064
|
uri: content3.resource.uri
|
|
22734
23065
|
};
|
|
22735
23066
|
}
|
|
@@ -22762,6 +23093,36 @@ async function normalizeToolContent(content3, prepareContent) {
|
|
|
22762
23093
|
}
|
|
22763
23094
|
return normalized;
|
|
22764
23095
|
}
|
|
23096
|
+
function rawMcpToolContent(rawOutput) {
|
|
23097
|
+
if (!isRecord4(rawOutput)) {
|
|
23098
|
+
return [];
|
|
23099
|
+
}
|
|
23100
|
+
const result = isRecord4(rawOutput["result"]) ? rawOutput["result"] : rawOutput;
|
|
23101
|
+
const content3 = result["content"];
|
|
23102
|
+
if (!Array.isArray(content3)) {
|
|
23103
|
+
return [];
|
|
23104
|
+
}
|
|
23105
|
+
return content3.flatMap((item) => {
|
|
23106
|
+
if (!isRecord4(item) || item["type"] !== "image" || typeof item["data"] !== "string" || typeof item["mimeType"] !== "string") {
|
|
23107
|
+
return [];
|
|
23108
|
+
}
|
|
23109
|
+
const uri = item["uri"];
|
|
23110
|
+
return [
|
|
23111
|
+
{
|
|
23112
|
+
type: "content",
|
|
23113
|
+
content: {
|
|
23114
|
+
type: "image",
|
|
23115
|
+
data: item["data"],
|
|
23116
|
+
mimeType: item["mimeType"],
|
|
23117
|
+
...typeof uri === "string" ? { uri } : {}
|
|
23118
|
+
}
|
|
23119
|
+
}
|
|
23120
|
+
];
|
|
23121
|
+
});
|
|
23122
|
+
}
|
|
23123
|
+
function toolContent(content3, rawOutput) {
|
|
23124
|
+
return content3 !== void 0 && content3 !== null && content3.length > 0 ? content3 : rawMcpToolContent(rawOutput);
|
|
23125
|
+
}
|
|
22765
23126
|
function normalizeLocations(locations) {
|
|
22766
23127
|
const normalized = [];
|
|
22767
23128
|
const unique = /* @__PURE__ */ new Set();
|
|
@@ -22925,7 +23286,10 @@ var AcpActivityTracker = class {
|
|
|
22925
23286
|
const output2 = update.rawOutput === void 0 ? readContentOutput(update.content) : formatUnknown(update.rawOutput);
|
|
22926
23287
|
const detailInput = update.rawInput === void 0 ? "" : formatUnknownDetail(update.rawInput);
|
|
22927
23288
|
const detailOutput = update.rawOutput === void 0 ? readContentOutputDetail(update.content) : formatUnknownDetail(update.rawOutput);
|
|
22928
|
-
const detailContent = await normalizeToolContent(
|
|
23289
|
+
const detailContent = await normalizeToolContent(
|
|
23290
|
+
toolContent(update.content, update.rawOutput),
|
|
23291
|
+
this.#prepareContent
|
|
23292
|
+
);
|
|
22929
23293
|
await this.#record(
|
|
22930
23294
|
key,
|
|
22931
23295
|
new AcpActivity(
|
|
@@ -22951,10 +23315,11 @@ var AcpActivityTracker = class {
|
|
|
22951
23315
|
const identity2 = this.#identity(key);
|
|
22952
23316
|
const previousDetail = recordedDetail(previous2);
|
|
22953
23317
|
const output2 = update.rawOutput !== void 0 ? formatUnknown(update.rawOutput) : update.content !== void 0 && update.content !== null ? readContentOutput(update.content) : previous2?.output ?? "";
|
|
22954
|
-
const
|
|
23318
|
+
const nextContent = toolContent(update.content, update.rawOutput);
|
|
23319
|
+
const content3 = nextContent.length === 0 ? previous2?.content ?? [] : await normalizeToolContent(nextContent, this.#prepareContent);
|
|
22955
23320
|
const detailInput = update.rawInput === void 0 ? previousDetail?.input ?? previous2?.input ?? "" : formatUnknownDetail(update.rawInput);
|
|
22956
23321
|
const detailOutput = update.rawOutput !== void 0 ? formatUnknownDetail(update.rawOutput) : update.content !== void 0 && update.content !== null ? readContentOutputDetail(update.content) : previousDetail?.output ?? previous2?.output ?? "";
|
|
22957
|
-
const detailContent =
|
|
23322
|
+
const detailContent = nextContent.length === 0 ? previousDetail?.content ?? previous2?.content ?? [] : content3;
|
|
22958
23323
|
await this.#record(
|
|
22959
23324
|
key,
|
|
22960
23325
|
new AcpActivity(
|
|
@@ -30361,8 +30726,70 @@ function normalizeConfigOptions(value, modes) {
|
|
|
30361
30726
|
}
|
|
30362
30727
|
return normalized.slice(0, 100);
|
|
30363
30728
|
}
|
|
30729
|
+
function insertRequiredOption(current, required2, afterCategory = "") {
|
|
30730
|
+
if (current.some((option2) => option2.id === required2.id || option2.category === required2.category)) {
|
|
30731
|
+
return current;
|
|
30732
|
+
}
|
|
30733
|
+
if (current.length < MAXIMUM_CONFIG_OPTIONS) {
|
|
30734
|
+
if (afterCategory.length === 0) {
|
|
30735
|
+
return [required2, ...current];
|
|
30736
|
+
}
|
|
30737
|
+
const index3 = current.findIndex((option2) => option2.category === afterCategory);
|
|
30738
|
+
if (index3 < 0) {
|
|
30739
|
+
return [...current, required2];
|
|
30740
|
+
}
|
|
30741
|
+
return [...current.slice(0, index3 + 1), required2, ...current.slice(index3 + 1)];
|
|
30742
|
+
}
|
|
30743
|
+
if (afterCategory.length === 0) {
|
|
30744
|
+
return [required2, ...current.slice(0, MAXIMUM_CONFIG_OPTIONS - 1)];
|
|
30745
|
+
}
|
|
30746
|
+
const index2 = current.findIndex((option2) => option2.category === afterCategory);
|
|
30747
|
+
if (index2 < 0) {
|
|
30748
|
+
return [...current.slice(0, MAXIMUM_CONFIG_OPTIONS - 1), required2];
|
|
30749
|
+
}
|
|
30750
|
+
if (index2 < MAXIMUM_CONFIG_OPTIONS - 1) {
|
|
30751
|
+
return [...current.slice(0, index2 + 1), required2, ...current.slice(index2 + 1, MAXIMUM_CONFIG_OPTIONS - 1)];
|
|
30752
|
+
}
|
|
30753
|
+
const anchor2 = current[index2];
|
|
30754
|
+
if (anchor2 === void 0) {
|
|
30755
|
+
throw new SessionConfigProtocolError("The required Agent execution setting is unavailable");
|
|
30756
|
+
}
|
|
30757
|
+
return [...current.slice(0, MAXIMUM_CONFIG_OPTIONS - 2), anchor2, required2];
|
|
30758
|
+
}
|
|
30759
|
+
function validRequiredSelect(option2) {
|
|
30760
|
+
return option2.type === "select" && option2.currentValue.length > 0 && option2.values.some((value) => value.value === option2.currentValue);
|
|
30761
|
+
}
|
|
30762
|
+
function ensureModelOption(current) {
|
|
30763
|
+
const existing = current.find((option2) => option2.id === "model" || option2.category === "model");
|
|
30764
|
+
if (existing !== void 0 && validRequiredSelect(existing)) {
|
|
30765
|
+
return current;
|
|
30766
|
+
}
|
|
30767
|
+
const unavailable = {
|
|
30768
|
+
booleanValue: false,
|
|
30769
|
+
category: "model",
|
|
30770
|
+
currentValue: AGENT_DEFAULT_REASONING_EFFORT,
|
|
30771
|
+
description: "This Agent does not expose an adjustable model.",
|
|
30772
|
+
id: "model",
|
|
30773
|
+
name: "Model",
|
|
30774
|
+
type: "select",
|
|
30775
|
+
values: [
|
|
30776
|
+
{
|
|
30777
|
+
description: "Selected by the Agent",
|
|
30778
|
+
groupId: "",
|
|
30779
|
+
groupName: "",
|
|
30780
|
+
name: "Agent default",
|
|
30781
|
+
value: AGENT_DEFAULT_REASONING_EFFORT
|
|
30782
|
+
}
|
|
30783
|
+
]
|
|
30784
|
+
};
|
|
30785
|
+
return insertRequiredOption(
|
|
30786
|
+
current.filter((option2) => option2.id !== "model" && option2.category !== "model"),
|
|
30787
|
+
unavailable
|
|
30788
|
+
);
|
|
30789
|
+
}
|
|
30364
30790
|
function ensureReasoningEffortOption(current) {
|
|
30365
|
-
|
|
30791
|
+
const existing = current.find((option2) => option2.id === "reasoning_effort" || option2.category === "thought_level");
|
|
30792
|
+
if (existing !== void 0 && validRequiredSelect(existing)) {
|
|
30366
30793
|
return current;
|
|
30367
30794
|
}
|
|
30368
30795
|
const unavailable = {
|
|
@@ -30383,28 +30810,27 @@ function ensureReasoningEffortOption(current) {
|
|
|
30383
30810
|
}
|
|
30384
30811
|
]
|
|
30385
30812
|
};
|
|
30386
|
-
|
|
30387
|
-
|
|
30388
|
-
|
|
30389
|
-
|
|
30390
|
-
|
|
30391
|
-
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30397
|
-
|
|
30398
|
-
|
|
30399
|
-
|
|
30400
|
-
|
|
30401
|
-
|
|
30402
|
-
}
|
|
30403
|
-
const model = current[modelIndex];
|
|
30404
|
-
if (model === void 0) {
|
|
30405
|
-
return [...current.slice(0, MAXIMUM_CONFIG_OPTIONS - 1), unavailable];
|
|
30813
|
+
return insertRequiredOption(
|
|
30814
|
+
current.filter((option2) => option2.id !== "reasoning_effort" && option2.category !== "thought_level"),
|
|
30815
|
+
unavailable,
|
|
30816
|
+
"model"
|
|
30817
|
+
);
|
|
30818
|
+
}
|
|
30819
|
+
function ensureRequiredExecutionOptions(current, permission) {
|
|
30820
|
+
const normalized = ensureReasoningEffortOption(ensureModelOption(current));
|
|
30821
|
+
const model = normalized.find(
|
|
30822
|
+
(option2) => (option2.id === "model" || option2.category === "model") && validRequiredSelect(option2)
|
|
30823
|
+
);
|
|
30824
|
+
const reasoningEffort = normalized.find(
|
|
30825
|
+
(option2) => (option2.id === "reasoning_effort" || option2.category === "thought_level") && validRequiredSelect(option2)
|
|
30826
|
+
);
|
|
30827
|
+
if (model === void 0 || reasoningEffort === void 0) {
|
|
30828
|
+
throw new SessionConfigProtocolError("The required Agent execution settings are unavailable");
|
|
30406
30829
|
}
|
|
30407
|
-
|
|
30830
|
+
const optional2 = normalized.filter(
|
|
30831
|
+
(option2) => option2.id !== permission.id && option2.category !== permission.category && option2.id !== "model" && option2.category !== "model" && option2.id !== "reasoning_effort" && option2.category !== "thought_level"
|
|
30832
|
+
);
|
|
30833
|
+
return [permission, model, reasoningEffort, ...optional2].slice(0, MAXIMUM_CONFIG_OPTIONS);
|
|
30408
30834
|
}
|
|
30409
30835
|
function normalizeStandardLifecycle(response) {
|
|
30410
30836
|
const lifecycle = isRecord5(response) ? response : {};
|
|
@@ -30924,7 +31350,7 @@ var MAX_PRE_SESSION_UPDATES = 100;
|
|
|
30924
31350
|
var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
|
|
30925
31351
|
var SESSION_CONTROL_COMMAND_ID = "session-control";
|
|
30926
31352
|
var NullAcpSessionObserver = class {
|
|
30927
|
-
|
|
31353
|
+
importLocalArtifact = (_sessionId, _artifact, signal) => {
|
|
30928
31354
|
signal.throwIfAborted();
|
|
30929
31355
|
return Promise.resolve("");
|
|
30930
31356
|
};
|
|
@@ -31479,6 +31905,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31479
31905
|
#preSessionUpdates = [];
|
|
31480
31906
|
#processExit;
|
|
31481
31907
|
#metrics;
|
|
31908
|
+
#permissionProfile;
|
|
31482
31909
|
#sessionConfigProtocol;
|
|
31483
31910
|
#store;
|
|
31484
31911
|
#verifiedAgentVersion;
|
|
@@ -31520,6 +31947,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31520
31947
|
this.#getObserver = getObserver;
|
|
31521
31948
|
this.#mobiusSessionId = mobiusSessionId;
|
|
31522
31949
|
this.#metrics = metrics;
|
|
31950
|
+
this.#permissionProfile = agent.permissionProfile;
|
|
31523
31951
|
this.#sessionConfigProtocol = sessionConfigProtocolForAgent(agent.id);
|
|
31524
31952
|
this.#store = store;
|
|
31525
31953
|
this.#verifiedAgentVersion = agent.agentVersion;
|
|
@@ -31691,6 +32119,13 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31691
32119
|
return await this.importRaster(raster, signal);
|
|
31692
32120
|
}
|
|
31693
32121
|
}
|
|
32122
|
+
if (content3.type === "video" && content3.data.length > 0) {
|
|
32123
|
+
const video = readInlineVideo(content3.data, content3.mimeType, content3.name);
|
|
32124
|
+
if (video === null) {
|
|
32125
|
+
return { ...content3, data: "" };
|
|
32126
|
+
}
|
|
32127
|
+
return await this.importVideo(video, AbortSignal.timeout(2e4));
|
|
32128
|
+
}
|
|
31694
32129
|
return content3;
|
|
31695
32130
|
};
|
|
31696
32131
|
emitAgentContent = async (content3, messageId) => {
|
|
@@ -31716,7 +32151,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31716
32151
|
});
|
|
31717
32152
|
};
|
|
31718
32153
|
importRaster = async (raster, signal) => {
|
|
31719
|
-
const artifactId = await this.#getObserver().
|
|
32154
|
+
const artifactId = await this.#getObserver().importLocalArtifact(this.#mobiusSessionId, raster, signal);
|
|
31720
32155
|
return imageDisplayContent(
|
|
31721
32156
|
raster.mimeType,
|
|
31722
32157
|
raster.name,
|
|
@@ -31724,6 +32159,22 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31724
32159
|
artifactId
|
|
31725
32160
|
);
|
|
31726
32161
|
};
|
|
32162
|
+
importVideo = async (video, signal) => {
|
|
32163
|
+
const artifactId = await this.#getObserver().importLocalArtifact(this.#mobiusSessionId, video, signal);
|
|
32164
|
+
return {
|
|
32165
|
+
artifactId,
|
|
32166
|
+
data: artifactId.length > 0 ? "" : video.base64(),
|
|
32167
|
+
mimeType: video.mimeType,
|
|
32168
|
+
name: video.name,
|
|
32169
|
+
newText: "",
|
|
32170
|
+
oldText: "",
|
|
32171
|
+
path: "",
|
|
32172
|
+
terminalId: "",
|
|
32173
|
+
text: "",
|
|
32174
|
+
type: "video",
|
|
32175
|
+
uri: ""
|
|
32176
|
+
};
|
|
32177
|
+
};
|
|
31727
32178
|
async #initializeAgent(signal) {
|
|
31728
32179
|
await this.#metrics.measure("agent-initialize", async () => await this.#initializeAgentOperation(signal));
|
|
31729
32180
|
}
|
|
@@ -31929,7 +32380,10 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
31929
32380
|
this.selectNativeSession(created.sessionId);
|
|
31930
32381
|
lifecycleResponse = created;
|
|
31931
32382
|
}
|
|
31932
|
-
this.#configOptions =
|
|
32383
|
+
this.#configOptions = ensureRequiredExecutionOptions(
|
|
32384
|
+
this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse),
|
|
32385
|
+
this.#permissionProfile.option(this.#environment)
|
|
32386
|
+
);
|
|
31933
32387
|
await this.#updateTail;
|
|
31934
32388
|
signal.throwIfAborted();
|
|
31935
32389
|
if (this.#prompted) {
|
|
@@ -32032,7 +32486,10 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32032
32486
|
);
|
|
32033
32487
|
await this.#updateTail;
|
|
32034
32488
|
if (this.#configRevision === configRevision) {
|
|
32035
|
-
this.#configOptions =
|
|
32489
|
+
this.#configOptions = ensureRequiredExecutionOptions(
|
|
32490
|
+
configured,
|
|
32491
|
+
this.#permissionProfile.option(this.#environment)
|
|
32492
|
+
);
|
|
32036
32493
|
}
|
|
32037
32494
|
} catch (error62) {
|
|
32038
32495
|
if (error62 instanceof SessionConfigProtocolError) {
|
|
@@ -32505,9 +32962,9 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
32505
32962
|
return;
|
|
32506
32963
|
}
|
|
32507
32964
|
if (update.sessionUpdate === "config_option_update") {
|
|
32508
|
-
this.#configOptions =
|
|
32509
|
-
this.#configOptions,
|
|
32510
|
-
|
|
32965
|
+
this.#configOptions = ensureRequiredExecutionOptions(
|
|
32966
|
+
this.#sessionConfigProtocol.normalizeUpdate(this.#configOptions, update.configOptions),
|
|
32967
|
+
this.#permissionProfile.option(this.#environment)
|
|
32511
32968
|
);
|
|
32512
32969
|
this.#configRevision += 1;
|
|
32513
32970
|
await this.emitConfigUpdate();
|
|
@@ -33045,6 +33502,9 @@ var AcpSessionManager = class {
|
|
|
33045
33502
|
);
|
|
33046
33503
|
try {
|
|
33047
33504
|
for (const desired of desiredConfigOptions) {
|
|
33505
|
+
if (desired.id === PERMISSION_MODE_CONFIG_ID) {
|
|
33506
|
+
continue;
|
|
33507
|
+
}
|
|
33048
33508
|
const current = runtime.prepared().configOptions.find((option2) => option2.id === desired.id);
|
|
33049
33509
|
if (current === void 0 || current.type !== desired.type) {
|
|
33050
33510
|
continue;
|
|
@@ -33237,6 +33697,30 @@ var AcpSessionManager = class {
|
|
|
33237
33697
|
this.#beginSessionUse(options.sessionId);
|
|
33238
33698
|
try {
|
|
33239
33699
|
const runtime = await this.ensureSession(options);
|
|
33700
|
+
if (options.configId === PERMISSION_MODE_CONFIG_ID) {
|
|
33701
|
+
const permission = runtime.prepared().configOptions.find((candidate) => candidate.id === PERMISSION_MODE_CONFIG_ID);
|
|
33702
|
+
if (permission === void 0 || permission.type !== "select" || options.valueType !== "select" || permission.values.length < 2 || !permission.values.some((value) => value.value === options.value)) {
|
|
33703
|
+
throw new AcpExecutionError(
|
|
33704
|
+
"The requested Agent permission mode is unavailable",
|
|
33705
|
+
{},
|
|
33706
|
+
"invalid_session_configuration"
|
|
33707
|
+
);
|
|
33708
|
+
}
|
|
33709
|
+
if (permission.currentValue === options.value) {
|
|
33710
|
+
return runtime.prepared().configOptions;
|
|
33711
|
+
}
|
|
33712
|
+
try {
|
|
33713
|
+
return (await this.prepareExecutionSession({
|
|
33714
|
+
...options,
|
|
33715
|
+
agent: options.agent.withPermissionMode(options.value)
|
|
33716
|
+
})).configOptions;
|
|
33717
|
+
} catch (error62) {
|
|
33718
|
+
if (error62 instanceof AgentPermissionConfigurationError) {
|
|
33719
|
+
throw new AcpExecutionError(error62.message, { cause: error62 }, error62.code);
|
|
33720
|
+
}
|
|
33721
|
+
throw error62;
|
|
33722
|
+
}
|
|
33723
|
+
}
|
|
33240
33724
|
return await runtime.configure(options);
|
|
33241
33725
|
} finally {
|
|
33242
33726
|
this.#endSessionUse(options.sessionId);
|
|
@@ -33730,7 +34214,7 @@ var AuditStore = class {
|
|
|
33730
34214
|
this.database.exec("ALTER TABLE audit_events ADD COLUMN details_json TEXT NOT NULL DEFAULT '{}'");
|
|
33731
34215
|
}
|
|
33732
34216
|
}
|
|
33733
|
-
record(
|
|
34217
|
+
record(record4) {
|
|
33734
34218
|
this.database.prepare(
|
|
33735
34219
|
`
|
|
33736
34220
|
INSERT INTO audit_events (
|
|
@@ -33743,10 +34227,10 @@ var AuditStore = class {
|
|
|
33743
34227
|
`
|
|
33744
34228
|
).run(
|
|
33745
34229
|
(/* @__PURE__ */ new Date()).toISOString(),
|
|
33746
|
-
|
|
33747
|
-
|
|
33748
|
-
|
|
33749
|
-
JSON.stringify(
|
|
34230
|
+
record4.event,
|
|
34231
|
+
record4.commandId,
|
|
34232
|
+
record4.sessionId,
|
|
34233
|
+
JSON.stringify(record4.details ?? {})
|
|
33750
34234
|
);
|
|
33751
34235
|
}
|
|
33752
34236
|
close() {
|
|
@@ -33788,12 +34272,13 @@ var LocalBotGrant = class {
|
|
|
33788
34272
|
bindingRevision;
|
|
33789
34273
|
botId;
|
|
33790
34274
|
expiresAt;
|
|
34275
|
+
executionConfiguration;
|
|
33791
34276
|
localGrantId;
|
|
33792
34277
|
revocationEpoch;
|
|
33793
34278
|
workspaceIdentityDigest;
|
|
33794
34279
|
workspacePath;
|
|
33795
34280
|
workspaceRef;
|
|
33796
|
-
constructor(localGrantId, botId, behaviorRevisionId, behaviorDigest, bindingId, bindingRevision, agent, agentIdentityDigest, workspaceRef, workspacePath, workspaceIdentityDigest, allowedDeliveryTargetIds, expiresAt, revocationEpoch) {
|
|
34281
|
+
constructor(localGrantId, botId, behaviorRevisionId, behaviorDigest, bindingId, bindingRevision, agent, agentIdentityDigest, workspaceRef, workspacePath, workspaceIdentityDigest, allowedDeliveryTargetIds, executionConfiguration, expiresAt, revocationEpoch) {
|
|
33797
34282
|
this.localGrantId = localGrantId;
|
|
33798
34283
|
this.botId = botId;
|
|
33799
34284
|
this.behaviorRevisionId = behaviorRevisionId;
|
|
@@ -33806,6 +34291,7 @@ var LocalBotGrant = class {
|
|
|
33806
34291
|
this.workspacePath = workspacePath;
|
|
33807
34292
|
this.workspaceIdentityDigest = workspaceIdentityDigest;
|
|
33808
34293
|
this.allowedDeliveryTargetIds = Object.freeze([...allowedDeliveryTargetIds]);
|
|
34294
|
+
this.executionConfiguration = executionConfiguration;
|
|
33809
34295
|
this.expiresAt = expiresAt;
|
|
33810
34296
|
this.revocationEpoch = revocationEpoch;
|
|
33811
34297
|
}
|
|
@@ -33824,6 +34310,16 @@ function agentDigest(agent) {
|
|
|
33824
34310
|
})
|
|
33825
34311
|
);
|
|
33826
34312
|
}
|
|
34313
|
+
function configurePermission(agent, permissionMode) {
|
|
34314
|
+
try {
|
|
34315
|
+
return agent.withPermissionMode(permissionMode);
|
|
34316
|
+
} catch (cause) {
|
|
34317
|
+
if (cause instanceof AgentPermissionConfigurationError) {
|
|
34318
|
+
throw new LocalBotAuthorizationError("binding_incompatible", cause.message, { cause });
|
|
34319
|
+
}
|
|
34320
|
+
throw cause;
|
|
34321
|
+
}
|
|
34322
|
+
}
|
|
33827
34323
|
function workspaceDigest(path2) {
|
|
33828
34324
|
return digest(path2);
|
|
33829
34325
|
}
|
|
@@ -33845,6 +34341,9 @@ function exactSessionConfigurations(left, right) {
|
|
|
33845
34341
|
return approved !== void 0 && approved.booleanValue === selection.booleanValue && approved.value === selection.value && approved.valueType === selection.valueType;
|
|
33846
34342
|
});
|
|
33847
34343
|
}
|
|
34344
|
+
function exactExecutionConfiguration(left, right) {
|
|
34345
|
+
return left.permissionMode === right.permissionMode && exactSessionConfigurations([left.model, left.reasoningEffort], [right.model, right.reasoningEffort]);
|
|
34346
|
+
}
|
|
33848
34347
|
function rowString(row, key) {
|
|
33849
34348
|
const value = Reflect.get(row, key);
|
|
33850
34349
|
if (typeof value !== "string") {
|
|
@@ -33890,6 +34389,15 @@ function parseSessionConfigurations(encoded) {
|
|
|
33890
34389
|
throw new LocalBotAuthorizationError("local_grant_invalid", "The local Bot grant is invalid", { cause });
|
|
33891
34390
|
}
|
|
33892
34391
|
}
|
|
34392
|
+
function parseExecutionConfiguration(encoded) {
|
|
34393
|
+
let value;
|
|
34394
|
+
try {
|
|
34395
|
+
value = JSON.parse(encoded);
|
|
34396
|
+
return decodeAgentExecutionConfiguration(value);
|
|
34397
|
+
} catch (cause) {
|
|
34398
|
+
throw new LocalBotAuthorizationError("local_grant_invalid", "The local Bot grant is invalid", { cause });
|
|
34399
|
+
}
|
|
34400
|
+
}
|
|
33893
34401
|
var LocalBotGrantStore = class {
|
|
33894
34402
|
#database;
|
|
33895
34403
|
constructor(path2) {
|
|
@@ -33927,6 +34435,10 @@ var LocalBotGrantStore = class {
|
|
|
33927
34435
|
local_grant_id TEXT PRIMARY KEY,
|
|
33928
34436
|
session_configurations_json TEXT NOT NULL
|
|
33929
34437
|
) STRICT;
|
|
34438
|
+
CREATE TABLE IF NOT EXISTS local_bot_grant_execution_configurations (
|
|
34439
|
+
local_grant_id TEXT PRIMARY KEY,
|
|
34440
|
+
execution_configuration_json TEXT NOT NULL
|
|
34441
|
+
) STRICT;
|
|
33930
34442
|
`);
|
|
33931
34443
|
}
|
|
33932
34444
|
approve = async (request, catalog, directories, bindingAuthorityId, now, signal) => {
|
|
@@ -33985,6 +34497,11 @@ var LocalBotGrantStore = class {
|
|
|
33985
34497
|
local_grant_id, session_configurations_json
|
|
33986
34498
|
) VALUES (?, ?)`
|
|
33987
34499
|
).run(localGrantId, JSON.stringify(request.sessionConfigurations));
|
|
34500
|
+
this.#database.prepare(
|
|
34501
|
+
`INSERT INTO local_bot_grant_execution_configurations (
|
|
34502
|
+
local_grant_id, execution_configuration_json
|
|
34503
|
+
) VALUES (?, ?)`
|
|
34504
|
+
).run(localGrantId, JSON.stringify(request.executionConfiguration));
|
|
33988
34505
|
this.#database.prepare(
|
|
33989
34506
|
`INSERT INTO local_bot_binding_resolutions (
|
|
33990
34507
|
request_id, binding_id, local_grant_id, resolved_at, result
|
|
@@ -34011,15 +34528,20 @@ var LocalBotGrantStore = class {
|
|
|
34011
34528
|
signal.throwIfAborted();
|
|
34012
34529
|
const row = this.#database.prepare(
|
|
34013
34530
|
`SELECT grants.*, COALESCE(configurations.session_configurations_json, '[]')
|
|
34014
|
-
AS session_configurations_json
|
|
34531
|
+
AS session_configurations_json,
|
|
34532
|
+
COALESCE(execution.execution_configuration_json, ?)
|
|
34533
|
+
AS execution_configuration_json
|
|
34015
34534
|
FROM local_bot_grants AS grants
|
|
34016
34535
|
LEFT JOIN local_bot_grant_configurations AS configurations
|
|
34017
34536
|
ON configurations.local_grant_id = grants.local_grant_id
|
|
34537
|
+
LEFT JOIN local_bot_grant_execution_configurations AS execution
|
|
34538
|
+
ON execution.local_grant_id = grants.local_grant_id
|
|
34018
34539
|
WHERE grants.local_grant_id = ? AND grants.bot_id = ?
|
|
34019
34540
|
AND behavior_revision_id = ? AND behavior_digest = ?
|
|
34020
34541
|
AND binding_id = ? AND binding_revision = ?
|
|
34021
34542
|
AND agent_ref = ?`
|
|
34022
34543
|
).get(
|
|
34544
|
+
JSON.stringify(DEFAULT_AGENT_EXECUTION_CONFIGURATION),
|
|
34023
34545
|
command.localGrantId,
|
|
34024
34546
|
command.botId,
|
|
34025
34547
|
command.behaviorRevisionId,
|
|
@@ -34049,7 +34571,16 @@ var LocalBotGrantStore = class {
|
|
|
34049
34571
|
"The Bot Agent configuration differs from its binding"
|
|
34050
34572
|
);
|
|
34051
34573
|
}
|
|
34052
|
-
const
|
|
34574
|
+
const approvedExecutionConfiguration = parseExecutionConfiguration(
|
|
34575
|
+
rowString(row, "execution_configuration_json")
|
|
34576
|
+
);
|
|
34577
|
+
if (!exactExecutionConfiguration(approvedExecutionConfiguration, command.executionConfiguration)) {
|
|
34578
|
+
throw new LocalBotAuthorizationError(
|
|
34579
|
+
"binding_not_approved",
|
|
34580
|
+
"The Bot execution configuration differs from its binding"
|
|
34581
|
+
);
|
|
34582
|
+
}
|
|
34583
|
+
const agent = configurePermission(catalog.find(command.agentId), command.executionConfiguration.permissionMode);
|
|
34053
34584
|
const [adapterUnchanged, agentUnchanged] = await Promise.all([
|
|
34054
34585
|
revalidateExecutable(agent.adapterIdentity),
|
|
34055
34586
|
revalidateExecutable(agent.agentIdentity)
|
|
@@ -34098,6 +34629,7 @@ var LocalBotGrantStore = class {
|
|
|
34098
34629
|
workspacePath,
|
|
34099
34630
|
currentWorkspaceDigest,
|
|
34100
34631
|
approvedTargets,
|
|
34632
|
+
approvedExecutionConfiguration,
|
|
34101
34633
|
expiresAt,
|
|
34102
34634
|
revocationEpoch
|
|
34103
34635
|
);
|
|
@@ -34114,7 +34646,10 @@ var LocalBotGrantStore = class {
|
|
|
34114
34646
|
this.#database.close();
|
|
34115
34647
|
};
|
|
34116
34648
|
resolveProposal = async (request, catalog, directories, bindingAuthorityId, signal) => {
|
|
34117
|
-
const agent =
|
|
34649
|
+
const agent = configurePermission(
|
|
34650
|
+
catalog.find(request.agentRef),
|
|
34651
|
+
request.executionConfiguration.permissionMode
|
|
34652
|
+
);
|
|
34118
34653
|
if (request.requiredCapabilities.includes("embedded-context") && !agent.capabilities.embeddedContextPrompt) {
|
|
34119
34654
|
throw new LocalBotAuthorizationError(
|
|
34120
34655
|
"binding_incompatible",
|
|
@@ -34700,7 +35235,7 @@ var BotOutboundIpcServer = class {
|
|
|
34700
35235
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
34701
35236
|
import { mkdir as mkdir4, open as open4, realpath as realpath7, rename as rename3, stat as stat6, writeFile as writeFile2 } from "node:fs/promises";
|
|
34702
35237
|
import { hostname as hostname3 } from "node:os";
|
|
34703
|
-
import { basename as
|
|
35238
|
+
import { basename as basename3, join as join15, resolve as resolve3 } from "node:path";
|
|
34704
35239
|
import { fetch as fetch3 } from "undici";
|
|
34705
35240
|
|
|
34706
35241
|
// src/agent-catalog/agent-discovery.ts
|
|
@@ -35330,7 +35865,7 @@ var CopilotCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35330
35865
|
};
|
|
35331
35866
|
|
|
35332
35867
|
// src/agent-catalog/agents/cursor-cli-agent.ts
|
|
35333
|
-
var CURSOR_CLI_TESTED_VERSION = "2026.09.
|
|
35868
|
+
var CURSOR_CLI_TESTED_VERSION = "2026.09.15-d2fe57e";
|
|
35334
35869
|
var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
35335
35870
|
adapterVersion = CURSOR_CLI_TESTED_VERSION;
|
|
35336
35871
|
authenticationCommand = () => "cursor-agent login";
|
|
@@ -35346,7 +35881,7 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35346
35881
|
}
|
|
35347
35882
|
verifyAcp = async (connection, initialized, defaultWorkspace, signal) => {
|
|
35348
35883
|
const capabilities = initialized.agentCapabilities ?? {};
|
|
35349
|
-
if (capabilities.loadSession !== true || capabilities.sessionCapabilities?.list == null
|
|
35884
|
+
if (capabilities.loadSession !== true || capabilities.sessionCapabilities?.list == null) {
|
|
35350
35885
|
throw new AgentProbeError("acp_incompatible", "Cursor CLI reported an unsupported ACP capability set");
|
|
35351
35886
|
}
|
|
35352
35887
|
await verifySessionCreation(connection, capabilities, defaultWorkspace, signal, this.label);
|
|
@@ -35429,11 +35964,10 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35429
35964
|
context.signal.throwIfAborted();
|
|
35430
35965
|
}
|
|
35431
35966
|
if (selectedHome === void 0 || selectedHome.length === 0) {
|
|
35432
|
-
return Object.freeze({
|
|
35967
|
+
return Object.freeze({});
|
|
35433
35968
|
}
|
|
35434
35969
|
return Object.freeze({
|
|
35435
|
-
DSH_HOME: await validateAgentHome(selectedHome)
|
|
35436
|
-
DSH_PERMISSION_MODE: "workspace-write"
|
|
35970
|
+
DSH_HOME: await validateAgentHome(selectedHome)
|
|
35437
35971
|
});
|
|
35438
35972
|
};
|
|
35439
35973
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
@@ -35940,7 +36474,14 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35940
36474
|
]
|
|
35941
36475
|
);
|
|
35942
36476
|
}
|
|
35943
|
-
createLaunchEnvironment = async (_agent,
|
|
36477
|
+
createLaunchEnvironment = async (_agent, context) => {
|
|
36478
|
+
const environment = { OPENCODE_DISABLE_AUTOUPDATE: "1" };
|
|
36479
|
+
const inlineConfiguration = context.environment["OPENCODE_CONFIG_CONTENT"];
|
|
36480
|
+
if (typeof inlineConfiguration === "string" && inlineConfiguration.length > 0) {
|
|
36481
|
+
environment["OPENCODE_CONFIG_CONTENT"] = inlineConfiguration;
|
|
36482
|
+
}
|
|
36483
|
+
return Object.freeze(environment);
|
|
36484
|
+
};
|
|
35944
36485
|
resolveManagedAgent = async (stateDirectory, platform, signal) => await validateManagedAgentArchive(
|
|
35945
36486
|
join10(stateDirectory, "agents", this.id, OPENCODE_MANAGED_VERSION),
|
|
35946
36487
|
openCodeManagedArchive(platform, process.arch),
|
|
@@ -36877,7 +37418,7 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
|
|
|
36877
37418
|
installableAgents,
|
|
36878
37419
|
machineName: hostname3(),
|
|
36879
37420
|
pairingCode: options.code,
|
|
36880
|
-
workspaceName:
|
|
37421
|
+
workspaceName: basename3(defaultWorkspace) || "Local workspace"
|
|
36881
37422
|
}),
|
|
36882
37423
|
dispatcher: environmentProxyDispatcher,
|
|
36883
37424
|
headers: { "content-type": "application/json" },
|
|
@@ -37048,7 +37589,7 @@ async function resumeLocalMachine(arguments_, signal = new AbortController().sig
|
|
|
37048
37589
|
|
|
37049
37590
|
// src/run-daemon.ts
|
|
37050
37591
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
37051
|
-
import { basename as
|
|
37592
|
+
import { basename as basename6, join as join17 } from "node:path";
|
|
37052
37593
|
import { styleText } from "node:util";
|
|
37053
37594
|
import { fetch as fetch7, WebSocket as WebSocket2 } from "undici";
|
|
37054
37595
|
|
|
@@ -37624,7 +38165,7 @@ function invalidResponse(message) {
|
|
|
37624
38165
|
function isRecord12(value) {
|
|
37625
38166
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37626
38167
|
}
|
|
37627
|
-
function
|
|
38168
|
+
function record3(value, name) {
|
|
37628
38169
|
if (!isRecord12(value)) {
|
|
37629
38170
|
throw invalidResponse(`The service returned an invalid ${name}`);
|
|
37630
38171
|
}
|
|
@@ -37759,11 +38300,11 @@ function uploadingArtifact(value) {
|
|
|
37759
38300
|
);
|
|
37760
38301
|
}
|
|
37761
38302
|
function decodeMobiusArtifactUpload(value) {
|
|
37762
|
-
const artifact =
|
|
38303
|
+
const artifact = record3(value, "artifact upload authorization");
|
|
37763
38304
|
return new MobiusArtifactUpload(uploadingArtifact(artifact), stringField(artifact, "uploadToken", 256));
|
|
37764
38305
|
}
|
|
37765
38306
|
function decodeMobiusArtifact(value) {
|
|
37766
|
-
const artifact =
|
|
38307
|
+
const artifact = record3(value, "artifact");
|
|
37767
38308
|
const state = stringField(artifact, "state", 32);
|
|
37768
38309
|
if (state === "uploading") {
|
|
37769
38310
|
return uploadingArtifact(artifact);
|
|
@@ -37911,15 +38452,15 @@ async function putContent(url2, authorization, bytes, signal) {
|
|
|
37911
38452
|
signal
|
|
37912
38453
|
});
|
|
37913
38454
|
}
|
|
37914
|
-
async function uploadRuntimeArtifact(config2, sessionId,
|
|
38455
|
+
async function uploadRuntimeArtifact(config2, sessionId, artifact, signal) {
|
|
37915
38456
|
signal.throwIfAborted();
|
|
37916
38457
|
let request;
|
|
37917
38458
|
try {
|
|
37918
38459
|
request = new MobiusArtifactUploadRequest(
|
|
37919
|
-
|
|
37920
|
-
|
|
37921
|
-
|
|
37922
|
-
createHash3("sha256").update(
|
|
38460
|
+
artifact.name,
|
|
38461
|
+
artifact.mimeType,
|
|
38462
|
+
artifact.bytes.byteLength,
|
|
38463
|
+
createHash3("sha256").update(artifact.bytes).digest("hex")
|
|
37923
38464
|
);
|
|
37924
38465
|
} catch (cause) {
|
|
37925
38466
|
translateSdkError(cause);
|
|
@@ -37958,7 +38499,7 @@ async function uploadRuntimeArtifact(config2, sessionId, image, signal) {
|
|
|
37958
38499
|
token
|
|
37959
38500
|
),
|
|
37960
38501
|
authorization,
|
|
37961
|
-
|
|
38502
|
+
artifact.bytes,
|
|
37962
38503
|
requestSignal
|
|
37963
38504
|
);
|
|
37964
38505
|
} catch (cause) {
|
|
@@ -37990,7 +38531,7 @@ async function uploadRuntimeArtifact(config2, sessionId, image, signal) {
|
|
|
37990
38531
|
// src/authorization/workspace-directory.ts
|
|
37991
38532
|
import { readdir as readdir2, realpath as realpath8, stat as stat7 } from "node:fs/promises";
|
|
37992
38533
|
import { homedir as homedir2 } from "node:os";
|
|
37993
|
-
import { basename as
|
|
38534
|
+
import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute10, join as join16, normalize as normalize3, relative as relative5 } from "node:path";
|
|
37994
38535
|
var WorkspaceDirectoryListing = class {
|
|
37995
38536
|
directoryId;
|
|
37996
38537
|
directoryLabel;
|
|
@@ -38082,7 +38623,7 @@ var WorkspaceDirectoryService = class {
|
|
|
38082
38623
|
return {
|
|
38083
38624
|
path: path2,
|
|
38084
38625
|
directoryId: encodePath(path2),
|
|
38085
|
-
name:
|
|
38626
|
+
name: basename4(path2) || path2,
|
|
38086
38627
|
label: this.label(path2)
|
|
38087
38628
|
};
|
|
38088
38629
|
};
|
|
@@ -38176,7 +38717,7 @@ var EmbeddedBotContextApplicator = class {
|
|
|
38176
38717
|
|
|
38177
38718
|
// src/native-sessions/service.ts
|
|
38178
38719
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
38179
|
-
import { basename as
|
|
38720
|
+
import { basename as basename5 } from "node:path";
|
|
38180
38721
|
|
|
38181
38722
|
// src/native-sessions/codex-history.ts
|
|
38182
38723
|
import { spawn as spawn4 } from "node:child_process";
|
|
@@ -38685,7 +39226,7 @@ var NativeSessionService = class {
|
|
|
38685
39226
|
}
|
|
38686
39227
|
resolvedPaths.add(path2);
|
|
38687
39228
|
additionalDirectories.push(path2);
|
|
38688
|
-
additionalEntries.push({ directoryId: directoryId2, name:
|
|
39229
|
+
additionalEntries.push({ directoryId: directoryId2, name: basename5(path2) });
|
|
38689
39230
|
}
|
|
38690
39231
|
const listing = await this.#directories.list(this.#config.bindingId, command.directoryId, signal);
|
|
38691
39232
|
const opened = await this.#sessions.forkSessionAtTurn(
|
|
@@ -40003,13 +40544,13 @@ function botIpcSocketPath() {
|
|
|
40003
40544
|
var DaemonAcpObserver = class {
|
|
40004
40545
|
#config;
|
|
40005
40546
|
#record;
|
|
40006
|
-
constructor(config2,
|
|
40547
|
+
constructor(config2, record4) {
|
|
40007
40548
|
this.#config = config2;
|
|
40008
|
-
this.#record =
|
|
40549
|
+
this.#record = record4;
|
|
40009
40550
|
}
|
|
40010
|
-
|
|
40551
|
+
importLocalArtifact = async (sessionId, artifact, signal) => {
|
|
40011
40552
|
try {
|
|
40012
|
-
return (await uploadRuntimeArtifact(this.#config, sessionId,
|
|
40553
|
+
return (await uploadRuntimeArtifact(this.#config, sessionId, artifact, signal)).artifactId;
|
|
40013
40554
|
} catch (cause) {
|
|
40014
40555
|
signal.throwIfAborted();
|
|
40015
40556
|
if (cause instanceof Error && cause.name === "AbortError") {
|
|
@@ -40580,7 +41121,7 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
40580
41121
|
additionalDirectories.push(directory);
|
|
40581
41122
|
additionalDirectoryEntries.push({
|
|
40582
41123
|
directoryId: additionalDirectoryId,
|
|
40583
|
-
name:
|
|
41124
|
+
name: basename6(directory)
|
|
40584
41125
|
});
|
|
40585
41126
|
}
|
|
40586
41127
|
return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
|
|
@@ -40915,9 +41456,55 @@ function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
|
40915
41456
|
agent.adapterIdentity,
|
|
40916
41457
|
agent.agentIdentity,
|
|
40917
41458
|
agent.promptTimeoutMilliseconds,
|
|
40918
|
-
agent.capabilities
|
|
41459
|
+
agent.capabilities,
|
|
41460
|
+
agent.permissionProfile
|
|
40919
41461
|
);
|
|
40920
41462
|
}
|
|
41463
|
+
function assertPreparedPermission(configOptions, permissionMode) {
|
|
41464
|
+
const permission = configOptions.find((option2) => option2.id === "permission_mode");
|
|
41465
|
+
if (permission === void 0 || permission.type !== "select" || permissionMode !== AGENT_DEFAULT_EXECUTION_SETTING && permission.currentValue !== permissionMode) {
|
|
41466
|
+
throw new AcpExecutionError(
|
|
41467
|
+
"The required Agent permission mode is unavailable",
|
|
41468
|
+
{},
|
|
41469
|
+
"invalid_session_configuration"
|
|
41470
|
+
);
|
|
41471
|
+
}
|
|
41472
|
+
}
|
|
41473
|
+
async function applyRequiredExecutionSelection(sessions, configOptions, selection, category, agent, cwd, additionalDirectories, sessionId, signal) {
|
|
41474
|
+
const option2 = configOptions.find((candidate) => candidate.id === selection.configId);
|
|
41475
|
+
if (option2 === void 0 || option2.type !== "select" || option2.category !== category || selection.valueType !== "select" || selection.booleanValue) {
|
|
41476
|
+
throw new AcpExecutionError(
|
|
41477
|
+
`The required Agent setting ${selection.configId} is unavailable`,
|
|
41478
|
+
{},
|
|
41479
|
+
"invalid_session_configuration"
|
|
41480
|
+
);
|
|
41481
|
+
}
|
|
41482
|
+
if (selection.value === AGENT_DEFAULT_EXECUTION_SETTING) {
|
|
41483
|
+
return configOptions;
|
|
41484
|
+
}
|
|
41485
|
+
if (!option2.values.some((value) => value.value === selection.value)) {
|
|
41486
|
+
throw new AcpExecutionError(
|
|
41487
|
+
`The required Agent setting ${selection.configId} is unavailable`,
|
|
41488
|
+
{},
|
|
41489
|
+
"invalid_session_configuration"
|
|
41490
|
+
);
|
|
41491
|
+
}
|
|
41492
|
+
if (option2.currentValue === selection.value) {
|
|
41493
|
+
return configOptions;
|
|
41494
|
+
}
|
|
41495
|
+
return await sessions.configureSession({
|
|
41496
|
+
additionalDirectories,
|
|
41497
|
+
agent,
|
|
41498
|
+
booleanValue: false,
|
|
41499
|
+
configId: selection.configId,
|
|
41500
|
+
cwd,
|
|
41501
|
+
requestId: `cfg_${randomUUID6()}`,
|
|
41502
|
+
sessionId,
|
|
41503
|
+
signal,
|
|
41504
|
+
value: selection.value,
|
|
41505
|
+
valueType: "select"
|
|
41506
|
+
});
|
|
41507
|
+
}
|
|
40921
41508
|
async function executeBotPrompt(outbox, publisher, command, config2, directories, audit, sessions, grants, contexts, applicator, ipc, attemptId, activateAttempt, timer, signal) {
|
|
40922
41509
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity) => {
|
|
40923
41510
|
publisher.recordAttempt(command.sessionId, encodeDaemonActivity(command, activity), attemptId);
|
|
@@ -41018,13 +41605,36 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
41018
41605
|
const lease = contexts.activate(command);
|
|
41019
41606
|
try {
|
|
41020
41607
|
const agent = botExecutionAgent(grant.agent, lease.context.contextHandle, ipc.socketPath);
|
|
41021
|
-
await sessions.prepareExecutionSession({
|
|
41608
|
+
const prepared = await sessions.prepareExecutionSession({
|
|
41022
41609
|
additionalDirectories: resolved.additionalDirectories,
|
|
41023
41610
|
agent,
|
|
41024
41611
|
cwd: resolved.cwd,
|
|
41025
41612
|
sessionId: command.sessionId,
|
|
41026
41613
|
signal: executionSignal
|
|
41027
41614
|
});
|
|
41615
|
+
assertPreparedPermission(prepared.configOptions, grant.executionConfiguration.permissionMode);
|
|
41616
|
+
let configOptions = await applyRequiredExecutionSelection(
|
|
41617
|
+
sessions,
|
|
41618
|
+
prepared.configOptions,
|
|
41619
|
+
grant.executionConfiguration.model,
|
|
41620
|
+
"model",
|
|
41621
|
+
agent,
|
|
41622
|
+
resolved.cwd,
|
|
41623
|
+
resolved.additionalDirectories,
|
|
41624
|
+
command.sessionId,
|
|
41625
|
+
executionSignal
|
|
41626
|
+
);
|
|
41627
|
+
configOptions = await applyRequiredExecutionSelection(
|
|
41628
|
+
sessions,
|
|
41629
|
+
configOptions,
|
|
41630
|
+
grant.executionConfiguration.reasoningEffort,
|
|
41631
|
+
"thought_level",
|
|
41632
|
+
agent,
|
|
41633
|
+
resolved.cwd,
|
|
41634
|
+
resolved.additionalDirectories,
|
|
41635
|
+
command.sessionId,
|
|
41636
|
+
executionSignal
|
|
41637
|
+
);
|
|
41028
41638
|
for (const selection of command.sessionConfigurations) {
|
|
41029
41639
|
await sessions.configureSession({
|
|
41030
41640
|
additionalDirectories: resolved.additionalDirectories,
|
|
@@ -42272,7 +42882,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
42272
42882
|
import { mkdir as mkdir5, realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
42273
42883
|
import { dirname as dirname8, join as join18, resolve as resolve5 } from "node:path";
|
|
42274
42884
|
var IDENTIFIER_PATTERN9 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
42275
|
-
var RUNTIME_CREDENTIAL_PATTERN = /^[a-zA-Z0-9_-]{
|
|
42885
|
+
var RUNTIME_CREDENTIAL_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
42276
42886
|
var MobiusRuntimeConfigurationError = class extends Error {
|
|
42277
42887
|
code = "runtime_configuration_invalid";
|
|
42278
42888
|
constructor(message, options = {}) {
|