@finalai/agents 0.12.0 → 0.14.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 (46) hide show
  1. package/README.md +1 -1
  2. package/dist/modules/agent-client/channels.d.mts +91 -28
  3. package/dist/modules/agent-client/channels.mjs +176 -46
  4. package/dist/modules/agent-client/channels.mjs.map +2 -2
  5. package/dist/modules/agent-client/client.d.mts +19 -4
  6. package/dist/modules/agent-client/client.mjs +16 -5
  7. package/dist/modules/agent-client/client.mjs.map +2 -2
  8. package/dist/modules/agent-client/conversation-resources.d.mts +18 -1
  9. package/dist/modules/agent-client/conversation-resources.mjs +28 -0
  10. package/dist/modules/agent-client/conversation-resources.mjs.map +2 -2
  11. package/dist/modules/agent-client/conversations.d.mts +21 -25
  12. package/dist/modules/agent-client/conversations.mjs +17 -62
  13. package/dist/modules/agent-client/conversations.mjs.map +2 -2
  14. package/dist/modules/agent-client/index.d.mts +5 -3
  15. package/dist/modules/agent-client/index.mjs.map +2 -2
  16. package/dist/modules/agent-client/integrations.d.mts +5 -1
  17. package/dist/modules/agent-client/integrations.mjs +9 -1
  18. package/dist/modules/agent-client/integrations.mjs.map +2 -2
  19. package/dist/modules/agent-client/organization.d.mts +83 -0
  20. package/dist/modules/agent-client/organization.mjs +209 -0
  21. package/dist/modules/agent-client/organization.mjs.map +7 -0
  22. package/dist/modules/agent-client/participant-configuration.d.mts +21 -0
  23. package/dist/modules/agent-client/participant-configuration.mjs +38 -0
  24. package/dist/modules/agent-client/participant-configuration.mjs.map +7 -0
  25. package/dist/modules/agent-client/project.d.mts +10 -2
  26. package/dist/modules/agent-client/project.mjs +8 -6
  27. package/dist/modules/agent-client/project.mjs.map +2 -2
  28. package/dist/modules/agent-client/provide.d.mts +0 -1
  29. package/dist/modules/agent-client/provide.mjs +0 -1
  30. package/dist/modules/agent-client/provide.mjs.map +2 -2
  31. package/dist/modules/agent-client/sandboxes.d.mts +7 -0
  32. package/dist/modules/agent-client/sandboxes.mjs +9 -1
  33. package/dist/modules/agent-client/sandboxes.mjs.map +2 -2
  34. package/dist/modules/agent-client/schedules.d.mts +7 -22
  35. package/dist/modules/agent-client/schedules.mjs +8 -47
  36. package/dist/modules/agent-client/schedules.mjs.map +2 -2
  37. package/dist/modules/agent-client/sessions.d.mts +8 -1
  38. package/dist/modules/agent-client/sessions.mjs +24 -5
  39. package/dist/modules/agent-client/sessions.mjs.map +2 -2
  40. package/dist/modules/public.d.mts +1 -1
  41. package/dist/modules/public.mjs.map +2 -2
  42. package/examples/release-scout/run-on-a-computer.ts +1 -1
  43. package/package.json +5 -10
  44. package/dist/modules/authoring/final-channel.d.mts +0 -1
  45. package/dist/modules/authoring/final-channel.mjs +0 -2
  46. package/dist/modules/authoring/final-channel.mjs.map +0 -7
package/README.md CHANGED
@@ -98,7 +98,7 @@ requirements check the platform runs; anything missing throws a
98
98
  `sessions.create` and `conversations.create` take an `id` you choose, so a
99
99
  sandbox created first can be owned by the session or conversation it is for
100
100
  (`project.sandboxes.create(environment, { setup, ownedBy, idempotencyKey })`).
101
- `conversations.findHome()` and `findDirect({ agent })` look up without creating.
101
+ `conversations.findDirect({ agent })` looks up without creating.
102
102
 
103
103
  ## Where things run
104
104
 
@@ -1,4 +1,4 @@
1
- import { type ChannelIface, type ChannelRouteIface, type ChannelSeenPlaceIface, type ConnectChannelPlaceRequestIface, type CreateChannelBindingResponseIface, type DefinitionVisibility, type PublishChannelResponseIface } from '@finalai/agent-protocol/agent-platform';
1
+ import { type ActorInputIface, type ChannelAppIface, type ChannelBindingIface, type ChannelIdentityLinkIface, type ChannelIdentityLinkProgressIface, type ChannelIface, type ChannelSeenPlaceIface, type ChannelTenantTicketIface, type ChannelTicketIface, type CompleteChannelIdentityLinkRequestIface, type CompleteChannelPlaceConnectionRequestIface, type CreateChannelAppRequestIface, type DefinitionVisibility, type InstallChannelRequestIface, type InstalledChannelIface, type PublishChannelResponseIface, type UpdateChannelAppRequestIface, type UpdateChannelBindingRequestIface } from '@finalai/agent-protocol/agent-platform';
2
2
  import { type ClientContextIface, type EnumInput, type SignalOptionsIface } from "./context.mjs";
3
3
  import { type ProvideIface } from "./provide.mjs";
4
4
  /** A channel value's source, as `channels.publish({ channel })` sends it. */
@@ -12,27 +12,26 @@ export type PublishChannelArgsIface = {
12
12
  name: string;
13
13
  /** `public` also makes the name public under the project's publisher handle. */
14
14
  visibility?: EnumInput<DefinitionVisibility>;
15
+ /** A channel app of this project that installs of the publication use unless they bring their own. */
16
+ app?: string;
15
17
  } & SignalOptionsIface & ({
16
18
  channel: object;
17
19
  } | {
18
20
  source: string;
19
21
  export?: string;
20
22
  });
