@axiom-lattice/client-sdk 5.0.1 → 7.0.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.
Files changed (70) hide show
  1. package/dist/__tests__/commands.test.d.ts +2 -0
  2. package/dist/__tests__/commands.test.d.ts.map +1 -0
  3. package/dist/__tests__/commands.test.js +96 -0
  4. package/dist/__tests__/commands.test.js.map +1 -0
  5. package/dist/__tests__/crons.test.d.ts +2 -0
  6. package/dist/__tests__/crons.test.d.ts.map +1 -0
  7. package/dist/__tests__/crons.test.js +103 -0
  8. package/dist/__tests__/crons.test.js.map +1 -0
  9. package/dist/__tests__/info.test.d.ts +2 -0
  10. package/dist/__tests__/info.test.d.ts.map +1 -0
  11. package/dist/__tests__/info.test.js +109 -0
  12. package/dist/__tests__/info.test.js.map +1 -0
  13. package/dist/__tests__/mcpApps.test.js +16 -0
  14. package/dist/__tests__/mcpApps.test.js.map +1 -1
  15. package/dist/__tests__/project-rooms.test.js +12 -0
  16. package/dist/__tests__/project-rooms.test.js.map +1 -1
  17. package/dist/__tests__/resume-last-event-id.test.d.ts +2 -0
  18. package/dist/__tests__/resume-last-event-id.test.d.ts.map +1 -0
  19. package/dist/__tests__/resume-last-event-id.test.js +111 -0
  20. package/dist/__tests__/resume-last-event-id.test.js.map +1 -0
  21. package/dist/__tests__/resume-stream-http-error.test.d.ts +2 -0
  22. package/dist/__tests__/resume-stream-http-error.test.d.ts.map +1 -0
  23. package/dist/__tests__/resume-stream-http-error.test.js +45 -0
  24. package/dist/__tests__/resume-stream-http-error.test.js.map +1 -0
  25. package/dist/__tests__/runs-task-queue.test.d.ts +2 -0
  26. package/dist/__tests__/runs-task-queue.test.d.ts.map +1 -0
  27. package/dist/__tests__/runs-task-queue.test.js +159 -0
  28. package/dist/__tests__/runs-task-queue.test.js.map +1 -0
  29. package/dist/__tests__/runs.test.d.ts +2 -0
  30. package/dist/__tests__/runs.test.d.ts.map +1 -0
  31. package/dist/__tests__/runs.test.js +135 -0
  32. package/dist/__tests__/runs.test.js.map +1 -0
  33. package/dist/__tests__/runtime-client.test.js +29 -0
  34. package/dist/__tests__/runtime-client.test.js.map +1 -1
  35. package/dist/__tests__/store.test.d.ts +2 -0
  36. package/dist/__tests__/store.test.d.ts.map +1 -0
  37. package/dist/__tests__/store.test.js +100 -0
  38. package/dist/__tests__/store.test.js.map +1 -0
  39. package/dist/__tests__/thread-event-stream.test.d.ts +2 -0
  40. package/dist/__tests__/thread-event-stream.test.d.ts.map +1 -0
  41. package/dist/__tests__/thread-event-stream.test.js +109 -0
  42. package/dist/__tests__/thread-event-stream.test.js.map +1 -0
  43. package/dist/__tests__/thread-maintenance.test.d.ts +2 -0
  44. package/dist/__tests__/thread-maintenance.test.d.ts.map +1 -0
  45. package/dist/__tests__/thread-maintenance.test.js +98 -0
  46. package/dist/__tests__/thread-maintenance.test.js.map +1 -0
  47. package/dist/abstract-client.d.ts +234 -1
  48. package/dist/abstract-client.d.ts.map +1 -1
  49. package/dist/abstract-client.js +406 -1
  50. package/dist/abstract-client.js.map +1 -1
  51. package/dist/client.d.ts +9 -0
  52. package/dist/client.d.ts.map +1 -1
  53. package/dist/client.js +35 -5
  54. package/dist/client.js.map +1 -1
  55. package/dist/index.d.ts +600 -3
  56. package/dist/index.js +622 -121
  57. package/dist/index.js.map +1 -1
  58. package/dist/index.mjs +622 -121
  59. package/dist/index.mjs.map +1 -1
  60. package/dist/project-rooms.d.ts +3 -0
  61. package/dist/project-rooms.d.ts.map +1 -1
  62. package/dist/project-rooms.js +1 -0
  63. package/dist/project-rooms.js.map +1 -1
  64. package/dist/runtime-client.d.ts.map +1 -1
  65. package/dist/runtime-client.js +2 -6
  66. package/dist/runtime-client.js.map +1 -1
  67. package/dist/types.d.ts +354 -2
  68. package/dist/types.d.ts.map +1 -1
  69. package/dist/types.js.map +1 -1
  70. package/package.json +9 -2
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _axiom_lattice_protocols from '@axiom-lattice/protocols';
2
- import { McpUiResourcePayload, CapabilityBundle, CapabilityPreview, AgentWebApp, Message, MessageChunk, DatabaseConfigEntry, MetricsServerConfigEntry, DataSource, McpServerConfigEntry, McpTool, LocalA2ATemplateDefinition, OpenGrant, TaskItem, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ModelProviderPublicEntry, CreateModelProviderRequest, UpdateModelProviderRequest, ModelProviderProbeRequest, ModelProviderProbeResult, ModelSelection, ModelDiscoveryResult, TenantModelCatalog, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, ConnectionEntry, CreateTaskRequest, UpdateTaskRequest, TaskWorkItem, LocalA2AProviderState, OpenCatalog, McpUiRef, CreateCapabilityBundleInput, UpdateCapabilityBundleInput, CreateAgentWebAppInput, UpdateAgentWebAppInput, Skill, CreateSkillRequest, CreateShareRequest, ShareResult, ShareRecord, ProjectRoom, ProjectRoomPublicMessage, ProjectMembership, ProjectBotMembership, ProjectRoomPublicMembership, ProjectRoomPublicBotMembership, ProjectRoomMention, ProjectHumanRole, ProjectBotRole, Project as Project$1, ProjectRoomEventScope, ToolCallUi } from '@axiom-lattice/protocols';
3
- export { AgentWebApp, AgentWebAppAppearance, AgentWebAppFeatures, AgentWebAppQuickPrompt, AgentWebAppScope, AgentWebAppStatus, CapabilityBundle, CapabilityPreview, CreateAgentWebAppInput, CreateCapabilityBundleInput, LocalA2AProviderId, LocalA2AProviderState, LocalA2AProviderStatus, LocalA2ATemplateDefinition, LocalRuntimeConfig, UpdateAgentWebAppInput, UpdateCapabilityBundleInput } from '@axiom-lattice/protocols';
2
+ import { McpUiResourcePayload, CapabilityBundle, CapabilityPreview, AgentWebApp, AgentInterrupt, Message, MessageChunk, DatabaseConfigEntry, MetricsServerConfigEntry, DataSource, McpServerConfigEntry, McpTool, LocalA2ATemplateDefinition, OpenGrant, TaskItem, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ModelProviderPublicEntry, CreateModelProviderRequest, UpdateModelProviderRequest, ModelProviderProbeRequest, ModelProviderProbeResult, ModelSelection, ModelDiscoveryResult, TenantModelCatalog, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, ConnectionEntry, CreateTaskRequest, UpdateTaskRequest, TaskWorkItem, ThreadCheckpointStorage, LocalA2AProviderState, OpenCatalog, McpUiRef, CreateCapabilityBundleInput, UpdateCapabilityBundleInput, CreateAgentWebAppInput, UpdateAgentWebAppInput, Skill, CreateSkillRequest, CreateShareRequest, ShareResult, ShareRecord, ProjectRoom, ProjectRoomPublicMessage, ProjectMembership, ProjectBotMembership, ProjectRoomPublicMembership, ProjectRoomPublicBotMembership, ProjectRoomMention, ProjectHumanRole, ProjectBotRole, Project as Project$1, ProjectRoomEventScope, ToolCallUi } from '@axiom-lattice/protocols';
3
+ export { AgentInterrupt, AgentWebApp, AgentWebAppAppearance, AgentWebAppFeatures, AgentWebAppQuickPrompt, AgentWebAppScope, AgentWebAppStatus, CapabilityBundle, CapabilityPreview, CreateAgentWebAppInput, CreateCapabilityBundleInput, LocalA2AProviderId, LocalA2AProviderState, LocalA2AProviderStatus, LocalA2ATemplateDefinition, LocalRuntimeConfig, ThreadCheckpointStorage, UpdateAgentWebAppInput, UpdateCapabilityBundleInput } from '@axiom-lattice/protocols';
4
4
 
