@slopus/happy-providers 0.0.47 → 0.0.48
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/core/ProviderModelCompatibility.d.ts +2 -2
- package/dist/core/ProviderModelCompatibility.d.ts.map +1 -1
- package/dist/core/ProviderModelCompatibility.js +8 -2
- package/dist/core/ProviderModelCompatibility.js.map +1 -1
- package/dist/core/SessionProviderError.d.ts +12 -0
- package/dist/core/SessionProviderError.d.ts.map +1 -1
- package/dist/core/SessionProviderError.js +2 -0
- package/dist/core/SessionProviderError.js.map +1 -1
- package/dist/core/SessionRunRequest.d.ts +6 -0
- package/dist/core/SessionRunRequest.d.ts.map +1 -1
- package/dist/core/isNetworkFailure.d.ts +8 -0
- package/dist/core/isNetworkFailure.d.ts.map +1 -0
- package/dist/core/isNetworkFailure.js +45 -0
- package/dist/core/isNetworkFailure.js.map +1 -0
- package/dist/core/providerModelFamily.d.ts.map +1 -1
- package/dist/core/providerModelFamily.js +4 -0
- package/dist/core/providerModelFamily.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/protocol/acp/AcpConnection.d.ts +41 -0
- package/dist/protocol/acp/AcpConnection.d.ts.map +1 -0
- package/dist/protocol/acp/AcpConnection.js +2 -0
- package/dist/protocol/acp/AcpConnection.js.map +1 -0
- package/dist/protocol/acp/AcpProvider.d.ts +86 -0
- package/dist/protocol/acp/AcpProvider.d.ts.map +1 -0
- package/dist/protocol/acp/AcpProvider.js +27 -0
- package/dist/protocol/acp/AcpProvider.js.map +1 -0
- package/dist/protocol/acp/AcpSession.d.ts +26 -0
- package/dist/protocol/acp/AcpSession.d.ts.map +1 -0
- package/dist/protocol/acp/AcpSession.js +676 -0
- package/dist/protocol/acp/AcpSession.js.map +1 -0
- package/dist/protocol/acp/acpDiscoverModels.d.ts +10 -0
- package/dist/protocol/acp/acpDiscoverModels.d.ts.map +1 -0
- package/dist/protocol/acp/acpDiscoverModels.js +34 -0
- package/dist/protocol/acp/acpDiscoverModels.js.map +1 -0
- package/dist/protocol/acp/impl/AcpToolBridgeServer.d.ts +37 -0
- package/dist/protocol/acp/impl/AcpToolBridgeServer.d.ts.map +1 -0
- package/dist/protocol/acp/impl/AcpToolBridgeServer.js +136 -0
- package/dist/protocol/acp/impl/AcpToolBridgeServer.js.map +1 -0
- package/dist/protocol/acp/impl/AcpTurnQueue.d.ts +10 -0
- package/dist/protocol/acp/impl/AcpTurnQueue.d.ts.map +1 -0
- package/dist/protocol/acp/impl/AcpTurnQueue.js +26 -0
- package/dist/protocol/acp/impl/AcpTurnQueue.js.map +1 -0
- package/dist/protocol/acp/impl/acpCompactWithAgent.d.ts +10 -0
- package/dist/protocol/acp/impl/acpCompactWithAgent.d.ts.map +1 -0
- package/dist/protocol/acp/impl/acpCompactWithAgent.js +69 -0
- package/dist/protocol/acp/impl/acpCompactWithAgent.js.map +1 -0
- package/dist/protocol/acp/impl/acpConfigOptions.d.ts +22 -0
- package/dist/protocol/acp/impl/acpConfigOptions.d.ts.map +1 -0
- package/dist/protocol/acp/impl/acpConfigOptions.js +37 -0
- package/dist/protocol/acp/impl/acpConfigOptions.js.map +1 -0
- package/dist/protocol/acp/impl/acpConnectionSpawn.d.ts +9 -0
- package/dist/protocol/acp/impl/acpConnectionSpawn.d.ts.map +1 -0
- package/dist/protocol/acp/impl/acpConnectionSpawn.js +64 -0
- package/dist/protocol/acp/impl/acpConnectionSpawn.js.map +1 -0
- package/dist/protocol/acp/impl/acpPromptFromMessages.d.ts +22 -0
- package/dist/protocol/acp/impl/acpPromptFromMessages.d.ts.map +1 -0
- package/dist/protocol/acp/impl/acpPromptFromMessages.js +139 -0
- package/dist/protocol/acp/impl/acpPromptFromMessages.js.map +1 -0
- package/dist/protocol/acp/impl/acpResponseEvents.d.ts +20 -0
- package/dist/protocol/acp/impl/acpResponseEvents.d.ts.map +1 -0
- package/dist/protocol/acp/impl/acpResponseEvents.js +183 -0
- package/dist/protocol/acp/impl/acpResponseEvents.js.map +1 -0
- package/dist/protocol/acp/impl/acpSessionStore.d.ts +25 -0
- package/dist/protocol/acp/impl/acpSessionStore.d.ts.map +1 -0
- package/dist/protocol/acp/impl/acpSessionStore.js +50 -0
- package/dist/protocol/acp/impl/acpSessionStore.js.map +1 -0
- package/dist/protocol/acp/impl/processTree.d.ts +11 -0
- package/dist/protocol/acp/impl/processTree.d.ts.map +1 -0
- package/dist/protocol/acp/impl/processTree.js +80 -0
- package/dist/protocol/acp/impl/processTree.js.map +1 -0
- package/dist/vendors/bedrock/errors/anthropicBedrockErrors.d.ts.map +1 -1
- package/dist/vendors/bedrock/errors/anthropicBedrockErrors.js +6 -3
- package/dist/vendors/bedrock/errors/anthropicBedrockErrors.js.map +1 -1
- package/dist/vendors/claude/impl/auth.d.ts +3 -1
- package/dist/vendors/claude/impl/auth.d.ts.map +1 -1
- package/dist/vendors/claude/impl/auth.js +9 -6
- package/dist/vendors/claude/impl/auth.js.map +1 -1
- package/dist/vendors/claudeAgent/claudeAgentConnect.d.ts +10 -0
- package/dist/vendors/claudeAgent/claudeAgentConnect.d.ts.map +1 -0
- package/dist/vendors/claudeAgent/claudeAgentConnect.js +347 -0
- package/dist/vendors/claudeAgent/claudeAgentConnect.js.map +1 -0
- package/dist/vendors/claudeAgent/impl/AsyncInputQueue.d.ts +8 -0
- package/dist/vendors/claudeAgent/impl/AsyncInputQueue.d.ts.map +1 -0
- package/dist/vendors/claudeAgent/impl/AsyncInputQueue.js +37 -0
- package/dist/vendors/claudeAgent/impl/AsyncInputQueue.js.map +1 -0
- package/dist/vendors/claudeAgent/impl/claudeAgentUpdates.d.ts +12 -0
- package/dist/vendors/claudeAgent/impl/claudeAgentUpdates.d.ts.map +1 -0
- package/dist/vendors/claudeAgent/impl/claudeAgentUpdates.js +126 -0
- package/dist/vendors/claudeAgent/impl/claudeAgentUpdates.js.map +1 -0
- package/dist/vendors/codex/errors/codexErrors.d.ts.map +1 -1
- package/dist/vendors/codex/errors/codexErrors.js +8 -4
- package/dist/vendors/codex/errors/codexErrors.js.map +1 -1
- package/dist/vendors/codexAppServer/codexAppServerConnect.d.ts +11 -0
- package/dist/vendors/codexAppServer/codexAppServerConnect.d.ts.map +1 -0
- package/dist/vendors/codexAppServer/codexAppServerConnect.js +409 -0
- package/dist/vendors/codexAppServer/codexAppServerConnect.js.map +1 -0
- package/dist/vendors/codexAppServer/impl/codexItemUpdates.d.ts +10 -0
- package/dist/vendors/codexAppServer/impl/codexItemUpdates.d.ts.map +1 -0
- package/dist/vendors/codexAppServer/impl/codexItemUpdates.js +113 -0
- package/dist/vendors/codexAppServer/impl/codexItemUpdates.js.map +1 -0
- package/dist/vendors/codexAppServer/resolveCodexExecutable.d.ts +10 -0
- package/dist/vendors/codexAppServer/resolveCodexExecutable.d.ts.map +1 -0
- package/dist/vendors/codexAppServer/resolveCodexExecutable.js +61 -0
- package/dist/vendors/codexAppServer/resolveCodexExecutable.js.map +1 -0
- package/dist/vendors/foreignAgents/ForeignAgent.d.ts +74 -0
- package/dist/vendors/foreignAgents/ForeignAgent.d.ts.map +1 -0
- package/dist/vendors/foreignAgents/ForeignAgent.js +54 -0
- package/dist/vendors/foreignAgents/ForeignAgent.js.map +1 -0
- package/dist/vendors/foreignAgents/acpGenericAgent.d.ts +11 -0
- package/dist/vendors/foreignAgents/acpGenericAgent.d.ts.map +1 -0
- package/dist/vendors/foreignAgents/acpGenericAgent.js +33 -0
- package/dist/vendors/foreignAgents/acpGenericAgent.js.map +1 -0
- package/dist/vendors/foreignAgents/antigravityAgent.d.ts +11 -0
- package/dist/vendors/foreignAgents/antigravityAgent.d.ts.map +1 -0
- package/dist/vendors/foreignAgents/antigravityAgent.js +104 -0
- package/dist/vendors/foreignAgents/antigravityAgent.js.map +1 -0
- package/dist/vendors/foreignAgents/claudeCodeAgent.d.ts +8 -0
- package/dist/vendors/foreignAgents/claudeCodeAgent.d.ts.map +1 -0
- package/dist/vendors/foreignAgents/claudeCodeAgent.js +71 -0
- package/dist/vendors/foreignAgents/claudeCodeAgent.js.map +1 -0
- package/dist/vendors/foreignAgents/codexCliAgent.d.ts +10 -0
- package/dist/vendors/foreignAgents/codexCliAgent.d.ts.map +1 -0
- package/dist/vendors/foreignAgents/codexCliAgent.js +68 -0
- package/dist/vendors/foreignAgents/codexCliAgent.js.map +1 -0
- package/dist/vendors/foreignAgents/foreignAgents.d.ts +6 -0
- package/dist/vendors/foreignAgents/foreignAgents.d.ts.map +1 -0
- package/dist/vendors/foreignAgents/foreignAgents.js +17 -0
- package/dist/vendors/foreignAgents/foreignAgents.js.map +1 -0
- package/dist/vendors/foreignAgents/opencodeAgent.d.ts +8 -0
- package/dist/vendors/foreignAgents/opencodeAgent.d.ts.map +1 -0
- package/dist/vendors/foreignAgents/opencodeAgent.js +28 -0
- package/dist/vendors/foreignAgents/opencodeAgent.js.map +1 -0
- package/dist/vendors/grok/errors/grokErrors.d.ts.map +1 -1
- package/dist/vendors/grok/errors/grokErrors.js +6 -3
- package/dist/vendors/grok/errors/grokErrors.js.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translate `codex app-server` notifications for one thread into ACP session updates: streamed
|
|
3
|
+
* message and reasoning text, and each command, file change, MCP call and web search as a tool
|
|
4
|
+
* call that settles when Codex completes the item.
|
|
5
|
+
*/
|
|
6
|
+
export function codexItemUpdates() {
|
|
7
|
+
return {
|
|
8
|
+
translate(method, params) {
|
|
9
|
+
if (method === "item/agentMessage/delta") {
|
|
10
|
+
return [chunk("agent_message_chunk", params["delta"])];
|
|
11
|
+
}
|
|
12
|
+
if (method === "item/reasoning/summaryTextDelta" ||
|
|
13
|
+
method === "item/reasoning/textDelta") {
|
|
14
|
+
return [chunk("agent_thought_chunk", params["delta"])];
|
|
15
|
+
}
|
|
16
|
+
if (method === "item/started")
|
|
17
|
+
return started(params["item"]);
|
|
18
|
+
if (method === "item/completed")
|
|
19
|
+
return completed(params["item"]);
|
|
20
|
+
return [];
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function chunk(sessionUpdate, delta) {
|
|
25
|
+
return {
|
|
26
|
+
sessionUpdate,
|
|
27
|
+
content: { type: "text", text: typeof delta === "string" ? delta : "" },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function started(item) {
|
|
31
|
+
const call = toolCall(item);
|
|
32
|
+
return call === undefined
|
|
33
|
+
? []
|
|
34
|
+
: [{ sessionUpdate: "tool_call", status: "in_progress", ...call }];
|
|
35
|
+
}
|
|
36
|
+
function completed(item) {
|
|
37
|
+
const call = toolCall(item);
|
|
38
|
+
if (call === undefined)
|
|
39
|
+
return [];
|
|
40
|
+
const status = String(item["status"] ?? "completed");
|
|
41
|
+
const failed = status === "failed" || status === "declined" || item["error"] != null;
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
sessionUpdate: "tool_call_update",
|
|
45
|
+
...call,
|
|
46
|
+
status: failed ? "failed" : "completed",
|
|
47
|
+
content: [{ type: "content", content: { type: "text", text: resultText(item) } }],
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
function toolCall(item) {
|
|
52
|
+
switch (item.type) {
|
|
53
|
+
case "commandExecution":
|
|
54
|
+
return {
|
|
55
|
+
toolCallId: item.id,
|
|
56
|
+
title: String(item["command"] ?? "command"),
|
|
57
|
+
kind: "execute",
|
|
58
|
+
rawInput: { command: item["command"], cwd: item["cwd"] },
|
|
59
|
+
};
|
|
60
|
+
case "fileChange": {
|
|
61
|
+
const changes = (item["changes"] ?? []);
|
|
62
|
+
return {
|
|
63
|
+
toolCallId: item.id,
|
|
64
|
+
title: `Edit ${changes.map((change) => change.path).join(", ")}`,
|
|
65
|
+
kind: "edit",
|
|
66
|
+
rawInput: { changes },
|
|
67
|
+
locations: changes.map((change) => ({ path: change.path })),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
case "mcpToolCall":
|
|
71
|
+
// `mcp__<server>__<tool>` marks Happy's own bridged tools so they are not recorded twice.
|
|
72
|
+
return {
|
|
73
|
+
toolCallId: item.id,
|
|
74
|
+
title: `mcp__${String(item["server"])}__${String(item["tool"])}`,
|
|
75
|
+
kind: "other",
|
|
76
|
+
rawInput: {
|
|
77
|
+
server: item["server"],
|
|
78
|
+
tool: item["tool"],
|
|
79
|
+
arguments: item["arguments"],
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
case "webSearch":
|
|
83
|
+
return {
|
|
84
|
+
toolCallId: item.id,
|
|
85
|
+
title: `Search ${String(item["query"] ?? "the web")}`,
|
|
86
|
+
kind: "fetch",
|
|
87
|
+
rawInput: { query: item["query"] },
|
|
88
|
+
};
|
|
89
|
+
case "dynamicToolCall":
|
|
90
|
+
case "collabAgentToolCall":
|
|
91
|
+
return {
|
|
92
|
+
toolCallId: item.id,
|
|
93
|
+
title: String(item["tool"] ?? item.type),
|
|
94
|
+
kind: "think",
|
|
95
|
+
rawInput: { arguments: item["arguments"] ?? item["prompt"] },
|
|
96
|
+
};
|
|
97
|
+
default:
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function resultText(item) {
|
|
102
|
+
if (typeof item["aggregatedOutput"] === "string")
|
|
103
|
+
return item["aggregatedOutput"];
|
|
104
|
+
const result = item["result"];
|
|
105
|
+
if (result?.content !== undefined) {
|
|
106
|
+
return result.content
|
|
107
|
+
.map((part) => (part.type === "text" ? (part.text ?? "") : ""))
|
|
108
|
+
.join("");
|
|
109
|
+
}
|
|
110
|
+
const error = item["error"];
|
|
111
|
+
return error?.message ?? "";
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=codexItemUpdates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codexItemUpdates.js","sourceRoot":"","sources":["../../../../sources/vendors/codexAppServer/impl/codexItemUpdates.ts"],"names":[],"m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C;AAED,SAAS,UAAU,CAAC,IAAU;IAC1B,IAAI,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAClF,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAA2D,CAAC;IACxF,IAAI,MAAM,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,OAAO;aAChB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC9D,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAgC,CAAC;IAC3D,OAAO,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AcpAgentLaunch } from "../../protocol/acp/AcpProvider.js";
|
|
2
|
+
/** The release Happy is tested against, fetched with `npx` only when nothing else is installed. */
|
|
3
|
+
export declare const CODEX_PINNED_VERSION = "0.160.1";
|
|
4
|
+
/**
|
|
5
|
+
* How to start `codex app-server`: the pinned release installed with this package, then a `codex`
|
|
6
|
+
* on PATH, then the pinned release through `npx`. The pinned binary is started directly with its
|
|
7
|
+
* bundled tools on PATH, as Codex's own launcher does.
|
|
8
|
+
*/
|
|
9
|
+
export declare function codexAppServerLaunch(env?: NodeJS.ProcessEnv): AcpAgentLaunch;
|
|
10
|
+
//# sourceMappingURL=resolveCodexExecutable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveCodexExecutable.d.ts","sourceRoot":"","sources":["../../../sources/vendors/codexAppServer/resolveCodexExecutable.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAIpE,mGAAmG;AACnG,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAW9C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAe,GAAG,cAAc,CAiBhF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { delimiter, dirname, join } from "node:path";
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
/** The release Happy is tested against, fetched with `npx` only when nothing else is installed. */
|
|
6
|
+
export const CODEX_PINNED_VERSION = "0.160.1";
|
|
7
|
+
const TARGETS = {
|
|
8
|
+
"darwin-arm64": ["aarch64-apple-darwin", "@openai/codex-darwin-arm64"],
|
|
9
|
+
"darwin-x64": ["x86_64-apple-darwin", "@openai/codex-darwin-x64"],
|
|
10
|
+
"linux-arm64": ["aarch64-unknown-linux-musl", "@openai/codex-linux-arm64"],
|
|
11
|
+
"linux-x64": ["x86_64-unknown-linux-musl", "@openai/codex-linux-x64"],
|
|
12
|
+
"win32-arm64": ["aarch64-pc-windows-msvc", "@openai/codex-win32-arm64"],
|
|
13
|
+
"win32-x64": ["x86_64-pc-windows-msvc", "@openai/codex-win32-x64"],
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* How to start `codex app-server`: the pinned release installed with this package, then a `codex`
|
|
17
|
+
* on PATH, then the pinned release through `npx`. The pinned binary is started directly with its
|
|
18
|
+
* bundled tools on PATH, as Codex's own launcher does.
|
|
19
|
+
*/
|
|
20
|
+
export function codexAppServerLaunch(env = {}) {
|
|
21
|
+
const pinned = pinnedCodexExecutable();
|
|
22
|
+
if (pinned !== undefined) {
|
|
23
|
+
const tools = join(dirname(dirname(pinned)), "codex-path");
|
|
24
|
+
const path = env["PATH"] ?? process.env["PATH"] ?? "";
|
|
25
|
+
return {
|
|
26
|
+
command: pinned,
|
|
27
|
+
args: ["app-server"],
|
|
28
|
+
env: existsSync(tools) ? { ...env, PATH: `${tools}${delimiter}${path}` } : env,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (onPath("codex", env))
|
|
32
|
+
return { command: "codex", args: ["app-server"], env };
|
|
33
|
+
return {
|
|
34
|
+
command: "npx",
|
|
35
|
+
args: ["-y", `@openai/codex@${CODEX_PINNED_VERSION}`, "app-server"],
|
|
36
|
+
env,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function pinnedCodexExecutable() {
|
|
40
|
+
const target = TARGETS[`${process.platform}-${process.arch}`];
|
|
41
|
+
if (target === undefined)
|
|
42
|
+
return undefined;
|
|
43
|
+
const [triple, platformPackage] = target;
|
|
44
|
+
try {
|
|
45
|
+
const codex = createRequire(require.resolve("@openai/codex/package.json"));
|
|
46
|
+
const root = dirname(codex.resolve(`${platformPackage}/package.json`));
|
|
47
|
+
const executable = join(root, "vendor", triple, "bin", process.platform === "win32" ? "codex.exe" : "codex");
|
|
48
|
+
return existsSync(executable) ? executable : undefined;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function onPath(command, env) {
|
|
55
|
+
const path = env["PATH"] ?? process.env["PATH"] ?? "";
|
|
56
|
+
const names = process.platform === "win32" ? [`${command}.exe`, `${command}.cmd`] : [command];
|
|
57
|
+
return path
|
|
58
|
+
.split(delimiter)
|
|
59
|
+
.some((directory) => directory !== "" && names.some((name) => existsSync(join(directory, name))));
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=resolveCodexExecutable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveCodexExecutable.js","sourceRoot":"","sources":["../../../sources/vendors/codexAppServer/resolveCodexExecutable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,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,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,MAAM,EAAE,GAAG,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9F,OAAO,IAAI;SACN,KAAK,CAAC,SAAS,CAAC;SAChB,IAAI,CACD,CAAC,SAAS,EAAE,EAAE,CACV,SAAS,KAAK,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAClF,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { AcpConnect } from "../../protocol/acp/AcpConnection.js";
|
|
2
|
+
import type { AcpAgentLaunch, AcpAgentProfile } from "../../protocol/acp/AcpProvider.js";
|
|
3
|
+
import type { SessionReasoningEffort } from "../../core/SessionRunRequest.js";
|
|
4
|
+
import type { AcpSelectValue } from "../../protocol/acp/impl/acpConfigOptions.js";
|
|
5
|
+
/**
|
|
6
|
+
* The foreign agents Happy can drive, by harness type: Claude Code and Codex through their own
|
|
7
|
+
* typed APIs; Antigravity, OpenCode, and any other agent through the Agent Client Protocol.
|
|
8
|
+
*/
|
|
9
|
+
export type ForeignAgentType = "claude-code" | "codex-cli" | "antigravity" | "opencode" | "acp";
|
|
10
|
+
export declare const FOREIGN_AGENT_TYPES: readonly ForeignAgentType[];
|
|
11
|
+
/**
|
|
12
|
+
* One model a foreign agent serves, under Happy's `<prefix>/<the agent's model value>` ID. The
|
|
13
|
+
* prefix is the agent's type, or `acp/<harness>` for a configured ACP agent.
|
|
14
|
+
*/
|
|
15
|
+
export interface ForeignAgentModel {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly effortLevels: readonly SessionReasoningEffort[];
|
|
19
|
+
readonly defaultEffort: SessionReasoningEffort;
|
|
20
|
+
readonly contextWindow: number;
|
|
21
|
+
}
|
|
22
|
+
/** Credentials a foreign agent may be started with instead of its CLI's default login. */
|
|
23
|
+
export interface ForeignAgentCredentials {
|
|
24
|
+
readonly apiKey?: string;
|
|
25
|
+
readonly authToken?: string;
|
|
26
|
+
readonly oauthToken?: string;
|
|
27
|
+
/** The agent CLI's own configuration directory, such as `CLAUDE_CONFIG_DIR` or `CODEX_HOME`. */
|
|
28
|
+
readonly configDir?: string;
|
|
29
|
+
}
|
|
30
|
+
/** What configuration says about starting one account's agent. */
|
|
31
|
+
export interface ForeignAgentStart {
|
|
32
|
+
/** The program to start instead of the agent's default, when the agent starts one. */
|
|
33
|
+
readonly command?: string;
|
|
34
|
+
readonly args?: readonly string[];
|
|
35
|
+
/** The credentials' environment and any configured extra variables. */
|
|
36
|
+
readonly env: NodeJS.ProcessEnv;
|
|
37
|
+
}
|
|
38
|
+
/** Everything that differs between foreign agents, around one shared session implementation. */
|
|
39
|
+
export interface ForeignAgent {
|
|
40
|
+
readonly type: ForeignAgentType;
|
|
41
|
+
readonly label: string;
|
|
42
|
+
/** The model ID prefix, without its trailing slash. */
|
|
43
|
+
readonly modelPrefix: string;
|
|
44
|
+
/**
|
|
45
|
+
* How to reach the agent: a first-party driver over the vendor's own typed API, which takes
|
|
46
|
+
* steering mid-turn, or an ACP adapter process. `start` carries the configured overrides.
|
|
47
|
+
*/
|
|
48
|
+
connect(start: ForeignAgentStart): AcpConnect;
|
|
49
|
+
/** The models assumed until the agent has been asked which it serves. */
|
|
50
|
+
readonly models: readonly ForeignAgentModel[];
|
|
51
|
+
/** Turn the values of the agent's own model selector into Happy models. */
|
|
52
|
+
readonly modelsFromSelector: (values: readonly AcpSelectValue[]) => readonly ForeignAgentModel[];
|
|
53
|
+
readonly profile: AcpAgentProfile;
|
|
54
|
+
/** Environment that hands the configured credentials to the agent's own CLI. */
|
|
55
|
+
credentialEnvironment(credentials: ForeignAgentCredentials): NodeJS.ProcessEnv;
|
|
56
|
+
}
|
|
57
|
+
/** The agent's own model value for a Happy `<prefix>/<model>` ID. */
|
|
58
|
+
export declare function foreignAgentModelName(prefix: string, model: string | undefined): string | undefined;
|
|
59
|
+
/** Whether a Happy model ID names a foreign agent's model. */
|
|
60
|
+
export declare function isForeignAgentModel(model: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Happy models from a model selector whose values carry their efforts in `_meta`, as the
|
|
63
|
+
* first-party drivers report them. Efforts Happy has no name for are left out, and a value with
|
|
64
|
+
* none is offered at medium.
|
|
65
|
+
*/
|
|
66
|
+
export declare function foreignModelsWithEfforts(prefix: string, values: readonly AcpSelectValue[], shape: (value: string, name: string) => {
|
|
67
|
+
readonly name: string;
|
|
68
|
+
readonly contextWindow: number;
|
|
69
|
+
}): readonly ForeignAgentModel[];
|
|
70
|
+
/** The ACP adapter `start` names, or `fallback` when configuration names none. */
|
|
71
|
+
export declare function foreignAgentLaunch(start: ForeignAgentStart, fallback: AcpAgentLaunch | undefined): AcpAgentLaunch;
|
|
72
|
+
/** Speak ACP to an adapter process. */
|
|
73
|
+
export declare function acpSpawnConnect(launch: AcpAgentLaunch): AcpConnect;
|
|
74
|
+
//# sourceMappingURL=ForeignAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForeignAgent.d.ts","sourceRoot":"","sources":["../../../sources/vendors/foreignAgents/ForeignAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,GAAG,KAAK,CAAC;AAEhG,eAAO,MAAM,mBAAmB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AAE,KAChC,SAAS,iBAAiB,EAAE,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,gFAAgF;IAChF,qBAAqB,CAAC,WAAW,EAAE,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC;CAClF;AAED,qEAAqE;AACrE,wBAAgB,qBAAqB,CACjC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,GAC1B,MAAM,GAAG,SAAS,CAGpB;AAED,8DAA8D;AAC9D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D;AAWD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,cAAc,EAAE,EACjC,KAAK,EAAE,CACH,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,KACX;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAC/D,SAAS,iBAAiB,EAAE,CAW9B;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,cAAc,GAAG,SAAS,GACrC,cAAc,CAKhB;AAED,uCAAuC;AACvC,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,UAAU,CAElE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { acpConnectionSpawn } from "../../protocol/acp/impl/acpConnectionSpawn.js";
|
|
2
|
+
export const FOREIGN_AGENT_TYPES = [
|
|
3
|
+
"claude-code",
|
|
4
|
+
"codex-cli",
|
|
5
|
+
"antigravity",
|
|
6
|
+
"opencode",
|
|
7
|
+
"acp",
|
|
8
|
+
];
|
|
9
|
+
/** The agent's own model value for a Happy `<prefix>/<model>` ID. */
|
|
10
|
+
export function foreignAgentModelName(prefix, model) {
|
|
11
|
+
const head = `${prefix}/`;
|
|
12
|
+
return model?.startsWith(head) === true ? model.slice(head.length) : undefined;
|
|
13
|
+
}
|
|
14
|
+
/** Whether a Happy model ID names a foreign agent's model. */
|
|
15
|
+
export function isForeignAgentModel(model) {
|
|
16
|
+
return FOREIGN_AGENT_TYPES.some((type) => model.startsWith(`${type}/`));
|
|
17
|
+
}
|
|
18
|
+
const HAPPY_EFFORTS = [
|
|
19
|
+
"minimal",
|
|
20
|
+
"low",
|
|
21
|
+
"medium",
|
|
22
|
+
"high",
|
|
23
|
+
"xhigh",
|
|
24
|
+
"max",
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Happy models from a model selector whose values carry their efforts in `_meta`, as the
|
|
28
|
+
* first-party drivers report them. Efforts Happy has no name for are left out, and a value with
|
|
29
|
+
* none is offered at medium.
|
|
30
|
+
*/
|
|
31
|
+
export function foreignModelsWithEfforts(prefix, values, shape) {
|
|
32
|
+
return values.map(({ value, name, meta }) => {
|
|
33
|
+
const offered = Array.isArray(meta?.["efforts"]) ? meta["efforts"] : [];
|
|
34
|
+
const efforts = HAPPY_EFFORTS.filter((effort) => offered.includes(effort));
|
|
35
|
+
const effortLevels = efforts.length === 0 ? ["medium"] : efforts;
|
|
36
|
+
const preferred = meta?.["defaultEffort"];
|
|
37
|
+
const defaultEffort = effortLevels.find((effort) => effort === preferred) ??
|
|
38
|
+
(effortLevels.includes("medium") ? "medium" : effortLevels[0]);
|
|
39
|
+
return { id: `${prefix}/${value}`, ...shape(value, name), effortLevels, defaultEffort };
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** The ACP adapter `start` names, or `fallback` when configuration names none. */
|
|
43
|
+
export function foreignAgentLaunch(start, fallback) {
|
|
44
|
+
const command = start.command ?? fallback?.command;
|
|
45
|
+
if (command === undefined)
|
|
46
|
+
throw new Error("The agent has no command to start.");
|
|
47
|
+
const args = start.command === undefined ? (fallback?.args ?? []) : (start.args ?? []);
|
|
48
|
+
return { command, args, env: start.env };
|
|
49
|
+
}
|
|
50
|
+
/** Speak ACP to an adapter process. */
|
|
51
|
+
export function acpSpawnConnect(launch) {
|
|
52
|
+
return (cwd, client) => acpConnectionSpawn(launch, cwd, client);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ForeignAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForeignAgent.js","sourceRoot":"","sources":["../../../sources/vendors/foreignAgents/ForeignAgent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAU/E,MAAM,CAAC,MAAM,mBAAmB,GAAgC;IAC5D,aAAa;IACb,WAAW;IACX,aAAa;IACb,UAAU;IACV,KAAK;CACR,CAAC;AAsDF,qEAAqE;AACrE,MAAM,UAAU,qBAAqB,CACjC,MAAc,EACd,KAAyB;IAEzB,MAAM,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC;IAC1B,OAAO,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC7C,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,aAAa,GAAsC;IACrD,SAAS;IACT,KAAK;IACL,QAAQ;IACR,MAAM;IACN,OAAO;IACP,KAAK;CACR,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACpC,MAAc,EACd,MAAiC,EACjC,KAG8D;IAE9D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,KAAK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IAAI,EAAE,CAAC,CAAC;IACvF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AAC7C,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAAC,MAAsB;IAClD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ForeignAgent } from "../../vendors/foreignAgents/ForeignAgent.js";
|
|
2
|
+
/**
|
|
3
|
+
* Any agent with an ACP server, configured as harness `harness` and started from its `command`,
|
|
4
|
+
* `args` and `env`. Its model IDs are `acp/<harness>/<model>`.
|
|
5
|
+
*
|
|
6
|
+
* Nothing about it is known ahead of time: its models are whatever its model selector offers,
|
|
7
|
+
* with efforts when the agent lists them in `_meta`, and its permission is the answer Happy's mode
|
|
8
|
+
* gives to each `session/request_permission`. Happy never compacts ahead of it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function acpGenericAgent(harness: string): ForeignAgent;
|
|
11
|
+
//# sourceMappingURL=acpGenericAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acpGenericAgent.d.ts","sourceRoot":"","sources":["../../../sources/vendors/foreignAgents/acpGenericAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,YAAY,EACpB,MAAM,yCAAyC,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAuB7D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { acpSpawnConnect, foreignAgentLaunch, foreignAgentModelName, foreignModelsWithEfforts, } from "../../vendors/foreignAgents/ForeignAgent.js";
|
|
2
|
+
/**
|
|
3
|
+
* Any agent with an ACP server, configured as harness `harness` and started from its `command`,
|
|
4
|
+
* `args` and `env`. Its model IDs are `acp/<harness>/<model>`.
|
|
5
|
+
*
|
|
6
|
+
* Nothing about it is known ahead of time: its models are whatever its model selector offers,
|
|
7
|
+
* with efforts when the agent lists them in `_meta`, and its permission is the answer Happy's mode
|
|
8
|
+
* gives to each `session/request_permission`. Happy never compacts ahead of it.
|
|
9
|
+
*/
|
|
10
|
+
export function acpGenericAgent(harness) {
|
|
11
|
+
const modelPrefix = `acp/${harness}`;
|
|
12
|
+
return {
|
|
13
|
+
type: "acp",
|
|
14
|
+
label: "ACP agent",
|
|
15
|
+
modelPrefix,
|
|
16
|
+
connect: (start) => acpSpawnConnect(foreignAgentLaunch(start, undefined)),
|
|
17
|
+
models: [],
|
|
18
|
+
modelsFromSelector: (values) => foreignModelsWithEfforts(modelPrefix, values, (_value, name) => ({
|
|
19
|
+
name,
|
|
20
|
+
contextWindow: 1_000_000,
|
|
21
|
+
})),
|
|
22
|
+
profile: {
|
|
23
|
+
modelOptions: (selected) => {
|
|
24
|
+
const name = foreignAgentModelName(modelPrefix, selected);
|
|
25
|
+
return name === undefined
|
|
26
|
+
? []
|
|
27
|
+
: [{ configId: "model", category: "model", value: name }];
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
credentialEnvironment: () => ({}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=acpGenericAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acpGenericAgent.js","sourceRoot":"","sources":["../../../sources/vendors/foreignAgents/acpGenericAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GAE3B,MAAM,yCAAyC,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC3C,MAAM,WAAW,GAAG,OAAO,OAAO,EAAE,CAAC;IACrC,OAAO;QACH,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,WAAW;QAClB,WAAW;QACX,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACzE,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,CAAC,MAAM,EAAE,EAAE,CAC3B,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YAC7D,IAAI;YACJ,aAAa,EAAE,SAAS;SAC3B,CAAC,CAAC;QACP,OAAO,EAAE;YACL,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACvB,MAAM,IAAI,GAAG,qBAAqB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;gBAC1D,OAAO,IAAI,KAAK,SAAS;oBACrB,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAClE,CAAC;SACJ;QACD,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;KACpC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ForeignAgent } from "../../vendors/foreignAgents/ForeignAgent.js";
|
|
2
|
+
/**
|
|
3
|
+
* Google Antigravity through the community `antigravity-acp` adapter, which drives the signed-in
|
|
4
|
+
* `agy` CLI and can resume its conversations.
|
|
5
|
+
*
|
|
6
|
+
* Antigravity names effort inside the model value (`gemini-3.8-flash-high`) and ignores ACP
|
|
7
|
+
* `mcpServers`; it does read `.agents/mcp_config.json` from every workspace directory, so the
|
|
8
|
+
* Happy bridge is placed in a private directory passed as an additional workspace root.
|
|
9
|
+
*/
|
|
10
|
+
export declare const antigravityAgent: ForeignAgent;
|
|
11
|
+
//# sourceMappingURL=antigravityAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antigravityAgent.d.ts","sourceRoot":"","sources":["../../../sources/vendors/foreignAgents/antigravityAgent.ts"],"names":[],"mappings":"AAEA,OAAO,EAIH,KAAK,YAAY,EAEpB,MAAM,yCAAyC,CAAC;AAqBjD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAuC9B,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { acpSpawnConnect, foreignAgentLaunch, foreignAgentModelName, } from "../../vendors/foreignAgents/ForeignAgent.js";
|
|
2
|
+
const THREE = ["low", "medium", "high"];
|
|
3
|
+
/** Efforts Antigravity spells as a model-value suffix, in Happy's picker order. */
|
|
4
|
+
const EFFORT_SUFFIXES = [
|
|
5
|
+
"minimal",
|
|
6
|
+
"low",
|
|
7
|
+
"medium",
|
|
8
|
+
"high",
|
|
9
|
+
"xhigh",
|
|
10
|
+
"max",
|
|
11
|
+
];
|
|
12
|
+
const models = [
|
|
13
|
+
model("gemini-4-argon", "Gemini 4 Argon", THREE, "medium"),
|
|
14
|
+
model("gemini-3.8-flash", "Gemini 3.8 Flash", THREE, "high"),
|
|
15
|
+
model("claude-opus-5-5", "Claude Opus 5.5 (Antigravity)", THREE, "medium"),
|
|
16
|
+
model("claude-sonnet-5-5", "Claude Sonnet 5.5 (Antigravity)", THREE, "medium"),
|
|
17
|
+
model("gpt-oss-120b", "GPT-OSS 120B (Antigravity)", ["medium"], "medium"),
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Google Antigravity through the community `antigravity-acp` adapter, which drives the signed-in
|
|
21
|
+
* `agy` CLI and can resume its conversations.
|
|
22
|
+
*
|
|
23
|
+
* Antigravity names effort inside the model value (`gemini-3.8-flash-high`) and ignores ACP
|
|
24
|
+
* `mcpServers`; it does read `.agents/mcp_config.json` from every workspace directory, so the
|
|
25
|
+
* Happy bridge is placed in a private directory passed as an additional workspace root.
|
|
26
|
+
*/
|
|
27
|
+
export const antigravityAgent = {
|
|
28
|
+
type: "antigravity",
|
|
29
|
+
modelPrefix: "antigravity",
|
|
30
|
+
label: "Antigravity",
|
|
31
|
+
connect: (start) => acpSpawnConnect(foreignAgentLaunch(start, { command: "npx", args: ["-y", "antigravity-acp@1.2.0"] })),
|
|
32
|
+
models,
|
|
33
|
+
modelsFromSelector,
|
|
34
|
+
profile: {
|
|
35
|
+
modelOptions: (selected, effort) => {
|
|
36
|
+
const name = foreignAgentModelName("antigravity", selected);
|
|
37
|
+
if (name === undefined)
|
|
38
|
+
return [];
|
|
39
|
+
// The API only admits efforts the catalog lists for this model, so the suffix exists.
|
|
40
|
+
const known = models.find((candidate) => candidate.id === selected);
|
|
41
|
+
const level = effort ?? known?.defaultEffort ?? "medium";
|
|
42
|
+
return [{ configId: "model", value: `${name}-${level}` }];
|
|
43
|
+
},
|
|
44
|
+
permissionOptions: (mode) => [
|
|
45
|
+
{ configId: "mode", value: mode === "read_only" ? "plan" : "default" },
|
|
46
|
+
{ configId: "sandbox", value: mode !== "full_access" },
|
|
47
|
+
],
|
|
48
|
+
// antigravity-acp binds a new session to the next conversation database agy creates in
|
|
49
|
+
// its shared store, so two new sessions started together can take each other's.
|
|
50
|
+
serializeNewSessions: true,
|
|
51
|
+
bridgeDirectoryFiles: (bridge) => [
|
|
52
|
+
{
|
|
53
|
+
path: ".agents/mcp_config.json",
|
|
54
|
+
content: JSON.stringify({
|
|
55
|
+
mcpServers: {
|
|
56
|
+
[bridge.name]: { serverUrl: bridge.url, headers: bridge.headers },
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
credentialEnvironment: (credentials) => credentials.apiKey === undefined ? {} : { GEMINI_API_KEY: credentials.apiKey },
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Antigravity lists every model once per effort (`gemini-3.8-flash-high`). Each base name becomes
|
|
66
|
+
* one Happy model whose efforts are its suffixes; a value without a known suffix is one model.
|
|
67
|
+
*/
|
|
68
|
+
function modelsFromSelector(values) {
|
|
69
|
+
const grouped = new Map();
|
|
70
|
+
for (const { value, name } of values) {
|
|
71
|
+
const effort = EFFORT_SUFFIXES.find((level) => value.endsWith(`-${level}`));
|
|
72
|
+
const base = effort === undefined ? value : value.slice(0, -(effort.length + 1));
|
|
73
|
+
const entry = grouped.get(base) ?? {
|
|
74
|
+
label: modelLabel(base, name, effort),
|
|
75
|
+
efforts: new Set(),
|
|
76
|
+
};
|
|
77
|
+
if (effort !== undefined)
|
|
78
|
+
entry.efforts.add(effort);
|
|
79
|
+
grouped.set(base, entry);
|
|
80
|
+
}
|
|
81
|
+
return [...grouped].map(([base, { label, efforts }]) => {
|
|
82
|
+
const levels = EFFORT_SUFFIXES.filter((level) => efforts.has(level));
|
|
83
|
+
const effortLevels = levels.length === 0 ? ["medium"] : levels;
|
|
84
|
+
const curated = models.find((candidate) => candidate.id === `antigravity/${base}`);
|
|
85
|
+
return model(base, curated?.name ?? label, effortLevels, effortLevels.includes("medium") ? "medium" : effortLevels[0]);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/** The agent's label for a model, without the effort it appends to it. */
|
|
89
|
+
function modelLabel(base, name, effort) {
|
|
90
|
+
if (effort === undefined)
|
|
91
|
+
return name;
|
|
92
|
+
const trimmed = name.replace(new RegExp(`[\\s(-]*${effort}\\)?$`, "i"), "").trim();
|
|
93
|
+
return trimmed.length > 0 && trimmed !== name ? trimmed : base;
|
|
94
|
+
}
|
|
95
|
+
function model(name, label, effortLevels, defaultEffort) {
|
|
96
|
+
return {
|
|
97
|
+
id: `antigravity/${name}`,
|
|
98
|
+
name: label,
|
|
99
|
+
effortLevels,
|
|
100
|
+
defaultEffort,
|
|
101
|
+
contextWindow: 1_000_000,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=antigravityAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antigravityAgent.js","sourceRoot":"","sources":["../../../sources/vendors/fo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AAE,CAAC,CAAC;QACnF,OAAO,KAAK,CACR,IAAI,EACJ,OAAO,EAAE,IAAI,IAAI,KAAK,EACtB,YAAY,EACZ,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAE,CAChE,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAED,0EAA0E;AAC1E,SAAS,UAAU,CACf,IAAY,EACZ,IAAY,EACZ,MAA0C;IAE1C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,WAAW,MAAM,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACnF,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACnE,CAAC;AAED,SAAS,KAAK,CACV,IAAY,EACZ,KAAa,EACb,YAA+C,EAC/C,aAAiD;IAEjD,OAAO;QACH,EAAE,EAAE,eAAe,IAAI,EAAE;QACzB,IAAI,EAAE,KAAK;QACX,YAAY;QACZ,aAAa;QACb,aAAa,EAAE,SAAS;KAC3B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ForeignAgent } from "../../vendors/foreignAgents/ForeignAgent.js";
|
|
2
|
+
/**
|
|
3
|
+
* Unmodified Claude Code through the Claude Agent SDK: Claude's own prompt, tools, settings,
|
|
4
|
+
* subagents and compaction, with Happy's tools bridged over MCP, real mid-turn steering, and the
|
|
5
|
+
* models the signed-in account serves. The SDK starts the Claude Code build Happy ships with.
|
|
6
|
+
*/
|
|
7
|
+
export declare const claudeCodeAgent: ForeignAgent;
|
|
8
|
+
//# sourceMappingURL=claudeCodeAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claudeCodeAgent.d.ts","sourceRoot":"","sources":["../../../sources/vendors/foreignAgents/claudeCodeAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,YAAY,EAEpB,MAAM,yCAAyC,CAAC;AAWjD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,YAgD7B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { foreignAgentModelName, foreignModelsWithEfforts, } from "../../vendors/foreignAgents/ForeignAgent.js";
|
|
2
|
+
import { claudeAgentConnect } from "../../vendors/claudeAgent/claudeAgentConnect.js";
|
|
3
|
+
const EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
4
|
+
const models = [
|
|
5
|
+
model("opus", "Claude Code · Opus"),
|
|
6
|
+
model("sonnet", "Claude Code · Sonnet"),
|
|
7
|
+
model("haiku", "Claude Code · Haiku"),
|
|
8
|
+
];
|
|
9
|
+
/**
|
|
10
|
+
* Unmodified Claude Code through the Claude Agent SDK: Claude's own prompt, tools, settings,
|
|
11
|
+
* subagents and compaction, with Happy's tools bridged over MCP, real mid-turn steering, and the
|
|
12
|
+
* models the signed-in account serves. The SDK starts the Claude Code build Happy ships with.
|
|
13
|
+
*/
|
|
14
|
+
export const claudeCodeAgent = {
|
|
15
|
+
type: "claude-code",
|
|
16
|
+
modelPrefix: "claude-code",
|
|
17
|
+
label: "Claude Code",
|
|
18
|
+
connect: (start) => claudeAgentConnect(start.env),
|
|
19
|
+
models,
|
|
20
|
+
modelsFromSelector: (values) => foreignModelsWithEfforts("claude-code", values, (value, name) => ({
|
|
21
|
+
name: `Claude Code · ${name}`,
|
|
22
|
+
contextWindow: value === "haiku" ? 200_000 : 1_000_000,
|
|
23
|
+
})),
|
|
24
|
+
profile: {
|
|
25
|
+
modelOptions: (selected, effort) => {
|
|
26
|
+
const name = foreignAgentModelName("claude-code", selected);
|
|
27
|
+
if (name === undefined)
|
|
28
|
+
return [];
|
|
29
|
+
return [
|
|
30
|
+
{ configId: "model", value: name },
|
|
31
|
+
...(effort === undefined || !EFFORTS.includes(effort)
|
|
32
|
+
? []
|
|
33
|
+
: [{ configId: "effort", value: effort }]),
|
|
34
|
+
];
|
|
35
|
+
},
|
|
36
|
+
permissionOptions: (mode) => [
|
|
37
|
+
{
|
|
38
|
+
configId: "mode",
|
|
39
|
+
value: mode === "read_only"
|
|
40
|
+
? "plan"
|
|
41
|
+
: mode === "workspace_write"
|
|
42
|
+
? "acceptEdits"
|
|
43
|
+
: mode === "auto"
|
|
44
|
+
? "auto"
|
|
45
|
+
: "bypassPermissions",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
credentialEnvironment: (credentials) => ({
|
|
50
|
+
...(credentials.oauthToken === undefined
|
|
51
|
+
? {}
|
|
52
|
+
: { CLAUDE_CODE_OAUTH_TOKEN: credentials.oauthToken }),
|
|
53
|
+
...(credentials.apiKey === undefined ? {} : { ANTHROPIC_API_KEY: credentials.apiKey }),
|
|
54
|
+
...(credentials.authToken === undefined
|
|
55
|
+
? {}
|
|
56
|
+
: { ANTHROPIC_AUTH_TOKEN: credentials.authToken }),
|
|
57
|
+
...(credentials.configDir === undefined
|
|
58
|
+
? {}
|
|
59
|
+
: { CLAUDE_CONFIG_DIR: credentials.configDir }),
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
function model(name, label) {
|
|
63
|
+
return {
|
|
64
|
+
id: `claude-code/${name}`,
|
|
65
|
+
name: label,
|
|
66
|
+
effortLevels: EFFORTS,
|
|
67
|
+
defaultEffort: "high",
|
|
68
|
+
contextWindow: name === "haiku" ? 200_000 : 1_000_000,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=claudeCodeAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claudeCodeAgent.js","sourceRoot":"","sources":["../../../sources/vendors/foreignAgents/claudeCodeAgent.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