@amigo-ai/platform-sdk 0.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/LICENSE +21 -0
- package/README.md +330 -0
- package/dist/core/auth.js +32 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/branded-types.js +22 -0
- package/dist/core/branded-types.js.map +1 -0
- package/dist/core/errors.js +168 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/openapi-client.js +66 -0
- package/dist/core/openapi-client.js.map +1 -0
- package/dist/core/retry.js +48 -0
- package/dist/core/retry.js.map +1 -0
- package/dist/core/utils.js +35 -0
- package/dist/core/utils.js.map +1 -0
- package/dist/index.cjs +1005 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +111 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +982 -0
- package/dist/index.mjs.map +7 -0
- package/dist/resources/agents.js +49 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/analytics.js +54 -0
- package/dist/resources/analytics.js.map +1 -0
- package/dist/resources/api-keys.js +45 -0
- package/dist/resources/api-keys.js.map +1 -0
- package/dist/resources/base.js +50 -0
- package/dist/resources/base.js.map +1 -0
- package/dist/resources/billing.js +15 -0
- package/dist/resources/billing.js.map +1 -0
- package/dist/resources/calls.js +28 -0
- package/dist/resources/calls.js.map +1 -0
- package/dist/resources/context-graphs.js +44 -0
- package/dist/resources/context-graphs.js.map +1 -0
- package/dist/resources/data-sources.js +29 -0
- package/dist/resources/data-sources.js.map +1 -0
- package/dist/resources/integrations.js +45 -0
- package/dist/resources/integrations.js.map +1 -0
- package/dist/resources/memory.js +31 -0
- package/dist/resources/memory.js.map +1 -0
- package/dist/resources/phone-numbers.js +38 -0
- package/dist/resources/phone-numbers.js.map +1 -0
- package/dist/resources/services.js +30 -0
- package/dist/resources/services.js.map +1 -0
- package/dist/resources/settings.js +47 -0
- package/dist/resources/settings.js.map +1 -0
- package/dist/resources/simulations.js +50 -0
- package/dist/resources/simulations.js.map +1 -0
- package/dist/resources/skills.js +44 -0
- package/dist/resources/skills.js.map +1 -0
- package/dist/resources/workspaces.js +57 -0
- package/dist/resources/workspaces.js.map +1 -0
- package/dist/resources/world.js +131 -0
- package/dist/resources/world.js.map +1 -0
- package/dist/types/api.js +12 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/core/auth.d.ts +20 -0
- package/dist/types/core/auth.d.ts.map +1 -0
- package/dist/types/core/branded-types.d.ts +50 -0
- package/dist/types/core/branded-types.d.ts.map +1 -0
- package/dist/types/core/errors.d.ts +76 -0
- package/dist/types/core/errors.d.ts.map +1 -0
- package/dist/types/core/openapi-client.d.ts +14 -0
- package/dist/types/core/openapi-client.d.ts.map +1 -0
- package/dist/types/core/retry.d.ts +21 -0
- package/dist/types/core/retry.d.ts.map +1 -0
- package/dist/types/core/utils.d.ts +39 -0
- package/dist/types/core/utils.d.ts.map +1 -0
- package/dist/types/index.d.ts +114 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/resources/agents.d.ts +32 -0
- package/dist/types/resources/agents.d.ts.map +1 -0
- package/dist/types/resources/analytics.d.ts +146 -0
- package/dist/types/resources/analytics.d.ts.map +1 -0
- package/dist/types/resources/api-keys.d.ts +28 -0
- package/dist/types/resources/api-keys.d.ts.map +1 -0
- package/dist/types/resources/base.d.ts +18 -0
- package/dist/types/resources/base.d.ts.map +1 -0
- package/dist/types/resources/billing.d.ts +19 -0
- package/dist/types/resources/billing.d.ts.map +1 -0
- package/dist/types/resources/calls.d.ts +50 -0
- package/dist/types/resources/calls.d.ts.map +1 -0
- package/dist/types/resources/context-graphs.d.ts +32 -0
- package/dist/types/resources/context-graphs.d.ts.map +1 -0
- package/dist/types/resources/data-sources.d.ts +24 -0
- package/dist/types/resources/data-sources.d.ts.map +1 -0
- package/dist/types/resources/integrations.d.ts +38 -0
- package/dist/types/resources/integrations.d.ts.map +1 -0
- package/dist/types/resources/memory.d.ts +99 -0
- package/dist/types/resources/memory.d.ts.map +1 -0
- package/dist/types/resources/phone-numbers.d.ts +26 -0
- package/dist/types/resources/phone-numbers.d.ts.map +1 -0
- package/dist/types/resources/services.d.ts +21 -0
- package/dist/types/resources/services.d.ts.map +1 -0
- package/dist/types/resources/settings.d.ts +102 -0
- package/dist/types/resources/settings.d.ts.map +1 -0
- package/dist/types/resources/simulations.d.ts +39 -0
- package/dist/types/resources/simulations.d.ts.map +1 -0
- package/dist/types/resources/skills.d.ts +31 -0
- package/dist/types/resources/skills.d.ts.map +1 -0
- package/dist/types/resources/workspaces.d.ts +28 -0
- package/dist/types/resources/workspaces.d.ts.map +1 -0
- package/dist/types/resources/world.d.ts +177 -0
- package/dist/types/resources/world.d.ts.map +1 -0
- package/dist/types/types/api.d.ts +739 -0
- package/dist/types/types/api.d.ts.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error hierarchy for the Amigo Platform SDK.
|
|
3
|
+
* All errors extend AmigoError which can be caught with a single catch.
|
|
4
|
+
*/
|
|
5
|
+
export interface ErrorContext {
|
|
6
|
+
statusCode?: number;
|
|
7
|
+
errorCode?: string;
|
|
8
|
+
requestId?: string;
|
|
9
|
+
detail?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Base class for all Amigo Platform SDK errors */
|
|
12
|
+
export declare class AmigoError extends Error {
|
|
13
|
+
readonly statusCode?: number;
|
|
14
|
+
readonly errorCode?: string;
|
|
15
|
+
readonly requestId?: string;
|
|
16
|
+
readonly detail?: string;
|
|
17
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
18
|
+
}
|
|
19
|
+
/** 400 Bad Request */
|
|
20
|
+
export declare class BadRequestError extends AmigoError {
|
|
21
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
22
|
+
}
|
|
23
|
+
/** 401 Unauthorized — invalid or missing API key */
|
|
24
|
+
export declare class AuthenticationError extends AmigoError {
|
|
25
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
26
|
+
}
|
|
27
|
+
/** 403 Forbidden — insufficient permissions */
|
|
28
|
+
export declare class PermissionError extends AmigoError {
|
|
29
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
30
|
+
}
|
|
31
|
+
/** 404 Not Found */
|
|
32
|
+
export declare class NotFoundError extends AmigoError {
|
|
33
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
34
|
+
}
|
|
35
|
+
/** 409 Conflict — duplicate slug or resource version conflict */
|
|
36
|
+
export declare class ConflictError extends AmigoError {
|
|
37
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
38
|
+
}
|
|
39
|
+
/** 422 Unprocessable Entity — validation failure */
|
|
40
|
+
export declare class ValidationError extends AmigoError {
|
|
41
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
42
|
+
}
|
|
43
|
+
/** 429 Too Many Requests */
|
|
44
|
+
export declare class RateLimitError extends AmigoError {
|
|
45
|
+
readonly retryAfter?: number;
|
|
46
|
+
constructor(message: string, ctx?: ErrorContext & {
|
|
47
|
+
retryAfter?: number;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** 5xx Server Error */
|
|
51
|
+
export declare class ServerError extends AmigoError {
|
|
52
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
53
|
+
}
|
|
54
|
+
/** 503 Service Unavailable */
|
|
55
|
+
export declare class ServiceUnavailableError extends ServerError {
|
|
56
|
+
constructor(message: string, ctx?: ErrorContext);
|
|
57
|
+
}
|
|
58
|
+
/** Network or fetch failure (no HTTP status available) */
|
|
59
|
+
export declare class NetworkError extends AmigoError {
|
|
60
|
+
constructor(message: string, cause?: unknown);
|
|
61
|
+
}
|
|
62
|
+
/** Failed to parse response body */
|
|
63
|
+
export declare class ParseError extends AmigoError {
|
|
64
|
+
readonly body?: string;
|
|
65
|
+
constructor(message: string, body?: string);
|
|
66
|
+
}
|
|
67
|
+
/** SDK misconfiguration */
|
|
68
|
+
export declare class ConfigurationError extends AmigoError {
|
|
69
|
+
constructor(message: string);
|
|
70
|
+
}
|
|
71
|
+
export declare function createApiError(response: Response): Promise<AmigoError>;
|
|
72
|
+
export declare function isAmigoError(err: unknown): err is AmigoError;
|
|
73
|
+
export declare function isNotFoundError(err: unknown): err is NotFoundError;
|
|
74
|
+
export declare function isRateLimitError(err: unknown): err is RateLimitError;
|
|
75
|
+
export declare function isAuthenticationError(err: unknown): err is AuthenticationError;
|
|
76
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,mDAAmD;AACnD,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEZ,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,YAAiB;CAUpD;AAED,sBAAsB;AACtB,qBAAa,eAAgB,SAAQ,UAAU;gBACjC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,YAAiB;CAGpD;AAED,oDAAoD;AACpD,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,YAAiB;CAGpD;AAED,+CAA+C;AAC/C,qBAAa,eAAgB,SAAQ,UAAU;gBACjC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,YAAiB;CAGpD;AAED,oBAAoB;AACpB,qBAAa,aAAc,SAAQ,U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,EAAE,OAAO,GAAG,GAAG,IAAI,aAAa,CAElE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc,CAEpE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,mBAAmB,CAE9E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a configured openapi-fetch client with auth, error handling, and retry middleware.
|
|
3
|
+
*/
|
|
4
|
+
import createClient from 'openapi-fetch';
|
|
5
|
+
import type { paths } from '../types/api.js';
|
|
6
|
+
import { type RetryOptions } from './retry.js';
|
|
7
|
+
export type AmigoFetch = ReturnType<typeof createClient<paths>>;
|
|
8
|
+
export interface ClientConfig {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
retry?: RetryOptions;
|
|
12
|
+
}
|
|
13
|
+
export declare function createAmigoClient(config: ClientConfig): AmigoFetch;
|
|
14
|
+
//# sourceMappingURL=openapi-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-client.d.ts","sourceRoot":"","sources":["../../../src/core/openapi-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,YAAiC,MAAM,eAAe,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAG5C,OAAO,EAAkD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9F,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;AAE/D,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CA6DlE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exponential backoff with full jitter and Retry-After header support.
|
|
3
|
+
*/
|
|
4
|
+
export interface RetryOptions {
|
|
5
|
+
/** Maximum number of attempts (including the first). Default: 3 */
|
|
6
|
+
maxAttempts?: number;
|
|
7
|
+
/** Base delay in milliseconds. Default: 250 */
|
|
8
|
+
baseDelayMs?: number;
|
|
9
|
+
/** Maximum delay cap in milliseconds. Default: 30_000 */
|
|
10
|
+
maxDelayMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface RetryContext {
|
|
13
|
+
method: string;
|
|
14
|
+
attempt: number;
|
|
15
|
+
response: Response;
|
|
16
|
+
options: Required<RetryOptions>;
|
|
17
|
+
}
|
|
18
|
+
export declare function shouldRetry(ctx: RetryContext): boolean;
|
|
19
|
+
export declare function computeDelay(attempt: number, response: Response, options: Required<RetryOptions>): number;
|
|
20
|
+
export declare function resolveRetryOptions(opts?: RetryOptions): Required<RetryOptions>;
|
|
21
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/core/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAMD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAA;CAChC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAYtD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,MAAM,CAUzG;AAYD,wBAAgB,mBAAmB,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,CAM/E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities: response extraction and pagination helpers.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Extracts the data payload from an openapi-fetch response,
|
|
6
|
+
* throwing ParseError if the response is empty or unexpected.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractData<T>(result: {
|
|
9
|
+
data?: T;
|
|
10
|
+
error?: unknown;
|
|
11
|
+
}): T;
|
|
12
|
+
/**
|
|
13
|
+
* Standard paginated list response shape.
|
|
14
|
+
*/
|
|
15
|
+
export interface PaginatedList<T> {
|
|
16
|
+
items: T[];
|
|
17
|
+
has_more: boolean;
|
|
18
|
+
continuation_token: number | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Standard query params for paginated list endpoints.
|
|
22
|
+
*/
|
|
23
|
+
export interface ListParams {
|
|
24
|
+
/** Max items per page. Default varies by endpoint. */
|
|
25
|
+
limit?: number;
|
|
26
|
+
/** Opaque token from previous response for next page. */
|
|
27
|
+
continuation_token?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Async iterator that auto-paginates through all pages.
|
|
31
|
+
* Yields one item at a time.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* for await (const agent of paginate((token) => client.agents.list({ continuation_token: token }))) {
|
|
35
|
+
* console.log(agent)
|
|
36
|
+
* }
|
|
37
|
+
*/
|
|
38
|
+
export declare function paginate<T>(fetcher: (continuationToken?: number) => Promise<PaginatedList<T>>): AsyncGenerator<T>;
|
|
39
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,CAAC,CAMvE;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,QAAQ,EAAE,OAAO,CAAA;IACjB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yDAAyD;IACzD,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAuB,QAAQ,CAAC,CAAC,EAC/B,OAAO,EAAE,CAAC,iBAAiB,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GACjE,cAAc,CAAC,CAAC,CAAC,CAUnB"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @amigo-ai/platform-sdk
|
|
3
|
+
*
|
|
4
|
+
* Official TypeScript SDK for the Amigo Platform API.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { AmigoClient } from '@amigo-ai/platform-sdk'
|
|
9
|
+
*
|
|
10
|
+
* const client = new AmigoClient({
|
|
11
|
+
* apiKey: 'your-api-key',
|
|
12
|
+
* workspaceId: 'your-workspace-id',
|
|
13
|
+
* })
|
|
14
|
+
*
|
|
15
|
+
* const agents = await client.agents.list()
|
|
16
|
+
* console.log(agents.items)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import type { RetryOptions } from './core/retry.js';
|
|
20
|
+
import { WorkspacesResource } from './resources/workspaces.js';
|
|
21
|
+
import { ApiKeysResource } from './resources/api-keys.js';
|
|
22
|
+
import { AgentsResource } from './resources/agents.js';
|
|
23
|
+
import { SkillsResource } from './resources/skills.js';
|
|
24
|
+
import { ServicesResource } from './resources/services.js';
|
|
25
|
+
import { ContextGraphsResource } from './resources/context-graphs.js';
|
|
26
|
+
import { DataSourcesResource } from './resources/data-sources.js';
|
|
27
|
+
import { WorldResource } from './resources/world.js';
|
|
28
|
+
import { CallsResource } from './resources/calls.js';
|
|
29
|
+
import { PhoneNumbersResource } from './resources/phone-numbers.js';
|
|
30
|
+
import { IntegrationsResource } from './resources/integrations.js';
|
|
31
|
+
import { AnalyticsResource } from './resources/analytics.js';
|
|
32
|
+
import { SimulationsResource } from './resources/simulations.js';
|
|
33
|
+
import { SettingsResource } from './resources/settings.js';
|
|
34
|
+
import { BillingResource } from './resources/billing.js';
|
|
35
|
+
import { MemoryResource } from './resources/memory.js';
|
|
36
|
+
export declare const DEFAULT_BASE_URL = "https://api.platform.amigo.ai";
|
|
37
|
+
export interface AmigoClientConfig {
|
|
38
|
+
/**
|
|
39
|
+
* Your Amigo Platform API key.
|
|
40
|
+
* Create one at: Platform > Workspace Settings > API Keys
|
|
41
|
+
*/
|
|
42
|
+
apiKey: string;
|
|
43
|
+
/**
|
|
44
|
+
* Your workspace ID. All resource operations are scoped to this workspace.
|
|
45
|
+
*/
|
|
46
|
+
workspaceId: string;
|
|
47
|
+
/**
|
|
48
|
+
* Override the base URL. Defaults to https://api.platform.amigo.ai
|
|
49
|
+
* Useful for pointing at a staging environment.
|
|
50
|
+
*/
|
|
51
|
+
baseUrl?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Retry configuration for failed requests.
|
|
54
|
+
* Applies exponential backoff with full jitter.
|
|
55
|
+
*/
|
|
56
|
+
retry?: RetryOptions;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The main entry point for the Amigo Platform SDK.
|
|
60
|
+
*
|
|
61
|
+
* Instantiate once and reuse across your application.
|
|
62
|
+
*/
|
|
63
|
+
export declare class AmigoClient {
|
|
64
|
+
/** Workspace management */
|
|
65
|
+
readonly workspaces: WorkspacesResource;
|
|
66
|
+
/** API key management */
|
|
67
|
+
readonly apiKeys: ApiKeysResource;
|
|
68
|
+
/** Agent management — AI agents that handle calls */
|
|
69
|
+
readonly agents: AgentsResource;
|
|
70
|
+
/** Skill management — reusable AI capabilities */
|
|
71
|
+
readonly skills: SkillsResource;
|
|
72
|
+
/** Service management — external service configurations */
|
|
73
|
+
readonly services: ServicesResource;
|
|
74
|
+
/** Context graph management — conversation flow structures */
|
|
75
|
+
readonly contextGraphs: ContextGraphsResource;
|
|
76
|
+
/** Data source management — external data connections */
|
|
77
|
+
readonly dataSources: DataSourcesResource;
|
|
78
|
+
/** World model — entities, events, and timelines */
|
|
79
|
+
readonly world: WorldResource;
|
|
80
|
+
/** Call records and intelligence */
|
|
81
|
+
readonly calls: CallsResource;
|
|
82
|
+
/** Phone number provisioning and management */
|
|
83
|
+
readonly phoneNumbers: PhoneNumbersResource;
|
|
84
|
+
/** Integration management — EHR, CRM, and other external systems */
|
|
85
|
+
readonly integrations: IntegrationsResource;
|
|
86
|
+
/** Analytics — aggregate metrics about calls and conversions */
|
|
87
|
+
readonly analytics: AnalyticsResource;
|
|
88
|
+
/** Simulation runs and interactive testing sessions */
|
|
89
|
+
readonly simulations: SimulationsResource;
|
|
90
|
+
/** Workspace-level settings (voice, branding, security, outreach, etc.) */
|
|
91
|
+
readonly settings: SettingsResource;
|
|
92
|
+
/** Billing — usage summaries and invoices */
|
|
93
|
+
readonly billing: BillingResource;
|
|
94
|
+
/** Agent Memory — structured long-term memory for entities */
|
|
95
|
+
readonly memory: MemoryResource;
|
|
96
|
+
constructor(config: AmigoClientConfig);
|
|
97
|
+
}
|
|
98
|
+
export type { AmigoClientConfig as AmigoConfig };
|
|
99
|
+
export { AmigoError, BadRequestError, AuthenticationError, PermissionError, NotFoundError, ConflictError, ValidationError, RateLimitError, ServerError, ServiceUnavailableError, NetworkError, ParseError, ConfigurationError, isAmigoError, isNotFoundError, isRateLimitError, isAuthenticationError, } from './core/errors.js';
|
|
100
|
+
export type { WorkspaceId, ApiKeyId, AgentId, SkillId, ServiceId, ContextGraphId, CallId, PhoneNumberId, IntegrationId, EntityId, EventId, SimulationRunId, SimulationSessionId, DataSourceId, } from './core/branded-types.js';
|
|
101
|
+
export { workspaceId, apiKeyId, agentId, skillId, serviceId, contextGraphId, callId, phoneNumberId, integrationId, entityId, eventId, simulationRunId, simulationSessionId, dataSourceId, } from './core/branded-types.js';
|
|
102
|
+
export { paginate } from './core/utils.js';
|
|
103
|
+
export type { PaginatedList, ListParams } from './core/utils.js';
|
|
104
|
+
export type { RetryOptions } from './core/retry.js';
|
|
105
|
+
export type { VoiceSettings, BrandingSettings, BrandingConfig, OutreachSettings, OutreachRule, MemorySettings, MemoryDimensionConfig, SecuritySettings, RetentionSettings, WorkflowSettings, WorkflowConfig, } from './resources/settings.js';
|
|
106
|
+
export type { UpdateDataSourceRequest } from './resources/data-sources.js';
|
|
107
|
+
export type { ContextGraphVersion, } from './resources/context-graphs.js';
|
|
108
|
+
export type { EntityRelationship, EntityGraph, EntityProvenance, EntityLineage, SyncEvent, SyncStatusBySink, SourceBreakdown, EntityStats, SearchEntitiesParams, } from './resources/world.js';
|
|
109
|
+
export type { SimulationIntelligence, } from './resources/simulations.js';
|
|
110
|
+
export type { CallDetail, CallIntelligence, CallTranscriptSegment, CallBenchmarks, } from './resources/calls.js';
|
|
111
|
+
export type { MetricWithDelta, AnalyticsDashboard, CallAnalytics, AgentAnalytics, AgentAnalyticsResponse, CallQualityMetrics, EmotionTrends, LatencyMetrics, ToolPerformance, DataQualityMetrics, AdvancedCallStats, CallComparison, AnalyticsQueryParams, } from './resources/analytics.js';
|
|
112
|
+
export type { DimensionScore, EntityDimensionsResponse, MemoryFact, EntityFactsResponse, DimensionAnalytics, MemoryAnalyticsResponse, } from './resources/memory.js';
|
|
113
|
+
export type { Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ApiKey, ApiKeyRole, CreateApiKeyRequest, CreateApiKeyResponse, RotateApiKeyResponse, AuthMeResponse, Agent, AgentVersion, AgentIdentity, AgentVoiceConfig, CreateAgentRequest, UpdateAgentRequest, CreateAgentVersionRequest, Skill, ExecutionTier, CreateSkillRequest, UpdateSkillRequest, SkillTestRequest, SkillTestResponse, Service, CreateServiceRequest, UpdateServiceRequest, ContextGraph, CreateContextGraphRequest, UpdateContextGraphRequest, DataSource, CreateDataSourceRequest, Entity, EntityType, WorldEvent, TimelineEntry, CreateEntityRequest, UpdateEntityRequest, EmitEventRequest, MergeEntitiesRequest, Call, CallDirection, ListCallsParams, PhoneNumber, PhoneNumberForwarding, ProvisionPhoneNumberRequest, UpdatePhoneNumberRequest, Integration, IntegrationEndpoint, CreateIntegrationRequest, UpdateIntegrationRequest, AgentPerformance, UsageMeter, ServiceVersionSet, ServiceTag, ServiceVoiceConfig, SimulationSession, SimulationSnapshot, SimulationStepResponse, SimulationStepObservation, CreateSimulationSessionRequest, UsageSummary, Invoice, PaginatedResponse, } from './types/api.js';
|
|
114
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC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B,cAAc,EACd,KAAK,EACL,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,EACL,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,UAAU,EACV,uBAAuB,EACvB,MAAM,EACN,UAAU,EACV,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,IAAI,EACJ,aAAa,EACb,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,EACxB,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,EAC9B,YAAY,EACZ,OAAO,EACP,iBAAiB,GAClB,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Agent, AgentVersion, CreateAgentRequest, UpdateAgentRequest, CreateAgentVersionRequest, PaginatedResponse } from '../types/api.js';
|
|
2
|
+
import type { AgentId } from '../core/branded-types.js';
|
|
3
|
+
import { WorkspaceScopedResource } from './base.js';
|
|
4
|
+
import type { ListParams } from '../core/utils.js';
|
|
5
|
+
export interface ListAgentsParams extends ListParams {
|
|
6
|
+
search?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ListAgentVersionsParams extends ListParams {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Manage agents — the AI personas that handle calls and interactions.
|
|
12
|
+
* Each agent can be assigned skills, a persona, and a model.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AgentsResource extends WorkspaceScopedResource {
|
|
15
|
+
/** Create a new agent */
|
|
16
|
+
create(body: CreateAgentRequest): Promise<Agent>;
|
|
17
|
+
/** List agents in the workspace */
|
|
18
|
+
list(params?: ListAgentsParams): Promise<PaginatedResponse<Agent>>;
|
|
19
|
+
/** Get a single agent */
|
|
20
|
+
get(agentId: AgentId | string): Promise<Agent>;
|
|
21
|
+
/** Update an agent's configuration */
|
|
22
|
+
update(agentId: AgentId | string, body: UpdateAgentRequest): Promise<Agent>;
|
|
23
|
+
/** Delete an agent */
|
|
24
|
+
delete(agentId: AgentId | string): Promise<void>;
|
|
25
|
+
/** List all versions of an agent */
|
|
26
|
+
listVersions(agentId: AgentId | string, params?: ListAgentVersionsParams): Promise<PaginatedResponse<AgentVersion>>;
|
|
27
|
+
/** Get a specific version of an agent — pass `"latest"` to get the most recent */
|
|
28
|
+
getVersion(agentId: AgentId | string, version: number | 'latest'): Promise<AgentVersion>;
|
|
29
|
+
/** Create a new version of an agent */
|
|
30
|
+
createVersion(agentId: AgentId | string, body: CreateAgentVersionRequest): Promise<AgentVersion>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/resources/agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,uBAAuB,EAAc,MAAM,WAAW,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,uBAAwB,SAAQ,UAAU;CAAG;AAE9D;;;GAGG;AACH,qBAAa,cAAe,SAAQ,uBAAuB;IACzD,yBAAyB;IACnB,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC;IAOtD,mCAAmC;IAC7B,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAIxE,yBAAyB;IACnB,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAIpD,sCAAsC;IAChC,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC;IAOjF,sBAAsB;IAChB,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,oCAAoC;IAC9B,YAAY,CAChB,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,MAAM,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAM3C,kFAAkF;IAC5E,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAI9F,uCAAuC;IACjC,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,YAAY,CAAC;CAMvG"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { WorkspaceScopedResource } from './base.js';
|
|
2
|
+
/** A metric value paired with its period-over-period change */
|
|
3
|
+
export interface MetricWithDelta {
|
|
4
|
+
value: number | null;
|
|
5
|
+
delta_pct: number | null;
|
|
6
|
+
}
|
|
7
|
+
export interface AnalyticsQueryParams {
|
|
8
|
+
/** Shorthand period, e.g. "7d", "30d" */
|
|
9
|
+
period?: string;
|
|
10
|
+
start_date?: string;
|
|
11
|
+
end_date?: string;
|
|
12
|
+
agent_id?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AnalyticsDashboard {
|
|
15
|
+
call_volume: MetricWithDelta;
|
|
16
|
+
avg_quality: MetricWithDelta;
|
|
17
|
+
avg_ttfb_ms: MetricWithDelta;
|
|
18
|
+
escalation_rate: MetricWithDelta;
|
|
19
|
+
tool_success_rate: MetricWithDelta;
|
|
20
|
+
avg_duration_s: MetricWithDelta;
|
|
21
|
+
period_days: number;
|
|
22
|
+
}
|
|
23
|
+
export interface CallAnalytics {
|
|
24
|
+
workspace_id: string;
|
|
25
|
+
period_start: string;
|
|
26
|
+
period_end: string;
|
|
27
|
+
total_calls: number;
|
|
28
|
+
total_duration_seconds: number;
|
|
29
|
+
avg_duration_seconds: number;
|
|
30
|
+
calls_by_date: Array<{
|
|
31
|
+
date: string;
|
|
32
|
+
count: number;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
export interface AgentAnalytics {
|
|
36
|
+
agent_id: string;
|
|
37
|
+
agent_name: string;
|
|
38
|
+
total_calls: number;
|
|
39
|
+
completed_calls: number;
|
|
40
|
+
avg_duration_seconds: number;
|
|
41
|
+
completion_rate: number;
|
|
42
|
+
}
|
|
43
|
+
export interface AgentAnalyticsResponse {
|
|
44
|
+
agents: AgentAnalytics[];
|
|
45
|
+
period: string;
|
|
46
|
+
}
|
|
47
|
+
export interface CallQualityMetrics {
|
|
48
|
+
avg_sentiment: number | null;
|
|
49
|
+
positive_pct: number;
|
|
50
|
+
negative_pct: number;
|
|
51
|
+
neutral_pct: number;
|
|
52
|
+
avg_transcription_confidence: number | null;
|
|
53
|
+
flagged_calls: number;
|
|
54
|
+
}
|
|
55
|
+
export interface EmotionTrends {
|
|
56
|
+
data: Array<{
|
|
57
|
+
date: string;
|
|
58
|
+
emotions: Record<string, number>;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
export interface LatencyMetrics {
|
|
62
|
+
avg_ttfb_ms: number;
|
|
63
|
+
p50_ttfb_ms: number;
|
|
64
|
+
p95_ttfb_ms: number;
|
|
65
|
+
avg_response_ms: number;
|
|
66
|
+
p95_response_ms: number;
|
|
67
|
+
}
|
|
68
|
+
export interface ToolPerformance {
|
|
69
|
+
tool_name: string;
|
|
70
|
+
call_count: number;
|
|
71
|
+
success_rate: number;
|
|
72
|
+
avg_latency_ms: number;
|
|
73
|
+
}
|
|
74
|
+
export interface DataQualityMetrics {
|
|
75
|
+
completeness_score: number;
|
|
76
|
+
duplicate_rate: number;
|
|
77
|
+
missing_canonical_id_pct: number;
|
|
78
|
+
stale_entities: number;
|
|
79
|
+
}
|
|
80
|
+
export interface AdvancedCallStats {
|
|
81
|
+
abandonment_rate: number;
|
|
82
|
+
transfer_rate: number;
|
|
83
|
+
avg_silence_pct: number;
|
|
84
|
+
avg_interruptions: number;
|
|
85
|
+
by_hour_of_day: Array<{
|
|
86
|
+
hour: number;
|
|
87
|
+
count: number;
|
|
88
|
+
}>;
|
|
89
|
+
by_day_of_week: Array<{
|
|
90
|
+
day: string;
|
|
91
|
+
count: number;
|
|
92
|
+
}>;
|
|
93
|
+
}
|
|
94
|
+
export interface CallComparison {
|
|
95
|
+
period_a: {
|
|
96
|
+
start: string;
|
|
97
|
+
end: string;
|
|
98
|
+
calls: number;
|
|
99
|
+
conversion_rate: number;
|
|
100
|
+
};
|
|
101
|
+
period_b: {
|
|
102
|
+
start: string;
|
|
103
|
+
end: string;
|
|
104
|
+
calls: number;
|
|
105
|
+
conversion_rate: number;
|
|
106
|
+
};
|
|
107
|
+
change_pct: Record<string, number>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Analytics — aggregate metrics about calls, agents, quality, and usage.
|
|
111
|
+
*/
|
|
112
|
+
export declare class AnalyticsResource extends WorkspaceScopedResource {
|
|
113
|
+
/** High-level dashboard summary — pass `days` (default: 7) for the lookback window */
|
|
114
|
+
getDashboard(params?: {
|
|
115
|
+
days?: number;
|
|
116
|
+
}): Promise<AnalyticsDashboard>;
|
|
117
|
+
/** Call volume and duration metrics */
|
|
118
|
+
getCalls(params?: AnalyticsQueryParams): Promise<CallAnalytics>;
|
|
119
|
+
/** Per-agent performance breakdown */
|
|
120
|
+
getAgents(params?: {
|
|
121
|
+
period?: string;
|
|
122
|
+
}): Promise<AgentAnalyticsResponse>;
|
|
123
|
+
/** Call quality — sentiment, transcription confidence, flagged calls */
|
|
124
|
+
getCallQuality(params?: AnalyticsQueryParams): Promise<CallQualityMetrics>;
|
|
125
|
+
/** Emotion trend data over time */
|
|
126
|
+
getEmotionTrends(params?: AnalyticsQueryParams): Promise<EmotionTrends>;
|
|
127
|
+
/** Voice pipeline latency metrics (TTFB, response time) */
|
|
128
|
+
getLatency(params?: AnalyticsQueryParams): Promise<LatencyMetrics>;
|
|
129
|
+
/** Tool call performance — success rates and latency per tool */
|
|
130
|
+
getToolPerformance(params?: AnalyticsQueryParams): Promise<ToolPerformance[]>;
|
|
131
|
+
/** Data quality metrics for the workspace world model */
|
|
132
|
+
getDataQuality(params?: AnalyticsQueryParams): Promise<DataQualityMetrics>;
|
|
133
|
+
/** Usage summary — API requests, call minutes, storage */
|
|
134
|
+
getUsage(params?: AnalyticsQueryParams): Promise<Record<string, unknown>>;
|
|
135
|
+
/** Advanced call statistics (abandonment, transfers, silence, hour-of-day) */
|
|
136
|
+
getAdvancedCallStats(params?: AnalyticsQueryParams): Promise<AdvancedCallStats>;
|
|
137
|
+
/** Compare two time periods side by side */
|
|
138
|
+
compareCallPeriods(params: {
|
|
139
|
+
current_from: string;
|
|
140
|
+
current_to: string;
|
|
141
|
+
previous_from: string;
|
|
142
|
+
previous_to: string;
|
|
143
|
+
service_id?: string;
|
|
144
|
+
}): Promise<CallComparison>;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../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AoB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAInF,yDAAyD;IACnD,cAAc,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIhF,0DAA0D;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI/E,8EAA8E;IACxE,oBAAoB,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIrF,4CAA4C;IACtC,kBAAkB,CAAC,MAAM,EAAE;QAC/B,YAAY,EAAE,MAAM,CAAA;QACpB,UAAU,EAAE,MAAM,CAAA;QAClB,aAAa,EAAE,MAAM,CAAA;QACrB,WAAW,EAAE,MAAM,CAAA;QACnB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,GAAG,OAAO,CAAC,cAAc,CAAC;CAG5B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ApiKey, CreateApiKeyRequest, CreateApiKeyResponse, RotateApiKeyResponse, AuthMeResponse, PaginatedResponse } from '../types/api.js';
|
|
2
|
+
import type { ApiKeyId } from '../core/branded-types.js';
|
|
3
|
+
import { WorkspaceScopedResource } from './base.js';
|
|
4
|
+
import type { ListParams } from '../core/utils.js';
|
|
5
|
+
/**
|
|
6
|
+
* Manage API keys for a workspace.
|
|
7
|
+
*
|
|
8
|
+
* API keys are used to authenticate SDK/API requests. Each key has a role
|
|
9
|
+
* and a set of permissions. Keys expire after 1-90 days.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ApiKeysResource extends WorkspaceScopedResource {
|
|
12
|
+
/**
|
|
13
|
+
* Get info about the currently authenticated API key.
|
|
14
|
+
* Does not require a workspace ID in the path.
|
|
15
|
+
*/
|
|
16
|
+
me(): Promise<AuthMeResponse>;
|
|
17
|
+
/** Create a new API key */
|
|
18
|
+
create(body: CreateApiKeyRequest): Promise<CreateApiKeyResponse>;
|
|
19
|
+
/** List API keys in the workspace */
|
|
20
|
+
list(params?: ListParams): Promise<PaginatedResponse<ApiKey>>;
|
|
21
|
+
/** Get a specific API key */
|
|
22
|
+
get(keyId: ApiKeyId | string): Promise<ApiKey>;
|
|
23
|
+
/** Revoke an API key */
|
|
24
|
+
revoke(keyId: ApiKeyId | string): Promise<void>;
|
|
25
|
+
/** Rotate an API key — invalidates the old key and issues a new one */
|
|
26
|
+
rotate(keyId: ApiKeyId | string): Promise<RotateApiKeyResponse>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=api-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAc,MAAM,WAAW,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,uBAAuB;IAC1D;;;OAGG;IACG,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC;IAOnC,2BAA2B;IACrB,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAOtE,qCAAqC;IAC/B,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAInE,6BAA6B;IACvB,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIpD,wBAAwB;IAClB,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,uEAAuE;IACjE,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAGtE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all workspace-scoped resources.
|
|
3
|
+
* Handles URL construction, auth headers, and error conversion.
|
|
4
|
+
*/
|
|
5
|
+
export interface ResourceConfig {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class WorkspaceScopedResource {
|
|
11
|
+
protected readonly config: ResourceConfig;
|
|
12
|
+
constructor(config: ResourceConfig);
|
|
13
|
+
protected get headers(): Record<string, string>;
|
|
14
|
+
protected workspaceUrl(path: string): string;
|
|
15
|
+
protected fetch<T>(path: string, init?: RequestInit): Promise<T>;
|
|
16
|
+
}
|
|
17
|
+
export declare function buildQuery(params?: any): string;
|
|
18
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/resources/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,8BAAsB,uBAAuB;IAC/B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc;gBAAtB,MAAM,EAAE,cAAc;IAErD,SAAS,KAAK,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAK9C;IAED,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;cAI5B,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,CAAC,CAAC;CAe3E;AAGD,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,MAAM,CAW/C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UsageSummary, Invoice, PaginatedResponse } from '../types/api.js';
|
|
2
|
+
import { WorkspaceScopedResource } from './base.js';
|
|
3
|
+
export interface UsageQueryParams {
|
|
4
|
+
start_date?: string;
|
|
5
|
+
end_date?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Billing — usage summaries and invoices.
|
|
9
|
+
*/
|
|
10
|
+
export declare class BillingResource extends WorkspaceScopedResource {
|
|
11
|
+
/** Get usage summary for a time period */
|
|
12
|
+
getUsage(params?: UsageQueryParams): Promise<UsageSummary>;
|
|
13
|
+
/** List invoices */
|
|
14
|
+
listInvoices(params?: {
|
|
15
|
+
limit?: number;
|
|
16
|
+
continuation_token?: number;
|
|
17
|
+
}): Promise<PaginatedResponse<Invoice>>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAC/E,OAAO,EAAE,uBAAuB,EAAc,MAAM,WAAW,CAAA;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,uBAAuB;IAC1D,0CAA0C;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIhE,oBAAoB;IACd,YAAY,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;CAGlH"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Call, ListCallsParams, PaginatedResponse } from '../types/api.js';
|
|
2
|
+
import { WorkspaceScopedResource } from './base.js';
|
|
3
|
+
export interface CallIntelligence {
|
|
4
|
+
summary: string | null;
|
|
5
|
+
sentiment: string | null;
|
|
6
|
+
key_moments: Array<{
|
|
7
|
+
type: string;
|
|
8
|
+
description: string;
|
|
9
|
+
timestamp_s: number;
|
|
10
|
+
}>;
|
|
11
|
+
action_items: string[];
|
|
12
|
+
outcomes: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface CallTranscriptSegment {
|
|
15
|
+
speaker: 'agent' | 'customer';
|
|
16
|
+
text: string;
|
|
17
|
+
start_seconds: number;
|
|
18
|
+
end_seconds: number;
|
|
19
|
+
}
|
|
20
|
+
export interface CallDetail extends Call {
|
|
21
|
+
intelligence: CallIntelligence | null;
|
|
22
|
+
transcript: CallTranscriptSegment[];
|
|
23
|
+
}
|
|
24
|
+
export interface CallBenchmarks {
|
|
25
|
+
workspace_id: string;
|
|
26
|
+
period_start: string;
|
|
27
|
+
period_end: string;
|
|
28
|
+
avg_duration_seconds: number;
|
|
29
|
+
answer_rate: number | null;
|
|
30
|
+
completion_rate: number | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Access call records and intelligence.
|
|
34
|
+
* Calls are read-only in the SDK — they are created by the voice pipeline.
|
|
35
|
+
*/
|
|
36
|
+
export declare class CallsResource extends WorkspaceScopedResource {
|
|
37
|
+
/** List calls with optional filtering */
|
|
38
|
+
list(params?: ListCallsParams): Promise<PaginatedResponse<Call>>;
|
|
39
|
+
/** Get full call detail including transcript and intelligence */
|
|
40
|
+
get(callSid: string): Promise<CallDetail>;
|
|
41
|
+
/** Get AI intelligence for a call */
|
|
42
|
+
getIntelligence(callSid: string): Promise<CallIntelligence>;
|
|
43
|
+
/** Get active intelligence across all in-progress calls */
|
|
44
|
+
getActiveIntelligence(): Promise<Record<string, unknown>[]>;
|
|
45
|
+
/** Get performance benchmarks for a time period */
|
|
46
|
+
getBenchmarks(params?: {
|
|
47
|
+
days?: number;
|
|
48
|
+
}): Promise<CallBenchmarks>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../../src/resources/calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,eAAe,EACf,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,uBAAuB,EAAc,MAAM,WAAW,CAAA;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9E,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,GAAG,UAAU,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,UAAW,SAAQ,IAAI;IACtC,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACrC,UAAU,EAAE,qBAAqB,EAAE,CAAA;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MA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