@naturali/sdk 0.73.2 → 0.75.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.cjs CHANGED
@@ -1385,6 +1385,71 @@ var ApiKeys = class {
1385
1385
  });
1386
1386
  }
1387
1387
  };
1388
+ var Approvals = class {
1389
+ /**
1390
+ * List approval items
1391
+ *
1392
+ * Returns approval items for a project, filterable by status, origin, and expiry.
1393
+ */
1394
+ static listApprovals(options) {
1395
+ return (options.client ?? client).get({
1396
+ url: "/v1/projects/{project_id}/approvals",
1397
+ ...options
1398
+ });
1399
+ }
1400
+ /**
1401
+ * List recurring approval groups
1402
+ *
1403
+ * 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.
1404
+ */
1405
+ static listApprovalRecurrences(options) {
1406
+ return (options.client ?? client).get({
1407
+ url: "/v1/projects/{project_id}/approvals/recurrences",
1408
+ ...options
1409
+ });
1410
+ }
1411
+ /**
1412
+ * Get an approval item
1413
+ *
1414
+ * Returns a single approval item with its full evidence.
1415
+ */
1416
+ static getApproval(options) {
1417
+ return (options.client ?? client).get({
1418
+ url: "/v1/projects/{project_id}/approvals/{approval_id}",
1419
+ ...options
1420
+ });
1421
+ }
1422
+ /**
1423
+ * Approve an approval item
1424
+ *
1425
+ * 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.
1426
+ */
1427
+ static approveApproval(options) {
1428
+ return (options.client ?? client).post({
1429
+ url: "/v1/projects/{project_id}/approvals/{approval_id}/approve",
1430
+ ...options,
1431
+ headers: {
1432
+ "Content-Type": "application/json",
1433
+ ...options.headers
1434
+ }
1435
+ });
1436
+ }
1437
+ /**
1438
+ * Reject an approval item
1439
+ *
1440
+ * Rejects the item. A reason is required and preserved on the item.
1441
+ */
1442
+ static rejectApproval(options) {
1443
+ return (options.client ?? client).post({
1444
+ url: "/v1/projects/{project_id}/approvals/{approval_id}/reject",
1445
+ ...options,
1446
+ headers: {
1447
+ "Content-Type": "application/json",
1448
+ ...options.headers
1449
+ }
1450
+ });
1451
+ }
1452
+ };
1388
1453
  var Assistant = class {
1389
1454
  /**
1390
1455
  * List linked identities
@@ -2140,6 +2205,56 @@ var Evaluations = class {
2140
2205
  });
2141
2206
  }
2142
2207
  };
2208
+ var Exceptions = class {
2209
+ /**
2210
+ * List exception items
2211
+ *
2212
+ * Returns exception items for a project, filterable by status, severity, and kind.
2213
+ */
2214
+ static listExceptions(options) {
2215
+ return (options.client ?? client).get({
2216
+ url: "/v1/projects/{project_id}/exceptions",
2217
+ ...options
2218
+ });
2219
+ }
2220
+ /**
2221
+ * Get an exception item
2222
+ *
2223
+ * Returns a single exception item with its full detail.
2224
+ */
2225
+ static getException(options) {
2226
+ return (options.client ?? client).get({
2227
+ url: "/v1/projects/{project_id}/exceptions/{exception_id}",
2228
+ ...options
2229
+ });
2230
+ }
2231
+ /**
2232
+ * Acknowledge an exception item
2233
+ *
2234
+ * 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.
2235
+ */
2236
+ static acknowledgeException(options) {
2237
+ return (options.client ?? client).post({
2238
+ url: "/v1/projects/{project_id}/exceptions/{exception_id}/acknowledge",
2239
+ ...options
2240
+ });
2241
+ }
2242
+ /**
2243
+ * Resolve an exception item
2244
+ *
2245
+ * Moves the item to `resolved` ("fixed"), recording who and an optional note.
2246
+ */
2247
+ static resolveException(options) {
2248
+ return (options.client ?? client).post({
2249
+ url: "/v1/projects/{project_id}/exceptions/{exception_id}/resolve",
2250
+ ...options,
2251
+ headers: {
2252
+ "Content-Type": "application/json",
2253
+ ...options.headers
2254
+ }
2255
+ });
2256
+ }
2257
+ };
2143
2258
  var Files = class {
2144
2259
  /**
2145
2260
  * List all files
@@ -2375,6 +2490,131 @@ var Generations = class {
2375
2490
  });
2376
2491
  }
2377
2492
  };
2493
+ var Guardrails = class {
2494
+ /**
2495
+ * List guardrails
2496
+ *
2497
+ * Returns all guardrails in the project.
2498
+ */
2499
+ static listGuardrails(options) {
2500
+ return (options.client ?? client).get({
2501
+ url: "/v1/projects/{project_id}/guardrails",
2502
+ ...options
2503
+ });
2504
+ }
2505
+ /**
2506
+ * Create a guardrail
2507
+ *
2508
+ * 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.
2509
+ *
2510
+ */
2511
+ static createGuardrail(options) {
2512
+ return (options.client ?? client).post({
2513
+ url: "/v1/projects/{project_id}/guardrails",
2514
+ ...options,
2515
+ headers: {
2516
+ "Content-Type": "application/json",
2517
+ ...options.headers
2518
+ }
2519
+ });
2520
+ }
2521
+ /**
2522
+ * Delete a guardrail
2523
+ *
2524
+ * Deletes a guardrail and its archived versions by ID.
2525
+ */
2526
+ static deleteGuardrail(options) {
2527
+ return (options.client ?? client).delete({
2528
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}",
2529
+ ...options
2530
+ });
2531
+ }
2532
+ /**
2533
+ * Get a guardrail
2534
+ *
2535
+ * Returns a single guardrail by ID.
2536
+ */
2537
+ static getGuardrail(options) {
2538
+ return (options.client ?? client).get({
2539
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}",
2540
+ ...options
2541
+ });
2542
+ }
2543
+ /**
2544
+ * Update a guardrail
2545
+ *
2546
+ * 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.
2547
+ *
2548
+ */
2549
+ static updateGuardrail(options) {
2550
+ return (options.client ?? client).patch({
2551
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}",
2552
+ ...options,
2553
+ headers: {
2554
+ "Content-Type": "application/json",
2555
+ ...options.headers
2556
+ }
2557
+ });
2558
+ }
2559
+ /**
2560
+ * List a guardrail's config versions
2561
+ *
2562
+ * 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).
2563
+ *
2564
+ */
2565
+ static listGuardrailVersions(options) {
2566
+ return (options.client ?? client).get({
2567
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}/versions",
2568
+ ...options
2569
+ });
2570
+ }
2571
+ /**
2572
+ * Fetch an archived guardrail version
2573
+ *
2574
+ * 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.
2575
+ *
2576
+ */
2577
+ static getGuardrailVersion(options) {
2578
+ return (options.client ?? client).get({
2579
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}/versions/{version}",
2580
+ ...options
2581
+ });
2582
+ }
2583
+ /**
2584
+ * Restore an archived guardrail config
2585
+ *
2586
+ * 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.
2587
+ *
2588
+ * 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.
2589
+ *
2590
+ */
2591
+ static restoreGuardrailVersion(options) {
2592
+ return (options.client ?? client).post({
2593
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}/versions/{version}/restore",
2594
+ ...options,
2595
+ headers: {
2596
+ "Content-Type": "application/json",
2597
+ ...options.headers
2598
+ }
2599
+ });
2600
+ }
2601
+ /**
2602
+ * Dry-run evaluate a guardrail
2603
+ *
2604
+ * 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.*`.
2605
+ *
2606
+ */
2607
+ static evaluateGuardrail(options) {
2608
+ return (options.client ?? client).post({
2609
+ url: "/v1/projects/{project_id}/guardrails/{guardrail_id}/evaluate",
2610
+ ...options,
2611
+ headers: {
2612
+ "Content-Type": "application/json",
2613
+ ...options.headers
2614
+ }
2615
+ });
2616
+ }
2617
+ };
2378
2618
  var IngestionRules = class {
2379
2619
  /**
2380
2620
  * List ingestion rules
@@ -2457,6 +2697,136 @@ var Knowledge = class {
2457
2697
  });
2458
2698
  }
2459
2699
  };
2700
+ var Memories = class {
2701
+ /**
2702
+ * List memories
2703
+ *
2704
+ * Returns a list of memory configurations for a project
2705
+ */
2706
+ static listMemories(options) {
2707
+ return (options.client ?? client).get({
2708
+ url: "/v1/projects/{project_id}/memories",
2709
+ ...options
2710
+ });
2711
+ }
2712
+ /**
2713
+ * Create a memory
2714
+ *
2715
+ * Creates a new memory configuration in a project
2716
+ */
2717
+ static createMemory(options) {
2718
+ return (options.client ?? client).post({
2719
+ url: "/v1/projects/{project_id}/memories",
2720
+ ...options,
2721
+ headers: {
2722
+ "Content-Type": "application/json",
2723
+ ...options.headers
2724
+ }
2725
+ });
2726
+ }
2727
+ /**
2728
+ * Delete a memory
2729
+ *
2730
+ * Deletes a memory configuration
2731
+ */
2732
+ static deleteMemory(options) {
2733
+ return (options.client ?? client).delete({
2734
+ url: "/v1/projects/{project_id}/memories/{memory_id}",
2735
+ ...options
2736
+ });
2737
+ }
2738
+ /**
2739
+ * Get a memory
2740
+ *
2741
+ * Returns a single memory configuration by ID
2742
+ */
2743
+ static getMemory(options) {
2744
+ return (options.client ?? client).get({
2745
+ url: "/v1/projects/{project_id}/memories/{memory_id}",
2746
+ ...options
2747
+ });
2748
+ }
2749
+ /**
2750
+ * Update a memory
2751
+ *
2752
+ * Updates an existing memory configuration
2753
+ */
2754
+ static updateMemory(options) {
2755
+ return (options.client ?? client).put({
2756
+ url: "/v1/projects/{project_id}/memories/{memory_id}",
2757
+ ...options,
2758
+ headers: {
2759
+ "Content-Type": "application/json",
2760
+ ...options.headers
2761
+ }
2762
+ });
2763
+ }
2764
+ };
2765
+ var MemoryEntries = class {
2766
+ /**
2767
+ * List memory entries
2768
+ *
2769
+ * Returns all entries in a memory container
2770
+ */
2771
+ static listMemoryEntries(options) {
2772
+ return (options.client ?? client).get({
2773
+ url: "/v1/projects/{project_id}/memory-entries",
2774
+ ...options
2775
+ });
2776
+ }
2777
+ /**
2778
+ * Create a memory entry
2779
+ *
2780
+ * 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.
2781
+ */
2782
+ static createMemoryEntry(options) {
2783
+ return (options.client ?? client).post({
2784
+ url: "/v1/projects/{project_id}/memory-entries",
2785
+ ...options,
2786
+ headers: {
2787
+ "Content-Type": "application/json",
2788
+ ...options.headers
2789
+ }
2790
+ });
2791
+ }
2792
+ /**
2793
+ * Delete a memory entry
2794
+ *
2795
+ * Deletes a memory entry
2796
+ */
2797
+ static deleteMemoryEntry(options) {
2798
+ return (options.client ?? client).delete({
2799
+ url: "/v1/projects/{project_id}/memory-entries/{entry_id}",
2800
+ ...options
2801
+ });
2802
+ }
2803
+ /**
2804
+ * Get a memory entry
2805
+ *
2806
+ * Returns a single memory entry by ID
2807
+ */
2808
+ static getMemoryEntry(options) {
2809
+ return (options.client ?? client).get({
2810
+ url: "/v1/projects/{project_id}/memory-entries/{entry_id}",
2811
+ ...options
2812
+ });
2813
+ }
2814
+ /**
2815
+ * Update a memory entry
2816
+ *
2817
+ * Updates an existing memory entry. Regenerates the embedding if content changes.
2818
+ */
2819
+ static updateMemoryEntry(options) {
2820
+ return (options.client ?? client).put({
2821
+ url: "/v1/projects/{project_id}/memory-entries/{entry_id}",
2822
+ ...options,
2823
+ headers: {
2824
+ "Content-Type": "application/json",
2825
+ ...options.headers
2826
+ }
2827
+ });
2828
+ }
2829
+ };
2460
2830
  var ModelRoutes = class {
2461
2831
  /**
2462
2832
  * List model routes
@@ -3785,6 +4155,7 @@ var NaturaliClient = class {
3785
4155
  agentVersions;
3786
4156
  aiProviders;
3787
4157
  apiKeys;
4158
+ approvals;
3788
4159
  assistant;
3789
4160
  channels;
3790
4161
  auth;
@@ -3792,10 +4163,14 @@ var NaturaliClient = class {
3792
4163
  documents;
3793
4164
  embeddings;
3794
4165
  evaluations;
4166
+ exceptions;
3795
4167
  files;
3796
4168
  generations;
4169
+ guardrails;
3797
4170
  ingestionRules;
3798
4171
  knowledge;
4172
+ memories;
4173
+ memoryEntries;
3799
4174
  modelRoutes;
3800
4175
  models;
3801
4176
  orchestrations;
@@ -3824,6 +4199,7 @@ var NaturaliClient = class {
3824
4199
  this.agentVersions = bindResource(AgentVersions, this.http);
3825
4200
  this.aiProviders = bindResource(AiProviders, this.http);
3826
4201
  this.apiKeys = bindResource(ApiKeys, this.http);
4202
+ this.approvals = bindResource(Approvals, this.http);
3827
4203
  this.assistant = bindResource(Assistant, this.http);
3828
4204
  this.channels = bindResource(Channels, this.http);
3829
4205
  this.auth = bindResource(Auth, this.http);
@@ -3831,10 +4207,14 @@ var NaturaliClient = class {
3831
4207
  this.documents = bindResource(Documents, this.http);
3832
4208
  this.embeddings = bindResource(Embeddings, this.http);
3833
4209
  this.evaluations = bindResource(Evaluations, this.http);
4210
+ this.exceptions = bindResource(Exceptions, this.http);
3834
4211
  this.files = bindResource(Files, this.http);
3835
4212
  this.generations = bindResource(Generations, this.http);
4213
+ this.guardrails = bindResource(Guardrails, this.http);
3836
4214
  this.ingestionRules = bindResource(IngestionRules, this.http);
3837
4215
  this.knowledge = bindResource(Knowledge, this.http);
4216
+ this.memories = bindResource(Memories, this.http);
4217
+ this.memoryEntries = bindResource(MemoryEntries, this.http);
3838
4218
  this.modelRoutes = bindResource(ModelRoutes, this.http);
3839
4219
  this.models = bindResource(Models, this.http);
3840
4220
  this.orchestrations = bindResource(Orchestrations, this.http);
@@ -3856,6 +4236,7 @@ exports.AgentVersions = AgentVersions;
3856
4236
  exports.Agents = Agents;
3857
4237
  exports.AiProviders = AiProviders;
3858
4238
  exports.ApiKeys = ApiKeys;
4239
+ exports.Approvals = Approvals;
3859
4240
  exports.Assistant = Assistant;
3860
4241
  exports.Auth = Auth;
3861
4242
  exports.Channels = Channels;
@@ -3863,10 +4244,14 @@ exports.Conversations = Conversations;
3863
4244
  exports.Documents = Documents;
3864
4245
  exports.Embeddings = Embeddings;
3865
4246
  exports.Evaluations = Evaluations;
4247
+ exports.Exceptions = Exceptions;
3866
4248
  exports.Files = Files;
3867
4249
  exports.Generations = Generations;
4250
+ exports.Guardrails = Guardrails;
3868
4251
  exports.IngestionRules = IngestionRules;
3869
4252
  exports.Knowledge = Knowledge;
4253
+ exports.Memories = Memories;
4254
+ exports.MemoryEntries = MemoryEntries;
3870
4255
  exports.ModelRoutes = ModelRoutes;
3871
4256
  exports.Models = Models;
3872
4257
  exports.NaturaliClient = NaturaliClient;