@auto-engineer/adk-claude-code-bridge 1.117.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # @auto-engineer/adk-claude-code-bridge
2
+
3
+ ## 1.117.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`40f03c3`](https://github.com/BeOnAuto/auto-engineer/commit/40f03c3e4c468517d917d001bc0ae2fcf4a95a8a) Thanks [@osamanar](https://github.com/osamanar)! - - Fixed package publishing issue for the ADK Claude Code bridge package
8
+
9
+ - [`cb406c3`](https://github.com/BeOnAuto/auto-engineer/commit/cb406c3c431ea34146e223d5e1f174c9259256ae) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **packages/adk-claude-code-bridge**: adds adk claude code as a package
10
+ - **global**: version packages
11
+
12
+ ## 1.116.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [`e8a852c`](https://github.com/BeOnAuto/auto-engineer/commit/e8a852c030a4c1ad9f20d4f00b33bf8291da84da) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **packages/adk-claude-code-bridge**: adds adk claude code bridge
17
+ - **global**: version packages
18
+
19
+ ### Patch Changes
20
+
21
+ - [`24fbfc9`](https://github.com/BeOnAuto/auto-engineer/commit/24fbfc9af6f4de2f402fa0b834d4ef2162af76c5) Thanks [@osamanar](https://github.com/osamanar)! - - Added ADK Claude Code bridge as a new package
22
+
23
+ ## 1.115.0
24
+
25
+ ### Minor Changes
26
+
27
+ - [`74ec5f3`](https://github.com/BeOnAuto/auto-engineer/commit/74ec5f33c87a58430c39fc695e5f4d162f567e7b) Thanks [@osamanar](https://github.com/osamanar)! - - Added ADK Claude Code bridge package for integrating Google's Agent Development Kit with Claude Code
package/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ Elastic License 2.0
2
+
3
+ Copyright 2024 Sam Hatoum
4
+
5
+ This software and associated documentation files (the "Software") are licensed under the Elastic License 2.0 (the "License"). You may not use this file except in compliance with the License.
6
+
7
+ You may obtain a copy of the License at:
8
+ https://www.elastic.co/licensing/elastic-license
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@@ -0,0 +1,12 @@
1
+ import type { BaseLlmConnection, LlmRequest, LlmResponse } from '@google/adk';
2
+ import { BaseLlm } from '@google/adk';
3
+ export declare class ClaudeCodeLlm extends BaseLlm {
4
+ static readonly supportedModels: Array<string | RegExp>;
5
+ constructor({ model }?: {
6
+ model: string;
7
+ });
8
+ static register(): void;
9
+ generateContentAsync(llmRequest: LlmRequest, _stream?: boolean): AsyncGenerator<LlmResponse, void>;
10
+ connect(_llmRequest: LlmRequest): Promise<BaseLlmConnection>;
11
+ }
12
+ //# sourceMappingURL=claude-code-llm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-code-llm.d.ts","sourceRoot":"","sources":["../src/claude-code-llm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AAmDnD,qBAAa,aAAc,SAAQ,OAAO;IACxC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAkB;gBAE7D,EAAE,KAAK,EAAE,GAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAmC;IAIzE,MAAM,CAAC,QAAQ,IAAI,IAAI;IAQhB,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC,WAAW,EAAE,IAAI,CAAC;IAwCzG,OAAO,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAG7D"}
@@ -0,0 +1,102 @@
1
+ import { query } from '@anthropic-ai/claude-agent-sdk';
2
+ import { BaseLlm, LLMRegistry } from '@google/adk';
3
+ function extractTextFromParts(parts) {
4
+ const segments = [];
5
+ for (const part of parts) {
6
+ if (part.text) {
7
+ segments.push(part.text);
8
+ }
9
+ else if (part.functionCall) {
10
+ segments.push(`[Tool call: ${part.functionCall.name}(${JSON.stringify(part.functionCall.args)})]`);
11
+ }
12
+ else if (part.functionResponse) {
13
+ segments.push(`[Tool result: ${JSON.stringify(part.functionResponse.response)}]`);
14
+ }
15
+ }
16
+ return segments.join('');
17
+ }
18
+ function contentsToPrompt(contents) {
19
+ if (contents.length === 1) {
20
+ const content = contents[0];
21
+ return extractTextFromParts(content?.parts ?? []);
22
+ }
23
+ const lines = [];
24
+ for (const content of contents) {
25
+ const role = content.role === 'model' ? 'Assistant' : 'Human';
26
+ const text = extractTextFromParts(content.parts ?? []);
27
+ lines.push(`${role}: ${text}`);
28
+ }
29
+ return lines.join('\n\n');
30
+ }
31
+ function createErrorResponse(error) {
32
+ return {
33
+ errorCode: 'CLAUDE_CODE_ERROR',
34
+ errorMessage: error instanceof Error ? error.message : String(error),
35
+ turnComplete: true,
36
+ };
37
+ }
38
+ function buildCleanEnv() {
39
+ const env = {};
40
+ for (const [key, value] of Object.entries(process.env)) {
41
+ if (key === 'CLAUDECODE')
42
+ continue;
43
+ if (value !== undefined)
44
+ env[key] = value;
45
+ }
46
+ return env;
47
+ }
48
+ let registered = false;
49
+ export class ClaudeCodeLlm extends BaseLlm {
50
+ constructor({ model } = { model: 'claude-sonnet-4-5' }) {
51
+ super({ model: model ?? 'claude-sonnet-4-5' });
52
+ }
53
+ static register() {
54
+ if (registered) {
55
+ return;
56
+ }
57
+ LLMRegistry.register(ClaudeCodeLlm);
58
+ registered = true;
59
+ }
60
+ async *generateContentAsync(llmRequest, _stream) {
61
+ try {
62
+ const prompt = contentsToPrompt(llmRequest.contents);
63
+ const systemPrompt = typeof llmRequest.config?.systemInstruction === 'string' ? llmRequest.config.systemInstruction : undefined;
64
+ const queryResult = query({
65
+ prompt,
66
+ options: {
67
+ model: this.model,
68
+ allowedTools: [],
69
+ env: buildCleanEnv(),
70
+ ...(systemPrompt ? { systemPrompt } : {}),
71
+ },
72
+ });
73
+ const accumulatedParts = [];
74
+ for await (const message of queryResult) {
75
+ if (message.type === 'assistant') {
76
+ for (const block of message.message.content) {
77
+ if (block.type === 'text') {
78
+ accumulatedParts.push({ text: block.text });
79
+ }
80
+ }
81
+ }
82
+ else if (message.type === 'result') {
83
+ yield {
84
+ content: {
85
+ role: 'model',
86
+ parts: accumulatedParts.length > 0 ? accumulatedParts : [{ text: '' }],
87
+ },
88
+ turnComplete: true,
89
+ };
90
+ }
91
+ }
92
+ }
93
+ catch (error) {
94
+ yield createErrorResponse(error);
95
+ }
96
+ }
97
+ connect(_llmRequest) {
98
+ throw new Error('ClaudeCodeLlm does not support bidirectional streaming');
99
+ }
100
+ }
101
+ ClaudeCodeLlm.supportedModels = [/^claude-.*/];
102
+ //# sourceMappingURL=claude-code-llm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-code-llm.js","sourceRoot":"","sources":["../src/claude-code-llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGnD,SAAS,oBAAoB,CAAC,KAAa;IACzC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;aAAM,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7B,QAAQ,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,IAAI,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CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC1C;aACF,CAAC,CAAC;YAEH,MAAM,gBAAgB,GAAW,EAAE,CAAC;YAEpC,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;gBACxC,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;oBACjC,KAAK,MAAM,KAAK,IAAK,OAAe,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;wBACrD,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;4BAC1B,gBAAgB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;wBAC9C,CAAC;oBACH,CAAC;gBACH,CAAC;qBAAM,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACrC,MAAM;wBACJ,OAAO,EAAE;4BACP,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;yBACvE;wBACD,YAAY,EAAE,IAAI;qBACnB,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,CAAC,WAAuB;QAC7B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;;AAxDe,6BAAe,GAA2B,CAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ClaudeCodeLlm } from './claude-code-llm.js';
2
+ export { ClaudeCodeLlm } from './claude-code-llm.js';
3
+ export declare function registerClaudeCode(model?: string): void;
4
+ export declare function ClaudeCode(model: string): ClaudeCodeLlm;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAKvD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAEvD"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import { LLMRegistry } from '@google/adk';
2
+ import { ClaudeCodeLlm } from './claude-code-llm.js';
3
+ export { ClaudeCodeLlm } from './claude-code-llm.js';
4
+ export function registerClaudeCode(model) {
5
+ ClaudeCodeLlm.register();
6
+ if (model) {
7
+ LLMRegistry.newLlm(model);
8
+ }
9
+ }
10
+ export function ClaudeCode(model) {
11
+ return new ClaudeCodeLlm({ model });
12
+ }
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,aAAa,CAAC,QAAQ,EAAE,CAAC;IACzB,IAAI,KAAK,EAAE,CAAC;QACV,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACtC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@auto-engineer/adk-claude-code-bridge",
3
+ "version": "1.117.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "CHANGELOG.md"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "dependencies": {
22
+ "@anthropic-ai/claude-agent-sdk": "^0.2.71",
23
+ "@google/adk": "^0.4.0",
24
+ "@google/genai": "^1.44.0"
25
+ },
26
+ "devDependencies": {
27
+ "tsx": "^4.21.0"
28
+ },
29
+ "scripts": {
30
+ "type-check": "tsc --noEmit",
31
+ "build": "tsc && tsx ../../scripts/fix-esm-imports.ts",
32
+ "test": "vitest run || true",
33
+ "release": "pnpm publish --no-git-checks"
34
+ }
35
+ }