5
5
  /** Resolved MCP App UI resource plus its ready-to-use CSP policy string. */
6
6
  interface McpUiResourceResponse extends McpUiResourcePayload {
@@ -116,6 +116,47 @@ interface CreateThreadOptions {
116
116
  * Optional metadata for the thread
117
117
  */
118
118
  metadata?: Record<string, any>;
119
+ /** Optional relative TTL in seconds. */
120
+ ttlSeconds?: number;
121
+ /** Optional absolute ISO expiry; ignored when ttlSeconds is supplied. */
122
+ expiresAt?: string;
123
+ /** Optional pre-populated graph state written at creation. */
124
+ supersteps?: ThreadSuperstepInput[];
125
+ }
126
+ /** One checkpoint update applied when creating a thread. */
127
+ interface ThreadSuperstepInput {
128
+ updates: Array<{
129
+ values: Record<string, unknown>;
130
+ as_node?: string;
131
+ }>;
132
+ }
133
+ /** Thread status and pending HITL interrupts. */
134
+ interface ThreadStatusInfo {
135
+ status: "idle" | "busy" | "interrupted" | "error";
136
+ pendingMessages: number;
137
+ interrupts: AgentInterrupt[];
138
+ }
139
+ /** One page of thread checkpoint history (newest first). */
140
+ interface ThreadHistoryPage {
141
+ history: unknown[];
142
+ }
143
+ /** Result of a thread copy operation. */
144
+ type CopiedThread = Thread;
145
+ /** Prune strategy input. */
146
+ interface PruneThreadInput {
147
+ strategy: "delete" | "keep_latest";
148
+ keep?: number;
149
+ }
150
+ /** Result of a thread prune operation. */
151
+ interface PruneThreadResult {
152
+ pruned: boolean;
153
+ strategy?: "delete" | "keep_latest";
154
+ keep?: number;
155
+ counts?: {
156
+ checkpoints: number;
157
+ blobs: number;
158
+ writes: number;
159
+ };
119
160
  }
120
161
  /**
121
162
  * Thread information
@@ -296,6 +337,13 @@ interface ResumeStreamOptions {
296
337
  * Polling interval in milliseconds (default: 100ms)
297
338
  */
298
339
  pollInterval?: number;
340
+ /**
341
+ * Last SSE event id received on a prior connection.
342
+ *
343
+ * Sent as `Last-Event-ID` so a shared/cursor-addressable chunk source resumes
344
+ * strictly after that record. Omit to position by message id.
345
+ */
346
+ lastEventId?: string;
299
347
  }
300
348
  /**
301
349
  * Thread list options
@@ -577,6 +625,306 @@ declare enum ScheduledTaskStatus {
577
625
  /**
578
626
  * Scheduled task definition
579
627
  */
