@llmsafespaces/sdk 0.15.3 → 0.15.4
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 +28 -0
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +27 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
NotFoundError: () => NotFoundError,
|
|
28
28
|
RateLimitError: () => RateLimitError,
|
|
29
29
|
SECRET_NAME_PATTERN: () => SECRET_NAME_PATTERN,
|
|
30
|
+
ServiceUnavailableError: () => ServiceUnavailableError,
|
|
30
31
|
TimeoutError: () => TimeoutError
|
|
31
32
|
});
|
|
32
33
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -72,6 +73,26 @@ var RateLimitError = class extends LLMSafeSpacesError {
|
|
|
72
73
|
this.name = "RateLimitError";
|
|
73
74
|
}
|
|
74
75
|
};
|
|
76
|
+
var ServiceUnavailableError = class extends LLMSafeSpacesError {
|
|
77
|
+
/**
|
|
78
|
+
* The workspace exists but cannot service requests (503). The `reason`
|
|
79
|
+
* field distinguishes the cause:
|
|
80
|
+
* - "not_ready" — workspace is booting or resuming
|
|
81
|
+
* - "agent_unreachable" — the agent process hung or crashed
|
|
82
|
+
* - "agent_restarting" — the agent is being restarted by the health
|
|
83
|
+
* watchdog or a credential reload
|
|
84
|
+
*
|
|
85
|
+
* Retry after `retryAfter` seconds (defaults to 10).
|
|
86
|
+
*/
|
|
87
|
+
reason;
|
|
88
|
+
retryAfter;
|
|
89
|
+
constructor(message = "Service temporarily unavailable", reason, retryAfter) {
|
|
90
|
+
super(message, 503, "SERVICE_UNAVAILABLE");
|
|
91
|
+
this.name = "ServiceUnavailableError";
|
|
92
|
+
this.reason = reason;
|
|
93
|
+
this.retryAfter = retryAfter;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
75
96
|
|
|
76
97
|
// src/client.ts
|
|
77
98
|
var DEFAULT_TIMEOUT = 12e4;
|
|
@@ -169,6 +190,12 @@ var LLMSafeSpaces = class {
|
|
|
169
190
|
throw new ConflictError(msg);
|
|
170
191
|
case 429:
|
|
171
192
|
throw new RateLimitError(msg);
|
|
193
|
+
case 503: {
|
|
194
|
+
const reason = errBody.reason;
|
|
195
|
+
const retryAfter = errBody.retryAfter;
|
|
196
|
+
const apiMessage = errBody.message ?? msg;
|
|
197
|
+
throw new ServiceUnavailableError(apiMessage, reason, retryAfter);
|
|
198
|
+
}
|
|
172
199
|
default:
|
|
173
200
|
throw new LLMSafeSpacesError(msg, res.status);
|
|
174
201
|
}
|
|
@@ -665,5 +692,6 @@ var SECRET_NAME_PATTERN = /^[a-z0-9._-]+$/;
|
|
|
665
692
|
NotFoundError,
|
|
666
693
|
RateLimitError,
|
|
667
694
|
SECRET_NAME_PATTERN,
|
|
695
|
+
ServiceUnavailableError,
|
|
668
696
|
TimeoutError
|
|
669
697
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -563,5 +563,20 @@ declare class TimeoutError extends LLMSafeSpacesError {
|
|
|
563
563
|
declare class RateLimitError extends LLMSafeSpacesError {
|
|
564
564
|
constructor(message?: string);
|
|
565
565
|
}
|
|
566
|
+
declare class ServiceUnavailableError extends LLMSafeSpacesError {
|
|
567
|
+
/**
|
|
568
|
+
* The workspace exists but cannot service requests (503). The `reason`
|
|
569
|
+
* field distinguishes the cause:
|
|
570
|
+
* - "not_ready" — workspace is booting or resuming
|
|
571
|
+
* - "agent_unreachable" — the agent process hung or crashed
|
|
572
|
+
* - "agent_restarting" — the agent is being restarted by the health
|
|
573
|
+
* watchdog or a credential reload
|
|
574
|
+
*
|
|
575
|
+
* Retry after `retryAfter` seconds (defaults to 10).
|
|
576
|
+
*/
|
|
577
|
+
readonly reason?: string;
|
|
578
|
+
readonly retryAfter?: number;
|
|
579
|
+
constructor(message?: string, reason?: string, retryAfter?: number);
|
|
580
|
+
}
|
|
566
581
|
|
|
567
|
-
export { type APIKey, type ActivateWorkspaceResponse, type ActiveSessionsResponse, AuthError, type AuthResponse, type ClientOptions, ConflictError, type CreateProviderCredentialRequest, type CreateSecretRequest, type CreateWorkspaceRequest, type EnsureSessionResponse, type FetchFn, LLMSafeSpaces, LLMSafeSpacesError, type MessageResponse, NotFoundError, type PaginationMetadata, type ProviderCredential, type QueuedMessage, RateLimitError, type RefreshWorkspaceResult, SECRET_NAME_PATTERN, type SecretResponse, type SessionListItem, type TerminalTicket, TimeoutError, type UpdateProviderCredentialRequest, type User, type Workspace, type WorkspaceCondition, type WorkspaceListItem, type WorkspaceListResult, type WorkspaceStatusResult };
|
|
582
|
+
export { type APIKey, type ActivateWorkspaceResponse, type ActiveSessionsResponse, AuthError, type AuthResponse, type ClientOptions, ConflictError, type CreateProviderCredentialRequest, type CreateSecretRequest, type CreateWorkspaceRequest, type EnsureSessionResponse, type FetchFn, LLMSafeSpaces, LLMSafeSpacesError, type MessageResponse, NotFoundError, type PaginationMetadata, type ProviderCredential, type QueuedMessage, RateLimitError, type RefreshWorkspaceResult, SECRET_NAME_PATTERN, type SecretResponse, ServiceUnavailableError, type SessionListItem, type TerminalTicket, TimeoutError, type UpdateProviderCredentialRequest, type User, type Workspace, type WorkspaceCondition, type WorkspaceListItem, type WorkspaceListResult, type WorkspaceStatusResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -563,5 +563,20 @@ declare class TimeoutError extends LLMSafeSpacesError {
|
|
|
563
563
|
declare class RateLimitError extends LLMSafeSpacesError {
|
|
564
564
|
constructor(message?: string);
|
|
565
565
|
}
|
|
566
|
+
declare class ServiceUnavailableError extends LLMSafeSpacesError {
|
|
567
|
+
/**
|
|
568
|
+
* The workspace exists but cannot service requests (503). The `reason`
|
|
569
|
+
* field distinguishes the cause:
|
|
570
|
+
* - "not_ready" — workspace is booting or resuming
|
|
571
|
+
* - "agent_unreachable" — the agent process hung or crashed
|
|
572
|
+
* - "agent_restarting" — the agent is being restarted by the health
|
|
573
|
+
* watchdog or a credential reload
|
|
574
|
+
*
|
|
575
|
+
* Retry after `retryAfter` seconds (defaults to 10).
|
|
576
|
+
*/
|
|
577
|
+
readonly reason?: string;
|
|
578
|
+
readonly retryAfter?: number;
|
|
579
|
+
constructor(message?: string, reason?: string, retryAfter?: number);
|
|
580
|
+
}
|
|
566
581
|
|
|
567
|
-
export { type APIKey, type ActivateWorkspaceResponse, type ActiveSessionsResponse, AuthError, type AuthResponse, type ClientOptions, ConflictError, type CreateProviderCredentialRequest, type CreateSecretRequest, type CreateWorkspaceRequest, type EnsureSessionResponse, type FetchFn, LLMSafeSpaces, LLMSafeSpacesError, type MessageResponse, NotFoundError, type PaginationMetadata, type ProviderCredential, type QueuedMessage, RateLimitError, type RefreshWorkspaceResult, SECRET_NAME_PATTERN, type SecretResponse, type SessionListItem, type TerminalTicket, TimeoutError, type UpdateProviderCredentialRequest, type User, type Workspace, type WorkspaceCondition, type WorkspaceListItem, type WorkspaceListResult, type WorkspaceStatusResult };
|
|
582
|
+
export { type APIKey, type ActivateWorkspaceResponse, type ActiveSessionsResponse, AuthError, type AuthResponse, type ClientOptions, ConflictError, type CreateProviderCredentialRequest, type CreateSecretRequest, type CreateWorkspaceRequest, type EnsureSessionResponse, type FetchFn, LLMSafeSpaces, LLMSafeSpacesError, type MessageResponse, NotFoundError, type PaginationMetadata, type ProviderCredential, type QueuedMessage, RateLimitError, type RefreshWorkspaceResult, SECRET_NAME_PATTERN, type SecretResponse, ServiceUnavailableError, type SessionListItem, type TerminalTicket, TimeoutError, type UpdateProviderCredentialRequest, type User, type Workspace, type WorkspaceCondition, type WorkspaceListItem, type WorkspaceListResult, type WorkspaceStatusResult };
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,26 @@ var RateLimitError = class extends LLMSafeSpacesError {
|
|
|
39
39
|
this.name = "RateLimitError";
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
+
var ServiceUnavailableError = class extends LLMSafeSpacesError {
|
|
43
|
+
/**
|
|
44
|
+
* The workspace exists but cannot service requests (503). The `reason`
|
|
45
|
+
* field distinguishes the cause:
|
|
46
|
+
* - "not_ready" — workspace is booting or resuming
|
|
47
|
+
* - "agent_unreachable" — the agent process hung or crashed
|
|
48
|
+
* - "agent_restarting" — the agent is being restarted by the health
|
|
49
|
+
* watchdog or a credential reload
|
|
50
|
+
*
|
|
51
|
+
* Retry after `retryAfter` seconds (defaults to 10).
|
|
52
|
+
*/
|
|
53
|
+
reason;
|
|
54
|
+
retryAfter;
|
|
55
|
+
constructor(message = "Service temporarily unavailable", reason, retryAfter) {
|
|
56
|
+
super(message, 503, "SERVICE_UNAVAILABLE");
|
|
57
|
+
this.name = "ServiceUnavailableError";
|
|
58
|
+
this.reason = reason;
|
|
59
|
+
this.retryAfter = retryAfter;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
42
62
|
|
|
43
63
|
// src/client.ts
|
|
44
64
|
var DEFAULT_TIMEOUT = 12e4;
|
|
@@ -136,6 +156,12 @@ var LLMSafeSpaces = class {
|
|
|
136
156
|
throw new ConflictError(msg);
|
|
137
157
|
case 429:
|
|
138
158
|
throw new RateLimitError(msg);
|
|
159
|
+
case 503: {
|
|
160
|
+
const reason = errBody.reason;
|
|
161
|
+
const retryAfter = errBody.retryAfter;
|
|
162
|
+
const apiMessage = errBody.message ?? msg;
|
|
163
|
+
throw new ServiceUnavailableError(apiMessage, reason, retryAfter);
|
|
164
|
+
}
|
|
139
165
|
default:
|
|
140
166
|
throw new LLMSafeSpacesError(msg, res.status);
|
|
141
167
|
}
|
|
@@ -631,5 +657,6 @@ export {
|
|
|
631
657
|
NotFoundError,
|
|
632
658
|
RateLimitError,
|
|
633
659
|
SECRET_NAME_PATTERN,
|
|
660
|
+
ServiceUnavailableError,
|
|
634
661
|
TimeoutError
|
|
635
662
|
};
|