@fevex/core 0.1.0-alpha.6 → 0.1.0-alpha.8
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/README.md +47 -0
- package/dist/agents/index.d.mts +2 -2
- package/dist/artifacts/index.d.mts +1 -1
- package/dist/channels/index.d.mts +1 -1
- package/dist/evals/index.d.mts +4 -4
- package/dist/{fevex-B4QY5Z6e.d.mts → fevex-DB0-k1fb.d.mts} +14 -10
- package/dist/http/index.d.mts +4 -4
- package/dist/{index-CzAi2Y_Z.d.mts → index-B8molngu.d.mts} +92 -3
- package/dist/{index-BgKFd9yw.d.mts → index-BfYzemR8.d.mts} +1 -1
- package/dist/{index-CbACw6xZ.d.mts → index-Bl0hR7EC.d.mts} +2 -2
- package/dist/index-CAyAoOW0.d.mts +116 -0
- package/dist/{index-Df84VWmN.d.mts → index-CL7mu_x9.d.mts} +1 -1
- package/dist/{index-1cHr7KB_.d.mts → index-CODYPevS.d.mts} +3 -3
- package/dist/{index-CpLDt6Rw.d.mts → index-CecXoEbs.d.mts} +3 -3
- package/dist/{index-DVw0zOc_.d.mts → index-CuaetTLQ.d.mts} +3 -3
- package/dist/{index-5p3q2yIp.d.mts → index-DtMxzCqj.d.mts} +2 -2
- package/dist/{index-CseuTR-F.d.mts → index-RKE3-CKs.d.mts} +2 -2
- package/dist/index.d.mts +13 -13
- package/dist/index.mjs +311 -24
- package/dist/knowledge/index.d.mts +2 -2
- package/dist/knowledge/index.mjs +236 -36
- package/dist/models/index.d.mts +1 -1
- package/dist/observability/index.d.mts +1 -1
- package/dist/policies/index.d.mts +1 -1
- package/dist/runtime/index.d.mts +2 -2
- package/dist/runtime/index.mjs +105 -1
- package/dist/sandbox/index.d.mts +1 -1
- package/dist/teams/index.d.mts +1 -1
- package/dist/testing/index.d.mts +6 -6
- package/dist/tools/index.d.mts +2 -2
- package/dist/{types-B8laW1hM.d.mts → types-CckDlhYo.d.mts} +15 -1
- package/dist/workflows/index.d.mts +1 -1
- package/package.json +1 -1
- package/dist/index-BJktlD4E.d.mts +0 -70
package/dist/knowledge/index.mjs
CHANGED
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var InMemoryMemoryStore = class {
|
|
4
|
-
#records = /* @__PURE__ */ new Map();
|
|
5
|
-
async search(query, context) {
|
|
6
|
-
context.signal?.throwIfAborted();
|
|
7
|
-
const terms = query.query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
8
|
-
const scored = [...this.#records.values()].filter((record) => matchesScope(record, query)).map((record) => ({
|
|
9
|
-
record,
|
|
10
|
-
score: score(record.content, terms)
|
|
11
|
-
})).filter(({ score }) => !terms.length || score > 0).sort((left, right) => right.score - left.score || right.record.createdAt.localeCompare(left.record.createdAt));
|
|
12
|
-
return scored.slice(0, query.limit ?? scored.length).map(({ record }) => structuredClone(record));
|
|
13
|
-
}
|
|
14
|
-
async write(record, context) {
|
|
15
|
-
context.signal?.throwIfAborted();
|
|
16
|
-
const saved = {
|
|
17
|
-
id: crypto.randomUUID(),
|
|
18
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19
|
-
...structuredClone(record)
|
|
20
|
-
};
|
|
21
|
-
this.#records.set(saved.id, saved);
|
|
22
|
-
return structuredClone(saved);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
function matchesScope(record, query) {
|
|
26
|
-
return matches(record.agentName, query.agentName) && matches(record.sessionId, query.sessionId) && matches(record.namespace, query.namespace) && matches(record.actor?.id, query.actor?.id);
|
|
27
|
-
}
|
|
28
|
-
function matches(left, right) {
|
|
29
|
-
return right === void 0 || left === void 0 || left === right;
|
|
30
|
-
}
|
|
31
|
-
function score(content, terms) {
|
|
32
|
-
const text = content.toLowerCase();
|
|
33
|
-
return terms.reduce((total, term) => total + (text.includes(term) ? 1 : 0), 0);
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
1
|
+
import { readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
2
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
36
3
|
//#region src/knowledge/knowledge.ts
|
|
4
|
+
function isProgressiveSkillProvider(provider) {
|
|
5
|
+
const candidate = provider;
|
|
6
|
+
return typeof candidate.load === "function" && typeof candidate.description === "string";
|
|
7
|
+
}
|
|
37
8
|
function defineContextProvider(provider) {
|
|
38
9
|
return provider;
|
|
39
10
|
}
|
|
@@ -86,4 +57,233 @@ function stringifyKnowledge(value) {
|
|
|
86
57
|
return typeof value === "string" ? value : JSON.stringify(value);
|
|
87
58
|
}
|
|
88
59
|
//#endregion
|
|
89
|
-
|
|
60
|
+
//#region src/knowledge/agents-md.ts
|
|
61
|
+
const DEFAULT_MAX_BYTES$1 = 256 * 1024;
|
|
62
|
+
/**
|
|
63
|
+
* Reads one explicit `AGENTS.md` file as context.
|
|
64
|
+
*
|
|
65
|
+
* Fevex never walks the filesystem looking for `AGENTS.md`; register one
|
|
66
|
+
* provider per file and reference its name from `agent.context`.
|
|
67
|
+
*/
|
|
68
|
+
function createAgentsMdContextProvider(options) {
|
|
69
|
+
const path = typeof options === "string" ? options : options.path;
|
|
70
|
+
const name = ((typeof options === "string" ? void 0 : options.name) ?? "agents-md").trim();
|
|
71
|
+
const maxBytes = (typeof options === "string" ? void 0 : options.maxBytes) ?? DEFAULT_MAX_BYTES$1;
|
|
72
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes <= 0) throw new TypeError("AGENTS.md maxBytes must be a positive safe integer");
|
|
73
|
+
if (!name.trim()) throw new TypeError("AGENTS.md provider name cannot be empty");
|
|
74
|
+
return defineContextProvider({
|
|
75
|
+
name,
|
|
76
|
+
async read() {
|
|
77
|
+
if ((await stat(path)).size > maxBytes) throw new Error(`AGENTS.md file "${path}" exceeds ${maxBytes} bytes`);
|
|
78
|
+
const content = await readFile(path, "utf8");
|
|
79
|
+
if (Buffer.byteLength(content) > maxBytes) throw new Error(`AGENTS.md file "${path}" exceeds ${maxBytes} bytes`);
|
|
80
|
+
return content.trim() ? [{
|
|
81
|
+
id: "agents-md",
|
|
82
|
+
content
|
|
83
|
+
}] : [];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/knowledge/in-memory-memory-store.ts
|
|
89
|
+
/** Volatile keyword-search memory store for tests and local development. */
|
|
90
|
+
var InMemoryMemoryStore = class {
|
|
91
|
+
#records = /* @__PURE__ */ new Map();
|
|
92
|
+
async search(query, context) {
|
|
93
|
+
context.signal?.throwIfAborted();
|
|
94
|
+
const terms = query.query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
95
|
+
const scored = [...this.#records.values()].filter((record) => matchesScope(record, query)).map((record) => ({
|
|
96
|
+
record,
|
|
97
|
+
score: score(record.content, terms)
|
|
98
|
+
})).filter(({ score }) => !terms.length || score > 0).sort((left, right) => right.score - left.score || right.record.createdAt.localeCompare(left.record.createdAt));
|
|
99
|
+
return scored.slice(0, query.limit ?? scored.length).map(({ record }) => structuredClone(record));
|
|
100
|
+
}
|
|
101
|
+
async write(record, context) {
|
|
102
|
+
context.signal?.throwIfAborted();
|
|
103
|
+
const saved = {
|
|
104
|
+
id: crypto.randomUUID(),
|
|
105
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
106
|
+
...structuredClone(record)
|
|
107
|
+
};
|
|
108
|
+
this.#records.set(saved.id, saved);
|
|
109
|
+
return structuredClone(saved);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
function matchesScope(record, query) {
|
|
113
|
+
return matches(record.agentName, query.agentName) && matches(record.sessionId, query.sessionId) && matches(record.namespace, query.namespace) && matches(record.actor?.id, query.actor?.id);
|
|
114
|
+
}
|
|
115
|
+
function matches(left, right) {
|
|
116
|
+
return right === void 0 || left === void 0 || left === right;
|
|
117
|
+
}
|
|
118
|
+
function score(content, terms) {
|
|
119
|
+
const text = content.toLowerCase();
|
|
120
|
+
return terms.reduce((total, term) => total + (text.includes(term) ? 1 : 0), 0);
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/knowledge/skill-file.ts
|
|
124
|
+
const DEFAULT_MAX_BYTES = 256 * 1024;
|
|
125
|
+
const DEFAULT_MAX_RESOURCE_BYTES = 256 * 1024;
|
|
126
|
+
const MAX_RESOURCES = 200;
|
|
127
|
+
const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
128
|
+
const RESOURCE_DIRECTORIES = [
|
|
129
|
+
"references",
|
|
130
|
+
"scripts",
|
|
131
|
+
"assets"
|
|
132
|
+
];
|
|
133
|
+
/**
|
|
134
|
+
* Loads one explicit `SKILL.md` file.
|
|
135
|
+
*
|
|
136
|
+
* Only `name` and `description` are advertised up front. The body and any
|
|
137
|
+
* files under `references/`, `scripts/` or `assets/` load on demand.
|
|
138
|
+
*/
|
|
139
|
+
async function loadSkillFile(path, options = {}) {
|
|
140
|
+
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
141
|
+
const maxResourceBytes = options.maxResourceBytes ?? DEFAULT_MAX_RESOURCE_BYTES;
|
|
142
|
+
assertPositiveInteger(maxBytes, "maxBytes");
|
|
143
|
+
assertPositiveInteger(maxResourceBytes, "maxResourceBytes");
|
|
144
|
+
const absolute = await realpath(resolve(path));
|
|
145
|
+
if ((await stat(absolute)).size > maxBytes) throw new Error(`Skill file "${path}" exceeds ${maxBytes} bytes`);
|
|
146
|
+
const source = (await readFile(absolute, "utf8")).replace(/^\uFEFF/, "");
|
|
147
|
+
if (Buffer.byteLength(source) > maxBytes) throw new Error(`Skill file "${path}" exceeds ${maxBytes} bytes`);
|
|
148
|
+
const skill = parseSkillFile(source, path);
|
|
149
|
+
const root = dirname(absolute);
|
|
150
|
+
return defineContextProvider({
|
|
151
|
+
name: skill.name,
|
|
152
|
+
description: skill.description,
|
|
153
|
+
async read() {
|
|
154
|
+
return [{
|
|
155
|
+
id: `${skill.name}:metadata`,
|
|
156
|
+
content: skill.description
|
|
157
|
+
}];
|
|
158
|
+
},
|
|
159
|
+
async load(_context, resource) {
|
|
160
|
+
if (resource !== void 0) return [{
|
|
161
|
+
id: `${skill.name}:resource:${resource}`,
|
|
162
|
+
content: await readResource(root, resource, maxResourceBytes)
|
|
163
|
+
}];
|
|
164
|
+
const blocks = [{
|
|
165
|
+
id: `${skill.name}:instructions`,
|
|
166
|
+
content: skill.instructions
|
|
167
|
+
}];
|
|
168
|
+
const resources = await listResources(root);
|
|
169
|
+
if (resources.length) blocks.push({
|
|
170
|
+
id: `${skill.name}:resources`,
|
|
171
|
+
content: [
|
|
172
|
+
"Resources:",
|
|
173
|
+
...resources.map((item) => `- ${item.path} (${formatBytes(item.size)})`),
|
|
174
|
+
"Load one by passing its path as the resource argument.",
|
|
175
|
+
...resources.some((item) => item.path.startsWith("scripts/")) ? ["Scripts are for reference only and are not executed by this runtime."] : []
|
|
176
|
+
].join("\n")
|
|
177
|
+
});
|
|
178
|
+
return blocks;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/** Loads several explicit `SKILL.md` files; it never scans directories. */
|
|
183
|
+
function loadSkillFiles(paths, options = {}) {
|
|
184
|
+
return Promise.all(paths.map((path) => loadSkillFile(path, options)));
|
|
185
|
+
}
|
|
186
|
+
function parseSkillFile(source, path) {
|
|
187
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(source);
|
|
188
|
+
if (!match) throw new Error(`Skill file "${path}" must start with --- frontmatter`);
|
|
189
|
+
const fields = parseFrontmatter(match[1]);
|
|
190
|
+
const name = fields.name?.trim();
|
|
191
|
+
const description = fields.description?.trim();
|
|
192
|
+
const instructions = match[2].trim();
|
|
193
|
+
if (!name) throw new Error(`Skill file "${path}" must define a name`);
|
|
194
|
+
if (name.length > 64 || !SKILL_NAME.test(name) || name.startsWith("fevex__")) throw new Error(`Skill file "${path}" has an invalid name; use lowercase letters, numbers and hyphens, up to 64 characters`);
|
|
195
|
+
if (!description) throw new Error(`Skill file "${path}" must define a description`);
|
|
196
|
+
if (!instructions) throw new Error(`Skill file "${path}" must contain instructions`);
|
|
197
|
+
return {
|
|
198
|
+
name,
|
|
199
|
+
description,
|
|
200
|
+
instructions
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function parseFrontmatter(source) {
|
|
204
|
+
const fields = {};
|
|
205
|
+
const lines = source.split(/\r?\n/);
|
|
206
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
207
|
+
const line = lines[index];
|
|
208
|
+
if (!line.trim() || line.trimStart().startsWith("#")) continue;
|
|
209
|
+
if (/^\s/.test(line)) continue;
|
|
210
|
+
const colon = line.indexOf(":");
|
|
211
|
+
if (colon <= 0) continue;
|
|
212
|
+
const key = line.slice(0, colon).trim();
|
|
213
|
+
let value = line.slice(colon + 1).trim();
|
|
214
|
+
if (value === "|" || value === ">" || value === "|-" || value === ">-") {
|
|
215
|
+
const block = [];
|
|
216
|
+
while (index + 1 < lines.length) {
|
|
217
|
+
const next = lines[index + 1];
|
|
218
|
+
if (next.trim() && !/^\s/.test(next)) break;
|
|
219
|
+
index += 1;
|
|
220
|
+
block.push(next.replace(/^\s+/, ""));
|
|
221
|
+
}
|
|
222
|
+
while (block.length && !block[block.length - 1]) block.pop();
|
|
223
|
+
value = value.startsWith(">") ? block.filter(Boolean).join(" ") : block.join("\n");
|
|
224
|
+
} else if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) value = value.slice(1, -1);
|
|
225
|
+
fields[key] = value;
|
|
226
|
+
}
|
|
227
|
+
return fields;
|
|
228
|
+
}
|
|
229
|
+
async function listResources(root) {
|
|
230
|
+
const resources = [];
|
|
231
|
+
for (const directory of RESOURCE_DIRECTORIES) await walkResources(resolve(root, directory), root, resources);
|
|
232
|
+
return resources.sort((left, right) => left.path.localeCompare(right.path)).slice(0, MAX_RESOURCES);
|
|
233
|
+
}
|
|
234
|
+
async function walkResources(directory, root, resources) {
|
|
235
|
+
if (resources.length >= MAX_RESOURCES) return;
|
|
236
|
+
let entries;
|
|
237
|
+
try {
|
|
238
|
+
entries = await readdir(directory, { withFileTypes: true });
|
|
239
|
+
} catch (error) {
|
|
240
|
+
if (isMissing(error)) return;
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
for (const entry of entries) {
|
|
244
|
+
if (resources.length >= MAX_RESOURCES) return;
|
|
245
|
+
if (entry.isSymbolicLink()) continue;
|
|
246
|
+
const target = resolve(directory, entry.name);
|
|
247
|
+
if (entry.isDirectory()) {
|
|
248
|
+
await walkResources(target, root, resources);
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
if (!entry.isFile()) continue;
|
|
252
|
+
const info = await stat(target);
|
|
253
|
+
resources.push({
|
|
254
|
+
path: relative(root, target).split("\\").join("/"),
|
|
255
|
+
size: info.size
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async function readResource(root, resource, maxBytes) {
|
|
260
|
+
if (resource.includes("\0")) throw new Error("Skill resource path is invalid");
|
|
261
|
+
const requested = resolve(root, resource);
|
|
262
|
+
const requestedPath = relative(root, requested);
|
|
263
|
+
if (!requestedPath || requestedPath.startsWith("..") || isAbsolute(requestedPath)) throw new Error(`Skill resource "${resource}" is outside the skill directory`);
|
|
264
|
+
let target;
|
|
265
|
+
try {
|
|
266
|
+
target = await realpath(requested);
|
|
267
|
+
} catch {
|
|
268
|
+
throw new Error(`Skill resource "${resource}" was not found`);
|
|
269
|
+
}
|
|
270
|
+
const path = relative(root, target);
|
|
271
|
+
if (!path || path.startsWith("..") || isAbsolute(path)) throw new Error(`Skill resource "${resource}" is outside the skill directory`);
|
|
272
|
+
const info = await stat(target);
|
|
273
|
+
if (!info.isFile()) throw new Error(`Skill resource "${resource}" is not a file`);
|
|
274
|
+
if (info.size > maxBytes) throw new Error(`Skill resource "${resource}" exceeds ${maxBytes} bytes`);
|
|
275
|
+
const buffer = await readFile(target);
|
|
276
|
+
if (buffer.includes(0)) throw new Error(`Skill resource "${resource}" is not UTF-8 text`);
|
|
277
|
+
return buffer.toString("utf8");
|
|
278
|
+
}
|
|
279
|
+
function formatBytes(bytes) {
|
|
280
|
+
return bytes < 1024 ? `${bytes} B` : `${(bytes / 1024).toFixed(1)} KB`;
|
|
281
|
+
}
|
|
282
|
+
function assertPositiveInteger(value, name) {
|
|
283
|
+
if (!Number.isSafeInteger(value) || value <= 0) throw new TypeError(`Skill ${name} must be a positive safe integer`);
|
|
284
|
+
}
|
|
285
|
+
function isMissing(error) {
|
|
286
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
287
|
+
}
|
|
288
|
+
//#endregion
|
|
289
|
+
export { InMemoryMemoryStore, createAgentsMdContextProvider, createMemoryContextProvider, defineContextProvider, defineSkill, isProgressiveSkillProvider, loadSkillFile, loadSkillFiles };
|
package/dist/models/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ModelResult, c as ReasoningEffort, i as ModelRef, l as ToolChoice, n as ModelInput, o as ModelStreamEvent, r as ModelMetadata, s as ModelUsage, t as ModelGateway } from "../index-
|
|
1
|
+
import { a as ModelResult, c as ReasoningEffort, i as ModelRef, l as ToolChoice, n as ModelInput, o as ModelStreamEvent, r as ModelMetadata, s as ModelUsage, t as ModelGateway } from "../index-BfYzemR8.mjs";
|
|
2
2
|
export { ModelGateway, ModelInput, ModelMetadata, ModelRef, ModelResult, ModelStreamEvent, ModelUsage, ReasoningEffort, ToolChoice };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as TraceSpanKind, a as RunTrace, c as TraceContentKind, d as TraceExportQueueOptions, f as TraceExporter, g as TraceSpan, h as TraceRunKind, i as ObservabilityStats, l as TraceContentPolicy, m as TraceRedactorInput, n as CostCalculatorInput, o as TraceAnnotation, p as TraceRedactor, r as ObservabilityOptions, s as TraceContent, t as CostCalculator, u as TraceCost, v as TraceStatus } from "../index-
|
|
1
|
+
import { _ as TraceSpanKind, a as RunTrace, c as TraceContentKind, d as TraceExportQueueOptions, f as TraceExporter, g as TraceSpan, h as TraceRunKind, i as ObservabilityStats, l as TraceContentPolicy, m as TraceRedactorInput, n as CostCalculatorInput, o as TraceAnnotation, p as TraceRedactor, r as ObservabilityOptions, s as TraceContent, t as CostCalculator, u as TraceCost, v as TraceStatus } from "../index-CecXoEbs.mjs";
|
|
2
2
|
export { CostCalculator, CostCalculatorInput, ObservabilityOptions, ObservabilityStats, RunTrace, TraceAnnotation, TraceContent, TraceContentKind, TraceContentPolicy, TraceCost, TraceExportQueueOptions, TraceExporter, TraceRedactor, TraceRedactorInput, TraceRunKind, TraceSpan, TraceSpanKind, TraceStatus };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as definePolicy, n as PolicyDecision, r as PolicyDefinition, t as PolicyAuthorization } from "../index-
|
|
1
|
+
import { i as definePolicy, n as PolicyDecision, r as PolicyDefinition, t as PolicyAuthorization } from "../index-Bl0hR7EC.mjs";
|
|
2
2
|
export { PolicyAuthorization, PolicyDecision, PolicyDefinition, definePolicy };
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AgentRun, AgentRunPause, ApprovalMode, ApprovalRequest, ApprovalResolution, CoordinatorCheckpoint, CoordinatorRun, CredentialStore, DurableRunStore, ElicitationMode, ElicitationRequest, ElicitationResolution, EventResolution, ExecutionCommit, ExecutionCreate, InMemoryRunStore, ListEventsOptions, PendingToolExecution, PurgeRunsOptions, PurgeRunsResult, ResumeRunResolution, RetainableRunStatus, RetainableRunStore, RunCheckpoint, RunCorrelation, RunLease, RunPause, RunRecord, RunRequest, RunResult, RunStatus, RunStore, Session, SessionId, StoredRunCheckpoint, TeamCheckpoint, TeamRun, TimerResolution, ToolExecutionRecord, ToolExecutionResolution, ToolExecutionStatus, WorkflowBudgetUsage, WorkflowCheckpoint, WorkflowCompensationRecord, WorkflowRun, WorkflowStepRecord, WorkflowWaitRecord, isDurableRunStore, isRetainableRunStore, validateListEventsOptions, validatePurgeRunsOptions };
|
|
1
|
+
import { $ as ToolExecutionRecord, A as ListEventsOptions, B as RunPause, C as DurableRunStore, D as EventResolution, E as ElicitationResolution, F as RetainableRunStatus, G as RunStore, H as RunRequest, I as RetainableRunStore, J as SessionId, K as Session, L as RunCheckpoint, M as PurgeRunsOptions, N as PurgeRunsResult, O as ExecutionCommit, P as ResumeRunResolution, Q as TimerResolution, R as RunCorrelation, S as CredentialStore, T as ElicitationRequest, U as RunResult, V as RunRecord, W as RunStatus, X as TeamCheckpoint, Y as StoredRunCheckpoint, Z as TeamRun, _ as ApprovalMode, a as InMemoryRunStore, at as WorkflowRun, b as CoordinatorCheckpoint, c as ContextCompactor, ct as isDurableRunStore, d as ResolvedContextBudget, dt as validatePurgeRunsOptions, et as ToolExecutionResolution, f as createDigestContextCompactor, g as AgentRunPause, h as AgentRun, it as WorkflowCompensationRecord, j as PendingToolExecution, k as ExecutionCreate, l as ContextTokenEstimator, lt as isRetainableRunStore, m as resolveContextBudget, nt as WorkflowBudgetUsage, o as ContextCompactionInput, ot as WorkflowStepRecord, p as estimateContextTokens, q as SessionCompaction, rt as WorkflowCheckpoint, s as ContextCompactionOptions, st as WorkflowWaitRecord, tt as ToolExecutionStatus, u as DigestContextCompactorOptions, ut as validateListEventsOptions, v as ApprovalRequest, w as ElicitationMode, x as CoordinatorRun, y as ApprovalResolution, z as RunLease } from "../index-B8molngu.mjs";
|
|
2
|
+
export { AgentRun, AgentRunPause, ApprovalMode, ApprovalRequest, ApprovalResolution, ContextCompactionInput, ContextCompactionOptions, ContextCompactor, ContextTokenEstimator, CoordinatorCheckpoint, CoordinatorRun, CredentialStore, DigestContextCompactorOptions, DurableRunStore, ElicitationMode, ElicitationRequest, ElicitationResolution, EventResolution, ExecutionCommit, ExecutionCreate, InMemoryRunStore, ListEventsOptions, PendingToolExecution, PurgeRunsOptions, PurgeRunsResult, ResolvedContextBudget, ResumeRunResolution, RetainableRunStatus, RetainableRunStore, RunCheckpoint, RunCorrelation, RunLease, RunPause, RunRecord, RunRequest, RunResult, RunStatus, RunStore, Session, SessionCompaction, SessionId, StoredRunCheckpoint, TeamCheckpoint, TeamRun, TimerResolution, ToolExecutionRecord, ToolExecutionResolution, ToolExecutionStatus, WorkflowBudgetUsage, WorkflowCheckpoint, WorkflowCompensationRecord, WorkflowRun, WorkflowStepRecord, WorkflowWaitRecord, createDigestContextCompactor, estimateContextTokens, isDurableRunStore, isRetainableRunStore, resolveContextBudget, validateListEventsOptions, validatePurgeRunsOptions };
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -1,4 +1,108 @@
|
|
|
1
1
|
import { t as FevexRunError } from "../run-error-Cr17wPGH.mjs";
|
|
2
|
+
//#region src/runtime/compaction.ts
|
|
3
|
+
/** Validates a context budget and fills in defaults. */
|
|
4
|
+
function resolveContextBudget(budget, label) {
|
|
5
|
+
if (budget === void 0) return void 0;
|
|
6
|
+
if (!isRecord(budget)) throw new TypeError(`${label} must be an object`);
|
|
7
|
+
const contextWindow = budget.contextWindow;
|
|
8
|
+
if (!Number.isSafeInteger(contextWindow) || contextWindow <= 0) throw new TypeError(`${label}.contextWindow must be a positive safe integer`);
|
|
9
|
+
const reserveOutputTokens = budget.reserveOutputTokens ?? 0;
|
|
10
|
+
if (!Number.isSafeInteger(reserveOutputTokens) || reserveOutputTokens < 0 || reserveOutputTokens >= contextWindow) throw new TypeError(`${label}.reserveOutputTokens must be a non-negative safe integer below contextWindow`);
|
|
11
|
+
const usable = contextWindow - reserveOutputTokens;
|
|
12
|
+
const compactAt = budget.compactAt ?? .8;
|
|
13
|
+
if (typeof compactAt !== "number" || !Number.isFinite(compactAt) || compactAt <= 0 || compactAt > 1) throw new TypeError(`${label}.compactAt must be greater than 0 and at most 1`);
|
|
14
|
+
const targetTokens = budget.targetTokens ?? Math.max(1, Math.floor(usable * Math.min(.5, compactAt * .9)));
|
|
15
|
+
if (!Number.isSafeInteger(targetTokens) || targetTokens <= 0 || targetTokens >= usable) throw new TypeError(`${label}.targetTokens must be a positive safe integer below the usable window`);
|
|
16
|
+
if (targetTokens > Math.floor(usable * compactAt)) throw new TypeError(`${label}.targetTokens must not exceed the compaction threshold`);
|
|
17
|
+
const safetyFactor = budget.safetyFactor ?? 1.1;
|
|
18
|
+
if (typeof safetyFactor !== "number" || !Number.isFinite(safetyFactor) || safetyFactor < 1 || safetyFactor > 2) throw new TypeError(`${label}.safetyFactor must be between 1 and 2`);
|
|
19
|
+
return {
|
|
20
|
+
contextWindow,
|
|
21
|
+
reserveOutputTokens,
|
|
22
|
+
compactAt,
|
|
23
|
+
targetTokens,
|
|
24
|
+
safetyFactor
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Rough provider-neutral estimate: about four characters per token plus
|
|
29
|
+
* message and tool framing. Hosts can inject a real tokenizer instead.
|
|
30
|
+
*/
|
|
31
|
+
function estimateContextTokens(input) {
|
|
32
|
+
let characters = 0;
|
|
33
|
+
for (const message of input.messages) {
|
|
34
|
+
characters += message.role.length + message.content.length + 16;
|
|
35
|
+
if (message.name !== void 0) characters += message.name.length;
|
|
36
|
+
if (message.toolCallId !== void 0) characters += message.toolCallId.length;
|
|
37
|
+
if (message.toolCalls !== void 0) characters += JSON.stringify(message.toolCalls).length;
|
|
38
|
+
}
|
|
39
|
+
if (input.tools?.length) characters += JSON.stringify(input.tools).length;
|
|
40
|
+
return Math.max(1, Math.ceil(characters / 4));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Deterministic compactor used when the host does not inject one. It keeps
|
|
44
|
+
* role-aware excerpts of older messages and drops the oldest excerpts first.
|
|
45
|
+
* It never calls a model.
|
|
46
|
+
*/
|
|
47
|
+
function createDigestContextCompactor(options = {}) {
|
|
48
|
+
const maxChars = options.maxCharsPerMessage ?? 400;
|
|
49
|
+
if (!Number.isSafeInteger(maxChars) || maxChars < 40) throw new TypeError("Digest compactor maxCharsPerMessage must be a safe integer of at least 40");
|
|
50
|
+
return { compact(input) {
|
|
51
|
+
if (input.messages.length === 0) return [{
|
|
52
|
+
role: "system",
|
|
53
|
+
content: "[Compacted earlier conversation]"
|
|
54
|
+
}];
|
|
55
|
+
let perMessage = maxChars;
|
|
56
|
+
let lines = input.messages.flatMap((message) => digestMessage(message, perMessage));
|
|
57
|
+
while (input.estimateTokens([{
|
|
58
|
+
role: "system",
|
|
59
|
+
content: digestContent(lines, input.messages.length)
|
|
60
|
+
}]) > input.targetTokens && perMessage > 40) {
|
|
61
|
+
perMessage = Math.max(40, Math.floor(perMessage * .7));
|
|
62
|
+
lines = input.messages.flatMap((message) => digestMessage(message, perMessage));
|
|
63
|
+
}
|
|
64
|
+
let selected = lines;
|
|
65
|
+
let content = digestContent(selected, input.messages.length);
|
|
66
|
+
while (input.estimateTokens([{
|
|
67
|
+
role: "system",
|
|
68
|
+
content
|
|
69
|
+
}]) > input.targetTokens && selected.length > 1) {
|
|
70
|
+
selected = selected.slice(1);
|
|
71
|
+
content = digestContent(selected, input.messages.length);
|
|
72
|
+
}
|
|
73
|
+
const limit = Math.max(80, input.targetTokens * 4);
|
|
74
|
+
if (content.length > limit) content = `${content.slice(0, Math.max(0, limit - 1))}…`;
|
|
75
|
+
return [{
|
|
76
|
+
role: "system",
|
|
77
|
+
content
|
|
78
|
+
}];
|
|
79
|
+
} };
|
|
80
|
+
}
|
|
81
|
+
function digestContent(lines, totalMessages) {
|
|
82
|
+
const omitted = Math.max(0, totalMessages - lines.length);
|
|
83
|
+
return [`[Compacted conversation: ${totalMessages} earlier messages${omitted ? `, ${omitted} omitted` : ""}]`, ...lines].join("\n");
|
|
84
|
+
}
|
|
85
|
+
function digestMessage(message, maxChars) {
|
|
86
|
+
const content = truncate(message.content, maxChars);
|
|
87
|
+
if (message.role === "user") return content ? [`User: ${content}`] : [];
|
|
88
|
+
if (message.role === "assistant") {
|
|
89
|
+
const lines = [];
|
|
90
|
+
if (content) lines.push(`Assistant: ${content}`);
|
|
91
|
+
for (const call of message.toolCalls ?? []) lines.push(`Tool call ${call.name}: ${truncate(JSON.stringify(call.input), Math.min(maxChars, 200))}`);
|
|
92
|
+
return lines;
|
|
93
|
+
}
|
|
94
|
+
if (message.role === "tool") return content ? [`Tool result${message.name === void 0 ? "" : ` (${message.name})`}: ${content}`] : [];
|
|
95
|
+
return content ? [`System: ${content}`] : [];
|
|
96
|
+
}
|
|
97
|
+
function truncate(value, maxChars) {
|
|
98
|
+
const normalized = value.replace(/\s+/g, " ").trim();
|
|
99
|
+
if (normalized.length <= maxChars) return normalized;
|
|
100
|
+
return `${normalized.slice(0, Math.max(0, maxChars - 1))}…`;
|
|
101
|
+
}
|
|
102
|
+
function isRecord(value) {
|
|
103
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
2
106
|
//#region src/runtime/run-store.ts
|
|
3
107
|
function validateListEventsOptions(options) {
|
|
4
108
|
if (options.limit !== void 0 && (!Number.isSafeInteger(options.limit) || options.limit < 1)) throw new TypeError("Event limit must be a positive safe integer");
|
|
@@ -180,4 +284,4 @@ var InMemoryRunStore = class {
|
|
|
180
284
|
}
|
|
181
285
|
};
|
|
182
286
|
//#endregion
|
|
183
|
-
export { InMemoryRunStore, isDurableRunStore, isRetainableRunStore, validateListEventsOptions, validatePurgeRunsOptions };
|
|
287
|
+
export { InMemoryRunStore, createDigestContextCompactor, estimateContextTokens, isDurableRunStore, isRetainableRunStore, resolveContextBudget, validateListEventsOptions, validatePurgeRunsOptions };
|
package/dist/sandbox/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SandboxError, c as sandboxResultToJson, i as SandboxCapabilities, n as createLocalSandbox, o as SandboxRunRequest, r as Sandbox, s as SandboxRunResult, t as LocalSandboxOptions } from "../index-
|
|
1
|
+
import { a as SandboxError, c as sandboxResultToJson, i as SandboxCapabilities, n as createLocalSandbox, o as SandboxRunRequest, r as Sandbox, s as SandboxRunResult, t as LocalSandboxOptions } from "../index-CL7mu_x9.mjs";
|
|
2
2
|
export { LocalSandboxOptions, Sandbox, SandboxCapabilities, SandboxError, SandboxRunRequest, SandboxRunResult, createLocalSandbox, sandboxResultToJson };
|
package/dist/teams/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TeamMember, c as defineTeam, i as TeamLimits, n as TeamDelegation, o as TeamStep, r as TeamHandoff, s as TeamTaskResult, t as TeamDefinition } from "../index-
|
|
1
|
+
import { a as TeamMember, c as defineTeam, i as TeamLimits, n as TeamDelegation, o as TeamStep, r as TeamHandoff, s as TeamTaskResult, t as TeamDefinition } from "../index-CODYPevS.mjs";
|
|
2
2
|
export { type TeamDefinition, type TeamDelegation, type TeamHandoff, type TeamLimits, type TeamMember, type TeamStep, type TeamTaskResult, defineTeam };
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { m as ToolCall } from "../types-
|
|
2
|
-
import { a as ModelResult, n as ModelInput, t as ModelGateway } from "../index-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { d as ToolProvider } from "../index-
|
|
6
|
-
import { d as ChannelMessage, f as ChannelOutput, o as ChannelElicitationContext, r as ChannelAdapter } from "../index-
|
|
1
|
+
import { m as ToolCall } from "../types-CckDlhYo.mjs";
|
|
2
|
+
import { a as ModelResult, n as ModelInput, t as ModelGateway } from "../index-BfYzemR8.mjs";
|
|
3
|
+
import { C as DurableRunStore, T as ElicitationRequest } from "../index-B8molngu.mjs";
|
|
4
|
+
import { f as MemoryStore } from "../index-CAyAoOW0.mjs";
|
|
5
|
+
import { d as ToolProvider } from "../index-DtMxzCqj.mjs";
|
|
6
|
+
import { d as ChannelMessage, f as ChannelOutput, o as ChannelElicitationContext, r as ChannelAdapter } from "../index-CuaetTLQ.mjs";
|
|
7
7
|
//#region src/testing/contracts.d.ts
|
|
8
8
|
interface ModelGatewayContract {
|
|
9
9
|
output?: unknown;
|
package/dist/tools/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { g as ToolSpec, m as ToolCall } from "../types-
|
|
2
|
-
import { C as toToolSpec, S as defineTool, _ as ToolExecutionContext, a as compileFevexJsonSchema, b as ToolRetryPolicy, c as ConnectionToolPolicy, d as ToolProvider, f as ToolProviderContext, g as ToolDefinition, h as ToolApproval, i as FevexJsonSchemaValidator, l as IntegrationError, m as defineConnection, n as FevexJsonSchemaProfileLimits, o as validateFevexJsonSchemaProfile, p as ToolProviderTool, r as FevexJsonSchemaProfileOptions, s as ConnectionDefinition, t as FEVEX_JSON_SCHEMA_PROFILE_VERSION, u as IntegrationErrorCategory, v as ToolIdempotency, x as ToolRisk, y as ToolResult } from "../index-
|
|
1
|
+
import { g as ToolSpec, m as ToolCall } from "../types-CckDlhYo.mjs";
|
|
2
|
+
import { C as toToolSpec, S as defineTool, _ as ToolExecutionContext, a as compileFevexJsonSchema, b as ToolRetryPolicy, c as ConnectionToolPolicy, d as ToolProvider, f as ToolProviderContext, g as ToolDefinition, h as ToolApproval, i as FevexJsonSchemaValidator, l as IntegrationError, m as defineConnection, n as FevexJsonSchemaProfileLimits, o as validateFevexJsonSchemaProfile, p as ToolProviderTool, r as FevexJsonSchemaProfileOptions, s as ConnectionDefinition, t as FEVEX_JSON_SCHEMA_PROFILE_VERSION, u as IntegrationErrorCategory, v as ToolIdempotency, x as ToolRisk, y as ToolResult } from "../index-DtMxzCqj.mjs";
|
|
3
3
|
export { ConnectionDefinition, ConnectionToolPolicy, FEVEX_JSON_SCHEMA_PROFILE_VERSION, FevexJsonSchemaProfileLimits, FevexJsonSchemaProfileOptions, FevexJsonSchemaValidator, IntegrationError, IntegrationErrorCategory, ToolApproval, type ToolCall, ToolDefinition, ToolExecutionContext, ToolIdempotency, ToolProvider, ToolProviderContext, ToolProviderTool, ToolResult, ToolRetryPolicy, ToolRisk, type ToolSpec, compileFevexJsonSchema, defineConnection, defineTool, toToolSpec, validateFevexJsonSchemaProfile };
|
|
@@ -258,7 +258,7 @@ interface ToolEventSource {
|
|
|
258
258
|
connectionName: string;
|
|
259
259
|
remoteToolName: string;
|
|
260
260
|
}
|
|
261
|
-
type AgentEventType = 'run.started' | 'run.recovered' | 'run.paused' | 'run.resumed' | 'model.started' | 'model.output.delta' | 'model.completed' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'tool.retrying' | 'tool.execution_unknown' | 'artifact.created' | 'elicitation.requested' | 'elicitation.resolved' | 'approval.requested' | 'approval.resolved' | 'run.completed' | 'run.failed' | 'run.cancelled' | 'workflow.run.started' | 'workflow.run.recovered' | 'workflow.step.started' | 'workflow.step.completed' | 'workflow.step.failed' | 'workflow.compensation.started' | 'workflow.compensation.completed' | 'workflow.compensation.failed' | 'workflow.wait.started' | 'workflow.wait.completed' | 'workflow.run.paused' | 'workflow.run.resumed' | 'workflow.run.completed' | 'workflow.run.failed' | 'workflow.run.cancelled' | 'team.run.started' | 'team.run.recovered' | 'team.agent.assigned' | 'team.handoff.created' | 'team.task.completed' | 'team.task.failed' | 'team.merge.started' | 'team.merge.completed' | 'team.merge.failed' | 'team.run.paused' | 'team.run.resumed' | 'team.run.completed' | 'team.run.failed' | 'team.run.cancelled';
|
|
261
|
+
type AgentEventType = 'run.started' | 'run.recovered' | 'run.paused' | 'run.resumed' | 'model.started' | 'model.output.delta' | 'model.completed' | 'context.compacted' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'tool.retrying' | 'tool.execution_unknown' | 'artifact.created' | 'elicitation.requested' | 'elicitation.resolved' | 'approval.requested' | 'approval.resolved' | 'run.completed' | 'run.failed' | 'run.cancelled' | 'workflow.run.started' | 'workflow.run.recovered' | 'workflow.step.started' | 'workflow.step.completed' | 'workflow.step.failed' | 'workflow.compensation.started' | 'workflow.compensation.completed' | 'workflow.compensation.failed' | 'workflow.wait.started' | 'workflow.wait.completed' | 'workflow.run.paused' | 'workflow.run.resumed' | 'workflow.run.completed' | 'workflow.run.failed' | 'workflow.run.cancelled' | 'team.run.started' | 'team.run.recovered' | 'team.agent.assigned' | 'team.handoff.created' | 'team.task.completed' | 'team.task.failed' | 'team.merge.started' | 'team.merge.completed' | 'team.merge.failed' | 'team.run.paused' | 'team.run.resumed' | 'team.run.completed' | 'team.run.failed' | 'team.run.cancelled';
|
|
262
262
|
interface AgentEventPayloads {
|
|
263
263
|
'run.started': undefined;
|
|
264
264
|
'run.recovered': {
|
|
@@ -292,6 +292,20 @@ interface AgentEventPayloads {
|
|
|
292
292
|
teamDelegationId?: string;
|
|
293
293
|
teamAgentName?: string;
|
|
294
294
|
};
|
|
295
|
+
'context.compacted': {
|
|
296
|
+
step: number;
|
|
297
|
+
removedMessages: number;
|
|
298
|
+
estimatedTokens: number;
|
|
299
|
+
compactedTokens: number;
|
|
300
|
+
targetTokens: number;
|
|
301
|
+
contextWindow: number;
|
|
302
|
+
summary: string;
|
|
303
|
+
summaryTruncated?: boolean;
|
|
304
|
+
workflowStepId?: string;
|
|
305
|
+
workflowAgentName?: string;
|
|
306
|
+
teamDelegationId?: string;
|
|
307
|
+
teamAgentName?: string;
|
|
308
|
+
};
|
|
295
309
|
'tool.started': {
|
|
296
310
|
step: number;
|
|
297
311
|
toolCallId: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as WorkflowStep, c as defineWorkflow, i as WorkflowEventResult, n as WorkflowDefinition, o as WorkflowStepContext, r as WorkflowEventDefinition, s as WorkflowStepOptions, t as WorkflowAgentResult } from "../index-
|
|
1
|
+
import { a as WorkflowStep, c as defineWorkflow, i as WorkflowEventResult, n as WorkflowDefinition, o as WorkflowStepContext, r as WorkflowEventDefinition, s as WorkflowStepOptions, t as WorkflowAgentResult } from "../index-RKE3-CKs.mjs";
|
|
2
2
|
export { WorkflowAgentResult, WorkflowDefinition, WorkflowEventDefinition, WorkflowEventResult, WorkflowStep, WorkflowStepContext, WorkflowStepOptions, defineWorkflow };
|
package/package.json
CHANGED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-B8laW1hM.mjs";
|
|
2
|
-
import { L as SessionId } from "./index-CzAi2Y_Z.mjs";
|
|
3
|
-
//#region src/knowledge/knowledge.d.ts
|
|
4
|
-
/** Runtime context supplied to knowledge providers and memory stores. */
|
|
5
|
-
interface KnowledgeContext {
|
|
6
|
-
agentName: string;
|
|
7
|
-
input: string;
|
|
8
|
-
sessionId: SessionId;
|
|
9
|
-
context?: ExecutionContext;
|
|
10
|
-
signal?: AbortSignal;
|
|
11
|
-
}
|
|
12
|
-
interface ContextBlock {
|
|
13
|
-
id: string;
|
|
14
|
-
content: string;
|
|
15
|
-
metadata?: JsonObject;
|
|
16
|
-
}
|
|
17
|
-
interface ContextProvider {
|
|
18
|
-
name: string;
|
|
19
|
-
read(context: KnowledgeContext): Promise<ContextBlock[]>;
|
|
20
|
-
}
|
|
21
|
-
interface MemoryQuery {
|
|
22
|
-
query: string;
|
|
23
|
-
limit?: number;
|
|
24
|
-
agentName?: string;
|
|
25
|
-
sessionId?: SessionId;
|
|
26
|
-
namespace?: string;
|
|
27
|
-
actor?: ExecutionContext['actor'];
|
|
28
|
-
}
|
|
29
|
-
interface MemoryWrite {
|
|
30
|
-
content: string;
|
|
31
|
-
agentName?: string;
|
|
32
|
-
sessionId?: SessionId;
|
|
33
|
-
namespace?: string;
|
|
34
|
-
actor?: ExecutionContext['actor'];
|
|
35
|
-
metadata?: JsonObject;
|
|
36
|
-
}
|
|
37
|
-
interface MemoryRecord extends MemoryWrite {
|
|
38
|
-
id: string;
|
|
39
|
-
createdAt: string;
|
|
40
|
-
}
|
|
41
|
-
interface MemoryStore {
|
|
42
|
-
search(query: MemoryQuery, context: KnowledgeContext): Promise<MemoryRecord[]>;
|
|
43
|
-
write(record: MemoryWrite, context: KnowledgeContext): Promise<MemoryRecord>;
|
|
44
|
-
}
|
|
45
|
-
interface SkillDefinition {
|
|
46
|
-
name: string;
|
|
47
|
-
instructions: string;
|
|
48
|
-
resources?: Array<string | JsonValue | {
|
|
49
|
-
id?: string;
|
|
50
|
-
content: string | JsonValue;
|
|
51
|
-
metadata?: JsonObject;
|
|
52
|
-
}>;
|
|
53
|
-
}
|
|
54
|
-
declare function defineContextProvider<T extends ContextProvider>(provider: T): T;
|
|
55
|
-
declare function defineSkill(skill: SkillDefinition): ContextProvider;
|
|
56
|
-
declare function createMemoryContextProvider(options: {
|
|
57
|
-
name?: string;
|
|
58
|
-
store: MemoryStore;
|
|
59
|
-
limit?: number;
|
|
60
|
-
}): ContextProvider;
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/knowledge/in-memory-memory-store.d.ts
|
|
63
|
-
/** Volatile keyword-search memory store for tests and local development. */
|
|
64
|
-
declare class InMemoryMemoryStore implements MemoryStore {
|
|
65
|
-
#private;
|
|
66
|
-
search(query: MemoryQuery, context: KnowledgeContext): Promise<MemoryRecord[]>;
|
|
67
|
-
write(record: MemoryWrite, context: KnowledgeContext): Promise<MemoryRecord>;
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
export { MemoryQuery as a, MemoryWrite as c, defineContextProvider as d, defineSkill as f, KnowledgeContext as i, SkillDefinition as l, ContextBlock as n, MemoryRecord as o, ContextProvider as r, MemoryStore as s, InMemoryMemoryStore as t, createMemoryContextProvider as u };
|