@blazingagents/sdk 0.40.0 → 0.41.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.
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { BlazingAgentsErrorCode } from "../types.ts";
2
3
  /**
3
4
  * `/v1` error envelope — see docs/adr/0003-ai-sdk-native-wire-protocol.md.
4
5
  * Closed producer code set; `code` is what SDKs switch on and `message` is
@@ -93,9 +94,15 @@ export declare const apiErrorCodeSchema: z.ZodEnum<{
93
94
  workspace_in_use: "workspace_in_use";
94
95
  workspace_not_found: "workspace_not_found";
95
96
  }>;
97
+ /**
98
+ * A code as received: any non-empty string, so a server newer than this SDK
99
+ * can send a code the SDK does not list. The type keeps autocomplete for the
100
+ * listed codes.
101
+ */
102
+ export declare const receivedApiErrorCodeSchema: z.ZodType<BlazingAgentsErrorCode>;
96
103
  export declare const receivedApiErrorResponseSchema: z.ZodObject<{
97
104
  error: z.ZodObject<{
98
- code: z.ZodString;
105
+ code: z.ZodType<BlazingAgentsErrorCode, unknown, z.core.$ZodTypeInternals<BlazingAgentsErrorCode, unknown>>;
99
106
  details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
100
107
  message: z.ZodString;
101
108
  param: z.ZodOptional<z.ZodString>;
@@ -93,7 +93,14 @@ export const apiErrorCodeSchema = z.enum([
93
93
  "tenant_deletion_not_ready",
94
94
  "tenant_not_deleting",
95
95
  ]);
96
- const receivedApiErrorCodeSchema = z.string().min(1);
96
+ /**
97
+ * A code as received: any non-empty string, so a server newer than this SDK
98
+ * can send a code the SDK does not list. The type keeps autocomplete for the
99
+ * listed codes.
100
+ */
101
+ export const receivedApiErrorCodeSchema = z
102
+ .string()
103
+ .min(1);
97
104
  const receivedApiErrorSchema = z
98
105
  .object({
99
106
  code: receivedApiErrorCodeSchema,
@@ -11,12 +11,12 @@ export declare const sessionInputSchema: z.ZodObject<{
11
11
  requestId: z.ZodString;
12
12
  sequence: z.ZodNumber;
13
13
  message: z.ZodObject<{
14
+ role: z.ZodLiteral<"user">;
14
15
  id: z.ZodString;
15
16
  parts: z.ZodArray<z.ZodObject<{
16
17
  type: z.ZodString;
17
18
  }, z.core.$loose>>;
18
19
  metadata: z.ZodOptional<z.ZodUnknown>;
19
- role: z.ZodLiteral<"user">;
20
20
  }, z.core.$loose>;
21
21
  state: z.ZodEnum<{
22
22
  accepted: "accepted";
@@ -49,12 +49,12 @@ export declare const sessionInputResponseSchema: z.ZodObject<{
49
49
  requestId: z.ZodString;
50
50
  sequence: z.ZodNumber;
51
51
  message: z.ZodObject<{
52
+ role: z.ZodLiteral<"user">;
52
53
  id: z.ZodString;
53
54
  parts: z.ZodArray<z.ZodObject<{
54
55
  type: z.ZodString;
55
56
  }, z.core.$loose>>;
56
57
  metadata: z.ZodOptional<z.ZodUnknown>;
57
- role: z.ZodLiteral<"user">;
58
58
  }, z.core.$loose>;
59
59
  state: z.ZodEnum<{
60
60
  accepted: "accepted";
@@ -88,12 +88,12 @@ export declare const sessionInputsResponseSchema: z.ZodObject<{
88
88
  requestId: z.ZodString;
89
89
  sequence: z.ZodNumber;
90
90
  message: z.ZodObject<{
91
+ role: z.ZodLiteral<"user">;
91
92
  id: z.ZodString;
92
93
  parts: z.ZodArray<z.ZodObject<{
93
94
  type: z.ZodString;
94
95
  }, z.core.$loose>>;
95
96
  metadata: z.ZodOptional<z.ZodUnknown>;
96
- role: z.ZodLiteral<"user">;
97
97
  }, z.core.$loose>;
98
98
  state: z.ZodEnum<{
99
99
  accepted: "accepted";
@@ -164,12 +164,12 @@ export declare const chatSteerConsumedEventSchema: z.ZodObject<{
164
164
  requestId: z.ZodString;
165
165
  sequence: z.ZodNumber;
166
166
  message: z.ZodObject<{
167
+ role: z.ZodLiteral<"user">;
167
168
  id: z.ZodString;
168
169
  parts: z.ZodArray<z.ZodObject<{
169
170
  type: z.ZodString;
170
171
  }, z.core.$loose>>;
171
172
  metadata: z.ZodOptional<z.ZodUnknown>;
172
- role: z.ZodLiteral<"user">;
173
173
  }, z.core.$loose>;
174
174
  turnId: z.ZodString;
175
175
  }, z.core.$strip>;
@@ -379,94 +379,7 @@ export declare const taskRunResponseSchema: z.ZodObject<{
379
379
  succeeded: "succeeded";
380
380
  }>;
381
381
  error: z.ZodNullable<z.ZodString>;
382
- errorCode: z.ZodNullable<z.ZodEnum<{
383
- admin_agent_managed: "admin_agent_managed";
384
- agent_disabled: "agent_disabled";
385
- agent_mcp_connection_not_found: "agent_mcp_connection_not_found";
386
- agent_mcp_connections_invalid: "agent_mcp_connections_invalid";
387
- api_key_limit_reached: "api_key_limit_reached";
388
- artifact_session_cap_reached: "artifact_session_cap_reached";
389
- chat_webhook_conflict: "chat_webhook_conflict";
390
- chat_webhook_registration_failed: "chat_webhook_registration_failed";
391
- checkout_evidence_mismatch: "checkout_evidence_mismatch";
392
- forbidden: "forbidden";
393
- function_call_conflict: "function_call_conflict";
394
- idempotency_conflict: "idempotency_conflict";
395
- input_idempotency_conflict: "input_idempotency_conflict";
396
- insufficient_scope: "insufficient_scope";
397
- internal: "internal";
398
- invalid_cursor: "invalid_cursor";
399
- invalid_request: "invalid_request";
400
- mcp_connection_authentication_failed: "mcp_connection_authentication_failed";
401
- mcp_connection_discovery_failed: "mcp_connection_discovery_failed";
402
- mcp_connection_in_use: "mcp_connection_in_use";
403
- mcp_connection_invalid: "mcp_connection_invalid";
404
- mcp_connection_limit_reached: "mcp_connection_limit_reached";
405
- mcp_connection_name_conflict: "mcp_connection_name_conflict";
406
- mcp_connection_stale_credential_version: "mcp_connection_stale_credential_version";
407
- mcp_connection_unreachable: "mcp_connection_unreachable";
408
- merchant_account_mismatch: "merchant_account_mismatch";
409
- merchant_balance_required: "merchant_balance_required";
410
- merchant_binding_not_found: "merchant_binding_not_found";
411
- merchant_binding_required: "merchant_binding_required";
412
- merchant_connection_in_use: "merchant_connection_in_use";
413
- merchant_connection_not_found: "merchant_connection_not_found";
414
- merchant_credential_invalid: "merchant_credential_invalid";
415
- merchant_customer_not_found: "merchant_customer_not_found";
416
- merchant_customer_unmapped: "merchant_customer_unmapped";
417
- merchant_eligibility_unavailable: "merchant_eligibility_unavailable";
418
- merchant_event_not_found: "merchant_event_not_found";
419
- merchant_event_state_conflict: "merchant_event_state_conflict";
420
- merchant_provider_unavailable: "merchant_provider_unavailable";
421
- merchant_subscription_required: "merchant_subscription_required";
422
- message_id_conflict: "message_id_conflict";
423
- message_not_found: "message_not_found";
424
- model_discovery_unsupported: "model_discovery_unsupported";
425
- model_not_found: "model_not_found";
426
- model_spending_limit_exceeded: "model_spending_limit_exceeded";
427
- model_validation_unavailable: "model_validation_unavailable";
428
- not_found: "not_found";
429
- prompt_variable_missing: "prompt_variable_missing";
430
- prompt_variable_unknown: "prompt_variable_unknown";
431
- provider_historical_use: "provider_historical_use";
432
- provider_in_use: "provider_in_use";
433
- provider_limit_reached: "provider_limit_reached";
434
- provider_name_conflict: "provider_name_conflict";
435
- provider_not_found: "provider_not_found";
436
- provider_required: "provider_required";
437
- quota_exceeded: "quota_exceeded";
438
- rate_limited: "rate_limited";
439
- service_unavailable: "service_unavailable";
440
- session_busy: "session_busy";
441
- session_fork_deleted: "session_fork_deleted";
442
- session_fork_unavailable: "session_fork_unavailable";
443
- session_turn_unresponsive: "session_turn_unresponsive";
444
- session_version_mismatch: "session_version_mismatch";
445
- skill_invalid_archive: "skill_invalid_archive";
446
- skill_invalid_markdown: "skill_invalid_markdown";
447
- skill_limit_reached: "skill_limit_reached";
448
- skill_name_conflict: "skill_name_conflict";
449
- skill_not_found: "skill_not_found";
450
- skill_too_many_files: "skill_too_many_files";
451
- skill_uncompressed_too_large: "skill_uncompressed_too_large";
452
- steer_not_available: "steer_not_available";
453
- subscription_already_paid: "subscription_already_paid";
454
- subscription_not_cancelled: "subscription_not_cancelled";
455
- subscription_required: "subscription_required";
456
- task_active_run_exists: "task_active_run_exists";
457
- tenant_deleting: "tenant_deleting";
458
- tenant_deletion_in_progress: "tenant_deletion_in_progress";
459
- tenant_deletion_not_ready: "tenant_deletion_not_ready";
460
- tenant_not_deleting: "tenant_not_deleting";
461
- tool_approval_continuation_settled: "tool_approval_continuation_settled";
462
- tool_approval_decision_conflict: "tool_approval_decision_conflict";
463
- unauthorized: "unauthorized";
464
- usage_credit_required: "usage_credit_required";
465
- validation_failed: "validation_failed";
466
- workspace_busy: "workspace_busy";
467
- workspace_in_use: "workspace_in_use";
468
- workspace_not_found: "workspace_not_found";
469
- }>>;
382
+ errorCode: z.ZodNullable<z.ZodType<import("../../types.ts").BlazingAgentsErrorCode, unknown, z.core.$ZodTypeInternals<import("../../types.ts").BlazingAgentsErrorCode, unknown>>>;
470
383
  userId: z.ZodString;
471
384
  metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
472
385
  startedAt: z.ZodNullable<z.ZodISODateTime>;
@@ -601,94 +514,7 @@ export declare const taskRunsListResponseSchema: z.ZodObject<{
601
514
  succeeded: "succeeded";
602
515
  }>;
603
516
  error: z.ZodNullable<z.ZodString>;
604
- errorCode: z.ZodNullable<z.ZodEnum<{
605
- admin_agent_managed: "admin_agent_managed";
606
- agent_disabled: "agent_disabled";
607
- agent_mcp_connection_not_found: "agent_mcp_connection_not_found";
608
- agent_mcp_connections_invalid: "agent_mcp_connections_invalid";
609
- api_key_limit_reached: "api_key_limit_reached";
610
- artifact_session_cap_reached: "artifact_session_cap_reached";
611
- chat_webhook_conflict: "chat_webhook_conflict";
612
- chat_webhook_registration_failed: "chat_webhook_registration_failed";
613
- checkout_evidence_mismatch: "checkout_evidence_mismatch";
614
- forbidden: "forbidden";
615
- function_call_conflict: "function_call_conflict";
616
- idempotency_conflict: "idempotency_conflict";
617
- input_idempotency_conflict: "input_idempotency_conflict";
618
- insufficient_scope: "insufficient_scope";
619
- internal: "internal";
620
- invalid_cursor: "invalid_cursor";
621
- invalid_request: "invalid_request";
622
- mcp_connection_authentication_failed: "mcp_connection_authentication_failed";
623
- mcp_connection_discovery_failed: "mcp_connection_discovery_failed";
624
- mcp_connection_in_use: "mcp_connection_in_use";
625
- mcp_connection_invalid: "mcp_connection_invalid";
626
- mcp_connection_limit_reached: "mcp_connection_limit_reached";
627
- mcp_connection_name_conflict: "mcp_connection_name_conflict";
628
- mcp_connection_stale_credential_version: "mcp_connection_stale_credential_version";
629
- mcp_connection_unreachable: "mcp_connection_unreachable";
630
- merchant_account_mismatch: "merchant_account_mismatch";
631
- merchant_balance_required: "merchant_balance_required";
632
- merchant_binding_not_found: "merchant_binding_not_found";
633
- merchant_binding_required: "merchant_binding_required";
634
- merchant_connection_in_use: "merchant_connection_in_use";
635
- merchant_connection_not_found: "merchant_connection_not_found";
636
- merchant_credential_invalid: "merchant_credential_invalid";
637
- merchant_customer_not_found: "merchant_customer_not_found";
638
- merchant_customer_unmapped: "merchant_customer_unmapped";
639
- merchant_eligibility_unavailable: "merchant_eligibility_unavailable";
640
- merchant_event_not_found: "merchant_event_not_found";
641
- merchant_event_state_conflict: "merchant_event_state_conflict";
642
- merchant_provider_unavailable: "merchant_provider_unavailable";
643
- merchant_subscription_required: "merchant_subscription_required";
644
- message_id_conflict: "message_id_conflict";
645
- message_not_found: "message_not_found";
646
- model_discovery_unsupported: "model_discovery_unsupported";
647
- model_not_found: "model_not_found";
648
- model_spending_limit_exceeded: "model_spending_limit_exceeded";
649
- model_validation_unavailable: "model_validation_unavailable";
650
- not_found: "not_found";
651
- prompt_variable_missing: "prompt_variable_missing";
652
- prompt_variable_unknown: "prompt_variable_unknown";
653
- provider_historical_use: "provider_historical_use";
654
- provider_in_use: "provider_in_use";
655
- provider_limit_reached: "provider_limit_reached";
656
- provider_name_conflict: "provider_name_conflict";
657
- provider_not_found: "provider_not_found";
658
- provider_required: "provider_required";
659
- quota_exceeded: "quota_exceeded";
660
- rate_limited: "rate_limited";
661
- service_unavailable: "service_unavailable";
662
- session_busy: "session_busy";
663
- session_fork_deleted: "session_fork_deleted";
664
- session_fork_unavailable: "session_fork_unavailable";
665
- session_turn_unresponsive: "session_turn_unresponsive";
666
- session_version_mismatch: "session_version_mismatch";
667
- skill_invalid_archive: "skill_invalid_archive";
668
- skill_invalid_markdown: "skill_invalid_markdown";
669
- skill_limit_reached: "skill_limit_reached";
670
- skill_name_conflict: "skill_name_conflict";
671
- skill_not_found: "skill_not_found";
672
- skill_too_many_files: "skill_too_many_files";
673
- skill_uncompressed_too_large: "skill_uncompressed_too_large";
674
- steer_not_available: "steer_not_available";
675
- subscription_already_paid: "subscription_already_paid";
676
- subscription_not_cancelled: "subscription_not_cancelled";
677
- subscription_required: "subscription_required";
678
- task_active_run_exists: "task_active_run_exists";
679
- tenant_deleting: "tenant_deleting";
680
- tenant_deletion_in_progress: "tenant_deletion_in_progress";
681
- tenant_deletion_not_ready: "tenant_deletion_not_ready";
682
- tenant_not_deleting: "tenant_not_deleting";
683
- tool_approval_continuation_settled: "tool_approval_continuation_settled";
684
- tool_approval_decision_conflict: "tool_approval_decision_conflict";
685
- unauthorized: "unauthorized";
686
- usage_credit_required: "usage_credit_required";
687
- validation_failed: "validation_failed";
688
- workspace_busy: "workspace_busy";
689
- workspace_in_use: "workspace_in_use";
690
- workspace_not_found: "workspace_not_found";
691
- }>>;
517
+ errorCode: z.ZodNullable<z.ZodType<import("../../types.ts").BlazingAgentsErrorCode, unknown, z.core.$ZodTypeInternals<import("../../types.ts").BlazingAgentsErrorCode, unknown>>>;
692
518
  userId: z.ZodString;
693
519
  metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
694
520
  startedAt: z.ZodNullable<z.ZodISODateTime>;
@@ -745,6 +571,16 @@ export declare const createTaskRunResponseSchema: z.ZodObject<{
745
571
  * `error`, and `finishedAt`, so one poll loop can follow the run.
746
572
  */
747
573
  export declare const taskRunMessagesResponseSchema: z.ZodObject<{
574
+ error: z.ZodNullable<z.ZodString>;
575
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
576
+ status: z.ZodEnum<{
577
+ blocked: "blocked";
578
+ canceled: "canceled";
579
+ failed: "failed";
580
+ queued: "queued";
581
+ running: "running";
582
+ succeeded: "succeeded";
583
+ }>;
748
584
  data: z.ZodArray<z.ZodObject<{
749
585
  id: z.ZodString;
750
586
  role: z.ZodEnum<{
@@ -760,16 +596,6 @@ export declare const taskRunMessagesResponseSchema: z.ZodObject<{
760
596
  }, z.core.$loose>>;
761
597
  nextCursor: z.ZodNullable<z.ZodString>;
762
598
  latestCursor: z.ZodNullable<z.ZodString>;
763
- error: z.ZodNullable<z.ZodString>;
764
- finishedAt: z.ZodNullable<z.ZodISODateTime>;
765
- status: z.ZodEnum<{
766
- blocked: "blocked";
767
- canceled: "canceled";
768
- failed: "failed";
769
- queued: "queued";
770
- running: "running";
771
- succeeded: "succeeded";
772
- }>;
773
599
  }, z.core.$strip>;
774
600
  export type TaskListItem = z.infer<typeof taskListItemSchema>;
775
601
  export type TaskRunStatus = z.infer<typeof taskRunStatusSchema>;
@@ -1,6 +1,6 @@
1
1
  import { Cron } from "croner";
2
2
  import { z } from "zod";
3
- import { apiErrorCodeSchema, paginatedResponseSchema } from "../api.js";
3
+ import { paginatedResponseSchema, receivedApiErrorCodeSchema } from "../api.js";
4
4
  import { agentIdSchema, sessionIdSchema, taskIdSchema, taskRunIdSchema, tenantIdSchema, turnIdSchema, } from "../ids.js";
5
5
  import { MAX_TASK_NAME_LENGTH, MAX_TASK_PROMPT_LENGTH, MIN_TASK_INTERVAL_MS, } from "../limitations.js";
6
6
  import { atLeastOneFieldMessage, hasObjectKeys } from "../utils.js";
@@ -242,7 +242,7 @@ export const taskRunResponseSchema = z
242
242
  turnId: turnIdSchema.nullable(),
243
243
  status: taskRunStatusSchema,
244
244
  error: z.string().nullable(),
245
- errorCode: apiErrorCodeSchema
245
+ errorCode: receivedApiErrorCodeSchema
246
246
  .nullable()
247
247
  .describe("Machine-readable reason a run ended `blocked` or `failed`: one of the API error codes, such as `usage_credit_required`, `quota_exceeded` or `provider_required`. `null` for every other run, and for a failure without a code; `error` carries the message."),
248
248
  userId: userIdSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.40.0",
3
+ "version": "0.41.0",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {