@sanoma-ai/connector-anthropic 0.11.21 → 0.11.23
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/MARKS-LICENSE +26 -0
- package/README.md +6 -2
- package/claude-code.svg +1 -0
- package/dist/agent.d.ts +7 -0
- package/dist/agent.js +42 -0
- package/dist/agent.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +16 -6
package/MARKS-LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
The marks in this package (claude-code.svg, Claude Code's; not logo.svg and logo-dark.svg, from Simple Icons) come
|
|
2
|
+
from LobeHub's icon set (@lobehub/icons-static-svg 1.102.0,
|
|
3
|
+
https://github.com/lobehub/lobe-icons), under the MIT License below. The marks themselves are
|
|
4
|
+
the trademarks of Anthropic and name their products only.
|
|
5
|
+
|
|
6
|
+
MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2023 LobeHub
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -24,11 +24,15 @@ The connector has no operations. It attaches a model half (`withSetup({ model })
|
|
|
24
24
|
|
|
25
25
|
The driver declares it, with no operations, so the app's connector page asks for it and stores it encrypted. The model half reads it at each request, the environment's first, then the stored one: a key set on the page is used from the next call, unless the environment sets one, which wins. Without one, a call fails with the AI SDK's `LoadAPIKeyError`, "anthropic is not configured: ANTHROPIC_API_KEY (…); set it on the connector page", and sends nothing. A key that cannot be read (the database down) fails the call alike, not retried. `ANTHROPIC_BASE_URL`, the adapter's own, points it at another endpoint: read from the app's environment once, when its registry is made, so a change needs a restart.
|
|
26
26
|
|
|
27
|
+
## Claude Code
|
|
28
|
+
|
|
29
|
+
The connector also gives the app's chat Claude Code, a coding agent (`withSetup({ agent })`): on a person's own plan as the engine `acp-claude-code`, over the Agent Client Protocol through `@agentclientprotocol/claude-agent-acp` (pinned), installed on first use in the person's box and signed in with their Claude account in the chat; and on the company's key as `claude-code`, through the AI SDK's `HarnessAgent` and its Claude Code adapter (`@ai-sdk/harness-claude-code`, pinned, loaded only when such a turn runs), on `anthropic/default` and `ANTHROPIC_API_KEY`. Its bridge installs Claude Code under the person's box's home on its first start there.
|
|
30
|
+
|
|
27
31
|
## Testing
|
|
28
32
|
|
|
29
|
-
`pnpm vitest run connectors/anthropic` runs the model half over a stubbed `fetch`, so no request leaves the machine and no key is needed.
|
|
33
|
+
`pnpm vitest run connectors/anthropic` runs the model half over a stubbed `fetch`, and loads Claude Code's adapter without starting it, so no request leaves the machine and no key is needed.
|
|
30
34
|
|
|
31
|
-
The logo the app shows is Anthropic's mark, from [Simple Icons](https://simpleicons.org/?q=anthropic) (CC0), in dark or light
|
|
35
|
+
The logo the app shows is Anthropic's mark, from [Simple Icons](https://simpleicons.org/?q=anthropic) (CC0), in dark or light; Claude Code's is from [LobeHub's icon set](https://github.com/lobehub/lobe-icons) (MIT, [`MARKS-LICENSE`](MARKS-LICENSE)). They are there only to identify the service. Anthropic does not endorse this package.
|
|
32
36
|
|
|
33
37
|
### Later
|
|
34
38
|
|
package/claude-code.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Claude Code</title><path clip-rule="evenodd" d="M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z" fill="#D97757" fill-rule="evenodd"></path></svg>
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CodingAgent } from "sanoma/workflows";
|
|
2
|
+
/**
|
|
3
|
+
* Claude Code, the chat's coding agent: on a person's own plan over the Agent Client Protocol
|
|
4
|
+
* (Zed's `claude-agent-acp`, signed in with their Claude account in the chat), and on the
|
|
5
|
+
* company's key through its `HarnessAgent` adapter, on this connector's model and key.
|
|
6
|
+
*/
|
|
7
|
+
export declare const claudeCode: CodingAgent;
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Claude Code's adapter for the AI SDK's `HarnessAgent`, loaded only when a turn runs it on the
|
|
11
|
+
* company's key, by a name the Worker's bundler leaves alone: the adapter runs its bridge in the
|
|
12
|
+
* person's box from files beside its own `dist/`, so it is never bundled.
|
|
13
|
+
*/
|
|
14
|
+
const ADAPTER = "@ai-sdk/harness-claude-code";
|
|
15
|
+
/**
|
|
16
|
+
* Claude Code, the chat's coding agent: on a person's own plan over the Agent Client Protocol
|
|
17
|
+
* (Zed's `claude-agent-acp`, signed in with their Claude account in the chat), and on the
|
|
18
|
+
* company's key through its `HarnessAgent` adapter, on this connector's model and key.
|
|
19
|
+
*/
|
|
20
|
+
export const claudeCode = {
|
|
21
|
+
own: {
|
|
22
|
+
packages: ["@agentclientprotocol/claude-agent-acp@0.95.0"],
|
|
23
|
+
bin: "claude-agent-acp",
|
|
24
|
+
args: [],
|
|
25
|
+
signIn: { method: "claude-ai-login" },
|
|
26
|
+
},
|
|
27
|
+
onKey: {
|
|
28
|
+
model: "anthropic",
|
|
29
|
+
baseUrl: "ANTHROPIC_BASE_URL",
|
|
30
|
+
qualified: false,
|
|
31
|
+
bridge: true,
|
|
32
|
+
harness: async (auth) => {
|
|
33
|
+
const { createClaudeCode } = await import(__rewriteRelativeImportExtension(
|
|
34
|
+
/* @vite-ignore */ ADAPTER));
|
|
35
|
+
return createClaudeCode({
|
|
36
|
+
auth,
|
|
37
|
+
env: { CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1", DISABLE_AUTOUPDATER: "1" },
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;AAEA;;;;GAIG;AACH,MAAM,OAAO,GAAG,6BAA6B,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAgB;IACrC,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC,8CAA8C,CAAC;QAC1D,GAAG,EAAE,kBAAkB;QACvB,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE;KACtC;IACD,KAAK,EAAE;QACL,KAAK,EAAE,WAAW;QAClB,OAAO,EAAE,oBAAoB;QAC7B,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,gBAAgB,EAAE,GAAiD,MAAM,MAAM;YACrF,kBAAkB,CAAC,OAAO,EAC3B,CAAC;YACF,OAAO,gBAAgB,CAAC;gBACtB,IAAI;gBACJ,GAAG,EAAE,EAAE,wCAAwC,EAAE,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE;aACjF,CAAC,CAAC;QACL,CAAC;KACF;CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { ANTHROPIC_DEFAULT_MODEL } from "./model.ts";
|
|
|
3
3
|
* Anthropic's models for the app's agent: its model half (`anthropicModel`), which the app's
|
|
4
4
|
* registry names `anthropic/<model-id>` (`anthropic/default` for `ANTHROPIC_DEFAULT_MODEL`), and
|
|
5
5
|
* a driver with no operations that declares `ANTHROPIC_API_KEY`, which the connector page sets.
|
|
6
|
+
* And Claude Code (`claudeCode`), a coding agent the chat runs on a person's own plan or on that key.
|
|
6
7
|
*/
|
|
7
8
|
export declare const anthropic: import("sanoma/workflows").Connector<"anthropic", {}>;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { withSetup } from "sanoma/workflows";
|
|
2
|
+
import { claudeCode } from "./agent.js";
|
|
2
3
|
import { anthropicOps } from "./connector.js";
|
|
3
4
|
import { anthropicDriver } from "./driver.js";
|
|
4
5
|
import { anthropicModel } from "./model.js";
|
|
@@ -7,6 +8,7 @@ export { ANTHROPIC_DEFAULT_MODEL } from "./model.js";
|
|
|
7
8
|
* Anthropic's models for the app's agent: its model half (`anthropicModel`), which the app's
|
|
8
9
|
* registry names `anthropic/<model-id>` (`anthropic/default` for `ANTHROPIC_DEFAULT_MODEL`), and
|
|
9
10
|
* a driver with no operations that declares `ANTHROPIC_API_KEY`, which the connector page sets.
|
|
11
|
+
* And Claude Code (`claudeCode`), a coding agent the chat runs on a person's own plan or on that key.
|
|
10
12
|
*/
|
|
11
|
-
export const anthropic = withSetup(anthropicOps, { driver: anthropicDriver, model: anthropicModel });
|
|
13
|
+
export const anthropic = withSetup(anthropicOps, { driver: anthropicDriver, model: anthropicModel, agent: claudeCode });
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanoma-ai/connector-anthropic",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"description": "Anthropic's Claude models for Sanoma's agent, through the AI SDK, on the company's API key",
|
|
3
|
+
"version": "0.11.23",
|
|
4
|
+
"description": "Anthropic's Claude models for Sanoma's agent, through the AI SDK, on the company's API key; and Claude Code, a coding agent for the chat on a person's own plan or the company's key",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-sdk",
|
|
7
7
|
"anthropic",
|
|
8
8
|
"claude",
|
|
9
|
+
"claude-code",
|
|
10
|
+
"coding-agent",
|
|
9
11
|
"connector",
|
|
10
12
|
"model",
|
|
11
13
|
"sanoma",
|
|
@@ -23,8 +25,10 @@
|
|
|
23
25
|
"dist",
|
|
24
26
|
"logo.svg",
|
|
25
27
|
"logo-dark.svg",
|
|
28
|
+
"claude-code.svg",
|
|
26
29
|
"README.md",
|
|
27
|
-
"LICENSE"
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"MARKS-LICENSE"
|
|
28
32
|
],
|
|
29
33
|
"type": "module",
|
|
30
34
|
"sideEffects": false,
|
|
@@ -45,15 +49,16 @@
|
|
|
45
49
|
},
|
|
46
50
|
"dependencies": {
|
|
47
51
|
"@ai-sdk/anthropic": "4.0.88",
|
|
52
|
+
"@ai-sdk/harness-claude-code": "1.0.162",
|
|
48
53
|
"@ai-sdk/provider": "4.0.34",
|
|
49
54
|
"ai": "7.0.153"
|
|
50
55
|
},
|
|
51
56
|
"devDependencies": {
|
|
52
|
-
"sanoma": "0.11.
|
|
57
|
+
"sanoma": "0.11.23",
|
|
53
58
|
"zod": "^4.6.5"
|
|
54
59
|
},
|
|
55
60
|
"peerDependencies": {
|
|
56
|
-
"sanoma": "0.11.
|
|
61
|
+
"sanoma": "0.11.23",
|
|
57
62
|
"zod": "^4"
|
|
58
63
|
},
|
|
59
64
|
"engines": {
|
|
@@ -62,7 +67,12 @@
|
|
|
62
67
|
"sanoma": {
|
|
63
68
|
"title": "Anthropic",
|
|
64
69
|
"logo": "logo.svg",
|
|
65
|
-
"logoDark": "logo-dark.svg"
|
|
70
|
+
"logoDark": "logo-dark.svg",
|
|
71
|
+
"agent": {
|
|
72
|
+
"id": "claude-code",
|
|
73
|
+
"title": "Claude Code",
|
|
74
|
+
"mark": "claude-code.svg"
|
|
75
|
+
}
|
|
66
76
|
},
|
|
67
77
|
"scripts": {
|
|
68
78
|
"build": "tsc -p tsconfig.build.json",
|