@finalai/agents 0.11.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/HOSTING.md +334 -245
- package/README.md +214 -29
- package/dist/modules/agent-client/agent-input.d.mts +24 -0
- package/dist/modules/agent-client/agent-input.mjs +46 -0
- package/dist/modules/agent-client/agent-input.mjs.map +7 -0
- package/dist/modules/agent-client/channels.d.mts +128 -16
- package/dist/modules/agent-client/channels.mjs +216 -33
- package/dist/modules/agent-client/channels.mjs.map +2 -2
- package/dist/modules/agent-client/client.d.mts +91 -21
- package/dist/modules/agent-client/client.mjs +79 -24
- package/dist/modules/agent-client/client.mjs.map +2 -2
- package/dist/modules/agent-client/config-options.mjs +1 -2
- package/dist/modules/agent-client/config-options.mjs.map +2 -2
- package/dist/modules/agent-client/conversation-resources.d.mts +102 -0
- package/dist/modules/agent-client/conversation-resources.mjs +178 -0
- package/dist/modules/agent-client/conversation-resources.mjs.map +7 -0
- package/dist/modules/agent-client/conversations.d.mts +120 -38
- package/dist/modules/agent-client/conversations.mjs +386 -71
- package/dist/modules/agent-client/conversations.mjs.map +2 -2
- package/dist/modules/agent-client/defaults.d.mts +8 -0
- package/dist/modules/agent-client/defaults.mjs +77 -0
- package/dist/modules/agent-client/defaults.mjs.map +7 -0
- package/dist/modules/agent-client/errors.d.mts +22 -2
- package/dist/modules/agent-client/errors.mjs +19 -0
- package/dist/modules/agent-client/errors.mjs.map +2 -2
- package/dist/modules/agent-client/events.d.mts +62 -0
- package/dist/modules/agent-client/events.mjs +107 -0
- package/dist/modules/agent-client/events.mjs.map +7 -0
- package/dist/modules/agent-client/harnesses.d.mts +66 -0
- package/dist/modules/agent-client/harnesses.mjs +156 -0
- package/dist/modules/agent-client/harnesses.mjs.map +7 -0
- package/dist/modules/agent-client/http.d.mts +2 -1
- package/dist/modules/agent-client/http.mjs +21 -2
- package/dist/modules/agent-client/http.mjs.map +2 -2
- package/dist/modules/agent-client/index.d.mts +21 -6
- package/dist/modules/agent-client/index.mjs +26 -0
- package/dist/modules/agent-client/index.mjs.map +2 -2
- package/dist/modules/agent-client/integrations.d.mts +40 -0
- package/dist/modules/agent-client/integrations.mjs +92 -0
- package/dist/modules/agent-client/integrations.mjs.map +7 -0
- package/dist/modules/agent-client/local-host-protocol.d.mts +156 -0
- package/dist/modules/agent-client/local-host-protocol.mjs +258 -0
- package/dist/modules/agent-client/local-host-protocol.mjs.map +7 -0
- package/dist/modules/agent-client/local-host.d.mts +56 -0
- package/dist/modules/agent-client/local-host.mjs +200 -0
- package/dist/modules/agent-client/local-host.mjs.map +7 -0
- package/dist/modules/agent-client/oauth-clients.d.mts +36 -0
- package/dist/modules/agent-client/oauth-clients.mjs +67 -0
- package/dist/modules/agent-client/oauth-clients.mjs.map +7 -0
- package/dist/modules/agent-client/project-agents.d.mts +54 -0
- package/dist/modules/agent-client/project-agents.mjs +111 -0
- package/dist/modules/agent-client/project-agents.mjs.map +7 -0
- package/dist/modules/agent-client/project.d.mts +48 -0
- package/dist/modules/agent-client/project.mjs +66 -0
- package/dist/modules/agent-client/project.mjs.map +7 -0
- package/dist/modules/agent-client/projects.d.mts +61 -0
- package/dist/modules/agent-client/projects.mjs +145 -0
- package/dist/modules/agent-client/projects.mjs.map +7 -0
- package/dist/modules/agent-client/provide.d.mts +41 -0
- package/dist/modules/agent-client/provide.mjs +90 -0
- package/dist/modules/agent-client/provide.mjs.map +7 -0
- package/dist/modules/agent-client/publishers.d.mts +57 -0
- package/dist/modules/agent-client/publishers.mjs +109 -0
- package/dist/modules/agent-client/publishers.mjs.map +7 -0
- package/dist/modules/agent-client/requirements.d.mts +60 -0
- package/dist/modules/agent-client/requirements.mjs +83 -0
- package/dist/modules/agent-client/requirements.mjs.map +7 -0
- package/dist/modules/agent-client/sandbox-providers.d.mts +34 -0
- package/dist/modules/agent-client/sandbox-providers.mjs +75 -0
- package/dist/modules/agent-client/sandbox-providers.mjs.map +7 -0
- package/dist/modules/agent-client/sandbox-uri.d.mts +1 -1
- package/dist/modules/agent-client/sandbox-uri.mjs +4 -4
- package/dist/modules/agent-client/sandbox-uri.mjs.map +1 -1
- package/dist/modules/agent-client/sandboxes.d.mts +72 -0
- package/dist/modules/agent-client/sandboxes.mjs +138 -0
- package/dist/modules/agent-client/sandboxes.mjs.map +7 -0
- package/dist/modules/agent-client/schedules.d.mts +9 -0
- package/dist/modules/agent-client/schedules.mjs +17 -0
- package/dist/modules/agent-client/schedules.mjs.map +7 -0
- package/dist/modules/agent-client/sessions.d.mts +46 -8
- package/dist/modules/agent-client/sessions.mjs +91 -29
- package/dist/modules/agent-client/sessions.mjs.map +2 -2
- package/dist/modules/agent-client/start.d.mts +101 -0
- package/dist/modules/agent-client/start.mjs +260 -0
- package/dist/modules/agent-client/start.mjs.map +7 -0
- package/dist/modules/agent-client/test-fakes.d.mts +1 -0
- package/dist/modules/agent-client/test-fakes.mjs +3 -1
- package/dist/modules/agent-client/test-fakes.mjs.map +2 -2
- package/dist/modules/cli/agent-module.d.mts +39 -0
- package/dist/modules/cli/agent-module.mjs +89 -0
- package/dist/modules/cli/agent-module.mjs.map +7 -0
- package/dist/modules/cli/cli.d.mts +6 -6
- package/dist/modules/cli/cli.mjs +94 -120
- package/dist/modules/cli/cli.mjs.map +2 -2
- package/dist/modules/cli/conformance.d.mts +2 -6
- package/dist/modules/cli/conformance.mjs +5 -8
- package/dist/modules/cli/conformance.mjs.map +2 -2
- package/dist/modules/cli/main.mjs.map +1 -1
- package/dist/modules/cli/output.d.mts +0 -9
- package/dist/modules/cli/output.mjs +7 -85
- package/dist/modules/cli/output.mjs.map +2 -2
- package/dist/modules/harnesses.mjs.map +2 -2
- package/dist/modules/index.d.mts +0 -2
- package/dist/modules/index.mjs +0 -4
- package/dist/modules/index.mjs.map +2 -2
- package/dist/modules/integrations.d.mts +24 -0
- package/dist/modules/integrations.mjs +30 -0
- package/dist/modules/integrations.mjs.map +7 -0
- package/dist/modules/public.d.mts +10 -10
- package/dist/modules/public.mjs +29 -78
- package/dist/modules/public.mjs.map +2 -2
- package/dist/modules/sandboxes.d.mts +2 -0
- package/dist/modules/sandboxes.mjs +4 -0
- package/dist/modules/sandboxes.mjs.map +2 -2
- package/dist/modules/verify.d.mts +1 -0
- package/dist/modules/verify.mjs +2 -0
- package/dist/modules/verify.mjs.map +7 -0
- package/dist/modules/webhooks.d.mts +37 -0
- package/dist/modules/webhooks.mjs +100 -0
- package/dist/modules/webhooks.mjs.map +7 -0
- package/examples/release-scout/README.md +18 -10
- package/examples/release-scout/agent.ts +41 -0
- package/examples/release-scout/by-name.ts +43 -0
- package/examples/release-scout/db.ts +6 -0
- package/examples/release-scout/instructions.md +5 -0
- package/examples/release-scout/run-on-a-computer.ts +49 -0
- package/examples/release-scout/run.ts +38 -0
- package/package.json +37 -28
- package/dist/modules/agent-client/build.d.mts +0 -110
- package/dist/modules/agent-client/build.mjs +0 -213
- package/dist/modules/agent-client/build.mjs.map +0 -7
- 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
- package/dist/modules/authoring/index.d.mts +0 -1
- package/dist/modules/authoring/index.mjs +0 -2
- package/dist/modules/authoring/index.mjs.map +0 -7
- package/dist/modules/authoring/instructions.d.mts +0 -1
- package/dist/modules/authoring/instructions.mjs +0 -2
- package/dist/modules/authoring/instructions.mjs.map +0 -7
- package/dist/modules/authoring/providers.d.mts +0 -2
- package/dist/modules/authoring/providers.mjs +0 -1
- package/dist/modules/authoring/providers.mjs.map +0 -7
- package/dist/modules/cli/build.d.mts +0 -22
- package/dist/modules/cli/build.mjs +0 -77
- package/dist/modules/cli/build.mjs.map +0 -7
- package/dist/modules/cli/channel-install.d.mts +0 -12
- package/dist/modules/cli/channel-install.mjs +0 -25
- package/dist/modules/cli/channel-install.mjs.map +0 -7
- package/dist/modules/cli/channel-socket.d.mts +0 -9
- package/dist/modules/cli/channel-socket.mjs +0 -114
- package/dist/modules/cli/channel-socket.mjs.map +0 -7
- package/dist/modules/cli/dev.d.mts +0 -26
- package/dist/modules/cli/dev.mjs +0 -311
- package/dist/modules/cli/dev.mjs.map +0 -7
- package/dist/modules/cli/files.d.mts +0 -18
- package/dist/modules/cli/files.mjs +0 -66
- package/dist/modules/cli/files.mjs.map +0 -7
- package/dist/modules/cli/harness-descriptions.d.mts +0 -20
- package/dist/modules/cli/harness-descriptions.mjs +0 -70
- package/dist/modules/cli/harness-descriptions.mjs.map +0 -7
- package/dist/modules/cli/publish.d.mts +0 -15
- package/dist/modules/cli/publish.mjs +0 -92
- package/dist/modules/cli/publish.mjs.map +0 -7
- package/dist/modules/compile.d.mts +0 -3
- package/dist/modules/compile.mjs +0 -58
- package/dist/modules/compile.mjs.map +0 -7
- package/dist/modules/index.browser.d.mts +0 -4
- package/dist/modules/index.browser.mjs +0 -8
- package/dist/modules/index.browser.mjs.map +0 -7
- package/examples/custom-harness/README.md +0 -16
- package/examples/custom-harness/agent.ts +0 -154
- package/examples/custom-sandbox/README.md +0 -12
- package/examples/custom-sandbox/agent.ts +0 -14
- package/examples/custom-sandbox/sandbox.ts +0 -24
- package/examples/release-scout/agent/agent.ts +0 -22
- package/examples/release-scout/agent/channels/github-signature.ts +0 -27
- package/examples/release-scout/agent/channels/github.ts +0 -32
- package/examples/release-scout/agent/connections/linear.ts +0 -9
- package/examples/release-scout/agent/hooks/audit.ts +0 -24
- package/examples/release-scout/agent/instructions/org-context.ts +0 -26
- package/examples/release-scout/agent/instructions.md +0 -2
- package/examples/release-scout/agent/sandbox.ts +0 -20
- package/examples/release-scout/agent/schedules/daily-digest.md +0 -7
- package/examples/release-scout/agent/skills/triage/SKILL.md +0 -8
- package/examples/release-scout/agent/skills/triage/checklist.md +0 -3
- package/examples/release-scout/agent/tools/lookup_release_notes.ts +0 -24
- package/examples/release-scout/client.ts +0 -122
|
@@ -1,49 +1,232 @@
|
|
|
1
1
|
import {
|
|
2
|
+
channelAppListSchema,
|
|
3
|
+
channelAppResponseSchema,
|
|
4
|
+
channelBindingListSchema,
|
|
5
|
+
channelBindingResponseSchema,
|
|
6
|
+
channelIdentityLinkListSchema,
|
|
7
|
+
channelIdentityLinkProgressSchema,
|
|
8
|
+
channelPlaceConnectionResponseSchema,
|
|
2
9
|
channelPlacesResponseSchema,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
channelSchema,
|
|
11
|
+
channelTenantTicketSchema,
|
|
12
|
+
channelTicketSchema,
|
|
13
|
+
completeChannelIdentityLinkRequestSchema,
|
|
14
|
+
completeChannelPlaceConnectionRequestSchema,
|
|
15
|
+
createChannelAppRequestSchema,
|
|
16
|
+
installChannelRequestSchema,
|
|
17
|
+
installedChannelResponseSchema,
|
|
18
|
+
okResponseSchema,
|
|
19
|
+
publishChannelRequestSchema,
|
|
20
|
+
publishChannelResponseSchema,
|
|
21
|
+
uninstallChannelBindingResponseSchema,
|
|
22
|
+
updateChannelAppRequestSchema,
|
|
23
|
+
updateChannelBindingRequestSchema,
|
|
24
|
+
updateChannelIdentityLinkRequestSchema
|
|
9
25
|
} from "@finalai/agent-protocol/agent-platform";
|
|
10
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
encodePath
|
|
28
|
+
} from "./context.mjs";
|
|
29
|
+
import { clientError, ClientErrorCode } from "./errors.mjs";
|
|
11
30
|
import { HttpMethod } from "./http.mjs";
|
|
31
|
+
import { provideDocumentOf } from "./provide.mjs";
|
|
32
|
+
const channelsPath = (projectId, suffix) => `/v1/projects/${encodePath(projectId)}/channels${suffix}`;
|
|
33
|
+
const bindingPath = (bindingId, suffix = "") => `/v1/channel-bindings/${encodePath(bindingId)}${suffix}`;
|
|
34
|
+
const createProjectChannelsApi = (args) => {
|
|
35
|
+
const { http } = args.context;
|
|
36
|
+
const installsPath = `/v1/projects/${encodePath(args.projectId)}/channel-bindings`;
|
|
37
|
+
return {
|
|
38
|
+
publish: (publish) => {
|
|
39
|
+
const source = "channel" in publish ? args.sourceOf(publish.channel) : {
|
|
40
|
+
source: publish.source,
|
|
41
|
+
...publish.export == null ? {} : { export: publish.export }
|
|
42
|
+
};
|
|
43
|
+
return http.request({
|
|
44
|
+
method: HttpMethod.Post,
|
|
45
|
+
path: channelsPath(args.projectId, "/publish"),
|
|
46
|
+
body: {
|
|
47
|
+
schema: publishChannelRequestSchema,
|
|
48
|
+
value: {
|
|
49
|
+
name: publish.name,
|
|
50
|
+
...source,
|
|
51
|
+
visibility: publish.visibility,
|
|
52
|
+
app: publish.app
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
response: publishChannelResponseSchema,
|
|
56
|
+
signal: publish.signal
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
get: ({ signal, ...selector }) => http.request({
|
|
60
|
+
method: HttpMethod.Get,
|
|
61
|
+
path: channelsPath(args.projectId, "/lookup"),
|
|
62
|
+
query: {
|
|
63
|
+
name: "name" in selector ? selector.name : void 0,
|
|
64
|
+
hash: "hash" in selector ? selector.hash : void 0
|
|
65
|
+
},
|
|
66
|
+
response: channelSchema,
|
|
67
|
+
signal
|
|
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
|
|
86
|
+
};
|
|
87
|
+
};
|
|
12
88
|
const createChannelBindingsApi = (ctx) => ({
|
|
13
|
-
|
|
14
|
-
method: HttpMethod.Post,
|
|
15
|
-
path: "/v1/channel-bindings",
|
|
16
|
-
body: { schema: createChannelBindingRequestSchema, value: body },
|
|
17
|
-
response: createChannelBindingResponseSchema,
|
|
18
|
-
signal
|
|
19
|
-
}),
|
|
20
|
-
places: async ({ bindingId, signal }) => (await ctx.http.request({
|
|
89
|
+
get: async ({ bindingId, signal }) => (await ctx.http.request({
|
|
21
90
|
method: HttpMethod.Get,
|
|
22
|
-
path:
|
|
23
|
-
response:
|
|
91
|
+
path: bindingPath(bindingId),
|
|
92
|
+
response: channelBindingResponseSchema,
|
|
24
93
|
signal
|
|
25
|
-
})).
|
|
26
|
-
|
|
27
|
-
method: HttpMethod.
|
|
28
|
-
path:
|
|
29
|
-
|
|
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,
|
|
106
|
+
signal
|
|
107
|
+
}),
|
|
108
|
+
uninstall: ({ bindingId, signal }) => ctx.http.request({
|
|
109
|
+
method: HttpMethod.Delete,
|
|
110
|
+
path: bindingPath(bindingId),
|
|
111
|
+
response: uninstallChannelBindingResponseSchema,
|
|
30
112
|
signal
|
|
31
|
-
})
|
|
32
|
-
|
|
113
|
+
}),
|
|
114
|
+
tenantTicket: ({ bindingId, signal }) => ctx.http.request({
|
|
33
115
|
method: HttpMethod.Post,
|
|
34
|
-
path:
|
|
35
|
-
|
|
36
|
-
response: connectChannelPlaceResponseSchema,
|
|
116
|
+
path: bindingPath(bindingId, "/tenant-tickets"),
|
|
117
|
+
response: channelTenantTicketSchema,
|
|
37
118
|
signal
|
|
38
119
|
}),
|
|
39
|
-
|
|
40
|
-
method: HttpMethod.
|
|
41
|
-
path:
|
|
42
|
-
response:
|
|
120
|
+
places: async ({ bindingId, signal }) => (await ctx.http.request({
|
|
121
|
+
method: HttpMethod.Get,
|
|
122
|
+
path: bindingPath(bindingId, "/places"),
|
|
123
|
+
response: channelPlacesResponseSchema,
|
|
43
124
|
signal
|
|
44
|
-
})
|
|
125
|
+
})).places
|
|
45
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
|
+
};
|
|
217
|
+
const noChannelSource = () => {
|
|
218
|
+
throw clientError({
|
|
219
|
+
message: "Publish a channel as `source`: this build cannot capture a channel value",
|
|
220
|
+
status: 0,
|
|
221
|
+
code: ClientErrorCode.InvalidRequest
|
|
222
|
+
});
|
|
223
|
+
};
|
|
46
224
|
export {
|
|
47
|
-
|
|
225
|
+
createChannelAppsApi,
|
|
226
|
+
createChannelBindingsApi,
|
|
227
|
+
createChannelTicketsApi,
|
|
228
|
+
createIdentityLinksApi,
|
|
229
|
+
createProjectChannelsApi,
|
|
230
|
+
noChannelSource
|
|
48
231
|
};
|
|
49
232
|
//# sourceMappingURL=channels.mjs.map
|
|
@@ -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 connectChannelPlaceRequestSchema,\n connectChannelPlaceResponseSchema,\n createChannelBindingRequestSchema,\n createChannelBindingResponseSchema,\n disconnectChannelRouteResponseSchema,\n type ChannelRouteIface,\n type ChannelSeenPlaceIface,\n type ConnectChannelPlaceRequestIface,\n type CreateChannelBindingRequestIface,\n type CreateChannelBindingResponseIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport { encodePath, type ClientContextIface, type SignalOptionsIface } from \"./context.mjs\";\nimport { HttpMethod } from \"./http.mjs\";\nexport interface ChannelBindingsApiIface {\n create(\n args: CreateChannelBindingRequestIface & SignalOptionsIface,\n ): Promise<CreateChannelBindingResponseIface>;\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}\nexport const createChannelBindingsApi = (ctx: ClientContextIface): ChannelBindingsApiIface => ({\n create: ({ signal, ...body }) =>\n ctx.http.request({\n method: HttpMethod.Post,\n path: '/v1/channel-bindings',\n body: { schema: createChannelBindingRequestSchema, value: body },\n response: createChannelBindingResponseSchema,\n signal,\n }),\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"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;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;A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I,KAAK,QAAQ;AAAA,MACrB,QAAQ,WAAW;AAAA,MACnB,MAAM,UAAU;AAAA,MAChB,OAAO,EAAE,OAAO,SAAS,MAAM;AAAA,MAC/B,UAAU;AAAA,MACV,QAAQ,SAAS;AAAA,IACnB,CAAC,GACD;AAAA,IACJ,QAAQ,OAAO,EAAE,IAAI,QAAQ,GAAG,MAAM,MAAM;AAC1C,YAAM,IAAI,KAAK,QAAQ;AAAA,QACrB,QAAQ,WAAW;AAAA,QACnB,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC,EAAE;AAAA,QACpC,MAAM,EAAE,QAAQ,wCAAwC,MAAM;AAAA,QAC9D,UAAU;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,QAAQ,OAAO,EAAE,IAAI,OAAO,OAAO,MAAM;AACvC,YAAM,IAAI,KAAK,QAAQ;AAAA,QACrB,QAAQ,WAAW;AAAA,QACnB,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC,EAAE;AAAA,QACpC,OAAO,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,20 +1,35 @@
|
|
|
1
|
-
import { type
|
|
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
|
-
import
|
|
3
|
+
import type { AgentValueCodecIface } from "./agent-input.mjs";
|
|
4
|
+
import { type ChannelBindingsApiIface, type ChannelSourceOf, type ChannelTicketsApiIface, type IdentityLinksApiIface } from "./channels.mjs";
|
|
4
5
|
import { type SignalOptionsIface } from "./context.mjs";
|
|
5
|
-
import { type ChannelBindingsApiIface } from "./channels.mjs";
|
|
6
6
|
import { type ConversationsApiIface } from "./conversations.mjs";
|
|
7
|
+
import { type EventsApiIface, type EventSubscriptionsApiIface } from "./events.mjs";
|
|
7
8
|
import { type StreamTimingIface } from "./frame-stream.mjs";
|
|
8
9
|
import { type AgentClientAuth, type FetchIface, type HeadersOption } from "./http.mjs";
|
|
9
10
|
import { type GatewayConnect, type RealtimeTransportIface } from "./realtime.mjs";
|
|
11
|
+
import type { LocalComputeIface, LocalHostSocketIface } from "./local-host.mjs";
|
|
12
|
+
import { type ProjectClientIface } from "./project.mjs";
|
|
13
|
+
import { type ProjectsApiIface } from "./projects.mjs";
|
|
14
|
+
import { type PublishersApiIface } from "./publishers.mjs";
|
|
10
15
|
import { type SessionsApiIface } from "./sessions.mjs";
|
|
16
|
+
/** Final's agents API. */
|
|
17
|
+
export declare const DEFAULT_AGENTS_HOST = "https://agent-session.final.ai";
|
|
11
18
|
export interface CreateClientOptionsIface {
|
|
19
|
+
auth: AgentClientAuth;
|
|
12
20
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
21
|
+
* Whether this process provides the files and shell an agent requires when
|
|
22
|
+
* the caller leaves them out (default true), so the model's file edits and
|
|
23
|
+
* commands run here, on this machine. A server should provide every
|
|
24
|
+
* capability explicitly and pass false, so an omission fails with
|
|
25
|
+
* `requirements_unmet` instead of giving the model a shell in the server.
|
|
15
26
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
localCompute?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The agents API origin (default `https://agent-session.final.ai`; its API is
|
|
30
|
+
* under `/api` and ACP at `/acp/ws`), or a base URL the API routes are mounted under.
|
|
31
|
+
*/
|
|
32
|
+
host?: string;
|
|
18
33
|
/** Extra headers per request; console clients send their client identity header here. */
|
|
19
34
|
headers?: HeadersOption;
|
|
20
35
|
/** API requests (the host's routes); carries auth and caller headers. */
|
|
@@ -36,24 +51,29 @@ export interface CreateClientOptionsIface {
|
|
|
36
51
|
newKey?: () => string;
|
|
37
52
|
/** Seam for the client clock (conversation recovery windows). */
|
|
38
53
|
now?: () => number;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
/** Seam: how agent values become documents and in-process code. */
|
|
55
|
+
agentCodec?: AgentValueCodecIface;
|
|
56
|
+
/** Seam: how a channel value becomes its source. */
|
|
57
|
+
channelSourceOf?: ChannelSourceOf;
|
|
58
|
+
/** Seams for local hosts: the socket, and the sandbox this process serves. */
|
|
59
|
+
localHosts?: {
|
|
60
|
+
/** Opens the local host socket; abandons it when `signal` aborts. */
|
|
61
|
+
dial?: (path: string, signal?: AbortSignal) => Promise<LocalHostSocketIface>;
|
|
62
|
+
compute?: Partial<LocalComputeIface>;
|
|
63
|
+
};
|
|
43
64
|
}
|
|
44
65
|
export interface AgentsApiIface {
|
|
45
66
|
/**
|
|
46
67
|
* The agents the caller can use; with `projectId`, those usable there (its own and those
|
|
47
68
|
* inherited from its ancestors). Without it, everything the caller can access (an API key: its
|
|
48
69
|
* parent project and every project it is granted; a person: every project they can read).
|
|
70
|
+
* Fetch one as data with `client.project({ id }).agents.get`.
|
|
49
71
|
*/
|
|
50
72
|
list: (options?: SignalOptionsIface & {
|
|
51
73
|
cursor?: string;
|
|
52
74
|
limit?: number;
|
|
53
75
|
projectId?: string;
|
|
54
76
|
}) => Promise<AgentListIface>;
|
|
55
|
-
/** I/O-free handle by slug or id. */
|
|
56
|
-
get: (slugOrId: string) => AgentHandleIface;
|
|
57
77
|
}
|
|
58
78
|
export interface PeopleApiIface {
|
|
59
79
|
/** One page of the caller's organization members, by name; pass `nextCursor` as `cursor` for the next. */
|
|
@@ -63,6 +83,10 @@ export interface PeopleApiIface {
|
|
|
63
83
|
}) => Promise<PersonListIface>;
|
|
64
84
|
/** Every member of the caller's organization (all pages). */
|
|
65
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
|
+
};
|
|
66
90
|
}
|
|
67
91
|
export interface RealtimeApiIface {
|
|
68
92
|
/**
|
|
@@ -72,28 +96,74 @@ export interface RealtimeApiIface {
|
|
|
72
96
|
*/
|
|
73
97
|
createSession: (options?: SignalOptionsIface) => Promise<RealtimeSessionResponseIface>;
|
|
74
98
|
}
|
|
99
|
+
export interface InferenceApiIface {
|
|
100
|
+
/**
|
|
101
|
+
* The vendors and models the platform's own metered inference serves, with
|
|
102
|
+
* prices (`GET /v1/inference/offering`, public). A harness using the
|
|
103
|
+
* platform's inference can run only models listed here.
|
|
104
|
+
*/
|
|
105
|
+
offering: (options?: SignalOptionsIface) => Promise<InferenceOfferingIface>;
|
|
106
|
+
}
|
|
107
|
+
export interface PlatformIdentityApiIface {
|
|
108
|
+
/**
|
|
109
|
+
* Exchanges a sandbox-provider (or downstream) assertion the platform issued
|
|
110
|
+
* for a fresh one: for the provider's own URL (a refresh) or a backend its
|
|
111
|
+
* registration was granted. The subject token is the credential.
|
|
112
|
+
*/
|
|
113
|
+
exchange: (args: PlatformIdentityExchangeRequestIface & SignalOptionsIface) => Promise<PlatformIdentityExchangeResponseIface>;
|
|
114
|
+
}
|
|
115
|
+
export interface DecisionsApiIface {
|
|
116
|
+
/** One decision awaiting the caller's answer, as `conversations.decisions` lists it. */
|
|
117
|
+
get: (args: {
|
|
118
|
+
id: string;
|
|
119
|
+
} & SignalOptionsIface) => Promise<DecisionIface>;
|
|
120
|
+
}
|
|
121
|
+
export interface AppApiIface {
|
|
122
|
+
/**
|
|
123
|
+
* The calling app's event subscriptions, across every organization that
|
|
124
|
+
* installed it. Needs an app-level token.
|
|
125
|
+
*/
|
|
126
|
+
eventSubscriptions: EventSubscriptionsApiIface;
|
|
127
|
+
}
|
|
75
128
|
export interface AgentClientIface {
|
|
129
|
+
/** One project: where sessions, conversations, sandboxes and integrations are created. */
|
|
130
|
+
project: (args: {
|
|
131
|
+
id: string;
|
|
132
|
+
}) => ProjectClientIface;
|
|
133
|
+
/** The project tree: list projects and create them. */
|
|
134
|
+
projects: ProjectsApiIface;
|
|
135
|
+
/** The event feed across everything the caller can see; `project({ id }).events` narrows it. */
|
|
136
|
+
events: EventsApiIface;
|
|
137
|
+
app: AppApiIface;
|
|
138
|
+
/** Publishers' public agents, channels, harnesses and ACP adapters. */
|
|
139
|
+
publishers: PublishersApiIface;
|
|
140
|
+
inference: InferenceApiIface;
|
|
141
|
+
platformIdentity: PlatformIdentityApiIface;
|
|
142
|
+
decisions: DecisionsApiIface;
|
|
76
143
|
health: (options?: SignalOptionsIface) => Promise<HealthResponseIface>;
|
|
77
144
|
agents: AgentsApiIface;
|
|
78
145
|
people: PeopleApiIface;
|
|
79
146
|
realtime: RealtimeApiIface;
|
|
147
|
+
/** Existing sessions by id; create them through `project({ id }).sessions`. */
|
|
80
148
|
sessions: SessionsApiIface;
|
|
149
|
+
/** The caller's conversations; create them through `project({ id }).conversations`. */
|
|
81
150
|
conversations: ConversationsApiIface;
|
|
151
|
+
/** Channel installs by id; install them through `project({ id }).channels`. */
|
|
82
152
|
channelBindings: ChannelBindingsApiIface;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
computerSetupGuides: ComputerSetupGuidesApiIface;
|
|
86
|
-
schedules: SchedulesApiIface;
|
|
153
|
+
/** Tickets from an installer's link and connect pages. */
|
|
154
|
+
channelTickets: ChannelTicketsApiIface;
|
|
87
155
|
/**
|
|
88
156
|
* ACP-native access (`/acp/ws`): an ACP v2 ClientApp connection on which the
|
|
89
157
|
* agents API is the agent. The ACP SDK loads on the first `connect`.
|
|
90
158
|
*/
|
|
91
159
|
acp: AcpApiIface;
|
|
92
160
|
/**
|
|
93
|
-
* Ends every stream (they reject with a `client_closed` ClientError) and
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
161
|
+
* Ends every stream (they reject with a `client_closed` ClientError) and every
|
|
162
|
+
* local host connection (the platform then reports this process's tools and
|
|
163
|
+
* compute as unavailable; sessions carry on) and, when the client created its
|
|
164
|
+
* own realtime transport, closes the gateway connection and cancels its
|
|
165
|
+
* retries. A transport passed in `realtime` belongs to the caller and is left
|
|
166
|
+
* open. Idempotent.
|
|
97
167
|
*/
|
|
98
168
|
close: () => void;
|
|
99
169
|
[Symbol.asyncDispose]: () => Promise<void>;
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
agentInfoSchema,
|
|
3
2
|
agentListSchema,
|
|
4
3
|
agentRealtimeTopics,
|
|
4
|
+
decisionResponseSchema,
|
|
5
5
|
healthResponseSchema,
|
|
6
|
+
inferenceOfferingSchema,
|
|
6
7
|
personListSchema,
|
|
8
|
+
platformIdentityExchangeRequestSchema,
|
|
9
|
+
platformIdentityExchangeResponseSchema,
|
|
7
10
|
realtimeSessionResponseSchema
|
|
8
11
|
} from "@finalai/agent-protocol/agent-platform";
|
|
9
12
|
import { createAcpApi } from "./acp.mjs";
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./build.mjs";
|
|
14
|
+
createChannelBindingsApi,
|
|
15
|
+
createChannelTicketsApi,
|
|
16
|
+
createIdentityLinksApi
|
|
17
|
+
} from "./channels.mjs";
|
|
16
18
|
import { encodePath } from "./context.mjs";
|
|
17
|
-
import { createChannelBindingsApi } from "./channels.mjs";
|
|
18
19
|
import { createConversationsApi } from "./conversations.mjs";
|
|
20
|
+
import {
|
|
21
|
+
defaultAgentCodec,
|
|
22
|
+
defaultChannelSourceOf,
|
|
23
|
+
defaultLocalCompute,
|
|
24
|
+
defaultLocalHostDial
|
|
25
|
+
} from "./defaults.mjs";
|
|
19
26
|
import { clientError, ClientErrorCode } from "./errors.mjs";
|
|
27
|
+
import {
|
|
28
|
+
createEventsApi,
|
|
29
|
+
createEventSubscriptionsApi
|
|
30
|
+
} from "./events.mjs";
|
|
20
31
|
import { defaultStreamTiming } from "./frame-stream.mjs";
|
|
21
32
|
import {
|
|
22
33
|
createHttp,
|
|
@@ -25,10 +36,14 @@ import {
|
|
|
25
36
|
import {
|
|
26
37
|
createGatewayRealtimeTransport
|
|
27
38
|
} from "./realtime.mjs";
|
|
39
|
+
import { createProjectClient } from "./project.mjs";
|
|
40
|
+
import { createProjectsApi } from "./projects.mjs";
|
|
41
|
+
import { createPublishersApi } from "./publishers.mjs";
|
|
28
42
|
import { createSessionsApi } from "./sessions.mjs";
|
|
43
|
+
const DEFAULT_AGENTS_HOST = "https://agent-session.final.ai";
|
|
29
44
|
const createClient = (options) => {
|
|
30
45
|
const http = createHttp({
|
|
31
|
-
host: options.host,
|
|
46
|
+
host: options.host ?? DEFAULT_AGENTS_HOST,
|
|
32
47
|
auth: options.auth,
|
|
33
48
|
headers: options.headers,
|
|
34
49
|
fetch: options.fetch
|
|
@@ -92,11 +107,25 @@ const createClient = (options) => {
|
|
|
92
107
|
newKey: options.newKey ?? (() => globalThis.crypto.randomUUID()),
|
|
93
108
|
now: options.now ?? Date.now
|
|
94
109
|
};
|
|
110
|
+
const hosts = /* @__PURE__ */ new Set();
|
|
111
|
+
const localCompute = defaultLocalCompute();
|
|
112
|
+
const start = {
|
|
113
|
+
context,
|
|
114
|
+
codec: options.agentCodec ?? defaultAgentCodec,
|
|
115
|
+
localCompute: options.localCompute ?? true,
|
|
116
|
+
compute: { ...localCompute, ...options.localHosts?.compute },
|
|
117
|
+
dial: options.localHosts?.dial ?? defaultLocalHostDial(http),
|
|
118
|
+
hosts
|
|
119
|
+
};
|
|
120
|
+
const channelSourceOf = options.channelSourceOf ?? defaultChannelSourceOf;
|
|
121
|
+
const clientLevel = { deps: start, projectId: null };
|
|
95
122
|
const close = () => {
|
|
96
123
|
if (closing.signal.aborted) return;
|
|
97
124
|
closing.abort(
|
|
98
125
|
clientError({ message: "Agent client closed", status: 0, code: ClientErrorCode.Closed })
|
|
99
126
|
);
|
|
127
|
+
for (const host of hosts) host.close();
|
|
128
|
+
hosts.clear();
|
|
100
129
|
ownTransport?.close();
|
|
101
130
|
};
|
|
102
131
|
return {
|
|
@@ -119,18 +148,9 @@ const createClient = (options) => {
|
|
|
119
148
|
},
|
|
120
149
|
response: agentListSchema,
|
|
121
150
|
signal: listOptions?.signal
|
|
122
|
-
}),
|
|
123
|
-
get: (slugOrId) => ({
|
|
124
|
-
slug: slugOrId,
|
|
125
|
-
info: (infoOptions) => http.request({
|
|
126
|
-
method: HttpMethod.Get,
|
|
127
|
-
path: `/v1/agents/${encodePath(slugOrId)}`,
|
|
128
|
-
response: agentInfoSchema,
|
|
129
|
-
signal: infoOptions?.signal
|
|
130
|
-
})
|
|
131
151
|
})
|
|
132
152
|
},
|
|
133
|
-
people:
|
|
153
|
+
people: (() => {
|
|
134
154
|
const list = (listOptions) => http.request({
|
|
135
155
|
method: HttpMethod.Get,
|
|
136
156
|
path: "/v1/people",
|
|
@@ -149,21 +169,56 @@ const createClient = (options) => {
|
|
|
149
169
|
if (next.nextCursor == null) return all;
|
|
150
170
|
cursor = next.nextCursor;
|
|
151
171
|
}
|
|
152
|
-
}
|
|
172
|
+
},
|
|
173
|
+
me: { identityLinks: createIdentityLinksApi(context) }
|
|
153
174
|
};
|
|
154
175
|
})(),
|
|
155
176
|
realtime: { createSession: createRealtimeSession },
|
|
177
|
+
project: ({ id }) => createProjectClient({ context, start, channelSourceOf, projectId: id }),
|
|
178
|
+
projects: createProjectsApi(context),
|
|
179
|
+
events: createEventsApi({ context, projectId: null }),
|
|
180
|
+
app: {
|
|
181
|
+
eventSubscriptions: createEventSubscriptionsApi({
|
|
182
|
+
context,
|
|
183
|
+
basePath: "/v1/apps/me/event-subscriptions"
|
|
184
|
+
})
|
|
185
|
+
},
|
|
186
|
+
publishers: createPublishersApi(context),
|
|
187
|
+
inference: {
|
|
188
|
+
offering: (offeringOptions) => http.request({
|
|
189
|
+
method: HttpMethod.Get,
|
|
190
|
+
path: "/v1/inference/offering",
|
|
191
|
+
response: inferenceOfferingSchema,
|
|
192
|
+
signal: offeringOptions?.signal
|
|
193
|
+
})
|
|
194
|
+
},
|
|
195
|
+
platformIdentity: {
|
|
196
|
+
exchange: ({ signal, ...value }) => http.request({
|
|
197
|
+
method: HttpMethod.Post,
|
|
198
|
+
path: "/v1/platform-identity/exchange",
|
|
199
|
+
body: { schema: platformIdentityExchangeRequestSchema, value },
|
|
200
|
+
response: platformIdentityExchangeResponseSchema,
|
|
201
|
+
signal
|
|
202
|
+
})
|
|
203
|
+
},
|
|
204
|
+
decisions: {
|
|
205
|
+
get: async ({ id, signal }) => (await http.request({
|
|
206
|
+
method: HttpMethod.Get,
|
|
207
|
+
path: `/v1/decisions/${encodePath(id)}`,
|
|
208
|
+
response: decisionResponseSchema,
|
|
209
|
+
signal,
|
|
210
|
+
context: { decisionId: id }
|
|
211
|
+
})).decision
|
|
212
|
+
},
|
|
156
213
|
sessions: createSessionsApi(context),
|
|
157
|
-
conversations: createConversationsApi(context),
|
|
214
|
+
conversations: createConversationsApi(context, clientLevel),
|
|
158
215
|
channelBindings: createChannelBindingsApi(context),
|
|
159
|
-
|
|
160
|
-
providers: createProvidersApi(context),
|
|
161
|
-
computerSetupGuides: createComputerSetupGuidesApi(context),
|
|
162
|
-
schedules: createSchedulesApi(context),
|
|
216
|
+
channelTickets: createChannelTicketsApi(context),
|
|
163
217
|
acp: createAcpApi({ http })
|
|
164
218
|
};
|
|
165
219
|
};
|
|
166
220
|
export {
|
|
221
|
+
DEFAULT_AGENTS_HOST,
|
|
167
222
|
createClient
|
|
168
223
|
};
|
|
169
224
|
//# sourceMappingURL=client.mjs.map
|