@naturali/sdk 0.73.2 → 0.74.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/dist/index.mjs CHANGED
@@ -1384,6 +1384,71 @@ var ApiKeys = class {
1384
1384
  });
1385
1385
  }
1386
1386
  };
1387
+ var Approvals = class {
1388
+ /**
1389
+ * List approval items
1390
+ *
1391
+ * Returns approval items for a project, filterable by status, origin, and expiry.
1392
+ */
1393
+ static listApprovals(options) {
1394
+ return (options.client ?? client).get({
1395
+ url: "/v1/projects/{project_id}/approvals",
1396
+ ...options
1397
+ });
1398
+ }
1399
+ /**
1400
+ * List recurring approval groups
1401
+ *
1402
+ * Read-only rollup answering "what keeps coming back?" — groups items by `dedup_key` and returns those recurring at least `min_count` times, most-recurrent first. Each group carries the ordered item chain (via `previous_item_id`) and the resolution reasons in order, so a human can read recurring rejections side by side and graduate the pattern into a guardrail `deny`. Exact-key grouping only; no cluster state is stored.
1403
+ */
1404
+ static listApprovalRecurrences(options) {
1405
+ return (options.client ?? client).get({
1406
+ url: "/v1/projects/{project_id}/approvals/recurrences",
1407
+ ...options
1408
+ });
1409
+ }
1410
+ /**
1411
+ * Get an approval item
1412
+ *
1413
+ * Returns a single approval item with its full evidence.
1414
+ */
1415
+ static getApproval(options) {
1416
+ return (options.client ?? client).get({
1417
+ url: "/v1/projects/{project_id}/approvals/{approval_id}",
1418
+ ...options
1419
+ });
1420
+ }
1421
+ /**
1422
+ * Approve an approval item
1423
+ *
1424
+ * Approves the item. Optionally supply edited `arguments` to replace the proposed arguments (edit-then-approve); the original is preserved on the item. Expiry is re-checked at decision time — an expired item can never be approved.
1425
+ */
1426
+ static approveApproval(options) {
1427
+ return (options.client ?? client).post({
1428
+ url: "/v1/projects/{project_id}/approvals/{approval_id}/approve",
1429
+ ...options,
1430
+ headers: {
1431
+ "Content-Type": "application/json",
1432
+ ...options.headers
1433
+ }
1434
+ });
1435
+ }
1436
+ /**
1437
+ * Reject an approval item
1438
+ *
1439
+ * Rejects the item. A reason is required and preserved on the item.
1440
+ */
1441
+ static rejectApproval(options) {
1442
+ return (options.client ?? client).post({
1443
+ url: "/v1/projects/{project_id}/approvals/{approval_id}/reject",
1444
+ ...options,
1445
+ headers: {
1446
+ "Content-Type": "application/json",
1447
+ ...options.headers
1448
+ }
1449
+ });
1450
+ }
1451
+ };
1387
1452
  var Assistant = class {
1388
1453
  /**
1389
1454
  * List linked identities
@@ -2139,6 +2204,56 @@ var Evaluations = class {
2139
2204
  });
2140
2205
  }
2141
2206
  };
2207
+ var Exceptions = class {
2208
+ /**
2209
+ * List exception items
2210
+ *
2211
+ * Returns exception items for a project, filterable by status, severity, and kind.
2212
+ */
2213
+ static listExceptions(options) {
2214
+ return (options.client ?? client).get({
2215
+ url: "/v1/projects/{project_id}/exceptions",
2216
+ ...options
2217
+ });
2218
+ }
2219
+ /**
2220
+ * Get an exception item
2221
+ *
2222
+ * Returns a single exception item with its full detail.
2223
+ */
2224
+ static getException(options) {
2225
+ return (options.client ?? client).get({
2226
+ url: "/v1/projects/{project_id}/exceptions/{exception_id}",
2227
+ ...options
2228
+ });
2229
+ }
2230
+ /**
2231
+ * Acknowledge an exception item
2232
+ *
2233
+ * Moves the item to `acknowledged` ("someone is on it"), recording who. A no-op that returns the item unchanged when already acknowledged; rejected when already resolved.
2234
+ */
2235
+ static acknowledgeException(options) {
2236
+ return (options.client ?? client).post({
2237
+ url: "/v1/projects/{project_id}/exceptions/{exception_id}/acknowledge",
2238
+ ...options
2239
+ });
2240
+ }
2241
+ /**
2242
+ * Resolve an exception item
2243
+ *
2244
+ * Moves the item to `resolved` ("fixed"), recording who and an optional note.
2245
+ */
2246
+ static resolveException(options) {
2247
+ return (options.client ?? client).post({
2248
+ url: "/v1/projects/{project_id}/exceptions/{exception_id}/resolve",
2249
+ ...options,
2250
+ headers: {
2251
+ "Content-Type": "application/json",
2252
+ ...options.headers
2253
+ }
2254
+ });
2255
+ }
2256
+ };
2142
2257
  var Files = class {
2143
2258
  /**
2144
2259
  * List all files
@@ -2374,6 +2489,131 @@ var Generations = class {
2374
2489
  });
2375
2490
  }
2376
2491
  };
2492
+ var Guardrails = class {
2493
+ /**
2494
+ * List guardrails
2495
+ *
2496
+ * Returns all guardrails in the project.
2497
+ */
2498
+ static listGuardrails(options) {
2499
+ return (options.client ?? client).get({
2500
+ url: "/v1/projects/{project_id}/guardrails",
2501
+ ...options
2502
+ });
2503
+ }
2504
+ /**
2505
+ * Create a guardrail
2506
+ *
2507
+ * Creates a new guardrail in the project, archiving its document as version 1. The `document` is validated on write: `class` must be a literal (A/B/C/D) or a JSON Logic expression, and every variable it (and `guard`) reference must resolve to the `args.*` / `context.*` / `runtime.*` namespaces — an out-of-catalog `runtime.*` key is rejected with 400.
2508
+ *
2509
+ */
2510
+ static createGuardrail(options) {
2511
+ return (options.client ?? client).post({
2512
+ url: "/v1/projects/{project_id}/guardrails",
2513
+ ...options,
2514
+ headers: {
2515
+ "Content-Type": "application/json",
2516
+ ...options.headers
2517
+ }
2518
+ });
2519
+ }
2520
+ /**
2521
+ * Delete a guardrail
2522
+ *
2523
+ * Deletes a guardrail and its archived versions by ID.
2524
+ */
2525
+ static deleteGuardrail(options) {
2526
+ return (options.client ?? client).delete({
2527
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}",
2528
+ ...options
2529
+ });
2530
+ }
2531
+ /**
2532
+ * Get a guardrail
2533
+ *
2534
+ * Returns a single guardrail by ID.
2535
+ */
2536
+ static getGuardrail(options) {
2537
+ return (options.client ?? client).get({
2538
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}",
2539
+ ...options
2540
+ });
2541
+ }
2542
+ /**
2543
+ * Update a guardrail
2544
+ *
2545
+ * Updates an existing guardrail. A `document` write that actually changes the policy increments `version` and archives the new document as a GuardrailVersion; metadata-only edits (name / description / context), and re-writing the document the guardrail already holds, leave the version untouched.
2546
+ *
2547
+ */
2548
+ static updateGuardrail(options) {
2549
+ return (options.client ?? client).patch({
2550
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}",
2551
+ ...options,
2552
+ headers: {
2553
+ "Content-Type": "application/json",
2554
+ ...options.headers
2555
+ }
2556
+ });
2557
+ }
2558
+ /**
2559
+ * List a guardrail's config versions
2560
+ *
2561
+ * Returns the guardrail's archived configurations, newest first. A version is written on create and on every subsequent write that changes the policy `document` — through the REST API or a formation apply alike. Metadata-only edits (name, description, context binding) do not archive a version. See [Versioning](/docs/modules/guardrails#versioning).
2562
+ *
2563
+ */
2564
+ static listGuardrailVersions(options) {
2565
+ return (options.client ?? client).get({
2566
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}/versions",
2567
+ ...options
2568
+ });
2569
+ }
2570
+ /**
2571
+ * Fetch an archived guardrail version
2572
+ *
2573
+ * Returns the exact configuration — and so the exact `document` — that governed at a given version. Approval items, activity entries, and exceptions record the version that governed them, so the audit chain survives edits.
2574
+ *
2575
+ */
2576
+ static getGuardrailVersion(options) {
2577
+ return (options.client ?? client).get({
2578
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}/versions/{version}",
2579
+ ...options
2580
+ });
2581
+ }
2582
+ /**
2583
+ * Restore an archived guardrail config
2584
+ *
2585
+ * Writes an archived version's `document` back as the guardrail's live policy, which archives it again as a **new** version rather than rewinding the counter — so an approval item or exception citing any version in between still resolves.
2586
+ *
2587
+ * The restore runs through the ordinary update path, so the archived document is re-validated; restoring the policy the guardrail already holds is a no-op and archives nothing.
2588
+ *
2589
+ */
2590
+ static restoreGuardrailVersion(options) {
2591
+ return (options.client ?? client).post({
2592
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}/versions/{version}/restore",
2593
+ ...options,
2594
+ headers: {
2595
+ "Content-Type": "application/json",
2596
+ ...options.headers
2597
+ }
2598
+ });
2599
+ }
2600
+ /**
2601
+ * Dry-run evaluate a guardrail
2602
+ *
2603
+ * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tool.*`.
2604
+ *
2605
+ */
2606
+ static evaluateGuardrail(options) {
2607
+ return (options.client ?? client).post({
2608
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}/evaluate",
2609
+ ...options,
2610
+ headers: {
2611
+ "Content-Type": "application/json",
2612
+ ...options.headers
2613
+ }
2614
+ });
2615
+ }
2616
+ };
2377
2617
  var IngestionRules = class {
2378
2618
  /**
2379
2619
  * List ingestion rules
@@ -2456,6 +2696,136 @@ var Knowledge = class {
2456
2696
  });
2457
2697
  }
2458
2698
  };
2699
+ var Memories = class {
2700
+ /**
2701
+ * List memories
2702
+ *
2703
+ * Returns a list of memory configurations for a project
2704
+ */
2705
+ static listMemories(options) {
2706
+ return (options.client ?? client).get({
2707
+ url: "/v1/projects/{project_id}/memories",
2708
+ ...options
2709
+ });
2710
+ }
2711
+ /**
2712
+ * Create a memory
2713
+ *
2714
+ * Creates a new memory configuration in a project
2715
+ */
2716
+ static createMemory(options) {
2717
+ return (options.client ?? client).post({
2718
+ url: "/v1/projects/{project_id}/memories",
2719
+ ...options,
2720
+ headers: {
2721
+ "Content-Type": "application/json",
2722
+ ...options.headers
2723
+ }
2724
+ });
2725
+ }
2726
+ /**
2727
+ * Delete a memory
2728
+ *
2729
+ * Deletes a memory configuration
2730
+ */
2731
+ static deleteMemory(options) {
2732
+ return (options.client ?? client).delete({
2733
+ url: "/v1/projects/{project_id}/memories/{memory_id}",
2734
+ ...options
2735
+ });
2736
+ }
2737
+ /**
2738
+ * Get a memory
2739
+ *
2740
+ * Returns a single memory configuration by ID
2741
+ */
2742
+ static getMemory(options) {
2743
+ return (options.client ?? client).get({
2744
+ url: "/v1/projects/{project_id}/memories/{memory_id}",
2745
+ ...options
2746
+ });
2747
+ }
2748
+ /**
2749
+ * Update a memory
2750
+ *
2751
+ * Updates an existing memory configuration
2752
+ */
2753
+ static updateMemory(options) {
2754
+ return (options.client ?? client).put({
2755
+ url: "/v1/projects/{project_id}/memories/{memory_id}",
2756
+ ...options,
2757
+ headers: {
2758
+ "Content-Type": "application/json",
2759
+ ...options.headers
2760
+ }
2761
+ });
2762
+ }
2763
+ };
2764
+ var MemoryEntries = class {
2765
+ /**
2766
+ * List memory entries
2767
+ *
2768
+ * Returns all entries in a memory container
2769
+ */
2770
+ static listMemoryEntries(options) {
2771
+ return (options.client ?? client).get({
2772
+ url: "/v1/projects/{project_id}/memory-entries",
2773
+ ...options
2774
+ });
2775
+ }
2776
+ /**
2777
+ * Create a memory entry
2778
+ *
2779
+ * Creates a new entry in the specified memory container. Automatically generates an embedding for semantic search, and skips the write when an existing entry is a near-duplicate (see `duplicate_threshold`). A merely similar fact is stored as its own entry: this path has no agent context and therefore no model to consolidate two facts into one.
2780
+ */
2781
+ static createMemoryEntry(options) {
2782
+ return (options.client ?? client).post({
2783
+ url: "/v1/projects/{project_id}/memory-entries",
2784
+ ...options,
2785
+ headers: {
2786
+ "Content-Type": "application/json",
2787
+ ...options.headers
2788
+ }
2789
+ });
2790
+ }
2791
+ /**
2792
+ * Delete a memory entry
2793
+ *
2794
+ * Deletes a memory entry
2795
+ */
2796
+ static deleteMemoryEntry(options) {
2797
+ return (options.client ?? client).delete({
2798
+ url: "/v1/projects/{project_id}/memory-entries/{entry_id}",
2799
+ ...options
2800
+ });
2801
+ }
2802
+ /**
2803
+ * Get a memory entry
2804
+ *
2805
+ * Returns a single memory entry by ID
2806
+ */
2807
+ static getMemoryEntry(options) {
2808
+ return (options.client ?? client).get({
2809
+ url: "/v1/projects/{project_id}/memory-entries/{entry_id}",
2810
+ ...options
2811
+ });
2812
+ }
2813
+ /**
2814
+ * Update a memory entry
2815
+ *
2816
+ * Updates an existing memory entry. Regenerates the embedding if content changes.
2817
+ */
2818
+ static updateMemoryEntry(options) {
2819
+ return (options.client ?? client).put({
2820
+ url: "/v1/projects/{project_id}/memory-entries/{entry_id}",
2821
+ ...options,
2822
+ headers: {
2823
+ "Content-Type": "application/json",
2824
+ ...options.headers
2825
+ }
2826
+ });
2827
+ }
2828
+ };
2459
2829
  var ModelRoutes = class {
2460
2830
  /**
2461
2831
  * List model routes
@@ -3784,6 +4154,7 @@ var NaturaliClient = class {
3784
4154
  agentVersions;
3785
4155
  aiProviders;
3786
4156
  apiKeys;
4157
+ approvals;
3787
4158
  assistant;
3788
4159
  channels;
3789
4160
  auth;
@@ -3791,10 +4162,14 @@ var NaturaliClient = class {
3791
4162
  documents;
3792
4163
  embeddings;
3793
4164
  evaluations;
4165
+ exceptions;
3794
4166
  files;
3795
4167
  generations;
4168
+ guardrails;
3796
4169
  ingestionRules;
3797
4170
  knowledge;
4171
+ memories;
4172
+ memoryEntries;
3798
4173
  modelRoutes;
3799
4174
  models;
3800
4175
  orchestrations;
@@ -3823,6 +4198,7 @@ var NaturaliClient = class {
3823
4198
  this.agentVersions = bindResource(AgentVersions, this.http);
3824
4199
  this.aiProviders = bindResource(AiProviders, this.http);
3825
4200
  this.apiKeys = bindResource(ApiKeys, this.http);
4201
+ this.approvals = bindResource(Approvals, this.http);
3826
4202
  this.assistant = bindResource(Assistant, this.http);
3827
4203
  this.channels = bindResource(Channels, this.http);
3828
4204
  this.auth = bindResource(Auth, this.http);
@@ -3830,10 +4206,14 @@ var NaturaliClient = class {
3830
4206
  this.documents = bindResource(Documents, this.http);
3831
4207
  this.embeddings = bindResource(Embeddings, this.http);
3832
4208
  this.evaluations = bindResource(Evaluations, this.http);
4209
+ this.exceptions = bindResource(Exceptions, this.http);
3833
4210
  this.files = bindResource(Files, this.http);
3834
4211
  this.generations = bindResource(Generations, this.http);
4212
+ this.guardrails = bindResource(Guardrails, this.http);
3835
4213
  this.ingestionRules = bindResource(IngestionRules, this.http);
3836
4214
  this.knowledge = bindResource(Knowledge, this.http);
4215
+ this.memories = bindResource(Memories, this.http);
4216
+ this.memoryEntries = bindResource(MemoryEntries, this.http);
3837
4217
  this.modelRoutes = bindResource(ModelRoutes, this.http);
3838
4218
  this.models = bindResource(Models, this.http);
3839
4219
  this.orchestrations = bindResource(Orchestrations, this.http);
@@ -3850,4 +4230,4 @@ var NaturaliClient = class {
3850
4230
  }
3851
4231
  };
3852
4232
  //#endregion
3853
- export { Actors, AgentVersions, Agents, AiProviders, ApiKeys, Assistant, Auth, Channels, Conversations, Documents, Embeddings, Evaluations, Files, Generations, IngestionRules, Knowledge, ModelRoutes, Models, NaturaliClient, Orchestrations, Projects, Secrets, Sessions, Tasks, Tools, Traces, Triggers, Users, Webhooks, Workflows, createClient, createConfig };
4233
+ export { Actors, AgentVersions, Agents, AiProviders, ApiKeys, Approvals, Assistant, Auth, Channels, Conversations, Documents, Embeddings, Evaluations, Exceptions, Files, Generations, Guardrails, IngestionRules, Knowledge, Memories, MemoryEntries, ModelRoutes, Models, NaturaliClient, Orchestrations, Projects, Secrets, Sessions, Tasks, Tools, Traces, Triggers, Users, Webhooks, Workflows, createClient, createConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.73.2",
3
+ "version": "0.74.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  "tsx": "^4.23.1",
38
38
  "typescript": "~6.0.3",
39
39
  "vitest": "^4.1.10",
40
- "@naturali/api": "0.73.2"
40
+ "@naturali/api": "0.74.0"
41
41
  },
42
42
  "scripts": {
43
43
  "generate": "tsx scripts/generate.ts",