@alexkroman1/aai 0.12.1 → 0.12.3
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/{direct-executor-ZUU0Ke4j.js → direct-executor-DRRrZUp0.js} +17 -4
- package/dist/host/_run-code.d.ts +3 -1
- package/dist/host/_test-utils.d.ts +2 -2
- package/dist/host/builtin-tools.d.ts +2 -0
- package/dist/host/direct-executor.d.ts +2 -0
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.js +3 -3
- package/dist/host/matchers.js +1 -1
- package/dist/host/server.js +1 -1
- package/dist/host/session.d.ts +1 -0
- package/dist/host/testing.js +1 -1
- package/dist/isolate/_internal-types.d.ts +1 -1
- package/dist/isolate/index.js +1 -1
- package/dist/isolate/system-prompt.d.ts +1 -0
- package/dist/{system-prompt-CVJSQJiA.js → system-prompt-DYAYFW99.js} +2 -1
- package/dist/{testing-Bb2B5Uob.js → testing-BreLdpq-.js} +2 -2
- package/package.json +7 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as agentToolsToSchemas, o as toAgentConfig, r as EMPTY_PARAMS, t as buildSystemPrompt } from "./system-prompt-
|
|
1
|
+
import { a as agentToolsToSchemas, o as toAgentConfig, r as EMPTY_PARAMS, t as buildSystemPrompt } from "./system-prompt-DYAYFW99.js";
|
|
2
2
|
import { errorDetail, errorMessage, toolError } from "./isolate/_utils.js";
|
|
3
3
|
import { C as MAX_VALUE_SIZE, S as MAX_TOOL_RESULT_CHARS, T as TOOL_EXECUTION_TIMEOUT_MS, _ as FETCH_TIMEOUT_MS, b as MAX_HTML_BYTES, g as DEFAULT_TTS_SAMPLE_RATE, h as DEFAULT_STT_SAMPLE_RATE, l as buildReadyConfig, m as DEFAULT_SHUTDOWN_TIMEOUT_MS, r as ClientMessageSchema, v as HOOK_TIMEOUT_MS, w as RUN_CODE_TIMEOUT_MS, x as MAX_PAGE_CHARS, y as MAX_GLOB_PATTERN_LENGTH } from "./protocol-rcOrz7T3.js";
|
|
4
4
|
import { callResolveTurnConfig, createAgentHooks } from "./isolate/hooks.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
+
import vm from "node:vm";
|
|
6
7
|
import pTimeout from "p-timeout";
|
|
7
8
|
import { createStorage, prefixStorage } from "unstorage";
|
|
8
|
-
import vm from "node:vm";
|
|
9
9
|
import { createNanoEvents } from "nanoevents";
|
|
10
10
|
import WsWebSocket from "ws";
|
|
11
11
|
//#region host/_run-code.ts
|
|
@@ -29,6 +29,7 @@ const runCodeParams = z.object({ code: z.string().describe("JavaScript code to e
|
|
|
29
29
|
*/
|
|
30
30
|
function createRunCode() {
|
|
31
31
|
return {
|
|
32
|
+
guidance: "You MUST use the run_code tool for ANY question involving math, counting, calculations, data processing, or code. NEVER do mental math or recite code verbally. run_code executes JavaScript (not Python). Always write JavaScript.",
|
|
32
33
|
description: "Execute JavaScript code in a sandbox and return the output. Use this for calculations, data transformations, string manipulation, or any task that benefits from running code. Output is captured from console.log(). No network or filesystem access.",
|
|
33
34
|
parameters: runCodeParams,
|
|
34
35
|
async execute(args) {
|
|
@@ -103,6 +104,7 @@ const BraveSearchResponseSchema = z.object({ web: z.object({ results: z.array(z.
|
|
|
103
104
|
})) }).optional() });
|
|
104
105
|
function createWebSearch(fetchFn = globalThis.fetch) {
|
|
105
106
|
return {
|
|
107
|
+
guidance: "Use web_search for factual questions, current events, or anything you are unsure about. Search first rather than guessing.",
|
|
106
108
|
description: "Search the web for current information, facts, news, or answers to questions. Returns a list of results with title, URL, and description. Use this when the user asks about something you don't know, need up-to-date information, or want to verify facts.",
|
|
107
109
|
parameters: webSearchParams,
|
|
108
110
|
async execute(args, ctx) {
|
|
@@ -132,6 +134,7 @@ function createWebSearch(fetchFn = globalThis.fetch) {
|
|
|
132
134
|
const visitWebpageParams = z.object({ url: z.string().describe("The full URL to fetch (e.g., 'https://example.com/page')") });
|
|
133
135
|
function createVisitWebpage(fetchFn = globalThis.fetch) {
|
|
134
136
|
return {
|
|
137
|
+
guidance: "Use visit_webpage to read the full content of a URL when search snippets are not detailed enough.",
|
|
135
138
|
description: "Fetch a webpage and return its content as clean text. Use this to read the full content of a URL found via web_search, or any link the user shares. Good for reading articles, documentation, blog posts, or product pages.",
|
|
136
139
|
parameters: visitWebpageParams,
|
|
137
140
|
async execute(args, _ctx) {
|
|
@@ -187,6 +190,7 @@ function sanitizeHeaders(raw) {
|
|
|
187
190
|
}
|
|
188
191
|
function createFetchJson(fetchFn = globalThis.fetch) {
|
|
189
192
|
return {
|
|
193
|
+
guidance: "Use fetch_json to call REST APIs and retrieve structured JSON data.",
|
|
190
194
|
description: "Call a REST API endpoint via HTTP GET and return the JSON response. Use this to fetch structured data from APIs — for example, weather data, stock prices, exchange rates, or any public JSON API. Supports custom headers for authenticated APIs.",
|
|
191
195
|
parameters: fetchJsonParams,
|
|
192
196
|
async execute(args, _ctx) {
|
|
@@ -230,6 +234,10 @@ function getBuiltinToolDefs(names, opts) {
|
|
|
230
234
|
for (const name of names) for (const [k, v] of resolveBuiltin(name, opts)) defs[k] = v;
|
|
231
235
|
return defs;
|
|
232
236
|
}
|
|
237
|
+
/** Returns system prompt guidance strings for the specified builtin tools. */
|
|
238
|
+
function getBuiltinToolGuidance(names) {
|
|
239
|
+
return names.flatMap((name) => resolveBuiltin(name).map(([, def]) => def.guidance).filter((g) => Boolean(g)));
|
|
240
|
+
}
|
|
233
241
|
/** Returns JSON tool schemas for the specified builtin tools. */
|
|
234
242
|
function getBuiltinToolSchemas(names) {
|
|
235
243
|
return names.flatMap((name) => resolveBuiltin(name).map(([toolName, def]) => ({
|
|
@@ -822,7 +830,8 @@ function createS2sSession(opts) {
|
|
|
822
830
|
} : opts.agentConfig;
|
|
823
831
|
const systemPrompt = buildSystemPrompt(agentConfig, {
|
|
824
832
|
hasTools: toolSchemas.length > 0 || (agentConfig.builtinTools?.length ?? 0) > 0,
|
|
825
|
-
voice: true
|
|
833
|
+
voice: true,
|
|
834
|
+
toolGuidance: opts.toolGuidance
|
|
826
835
|
});
|
|
827
836
|
const s2sTools = toolSchemas.map((ts) => ({
|
|
828
837
|
type: "function",
|
|
@@ -1278,10 +1287,12 @@ function createRuntime(opts) {
|
|
|
1278
1287
|
let executeTool;
|
|
1279
1288
|
let hooks;
|
|
1280
1289
|
let toolSchemas;
|
|
1290
|
+
let toolGuidance = [];
|
|
1281
1291
|
if (opts.executeTool && opts.hooks && opts.toolSchemas) {
|
|
1282
1292
|
executeTool = opts.executeTool;
|
|
1283
1293
|
hooks = opts.hooks;
|
|
1284
1294
|
toolSchemas = opts.toolSchemas;
|
|
1295
|
+
toolGuidance = opts.toolGuidance ?? [];
|
|
1285
1296
|
} else {
|
|
1286
1297
|
const allTools = {
|
|
1287
1298
|
...getBuiltinToolDefs(agent.builtinTools ?? []),
|
|
@@ -1290,6 +1301,7 @@ function createRuntime(opts) {
|
|
|
1290
1301
|
const customSchemas = agentToolsToSchemas(agent.tools ?? {});
|
|
1291
1302
|
const builtinSchemas = getBuiltinToolSchemas(agent.builtinTools ?? []);
|
|
1292
1303
|
toolSchemas = [...customSchemas, ...builtinSchemas];
|
|
1304
|
+
toolGuidance = getBuiltinToolGuidance(agent.builtinTools ?? []);
|
|
1293
1305
|
const stateMap = /* @__PURE__ */ new Map();
|
|
1294
1306
|
const getState = (sid) => {
|
|
1295
1307
|
if (!stateMap.has(sid) && agent.state) stateMap.set(sid, agent.state());
|
|
@@ -1337,6 +1349,7 @@ function createRuntime(opts) {
|
|
|
1337
1349
|
client: sessionOpts.client,
|
|
1338
1350
|
agentConfig,
|
|
1339
1351
|
toolSchemas,
|
|
1352
|
+
toolGuidance,
|
|
1340
1353
|
apiKey,
|
|
1341
1354
|
s2sConfig,
|
|
1342
1355
|
executeTool,
|
|
@@ -1397,4 +1410,4 @@ function createRuntime(opts) {
|
|
|
1397
1410
|
};
|
|
1398
1411
|
}
|
|
1399
1412
|
//#endregion
|
|
1400
|
-
export { _internals as a, connectS2s as c, consoleLogger as d, jsonLogger as f, createUnstorageKv as i, defaultCreateS2sWebSocket as l, executeToolCall as n, buildCtx as o, wireSessionSocket as r, createS2sSession as s, createRuntime as t, DEFAULT_S2S_CONFIG as u };
|
|
1413
|
+
export { _internals as a, connectS2s as c, consoleLogger as d, jsonLogger as f, executeInIsolate as g, getBuiltinToolSchemas as h, createUnstorageKv as i, defaultCreateS2sWebSocket as l, getBuiltinToolGuidance as m, executeToolCall as n, buildCtx as o, getBuiltinToolDefs as p, wireSessionSocket as r, createS2sSession as s, createRuntime as t, DEFAULT_S2S_CONFIG as u };
|
package/dist/host/_run-code.d.ts
CHANGED
|
@@ -20,7 +20,9 @@ declare const runCodeParams: z.ZodObject<{
|
|
|
20
20
|
* The context is discarded after execution, so no state leaks between
|
|
21
21
|
* invocations or across sessions.
|
|
22
22
|
*/
|
|
23
|
-
export declare function createRunCode(): ToolDef<typeof runCodeParams
|
|
23
|
+
export declare function createRunCode(): ToolDef<typeof runCodeParams> & {
|
|
24
|
+
guidance: string;
|
|
25
|
+
};
|
|
24
26
|
/**
|
|
25
27
|
* Execute user code in a fresh `node:vm` context.
|
|
26
28
|
*
|
|
@@ -30,12 +30,12 @@ export declare const silentLogger: {
|
|
|
30
30
|
debug: (...args: unknown[]) => void;
|
|
31
31
|
};
|
|
32
32
|
export declare function makeSessionOpts(overrides?: Partial<S2sSessionOptions>): S2sSessionOptions;
|
|
33
|
-
/** Load a JSON fixture from
|
|
33
|
+
/** Load a JSON fixture from fixtures/. */
|
|
34
34
|
export declare function loadFixture<T = Record<string, unknown>[]>(name: string): T;
|
|
35
35
|
/**
|
|
36
36
|
* Replay recorded S2S API messages through a MockS2sHandle.
|
|
37
37
|
*
|
|
38
|
-
* Converts raw wire-format JSON (from
|
|
38
|
+
* Converts raw wire-format JSON (from fixtures/) into typed `_fire()` calls.
|
|
39
39
|
* This is the inverse of `dispatchS2sMessage` in s2s.ts — it translates
|
|
40
40
|
* snake_case API fields to camelCase event payloads.
|
|
41
41
|
*
|
|
@@ -20,5 +20,7 @@ type ToolDefRecord = Record<string, ToolDef<z.ZodObject<z.ZodRawShape>>>;
|
|
|
20
20
|
* For runtime use.
|
|
21
21
|
*/
|
|
22
22
|
export declare function getBuiltinToolDefs(names: readonly string[], opts?: BuiltinToolOptions): ToolDefRecord;
|
|
23
|
+
/** Returns system prompt guidance strings for the specified builtin tools. */
|
|
24
|
+
export declare function getBuiltinToolGuidance(names: readonly string[]): string[];
|
|
23
25
|
/** Returns JSON tool schemas for the specified builtin tools. */
|
|
24
26
|
export declare function getBuiltinToolSchemas(names: readonly string[]): ToolSchema[];
|
|
@@ -87,6 +87,8 @@ export type RuntimeOptions = {
|
|
|
87
87
|
* is provided (the host doesn't have the tool definitions to derive schemas).
|
|
88
88
|
*/
|
|
89
89
|
toolSchemas?: ToolSchema[] | undefined;
|
|
90
|
+
/** System prompt guidance for builtin tools. Passed through in sandbox mode. */
|
|
91
|
+
toolGuidance?: string[] | undefined;
|
|
90
92
|
};
|
|
91
93
|
/**
|
|
92
94
|
* The agent runtime returned by {@link createRuntime}.
|
package/dist/host/index.d.ts
CHANGED
package/dist/host/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BuiltinToolSchema, DEFAULT_GREETING, DEFAULT_INSTRUCTIONS, ToolChoiceSchema, defineAgent, defineTool, defineToolFactory } from "../isolate/types.js";
|
|
2
|
-
import { a as agentToolsToSchemas, i as ToolSchemaSchema, n as AgentConfigSchema, o as toAgentConfig, r as EMPTY_PARAMS, t as buildSystemPrompt } from "../system-prompt-
|
|
2
|
+
import { a as agentToolsToSchemas, i as ToolSchemaSchema, n as AgentConfigSchema, o as toAgentConfig, r as EMPTY_PARAMS, t as buildSystemPrompt } from "../system-prompt-DYAYFW99.js";
|
|
3
3
|
import { errorDetail, errorMessage, toolError } from "../isolate/_utils.js";
|
|
4
4
|
import { C as MAX_VALUE_SIZE, S as MAX_TOOL_RESULT_CHARS, T as TOOL_EXECUTION_TIMEOUT_MS, _ as FETCH_TIMEOUT_MS, a as ReadyConfigSchema, b as MAX_HTML_BYTES, c as TurnConfigSchema, d as DEFAULT_IDLE_TIMEOUT_MS, f as DEFAULT_MAX_HISTORY, g as DEFAULT_TTS_SAMPLE_RATE, h as DEFAULT_STT_SAMPLE_RATE, i as KvRequestSchema, l as buildReadyConfig, m as DEFAULT_SHUTDOWN_TIMEOUT_MS, n as ClientEventSchema, o as ServerMessageSchema, p as DEFAULT_SESSION_START_TIMEOUT_MS, r as ClientMessageSchema, s as SessionErrorCodeSchema, t as AUDIO_FORMAT, u as AGENT_CSP, v as HOOK_TIMEOUT_MS, w as RUN_CODE_TIMEOUT_MS, x as MAX_PAGE_CHARS, y as MAX_GLOB_PATTERN_LENGTH } from "../protocol-rcOrz7T3.js";
|
|
5
5
|
import { callResolveTurnConfig, createAgentHooks } from "../isolate/hooks.js";
|
|
6
6
|
import "../isolate/index.js";
|
|
7
|
-
import { a as _internals, c as connectS2s, d as consoleLogger, f as jsonLogger, i as createUnstorageKv, l as defaultCreateS2sWebSocket, n as executeToolCall, o as buildCtx, r as wireSessionSocket, s as createS2sSession, t as createRuntime, u as DEFAULT_S2S_CONFIG } from "../direct-executor-
|
|
7
|
+
import { a as _internals, c as connectS2s, d as consoleLogger, f as jsonLogger, g as executeInIsolate, h as getBuiltinToolSchemas, i as createUnstorageKv, l as defaultCreateS2sWebSocket, m as getBuiltinToolGuidance, n as executeToolCall, o as buildCtx, p as getBuiltinToolDefs, r as wireSessionSocket, s as createS2sSession, t as createRuntime, u as DEFAULT_S2S_CONFIG } from "../direct-executor-DRRrZUp0.js";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { describe, expect, test } from "vitest";
|
|
10
10
|
//#region host/_runtime-conformance.ts
|
|
@@ -162,4 +162,4 @@ function testRuntime(label, getContext) {
|
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
//#endregion
|
|
165
|
-
export { AGENT_CSP, AUDIO_FORMAT, AgentConfigSchema, BuiltinToolSchema, CONFORMANCE_AGENT, ClientEventSchema, ClientMessageSchema, DEFAULT_GREETING, DEFAULT_IDLE_TIMEOUT_MS, DEFAULT_INSTRUCTIONS, DEFAULT_MAX_HISTORY, DEFAULT_S2S_CONFIG, DEFAULT_SESSION_START_TIMEOUT_MS, DEFAULT_SHUTDOWN_TIMEOUT_MS, DEFAULT_STT_SAMPLE_RATE, DEFAULT_TTS_SAMPLE_RATE, EMPTY_PARAMS, FETCH_TIMEOUT_MS, HOOK_TIMEOUT_MS, KvRequestSchema, MAX_GLOB_PATTERN_LENGTH, MAX_HTML_BYTES, MAX_PAGE_CHARS, MAX_TOOL_RESULT_CHARS, MAX_VALUE_SIZE, RUN_CODE_TIMEOUT_MS, ReadyConfigSchema, ServerMessageSchema, SessionErrorCodeSchema, TOOL_EXECUTION_TIMEOUT_MS, ToolChoiceSchema, ToolSchemaSchema, TurnConfigSchema, _internals, agentToolsToSchemas, buildCtx, buildReadyConfig, buildSystemPrompt, callResolveTurnConfig, connectS2s, consoleLogger, createAgentHooks, createRuntime, createS2sSession, createUnstorageKv, defaultCreateS2sWebSocket, defineAgent, defineTool, defineTool as tool, defineToolFactory, errorDetail, errorMessage, executeToolCall, jsonLogger, testRuntime, toAgentConfig, toolError, wireSessionSocket };
|
|
165
|
+
export { AGENT_CSP, AUDIO_FORMAT, AgentConfigSchema, BuiltinToolSchema, CONFORMANCE_AGENT, ClientEventSchema, ClientMessageSchema, DEFAULT_GREETING, DEFAULT_IDLE_TIMEOUT_MS, DEFAULT_INSTRUCTIONS, DEFAULT_MAX_HISTORY, DEFAULT_S2S_CONFIG, DEFAULT_SESSION_START_TIMEOUT_MS, DEFAULT_SHUTDOWN_TIMEOUT_MS, DEFAULT_STT_SAMPLE_RATE, DEFAULT_TTS_SAMPLE_RATE, EMPTY_PARAMS, FETCH_TIMEOUT_MS, HOOK_TIMEOUT_MS, KvRequestSchema, MAX_GLOB_PATTERN_LENGTH, MAX_HTML_BYTES, MAX_PAGE_CHARS, MAX_TOOL_RESULT_CHARS, MAX_VALUE_SIZE, RUN_CODE_TIMEOUT_MS, ReadyConfigSchema, ServerMessageSchema, SessionErrorCodeSchema, TOOL_EXECUTION_TIMEOUT_MS, ToolChoiceSchema, ToolSchemaSchema, TurnConfigSchema, _internals, agentToolsToSchemas, buildCtx, buildReadyConfig, buildSystemPrompt, callResolveTurnConfig, connectS2s, consoleLogger, createAgentHooks, createRuntime, createS2sSession, createUnstorageKv, defaultCreateS2sWebSocket, defineAgent, defineTool, defineTool as tool, defineToolFactory, errorDetail, errorMessage, executeInIsolate, executeToolCall, getBuiltinToolDefs, getBuiltinToolGuidance, getBuiltinToolSchemas, jsonLogger, testRuntime, toAgentConfig, toolError, wireSessionSocket };
|
package/dist/host/matchers.js
CHANGED
package/dist/host/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as AGENT_CSP } from "../protocol-rcOrz7T3.js";
|
|
2
|
-
import { d as consoleLogger, t as createRuntime } from "../direct-executor-
|
|
2
|
+
import { d as consoleLogger, t as createRuntime } from "../direct-executor-DRRrZUp0.js";
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import http from "node:http";
|
package/dist/host/session.d.ts
CHANGED
package/dist/host/testing.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as makeStubSession, i as flush, n as TurnResult, o as MockWebSocket, r as createTestHarness, s as installMockWebSocket, t as TestHarness } from "../testing-
|
|
1
|
+
import { a as makeStubSession, i as flush, n as TurnResult, o as MockWebSocket, r as createTestHarness, s as installMockWebSocket, t as TestHarness } from "../testing-BreLdpq-.js";
|
|
2
2
|
export { MockWebSocket, TestHarness, TurnResult, createTestHarness, flush, installMockWebSocket, makeStubSession };
|
|
@@ -11,7 +11,7 @@ import { type ToolDef } from "./types.ts";
|
|
|
11
11
|
* Function signature for executing a tool by name.
|
|
12
12
|
*
|
|
13
13
|
* Used by session.ts to invoke tools, by direct-executor.ts and
|
|
14
|
-
*
|
|
14
|
+
* harness-runtime.ts to implement the execution.
|
|
15
15
|
*/
|
|
16
16
|
export type ExecuteTool = (name: string, args: Readonly<Record<string, unknown>>, sessionId?: string, messages?: readonly Message[]) => Promise<string>;
|
|
17
17
|
/**
|
package/dist/isolate/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuiltinToolSchema, DEFAULT_GREETING, DEFAULT_INSTRUCTIONS, ToolChoiceSchema, defineAgent, defineTool, defineToolFactory } from "./types.js";
|
|
2
|
-
import { a as agentToolsToSchemas, i as ToolSchemaSchema, n as AgentConfigSchema, o as toAgentConfig, r as EMPTY_PARAMS, t as buildSystemPrompt } from "../system-prompt-
|
|
2
|
+
import { a as agentToolsToSchemas, i as ToolSchemaSchema, n as AgentConfigSchema, o as toAgentConfig, r as EMPTY_PARAMS, t as buildSystemPrompt } from "../system-prompt-DYAYFW99.js";
|
|
3
3
|
import { errorDetail, errorMessage, toolError } from "./_utils.js";
|
|
4
4
|
import { C as MAX_VALUE_SIZE, S as MAX_TOOL_RESULT_CHARS, T as TOOL_EXECUTION_TIMEOUT_MS, _ as FETCH_TIMEOUT_MS, a as ReadyConfigSchema, b as MAX_HTML_BYTES, c as TurnConfigSchema, d as DEFAULT_IDLE_TIMEOUT_MS, f as DEFAULT_MAX_HISTORY, g as DEFAULT_TTS_SAMPLE_RATE, h as DEFAULT_STT_SAMPLE_RATE, i as KvRequestSchema, l as buildReadyConfig, m as DEFAULT_SHUTDOWN_TIMEOUT_MS, n as ClientEventSchema, o as ServerMessageSchema, p as DEFAULT_SESSION_START_TIMEOUT_MS, r as ClientMessageSchema, s as SessionErrorCodeSchema, t as AUDIO_FORMAT, u as AGENT_CSP, v as HOOK_TIMEOUT_MS, w as RUN_CODE_TIMEOUT_MS, x as MAX_PAGE_CHARS, y as MAX_GLOB_PATTERN_LENGTH } from "../protocol-rcOrz7T3.js";
|
|
5
5
|
import { callResolveTurnConfig, createAgentHooks } from "./hooks.js";
|
|
@@ -85,7 +85,8 @@ function buildSystemPrompt(config, opts) {
|
|
|
85
85
|
const { hasTools } = opts;
|
|
86
86
|
const agentInstructions = config.instructions && config.instructions !== DEFAULT_INSTRUCTIONS ? `\n\nAgent-Specific Instructions:\n${config.instructions}` : "";
|
|
87
87
|
const toolPreamble = hasTools ? "\n\nWhen you decide to use a tool, ALWAYS say a brief natural phrase BEFORE the tool call (e.g. \"Let me look that up\" or \"One moment while I check\"). This fills silence while the tool executes. Keep preambles to one short sentence." : "";
|
|
88
|
-
|
|
88
|
+
const guidance = opts.toolGuidance && opts.toolGuidance.length > 0 ? `\n\nBuilt-in Tool Usage:\n${opts.toolGuidance.join("\n")}` : "";
|
|
89
|
+
return DEFAULT_INSTRUCTIONS + `\n\nToday's date is ${getFormattedDate()}.` + agentInstructions + toolPreamble + guidance + (opts.voice ? VOICE_RULES : "");
|
|
89
90
|
}
|
|
90
91
|
//#endregion
|
|
91
92
|
export { agentToolsToSchemas as a, ToolSchemaSchema as i, AgentConfigSchema as n, toAgentConfig as o, EMPTY_PARAMS as r, buildSystemPrompt as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./isolate/types.js";
|
|
2
|
-
import { i as createUnstorageKv, t as createRuntime } from "./direct-executor-
|
|
2
|
+
import { i as createUnstorageKv, t as createRuntime } from "./direct-executor-DRRrZUp0.js";
|
|
3
3
|
import { vi } from "vitest";
|
|
4
4
|
import { createStorage } from "unstorage";
|
|
5
5
|
import "nanoevents";
|
|
@@ -177,7 +177,7 @@ function makeStubSession(overrides) {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
vi.fn(), vi.fn(), vi.fn(), vi.fn();
|
|
180
|
-
resolve(import.meta.dirname, "
|
|
180
|
+
resolve(import.meta.dirname, "fixtures");
|
|
181
181
|
//#endregion
|
|
182
182
|
//#region host/testing.ts
|
|
183
183
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexkroman1/aai",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"zod": "^4.3.6"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"vitest": "^4.1.
|
|
79
|
+
"vitest": "^4.1.2"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"vitest": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@types/json-schema": "^7.0.15",
|
|
88
88
|
"@types/node": "^25.5.0",
|
|
89
89
|
"@types/ws": "^8.18.1",
|
|
90
|
-
"tsdown": "^0.21.
|
|
90
|
+
"tsdown": "^0.21.7",
|
|
91
91
|
"vite": "^8.0.3"
|
|
92
92
|
},
|
|
93
93
|
"engines": {
|
|
@@ -99,6 +99,10 @@
|
|
|
99
99
|
"directory": "packages/aai"
|
|
100
100
|
},
|
|
101
101
|
"scripts": {
|
|
102
|
+
"test": "vitest run",
|
|
103
|
+
"test:coverage": "vitest run --coverage",
|
|
104
|
+
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
105
|
+
"check:integration": "pnpm run test:integration",
|
|
102
106
|
"build": "tsdown && tsc -p tsconfig.build.json",
|
|
103
107
|
"typecheck": "tsc --noEmit && tsc -p isolate/tsconfig.json",
|
|
104
108
|
"lint": "biome check .",
|