@amigo-ai/sdk 1.0.0 → 1.1.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/README.md +50 -37
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs.map +2 -2
- package/dist/platform.cjs +1754 -0
- package/dist/platform.cjs.map +7 -0
- package/dist/platform.mjs +1723 -0
- package/dist/platform.mjs.map +7 -0
- package/dist/types/core/utils.d.ts +11 -0
- package/dist/types/generated/api-types.d.ts +1 -1
- package/dist/types/generated/platform-api-types.d.ts +45240 -0
- package/dist/types/platform/core/auth.d.ts +6 -0
- package/dist/types/platform/core/branded-types.d.ts +59 -0
- package/dist/types/platform/core/openapi-client.d.ts +6 -0
- package/dist/types/platform/core/websocket.d.ts +8 -0
- package/dist/types/platform/index.d.ts +59 -0
- package/dist/types/platform/resources/agents.d.ts +107 -0
- package/dist/types/platform/resources/api-keys.d.ts +57 -0
- package/dist/types/platform/resources/context-graphs.d.ts +114 -0
- package/dist/types/platform/resources/conversations.d.ts +154 -0
- package/dist/types/platform/resources/data-sources.d.ts +143 -0
- package/dist/types/platform/resources/events.d.ts +253 -0
- package/dist/types/platform/resources/fhir.d.ts +186 -0
- package/dist/types/platform/resources/integrations.d.ts +114 -0
- package/dist/types/platform/resources/phone-numbers.d.ts +170 -0
- package/dist/types/platform/resources/services.d.ts +133 -0
- package/dist/types/platform/resources/sessions.d.ts +61 -0
- package/dist/types/platform/resources/skills.d.ts +169 -0
- package/dist/types/platform/resources/workspaces.d.ts +187 -0
- package/package.json +15 -11
- package/assets/readme/amigo-banner.png +0 -0
- package/assets/readme/classic-ts-architecture.png +0 -0
- package/assets/readme/classic-ts-architecture.svg +0 -102
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Middleware } from 'openapi-fetch';
|
|
2
|
+
/**
|
|
3
|
+
* Create a middleware that sets the Authorization header with a raw API key.
|
|
4
|
+
* Platform API uses simple Bearer token auth — no token exchange needed.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createPlatformAuthMiddleware(apiKey: string): Middleware;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare const __brand: unique symbol;
|
|
2
|
+
type Brand<T, B extends string> = T & {
|
|
3
|
+
readonly [__brand]: B;
|
|
4
|
+
};
|
|
5
|
+
/** A branded string representing a Workspace ID. */
|
|
6
|
+
export type WorkspaceId = Brand<string, 'WorkspaceId'>;
|
|
7
|
+
/** A branded string representing a Skill ID. */
|
|
8
|
+
export type SkillId = Brand<string, 'SkillId'>;
|
|
9
|
+
/** A branded string representing an Integration ID. */
|
|
10
|
+
export type IntegrationId = Brand<string, 'IntegrationId'>;
|
|
11
|
+
/** A branded string representing an HSM ID. */
|
|
12
|
+
export type HsmId = Brand<string, 'HsmId'>;
|
|
13
|
+
/** A branded string representing a Context Graph ID. */
|
|
14
|
+
export type ContextGraphId = Brand<string, 'ContextGraphId'>;
|
|
15
|
+
/** A branded string representing a Platform Agent ID. */
|
|
16
|
+
export type PlatformAgentId = Brand<string, 'PlatformAgentId'>;
|
|
17
|
+
/** A branded string representing a Platform Service ID. */
|
|
18
|
+
export type PlatformServiceId = Brand<string, 'PlatformServiceId'>;
|
|
19
|
+
/** A branded string representing a Phone Number ID. */
|
|
20
|
+
export type PhoneNumberId = Brand<string, 'PhoneNumberId'>;
|
|
21
|
+
/** A branded string representing a Platform API Key ID. */
|
|
22
|
+
export type PlatformApiKeyId = Brand<string, 'PlatformApiKeyId'>;
|
|
23
|
+
/** A branded string representing a Call SID. */
|
|
24
|
+
export type CallSid = Brand<string, 'CallSid'>;
|
|
25
|
+
/** A branded string representing a Platform Conversation ID. */
|
|
26
|
+
export type PlatformConversationId = Brand<string, 'PlatformConversationId'>;
|
|
27
|
+
/** A branded string representing a Data Source ID. */
|
|
28
|
+
export type DataSourceId = Brand<string, 'DataSourceId'>;
|
|
29
|
+
/** A branded string representing an Operator ID. */
|
|
30
|
+
export type OperatorId = Brand<string, 'OperatorId'>;
|
|
31
|
+
/** A branded string representing a Review Item ID. */
|
|
32
|
+
export type ReviewItemId = Brand<string, 'ReviewItemId'>;
|
|
33
|
+
/** A branded string representing a Monitor Concept ID. */
|
|
34
|
+
export type MonitorConceptId = Brand<string, 'MonitorConceptId'>;
|
|
35
|
+
/** A branded string representing a Unification Rule ID. */
|
|
36
|
+
export type UnificationRuleId = Brand<string, 'UnificationRuleId'>;
|
|
37
|
+
/** A branded string representing an Entity ID. */
|
|
38
|
+
export type EntityId = Brand<string, 'EntityId'>;
|
|
39
|
+
/** A branded string representing a Task ID. */
|
|
40
|
+
export type TaskId = Brand<string, 'TaskId'>;
|
|
41
|
+
export declare function workspaceId(id: string): WorkspaceId;
|
|
42
|
+
export declare function skillId(id: string): SkillId;
|
|
43
|
+
export declare function integrationId(id: string): IntegrationId;
|
|
44
|
+
export declare function hsmId(id: string): HsmId;
|
|
45
|
+
export declare function contextGraphId(id: string): ContextGraphId;
|
|
46
|
+
export declare function platformAgentId(id: string): PlatformAgentId;
|
|
47
|
+
export declare function platformServiceId(id: string): PlatformServiceId;
|
|
48
|
+
export declare function phoneNumberId(id: string): PhoneNumberId;
|
|
49
|
+
export declare function platformApiKeyId(id: string): PlatformApiKeyId;
|
|
50
|
+
export declare function callSid(id: string): CallSid;
|
|
51
|
+
export declare function platformConversationId(id: string): PlatformConversationId;
|
|
52
|
+
export declare function dataSourceId(id: string): DataSourceId;
|
|
53
|
+
export declare function operatorId(id: string): OperatorId;
|
|
54
|
+
export declare function reviewItemId(id: string): ReviewItemId;
|
|
55
|
+
export declare function monitorConceptId(id: string): MonitorConceptId;
|
|
56
|
+
export declare function unificationRuleId(id: string): UnificationRuleId;
|
|
57
|
+
export declare function entityId(id: string): EntityId;
|
|
58
|
+
export declare function taskId(id: string): TaskId;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Client } from 'openapi-fetch';
|
|
2
|
+
import type { paths } from '../../generated/platform-api-types';
|
|
3
|
+
import type { PlatformClientConfig } from '..';
|
|
4
|
+
export type PlatformFetch = Client<paths>;
|
|
5
|
+
/** Create an OpenAPI-typed fetch client for the Platform API. */
|
|
6
|
+
export declare function createPlatformFetch(config: PlatformClientConfig, mockFetch?: typeof fetch): PlatformFetch;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface PlatformWebSocketLike {
|
|
2
|
+
close(code?: number, reason?: string): void;
|
|
3
|
+
send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
4
|
+
readonly readyState: number;
|
|
5
|
+
}
|
|
6
|
+
export type PlatformWebSocketConstructor = new (url: string, protocols?: string | string[]) => PlatformWebSocketLike;
|
|
7
|
+
export declare function webSocketBaseFromHttpBase(baseUrl: string): string;
|
|
8
|
+
export declare function getWebSocketConstructor(override?: PlatformWebSocketConstructor): PlatformWebSocketConstructor;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { RetryOptions } from '../core/retry';
|
|
2
|
+
import { createPlatformFetch, type PlatformFetch } from './core/openapi-client';
|
|
3
|
+
import { type PlatformWebSocketConstructor } from './core/websocket';
|
|
4
|
+
import { PlatformAgentResource } from './resources/agents';
|
|
5
|
+
import { PlatformApiKeyResource } from './resources/api-keys';
|
|
6
|
+
import { ContextGraphResource } from './resources/context-graphs';
|
|
7
|
+
import { PlatformConversationResource } from './resources/conversations';
|
|
8
|
+
import { DataSourceResource } from './resources/data-sources';
|
|
9
|
+
import { PlatformEventResource } from './resources/events';
|
|
10
|
+
import { FhirResource } from './resources/fhir';
|
|
11
|
+
import { IntegrationResource } from './resources/integrations';
|
|
12
|
+
import { PhoneNumberResource } from './resources/phone-numbers';
|
|
13
|
+
import { PlatformServiceResource } from './resources/services';
|
|
14
|
+
import { PlatformSessionResource } from './resources/sessions';
|
|
15
|
+
import { SkillResource } from './resources/skills';
|
|
16
|
+
import { WorkspaceResource } from './resources/workspaces';
|
|
17
|
+
import type { WorkspaceId } from './core/branded-types';
|
|
18
|
+
export interface PlatformClientConfig {
|
|
19
|
+
/** Platform API key or JWT. */
|
|
20
|
+
apiKey: string;
|
|
21
|
+
/** Workspace ID used by workspace-scoped resources. */
|
|
22
|
+
workspaceId: WorkspaceId;
|
|
23
|
+
/** Platform API base URL. */
|
|
24
|
+
baseUrl?: string;
|
|
25
|
+
/** Platform WebSocket base URL. Defaults to `baseUrl` with ws/wss protocol. */
|
|
26
|
+
webSocketBaseUrl?: string;
|
|
27
|
+
/** Retry configuration for HTTP requests. */
|
|
28
|
+
retry?: RetryOptions;
|
|
29
|
+
/** Fetch implementation override for tests or non-standard runtimes. */
|
|
30
|
+
fetch?: typeof fetch;
|
|
31
|
+
/** WebSocket constructor override for Node runtimes without global WebSocket. */
|
|
32
|
+
WebSocket?: PlatformWebSocketConstructor;
|
|
33
|
+
}
|
|
34
|
+
/** Main client for the workspace-scoped Amigo Platform API. */
|
|
35
|
+
export declare class PlatformClient {
|
|
36
|
+
readonly api: PlatformFetch;
|
|
37
|
+
readonly agents: PlatformAgentResource;
|
|
38
|
+
readonly apiKeys: PlatformApiKeyResource;
|
|
39
|
+
readonly contextGraphs: ContextGraphResource;
|
|
40
|
+
readonly conversations: PlatformConversationResource;
|
|
41
|
+
readonly dataSources: DataSourceResource;
|
|
42
|
+
readonly events: PlatformEventResource;
|
|
43
|
+
readonly fhir: FhirResource;
|
|
44
|
+
readonly integrations: IntegrationResource;
|
|
45
|
+
readonly phoneNumbers: PhoneNumberResource;
|
|
46
|
+
readonly services: PlatformServiceResource;
|
|
47
|
+
readonly sessions: PlatformSessionResource;
|
|
48
|
+
readonly skills: SkillResource;
|
|
49
|
+
readonly workspaces: WorkspaceResource;
|
|
50
|
+
readonly config: Required<Pick<PlatformClientConfig, 'apiKey' | 'workspaceId' | 'baseUrl' | 'webSocketBaseUrl'>> & Omit<PlatformClientConfig, 'apiKey' | 'workspaceId' | 'baseUrl' | 'webSocketBaseUrl'>;
|
|
51
|
+
constructor(config: PlatformClientConfig);
|
|
52
|
+
}
|
|
53
|
+
export { createPlatformFetch };
|
|
54
|
+
export type { PlatformFetch, PlatformWebSocketConstructor };
|
|
55
|
+
export type { ServerSentEvent } from '../core/utils';
|
|
56
|
+
export { AmigoError, BadRequestError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, ServerError, ServiceUnavailableError, ConfigurationError, ValidationError, NetworkError, ParseError, isAmigoError, } from '../core/errors';
|
|
57
|
+
export type { components, operations, paths } from '../generated/platform-api-types';
|
|
58
|
+
export type { CallSid, ContextGraphId, DataSourceId, EntityId, IntegrationId, MonitorConceptId, OperatorId, PhoneNumberId, PlatformAgentId, PlatformApiKeyId, PlatformConversationId, PlatformServiceId, ReviewItemId, SkillId, TaskId, UnificationRuleId, WorkspaceId, } from './core/branded-types';
|
|
59
|
+
export { callSid, contextGraphId, dataSourceId, entityId, integrationId, monitorConceptId, operatorId, phoneNumberId, platformAgentId, platformApiKeyId, platformConversationId, platformServiceId, reviewItemId, skillId, taskId, unificationRuleId, workspaceId, } from './core/branded-types';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { PlatformFetch } from '../core/openapi-client';
|
|
2
|
+
import type { components, operations } from '../../generated/platform-api-types';
|
|
3
|
+
import type { WorkspaceId, PlatformAgentId } from '../core/branded-types';
|
|
4
|
+
/** Resource for managing platform agents. */
|
|
5
|
+
export declare class PlatformAgentResource {
|
|
6
|
+
private c;
|
|
7
|
+
private workspaceId;
|
|
8
|
+
constructor(c: PlatformFetch, workspaceId: WorkspaceId);
|
|
9
|
+
/** List agents in the workspace. */
|
|
10
|
+
list(options?: {
|
|
11
|
+
query?: operations['list-agents']['parameters']['query'];
|
|
12
|
+
}): Promise<{
|
|
13
|
+
continuation_token?: number | null;
|
|
14
|
+
has_more: boolean;
|
|
15
|
+
items: components["schemas"]["AgentResponse"][];
|
|
16
|
+
total?: number | null;
|
|
17
|
+
}>;
|
|
18
|
+
/** Get an agent by ID. */
|
|
19
|
+
get(options: {
|
|
20
|
+
agentId: PlatformAgentId;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
created_at: string;
|
|
23
|
+
description: string;
|
|
24
|
+
id: string;
|
|
25
|
+
latest_version?: number;
|
|
26
|
+
name: string;
|
|
27
|
+
updated_at: string;
|
|
28
|
+
workspace_id: string;
|
|
29
|
+
}>;
|
|
30
|
+
/** Create a new agent. */
|
|
31
|
+
create(options: {
|
|
32
|
+
body: components['schemas']['CreateAgentRequest'];
|
|
33
|
+
}): Promise<{
|
|
34
|
+
created_at: string;
|
|
35
|
+
description: string;
|
|
36
|
+
id: string;
|
|
37
|
+
latest_version?: number;
|
|
38
|
+
name: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
workspace_id: string;
|
|
41
|
+
}>;
|
|
42
|
+
/** Update an agent. */
|
|
43
|
+
update(options: {
|
|
44
|
+
agentId: PlatformAgentId;
|
|
45
|
+
body: components['schemas']['UpdateAgentRequest'];
|
|
46
|
+
}): Promise<{
|
|
47
|
+
created_at: string;
|
|
48
|
+
description: string;
|
|
49
|
+
id: string;
|
|
50
|
+
latest_version?: number;
|
|
51
|
+
name: string;
|
|
52
|
+
updated_at: string;
|
|
53
|
+
workspace_id: string;
|
|
54
|
+
}>;
|
|
55
|
+
/** Delete an agent. */
|
|
56
|
+
delete(options: {
|
|
57
|
+
agentId: PlatformAgentId;
|
|
58
|
+
}): Promise<void>;
|
|
59
|
+
/** List agent versions. */
|
|
60
|
+
listVersions(options: {
|
|
61
|
+
agentId: PlatformAgentId;
|
|
62
|
+
query?: operations['list-agent-versions']['parameters']['query'];
|
|
63
|
+
}): Promise<{
|
|
64
|
+
continuation_token?: number | null;
|
|
65
|
+
has_more: boolean;
|
|
66
|
+
items: components["schemas"]["AgentVersionResponse"][];
|
|
67
|
+
total?: number | null;
|
|
68
|
+
}>;
|
|
69
|
+
/** Get a specific agent version, or pass `"latest"` for the most recent version. */
|
|
70
|
+
getVersion(options: {
|
|
71
|
+
agentId: PlatformAgentId;
|
|
72
|
+
version: number | 'latest';
|
|
73
|
+
}): Promise<{
|
|
74
|
+
agent_id: string;
|
|
75
|
+
background: string;
|
|
76
|
+
behaviors: string[];
|
|
77
|
+
communication_patterns: string[];
|
|
78
|
+
created_at: string;
|
|
79
|
+
id: string;
|
|
80
|
+
identity: components["schemas"]["Identity"];
|
|
81
|
+
initials: string;
|
|
82
|
+
name: string;
|
|
83
|
+
updated_at: string;
|
|
84
|
+
version: number;
|
|
85
|
+
voice_config: components["schemas"]["VoiceConfig"] | null;
|
|
86
|
+
workspace_id: string;
|
|
87
|
+
}>;
|
|
88
|
+
/** Create a new agent version. */
|
|
89
|
+
createVersion(options: {
|
|
90
|
+
agentId: PlatformAgentId;
|
|
91
|
+
body: components['schemas']['CreateAgentVersionRequest'];
|
|
92
|
+
}): Promise<{
|
|
93
|
+
agent_id: string;
|
|
94
|
+
background: string;
|
|
95
|
+
behaviors: string[];
|
|
96
|
+
communication_patterns: string[];
|
|
97
|
+
created_at: string;
|
|
98
|
+
id: string;
|
|
99
|
+
identity: components["schemas"]["Identity"];
|
|
100
|
+
initials: string;
|
|
101
|
+
name: string;
|
|
102
|
+
updated_at: string;
|
|
103
|
+
version: number;
|
|
104
|
+
voice_config: components["schemas"]["VoiceConfig"] | null;
|
|
105
|
+
workspace_id: string;
|
|
106
|
+
}>;
|
|
107
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { PlatformFetch } from '../core/openapi-client';
|
|
2
|
+
import type { components, operations } from '../../generated/platform-api-types';
|
|
3
|
+
import type { WorkspaceId, PlatformApiKeyId } from '../core/branded-types';
|
|
4
|
+
/** Resource for managing API keys. */
|
|
5
|
+
export declare class PlatformApiKeyResource {
|
|
6
|
+
private c;
|
|
7
|
+
private workspaceId;
|
|
8
|
+
constructor(c: PlatformFetch, workspaceId: WorkspaceId);
|
|
9
|
+
/** Get information about the currently authenticated API key. */
|
|
10
|
+
me(): Promise<{
|
|
11
|
+
expires_at: string;
|
|
12
|
+
expires_in_seconds: number;
|
|
13
|
+
key_id: string;
|
|
14
|
+
name: string | null;
|
|
15
|
+
workspace_id: string;
|
|
16
|
+
}>;
|
|
17
|
+
/** List API keys in the workspace. */
|
|
18
|
+
list(options?: {
|
|
19
|
+
query?: operations['list-api-keys']['parameters']['query'];
|
|
20
|
+
}): Promise<{
|
|
21
|
+
continuation_token?: number | null;
|
|
22
|
+
has_more: boolean;
|
|
23
|
+
items: components["schemas"]["ApiKeyResponse"][];
|
|
24
|
+
total?: number | null;
|
|
25
|
+
}>;
|
|
26
|
+
/** Create a new API key. */
|
|
27
|
+
create(options: {
|
|
28
|
+
body: components['schemas']['CreateApiKeyRequest'];
|
|
29
|
+
}): Promise<{
|
|
30
|
+
api_key: string;
|
|
31
|
+
created_by_credential_id: string | null;
|
|
32
|
+
created_by_entity_id: string | null;
|
|
33
|
+
expires_at: string;
|
|
34
|
+
key_id: string;
|
|
35
|
+
name: string | null;
|
|
36
|
+
permissions: string[];
|
|
37
|
+
role: string;
|
|
38
|
+
}>;
|
|
39
|
+
/** Delete an API key. */
|
|
40
|
+
delete(options: {
|
|
41
|
+
keyId: PlatformApiKeyId;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
/** Rotate an API key and return the replacement secret. */
|
|
44
|
+
rotate(options: {
|
|
45
|
+
keyId: PlatformApiKeyId;
|
|
46
|
+
body: components['schemas']['RotateApiKeyRequest'];
|
|
47
|
+
}): Promise<{
|
|
48
|
+
api_key: string;
|
|
49
|
+
created_by_credential_id: string | null;
|
|
50
|
+
created_by_entity_id: string | null;
|
|
51
|
+
expires_at: string;
|
|
52
|
+
key_id: string;
|
|
53
|
+
name: string | null;
|
|
54
|
+
permissions: string[];
|
|
55
|
+
role: string;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { PlatformFetch } from '../core/openapi-client';
|
|
2
|
+
import type { components, operations } from '../../generated/platform-api-types';
|
|
3
|
+
import type { ContextGraphId, WorkspaceId } from '../core/branded-types';
|
|
4
|
+
/** Resource for managing platform context graphs. */
|
|
5
|
+
export declare class ContextGraphResource {
|
|
6
|
+
private c;
|
|
7
|
+
private workspaceId;
|
|
8
|
+
constructor(c: PlatformFetch, workspaceId: WorkspaceId);
|
|
9
|
+
/** List context graphs in the workspace. */
|
|
10
|
+
list(options?: {
|
|
11
|
+
query?: operations['list-context_graphs']['parameters']['query'];
|
|
12
|
+
}): Promise<{
|
|
13
|
+
continuation_token?: number | null;
|
|
14
|
+
has_more: boolean;
|
|
15
|
+
items: components["schemas"]["ContextGraphResponse"][];
|
|
16
|
+
total?: number | null;
|
|
17
|
+
}>;
|
|
18
|
+
/** Get a context graph by ID. */
|
|
19
|
+
get(options: {
|
|
20
|
+
contextGraphId: ContextGraphId;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
created_at: string;
|
|
23
|
+
description: string;
|
|
24
|
+
id: string;
|
|
25
|
+
latest_version?: number;
|
|
26
|
+
name: string;
|
|
27
|
+
state_count?: number;
|
|
28
|
+
updated_at: string;
|
|
29
|
+
workspace_id: string;
|
|
30
|
+
}>;
|
|
31
|
+
/** Create a new context graph. */
|
|
32
|
+
create(options: {
|
|
33
|
+
body: components['schemas']['CreateContextGraphRequest'];
|
|
34
|
+
}): Promise<{
|
|
35
|
+
created_at: string;
|
|
36
|
+
description: string;
|
|
37
|
+
id: string;
|
|
38
|
+
latest_version?: number;
|
|
39
|
+
name: string;
|
|
40
|
+
state_count?: number;
|
|
41
|
+
updated_at: string;
|
|
42
|
+
workspace_id: string;
|
|
43
|
+
}>;
|
|
44
|
+
/** Update a context graph. */
|
|
45
|
+
update(options: {
|
|
46
|
+
contextGraphId: ContextGraphId;
|
|
47
|
+
body: components['schemas']['UpdateContextGraphRequest'];
|
|
48
|
+
}): Promise<{
|
|
49
|
+
created_at: string;
|
|
50
|
+
description: string;
|
|
51
|
+
id: string;
|
|
52
|
+
latest_version?: number;
|
|
53
|
+
name: string;
|
|
54
|
+
state_count?: number;
|
|
55
|
+
updated_at: string;
|
|
56
|
+
workspace_id: string;
|
|
57
|
+
}>;
|
|
58
|
+
/** Delete a context graph. */
|
|
59
|
+
delete(options: {
|
|
60
|
+
contextGraphId: ContextGraphId;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
/** List context graph versions. */
|
|
63
|
+
listVersions(options: {
|
|
64
|
+
contextGraphId: ContextGraphId;
|
|
65
|
+
query?: operations['list-context_graph-versions']['parameters']['query'];
|
|
66
|
+
}): Promise<{
|
|
67
|
+
continuation_token?: number | null;
|
|
68
|
+
has_more: boolean;
|
|
69
|
+
items: components["schemas"]["ContextGraphVersionResponse"][];
|
|
70
|
+
total?: number | null;
|
|
71
|
+
}>;
|
|
72
|
+
/** Get a specific context graph version. */
|
|
73
|
+
getVersion(options: {
|
|
74
|
+
contextGraphId: ContextGraphId;
|
|
75
|
+
version: number | 'latest';
|
|
76
|
+
}): Promise<{
|
|
77
|
+
context_graph_id: string;
|
|
78
|
+
created_at: string;
|
|
79
|
+
description: string;
|
|
80
|
+
global_action_guidelines: string[];
|
|
81
|
+
global_boundary_constraints: string[];
|
|
82
|
+
global_intra_state_navigation_guidelines: string[];
|
|
83
|
+
id: string;
|
|
84
|
+
new_user_initial_state: string;
|
|
85
|
+
returning_user_initial_state: string;
|
|
86
|
+
states: components["schemas"]["ContextGraphState-Output"][];
|
|
87
|
+
terminal_state: string;
|
|
88
|
+
topology_description: string | null;
|
|
89
|
+
updated_at: string;
|
|
90
|
+
version: number;
|
|
91
|
+
workspace_id: string;
|
|
92
|
+
}>;
|
|
93
|
+
/** Create a new context graph version. */
|
|
94
|
+
createVersion(options: {
|
|
95
|
+
contextGraphId: ContextGraphId;
|
|
96
|
+
body: components['schemas']['CreateContextGraphVersionRequest'];
|
|
97
|
+
}): Promise<{
|
|
98
|
+
context_graph_id: string;
|
|
99
|
+
created_at: string;
|
|
100
|
+
description: string;
|
|
101
|
+
global_action_guidelines: string[];
|
|
102
|
+
global_boundary_constraints: string[];
|
|
103
|
+
global_intra_state_navigation_guidelines: string[];
|
|
104
|
+
id: string;
|
|
105
|
+
new_user_initial_state: string;
|
|
106
|
+
returning_user_initial_state: string;
|
|
107
|
+
states: components["schemas"]["ContextGraphState-Output"][];
|
|
108
|
+
terminal_state: string;
|
|
109
|
+
topology_description: string | null;
|
|
110
|
+
updated_at: string;
|
|
111
|
+
version: number;
|
|
112
|
+
workspace_id: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { PlatformFetch } from '../core/openapi-client';
|
|
2
|
+
import type { components, operations } from '../../generated/platform-api-types';
|
|
3
|
+
import type { PlatformConversationId, WorkspaceId } from '../core/branded-types';
|
|
4
|
+
/** Resource for managing unified platform conversations. */
|
|
5
|
+
export declare class PlatformConversationResource {
|
|
6
|
+
private c;
|
|
7
|
+
private workspaceId;
|
|
8
|
+
constructor(c: PlatformFetch, workspaceId: WorkspaceId);
|
|
9
|
+
/** List voice and text conversations in the workspace. */
|
|
10
|
+
list(options?: {
|
|
11
|
+
query?: operations['list_conversations_v1__workspace_id__conversations_get']['parameters']['query'];
|
|
12
|
+
}): Promise<{
|
|
13
|
+
has_more: boolean;
|
|
14
|
+
items: components["schemas"]["src__routes__conversations__ConversationSummary"][];
|
|
15
|
+
total: number;
|
|
16
|
+
}>;
|
|
17
|
+
/** Create a text conversation. */
|
|
18
|
+
create(options: {
|
|
19
|
+
body: components['schemas']['CreateConversationRequest'];
|
|
20
|
+
}): Promise<{
|
|
21
|
+
call_sid?: string | null;
|
|
22
|
+
caller_id?: string | null;
|
|
23
|
+
channel_kind: "voice" | "sms" | "whatsapp" | "web" | "email";
|
|
24
|
+
completion_reason?: string | null;
|
|
25
|
+
created_at: string;
|
|
26
|
+
direction?: string | null;
|
|
27
|
+
duration_seconds?: number | null;
|
|
28
|
+
entity_id?: string | null;
|
|
29
|
+
escalation_status?: string | null;
|
|
30
|
+
final_state?: string | null;
|
|
31
|
+
has_recording?: boolean | null;
|
|
32
|
+
id: string;
|
|
33
|
+
phone_number?: string | null;
|
|
34
|
+
plan?: string | null;
|
|
35
|
+
quality_score?: number | null;
|
|
36
|
+
service_id?: string | null;
|
|
37
|
+
source?: string | null;
|
|
38
|
+
status: "active" | "frozen" | "closed" | "completed" | "in-progress" | "failed";
|
|
39
|
+
turn_count?: number;
|
|
40
|
+
turns?: components["schemas"]["ConversationTurn"][];
|
|
41
|
+
updated_at: string;
|
|
42
|
+
voice?: components["schemas"]["VoiceDetail"] | null;
|
|
43
|
+
}>;
|
|
44
|
+
/** Get a conversation detail by ID. */
|
|
45
|
+
get(options: {
|
|
46
|
+
conversationId: PlatformConversationId | string;
|
|
47
|
+
}): Promise<{
|
|
48
|
+
call_sid?: string | null;
|
|
49
|
+
caller_id?: string | null;
|
|
50
|
+
channel_kind: "voice" | "sms" | "whatsapp" | "web" | "email";
|
|
51
|
+
completion_reason?: string | null;
|
|
52
|
+
created_at: string;
|
|
53
|
+
direction?: string | null;
|
|
54
|
+
duration_seconds?: number | null;
|
|
55
|
+
entity_id?: string | null;
|
|
56
|
+
escalation_status?: string | null;
|
|
57
|
+
final_state?: string | null;
|
|
58
|
+
has_recording?: boolean | null;
|
|
59
|
+
id: string;
|
|
60
|
+
phone_number?: string | null;
|
|
61
|
+
plan?: string | null;
|
|
62
|
+
quality_score?: number | null;
|
|
63
|
+
service_id?: string | null;
|
|
64
|
+
source?: string | null;
|
|
65
|
+
status: "active" | "frozen" | "closed" | "completed" | "in-progress" | "failed";
|
|
66
|
+
turn_count?: number;
|
|
67
|
+
turns?: components["schemas"]["ConversationTurn"][];
|
|
68
|
+
updated_at: string;
|
|
69
|
+
voice?: components["schemas"]["VoiceDetail"] | null;
|
|
70
|
+
}>;
|
|
71
|
+
/** Close a text conversation. */
|
|
72
|
+
close(options: {
|
|
73
|
+
conversationId: PlatformConversationId | string;
|
|
74
|
+
}): Promise<void>;
|
|
75
|
+
/** Send a text turn and receive the full JSON response. */
|
|
76
|
+
createTurn(options: {
|
|
77
|
+
conversationId: PlatformConversationId | string;
|
|
78
|
+
body: components['schemas']['TurnRequest'];
|
|
79
|
+
query?: operations['create_turn_v1__workspace_id__conversations__conversation_id__turns_post']['parameters']['query'];
|
|
80
|
+
}): Promise<NonNullable<{
|
|
81
|
+
conversation_id: string;
|
|
82
|
+
event: "done";
|
|
83
|
+
status: string;
|
|
84
|
+
turn_count: number;
|
|
85
|
+
} | {
|
|
86
|
+
event: "error";
|
|
87
|
+
message: string;
|
|
88
|
+
} | {
|
|
89
|
+
event: "message";
|
|
90
|
+
role: string;
|
|
91
|
+
text: string;
|
|
92
|
+
} | {
|
|
93
|
+
conversation: components["schemas"]["TurnConversationSnapshot"];
|
|
94
|
+
input: components["schemas"]["ConversationTurn"];
|
|
95
|
+
output: components["schemas"]["ConversationTurn"][];
|
|
96
|
+
tool_calls?: components["schemas"]["ConversationToolCallDetail"][];
|
|
97
|
+
turn_id: string;
|
|
98
|
+
} | {
|
|
99
|
+
event: "token";
|
|
100
|
+
text: string;
|
|
101
|
+
} | {
|
|
102
|
+
call_id: string;
|
|
103
|
+
event: "tool_call_started";
|
|
104
|
+
input: string;
|
|
105
|
+
tool_name: string;
|
|
106
|
+
} | {
|
|
107
|
+
call_id: string;
|
|
108
|
+
event: "tool_call_completed";
|
|
109
|
+
result: string;
|
|
110
|
+
succeeded: boolean;
|
|
111
|
+
tool_name: string;
|
|
112
|
+
} | {
|
|
113
|
+
event: "thinking";
|
|
114
|
+
tier: number;
|
|
115
|
+
tier_name: string;
|
|
116
|
+
}>>;
|
|
117
|
+
/** Send a text turn and receive typed Server-Sent Events. */
|
|
118
|
+
streamTurn(options: {
|
|
119
|
+
conversationId: PlatformConversationId | string;
|
|
120
|
+
body: components['schemas']['TurnRequest'];
|
|
121
|
+
query?: operations['create_turn_v1__workspace_id__conversations__conversation_id__turns_post']['parameters']['query'];
|
|
122
|
+
signal?: AbortSignal;
|
|
123
|
+
}): Promise<AsyncGenerator<import("..").ServerSentEvent<{
|
|
124
|
+
conversation_id: string;
|
|
125
|
+
event: "done";
|
|
126
|
+
status: string;
|
|
127
|
+
turn_count: number;
|
|
128
|
+
} | {
|
|
129
|
+
event: "error";
|
|
130
|
+
message: string;
|
|
131
|
+
} | {
|
|
132
|
+
event: "message";
|
|
133
|
+
role: string;
|
|
134
|
+
text: string;
|
|
135
|
+
} | {
|
|
136
|
+
event: "token";
|
|
137
|
+
text: string;
|
|
138
|
+
} | {
|
|
139
|
+
call_id: string;
|
|
140
|
+
event: "tool_call_started";
|
|
141
|
+
input: string;
|
|
142
|
+
tool_name: string;
|
|
143
|
+
} | {
|
|
144
|
+
call_id: string;
|
|
145
|
+
event: "tool_call_completed";
|
|
146
|
+
result: string;
|
|
147
|
+
succeeded: boolean;
|
|
148
|
+
tool_name: string;
|
|
149
|
+
} | {
|
|
150
|
+
event: "thinking";
|
|
151
|
+
tier: number;
|
|
152
|
+
tier_name: string;
|
|
153
|
+
}>, any, any>>;
|
|
154
|
+
}
|