@finalai/agent-definition 0.1.2 → 0.1.3

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 (105) hide show
  1. package/HOSTING.md +165 -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-JPY4L2UJ.ts → chunk-3YAKMWV4.ts} +7 -7
  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-5IZTHCGZ.ts} +8 -8
  9. package/dist/compiler-assets/{chunk-2CZRHOLL.ts → chunk-7XUPKRZU.ts} +1 -1
  10. package/dist/compiler-assets/{chunk-7VSSVZM4.ts → chunk-BEFBCBUL.ts} +4 -4
  11. package/dist/compiler-assets/{chunk-HFS4KLEL.ts → chunk-D3SB4CCB.ts} +1 -1
  12. package/dist/compiler-assets/{chunk-EVQIK62B.ts → chunk-FHKYXT3F.ts} +11 -7
  13. package/dist/compiler-assets/{chunk-HNPUTP35.ts → chunk-GCFSHHH2.ts} +2 -2
  14. package/dist/compiler-assets/{chunk-MZMSKIKU.ts → chunk-I6U47R5U.ts} +14 -5
  15. package/dist/compiler-assets/{chunk-5BK6FVRE.ts → chunk-IF6MR7JF.ts} +2 -2
  16. package/dist/compiler-assets/{chunk-LUSAAV4L.ts → chunk-IZGOMT7K.ts} +2 -2
  17. package/dist/compiler-assets/{chunk-GTUZOATD.ts → chunk-JGQ2KAN7.ts} +1 -1
  18. package/dist/compiler-assets/chunk-JXJPBM5W.ts +61 -0
  19. package/dist/compiler-assets/{chunk-NYTOYKKF.ts → chunk-K6D7ZK74.ts} +3 -3
  20. package/dist/compiler-assets/{chunk-WMXMVFHM.ts → chunk-K7V4IMOB.ts} +3 -3
  21. package/dist/compiler-assets/{chunk-VHXHUU7L.ts → chunk-LHMUAIYJ.ts} +1 -1
  22. package/dist/compiler-assets/{chunk-SKTNMUO7.ts → chunk-MSE7X5YG.ts} +25 -2
  23. package/dist/compiler-assets/{chunk-OWC6SFFF.ts → chunk-OO67EO5E.ts} +10 -9
  24. package/dist/compiler-assets/chunk-PFLSBTJA.ts +39 -0
  25. package/dist/compiler-assets/{chunk-XHKPWT3G.ts → chunk-QJ26GEUM.ts} +1 -1
  26. package/dist/compiler-assets/chunk-RMIQJHSL.ts +0 -0
  27. package/dist/compiler-assets/{chunk-BLB6JGLO.ts → chunk-TCKYMNPM.ts} +27 -24
  28. package/dist/compiler-assets/{chunk-QMWTDPNT.ts → chunk-TJZS457N.ts} +3 -3
  29. package/dist/compiler-assets/{chunk-JIPNTA56.ts → chunk-TM36NO3C.ts} +1 -1
  30. package/dist/compiler-assets/{chunk-QMKWAFVZ.ts → chunk-TS7XNNHN.ts} +3 -3
  31. package/dist/compiler-assets/chunk-ULI5WWRR.ts +40 -0
  32. package/dist/compiler-assets/chunk-W6DOJA4W.ts +3763 -0
  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 +50 -41
  51. package/dist/compiler-assets/src/manifest.ts +4 -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 +16 -11
  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/connections.d.mts +5 -0
  61. package/dist/modules/authoring/connections.mjs +36 -0
  62. package/dist/modules/authoring/connections.mjs.map +2 -2
  63. package/dist/modules/authoring/context.d.mts +3 -1
  64. package/dist/modules/authoring/context.mjs.map +2 -2
  65. package/dist/modules/authoring/dynamic.d.mts +3 -1
  66. package/dist/modules/authoring/dynamic.mjs +19 -1
  67. package/dist/modules/authoring/dynamic.mjs.map +2 -2
  68. package/dist/modules/authoring/hooks.d.mts +2 -1
  69. package/dist/modules/authoring/hooks.mjs.map +2 -2
  70. package/dist/modules/authoring/index.d.mts +4 -2
  71. package/dist/modules/authoring/index.mjs +4 -1
  72. package/dist/modules/authoring/index.mjs.map +2 -2
  73. package/dist/modules/authoring/sandbox.d.mts +2 -1
  74. package/dist/modules/authoring/sandbox.mjs.map +2 -2
  75. package/dist/modules/compiler/assemble.mjs +5 -0
  76. package/dist/modules/compiler/assemble.mjs.map +2 -2
  77. package/dist/modules/compiler/index.d.mts +2 -1
  78. package/dist/modules/compiler/index.mjs +18 -0
  79. package/dist/modules/compiler/index.mjs.map +2 -2
  80. package/dist/modules/compiler/local-isolate.d.mts +2 -1
  81. package/dist/modules/compiler/local-isolate.mjs +6 -1
  82. package/dist/modules/compiler/local-isolate.mjs.map +2 -2
  83. package/dist/modules/hosted-bindings.d.mts +10 -0
  84. package/dist/modules/hosted-bindings.mjs +36 -0
  85. package/dist/modules/hosted-bindings.mjs.map +7 -0
  86. package/dist/modules/index.d.mts +2 -0
  87. package/dist/modules/index.mjs +2 -0
  88. package/dist/modules/index.mjs.map +2 -2
  89. package/dist/modules/resolve.mjs +4 -0
  90. package/dist/modules/resolve.mjs.map +2 -2
  91. package/dist/modules/runtime/describe.mjs +8 -1
  92. package/dist/modules/runtime/describe.mjs.map +2 -2
  93. package/dist/modules/runtime/described.d.mts +36 -0
  94. package/dist/modules/runtime/described.mjs +2 -1
  95. package/dist/modules/runtime/described.mjs.map +2 -2
  96. package/dist/modules/runtime/isolate.d.mts +2 -0
  97. package/dist/modules/runtime/isolate.mjs +7 -4
  98. package/dist/modules/runtime/isolate.mjs.map +2 -2
  99. package/dist/modules/runtime/schema-validation.mjs +19 -2
  100. package/dist/modules/runtime/schema-validation.mjs.map +2 -2
  101. package/package.json +4 -3
  102. package/dist/compiler-assets/chunk-GNR7XBPN.ts +0 -3364
  103. package/dist/compiler-assets/chunk-JNJE72EH.ts +0 -10
  104. package/dist/compiler-assets/chunk-T6WG4L4M.ts +0 -19
  105. /package/dist/compiler-assets/{chunk-6WR3PGNF.ts → chunk-CIWWFQHL.ts} +0 -0
