@finalai/agents 0.12.0 → 0.13.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.
- package/dist/modules/agent-client/channels.d.mts +91 -28
- package/dist/modules/agent-client/channels.mjs +168 -46
- package/dist/modules/agent-client/channels.mjs.map +2 -2
- package/dist/modules/agent-client/client.d.mts +8 -3
- package/dist/modules/agent-client/client.mjs +7 -5
- package/dist/modules/agent-client/client.mjs.map +2 -2
- package/dist/modules/agent-client/conversation-resources.d.mts +18 -1
- package/dist/modules/agent-client/conversation-resources.mjs +28 -0
- package/dist/modules/agent-client/conversation-resources.mjs.map +2 -2
- package/dist/modules/agent-client/conversations.d.mts +5 -1
- package/dist/modules/agent-client/conversations.mjs +7 -0
- package/dist/modules/agent-client/conversations.mjs.map +2 -2
- package/dist/modules/agent-client/index.d.mts +3 -3
- package/dist/modules/agent-client/index.mjs.map +2 -2
- package/dist/modules/agent-client/project.d.mts +7 -2
- package/dist/modules/agent-client/project.mjs +5 -5
- package/dist/modules/agent-client/project.mjs.map +2 -2
- package/dist/modules/agent-client/sandboxes.d.mts +7 -0
- package/dist/modules/agent-client/sandboxes.mjs +9 -1
- package/dist/modules/agent-client/sandboxes.mjs.map +2 -2
- package/dist/modules/agent-client/schedules.d.mts +7 -22
- package/dist/modules/agent-client/schedules.mjs +8 -47
- package/dist/modules/agent-client/schedules.mjs.map +2 -2
- package/dist/modules/public.d.mts +1 -1
- package/dist/modules/public.mjs.map +2 -2
- package/examples/release-scout/run-on-a-computer.ts +1 -1
- package/package.json +5 -10
- package/dist/modules/authoring/final-channel.d.mts +0 -1
- package/dist/modules/authoring/final-channel.mjs +0 -2
- package/dist/modules/authoring/final-channel.mjs.map +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
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
|
|
22
|
-
/**
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
/**
|
|
44
|
-
|
|
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
|
-
|
|
54
|
+
/** One install, with whether its agent's requirements are met now. */
|
|
55
|
+
get: (args: {
|
|
48
56
|
bindingId: string;
|
|
49
|
-
} & SignalOptionsIface)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} & SignalOptionsIface)
|
|
56
|
-
|
|
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
|
-
|
|
59
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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: {
|
|
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,154 @@ const createProjectChannelsApi = (args) => {
|
|
|
46
66
|
response: channelSchema,
|
|
47
67
|
signal
|
|
48
68
|
}),
|
|
49
|
-
install: (install) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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: { ...install, agents: { provide: provideDocumentOf(agents.provide) } }
|
|
75
|
+
},
|
|
76
|
+
response: installedChannelResponseSchema,
|
|
77
|
+
signal
|
|
78
|
+
}),
|
|
79
|
+
installs: async (options) => (await http.request({
|
|
80
|
+
method: HttpMethod.Get,
|
|
81
|
+
path: installsPath,
|
|
82
|
+
query: { includeArchived: options?.includeArchived === true ? "true" : void 0 },
|
|
83
|
+
response: channelBindingListSchema,
|
|
84
|
+
signal: options?.signal
|
|
85
|
+
})).bindings
|
|
69
86
|
};
|
|
70
87
|
};
|
|
71
88
|
const createChannelBindingsApi = (ctx) => ({
|
|
72
|
-
|
|
89
|
+
get: async ({ bindingId, signal }) => (await ctx.http.request({
|
|
73
90
|
method: HttpMethod.Get,
|
|
74
|
-
path:
|
|
75
|
-
response:
|
|
91
|
+
path: bindingPath(bindingId),
|
|
92
|
+
response: channelBindingResponseSchema,
|
|
76
93
|
signal
|
|
77
|
-
})).
|
|
78
|
-
|
|
79
|
-
method: HttpMethod.
|
|
80
|
-
path:
|
|
81
|
-
|
|
94
|
+
})).binding,
|
|
95
|
+
update: ({ bindingId, signal, agents, ...change }) => ctx.http.request({
|
|
96
|
+
method: HttpMethod.Patch,
|
|
97
|
+
path: bindingPath(bindingId),
|
|
98
|
+
body: {
|
|
99
|
+
schema: updateChannelBindingRequestSchema,
|
|
100
|
+
value: {
|
|
101
|
+
...change,
|
|
102
|
+
...agents == null ? {} : { agents: { provide: provideDocumentOf(agents.provide) } }
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
response: installedChannelResponseSchema,
|
|
82
106
|
signal
|
|
83
|
-
})
|
|
84
|
-
|
|
107
|
+
}),
|
|
108
|
+
uninstall: ({ bindingId, signal }) => ctx.http.request({
|
|
109
|
+
method: HttpMethod.Delete,
|
|
110
|
+
path: bindingPath(bindingId),
|
|
111
|
+
response: uninstallChannelBindingResponseSchema,
|
|
112
|
+
signal
|
|
113
|
+
}),
|
|
114
|
+
tenantTicket: ({ bindingId, signal }) => ctx.http.request({
|
|
85
115
|
method: HttpMethod.Post,
|
|
86
|
-
path:
|
|
87
|
-
|
|
88
|
-
response: connectChannelPlaceResponseSchema,
|
|
116
|
+
path: bindingPath(bindingId, "/tenant-tickets"),
|
|
117
|
+
response: channelTenantTicketSchema,
|
|
89
118
|
signal
|
|
90
119
|
}),
|
|
91
|
-
|
|
92
|
-
method: HttpMethod.
|
|
93
|
-
path:
|
|
94
|
-
response:
|
|
120
|
+
places: async ({ bindingId, signal }) => (await ctx.http.request({
|
|
121
|
+
method: HttpMethod.Get,
|
|
122
|
+
path: bindingPath(bindingId, "/places"),
|
|
123
|
+
response: channelPlacesResponseSchema,
|
|
95
124
|
signal
|
|
96
|
-
})
|
|
125
|
+
})).places
|
|
97
126
|
});
|
|
127
|
+
const createChannelAppsApi = (args) => {
|
|
128
|
+
const { http } = args.context;
|
|
129
|
+
const appPath = (id) => `/v1/channel-apps/${encodePath(id)}`;
|
|
130
|
+
return {
|
|
131
|
+
create: async ({ signal, ...value }) => (await http.request({
|
|
132
|
+
method: HttpMethod.Post,
|
|
133
|
+
path: `/v1/projects/${encodePath(args.projectId)}/channel-apps`,
|
|
134
|
+
body: { schema: createChannelAppRequestSchema, value },
|
|
135
|
+
response: channelAppResponseSchema,
|
|
136
|
+
signal
|
|
137
|
+
})).app,
|
|
138
|
+
list: async (options) => (await http.request({
|
|
139
|
+
method: HttpMethod.Get,
|
|
140
|
+
path: `/v1/projects/${encodePath(args.projectId)}/channel-apps`,
|
|
141
|
+
response: channelAppListSchema,
|
|
142
|
+
signal: options?.signal
|
|
143
|
+
})).apps,
|
|
144
|
+
update: async ({ id, signal, ...value }) => (await http.request({
|
|
145
|
+
method: HttpMethod.Patch,
|
|
146
|
+
path: appPath(id),
|
|
147
|
+
body: { schema: updateChannelAppRequestSchema, value },
|
|
148
|
+
response: channelAppResponseSchema,
|
|
149
|
+
signal
|
|
150
|
+
})).app,
|
|
151
|
+
delete: async ({ id, signal }) => {
|
|
152
|
+
await http.request({
|
|
153
|
+
method: HttpMethod.Delete,
|
|
154
|
+
path: appPath(id),
|
|
155
|
+
response: okResponseSchema,
|
|
156
|
+
signal
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
const createChannelTicketsApi = (ctx) => {
|
|
162
|
+
const ticketPath = (ticket, suffix = "") => `/v1/channel-tickets/${encodePath(ticket)}${suffix}`;
|
|
163
|
+
return {
|
|
164
|
+
get: ({ ticket, actor, signal }) => ctx.http.request({
|
|
165
|
+
method: HttpMethod.Get,
|
|
166
|
+
path: ticketPath(ticket),
|
|
167
|
+
query: { actor },
|
|
168
|
+
response: channelTicketSchema,
|
|
169
|
+
signal
|
|
170
|
+
}),
|
|
171
|
+
link: ({ ticket, signal, ...value }) => ctx.http.request({
|
|
172
|
+
method: HttpMethod.Post,
|
|
173
|
+
path: ticketPath(ticket, "/identity-link"),
|
|
174
|
+
body: { schema: completeChannelIdentityLinkRequestSchema, value },
|
|
175
|
+
response: channelIdentityLinkProgressSchema,
|
|
176
|
+
signal
|
|
177
|
+
}),
|
|
178
|
+
connect: ({ ticket, signal, ...value }) => ctx.http.request({
|
|
179
|
+
method: HttpMethod.Post,
|
|
180
|
+
path: ticketPath(ticket, "/place-connection"),
|
|
181
|
+
body: { schema: completeChannelPlaceConnectionRequestSchema, value },
|
|
182
|
+
response: channelPlaceConnectionResponseSchema,
|
|
183
|
+
signal
|
|
184
|
+
})
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
const createIdentityLinksApi = (ctx) => {
|
|
188
|
+
const linksPath = (suffix = "") => `/v1/people/me/identity-links${suffix}`;
|
|
189
|
+
return {
|
|
190
|
+
list: async (options) => (await ctx.http.request({
|
|
191
|
+
method: HttpMethod.Get,
|
|
192
|
+
path: linksPath(),
|
|
193
|
+
query: { actor: options?.actor },
|
|
194
|
+
response: channelIdentityLinkListSchema,
|
|
195
|
+
signal: options?.signal
|
|
196
|
+
})).links,
|
|
197
|
+
update: async ({ id, signal, ...value }) => {
|
|
198
|
+
await ctx.http.request({
|
|
199
|
+
method: HttpMethod.Patch,
|
|
200
|
+
path: linksPath(`/${encodePath(id)}`),
|
|
201
|
+
body: { schema: updateChannelIdentityLinkRequestSchema, value },
|
|
202
|
+
response: okResponseSchema,
|
|
203
|
+
signal
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
delete: async ({ id, actor, signal }) => {
|
|
207
|
+
await ctx.http.request({
|
|
208
|
+
method: HttpMethod.Delete,
|
|
209
|
+
path: linksPath(`/${encodePath(id)}`),
|
|
210
|
+
query: { actor },
|
|
211
|
+
response: okResponseSchema,
|
|
212
|
+
signal
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
};
|
|
98
217
|
const noChannelSource = () => {
|
|
99
218
|
throw clientError({
|
|
100
219
|
message: "Publish a channel as `source`: this build cannot capture a channel value",
|
|
@@ -103,7 +222,10 @@ const noChannelSource = () => {
|
|
|
103
222
|
});
|
|
104
223
|
};
|
|
105
224
|
export {
|
|
225
|
+
createChannelAppsApi,
|
|
106
226
|
createChannelBindingsApi,
|
|
227
|
+
createChannelTicketsApi,
|
|
228
|
+
createIdentityLinksApi,
|
|
107
229
|
createProjectChannelsApi,
|
|
108
230
|
noChannelSource
|
|
109
231
|
};
|
|
@@ -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,
|
|
4
|
+
"sourcesContent": ["import {\n 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: { ...install, agents: { provide: provideDocumentOf(agents.provide) } },\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\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 ...(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: 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,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,OAmBK;AACP;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa,uBAAuB;AAC7C,SAAS,kBAAkB;AAC3B,SAAS,yBAA4C;AAsHrD,MAAM,eAAe,CAAC,WAAmB,WACvC,gBAAgB,WAAW,SAAS,CAAC,YAAY,MAAM;AAEzD,MAAM,cAAc,CAAC,WAAmB,SAAS,OAC/C,wBAAwB,WAAW,SAAS,CAAC,GAAG,MAAM;AAEjD,MAAM,2BAA2B,CAAC,SAIV;AAC7B,QAAM,EAAE,KAAK,IAAI,KAAK;AACtB,QAAM,eAAe,gBAAgB,WAAW,KAAK,SAAS,CAAC;AAC/D,SAAO;AAAA,IACL,SAAS,CAAC,YAAY;AACpB,YAAM,SACJ,aAAa,UACT,KAAK,SAAS,QAAQ,OAAO,IAC7B;AAAA,QACE,QAAQ,QAAQ;AAAA,QAChB,GAAI,QAAQ,UAAU,OAAO,CAAC,IAAI,EAAE,QAAQ,QAAQ,OAAO;AAAA,MAC7D;AACN,aAAO,KAAK,QAAQ;AAAA,QAClB,QAAQ,WAAW;AAA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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
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';
|
|
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";
|
|
@@ -12,7 +12,6 @@ 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
14
|
import { type PublishersApiIface } from "./publishers.mjs";
|
|
15
|
-
import { type SchedulesApiIface } from "./schedules.mjs";
|
|
16
15
|
import { type SessionsApiIface } from "./sessions.mjs";
|
|
17
16
|
/** Final's agents API. */
|
|
18
17
|
export declare const DEFAULT_AGENTS_HOST = "https://agent-session.final.ai";
|
|
@@ -84,6 +83,10 @@ export interface PeopleApiIface {
|
|
|
84
83
|
}) => Promise<PersonListIface>;
|
|
85
84
|
/** Every member of the caller's organization (all pages). */
|
|
86
85
|
all: (options?: SignalOptionsIface) => Promise<PersonIface[]>;
|
|
86
|
+
/** The caller's own person (or, for an API key or app, the actor it names). */
|
|
87
|
+
me: {
|
|
88
|
+
identityLinks: IdentityLinksApiIface;
|
|
89
|
+
};
|
|
87
90
|
}
|
|
88
91
|
export interface RealtimeApiIface {
|
|
89
92
|
/**
|
|
@@ -145,8 +148,10 @@ export interface AgentClientIface {
|
|
|
145
148
|
sessions: SessionsApiIface;
|
|
146
149
|
/** The caller's conversations; create them through `project({ id }).conversations`. */
|
|
147
150
|
conversations: ConversationsApiIface;
|
|
151
|
+
/** Channel installs by id; install them through `project({ id }).channels`. */
|
|
148
152
|
channelBindings: ChannelBindingsApiIface;
|
|
149
|
-
|
|
153
|
+
/** Tickets from an installer's link and connect pages. */
|
|
154
|
+
channelTickets: ChannelTicketsApiIface;
|
|
150
155
|
/**
|
|
151
156
|
* ACP-native access (`/acp/ws`): an ACP v2 ClientApp connection on which the
|
|
152
157
|
* agents API is the agent. The ACP SDK loads on the first `connect`.
|
|
@@ -11,7 +11,9 @@ import {
|
|
|
11
11
|
} from "@finalai/agent-protocol/agent-platform";
|
|
12
12
|
import { createAcpApi } from "./acp.mjs";
|
|
13
13
|
import {
|
|
14
|
-
createChannelBindingsApi
|
|
14
|
+
createChannelBindingsApi,
|
|
15
|
+
createChannelTicketsApi,
|
|
16
|
+
createIdentityLinksApi
|
|
15
17
|
} from "./channels.mjs";
|
|
16
18
|
import { encodePath } from "./context.mjs";
|
|
17
19
|
import { createConversationsApi } from "./conversations.mjs";
|
|
@@ -37,7 +39,6 @@ import {
|
|
|
37
39
|
import { createProjectClient } from "./project.mjs";
|
|
38
40
|
import { createProjectsApi } from "./projects.mjs";
|
|
39
41
|
import { createPublishersApi } from "./publishers.mjs";
|
|
40
|
-
import { createSchedulesApi } from "./schedules.mjs";
|
|
41
42
|
import { createSessionsApi } from "./sessions.mjs";
|
|
42
43
|
const DEFAULT_AGENTS_HOST = "https://agent-session.final.ai";
|
|
43
44
|
const createClient = (options) => {
|
|
@@ -149,7 +150,7 @@ const createClient = (options) => {
|
|
|
149
150
|
signal: listOptions?.signal
|
|
150
151
|
})
|
|
151
152
|
},
|
|
152
|
-
people:
|
|
153
|
+
people: (() => {
|
|
153
154
|
const list = (listOptions) => http.request({
|
|
154
155
|
method: HttpMethod.Get,
|
|
155
156
|
path: "/v1/people",
|
|
@@ -168,7 +169,8 @@ const createClient = (options) => {
|
|
|
168
169
|
if (next.nextCursor == null) return all;
|
|
169
170
|
cursor = next.nextCursor;
|
|
170
171
|
}
|
|
171
|
-
}
|
|
172
|
+
},
|
|
173
|
+
me: { identityLinks: createIdentityLinksApi(context) }
|
|
172
174
|
};
|
|
173
175
|
})(),
|
|
174
176
|
realtime: { createSession: createRealtimeSession },
|
|
@@ -211,7 +213,7 @@ const createClient = (options) => {
|
|
|
211
213
|
sessions: createSessionsApi(context),
|
|
212
214
|
conversations: createConversationsApi(context, clientLevel),
|
|
213
215
|
channelBindings: createChannelBindingsApi(context),
|
|
214
|
-
|
|
216
|
+
channelTickets: createChannelTicketsApi(context),
|
|
215
217
|
acp: createAcpApi({ http })
|
|
216
218
|
};
|
|
217
219
|
};
|