@plucky-ai/node 0.2.0 → 0.2.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.
@@ -0,0 +1,407 @@
1
+ import { ApiClient, ApiClient as ApiClient$1, CreateApiClientOptions, createApiClient } from "@plucky-ai/api-contracts/client";
2
+ import * as _orpc_contract0 from "@orpc/contract";
3
+ import * as zod from "zod";
4
+ import { z } from "zod";
5
+ import * as _orpc_client0 from "@orpc/client";
6
+ import * as zod_v4_core0 from "zod/v4/core";
7
+
8
+ //#region ../api-contracts/dist/index.d.mts
9
+ //#region src/headers.d.ts
10
+ /**
11
+ * Header name constants for the public API
12
+ */
13
+ declare const API_KEY_HEADER = "x-api-key";
14
+ /**
15
+ * Schema for the API key header
16
+ * API keys are prefixed with 'sk_' (secret key)
17
+ */
18
+ //#endregion
19
+ //#region src/index.d.ts
20
+ declare const contract: {
21
+ apps: {
22
+ find: _orpc_contract0.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
23
+ id: zod.ZodString;
24
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
25
+ id: zod.ZodString;
26
+ name: zod.ZodString;
27
+ createdAt: zod.ZodCoercedDate<unknown>;
28
+ }, zod_v4_core0.$strip>, Record<never, never>, Record<never, never>>;
29
+ list: _orpc_contract0.ContractProcedureBuilderWithOutput<_orpc_contract0.Schema<unknown, unknown>, zod.ZodObject<{
30
+ results: zod.ZodArray<zod.ZodObject<{
31
+ id: zod.ZodString;
32
+ name: zod.ZodString;
33
+ createdAt: zod.ZodCoercedDate<unknown>;
34
+ }, zod_v4_core0.$strip>>;
35
+ }, zod_v4_core0.$strip>, Record<never, never>, Record<never, never>>;
36
+ };
37
+ chats: {
38
+ create: _orpc_contract0.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
39
+ title: zod.ZodString;
40
+ userId: zod.ZodString;
41
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
42
+ id: zod.ZodString;
43
+ title: zod.ZodString;
44
+ userId: zod.ZodString;
45
+ createdAt: zod.ZodCoercedDate<unknown>;
46
+ }, zod_v4_core0.$strip>, Record<never, never>, Record<never, never>>;
47
+ find: _orpc_contract0.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
48
+ id: zod.ZodString;
49
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
50
+ id: zod.ZodString;
51
+ title: zod.ZodString;
52
+ userId: zod.ZodString;
53
+ createdAt: zod.ZodCoercedDate<unknown>;
54
+ }, zod_v4_core0.$strip>, Record<never, never>, Record<never, never>>;
55
+ list: _orpc_contract0.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
56
+ userId: zod.ZodOptional<zod.ZodString>;
57
+ limit: zod.ZodDefault<zod.ZodCoercedNumber<unknown>>;
58
+ cursor: zod.ZodOptional<zod.ZodString>;
59
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
60
+ results: zod.ZodArray<zod.ZodObject<{
61
+ id: zod.ZodString;
62
+ title: zod.ZodString;
63
+ userId: zod.ZodString;
64
+ createdAt: zod.ZodCoercedDate<unknown>;
65
+ }, zod_v4_core0.$strip>>;
66
+ nextCursor: zod.ZodNullable<zod.ZodString>;
67
+ hasMore: zod.ZodBoolean;
68
+ }, zod_v4_core0.$strip>, Record<never, never>, Record<never, never>>;
69
+ };
70
+ messages: {
71
+ create: _orpc_contract0.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
72
+ id: zod.ZodOptional<zod.ZodString>;
73
+ chatId: zod.ZodString;
74
+ content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
75
+ type: zod.ZodLiteral<"text">;
76
+ text: zod.ZodString;
77
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
78
+ type: zod.ZodLiteral<"tool_use">;
79
+ id: zod.ZodString;
80
+ name: zod.ZodString;
81
+ input: zod.ZodUnknown;
82
+ defaultLoadingText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
83
+ defaultSuccessText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
84
+ partial_json: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
85
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
86
+ type: zod.ZodLiteral<"tool_result">;
87
+ toolUseId: zod.ZodString;
88
+ content: zod.ZodString;
89
+ successText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
90
+ }, zod_v4_core0.$strip>]>>]>;
91
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
92
+ id: zod.ZodString;
93
+ role: zod.ZodEnum<{
94
+ user: "user";
95
+ assistant: "assistant";
96
+ }>;
97
+ content: zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
98
+ type: zod.ZodLiteral<"text">;
99
+ text: zod.ZodString;
100
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
101
+ type: zod.ZodLiteral<"tool_use">;
102
+ id: zod.ZodString;
103
+ name: zod.ZodString;
104
+ input: zod.ZodUnknown;
105
+ defaultLoadingText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
106
+ defaultSuccessText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
107
+ partial_json: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
108
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
109
+ type: zod.ZodLiteral<"tool_result">;
110
+ toolUseId: zod.ZodString;
111
+ content: zod.ZodString;
112
+ successText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
113
+ }, zod_v4_core0.$strip>]>>;
114
+ createdAt: zod.ZodCoercedDate<unknown>;
115
+ error: zod.ZodNullable<zod.ZodObject<{
116
+ code: zod.ZodString;
117
+ message: zod.ZodString;
118
+ }, zod_v4_core0.$strip>>;
119
+ }, zod_v4_core0.$strip>, Record<never, never>, Record<never, never>>;
120
+ };
121
+ responses: {
122
+ create: _orpc_contract0.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
123
+ id: zod.ZodOptional<zod.ZodString>;
124
+ chatId: zod.ZodString;
125
+ content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
126
+ type: zod.ZodLiteral<"text">;
127
+ text: zod.ZodString;
128
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
129
+ type: zod.ZodLiteral<"tool_use">;
130
+ id: zod.ZodString;
131
+ name: zod.ZodString;
132
+ input: zod.ZodUnknown;
133
+ defaultLoadingText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
134
+ defaultSuccessText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
135
+ partial_json: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
136
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
137
+ type: zod.ZodLiteral<"tool_result">;
138
+ toolUseId: zod.ZodString;
139
+ content: zod.ZodString;
140
+ successText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
141
+ }, zod_v4_core0.$strip>]>>]>;
142
+ tools: zod.ZodDefault<zod.ZodArray<zod.ZodObject<{
143
+ name: zod.ZodString;
144
+ description: zod.ZodString;
145
+ defaultLoadingText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
146
+ defaultSuccessText: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
147
+ inputSchema: zod.ZodOptional<zod.ZodAny>;
148
+ }, zod_v4_core0.$strip>>>;
149
+ tags: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
150
+ model: zod.ZodOptional<zod.ZodString>;
151
+ }, zod_v4_core0.$strip>, _orpc_contract0.Schema<AsyncIteratorObject<{
152
+ type: "message_start";
153
+ data: {
154
+ type: "message_start";
155
+ message: {
156
+ id: string;
157
+ role: "user" | "assistant";
158
+ content: ({
159
+ type: "text";
160
+ text: string;
161
+ } | {
162
+ type: "tool_use";
163
+ id: string;
164
+ name: string;
165
+ input: unknown;
166
+ defaultLoadingText?: string | null | undefined;
167
+ defaultSuccessText?: string | null | undefined;
168
+ partial_json?: string | null | undefined;
169
+ } | {
170
+ type: "tool_result";
171
+ toolUseId: string;
172
+ content: string;
173
+ successText?: string | null | undefined;
174
+ })[];
175
+ };
176
+ };
177
+ } | {
178
+ type: "message_delta";
179
+ data: {
180
+ type: "message_delta";
181
+ delta: {
182
+ stop_reason: "tool_use" | "end_turn";
183
+ stop_sequence: string | null;
184
+ };
185
+ usage?: {
186
+ inputTokens: number;
187
+ outputTokens: number;
188
+ cacheReadInputTokens?: number | undefined;
189
+ cacheCreationInputTokens?: number | undefined;
190
+ } | undefined;
191
+ };
192
+ } | {
193
+ type: "message_stop";
194
+ data: {
195
+ type: "message_stop";
196
+ };
197
+ } | {
198
+ type: "content_block_start";
199
+ data: {
200
+ type: "content_block_start";
201
+ index: number;
202
+ contentBlock: {
203
+ type: "text";
204
+ text: string;
205
+ } | {
206
+ type: "tool_use";
207
+ id: string;
208
+ name: string;
209
+ input: unknown;
210
+ defaultLoadingText?: string | null | undefined;
211
+ defaultSuccessText?: string | null | undefined;
212
+ partial_json?: string | null | undefined;
213
+ } | {
214
+ type: "tool_result";
215
+ toolUseId: string;
216
+ content: string;
217
+ successText?: string | null | undefined;
218
+ };
219
+ };
220
+ } | {
221
+ type: "content_block_delta";
222
+ data: {
223
+ type: "content_block_delta";
224
+ index: number;
225
+ delta: {
226
+ type: "text_delta";
227
+ text: string;
228
+ } | {
229
+ type: "input_json_delta";
230
+ partial_json: string;
231
+ };
232
+ };
233
+ } | {
234
+ type: "content_block_stop";
235
+ data: {
236
+ type: "content_block_stop";
237
+ index: number;
238
+ };
239
+ } | {
240
+ type: "error";
241
+ data: {
242
+ type: "error";
243
+ error: {
244
+ code: string;
245
+ message: string;
246
+ };
247
+ };
248
+ } | {
249
+ type: "ping";
250
+ data: {
251
+ type: "ping";
252
+ timestamp: number;
253
+ };
254
+ }, unknown, void>, _orpc_client0.AsyncIteratorClass<{
255
+ type: "message_start";
256
+ data: {
257
+ type: "message_start";
258
+ message: {
259
+ id: string;
260
+ role: "user" | "assistant";
261
+ content: ({
262
+ type: "text";
263
+ text: string;
264
+ } | {
265
+ type: "tool_use";
266
+ id: string;
267
+ name: string;
268
+ input: unknown;
269
+ defaultLoadingText?: string | null | undefined;
270
+ defaultSuccessText?: string | null | undefined;
271
+ partial_json?: string | null | undefined;
272
+ } | {
273
+ type: "tool_result";
274
+ toolUseId: string;
275
+ content: string;
276
+ successText?: string | null | undefined;
277
+ })[];
278
+ };
279
+ };
280
+ } | {
281
+ type: "message_delta";
282
+ data: {
283
+ type: "message_delta";
284
+ delta: {
285
+ stop_reason: "tool_use" | "end_turn";
286
+ stop_sequence: string | null;
287
+ };
288
+ usage?: {
289
+ inputTokens: number;
290
+ outputTokens: number;
291
+ cacheReadInputTokens?: number | undefined;
292
+ cacheCreationInputTokens?: number | undefined;
293
+ } | undefined;
294
+ };
295
+ } | {
296
+ type: "message_stop";
297
+ data: {
298
+ type: "message_stop";
299
+ };
300
+ } | {
301
+ type: "content_block_start";
302
+ data: {
303
+ type: "content_block_start";
304
+ index: number;
305
+ contentBlock: {
306
+ type: "text";
307
+ text: string;
308
+ } | {
309
+ type: "tool_use";
310
+ id: string;
311
+ name: string;
312
+ input: unknown;
313
+ defaultLoadingText?: string | null | undefined;
314
+ defaultSuccessText?: string | null | undefined;
315
+ partial_json?: string | null | undefined;
316
+ } | {
317
+ type: "tool_result";
318
+ toolUseId: string;
319
+ content: string;
320
+ successText?: string | null | undefined;
321
+ };
322
+ };
323
+ } | {
324
+ type: "content_block_delta";
325
+ data: {
326
+ type: "content_block_delta";
327
+ index: number;
328
+ delta: {
329
+ type: "text_delta";
330
+ text: string;
331
+ } | {
332
+ type: "input_json_delta";
333
+ partial_json: string;
334
+ };
335
+ };
336
+ } | {
337
+ type: "content_block_stop";
338
+ data: {
339
+ type: "content_block_stop";
340
+ index: number;
341
+ };
342
+ } | {
343
+ type: "error";
344
+ data: {
345
+ type: "error";
346
+ error: {
347
+ code: string;
348
+ message: string;
349
+ };
350
+ };
351
+ } | {
352
+ type: "ping";
353
+ data: {
354
+ type: "ping";
355
+ timestamp: number;
356
+ };
357
+ }, unknown, void>>, Record<never, never>, Record<never, never>>;
358
+ };
359
+ }; //#endregion
360
+ //#endregion
361
+ //#region src/index.d.ts
362
+ interface PluckyOptions {
363
+ /**
364
+ * Your Plucky API key (starts with 'sk_')
365
+ */
366
+ apiKey: string;
367
+ /**
368
+ * Base URL of the Plucky API
369
+ * @default 'https://api.plucky.ai'
370
+ */
371
+ baseUrl?: string;
372
+ /**
373
+ * Optional custom fetch implementation for advanced use cases
374
+ */
375
+ fetch?: typeof fetch;
376
+ }
377
+ /**
378
+ * Plucky API client for Node.js
379
+ *
380
+ * @example
381
+ * ```ts
382
+ * import Plucky from '@plucky-ai/node'
383
+ *
384
+ * const plucky = new Plucky({ apiKey: 'sk_...' })
385
+ *
386
+ * const chats = await plucky.chats.list()
387
+ * ```
388
+ */
389
+ declare class Plucky {
390
+ private client;
391
+ /**
392
+ * Access to chat operations
393
+ */
394
+ readonly chats: ApiClient$1['chats'];
395
+ /**
396
+ * Access to app operations
397
+ */
398
+ readonly apps: ApiClient$1['apps'];
399
+ constructor(options: PluckyOptions);
400
+ /**
401
+ * Get the underlying API client for advanced use cases
402
+ */
403
+ get api(): ApiClient$1;
404
+ }
405
+ //#endregion
406
+ export { API_KEY_HEADER, type ApiClient, type CreateApiClientOptions, Plucky, Plucky as default, PluckyOptions, contract, createApiClient };
407
+ //# sourceMappingURL=index.d.mts.map