theokit 0.12.1 → 0.14.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/{actions-virtual-module-SQDY3V5X.js → actions-virtual-module-3CDQTWOC.js} +6 -6
- package/dist/{actions-virtual-module-PNPRCEOS.js → actions-virtual-module-RM7JRY5N.js} +9 -9
- package/dist/agents-typed-client-SAWAAH7K.js +142 -0
- package/dist/agents-typed-client-SAWAAH7K.js.map +1 -0
- package/dist/agents-typed-client-UTEQUA63.js +143 -0
- package/dist/agents-typed-client-UTEQUA63.js.map +1 -0
- package/dist/{app-typed-client-5GYEOYP3.js → app-typed-client-5VQE6DNF.js} +9 -9
- package/dist/{app-typed-client-QG7BVZYW.js → app-typed-client-CSOK7NPC.js} +6 -6
- package/dist/body-parser-web-FV5HWCY3.js +71 -0
- package/dist/body-parser-web-FV5HWCY3.js.map +1 -0
- package/dist/boot/index.js +3 -3
- package/dist/{build-QFRLSEZ4.js → build-5K7LK77K.js} +11 -11
- package/dist/{chunk-223EFY5X.js → chunk-2J7XU3PW.js} +68 -27
- package/dist/chunk-2J7XU3PW.js.map +1 -0
- package/dist/chunk-5UUOGAJH.js +445 -0
- package/dist/chunk-5UUOGAJH.js.map +1 -0
- package/dist/{chunk-43D6XNDR.js → chunk-637WJB7Z.js} +91 -18
- package/dist/chunk-637WJB7Z.js.map +1 -0
- package/dist/{chunk-6FYD34NX.js → chunk-BQDGES7C.js} +28 -28
- package/dist/{chunk-6FYD34NX.js.map → chunk-BQDGES7C.js.map} +1 -1
- package/dist/chunk-F4YUPDJ2.js +115 -0
- package/dist/chunk-F4YUPDJ2.js.map +1 -0
- package/dist/{chunk-TGTNRUH3.js → chunk-H243MR3F.js} +2 -2
- package/dist/chunk-JZHT3LW7.js +32 -0
- package/dist/chunk-JZHT3LW7.js.map +1 -0
- package/dist/chunk-KGFNWIMS.js +94 -0
- package/dist/chunk-KGFNWIMS.js.map +1 -0
- package/dist/{chunk-NAZ4E2GT.js → chunk-KXA37ONC.js} +2 -2
- package/dist/{chunk-7CBRKNQA.js → chunk-RBHCJHRR.js} +251 -22
- package/dist/chunk-RBHCJHRR.js.map +1 -0
- package/dist/chunk-RSVN727G.js +1 -0
- package/dist/chunk-S7Y5WLZY.js +235 -0
- package/dist/chunk-S7Y5WLZY.js.map +1 -0
- package/dist/{chunk-GFMQJHXX.js → chunk-WR4F4EEZ.js} +1082 -1074
- package/dist/chunk-WR4F4EEZ.js.map +1 -0
- package/dist/{chunk-WFNLNIJX.js → chunk-Z5IGLBWE.js} +1 -1
- package/dist/cli/index.js +5 -5
- package/dist/client/index.d.ts +41 -134
- package/dist/client/index.js +60 -202
- package/dist/client/index.js.map +1 -1
- package/dist/{dev-GBXOTXUP.js → dev-QOEVYNBG.js} +10 -10
- package/dist/{dev-emit-FEFEDLZF.js → dev-emit-5MDSBP5D.js} +3 -3
- package/dist/{dev-emit-O4EGOSNV.js → dev-emit-QH2YGZXN.js} +2 -2
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/internal-api-5BDI6N5U.js +83 -0
- package/dist/internal-api-EFKZWIYZ.js +66 -0
- package/dist/{openapi-VR6AFBLJ.js → openapi-FHY6HC6I.js} +7 -7
- package/dist/{registry-Q2TZQLUH.js → registry-34LL7NF4.js} +1 -1
- package/dist/{routes-LRYOIIAI.js → routes-EW7TP7NJ.js} +2 -2
- package/dist/server/auth/index.js +1 -1
- package/dist/server/define/index.d.ts +3 -70
- package/dist/server/define/index.js +4 -4
- package/dist/server/http/index.js +2 -2
- package/dist/server/index.d.ts +2 -4
- package/dist/server/index.js +94 -394
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.js +4 -4
- package/dist/server/observability/index.js +1 -1
- package/dist/server/scan/index.d.ts +22 -2
- package/dist/server/scan/index.js +2 -2
- package/dist/{start-3ZHAXSJE.js → start-2KG4JSXM.js} +76 -13
- package/dist/start-2KG4JSXM.js.map +1 -0
- package/dist/vite-plugin/index.js +13 -12
- package/dist/{vite-plugin-WO72VLYR.js → vite-plugin-TDIDZ5U7.js} +7 -7
- package/dist/vite-plugin-TDIDZ5U7.js.map +1 -0
- package/package.json +3 -7
- package/dist/agent-events-DosDXkSV.d.ts +0 -94
- package/dist/chunk-223EFY5X.js.map +0 -1
- package/dist/chunk-3LVRAGAZ.js +0 -73
- package/dist/chunk-3LVRAGAZ.js.map +0 -1
- package/dist/chunk-43D6XNDR.js.map +0 -1
- package/dist/chunk-7CBRKNQA.js.map +0 -1
- package/dist/chunk-AD74EAK3.js +0 -237
- package/dist/chunk-AD74EAK3.js.map +0 -1
- package/dist/chunk-GFMQJHXX.js.map +0 -1
- package/dist/chunk-PBEH6NXR.js +0 -44
- package/dist/chunk-PBEH6NXR.js.map +0 -1
- package/dist/chunk-PIVX3DYW.js +0 -142
- package/dist/chunk-PIVX3DYW.js.map +0 -1
- package/dist/chunk-PPPR5DGR.js +0 -1
- package/dist/chunk-RESN62GB.js +0 -269
- package/dist/chunk-RESN62GB.js.map +0 -1
- package/dist/server/agent/index.d.ts +0 -229
- package/dist/server/agent/index.js +0 -16
- package/dist/start-3ZHAXSJE.js.map +0 -1
- /package/dist/{actions-virtual-module-SQDY3V5X.js.map → actions-virtual-module-3CDQTWOC.js.map} +0 -0
- /package/dist/{actions-virtual-module-PNPRCEOS.js.map → actions-virtual-module-RM7JRY5N.js.map} +0 -0
- /package/dist/{app-typed-client-5GYEOYP3.js.map → app-typed-client-5VQE6DNF.js.map} +0 -0
- /package/dist/{app-typed-client-QG7BVZYW.js.map → app-typed-client-CSOK7NPC.js.map} +0 -0
- /package/dist/{build-QFRLSEZ4.js.map → build-5K7LK77K.js.map} +0 -0
- /package/dist/{chunk-TGTNRUH3.js.map → chunk-H243MR3F.js.map} +0 -0
- /package/dist/{chunk-NAZ4E2GT.js.map → chunk-KXA37ONC.js.map} +0 -0
- /package/dist/{chunk-PPPR5DGR.js.map → chunk-RSVN727G.js.map} +0 -0
- /package/dist/{chunk-WFNLNIJX.js.map → chunk-Z5IGLBWE.js.map} +0 -0
- /package/dist/{dev-GBXOTXUP.js.map → dev-QOEVYNBG.js.map} +0 -0
- /package/dist/{dev-emit-FEFEDLZF.js.map → dev-emit-5MDSBP5D.js.map} +0 -0
- /package/dist/{dev-emit-O4EGOSNV.js.map → dev-emit-QH2YGZXN.js.map} +0 -0
- /package/dist/{server/agent/index.js.map → internal-api-5BDI6N5U.js.map} +0 -0
- /package/dist/{vite-plugin-WO72VLYR.js.map → internal-api-EFKZWIYZ.js.map} +0 -0
- /package/dist/{openapi-VR6AFBLJ.js.map → openapi-FHY6HC6I.js.map} +0 -0
- /package/dist/{registry-Q2TZQLUH.js.map → registry-34LL7NF4.js.map} +0 -0
- /package/dist/{routes-LRYOIIAI.js.map → routes-EW7TP7NJ.js.map} +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { A as AgentEvent } from '../../agent-events-DosDXkSV.js';
|
|
3
2
|
import { UIMessageChunk } from 'ai';
|
|
4
3
|
import { b as WebSocketLike } from '../../define-websocket-CdK94O-D.js';
|
|
5
4
|
export { W as WebSocketHandler, a as WebSocketHandlerWeb, d as defineWebSocket, c as defineWebSocketWeb } from '../../define-websocket-CdK94O-D.js';
|
|
@@ -120,72 +119,6 @@ type MiddlewareHandler = (request: Request, next: (request: Request) => Promise<
|
|
|
120
119
|
*/
|
|
121
120
|
declare function defineMiddleware(handler: MiddlewareHandler): MiddlewareHandler;
|
|
122
121
|
|
|
123
|
-
/**
|
|
124
|
-
* T5.1 — defineAgentEndpoint
|
|
125
|
-
*
|
|
126
|
-
* Sugar over defineRoute (ADR D4). Accepts an async generator that yields
|
|
127
|
-
* AgentEvents and produces a RouteConfig whose handler returns a Response
|
|
128
|
-
* streaming Server-Sent Events (SSE).
|
|
129
|
-
*
|
|
130
|
-
* Wire format: `data: <JSON>\n\n` per event. Standards-compliant.
|
|
131
|
-
*
|
|
132
|
-
* The generator may throw — the wrapper catches and emits a final
|
|
133
|
-
* `{ type: 'error', message }` event before closing the stream.
|
|
134
|
-
*
|
|
135
|
-
* The wrapper observes `request.signal` (EC-7) — when aborted, the
|
|
136
|
-
* underlying generator is told to `return()` and the stream closes
|
|
137
|
-
* promptly.
|
|
138
|
-
*
|
|
139
|
-
* Note (EC-12, Out of Scope): SSE backpressure (slow consumer) is not
|
|
140
|
-
* handled here. For high-frequency token streaming consider a different
|
|
141
|
-
* transport (WS) or a buffer policy. This MVP enqueues each event
|
|
142
|
-
* immediately.
|
|
143
|
-
*/
|
|
144
|
-
interface AgentEndpointHandlerArgs<TCtx = unknown, TBody = unknown, TParams extends z.ZodType = z.ZodUndefined> {
|
|
145
|
-
query: undefined;
|
|
146
|
-
body: TBody;
|
|
147
|
-
params: z.infer<TParams>;
|
|
148
|
-
request: Request;
|
|
149
|
-
ctx: TCtx;
|
|
150
|
-
/**
|
|
151
|
-
* Mutable headers bag that the wrapper merges into the SSE response BEFORE
|
|
152
|
-
* the stream starts. Used by `createConversationHistory` to issue a
|
|
153
|
-
* conversation-id cookie on first request. Append entries via
|
|
154
|
-
* `cookieHeaders.append('set-cookie', '<cookie-string>')`.
|
|
155
|
-
*
|
|
156
|
-
* Cookies appended AFTER the first yield are NOT applied — the response
|
|
157
|
-
* headers commit when the wrapper constructs the Response, before the
|
|
158
|
-
* async generator runs. This is per HTTP semantics, not a wrapper choice.
|
|
159
|
-
*/
|
|
160
|
-
cookieHeaders: Headers;
|
|
161
|
-
/**
|
|
162
|
-
* Phase 3 (Production-Readiness #5) — request abort signal.
|
|
163
|
-
*
|
|
164
|
-
* Fires when the SSE client disconnects (browser closes tab, abort fetch,
|
|
165
|
-
* etc.). Thread this to `agent.send(msg, { signal })` so the SDK cancels
|
|
166
|
-
* the in-flight provider call — STOPS TOKENS FROM CHARGING for output
|
|
167
|
-
* the user will never receive.
|
|
168
|
-
*
|
|
169
|
-
* EC-1 (MUST FIX): the signal is derived via duck-type detection
|
|
170
|
-
* (`'aborted' in r.signal && typeof r.signal.addEventListener === 'function'`)
|
|
171
|
-
* to survive cross-realm scenarios (Node 18 polyfills, undici, Edge
|
|
172
|
-
* runtimes with their own AbortSignal globals). `instanceof AbortSignal`
|
|
173
|
-
* would fail in those cases.
|
|
174
|
-
*/
|
|
175
|
-
signal: AbortSignal;
|
|
176
|
-
}
|
|
177
|
-
interface AgentEndpointConfig<TCtx = unknown, TBody = unknown, TParams extends z.ZodType = z.ZodUndefined> {
|
|
178
|
-
/**
|
|
179
|
-
* Optional Zod schema for path params (e.g. `z.object({ id: z.string() })`).
|
|
180
|
-
* When present, the runner validates path params and returns 400 on mismatch
|
|
181
|
-
* BEFORE the generator runs; the validated params are threaded to the
|
|
182
|
-
* generator typed as `z.infer<TParams>` (D4).
|
|
183
|
-
*/
|
|
184
|
-
params?: TParams;
|
|
185
|
-
handler: (args: AgentEndpointHandlerArgs<TCtx, TBody, TParams>) => AsyncGenerator<AgentEvent, void, unknown>;
|
|
186
|
-
}
|
|
187
|
-
declare function defineAgentEndpoint<TBody = unknown, TCtx = unknown, TParams extends z.ZodType = z.ZodUndefined>(config: AgentEndpointConfig<TCtx, TBody, TParams>): RouteConfig<z.ZodUndefined, z.ZodUndefined, TParams, TCtx, Response>;
|
|
188
|
-
|
|
189
122
|
declare function uiMessageStreamResponse(chunks: AsyncIterable<UIMessageChunk>): Response;
|
|
190
123
|
|
|
191
124
|
/**
|
|
@@ -201,8 +134,8 @@ declare function uiMessageStreamResponse(chunks: AsyncIterable<UIMessageChunk>):
|
|
|
201
134
|
* Handler error propagation:
|
|
202
135
|
* `defineAgentTool` parses the input via the Zod schema BEFORE calling the
|
|
203
136
|
* user handler. Invalid input throws a `ZodError`, which the SDK's tool-
|
|
204
|
-
* dispatcher
|
|
205
|
-
*
|
|
137
|
+
* dispatcher treats as a tool failure and surfaces to the model as a tool
|
|
138
|
+
* error (the SDK owns the wire; ADR D3).
|
|
206
139
|
*/
|
|
207
140
|
/**
|
|
208
141
|
* Local mirror of the SDK's `CustomTool` interface. We don't `import type`
|
|
@@ -310,4 +243,4 @@ declare function defineWebChannel<TMessage = unknown>(handler: WebChannelHandler
|
|
|
310
243
|
*/
|
|
311
244
|
declare function defineTheoPlugin(plugin: TheoPlugin): TheoPlugin;
|
|
312
245
|
|
|
313
|
-
export { type ActionAccept, type ActionConfig, type
|
|
246
|
+
export { type ActionAccept, type ActionConfig, type ChannelHandler, type CustomTool, type DefineAgentToolSpec, type MiddlewareHandler, type RouteConfig, type WebChannelHandler, WebSocketLike, defineAction, defineAgentTool, defineChannel, defineMiddleware, defineRoute, defineTheoPlugin, defineWebChannel, uiMessageStreamResponse };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineAction,
|
|
3
|
-
defineAgentEndpoint,
|
|
4
3
|
defineAgentTool,
|
|
5
4
|
defineChannel,
|
|
6
5
|
defineMiddleware,
|
|
@@ -8,9 +7,11 @@ import {
|
|
|
8
7
|
defineTheoPlugin,
|
|
9
8
|
defineWebChannel,
|
|
10
9
|
defineWebSocket,
|
|
11
|
-
defineWebSocketWeb
|
|
10
|
+
defineWebSocketWeb
|
|
11
|
+
} from "../../chunk-KGFNWIMS.js";
|
|
12
|
+
import {
|
|
12
13
|
uiMessageStreamResponse
|
|
13
|
-
} from "../../chunk-
|
|
14
|
+
} from "../../chunk-JZHT3LW7.js";
|
|
14
15
|
import {
|
|
15
16
|
HEALTH_PATH,
|
|
16
17
|
READY_PATH,
|
|
@@ -23,7 +24,6 @@ export {
|
|
|
23
24
|
HEALTH_PATH,
|
|
24
25
|
READY_PATH,
|
|
25
26
|
defineAction,
|
|
26
|
-
defineAgentEndpoint,
|
|
27
27
|
defineAgentTool,
|
|
28
28
|
defineChannel,
|
|
29
29
|
defineHealthRoute,
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
runMiddlewareAndContext,
|
|
25
25
|
sendError,
|
|
26
26
|
sendJson
|
|
27
|
-
} from "../../chunk-
|
|
27
|
+
} from "../../chunk-H243MR3F.js";
|
|
28
28
|
import "../../chunk-GY5Q27BJ.js";
|
|
29
|
-
import "../../chunk-
|
|
29
|
+
import "../../chunk-Z5IGLBWE.js";
|
|
30
30
|
import "../../chunk-ZEGYW52B.js";
|
|
31
31
|
import "../../chunk-TSLSIRBR.js";
|
|
32
32
|
import "../../chunk-UD3LFGDL.js";
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { RouteConfig } from './define/index.js';
|
|
2
|
-
export { ActionAccept, ActionConfig,
|
|
2
|
+
export { ActionAccept, ActionConfig, ChannelHandler, CustomTool, DefineAgentToolSpec, MiddlewareHandler, WebChannelHandler, defineAction, defineAgentTool, defineChannel, defineMiddleware, defineRoute, defineTheoPlugin, defineWebChannel, uiMessageStreamResponse } from './define/index.js';
|
|
3
3
|
export { W as WebSocketHandler, a as WebSocketHandlerWeb, b as WebSocketLike, d as defineWebSocket, c as defineWebSocketWeb } from '../define-websocket-CdK94O-D.js';
|
|
4
4
|
export { H as HEALTH_PATH, a as HealthRouteConfig, b as READY_PATH, c as ReadyRouteConfig, d as ReservedResponse, R as ReservedRoutes, e as defineHealthRoute, f as defineReadyRoute, s as serveReservedRoute } from '../health-route-C0hk64_U.js';
|
|
5
5
|
export { B as BATCH_PATH, a as BatchExecuteFn, b as BatchPathConflictError, c as BatchPayload, d as BatchRequestItem, e as BatchResponse, f as BatchResultItem, C as CookieOptions, g as CorsConfig, h as CorsHandler, i as CorsOrigin, j as CorsWebHandler, k as CustomErrorPages, E as ExecuteActionOptions, l as ExecuteRouteContext, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, m as MiddlewareResult, N as NotFoundError, S as STRIPPED_HEADERS, n as SendErrorInput, o as SendErrorOptions, T as TRACE_HEADER, p as TRACE_PARENT_HEADER, q as TheoError, r as TheoTransformer, _ as _resetMiddlewareCacheForTests, s as appendCookieToHeaders, t as appendDeleteCookieToHeaders, u as createCorsHandler, v as createCorsWebHandler, w as deleteCookie, x as envelopeCodeToStatus, y as executeAction, z as executeRoute, A as extractTraceId, D as extractTraceIdFromRequest, F as fromUnknown, G as getCookie, I as getCookieFromRequest, J as handleBatchRequest, K as handleRequestError, L as handleWebRequestError, O as jsonTransformer, P as loadCustomErrorPages, Q as matchesOrigin, R as parseCookieHeader, U as parseTraceparent, V as resolveTransformer, W as runMiddlewareAndContext, X as sendError, Y as sendJson, Z as serializeCookie, $ as serveStaticFile, a0 as serverErrorToEnvelope, a1 as setCookie, a2 as superjsonTransformer } from '../index-B40qUSrQ.js';
|
|
6
|
-
export { ActionNode, ActionScanError, LoadedManifest, ManifestAction, ManifestRoute, ManifestWebSocket, TheoManifest, WebSocketRouteNode, generateManifest, loadManifest, scanMiddlewares, scanServerActions, scanServerActionsEnriched, scanServerRoutes, scanWebSocketRoutes, writeManifest } from './scan/index.js';
|
|
6
|
+
export { ActionNode, ActionScanError, LoadedManifest, ManifestAction, ManifestAgent, ManifestRoute, ManifestWebSocket, TheoManifest, WebSocketRouteNode, generateManifest, loadManifest, scanMiddlewares, scanServerActions, scanServerActionsEnriched, scanServerRoutes, scanWebSocketRoutes, writeManifest } from './scan/index.js';
|
|
7
7
|
export { L as LoadModule, S as ServerRouteNode, c as compilePattern, a as createProductionLoader, b as createViteLoader, m as matchRoute } from '../match-CfbEFRG4.js';
|
|
8
8
|
import { T as TheoErrorEnvelope, a as TheoErrorCode, V as ValidationFieldsExt } from '../error-envelope-BsNzzAV5.js';
|
|
9
|
-
export { AgentRunLike, AgentRunResult, AgentRunStreamMessage, ConversationHistoryArgs, ConversationHistoryResult, ConversationStorageLike, SdkAgent, SdkAgentOptions, SdkRunLike, createConversationHistory, errorToEvent, streamAgentRun } from './agent/index.js';
|
|
10
|
-
export { a as AgentErrorEvent, A as AgentEvent, b as AgentMessageEvent, f as AgentRunErrorCode, c as AgentThinkingEvent, d as AgentToolCallEvent, e as AgentToolResultEvent } from '../agent-events-DosDXkSV.js';
|
|
11
9
|
export { AuthRequiredError, BackupCode, BackupCodeOptions, OidcMetadata, PkceChallenge, SessionConfig, SessionManager, SessionManagerWeb, SessionMeta, ThrottleOptions, ThrottleState, TotpAlgorithm, TotpOptions, TotpUriOptions, VerifyTotpOptions, _resetKeyCacheForTests, assertProductionSecret, checkThrottle, clearOidcCache, createSessionManager, createSessionManagerWeb, decrypt, discoverOidcProvider, encrypt, generateBackupCodes, generateNonce, generateOAuthState, generatePkceChallenge, generateTotp, generateTotpSecret, pkceChallengeFromVerifier, recordAttempt, requireAuth, rotateIfNeeded, rotateIfNeededWeb, totpUri, verifyBackupCode, verifyOAuthState, verifyTotp } from './auth/index.js';
|
|
12
10
|
export { InMemoryUsageStorage, ToolHookEvent, ToolUsageRecord, TrackAgentRunInput, TrackAgentRunOptions, TrackAgentToolsHooks, TrackAgentToolsOptions, UsageQuery, UsageRecord, UsageResult, UsageStorageAdapter, trackAgentRun, trackAgentTools } from './cost/index.js';
|
|
13
11
|
export { CRON_MANIFEST_SCHEMA_VERSION, CronConcurrencyPolicy, CronContext, CronDefinition, CronManifest, CronManifestEntry, CronNode, CronOptions, CronScheduler, DuplicateCronNameError, ExistingConfigUnparseableError, buildCronManifest, convertToAwsCron, createCronScheduler, defineCron, scanCrons, translateCronToAws, translateCronToCloudflare, translateCronToDeno, translateCronToVercel, validateCronSchedule, writeCronManifest } from './cron/index.js';
|