@blazingagents/sdk 0.3.0 → 0.5.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/README.md CHANGED
@@ -158,3 +158,14 @@ client.agent({ agentId }).skills.list({ abortSignal: signal });
158
158
 
159
159
  `ResourceRequestOptions` replaces `ResourceReadOptions`. Cancellation stops the
160
160
  request; it does not roll back a mutation already accepted by the server.
161
+
162
+ ## Interactive resend
163
+
164
+ Successful interactive exchanges are saved together. Failed or canceled execution
165
+ leaves saved history unchanged, including the previous answer during regeneration;
166
+ executed usage and Tool effects remain. Retain submitted text/images until success
167
+ and resend edited or unchanged input through ordinary chat with a fresh message ID.
168
+ Stop requests cancellation; a lost response can hide a saved exchange. Reuse the
169
+ returned Session ID and load history normally on return. No outcome polling or
170
+ automatic generation retry is needed. See the [chatbot guide](https://docs.blazingagents.com/getting-started/chatbot)
171
+ and [working examples](https://github.com/blazingagents/examples).
@@ -29,6 +29,49 @@ export declare const sessionsListResponseSchema: z.ZodObject<{
29
29
  }, z.core.$strip>>;
30
30
  nextCursor: z.ZodNullable<z.ZodString>;
31
31
  }, z.core.$strip>;
32
+ /**
33
+ * `GET /v1/sessions/latest` list item — one per Agent: the Agent's most
34
+ * recently updated Session (optionally among one end user's Sessions).
35
+ * Carries `agentId` and the Agent's current model, Thinking level, and status,
36
+ * independently of the Session's pinned Version.
37
+ */
38
+ export declare const latestSessionListItemSchema: z.ZodObject<{
39
+ agentVersion: z.ZodNullable<z.ZodNumber>;
40
+ id: z.ZodString;
41
+ messageCount: z.ZodNumber;
42
+ lastMessagePreview: z.ZodNullable<z.ZodString>;
43
+ userId: z.ZodString;
44
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
45
+ createdAt: z.ZodISODateTime;
46
+ updatedAt: z.ZodISODateTime;
47
+ agentId: z.ZodString;
48
+ model: z.ZodNullable<z.ZodString>;
49
+ thinkingLevel: z.ZodNullable<z.ZodString>;
50
+ status: z.ZodEnum<{
51
+ active: "active";
52
+ disabled: "disabled";
53
+ }>;
54
+ }, z.core.$strip>;
55
+ export declare const latestSessionsListResponseSchema: z.ZodObject<{
56
+ data: z.ZodArray<z.ZodObject<{
57
+ agentVersion: z.ZodNullable<z.ZodNumber>;
58
+ id: z.ZodString;
59
+ messageCount: z.ZodNumber;
60
+ lastMessagePreview: z.ZodNullable<z.ZodString>;
61
+ userId: z.ZodString;
62
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
63
+ createdAt: z.ZodISODateTime;
64
+ updatedAt: z.ZodISODateTime;
65
+ agentId: z.ZodString;
66
+ model: z.ZodNullable<z.ZodString>;
67
+ thinkingLevel: z.ZodNullable<z.ZodString>;
68
+ status: z.ZodEnum<{
69
+ active: "active";
70
+ disabled: "disabled";
71
+ }>;
72
+ }, z.core.$strip>>;
73
+ nextCursor: z.ZodNullable<z.ZodString>;
74
+ }, z.core.$strip>;
32
75
  /**
33
76
  * `GET /v1/agents/{agentId}/sessions/{sessionId}/messages` — transcript as
34
77
  * `UIMessage[]` verbatim, paginated backwards (newest page first) with an
@@ -146,6 +189,8 @@ export declare const toolApprovalDecisionResponseSchema: z.ZodObject<{
146
189
  }, z.core.$strip>;
147
190
  export type SessionListItem = z.infer<typeof sessionListItemSchema>;
148
191
  export type SessionsListResponse = z.infer<typeof sessionsListResponseSchema>;
192
+ export type LatestSessionListItem = z.infer<typeof latestSessionListItemSchema>;
193
+ export type LatestSessionsListResponse = z.infer<typeof latestSessionsListResponseSchema>;
149
194
  export type SessionMessage = z.infer<typeof sessionMessageSchema>;
150
195
  export type SessionMessagesResponse = z.infer<typeof sessionMessagesResponseSchema>;
151
196
  export type SessionMessagesQuery = z.infer<typeof sessionMessagesQuerySchema>;
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { paginatedResponseSchema } from "../api.js";
3
- import { sessionIdSchema } from "../ids.js";
3
+ import { agentIdSchema, sessionIdSchema } from "../ids.js";
4
4
  import { DEFAULT_SESSION_MESSAGES_LIMIT, MAX_SESSION_MESSAGES_LIMIT, } from "../limitations.js";
5
- import { agentVersionNumberSchema } from "./agents.js";
5
+ import { agentSchema, agentVersionNumberSchema } from "./agents.js";
6
6
  import { metadataSchema, userIdSchema } from "./attribution.js";
7
7
  /**
8
8
  * `GET /v1/agents/{agentId}/sessions` list item — the public wire shape:
@@ -24,6 +24,21 @@ export const sessionListItemSchema = z
24
24
  })
25
25
  .strip();
26
26
  export const sessionsListResponseSchema = paginatedResponseSchema(sessionListItemSchema);
27
+ /**
28
+ * `GET /v1/sessions/latest` list item — one per Agent: the Agent's most
29
+ * recently updated Session (optionally among one end user's Sessions).
30
+ * Carries `agentId` and the Agent's current model, Thinking level, and status,
31
+ * independently of the Session's pinned Version.
32
+ */
33
+ export const latestSessionListItemSchema = sessionListItemSchema
34
+ .extend({
35
+ agentId: agentIdSchema,
36
+ model: agentSchema.shape.model,
37
+ thinkingLevel: agentSchema.shape.thinkingLevel,
38
+ status: agentSchema.shape.status,
39
+ })
40
+ .strip();
41
+ export const latestSessionsListResponseSchema = paginatedResponseSchema(latestSessionListItemSchema);
27
42
  /**
28
43
  * `GET /v1/agents/{agentId}/sessions/{sessionId}/messages` — transcript as
29
44
  * `UIMessage[]` verbatim, paginated backwards (newest page first) with an
@@ -10,7 +10,7 @@ export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchem
10
10
  export { createPromptBodySchema, promptResponseSchema, promptSchema, promptsResponseSchema, updatePromptBodySchema, } from "./entities/prompts.ts";
11
11
  export { createProviderBodySchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.ts";
12
12
  export type { ToolApprovalDecisionResponse, ToolApprovalsResponse, } from "./entities/sessions.ts";
13
- export { decideToolApprovalBodySchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.ts";
13
+ export { decideToolApprovalBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.ts";
14
14
  export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.ts";
15
15
  export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskListItemSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleKindSchema, taskSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.ts";
16
16
  export { quotaSchema, subscriptionStatusSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.ts";
@@ -9,7 +9,7 @@ export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema,
9
9
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.js";
10
10
  export { createPromptBodySchema, promptResponseSchema, promptSchema, promptsResponseSchema, updatePromptBodySchema, } from "./entities/prompts.js";
11
11
  export { createProviderBodySchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.js";
12
- export { decideToolApprovalBodySchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.js";
12
+ export { decideToolApprovalBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.js";
13
13
  export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.js";
14
14
  export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskListItemSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleKindSchema, taskSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.js";
15
15
  export { quotaSchema, subscriptionStatusSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.js";
package/dist/index.d.ts CHANGED
@@ -18,4 +18,4 @@ export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetw
18
18
  export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransportOptions, } from "./direct-chat-transport.ts";
19
19
  export { BlazingAgentsError } from "./errors.ts";
20
20
  export { createChatRelay, createCompletionRelay, type RelayContext, type SessionOwnershipStore, } from "./relay.ts";
21
- export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, McpConnectionsResource, MemoriesListOptions, MemoriesResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
21
+ export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
@@ -1,4 +1,4 @@
1
- import { sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalDecisionResponseSchema, toolApprovalsResponseSchema, } from "../contracts/entities/sessions.js";
1
+ import { latestSessionsListResponseSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalDecisionResponseSchema, toolApprovalsResponseSchema, } from "../contracts/entities/sessions.js";
2
2
  import { buildTerminalStreamResult } from "../generation.js";
3
3
  import { requestJson, requestStream } from "../http.js";
4
4
  /**
@@ -27,6 +27,17 @@ export function createSessionsResource(config) {
27
27
  },
28
28
  }, sessionsListResponseSchema);
29
29
  },
30
+ async listLatest(options = {}) {
31
+ return await requestJson(config, "/v1/sessions/latest", {
32
+ signal: options.abortSignal,
33
+ query: {
34
+ cursor: options.cursor,
35
+ limit: options.limit,
36
+ // Stryker disable next-line ConditionalExpression: URL serialization omits an undefined query value.
37
+ ...(options.userId === undefined ? {} : { userId: options.userId }),
38
+ },
39
+ }, latestSessionsListResponseSchema);
40
+ },
30
41
  async messages({ agentId, sessionId, ...options }) {
31
42
  return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/messages`, {
32
43
  signal: options.abortSignal,
package/dist/types.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResp
7
7
  import type { CreateMemoryBody, MemoriesListResponse, MemoryResponse, UpdateMemoryBody } from "./contracts/entities/memories.ts";
8
8
  import type { CreatePromptBody, PromptResponse, PromptsResponse, UpdatePromptBody } from "./contracts/entities/prompts.ts";
9
9
  import type { CreateProviderBody, DeleteProviderOptions, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ThinkingLevelsResponse, UpdateProviderBody } from "./contracts/entities/providers.ts";
10
- import type { DecideToolApprovalBody, SessionMessagesResponse, SessionsListResponse, ToolApprovalDecisionResponse, ToolApprovalsResponse } from "./contracts/entities/sessions.ts";
10
+ import type { DecideToolApprovalBody, LatestSessionsListResponse, SessionMessagesResponse, SessionsListResponse, ToolApprovalDecisionResponse, ToolApprovalsResponse } from "./contracts/entities/sessions.ts";
11
11
  import type { CreateSkillBody, SkillArchiveType, SkillCopyResults, SkillDetail, SkillsListResponse } from "./contracts/entities/skills.ts";
12
12
  import type { CreateTaskBody, CreateTaskResponse, CreateTaskRunBody, CreateTaskRunResponse, TaskResponse, TaskRunMessagesResponse, TaskRunResponse, TaskRunsListResponse, TasksListResponse, UpdateTaskBody } from "./contracts/entities/tasks.ts";
13
13
  import type { TenantSettingsResponse, UpdateTenantSettingsBody } from "./contracts/entities/tenants.ts";
@@ -371,6 +371,11 @@ export interface SessionsListOptions extends ResourceRequestOptions {
371
371
  limit?: number;
372
372
  userId?: string;
373
373
  }
374
+ export interface LatestSessionsListOptions extends ResourceRequestOptions {
375
+ cursor?: string;
376
+ limit?: number;
377
+ userId?: string;
378
+ }
374
379
  export interface SessionMessagesOptions extends ResourceRequestOptions {
375
380
  after?: string;
376
381
  cursor?: string;
@@ -395,6 +400,12 @@ export interface SessionsResource {
395
400
  list(input: {
396
401
  agentId: string;
397
402
  } & SessionsListOptions): Promise<SessionsListResponse>;
403
+ /**
404
+ * `GET /v1/sessions/latest` — each Agent's most recently updated Session
405
+ * across the Tenant, one item per Agent, newest first. `userId` narrows
406
+ * the candidate Sessions to one end user's before picking the latest.
407
+ */
408
+ listLatest(input?: LatestSessionsListOptions): Promise<LatestSessionsListResponse>;
398
409
  messages(input: {
399
410
  agentId: string;
400
411
  sessionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {