@executioncontrolprotocol/anthropic 0.13.2 → 0.60.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/README.md CHANGED
@@ -1,22 +1,8 @@
1
1
  # `@executioncontrolprotocol/anthropic`
2
2
 
3
- Anthropic Messages API model provider for ECP (`anthropic.generate` / `anthropic.evaluate`).
3
+ Anthropic generate capability for ECP executions.
4
4
 
5
- ## Auth
5
+ **Entrypoints:** `src/index.ts`, `ecp.manifest.json`
6
6
 
7
- - Extension config `apiKey`, or
8
- - `ANTHROPIC_API_KEY` from the process environment (Node)
9
-
10
- Browser demo BYOK uses the vault secret `ANTHROPIC_API_KEY` with local execution and the
11
- `anthropic-dangerous-direct-browser-access` header.
12
-
13
- ## Multimodal `files`
14
-
15
- Optional `files` on `model.generate` are portable `FileRef` values. Supported MIME types:
16
-
17
- | Kind | MIME |
18
- | ---- | ---- |
19
- | Image | `image/jpeg`, `image/png`, `image/gif`, `image/webp` |
20
- | Document | `application/pdf` |
21
-
22
- Unsupported MIME types are rejected before the API call.
7
+ Configure with a config object; put the API key behind `{ "$secret": "…" }` and
8
+ `ecp config secrets set`.
@@ -0,0 +1,8 @@
1
+ import type { HandlerContext } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { type GenerateInput, type GenerateOutput } from "../schemas.js";
3
+ /**
4
+ * Generate handler: one Messages API call.
5
+ * @category Plugins
6
+ */
7
+ export default function handler(input: GenerateInput, ctx: HandlerContext): Promise<GenerateOutput>;
8
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/capabilities/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AA+EtB;;;GAGG;AACH,wBAA8B,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CA+CxG"}
@@ -0,0 +1,101 @@
1
+ import { ANTHROPIC_IMAGE_MEDIA_TYPES, anthropicConfigSchema, } from "../schemas.js";
2
+ const DEFAULT_BASE_URL = "https://api.anthropic.com";
3
+ const ANTHROPIC_VERSION = "2023-06-01";
4
+ const DEFAULT_MAX_TOKENS = 4096;
5
+ function codedError(code, message, details) {
6
+ return Object.assign(new Error(message), { code, details });
7
+ }
8
+ function providerErrorMessage(prefix, status, body) {
9
+ const detail = isRecord(body) && isRecord(body.error) && typeof body.error.message === "string"
10
+ ? body.error.message
11
+ : isRecord(body) && typeof body.message === "string"
12
+ ? body.message
13
+ : undefined;
14
+ return detail
15
+ ? `${prefix} returned HTTP ${status}: ${detail}`
16
+ : `${prefix} returned HTTP ${status}.`;
17
+ }
18
+ function isRecord(value) {
19
+ return typeof value === "object" && value !== null && !Array.isArray(value);
20
+ }
21
+ function resolveConfig(raw) {
22
+ const parsed = anthropicConfigSchema.safeParse(raw);
23
+ if (!parsed.success) {
24
+ throw codedError("ECP_CONFIG_INVALID", "The anthropic step needs a config object with an apiKey (and optionally model and baseUrl).", { issues: parsed.error.issues.map((issue) => ({ path: issue.path.join("."), message: issue.message })) });
25
+ }
26
+ return parsed.data;
27
+ }
28
+ /** The Messages API rejects images over 5 MB. */
29
+ const MAX_IMAGE_BYTES = 5 * 1024 * 1024;
30
+ /** Read one image through the host file service and turn it into a Messages API image block. */
31
+ async function imageBlock(ref, index, ctx) {
32
+ const read = await ctx.files.bytes(ref);
33
+ const mediaType = (read.mediaType ?? ref.mediaType ?? "").split(";")[0].trim().toLowerCase();
34
+ if (!ANTHROPIC_IMAGE_MEDIA_TYPES.includes(mediaType)) {
35
+ throw codedError("ECP_INPUT_INVALID", `images[${index}] is ${mediaType || "of unknown type"}; Claude reads JPEG, PNG, GIF or WebP.`, { path: `images/${index}` });
36
+ }
37
+ if (read.bytes.byteLength > MAX_IMAGE_BYTES) {
38
+ throw codedError("ECP_INPUT_INVALID", `images[${index}] is ${read.bytes.byteLength} bytes; Claude accepts up to 5 MB per image. Request a smaller rendition (for example a JPEG with a width limit).`, { path: `images/${index}` });
39
+ }
40
+ return {
41
+ type: "image",
42
+ source: { type: "base64", media_type: mediaType, data: Buffer.from(read.bytes).toString("base64") },
43
+ };
44
+ }
45
+ async function readBody(res) {
46
+ const text = await res.text();
47
+ try {
48
+ return JSON.parse(text);
49
+ }
50
+ catch {
51
+ return text;
52
+ }
53
+ }
54
+ /**
55
+ * Generate handler: one Messages API call.
56
+ * @category Plugins
57
+ */
58
+ export default async function handler(input, ctx) {
59
+ const config = resolveConfig(ctx.config);
60
+ const baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
61
+ const images = await Promise.all((input.images ?? []).map((ref, index) => imageBlock(ref, index, ctx)));
62
+ const body = {
63
+ model: config.model,
64
+ max_tokens: input.maxTokens ?? DEFAULT_MAX_TOKENS,
65
+ ...(input.system === undefined ? {} : { system: input.system }),
66
+ messages: [
67
+ {
68
+ role: "user",
69
+ content: images.length === 0 ? input.prompt : [...images, { type: "text", text: input.prompt }],
70
+ },
71
+ ],
72
+ };
73
+ const res = await fetch(`${baseUrl}/v1/messages`, {
74
+ method: "POST",
75
+ headers: {
76
+ "content-type": "application/json",
77
+ "x-api-key": config.apiKey,
78
+ "anthropic-version": ANTHROPIC_VERSION,
79
+ },
80
+ body: JSON.stringify(body),
81
+ signal: ctx.signal,
82
+ });
83
+ if (!res.ok) {
84
+ const body = await readBody(res);
85
+ throw codedError("ECP_PROVIDER_ERROR", providerErrorMessage("Anthropic Messages API", res.status, body), {
86
+ status: res.status,
87
+ body,
88
+ });
89
+ }
90
+ const data = (await res.json());
91
+ const text = (data.content ?? [])
92
+ .filter((block) => block.type === "text" && typeof block.text === "string")
93
+ .map((block) => block.text)
94
+ .join("");
95
+ const inputTokens = data.usage?.input_tokens ?? 0;
96
+ const outputTokens = data.usage?.output_tokens ?? 0;
97
+ ctx.usage.record({ kind: "tokens.in", amount: inputTokens, unit: "token" });
98
+ ctx.usage.record({ kind: "tokens.out", amount: outputTokens, unit: "token" });
99
+ return { text, usage: { inputTokens, outputTokens } };
100
+ }
101
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/capabilities/generate.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,GAItB,MAAM,eAAe,CAAA;AAEtB,MAAM,gBAAgB,GAAG,2BAA2B,CAAA;AACpD,MAAM,iBAAiB,GAAG,YAAY,CAAA;AACtC,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAO/B,SAAS,UAAU,CAAC,IAAY,EAAE,OAAe,EAAE,OAAgC;IACjF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;AAC7D,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAc,EAAE,MAAc,EAAE,IAAa;IACzE,MAAM,MAAM,GACV,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ;QAC9E,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO;QACpB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;YAClD,CAAC,CAAC,IAAI,CAAC,OAAO;YACd,CAAC,CAAC,SAAS,CAAA;IACjB,OAAO,MAAM;QACX,CAAC,CAAC,GAAG,MAAM,kBAAkB,MAAM,KAAK,MAAM,EAAE;QAChD,CAAC,CAAC,GAAG,MAAM,kBAAkB,MAAM,GAAG,CAAA;AAC1C,CAAC;AAED,SAAS,QAAQ,CAAC,KAA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CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;SAC9B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;SAC1E,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SAC1B,IAAI,CAAC,EAAE,CAAC,CAAA;IACX,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE,YAAY,IAAI,CAAC,CAAA;IACjD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,aAAa,IAAI,CAAC,CAAA;IAEnD,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IAC3E,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IAE7E,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,CAAA;AACvD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,114 @@
1
- import { type Registry } from "@executioncontrolprotocol/core";
2
- export { ANTHROPIC_GENERATE_DOCUMENT_MEDIA_TYPES, ANTHROPIC_GENERATE_IMAGE_MEDIA_TYPES, ANTHROPIC_GENERATE_MEDIA_TYPES, isAnthropicDocumentMediaType, isAnthropicGenerateMediaType, isAnthropicImageMediaType, } from "./media-types.js";
3
- export { ANTHROPIC_DEFAULT_MAX_TOKENS, ANTHROPIC_DEFAULT_MODEL, buildAnthropicUserContent, resolveAnthropicModel, resolveAnthropicSamplingOptions, } from "./messages.js";
4
- export { resolveAnthropicApiKey } from "./resolve-api-key.js";
5
- /** Anthropic model provider. @category Extensions */
6
- export declare const anthropicExtension: import("@executioncontrolprotocol/core").ExtensionDefinition;
7
- /** Register Anthropic extension. @category Extensions */
8
- export declare function registerAnthropicExtension(registry?: Registry): Promise<void>;
9
- export default anthropicExtension;
1
+ export { ANTHROPIC_DEFAULT_MODEL, anthropicConfigSchema, generateAcceptsSchema, generateReturnsSchema, } from "./schemas.js";
2
+ export type { AnthropicConfig, GenerateInput, GenerateOutput } from "./schemas.js";
3
+ /**
4
+ * Generate capability definition (for handler typing).
5
+ * @category Plugins
6
+ */
7
+ export declare const generate: import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodObject<{
8
+ prompt: import("zod").ZodString;
9
+ system: import("zod").ZodOptional<import("zod").ZodString>;
10
+ maxTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
11
+ images: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
12
+ kind: import("zod").ZodLiteral<"file">;
13
+ path: import("zod").ZodString;
14
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
15
+ archive: import("zod").ZodOptional<import("zod").ZodObject<{
16
+ kind: import("zod").ZodLiteral<"artifact">;
17
+ uri: import("zod").ZodString;
18
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
19
+ name: import("zod").ZodOptional<import("zod").ZodString>;
20
+ sizeBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
21
+ }, import("zod/v4/core").$strip>>;
22
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
23
+ kind: import("zod").ZodLiteral<"url">;
24
+ url: import("zod").ZodString;
25
+ headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
26
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
27
+ archive: import("zod").ZodOptional<import("zod").ZodObject<{
28
+ kind: import("zod").ZodLiteral<"artifact">;
29
+ uri: import("zod").ZodString;
30
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
31
+ name: import("zod").ZodOptional<import("zod").ZodString>;
32
+ sizeBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
33
+ }, import("zod/v4/core").$strip>>;
34
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
35
+ kind: import("zod").ZodLiteral<"artifact">;
36
+ uri: import("zod").ZodString;
37
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
38
+ name: import("zod").ZodOptional<import("zod").ZodString>;
39
+ sizeBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
40
+ archive: import("zod").ZodOptional<import("zod").ZodObject<{
41
+ kind: import("zod").ZodLiteral<"artifact">;
42
+ uri: import("zod").ZodString;
43
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
44
+ name: import("zod").ZodOptional<import("zod").ZodString>;
45
+ sizeBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
46
+ }, import("zod/v4/core").$strip>>;
47
+ }, import("zod/v4/core").$strip>], "kind">>>;
48
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
49
+ text: import("zod").ZodString;
50
+ usage: import("zod").ZodObject<{
51
+ inputTokens: import("zod").ZodNumber;
52
+ outputTokens: import("zod").ZodNumber;
53
+ }, import("zod/v4/core").$strip>;
54
+ }, import("zod/v4/core").$strip>, Record<string, unknown> | undefined>;
55
+ /**
56
+ * Anthropic plugin. Claude text generation through the Messages API.
57
+ * @category Plugins
58
+ */
59
+ declare const _default: import("@executioncontrolprotocol/plugin-sdk").PluginDefinition<import("zod").ZodObject<{
60
+ apiKey: import("zod").ZodString;
61
+ model: import("zod").ZodDefault<import("zod").ZodString>;
62
+ baseUrl: import("zod").ZodOptional<import("zod").ZodString>;
63
+ }, import("zod/v4/core").$strip>, {
64
+ generate: import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodObject<{
65
+ prompt: import("zod").ZodString;
66
+ system: import("zod").ZodOptional<import("zod").ZodString>;
67
+ maxTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
68
+ images: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
69
+ kind: import("zod").ZodLiteral<"file">;
70
+ path: import("zod").ZodString;
71
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
72
+ archive: import("zod").ZodOptional<import("zod").ZodObject<{
73
+ kind: import("zod").ZodLiteral<"artifact">;
74
+ uri: import("zod").ZodString;
75
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
76
+ name: import("zod").ZodOptional<import("zod").ZodString>;
77
+ sizeBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
78
+ }, import("zod/v4/core").$strip>>;
79
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
80
+ kind: import("zod").ZodLiteral<"url">;
81
+ url: import("zod").ZodString;
82
+ headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
83
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
84
+ archive: import("zod").ZodOptional<import("zod").ZodObject<{
85
+ kind: import("zod").ZodLiteral<"artifact">;
86
+ uri: import("zod").ZodString;
87
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
88
+ name: import("zod").ZodOptional<import("zod").ZodString>;
89
+ sizeBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
90
+ }, import("zod/v4/core").$strip>>;
91
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
92
+ kind: import("zod").ZodLiteral<"artifact">;
93
+ uri: import("zod").ZodString;
94
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
95
+ name: import("zod").ZodOptional<import("zod").ZodString>;
96
+ sizeBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
97
+ archive: import("zod").ZodOptional<import("zod").ZodObject<{
98
+ kind: import("zod").ZodLiteral<"artifact">;
99
+ uri: import("zod").ZodString;
100
+ mediaType: import("zod").ZodOptional<import("zod").ZodString>;
101
+ name: import("zod").ZodOptional<import("zod").ZodString>;
102
+ sizeBytes: import("zod").ZodOptional<import("zod").ZodNumber>;
103
+ }, import("zod/v4/core").$strip>>;
104
+ }, import("zod/v4/core").$strip>], "kind">>>;
105
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
106
+ text: import("zod").ZodString;
107
+ usage: import("zod").ZodObject<{
108
+ inputTokens: import("zod").ZodNumber;
109
+ outputTokens: import("zod").ZodNumber;
110
+ }, import("zod/v4/core").$strip>;
111
+ }, import("zod/v4/core").$strip>, Record<string, unknown> | undefined>;
112
+ }>;
113
+ export default _default;
10
114
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,QAAQ,EACd,MAAM,gCAAgC,CAAA;AAcvC,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACpC,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAiC7D,qDAAqD;AACrD,eAAO,MAAM,kBAAkB,8DAyIrB,CAAA;AAIV,yDAAyD;AACzD,wBAAsB,0BAA0B,CAC9C,QAAQ,GAAE,QAAyB,GAClC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,eAAe,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElF;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sEAgBnB,CAAA;AAEF;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACH,wBASE"}
package/dist/index.js CHANGED
@@ -1,166 +1,37 @@
1
- import { catalogExtension, capabilityFor, defineExtension, globalRegistry, BROWSER_RUNTIME_ID, NODE_RUNTIME_ID, toProviderChatTurns, } from "@executioncontrolprotocol/core";
2
- import { modelGenerateInputSchema, modelGenerateOutputSchema, } from "@executioncontrolprotocol/types";
3
- import { z } from "zod";
4
- import { buildAnthropicUserContent, resolveAnthropicModel, resolveAnthropicSamplingOptions, ANTHROPIC_DEFAULT_MODEL, } from "./messages.js";
5
- import { resolveAnthropicApiKey } from "./resolve-api-key.js";
6
- export { ANTHROPIC_GENERATE_DOCUMENT_MEDIA_TYPES, ANTHROPIC_GENERATE_IMAGE_MEDIA_TYPES, ANTHROPIC_GENERATE_MEDIA_TYPES, isAnthropicDocumentMediaType, isAnthropicGenerateMediaType, isAnthropicImageMediaType, } from "./media-types.js";
7
- export { ANTHROPIC_DEFAULT_MAX_TOKENS, ANTHROPIC_DEFAULT_MODEL, buildAnthropicUserContent, resolveAnthropicModel, resolveAnthropicSamplingOptions, } from "./messages.js";
8
- export { resolveAnthropicApiKey } from "./resolve-api-key.js";
9
- async function anthropicMessages(apiKey, body) {
10
- const res = await fetch("https://api.anthropic.com/v1/messages", {
11
- method: "POST",
12
- headers: {
13
- "x-api-key": apiKey,
14
- "anthropic-version": "2023-06-01",
15
- "content-type": "application/json",
16
- "anthropic-dangerous-direct-browser-access": "true",
17
- },
18
- body: JSON.stringify(body),
19
- });
20
- if (!res.ok) {
21
- let detail = "";
22
- try {
23
- detail = (await res.text()).slice(0, 500).trim();
24
- }
25
- catch {
26
- detail = "";
27
- }
28
- throw new Error(detail ? `Anthropic API error: ${res.status} (${detail})` : `Anthropic API error: ${res.status}`);
29
- }
30
- const data = (await res.json());
31
- return data.content.find((c) => c.type === "text")?.text ?? "";
32
- }
33
- /** Anthropic model provider. @category Extensions */
34
- export const anthropicExtension = defineExtension("@executioncontrolprotocol", "anthropic")
35
- .withSupportedRuntimes([NODE_RUNTIME_ID, BROWSER_RUNTIME_ID])
36
- .withConfig({
37
- apiKey: z.string().optional(),
38
- defaultModel: z.string().optional(),
39
- })
40
- .withMetadata({
41
- summary: "Anthropic Messages API for browser and Node hosts.",
42
- description: "Calls the Anthropic Messages API for multimodal chat completion and harness evaluation. Supports images and documents on the final user turn when files are supplied.",
43
- })
44
- .withCapabilities([
45
- capabilityFor("@executioncontrolprotocol/anthropic", "generate")
46
- .withExecution("local")
47
- .withInput(modelGenerateInputSchema)
48
- .withOutput(modelGenerateOutputSchema)
49
- .withMetadata({
50
- summary: "Generate text with multimodal Anthropic Messages.",
51
- description: "Runs chat completion against the Anthropic Messages API. Accepts images and documents on the final user turn in browser and Node hosts. Requires a configured API key. Supports system prompts, prior turns, and sampling options.",
52
- useCases: [
53
- "Workflow step analyzes an uploaded image alongside a user question.",
54
- "Browser or server harness needs long-context chat with document attachments.",
55
- ],
56
- samplePrompts: [
57
- "Describe this image and answer the user's question.",
58
- "Generate a reply using Claude with the attached PDF.",
59
- ],
60
- })
61
- .withHandler(async (raw, ctx) => {
62
- const input = modelGenerateInputSchema.parse(raw);
63
- const cfg = ctx.extensionConfig ?? {};
64
- const apiKey = resolveAnthropicApiKey(cfg);
65
- if (!apiKey)
66
- throw new Error("Anthropic API key required");
67
- const model = resolveAnthropicModel(input, cfg);
68
- const sampling = resolveAnthropicSamplingOptions(input.options);
69
- const turns = toProviderChatTurns({
70
- system: input.system,
71
- messages: input.messages,
72
- prompt: input.prompt,
73
- context: input.context,
74
- });
75
- const systemParts = turns
76
- .filter((turn) => turn.role === "system")
77
- .map((turn) => turn.content);
78
- const priorAndCurrent = turns.filter((turn) => turn.role !== "system");
79
- const messages = [];
80
- for (let i = 0; i < priorAndCurrent.length; i++) {
81
- const turn = priorAndCurrent[i];
82
- const isLast = i === priorAndCurrent.length - 1;
83
- if (turn.role !== "user" && turn.role !== "assistant") {
84
- continue;
85
- }
86
- if (isLast && turn.role === "user") {
87
- const content = await buildAnthropicUserContent(turn.content, input.files, ctx);
88
- messages.push({ role: "user", content });
89
- }
90
- else {
91
- messages.push({ role: turn.role, content: turn.content });
92
- }
93
- }
94
- ctx.usage.increment({ modelCalls: 1 });
95
- const text = await anthropicMessages(apiKey, {
96
- model,
97
- ...sampling,
98
- ...(systemParts.length > 0 ? { system: systemParts.join("\n\n") } : {}),
99
- messages,
100
- });
101
- return { text };
102
- }),
103
- capabilityFor("@executioncontrolprotocol/anthropic", "evaluate")
104
- .withExecution("local")
105
- .withInput(z.object({
106
- artifact: z.unknown(),
107
- criteria: z.unknown().optional(),
108
- goal: z.string().optional(),
109
- classifiedIntent: z.string().optional(),
110
- model: z.string().optional(),
111
- }))
112
- .withOutput(z.object({ approved: z.boolean(), feedback: z.string().optional() }))
113
- .withMetadata({
114
- summary: "Judge harness outputs with an Anthropic model.",
115
- description: "Scores harness artifacts against a goal, rubric, and optional classified intent. Returns approved and feedback. Skips when no API key is configured. Used by harness eval gates, not end-user chat.",
116
- useCases: [
117
- "Harness matrix uses a cloud judge with intent-aware rubrics.",
118
- "Eval approves FAQ answers separately from workflow patch outputs.",
119
- ],
120
- samplePrompts: [
121
- "Evaluate whether this harness artifact passes the rubric.",
122
- "Judge the classified intent output for this eval case.",
123
- ],
124
- })
125
- .withHandler(async (input, ctx) => {
126
- const cfg = ctx.extensionConfig ?? {};
127
- const apiKey = resolveAnthropicApiKey(cfg);
128
- if (!apiKey)
129
- return { approved: true, feedback: "skipped (no API key)" };
130
- const row = input;
131
- const prompt = [
132
- "You are an eval judge for ECP harness outputs.",
133
- 'Reply with JSON only: {"approved":true,"feedback":"ok"} or {"approved":false,"feedback":"reason"}.',
134
- `Goal: ${row.goal ?? "quality check"}`,
135
- row.classifiedIntent ? `Classified intent: ${row.classifiedIntent}` : "",
136
- row.criteria ? `Rubric: ${JSON.stringify(row.criteria)}` : "",
137
- `Artifact: ${JSON.stringify(row.artifact)}`,
138
- ]
139
- .filter((line) => line.length > 0)
140
- .join("\n");
141
- ctx.usage.increment({ modelCalls: 1 });
142
- const content = await anthropicMessages(apiKey, {
143
- model: row.model ??
144
- cfg.defaultModel ??
145
- ANTHROPIC_DEFAULT_MODEL,
146
- max_tokens: 1024,
147
- messages: [{ role: "user", content: prompt }],
148
- });
149
- try {
150
- return JSON.parse(content);
151
- }
152
- catch {
153
- return { approved: true, feedback: content };
154
- }
155
- }),
156
- ])
157
- .build();
158
- catalogExtension(anthropicExtension);
159
- /** Register Anthropic extension. @category Extensions */
160
- export async function registerAnthropicExtension(registry = globalRegistry) {
161
- if (!registry.getExtension("@executioncontrolprotocol/anthropic")) {
162
- await registry.registerExtension(anthropicExtension);
163
- }
164
- }
165
- export default anthropicExtension;
1
+ import { capability, definePlugin } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { anthropicConfigSchema, generateAcceptsSchema, generateReturnsSchema } from "./schemas.js";
3
+ export { ANTHROPIC_DEFAULT_MODEL, anthropicConfigSchema, generateAcceptsSchema, generateReturnsSchema, } from "./schemas.js";
4
+ /**
5
+ * Generate capability definition (for handler typing).
6
+ * @category Plugins
7
+ */
8
+ export const generate = capability({
9
+ summary: "Generate text with a Claude model.",
10
+ description: "Sends one user prompt, with an optional system prompt and optional images (FileRefs in JPEG, PNG, GIF or WebP, up to 5 MB each, read by the host), to the Anthropic Messages API using the model from the config object, and returns the reply text with token usage. Provider failures (bad key, rate limit, overload) fail the step with ECP_PROVIDER_ERROR and the HTTP status in details.",
11
+ useCases: [
12
+ "Draft, rewrite, summarise or translate text from a prompt",
13
+ "Turn upstream step output into a short caption, title or brief",
14
+ "Review or describe rendered images, such as checking a layout rendition against criteria",
15
+ ],
16
+ projections: [
17
+ "Take `text` for the reply; `usage` reports input and output tokens for cost tracking",
18
+ ],
19
+ accepts: generateAcceptsSchema,
20
+ returns: generateReturnsSchema,
21
+ timeoutMs: 120_000,
22
+ handler: () => import("./capabilities/generate.js"),
23
+ });
24
+ /**
25
+ * Anthropic plugin. Claude text generation through the Messages API.
26
+ * @category Plugins
27
+ */
28
+ export default definePlugin({
29
+ id: "@executioncontrolprotocol/anthropic",
30
+ summary: "Claude models from Anthropic.",
31
+ description: "Text generation with Claude through the Anthropic Messages API. The config object holds the API key (as a secret reference), the model and an optional base URL for proxies.",
32
+ config: anthropicConfigSchema,
33
+ capabilities: {
34
+ generate,
35
+ },
36
+ });
166
37
  //# 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,EACL,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,mBAAmB,GAGpB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACpC,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,KAAK,UAAU,iBAAiB,CAC9B,MAAc,EACd,IAA6B;IAE7B,MAAM,GAAG,GAAG,MAAM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CAAC,KAAK,UAAU,0BAA0B,CAC9C,WAAqB,cAAc;IAEnC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,qCAAqC,CAAC,EAAE,CAAC;QAClE,MAAM,QAAQ,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAA;IACtD,CAAC;AACH,CAAC;AAED,eAAe,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAElG,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,cAAc,CAAA;AAGrB;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;IACjC,OAAO,EAAE,oCAAoC;IAC7C,WAAW,EACT,+XAA+X;IACjY,QAAQ,EAAE;QACR,2DAA2D;QAC3D,gEAAgE;QAChE,0FAA0F;KAC3F;IACD,WAAW,EAAE;QACX,sFAAsF;KACvF;IACD,OAAO,EAAE,qBAAqB;IAC9B,OAAO,EAAE,qBAAqB;IAC9B,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,4BAA4B,CAAC;CACpD,CAAC,CAAA;AAEF;;;GAGG;AACH,eAAe,YAAY,CAAC;IAC1B,EAAE,EAAE,qCAAqC;IACzC,OAAO,EAAE,+BAA+B;IACxC,WAAW,EACT,8KAA8K;IAChL,MAAM,EAAE,qBAAqB;IAC7B,YAAY,EAAE;QACZ,QAAQ;KACT;CACF,CAAC,CAAA"}
