@finalai/agent-definition 0.1.2 → 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.
Files changed (115) hide show
  1. package/HOSTING.md +234 -0
  2. package/README.md +7 -0
  3. package/dist/compiler-assets/{chunk-TATN3PYK.ts → chunk-2ZRYQO4Q.ts} +4 -4
  4. package/dist/compiler-assets/{chunk-HGW4YHAY.ts → chunk-3K4C4SVG.ts} +9 -0
  5. package/dist/compiler-assets/{chunk-7VSSVZM4.ts → chunk-4A66SVBJ.ts} +4 -4
  6. package/dist/compiler-assets/{chunk-CWWRTRWW.ts → chunk-4E5HECVD.ts} +1 -1
  7. package/dist/compiler-assets/{chunk-7QP2CKPI.ts → chunk-4X2DS5BR.ts} +1 -1
  8. package/dist/compiler-assets/{chunk-ZDLVA6XF.ts → chunk-5NTKRRMC.ts} +112 -21
  9. package/dist/compiler-assets/{chunk-2CZRHOLL.ts → chunk-7XUPKRZU.ts} +1 -1
  10. package/dist/compiler-assets/{chunk-OWC6SFFF.ts → chunk-APU2VKLW.ts} +52 -12
  11. package/dist/compiler-assets/{chunk-HFS4KLEL.ts → chunk-D3SB4CCB.ts} +1 -1
  12. package/dist/compiler-assets/{chunk-HNPUTP35.ts → chunk-GCFSHHH2.ts} +2 -2
  13. package/dist/compiler-assets/{chunk-5BK6FVRE.ts → chunk-IF6MR7JF.ts} +2 -2
  14. package/dist/compiler-assets/{chunk-LUSAAV4L.ts → chunk-IZGOMT7K.ts} +2 -2
  15. package/dist/compiler-assets/{chunk-GTUZOATD.ts → chunk-JGQ2KAN7.ts} +1 -1
  16. package/dist/compiler-assets/{chunk-NYTOYKKF.ts → chunk-K6D7ZK74.ts} +3 -3
  17. package/dist/compiler-assets/{chunk-WMXMVFHM.ts → chunk-K7V4IMOB.ts} +3 -3
  18. package/dist/compiler-assets/{chunk-VHXHUU7L.ts → chunk-LHMUAIYJ.ts} +1 -1
  19. package/dist/compiler-assets/{chunk-SKTNMUO7.ts → chunk-MSE7X5YG.ts} +25 -2
  20. package/dist/compiler-assets/chunk-PFLSBTJA.ts +39 -0
  21. package/dist/compiler-assets/{chunk-XHKPWT3G.ts → chunk-QJ26GEUM.ts} +1 -1
  22. package/dist/compiler-assets/{chunk-JPY4L2UJ.ts → chunk-RIEMTCTV.ts} +12 -8
  23. package/dist/compiler-assets/chunk-RMIQJHSL.ts +0 -0
  24. package/dist/compiler-assets/chunk-TJ536HI4.ts +61 -0
  25. package/dist/compiler-assets/{chunk-QMWTDPNT.ts → chunk-TJZS457N.ts} +3 -3
  26. package/dist/compiler-assets/{chunk-JIPNTA56.ts → chunk-TM36NO3C.ts} +1 -1
  27. package/dist/compiler-assets/{chunk-MZMSKIKU.ts → chunk-UBR53WBH.ts} +33 -8
  28. package/dist/compiler-assets/chunk-ULI5WWRR.ts +40 -0
  29. package/dist/compiler-assets/chunk-W6DOJA4W.ts +3763 -0
  30. package/dist/compiler-assets/{chunk-EVQIK62B.ts → chunk-YW7HDGQA.ts} +11 -7
  31. package/dist/compiler-assets/{chunk-BLB6JGLO.ts → chunk-YWFGIPHD.ts} +27 -24
  32. package/dist/compiler-assets/{chunk-QMKWAFVZ.ts → chunk-Z5TO7RSJ.ts} +5 -3
  33. package/dist/compiler-assets/src/authoring/agent.ts +4 -4
  34. package/dist/compiler-assets/src/authoring/approval.ts +7 -7
  35. package/dist/compiler-assets/src/authoring/brand.ts +3 -3
  36. package/dist/compiler-assets/src/authoring/channels.ts +6 -6
  37. package/dist/compiler-assets/src/authoring/connections.ts +14 -4
  38. package/dist/compiler-assets/src/authoring/credentials.ts +7 -6
  39. package/dist/compiler-assets/src/authoring/dynamic.ts +9 -4
  40. package/dist/compiler-assets/src/authoring/harness.ts +9 -9
  41. package/dist/compiler-assets/src/authoring/hooks.ts +10 -8
  42. package/dist/compiler-assets/src/authoring/index.ts +33 -26
  43. package/dist/compiler-assets/src/authoring/instructions.ts +10 -5
  44. package/dist/compiler-assets/src/authoring/sandbox.ts +10 -10
  45. package/dist/compiler-assets/src/authoring/schedules.ts +4 -4
  46. package/dist/compiler-assets/src/authoring/skills.ts +4 -4
  47. package/dist/compiler-assets/src/authoring/tools.ts +10 -8
  48. package/dist/compiler-assets/src/compatibility.ts +11 -11
  49. package/dist/compiler-assets/src/hosted-bindings.ts +15 -0
  50. package/dist/compiler-assets/src/index.ts +54 -41
  51. package/dist/compiler-assets/src/manifest.ts +8 -4
  52. package/dist/compiler-assets/src/resolve.ts +5 -5
  53. package/dist/compiler-assets/src/runtime/bundle.ts +22 -20
  54. package/dist/compiler-assets/src/runtime/describe.ts +14 -12
  55. package/dist/compiler-assets/src/runtime/described.ts +19 -12
  56. package/dist/compiler-assets/src/runtime/isolate.ts +18 -16
  57. package/dist/compiler-assets/src/runtime/lower.ts +13 -11
  58. package/dist/compiler-assets/src/runtime/schema-validation.ts +4 -4
  59. package/dist/compiler-assets/src/runtime/values.ts +2 -2
  60. package/dist/modules/authoring/agent.d.mts +3 -2
  61. package/dist/modules/authoring/agent.mjs.map +2 -2
  62. package/dist/modules/authoring/connections.d.mts +15 -2
  63. package/dist/modules/authoring/connections.mjs +36 -0
  64. package/dist/modules/authoring/connections.mjs.map +2 -2
  65. package/dist/modules/authoring/context.d.mts +3 -1
  66. package/dist/modules/authoring/context.mjs.map +2 -2
  67. package/dist/modules/authoring/dynamic.d.mts +3 -1
  68. package/dist/modules/authoring/dynamic.mjs +19 -1
  69. package/dist/modules/authoring/dynamic.mjs.map +2 -2
  70. package/dist/modules/authoring/harness.mjs +2 -0
  71. package/dist/modules/authoring/harness.mjs.map +2 -2
  72. package/dist/modules/authoring/hooks.d.mts +2 -1
  73. package/dist/modules/authoring/hooks.mjs.map +2 -2
  74. package/dist/modules/authoring/index.d.mts +4 -2
  75. package/dist/modules/authoring/index.mjs +4 -1
  76. package/dist/modules/authoring/index.mjs.map +2 -2
  77. package/dist/modules/authoring/sandbox.d.mts +2 -1
  78. package/dist/modules/authoring/sandbox.mjs.map +2 -2
  79. package/dist/modules/compiler/assemble.mjs +6 -1
  80. package/dist/modules/compiler/assemble.mjs.map +2 -2
  81. package/dist/modules/compiler/index.d.mts +2 -1
  82. package/dist/modules/compiler/index.mjs +18 -0
  83. package/dist/modules/compiler/index.mjs.map +2 -2
  84. package/dist/modules/compiler/local-isolate.d.mts +2 -1
  85. package/dist/modules/compiler/local-isolate.mjs +6 -1
  86. package/dist/modules/compiler/local-isolate.mjs.map +2 -2
  87. package/dist/modules/hosted-bindings.d.mts +10 -0
  88. package/dist/modules/hosted-bindings.mjs +36 -0
  89. package/dist/modules/hosted-bindings.mjs.map +7 -0
  90. package/dist/modules/index.d.mts +2 -0
  91. package/dist/modules/index.mjs +2 -0
  92. package/dist/modules/index.mjs.map +2 -2
  93. package/dist/modules/manifest.d.mts +2 -2
  94. package/dist/modules/manifest.mjs +4 -0
  95. package/dist/modules/manifest.mjs.map +2 -2
  96. package/dist/modules/resolve.mjs +4 -0
  97. package/dist/modules/resolve.mjs.map +2 -2
  98. package/dist/modules/runtime/describe.mjs +25 -4
  99. package/dist/modules/runtime/describe.mjs.map +2 -2
  100. package/dist/modules/runtime/described.d.mts +40 -4
  101. package/dist/modules/runtime/described.mjs +7 -2
  102. package/dist/modules/runtime/described.mjs.map +2 -2
  103. package/dist/modules/runtime/isolate.d.mts +2 -0
  104. package/dist/modules/runtime/isolate.mjs +7 -4
  105. package/dist/modules/runtime/isolate.mjs.map +2 -2
  106. package/dist/modules/runtime/lower.mjs +76 -14
  107. package/dist/modules/runtime/lower.mjs.map +2 -2
  108. package/dist/modules/runtime/schema-validation.mjs +19 -2
  109. package/dist/modules/runtime/schema-validation.mjs.map +2 -2
  110. package/fixtures/assistant/agent/agent.ts +7 -0
  111. package/package.json +4 -3
  112. package/dist/compiler-assets/chunk-GNR7XBPN.ts +0 -3364
  113. package/dist/compiler-assets/chunk-JNJE72EH.ts +0 -10
  114. package/dist/compiler-assets/chunk-T6WG4L4M.ts +0 -19
  115. /package/dist/compiler-assets/{chunk-6WR3PGNF.ts → chunk-CIWWFQHL.ts} +0 -0
