@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
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
resolveManifestDetailed,
|
|
6
6
|
slotKindOf,
|
|
7
7
|
validateSlotValue
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-YW7HDGQA.ts";
|
|
9
9
|
import {
|
|
10
10
|
AGENT_DYNAMIC_PREFIX,
|
|
11
11
|
AUTHORED_SERVER_KEY,
|
|
@@ -15,7 +15,7 @@ import "../chunk-RMIQJHSL.ts";
|
|
|
15
15
|
import {
|
|
16
16
|
completeHarnessDescription,
|
|
17
17
|
defineHarness
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-Z5TO7RSJ.ts";
|
|
19
19
|
import {
|
|
20
20
|
HookEvent,
|
|
21
21
|
defineHook
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import "../chunk-4E5HECVD.ts";
|
|
33
33
|
import {
|
|
34
34
|
SandboxWire
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-RIEMTCTV.ts";
|
|
36
36
|
import {
|
|
37
37
|
defineSchedule
|
|
38
38
|
} from "../chunk-JGQ2KAN7.ts";
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
always,
|
|
51
51
|
never,
|
|
52
52
|
whenInput
|
|
53
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-4A66SVBJ.ts";
|
|
54
54
|
import {
|
|
55
55
|
DELETE,
|
|
56
56
|
GET,
|
|
@@ -65,7 +65,7 @@ import "../chunk-IF6MR7JF.ts";
|
|
|
65
65
|
import {
|
|
66
66
|
defineHostedConnection,
|
|
67
67
|
defineMcpClientConnection
|
|
68
|
-
} from "../chunk-
|
|
68
|
+
} from "../chunk-TJ536HI4.ts";
|
|
69
69
|
import "../chunk-CIWWFQHL.ts";
|
|
70
70
|
import {
|
|
71
71
|
BaseCapability,
|
|
@@ -76,7 +76,9 @@ import {
|
|
|
76
76
|
SandboxAttach,
|
|
77
77
|
ScheduleTarget,
|
|
78
78
|
ToolApproval,
|
|
79
|
+
agentAvatarSchema,
|
|
79
80
|
agentManifestSchema,
|
|
81
|
+
avatarMediaSchema,
|
|
80
82
|
baseToolsSchema,
|
|
81
83
|
bundleSchema,
|
|
82
84
|
channelBindingSchema,
|
|
@@ -95,7 +97,7 @@ import {
|
|
|
95
97
|
skillFileSchema,
|
|
96
98
|
toolDescriptorSchema,
|
|
97
99
|
workerMcpServerBindingSchema
|
|
98
|
-
} from "../chunk-
|
|
100
|
+
} from "../chunk-APU2VKLW.ts";
|
|
99
101
|
import {
|
|
100
102
|
TranscriptRole
|
|
101
103
|
} from "../chunk-RWUIMTBI.ts";
|
|
@@ -150,8 +152,10 @@ export {
|
|
|
150
152
|
ToolApproval,
|
|
151
153
|
TranscriptRole,
|
|
152
154
|
WS,
|
|
155
|
+
agentAvatarSchema,
|
|
153
156
|
agentManifestSchema,
|
|
154
157
|
always,
|
|
158
|
+
avatarMediaSchema,
|
|
155
159
|
baseTools,
|
|
156
160
|
baseToolsSchema,
|
|
157
161
|
bundleSchema,
|
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
SandboxAttach,
|
|
9
9
|
ScheduleTarget,
|
|
10
10
|
ToolApproval,
|
|
11
|
+
agentAvatarSchema,
|
|
11
12
|
agentManifestSchema,
|
|
13
|
+
avatarMediaSchema,
|
|
12
14
|
baseToolsSchema,
|
|
13
15
|
bundleSchema,
|
|
14
16
|
channelBindingSchema,
|
|
@@ -27,7 +29,7 @@ import {
|
|
|
27
29
|
skillFileSchema,
|
|
28
30
|
toolDescriptorSchema,
|
|
29
31
|
workerMcpServerBindingSchema
|
|
30
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-APU2VKLW.ts";
|
|
31
33
|
import {
|
|
32
34
|
DynamicEvent,
|
|
33
35
|
dynamicSlotSchema,
|
|
@@ -47,7 +49,9 @@ export {
|
|
|
47
49
|
SandboxAttach,
|
|
48
50
|
ScheduleTarget,
|
|
49
51
|
ToolApproval,
|
|
52
|
+
agentAvatarSchema,
|
|
50
53
|
agentManifestSchema,
|
|
54
|
+
avatarMediaSchema,
|
|
51
55
|
baseToolsSchema,
|
|
52
56
|
bundleSchema,
|
|
53
57
|
channelBindingSchema,
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
resolveManifestDetailed,
|
|
5
5
|
slotKindOf,
|
|
6
6
|
validateSlotValue
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-YW7HDGQA.ts";
|
|
8
|
+
import "../chunk-APU2VKLW.ts";
|
|
9
9
|
import "../chunk-MSE7X5YG.ts";
|
|
10
10
|
import "../chunk-4X2DS5BR.ts";
|
|
11
11
|
import "../chunk-3K4C4SVG.ts";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
combineMcpServers,
|
|
3
3
|
createIsolateRuntime
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-YWFGIPHD.ts";
|
|
5
5
|
import {
|
|
6
6
|
describeBundle,
|
|
7
7
|
needsCombinedMcpServers,
|
|
8
8
|
synthesizedExports
|
|
9
|
-
} from "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
} from "../../chunk-UBR53WBH.ts";
|
|
10
|
+
import "../../chunk-5NTKRRMC.ts";
|
|
11
11
|
import {
|
|
12
12
|
COMBINED_MCP_SERVERS_EXPORT,
|
|
13
13
|
namedExportName
|
|
@@ -17,10 +17,10 @@ import "../../chunk-4E5HECVD.ts";
|
|
|
17
17
|
import {
|
|
18
18
|
registerToolName
|
|
19
19
|
} from "../../chunk-2ZRYQO4Q.ts";
|
|
20
|
-
import "../../chunk-
|
|
20
|
+
import "../../chunk-4A66SVBJ.ts";
|
|
21
21
|
import "../../chunk-IF6MR7JF.ts";
|
|
22
22
|
import "../../chunk-CIWWFQHL.ts";
|
|
23
|
-
import "../../chunk-
|
|
23
|
+
import "../../chunk-APU2VKLW.ts";
|
|
24
24
|
import "../../chunk-RWUIMTBI.ts";
|
|
25
25
|
import "../../chunk-PFLSBTJA.ts";
|
|
26
26
|
import "../../chunk-ULI5WWRR.ts";
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
describeDynamic,
|
|
5
5
|
needsCombinedMcpServers,
|
|
6
6
|
synthesizedExports
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-UBR53WBH.ts";
|
|
8
|
+
import "../../chunk-5NTKRRMC.ts";
|
|
9
9
|
import {
|
|
10
10
|
COMBINED_MCP_SERVERS_EXPORT
|
|
11
11
|
} from "../../chunk-NMYHO2QN.ts";
|
|
12
12
|
import "../../chunk-2ZRYQO4Q.ts";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-4A66SVBJ.ts";
|
|
14
14
|
import "../../chunk-CIWWFQHL.ts";
|
|
15
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-APU2VKLW.ts";
|
|
16
16
|
import "../../chunk-PFLSBTJA.ts";
|
|
17
17
|
import "../../chunk-ULI5WWRR.ts";
|
|
18
18
|
import "../../chunk-W6DOJA4W.ts";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IssueSeverity
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-5NTKRRMC.ts";
|
|
4
4
|
import {
|
|
5
5
|
SlotKind
|
|
6
6
|
} from "../../chunk-NMYHO2QN.ts";
|
|
7
7
|
import "../../chunk-2ZRYQO4Q.ts";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-4A66SVBJ.ts";
|
|
9
9
|
import "../../chunk-CIWWFQHL.ts";
|
|
10
|
-
import
|
|
10
|
+
import {
|
|
11
|
+
agentAvatarSchema
|
|
12
|
+
} from "../../chunk-APU2VKLW.ts";
|
|
11
13
|
import "../../chunk-PFLSBTJA.ts";
|
|
12
14
|
import "../../chunk-ULI5WWRR.ts";
|
|
13
15
|
import "../../chunk-W6DOJA4W.ts";
|
|
@@ -50,7 +52,7 @@ var describedAgentSchema = object({
|
|
|
50
52
|
type: literal("agent"),
|
|
51
53
|
name: string().nullable(),
|
|
52
54
|
description: string().nullable(),
|
|
53
|
-
|
|
55
|
+
avatar: agentAvatarSchema.nullable().default(null),
|
|
54
56
|
harness: object({ harness: jsonValueSchema, config: jsonValueSchema }).nullable(),
|
|
55
57
|
tools: record(string(), string()).nullable(),
|
|
56
58
|
// Capabilities bound to `harnessHost` (the harness's own host, no target).
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
combineMcpServers,
|
|
3
3
|
createIsolateRuntime,
|
|
4
4
|
lowerResolvedValue
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-YWFGIPHD.ts";
|
|
6
|
+
import "../../chunk-5NTKRRMC.ts";
|
|
7
7
|
import "../../chunk-NMYHO2QN.ts";
|
|
8
8
|
import "../../chunk-TJZS457N.ts";
|
|
9
9
|
import "../../chunk-4E5HECVD.ts";
|
|
10
10
|
import "../../chunk-2ZRYQO4Q.ts";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-4A66SVBJ.ts";
|
|
12
12
|
import "../../chunk-IF6MR7JF.ts";
|
|
13
13
|
import "../../chunk-CIWWFQHL.ts";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-APU2VKLW.ts";
|
|
15
15
|
import "../../chunk-RWUIMTBI.ts";
|
|
16
16
|
import "../../chunk-PFLSBTJA.ts";
|
|
17
17
|
import "../../chunk-ULI5WWRR.ts";
|
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
toJson,
|
|
18
18
|
toJsonSchema,
|
|
19
19
|
warning
|
|
20
|
-
} from "../../chunk-
|
|
20
|
+
} from "../../chunk-5NTKRRMC.ts";
|
|
21
21
|
import "../../chunk-2ZRYQO4Q.ts";
|
|
22
|
-
import "../../chunk-
|
|
22
|
+
import "../../chunk-4A66SVBJ.ts";
|
|
23
23
|
import "../../chunk-CIWWFQHL.ts";
|
|
24
|
-
import "../../chunk-
|
|
24
|
+
import "../../chunk-APU2VKLW.ts";
|
|
25
25
|
import "../../chunk-PFLSBTJA.ts";
|
|
26
26
|
import "../../chunk-ULI5WWRR.ts";
|
|
27
27
|
import "../../chunk-W6DOJA4W.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsonObject, ProviderRef, ToolApproval } from '@finalai/agent-provider';
|
|
1
|
+
import type { AgentAvatarIface, JsonObject, ProviderRef, ToolApproval } from '@finalai/agent-provider';
|
|
2
2
|
import type { BaseToolsValueIface } from "./sandbox.mjs";
|
|
3
3
|
export interface HarnessBindingValueIface {
|
|
4
4
|
readonly harness: ProviderRef;
|
|
@@ -12,7 +12,8 @@ export interface ChannelBindingValueIface {
|
|
|
12
12
|
export interface AgentDefinitionInputIface {
|
|
13
13
|
readonly name?: string;
|
|
14
14
|
readonly description?: string;
|
|
15
|
-
|
|
15
|
+
/** Static avatar and optional state artwork. */
|
|
16
|
+
readonly avatar?: AgentAvatarIface;
|
|
16
17
|
readonly harness: HarnessBindingValueIface;
|
|
17
18
|
readonly tools?: BaseToolsValueIface;
|
|
18
19
|
readonly toolPolicy?: Readonly<Record<string, ToolApproval | `${ToolApproval}`>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/authoring/agent.ts"],
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type {\n AgentAvatarIface,\n JsonObject,\n ProviderRef,\n ToolApproval,\n} from '@finalai/agent-provider';\nimport { AuthoredKind, stamp } from \"./brand.mjs\";\nimport type { BaseToolsValueIface } from \"./sandbox.mjs\";\n\n// A harness binding as authoring helpers produce it: an installed harness\n// helper (`serverlessPi({...})`), a defineHarness result, or a literal.\nexport interface HarnessBindingValueIface {\n readonly harness: ProviderRef;\n readonly config: unknown;\n}\n\nexport interface ChannelBindingValueIface {\n readonly channel: ProviderRef;\n readonly config?: JsonObject;\n readonly key?: string;\n}\n\n// agent.ts. The agent names its harness; everything\n// the harness has an opinion about (model, reasoning, credentials, permission\n// mode, instructions, skills) lives in `harness.config`.\nexport interface AgentDefinitionInputIface {\n readonly name?: string;\n readonly description?: string;\n /** Static avatar and optional state artwork. */\n readonly avatar?: AgentAvatarIface;\n readonly harness: HarnessBindingValueIface;\n // Base tool capabilities bound to sandbox targets; none unless declared.\n readonly tools?: BaseToolsValueIface;\n // Extra approval policy for MCP tools (`<server>/<tool>`) and base\n // capabilities (`shell`, `files.write`).\n readonly toolPolicy?: Readonly<Record<string, ToolApproval | `${ToolApproval}`>>;\n // Organization secrets this agent's code may read with `ctx.secrets.get(name)`\n // (tools, hooks, resolvers, channel routes). Names referenced elsewhere in the\n // definition (connection `auth.secretKey`, `credentials.apiKey({ secret })`)\n // are added by the compiler; any other secret must be listed here, or reading\n // it fails at run time.\n readonly secrets?: readonly string[];\n // Installed channels (custom channels are files under channels/).\n readonly channels?: readonly ChannelBindingValueIface[];\n}\n\nexport const defineAgent = <TAgent extends AgentDefinitionInputIface>(definition: TAgent): TAgent =>\n stamp({ ...definition }, AuthoredKind.Agent);\n"],
|
|
5
|
+
"mappings": "AAMA,SAAS,cAAc,aAAa;AAwC7B,MAAM,cAAc,CAA2C,eACpE,MAAM,EAAE,GAAG,WAAW,GAAG,aAAa,KAAK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,10 +6,18 @@ export type McpConnectionAuthIface = {
|
|
|
6
6
|
} | {
|
|
7
7
|
readonly kind: 'final-session';
|
|
8
8
|
};
|
|
9
|
+
export interface McpToolAnnotationSelectorIface {
|
|
10
|
+
readonly readOnlyHint?: boolean;
|
|
11
|
+
readonly destructiveHint?: boolean;
|
|
12
|
+
readonly idempotentHint?: boolean;
|
|
13
|
+
readonly openWorldHint?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type McpToolSelector = string | McpToolAnnotationSelectorIface;
|
|
9
16
|
export interface McpConnectionToolsIface {
|
|
10
|
-
readonly allow?: readonly
|
|
11
|
-
readonly deny?: readonly
|
|
17
|
+
readonly allow?: readonly McpToolSelector[];
|
|
18
|
+
readonly deny?: readonly McpToolSelector[];
|
|
12
19
|
readonly approval?: Readonly<Record<string, ApprovalPolicyIface<never>>>;
|
|
20
|
+
readonly load?: readonly string[];
|
|
13
21
|
}
|
|
14
22
|
export interface McpClientConnectionDefinitionIface {
|
|
15
23
|
readonly url: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/authoring/connections.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ApprovalPolicyIface } from \"./approval.mjs\";\nimport { AuthoredKind, stamp } from \"./brand.mjs\";\nimport { jsonObjectSchema, mcpAuthSchema, requireHostedBinding } from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport { defineDynamic, type DynamicSentinelIface } from \"./dynamic.mjs\";\n\n// An MCP connection. Secrets are references by\n// name: the MCP host injects them, so they never reach the harness. Final's\n// own MCP server is an ordinary connection with `auth: { kind: 'final-session' }`.\n\nexport type McpConnectionAuthIface =\n // Sent as `Authorization: Bearer <secret>` when headerName is null.\n | { readonly secretKey: string; readonly headerName: string | null }\n | { readonly kind: 'final-session' };\n\nexport interface McpConnectionToolsIface {\n // Only these tools are exposed; omit to expose every tool the server lists.\n readonly allow?: readonly
|
|
5
|
-
"mappings": "AACA,SAAS,cAAc,aAAa;AACpC,SAAS,kBAAkB,eAAe,4BAA4B;AACtE,YAAY,OAAO;AACnB,SAAS,qBAAgD;
|
|
4
|
+
"sourcesContent": ["import type { ApprovalPolicyIface } from \"./approval.mjs\";\nimport { AuthoredKind, stamp } from \"./brand.mjs\";\nimport { jsonObjectSchema, mcpAuthSchema, requireHostedBinding } from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport { defineDynamic, type DynamicSentinelIface } from \"./dynamic.mjs\";\n\n// An MCP connection. Secrets are references by\n// name: the MCP host injects them, so they never reach the harness. Final's\n// own MCP server is an ordinary connection with `auth: { kind: 'final-session' }`.\n\nexport type McpConnectionAuthIface =\n // Sent as `Authorization: Bearer <secret>` when headerName is null.\n | { readonly secretKey: string; readonly headerName: string | null }\n | { readonly kind: 'final-session' };\n\n// Selects tools by the MCP annotations their server reports, reading omitted\n// hints as the spec's defaults: `{ readOnlyHint: true }` matches only tools\n// the server marks read-only. Use with servers you trust to classify tools.\nexport interface McpToolAnnotationSelectorIface {\n readonly readOnlyHint?: boolean;\n readonly destructiveHint?: boolean;\n readonly idempotentHint?: boolean;\n readonly openWorldHint?: boolean;\n}\n\nexport type McpToolSelector = string | McpToolAnnotationSelectorIface;\n\n// Entries and keys are tool names or `*` patterns (`github.*`), and allow and\n// deny entries may also be annotation selectors; the most specific matching\n// key governs a tool.\nexport interface McpConnectionToolsIface {\n // Only these tools are exposed; omit to expose every tool the server lists.\n // Annotation-selected tools run under the connection's default approval.\n readonly allow?: readonly McpToolSelector[];\n // These tools are hidden, whatever `allow` says.\n readonly deny?: readonly McpToolSelector[];\n // Per-tool approval; tools not listed use the connection's `approval`.\n readonly approval?: Readonly<Record<string, ApprovalPolicyIface<never>>>;\n // Exposed tools (names or `*` patterns) the harness lists up front; the rest\n // stay reachable through the host's tool search. Omit to list every exposed tool.\n readonly load?: readonly string[];\n}\n\nexport interface McpClientConnectionDefinitionIface {\n readonly url: string;\n readonly description?: string;\n readonly auth?: McpConnectionAuthIface;\n readonly headers?: Readonly<Record<string, string>>;\n readonly tools?: McpConnectionToolsIface;\n // Default approval for every tool of this connection.\n readonly approval?: ApprovalPolicyIface<never>;\n readonly protocolVersionDiscovery?: boolean;\n readonly instanceKey?: string;\n}\n\nexport const defineMcpClientConnection = <TConnection extends McpClientConnectionDefinitionIface>(\n definition: TConnection,\n): TConnection => stamp({ ...definition }, AuthoredKind.Connection);\n\nexport interface HostedConnectionDefinitionIface extends Omit<\n McpClientConnectionDefinitionIface,\n 'url' | 'auth' | 'headers' | 'protocolVersionDiscovery' | 'instanceKey'\n> {\n readonly binding: string;\n}\n\nconst hostedConnectionSchema = z.strictObject({\n url: z.string().url(),\n auth: mcpAuthSchema.nullable().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n});\n\n// Built-in and third-party bindings use the ordinary dynamic connection path.\nexport const defineHostedConnection = (\n definition: HostedConnectionDefinitionIface,\n): DynamicSentinelIface<McpClientConnectionDefinitionIface> => {\n const { binding, description, tools, approval } = definition;\n if (binding.trim().length === 0) throw new Error('Hosted connection binding must not be empty');\n return defineDynamic({\n description: definition.description ?? `Hosted connection ${binding}`,\n preview: `Resolved by hosting from ${binding}`,\n requiredBindings: [\n { name: binding, schema: jsonObjectSchema.parse(z.toJSONSchema(hostedConnectionSchema)) },\n ],\n events: {\n 'session.started': async (_event, ctx) => {\n const value = await requireHostedBinding({ bindings: ctx.bindings, name: binding });\n const parsed = hostedConnectionSchema.safeParse(value);\n if (!parsed.success)\n throw new Error(`Hosted connection ${binding} has invalid configuration`);\n const { auth, ...transport } = parsed.data;\n return defineMcpClientConnection({\n ...transport,\n description,\n tools,\n approval,\n ...(auth == null ? {} : { auth }),\n });\n },\n },\n });\n};\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,cAAc,aAAa;AACpC,SAAS,kBAAkB,eAAe,4BAA4B;AACtE,YAAY,OAAO;AACnB,SAAS,qBAAgD;AAmDlD,MAAM,4BAA4B,CACvC,eACgB,MAAM,EAAE,GAAG,WAAW,GAAG,aAAa,UAAU;AASlE,MAAM,yBAAyB,EAAE,aAAa;AAAA,EAC5C,KAAK,EAAE,OAAO,EAAE,IAAI;AAAA,EACpB,MAAM,cAAc,SAAS,EAAE,SAAS;AAAA,EACxC,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAAE,SAAS;AACrD,CAAC;AAGM,MAAM,yBAAyB,CACpC,eAC6D;AAC7D,QAAM,EAAE,SAAS,aAAa,OAAO,SAAS,IAAI;AAClD,MAAI,QAAQ,KAAK,EAAE,WAAW,EAAG,OAAM,IAAI,MAAM,6CAA6C;AAC9F,SAAO,cAAc;AAAA,IACnB,aAAa,WAAW,eAAe,qBAAqB,OAAO;AAAA,IACnE,SAAS,4BAA4B,OAAO;AAAA,IAC5C,kBAAkB;AAAA,MAChB,EAAE,MAAM,SAAS,QAAQ,iBAAiB,MAAM,EAAE,aAAa,sBAAsB,CAAC,EAAE;AAAA,IAC1F;AAAA,IACA,QAAQ;AAAA,MACN,mBAAmB,OAAO,QAAQ,QAAQ;AACxC,cAAM,QAAQ,MAAM,qBAAqB,EAAE,UAAU,IAAI,UAAU,MAAM,QAAQ,CAAC;AAClF,cAAM,SAAS,uBAAuB,UAAU,KAAK;AACrD,YAAI,CAAC,OAAO;AACV,gBAAM,IAAI,MAAM,qBAAqB,OAAO,4BAA4B;AAC1E,cAAM,EAAE,MAAM,GAAG,UAAU,IAAI,OAAO;AACtC,eAAO,0BAA0B;AAAA,UAC/B,GAAG;AAAA,UACH;AAAA,UACA;AAAA,UACA;AAAA,UACA,GAAI,QAAQ,OAAO,CAAC,IAAI,EAAE,KAAK;AAAA,QACjC,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -14,6 +14,8 @@ const completeHarnessDescription = (authored) => {
|
|
|
14
14
|
};
|
|
15
15
|
if (authored.supports?.nativeToolPolicy != null)
|
|
16
16
|
supports.nativeToolPolicy = authored.supports.nativeToolPolicy;
|
|
17
|
+
if (authored.supports?.deferredToolSearch != null)
|
|
18
|
+
supports.deferredToolSearch = authored.supports.deferredToolSearch;
|
|
17
19
|
return harnessDescriptionSchema.parse({
|
|
18
20
|
...authored,
|
|
19
21
|
acp: { transports: authored.acp.transports, mcp: authored.acp.mcp ?? [] },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/authoring/harness.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n bundleRef,\n CredentialDelivery,\n harnessDescriptionSchema,\n InferenceCredentialKind,\n type AcpTransport,\n type DefinedHarnessBindingIface,\n type DescribeHarnessArgsIface,\n type HarnessClientTlsIface,\n type HarnessDescriptionIface,\n type HarnessSessionRefIface,\n type JsonSchema,\n type JsonValue,\n type McpTransportKind,\n type OpenHarnessSessionArgsIface,\n type PromptWhileRunning,\n type ProviderRef,\n type SandboxWire,\n type SecretReaderIface,\n type UserInstructionDelivery,\n} from '@finalai/agent-provider';\nimport { registerPending } from \"./brand.mjs\";\n\n// A harness declared in the definition's bundle. Its\n// methods run in the agent's Worker isolate; the session service dials the\n// endpoints they return like any other harness's.\n\ntype EnumInput<E extends string> = E | `${E}`;\n\n// What `describe` may return: what the session service needs to dial and\n// report on the harness. Omitted fields take the defaults of a third-party\n// harness that owns its model and native tools: no base tools, no sandbox\n// wires, harness-owned inference, and none of observe, resume replay, fork or\n// author metadata.\nexport interface AuthoredHarnessDescriptionIface {\n configSchema: JsonSchema;\n userInstructionDelivery?: EnumInput<UserInstructionDelivery>;\n acp: {\n transports: readonly EnumInput<AcpTransport.Ws | AcpTransport.Http>[];\n mcp?: readonly EnumInput<McpTransportKind>[];\n };\n baseTools?: HarnessDescriptionIface['baseTools'];\n consumes?: readonly EnumInput<SandboxWire>[];\n inference?: {\n vendors?: readonly string[];\n kinds?: readonly EnumInput<InferenceCredentialKind>[];\n delivery?: EnumInput<CredentialDelivery>;\n };\n supports?: Partial<HarnessDescriptionIface['supports']>;\n promptWhileRunning?: EnumInput<PromptWhileRunning>;\n sessionSurvivesDisconnect?: boolean;\n}\n\n// The harness's own session reference; the session service adds which\n// harness it belongs to.\nexport interface AuthoredHarnessSessionRefIface {\n harnessSessionRef: string;\n generation: number;\n}\n\nexport type AuthoredHarnessEndpointIface =\n | {\n ref: AuthoredHarnessSessionRefIface;\n transport: EnumInput<AcpTransport.Ws>;\n url: string;\n headers?: Record<string, string>;\n tls?: HarnessClientTlsIface;\n }\n | {\n ref: AuthoredHarnessSessionRefIface;\n transport: EnumInput<AcpTransport.Http>;\n url: string;\n headers?: Record<string, string>;\n tls?: HarnessClientTlsIface;\n };\n\nexport interface AuthoredHarnessOpenArgsIface<Config> extends Omit<\n OpenHarnessSessionArgsIface,\n 'config' | 'observer'\n> {\n config: Config;\n // The agent session's id (`session.sessionId`), for keying the harness's own state.\n sessionId: string;\n}\n\nexport interface AuthoredHarnessResumeArgsIface<\n Config,\n> extends AuthoredHarnessOpenArgsIface<Config> {\n ref: HarnessSessionRefIface;\n lastSeq: number;\n}\n\n// What the session service sends: the open and resume arguments before\n// `sessionId` is filled in from `session`.\nexport type HarnessOpenCallIface<Config> = Omit<AuthoredHarnessOpenArgsIface<Config>, 'sessionId'>;\nexport type HarnessResumeCallIface<Config> = Omit<\n AuthoredHarnessResumeArgsIface<Config>,\n 'sessionId'\n>;\n\n// park, close and health get the session reference and the definition's\n// secret reader (the isolate's `secrets`, limited to manifest.secrets).\nexport interface AuthoredHarnessRefContextIface {\n secrets: SecretReaderIface;\n}\n\n// close is graceful unless `force` (the contract's close options).\nexport interface AuthoredHarnessCloseContextIface extends AuthoredHarnessRefContextIface {\n force: boolean;\n}\n\n// The first argument of park, close and health: the session reference itself,\n// also under `ref`, with the context's fields, so both `park(ref)` and\n// `park({ ref, secrets })` read naturally.\nexport type AuthoredHarnessRefArgIface<Context extends AuthoredHarnessRefContextIface> =\n HarnessSessionRefIface & Context & { ref: HarnessSessionRefIface };\n\nexport interface AuthoredHarnessHealthIface {\n ok: boolean;\n detail?: string;\n // Defaults to when the check returned.\n checkedAt?: string;\n}\n\nexport interface AuthoredHarnessIface<Config> {\n describe(binding?: DescribeHarnessArgsIface): Promise<AuthoredHarnessDescriptionIface>;\n open(args: AuthoredHarnessOpenArgsIface<Config>): Promise<AuthoredHarnessEndpointIface>;\n resume(args: AuthoredHarnessResumeArgsIface<Config>): Promise<AuthoredHarnessEndpointIface>;\n park(\n ref: AuthoredHarnessRefArgIface<AuthoredHarnessRefContextIface>,\n ctx: AuthoredHarnessRefContextIface,\n ): Promise<void>;\n close(\n ref: AuthoredHarnessRefArgIface<AuthoredHarnessCloseContextIface>,\n ctx: AuthoredHarnessCloseContextIface,\n ): Promise<void>;\n health(\n ref: AuthoredHarnessRefArgIface<AuthoredHarnessRefContextIface>,\n ctx: AuthoredHarnessRefContextIface,\n ): Promise<AuthoredHarnessHealthIface>;\n}\n\nexport interface DefinedAuthoredHarnessIface<Config> {\n (config: Config): DefinedHarnessBindingIface;\n describe(binding?: DescribeHarnessArgsIface): Promise<HarnessDescriptionIface>;\n open(args: HarnessOpenCallIface<Config>): Promise<AuthoredHarnessEndpointIface>;\n resume(args: HarnessResumeCallIface<Config>): Promise<AuthoredHarnessEndpointIface>;\n park(ref: HarnessSessionRefIface, ctx: AuthoredHarnessRefContextIface): Promise<void>;\n close(ref: HarnessSessionRefIface, ctx: AuthoredHarnessCloseContextIface): Promise<void>;\n health(\n ref: HarnessSessionRefIface,\n ctx: AuthoredHarnessRefContextIface,\n ): Promise<{ ok: boolean; detail?: string; checkedAt: string }>;\n}\n\n// Fills the omitted description fields (see AuthoredHarnessDescriptionIface)\n// and validates the result against the contract's schema, which also applies\n// its own defaults and turns enum literals into members.\nexport const completeHarnessDescription = (\n authored: AuthoredHarnessDescriptionIface,\n): HarnessDescriptionIface => {\n const supports: HarnessDescriptionIface['supports'] = {\n observe: authored.supports?.observe ?? false,\n resumeReplay: authored.supports?.resumeReplay ?? false,\n fork: authored.supports?.fork ?? false,\n authorMeta: authored.supports?.authorMeta ?? false,\n };\n if (authored.supports?.nativeToolPolicy != null)\n supports.nativeToolPolicy = authored.supports.nativeToolPolicy;\n return harnessDescriptionSchema.parse({\n ...authored,\n acp: { transports: authored.acp.transports, mcp: authored.acp.mcp ?? [] },\n baseTools: authored.baseTools ?? {},\n consumes: authored.consumes ?? [],\n inference: {\n vendors: authored.inference?.vendors ?? [],\n kinds: authored.inference?.kinds ?? [InferenceCredentialKind.HarnessOwned],\n delivery: authored.inference?.delivery ?? CredentialDelivery.AtOpen,\n },\n supports,\n });\n};\n\n// The contract's binding shape, with the bundle export placeholder made\n// unique per harness so the compiler can bind it to a synthesized bundle\n// export even when the harness is not exported.\nexport const defineHarness = <Config extends JsonValue = JsonValue>(\n implementation: AuthoredHarnessIface<Config>,\n): DefinedAuthoredHarnessIface<Config> => {\n let placeholder: ProviderRef | null = null;\n const binding = (config: Config): DefinedHarnessBindingIface => ({\n harness: placeholder ?? bundleRef('<pending>'),\n config,\n definedHarness: true,\n });\n const defined = Object.assign(binding, {\n describe: async (args?: DescribeHarnessArgsIface): Promise<HarnessDescriptionIface> =>\n completeHarnessDescription(await implementation.describe(args)),\n open: (args: HarnessOpenCallIface<Config>) =>\n implementation.open({ ...args, sessionId: args.session.sessionId }),\n resume: (args: HarnessResumeCallIface<Config>) =>\n implementation.resume({ ...args, sessionId: args.session.sessionId }),\n park: (ref: HarnessSessionRefIface, ctx: AuthoredHarnessRefContextIface) =>\n implementation.park({ ...ref, ...ctx, ref }, ctx),\n close: (ref: HarnessSessionRefIface, ctx: AuthoredHarnessCloseContextIface) =>\n implementation.close({ ...ref, ...ctx, ref }, ctx),\n health: async (ref: HarnessSessionRefIface, ctx: AuthoredHarnessRefContextIface) => {\n const health = await implementation.health({ ...ref, ...ctx, ref }, ctx);\n return { ...health, checkedAt: health.checkedAt ?? new Date().toISOString() };\n },\n });\n placeholder = bundleRef(registerPending(defined));\n return defined;\n};\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAgBK;AACP,SAAS,uBAAuB;AAyIzB,MAAM,6BAA6B,CACxC,aAC4B;AAC5B,QAAM,WAAgD;AAAA,IACpD,SAAS,SAAS,UAAU,WAAW;AAAA,IACvC,cAAc,SAAS,UAAU,gBAAgB;AAAA,IACjD,MAAM,SAAS,UAAU,QAAQ;AAAA,IACjC,YAAY,SAAS,UAAU,cAAc;AAAA,EAC/C;AACA,MAAI,SAAS,UAAU,oBAAoB;AACzC,aAAS,mBAAmB,SAAS,SAAS;AAChD,SAAO,yBAAyB,MAAM;AAAA,IACpC,GAAG;AAAA,IACH,KAAK,EAAE,YAAY,SAAS,IAAI,YAAY,KAAK,SAAS,IAAI,OAAO,CAAC,EAAE;AAAA,IACxE,WAAW,SAAS,aAAa,CAAC;AAAA,IAClC,UAAU,SAAS,YAAY,CAAC;AAAA,IAChC,WAAW;AAAA,MACT,SAAS,SAAS,WAAW,WAAW,CAAC;AAAA,MACzC,OAAO,SAAS,WAAW,SAAS,CAAC,wBAAwB,YAAY;AAAA,MACzE,UAAU,SAAS,WAAW,YAAY,mBAAmB;AAAA,IAC/D;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAKO,MAAM,gBAAgB,CAC3B,mBACwC;AACxC,MAAI,cAAkC;AACtC,QAAM,UAAU,CAAC,YAAgD;AAAA,IAC/D,SAAS,eAAe,UAAU,WAAW;AAAA,IAC7C;AAAA,IACA,gBAAgB;AAAA,EAClB;AACA,QAAM,UAAU,OAAO,OAAO,SAAS;AAAA,IACrC,UAAU,OAAO,SACf,2BAA2B,MAAM,eAAe,SAAS,IAAI,CAAC;AAAA,IAChE,MAAM,CAAC,SACL,eAAe,KAAK,EAAE,GAAG,MAAM,WAAW,KAAK,QAAQ,UAAU,CAAC;AAAA,IACpE,QAAQ,CAAC,SACP,eAAe,OAAO,EAAE,GAAG,MAAM,WAAW,KAAK,QAAQ,UAAU,CAAC;AAAA,IACtE,MAAM,CAAC,KAA6B,QAClC,eAAe,KAAK,EAAE,GAAG,KAAK,GAAG,KAAK,IAAI,GAAG,GAAG;AAAA,IAClD,OAAO,CAAC,KAA6B,QACnC,eAAe,MAAM,EAAE,GAAG,KAAK,GAAG,KAAK,IAAI,GAAG,GAAG;AAAA,IACnD,QAAQ,OAAO,KAA6B,QAAwC;AAClF,YAAM,SAAS,MAAM,eAAe,OAAO,EAAE,GAAG,KAAK,GAAG,KAAK,IAAI,GAAG,GAAG;AACvE,aAAO,EAAE,GAAG,QAAQ,WAAW,OAAO,cAAa,oBAAI,KAAK,GAAE,YAAY,EAAE;AAAA,IAC9E;AAAA,EACF,CAAC;AACD,gBAAc,UAAU,gBAAgB,OAAO,CAAC;AAChD,SAAO;AACT;",
|
|
4
|
+
"sourcesContent": ["import {\n bundleRef,\n CredentialDelivery,\n harnessDescriptionSchema,\n InferenceCredentialKind,\n type AcpTransport,\n type DefinedHarnessBindingIface,\n type DescribeHarnessArgsIface,\n type HarnessClientTlsIface,\n type HarnessDescriptionIface,\n type HarnessSessionRefIface,\n type JsonSchema,\n type JsonValue,\n type McpTransportKind,\n type OpenHarnessSessionArgsIface,\n type PromptWhileRunning,\n type ProviderRef,\n type SandboxWire,\n type SecretReaderIface,\n type UserInstructionDelivery,\n} from '@finalai/agent-provider';\nimport { registerPending } from \"./brand.mjs\";\n\n// A harness declared in the definition's bundle. Its\n// methods run in the agent's Worker isolate; the session service dials the\n// endpoints they return like any other harness's.\n\ntype EnumInput<E extends string> = E | `${E}`;\n\n// What `describe` may return: what the session service needs to dial and\n// report on the harness. Omitted fields take the defaults of a third-party\n// harness that owns its model and native tools: no base tools, no sandbox\n// wires, harness-owned inference, and none of observe, resume replay, fork or\n// author metadata.\nexport interface AuthoredHarnessDescriptionIface {\n configSchema: JsonSchema;\n userInstructionDelivery?: EnumInput<UserInstructionDelivery>;\n acp: {\n transports: readonly EnumInput<AcpTransport.Ws | AcpTransport.Http>[];\n mcp?: readonly EnumInput<McpTransportKind>[];\n };\n baseTools?: HarnessDescriptionIface['baseTools'];\n consumes?: readonly EnumInput<SandboxWire>[];\n inference?: {\n vendors?: readonly string[];\n kinds?: readonly EnumInput<InferenceCredentialKind>[];\n delivery?: EnumInput<CredentialDelivery>;\n };\n supports?: Partial<HarnessDescriptionIface['supports']>;\n promptWhileRunning?: EnumInput<PromptWhileRunning>;\n sessionSurvivesDisconnect?: boolean;\n}\n\n// The harness's own session reference; the session service adds which\n// harness it belongs to.\nexport interface AuthoredHarnessSessionRefIface {\n harnessSessionRef: string;\n generation: number;\n}\n\nexport type AuthoredHarnessEndpointIface =\n | {\n ref: AuthoredHarnessSessionRefIface;\n transport: EnumInput<AcpTransport.Ws>;\n url: string;\n headers?: Record<string, string>;\n tls?: HarnessClientTlsIface;\n }\n | {\n ref: AuthoredHarnessSessionRefIface;\n transport: EnumInput<AcpTransport.Http>;\n url: string;\n headers?: Record<string, string>;\n tls?: HarnessClientTlsIface;\n };\n\nexport interface AuthoredHarnessOpenArgsIface<Config> extends Omit<\n OpenHarnessSessionArgsIface,\n 'config' | 'observer'\n> {\n config: Config;\n // The agent session's id (`session.sessionId`), for keying the harness's own state.\n sessionId: string;\n}\n\nexport interface AuthoredHarnessResumeArgsIface<\n Config,\n> extends AuthoredHarnessOpenArgsIface<Config> {\n ref: HarnessSessionRefIface;\n lastSeq: number;\n}\n\n// What the session service sends: the open and resume arguments before\n// `sessionId` is filled in from `session`.\nexport type HarnessOpenCallIface<Config> = Omit<AuthoredHarnessOpenArgsIface<Config>, 'sessionId'>;\nexport type HarnessResumeCallIface<Config> = Omit<\n AuthoredHarnessResumeArgsIface<Config>,\n 'sessionId'\n>;\n\n// park, close and health get the session reference and the definition's\n// secret reader (the isolate's `secrets`, limited to manifest.secrets).\nexport interface AuthoredHarnessRefContextIface {\n secrets: SecretReaderIface;\n}\n\n// close is graceful unless `force` (the contract's close options).\nexport interface AuthoredHarnessCloseContextIface extends AuthoredHarnessRefContextIface {\n force: boolean;\n}\n\n// The first argument of park, close and health: the session reference itself,\n// also under `ref`, with the context's fields, so both `park(ref)` and\n// `park({ ref, secrets })` read naturally.\nexport type AuthoredHarnessRefArgIface<Context extends AuthoredHarnessRefContextIface> =\n HarnessSessionRefIface & Context & { ref: HarnessSessionRefIface };\n\nexport interface AuthoredHarnessHealthIface {\n ok: boolean;\n detail?: string;\n // Defaults to when the check returned.\n checkedAt?: string;\n}\n\nexport interface AuthoredHarnessIface<Config> {\n describe(binding?: DescribeHarnessArgsIface): Promise<AuthoredHarnessDescriptionIface>;\n open(args: AuthoredHarnessOpenArgsIface<Config>): Promise<AuthoredHarnessEndpointIface>;\n resume(args: AuthoredHarnessResumeArgsIface<Config>): Promise<AuthoredHarnessEndpointIface>;\n park(\n ref: AuthoredHarnessRefArgIface<AuthoredHarnessRefContextIface>,\n ctx: AuthoredHarnessRefContextIface,\n ): Promise<void>;\n close(\n ref: AuthoredHarnessRefArgIface<AuthoredHarnessCloseContextIface>,\n ctx: AuthoredHarnessCloseContextIface,\n ): Promise<void>;\n health(\n ref: AuthoredHarnessRefArgIface<AuthoredHarnessRefContextIface>,\n ctx: AuthoredHarnessRefContextIface,\n ): Promise<AuthoredHarnessHealthIface>;\n}\n\nexport interface DefinedAuthoredHarnessIface<Config> {\n (config: Config): DefinedHarnessBindingIface;\n describe(binding?: DescribeHarnessArgsIface): Promise<HarnessDescriptionIface>;\n open(args: HarnessOpenCallIface<Config>): Promise<AuthoredHarnessEndpointIface>;\n resume(args: HarnessResumeCallIface<Config>): Promise<AuthoredHarnessEndpointIface>;\n park(ref: HarnessSessionRefIface, ctx: AuthoredHarnessRefContextIface): Promise<void>;\n close(ref: HarnessSessionRefIface, ctx: AuthoredHarnessCloseContextIface): Promise<void>;\n health(\n ref: HarnessSessionRefIface,\n ctx: AuthoredHarnessRefContextIface,\n ): Promise<{ ok: boolean; detail?: string; checkedAt: string }>;\n}\n\n// Fills the omitted description fields (see AuthoredHarnessDescriptionIface)\n// and validates the result against the contract's schema, which also applies\n// its own defaults and turns enum literals into members.\nexport const completeHarnessDescription = (\n authored: AuthoredHarnessDescriptionIface,\n): HarnessDescriptionIface => {\n const supports: HarnessDescriptionIface['supports'] = {\n observe: authored.supports?.observe ?? false,\n resumeReplay: authored.supports?.resumeReplay ?? false,\n fork: authored.supports?.fork ?? false,\n authorMeta: authored.supports?.authorMeta ?? false,\n };\n if (authored.supports?.nativeToolPolicy != null)\n supports.nativeToolPolicy = authored.supports.nativeToolPolicy;\n if (authored.supports?.deferredToolSearch != null)\n supports.deferredToolSearch = authored.supports.deferredToolSearch;\n return harnessDescriptionSchema.parse({\n ...authored,\n acp: { transports: authored.acp.transports, mcp: authored.acp.mcp ?? [] },\n baseTools: authored.baseTools ?? {},\n consumes: authored.consumes ?? [],\n inference: {\n vendors: authored.inference?.vendors ?? [],\n kinds: authored.inference?.kinds ?? [InferenceCredentialKind.HarnessOwned],\n delivery: authored.inference?.delivery ?? CredentialDelivery.AtOpen,\n },\n supports,\n });\n};\n\n// The contract's binding shape, with the bundle export placeholder made\n// unique per harness so the compiler can bind it to a synthesized bundle\n// export even when the harness is not exported.\nexport const defineHarness = <Config extends JsonValue = JsonValue>(\n implementation: AuthoredHarnessIface<Config>,\n): DefinedAuthoredHarnessIface<Config> => {\n let placeholder: ProviderRef | null = null;\n const binding = (config: Config): DefinedHarnessBindingIface => ({\n harness: placeholder ?? bundleRef('<pending>'),\n config,\n definedHarness: true,\n });\n const defined = Object.assign(binding, {\n describe: async (args?: DescribeHarnessArgsIface): Promise<HarnessDescriptionIface> =>\n completeHarnessDescription(await implementation.describe(args)),\n open: (args: HarnessOpenCallIface<Config>) =>\n implementation.open({ ...args, sessionId: args.session.sessionId }),\n resume: (args: HarnessResumeCallIface<Config>) =>\n implementation.resume({ ...args, sessionId: args.session.sessionId }),\n park: (ref: HarnessSessionRefIface, ctx: AuthoredHarnessRefContextIface) =>\n implementation.park({ ...ref, ...ctx, ref }, ctx),\n close: (ref: HarnessSessionRefIface, ctx: AuthoredHarnessCloseContextIface) =>\n implementation.close({ ...ref, ...ctx, ref }, ctx),\n health: async (ref: HarnessSessionRefIface, ctx: AuthoredHarnessRefContextIface) => {\n const health = await implementation.health({ ...ref, ...ctx, ref }, ctx);\n return { ...health, checkedAt: health.checkedAt ?? new Date().toISOString() };\n },\n });\n placeholder = bundleRef(registerPending(defined));\n return defined;\n};\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAgBK;AACP,SAAS,uBAAuB;AAyIzB,MAAM,6BAA6B,CACxC,aAC4B;AAC5B,QAAM,WAAgD;AAAA,IACpD,SAAS,SAAS,UAAU,WAAW;AAAA,IACvC,cAAc,SAAS,UAAU,gBAAgB;AAAA,IACjD,MAAM,SAAS,UAAU,QAAQ;AAAA,IACjC,YAAY,SAAS,UAAU,cAAc;AAAA,EAC/C;AACA,MAAI,SAAS,UAAU,oBAAoB;AACzC,aAAS,mBAAmB,SAAS,SAAS;AAChD,MAAI,SAAS,UAAU,sBAAsB;AAC3C,aAAS,qBAAqB,SAAS,SAAS;AAClD,SAAO,yBAAyB,MAAM;AAAA,IACpC,GAAG;AAAA,IACH,KAAK,EAAE,YAAY,SAAS,IAAI,YAAY,KAAK,SAAS,IAAI,OAAO,CAAC,EAAE;AAAA,IACxE,WAAW,SAAS,aAAa,CAAC;AAAA,IAClC,UAAU,SAAS,YAAY,CAAC;AAAA,IAChC,WAAW;AAAA,MACT,SAAS,SAAS,WAAW,WAAW,CAAC;AAAA,MACzC,OAAO,SAAS,WAAW,SAAS,CAAC,wBAAwB,YAAY;AAAA,MACzE,UAAU,SAAS,WAAW,YAAY,mBAAmB;AAAA,IAC/D;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAKO,MAAM,gBAAgB,CAC3B,mBACwC;AACxC,MAAI,cAAkC;AACtC,QAAM,UAAU,CAAC,YAAgD;AAAA,IAC/D,SAAS,eAAe,UAAU,WAAW;AAAA,IAC7C;AAAA,IACA,gBAAgB;AAAA,EAClB;AACA,QAAM,UAAU,OAAO,OAAO,SAAS;AAAA,IACrC,UAAU,OAAO,SACf,2BAA2B,MAAM,eAAe,SAAS,IAAI,CAAC;AAAA,IAChE,MAAM,CAAC,SACL,eAAe,KAAK,EAAE,GAAG,MAAM,WAAW,KAAK,QAAQ,UAAU,CAAC;AAAA,IACpE,QAAQ,CAAC,SACP,eAAe,OAAO,EAAE,GAAG,MAAM,WAAW,KAAK,QAAQ,UAAU,CAAC;AAAA,IACtE,MAAM,CAAC,KAA6B,QAClC,eAAe,KAAK,EAAE,GAAG,KAAK,GAAG,KAAK,IAAI,GAAG,GAAG;AAAA,IAClD,OAAO,CAAC,KAA6B,QACnC,eAAe,MAAM,EAAE,GAAG,KAAK,GAAG,KAAK,IAAI,GAAG,GAAG;AAAA,IACnD,QAAQ,OAAO,KAA6B,QAAwC;AAClF,YAAM,SAAS,MAAM,eAAe,OAAO,EAAE,GAAG,KAAK,GAAG,KAAK,IAAI,GAAG,GAAG;AACvE,aAAO,EAAE,GAAG,QAAQ,WAAW,OAAO,cAAa,oBAAI,KAAK,GAAE,YAAY,EAAE;AAAA,IAC9E;AAAA,EACF,CAAC;AACD,gBAAc,UAAU,gBAAgB,OAAO,CAAC;AAChD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ export type { ApprovalPolicyIface } from "./approval.mjs";
|
|
|
5
5
|
export { DELETE, GET, POST, PUT, WS, defineChannel, defineProviderChannel, disableChannel, } from "./channels.mjs";
|
|
6
6
|
export type { AuthoredChannelDefinitionIface, RouteHandler, RouteHandlerArgsIface, } from "./channels.mjs";
|
|
7
7
|
export { defineHostedConnection, defineMcpClientConnection } from "./connections.mjs";
|
|
8
|
-
export type { HostedConnectionDefinitionIface, McpClientConnectionDefinitionIface, McpConnectionAuthIface, } from "./connections.mjs";
|
|
8
|
+
export type { HostedConnectionDefinitionIface, McpClientConnectionDefinitionIface, McpConnectionAuthIface, McpConnectionToolsIface, McpToolAnnotationSelectorIface, McpToolSelector, } from "./connections.mjs";
|
|
9
9
|
export * from "./context.mjs";
|
|
10
10
|
export { requireHostedBinding } from '@finalai/agent-provider';
|
|
11
11
|
export type { HostedBindingsIface } from '@finalai/agent-provider';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/authoring/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { defineAgent } from \"./agent.mjs\";\nexport type {\n AgentDefinitionInputIface,\n ChannelBindingValueIface,\n HarnessBindingValueIface,\n} from \"./agent.mjs\";\nexport { always, never, whenInput } from \"./approval.mjs\";\nexport type { ApprovalPolicyIface } from \"./approval.mjs\";\nexport {\n DELETE,\n GET,\n POST,\n PUT,\n WS,\n defineChannel,\n defineProviderChannel,\n disableChannel,\n} from \"./channels.mjs\";\nexport type {\n AuthoredChannelDefinitionIface,\n RouteHandler,\n RouteHandlerArgsIface,\n} from \"./channels.mjs\";\nexport { defineHostedConnection, defineMcpClientConnection } from \"./connections.mjs\";\nexport type {\n HostedConnectionDefinitionIface,\n McpClientConnectionDefinitionIface,\n McpConnectionAuthIface,\n} from \"./connections.mjs\";\nexport * from \"./context.mjs\";\nexport { requireHostedBinding } from '@finalai/agent-provider';\nexport type { HostedBindingsIface } from '@finalai/agent-provider';\nexport { CredentialOwner, CredentialPayer, credentials } from \"./credentials.mjs\";\nexport type { CredentialNode, CredentialPolicyIface } from \"./credentials.mjs\";\nexport { defineDynamic } from \"./dynamic.mjs\";\nexport type { DynamicDefinitionIface, DynamicEventsIface, DynamicSentinelIface } from \"./dynamic.mjs\";\nexport { completeHarnessDescription, defineHarness } from \"./harness.mjs\";\nexport type {\n AuthoredHarnessCloseContextIface,\n AuthoredHarnessDescriptionIface,\n AuthoredHarnessEndpointIface,\n AuthoredHarnessHealthIface,\n AuthoredHarnessIface,\n AuthoredHarnessOpenArgsIface,\n AuthoredHarnessRefContextIface,\n AuthoredHarnessResumeArgsIface,\n AuthoredHarnessSessionRefIface,\n DefinedAuthoredHarnessIface,\n} from \"./harness.mjs\";\nexport { HookEvent, defineHook } from \"./hooks.mjs\";\nexport type {\n HookContextIface,\n HookDefinitionIface,\n HookEventFor,\n HookEventIface,\n HookEventKey,\n} from \"./hooks.mjs\";\nexport { defineInstructions } from \"./instructions.mjs\";\nexport type { DefinedInstructionsIface, InstructionsDefinitionIface } from \"./instructions.mjs\";\nexport {\n SandboxWire,\n baseTools,\n defineSandbox,\n defineSandboxProvider,\n harnessHost,\n} from \"./sandbox.mjs\";\nexport type {\n BaseToolsValueIface,\n HarnessHostIface,\n SandboxSelector,\n SandboxSelectorContextIface,\n SandboxTargetValue,\n} from \"./sandbox.mjs\";\nexport { defineSchedule } from \"./schedules.mjs\";\nexport type { ScheduleInputIface } from \"./schedules.mjs\";\nexport { defineSkill } from \"./skills.mjs\";\nexport type { SkillDefinitionIface } from \"./skills.mjs\";\nexport { defineTool, toolResultFrom } from \"./tools.mjs\";\nexport type {\n DefinedToolIface,\n StandardSchemaLikeIface,\n ToolCallEventDataIface,\n ToolDefinitionIface,\n ToolInputSchema,\n} from \"./tools.mjs\";\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,mBAAmB;AAM5B,SAAS,QAAQ,OAAO,iBAAiB;AAEzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,wBAAwB,iCAAiC;
|
|
4
|
+
"sourcesContent": ["export { defineAgent } from \"./agent.mjs\";\nexport type {\n AgentDefinitionInputIface,\n ChannelBindingValueIface,\n HarnessBindingValueIface,\n} from \"./agent.mjs\";\nexport { always, never, whenInput } from \"./approval.mjs\";\nexport type { ApprovalPolicyIface } from \"./approval.mjs\";\nexport {\n DELETE,\n GET,\n POST,\n PUT,\n WS,\n defineChannel,\n defineProviderChannel,\n disableChannel,\n} from \"./channels.mjs\";\nexport type {\n AuthoredChannelDefinitionIface,\n RouteHandler,\n RouteHandlerArgsIface,\n} from \"./channels.mjs\";\nexport { defineHostedConnection, defineMcpClientConnection } from \"./connections.mjs\";\nexport type {\n HostedConnectionDefinitionIface,\n McpClientConnectionDefinitionIface,\n McpConnectionAuthIface,\n McpConnectionToolsIface,\n McpToolAnnotationSelectorIface,\n McpToolSelector,\n} from \"./connections.mjs\";\nexport * from \"./context.mjs\";\nexport { requireHostedBinding } from '@finalai/agent-provider';\nexport type { HostedBindingsIface } from '@finalai/agent-provider';\nexport { CredentialOwner, CredentialPayer, credentials } from \"./credentials.mjs\";\nexport type { CredentialNode, CredentialPolicyIface } from \"./credentials.mjs\";\nexport { defineDynamic } from \"./dynamic.mjs\";\nexport type { DynamicDefinitionIface, DynamicEventsIface, DynamicSentinelIface } from \"./dynamic.mjs\";\nexport { completeHarnessDescription, defineHarness } from \"./harness.mjs\";\nexport type {\n AuthoredHarnessCloseContextIface,\n AuthoredHarnessDescriptionIface,\n AuthoredHarnessEndpointIface,\n AuthoredHarnessHealthIface,\n AuthoredHarnessIface,\n AuthoredHarnessOpenArgsIface,\n AuthoredHarnessRefContextIface,\n AuthoredHarnessResumeArgsIface,\n AuthoredHarnessSessionRefIface,\n DefinedAuthoredHarnessIface,\n} from \"./harness.mjs\";\nexport { HookEvent, defineHook } from \"./hooks.mjs\";\nexport type {\n HookContextIface,\n HookDefinitionIface,\n HookEventFor,\n HookEventIface,\n HookEventKey,\n} from \"./hooks.mjs\";\nexport { defineInstructions } from \"./instructions.mjs\";\nexport type { DefinedInstructionsIface, InstructionsDefinitionIface } from \"./instructions.mjs\";\nexport {\n SandboxWire,\n baseTools,\n defineSandbox,\n defineSandboxProvider,\n harnessHost,\n} from \"./sandbox.mjs\";\nexport type {\n BaseToolsValueIface,\n HarnessHostIface,\n SandboxSelector,\n SandboxSelectorContextIface,\n SandboxTargetValue,\n} from \"./sandbox.mjs\";\nexport { defineSchedule } from \"./schedules.mjs\";\nexport type { ScheduleInputIface } from \"./schedules.mjs\";\nexport { defineSkill } from \"./skills.mjs\";\nexport type { SkillDefinitionIface } from \"./skills.mjs\";\nexport { defineTool, toolResultFrom } from \"./tools.mjs\";\nexport type {\n DefinedToolIface,\n StandardSchemaLikeIface,\n ToolCallEventDataIface,\n ToolDefinitionIface,\n ToolInputSchema,\n} from \"./tools.mjs\";\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAM5B,SAAS,QAAQ,OAAO,iBAAiB;AAEzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,wBAAwB,iCAAiC;AASlE,cAAc;AACd,SAAS,4BAA4B;AAErC,SAAS,iBAAiB,iBAAiB,mBAAmB;AAE9D,SAAS,qBAAqB;AAE9B,SAAS,4BAA4B,qBAAqB;AAa1D,SAAS,WAAW,kBAAkB;AAQtC,SAAS,0BAA0B;AAEnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP,SAAS,sBAAsB;AAE/B,SAAS,mBAAmB;AAE5B,SAAS,YAAY,sBAAsB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -857,7 +857,7 @@ ${text}`;
|
|
|
857
857
|
identity: {
|
|
858
858
|
name: agent?.name ?? input.fallbackName,
|
|
859
859
|
description: agent?.description ?? null,
|
|
860
|
-
|
|
860
|
+
...agent?.avatar == null ? {} : { avatar: agent.avatar }
|
|
861
861
|
},
|
|
862
862
|
harness: { harness: harnessRef, config },
|
|
863
863
|
mcpServers,
|