framework-agents 0.1.3 → 0.1.6
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-AXBAXCB5.js +7 -0
- package/dist/{agent-KV6TG47A.js → agent-Y4D6JSG5.js} +1 -1
- package/dist/{chunk-VIGLIWEY.js → chunk-AJI2QSJE.js} +94 -18
- package/dist/chunk-AJI2QSJE.js.map +1 -0
- package/dist/{chunk-G3CMR4MD.js → chunk-JUOOPH4Z.js} +102 -16
- package/dist/cli.js +103 -87
- package/dist/index.d.ts +31 -21
- package/dist/index.js +108 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/agent-ZEGATFZY.js +0 -7
- package/dist/chunk-VIGLIWEY.js.map +0 -1
- /package/dist/{agent-ZEGATFZY.js.map → agent-AXBAXCB5.js.map} +0 -0
|
@@ -100,6 +100,16 @@ var ToolRejection = class extends Error {
|
|
|
100
100
|
this.feedback = feedback;
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
+
var RETRYABLE = /* @__PURE__ */ Symbol.for("framework.retryable");
|
|
104
|
+
function stampRetryable(err, retryable) {
|
|
105
|
+
err[RETRYABLE] = retryable;
|
|
106
|
+
return err;
|
|
107
|
+
}
|
|
108
|
+
function getRetryable(err) {
|
|
109
|
+
if (err instanceof AgentError) return err.retryable;
|
|
110
|
+
if (err instanceof Error) return err[RETRYABLE];
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
103
113
|
var HitlInterrupt = class extends Error {
|
|
104
114
|
interruptId;
|
|
105
115
|
tool;
|
|
@@ -461,6 +471,27 @@ async function runWithBudget(fn, budget = {}) {
|
|
|
461
471
|
}
|
|
462
472
|
|
|
463
473
|
// src/agent/index.ts
|
|
474
|
+
var EventQueue = class {
|
|
475
|
+
items = [];
|
|
476
|
+
wakes = [];
|
|
477
|
+
closed = false;
|
|
478
|
+
push(item) {
|
|
479
|
+
this.items.push(item);
|
|
480
|
+
this.wakes.shift()?.();
|
|
481
|
+
}
|
|
482
|
+
close() {
|
|
483
|
+
this.closed = true;
|
|
484
|
+
for (const w of this.wakes.splice(0)) w();
|
|
485
|
+
}
|
|
486
|
+
async next() {
|
|
487
|
+
for (; ; ) {
|
|
488
|
+
const item = this.items.shift();
|
|
489
|
+
if (item !== void 0) return { done: false, value: item };
|
|
490
|
+
if (this.closed) return { done: true };
|
|
491
|
+
await new Promise((resolve2) => this.wakes.push(resolve2));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
};
|
|
464
495
|
var DEFAULT_SYSTEM = "You are a helpful agent. Use tools when needed. Be concise.";
|
|
465
496
|
var DEFAULT_MAX_STEPS = 6;
|
|
466
497
|
var toolJsonSchemas = /* @__PURE__ */ new WeakMap();
|
|
@@ -798,27 +829,82 @@ var Agent = class _Agent {
|
|
|
798
829
|
...strategy === "provider" && format ? { responseFormat: { name: responseFormatName(format), schema: responseFormatJsonSchema(format) } } : {}
|
|
799
830
|
};
|
|
800
831
|
for (const mw of middleware) req = await mw.beforeModel?.(req, ctxFor(step)) ?? req;
|
|
801
|
-
const
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
832
|
+
const needsBatching = middleware.some((mw) => mw.wrapModel || mw.afterModel);
|
|
833
|
+
const buffered = [];
|
|
834
|
+
const channel = new EventQueue();
|
|
835
|
+
const emitDelta = (type, d) => {
|
|
836
|
+
const event = { type, delta: d };
|
|
837
|
+
if (needsBatching) buffered.push(event);
|
|
838
|
+
else channel.push(event);
|
|
839
|
+
};
|
|
840
|
+
const callModel = (r) => {
|
|
841
|
+
const start = buffered.length;
|
|
842
|
+
let failed = false;
|
|
843
|
+
try {
|
|
844
|
+
return model.complete({
|
|
845
|
+
...r,
|
|
846
|
+
// Propagate the run's abort into the in-flight provider request.
|
|
847
|
+
...signal ? { signal } : {},
|
|
848
|
+
onToken: (d) => {
|
|
849
|
+
events?.onToken?.(d);
|
|
850
|
+
if (failed) return;
|
|
851
|
+
emitDelta("token", d);
|
|
852
|
+
},
|
|
853
|
+
onThinking: (d) => {
|
|
854
|
+
events?.onThinking?.(d);
|
|
855
|
+
if (failed) return;
|
|
856
|
+
emitDelta("thinking", d);
|
|
857
|
+
}
|
|
858
|
+
}).catch((err) => {
|
|
859
|
+
failed = true;
|
|
860
|
+
buffered.splice(start);
|
|
861
|
+
throw err;
|
|
862
|
+
});
|
|
863
|
+
} catch (err) {
|
|
864
|
+
failed = true;
|
|
865
|
+
buffered.splice(start);
|
|
866
|
+
throw err;
|
|
813
867
|
}
|
|
814
|
-
}
|
|
868
|
+
};
|
|
815
869
|
const modelChain = middleware.filter((mw) => mw.wrapModel).reduceRight(
|
|
816
870
|
(next, mw) => (r) => mw.wrapModel(r, next, ctxFor(step)),
|
|
817
871
|
callModel
|
|
818
872
|
);
|
|
819
|
-
let
|
|
820
|
-
|
|
821
|
-
|
|
873
|
+
let deltasEmittedThisCall = false;
|
|
874
|
+
let completion;
|
|
875
|
+
const pendingCompletion = modelChain(req).then(
|
|
876
|
+
(c) => {
|
|
877
|
+
channel.close();
|
|
878
|
+
return c;
|
|
879
|
+
},
|
|
880
|
+
(e) => {
|
|
881
|
+
channel.close();
|
|
882
|
+
throw e;
|
|
883
|
+
}
|
|
884
|
+
);
|
|
885
|
+
pendingCompletion.catch(() => {
|
|
886
|
+
});
|
|
887
|
+
try {
|
|
888
|
+
if (needsBatching) {
|
|
889
|
+
completion = await pendingCompletion;
|
|
890
|
+
for (const e of buffered.splice(0)) {
|
|
891
|
+
if (e.delta !== "") yield e;
|
|
892
|
+
}
|
|
893
|
+
} else {
|
|
894
|
+
for (; ; ) {
|
|
895
|
+
const next = await channel.next();
|
|
896
|
+
if (next.done) break;
|
|
897
|
+
deltasEmittedThisCall = true;
|
|
898
|
+
if (next.value.delta !== "") yield next.value;
|
|
899
|
+
}
|
|
900
|
+
completion = await pendingCompletion;
|
|
901
|
+
}
|
|
902
|
+
} catch (err) {
|
|
903
|
+
buffered.splice(0);
|
|
904
|
+
if (deltasEmittedThisCall && getRetryable(err) === void 0) {
|
|
905
|
+
stampRetryable(err, false);
|
|
906
|
+
}
|
|
907
|
+
throw err;
|
|
822
908
|
}
|
|
823
909
|
for (const mw of [...middleware].reverse()) completion = await mw.afterModel?.(completion, req, ctxFor(step)) ?? completion;
|
|
824
910
|
usage.inputTokens += completion.usage.inputTokens;
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
imagesOf,
|
|
10
10
|
todoListMiddleware,
|
|
11
11
|
wireTextOf
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JUOOPH4Z.js";
|
|
13
13
|
|
|
14
14
|
// src/serve/cli.ts
|
|
15
15
|
import { resolve as resolve3 } from "path";
|
|
@@ -184,8 +184,8 @@ var OpenAICompatibleProvider = class {
|
|
|
184
184
|
}
|
|
185
185
|
} : {},
|
|
186
186
|
messages: options.messages.map(toWireMessage),
|
|
187
|
-
...options.tools
|
|
188
|
-
tools: options.tools.map((t) => ({
|
|
187
|
+
...options.tools?.length ? {
|
|
188
|
+
tools: (options.tools ?? []).map((t) => ({
|
|
189
189
|
type: "function",
|
|
190
190
|
function: {
|
|
191
191
|
name: t.name,
|
|
@@ -252,91 +252,107 @@ var OpenAICompatibleProvider = class {
|
|
|
252
252
|
/** SSE: `data: {...}` lines; delta.content -> onToken, delta.reasoning_content -> onThinking. */
|
|
253
253
|
async readStream(res, options) {
|
|
254
254
|
if (!res.body) throw new Error("Streaming response has no body");
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
let
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (
|
|
305
|
-
|
|
255
|
+
return this._readSse(res.body, options).catch((err) => {
|
|
256
|
+
if (err instanceof AgentError || err instanceof Error && err.name === "AbortError") throw err;
|
|
257
|
+
throw new AgentError("MODEL_ERROR", `Stream broke mid-response: ${err}`, false);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
async _readSse(body, options) {
|
|
261
|
+
let delivered = false;
|
|
262
|
+
try {
|
|
263
|
+
const reader = body.getReader();
|
|
264
|
+
const decoder = new TextDecoder();
|
|
265
|
+
let text = "";
|
|
266
|
+
let thinking = "";
|
|
267
|
+
let inputTokens = 0;
|
|
268
|
+
let outputTokens = 0;
|
|
269
|
+
let reasoningTokens;
|
|
270
|
+
let finishReason;
|
|
271
|
+
const toolArgBuffers = /* @__PURE__ */ new Map();
|
|
272
|
+
let buffer = "";
|
|
273
|
+
const flush = (chunk) => {
|
|
274
|
+
buffer += chunk;
|
|
275
|
+
const lines = buffer.split("\n");
|
|
276
|
+
buffer = lines.pop() ?? "";
|
|
277
|
+
for (const line of lines) {
|
|
278
|
+
const t = line.trim();
|
|
279
|
+
if (!t.startsWith("data:")) continue;
|
|
280
|
+
const payload = t.slice(5).trim();
|
|
281
|
+
if (payload === "[DONE]") continue;
|
|
282
|
+
let evt;
|
|
283
|
+
try {
|
|
284
|
+
evt = JSON.parse(payload);
|
|
285
|
+
} catch {
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (evt.choices?.[0]?.finish_reason) finishReason = evt.choices[0].finish_reason ?? void 0;
|
|
289
|
+
if (evt.usage) {
|
|
290
|
+
if (evt.usage.prompt_tokens != null) inputTokens = evt.usage.prompt_tokens;
|
|
291
|
+
if (evt.usage.completion_tokens != null) outputTokens = evt.usage.completion_tokens;
|
|
292
|
+
const rt = reasoningOf(evt.usage);
|
|
293
|
+
if (rt != null) reasoningTokens = rt;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
const delta = evt.choices?.[0]?.delta;
|
|
297
|
+
if (!delta) continue;
|
|
298
|
+
const think = thinkingOf(delta);
|
|
299
|
+
if (think) {
|
|
300
|
+
thinking += think;
|
|
301
|
+
delivered = true;
|
|
302
|
+
options.onThinking?.(think);
|
|
303
|
+
}
|
|
304
|
+
if (delta.content) {
|
|
305
|
+
text += delta.content;
|
|
306
|
+
delivered = true;
|
|
307
|
+
options.onToken?.(delta.content);
|
|
308
|
+
}
|
|
309
|
+
for (const [i, tc] of (delta.tool_calls ?? []).entries()) {
|
|
310
|
+
const key = tc.index ?? i;
|
|
311
|
+
delivered = true;
|
|
312
|
+
const slot = toolArgBuffers.get(key) ?? { id: "", name: "", args: "" };
|
|
313
|
+
if (tc.id) slot.id = tc.id;
|
|
314
|
+
if (tc.function?.name) slot.name = tc.function.name;
|
|
315
|
+
if (tc.function?.arguments) slot.args += tc.function.arguments;
|
|
316
|
+
toolArgBuffers.set(key, slot);
|
|
317
|
+
}
|
|
306
318
|
}
|
|
319
|
+
};
|
|
320
|
+
for (; ; ) {
|
|
321
|
+
const { done, value } = await reader.read();
|
|
322
|
+
if (done) break;
|
|
323
|
+
flush(decoder.decode(value, { stream: true }));
|
|
307
324
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (!text && !toolArgBuffers.size && thinking && finishReason === "stop") {
|
|
316
|
-
throw new AgentError(
|
|
317
|
-
"MODEL_ERROR",
|
|
318
|
-
"Stream ended at finish_reason=stop having put the entire answer in the reasoning channel (no content, no tool calls, thinking present). The reasoning/content split lost the reply \u2014 retry or raise maxTokens.",
|
|
319
|
-
true
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
if (!text && !toolArgBuffers.size && finishReason === "length") {
|
|
323
|
-
throw new AgentError(
|
|
324
|
-
"MODEL_ERROR",
|
|
325
|
-
`Stream ended at finish_reason=length with no content (${outputTokens} tokens burned). Raise maxTokens.`,
|
|
326
|
-
false
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
return {
|
|
330
|
-
text,
|
|
331
|
-
...thinking ? { thinking } : {},
|
|
332
|
-
...finishReason ? { finishReason } : {},
|
|
333
|
-
toolCalls: [...toolArgBuffers.values()].filter((t) => t.name).map((t) => ({ id: t.id || `call_${++callSeq}`, name: t.name, args: safeJson(t.args) })),
|
|
334
|
-
usage: {
|
|
335
|
-
inputTokens,
|
|
336
|
-
outputTokens,
|
|
337
|
-
...reasoningTokens != null ? { reasoningTokens } : {}
|
|
325
|
+
flush(decoder.decode());
|
|
326
|
+
if (!text && !toolArgBuffers.size && thinking && finishReason === "stop") {
|
|
327
|
+
throw new AgentError(
|
|
328
|
+
"MODEL_ERROR",
|
|
329
|
+
"Stream ended at finish_reason=stop having put the entire answer in the reasoning channel (no content, no tool calls, thinking present). The reasoning/content split lost the reply \u2014 retry or raise maxTokens.",
|
|
330
|
+
true
|
|
331
|
+
);
|
|
338
332
|
}
|
|
339
|
-
|
|
333
|
+
if (!text && !toolArgBuffers.size && finishReason === "length") {
|
|
334
|
+
throw new AgentError(
|
|
335
|
+
"MODEL_ERROR",
|
|
336
|
+
`Stream ended at finish_reason=length with no content (${outputTokens} tokens burned). Raise maxTokens.`,
|
|
337
|
+
false
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
text,
|
|
342
|
+
...thinking ? { thinking } : {},
|
|
343
|
+
...finishReason ? { finishReason } : {},
|
|
344
|
+
toolCalls: [...toolArgBuffers.values()].map((t) => ({ id: t.id || `call_${++callSeq}`, name: t.name, args: safeJson(t.args) })),
|
|
345
|
+
usage: {
|
|
346
|
+
inputTokens,
|
|
347
|
+
outputTokens,
|
|
348
|
+
...reasoningTokens != null ? { reasoningTokens } : {}
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
} catch (err) {
|
|
352
|
+
if (err instanceof Error && err.name === "AbortError") throw err;
|
|
353
|
+
if (err instanceof AgentError) throw err;
|
|
354
|
+
throw new AgentError("MODEL_ERROR", `Stream broke mid-response${delivered ? " (deltas already delivered)" : ""}: ${err}`, !delivered);
|
|
355
|
+
}
|
|
340
356
|
}
|
|
341
357
|
};
|
|
342
358
|
var callSeq = 0;
|
|
@@ -431,8 +447,8 @@ var AnthropicProvider = class {
|
|
|
431
447
|
...thinkingBudget ? { thinking: { type: "enabled", budget_tokens: thinkingBudget } } : {},
|
|
432
448
|
...stream ? { stream: true } : {},
|
|
433
449
|
messages,
|
|
434
|
-
...options.tools
|
|
435
|
-
tools: options.tools.map((t) => ({
|
|
450
|
+
...options.tools?.length ? {
|
|
451
|
+
tools: (options.tools ?? []).map((t) => ({
|
|
436
452
|
name: t.name,
|
|
437
453
|
description: t.description,
|
|
438
454
|
input_schema: t.parametersSchema ?? { type: "object" }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import * as zod from 'zod';
|
|
3
|
+
export { zod as z };
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Content blocks — standard, provider-neutral message payload
|
|
@@ -623,6 +625,7 @@ declare class OpenAICompatibleProvider implements ModelProvider {
|
|
|
623
625
|
private readJson;
|
|
624
626
|
/** SSE: `data: {...}` lines; delta.content -> onToken, delta.reasoning_content -> onThinking. */
|
|
625
627
|
private readStream;
|
|
628
|
+
private _readSse;
|
|
626
629
|
}
|
|
627
630
|
/** Build a provider from env config (TogetherAI preferred when key present). */
|
|
628
631
|
declare function providerFromEnv(active: {
|
|
@@ -766,7 +769,7 @@ interface ResponseFormatWire {
|
|
|
766
769
|
interface CompleteOptions {
|
|
767
770
|
messages: ChatMessage[];
|
|
768
771
|
/** Tool metadata; `parametersSchema` (JSON Schema) lets models call with real args — omit only for zero-arg tools. */
|
|
769
|
-
tools
|
|
772
|
+
tools?: {
|
|
770
773
|
name: string;
|
|
771
774
|
description: string;
|
|
772
775
|
parametersSchema?: Record<string, unknown>;
|
|
@@ -807,10 +810,18 @@ interface ToolResult {
|
|
|
807
810
|
/** Downstream-only data — stored on the call record, never sent to the model. */
|
|
808
811
|
artifact?: unknown;
|
|
809
812
|
}
|
|
813
|
+
/**
|
|
814
|
+
* Minimal structural contract for a schema — satisfied by zod v3, v4, minis,
|
|
815
|
+
* and anything with `.parse` (so consumers on ANY zod version work).
|
|
816
|
+
*/
|
|
817
|
+
type AnySchema = {
|
|
818
|
+
parse(input: unknown): unknown;
|
|
819
|
+
};
|
|
810
820
|
interface Tool<TArgs = any, TOutput = any> {
|
|
811
821
|
name: string;
|
|
812
822
|
description: string;
|
|
813
|
-
schema
|
|
823
|
+
/** Any zod-like schema (v3/v4); the registry calls `.parse` for validation. */
|
|
824
|
+
schema: AnySchema;
|
|
814
825
|
/** Optional second arg receives ToolContext (state + invocationState). */
|
|
815
826
|
execute: (args: TArgs, ctx?: ToolContext) => Promise<TOutput>;
|
|
816
827
|
/**
|
|
@@ -821,23 +832,22 @@ interface Tool<TArgs = any, TOutput = any> {
|
|
|
821
832
|
toResult?: (output: TOutput) => ToolResult;
|
|
822
833
|
}
|
|
823
834
|
/**
|
|
824
|
-
* The defineTool() input:
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
* annotations needed):
|
|
835
|
+
* The defineTool() input: TArgs drives the arg type from `execute` itself
|
|
836
|
+
* (annotate the destructure once — that IS the parsed shape), and `schema`
|
|
837
|
+
* accepts any zod version (v3/v4) or anything with `.parse`:
|
|
828
838
|
*
|
|
829
839
|
* defineTool({ schema: z.object({ city: z.string() }),
|
|
830
|
-
* execute: async ({ city }) => ... })
|
|
840
|
+
* execute: async ({ city }: { city: string }) => ... })
|
|
831
841
|
*/
|
|
832
|
-
interface ToolSpec<
|
|
842
|
+
interface ToolSpec<TArgs = any, TOutput = unknown> {
|
|
833
843
|
name: string;
|
|
834
844
|
description: string;
|
|
835
|
-
schema:
|
|
836
|
-
execute: (args:
|
|
845
|
+
schema: AnySchema;
|
|
846
|
+
execute: (args: TArgs, ctx?: ToolContext) => Promise<TOutput>;
|
|
837
847
|
toResult?: (output: TOutput) => ToolResult;
|
|
838
848
|
}
|
|
839
849
|
declare function defaultToResult(output: unknown): ToolResult;
|
|
840
|
-
declare function defineTool<
|
|
850
|
+
declare function defineTool<TArgs = any, TOutput = unknown>(tool: ToolSpec<TArgs, TOutput>): Tool<TArgs, TOutput>;
|
|
841
851
|
/** Validating registry — single place tools are looked up + arg-checked. */
|
|
842
852
|
declare class ToolRegistry {
|
|
843
853
|
private tools;
|
|
@@ -1916,8 +1926,8 @@ declare function retrievalTool(retriever: Retriever, opts?: {
|
|
|
1916
1926
|
k?: number;
|
|
1917
1927
|
name?: string;
|
|
1918
1928
|
}): Tool<{
|
|
1919
|
-
k: number;
|
|
1920
1929
|
query: string;
|
|
1930
|
+
k?: number;
|
|
1921
1931
|
}, ScoredDoc[]>;
|
|
1922
1932
|
/** SPARQL-backed retriever: keyword match over the closure, rendered as text. */
|
|
1923
1933
|
declare function sparqlRetriever(store: {
|
|
@@ -2372,8 +2382,8 @@ declare class EntityLinker {
|
|
|
2372
2382
|
}
|
|
2373
2383
|
/** link_entity agent tool: mention -> canonical IRIs with scores. */
|
|
2374
2384
|
declare function linkEntityTool(linker: EntityLinker): Tool<{
|
|
2375
|
-
k: number;
|
|
2376
2385
|
mention: string;
|
|
2386
|
+
k?: number;
|
|
2377
2387
|
}, LinkedEntity[]>;
|
|
2378
2388
|
interface MappingProposal {
|
|
2379
2389
|
id: string;
|
|
@@ -2420,8 +2430,8 @@ declare class MappingProposals {
|
|
|
2420
2430
|
decide(store: GraphStore, id: string, decision: MappingDecision): Promise<MappingProposal | undefined>;
|
|
2421
2431
|
}
|
|
2422
2432
|
declare function proposeMappingTool(proposals: MappingProposals): Tool<{
|
|
2423
|
-
to: string;
|
|
2424
2433
|
from: string;
|
|
2434
|
+
to: string;
|
|
2425
2435
|
source: string;
|
|
2426
2436
|
}, string | {
|
|
2427
2437
|
id: string;
|
|
@@ -2603,9 +2613,9 @@ declare function adoptShapes(store: InMemoryGraphStore, shapes: NodeShape[]): Pr
|
|
|
2603
2613
|
}[];
|
|
2604
2614
|
}>;
|
|
2605
2615
|
/** review_ontology agent tool: inventory + gaps, straight from the store. */
|
|
2606
|
-
declare function reviewOntologyTool(store: InMemoryGraphStore): Tool<
|
|
2616
|
+
declare function reviewOntologyTool(store: InMemoryGraphStore): Tool<any, OntologyReview>;
|
|
2607
2617
|
/** propose_shapes agent tool: SHACL candidates induced from instance data. */
|
|
2608
|
-
declare function proposeShapesTool(store: InMemoryGraphStore, opts?: ShapeInductionOptions): Tool<
|
|
2618
|
+
declare function proposeShapesTool(store: InMemoryGraphStore, opts?: ShapeInductionOptions): Tool<any, NodeShape[]>;
|
|
2609
2619
|
|
|
2610
2620
|
/**
|
|
2611
2621
|
* Semantic layer. See docs/07-semantics-governance.md.
|
|
@@ -2741,7 +2751,7 @@ declare function sparqlSelectTool(store: GraphStore): Tool<{
|
|
|
2741
2751
|
/** Ontology lookup: find classes/properties/labels matching a term. */
|
|
2742
2752
|
declare function ontologyLookupTool(store: GraphStore): Tool<{
|
|
2743
2753
|
term: string;
|
|
2744
|
-
limit
|
|
2754
|
+
limit?: number;
|
|
2745
2755
|
}, {
|
|
2746
2756
|
subject: string;
|
|
2747
2757
|
predicate: string;
|
|
@@ -2770,10 +2780,10 @@ declare const TurtleQuadSchema: z.ZodObject<{
|
|
|
2770
2780
|
*/
|
|
2771
2781
|
declare function graphAddTool(store: GraphStore): Tool<{
|
|
2772
2782
|
quads: {
|
|
2773
|
-
object: string;
|
|
2774
|
-
source: string;
|
|
2775
2783
|
subject: string;
|
|
2776
2784
|
predicate: string;
|
|
2785
|
+
object: string;
|
|
2786
|
+
source: string;
|
|
2777
2787
|
}[];
|
|
2778
2788
|
}, string | {
|
|
2779
2789
|
committed: number;
|
|
@@ -2786,9 +2796,9 @@ type ClaimVerdict = "grounded" | "unknown" | "contradicted";
|
|
|
2786
2796
|
* (contradicted)? Ask before answering from memory.
|
|
2787
2797
|
*/
|
|
2788
2798
|
declare function claimCheckTool(store: GraphStore): Tool<{
|
|
2789
|
-
object: string;
|
|
2790
2799
|
subject: string;
|
|
2791
2800
|
predicate: string;
|
|
2801
|
+
object: string;
|
|
2792
2802
|
}, {
|
|
2793
2803
|
verdict: ClaimVerdict;
|
|
2794
2804
|
proof: {
|
|
@@ -2855,4 +2865,4 @@ declare function estimateCostUsd(usage: {
|
|
|
2855
2865
|
outputPerMillion: number;
|
|
2856
2866
|
}): number;
|
|
2857
2867
|
|
|
2858
|
-
export { A2AClient, type A2AClientOptions, A2AServer, type A2AServerOptions, Agent, type AgentCard, AgentClient, type AgentClientOptions, AgentError, type AgentEvents, type AgentId, type AgentMiddleware, type AgentOptions, type AgentResult, AgentState, type AnthropicOptions, AnthropicProvider, type AnyMcpClient, AudioBlockSchema, type BackoffOptions, type Brand, type Budget, type ChatMessage, ChatMessageSchema, type Checkpointer, type ClaimVerdict, ClearToolUsesEdit, type ClearToolUsesOptions, CompactedMemory, type CompactionOptions, type CompleteOptions, type ConformanceCheck, type ConformanceReport, type ConformanceResult, type ConsoleEventsOptions, ConsoleSpanSink, type ContentBlock, ContentBlockSchema, type ConversationManager, type DoneEvent, EntityLinker, type EvalCase, type EvalExpect, type EvalScore, type ExecutedToolCall, FileBlockSchema, FileCheckpointer, FileMemory, type FrameworkConfig, type FrameworkFile, FrameworkFileSchema, GraphMemory, type GraphRule, type GraphStore, type HandoffSignal, type HitlDecideRequest, type HitlDecision, HitlInterrupt, type HookContext, type ImageBlock, ImageBlockSchema, InMemoryGraphStore, InMemoryMemory, InMemoryRetriever, InMemoryStorage, type InvocationState, JSONLD_PREFIXES, JsonlSpanSink, LABEL_PREDICATES, type LinkedEntity, type LoadedFrameworkFile, LocalFileStorage, type MappingDecision, type MappingProposal, MappingProposals, type MappingProposalsOptions, type McpClient, type McpClientOptions, McpHttpClient, McpStdioClient, type McpToolDef, type Memory, MemorySpanSink, type MigrationReport, type MigrationResult, MockModelProvider, type ModelCapability, type ModelCompletion, type ModelPrice, type ModelProvider, type ModelRequest, type NodeShape, NonStandardBlockSchema, NullConversationManager, OWL_VOCAB, type OllamaOptions, OllamaProvider, type OntologyReview, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OrchestratedResult, type OrchestrationPlan, type OrchestrationStrategy, type OutputVersion, type PIIDetector, type PIIMatch, type PIIStrategy, type PatternBinding, type PromptTemplate, type PropertyShape, type Quad, type ReasoningBlock, ReasoningBlockSchema, RemoteSparqlAdapter, type RemoteSparqlOptions, type ResolvedAgentDef, type ResponseFormat, type ResponseFormatWire, type ResponseStrategy, type Result, type Retriever, type RetryFilter, type RetryMiddlewareOptions, type RunId, type RunOptions, type SandboxBackend, type SandboxOptions, type ScoredDoc, type ServedAgent, SessionManager, type SessionManagerOptions, type ShapeInductionOptions, type ShapeReport, type Skill, type SkillLoaderOptions, SkillRegistry, SlidingWindowConversationManager, type SlidingWindowOptions, type Snapshot, type SnapshotData, type SnapshotField, type Span, type SpanSink, type SparqlAuth, type SparqlRow, type SparqlSelect, type StepEvent, type Storage, type StoreOptions, type StreamEvent, SummarizingConversationManager, type SummarizingOptions, Swarm, type SwarmOptions, type SwarmResult, type SwarmStatus, type SwarmStreamEvent, TBOX_PREDICATES, type TBoxMigrationSpec, type TakeSnapshotOptions, type TermStat, type TextBlock, TextBlockSchema, type ThreadCheckpoint, type TimelineEntry, type TodoItem, type TokenBudgets, type TokenUsage, type Tool, ToolCallBlockSchema, type ToolCallEvent, type ToolCallRef, type ToolCallRequest, type ToolContext, type ToolName, ToolRegistry, ToolRejection, type ToolResult, type ToolResultEvent, type ToolSpec, type TriplePattern, TurtleQuadSchema, type WorkflowNode, type WorkflowOptions, __resetConfig, a2aAsTool, abPrompts, adoptShapes, assertCanHandle, assistant, backoffDelayMs, buildServedAgent, claimCheckTool, collectStream, connectMcpHttp, connectMcpStdio, consoleEvents, contextEditingMiddleware, createMiddleware, createSandboxBackend, createSubAgentMiddleware, defaultSummarize, defaultToResult, definePrompt, defineTool, deserializeMessages, discoverSkills, estimateCostUsd, estimateTokens, executeSelect, filesystemMiddleware, filesystemTools, getRetryable, graphAddTool, handleAgentRoute, hasImages, historyTokens, hitlKey, humanInTheLoopMiddleware, imagesOf, initChatModel, instantiate, jsonSchemaToZod, jsonldToQuads, linkEntityTool, llmToolSelectorMiddleware, loadConfig, loadEnvFile, loadFrameworkConfig, loadJsonl, loadPromptFile, loadSkillsInto, logError, matchGlob, matchPatterns, matchSkills, mcpToolsToFramework, messageTokens, migrateTBox, modelCallLimit, modelFallbackMiddleware, modelRetryMiddleware, ollama, ontologyLookupTool, parseSelect, parseSkillFile, parseStructured, piiMiddleware, policyFilterMiddleware, priceFor, printReport, proposeMappingTool, proposeShapes, proposeShapesTool, providerFromEnv, providerStrategy, quadsToJsonLd, readHandoffSignal, remoteSparqlTool, responseFormatJsonSchema, responseFormatName, retrievalTool, reviewOntology, reviewOntologyTool, runConformance, runEval, runJavascriptTool, runOrchestrated, runWithBudget, runWorkflow, scoreSkills, selectSnapshotFields, serializeMessages, serveFramework, sleep, sparqlRetriever, sparqlSelectTool, stampRetryable, summarizationMiddleware, supportsColor, supportsVision, system, textOf, todoListMiddleware, tokenize, toolCallLimitMiddleware, toolEmulatorMiddleware, toolResult, toolRetry, toolRetryMiddleware, toolStrategy, tracingEvents, trimDangling, usageCost, user, wireTextOf, withFileLock };
|
|
2868
|
+
export { A2AClient, type A2AClientOptions, A2AServer, type A2AServerOptions, Agent, type AgentCard, AgentClient, type AgentClientOptions, AgentError, type AgentEvents, type AgentId, type AgentMiddleware, type AgentOptions, type AgentResult, AgentState, type AnthropicOptions, AnthropicProvider, type AnyMcpClient, type AnySchema, AudioBlockSchema, type BackoffOptions, type Brand, type Budget, type ChatMessage, ChatMessageSchema, type Checkpointer, type ClaimVerdict, ClearToolUsesEdit, type ClearToolUsesOptions, CompactedMemory, type CompactionOptions, type CompleteOptions, type ConformanceCheck, type ConformanceReport, type ConformanceResult, type ConsoleEventsOptions, ConsoleSpanSink, type ContentBlock, ContentBlockSchema, type ConversationManager, type DoneEvent, EntityLinker, type EvalCase, type EvalExpect, type EvalScore, type ExecutedToolCall, FileBlockSchema, FileCheckpointer, FileMemory, type FrameworkConfig, type FrameworkFile, FrameworkFileSchema, GraphMemory, type GraphRule, type GraphStore, type HandoffSignal, type HitlDecideRequest, type HitlDecision, HitlInterrupt, type HookContext, type ImageBlock, ImageBlockSchema, InMemoryGraphStore, InMemoryMemory, InMemoryRetriever, InMemoryStorage, type InvocationState, JSONLD_PREFIXES, JsonlSpanSink, LABEL_PREDICATES, type LinkedEntity, type LoadedFrameworkFile, LocalFileStorage, type MappingDecision, type MappingProposal, MappingProposals, type MappingProposalsOptions, type McpClient, type McpClientOptions, McpHttpClient, McpStdioClient, type McpToolDef, type Memory, MemorySpanSink, type MigrationReport, type MigrationResult, MockModelProvider, type ModelCapability, type ModelCompletion, type ModelPrice, type ModelProvider, type ModelRequest, type NodeShape, NonStandardBlockSchema, NullConversationManager, OWL_VOCAB, type OllamaOptions, OllamaProvider, type OntologyReview, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OrchestratedResult, type OrchestrationPlan, type OrchestrationStrategy, type OutputVersion, type PIIDetector, type PIIMatch, type PIIStrategy, type PatternBinding, type PromptTemplate, type PropertyShape, type Quad, type ReasoningBlock, ReasoningBlockSchema, RemoteSparqlAdapter, type RemoteSparqlOptions, type ResolvedAgentDef, type ResponseFormat, type ResponseFormatWire, type ResponseStrategy, type Result, type Retriever, type RetryFilter, type RetryMiddlewareOptions, type RunId, type RunOptions, type SandboxBackend, type SandboxOptions, type ScoredDoc, type ServedAgent, SessionManager, type SessionManagerOptions, type ShapeInductionOptions, type ShapeReport, type Skill, type SkillLoaderOptions, SkillRegistry, SlidingWindowConversationManager, type SlidingWindowOptions, type Snapshot, type SnapshotData, type SnapshotField, type Span, type SpanSink, type SparqlAuth, type SparqlRow, type SparqlSelect, type StepEvent, type Storage, type StoreOptions, type StreamEvent, SummarizingConversationManager, type SummarizingOptions, Swarm, type SwarmOptions, type SwarmResult, type SwarmStatus, type SwarmStreamEvent, TBOX_PREDICATES, type TBoxMigrationSpec, type TakeSnapshotOptions, type TermStat, type TextBlock, TextBlockSchema, type ThreadCheckpoint, type TimelineEntry, type TodoItem, type TokenBudgets, type TokenUsage, type Tool, ToolCallBlockSchema, type ToolCallEvent, type ToolCallRef, type ToolCallRequest, type ToolContext, type ToolName, ToolRegistry, ToolRejection, type ToolResult, type ToolResultEvent, type ToolSpec, type TriplePattern, TurtleQuadSchema, type WorkflowNode, type WorkflowOptions, __resetConfig, a2aAsTool, abPrompts, adoptShapes, assertCanHandle, assistant, backoffDelayMs, buildServedAgent, claimCheckTool, collectStream, connectMcpHttp, connectMcpStdio, consoleEvents, contextEditingMiddleware, createMiddleware, createSandboxBackend, createSubAgentMiddleware, defaultSummarize, defaultToResult, definePrompt, defineTool, deserializeMessages, discoverSkills, estimateCostUsd, estimateTokens, executeSelect, filesystemMiddleware, filesystemTools, getRetryable, graphAddTool, handleAgentRoute, hasImages, historyTokens, hitlKey, humanInTheLoopMiddleware, imagesOf, initChatModel, instantiate, jsonSchemaToZod, jsonldToQuads, linkEntityTool, llmToolSelectorMiddleware, loadConfig, loadEnvFile, loadFrameworkConfig, loadJsonl, loadPromptFile, loadSkillsInto, logError, matchGlob, matchPatterns, matchSkills, mcpToolsToFramework, messageTokens, migrateTBox, modelCallLimit, modelFallbackMiddleware, modelRetryMiddleware, ollama, ontologyLookupTool, parseSelect, parseSkillFile, parseStructured, piiMiddleware, policyFilterMiddleware, priceFor, printReport, proposeMappingTool, proposeShapes, proposeShapesTool, providerFromEnv, providerStrategy, quadsToJsonLd, readHandoffSignal, remoteSparqlTool, responseFormatJsonSchema, responseFormatName, retrievalTool, reviewOntology, reviewOntologyTool, runConformance, runEval, runJavascriptTool, runOrchestrated, runWithBudget, runWorkflow, scoreSkills, selectSnapshotFields, serializeMessages, serveFramework, sleep, sparqlRetriever, sparqlSelectTool, stampRetryable, summarizationMiddleware, supportsColor, supportsVision, system, textOf, todoListMiddleware, tokenize, toolCallLimitMiddleware, toolEmulatorMiddleware, toolResult, toolRetry, toolRetryMiddleware, toolStrategy, tracingEvents, trimDangling, usageCost, user, wireTextOf, withFileLock };
|