@vibesdotdev/integrations-anthropic 0.0.0-stage → 1.0.0-rc.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.
Files changed (150) hide show
  1. package/LICENSE +126 -0
  2. package/README.md +57 -2
  3. package/dist/ai/anthropic-router-codec.d.ts +32 -0
  4. package/dist/ai/anthropic-router-codec.d.ts.map +1 -0
  5. package/dist/ai/anthropic-router-codec.js +321 -0
  6. package/dist/ai/anthropic-router-codec.js.map +1 -0
  7. package/dist/ai/anthropic.plugin.d.ts +6 -0
  8. package/dist/ai/anthropic.plugin.d.ts.map +1 -0
  9. package/dist/ai/anthropic.plugin.js +116 -0
  10. package/dist/ai/anthropic.plugin.js.map +1 -0
  11. package/dist/ai/catalog.d.ts +87 -0
  12. package/dist/ai/catalog.d.ts.map +1 -0
  13. package/dist/ai/catalog.js +64 -0
  14. package/dist/ai/catalog.js.map +1 -0
  15. package/dist/ai/claude-code-session.d.ts +56 -0
  16. package/dist/ai/claude-code-session.d.ts.map +1 -0
  17. package/dist/ai/claude-code-session.js +75 -0
  18. package/dist/ai/claude-code-session.js.map +1 -0
  19. package/dist/ai/claude-code-turn-env.d.ts +10 -0
  20. package/dist/ai/claude-code-turn-env.d.ts.map +1 -0
  21. package/dist/ai/claude-code-turn-env.js +19 -0
  22. package/dist/ai/claude-code-turn-env.js.map +1 -0
  23. package/dist/ai/hostile.d.ts +23 -0
  24. package/dist/ai/hostile.d.ts.map +1 -0
  25. package/dist/ai/hostile.js +22 -0
  26. package/dist/ai/hostile.js.map +1 -0
  27. package/dist/ai/index.d.ts +4 -0
  28. package/dist/ai/index.d.ts.map +1 -0
  29. package/dist/ai/index.js +4 -0
  30. package/dist/ai/index.js.map +1 -0
  31. package/dist/ai/metadata/assets/logos/providers/anthropic.svg +1 -0
  32. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-3-5-haiku-20241022.json +77 -0
  33. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-3-5-sonnet-20241022.json +42 -0
  34. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-4-opus-20250514.json +79 -0
  35. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-4-sonnet-20250514.json +79 -0
  36. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-haiku-4-5.json +80 -0
  37. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-haiku-5-5.json +39 -0
  38. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-opus-4-1.json +78 -0
  39. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-opus-4-5.json +80 -0
  40. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-opus-4-6.json +80 -0
  41. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-opus-4-7.json +81 -0
  42. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-sonnet-4-5.json +80 -0
  43. package/dist/ai/metadata/provider-models/anthropic/anthropic-claude-sonnet-4-6.json +80 -0
  44. package/dist/ai/metadata/providers/anthropic.json +22 -0
  45. package/dist/ai/providers/anthropic/anthropic.provider.impl.d.ts +62 -0
  46. package/dist/ai/providers/anthropic/anthropic.provider.impl.d.ts.map +1 -0
  47. package/dist/ai/providers/anthropic/anthropic.provider.impl.js +430 -0
  48. package/dist/ai/providers/anthropic/anthropic.provider.impl.js.map +1 -0
  49. package/dist/ai/providers/anthropic/detection/index.d.ts +8 -0
  50. package/dist/ai/providers/anthropic/detection/index.d.ts.map +1 -0
  51. package/dist/ai/providers/anthropic/detection/index.js +8 -0
  52. package/dist/ai/providers/anthropic/detection/index.js.map +1 -0
  53. package/dist/ai/providers/anthropic/detection/system.d.ts +12 -0
  54. package/dist/ai/providers/anthropic/detection/system.d.ts.map +1 -0
  55. package/dist/ai/providers/anthropic/detection/system.js +34 -0
  56. package/dist/ai/providers/anthropic/detection/system.js.map +1 -0
  57. package/dist/ai/providers/anthropic/docs/ai.providers.anthropic.docs.descriptor.d.ts +4 -0
  58. package/dist/ai/providers/anthropic/docs/ai.providers.anthropic.docs.descriptor.d.ts.map +1 -0
  59. package/dist/ai/providers/anthropic/docs/ai.providers.anthropic.docs.descriptor.js +212 -0
  60. package/dist/ai/providers/anthropic/docs/ai.providers.anthropic.docs.descriptor.js.map +1 -0
  61. package/dist/ai/providers/anthropic/index.d.ts +4 -0
  62. package/dist/ai/providers/anthropic/index.d.ts.map +1 -0
  63. package/dist/ai/providers/anthropic/index.js +4 -0
  64. package/dist/ai/providers/anthropic/index.js.map +1 -0
  65. package/dist/ai/providers/anthropic/recommendations.d.ts +24 -0
  66. package/dist/ai/providers/anthropic/recommendations.d.ts.map +1 -0
  67. package/dist/ai/providers/anthropic/recommendations.js +192 -0
  68. package/dist/ai/providers/anthropic/recommendations.js.map +1 -0
  69. package/dist/ai/providers/cloud/frontier/anthropic/config/config.anthropic.descriptor.d.ts +4194 -0
  70. package/dist/ai/providers/cloud/frontier/anthropic/config/config.anthropic.descriptor.d.ts.map +1 -0
  71. package/dist/ai/providers/cloud/frontier/anthropic/config/config.anthropic.descriptor.js +52 -0
  72. package/dist/ai/providers/cloud/frontier/anthropic/config/config.anthropic.descriptor.js.map +1 -0
  73. package/dist/ai/providers/cloud/frontier/anthropic/config/schemas/index.d.ts +46 -0
  74. package/dist/ai/providers/cloud/frontier/anthropic/config/schemas/index.d.ts.map +1 -0
  75. package/dist/ai/providers/cloud/frontier/anthropic/config/schemas/index.js +22 -0
  76. package/dist/ai/providers/cloud/frontier/anthropic/config/schemas/index.js.map +1 -0
  77. package/dist/ai/providers/cloud/frontier/anthropic/index.d.ts +5 -0
  78. package/dist/ai/providers/cloud/frontier/anthropic/index.d.ts.map +1 -0
  79. package/dist/ai/providers/cloud/frontier/anthropic/index.js +4 -0
  80. package/dist/ai/providers/cloud/frontier/anthropic/index.js.map +1 -0
  81. package/dist/ai/providers/cloud/frontier/anthropic/provider.anthropic.descriptor.d.ts +183 -0
  82. package/dist/ai/providers/cloud/frontier/anthropic/provider.anthropic.descriptor.d.ts.map +1 -0
  83. package/dist/ai/providers/cloud/frontier/anthropic/provider.anthropic.descriptor.js +115 -0
  84. package/dist/ai/providers/cloud/frontier/anthropic/provider.anthropic.descriptor.js.map +1 -0
  85. package/dist/ai/specs/anthropic-messages/anthropic-messages.failures.d.ts +46 -0
  86. package/dist/ai/specs/anthropic-messages/anthropic-messages.failures.d.ts.map +1 -0
  87. package/dist/ai/specs/anthropic-messages/anthropic-messages.failures.js +183 -0
  88. package/dist/ai/specs/anthropic-messages/anthropic-messages.failures.js.map +1 -0
  89. package/dist/ai/specs/anthropic-messages/anthropic-messages.spec.descriptor.d.ts +34 -0
  90. package/dist/ai/specs/anthropic-messages/anthropic-messages.spec.descriptor.d.ts.map +1 -0
  91. package/dist/ai/specs/anthropic-messages/anthropic-messages.spec.descriptor.js +29 -0
  92. package/dist/ai/specs/anthropic-messages/anthropic-messages.spec.descriptor.js.map +1 -0
  93. package/dist/ai/specs/anthropic-messages/anthropic-messages.spec.impl.d.ts +48 -0
  94. package/dist/ai/specs/anthropic-messages/anthropic-messages.spec.impl.d.ts.map +1 -0
  95. package/dist/ai/specs/anthropic-messages/anthropic-messages.spec.impl.js +557 -0
  96. package/dist/ai/specs/anthropic-messages/anthropic-messages.spec.impl.js.map +1 -0
  97. package/dist/ai/specs/claude-code-exec/claude-code-exec.spec.descriptor.d.ts +26 -0
  98. package/dist/ai/specs/claude-code-exec/claude-code-exec.spec.descriptor.d.ts.map +1 -0
  99. package/dist/ai/specs/claude-code-exec/claude-code-exec.spec.descriptor.js +15 -0
  100. package/dist/ai/specs/claude-code-exec/claude-code-exec.spec.descriptor.js.map +1 -0
  101. package/dist/ai/specs/claude-code-exec/claude-code-exec.spec.impl.d.ts +35 -0
  102. package/dist/ai/specs/claude-code-exec/claude-code-exec.spec.impl.d.ts.map +1 -0
  103. package/dist/ai/specs/claude-code-exec/claude-code-exec.spec.impl.js +210 -0
  104. package/dist/ai/specs/claude-code-exec/claude-code-exec.spec.impl.js.map +1 -0
  105. package/dist/external/acp-server.consumer.plugin.d.ts +3 -0
  106. package/dist/external/acp-server.consumer.plugin.d.ts.map +1 -0
  107. package/dist/external/acp-server.consumer.plugin.js +29 -0
  108. package/dist/external/acp-server.consumer.plugin.js.map +1 -0
  109. package/dist/external/acp-server.d.ts +19 -0
  110. package/dist/external/acp-server.d.ts.map +1 -0
  111. package/dist/external/acp-server.js +198 -0
  112. package/dist/external/acp-server.js.map +1 -0
  113. package/dist/external/claude-code-hooks.d.ts +51 -0
  114. package/dist/external/claude-code-hooks.d.ts.map +1 -0
  115. package/dist/external/claude-code-hooks.js +252 -0
  116. package/dist/external/claude-code-hooks.js.map +1 -0
  117. package/dist/external/claude-code-installer.d.ts +10 -0
  118. package/dist/external/claude-code-installer.d.ts.map +1 -0
  119. package/dist/external/claude-code-installer.js +604 -0
  120. package/dist/external/claude-code-installer.js.map +1 -0
  121. package/dist/external/claude-code-operations.d.ts +217 -0
  122. package/dist/external/claude-code-operations.d.ts.map +1 -0
  123. package/dist/external/claude-code-operations.js +101 -0
  124. package/dist/external/claude-code-operations.js.map +1 -0
  125. package/dist/external/claude-code-plugin.json +7 -0
  126. package/dist/external/claude-code-presets.d.ts +813 -0
  127. package/dist/external/claude-code-presets.d.ts.map +1 -0
  128. package/dist/external/claude-code-presets.js +157 -0
  129. package/dist/external/claude-code-presets.js.map +1 -0
  130. package/dist/external/claude-code.descriptor.d.ts +160 -0
  131. package/dist/external/claude-code.descriptor.d.ts.map +1 -0
  132. package/dist/external/claude-code.descriptor.js +5 -0
  133. package/dist/external/claude-code.descriptor.js.map +1 -0
  134. package/dist/external/claude-code.manifest.d.ts +5 -0
  135. package/dist/external/claude-code.manifest.d.ts.map +1 -0
  136. package/dist/external/claude-code.manifest.js +205 -0
  137. package/dist/external/claude-code.manifest.js.map +1 -0
  138. package/dist/external/external.plugin.d.ts +6 -0
  139. package/dist/external/external.plugin.d.ts.map +1 -0
  140. package/dist/external/external.plugin.js +56 -0
  141. package/dist/external/external.plugin.js.map +1 -0
  142. package/dist/external/index.d.ts +6 -0
  143. package/dist/external/index.d.ts.map +1 -0
  144. package/dist/external/index.js +6 -0
  145. package/dist/external/index.js.map +1 -0
  146. package/dist/index.d.ts +4 -0
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/index.js +4 -0
  149. package/dist/index.js.map +1 -0
  150. package/package.json +108 -4