package/HOSTING.md ADDED
@@ -0,0 +1,165 @@
1
+ # Portable agent definitions and hosted bindings
2
+
3
+ An agent declares behavior and logical resources. Hosting supplies endpoints,
4
+ resource identifiers, and credential references. The same compiled source can
5
+ resolve against dev and production configuration without source edits.
6
+
7
+ ## Selecting a deployment
8
+
9
+ ```sh
10
+ export FINAL_API_HOST=https://agent-session.primary-dev.final.ai/api
11
+ export FINAL_API_KEY=<dev-organization-key>
12
+ pnpm exec final-agents build ./agent
13
+ pnpm exec final-agents publish ./agent --agent my-agent
14
+ ```
15
+
16
+ Choose production by changing the host and organization key. `--host` overrides
17
+ `FINAL_API_HOST`; without either, the existing production default remains. Build
18
+ compiles locally and optionally checks installed-harness compatibility. Publish
19
+ compiles again and sends source/release requests to the selected deployment.
20
+ Neither rewrites authored URLs. A GitHub-backed definition uses remote source;
21
+ push edits before explicitly publishing a ref. Caller API keys never become agent
22
+ credentials merely because they were used to publish.
23
+
24
+ ## Hosted connections
25
+
26
+ ```ts
27
+ import { defineHostedConnection } from '@finalai/agents';
28
+
29
+ export default defineHostedConnection({
30
+ binding: 'issue-tracker',
31
+ tools: { allow: ['read_issue'], deny: ['delete_issue'] },
32
+ });
33
+ ```
34
+
35
+ `issue-tracker` is an example configuration name, not a built-in service.
36
+ Hosting configures it with non-secret JSON:
37
+
38
+ ```json
39
+ {
40
+ "url": "https://issues.dev.example/mcp",
41
+ "auth": { "secretKey": "ISSUE_TRACKER_TOKEN", "headerName": null },
42
+ "headers": { "X-Workspace": "development" }
43
+ }
44
+ ```
45
+
46
+ Production supplies another value under the same name. The helper uses an ordinary
47
+ `defineDynamic` connection at `session.started`, then the usual HTTP MCP lowering,
48
+ validation, permissions, and credential broker. Hosting supplies transport settings,
49
+ not tool policies. URL, authentication references, transport headers belong to hosting; the hosted helper does
50
+ not accept authored overrides for these fields. Referenced secrets still need the agent's secret allowlist and normal
51
+ authorization. Actual tokens must not be returned in configuration headers.
52
+
53
+ Final uses the same generic helper:
54
+
55
+ ```ts
56
+ import { defineFinalConnection } from '@finalai/agents';
57
+
58
+ export default defineFinalConnection({
59
+ tools: { deny: ['create_agent_session'] },
60
+ });
61
+ ```
62
+
63
+ This resolves the `final` binding. Hosting supplies its URL and
64
+ `auth: { kind: 'final-session' }`, just as it supplies authentication for any
65
+ other hosted connection. `binding`
66
+ selects another name. Existing explicit `url` calls remain static and compatible;
67
+ they always point at that URL. There is no Final-specific compiler rewrite.
68
+
69
+ ## Resources and provider packages
70
+
71
+ `HostedBindingsIface` is the shared `@finalai/agent-provider` contract. Hosting
72
+ implements `get(name)` to return scoped JSON or null. `requireHostedBinding` rejects
73
+ missing hosting, absent names, and invalid JSON without an environment fallback.
74
+ Names are configuration keys, not global permissions or inferred URLs.
75
+
76
+ Tools, hooks, dynamic resolvers, sandbox selectors, and harness/sandbox/channel
77
+ provider contexts expose an optional `bindings` reader. A third-party resolver can
78
+ use the same reader for model or resource configuration:
79
+
80
+ ```ts
81
+ import { defineDynamic, requireHostedBinding } from '@finalai/agents';
82
+
83
+ export const model = defineDynamic({
84
+ requiredBindings: [{ name: 'primary-model', schema: { type: 'string', minLength: 1 } }],
85
+ description: 'The deployment model',
86
+ preview: 'Resolved from primary-model',
87
+ events: {
88
+ 'session.started': async (_event, ctx) =>
89
+ requireHostedBinding({ bindings: ctx.bindings, name: 'primary-model' }),
90
+ },
91
+ });
92
+ ```
93
+
94
+ Use that value in a harness configuration supporting dynamic models. A resource
95
+ binding can similarly contain a repository, guide slug, device ID, or non-secret
96
+ SDK base URL; the consumer validates the resource-specific schema. Literal IDs,
97
+ custom URLs, and external credential choices are never silently rewritten.
98
+
99
+ Installed providers already accept factory configuration injected by hosting.
100
+ Keep supplying deployment service URLs there. Computer/WebSocket clients retain
101
+ explicit configuration; a hosted provider can obtain it through this shared reader.
102
+ Package versions stay pinned. Packages do not read a global DEV/PROD flag.
103
+
104
+ ## Declared requirements and user experience
105
+
106
+ `defineHostedConnection` declares its binding name and JSON configuration schema
107
+ in the compiled dynamic slot automatically. Other dynamic consumers declare
108
+ `requiredBindings` as in the model example. Hosts can inspect these requirements
109
+ without running authored resolvers. Repeated names must satisfy every declared
110
+ schema; names are looked up once per preflight.
111
+
112
+ Before accepting a release, hosting calls
113
+ `validateHostedBindings({ manifest, bindings })` with a reader scoped to the
114
+ selected deployment, organization, and agent. Hosts compiling source can instead
115
+ pass `hostedBindings` to `compile`; failed preflight returns error diagnostics and
116
+ no manifest or bundle. An offline build can still compile and expose requirements
117
+ without accessing deployment configuration. The CLI does not yet fetch binding
118
+ configuration itself: server-side publication must enable this preflight.
119
+
120
+ When dev is selected, lookups use only dev configuration. A missing dev binding
121
+ fails even if production has the same name; never retry against production or
122
+ substitute a production default. Changing the CLI host selects where to publish;
123
+ the runtime reader comes from that deployment, not from the author's environment.
124
+ Explicit authored URLs retain their literal destination.
125
+
126
+ Authors keep one source definition. Operators configure its named connections
127
+ and resources once in each deployment. End users start the agent as usual; an
128
+ unconfigured required resource produces a configuration failure instead of a
129
+ session silently missing tools. Dynamic handlers validate declared requirements
130
+ before running. Shared manifest resolution rejects null results for required slots,
131
+ even if a host catches a resolver exception and returns null. Hosts must propagate
132
+ that failure to startup. Session-started values stay pinned across turns and resume.
133
+
134
+ This PR adds no configuration UI. A host can use the compiled requirements to show
135
+ which names need configuration and return an actionable deployment-specific error.
136
+
137
+ ## Host integration
138
+
139
+ These packages implement contracts and authored runtime behavior, not a deployment
140
+ configuration store or RPC service. Existing hosting needs to:
141
+
142
+ 1. Resolve names within the authorized deployment, organization, and agent; never
143
+ expose the process environment or an unrestricted cross-tenant registry.
144
+ 2. Inject `bindings` into lifecycle resolution and the tool/hook/selector/provider
145
+ contexts using it. Dynamic approval evaluation and tool reconstruction after
146
+ isolate eviction need the same reader. Readers and tokens are not persisted in
147
+ boundary snapshots.
148
+ 3. Configure `final` with that deployment's approved MCP endpoint. The ordinary
149
+ broker continues restricting `final-session` grants to that endpoint.
150
+ 4. Return non-secret configuration and credential references, with normal provider,
151
+ secret, resource, and organization authorization.
152
+ 5. Run the release preflight above and validate again before starting a new
153
+ session. Treat failed required-binding resolution as a startup/configuration error, not
154
+ an omitted connection or a fallback to production. Preserve existing runtime
155
+ revisions when publication fails.
156
+ 6. Retain session-started resolved values across turns/resume; resolve new sessions
157
+ against their own deployment.
158
+
159
+ Optional readers preserve source compatibility with existing hosts. Definitions
160
+ requesting bindings fail clearly if hosting does not provide them. Installing these
161
+ packages alone does not change Final's deployed service wiring or provision secrets.
162
+
163
+ New compiles emit manifest version 3, so older hosts reject them rather than
164
+ stripping required-binding metadata. Updated readers still accept persisted
165
+ version 2 revisions. Upgrade hosting before publishing newly compiled agents.
package/README.md CHANGED
@@ -14,3 +14,10 @@ resolves those convenience entrypoints for the generic compiler.
14
14
 
