@finalai/final-agent-provider 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.
package/HOSTING.md ADDED
@@ -0,0 +1,234 @@
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
+ ## Connection tool policy
70
+
71
+ `tools.allow`, `tools.deny` and `tools.approval` keys are tool names or `*`
72
+ patterns, so a definition can scope a connection whose tool list it does not know:
73
+
74
+ ```ts
75
+ export default defineFinalConnection({
76
+ tools: {
77
+ allow: ['github.*', 'list_goals'],
78
+ deny: ['github.delete_repo'],
79
+ approval: { 'github.delete_*': always() },
80
+ },
81
+ });
82
+ ```
83
+
84
+ `*` matches any run of characters; everything else matches literally. `deny` wins
85
+ over `allow`. The most specific key governs a tool: an exact name, else the matching
86
+ pattern with the most literal characters, with ties resolved toward `ask`. Hosts
87
+ enforce this through `isToolExposed` and `toolApprovalOf` from
88
+ `@finalai/agent-provider`, and look up a tool's input-approval predicate under the
89
+ key `resolveToolApprovalKey` returns.
90
+
91
+ ## Loaded and searchable tools
92
+
93
+ A connection that can expose many tools, such as Final's with every service the
94
+ person has connected, can name the ones the harness should list up front:
95
+
96
+ ```ts
97
+ export default defineFinalConnection({
98
+ tools: { load: ['list_goals', 'get_goal', 'draft_goal', 'notify_user'] },
99
+ });
100
+ ```
101
+
102
+ Without `load`, the harness lists every exposed tool, as before. With it, the host
103
+ lists only the loaded tools and must keep every other exposed tool reachable: it
104
+ serves a search over the connection's remaining exposed tools (name, description,
105
+ input schema) and a call that runs a found tool by its real name, with the same
106
+ exposure and approval checks as a direct call. A host may instead add a found tool
107
+ to the list and send `notifications/tools/list_changed`; harnesses that ignore that
108
+ notification still need the call path. `load: []` leaves every tool to search.
109
+ Entries are tool names or `*` patterns. `isToolLoaded` from `@finalai/agent-provider`
110
+ applies the rule after exposure.
111
+
112
+ ## Selecting tools by annotation
113
+
114
+ `tools.allow` and `tools.deny` entries can be MCP annotation selectors as well as
115
+ tool names, so a definition can scope tools it cannot name in advance:
116
+
117
+ ```ts
118
+ export default defineFinalConnection({
119
+ tools: {
120
+ allow: ['list_goals', 'draft_goal', { readOnlyHint: true }],
121
+ deny: [{ destructiveHint: true, readOnlyHint: false }],
122
+ },
123
+ });
124
+ ```
125
+
126
+ A selector matches when every hint it sets equals the tool's hint, reading hints the
127
+ tool omits as the MCP spec's defaults (not read-only, destructive, not idempotent,
128
+ open world). The annotations come from the connection's server, so select on them
129
+ only for servers trusted to classify their own tools.
130
+
131
+ Selectors lower to `allowAnnotations` (each with the connection default approval and
132
+ input predicate) and `denyAnnotations`. A host exposes a tool when nothing in `deny`
133
+ or `denyAnnotations` matches it and either an `approvals` key (name or pattern)
134
+ governs it, `approvals` is null, or `toolAnnotationRuleFor` finds a rule; a tool an
135
+ `approvals` key governs keeps that approval, otherwise it runs under the rule's. `tools.approval` overrides apply only to
136
+ named tools.
137
+
138
+ ## Resources and provider packages
139
+
140
+ `HostedBindingsIface` is the shared `@finalai/agent-provider` contract. Hosting
141
+ implements `get(name)` to return scoped JSON or null. `requireHostedBinding` rejects
142
+ missing hosting, absent names, and invalid JSON without an environment fallback.
143
+ Names are configuration keys, not global permissions or inferred URLs.
144
+
145
+ Tools, hooks, dynamic resolvers, sandbox selectors, and harness/sandbox/channel
146
+ provider contexts expose an optional `bindings` reader. A third-party resolver can
147
+ use the same reader for model or resource configuration:
148
+
149
+ ```ts
150
+ import { defineDynamic, requireHostedBinding } from '@finalai/agents';
151
+
152
+ export const model = defineDynamic({
153
+ requiredBindings: [{ name: 'primary-model', schema: { type: 'string', minLength: 1 } }],
154
+ description: 'The deployment model',
155
+ preview: 'Resolved from primary-model',
156
+ events: {
157
+ 'session.started': async (_event, ctx) =>
158
+ requireHostedBinding({ bindings: ctx.bindings, name: 'primary-model' }),
159
+ },
160
+ });
161
+ ```
162
+
163
+ Use that value in a harness configuration supporting dynamic models. A resource
164
+ binding can similarly contain a repository, guide slug, device ID, or non-secret
165
+ SDK base URL; the consumer validates the resource-specific schema. Literal IDs,
166
+ custom URLs, and external credential choices are never silently rewritten.
167
+
168
+ Installed providers already accept factory configuration injected by hosting.
169
+ Keep supplying deployment service URLs there. Computer/WebSocket clients retain
170
+ explicit configuration; a hosted provider can obtain it through this shared reader.
171
+ Package versions stay pinned. Packages do not read a global DEV/PROD flag.
172
+
173
+ ## Declared requirements and user experience
174
+
175
+ `defineHostedConnection` declares its binding name and JSON configuration schema
176
+ in the compiled dynamic slot automatically. Other dynamic consumers declare
177
+ `requiredBindings` as in the model example. Hosts can inspect these requirements
178
+ without running authored resolvers. Repeated names must satisfy every declared
179
+ schema; names are looked up once per preflight.
180
+
181
+ Before accepting a release, hosting calls
182
+ `validateHostedBindings({ manifest, bindings })` with a reader scoped to the
183
+ selected deployment, organization, and agent. Hosts compiling source can instead
184
+ pass `hostedBindings` to `compile`; failed preflight returns error diagnostics and
185
+ no manifest or bundle. An offline build can still compile and expose requirements
186
+ without accessing deployment configuration. The CLI does not yet fetch binding
187
+ configuration itself: server-side publication must enable this preflight.
188
+
189
+ When dev is selected, lookups use only dev configuration. A missing dev binding
190
+ fails even if production has the same name; never retry against production or
191
+ substitute a production default. Changing the CLI host selects where to publish;
192
+ the runtime reader comes from that deployment, not from the author's environment.
193
+ Explicit authored URLs retain their literal destination.
194
+
195
+ Authors keep one source definition. Operators configure its named connections
196
+ and resources once in each deployment. End users start the agent as usual; an
197
+ unconfigured required resource produces a configuration failure instead of a
198
+ session silently missing tools. Dynamic handlers validate declared requirements
199
+ before running. Shared manifest resolution rejects null results for required slots,
200
+ even if a host catches a resolver exception and returns null. Hosts must propagate
201
+ that failure to startup. Session-started values stay pinned across turns and resume.
202
+
203
+ This PR adds no configuration UI. A host can use the compiled requirements to show
204
+ which names need configuration and return an actionable deployment-specific error.
205
+
206
+ ## Host integration
207
+
208
+ These packages implement contracts and authored runtime behavior, not a deployment
209
+ configuration store or RPC service. Existing hosting needs to:
210
+
211
+ 1. Resolve names within the authorized deployment, organization, and agent; never
212
+ expose the process environment or an unrestricted cross-tenant registry.
213
+ 2. Inject `bindings` into lifecycle resolution and the tool/hook/selector/provider
214
+ contexts using it. Dynamic approval evaluation and tool reconstruction after
215
+ isolate eviction need the same reader. Readers and tokens are not persisted in
216
+ boundary snapshots.
217
+ 3. Configure `final` with that deployment's approved MCP endpoint. The ordinary
218
+ broker continues restricting `final-session` grants to that endpoint.
219
+ 4. Return non-secret configuration and credential references, with normal provider,
220
+ secret, resource, and organization authorization.
221
+ 5. Run the release preflight above and validate again before starting a new
222
+ session. Treat failed required-binding resolution as a startup/configuration error, not
223
+ an omitted connection or a fallback to production. Preserve existing runtime
224
+ revisions when publication fails.
225
+ 6. Retain session-started resolved values across turns/resume; resolve new sessions
226
+ against their own deployment.
227
+
228
+ Optional readers preserve source compatibility with existing hosts. Definitions
229
+ requesting bindings fail clearly if hosting does not provide them. Installing these
230
+ packages alone does not change Final's deployed service wiring or provision secrets.
231
+
232
+ New compiles emit manifest version 3, so older hosts reject them rather than
233
+ stripping required-binding metadata. Updated readers still accept persisted
234
+ version 2 revisions. Upgrade hosting before publishing newly compiled agents.
package/README.md CHANGED
@@ -10,3 +10,9 @@ the public Computers and Device APIs; the Computers transport is shared with
10
10
 
