@finalai/agents 0.8.0

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.

Potentially problematic release.


This version of @finalai/agents might be problematic. Click here for more details.

Files changed (153) hide show
  1. package/README.md +30 -0
  2. package/dist/modules/agent-client/acp-frames.d.mts +19 -0
  3. package/dist/modules/agent-client/acp-frames.mjs +49 -0
  4. package/dist/modules/agent-client/acp-frames.mjs.map +7 -0
  5. package/dist/modules/agent-client/acp.d.mts +43 -0
  6. package/dist/modules/agent-client/acp.mjs +76 -0
  7. package/dist/modules/agent-client/acp.mjs.map +7 -0
  8. package/dist/modules/agent-client/async-queue.d.mts +10 -0
  9. package/dist/modules/agent-client/async-queue.mjs +66 -0
  10. package/dist/modules/agent-client/async-queue.mjs.map +7 -0
  11. package/dist/modules/agent-client/build.d.mts +107 -0
  12. package/dist/modules/agent-client/build.mjs +222 -0
  13. package/dist/modules/agent-client/build.mjs.map +7 -0
  14. package/dist/modules/agent-client/client.d.mts +111 -0
  15. package/dist/modules/agent-client/client.mjs +198 -0
  16. package/dist/modules/agent-client/client.mjs.map +7 -0
  17. package/dist/modules/agent-client/collection-events.d.mts +35 -0
  18. package/dist/modules/agent-client/collection-events.mjs +142 -0
  19. package/dist/modules/agent-client/collection-events.mjs.map +7 -0
  20. package/dist/modules/agent-client/config-options.d.mts +24 -0
  21. package/dist/modules/agent-client/config-options.mjs +49 -0
  22. package/dist/modules/agent-client/config-options.mjs.map +7 -0
  23. package/dist/modules/agent-client/context.d.mts +31 -0
  24. package/dist/modules/agent-client/context.mjs +11 -0
  25. package/dist/modules/agent-client/context.mjs.map +7 -0
  26. package/dist/modules/agent-client/conversations.d.mts +385 -0
  27. package/dist/modules/agent-client/conversations.mjs +1156 -0
  28. package/dist/modules/agent-client/conversations.mjs.map +7 -0
  29. package/dist/modules/agent-client/errors.d.mts +85 -0
  30. package/dist/modules/agent-client/errors.mjs +94 -0
  31. package/dist/modules/agent-client/errors.mjs.map +7 -0
  32. package/dist/modules/agent-client/event-stream.d.mts +14 -0
  33. package/dist/modules/agent-client/event-stream.mjs +89 -0
  34. package/dist/modules/agent-client/event-stream.mjs.map +7 -0
  35. package/dist/modules/agent-client/frame-stream.d.mts +51 -0
  36. package/dist/modules/agent-client/frame-stream.mjs +333 -0
  37. package/dist/modules/agent-client/frame-stream.mjs.map +7 -0
  38. package/dist/modules/agent-client/http.d.mts +68 -0
  39. package/dist/modules/agent-client/http.mjs +168 -0
  40. package/dist/modules/agent-client/http.mjs.map +7 -0
  41. package/dist/modules/agent-client/index.d.mts +17 -0
  42. package/dist/modules/agent-client/index.mjs +86 -0
  43. package/dist/modules/agent-client/index.mjs.map +7 -0
  44. package/dist/modules/agent-client/live-stream.d.mts +18 -0
  45. package/dist/modules/agent-client/live-stream.mjs +94 -0
  46. package/dist/modules/agent-client/live-stream.mjs.map +7 -0
  47. package/dist/modules/agent-client/realtime.d.mts +72 -0
  48. package/dist/modules/agent-client/realtime.mjs +186 -0
  49. package/dist/modules/agent-client/realtime.mjs.map +7 -0
  50. package/dist/modules/agent-client/sandbox-uri.d.mts +19 -0
  51. package/dist/modules/agent-client/sandbox-uri.mjs +43 -0
  52. package/dist/modules/agent-client/sandbox-uri.mjs.map +7 -0
  53. package/dist/modules/agent-client/sessions.d.mts +124 -0
  54. package/dist/modules/agent-client/sessions.mjs +350 -0
  55. package/dist/modules/agent-client/sessions.mjs.map +7 -0
  56. package/dist/modules/agent-client/test-fakes.d.mts +40 -0
  57. package/dist/modules/agent-client/test-fakes.mjs +94 -0
  58. package/dist/modules/agent-client/test-fakes.mjs.map +7 -0
  59. package/dist/modules/authoring/approval.d.mts +1 -0
  60. package/dist/modules/authoring/approval.mjs +2 -0
  61. package/dist/modules/authoring/approval.mjs.map +7 -0
  62. package/dist/modules/authoring/channels.d.mts +1 -0
  63. package/dist/modules/authoring/channels.mjs +2 -0
  64. package/dist/modules/authoring/channels.mjs.map +7 -0
  65. package/dist/modules/authoring/final-channel.d.mts +1 -0
  66. package/dist/modules/authoring/final-channel.mjs +2 -0
  67. package/dist/modules/authoring/final-channel.mjs.map +7 -0
  68. package/dist/modules/authoring/hooks.d.mts +1 -0
  69. package/dist/modules/authoring/hooks.mjs +2 -0
  70. package/dist/modules/authoring/hooks.mjs.map +7 -0
  71. package/dist/modules/authoring/index.d.mts +1 -0
  72. package/dist/modules/authoring/index.mjs +2 -0
  73. package/dist/modules/authoring/index.mjs.map +7 -0
  74. package/dist/modules/authoring/instructions.d.mts +1 -0
  75. package/dist/modules/authoring/instructions.mjs +2 -0
  76. package/dist/modules/authoring/instructions.mjs.map +7 -0
  77. package/dist/modules/authoring/providers.d.mts +2 -0
  78. package/dist/modules/authoring/providers.mjs +1 -0
  79. package/dist/modules/authoring/providers.mjs.map +7 -0
  80. package/dist/modules/authoring/tools.d.mts +1 -0
  81. package/dist/modules/authoring/tools.mjs +2 -0
  82. package/dist/modules/authoring/tools.mjs.map +7 -0
  83. package/dist/modules/cli/build.d.mts +22 -0
  84. package/dist/modules/cli/build.mjs +77 -0
  85. package/dist/modules/cli/build.mjs.map +7 -0
  86. package/dist/modules/cli/channel-socket.d.mts +9 -0
  87. package/dist/modules/cli/channel-socket.mjs +114 -0
  88. package/dist/modules/cli/channel-socket.mjs.map +7 -0
  89. package/dist/modules/cli/cli.d.mts +16 -0
  90. package/dist/modules/cli/cli.mjs +151 -0
  91. package/dist/modules/cli/cli.mjs.map +7 -0
  92. package/dist/modules/cli/conformance.d.mts +36 -0
  93. package/dist/modules/cli/conformance.mjs +220 -0
  94. package/dist/modules/cli/conformance.mjs.map +7 -0
  95. package/dist/modules/cli/dev.d.mts +24 -0
  96. package/dist/modules/cli/dev.mjs +263 -0
  97. package/dist/modules/cli/dev.mjs.map +7 -0
  98. package/dist/modules/cli/files.d.mts +18 -0
  99. package/dist/modules/cli/files.mjs +66 -0
  100. package/dist/modules/cli/files.mjs.map +7 -0
  101. package/dist/modules/cli/harness-descriptions.d.mts +20 -0
  102. package/dist/modules/cli/harness-descriptions.mjs +70 -0
  103. package/dist/modules/cli/harness-descriptions.mjs.map +7 -0
  104. package/dist/modules/cli/main.d.mts +2 -0
  105. package/dist/modules/cli/main.mjs +20 -0
  106. package/dist/modules/cli/main.mjs.map +7 -0
  107. package/dist/modules/cli/output.d.mts +14 -0
  108. package/dist/modules/cli/output.mjs +94 -0
  109. package/dist/modules/cli/output.mjs.map +7 -0
  110. package/dist/modules/cli/publish.d.mts +14 -0
  111. package/dist/modules/cli/publish.mjs +89 -0
  112. package/dist/modules/cli/publish.mjs.map +7 -0
  113. package/dist/modules/compile.d.mts +3 -0
  114. package/dist/modules/compile.mjs +62 -0
  115. package/dist/modules/compile.mjs.map +7 -0
  116. package/dist/modules/harnesses.d.mts +1 -0
  117. package/dist/modules/harnesses.mjs +2 -0
  118. package/dist/modules/harnesses.mjs.map +7 -0
  119. package/dist/modules/index.browser.d.mts +4 -0
  120. package/dist/modules/index.browser.mjs +8 -0
  121. package/dist/modules/index.browser.mjs.map +7 -0
  122. package/dist/modules/index.d.mts +3 -0
  123. package/dist/modules/index.mjs +6 -0
  124. package/dist/modules/index.mjs.map +7 -0
  125. package/dist/modules/models.d.mts +1 -0
  126. package/dist/modules/models.mjs +2 -0
  127. package/dist/modules/models.mjs.map +7 -0
  128. package/dist/modules/public.d.mts +6 -0
  129. package/dist/modules/public.mjs +68 -0
  130. package/dist/modules/public.mjs.map +7 -0
  131. package/dist/modules/sandboxes.d.mts +1 -0
  132. package/dist/modules/sandboxes.mjs +2 -0
  133. package/dist/modules/sandboxes.mjs.map +7 -0
  134. package/examples/custom-harness/README.md +16 -0
  135. package/examples/custom-harness/agent.ts +154 -0
  136. package/examples/custom-sandbox/README.md +12 -0
  137. package/examples/custom-sandbox/agent.ts +14 -0
  138. package/examples/custom-sandbox/sandbox.ts +22 -0
  139. package/examples/release-scout/README.md +11 -0
  140. package/examples/release-scout/agent/agent.ts +22 -0
  141. package/examples/release-scout/agent/channels/github-signature.ts +27 -0
  142. package/examples/release-scout/agent/channels/github.ts +38 -0
  143. package/examples/release-scout/agent/connections/linear.ts +9 -0
  144. package/examples/release-scout/agent/hooks/audit.ts +24 -0
  145. package/examples/release-scout/agent/instructions/org-context.ts +26 -0
  146. package/examples/release-scout/agent/instructions.md +2 -0
  147. package/examples/release-scout/agent/sandbox.ts +20 -0
  148. package/examples/release-scout/agent/schedules/daily-digest.md +7 -0
  149. package/examples/release-scout/agent/skills/triage/SKILL.md +8 -0
  150. package/examples/release-scout/agent/skills/triage/checklist.md +3 -0
  151. package/examples/release-scout/agent/tools/lookup_release_notes.ts +24 -0
  152. package/examples/release-scout/client.ts +123 -0
  153. package/package.json +126 -0
