@ai-development-environment/control-agent 0.0.61 → 0.0.63
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/control-agent.js +81 -32
- package/package.json +1 -1
package/dist/control-agent.js
CHANGED
|
@@ -5062,7 +5062,7 @@ var RUN_COMMAND_FIELDS = `
|
|
|
5062
5062
|
run {
|
|
5063
5063
|
id kind displayNumber status phase origin provider worktreeId agentId
|
|
5064
5064
|
worktree { id folder branch }
|
|
5065
|
-
model effort webSearchEnabled initialPrompt finalOutput
|
|
5065
|
+
model effort webSearchEnabled mcpToolNames initialPrompt finalOutput
|
|
5066
5066
|
inputs { id sequence kind prompt attachments { id filename contentType size sha256 downloadPath } }
|
|
5067
5067
|
attempts { id generation nativeId status }
|
|
5068
5068
|
sourcePlan { id provider attempts { id generation nativeId status } }
|
|
@@ -5093,6 +5093,16 @@ var AgentGraphQLClient = class {
|
|
|
5093
5093
|
this.requestTimeoutMs = requestTimeoutMs;
|
|
5094
5094
|
this.headers = { ...headers };
|
|
5095
5095
|
}
|
|
5096
|
+
mcpServerDescriptor(runId) {
|
|
5097
|
+
if (!this.credential) return null;
|
|
5098
|
+
return {
|
|
5099
|
+
name: "ai-development-environment",
|
|
5100
|
+
url: `${this.server}/api/mcp?run=${encodeURIComponent(runId)}`,
|
|
5101
|
+
headers: mergeHeaders(this.headers, {
|
|
5102
|
+
authorization: `Bearer ${this.credential}`
|
|
5103
|
+
})
|
|
5104
|
+
};
|
|
5105
|
+
}
|
|
5096
5106
|
async request(query, variables) {
|
|
5097
5107
|
const response = await fetch(`${this.server}/api/graphql`, {
|
|
5098
5108
|
method: "POST",
|
|
@@ -42490,6 +42500,15 @@ function claudeEnvironment() {
|
|
|
42490
42500
|
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS: "1"
|
|
42491
42501
|
};
|
|
42492
42502
|
}
|
|
42503
|
+
function claudeMcpServers(server) {
|
|
42504
|
+
return server ? {
|
|
42505
|
+
[server.name]: {
|
|
42506
|
+
type: "http",
|
|
42507
|
+
url: server.url,
|
|
42508
|
+
headers: server.headers
|
|
42509
|
+
}
|
|
42510
|
+
} : void 0;
|
|
42511
|
+
}
|
|
42493
42512
|
function claudeModelUsages(record, fallbackModel) {
|
|
42494
42513
|
const toolCallCount = Number(record.num_turns ?? 0);
|
|
42495
42514
|
const entries = Object.entries(asRecord(record.modelUsage)).filter(
|
|
@@ -42589,6 +42608,7 @@ var ClaudeAdapter = class {
|
|
|
42589
42608
|
includePartialMessages: true,
|
|
42590
42609
|
env: claudeEnvironment(),
|
|
42591
42610
|
disallowedTools: input.run.webSearchEnabled ? [] : ["WebSearch"],
|
|
42611
|
+
...input.mcpServer ? { mcpServers: claudeMcpServers(input.mcpServer) } : {},
|
|
42592
42612
|
canUseTool: async (toolName, toolInput, options) => {
|
|
42593
42613
|
if (toolName !== "AskUserQuestion") {
|
|
42594
42614
|
return { behavior: "allow", updatedInput: toolInput };
|
|
@@ -42766,6 +42786,19 @@ function supportedCodexVersion(version) {
|
|
|
42766
42786
|
)
|
|
42767
42787
|
);
|
|
42768
42788
|
}
|
|
42789
|
+
function codexRunConfig(input) {
|
|
42790
|
+
return {
|
|
42791
|
+
web_search: input.run.webSearchEnabled ? "live" : "disabled",
|
|
42792
|
+
...input.mcpServer ? {
|
|
42793
|
+
mcp_servers: {
|
|
42794
|
+
[input.mcpServer.name]: {
|
|
42795
|
+
url: input.mcpServer.url,
|
|
42796
|
+
http_headers: input.mcpServer.headers
|
|
42797
|
+
}
|
|
42798
|
+
}
|
|
42799
|
+
} : {}
|
|
42800
|
+
};
|
|
42801
|
+
}
|
|
42769
42802
|
function codexTokenUsage(value, model2) {
|
|
42770
42803
|
const total = asRecord(value);
|
|
42771
42804
|
const inputTokens = Number(total.inputTokens ?? total.input_tokens ?? 0);
|
|
@@ -43066,18 +43099,14 @@ var CodexAdapter = class {
|
|
|
43066
43099
|
model: input.run.model === "default" ? null : input.run.model,
|
|
43067
43100
|
approvalPolicy: "never",
|
|
43068
43101
|
sandbox,
|
|
43069
|
-
config:
|
|
43070
|
-
web_search: input.run.webSearchEnabled ? "live" : "disabled"
|
|
43071
|
-
}
|
|
43102
|
+
config: codexRunConfig(input)
|
|
43072
43103
|
}
|
|
43073
43104
|
) : await this.server.request("thread/start", {
|
|
43074
43105
|
cwd,
|
|
43075
43106
|
model: input.run.model === "default" ? null : input.run.model,
|
|
43076
43107
|
approvalPolicy: "never",
|
|
43077
43108
|
sandbox,
|
|
43078
|
-
config:
|
|
43079
|
-
web_search: input.run.webSearchEnabled ? "live" : "disabled"
|
|
43080
|
-
},
|
|
43109
|
+
config: codexRunConfig(input),
|
|
43081
43110
|
ephemeral: false,
|
|
43082
43111
|
experimentalRawEvents: false
|
|
43083
43112
|
})
|
|
@@ -49007,33 +49036,51 @@ var OpenCodeAdapter = class {
|
|
|
49007
49036
|
};
|
|
49008
49037
|
}
|
|
49009
49038
|
async start(input, callbacks) {
|
|
49010
|
-
const
|
|
49039
|
+
const isolatedRuntime = input.mcpServer ? await createOpencode({
|
|
49040
|
+
port: 0,
|
|
49041
|
+
config: {
|
|
49042
|
+
mcp: {
|
|
49043
|
+
[input.mcpServer.name]: {
|
|
49044
|
+
type: "remote",
|
|
49045
|
+
url: input.mcpServer.url,
|
|
49046
|
+
headers: input.mcpServer.headers,
|
|
49047
|
+
oauth: false
|
|
49048
|
+
}
|
|
49049
|
+
}
|
|
49050
|
+
}
|
|
49051
|
+
}) : void 0;
|
|
49052
|
+
const client2 = isolatedRuntime?.client ?? await this.client();
|
|
49011
49053
|
const cwd = input.run.worktree.folder;
|
|
49012
49054
|
let nativeId;
|
|
49013
|
-
|
|
49014
|
-
|
|
49015
|
-
|
|
49016
|
-
|
|
49017
|
-
|
|
49018
|
-
|
|
49019
|
-
|
|
49020
|
-
|
|
49021
|
-
|
|
49022
|
-
|
|
49023
|
-
|
|
49024
|
-
|
|
49025
|
-
|
|
49026
|
-
|
|
49027
|
-
|
|
49028
|
-
|
|
49029
|
-
|
|
49030
|
-
|
|
49031
|
-
|
|
49032
|
-
|
|
49033
|
-
|
|
49034
|
-
|
|
49055
|
+
try {
|
|
49056
|
+
if (input.resumeNativeId && input.fork !== false) {
|
|
49057
|
+
const forked = resultData(
|
|
49058
|
+
await client2.session.fork({
|
|
49059
|
+
sessionID: input.resumeNativeId,
|
|
49060
|
+
directory: cwd
|
|
49061
|
+
})
|
|
49062
|
+
);
|
|
49063
|
+
nativeId = String(asRecord(forked).id);
|
|
49064
|
+
} else if (input.resumeNativeId) {
|
|
49065
|
+
nativeId = input.resumeNativeId;
|
|
49066
|
+
} else {
|
|
49067
|
+
const created = resultData(
|
|
49068
|
+
await client2.session.create({
|
|
49069
|
+
directory: cwd,
|
|
49070
|
+
agent: input.run.kind === "PLAN" ? "plan" : "build",
|
|
49071
|
+
permission: input.run.kind === "SESSION" ? [{ permission: "*", pattern: "*", action: "allow" }] : void 0
|
|
49072
|
+
})
|
|
49073
|
+
);
|
|
49074
|
+
nativeId = String(asRecord(created).id);
|
|
49075
|
+
}
|
|
49076
|
+
if (!nativeId || nativeId === "undefined") {
|
|
49077
|
+
throw new Error("OpenCode did not return a session ID");
|
|
49078
|
+
}
|
|
49079
|
+
await callbacks.onNativeId(nativeId, "1.18.4");
|
|
49080
|
+
} catch (error) {
|
|
49081
|
+
isolatedRuntime?.server.close();
|
|
49082
|
+
throw error;
|
|
49035
49083
|
}
|
|
49036
|
-
await callbacks.onNativeId(nativeId, "1.18.4");
|
|
49037
49084
|
let stopReason = null;
|
|
49038
49085
|
const streamController = new AbortController();
|
|
49039
49086
|
const questionSurfaces = /* @__PURE__ */ new Map();
|
|
@@ -49213,6 +49260,7 @@ var OpenCodeAdapter = class {
|
|
|
49213
49260
|
legacyQuestionReconciliationTask,
|
|
49214
49261
|
v2QuestionReconciliationTask
|
|
49215
49262
|
]);
|
|
49263
|
+
isolatedRuntime?.server.close();
|
|
49216
49264
|
}
|
|
49217
49265
|
})();
|
|
49218
49266
|
return {
|
|
@@ -49651,7 +49699,8 @@ var RunManager = class {
|
|
|
49651
49699
|
prompt: initialInput.prompt,
|
|
49652
49700
|
attachments,
|
|
49653
49701
|
resumeNativeId: resumeNativeId || void 0,
|
|
49654
|
-
fork: command3.type !== "CONTINUE"
|
|
49702
|
+
fork: command3.type !== "CONTINUE",
|
|
49703
|
+
mcpServer: run.mcpToolNames?.length ? this.client.mcpServerDescriptor(run.id) ?? void 0 : void 0
|
|
49655
49704
|
},
|
|
49656
49705
|
callbacks
|
|
49657
49706
|
);
|