@paraharness/claude 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +63 -2
- package/dist/builders/claude-account-seat-builder.d.ts +44 -0
- package/dist/builders/claude-account-seat-builder.d.ts.map +1 -0
- package/dist/builders/claude-account-seat-builder.js +2 -0
- package/dist/builders/claude-account-seat-builder.js.map +1 -0
- package/dist/builders/claude-model-builder.d.ts +52 -0
- package/dist/builders/claude-model-builder.d.ts.map +1 -0
- package/dist/builders/claude-model-builder.js +2 -0
- package/dist/builders/claude-model-builder.js.map +1 -0
- package/dist/builders/claude-model-options.d.ts +13 -0
- package/dist/builders/claude-model-options.d.ts.map +1 -0
- package/dist/builders/claude-model-options.js +2 -0
- package/dist/builders/claude-model-options.js.map +1 -0
- package/dist/builders/claude-namespace-contract.d.ts +49 -0
- package/dist/builders/claude-namespace-contract.d.ts.map +1 -0
- package/dist/builders/claude-namespace-contract.js +2 -0
- package/dist/builders/claude-namespace-contract.js.map +1 -0
- package/dist/builders/claude-namespace.d.ts +4 -0
- package/dist/builders/claude-namespace.d.ts.map +1 -0
- package/dist/builders/claude-namespace.js +9 -0
- package/dist/builders/claude-namespace.js.map +1 -0
- package/dist/builders/create-claude-account-seat-builder.d.ts +18 -0
- package/dist/builders/create-claude-account-seat-builder.d.ts.map +1 -0
- package/dist/builders/create-claude-account-seat-builder.js +44 -0
- package/dist/builders/create-claude-account-seat-builder.js.map +1 -0
- package/dist/builders/create-claude-model-builder.d.ts +19 -0
- package/dist/builders/create-claude-model-builder.d.ts.map +1 -0
- package/dist/builders/create-claude-model-builder.js +48 -0
- package/dist/builders/create-claude-model-builder.js.map +1 -0
- package/dist/driver/claude-executors.constants.d.ts +4 -0
- package/dist/driver/claude-executors.constants.d.ts.map +1 -0
- package/dist/driver/claude-executors.constants.js +4 -0
- package/dist/driver/claude-executors.constants.js.map +1 -0
- package/dist/driver/claude-http-request.d.ts +23 -0
- package/dist/driver/claude-http-request.d.ts.map +1 -0
- package/dist/driver/claude-http-request.js +2 -0
- package/dist/driver/claude-http-request.js.map +1 -0
- package/dist/driver/claude-http-response.d.ts +19 -0
- package/dist/driver/claude-http-response.d.ts.map +1 -0
- package/dist/driver/claude-http-response.js +2 -0
- package/dist/driver/claude-http-response.js.map +1 -0
- package/dist/driver/claude-http-transport.d.ts +24 -0
- package/dist/driver/claude-http-transport.d.ts.map +1 -0
- package/dist/driver/claude-http-transport.js +2 -0
- package/dist/driver/claude-http-transport.js.map +1 -0
- package/dist/driver/claude-model-driver.d.ts +71 -0
- package/dist/driver/claude-model-driver.d.ts.map +1 -0
- package/dist/driver/claude-model-driver.js +105 -0
- package/dist/driver/claude-model-driver.js.map +1 -0
- package/dist/driver/create-claude-executors.d.ts +14 -0
- package/dist/driver/create-claude-executors.d.ts.map +1 -0
- package/dist/driver/create-claude-executors.js +20 -0
- package/dist/driver/create-claude-executors.js.map +1 -0
- package/dist/driver/default-claude-http-transport.constants.d.ts +14 -0
- package/dist/driver/default-claude-http-transport.constants.d.ts.map +1 -0
- package/dist/driver/default-claude-http-transport.constants.js +38 -0
- package/dist/driver/default-claude-http-transport.constants.js.map +1 -0
- package/dist/driver/internal/build-claude-paired-fork-tool-frame.d.ts +14 -0
- package/dist/driver/internal/build-claude-paired-fork-tool-frame.d.ts.map +1 -0
- package/dist/driver/internal/build-claude-paired-fork-tool-frame.js +56 -0
- package/dist/driver/internal/build-claude-paired-fork-tool-frame.js.map +1 -0
- package/dist/driver/internal/build-claude-user-frame.d.ts +26 -0
- package/dist/driver/internal/build-claude-user-frame.d.ts.map +1 -0
- package/dist/driver/internal/build-claude-user-frame.js +29 -0
- package/dist/driver/internal/build-claude-user-frame.js.map +1 -0
- package/dist/driver/internal/claude-append-tool-result-notes.d.ts +28 -0
- package/dist/driver/internal/claude-append-tool-result-notes.d.ts.map +1 -0
- package/dist/driver/internal/claude-append-tool-result-notes.js +124 -0
- package/dist/driver/internal/claude-append-tool-result-notes.js.map +1 -0
- package/dist/driver/internal/claude-prepare-fork.d.ts +14 -0
- package/dist/driver/internal/claude-prepare-fork.d.ts.map +1 -0
- package/dist/driver/internal/claude-prepare-fork.js +59 -0
- package/dist/driver/internal/claude-prepare-fork.js.map +1 -0
- package/dist/driver/internal/claude-seat-auth.d.ts +14 -0
- package/dist/driver/internal/claude-seat-auth.d.ts.map +1 -0
- package/dist/driver/internal/claude-seat-auth.js +2 -0
- package/dist/driver/internal/claude-seat-auth.js.map +1 -0
- package/dist/driver/internal/claude-wire-converter.d.ts +27 -0
- package/dist/driver/internal/claude-wire-converter.d.ts.map +1 -0
- package/dist/driver/internal/claude-wire-converter.js +83 -0
- package/dist/driver/internal/claude-wire-converter.js.map +1 -0
- package/dist/driver/internal/compute-anthropic-turn-usage.d.ts +12 -0
- package/dist/driver/internal/compute-anthropic-turn-usage.d.ts.map +1 -0
- package/dist/driver/internal/compute-anthropic-turn-usage.js +27 -0
- package/dist/driver/internal/compute-anthropic-turn-usage.js.map +1 -0
- package/dist/driver/internal/create-anthropic-sdk-fetch.d.ts +23 -0
- package/dist/driver/internal/create-anthropic-sdk-fetch.d.ts.map +1 -0
- package/dist/driver/internal/create-anthropic-sdk-fetch.js +21 -0
- package/dist/driver/internal/create-anthropic-sdk-fetch.js.map +1 -0
- package/dist/driver/internal/decode-frame-to-anthropic-message.d.ts +14 -0
- package/dist/driver/internal/decode-frame-to-anthropic-message.d.ts.map +1 -0
- package/dist/driver/internal/decode-frame-to-anthropic-message.js +29 -0
- package/dist/driver/internal/decode-frame-to-anthropic-message.js.map +1 -0
- package/dist/driver/internal/extract-anthropic-content-blocks.d.ts +12 -0
- package/dist/driver/internal/extract-anthropic-content-blocks.d.ts.map +1 -0
- package/dist/driver/internal/extract-anthropic-content-blocks.js +36 -0
- package/dist/driver/internal/extract-anthropic-content-blocks.js.map +1 -0
- package/dist/driver/internal/extract-claude-response-body.d.ts +29 -0
- package/dist/driver/internal/extract-claude-response-body.d.ts.map +1 -0
- package/dist/driver/internal/extract-claude-response-body.js +36 -0
- package/dist/driver/internal/extract-claude-response-body.js.map +1 -0
- package/dist/driver/internal/extract-oauth-token-from-config-dir.d.ts +12 -0
- package/dist/driver/internal/extract-oauth-token-from-config-dir.d.ts.map +1 -0
- package/dist/driver/internal/extract-oauth-token-from-config-dir.js +99 -0
- package/dist/driver/internal/extract-oauth-token-from-config-dir.js.map +1 -0
- package/dist/driver/internal/extracted-anthropic-content-blocks.d.ts +15 -0
- package/dist/driver/internal/extracted-anthropic-content-blocks.d.ts.map +1 -0
- package/dist/driver/internal/extracted-anthropic-content-blocks.js +2 -0
- package/dist/driver/internal/extracted-anthropic-content-blocks.js.map +1 -0
- package/dist/driver/internal/format-claude-fork-prompt-text.d.ts +12 -0
- package/dist/driver/internal/format-claude-fork-prompt-text.d.ts.map +1 -0
- package/dist/driver/internal/format-claude-fork-prompt-text.js +20 -0
- package/dist/driver/internal/format-claude-fork-prompt-text.js.map +1 -0
- package/dist/driver/internal/parse-claude-retry-after-reset-at-ms.d.ts +11 -0
- package/dist/driver/internal/parse-claude-retry-after-reset-at-ms.d.ts.map +1 -0
- package/dist/driver/internal/parse-claude-retry-after-reset-at-ms.js +22 -0
- package/dist/driver/internal/parse-claude-retry-after-reset-at-ms.js.map +1 -0
- package/dist/driver/internal/project-canonical-to-anthropic-message.d.ts +13 -0
- package/dist/driver/internal/project-canonical-to-anthropic-message.d.ts.map +1 -0
- package/dist/driver/internal/project-canonical-to-anthropic-message.js +80 -0
- package/dist/driver/internal/project-canonical-to-anthropic-message.js.map +1 -0
- package/dist/driver/internal/resolve-anthropic-sdk-base-url.d.ts +11 -0
- package/dist/driver/internal/resolve-anthropic-sdk-base-url.d.ts.map +1 -0
- package/dist/driver/internal/resolve-anthropic-sdk-base-url.js +19 -0
- package/dist/driver/internal/resolve-anthropic-sdk-base-url.js.map +1 -0
- package/dist/driver/internal/resolve-anthropic-wire-tools.d.ts +13 -0
- package/dist/driver/internal/resolve-anthropic-wire-tools.d.ts.map +1 -0
- package/dist/driver/internal/resolve-anthropic-wire-tools.js +25 -0
- package/dist/driver/internal/resolve-anthropic-wire-tools.js.map +1 -0
- package/dist/driver/internal/resolve-claude-seat-auth.d.ts +28 -0
- package/dist/driver/internal/resolve-claude-seat-auth.d.ts.map +1 -0
- package/dist/driver/internal/resolve-claude-seat-auth.js +85 -0
- package/dist/driver/internal/resolve-claude-seat-auth.js.map +1 -0
- package/dist/driver/internal/send-claude-messages-via-sdk.d.ts +15 -0
- package/dist/driver/internal/send-claude-messages-via-sdk.d.ts.map +1 -0
- package/dist/driver/internal/send-claude-messages-via-sdk.js +98 -0
- package/dist/driver/internal/send-claude-messages-via-sdk.js.map +1 -0
- package/dist/driver/internal/slice-claude-parent-chain.d.ts +12 -0
- package/dist/driver/internal/slice-claude-parent-chain.d.ts.map +1 -0
- package/dist/driver/internal/slice-claude-parent-chain.js +23 -0
- package/dist/driver/internal/slice-claude-parent-chain.js.map +1 -0
- package/dist/driver/internal/transform-claude-fork-frame.d.ts +27 -0
- package/dist/driver/internal/transform-claude-fork-frame.d.ts.map +1 -0
- package/dist/driver/internal/transform-claude-fork-frame.js +61 -0
- package/dist/driver/internal/transform-claude-fork-frame.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tornike Tsomaia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @paraharness/claude
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Anthropic Claude model driver and declarative `claude.*` builders for [Paraharness](https://github.com/paraharness/paraharness). This package connects `P.agent` actors and `P.pool` seat pools to the Anthropic `/v1/messages` API and Claude CLI OAuth subscription seats (`~/.claude-*`), handling ephemeral KV-cache breakpoint injection, cryptographic `thinking` block signature preservation, native JSON-schema structured outputs, and warm-prefix downward fork preparation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
With npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @paraharness/claude @paraharness/core zod
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
With yarn:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @paraharness/claude @paraharness/core zod
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
With pnpm:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add @paraharness/claude @paraharness/core zod
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { P, z } from '@paraharness/core';
|
|
29
|
+
import { createExecutorRegistry } from '@paraharness/core/runtime';
|
|
30
|
+
import { claude, claudeExecutors } from '@paraharness/claude';
|
|
31
|
+
|
|
32
|
+
const seatA = claude.cliAccount('seat-a').configDir('~/.claude-seat-a');
|
|
33
|
+
const apiFallback = claude.cliAccount('api-fallback').apiKey(P.env('ANTHROPIC_API_KEY'));
|
|
34
|
+
|
|
35
|
+
const claudeSeats = P.pool('claude-seats')
|
|
36
|
+
.items(seatA)
|
|
37
|
+
.strategy('soonest-reset')
|
|
38
|
+
.fallback(apiFallback);
|
|
39
|
+
|
|
40
|
+
const opus = claude
|
|
41
|
+
.model('opus', { id: 'claude-opus-4-6', effort: 'high' })
|
|
42
|
+
.accountPool(claudeSeats);
|
|
43
|
+
|
|
44
|
+
const reviewer = P.agent('reviewer')
|
|
45
|
+
.model(opus)
|
|
46
|
+
.instructions('Audit the pull request diff and report any security or correctness regressions.')
|
|
47
|
+
.input(z.object({ diff: z.string() }))
|
|
48
|
+
.output(
|
|
49
|
+
z.object({
|
|
50
|
+
approved: z.boolean(),
|
|
51
|
+
findings: z.array(z.string()),
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const registry = createExecutorRegistry(claudeExecutors);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
See the [`@paraharness/claude` API Reference](https://paraharness.github.io/paraharness/modules/_paraharness_claude.html) for full type and builder specifications.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
[MIT](./LICENSE) © Tornike Tsomaia
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AstBuilder, ClaudeAccountSeatNode, EnvRef } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Fluent builder for constructing a passive `ClaudeAccountSeatNode` (`type: 'claude:account-seat'`).
|
|
4
|
+
*
|
|
5
|
+
* Configures either a Claude CLI subscription seat backed by an OAuth `configDir` or an API key
|
|
6
|
+
* seat resolved late via `P.env(key)` at turn execution time without import-time I/O.
|
|
7
|
+
*/
|
|
8
|
+
export interface ClaudeAccountSeatBuilder extends AstBuilder<ClaudeAccountSeatNode> {
|
|
9
|
+
/** Unique identifier of the Claude account seat within capacity pools. */
|
|
10
|
+
readonly id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Binds a filesystem path to a Claude CLI configuration directory containing OAuth credentials.
|
|
13
|
+
*
|
|
14
|
+
* Returns a new immutable builder instance with `configDir` set while leaving the receiver unchanged.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} path - Path to the Claude CLI directory (such as `'~/.claude-a'`).
|
|
17
|
+
*
|
|
18
|
+
* @returns {ClaudeAccountSeatBuilder} New immutable account seat builder with `configDir` configured.
|
|
19
|
+
*
|
|
20
|
+
* @throws {Error} If `path` is empty or whitespace-only.
|
|
21
|
+
*/
|
|
22
|
+
configDir(path: string): ClaudeAccountSeatBuilder;
|
|
23
|
+
/**
|
|
24
|
+
* Binds a literal API key or symbolic `P.env(key)` reference for Anthropic API authentication.
|
|
25
|
+
*
|
|
26
|
+
* Returns a new immutable builder instance that resolves the key only at leaf turn invocation time.
|
|
27
|
+
*
|
|
28
|
+
* @param {string | EnvRef} envOrKey - Symbolic `EnvRef` or literal API key string.
|
|
29
|
+
*
|
|
30
|
+
* @returns {ClaudeAccountSeatBuilder} New immutable account seat builder with `apiKey` configured.
|
|
31
|
+
*
|
|
32
|
+
* @throws {Error} If `envOrKey` is an empty or whitespace-only string.
|
|
33
|
+
*/
|
|
34
|
+
apiKey(envOrKey: string | EnvRef): ClaudeAccountSeatBuilder;
|
|
35
|
+
/**
|
|
36
|
+
* Compiles the builder configuration into a deeply frozen passive `ClaudeAccountSeatNode` AST node.
|
|
37
|
+
*
|
|
38
|
+
* Preserves a monomorphic property shape with `type: 'claude:account-seat'` and zero runtime methods.
|
|
39
|
+
*
|
|
40
|
+
* @returns {ClaudeAccountSeatNode} Frozen passive AST node representing the Claude account seat.
|
|
41
|
+
*/
|
|
42
|
+
toAST(): ClaudeAccountSeatNode;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=claude-account-seat-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-account-seat-builder.d.ts","sourceRoot":"","sources":["../../src/builders/claude-account-seat-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,WAAW,wBAAyB,SAAQ,UAAU,CAAC,qBAAqB,CAAC;IACjF,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,CAAC;IAElD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,wBAAwB,CAAC;IAE5D;;;;;;OAMG;IACH,KAAK,IAAI,qBAAqB,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-account-seat-builder.js","sourceRoot":"","sources":["../../src/builders/claude-account-seat-builder.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { AstBuilder, ClaudeAccountSeatNode, ClaudeModelNode, MaybeBuilder, PoolNode } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Fluent builder for constructing a passive `ClaudeModelNode` (`type: 'claude:model'`).
|
|
4
|
+
*
|
|
5
|
+
* Binds an Anthropic model identifier, optional reasoning effort budget, and an optional
|
|
6
|
+
* `P.pool` of `ClaudeAccountSeatNode` seats with run-sticky KV-cache affinity.
|
|
7
|
+
*/
|
|
8
|
+
export interface ClaudeModelBuilder extends AstBuilder<ClaudeModelNode> {
|
|
9
|
+
/** Logical alias of the model within the harness definition. */
|
|
10
|
+
readonly alias: string;
|
|
11
|
+
/** Provider-specific Anthropic model identifier transmitted on the wire. */
|
|
12
|
+
readonly modelId: string;
|
|
13
|
+
/**
|
|
14
|
+
* Configures the reasoning effort level for extended thinking turns on this Claude model.
|
|
15
|
+
*
|
|
16
|
+
* Returns a new immutable `ClaudeModelBuilder` with the updated effort level.
|
|
17
|
+
*
|
|
18
|
+
* @param {'low' | 'medium' | 'high'} level - Extended thinking effort level.
|
|
19
|
+
*
|
|
20
|
+
* @returns {ClaudeModelBuilder} New immutable model builder with `effort` configured.
|
|
21
|
+
*/
|
|
22
|
+
effort(level: 'low' | 'medium' | 'high'): ClaudeModelBuilder;
|
|
23
|
+
/**
|
|
24
|
+
* Attaches a capacity pool of `ClaudeAccountSeatNode` seats to multiplex requests with run-sticky affinity.
|
|
25
|
+
*
|
|
26
|
+
* Accepts either a compiled `PoolNode<ClaudeAccountSeatNode>` or a `PoolBuilder` instance.
|
|
27
|
+
*
|
|
28
|
+
* @param {MaybeBuilder<PoolNode<ClaudeAccountSeatNode>>} pool - Account seat pool node or builder.
|
|
29
|
+
*
|
|
30
|
+
* @returns {ClaudeModelBuilder} New immutable model builder bound to the specified account seat pool.
|
|
31
|
+
*/
|
|
32
|
+
accountPool(pool: MaybeBuilder<PoolNode<ClaudeAccountSeatNode>>): ClaudeModelBuilder;
|
|
33
|
+
/**
|
|
34
|
+
* Alias for `accountPool(pool)` attaching a capacity pool of `ClaudeAccountSeatNode` seats.
|
|
35
|
+
*
|
|
36
|
+
* Preserves API symmetry across `@paraharness/claude`, `@paraharness/openai`, and `@paraharness/gemini`.
|
|
37
|
+
*
|
|
38
|
+
* @param {MaybeBuilder<PoolNode<ClaudeAccountSeatNode>>} pool - Account seat pool node or builder.
|
|
39
|
+
*
|
|
40
|
+
* @returns {ClaudeModelBuilder} New immutable model builder bound to the specified account seat pool.
|
|
41
|
+
*/
|
|
42
|
+
pool(pool: MaybeBuilder<PoolNode<ClaudeAccountSeatNode>>): ClaudeModelBuilder;
|
|
43
|
+
/**
|
|
44
|
+
* Compiles the builder configuration into a deeply frozen passive `ClaudeModelNode` AST node.
|
|
45
|
+
*
|
|
46
|
+
* Produces a monomorphic AST node with `type: 'claude:model'` and `vendor: 'anthropic'`.
|
|
47
|
+
*
|
|
48
|
+
* @returns {ClaudeModelNode} Frozen passive AST node representing the Claude model.
|
|
49
|
+
*/
|
|
50
|
+
toAST(): ClaudeModelNode;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=claude-model-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-model-builder.d.ts","sourceRoot":"","sources":["../../src/builders/claude-model-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU,CAAC,eAAe,CAAC;IACrE,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,kBAAkB,CAAC;IAE7D;;;;;;;;OAQG;IACH,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,GAAG,kBAAkB,CAAC;IAErF;;;;;;;;OAQG;IACH,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,GAAG,kBAAkB,CAAC;IAE9E;;;;;;OAMG;IACH,KAAK,IAAI,eAAe,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-model-builder.js","sourceRoot":"","sources":["../../src/builders/claude-model-builder.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for declaring an Anthropic Claude model via `claude.model(alias, options)`.
|
|
3
|
+
*
|
|
4
|
+
* Specifies the provider-level model identifier transmitted to `/v1/messages` and the optional
|
|
5
|
+
* extended thinking effort budget applied across turns.
|
|
6
|
+
*/
|
|
7
|
+
export interface ClaudeModelOptions {
|
|
8
|
+
/** Anthropic wire model identifier (such as `'claude-sonnet-4-6'` or `'claude-opus-4-6'`). */
|
|
9
|
+
readonly id: string;
|
|
10
|
+
/** Optional reasoning effort level controlling extended thinking budget allocation. */
|
|
11
|
+
readonly effort?: 'low' | 'medium' | 'high';
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=claude-model-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-model-options.d.ts","sourceRoot":"","sources":["../../src/builders/claude-model-options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-model-options.js","sourceRoot":"","sources":["../../src/builders/claude-model-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ClaudeAccountSeatBuilder } from './claude-account-seat-builder.js';
|
|
2
|
+
import type { ClaudeModelBuilder } from './claude-model-builder.js';
|
|
3
|
+
import type { ClaudeModelOptions } from './claude-model-options.js';
|
|
4
|
+
/**
|
|
5
|
+
* Builder namespace contract exported as `claude` by `@paraharness/claude`.
|
|
6
|
+
*
|
|
7
|
+
* Provides entrypoints for declaring passive `ClaudeAccountSeatNode` and `ClaudeModelNode`
|
|
8
|
+
* AST descriptors without import-time or declaration-time side effects.
|
|
9
|
+
*/
|
|
10
|
+
export interface ClaudeNamespace {
|
|
11
|
+
/**
|
|
12
|
+
* Declares a Claude CLI subscription or API fallback seat (`type: 'claude:account-seat'`).
|
|
13
|
+
*
|
|
14
|
+
* Supports `.configDir(path)` for OAuth credential extraction and `.apiKey(envRef)` for API key fallback.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} id - Unique identifier for the Claude account seat.
|
|
17
|
+
*
|
|
18
|
+
* @returns {ClaudeAccountSeatBuilder} Fluent builder for the Claude account seat.
|
|
19
|
+
*
|
|
20
|
+
* @throws {Error} If `id` is empty or whitespace-only.
|
|
21
|
+
*/
|
|
22
|
+
cliAccount(id: string): ClaudeAccountSeatBuilder;
|
|
23
|
+
/**
|
|
24
|
+
* Declares a Claude account seat (`type: 'claude:account-seat'`).
|
|
25
|
+
*
|
|
26
|
+
* Alias for `cliAccount(id)` supporting both `.apiKey(envRef)` and `.configDir(path)` configurations.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} id - Unique identifier for the Claude account seat.
|
|
29
|
+
*
|
|
30
|
+
* @returns {ClaudeAccountSeatBuilder} Fluent builder for the Claude account seat.
|
|
31
|
+
*
|
|
32
|
+
* @throws {Error} If `id` is empty or whitespace-only.
|
|
33
|
+
*/
|
|
34
|
+
account(id: string): ClaudeAccountSeatBuilder;
|
|
35
|
+
/**
|
|
36
|
+
* Declares an Anthropic Claude model configuration (`type: 'claude:model'`, `vendor: 'anthropic'`).
|
|
37
|
+
*
|
|
38
|
+
* Supports `.accountPool(pool)` / `.pool(pool)` and `.effort(level)` before compiling to `ClaudeModelNode`.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} alias - Logical model alias (such as `'sonnet'` or `'opus'`).
|
|
41
|
+
* @param {ClaudeModelOptions} options - Anthropic model identifier and optional thinking effort.
|
|
42
|
+
*
|
|
43
|
+
* @returns {ClaudeModelBuilder} Fluent builder for the Claude model node.
|
|
44
|
+
*
|
|
45
|
+
* @throws {Error} If `alias` or `options.id` is empty or whitespace-only.
|
|
46
|
+
*/
|
|
47
|
+
model(alias: string, options: ClaudeModelOptions): ClaudeModelBuilder;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=claude-namespace-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-namespace-contract.d.ts","sourceRoot":"","sources":["../../src/builders/claude-namespace-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,wBAAwB,CAAC;IAEjD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,wBAAwB,CAAC;IAE9C;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;CACvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-namespace-contract.js","sourceRoot":"","sources":["../../src/builders/claude-namespace-contract.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-namespace.d.ts","sourceRoot":"","sources":["../../src/builders/claude-namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAItE,sFAAsF;AACtF,eAAO,MAAM,MAAM,EAAE,eAInB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createClaudeAccountSeatBuilder } from './create-claude-account-seat-builder.js';
|
|
2
|
+
import { createClaudeModelBuilder } from './create-claude-model-builder.js';
|
|
3
|
+
/** Frozen `claude` builder namespace for constructing passive Anthropic AST nodes. */
|
|
4
|
+
export const claude = Object.freeze({
|
|
5
|
+
cliAccount: (id) => createClaudeAccountSeatBuilder(id),
|
|
6
|
+
account: (id) => createClaudeAccountSeatBuilder(id),
|
|
7
|
+
model: (alias, options) => createClaudeModelBuilder(alias, options),
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=claude-namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-namespace.js","sourceRoot":"","sources":["../../src/builders/claude-namespace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,sFAAsF;AACtF,MAAM,CAAC,MAAM,MAAM,GAAoB,MAAM,CAAC,MAAM,CAAkB;IACpE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,8BAA8B,CAAC,EAAE,CAAC;IACtD,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,8BAA8B,CAAC,EAAE,CAAC;IACnD,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,wBAAwB,CAAC,KAAK,EAAE,OAAO,CAAC;CACpE,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EnvRef } from '@paraharness/core';
|
|
2
|
+
import type { ClaudeAccountSeatBuilder } from './claude-account-seat-builder.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an immutable `ClaudeAccountSeatBuilder` for an Anthropic CLI subscription or API key seat.
|
|
5
|
+
*
|
|
6
|
+
* Performs zero filesystem reads or environment variable lookups at builder construction time,
|
|
7
|
+
* deferring credential extraction to `ClaudeModelDriver.invokeTurn()`.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} id - Non-empty unique seat identifier.
|
|
10
|
+
* @param {string | undefined} configDir - Optional Claude CLI OAuth configuration directory path.
|
|
11
|
+
* @param {string | EnvRef | undefined} apiKey - Optional literal API key or symbolic `EnvRef`.
|
|
12
|
+
*
|
|
13
|
+
* @returns {ClaudeAccountSeatBuilder} Immutable builder compiling to `ClaudeAccountSeatNode`.
|
|
14
|
+
*
|
|
15
|
+
* @throws {Error} If `id` is empty or whitespace-only.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createClaudeAccountSeatBuilder(id: string, configDir?: string, apiKey?: string | EnvRef): ClaudeAccountSeatBuilder;
|
|
18
|
+
//# sourceMappingURL=create-claude-account-seat-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-claude-account-seat-builder.d.ts","sourceRoot":"","sources":["../../src/builders/create-claude-account-seat-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAEjF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,8BAA8B,CAC5C,EAAE,EAAE,MAAM,EACV,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GACvB,wBAAwB,CA4B1B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an immutable `ClaudeAccountSeatBuilder` for an Anthropic CLI subscription or API key seat.
|
|
3
|
+
*
|
|
4
|
+
* Performs zero filesystem reads or environment variable lookups at builder construction time,
|
|
5
|
+
* deferring credential extraction to `ClaudeModelDriver.invokeTurn()`.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} id - Non-empty unique seat identifier.
|
|
8
|
+
* @param {string | undefined} configDir - Optional Claude CLI OAuth configuration directory path.
|
|
9
|
+
* @param {string | EnvRef | undefined} apiKey - Optional literal API key or symbolic `EnvRef`.
|
|
10
|
+
*
|
|
11
|
+
* @returns {ClaudeAccountSeatBuilder} Immutable builder compiling to `ClaudeAccountSeatNode`.
|
|
12
|
+
*
|
|
13
|
+
* @throws {Error} If `id` is empty or whitespace-only.
|
|
14
|
+
*/
|
|
15
|
+
export function createClaudeAccountSeatBuilder(id, configDir, apiKey) {
|
|
16
|
+
if (id.trim().length === 0) {
|
|
17
|
+
throw new Error('Claude account seat id must be a non-empty string.');
|
|
18
|
+
}
|
|
19
|
+
const astNode = Object.freeze({
|
|
20
|
+
type: 'claude:account-seat',
|
|
21
|
+
id,
|
|
22
|
+
configDir,
|
|
23
|
+
apiKey,
|
|
24
|
+
});
|
|
25
|
+
return Object.freeze({
|
|
26
|
+
id,
|
|
27
|
+
configDir(path) {
|
|
28
|
+
if (path.trim().length === 0) {
|
|
29
|
+
throw new Error(`Claude account seat '${id}' configDir must be a non-empty path.`);
|
|
30
|
+
}
|
|
31
|
+
return createClaudeAccountSeatBuilder(id, path, apiKey);
|
|
32
|
+
},
|
|
33
|
+
apiKey(envOrKey) {
|
|
34
|
+
if (typeof envOrKey === 'string' && envOrKey.trim().length === 0) {
|
|
35
|
+
throw new Error(`Claude account seat '${id}' apiKey string must be non-empty.`);
|
|
36
|
+
}
|
|
37
|
+
return createClaudeAccountSeatBuilder(id, configDir, envOrKey);
|
|
38
|
+
},
|
|
39
|
+
toAST() {
|
|
40
|
+
return astNode;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=create-claude-account-seat-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-claude-account-seat-builder.js","sourceRoot":"","sources":["../../src/builders/create-claude-account-seat-builder.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,8BAA8B,CAC5C,EAAU,EACV,SAAkB,EAClB,MAAwB;IAExB,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAwB;QACnD,IAAI,EAAE,qBAAqB;QAC3B,EAAE;QACF,SAAS;QACT,MAAM;KACP,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAA2B;QAC7C,EAAE;QACF,SAAS,CAAC,IAAY;YACpB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,wBAAwB,EAAE,uCAAuC,CAAC,CAAC;YACrF,CAAC;YACD,OAAO,8BAA8B,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,CAAC,QAAyB;YAC9B,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACjE,MAAM,IAAI,KAAK,CAAC,wBAAwB,EAAE,oCAAoC,CAAC,CAAC;YAClF,CAAC;YACD,OAAO,8BAA8B,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC;QACD,KAAK;YACH,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ClaudeAccountSeatNode, type PoolNode } from '@paraharness/core';
|
|
2
|
+
import type { ClaudeModelBuilder } from './claude-model-builder.js';
|
|
3
|
+
import type { ClaudeModelOptions } from './claude-model-options.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates an immutable `ClaudeModelBuilder` for an Anthropic Claude model configuration.
|
|
6
|
+
*
|
|
7
|
+
* Validates that both `alias` and `options.id` are non-empty strings and compiles to a frozen
|
|
8
|
+
* passive `ClaudeModelNode` without performing network or environment I/O.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} alias - Logical alias of the model.
|
|
11
|
+
* @param {ClaudeModelOptions} options - Provider model identifier and optional effort level.
|
|
12
|
+
* @param {PoolNode<ClaudeAccountSeatNode> | undefined} accountPool - Optional compiled pool of Claude account seats.
|
|
13
|
+
*
|
|
14
|
+
* @returns {ClaudeModelBuilder} Immutable builder compiling to `ClaudeModelNode`.
|
|
15
|
+
*
|
|
16
|
+
* @throws {Error} If `alias` or `options.id` is empty or whitespace-only.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createClaudeModelBuilder(alias: string, options: ClaudeModelOptions, accountPool?: PoolNode<ClaudeAccountSeatNode>): ClaudeModelBuilder;
|
|
19
|
+
//# sourceMappingURL=create-claude-model-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-claude-model-builder.d.ts","sourceRoot":"","sources":["../../src/builders/create-claude-model-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAG1B,KAAK,QAAQ,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,kBAAkB,EAC3B,WAAW,CAAC,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAC5C,kBAAkB,CA+BpB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { extractAST, } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an immutable `ClaudeModelBuilder` for an Anthropic Claude model configuration.
|
|
4
|
+
*
|
|
5
|
+
* Validates that both `alias` and `options.id` are non-empty strings and compiles to a frozen
|
|
6
|
+
* passive `ClaudeModelNode` without performing network or environment I/O.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} alias - Logical alias of the model.
|
|
9
|
+
* @param {ClaudeModelOptions} options - Provider model identifier and optional effort level.
|
|
10
|
+
* @param {PoolNode<ClaudeAccountSeatNode> | undefined} accountPool - Optional compiled pool of Claude account seats.
|
|
11
|
+
*
|
|
12
|
+
* @returns {ClaudeModelBuilder} Immutable builder compiling to `ClaudeModelNode`.
|
|
13
|
+
*
|
|
14
|
+
* @throws {Error} If `alias` or `options.id` is empty or whitespace-only.
|
|
15
|
+
*/
|
|
16
|
+
export function createClaudeModelBuilder(alias, options, accountPool) {
|
|
17
|
+
if (alias.trim().length === 0) {
|
|
18
|
+
throw new Error('Claude model alias must be a non-empty string.');
|
|
19
|
+
}
|
|
20
|
+
if (options.id.trim().length === 0) {
|
|
21
|
+
throw new Error(`Claude model '${alias}' options.id must be a non-empty string.`);
|
|
22
|
+
}
|
|
23
|
+
const astNode = Object.freeze({
|
|
24
|
+
type: 'claude:model',
|
|
25
|
+
vendor: 'anthropic',
|
|
26
|
+
alias,
|
|
27
|
+
modelId: options.id,
|
|
28
|
+
effort: options.effort,
|
|
29
|
+
accountPool,
|
|
30
|
+
});
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
alias,
|
|
33
|
+
modelId: options.id,
|
|
34
|
+
effort(level) {
|
|
35
|
+
return createClaudeModelBuilder(alias, { id: options.id, effort: level }, accountPool);
|
|
36
|
+
},
|
|
37
|
+
accountPool(pool) {
|
|
38
|
+
return createClaudeModelBuilder(alias, options, extractAST(pool));
|
|
39
|
+
},
|
|
40
|
+
pool(pool) {
|
|
41
|
+
return createClaudeModelBuilder(alias, options, extractAST(pool));
|
|
42
|
+
},
|
|
43
|
+
toAST() {
|
|
44
|
+
return astNode;
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=create-claude-model-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-claude-model-builder.js","sourceRoot":"","sources":["../../src/builders/create-claude-model-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAKX,MAAM,mBAAmB,CAAC;AAI3B;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAAa,EACb,OAA2B,EAC3B,WAA6C;IAE7C,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,0CAA0C,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAkB;QAC7C,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,WAAW;QACnB,KAAK;QACL,OAAO,EAAE,OAAO,CAAC,EAAE;QACnB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW;KACZ,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAqB;QACvC,KAAK;QACL,OAAO,EAAE,OAAO,CAAC,EAAE;QACnB,MAAM,CAAC,KAAgC;YACrC,OAAO,wBAAwB,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,WAAW,CAAC,CAAC;QACzF,CAAC;QACD,WAAW,CAAC,IAAmD;YAC7D,OAAO,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,IAAmD;YACtD,OAAO,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACpE,CAAC;QACD,KAAK;YACH,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RuntimeExecutorRegistrySlice } from '@paraharness/core';
|
|
2
|
+
/** Default `RuntimeExecutorRegistrySlice` for `@paraharness/claude` (`models['claude:model']`). */
|
|
3
|
+
export declare const claudeExecutors: RuntimeExecutorRegistrySlice;
|
|
4
|
+
//# sourceMappingURL=claude-executors.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-executors.constants.d.ts","sourceRoot":"","sources":["../../src/driver/claude-executors.constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAGtE,mGAAmG;AACnG,eAAO,MAAM,eAAe,EAAE,4BAAsD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createClaudeExecutors } from './create-claude-executors.js';
|
|
2
|
+
/** Default `RuntimeExecutorRegistrySlice` for `@paraharness/claude` (`models['claude:model']`). */
|
|
3
|
+
export const claudeExecutors = createClaudeExecutors();
|
|
4
|
+
//# sourceMappingURL=claude-executors.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-executors.constants.js","sourceRoot":"","sources":["../../src/driver/claude-executors.constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,mGAAmG;AACnG,MAAM,CAAC,MAAM,eAAe,GAAiC,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP request descriptor passed to `ClaudeHttpTransport.sendMessagesRequest()`.
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates the target Anthropic `/v1/messages` endpoint URL, authentication headers,
|
|
5
|
+
* wire-formatted JSON request payload, resolved seat metadata, and optional abort signal.
|
|
6
|
+
*/
|
|
7
|
+
export interface ClaudeHttpRequest {
|
|
8
|
+
/** Target Anthropic Messages API endpoint URL. */
|
|
9
|
+
readonly url: string;
|
|
10
|
+
/** HTTP request headers including `anthropic-version` and OAuth bearer or `x-api-key` credentials. */
|
|
11
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
12
|
+
/** Serialized Anthropic `/v1/messages` request payload object. */
|
|
13
|
+
readonly body: Readonly<Record<string, unknown>>;
|
|
14
|
+
/** Optional identifier of the active `ClaudeAccountSeatNode` selected for this turn. */
|
|
15
|
+
readonly seatId?: string;
|
|
16
|
+
/** Resolved authentication mechanism used for the request (`'cli-oauth'`, `'api-key'`, or `'none'`). */
|
|
17
|
+
readonly authSource?: 'cli-oauth' | 'api-key' | 'none';
|
|
18
|
+
/** Optional abort signal cancelling the in-flight HTTP request. */
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
20
|
+
/** Optional custom `fetch` implementation passed to the underlying `@anthropic-ai/sdk` client. */
|
|
21
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=claude-http-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-http-request.d.ts","sourceRoot":"","sources":["../../src/driver/claude-http-request.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,sGAAsG;IACtG,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,wFAAwF;IACxF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,wGAAwG;IACxG,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;IACvD,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,kGAAkG;IAClG,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-http-request.js","sourceRoot":"","sources":["../../src/driver/claude-http-request.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP response descriptor returned by `ClaudeHttpTransport.sendMessagesRequest()`.
|
|
3
|
+
*
|
|
4
|
+
* Carries the HTTP status code, parsed JSON response payload or raw text body from Anthropic
|
|
5
|
+
* `/v1/messages`, response headers, and optional rate-limit cooldown reset timestamp when `status === 429`.
|
|
6
|
+
*/
|
|
7
|
+
export interface ClaudeHttpResponse {
|
|
8
|
+
/** HTTP status code returned by the Anthropic `/v1/messages` endpoint. */
|
|
9
|
+
readonly status: number;
|
|
10
|
+
/** Parsed JSON response body returned by the Anthropic API when available. */
|
|
11
|
+
readonly body?: Readonly<Record<string, unknown>>;
|
|
12
|
+
/** Optional raw HTTP response body text before JSON parsing. */
|
|
13
|
+
readonly bodyText?: string;
|
|
14
|
+
/** Optional HTTP response headers map (`retry-after`, etc.). */
|
|
15
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
16
|
+
/** Optional epoch timestamp in milliseconds when an HTTP `429` rate limit resets. */
|
|
17
|
+
readonly resetAtMs?: number;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=claude-http-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-http-response.d.ts","sourceRoot":"","sources":["../../src/driver/claude-http-response.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,qFAAqF;IACrF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-http-response.js","sourceRoot":"","sources":["../../src/driver/claude-http-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ClaudeHttpRequest } from './claude-http-request.js';
|
|
2
|
+
import type { ClaudeHttpResponse } from './claude-http-response.js';
|
|
3
|
+
/**
|
|
4
|
+
* Injectable HTTP transport port for dispatching Anthropic `/v1/messages` requests.
|
|
5
|
+
*
|
|
6
|
+
* Allows `ClaudeModelDriver` to execute against either the production `fetch` transport
|
|
7
|
+
* or deterministic recorded transport fixtures in unit and integration tests.
|
|
8
|
+
*/
|
|
9
|
+
export interface ClaudeHttpTransport {
|
|
10
|
+
/**
|
|
11
|
+
* Sends a single `/v1/messages` POST request to the Anthropic API and returns the parsed response.
|
|
12
|
+
*
|
|
13
|
+
* Implementations must honor `request.signal` and return status `429` with `resetAtMs` rather
|
|
14
|
+
* than swallowing rate-limit responses so `PoolManager` can fail over across seats.
|
|
15
|
+
*
|
|
16
|
+
* @param {ClaudeHttpRequest} request - Wire-formatted Anthropic Messages API request.
|
|
17
|
+
*
|
|
18
|
+
* @returns {Promise<ClaudeHttpResponse>} HTTP status code, response body, and optional rate-limit reset timestamp.
|
|
19
|
+
*
|
|
20
|
+
* @throws {Error} If `request.signal` is aborted or an unrecoverable transport failure occurs.
|
|
21
|
+
*/
|
|
22
|
+
sendMessagesRequest(request: ClaudeHttpRequest): Promise<ClaudeHttpResponse>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=claude-http-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-http-transport.d.ts","sourceRoot":"","sources":["../../src/driver/claude-http-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-http-transport.js","sourceRoot":"","sources":["../../src/driver/claude-http-transport.ts"],"names":[],"mappings":""}
|