@nixet/sdk 0.1.0 → 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/SECURITY.md ADDED
@@ -0,0 +1,30 @@
1
+ # Security policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Please do not report security issues in public issues or discussions.
6
+
7
+ Email **shubham@nixet.ai** with:
8
+
9
+ - a description of the issue and its impact,
10
+ - steps to reproduce, or a proof of concept,
11
+ - the SDK version and runtime (Node, Deno, Bun, browser) you used.
12
+
13
+ We acknowledge reports within three business days and keep you informed until
14
+ the issue is resolved. We ask that you give us reasonable time to fix an issue
15
+ before disclosing it.
16
+
17
+ ## Supported versions
18
+
19
+ Security fixes are released for the latest minor version of `@nixet/sdk`.
20
+
21
+ ## Handling credentials
22
+
23
+ - Keep API keys on a server. Never ship one in browser or mobile code, where
24
+ anyone can read it.
25
+ - Pass keys through `NIXET_API_KEY` or a secret manager rather than committing
26
+ them to source control.
27
+ - Secret values, MCP connection credentials and document passwords are
28
+ write-only: the API never returns them, and this SDK never logs them.
29
+ - If a key is exposed, revoke it in the [console](https://console.nixet.ai)
30
+ and issue a new one.
package/api.md ADDED
@@ -0,0 +1,485 @@
1
+ # API reference
2
+
3
+ Every method on the `Nixet` client, the HTTP request it makes, and what it
4
+ returns. Paths are relative to the base URL, `https://api.nixet.ai/v1` by default.
5
+
6
+ Every method also accepts a final `options` argument, `{ signal?: AbortSignal }`,
7
+ omitted from the signatures below. List methods return `Page<T>`:
8
+ `{ data: T[]; count: number }`, where `count` is the total across all pages, and
9
+ accept `{ limit?, offset? }`.
10
+
11
+ - [Client](#client)
12
+ - [Agents](#agents)
13
+ - [Agent versions](#agent-versions)
14
+ - [Runs](#runs)
15
+ - [Tasks](#tasks)
16
+ - [Users](#users)
17
+ - [Conversations](#conversations)
18
+ - [Memory](#memory)
19
+ - [Skills](#skills)
20
+ - [Knowledge collections](#knowledge-collections)
21
+ - [Knowledge sources](#knowledge-sources)
22
+ - [Documents](#documents)
23
+ - [MCP servers](#mcp-servers)
24
+ - [Tools](#tools)
25
+ - [Connections](#connections)
26
+ - [Guardrails](#guardrails)
27
+ - [Secrets](#secrets)
28
+ - [RunStream](#runstream)
29
+ - [Errors](#errors)
30
+ - [Types](#types)
31
+
32
+ ## Client
33
+
34
+ ```ts
35
+ new Nixet(options?: NixetOptions)
36
+ ```
37
+
38
+ | Option | Type | Default |
39
+ | --- | --- | --- |
40
+ | `apiKey` | `string` | `process.env.NIXET_API_KEY` (required) |
41
+ | `baseURL` | `string` | `process.env.NIXET_BASE_URL` or `https://api.nixet.ai/v1` |
42
+ | `timeout` | `number` (ms) | `600000` |
43
+ | `maxRetries` | `number` | `2` |
44
+ | `fetch` | `typeof fetch` | `globalThis.fetch` |
45
+
46
+ | Method | Request | Returns |
47
+ | --- | --- | --- |
48
+ | `nixet.whoami()` | `GET /whoami` | `Identity` |
49
+
50
+ ## Agents
51
+
52
+ | Method | Request | Returns |
53
+ | --- | --- | --- |
54
+ | `nixet.agents.create(params)` | `POST /agents`, then `POST /agents/{id}/versions` when `instructions` is given | `CreatedAgent` |
55
+ | `nixet.agents.retrieve(agentId)` | `GET /agents/{id}` | `Agent` |
56
+ | `nixet.agents.list(params?)` | `GET /agents` | `Page<Agent>` |
57
+
58
+ **`CreateAgentParams`**
59
+
60
+ | Param | Type | Notes |
61
+ | --- | --- | --- |
62
+ | `name` | `string` | Required |
63
+ | `description` | `string` | |
64
+ | `instructions` | `string` | When given, publishes v1 with the fields below |
65
+ | `model` | `ModelConfig` | |
66
+ | `tools` | `(string \| ToolRef)[]` | |
67
+ | `skills` | `string[]` | `name` or `name@v2` |
68
+ | `mcpServers` | `string[]` | |
69
+ | `toolPolicies` | `Record<string, ToolPolicy>` | Keys are `server.tool` |
70
+ | `knowledgeCollections` | `string[]` | |
71
+ | `variables` | `string[]` | |
72
+ | `guardrails` | `CreateVersionParams["guardrails"]` | |
73
+
74
+ `CreatedAgent` is `Agent` plus `version?: AgentVersion`, present when a version
75
+ was published.
76
+
77
+ ## Agent versions
78
+
79
+ | Method | Request | Returns |
80
+ | --- | --- | --- |
81
+ | `nixet.agents.versions.create(agentId, params)` | `POST /agents/{id}/versions` | `AgentVersion` |
82
+ | `nixet.agents.versions.retrieve(agentId, version)` | `GET /agents/{id}/versions/{version}` | `AgentVersion` |
83
+ | `nixet.agents.versions.list(agentId, params?)` | `GET /agents/{id}/versions` | `Page<AgentVersion>` |
84
+
85
+ **`CreateVersionParams`**
86
+
87
+ | Param | Type | Notes |
88
+ | --- | --- | --- |
89
+ | `instructions` | `string` | Required |
90
+ | `model` | `ModelConfig` | Default `{ provider: "nix", tier: "balanced" }` |
91
+ | `tools` | `(string \| ToolRef)[]` | `current_time`, `calculate`, `web_search`, `fetch_url` |
92
+ | `skills` | `string[]` | Pinned at publish |
93
+ | `redaction` | `RedactionPolicyInput` | Cannot be combined with `mcpServers` |
94
+ | `mcpServers` | `string[]` | Registered server names |
95
+ | `toolPolicies` | `Record<string, ToolPolicy>` | Only exceptions to the defaults; `ask` refused for now |
96
+ | `knowledgeCollections` | `string[]` | Collection names |
97
+ | `variables` | `string[]` | Must match the `{{placeholders}}` in `instructions` exactly |
98
+ | `guardrails` | `{ input?, output?, tool_result?: string[]; mode?: "run_all" \| "fail_fast"; on_block?: "return_message" \| "error" }` | Defaults `run_all`, `return_message` |
99
+ | `publish` | `boolean` | Default `true` |
100
+
101
+ ## Runs
102
+
103
+ | Method | Request | Returns |
104
+ | --- | --- | --- |
105
+ | `nixet.runs.create(agentId, params)` | `POST /agents/{id}/runs` | `Run` |
106
+ | `nixet.runs.stream(agentId, params)` | `POST /agents/{id}/runs/stream` (server-sent events) | `RunStream` |
107
+ | `nixet.runs.retrieve(runId)` | `GET /runs/{id}` | `Run` |
108
+ | `nixet.runs.list(agentId, params?)` | `GET /agents/{id}/runs` | `Page<Run>` |
109
+ | `nixet.runs.events(runId, params?)` | `GET /runs/{id}/events` | `Page<RunEvent>` |
110
+
111
+ **`CreateRunParams`**
112
+
113
+ | Param | Type | Notes |
114
+ | --- | --- | --- |
115
+ | `input` | `string` | Required |
116
+ | `version` | `string` | e.g. `"v2"`. Default: the published version |
117
+ | `provider` | `Provider` | Overrides the version's provider for this run |
118
+ | `sessionId` | `string` | Groups related runs |
119
+ | `userId` | `string` | Decides whose memory and connections apply |
120
+ | `variables` | `Record<string, string>` | Every declared variable, nothing else |
121
+ | `mcpServers` | `string[]` | Subset of the version's servers |
122
+
123
+ **`ListEventsParams`** — `limit`, `offset`, plus:
124
+
125
+ | Param | Type | Notes |
126
+ | --- | --- | --- |
127
+ | `after` | `number` | Only events with a higher `sequence` |
128
+ | `type` | `RunEventType` | Only this event type |
129
+
130
+ ## Tasks
131
+
132
+ | Method | Request | Returns |
133
+ | --- | --- | --- |
134
+ | `nixet.tasks.create(params)` | `POST /tasks` | `Task` |
135
+ | `nixet.tasks.retrieve(taskId)` | `GET /tasks/{id}` | `Task` |
136
+ | `nixet.tasks.list(params?)` | `GET /tasks` | `Page<Task>` |
137
+ | `nixet.tasks.cancel(taskId)` | `POST /tasks/{id}/cancel` | `Task` |
138
+ | `nixet.tasks.retry(taskId)` | `POST /tasks/{id}/retry` | `Task` |
139
+ | `nixet.tasks.resume(taskId)` | `POST /tasks/{id}/resume` | `Task` |
140
+ | `nixet.tasks.wait(taskId, options?)` | Polls `GET /tasks/{id}` | `Task` |
141
+
142
+ **`CreateTaskParams`**: `agentId` (required), `input` (required), `version`,
143
+ `conversationId`, `userId`, `provider`, `memory: MemoryPolicy`,
144
+ `maxAttempts` (default 3).
145
+
146
+ **`ListTaskParams`**: `limit`, `offset`, `status: TaskStatus`, `agentId`,
147
+ `conversationId`.
148
+
149
+ **`wait` options**: `intervalMs` (default 2000), `timeoutMs` (default 600000),
150
+ `onUpdate(task)`, `signal`. Resolves when the status is `completed`, `failed`
151
+ or `cancelled`; throws on timeout without cancelling the task.
152
+
153
+ `resume` exists for paused tasks; nothing pauses a task yet.
154
+
155
+ ## Users
156
+
157
+ | Method | Request | Returns |
158
+ | --- | --- | --- |
159
+ | `nixet.users.create(params)` | `POST /users` | `User` |
160
+ | `nixet.users.retrieve(userId)` | `GET /users/{id}` | `User` |
161
+ | `nixet.users.list(params?)` | `GET /users` | `Page<User>` |
162
+
163
+ **`CreateUserParams`**: `reference` (required, unique in the workspace),
164
+ `email`, `name`, `metadata: Record<string, unknown>`.
165
+
166
+ `list` accepts `reference` to find a user by your own ID.
167
+
168
+ ## Conversations
169
+
170
+ | Method | Request | Returns |
171
+ | --- | --- | --- |
172
+ | `nixet.conversations.create(params)` | `POST /conversations` | `Conversation` |
173
+ | `nixet.conversations.retrieve(conversationId)` | `GET /conversations/{id}` | `Conversation` |
174
+ | `nixet.conversations.list(params?)` | `GET /conversations` | `Page<Conversation>` |
175
+ | `nixet.conversations.send(conversationId, params)` | `POST /conversations/{id}/messages` | `SendMessageResponse` |
176
+ | `nixet.conversations.messages(conversationId)` | `GET /conversations/{id}/messages` | `Page<ConversationMessage>` |
177
+
178
+ **`CreateConversationParams`**: `agentId` (required), `userId`, `title`,
179
+ `agentVersion`, `memory: Partial<MemoryPolicy>`.
180
+
181
+ **`SendMessageParams`**: `input` (required), `provider`.
182
+
183
+ `list` accepts `agentId` and `userId`.
184
+
185
+ ## Memory
186
+
187
+ Every call names a target: `agentId` (required), and optionally `userId` and
188
+ `conversationId`.
189
+
190
+ | Method | Request | Returns |
191
+ | --- | --- | --- |
192
+ | `nixet.memory.create(params)` | `POST /memory` | `MemoryRow[]` |
193
+ | `nixet.memory.search(params)` | `POST /memory/search` | `MemoryRow[]` |
194
+ | `nixet.memory.list(params)` | `POST /memory/list` | `MemoryRow[]` |
195
+ | `nixet.memory.get(memoryId, target)` | `GET /memory/{id}` | `MemoryRow` |
196
+ | `nixet.memory.update(memoryId, params)` | `PATCH /memory/{id}` | `MemoryRow` |
197
+ | `nixet.memory.delete(memoryId, target)` | `DELETE /memory/{id}` | `void` |
198
+
199
+ | Params | Fields |
200
+ | --- | --- |
201
+ | `CreateMemoryParams` | target + `scope: MemoryScope` (required), `content` (required), `metadata`, `expiresAt` |
202
+ | `SearchMemoryParams` | target + `query` (required), `scope`, `limit` (default 10) |
203
+ | `ListMemoryParams` | target + `scope`, `limit` (default 50) |
204
+ | `UpdateMemoryParams` | target + `content`, `metadata`, `expiresAt` (`null` clears) |
205
+
206
+ ## Skills
207
+
208
+ | Method | Request | Returns |
209
+ | --- | --- | --- |
210
+ | `nixet.skills.create(params)` | `POST /skills`, then `POST /skills/{id}/versions` when `instructions` is given | `Skill & { version?: SkillVersion }` |
211
+ | `nixet.skills.retrieve(skillId)` | `GET /skills/{id}` | `Skill` |
212
+ | `nixet.skills.list(params?)` | `GET /skills` | `Page<Skill>` |
213
+ | `nixet.skills.versions.create(skillId, params)` | `POST /skills/{id}/versions` | `SkillVersion` |
214
+ | `nixet.skills.versions.list(skillId, params?)` | `GET /skills/{id}/versions` | `Page<SkillVersion>` |
215
+
216
+ **`CreateSkillParams`**: `name` (required; lowercase, optionally `group/name`),
217
+ `description`, `instructions`, `tools`.
218
+
219
+ **`CreateSkillVersionParams`**: `instructions` (required), `tools`, `publish`
220
+ (default `true`).
221
+
222
+ ## Knowledge collections
223
+
224
+ | Method | Request | Returns |
225
+ | --- | --- | --- |
226
+ | `nixet.knowledge.collections.create(params)` | `POST /knowledge/collections` | `KnowledgeCollection` |
227
+ | `nixet.knowledge.collections.retrieve(collectionId)` | `GET /knowledge/collections/{id}` | `KnowledgeCollection` |
228
+ | `nixet.knowledge.collections.list(params?)` | `GET /knowledge/collections` | `Page<KnowledgeCollection>` |
229
+ | `nixet.knowledge.collections.del(collectionId)` | `DELETE /knowledge/collections/{id}` | `KnowledgeCollection` |
230
+
231
+ **`CreateKnowledgeCollectionParams`**: `name` (required; lowercase and
232
+ hyphenated), `description`, `chunkStrategy: "recursive" | "markdown"` (default
233
+ `recursive`), `chunkSize` (128–8000, default 1000), `chunkOverlap` (0–2000,
234
+ default 200, below `chunkSize`). Chunk settings are fixed at creation.
235
+
236
+ `list` accepts `name`. `del` is refused while the collection has sources.
237
+
238
+ ## Knowledge sources
239
+
240
+ | Method | Request | Returns |
241
+ | --- | --- | --- |
242
+ | `nixet.knowledge.sources.create(params)` | `POST /knowledge/sources` | `KnowledgeSource` |
243
+ | `nixet.knowledge.sources.retrieve(sourceId)` | `GET /knowledge/sources/{id}` | `KnowledgeSource` |
244
+ | `nixet.knowledge.sources.list(params?)` | `GET /knowledge/sources` | `Page<KnowledgeSource>` |
245
+ | `nixet.knowledge.sources.del(sourceId)` | `DELETE /knowledge/sources/{id}` | `KnowledgeSource` |
246
+
247
+ **`CreateKnowledgeSourceParams`**: `collection` (required; the name),
248
+ `kind: "text" | "url"` (required), `title` (required), `content` (required; the
249
+ text, or the URL).
250
+
251
+ `create` returns while the source is still `pending`; poll `retrieve` until
252
+ `status` is `ready` or `failed`. `list` accepts `collectionId` and `status`.
253
+ To add a file, use `documents.convert` with `collection`.
254
+
255
+ ## Documents
256
+
257
+ | Method | Request | Returns |
258
+ | --- | --- | --- |
259
+ | `nixet.documents.convert(params)` | `POST /documents/convert` (multipart) | `DocumentConversionResult` |
260
+
261
+ **`ConvertDocumentParams`**
262
+
263
+ | Param | Type | Notes |
264
+ | --- | --- | --- |
265
+ | `file` | `Blob \| Uint8Array` | Required. Up to 20 MB |
266
+ | `filename` | `string` | Needed for bytes; matters for CSV |
267
+ | `password` | `string` | Opens a protected PDF; never stored |
268
+ | `collection` | `string` | Also store as a knowledge source. Needs `knowledge:write` |
269
+ | `title` | `string` | Source title when storing |
270
+ | `signal` | `AbortSignal` | Passed here rather than as a second argument |
271
+
272
+ **`DocumentConversionResult`**: `markdown`, `bytes`, `page_count` (null for
273
+ spreadsheets), `ocr_pages: number[]`, `source` (null unless a collection was
274
+ named; otherwise `{ id, collection, status }`).
275
+
276
+ ## MCP servers
277
+
278
+ | Method | Request | Returns |
279
+ | --- | --- | --- |
280
+ | `nixet.mcpServers.create(params)` | `POST /mcp/servers` | `McpServer` |
281
+ | `nixet.mcpServers.retrieve(serverId)` | `GET /mcp/servers/{id}` | `McpServer` |
282
+ | `nixet.mcpServers.list(params?)` | `GET /mcp/servers` | `Page<McpServer>` |
283
+ | `nixet.mcpServers.update(serverId, params)` | `PATCH /mcp/servers/{id}` | `McpServer` |
284
+ | `nixet.mcpServers.del(serverId)` | `DELETE /mcp/servers/{id}` | `McpServer` |
285
+
286
+ **`CreateMcpServerParams`**: `name` (required, fixed once created), `url`
287
+ (required; public `http(s)` only), `transport: "http" | "sse"` (default
288
+ `http`), `description`, `auth: McpAuth` (default `{ type: "none" }`).
289
+
290
+ **`UpdateMcpServerParams`**: `url`, `transport`, `description`, `auth`.
291
+ Changing `url` rediscovers the tools.
292
+
293
+ `list` accepts `name`.
294
+
295
+ ## Tools
296
+
297
+ Read-only: tools are discovered from registered MCP servers.
298
+
299
+ | Method | Request | Returns |
300
+ | --- | --- | --- |
301
+ | `nixet.tools.list(params?)` | `GET /mcp/tools` | `Page<McpTool>` |
302
+ | `nixet.tools.retrieve(toolId)` | `GET /mcp/tools/{id}` | `McpTool` |
303
+
304
+ `list` accepts `serverName` and `name`.
305
+
306
+ ## Connections
307
+
308
+ | Method | Request | Returns |
309
+ | --- | --- | --- |
310
+ | `nixet.connections.create(params)` | `POST /mcp/connections` | `Connection` |
311
+ | `nixet.connections.retrieve(id)` | `GET /mcp/connections/{id}` | `Connection` |
312
+ | `nixet.connections.list(params?)` | `GET /mcp/connections` | `Page<Connection>` |
313
+ | `nixet.connections.revoke(id)` | `DELETE /mcp/connections/{id}` | `Connection` |
314
+
315
+ **`CreateConnectionParams`**: `userId` (required), `server` (required; a server
316
+ with `per_user` auth), `value` (required; never returned), `expiresAt`,
317
+ `refreshValue`.
318
+
319
+ **`ListConnectionParams`**: `limit`, `offset`, `userId`, `server`,
320
+ `status: ConnectionStatus`.
321
+
322
+ **`Connection`**: `id`, `user_id`, `server`, `scheme`, `status`, `expires_at`,
323
+ `last_used_at`, `created_at`, `updated_at`.
324
+
325
+ ## Guardrails
326
+
327
+ | Method | Request | Returns |
328
+ | --- | --- | --- |
329
+ | `nixet.guardrails.create(params)` | `POST /guardrails` | `Guardrail` |
330
+ | `nixet.guardrails.retrieve(id)` | `GET /guardrails/{id}` | `Guardrail` |
331
+ | `nixet.guardrails.list(params?)` | `GET /guardrails` | `Page<Guardrail>` |
332
+
333
+ **`CreateGuardrailParams`** (wire field names)
334
+
335
+ | Param | Type | Notes |
336
+ | --- | --- | --- |
337
+ | `name` | `string` | Required; lowercase, numbers, hyphens |
338
+ | `description` | `string` | |
339
+ | `stage` | `"input" \| "output" \| "tool_result"` | Required |
340
+ | `action` | `"allow" \| "modify" \| "warn" \| "block"` | Required. `modify` needs `replace` on every pattern |
341
+ | `patterns` | `{ match: string; replace?: string }[]` | Case-insensitive regular expressions, up to 50 |
342
+ | `detector` | `"pii" \| "topics" \| "length"` | Instead of `patterns` |
343
+ | `topics` | `string[]` | For the `topics` detector |
344
+ | `max_characters` | `number` | For the `length` detector |
345
+ | `message` | `string` | Shown when the guard blocks |
346
+
347
+ `list` accepts `name` and `stage`. Guardrails have no update or delete through
348
+ the API.
349
+
350
+ ## Secrets
351
+
352
+ | Method | Request | Returns |
353
+ | --- | --- | --- |
354
+ | `nixet.secrets.create(params)` | `POST /secrets` | `Secret` |
355
+ | `nixet.secrets.retrieve(secretId)` | `GET /secrets/{id}` | `Secret` |
356
+ | `nixet.secrets.list(params?)` | `GET /secrets` | `Page<Secret>` |
357
+ | `nixet.secrets.update(secretId, params)` | `PATCH /secrets/{id}` | `Secret` |
358
+ | `nixet.secrets.del(secretId)` | `DELETE /secrets/{id}` | `Secret` |
359
+
360
+ **`CreateSecretParams`**: `name` (required; lowercase and hyphenated, fixed),
361
+ `value` (required; never returned), `description`.
362
+
363
+ **`UpdateSecretParams`**: `value`, `description`.
364
+
365
+ `list` accepts `name`. `Secret` holds metadata and a hint, never the value.
366
+
367
+ ## RunStream
368
+
369
+ Returned by `nixet.runs.stream`. Read it one way per run.
370
+
371
+ | Member | Type | Notes |
372
+ | --- | --- | --- |
373
+ | `runId` | `Promise<string>` | Resolves when the server accepts the run |
374
+ | `[Symbol.asyncIterator]()` | `AsyncGenerator<RunEvent>` | Every event |
375
+ | `chunks()` | `AsyncGenerator<string>` | Only `run.output` text |
376
+ | `text()` | `Promise<string>` | The full output once finished |
377
+ | `on(type \| "*", handler)` | `() => void` | Subscribe; returns an unsubscribe function |
378
+
379
+ Reading a stream twice throws.
380
+
381
+ ## Errors
382
+
383
+ ```text
384
+ NixetError
385
+ ├── APIError status, requestId
386
+ │ ├── BadRequestError 400
387
+ │ ├── AuthenticationError 401
388
+ │ ├── PermissionError 403
389
+ │ ├── NotFoundError 404
390
+ │ ├── ConflictError 409
391
+ │ ├── RateLimitError 429
392
+ │ └── ServerError 5xx
393
+ └── ConnectionError cause
394
+ ```
395
+
396
+ `ConnectionError`, `RateLimitError` and `ServerError` are retried automatically
397
+ up to `maxRetries` times before being thrown.
398
+
399
+ ## Types
400
+
401
+ All types are exported from `@nixet/sdk`. Response objects use the API's
402
+ `snake_case` field names.
403
+
404
+ ```ts
405
+ type Provider = "nix" | "openai" | "anthropic";
406
+ type Tier = "fast" | "balanced" | "powerful";
407
+
408
+ type ModelConfig =
409
+ | { provider: "nix"; tier?: Tier }
410
+ | { provider: "openai" | "anthropic"; model: string };
411
+
412
+ type RunStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
413
+
414
+ type TaskStatus =
415
+ | "queued" | "running" | "completed" | "failed" | "cancelled"
416
+ // declared for future approvals and pauses; not produced yet
417
+ | "waiting_for_tool" | "waiting_for_approval" | "waiting_for_user" | "paused";
418
+
419
+ type MemoryScope = "conversation" | "user" | "agent";
420
+ interface MemoryPolicy { conversation: boolean; user: boolean; agent: boolean }
421
+
422
+ type ToolTag = "read" | "write" | "destructive" | "external";
423
+ type ToolPolicy = "allow" | "ask" | "deny";
424
+
425
+ type McpTransport = "http" | "sse";
426
+ type McpConnectionScheme = "api_key" | "oauth2" | "session";
427
+ type McpAuth =
428
+ | { type: "none" }
429
+ | { type: "bearer"; secret: string }
430
+ | { type: "header"; header: string; secret: string }
431
+ | { type: "oauth"; secret: string }
432
+ | { type: "per_user"; scheme: McpConnectionScheme };
433
+
434
+ type ConnectionStatus = "pending" | "active" | "expired" | "revoked";
435
+
436
+ type SourceKind = "file" | "text" | "url";
437
+ type ChunkStrategy = "markdown" | "recursive";
438
+
439
+ type RedactionMode = "off" | "structured" | "standard" | "strict";
440
+ interface RedactionPolicyInput {
441
+ mode: RedactionMode;
442
+ reversible?: boolean;
443
+ minimumConfidence?: number;
444
+ labels?: RedactionLabel[];
445
+ retainFor?: "1h" | "24h" | "7d" | "30d";
446
+ }
447
+
448
+ interface Identity {
449
+ key_id: string | null;
450
+ organization_id: string;
451
+ project_id: string;
452
+ environment_id: "development" | "production";
453
+ permissions: string[];
454
+ }
455
+ ```
456
+
457
+ ### Run events
458
+
459
+ ```ts
460
+ type RunEventType =
461
+ | "run.started" | "run.completed" | "run.failed" | "run.cancelled"
462
+ | "run.paused" | "run.continued"
463
+ | "run.output"
464
+ | "run.model.started" | "run.model.completed"
465
+ | "run.tool.started" | "run.tool.completed" | "run.tool.failed"
466
+ | "run.knowledge.started" | "run.knowledge.completed"
467
+ | "run.memory.recall.started" | "run.memory.recall.completed"
468
+ | "run.memory.update.started" | "run.memory.update.completed"
469
+ | "run.reasoning.started" | "run.reasoning.completed"
470
+ | "run.subagent.spawned" | "run.subagent.completed"
471
+ | "run.subagent.failed" | "run.subagent.killed"
472
+ | "run.workflow.step.started" | "run.workflow.step.completed"
473
+ | "run.workflow.step.failed" | "run.workflow.step.skipped"
474
+ | "run.task.created" | "run.task.status"
475
+ | "run.session.summarised" | "run.context.compressed"
476
+ | "run.skill.loaded";
477
+ ```
478
+
479
+ Each `RunEvent` carries a `sequence` (monotonic within a run), a `type`, a
480
+ `category`, optional `data`, and timestamps. Resume a dropped stream with
481
+ `runs.events(runId, { after: sequence })`.
482
+
483
+ For the exact fields of every response object, see the type declarations
484
+ shipped in the package (`dist/cjs/types.d.ts`) or the
485
+ [`@nixet/contracts`](https://www.npmjs.com/package/@nixet/contracts) schemas.
@@ -84,5 +84,6 @@ export type { CreateMcpServerParams, UpdateMcpServerParams, } from "./resources/
84
84
  export type { CreateKnowledgeCollectionParams, CreateKnowledgeSourceParams, ListKnowledgeCollectionParams, ListKnowledgeSourceParams, } from "./resources/knowledge.js";
85
85
  export type { ConvertDocumentParams } from "./resources/documents.js";
86
86
  export type { ListGuardrailParams } from "./resources/guardrails.js";
87
+ export type { CreateGuardrailParams } from "@nixet/contracts";
87
88
  export type { CreateConnectionParams, ListConnectionParams, } from "./resources/connections.js";
88
89
  export type * from "./types.js";
@@ -1,5 +1,5 @@
1
1
  import type { Transport } from "../transport.js";
2
- import type { CreateGuardrailRequest, Guardrail, GuardrailStage } from "@nixet/contracts";
2
+ import type { CreateGuardrailParams, Guardrail, GuardrailStage } from "@nixet/contracts";
3
3
  import type { ListParams, Page } from "../types.js";
4
4
  export interface ListGuardrailParams extends ListParams {
5
5
  name?: string;
@@ -44,7 +44,7 @@ export interface ListGuardrailParams extends ListParams {
44
44
  export declare class Guardrails {
45
45
  private readonly transport;
46
46
  constructor(transport: Transport);
47
- create(params: CreateGuardrailRequest, options?: {
47
+ create(params: CreateGuardrailParams, options?: {
48
48
  signal?: AbortSignal;
49
49
  }): Promise<Guardrail>;
50
50
  list(params?: ListGuardrailParams, options?: {
@@ -163,9 +163,6 @@ export declare class KnowledgeSources {
163
163
  * own. A version pins a collection by name, the way it pins an MCP server, so
164
164
  * adding a document changes what a published agent can find without
165
165
  * republishing it.
166
- *
167
- * Naming collections on a version is `knowledge_collections` on the publish
168
- * request, which this SDK's `versions.create` does not yet expose.
169
166
  */
170
167
  export declare class Knowledge {
171
168
  /** Sub-resource, so `nixet.knowledge.collections.create(...)` reads naturally. */
@@ -196,9 +196,6 @@ exports.KnowledgeSources = KnowledgeSources;
196
196
  * own. A version pins a collection by name, the way it pins an MCP server, so
197
197
  * adding a document changes what a published agent can find without
198
198
  * republishing it.
199
- *
200
- * Naming collections on a version is `knowledge_collections` on the publish
201
- * request, which this SDK's `versions.create` does not yet expose.
202
199
  */
203
200
  class Knowledge {
204
201
  collections;
@@ -191,9 +191,6 @@ export class KnowledgeSources {
191
191
  * own. A version pins a collection by name, the way it pins an MCP server, so
192
192
  * adding a document changes what a published agent can find without
193
193
  * republishing it.
194
- *
195
- * Naming collections on a version is `knowledge_collections` on the publish
196
- * request, which this SDK's `versions.create` does not yet expose.
197
194
  */
198
195
  export class Knowledge {
199
196
  collections;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nixet/sdk",
3
- "version": "0.1.0",
4
- "description": "Official TypeScript SDK for the Nixet agent API.",
3
+ "version": "0.1.1",
4
+ "description": "Official TypeScript SDK for the Nixet agent API: agents, versions, runs, streaming, tasks, memory, knowledge, MCP tools and guardrails.",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.js",
@@ -16,6 +16,9 @@
16
16
  "files": [
17
17
  "dist",
18
18
  "README.md",
19
+ "api.md",
20
+ "CHANGELOG.md",
21
+ "SECURITY.md",
19
22
  "LICENSE"
20
23
  ],
21
24
  "scripts": {
@@ -26,7 +29,13 @@
26
29
  "nixet",
27
30
  "agents",
28
31
  "ai",
29
- "sdk"
32
+ "ai-agents",
33
+ "llm",
34
+ "sdk",
35
+ "mcp",
36
+ "rag",
37
+ "streaming",
38
+ "typescript"
30
39
  ],
31
40
  "engines": {
32
41
  "node": ">=18"
@@ -35,8 +44,16 @@
35
44
  "typescript": "6.0.3"
36
45
  },
37
46
  "homepage": "https://nixet.ai",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/nixetio/nixet-sdk.git",
50
+ "directory": "packages/sdk"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/nixetio/nixet-sdk/issues"
54
+ },
38
55
  "dependencies": {
39
- "@nixet/contracts": "^0.1.0"
56
+ "@nixet/contracts": "^0.1.1"
40
57
  },
41
58
  "publishConfig": {
42
59
  "access": "public"