@@ -0,0 +1,93 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Image media types the Messages API accepts.
4
+ * @category Plugins
5
+ */
6
+ export declare const ANTHROPIC_IMAGE_MEDIA_TYPES: readonly ["image/jpeg", "image/png", "image/gif", "image/webp"];
7
+ /**
8
+ * Model used when the config object doesn't name one.
9
+ * @category Plugins
10
+ */
11
+ export declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
12
+ /**
13
+ * Plugin config: API key, model and an optional API base URL.
14
+ * @category Plugins
15
+ */
16
+ export declare const anthropicConfigSchema: z.ZodObject<{
17
+ apiKey: z.ZodString;
18
+ model: z.ZodDefault<z.ZodString>;
19
+ baseUrl: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ /**
22
+ * Parsed plugin config, with the default model applied.
23
+ * @category Plugins
24
+ */
25
+ export type AnthropicConfig = z.infer<typeof anthropicConfigSchema>;
26
+ /**
27
+ * Input of the `generate` capability.
28
+ * @category Plugins
29
+ */
30
+ export declare const generateAcceptsSchema: z.ZodObject<{
31
+ prompt: z.ZodString;
32
+ system: z.ZodOptional<z.ZodString>;
33
+ maxTokens: z.ZodOptional<z.ZodNumber>;
34
+ images: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
35
+ kind: z.ZodLiteral<"file">;
36
+ path: z.ZodString;
37
+ mediaType: z.ZodOptional<z.ZodString>;
38
+ archive: z.ZodOptional<z.ZodObject<{
39
+ kind: z.ZodLiteral<"artifact">;
40
+ uri: z.ZodString;
41
+ mediaType: z.ZodOptional<z.ZodString>;
42
+ name: z.ZodOptional<z.ZodString>;
43
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
44
+ }, z.core.$strip>>;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ kind: z.ZodLiteral<"url">;
47
+ url: z.ZodString;
48
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
49
+ mediaType: z.ZodOptional<z.ZodString>;
50
+ archive: z.ZodOptional<z.ZodObject<{
51
+ kind: z.ZodLiteral<"artifact">;
52
+ uri: z.ZodString;
53
+ mediaType: z.ZodOptional<z.ZodString>;
54
+ name: z.ZodOptional<z.ZodString>;
55
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ kind: z.ZodLiteral<"artifact">;
59
+ uri: z.ZodString;
60
+ mediaType: z.ZodOptional<z.ZodString>;
61
+ name: z.ZodOptional<z.ZodString>;
62
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
63
+ archive: z.ZodOptional<z.ZodObject<{
64
+ kind: z.ZodLiteral<"artifact">;
65
+ uri: z.ZodString;
66
+ mediaType: z.ZodOptional<z.ZodString>;
67
+ name: z.ZodOptional<z.ZodString>;
68
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
69
+ }, z.core.$strip>>;
70
+ }, z.core.$strip>], "kind">>>;
71
+ }, z.core.$strip>;
72
+ /**
73
+ * Output of the `generate` capability.
74
+ * @category Plugins
75
+ */
76
+ export declare const generateReturnsSchema: z.ZodObject<{
77
+ text: z.ZodString;
78
+ usage: z.ZodObject<{
79
+ inputTokens: z.ZodNumber;
80
+ outputTokens: z.ZodNumber;
81
+ }, z.core.$strip>;
82
+ }, z.core.$strip>;
83
+ /**
84
+ * Typed input of the `generate` capability.
85
+ * @category Plugins
86
+ */
87
+ export type GenerateInput = z.infer<typeof generateAcceptsSchema>;
88
+ /**
89
+ * Typed output of the `generate` capability.
90
+ * @category Plugins
91
+ */
92
+ export type GenerateOutput = z.infer<typeof generateReturnsSchema>;
93
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;GAGG;AACH,eAAO,MAAM,2BAA2B,iEAAkE,CAAA;AAE1G;;;GAGG;AACH,eAAO,MAAM,uBAAuB,sBAAsB,CAAA;AAE1D;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;iBAIhC,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAShC,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;iBAMhC,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEjE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
@@ -0,0 +1,47 @@
1
+ import { fileRefSchema } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { z } from "zod";
3
+ /**
4
+ * Image media types the Messages API accepts.
5
+ * @category Plugins
6
+ */
7
+ export const ANTHROPIC_IMAGE_MEDIA_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
8
+ /**
9
+ * Model used when the config object doesn't name one.
10
+ * @category Plugins
11
+ */
12
+ export const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
13
+ /**
14
+ * Plugin config: API key, model and an optional API base URL.
15
+ * @category Plugins
16
+ */
17
+ export const anthropicConfigSchema = z.object({
18
+ apiKey: z.string(),
19
+ model: z.string().default(ANTHROPIC_DEFAULT_MODEL),
20
+ baseUrl: z.string().url().optional(),
21
+ });
22
+ /**
23
+ * Input of the `generate` capability.
24
+ * @category Plugins
25
+ */
26
+ export const generateAcceptsSchema = z.object({
27
+ prompt: z.string(),
28
+ system: z.string().optional(),
29
+ maxTokens: z.number().int().positive().optional(),
30
+ /** Images the model looks at with the prompt. Any FileRef kind: the host reads the bytes. */
31
+ images: z
32
+ .array(fileRefSchema({ access: "bytes", mediaTypes: [...ANTHROPIC_IMAGE_MEDIA_TYPES] }))
33
+ .max(20)
34
+ .optional(),
35
+ });
36
+ /**
37
+ * Output of the `generate` capability.
38
+ * @category Plugins
39
+ */
40
+ export const generateReturnsSchema = z.object({
41
+ text: z.string(),
42
+ usage: z.object({
43
+ inputTokens: z.number().int(),
44
+ outputTokens: z.number().int(),
45
+ }),
46
+ });
47
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,CAAU,CAAA;AAE1G;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAA;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC;IAClD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAA;AAQF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACjD,6FAA6F;IAC7F,MAAM,EAAE,CAAC;SACN,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,GAAG,2BAA2B,CAAC,EAAE,CAAC,CAAC;SACvF,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,EAAE;CACd,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;QAC7B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;KAC/B,CAAC;CACH,CAAC,CAAA"}
@@ -0,0 +1,35 @@
1
+ {
2
+ "capabilities": [
3
+ {
4
+ "description": "Sends one user prompt, with an optional system prompt and optional images (FileRefs in JPEG, PNG, GIF or WebP, up to 5 MB each, read by the host), to the Anthropic Messages API using the model from the config object, and returns the reply text with token usage. Provider failures (bad key, rate limit, overload) fail the step with ECP_PROVIDER_ERROR and the HTTP status in details.",
5
+ "id": "@executioncontrolprotocol/anthropic.generate",
6
+ "name": "generate",
7
+ "projections": [
8
+ "Take `text` for the reply; `usage` reports input and output tokens for cost tracking"
9
+ ],
10
+ "summary": "Generate text with a Claude model.",
11
+ "timeoutMs": 120000,
12
+ "useCases": [
13
+ "Draft, rewrite, summarise or translate text from a prompt",
14
+ "Turn upstream step output into a short caption, title or brief",
15
+ "Review or describe rendered images, such as checking a layout rendition against criteria"
16
+ ]
17
+ }
18
+ ],
19
+ "entry": "./dist/index.js",
20
+ "hash": "994871f33856b345fe8b5adadb13094287eef91dbcd93013ab5da5e16b44ae88",
21
+ "plugin": {
22
+ "description": "Text generation with Claude through the Anthropic Messages API. The config object holds the API key (as a secret reference), the model and an optional base URL for proxies.",
23
+ "id": "@executioncontrolprotocol/anthropic",
24
+ "package": "@executioncontrolprotocol/anthropic",
25
+ "summary": "Claude models from Anthropic.",
26
+ "version": "0.60.0"
27
+ },
28
+ "pluginSchema": {
29
+ "hash": "8d63ab0960b7a66a13b5d300183f635b44f95d069611f80395b0ed09200d4df6",
30
+ "path": "./ecp.schema.json"
31
+ },
32
+ "schema": "@executioncontrolprotocol.plugin-manifest",
33
+ "sdkVersion": "0.60.0",
34
+ "version": "2.0"
35
+ }
@@ -0,0 +1,255 @@
1
+ {
2
+ "$defs": {
3
+ "config": {
4
+ "properties": {
5
+ "apiKey": {
6
+ "type": "string"
7
+ },
8
+ "baseUrl": {
9
+ "format": "uri",
10
+ "type": "string"
11
+ },
12
+ "model": {
13
+ "default": "claude-sonnet-4-5",
14
+ "type": "string"
15
+ }
16
+ },
17
+ "required": [
18
+ "apiKey"
19
+ ],
20
+ "type": "object"
21
+ },
22
+ "generate.accepts": {
23
+ "properties": {
24
+ "images": {
25
+ "items": {
26
+ "oneOf": [
27
+ {
28
+ "properties": {
29
+ "archive": {
30
+ "properties": {
31
+ "kind": {
32
+ "const": "artifact",
33
+ "type": "string"
34
+ },
35
+ "mediaType": {
36
+ "type": "string"
37
+ },
38
+ "name": {
39
+ "type": "string"
40
+ },
41
+ "sizeBytes": {
42
+ "maximum": 9007199254740991,
43
+ "minimum": 0,
44
+ "type": "integer"
45
+ },
46
+ "uri": {
47
+ "minLength": 1,
48
+ "type": "string"
49
+ }
50
+ },
51
+ "required": [
52
+ "kind",
53
+ "uri"
54
+ ],
55
+ "type": "object"
56
+ },
57
+ "kind": {
58
+ "const": "file",
59
+ "type": "string"
60
+ },
61
+ "mediaType": {
62
+ "type": "string"
63
+ },
64
+ "path": {
65
+ "minLength": 1,
66
+ "type": "string"
67
+ }
68
+ },
69
+ "required": [
70
+ "kind",
71
+ "path"
72
+ ],
73
+ "type": "object"
74
+ },
75
+ {
76
+ "properties": {
77
+ "archive": {
78
+ "properties": {
79
+ "kind": {
80
+ "const": "artifact",
81
+ "type": "string"
82
+ },
83
+ "mediaType": {
84
+ "type": "string"
85
+ },
86
+ "name": {
87
+ "type": "string"
88
+ },
89
+ "sizeBytes": {
90
+ "maximum": 9007199254740991,
91
+ "minimum": 0,
92
+ "type": "integer"
93
+ },
94
+ "uri": {
95
+ "minLength": 1,
96
+ "type": "string"
97
+ }
98
+ },
99
+ "required": [
100
+ "kind",
101
+ "uri"
102
+ ],
103
+ "type": "object"
104
+ },
105
+ "headers": {
106
+ "additionalProperties": {
107
+ "type": "string"
108
+ },
109
+ "propertyNames": {
110
+ "type": "string"
111
+ },
112
+ "type": "object"
113
+ },
114
+ "kind": {
115
+ "const": "url",
116
+ "type": "string"
117
+ },
118
+ "mediaType": {
119
+ "type": "string"
120
+ },
121
+ "url": {
122
+ "format": "uri",
123
+ "type": "string"
124
+ }
125
+ },
126
+ "required": [
127
+ "kind",
128
+ "url"
129
+ ],
130
+ "type": "object"
131
+ },
132
+ {
133
+ "properties": {
134
+ "archive": {
135
+ "properties": {
136
+ "kind": {
137
+ "const": "artifact",
138
+ "type": "string"
139
+ },
140
+ "mediaType": {
141
+ "type": "string"
142
+ },
143
+ "name": {
144
+ "type": "string"
145
+ },
146
+ "sizeBytes": {
147
+ "maximum": 9007199254740991,
148
+ "minimum": 0,
149
+ "type": "integer"
150
+ },
151
+ "uri": {
152
+ "minLength": 1,
153
+ "type": "string"
154
+ }
155
+ },
156
+ "required": [
157
+ "kind",
158
+ "uri"
159
+ ],
160
+ "type": "object"
161
+ },
162
+ "kind": {
163
+ "const": "artifact",
164
+ "type": "string"
165
+ },
166
+ "mediaType": {
167
+ "type": "string"
168
+ },
169
+ "name": {
170
+ "type": "string"
171
+ },
172
+ "sizeBytes": {
173
+ "maximum": 9007199254740991,
174
+ "minimum": 0,
175
+ "type": "integer"
176
+ },
177
+ "uri": {
178
+ "minLength": 1,
179
+ "type": "string"
180
+ }
181
+ },
182
+ "required": [
183
+ "kind",
184
+ "uri"
185
+ ],
186
+ "type": "object"
187
+ }
188
+ ],
189
+ "x-ecp-file": {
190
+ "access": "bytes",
191
+ "mediaTypes": [
192
+ "image/jpeg",
193
+ "image/png",
194
+ "image/gif",
195
+ "image/webp"
196
+ ]
197
+ }
198
+ },
199
+ "maxItems": 20,
200
+ "type": "array"
201
+ },
202
+ "maxTokens": {
203
+ "exclusiveMinimum": 0,
204
+ "maximum": 9007199254740991,
205
+ "type": "integer"
206
+ },
207
+ "prompt": {
208
+ "type": "string"
209
+ },
210
+ "system": {
211
+ "type": "string"
212
+ }
213
+ },
214
+ "required": [
215
+ "prompt"
216
+ ],
217
+ "type": "object"
218
+ },
219
+ "generate.returns": {
220
+ "additionalProperties": false,
221
+ "properties": {
222
+ "text": {
223
+ "type": "string"
224
+ },
225
+ "usage": {
226
+ "additionalProperties": false,
227
+ "properties": {
228
+ "inputTokens": {
229
+ "maximum": 9007199254740991,
230
+ "minimum": -9007199254740991,
231
+ "type": "integer"
232
+ },
233
+ "outputTokens": {
234
+ "maximum": 9007199254740991,
235
+ "minimum": -9007199254740991,
236
+ "type": "integer"
237
+ }
238
+ },
239
+ "required": [
240
+ "inputTokens",
241
+ "outputTokens"
242
+ ],
243
+ "type": "object"
244
+ }
245
+ },
246
+ "required": [
247
+ "text",
248
+ "usage"
249
+ ],
250
+ "type": "object"
251
+ }
252
+ },
253
+ "$id": "ecp://plugins/@executioncontrolprotocol/anthropic/0.60.0/schema.json",
254
+ "$schema": "https://json-schema.org/draft/2020-12/schema"
255
+ }
package/package.json CHANGED
@@ -1,33 +1,44 @@
1
1
  {
2
2
  "name": "@executioncontrolprotocol/anthropic",
3
- "version": "0.13.2",
4
- "description": "Anthropic Claude model provider for ECP",
5
- "license": "Apache-2.0",
3
+ "version": "0.60.0",
4
+ "description": "Claude text generation through the Anthropic Messages API.",
6
5
  "type": "module",
7
- "main": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
6
+ "engines": {
7
+ "node": ">=22.12"
8
+ },
9
+ "keywords": [
10
+ "ecosystem:ecp-plugin",
11
+ "oclif-plugin"
12
+ ],
13
+ "oclif": {},
14
+ "ecp": {
15
+ "manifest": "./ecp.manifest.json",
16
+ "schema": "./ecp.schema.json"
17
+ },
9
18
  "exports": {
10
19
  ".": {
11
20
  "types": "./dist/index.d.ts",
12
21
  "import": "./dist/index.js"
13
- }
22
+ },
23
+ "./ecp.manifest.json": "./ecp.manifest.json",
24
+ "./ecp.schema.json": "./ecp.schema.json"
14
25
  },