@@ -1,13 +1,13 @@
1
- import {
2
- jsonObjectSchema,
3
- jsonSchemaSchema,
4
- jsonValueSchema
5
- } from "./chunk-7QP2CKPI.ts";
6
1
  import {
7
2
  DynamicEvent,
8
3
  containsDynamicSlot,
9
4
  maybeDynamic
10
- } from "./chunk-SKTNMUO7.ts";
5
+ } from "./chunk-MSE7X5YG.ts";
6
+ import {
7
+ jsonObjectSchema,
8
+ jsonSchemaSchema,
9
+ jsonValueSchema
10
+ } from "./chunk-4X2DS5BR.ts";
11
11
  import {
12
12
  array,
13
13
  boolean,
@@ -17,9 +17,24 @@ import {
17
17
  object,
18
18
  partialRecord,
19
19
  record,
20
+ strictObject,
20
21
  string,
21
22
  union
22
- } from "./chunk-HGW4YHAY.ts";
23
+ } from "./chunk-3K4C4SVG.ts";
24
+
25
+ // ../agent-protocol/src/avatar.ts
26
+ var avatarMediaSchema = discriminatedUnion("type", [
27
+ object({ type: literal("image"), url: string().url() }),
28
+ object({
29
+ type: literal("video"),
30
+ url: string().url(),
31
+ posterUrl: string().url().optional()
32
+ })
33
+ ]);
34
+ var agentAvatarSchema = object({
35
+ url: string().url(),
36
+ states: record(string().min(1), avatarMediaSchema).optional()
37
+ });
23
38
 
