@finalai/agents 0.6.3 → 0.9.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 +4 -4
- package/README.md +2 -0
- package/dist/modules/agent-client/acp.mjs.map +2 -2
- package/dist/modules/agent-client/build.d.mts +2 -10
- package/dist/modules/agent-client/build.mjs +0 -9
- package/dist/modules/agent-client/build.mjs.map +2 -2
- package/dist/modules/agent-client/channels.d.mts +23 -0
- package/dist/modules/agent-client/channels.mjs +49 -0
- package/dist/modules/agent-client/channels.mjs.map +7 -0
- package/dist/modules/agent-client/client.d.mts +2 -0
- package/dist/modules/agent-client/client.mjs +2 -0
- package/dist/modules/agent-client/client.mjs.map +2 -2
- package/dist/modules/agent-client/conversations.d.mts +8 -10
- package/dist/modules/agent-client/conversations.mjs.map +2 -2
- package/dist/modules/agent-client/http.mjs.map +2 -2
- package/dist/modules/agent-client/index.d.mts +1 -0
- package/dist/modules/agent-client/index.mjs.map +1 -1
- package/dist/modules/cli/channel-install.d.mts +10 -0
- package/dist/modules/cli/channel-install.mjs +32 -0
- package/dist/modules/cli/channel-install.mjs.map +7 -0
- package/dist/modules/cli/cli.mjs +23 -1
- package/dist/modules/cli/cli.mjs.map +2 -2
- package/dist/modules/cli/dev.d.mts +2 -0
- package/dist/modules/cli/dev.mjs +70 -8
- package/dist/modules/cli/dev.mjs.map +2 -2
- package/dist/modules/compile.mjs +7 -0
- package/dist/modules/compile.mjs.map +2 -2
- package/dist/modules/public.d.mts +2 -2
- package/dist/modules/public.mjs +2 -0
- package/dist/modules/public.mjs.map +2 -2
- package/examples/release-scout/agent/channels/github.ts +2 -38
- package/examples/release-scout/agent/hooks/audit.ts +1 -1
- package/examples/release-scout/agent/instructions/org-context.ts +1 -1
- package/package.json +7 -7
package/HOSTING.md
CHANGED
|
@@ -240,7 +240,7 @@ before running. Shared manifest resolution rejects null results for required slo
|
|
|
240
240
|
even if a host catches a resolver exception and returns null. Hosts must propagate
|
|
241
241
|
that failure to startup. Session-started values stay pinned across turns and resume.
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
Hosts can use the compiled requirements to show
|
|
244
244
|
which names need configuration and return an actionable deployment-specific error.
|
|
245
245
|
|
|
246
246
|
## Host integration
|
|
@@ -269,6 +269,6 @@ Optional readers preserve source compatibility with existing hosts. Definitions
|
|
|
269
269
|
requesting bindings fail clearly if hosting does not provide them. Installing these
|
|
270
270
|
packages alone does not change Final's deployed service wiring or provision secrets.
|
|
271
271
|
|
|
272
|
-
New compiles emit manifest version
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
New compiles emit manifest version 4. Hosts and stored revisions must use v4;
|
|
273
|
+
recompile older definitions before loading them. Upgrade hosting before
|
|
274
|
+
publishing newly compiled agents.
|
package/README.md
CHANGED
|
@@ -35,3 +35,5 @@ connection resolved by hosting at session start. `defineFinalConnection()` uses
|
|
|
35
35
|
the same path with the `final` binding. Explicit URL declarations remain static.
|
|
36
36
|
See the repository's [hosting guide](HOSTING.md) for provider contexts,
|
|
37
37
|
resource lookup, and the required hosting integration.
|
|
38
|
+
|
|
39
|
+
Local provider webhook previews can use `AGENT_LOCAL_APP_INFO_JSON`, a JSON object keyed by the declared application name, for example `slack`. Each value contains `clientId`, `clientSecret`, and optional `signingSecret`. Only that channel's declared application's metadata is supplied, and access tokens are never included. Member, chat, and media operations still require a real host.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/agent-client/acp.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n AnyWireMessage,\n ClientApp,\n ClientConnection,\n} from '@agentclientprotocol/sdk/experimental/v2';\nimport type { WebSocketConstructor } from '@agentclientprotocol/sdk/experimental/ws-client';\nimport {\n ACP_TICKET_SUBPROTOCOL_PREFIX,\n ACP_WS_SUBPROTOCOL,\n acpTicketRequestSchema,\n acpTicketSchema,\n} from '@finalai/agent-protocol/agent-platform';\nimport type { SignalOptionsIface } from \"./context.mjs\";\nimport { createHttp, HttpMethod, type CreateHttpOptionsIface, type HttpIface } from \"./http.mjs\";\n\n// ACP-native access: the session service serves a standard ACP v2 agent at\n// `/acp/ws`. Callers bring a ClientApp with their handlers (session updates,\n// permission requests); `?agent=` is the agent a plain `session/new` opens,\n// and `_meta[\"final.ai\"].agent` names one per session.\n\n/** How the WebSocket upgrade authenticates. */\nexport enum AcpAuthMode {\n /** The client's authorization header (Node and other runtimes that can set headers). */\n Headers = 'headers',\n /**\n * A single-use ticket minted over HTTP (`POST /v1/acp/tickets`) and offered\n * as a subprotocol: for browsers, whose WebSocket cannot send headers.\n */\n Ticket = 'ticket',\n}\n\nexport interface AcpConnectArgsIface extends SignalOptionsIface {\n /** Agent slug or id; may instead be given in `session/new` `_meta`. */\n agent?: string;\n /** The ClientApp to connect; defaults to an app with no handlers. */\n app?: ClientApp;\n /** WebSocket constructor for Node (for example `ws.WebSocket`); browsers use the global. */\n WebSocket?: WebSocketConstructor;\n /** Defaults to `Ticket` for cookie-authenticated (browser) clients, `Headers` otherwise. */\n authMode?: AcpAuthMode;\n}\n\nexport interface AcpApiIface {\n connect: (args?: AcpConnectArgsIface) => Promise<ClientConnection>;\n}\n\nexport const acpWebSocketUrl = (args: { host: URL; agent?: string; endpoint?: string }): string => {\n //
|
|
5
|
-
"mappings": "AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,YAAY,kBAA+D;AAQ7E,IAAK,cAAL,kBAAKA,iBAAL;AAEL,EAAAA,aAAA,aAAU;AAKV,EAAAA,aAAA,YAAS;AAPC,SAAAA;AAAA,GAAA;AAyBL,MAAM,kBAAkB,CAAC,SAAmE;
|
|
4
|
+
"sourcesContent": ["import type {\n AnyWireMessage,\n ClientApp,\n ClientConnection,\n} from '@agentclientprotocol/sdk/experimental/v2';\nimport type { WebSocketConstructor } from '@agentclientprotocol/sdk/experimental/ws-client';\nimport {\n ACP_TICKET_SUBPROTOCOL_PREFIX,\n ACP_WS_SUBPROTOCOL,\n acpTicketRequestSchema,\n acpTicketSchema,\n} from '@finalai/agent-protocol/agent-platform';\nimport type { SignalOptionsIface } from \"./context.mjs\";\nimport { createHttp, HttpMethod, type CreateHttpOptionsIface, type HttpIface } from \"./http.mjs\";\n\n// ACP-native access: the session service serves a standard ACP v2 agent at\n// `/acp/ws`. Callers bring a ClientApp with their handlers (session updates,\n// permission requests); `?agent=` is the agent a plain `session/new` opens,\n// and `_meta[\"final.ai\"].agent` names one per session.\n\n/** How the WebSocket upgrade authenticates. */\nexport enum AcpAuthMode {\n /** The client's authorization header (Node and other runtimes that can set headers). */\n Headers = 'headers',\n /**\n * A single-use ticket minted over HTTP (`POST /v1/acp/tickets`) and offered\n * as a subprotocol: for browsers, whose WebSocket cannot send headers.\n */\n Ticket = 'ticket',\n}\n\nexport interface AcpConnectArgsIface extends SignalOptionsIface {\n /** Agent slug or id; may instead be given in `session/new` `_meta`. */\n agent?: string;\n /** The ClientApp to connect; defaults to an app with no handlers. */\n app?: ClientApp;\n /** WebSocket constructor for Node (for example `ws.WebSocket`); browsers use the global. */\n WebSocket?: WebSocketConstructor;\n /** Defaults to `Ticket` for cookie-authenticated (browser) clients, `Headers` otherwise. */\n authMode?: AcpAuthMode;\n}\n\nexport interface AcpApiIface {\n connect: (args?: AcpConnectArgsIface) => Promise<ClientConnection>;\n}\n\nexport const acpWebSocketUrl = (args: { host: URL; agent?: string; endpoint?: string }): string => {\n // A connection ticket can select a WebSocket endpoint outside the HTTP API prefix.\n const url = args.endpoint == null ? new URL('/acp/ws', args.host) : new URL(args.endpoint);\n url.protocol = url.protocol === 'http:' || url.protocol === 'ws:' ? 'ws:' : 'wss:';\n if (args.agent != null) url.searchParams.set('agent', args.agent);\n return url.toString();\n};\n\nexport interface AcpTransportIface {\n url: string;\n headers: Record<string, string>;\n protocols: string[] | undefined;\n}\n\n/** Where and how `connect` opens the socket; exported for tests. */\nexport const resolveAcpTransport = async (\n http: HttpIface,\n args: AcpConnectArgsIface | undefined,\n): Promise<AcpTransportIface> => {\n const mode = args?.authMode ?? (http.usesCookies ? AcpAuthMode.Ticket : AcpAuthMode.Headers);\n if (mode === AcpAuthMode.Headers) {\n return {\n url: acpWebSocketUrl({ host: http.url(''), agent: args?.agent }),\n headers: await http.headers(),\n protocols: undefined,\n };\n }\n const ticket = await http.request({\n method: HttpMethod.Post,\n path: '/v1/acp/tickets',\n body: { schema: acpTicketRequestSchema, value: { agent: args?.agent } },\n response: acpTicketSchema,\n signal: args?.signal,\n });\n return {\n url: acpWebSocketUrl({\n host: http.url(''),\n agent: args?.agent,\n endpoint: ticket.url ?? undefined,\n }),\n headers: {},\n protocols: [ACP_WS_SUBPROTOCOL, `${ACP_TICKET_SUBPROTOCOL_PREFIX}${ticket.ticket}`],\n };\n};\n\nexport const createAcpApi = (context: { http: HttpIface }): AcpApiIface => ({\n connect: async (args) => {\n // The ACP SDK loads on first use: bundlers that split code keep it out of\n // HTTP-only pages.\n const [{ client }, { createWebSocketStream }] = await Promise.all([\n import('@agentclientprotocol/sdk/experimental/v2'),\n import('@agentclientprotocol/sdk/experimental/ws-client'),\n ]);\n const transport = await resolveAcpTransport(context.http, args);\n const stream = createWebSocketStream<AnyWireMessage>(transport.url, {\n headers: transport.headers,\n protocols: transport.protocols,\n // The ticket is the credential; the session service has no cookie auth.\n cookies: 'omit',\n WebSocket: args?.WebSocket,\n });\n const connection = (args?.app ?? client({ name: '@finalai/agents' })).connect(stream);\n const signal = args?.signal;\n if (signal != null) {\n if (signal.aborted) connection.close(signal.reason);\n else signal.addEventListener('abort', () => connection.close(signal.reason), { once: true });\n }\n return connection;\n },\n});\n\n// `client.acp` without the rest of the client (`@finalai/agents/client/acp`).\nexport const createAcpClient = (options: CreateHttpOptionsIface): AcpApiIface =>\n createAcpApi({ http: createHttp(options) });\n"],
|
|
5
|
+
"mappings": "AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK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AC1E,SAAS,OAAO,SAAS;AAGvB,UAAM,CAAC,EAAE,OAAO,GAAG,EAAE,sBAAsB,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,MAChE,OAAO,0CAA0C;AAAA,MACjD,OAAO,iDAAiD;AAAA,IAC1D,CAAC;AACD,UAAM,YAAY,MAAM,oBAAoB,QAAQ,MAAM,IAAI;AAC9D,UAAM,SAAS,sBAAsC,UAAU,KAAK;AAAA,MAClE,SAAS,UAAU;AAAA,MACnB,WAAW,UAAU;AAAA;AAAA,MAErB,SAAS;AAAA,MACT,WAAW,MAAM;AAAA,IACnB,CAAC;AACD,UAAM,cAAc,MAAM,OAAO,OAAO,EAAE,MAAM,kBAAkB,CAAC,GAAG,QAAQ,MAAM;AACpF,UAAM,SAAS,MAAM;AACrB,QAAI,UAAU,MAAM;AAClB,UAAI,OAAO,QAAS,YAAW,MAAM,OAAO,MAAM;AAAA,UAC7C,QAAO,iBAAiB,SAAS,MAAM,WAAW,MAAM,OAAO,MAAM,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,IAC7F;AACA,WAAO;AAAA,EACT;AACF;AAGO,MAAM,kBAAkB,CAAC,YAC9B,aAAa,EAAE,MAAM,WAAW,OAAO,EAAE,CAAC;",
|
|
6
6
|
"names": ["AcpAuthMode"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CommitDefinitionRequestIface, type CommitResultIface, type CompatibilityReportIface, type CompileResultIface, type ComputerSetupGuideDetailIface, type ComputerSetupGuideIface, type ComputerSetupGuideVersionIface, type CreateDefinitionRequestIface, type CredentialPolicyPreviewIface, type DefinitionChannelIface, type DefinitionCloneUrlIface, type DefinitionFilesIface, type DefinitionIface, type PreviewCredentialPolicyRequestIface, type ProviderEntryIface, type PublishComputerSetupGuideRequestIface, type PublishResultIface, type RevisionDiffIface, type RevisionIface, type ScheduleIface, type ScheduleRunResultIface, type UpdateScheduleRequestIface } from '@finalai/agent-protocol/agent-platform';
|
|
2
2
|
import { type ClientContextIface, type SignalOptionsIface } from "./context.mjs";
|
|
3
3
|
export interface DefinitionRefIface extends SignalOptionsIface {
|
|
4
4
|
/** Definition id or slug. */
|
|
@@ -62,16 +62,8 @@ export interface DefinitionsApiIface {
|
|
|
62
62
|
harness: string;
|
|
63
63
|
ref?: string;
|
|
64
64
|
}) => Promise<CompatibilityReportIface>;
|
|
65
|
-
/** The agent's live channel bindings
|
|
65
|
+
/** The agent's live channel bindings and their public route URLs. */
|
|
66
66
|
channels: (args: DefinitionRefIface) => Promise<DefinitionChannelIface[]>;
|
|
67
|
-
/**
|
|
68
|
-
* Attaches a channel binding to a conversation the agent and the caller take
|
|
69
|
-
* part in (its events and bound-conversation schedules post there); null detaches.
|
|
70
|
-
*/
|
|
71
|
-
attachChannel: (args: DefinitionRefIface & {
|
|
72
|
-
bindingId: string;
|
|
73
|
-
conversationId: string | null;
|
|
74
|
-
}) => Promise<AttachChannelBindingResponseIface>;
|
|
75
67
|
/**
|
|
76
68
|
* Archives the definition: it leaves listings, its schedules and channel
|
|
77
69
|
* bindings stop, and new sessions are refused. Its repository is kept.
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
attachChannelBindingRequestSchema,
|
|
3
|
-
attachChannelBindingResponseSchema,
|
|
4
2
|
commitDefinitionRequestSchema,
|
|
5
3
|
commitResultSchema,
|
|
6
4
|
compatibilityReportSchema,
|
|
@@ -123,13 +121,6 @@ const createDefinitionsApi = ({ http }) => ({
|
|
|
123
121
|
response: definitionChannelsResponseSchema,
|
|
124
122
|
signal
|
|
125
123
|
})).channels,
|
|
126
|
-
attachChannel: ({ definition, bindingId, conversationId, signal }) => http.request({
|
|
127
|
-
method: HttpMethod.Put,
|
|
128
|
-
path: definitionPath(definition, `/channels/${encodePath(bindingId)}/conversation`),
|
|
129
|
-
body: { schema: attachChannelBindingRequestSchema, value: { conversationId } },
|
|
130
|
-
response: attachChannelBindingResponseSchema,
|
|
131
|
-
signal
|
|
132
|
-
}),
|
|
133
124
|
archive: ({ definition, signal }) => http.request({
|
|
134
125
|
method: HttpMethod.Post,
|
|
135
126
|
path: definitionPath(definition, "/archive"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/agent-client/build.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n attachChannelBindingRequestSchema,\n attachChannelBindingResponseSchema,\n commitDefinitionRequestSchema,\n commitResultSchema,\n compatibilityReportSchema,\n compileDefinitionRequestSchema,\n compileResultSchema,\n computerSetupGuideDetailSchema,\n computerSetupGuideListSchema,\n createDefinitionRequestSchema,\n credentialPolicyPreviewSchema,\n definitionChannelsResponseSchema,\n definitionCloneUrlSchema,\n definitionFilesSchema,\n definitionListSchema,\n definitionSchema,\n previewCredentialPolicyRequestSchema,\n providerListSchema,\n publishComputerSetupGuideRequestSchema,\n publishComputerSetupGuideResultSchema,\n publishDefinitionRequestSchema,\n publishResultSchema,\n revisionDiffSchema,\n revisionListSchema,\n revisionSchema,\n scheduleListSchema,\n scheduleRunResultSchema,\n scheduleSchema,\n updateScheduleRequestSchema,\n type AttachChannelBindingResponseIface,\n type CommitDefinitionRequestIface,\n type CommitResultIface,\n type CompatibilityReportIface,\n type CompileResultIface,\n type ComputerSetupGuideDetailIface,\n type ComputerSetupGuideIface,\n type ComputerSetupGuideVersionIface,\n type CreateDefinitionRequestIface,\n type CredentialPolicyPreviewIface,\n type DefinitionChannelIface,\n type DefinitionCloneUrlIface,\n type DefinitionFilesIface,\n type DefinitionIface,\n type PreviewCredentialPolicyRequestIface,\n type ProviderEntryIface,\n type PublishComputerSetupGuideRequestIface,\n type PublishResultIface,\n type RevisionDiffIface,\n type RevisionIface,\n type ScheduleIface,\n type ScheduleRunResultIface,\n type UpdateScheduleRequestIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport { encodePath, type ClientContextIface, type SignalOptionsIface } from \"./context.mjs\";\nimport { clientError, ClientErrorCode } from \"./errors.mjs\";\nimport { HttpMethod } from \"./http.mjs\";\n\n// Definitions, providers, setup guides, schedules, credentials and budgets:\n// what Build, settings and CI use.\n\nexport interface DefinitionRefIface extends SignalOptionsIface {\n /** Definition id or slug. */\n definition: string;\n}\n\nexport interface DefinitionsApiIface {\n /** Compiles a draft into an immutable test snapshot without publishing or activating schedules/channels. */\n testRevision: (args: DefinitionRefIface & { ref: string }) => Promise<RevisionIface>;\n previewCredentialPolicy: (\n args: DefinitionRefIface & PreviewCredentialPolicyRequestIface,\n ) => Promise<CredentialPolicyPreviewIface>;\n /**\n * With `projectId`, its definitions and those inherited from its ancestors. Without it,\n * everything the caller can access (an API key: its parent project and every project it is\n * granted; a person: every project they can read).\n */\n list: (\n options?: SignalOptionsIface & { cursor?: string; limit?: number; projectId?: string },\n ) => Promise<{ definitions: DefinitionIface[]; nextCursor: string | null }>;\n /**\n * Creates the definition in `projectId` (editors of that project); omitted, the API key's parent\n * project (a signed-in person's: My Work).\n */\n create: (args: CreateDefinitionRequestIface & SignalOptionsIface) => Promise<DefinitionIface>;\n get: (args: DefinitionRefIface) => Promise<DefinitionIface>;\n /** Compiles the directory at `ref` server-side without publishing. */\n compile: (\n args: DefinitionRefIface & { ref: string; harness?: string },\n ) => Promise<CompileResultIface>;\n commit: (args: DefinitionRefIface & CommitDefinitionRequestIface) => Promise<CommitResultIface>;\n /** Compiles `ref`, stores a revision and makes it current. */\n publish: (\n args: DefinitionRefIface & { ref: string; note?: string },\n ) => Promise<PublishResultIface>;\n /** The agent directory's files at `ref` (default branch when omitted). */\n files: (args: DefinitionRefIface & { ref?: string }) => Promise<DefinitionFilesIface>;\n revisions: (\n args: DefinitionRefIface & { cursor?: string },\n ) => Promise<{ revisions: RevisionIface[]; nextCursor: string | null }>;\n /**\n * What changed in the compiled manifest between two revisions (revision ids\n * or numbers); `to` defaults to the current revision.\n */\n revisionDiff: (\n args: DefinitionRefIface & { from: string | number; to?: string | number },\n ) => Promise<RevisionDiffIface>;\n compatibility: (\n args: DefinitionRefIface & { harness: string; ref?: string },\n ) => Promise<CompatibilityReportIface>;\n /** The agent's live channel bindings, with the conversation each is attached to. */\n channels: (args: DefinitionRefIface) => Promise<DefinitionChannelIface[]>;\n /**\n * Attaches a channel binding to a conversation the agent and the caller take\n * part in (its events and bound-conversation schedules post there); null detaches.\n */\n attachChannel: (\n args: DefinitionRefIface & { bindingId: string; conversationId: string | null },\n ) => Promise<AttachChannelBindingResponseIface>;\n /**\n * Archives the definition: it leaves listings, its schedules and channel\n * bindings stop, and new sessions are refused. Its repository is kept.\n */\n archive: (args: DefinitionRefIface) => Promise<DefinitionIface>;\n /**\n * A short-lived, read-only git remote for a Final-hosted repository, for\n * `git clone` (editors of the definition's project).\n */\n cloneUrl: (args: DefinitionRefIface) => Promise<DefinitionCloneUrlIface>;\n}\n\nexport interface ProvidersApiIface {\n list: (options?: SignalOptionsIface) => Promise<ProviderEntryIface[]>;\n}\n\nexport interface ComputerSetupGuidesApiIface {\n list: (options?: SignalOptionsIface) => Promise<ComputerSetupGuideIface[]>;\n /** Guide by slug or id, with its versions. */\n get: (ref: string, options?: SignalOptionsIface) => Promise<ComputerSetupGuideDetailIface>;\n /** Publishes a new version (creating the guide on first publish). */\n publish: (\n args: PublishComputerSetupGuideRequestIface & SignalOptionsIface,\n ) => Promise<{ guide: ComputerSetupGuideIface; version: ComputerSetupGuideVersionIface }>;\n}\n\nexport type ScheduleRef = { scheduleId: string } | { agent: string; key: string };\n\nexport interface SchedulesApiIface {\n list: (options?: SignalOptionsIface & { agent?: string }) => Promise<ScheduleIface[]>;\n runNow: (args: ScheduleRef & SignalOptionsIface) => Promise<ScheduleRunResultIface>;\n update: (\n args: { scheduleId: string } & UpdateScheduleRequestIface & SignalOptionsIface,\n ) => Promise<ScheduleIface>;\n}\n\nconst definitionPath = (definition: string, suffix = ''): string =>\n `/v1/definitions/${encodePath(definition)}${suffix}`;\n\nexport const createDefinitionsApi = ({ http }: ClientContextIface): DefinitionsApiIface => ({\n testRevision: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/test-revision'),\n body: { schema: compileDefinitionRequestSchema, value },\n response: revisionSchema,\n signal,\n }),\n previewCredentialPolicy: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/credential-policy/preview'),\n body: { schema: previewCredentialPolicyRequestSchema, value },\n response: credentialPolicyPreviewSchema,\n signal,\n }),\n list: (options) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/definitions',\n query: { cursor: options?.cursor, limit: options?.limit, projectId: options?.projectId },\n response: definitionListSchema,\n signal: options?.signal,\n }),\n create: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/definitions',\n body: { schema: createDefinitionRequestSchema, value },\n response: definitionSchema,\n signal,\n }),\n get: ({ definition, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition),\n response: definitionSchema,\n signal,\n }),\n compile: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/compile'),\n body: { schema: compileDefinitionRequestSchema, value },\n response: compileResultSchema,\n signal,\n }),\n commit: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/commit'),\n body: { schema: commitDefinitionRequestSchema, value },\n response: commitResultSchema,\n signal,\n }),\n publish: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/publish'),\n body: { schema: publishDefinitionRequestSchema, value },\n response: publishResultSchema,\n signal,\n }),\n files: ({ definition, ref, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/files'),\n query: { ref },\n response: definitionFilesSchema,\n signal,\n }),\n revisions: ({ definition, cursor, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/revisions'),\n query: { cursor },\n response: revisionListSchema,\n signal,\n }),\n revisionDiff: ({ definition, from, to, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/revisions/diff'),\n query: { from, to },\n response: revisionDiffSchema,\n signal,\n }),\n compatibility: ({ definition, harness, ref, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/compatibility'),\n query: { harness, ref },\n response: compatibilityReportSchema,\n signal,\n }),\n channels: async ({ definition, signal }) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/channels'),\n response: definitionChannelsResponseSchema,\n signal,\n })\n ).channels,\n attachChannel: ({ definition, bindingId, conversationId, signal }) =>\n http.request({\n method: HttpMethod.Put,\n path: definitionPath(definition, `/channels/${encodePath(bindingId)}/conversation`),\n body: { schema: attachChannelBindingRequestSchema, value: { conversationId } },\n response: attachChannelBindingResponseSchema,\n signal,\n }),\n archive: ({ definition, signal }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/archive'),\n response: definitionSchema,\n signal,\n }),\n cloneUrl: ({ definition, signal }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/clone-url'),\n response: definitionCloneUrlSchema,\n signal,\n }),\n});\n\nexport const createProvidersApi = ({ http }: ClientContextIface): ProvidersApiIface => ({\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: '/v1/providers',\n response: providerListSchema,\n signal: options?.signal,\n })\n ).providers,\n});\n\nexport const createComputerSetupGuidesApi = ({\n http,\n}: ClientContextIface): ComputerSetupGuidesApiIface => ({\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: '/v1/computer-setup-guides',\n response: computerSetupGuideListSchema,\n signal: options?.signal,\n })\n ).guides,\n get: (ref, options) =>\n http.request({\n method: HttpMethod.Get,\n path: `/v1/computer-setup-guides/${encodePath(ref)}`,\n response: computerSetupGuideDetailSchema,\n signal: options?.signal,\n }),\n publish: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/computer-setup-guides',\n body: { schema: publishComputerSetupGuideRequestSchema, value },\n response: publishComputerSetupGuideResultSchema,\n signal,\n }),\n});\n\nexport const createSchedulesApi = ({ http }: ClientContextIface): SchedulesApiIface => {\n const list: SchedulesApiIface['list'] = async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: '/v1/schedules',\n query: { agent: options?.agent },\n response: scheduleListSchema,\n signal: options?.signal,\n })\n ).schedules;\n\n const scheduleIdOf = async (args: ScheduleRef & SignalOptionsIface): Promise<string> => {\n if ('scheduleId' in args) return args.scheduleId;\n const found = (await list({ agent: args.agent, signal: args.signal })).find(\n (schedule) => schedule.key === args.key,\n );\n if (found == null) {\n throw clientError({\n message: `No schedule ${args.key} on agent ${args.agent}`,\n status: 0,\n code: ClientErrorCode.NotFound,\n });\n }\n return found.id;\n };\n\n return {\n list,\n runNow: async (args) =>\n http.request({\n method: HttpMethod.Post,\n path: `/v1/schedules/${encodePath(await scheduleIdOf(args))}/run-now`,\n response: scheduleRunResultSchema,\n signal: args.signal,\n }),\n update: ({ scheduleId, signal, ...value }) =>\n http.request({\n method: HttpMethod.Patch,\n path: `/v1/schedules/${encodePath(scheduleId)}`,\n body: { schema: updateScheduleRequestSchema, value },\n response: scheduleSchema,\n signal,\n }),\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n commitDefinitionRequestSchema,\n commitResultSchema,\n compatibilityReportSchema,\n compileDefinitionRequestSchema,\n compileResultSchema,\n computerSetupGuideDetailSchema,\n computerSetupGuideListSchema,\n createDefinitionRequestSchema,\n credentialPolicyPreviewSchema,\n definitionChannelsResponseSchema,\n definitionCloneUrlSchema,\n definitionFilesSchema,\n definitionListSchema,\n definitionSchema,\n previewCredentialPolicyRequestSchema,\n providerListSchema,\n publishComputerSetupGuideRequestSchema,\n publishComputerSetupGuideResultSchema,\n publishDefinitionRequestSchema,\n publishResultSchema,\n revisionDiffSchema,\n revisionListSchema,\n revisionSchema,\n scheduleListSchema,\n scheduleRunResultSchema,\n scheduleSchema,\n updateScheduleRequestSchema,\n type CommitDefinitionRequestIface,\n type CommitResultIface,\n type CompatibilityReportIface,\n type CompileResultIface,\n type ComputerSetupGuideDetailIface,\n type ComputerSetupGuideIface,\n type ComputerSetupGuideVersionIface,\n type CreateDefinitionRequestIface,\n type CredentialPolicyPreviewIface,\n type DefinitionChannelIface,\n type DefinitionCloneUrlIface,\n type DefinitionFilesIface,\n type DefinitionIface,\n type PreviewCredentialPolicyRequestIface,\n type ProviderEntryIface,\n type PublishComputerSetupGuideRequestIface,\n type PublishResultIface,\n type RevisionDiffIface,\n type RevisionIface,\n type ScheduleIface,\n type ScheduleRunResultIface,\n type UpdateScheduleRequestIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport { encodePath, type ClientContextIface, type SignalOptionsIface } from \"./context.mjs\";\nimport { clientError, ClientErrorCode } from \"./errors.mjs\";\nimport { HttpMethod } from \"./http.mjs\";\n\n// Definitions, providers, setup guides, schedules, credentials and budgets:\n// what Build, settings and CI use.\n\nexport interface DefinitionRefIface extends SignalOptionsIface {\n /** Definition id or slug. */\n definition: string;\n}\n\nexport interface DefinitionsApiIface {\n /** Compiles a draft into an immutable test snapshot without publishing or activating schedules/channels. */\n testRevision: (args: DefinitionRefIface & { ref: string }) => Promise<RevisionIface>;\n previewCredentialPolicy: (\n args: DefinitionRefIface & PreviewCredentialPolicyRequestIface,\n ) => Promise<CredentialPolicyPreviewIface>;\n /**\n * With `projectId`, its definitions and those inherited from its ancestors. Without it,\n * everything the caller can access (an API key: its parent project and every project it is\n * granted; a person: every project they can read).\n */\n list: (\n options?: SignalOptionsIface & { cursor?: string; limit?: number; projectId?: string },\n ) => Promise<{ definitions: DefinitionIface[]; nextCursor: string | null }>;\n /**\n * Creates the definition in `projectId` (editors of that project); omitted, the API key's parent\n * project (a signed-in person's: My Work).\n */\n create: (args: CreateDefinitionRequestIface & SignalOptionsIface) => Promise<DefinitionIface>;\n get: (args: DefinitionRefIface) => Promise<DefinitionIface>;\n /** Compiles the directory at `ref` server-side without publishing. */\n compile: (\n args: DefinitionRefIface & { ref: string; harness?: string },\n ) => Promise<CompileResultIface>;\n commit: (args: DefinitionRefIface & CommitDefinitionRequestIface) => Promise<CommitResultIface>;\n /** Compiles `ref`, stores a revision and makes it current. */\n publish: (\n args: DefinitionRefIface & { ref: string; note?: string },\n ) => Promise<PublishResultIface>;\n /** The agent directory's files at `ref` (default branch when omitted). */\n files: (args: DefinitionRefIface & { ref?: string }) => Promise<DefinitionFilesIface>;\n revisions: (\n args: DefinitionRefIface & { cursor?: string },\n ) => Promise<{ revisions: RevisionIface[]; nextCursor: string | null }>;\n /**\n * What changed in the compiled manifest between two revisions (revision ids\n * or numbers); `to` defaults to the current revision.\n */\n revisionDiff: (\n args: DefinitionRefIface & { from: string | number; to?: string | number },\n ) => Promise<RevisionDiffIface>;\n compatibility: (\n args: DefinitionRefIface & { harness: string; ref?: string },\n ) => Promise<CompatibilityReportIface>;\n /** The agent's live channel bindings and their public route URLs. */\n channels: (args: DefinitionRefIface) => Promise<DefinitionChannelIface[]>;\n /**\n * Archives the definition: it leaves listings, its schedules and channel\n * bindings stop, and new sessions are refused. Its repository is kept.\n */\n archive: (args: DefinitionRefIface) => Promise<DefinitionIface>;\n /**\n * A short-lived, read-only git remote for a Final-hosted repository, for\n * `git clone` (editors of the definition's project).\n */\n cloneUrl: (args: DefinitionRefIface) => Promise<DefinitionCloneUrlIface>;\n}\n\nexport interface ProvidersApiIface {\n list: (options?: SignalOptionsIface) => Promise<ProviderEntryIface[]>;\n}\n\nexport interface ComputerSetupGuidesApiIface {\n list: (options?: SignalOptionsIface) => Promise<ComputerSetupGuideIface[]>;\n /** Guide by slug or id, with its versions. */\n get: (ref: string, options?: SignalOptionsIface) => Promise<ComputerSetupGuideDetailIface>;\n /** Publishes a new version (creating the guide on first publish). */\n publish: (\n args: PublishComputerSetupGuideRequestIface & SignalOptionsIface,\n ) => Promise<{ guide: ComputerSetupGuideIface; version: ComputerSetupGuideVersionIface }>;\n}\n\nexport type ScheduleRef = { scheduleId: string } | { agent: string; key: string };\n\nexport interface SchedulesApiIface {\n list: (options?: SignalOptionsIface & { agent?: string }) => Promise<ScheduleIface[]>;\n runNow: (args: ScheduleRef & SignalOptionsIface) => Promise<ScheduleRunResultIface>;\n update: (\n args: { scheduleId: string } & UpdateScheduleRequestIface & SignalOptionsIface,\n ) => Promise<ScheduleIface>;\n}\n\nconst definitionPath = (definition: string, suffix = ''): string =>\n `/v1/definitions/${encodePath(definition)}${suffix}`;\n\nexport const createDefinitionsApi = ({ http }: ClientContextIface): DefinitionsApiIface => ({\n testRevision: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/test-revision'),\n body: { schema: compileDefinitionRequestSchema, value },\n response: revisionSchema,\n signal,\n }),\n previewCredentialPolicy: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/credential-policy/preview'),\n body: { schema: previewCredentialPolicyRequestSchema, value },\n response: credentialPolicyPreviewSchema,\n signal,\n }),\n list: (options) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/definitions',\n query: { cursor: options?.cursor, limit: options?.limit, projectId: options?.projectId },\n response: definitionListSchema,\n signal: options?.signal,\n }),\n create: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/definitions',\n body: { schema: createDefinitionRequestSchema, value },\n response: definitionSchema,\n signal,\n }),\n get: ({ definition, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition),\n response: definitionSchema,\n signal,\n }),\n compile: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/compile'),\n body: { schema: compileDefinitionRequestSchema, value },\n response: compileResultSchema,\n signal,\n }),\n commit: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/commit'),\n body: { schema: commitDefinitionRequestSchema, value },\n response: commitResultSchema,\n signal,\n }),\n publish: ({ definition, signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/publish'),\n body: { schema: publishDefinitionRequestSchema, value },\n response: publishResultSchema,\n signal,\n }),\n files: ({ definition, ref, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/files'),\n query: { ref },\n response: definitionFilesSchema,\n signal,\n }),\n revisions: ({ definition, cursor, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/revisions'),\n query: { cursor },\n response: revisionListSchema,\n signal,\n }),\n revisionDiff: ({ definition, from, to, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/revisions/diff'),\n query: { from, to },\n response: revisionDiffSchema,\n signal,\n }),\n compatibility: ({ definition, harness, ref, signal }) =>\n http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/compatibility'),\n query: { harness, ref },\n response: compatibilityReportSchema,\n signal,\n }),\n channels: async ({ definition, signal }) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: definitionPath(definition, '/channels'),\n response: definitionChannelsResponseSchema,\n signal,\n })\n ).channels,\n archive: ({ definition, signal }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/archive'),\n response: definitionSchema,\n signal,\n }),\n cloneUrl: ({ definition, signal }) =>\n http.request({\n method: HttpMethod.Post,\n path: definitionPath(definition, '/clone-url'),\n response: definitionCloneUrlSchema,\n signal,\n }),\n});\n\nexport const createProvidersApi = ({ http }: ClientContextIface): ProvidersApiIface => ({\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: '/v1/providers',\n response: providerListSchema,\n signal: options?.signal,\n })\n ).providers,\n});\n\nexport const createComputerSetupGuidesApi = ({\n http,\n}: ClientContextIface): ComputerSetupGuidesApiIface => ({\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: '/v1/computer-setup-guides',\n response: computerSetupGuideListSchema,\n signal: options?.signal,\n })\n ).guides,\n get: (ref, options) =>\n http.request({\n method: HttpMethod.Get,\n path: `/v1/computer-setup-guides/${encodePath(ref)}`,\n response: computerSetupGuideDetailSchema,\n signal: options?.signal,\n }),\n publish: ({ signal, ...value }) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/computer-setup-guides',\n body: { schema: publishComputerSetupGuideRequestSchema, value },\n response: publishComputerSetupGuideResultSchema,\n signal,\n }),\n});\n\nexport const createSchedulesApi = ({ http }: ClientContextIface): SchedulesApiIface => {\n const list: SchedulesApiIface['list'] = async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: '/v1/schedules',\n query: { agent: options?.agent },\n response: scheduleListSchema,\n signal: options?.signal,\n })\n ).schedules;\n\n const scheduleIdOf = async (args: ScheduleRef & SignalOptionsIface): Promise<string> => {\n if ('scheduleId' in args) return args.scheduleId;\n const found = (await list({ agent: args.agent, signal: args.signal })).find(\n (schedule) => schedule.key === args.key,\n );\n if (found == null) {\n throw clientError({\n message: `No schedule ${args.key} on agent ${args.agent}`,\n status: 0,\n code: ClientErrorCode.NotFound,\n });\n }\n return found.id;\n };\n\n return {\n list,\n runNow: async (args) =>\n http.request({\n method: HttpMethod.Post,\n path: `/v1/schedules/${encodePath(await scheduleIdOf(args))}/run-now`,\n response: scheduleRunResultSchema,\n signal: args.signal,\n }),\n update: ({ scheduleId, signal, ...value }) =>\n http.request({\n method: HttpMethod.Patch,\n path: `/v1/schedules/${encodePath(scheduleId)}`,\n body: { schema: updateScheduleRequestSchema, value },\n response: schedu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MAAM;AACjB,YAAM,YAAY;AAAA,QAChB,SAAS,eAAe,KAAK,GAAG,aAAa,KAAK,KAAK;AAAA,QACvD,QAAQ;AAAA,QACR,MAAM,gBAAgB;AAAA,MACxB,CAAC;AAAA,IACH;AACA,WAAO,MAAM;AAAA,EACf;AAEA,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,OAAO,SACb,KAAK,QAAQ;AAAA,MACX,QAAQ,WAAW;AAAA,MACnB,MAAM,iBAAiB,WAAW,MAAM,aAAa,IAAI,CAAC,CAAC;AAAA,MAC3D,UAAU;AAAA,MACV,QAAQ,KAAK;AAAA,IACf,CAAC;AAAA,IACH,QAAQ,CAAC,EAAE,YAAY,QAAQ,GAAG,MAAM,MACtC,KAAK,QAAQ;AAAA,MACX,QAAQ,WAAW;AAAA,MACnB,MAAM,iBAAiB,WAAW,UAAU,CAAC;AAAA,MAC7C,MAAM,EAAE,QAAQ,6BAA6B,MAAM;AAAA,MACnD,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AAAA,EACL;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ChannelRouteIface, type ChannelSeenPlaceIface, type ConnectChannelPlaceRequestIface, type CreateChannelBindingRequestIface, type CreateChannelBindingResponseIface } from '@finalai/agent-protocol/agent-platform';
|
|
2
|
+
import { type ClientContextIface, type SignalOptionsIface } from "./context.mjs";
|
|
3
|
+
export interface ChannelBindingsApiIface {
|
|
4
|
+
create(args: CreateChannelBindingRequestIface & SignalOptionsIface): Promise<CreateChannelBindingResponseIface>;
|
|
5
|
+
places(args: {
|
|
6
|
+
bindingId: string;
|
|
7
|
+
} & SignalOptionsIface): Promise<ChannelSeenPlaceIface[]>;
|
|
8
|
+
routes(args: {
|
|
9
|
+
conversationId: string;
|
|
10
|
+
} & SignalOptionsIface): Promise<ChannelRouteIface[]>;
|
|
11
|
+
connect(args: ConnectChannelPlaceRequestIface & {
|
|
12
|
+
conversationId: string;
|
|
13
|
+
} & SignalOptionsIface): Promise<{
|
|
14
|
+
id: string;
|
|
15
|
+
}>;
|
|
16
|
+
disconnect(args: {
|
|
17
|
+
conversationId: string;
|
|
18
|
+
routeId: string;
|
|
19
|
+
} & SignalOptionsIface): Promise<{
|
|
20
|
+
ok: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
export declare const createChannelBindingsApi: (ctx: ClientContextIface) => ChannelBindingsApiIface;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
channelPlacesResponseSchema,
|
|
3
|
+
channelRoutesResponseSchema,
|
|
4
|
+
connectChannelPlaceRequestSchema,
|
|
5
|
+
connectChannelPlaceResponseSchema,
|
|
6
|
+
createChannelBindingRequestSchema,
|
|
7
|
+
createChannelBindingResponseSchema,
|
|
8
|
+
disconnectChannelRouteResponseSchema
|
|
9
|
+
} from "@finalai/agent-protocol/agent-platform";
|
|
10
|
+
import { encodePath } from "./context.mjs";
|
|
11
|
+
import { HttpMethod } from "./http.mjs";
|
|
12
|
+
const createChannelBindingsApi = (ctx) => ({
|
|
13
|
+
create: ({ signal, ...body }) => ctx.http.request({
|
|
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({
|
|
21
|
+
method: HttpMethod.Get,
|
|
22
|
+
path: `/v1/channel-bindings/${encodePath(bindingId)}/places`,
|
|
23
|
+
response: channelPlacesResponseSchema,
|
|
24
|
+
signal
|
|
25
|
+
})).places,
|
|
26
|
+
routes: async ({ conversationId, signal }) => (await ctx.http.request({
|
|
27
|
+
method: HttpMethod.Get,
|
|
28
|
+
path: `/v1/conversations/${encodePath(conversationId)}/channel-routes`,
|
|
29
|
+
response: channelRoutesResponseSchema,
|
|
30
|
+
signal
|
|
31
|
+
})).routes,
|
|
32
|
+
connect: ({ conversationId, signal, ...body }) => ctx.http.request({
|
|
33
|
+
method: HttpMethod.Post,
|
|
34
|
+
path: `/v1/conversations/${encodePath(conversationId)}/channel-routes`,
|
|
35
|
+
body: { schema: connectChannelPlaceRequestSchema, value: body },
|
|
36
|
+
response: connectChannelPlaceResponseSchema,
|
|
37
|
+
signal
|
|
38
|
+
}),
|
|
39
|
+
disconnect: ({ conversationId, routeId, signal }) => ctx.http.request({
|
|
40
|
+
method: HttpMethod.Delete,
|
|
41
|
+
path: `/v1/conversations/${encodePath(conversationId)}/channel-routes/${encodePath(routeId)}`,
|
|
42
|
+
response: disconnectChannelRouteResponseSchema,
|
|
43
|
+
signal
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
export {
|
|
47
|
+
createChannelBindingsApi
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=channels.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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,OAMK;AACP,SAAS,kBAAoE;AAC7E,SAAS,kBAAkB;AAcpB,MAAM,2BAA2B,CAAC,SAAsD;AAAA,EAC7F,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,MACzB,IAAI,KAAK,QAAQ;AAAA,IACf,QAAQ,WAAW;AAAA,IACnB,MAAM;AAAA,IACN,MAAM,EAAE,QAAQ,mCAAmC,OAAO,KAAK;AAAA,IAC/D,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AAAA,EACH,QAAQ,OAAO,EAAE,WAAW,OAAO,OAE/B,MAAM,IAAI,KAAK,QAAQ;AAAA,IACrB,QAAQ,WAAW;AAAA,IACnB,MAAM,wBAAwB,WAAW,SAAS,CAAC;AAAA,IACnD,UAAU;AAAA,IACV;AAAA,EACF,CAAC,GACD;AAAA,EACJ,QAAQ,OAAO,EAAE,gBAAgB,OAAO,OAEpC,MAAM,IAAI,KAAK,QAAQ;AAAA,IACrB,QAAQ,WAAW;AAAA,IACnB,MAAM,qBAAqB,WAAW,cAAc,CAAC;AAAA,IACrD,UAAU;AAAA,IACV;AAAA,EACF,CAAC,GACD;AAAA,EACJ,SAAS,CAAC,EAAE,gBAAgB,QAAQ,GAAG,KAAK,MAC1C,IAAI,KAAK,QAAQ;AAAA,IACf,QAAQ,WAAW;AAAA,IACnB,MAAM,qBAAqB,WAAW,cAAc,CAAC;AAAA,IACrD,MAAM,EAAE,QAAQ,kCAAkC,OAAO,KAAK;AAAA,IAC9D,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AAAA,EACH,YAAY,CAAC,EAAE,gBAAgB,SAAS,OAAO,MAC7C,IAAI,KAAK,QAAQ;AAAA,IACf,QAAQ,WAAW;AAAA,IACnB,MAAM,qBAAqB,WAAW,cAAc,CAAC,mBAAmB,WAAW,OAAO,CAAC;AAAA,IAC3F,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,6 +2,7 @@ import { type AgentInfoIface, type AgentListIface, type HealthResponseIface, typ
|
|
|
2
2
|
import { type AcpApiIface } from "./acp.mjs";
|
|
3
3
|
import { type ComputerSetupGuidesApiIface, type DefinitionsApiIface, type ProvidersApiIface, type SchedulesApiIface } from "./build.mjs";
|
|
4
4
|
import { type SignalOptionsIface } from "./context.mjs";
|
|
5
|
+
import { type ChannelBindingsApiIface } from "./channels.mjs";
|
|
5
6
|
import { type ConversationsApiIface } from "./conversations.mjs";
|
|
6
7
|
import { type StreamTimingIface } from "./frame-stream.mjs";
|
|
7
8
|
import { type AgentClientAuth, type FetchIface, type HeadersOption } from "./http.mjs";
|
|
@@ -78,6 +79,7 @@ export interface AgentClientIface {
|
|
|
78
79
|
realtime: RealtimeApiIface;
|
|
79
80
|
sessions: SessionsApiIface;
|
|
80
81
|
conversations: ConversationsApiIface;
|
|
82
|
+
channelBindings: ChannelBindingsApiIface;
|
|
81
83
|
definitions: DefinitionsApiIface;
|
|
82
84
|
providers: ProvidersApiIface;
|
|
83
85
|
computerSetupGuides: ComputerSetupGuidesApiIface;
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
createSchedulesApi
|
|
15
15
|
} from "./build.mjs";
|
|
16
16
|
import { encodePath } from "./context.mjs";
|
|
17
|
+
import { createChannelBindingsApi } from "./channels.mjs";
|
|
17
18
|
import { createConversationsApi } from "./conversations.mjs";
|
|
18
19
|
import { clientError, ClientErrorCode } from "./errors.mjs";
|
|
19
20
|
import { defaultStreamTiming } from "./frame-stream.mjs";
|
|
@@ -154,6 +155,7 @@ const createClient = (options) => {
|
|
|
154
155
|
realtime: { createSession: createRealtimeSession },
|
|
155
156
|
sessions: createSessionsApi(context),
|
|
156
157
|
conversations: createConversationsApi(context),
|
|
158
|
+
channelBindings: createChannelBindingsApi(context),
|
|
157
159
|
definitions: createDefinitionsApi(context),
|
|
158
160
|
providers: createProvidersApi(context),
|
|
159
161
|
computerSetupGuides: createComputerSetupGuidesApi(context),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/agent-client/client.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n agentInfoSchema,\n agentListSchema,\n agentRealtimeTopics,\n healthResponseSchema,\n personListSchema,\n realtimeSessionResponseSchema,\n type AgentInfoIface,\n type AgentListIface,\n type HealthResponseIface,\n type PersonIface,\n type PersonListIface,\n type RealtimeSessionResponseIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport { createAcpApi, type AcpApiIface } from \"./acp.mjs\";\nimport {\n createComputerSetupGuidesApi,\n createDefinitionsApi,\n createProvidersApi,\n createSchedulesApi,\n type ComputerSetupGuidesApiIface,\n type DefinitionsApiIface,\n type ProvidersApiIface,\n type SchedulesApiIface,\n} from \"./build.mjs\";\nimport { encodePath, type ClientContextIface, type SignalOptionsIface } from \"./context.mjs\";\nimport { createConversationsApi, type ConversationsApiIface } from \"./conversations.mjs\";\nimport { clientError, ClientErrorCode } from \"./errors.mjs\";\nimport { defaultStreamTiming, type StreamTimingIface } from \"./frame-stream.mjs\";\nimport {\n createHttp,\n HttpMethod,\n type AgentClientAuth,\n type FetchIface,\n type HeadersOption,\n} from \"./http.mjs\";\nimport {\n createGatewayRealtimeTransport,\n type GatewayConnect,\n type GatewayRealtimeTransportIface,\n type RealtimeTransportIface,\n} from \"./realtime.mjs\";\nimport { createSessionsApi, type SessionsApiIface } from \"./sessions.mjs\";\n\nexport interface CreateClientOptionsIface {\n /**\n * The agents API origin (`https://agent-session.final.ai`; its API is under\n * `/api` and ACP at `/acp/ws`), or a base URL the API routes are mounted under.\n */\n host: string;\n auth: AgentClientAuth;\n /** Extra headers per request; console clients send their client identity header here. */\n headers?: HeadersOption;\n /** API requests (the host's routes); carries auth and caller headers. */\n fetch?: FetchIface;\n /**\n * Presigned storage requests (attachment uploads). Gets only the headers the\n * presign requires, never auth, client identity or cookies, so a storage\n * bucket's CORS and third-party hosts see nothing of the caller. Defaults to\n * `globalThis.fetch`; keep it free of header-injecting wrappers.\n */\n storageFetch?: FetchIface;\n /** console-web and console-mobile pass their realtime clients; defaults to a gateway connection. */\n realtime?: RealtimeTransportIface;\n /** Seam for the default transport's gateway connection. */\n gatewayConnect?: GatewayConnect;\n /** Seam for stream retry timing (tests). */\n timing?: Partial<StreamTimingIface>;\n /** Seam for idempotency keys and client message ids; defaults to `crypto.randomUUID`. */\n newKey?: () => string;\n /** Seam for the client clock (conversation recovery windows). */\n now?: () => number;\n}\n\nexport interface AgentHandleIface {\n slug: string;\n info: (options?: SignalOptionsIface) => Promise<AgentInfoIface>;\n}\n\nexport interface AgentsApiIface {\n /**\n * The agents the caller can use; with `projectId`, those usable there (its own and those\n * inherited from its ancestors). Without it, everything the caller can access (an API key: its\n * parent project and every project it is granted; a person: every project they can read).\n */\n list: (\n options?: SignalOptionsIface & { cursor?: string; limit?: number; projectId?: string },\n ) => Promise<AgentListIface>;\n /** I/O-free handle by slug or id. */\n get: (slugOrId: string) => AgentHandleIface;\n}\n\nexport interface PeopleApiIface {\n /** One page of the caller's organization members, by name; pass `nextCursor` as `cursor` for the next. */\n list: (\n options?: SignalOptionsIface & { cursor?: string; limit?: number },\n ) => Promise<PersonListIface>;\n /** Every member of the caller's organization (all pages). */\n all: (options?: SignalOptionsIface) => Promise<PersonIface[]>;\n}\n\nexport interface RealtimeApiIface {\n /**\n * Mints a gateway session (`POST /v1/realtime/session`) for the signed-in user:\n * the gateway URL, a short-lived token, and the user id realtime topics are keyed by.\n * Pass it as `createSession` to `createGatewayRealtimeTransport` when supplying a transport.\n */\n createSession: (options?: SignalOptionsIface) => Promise<RealtimeSessionResponseIface>;\n}\n\nexport interface AgentClientIface {\n health: (options?: SignalOptionsIface) => Promise<HealthResponseIface>;\n agents: AgentsApiIface;\n people: PeopleApiIface;\n realtime: RealtimeApiIface;\n sessions: SessionsApiIface;\n conversations: ConversationsApiIface;\n definitions: DefinitionsApiIface;\n providers: ProvidersApiIface;\n computerSetupGuides: ComputerSetupGuidesApiIface;\n schedules: SchedulesApiIface;\n /**\n * ACP-native access (`/acp/ws`): an ACP v2 ClientApp connection on which the\n * agents API is the agent. The ACP SDK loads on the first `connect`.\n */\n acp: AcpApiIface;\n /**\n * Ends every stream (they reject with a `client_closed` ClientError) and, when\n * the client created its own realtime transport, closes the gateway connection\n * and cancels its retries. A transport passed in `realtime` belongs to the\n * caller and is left open. Idempotent.\n */\n close: () => void;\n [Symbol.asyncDispose]: () => Promise<void>;\n}\n\nexport const createClient = (options: CreateClientOptionsIface): AgentClientIface => {\n const http = createHttp({\n host: options.host,\n auth: options.auth,\n headers: options.headers,\n fetch: options.fetch,\n });\n let realtime = options.realtime ?? null;\n let ownTransport: GatewayRealtimeTransportIface | null = null;\n const closing = new AbortController();\n const createRealtimeSession: RealtimeApiIface['createSession'] = (sessionOptions) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/realtime/session',\n response: realtimeSessionResponseSchema,\n signal: sessionOptions?.signal,\n });\n let realtimeOwner: Promise<RealtimeSessionResponseIface> | null = null;\n const realtimeOwnerSession = () => {\n if (realtimeOwner != null) return realtimeOwner;\n const pending = createRealtimeSession({ signal: closing.signal });\n realtimeOwner = pending;\n void pending.catch(() => {\n if (realtimeOwner === pending) realtimeOwner = null;\n });\n return pending;\n };\n let realtimeUser: Promise<string> | null = null;\n // Shared by every stream, so it is cancelled only with the client, never by one caller.\n const realtimeUserId: ClientContextIface['realtimeUserId'] = () => {\n if (realtimeUser != null) return realtimeUser;\n const pending = realtimeOwnerSession().then((session) => {\n if (session.userId == null)\n throw new Error('This client authenticates as an API-key owner, not a user');\n return session.userId;\n });\n realtimeUser = pending;\n // A failed (or aborted) read is not cached.\n pending.catch(() => {\n if (realtimeUser === pending) realtimeUser = null;\n });\n return pending;\n };\n const context: ClientContextIface = {\n http,\n closeSignal: closing.signal,\n realtimeUserId,\n // Conversations is the only collection.\n realtimeCollectionTopic: async () => {\n const owner = await realtimeOwnerSession();\n // API keys act in their project, not as members: they reach agents through channels.\n if (owner.userId == null)\n throw new Error('Collection streams belong to users; API-key owners use session streams');\n return agentRealtimeTopics.userConversations(owner.userId);\n },\n storageFetch: options.storageFetch ?? ((input, init) => globalThis.fetch(input, init)),\n realtime: () => {\n if (realtime != null) return realtime;\n ownTransport = createGatewayRealtimeTransport({\n createSession: () => createRealtimeSession(),\n connect: options.gatewayConnect,\n });\n if (closing.signal.aborted) ownTransport.close();\n realtime = ownTransport;\n return realtime;\n },\n timing: { ...defaultStreamTiming, ...options.timing },\n newKey: options.newKey ?? (() => globalThis.crypto.randomUUID()),\n now: options.now ?? Date.now,\n };\n\n const close = (): void => {\n if (closing.signal.aborted) return;\n closing.abort(\n clientError({ message: 'Agent client closed', status: 0, code: ClientErrorCode.Closed }),\n );\n ownTransport?.close();\n };\n\n return {\n close,\n [Symbol.asyncDispose]: async () => close(),\n health: (healthOptions) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/health',\n response: healthResponseSchema,\n signal: healthOptions?.signal,\n }),\n agents: {\n list: (listOptions) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/agents',\n query: {\n cursor: listOptions?.cursor,\n limit: listOptions?.limit,\n projectId: listOptions?.projectId,\n },\n response: agentListSchema,\n signal: listOptions?.signal,\n }),\n get: (slugOrId) => ({\n slug: slugOrId,\n info: (infoOptions) =>\n http.request({\n method: HttpMethod.Get,\n path: `/v1/agents/${encodePath(slugOrId)}`,\n response: agentInfoSchema,\n signal: infoOptions?.signal,\n }),\n }),\n },\n people: (() => {\n const list: PeopleApiIface['list'] = (listOptions) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/people',\n query: { cursor: listOptions?.cursor, limit: listOptions?.limit },\n response: personListSchema,\n signal: listOptions?.signal,\n });\n return {\n list,\n all: async (allOptions) => {\n const all: PersonIface[] = [];\n let cursor: string | undefined;\n for (;;) {\n const next = await list({ cursor, signal: allOptions?.signal });\n all.push(...next.people);\n if (next.nextCursor == null) return all;\n cursor = next.nextCursor;\n }\n },\n };\n })(),\n realtime: { createSession: createRealtimeSession },\n sessions: createSessionsApi(context),\n conversations: createConversationsApi(context),\n definitions: createDefinitionsApi(context),\n providers: createProvidersApi(context),\n computerSetupGuides: createComputerSetupGuidesApi(context),\n schedules: createSchedulesApi(context),\n acp: createAcpApi({ http }),\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP,SAAS,oBAAsC;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,kBAAoE;AAC7E,SAAS,8BAA0D;AACnE,SAAS,aAAa,uBAAuB;AAC7C,SAAS,2BAAmD;AAC5D;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,OAIK;AACP,SAAS,yBAAgD;
|
|
4
|
+
"sourcesContent": ["import {\n agentInfoSchema,\n agentListSchema,\n agentRealtimeTopics,\n healthResponseSchema,\n personListSchema,\n realtimeSessionResponseSchema,\n type AgentInfoIface,\n type AgentListIface,\n type HealthResponseIface,\n type PersonIface,\n type PersonListIface,\n type RealtimeSessionResponseIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport { createAcpApi, type AcpApiIface } from \"./acp.mjs\";\nimport {\n createComputerSetupGuidesApi,\n createDefinitionsApi,\n createProvidersApi,\n createSchedulesApi,\n type ComputerSetupGuidesApiIface,\n type DefinitionsApiIface,\n type ProvidersApiIface,\n type SchedulesApiIface,\n} from \"./build.mjs\";\nimport { encodePath, type ClientContextIface, type SignalOptionsIface } from \"./context.mjs\";\nimport { createChannelBindingsApi, type ChannelBindingsApiIface } from \"./channels.mjs\";\nimport { createConversationsApi, type ConversationsApiIface } from \"./conversations.mjs\";\nimport { clientError, ClientErrorCode } from \"./errors.mjs\";\nimport { defaultStreamTiming, type StreamTimingIface } from \"./frame-stream.mjs\";\nimport {\n createHttp,\n HttpMethod,\n type AgentClientAuth,\n type FetchIface,\n type HeadersOption,\n} from \"./http.mjs\";\nimport {\n createGatewayRealtimeTransport,\n type GatewayConnect,\n type GatewayRealtimeTransportIface,\n type RealtimeTransportIface,\n} from \"./realtime.mjs\";\nimport { createSessionsApi, type SessionsApiIface } from \"./sessions.mjs\";\n\nexport interface CreateClientOptionsIface {\n /**\n * The agents API origin (`https://agent-session.final.ai`; its API is under\n * `/api` and ACP at `/acp/ws`), or a base URL the API routes are mounted under.\n */\n host: string;\n auth: AgentClientAuth;\n /** Extra headers per request; console clients send their client identity header here. */\n headers?: HeadersOption;\n /** API requests (the host's routes); carries auth and caller headers. */\n fetch?: FetchIface;\n /**\n * Presigned storage requests (attachment uploads). Gets only the headers the\n * presign requires, never auth, client identity or cookies, so a storage\n * bucket's CORS and third-party hosts see nothing of the caller. Defaults to\n * `globalThis.fetch`; keep it free of header-injecting wrappers.\n */\n storageFetch?: FetchIface;\n /** console-web and console-mobile pass their realtime clients; defaults to a gateway connection. */\n realtime?: RealtimeTransportIface;\n /** Seam for the default transport's gateway connection. */\n gatewayConnect?: GatewayConnect;\n /** Seam for stream retry timing (tests). */\n timing?: Partial<StreamTimingIface>;\n /** Seam for idempotency keys and client message ids; defaults to `crypto.randomUUID`. */\n newKey?: () => string;\n /** Seam for the client clock (conversation recovery windows). */\n now?: () => number;\n}\n\nexport interface AgentHandleIface {\n slug: string;\n info: (options?: SignalOptionsIface) => Promise<AgentInfoIface>;\n}\n\nexport interface AgentsApiIface {\n /**\n * The agents the caller can use; with `projectId`, those usable there (its own and those\n * inherited from its ancestors). Without it, everything the caller can access (an API key: its\n * parent project and every project it is granted; a person: every project they can read).\n */\n list: (\n options?: SignalOptionsIface & { cursor?: string; limit?: number; projectId?: string },\n ) => Promise<AgentListIface>;\n /** I/O-free handle by slug or id. */\n get: (slugOrId: string) => AgentHandleIface;\n}\n\nexport interface PeopleApiIface {\n /** One page of the caller's organization members, by name; pass `nextCursor` as `cursor` for the next. */\n list: (\n options?: SignalOptionsIface & { cursor?: string; limit?: number },\n ) => Promise<PersonListIface>;\n /** Every member of the caller's organization (all pages). */\n all: (options?: SignalOptionsIface) => Promise<PersonIface[]>;\n}\n\nexport interface RealtimeApiIface {\n /**\n * Mints a gateway session (`POST /v1/realtime/session`) for the signed-in user:\n * the gateway URL, a short-lived token, and the user id realtime topics are keyed by.\n * Pass it as `createSession` to `createGatewayRealtimeTransport` when supplying a transport.\n */\n createSession: (options?: SignalOptionsIface) => Promise<RealtimeSessionResponseIface>;\n}\n\nexport interface AgentClientIface {\n health: (options?: SignalOptionsIface) => Promise<HealthResponseIface>;\n agents: AgentsApiIface;\n people: PeopleApiIface;\n realtime: RealtimeApiIface;\n sessions: SessionsApiIface;\n conversations: ConversationsApiIface;\n channelBindings: ChannelBindingsApiIface;\n definitions: DefinitionsApiIface;\n providers: ProvidersApiIface;\n computerSetupGuides: ComputerSetupGuidesApiIface;\n schedules: SchedulesApiIface;\n /**\n * ACP-native access (`/acp/ws`): an ACP v2 ClientApp connection on which the\n * agents API is the agent. The ACP SDK loads on the first `connect`.\n */\n acp: AcpApiIface;\n /**\n * Ends every stream (they reject with a `client_closed` ClientError) and, when\n * the client created its own realtime transport, closes the gateway connection\n * and cancels its retries. A transport passed in `realtime` belongs to the\n * caller and is left open. Idempotent.\n */\n close: () => void;\n [Symbol.asyncDispose]: () => Promise<void>;\n}\n\nexport const createClient = (options: CreateClientOptionsIface): AgentClientIface => {\n const http = createHttp({\n host: options.host,\n auth: options.auth,\n headers: options.headers,\n fetch: options.fetch,\n });\n let realtime = options.realtime ?? null;\n let ownTransport: GatewayRealtimeTransportIface | null = null;\n const closing = new AbortController();\n const createRealtimeSession: RealtimeApiIface['createSession'] = (sessionOptions) =>\n http.request({\n method: HttpMethod.Post,\n path: '/v1/realtime/session',\n response: realtimeSessionResponseSchema,\n signal: sessionOptions?.signal,\n });\n let realtimeOwner: Promise<RealtimeSessionResponseIface> | null = null;\n const realtimeOwnerSession = () => {\n if (realtimeOwner != null) return realtimeOwner;\n const pending = createRealtimeSession({ signal: closing.signal });\n realtimeOwner = pending;\n void pending.catch(() => {\n if (realtimeOwner === pending) realtimeOwner = null;\n });\n return pending;\n };\n let realtimeUser: Promise<string> | null = null;\n // Shared by every stream, so it is cancelled only with the client, never by one caller.\n const realtimeUserId: ClientContextIface['realtimeUserId'] = () => {\n if (realtimeUser != null) return realtimeUser;\n const pending = realtimeOwnerSession().then((session) => {\n if (session.userId == null)\n throw new Error('This client authenticates as an API-key owner, not a user');\n return session.userId;\n });\n realtimeUser = pending;\n // A failed (or aborted) read is not cached.\n pending.catch(() => {\n if (realtimeUser === pending) realtimeUser = null;\n });\n return pending;\n };\n const context: ClientContextIface = {\n http,\n closeSignal: closing.signal,\n realtimeUserId,\n // Conversations is the only collection.\n realtimeCollectionTopic: async () => {\n const owner = await realtimeOwnerSession();\n // API keys act in their project, not as members: they reach agents through channels.\n if (owner.userId == null)\n throw new Error('Collection streams belong to users; API-key owners use session streams');\n return agentRealtimeTopics.userConversations(owner.userId);\n },\n storageFetch: options.storageFetch ?? ((input, init) => globalThis.fetch(input, init)),\n realtime: () => {\n if (realtime != null) return realtime;\n ownTransport = createGatewayRealtimeTransport({\n createSession: () => createRealtimeSession(),\n connect: options.gatewayConnect,\n });\n if (closing.signal.aborted) ownTransport.close();\n realtime = ownTransport;\n return realtime;\n },\n timing: { ...defaultStreamTiming, ...options.timing },\n newKey: options.newKey ?? (() => globalThis.crypto.randomUUID()),\n now: options.now ?? Date.now,\n };\n\n const close = (): void => {\n if (closing.signal.aborted) return;\n closing.abort(\n clientError({ message: 'Agent client closed', status: 0, code: ClientErrorCode.Closed }),\n );\n ownTransport?.close();\n };\n\n return {\n close,\n [Symbol.asyncDispose]: async () => close(),\n health: (healthOptions) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/health',\n response: healthResponseSchema,\n signal: healthOptions?.signal,\n }),\n agents: {\n list: (listOptions) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/agents',\n query: {\n cursor: listOptions?.cursor,\n limit: listOptions?.limit,\n projectId: listOptions?.projectId,\n },\n response: agentListSchema,\n signal: listOptions?.signal,\n }),\n get: (slugOrId) => ({\n slug: slugOrId,\n info: (infoOptions) =>\n http.request({\n method: HttpMethod.Get,\n path: `/v1/agents/${encodePath(slugOrId)}`,\n response: agentInfoSchema,\n signal: infoOptions?.signal,\n }),\n }),\n },\n people: (() => {\n const list: PeopleApiIface['list'] = (listOptions) =>\n http.request({\n method: HttpMethod.Get,\n path: '/v1/people',\n query: { cursor: listOptions?.cursor, limit: listOptions?.limit },\n response: personListSchema,\n signal: listOptions?.signal,\n });\n return {\n list,\n all: async (allOptions) => {\n const all: PersonIface[] = [];\n let cursor: string | undefined;\n for (;;) {\n const next = await list({ cursor, signal: allOptions?.signal });\n all.push(...next.people);\n if (next.nextCursor == null) return all;\n cursor = next.nextCursor;\n }\n },\n };\n })(),\n realtime: { createSession: createRealtimeSession },\n sessions: createSessionsApi(context),\n conversations: createConversationsApi(context),\n channelBindings: createChannelBindingsApi(context),\n definitions: createDefinitionsApi(context),\n providers: createProvidersApi(context),\n computerSetupGuides: createComputerSetupGuidesApi(context),\n schedules: createSchedulesApi(context),\n acp: createAcpApi({ http }),\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP,SAAS,oBAAsC;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,kBAAoE;AAC7E,SAAS,gCAA8D;AACvE,SAAS,8BAA0D;AACnE,SAAS,aAAa,uBAAuB;AAC7C,SAAS,2BAAmD;AAC5D;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,OAIK;AACP,SAAS,yBAAgD;AA+FlD,MAAM,eAAe,CAAC,YAAwD;AACnF,QAAM,OAAO,WAAW;AAAA,IACtB,MAAM,QAAQ;AAAA,IACd,MAAM,QAAQ;AAAA,IACd,SAAS,QAAQ;AAAA,IACjB,OAAO,QAAQ;AAAA,EACjB,CAAC;AACD,MAAI,WAAW,QAAQ,YAAY;AACnC,MAAI,eAAqD;AACzD,QAAM,UAAU,IAAI,gBAAgB;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AAAA,QACnB,MAAM;AAAA,QACN,OAAO,EAAE,QAAQ,aAAa,QAAQ,OAAO,aAAa,MAAM;AAAA,QAChE,UAAU;AAAA,QACV,QAAQ,aAAa;AAAA,MACvB,CAAC;AACH,aAAO;AAAA,QACL;AAAA,QACA,KAAK,OAAO,eAAe;AACzB,gBAAM,MAAqB,CAAC;AAC5B,cAAI;AACJ,qBAAS;AACP,kBAAM,OAAO,MAAM,KAAK,EAAE,QAAQ,QAAQ,YAAY,OAAO,CAAC;AAC9D,gBAAI,KAAK,GAAG,KAAK,MAAM;AACvB,gBAAI,KAAK,cAAc,KAAM,QAAO;AACpC,qBAAS,KAAK;AAAA,UAChB;AAAA,QACF;AAAA,MACF;AAAA,IACF,GAAG;AAAA,IACH,UAAU,EAAE,eAAe,sBAAsB;AAAA,IACjD,UAAU,kBAAkB,OAAO;AAAA,IACnC,eAAe,uBAAuB,OAAO;AAAA,IAC7C,iBAAiB,yBAAyB,OAAO;AAAA,IACjD,aAAa,qBAAqB,OAAO;AAAA,IACzC,WAAW,mBAAmB,OAAO;AAAA,IACrC,qBAAqB,6BAA6B,OAAO;AAAA,IACzD,WAAW,mBAAmB,OAAO;AAAA,IACrC,KAAK,aAAa,EAAE,KAAK,CAAC;AAAA,EAC5B;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -314,8 +314,8 @@ export interface OpenedConversationIface extends ConversationHandleIface {
|
|
|
314
314
|
}
|
|
315
315
|
export interface CreateConversationArgsIface extends SignalOptionsIface {
|
|
316
316
|
/**
|
|
317
|
-
* The project (`prj_...`) a group chat
|
|
318
|
-
*
|
|
317
|
+
* The project (`prj_...`) a signed-in person creates a group chat in (editors only).
|
|
318
|
+
* Omitted: their personal project. Project API keys cannot create person-owned chats.
|
|
319
319
|
* A direct chat is the caller's own and lives in their personal project.
|
|
320
320
|
*/
|
|
321
321
|
projectId?: string;
|
|
@@ -326,10 +326,9 @@ export interface CreateConversationArgsIface extends SignalOptionsIface {
|
|
|
326
326
|
}
|
|
327
327
|
export interface ConversationsApiIface {
|
|
328
328
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* that project and the projects below it.
|
|
329
|
+
* A signed-in person's conversations. Without `projectId`, lists their participant inbox.
|
|
330
|
+
* With `projectId`, also includes readable Shared chats in that project and its descendants.
|
|
331
|
+
* A project API key has no person inbox and receives an empty list.
|
|
333
332
|
*/
|
|
334
333
|
list: (options?: SignalOptionsIface & {
|
|
335
334
|
cursor?: string;
|
|
@@ -343,7 +342,7 @@ export interface ConversationsApiIface {
|
|
|
343
342
|
} & SignalOptionsIface) => Promise<OpenedConversationIface>;
|
|
344
343
|
/**
|
|
345
344
|
* Finds or creates the caller's own Project Agent thread in `projectId`, which
|
|
346
|
-
* omitted, is the
|
|
345
|
+
* omitted, is the signed-in person's personal project. Requires person authority.
|
|
347
346
|
*/
|
|
348
347
|
home: (options?: SignalOptionsIface & {
|
|
349
348
|
projectId?: string;
|
|
@@ -367,9 +366,8 @@ export interface ConversationsApiIface {
|
|
|
367
366
|
listEvents: (options?: CollectionEventsOptionsIface) => AsyncIterableIterator<CollectionEvent>;
|
|
368
367
|
/**
|
|
369
368
|
* What awaits the caller's answer across conversations.
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* that project and the projects below it.
|
|
369
|
+
* Decisions in the selected project and its descendants; omitted, the signed-in person's
|
|
370
|
+
* personal project. A project API key has no person inbox and receives an empty list.
|
|
373
371
|
*/
|
|
374
372
|
decisions: (options?: SignalOptionsIface & {
|
|
375
373
|
cursor?: string;
|