11
11
  Authoring helpers produce manifest bindings. Select the matching `/runtime/*`
12
12
  adapter when connecting your own CLI or ACP endpoint.
13
+
14
+ `defineFinalConnection()` requests the host's `final` binding at session start,
15
+ using the generic `defineHostedConnection` implementation. Its session grant still
16
+ goes through the usual credential broker. Existing calls with an explicit `url`
17
+ remain static. Hosts without a binding reader cannot run URL-free definitions;
18
+ see the repository's [hosting guide](HOSTING.md) for wiring requirements.
@@ -1,7 +1,11 @@
1
- import { type McpClientConnectionDefinitionIface } from '@finalai/agent-definition/authoring';
1
+ import { type DynamicSentinelIface, type HostedConnectionDefinitionIface, type McpClientConnectionDefinitionIface } from '@finalai/agent-definition/authoring';
2
2
  export type FinalConnectionDefinitionIface = Omit<McpClientConnectionDefinitionIface, 'auth'>;
3
- export declare const defineFinalConnection: <TConnection extends FinalConnectionDefinitionIface>(definition: TConnection) => TConnection & {
3
+ export interface FinalHostedConnectionDefinitionIface extends Omit<HostedConnectionDefinitionIface, 'binding'> {
4
+ readonly binding?: string;
5
+ }
6
+ export declare function defineFinalConnection<TConnection extends FinalConnectionDefinitionIface>(definition: TConnection): TConnection & {
4
7
  readonly auth: {
5
- readonly kind: "final-session";
8
+ readonly kind: 'final-session';
6
9
  };
7
10
  };
11
+ export declare function defineFinalConnection(definition?: FinalHostedConnectionDefinitionIface): DynamicSentinelIface<McpClientConnectionDefinitionIface>;
@@ -1,7 +1,15 @@
1
1
  import {
2
- defineMcpClientConnection
2
+ defineMcpClientConnection,
3
+ defineHostedConnection
3
4
  } from "@finalai/agent-definition/authoring";
4
- const defineFinalConnection = (definition) => defineMcpClientConnection({ ...definition, auth: { kind: "final-session" } });
5
+ function defineFinalConnection(definition = {}) {
6
+ if ("url" in definition)
7
+ return defineMcpClientConnection({ ...definition, auth: { kind: "final-session" } });
8
+ return defineHostedConnection({
9
+ ...definition,
10
+ binding: definition.binding ?? "final"
11
+ });
12
+ }
5
13
  export {
6
14
  defineFinalConnection
7
15
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/connections.ts"],
4
- "sourcesContent": ["import {\n defineMcpClientConnection,\n type McpClientConnectionDefinitionIface,\n} from '@finalai/agent-definition/authoring';\n\nexport type FinalConnectionDefinitionIface = Omit<McpClientConnectionDefinitionIface, 'auth'>;\n\n// `connections/final.ts`: Final's MCP server as an ordinary connection. The\n// session service's broker resolves `final-session` auth to a grant scoped to\n// the calling session, which Final's MCP server runs the tools as.\nexport const defineFinalConnection = <TConnection extends FinalConnectionDefinitionIface>(\n definition: TConnection,\n): TConnection & { readonly auth: { readonly kind: 'final-session' } } =>\n defineMcpClientConnection({ ...definition, auth: { kind: 'final-session' } });\n"],
5
- "mappings": "AAAA;AAAA,EACE;AAAA,OAEK;AAOA,MAAM,wBAAwB,CACnC,eAEA,0BAA0B,EAAE,GAAG,YAAY,MAAM,EAAE,MAAM,gBAAgB,EAAE,CAAC;",
4
+ "sourcesContent": ["import {\n defineMcpClientConnection,\n defineHostedConnection,\n type DynamicSentinelIface,\n type HostedConnectionDefinitionIface,\n type McpClientConnectionDefinitionIface,\n} from '@finalai/agent-definition/authoring';\n\nexport type FinalConnectionDefinitionIface = Omit<McpClientConnectionDefinitionIface, 'auth'>;\n\nexport interface FinalHostedConnectionDefinitionIface extends Omit<\n HostedConnectionDefinitionIface,\n 'binding'\n> {\n readonly binding?: string;\n}\n\n// `connections/final.ts`: Final's MCP server as an ordinary connection. The\n// session service's broker resolves `final-session` auth to a grant scoped to\n// the calling session, which Final's MCP server runs the tools as.\nexport function defineFinalConnection<TConnection extends FinalConnectionDefinitionIface>(\n definition: TConnection,\n): TConnection & { readonly auth: { readonly kind: 'final-session' } };\nexport function defineFinalConnection(\n definition?: FinalHostedConnectionDefinitionIface,\n): DynamicSentinelIface<McpClientConnectionDefinitionIface>;\nexport function defineFinalConnection(\n definition: FinalConnectionDefinitionIface | FinalHostedConnectionDefinitionIface = {},\n): McpClientConnectionDefinitionIface | DynamicSentinelIface<McpClientConnectionDefinitionIface> {\n if ('url' in definition)\n return defineMcpClientConnection({ ...definition, auth: { kind: 'final-session' } });\n return defineHostedConnection({\n ...definition,\n binding: definition.binding ?? 'final',\n });\n}\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAoBA,SAAS,sBACd,aAAoF,CAAC,GACU;AAC/F,MAAI,SAAS;AACX,WAAO,0BAA0B,EAAE,GAAG,YAAY,MAAM,EAAE,MAAM,gBAAgB,EAAE,CAAC;AACrF,SAAO,uBAAuB;AAAA,IAC5B,GAAG;AAAA,IACH,SAAS,WAAW,WAAW;AAAA,EACjC,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -34,7 +34,7 @@ const deviceEndpoint = {
34
34
  };
35
35
  const resolvedManifest = () => ({
36
36
  version: MANIFEST_VERSION,
37
- identity: { name: "Release Scout", description: null, avatarUrl: null },
37
+ identity: { name: "Release Scout", description: null },
38
38
  harness: {
39
39
  harness: packageRef("@finalai/final-agent-provider/harnesses/serverless-pi"),
40
40
  config: {}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/testing/harness.ts"],
4
- "sourcesContent": ["import {\n BaseCapability,\n CredentialRoute,\n credentials,\n jsonObjectSchema,\n MANIFEST_VERSION,\n packageRef,\n ToolApproval,\n type OpenHarnessSessionArgsIface,\n type ResolvedAgentManifestIface,\n type SandboxTargetEndpointIface,\n} from '@finalai/agent-provider';\n\n// Shared fixtures for the harness tests (no module mocks: fakes go in through\n// each factory's fetch/now/newId seams).\n\nexport const SESSION_ID = '0192f7a0-0000-7000-8000-000000000001';\nexport const HARNESS_SESSION_ID = '0192f7a0-0000-7000-8000-0000000000aa';\nexport const EXPIRES_AT = '2026-10-10T00:15:00.000Z';\n\nexport const computerEndpoint: SandboxTargetEndpointIface = {\n target: 'computer',\n bindingId: '0192f7a0-0000-7000-8000-0000000000c1',\n capabilities: ['shell', 'files', 'process'],\n rpc: { url: 'wss://agent-session.test/sandboxes/b/c1', token: 'rpc-c1', expiresAt: EXPIRES_AT },\n mcp: {\n url: 'https://agent-session.test/sandboxes/b/c1/mcp',\n token: 'mcp-c1',\n expiresAt: EXPIRES_AT,\n },\n};\n\nexport const deviceEndpoint: SandboxTargetEndpointIface = {\n target: 'device',\n bindingId: '0192f7a0-0000-7000-8000-0000000000d1',\n capabilities: ['computerUse'],\n rpc: null,\n mcp: {\n url: 'https://agent-session.test/sandboxes/b/d1/mcp',\n token: 'mcp-d1',\n expiresAt: EXPIRES_AT,\n },\n};\n\nexport const resolvedManifest = (): ResolvedAgentManifestIface => ({\n version: MANIFEST_VERSION,\n identity: { name: 'Release Scout', description: null, avatarUrl: null },\n harness: {\n harness: packageRef('@finalai/final-agent-provider/harnesses/serverless-pi'),\n config: {},\n },\n mcpServers: [],\n sandboxes: {},\n tools: {\n base: {\n shell: { target: 'computer' },\n files: { target: 'computer' },\n computerUse: { target: 'device' },\n },\n },\n secrets: [],\n toolPolicy: {\n shell: ToolApproval.Ask,\n 'files.write': ToolApproval.Ask,\n create_issue: ToolApproval.Allow,\n },\n channels: [],\n hooks: [],\n schedules: [],\n bundle: null,\n});\n\nexport const openArgs = (\n config: unknown,\n secrets: Record<string, string> = {},\n): OpenHarnessSessionArgsIface => ({\n harnessSessionId: '0192f7a0-0000-7000-8000-0000000000a1',\n session: {\n sessionId: SESSION_ID,\n organizationId: '0192f7a0-0000-7000-8000-0000000000o1',\n definitionId: '0192f7a0-0000-7000-8000-0000000000e1',\n revisionId: '0192f7a0-0000-7000-8000-0000000000r1',\n sessionServiceUrl: 'https://agent-session.test',\n },\n config: {\n credentials: credentials.chain({\n payer: 'organization',\n tryInOrder: [credentials.apiKey({ owner: 'organization' }), credentials.platform()],\n }),\n ...jsonObjectSchema.parse(config),\n },\n manifest: resolvedManifest(),\n mcpServers: [],\n baseTools: {\n [BaseCapability.Shell]: computerEndpoint,\n [BaseCapability.Files]: computerEndpoint,\n [BaseCapability.ComputerUse]: deviceEndpoint,\n },\n sandboxes: { computer: computerEndpoint, device: deviceEndpoint },\n credentials: {\n brokerUrl: 'https://agent-session.test/internal/runtime/broker',\n grants: [\n { route: CredentialRoute.Model, token: 'grant-model', expiresAt: EXPIRES_AT },\n { route: CredentialRoute.Mcp, token: 'grant-mcp', expiresAt: EXPIRES_AT },\n ],\n atOpen: null,\n refresh: {\n url: 'https://agent-session.test/internal/runtime/broker/refresh',\n token: 'grant-model',\n harnessSessionId: '0192f7a0-0000-7000-8000-0000000000a1',\n expiresAt: EXPIRES_AT,\n },\n },\n secrets: { get: async (name) => secrets[name] ?? null },\n trace: {\n traceparent: '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01',\n tracestate: null,\n },\n});\n\n// Monotonic ids so assertions can name them.\nexport const idSequence = (prefix: string): (() => string) => {\n let next = 0;\n return () => {\n next += 1;\n return `${prefix}-7000-8000-${String(next).padStart(12, '0')}`;\n };\n};\n"],
5
- "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAKA,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,MAAM,aAAa;AAEnB,MAAM,mBAA+C;AAAA,EAC1D,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc,CAAC,SAAS,SAAS,SAAS;AAAA,EAC1C,KAAK,EAAE,KAAK,2CAA2C,OAAO,UAAU,WAAW,WAAW;AAAA,EAC9F,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,EACb;AACF;AAEO,MAAM,iBAA6C;AAAA,EACxD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc,CAAC,aAAa;AAAA,EAC5B,KAAK;AAAA,EACL,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,EACb;AACF;AAEO,MAAM,mBAAmB,OAAmC;AAAA,EACjE,SAAS;AAAA,EACT,UAAU,EAAE,MAAM,iBAAiB,aAAa,MAAM,WAAW,KAAK;AAAA,EACtE,SAAS;AAAA,IACP,SAAS,WAAW,uDAAuD;AAAA,IAC3E,QAAQ,CAAC;AAAA,EACX;AAAA,EACA,YAAY,CAAC;AAAA,EACb,WAAW,CAAC;AAAA,EACZ,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,OAAO,EAAE,QAAQ,WAAW;AAAA,MAC5B,OAAO,EA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AW;AAAA,IACb;AAAA,EACF;AAAA,EACA,SAAS,EAAE,KAAK,OAAO,SAAS,QAAQ,IAAI,KAAK,KAAK;AAAA,EACtD,OAAO;AAAA,IACL,aAAa;AAAA,IACb,YAAY;AAAA,EACd;AACF;AAGO,MAAM,aAAa,CAAC,WAAmC;AAC5D,MAAI,OAAO;AACX,SAAO,MAAM;AACX,YAAQ;AACR,WAAO,GAAG,MAAM,cAAc,OAAO,IAAI,EAAE,SAAS,IAAI,GAAG,CAAC;AAAA,EAC9D;AACF;",
4
+ "sourcesContent": ["import {\n BaseCapability,\n CredentialRoute,\n credentials,\n jsonObjectSchema,\n MANIFEST_VERSION,\n packageRef,\n ToolApproval,\n type OpenHarnessSessionArgsIface,\n type ResolvedAgentManifestIface,\n type SandboxTargetEndpointIface,\n} from '@finalai/agent-provider';\n\n// Shared fixtures for the harness tests (no module mocks: fakes go in through\n// each factory's fetch/now/newId seams).\n\nexport const SESSION_ID = '0192f7a0-0000-7000-8000-000000000001';\nexport const HARNESS_SESSION_ID = '0192f7a0-0000-7000-8000-0000000000aa';\nexport const EXPIRES_AT = '2026-10-10T00:15:00.000Z';\n\nexport const computerEndpoint: SandboxTargetEndpointIface = {\n target: 'computer',\n bindingId: '0192f7a0-0000-7000-8000-0000000000c1',\n capabilities: ['shell', 'files', 'process'],\n rpc: { url: 'wss://agent-session.test/sandboxes/b/c1', token: 'rpc-c1', expiresAt: EXPIRES_AT },\n mcp: {\n url: 'https://agent-session.test/sandboxes/b/c1/mcp',\n token: 'mcp-c1',\n expiresAt: EXPIRES_AT,\n },\n};\n\nexport const deviceEndpoint: SandboxTargetEndpointIface = {\n target: 'device',\n bindingId: '0192f7a0-0000-7000-8000-0000000000d1',\n capabilities: ['computerUse'],\n rpc: null,\n mcp: {\n url: 'https://agent-session.test/sandboxes/b/d1/mcp',\n token: 'mcp-d1',\n expiresAt: EXPIRES_AT,\n },\n};\n\nexport const resolvedManifest = (): ResolvedAgentManifestIface => ({\n version: MANIFEST_VERSION,\n identity: { name: 'Release Scout', description: null },\n harness: {\n harness: packageRef('@finalai/final-agent-provider/harnesses/serverless-pi'),\n config: {},\n },\n mcpServers: [],\n sandboxes: {},\n tools: {\n base: {\n shell: { target: 'computer' },\n files: { target: 'computer' },\n computerUse: { target: 'device' },\n },\n },\n secrets: [],\n toolPolicy: {\n shell: ToolApproval.Ask,\n 'files.write': ToolApproval.Ask,\n create_issue: ToolApproval.Allow,\n },\n channels: [],\n hooks: [],\n schedules: [],\n bundle: null,\n});\n\nexport const openArgs = (\n config: unknown,\n secrets: Record<string, string> = {},\n): OpenHarnessSessionArgsIface => ({\n harnessSessionId: '0192f7a0-0000-7000-8000-0000000000a1',\n session: {\n sessionId: SESSION_ID,\n organizationId: '0192f7a0-0000-7000-8000-0000000000o1',\n definitionId: '0192f7a0-0000-7000-8000-0000000000e1',\n revisionId: '0192f7a0-0000-7000-8000-0000000000r1',\n sessionServiceUrl: 'https://agent-session.test',\n },\n config: {\n credentials: credentials.chain({\n payer: 'organization',\n tryInOrder: [credentials.apiKey({ owner: 'organization' }), credentials.platform()],\n }),\n ...jsonObjectSchema.parse(config),\n },\n manifest: resolvedManifest(),\n mcpServers: [],\n baseTools: {\n [BaseCapability.Shell]: computerEndpoint,\n [BaseCapability.Files]: computerEndpoint,\n [BaseCapability.ComputerUse]: deviceEndpoint,\n },\n sandboxes: { computer: computerEndpoint, device: deviceEndpoint },\n credentials: {\n brokerUrl: 'https://agent-session.test/internal/runtime/broker',\n grants: [\n { route: CredentialRoute.Model, token: 'grant-model', expiresAt: EXPIRES_AT },\n { route: CredentialRoute.Mcp, token: 'grant-mcp', expiresAt: EXPIRES_AT },\n ],\n atOpen: null,\n refresh: {\n url: 'https://agent-session.test/internal/runtime/broker/refresh',\n token: 'grant-model',\n harnessSessionId: '0192f7a0-0000-7000-8000-0000000000a1',\n expiresAt: EXPIRES_AT,\n },\n },\n secrets: { get: async (name) => secrets[name] ?? null },\n trace: {\n traceparent: '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01',\n tracestate: null,\n },\n});\n\n// Monotonic ids so assertions can name them.\nexport const idSequence = (prefix: string): (() => string) => {\n let next = 0;\n return () => {\n next += 1;\n return `${prefix}-7000-8000-${String(next).padStart(12, '0')}`;\n };\n};\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAKA,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,MAAM,aAAa;AAEnB,MAAM,mBAA+C;AAAA,EAC1D,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc,CAAC,SAAS,SAAS,SAAS;AAAA,EAC1C,KAAK,EAAE,KAAK,2CAA2C,OAAO,UAAU,WAAW,WAAW;AAAA,EAC9F,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,EACb;AACF;AAEO,MAAM,iBAA6C;AAAA,EACxD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc,CAAC,aAAa;AAAA,EAC5B,KAAK;AAAA,EACL,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,EACb;AACF;AAEO,MAAM,mBAAmB,OAAmC;AAAA,EACjE,SAAS;AAAA,EACT,UAAU,EAAE,MAAM,iBAAiB,aAAa,KAAK;AAAA,EACrD,SAAS;AAAA,IACP,SAAS,WAAW,uDAAuD;AAAA,IAC3E,QAAQ,CAAC;AAAA,EACX;AAAA,EACA,YAAY,CAAC;AAAA,EACb,WAAW,CAAC;AAAA,EACZ,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,OAAO,EAAE,QAAQ,WAAW;AAAA,MAC5B,OAAO,EAAE,QAAQ,WAAW;AAAA,MAC5B,aAAa,EAAE,QAAQ,SAAS;AAAA,IAClC;AAAA,EACF;AAAA,EACA,SAAS,CAAC;AAAA,EACV,YAAY;AAAA,IACV,OAAO,a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,YAAY;AAAA,EACd;AACF;AAGO,MAAM,aAAa,CAAC,WAAmC;AAC5D,MAAI,OAAO;AACX,SAAO,MAAM;AACX,YAAQ;AACR,WAAO,GAAG,MAAM,cAAc,OAAO,IAAI,EAAE,SAAS,IAAI,GAAG,CAAC;AAAA,EAC9D;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finalai/final-agent-provider",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "Final's provider package: serverless, remote and local harnesses; the computer and device sandboxes; the messaging, schedule and event channels.",
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",
@@ -212,14 +213,14 @@
212
213
  },
213
214
  "dependencies": {
214
215
  "@agentclientprotocol/sdk": "1.8.0",
215
- "@finalai/acp-session": "0.1.2",
216
- "@finalai/agent-protocol": "0.1.2",
217
- "@finalai/agent-provider": "0.1.2",
218
- "@finalai/computers": "0.1.2",
219
- "@finalai/websockets": "0.1.2",
216
+ "@finalai/acp-session": "0.1.4",
217
+ "@finalai/agent-protocol": "0.1.4",
218
+ "@finalai/agent-provider": "0.1.4",
219
+ "@finalai/computers": "0.1.4",
220
+ "@finalai/websockets": "0.1.4",
220
221
  "ws": "^8.21.3",
221
222
  "zod": "4.6.5",
222
- "@finalai/agent-definition": "0.1.2"
223
+ "@finalai/agent-definition": "0.1.4"
223
224
  },
224
225
  "engines": {
225
226
  "node": ">=26"