24
39
  // ../agent-provider/src/provider-ref.ts
25
40
  var packageProviderRefSchema = object({
@@ -45,7 +60,7 @@ var bundleRef = (exportName) => ({
45
60
  var formatProviderRef = (ref) => ref.kind === "package" /* Package */ ? `package:${ref.specifier}` : `bundle:${ref.export}`;
46
61
 
47
62
  // ../agent-provider/src/manifest.ts
48
- var MANIFEST_VERSION = 2;
63
+ var MANIFEST_VERSION = 3;
49
64
  var BaseCapability = /* @__PURE__ */ ((BaseCapability2) => {
50
65
  BaseCapability2["Shell"] = "shell";
51
66
  BaseCapability2["Files"] = "files";
@@ -84,7 +99,7 @@ var ScheduleTarget = /* @__PURE__ */ ((ScheduleTarget2) => {
84
99
  var identitySchema = object({
85
100
  name: string().min(1).max(120),
86
101
  description: string().max(2e3).nullable(),
87
- avatarUrl: string().url().nullable()
102
+ avatar: agentAvatarSchema.optional()
88
103
  });
89
104
  var InputApprovalKind = /* @__PURE__ */ ((InputApprovalKind2) => {
90
105
  InputApprovalKind2["Tool"] = "tool";
@@ -122,6 +137,17 @@ var mcpAuthSchema = union([
122
137
  object({ kind: literal("final-session") })
123
138
  ]);
124
139
  var toolApprovalsSchema = record(string(), nativeEnum(ToolApproval)).nullable();
140
+ var toolAnnotationSelectorSchema = strictObject({
141
+ readOnlyHint: boolean().optional(),
142
+ destructiveHint: boolean().optional(),
143
+ idempotentHint: boolean().optional(),
144
+ openWorldHint: boolean().optional()
145
+ }).refine((selector) => Object.keys(selector).length > 0, "Select at least one annotation");
146
+ var toolAnnotationRuleSchema = object({
147
+ match: toolAnnotationSelectorSchema,
148
+ approval: nativeEnum(ToolApproval),
149
+ inputApproval: inputApprovalSchema.optional()
150
+ });
125
151
  var workerMcpServerBindingSchema = object({
126
152
  key: string().min(1),
127
153
  kind: literal("worker" /* Worker */),
@@ -135,9 +161,19 @@ var httpMcpServerBindingSchema = object({
135
161
  auth: mcpAuthSchema.nullable(),
136
162
  headers: record(string(), string()).default({}),
137
163
  // Null allows every tool the server lists, each with the default approval.
164
+ // Keys are tool names or `*` patterns (./tool-patterns.ts); the most
165
+ // specific matching key governs a tool.
138
166
  approvals: toolApprovalsSchema,
139
- // Tools hidden even when `approvals` would expose them.
167
+ // Tool names or `*` patterns hidden even when `approvals` would expose them.
140
168
  deny: array(string().min(1)).optional(),
169
+ // Exposed tools (names or `*` patterns) the harness lists up front. Absent
170
+ // lists every exposed tool; otherwise the host keeps the rest reachable
171
+ // through search (HOSTING.md).
172
+ load: array(string().min(1)).optional(),
173
+ // Tools also exposed by their MCP annotations; named tools keep `approvals`.
174
+ allowAnnotations: array(toolAnnotationRuleSchema).optional(),
175
+ // Tools hidden by their MCP annotations, whatever else exposes them.
176
+ denyAnnotations: array(toolAnnotationSelectorSchema).optional(),
141
177
  // The authored resolver that produced this connection, for retained boundary values.
142
178
  dynamicResolver: string().min(1).optional(),
143
179
  inputApprovals: record(string(), inputApprovalSchema).optional()
@@ -197,7 +233,8 @@ var harnessBindingSchema = object({
197
233
  config: maybeDynamic(jsonValueSchema)
198
234
  });
199
235
  var agentManifestSchema = object({
200
- version: literal(MANIFEST_VERSION),
236
+ // Read persisted v2 revisions; v3 writers require hosts enforcing hosted bindings.
237
+ version: union([literal(2), literal(MANIFEST_VERSION)]),
201
238
  identity: identitySchema,
202
239
  harness: harnessBindingSchema,
203
240
  mcpServers: maybeDynamic(array(mcpServerBindingSchema)),
@@ -245,7 +282,7 @@ var skillBundleSchema = object({
245
282
  });
246
283
  var emptyManifest = (name) => ({
247
284
  version: MANIFEST_VERSION,
248
- identity: { name, description: null, avatarUrl: null },
285
+ identity: { name, description: null },
249
286
  harness: {
250
287
  harness: packageRef("@finalai/final-agent-provider/harnesses/serverless-final"),
251
288
  config: {}
@@ -262,6 +299,8 @@ var emptyManifest = (name) => ({
262
299
  });
263
300
 
264
301
  export {
302
+ avatarMediaSchema,
303
+ agentAvatarSchema,
265
304
  providerRefSchema,
266
305
  bundleRef,
267
306
  formatProviderRef,
@@ -275,6 +314,7 @@ export {
275
314
  identitySchema,
276
315
  toolDescriptorSchema,
277
316
  mcpAuthSchema,
317
+ toolAnnotationSelectorSchema,
278
318
  workerMcpServerBindingSchema,
279
319
  httpMcpServerBindingSchema,
280
320
  mcpServerBindingSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  stamp
3
- } from "./chunk-XHKPWT3G.ts";
3
+ } from "./chunk-QJ26GEUM.ts";
4
4
 
5
5
  // src/authoring/skills.ts
6
6
  var defineSkill = (definition) => stamp({ ...definition }, "skill" /* Skill */);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DynamicEvent
3
- } from "./chunk-SKTNMUO7.ts";
3
+ } from "./chunk-MSE7X5YG.ts";
4
4
  import {
5
5
  array,
6
6
  literal,
@@ -8,7 +8,7 @@ import {
8
8
  object,
9
9
  string,
10
10
  union
11
- } from "./chunk-HGW4YHAY.ts";
11
+ } from "./chunk-3K4C4SVG.ts";
12
12
 
13
13
  // ../agent-provider/src/credentials.ts
14
14
  var CredentialPayer = /* @__PURE__ */ ((CredentialPayer2) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  jsonObjectSchema,
3
3
  jsonValueSchema
4
- } from "./chunk-7QP2CKPI.ts";
4
+ } from "./chunk-4X2DS5BR.ts";
5
5
  import {
6
6
  _null,
7
7
  array,
@@ -11,7 +11,7 @@ import {
11
11
  object,
12
12
  string,
13
13
  union
14
- } from "./chunk-HGW4YHAY.ts";
14
+ } from "./chunk-3K4C4SVG.ts";
15
15
 
16
16
  // ../agent-provider/src/channel.ts
17
17
  var ConversationKind = /* @__PURE__ */ ((ConversationKind2) => {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  awaitableOpenRequest
3
- } from "./chunk-CWWRTRWW.ts";
3
+ } from "./chunk-4E5HECVD.ts";
4
4
  import {
5
5
  stamp
6
- } from "./chunk-XHKPWT3G.ts";
6
+ } from "./chunk-QJ26GEUM.ts";
7
7
 
8
8
  // ../agent-provider/src/sandbox/types.ts
9
9
  var defineSandboxProvider = (definition) => ({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  stamp
3
- } from "./chunk-XHKPWT3G.ts";
3
+ } from "./chunk-QJ26GEUM.ts";
4
4
 
5
5
  // src/authoring/schedules.ts
6
6
  var defineSchedule = (definition) => stamp({ ...definition }, "schedule" /* Schedule */);
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  credentials
3
- } from "./chunk-HNPUTP35.ts";
3
+ } from "./chunk-GCFSHHH2.ts";
4
4
  import {
5
5
  DynamicEvent
6
- } from "./chunk-SKTNMUO7.ts";
6
+ } from "./chunk-MSE7X5YG.ts";
7
7
  import {
8
8
  isAuthored,
9
9
  registerPending
10
- } from "./chunk-XHKPWT3G.ts";
10
+ } from "./chunk-QJ26GEUM.ts";
11
11
 
12
12
  // src/authoring/credentials.ts
13
13
  var DYNAMIC_EVENTS = Object.values(DynamicEvent);
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  jsonObjectSchema
3
- } from "./chunk-7QP2CKPI.ts";
3
+ } from "./chunk-4X2DS5BR.ts";
4
4
  import {
5
5
  stamp
6
- } from "./chunk-XHKPWT3G.ts";
6
+ } from "./chunk-QJ26GEUM.ts";
7
7
  import {
8
8
  array,
9
9
  nativeEnum,
10
10
  object,
11
11
  string
12
- } from "./chunk-HGW4YHAY.ts";
12
+ } from "./chunk-3K4C4SVG.ts";
13
13
 
14
14
  // ../agent-provider/src/channel-context.ts
15
15
  var ChannelPrincipalType = /* @__PURE__ */ ((ChannelPrincipalType2) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  stamp
3
- } from "./chunk-XHKPWT3G.ts";
3
+ } from "./chunk-QJ26GEUM.ts";
4
4
 
5
5
  // src/authoring/instructions.ts
6
6
  var defineInstructions = (definition) => stamp(
@@ -1,3 +1,7 @@
1
+ import {
2
+ jsonSchemaSchema,
3
+ jsonValueSchema
4
+ } from "./chunk-4X2DS5BR.ts";
1
5
  import {
2
6
  array,
3
7
  json,
@@ -7,7 +11,23 @@ import {
7
11
  string,
8
12
  union,
9
13
  unknown
10
- } from "./chunk-HGW4YHAY.ts";
14
+ } from "./chunk-3K4C4SVG.ts";
15
+
16
+ // ../agent-provider/src/hosted-bindings.ts
17
+ var requireHostedBinding = async (options) => {
18
+ if (options.name.trim().length === 0) throw new Error("Hosted binding name must not be empty");
19
+ if (options.bindings == null)
20
+ throw new Error(`Hosting does not supply bindings required by ${options.name}`);
21
+ const value = await options.bindings.get(options.name);
22
+ if (value == null) throw new Error(`Hosted binding ${options.name} is not configured`);
23
+ const parsed = jsonValueSchema.safeParse(value);
24
+ if (!parsed.success) throw new Error(`Hosted binding ${options.name} is not JSON configuration`);
25
+ return parsed.data;
26
+ };
27
+ var hostedBindingRequirementSchema = object({
28
+ name: string().trim().min(1),
29
+ schema: jsonSchemaSchema
30
+ });
11
31
 
12
32
  // ../agent-provider/src/dynamic.ts
13
33
  var DynamicEvent = /* @__PURE__ */ ((DynamicEvent2) => {
@@ -22,7 +42,8 @@ var dynamicSlotSchema = object({
22
42
  events: array(nativeEnum(DynamicEvent)).min(1),
23
43
  // Final additions so Build can render a slot without resolving it.
24
44
  description: string().optional(),
25
- preview: string().optional()
45
+ preview: string().optional(),
46
+ requiredBindings: array(hostedBindingRequirementSchema).optional()
26
47
  })
27
48
  });
28
49
  var isDynamicSlot = (value) => dynamicSlotSchema.safeParse(value).success;
@@ -55,6 +76,8 @@ var findDynamicSlots = (value, path = "") => {
55
76
  var containsDynamicSlot = (value) => findDynamicSlots(value).length > 0;
56
77
 
57
78
  export {
79
+ requireHostedBinding,
80
+ hostedBindingRequirementSchema,
58
81
  DynamicEvent,
59
82
  dynamicSlotSchema,
60
83
  isDynamicSlot,
@@ -0,0 +1,39 @@
1
+ import {
2
+ validateHostedBindingRequirements
3
+ } from "./chunk-ULI5WWRR.ts";
4
+ import {
5
+ stamp
6
+ } from "./chunk-QJ26GEUM.ts";
7
+
8
+ // src/authoring/dynamic.ts
9
+ var defineDynamic = (definition) => {
10
+ const checked = (handler) => {
11
+ if (handler == null || (definition.requiredBindings?.length ?? 0) === 0) return handler;
12
+ return async (event, ctx) => {
13
+ await validateHostedBindingRequirements({
14
+ requirements: definition.requiredBindings ?? [],
15
+ bindings: ctx.bindings
16
+ });
17
+ const result = await handler(event, ctx);
18
+ if (result == null) throw new Error("Required hosted binding resolver returned no value");
19
+ return result;
20
+ };
21
+ };
22
+ const sentinel = {
23
+ kind: "final:dynamic",
24
+ events: {
25
+ ...definition.events,
26
+ "session.started": checked(definition.events["session.started"]),
27
+ "turn.started": checked(definition.events["turn.started"])
28
+ }
29
+ };
30
+ if (definition.description != null) sentinel.description = definition.description;
31
+ if (definition.preview != null) sentinel.preview = definition.preview;
32
+ if (definition.provider != null) sentinel.provider = definition.provider;
33
+ if (definition.requiredBindings != null) sentinel.requiredBindings = definition.requiredBindings;
34
+ return stamp(sentinel, "dynamic" /* Dynamic */);
35
+ };
36
+
37
+ export {
38
+ defineDynamic
39
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isObjectLike
3
- } from "./chunk-JIPNTA56.ts";
3
+ } from "./chunk-TM36NO3C.ts";
4
4
 
5
5
  // src/authoring/brand.ts
6
6
  var AuthoredKind = /* @__PURE__ */ ((AuthoredKind2) => {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  BaseCapability,
3
3
  providerRefSchema
4
- } from "./chunk-OWC6SFFF.ts";
5
- import {
6
- jsonObjectSchema,
7
- jsonSchemaSchema
8
- } from "./chunk-7QP2CKPI.ts";
4
+ } from "./chunk-APU2VKLW.ts";
9
5
  import {
10
6
  CredentialDelivery,
11
7
  InferenceCredentialKind
12
- } from "./chunk-HNPUTP35.ts";
8
+ } from "./chunk-GCFSHHH2.ts";
9
+ import {
10
+ jsonObjectSchema,
11
+ jsonSchemaSchema
12
+ } from "./chunk-4X2DS5BR.ts";
13
13
  import {
14
14
  array,
15
15
  boolean,
@@ -22,7 +22,7 @@ import {
22
22
  record,
23
23
  string,
24
24
  union
25
- } from "./chunk-HGW4YHAY.ts";
25
+ } from "./chunk-3K4C4SVG.ts";
26
26
 
27
27
  // ../agent-provider/src/schemas.ts
28
28
  var SCHEMA_IDS = {
@@ -260,7 +260,11 @@ var harnessDescriptionSchema = object({
260
260
  // the author's name to the text.
261
261
  authorMeta: boolean(),
262
262
  // Explicit false: native toolPolicy cannot be enforced by this adapter's public surface.
263
- nativeToolPolicy: boolean().optional()
263
+ nativeToolPolicy: boolean().optional(),
264
+ // Defers and searches MCP tools itself (a harness-native tool search): the
265
+ // host lists every exposed tool, ignoring connections' `tools.load`, and
266
+ // adds no search of its own. Absent: the host applies `load` and serves search.
267
+ deferredToolSearch: boolean().optional()
264
268
  }),
265
269
  promptWhileRunning: nativeEnum(PromptWhileRunning).default(DEFAULT_PROMPT_WHILE_RUNNING),
266
270
  // Keeps the session, its running work and its open requests across a dropped
File without changes
@@ -0,0 +1,61 @@
1
+ import {
2
+ mcpAuthSchema
3
+ } from "./chunk-APU2VKLW.ts";
4
+ import {
5
+ defineDynamic
6
+ } from "./chunk-PFLSBTJA.ts";
7
+ import {
8
+ requireHostedBinding
9
+ } from "./chunk-MSE7X5YG.ts";
10
+ import {
11
+ jsonObjectSchema
12
+ } from "./chunk-4X2DS5BR.ts";
13
+ import {
14
+ stamp
15
+ } from "./chunk-QJ26GEUM.ts";
16
+ import {
17
+ record,
18
+ strictObject,
19
+ string,
20
+ toJSONSchema
21
+ } from "./chunk-3K4C4SVG.ts";
22
+
23
+ // src/authoring/connections.ts
24
+ var defineMcpClientConnection = (definition) => stamp({ ...definition }, "connection" /* Connection */);
25
+ var hostedConnectionSchema = strictObject({
26
+ url: string().url(),
27
+ auth: mcpAuthSchema.nullable().optional(),
28
+ headers: record(string(), string()).optional()
29
+ });
30
+ var defineHostedConnection = (definition) => {
31
+ const { binding, description, tools, approval } = definition;
32
+ if (binding.trim().length === 0) throw new Error("Hosted connection binding must not be empty");
33
+ return defineDynamic({
34
+ description: definition.description ?? `Hosted connection ${binding}`,
35
+ preview: `Resolved by hosting from ${binding}`,
36
+ requiredBindings: [
37
+ { name: binding, schema: jsonObjectSchema.parse(toJSONSchema(hostedConnectionSchema)) }
38
+ ],
39
+ events: {
40
+ "session.started": async (_event, ctx) => {
41
+ const value = await requireHostedBinding({ bindings: ctx.bindings, name: binding });
42
+ const parsed = hostedConnectionSchema.safeParse(value);
43
+ if (!parsed.success)
44
+ throw new Error(`Hosted connection ${binding} has invalid configuration`);
45
+ const { auth, ...transport } = parsed.data;
46
+ return defineMcpClientConnection({
47
+ ...transport,
48
+ description,
49
+ tools,
50
+ approval,
51
+ ...auth == null ? {} : { auth }
52
+ });
53
+ }
54
+ }
55
+ });
56
+ };
57
+
58
+ export {
59
+ defineMcpClientConnection,
60
+ defineHostedConnection
61
+ };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  stamp
3
- } from "./chunk-XHKPWT3G.ts";
3
+ } from "./chunk-QJ26GEUM.ts";
4
4
  import {
5
5
  authoredRecordSchema,
6
6
  isCallable
7
- } from "./chunk-JIPNTA56.ts";
7
+ } from "./chunk-TM36NO3C.ts";
8
8
  import {
9
9
  looseObject
10
- } from "./chunk-HGW4YHAY.ts";
10
+ } from "./chunk-3K4C4SVG.ts";
11
11
 
12
12
  // src/authoring/hooks.ts
13
13
  var HookEvent = /* @__PURE__ */ ((HookEvent2) => {
@@ -7,7 +7,7 @@ import {
7
7
  record,
8
8
  string,
9
9
  unknown
10
- } from "./chunk-HGW4YHAY.ts";
10
+ } from "./chunk-3K4C4SVG.ts";
11
11
 
12
12
  // src/runtime/values.ts
13
13
  var authoredValueSchema = unknown();
@@ -13,16 +13,25 @@ import {
13
13
  note,
14
14
  sandboxProviderNameOf,
15
15
  toJson
16
- } from "./chunk-ZDLVA6XF.ts";
16
+ } from "./chunk-5NTKRRMC.ts";
17
17
  import {
18
18
  AGENT_DYNAMIC_PREFIX,
19
19
  namedExportName
20
20
  } from "./chunk-NMYHO2QN.ts";
21
+ import {
22
+ agentAvatarSchema
23
+ } from "./chunk-APU2VKLW.ts";
24
+ import {
25
+ hostedBindingRequirementSchema
26
+ } from "./chunk-MSE7X5YG.ts";
27
+ import {
28
+ jsonValueSchema
29
+ } from "./chunk-4X2DS5BR.ts";
21
30
  import {
22
31
  authoredKindOf,
23
32
  pendingEntries,
24
33
  pendingExportName
25
- } from "./chunk-XHKPWT3G.ts";
34
+ } from "./chunk-QJ26GEUM.ts";
26
35
  import {
27
36
  entriesOf,
28
37
  fieldOf,
@@ -33,11 +42,11 @@ import {
33
42
  isString,
34
43
  messageOf,
35
44
  stringOrNull
36
- } from "./chunk-JIPNTA56.ts";
45
+ } from "./chunk-TM36NO3C.ts";
37
46
  import {
38
47
  array,
39
48
  string
40
- } from "./chunk-HGW4YHAY.ts";
49
+ } from "./chunk-3K4C4SVG.ts";
41
50
 
42
51
  // src/runtime/describe.ts
43
52
  var describeDynamic = (value) => {
@@ -63,7 +72,8 @@ var describeDynamic = (value) => {
63
72
  events: dynamicEventsOf(value),
64
73
  description: stringOrNull(fieldOf(value, "description")),
65
74
  preview: stringOrNull(fieldOf(value, "preview")),
66
- provider: hint
75
+ provider: hint,
76
+ requiredBindings: array(hostedBindingRequirementSchema).parse(fieldOf(value, "requiredBindings") ?? [])
67
77
  };
68
78
  };
69
79
  var collectAgentDynamics = (agent) => {
@@ -90,13 +100,15 @@ var dynamicSlot = (value, path) => {
90
100
  const slot = { resolver: `${AGENT_DYNAMIC_PREFIX}${path}`, events: described.events };
91
101
  if (described.description != null) slot["description"] = described.description;
92
102
  if (described.preview != null) slot["preview"] = described.preview;
103
+ if ((described.requiredBindings?.length ?? 0) > 0)
104
+ slot["requiredBindings"] = jsonValueSchema.parse(described.requiredBindings);
93
105
  return { $dynamic: slot };
94
106
  };
95
107
  var isDefinedHarnessLike = (value) => isCallable(value) && isCallable(fieldOf(value, "describe")) && isCallable(fieldOf(value, "open"));
96
108
  var KNOWN_AGENT_FIELDS = /* @__PURE__ */ new Set([
97
109
  "name",
98
110
  "description",
99
- "avatarUrl",
111
+ "avatar",
100
112
  "harness",
101
113
  "tools",
102
114
  "toolPolicy",
@@ -123,7 +135,7 @@ var unknownAgentField = (key) => {
123
135
  if (key === "defaultTools")
124
136
  return "agent.ts field defaultTools is not supported: base tools are declared with tools: baseTools({ ... }) and are off by default";
125
137
  if (key === "subagents" || key === "memory") return `agent.ts field ${key} is not supported yet`;
126
- return `agent.ts field ${key} is not an agent field (name, description, avatarUrl, harness, tools, toolPolicy, secrets, channels)`;
138
+ return `agent.ts field ${key} is not an agent field (name, description, avatar, harness, tools, toolPolicy, secrets, channels)`;
127
139
  };
128
140
  var describeHarness = (harness, ctx, issues) => {
129
141
  if (harness == null) return null;
@@ -193,6 +205,19 @@ var describeSecrets = (value, issues) => {
193
205
  issues.push(error("agent.ts secrets must be a list of secret names"));
194
206
  return null;
195
207
  };
208
+ var describeAvatar = (value, issues) => {
209
+ if (value === void 0) return null;
210
+ const parsed = agentAvatarSchema.safeParse(toJson(value, { path: "avatar", issues }));
211
+ if (parsed.success) return parsed.data;
212
+ for (const issue of parsed.error.issues) {
213
+ issues.push(
214
+ error(
215
+ `agent.ts avatar${issue.path.length > 0 ? `.${issue.path.join(".")}` : ""}: ${issue.message}`
216
+ )
217
+ );
218
+ }
219
+ return null;
220
+ };
196
221
  var describeAgent = (value, ctx, issues) => {
197
222
  if (value == null) return null;
198
223
  if (!isPlainObject(value)) {
@@ -231,7 +256,7 @@ var describeAgent = (value, ctx, issues) => {
231
256
  type: "agent",
232
257
  name: stringOrNull(value["name"]),
233
258
  description: stringOrNull(value["description"]),
234
- avatarUrl: stringOrNull(value["avatarUrl"]),
259
+ avatar: describeAvatar(value["avatar"], issues),
235
260
  harness: describeHarness(value["harness"], ctx, issues),
236
261
  tools: baseToolsDescription?.targets ?? null,
237
262
  hostTools: baseToolsDescription?.host ?? null,
@@ -0,0 +1,40 @@
1
+ import {
2
+ jsonSchemaError
3
+ } from "./chunk-W6DOJA4W.ts";
4
+ import {
5
+ findDynamicSlots,
6
+ requireHostedBinding
7
+ } from "./chunk-MSE7X5YG.ts";
8
+
9
+ // src/hosted-bindings.ts
10
+ var validateHostedBindings = async (options) => {
11
+ await validateHostedBindingRequirements({
12
+ requirements: findDynamicSlots(options.manifest).flatMap(
13
+ ({ slot }) => slot.$dynamic.requiredBindings ?? []
14
+ ),
15
+ bindings: options.bindings
16
+ });
17
+ };
18
+ var validateHostedBindingRequirements = async (options) => {
19
+ const values = /* @__PURE__ */ new Map();
20
+ for (const requirement of options.requirements) {
21
+ let value = values.get(requirement.name);
22
+ if (value == null) {
23
+ value = await requireHostedBinding({ bindings: options.bindings, name: requirement.name });
24
+ values.set(requirement.name, value);
25
+ }
26
+ let validationError;
27
+ try {
28
+ validationError = jsonSchemaError(requirement.schema, value);
29
+ } catch {
30
+ throw new Error(`Hosted binding ${requirement.name} has an invalid schema`);
31
+ }
32
+ if (validationError != null)
33
+ throw new Error(`Hosted binding ${requirement.name} has invalid configuration`);
34
+ }
35
+ };
36
+
37
+ export {
38
+ validateHostedBindings,
39
+ validateHostedBindingRequirements
40
+ };