26
+ "types": "./dist/index.d.ts",
15
27
  "files": [
16
28
  "dist",
17
- "README.md"
29
+ "ecp.manifest.json",
30
+ "ecp.schema.json"
18
31
  ],
19
32
  "peerDependencies": {
20
- "zod": "^3.24.0",
21
- "@executioncontrolprotocol/core": "^0.13.2",
22
- "@executioncontrolprotocol/types": "^0.13.2"
33
+ "zod": "^4.0.0",
34
+ "@executioncontrolprotocol/plugin-sdk": "0.60.0"
23
35
  },
24
36
  "devDependencies": {
25
- "typescript": "^5.7.0",
26
- "zod": "^3.24.0",
27
- "@executioncontrolprotocol/core": "^0.13.2",
28
- "@executioncontrolprotocol/types": "^0.13.2"
37
+ "zod": "^4.0.0",
38
+ "@executioncontrolprotocol/plugin-sdk": "0.60.0"
29
39
  },
30
40
  "scripts": {
31
- "build": "tsc -b"
41
+ "build": "tsc -b && node ../../packages/plugin-sdk/dist/bin/ecp-plugin-manifest.js",
42
+ "check:manifest": "node ../../packages/plugin-sdk/dist/bin/ecp-plugin-manifest.js --check"
32
43
  }
