@usecrow/client 0.1.17 → 0.1.19

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.
@@ -1,188 +0,0 @@
1
- /**
2
- * Core types for @usecrow/client
3
- */
4
- interface CrowClientConfig {
5
- /** Your Crow product ID from the dashboard */
6
- productId: string;
7
- /** API URL (defaults to https://api.usecrow.org) */
8
- apiUrl?: string;
9
- /** Default model to use */
10
- model?: string;
11
- }
12
- interface IdentifyOptions {
13
- /** JWT token from your backend for user verification */
14
- token: string;
15
- /** Optional user display name */
16
- name?: string;
17
- /** Optional user email */
18
- email?: string;
19
- /** Any additional metadata */
20
- [key: string]: unknown;
21
- }
22
- interface IdentityState {
23
- token: string | null;
24
- metadata: Record<string, unknown>;
25
- isVerified: boolean;
26
- }
27
- interface Message {
28
- id: string;
29
- content: string;
30
- role: 'user' | 'assistant';
31
- timestamp: Date;
32
- /** Citations from knowledge base */
33
- citations?: Citation[];
34
- /** Claude's reasoning/thinking trace */
35
- thinking?: string;
36
- /** Whether thinking is complete */
37
- thinkingComplete?: boolean;
38
- }
39
- interface Citation {
40
- document_id: string;
41
- filename: string;
42
- similarity?: number;
43
- image_url?: string;
44
- page?: number;
45
- }
46
- type StreamEvent = {
47
- type: 'content';
48
- text: string;
49
- accumulated: string;
50
- } | {
51
- type: 'thinking';
52
- content: string;
53
- } | {
54
- type: 'thinking_complete';
55
- } | {
56
- type: 'citations';
57
- citations: Citation[];
58
- } | {
59
- type: 'tool_call_start';
60
- toolName: string;
61
- arguments: Record<string, unknown>;
62
- } | {
63
- type: 'tool_call_complete';
64
- toolName: string;
65
- success: boolean;
66
- } | {
67
- type: 'client_tool_call';
68
- toolName: string;
69
- arguments: Record<string, unknown>;
70
- } | {
71
- type: 'workflow_started';
72
- name: string;
73
- todos: WorkflowTodo[];
74
- } | {
75
- type: 'workflow_todo_updated';
76
- todoId: string;
77
- status: 'pending' | 'completed';
78
- } | {
79
- type: 'workflow_ended';
80
- } | {
81
- type: 'workflow_complete_prompt';
82
- } | {
83
- type: 'verification_status';
84
- isVerified: boolean;
85
- } | {
86
- type: 'conversation_id';
87
- conversationId: string;
88
- } | {
89
- type: 'error';
90
- message: string;
91
- } | {
92
- type: 'done';
93
- };
94
- type ToolHandler = (args: Record<string, unknown>) => Promise<ToolResult> | ToolResult;
95
- interface ToolResult {
96
- status: 'success' | 'error';
97
- data?: unknown;
98
- error?: string;
99
- }
100
- type ToolHandlers = Record<string, ToolHandler>;
101
- interface Conversation {
102
- id: string;
103
- name: string | null;
104
- created_at: string;
105
- updated_at: string;
106
- }
107
- interface WorkflowTodo {
108
- id: string;
109
- text: string;
110
- status: 'pending' | 'completed';
111
- }
112
- interface ActiveWorkflow {
113
- name: string;
114
- todos: WorkflowTodo[];
115
- isComplete?: boolean;
116
- }
117
- interface ContextData {
118
- /** Current page URL or path */
119
- page?: string;
120
- /** Custom context data */
121
- [key: string]: unknown;
122
- }
123
- interface CrowEventCallbacks {
124
- onMessage?: (message: Message) => void;
125
- onMessageUpdate?: (messageId: string, updates: Partial<Message>) => void;
126
- onToolCall?: (event: StreamEvent & {
127
- type: 'tool_call_start' | 'tool_call_complete' | 'client_tool_call';
128
- }) => void;
129
- onWorkflow?: (event: StreamEvent & {
130
- type: 'workflow_started' | 'workflow_todo_updated' | 'workflow_ended' | 'workflow_complete_prompt';
131
- }) => void;
132
- onVerificationStatus?: (isVerified: boolean) => void;
133
- onError?: (error: Error) => void;
134
- }
135
-
136
- /**
137
- * CrowBrowserUse - Client-side browser automation orchestrator
138
- *
139
- * Handles DOM operations via PageController while server makes LLM decisions.
140
- * API keys stay secure on the server.
141
- *
142
- * Usage:
143
- * - For widget/bundled contexts: import from '@usecrow/client/browser' which
144
- * statically imports PageController and injects it automatically.
145
- * - For standalone SDK: install @page-agent/page-controller and use dynamic import fallback.
146
- */
147
-
148
- interface BrowserUseConfig {
149
- productId: string;
150
- apiUrl: string;
151
- }
152
- declare class CrowBrowserUse {
153
- private config;
154
- private pageController;
155
- private sessionId;
156
- private maxSteps;
157
- constructor(config: BrowserUseConfig);
158
- /**
159
- * Initialize PageController with non-blocking pointer
160
- */
161
- private initPageController;
162
- /**
163
- * Execute a browser automation task
164
- */
165
- execute(task: string): Promise<ToolResult>;
166
- /**
167
- * Start a browser-use session on the server
168
- */
169
- private startSession;
170
- /**
171
- * Process a step on the server
172
- */
173
- private processStep;
174
- /**
175
- * Execute an action using PageController
176
- */
177
- private executeAction;
178
- /**
179
- * Cleanup resources
180
- */
181
- private cleanup;
182
- /**
183
- * Stop the current task
184
- */
185
- stop(): Promise<void>;
186
- }
187
-
188
- export { type ActiveWorkflow as A, type CrowClientConfig as C, type IdentifyOptions as I, type Message as M, type StreamEvent as S, type ToolHandlers as T, type WorkflowTodo as W, type CrowEventCallbacks as a, type ContextData as b, type Conversation as c, type IdentityState as d, type ToolResult as e, type Citation as f, CrowBrowserUse as g, type ToolHandler as h };