@warlock.js/ai-tools 4.8.2 → 4.9.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/cjs/index.cjs +15 -15
- package/cjs/index.cjs.map +1 -1
- package/esm/contracts/http.type.d.mts +1 -1
- package/esm/contracts/http.type.d.mts.map +1 -1
- package/esm/contracts/mcp.type.d.mts +1 -1
- package/esm/contracts/mcp.type.d.mts.map +1 -1
- package/esm/contracts/utility.type.d.mts +1 -1
- package/esm/contracts/utility.type.d.mts.map +1 -1
- package/esm/contracts/web.type.d.mts +1 -1
- package/esm/contracts/web.type.d.mts.map +1 -1
- package/esm/errors.d.mts +1 -1
- package/esm/errors.d.mts.map +1 -1
- package/esm/errors.mjs +1 -1
- package/esm/errors.mjs.map +1 -1
- package/esm/http/http-request.d.mts +1 -1
- package/esm/http/http-request.d.mts.map +1 -1
- package/esm/http/http-request.mjs +1 -1
- package/esm/http/http-request.mjs.map +1 -1
- package/esm/mcp/client.mjs +1 -1
- package/esm/mcp/client.mjs.map +1 -1
- package/esm/mcp/index.d.mts +1 -1
- package/esm/mcp/index.d.mts.map +1 -1
- package/esm/mcp/index.mjs +1 -1
- package/esm/mcp/index.mjs.map +1 -1
- package/esm/mcp/json-schema-to-standard.d.mts +1 -1
- package/esm/mcp/json-schema-to-standard.d.mts.map +1 -1
- package/esm/mcp/json-schema-to-standard.mjs +1 -1
- package/esm/mcp/json-schema-to-standard.mjs.map +1 -1
- package/esm/mcp/serve.d.mts +1 -1
- package/esm/mcp/serve.d.mts.map +1 -1
- package/esm/mcp/serve.mjs +1 -1
- package/esm/mcp/serve.mjs.map +1 -1
- package/esm/mcp/transport.d.mts +1 -1
- package/esm/mcp/transport.d.mts.map +1 -1
- package/esm/mcp/transport.mjs +1 -1
- package/esm/mcp/transport.mjs.map +1 -1
- package/esm/mcp/transport.type.d.mts +1 -1
- package/esm/mcp/transport.type.d.mts.map +1 -1
- package/esm/node_modules/@standard-schema/spec/dist/index.d.mts +1 -1
- package/esm/node_modules/@standard-schema/spec/dist/index.d.mts.map +1 -1
- package/esm/register.d.mts +1 -1
- package/esm/register.d.mts.map +1 -1
- package/esm/register.mjs +1 -1
- package/esm/register.mjs.map +1 -1
- package/esm/schema.mjs +1 -1
- package/esm/schema.mjs.map +1 -1
- package/esm/utility/calculator.d.mts +1 -1
- package/esm/utility/calculator.d.mts.map +1 -1
- package/esm/utility/calculator.mjs +1 -1
- package/esm/utility/calculator.mjs.map +1 -1
- package/esm/utility/date-time.d.mts +1 -1
- package/esm/utility/date-time.d.mts.map +1 -1
- package/esm/utility/date-time.mjs +1 -1
- package/esm/utility/date-time.mjs.map +1 -1
- package/esm/utility/schema.mjs +1 -1
- package/esm/utility/schema.mjs.map +1 -1
- package/esm/web/fetch-url.d.mts +1 -1
- package/esm/web/fetch-url.d.mts.map +1 -1
- package/esm/web/fetch-url.mjs +1 -1
- package/esm/web/fetch-url.mjs.map +1 -1
- package/esm/web/schema.mjs +1 -1
- package/esm/web/schema.mjs.map +1 -1
- package/esm/web/web-search.d.mts +1 -1
- package/esm/web/web-search.d.mts.map +1 -1
- package/esm/web/web-search.mjs +1 -1
- package/esm/web/web-search.mjs.map +1 -1
- package/package.json +2 -2
package/cjs/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ let _warlock_js_ai = require("@warlock.js/ai");
|
|
|
3
3
|
let node_child_process = require("node:child_process");
|
|
4
4
|
let node_readline = require("node:readline");
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../ai-tools/src/errors.ts
|
|
7
7
|
/**
|
|
8
8
|
* The `calculator` tool could not evaluate an expression — it was not
|
|
9
9
|
* valid arithmetic, divided by zero, or overflowed to a non-finite
|
|
@@ -135,7 +135,7 @@ var HttpPolicyError = class extends _warlock_js_ai.AIError {
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
//#endregion
|
|
138
|
-
//#region
|
|
138
|
+
//#region ../ai-tools/src/schema.ts
|
|
139
139
|
/**
|
|
140
140
|
* Tiny, dependency-free [Standard Schema](https://standardschema.dev)
|
|
141
141
|
* builders for the tools' input validation. The package pins only
|
|
@@ -260,7 +260,7 @@ function objectSchema$2(shape) {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
//#endregion
|
|
263
|
-
//#region
|
|
263
|
+
//#region ../ai-tools/src/http/http-request.ts
|
|
264
264
|
/** Default tool name exposed to the LLM. */
|
|
265
265
|
const DEFAULT_NAME$4 = "http_request";
|
|
266
266
|
/** Default per-request wall-clock timeout, in milliseconds. */
|
|
@@ -475,7 +475,7 @@ function httpRequestTool(options = {}) {
|
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
//#endregion
|
|
478
|
-
//#region
|
|
478
|
+
//#region ../ai-tools/src/mcp/json-schema-to-standard.ts
|
|
479
479
|
/**
|
|
480
480
|
* The inverse of `@warlock.js/ai`'s `extractJsonSchema` (which goes
|
|
481
481
|
* Standard Schema → JSON Schema). Here we wrap a raw JSON Schema as a
|
|
@@ -620,7 +620,7 @@ function pathFromInstancePath(instancePath) {
|
|
|
620
620
|
}
|
|
621
621
|
|
|
622
622
|
//#endregion
|
|
623
|
-
//#region
|
|
623
|
+
//#region ../ai-tools/src/mcp/transport.ts
|
|
624
624
|
/** Default per-request wait before a transport call is abandoned. */
|
|
625
625
|
const DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
626
626
|
/** The JSON-RPC version literal every outbound message carries. */
|
|
@@ -995,7 +995,7 @@ function withIdAllocator(client) {
|
|
|
995
995
|
}
|
|
996
996
|
|
|
997
997
|
//#endregion
|
|
998
|
-
//#region
|
|
998
|
+
//#region ../ai-tools/src/mcp/client.ts
|
|
999
999
|
/** Default per-call timeout for `tools/call`. */
|
|
1000
1000
|
const DEFAULT_CALL_TIMEOUT_MS = 3e4;
|
|
1001
1001
|
/** The MCP protocol version this client advertises in `initialize`. */
|
|
@@ -1187,7 +1187,7 @@ function mcp$1(server, options) {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
|
|
1189
1189
|
//#endregion
|
|
1190
|
-
//#region
|
|
1190
|
+
//#region ../ai-tools/src/mcp/serve.ts
|
|
1191
1191
|
/** JSON-RPC version literal every outbound message carries. */
|
|
1192
1192
|
const JSONRPC_VERSION = "2.0";
|
|
1193
1193
|
/** Default JSON-Schema dialect emitted for each tool's `inputSchema`. */
|
|
@@ -1445,7 +1445,7 @@ function serve(source, options) {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
|
|
1447
1447
|
//#endregion
|
|
1448
|
-
//#region
|
|
1448
|
+
//#region ../ai-tools/src/mcp/index.ts
|
|
1449
1449
|
/**
|
|
1450
1450
|
* The `ai.mcp` factory value: the client factory with `.serve` attached.
|
|
1451
1451
|
* `Object.assign` keeps `mcp` callable (Direction A) while widening it with
|
|
@@ -1457,7 +1457,7 @@ function serve(source, options) {
|
|
|
1457
1457
|
const mcp = Object.assign((server, options) => mcp$1(server, options), { serve });
|
|
1458
1458
|
|
|
1459
1459
|
//#endregion
|
|
1460
|
-
//#region
|
|
1460
|
+
//#region ../ai-tools/src/utility/schema.ts
|
|
1461
1461
|
/**
|
|
1462
1462
|
* Tiny, dependency-free [Standard Schema](https://standardschema.dev)
|
|
1463
1463
|
* builders for the utility tools' input validation. This package pins
|
|
@@ -1569,7 +1569,7 @@ function objectSchema$1(shape) {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
1571
|
//#endregion
|
|
1572
|
-
//#region
|
|
1572
|
+
//#region ../ai-tools/src/utility/calculator.ts
|
|
1573
1573
|
/** Default tool name exposed to the LLM. */
|
|
1574
1574
|
const DEFAULT_NAME$3 = "calculator";
|
|
1575
1575
|
/** Input schema for the `calculator` tool: a single `expression` string. */
|
|
@@ -1835,7 +1835,7 @@ function calculatorTool(options) {
|
|
|
1835
1835
|
}
|
|
1836
1836
|
|
|
1837
1837
|
//#endregion
|
|
1838
|
-
//#region
|
|
1838
|
+
//#region ../ai-tools/src/utility/date-time.ts
|
|
1839
1839
|
/** Default tool name exposed to the LLM. */
|
|
1840
1840
|
const DEFAULT_NAME$2 = "date_time";
|
|
1841
1841
|
/** Input schema for the `date_time` tool. */
|
|
@@ -2022,7 +2022,7 @@ function dateTimeTool(options, deps) {
|
|
|
2022
2022
|
}
|
|
2023
2023
|
|
|
2024
2024
|
//#endregion
|
|
2025
|
-
//#region
|
|
2025
|
+
//#region ../ai-tools/src/web/schema.ts
|
|
2026
2026
|
/**
|
|
2027
2027
|
* Tiny, dependency-free [Standard Schema](https://standardschema.dev)
|
|
2028
2028
|
* builders for the web tools' input validation. The package pins only
|
|
@@ -2106,7 +2106,7 @@ function objectSchema(shape) {
|
|
|
2106
2106
|
}
|
|
2107
2107
|
|
|
2108
2108
|
//#endregion
|
|
2109
|
-
//#region
|
|
2109
|
+
//#region ../ai-tools/src/web/fetch-url.ts
|
|
2110
2110
|
/** Default tool name exposed to the LLM. */
|
|
2111
2111
|
const DEFAULT_NAME$1 = "fetch_url";
|
|
2112
2112
|
/** Default hard cap on response bytes read before truncation. */
|
|
@@ -2328,7 +2328,7 @@ function fetchUrlTool(options) {
|
|
|
2328
2328
|
}
|
|
2329
2329
|
|
|
2330
2330
|
//#endregion
|
|
2331
|
-
//#region
|
|
2331
|
+
//#region ../ai-tools/src/web/web-search.ts
|
|
2332
2332
|
/** Default tool name exposed to the LLM. */
|
|
2333
2333
|
const DEFAULT_NAME = "web_search";
|
|
2334
2334
|
/** Default per-call result cap when the constructor does not set one. */
|
|
@@ -2489,7 +2489,7 @@ function webSearchTool(options) {
|
|
|
2489
2489
|
}
|
|
2490
2490
|
|
|
2491
2491
|
//#endregion
|
|
2492
|
-
//#region
|
|
2492
|
+
//#region ../ai-tools/src/register.ts
|
|
2493
2493
|
_warlock_js_ai.ai.tools = {
|
|
2494
2494
|
webSearch: webSearchTool,
|
|
2495
2495
|
fetchUrl: fetchUrlTool,
|