@finalai/agent-definition 0.1.3 → 0.1.4
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/HOSTING.md +69 -0
- package/dist/compiler-assets/{chunk-BEFBCBUL.ts → chunk-4A66SVBJ.ts} +1 -1
- package/dist/compiler-assets/{chunk-5IZTHCGZ.ts → chunk-5NTKRRMC.ts} +105 -14
- package/dist/compiler-assets/{chunk-OO67EO5E.ts → chunk-APU2VKLW.ts} +42 -3
- package/dist/compiler-assets/{chunk-3YAKMWV4.ts → chunk-RIEMTCTV.ts} +6 -2
- package/dist/compiler-assets/{chunk-JXJPBM5W.ts → chunk-TJ536HI4.ts} +1 -1
- package/dist/compiler-assets/{chunk-I6U47R5U.ts → chunk-UBR53WBH.ts} +20 -4
- package/dist/compiler-assets/{chunk-FHKYXT3F.ts → chunk-YW7HDGQA.ts} +1 -1
- package/dist/compiler-assets/{chunk-TCKYMNPM.ts → chunk-YWFGIPHD.ts} +3 -3
- package/dist/compiler-assets/{chunk-TS7XNNHN.ts → chunk-Z5TO7RSJ.ts} +4 -2
- package/dist/compiler-assets/src/authoring/approval.ts +2 -2
- package/dist/compiler-assets/src/authoring/connections.ts +2 -2
- package/dist/compiler-assets/src/authoring/harness.ts +3 -3
- package/dist/compiler-assets/src/authoring/index.ts +5 -5
- package/dist/compiler-assets/src/authoring/sandbox.ts +2 -2
- package/dist/compiler-assets/src/compatibility.ts +2 -2
- package/dist/compiler-assets/src/index.ts +10 -6
- package/dist/compiler-assets/src/manifest.ts +5 -1
- package/dist/compiler-assets/src/resolve.ts +2 -2
- package/dist/compiler-assets/src/runtime/bundle.ts +5 -5
- package/dist/compiler-assets/src/runtime/describe.ts +4 -4
- package/dist/compiler-assets/src/runtime/described.ts +6 -4
- package/dist/compiler-assets/src/runtime/isolate.ts +4 -4
- package/dist/compiler-assets/src/runtime/lower.ts +3 -3
- package/dist/modules/authoring/agent.d.mts +3 -2
- package/dist/modules/authoring/agent.mjs.map +2 -2
- package/dist/modules/authoring/connections.d.mts +10 -2
- package/dist/modules/authoring/connections.mjs.map +2 -2
- package/dist/modules/authoring/harness.mjs +2 -0
- package/dist/modules/authoring/harness.mjs.map +2 -2
- package/dist/modules/authoring/index.d.mts +1 -1
- package/dist/modules/authoring/index.mjs.map +2 -2
- package/dist/modules/compiler/assemble.mjs +1 -1
- package/dist/modules/compiler/assemble.mjs.map +2 -2
- package/dist/modules/manifest.d.mts +2 -2
- package/dist/modules/manifest.mjs +4 -0
- package/dist/modules/manifest.mjs.map +2 -2
- package/dist/modules/runtime/describe.mjs +17 -3
- package/dist/modules/runtime/describe.mjs.map +2 -2
- package/dist/modules/runtime/described.d.mts +4 -4
- package/dist/modules/runtime/described.mjs +6 -2
- package/dist/modules/runtime/described.mjs.map +2 -2
- package/dist/modules/runtime/lower.mjs +76 -14
- package/dist/modules/runtime/lower.mjs.map +2 -2
- package/fixtures/assistant/agent/agent.ts +7 -0
- package/package.json +3 -3
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
agentAvatarSchema,
|
|
3
|
+
hostedBindingRequirementSchema,
|
|
4
|
+
jsonValueSchema
|
|
5
|
+
} from "@finalai/agent-provider";
|
|
2
6
|
import * as z from "zod";
|
|
3
7
|
import { SlotKind } from "./layout.mjs";
|
|
4
8
|
import { IssueSeverity } from "./lower.mjs";
|
|
@@ -19,7 +23,7 @@ const describedAgentSchema = z.object({
|
|
|
19
23
|
type: z.literal("agent"),
|
|
20
24
|
name: z.string().nullable(),
|
|
21
25
|
description: z.string().nullable(),
|
|
22
|
-
|
|
26
|
+
avatar: agentAvatarSchema.nullable().default(null),
|
|
23
27
|
harness: z.object({ harness: jsonValueSchema, config: jsonValueSchema }).nullable(),
|
|
24
28
|
tools: z.record(z.string(), z.string()).nullable(),
|
|
25
29
|
// Capabilities bound to `harnessHost` (the harness's own host, no target).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/runtime/described.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n agentAvatarSchema,\n hostedBindingRequirementSchema,\n jsonValueSchema,\n} from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport { SlotKind } from \"./layout.mjs\";\nimport { IssueSeverity } from \"./lower.mjs\";\n\n// The static description of a bundle's authored modules, produced inside the\n// evaluation realm and parsed by the compiler. Everything is JSON.\n\nexport const issueSchema = z.object({ severity: z.nativeEnum(IssueSeverity), message: z.string() });\n\nconst providerHintSchema = z.object({\n ref: jsonValueSchema.nullable(),\n name: z.string().nullable(),\n});\n\nexport const describedDynamicSchema = z.object({\n type: z.literal('dynamic'),\n events: z.array(z.string()),\n description: z.string().nullable(),\n preview: z.string().nullable(),\n requiredBindings: z.array(hostedBindingRequirementSchema).optional(),\n provider: providerHintSchema.nullable(),\n});\n\nconst describedAgentSchema = z.object({\n type: z.literal('agent'),\n name: z.string().nullable(),\n description: z.string().nullable(),\n avatar: agentAvatarSchema.nullable().default(null),\n harness: z.object({ harness: jsonValueSchema, config: jsonValueSchema }).nullable(),\n tools: z.record(z.string(), z.string()).nullable(),\n // Capabilities bound to `harnessHost` (the harness's own host, no target).\n hostTools: z.array(z.string()).nullable().default(null),\n toolPolicy: z.record(z.string(), z.string()).nullable(),\n secrets: z.array(z.string()).nullable(),\n channels: z\n .array(\n z.object({ key: z.string().nullable(), channel: jsonValueSchema, config: jsonValueSchema }),\n )\n .nullable(),\n});\n\nconst describedInstructionsSchema = z.object({\n type: z.literal('instructions'),\n role: z.string(),\n content: z.string(),\n});\n\nconst describedSkillSchema = z.object({ type: z.literal('skill'), skill: jsonValueSchema });\n\nconst describedToolSchema = z.object({\n type: z.literal('tool'),\n descriptor: jsonValueSchema,\n approval: z.string(),\n});\n\nconst describedConnectionSchema = z.object({\n type: z.literal('connection'),\n binding: jsonValueSchema,\n});\n\nconst describedScheduleSchema = z.object({\n type: z.literal('schedule'),\n cron: z.string().nullable(),\n markdown: z.string().nullable(),\n timezone: z.string().nullable(),\n target: z.string().nullable(),\n});\n\nconst describedHookSchema = z.object({ type: z.literal('hook'), keys: z.array(z.string()) });\n\nconst describedChannelSchema = z.object({\n type: z.literal('channel'),\n routes: z.array(z.object({ method: z.string(), path: z.string() })),\n turnPolicy: z.string().nullable(),\n config: jsonValueSchema,\n disabled: z.boolean().default(false),\n installed: jsonValueSchema.nullable().default(null),\n});\n\nexport const describedEnvironmentSchema = z.object({\n providerName: z.string(),\n providerRef: jsonValueSchema.nullable(),\n options: jsonValueSchema,\n openOptions: jsonValueSchema.nullable(),\n});\n\nconst describedSandboxTargetSchema = z.object({\n exportName: z.string(),\n environment: describedEnvironmentSchema.nullable(),\n dynamic: describedDynamicSchema.nullable(),\n});\n\nconst describedSandboxSchema = z.object({\n type: z.literal('sandbox'),\n targets: z.record(z.string(), describedSandboxTargetSchema),\n // Bundle export name \u2192 provider name, for providers defined in sandbox.ts.\n providers: z.record(z.string(), z.string()),\n selector: z.boolean(),\n defaultTarget: z.string().nullable(),\n});\n\nexport const describedValueSchema = z.discriminatedUnion('type', [\n describedAgentSchema,\n describedDynamicSchema,\n describedInstructionsSchema,\n describedSkillSchema,\n describedToolSchema,\n describedConnectionSchema,\n describedScheduleSchema,\n describedHookSchema,\n describedChannelSchema,\n describedSandboxSchema,\n]);\n\nexport const describedModuleSchema = z.object({\n base: z.string(),\n path: z.string(),\n slot: z.nativeEnum(SlotKind),\n key: z.string(),\n hasDefault: z.boolean(),\n issues: z.array(issueSchema),\n value: describedValueSchema.nullable(),\n});\n\nexport const describedBundleSchema = z.object({\n modules: z.array(describedModuleSchema),\n // Exports the bundle synthesizes beyond the authored ones.\n synthesized: z.array(z.string()),\n});\n\nexport type DescribedIssueIface = z.infer<typeof issueSchema>;\nexport type DescribedDynamicIface = z.infer<typeof describedDynamicSchema>;\nexport type DescribedAgentIface = z.infer<typeof describedAgentSchema>;\nexport type DescribedSandboxIface = z.infer<typeof describedSandboxSchema>;\nexport type DescribedSandboxTargetIface = z.infer<typeof describedSandboxTargetSchema>;\nexport type DescribedEnvironmentIface = z.infer<typeof describedEnvironmentSchema>;\nexport type DescribedValue = z.infer<typeof describedValueSchema>;\nexport type DescribedModuleIface = z.infer<typeof describedModuleSchema>;\nexport type DescribedBundleIface = z.infer<typeof describedBundleSchema>;\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,YAAY,OAAO;AACnB,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAKvB,MAAM,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,aAAa,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC;AAElG,MAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,KAAK,gBAAgB,SAAS;AAAA,EAC9B,MAAM,EAAE,OAAO,EAAE,SAAS;AAC5B,CAAC;AAEM,MAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,MAAM,EAAE,QAAQ,SAAS;AAAA,EACzB,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EAC1B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,kBAAkB,EAAE,MAAM,8BAA8B,EAAE,SAAS;AAAA,EACnE,UAAU,mBAAmB,SAAS;AACxC,CAAC;AAED,MAAM,uBAAuB,EAAE,OAAO;AAAA,EACpC,MAAM,EAAE,QAAQ,OAAO;AAAA,EACvB,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,QAAQ,kBAAkB,SAAS,EAAE,QAAQ,IAAI;AAAA,EACjD,SAAS,EAAE,OAAO,EAAE,SAAS,iBAAiB,QAAQ,gBAAgB,CAAC,EAAE,SAAS;AAAA,EA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MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,WAAW,QAAQ;AAAA,EAC3B,KAAK,EAAE,OAAO;AAAA,EACd,YAAY,EAAE,QAAQ;AAAA,EACtB,QAAQ,EAAE,MAAM,WAAW;AAAA,EAC3B,OAAO,qBAAqB,SAAS;AACvC,CAAC;AAEM,MAAM,wBAAwB,EAAE,OAAO;AAAA,EAC5C,SAAS,EAAE,MAAM,qBAAqB;AAAA;AAAA,EAEtC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC;AACjC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputApprovalKind,
|
|
3
3
|
InstructionRole,
|
|
4
|
+
isToolDenied,
|
|
4
5
|
McpServerBindingKind,
|
|
5
|
-
ToolApproval
|
|
6
|
+
ToolApproval,
|
|
7
|
+
TOOL_PATTERN_WILDCARD,
|
|
8
|
+
toolAnnotationSelectorSchema,
|
|
9
|
+
toolPatternMatches
|
|
6
10
|
} from "@finalai/agent-provider";
|
|
7
11
|
import * as z from "zod";
|
|
8
12
|
import { lowerApproval } from "../authoring/approval.mjs";
|
|
@@ -223,9 +227,10 @@ const authoredConnectionSchema = z.looseObject({
|
|
|
223
227
|
approval: optionalValueSchema,
|
|
224
228
|
toolCall: optionalValueSchema,
|
|
225
229
|
tools: z.looseObject({
|
|
226
|
-
allow: z.array(z.
|
|
227
|
-
deny: z.array(z.
|
|
228
|
-
approval: authoredRecordSchema.optional()
|
|
230
|
+
allow: z.array(z.unknown()).optional(),
|
|
231
|
+
deny: z.array(z.unknown()).optional(),
|
|
232
|
+
approval: authoredRecordSchema.optional(),
|
|
233
|
+
load: z.array(z.string()).optional()
|
|
229
234
|
}).optional()
|
|
230
235
|
});
|
|
231
236
|
const connectionAuthSchema = z.union([
|
|
@@ -250,6 +255,25 @@ const lowerAuth = (value, path, issues) => {
|
|
|
250
255
|
);
|
|
251
256
|
return null;
|
|
252
257
|
};
|
|
258
|
+
const splitToolEntries = (args) => {
|
|
259
|
+
const names = [];
|
|
260
|
+
const selectors = [];
|
|
261
|
+
for (const entry of args.entries) {
|
|
262
|
+
if (isString(entry)) {
|
|
263
|
+
names.push(entry);
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const parsed = toolAnnotationSelectorSchema.safeParse(entry);
|
|
267
|
+
if (parsed.success) selectors.push(parsed.data);
|
|
268
|
+
else
|
|
269
|
+
args.issues.push(
|
|
270
|
+
error(
|
|
271
|
+
`${args.label} entries must be tool names, * patterns, or annotation selectors such as { readOnlyHint: true }`
|
|
272
|
+
)
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
return { names, selectors };
|
|
276
|
+
};
|
|
253
277
|
const lowerConnection = (args) => {
|
|
254
278
|
const issues = [];
|
|
255
279
|
const path = `connection ${args.key}`;
|
|
@@ -288,12 +312,29 @@ const lowerConnection = (args) => {
|
|
|
288
312
|
const overrides = Object.fromEntries(overrideEntries);
|
|
289
313
|
const inputApprovals = Object.fromEntries(inputApprovalEntries);
|
|
290
314
|
for (const key of staticOverrideKeys) delete inputApprovals[key];
|
|
291
|
-
const defaultPolicy = overrides[
|
|
292
|
-
const
|
|
315
|
+
const defaultPolicy = overrides[TOOL_PATTERN_WILDCARD] ?? defaultApproval.policy;
|
|
316
|
+
const allowEntries = tools?.allow == null ? null : splitToolEntries({ entries: tools.allow, label: `${path} tools.allow`, issues });
|
|
317
|
+
const allow = allowEntries?.names ?? null;
|
|
318
|
+
const allowSelectors = allowEntries?.selectors ?? [];
|
|
319
|
+
const denyEntries = splitToolEntries({
|
|
320
|
+
entries: tools?.deny ?? [],
|
|
321
|
+
label: `${path} tools.deny`,
|
|
322
|
+
issues
|
|
323
|
+
});
|
|
324
|
+
const deny = denyEntries.names;
|
|
325
|
+
const authoredEntries = {
|
|
326
|
+
allow: allow ?? [],
|
|
327
|
+
deny,
|
|
328
|
+
approval: Object.keys(overrides)
|
|
329
|
+
};
|
|
330
|
+
for (const [field, entries] of Object.entries(authoredEntries)) {
|
|
331
|
+
if (entries.some((entry) => entry.trim().length === 0))
|
|
332
|
+
issues.push(error(`${path} tools.${field} entries must be tool names or * patterns`));
|
|
333
|
+
}
|
|
334
|
+
const inherited = Object.hasOwn(inputApprovals, "*") ? inputApprovals["*"] : void 0;
|
|
293
335
|
let approvals = null;
|
|
294
336
|
if (allow != null) {
|
|
295
337
|
approvals = Object.fromEntries(allow.map((tool) => [tool, overrides[tool] ?? defaultPolicy]));
|
|
296
|
-
const inherited = Object.hasOwn(inputApprovals, "*") ? inputApprovals["*"] : void 0;
|
|
297
338
|
if (inherited != null) {
|
|
298
339
|
for (const tool of allow) {
|
|
299
340
|
if (!Object.hasOwn(overrides, tool))
|
|
@@ -306,20 +347,33 @@ const lowerConnection = (args) => {
|
|
|
306
347
|
}
|
|
307
348
|
}
|
|
308
349
|
for (const tool of Object.keys(overrides)) {
|
|
309
|
-
if (
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
350
|
+
if (tool === TOOL_PATTERN_WILDCARD || allow.includes(tool)) continue;
|
|
351
|
+
if (allow.some((pattern) => toolPatternMatches(pattern, tool))) {
|
|
352
|
+
approvals[tool] = overrides[tool] ?? defaultPolicy;
|
|
353
|
+
continue;
|
|
313
354
|
}
|
|
355
|
+
issues.push(
|
|
356
|
+
warning(
|
|
357
|
+
allowSelectors.length > 0 ? `${path} sets an approval for ${tool}, which tools.allow does not name; approvals apply only to named tools` : `${path} sets an approval for ${tool}, which tools.allow does not expose`
|
|
358
|
+
)
|
|
359
|
+
);
|
|
314
360
|
}
|
|
315
361
|
} else if (defaultApproval.policy === ToolApproval.Ask || Object.keys(overrides).length > 0) {
|
|
316
362
|
approvals = { "*": defaultApproval.policy, ...overrides };
|
|
317
363
|
}
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
if (Object.hasOwn(overrides, tool))
|
|
364
|
+
for (const tool of Object.keys(overrides)) {
|
|
365
|
+
if (tool !== TOOL_PATTERN_WILDCARD && isToolDenied(deny, tool))
|
|
321
366
|
issues.push(warning(`${path} sets an approval for ${tool}, which tools.deny hides`));
|
|
322
367
|
}
|
|
368
|
+
const load = tools?.load ?? null;
|
|
369
|
+
if (load?.some((tool) => tool.trim().length === 0) === true)
|
|
370
|
+
issues.push(error(`${path} tools.load entries must be tool names or * patterns`));
|
|
371
|
+
for (const tool of load ?? []) {
|
|
372
|
+
if (isToolDenied(deny, tool))
|
|
373
|
+
issues.push(warning(`${path} loads ${tool}, which tools.deny hides`));
|
|
374
|
+
else if (allow != null && allowSelectors.length === 0 && !allow.some((pattern) => toolPatternMatches(pattern, tool)))
|
|
375
|
+
issues.push(warning(`${path} loads ${tool}, which tools.allow does not expose`));
|
|
376
|
+
}
|
|
323
377
|
if (connection?.toolCall != null)
|
|
324
378
|
issues.push(error(`${path} uses toolCall.providedArguments, which is not supported`));
|
|
325
379
|
const binding = {
|
|
@@ -331,6 +385,14 @@ const lowerConnection = (args) => {
|
|
|
331
385
|
approvals
|
|
332
386
|
};
|
|
333
387
|
if (deny.length > 0) binding.deny = [...new Set(deny)];
|
|
388
|
+
if (load != null) binding.load = [...new Set(load)];
|
|
389
|
+
if (allowSelectors.length > 0)
|
|
390
|
+
binding.allowAnnotations = allowSelectors.map((match) => ({
|
|
391
|
+
match,
|
|
392
|
+
approval: defaultPolicy,
|
|
393
|
+
...inherited == null ? {} : { inputApproval: inherited }
|
|
394
|
+
}));
|
|
395
|
+
if (denyEntries.selectors.length > 0) binding.denyAnnotations = denyEntries.selectors;
|
|
334
396
|
if (Object.keys(inputApprovals).length > 0) binding.inputApprovals = inputApprovals;
|
|
335
397
|
return { binding, issues };
|
|
336
398
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/runtime/lower.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n InputApprovalKind,\n InstructionRole,\n McpServerBindingKind,\n ToolApproval,\n type HttpMcpServerBindingIface,\n type InputApprovalIface,\n type InstructionFragmentIface,\n type JsonObject,\n type JsonValue,\n type SkillBundleIface,\n type ToolDescriptorIface,\n} from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport { lowerApproval } from \"../authoring/approval.mjs\";\nimport {\n AuthoredKind,\n authoredKindOf,\n pendingExportName,\n pendingIndexOf,\n} from \"../authoring/brand.mjs\";\nimport { toolLabelSchema } from \"../authoring/tools.mjs\";\nimport { jsonSchemaDeclarationError, SchemaIo } from \"./schema-validation.mjs\";\nimport {\n authoredRecordSchema,\n authoredValueSchema,\n callableSchema,\n entriesOf,\n fieldOf,\n isBoolean,\n isCallable,\n isNumber,\n isObjectLike,\n isPlainObject,\n isString,\n messageOf,\n optionalValueSchema,\n type AuthoredValue,\n} from \"./values.mjs\";\n\n// Lowering of authored values to manifest JSON. Runs inside the realm that\n// evaluated the authored modules (the compiler's vm context, or the agent's\n// Worker isolate for dynamic resolver outputs), so it never crosses realms\n// with live values.\n\nexport enum IssueSeverity {\n Error = 'error',\n Warning = 'warning',\n Note = 'note',\n}\n\nexport interface IssueIface {\n severity: IssueSeverity;\n message: string;\n}\n\nexport const error = (message: string): IssueIface => ({ severity: IssueSeverity.Error, message });\nexport const warning = (message: string): IssueIface => ({\n severity: IssueSeverity.Warning,\n message,\n});\nexport const note = (message: string): IssueIface => ({ severity: IssueSeverity.Note, message });\n\nexport const childPath = (parent: string, key: string | number): string => {\n if (isNumber(key)) return `${parent}[${key}]`;\n return parent.length === 0 ? key : `${parent}.${key}`;\n};\n\nexport interface ToJsonOptionsIface {\n path: string;\n issues: IssueIface[];\n // Replaces an authored value (a dynamic sentinel) with its manifest form;\n // return undefined to fall back to the default conversion.\n visit?: (value: AuthoredValue, path: string) => JsonValue | undefined;\n}\n\nconst PENDING_PLACEHOLDER = /^<pending:\\d+>$/;\n\nconst label = (path: string): string => (path.length === 0 ? 'value' : path);\n\n// Plain JSON conversion with diagnostics for values JSON cannot hold.\nexport const toJson = (value: AuthoredValue, options: ToJsonOptionsIface): JsonValue => {\n const visited = options.visit?.(value, options.path);\n if (visited !== undefined) return visited;\n if (value == null) return null;\n if (isString(value)) {\n const index = PENDING_PLACEHOLDER.test(value) ? pendingIndexOf(value) : null;\n return index == null ? value : pendingExportName(index);\n }\n if (isNumber(value)) {\n if (Number.isFinite(value)) return value;\n options.issues.push(error(`${label(options.path)} is not a finite number`));\n return null;\n }\n if (isBoolean(value)) return value;\n if (Array.isArray(value)) {\n return value.map((item, index) =>\n toJson(item, { ...options, path: childPath(options.path, index) }),\n );\n }\n if (isCallable(value)) {\n options.issues.push(\n error(`${label(options.path)} is a function; only static values can appear here`),\n );\n return null;\n }\n if (isPlainObject(value) || authoredKindOf(value) != null) {\n const out: JsonObject = {};\n for (const [key, item] of entriesOf(value)) {\n if (item === undefined) continue;\n out[key] = toJson(item, { ...options, path: childPath(options.path, key) });\n }\n return out;\n }\n options.issues.push(\n error(`${label(options.path)} is not JSON (${Object.prototype.toString.call(value)})`),\n );\n return null;\n};\n\nconst jsonSchemaObjectSchema = z.record(z.string(), authoredValueSchema);\n\nconst standardJsonSchemaSchema = z.looseObject({\n '~standard': z.looseObject({\n jsonSchema: z\n .looseObject({ input: callableSchema, output: callableSchema.optional() })\n .optional(),\n }),\n});\n\nconst isZodSchema = (value: AuthoredValue): value is z.ZodType => value instanceof z.ZodType;\n\n// Tool input/output schemas: Standard JSON Schema (zod 4 and others), a zod\n// schema, or a JSON Schema document.\nexport const toJsonSchema = (args: {\n schema: AuthoredValue;\n path: string;\n issues: IssueIface[];\n io?: SchemaIo;\n}): JsonObject | null => {\n const { schema, path, issues } = args;\n const io = args.io ?? SchemaIo.Input;\n const standard = standardJsonSchemaSchema.safeParse(schema);\n const jsonSchema = fieldOf(fieldOf(schema, '~standard'), 'jsonSchema');\n let converted: AuthoredValue = null;\n if (standard.success && standard.data['~standard'].jsonSchema != null) {\n try {\n const convert = standard.data['~standard'].jsonSchema[io];\n if (convert == null) throw new Error(`Standard JSON Schema has no ${io} converter`);\n converted = convert.call(jsonSchema, {\n target: 'draft-2020-12',\n });\n } catch (cause) {\n issues.push(error(`${path} could not be converted to JSON Schema: ${messageOf(cause)}`));\n return null;\n }\n } else if (isZodSchema(schema)) {\n converted = z.toJSONSchema(schema, { io });\n } else if (standard.success) {\n issues.push(\n error(\n `${path} is a Standard Schema without JSON Schema support; use zod 4 or a JSON Schema object`,\n ),\n );\n return null;\n } else if (isPlainObject(schema)) {\n converted = schema;\n } else {\n issues.push(error(`${path} must be a zod schema or a JSON Schema object`));\n return null;\n }\n const json = toJson(converted, { path, issues });\n if (\n json == null ||\n Array.isArray(json) ||\n !jsonSchemaObjectSchema.safeParse(json).success ||\n !isPlainObject(json)\n ) {\n issues.push(error(`${path} did not produce a JSON Schema object`));\n return null;\n }\n const out: JsonObject = {};\n for (const [key, item] of Object.entries(json)) {\n if (key !== '$schema' || (!standard.success && !isZodSchema(schema))) out[key] = item;\n }\n const declarationError = jsonSchemaDeclarationError(out);\n if (declarationError != null) {\n issues.push(error(`${path} is an invalid JSON Schema: ${declarationError}`));\n return null;\n }\n return out;\n};\n\nconst authoredToolSchema = z.looseObject({\n description: optionalValueSchema,\n execute: optionalValueSchema,\n inputSchema: optionalValueSchema,\n outputSchema: optionalValueSchema,\n endsTurn: optionalValueSchema,\n approval: optionalValueSchema,\n label: optionalValueSchema,\n annotations: z\n .looseObject({\n title: z.string().optional(),\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n })\n .optional()\n .catch(undefined),\n});\n\nexport interface LoweredToolIface {\n descriptor: ToolDescriptorIface;\n approval: ToolApproval;\n issues: IssueIface[];\n}\n\nexport const lowerTool = (args: {\n name: string;\n exportName: string;\n value: AuthoredValue;\n}): LoweredToolIface => {\n const issues: IssueIface[] = [];\n const path = `tool ${args.name}`;\n const parsed = authoredToolSchema.safeParse(args.value);\n if (!parsed.success) {\n issues.push(error(`${path} must be defineTool({ description, inputSchema, execute })`));\n return {\n descriptor: {\n name: args.name,\n description: '',\n inputSchema: { type: 'object' },\n export: args.exportName,\n },\n approval: ToolApproval.Ask,\n issues,\n };\n }\n const tool = parsed.data;\n const description = isString(tool.description) ? tool.description : '';\n if (description.length === 0) issues.push(error(`${path} needs a description`));\n if (!isCallable(tool.execute)) issues.push(error(`${path} needs an execute function`));\n const inputSchema = toJsonSchema({\n schema: tool.inputSchema,\n path: `${path} inputSchema`,\n issues,\n }) ?? {\n type: 'object',\n };\n if (tool.endsTurn != null && tool.endsTurn !== false) {\n issues.push(\n error(`${path} sets endsTurn; it is not supported because the harness owns the loop`),\n );\n }\n const approval = lowerApproval(tool.approval);\n if (approval.error != null) issues.push(error(`${path}: ${approval.error}`));\n if (approval.note != null) issues.push(note(`${path}: ${approval.note}`));\n const descriptor: ToolDescriptorIface = {\n name: args.name,\n description,\n inputSchema,\n export: args.exportName,\n };\n if (approval.inputDependent)\n descriptor.inputApproval = { kind: InputApprovalKind.Tool, export: args.exportName };\n if (tool.outputSchema != null) {\n const outputSchema = toJsonSchema({\n schema: tool.outputSchema,\n path: `${path} outputSchema`,\n issues,\n io: SchemaIo.Output,\n });\n if (outputSchema != null) descriptor.outputSchema = outputSchema;\n }\n const annotations: NonNullable<ToolDescriptorIface['annotations']> = { ...tool.annotations };\n if (tool.label != null && !toolLabelSchema.safeParse(tool.label).success)\n issues.push(error(`${path} label must be text or { start, delta?, complete? } callbacks`));\n if (isString(tool.label)) annotations.title = tool.label;\n if (Object.keys(annotations).length > 0) descriptor.annotations = annotations;\n return { descriptor, approval: approval.policy, issues };\n};\n\nconst authoredConnectionSchema = z.looseObject({\n url: optionalValueSchema,\n auth: optionalValueSchema,\n headers: optionalValueSchema,\n approval: optionalValueSchema,\n toolCall: optionalValueSchema,\n tools: z\n .looseObject({\n allow: z.array(z.string()).optional(),\n deny: z.array(z.string()).optional(),\n approval: authoredRecordSchema.optional(),\n })\n .optional(),\n});\n\nconst connectionAuthSchema = z.union([\n z\n .object({ kind: z.literal('final-session') })\n .transform(() => ({ kind: 'final-session' as const })),\n z\n .looseObject({ secretKey: z.string().min(1), headerName: z.string().nullish() })\n .transform((auth) => ({ secretKey: auth.secretKey, headerName: auth.headerName ?? null })),\n]);\n\nexport interface LoweredConnectionIface {\n binding: HttpMcpServerBindingIface;\n issues: IssueIface[];\n}\n\nconst stringRecord = (\n value: AuthoredValue,\n path: string,\n issues: IssueIface[],\n): Record<string, string> => {\n if (value == null) return {};\n const parsed = z.record(z.string(), z.string()).safeParse(value);\n if (parsed.success) return parsed.data;\n issues.push(error(`${path} must be a record of strings (header callbacks are not supported)`));\n return {};\n};\n\nconst lowerAuth = (\n value: AuthoredValue,\n path: string,\n issues: IssueIface[],\n): HttpMcpServerBindingIface['auth'] => {\n if (value == null) return null;\n const parsed = connectionAuthSchema.safeParse(value);\n if (parsed.success) return parsed.data;\n issues.push(\n error(\n `${path} must be { secretKey, headerName } or { kind: 'final-session' }; auth providers and callbacks are not supported`,\n ),\n );\n return null;\n};\n\nexport const lowerConnection = (args: {\n key: string;\n exportName: string;\n value: AuthoredValue;\n}): LoweredConnectionIface => {\n const issues: IssueIface[] = [];\n const path = `connection ${args.key}`;\n const parsed = authoredConnectionSchema.safeParse(args.value);\n const connection = parsed.success ? parsed.data : null;\n if (connection == null)\n issues.push(error(`${path} must be defineMcpClientConnection({ url, ... })`));\n const url = isString(connection?.url) ? connection.url : null;\n if (url == null || !z.url().safeParse(url).success)\n issues.push(error(`${path} needs a valid url`));\n const tools = connection?.tools;\n const defaultApproval = lowerApproval(connection?.approval);\n if (defaultApproval.error != null) issues.push(error(`${path}: ${defaultApproval.error}`));\n if (defaultApproval.note != null) issues.push(note(`${path}: ${defaultApproval.note}`));\n const overrideEntries: [string, ToolApproval][] = [];\n const inputApprovalEntries: [string, InputApprovalIface][] = [];\n const staticOverrideKeys: string[] = [];\n if (defaultApproval.inputDependent)\n inputApprovalEntries.push([\n '*',\n { kind: InputApprovalKind.Connection, export: args.exportName },\n ]);\n for (const [tool, approval] of Object.entries(tools?.approval ?? {})) {\n const lowered = lowerApproval(approval);\n if (lowered.error != null)\n issues.push(error(`${path} tools.approval.${tool}: ${lowered.error}`));\n if (lowered.note != null) issues.push(note(`${path} tools.approval.${tool}: ${lowered.note}`));\n overrideEntries.push([tool, lowered.policy]);\n if (lowered.inputDependent)\n inputApprovalEntries.push([\n tool,\n { kind: InputApprovalKind.Connection, export: args.exportName, policyKey: tool },\n ]);\n else staticOverrideKeys.push(tool);\n }\n const overrides = Object.fromEntries(overrideEntries);\n const inputApprovals = Object.fromEntries(inputApprovalEntries);\n for (const key of staticOverrideKeys) delete inputApprovals[key];\n const defaultPolicy = overrides['*'] ?? defaultApproval.policy;\n const allow = tools?.allow ?? null;\n let approvals: Record<string, ToolApproval> | null = null;\n if (allow != null) {\n approvals = Object.fromEntries(allow.map((tool) => [tool, overrides[tool] ?? defaultPolicy]));\n const inherited = Object.hasOwn(inputApprovals, '*') ? inputApprovals['*'] : undefined;\n if (inherited != null) {\n for (const tool of allow) {\n if (!Object.hasOwn(overrides, tool))\n Object.defineProperty(inputApprovals, tool, {\n value: inherited,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n }\n }\n for (const tool of Object.keys(overrides)) {\n if (!allow.includes(tool)) {\n issues.push(\n warning(`${path} sets an approval for ${tool}, which tools.allow does not expose`),\n );\n }\n }\n } else if (defaultApproval.policy === ToolApproval.Ask || Object.keys(overrides).length > 0) {\n // '*' applies to every listed tool without its own entry.\n approvals = { '*': defaultApproval.policy, ...overrides };\n }\n const deny = tools?.deny ?? [];\n for (const tool of deny) {\n if (Object.hasOwn(overrides, tool))\n issues.push(warning(`${path} sets an approval for ${tool}, which tools.deny hides`));\n }\n if (connection?.toolCall != null)\n issues.push(error(`${path} uses toolCall.providedArguments, which is not supported`));\n const binding: HttpMcpServerBindingIface = {\n key: args.key,\n kind: McpServerBindingKind.Http,\n url: url ?? 'https://invalid.invalid',\n auth: lowerAuth(connection?.auth, `${path} auth`, issues),\n headers: stringRecord(connection?.headers, `${path} headers`, issues),\n approvals,\n };\n if (deny.length > 0) binding.deny = [...new Set(deny)];\n if (Object.keys(inputApprovals).length > 0) binding.inputApprovals = inputApprovals;\n return { binding, issues };\n};\n\nexport const skillMarkdown = (args: {\n key: string;\n description: string;\n markdown: string;\n}): string =>\n args.markdown.startsWith('---\\n')\n ? args.markdown\n : `---\\nname: ${JSON.stringify(args.key)}\\ndescription: ${JSON.stringify(args.description)}\\n---\\n\\n${args.markdown}`;\n\nconst authoredSkillSchema = z.looseObject({\n description: optionalValueSchema,\n markdown: optionalValueSchema,\n files: authoredRecordSchema.optional().catch(undefined),\n});\n\nexport interface LoweredSkillIface {\n skill: SkillBundleIface;\n issues: IssueIface[];\n}\n\nexport const lowerSkill = (args: { key: string; value: AuthoredValue }): LoweredSkillIface => {\n const issues: IssueIface[] = [];\n const parsed = authoredSkillSchema.safeParse(args.value);\n const description =\n parsed.success && isString(parsed.data.description) ? parsed.data.description : null;\n const markdown = parsed.success && isString(parsed.data.markdown) ? parsed.data.markdown : null;\n if (description == null || description.length === 0)\n issues.push(error(`skill ${args.key} needs a description`));\n if (markdown == null) issues.push(error(`skill ${args.key} needs markdown`));\n const files: SkillBundleIface['files'] = [\n {\n path: 'SKILL.md',\n content: skillMarkdown({\n key: args.key,\n description: description ?? '',\n markdown: markdown ?? '',\n }),\n },\n ];\n for (const [path, content] of Object.entries(\n (parsed.success ? parsed.data.files : undefined) ?? {},\n )) {\n if (path.startsWith('/') || path.split(/[\\\\/]/).includes('..')) {\n issues.push(error(`skill ${args.key} file ${path} must stay inside the skill directory`));\n } else if (!isString(content)) {\n issues.push(warning(`skill ${args.key} file ${path} is binary and was left out`));\n } else if (path !== 'SKILL.md') files.push({ path, content });\n }\n const skill: SkillBundleIface = { key: args.key, files };\n if (description != null) skill.description = description;\n return { skill, issues };\n};\n\nconst authoredInstructionsSchema = z.looseObject({\n content: z.string(),\n role: z.string().optional(),\n});\n\nexport const lowerInstructions = (\n value: AuthoredValue,\n source: string | null,\n): InstructionFragmentIface | null => {\n const parsed = authoredInstructionsSchema.safeParse(value);\n if (!parsed.success) return null;\n const fragment: InstructionFragmentIface = {\n role: parsed.data.role === InstructionRole.User ? InstructionRole.User : InstructionRole.System,\n content: parsed.data.content,\n };\n if (source != null) fragment.source = source;\n return fragment;\n};\n\nexport interface LoweredEnvironmentIface {\n providerName: string;\n providerRef: JsonValue | null;\n options: JsonValue;\n openOptions: JsonValue | null;\n}\n\nconst environmentSchema = z.looseObject({\n providerName: z.string(),\n providerRef: optionalValueSchema,\n options: optionalValueSchema,\n open: callableSchema,\n});\n\nconst openRequestSchema = z.looseObject({\n providerName: z.string(),\n providerRef: optionalValueSchema,\n environmentOptions: optionalValueSchema,\n openOptions: optionalValueSchema,\n});\n\nconst sandboxProviderSchema = z.looseObject({\n name: z.string(),\n environment: callableSchema,\n definition: z.looseObject({}),\n});\n\nexport const isEnvironmentLike = (value: AuthoredValue): boolean =>\n environmentSchema.safeParse(value).success;\n\nexport const isOpenRequestLike = (value: AuthoredValue): boolean =>\n openRequestSchema.safeParse(value).success &&\n isObjectLike(value) &&\n 'environmentOptions' in value;\n\nexport const sandboxProviderNameOf = (value: AuthoredValue): string | null => {\n const parsed = sandboxProviderSchema.safeParse(value);\n return parsed.success ? parsed.data.name : null;\n};\n\nexport const lowerEnvironment = (\n value: AuthoredValue,\n path: string,\n issues: IssueIface[],\n): LoweredEnvironmentIface | null => {\n const warnings = z.array(z.string()).safeParse(fieldOf(value, 'authoringWarnings'));\n if (warnings.success)\n for (const message of warnings.data) issues.push(warning(`${path}: ${message}`));\n const request = isOpenRequestLike(value) ? openRequestSchema.safeParse(value) : null;\n if (request?.success === true) {\n return {\n providerName: request.data.providerName,\n providerRef:\n request.data.providerRef == null\n ? null\n : toJson(request.data.providerRef, { path, issues }),\n options: toJson(request.data.environmentOptions ?? {}, { path: `${path} options`, issues }),\n openOptions: toJson(request.data.openOptions ?? null, {\n path: `${path} open options`,\n issues,\n }),\n };\n }\n const environment = environmentSchema.safeParse(value);\n if (!environment.success) return null;\n return {\n providerName: environment.data.providerName,\n providerRef:\n environment.data.providerRef == null\n ? null\n : toJson(environment.data.providerRef, { path, issues }),\n options: toJson(environment.data.options ?? {}, { path: `${path} options`, issues }),\n openOptions: null,\n };\n};\n\nexport const isDynamicSentinel = (value: AuthoredValue): boolean =>\n authoredKindOf(value) === AuthoredKind.Dynamic;\n\nexport const dynamicEventsOf = (value: AuthoredValue): string[] =>\n entriesOf(fieldOf(value, 'events'))\n .filter(([, handler]) => isCallable(handler))\n .map(([event]) => event);\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAQK;AACP,YAAY,OAAO;AACnB,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,4BAA4B,gBAAgB;AACrD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAOA,IAAK,gBAAL,kBAAKA,mBAAL;AACL,EAAAA,eAAA,WAAQ;AACR,EAAAA,eAAA,aAAU;AACV,EAAAA,eAAA,UAAO;AAHG,SAAAA;AAAA,GAAA;AAWL,MAAM,QAAQ,CAAC,aAAiC,EAAE,UAAU,qBAAqB,QAAQ;AACzF,MAAM,UAAU,CAAC,aAAiC;AAAA,EACvD,UAAU;AAAA,EACV;AACF;AACO,MAAM,OAAO,CAAC,aAAiC,EAAE,UAAU,mBAAoB,QAAQ;AAEvF,MAAM,YAAY,CAAC,QAAgB,QAAiC;AACzE,MAAI,SAAS,GAAG,EAAG,QAAO,GAAG,MAAM,IAAI,GAAG;AAC1C,SAAO,OAAO,WAAW,IA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UAC9B,UAAU,QAAQ,OAAO,QAAQ,CAAC,EAC/B,OAAO,CAAC,CAAC,EAAE,OAAO,MAAM,WAAW,OAAO,CAAC,EAC3C,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;",
|
|
4
|
+
"sourcesContent": ["import {\n InputApprovalKind,\n InstructionRole,\n isToolDenied,\n McpServerBindingKind,\n ToolApproval,\n TOOL_PATTERN_WILDCARD,\n toolAnnotationSelectorSchema,\n toolPatternMatches,\n type HttpMcpServerBindingIface,\n type InputApprovalIface,\n type InstructionFragmentIface,\n type JsonObject,\n type JsonValue,\n type SkillBundleIface,\n type ToolAnnotationSelectorIface,\n type ToolDescriptorIface,\n} from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport { lowerApproval } from \"../authoring/approval.mjs\";\nimport {\n AuthoredKind,\n authoredKindOf,\n pendingExportName,\n pendingIndexOf,\n} from \"../authoring/brand.mjs\";\nimport { toolLabelSchema } from \"../authoring/tools.mjs\";\nimport { jsonSchemaDeclarationError, SchemaIo } from \"./schema-validation.mjs\";\nimport {\n authoredRecordSchema,\n authoredValueSchema,\n callableSchema,\n entriesOf,\n fieldOf,\n isBoolean,\n isCallable,\n isNumber,\n isObjectLike,\n isPlainObject,\n isString,\n messageOf,\n optionalValueSchema,\n type AuthoredValue,\n} from \"./values.mjs\";\n\n// Lowering of authored values to manifest JSON. Runs inside the realm that\n// evaluated the authored modules (the compiler's vm context, or the agent's\n// Worker isolate for dynamic resolver outputs), so it never crosses realms\n// with live values.\n\nexport enum IssueSeverity {\n Error = 'error',\n Warning = 'warning',\n Note = 'note',\n}\n\nexport interface IssueIface {\n severity: IssueSeverity;\n message: string;\n}\n\nexport const error = (message: string): IssueIface => ({ severity: IssueSeverity.Error, message });\nexport const warning = (message: string): IssueIface => ({\n severity: IssueSeverity.Warning,\n message,\n});\nexport const note = (message: string): IssueIface => ({ severity: IssueSeverity.Note, message });\n\nexport const childPath = (parent: string, key: string | number): string => {\n if (isNumber(key)) return `${parent}[${key}]`;\n return parent.length === 0 ? key : `${parent}.${key}`;\n};\n\nexport interface ToJsonOptionsIface {\n path: string;\n issues: IssueIface[];\n // Replaces an authored value (a dynamic sentinel) with its manifest form;\n // return undefined to fall back to the default conversion.\n visit?: (value: AuthoredValue, path: string) => JsonValue | undefined;\n}\n\nconst PENDING_PLACEHOLDER = /^<pending:\\d+>$/;\n\nconst label = (path: string): string => (path.length === 0 ? 'value' : path);\n\n// Plain JSON conversion with diagnostics for values JSON cannot hold.\nexport const toJson = (value: AuthoredValue, options: ToJsonOptionsIface): JsonValue => {\n const visited = options.visit?.(value, options.path);\n if (visited !== undefined) return visited;\n if (value == null) return null;\n if (isString(value)) {\n const index = PENDING_PLACEHOLDER.test(value) ? pendingIndexOf(value) : null;\n return index == null ? value : pendingExportName(index);\n }\n if (isNumber(value)) {\n if (Number.isFinite(value)) return value;\n options.issues.push(error(`${label(options.path)} is not a finite number`));\n return null;\n }\n if (isBoolean(value)) return value;\n if (Array.isArray(value)) {\n return value.map((item, index) =>\n toJson(item, { ...options, path: childPath(options.path, index) }),\n );\n }\n if (isCallable(value)) {\n options.issues.push(\n error(`${label(options.path)} is a function; only static values can appear here`),\n );\n return null;\n }\n if (isPlainObject(value) || authoredKindOf(value) != null) {\n const out: JsonObject = {};\n for (const [key, item] of entriesOf(value)) {\n if (item === undefined) continue;\n out[key] = toJson(item, { ...options, path: childPath(options.path, key) });\n }\n return out;\n }\n options.issues.push(\n error(`${label(options.path)} is not JSON (${Object.prototype.toString.call(value)})`),\n );\n return null;\n};\n\nconst jsonSchemaObjectSchema = z.record(z.string(), authoredValueSchema);\n\nconst standardJsonSchemaSchema = z.looseObject({\n '~standard': z.looseObject({\n jsonSchema: z\n .looseObject({ input: callableSchema, output: callableSchema.optional() })\n .optional(),\n }),\n});\n\nconst isZodSchema = (value: AuthoredValue): value is z.ZodType => value instanceof z.ZodType;\n\n// Tool input/output schemas: Standard JSON Schema (zod 4 and others), a zod\n// schema, or a JSON Schema document.\nexport const toJsonSchema = (args: {\n schema: AuthoredValue;\n path: string;\n issues: IssueIface[];\n io?: SchemaIo;\n}): JsonObject | null => {\n const { schema, path, issues } = args;\n const io = args.io ?? SchemaIo.Input;\n const standard = standardJsonSchemaSchema.safeParse(schema);\n const jsonSchema = fieldOf(fieldOf(schema, '~standard'), 'jsonSchema');\n let converted: AuthoredValue = null;\n if (standard.success && standard.data['~standard'].jsonSchema != null) {\n try {\n const convert = standard.data['~standard'].jsonSchema[io];\n if (convert == null) throw new Error(`Standard JSON Schema has no ${io} converter`);\n converted = convert.call(jsonSchema, {\n target: 'draft-2020-12',\n });\n } catch (cause) {\n issues.push(error(`${path} could not be converted to JSON Schema: ${messageOf(cause)}`));\n return null;\n }\n } else if (isZodSchema(schema)) {\n converted = z.toJSONSchema(schema, { io });\n } else if (standard.success) {\n issues.push(\n error(\n `${path} is a Standard Schema without JSON Schema support; use zod 4 or a JSON Schema object`,\n ),\n );\n return null;\n } else if (isPlainObject(schema)) {\n converted = schema;\n } else {\n issues.push(error(`${path} must be a zod schema or a JSON Schema object`));\n return null;\n }\n const json = toJson(converted, { path, issues });\n if (\n json == null ||\n Array.isArray(json) ||\n !jsonSchemaObjectSchema.safeParse(json).success ||\n !isPlainObject(json)\n ) {\n issues.push(error(`${path} did not produce a JSON Schema object`));\n return null;\n }\n const out: JsonObject = {};\n for (const [key, item] of Object.entries(json)) {\n if (key !== '$schema' || (!standard.success && !isZodSchema(schema))) out[key] = item;\n }\n const declarationError = jsonSchemaDeclarationError(out);\n if (declarationError != null) {\n issues.push(error(`${path} is an invalid JSON Schema: ${declarationError}`));\n return null;\n }\n return out;\n};\n\nconst authoredToolSchema = z.looseObject({\n description: optionalValueSchema,\n execute: optionalValueSchema,\n inputSchema: optionalValueSchema,\n outputSchema: optionalValueSchema,\n endsTurn: optionalValueSchema,\n approval: optionalValueSchema,\n label: optionalValueSchema,\n annotations: z\n .looseObject({\n title: z.string().optional(),\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n })\n .optional()\n .catch(undefined),\n});\n\nexport interface LoweredToolIface {\n descriptor: ToolDescriptorIface;\n approval: ToolApproval;\n issues: IssueIface[];\n}\n\nexport const lowerTool = (args: {\n name: string;\n exportName: string;\n value: AuthoredValue;\n}): LoweredToolIface => {\n const issues: IssueIface[] = [];\n const path = `tool ${args.name}`;\n const parsed = authoredToolSchema.safeParse(args.value);\n if (!parsed.success) {\n issues.push(error(`${path} must be defineTool({ description, inputSchema, execute })`));\n return {\n descriptor: {\n name: args.name,\n description: '',\n inputSchema: { type: 'object' },\n export: args.exportName,\n },\n approval: ToolApproval.Ask,\n issues,\n };\n }\n const tool = parsed.data;\n const description = isString(tool.description) ? tool.description : '';\n if (description.length === 0) issues.push(error(`${path} needs a description`));\n if (!isCallable(tool.execute)) issues.push(error(`${path} needs an execute function`));\n const inputSchema = toJsonSchema({\n schema: tool.inputSchema,\n path: `${path} inputSchema`,\n issues,\n }) ?? {\n type: 'object',\n };\n if (tool.endsTurn != null && tool.endsTurn !== false) {\n issues.push(\n error(`${path} sets endsTurn; it is not supported because the harness owns the loop`),\n );\n }\n const approval = lowerApproval(tool.approval);\n if (approval.error != null) issues.push(error(`${path}: ${approval.error}`));\n if (approval.note != null) issues.push(note(`${path}: ${approval.note}`));\n const descriptor: ToolDescriptorIface = {\n name: args.name,\n description,\n inputSchema,\n export: args.exportName,\n };\n if (approval.inputDependent)\n descriptor.inputApproval = { kind: InputApprovalKind.Tool, export: args.exportName };\n if (tool.outputSchema != null) {\n const outputSchema = toJsonSchema({\n schema: tool.outputSchema,\n path: `${path} outputSchema`,\n issues,\n io: SchemaIo.Output,\n });\n if (outputSchema != null) descriptor.outputSchema = outputSchema;\n }\n const annotations: NonNullable<ToolDescriptorIface['annotations']> = { ...tool.annotations };\n if (tool.label != null && !toolLabelSchema.safeParse(tool.label).success)\n issues.push(error(`${path} label must be text or { start, delta?, complete? } callbacks`));\n if (isString(tool.label)) annotations.title = tool.label;\n if (Object.keys(annotations).length > 0) descriptor.annotations = annotations;\n return { descriptor, approval: approval.policy, issues };\n};\n\nconst authoredConnectionSchema = z.looseObject({\n url: optionalValueSchema,\n auth: optionalValueSchema,\n headers: optionalValueSchema,\n approval: optionalValueSchema,\n toolCall: optionalValueSchema,\n tools: z\n .looseObject({\n allow: z.array(z.unknown()).optional(),\n deny: z.array(z.unknown()).optional(),\n approval: authoredRecordSchema.optional(),\n load: z.array(z.string()).optional(),\n })\n .optional(),\n});\n\nconst connectionAuthSchema = z.union([\n z\n .object({ kind: z.literal('final-session') })\n .transform(() => ({ kind: 'final-session' as const })),\n z\n .looseObject({ secretKey: z.string().min(1), headerName: z.string().nullish() })\n .transform((auth) => ({ secretKey: auth.secretKey, headerName: auth.headerName ?? null })),\n]);\n\nexport interface LoweredConnectionIface {\n binding: HttpMcpServerBindingIface;\n issues: IssueIface[];\n}\n\nconst stringRecord = (\n value: AuthoredValue,\n path: string,\n issues: IssueIface[],\n): Record<string, string> => {\n if (value == null) return {};\n const parsed = z.record(z.string(), z.string()).safeParse(value);\n if (parsed.success) return parsed.data;\n issues.push(error(`${path} must be a record of strings (header callbacks are not supported)`));\n return {};\n};\n\nconst lowerAuth = (\n value: AuthoredValue,\n path: string,\n issues: IssueIface[],\n): HttpMcpServerBindingIface['auth'] => {\n if (value == null) return null;\n const parsed = connectionAuthSchema.safeParse(value);\n if (parsed.success) return parsed.data;\n issues.push(\n error(\n `${path} must be { secretKey, headerName } or { kind: 'final-session' }; auth providers and callbacks are not supported`,\n ),\n );\n return null;\n};\n\ninterface ToolEntriesIface {\n names: string[];\n selectors: ToolAnnotationSelectorIface[];\n}\n\n// `tools.allow` and `tools.deny` entries: tool names, or MCP annotation selectors.\nconst splitToolEntries = (args: {\n entries: readonly unknown[];\n label: string;\n issues: IssueIface[];\n}): ToolEntriesIface => {\n const names: string[] = [];\n const selectors: ToolAnnotationSelectorIface[] = [];\n for (const entry of args.entries) {\n if (isString(entry)) {\n names.push(entry);\n continue;\n }\n const parsed = toolAnnotationSelectorSchema.safeParse(entry);\n if (parsed.success) selectors.push(parsed.data);\n else\n args.issues.push(\n error(\n `${args.label} entries must be tool names, * patterns, or annotation selectors such as { readOnlyHint: true }`,\n ),\n );\n }\n return { names, selectors };\n};\n\nexport const lowerConnection = (args: {\n key: string;\n exportName: string;\n value: AuthoredValue;\n}): LoweredConnectionIface => {\n const issues: IssueIface[] = [];\n const path = `connection ${args.key}`;\n const parsed = authoredConnectionSchema.safeParse(args.value);\n const connection = parsed.success ? parsed.data : null;\n if (connection == null)\n issues.push(error(`${path} must be defineMcpClientConnection({ url, ... })`));\n const url = isString(connection?.url) ? connection.url : null;\n if (url == null || !z.url().safeParse(url).success)\n issues.push(error(`${path} needs a valid url`));\n const tools = connection?.tools;\n const defaultApproval = lowerApproval(connection?.approval);\n if (defaultApproval.error != null) issues.push(error(`${path}: ${defaultApproval.error}`));\n if (defaultApproval.note != null) issues.push(note(`${path}: ${defaultApproval.note}`));\n const overrideEntries: [string, ToolApproval][] = [];\n const inputApprovalEntries: [string, InputApprovalIface][] = [];\n const staticOverrideKeys: string[] = [];\n if (defaultApproval.inputDependent)\n inputApprovalEntries.push([\n '*',\n { kind: InputApprovalKind.Connection, export: args.exportName },\n ]);\n for (const [tool, approval] of Object.entries(tools?.approval ?? {})) {\n const lowered = lowerApproval(approval);\n if (lowered.error != null)\n issues.push(error(`${path} tools.approval.${tool}: ${lowered.error}`));\n if (lowered.note != null) issues.push(note(`${path} tools.approval.${tool}: ${lowered.note}`));\n overrideEntries.push([tool, lowered.policy]);\n if (lowered.inputDependent)\n inputApprovalEntries.push([\n tool,\n { kind: InputApprovalKind.Connection, export: args.exportName, policyKey: tool },\n ]);\n else staticOverrideKeys.push(tool);\n }\n const overrides = Object.fromEntries(overrideEntries);\n const inputApprovals = Object.fromEntries(inputApprovalEntries);\n for (const key of staticOverrideKeys) delete inputApprovals[key];\n const defaultPolicy = overrides[TOOL_PATTERN_WILDCARD] ?? defaultApproval.policy;\n const allowEntries =\n tools?.allow == null\n ? null\n : splitToolEntries({ entries: tools.allow, label: `${path} tools.allow`, issues });\n const allow = allowEntries?.names ?? null;\n const allowSelectors = allowEntries?.selectors ?? [];\n const denyEntries = splitToolEntries({\n entries: tools?.deny ?? [],\n label: `${path} tools.deny`,\n issues,\n });\n const deny = denyEntries.names;\n const authoredEntries: Record<string, readonly string[]> = {\n allow: allow ?? [],\n deny,\n approval: Object.keys(overrides),\n };\n for (const [field, entries] of Object.entries(authoredEntries)) {\n if (entries.some((entry) => entry.trim().length === 0))\n issues.push(error(`${path} tools.${field} entries must be tool names or * patterns`));\n }\n const inherited = Object.hasOwn(inputApprovals, '*') ? inputApprovals['*'] : undefined;\n let approvals: Record<string, ToolApproval> | null = null;\n if (allow != null) {\n approvals = Object.fromEntries(allow.map((tool) => [tool, overrides[tool] ?? defaultPolicy]));\n if (inherited != null) {\n for (const tool of allow) {\n if (!Object.hasOwn(overrides, tool))\n Object.defineProperty(inputApprovals, tool, {\n value: inherited,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n }\n }\n // A narrower approval inside an allow pattern (`github.delete_*` under\n // `github.*`) keeps its own key; the most specific key governs a tool.\n // `*` is the connection default here, already folded into each entry.\n for (const tool of Object.keys(overrides)) {\n if (tool === TOOL_PATTERN_WILDCARD || allow.includes(tool)) continue;\n if (allow.some((pattern) => toolPatternMatches(pattern, tool))) {\n approvals[tool] = overrides[tool] ?? defaultPolicy;\n continue;\n }\n issues.push(\n warning(\n allowSelectors.length > 0\n ? `${path} sets an approval for ${tool}, which tools.allow does not name; approvals apply only to named tools`\n : `${path} sets an approval for ${tool}, which tools.allow does not expose`,\n ),\n );\n }\n } else if (defaultApproval.policy === ToolApproval.Ask || Object.keys(overrides).length > 0) {\n // '*' applies to every listed tool without its own entry.\n approvals = { '*': defaultApproval.policy, ...overrides };\n }\n for (const tool of Object.keys(overrides)) {\n if (tool !== TOOL_PATTERN_WILDCARD && isToolDenied(deny, tool))\n issues.push(warning(`${path} sets an approval for ${tool}, which tools.deny hides`));\n }\n const load = tools?.load ?? null;\n if (load?.some((tool) => tool.trim().length === 0) === true)\n issues.push(error(`${path} tools.load entries must be tool names or * patterns`));\n for (const tool of load ?? []) {\n if (isToolDenied(deny, tool))\n issues.push(warning(`${path} loads ${tool}, which tools.deny hides`));\n // A tool an annotation selector exposes cannot be checked by name here.\n else if (\n allow != null &&\n allowSelectors.length === 0 &&\n !allow.some((pattern) => toolPatternMatches(pattern, tool))\n )\n issues.push(warning(`${path} loads ${tool}, which tools.allow does not expose`));\n }\n if (connection?.toolCall != null)\n issues.push(error(`${path} uses toolCall.providedArguments, which is not supported`));\n const binding: HttpMcpServerBindingIface = {\n key: args.key,\n kind: McpServerBindingKind.Http,\n url: url ?? 'https://invalid.invalid',\n auth: lowerAuth(connection?.auth, `${path} auth`, issues),\n headers: stringRecord(connection?.headers, `${path} headers`, issues),\n approvals,\n };\n if (deny.length > 0) binding.deny = [...new Set(deny)];\n if (load != null) binding.load = [...new Set(load)];\n // Annotation-selected tools run under the connection default, as unnamed tools do.\n if (allowSelectors.length > 0)\n binding.allowAnnotations = allowSelectors.map((match) => ({\n match,\n approval: defaultPolicy,\n ...(inherited == null ? {} : { inputApproval: inherited }),\n }));\n if (denyEntries.selectors.length > 0) binding.denyAnnotations = denyEntries.selectors;\n if (Object.keys(inputApprovals).length > 0) binding.inputApprovals = inputApprovals;\n return { binding, issues };\n};\n\nexport const skillMarkdown = (args: {\n key: string;\n description: string;\n markdown: string;\n}): string =>\n args.markdown.startsWith('---\\n')\n ? args.markdown\n : `---\\nname: ${JSON.stringify(args.key)}\\ndescription: ${JSON.stringify(args.description)}\\n---\\n\\n${args.markdown}`;\n\nconst authoredSkillSchema = z.looseObject({\n description: optionalValueSchema,\n markdown: optionalValueSchema,\n files: authoredRecordSchema.optional().catch(undefined),\n});\n\nexport interface LoweredSkillIface {\n skill: SkillBundleIface;\n issues: IssueIface[];\n}\n\nexport const lowerSkill = (args: { key: string; value: AuthoredValue }): LoweredSkillIface => {\n const issues: IssueIface[] = [];\n const parsed = authoredSkillSchema.safeParse(args.value);\n const description =\n parsed.success && isString(parsed.data.description) ? parsed.data.description : null;\n const markdown = parsed.success && isString(parsed.data.markdown) ? parsed.data.markdown : null;\n if (description == null || description.length === 0)\n issues.push(error(`skill ${args.key} needs a description`));\n if (markdown == null) issues.push(error(`skill ${args.key} needs markdown`));\n const files: SkillBundleIface['files'] = [\n {\n path: 'SKILL.md',\n content: skillMarkdown({\n key: args.key,\n description: description ?? '',\n markdown: markdown ?? '',\n }),\n },\n ];\n for (const [path, content] of Object.entries(\n (parsed.success ? parsed.data.files : undefined) ?? {},\n )) {\n if (path.startsWith('/') || path.split(/[\\\\/]/).includes('..')) {\n issues.push(error(`skill ${args.key} file ${path} must stay inside the skill directory`));\n } else if (!isString(content)) {\n issues.push(warning(`skill ${args.key} file ${path} is binary and was left out`));\n } else if (path !== 'SKILL.md') files.push({ path, content });\n }\n const skill: SkillBundleIface = { key: args.key, files };\n if (description != null) skill.description = description;\n return { skill, issues };\n};\n\nconst authoredInstructionsSchema = z.looseObject({\n content: z.string(),\n role: z.string().optional(),\n});\n\nexport const lowerInstructions = (\n value: AuthoredValue,\n source: string | null,\n): InstructionFragmentIface | null => {\n const parsed = authoredInstructionsSchema.safeParse(value);\n if (!parsed.success) return null;\n const fragment: InstructionFragmentIface = {\n role: parsed.data.role === InstructionRole.User ? InstructionRole.User : InstructionRole.System,\n content: parsed.data.content,\n };\n if (source != null) fragment.source = source;\n return fragment;\n};\n\nexport interface LoweredEnvironmentIface {\n providerName: string;\n providerRef: JsonValue | null;\n options: JsonValue;\n openOptions: JsonValue | null;\n}\n\nconst environmentSchema = z.looseObject({\n providerName: z.string(),\n providerRef: optionalValueSchema,\n options: optionalValueSchema,\n open: callableSchema,\n});\n\nconst openRequestSchema = z.looseObject({\n providerName: z.string(),\n providerRef: optionalValueSchema,\n environmentOptions: optionalValueSchema,\n openOptions: optionalValueSchema,\n});\n\nconst sandboxProviderSchema = z.looseObject({\n name: z.string(),\n environment: callableSchema,\n definition: z.looseObject({}),\n});\n\nexport const isEnvironmentLike = (value: AuthoredValue): boolean =>\n environmentSchema.safeParse(value).success;\n\nexport const isOpenRequestLike = (value: AuthoredValue): boolean =>\n openRequestSchema.safeParse(value).success &&\n isObjectLike(value) &&\n 'environmentOptions' in value;\n\nexport const sandboxProviderNameOf = (value: AuthoredValue): string | null => {\n const parsed = sandboxProviderSchema.safeParse(value);\n return parsed.success ? parsed.data.name : null;\n};\n\nexport const lowerEnvironment = (\n value: AuthoredValue,\n path: string,\n issues: IssueIface[],\n): LoweredEnvironmentIface | null => {\n const warnings = z.array(z.string()).safeParse(fieldOf(value, 'authoringWarnings'));\n if (warnings.success)\n for (const message of warnings.data) issues.push(warning(`${path}: ${message}`));\n const request = isOpenRequestLike(value) ? openRequestSchema.safeParse(value) : null;\n if (request?.success === true) {\n return {\n providerName: request.data.providerName,\n providerRef:\n request.data.providerRef == null\n ? null\n : toJson(request.data.providerRef, { path, issues }),\n options: toJson(request.data.environmentOptions ?? {}, { path: `${path} options`, issues }),\n openOptions: toJson(request.data.openOptions ?? null, {\n path: `${path} open options`,\n issues,\n }),\n };\n }\n const environment = environmentSchema.safeParse(value);\n if (!environment.success) return null;\n return {\n providerName: environment.data.providerName,\n providerRef:\n environment.data.providerRef == null\n ? null\n : toJson(environment.data.providerRef, { path, issues }),\n options: toJson(environment.data.options ?? {}, { path: `${path} options`, issues }),\n openOptions: null,\n };\n};\n\nexport const isDynamicSentinel = (value: AuthoredValue): boolean =>\n authoredKindOf(value) === AuthoredKind.Dynamic;\n\nexport const dynamicEventsOf = (value: AuthoredValue): string[] =>\n entriesOf(fieldOf(value, 'events'))\n .filter(([, handler]) => isCallable(handler))\n .map(([event]) => event);\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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AA,IACL,cAAc,YAAY,KAAK;AAAA,IAC/B,aACE,YAAY,KAAK,eAAe,OAC5B,OACA,OAAO,YAAY,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAAA,IAC3D,SAAS,OAAO,YAAY,KAAK,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,YAAY,OAAO,CAAC;AAAA,IACnF,aAAa;AAAA,EACf;AACF;AAEO,MAAM,oBAAoB,CAAC,UAChC,eAAe,KAAK,MAAM,aAAa;AAElC,MAAM,kBAAkB,CAAC,UAC9B,UAAU,QAAQ,OAAO,QAAQ,CAAC,EAC/B,OAAO,CAAC,CAAC,EAAE,OAAO,MAAM,WAAW,OAAO,CAAC,EAC3C,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;",
|
|
6
6
|
"names": ["IssueSeverity"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,13 @@ import { defineAgent, credentials as definitionCredentials } from '@finalai/agen
|
|
|
2
2
|
import { serverlessPi } from '@finalai/final-agent-provider/harnesses';
|
|
3
3
|
|
|
4
4
|
export default defineAgent({
|
|
5
|
+
avatar: {
|
|
6
|
+
url: 'https://cdn.example.com/assistant/poster.png',
|
|
7
|
+
states: {
|
|
8
|
+
idle: { type: 'video', url: 'https://cdn.example.com/assistant/idle.mp4' },
|
|
9
|
+
researching: { type: 'image', url: 'https://cdn.example.com/assistant/researching.webp' },
|
|
10
|
+
},
|
|
11
|
+
},
|
|
5
12
|
harness: serverlessPi({
|
|
6
13
|
credentials: definitionCredentials.chain({
|
|
7
14
|
payer: 'organization',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finalai/agent-definition",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provider-independent agent authoring, manifest schemas, directory compiler, and harness compatibility reports.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"registry": "https://registry.npmjs.org/"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@finalai/agent-protocol": "0.1.
|
|
79
|
-
"@finalai/agent-provider": "0.1.
|
|
78
|
+
"@finalai/agent-protocol": "0.1.4",
|
|
79
|
+
"@finalai/agent-provider": "0.1.4",
|
|
80
80
|
"ajv": "^8.20.0",
|
|
81
81
|
"ajv-formats": "^3.0.1",
|
|
82
82
|
"croner": "^10.0.1",
|