@finalai/agents 0.13.0 → 0.15.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 (48) hide show
  1. package/README.md +7 -1
  2. package/dist/modules/agent-client/api.d.mts +35 -0
  3. package/dist/modules/agent-client/api.mjs +110 -0
  4. package/dist/modules/agent-client/api.mjs.map +7 -0
  5. package/dist/modules/agent-client/channels.mjs +9 -1
  6. package/dist/modules/agent-client/channels.mjs.map +2 -2
  7. package/dist/modules/agent-client/client.d.mts +29 -7
  8. package/dist/modules/agent-client/client.mjs +15 -12
  9. package/dist/modules/agent-client/client.mjs.map +2 -2
  10. package/dist/modules/agent-client/conversations.d.mts +17 -25
  11. package/dist/modules/agent-client/conversations.mjs +10 -62
  12. package/dist/modules/agent-client/conversations.mjs.map +2 -2
  13. package/dist/modules/agent-client/defaults.d.mts +0 -4
  14. package/dist/modules/agent-client/defaults.mjs +1 -52
  15. package/dist/modules/agent-client/defaults.mjs.map +2 -2
  16. package/dist/modules/agent-client/index.d.mts +2 -33
  17. package/dist/modules/agent-client/index.mjs +3 -109
  18. package/dist/modules/agent-client/index.mjs.map +2 -2
  19. package/dist/modules/agent-client/integrations.d.mts +5 -1
  20. package/dist/modules/agent-client/integrations.mjs +9 -1
  21. package/dist/modules/agent-client/integrations.mjs.map +2 -2
  22. package/dist/modules/agent-client/node.d.mts +2 -0
  23. package/dist/modules/agent-client/node.mjs +62 -0
  24. package/dist/modules/agent-client/node.mjs.map +7 -0
  25. package/dist/modules/agent-client/organization.d.mts +83 -0
  26. package/dist/modules/agent-client/organization.mjs +209 -0
  27. package/dist/modules/agent-client/organization.mjs.map +7 -0
  28. package/dist/modules/agent-client/participant-configuration.d.mts +21 -0
  29. package/dist/modules/agent-client/participant-configuration.mjs +38 -0
  30. package/dist/modules/agent-client/participant-configuration.mjs.map +7 -0
  31. package/dist/modules/agent-client/portable.d.mts +3 -0
  32. package/dist/modules/agent-client/portable.mjs +28 -0
  33. package/dist/modules/agent-client/portable.mjs.map +7 -0
  34. package/dist/modules/agent-client/project.d.mts +3 -0
  35. package/dist/modules/agent-client/project.mjs +3 -1
  36. package/dist/modules/agent-client/project.mjs.map +2 -2
  37. package/dist/modules/agent-client/provide.d.mts +0 -1
  38. package/dist/modules/agent-client/provide.mjs +0 -1
  39. package/dist/modules/agent-client/provide.mjs.map +2 -2
  40. package/dist/modules/agent-client/sandboxes.d.mts +8 -1
  41. package/dist/modules/agent-client/sandboxes.mjs +9 -0
  42. package/dist/modules/agent-client/sandboxes.mjs.map +2 -2
  43. package/dist/modules/agent-client/sessions.d.mts +8 -1
  44. package/dist/modules/agent-client/sessions.mjs +24 -5
  45. package/dist/modules/agent-client/sessions.mjs.map +2 -2
  46. package/dist/modules/cli/cli.mjs +2 -1
  47. package/dist/modules/cli/cli.mjs.map +2 -2
  48. package/package.json +7 -6
