agent-framework-js 0.2.0 → 0.4.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 (81) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +6 -0
  3. package/dist/agents/index.cjs +7 -7
  4. package/dist/agents/index.d.cts +6 -6
  5. package/dist/agents/index.d.ts +6 -6
  6. package/dist/agents/index.js +2 -2
  7. package/dist/{chunk-245NZAGV.cjs → chunk-2WBJEXNY.cjs} +4 -4
  8. package/dist/{chunk-245NZAGV.cjs.map → chunk-2WBJEXNY.cjs.map} +1 -1
  9. package/dist/{chunk-IGIFX6QO.js → chunk-3KU76DCP.js} +4 -4
  10. package/dist/{chunk-IGIFX6QO.js.map → chunk-3KU76DCP.js.map} +1 -1
  11. package/dist/{chunk-S5776DOL.js → chunk-55NB43FN.js} +3 -3
  12. package/dist/{chunk-S5776DOL.js.map → chunk-55NB43FN.js.map} +1 -1
  13. package/dist/{chunk-UIXNKPLQ.cjs → chunk-5KC6X2T5.cjs} +7 -7
  14. package/dist/{chunk-UIXNKPLQ.cjs.map → chunk-5KC6X2T5.cjs.map} +1 -1
  15. package/dist/{chunk-NURRGYIU.cjs → chunk-FDCTSJMB.cjs} +13 -11
  16. package/dist/chunk-FDCTSJMB.cjs.map +1 -0
  17. package/dist/{chunk-ILBKDEEL.cjs → chunk-I55OVD23.cjs} +2 -2
  18. package/dist/chunk-I55OVD23.cjs.map +1 -0
  19. package/dist/{chunk-U64OEHG6.cjs → chunk-JLPLGU7O.cjs} +131 -21
  20. package/dist/chunk-JLPLGU7O.cjs.map +1 -0
  21. package/dist/{chunk-WEKU7735.js → chunk-KOPGBIES.js} +6 -4
  22. package/dist/chunk-KOPGBIES.js.map +1 -0
  23. package/dist/{chunk-E4VTVUYU.js → chunk-LC54DGGR.js} +2 -2
  24. package/dist/chunk-LC54DGGR.js.map +1 -0
  25. package/dist/{chunk-FOTCUNP5.cjs → chunk-N64ZFATA.cjs} +5 -2
  26. package/dist/chunk-N64ZFATA.cjs.map +1 -0
  27. package/dist/{chunk-ACBIHS5H.js → chunk-QXAJ4DUJ.js} +5 -2
  28. package/dist/chunk-QXAJ4DUJ.js.map +1 -0
  29. package/dist/{chunk-YH5746OF.js → chunk-QYG4HLIC.js} +3 -3
  30. package/dist/{chunk-YH5746OF.js.map → chunk-QYG4HLIC.js.map} +1 -1
  31. package/dist/{chunk-GYDY3KX5.cjs → chunk-U3ULJMNH.cjs} +4 -4
  32. package/dist/{chunk-GYDY3KX5.cjs.map → chunk-U3ULJMNH.cjs.map} +1 -1
  33. package/dist/{chunk-7M3EAGCA.js → chunk-YVJGF4HQ.js} +132 -22
  34. package/dist/chunk-YVJGF4HQ.js.map +1 -0
  35. package/dist/declarative/index.cjs +4 -4
  36. package/dist/declarative/index.d.cts +6 -6
  37. package/dist/declarative/index.d.ts +6 -6
  38. package/dist/declarative/index.js +3 -3
  39. package/dist/{index-Dog-CyOK.d.ts → index-C22fqyZQ.d.ts} +5 -5
  40. package/dist/{index-5eIhfrC1.d.cts → index-b1oTo3Lv.d.cts} +5 -5
  41. package/dist/index.cjs +37 -37
  42. package/dist/index.d.cts +11 -6
  43. package/dist/index.d.ts +11 -6
  44. package/dist/index.js +7 -7
  45. package/dist/mcp/index.cjs +4 -4
  46. package/dist/mcp/index.d.cts +2 -2
  47. package/dist/mcp/index.d.ts +2 -2
  48. package/dist/mcp/index.js +2 -2
  49. package/dist/middleware/index.d.cts +7 -7
  50. package/dist/middleware/index.d.ts +7 -7
  51. package/dist/persistence/index.cjs +6 -6
  52. package/dist/persistence/index.d.cts +3 -3
  53. package/dist/persistence/index.d.ts +3 -3
  54. package/dist/persistence/index.js +3 -3
  55. package/dist/{provider-IJnfNhCX.d.cts → provider-B807EuDV.d.cts} +6 -1
  56. package/dist/{provider-C_rgZvmX.d.ts → provider-CvU3I-Xo.d.ts} +6 -1
  57. package/dist/providers/index.cjs +7 -6
  58. package/dist/providers/index.d.cts +39 -4
  59. package/dist/providers/index.d.ts +39 -4
  60. package/dist/providers/index.js +2 -1
  61. package/dist/{registry-B-hicOxp.d.cts → registry-BCkSIe0E.d.cts} +2 -2
  62. package/dist/{registry-KMWN0p4Z.d.ts → registry-D-CmT0gk.d.ts} +2 -2
  63. package/dist/{thread-D3zaGK1Y.d.cts → thread-BzwE1OnJ.d.cts} +2 -2
  64. package/dist/{thread-COV135Ja.d.ts → thread-COljUAtD.d.ts} +2 -2
  65. package/dist/{tool-BZg_znMZ.d.cts → tool-D9Uodu9Y.d.cts} +1 -1
  66. package/dist/{tool-CSCC87OD.d.ts → tool-LPMc4QQd.d.ts} +1 -1
  67. package/dist/tools/index.d.cts +4 -4
  68. package/dist/tools/index.d.ts +4 -4
  69. package/dist/{types-Cn1g9Tg4.d.cts → types-AlvjoTyS.d.cts} +24 -1
  70. package/dist/{types-Cn1g9Tg4.d.ts → types-AlvjoTyS.d.ts} +24 -1
  71. package/dist/workflows/index.d.cts +6 -6
  72. package/dist/workflows/index.d.ts +6 -6
  73. package/package.json +7 -7
  74. package/dist/chunk-7M3EAGCA.js.map +0 -1
  75. package/dist/chunk-ACBIHS5H.js.map +0 -1
  76. package/dist/chunk-E4VTVUYU.js.map +0 -1
  77. package/dist/chunk-FOTCUNP5.cjs.map +0 -1
  78. package/dist/chunk-ILBKDEEL.cjs.map +0 -1
  79. package/dist/chunk-NURRGYIU.cjs.map +0 -1
  80. package/dist/chunk-U64OEHG6.cjs.map +0 -1
  81. package/dist/chunk-WEKU7735.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -3,18 +3,18 @@
