@finalai/daytona-agent-provider 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 (2) hide show
  1. package/HOSTING.md +165 -0
  2. package/package.json +3 -2
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finalai/daytona-agent-provider",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "description": "Daytona's provider package: the daytona sandbox over Daytona's public API, implementing only the public sandbox provider contract.",
6
6
  "license": "Apache-2.0",
@@ -9,6 +9,7 @@
9
9
  "README.md",
10
10
  "LICENSE",
11
11
  "NOTICE",
12
+ "HOSTING.md",
12
13
  "THIRD_PARTY_NOTICES.md"
13
14
  ],
14
15
  "type": "module",
@@ -36,7 +37,7 @@
36
37
  "registry": "https://registry.npmjs.org/"
37
38
  },
38
39
  "dependencies": {
39
- "@finalai/agent-provider": "0.1.2",
40
+ "@finalai/agent-provider": "0.1.3",
40
41
  "zod": "4.6.5"
41
42
  },
42
43
  "engines": {