@finalai/agents 0.11.0 → 0.12.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.
Files changed (185) hide show
  1. package/HOSTING.md +334 -245
  2. package/README.md +214 -29
  3. package/dist/modules/agent-client/agent-input.d.mts +24 -0
  4. package/dist/modules/agent-client/agent-input.mjs +46 -0
  5. package/dist/modules/agent-client/agent-input.mjs.map +7 -0
  6. package/dist/modules/agent-client/channels.d.mts +52 -3
  7. package/dist/modules/agent-client/channels.mjs +71 -10
  8. package/dist/modules/agent-client/channels.mjs.map +2 -2
  9. package/dist/modules/agent-client/client.d.mts +85 -20
  10. package/dist/modules/agent-client/client.mjs +74 -21
  11. package/dist/modules/agent-client/client.mjs.map +2 -2
  12. package/dist/modules/agent-client/config-options.mjs +1 -2
  13. package/dist/modules/agent-client/config-options.mjs.map +2 -2
  14. package/dist/modules/agent-client/conversation-resources.d.mts +85 -0
  15. package/dist/modules/agent-client/conversation-resources.mjs +150 -0
  16. package/dist/modules/agent-client/conversation-resources.mjs.map +7 -0
  17. package/dist/modules/agent-client/conversations.d.mts +116 -38
  18. package/dist/modules/agent-client/conversations.mjs +379 -71
  19. package/dist/modules/agent-client/conversations.mjs.map +2 -2
  20. package/dist/modules/agent-client/defaults.d.mts +8 -0
  21. package/dist/modules/agent-client/defaults.mjs +77 -0
  22. package/dist/modules/agent-client/defaults.mjs.map +7 -0
  23. package/dist/modules/agent-client/errors.d.mts +22 -2
  24. package/dist/modules/agent-client/errors.mjs +19 -0
  25. package/dist/modules/agent-client/errors.mjs.map +2 -2
  26. package/dist/modules/agent-client/events.d.mts +62 -0
  27. package/dist/modules/agent-client/events.mjs +107 -0
  28. package/dist/modules/agent-client/events.mjs.map +7 -0
  29. package/dist/modules/agent-client/harnesses.d.mts +66 -0
  30. package/dist/modules/agent-client/harnesses.mjs +156 -0
  31. package/dist/modules/agent-client/harnesses.mjs.map +7 -0
  32. package/dist/modules/agent-client/http.d.mts +2 -1
  33. package/dist/modules/agent-client/http.mjs +21 -2
  34. package/dist/modules/agent-client/http.mjs.map +2 -2
  35. package/dist/modules/agent-client/index.d.mts +21 -6
  36. package/dist/modules/agent-client/index.mjs +26 -0
  37. package/dist/modules/agent-client/index.mjs.map +2 -2
  38. package/dist/modules/agent-client/integrations.d.mts +40 -0
  39. package/dist/modules/agent-client/integrations.mjs +92 -0
  40. package/dist/modules/agent-client/integrations.mjs.map +7 -0
  41. package/dist/modules/agent-client/local-host-protocol.d.mts +156 -0
  42. package/dist/modules/agent-client/local-host-protocol.mjs +258 -0
  43. package/dist/modules/agent-client/local-host-protocol.mjs.map +7 -0
  44. package/dist/modules/agent-client/local-host.d.mts +56 -0
  45. package/dist/modules/agent-client/local-host.mjs +200 -0
  46. package/dist/modules/agent-client/local-host.mjs.map +7 -0
  47. package/dist/modules/agent-client/oauth-clients.d.mts +36 -0
  48. package/dist/modules/agent-client/oauth-clients.mjs +67 -0
  49. package/dist/modules/agent-client/oauth-clients.mjs.map +7 -0
  50. package/dist/modules/agent-client/project-agents.d.mts +54 -0
  51. package/dist/modules/agent-client/project-agents.mjs +111 -0
  52. package/dist/modules/agent-client/project-agents.mjs.map +7 -0
  53. package/dist/modules/agent-client/project.d.mts +43 -0
  54. package/dist/modules/agent-client/project.mjs +66 -0
  55. package/dist/modules/agent-client/project.mjs.map +7 -0
  56. package/dist/modules/agent-client/projects.d.mts +61 -0
  57. package/dist/modules/agent-client/projects.mjs +145 -0
  58. package/dist/modules/agent-client/projects.mjs.map +7 -0
  59. package/dist/modules/agent-client/provide.d.mts +41 -0
  60. package/dist/modules/agent-client/provide.mjs +90 -0
  61. package/dist/modules/agent-client/provide.mjs.map +7 -0
  62. package/dist/modules/agent-client/publishers.d.mts +57 -0
  63. package/dist/modules/agent-client/publishers.mjs +109 -0
  64. package/dist/modules/agent-client/publishers.mjs.map +7 -0
  65. package/dist/modules/agent-client/requirements.d.mts +60 -0
  66. package/dist/modules/agent-client/requirements.mjs +83 -0
  67. package/dist/modules/agent-client/requirements.mjs.map +7 -0
  68. package/dist/modules/agent-client/sandbox-providers.d.mts +34 -0
  69. package/dist/modules/agent-client/sandbox-providers.mjs +75 -0
  70. package/dist/modules/agent-client/sandbox-providers.mjs.map +7 -0
  71. package/dist/modules/agent-client/sandbox-uri.d.mts +1 -1
  72. package/dist/modules/agent-client/sandbox-uri.mjs +4 -4
  73. package/dist/modules/agent-client/sandbox-uri.mjs.map +1 -1
  74. package/dist/modules/agent-client/sandboxes.d.mts +65 -0
  75. package/dist/modules/agent-client/sandboxes.mjs +130 -0
  76. package/dist/modules/agent-client/sandboxes.mjs.map +7 -0
  77. package/dist/modules/agent-client/schedules.d.mts +24 -0
  78. package/dist/modules/agent-client/schedules.mjs +56 -0
  79. package/dist/modules/agent-client/schedules.mjs.map +7 -0
  80. package/dist/modules/agent-client/sessions.d.mts +46 -8
  81. package/dist/modules/agent-client/sessions.mjs +91 -29
  82. package/dist/modules/agent-client/sessions.mjs.map +2 -2
  83. package/dist/modules/agent-client/start.d.mts +101 -0
  84. package/dist/modules/agent-client/start.mjs +260 -0
  85. package/dist/modules/agent-client/start.mjs.map +7 -0
  86. package/dist/modules/agent-client/test-fakes.d.mts +1 -0
  87. package/dist/modules/agent-client/test-fakes.mjs +3 -1
  88. package/dist/modules/agent-client/test-fakes.mjs.map +2 -2
  89. package/dist/modules/cli/agent-module.d.mts +39 -0
  90. package/dist/modules/cli/agent-module.mjs +89 -0
  91. package/dist/modules/cli/agent-module.mjs.map +7 -0
  92. package/dist/modules/cli/cli.d.mts +6 -6
  93. package/dist/modules/cli/cli.mjs +94 -120
  94. package/dist/modules/cli/cli.mjs.map +2 -2
  95. package/dist/modules/cli/conformance.d.mts +2 -6
  96. package/dist/modules/cli/conformance.mjs +5 -8
  97. package/dist/modules/cli/conformance.mjs.map +2 -2
  98. package/dist/modules/cli/main.mjs.map +1 -1
  99. package/dist/modules/cli/output.d.mts +0 -9
  100. package/dist/modules/cli/output.mjs +7 -85
  101. package/dist/modules/cli/output.mjs.map +2 -2
  102. package/dist/modules/harnesses.mjs.map +2 -2
  103. package/dist/modules/index.d.mts +0 -2
  104. package/dist/modules/index.mjs +0 -4
  105. package/dist/modules/index.mjs.map +2 -2
  106. package/dist/modules/integrations.d.mts +24 -0
  107. package/dist/modules/integrations.mjs +30 -0
  108. package/dist/modules/integrations.mjs.map +7 -0
  109. package/dist/modules/public.d.mts +10 -10
  110. package/dist/modules/public.mjs +29 -78
  111. package/dist/modules/public.mjs.map +2 -2
  112. package/dist/modules/sandboxes.d.mts +2 -0
  113. package/dist/modules/sandboxes.mjs +4 -0
  114. package/dist/modules/sandboxes.mjs.map +2 -2
  115. package/dist/modules/verify.d.mts +1 -0
  116. package/dist/modules/verify.mjs +2 -0
  117. package/dist/modules/verify.mjs.map +7 -0
  118. package/dist/modules/webhooks.d.mts +37 -0
  119. package/dist/modules/webhooks.mjs +100 -0
  120. package/dist/modules/webhooks.mjs.map +7 -0
  121. package/examples/release-scout/README.md +18 -10
  122. package/examples/release-scout/agent.ts +41 -0
  123. package/examples/release-scout/by-name.ts +43 -0
  124. package/examples/release-scout/db.ts +6 -0
  125. package/examples/release-scout/instructions.md +5 -0
  126. package/examples/release-scout/run-on-a-computer.ts +49 -0
  127. package/examples/release-scout/run.ts +38 -0
  128. package/package.json +42 -28
  129. package/dist/modules/agent-client/build.d.mts +0 -110
  130. package/dist/modules/agent-client/build.mjs +0 -213
  131. package/dist/modules/agent-client/build.mjs.map +0 -7
  132. package/dist/modules/authoring/index.d.mts +0 -1
  133. package/dist/modules/authoring/index.mjs +0 -2
  134. package/dist/modules/authoring/index.mjs.map +0 -7
  135. package/dist/modules/authoring/instructions.d.mts +0 -1
  136. package/dist/modules/authoring/instructions.mjs +0 -2
  137. package/dist/modules/authoring/instructions.mjs.map +0 -7
  138. package/dist/modules/authoring/providers.d.mts +0 -2
  139. package/dist/modules/authoring/providers.mjs +0 -1
  140. package/dist/modules/authoring/providers.mjs.map +0 -7
  141. package/dist/modules/cli/build.d.mts +0 -22
  142. package/dist/modules/cli/build.mjs +0 -77
  143. package/dist/modules/cli/build.mjs.map +0 -7
  144. package/dist/modules/cli/channel-install.d.mts +0 -12
  145. package/dist/modules/cli/channel-install.mjs +0 -25
  146. package/dist/modules/cli/channel-install.mjs.map +0 -7
  147. package/dist/modules/cli/channel-socket.d.mts +0 -9
  148. package/dist/modules/cli/channel-socket.mjs +0 -114
  149. package/dist/modules/cli/channel-socket.mjs.map +0 -7
  150. package/dist/modules/cli/dev.d.mts +0 -26
  151. package/dist/modules/cli/dev.mjs +0 -311
  152. package/dist/modules/cli/dev.mjs.map +0 -7
  153. package/dist/modules/cli/files.d.mts +0 -18
  154. package/dist/modules/cli/files.mjs +0 -66
  155. package/dist/modules/cli/files.mjs.map +0 -7
  156. package/dist/modules/cli/harness-descriptions.d.mts +0 -20
  157. package/dist/modules/cli/harness-descriptions.mjs +0 -70
  158. package/dist/modules/cli/harness-descriptions.mjs.map +0 -7
  159. package/dist/modules/cli/publish.d.mts +0 -15
  160. package/dist/modules/cli/publish.mjs +0 -92
  161. package/dist/modules/cli/publish.mjs.map +0 -7
  162. package/dist/modules/compile.d.mts +0 -3
  163. package/dist/modules/compile.mjs +0 -58
  164. package/dist/modules/compile.mjs.map +0 -7
  165. package/dist/modules/index.browser.d.mts +0 -4
  166. package/dist/modules/index.browser.mjs +0 -8
  167. package/dist/modules/index.browser.mjs.map +0 -7
  168. package/examples/custom-harness/README.md +0 -16
  169. package/examples/custom-harness/agent.ts +0 -154
  170. package/examples/custom-sandbox/README.md +0 -12
  171. package/examples/custom-sandbox/agent.ts +0 -14
  172. package/examples/custom-sandbox/sandbox.ts +0 -24
  173. package/examples/release-scout/agent/agent.ts +0 -22
  174. package/examples/release-scout/agent/channels/github-signature.ts +0 -27
  175. package/examples/release-scout/agent/channels/github.ts +0 -32
  176. package/examples/release-scout/agent/connections/linear.ts +0 -9
  177. package/examples/release-scout/agent/hooks/audit.ts +0 -24
  178. package/examples/release-scout/agent/instructions/org-context.ts +0 -26
  179. package/examples/release-scout/agent/instructions.md +0 -2
  180. package/examples/release-scout/agent/sandbox.ts +0 -20
  181. package/examples/release-scout/agent/schedules/daily-digest.md +0 -7
  182. package/examples/release-scout/agent/skills/triage/SKILL.md +0 -8
  183. package/examples/release-scout/agent/skills/triage/checklist.md +0 -3
  184. package/examples/release-scout/agent/tools/lookup_release_notes.ts +0 -24
  185. package/examples/release-scout/client.ts +0 -122