3
3
  var chunkIU3LS5FC_cjs = require('./chunk-IU3LS5FC.cjs');
4
4
  var chunkRZP2ZUUX_cjs = require('./chunk-RZP2ZUUX.cjs');
5
5
  require('./chunk-5M6ER4ZX.cjs');
6
- var chunk245NZAGV_cjs = require('./chunk-245NZAGV.cjs');
7
- var chunkNURRGYIU_cjs = require('./chunk-NURRGYIU.cjs');
6
+ var chunk2WBJEXNY_cjs = require('./chunk-2WBJEXNY.cjs');
7
+ var chunkFDCTSJMB_cjs = require('./chunk-FDCTSJMB.cjs');
8
8
  var chunkWSMYH2IN_cjs = require('./chunk-WSMYH2IN.cjs');
9
9
  var chunkTAMJ5HSR_cjs = require('./chunk-TAMJ5HSR.cjs');
10
10
  var chunkKEI3EALJ_cjs = require('./chunk-KEI3EALJ.cjs');
11
11
  var chunkFSDMBWQV_cjs = require('./chunk-FSDMBWQV.cjs');
12
- var chunkGYDY3KX5_cjs = require('./chunk-GYDY3KX5.cjs');
12
+ var chunkU3ULJMNH_cjs = require('./chunk-U3ULJMNH.cjs');
13
13
  var chunkV6O6SYAN_cjs = require('./chunk-V6O6SYAN.cjs');
14
- var chunkUIXNKPLQ_cjs = require('./chunk-UIXNKPLQ.cjs');
15
- var chunkILBKDEEL_cjs = require('./chunk-ILBKDEEL.cjs');
16
- var chunkFOTCUNP5_cjs = require('./chunk-FOTCUNP5.cjs');
17
- var chunkU64OEHG6_cjs = require('./chunk-U64OEHG6.cjs');
14
+ var chunk5KC6X2T5_cjs = require('./chunk-5KC6X2T5.cjs');
15
+ var chunkI55OVD23_cjs = require('./chunk-I55OVD23.cjs');
16
+ var chunkJLPLGU7O_cjs = require('./chunk-JLPLGU7O.cjs');
17
+ var chunkN64ZFATA_cjs = require('./chunk-N64ZFATA.cjs');
18
18
  var chunkMQ2XTH3S_cjs = require('./chunk-MQ2XTH3S.cjs');
19
19
  var chunkIJASUMIQ_cjs = require('./chunk-IJASUMIQ.cjs');
20
20
 
@@ -66,19 +66,19 @@ Object.defineProperty(exports, "stepSequential", {
66
66
  });
67
67
  Object.defineProperty(exports, "loadAgentDefinition", {
68
68
  enumerable: true,
69
- get: function () { return chunk245NZAGV_cjs.loadAgentDefinition; }
69
+ get: function () { return chunk2WBJEXNY_cjs.loadAgentDefinition; }
70
70
  });
71
71
  Object.defineProperty(exports, "buildMessages", {
72
72
  enumerable: true,
73
- get: function () { return chunkNURRGYIU_cjs.buildMessages; }
73
+ get: function () { return chunkFDCTSJMB_cjs.buildMessages; }
74
74
  });
75
75
  Object.defineProperty(exports, "createAgent", {
76
76
  enumerable: true,
77
- get: function () { return chunkNURRGYIU_cjs.createAgent; }
77
+ get: function () { return chunkFDCTSJMB_cjs.createAgent; }
78
78
  });
79
79
  Object.defineProperty(exports, "runLoop", {
80
80
  enumerable: true,
81
- get: function () { return chunkNURRGYIU_cjs.runLoop; }
81
+ get: function () { return chunkFDCTSJMB_cjs.runLoop; }
82
82
  });
