@theokit/sdk 4.27.0 → 4.28.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/{chunk-WBBYSW3Q.cjs → chunk-I53QDJVI.cjs} +5 -5
- package/dist/{chunk-WBBYSW3Q.cjs.map → chunk-I53QDJVI.cjs.map} +1 -1
- package/dist/{chunk-OX772BEW.js → chunk-PF5Y5BHG.js} +3 -3
- package/dist/{chunk-OX772BEW.js.map → chunk-PF5Y5BHG.js.map} +1 -1
- package/dist/{chunk-TMNS2LOS.cjs → chunk-PN53WGEI.cjs} +5 -5
- package/dist/{chunk-TMNS2LOS.cjs.map → chunk-PN53WGEI.cjs.map} +1 -1
- package/dist/{chunk-6M76Z3AI.js → chunk-XW6RXVGB.js} +3 -3
- package/dist/{chunk-6M76Z3AI.js.map → chunk-XW6RXVGB.js.map} +1 -1
- package/dist/{cron-DPUZzncH.d.ts → cron-BN6JJlDw.d.ts} +8 -0
- package/dist/{cron-DzZ9TMa2.d.cts → cron-CoQREV_k.d.cts} +8 -0
- package/dist/cron.cjs +3 -3
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +2 -2
- package/dist/errors.d.ts +3 -424
- package/dist/eval.cjs +2 -2
- package/dist/eval.js +1 -1
- package/dist/index.cjs +21 -21
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/{run-until-K7IO7ZPQ.js → run-until-YZ2ODWOF.js} +3 -2
- package/dist/run-until-YZ2ODWOF.js.map +1 -0
- package/dist/{run-until-ZD4PRLNJ.cjs → run-until-ZZ2JLPJM.cjs} +3 -2
- package/dist/run-until-ZZ2JLPJM.cjs.map +1 -0
- package/dist/server/auth/index.d.cts +207 -11
- package/dist/server/auth/index.d.ts +207 -11
- package/dist/server/errors-envelope.d.cts +12 -6
- package/dist/server/errors-envelope.d.ts +12 -6
- package/dist/types/goal-events.d.ts +8 -0
- package/package.json +1 -1
- package/dist/run-until-K7IO7ZPQ.js.map +0 -1
- package/dist/run-until-ZD4PRLNJ.cjs.map +0 -1
|
@@ -674,6 +674,14 @@ interface GoalOptions {
|
|
|
674
674
|
judgeModel?: string;
|
|
675
675
|
/** Override env for the judge auxiliary agent. Default `OPENROUTER_API_KEY` (EC-A). */
|
|
676
676
|
judgeApiKey?: string;
|
|
677
|
+
/**
|
|
678
|
+
* M80 — o modelo do agente CONDUZIDO, base da derivação do judge quando `judgeModel` é omitido.
|
|
679
|
+
*
|
|
680
|
+
* Existe porque o default fixo (`openai/gpt-4o-mini`) só resolve em OpenRouter: com chave
|
|
681
|
+
* Anthropic dá 404, com bearer OAuth dá 401, e o goal queimava 3 turnos antes de falhar com razão
|
|
682
|
+
* enganosa. Um judge que roda no mesmo modelo do chat funciona onde o chat funciona.
|
|
683
|
+
*/
|
|
684
|
+
agentModel?: string;
|
|
677
685
|
/** Optional subgoals fed to the judge prompt. */
|
|
678
686
|
subgoals?: string[];
|
|
679
687
|
/**
|
|
@@ -674,6 +674,14 @@ interface GoalOptions {
|
|
|
674
674
|
judgeModel?: string;
|
|
675
675
|
/** Override env for the judge auxiliary agent. Default `OPENROUTER_API_KEY` (EC-A). */
|
|
676
676
|
judgeApiKey?: string;
|
|
677
|
+
/**
|
|
678
|
+
* M80 — o modelo do agente CONDUZIDO, base da derivação do judge quando `judgeModel` é omitido.
|
|
679
|
+
*
|
|
680
|
+
* Existe porque o default fixo (`openai/gpt-4o-mini`) só resolve em OpenRouter: com chave
|
|
681
|
+
* Anthropic dá 404, com bearer OAuth dá 401, e o goal queimava 3 turnos antes de falhar com razão
|
|
682
|
+
* enganosa. Um judge que roda no mesmo modelo do chat funciona onde o chat funciona.
|
|
683
|
+
*/
|
|
684
|
+
agentModel?: string;
|
|
677
685
|
/** Optional subgoals fed to the judge prompt. */
|
|
678
686
|
subgoals?: string[];
|
|
679
687
|
/**
|
package/dist/cron.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkI53QDJVI_cjs = require('./chunk-I53QDJVI.cjs');
|
|
4
|
+
require('./chunk-PN53WGEI.cjs');
|
|
5
5
|
require('./chunk-MZ5ZRORA.cjs');
|
|
6
6
|
require('./chunk-YU6KON2I.cjs');
|
|
7
7
|
require('./chunk-BUUUWQMB.cjs');
|
|
@@ -43,7 +43,7 @@ require('./chunk-BEURCLDV.cjs');
|
|
|
43
43
|
|
|
44
44
|
Object.defineProperty(exports, "Cron", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkI53QDJVI_cjs.Cron; }
|
|
47
47
|
});
|
|
48
48
|
//# sourceMappingURL=cron.cjs.map
|
|
49
49
|
//# sourceMappingURL=cron.cjs.map
|
package/dist/cron.d.cts
CHANGED
package/dist/cron.d.ts
CHANGED
package/dist/cron.js
CHANGED
package/dist/errors.d.ts
CHANGED
|
@@ -1,424 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* (ADR D66). Consumers can `switch (err.metadata?.code)` exhaustively
|
|
5
|
-
* — adding a new variant is an explicit decision + test coverage.
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export type ErrorCode = "rate_limit" | "auth_failed" | "invalid_request" | "timeout" | "server_error" | "context_too_long" | "content_filtered" | "model_unavailable" | "network" | "quota_exceeded" | "unknown";
|
|
10
|
-
/**
|
|
11
|
-
* Codes used by {@link AgentRunError} (Production-Readiness #3, ADR D311).
|
|
12
|
-
*
|
|
13
|
-
* Superset of {@link ErrorCode} extended with codes that do NOT originate
|
|
14
|
-
* from a provider HTTP response:
|
|
15
|
-
*
|
|
16
|
-
* - `quota_exceeded` — billing limit hit (provider 402 or signalled error)
|
|
17
|
-
* - `tool_runtime_error` — custom tool handler threw inside dispatch
|
|
18
|
-
* - `aborted` — caller's `AbortSignal` fired (Phase 4)
|
|
19
|
-
* - `invalid_model` — model id rejected by provider (400 "model not found")
|
|
20
|
-
* - `safety_blocked` — provider safety filter blocked req or resp
|
|
21
|
-
* - `provider_unreachable` — DNS/TCP/timeout/5xx at transport boundary
|
|
22
|
-
*
|
|
23
|
-
* The `& {}` tail keeps the literal-union ergonomics (autocomplete) while
|
|
24
|
-
* accepting any string for forward compatibility with constructor calls
|
|
25
|
-
* that pass arbitrary code values (legacy callers).
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* T1.1 — closed literal union for `AgentRunError.code`. The previous
|
|
31
|
-
* `(string & {})` escape hatch let arbitrary strings slip into the type
|
|
32
|
-
* surface and defeated exhaustive `switch (code)` discrimination. This is
|
|
33
|
-
* the canonical closed form. `AgentRunErrorCode` is re-aliased below for
|
|
34
|
-
* source-level back-compat.
|
|
35
|
-
*
|
|
36
|
-
* Adding a new code: append the literal here AND audit every `switch (err.code)`
|
|
37
|
-
* in callers. Type-checker enforces the audit via the `default: assertNever(code)`
|
|
38
|
-
* convention.
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
export type KnownAgentRunErrorCode = ErrorCode | "quota_exceeded" | "tool_runtime_error" | "aborted" | "invalid_model" | "safety_blocked" | "provider_unreachable";
|
|
43
|
-
/**
|
|
44
|
-
* Back-compat alias of {@link KnownAgentRunErrorCode}. Pre-T1.1 callers that
|
|
45
|
-
* imported `AgentRunErrorCode` keep working; new code SHOULD prefer
|
|
46
|
-
* `KnownAgentRunErrorCode` to make the closed-union intent explicit.
|
|
47
|
-
*
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export type AgentRunErrorCode = KnownAgentRunErrorCode;
|
|
51
|
-
/**
|
|
52
|
-
* Structured context for errors that originated from a provider HTTP
|
|
53
|
-
* call (ADR D65). Lets callers retry with the right backoff (`retryAfter`),
|
|
54
|
-
* surface actionable diagnostics (`provider`, `endpoint`), and inspect the
|
|
55
|
-
* raw response body when needed (`raw`, capped at ~2KB by the mapper).
|
|
56
|
-
*
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
export interface ErrorMetadata {
|
|
60
|
-
/** Provider canonical name (e.g., `"anthropic"`, `"openai"`, `"openrouter"`, `"gemini"`). */
|
|
61
|
-
provider: string;
|
|
62
|
-
/** HTTP endpoint that failed (e.g., `"/v1/messages"`, `"/v1/chat/completions"`). */
|
|
63
|
-
endpoint: string;
|
|
64
|
-
/** Machine-readable error code (finite enum). */
|
|
65
|
-
code: ErrorCode;
|
|
66
|
-
/** HTTP status code if applicable. */
|
|
67
|
-
statusCode?: number;
|
|
68
|
-
/** Seconds to wait before retry, per provider's `retry-after` header (numeric form only). */
|
|
69
|
-
retryAfter?: number;
|
|
70
|
-
/** Raw response body for debugging (truncated to ~2KB by the mapper). */
|
|
71
|
-
raw?: unknown;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Base class for all errors thrown by `@theokit/sdk`.
|
|
75
|
-
*
|
|
76
|
-
* Use `isRetryable` to drive retry/backoff logic. `code` and `protoErrorCode`
|
|
77
|
-
* are populated for server-originated errors when available. `metadata`
|
|
78
|
-
* (ADR D65) carries structured `{ provider, endpoint, code, ... }` when
|
|
79
|
-
* the error originated from a provider HTTP call.
|
|
80
|
-
*
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
export declare class TheokitAgentError extends Error {
|
|
84
|
-
readonly name: string;
|
|
85
|
-
readonly isRetryable: boolean;
|
|
86
|
-
readonly code?: string;
|
|
87
|
-
readonly protoErrorCode?: string;
|
|
88
|
-
readonly metadata?: ErrorMetadata;
|
|
89
|
-
constructor(message: string, options?: {
|
|
90
|
-
isRetryable?: boolean;
|
|
91
|
-
code?: string;
|
|
92
|
-
protoErrorCode?: string;
|
|
93
|
-
cause?: unknown;
|
|
94
|
-
metadata?: ErrorMetadata;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Invalid API key, not logged in, insufficient permissions.
|
|
99
|
-
*
|
|
100
|
-
* @public
|
|
101
|
-
*/
|
|
102
|
-
export declare class AuthenticationError extends TheokitAgentError {
|
|
103
|
-
readonly name: string;
|
|
104
|
-
constructor(message: string, options?: {
|
|
105
|
-
code?: string;
|
|
106
|
-
cause?: unknown;
|
|
107
|
-
metadata?: ErrorMetadata;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Too many requests or usage limits exceeded.
|
|
112
|
-
*
|
|
113
|
-
* @public
|
|
114
|
-
*/
|
|
115
|
-
export declare class RateLimitError extends TheokitAgentError {
|
|
116
|
-
readonly name: string;
|
|
117
|
-
constructor(message: string, options?: {
|
|
118
|
-
code?: string;
|
|
119
|
-
cause?: unknown;
|
|
120
|
-
metadata?: ErrorMetadata;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Invalid model, bad request parameters, malformed options.
|
|
125
|
-
*
|
|
126
|
-
* @public
|
|
127
|
-
*/
|
|
128
|
-
export declare class ConfigurationError extends TheokitAgentError {
|
|
129
|
-
readonly name: string;
|
|
130
|
-
constructor(message: string, options?: {
|
|
131
|
-
code?: string;
|
|
132
|
-
cause?: unknown;
|
|
133
|
-
metadata?: ErrorMetadata;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Thrown when creating a cloud agent for a repo whose SCM provider is not
|
|
138
|
-
* connected. Use `helpUrl` to point the user at the right reconnect flow.
|
|
139
|
-
*
|
|
140
|
-
* @public
|
|
141
|
-
*/
|
|
142
|
-
export declare class IntegrationNotConnectedError extends ConfigurationError {
|
|
143
|
-
readonly name: string;
|
|
144
|
-
readonly provider: string;
|
|
145
|
-
readonly helpUrl: string;
|
|
146
|
-
constructor(message: string, options: {
|
|
147
|
-
provider: string;
|
|
148
|
-
helpUrl: string;
|
|
149
|
-
code?: string;
|
|
150
|
-
cause?: unknown;
|
|
151
|
-
metadata?: ErrorMetadata;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Service unavailable, timeout, transport-level failure.
|
|
156
|
-
*
|
|
157
|
-
* @public
|
|
158
|
-
*/
|
|
159
|
-
export declare class NetworkError extends TheokitAgentError {
|
|
160
|
-
readonly name: string;
|
|
161
|
-
constructor(message: string, options?: {
|
|
162
|
-
code?: string;
|
|
163
|
-
cause?: unknown;
|
|
164
|
-
metadata?: ErrorMetadata;
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Catch-all for unclassified server or runtime errors.
|
|
169
|
-
*
|
|
170
|
-
* @public
|
|
171
|
-
*/
|
|
172
|
-
export declare class UnknownAgentError extends TheokitAgentError {
|
|
173
|
-
readonly name: string;
|
|
174
|
-
constructor(message: string, options?: {
|
|
175
|
-
code?: string;
|
|
176
|
-
cause?: unknown;
|
|
177
|
-
metadata?: ErrorMetadata;
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Thrown by `Agent.prompt` (and helpers that go through `run.wait()`) when
|
|
182
|
-
* the option `{ throwOnError: true }` is set and the run terminates with
|
|
183
|
-
* `status: 'error'`. Carries the structured `RunResult.error` fields so
|
|
184
|
-
* callers can `catch` once and branch on `code` / `provider` instead of
|
|
185
|
-
* unwrapping the run.
|
|
186
|
-
*
|
|
187
|
-
* Extends {@link TheokitAgentError} per ADR D65 — no new hierarchy.
|
|
188
|
-
*
|
|
189
|
-
* @example
|
|
190
|
-
* try {
|
|
191
|
-
* await Agent.prompt(msg, { apiKey, model, throwOnError: true });
|
|
192
|
-
* } catch (err) {
|
|
193
|
-
* if (err instanceof AgentRunError && err.code === 'auth_failed') {
|
|
194
|
-
* // bad key
|
|
195
|
-
* }
|
|
196
|
-
* }
|
|
197
|
-
*
|
|
198
|
-
* @public
|
|
199
|
-
*/
|
|
200
|
-
export declare class AgentRunError extends TheokitAgentError {
|
|
201
|
-
readonly name: string;
|
|
202
|
-
readonly provider?: string;
|
|
203
|
-
readonly raw?: string;
|
|
204
|
-
/** Provider's request id (`x-request-id` / `request-id` header). Useful for support tickets. */
|
|
205
|
-
readonly requestId?: string;
|
|
206
|
-
/** SDK conversation id this error was raised inside. */
|
|
207
|
-
readonly conversationId?: string;
|
|
208
|
-
constructor(message: string, options: {
|
|
209
|
-
code: AgentRunErrorCode;
|
|
210
|
-
provider?: string;
|
|
211
|
-
raw?: string;
|
|
212
|
-
requestId?: string;
|
|
213
|
-
conversationId?: string;
|
|
214
|
-
retriable?: boolean;
|
|
215
|
-
cause?: unknown;
|
|
216
|
-
metadata?: ErrorMetadata;
|
|
217
|
-
});
|
|
218
|
-
/**
|
|
219
|
-
* Production-Readiness #3 (ADR D311): alias for `isRetryable` exposed as
|
|
220
|
-
* `retriable` to match the handoff contract. Future v2 will deprecate
|
|
221
|
-
* `isRetryable` in favor of this.
|
|
222
|
-
*/
|
|
223
|
-
get retriable(): boolean;
|
|
224
|
-
/**
|
|
225
|
-
* D312: provider's `Retry-After` header in **milliseconds**. Mappers store
|
|
226
|
-
* the header value (seconds) in `metadata.retryAfter`; this getter
|
|
227
|
-
* multiplies by 1000 so the result composes with `Date.now()`/`setTimeout`.
|
|
228
|
-
*
|
|
229
|
-
* Returns `undefined` when no hint was provided. `0` is a legitimate value
|
|
230
|
-
* — use `=== undefined` check rather than truthy check.
|
|
231
|
-
*/
|
|
232
|
-
get retryAfterMs(): number | undefined;
|
|
233
|
-
/**
|
|
234
|
-
* D313 + T1.5: alias for `metadata.raw`. Provider response body for
|
|
235
|
-
* debugging. T1.5 wraps the value in `redactSecrets` at the getter
|
|
236
|
-
* boundary so secret-shaped substrings (`sk-...`, Bearer JWTs, etc.) are
|
|
237
|
-
* stripped before reaching the caller. Available but NEVER serialized
|
|
238
|
-
* into `.message` (anti-leak invariant).
|
|
239
|
-
*/
|
|
240
|
-
get providerError(): unknown;
|
|
241
|
-
/**
|
|
242
|
-
* T1.5 — sanitized JSON form. `metadata.raw` is OMITTED by default; opt
|
|
243
|
-
* in via `THEOKIT_DEBUG_RAW_ERRORS=1` to surface the (redacted) raw
|
|
244
|
-
* payload for diagnostics. Every other field stays accessible.
|
|
245
|
-
*
|
|
246
|
-
* The single env-var gate is read each call so operators can toggle at
|
|
247
|
-
* runtime without restarting the process.
|
|
248
|
-
*/
|
|
249
|
-
toJSON(): Record<string, unknown>;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Is this error transient (worth retrying)?
|
|
253
|
-
*
|
|
254
|
-
* Returns the SDK's own retryability verdict: every {@link TheokitAgentError}
|
|
255
|
-
* subclass computes `isRetryable` at construction (rate-limit / network /
|
|
256
|
-
* credential-pool-exhausted are retryable; auth / configuration / unsupported
|
|
257
|
-
* are not), so this predicate is a single source of truth rather than a
|
|
258
|
-
* re-derivation. Non-SDK errors return `false` conservatively — wrap a foreign
|
|
259
|
-
* error in the appropriate SDK error first if you want it considered transient.
|
|
260
|
-
* It never inspects `err.message`.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* try {
|
|
264
|
-
* await agent.send(message, { throwOnError: true });
|
|
265
|
-
* } catch (err) {
|
|
266
|
-
* if (isTransientError(err)) return retryWithBackoff();
|
|
267
|
-
* throw err;
|
|
268
|
-
* }
|
|
269
|
-
*
|
|
270
|
-
* @public
|
|
271
|
-
*/
|
|
272
|
-
export declare function isTransientError(err: unknown): boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Thrown when a {@link Run} or agent operation is not available on the current
|
|
275
|
-
* runtime. Check first with `run.supports(operation)`.
|
|
276
|
-
*
|
|
277
|
-
* Extends {@link TheokitAgentError} (so error-catching code that branches on
|
|
278
|
-
* `instanceof TheokitAgentError` continues to work) but is never retryable —
|
|
279
|
-
* an unsupported operation will not become supported on retry.
|
|
280
|
-
*
|
|
281
|
-
* @public
|
|
282
|
-
*/
|
|
283
|
-
export declare class UnsupportedRunOperationError extends TheokitAgentError {
|
|
284
|
-
readonly name: string;
|
|
285
|
-
readonly operation: RunOperation;
|
|
286
|
-
constructor(message: string, operation: RunOperation, options?: {
|
|
287
|
-
code?: string;
|
|
288
|
-
cause?: unknown;
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Thrown when every credential in a per-provider pool is in cooldown
|
|
293
|
-
* and no healthy key is available (ADR D133). The caller's
|
|
294
|
-
* {@link import("./internal/llm/fallback-client.js").FallbackLlmClient}
|
|
295
|
-
* catches this and tries the next provider in the fallback chain.
|
|
296
|
-
*
|
|
297
|
-
* `metadata.nextRetryAt` (epoch ms) tells callers when the soonest
|
|
298
|
-
* pool entry resumes — useful for manual retry scheduling.
|
|
299
|
-
*
|
|
300
|
-
* @public
|
|
301
|
-
*/
|
|
302
|
-
export declare class CredentialPoolExhaustedError extends TheokitAgentError {
|
|
303
|
-
readonly name: string;
|
|
304
|
-
readonly provider: string;
|
|
305
|
-
readonly nextRetryAt: number | undefined;
|
|
306
|
-
constructor(message: string, options: {
|
|
307
|
-
provider: string;
|
|
308
|
-
nextRetryAt?: number;
|
|
309
|
-
code?: string;
|
|
310
|
-
cause?: unknown;
|
|
311
|
-
metadata?: ErrorMetadata;
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Finite error codes specific to memory adapter operations (ADR D141).
|
|
316
|
-
*
|
|
317
|
-
* @public
|
|
318
|
-
*/
|
|
319
|
-
export type MemoryAdapterErrorCode = "auth_failed" | "rate_limited" | "not_found" | "network" | "invalid_input" | "unknown";
|
|
320
|
-
/**
|
|
321
|
-
* Error raised by `@theokit-memory-*` adapters. Carries `adapterId`
|
|
322
|
-
* so callers can branch on which provider failed (ADR D141).
|
|
323
|
-
*
|
|
324
|
-
* @public
|
|
325
|
-
*/
|
|
326
|
-
export declare class MemoryAdapterError extends TheokitAgentError {
|
|
327
|
-
readonly name: string;
|
|
328
|
-
readonly adapterId: string;
|
|
329
|
-
constructor(message: string, options: {
|
|
330
|
-
adapterId: string;
|
|
331
|
-
code: MemoryAdapterErrorCode;
|
|
332
|
-
cause?: unknown;
|
|
333
|
-
metadata?: ErrorMetadata;
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Thrown when a user-supplied task ID violates the grammar
|
|
338
|
-
* `^[a-z0-9][a-z0-9_-]*$` (D368) OR starts with a reserved adapter
|
|
339
|
-
* prefix (`wf-` / `b-` / `cron-`, EC-5).
|
|
340
|
-
*
|
|
341
|
-
* @public
|
|
342
|
-
*/
|
|
343
|
-
export declare class InvalidTaskIdError extends TheokitAgentError {
|
|
344
|
-
readonly name: string;
|
|
345
|
-
readonly taskId: string;
|
|
346
|
-
constructor(message: string, taskId: string, options?: {
|
|
347
|
-
cause?: unknown;
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Thrown when `Task.subscribe(id)` is called for a task that has been
|
|
352
|
-
* evicted, never submitted, or evicted after retention (D373).
|
|
353
|
-
*
|
|
354
|
-
* @public
|
|
355
|
-
*/
|
|
356
|
-
export declare class TaskNotFoundError extends TheokitAgentError {
|
|
357
|
-
readonly name: string;
|
|
358
|
-
readonly taskId: string;
|
|
359
|
-
constructor(taskId: string, options?: {
|
|
360
|
-
cause?: unknown;
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Thrown when `CloudAgent` is asked to wrap a task (D370). Cloud
|
|
365
|
-
* task observability is deferred until Theo PaaS GA.
|
|
366
|
-
*
|
|
367
|
-
* @public
|
|
368
|
-
*/
|
|
369
|
-
export declare class UnsupportedTaskOperationError extends TheokitAgentError {
|
|
370
|
-
readonly name: string;
|
|
371
|
-
readonly operation: string;
|
|
372
|
-
constructor(operation: string, options?: {
|
|
373
|
-
cause?: unknown;
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Thrown by `Budget` enforcement (ADR D386) when a `mode: "block"`
|
|
378
|
-
* budget would be exceeded by the upcoming LLM call. Caller pega
|
|
379
|
-
* tipado para retry-after-window-reset or surface to the user.
|
|
380
|
-
*
|
|
381
|
-
* @public
|
|
382
|
-
*/
|
|
383
|
-
export declare class BudgetExceededError extends TheokitAgentError {
|
|
384
|
-
readonly name: string;
|
|
385
|
-
readonly budgetName: string;
|
|
386
|
-
readonly window: import("./types/budget.js").BudgetWindow;
|
|
387
|
-
readonly spentUsd: number;
|
|
388
|
-
readonly limitUsd: number;
|
|
389
|
-
readonly mode: import("./types/budget.js").BudgetMode;
|
|
390
|
-
constructor(args: {
|
|
391
|
-
budgetName: string;
|
|
392
|
-
window: import("./types/budget.js").BudgetWindow;
|
|
393
|
-
spentUsd: number;
|
|
394
|
-
limitUsd: number;
|
|
395
|
-
mode: import("./types/budget.js").BudgetMode;
|
|
396
|
-
cause?: unknown;
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Thrown when `CloudAgent.send({ budget })` is invoked (D388). Cloud
|
|
401
|
-
* budget surface waits for Theo PaaS GA.
|
|
402
|
-
*
|
|
403
|
-
* @public
|
|
404
|
-
*/
|
|
405
|
-
/**
|
|
406
|
-
* T1.6 — Thrown when a consumer calls `agent.send()` or any method
|
|
407
|
-
* on an agent that has already been `dispose()`d. Pre-T1.6 this was
|
|
408
|
-
* a generic `new Error("Agent has been disposed")` — consumers
|
|
409
|
-
* couldn't catch it without string-matching the message.
|
|
410
|
-
*
|
|
411
|
-
* @public
|
|
412
|
-
*/
|
|
413
|
-
export declare class AgentDisposedError extends TheokitAgentError {
|
|
414
|
-
readonly name: string;
|
|
415
|
-
readonly agentId: string;
|
|
416
|
-
constructor(agentId: string);
|
|
417
|
-
}
|
|
418
|
-
export declare class UnsupportedBudgetOperationError extends TheokitAgentError {
|
|
419
|
-
readonly name: string;
|
|
420
|
-
readonly operation: string;
|
|
421
|
-
constructor(operation: string, options?: {
|
|
422
|
-
cause?: unknown;
|
|
423
|
-
});
|
|
424
|
-
}
|
|
1
|
+
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, g as BudgetExceededError, C as ConfigurationError, u as CredentialPoolExhaustedError, m as ErrorCode, E as ErrorMetadata, I as IntegrationNotConnectedError, n as InvalidTaskIdError, K as KnownAgentRunErrorCode, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, T as TheokitAgentError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-DHZtSNnj.js';
|
|
2
|
+
import './run-OJbGyweZ.js';
|
|
3
|
+
import 'zod';
|
package/dist/eval.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkS7OEXQMI_cjs = require('./chunk-S7OEXQMI.cjs');
|
|
4
4
|
var chunkQUTUJ6P6_cjs = require('./chunk-QUTUJ6P6.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkPN53WGEI_cjs = require('./chunk-PN53WGEI.cjs');
|
|
6
6
|
require('./chunk-MZ5ZRORA.cjs');
|
|
7
7
|
require('./chunk-YU6KON2I.cjs');
|
|
8
8
|
var chunkBUUUWQMB_cjs = require('./chunk-BUUUWQMB.cjs');
|
|
@@ -766,7 +766,7 @@ function makeDefaultEmbedder(opts) {
|
|
|
766
766
|
let runtime;
|
|
767
767
|
return (texts) => {
|
|
768
768
|
if (runtime === void 0) {
|
|
769
|
-
runtime =
|
|
769
|
+
runtime = chunkPN53WGEI_cjs.openRouterMemoryEmbeddingProviderAdapter.create(embedderCreateOptions(opts));
|
|
770
770
|
}
|
|
771
771
|
return runtime.then((rt) => rt.embed(texts));
|
|
772
772
|
};
|
package/dist/eval.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { shellEscapePosix, LocalSandbox } from './chunk-SKWVAQAY.js';
|
|
2
2
|
import { readJsonlIds, appendJsonl } from './chunk-DUK5WMKJ.js';
|
|
3
3
|
export { JsonlParseError, loadJsonl } from './chunk-DUK5WMKJ.js';
|
|
4
|
-
import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-
|
|
4
|
+
import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-XW6RXVGB.js';
|
|
5
5
|
import './chunk-HRA3CPGG.js';
|
|
6
6
|
import './chunk-SQLZ7ONU.js';
|
|
7
7
|
import { getTracer } from './chunk-K2BQQ445.js';
|
package/dist/index.cjs
CHANGED
|
@@ -8,8 +8,8 @@ require('./chunk-EPYZOCOL.cjs');
|
|
|
8
8
|
var chunkZ2OC3UIW_cjs = require('./chunk-Z2OC3UIW.cjs');
|
|
9
9
|
require('./chunk-BWT67BI4.cjs');
|
|
10
10
|
require('./chunk-PNVDQL5Y.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var chunkI53QDJVI_cjs = require('./chunk-I53QDJVI.cjs');
|
|
12
|
+
var chunkPN53WGEI_cjs = require('./chunk-PN53WGEI.cjs');
|
|
13
13
|
var chunkMZ5ZRORA_cjs = require('./chunk-MZ5ZRORA.cjs');
|
|
14
14
|
require('./chunk-YU6KON2I.cjs');
|
|
15
15
|
require('./chunk-BUUUWQMB.cjs');
|
|
@@ -55,8 +55,8 @@ var fs = require('fs');
|
|
|
55
55
|
// src/agent-factory.ts
|
|
56
56
|
function createAgentFactory(common) {
|
|
57
57
|
return {
|
|
58
|
-
forSession: (agentId, overrides) =>
|
|
59
|
-
getOrCreate: (agentId, overrides) =>
|
|
58
|
+
forSession: (agentId, overrides) => chunkPN53WGEI_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
|
|
59
|
+
getOrCreate: (agentId, overrides) => chunkPN53WGEI_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
function mergeAgentOptions(common, overrides, agentId) {
|
|
@@ -693,7 +693,7 @@ var EventBus = class {
|
|
|
693
693
|
// src/goal-loop.ts
|
|
694
694
|
function runGoalLoop(agent, goal, options, depsOverride) {
|
|
695
695
|
async function* wrap() {
|
|
696
|
-
const { runUntilImpl } = await import('./run-until-
|
|
696
|
+
const { runUntilImpl } = await import('./run-until-ZZ2JLPJM.cjs');
|
|
697
697
|
const deps = depsOverride ?? await (async () => {
|
|
698
698
|
const { judgeCallImpl } = await import('./judge-call-2FULQ6KL.cjs');
|
|
699
699
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
@@ -1143,7 +1143,7 @@ var Memory = {
|
|
|
1143
1143
|
return await peer.IndexManager.open(openArgs);
|
|
1144
1144
|
}
|
|
1145
1145
|
const { IndexManager } = await import('./index-manager-CB6I7XFQ.cjs');
|
|
1146
|
-
openArgs.embedding = await resolveEmbedding(opts.embedding,
|
|
1146
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, chunkPN53WGEI_cjs.MEMORY_EMBEDDING_ADAPTERS);
|
|
1147
1147
|
return await IndexManager.open(openArgs);
|
|
1148
1148
|
},
|
|
1149
1149
|
/**
|
|
@@ -1154,7 +1154,7 @@ var Memory = {
|
|
|
1154
1154
|
*/
|
|
1155
1155
|
async runDreamingSweep(opts) {
|
|
1156
1156
|
const peer = await tryLoadSdkMemoryPeer();
|
|
1157
|
-
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS :
|
|
1157
|
+
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkPN53WGEI_cjs.MEMORY_EMBEDDING_ADAPTERS;
|
|
1158
1158
|
const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
|
|
1159
1159
|
const result = peer !== null ? (
|
|
1160
1160
|
// biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
|
|
@@ -1699,7 +1699,7 @@ var FIXTURE_USER = {
|
|
|
1699
1699
|
};
|
|
1700
1700
|
var FIXTURE_MODELS = [
|
|
1701
1701
|
{
|
|
1702
|
-
id:
|
|
1702
|
+
id: chunkPN53WGEI_cjs.DEFAULT_AGENTIC_MODEL_ID,
|
|
1703
1703
|
name: "Gemini 2.0 Flash",
|
|
1704
1704
|
displayName: "Gemini 2.0 Flash",
|
|
1705
1705
|
parameters: [
|
|
@@ -1907,7 +1907,7 @@ var Theokit = class {
|
|
|
1907
1907
|
envVars: p.envVars
|
|
1908
1908
|
}));
|
|
1909
1909
|
},
|
|
1910
|
-
embeddingAdapters: () => Object.entries(
|
|
1910
|
+
embeddingAdapters: () => Object.entries(chunkPN53WGEI_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
|
|
1911
1911
|
id,
|
|
1912
1912
|
transport: adapter.transport,
|
|
1913
1913
|
defaultModel: adapter.defaultModel
|
|
@@ -1939,17 +1939,17 @@ function resolveLocalProviderBaseUrl(providerName, fallback) {
|
|
|
1939
1939
|
return fallback;
|
|
1940
1940
|
}
|
|
1941
1941
|
async function executeCatalogRequest(request) {
|
|
1942
|
-
const apiKey =
|
|
1942
|
+
const apiKey = chunkPN53WGEI_cjs.resolveApiKey(request.apiKey);
|
|
1943
1943
|
if (apiKey === void 0) {
|
|
1944
1944
|
throw new chunkA44COQJJ_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
1945
1945
|
}
|
|
1946
|
-
if (
|
|
1946
|
+
if (chunkPN53WGEI_cjs.shouldUseFixtureMode(apiKey)) {
|
|
1947
1947
|
return request.fixture;
|
|
1948
1948
|
}
|
|
1949
|
-
if (!
|
|
1949
|
+
if (!chunkPN53WGEI_cjs.isFixtureApiKey(apiKey) && process.env.THEOKIT_API_BASE_URL === void 0) {
|
|
1950
1950
|
throw new chunkA44COQJJ_cjs.AuthenticationError("Invalid API key", { code: "authentication_error" });
|
|
1951
1951
|
}
|
|
1952
|
-
return
|
|
1952
|
+
return chunkPN53WGEI_cjs.httpRequest(request.path, { apiKey });
|
|
1953
1953
|
}
|
|
1954
1954
|
|
|
1955
1955
|
// src/trajectory-helpers.ts
|
|
@@ -2065,35 +2065,35 @@ Object.defineProperty(exports, "GenerateObjectError", {
|
|
|
2065
2065
|
});
|
|
2066
2066
|
Object.defineProperty(exports, "Cron", {
|
|
2067
2067
|
enumerable: true,
|
|
2068
|
-
get: function () { return
|
|
2068
|
+
get: function () { return chunkI53QDJVI_cjs.Cron; }
|
|
2069
2069
|
});
|
|
2070
2070
|
Object.defineProperty(exports, "Agent", {
|
|
2071
2071
|
enumerable: true,
|
|
2072
|
-
get: function () { return
|
|
2072
|
+
get: function () { return chunkPN53WGEI_cjs.Agent; }
|
|
2073
2073
|
});
|
|
2074
2074
|
Object.defineProperty(exports, "AgentBuilder", {
|
|
2075
2075
|
enumerable: true,
|
|
2076
|
-
get: function () { return
|
|
2076
|
+
get: function () { return chunkPN53WGEI_cjs.AgentBuilder; }
|
|
2077
2077
|
});
|
|
2078
2078
|
Object.defineProperty(exports, "Tool", {
|
|
2079
2079
|
enumerable: true,
|
|
2080
|
-
get: function () { return
|
|
2080
|
+
get: function () { return chunkPN53WGEI_cjs.Tool; }
|
|
2081
2081
|
});
|
|
2082
2082
|
Object.defineProperty(exports, "ToolError", {
|
|
2083
2083
|
enumerable: true,
|
|
2084
|
-
get: function () { return
|
|
2084
|
+
get: function () { return chunkPN53WGEI_cjs.ToolError; }
|
|
2085
2085
|
});
|
|
2086
2086
|
Object.defineProperty(exports, "UsageAccumulator", {
|
|
2087
2087
|
enumerable: true,
|
|
2088
|
-
get: function () { return
|
|
2088
|
+
get: function () { return chunkPN53WGEI_cjs.UsageAccumulator; }
|
|
2089
2089
|
});
|
|
2090
2090
|
Object.defineProperty(exports, "computeCost", {
|
|
2091
2091
|
enumerable: true,
|
|
2092
|
-
get: function () { return
|
|
2092
|
+
get: function () { return chunkPN53WGEI_cjs.computeCost; }
|
|
2093
2093
|
});
|
|
2094
2094
|
Object.defineProperty(exports, "getPricingEntry", {
|
|
2095
2095
|
enumerable: true,
|
|
2096
|
-
get: function () { return
|
|
2096
|
+
get: function () { return chunkPN53WGEI_cjs.getPricingEntry; }
|
|
2097
2097
|
});
|
|
2098
2098
|
Object.defineProperty(exports, "emitRunEvent", {
|
|
2099
2099
|
enumerable: true,
|