33
44
  }
@@ -1,19 +0,0 @@
1
- /** Anthropic Messages image MIME types. @category Extensions */
2
- export declare const ANTHROPIC_GENERATE_IMAGE_MEDIA_TYPES: readonly ["image/jpeg", "image/png", "image/gif", "image/webp"];
3
- /** Anthropic Messages document MIME types. @category Extensions */
4
- export declare const ANTHROPIC_GENERATE_DOCUMENT_MEDIA_TYPES: readonly ["application/pdf"];
5
- /** All MIME types accepted by anthropic.generate files. @category Extensions */
6
- export declare const ANTHROPIC_GENERATE_MEDIA_TYPES: readonly ["image/jpeg", "image/png", "image/gif", "image/webp", "application/pdf"];
7
- /** Anthropic image MIME union. @category Extensions */
8
- export type AnthropicGenerateImageMediaType = (typeof ANTHROPIC_GENERATE_IMAGE_MEDIA_TYPES)[number];
9
- /** Anthropic document MIME union. @category Extensions */
10
- export type AnthropicGenerateDocumentMediaType = (typeof ANTHROPIC_GENERATE_DOCUMENT_MEDIA_TYPES)[number];
11
- /** Anthropic generate file MIME union. @category Extensions */
12
- export type AnthropicGenerateMediaType = (typeof ANTHROPIC_GENERATE_MEDIA_TYPES)[number];
13
- /** Whether MIME is an Anthropic image block type. @category Extensions */
14
- export declare function isAnthropicImageMediaType(mediaType: string): mediaType is AnthropicGenerateImageMediaType;
15
- /** Whether MIME is an Anthropic document block type. @category Extensions */
16
- export declare function isAnthropicDocumentMediaType(mediaType: string): mediaType is AnthropicGenerateDocumentMediaType;
17
- /** Whether MIME is accepted by anthropic.generate files. @category Extensions */
18
- export declare function isAnthropicGenerateMediaType(mediaType: string): mediaType is AnthropicGenerateMediaType;
19
- //# sourceMappingURL=media-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"media-types.d.ts","sourceRoot":"","sources":["../src/media-types.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,eAAO,MAAM,oCAAoC,iEAKvC,CAAA;AAEV,mEAAmE;AACnE,eAAO,MAAM,uCAAuC,8BAA+B,CAAA;AAEnF,gFAAgF;AAChF,eAAO,MAAM,8BAA8B,oFAGjC,CAAA;AAEV,uDAAuD;AACvD,MAAM,MAAM,+BAA+B,GACzC,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,0DAA0D;AAC1D,MAAM,MAAM,kCAAkC,GAC5C,CAAC,OAAO,uCAAuC,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1D,+DAA+D;AAC/D,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAA;AAKxF,0EAA0E;AAC1E,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,IAAI,+BAA+B,CAEzG;AAED,6EAA6E;AAC7E,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAChB,SAAS,IAAI,kCAAkC,CAEjD;AAED,iFAAiF;AACjF,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,IAAI,0BAA0B,CAEvG"}
@@ -1,29 +0,0 @@
1
- /** Anthropic Messages image MIME types. @category Extensions */
2
- export const ANTHROPIC_GENERATE_IMAGE_MEDIA_TYPES = [
3
- "image/jpeg",
4
- "image/png",
5
- "image/gif",
6
- "image/webp",
7
- ];
8
- /** Anthropic Messages document MIME types. @category Extensions */
9
- export const ANTHROPIC_GENERATE_DOCUMENT_MEDIA_TYPES = ["application/pdf"];
10
- /** All MIME types accepted by anthropic.generate files. @category Extensions */
11
- export const ANTHROPIC_GENERATE_MEDIA_TYPES = [
12
- ...ANTHROPIC_GENERATE_IMAGE_MEDIA_TYPES,
13
- ...ANTHROPIC_GENERATE_DOCUMENT_MEDIA_TYPES,
14
- ];
15
- const IMAGE_SET = new Set(ANTHROPIC_GENERATE_IMAGE_MEDIA_TYPES);
16
- const DOCUMENT_SET = new Set(ANTHROPIC_GENERATE_DOCUMENT_MEDIA_TYPES);
17
- /** Whether MIME is an Anthropic image block type. @category Extensions */
18
- export function isAnthropicImageMediaType(mediaType) {
19
- return IMAGE_SET.has(mediaType);
20
- }
21
- /** Whether MIME is an Anthropic document block type. @category Extensions */
22
- export function isAnthropicDocumentMediaType(mediaType) {
23
- return DOCUMENT_SET.has(mediaType);
24
- }
25
- /** Whether MIME is accepted by anthropic.generate files. @category Extensions */
26
- export function isAnthropicGenerateMediaType(mediaType) {
27
- return IMAGE_SET.has(mediaType) || DOCUMENT_SET.has(mediaType);
28
- }
29
- //# sourceMappingURL=media-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"media-types.js","sourceRoot":"","sources":["../src/media-types.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,CAAC,MAAM,oCAAoC,GAAG;IAClD,YAAY;IACZ,WAAW;IACX,WAAW;IACX,YAAY;CACJ,CAAA;AAEV,mEAAmE;AACnE,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,iBAAiB,CAAU,CAAA;AAEnF,gFAAgF;AAChF,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,GAAG,oCAAoC;IACvC,GAAG,uCAAuC;CAClC,CAAA;AAaV,MAAM,SAAS,GAAG,IAAI,GAAG,CAAS,oCAAoC,CAAC,CAAA;AACvE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS,uCAAuC,CAAC,CAAA;AAE7E,0EAA0E;AAC1E,MAAM,UAAU,yBAAyB,CAAC,SAAiB;IACzD,OAAO,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AACjC,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,4BAA4B,CAC1C,SAAiB;IAEjB,OAAO,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AACpC,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,4BAA4B,CAAC,SAAiB;IAC5D,OAAO,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AAChE,CAAC"}
@@ -1,50 +0,0 @@
1
- import { type FileRef, type ModelGenerateInput } from "@executioncontrolprotocol/types";
2
- import { type FileCapabilityContext } from "@executioncontrolprotocol/core";
3
- import { type AnthropicGenerateDocumentMediaType, type AnthropicGenerateImageMediaType } from "./media-types.js";
4
- /** Default max tokens when options omit max_tokens. @category Extensions */
5
- export declare const ANTHROPIC_DEFAULT_MAX_TOKENS = 4096;
6
- /** Default Claude model for generate. @category Extensions */
7
- export declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
8
- interface AnthropicTextBlock {
9
- type: "text";
10
- text: string;
11
- }
12
- interface AnthropicImageBlock {
13
- type: "image";
14
- source: {
15
- type: "base64";
16
- media_type: AnthropicGenerateImageMediaType;
17
- data: string;
18
- } | {
19
- type: "url";
20
- url: string;
21
- };
22
- }
23
- interface AnthropicDocumentBlock {
24
- type: "document";
25
- source: {
26
- type: "base64";
27
- media_type: AnthropicGenerateDocumentMediaType;
28
- data: string;
29
- } | {
30
- type: "url";
31
- url: string;
32
- };
33
- }
34
- /** Anthropic user message content block. @category Extensions */
35
- export type AnthropicContentBlock = AnthropicTextBlock | AnthropicImageBlock | AnthropicDocumentBlock;
36
- /**
37
- * Map portable file refs to Anthropic Messages content blocks (media before text).
38
- * @category Extensions
39
- */
40
- export declare function buildAnthropicUserContent(prompt: string, files: FileRef[] | undefined, ctx: FileCapabilityContext): Promise<AnthropicContentBlock[]>;
41
- /** Resolve sampling options for Anthropic (temperature XOR top_p). @category Extensions */
42
- export declare function resolveAnthropicSamplingOptions(options: Record<string, unknown> | undefined): {
43
- max_tokens: number;
44
- temperature?: number;
45
- top_p?: number;
46
- };
47
- /** Build Messages API body fields from normalized generate input. @category Extensions */
48
- export declare function resolveAnthropicModel(input: Pick<ModelGenerateInput, "model">, cfg: Record<string, unknown>): string;
49
- export {};
50
- //# sourceMappingURL=messages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAe,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACxF,OAAO,EAIL,KAAK,kCAAkC,EACvC,KAAK,+BAA+B,EACrC,MAAM,kBAAkB,CAAA;AAEzB,4EAA4E;AAC5E,eAAO,MAAM,4BAA4B,OAAO,CAAA;AAEhD,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,sBAAsB,CAAA;AAE1D,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EACF;QACE,IAAI,EAAE,QAAQ,CAAA;QACd,UAAU,EAAE,+BAA+B,CAAA;QAC3C,IAAI,EAAE,MAAM,CAAA;KACb,GACD;QACE,IAAI,EAAE,KAAK,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;CACN;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EACF;QACE,IAAI,EAAE,QAAQ,CAAA;QACd,UAAU,EAAE,kCAAkC,CAAA;QAC9C,IAAI,EAAE,MAAM,CAAA;KACb,GACD;QACE,IAAI,EAAE,KAAK,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;CACN;AAED,iEAAiE;AACjE,MAAM,MAAM,qBAAqB,GAC7B,kBAAkB,GAClB,mBAAmB,GACnB,sBAAsB,CAAA;AAmB1B;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,EAC5B,GAAG,EAAE,qBAAqB,GACzB,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAuClC;AAED,2FAA2F;AAC3F,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC3C;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA0B9D;AAED,0FAA0F;AAC1F,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,EACxC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,MAAM,CAER"}
package/dist/messages.js DELETED
@@ -1,92 +0,0 @@
1
- import { FILE_REF_KINDS, } from "@executioncontrolprotocol/types";
2
- import { resolveFile } from "@executioncontrolprotocol/core";
3
- import { isAnthropicDocumentMediaType, isAnthropicGenerateMediaType, isAnthropicImageMediaType, } from "./media-types.js";
4
- /** Default max tokens when options omit max_tokens. @category Extensions */
5
- export const ANTHROPIC_DEFAULT_MAX_TOKENS = 4096;
6
- /** Default Claude model for generate. @category Extensions */
7
- export const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
8
- function bytesToBase64(bytes) {
9
- if (typeof Buffer !== "undefined") {
10
- return Buffer.from(bytes).toString("base64");
11
- }
12
- let binary = "";
13
- for (const byte of bytes) {
14
- binary += String.fromCharCode(byte);
15
- }
16
- return btoa(binary);
17
- }
18
- function normalizeMediaType(mediaType, fallbackHint) {
19
- const raw = (mediaType ?? fallbackHint ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
20
- if (raw === "image/jpg")
21
- return "image/jpeg";
22
- return raw;
23
- }
24
- /**
25
- * Map portable file refs to Anthropic Messages content blocks (media before text).
26
- * @category Extensions
27
- */
28
- export async function buildAnthropicUserContent(prompt, files, ctx) {
29
- const mediaBlocks = [];
30
- for (const ref of files ?? []) {
31
- if (ref.kind === FILE_REF_KINDS.URL) {
32
- const mediaType = normalizeMediaType(ref.mediaType);
33
- if (!mediaType || !isAnthropicGenerateMediaType(mediaType)) {
34
- throw new Error(`Unsupported Anthropic generate file media type: ${mediaType || "(missing)"}. Allowed: image/jpeg, image/png, image/gif, image/webp, application/pdf`);
35
- }
36
- if (isAnthropicImageMediaType(mediaType)) {
37
- mediaBlocks.push({ type: "image", source: { type: "url", url: ref.url } });
38
- }
39
- else {
40
- mediaBlocks.push({ type: "document", source: { type: "url", url: ref.url } });
41
- }
42
- continue;
43
- }
44
- const resolved = await resolveFile(ref, ctx, { allowRemoteUrls: false });
45
- const mediaType = normalizeMediaType(resolved.mediaType, ref.mediaType);
46
- if (!mediaType || !isAnthropicGenerateMediaType(mediaType)) {
47
- throw new Error(`Unsupported Anthropic generate file media type: ${mediaType || "(missing)"}. Allowed: image/jpeg, image/png, image/gif, image/webp, application/pdf`);
48
- }
49
- const data = bytesToBase64(resolved.bytes);
50
- if (isAnthropicImageMediaType(mediaType)) {
51
- mediaBlocks.push({
52
- type: "image",
53
- source: { type: "base64", media_type: mediaType, data },
54
- });
55
- }
56
- else if (isAnthropicDocumentMediaType(mediaType)) {
57
- mediaBlocks.push({
58
- type: "document",
59
- source: { type: "base64", media_type: mediaType, data },
60
- });
61
- }
62
- }
63
- return [...mediaBlocks, { type: "text", text: prompt }];
64
- }
65
- /** Resolve sampling options for Anthropic (temperature XOR top_p). @category Extensions */
66
- export function resolveAnthropicSamplingOptions(options) {
67
- const maxTokensRaw = options?.max_tokens ?? options?.maxTokens;
68
- const max_tokens = typeof maxTokensRaw === "number" && Number.isFinite(maxTokensRaw) && maxTokensRaw > 0
69
- ? Math.floor(maxTokensRaw)
70
- : ANTHROPIC_DEFAULT_MAX_TOKENS;
71
- const temperature = typeof options?.temperature === "number" && Number.isFinite(options.temperature)
72
- ? options.temperature
73
- : undefined;
74
- const topP = typeof options?.top_p === "number" && Number.isFinite(options.top_p)
75
- ? options.top_p
76
- : typeof options?.topP === "number" && Number.isFinite(options.topP)
77
- ? options.topP
78
- : undefined;
79
- // Anthropic rejects setting both temperature and top_p.
80
- if (temperature !== undefined) {
81
- return { max_tokens, temperature };
82
- }
83
- if (topP !== undefined) {
84
- return { max_tokens, top_p: topP };
85
- }
86
- return { max_tokens };
87
- }
88
- /** Build Messages API body fields from normalized generate input. @category Extensions */
89
- export function resolveAnthropicModel(input, cfg) {
90
- return input.model ?? cfg.defaultModel ?? ANTHROPIC_DEFAULT_MODEL;
91
- }
92
- //# sourceMappingURL=messages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAGf,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,WAAW,EAA8B,MAAM,gCAAgC,CAAA;AACxF,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB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AAU,EAAE,WAAW,EAAE,CAAA;IACpC,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IACpC,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,CAAA;AACvB,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,qBAAqB,CACnC,KAAwC,EACxC,GAA4B;IAE5B,OAAO,KAAK,CAAC,KAAK,IAAK,GAAG,CAAC,YAAmC,IAAI,uBAAuB,CAAA;AAC3F,CAAC"}
@@ -1,3 +0,0 @@
1
- /** Resolve Anthropic API key from extension config, optionally process.env on Node. */
2
- export declare function resolveAnthropicApiKey(cfg: Record<string, unknown>): string;
3
- //# sourceMappingURL=resolve-api-key.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-api-key.d.ts","sourceRoot":"","sources":["../src/resolve-api-key.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAO3E"}
@@ -1,11 +0,0 @@
1
- /** Resolve Anthropic API key from extension config, optionally process.env on Node. */
2
- export function resolveAnthropicApiKey(cfg) {
3
- const fromConfig = cfg.apiKey;
4
- if (fromConfig)
5
- return fromConfig;
6
- if (typeof process !== "undefined" && process.env?.ANTHROPIC_API_KEY) {
7
- return process.env.ANTHROPIC_API_KEY;
8
- }
9
- return "";
10
- }
11
- //# sourceMappingURL=resolve-api-key.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-api-key.js","sourceRoot":"","sources":["../src/resolve-api-key.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,UAAU,sBAAsB,CAAC,GAA4B;IACjE,MAAM,UAAU,GAAG,GAAG,CAAC,MAA4B,CAAA;IACnD,IAAI,UAAU;QAAE,OAAO,UAAU,CAAA;IACjC,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,CAAC;QACrE,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAA;IACtC,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC"}