@optima-chat/agentic-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.
Files changed (73) hide show
  1. package/dist/client/conversation-api.d.ts +23 -0
  2. package/dist/client/conversation-api.d.ts.map +1 -0
  3. package/dist/client/conversation-api.js +207 -0
  4. package/dist/client/conversation-api.js.map +1 -0
  5. package/dist/client/error-mapper.d.ts +5 -0
  6. package/dist/client/error-mapper.d.ts.map +1 -0
  7. package/dist/client/error-mapper.js +19 -0
  8. package/dist/client/error-mapper.js.map +1 -0
  9. package/dist/client/event-parser.d.ts +79 -0
  10. package/dist/client/event-parser.d.ts.map +1 -0
  11. package/dist/client/event-parser.js +219 -0
  12. package/dist/client/event-parser.js.map +1 -0
  13. package/dist/client/gateway-client.d.ts +45 -0
  14. package/dist/client/gateway-client.d.ts.map +1 -0
  15. package/dist/client/gateway-client.js +172 -0
  16. package/dist/client/gateway-client.js.map +1 -0
  17. package/dist/hooks/use-approval.d.ts +8 -0
  18. package/dist/hooks/use-approval.d.ts.map +1 -0
  19. package/dist/hooks/use-approval.js +39 -0
  20. package/dist/hooks/use-approval.js.map +1 -0
  21. package/dist/hooks/use-connection-state.d.ts +7 -0
  22. package/dist/hooks/use-connection-state.d.ts.map +1 -0
  23. package/dist/hooks/use-connection-state.js +12 -0
  24. package/dist/hooks/use-connection-state.js.map +1 -0
  25. package/dist/hooks/use-conversations.d.ts +12 -0
  26. package/dist/hooks/use-conversations.d.ts.map +1 -0
  27. package/dist/hooks/use-conversations.js +42 -0
  28. package/dist/hooks/use-conversations.js.map +1 -0
  29. package/dist/hooks/use-current-chat.d.ts +14 -0
  30. package/dist/hooks/use-current-chat.d.ts.map +1 -0
  31. package/dist/hooks/use-current-chat.js +142 -0
  32. package/dist/hooks/use-current-chat.js.map +1 -0
  33. package/dist/hooks/use-question.d.ts +7 -0
  34. package/dist/hooks/use-question.d.ts.map +1 -0
  35. package/dist/hooks/use-question.js +17 -0
  36. package/dist/hooks/use-question.js.map +1 -0
  37. package/dist/hooks/use-session.d.ts +7 -0
  38. package/dist/hooks/use-session.d.ts.map +1 -0
  39. package/dist/hooks/use-session.js +13 -0
  40. package/dist/hooks/use-session.js.map +1 -0
  41. package/dist/hooks/use-switch-config.d.ts +7 -0
  42. package/dist/hooks/use-switch-config.d.ts.map +1 -0
  43. package/dist/hooks/use-switch-config.js +30 -0
  44. package/dist/hooks/use-switch-config.js.map +1 -0
  45. package/dist/index.d.ts +13 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +12 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/provider/chat-context.d.ts +14 -0
  50. package/dist/provider/chat-context.d.ts.map +1 -0
  51. package/dist/provider/chat-context.js +10 -0
  52. package/dist/provider/chat-context.js.map +1 -0
  53. package/dist/provider/chat-provider.d.ts +16 -0
  54. package/dist/provider/chat-provider.d.ts.map +1 -0
  55. package/dist/provider/chat-provider.js +200 -0
  56. package/dist/provider/chat-provider.js.map +1 -0
  57. package/dist/store/chat-store.d.ts +65 -0
  58. package/dist/store/chat-store.d.ts.map +1 -0
  59. package/dist/store/chat-store.js +220 -0
  60. package/dist/store/chat-store.js.map +1 -0
  61. package/dist/types.d.ts +152 -0
  62. package/dist/types.d.ts.map +1 -0
  63. package/dist/types.js +10 -0
  64. package/dist/types.js.map +1 -0
  65. package/dist/workspace/default-provider.d.ts +14 -0
  66. package/dist/workspace/default-provider.d.ts.map +1 -0
  67. package/dist/workspace/default-provider.js +46 -0
  68. package/dist/workspace/default-provider.js.map +1 -0
  69. package/dist/workspace/types.d.ts +11 -0
  70. package/dist/workspace/types.d.ts.map +1 -0
  71. package/dist/workspace/types.js +2 -0
  72. package/dist/workspace/types.js.map +1 -0
  73. package/package.json +49 -0
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Public types for @optima-chat/agentic-sdk.
3
+ *
4
+ * These are the types consumers see. They are distinct from the gateway protocol
5
+ * types in @optima-chat/gateway-protocol — this module performs field/type
6
+ * mapping (snake_case → camelCase, ISO strings → epoch ms, etc.) before the
7
+ * state reaches consumers.
8
+ */
9
+ import type { ServerEvent, ClientEvent, FinishInfo, Question, ApprovalRequest, ApprovalResponse, TokenProgress, BillingError, ToolResultContentBlock } from '@optima-chat/gateway-protocol';
10
+ import type { WorkspaceProvider } from './workspace/types.js';
11
+ /** WebSocket connection lifecycle state. */
12
+ export type ConnectionState = 'connecting' | 'connected' | 'reconnecting' | 'disconnected' | 'auth_failed';
13
+ /** Message lifecycle status. */
14
+ export type MessageStatus = 'pending' | 'streaming' | 'complete' | 'error';
15
+ /** Tool-call lifecycle status. */
16
+ export type ToolCallStatus = 'pending' | 'executing' | 'awaiting_approval' | 'completed' | 'error';
17
+ /** Error surfaced to consumers. */
18
+ export interface ChatError {
19
+ code: string;
20
+ message: string;
21
+ retryable?: boolean;
22
+ details?: unknown;
23
+ }
24
+ /** Conversation summary. */
25
+ export interface Conversation {
26
+ id: string;
27
+ title: string;
28
+ /** Epoch ms, converted from protocol's ISO-8601 string. */
29
+ lastMessageAt: number;
30
+ messageCount: number;
31
+ /** Epoch ms. 0 when session_ready's ConversationSummary doesn't carry it. */
32
+ createdAt: number;
33
+ }
34
+ /** Attachment (image/file/audio) on a Message — v1 only for user messages. */
35
+ export interface MessageAttachment {
36
+ type: 'image' | 'file' | 'audio';
37
+ url: string;
38
+ name?: string;
39
+ mediaType?: string;
40
+ /** Audio-only: duration in ms. */
41
+ duration?: number;
42
+ /** Audio-only: transcribed text. */
43
+ transcription?: string;
44
+ }
45
+ /** Tool call attached to an assistant Message. */
46
+ export interface ToolCall {
47
+ id: string;
48
+ /** Mapped from protocol's ToolCallInfo.name. */
49
+ toolName: string;
50
+ /** JSON string, mapped from protocol's ToolCallInfo.arguments. */
51
+ arguments: string;
52
+ status: ToolCallStatus;
53
+ /** Mapped from protocol's ToolResultInfo.output. */
54
+ result?: string;
55
+ /** Mapped from protocol's ToolResultInfo.content_blocks. */
56
+ resultContentBlocks?: ToolResultContentBlock[];
57
+ error?: string;
58
+ progress?: {
59
+ message: string;
60
+ percentage?: number;
61
+ };
62
+ }
63
+ /** Chat message — user / assistant / system. */
64
+ export interface Message {
65
+ id: string;
66
+ conversationId: string;
67
+ role: 'user' | 'assistant' | 'system';
68
+ /** Accumulated full text. */
69
+ content: string;
70
+ toolCalls: ToolCall[];
71
+ attachments?: MessageAttachment[];
72
+ status: MessageStatus;
73
+ /** Epoch ms. */
74
+ createdAt: number;
75
+ /** Optional retention of raw protocol events. */
76
+ rawEvents?: ServerEvent[];
77
+ }
78
+ /** Pending ask_question state. */
79
+ export interface QuestionRequest {
80
+ requestId: string;
81
+ /** Filled by agentic-sdk from the currently active conversation. */
82
+ conversationId: string;
83
+ questions: Question[];
84
+ }
85
+ /** Pending approval_request (ApprovalRequest + conversationId). */
86
+ export interface ApprovalRequestWithId {
87
+ requestId: string;
88
+ /** Filled by agentic-sdk from the currently active conversation. */
89
+ conversationId: string;
90
+ toolName: string;
91
+ args: Record<string, unknown>;
92
+ description?: string;
93
+ risk?: 'low' | 'medium' | 'high';
94
+ }
95
+ /** Options for sendMessage. */
96
+ export interface SendMessageOptions {
97
+ images?: File[];
98
+ files?: File[];
99
+ audio?: File[];
100
+ metadata?: Record<string, unknown>;
101
+ }
102
+ /** Result of a WorkspaceProvider upload. */
103
+ export interface UploadResult {
104
+ originalName: string;
105
+ url: string;
106
+ mediaType: string;
107
+ }
108
+ /** Props for <ChatProvider>. */
109
+ export interface ChatProviderProps {
110
+ children: React.ReactNode;
111
+ gatewayUrl: string;
112
+ tokenProvider: () => Promise<string> | string;
113
+ authenticatedFetch: (url: string, init?: RequestInit) => Promise<Response>;
114
+ onFinish?: (event: {
115
+ conversationId: string;
116
+ finish: FinishInfo;
117
+ }) => void;
118
+ onToolCall?: (event: {
119
+ conversationId: string;
120
+ toolName: string;
121
+ toolCallId: string;
122
+ /** JSON string, matches protocol ToolCallInfo.arguments. */
123
+ args: string;
124
+ }) => void;
125
+ onNotification?: (event: {
126
+ type: 'info' | 'warning' | 'error';
127
+ message: string;
128
+ code?: string;
129
+ }) => void;
130
+ onFileChange?: (event: {
131
+ conversationId: string;
132
+ path: string;
133
+ action: 'created' | 'modified' | 'deleted';
134
+ }) => void;
135
+ onError?: (error: ChatError) => void;
136
+ onAuthError?: (error: ChatError) => void;
137
+ onRawEvent?: (event: ServerEvent) => void;
138
+ onBeforeSend?: (event: ClientEvent) => ClientEvent | null;
139
+ workspaceProvider?: WorkspaceProvider;
140
+ reconnectOptions?: {
141
+ /** Default 5. */
142
+ maxRetries?: number;
143
+ /** Default 2000ms. */
144
+ baseDelay?: number;
145
+ /** Default 30000ms. */
146
+ maxDelay?: number;
147
+ };
148
+ /** Default 30000ms. */
149
+ heartbeatInterval?: number;
150
+ }
151
+ export type { FinishInfo, Question, ApprovalRequest, ApprovalResponse, TokenProgress, BillingError };
152
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,4CAA4C;AAC5C,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,WAAW,GACX,cAAc,GACd,cAAc,GACd,aAAa,CAAC;AAElB,gCAAgC;AAChC,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAE3E,kCAAkC;AAClC,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,WAAW,GACX,mBAAmB,GACnB,WAAW,GACX,OAAO,CAAC;AAEZ,mCAAmC;AACnC,MAAM,WAAW,SAAS;IACxB,IAAI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B,iBAAiB;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,sBAAsB;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,uBAAuB;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,uBAAuB;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAGD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Public types for @optima-chat/agentic-sdk.
3
+ *
4
+ * These are the types consumers see. They are distinct from the gateway protocol
5
+ * types in @optima-chat/gateway-protocol — this module performs field/type
6
+ * mapping (snake_case → camelCase, ISO strings → epoch ms, etc.) before the
7
+ * state reaches consumers.
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,14 @@
1
+ import type { WorkspaceProvider } from './types.js';
2
+ /**
3
+ * Default WorkspaceProvider backed by the gateway's workspace endpoints.
4
+ *
5
+ * - `uploadFiles` POSTs each file individually to `/api/workspace/upload` as
6
+ * FormData (field name `file`) and expects a JSON response with a `url`
7
+ * field.
8
+ * - `resolveFileUrl` returns a GET URL under `/api/workspace/files/<path>`.
9
+ *
10
+ * Consumers with a different backend can pass their own WorkspaceProvider to
11
+ * <ChatProvider>.
12
+ */
13
+ export declare function createDefaultWorkspaceProvider(gatewayBaseUrl: string, authenticatedFetch: (url: string, init?: RequestInit) => Promise<Response>): WorkspaceProvider;
14
+ //# sourceMappingURL=default-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src/workspace/default-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,GACzE,iBAAiB,CAsCnB"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Default WorkspaceProvider backed by the gateway's workspace endpoints.
3
+ *
4
+ * - `uploadFiles` POSTs each file individually to `/api/workspace/upload` as
5
+ * FormData (field name `file`) and expects a JSON response with a `url`
6
+ * field.
7
+ * - `resolveFileUrl` returns a GET URL under `/api/workspace/files/<path>`.
8
+ *
9
+ * Consumers with a different backend can pass their own WorkspaceProvider to
10
+ * <ChatProvider>.
11
+ */
12
+ export function createDefaultWorkspaceProvider(gatewayBaseUrl, authenticatedFetch) {
13
+ const base = gatewayBaseUrl.endsWith('/')
14
+ ? gatewayBaseUrl.slice(0, -1)
15
+ : gatewayBaseUrl;
16
+ return {
17
+ async uploadFiles(files) {
18
+ const results = [];
19
+ for (const file of files) {
20
+ const formData = new FormData();
21
+ formData.append('file', file);
22
+ const res = await authenticatedFetch(`${base}/api/workspace/upload`, {
23
+ method: 'POST',
24
+ body: formData,
25
+ });
26
+ if (!res.ok) {
27
+ throw new Error(`workspace upload failed for ${file.name}: ${res.status}`);
28
+ }
29
+ const data = (await res.json());
30
+ if (!data.url) {
31
+ throw new Error(`workspace upload for ${file.name} did not return a url`);
32
+ }
33
+ results.push({
34
+ originalName: file.name,
35
+ url: data.url,
36
+ mediaType: file.type,
37
+ });
38
+ }
39
+ return results;
40
+ },
41
+ resolveFileUrl(path) {
42
+ return `${base}/api/workspace/files/${encodeURIComponent(path)}`;
43
+ },
44
+ };
45
+ }
46
+ //# sourceMappingURL=default-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src/workspace/default-provider.ts"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AAc,CAAC,IAAY;YACzB,OAAO,GAAG,IAAI,wBAAwB,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;QACnE,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { UploadResult } from '../types.js';
2
+ /**
3
+ * WorkspaceProvider — consumer-supplied abstraction for file upload and URL
4
+ * resolution. The default implementation uploads to the gateway's workspace
5
+ * endpoint, but consumers may provide their own (e.g. signed S3 uploads).
6
+ */
7
+ export interface WorkspaceProvider {
8
+ uploadFiles: (files: File[]) => Promise<UploadResult[]>;
9
+ resolveFileUrl: (path: string) => string;
10
+ }
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/workspace/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IACxD,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/workspace/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@optima-chat/agentic-sdk",
3
+ "version": "0.1.0",
4
+ "description": "Chat core logic for Optima gateway - Provider, hooks, store, WebSocket client",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "sideEffects": false,
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/Optima-Chat/agentic-sdk.git",
25
+ "directory": "packages/sdk"
26
+ },
27
+ "peerDependencies": {
28
+ "react": "^19.0.0",
29
+ "zustand": "^5.0.0"
30
+ },
31
+ "dependencies": {
32
+ "@optima-chat/gateway-protocol": "^0.1.0"
33
+ },
34
+ "devDependencies": {
35
+ "@testing-library/react": "^16.0.0",
36
+ "@types/react": "^19.0.0",
37
+ "jsdom": "^25.0.0",
38
+ "react": "^19.0.0",
39
+ "react-dom": "^19.0.0",
40
+ "zustand": "^5.0.0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc",
44
+ "typecheck": "tsc --noEmit",
45
+ "test": "vitest run",
46
+ "test:watch": "vitest",
47
+ "clean": "rm -rf dist"
48
+ }
49
+ }