package/LICENSE ADDED
@@ -0,0 +1,126 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: VIBES DEV LLC
6
+ Licensed Work: @vibesdotdev/integrations-anthropic
7
+ The Licensed Work is (c) 2026 VIBES DEV LLC.
8
+ Additional Use Grant: In this grant, "Vibes Platform" means the hosted services VIBES DEV LLC
9
+ operates at vibes.dev and its subdomains.
10
+
11
+ You may make production use of the Licensed Work, including commercial
12
+ use, subject to the limits below. Permitted production use includes:
13
+ building, operating and selling your own applications, agents and services
14
+ on or with the Vibes Platform; self-hosting the Licensed Work for use inside
15
+ your own organization; and providing consulting, integration or development
16
+ services to clients who build on the Vibes Platform.
17
+
18
+ The production use permitted above does not include use that:
19
+
20
+ (a) offers third parties a hosted, managed or embedded service that
21
+ substitutes for the Vibes Platform or a material part of it (including
22
+ agent hosting; fleet, sandbox or container provisioning; package
23
+ registry; source hosting and continuous integration; and managed AI,
24
+ storage, secrets or messaging), where the Licensed Work provides a
25
+ material part of that service's value and that service earns more than
26
+ US$1,000,000 in gross revenue in any twelve-month period;
27
+ (b) sells, rents, sublicenses or white-labels the Licensed Work, or access
28
+ to Vibes Platform functionality, as a product in its own right;
29
+ (c) removes, disables or works around entitlement checks, usage metering,
30
+ quotas or plan limits, or reaches Vibes Platform features the user's
31
+ account is not entitled to;
32
+ (d) scrapes, bulk-exports or harvests data or content from the Vibes
33
+ Platform or its users other than through documented interfaces and
34
+ within their terms, or uses outputs or data obtained from the Vibes
35
+ Platform to train or improve a product that competes with it;
36
+ (e) violates applicable law, infringes anyone's rights, commits fraud or
37
+ deception, conducts unlawful surveillance or harassment, distributes
38
+ malware, or accesses systems without authorization; or
39
+ (f) violates applicable antitrust or competition law.
40
+
41
+ A written permission from the Licensor extends this grant.
42
+ Change Date: Four years from the date the Licensed Work is published.
43
+ Change License: MIT
44
+
45
+ For information about alternative licensing arrangements for the Licensed Work,
46
+ contact VIBES DEV LLC through https://vibes.dev.
47
+
48
+ Notice
49
+
50
+ The Business Source License (this document, or the "License") is not an Open
51
+ Source license. However, the Licensed Work will eventually be made available
52
+ under an Open Source License, as stated in this License.
53
+
54
+ -----------------------------------------------------------------------------
55
+
56
+ Business Source License 1.1
57
+
58
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
59
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
60
+
61
+ Terms
62
+
63
+ The Licensor hereby grants you the right to copy, modify, create derivative
64
+ works, redistribute, and make non-production use of the Licensed Work. The
65
+ Licensor may make an Additional Use Grant, above, permitting limited
66
+ production use.
67
+
68
+ Effective on the Change Date, or the fourth anniversary of the first publicly
69
+ available distribution of a specific version of the Licensed Work under this
70
+ License, whichever comes first, the Licensor hereby grants you rights under
71
+ the terms of the Change License, and the rights granted in the paragraph
72
+ above terminate.
73
+
74
+ If your use of the Licensed Work does not comply with the requirements
75
+ currently in effect as described in this License, you must purchase a
76
+ commercial license from the Licensor, its affiliated entities, or authorized
77
+ resellers, or you must refrain from using the Licensed Work.
78
+
79
+ All copies of the original and modified Licensed Work, and derivative works
80
+ of the Licensed Work, are subject to this License. This License applies
81
+ separately for each version of the Licensed Work and the Change Date may vary
82
+ for each version of the Licensed Work released by Licensor.
83
+
84
+ You must conspicuously display this License on each original or modified copy
85
+ of the Licensed Work. If you receive the Licensed Work in original or
86
+ modified form from a third party, the terms and conditions set forth in this
87
+ License apply to your use of that work.
88
+
89
+ Any use of the Licensed Work in violation of this License will automatically
90
+ terminate your rights under this License for the current and all other
91
+ versions of the Licensed Work.
92
+
93
+ This License does not grant you any right in any trademark or logo of
94
+ Licensor or its affiliates (provided that you may use a trademark or logo of
95
+ Licensor as expressly required by this License).
96
+
97
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
98
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
99
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
100
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
101
+ TITLE.
102
+
103
+ MariaDB hereby grants you permission to use this License’s text to license
104
+ your works, and to refer to it using the trademark “Business Source License”,
105
+ as long as you comply with the Covenants of Licensor below.
106
+
107
+ Covenants of Licensor
108
+
109
+ In consideration of the right to use this License’s text and the “Business
110
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
111
+ other recipients of the licensed work to be provided by Licensor:
112
+
113
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
114
+ or a license that is compatible with GPL Version 2.0 or a later version,
115
+ where “compatible” means that software provided under the Change License can
116
+ be included in a program with software provided under GPL Version 2.0 or a
117
+ later version. Licensor may specify additional Change Licenses without
118
+ limitation.
119
+
120
+ 2. To either: (a) specify an additional grant of rights to use that does not
121
+ impose any additional restriction on the right granted in this License, as
122
+ the Additional Use Grant; or (b) insert the text “None”.
123
+
124
+ 3. To specify a Change Date.
125
+
126
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -1,3 +1,58 @@
1
- # Temporary Holding Version
1
+ # @vibesdotdev/integrations-anthropic
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Everything Anthropic-specific in Vibes: the provider, its Messages API dialect, the Claude Code
4
+ subscription route, and the Claude Code external-tool projection.
5
+
6
+ ## What it owns
7
+
8
+ - **Provider `anthropic`** with two billing variants that are never mixed: a Claude subscription
9
+ (through the local Claude Code CLI) and the separately billed Anthropic API (a key held as a
10
+ `CredentialReference`, never a plaintext value).
11
+ - **`anthropic-messages` spec**: the `/v1/messages` request and stream dialect. A turn either
12
+ completes or fails with a typed `CapabilityError`; no HTTP error, mid-stream `error` event or
13
+ truncated stream is ever a successful empty reply.
14
+ - **`claude-code-exec` spec**: one tool-free `claude -p` turn. The conversation goes to the child on
15
+ stdin, the child runs with the cloud-routing variables blanked, and tools, images and sampling the
16
+ turn cannot honour are refused.
17
+ - **Health and sign-in**: `claude auth status` for the subscription, a bounded `https`-only probe for
18
+ an API key. Nothing the network or a child said (reason phrases, bodies, stderr, fetch errors) reaches
19
+ a message or a result.
20
+ - **Model catalogue** (`src/ai/metadata`): the one table of model ids, limits and prices that the
21
+ plugin, the provider's recommendations and the setup recommendation all read.
22
+ - **Router codec** for `/v1/messages`.
23
+ - **Claude Code projection** (`./external/plugin`): the `claude-code` host manifest, its hook adapter
24
+ and templates, presets, and eight installer operations (install, uninstall, status, backup, backups,
25
+ restore, build, assets). Launching `claude` passes `--dangerously-skip-permissions` only when the
26
+ caller declares an execution policy (`vibes launch claude --execution-policy sandboxed`).
27
+
28
+ ## Entrypoints
29
+
30
+ | Import | What |
31
+ |---|---|
32
+ | `@vibesdotdev/integrations-anthropic/ai/plugin` | The AI RuntimePlugin hosts select |
33
+ | `@vibesdotdev/integrations-anthropic/external/plugin` | The Claude Code RuntimePlugin hosts select |
34
+ | `@vibesdotdev/integrations-anthropic/ai/metadata/*` | Provider and model JSON records |
35
+
36
+ The package barrel and the `./ai/*` and `./external/*` wildcards also expose implementation modules; they
37
+ narrow only once a census shows no importer (see `SPEC.md`, Owed).
38
+
39
+ ## Not here
40
+
41
+ Brain, presence, session, memory, storage and encryption live in their own packages; Claude hooks reach
42
+ them through provider-neutral runtime capabilities. The provider-neutral `external/*` kinds, the hook
43
+ bridge and the launch machinery are `@vibesdotdev/external`.
44
+
45
+ ## Proof
46
+
47
+ ```
48
+ bun run check # typechecks sources and tests without emitting (tsconfig.json)
49
+ bun run test # in-process runtime and installer coverage
50
+ bun run build # production artifacts and metadata assets (tsconfig.build.json)
51
+ bun run test:node # bundles current source for real Node, imports every export, runs a turn against a fake claude child
52
+ ```
53
+
54
+ The contract, its refusals and its open items are in [SPEC.md](./SPEC.md).
55
+
56
+ ## License
57
+
58
+ BUSL-1.1
@@ -0,0 +1,32 @@
1
+ import { type AIRouterCodec } from '@vibesdotdev/ai/router';
2
+ export declare const anthropicRouterCodecDescriptor: {
3
+ id: string;
4
+ kind: "ai/router-codec";
5
+ routes: {
6
+ method: string;
7
+ path: string;
8
+ }[];
9
+ name?: string | undefined;
10
+ description?: string | undefined;
11
+ tags?: string[] | undefined;
12
+ hardware?: string[] | undefined;
13
+ enabled?: boolean | undefined;
14
+ priority?: number | undefined;
15
+ capabilityId?: string | undefined;
16
+ requiredContext?: string[] | undefined;
17
+ optionalContext?: string[] | undefined;
18
+ config?: unknown;
19
+ retention?: string | {
20
+ reason: string;
21
+ maxAgeDays?: number | undefined;
22
+ maxEntries?: number | undefined;
23
+ maxBytes?: number | undefined;
24
+ cascadeFrom?: string | undefined;
25
+ ageField?: string | undefined;
26
+ enforcedBy?: string | undefined;
27
+ } | undefined;
28
+ contentTypes?: string[] | undefined;
29
+ surfaces?: string[] | undefined;
30
+ };
31
+ export declare const anthropicRouterCodec: AIRouterCodec;
32
+ //# sourceMappingURL=anthropic-router-codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic-router-codec.d.ts","sourceRoot":"","sources":["../../src/ai/anthropic-router-codec.ts"],"names":[],"mappings":"AAIA,OAAO,EAGN,KAAK,aAAa,EAGlB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUzC,CAAC;AAqNH,eAAO,MAAM,oBAAoB,EAAE,aAoHlC,CAAC"}
@@ -0,0 +1,321 @@
1
+ import * as z from 'zod/v4';
2
+ import { CapabilityError } from '@vibesdotdev/kernel';
3
+ import { providerTextCause } from '@vibesdotdev/ai/utils/provider-text';
4
+ import { readHostile } from "./hostile.js";
5
+ import { buildInternalRouterRequest, createAIRouterCodecDescriptor } from '@vibesdotdev/ai/router';
6
+ import { JsonObjectSchema } from '@vibesdotdev/kernel/schemas/json';
7
+ export const anthropicRouterCodecDescriptor = createAIRouterCodecDescriptor({
8
+ id: 'anthropic-messages',
9
+ name: 'Anthropic Messages router codec',
10
+ description: 'Projects /v1/messages onto the neutral AI router request and event contracts',
11
+ routes: [{ method: 'POST', path: '/v1/messages' }],
12
+ contentTypes: ['application/json'],
13
+ surfaces: ['server'],
14
+ priority: 100,
15
+ hardware: ['consumer', 'cloud'],
16
+ tags: ['anthropic', 'router', 'messages']
17
+ });
18
+ // Members of an unexpected type read as absent, as an absent member does: the
19
+ // router answers a malformed request body by projecting what it can read.
20
+ const optionalString = z.string().optional().catch(undefined);
21
+ // A `text` that is not a string (an object, a null-prototype value) is not text: it is left out, never
22
+ // stringified into "[object Object]" and never allowed to throw while being converted.
23
+ const SystemPartSchema = z.looseObject({ type: optionalString, text: optionalString }).catch({});
24
+ const MessagesRequestSchema = z.looseObject({
25
+ system: z
26
+ .union([
27
+ z.string(),
28
+ z.array(SystemPartSchema).transform((parts) => parts
29
+ .filter((part) => part.type === 'text' && part.text !== undefined)
30
+ .map((part) => part.text)
31
+ .join('\n'))
32
+ ])
33
+ .optional()
34
+ .catch(undefined),
35
+ messages: z
36
+ .array(z.looseObject({ role: optionalString, content: z.unknown().optional() }).catch({}))
37
+ .optional()
38
+ .catch(undefined),
39
+ tools: z
40
+ .array(z
41
+ .looseObject({
42
+ name: z.unknown().optional(),
43
+ description: z.unknown().optional(),
44
+ input_schema: z.unknown().optional()
45
+ })
46
+ .catch({}))
47
+ .optional()
48
+ .catch(undefined),
49
+ model: z.unknown().optional(),
50
+ stream: z.unknown().optional(),
51
+ temperature: z.unknown().optional(),
52
+ max_tokens: z.unknown().optional(),
53
+ top_p: z.unknown().optional(),
54
+ tool_choice: z.unknown().optional(),
55
+ stop_sequences: z.unknown().optional()
56
+ });
57
+ /** Request headers as the router hands them (lower-cased); an absent, non-record or unreadable value is no headers. */
58
+ const HeadersSchema = z.record(z.string(), z.string()).catch({});
59
+ function readHeaders(input) {
60
+ const headers = readHostile(HeadersSchema, input.headers);
61
+ return headers.ok ? headers.data : {};
62
+ }
63
+ function refuseRequest(failure) {
64
+ return new CapabilityError('The Messages request cannot be read.', 'INVALID_INPUT', {
65
+ reason: 'invalid-router-request',
66
+ retryable: false,
67
+ details: failure ? { failure: failure.name } : undefined
68
+ });
69
+ }
70
+ /** The request body, read once into a plain copy; a body that cannot be read (a trapping or revoked Proxy, a throwing getter) is a typed refusal. */
71
+ function readRequest(input) {
72
+ const parsed = readHostile(MessagesRequestSchema, input.body);
73
+ if (parsed.ok)
74
+ return parsed.data;
75
+ if (parsed.threw)
76
+ throw refuseRequest(parsed.failure);
77
+ // A body that is not a JSON object is projected as an empty request.
78
+ return MessagesRequestSchema.parse({});
79
+ }
80
+ /** The error types the dialect defines; the router's own kinds map onto them and anything else is `api_error`. */
81
+ const ERROR_TYPES = new Set([
82
+ 'invalid_request_error',
83
+ 'authentication_error',
84
+ 'billing_error',
85
+ 'permission_error',
86
+ 'not_found_error',
87
+ 'request_too_large',
88
+ 'rate_limit_error',
89
+ 'timeout_error',
90
+ 'api_error',
91
+ 'overloaded_error'
92
+ ]);
93
+ const MAX_ERROR_MESSAGE_CHARS = 512;
94
+ const ErrorFieldsSchema = z.object({
95
+ type: z.string().catch('api_error'),
96
+ message: z.string().catch('The router failed.'),
97
+ status: z.number().int().min(400).max(599).catch(500)
98
+ });
99
+ /**
100
+ * The dialect's error object. Only the type (from the dialect's own set) and the router's message
101
+ * (bounded) are projected: `details` is never echoed, and a value that cannot be read is a generic 500.
102
+ */
103
+ function errorBody(error) {
104
+ const read = readHostile(ErrorFieldsSchema, error);
105
+ const fields = read.ok ? read.data : { type: 'api_error', message: 'The router failed.', status: 500 };
106
+ const type = fields.type === 'internal_error' || !ERROR_TYPES.has(fields.type) ? 'api_error' : fields.type;
107
+ return { status: fields.status, body: { type: 'error', error: { type, message: fields.message.slice(0, MAX_ERROR_MESSAGE_CHARS) } } };
108
+ }
109
+ /** Foreign finish reasons (OpenAI chat, router-native) onto the dialect's `stop_reason`. */
110
+ const STOP_REASONS = new Map([
111
+ ['stop', 'end_turn'],
112
+ ['end_turn', 'end_turn'],
113
+ ['length', 'max_tokens'],
114
+ ['max_tokens', 'max_tokens'],
115
+ ['tool_calls', 'tool_use'],
116
+ ['function_call', 'tool_use'],
117
+ ['tool_use', 'tool_use'],
118
+ ['stop_sequence', 'stop_sequence'],
119
+ ['content_filter', 'refusal'],
120
+ ['refusal', 'refusal']
121
+ ]);
122
+ const ResultModelSchema = z.looseObject({ model: z.string().min(1).max(256).optional().catch(undefined) });
123
+ function refuseToolArguments(name) {
124
+ return new CapabilityError('Routed tool-call arguments are not a complete JSON object.', 'INVALID_INPUT', {
125
+ reason: 'invalid-tool-arguments',
126
+ retryable: false,
127
+ details: { tool: name.slice(0, 128) }
128
+ });
129
+ }
130
+ /** The turn the events say; its model is the one the events name, else the one the request asked for. */
131
+ function foldEvents(events, requestedModel) {
132
+ const turn = { text: '', toolCalls: [], stopReason: 'end_turn', inputTokens: 0, outputTokens: 0, model: requestedModel };
133
+ const byId = new Map();
134
+ let finish;
135
+ for (const event of events) {
136
+ if (event.kind === 'error') {
137
+ // An error is never a 200 with empty content: it ends the exchange as a typed failure the router answers as an error.
138
+ throw new CapabilityError('The routed request failed.', 'UNAVAILABLE', {
139
+ reason: 'router-upstream-error',
140
+ retryable: true,
141
+ cause: providerTextCause(event.error?.message ?? '')
142
+ });
143
+ }
144
+ if (event.kind === 'text-delta')
145
+ turn.text += event.delta ?? '';
146
+ else if (event.kind === 'tool-call-start') {
147
+ const call = { id: event.id ?? `toolu_${turn.toolCalls.length}`, name: event.name ?? '', args: '' };
148
+ byId.set(call.id, call);
149
+ turn.toolCalls.push(call);
150
+ }
151
+ else if (event.kind === 'tool-call-arg-delta') {
152
+ const call = event.id === undefined ? undefined : byId.get(event.id);
153
+ if (!call)
154
+ throw refuseToolArguments('');
155
+ call.args += event.delta ?? '';
156
+ }
157
+ else if (event.kind === 'usage') {
158
+ finish = event.finishReason ?? finish;
159
+ turn.inputTokens = event.tokensPrompt ?? turn.inputTokens;
160
+ turn.outputTokens = event.tokensCompletion ?? turn.outputTokens;
161
+ }
162
+ else if (event.kind === 'result') {
163
+ const model = ResultModelSchema.safeParse(event.result);
164
+ if (model.success && model.data.model)
165
+ turn.model = model.data.model;
166
+ }
167
+ }
168
+ if (turn.toolCalls.length > 0 && (finish === undefined || STOP_REASONS.get(finish) === 'end_turn'))
169
+ finish = 'tool_use';
170
+ turn.stopReason = finish === undefined ? 'end_turn' : (STOP_REASONS.get(finish) ?? 'end_turn');
171
+ return turn;
172
+ }
173
+ const ToolInputSchema = JsonObjectSchema;
174
+ /** A tool call's arguments as the object the dialect carries; no text is `{}`, text that is not a complete JSON object is refused. */
175
+ function toolInput(call) {
176
+ if (call.args.trim() === '')
177
+ return {};
178
+ let decoded;
179
+ try {
180
+ decoded = JSON.parse(call.args);
181
+ }
182
+ catch (error) {
183
+ if (error instanceof SyntaxError)
184
+ throw refuseToolArguments(call.name);
185
+ throw error;
186
+ }
187
+ const parsed = ToolInputSchema.safeParse(decoded);
188
+ if (!parsed.success)
189
+ throw refuseToolArguments(call.name);
190
+ return parsed.data;
191
+ }
192
+ /** A message id the runtime makes: unique per response. */
193
+ function messageId() {
194
+ return `msg_${crypto.randomUUID().replaceAll('-', '')}`;
195
+ }
196
+ function sse(event, data) {
197
+ return `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
198
+ }
199
+ export const anthropicRouterCodec = {
200
+ detect(input) {
201
+ const headers = readHeaders(input);
202
+ if (headers['x-vibes-spec-id'] === 'anthropic-messages')
203
+ return 100;
204
+ if ((headers.accept ?? '').includes('anthropic'))
205
+ return 75;
206
+ // A body that cannot be read is not claimed: detection only scores, `decode` refuses it typed.
207
+ const body = readHostile(MessagesRequestSchema, input.body);
208
+ const value = body.ok ? body.data : undefined;
209
+ if (value === undefined)
210
+ return false;
211
+ return 'system' in value && ('max_tokens' in value || Array.isArray(value.messages))
212
+ ? 50
213
+ : false;
214
+ },
215
+ decode(input) {
216
+ const headers = readHeaders(input);
217
+ const value = readRequest(input);
218
+ const system = value.system ?? '';
219
+ const messages = (value.messages ?? []).map((message) => ({
220
+ role: message.role ?? 'user',
221
+ content: message.content ?? ''
222
+ }));
223
+ const tools = value.tools?.map((tool) => ({
224
+ name: tool.name,
225
+ description: tool.description,
226
+ parameters: tool.input_schema
227
+ }));
228
+ return buildInternalRouterRequest({
229
+ specId: 'anthropic-messages',
230
+ rawBody: value,
231
+ body: {
232
+ messages: system ? [{ role: 'system', content: system }, ...messages] : messages,
233
+ model: value.model,
234
+ stream: value.stream === true,
235
+ temperature: value.temperature,
236
+ maxTokens: value.max_tokens,
237
+ topP: value.top_p,
238
+ tools,
239
+ toolChoice: value.tool_choice,
240
+ stop: value.stop_sequences
241
+ },
242
+ headers
243
+ });
244
+ },
245
+ encode(events, { streaming, model }) {
246
+ const turn = foldEvents(events, model);
247
+ // Tool arguments are decoded before anything is returned, so a bad call fails the exchange, not half of it.
248
+ const toolBlocks = turn.toolCalls.map((call) => ({ call, input: toolInput(call) }));
249
+ const id = messageId();
250
+ if (!streaming) {
251
+ const content = [];
252
+ if (turn.text)
253
+ content.push({ type: 'text', text: turn.text });
254
+ for (const { call, input } of toolBlocks)
255
+ content.push({ type: 'tool_use', id: call.id, name: call.name, input });
256
+ return {
257
+ headers: { 'Content-Type': 'application/json' },
258
+ contentType: 'application/json',
259
+ body: JSON.stringify({
260
+ id,
261
+ type: 'message',
262
+ role: 'assistant',
263
+ model: turn.model,
264
+ content,
265
+ stop_reason: turn.stopReason,
266
+ stop_sequence: null,
267
+ usage: { input_tokens: turn.inputTokens, output_tokens: turn.outputTokens }
268
+ })
269
+ };
270
+ }
271
+ async function* stream() {
272
+ yield sse('message_start', {
273
+ type: 'message_start',
274
+ message: {
275
+ id,
276
+ type: 'message',
277
+ role: 'assistant',
278
+ model: turn.model,
279
+ content: [],
280
+ stop_reason: null,
281
+ stop_sequence: null,
282
+ usage: { input_tokens: turn.inputTokens, output_tokens: 0 }
283
+ }
284
+ });
285
+ let index = 0;
286
+ if (turn.text) {
287
+ yield sse('content_block_start', { type: 'content_block_start', index, content_block: { type: 'text', text: '' } });
288
+ // Text deltas keep the router's own chunking.
289
+ for (const event of events) {
290
+ if (event.kind === 'text-delta') {
291
+ yield sse('content_block_delta', { type: 'content_block_delta', index, delta: { type: 'text_delta', text: event.delta ?? '' } });
292
+ }
293
+ }
294
+ yield sse('content_block_stop', { type: 'content_block_stop', index });
295
+ index += 1;
296
+ }
297
+ for (const { call, input } of toolBlocks) {
298
+ yield sse('content_block_start', { type: 'content_block_start', index, content_block: { type: 'tool_use', id: call.id, name: call.name, input: {} } });
299
+ yield sse('content_block_delta', { type: 'content_block_delta', index, delta: { type: 'input_json_delta', partial_json: JSON.stringify(input) } });
300
+ yield sse('content_block_stop', { type: 'content_block_stop', index });
301
+ index += 1;
302
+ }
303
+ yield sse('message_delta', {
304
+ type: 'message_delta',
305
+ delta: { stop_reason: turn.stopReason, stop_sequence: null },
306
+ usage: { output_tokens: turn.outputTokens }
307
+ });
308
+ yield sse('message_stop', { type: 'message_stop' });
309
+ }
310
+ return {
311
+ headers: { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache' },
312
+ contentType: 'text/event-stream',
313
+ body: stream()
314
+ };
315
+ },
316
+ encodeError(error) {
317
+ const { status, body } = errorBody(error);
318
+ return Response.json(body, { status });
319
+ }
320
+ };
321
+ //# sourceMappingURL=anthropic-router-codec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic-router-codec.js","sourceRoot":"","sources":["../../src/ai/anthropic-router-codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAyB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,E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Q,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;CACD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type RuntimePlugin } from '@vibesdotdev/kernel';
2
+ /** Complete runtime boundary for Anthropic-owned AI capabilities. */
3
+ export declare function createAnthropicPlugin(): RuntimePlugin;
4
+ export declare const anthropicAIPlugin: RuntimePlugin;
5
+ export default anthropicAIPlugin;
6
+ //# sourceMappingURL=anthropic.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.plugin.d.ts","sourceRoot":"","sources":["../../src/ai/anthropic.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAyD9E,qEAAqE;AACrE,wBAAgB,qBAAqB,IAAI,aAAa,CAyErD;AAED,eAAO,MAAM,iBAAiB,EAAE,aAAuC,CAAC;AACxE,eAAe,iBAAiB,CAAC"}