83
83
  Object.defineProperty(exports, "SkillIndex", {
84
84
  enumerable: true,
@@ -114,11 +114,11 @@ Object.defineProperty(exports, "composeMiddleware", {
114
114
  });
115
115
  Object.defineProperty(exports, "connectMCP", {
116
116
  enumerable: true,
117
- get: function () { return chunkGYDY3KX5_cjs.connectMCP; }
117
+ get: function () { return chunkU3ULJMNH_cjs.connectMCP; }
118
118
  });
119
119
  Object.defineProperty(exports, "mcpToolToTool", {
120
120
  enumerable: true,
121
- get: function () { return chunkGYDY3KX5_cjs.mcpToolToTool; }
121
+ get: function () { return chunkU3ULJMNH_cjs.mcpToolToTool; }
122
122
  });
123
123
  Object.defineProperty(exports, "configureObservability", {
124
124
  enumerable: true,
@@ -138,67 +138,67 @@ Object.defineProperty(exports, "withSpan", {
138
138
  });
139
139
  Object.defineProperty(exports, "ThreadPersistence", {
140
140
  enumerable: true,
141
- get: function () { return chunkUIXNKPLQ_cjs.ThreadPersistence; }
141
+ get: function () { return chunk5KC6X2T5_cjs.ThreadPersistence; }
142
142
  });
143
143
  Object.defineProperty(exports, "createBrowserStore", {
144
144
  enumerable: true,
145
- get: function () { return chunkUIXNKPLQ_cjs.createBrowserStore; }
145
+ get: function () { return chunk5KC6X2T5_cjs.createBrowserStore; }
146
146
  });
147
147
  Object.defineProperty(exports, "createMemoryStore", {
148
148
  enumerable: true,
149
- get: function () { return chunkUIXNKPLQ_cjs.createMemoryStore; }
149
+ get: function () { return chunk5KC6X2T5_cjs.createMemoryStore; }
150
150
  });
151
151
  Object.defineProperty(exports, "Thread", {
152
152
  enumerable: true,
153
- get: function () { return chunkILBKDEEL_cjs.Thread; }
153
+ get: function () { return chunkI55OVD23_cjs.Thread; }
154
154
  });
155
155
  Object.defineProperty(exports, "estimateTokens", {
156
156
  enumerable: true,
157
- get: function () { return chunkILBKDEEL_cjs.estimateTokens; }
157
+ get: function () { return chunkI55OVD23_cjs.estimateTokens; }
158
158
  });
159
159
  Object.defineProperty(exports, "hasImage", {
160
160
  enumerable: true,
161
- get: function () { return chunkILBKDEEL_cjs.hasImage; }
161
+ get: function () { return chunkI55OVD23_cjs.hasImage; }
162
162
  });
163
163
  Object.defineProperty(exports, "messageText", {
164
164
  enumerable: true,
165
- get: function () { return chunkILBKDEEL_cjs.messageText; }
165
+ get: function () { return chunkI55OVD23_cjs.messageText; }
166
166
  });
167
167
  Object.defineProperty(exports, "textMessage", {
168
168
  enumerable: true,
169
- get: function () { return chunkILBKDEEL_cjs.textMessage; }
169
+ get: function () { return chunkI55OVD23_cjs.textMessage; }
170
170
  });
171
- Object.defineProperty(exports, "detectRuntime", {
171
+ Object.defineProperty(exports, "createCopilotProvider", {
172
172
  enumerable: true,
173
- get: function () { return chunkFOTCUNP5_cjs.detectRuntime; }
173
+ get: function () { return chunkJLPLGU7O_cjs.createCopilotProvider; }
174
174
  });
175
- Object.defineProperty(exports, "requireCapability", {
175
+ Object.defineProperty(exports, "createOpenAICompatibleProvider", {
176
176
  enumerable: true,
177
- get: function () { return chunkFOTCUNP5_cjs.requireCapability; }
177
+ get: function () { return chunkJLPLGU7O_cjs.createOpenAICompatibleProvider; }
178
178
  });
179
- Object.defineProperty(exports, "resetRuntimeCache", {
179
+ Object.defineProperty(exports, "providerErrorFromStatus", {
180
180
  enumerable: true,
181
- get: function () { return chunkFOTCUNP5_cjs.resetRuntimeCache; }
181
+ get: function () { return chunkJLPLGU7O_cjs.providerErrorFromStatus; }
182
182
  });
183
- Object.defineProperty(exports, "createCopilotProvider", {
183
+ Object.defineProperty(exports, "resolveModels", {
184
184
  enumerable: true,
185
- get: function () { return chunkU64OEHG6_cjs.createCopilotProvider; }
185
+ get: function () { return chunkJLPLGU7O_cjs.resolveModels; }
186
186
  });
187
- Object.defineProperty(exports, "createOpenAICompatibleProvider", {
187
+ Object.defineProperty(exports, "withRetry", {
188
188
  enumerable: true,
189
- get: function () { return chunkU64OEHG6_cjs.createOpenAICompatibleProvider; }
189
+ get: function () { return chunkJLPLGU7O_cjs.withRetry; }
190
190
  });
191
- Object.defineProperty(exports, "providerErrorFromStatus", {
191
+ Object.defineProperty(exports, "detectRuntime", {
192
192
  enumerable: true,
193
- get: function () { return chunkU64OEHG6_cjs.providerErrorFromStatus; }
193
+ get: function () { return chunkN64ZFATA_cjs.detectRuntime; }
194
194
  });
195
- Object.defineProperty(exports, "resolveModels", {
195
+ Object.defineProperty(exports, "requireCapability", {
196
196
  enumerable: true,
197
- get: function () { return chunkU64OEHG6_cjs.resolveModels; }
197
+ get: function () { return chunkN64ZFATA_cjs.requireCapability; }
198
198
  });
199
- Object.defineProperty(exports, "withRetry", {
199
+ Object.defineProperty(exports, "resetRuntimeCache", {
200
200
  enumerable: true,
201
- get: function () { return chunkU64OEHG6_cjs.withRetry; }
201
+ get: function () { return chunkN64ZFATA_cjs.resetRuntimeCache; }
202
202
  });
203
203
  Object.defineProperty(exports, "CheckpointError", {
204
204
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- export { C as ContentPart, J as JSONSchema, M as Message, a as ModelCapabilities, R as Role, h as hasImage, m as messageText, t as textMessage } from './types-Cn1g9Tg4.cjs';
1
+ export { C as ContentPart, J as JSONSchema, M as Message, a as MessageToolCall, b as ModelCapabilities, R as Role, h as hasImage, m as messageText, t as textMessage } from './types-AlvjoTyS.cjs';
2
2
  export { C as CheckpointError, a as CheckpointErrorReason, E as ErrorKind, F as FrameworkError, M as MCPError, P as ProviderError, b as ProviderErrorReason, R as RuntimeUnsupportedError, T as ToolError, c as ToolErrorReason, V as ValidationError } from './errors-CjVz4W_5.cjs';
3
3
  export { O as ObservabilityConfig, R as REDACTED, c as configureObservability, i as isObservabilityEnabled, r as redact, a as resetObservability, w as withSpan } from './index-C2vzfbBz.cjs';
4
- export { C as CredentialSource, G as GenerateChunk, a as GenerateRequest, b as GenerateResponse, M as ModelSelectionOptions, P as Provider, R as ResolvedModels, T as ToolCall, c as ToolSpec, r as resolveModels } from './provider-IJnfNhCX.cjs';
4
+ export { C as CredentialSource, G as GenerateChunk, a as GenerateRequest, b as GenerateResponse, M as ModelSelectionOptions, P as Provider, R as ResolvedModels, T as ToolCall, c as ToolSpec, r as resolveModels } from './provider-B807EuDV.cjs';
5
5
  export { CopilotProviderOptions, OpenAICompatibleProviderOptions, RetryOptions, createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, withRetry } from './providers/index.cjs';
6
- export { T as Tool, d as defineTool } from './tool-BZg_znMZ.cjs';
6
+ export { T as Tool, d as defineTool } from './tool-D9Uodu9Y.cjs';
7
7
  export { validateArgs } from './tools/index.cjs';
8
- export { T as ToolRegistry, a as ToolResult, n as namespacedName } from './registry-B-hicOxp.cjs';
9
- export { A as Agent, a as AgentConfig, b as AgentInput, G as GenerateFn, L as LoopOptions, c as LoopResult, M as Middleware, d as MiddlewareContext, N as Next, R as RunChunk, e as RunOptions, f as RunResult, g as RunStatus, h as buildMessages, i as composeMiddleware, j as createAgent, r as runLoop } from './index-5eIhfrC1.cjs';
10
- export { T as Thread, a as ThreadOptions, e as estimateTokens } from './thread-D3zaGK1Y.cjs';
8
+ export { T as ToolRegistry, a as ToolResult, n as namespacedName } from './registry-BCkSIe0E.cjs';
9
+ export { A as Agent, a as AgentConfig, b as AgentInput, G as GenerateFn, L as LoopOptions, c as LoopResult, M as Middleware, d as MiddlewareContext, N as Next, R as RunChunk, e as RunOptions, f as RunResult, g as RunStatus, h as buildMessages, i as composeMiddleware, j as createAgent, r as runLoop } from './index-b1oTo3Lv.cjs';
10
+ export { T as Thread, a as ThreadOptions, e as estimateTokens } from './thread-BzwE1OnJ.cjs';
11
11
  export { MCPConnection, MCPConnectionConfig, MCPTransport, connectMCP, mcpToolToTool } from './mcp/index.cjs';
12
12
  export { SkillIndex } from './skills/index.cjs';
13
13
  export { BranchResult, CHECKPOINT_VERSION, Checkpoint, FailurePolicy, PatternHooks, StepResult, Workflow, WorkflowConfig, WorkflowContext, WorkflowEvent, WorkflowPattern, WorkflowState, WorkflowStatus, createCheckpoint, createWorkflow, restoreCheckpoint, runBounded, serializeCheckpoint, stepConcurrent, stepGroup, stepHandoff, stepSequential } from './workflows/index.cjs';
@@ -34,6 +34,11 @@ interface RuntimeCapabilities {
34
34
  hasIndexedDB: boolean;
35
35
  /** Running under Node.js. */
36
36
  isNode: boolean;
37
+ /**
38
+ * Running inside a web browser (has `window`/`document`). Distinguished from
39
+ * edge runtimes, which also lack Node but make server-side (CORS-free) requests.
40
+ */
41
+ isBrowser: boolean;
37
42
  }
38
43
  /** Detect the current runtime's capabilities (memoized). */
39
44
  declare function detectRuntime(): RuntimeCapabilities;
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export { C as ContentPart, J as JSONSchema, M as Message, a as ModelCapabilities, R as Role, h as hasImage, m as messageText, t as textMessage } from './types-Cn1g9Tg4.js';
1
+ export { C as ContentPart, J as JSONSchema, M as Message, a as MessageToolCall, b as ModelCapabilities, R as Role, h as hasImage, m as messageText, t as textMessage } from './types-AlvjoTyS.js';
2
2
  export { C as CheckpointError, a as CheckpointErrorReason, E as ErrorKind, F as FrameworkError, M as MCPError, P as ProviderError, b as ProviderErrorReason, R as RuntimeUnsupportedError, T as ToolError, c as ToolErrorReason, V as ValidationError } from './errors-CjVz4W_5.js';
3
3
  export { O as ObservabilityConfig, R as REDACTED, c as configureObservability, i as isObservabilityEnabled, r as redact, a as resetObservability, w as withSpan } from './index-C2vzfbBz.js';
4
- export { C as CredentialSource, G as GenerateChunk, a as GenerateRequest, b as GenerateResponse, M as ModelSelectionOptions, P as Provider, R as ResolvedModels, T as ToolCall, c as ToolSpec, r as resolveModels } from './provider-C_rgZvmX.js';
4
+ export { C as CredentialSource, G as GenerateChunk, a as GenerateRequest, b as GenerateResponse, M as ModelSelectionOptions, P as Provider, R as ResolvedModels, T as ToolCall, c as ToolSpec, r as resolveModels } from './provider-CvU3I-Xo.js';
5
5
  export { CopilotProviderOptions, OpenAICompatibleProviderOptions, RetryOptions, createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, withRetry } from './providers/index.js';
6
- export { T as Tool, d as defineTool } from './tool-CSCC87OD.js';
6
+ export { T as Tool, d as defineTool } from './tool-LPMc4QQd.js';
7
7
  export { validateArgs } from './tools/index.js';
8
- export { T as ToolRegistry, a as ToolResult, n as namespacedName } from './registry-KMWN0p4Z.js';
9
- export { A as Agent, a as AgentConfig, b as AgentInput, G as GenerateFn, L as LoopOptions, c as LoopResult, M as Middleware, d as MiddlewareContext, N as Next, R as RunChunk, e as RunOptions, f as RunResult, g as RunStatus, h as buildMessages, i as composeMiddleware, j as createAgent, r as runLoop } from './index-Dog-CyOK.js';
10
- export { T as Thread, a as ThreadOptions, e as estimateTokens } from './thread-COV135Ja.js';
8
+ export { T as ToolRegistry, a as ToolResult, n as namespacedName } from './registry-D-CmT0gk.js';
9
+ export { A as Agent, a as AgentConfig, b as AgentInput, G as GenerateFn, L as LoopOptions, c as LoopResult, M as Middleware, d as MiddlewareContext, N as Next, R as RunChunk, e as RunOptions, f as RunResult, g as RunStatus, h as buildMessages, i as composeMiddleware, j as createAgent, r as runLoop } from './index-C22fqyZQ.js';
10
+ export { T as Thread, a as ThreadOptions, e as estimateTokens } from './thread-COljUAtD.js';
11
11
  export { MCPConnection, MCPConnectionConfig, MCPTransport, connectMCP, mcpToolToTool } from './mcp/index.js';
12
12
  export { SkillIndex } from './skills/index.js';
13
13
  export { BranchResult, CHECKPOINT_VERSION, Checkpoint, FailurePolicy, PatternHooks, StepResult, Workflow, WorkflowConfig, WorkflowContext, WorkflowEvent, WorkflowPattern, WorkflowState, WorkflowStatus, createCheckpoint, createWorkflow, restoreCheckpoint, runBounded, serializeCheckpoint, stepConcurrent, stepGroup, stepHandoff, stepSequential } from './workflows/index.js';
@@ -34,6 +34,11 @@ interface RuntimeCapabilities {
34
34
  hasIndexedDB: boolean;
35
35
  /** Running under Node.js. */
36
36
  isNode: boolean;
37
+ /**
38
+ * Running inside a web browser (has `window`/`document`). Distinguished from
39
+ * edge runtimes, which also lack Node but make server-side (CORS-free) requests.
40
+ */
41
+ isBrowser: boolean;
37
42
  }
38
43
  /** Detect the current runtime's capabilities (memoized). */
39
44
  declare function detectRuntime(): RuntimeCapabilities;
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  export { defineTool } from './chunk-RZ43WNHR.js';
2
2
  export { CHECKPOINT_VERSION, createCheckpoint, createWorkflow, restoreCheckpoint, runBounded, serializeCheckpoint, stepConcurrent, stepGroup, stepHandoff, stepSequential } from './chunk-T2GHJ5R4.js';
3
3
  import './chunk-MCLVWCOB.js';
4
- export { loadAgentDefinition } from './chunk-S5776DOL.js';
5
- export { buildMessages, createAgent, runLoop } from './chunk-WEKU7735.js';
4
+ export { loadAgentDefinition } from './chunk-55NB43FN.js';
5
+ export { buildMessages, createAgent, runLoop } from './chunk-KOPGBIES.js';
6
6
  export { SkillIndex, defineSkill, loadSource } from './chunk-YCBDEEAV.js';
7
7
  export { ToolRegistry, namespacedName, validateArgs } from './chunk-HGEPXJDG.js';
8
8
  export { useMiddleware } from './chunk-IUKD54F7.js';
9
9
  export { composeMiddleware } from './chunk-7ZXUIHLH.js';
10
- export { connectMCP, mcpToolToTool } from './chunk-YH5746OF.js';
10
+ export { connectMCP, mcpToolToTool } from './chunk-QYG4HLIC.js';
11
11
  export { configureObservability, isObservabilityEnabled, resetObservability, withSpan } from './chunk-5PDJOBTD.js';
12
- export { ThreadPersistence, createBrowserStore, createMemoryStore } from './chunk-IGIFX6QO.js';
13
- export { Thread, estimateTokens, hasImage, messageText, textMessage } from './chunk-E4VTVUYU.js';
14
- export { detectRuntime, requireCapability, resetRuntimeCache } from './chunk-ACBIHS5H.js';
15
- export { createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, resolveModels, withRetry } from './chunk-7M3EAGCA.js';
12
+ export { ThreadPersistence, createBrowserStore, createMemoryStore } from './chunk-3KU76DCP.js';
13
+ export { Thread, estimateTokens, hasImage, messageText, textMessage } from './chunk-LC54DGGR.js';
14
+ export { createCopilotProvider, createOpenAICompatibleProvider, providerErrorFromStatus, resolveModels, withRetry } from './chunk-YVJGF4HQ.js';
15
+ export { detectRuntime, requireCapability, resetRuntimeCache } from './chunk-QXAJ4DUJ.js';
16
16
  export { CheckpointError, FrameworkError, MCPError, ProviderError, RuntimeUnsupportedError, ToolError, ValidationError } from './chunk-IXV4UIF5.js';
17
17
  export { REDACTED, redact } from './chunk-DEABART4.js';
18
18
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkGYDY3KX5_cjs = require('../chunk-GYDY3KX5.cjs');
4
- require('../chunk-FOTCUNP5.cjs');
3
+ var chunkU3ULJMNH_cjs = require('../chunk-U3ULJMNH.cjs');
4
+ require('../chunk-N64ZFATA.cjs');
5
5
  require('../chunk-MQ2XTH3S.cjs');
6
6
  require('../chunk-IJASUMIQ.cjs');
7
7
 
@@ -9,11 +9,11 @@ require('../chunk-IJASUMIQ.cjs');
9
9
 
10
10
  Object.defineProperty(exports, "connectMCP", {
11
11
  enumerable: true,
12
- get: function () { return chunkGYDY3KX5_cjs.connectMCP; }
12
+ get: function () { return chunkU3ULJMNH_cjs.connectMCP; }
13
13
  });
14
14
  Object.defineProperty(exports, "mcpToolToTool", {
15
15
  enumerable: true,
16
- get: function () { return chunkGYDY3KX5_cjs.mcpToolToTool; }
16
+ get: function () { return chunkU3ULJMNH_cjs.mcpToolToTool; }
17
17
  });
18
18
  //# sourceMappingURL=index.cjs.map
19
19
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { T as Tool } from '../tool-BZg_znMZ.cjs';
2
- import '../types-Cn1g9Tg4.cjs';
1
+ import { T as Tool } from '../tool-D9Uodu9Y.cjs';
2
+ import '../types-AlvjoTyS.cjs';
3
3
 
4
4
  /**
5
5
  * MCP (Model Context Protocol) integration. Connects to MCP servers and exposes
@@ -1,5 +1,5 @@
1
- import { T as Tool } from '../tool-CSCC87OD.js';
2
- import '../types-Cn1g9Tg4.js';
1
+ import { T as Tool } from '../tool-LPMc4QQd.js';
2
+ import '../types-AlvjoTyS.js';
3
3
 
4
4
  /**
5
5
  * MCP (Model Context Protocol) integration. Connects to MCP servers and exposes
package/dist/mcp/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { connectMCP, mcpToolToTool } from '../chunk-YH5746OF.js';
2
- import '../chunk-ACBIHS5H.js';
1
+ export { connectMCP, mcpToolToTool } from '../chunk-QYG4HLIC.js';
2
+ import '../chunk-QXAJ4DUJ.js';
3
3
  import '../chunk-IXV4UIF5.js';
4
4
  import '../chunk-DEABART4.js';
5
5
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,12 @@
1
- import { a as AgentConfig, M as Middleware } from '../index-5eIhfrC1.cjs';
2
- export { d as MiddlewareContext, N as Next, i as composeMiddleware } from '../index-5eIhfrC1.cjs';
3
- import '../types-Cn1g9Tg4.cjs';
1
+ import { a as AgentConfig, M as Middleware } from '../index-b1oTo3Lv.cjs';
2
+ export { d as MiddlewareContext, N as Next, i as composeMiddleware } from '../index-b1oTo3Lv.cjs';
3
+ import '../types-AlvjoTyS.cjs';
4
4
  import '../errors-CjVz4W_5.cjs';
5
- import '../provider-IJnfNhCX.cjs';
6
- import '../tool-BZg_znMZ.cjs';
5
+ import '../provider-B807EuDV.cjs';
6
+ import '../tool-D9Uodu9Y.cjs';
7
7
  import '../skill-DfNChtJN.cjs';
8
- import '../thread-D3zaGK1Y.cjs';
9
- import '../registry-B-hicOxp.cjs';
8
+ import '../thread-BzwE1OnJ.cjs';
9
+ import '../registry-BCkSIe0E.cjs';
10
10
 
11
11
  /**
12
12
  * Convenience helper for attaching middleware to an agent configuration.
@@ -1,12 +1,12 @@
1
- import { a as AgentConfig, M as Middleware } from '../index-Dog-CyOK.js';
2
- export { d as MiddlewareContext, N as Next, i as composeMiddleware } from '../index-Dog-CyOK.js';
3
- import '../types-Cn1g9Tg4.js';
1
+ import { a as AgentConfig, M as Middleware } from '../index-C22fqyZQ.js';
2
+ export { d as MiddlewareContext, N as Next, i as composeMiddleware } from '../index-C22fqyZQ.js';
3
+ import '../types-AlvjoTyS.js';
4
4
  import '../errors-CjVz4W_5.js';
5
- import '../provider-C_rgZvmX.js';
6
- import '../tool-CSCC87OD.js';
5
+ import '../provider-CvU3I-Xo.js';
6
+ import '../tool-LPMc4QQd.js';
7
7
  import '../skill-DfNChtJN.js';
8
- import '../thread-COV135Ja.js';
9
- import '../registry-KMWN0p4Z.js';
8
+ import '../thread-COljUAtD.js';
9
+ import '../registry-D-CmT0gk.js';
10
10
 
11
11
  /**
12
12
  * Convenience helper for attaching middleware to an agent configuration.
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkUIXNKPLQ_cjs = require('../chunk-UIXNKPLQ.cjs');
4
- require('../chunk-ILBKDEEL.cjs');
5
- require('../chunk-FOTCUNP5.cjs');
3
+ var chunk5KC6X2T5_cjs = require('../chunk-5KC6X2T5.cjs');
4
+ require('../chunk-I55OVD23.cjs');
5
+ require('../chunk-N64ZFATA.cjs');
6
6
  require('../chunk-MQ2XTH3S.cjs');
7
7
  require('../chunk-IJASUMIQ.cjs');
8
8
 
@@ -10,15 +10,15 @@ require('../chunk-IJASUMIQ.cjs');
10
10
 
11
11
  Object.defineProperty(exports, "ThreadPersistence", {
12
12
  enumerable: true,
13
- get: function () { return chunkUIXNKPLQ_cjs.ThreadPersistence; }
13
+ get: function () { return chunk5KC6X2T5_cjs.ThreadPersistence; }
14
14
  });
15
15
  Object.defineProperty(exports, "createBrowserStore", {
16
16
  enumerable: true,
17
- get: function () { return chunkUIXNKPLQ_cjs.createBrowserStore; }
17
+ get: function () { return chunk5KC6X2T5_cjs.createBrowserStore; }
18
18
  });
19
19
  Object.defineProperty(exports, "createMemoryStore", {
20
20
  enumerable: true,
21
- get: function () { return chunkUIXNKPLQ_cjs.createMemoryStore; }
21
+ get: function () { return chunk5KC6X2T5_cjs.createMemoryStore; }
22
22
  });
23
23
  //# sourceMappingURL=index.cjs.map
24
24
  //# sourceMappingURL=index.cjs.map
@@ -1,6 +1,6 @@
1
- import { T as Thread } from '../thread-D3zaGK1Y.cjs';
2
- import '../types-Cn1g9Tg4.cjs';
3
- import '../provider-IJnfNhCX.cjs';
1
+ import { T as Thread } from '../thread-BzwE1OnJ.cjs';
2
+ import '../types-AlvjoTyS.cjs';
3
+ import '../provider-B807EuDV.cjs';
4
4
 
5
5
  /**
6
6
  * Pluggable storage abstraction for persisting conversation/thread state in a
@@ -1,6 +1,6 @@
1
- import { T as Thread } from '../thread-COV135Ja.js';
2
- import '../types-Cn1g9Tg4.js';
3
- import '../provider-C_rgZvmX.js';
1
+ import { T as Thread } from '../thread-COljUAtD.js';
2
+ import '../types-AlvjoTyS.js';
3
+ import '../provider-CvU3I-Xo.js';
4
4
 
5
5
  /**
6
6
  * Pluggable storage abstraction for persisting conversation/thread state in a
@@ -1,6 +1,6 @@
1
- export { ThreadPersistence, createBrowserStore, createMemoryStore } from '../chunk-IGIFX6QO.js';
2
- import '../chunk-E4VTVUYU.js';
3
- import '../chunk-ACBIHS5H.js';
1
+ export { ThreadPersistence, createBrowserStore, createMemoryStore } from '../chunk-3KU76DCP.js';
2
+ import '../chunk-LC54DGGR.js';
3
+ import '../chunk-QXAJ4DUJ.js';
4
4
  import '../chunk-IXV4UIF5.js';
5
5
  import '../chunk-DEABART4.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { a as ModelCapabilities, M as Message } from './types-Cn1g9Tg4.cjs';
1
+ import { b as ModelCapabilities, M as Message } from './types-AlvjoTyS.cjs';
2
2
 
3
3
  /**
4
4
  * LLM provider abstraction. Agents and workflows depend only on this interface,
@@ -83,6 +83,11 @@ interface GenerateResponse {
83
83
  text: string;
84
84
  /** Reasoning/thinking content — only present for reasoning-capable models. (FR-003a) */
85
85
  reasoning?: string;
86
+ /**
87
+ * Opaque reasoning blob (e.g. Claude thinking signature) to round-trip on the
88
+ * next assistant turn for thinking continuity. Never logged or inspected.
89
+ */
90
+ reasoningOpaque?: string;
86
91
  /** Tool calls the model wants to make, if any. */
87
92
  toolCalls?: ToolCall[];
88
93
  /** Approximate token usage if reported by the provider. */
@@ -1,4 +1,4 @@
1
- import { a as ModelCapabilities, M as Message } from './types-Cn1g9Tg4.js';
1
+ import { b as ModelCapabilities, M as Message } from './types-AlvjoTyS.js';
2
2
 
3
3
  /**
4
4
  * LLM provider abstraction. Agents and workflows depend only on this interface,
@@ -83,6 +83,11 @@ interface GenerateResponse {
83
83
  text: string;
84
84
  /** Reasoning/thinking content — only present for reasoning-capable models. (FR-003a) */
85
85
  reasoning?: string;
86
+ /**
87
+ * Opaque reasoning blob (e.g. Claude thinking signature) to round-trip on the
88
+ * next assistant turn for thinking continuity. Never logged or inspected.
89
+ */
90
+ reasoningOpaque?: string;
86
91
  /** Tool calls the model wants to make, if any. */
87
92
  toolCalls?: ToolCall[];
88
93
  /** Approximate token usage if reported by the provider. */
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkU64OEHG6_cjs = require('../chunk-U64OEHG6.cjs');
3
+ var chunkJLPLGU7O_cjs = require('../chunk-JLPLGU7O.cjs');
4
+ require('../chunk-N64ZFATA.cjs');
4
5
  require('../chunk-MQ2XTH3S.cjs');
5
6
  require('../chunk-IJASUMIQ.cjs');
6
7
 
@@ -8,23 +9,23 @@ require('../chunk-IJASUMIQ.cjs');
8
9
 
9
10
  Object.defineProperty(exports, "createCopilotProvider", {
10
11
  enumerable: true,
11
- get: function () { return chunkU64OEHG6_cjs.createCopilotProvider; }
12
+ get: function () { return chunkJLPLGU7O_cjs.createCopilotProvider; }
12
13
  });
13
14
  Object.defineProperty(exports, "createOpenAICompatibleProvider", {
14
15
  enumerable: true,
15
- get: function () { return chunkU64OEHG6_cjs.createOpenAICompatibleProvider; }
16
+ get: function () { return chunkJLPLGU7O_cjs.createOpenAICompatibleProvider; }
16
17
  });
17
18
  Object.defineProperty(exports, "providerErrorFromStatus", {
18
19
  enumerable: true,
19
- get: function () { return chunkU64OEHG6_cjs.providerErrorFromStatus; }
20
+ get: function () { return chunkJLPLGU7O_cjs.providerErrorFromStatus; }
20
21
  });
21
22
  Object.defineProperty(exports, "resolveModels", {
22
23
  enumerable: true,
23
- get: function () { return chunkU64OEHG6_cjs.resolveModels; }
24
+ get: function () { return chunkJLPLGU7O_cjs.resolveModels; }
24
25
  });
25
26
  Object.defineProperty(exports, "withRetry", {
26
27
  enumerable: true,
27
- get: function () { return chunkU64OEHG6_cjs.withRetry; }
28
+ get: function () { return chunkJLPLGU7O_cjs.withRetry; }
28
29
  });
29
30
  //# sourceMappingURL=index.cjs.map
30
31
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
- import { C as CredentialSource, M as ModelSelectionOptions, P as Provider } from '../provider-IJnfNhCX.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-IJnfNhCX.cjs';
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 '../types-Cn1g9Tg4.cjs';
4
+ import '../types-AlvjoTyS.cjs';
5
5
 
6
6
  /**
7
7
  * Exponential-backoff retry for transient provider failures. Transient errors
@@ -35,7 +35,20 @@ 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`. (FR-006)
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
  */
@@ -49,6 +62,12 @@ declare function providerErrorFromStatus(status: number, message: string): Provi
49
62
  interface OpenAICompatibleProviderOptions extends CredentialSource, ModelSelectionOptions {
50
63
  /** Base URL of the OpenAI-compatible API, e.g. `http://localhost:1234/v1`. */
51
64
  baseUrl: string;
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>;
52
71
  /** Retry tuning for transient failures. */
53
72
  retry?: RetryOptions;
54
73
  /** Optional custom fetch (for testing or non-standard runtimes). */
@@ -80,6 +99,11 @@ declare function createOpenAICompatibleProvider(options: OpenAICompatibleProvide
80
99
  * client-side); in a backend deployment the developer may supply it, or the user
81
100
  * sends it per request over SSL/TLS and the backend must not log or persist it.
82
101
  *
102
+ * Note: the Copilot API (`api.githubcopilot.com`) sends no CORS headers, so it
103
+ * cannot be called directly from a browser. A browser deployment must route through
104
+ * a backend/proxy (set `baseUrl` to it); constructing this provider in a browser
105
+ * against the default host throws {@link RuntimeUnsupportedError}.
106
+ *
83
107
  * @packageDocumentation
84
108
  */
85
109
 
@@ -92,6 +116,12 @@ declare function createOpenAICompatibleProvider(options: OpenAICompatibleProvide
92
116
  interface CopilotProviderOptions extends CredentialSource, ModelSelectionOptions {
93
117
  /** Override the Copilot base URL if needed. */
94
118
  baseUrl?: string;
119
+ /**
120
+ * Extra/override request headers. Merged over the required Copilot defaults
121
+ * (`Editor-Version`, `Editor-Plugin-Version`, `Copilot-Integration-Id`,
122
+ * `Openai-Intent`), so you can adjust them without losing the others.
123
+ */
124
+ headers?: Record<string, string>;
95
125
  /** Retry tuning for transient failures. */
96
126
  retry?: RetryOptions;
97
127
  /** Optional custom fetch (for testing or non-standard runtimes). */
@@ -120,6 +150,11 @@ interface CopilotProviderOptions extends CredentialSource, ModelSelectionOptions
120
150
  * });
121
151
  * // Pick a model per request: provider.generate({ messages, model: "o3-mini" })
122
152
  * ```
153
+ *
154
+ * @throws {RuntimeUnsupportedError} when constructed in a browser against the
155
+ * default Copilot host. `api.githubcopilot.com` does not send CORS headers, so a
156
+ * browser cannot call it directly — host a small backend/proxy and point `baseUrl`
157
+ * at it (which lifts this guard), or run the provider server-side (Node/edge).
123
158
  */
124
159
  declare function createCopilotProvider(options: CopilotProviderOptions): Provider;
125
160