@amigo-ai/sdk 0.1.1
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 +102 -0
- package/dist/index.js +739 -0
- package/dist/index.js.map +7 -0
- package/dist/types/core/auth.d.ts +8 -0
- package/dist/types/core/errors.d.ts +67 -0
- package/dist/types/core/openapi-client.d.ts +5 -0
- package/dist/types/core/retry.d.ts +15 -0
- package/dist/types/core/utils.d.ts +13 -0
- package/dist/types/generated/api-types.d.ts +16433 -0
- package/dist/types/index.d.ts +29 -0
- package/dist/types/resources/conversation.d.ts +94 -0
- package/dist/types/resources/organization.d.ts +21 -0
- package/dist/types/resources/services.d.ts +18 -0
- package/dist/types/resources/user.d.ts +18 -0
- package/package.json +64 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OrganizationResource } from './resources/organization';
|
|
2
|
+
import { ConversationResource } from './resources/conversation';
|
|
3
|
+
import { ServiceResource } from './resources/services';
|
|
4
|
+
import { UserResource } from './resources/user';
|
|
5
|
+
import type { RetryOptions } from './core/retry';
|
|
6
|
+
export interface AmigoSdkConfig {
|
|
7
|
+
/** API key from Amigo dashboard */
|
|
8
|
+
apiKey: string;
|
|
9
|
+
/** API-key ID from Amigo dashboard */
|
|
10
|
+
apiKeyId: string;
|
|
11
|
+
/** User ID on whose behalf the request is made */
|
|
12
|
+
userId: string;
|
|
13
|
+
/** The Organization ID */
|
|
14
|
+
orgId: string;
|
|
15
|
+
/** Base URL of the Amigo API */
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
/** Retry configuration for HTTP requests */
|
|
18
|
+
retry?: RetryOptions;
|
|
19
|
+
}
|
|
20
|
+
export declare class AmigoClient {
|
|
21
|
+
readonly organizations: OrganizationResource;
|
|
22
|
+
readonly conversations: ConversationResource;
|
|
23
|
+
readonly services: ServiceResource;
|
|
24
|
+
readonly users: UserResource;
|
|
25
|
+
readonly config: AmigoSdkConfig;
|
|
26
|
+
constructor(config: AmigoSdkConfig);
|
|
27
|
+
}
|
|
28
|
+
export * as errors from './core/errors';
|
|
29
|
+
export type { components, operations, paths } from './generated/api-types';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { AmigoFetch } from '../core/openapi-client';
|
|
2
|
+
import type { components, operations } from '../generated/api-types';
|
|
3
|
+
type VoiceData = Blob | Uint8Array | ReadableStream<Uint8Array>;
|
|
4
|
+
export type InteractionInput = string | VoiceData;
|
|
5
|
+
export declare class ConversationResource {
|
|
6
|
+
private c;
|
|
7
|
+
private orgId;
|
|
8
|
+
constructor(c: AmigoFetch, orgId: string);
|
|
9
|
+
createConversation(body: components['schemas']['conversation__create_conversation__Request'], queryParams: operations['create-conversation']['parameters']['query'], headers?: operations['create-conversation']['parameters']['header'], options?: {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}): Promise<AsyncGenerator<{
|
|
12
|
+
type: "conversation-created";
|
|
13
|
+
conversation_id: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "interaction-complete";
|
|
16
|
+
message_id: string;
|
|
17
|
+
interaction_id: string;
|
|
18
|
+
full_message: string;
|
|
19
|
+
conversation_completed: boolean;
|
|
20
|
+
} | {
|
|
21
|
+
type: "new-message";
|
|
22
|
+
message: string;
|
|
23
|
+
message_metadata: string[];
|
|
24
|
+
transcript_alignment: [number, string][] | null;
|
|
25
|
+
stop: boolean;
|
|
26
|
+
sequence_number: number;
|
|
27
|
+
message_id: string;
|
|
28
|
+
} | {
|
|
29
|
+
type: "current-agent-action";
|
|
30
|
+
action: components["schemas"]["src__app__amigo__service__conversation__Action"];
|
|
31
|
+
} | {
|
|
32
|
+
type: "error";
|
|
33
|
+
http_error_code: number;
|
|
34
|
+
error_description: string;
|
|
35
|
+
}, any, any>>;
|
|
36
|
+
interactWithConversation(conversationId: string, input: InteractionInput, queryParams: operations['interact-with-conversation']['parameters']['query'], headers?: operations['interact-with-conversation']['parameters']['header'], options?: {
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}): Promise<AsyncGenerator<{
|
|
39
|
+
type: "interaction-complete";
|
|
40
|
+
message_id: string;
|
|
41
|
+
interaction_id: string;
|
|
42
|
+
full_message: string;
|
|
43
|
+
conversation_completed: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
type?: "end-session";
|
|
46
|
+
} | {
|
|
47
|
+
type: "new-message";
|
|
48
|
+
message: string;
|
|
49
|
+
message_metadata: string[];
|
|
50
|
+
transcript_alignment: [number, string][] | null;
|
|
51
|
+
stop: boolean;
|
|
52
|
+
sequence_number: number;
|
|
53
|
+
message_id: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: "current-agent-action";
|
|
56
|
+
action: components["schemas"]["src__app__amigo__service__conversation__Action"];
|
|
57
|
+
} | {
|
|
58
|
+
type: "error";
|
|
59
|
+
http_error_code: number;
|
|
60
|
+
error_description: string;
|
|
61
|
+
} | {
|
|
62
|
+
type?: "user-message-available";
|
|
63
|
+
message_id: string;
|
|
64
|
+
user_message: string;
|
|
65
|
+
}, any, any>>;
|
|
66
|
+
getConversations(queryParams?: operations['get-conversations']['parameters']['query'], headers?: operations['get-conversations']['parameters']['header']): Promise<{
|
|
67
|
+
conversations: components["schemas"]["Conversation"][];
|
|
68
|
+
has_more: boolean;
|
|
69
|
+
continuation_token: number | null;
|
|
70
|
+
}>;
|
|
71
|
+
getConversationMessages(conversationId: string, queryParams?: operations['get-conversation-messages']['parameters']['query'], headers?: operations['get-conversation-messages']['parameters']['header']): Promise<{
|
|
72
|
+
messages: components["schemas"]["MessageInstance"][];
|
|
73
|
+
has_more: boolean;
|
|
74
|
+
continuation_token: number | null;
|
|
75
|
+
}>;
|
|
76
|
+
finishConversation(conversationId: string, headers?: operations['finish-conversation']['parameters']['header']): Promise<void>;
|
|
77
|
+
recommendResponsesForInteraction(conversationId: string, interactionId: string, headers?: operations['recommend-responses-for-interaction']['parameters']['header']): Promise<{
|
|
78
|
+
recommended_responses: string[];
|
|
79
|
+
}>;
|
|
80
|
+
getInteractionInsights(conversationId: string, interactionId: string, headers?: operations['get-interaction-insights']['parameters']['header']): Promise<{
|
|
81
|
+
current_state_name: string;
|
|
82
|
+
current_state_action: string;
|
|
83
|
+
current_state_objective: string;
|
|
84
|
+
state_transition_logs: components["schemas"]["StateTransitionLog"][];
|
|
85
|
+
working_memory: components["schemas"]["WorkingMemory"][];
|
|
86
|
+
reflections: string[];
|
|
87
|
+
triggered_dynamic_behavior_set_version_info: [string, number] | null;
|
|
88
|
+
}>;
|
|
89
|
+
getMessageSource(conversationId: string, messageId: string, headers?: operations['retrieve-message-source']['parameters']['header']): Promise<{}>;
|
|
90
|
+
generateConversationStarters(body: components['schemas']['conversation__generate_conversation_starter__Request'], headers?: operations['generate-conversation-starter']['parameters']['header']): Promise<{
|
|
91
|
+
prompts: components["schemas"]["Prompt"][];
|
|
92
|
+
}>;
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AmigoFetch } from '../core/openapi-client';
|
|
2
|
+
import type { operations } from '../generated/api-types';
|
|
3
|
+
export declare class OrganizationResource {
|
|
4
|
+
private c;
|
|
5
|
+
private orgId;
|
|
6
|
+
constructor(c: AmigoFetch, orgId: string);
|
|
7
|
+
/**
|
|
8
|
+
* Get organization details
|
|
9
|
+
* @param headers - The headers
|
|
10
|
+
* @returns The organization details
|
|
11
|
+
*/
|
|
12
|
+
getOrganization(headers?: operations['get-organization']['parameters']['header']): Promise<{
|
|
13
|
+
org_id: string;
|
|
14
|
+
org_name: string;
|
|
15
|
+
title: string;
|
|
16
|
+
main_description: string;
|
|
17
|
+
sub_description: string;
|
|
18
|
+
onboarding_instructions: string[];
|
|
19
|
+
default_user_preferences: import("..").components["schemas"]["Preferences-Output"] | null;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AmigoFetch } from '../core/openapi-client';
|
|
2
|
+
import type { operations } from '../generated/api-types';
|
|
3
|
+
export declare class ServiceResource {
|
|
4
|
+
private c;
|
|
5
|
+
private orgId;
|
|
6
|
+
constructor(c: AmigoFetch, orgId: string);
|
|
7
|
+
/**
|
|
8
|
+
* Get services
|
|
9
|
+
* @param headers - The headers
|
|
10
|
+
* @returns The services
|
|
11
|
+
*/
|
|
12
|
+
getServices(queryParams?: operations['get-services']['parameters']['query'], headers?: operations['get-services']['parameters']['header']): Promise<{
|
|
13
|
+
services: import("..").components["schemas"]["ServiceInstance"][];
|
|
14
|
+
has_more: boolean;
|
|
15
|
+
continuation_token: number | null;
|
|
16
|
+
filter_values: import("..").components["schemas"]["service__get_services__Response__FilterValues"] | null;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AmigoFetch } from '../core/openapi-client';
|
|
2
|
+
import type { components, operations } from '../generated/api-types';
|
|
3
|
+
export declare class UserResource {
|
|
4
|
+
private c;
|
|
5
|
+
private orgId;
|
|
6
|
+
constructor(c: AmigoFetch, orgId: string);
|
|
7
|
+
getUsers(queryParams?: operations['get-users']['parameters']['query'], headers?: operations['get-users']['parameters']['header']): Promise<{
|
|
8
|
+
users: components["schemas"]["UserInstance"][];
|
|
9
|
+
has_more: boolean;
|
|
10
|
+
continuation_token: number | null;
|
|
11
|
+
}>;
|
|
12
|
+
createUser(body: components['schemas']['user__create_invited_user__Request'], headers?: operations['create-invited-user']['parameters']['header']): Promise<{
|
|
13
|
+
user_id: string;
|
|
14
|
+
verify_link: string | null;
|
|
15
|
+
}>;
|
|
16
|
+
deleteUser(userId: string, headers?: operations['delete-user']['parameters']['header']): Promise<void>;
|
|
17
|
+
updateUser(userId: string, body: components['schemas']['user__update_user_info__Request'], headers?: operations['update-user-info']['parameters']['header']): Promise<void>;
|
|
18
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@amigo-ai/sdk",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Amigo TypeScript SDK",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"gen-types": "node scripts/gen.mjs",
|
|
14
|
+
"test": "vitest run --project unit",
|
|
15
|
+
"test:integration": "vitest run --project integration",
|
|
16
|
+
"test:watch": "vitest",
|
|
17
|
+
"test:coverage": "vitest run --coverage --project unit",
|
|
18
|
+
"build": "node scripts/gen.mjs && node scripts/build.mjs && tsc --project tsconfig.build.json",
|
|
19
|
+
"dev": "node scripts/gen.mjs && node scripts/build.mjs --watch",
|
|
20
|
+
"format": "prettier --check .",
|
|
21
|
+
"format:write": "prettier --write .",
|
|
22
|
+
"lint": "eslint 'src/**/*.{ts,tsx}' --max-warnings 0",
|
|
23
|
+
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
|
|
24
|
+
"pack:local": "npm run build && rm -rf artifacts && mkdir -p artifacts && TARBALL=$(npm pack) && mv \"$TARBALL\" artifacts/ && echo Packed: artifacts/$TARBALL"
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"types": "./dist/types/index.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"type": "module",
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/amigo-ai/amigo-typescript-sdk.git"
|
|
38
|
+
},
|
|
39
|
+
"author": "Amigo AI",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/amigo-ai/amigo-typescript-sdk/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/amigo-ai/amigo-typescript-sdk#readme",
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^24.2.0",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.39.0",
|
|
48
|
+
"@typescript-eslint/parser": "^8.39.0",
|
|
49
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
50
|
+
"dotenv": "^17.2.1",
|
|
51
|
+
"esbuild": "^0.25.8",
|
|
52
|
+
"eslint": "^9.32.0",
|
|
53
|
+
"eslint-config-prettier": "^10.1.8",
|
|
54
|
+
"globals": "^16.3.0",
|
|
55
|
+
"msw": "^2.10.4",
|
|
56
|
+
"openapi-typescript": "^7.8.0",
|
|
57
|
+
"prettier": "^3.6.2",
|
|
58
|
+
"typescript": "^5.9.2",
|
|
59
|
+
"vitest": "^3.2.4"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"openapi-fetch": "^0.14.0"
|
|
63
|
+
}
|
|
64
|
+
}
|