628
+ /** Queue behavior for an Agent cron. */
629
+ type CronMultitaskStrategy = "enqueue" | "interrupt";
630
+ /** Completion behavior for a stateless Agent cron. */
631
+ type CronOnRunCompleted = "keep" | "delete";
632
+ /** Agent cron resource returned by the gateway. */
633
+ interface AgentCron {
634
+ cron_id: string;
635
+ thread_id?: string;
636
+ assistant_id: string;
637
+ /** Workspace scope captured when the cron was created. */
638
+ workspace_id?: string;
639
+ /** Project scope captured when the cron was created. */
640
+ project_id?: string;
641
+ schedule: string;
642
+ timezone: string;
643
+ end_time?: string;
644
+ next_run_date?: string;
645
+ enabled: boolean;
646
+ payload: Record<string, unknown>;
647
+ on_run_completed?: CronOnRunCompleted;
648
+ multitask_strategy: CronMultitaskStrategy;
649
+ created_at: string;
650
+ updated_at: string;
651
+ run_count: number;
652
+ status: string;
653
+ }
654
+ /** Shared create fields for thread and stateless crons. */
655
+ interface CreateCronInput {
656
+ schedule: string;
657
+ timezone?: string;
658
+ end_time?: string;
659
+ payload: {
660
+ input: Record<string, unknown>;
661
+ };
662
+ enabled?: boolean;
663
+ multitask_strategy?: CronMultitaskStrategy;
664
+ /** Workspace to bind to the scheduled runs. */
665
+ workspace_id?: string;
666
+ /** Project to bind to the scheduled runs. */
667
+ project_id?: string;
668
+ }
669
+ /** Create a cron bound to an existing thread. */
670
+ type CreateThreadCronInput = CreateCronInput;
671
+ /** Create a stateless cron that starts a fresh thread per fire. */
672
+ interface CreateStatelessCronInput extends CreateCronInput {
673
+ assistant_id: string;
674
+ on_run_completed?: CronOnRunCompleted;
675
+ }
676
+ /** Filters accepted by cron search/count. */
677
+ interface CronSearchFilters {
678
+ assistant_id?: string;
679
+ thread_id?: string;
680
+ enabled?: boolean;
681
+ limit?: number;
682
+ offset?: number;
683
+ }
684
+ /** Count filters accepted by the cron count endpoint. */
685
+ interface CronCountFilters {
686
+ assistant_id?: string;
687
+ thread_id?: string;
688
+ enabled?: boolean;
689
+ }
690
+ /** Patchable fields on an Agent cron (D1: enabled only). */
691
+ interface UpdateAgentCronInput {
692
+ enabled: boolean;
693
+ }
694
+ /** Structured Agent graph returned by `agent.getTree`. */
695
+ interface AgentGraphTree {
696
+ nodes: unknown[];
697
+ edges: unknown[];
698
+ mermaid: string;
699
+ namespaces: string[][];
700
+ }
701
+ /** Input payload accepted by the `run.start` thread command. */
702
+ interface CommandRunStartInput {
703
+ message?: string;
704
+ messages?: Array<{
705
+ role: string;
706
+ content: unknown;
707
+ }>;
708
+ id?: string;
709
+ }
710
+ /** Arguments for `run.start`. */
711
+ interface CommandRunStartArgs {
712
+ input: CommandRunStartInput;
713
+ config?: Record<string, unknown>;
714
+ metadata?: Record<string, unknown>;
715
+ multitask_strategy?: "enqueue" | "interrupt" | "collect";
716
+ }
717
+ /** Result of `run.start`. */
718
+ interface CommandRunStartResult {
719
+ messageId: string;
720
+ queued: boolean;
721
+ mode: string;
722
+ }
723
+ /** Arguments for `input.respond`. */
724
+ interface CommandInputRespondArgs {
725
+ interrupt_id: string;
726
+ response?: unknown;
727
+ answers?: unknown[];
728
+ resume?: Record<string, unknown>;
729
+ config?: Record<string, unknown>;
730
+ /** Server currently derives this from `interrupt_id`; accepted for forward compatibility. */
731
+ expected_interrupt_id?: string;
732
+ }
733
+ /** Result of `input.respond` (queue-first: the answer is accepted before it runs). */
734
+ interface CommandInputRespondResult {
735
+ messageId: string;
736
+ queued: boolean;
737
+ interruptId: string;
738
+ /** Present on queue-first responses; the answer was durably accepted. */
739
+ accepted?: boolean;
740
+ /** Present on queue-first responses; the queued command id. */
741
+ commandId?: string;
742
+ }
743
+ /** Input accepted by the single-run create API. */
744
+ interface RunCreateInput {
745
+ message?: string;
746
+ messages?: Array<{
747
+ role: string;
748
+ content: unknown;
749
+ }>;
750
+ id?: string;
751
+ }
752
+ /** Options accepted by the single-run create API. */
753
+ interface RunCreateOptions {
754
+ config?: Record<string, unknown>;
755
+ mode?: "followup" | "enqueue";
756
+ /** HITL resume command; mutually exclusive with `input`. */
757
+ command?: {
758
+ resume: unknown;
759
+ };
760
+ /**
761
+ * Behavior when the thread already has an active run. Defaults to `enqueue`.
762
+ *
763
+ * @remarks `reject` returns `409 RUN_REJECTED` without touching the active
764
+ * run; `interrupt` settles or interrupts exactly one active run, waits for it
765
+ * to become terminal, then creates the new pending run; `rollback` rewinds
766
+ * and deletes the active run first. `interrupt`/`rollback` return
767
+ * `409 MULTITASK_INTERRUPT_CONFLICT` / `409 MULTITASK_ROLLBACK_CONFLICT` when
768
+ * more than one run is active.
769
+ */
770
+ multitaskStrategy?: "enqueue" | "reject" | "interrupt" | "rollback";
771
+ }
772
+ /** Result of creating a single run (durable pending queue entry). */
773
+ interface RunCreateResult {
774
+ runId: string;
775
+ /** Present for input runs; command runs do not create a user message. */
776
+ messageId?: string;
777
+ status: "pending";
778
+ }
779
+ /** Safe, client-facing projection of a run ledger record. */
780
+ interface RunRecord {
781
+ runId: string;
782
+ status: AgentRunStatus;
783
+ /** Null while the run is pending. */
784
+ owner: string | null;
785
+ attempts: number;
786
+ error: string | null;
787
+ cancelRequested: boolean;
788
+ createdAt: number;
789
+ updatedAt: number;
790
+ /** Null while the run is pending. */
791
+ startedAt: number | null;
792
+ finishedAt: number | null;
793
+ }
794
+ /** Options for cancelling a run. */
795
+ interface RunCancelOptions {
796
+ /** Wait for the run to reach a terminal status (server caps the wait). */
797
+ wait?: boolean;
798
+ /**
799
+ * `interrupt` keeps the run and its checkpoints; `rollback` deletes the
800
+ * pending row or rewinds a running run's checkpoints and row.
801
+ */
802
+ action?: "interrupt" | "rollback";
803
+ }
804
+ /** Result of a run cancellation request. */
805
+ interface RunCancelResult {
806
+ success: boolean;
807
+ accepted: boolean;
808
+ /** `rolled_back` means the run row was deleted; no `run` is returned. */
809
+ status: AgentRunStatus | "requested" | "rolled_back";
810
+ terminal: boolean;
811
+ run?: RunRecord;
812
+ }
813
+ /** One projected thread event from the SSE event stream. */
814
+ interface ThreadEvent {
815
+ type: "event";
816
+ event_id: string;
817
+ seq: string;
818
+ method: string;
819
+ params: {
820
+ namespace: string[];
821
+ timestamp: number;
822
+ data: unknown;
823
+ node?: string;
824
+ };
825
+ }
826
+ /** Filters/resume cursor for the thread event stream. */
827
+ interface ThreadEventStreamOptions {
828
+ channels?: string[];
829
+ namespaces?: string[][];
830
+ depth?: number;
831
+ since?: string | number;
832
+ }
833
+ /** Error delivered to `streamThreadEvents` consumers. */
834
+ interface ThreadEventStreamError extends Error {
835
+ code?: string;
836
+ /** HTTP status for non-OK stream responses. */
837
+ status?: number;
838
+ /** Parsed JSON body for non-OK stream responses. */
839
+ responseBody?: unknown;
840
+ }
841
+ /** Public gateway identity, flags, capabilities, and endpoint paths. */
842
+ interface GatewayInfo {
843
+ service: "lattice-gateway";
844
+ version: string;
845
+ commit?: string;
846
+ startedAt: string;
847
+ uptimeSeconds: number;
848
+ flags: {
849
+ authRequired: boolean;
850
+ executionWorker: boolean;
851
+ chunkSource: "memory" | "redis";
852
+ multiReplica: boolean;
853
+ };
854
+ capabilities: {
855
+ a2a: boolean;
856
+ mcp: boolean;
857
+ store: boolean;
858
+ crons: boolean;
859
+ threadEvents: boolean;
860
+ threadEventsWebSocket: boolean;
861
+ metrics: boolean;
862
+ taskLifecycle: boolean;
863
+ };
864
+ endpoints: {
865
+ health: string;
866
+ metrics: string;
867
+ info: string;
868
+ mcp: string;
869
+ store: string;
870
+ threadEvents: string;
871
+ a2aAgentCard: string;
872
+ a2aJsonRpc: string;
873
+ };
874
+ metadata: {
875
+ deployment?: string;
876
+ };
877
+ }
878
+ /** Agent run lifecycle status exposed by `/metrics`. */
879
+ type AgentRunStatus = "pending" | "running" | "success" | "error" | "interrupted" | "cancelled" | "timeout";
880
+ /** Execution worker posture exposed by `/metrics`. */
881
+ interface SystemMetricsWorker {
882
+ enabled: boolean;
883
+ started?: boolean;
884
+ inFlight?: number;
885
+ maxConcurrentThreads?: number;
886
+ scanIntervalMs?: number;
887
+ }
888
+ /** Chunk stream posture exposed by `/metrics`. */
889
+ interface SystemMetricsChunk {
890
+ source: "memory" | "redis";
891
+ ttlMs: number;
892
+ maxLen: number;
893
+ }
894
+ /** Point-in-time gateway posture returned by `/metrics?format=json`. */
895
+ interface SystemMetrics {
896
+ replicaId: string;
897
+ uptimeSeconds: number;
898
+ agentRuns?: Record<AgentRunStatus, number>;
899
+ pendingThreads?: number;
900
+ worker: SystemMetricsWorker;
901
+ chunk: SystemMetricsChunk;
902
+ }
903
+ /** Tenant-scoped namespaced store item. */
904
+ interface StoreItem {
905
+ namespace: string[];
906
+ key: string;
907
+ value: Record<string, unknown>;
908
+ createdAt: string;
909
+ updatedAt: string;
910
+ expiresAt?: string;
911
+ }
912
+ /** Create/replace input for a store item. */
913
+ interface StorePutInput {
914
+ namespace: string[];
915
+ key: string;
916
+ value: Record<string, unknown>;
917
+ ttlMinutes?: number;
918
+ index?: boolean | string[];
919
+ }
920
+ /** Search input for the tenant store. */
921
+ interface StoreSearchInput {
922
+ namespacePrefix?: string[];
923
+ filter?: Record<string, unknown>;
924
+ query?: string;
925
+ limit?: number;
926
+ offset?: number;
927
+ }
580
928
  interface ScheduledTask {
581
929
  /**
582
930
  * Unique task identifier
@@ -940,6 +1288,10 @@ interface KeyExposure {
940
1288
  assistantId: string;
941
1289
  cardUrl: string;
942
1290
  jsonrpcUrl: string;
1291
+ /** A2A 1.0 Agent Card endpoint (same credential as the 0.3 endpoint). */
1292
+ v1CardUrl?: string;
1293
+ /** A2A 1.0 JSON-RPC endpoint. */
1294
+ v1JsonrpcUrl?: string;
943
1295
  card: Record<string, unknown>;
944
1296
  }>;
