agent-framework-js 0.1.2 → 0.3.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/CHANGELOG.md +100 -0
- package/README.md +45 -0
- package/dist/agents/index.cjs +7 -7
- package/dist/agents/index.d.cts +6 -6
- package/dist/agents/index.d.ts +6 -6
- package/dist/agents/index.js +2 -2
- package/dist/{chunk-YKZJRE32.cjs → chunk-2WBJEXNY.cjs} +4 -4
- package/dist/{chunk-YKZJRE32.cjs.map → chunk-2WBJEXNY.cjs.map} +1 -1
- package/dist/{chunk-VLSVL5N2.js → chunk-55NB43FN.js} +3 -3
- package/dist/{chunk-VLSVL5N2.js.map → chunk-55NB43FN.js.map} +1 -1
- package/dist/{chunk-YBFLWRO5.cjs → chunk-FDCTSJMB.cjs} +21 -16
- package/dist/chunk-FDCTSJMB.cjs.map +1 -0
- package/dist/{chunk-LMN75W3W.cjs → chunk-I55OVD23.cjs} +4 -3
- package/dist/chunk-I55OVD23.cjs.map +1 -0
- package/dist/{chunk-QJ5XHA6S.cjs → chunk-IHMPSELC.cjs} +4 -4
- package/dist/{chunk-QJ5XHA6S.cjs.map → chunk-IHMPSELC.cjs.map} +1 -1
- package/dist/{chunk-RD5YUB2E.js → chunk-KOPGBIES.js} +15 -10
- package/dist/chunk-KOPGBIES.js.map +1 -0
- package/dist/{chunk-XPXTXOYQ.js → chunk-LC54DGGR.js} +4 -3
- package/dist/chunk-LC54DGGR.js.map +1 -0
- package/dist/{chunk-V472N2PK.js → chunk-PYIZ4PT3.js} +3 -3
- package/dist/{chunk-V472N2PK.js.map → chunk-PYIZ4PT3.js.map} +1 -1
- package/dist/chunk-QD2FFISV.js +327 -0
- package/dist/chunk-QD2FFISV.js.map +1 -0
- package/dist/chunk-XMDGLQFL.cjs +333 -0
- package/dist/chunk-XMDGLQFL.cjs.map +1 -0
- package/dist/declarative/index.cjs +4 -4
- package/dist/declarative/index.d.cts +6 -6
- package/dist/declarative/index.d.ts +6 -6
- package/dist/declarative/index.js +3 -3
- package/dist/{index-D7-znzrc.d.ts → index-C22fqyZQ.d.ts} +7 -5
- package/dist/{index-DdYZeNIu.d.cts → index-b1oTo3Lv.d.cts} +7 -5
- package/dist/index.cjs +34 -30
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/mcp/index.d.cts +2 -2
- package/dist/mcp/index.d.ts +2 -2
- package/dist/middleware/index.d.cts +7 -7
- package/dist/middleware/index.d.ts +7 -7
- package/dist/persistence/index.cjs +5 -5
- package/dist/persistence/index.d.cts +3 -3
- package/dist/persistence/index.d.ts +3 -3
- package/dist/persistence/index.js +2 -2
- package/dist/provider-B807EuDV.d.cts +132 -0
- package/dist/provider-CvU3I-Xo.d.ts +132 -0
- package/dist/providers/index.cjs +9 -5
- package/dist/providers/index.d.cts +58 -14
- package/dist/providers/index.d.ts +58 -14
- package/dist/providers/index.js +1 -1
- package/dist/{registry-D4fThGiN.d.cts → registry-BCkSIe0E.d.cts} +2 -2
- package/dist/{registry-CpO0yH5v.d.ts → registry-D-CmT0gk.d.ts} +2 -2
- package/dist/{thread-CWVzTyti.d.ts → thread-BzwE1OnJ.d.cts} +4 -2
- package/dist/{thread-Dfo9LLf7.d.cts → thread-COljUAtD.d.ts} +4 -2
- package/dist/{tool-BZg_znMZ.d.cts → tool-D9Uodu9Y.d.cts} +1 -1
- package/dist/{tool-CSCC87OD.d.ts → tool-LPMc4QQd.d.ts} +1 -1
- package/dist/tools/index.d.cts +4 -4
- package/dist/tools/index.d.ts +4 -4
- package/dist/{types-Cn1g9Tg4.d.cts → types-AlvjoTyS.d.cts} +24 -1
- package/dist/{types-Cn1g9Tg4.d.ts → types-AlvjoTyS.d.ts} +24 -1
- package/dist/workflows/index.d.cts +6 -6
- package/dist/workflows/index.d.ts +6 -6
- package/package.json +4 -4
- package/AGENT_USAGE.md +0 -207
- package/dist/chunk-LMN75W3W.cjs.map +0 -1
- package/dist/chunk-RD5YUB2E.js.map +0 -1
- package/dist/chunk-TLACSVEZ.cjs +0 -201
- package/dist/chunk-TLACSVEZ.cjs.map +0 -1
- package/dist/chunk-UVWQWOLO.js +0 -196
- package/dist/chunk-UVWQWOLO.js.map +0 -1
- package/dist/chunk-XPXTXOYQ.js.map +0 -1
- package/dist/chunk-YBFLWRO5.cjs.map +0 -1
- package/dist/provider-CMAymr1b.d.cts +0 -82
- package/dist/provider-osAtfZ7x.d.ts +0 -82
package/dist/providers/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXMDGLQFL_cjs = require('../chunk-XMDGLQFL.cjs');
|
|
4
4
|
require('../chunk-MQ2XTH3S.cjs');
|
|
5
5
|
require('../chunk-IJASUMIQ.cjs');
|
|
6
6
|
|
|
@@ -8,19 +8,23 @@ require('../chunk-IJASUMIQ.cjs');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "createCopilotProvider", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkXMDGLQFL_cjs.createCopilotProvider; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "createOpenAICompatibleProvider", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkXMDGLQFL_cjs.createOpenAICompatibleProvider; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "providerErrorFromStatus", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkXMDGLQFL_cjs.providerErrorFromStatus; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "resolveModels", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkXMDGLQFL_cjs.resolveModels; }
|
|
20
24
|
});
|
|
21
25
|
Object.defineProperty(exports, "withRetry", {
|
|
22
26
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkXMDGLQFL_cjs.withRetry; }
|
|
24
28
|
});
|
|
25
29
|
//# sourceMappingURL=index.cjs.map
|
|
26
30
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as CredentialSource, P as Provider } from '../provider-
|
|
2
|
-
export { G as GenerateChunk, a as GenerateRequest, b as GenerateResponse, T as ToolCall, c as ToolSpec } from '../provider-
|
|
1
|
+
import { C as CredentialSource, M as ModelSelectionOptions, P as Provider } from '../provider-B807EuDV.cjs';
|
|
2
|
+
export { G as GenerateChunk, a as GenerateRequest, b as GenerateResponse, R as ResolvedModels, T as ToolCall, c as ToolSpec, r as resolveModels } from '../provider-B807EuDV.cjs';
|
|
3
3
|
import { P as ProviderError } from '../errors-CjVz4W_5.cjs';
|
|
4
|
-
import
|
|
4
|
+
import '../types-AlvjoTyS.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Exponential-backoff retry for transient provider failures. Transient errors
|
|
@@ -35,17 +35,39 @@ declare function providerErrorFromStatus(status: number, message: string): Provi
|
|
|
35
35
|
/**
|
|
36
36
|
* OpenAI-compatible provider. Targets any endpoint speaking the OpenAI
|
|
37
37
|
* `/chat/completions` API, including local servers such as LM Studio via a custom
|
|
38
|
-
* `baseUrl
|
|
38
|
+
* `baseUrl`, and GitHub Copilot (see {@link createCopilotProvider}). (FR-006)
|
|
39
|
+
*
|
|
40
|
+
* Provider compatibility notes (handled here so callers don't have to):
|
|
41
|
+
* - Tool names are sanitized to `^[a-zA-Z0-9_-]+$` on the wire (OpenAI/Copilot
|
|
42
|
+
* reject dotted names like `webiq.browse`) and translated back to the registry
|
|
43
|
+
* key when the model calls them.
|
|
44
|
+
* - Assistant turns that requested tools emit `tool_calls` with `content: null`
|
|
45
|
+
* so strict providers (e.g. Anthropic) can pair each tool result with its call.
|
|
46
|
+
* - Streaming responses accumulate `delta.tool_calls[]` keyed by `index`
|
|
47
|
+
* (fragments may start at a non-zero index when reasoning occupies 0/1).
|
|
48
|
+
* - Some reasoning models report `finish_reason: "tool_calls"` from the
|
|
49
|
+
* non-streaming endpoint without a `tool_calls` array; `generate` transparently
|
|
50
|
+
* re-requests in streaming mode and assembles them, failing loud (typed
|
|
51
|
+
* {@link ProviderError}) rather than silently stopping if none materialize.
|
|
39
52
|
*
|
|
40
53
|
* @packageDocumentation
|
|
41
54
|
*/
|
|
42
55
|
|
|
43
|
-
/**
|
|
44
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Options for {@link createOpenAICompatibleProvider}.
|
|
58
|
+
*
|
|
59
|
+
* Supply a single model via `capabilities`, or multiple via `models` (most
|
|
60
|
+
* OpenAI-compatible endpoints expose one model, but multiple are supported).
|
|
61
|
+
*/
|
|
62
|
+
interface OpenAICompatibleProviderOptions extends CredentialSource, ModelSelectionOptions {
|
|
45
63
|
/** Base URL of the OpenAI-compatible API, e.g. `http://localhost:1234/v1`. */
|
|
46
64
|
baseUrl: string;
|
|
47
|
-
/**
|
|
48
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Extra request headers merged into every call (e.g. provider-required
|
|
67
|
+
* identification headers). The `authorization` header is always set from
|
|
68
|
+
* `getCredential()` and cannot be overridden here.
|
|
69
|
+
*/
|
|
70
|
+
headers?: Record<string, string>;
|
|
49
71
|
/** Retry tuning for transient failures. */
|
|
50
72
|
retry?: RetryOptions;
|
|
51
73
|
/** Optional custom fetch (for testing or non-standard runtimes). */
|
|
@@ -80,12 +102,21 @@ declare function createOpenAICompatibleProvider(options: OpenAICompatibleProvide
|
|
|
80
102
|
* @packageDocumentation
|
|
81
103
|
*/
|
|
82
104
|
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Options for {@link createCopilotProvider}.
|
|
107
|
+
*
|
|
108
|
+
* GitHub Copilot exposes several models, so configure them via `models` (with an
|
|
109
|
+
* optional `defaultModel`). A single `capabilities` object is also accepted.
|
|
110
|
+
*/
|
|
111
|
+
interface CopilotProviderOptions extends CredentialSource, ModelSelectionOptions {
|
|
87
112
|
/** Override the Copilot base URL if needed. */
|
|
88
113
|
baseUrl?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Extra/override request headers. Merged over the required Copilot defaults
|
|
116
|
+
* (`Editor-Version`, `Editor-Plugin-Version`, `Copilot-Integration-Id`,
|
|
117
|
+
* `Openai-Intent`), so you can adjust them without losing the others.
|
|
118
|
+
*/
|
|
119
|
+
headers?: Record<string, string>;
|
|
89
120
|
/** Retry tuning for transient failures. */
|
|
90
121
|
retry?: RetryOptions;
|
|
91
122
|
/** Optional custom fetch (for testing or non-standard runtimes). */
|
|
@@ -94,14 +125,27 @@ interface CopilotProviderOptions extends CredentialSource {
|
|
|
94
125
|
/**
|
|
95
126
|
* Create a GitHub Copilot provider.
|
|
96
127
|
*
|
|
97
|
-
* @example
|
|
128
|
+
* @example Single model
|
|
98
129
|
* ```ts
|
|
99
130
|
* const provider = createCopilotProvider({
|
|
100
131
|
* getCredential: () => myCopilotToken, // never logged or persisted
|
|
101
132
|
* capabilities: { model: "gpt-4o", maxInputTokens: 128000, maxOutputTokens: 16000 },
|
|
102
133
|
* });
|
|
103
134
|
* ```
|
|
135
|
+
*
|
|
136
|
+
* @example Multiple models
|
|
137
|
+
* ```ts
|
|
138
|
+
* const provider = createCopilotProvider({
|
|
139
|
+
* getCredential: () => myCopilotToken,
|
|
140
|
+
* models: [
|
|
141
|
+
* { model: "gpt-4o", maxInputTokens: 128000, maxOutputTokens: 16000, supportsVision: true },
|
|
142
|
+
* { model: "o3-mini", maxInputTokens: 200000, maxOutputTokens: 100000, supportsReasoning: true },
|
|
143
|
+
* ],
|
|
144
|
+
* defaultModel: "gpt-4o",
|
|
145
|
+
* });
|
|
146
|
+
* // Pick a model per request: provider.generate({ messages, model: "o3-mini" })
|
|
147
|
+
* ```
|
|
104
148
|
*/
|
|
105
149
|
declare function createCopilotProvider(options: CopilotProviderOptions): Provider;
|
|
106
150
|
|
|
107
|
-
export { type CopilotProviderOptions, CredentialSource, type OpenAICompatibleProviderOptions, Provider, type RetryOptions, createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, withRetry };
|
|
151
|
+
export { type CopilotProviderOptions, CredentialSource, ModelSelectionOptions, type OpenAICompatibleProviderOptions, Provider, type RetryOptions, createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, withRetry };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as CredentialSource, P as Provider } from '../provider-
|
|
2
|
-
export { G as GenerateChunk, a as GenerateRequest, b as GenerateResponse, T as ToolCall, c as ToolSpec } from '../provider-
|
|
1
|
+
import { C as CredentialSource, M as ModelSelectionOptions, P as Provider } from '../provider-CvU3I-Xo.js';
|
|
2
|
+
export { G as GenerateChunk, a as GenerateRequest, b as GenerateResponse, R as ResolvedModels, T as ToolCall, c as ToolSpec, r as resolveModels } from '../provider-CvU3I-Xo.js';
|
|
3
3
|
import { P as ProviderError } from '../errors-CjVz4W_5.js';
|
|
4
|
-
import
|
|
4
|
+
import '../types-AlvjoTyS.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Exponential-backoff retry for transient provider failures. Transient errors
|
|
@@ -35,17 +35,39 @@ declare function providerErrorFromStatus(status: number, message: string): Provi
|
|
|
35
35
|
/**
|
|
36
36
|
* OpenAI-compatible provider. Targets any endpoint speaking the OpenAI
|
|
37
37
|
* `/chat/completions` API, including local servers such as LM Studio via a custom
|
|
38
|
-
* `baseUrl
|
|
38
|
+
* `baseUrl`, and GitHub Copilot (see {@link createCopilotProvider}). (FR-006)
|
|
39
|
+
*
|
|
40
|
+
* Provider compatibility notes (handled here so callers don't have to):
|
|
41
|
+
* - Tool names are sanitized to `^[a-zA-Z0-9_-]+$` on the wire (OpenAI/Copilot
|
|
42
|
+
* reject dotted names like `webiq.browse`) and translated back to the registry
|
|
43
|
+
* key when the model calls them.
|
|
44
|
+
* - Assistant turns that requested tools emit `tool_calls` with `content: null`
|
|
45
|
+
* so strict providers (e.g. Anthropic) can pair each tool result with its call.
|
|
46
|
+
* - Streaming responses accumulate `delta.tool_calls[]` keyed by `index`
|
|
47
|
+
* (fragments may start at a non-zero index when reasoning occupies 0/1).
|
|
48
|
+
* - Some reasoning models report `finish_reason: "tool_calls"` from the
|
|
49
|
+
* non-streaming endpoint without a `tool_calls` array; `generate` transparently
|
|
50
|
+
* re-requests in streaming mode and assembles them, failing loud (typed
|
|
51
|
+
* {@link ProviderError}) rather than silently stopping if none materialize.
|
|
39
52
|
*
|
|
40
53
|
* @packageDocumentation
|
|
41
54
|
*/
|
|
42
55
|
|
|
43
|
-
/**
|
|
44
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Options for {@link createOpenAICompatibleProvider}.
|
|
58
|
+
*
|
|
59
|
+
* Supply a single model via `capabilities`, or multiple via `models` (most
|
|
60
|
+
* OpenAI-compatible endpoints expose one model, but multiple are supported).
|
|
61
|
+
*/
|
|
62
|
+
interface OpenAICompatibleProviderOptions extends CredentialSource, ModelSelectionOptions {
|
|
45
63
|
/** Base URL of the OpenAI-compatible API, e.g. `http://localhost:1234/v1`. */
|
|
46
64
|
baseUrl: string;
|
|
47
|
-
/**
|
|
48
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Extra request headers merged into every call (e.g. provider-required
|
|
67
|
+
* identification headers). The `authorization` header is always set from
|
|
68
|
+
* `getCredential()` and cannot be overridden here.
|
|
69
|
+
*/
|
|
70
|
+
headers?: Record<string, string>;
|
|
49
71
|
/** Retry tuning for transient failures. */
|
|
50
72
|
retry?: RetryOptions;
|
|
51
73
|
/** Optional custom fetch (for testing or non-standard runtimes). */
|
|
@@ -80,12 +102,21 @@ declare function createOpenAICompatibleProvider(options: OpenAICompatibleProvide
|
|
|
80
102
|
* @packageDocumentation
|
|
81
103
|
*/
|
|
82
104
|
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Options for {@link createCopilotProvider}.
|
|
107
|
+
*
|
|
108
|
+
* GitHub Copilot exposes several models, so configure them via `models` (with an
|
|
109
|
+
* optional `defaultModel`). A single `capabilities` object is also accepted.
|
|
110
|
+
*/
|
|
111
|
+
interface CopilotProviderOptions extends CredentialSource, ModelSelectionOptions {
|
|
87
112
|
/** Override the Copilot base URL if needed. */
|
|
88
113
|
baseUrl?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Extra/override request headers. Merged over the required Copilot defaults
|
|
116
|
+
* (`Editor-Version`, `Editor-Plugin-Version`, `Copilot-Integration-Id`,
|
|
117
|
+
* `Openai-Intent`), so you can adjust them without losing the others.
|
|
118
|
+
*/
|
|
119
|
+
headers?: Record<string, string>;
|
|
89
120
|
/** Retry tuning for transient failures. */
|
|
90
121
|
retry?: RetryOptions;
|
|
91
122
|
/** Optional custom fetch (for testing or non-standard runtimes). */
|
|
@@ -94,14 +125,27 @@ interface CopilotProviderOptions extends CredentialSource {
|
|
|
94
125
|
/**
|
|
95
126
|
* Create a GitHub Copilot provider.
|
|
96
127
|
*
|
|
97
|
-
* @example
|
|
128
|
+
* @example Single model
|
|
98
129
|
* ```ts
|
|
99
130
|
* const provider = createCopilotProvider({
|
|
100
131
|
* getCredential: () => myCopilotToken, // never logged or persisted
|
|
101
132
|
* capabilities: { model: "gpt-4o", maxInputTokens: 128000, maxOutputTokens: 16000 },
|
|
102
133
|
* });
|
|
103
134
|
* ```
|
|
135
|
+
*
|
|
136
|
+
* @example Multiple models
|
|
137
|
+
* ```ts
|
|
138
|
+
* const provider = createCopilotProvider({
|
|
139
|
+
* getCredential: () => myCopilotToken,
|
|
140
|
+
* models: [
|
|
141
|
+
* { model: "gpt-4o", maxInputTokens: 128000, maxOutputTokens: 16000, supportsVision: true },
|
|
142
|
+
* { model: "o3-mini", maxInputTokens: 200000, maxOutputTokens: 100000, supportsReasoning: true },
|
|
143
|
+
* ],
|
|
144
|
+
* defaultModel: "gpt-4o",
|
|
145
|
+
* });
|
|
146
|
+
* // Pick a model per request: provider.generate({ messages, model: "o3-mini" })
|
|
147
|
+
* ```
|
|
104
148
|
*/
|
|
105
149
|
declare function createCopilotProvider(options: CopilotProviderOptions): Provider;
|
|
106
150
|
|
|
107
|
-
export { type CopilotProviderOptions, CredentialSource, type OpenAICompatibleProviderOptions, Provider, type RetryOptions, createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, withRetry };
|
|
151
|
+
export { type CopilotProviderOptions, CredentialSource, ModelSelectionOptions, type OpenAICompatibleProviderOptions, Provider, type RetryOptions, createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, withRetry };
|
package/dist/providers/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, withRetry } from '../chunk-
|
|
1
|
+
export { createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, resolveModels, withRetry } from '../chunk-QD2FFISV.js';
|
|
2
2
|
import '../chunk-IXV4UIF5.js';
|
|
3
3
|
import '../chunk-DEABART4.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tool } from './tool-
|
|
2
|
-
import { c as ToolSpec } from './provider-
|
|
1
|
+
import { T as Tool } from './tool-D9Uodu9Y.cjs';
|
|
2
|
+
import { c as ToolSpec } from './provider-B807EuDV.cjs';
|
|
3
3
|
import { T as ToolError } from './errors-CjVz4W_5.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tool } from './tool-
|
|
2
|
-
import { c as ToolSpec } from './provider-
|
|
1
|
+
import { T as Tool } from './tool-LPMc4QQd.js';
|
|
2
|
+
import { c as ToolSpec } from './provider-CvU3I-Xo.js';
|
|
3
3
|
import { T as ToolError } from './errors-CjVz4W_5.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Message } from './types-
|
|
2
|
-
import { P as Provider } from './provider-
|
|
1
|
+
import { M as Message, b as ModelCapabilities } from './types-AlvjoTyS.cjs';
|
|
2
|
+
import { P as Provider } from './provider-B807EuDV.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Conversation thread with automatic compaction. When a thread approaches the
|
|
@@ -15,6 +15,8 @@ interface ThreadOptions {
|
|
|
15
15
|
compactionThreshold?: number;
|
|
16
16
|
/** Provider used to summarize; defaults to the agent's own provider. (FR-004b) */
|
|
17
17
|
compactionModel?: Provider;
|
|
18
|
+
/** Capabilities of the model in use; defaults to the provider's default model. */
|
|
19
|
+
modelCapabilities?: ModelCapabilities;
|
|
18
20
|
}
|
|
19
21
|
/** Rough token estimate (~4 chars/token) — avoids a tokenizer dependency. */
|
|
20
22
|
declare function estimateTokens(messages: Message[]): number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Message } from './types-
|
|
2
|
-
import { P as Provider } from './provider-
|
|
1
|
+
import { M as Message, b as ModelCapabilities } from './types-AlvjoTyS.js';
|
|
2
|
+
import { P as Provider } from './provider-CvU3I-Xo.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Conversation thread with automatic compaction. When a thread approaches the
|
|
@@ -15,6 +15,8 @@ interface ThreadOptions {
|
|
|
15
15
|
compactionThreshold?: number;
|
|
16
16
|
/** Provider used to summarize; defaults to the agent's own provider. (FR-004b) */
|
|
17
17
|
compactionModel?: Provider;
|
|
18
|
+
/** Capabilities of the model in use; defaults to the provider's default model. */
|
|
19
|
+
modelCapabilities?: ModelCapabilities;
|
|
18
20
|
}
|
|
19
21
|
/** Rough token estimate (~4 chars/token) — avoids a tokenizer dependency. */
|
|
20
22
|
declare function estimateTokens(messages: Message[]): number;
|
package/dist/tools/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { T as Tool, d as defineTool } from '../tool-
|
|
2
|
-
import { J as JSONSchema } from '../types-
|
|
3
|
-
export { T as ToolRegistry, a as ToolResult, n as namespacedName } from '../registry-
|
|
4
|
-
import '../provider-
|
|
1
|
+
export { T as Tool, d as defineTool } from '../tool-D9Uodu9Y.cjs';
|
|
2
|
+
import { J as JSONSchema } from '../types-AlvjoTyS.cjs';
|
|
3
|
+
export { T as ToolRegistry, a as ToolResult, n as namespacedName } from '../registry-BCkSIe0E.cjs';
|
|
4
|
+
import '../provider-B807EuDV.cjs';
|
|
5
5
|
import '../errors-CjVz4W_5.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { T as Tool, d as defineTool } from '../tool-
|
|
2
|
-
import { J as JSONSchema } from '../types-
|
|
3
|
-
export { T as ToolRegistry, a as ToolResult, n as namespacedName } from '../registry-
|
|
4
|
-
import '../provider-
|
|
1
|
+
export { T as Tool, d as defineTool } from '../tool-LPMc4QQd.js';
|
|
2
|
+
import { J as JSONSchema } from '../types-AlvjoTyS.js';
|
|
3
|
+
export { T as ToolRegistry, a as ToolResult, n as namespacedName } from '../registry-D-CmT0gk.js';
|
|
4
|
+
import '../provider-CvU3I-Xo.js';
|
|
5
5
|
import '../errors-CjVz4W_5.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -20,6 +20,19 @@ type ContentPart = {
|
|
|
20
20
|
data: string;
|
|
21
21
|
mimeType: string;
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* A tool call recorded on an assistant message. Round-tripped to providers that
|
|
25
|
+
* require the assistant turn to declare its `tool_calls` (e.g. Anthropic via
|
|
26
|
+
* Copilot) so the following `tool` results have a matching `tool_use`. (FR-012)
|
|
27
|
+
*/
|
|
28
|
+
interface MessageToolCall {
|
|
29
|
+
/** Provider-assigned call id, linking the assistant call to its tool result. */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Namespaced tool name (registry key). */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Raw JSON arguments the model supplied. */
|
|
34
|
+
arguments: unknown;
|
|
35
|
+
}
|
|
23
36
|
/**
|
|
24
37
|
* A conversation message.
|
|
25
38
|
*
|
|
@@ -35,6 +48,16 @@ interface Message {
|
|
|
35
48
|
toolCallId?: string;
|
|
36
49
|
/** Optional display name (e.g., the tool name for a tool message). */
|
|
37
50
|
name?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Tool calls requested by an assistant turn. Persisted so providers that
|
|
53
|
+
* require it (e.g. Anthropic) receive `tool_calls` paired with the tool results.
|
|
54
|
+
*/
|
|
55
|
+
toolCalls?: MessageToolCall[];
|
|
56
|
+
/**
|
|
57
|
+
* Opaque reasoning blob carried across turns for thinking-capable models, so
|
|
58
|
+
* reasoning continuity is preserved without exposing the contents. (FR-003a)
|
|
59
|
+
*/
|
|
60
|
+
reasoningOpaque?: string;
|
|
38
61
|
}
|
|
39
62
|
/**
|
|
40
63
|
* Per-model capabilities supplied by the caller. The framework cannot reliably
|
|
@@ -60,4 +83,4 @@ declare function hasImage(message: Message): boolean;
|
|
|
60
83
|
/** Extract the concatenated text from a message. */
|
|
61
84
|
declare function messageText(message: Message): string;
|
|
62
85
|
|
|
63
|
-
export { type ContentPart as C, type JSONSchema as J, type Message as M, type Role as R, type
|
|
86
|
+
export { type ContentPart as C, type JSONSchema as J, type Message as M, type Role as R, type MessageToolCall as a, type ModelCapabilities as b, hasImage as h, messageText as m, textMessage as t };
|
|
@@ -20,6 +20,19 @@ type ContentPart = {
|
|
|
20
20
|
data: string;
|
|
21
21
|
mimeType: string;
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* A tool call recorded on an assistant message. Round-tripped to providers that
|
|
25
|
+
* require the assistant turn to declare its `tool_calls` (e.g. Anthropic via
|
|
26
|
+
* Copilot) so the following `tool` results have a matching `tool_use`. (FR-012)
|
|
27
|
+
*/
|
|
28
|
+
interface MessageToolCall {
|
|
29
|
+
/** Provider-assigned call id, linking the assistant call to its tool result. */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Namespaced tool name (registry key). */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Raw JSON arguments the model supplied. */
|
|
34
|
+
arguments: unknown;
|
|
35
|
+
}
|
|
23
36
|
/**
|
|
24
37
|
* A conversation message.
|
|
25
38
|
*
|
|
@@ -35,6 +48,16 @@ interface Message {
|
|
|
35
48
|
toolCallId?: string;
|
|
36
49
|
/** Optional display name (e.g., the tool name for a tool message). */
|
|
37
50
|
name?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Tool calls requested by an assistant turn. Persisted so providers that
|
|
53
|
+
* require it (e.g. Anthropic) receive `tool_calls` paired with the tool results.
|
|
54
|
+
*/
|
|
55
|
+
toolCalls?: MessageToolCall[];
|
|
56
|
+
/**
|
|
57
|
+
* Opaque reasoning blob carried across turns for thinking-capable models, so
|
|
58
|
+
* reasoning continuity is preserved without exposing the contents. (FR-003a)
|
|
59
|
+
*/
|
|
60
|
+
reasoningOpaque?: string;
|
|
38
61
|
}
|
|
39
62
|
/**
|
|
40
63
|
* Per-model capabilities supplied by the caller. The framework cannot reliably
|
|
@@ -60,4 +83,4 @@ declare function hasImage(message: Message): boolean;
|
|
|
60
83
|
/** Extract the concatenated text from a message. */
|
|
61
84
|
declare function messageText(message: Message): string;
|
|
62
85
|
|
|
63
|
-
export { type ContentPart as C, type JSONSchema as J, type Message as M, type Role as R, type
|
|
86
|
+
export { type ContentPart as C, type JSONSchema as J, type Message as M, type Role as R, type MessageToolCall as a, type ModelCapabilities as b, hasImage as h, messageText as m, textMessage as t };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as Agent } from '../index-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { A as Agent } from '../index-b1oTo3Lv.cjs';
|
|
2
|
+
import '../types-AlvjoTyS.cjs';
|
|
3
3
|
import '../errors-CjVz4W_5.cjs';
|
|
4
|
-
import '../provider-
|
|
5
|
-
import '../tool-
|
|
4
|
+
import '../provider-B807EuDV.cjs';
|
|
5
|
+
import '../tool-D9Uodu9Y.cjs';
|
|
6
6
|
import '../skill-DfNChtJN.cjs';
|
|
7
|
-
import '../thread-
|
|
8
|
-
import '../registry-
|
|
7
|
+
import '../thread-BzwE1OnJ.cjs';
|
|
8
|
+
import '../registry-BCkSIe0E.cjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Bounded-concurrency execution with a configurable failure policy for concurrent
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as Agent } from '../index-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { A as Agent } from '../index-C22fqyZQ.js';
|
|
2
|
+
import '../types-AlvjoTyS.js';
|
|
3
3
|
import '../errors-CjVz4W_5.js';
|
|
4
|
-
import '../provider-
|
|
5
|
-
import '../tool-
|
|
4
|
+
import '../provider-CvU3I-Xo.js';
|
|
5
|
+
import '../tool-LPMc4QQd.js';
|
|
6
6
|
import '../skill-DfNChtJN.js';
|
|
7
|
-
import '../thread-
|
|
8
|
-
import '../registry-
|
|
7
|
+
import '../thread-COljUAtD.js';
|
|
8
|
+
import '../registry-D-CmT0gk.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Bounded-concurrency execution with a configurable failure policy for concurrent
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-framework-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Modular, tree-shakeable JavaScript/TypeScript agent framework for no-backend deployments (browser, edge, Node). Agents, tools, MCP, skills, multi-agent workflows, middleware, persistence, and OpenTelemetry observability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"files": [
|
|
85
85
|
"dist",
|
|
86
86
|
"README.md",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
87
|
+
"LICENSE",
|
|
88
|
+
"CHANGELOG.md"
|
|
89
89
|
],
|
|
90
90
|
"scripts": {
|
|
91
91
|
"build": "tsup",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"test:watch": "vitest",
|
|
95
95
|
"lint": "eslint .",
|
|
96
96
|
"format": "prettier --write .",
|
|
97
|
-
"audit": "npm audit --audit-level=high",
|
|
97
|
+
"audit": "npm audit --omit=dev --audit-level=high",
|
|
98
98
|
"prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build"
|
|
99
99
|
},
|
|
100
100
|
"keywords": [
|