@fabric-harness/sdk 0.10.0 → 1.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/dist/agent-definition.js +2 -2
- package/dist/agent-definition.js.map +1 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +4 -2
- package/dist/agent.js.map +1 -1
- package/dist/cloudflare-source.d.ts +2 -1
- package/dist/cloudflare-source.d.ts.map +1 -1
- package/dist/cloudflare-source.js +2 -1
- package/dist/cloudflare-source.js.map +1 -1
- package/dist/experimental.d.ts +14 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +14 -0
- package/dist/experimental.js.map +1 -0
- package/dist/filesystem-source.d.ts +2 -1
- package/dist/filesystem-source.d.ts.map +1 -1
- package/dist/filesystem-source.js +2 -1
- package/dist/filesystem-source.js.map +1 -1
- package/dist/history.d.ts +17 -0
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +35 -0
- package/dist/history.js.map +1 -1
- package/dist/index.d.ts +9 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +35 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +71 -0
- package/dist/logger.js.map +1 -0
- package/dist/model.d.ts +24 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +3 -3
- package/dist/model.js.map +1 -1
- package/dist/sandbox-ref.d.ts +56 -1
- package/dist/sandbox-ref.d.ts.map +1 -1
- package/dist/sandbox-ref.js +71 -0
- package/dist/sandbox-ref.js.map +1 -1
- package/dist/sandbox.d.ts +25 -0
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +3 -0
- package/dist/sandbox.js.map +1 -1
- package/dist/session.d.ts +17 -5
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +50 -15
- package/dist/session.js.map +1 -1
- package/dist/strict.d.ts +7 -3
- package/dist/strict.d.ts.map +1 -1
- package/dist/strict.js +4 -2
- package/dist/strict.js.map +1 -1
- package/dist/telemetry.d.ts +6 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +9 -2
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +11 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +11 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vercel-ai-gateway.d.ts +57 -0
- package/dist/vercel-ai-gateway.d.ts.map +1 -0
- package/dist/vercel-ai-gateway.js +44 -0
- package/dist/vercel-ai-gateway.js.map +1 -0
- package/package.json +10 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { OpenAICompatibleModelProvider } from './model.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default base URL for Vercel AI Gateway's OpenAI-compatible Chat Completions
|
|
4
|
+
* endpoint. The gateway accepts the standard OpenAI request body and routes
|
|
5
|
+
* through to the configured provider; switching from OpenAI to the gateway
|
|
6
|
+
* is just a base-URL change.
|
|
7
|
+
*
|
|
8
|
+
* See https://vercel.com/docs/ai-gateway/sdks-and-apis/openai-compat
|
|
9
|
+
*/
|
|
10
|
+
export declare const VERCEL_AI_GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh/v1";
|
|
11
|
+
export interface VercelAIGatewayProviderOptions {
|
|
12
|
+
/**
|
|
13
|
+
* AI Gateway API key. From the Vercel dashboard, or pass an OIDC token if
|
|
14
|
+
* you've configured workload identity. Forwarded as `Authorization: Bearer`.
|
|
15
|
+
*/
|
|
16
|
+
apiKey: string;
|
|
17
|
+
/**
|
|
18
|
+
* Default model id (e.g. `anthropic/claude-3-5-sonnet-20241022`,
|
|
19
|
+
* `openai/gpt-4o`). Used when `init({ model: ... })` isn't set per-call.
|
|
20
|
+
*/
|
|
21
|
+
defaultModel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Override the gateway base URL. Default is the production gateway
|
|
24
|
+
* (`https://ai-gateway.vercel.sh/v1`). Override for staging or self-hosted.
|
|
25
|
+
*/
|
|
26
|
+
baseUrl?: string;
|
|
27
|
+
/** Optional name override for telemetry. Defaults to `vercel-ai-gateway`. */
|
|
28
|
+
name?: string;
|
|
29
|
+
/** Extra headers (e.g. team scoping, observability tags). */
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Vercel AI Gateway model provider.
|
|
34
|
+
*
|
|
35
|
+
* The gateway is an OpenAI-compatible HTTP endpoint that brokers between
|
|
36
|
+
* your agent and any of the major model providers (OpenAI, Anthropic,
|
|
37
|
+
* Google, xAI, Groq, etc.) with a single key, observability, caching, and
|
|
38
|
+
* spend controls. Use this provider on any deploy target — Node, Cloudflare
|
|
39
|
+
* Workers, Vercel — to route inference through the gateway.
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { vercelAIGateway, init } from '@fabric-harness/sdk';
|
|
43
|
+
*
|
|
44
|
+
* const fabric = await init({
|
|
45
|
+
* modelProvider: vercelAIGateway({
|
|
46
|
+
* apiKey: process.env.AI_GATEWAY_API_KEY!,
|
|
47
|
+
* defaultModel: 'anthropic/claude-3-5-sonnet-20241022',
|
|
48
|
+
* }),
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* Returns an {@link OpenAICompatibleModelProvider} configured for the gateway
|
|
53
|
+
* — use it anywhere a `ModelProvider` is accepted. Compatible with
|
|
54
|
+
* fabric-harness's tool-calling, retries, and timeout semantics.
|
|
55
|
+
*/
|
|
56
|
+
export declare function vercelAIGateway(options: VercelAIGatewayProviderOptions): OpenAICompatibleModelProvider;
|
|
57
|
+
//# sourceMappingURL=vercel-ai-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai-gateway.d.ts","sourceRoot":"","sources":["../src/vercel-ai-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,oCAAoC,CAAC;AAE5E,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,8BAA8B,GAAG,6BAA6B,CAQtG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { OpenAICompatibleModelProvider } from './model.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default base URL for Vercel AI Gateway's OpenAI-compatible Chat Completions
|
|
4
|
+
* endpoint. The gateway accepts the standard OpenAI request body and routes
|
|
5
|
+
* through to the configured provider; switching from OpenAI to the gateway
|
|
6
|
+
* is just a base-URL change.
|
|
7
|
+
*
|
|
8
|
+
* See https://vercel.com/docs/ai-gateway/sdks-and-apis/openai-compat
|
|
9
|
+
*/
|
|
10
|
+
export const VERCEL_AI_GATEWAY_BASE_URL = 'https://ai-gateway.vercel.sh/v1';
|
|
11
|
+
/**
|
|
12
|
+
* Vercel AI Gateway model provider.
|
|
13
|
+
*
|
|
14
|
+
* The gateway is an OpenAI-compatible HTTP endpoint that brokers between
|
|
15
|
+
* your agent and any of the major model providers (OpenAI, Anthropic,
|
|
16
|
+
* Google, xAI, Groq, etc.) with a single key, observability, caching, and
|
|
17
|
+
* spend controls. Use this provider on any deploy target — Node, Cloudflare
|
|
18
|
+
* Workers, Vercel — to route inference through the gateway.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { vercelAIGateway, init } from '@fabric-harness/sdk';
|
|
22
|
+
*
|
|
23
|
+
* const fabric = await init({
|
|
24
|
+
* modelProvider: vercelAIGateway({
|
|
25
|
+
* apiKey: process.env.AI_GATEWAY_API_KEY!,
|
|
26
|
+
* defaultModel: 'anthropic/claude-3-5-sonnet-20241022',
|
|
27
|
+
* }),
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Returns an {@link OpenAICompatibleModelProvider} configured for the gateway
|
|
32
|
+
* — use it anywhere a `ModelProvider` is accepted. Compatible with
|
|
33
|
+
* fabric-harness's tool-calling, retries, and timeout semantics.
|
|
34
|
+
*/
|
|
35
|
+
export function vercelAIGateway(options) {
|
|
36
|
+
return new OpenAICompatibleModelProvider({
|
|
37
|
+
name: options.name ?? 'vercel-ai-gateway',
|
|
38
|
+
baseUrl: options.baseUrl ?? VERCEL_AI_GATEWAY_BASE_URL,
|
|
39
|
+
apiKey: options.apiKey,
|
|
40
|
+
...(options.defaultModel !== undefined ? { defaultModel: options.defaultModel } : {}),
|
|
41
|
+
...(options.headers !== undefined ? { headers: options.headers } : {}),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=vercel-ai-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai-gateway.js","sourceRoot":"","sources":["../src/vercel-ai-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAwB5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,eAAe,CAAC,OAAuC;IACrE,OAAO,IAAI,6BAA6B,CAAC;QACvC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,mBAAmB;QACzC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,0BAA0B;QACtD,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabric-harness/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Headless TypeScript framework for building durable, deployable autonomous agents — core SDK.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Fabric",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"type": "module",
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
29
|
+
"node": ">=20.18.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"registry": "https://registry.npmjs.org",
|
|
@@ -44,6 +44,14 @@
|
|
|
44
44
|
"./cloudflare": {
|
|
45
45
|
"types": "./dist/cloudflare-source.d.ts",
|
|
46
46
|
"import": "./dist/cloudflare-source.js"
|
|
47
|
+
},
|
|
48
|
+
"./experimental": {
|
|
49
|
+
"types": "./dist/experimental.d.ts",
|
|
50
|
+
"import": "./dist/experimental.js"
|
|
51
|
+
},
|
|
52
|
+
"./testing": {
|
|
53
|
+
"types": "./dist/testing.d.ts",
|
|
54
|
+
"import": "./dist/testing.js"
|
|
47
55
|
}
|
|
48
56
|
},
|
|
49
57
|
"files": [
|