945
1297
  };
@@ -1237,6 +1589,27 @@ declare abstract class AbstractClient {
1237
1589
  * @returns A new client instance with the same configuration and state
1238
1590
  */
1239
1591
  clone(overrides?: Partial<ClientConfig>): AbstractClient;
1592
+ /**
1593
+ * Headers for thread event SSE requests. Concrete clients may add live
1594
+ * tenant/workspace/auth state.
1595
+ *
1596
+ * @returns Request headers.
1597
+ */
1598
+ protected getThreadEventHeaders(): Record<string, string>;
1599
+ /**
1600
+ * Stream thread-wide projected events over SSE.
1601
+ *
1602
+ * The caller owns reconnection: pass the last `event.seq` as `since`.
1603
+ * There is no automatic retry. Browser WebSocket auth is not covered here;
1604
+ * this SSE path uses `fetch` and the normal Authorization headers.
1605
+ *
1606
+ * @param threadId - Thread id.
1607
+ * @param options - Channel/namespace/depth filters and resume cursor.
1608
+ * @param onEvent - Callback for each projected event.
1609
+ * @param onError - Callback for stream/cursor errors (stream stops).
1610
+ * @returns Abort function.
1611
+ */
1612
+ streamThreadEvents(threadId: string, options: ThreadEventStreamOptions, onEvent: (event: ThreadEvent) => void, onError?: (error: ThreadEventStreamError) => void): () => void;
1240
1613
  /**
1241
1614
  * Abstract method for making API requests
1242
1615
  * To be implemented by concrete client classes
@@ -1282,6 +1655,58 @@ declare abstract class AbstractClient {
1282
1655
  * @returns A promise that resolves to an array of threads
1283
1656
  */
1284
1657
  listThreads(options?: ListThreadsOptions): Promise<Thread[]>;
1658
+ /**
1659
+ * Reads a thread's run status, pending message count, and interrupts.
1660
+ * @param threadId - Thread identifier.
1661
+ * @returns Thread status projection.
1662
+ */
1663
+ getThreadStatus(threadId: string): Promise<ThreadStatusInfo>;
1664
+ /**
1665
+ * Reads a page of thread checkpoint history.
1666
+ * @param threadId - Thread identifier.
1667
+ * @param options - Optional limit and before-checkpoint cursor.
1668
+ * @returns Checkpoint snapshots, newest first.
1669
+ */
1670
+ getThreadHistory(threadId: string, options?: {
1671
+ limit?: number;
1672
+ before?: string;
1673
+ }): Promise<unknown[]>;
1674
+ /**
1675
+ * Reads the raw snapshot at one checkpoint.
1676
+ * @param threadId - Thread identifier.
1677
+ * @param checkpointId - Checkpoint identifier.
1678
+ * @returns The raw checkpoint snapshot.
1679
+ */
1680
+ getThreadStateAtCheckpoint(threadId: string, checkpointId: string): Promise<unknown>;
1681
+ /**
1682
+ * Reads checkpoint storage accounting for a thread.
1683
+ * @param threadId - Thread identifier.
1684
+ * @returns Storage byte/count projection.
1685
+ */
1686
+ getThreadStorage(threadId: string): Promise<ThreadCheckpointStorage>;
1687
+ /**
1688
+ * Copies a thread's checkpoints and row into a new thread.
1689
+ * @param threadId - Source thread identifier.
1690
+ * @returns The created thread.
1691
+ */
1692
+ copyThread(threadId: string): Promise<CopiedThread>;
1693
+ /**
1694
+ * Prunes a thread's checkpoints or deletes the thread.
1695
+ * @param threadId - Thread identifier.
1696
+ * @param input - Prune strategy and optional keep count.
1697
+ * @returns Prune result.
1698
+ */
1699
+ pruneThread(threadId: string, input: PruneThreadInput): Promise<PruneThreadResult>;
1700
+ /**
1701
+ * Reads the public gateway info surface.
1702
+ * @returns Service identity, flags, capabilities, endpoints, and metadata.
1703
+ */
1704
+ getInfo(): Promise<GatewayInfo>;
1705
+ /**
1706
+ * Reads the current gateway replica's runtime metrics.
1707
+ * @returns Run counts, pending threads, worker posture, and chunk posture.
1708
+ */
1709
+ getSystemMetrics(): Promise<SystemMetrics>;
1285
1710
  /**
1286
1711
  * Deletes a thread
1287
1712
  * @deprecated Use threads.delete() instead
@@ -1332,6 +1757,7 @@ declare abstract class AbstractClient {
1332
1757
  sendBackground: (options: ChatSendOptions) => Promise<{
1333
1758
  messageId: string;
1334
1759
  queued: boolean;
1760
+ runId?: string;
1335
1761
  }>;
1336
1762
  /**
1337
1763
  * Sends a message to a thread and streams the response
@@ -1832,6 +2258,165 @@ declare abstract class AbstractClient {
1832
2258
  */
1833
2259
  resume: (taskId: string) => Promise<boolean>;
1834
2260
  };