15
15
  Custom provider contracts and sandbox implementation helpers are available directly
16
16
  from `@finalai/agent-provider` and `@finalai/agent-provider/sandbox`.
17
+
18
+ `defineHostedConnection` resolves a named transport through the existing dynamic
19
+ connection lifecycle. `DynamicResolveContextIface.bindings` is the optional shared
20
+ host reader; use `requireHostedBinding` for configuration and logical resource
21
+ references. Missing required bindings reject resolution. No environment URLs are
22
+ chosen by the compiler. Dynamic approval/tool reconstruction must receive the same
23
+ reader from hosting. See the repository's [hosting guide](HOSTING.md).
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  resultMatchesSchema
3
- } from "./chunk-GNR7XBPN.ts";
3
+ } from "./chunk-W6DOJA4W.ts";
4
4
  import {
5
5
  stamp
6
- } from "./chunk-XHKPWT3G.ts";
6
+ } from "./chunk-QJ26GEUM.ts";
7
7
  import {
8
8
  callableSchema,
9
9
  isObjectLike,
10
10
  optionalValueSchema
11
- } from "./chunk-JIPNTA56.ts";
11
+ } from "./chunk-TM36NO3C.ts";
12
12
  import {
13
13
  array,
14
14
  boolean,
@@ -16,7 +16,7 @@ import {
16
16
  object,
17
17
  string,
18
18
  union
19
- } from "./chunk-HGW4YHAY.ts";
19
+ } from "./chunk-3K4C4SVG.ts";
20
20
 