@@ -0,0 +1,209 @@
1
+ import {
2
+ addAllowedEndpointRequestSchema,
3
+ allowedEndpointSchema,
4
+ budgetListSchema,
5
+ budgetSchema,
6
+ chatGptSubscriptionChallengeSchema,
7
+ chatGptSubscriptionPollSchema,
8
+ connectApiKeyRequestSchema,
9
+ connectClaudeSubscriptionRequestSchema,
10
+ createBudgetRequestSchema,
11
+ createModelCredentialGrantRequestSchema,
12
+ listAllowedEndpointsResponseSchema,
13
+ modelCredentialGrantListSchema,
14
+ modelCredentialGrantSchema,
15
+ modelCredentialListSchema,
16
+ modelCredentialSchema,
17
+ okResponseSchema,
18
+ organizationAgentPolicySchema,
19
+ platformSpendingRestrictionsSchema,
20
+ pollChatGptSubscriptionRequestSchema,
21
+ startChatGptSubscriptionRequestSchema,
22
+ updateModelCredentialRequestSchema,
23
+ updateOrganizationAgentPolicyRequestSchema,
24
+ updatePlatformSpendingRestrictionsRequestSchema
25
+ } from "@finalai/agent-protocol/agent-platform";
26
+ import { encodePath } from "./context.mjs";
27
+ import { HttpMethod } from "./http.mjs";
28
+ const credentialPath = (credentialId, suffix = "") => `/v1/model-credentials/${encodePath(credentialId)}${suffix}`;
29
+ const createModelCredentialsApi = ({ http }) => ({
30
+ list: async (options) => (await http.request({
31
+ method: HttpMethod.Get,
32
+ path: "/v1/model-credentials",
33
+ query: { projectId: options?.projectId },
34
+ response: modelCredentialListSchema,
35
+ signal: options?.signal
36
+ })).credentials,
37
+ connectApiKey: ({ signal, ...value }) => http.request({
38
+ method: HttpMethod.Post,
39
+ path: "/v1/model-credentials",
40
+ body: { schema: connectApiKeyRequestSchema, value },
41
+ response: modelCredentialSchema,
42
+ signal
43
+ }),
44
+ connectClaudeSubscription: ({ signal, ...value }) => http.request({
45
+ method: HttpMethod.Post,
46
+ path: "/v1/model-credentials/subscriptions/claude",
47
+ body: { schema: connectClaudeSubscriptionRequestSchema, value },
48
+ response: modelCredentialSchema,
49
+ signal
50
+ }),
51
+ startChatGptSubscription: ({ signal, ...value }) => http.request({
52
+ method: HttpMethod.Post,
53
+ path: "/v1/model-credentials/subscriptions/chatgpt/start",
54
+ body: { schema: startChatGptSubscriptionRequestSchema, value },
55
+ response: chatGptSubscriptionChallengeSchema,
56
+ signal
57
+ }),
58
+ pollChatGptSubscription: ({ signal, ...value }) => http.request({
59
+ method: HttpMethod.Post,
60
+ path: "/v1/model-credentials/subscriptions/chatgpt/poll",
61
+ body: { schema: pollChatGptSubscriptionRequestSchema, value },
62
+ response: chatGptSubscriptionPollSchema,
63
+ signal
64
+ }),
65
+ update: ({ credentialId, signal, ...value }) => http.request({
66
+ method: HttpMethod.Patch,
67
+ path: credentialPath(credentialId),
68
+ body: { schema: updateModelCredentialRequestSchema, value },
69
+ response: modelCredentialSchema,
70
+ signal
71
+ }),
72
+ resetUsage: ({ credentialId, signal }) => http.request({
73
+ method: HttpMethod.Patch,
74
+ path: credentialPath(credentialId),
75
+ body: { schema: updateModelCredentialRequestSchema, value: { resetUsage: true } },
76
+ response: modelCredentialSchema,
77
+ signal
78
+ }),
79
+ disconnect: async ({ credentialId, signal }) => {
80
+ await http.request({
81
+ method: HttpMethod.Delete,
82
+ path: credentialPath(credentialId),
83
+ response: okResponseSchema,
84
+ signal
85
+ });
86
+ },
87
+ grants: {
88
+ list: async ({ credentialId, signal }) => (await http.request({
89
+ method: HttpMethod.Get,
90
+ path: credentialPath(credentialId, "/grants"),
91
+ response: modelCredentialGrantListSchema,
92
+ signal
93
+ })).grants,
94
+ create: ({ credentialId, signal, ...value }) => http.request({
95
+ method: HttpMethod.Post,
96
+ path: credentialPath(credentialId, "/grants"),
97
+ body: { schema: createModelCredentialGrantRequestSchema, value },
98
+ response: modelCredentialGrantSchema,
99
+ signal
100
+ }),
101
+ revoke: async ({ credentialId, grantId, signal }) => {
102
+ await http.request({
103
+ method: HttpMethod.Delete,
104
+ path: credentialPath(credentialId, `/grants/${encodePath(grantId)}`),
105
+ response: okResponseSchema,
106
+ signal
107
+ });
108
+ }
109
+ }
110
+ });
111
+ const createBudgetsApi = ({ http }) => ({
112
+ list: async (options) => (await http.request({
113
+ method: HttpMethod.Get,
114
+ path: "/v1/budgets",
115
+ response: budgetListSchema,
116
+ signal: options?.signal
117
+ })).budgets,
118
+ create: ({ signal, ...value }) => http.request({
119
+ method: HttpMethod.Post,
120
+ path: "/v1/budgets",
121
+ body: { schema: createBudgetRequestSchema, value },
122
+ response: budgetSchema,
123
+ signal
124
+ }),
125
+ update: ({ budgetId, signal, ...value }) => http.request({
126
+ method: HttpMethod.Put,
127
+ path: `/v1/budgets/${encodePath(budgetId)}`,
128
+ body: { schema: createBudgetRequestSchema, value },
129
+ response: budgetSchema,
130
+ signal
131
+ }),
132
+ delete: async ({ budgetId, signal }) => {
133
+ await http.request({
134
+ method: HttpMethod.Delete,
135
+ path: `/v1/budgets/${encodePath(budgetId)}`,
136
+ response: okResponseSchema,
137
+ signal
138
+ });
139
+ }
140
+ });
141
+ const createOrganizationApi = (context) => {
142
+ const { http } = context;
143
+ return {
144
+ modelCredentials: createModelCredentialsApi(context),
145
+ budgets: createBudgetsApi(context),
146
+ policy: {
147
+ get: (options) => http.request({
148
+ method: HttpMethod.Get,
149
+ path: "/v1/organization-policy",
150
+ response: organizationAgentPolicySchema,
151
+ signal: options?.signal
152
+ }),
153
+ update: ({ signal, ...value }) => http.request({
154
+ method: HttpMethod.Put,
155
+ path: "/v1/organization-policy",
156
+ body: { schema: updateOrganizationAgentPolicyRequestSchema, value },
157
+ response: organizationAgentPolicySchema,
158
+ signal
159
+ })
160
+ },
161
+ spendingRestrictions: {
162
+ get: (options) => http.request({
163
+ method: HttpMethod.Get,
164
+ path: "/v1/platform-spending-restrictions",
165
+ response: platformSpendingRestrictionsSchema,
166
+ signal: options?.signal
167
+ }),
168
+ update: ({ signal, ...value }) => http.request({
169
+ method: HttpMethod.Put,
170
+ path: "/v1/platform-spending-restrictions",
171
+ body: { schema: updatePlatformSpendingRestrictionsRequestSchema, value },
172
+ response: platformSpendingRestrictionsSchema,
173
+ signal
174
+ })
175
+ }
176
+ };
177
+ };
178
+ const createAllowedEndpointsApi = (args) => {
179
+ const { http } = args.context;
180
+ const path = (suffix = "") => `/v1/projects/${encodePath(args.projectId)}/allowed-endpoints${suffix}`;
181
+ return {
182
+ list: async (options) => (await http.request({
183
+ method: HttpMethod.Get,
184
+ path: path(),
185
+ response: listAllowedEndpointsResponseSchema,
186
+ signal: options?.signal
187
+ })).endpoints,
188
+ add: ({ signal, ...value }) => http.request({
189
+ method: HttpMethod.Post,
190
+ path: path(),
191
+ body: { schema: addAllowedEndpointRequestSchema, value },
192
+ response: allowedEndpointSchema,
193
+ signal
194
+ }),
195
+ remove: async ({ endpointId, signal }) => {
196
+ await http.request({
197
+ method: HttpMethod.Delete,
198
+ path: path(`/${encodePath(endpointId)}`),
199
+ response: okResponseSchema,
200
+ signal
201
+ });
202
+ }
203
+ };
204
+ };
205
+ export {
206
+ createAllowedEndpointsApi,
207
+ createOrganizationApi
208
+ };
209
+ //# sourceMappingURL=organization.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/agent-client/organization.ts"],
4
+ "sourcesContent": ["import {\n addAllowedEndpointRequestSchema,\n allowedEndpointSchema,\n budgetListSchema,\n budgetSchema,\n chatGptSubscriptionChallengeSchema,\n chatGptSubscriptionPollSchema,\n connectApiKeyRequestSchema,\n connectClaudeSubscriptionRequestSchema,\n createBudgetRequestSchema,\n createModelCredentialGrantRequestSchema,\n listAllowedEndpointsResponseSchema,\n modelCredentialGrantListSchema,\n modelCredentialGrantSchema,\n modelCredentialListSchema,\n modelCredentialSchema,\n okResponseSchema,\n organizationAgentPolicySchema,\n platformSpendingRestrictionsSchema,\n pollChatGptSubscriptionRequestSchema,\n startChatGptSubscriptionRequestSchema,\n updateModelCredentialRequestSchema,\n updateOrganizationAgentPolicyRequestSchema,\n updatePlatformSpendingRestrictionsRequestSchema,\n type AddAllowedEndpointRequestIface,\n type AllowedEndpointIface,\n type BudgetIface,\n type ChatGptSubscriptionChallengeIface,\n type ChatGptSubscriptionPollIface,\n type ConnectApiKeyRequestIface,\n type ConnectClaudeSubscriptionRequestIface,\n type CreateBudgetRequestIface,\n type CreateModelCredentialGrantRequestIface,\n type ModelCredentialGrantIface,\n type ModelCredentialIface,\n type OrganizationAgentPolicyIface,\n type PlatformSpendingRestrictionsIface,\n type StartChatGptSubscriptionRequestIface,\n type UpdateModelCredentialRequestIface,\n type UpdateOrganizationAgentPolicyRequestIface,\n type UpdatePlatformSpendingRestrictionsRequestIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport { encodePath, type ClientContextIface, type SignalOptionsIface } from \"./context.mjs\";\nimport { HttpMethod } from \"./http.mjs\";\n\nexport interface ModelCredentialGrantsApiIface {\n list: (\n args: { credentialId: string } & SignalOptionsIface,\n ) => Promise<ModelCredentialGrantIface[]>;\n /** Shares the credential with a project or a member; idempotent per grantee. */\n create: (\n args: { credentialId: string } & CreateModelCredentialGrantRequestIface & SignalOptionsIface,\n ) => Promise<ModelCredentialGrantIface>;\n revoke: (args: { credentialId: string; grantId: string } & SignalOptionsIface) => Promise<void>;\n}\n\n/** The subscriptions and API keys the caller's projects run models with. */\nexport interface ModelCredentialsApiIface {\n /** The caller's credentials; with `projectId`, that project's and those it inherits. */\n list: (options?: { projectId?: string } & SignalOptionsIface) => Promise<ModelCredentialIface[]>;\n connectApiKey: (\n args: ConnectApiKeyRequestIface & SignalOptionsIface,\n ) => Promise<ModelCredentialIface>;\n connectClaudeSubscription: (\n args: ConnectClaudeSubscriptionRequestIface & SignalOptionsIface,\n ) => Promise<ModelCredentialIface>;\n /** Starts a device-code sign-in; poll it with the returned `state`. */\n startChatGptSubscription: (\n args: StartChatGptSubscriptionRequestIface & SignalOptionsIface,\n ) => Promise<ChatGptSubscriptionChallengeIface>;\n pollChatGptSubscription: (\n args: { state: string } & SignalOptionsIface,\n ) => Promise<ChatGptSubscriptionPollIface>;\n /** The owner's settings (an editor of the credential's project). */\n update: (\n args: { credentialId: string } & UpdateModelCredentialRequestIface & SignalOptionsIface,\n ) => Promise<ModelCredentialIface>;\n /** Clears a subscription's remembered limit after the vendor reset it. */\n resetUsage: (\n args: { credentialId: string } & SignalOptionsIface,\n ) => Promise<ModelCredentialIface>;\n disconnect: (args: { credentialId: string } & SignalOptionsIface) => Promise<void>;\n /** Who else may use a credential (its managers only). */\n grants: ModelCredentialGrantsApiIface;\n}\n\n/** Spend limits; organization admins write them. */\nexport interface BudgetsApiIface {\n list: (options?: SignalOptionsIface) => Promise<BudgetIface[]>;\n create: (args: CreateBudgetRequestIface & SignalOptionsIface) => Promise<BudgetIface>;\n update: (\n args: { budgetId: string } & CreateBudgetRequestIface & SignalOptionsIface,\n ) => Promise<BudgetIface>;\n delete: (args: { budgetId: string } & SignalOptionsIface) => Promise<void>;\n}\n\n/** The organization's provider gates and turn limits; organization admins update it. */\nexport interface OrganizationPolicyApiIface {\n get: (options?: SignalOptionsIface) => Promise<OrganizationAgentPolicyIface>;\n update: (\n args: UpdateOrganizationAgentPolicyRequestIface & SignalOptionsIface,\n ) => Promise<OrganizationAgentPolicyIface>;\n}\n\n/** Who may spend the platform's own metered inference; organization admins update it. */\nexport interface SpendingRestrictionsApiIface {\n get: (options?: SignalOptionsIface) => Promise<PlatformSpendingRestrictionsIface>;\n update: (\n args: UpdatePlatformSpendingRestrictionsRequestIface & SignalOptionsIface,\n ) => Promise<PlatformSpendingRestrictionsIface>;\n}\n\n/** The caller's organization: model credentials, budgets and policies. */\nexport interface OrganizationApiIface {\n modelCredentials: ModelCredentialsApiIface;\n budgets: BudgetsApiIface;\n policy: OrganizationPolicyApiIface;\n spendingRestrictions: SpendingRestrictionsApiIface;\n}\n\n/** Where a project lets its secrets go beyond model vendors' own APIs; its admins change it. */\nexport interface AllowedEndpointsApiIface {\n list: (options?: SignalOptionsIface) => Promise<AllowedEndpointIface[]>;\n add: (args: AddAllowedEndpointRequestIface & SignalOptionsIface) => Promise<AllowedEndpointIface>;\n remove: (args: { endpointId: string } & SignalOptionsIface) => Promise<void>;\n}\n\nconst credentialPath = (credentialId: string, suffix = ''): string =>\n `/v1/model-credentials/${encodePath(credentialId)}${suffix}`;\n\nconst createModelCredentialsApi = ({ http }: ClientContextIface): ModelCredentialsApiIface => ({\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: '/v1/model-credentials',\n query: { projectId: options?.projectId },\n response: modelCredentialListSchema,\n signal: options?.signal,\n })\n ).credentials,\n connectApiKey: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/model-credentials',\n body: { schema: connectApiKeyRequestSchema, value },\n response: modelCredentialSchema,\n signal,\n }),\n connectClaudeSubscription: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/model-credentials/subscriptions/claude',\n body: { schema: connectClaudeSubscriptionRequestSchema, value },\n response: modelCredentialSchema,\n signal,\n }),\n startChatGptSubscription: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/model-credentials/subscriptions/chatgpt/start',\n body: { schema: startChatGptSubscriptionRequestSchema, value },\n response: chatGptSubscriptionChallengeSchema,\n signal,\n }),\n pollChatGptSubscription: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/model-credentials/subscriptions/chatgpt/poll',\n body: { schema: pollChatGptSubscriptionRequestSchema, value },\n response: chatGptSubscriptionPollSchema,\n signal,\n }),\n update: ({ credentialId, signal, ...value }) =>\n http.request({\n method: HttpMethod.Patch,\n path: credentialPath(credentialId),\n body: { schema: updateModelCredentialRequestSchema, value },\n response: modelCredentialSchema,\n signal,\n }),\n resetUsage: ({ credentialId, signal }) =>\n http.request({\n method: HttpMethod.Patch,\n path: credentialPath(credentialId),\n body: { schema: updateModelCredentialRequestSchema, value: { resetUsage: true } },\n response: modelCredentialSchema,\n signal,\n }),\n disconnect: async ({ credentialId, signal }) => {\n await http.request({\n method: HttpMethod.Delete,\n path: credentialPath(credentialId),\n response: okResponseSchema,\n signal,\n });\n },\n grants: {\n list: async ({ credentialId, signal }) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: credentialPath(credentialId, '/grants'),\n response: modelCredentialGrantListSchema,\n signal,\n })\n ).grants,\n create: ({ credentialId, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: credentialPath(credentialId, '/grants'),\n body: { schema: createModelCredentialGrantRequestSchema, value },\n response: modelCredentialGrantSchema,\n signal,\n }),\n revoke: async ({ credentialId, grantId, signal }) => {\n await http.request({\n method: HttpMethod.Delete,\n path: credentialPath(credentialId, `/grants/${encodePath(grantId)}`),\n response: okResponseSchema,\n signal,\n });\n },\n },\n});\n\nconst createBudgetsApi = ({ http }: ClientContextIface): BudgetsApiIface => ({\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: '/v1/budgets',\n response: budgetListSchema,\n signal: options?.signal,\n })\n ).budgets,\n create: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/budgets',\n body: { schema: createBudgetRequestSchema, value },\n response: budgetSchema,\n signal,\n }),\n update: ({ budgetId, signal, ...value }) =>\n http.request({\n method: HttpMethod.Put,\n path: `/v1/budgets/${encodePath(budgetId)}`,\n body: { schema: createBudgetRequestSchema, value },\n response: budgetSchema,\n signal,\n }),\n delete: async ({ budgetId, signal }) => {\n await http.request({\n method: HttpMethod.Delete,\n path: `/v1/budgets/${encodePath(budgetId)}`,\n response: okResponseSchema,\n signal,\n });\n },\n});\n\nexport const createOrganizationApi = (context: ClientContextIface): OrganizationApiIface => {\n const { http } = context;\n return {\n modelCredentials: createModelCredentialsApi(context),\n budgets: createBudgetsApi(context),\n policy: {\n get: (options) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/organization-policy',\n response: organizationAgentPolicySchema,\n signal: options?.signal,\n }),\n update: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Put,\n path: '/v1/organization-policy',\n body: { schema: updateOrganizationAgentPolicyRequestSchema, value },\n response: organizationAgentPolicySchema,\n signal,\n }),\n },\n spendingRestrictions: {\n get: (options) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/platform-spending-restrictions',\n response: platformSpendingRestrictionsSchema,\n signal: options?.signal,\n }),\n update: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Put,\n path: '/v1/platform-spending-restrictions',\n body: { schema: updatePlatformSpendingRestrictionsRequestSchema, value },\n response: platformSpendingRestrictionsSchema,\n signal,\n }),\n },\n };\n};\n\nexport const createAllowedEndpointsApi = (args: {\n context: ClientContextIface;\n projectId: string;\n}): AllowedEndpointsApiIface => {\n const { http } = args.context;\n const path = (suffix = ''): string =>\n `/v1/projects/${encodePath(args.projectId)}/allowed-endpoints${suffix}`;\n return {\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: path(),\n response: listAllowedEndpointsResponseSchema,\n signal: options?.signal,\n })\n ).endpoints,\n add: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: path(),\n body: { schema: addAllowedEndpointRequestSchema, value },\n response: allowedEndpointSchema,\n signal,\n }),\n remove: async ({ endpointId, signal }) => {\n await http.request({\n method: HttpMethod.Delete,\n path: path(`/${encodePath(endpointId)}`),\n response: okResponseSchema,\n signal,\n });\n },\n };\n};\n"],
5
+ "mappings": "AAAA;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,OAkBK;AACP,SAAS,kBAAoE;AAC7E,SAAS,kBAAkB;AAoF3B,MAAM,iBAAiB,CAAC,cAAsB,SAAS,OACrD,yBAAyB,WAAW,YAAY,CAAC,GAAG,MAAM;AAE5D,MAAM,4BAA4B,CAAC,EAAE,KAAK,OAAqD;AAAA,EAC7F,MAAM,OAAO,aAET,MAAM,KAAK,QAAQ;AAAA,IACjB,QAAQ,WAAW;AAAA,IACnB,MAAM;AAAA,IACN,OAAO,EAAE,WAAW,SAAS,UAAU;AAAA,IACvC,UAAU;AAAA,IACV,QAAQ,SAAS;AAAA,EACnB,CAAC,GACD;AAAA,EACJ,eAAe,CAAC,EAAE,QAAQ,GAAG,MAAM,MACjC,KAAK,QAAQ;AAAA,IACX,QAAQ,WAAW;AAAA,IACnB,MAAM;AAAA,IACN,MAAM,EAAE,QAAQ,4BAA4B,MAAM;AAAA,IAClD,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AAAA,EACH,2BAA2B,CAAC,EAAE,QAAQ,GAAG,MAAM,MAC7C,KAAK,QAAQ;AAAA,IACX,QAAQ,WAAW;AAAA,IACnB,MAAM;AAAA,IACN,MAAM,EAAE,QAAQ,wCAAwC,MAAM;AAAA,IAC9D,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AAAA,EACH,0BAA0B,CAAC,EAAE,QAAQ,GAAG,MAAM,MAC5C,KAAK,QAAQ;AAAA,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ACnB,CAAC,GACD;AAAA,IACJ,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,MACvB,KAAK,QAAQ;AAAA,MACX,QAAQ,WAAW;AAAA,MACnB,MAAM,KAAK;AAAA,MACX,MAAM,EAAE,QAAQ,iCAAiC,MAAM;AAAA,MACvD,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AAAA,IACH,QAAQ,OAAO,EAAE,YAAY,OAAO,MAAM;AACxC,YAAM,KAAK,QAAQ;AAAA,QACjB,QAAQ,WAAW;AAAA,QACnB,MAAM,KAAK,IAAI,WAAW,UAAU,CAAC,EAAE;AAAA,QACvC,UAAU;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,21 @@
1
+ import { type ChatChangeProposalIface, type ChatConfigurationViewIface, type ProposeChatChangeRequestIface } from '@finalai/agent-protocol/agent-platform';
2
+ import { type ClientContextIface, type SignalOptionsIface } from "./context.mjs";
3
+ /**
4
+ * An agent participant's settings in this conversation, changed through proposals: one waits
5
+ * for a manager's decision unless the proposer may apply it.
6
+ */
7
+ export interface ParticipantConfigurationApiIface {
8
+ /** The participant's settings, what it is provided, and the open proposals. */
9
+ get: (participantId: string, options?: SignalOptionsIface) => Promise<ChatConfigurationViewIface>;
10
+ /** Proposes a change; proposing the same `requestKey` again returns the first proposal. */
11
+ propose: (participantId: string, request: ProposeChatChangeRequestIface, options?: SignalOptionsIface) => Promise<ChatChangeProposalIface>;
12
+ /** Accepts or declines a proposal (a manager of the conversation). */
13
+ decide: (participantId: string, args: {
14
+ proposalId: string;
15
+ accept: boolean;
16
+ }, options?: SignalOptionsIface) => Promise<ChatChangeProposalIface>;
17
+ }
18
+ export declare const createParticipantConfigurationApi: (args: {
19
+ context: ClientContextIface;
20
+ conversationId: string;
21
+ }) => ParticipantConfigurationApiIface;
@@ -0,0 +1,38 @@
1
+ import {
2
+ chatChangeProposalSchema,
3
+ chatConfigurationViewSchema,
4
+ decideChatChangeRequestSchema,
5
+ proposeChatChangeRequestSchema
6
+ } from "@finalai/agent-protocol/agent-platform";
7
+ import { encodePath } from "./context.mjs";
8
+ import { HttpMethod } from "./http.mjs";
9
+ const createParticipantConfigurationApi = (args) => {
10
+ const { http } = args.context;
11
+ const path = (participantId, suffix = "") => `/v1/conversations/${encodePath(args.conversationId)}/participants/${encodePath(participantId)}/configuration${suffix}`;
12
+ return {
13
+ get: (participantId, options) => http.request({
14
+ method: HttpMethod.Get,
15
+ path: path(participantId),
16
+ response: chatConfigurationViewSchema,
17
+ signal: options?.signal
18
+ }),
19
+ propose: (participantId, request, options) => http.request({
20
+ method: HttpMethod.Post,
21
+ path: path(participantId, "/proposals"),
22
+ body: { schema: proposeChatChangeRequestSchema, value: request },
23
+ response: chatChangeProposalSchema,
24
+ signal: options?.signal
25
+ }),
26
+ decide: (participantId, { proposalId, accept }, options) => http.request({
27
+ method: HttpMethod.Post,
28
+ path: path(participantId, `/proposals/${encodePath(proposalId)}/decision`),
29
+ body: { schema: decideChatChangeRequestSchema, value: { accept } },
30
+ response: chatChangeProposalSchema,
31
+ signal: options?.signal
32
+ })
33
+ };
34
+ };
35
+ export {
36
+ createParticipantConfigurationApi
37
+ };
38
+ //# sourceMappingURL=participant-configuration.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/agent-client/participant-configuration.ts"],
4
+ "sourcesContent": ["import {\n chatChangeProposalSchema,\n chatConfigurationViewSchema,\n decideChatChangeRequestSchema,\n proposeChatChangeRequestSchema,\n type ChatChangeProposalIface,\n type ChatConfigurationViewIface,\n type ProposeChatChangeRequestIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport { encodePath, type ClientContextIface, type SignalOptionsIface } from \"./context.mjs\";\nimport { HttpMethod } from \"./http.mjs\";\n\n/**\n * An agent participant's settings in this conversation, changed through proposals: one waits\n * for a manager's decision unless the proposer may apply it.\n */\nexport interface ParticipantConfigurationApiIface {\n /** The participant's settings, what it is provided, and the open proposals. */\n get: (participantId: string, options?: SignalOptionsIface) => Promise<ChatConfigurationViewIface>;\n /** Proposes a change; proposing the same `requestKey` again returns the first proposal. */\n propose: (\n participantId: string,\n request: ProposeChatChangeRequestIface,\n options?: SignalOptionsIface,\n ) => Promise<ChatChangeProposalIface>;\n /** Accepts or declines a proposal (a manager of the conversation). */\n decide: (\n participantId: string,\n args: { proposalId: string; accept: boolean },\n options?: SignalOptionsIface,\n ) => Promise<ChatChangeProposalIface>;\n}\n\nexport const createParticipantConfigurationApi = (args: {\n context: ClientContextIface;\n conversationId: string;\n}): ParticipantConfigurationApiIface => {\n const { http } = args.context;\n const path = (participantId: string, suffix = ''): string =>\n `/v1/conversations/${encodePath(args.conversationId)}/participants/${encodePath(participantId)}/configuration${suffix}`;\n return {\n get: (participantId, options) =>\n http.request({\n method: HttpMethod.Get,\n path: path(participantId),\n response: chatConfigurationViewSchema,\n signal: options?.signal,\n }),\n propose: (participantId, request, options) =>\n http.request({\n method: HttpMethod.Post,\n path: path(participantId, '/proposals'),\n body: { schema: proposeChatChangeRequestSchema, value: request },\n response: chatChangeProposalSchema,\n signal: options?.signal,\n }),\n decide: (participantId, { proposalId, accept }, options) =>\n http.request({\n method: HttpMethod.Post,\n path: path(participantId, `/proposals/${encodePath(proposalId)}/decision`),\n body: { schema: decideChatChangeRequestSchema, value: { accept } },\n response: chatChangeProposalSchema,\n signal: options?.signal,\n }),\n };\n};\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,kBAAoE;AAC7E,SAAS,kBAAkB;AAuBpB,MAAM,oCAAoC,CAAC,SAGV;AACtC,QAAM,EAAE,KAAK,IAAI,KAAK;AACtB,QAAM,OAAO,CAAC,eAAuB,SAAS,OAC5C,qBAAqB,WAAW,KAAK,cAAc,CAAC,iBAAiB,WAAW,aAAa,CAAC,iBAAiB,MAAM;AACvH,SAAO;AAAA,IACL,KAAK,CAAC,eAAe,YACnB,KAAK,QAAQ;AAAA,MACX,QAAQ,WAAW;AAAA,MACnB,MAAM,KAAK,aAAa;AAAA,MACxB,UAAU;AAAA,MACV,QAAQ,SAAS;AAAA,IACnB,CAAC;AAAA,IACH,SAAS,CAAC,eAAe,SAAS,YAChC,KAAK,QAAQ;AAAA,MACX,QAAQ,WAAW;AAAA,MACnB,MAAM,KAAK,eAAe,YAAY;AAAA,MACtC,MAAM,EAAE,QAAQ,gCAAgC,OAAO,QAAQ;AAAA,MAC/D,UAAU;AAAA,MACV,QAAQ,SAAS;AAAA,IACnB,CAAC;AAAA,IACH,QAAQ,CAAC,eAAe,EAAE,YAAY,OAAO,GAAG,YAC9C,KAAK,QAAQ;AAAA,MACX,QAAQ,WAAW;AAAA,MACnB,MAAM,KAAK,eAAe,cAAc,WAAW,UAAU,CAAC,WAAW;AAAA,MACzE,MAAM,EAAE,QAAQ,+BAA+B,OAAO,EAAE,OAAO,EAAE;AAAA,MACjE,UAAU;AAAA,MACV,QAAQ,SAAS;AAAA,IACnB,CAAC;AAAA,EACL;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ import { type AgentClientIface, type CreateClientOptionsIface } from "./client.mjs";
2
+ export * from "./api.mjs";
3
+ export declare const createClient: (options: CreateClientOptionsIface) => AgentClientIface;
@@ -0,0 +1,28 @@
1
+ import { connectSandboxClient } from "@finalai/agent-provider/sandbox/client";
2
+ import {
3
+ createClientFor
4
+ } from "./client.mjs";
5
+ import { clientError, ClientErrorCode } from "./errors.mjs";
6
+ export * from "./api.mjs";
7
+ const unavailable = (what) => clientError({
8
+ message: `${what} is not available in this runtime: pass createClient({ localHosts }) to serve it`,
9
+ status: 0,
10
+ code: ClientErrorCode.InvalidRequest
11
+ });
12
+ const portableRuntime = {
13
+ localCompute: false,
14
+ compute: () => ({
15
+ sandbox: () => Promise.reject(unavailable("A local sandbox")),
16
+ openSandbox: (endpoint) => connectSandboxClient({
17
+ url: endpoint.url,
18
+ token: endpoint.token,
19
+ expiresAt: endpoint.expiresAt
20
+ })
21
+ }),
22
+ dial: () => () => Promise.reject(unavailable("The local host socket"))
23
+ };
24
+ const createClient = (options) => createClientFor(portableRuntime, options);
25
+ export {
26
+ createClient
27
+ };
28
+ //# sourceMappingURL=portable.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/agent-client/portable.ts"],
4
+ "sourcesContent": ["import { connectSandboxClient } from '@finalai/agent-provider/sandbox/client';\nimport {\n createClientFor,\n type AgentClientIface,\n type ClientRuntimeIface,\n type CreateClientOptionsIface,\n} from \"./client.mjs\";\nimport { clientError, ClientErrorCode } from \"./errors.mjs\";\n\n// `@finalai/agents/client` in browsers, React Native and Workers (the\n// `browser` and `react-native` export conditions): the same API as in Node,\n// with defaults that import nothing Node-only. This process serves no files\n// or shell unless the caller passes `localHosts.compute`, and dials no local\n// host socket unless it passes `localHosts.dial`, since a browser socket\n// cannot carry the client's auth headers.\n\nexport * from \"./api.mjs\";\n\nconst unavailable = (what: string) =>\n clientError({\n message: `${what} is not available in this runtime: pass createClient({ localHosts }) to serve it`,\n status: 0,\n code: ClientErrorCode.InvalidRequest,\n });\n\nconst portableRuntime: ClientRuntimeIface = {\n localCompute: false,\n compute: () => ({\n sandbox: () => Promise.reject(unavailable('A local sandbox')),\n openSandbox: (endpoint) =>\n connectSandboxClient({\n url: endpoint.url,\n token: endpoint.token,\n expiresAt: endpoint.expiresAt,\n }),\n }),\n dial: () => () => Promise.reject(unavailable('The local host socket')),\n};\n\nexport const createClient = (options: CreateClientOptionsIface): AgentClientIface =>\n createClientFor(portableRuntime, options);\n"],
5
+ "mappings": "AAAA,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa,uBAAuB;AAS7C,cAAc;AAEd,MAAM,cAAc,CAAC,SACnB,YAAY;AAAA,EACV,SAAS,GAAG,IAAI;AAAA,EAChB,QAAQ;AAAA,EACR,MAAM,gBAAgB;AACxB,CAAC;AAEH,MAAM,kBAAsC;AAAA,EAC1C,cAAc;AAAA,EACd,SAAS,OAAO;AAAA,IACd,SAAS,MAAM,QAAQ,OAAO,YAAY,iBAAiB,CAAC;AAAA,IAC5D,aAAa,CAAC,aACZ,qBAAqB;AAAA,MACnB,KAAK,SAAS;AAAA,MACd,OAAO,SAAS;AAAA,MAChB,WAAW,SAAS;AAAA,IACtB,CAAC;AAAA,EACL;AAAA,EACA,MAAM,MAAM,MAAM,QAAQ,OAAO,YAAY,uBAAuB,CAAC;AACvE;AAEO,MAAM,eAAe,CAAC,YAC3B,gBAAgB,iBAAiB,OAAO;",
6
+ "names": []
7
+ }
@@ -1,3 +1,4 @@
1
+ import { type AllowedEndpointsApiIface } from "./organization.mjs";
1
2
  import { type ChannelAppsApiIface, type ChannelSourceOf, type ProjectChannelsApiIface } from "./channels.mjs";