2261
+ /**
2262
+ * Agent cron resources (`/api/runs/crons` and thread-bound crons).
2263
+ */
2264
+ crons: {
2265
+ /**
2266
+ * Creates a cron bound to an existing thread.
2267
+ * @param threadId - Thread that receives follow-up runs.
2268
+ * @param body - Cron definition.
2269
+ * @returns The created cron.
2270
+ */
2271
+ createForThread: (threadId: string, body: CreateThreadCronInput) => Promise<AgentCron>;
2272
+ /**
2273
+ * Creates a stateless cron that starts a fresh thread per fire.
2274
+ * @param body - Cron definition including the assistant id.
2275
+ * @returns The created cron.
2276
+ */
2277
+ createStateless: (body: CreateStatelessCronInput) => Promise<AgentCron>;
2278
+ /**
2279
+ * Searches tenant-scoped Agent crons.
2280
+ * @param body - Optional assistant/thread/enabled/pagination filters.
2281
+ * @returns Matching crons.
2282
+ */
2283
+ search: (body?: CronSearchFilters) => Promise<AgentCron[]>;
2284
+ /**
2285
+ * Counts tenant-scoped Agent crons.
2286
+ * @param body - Optional assistant/thread/enabled filters.
2287
+ * @returns Matching cron count.
2288
+ */
2289
+ count: (body?: CronCountFilters) => Promise<number>;
2290
+ /**
2291
+ * Reads one Agent cron.
2292
+ * @param cronId - Cron id.
2293
+ * @returns The cron resource.
2294
+ */
2295
+ get: (cronId: string) => Promise<AgentCron>;
2296
+ /**
2297
+ * Pauses or resumes a cron.
2298
+ * @param cronId - Cron id.
2299
+ * @param enabled - Desired enabled state.
2300
+ * @returns The updated cron.
2301
+ */
2302
+ updateEnabled: (cronId: string, enabled: boolean) => Promise<AgentCron>;
2303
+ /**
2304
+ * Cancels/deletes a cron.
2305
+ * @param cronId - Cron id.
2306
+ * @returns True when the gateway reports success.
2307
+ */
2308
+ delete: (cronId: string) => Promise<boolean>;
2309
+ };
2310
+ /**
2311
+ * Thread command surface (`run.start`, `input.respond`, `agent.getTree`).
2312
+ */
2313
+ commands: {
2314
+ /**
2315
+ * Starts a run on a thread.
2316
+ * @param threadId - Thread id.
2317
+ * @param args - Input/config/metadata/strategy.
2318
+ * @returns Queued message id and mode.
2319
+ */
2320
+ runStart: (threadId: string, args: CommandRunStartArgs) => Promise<CommandRunStartResult>;
2321
+ /**
2322
+ * Answers a pending interrupt.
2323
+ * @param threadId - Thread id.
2324
+ * @param args - Interrupt id and response/resume payload.
2325
+ * @returns Queued message id and interrupt id.
2326
+ */
2327
+ respond: (threadId: string, args: CommandInputRespondArgs) => Promise<CommandInputRespondResult>;
2328
+ /**
2329
+ * Reads the structured Agent graph.
2330
+ * @param threadId - Thread id.
2331
+ * @returns Nodes, edges, Mermaid, and namespace placeholder.
2332
+ */
2333
+ getTree: (threadId: string) => Promise<AgentGraphTree>;
2334
+ };
2335
+ /**
2336
+ * Single-run surface (`POST/GET /threads/:id/runs`, cancellation).
2337
+ */
2338
+ runs: {
2339
+ /**
2340
+ * Enqueues one run-bound input or HITL resume command.
2341
+ * @param threadId - Thread id.
2342
+ * @param input - Message or messages accepted by the run API; omit for command runs.
2343
+ * @param options - Optional config, mode, command, and multitask strategy.
2344
+ * @param assistantId - Assistant id override (defaults to the client's).
2345
+ * @returns Pending run id and the optional input message id.
2346
+ */
2347
+ create: (threadId: string, input: RunCreateInput | undefined, options?: RunCreateOptions, assistantId?: string) => Promise<RunCreateResult>;
2348
+ /**
2349
+ * Lists run ledger records for a thread.
2350
+ * @param threadId - Thread id.
2351
+ * @param assistantId - Assistant id override (defaults to the client's).
2352
+ * @returns Safe run records.
2353
+ */
2354
+ list: (threadId: string, assistantId?: string) => Promise<RunRecord[]>;
2355
+ /**
2356
+ * Reads one run ledger record.
2357
+ * @param threadId - Thread id.
2358
+ * @param runId - Run id.
2359
+ * @param assistantId - Assistant id override (defaults to the client's).
2360
+ * @returns The safe run record.
2361
+ */
2362
+ get: (threadId: string, runId: string, assistantId?: string) => Promise<RunRecord>;
2363
+ /**
2364
+ * Waits for a run to reach a terminal status (server-capped).
2365
+ * @param threadId - Thread id.
2366
+ * @param runId - Run id.
2367
+ * @param assistantId - Assistant id override (defaults to the client's).
2368
+ * @returns The terminal run record.
2369
+ * @throws {ApiError} On `504 RUN_JOIN_TIMEOUT` or `404 RUN_NOT_FOUND`.
2370
+ */
2371
+ join: (threadId: string, runId: string, assistantId?: string) => Promise<RunRecord>;
2372
+ /**
2373
+ * Requests cancellation of one run.
2374
+ * @param threadId - Thread id.
2375
+ * @param runId - Run id.
2376
+ * @param options - Optional `wait` and `action` (`interrupt` or `rollback`).
2377
+ * @param assistantId - Assistant id override (defaults to the client's).
2378
+ * @returns Acceptance, terminal status, and optional latest run.
2379
+ */
2380
+ cancel: (threadId: string, runId: string, options?: RunCancelOptions, assistantId?: string) => Promise<RunCancelResult>;
2381
+ };
2382
+ /**
2383
+ * Tenant-scoped namespaced key-value store (viewer/editor surface).
2384
+ */
2385
+ store: {
2386
+ /**
2387
+ * Creates or replaces a store item.
2388
+ * @param input - Namespace, key, value, optional TTL/index hint.
2389
+ * @returns The persisted item.
2390
+ */
2391
+ put: (input: StorePutInput) => Promise<StoreItem>;
2392
+ /**
2393
+ * Reads one item by namespace and key.
2394
+ * @param namespace - Namespace path.
2395
+ * @param key - Item key.
2396
+ * @returns The item.
2397
+ */
2398
+ get: (namespace: string[], key: string) => Promise<StoreItem>;
2399
+ /**
2400
+ * Deletes one item.
2401
+ * @param namespace - Namespace path.
2402
+ * @param key - Item key.
2403
+ * @returns True when deleted.
2404
+ */
2405
+ delete: (namespace: string[], key: string) => Promise<boolean>;
2406
+ /**
2407
+ * Searches items under a namespace prefix.
2408
+ * @param input - Prefix/filter/query/pagination.
2409
+ * @returns Matching items.
2410
+ */
2411
+ search: (input?: StoreSearchInput) => Promise<StoreItem[]>;
2412
+ /**
2413
+ * Lists distinct namespace paths.
2414
+ * @param prefix - Optional namespace prefix.
2415
+ * @param limit - Optional result cap (gateway clamps).
2416
+ * @returns Namespace paths.
2417
+ */
2418
+ namespaces: (prefix?: string[], limit?: number) => Promise<string[][]>;
2419
+ };
1835
2420
  }