21
21
  // src/authoring/tools.ts
22
22
  var toolLabelSchema = union([
@@ -6449,6 +6449,14 @@ function object(shape, params) {
6449
6449
  };
6450
6450
  return new ZodObject(def);
6451
6451
  }
6452
+ function strictObject(shape, params) {
6453
+ return new ZodObject({
6454
+ type: "object",
6455
+ shape,
6456
+ catchall: never(),
6457
+ ...util_exports.normalizeParams(params)
6458
+ });
6459
+ }
6452
6460
  function looseObject(shape, params) {
6453
6461
  return new ZodObject({
6454
6462
  type: "object",
@@ -6851,6 +6859,7 @@ export {
6851
6859
  unknown,
6852
6860
  array,
6853
6861
  object,
6862
+ strictObject,
6854
6863
  looseObject,
6855
6864
  union,
6856
6865
  discriminatedUnion,
@@ -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-OO67EO5E.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 = {
@@ -7,7 +7,7 @@ import {
7
7
  object,
8
8
  string,
9
9
  unknown
10
- } from "./chunk-HGW4YHAY.ts";
10
+ } from "./chunk-3K4C4SVG.ts";
11
11
 
12
12
  // ../agent-provider/src/sandbox/open-scope.ts
13
13
  var openRequestFieldsSchema = looseObject({
@@ -7,7 +7,7 @@ import {
7
7
  record,
8
8
  string,
9
9
  union
10
- } from "./chunk-HGW4YHAY.ts";
10
+ } from "./chunk-3K4C4SVG.ts";
11
11
 
12
12
  // ../agent-provider/src/json.ts
13
13
  var jsonValueSchema = lazy(
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  toolLabelSchema
3
- } from "./chunk-TATN3PYK.ts";
4
- import {
5
- jsonSchemaDeclarationError
6
- } from "./chunk-GNR7XBPN.ts";
3
+ } from "./chunk-2ZRYQO4Q.ts";
7
4
  import {
8
5
  lowerApproval
9
- } from "./chunk-7VSSVZM4.ts";
6
+ } from "./chunk-BEFBCBUL.ts";
7
+ import {
8
+ jsonSchemaDeclarationError
9
+ } from "./chunk-W6DOJA4W.ts";
10
10
  import {
11
11
  authoredKindOf,
12
12
  pendingExportName,
13
13
  pendingIndexOf
14
- } from "./chunk-XHKPWT3G.ts";
14
+ } from "./chunk-QJ26GEUM.ts";
15
15
  import {
16
16
  authoredRecordSchema,
17
17
  authoredValueSchema,
@@ -26,7 +26,7 @@ import {
26
26
  isString,
27
27
  messageOf,
28
28
  optionalValueSchema
29
- } from "./chunk-JIPNTA56.ts";
29
+ } from "./chunk-TM36NO3C.ts";
30
30
  import {
31
31
  ZodType,
32
32
  array,
@@ -39,7 +39,7 @@ import {
39
39
  toJSONSchema,
40
40
  union,
41
41
  url
42
- } from "./chunk-HGW4YHAY.ts";
42
+ } from "./chunk-3K4C4SVG.ts";
43
43
 
44
44
  // src/runtime/lower.ts
45
45
  var IssueSeverity = /* @__PURE__ */ ((IssueSeverity2) => {
@@ -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/agent.ts
6
6
  var defineAgent = (definition) => stamp({ ...definition }, "agent" /* Agent */);
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  ToolApproval
3
- } from "./chunk-OWC6SFFF.ts";
3
+ } from "./chunk-OO67EO5E.ts";
4
4
  import {
5
5
  authoredKindOf,
6
6
  stamp
7
- } from "./chunk-XHKPWT3G.ts";
7
+ } from "./chunk-QJ26GEUM.ts";
8
8
  import {
9
9
  callableSchema
10
- } from "./chunk-JIPNTA56.ts";
10
+ } from "./chunk-TM36NO3C.ts";
11
11
  import {
12
12
  nativeEnum,
13
13
  object,
14
14
  string
15
- } from "./chunk-HGW4YHAY.ts";
15
+ } from "./chunk-3K4C4SVG.ts";
16
16
 