2
3
  import { type ClientContextIface } from "./context.mjs";
3
4
  import { type ProjectConversationsApiIface } from "./conversations.mjs";
@@ -39,6 +40,8 @@ export interface ProjectClientIface extends ProjectResourceApiIface {
39
40
  publisher: ProjectPublisherApiIface;
40
41
  /** Which of the project's names resolve as `handle/name` from any organization. */
41
42
  publicNames: PublicNamesApiIface;
43
+ /** Where the project lets its secrets go beyond model vendors' own APIs. */
44
+ allowedEndpoints: AllowedEndpointsApiIface;
42
45
  }
43
46
  export declare const createProjectClient: (args: {
44
47
  context: ClientContextIface;
@@ -1,3 +1,4 @@
1
+ import { createAllowedEndpointsApi } from "./organization.mjs";
1
2
  import {
2
3
  createChannelAppsApi,
3
4
  createProjectChannelsApi
@@ -57,7 +58,8 @@ const createProjectClient = (args) => {
57
58
  oauthClients: createOAuthClientsApi({ context, projectId }),
58
59
  signInReturnOrigins: createSignInReturnOriginsApi({ context, projectId }),
59
60
  publisher: createProjectPublisherApi({ context, projectId }),
60
- publicNames: createPublicNamesApi({ context, projectId })
61
+ publicNames: createPublicNamesApi({ context, projectId }),
62
+ allowedEndpoints: createAllowedEndpointsApi({ context, projectId })
61
63
  };
62
64
  };
63
65
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/agent-client/project.ts"],
4
- "sourcesContent": ["import type { AgentInput } from \"./agent-input.mjs\";\nimport {\n createChannelAppsApi,\n createProjectChannelsApi,\n type ChannelAppsApiIface,\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 { createProjectSchedulesApi, type ProjectSchedulesApiIface } from \"./schedules.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;\n /** Provider application credentials the project's channel installs use. */\n channelApps: ChannelAppsApiIface;\n /** The schedules of the project's conversations. */\n schedules: ProjectSchedulesApiIface;\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: createProjectChannelsApi({ context, projectId, sourceOf: args.channelSourceOf }),\n channelApps: createChannelAppsApi({ context, projectId }),\n schedules: createProjectSchedulesApi({ context, projectId }),\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,SAAS,iCAAgE;AACzE;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,gCAA8D;AAkChE,MAAM,sBAAsB,CAAC,SAKV;AACxB,QAAM,EAAE,SAAS,UAAU,IAAI;AAC/B,QAAM,SAAS,uBAAuB,EAAE,SAAS,WAAW,OAAO,KAAK,MAAM,MAAM,CAAC;AAErF,QAAM,QAAQ,OAAO,OAAmB,YACrC,MAAM,OAAO,MAAM,EAAE,OAAO,OAAO,CAAC,GAAG;AAC1C,SAAO;AAAA,IACL,GAAG,yBAAyB,EAAE,SAAS,UAAU,CAAC;AAAA,IAClD,IAAI;AAAA,IACJ,UAAU,yBAAyB,EAAE,SAAS,WAAW,OAAO,KAAK,MAAM,CAAC;AAAA,IAC5E,eAAe,8BAA8B,EAAE,SAAS,WAAW,OAAO,KAAK,MAAM,CAAC;AAAA,IACtF;AAAA,IACA,WAAW,mBAAmB,EAAE,SAAS,UAAU,CAAC;AAAA,IACpD,eAAe,uBAAuB,EAAE,SAAS,UAAU,CAAC;AAAA,IAC5D,cAAc,sBAAsB,EAAE,SAAS,UAAU,CAAC;AAAA,IAC1D,WAAW,mBAAmB,EAAE,SAAS,WAAW,MAAM,CAAC;AAAA,IAC3D,aAAa,qBAAqB,EAAE,SAAS,UAAU,CAAC;AAAA,IACxD,UAAU,yBAAyB,EAAE,SAAS,WAAW,UAAU,KAAK,gBAAgB,CAAC;AAAA,IACzF,aAAa,qBAAqB,EAAE,SAAS,UAAU,CAAC;AAAA,IACxD,WAAW,0BAA0B,EAAE,SAAS,UAAU,CAAC;AAAA,IAC3D,QAAQ,gBAAgB,EAAE,SAAS,UAAU,CAAC;AAAA,IAC9C,oBAAoB,4BAA4B;AAAA,MAC9C;AAAA,MACA,UAAU,gBAAgB,WAAW,SAAS,CAAC;AAAA,IACjD,CAAC;AAAA,IACD,kBAAkB,0BAA0B,EAAE,SAAS,UAAU,CAAC;AAAA,IAClE,cAAc,sBAAsB,EAAE,SAAS,UAAU,CAAC;AAAA,IAC1D,qBAAqB,6BAA6B,EAAE,SAAS,UAAU,CAAC;AAAA,IACxE,WAAW,0BAA0B,EAAE,SAAS,UAAU,CAAC;AAAA,IAC3D,aAAa,qBAAqB,EAAE,SAAS,UAAU,CAAC;AAAA,EAC1D;AACF;",
4
+ "sourcesContent": ["import { createAllowedEndpointsApi, type AllowedEndpointsApiIface } from \"./organization.mjs\";\nimport type { AgentInput } from \"./agent-input.mjs\";\nimport {\n createChannelAppsApi,\n createProjectChannelsApi,\n type ChannelAppsApiIface,\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 { createProjectSchedulesApi, type ProjectSchedulesApiIface } from \"./schedules.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;\n /** Provider application credentials the project's channel installs use. */\n channelApps: ChannelAppsApiIface;\n /** The schedules of the project's conversations. */\n schedules: ProjectSchedulesApiIface;\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 /** Where the project lets its secrets go beyond model vendors' own APIs. */\n allowedEndpoints: AllowedEndpointsApiIface;\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: createProjectChannelsApi({ context, projectId, sourceOf: args.channelSourceOf }),\n channelApps: createChannelAppsApi({ context, projectId }),\n schedules: createProjectSchedulesApi({ context, projectId }),\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 allowedEndpoints: createAllowedEndpointsApi({ context, projectId }),\n };\n};\n"],
5
+ "mappings": "AAAA,SAAS,iCAAgE;AAEzE;AAAA,EACE;AAAA,EACA;AAAA,OAIK;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,SAAS,UAAU,CAAC;AAAA,IAC3D,QAAQ,gBAAgB,EAAE,SAAS,UAAU,CAAC;AAAA,IAC9C,oBAAoB,4BAA4B;AAAA,MAC9C;AAAA,MACA,UAAU,gBAAgB,WAAW,SAAS,CAAC;AAAA,IACjD,CAAC;AAAA,IACD,kBAAkB,0BAA0B,EAAE,SAAS,UAAU,CAAC;AAAA,IAClE,cAAc,sBAAsB,EAAE,SAAS,UAAU,CAAC;AAAA,IAC1D,qBAAqB,6BAA6B,EAAE,SAAS,UAAU,CAAC;AAAA,IACxE,WAAW,0BAA0B,EAAE,SAAS,UAAU,CAAC;AAAA,IAC3D,aAAa,qBAAqB,EAAE,SAAS,UAAU,CAAC;AAAA,IACxD,kBAAkB,0BAA0B,EAAE,SAAS,UAAU,CAAC;AAAA,EACpE;AACF;",
6
6
  "names": []
7
7
  }
@@ -22,7 +22,6 @@ export interface ProvidePatchIface {
22
22
  harness?: HarnessSettingsIface;
23
23
  compute?: Partial<Record<Capability | `${Capability}`, ResourceRef | null>>;
24
24
  integrations?: Record<string, ResourceRef | null>;
25
- instructions?: string | null;
26
25
  tools?: string[] | null;
27
26
  /** The settings revision you read; a stale one fails with `conflict`. */
28
27
  revision?: number;
@@ -39,7 +39,6 @@ const providePatchOf = (patch) => ({
39
39
  ...patch.harness == null ? {} : { harness: patch.harness },
40
40
  ...patch.compute == null ? {} : { compute: computePatchOf(patch.compute) },
41
41
  ...patch.integrations == null ? {} : { integrations: slotPatchOf(patch.integrations) },
42
- ...patch.instructions === void 0 ? {} : { instructions: patch.instructions },
43
42
  ...patch.tools === void 0 ? {} : { tools: patch.tools },
44
43
  ...patch.revision == null ? {} : { revision: patch.revision }
45
44
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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,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AAA,EAC3F;AACF;AAOO,MAAM,eAAe,CAC1B,KACA,WACyB;AACzB,QAAM,UAAU,IAAI,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;",
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 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.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;AAqCtC,MAAM,eAA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c,cAAc,GAAG;AACrE,QAAI,cAAc,KAAM,SAAQ,UAAU,IAAI;AAAA,EAChD;AACA,SAAO;AAAA,IACL,GAAI,KAAK,WAAW,OAAO,CAAC,IAAI,EAAE,SAAS,cAAc,KAAK,OAAO,EAAE;AAAA,IACvE,GAAI,OAAO,KAAK,OAAO,EAAE,WAAW,IAAI,CAAC,IAAI,EAAE,QAAQ;AAAA,IACvD,GAAI,OAAO,KAAK,KAAK,YAAY,EAAE,WAAW,IAAI,CAAC,IAAI,EAAE,cAAc,KAAK,aAAa;AAAA,EAC3F;AACF;AAOO,MAAM,eAAe,CAC1B,KACA,WACyB;AACzB,QAAM,UAAU,IAAI,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
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { SandboxEnvironmentValueIface } from '@finalai/agent-provider/sandbox/types';
2
- import { type PublishSandboxSetupResponseIface, type RunSandboxCommandRequestIface, type RunSandboxCommandResponseIface, type SandboxDescriptionIface, type SandboxListIface, type SandboxProviderIface, type SandboxResourceIface, type SandboxSetupInputIface, type SandboxSetupRefInputIface, type SandboxSetupResourceIface } from '@finalai/agent-protocol/agent-platform';
2
+ import { type PublishSandboxSetupResponseIface, type RunSandboxCommandRequestIface, type RunSandboxCommandResponseIface, type SandboxDescriptionIface, type SandboxExitConsentIface, type SandboxListIface, type SandboxProviderIface, type SandboxResourceIface, type SandboxSetupInputIface, type SandboxSetupRefInputIface, type SandboxSetupResourceIface } from '@finalai/agent-protocol/agent-platform';
3
3
  import { type ClientContextIface, type SignalOptionsIface } from "./context.mjs";
4
4
  export type { SandboxEnvironmentValueIface };
5
5
  /** A published sandbox setup at a version, or `latest` (resolved once, at creation). */
@@ -33,6 +33,13 @@ export interface SandboxHandleIface {
33
33
  setEgressExit: (args: {
34
34
  integration: string | null;
35
35
  } & SignalOptionsIface) => Promise<SandboxResourceIface>;
36
+ /**
37
+ * Proof for an integration's egress exit (`intg_...`) that you are the person the sandbox acts
38
+ * for now, to present with your consent to that exit. Refused for anyone else.
39
+ */
40
+ exitConsent: (args: {
41
+ integration: string;
42
+ } & SignalOptionsIface) => Promise<SandboxExitConsentIface>;
36
43
  delete: (options?: SignalOptionsIface) => Promise<void>;
37
44
  }
38
45
  export interface SandboxesApiIface {
@@ -12,6 +12,8 @@ import {
12
12
  sandboxResourceSchema,
13
13
  sandboxSetupListSchema,
14
14
  sandboxSetupResourceSchema,
15
+ sandboxExitConsentRequestSchema,
16
+ sandboxExitConsentSchema,
15
17
  setSandboxEgressExitRequestSchema
16
18
  } from "@finalai/agent-protocol/agent-platform";
17
19
  import { encodePath } from "./context.mjs";
@@ -49,6 +51,13 @@ const createSandboxesApi = (args) => {
49
51
  response: sandboxResourceSchema,
50
52
  signal
51
53
  }),
54
+ exitConsent: ({ signal, ...value }) => http.request({
55
+ method: HttpMethod.Post,
56
+ path: sandboxPath(resource.id, "/exit-consent"),
57
+ body: { schema: sandboxExitConsentRequestSchema, value },
58
+ response: sandboxExitConsentSchema,
59
+ signal
60
+ }),
52
61
  delete: async (options) => {
53
62
  await http.request({
54
63
  method: HttpMethod.Delete,