agent-framework-js 0.1.1
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/AGENT_USAGE.md +207 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/agents/index.cjs +35 -0
- package/dist/agents/index.cjs.map +1 -0
- package/dist/agents/index.d.cts +8 -0
- package/dist/agents/index.d.ts +8 -0
- package/dist/agents/index.js +10 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/chunk-5M6ER4ZX.cjs +4 -0
- package/dist/chunk-5M6ER4ZX.cjs.map +1 -0
- package/dist/chunk-5PDJOBTD.js +38 -0
- package/dist/chunk-5PDJOBTD.js.map +1 -0
- package/dist/chunk-7ZXUIHLH.js +18 -0
- package/dist/chunk-7ZXUIHLH.js.map +1 -0
- package/dist/chunk-ACBIHS5H.js +30 -0
- package/dist/chunk-ACBIHS5H.js.map +1 -0
- package/dist/chunk-DEABART4.js +54 -0
- package/dist/chunk-DEABART4.js.map +1 -0
- package/dist/chunk-FOTCUNP5.cjs +34 -0
- package/dist/chunk-FOTCUNP5.cjs.map +1 -0
- package/dist/chunk-FSDMBWQV.cjs +20 -0
- package/dist/chunk-FSDMBWQV.cjs.map +1 -0
- package/dist/chunk-GYDY3KX5.cjs +72 -0
- package/dist/chunk-GYDY3KX5.cjs.map +1 -0
- package/dist/chunk-HGEPXJDG.js +129 -0
- package/dist/chunk-HGEPXJDG.js.map +1 -0
- package/dist/chunk-IJASUMIQ.cjs +57 -0
- package/dist/chunk-IJASUMIQ.cjs.map +1 -0
- package/dist/chunk-IU3LS5FC.cjs +10 -0
- package/dist/chunk-IU3LS5FC.cjs.map +1 -0
- package/dist/chunk-IUKD54F7.js +8 -0
- package/dist/chunk-IUKD54F7.js.map +1 -0
- package/dist/chunk-IXV4UIF5.js +79 -0
- package/dist/chunk-IXV4UIF5.js.map +1 -0
- package/dist/chunk-KEI3EALJ.cjs +10 -0
- package/dist/chunk-KEI3EALJ.cjs.map +1 -0
- package/dist/chunk-LMN75W3W.cjs +87 -0
- package/dist/chunk-LMN75W3W.cjs.map +1 -0
- package/dist/chunk-MCLVWCOB.js +3 -0
- package/dist/chunk-MCLVWCOB.js.map +1 -0
- package/dist/chunk-MQ2XTH3S.cjs +87 -0
- package/dist/chunk-MQ2XTH3S.cjs.map +1 -0
- package/dist/chunk-QJ5XHA6S.cjs +95 -0
- package/dist/chunk-QJ5XHA6S.cjs.map +1 -0
- package/dist/chunk-RD5YUB2E.js +190 -0
- package/dist/chunk-RD5YUB2E.js.map +1 -0
- package/dist/chunk-RZ43WNHR.js +8 -0
- package/dist/chunk-RZ43WNHR.js.map +1 -0
- package/dist/chunk-RZP2ZUUX.cjs +252 -0
- package/dist/chunk-RZP2ZUUX.cjs.map +1 -0
- package/dist/chunk-T2GHJ5R4.js +241 -0
- package/dist/chunk-T2GHJ5R4.js.map +1 -0
- package/dist/chunk-TAMJ5HSR.cjs +137 -0
- package/dist/chunk-TAMJ5HSR.cjs.map +1 -0
- package/dist/chunk-TLACSVEZ.cjs +201 -0
- package/dist/chunk-TLACSVEZ.cjs.map +1 -0
- package/dist/chunk-UVWQWOLO.js +196 -0
- package/dist/chunk-UVWQWOLO.js.map +1 -0
- package/dist/chunk-V472N2PK.js +91 -0
- package/dist/chunk-V472N2PK.js.map +1 -0
- package/dist/chunk-V6O6SYAN.cjs +43 -0
- package/dist/chunk-V6O6SYAN.cjs.map +1 -0
- package/dist/chunk-VLSVL5N2.js +48 -0
- package/dist/chunk-VLSVL5N2.js.map +1 -0
- package/dist/chunk-WSMYH2IN.cjs +86 -0
- package/dist/chunk-WSMYH2IN.cjs.map +1 -0
- package/dist/chunk-XPXTXOYQ.js +81 -0
- package/dist/chunk-XPXTXOYQ.js.map +1 -0
- package/dist/chunk-YBFLWRO5.cjs +194 -0
- package/dist/chunk-YBFLWRO5.cjs.map +1 -0
- package/dist/chunk-YCBDEEAV.js +82 -0
- package/dist/chunk-YCBDEEAV.js.map +1 -0
- package/dist/chunk-YH5746OF.js +69 -0
- package/dist/chunk-YH5746OF.js.map +1 -0
- package/dist/chunk-YKZJRE32.cjs +50 -0
- package/dist/chunk-YKZJRE32.cjs.map +1 -0
- package/dist/declarative/index.cjs +19 -0
- package/dist/declarative/index.cjs.map +1 -0
- package/dist/declarative/index.d.cts +60 -0
- package/dist/declarative/index.d.ts +60 -0
- package/dist/declarative/index.js +10 -0
- package/dist/declarative/index.js.map +1 -0
- package/dist/errors-CjVz4W_5.d.cts +68 -0
- package/dist/errors-CjVz4W_5.d.ts +68 -0
- package/dist/index-C2vzfbBz.d.cts +57 -0
- package/dist/index-C2vzfbBz.d.ts +57 -0
- package/dist/index-D7-znzrc.d.ts +153 -0
- package/dist/index-DdYZeNIu.d.cts +153 -0
- package/dist/index.cjs +236 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +51 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.cjs +19 -0
- package/dist/mcp/index.cjs.map +1 -0
- package/dist/mcp/index.d.cts +72 -0
- package/dist/mcp/index.d.ts +72 -0
- package/dist/mcp/index.js +6 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/middleware/index.cjs +17 -0
- package/dist/middleware/index.cjs.map +1 -0
- package/dist/middleware/index.d.cts +29 -0
- package/dist/middleware/index.d.ts +29 -0
- package/dist/middleware/index.js +4 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/observability/index.cjs +29 -0
- package/dist/observability/index.cjs.map +1 -0
- package/dist/observability/index.d.cts +1 -0
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.js +4 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/persistence/index.cjs +24 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +51 -0
- package/dist/persistence/index.d.ts +51 -0
- package/dist/persistence/index.js +7 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/provider-CMAymr1b.d.cts +82 -0
- package/dist/provider-osAtfZ7x.d.ts +82 -0
- package/dist/providers/index.cjs +26 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +107 -0
- package/dist/providers/index.d.ts +107 -0
- package/dist/providers/index.js +5 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/registry-CpO0yH5v.d.ts +57 -0
- package/dist/registry-D4fThGiN.d.cts +57 -0
- package/dist/skill-DfNChtJN.d.cts +45 -0
- package/dist/skill-DfNChtJN.d.ts +45 -0
- package/dist/skills/index.cjs +20 -0
- package/dist/skills/index.cjs.map +1 -0
- package/dist/skills/index.d.cts +30 -0
- package/dist/skills/index.d.ts +30 -0
- package/dist/skills/index.js +3 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/thread-CWVzTyti.d.ts +51 -0
- package/dist/thread-Dfo9LLf7.d.cts +51 -0
- package/dist/tool-BZg_znMZ.d.cts +50 -0
- package/dist/tool-CSCC87OD.d.ts +50 -0
- package/dist/tools/index.cjs +27 -0
- package/dist/tools/index.cjs.map +1 -0
- package/dist/tools/index.d.cts +21 -0
- package/dist/tools/index.d.ts +21 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types-Cn1g9Tg4.d.cts +63 -0
- package/dist/types-Cn1g9Tg4.d.ts +63 -0
- package/dist/workflows/index.cjs +50 -0
- package/dist/workflows/index.cjs.map +1 -0
- package/dist/workflows/index.d.cts +182 -0
- package/dist/workflows/index.d.ts +182 -0
- package/dist/workflows/index.js +5 -0
- package/dist/workflows/index.js.map +1 -0
- package/package.json +145 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { S as Skill } from '../skill-DfNChtJN.js';
|
|
2
|
+
export { a as SkillSource, d as defineSkill, l as loadSource } from '../skill-DfNChtJN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Client-side keyword/text index over skill descriptions. No embeddings and no
|
|
6
|
+
* extra provider — relevance is decided by simple token overlap so it runs fully
|
|
7
|
+
* in the browser/edge. Full content is loaded only after a skill is selected.
|
|
8
|
+
* (FR-017, FR-017a)
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Indexes skills by description and selects relevant ones for a prompt. */
|
|
14
|
+
declare class SkillIndex {
|
|
15
|
+
private readonly entries;
|
|
16
|
+
constructor(skills?: Skill[]);
|
|
17
|
+
/** Add a skill to the index (description-only). */
|
|
18
|
+
add(skill: Skill): void;
|
|
19
|
+
/**
|
|
20
|
+
* Select skills relevant to `prompt` by keyword overlap with their descriptions.
|
|
21
|
+
*
|
|
22
|
+
* @param prompt - The user prompt.
|
|
23
|
+
* @param minOverlap - Minimum overlapping tokens to count as relevant. Default 1.
|
|
24
|
+
*/
|
|
25
|
+
select(prompt: string, minOverlap?: number): Skill[];
|
|
26
|
+
/** Load the full content of a selected skill (concatenated sources). (FR-017) */
|
|
27
|
+
load(skill: Skill): Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Skill, SkillIndex };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { M as Message } from './types-Cn1g9Tg4.js';
|
|
2
|
+
import { P as Provider } from './provider-osAtfZ7x.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Conversation thread with automatic compaction. When a thread approaches the
|
|
6
|
+
* model's input-token budget it is summarized into a compact form so the
|
|
7
|
+
* conversation can continue. (FR-004, FR-004a, FR-004b)
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Options controlling a thread's compaction behavior. */
|
|
13
|
+
interface ThreadOptions {
|
|
14
|
+
/** Fraction of `maxInputTokens` at which compaction triggers. Default 0.9. */
|
|
15
|
+
compactionThreshold?: number;
|
|
16
|
+
/** Provider used to summarize; defaults to the agent's own provider. (FR-004b) */
|
|
17
|
+
compactionModel?: Provider;
|
|
18
|
+
}
|
|
19
|
+
/** Rough token estimate (~4 chars/token) — avoids a tokenizer dependency. */
|
|
20
|
+
declare function estimateTokens(messages: Message[]): number;
|
|
21
|
+
/** A multi-turn conversation that preserves context and compacts when large. */
|
|
22
|
+
declare class Thread {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
messages: Message[];
|
|
25
|
+
/** Whether the thread has been compacted at least once. */
|
|
26
|
+
compacted: boolean;
|
|
27
|
+
constructor(id?: string, messages?: Message[]);
|
|
28
|
+
/** Append a message. */
|
|
29
|
+
add(message: Message): void;
|
|
30
|
+
/** Serializable snapshot for persistence. */
|
|
31
|
+
toJSON(): {
|
|
32
|
+
id: string;
|
|
33
|
+
messages: Message[];
|
|
34
|
+
compacted: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** Restore a thread from a snapshot. */
|
|
37
|
+
static fromJSON(data: {
|
|
38
|
+
id: string;
|
|
39
|
+
messages: Message[];
|
|
40
|
+
compacted?: boolean;
|
|
41
|
+
}): Thread;
|
|
42
|
+
/**
|
|
43
|
+
* Compact the thread if it exceeds the threshold. System messages and the most
|
|
44
|
+
* recent turn are preserved; older turns are summarized via the model.
|
|
45
|
+
*
|
|
46
|
+
* @returns true if compaction occurred.
|
|
47
|
+
*/
|
|
48
|
+
maybeCompact(provider: Provider, options?: ThreadOptions): Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { Thread as T, type ThreadOptions as a, estimateTokens as e };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { M as Message } from './types-Cn1g9Tg4.cjs';
|
|
2
|
+
import { P as Provider } from './provider-CMAymr1b.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Conversation thread with automatic compaction. When a thread approaches the
|
|
6
|
+
* model's input-token budget it is summarized into a compact form so the
|
|
7
|
+
* conversation can continue. (FR-004, FR-004a, FR-004b)
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Options controlling a thread's compaction behavior. */
|
|
13
|
+
interface ThreadOptions {
|
|
14
|
+
/** Fraction of `maxInputTokens` at which compaction triggers. Default 0.9. */
|
|
15
|
+
compactionThreshold?: number;
|
|
16
|
+
/** Provider used to summarize; defaults to the agent's own provider. (FR-004b) */
|
|
17
|
+
compactionModel?: Provider;
|
|
18
|
+
}
|
|
19
|
+
/** Rough token estimate (~4 chars/token) — avoids a tokenizer dependency. */
|
|
20
|
+
declare function estimateTokens(messages: Message[]): number;
|
|
21
|
+
/** A multi-turn conversation that preserves context and compacts when large. */
|
|
22
|
+
declare class Thread {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
messages: Message[];
|
|
25
|
+
/** Whether the thread has been compacted at least once. */
|
|
26
|
+
compacted: boolean;
|
|
27
|
+
constructor(id?: string, messages?: Message[]);
|
|
28
|
+
/** Append a message. */
|
|
29
|
+
add(message: Message): void;
|
|
30
|
+
/** Serializable snapshot for persistence. */
|
|
31
|
+
toJSON(): {
|
|
32
|
+
id: string;
|
|
33
|
+
messages: Message[];
|
|
34
|
+
compacted: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** Restore a thread from a snapshot. */
|
|
37
|
+
static fromJSON(data: {
|
|
38
|
+
id: string;
|
|
39
|
+
messages: Message[];
|
|
40
|
+
compacted?: boolean;
|
|
41
|
+
}): Thread;
|
|
42
|
+
/**
|
|
43
|
+
* Compact the thread if it exceeds the threshold. System messages and the most
|
|
44
|
+
* recent turn are preserved; older turns are summarized via the model.
|
|
45
|
+
*
|
|
46
|
+
* @returns true if compaction occurred.
|
|
47
|
+
*/
|
|
48
|
+
maybeCompact(provider: Provider, options?: ThreadOptions): Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { Thread as T, type ThreadOptions as a, estimateTokens as e };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { J as JSONSchema } from './types-Cn1g9Tg4.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The uniform tool contract. Every capability exposed to an agent — whether a
|
|
5
|
+
* local function or an MCP-provided tool — implements this single interface, with
|
|
6
|
+
* a JSON Schema (MCP-popularized) describing its inputs/outputs. The framework
|
|
7
|
+
* ships no built-in tools. (FR-009, FR-012d, Constitution V)
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** A callable capability available to an agent. */
|
|
13
|
+
interface Tool<I = unknown, O = unknown> {
|
|
14
|
+
/** Unique name. When provided by an MCP server it is namespaced as `server.tool`. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Natural-language description used by the model to decide when to call it. */
|
|
17
|
+
description: string;
|
|
18
|
+
/** JSON Schema for the arguments; validated before invocation. */
|
|
19
|
+
inputSchema: JSONSchema;
|
|
20
|
+
/** Optional JSON Schema describing the result. */
|
|
21
|
+
outputSchema?: JSONSchema;
|
|
22
|
+
/** Origin: `"local"` for code tools, or an MCP server id. */
|
|
23
|
+
source?: "local" | string;
|
|
24
|
+
/** Whether the tool is currently presented to the agent. Defaults to true. */
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
/** Execute the tool with validated arguments. */
|
|
27
|
+
run(args: I): Promise<O>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Define a local function tool with full type inference.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const add = defineTool({
|
|
35
|
+
* name: "add",
|
|
36
|
+
* description: "Add two numbers.",
|
|
37
|
+
* inputSchema: { type: "object", properties: { a: { type: "number" }, b: { type: "number" } }, required: ["a", "b"] },
|
|
38
|
+
* run: async ({ a, b }: { a: number; b: number }) => ({ sum: a + b }),
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare function defineTool<I, O>(tool: {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
inputSchema: JSONSchema;
|
|
46
|
+
outputSchema?: JSONSchema;
|
|
47
|
+
run: (args: I) => Promise<O>;
|
|
48
|
+
}): Tool<I, O>;
|
|
49
|
+
|
|
50
|
+
export { type Tool as T, defineTool as d };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { J as JSONSchema } from './types-Cn1g9Tg4.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The uniform tool contract. Every capability exposed to an agent — whether a
|
|
5
|
+
* local function or an MCP-provided tool — implements this single interface, with
|
|
6
|
+
* a JSON Schema (MCP-popularized) describing its inputs/outputs. The framework
|
|
7
|
+
* ships no built-in tools. (FR-009, FR-012d, Constitution V)
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** A callable capability available to an agent. */
|
|
13
|
+
interface Tool<I = unknown, O = unknown> {
|
|
14
|
+
/** Unique name. When provided by an MCP server it is namespaced as `server.tool`. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Natural-language description used by the model to decide when to call it. */
|
|
17
|
+
description: string;
|
|
18
|
+
/** JSON Schema for the arguments; validated before invocation. */
|
|
19
|
+
inputSchema: JSONSchema;
|
|
20
|
+
/** Optional JSON Schema describing the result. */
|
|
21
|
+
outputSchema?: JSONSchema;
|
|
22
|
+
/** Origin: `"local"` for code tools, or an MCP server id. */
|
|
23
|
+
source?: "local" | string;
|
|
24
|
+
/** Whether the tool is currently presented to the agent. Defaults to true. */
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
/** Execute the tool with validated arguments. */
|
|
27
|
+
run(args: I): Promise<O>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Define a local function tool with full type inference.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const add = defineTool({
|
|
35
|
+
* name: "add",
|
|
36
|
+
* description: "Add two numbers.",
|
|
37
|
+
* inputSchema: { type: "object", properties: { a: { type: "number" }, b: { type: "number" } }, required: ["a", "b"] },
|
|
38
|
+
* run: async ({ a, b }: { a: number; b: number }) => ({ sum: a + b }),
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare function defineTool<I, O>(tool: {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
inputSchema: JSONSchema;
|
|
46
|
+
outputSchema?: JSONSchema;
|
|
47
|
+
run: (args: I) => Promise<O>;
|
|
48
|
+
}): Tool<I, O>;
|
|
49
|
+
|
|
50
|
+
export { type Tool as T, defineTool as d };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkIU3LS5FC_cjs = require('../chunk-IU3LS5FC.cjs');
|
|
4
|
+
var chunkTAMJ5HSR_cjs = require('../chunk-TAMJ5HSR.cjs');
|
|
5
|
+
require('../chunk-MQ2XTH3S.cjs');
|
|
6
|
+
require('../chunk-IJASUMIQ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "defineTool", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkIU3LS5FC_cjs.defineTool; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "ToolRegistry", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkTAMJ5HSR_cjs.ToolRegistry; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "namespacedName", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkTAMJ5HSR_cjs.namespacedName; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "validateArgs", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunkTAMJ5HSR_cjs.validateArgs; }
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=index.cjs.map
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { T as Tool, d as defineTool } from '../tool-BZg_znMZ.cjs';
|
|
2
|
+
import { J as JSONSchema } from '../types-Cn1g9Tg4.cjs';
|
|
3
|
+
export { T as ToolRegistry, a as ToolResult, n as namespacedName } from '../registry-D4fThGiN.cjs';
|
|
4
|
+
import '../provider-CMAymr1b.cjs';
|
|
5
|
+
import '../errors-CjVz4W_5.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* JSON Schema validation for tool arguments, backed by Ajv. Invalid arguments are
|
|
9
|
+
* rejected before a tool runs and reported as a typed error the agent can act on.
|
|
10
|
+
* (FR-011)
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Validate `args` against `schema`. Returns the args on success; throws a
|
|
17
|
+
* {@link ValidationError} listing the failures otherwise.
|
|
18
|
+
*/
|
|
19
|
+
declare function validateArgs<T = unknown>(schema: JSONSchema, args: unknown): T;
|
|
20
|
+
|
|
21
|
+
export { validateArgs };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { T as Tool, d as defineTool } from '../tool-CSCC87OD.js';
|
|
2
|
+
import { J as JSONSchema } from '../types-Cn1g9Tg4.js';
|
|
3
|
+
export { T as ToolRegistry, a as ToolResult, n as namespacedName } from '../registry-CpO0yH5v.js';
|
|
4
|
+
import '../provider-osAtfZ7x.js';
|
|
5
|
+
import '../errors-CjVz4W_5.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* JSON Schema validation for tool arguments, backed by Ajv. Invalid arguments are
|
|
9
|
+
* rejected before a tool runs and reported as a typed error the agent can act on.
|
|
10
|
+
* (FR-011)
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Validate `args` against `schema`. Returns the args on success; throws a
|
|
17
|
+
* {@link ValidationError} listing the failures otherwise.
|
|
18
|
+
*/
|
|
19
|
+
declare function validateArgs<T = unknown>(schema: JSONSchema, args: unknown): T;
|
|
20
|
+
|
|
21
|
+
export { validateArgs };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { defineTool } from '../chunk-RZ43WNHR.js';
|
|
2
|
+
export { ToolRegistry, namespacedName, validateArgs } from '../chunk-HGEPXJDG.js';
|
|
3
|
+
import '../chunk-IXV4UIF5.js';
|
|
4
|
+
import '../chunk-DEABART4.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared content, message, and model-capability types used across the framework.
|
|
3
|
+
*
|
|
4
|
+
* These are the lowest-level building blocks: every higher-level module (agents,
|
|
5
|
+
* providers, tools, workflows) speaks in terms of {@link Message} and
|
|
6
|
+
* {@link ContentPart}. Keeping them dependency-free keeps the core tree-shakeable.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
/** A JSON Schema object (draft 2020-12 compatible), as popularized by MCP. */
|
|
11
|
+
type JSONSchema = Record<string, unknown>;
|
|
12
|
+
/** Role of a message in a conversation. */
|
|
13
|
+
type Role = "system" | "user" | "assistant" | "tool";
|
|
14
|
+
/** A single piece of message content. Images are only valid for vision-capable models. */
|
|
15
|
+
type ContentPart = {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: "image";
|
|
20
|
+
data: string;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A conversation message.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const msg: Message = { role: "user", parts: [{ type: "text", text: "Hi" }] };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
interface Message {
|
|
32
|
+
role: Role;
|
|
33
|
+
parts: ContentPart[];
|
|
34
|
+
/** Optional tool-call linkage for assistant/tool messages. */
|
|
35
|
+
toolCallId?: string;
|
|
36
|
+
/** Optional display name (e.g., the tool name for a tool message). */
|
|
37
|
+
name?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Per-model capabilities supplied by the caller. The framework cannot reliably
|
|
41
|
+
* discover these for arbitrary OpenAI-compatible/LM Studio models, so they are
|
|
42
|
+
* provided explicitly. (FR-007a)
|
|
43
|
+
*/
|
|
44
|
+
interface ModelCapabilities {
|
|
45
|
+
/** Model id/name. */
|
|
46
|
+
model: string;
|
|
47
|
+
/** Maximum input/context tokens; drives compaction threshold. */
|
|
48
|
+
maxInputTokens: number;
|
|
49
|
+
/** Maximum output tokens. */
|
|
50
|
+
maxOutputTokens: number;
|
|
51
|
+
/** Whether the model accepts image input. Defaults to false. */
|
|
52
|
+
supportsVision?: boolean;
|
|
53
|
+
/** Whether the model emits separate reasoning/thinking content. Defaults to false. */
|
|
54
|
+
supportsReasoning?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** Convenience: build a user message from a plain string. */
|
|
57
|
+
declare function textMessage(role: Role, text: string): Message;
|
|
58
|
+
/** Returns true if a message contains any image content part. */
|
|
59
|
+
declare function hasImage(message: Message): boolean;
|
|
60
|
+
/** Extract the concatenated text from a message. */
|
|
61
|
+
declare function messageText(message: Message): string;
|
|
62
|
+
|
|
63
|
+
export { type ContentPart as C, type JSONSchema as J, type Message as M, type Role as R, type ModelCapabilities as a, hasImage as h, messageText as m, textMessage as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared content, message, and model-capability types used across the framework.
|
|
3
|
+
*
|
|
4
|
+
* These are the lowest-level building blocks: every higher-level module (agents,
|
|
5
|
+
* providers, tools, workflows) speaks in terms of {@link Message} and
|
|
6
|
+
* {@link ContentPart}. Keeping them dependency-free keeps the core tree-shakeable.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
/** A JSON Schema object (draft 2020-12 compatible), as popularized by MCP. */
|
|
11
|
+
type JSONSchema = Record<string, unknown>;
|
|
12
|
+
/** Role of a message in a conversation. */
|
|
13
|
+
type Role = "system" | "user" | "assistant" | "tool";
|
|
14
|
+
/** A single piece of message content. Images are only valid for vision-capable models. */
|
|
15
|
+
type ContentPart = {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: "image";
|
|
20
|
+
data: string;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A conversation message.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const msg: Message = { role: "user", parts: [{ type: "text", text: "Hi" }] };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
interface Message {
|
|
32
|
+
role: Role;
|
|
33
|
+
parts: ContentPart[];
|
|
34
|
+
/** Optional tool-call linkage for assistant/tool messages. */
|
|
35
|
+
toolCallId?: string;
|
|
36
|
+
/** Optional display name (e.g., the tool name for a tool message). */
|
|
37
|
+
name?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Per-model capabilities supplied by the caller. The framework cannot reliably
|
|
41
|
+
* discover these for arbitrary OpenAI-compatible/LM Studio models, so they are
|
|
42
|
+
* provided explicitly. (FR-007a)
|
|
43
|
+
*/
|
|
44
|
+
interface ModelCapabilities {
|
|
45
|
+
/** Model id/name. */
|
|
46
|
+
model: string;
|
|
47
|
+
/** Maximum input/context tokens; drives compaction threshold. */
|
|
48
|
+
maxInputTokens: number;
|
|
49
|
+
/** Maximum output tokens. */
|
|
50
|
+
maxOutputTokens: number;
|
|
51
|
+
/** Whether the model accepts image input. Defaults to false. */
|
|
52
|
+
supportsVision?: boolean;
|
|
53
|
+
/** Whether the model emits separate reasoning/thinking content. Defaults to false. */
|
|
54
|
+
supportsReasoning?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** Convenience: build a user message from a plain string. */
|
|
57
|
+
declare function textMessage(role: Role, text: string): Message;
|
|
58
|
+
/** Returns true if a message contains any image content part. */
|
|
59
|
+
declare function hasImage(message: Message): boolean;
|
|
60
|
+
/** Extract the concatenated text from a message. */
|
|
61
|
+
declare function messageText(message: Message): string;
|
|
62
|
+
|
|
63
|
+
export { type ContentPart as C, type JSONSchema as J, type Message as M, type Role as R, type ModelCapabilities as a, hasImage as h, messageText as m, textMessage as t };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkRZP2ZUUX_cjs = require('../chunk-RZP2ZUUX.cjs');
|
|
4
|
+
require('../chunk-MQ2XTH3S.cjs');
|
|
5
|
+
require('../chunk-IJASUMIQ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "CHECKPOINT_VERSION", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkRZP2ZUUX_cjs.CHECKPOINT_VERSION; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "createCheckpoint", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkRZP2ZUUX_cjs.createCheckpoint; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "createWorkflow", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkRZP2ZUUX_cjs.createWorkflow; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "restoreCheckpoint", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkRZP2ZUUX_cjs.restoreCheckpoint; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "runBounded", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkRZP2ZUUX_cjs.runBounded; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "serializeCheckpoint", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkRZP2ZUUX_cjs.serializeCheckpoint; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "stepConcurrent", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkRZP2ZUUX_cjs.stepConcurrent; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "stepGroup", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkRZP2ZUUX_cjs.stepGroup; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "stepHandoff", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkRZP2ZUUX_cjs.stepHandoff; }
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "stepSequential", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return chunkRZP2ZUUX_cjs.stepSequential; }
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=index.cjs.map
|
|
50
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|