@utilix-tech/sdk 0.42.0 → 0.43.0
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/CHANGELOG.md +4 -0
- package/README.md +7 -3
- package/dist/{ai_agent-C1zudGgT.d.cts → ai_agent-CmrVjvYH.d.cts} +28 -2
- package/dist/{ai_agent-C1zudGgT.d.ts → ai_agent-CmrVjvYH.d.ts} +28 -2
- package/dist/{chunk-W3J7GZVQ.js → chunk-EKIXOA7B.js} +114 -1
- package/dist/{chunk-UD45LBG7.js → chunk-XPNZYPM5.js} +108 -1
- package/dist/index.cjs +220 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{network-oAs83Ztn.d.cts → network-DISiPMoK.d.cts} +39 -2
- package/dist/{network-oAs83Ztn.d.ts → network-DISiPMoK.d.ts} +39 -2
- package/dist/tools/ai_agent.cjs +113 -0
- package/dist/tools/ai_agent.d.cts +1 -1
- package/dist/tools/ai_agent.d.ts +1 -1
- package/dist/tools/ai_agent.js +1 -1
- package/dist/tools/network.cjs +107 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9952,6 +9952,7 @@ __export(network_exports, {
|
|
|
9952
9952
|
validateDomain: () => validateDomain,
|
|
9953
9953
|
validateHeaderName: () => validateHeaderName,
|
|
9954
9954
|
validateHeaderValue: () => validateHeaderValue,
|
|
9955
|
+
validateManifest: () => validateManifest,
|
|
9955
9956
|
validateRobotsTxt: () => validateRobotsTxt,
|
|
9956
9957
|
validateSitemap: () => validateSitemap
|
|
9957
9958
|
});
|
|
@@ -12270,6 +12271,112 @@ function parseVaryHeader(raw) {
|
|
|
12270
12271
|
const headers = withoutLabel.split(",").map((h) => h.trim()).filter((h) => h.length > 0);
|
|
12271
12272
|
return buildVaryHeader(headers);
|
|
12272
12273
|
}
|
|
12274
|
+
var VALID_MANIFEST_DISPLAY = /* @__PURE__ */ new Set(["fullscreen", "standalone", "minimal-ui", "browser"]);
|
|
12275
|
+
function validateManifest(jsonText) {
|
|
12276
|
+
if (!jsonText || !jsonText.trim()) return { error: "Input is empty" };
|
|
12277
|
+
let manifest;
|
|
12278
|
+
try {
|
|
12279
|
+
manifest = JSON.parse(jsonText);
|
|
12280
|
+
} catch (e) {
|
|
12281
|
+
return { error: `Invalid JSON: ${e.message}` };
|
|
12282
|
+
}
|
|
12283
|
+
if (typeof manifest !== "object" || manifest === null || Array.isArray(manifest)) {
|
|
12284
|
+
return { error: "Manifest must be a JSON object" };
|
|
12285
|
+
}
|
|
12286
|
+
const m = manifest;
|
|
12287
|
+
const issues = [];
|
|
12288
|
+
if (!m.name && !m.short_name) {
|
|
12289
|
+
issues.push({ severity: "error", path: "name", message: 'Manifest must have at least one of "name" or "short_name"' });
|
|
12290
|
+
}
|
|
12291
|
+
if (m.name !== void 0 && typeof m.name !== "string") {
|
|
12292
|
+
issues.push({ severity: "error", path: "name", message: '"name" must be a string' });
|
|
12293
|
+
} else if (typeof m.name === "string" && m.name.length > 45) {
|
|
12294
|
+
issues.push({ severity: "warning", path: "name", message: `"name" is ${m.name.length} characters; keep it under ~45 to avoid truncation in install prompts` });
|
|
12295
|
+
}
|
|
12296
|
+
if (m.short_name !== void 0 && typeof m.short_name !== "string") {
|
|
12297
|
+
issues.push({ severity: "error", path: "short_name", message: '"short_name" must be a string' });
|
|
12298
|
+
} else if (typeof m.short_name === "string" && m.short_name.length > 12) {
|
|
12299
|
+
issues.push({ severity: "warning", path: "short_name", message: `"short_name" is ${m.short_name.length} characters; keep it under ~12 to avoid truncation on home screens` });
|
|
12300
|
+
}
|
|
12301
|
+
if (!m.start_url) {
|
|
12302
|
+
issues.push({ severity: "error", path: "start_url", message: 'Manifest is missing "start_url"' });
|
|
12303
|
+
} else if (typeof m.start_url !== "string") {
|
|
12304
|
+
issues.push({ severity: "error", path: "start_url", message: '"start_url" must be a string' });
|
|
12305
|
+
} else if (m.start_url.startsWith("//")) {
|
|
12306
|
+
issues.push({ severity: "warning", path: "start_url", message: '"start_url" looks protocol-relative; use a relative path (e.g. "/") or a full absolute URL instead' });
|
|
12307
|
+
}
|
|
12308
|
+
if (m.display !== void 0) {
|
|
12309
|
+
if (typeof m.display !== "string" || !VALID_MANIFEST_DISPLAY.has(m.display)) {
|
|
12310
|
+
issues.push({ severity: "error", path: "display", message: `"display" must be one of: ${[...VALID_MANIFEST_DISPLAY].join(", ")}` });
|
|
12311
|
+
}
|
|
12312
|
+
} else {
|
|
12313
|
+
issues.push({ severity: "warning", path: "display", message: 'Missing "display"; it defaults to "browser", which will not open the installed app in its own standalone window' });
|
|
12314
|
+
}
|
|
12315
|
+
const icons = [];
|
|
12316
|
+
let hasMaskableIcon = false;
|
|
12317
|
+
let has512Icon = false;
|
|
12318
|
+
if (!Array.isArray(m.icons) || m.icons.length === 0) {
|
|
12319
|
+
issues.push({ severity: "error", path: "icons", message: 'Manifest must have a non-empty "icons" array' });
|
|
12320
|
+
} else {
|
|
12321
|
+
m.icons.forEach((icon, i) => {
|
|
12322
|
+
const path = `icons[${i}]`;
|
|
12323
|
+
if (!icon || typeof icon !== "object") {
|
|
12324
|
+
issues.push({ severity: "error", path, message: "Icon entry must be an object" });
|
|
12325
|
+
return;
|
|
12326
|
+
}
|
|
12327
|
+
const iconObj = icon;
|
|
12328
|
+
if (!iconObj.src || typeof iconObj.src !== "string") {
|
|
12329
|
+
issues.push({ severity: "error", path, message: 'Icon entry is missing a required "src"' });
|
|
12330
|
+
}
|
|
12331
|
+
if (iconObj.sizes !== void 0) {
|
|
12332
|
+
if (typeof iconObj.sizes !== "string" || iconObj.sizes !== "any" && !/^\d+x\d+(\s+\d+x\d+)*$/i.test(iconObj.sizes)) {
|
|
12333
|
+
issues.push({ severity: "warning", path, message: `"sizes" value "${String(iconObj.sizes)}" doesn't match the expected "WIDTHxHEIGHT" format` });
|
|
12334
|
+
} else if (/(^|\s)512x512(\s|$)/i.test(iconObj.sizes)) {
|
|
12335
|
+
has512Icon = true;
|
|
12336
|
+
}
|
|
12337
|
+
}
|
|
12338
|
+
if (typeof iconObj.purpose === "string" && iconObj.purpose.toLowerCase().includes("maskable")) {
|
|
12339
|
+
hasMaskableIcon = true;
|
|
12340
|
+
}
|
|
12341
|
+
icons.push({
|
|
12342
|
+
src: typeof iconObj.src === "string" ? iconObj.src : "",
|
|
12343
|
+
sizes: typeof iconObj.sizes === "string" ? iconObj.sizes : void 0,
|
|
12344
|
+
type: typeof iconObj.type === "string" ? iconObj.type : void 0,
|
|
12345
|
+
purpose: typeof iconObj.purpose === "string" ? iconObj.purpose : void 0
|
|
12346
|
+
});
|
|
12347
|
+
});
|
|
12348
|
+
if (icons.length > 0) {
|
|
12349
|
+
if (!has512Icon) {
|
|
12350
|
+
issues.push({ severity: "warning", path: "icons", message: "No icon sized 512x512 found; this size is used for splash screens and app store listings" });
|
|
12351
|
+
}
|
|
12352
|
+
if (!hasMaskableIcon) {
|
|
12353
|
+
issues.push({ severity: "warning", path: "icons", message: 'No icon with purpose "maskable" (or "any maskable") found; without one, Android may crop your icon into its adaptive icon mask' });
|
|
12354
|
+
}
|
|
12355
|
+
}
|
|
12356
|
+
}
|
|
12357
|
+
if (m.theme_color !== void 0 && typeof m.theme_color !== "string") {
|
|
12358
|
+
issues.push({ severity: "error", path: "theme_color", message: '"theme_color" must be a CSS color string' });
|
|
12359
|
+
}
|
|
12360
|
+
if (m.background_color !== void 0 && typeof m.background_color !== "string") {
|
|
12361
|
+
issues.push({ severity: "error", path: "background_color", message: '"background_color" must be a CSS color string' });
|
|
12362
|
+
} else if (m.background_color === void 0) {
|
|
12363
|
+
issues.push({ severity: "warning", path: "background_color", message: 'Missing "background_color"; without it the splash screen background defaults to white' });
|
|
12364
|
+
}
|
|
12365
|
+
const valid = !issues.some((i) => i.severity === "error");
|
|
12366
|
+
return {
|
|
12367
|
+
issues,
|
|
12368
|
+
valid,
|
|
12369
|
+
summary: {
|
|
12370
|
+
name: typeof m.name === "string" ? m.name : void 0,
|
|
12371
|
+
shortName: typeof m.short_name === "string" ? m.short_name : void 0,
|
|
12372
|
+
startUrl: typeof m.start_url === "string" ? m.start_url : void 0,
|
|
12373
|
+
display: typeof m.display === "string" ? m.display : void 0,
|
|
12374
|
+
icons,
|
|
12375
|
+
hasMaskableIcon,
|
|
12376
|
+
has512Icon
|
|
12377
|
+
}
|
|
12378
|
+
};
|
|
12379
|
+
}
|
|
12273
12380
|
|
|
12274
12381
|
// src/tools/api.ts
|
|
12275
12382
|
var api_exports = {};
|
|
@@ -20121,6 +20228,7 @@ __export(ai_agent_exports, {
|
|
|
20121
20228
|
extractUrls: () => extractUrls,
|
|
20122
20229
|
flattenJson: () => flattenJson,
|
|
20123
20230
|
formatFewShotExamples: () => formatFewShotExamples,
|
|
20231
|
+
lintToolSchema: () => lintToolSchema,
|
|
20124
20232
|
mergeJson: () => mergeJson,
|
|
20125
20233
|
redactPii: () => redactPii,
|
|
20126
20234
|
repairJson: () => repairJson,
|
|
@@ -21101,6 +21209,118 @@ Output: ${e.output.trim()}`).join("\n\n");
|
|
|
21101
21209
|
}
|
|
21102
21210
|
return { formatted, exampleCount: valid.length, format };
|
|
21103
21211
|
}
|
|
21212
|
+
var TOOL_NAME_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
21213
|
+
function normalizeToolDefs(data) {
|
|
21214
|
+
let rawList;
|
|
21215
|
+
if (Array.isArray(data)) {
|
|
21216
|
+
rawList = data;
|
|
21217
|
+
} else if (data && typeof data === "object" && Array.isArray(data.tools)) {
|
|
21218
|
+
rawList = data.tools;
|
|
21219
|
+
} else {
|
|
21220
|
+
rawList = [data];
|
|
21221
|
+
}
|
|
21222
|
+
const out = [];
|
|
21223
|
+
for (const item of rawList) {
|
|
21224
|
+
if (!item || typeof item !== "object") {
|
|
21225
|
+
return { error: "Each tool definition must be a JSON object" };
|
|
21226
|
+
}
|
|
21227
|
+
const obj = item;
|
|
21228
|
+
if (obj.type === "function" && obj.function && typeof obj.function === "object") {
|
|
21229
|
+
const fn = obj.function;
|
|
21230
|
+
out.push({ name: String(fn.name ?? ""), description: typeof fn.description === "string" ? fn.description : void 0, schema: fn.parameters, format: "openai" });
|
|
21231
|
+
} else if ("input_schema" in obj) {
|
|
21232
|
+
out.push({ name: String(obj.name ?? ""), description: typeof obj.description === "string" ? obj.description : void 0, schema: obj.input_schema, format: "anthropic" });
|
|
21233
|
+
} else if ("inputSchema" in obj) {
|
|
21234
|
+
out.push({ name: String(obj.name ?? ""), description: typeof obj.description === "string" ? obj.description : void 0, schema: obj.inputSchema, format: "mcp" });
|
|
21235
|
+
} else if ("parameters" in obj || "name" in obj) {
|
|
21236
|
+
out.push({ name: String(obj.name ?? ""), description: typeof obj.description === "string" ? obj.description : void 0, schema: obj.parameters, format: "bare" });
|
|
21237
|
+
} else {
|
|
21238
|
+
return { error: 'Unrecognized tool-definition format: expected an OpenAI ({type:"function",function:{...}}), Anthropic ({name,input_schema}), or MCP ({name,inputSchema}) shape' };
|
|
21239
|
+
}
|
|
21240
|
+
}
|
|
21241
|
+
return out;
|
|
21242
|
+
}
|
|
21243
|
+
function lintToolSchema(jsonText) {
|
|
21244
|
+
if (!jsonText || !jsonText.trim()) return { error: "Input is empty" };
|
|
21245
|
+
let data;
|
|
21246
|
+
try {
|
|
21247
|
+
data = JSON.parse(jsonText);
|
|
21248
|
+
} catch (e) {
|
|
21249
|
+
return { error: `Invalid JSON: ${e.message}` };
|
|
21250
|
+
}
|
|
21251
|
+
const normalized = normalizeToolDefs(data);
|
|
21252
|
+
if ("error" in normalized) return normalized;
|
|
21253
|
+
if (normalized.length === 0) return { error: "No tool definitions found" };
|
|
21254
|
+
const issues = [];
|
|
21255
|
+
const seenNames = /* @__PURE__ */ new Map();
|
|
21256
|
+
for (const tool of normalized) {
|
|
21257
|
+
const label = tool.name || "(unnamed)";
|
|
21258
|
+
seenNames.set(label, (seenNames.get(label) ?? 0) + 1);
|
|
21259
|
+
if (!tool.name) {
|
|
21260
|
+
issues.push({ severity: "error", tool: label, path: "name", message: 'Tool is missing a "name"' });
|
|
21261
|
+
} else if (!TOOL_NAME_RE.test(tool.name)) {
|
|
21262
|
+
issues.push({ severity: "error", tool: label, path: "name", message: `Tool name "${tool.name}" must match ^[a-zA-Z0-9_-]{1,64}$ (letters, digits, underscores, hyphens, max 64 chars) to be accepted by OpenAI/Anthropic function calling` });
|
|
21263
|
+
}
|
|
21264
|
+
if (!tool.description || !tool.description.trim()) {
|
|
21265
|
+
issues.push({ severity: "error", tool: label, path: "description", message: 'Tool is missing a "description" \u2014 the model relies entirely on this text to decide when to call it' });
|
|
21266
|
+
} else {
|
|
21267
|
+
if (tool.description.trim().length < 10) {
|
|
21268
|
+
issues.push({ severity: "warning", tool: label, path: "description", message: "Description is very short; a vague description measurably hurts the model's ability to pick the right tool" });
|
|
21269
|
+
}
|
|
21270
|
+
if (tool.description.length > 1024) {
|
|
21271
|
+
issues.push({ severity: "warning", tool: label, path: "description", message: `Description is ${tool.description.length} characters; long descriptions cost tokens on every request that includes this tool` });
|
|
21272
|
+
}
|
|
21273
|
+
}
|
|
21274
|
+
if (tool.schema === void 0 || tool.schema === null) {
|
|
21275
|
+
issues.push({ severity: "warning", tool: label, path: "parameters", message: "Tool has no parameter schema; only correct if the tool genuinely takes no arguments" });
|
|
21276
|
+
continue;
|
|
21277
|
+
}
|
|
21278
|
+
if (typeof tool.schema !== "object" || Array.isArray(tool.schema)) {
|
|
21279
|
+
issues.push({ severity: "error", tool: label, path: "parameters", message: "Parameter schema must be a JSON Schema object" });
|
|
21280
|
+
continue;
|
|
21281
|
+
}
|
|
21282
|
+
const schema = tool.schema;
|
|
21283
|
+
if (schema.type !== void 0 && schema.type !== "object") {
|
|
21284
|
+
issues.push({ severity: "error", tool: label, path: "parameters.type", message: `Top-level parameter schema type is "${String(schema.type)}"; OpenAI and Anthropic both require "object" at the top level` });
|
|
21285
|
+
}
|
|
21286
|
+
const properties = schema.properties;
|
|
21287
|
+
if (properties !== void 0 && (typeof properties !== "object" || properties === null || Array.isArray(properties))) {
|
|
21288
|
+
issues.push({ severity: "error", tool: label, path: "parameters.properties", message: '"properties" must be an object' });
|
|
21289
|
+
} else if (properties && typeof properties === "object") {
|
|
21290
|
+
const propsObj = properties;
|
|
21291
|
+
const propNames = Object.keys(propsObj);
|
|
21292
|
+
for (const propName of propNames) {
|
|
21293
|
+
const prop = propsObj[propName];
|
|
21294
|
+
const propPath = `parameters.properties.${propName}`;
|
|
21295
|
+
if (!prop || typeof prop !== "object") {
|
|
21296
|
+
issues.push({ severity: "error", tool: label, path: propPath, message: "Property schema must be an object" });
|
|
21297
|
+
continue;
|
|
21298
|
+
}
|
|
21299
|
+
const propObj = prop;
|
|
21300
|
+
if (!propObj.description) {
|
|
21301
|
+
issues.push({ severity: "warning", tool: label, path: propPath, message: `Property "${propName}" has no description; missing per-parameter descriptions measurably hurt model accuracy on which value to pass` });
|
|
21302
|
+
}
|
|
21303
|
+
if (Array.isArray(propObj.enum) && propObj.enum.length === 0) {
|
|
21304
|
+
issues.push({ severity: "error", tool: label, path: propPath, message: `Property "${propName}" has an empty "enum" array` });
|
|
21305
|
+
}
|
|
21306
|
+
}
|
|
21307
|
+
if (Array.isArray(schema.required)) {
|
|
21308
|
+
for (const req of schema.required) {
|
|
21309
|
+
if (typeof req === "string" && !propNames.includes(req)) {
|
|
21310
|
+
issues.push({ severity: "error", tool: label, path: "parameters.required", message: `"required" lists "${req}", which isn't defined in "properties"` });
|
|
21311
|
+
}
|
|
21312
|
+
}
|
|
21313
|
+
}
|
|
21314
|
+
}
|
|
21315
|
+
}
|
|
21316
|
+
for (const [name, count] of seenNames) {
|
|
21317
|
+
if (count > 1 && name !== "(unnamed)") {
|
|
21318
|
+
issues.push({ severity: "error", tool: name, path: "name", message: `Tool name "${name}" is used ${count} times; tool names must be unique within a single request` });
|
|
21319
|
+
}
|
|
21320
|
+
}
|
|
21321
|
+
const valid = !issues.some((i) => i.severity === "error");
|
|
21322
|
+
return { toolCount: normalized.length, issues, valid };
|
|
21323
|
+
}
|
|
21104
21324
|
|
|
21105
21325
|
// src/tools/media.ts
|
|
21106
21326
|
var media_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -6,13 +6,13 @@ export { d as data } from './data-BKpEOcOX.cjs';
|
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
8
|
export { u as units } from './units-CzPwRC03.cjs';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-DISiPMoK.cjs';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.cjs';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.cjs';
|
|
15
|
-
export { a as ai_agent } from './ai_agent-
|
|
15
|
+
export { a as ai_agent } from './ai_agent-CmrVjvYH.cjs';
|
|
16
16
|
export { m as media } from './media-fD8dJ5qR.cjs';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
package/dist/index.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ export { d as data } from './data-BKpEOcOX.js';
|
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
8
|
export { u as units } from './units-CzPwRC03.js';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-DISiPMoK.js';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.js';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.js';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.js';
|
|
15
|
-
export { a as ai_agent } from './ai_agent-
|
|
15
|
+
export { a as ai_agent } from './ai_agent-CmrVjvYH.js';
|
|
16
16
|
export { m as media } from './media-fD8dJ5qR.js';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-L6V4W4SU.js';
|
|
2
2
|
export { units_exports as units } from './chunk-2MTHD2LG.js';
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
3
|
+
export { network_exports as network } from './chunk-XPNZYPM5.js';
|
|
4
4
|
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
5
|
export { code_exports as code } from './chunk-JL7YTXRB.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
7
7
|
export { css_exports as css } from './chunk-6YPV2AB5.js';
|
|
8
8
|
export { misc_exports as misc } from './chunk-GX7H6TAX.js';
|
|
9
|
-
export { ai_agent_exports as ai_agent } from './chunk-
|
|
9
|
+
export { ai_agent_exports as ai_agent } from './chunk-EKIXOA7B.js';
|
|
10
10
|
export { json_exports as json } from './chunk-WVEKRKGU.js';
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
12
|
export { hashing_exports as hashing } from './chunk-PET2CGTH.js';
|
|
@@ -525,6 +525,39 @@ declare function buildVaryHeader(headers: string[]): VaryHeaderResult | {
|
|
|
525
525
|
declare function parseVaryHeader(raw: string): VaryHeaderResult | {
|
|
526
526
|
error: string;
|
|
527
527
|
};
|
|
528
|
+
interface ManifestIssue {
|
|
529
|
+
severity: 'error' | 'warning';
|
|
530
|
+
path: string;
|
|
531
|
+
message: string;
|
|
532
|
+
}
|
|
533
|
+
interface ManifestIconInfo {
|
|
534
|
+
src: string;
|
|
535
|
+
sizes?: string;
|
|
536
|
+
type?: string;
|
|
537
|
+
purpose?: string;
|
|
538
|
+
}
|
|
539
|
+
interface ManifestValidationResult {
|
|
540
|
+
issues: ManifestIssue[];
|
|
541
|
+
valid: boolean;
|
|
542
|
+
summary: {
|
|
543
|
+
name?: string;
|
|
544
|
+
shortName?: string;
|
|
545
|
+
startUrl?: string;
|
|
546
|
+
display?: string;
|
|
547
|
+
icons: ManifestIconInfo[];
|
|
548
|
+
hasMaskableIcon: boolean;
|
|
549
|
+
has512Icon: boolean;
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Validate a web app manifest.json against the W3C Web App Manifest spec's
|
|
554
|
+
* installability requirements: name/short_name, start_url, display mode, and
|
|
555
|
+
* an icons array covering a 512x512 and a maskable icon, plus recommended
|
|
556
|
+
* theme_color/background_color fields.
|
|
557
|
+
*/
|
|
558
|
+
declare function validateManifest(jsonText: string): ManifestValidationResult | {
|
|
559
|
+
error: string;
|
|
560
|
+
};
|
|
528
561
|
|
|
529
562
|
type network_AuthResultEntry = AuthResultEntry;
|
|
530
563
|
type network_BuildRangeHeaderOptions = BuildRangeHeaderOptions;
|
|
@@ -554,6 +587,9 @@ type network_LinkHeaderEntry = LinkHeaderEntry;
|
|
|
554
587
|
type network_LinkHeaderEntryInput = LinkHeaderEntryInput;
|
|
555
588
|
type network_LinkHeaderResult = LinkHeaderResult;
|
|
556
589
|
type network_LinkRel = LinkRel;
|
|
590
|
+
type network_ManifestIconInfo = ManifestIconInfo;
|
|
591
|
+
type network_ManifestIssue = ManifestIssue;
|
|
592
|
+
type network_ManifestValidationResult = ManifestValidationResult;
|
|
557
593
|
type network_ParsedDnsResult = ParsedDnsResult;
|
|
558
594
|
type network_ParsedGeoResult = ParsedGeoResult;
|
|
559
595
|
declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
|
|
@@ -617,10 +653,11 @@ declare const network_typeNumberToLabel: typeof typeNumberToLabel;
|
|
|
617
653
|
declare const network_validateDomain: typeof validateDomain;
|
|
618
654
|
declare const network_validateHeaderName: typeof validateHeaderName;
|
|
619
655
|
declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
656
|
+
declare const network_validateManifest: typeof validateManifest;
|
|
620
657
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
621
658
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
622
659
|
declare namespace network {
|
|
623
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
660
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
624
661
|
}
|
|
625
662
|
|
|
626
|
-
export { type
|
|
663
|
+
export { type UaDeviceType as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type ReceivedHop as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type ReferrerPolicyEntry as J, type ReferrerPolicyResult as K, LINK_REL_VALUES as L, type ManifestIconInfo as M, type ReferrerPolicyValue as N, type RobotsGroup as O, type ParsedDnsResult as P, type RobotsIssue as Q, REFERRER_POLICY_VALUES as R, type RobotsRule as S, type RobotsValidationResult as T, STATUS_CODES as U, type SameSiteValue as V, type SitemapIndexEntry as W, type SitemapIssue as X, type SitemapUrlEntry as Y, type SitemapValidationResult as Z, type StatusCode as _, type CacheControlOptions as a, type UserAgentInfo as a0, type VaryHeaderEntry as a1, type VaryHeaderResult as a2, analyzeEmailHeaders as a3, buildCacheControl as a4, buildDnsQueryUrl as a5, buildGeoUrl as a6, buildLinkHeader as a7, buildMapUrl as a8, buildRangeHeader as a9, statusCodeToText as aA, typeNumberToLabel as aB, validateDomain as aC, validateHeaderName as aD, validateHeaderValue as aE, validateManifest as aF, validateRobotsTxt as aG, validateSitemap as aH, buildReferrerPolicy as aa, buildVaryHeader as ab, checkSetCookieHeader as ac, countryCodeToFlag as ad, formatCoordinates as ae, formatTtl as af, getByCategory as ag, getHeader as ah, getHeadersByCategory as ai, getStatusByCategory as aj, getStatusCode as ak, isClientError as al, isServerError as am, isSuccess as an, isValidIp as ao, isValidIpv4 as ap, isValidIpv6 as aq, parseContentRangeHeader as ar, parseDnsResponse as as, parseGeoResponse as at, parseHar as au, parseIpv6Address as av, parseUserAgent as aw, parseVaryHeader as ax, searchHeaders as ay, searchStatusCodes as az, type CacheControlResult as b, type ContentRangeResult as c, type CookieAttributes as d, type CookieCheckResult as e, type DnsRecord as f, type DnsRecordType as g, type DnsResponse as h, type EmailHeaderField as i, type HarEntry as j, type HarParseResult as k, type HarSummary as l, type HeaderCategory as m, network as n, type HttpHeader as o, type Ipv6ParseResult as p, type LinkHeaderEntry as q, type LinkHeaderEntryInput as r, type LinkHeaderResult as s, type LinkRel as t, type ManifestIssue as u, type ManifestValidationResult as v, type ParsedGeoResult as w, type RangeEntry as x, type RangeEntryInput as y, type RangeHeaderResult as z };
|
|
@@ -525,6 +525,39 @@ declare function buildVaryHeader(headers: string[]): VaryHeaderResult | {
|
|
|
525
525
|
declare function parseVaryHeader(raw: string): VaryHeaderResult | {
|
|
526
526
|
error: string;
|
|
527
527
|
};
|
|
528
|
+
interface ManifestIssue {
|
|
529
|
+
severity: 'error' | 'warning';
|
|
530
|
+
path: string;
|
|
531
|
+
message: string;
|
|
532
|
+
}
|
|
533
|
+
interface ManifestIconInfo {
|
|
534
|
+
src: string;
|
|
535
|
+
sizes?: string;
|
|
536
|
+
type?: string;
|
|
537
|
+
purpose?: string;
|
|
538
|
+
}
|
|
539
|
+
interface ManifestValidationResult {
|
|
540
|
+
issues: ManifestIssue[];
|
|
541
|
+
valid: boolean;
|
|
542
|
+
summary: {
|
|
543
|
+
name?: string;
|
|
544
|
+
shortName?: string;
|
|
545
|
+
startUrl?: string;
|
|
546
|
+
display?: string;
|
|
547
|
+
icons: ManifestIconInfo[];
|
|
548
|
+
hasMaskableIcon: boolean;
|
|
549
|
+
has512Icon: boolean;
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Validate a web app manifest.json against the W3C Web App Manifest spec's
|
|
554
|
+
* installability requirements: name/short_name, start_url, display mode, and
|
|
555
|
+
* an icons array covering a 512x512 and a maskable icon, plus recommended
|
|
556
|
+
* theme_color/background_color fields.
|
|
557
|
+
*/
|
|
558
|
+
declare function validateManifest(jsonText: string): ManifestValidationResult | {
|
|
559
|
+
error: string;
|
|
560
|
+
};
|
|
528
561
|
|
|
529
562
|
type network_AuthResultEntry = AuthResultEntry;
|
|
530
563
|
type network_BuildRangeHeaderOptions = BuildRangeHeaderOptions;
|
|
@@ -554,6 +587,9 @@ type network_LinkHeaderEntry = LinkHeaderEntry;
|
|
|
554
587
|
type network_LinkHeaderEntryInput = LinkHeaderEntryInput;
|
|
555
588
|
type network_LinkHeaderResult = LinkHeaderResult;
|
|
556
589
|
type network_LinkRel = LinkRel;
|
|
590
|
+
type network_ManifestIconInfo = ManifestIconInfo;
|
|
591
|
+
type network_ManifestIssue = ManifestIssue;
|
|
592
|
+
type network_ManifestValidationResult = ManifestValidationResult;
|
|
557
593
|
type network_ParsedDnsResult = ParsedDnsResult;
|
|
558
594
|
type network_ParsedGeoResult = ParsedGeoResult;
|
|
559
595
|
declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
|
|
@@ -617,10 +653,11 @@ declare const network_typeNumberToLabel: typeof typeNumberToLabel;
|
|
|
617
653
|
declare const network_validateDomain: typeof validateDomain;
|
|
618
654
|
declare const network_validateHeaderName: typeof validateHeaderName;
|
|
619
655
|
declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
656
|
+
declare const network_validateManifest: typeof validateManifest;
|
|
620
657
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
621
658
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
622
659
|
declare namespace network {
|
|
623
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
660
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
624
661
|
}
|
|
625
662
|
|
|
626
|
-
export { type
|
|
663
|
+
export { type UaDeviceType as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type ReceivedHop as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type ReferrerPolicyEntry as J, type ReferrerPolicyResult as K, LINK_REL_VALUES as L, type ManifestIconInfo as M, type ReferrerPolicyValue as N, type RobotsGroup as O, type ParsedDnsResult as P, type RobotsIssue as Q, REFERRER_POLICY_VALUES as R, type RobotsRule as S, type RobotsValidationResult as T, STATUS_CODES as U, type SameSiteValue as V, type SitemapIndexEntry as W, type SitemapIssue as X, type SitemapUrlEntry as Y, type SitemapValidationResult as Z, type StatusCode as _, type CacheControlOptions as a, type UserAgentInfo as a0, type VaryHeaderEntry as a1, type VaryHeaderResult as a2, analyzeEmailHeaders as a3, buildCacheControl as a4, buildDnsQueryUrl as a5, buildGeoUrl as a6, buildLinkHeader as a7, buildMapUrl as a8, buildRangeHeader as a9, statusCodeToText as aA, typeNumberToLabel as aB, validateDomain as aC, validateHeaderName as aD, validateHeaderValue as aE, validateManifest as aF, validateRobotsTxt as aG, validateSitemap as aH, buildReferrerPolicy as aa, buildVaryHeader as ab, checkSetCookieHeader as ac, countryCodeToFlag as ad, formatCoordinates as ae, formatTtl as af, getByCategory as ag, getHeader as ah, getHeadersByCategory as ai, getStatusByCategory as aj, getStatusCode as ak, isClientError as al, isServerError as am, isSuccess as an, isValidIp as ao, isValidIpv4 as ap, isValidIpv6 as aq, parseContentRangeHeader as ar, parseDnsResponse as as, parseGeoResponse as at, parseHar as au, parseIpv6Address as av, parseUserAgent as aw, parseVaryHeader as ax, searchHeaders as ay, searchStatusCodes as az, type CacheControlResult as b, type ContentRangeResult as c, type CookieAttributes as d, type CookieCheckResult as e, type DnsRecord as f, type DnsRecordType as g, type DnsResponse as h, type EmailHeaderField as i, type HarEntry as j, type HarParseResult as k, type HarSummary as l, type HeaderCategory as m, network as n, type HttpHeader as o, type Ipv6ParseResult as p, type LinkHeaderEntry as q, type LinkHeaderEntryInput as r, type LinkHeaderResult as s, type LinkRel as t, type ManifestIssue as u, type ManifestValidationResult as v, type ParsedGeoResult as w, type RangeEntry as x, type RangeEntryInput as y, type RangeHeaderResult as z };
|
package/dist/tools/ai_agent.cjs
CHANGED
|
@@ -969,6 +969,118 @@ Output: ${e.output.trim()}`).join("\n\n");
|
|
|
969
969
|
}
|
|
970
970
|
return { formatted, exampleCount: valid.length, format };
|
|
971
971
|
}
|
|
972
|
+
var TOOL_NAME_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
973
|
+
function normalizeToolDefs(data) {
|
|
974
|
+
let rawList;
|
|
975
|
+
if (Array.isArray(data)) {
|
|
976
|
+
rawList = data;
|
|
977
|
+
} else if (data && typeof data === "object" && Array.isArray(data.tools)) {
|
|
978
|
+
rawList = data.tools;
|
|
979
|
+
} else {
|
|
980
|
+
rawList = [data];
|
|
981
|
+
}
|
|
982
|
+
const out = [];
|
|
983
|
+
for (const item of rawList) {
|
|
984
|
+
if (!item || typeof item !== "object") {
|
|
985
|
+
return { error: "Each tool definition must be a JSON object" };
|
|
986
|
+
}
|
|
987
|
+
const obj = item;
|
|
988
|
+
if (obj.type === "function" && obj.function && typeof obj.function === "object") {
|
|
989
|
+
const fn = obj.function;
|
|
990
|
+
out.push({ name: String(fn.name ?? ""), description: typeof fn.description === "string" ? fn.description : void 0, schema: fn.parameters, format: "openai" });
|
|
991
|
+
} else if ("input_schema" in obj) {
|
|
992
|
+
out.push({ name: String(obj.name ?? ""), description: typeof obj.description === "string" ? obj.description : void 0, schema: obj.input_schema, format: "anthropic" });
|
|
993
|
+
} else if ("inputSchema" in obj) {
|
|
994
|
+
out.push({ name: String(obj.name ?? ""), description: typeof obj.description === "string" ? obj.description : void 0, schema: obj.inputSchema, format: "mcp" });
|
|
995
|
+
} else if ("parameters" in obj || "name" in obj) {
|
|
996
|
+
out.push({ name: String(obj.name ?? ""), description: typeof obj.description === "string" ? obj.description : void 0, schema: obj.parameters, format: "bare" });
|
|
997
|
+
} else {
|
|
998
|
+
return { error: 'Unrecognized tool-definition format: expected an OpenAI ({type:"function",function:{...}}), Anthropic ({name,input_schema}), or MCP ({name,inputSchema}) shape' };
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
return out;
|
|
1002
|
+
}
|
|
1003
|
+
function lintToolSchema(jsonText) {
|
|
1004
|
+
if (!jsonText || !jsonText.trim()) return { error: "Input is empty" };
|
|
1005
|
+
let data;
|
|
1006
|
+
try {
|
|
1007
|
+
data = JSON.parse(jsonText);
|
|
1008
|
+
} catch (e) {
|
|
1009
|
+
return { error: `Invalid JSON: ${e.message}` };
|
|
1010
|
+
}
|
|
1011
|
+
const normalized = normalizeToolDefs(data);
|
|
1012
|
+
if ("error" in normalized) return normalized;
|
|
1013
|
+
if (normalized.length === 0) return { error: "No tool definitions found" };
|
|
1014
|
+
const issues = [];
|
|
1015
|
+
const seenNames = /* @__PURE__ */ new Map();
|
|
1016
|
+
for (const tool of normalized) {
|
|
1017
|
+
const label = tool.name || "(unnamed)";
|
|
1018
|
+
seenNames.set(label, (seenNames.get(label) ?? 0) + 1);
|
|
1019
|
+
if (!tool.name) {
|
|
1020
|
+
issues.push({ severity: "error", tool: label, path: "name", message: 'Tool is missing a "name"' });
|
|
1021
|
+
} else if (!TOOL_NAME_RE.test(tool.name)) {
|
|
1022
|
+
issues.push({ severity: "error", tool: label, path: "name", message: `Tool name "${tool.name}" must match ^[a-zA-Z0-9_-]{1,64}$ (letters, digits, underscores, hyphens, max 64 chars) to be accepted by OpenAI/Anthropic function calling` });
|
|
1023
|
+
}
|
|
1024
|
+
if (!tool.description || !tool.description.trim()) {
|
|
1025
|
+
issues.push({ severity: "error", tool: label, path: "description", message: 'Tool is missing a "description" \u2014 the model relies entirely on this text to decide when to call it' });
|
|
1026
|
+
} else {
|
|
1027
|
+
if (tool.description.trim().length < 10) {
|
|
1028
|
+
issues.push({ severity: "warning", tool: label, path: "description", message: "Description is very short; a vague description measurably hurts the model's ability to pick the right tool" });
|
|
1029
|
+
}
|
|
1030
|
+
if (tool.description.length > 1024) {
|
|
1031
|
+
issues.push({ severity: "warning", tool: label, path: "description", message: `Description is ${tool.description.length} characters; long descriptions cost tokens on every request that includes this tool` });
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
if (tool.schema === void 0 || tool.schema === null) {
|
|
1035
|
+
issues.push({ severity: "warning", tool: label, path: "parameters", message: "Tool has no parameter schema; only correct if the tool genuinely takes no arguments" });
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
if (typeof tool.schema !== "object" || Array.isArray(tool.schema)) {
|
|
1039
|
+
issues.push({ severity: "error", tool: label, path: "parameters", message: "Parameter schema must be a JSON Schema object" });
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
const schema = tool.schema;
|
|
1043
|
+
if (schema.type !== void 0 && schema.type !== "object") {
|
|
1044
|
+
issues.push({ severity: "error", tool: label, path: "parameters.type", message: `Top-level parameter schema type is "${String(schema.type)}"; OpenAI and Anthropic both require "object" at the top level` });
|
|
1045
|
+
}
|
|
1046
|
+
const properties = schema.properties;
|
|
1047
|
+
if (properties !== void 0 && (typeof properties !== "object" || properties === null || Array.isArray(properties))) {
|
|
1048
|
+
issues.push({ severity: "error", tool: label, path: "parameters.properties", message: '"properties" must be an object' });
|
|
1049
|
+
} else if (properties && typeof properties === "object") {
|
|
1050
|
+
const propsObj = properties;
|
|
1051
|
+
const propNames = Object.keys(propsObj);
|
|
1052
|
+
for (const propName of propNames) {
|
|
1053
|
+
const prop = propsObj[propName];
|
|
1054
|
+
const propPath = `parameters.properties.${propName}`;
|
|
1055
|
+
if (!prop || typeof prop !== "object") {
|
|
1056
|
+
issues.push({ severity: "error", tool: label, path: propPath, message: "Property schema must be an object" });
|
|
1057
|
+
continue;
|
|
1058
|
+
}
|
|
1059
|
+
const propObj = prop;
|
|
1060
|
+
if (!propObj.description) {
|
|
1061
|
+
issues.push({ severity: "warning", tool: label, path: propPath, message: `Property "${propName}" has no description; missing per-parameter descriptions measurably hurt model accuracy on which value to pass` });
|
|
1062
|
+
}
|
|
1063
|
+
if (Array.isArray(propObj.enum) && propObj.enum.length === 0) {
|
|
1064
|
+
issues.push({ severity: "error", tool: label, path: propPath, message: `Property "${propName}" has an empty "enum" array` });
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
if (Array.isArray(schema.required)) {
|
|
1068
|
+
for (const req of schema.required) {
|
|
1069
|
+
if (typeof req === "string" && !propNames.includes(req)) {
|
|
1070
|
+
issues.push({ severity: "error", tool: label, path: "parameters.required", message: `"required" lists "${req}", which isn't defined in "properties"` });
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
for (const [name, count] of seenNames) {
|
|
1077
|
+
if (count > 1 && name !== "(unnamed)") {
|
|
1078
|
+
issues.push({ severity: "error", tool: name, path: "name", message: `Tool name "${name}" is used ${count} times; tool names must be unique within a single request` });
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
const valid = !issues.some((i) => i.severity === "error");
|
|
1082
|
+
return { toolCount: normalized.length, issues, valid };
|
|
1083
|
+
}
|
|
972
1084
|
|
|
973
1085
|
exports.MODEL_PRICING = MODEL_PRICING;
|
|
974
1086
|
exports.chunkText = chunkText;
|
|
@@ -990,6 +1102,7 @@ exports.extractTables = extractTables;
|
|
|
990
1102
|
exports.extractUrls = extractUrls;
|
|
991
1103
|
exports.flattenJson = flattenJson;
|
|
992
1104
|
exports.formatFewShotExamples = formatFewShotExamples;
|
|
1105
|
+
exports.lintToolSchema = lintToolSchema;
|
|
993
1106
|
exports.mergeJson = mergeJson;
|
|
994
1107
|
exports.redactPii = redactPii;
|
|
995
1108
|
exports.repairJson = repairJson;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ChunkStrategy, b as CompressHtmlResult, c as CompressJsonResult, d as CompressMarkdownResult, e as CostEstimate, D as DedupeResult, f as DedupeStrategy, g as DiffEntry2, h as DiffOp2, i as DiffResult2, E as Entity2, j as EntityType2, k as ExtractJsonResult, l as ExtractKeywordsResult, m as ExtractUrlsResult, F as FewShotExample, n as FewShotFormat, o as FewShotFormatResult, I as InjectionDetectResult, p as InjectionFinding, J as JsonBlock, q as JsonRepairResult, K as Keyword, M as MODEL_PRICING, r as MergeResult, s as MergeStrategy, t as ModelPricing, P as PiiDetectResult, u as PiiFinding, v as PiiType, R as RankedChunk, w as RelevanceResult, S as SanitizeResult, x as SecretDetectResult, y as SecretFinding, z as SecretType, A as SummaryResult, T as TableResult2, B as TextChunk, G as TokenEstimate, H as TokenEstimateResult, L as
|
|
1
|
+
export { C as ChunkStrategy, b as CompressHtmlResult, c as CompressJsonResult, d as CompressMarkdownResult, e as CostEstimate, D as DedupeResult, f as DedupeStrategy, g as DiffEntry2, h as DiffOp2, i as DiffResult2, E as Entity2, j as EntityType2, k as ExtractJsonResult, l as ExtractKeywordsResult, m as ExtractUrlsResult, F as FewShotExample, n as FewShotFormat, o as FewShotFormatResult, I as InjectionDetectResult, p as InjectionFinding, J as JsonBlock, q as JsonRepairResult, K as Keyword, M as MODEL_PRICING, r as MergeResult, s as MergeStrategy, t as ModelPricing, P as PiiDetectResult, u as PiiFinding, v as PiiType, R as RankedChunk, w as RelevanceResult, S as SanitizeResult, x as SecretDetectResult, y as SecretFinding, z as SecretType, A as SummaryResult, T as TableResult2, B as TextChunk, G as TokenEstimate, H as TokenEstimateResult, L as ToolSchemaIssue, N as ToolSchemaLintResult, O as TrimResult, Q as TrimStrategy, U as UrlMatch, V as ValidationError, W as ValidationResult, X as VectorSimilarityResult, Y as chunkText, Z as compressHtml, _ as compressJson, $ as compressMarkdown, a0 as deduplicateLines, a1 as detectPii, a2 as detectPromptInjection, a3 as detectSecrets, a4 as diffJson, a5 as estimateCost, a6 as estimateTokens, a7 as expandQuery, a8 as extractEntities, a9 as extractJson, aa as extractKeywords, ab as extractTables, ac as extractUrls, ad as flattenJson, ae as formatFewShotExamples, af as lintToolSchema, ag as mergeJson, ah as redactPii, ai as repairJson, aj as rerankChunks, ak as sanitizeHtml, al as scoreRelevance, am as summarizeForLlm, an as trimToTokens, ao as unflattenJson, ap as validateJsonSchema, aq as vectorSimilarity } from '../ai_agent-CmrVjvYH.cjs';
|
package/dist/tools/ai_agent.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ChunkStrategy, b as CompressHtmlResult, c as CompressJsonResult, d as CompressMarkdownResult, e as CostEstimate, D as DedupeResult, f as DedupeStrategy, g as DiffEntry2, h as DiffOp2, i as DiffResult2, E as Entity2, j as EntityType2, k as ExtractJsonResult, l as ExtractKeywordsResult, m as ExtractUrlsResult, F as FewShotExample, n as FewShotFormat, o as FewShotFormatResult, I as InjectionDetectResult, p as InjectionFinding, J as JsonBlock, q as JsonRepairResult, K as Keyword, M as MODEL_PRICING, r as MergeResult, s as MergeStrategy, t as ModelPricing, P as PiiDetectResult, u as PiiFinding, v as PiiType, R as RankedChunk, w as RelevanceResult, S as SanitizeResult, x as SecretDetectResult, y as SecretFinding, z as SecretType, A as SummaryResult, T as TableResult2, B as TextChunk, G as TokenEstimate, H as TokenEstimateResult, L as
|
|
1
|
+
export { C as ChunkStrategy, b as CompressHtmlResult, c as CompressJsonResult, d as CompressMarkdownResult, e as CostEstimate, D as DedupeResult, f as DedupeStrategy, g as DiffEntry2, h as DiffOp2, i as DiffResult2, E as Entity2, j as EntityType2, k as ExtractJsonResult, l as ExtractKeywordsResult, m as ExtractUrlsResult, F as FewShotExample, n as FewShotFormat, o as FewShotFormatResult, I as InjectionDetectResult, p as InjectionFinding, J as JsonBlock, q as JsonRepairResult, K as Keyword, M as MODEL_PRICING, r as MergeResult, s as MergeStrategy, t as ModelPricing, P as PiiDetectResult, u as PiiFinding, v as PiiType, R as RankedChunk, w as RelevanceResult, S as SanitizeResult, x as SecretDetectResult, y as SecretFinding, z as SecretType, A as SummaryResult, T as TableResult2, B as TextChunk, G as TokenEstimate, H as TokenEstimateResult, L as ToolSchemaIssue, N as ToolSchemaLintResult, O as TrimResult, Q as TrimStrategy, U as UrlMatch, V as ValidationError, W as ValidationResult, X as VectorSimilarityResult, Y as chunkText, Z as compressHtml, _ as compressJson, $ as compressMarkdown, a0 as deduplicateLines, a1 as detectPii, a2 as detectPromptInjection, a3 as detectSecrets, a4 as diffJson, a5 as estimateCost, a6 as estimateTokens, a7 as expandQuery, a8 as extractEntities, a9 as extractJson, aa as extractKeywords, ab as extractTables, ac as extractUrls, ad as flattenJson, ae as formatFewShotExamples, af as lintToolSchema, ag as mergeJson, ah as redactPii, ai as repairJson, aj as rerankChunks, ak as sanitizeHtml, al as scoreRelevance, am as summarizeForLlm, an as trimToTokens, ao as unflattenJson, ap as validateJsonSchema, aq as vectorSimilarity } from '../ai_agent-CmrVjvYH.js';
|