17
17
  // src/authoring/approval.ts
18
18
  var policy = (value, note = null) => stamp({ policy: value, note }, "approval" /* Approval */);
@@ -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 */);
@@ -6,15 +6,15 @@ import {
6
6
  resolvedAgentManifestSchema,
7
7
  sandboxBindingSchema,
8
8
  skillBundleSchema
9
- } from "./chunk-OWC6SFFF.ts";
10
- import {
11
- jsonObjectSchema,
12
- jsonValueSchema
13
- } from "./chunk-7QP2CKPI.ts";
9
+ } from "./chunk-OO67EO5E.ts";
14
10
  import {
15
11
  findDynamicSlots,
16
12
  isDynamicSlot
17
- } from "./chunk-SKTNMUO7.ts";
13
+ } from "./chunk-MSE7X5YG.ts";
14
+ import {
15
+ jsonObjectSchema,
16
+ jsonValueSchema
17
+ } from "./chunk-4X2DS5BR.ts";
18
18
  import {
19
19
  _null,
20
20
  array,
@@ -22,7 +22,7 @@ import {
22
22
  number,
23
23
  record,
24
24
  string
25
- } from "./chunk-HGW4YHAY.ts";
25
+ } from "./chunk-3K4C4SVG.ts";
26
26
 
27
27
  // src/resolve.ts