@@ -0,0 +1,94 @@
1
+ import {
2
+ findDynamicSlots,
3
+ formatProviderRef,
4
+ isDynamicSlot
5
+ } from "@finalai/agent-provider";
6
+ import * as z from "zod";
7
+ import { isClientError } from "../agent-client/errors.mjs";
8
+ import { diagnosticSchema } from "../agent-client/index.mjs";
9
+ const listOrNone = (items) => items.length === 0 ? "none" : items.join(", ");
10
+ const manifestSummaryLines = (manifest) => {
11
+ const lines = [`agent: ${manifest.identity.name}`];
12
+ if (manifest.identity.description != null)
13
+ lines.push(`description: ${manifest.identity.description}`);
14
+ lines.push(`harness: ${formatProviderRef(manifest.harness.harness)}`);
15
+ lines.push(
16
+ `mcp servers: ${isDynamicSlot(manifest.mcpServers) ? "dynamic" : listOrNone(manifest.mcpServers.map((server) => `${server.key} (${server.kind})`))}`
17
+ );
18
+ lines.push(
19
+ `sandboxes: ${isDynamicSlot(manifest.sandboxes) ? "dynamic" : listOrNone(Object.keys(manifest.sandboxes))}`
20
+ );
21
+ lines.push(
22
+ `base tools: ${listOrNone(
23
+ Object.entries(manifest.tools.base).map(
24
+ ([capability, binding]) => `${capability} \u2192 ${binding?.target ?? "?"}`
25
+ )
26
+ )}`
27
+ );
28
+ lines.push(`channels: ${listOrNone(manifest.channels.map((channel) => channel.key))}`);
29
+ lines.push(
30
+ `schedules: ${listOrNone(
31
+ manifest.schedules.map(
32
+ (schedule) => `${schedule.key} (${schedule.cron}, ${schedule.timezone})`
33
+ )
34
+ )}`
35
+ );
36
+ lines.push(`secrets: ${listOrNone(manifest.secrets)}`);
37
+ lines.push(`dynamic slots: ${listOrNone(findDynamicSlots(manifest).map((slot) => slot.path))}`);
38
+ lines.push(`bundle: ${manifest.bundle?.hash ?? "none"}`);
39
+ return lines;
40
+ };
41
+ const hookLines = (manifest) => manifest.hooks.length === 0 ? ["hooks: none"] : [
42
+ "hooks:",
43
+ ...manifest.hooks.map(
44
+ (hook) => ` ${hook.slug} (${hook.export}): ${hook.events.join(", ")}`
45
+ )
46
+ ];
47
+ const reportLines = (report) => [
48
+ `compatibility with ${formatProviderRef(report.harness)}: ${report.ok ? "ok" : "incompatible"}`,
49
+ ...report.rows.map((row) => ` ${row.item}: ${row.result} (${row.why})`)
50
+ ];
51
+ const diagnosticLine = (item) => `${item.severity}: ${item.path == null ? "" : `${item.path}: `}${item.message} [${item.code}]`;
52
+ const errorDiagnosticsSchema = z.object({
53
+ error: z.object({
54
+ details: z.object({ diagnostics: z.array(diagnosticSchema) }).nullable()
55
+ })
56
+ });
57
+ const errorLines = (cause) => {
58
+ if (!isClientError(cause))
59
+ return [`error: ${cause instanceof Error ? cause.message : String(cause)}`];
60
+ const lines = [`error: ${cause.message}${cause.status === 0 ? "" : ` (HTTP ${cause.status})`}`];
61
+ const parsed = errorDiagnosticsSchema.safeParse(cause.body);
62
+ for (const item of parsed.success ? parsed.data.error.details?.diagnostics ?? [] : []) {
63
+ lines.push(` ${item.severity}: ${item.file == null ? "" : `${item.file}: `}${item.message}`);
64
+ }
65
+ return lines;
66
+ };
67
+ const publishResultLines = (result) => {
68
+ const revision = result.revision;
69
+ const lines = [
70
+ `${result.created ? "published" : "already current"}: revision ${revision.number} (${revision.id})`,
71
+ `commit: ${revision.commitSha ?? "unknown"}`,
72
+ `bundle: ${revision.bundleHash ?? "none"}`
73
+ ];
74
+ for (const item of result.diagnostics) lines.push(`${item.severity}: ${item.message}`);
75
+ for (const channel of result.channels) {
76
+ lines.push(`channel ${channel.key} (${channel.bindingId}):`);
77
+ for (const route of channel.routes) {
78
+ lines.push(` ${route.method} ${route.url ?? route.aliasUrl}`);
79
+ if (route.url != null) lines.push(` alias: ${route.aliasUrl}`);
80
+ }
81
+ if (channel.webhookSecret != null)
82
+ lines.push(` signing secret (shown once): ${channel.webhookSecret}`);
83
+ }
84
+ return lines;
85
+ };
86
+ export {
87
+ diagnosticLine,
88
+ errorLines,
89
+ hookLines,
90
+ manifestSummaryLines,
91
+ publishResultLines,
92
+ reportLines
93
+ };
94
+ //# sourceMappingURL=output.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/cli/output.ts"],
4
+ "sourcesContent": ["import type { CompatibilityReportIface } from '@finalai/agent-definition/compatibility';\nimport type { DiagnosticIface } from '@finalai/agent-definition/compiler';\nimport {\n findDynamicSlots,\n formatProviderRef,\n isDynamicSlot,\n type AgentManifestIface,\n} from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport { isClientError } from \"../agent-client/errors.mjs\";\nimport { diagnosticSchema, type PublishResultIface } from \"../agent-client/index.mjs\";\n\nexport interface OutputIface {\n stdout: (line: string) => void;\n stderr: (line: string) => void;\n}\n\nconst listOrNone = (items: readonly string[]): string =>\n items.length === 0 ? 'none' : items.join(', ');\n\nexport const manifestSummaryLines = (manifest: AgentManifestIface): string[] => {\n const lines = [`agent: ${manifest.identity.name}`];\n if (manifest.identity.description != null)\n lines.push(`description: ${manifest.identity.description}`);\n lines.push(`harness: ${formatProviderRef(manifest.harness.harness)}`);\n lines.push(\n `mcp servers: ${\n isDynamicSlot(manifest.mcpServers)\n ? 'dynamic'\n : listOrNone(manifest.mcpServers.map((server) => `${server.key} (${server.kind})`))\n }`,\n );\n lines.push(\n `sandboxes: ${\n isDynamicSlot(manifest.sandboxes) ? 'dynamic' : listOrNone(Object.keys(manifest.sandboxes))\n }`,\n );\n lines.push(\n `base tools: ${listOrNone(\n Object.entries(manifest.tools.base).map(\n ([capability, binding]) => `${capability} \u2192 ${binding?.target ?? '?'}`,\n ),\n )}`,\n );\n lines.push(`channels: ${listOrNone(manifest.channels.map((channel) => channel.key))}`);\n lines.push(\n `schedules: ${listOrNone(\n manifest.schedules.map(\n (schedule) => `${schedule.key} (${schedule.cron}, ${schedule.timezone})`,\n ),\n )}`,\n );\n lines.push(`secrets: ${listOrNone(manifest.secrets)}`);\n lines.push(`dynamic slots: ${listOrNone(findDynamicSlots(manifest).map((slot) => slot.path))}`);\n lines.push(`bundle: ${manifest.bundle?.hash ?? 'none'}`);\n return lines;\n};\n\nexport const hookLines = (manifest: AgentManifestIface): string[] =>\n manifest.hooks.length === 0\n ? ['hooks: none']\n : [\n 'hooks:',\n ...manifest.hooks.map(\n (hook) => ` ${hook.slug} (${hook.export}): ${hook.events.join(', ')}`,\n ),\n ];\n\nexport const reportLines = (report: CompatibilityReportIface): string[] => [\n `compatibility with ${formatProviderRef(report.harness)}: ${report.ok ? 'ok' : 'incompatible'}`,\n ...report.rows.map((row) => ` ${row.item}: ${row.result} (${row.why})`),\n];\n\nexport const diagnosticLine = (item: DiagnosticIface): string =>\n `${item.severity}: ${item.path == null ? '' : `${item.path}: `}${item.message} [${item.code}]`;\n\nconst errorDiagnosticsSchema = z.object({\n error: z.object({\n details: z.object({ diagnostics: z.array(diagnosticSchema) }).nullable(),\n }),\n});\n\n// SDK errors with the server's compile diagnostics, when it sent any.\nexport const errorLines = (cause: unknown): string[] => {\n if (!isClientError(cause))\n return [`error: ${cause instanceof Error ? cause.message : String(cause)}`];\n const lines = [`error: ${cause.message}${cause.status === 0 ? '' : ` (HTTP ${cause.status})`}`];\n const parsed = errorDiagnosticsSchema.safeParse(cause.body);\n for (const item of parsed.success ? (parsed.data.error.details?.diagnostics ?? []) : []) {\n lines.push(` ${item.severity}: ${item.file == null ? '' : `${item.file}: `}${item.message}`);\n }\n return lines;\n};\n\nexport const publishResultLines = (result: PublishResultIface): string[] => {\n const revision = result.revision;\n const lines = [\n `${result.created ? 'published' : 'already current'}: revision ${revision.number} (${revision.id})`,\n `commit: ${revision.commitSha ?? 'unknown'}`,\n `bundle: ${revision.bundleHash ?? 'none'}`,\n ];\n for (const item of result.diagnostics) lines.push(`${item.severity}: ${item.message}`);\n for (const channel of result.channels) {\n lines.push(`channel ${channel.key} (${channel.bindingId}):`);\n for (const route of channel.routes) {\n lines.push(` ${route.method} ${route.url ?? route.aliasUrl}`);\n if (route.url != null) lines.push(` alias: ${route.aliasUrl}`);\n }\n if (channel.webhookSecret != null)\n lines.push(` signing secret (shown once): ${channel.webhookSecret}`);\n }\n return lines;\n};\n"],
5
+ "mappings": "AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,YAAY,OAAO;AACnB,SAAS,qBAAqB;AAC9B,SAAS,wBAAiD;AAO1D,MAAM,aAAa,CAAC,UAClB,MAAM,WAAW,IAAI,SAAS,MAAM,KAAK,IAAI;AAExC,MAAM,uBAAuB,CAAC,aAA2C;AAC9E,QAAM,QAAQ,CAAC,UAAU,SAAS,SAAS,IAAI,EAAE;AACjD,MAAI,SAAS,SAAS,eAAe;AACnC,UAAM,KAAK,gBAAgB,SAAS,SAAS,WAAW,EAAE;AAC5D,QAAM,KAAK,YAAY,kBAAkB,SAAS,QAAQ,OAAO,CAAC,EAAE;AACpE,QAAM;AAAA,IACJ,gBACE,cAAc,SAAS,UAAU,IAC7B,YACA,WAAW,SAAS,WAAW,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,KAAK,OAAO,IAAI,GAAG,CAAC,CACtF;AAAA,EACF;AACA,QAAM;AAAA,IACJ,cACE,cAAc,SAAS,SAAS,IAAI,YAAY,WAAW,OAAO,KAAK,SAAS,SAAS,CAAC,CAC5F;AAAA,EACF;AACA,QAAM;AAAA,IACJ,eAAe;AAAA,MACb,OAAO,QAAQ,SAAS,MAAM,IAAI,EAAE;AAAA,QAClC,C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AAc,MAAM,QAAQ,EAAE;AAAA,IAClE;AACA,QAAI,QAAQ,iBAAiB;AAC3B,YAAM,KAAK,kCAAkC,QAAQ,aAAa,EAAE;AAAA,EACxE;AACA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import type { AgentClientIface } from "../agent-client/client.mjs";
2
+ import { type ListFiles } from "./files.mjs";
3
+ import { type OutputIface } from "./output.mjs";
4
+ export interface PublishArgsIface {
5
+ dir: string;
6
+ agent: string;
7
+ ref: string | null;
8
+ message: string;
9
+ note: string | null;
10
+ client: AgentClientIface;
11
+ listFiles: ListFiles;
12
+ output: OutputIface;
13
+ }
14
+ export declare const runPublish: (args: PublishArgsIface) => Promise<number>;
@@ -0,0 +1,89 @@
1
+ import { isClientError } from "../agent-client/errors.mjs";
2
+ import { DefinitionRepositoryKind } from "../agent-client/index.mjs";
3
+ import { compileAndPrint } from "./build.mjs";
4
+ import { fileChanges, readLocalFiles } from "./files.mjs";
5
+ import { errorLines, publishResultLines } from "./output.mjs";
6
+ const remoteFiles = async (args) => {
7
+ try {
8
+ const listing = await args.client.definitions.files({
9
+ definition: args.definition.id,
10
+ ref: args.branch
11
+ });
12
+ return {
13
+ commitSha: listing.commitSha,
14
+ files: Object.fromEntries(listing.files.map((file) => [file.path, file.content]))
15
+ };
16
+ } catch (cause) {
17
+ if (isClientError(cause) && cause.status === 404) return { commitSha: null, files: {} };
18
+ throw cause;
19
+ }
20
+ };
21
+ const commitCheckout = async (args) => {
22
+ const { client, output, message } = args.publish;
23
+ const remote = await remoteFiles({ client, definition: args.definition, branch: args.branch });
24
+ const changes = fileChanges({ local: args.local, remote: remote.files });
25
+ if (changes.length === 0 && remote.commitSha != null) {
26
+ output.stdout(`no changes; publishing ${args.branch} at ${remote.commitSha}`);
27
+ return remote.commitSha;
28
+ }
29
+ const request = {
30
+ definition: args.definition.id,
31
+ files: changes,
32
+ message,
33
+ branch: args.branch
34
+ };
35
+ if (remote.commitSha != null) request.parentSha = remote.commitSha;
36
+ const committed = await client.definitions.commit(request);
37
+ const deleted = changes.filter((change) => change.content == null).length;
38
+ output.stdout(
39
+ `committed ${committed.commitSha} to ${committed.branch} (${changes.length - deleted} written, ${deleted} deleted)`
40
+ );
41
+ return committed.commitSha;
42
+ };
43
+ const runPublish = async (args) => {
44
+ const { client, output } = args;
45
+ try {
46
+ const local = await readLocalFiles({ dir: args.dir, listFiles: args.listFiles });
47
+ for (const problem of local.problems) output.stderr(`error: ${problem}`);
48
+ if (local.problems.length > 0) return 1;
49
+ const compiled = await compileAndPrint({ source: { files: local.files }, client, output });
50
+ if (!compiled.ok) {
51
+ output.stderr("error: the agent did not compile; nothing was published");
52
+ return 1;
53
+ }
54
+ const definition = await client.definitions.get({ definition: args.agent });
55
+ const repository = definition.repository;
56
+ const kind = repository?.kind ?? DefinitionRepositoryKind.CodeStorage;
57
+ const branch = repository?.defaultBranch ?? "main";
58
+ let ref;
59
+ if (kind === DefinitionRepositoryKind.GitHub) {
60
+ ref = args.ref ?? branch;
61
+ } else if (kind === DefinitionRepositoryKind.CodeStorage) {
62
+ if (args.ref != null) {
63
+ output.stderr(
64
+ "error: --ref applies to GitHub-backed agents; this agent is published from the checkout"
65
+ );
66
+ return 1;
67
+ }
68
+ ref = await commitCheckout({ publish: args, definition, branch, local: local.files });
69
+ } else {
70
+ output.stderr(`error: ${args.agent} uses a repository kind this CLI does not know`);
71
+ return 1;
72
+ }
73
+ const request = {
74
+ definition: definition.id,
75
+ ref
76
+ };
77
+ if (args.note != null) request.note = args.note;
78
+ const result = await client.definitions.publish(request);
79
+ for (const line of publishResultLines(result)) output.stdout(line);
80
+ return 0;
81
+ } catch (cause) {
82
+ for (const line of errorLines(cause)) output.stderr(line);
83
+ return 1;
84
+ }
85
+ };
86
+ export {
87
+ runPublish
88
+ };
89
+ //# sourceMappingURL=publish.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/cli/publish.ts"],
4
+ "sourcesContent": ["import type { AgentClientIface } from \"../agent-client/client.mjs\";\nimport { isClientError } from \"../agent-client/errors.mjs\";\nimport { DefinitionRepositoryKind, type DefinitionIface } from \"../agent-client/index.mjs\";\nimport { compileAndPrint } from \"./build.mjs\";\nimport { fileChanges, readLocalFiles, type ListFiles } from \"./files.mjs\";\nimport { errorLines, publishResultLines, type OutputIface } from \"./output.mjs\";\n\n// `final agents publish`: compiles the checkout\n// locally, commits it to the agent's default branch, and publishes that\n// commit. A GitHub-backed definition is not committed to; its ref (the\n// default branch unless given) is published as-is.\n\nexport interface PublishArgsIface {\n dir: string;\n // Definition slug or id.\n agent: string;\n // GitHub-backed definitions only.\n ref: string | null;\n message: string;\n note: string | null;\n client: AgentClientIface;\n listFiles: ListFiles;\n output: OutputIface;\n}\n\n// The default branch's files and head; an empty repository has neither.\nconst remoteFiles = async (args: {\n client: AgentClientIface;\n definition: DefinitionIface;\n branch: string;\n}): Promise<{ commitSha: string | null; files: Record<string, string> }> => {\n try {\n const listing = await args.client.definitions.files({\n definition: args.definition.id,\n ref: args.branch,\n });\n return {\n commitSha: listing.commitSha,\n files: Object.fromEntries(listing.files.map((file) => [file.path, file.content])),\n };\n } catch (cause) {\n if (isClientError(cause) && cause.status === 404) return { commitSha: null, files: {} };\n throw cause;\n }\n};\n\nconst commitCheckout = async (args: {\n publish: PublishArgsIface;\n definition: DefinitionIface;\n branch: string;\n local: Record<string, string>;\n}): Promise<string> => {\n const { client, output, message } = args.publish;\n const remote = await remoteFiles({ client, definition: args.definition, branch: args.branch });\n const changes = fileChanges({ local: args.local, remote: remote.files });\n if (changes.length === 0 && remote.commitSha != null) {\n output.stdout(`no changes; publishing ${args.branch} at ${remote.commitSha}`);\n return remote.commitSha;\n }\n const request: Parameters<AgentClientIface['definitions']['commit']>[0] = {\n definition: args.definition.id,\n files: changes,\n message,\n branch: args.branch,\n };\n // The commit fails if the branch moved since it was read.\n if (remote.commitSha != null) request.parentSha = remote.commitSha;\n const committed = await client.definitions.commit(request);\n const deleted = changes.filter((change) => change.content == null).length;\n output.stdout(\n `committed ${committed.commitSha} to ${committed.branch} (${changes.length - deleted} written, ${deleted} deleted)`,\n );\n return committed.commitSha;\n};\n\nexport const runPublish = async (args: PublishArgsIface): Promise<number> => {\n const { client, output } = args;\n try {\n const local = await readLocalFiles({ dir: args.dir, listFiles: args.listFiles });\n for (const problem of local.problems) output.stderr(`error: ${problem}`);\n if (local.problems.length > 0) return 1;\n\n // What the platform compiles is the committed files, so compile those.\n const compiled = await compileAndPrint({ source: { files: local.files }, client, output });\n if (!compiled.ok) {\n output.stderr('error: the agent did not compile; nothing was published');\n return 1;\n }\n\n const definition = await client.definitions.get({ definition: args.agent });\n const repository = definition.repository;\n const kind = repository?.kind ?? DefinitionRepositoryKind.CodeStorage;\n const branch = repository?.defaultBranch ?? 'main';\n let ref: string;\n if (kind === DefinitionRepositoryKind.GitHub) {\n ref = args.ref ?? branch;\n } else if (kind === DefinitionRepositoryKind.CodeStorage) {\n if (args.ref != null) {\n output.stderr(\n 'error: --ref applies to GitHub-backed agents; this agent is published from the checkout',\n );\n return 1;\n }\n ref = await commitCheckout({ publish: args, definition, branch, local: local.files });\n } else {\n output.stderr(`error: ${args.agent} uses a repository kind this CLI does not know`);\n return 1;\n }\n\n const request: Parameters<AgentClientIface['definitions']['publish']>[0] = {\n definition: definition.id,\n ref,\n };\n if (args.note != null) request.note = args.note;\n const result = await client.definitions.publish(request);\n for (const line of publishResultLines(result)) output.stdout(line);\n return 0;\n } catch (cause) {\n for (const line of errorLines(cause)) output.stderr(line);\n return 1;\n }\n};\n"],
5
+ "mappings": "AACA,SAAS,qBAAqB;AAC9B,SAAS,gCAAsD;AAC/D,SAAS,uBAAuB;AAChC,SAAS,aAAa,sBAAsC;AAC5D,SAAS,YAAY,0BAA4C;AAqBjE,MAAM,cAAc,OAAO,SAIiD;AAC1E,MAAI;AACF,UAAM,UAAU,MAAM,KAAK,OAAO,YAAY,MAAM;AAAA,MAClD,YAAY,KAAK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7
+ }
@@ -0,0 +1,3 @@
1
+ import type { CompileOptionsIface, CompileResultIface } from '@finalai/agent-definition/compiler';
2
+ export declare const compile: (options: CompileOptionsIface) => Promise<CompileResultIface>;
3
+ export type { CompatibilityReportIface, CompiledBundleIface, CompileOptionsIface, CompileResultIface, DiagnosticCode, DiagnosticIface, DiagnosticSeverity, HarnessDescriptionContextIface, } from '@finalai/agent-definition/compiler';
@@ -0,0 +1,62 @@
1
+ import { fileURLToPath } from "node:url";
2
+ const compile = async (options) => {
3
+ const finalAuthoringModules = [
4
+ "harnesses",
5
+ "harnesses/models",
6
+ "harnesses/config-fields",
7
+ "harnesses/serverless-final",
8
+ "harnesses/serverless-pi",
9
+ "harnesses/serverless-nanocode-codex",
10
+ "harnesses/serverless-nanocode-claude",
11
+ "harnesses/remote-pi",
12
+ "harnesses/remote-codex",
13
+ "harnesses/remote-claude-code",
14
+ "harnesses/remote-acp",
15
+ "harnesses/local-stdio",
16
+ "sandboxes",
17
+ "sandboxes/computer",
18
+ "sandboxes/device",
19
+ "sandboxes/environment",
20
+ "connections",
21
+ "channels/final",
22
+ "channel-factories"
23
+ ].map((path) => "@finalai/final-agent-provider/" + path);
24
+ const providerModules = {
25
+ ...Object.fromEntries(
26
+ finalAuthoringModules.map((specifier) => [
27
+ specifier,
28
+ fileURLToPath(import.meta.resolve(specifier))
29
+ ])
30
+ ),
31
+ "@finalai/agents": fileURLToPath(import.meta.resolve("@finalai/agents/authoring")),
32
+ "@finalai/agents/harnesses": fileURLToPath(
33
+ import.meta.resolve("@finalai/final-agent-provider/harnesses")
34
+ ),
35
+ "@finalai/agents/models": fileURLToPath(
36
+ import.meta.resolve("@finalai/final-agent-provider/harnesses/models")
37
+ ),
38
+ "@finalai/agents/sandboxes": fileURLToPath(
39
+ import.meta.resolve("@finalai/final-agent-provider/sandboxes")
40
+ ),
41
+ "@finalai/agents/channels/final": fileURLToPath(
42
+ import.meta.resolve("@finalai/final-agent-provider/channels/final")
43
+ ),
44
+ ...options.providerModules
45
+ };
46
+ return (await import("@finalai/agent-definition/compiler")).compile({
47
+ defaultFiles: {
48
+ "channels/final.ts": "import { finalChannel } from '@finalai/agents/channels/final'; export default finalChannel();"
49
+ },
50
+ ...options,
51
+ providerModules,
52
+ installedSandboxProviders: {
53
+ computer: "@finalai/final-agent-provider/sandboxes/computer",
54
+ device: "@finalai/final-agent-provider/sandboxes/device",
55
+ ...options.installedSandboxProviders
56
+ }
57
+ });
58
+ };
59
+ export {
60
+ compile
61
+ };
62
+ //# sourceMappingURL=compile.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/compile.ts"],
4
+ "sourcesContent": ["import type { CompileOptionsIface, CompileResultIface } from '@finalai/agent-definition/compiler';\nimport { fileURLToPath } from 'node:url';\nexport const compile = async (options: CompileOptionsIface): Promise<CompileResultIface> => {\n const finalAuthoringModules = [\n 'harnesses',\n 'harnesses/models',\n 'harnesses/config-fields',\n 'harnesses/serverless-final',\n 'harnesses/serverless-pi',\n 'harnesses/serverless-nanocode-codex',\n 'harnesses/serverless-nanocode-claude',\n 'harnesses/remote-pi',\n 'harnesses/remote-codex',\n 'harnesses/remote-claude-code',\n 'harnesses/remote-acp',\n 'harnesses/local-stdio',\n 'sandboxes',\n 'sandboxes/computer',\n 'sandboxes/device',\n 'sandboxes/environment',\n 'connections',\n 'channels/final',\n 'channel-factories',\n ].map((path) => '@finalai/final-agent-provider/' + path);\n const providerModules = {\n ...Object.fromEntries(\n finalAuthoringModules.map((specifier) => [\n specifier,\n fileURLToPath(import.meta.resolve(specifier)),\n ]),\n ),\n '@finalai/agents': fileURLToPath(import.meta.resolve('@finalai/agents/authoring')),\n '@finalai/agents/harnesses': fileURLToPath(\n import.meta.resolve('@finalai/final-agent-provider/harnesses'),\n ),\n '@finalai/agents/models': fileURLToPath(\n import.meta.resolve('@finalai/final-agent-provider/harnesses/models'),\n ),\n '@finalai/agents/sandboxes': fileURLToPath(\n import.meta.resolve('@finalai/final-agent-provider/sandboxes'),\n ),\n '@finalai/agents/channels/final': fileURLToPath(\n import.meta.resolve('@finalai/final-agent-provider/channels/final'),\n ),\n ...options.providerModules,\n };\n return (await import('@finalai/agent-definition/compiler')).compile({\n defaultFiles: {\n 'channels/final.ts':\n \"import { finalChannel } from '@finalai/agents/channels/final'; export default finalChannel();\",\n },\n ...options,\n providerModules,\n installedSandboxProviders: {\n computer: '@finalai/final-agent-provider/sandboxes/computer',\n device: '@finalai/final-agent-provider/sandboxes/device',\n ...options.installedSandboxProviders,\n },\n });\n};\nexport type {\n CompatibilityReportIface,\n CompiledBundleIface,\n CompileOptionsIface,\n CompileResultIface,\n DiagnosticCode,\n DiagnosticIface,\n DiagnosticSeverity,\n HarnessDescriptionContextIface,\n} from '@finalai/agent-definition/compiler';\n"],
5
+ "mappings": "AACA,SAAS,qBAAqB;AACvB,MAAM,UAAU,OAAO,YAA8D;AAC1F,QAAM,wBAAwB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,IAAI,CAAC,SAAS,mCAAmC,IAAI;AACvD,QAAM,kBAAkB;AAAA,IACtB,GAAG,OAAO;AAAA,MACR,sBAAsB,IAAI,CAAC,cAAc;AAAA,QACvC;AAAA,QACA,cAAc,YAAY,QAAQ,SAAS,CAAC;AAAA,MAC9C,CAAC;AAAA,IACH;AAAA,IACA,mBAAmB,cAAc,YAAY,QAAQ,2BAA2B,CAAC;AAAA,IACjF,6BAA6B;AAAA,MAC3B,YAAY,QAAQ,yCAAyC;AAAA,IAC/D;AAAA,IACA,0BAA0B;AAAA,MACxB,YAAY,QAAQ,gDAAgD;AAAA,IACtE;AAAA,IACA,6BAA6B;AAAA,MAC3B,YAAY,QAAQ,yCAAyC;AAAA,IAC/D;AAAA,IACA,kCAAkC;AAAA,MAChC,YAAY,QAAQ,8CAA8C;AAAA,IACpE;AAAA,IACA,GAAG,QAAQ;AAAA,EACb;AACA,UAAQ,MAAM,OAAO,oCAAoC,GAAG,QAAQ;AAAA,IAClE,cAAc;AAAA,MACZ,qBACE;AAAA,IACJ;AAAA,IACA,GAAG;AAAA,IACH;AAAA,IACA,2BAA2B;AAAA,MACzB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,GAAG,QAAQ;AAAA,IACb;AAAA,EACF,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export * from '@finalai/final-agent-provider/harnesses';
@@ -0,0 +1,2 @@
1
+ export * from "@finalai/final-agent-provider/harnesses";
2
+ //# sourceMappingURL=harnesses.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/harnesses.ts"],
4
+ "sourcesContent": ["export * from '@finalai/final-agent-provider/harnesses';\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ export type { CompatibilityReportIface, CompiledBundleIface, CompileOptionsIface, CompileResultIface, DiagnosticCode, DiagnosticIface, DiagnosticSeverity, HarnessDescriptionContextIface, } from "./compile.mjs";
2
+ export * from "./public.mjs";
3
+ import type { CompileOptionsIface, CompileResultIface } from "./compile.mjs";
4
+ export declare const compile: (_options: CompileOptionsIface) => Promise<CompileResultIface>;
@@ -0,0 +1,8 @@
1
+ export * from "./public.mjs";
2
+ const compile = async (_options) => {
3
+ throw new Error("Agent directory compilation requires Node.js.");
4
+ };
5
+ export {
6
+ compile
7
+ };
8
+ //# sourceMappingURL=index.browser.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/index.browser.ts"],
4
+ "sourcesContent": ["export type {\n CompatibilityReportIface,\n CompiledBundleIface,\n CompileOptionsIface,\n CompileResultIface,\n DiagnosticCode,\n DiagnosticIface,\n DiagnosticSeverity,\n HarnessDescriptionContextIface,\n} from \"./compile.mjs\";\nexport * from \"./public.mjs\";\nimport type { CompileOptionsIface, CompileResultIface } from \"./compile.mjs\";\n\nexport const compile = async (_options: CompileOptionsIface): Promise<CompileResultIface> => {\n throw new Error('Agent directory compilation requires Node.js.');\n};\n"],
5
+ "mappings": "AAUA,cAAc;AAGP,MAAM,UAAU,OAAO,aAA+D;AAC3F,QAAM,IAAI,MAAM,+CAA+C;AACjE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./public.mjs";
2
+ export { compile } from "./compile.mjs";
3
+ export type { CompatibilityReportIface, CompileOptionsIface, CompileResultIface, CompiledBundleIface, DiagnosticCode, DiagnosticIface, DiagnosticSeverity, HarnessDescriptionContextIface, } from "./compile.mjs";
@@ -0,0 +1,6 @@
1
+ export * from "./public.mjs";
2
+ import { compile } from "./compile.mjs";
3
+ export {
4
+ compile
5
+ };
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/index.ts"],
4
+ "sourcesContent": ["export * from \"./public.mjs\";\n\n// Node compiler entrypoint.\nexport { compile } from \"./compile.mjs\";\nexport type {\n CompatibilityReportIface,\n CompileOptionsIface,\n CompileResultIface,\n CompiledBundleIface,\n DiagnosticCode,\n DiagnosticIface,\n DiagnosticSeverity,\n HarnessDescriptionContextIface,\n} from \"./compile.mjs\";\n"],
5
+ "mappings": "AAAA,cAAc;AAGd,SAAS,eAAe;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export * from '@finalai/final-agent-provider/harnesses/models';
@@ -0,0 +1,2 @@
1
+ export * from "@finalai/final-agent-provider/harnesses/models";
2
+ //# sourceMappingURL=models.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/models.ts"],
4
+ "sourcesContent": ["export * from '@finalai/final-agent-provider/harnesses/models';\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ export { CredentialOwner, CredentialPayer, DELETE, GET, HookEvent, POST, PUT, SandboxWire, WS, always, baseTools, credentials, defineAgent, defineChannel, disableChannel, defineProviderChannel, defineDynamic, defineHarness, defineHook, defineInstructions, defineMcpClientConnection, defineSandbox, defineSandboxProvider, defineSchedule, defineSkill, defineTool, harnessHost, never, toolResultFrom, whenInput, } from "./authoring/index.mjs";
2
+ export type { AgentDefinitionInputIface, AgentSessionInfoIface, ApprovalPolicyIface, AuthoredChannelDefinitionIface, AuthoredHarnessCloseContextIface, AuthoredHarnessDescriptionIface, AuthoredHarnessEndpointIface, AuthoredHarnessHealthIface, AuthoredHarnessIface, AuthoredHarnessOpenArgsIface, AuthoredHarnessRefContextIface, AuthoredHarnessResumeArgsIface, BaseToolsValueIface, ConversationInfoIface, CredentialNode, CredentialPolicyIface, DefinedAuthoredHarnessIface, DefinedToolIface, DynamicDefinitionIface, DynamicResolveContextIface, DynamicSentinelIface, FinalPlatformClientIface, HarnessHostIface, HookContextIface, HookDefinitionIface, HookEventIface, McpClientConnectionDefinitionIface, SandboxSelectorContextIface, ScheduleInputIface, SkillDefinitionIface, ToolContextIface, ToolDefinitionIface, } from "./authoring/index.mjs";
3
+ export * from "./authoring/providers.mjs";
4
+ export type { AgentManifestIface, ChannelDefinitionIface, ChannelPlatformIface, ChannelSocketIface, HarnessDescriptionIface, HarnessEndpointIface, HarnessIface, HarnessSessionRefIface, McpChannelIface, NetworkSandboxSessionIface, ResolvedAgentManifestIface, RouteDefinitionIface, SandboxMcpEndpoint, SandboxPrepareContextIface, SandboxProcessIface, SandboxProviderHandleIface, SandboxProviderIface, SandboxProviderImplementationIface, SandboxSessionIface, SandboxStartContextIface, ScreenSessionIface, } from '@finalai/agent-provider';
5
+ export { defineFinalConnection } from '@finalai/final-agent-provider/connections';
6
+ export type { FinalConnectionDefinitionIface } from '@finalai/final-agent-provider/connections';
@@ -0,0 +1,68 @@
1
+ import {
2
+ CredentialOwner,
3
+ CredentialPayer,
4
+ DELETE,
5
+ GET,
6
+ HookEvent,
7
+ POST,
8
+ PUT,
9
+ SandboxWire,
10
+ WS,
11
+ always,
12
+ baseTools,
13
+ credentials,
14
+ defineAgent,
15
+ defineChannel,
16
+ disableChannel,
17
+ defineProviderChannel,
18
+ defineDynamic,
19
+ defineHarness,
20
+ defineHook,
21
+ defineInstructions,
22
+ defineMcpClientConnection,
23
+ defineSandbox,
24
+ defineSandboxProvider,
25
+ defineSchedule,
26
+ defineSkill,
27
+ defineTool,
28
+ harnessHost,
29
+ never,
30
+ toolResultFrom,
31
+ whenInput
32
+ } from "./authoring/index.mjs";
33
+ export * from "./authoring/providers.mjs";
34
+ import { defineFinalConnection } from "@finalai/final-agent-provider/connections";
35
+ export {
36
+ CredentialOwner,
37
+ CredentialPayer,
38
+ DELETE,
39
+ GET,
40
+ HookEvent,
41
+ POST,
42
+ PUT,
43
+ SandboxWire,
44
+ WS,
45
+ always,
46
+ baseTools,
47
+ credentials,
48
+ defineAgent,
49
+ defineChannel,
50
+ defineDynamic,
51
+ defineFinalConnection,
52
+ defineHarness,
53
+ defineHook,
54
+ defineInstructions,
55
+ defineMcpClientConnection,
56
+ defineProviderChannel,
57
+ defineSandbox,
58
+ defineSandboxProvider,
59
+ defineSchedule,
60
+ defineSkill,
61
+ defineTool,
62
+ disableChannel,
63
+ harnessHost,
64
+ never,
65
+ toolResultFrom,
66
+ whenInput
67
+ };
68
+ //# sourceMappingURL=public.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/public.ts"],
4
+ "sourcesContent": ["// Agent authoring.\nexport {\n CredentialOwner,\n CredentialPayer,\n DELETE,\n GET,\n HookEvent,\n POST,\n PUT,\n SandboxWire,\n WS,\n always,\n baseTools,\n credentials,\n defineAgent,\n defineChannel,\n disableChannel,\n defineProviderChannel,\n defineDynamic,\n defineHarness,\n defineHook,\n defineInstructions,\n defineMcpClientConnection,\n defineSandbox,\n defineSandboxProvider,\n defineSchedule,\n defineSkill,\n defineTool,\n harnessHost,\n never,\n toolResultFrom,\n whenInput,\n} from \"./authoring/index.mjs\";\nexport type {\n AgentDefinitionInputIface,\n AgentSessionInfoIface,\n ApprovalPolicyIface,\n AuthoredChannelDefinitionIface,\n AuthoredHarnessCloseContextIface,\n AuthoredHarnessDescriptionIface,\n AuthoredHarnessEndpointIface,\n AuthoredHarnessHealthIface,\n AuthoredHarnessIface,\n AuthoredHarnessOpenArgsIface,\n AuthoredHarnessRefContextIface,\n AuthoredHarnessResumeArgsIface,\n BaseToolsValueIface,\n ConversationInfoIface,\n CredentialNode,\n CredentialPolicyIface,\n DefinedAuthoredHarnessIface,\n DefinedToolIface,\n DynamicDefinitionIface,\n DynamicResolveContextIface,\n DynamicSentinelIface,\n FinalPlatformClientIface,\n HarnessHostIface,\n HookContextIface,\n HookDefinitionIface,\n HookEventIface,\n McpClientConnectionDefinitionIface,\n SandboxSelectorContextIface,\n ScheduleInputIface,\n SkillDefinitionIface,\n ToolContextIface,\n ToolDefinitionIface,\n} from \"./authoring/index.mjs\";\nexport * from \"./authoring/providers.mjs\";\n\nexport type {\n AgentManifestIface,\n ChannelDefinitionIface,\n ChannelPlatformIface,\n ChannelSocketIface,\n HarnessDescriptionIface,\n HarnessEndpointIface,\n HarnessIface,\n HarnessSessionRefIface,\n McpChannelIface,\n NetworkSandboxSessionIface,\n ResolvedAgentManifestIface,\n RouteDefinitionIface,\n SandboxMcpEndpoint,\n SandboxPrepareContextIface,\n SandboxProcessIface,\n SandboxProviderHandleIface,\n SandboxProviderIface,\n SandboxProviderImplementationIface,\n SandboxSessionIface,\n SandboxStartContextIface,\n ScreenSessionIface,\n} from '@finalai/agent-provider';\n\nexport { defineFinalConnection } from '@finalai/final-agent-provider/connections';\nexport type { FinalConnectionDefinitionIface } from '@finalai/final-agent-provider/connections';\n"],
5
+ "mappings": "AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAmCP,cAAc;AA0Bd,SAAS,6BAA6B;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export * from '@finalai/final-agent-provider/sandboxes';
@@ -0,0 +1,2 @@
1
+ export * from "@finalai/final-agent-provider/sandboxes";
2
+ //# sourceMappingURL=sandboxes.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/sandboxes.ts"],
4
+ "sourcesContent": ["export * from '@finalai/final-agent-provider/sandboxes';\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,16 @@
1
+ # Custom harness fleet
2
+
3
+ `agent.ts` demonstrates binding an agent to a custom harness fleet. Replace the sample fleet origin with your fleet and implement its API before publishing. The named `acmeFleet` export lets another definition import the same binding.
4
+
5
+ The sample fleet uses its own model login. Billing policy is explicit in definition source; Final MCP and other tool credentials remain independently owned at their MCP hosts. The `acme-fleet-key` secret authenticates hosting operations and must be declared and supplied before publication.
6
+
7
+ The fleet API contract is:
8
+
9
+ - `POST /sessions`: create or recover by `idempotencyKey`, accepting `sessionId`, `region`, `program` and materialized `mcpServers`.
10
+ - `POST /sessions/:id/resume`: accept the saved `generation`, `lastSeq` and fresh `mcpServers`, then return an endpoint for the existing session.
11
+ - Both return `{ id, generation, wsUrl, token }`. The WebSocket must be on the fleet's origin and speak ACP v2. Session IDs remain stable, generations are nonnegative, and the native runtime preserves running work and open requests through reconnect. Replay must agree with the declared `resumeReplay` capability.
12
+ - `POST /sessions/:id/pause`: persist state before parking; retries are idempotent.
13
+ - `DELETE /sessions/:id`: accept `generation` and `force`; persist state on graceful close, abort promptly when forced, and succeed for an already closed session.
14
+ - `GET /sessions/:id/health`: return `{ ok, detail? }` from the actual runtime state.
15
+
16
+ All routes require a bearer hosting secret. Endpoint tokens authorize only the returned ACP session. The fleet must pass the MCP servers through the installed program's public surface, retain its own settings/login, accept prompts while running under its queue policy, and implement the public conformance cases before use. This example supplies every lifecycle callback; it does not provision that external fleet.