1836
2421
 
1837
2422
  /**
@@ -2080,15 +2665,18 @@ type ResumeProjectRoomInterruptInput = {
2080
2665
  kind: "presence";
2081
2666
  membershipId: string;
2082
2667
  };
2668
+ interruptId?: string;
2083
2669
  answers?: ProjectRoomInterruptAnswerInput[];
2084
2670
  } | {
2085
2671
  ref: {
2086
2672
  kind: "task";
2087
2673
  taskId: string;
2088
2674
  };
2675
+ interruptId?: string;
2089
2676
  answers?: ProjectRoomInterruptAnswerInput[];
2090
2677
  } | {
2091
2678
  membershipId: string;
2679
+ interruptId?: string;
2092
2680
  answers?: ProjectRoomInterruptAnswerInput[];
2093
2681
  };
2094
2682
  type HeadersGetter$1 = () => Record<string, string>;
@@ -2279,6 +2867,8 @@ declare class RoomEventsClient {
2279
2867
  */
2280
2868
  declare class Client extends AbstractClient {
2281
2869
  private headers;
2870
+ /** Last SSE event id observed per thread, for automatic resume. */
2871
+ private resumeEventIds;
2282
2872
  resources: ResourcesClient;
2283
2873
  exportImport: ExportImportClient;
2284
2874
  readonly projectRooms: ProjectRoomsClient;
@@ -2326,6 +2916,12 @@ declare class Client extends AbstractClient {
2326
2916
  * Get workspace headers for THIS instance (merged with global fallback)
2327
2917
  */
2328
2918
  getWorkspaceHeaders(): Record<string, string>;
2919
+ /**
2920
+ * Instance-only workspace headers (never merged with the process-global
2921
+ * Console context). Runtime transports use this so a web-app scope cannot
2922
+ * inherit a Console tenant/project selection from another client.
2923
+ */
2924
+ getInstanceWorkspaceHeaders(): Record<string, string>;
2329
2925
  /**
2330
2926
  * Get global workspace headers (legacy static API)
2331
2927
  */
@@ -2384,6 +2980,7 @@ declare class Client extends AbstractClient {
2384
2980
  * @private
2385
2981
  */
2386
2982
  protected getAllHeaders(): Record<string, string>;
2983
+ protected getThreadEventHeaders(): Record<string, string>;
2387
2984
  protected bodyAffinityHeaders(body: unknown): Record<string, string>;
2388
2985
  private streamRun;
2389
2986
  }
@@ -2658,4 +3255,4 @@ declare function normalizeToolResult(message: {
2658
3255
  artifact?: unknown;
2659
3256
  }): NormalizedToolResult;
2660
3257
 
2661
- export { A2AKeyListItem, A2AKeysListResponse, AbortAgentParams, AbstractClient, AddProjectBotMembershipInput, AddProjectMembershipInput, AgentState, AgentWebAppsListResponse, ApiError, ArchiveInput, Assistant, AssistantListResponse, AssistantResponse, AuthenticationError, CapabilityBundleListResponse, ChatResponse, ChatSendOptions, ChatStreamOptions, Client, ClientConfig, CompleteTaskInput, CompleteTaskResponse, CreateA2AKeyInput, CreateAssistantOptions, CreateProjectRequest, CreateThreadOptions, CreateWorkspaceRequest, DatabaseConfigResponse, DatabaseConfigsListResponse, DatasourcesListResponse, ExportBundle, ExportConfigResult, ExportConfirmationRequired, ExportDownload, ExportEntityIds, ExportEntityPreview, ExportEntityPreviewMap, ExportImportClient, ExportableEntity, ExportableTypeInfo, FileItem, GetMessagesOptions, GetScheduledTasksOptions, ImportApplyResult, ImportConflict, ImportEntityResult, ImportInsertion, ImportPreviewError, ImportPreviewResult, ImportResolution, ImportResolutions, ImportSource, InvalidCapabilityBundleSummary, KeyExposure, ListAgentWebAppsParams, ListProjectRoomMessagesOptions, ListThreadsOptions, LocalA2ATemplatesListResponse, McpServerResponse, McpServersListResponse, McpUiResourceResponse, MetricsConfigResponse, MetricsConfigsListResponse, MutationExpectedUpdatedAt, NetworkError, NormalizedToolResult, OpenAuditLogRecord, PendingMessage, Project, ProjectCapabilitiesResponse, ProjectKind, ProjectRecord, ProjectRoomBotRecord, ProjectRoomClientError, ProjectRoomDispatchErrorCode, ProjectRoomDispatchResult, ProjectRoomInterruptAnswerInput, ProjectRoomMembershipRecord, ProjectRoomMessageRecord, ProjectRoomPublicBotRecord, ProjectRoomPublicMembershipRecord, ProjectRoomRecord, ProjectRoomSendResult, ProjectRoomsClient, RegisterToolOptions, RemovePendingMessageOptions, ResourcesClient, ResumeProjectRoomInterruptInput, ResumeStreamOptions, RetryConfig, RoomEventScopeRecord, RoomEventsClient, RunOptions, RuntimeAxiomClient, RuntimeAxiomIdentity, ScheduleExecutionType, ScheduledTask, ScheduledTaskStatus, ScheduledTasksListResponse, SendProjectRoomMessageInput, StorageType, StreamCallbacks, StreamEvent, TaskCommandInput, TaskCommandResponse, TaskLifecycleWarning, TaskResponse, TasksListResponse, TestConnectionResponse, TestMcpServerResponse, Thread, ThreadListResponse, ThreadResponse, Tool, ToolResponse, ToolsListResponse, Transport, UpdateAssistantOptions, UpdateProjectBotMembershipInput, UpdateProjectMembershipInput, UpdateProjectRequest, UpdateThreadOptions, UpdateWorkspaceRequest, WeChatClient, Workspace, WorkspaceClient, WorkspaceMemberRecord, WorkspaceMembersClient, WorkspaceRoomBusinessEvent, WorkspaceRoomControlEvent, WorkspaceRoomEntryRecord, WorkspaceRoomEventConnection, WorkspaceRoomEventFrame, WorkspaceRoomKnownBusinessEvent, WorkspaceRoomUnknownBusinessEvent, WorkspaceRoomsClient, createSimpleMessageMerger, normalizeToolResult };
3258
+ export { A2AKeyListItem, A2AKeysListResponse, AbortAgentParams, AbstractClient, AddProjectBotMembershipInput, AddProjectMembershipInput, AgentCron, AgentGraphTree, AgentRunStatus, AgentState, AgentWebAppsListResponse, ApiError, ArchiveInput, Assistant, AssistantListResponse, AssistantResponse, AuthenticationError, CapabilityBundleListResponse, ChatResponse, ChatSendOptions, ChatStreamOptions, Client, ClientConfig, CommandInputRespondArgs, CommandInputRespondResult, CommandRunStartArgs, CommandRunStartInput, CommandRunStartResult, CompleteTaskInput, CompleteTaskResponse, CopiedThread, CreateA2AKeyInput, CreateAssistantOptions, CreateCronInput, CreateProjectRequest, CreateStatelessCronInput, CreateThreadCronInput, CreateThreadOptions, CreateWorkspaceRequest, CronCountFilters, CronMultitaskStrategy, CronOnRunCompleted, CronSearchFilters, DatabaseConfigResponse, DatabaseConfigsListResponse, DatasourcesListResponse, ExportBundle, ExportConfigResult, ExportConfirmationRequired, ExportDownload, ExportEntityIds, ExportEntityPreview, ExportEntityPreviewMap, ExportImportClient, ExportableEntity, ExportableTypeInfo, FileItem, GatewayInfo, GetMessagesOptions, GetScheduledTasksOptions, ImportApplyResult, ImportConflict, ImportEntityResult, ImportInsertion, ImportPreviewError, ImportPreviewResult, ImportResolution, ImportResolutions, ImportSource, InvalidCapabilityBundleSummary, KeyExposure, ListAgentWebAppsParams, ListProjectRoomMessagesOptions, ListThreadsOptions, LocalA2ATemplatesListResponse, McpServerResponse, McpServersListResponse, McpUiResourceResponse, MetricsConfigResponse, MetricsConfigsListResponse, MutationExpectedUpdatedAt, NetworkError, NormalizedToolResult, OpenAuditLogRecord, PendingMessage, Project, ProjectCapabilitiesResponse, ProjectKind, ProjectRecord, ProjectRoomBotRecord, ProjectRoomClientError, ProjectRoomDispatchErrorCode, ProjectRoomDispatchResult, ProjectRoomInterruptAnswerInput, ProjectRoomMembershipRecord, ProjectRoomMessageRecord, ProjectRoomPublicBotRecord, ProjectRoomPublicMembershipRecord, ProjectRoomRecord, ProjectRoomSendResult, ProjectRoomsClient, PruneThreadInput, PruneThreadResult, RegisterToolOptions, RemovePendingMessageOptions, ResourcesClient, ResumeProjectRoomInterruptInput, ResumeStreamOptions, RetryConfig, RoomEventScopeRecord, RoomEventsClient, RunCancelOptions, RunCancelResult, RunCreateInput, RunCreateOptions, RunCreateResult, RunOptions, RunRecord, RuntimeAxiomClient, RuntimeAxiomIdentity, ScheduleExecutionType, ScheduledTask, ScheduledTaskStatus, ScheduledTasksListResponse, SendProjectRoomMessageInput, StorageType, StoreItem, StorePutInput, StoreSearchInput, StreamCallbacks, StreamEvent, SystemMetrics, SystemMetricsChunk, SystemMetricsWorker, TaskCommandInput, TaskCommandResponse, TaskLifecycleWarning, TaskResponse, TasksListResponse, TestConnectionResponse, TestMcpServerResponse, Thread, ThreadEvent, ThreadEventStreamError, ThreadEventStreamOptions, ThreadHistoryPage, ThreadListResponse, ThreadResponse, ThreadStatusInfo, ThreadSuperstepInput, Tool, ToolResponse, ToolsListResponse, Transport, UpdateAgentCronInput, UpdateAssistantOptions, UpdateProjectBotMembershipInput, UpdateProjectMembershipInput, UpdateProjectRequest, UpdateThreadOptions, UpdateWorkspaceRequest, WeChatClient, Workspace, WorkspaceClient, WorkspaceMemberRecord, WorkspaceMembersClient, WorkspaceRoomBusinessEvent, WorkspaceRoomControlEvent, WorkspaceRoomEntryRecord, WorkspaceRoomEventConnection, WorkspaceRoomEventFrame, WorkspaceRoomKnownBusinessEvent, WorkspaceRoomUnknownBusinessEvent, WorkspaceRoomsClient, createSimpleMessageMerger, normalizeToolResult };