@llmsafespaces/sdk 0.30.1 → 0.32.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
@@ -419,13 +419,17 @@ var SessionsAPI = class {
419
419
  abort(workspaceId, sessionId) {
420
420
  return this.client.request("POST", `/workspaces/${workspaceId}/sessions/${sessionId}/abort`);
421
421
  }
422
+ /** Gets one session in contract shape (pkg/session Session). */
422
423
  get(workspaceId, sessionId) {
423
424
  return this.client.request("GET", `/workspaces/${workspaceId}/sessions/${sessionId}`);
424
425
  }
425
426
  /**
426
- * Sends a prompt asynchronously (202; the reply arrives on the workspace
427
- * SSE stream). Optional `files` (Epic 68) are upload-namespace paths
428
- * the API composes the v1 attachment manifest into the dispatched text.
427
+ * Sends a prompt asynchronously into the delivery outbox (202) and
428
+ * returns the accepted-entry receipt; the agent's reply arrives on the
429
+ * workspace SSE stream. A retried clientMessageID answers 200 with the
430
+ * ORIGINAL accepted entry (status "duplicate"). Optional `files`
431
+ * (Epic 68) are upload-namespace paths — the API composes the v1
432
+ * attachment manifest into the dispatched text.
429
433
  */
430
434
  sendPromptAsync(workspaceId, sessionId, message, files) {
431
435
  const body = { parts: [{ type: "text", text: message }] };
package/dist/index.d.cts CHANGED
@@ -103,6 +103,44 @@ interface SessionListItem {
103
103
  messageCount: number;
104
104
  status: string;
105
105
  }
106
+ /**
107
+ * The platform-owned view of one agent session (pkg/session contract,
108
+ * design 0049) — the getSession response shape.
109
+ */
110
+ interface Session {
111
+ id: string;
112
+ workspaceId: string;
113
+ parentId?: string;
114
+ title?: string;
115
+ agentId?: string;
116
+ model?: ModelRef;
117
+ status: "unknown" | "idle" | "busy" | "error" | "compacting" | "archived";
118
+ cost?: Cost;
119
+ contextUsage?: ContextUsage;
120
+ time?: TimeRange;
121
+ summary?: string;
122
+ archived?: boolean;
123
+ }
124
+ /** The session's live context occupancy (non-monotonic: compaction resets it). */
125
+ interface ContextUsage {
126
+ used: number;
127
+ window?: number;
128
+ }
129
+ /** Bounds a session or message. completedAt is absent while busy. */
130
+ interface TimeRange {
131
+ startedAt: string;
132
+ completedAt?: string;
133
+ }
134
+ /**
135
+ * The delivery-outbox receipt for an async prompt: the 202 body of a
136
+ * fresh accept, and the 200 body of a retried clientMessageID (which
137
+ * echoes the ORIGINAL accepted entry with status "duplicate").
138
+ */
139
+ interface PromptAccepted {
140
+ messageID: string;
141
+ clientMessageID?: string;
142
+ status: "queued" | "duplicate";
143
+ }
106
144
  interface ActiveSessionsResponse {
107
145
  active: string[];
108
146
  maxActive: number;
@@ -136,7 +174,7 @@ interface Message {
136
174
  }
137
175
  /** One renderable part of a message — the closed 5-type union. */
138
176
  interface Part {
139
- type: "text" | "reasoning" | "tool" | "file-change" | "custom";
177
+ type: "text" | "reasoning" | "tool" | "file_change" | "custom";
140
178
  id?: string;
141
179
  text?: string;
142
180
  reasoning?: string;
@@ -477,13 +515,17 @@ declare class SessionsAPI {
477
515
  nextCursor: string;
478
516
  }>;
479
517
  abort(workspaceId: string, sessionId: string): Promise<void>;
480
- get(workspaceId: string, sessionId: string): Promise<Record<string, unknown>>;
518
+ /** Gets one session in contract shape (pkg/session Session). */
519
+ get(workspaceId: string, sessionId: string): Promise<Session>;
481
520
  /**
482
- * Sends a prompt asynchronously (202; the reply arrives on the workspace
483
- * SSE stream). Optional `files` (Epic 68) are upload-namespace paths
484
- * the API composes the v1 attachment manifest into the dispatched text.
521
+ * Sends a prompt asynchronously into the delivery outbox (202) and
522
+ * returns the accepted-entry receipt; the agent's reply arrives on the
523
+ * workspace SSE stream. A retried clientMessageID answers 200 with the
524
+ * ORIGINAL accepted entry (status "duplicate"). Optional `files`
525
+ * (Epic 68) are upload-namespace paths — the API composes the v1
526
+ * attachment manifest into the dispatched text.
485
527
  */
486
- sendPromptAsync(workspaceId: string, sessionId: string, message: string, files?: string[]): Promise<void>;
528
+ sendPromptAsync(workspaceId: string, sessionId: string, message: string, files?: string[]): Promise<PromptAccepted>;
487
529
  delete(workspaceId: string, sessionId: string): Promise<void>;
488
530
  /** Enqueues a message for a busy session; optional `files` as in sendPromptAsync. */
489
531
  enqueue(workspaceId: string, sessionId: string, text: string, files?: string[]): Promise<{
@@ -851,4 +893,4 @@ declare class ServiceUnavailableError extends LLMSafeSpacesError {
851
893
  constructor(message?: string, reason?: string, retryAfter?: number);
852
894
  }
853
895
 
854
- export { type APIKey, type ActivateWorkspaceResponse, type ActiveSessionsResponse, AuthError, type AuthResponse, type ClientOptions, ConflictError, type Cost, type CreateMcpServerRequest, type CreateProviderCredentialRequest, type CreateSecretRequest, type CreateWorkspaceRequest, type EnsureSessionResponse, type FetchFn, type FileDiff, type FileUpload, type InboxLateAnswerAccepted, type InputOption, type InputRequest, LLMSafeSpaces, LLMSafeSpacesError, type McpAutoApplyRule, type McpServer, type Message, type ModelRef, NotFoundError, type PaginationMetadata, type Part, type ProviderCredential, type QueuedMessage, RateLimitError, type RefreshWorkspaceResult, SECRET_NAME_PATTERN, type SecretResponse, ServiceUnavailableError, type SessionListItem, type TerminalTicket, TimeoutError, type ToolPart, type ToolRef, type UpdateMcpServerRequest, type UpdateProviderCredentialRequest, type User, type Workspace, type WorkspaceCondition, type WorkspaceListItem, type WorkspaceListResult, type WorkspaceStatusResult };
896
+ export { type APIKey, type ActivateWorkspaceResponse, type ActiveSessionsResponse, AuthError, type AuthResponse, type ClientOptions, ConflictError, type ContextUsage, type Cost, type CreateMcpServerRequest, type CreateProviderCredentialRequest, type CreateSecretRequest, type CreateWorkspaceRequest, type EnsureSessionResponse, type FetchFn, type FileDiff, type FileUpload, type InboxLateAnswerAccepted, type InputOption, type InputRequest, LLMSafeSpaces, LLMSafeSpacesError, type McpAutoApplyRule, type McpServer, type Message, type ModelRef, NotFoundError, type PaginationMetadata, type Part, type PromptAccepted, type ProviderCredential, type QueuedMessage, RateLimitError, type RefreshWorkspaceResult, SECRET_NAME_PATTERN, type SecretResponse, ServiceUnavailableError, type Session, type SessionListItem, type TerminalTicket, type TimeRange, TimeoutError, type ToolPart, type ToolRef, type UpdateMcpServerRequest, type UpdateProviderCredentialRequest, type User, type Workspace, type WorkspaceCondition, type WorkspaceListItem, type WorkspaceListResult, type WorkspaceStatusResult };
package/dist/index.d.ts CHANGED
@@ -103,6 +103,44 @@ interface SessionListItem {
103
103
  messageCount: number;
104
104
  status: string;
105
105
  }
106
+ /**
107
+ * The platform-owned view of one agent session (pkg/session contract,
108
+ * design 0049) — the getSession response shape.
109
+ */
110
+ interface Session {
111
+ id: string;
112
+ workspaceId: string;
113
+ parentId?: string;
114
+ title?: string;
115
+ agentId?: string;
116
+ model?: ModelRef;
117
+ status: "unknown" | "idle" | "busy" | "error" | "compacting" | "archived";
118
+ cost?: Cost;
119
+ contextUsage?: ContextUsage;
120
+ time?: TimeRange;
121
+ summary?: string;
122
+ archived?: boolean;
123
+ }
124
+ /** The session's live context occupancy (non-monotonic: compaction resets it). */
125
+ interface ContextUsage {
126
+ used: number;
127
+ window?: number;
128
+ }
129
+ /** Bounds a session or message. completedAt is absent while busy. */
130
+ interface TimeRange {
131
+ startedAt: string;
132
+ completedAt?: string;
133
+ }
134
+ /**
135
+ * The delivery-outbox receipt for an async prompt: the 202 body of a
136
+ * fresh accept, and the 200 body of a retried clientMessageID (which
137
+ * echoes the ORIGINAL accepted entry with status "duplicate").
138
+ */
139
+ interface PromptAccepted {
140
+ messageID: string;
141
+ clientMessageID?: string;
142
+ status: "queued" | "duplicate";
143
+ }
106
144
  interface ActiveSessionsResponse {
107
145
  active: string[];
108
146
  maxActive: number;
@@ -136,7 +174,7 @@ interface Message {
136
174
  }
137
175
  /** One renderable part of a message — the closed 5-type union. */
138
176
  interface Part {
139
- type: "text" | "reasoning" | "tool" | "file-change" | "custom";
177
+ type: "text" | "reasoning" | "tool" | "file_change" | "custom";
140
178
  id?: string;
141
179
  text?: string;
142
180
  reasoning?: string;
@@ -477,13 +515,17 @@ declare class SessionsAPI {
477
515
  nextCursor: string;
478
516
  }>;
479
517
  abort(workspaceId: string, sessionId: string): Promise<void>;
480
- get(workspaceId: string, sessionId: string): Promise<Record<string, unknown>>;
518
+ /** Gets one session in contract shape (pkg/session Session). */
519
+ get(workspaceId: string, sessionId: string): Promise<Session>;
481
520
  /**
482
- * Sends a prompt asynchronously (202; the reply arrives on the workspace
483
- * SSE stream). Optional `files` (Epic 68) are upload-namespace paths
484
- * the API composes the v1 attachment manifest into the dispatched text.
521
+ * Sends a prompt asynchronously into the delivery outbox (202) and
522
+ * returns the accepted-entry receipt; the agent's reply arrives on the
523
+ * workspace SSE stream. A retried clientMessageID answers 200 with the
524
+ * ORIGINAL accepted entry (status "duplicate"). Optional `files`
525
+ * (Epic 68) are upload-namespace paths — the API composes the v1
526
+ * attachment manifest into the dispatched text.
485
527
  */
486
- sendPromptAsync(workspaceId: string, sessionId: string, message: string, files?: string[]): Promise<void>;
528
+ sendPromptAsync(workspaceId: string, sessionId: string, message: string, files?: string[]): Promise<PromptAccepted>;
487
529
  delete(workspaceId: string, sessionId: string): Promise<void>;
488
530
  /** Enqueues a message for a busy session; optional `files` as in sendPromptAsync. */
489
531
  enqueue(workspaceId: string, sessionId: string, text: string, files?: string[]): Promise<{
@@ -851,4 +893,4 @@ declare class ServiceUnavailableError extends LLMSafeSpacesError {
851
893
  constructor(message?: string, reason?: string, retryAfter?: number);
852
894
  }
853
895
 
854
- export { type APIKey, type ActivateWorkspaceResponse, type ActiveSessionsResponse, AuthError, type AuthResponse, type ClientOptions, ConflictError, type Cost, type CreateMcpServerRequest, type CreateProviderCredentialRequest, type CreateSecretRequest, type CreateWorkspaceRequest, type EnsureSessionResponse, type FetchFn, type FileDiff, type FileUpload, type InboxLateAnswerAccepted, type InputOption, type InputRequest, LLMSafeSpaces, LLMSafeSpacesError, type McpAutoApplyRule, type McpServer, type Message, type ModelRef, NotFoundError, type PaginationMetadata, type Part, type ProviderCredential, type QueuedMessage, RateLimitError, type RefreshWorkspaceResult, SECRET_NAME_PATTERN, type SecretResponse, ServiceUnavailableError, type SessionListItem, type TerminalTicket, TimeoutError, type ToolPart, type ToolRef, type UpdateMcpServerRequest, type UpdateProviderCredentialRequest, type User, type Workspace, type WorkspaceCondition, type WorkspaceListItem, type WorkspaceListResult, type WorkspaceStatusResult };
896
+ export { type APIKey, type ActivateWorkspaceResponse, type ActiveSessionsResponse, AuthError, type AuthResponse, type ClientOptions, ConflictError, type ContextUsage, type Cost, type CreateMcpServerRequest, type CreateProviderCredentialRequest, type CreateSecretRequest, type CreateWorkspaceRequest, type EnsureSessionResponse, type FetchFn, type FileDiff, type FileUpload, type InboxLateAnswerAccepted, type InputOption, type InputRequest, LLMSafeSpaces, LLMSafeSpacesError, type McpAutoApplyRule, type McpServer, type Message, type ModelRef, NotFoundError, type PaginationMetadata, type Part, type PromptAccepted, type ProviderCredential, type QueuedMessage, RateLimitError, type RefreshWorkspaceResult, SECRET_NAME_PATTERN, type SecretResponse, ServiceUnavailableError, type Session, type SessionListItem, type TerminalTicket, type TimeRange, TimeoutError, type ToolPart, type ToolRef, type UpdateMcpServerRequest, type UpdateProviderCredentialRequest, type User, type Workspace, type WorkspaceCondition, type WorkspaceListItem, type WorkspaceListResult, type WorkspaceStatusResult };
package/dist/index.js CHANGED
@@ -385,13 +385,17 @@ var SessionsAPI = class {
385
385
  abort(workspaceId, sessionId) {
386
386
  return this.client.request("POST", `/workspaces/${workspaceId}/sessions/${sessionId}/abort`);
387
387
  }
388
+ /** Gets one session in contract shape (pkg/session Session). */
388
389
  get(workspaceId, sessionId) {
389
390
  return this.client.request("GET", `/workspaces/${workspaceId}/sessions/${sessionId}`);
390
391
  }
391
392
  /**
392
- * Sends a prompt asynchronously (202; the reply arrives on the workspace
393
- * SSE stream). Optional `files` (Epic 68) are upload-namespace paths
394
- * the API composes the v1 attachment manifest into the dispatched text.
393
+ * Sends a prompt asynchronously into the delivery outbox (202) and
394
+ * returns the accepted-entry receipt; the agent's reply arrives on the
395
+ * workspace SSE stream. A retried clientMessageID answers 200 with the
396
+ * ORIGINAL accepted entry (status "duplicate"). Optional `files`
397
+ * (Epic 68) are upload-namespace paths — the API composes the v1
398
+ * attachment manifest into the dispatched text.
395
399
  */
396
400
  sendPromptAsync(workspaceId, sessionId, message, files) {
397
401
  const body = { parts: [{ type: "text", text: message }] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmsafespaces/sdk",
3
- "version": "0.30.1",
3
+ "version": "0.32.0",
4
4
  "description": "TypeScript SDK for LLMSafeSpaces API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",