@naturali/sdk 0.78.6 → 0.80.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
@@ -2462,6 +2462,126 @@ var Files = class {
2462
2462
  });
2463
2463
  }
2464
2464
  };
2465
+ var Formations = class {
2466
+ /**
2467
+ * Validate a formation template
2468
+ *
2469
+ * Validates a formation template without creating any resources. Returns a list of errors and warnings. Accepts the template as a JSON object or as a YAML/JSON string.
2470
+ *
2471
+ */
2472
+ static validateFormation(options) {
2473
+ return (options.client ?? client).post({
2474
+ url: "/v1/projects/{project_id}/formations/validate",
2475
+ ...options,
2476
+ headers: {
2477
+ "Content-Type": "application/json",
2478
+ ...options.headers
2479
+ }
2480
+ });
2481
+ }
2482
+ /**
2483
+ * Plan a formation deployment
2484
+ *
2485
+ * Computes a diff between the desired template and the current stack state without making any changes. Returns the list of planned actions.
2486
+ *
2487
+ */
2488
+ static planFormation(options) {
2489
+ return (options.client ?? client).post({
2490
+ url: "/v1/projects/{project_id}/formations/plan",
2491
+ ...options,
2492
+ headers: {
2493
+ "Content-Type": "application/json",
2494
+ ...options.headers
2495
+ }
2496
+ });
2497
+ }
2498
+ /**
2499
+ * List formations
2500
+ *
2501
+ * Returns all formation stacks for a project
2502
+ */
2503
+ static listFormations(options) {
2504
+ return (options.client ?? client).get({
2505
+ url: "/v1/projects/{project_id}/formations",
2506
+ ...options
2507
+ });
2508
+ }
2509
+ /**
2510
+ * Create a new formation
2511
+ *
2512
+ * Validates the template, creates the formation record, then provisions all declared resources in dependency order.
2513
+ *
2514
+ * A **template-shape** error is refused with `400`. A **deploy** failure is not: the operation ran, so the formation is returned with `201` and `status: "failed"`, and `error` explains why (the resources created before the failure are rolled back). Read `status` — a `2xx` here means the deploy was attempted, not that it worked. The `builtin` CLI exits non-zero on that body so `create-formation && …` does not lie.
2515
+ *
2516
+ */
2517
+ static createFormation(options) {
2518
+ return (options.client ?? client).post({
2519
+ url: "/v1/projects/{project_id}/formations",
2520
+ ...options,
2521
+ headers: {
2522
+ "Content-Type": "application/json",
2523
+ ...options.headers
2524
+ }
2525
+ });
2526
+ }
2527
+ /**
2528
+ * Delete an formation
2529
+ *
2530
+ * Deletes the formation stack and all its managed resources in reverse dependency order.
2531
+ *
2532
+ * A resource the platform refuses to delete on its own — most often an agent that has generation or trace history — fails the teardown with `409 FORMATION_DELETE_FAILED`, naming every blocking resource in `error.meta.failures`. Resolve the blockers (for an agent, `DELETE /v1/projects/{project_id}/agents/{agent_id}?force=true` also removes its generations and traces, and `deletion_policy: retain` exempts it from teardown entirely) and delete the formation again.
2533
+ *
2534
+ * A refusal the platform can foresee is found by a pre-flight, before the first delete: nothing is removed, and the formation stays `active` and intact for the retry. An unforeseeable error surfaces mid-teardown instead, where resources deleted before the blocker stay deleted and the formation is left in `delete_failed`. The error message states which happened.
2535
+ *
2536
+ */
2537
+ static deleteFormation(options) {
2538
+ return (options.client ?? client).delete({
2539
+ url: "/v1/projects/{project_id}/formations/{formation_id}",
2540
+ ...options
2541
+ });
2542
+ }
2543
+ /**
2544
+ * Get a specific formation
2545
+ *
2546
+ * Returns the formation stack including its current resources.
2547
+ */
2548
+ static getFormation(options) {
2549
+ return (options.client ?? client).get({
2550
+ url: "/v1/projects/{project_id}/formations/{formation_id}",
2551
+ ...options
2552
+ });
2553
+ }
2554
+ /**
2555
+ * Update an formation
2556
+ *
2557
+ * Applies a new template to the formation. Resources are created, updated, or deleted to reconcile the current state with the desired state.
2558
+ *
2559
+ * A **template-shape** error is refused with `400`. A **deploy** failure is not: the operation ran, so the formation is returned with `200` and `status: "failed"`, and `error` explains why. Read `status` — a `2xx` here means the deploy was attempted, not that it worked. The `builtin` CLI exits non-zero on that body so `update-formation && …` does not lie.
2560
+ *
2561
+ */
2562
+ static updateFormation(options) {
2563
+ return (options.client ?? client).put({
2564
+ url: "/v1/projects/{project_id}/formations/{formation_id}",
2565
+ ...options,
2566
+ headers: {
2567
+ "Content-Type": "application/json",
2568
+ ...options.headers
2569
+ }
2570
+ });
2571
+ }
2572
+ /**
2573
+ * List formation operation events
2574
+ *
2575
+ * Returns all operations (create, update, delete) with their event logs for the formation, ordered chronologically.
2576
+ *
2577
+ */
2578
+ static listFormationEvents(options) {
2579
+ return (options.client ?? client).get({
2580
+ url: "/v1/projects/{project_id}/formations/{formation_id}/events",
2581
+ ...options
2582
+ });
2583
+ }
2584
+ };
2465
2585
  var Generations = class {
2466
2586
  /**
2467
2587
  * List generations
@@ -3122,7 +3242,9 @@ var Orchestrations = class {
3122
3242
  /**
3123
3243
  * List orchestration runs
3124
3244
  *
3125
- * Returns orchestration runs the caller can access, optionally filtered by orchestration.
3245
+ * Returns orchestration runs the caller can access, optionally filtered by orchestration, by parent run, or by whether the run has a parent at all.
3246
+ *
3247
+ * Note when aggregating: a run's `usage` covers its whole subtree, so summing it over a list that contains both a parent and its children counts the children more than once. Pass `nested=false` to sum over runs a caller started.
3126
3248
  */
3127
3249
  static listOrchestrationRuns(options) {
3128
3250
  return (options.client ?? client).get({
@@ -3772,7 +3894,7 @@ var Tools = class {
3772
3894
  *
3773
3895
  * Directly invokes a tool and returns its output. Supported for `http`, `mcp`, and `pipeline` tools. `client` tools cannot be invoked server-side and will return 422. A `pipeline` tool runs its declared steps in order and returns the mapped `output` (or the last step's output); `action` is ignored and `input` is the pipeline input.
3774
3896
  * For `mcp` tools the `action` field is required and identifies which tool name to invoke. For `http` tools `action` is ignored. When an `mcp` tool declares an `actions` allowlist, an action outside it is rejected with `400 VALIDATION_FAILED` ("not available on this tool") before any outbound request is made.
3775
- * `preset_parameters` stored on the tool are merged with the caller-supplied `input` before execution; preset keys take lower precedence.
3897
+ * `preset_parameters` stored on the tool are pinned over the caller-supplied `input` before execution: a key the tool presets keeps its preset value even when `input` sets it. Keys the presets do not name are taken from `input` as sent.
3776
3898
  *
3777
3899
  */
3778
3900
  static callTool(options) {
@@ -4282,6 +4404,7 @@ var NaturaliClient = class {
4282
4404
  evaluations;
4283
4405
  exceptions;
4284
4406
  files;
4407
+ formations;
4285
4408
  generations;
4286
4409
  guardrails;
4287
4410
  ingestionRules;
@@ -4329,6 +4452,7 @@ var NaturaliClient = class {
4329
4452
  this.evaluations = bindResource(Evaluations, this.http);
4330
4453
  this.exceptions = bindResource(Exceptions, this.http);
4331
4454
  this.files = bindResource(Files, this.http);
4455
+ this.formations = bindResource(Formations, this.http);
4332
4456
  this.generations = bindResource(Generations, this.http);
4333
4457
  this.guardrails = bindResource(Guardrails, this.http);
4334
4458
  this.ingestionRules = bindResource(IngestionRules, this.http);
@@ -4369,6 +4493,7 @@ exports.Embeddings = Embeddings;
4369
4493
  exports.Evaluations = Evaluations;
4370
4494
  exports.Exceptions = Exceptions;
4371
4495
  exports.Files = Files;
4496
+ exports.Formations = Formations;
4372
4497
  exports.Generations = Generations;
4373
4498
  exports.Guardrails = Guardrails;
4374
4499
  exports.IngestionRules = IngestionRules;