@@ -0,0 +1,66 @@
1
+ import {
2
+ createChannelBindingsApi,
3
+ createProjectChannelsApi
4
+ } from "./channels.mjs";
5
+ import { encodePath } from "./context.mjs";
6
+ import { createProjectConversationsApi } from "./conversations.mjs";
7
+ import {
8
+ createEventsApi,
9
+ createEventSubscriptionsApi
10
+ } from "./events.mjs";
11
+ import {
12
+ createAcpAdaptersApi,
13
+ createHarnessesApi
14
+ } from "./harnesses.mjs";
15
+ import { createIntegrationsApi } from "./integrations.mjs";
16
+ import {
17
+ createOAuthClientsApi,
18
+ createSignInReturnOriginsApi
19
+ } from "./oauth-clients.mjs";
20
+ import { createProjectAgentsApi } from "./project-agents.mjs";
21
+ import { createProjectResourceApi } from "./projects.mjs";
22
+ import {
23
+ createProjectPublisherApi,
24
+ createPublicNamesApi
25
+ } from "./publishers.mjs";
26
+ import { createSandboxProvidersApi } from "./sandbox-providers.mjs";
27
+ import {
28
+ createSandboxesApi,
29
+ createSandboxSetupsApi
30
+ } from "./sandboxes.mjs";
31
+ import { createProjectSessionsApi } from "./sessions.mjs";
32
+ const createProjectClient = (args) => {
33
+ const { context, projectId } = args;
34
+ const agents = createProjectAgentsApi({ context, projectId, codec: args.start.codec });
35
+ const store = async (agent, signal) => (await agents.store({ agent, signal })).hash;
36
+ return {
37
+ ...createProjectResourceApi({ context, projectId }),
38
+ id: projectId,
39
+ sessions: createProjectSessionsApi({ context, projectId, start: args.start }),
40
+ conversations: createProjectConversationsApi({ context, projectId, start: args.start }),
41
+ agents,
42
+ sandboxes: createSandboxesApi({ context, projectId }),
43
+ sandboxSetups: createSandboxSetupsApi({ context, projectId }),
44
+ integrations: createIntegrationsApi({ context, projectId }),
45
+ harnesses: createHarnessesApi({ context, projectId, store }),
46
+ acpAdapters: createAcpAdaptersApi({ context, projectId }),
47
+ channels: {
48
+ ...createProjectChannelsApi({ context, projectId, sourceOf: args.channelSourceOf }),
49
+ ...createChannelBindingsApi(context)
50
+ },
51
+ events: createEventsApi({ context, projectId }),
52
+ eventSubscriptions: createEventSubscriptionsApi({
53
+ context,
54
+ basePath: `/v1/projects/${encodePath(projectId)}/event-subscriptions`
55
+ }),
56
+ sandboxProviders: createSandboxProvidersApi({ context, projectId }),
57
+ oauthClients: createOAuthClientsApi({ context, projectId }),
58
+ signInReturnOrigins: createSignInReturnOriginsApi({ context, projectId }),
59
+ publisher: createProjectPublisherApi({ context, projectId }),
60
+ publicNames: createPublicNamesApi({ context, projectId })
61
+ };
62
+ };
63
+ export {
64
+ createProjectClient
65
+ };
66
+ //# sourceMappingURL=project.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/agent-client/project.ts"],
4
+ "sourcesContent": ["import type { AgentInput } from \"./agent-input.mjs\";\nimport {\n createChannelBindingsApi,\n createProjectChannelsApi,\n type ChannelBindingsApiIface,\n type ChannelSourceOf,\n type ProjectChannelsApiIface,\n} from \"./channels.mjs\";\nimport { encodePath, type ClientContextIface } from \"./context.mjs\";\nimport { createProjectConversationsApi, type ProjectConversationsApiIface } from \"./conversations.mjs\";\nimport {\n createEventsApi,\n createEventSubscriptionsApi,\n type EventsApiIface,\n type EventSubscriptionsApiIface,\n} from \"./events.mjs\";\nimport {\n createAcpAdaptersApi,\n createHarnessesApi,\n type AcpAdaptersApiIface,\n type HarnessesApiIface,\n} from \"./harnesses.mjs\";\nimport { createIntegrationsApi, type IntegrationsApiIface } from \"./integrations.mjs\";\nimport {\n createOAuthClientsApi,\n createSignInReturnOriginsApi,\n type OAuthClientsApiIface,\n type SignInReturnOriginsApiIface,\n} from \"./oauth-clients.mjs\";\nimport { createProjectAgentsApi, type ProjectAgentsApiIface } from \"./project-agents.mjs\";\nimport { createProjectResourceApi, type ProjectResourceApiIface } from \"./projects.mjs\";\nimport {\n createProjectPublisherApi,\n createPublicNamesApi,\n type ProjectPublisherApiIface,\n type PublicNamesApiIface,\n} from \"./publishers.mjs\";\nimport { createSandboxProvidersApi, type SandboxProvidersApiIface } from \"./sandbox-providers.mjs\";\nimport {\n createSandboxesApi,\n createSandboxSetupsApi,\n type SandboxesApiIface,\n type SandboxSetupsApiIface,\n} from \"./sandboxes.mjs\";\nimport { createProjectSessionsApi, type ProjectSessionsApiIface } from \"./sessions.mjs\";\nimport type { AgentStartDepsIface } from \"./start.mjs\";\n\n// One project: everything is created through it, and a session can only be\n// provided things from its own project.\n\nexport interface ProjectClientIface extends ProjectResourceApiIface {\n readonly id: string;\n sessions: ProjectSessionsApiIface;\n conversations: ProjectConversationsApiIface;\n agents: ProjectAgentsApiIface;\n sandboxes: SandboxesApiIface;\n sandboxSetups: SandboxSetupsApiIface;\n integrations: IntegrationsApiIface;\n harnesses: HarnessesApiIface;\n acpAdapters: AcpAdaptersApiIface;\n channels: ProjectChannelsApiIface & ChannelBindingsApiIface;\n /** The event feed for this project and those below it. */\n events: EventsApiIface;\n /** Pushes this project's feed to a URL (`webhooks:write`, project admin). */\n eventSubscriptions: EventSubscriptionsApiIface;\n sandboxProviders: SandboxProvidersApiIface;\n oauthClients: OAuthClientsApiIface;\n signInReturnOrigins: SignInReturnOriginsApiIface;\n /** The project's publisher handle. */\n publisher: ProjectPublisherApiIface;\n /** Which of the project's names resolve as `handle/name` from any organization. */\n publicNames: PublicNamesApiIface;\n}\n\nexport const createProjectClient = (args: {\n context: ClientContextIface;\n start: AgentStartDepsIface;\n channelSourceOf: ChannelSourceOf;\n projectId: string;\n}): ProjectClientIface => {\n const { context, projectId } = args;\n const agents = createProjectAgentsApi({ context, projectId, codec: args.start.codec });\n // The document must be stored before the platform can check a harness against it.\n const store = async (agent: AgentInput, signal?: AbortSignal): Promise<string> =>\n (await agents.store({ agent, signal })).hash;\n return {\n ...createProjectResourceApi({ context, projectId }),\n id: projectId,\n sessions: createProjectSessionsApi({ context, projectId, start: args.start }),\n conversations: createProjectConversationsApi({ context, projectId, start: args.start }),\n agents,\n sandboxes: createSandboxesApi({ context, projectId }),\n sandboxSetups: createSandboxSetupsApi({ context, projectId }),\n integrations: createIntegrationsApi({ context, projectId }),\n harnesses: createHarnessesApi({ context, projectId, store }),\n acpAdapters: createAcpAdaptersApi({ context, projectId }),\n channels: {\n ...createProjectChannelsApi({ context, projectId, sourceOf: args.channelSourceOf }),\n ...createChannelBindingsApi(context),\n },\n events: createEventsApi({ context, projectId }),\n eventSubscriptions: createEventSubscriptionsApi({\n context,\n basePath: `/v1/projects/${encodePath(projectId)}/event-subscriptions`,\n }),\n sandboxProviders: createSandboxProvidersApi({ context, projectId }),\n oauthClients: createOAuthClientsApi({ context, projectId }),\n signInReturnOrigins: createSignInReturnOriginsApi({ context, projectId }),\n publisher: createProjectPublisherApi({ context, projectId }),\n publicNames: createPublicNamesApi({ context, projectId }),\n };\n};\n"],
5
+ "mappings": "AACA;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP,SAAS,kBAA2C;AACpD,SAAS,qCAAwE;AACjF;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,6BAAwD;AACjE;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,8BAA0D;AACnE,SAAS,gCAA8D;AACvE;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,iCAAgE;AACzE;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,gCAA8D;AA8BhE,MAAM,sBAAsB,CAAC,SAKV;AACxB,QAAM,EAAE,SAAS,UAAU,IAAI;AAC/B,QAAM,SAAS,uBAAuB,EAAE,SAAS,WAAW,O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estIface, type ApiKeyIface, type CreateApiKeyRequestIface, type CreateApiKeyResponseIface, type CreateProjectRequestIface, type ProjectIface, type ProjectMemberIface, type ProjectMovePreviewIface, type ProjectRole, type UpdateProjectRequestIface } from '@finalai/agent-protocol/agent-platform';
2
+ import { type ClientContextIface, type EnumInput, type SignalOptionsIface } from "./context.mjs";
3
+ export interface ProjectsApiIface {
4
+ /** Every project the caller can see, or the children of `parentId`. */
5
+ list: (options?: SignalOptionsIface & {
6
+ parentId?: string;
7
+ includeArchived?: boolean;
8
+ }) => Promise<ProjectIface[]>;
9
+ /** Creates a project; open it with `client.project({ id })`. */
10
+ create: (args: CreateProjectRequestIface & SignalOptionsIface) => Promise<ProjectIface>;
11
+ }
12
+ export interface ProjectMembersApiIface {
13
+ /** Everyone with a role here, inherited roles included. */
14
+ list: (options?: SignalOptionsIface) => Promise<ProjectMemberIface[]>;
15
+ /** Grants a person or an API key a role here; never more than the caller's own. */
16
+ add: (args: Omit<AddProjectMemberRequestIface, 'role'> & {
17
+ role: EnumInput<ProjectRole>;
18
+ } & SignalOptionsIface) => Promise<ProjectMemberIface>;
19
+ /** `memberId` is the member's user (`usr_...`) or API key (`ak_...`) id. */
20
+ update: (args: {
21
+ memberId: string;
22
+ role: EnumInput<ProjectRole>;
23
+ } & SignalOptionsIface) => Promise<ProjectMemberIface>;
24
+ remove: (args: {
25
+ memberId: string;
26
+ } & SignalOptionsIface) => Promise<void>;
27
+ }
28
+ export interface ProjectApiKeysApiIface {
29
+ /** Creates a key acting in this project; its `value` is returned only here. */
30
+ create: (args: CreateApiKeyRequestIface & SignalOptionsIface) => Promise<CreateApiKeyResponseIface>;
31
+ list: (options?: SignalOptionsIface) => Promise<ApiKeyIface[]>;
32
+ delete: (args: {
33
+ id: string;
34
+ } & SignalOptionsIface) => Promise<boolean>;
35
+ }
36
+ export interface ProjectResourceApiIface {
37
+ /** The project itself, with the caller's effective role. */
38
+ info: (options?: SignalOptionsIface) => Promise<ProjectIface>;
39
+ update: (patch: UpdateProjectRequestIface, options?: SignalOptionsIface) => Promise<ProjectIface>;
40
+ archive: (options?: SignalOptionsIface) => Promise<ProjectIface>;
41
+ unarchive: (options?: SignalOptionsIface) => Promise<ProjectIface>;
42
+ /**
43
+ * Who would gain and lose a role if the project moved under `parentId`
44
+ * (omitted or null: the top of the organization). Pass its fingerprint to `move`.
45
+ */
46
+ movePreview: (args?: {
47
+ parentId?: string | null;
48
+ } & SignalOptionsIface) => Promise<ProjectMovePreviewIface>;
49
+ /** Refused if access would now change differently from the preview `fingerprint` came from. */
50
+ move: (args: {
51
+ parentId: string | null;
52
+ fingerprint: string;
53
+ } & SignalOptionsIface) => Promise<ProjectIface>;
54
+ members: ProjectMembersApiIface;
55
+ apiKeys: ProjectApiKeysApiIface;
56
+ }
57
+ export declare const createProjectsApi: (context: ClientContextIface) => ProjectsApiIface;
58
+ export declare const createProjectResourceApi: (args: {
59
+ context: ClientContextIface;
60
+ projectId: string;
61
+ }) => ProjectResourceApiIface;
@@ -0,0 +1,145 @@
1
+ import {
2
+ addProjectMemberRequestSchema,
3
+ apiKeyListSchema,
4
+ createApiKeyRequestSchema,
5
+ createApiKeyResponseSchema,
6
+ createProjectRequestSchema,
7
+ deleteApiKeyResponseSchema,
8
+ moveProjectRequestSchema,
9
+ okResponseSchema,
10
+ projectListSchema,
11
+ projectMemberListSchema,
12
+ projectMemberResponseSchema,
13
+ projectMovePreviewSchema,
14
+ projectResponseSchema,
15
+ updateProjectMemberRequestSchema,
16
+ updateProjectRequestSchema
17
+ } from "@finalai/agent-protocol/agent-platform";
18
+ import * as z from "zod";
19
+ import {
20
+ encodePath
21
+ } from "./context.mjs";
22
+ import { HttpMethod } from "./http.mjs";
23
+ const emptyBodySchema = z.strictObject({});
24
+ const createProjectsApi = (context) => ({
25
+ list: async (options) => (await context.http.request({
26
+ method: HttpMethod.Get,
27
+ path: "/v1/projects",
28
+ query: { parentId: options?.parentId, includeArchived: options?.includeArchived },
29
+ response: projectListSchema,
30
+ signal: options?.signal
31
+ })).projects,
32
+ create: async ({ signal, ...value }) => (await context.http.request({
33
+ method: HttpMethod.Post,
34
+ path: "/v1/projects",
35
+ body: { schema: createProjectRequestSchema, value },
36
+ response: projectResponseSchema,
37
+ signal
38
+ })).project
39
+ });
40
+ const createProjectResourceApi = (args) => {
41
+ const { http } = args.context;
42
+ const path = (suffix = "") => `/v1/projects/${encodePath(args.projectId)}${suffix}`;
43
+ const project = async (request, signal) => (await http.request({
44
+ method: request.method,
45
+ path: path(request.suffix),
46
+ body: request.body,
47
+ response: projectResponseSchema,
48
+ signal
49
+ })).project;
50
+ const memberPath = (memberId) => path(`/members/${encodePath(memberId)}`);
51
+ return {
52
+ info: (options) => project({ method: HttpMethod.Get }, options?.signal),
53
+ update: (patch, options) => project(
54
+ { method: HttpMethod.Patch, body: { schema: updateProjectRequestSchema, value: patch } },
55
+ options?.signal
56
+ ),
57
+ archive: (options) => project(
58
+ {
59
+ method: HttpMethod.Post,
60
+ suffix: "/archive",
61
+ body: { schema: emptyBodySchema, value: {} }
62
+ },
63
+ options?.signal
64
+ ),
65
+ unarchive: (options) => project(
66
+ {
67
+ method: HttpMethod.Post,
68
+ suffix: "/unarchive",
69
+ body: { schema: emptyBodySchema, value: {} }
70
+ },
71
+ options?.signal
72
+ ),
73
+ movePreview: (options) => http.request({
74
+ method: HttpMethod.Get,
75
+ path: path("/move-preview"),
76
+ query: { parentId: options?.parentId ?? void 0 },
77
+ response: projectMovePreviewSchema,
78
+ signal: options?.signal
79
+ }),
80
+ move: ({ signal, ...value }) => project(
81
+ {
82
+ method: HttpMethod.Post,
83
+ suffix: "/move",
84
+ body: { schema: moveProjectRequestSchema, value }
85
+ },
86
+ signal
87
+ ),
88
+ members: {
89
+ list: async (options) => (await http.request({
90
+ method: HttpMethod.Get,
91
+ path: path("/members"),
92
+ response: projectMemberListSchema,
93
+ signal: options?.signal
94
+ })).members,
95
+ add: async ({ signal, ...value }) => (await http.request({
96
+ method: HttpMethod.Post,
97
+ path: path("/members"),
98
+ body: { schema: addProjectMemberRequestSchema, value },
99
+ response: projectMemberResponseSchema,
100
+ signal
101
+ })).member,
102
+ update: async ({ memberId, role, signal }) => (await http.request({
103
+ method: HttpMethod.Patch,
104
+ path: memberPath(memberId),
105
+ body: { schema: updateProjectMemberRequestSchema, value: { role } },
106
+ response: projectMemberResponseSchema,
107
+ signal
108
+ })).member,
109
+ remove: async ({ memberId, signal }) => {
110
+ await http.request({
111
+ method: HttpMethod.Delete,
112
+ path: memberPath(memberId),
113
+ response: okResponseSchema,
114
+ signal
115
+ });
116
+ }
117
+ },
118
+ apiKeys: {
119
+ create: ({ signal, ...value }) => http.request({
120
+ method: HttpMethod.Post,
121
+ path: path("/api-keys"),
122
+ body: { schema: createApiKeyRequestSchema, value },
123
+ response: createApiKeyResponseSchema,
124
+ signal
125
+ }),
126
+ list: async (options) => (await http.request({
127
+ method: HttpMethod.Get,
128
+ path: path("/api-keys"),
129
+ response: apiKeyListSchema,
130
+ signal: options?.signal
131
+ })).apiKeys,
132
+ delete: async ({ id, signal }) => (await http.request({
133
+ method: HttpMethod.Delete,
134
+ path: path(`/api-keys/${encodePath(id)}`),
135
+ response: deleteApiKeyResponseSchema,
136
+ signal
137
+ })).deleted
138
+ }
139
+ };
140
+ };
141
+ export {
142
+ createProjectResourceApi,
143
+ createProjectsApi
144
+ };
145
+ //# sourceMappingURL=projects.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/agent-client/projects.ts"],
4
+ "sourcesContent": ["import {\n addProjectMemberRequestSchema,\n apiKeyListSchema,\n createApiKeyRequestSchema,\n createApiKeyResponseSchema,\n createProjectRequestSchema,\n deleteApiKeyResponseSchema,\n moveProjectRequestSchema,\n okResponseSchema,\n projectListSchema,\n projectMemberListSchema,\n projectMemberResponseSchema,\n projectMovePreviewSchema,\n projectResponseSchema,\n updateProjectMemberRequestSchema,\n updateProjectRequestSchema,\n type AddProjectMemberRequestIface,\n type ApiKeyIface,\n type CreateApiKeyRequestIface,\n type CreateApiKeyResponseIface,\n type CreateProjectRequestIface,\n type ProjectIface,\n type ProjectMemberIface,\n type ProjectMovePreviewIface,\n type ProjectRole,\n type UpdateProjectRequestIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport * as z from 'zod';\nimport {\n encodePath,\n type ClientContextIface,\n type EnumInput,\n type SignalOptionsIface,\n} from \"./context.mjs\";\nimport { HttpMethod, type HttpBodyIface } from \"./http.mjs\";\n\n// Projects as a resource: the tree itself, its members and its API keys.\n\nexport interface ProjectsApiIface {\n /** Every project the caller can see, or the children of `parentId`. */\n list: (\n options?: SignalOptionsIface & { parentId?: string; includeArchived?: boolean },\n ) => Promise<ProjectIface[]>;\n /** Creates a project; open it with `client.project({ id })`. */\n create: (args: CreateProjectRequestIface & SignalOptionsIface) => Promise<ProjectIface>;\n}\n\nexport interface ProjectMembersApiIface {\n /** Everyone with a role here, inherited roles included. */\n list: (options?: SignalOptionsIface) => Promise<ProjectMemberIface[]>;\n /** Grants a person or an API key a role here; never more than the caller's own. */\n add: (\n args: Omit<AddProjectMemberRequestIface, 'role'> & {\n role: EnumInput<ProjectRole>;\n } & SignalOptionsIface,\n ) => Promise<ProjectMemberIface>;\n /** `memberId` is the member's user (`usr_...`) or API key (`ak_...`) id. */\n update: (\n args: { memberId: string; role: EnumInput<ProjectRole> } & SignalOptionsIface,\n ) => Promise<ProjectMemberIface>;\n remove: (args: { memberId: string } & SignalOptionsIface) => Promise<void>;\n}\n\nexport interface ProjectApiKeysApiIface {\n /** Creates a key acting in this project; its `value` is returned only here. */\n create: (\n args: CreateApiKeyRequestIface & SignalOptionsIface,\n ) => Promise<CreateApiKeyResponseIface>;\n list: (options?: SignalOptionsIface) => Promise<ApiKeyIface[]>;\n delete: (args: { id: string } & SignalOptionsIface) => Promise<boolean>;\n}\n\nexport interface ProjectResourceApiIface {\n /** The project itself, with the caller's effective role. */\n info: (options?: SignalOptionsIface) => Promise<ProjectIface>;\n update: (patch: UpdateProjectRequestIface, options?: SignalOptionsIface) => Promise<ProjectIface>;\n archive: (options?: SignalOptionsIface) => Promise<ProjectIface>;\n unarchive: (options?: SignalOptionsIface) => Promise<ProjectIface>;\n /**\n * Who would gain and lose a role if the project moved under `parentId`\n * (omitted or null: the top of the organization). Pass its fingerprint to `move`.\n */\n movePreview: (\n args?: { parentId?: string | null } & SignalOptionsIface,\n ) => Promise<ProjectMovePreviewIface>;\n /** Refused if access would now change differently from the preview `fingerprint` came from. */\n move: (\n args: { parentId: string | null; fingerprint: string } & SignalOptionsIface,\n ) => Promise<ProjectIface>;\n members: ProjectMembersApiIface;\n apiKeys: ProjectApiKeysApiIface;\n}\n\nconst emptyBodySchema = z.strictObject({});\n\nexport const createProjectsApi = (context: ClientContextIface): ProjectsApiIface => ({\n list: async (options) =>\n (\n await context.http.request({\n method: HttpMethod.Get,\n path: '/v1/projects',\n query: { parentId: options?.parentId, includeArchived: options?.includeArchived },\n response: projectListSchema,\n signal: options?.signal,\n })\n ).projects,\n create: async ({ signal, ...value }) =>\n (\n await context.http.request({\n method: HttpMethod.Post,\n path: '/v1/projects',\n body: { schema: createProjectRequestSchema, value },\n response: projectResponseSchema,\n signal,\n })\n ).project,\n});\n\nexport const createProjectResourceApi = (args: {\n context: ClientContextIface;\n projectId: string;\n}): ProjectResourceApiIface => {\n const { http } = args.context;\n const path = (suffix = ''): string => `/v1/projects/${encodePath(args.projectId)}${suffix}`;\n const project = async (\n request: { method: HttpMethod; suffix?: string; body?: HttpBodyIface },\n signal: AbortSignal | undefined,\n ): Promise<ProjectIface> =>\n (\n await http.request({\n method: request.method,\n path: path(request.suffix),\n body: request.body,\n response: projectResponseSchema,\n signal,\n })\n ).project;\n const memberPath = (memberId: string): string => path(`/members/${encodePath(memberId)}`);\n return {\n info: (options) => project({ method: HttpMethod.Get }, options?.signal),\n update: (patch, options) =>\n project(\n { method: HttpMethod.Patch, body: { schema: updateProjectRequestSchema, value: patch } },\n options?.signal,\n ),\n archive: (options) =>\n project(\n {\n method: HttpMethod.Post,\n suffix: '/archive',\n body: { schema: emptyBodySchema, value: {} },\n },\n options?.signal,\n ),\n unarchive: (options) =>\n project(\n {\n method: HttpMethod.Post,\n suffix: '/unarchive',\n body: { schema: emptyBodySchema, value: {} },\n },\n options?.signal,\n ),\n movePreview: (options) =>\n http.request({\n method: HttpMethod.Get,\n path: path('/move-preview'),\n query: { parentId: options?.parentId ?? undefined },\n response: projectMovePreviewSchema,\n signal: options?.signal,\n }),\n move: ({ signal, ...value }) =>\n project(\n {\n method: HttpMethod.Post,\n suffix: '/move',\n body: { schema: moveProjectRequestSchema, value },\n },\n signal,\n ),\n members: {\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: path('/members'),\n response: projectMemberListSchema,\n signal: options?.signal,\n })\n ).members,\n add: async ({ signal, ...value }) =>\n (\n await http.request({\n method: HttpMethod.Post,\n path: path('/members'),\n body: { schema: addProjectMemberRequestSchema, value },\n response: projectMemberResponseSchema,\n signal,\n })\n ).member,\n update: async ({ memberId, role, signal }) =>\n (\n await http.request({\n method: HttpMethod.Patch,\n path: memberPath(memberId),\n body: { schema: updateProjectMemberRequestSchema, value: { role } },\n response: projectMemberResponseSchema,\n signal,\n })\n ).member,\n remove: async ({ memberId, signal }) => {\n await http.request({\n method: HttpMethod.Delete,\n path: memberPath(memberId),\n response: okResponseSchema,\n signal,\n });\n },\n },\n apiKeys: {\n create: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: path('/api-keys'),\n body: { schema: createApiKeyRequestSchema, value },\n response: createApiKeyResponseSchema,\n signal,\n }),\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: path('/api-keys'),\n response: apiKeyListSchema,\n signal: options?.signal,\n })\n ).apiKeys,\n delete: async ({ id, signal }) =>\n (\n await http.request({\n method: HttpMethod.Delete,\n path: path(`/api-keys/${encodePath(id)}`),\n response: deleteApiKeyResponseSchema,\n signal,\n })\n ).deleted,\n },\n };\n};\n"],
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 -0,0 +1,41 @@
1
+ import { type Capability } from '@finalai/agent-protocol';
2
+ import { type HarnessSettingsIface, type ProvideDocumentIface, type ProvideDocumentViewIface, type ProvideParticipantRequestIface } from '@finalai/agent-protocol/agent-platform';
3
+ /** Anything with the id of a project resource: a handle, or a fetched record. */
4
+ export interface ResourceRefIface {
5
+ readonly id: string;
6
+ }
7
+ export type ResourceRef = string | ResourceRefIface;
8
+ export interface ProvideIface {
9
+ /** Harness settings, inline: `serverlessPi({ model, inference })`. */
10
+ harness?: HarnessSettingsIface;
11
+ /**
12
+ * Capability → the sandbox that provides it. `files` and `shell` must name the
13
+ * same sandbox. A capability left out runs in this process unless the client
14
+ * was created with `localCompute: false`.
15
+ */
16
+ compute?: Partial<Record<Capability | `${Capability}`, ResourceRef>>;
17
+ /** Integration slot → the integration that fills it. */
18
+ integrations?: Record<string, ResourceRef>;
19
+ }
20
+ /** A change to one agent participant's settings; `null` removes a capability or slot. */
21
+ export interface ProvidePatchIface {
22
+ harness?: HarnessSettingsIface;
23
+ compute?: Partial<Record<Capability | `${Capability}`, ResourceRef | null>>;
24
+ integrations?: Record<string, ResourceRef | null>;
25
+ instructions?: string | null;
26
+ tools?: string[] | null;
27
+ /** The settings revision you read; a stale one fails with `conflict`. */
28
+ revision?: number;
29
+ }
30
+ export declare const resourceIdOf: (ref: ResourceRef) => string;
31
+ /** The wire document for `provide`: handles become ids. */
32
+ export declare const provideDocumentOf: (provide: ProvideIface) => ProvideDocumentIface;
33
+ export declare const providePatchOf: (patch: ProvidePatchIface) => ProvideParticipantRequestIface;
34
+ /** A provide document as the server returns it, back in the form calls send. */
35
+ export declare const provideDocumentOfView: (view: ProvideDocumentViewIface) => ProvideDocumentIface;
36
+ /**
37
+ * What an agent is provided, as the platform layers it: the nearest scope that
38
+ * sets a top-level key wins it whole, so compute never mixes sandboxes from
39
+ * two scopes.
40
+ */
41
+ export declare const layerProvide: (own: ProvideDocumentIface, shared: ProvideDocumentIface | null) => ProvideDocumentIface;
@@ -0,0 +1,90 @@
1
+ import { CAPABILITIES } from "@finalai/agent-protocol";
2
+ import {
3
+ harnessSettingsSchema
4
+ } from "@finalai/agent-protocol/agent-platform";
5
+ import { clientError, ClientErrorCode } from "./errors.mjs";
6
+ const resourceIdOf = (ref) => typeof ref === "string" ? ref : ref.id;
7
+ const capabilityOf = (key) => {
8
+ const capability = CAPABILITIES.find((candidate) => candidate === key);
9
+ if (capability == null)
10
+ throw clientError({
11
+ message: `Unknown compute capability ${key}: use ${CAPABILITIES.join(", ")}`,
12
+ status: 0,
13
+ code: ClientErrorCode.InvalidRequest
14
+ });
15
+ return capability;
16
+ };
17
+ const computeIdsOf = (refs) => {
18
+ const ids = {};
19
+ for (const [key, ref] of Object.entries(refs))
20
+ if (ref != null) ids[capabilityOf(key)] = resourceIdOf(ref);
21
+ return ids;
22
+ };
23
+ const computePatchOf = (refs) => {
24
+ const ids = {};
25
+ for (const [key, ref] of Object.entries(refs))
26
+ if (ref !== void 0) ids[capabilityOf(key)] = ref == null ? null : resourceIdOf(ref);
27
+ return ids;
28
+ };
29
+ const slotIdsOf = (refs) => Object.fromEntries(Object.entries(refs).map(([slot, ref]) => [slot, resourceIdOf(ref)]));
30
+ const slotPatchOf = (refs) => Object.fromEntries(
31
+ Object.entries(refs).map(([slot, ref]) => [slot, ref == null ? null : resourceIdOf(ref)])
32
+ );
33
+ const provideDocumentOf = (provide) => ({
34
+ ...provide.harness == null ? {} : { harness: provide.harness },
35
+ ...provide.compute == null ? {} : { compute: computeIdsOf(provide.compute) },
36
+ ...provide.integrations == null ? {} : { integrations: slotIdsOf(provide.integrations) }
37
+ });
38
+ const providePatchOf = (patch) => ({
39
+ ...patch.harness == null ? {} : { harness: patch.harness },
40
+ ...patch.compute == null ? {} : { compute: computePatchOf(patch.compute) },
41
+ ...patch.integrations == null ? {} : { integrations: slotPatchOf(patch.integrations) },
42
+ ...patch.instructions === void 0 ? {} : { instructions: patch.instructions },
43
+ ...patch.tools === void 0 ? {} : { tools: patch.tools },
44
+ ...patch.revision == null ? {} : { revision: patch.revision }
45
+ });
46
+ const harnessOfView = (view) => {
47
+ const environment = view.environment == null ? {} : {
48
+ environment: typeof view.environment === "string" ? view.environment : {
49
+ url: view.environment.url,
50
+ ...view.environment.hop == null ? {} : { hop: view.environment.hop }
51
+ }
52
+ };
53
+ const parsed = harnessSettingsSchema.safeParse({
54
+ harness: view.harness,
55
+ ...view.adapter == null ? {} : { adapter: view.adapter },
56
+ configuration: view.configuration,
57
+ ...environment
58
+ });
59
+ return parsed.success ? parsed.data : { harness: view.harness };
60
+ };
61
+ const provideDocumentOfView = (view) => {
62
+ const compute = {};
63
+ for (const [key, id] of Object.entries(view.compute)) {
64
+ const capability = CAPABILITIES.find((candidate) => candidate === key);
65
+ if (capability != null) compute[capability] = id;
66
+ }
67
+ return {
68
+ ...view.harness == null ? {} : { harness: harnessOfView(view.harness) },
69
+ ...Object.keys(compute).length === 0 ? {} : { compute },
70
+ ...Object.keys(view.integrations).length === 0 ? {} : { integrations: view.integrations }
71
+ };
72
+ };
73
+ const layerProvide = (own, shared) => {
74
+ const harness = own.harness ?? shared?.harness;
75
+ const compute = own.compute ?? shared?.compute;
76
+ const integrations = own.integrations ?? shared?.integrations;
77
+ return {
78
+ ...harness == null ? {} : { harness },
79
+ ...compute == null ? {} : { compute },
80
+ ...integrations == null ? {} : { integrations }
81
+ };
82
+ };
83
+ export {
84
+ layerProvide,
85
+ provideDocumentOf,
86
+ provideDocumentOfView,
87
+ providePatchOf,
88
+ resourceIdOf
89
+ };
90
+ //# sourceMappingURL=provide.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/agent-client/provide.ts"],
4
+ "sourcesContent": ["import { CAPABILITIES, type Capability } from '@finalai/agent-protocol';\nimport {\n harnessSettingsSchema,\n type HarnessSettingsIface,\n type HarnessSettingsViewIface,\n type ProvideDocumentIface,\n type ProvideDocumentViewIface,\n type ProvideParticipantRequestIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport { clientError, ClientErrorCode } from \"./errors.mjs\";\n\n// What a caller provides to meet an agent's requirements, as the SDK accepts\n// it: the wire document, except that a sandbox or an integration may be given\n// as the handle `project.sandboxes.create` or `project.integrations.create`\n// returned. Handles are sent as their ids.\n\n/** Anything with the id of a project resource: a handle, or a fetched record. */\nexport interface ResourceRefIface {\n readonly id: string;\n}\n\nexport type ResourceRef = string | ResourceRefIface;\n\nexport interface ProvideIface {\n /** Harness settings, inline: `serverlessPi({ model, inference })`. */\n harness?: HarnessSettingsIface;\n /**\n * Capability \u2192 the sandbox that provides it. `files` and `shell` must name the\n * same sandbox. A capability left out runs in this process unless the client\n * was created with `localCompute: false`.\n */\n compute?: Partial<Record<Capability | `${Capability}`, ResourceRef>>;\n /** Integration slot \u2192 the integration that fills it. */\n integrations?: Record<string, ResourceRef>;\n}\n\n/** A change to one agent participant's settings; `null` removes a capability or slot. */\nexport interface ProvidePatchIface {\n harness?: HarnessSettingsIface;\n compute?: Partial<Record<Capability | `${Capability}`, ResourceRef | null>>;\n integrations?: Record<string, ResourceRef | null>;\n instructions?: string | null;\n tools?: string[] | null;\n /** The settings revision you read; a stale one fails with `conflict`. */\n revision?: number;\n}\n\nexport const resourceIdOf = (ref: ResourceRef): string => (typeof ref === 'string' ? ref : ref.id);\n\nconst capabilityOf = (key: string): Capability => {\n const capability = CAPABILITIES.find((candidate) => candidate === key);\n if (capability == null)\n throw clientError({\n message: `Unknown compute capability ${key}: use ${CAPABILITIES.join(', ')}`,\n status: 0,\n code: ClientErrorCode.InvalidRequest,\n });\n return capability;\n};\n\nconst computeIdsOf = (\n refs: Partial<Record<string, ResourceRef>>,\n): Partial<Record<Capability, string>> => {\n const ids: Partial<Record<Capability, string>> = {};\n for (const [key, ref] of Object.entries(refs))\n if (ref != null) ids[capabilityOf(key)] = resourceIdOf(ref);\n return ids;\n};\n\nconst computePatchOf = (\n refs: Partial<Record<string, ResourceRef | null>>,\n): Partial<Record<Capability, string | null>> => {\n const ids: Partial<Record<Capability, string | null>> = {};\n for (const [key, ref] of Object.entries(refs))\n if (ref !== undefined) ids[capabilityOf(key)] = ref == null ? null : resourceIdOf(ref);\n return ids;\n};\n\nconst slotIdsOf = (refs: Record<string, ResourceRef>): Record<string, string> =>\n Object.fromEntries(Object.entries(refs).map(([slot, ref]) => [slot, resourceIdOf(ref)]));\n\nconst slotPatchOf = (refs: Record<string, ResourceRef | null>): Record<string, string | null> =>\n Object.fromEntries(\n Object.entries(refs).map(([slot, ref]) => [slot, ref == null ? null : resourceIdOf(ref)]),\n );\n\n/** The wire document for `provide`: handles become ids. */\nexport const provideDocumentOf = (provide: ProvideIface): ProvideDocumentIface => ({\n ...(provide.harness == null ? {} : { harness: provide.harness }),\n ...(provide.compute == null ? {} : { compute: computeIdsOf(provide.compute) }),\n ...(provide.integrations == null ? {} : { integrations: slotIdsOf(provide.integrations) }),\n});\n\nexport const providePatchOf = (patch: ProvidePatchIface): ProvideParticipantRequestIface => ({\n ...(patch.harness == null ? {} : { harness: patch.harness }),\n ...(patch.compute == null ? {} : { compute: computePatchOf(patch.compute) }),\n ...(patch.integrations == null ? {} : { integrations: slotPatchOf(patch.integrations) }),\n ...(patch.instructions === undefined ? {} : { instructions: patch.instructions }),\n ...(patch.tools === undefined ? {} : { tools: patch.tools }),\n ...(patch.revision == null ? {} : { revision: patch.revision }),\n});\n\n// Settings the SDK cannot read back in full (a newer server's inference\n// source) still name the harness, which is what the local check needs.\nconst harnessOfView = (view: HarnessSettingsViewIface): HarnessSettingsIface => {\n const environment =\n view.environment == null\n ? {}\n : {\n environment:\n typeof view.environment === 'string'\n ? view.environment\n : {\n url: view.environment.url,\n ...(view.environment.hop == null ? {} : { hop: view.environment.hop }),\n },\n };\n const parsed = harnessSettingsSchema.safeParse({\n harness: view.harness,\n ...(view.adapter == null ? {} : { adapter: view.adapter }),\n configuration: view.configuration,\n ...environment,\n });\n return parsed.success ? parsed.data : { harness: view.harness };\n};\n\n/** A provide document as the server returns it, back in the form calls send. */\nexport const provideDocumentOfView = (view: ProvideDocumentViewIface): ProvideDocumentIface => {\n const compute: Partial<Record<Capability, string>> = {};\n for (const [key, id] of Object.entries(view.compute)) {\n const capability = CAPABILITIES.find((candidate) => candidate === key);\n if (capability != null) compute[capability] = id;\n }\n return {\n ...(view.harness == null ? {} : { harness: harnessOfView(view.harness) }),\n ...(Object.keys(compute).length === 0 ? {} : { compute }),\n ...(Object.keys(view.integrations).length === 0 ? {} : { integrations: view.integrations }),\n };\n};\n\n/**\n * What an agent is provided, as the platform layers it: the nearest scope that\n * sets a top-level key wins it whole, so compute never mixes sandboxes from\n * two scopes.\n */\nexport const layerProvide = (\n own: ProvideDocumentIface,\n shared: ProvideDocumentIface | null,\n): ProvideDocumentIface => {\n const harness = own.harness ?? shared?.harness;\n const compute = own.compute ?? shared?.compute;\n const integrations = own.integrations ?? shared?.integrations;\n return {\n ...(harness == null ? {} : { harness }),\n ...(compute == null ? {} : { compute }),\n ...(integrations == null ? {} : { integrations }),\n };\n};\n"],
5
+ "mappings": "AAAA,SAAS,oBAAqC;AAC9C;AAAA,EACE;AAAA,OAMK;AACP,SAAS,aAAa,uBAAuB;AAsCtC,MAAM,eAAe,CAAC,QAA8B,OAAO,QAAQ,WAAW,MAAM,IAAI;AAE/F,MAAM,eAAe,CAAC,QAA4B;AAChD,QAAM,aAAa,aAAa,KAAK,CAAC,cAAc,cAAc,GAAG;AACrE,MAAI,cAAc;AAChB,UAAM,YAAY;AAAA,MAChB,SAAS,8BAA8B,GAAG,SAAS,aAAa,KAAK,IAAI,CAAC;AAAA,MAC1E,QAAQ;AAAA,MACR,MAAM,gBAAgB;AAAA,IACxB,CAAC;AACH,SAAO;AACT;AAEA,MAAM,eAAe,CACnB,SACwC;AACxC,QAAM,MAA2C,CAAC;AAClD,aAAW,CAAC,KAAK,GAAG,KAAK,OAAO,QAAQ,IAAI;AAC1C,QAAI,OAAO,KAAM,KAAI,aAAa,GAAG,CAAC,IAAI,aAAa,GAAG;A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I,WAAW,QAAQ;AACvC,QAAM,UAAU,IAAI,WAAW,QAAQ;AACvC,QAAM,eAAe,IAAI,gBAAgB,QAAQ;AACjD,SAAO;AAAA,IACL,GAAI,WAAW,OAAO,CAAC,IAAI,EAAE,QAAQ;AAAA,IACrC,GAAI,WAAW,OAAO,CAAC,IAAI,EAAE,QAAQ;AAAA,IACrC,GAAI,gBAAgB,OAAO,CAAC,IAAI,EAAE,aAAa;AAAA,EACjD;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,57 @@
1
+ import { type AcpAdapterDefinitionSummaryIface, type AgentListIface, type ChannelIface, type HarnessDefinitionSummaryIface, type PublicNameIface, type PublicNameKind, type PublisherIface } from '@finalai/agent-protocol/agent-platform';
2
+ import { type ClientContextIface, type EnumInput, type SignalOptionsIface } from "./context.mjs";
3
+ export interface ProjectPublisherApiIface {
4
+ /** Claims the project's handle: first come, once per project, never changed. */
5
+ claim: (args: {
6
+ handle: string;
7
+ } & SignalOptionsIface) => Promise<PublisherIface>;
8
+ /** The project's handle; fails with `not_found` before one is claimed. */
9
+ get: (options?: SignalOptionsIface) => Promise<PublisherIface>;
10
+ }
11
+ export interface PublicNamesApiIface {
12
+ /**
13
+ * Makes a name the project published resolvable as `handle/name`; every later
14
+ * publication under it is public too. Needs the project's publisher handle.
15
+ */
16
+ publish: (args: {
17
+ kind: EnumInput<PublicNameKind>;
18
+ name: string;
19
+ } & SignalOptionsIface) => Promise<PublicNameIface>;
20
+ /** Withdraws a public name; `handle/name` stops resolving. */
21
+ withdraw: (args: {
22
+ kind: EnumInput<PublicNameKind>;
23
+ name: string;
24
+ } & SignalOptionsIface) => Promise<void>;
25
+ }
26
+ export interface PublisherHandleIface {
27
+ readonly handle: string;
28
+ info: (options?: SignalOptionsIface) => Promise<PublisherIface>;
29
+ agents: {
30
+ list: (options?: SignalOptionsIface & {
31
+ cursor?: string;
32
+ limit?: number;
33
+ }) => Promise<AgentListIface>;
34
+ };
35
+ channels: {
36
+ list: (options?: SignalOptionsIface) => Promise<ChannelIface[]>;
37
+ };
38
+ harnesses: {
39
+ list: (options?: SignalOptionsIface) => Promise<HarnessDefinitionSummaryIface[]>;
40
+ };
41
+ adapters: {
42
+ list: (options?: SignalOptionsIface) => Promise<AcpAdapterDefinitionSummaryIface[]>;
43
+ };
44
+ }
45
+ export interface PublishersApiIface {
46
+ /** A publisher's public names (I/O-free handle). */
47
+ get: (handle: string) => PublisherHandleIface;
48
+ }
49
+ export declare const createProjectPublisherApi: (args: {
50
+ context: ClientContextIface;
51
+ projectId: string;
52
+ }) => ProjectPublisherApiIface;
53
+ export declare const createPublicNamesApi: (args: {
54
+ context: ClientContextIface;
55
+ projectId: string;
56
+ }) => PublicNamesApiIface;
57
+ export declare const createPublishersApi: (context: ClientContextIface) => PublishersApiIface;
@@ -0,0 +1,109 @@
1
+ import {
2
+ acpAdapterDefinitionListSchema,
3
+ agentListSchema,
4
+ channelListSchema,
5
+ claimPublisherRequestSchema,
6
+ harnessDefinitionListSchema,
7
+ okResponseSchema,
8
+ publicNameSchema,
9
+ publisherSchema,
10
+ publishNameRequestSchema
11
+ } from "@finalai/agent-protocol/agent-platform";
12
+ import {
13
+ encodePath
14
+ } from "./context.mjs";
15
+ import { HttpMethod } from "./http.mjs";
16
+ const createProjectPublisherApi = (args) => {
17
+ const { http } = args.context;
18
+ const path = `/v1/projects/${encodePath(args.projectId)}/publisher`;
19
+ return {
20
+ claim: ({ handle, signal }) => http.request({
21
+ method: HttpMethod.Put,
22
+ path,
23
+ body: { schema: claimPublisherRequestSchema, value: { handle } },
24
+ response: publisherSchema,
25
+ signal
26
+ }),
27
+ get: (options) => http.request({
28
+ method: HttpMethod.Get,
29
+ path,
30
+ response: publisherSchema,
31
+ signal: options?.signal
32
+ })
33
+ };
34
+ };
35
+ const createPublicNamesApi = (args) => {
36
+ const { http } = args.context;
37
+ const path = (kind, name) => `/v1/projects/${encodePath(args.projectId)}/public-names/${encodePath(kind)}/${encodePath(name)}`;
38
+ return {
39
+ publish: ({ kind, name, signal }) => http.request({
40
+ method: HttpMethod.Put,
41
+ path: path(kind, name),
42
+ body: { schema: publishNameRequestSchema, value: {} },
43
+ response: publicNameSchema,
44
+ signal
45
+ }),
46
+ withdraw: async ({ kind, name, signal }) => {
47
+ await http.request({
48
+ method: HttpMethod.Delete,
49
+ path: path(kind, name),
50
+ response: okResponseSchema,
51
+ signal
52
+ });
53
+ }
54
+ };
55
+ };
56
+ const createPublishersApi = (context) => ({
57
+ get: (handle) => {
58
+ const { http } = context;
59
+ const path = (suffix = "") => `/v1/publishers/${encodePath(handle)}${suffix}`;
60
+ return {
61
+ handle,
62
+ info: (options) => http.request({
63
+ method: HttpMethod.Get,
64
+ path: path(),
65
+ response: publisherSchema,
66
+ signal: options?.signal
67
+ }),
68
+ agents: {
69
+ list: (options) => http.request({
70
+ method: HttpMethod.Get,
71
+ path: path("/agents"),
72
+ query: { cursor: options?.cursor, limit: options?.limit },
73
+ response: agentListSchema,
74
+ signal: options?.signal
75
+ })
76
+ },
77
+ channels: {
78
+ list: async (options) => (await http.request({
79
+ method: HttpMethod.Get,
80
+ path: path("/channels"),
81
+ response: channelListSchema,
82
+ signal: options?.signal
83
+ })).channels
84
+ },
85
+ harnesses: {
86
+ list: async (options) => (await http.request({
87
+ method: HttpMethod.Get,
88
+ path: path("/harnesses"),
89
+ response: harnessDefinitionListSchema,
90
+ signal: options?.signal
91
+ })).harnesses
92
+ },
93
+ adapters: {
94
+ list: async (options) => (await http.request({
95
+ method: HttpMethod.Get,
96
+ path: path("/acp-adapters"),
97
+ response: acpAdapterDefinitionListSchema,
98
+ signal: options?.signal
99
+ })).adapters
100
+ }
101
+ };
102
+ }
103
+ });
104
+ export {
105
+ createProjectPublisherApi,
106
+ createPublicNamesApi,
107
+ createPublishersApi
108
+ };
109
+ //# sourceMappingURL=publishers.mjs.map