theokit 0.12.0 → 0.13.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-EIPXX4ZB.js} +3 -3
- package/dist/adapters/web-shim.d.ts +67 -0
- package/dist/adapters/ws-shim.d.ts +55 -0
- package/dist/agent-events-DosDXkSV.d.ts +94 -0
- 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-7PBFWZUE.js} +3 -3
- package/dist/{app-typed-client-QG7BVZYW.js → app-typed-client-CSOK7NPC.js} +6 -6
- package/dist/audit-log-BQWM5YLG.d.ts +60 -0
- package/dist/body-parser-web-FV5HWCY3.js +71 -0
- package/dist/body-parser-web-FV5HWCY3.js.map +1 -0
- package/dist/boot/index.d.ts +39 -0
- package/dist/{build-QFRLSEZ4.js → build-HXND27XG.js} +11 -11
- package/dist/{chunk-223EFY5X.js → chunk-2J7XU3PW.js} +68 -27
- package/dist/chunk-2J7XU3PW.js.map +1 -0
- package/dist/{chunk-RESN62GB.js → chunk-2KZQPDYR.js} +5 -48
- package/dist/chunk-2KZQPDYR.js.map +1 -0
- package/dist/chunk-3S3BNW5K.js +445 -0
- package/dist/chunk-3S3BNW5K.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-EXP56GFQ.js +52 -0
- package/dist/chunk-EXP56GFQ.js.map +1 -0
- package/dist/chunk-F4YUPDJ2.js +115 -0
- package/dist/chunk-F4YUPDJ2.js.map +1 -0
- package/dist/{chunk-NAZ4E2GT.js → chunk-KXA37ONC.js} +2 -2
- package/dist/chunk-NHJMZCAS.js +32 -0
- package/dist/chunk-NHJMZCAS.js.map +1 -0
- package/dist/{chunk-43D6XNDR.js → chunk-O62MW4MT.js} +91 -18
- package/dist/chunk-O62MW4MT.js.map +1 -0
- package/dist/chunk-RSVN727G.js +1 -0
- package/dist/{chunk-7CBRKNQA.js → chunk-RYTZYFSD.js} +198 -6
- package/dist/chunk-RYTZYFSD.js.map +1 -0
- package/dist/chunk-UNLA45FY.js +235 -0
- package/dist/chunk-UNLA45FY.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-AD74EAK3.js → chunk-ZSTZXR2D.js} +1 -30
- package/dist/chunk-ZSTZXR2D.js.map +1 -0
- package/dist/cli/index.js +5 -5
- package/dist/client/index.d.ts +418 -0
- package/dist/client/index.js +84 -3
- package/dist/client/index.js.map +1 -1
- package/dist/csrf-BBrEZSBW.d.ts +107 -0
- package/dist/csrf-readiness-store-CjIoub3U.d.ts +43 -0
- package/dist/define-websocket-CdK94O-D.d.ts +64 -0
- package/dist/{dev-GBXOTXUP.js → dev-OWW4XVIH.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/devtools/entry.d.ts +5 -0
- package/dist/error-envelope-BsNzzAV5.d.ts +62 -0
- package/dist/health-route-C0hk64_U.d.ts +57 -0
- package/dist/index-B40qUSrQ.d.ts +575 -0
- package/dist/index.d.ts +361 -0
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/internal-api-4YTJDITC.js +83 -0
- package/dist/internal-api-EFKZWIYZ.js +66 -0
- package/dist/internal-api-EFKZWIYZ.js.map +1 -0
- package/dist/job-backend-CgC8Xf33.d.ts +68 -0
- package/dist/match-CfbEFRG4.d.ts +26 -0
- package/dist/{openapi-VR6AFBLJ.js → openapi-FHY6HC6I.js} +7 -7
- package/dist/plugin-runner-BGBkzgi0.d.ts +95 -0
- package/dist/plugin-types-DNJGxr4Z.d.ts +79 -0
- package/dist/rate-limit-BdNDZ3vt.d.ts +58 -0
- package/dist/rate-limit-store-BEJnhWdw.d.ts +72 -0
- package/dist/react-query/index.d.ts +33 -0
- package/dist/{registry-Q2TZQLUH.js → registry-34LL7NF4.js} +1 -1
- package/dist/{routes-LRYOIIAI.js → routes-EW7TP7NJ.js} +2 -2
- package/dist/schema-BpH6ivDY.d.ts +74 -0
- package/dist/server/agent/index.d.ts +229 -0
- package/dist/server/agent/index.js +2 -1
- package/dist/server/auth/index.d.ts +419 -0
- package/dist/server/cost/index.d.ts +177 -0
- package/dist/server/cron/index.d.ts +208 -0
- package/dist/server/define/index.d.ts +313 -0
- package/dist/server/define/index.js +4 -2
- package/dist/server/http/index.d.ts +11 -0
- package/dist/server/index.d.ts +848 -0
- package/dist/server/index.js +9 -294
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.d.ts +348 -0
- package/dist/server/observability/index.d.ts +324 -0
- package/dist/server/plugins/index.d.ts +17 -0
- package/dist/server/rate-limit/index.d.ts +105 -0
- package/dist/server/realtime/index.d.ts +15 -0
- package/dist/server/scan/index.d.ts +126 -0
- package/dist/server/scan/index.js +1 -1
- package/dist/server/security/index.d.ts +193 -0
- package/dist/server/storage/index.d.ts +22 -0
- package/dist/server/webhook/index.d.ts +148 -0
- package/dist/{start-3ZHAXSJE.js → start-KIQ5TTLR.js} +76 -13
- package/dist/start-KIQ5TTLR.js.map +1 -0
- package/dist/storage-manager-C4jsO0Tp.d.ts +89 -0
- package/dist/storage-types-DsDTCPbp.d.ts +96 -0
- package/dist/vite-plugin/index.d.ts +115 -0
- package/dist/vite-plugin/index.js +6 -4
- package/dist/{vite-plugin-WO72VLYR.js → vite-plugin-RK66K26Z.js} +7 -7
- package/dist/vite-plugin-RK66K26Z.js.map +1 -0
- package/package.json +4 -4
- 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.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.map +0 -1
- 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-EIPXX4ZB.js.map} +0 -0
- /package/dist/{app-typed-client-5GYEOYP3.js.map → app-typed-client-7PBFWZUE.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-HXND27XG.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/{dev-GBXOTXUP.js.map → dev-OWW4XVIH.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/{vite-plugin-WO72VLYR.js.map → internal-api-4YTJDITC.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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error envelope — canonical cross-layer contract for theokit framework, SDK,
|
|
3
|
+
* and UI per plan g5-error-envelope-cross-layer v1.0 § Phase 1 / T1.1.
|
|
4
|
+
*
|
|
5
|
+
* Blueprint G5 (SHIPPABLE_WITH_CAVEATS 89/100) — Form 4 Hybrid: shared CODE
|
|
6
|
+
* enum + per-domain extensions + 2-layer SDK boundary translation.
|
|
7
|
+
*
|
|
8
|
+
* 3/3 references convergence: code + message + cause base (trpc TRPCError
|
|
9
|
+
* + hono HTTPException + encore Error). Wasp confirms ecosystem gap.
|
|
10
|
+
*
|
|
11
|
+
* Reference anchors (verified file:line):
|
|
12
|
+
* - referencia: trpc/packages/server/src/unstable-core-do-not-import/error/TRPCError.ts:65-87
|
|
13
|
+
* - referencia: trpc/packages/server/src/unstable-core-do-not-import/rpc/codes.ts:11-44,76-81
|
|
14
|
+
* - referencia: hono/src/http-exception.ts:46-78
|
|
15
|
+
* - referencia: encore/runtimes/go/beta/errs/error.go:38-55 (Go — D4 disclaimer applied)
|
|
16
|
+
*
|
|
17
|
+
* Per blueprint ADR D2: retryable + hint are extension slots, NOT base fields
|
|
18
|
+
* (3/3 references derive retryability from code identity; no reference ships
|
|
19
|
+
* a `retryable: boolean` on envelope; `hint` is novel).
|
|
20
|
+
*
|
|
21
|
+
* Per blueprint ADR D5: server-only `meta` filtered at serializer boundary
|
|
22
|
+
* (encore `json:"-"` analog).
|
|
23
|
+
*
|
|
24
|
+
* Lives in `core/contracts/` per architecture.md v3 — canonical home for
|
|
25
|
+
* shared client↔server types. Zero intra-monorepo deps; zero runtime deps
|
|
26
|
+
* (trpc + hono ship envelope with zero runtime deps per blueprint Q5).
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Canonical TheoKit error code union. HTTP-status flavor + SDK/agent-domain
|
|
30
|
+
* additions per blueprint Recommendations § concrete shape.
|
|
31
|
+
*
|
|
32
|
+
* String-literal union mirrors trpc's TRPC_ERROR_CODE_KEY pattern — enables
|
|
33
|
+
* exhaustive `switch (env.code)` narrowing in consumer code (UI display
|
|
34
|
+
* dispatch, retry-policy gates, telemetry classification).
|
|
35
|
+
*/
|
|
36
|
+
type TheoErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'METHOD_NOT_ALLOWED' | 'CONFLICT' | 'PRECONDITION_FAILED' | 'PAYLOAD_TOO_LARGE' | 'UNSUPPORTED_MEDIA_TYPE' | 'UNPROCESSABLE_ENTITY' | 'TOO_MANY_REQUESTS' | 'INTERNAL_SERVER_ERROR' | 'NOT_IMPLEMENTED' | 'BAD_GATEWAY' | 'SERVICE_UNAVAILABLE' | 'GATEWAY_TIMEOUT' | 'AGENT_RUN_ERROR' | 'PROVIDER_KEY_MISSING' | 'BUDGET_EXCEEDED' | 'RATE_LIMITED' | 'CREDENTIAL_POOL_EXHAUSTED';
|
|
37
|
+
/**
|
|
38
|
+
* Base envelope shape — `{ code, message, cause?, meta?, ext? }`.
|
|
39
|
+
*
|
|
40
|
+
* `cause` follows TC39 proposal-error-cause (universal pattern, 3/3 references).
|
|
41
|
+
* `meta` is server-only metadata filtered at serializer boundary per ADR D5
|
|
42
|
+
* (`stack` is auto-stripped in non-dev builds — see T1.2 `TheoError.toJSON()`).
|
|
43
|
+
* `ext` carries opt-in per-domain extensions (`ValidationFieldsExt`,
|
|
44
|
+
* `RetryableExt`, `HintExt`, or arbitrary user-defined types via formatter hook).
|
|
45
|
+
*/
|
|
46
|
+
interface TheoErrorEnvelope<TExt = unknown> {
|
|
47
|
+
readonly code: TheoErrorCode;
|
|
48
|
+
readonly message: string;
|
|
49
|
+
readonly cause?: unknown;
|
|
50
|
+
readonly meta?: Record<string, unknown>;
|
|
51
|
+
readonly ext?: TExt;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `ValidationFieldsExt` — validation-failure extension carrying the dot-notation
|
|
55
|
+
* field map identical to G3 `ActionInputError.fields`. Empty-string key for
|
|
56
|
+
* root-level errors (mirrors G3 EC-7). Multiple messages per key are preserved.
|
|
57
|
+
*/
|
|
58
|
+
interface ValidationFieldsExt {
|
|
59
|
+
readonly fields: Record<string, string[]>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type { TheoErrorEnvelope as T, ValidationFieldsExt as V, TheoErrorCode as a };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M7-2 — health/ready reserved routes for the convention/filesystem-route
|
|
3
|
+
* server. Liveness (`/__theo/health`, always 200) and readiness
|
|
4
|
+
* (`/__theo/ready`, 200/503 from a probe) are registered on a reserved
|
|
5
|
+
* namespace BEFORE the user-route catch-all + 404 branch — mirroring nitro's
|
|
6
|
+
* `/_nitro/*` reserved-namespace pattern (knowledge-base/references/nitro/src/
|
|
7
|
+
* runtime/internal/routes/dev-tasks.ts). Liveness and readiness are kept
|
|
8
|
+
* separate by design: liveness says "the process is up", readiness says
|
|
9
|
+
* "dependencies are up".
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
/** Reserved path for the liveness endpoint. */
|
|
14
|
+
declare const HEALTH_PATH = "/__theo/health";
|
|
15
|
+
/** Reserved path for the readiness endpoint. */
|
|
16
|
+
declare const READY_PATH = "/__theo/ready";
|
|
17
|
+
/** Config produced by {@link defineHealthRoute}. */
|
|
18
|
+
interface HealthRouteConfig {
|
|
19
|
+
readonly kind: 'health';
|
|
20
|
+
/** Returns the liveness body (auto-serialized to JSON). Default: `{ status: 'ok' }`. */
|
|
21
|
+
readonly handler: () => unknown;
|
|
22
|
+
}
|
|
23
|
+
/** Config produced by {@link defineReadyRoute}. */
|
|
24
|
+
interface ReadyRouteConfig {
|
|
25
|
+
readonly kind: 'ready';
|
|
26
|
+
/** Resolves `true` when dependencies are ready. A throw/reject is treated as not-ready (503). */
|
|
27
|
+
readonly probe: () => boolean | Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
/** The reserved-route registry consulted by {@link serveReservedRoute}. */
|
|
30
|
+
interface ReservedRoutes {
|
|
31
|
+
readonly health?: HealthRouteConfig;
|
|
32
|
+
readonly ready?: ReadyRouteConfig;
|
|
33
|
+
}
|
|
34
|
+
/** A reserved-route response: an HTTP status + a JSON-serializable body. */
|
|
35
|
+
interface ReservedResponse {
|
|
36
|
+
readonly status: number;
|
|
37
|
+
readonly body: unknown;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Define the liveness route. The default handler returns `{ status: 'ok' }`.
|
|
41
|
+
* Liveness is always 200 — it asserts the process is up, not that dependencies are.
|
|
42
|
+
*/
|
|
43
|
+
declare function defineHealthRoute(handler?: () => unknown): HealthRouteConfig;
|
|
44
|
+
/**
|
|
45
|
+
* Define the readiness route. The `probe` decides 200 (ready) vs 503 (not-ready).
|
|
46
|
+
* A probe that throws/rejects is treated as not-ready (503) — never a 500 crash.
|
|
47
|
+
*/
|
|
48
|
+
declare function defineReadyRoute(probe: () => boolean | Promise<boolean>): ReadyRouteConfig;
|
|
49
|
+
/**
|
|
50
|
+
* Pure dispatcher: map a request pathname to a reserved-route response, or
|
|
51
|
+
* `null` when the path is not reserved (so the user catch-all + 404 take over).
|
|
52
|
+
* Liveness defaults to 200 `{status:'ok'}`; readiness without a probe is
|
|
53
|
+
* trivially ready (200). Registered BEFORE the user catch-all by the caller.
|
|
54
|
+
*/
|
|
55
|
+
declare function serveReservedRoute(pathname: string, routes?: ReservedRoutes): Promise<ReservedResponse | null>;
|
|
56
|
+
|
|
57
|
+
export { HEALTH_PATH as H, type ReservedRoutes as R, type HealthRouteConfig as a, READY_PATH as b, type ReadyRouteConfig as c, type ReservedResponse as d, defineHealthRoute as e, defineReadyRoute as f, serveReservedRoute as s };
|