28
28
  var SlotValueKind = /* @__PURE__ */ ((SlotValueKind2) => {
@@ -157,6 +157,10 @@ var resolveManifestDetailed = async (args) => {
157
157
  for (const found of slots) {
158
158
  const subscribed = found.slot.$dynamic.events.includes(args.event);
159
159
  const raw = subscribed ? await args.resolve(found.slot, found.path) : args.previous?.[found.path] ?? null;
160
+ if ((found.slot.$dynamic.requiredBindings?.length ?? 0) > 0 && raw == null)
161
+ throw new Error(
162
+ `Required hosted bindings for ${found.path} did not resolve: ${found.slot.$dynamic.requiredBindings?.map((item) => item.name).join(", ")}`
163
+ );
160
164
  if (subscribed) checkEnvironmentProvider(args.manifest, found.path, raw);
161
165
  normalized[found.path] = validateSlotValue(found.path, raw) ?? FIELD_DEFAULTS.get(found.path) ?? null;
162
166
  values[found.path] = slotKindOf(found.path) === "sandbox-environment" /* SandboxEnvironment */ ? raw : normalized[found.path] ?? null;
@@ -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) => {
@@ -13,16 +13,22 @@ import {
13
13
  note,
14
14
  sandboxProviderNameOf,
15
15
  toJson
16
- } from "./chunk-ZDLVA6XF.ts";
16
+ } from "./chunk-5IZTHCGZ.ts";
17
17
  import {
18
18
  AGENT_DYNAMIC_PREFIX,
19
19
  namedExportName
20
20
  } from "./chunk-NMYHO2QN.ts";
21
+ import {
22
+ hostedBindingRequirementSchema
23
+ } from "./chunk-MSE7X5YG.ts";
24
+ import {
25
+ jsonValueSchema
26
+ } from "./chunk-4X2DS5BR.ts";
21
27
  import {
22
28
  authoredKindOf,
23
29
  pendingEntries,
24
30
  pendingExportName
25
- } from "./chunk-XHKPWT3G.ts";
31
+ } from "./chunk-QJ26GEUM.ts";
26
32
  import {
27
33
  entriesOf,
28
34
  fieldOf,
@@ -33,11 +39,11 @@ import {
33
39
  isString,
34
40
  messageOf,
35
41
  stringOrNull
36
- } from "./chunk-JIPNTA56.ts";
42
+ } from "./chunk-TM36NO3C.ts";
37
43
  import {
38
44
  array,
39
45
  string
40
- } from "./chunk-HGW4YHAY.ts";
46
+ } from "./chunk-3K4C4SVG.ts";
41
47
 
42
48
  // src/runtime/describe.ts
43
49
  var describeDynamic = (value) => {
@@ -63,7 +69,8 @@ var describeDynamic = (value) => {
63
69
  events: dynamicEventsOf(value),
64
70
  description: stringOrNull(fieldOf(value, "description")),
65
71
  preview: stringOrNull(fieldOf(value, "preview")),
66
- provider: hint
72
+ provider: hint,
73
+ requiredBindings: array(hostedBindingRequirementSchema).parse(fieldOf(value, "requiredBindings") ?? [])
67
74
  };
68
75
  };
69
76
  var collectAgentDynamics = (agent) => {
@@ -90,6 +97,8 @@ var dynamicSlot = (value, path) => {
90
97
  const slot = { resolver: `${AGENT_DYNAMIC_PREFIX}${path}`, events: described.events };
91
98
  if (described.description != null) slot["description"] = described.description;
92
99
  if (described.preview != null) slot["preview"] = described.preview;
100
+ if ((described.requiredBindings?.length ?? 0) > 0)
101
+ slot["requiredBindings"] = jsonValueSchema.parse(described.requiredBindings);
93
102
  return { $dynamic: slot };
94
103
  };
95
104
  var isDefinedHarnessLike = (value) => isCallable(value) && isCallable(fieldOf(value, "describe")) && isCallable(fieldOf(value, "open"));
@@ -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 */);
@@ -0,0 +1,61 @@
1
+ import {
2
+ mcpAuthSchema
3
+ } from "./chunk-OO67EO5E.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
  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(