@fazpi-ai/sdk 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @fazpi-ai/sdk
2
2
 
3
- TypeScript and JavaScript client for Node.js 20+. Version 0.1.0. No browser SDK or UI.
3
+ TypeScript and JavaScript client for Node.js 20+. Version 0.2.0. No browser SDK or UI.
4
4
 
5
5
  ```js
6
6
  import { Fazpi } from '@fazpi-ai/sdk';
@@ -13,7 +13,7 @@ for await (const event of client.runs.stream(run.id)) {
13
13
  }
14
14
  ```
15
15
 
16
- Install with `npm install @fazpi-ai/sdk@0.1.0` or `pnpm add @fazpi-ai/sdk@0.1.0`. For the deployed API, use base URL `https://api.fazpi.ai/v2/api/v1`. Applications import the package by name; source-checkout examples use the local build.
16
+ Install with `npm install @fazpi-ai/sdk@0.2.0` or `pnpm add @fazpi-ai/sdk@0.2.0`. For the deployed API, use base URL `https://api.fazpi.ai/v2/api/v1`. Applications import the package by name; source-checkout examples use the local build.
17
17
 
18
18
  Persist `conversation.id` and retrieve it in another process to continue without resending history. Both Go and Node clients use the same conversation IDs. For a group, use target type `group`.
19
19
 
@@ -26,3 +26,11 @@ Defaults: 30-second request/stream-connection timeout, two request retries, two
26
26
  Errors are typed: `APIError` includes status, code and requestID; `TransportError`, `ProtocolError`, `TimeoutError` and `AbortError` identify client/transport failures. HTTP is restricted to loopback unless explicitly enabled. Redirects never forward credentials.
27
27
 
28
28
  See the repository root README and `RELEASING.md` for runnable Go/Node examples, tests, local API setup, limitations and verification evidence. The SDK is backend-only and requires an authorized Fazpi integration key.
29
+
30
+ ## PDF attachments (0.2.0)
31
+
32
+ Send `files: [{ name: "documento.pdf", content_base64: pdf.toString("base64") }]`
33
+ with `conversations.messages.create`. Up to five PDFs, 10 MiB per PDF and 20 MiB
34
+ combined. Use `text: ""` for PDF-only messages and reuse the same idempotency key
35
+ when retrying. The matching server update must be deployed. History and message
36
+ events include safe `files` metadata. See the repository README for full examples.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { Target, Agent, Conversation, Message, RunStatus, APIErrorBody, Run, MessagePage, CreateConversation, CreateMessage, PublicEvent, Activity, } from './types.js';
1
+ export type { Target, Agent, Conversation, Message, File, RunStatus, APIErrorBody, Run, MessagePage, CreateConversation, CreateMessage, InputFile, PublicEvent, Activity, } from './types.js';
2
2
  export { Fazpi, default } from './client.js';
3
3
  export type { MessageListParams } from './client.js';
4
4
  export type { ClientOptions, RequestOptions } from './transport.js';
package/dist/transport.js CHANGED
@@ -96,7 +96,7 @@ export class Transport {
96
96
  fetcher;
97
97
  constructor(options) {
98
98
  if (typeof process === 'undefined' || !process.versions?.node)
99
- throw new TypeError('Fazpi SDK v0.1 supports backend Node.js only.');
99
+ throw new TypeError('Fazpi SDK supports backend Node.js only.');
100
100
  if (!options || typeof options.apiKey !== 'string' || !/^fz_sk_[0-9a-f]{64}$/.test(options.apiKey))
101
101
  throw new TypeError('A valid server API key is required.');
102
102
  let base;
@@ -138,7 +138,7 @@ export class Transport {
138
138
  throw options.signal?.aborted ? new AbortError('Request aborted.') : new TimeoutError('Request timed out.');
139
139
  try {
140
140
  const response = await this.fetcher(url, { method, redirect: 'manual', signal: scope.signal, headers: {
141
- Authorization: `Bearer ${this.credential}`, Accept: stream ? 'text/event-stream' : 'application/json', 'X-Fazpi-SDK': 'typescript/0.1.0',
141
+ Authorization: `Bearer ${this.credential}`, Accept: stream ? 'text/event-stream' : 'application/json', 'X-Fazpi-SDK': 'typescript/0.2.0',
142
142
  ...(serialized === undefined ? {} : { 'Content-Type': 'application/json' }),
143
143
  ...(key === undefined ? {} : { 'Idempotency-Key': key }),
144
144
  }, ...(serialized === undefined ? {} : { body: serialized }) });
package/dist/types.d.ts CHANGED
@@ -12,7 +12,14 @@ export interface Conversation {
12
12
  target: Target;
13
13
  created_at: string;
14
14
  }
15
+ export interface File {
16
+ id: string;
17
+ name: string;
18
+ media_type: string;
19
+ size: number;
20
+ }
15
21
  export interface Message {
22
+ files?: File[];
16
23
  incomplete?: boolean;
17
24
  id: string;
18
25
  conversation_id: string;
@@ -42,8 +49,14 @@ export interface CreateConversation {
42
49
  subject_id: string;
43
50
  target: Target;
44
51
  }
52
+ /** Up to five PDFs, 10 MiB per PDF, 20 MiB combined. content_base64 is standard base64 without a data URL prefix. */
53
+ export interface InputFile {
54
+ name: string;
55
+ content_base64: string;
56
+ }
45
57
  export interface CreateMessage {
46
58
  text: string;
59
+ files?: InputFile[];
47
60
  }
48
61
  /** Keep persisted cursor IDs as strings; JavaScript numbers can lose precision. */
49
62
  export interface PublicEvent {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fazpi-ai/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [