@llmsafespaces/sdk 0.30.0 → 0.30.1
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 +38 -5
- package/dist/index.d.cts +42 -5
- package/dist/index.d.ts +42 -5
- package/dist/index.js +38 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -205,7 +205,8 @@ var LLMSafeSpaces = class {
|
|
|
205
205
|
throw new RateLimitError(msg);
|
|
206
206
|
case 503: {
|
|
207
207
|
const reason = errBody.reason;
|
|
208
|
-
const
|
|
208
|
+
const headerAfter = Number(res.headers.get("Retry-After"));
|
|
209
|
+
const retryAfter = errBody.retryAfter ?? (Number.isFinite(headerAfter) && headerAfter > 0 ? headerAfter : void 0);
|
|
209
210
|
const apiMessage = errBody.message ?? msg;
|
|
210
211
|
throw new ServiceUnavailableError(apiMessage, reason, retryAfter);
|
|
211
212
|
}
|
|
@@ -623,25 +624,57 @@ var UsageAPI = class {
|
|
|
623
624
|
return this.client.request("GET", "/usage/quota");
|
|
624
625
|
}
|
|
625
626
|
};
|
|
627
|
+
function lateAnswerOnly(late) {
|
|
628
|
+
return late?.status === "queued" ? late : void 0;
|
|
629
|
+
}
|
|
626
630
|
var InputRequestsAPI = class {
|
|
627
631
|
constructor(client) {
|
|
628
632
|
this.client = client;
|
|
629
633
|
}
|
|
630
634
|
client;
|
|
635
|
+
/** Pending questions as contract InputRequest values (kind=question). */
|
|
631
636
|
listQuestions(workspaceId) {
|
|
632
637
|
return this.client.request("GET", `/workspaces/${workspaceId}/question`);
|
|
633
638
|
}
|
|
634
|
-
|
|
635
|
-
|
|
639
|
+
/**
|
|
640
|
+
* Answers a live question. When the ask is no longer live but its
|
|
641
|
+
* unanswered-question inbox record is pending (#1313), the server
|
|
642
|
+
* accepts the answer as a late answer through the delivery outbox
|
|
643
|
+
* (202) and the resolved value carries the outbox entry; a live
|
|
644
|
+
* answer (200) resolves to undefined.
|
|
645
|
+
*/
|
|
646
|
+
replyQuestion(workspaceId, requestId, answers) {
|
|
647
|
+
return this.client.request("POST", `/workspaces/${workspaceId}/question/${requestId}/reply`, { answers }).then(lateAnswerOnly);
|
|
636
648
|
}
|
|
649
|
+
/** Rejects (dismisses) a pending question. */
|
|
637
650
|
rejectQuestion(workspaceId, requestId) {
|
|
638
651
|
return this.client.request("POST", `/workspaces/${workspaceId}/question/${requestId}/reject`);
|
|
639
652
|
}
|
|
653
|
+
/** Pending permissions as contract InputRequest values (kind=permission). */
|
|
640
654
|
listPermissions(workspaceId) {
|
|
641
655
|
return this.client.request("GET", `/workspaces/${workspaceId}/permission`);
|
|
642
656
|
}
|
|
643
|
-
|
|
644
|
-
|
|
657
|
+
/**
|
|
658
|
+
* Answers a live permission with the reply vocabulary
|
|
659
|
+
* ("once" | "always" | "reject") and an optional message. A late
|
|
660
|
+
* decision (ask no longer live, inbox record pending) resolves to the
|
|
661
|
+
* 202 outbox entry; a live answer (200) resolves to undefined.
|
|
662
|
+
*/
|
|
663
|
+
replyPermission(workspaceId, requestId, reply, message) {
|
|
664
|
+
const body = { reply };
|
|
665
|
+
if (message !== void 0 && message !== "") body.message = message;
|
|
666
|
+
return this.client.request("POST", `/workspaces/${workspaceId}/permission/${requestId}/reply`, body).then(lateAnswerOnly);
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Dismisses an unanswered-question inbox record (#1313): the record
|
|
670
|
+
* becomes dismissed; a still-live ask is rejected first server-side.
|
|
671
|
+
*/
|
|
672
|
+
dismissInboxRecord(workspaceId, sessionId, requestId) {
|
|
673
|
+
return this.client.request("DELETE", `/workspaces/${workspaceId}/sessions/${sessionId}/inbox/${requestId}`);
|
|
674
|
+
}
|
|
675
|
+
/** Triggers an input-snapshot flight (202; events arrive on the event streams). */
|
|
676
|
+
requestInputSnapshot(workspaceId) {
|
|
677
|
+
return this.client.request("POST", `/workspaces/${workspaceId}/input-snapshot`);
|
|
645
678
|
}
|
|
646
679
|
};
|
|
647
680
|
var ProbeAPI = class {
|
package/dist/index.d.cts
CHANGED
|
@@ -194,6 +194,20 @@ interface ToolRef {
|
|
|
194
194
|
messageId?: string;
|
|
195
195
|
callId?: string;
|
|
196
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* The 202 body for a reply that landed as a late answer through the
|
|
199
|
+
* delivery outbox (#1313): the ask was no longer live, so the answer
|
|
200
|
+
* rides a Q&A user message instead of the live ask.
|
|
201
|
+
*/
|
|
202
|
+
interface InboxLateAnswerAccepted {
|
|
203
|
+
status: "queued";
|
|
204
|
+
/** Ask-scoped dedupe key (`inbox-{requestID}-answer`); duplicate clicks return the original. */
|
|
205
|
+
clientMessageID: string;
|
|
206
|
+
/** The outbox entry ID (202) or the original accepted entry (duplicate). */
|
|
207
|
+
messageID: string;
|
|
208
|
+
/** Present and true when the ask-scoped key was already accepted. */
|
|
209
|
+
duplicate?: boolean;
|
|
210
|
+
}
|
|
197
211
|
interface ModelRef {
|
|
198
212
|
id: string;
|
|
199
213
|
provider?: string;
|
|
@@ -587,11 +601,34 @@ declare class UsageAPI {
|
|
|
587
601
|
declare class InputRequestsAPI {
|
|
588
602
|
private client;
|
|
589
603
|
constructor(client: LLMSafeSpaces);
|
|
590
|
-
|
|
591
|
-
|
|
604
|
+
/** Pending questions as contract InputRequest values (kind=question). */
|
|
605
|
+
listQuestions(workspaceId: string): Promise<InputRequest[]>;
|
|
606
|
+
/**
|
|
607
|
+
* Answers a live question. When the ask is no longer live but its
|
|
608
|
+
* unanswered-question inbox record is pending (#1313), the server
|
|
609
|
+
* accepts the answer as a late answer through the delivery outbox
|
|
610
|
+
* (202) and the resolved value carries the outbox entry; a live
|
|
611
|
+
* answer (200) resolves to undefined.
|
|
612
|
+
*/
|
|
613
|
+
replyQuestion(workspaceId: string, requestId: string, answers: string[][]): Promise<InboxLateAnswerAccepted | undefined>;
|
|
614
|
+
/** Rejects (dismisses) a pending question. */
|
|
592
615
|
rejectQuestion(workspaceId: string, requestId: string): Promise<void>;
|
|
593
|
-
|
|
594
|
-
|
|
616
|
+
/** Pending permissions as contract InputRequest values (kind=permission). */
|
|
617
|
+
listPermissions(workspaceId: string): Promise<InputRequest[]>;
|
|
618
|
+
/**
|
|
619
|
+
* Answers a live permission with the reply vocabulary
|
|
620
|
+
* ("once" | "always" | "reject") and an optional message. A late
|
|
621
|
+
* decision (ask no longer live, inbox record pending) resolves to the
|
|
622
|
+
* 202 outbox entry; a live answer (200) resolves to undefined.
|
|
623
|
+
*/
|
|
624
|
+
replyPermission(workspaceId: string, requestId: string, reply: "once" | "always" | "reject", message?: string): Promise<InboxLateAnswerAccepted | undefined>;
|
|
625
|
+
/**
|
|
626
|
+
* Dismisses an unanswered-question inbox record (#1313): the record
|
|
627
|
+
* becomes dismissed; a still-live ask is rejected first server-side.
|
|
628
|
+
*/
|
|
629
|
+
dismissInboxRecord(workspaceId: string, sessionId: string, requestId: string): Promise<void>;
|
|
630
|
+
/** Triggers an input-snapshot flight (202; events arrive on the event streams). */
|
|
631
|
+
requestInputSnapshot(workspaceId: string): Promise<void>;
|
|
595
632
|
}
|
|
596
633
|
declare class ProbeAPI {
|
|
597
634
|
private client;
|
|
@@ -814,4 +851,4 @@ declare class ServiceUnavailableError extends LLMSafeSpacesError {
|
|
|
814
851
|
constructor(message?: string, reason?: string, retryAfter?: number);
|
|
815
852
|
}
|
|
816
853
|
|
|
817
|
-
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 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -194,6 +194,20 @@ interface ToolRef {
|
|
|
194
194
|
messageId?: string;
|
|
195
195
|
callId?: string;
|
|
196
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* The 202 body for a reply that landed as a late answer through the
|
|
199
|
+
* delivery outbox (#1313): the ask was no longer live, so the answer
|
|
200
|
+
* rides a Q&A user message instead of the live ask.
|
|
201
|
+
*/
|
|
202
|
+
interface InboxLateAnswerAccepted {
|
|
203
|
+
status: "queued";
|
|
204
|
+
/** Ask-scoped dedupe key (`inbox-{requestID}-answer`); duplicate clicks return the original. */
|
|
205
|
+
clientMessageID: string;
|
|
206
|
+
/** The outbox entry ID (202) or the original accepted entry (duplicate). */
|
|
207
|
+
messageID: string;
|
|
208
|
+
/** Present and true when the ask-scoped key was already accepted. */
|
|
209
|
+
duplicate?: boolean;
|
|
210
|
+
}
|
|
197
211
|
interface ModelRef {
|
|
198
212
|
id: string;
|
|
199
213
|
provider?: string;
|
|
@@ -587,11 +601,34 @@ declare class UsageAPI {
|
|
|
587
601
|
declare class InputRequestsAPI {
|
|
588
602
|
private client;
|
|
589
603
|
constructor(client: LLMSafeSpaces);
|
|
590
|
-
|
|
591
|
-
|
|
604
|
+
/** Pending questions as contract InputRequest values (kind=question). */
|
|
605
|
+
listQuestions(workspaceId: string): Promise<InputRequest[]>;
|
|
606
|
+
/**
|
|
607
|
+
* Answers a live question. When the ask is no longer live but its
|
|
608
|
+
* unanswered-question inbox record is pending (#1313), the server
|
|
609
|
+
* accepts the answer as a late answer through the delivery outbox
|
|
610
|
+
* (202) and the resolved value carries the outbox entry; a live
|
|
611
|
+
* answer (200) resolves to undefined.
|
|
612
|
+
*/
|
|
613
|
+
replyQuestion(workspaceId: string, requestId: string, answers: string[][]): Promise<InboxLateAnswerAccepted | undefined>;
|
|
614
|
+
/** Rejects (dismisses) a pending question. */
|
|
592
615
|
rejectQuestion(workspaceId: string, requestId: string): Promise<void>;
|
|
593
|
-
|
|
594
|
-
|
|
616
|
+
/** Pending permissions as contract InputRequest values (kind=permission). */
|
|
617
|
+
listPermissions(workspaceId: string): Promise<InputRequest[]>;
|
|
618
|
+
/**
|
|
619
|
+
* Answers a live permission with the reply vocabulary
|
|
620
|
+
* ("once" | "always" | "reject") and an optional message. A late
|
|
621
|
+
* decision (ask no longer live, inbox record pending) resolves to the
|
|
622
|
+
* 202 outbox entry; a live answer (200) resolves to undefined.
|
|
623
|
+
*/
|
|
624
|
+
replyPermission(workspaceId: string, requestId: string, reply: "once" | "always" | "reject", message?: string): Promise<InboxLateAnswerAccepted | undefined>;
|
|
625
|
+
/**
|
|
626
|
+
* Dismisses an unanswered-question inbox record (#1313): the record
|
|
627
|
+
* becomes dismissed; a still-live ask is rejected first server-side.
|
|
628
|
+
*/
|
|
629
|
+
dismissInboxRecord(workspaceId: string, sessionId: string, requestId: string): Promise<void>;
|
|
630
|
+
/** Triggers an input-snapshot flight (202; events arrive on the event streams). */
|
|
631
|
+
requestInputSnapshot(workspaceId: string): Promise<void>;
|
|
595
632
|
}
|
|
596
633
|
declare class ProbeAPI {
|
|
597
634
|
private client;
|
|
@@ -814,4 +851,4 @@ declare class ServiceUnavailableError extends LLMSafeSpacesError {
|
|
|
814
851
|
constructor(message?: string, reason?: string, retryAfter?: number);
|
|
815
852
|
}
|
|
816
853
|
|
|
817
|
-
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 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -171,7 +171,8 @@ var LLMSafeSpaces = class {
|
|
|
171
171
|
throw new RateLimitError(msg);
|
|
172
172
|
case 503: {
|
|
173
173
|
const reason = errBody.reason;
|
|
174
|
-
const
|
|
174
|
+
const headerAfter = Number(res.headers.get("Retry-After"));
|
|
175
|
+
const retryAfter = errBody.retryAfter ?? (Number.isFinite(headerAfter) && headerAfter > 0 ? headerAfter : void 0);
|
|
175
176
|
const apiMessage = errBody.message ?? msg;
|
|
176
177
|
throw new ServiceUnavailableError(apiMessage, reason, retryAfter);
|
|
177
178
|
}
|
|
@@ -589,25 +590,57 @@ var UsageAPI = class {
|
|
|
589
590
|
return this.client.request("GET", "/usage/quota");
|
|
590
591
|
}
|
|
591
592
|
};
|
|
593
|
+
function lateAnswerOnly(late) {
|
|
594
|
+
return late?.status === "queued" ? late : void 0;
|
|
595
|
+
}
|
|
592
596
|
var InputRequestsAPI = class {
|
|
593
597
|
constructor(client) {
|
|
594
598
|
this.client = client;
|
|
595
599
|
}
|
|
596
600
|
client;
|
|
601
|
+
/** Pending questions as contract InputRequest values (kind=question). */
|
|
597
602
|
listQuestions(workspaceId) {
|
|
598
603
|
return this.client.request("GET", `/workspaces/${workspaceId}/question`);
|
|
599
604
|
}
|
|
600
|
-
|
|
601
|
-
|
|
605
|
+
/**
|
|
606
|
+
* Answers a live question. When the ask is no longer live but its
|
|
607
|
+
* unanswered-question inbox record is pending (#1313), the server
|
|
608
|
+
* accepts the answer as a late answer through the delivery outbox
|
|
609
|
+
* (202) and the resolved value carries the outbox entry; a live
|
|
610
|
+
* answer (200) resolves to undefined.
|
|
611
|
+
*/
|
|
612
|
+
replyQuestion(workspaceId, requestId, answers) {
|
|
613
|
+
return this.client.request("POST", `/workspaces/${workspaceId}/question/${requestId}/reply`, { answers }).then(lateAnswerOnly);
|
|
602
614
|
}
|
|
615
|
+
/** Rejects (dismisses) a pending question. */
|
|
603
616
|
rejectQuestion(workspaceId, requestId) {
|
|
604
617
|
return this.client.request("POST", `/workspaces/${workspaceId}/question/${requestId}/reject`);
|
|
605
618
|
}
|
|
619
|
+
/** Pending permissions as contract InputRequest values (kind=permission). */
|
|
606
620
|
listPermissions(workspaceId) {
|
|
607
621
|
return this.client.request("GET", `/workspaces/${workspaceId}/permission`);
|
|
608
622
|
}
|
|
609
|
-
|
|
610
|
-
|
|
623
|
+
/**
|
|
624
|
+
* Answers a live permission with the reply vocabulary
|
|
625
|
+
* ("once" | "always" | "reject") and an optional message. A late
|
|
626
|
+
* decision (ask no longer live, inbox record pending) resolves to the
|
|
627
|
+
* 202 outbox entry; a live answer (200) resolves to undefined.
|
|
628
|
+
*/
|
|
629
|
+
replyPermission(workspaceId, requestId, reply, message) {
|
|
630
|
+
const body = { reply };
|
|
631
|
+
if (message !== void 0 && message !== "") body.message = message;
|
|
632
|
+
return this.client.request("POST", `/workspaces/${workspaceId}/permission/${requestId}/reply`, body).then(lateAnswerOnly);
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Dismisses an unanswered-question inbox record (#1313): the record
|
|
636
|
+
* becomes dismissed; a still-live ask is rejected first server-side.
|
|
637
|
+
*/
|
|
638
|
+
dismissInboxRecord(workspaceId, sessionId, requestId) {
|
|
639
|
+
return this.client.request("DELETE", `/workspaces/${workspaceId}/sessions/${sessionId}/inbox/${requestId}`);
|
|
640
|
+
}
|
|
641
|
+
/** Triggers an input-snapshot flight (202; events arrive on the event streams). */
|
|
642
|
+
requestInputSnapshot(workspaceId) {
|
|
643
|
+
return this.client.request("POST", `/workspaces/${workspaceId}/input-snapshot`);
|
|
611
644
|
}
|
|
612
645
|
};
|
|
613
646
|
var ProbeAPI = class {
|