21
- export interface InstallChannelArgsIface extends SignalOptionsIface {
22
- /** A published channel (`channels.get`), or `{ name }` to install what the name points at now. */
23
- channel: Pick<ChannelIface, 'hash'> | {
24
- name: string;
25
- };
26
- connectorInstallId: string;
27
- /** What an agent gets in every chat this install creates. */
23
+ export type InstallChannelArgsIface = Omit<InstallChannelRequestIface, 'agents'> & {
24
+ /** What the agent gets in every chat this install creates. */
28
25
  agents: {
29
26
  provide: ProvideIface;
30
27
  };
31
- /** Explicitly replace an existing install of the same connector. */
32
- replace?: boolean;
33
- /** Reaches only the channel's own code. */
34
- config?: Record<string, unknown>;
35
- }
28
+ } & SignalOptionsIface;
29
+ export type UpdateChannelBindingArgsIface = Omit<UpdateChannelBindingRequestIface, 'agents'> & {
30
+ bindingId: string;
31
+ agents?: {
32
+ provide: ProvideIface;
33
+ };
34
+ } & SignalOptionsIface;
36
35
  export interface ProjectChannelsApiIface {
37
36
  publish: (args: PublishChannelArgsIface) => Promise<PublishChannelResponseIface>;
38
37
  get: (selector: ({
@@ -40,33 +39,97 @@ export interface ProjectChannelsApiIface {
40
39
  } | {
41
40
  hash: string;
42
41
  }) & SignalOptionsIface) => Promise<ChannelIface>;
43
- /** Fails with `requirements_unmet` unless `agents.provide` meets the answering agent's requirements. */
44
- install: (args: InstallChannelArgsIface) => Promise<CreateChannelBindingResponseIface>;
42
+ /**
43
+ * Installs a channel in the project. Fails with `requirements_unmet`, and
44
+ * installs nothing, unless `agents.provide` meets the agent's requirements
45
+ * and the channel's app requirement is met.
46
+ */
47
+ install: (args: InstallChannelArgsIface) => Promise<InstalledChannelIface>;
48
+ /** The project's installs, newest first. */
49
+ installs: (options?: SignalOptionsIface & {
50
+ includeArchived?: boolean;
51
+ }) => Promise<ChannelBindingIface[]>;
45
52
  }
46
53
  export interface ChannelBindingsApiIface {
47
- places(args: {
54
+ /** One install, with whether its agent's requirements are met now. */
55
+ get: (args: {
48
56
  bindingId: string;
49
- } & SignalOptionsIface): Promise<ChannelSeenPlaceIface[]>;
50
- routes(args: {
51
- conversationId: string;
52
- } & SignalOptionsIface): Promise<ChannelRouteIface[]>;
53
- connect(args: ConnectChannelPlaceRequestIface & {
54
- conversationId: string;
55
- } & SignalOptionsIface): Promise<{
56
- id: string;
57
+ } & SignalOptionsIface) => Promise<ChannelBindingIface>;
58
+ /** Fails with `revision_conflict` unless `revision` is the one last read, and with `requirements_unmet` when the change would leave them unmet. */
59
+ update: (args: UpdateChannelBindingArgsIface) => Promise<InstalledChannelIface>;
60
+ /** Ends the install: its connected places, tenants, listeners and the links made through it. */
61
+ uninstall: (args: {
62
+ bindingId: string;
63
+ } & SignalOptionsIface) => Promise<{
64
+ archivedAt: string | null;
57
65
  }>;
58
- disconnect(args: {
59
- conversationId: string;
66
+ /** A single-use link that installs the provider app for one tenant (a workspace, a server). */
67
+ tenantTicket: (args: {
68
+ bindingId: string;
69
+ } & SignalOptionsIface) => Promise<ChannelTenantTicketIface>;
70
+ /** The provider places the install has seen. */
71
+ places: (args: {
72
+ bindingId: string;
73
+ } & SignalOptionsIface) => Promise<ChannelSeenPlaceIface[]>;
74
+ }
75
+ export interface ChannelAppsApiIface {
76
+ /** Registers the provider application's credentials; secret values stay project secrets. */
77
+ create: (args: CreateChannelAppRequestIface & SignalOptionsIface) => Promise<ChannelAppIface>;
78
+ /** The apps of the project and its ancestors. */
79
+ list: (options?: SignalOptionsIface) => Promise<ChannelAppIface[]>;
80
+ update: (args: UpdateChannelAppRequestIface & {
81
+ id: string;
82
+ } & SignalOptionsIface) => Promise<ChannelAppIface>;
83
+ /** Refused while a live install or publication uses the app. */
84
+ delete: (args: {
85
+ id: string;
86
+ } & SignalOptionsIface) => Promise<void>;
87
+ }
88
+ /** The actor an API key or app acts for, by its external id. */
89
+ export interface ActorOptionIface {
90
+ actor?: string;
91
+ }
92
+ export interface ChannelTicketsApiIface {
93
+ /** What a ticket from an installer's link or connect page is for. */
94
+ get: (args: {
95
+ ticket: string;
96
+ } & ActorOptionIface & SignalOptionsIface) => Promise<ChannelTicketIface>;
97
+ /** Links the ticket's channel account to the caller's person, or to `actor`. */
98
+ link: (args: {
99
+ ticket: string;
100
+ } & CompleteChannelIdentityLinkRequestIface & SignalOptionsIface) => Promise<ChannelIdentityLinkProgressIface>;
101
+ /** Connects the ticket's place to a conversation the caller manages. */
102
+ connect: (args: {
103
+ ticket: string;
104
+ } & CompleteChannelPlaceConnectionRequestIface & SignalOptionsIface) => Promise<{
60
105
  routeId: string;
61
- } & SignalOptionsIface): Promise<{
62
- ok: boolean;
63
106
  }>;
64
107
  }
108
+ export interface IdentityLinksApiIface {
109
+ /** The channel accounts linked to the caller's person, or to `actor`. */
110
+ list: (options?: ActorOptionIface & SignalOptionsIface) => Promise<ChannelIdentityLinkIface[]>;
111
+ /** Chooses where the person's direct messages to the channel land. */
112
+ update: (args: {
113
+ id: string;
114
+ directConversationId: string | null;
115
+ actor?: ActorInputIface;
116
+ } & SignalOptionsIface) => Promise<void>;
117
+ /** Unlinks the account. */
118
+ delete: (args: {
119
+ id: string;
120
+ } & ActorOptionIface & SignalOptionsIface) => Promise<void>;
121
+ }
65
122
  export declare const createProjectChannelsApi: (args: {
66
123
  context: ClientContextIface;
67
124
  projectId: string;
68
125
  sourceOf: ChannelSourceOf;
69
126
  }) => ProjectChannelsApiIface;
70
127
  export declare const createChannelBindingsApi: (ctx: ClientContextIface) => ChannelBindingsApiIface;
128
+ export declare const createChannelAppsApi: (args: {
129
+ context: ClientContextIface;
130
+ projectId: string;
131
+ }) => ChannelAppsApiIface;
132
+ export declare const createChannelTicketsApi: (ctx: ClientContextIface) => ChannelTicketsApiIface;
133
+ export declare const createIdentityLinksApi: (ctx: ClientContextIface) => IdentityLinksApiIface;
71
134
  /** The default `ChannelSourceOf` when no codec is available. */
72
135
  export declare const noChannelSource: ChannelSourceOf;
@@ -1,14 +1,27 @@
1
1
  import {
2
+ channelAppListSchema,
3
+ channelAppResponseSchema,
4
+ channelBindingListSchema,
5
+ channelBindingResponseSchema,
6
+ channelIdentityLinkListSchema,
7
+ channelIdentityLinkProgressSchema,
8
+ channelPlaceConnectionResponseSchema,
2
9
  channelPlacesResponseSchema,
3
- channelRoutesResponseSchema,
4
10
  channelSchema,
5
- connectChannelPlaceRequestSchema,
6
- connectChannelPlaceResponseSchema,
7
- createChannelBindingRequestSchema,
8
- createChannelBindingResponseSchema,
9
- disconnectChannelRouteResponseSchema,
11
+ channelTenantTicketSchema,
12
+ channelTicketSchema,
13
+ completeChannelIdentityLinkRequestSchema,
14
+ completeChannelPlaceConnectionRequestSchema,
15
+ createChannelAppRequestSchema,
16
+ installChannelRequestSchema,
17
+ installedChannelResponseSchema,
18
+ okResponseSchema,
10
19
  publishChannelRequestSchema,
11
- publishChannelResponseSchema
20
+ publishChannelResponseSchema,
21
+ uninstallChannelBindingResponseSchema,
22
+ updateChannelAppRequestSchema,
23
+ updateChannelBindingRequestSchema,
24
+ updateChannelIdentityLinkRequestSchema
12
25
  } from "@finalai/agent-protocol/agent-platform";
13
26
  import {
14
27
  encodePath
@@ -17,8 +30,10 @@ import { clientError, ClientErrorCode } from "./errors.mjs";
17
30
  import { HttpMethod } from "./http.mjs";
18
31
  import { provideDocumentOf } from "./provide.mjs";
19
32
  const channelsPath = (projectId, suffix) => `/v1/projects/${encodePath(projectId)}/channels${suffix}`;
33
+ const bindingPath = (bindingId, suffix = "") => `/v1/channel-bindings/${encodePath(bindingId)}${suffix}`;
20
34
  const createProjectChannelsApi = (args) => {
21
35
  const { http } = args.context;
36
+ const installsPath = `/v1/projects/${encodePath(args.projectId)}/channel-bindings`;
22
37
  return {
23
38
  publish: (publish) => {
24
39
  const source = "channel" in publish ? args.sourceOf(publish.channel) : {
@@ -30,7 +45,12 @@ const createProjectChannelsApi = (args) => {
30
45
  path: channelsPath(args.projectId, "/publish"),
31
46
  body: {
32
47
  schema: publishChannelRequestSchema,
33
- value: { name: publish.name, ...source, visibility: publish.visibility }
48
+ value: {
49
+ name: publish.name,
50
+ ...source,
51
+ visibility: publish.visibility,
52
+ app: publish.app
53
+ }
34
54
  },
35
55
  response: publishChannelResponseSchema,
36
56
  signal: publish.signal
@@ -46,55 +66,162 @@ const createProjectChannelsApi = (args) => {
46
66
  response: channelSchema,
47
67
  signal
48
68
  }),
49
- install: (install) => {
50
- const channel = "hash" in install.channel ? { hash: install.channel.hash } : { name: install.channel.name };
51
- return http.request({
52
- method: HttpMethod.Post,
53
- path: "/v1/channel-bindings",
54
- body: {
55
- schema: createChannelBindingRequestSchema,
56
- value: {
57
- projectId: args.projectId,
58
- channel,
59
- connectorInstallId: install.connectorInstallId,
60
- agents: { provide: provideDocumentOf(install.agents.provide) },
61
- replace: install.replace,
62
- config: install.config
63
- }
64
- },
65
- response: createChannelBindingResponseSchema,
66
- signal: install.signal
67
- });
68
- }
69
+ install: ({ signal, agents, ...install }) => http.request({
70
+ method: HttpMethod.Post,
71
+ path: installsPath,
72
+ body: {
73
+ schema: installChannelRequestSchema,
74
+ value: {
75
+ ...install,
76
+ channel: referenceOf(install.channel),
77
+ agent: referenceOf(install.agent),
78
+ agents: { provide: provideDocumentOf(agents.provide) }
79
+ }
80
+ },
81
+ response: installedChannelResponseSchema,
82
+ signal
83
+ }),
84
+ installs: async (options) => (await http.request({
85
+ method: HttpMethod.Get,
86
+ path: installsPath,
87
+ query: { includeArchived: options?.includeArchived === true ? "true" : void 0 },
88
+ response: channelBindingListSchema,
89
+ signal: options?.signal
90
+ })).bindings
69
91
  };
70
92
  };
93
+ const referenceOf = (reference) => "hash" in reference ? { hash: reference.hash } : { name: reference.name };
71
94
  const createChannelBindingsApi = (ctx) => ({
72
- places: async ({ bindingId, signal }) => (await ctx.http.request({
95
+ get: async ({ bindingId, signal }) => (await ctx.http.request({
73
96
  method: HttpMethod.Get,
74
- path: `/v1/channel-bindings/${encodePath(bindingId)}/places`,
75
- response: channelPlacesResponseSchema,
97
+ path: bindingPath(bindingId),
98
+ response: channelBindingResponseSchema,
76
99
  signal
77
- })).places,
78
- routes: async ({ conversationId, signal }) => (await ctx.http.request({
79
- method: HttpMethod.Get,
80
- path: `/v1/conversations/${encodePath(conversationId)}/channel-routes`,
81
- response: channelRoutesResponseSchema,
100
+ })).binding,
101
+ update: ({ bindingId, signal, agents, ...change }) => ctx.http.request({
102
+ method: HttpMethod.Patch,
103
+ path: bindingPath(bindingId),
104
+ body: {
105
+ schema: updateChannelBindingRequestSchema,
106
+ value: {
107
+ ...change,
108
+ ...change.channel == null ? {} : { channel: referenceOf(change.channel) },
109
+ ...change.agent == null ? {} : { agent: referenceOf(change.agent) },
110
+ ...agents == null ? {} : { agents: { provide: provideDocumentOf(agents.provide) } }
111
+ }
112
+ },
113
+ response: installedChannelResponseSchema,
82
114
  signal
83
- })).routes,
84
- connect: ({ conversationId, signal, ...body }) => ctx.http.request({
115
+ }),
116
+ uninstall: ({ bindingId, signal }) => ctx.http.request({
117
+ method: HttpMethod.Delete,
118
+ path: bindingPath(bindingId),
119
+ response: uninstallChannelBindingResponseSchema,
120
+ signal
121
+ }),
122
+ tenantTicket: ({ bindingId, signal }) => ctx.http.request({
85
123
  method: HttpMethod.Post,
86
- path: `/v1/conversations/${encodePath(conversationId)}/channel-routes`,
87
- body: { schema: connectChannelPlaceRequestSchema, value: body },
88
- response: connectChannelPlaceResponseSchema,
124
+ path: bindingPath(bindingId, "/tenant-tickets"),
125
+ response: channelTenantTicketSchema,
89
126
  signal
90
127
  }),
91
- disconnect: ({ conversationId, routeId, signal }) => ctx.http.request({
92
- method: HttpMethod.Delete,
93
- path: `/v1/conversations/${encodePath(conversationId)}/channel-routes/${encodePath(routeId)}`,
94
- response: disconnectChannelRouteResponseSchema,
128
+ places: async ({ bindingId, signal }) => (await ctx.http.request({
129
+ method: HttpMethod.Get,
130
+ path: bindingPath(bindingId, "/places"),
131
+ response: channelPlacesResponseSchema,
95
132
  signal
96
- })
133
+ })).places
97
134
  });
135
+ const createChannelAppsApi = (args) => {
136
+ const { http } = args.context;
137
+ const appPath = (id) => `/v1/channel-apps/${encodePath(id)}`;
138
+ return {
139
+ create: async ({ signal, ...value }) => (await http.request({
140
+ method: HttpMethod.Post,
141
+ path: `/v1/projects/${encodePath(args.projectId)}/channel-apps`,
142
+ body: { schema: createChannelAppRequestSchema, value },
143
+ response: channelAppResponseSchema,
144
+ signal
145
+ })).app,
146
+ list: async (options) => (await http.request({
147
+ method: HttpMethod.Get,
148
+ path: `/v1/projects/${encodePath(args.projectId)}/channel-apps`,
149
+ response: channelAppListSchema,
150
+ signal: options?.signal
151
+ })).apps,
152
+ update: async ({ id, signal, ...value }) => (await http.request({
153
+ method: HttpMethod.Patch,
154
+ path: appPath(id),
155
+ body: { schema: updateChannelAppRequestSchema, value },
156
+ response: channelAppResponseSchema,
157
+ signal
158
+ })).app,
159
+ delete: async ({ id, signal }) => {
160
+ await http.request({
161
+ method: HttpMethod.Delete,
162
+ path: appPath(id),
163
+ response: okResponseSchema,
164
+ signal
165
+ });
166
+ }
167
+ };
168
+ };
169
+ const createChannelTicketsApi = (ctx) => {
170
+ const ticketPath = (ticket, suffix = "") => `/v1/channel-tickets/${encodePath(ticket)}${suffix}`;
171
+ return {
172
+ get: ({ ticket, actor, signal }) => ctx.http.request({
173
+ method: HttpMethod.Get,
174
+ path: ticketPath(ticket),
175
+ query: { actor },
176
+ response: channelTicketSchema,
177
+ signal
178
+ }),
179
+ link: ({ ticket, signal, ...value }) => ctx.http.request({
180
+ method: HttpMethod.Post,
181
+ path: ticketPath(ticket, "/identity-link"),
182
+ body: { schema: completeChannelIdentityLinkRequestSchema, value },
183
+ response: channelIdentityLinkProgressSchema,
184
+ signal
185
+ }),
186
+ connect: ({ ticket, signal, ...value }) => ctx.http.request({
187
+ method: HttpMethod.Post,
188
+ path: ticketPath(ticket, "/place-connection"),
189
+ body: { schema: completeChannelPlaceConnectionRequestSchema, value },
190
+ response: channelPlaceConnectionResponseSchema,
191
+ signal
192
+ })
193
+ };
194
+ };
195
+ const createIdentityLinksApi = (ctx) => {
196
+ const linksPath = (suffix = "") => `/v1/people/me/identity-links${suffix}`;
197
+ return {
198
+ list: async (options) => (await ctx.http.request({
199
+ method: HttpMethod.Get,
200
+ path: linksPath(),
201
+ query: { actor: options?.actor },
202
+ response: channelIdentityLinkListSchema,
203
+ signal: options?.signal
204
+ })).links,
205
+ update: async ({ id, signal, ...value }) => {
206
+ await ctx.http.request({
207
+ method: HttpMethod.Patch,
208
+ path: linksPath(`/${encodePath(id)}`),
209
+ body: { schema: updateChannelIdentityLinkRequestSchema, value },
210
+ response: okResponseSchema,
211
+ signal
212
+ });
213
+ },
214
+ delete: async ({ id, actor, signal }) => {
215
+ await ctx.http.request({
216
+ method: HttpMethod.Delete,
217
+ path: linksPath(`/${encodePath(id)}`),
218
+ query: { actor },
219
+ response: okResponseSchema,
220
+ signal
221
+ });
222
+ }
223
+ };
224
+ };
98
225
  const noChannelSource = () => {
99
226
  throw clientError({
100
227
  message: "Publish a channel as `source`: this build cannot capture a channel value",
@@ -103,7 +230,10 @@ const noChannelSource = () => {
103
230
  });
104
231
  };
105
232
  export {
233
+ createChannelAppsApi,
106
234
  createChannelBindingsApi,
235
+ createChannelTicketsApi,
236
+ createIdentityLinksApi,
107
237
  createProjectChannelsApi,
108
238
  noChannelSource
109
239
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/agent-client/channels.ts"],
4
- "sourcesContent": ["import {\n channelPlacesResponseSchema,\n channelRoutesResponseSchema,\n channelSchema,\n connectChannelPlaceRequestSchema,\n connectChannelPlaceResponseSchema,\n createChannelBindingRequestSchema,\n createChannelBindingResponseSchema,\n disconnectChannelRouteResponseSchema,\n publishChannelRequestSchema,\n publishChannelResponseSchema,\n type ChannelIface,\n type ChannelRouteIface,\n type ChannelSeenPlaceIface,\n type ConnectChannelPlaceRequestIface,\n type CreateChannelBindingResponseIface,\n type DefinitionVisibility,\n type PublishChannelResponseIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport {\n encodePath,\n type ClientContextIface,\n type EnumInput,\n type SignalOptionsIface,\n} from \"./context.mjs\";\nimport { clientError, ClientErrorCode } from \"./errors.mjs\";\nimport { HttpMethod } from \"./http.mjs\";\nimport { provideDocumentOf, type ProvideIface } from \"./provide.mjs\";\n\n// Channels connect a provider (Slack, email, a webhook) to a project's chats.\n// A channel is one self-contained module, published by name and stored by\n// content hash; its handlers always run on Final's serverless runtime.\n\n/** A channel value's source, as `channels.publish({ channel })` sends it. */\nexport interface ChannelSourceIface {\n source: string;\n export?: string;\n}\n\n/** How the SDK turns a channel value into its source; a seam over `@finalai/agent-definition`. */\nexport type ChannelSourceOf = (channel: object) => ChannelSourceIface;\n\nexport type PublishChannelArgsIface = {\n name: string;\n /** `public` also makes the name public under the project's publisher handle. */\n visibility?: EnumInput<DefinitionVisibility>;\n} & SignalOptionsIface &\n ({ channel: object } | { source: string; export?: string });\n\nexport interface InstallChannelArgsIface extends SignalOptionsIface {\n /** A published channel (`channels.get`), or `{ name }` to install what the name points at now. */\n channel: Pick<ChannelIface, 'hash'> | { name: string };\n connectorInstallId: string;\n /** What an agent gets in every chat this install creates. */\n agents: { provide: ProvideIface };\n /** Explicitly replace an existing install of the same connector. */\n replace?: boolean;\n /** Reaches only the channel's own code. */\n config?: Record<string, unknown>;\n}\n\nexport interface ProjectChannelsApiIface {\n publish: (args: PublishChannelArgsIface) => Promise<PublishChannelResponseIface>;\n get: (\n selector: ({ name: string } | { hash: string }) & SignalOptionsIface,\n ) => Promise<ChannelIface>;\n /** Fails with `requirements_unmet` unless `agents.provide` meets the answering agent's requirements. */\n install: (args: InstallChannelArgsIface) => Promise<CreateChannelBindingResponseIface>;\n}\n\nexport interface ChannelBindingsApiIface {\n places(args: { bindingId: string } & SignalOptionsIface): Promise<ChannelSeenPlaceIface[]>;\n routes(args: { conversationId: string } & SignalOptionsIface): Promise<ChannelRouteIface[]>;\n connect(\n args: ConnectChannelPlaceRequestIface & { conversationId: string } & SignalOptionsIface,\n ): Promise<{ id: string }>;\n disconnect(\n args: { conversationId: string; routeId: string } & SignalOptionsIface,\n ): Promise<{ ok: boolean }>;\n}\n\nconst channelsPath = (projectId: string, suffix: string): string =>\n `/v1/projects/${encodePath(projectId)}/channels${suffix}`;\n\nexport const createProjectChannelsApi = (args: {\n context: ClientContextIface;\n projectId: string;\n sourceOf: ChannelSourceOf;\n}): ProjectChannelsApiIface => {\n const { http } = args.context;\n return {\n publish: (publish) => {\n const source: ChannelSourceIface =\n 'channel' in publish\n ? args.sourceOf(publish.channel)\n : {\n source: publish.source,\n ...(publish.export == null ? {} : { export: publish.export }),\n };\n return http.request({\n method: HttpMethod.Post,\n path: channelsPath(args.projectId, '/publish'),\n body: {\n schema: publishChannelRequestSchema,\n value: { name: publish.name, ...source, visibility: publish.visibility },\n },\n response: publishChannelResponseSchema,\n signal: publish.signal,\n });\n },\n get: ({ signal, ...selector }) =>\n http.request({\n method: HttpMethod.Get,\n path: channelsPath(args.projectId, '/lookup'),\n query: {\n name: 'name' in selector ? selector.name : undefined,\n hash: 'hash' in selector ? selector.hash : undefined,\n },\n response: channelSchema,\n signal,\n }),\n install: (install) => {\n const channel =\n 'hash' in install.channel ? { hash: install.channel.hash } : { name: install.channel.name };\n return http.request({\n method: HttpMethod.Post,\n path: '/v1/channel-bindings',\n body: {\n schema: createChannelBindingRequestSchema,\n value: {\n projectId: args.projectId,\n channel,\n connectorInstallId: install.connectorInstallId,\n agents: { provide: provideDocumentOf(install.agents.provide) },\n replace: install.replace,\n config: install.config,\n },\n },\n response: createChannelBindingResponseSchema,\n signal: install.signal,\n });\n },\n };\n};\n\nexport const createChannelBindingsApi = (ctx: ClientContextIface): ChannelBindingsApiIface => ({\n places: async ({ bindingId, signal }) =>\n (\n await ctx.http.request({\n method: HttpMethod.Get,\n path: `/v1/channel-bindings/${encodePath(bindingId)}/places`,\n response: channelPlacesResponseSchema,\n signal,\n })\n ).places,\n routes: async ({ conversationId, signal }) =>\n (\n await ctx.http.request({\n method: HttpMethod.Get,\n path: `/v1/conversations/${encodePath(conversationId)}/channel-routes`,\n response: channelRoutesResponseSchema,\n signal,\n })\n ).routes,\n connect: ({ conversationId, signal, ...body }) =>\n ctx.http.request({\n method: HttpMethod.Post,\n path: `/v1/conversations/${encodePath(conversationId)}/channel-routes`,\n body: { schema: connectChannelPlaceRequestSchema, value: body },\n response: connectChannelPlaceResponseSchema,\n signal,\n }),\n disconnect: ({ conversationId, routeId, signal }) =>\n ctx.http.request({\n method: HttpMethod.Delete,\n path: `/v1/conversations/${encodePath(conversationId)}/channel-routes/${encodePath(routeId)}`,\n response: disconnectChannelRouteResponseSchema,\n signal,\n }),\n});\n\n/** The default `ChannelSourceOf` when no codec is available. */\nexport const noChannelSource: ChannelSourceOf = () => {\n throw clientError({\n message: 'Publish a channel as `source`: this build cannot capture a channel value',\n status: 0,\n code: ClientErrorCode.InvalidRequest,\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,OAQK;AACP;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa,uBAAuB;AAC7C,SAAS,kBAAkB;AAC3B,SAAS,yBAA4C;AAsDrD,MAAM,eAAe,CAAC,WAAmB,WACvC,gBAAgB,WAAW,SAAS,CAAC,YAAY,MAAM;AAElD,MAAM,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channelAppListSchema,\n channelAppResponseSchema,\n channelBindingListSchema,\n channelBindingResponseSchema,\n channelIdentityLinkListSchema,\n channelIdentityLinkProgressSchema,\n channelPlaceConnectionResponseSchema,\n channelPlacesResponseSchema,\n channelSchema,\n channelTenantTicketSchema,\n channelTicketSchema,\n completeChannelIdentityLinkRequestSchema,\n completeChannelPlaceConnectionRequestSchema,\n createChannelAppRequestSchema,\n installChannelRequestSchema,\n installedChannelResponseSchema,\n okResponseSchema,\n publishChannelRequestSchema,\n publishChannelResponseSchema,\n uninstallChannelBindingResponseSchema,\n updateChannelAppRequestSchema,\n updateChannelBindingRequestSchema,\n updateChannelIdentityLinkRequestSchema,\n type ActorInputIface,\n type ChannelAppIface,\n type ChannelBindingIface,\n type ChannelIdentityLinkIface,\n type ChannelIdentityLinkProgressIface,\n type ChannelIface,\n type ChannelSeenPlaceIface,\n type ChannelTenantTicketIface,\n type ChannelTicketIface,\n type CompleteChannelIdentityLinkRequestIface,\n type CompleteChannelPlaceConnectionRequestIface,\n type CreateChannelAppRequestIface,\n type DefinitionVisibility,\n type InstallChannelRequestIface,\n type InstalledChannelIface,\n type PublishChannelResponseIface,\n type UpdateChannelAppRequestIface,\n type UpdateChannelBindingRequestIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport {\n encodePath,\n type ClientContextIface,\n type EnumInput,\n type SignalOptionsIface,\n} from \"./context.mjs\";\nimport { clientError, ClientErrorCode } from \"./errors.mjs\";\nimport { HttpMethod } from \"./http.mjs\";\nimport { provideDocumentOf, type ProvideIface } from \"./provide.mjs\";\n\n// Channels connect a provider (Slack, email, a webhook) to a project's chats.\n// A channel is one self-contained module, published by name and stored by\n// content hash; its handlers always run on Final's serverless runtime. An\n// install (a channel binding) runs a channel in a project, a channel app holds\n// the provider application's credentials, and tickets let the installer's own\n// pages link people and connect places.\n\n/** A channel value's source, as `channels.publish({ channel })` sends it. */\nexport interface ChannelSourceIface {\n source: string;\n export?: string;\n}\n\n/** How the SDK turns a channel value into its source; a seam over `@finalai/agent-definition`. */\nexport type ChannelSourceOf = (channel: object) => ChannelSourceIface;\n\nexport type PublishChannelArgsIface = {\n name: string;\n /** `public` also makes the name public under the project's publisher handle. */\n visibility?: EnumInput<DefinitionVisibility>;\n /** A channel app of this project that installs of the publication use unless they bring their own. */\n app?: string;\n} & SignalOptionsIface &\n ({ channel: object } | { source: string; export?: string });\n\nexport type InstallChannelArgsIface = Omit<InstallChannelRequestIface, 'agents'> & {\n /** What the agent gets in every chat this install creates. */\n agents: { provide: ProvideIface };\n} & SignalOptionsIface;\n\nexport type UpdateChannelBindingArgsIface = Omit<UpdateChannelBindingRequestIface, 'agents'> & {\n bindingId: string;\n agents?: { provide: ProvideIface };\n} & SignalOptionsIface;\n\nexport interface ProjectChannelsApiIface {\n publish: (args: PublishChannelArgsIface) => Promise<PublishChannelResponseIface>;\n get: (\n selector: ({ name: string } | { hash: string }) & SignalOptionsIface,\n ) => Promise<ChannelIface>;\n /**\n * Installs a channel in the project. Fails with `requirements_unmet`, and\n * installs nothing, unless `agents.provide` meets the agent's requirements\n * and the channel's app requirement is met.\n */\n install: (args: InstallChannelArgsIface) => Promise<InstalledChannelIface>;\n /** The project's installs, newest first. */\n installs: (\n options?: SignalOptionsIface & { includeArchived?: boolean },\n ) => Promise<ChannelBindingIface[]>;\n}\n\nexport interface ChannelBindingsApiIface {\n /** One install, with whether its agent's requirements are met now. */\n get: (args: { bindingId: string } & SignalOptionsIface) => Promise<ChannelBindingIface>;\n /** Fails with `revision_conflict` unless `revision` is the one last read, and with `requirements_unmet` when the change would leave them unmet. */\n update: (args: UpdateChannelBindingArgsIface) => Promise<InstalledChannelIface>;\n /** Ends the install: its connected places, tenants, listeners and the links made through it. */\n uninstall: (\n args: { bindingId: string } & SignalOptionsIface,\n ) => Promise<{ archivedAt: string | null }>;\n /** A single-use link that installs the provider app for one tenant (a workspace, a server). */\n tenantTicket: (\n args: { bindingId: string } & SignalOptionsIface,\n ) => Promise<ChannelTenantTicketIface>;\n /** The provider places the install has seen. */\n places: (args: { bindingId: string } & SignalOptionsIface) => Promise<ChannelSeenPlaceIface[]>;\n}\n\nexport interface ChannelAppsApiIface {\n /** Registers the provider application's credentials; secret values stay project secrets. */\n create: (args: CreateChannelAppRequestIface & SignalOptionsIface) => Promise<ChannelAppIface>;\n /** The apps of the project and its ancestors. */\n list: (options?: SignalOptionsIface) => Promise<ChannelAppIface[]>;\n update: (\n args: UpdateChannelAppRequestIface & { id: string } & SignalOptionsIface,\n ) => Promise<ChannelAppIface>;\n /** Refused while a live install or publication uses the app. */\n delete: (args: { id: string } & SignalOptionsIface) => Promise<void>;\n}\n\n/** The actor an API key or app acts for, by its external id. */\nexport interface ActorOptionIface {\n actor?: string;\n}\n\nexport interface ChannelTicketsApiIface {\n /** What a ticket from an installer's link or connect page is for. */\n get: (\n args: { ticket: string } & ActorOptionIface & SignalOptionsIface,\n ) => Promise<ChannelTicketIface>;\n /** Links the ticket's channel account to the caller's person, or to `actor`. */\n link: (\n args: { ticket: string } & CompleteChannelIdentityLinkRequestIface & SignalOptionsIface,\n ) => Promise<ChannelIdentityLinkProgressIface>;\n /** Connects the ticket's place to a conversation the caller manages. */\n connect: (\n args: { ticket: string } & CompleteChannelPlaceConnectionRequestIface & SignalOptionsIface,\n ) => Promise<{ routeId: string }>;\n}\n\nexport interface IdentityLinksApiIface {\n /** The channel accounts linked to the caller's person, or to `actor`. */\n list: (options?: ActorOptionIface & SignalOptionsIface) => Promise<ChannelIdentityLinkIface[]>;\n /** Chooses where the person's direct messages to the channel land. */\n update: (\n args: {\n id: string;\n directConversationId: string | null;\n actor?: ActorInputIface;\n } & SignalOptionsIface,\n ) => Promise<void>;\n /** Unlinks the account. */\n delete: (args: { id: string } & ActorOptionIface & SignalOptionsIface) => Promise<void>;\n}\n\nconst channelsPath = (projectId: string, suffix: string): string =>\n `/v1/projects/${encodePath(projectId)}/channels${suffix}`;\n\nconst bindingPath = (bindingId: string, suffix = ''): string =>\n `/v1/channel-bindings/${encodePath(bindingId)}${suffix}`;\n\nexport const createProjectChannelsApi = (args: {\n context: ClientContextIface;\n projectId: string;\n sourceOf: ChannelSourceOf;\n}): ProjectChannelsApiIface => {\n const { http } = args.context;\n const installsPath = `/v1/projects/${encodePath(args.projectId)}/channel-bindings`;\n return {\n publish: (publish) => {\n const source: ChannelSourceIface =\n 'channel' in publish\n ? args.sourceOf(publish.channel)\n : {\n source: publish.source,\n ...(publish.export == null ? {} : { export: publish.export }),\n };\n return http.request({\n method: HttpMethod.Post,\n path: channelsPath(args.projectId, '/publish'),\n body: {\n schema: publishChannelRequestSchema,\n value: {\n name: publish.name,\n ...source,\n visibility: publish.visibility,\n app: publish.app,\n },\n },\n response: publishChannelResponseSchema,\n signal: publish.signal,\n });\n },\n get: ({ signal, ...selector }) =>\n http.request({\n method: HttpMethod.Get,\n path: channelsPath(args.projectId, '/lookup'),\n query: {\n name: 'name' in selector ? selector.name : undefined,\n hash: 'hash' in selector ? selector.hash : undefined,\n },\n response: channelSchema,\n signal,\n }),\n install: ({ signal, agents, ...install }) =>\n http.request({\n method: HttpMethod.Post,\n path: installsPath,\n body: {\n schema: installChannelRequestSchema,\n value: {\n ...install,\n channel: referenceOf(install.channel),\n agent: referenceOf(install.agent),\n agents: { provide: provideDocumentOf(agents.provide) },\n },\n },\n response: installedChannelResponseSchema,\n signal,\n }),\n installs: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: installsPath,\n query: { includeArchived: options?.includeArchived === true ? 'true' : undefined },\n response: channelBindingListSchema,\n signal: options?.signal,\n })\n ).bindings,\n };\n};\n\n// A channel or agent reference as the wire takes it: a published value (with its id, name and\n// more) narrows to its hash, which pins what was read.\nconst referenceOf = (reference: { hash: string } | { name: string }) =>\n 'hash' in reference ? { hash: reference.hash } : { name: reference.name };\n\nexport const createChannelBindingsApi = (ctx: ClientContextIface): ChannelBindingsApiIface => ({\n get: async ({ bindingId, signal }) =>\n (\n await ctx.http.request({\n method: HttpMethod.Get,\n path: bindingPath(bindingId),\n response: channelBindingResponseSchema,\n signal,\n })\n ).binding,\n update: ({ bindingId, signal, agents, ...change }) =>\n ctx.http.request({\n method: HttpMethod.Patch,\n path: bindingPath(bindingId),\n body: {\n schema: updateChannelBindingRequestSchema,\n value: {\n ...change,\n ...(change.channel == null ? {} : { channel: referenceOf(change.channel) }),\n ...(change.agent == null ? {} : { agent: referenceOf(change.agent) }),\n ...(agents == null ? {} : { agents: { provide: provideDocumentOf(agents.provide) } }),\n },\n },\n response: installedChannelResponseSchema,\n signal,\n }),\n uninstall: ({ bindingId, signal }) =>\n ctx.http.request({\n method: HttpMethod.Delete,\n path: bindingPath(bindingId),\n response: uninstallChannelBindingResponseSchema,\n signal,\n }),\n tenantTicket: ({ bindingId, signal }) =>\n ctx.http.request({\n method: HttpMethod.Post,\n path: bindingPath(bindingId, '/tenant-tickets'),\n response: channelTenantTicketSchema,\n signal,\n }),\n places: async ({ bindingId, signal }) =>\n (\n await ctx.http.request({\n method: HttpMethod.Get,\n path: bindingPath(bindingId, '/places'),\n response: channelPlacesResponseSchema,\n signal,\n })\n ).places,\n});\n\nexport const createChannelAppsApi = (args: {\n context: ClientContextIface;\n projectId: string;\n}): ChannelAppsApiIface => {\n const { http } = args.context;\n const appPath = (id: string): string => `/v1/channel-apps/${encodePath(id)}`;\n return {\n create: async ({ signal, ...value }) =>\n (\n await http.request({\n method: HttpMethod.Post,\n path: `/v1/projects/${encodePath(args.projectId)}/channel-apps`,\n body: { schema: createChannelAppRequestSchema, value },\n response: channelAppResponseSchema,\n signal,\n })\n ).app,\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: `/v1/projects/${encodePath(args.projectId)}/channel-apps`,\n response: channelAppListSchema,\n signal: options?.signal,\n })\n ).apps,\n update: async ({ id, signal, ...value }) =>\n (\n await http.request({\n method: HttpMethod.Patch,\n path: appPath(id),\n body: { schema: updateChannelAppRequestSchema, value },\n response: channelAppResponseSchema,\n signal,\n })\n ).app,\n delete: async ({ id, signal }) => {\n await http.request({\n method: HttpMethod.Delete,\n path: appPath(id),\n response: okResponseSchema,\n signal,\n });\n },\n };\n};\n\nexport const createChannelTicketsApi = (ctx: ClientContextIface): ChannelTicketsApiIface => {\n const ticketPath = (ticket: string, suffix = ''): string =>\n `/v1/channel-tickets/${encodePath(ticket)}${suffix}`;\n return {\n get: ({ ticket, actor, signal }) =>\n ctx.http.request({\n method: HttpMethod.Get,\n path: ticketPath(ticket),\n query: { actor },\n response: channelTicketSchema,\n signal,\n }),\n link: ({ ticket, signal, ...value }) =>\n ctx.http.request({\n method: HttpMethod.Post,\n path: ticketPath(ticket, '/identity-link'),\n body: { schema: completeChannelIdentityLinkRequestSchema, value },\n response: channelIdentityLinkProgressSchema,\n signal,\n }),\n connect: ({ ticket, signal, ...value }) =>\n ctx.http.request({\n method: HttpMethod.Post,\n path: ticketPath(ticket, '/place-connection'),\n body: { schema: completeChannelPlaceConnectionRequestSchema, value },\n response: channelPlaceConnectionResponseSchema,\n signal,\n }),\n };\n};\n\nexport const createIdentityLinksApi = (ctx: ClientContextIface): IdentityLinksApiIface => {\n const linksPath = (suffix = ''): string => `/v1/people/me/identity-links${suffix}`;\n return {\n list: async (options) =>\n (\n await ctx.http.request({\n method: HttpMethod.Get,\n path: linksPath(),\n query: { actor: options?.actor },\n response: channelIdentityLinkListSchema,\n signal: options?.signal,\n })\n ).links,\n update: async ({ id, signal, ...value }) => {\n await ctx.http.request({\n method: HttpMethod.Patch,\n path: linksPath(`/${encodePath(id)}`),\n body: { schema: updateChannelIdentityLinkRequestSchema, value },\n response: okResponseSchema,\n signal,\n });\n },\n delete: async ({ id, actor, signal }) => {\n await ctx.http.request({\n method: HttpMethod.Delete,\n path: linksPath(`/${encodePath(id)}`),\n query: { actor },\n response: okResponseSchema,\n signal,\n });\n },\n };\n};\n\n/** The default `ChannelSourceOf` when no codec is available. */\nexport const noChannelSource: ChannelSourceOf = () => {\n throw clientError({\n message: 'Publish a channel as `source`: this build cannot capture a channel value',\n status: 0,\n code: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AO,EAAE,MAAM;AAAA,QACf,UAAU;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAGO,MAAM,kBAAmC,MAAM;AACpD,QAAM,YAAY;AAAA,IAChB,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,MAAM,gBAAgB;AAAA,EACxB,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
- import { type AgentListIface, type DecisionIface, type HealthResponseIface, type InferenceOfferingIface, type PersonIface, type PersonListIface, type PlatformIdentityExchangeRequestIface, type PlatformIdentityExchangeResponseIface, type RealtimeSessionResponseIface } from '@finalai/agent-protocol/agent-platform';
1
+ import { type AgentListIface, type AgentSummaryIface, type DecisionIface, type HealthResponseIface, type InferenceOfferingIface, type PersonIface, type PersonListIface, type PlatformIdentityExchangeRequestIface, type PlatformIdentityExchangeResponseIface, type RealtimeSessionResponseIface } from '@finalai/agent-protocol/agent-platform';
2
2
  import { type AcpApiIface } from "./acp.mjs";
3
3
  import type { AgentValueCodecIface } from "./agent-input.mjs";
4
- import { type ChannelBindingsApiIface, type ChannelSourceOf } from "./channels.mjs";
4
+ import { type ChannelBindingsApiIface, type ChannelSourceOf, type ChannelTicketsApiIface, type IdentityLinksApiIface } from "./channels.mjs";
5
5
  import { type SignalOptionsIface } from "./context.mjs";
6
6
  import { type ConversationsApiIface } from "./conversations.mjs";
7
7
  import { type EventsApiIface, type EventSubscriptionsApiIface } from "./events.mjs";
@@ -11,8 +11,8 @@ import { type GatewayConnect, type RealtimeTransportIface } from "./realtime.mjs
11
11
  import type { LocalComputeIface, LocalHostSocketIface } from "./local-host.mjs";
12
12
  import { type ProjectClientIface } from "./project.mjs";
13
13
  import { type ProjectsApiIface } from "./projects.mjs";
14
+ import { type OrganizationApiIface } from "./organization.mjs";
14
15
  import { type PublishersApiIface } from "./publishers.mjs";
15
- import { type SchedulesApiIface } from "./schedules.mjs";
16
16
  import { type SessionsApiIface } from "./sessions.mjs";
17
17
  /** Final's agents API. */
18
18
  export declare const DEFAULT_AGENTS_HOST = "https://agent-session.final.ai";
@@ -75,6 +75,13 @@ export interface AgentsApiIface {
75
75
  limit?: number;
76
76
  projectId?: string;
77
77
  }) => Promise<AgentListIface>;
78
+ /**
79
+ * One agent the caller can use, by id, in whichever project owns it; also one that was never
80
+ * published (`hash` and `revisionId` are null). Archived agents are not found.
81
+ */
82
+ get: (args: {
83
+ id: string;
84
+ } & SignalOptionsIface) => Promise<AgentSummaryIface>;
78
85
  }
79
86
  export interface PeopleApiIface {
80
87
  /** One page of the caller's organization members, by name; pass `nextCursor` as `cursor` for the next. */
@@ -84,6 +91,10 @@ export interface PeopleApiIface {
84
91
  }) => Promise<PersonListIface>;
85
92
  /** Every member of the caller's organization (all pages). */
86
93
  all: (options?: SignalOptionsIface) => Promise<PersonIface[]>;
94
+ /** The caller's own person (or, for an API key or app, the actor it names). */
95
+ me: {
96
+ identityLinks: IdentityLinksApiIface;
97
+ };
87
98
  }
88
99
  export interface RealtimeApiIface {
89
100
  /**
@@ -138,6 +149,8 @@ export interface AgentClientIface {
138
149
  platformIdentity: PlatformIdentityApiIface;
139
150
  decisions: DecisionsApiIface;
140
151
  health: (options?: SignalOptionsIface) => Promise<HealthResponseIface>;
152
+ /** The caller's organization: model credentials, budgets and policies. */
153
+ organization: OrganizationApiIface;
141
154
  agents: AgentsApiIface;
142
155
  people: PeopleApiIface;
143
156
  realtime: RealtimeApiIface;
@@ -145,8 +158,10 @@ export interface AgentClientIface {
145
158
  sessions: SessionsApiIface;
146
159
  /** The caller's conversations; create them through `project({ id }).conversations`. */
147
160
  conversations: ConversationsApiIface;
161
+ /** Channel installs by id; install them through `project({ id }).channels`. */
148
162
  channelBindings: ChannelBindingsApiIface;
149
- schedules: SchedulesApiIface;
163
+ /** Tickets from an installer's link and connect pages. */
164
+ channelTickets: ChannelTicketsApiIface;
150
165
  /**
151
166
  * ACP-native access (`/acp/ws`): an ACP v2 ClientApp connection on which the
152
167
  * agents API is the agent. The ACP SDK loads on the first `connect`.