rivetkit 2.3.3-rc.1 → 2.3.3-rc.2
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/browser/client.d.ts +1 -0
- package/dist/browser/client.js +9 -6
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +22 -2
- package/dist/browser/inspector/client.js +996 -222
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/agent-os/index.cjs +9 -6
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +1 -0
- package/dist/tsup/agent-os/index.d.ts +1 -0
- package/dist/tsup/agent-os/index.js +9 -6
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-KVSK67EL.cjs → chunk-6JRGYOBR.cjs} +18 -10
- package/dist/tsup/chunk-6JRGYOBR.cjs.map +1 -0
- package/dist/tsup/{chunk-TXO4XNNB.js → chunk-CLQHFXG3.js} +2 -2
- package/dist/tsup/{chunk-VEJGWALU.cjs → chunk-GRXM3FQX.cjs} +3 -3
- package/dist/tsup/{chunk-VEJGWALU.cjs.map → chunk-GRXM3FQX.cjs.map} +1 -1
- package/dist/tsup/{chunk-T5YE5THK.cjs → chunk-LIZO2BE3.cjs} +24 -4
- package/dist/tsup/chunk-LIZO2BE3.cjs.map +1 -0
- package/dist/tsup/{chunk-EIB2XNTL.js → chunk-OUIOGTEL.js} +12 -4
- package/dist/tsup/chunk-OUIOGTEL.js.map +1 -0
- package/dist/tsup/{chunk-CN4IAGVP.cjs → chunk-Q3DY23PN.cjs} +141 -141
- package/dist/tsup/{chunk-CN4IAGVP.cjs.map → chunk-Q3DY23PN.cjs.map} +1 -1
- package/dist/tsup/{chunk-J7NGTEDW.js → chunk-Q6EIXJ2L.js} +3 -3
- package/dist/tsup/{chunk-GMD47RV5.cjs → chunk-QIRZKXPN.cjs} +5 -5
- package/dist/tsup/{chunk-GMD47RV5.cjs.map → chunk-QIRZKXPN.cjs.map} +1 -1
- package/dist/tsup/{chunk-3UWWME7J.js → chunk-QRPFFGZB.js} +22 -2
- package/dist/tsup/chunk-QRPFFGZB.js.map +1 -0
- package/dist/tsup/{chunk-CFVNICL7.cjs → chunk-QXKIL5NU.cjs} +7 -7
- package/dist/tsup/{chunk-CFVNICL7.cjs.map → chunk-QXKIL5NU.cjs.map} +1 -1
- package/dist/tsup/{chunk-MLFI5BLT.cjs → chunk-SNTYTMHE.cjs} +12 -8
- package/dist/tsup/chunk-SNTYTMHE.cjs.map +1 -0
- package/dist/tsup/{chunk-2ZBWR7HC.js → chunk-URLGKL2B.js} +2 -2
- package/dist/tsup/{chunk-D5KMS3WU.js → chunk-VPKNVMUA.js} +11 -7
- package/dist/tsup/chunk-VPKNVMUA.js.map +1 -0
- package/dist/tsup/{chunk-VNWYKWBM.js → chunk-ZEBW32PT.js} +7 -7
- package/dist/tsup/client/mod.cjs +7 -7
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +6 -6
- package/dist/tsup/common/log.cjs +4 -2
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +5 -3
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-CzvopP5m.d.cts → config-BfBhjEbk.d.cts} +1 -0
- package/dist/tsup/{config-DZuT7tcp.d.ts → config-ZkIsRFsN.d.ts} +1 -0
- package/dist/tsup/{context-CyAdY-aA.d.ts → context-B7-84u9K.d.ts} +2 -1
- package/dist/tsup/{context-sNB28g0N.d.cts → context-sZ9GlaBK.d.cts} +2 -1
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/inspector/mod.cjs +46 -11
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +37 -15
- package/dist/tsup/inspector/mod.d.ts +37 -15
- package/dist/tsup/inspector/mod.js +45 -10
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector-tab/mod.cjs +1 -12
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
- package/dist/tsup/inspector-tab/mod.d.cts +3 -13
- package/dist/tsup/inspector-tab/mod.d.ts +3 -13
- package/dist/tsup/inspector-tab/mod.js +0 -11
- package/dist/tsup/inspector-tab/mod.js.map +1 -1
- package/dist/tsup/mod.cjs +121 -62
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +66 -7
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +10 -10
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +10 -7
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +7 -4
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +8 -8
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/transport/v1.ts +36 -0
- package/src/common/log.ts +14 -8
- package/src/inspector/client.browser.ts +73 -16
- package/src/inspector/mod.ts +1 -1
- package/src/inspector-tab/mod.ts +0 -15
- package/src/registry/index.ts +4 -0
- package/src/registry/napi-runtime.ts +11 -0
- package/src/registry/native.ts +70 -2
- package/src/registry/runtime.ts +1 -0
- package/src/registry/wasm-runtime.ts +5 -0
- package/src/workflow/context.ts +4 -0
- package/src/workflow/inspector.ts +8 -0
- package/dist/tsup/chunk-3UWWME7J.js.map +0 -1
- package/dist/tsup/chunk-D5KMS3WU.js.map +0 -1
- package/dist/tsup/chunk-EIB2XNTL.js.map +0 -1
- package/dist/tsup/chunk-KVSK67EL.cjs.map +0 -1
- package/dist/tsup/chunk-MLFI5BLT.cjs.map +0 -1
- package/dist/tsup/chunk-T5YE5THK.cjs.map +0 -1
- /package/dist/tsup/{chunk-TXO4XNNB.js.map → chunk-CLQHFXG3.js.map} +0 -0
- /package/dist/tsup/{chunk-J7NGTEDW.js.map → chunk-Q6EIXJ2L.js.map} +0 -0
- /package/dist/tsup/{chunk-2ZBWR7HC.js.map → chunk-URLGKL2B.js.map} +0 -0
- /package/dist/tsup/{chunk-VNWYKWBM.js.map → chunk-ZEBW32PT.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/inspector-tab/mod.ts"],"sourcesContent":["/**\n * Type and schema declarations for custom Rivet inspector tabs.\n *\n * Everything here is **derived from runtime Zod schemas** that the\n * dashboard and rivetkit itself use, so the published types cannot\n * drift from the wire format. There are three sources of truth:\n *\n * 1. The `inspector.tabs[]` actor-config Zod schemas in\n * `../actor/config.ts` — re-exported below. These validate the\n * authoring surface (`defineActor({ inspector: { tabs: [...] } })`).\n * 2. The dashboard ↔ tab postMessage envelopes defined in this file.\n * The inspector-ui SPA (`frontend/apps/inspector-ui/src/bridge.ts`)\n * imports the same schemas to validate messages at runtime, so any\n * change here lands on both ends in lockstep.\n * 3. The inspector HTTP endpoint response schemas defined in this\n * file. The dashboard parses every response through them; if the\n * Rust handler ever emits a different shape, the dashboard fails\n * loudly at the parse step instead of silently casting `unknown`.\n *\n * Tab bundles import these types for autocomplete and compile-time\n * safety:\n *\n * ```ts\n * import type {\n * ShellToTabMessage,\n * TabToShellMessage,\n * V1Init,\n * InspectorStateResponse,\n * } from \"rivetkit/inspector-tab\";\n * ```\n */\n\nimport { z } from \"zod\";\n\n// ============================================================================\n// Re-exported from `../actor/config.ts` — the authoring schema for\n// `defineActor({ inspector: { tabs: [...] } })`.\n// ============================================================================\n\nexport type { ActorInspectorConfig } from \"../actor/config\";\nexport {\n\tActorInspectorConfigSchema,\n\tBUILTIN_INSPECTOR_TAB_IDS,\n\tBuiltinInspectorTabIdSchema,\n\tCustomInspectorTabEntrySchema,\n\tHideInspectorTabEntrySchema,\n\tInspectorTabEntrySchema,\n} from \"../actor/config\";\n\nimport type {\n\tCustomInspectorTabEntrySchema,\n\tHideInspectorTabEntrySchema,\n\tInspectorTabEntrySchema,\n} from \"../actor/config\";\n\n/** One entry in the actor's `inspector.tabs[]` declaration. */\nexport type ActorInspectorTabEntry = z.input<typeof InspectorTabEntrySchema>;\n/** A custom-tab entry — adds a new tab to the dashboard strip. */\nexport type ActorCustomInspectorTabEntry = z.input<\n\ttypeof CustomInspectorTabEntrySchema\n>;\n/** A hide modifier — removes a built-in tab from the strip. */\nexport type ActorHideInspectorTabEntry = z.input<\n\ttypeof HideInspectorTabEntrySchema\n>;\n/** Union of the six built-in inspector tab ids. */\nexport type BuiltinInspectorTabId =\n\t| \"workflow\"\n\t| \"database\"\n\t| \"state\"\n\t| \"queue\"\n\t| \"connections\"\n\t| \"console\";\n\n// ============================================================================\n// Dashboard ↔ tab postMessage envelope (source of truth).\n//\n// These Zod schemas are imported by `frontend/apps/inspector-ui/src/bridge.ts`\n// and used to validate inbound messages at runtime. Changes here flow to\n// both sides in a single commit.\n// ============================================================================\n\n/** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */\nexport const InspectorTabDescriptorSchema = z.object({\n\tid: z.string(),\n\tlabel: z.string(),\n\ticon: z.string(),\n\t/**\n\t * `true` for author-shipped custom tabs; absent or `false` for\n\t * built-in tabs the SPA renders. Lets the dashboard route the\n\t * iframe `src` to `/inspector/custom-tabs/<id>/` for custom tabs and\n\t * `/inspector/ui/` for built-ins without the dashboard needing to\n\t * know which ids are built-in.\n\t */\n\tisCustom: z.boolean().optional(),\n});\n\n/**\n * Initial handshake from the dashboard. Sent on first mount and again on\n * every token refresh. Tabs MUST accept late `init` messages and replace\n * the cached token.\n */\nexport const V1InitSchema = z.object({\n\ttype: z.literal(\"init\"),\n\tv: z.literal(1),\n\t/** The actor this tab is mounted for. */\n\tactorId: z.string(),\n\t/**\n\t * Per-actor inspector bearer token. Tabs include it as\n\t * `Authorization: Bearer ${authToken}` on every authenticated fetch.\n\t */\n\tauthToken: z.string(),\n\t/**\n\t * Outer Rivet API token. Optional; not required for inspector HTTP\n\t * routes but available to tabs that want to call the engine REST API.\n\t */\n\trivetToken: z.string().optional(),\n\t/**\n\t * The tab id the dashboard wants active at mount time. Multi-view\n\t * tabs may read this to seed their initial route; most tabs ignore it.\n\t */\n\tactiveTab: z.string().optional(),\n\t/**\n\t * Dashboard's currently active theme. Tabs that use the shared\n\t * stylesheet (`/inspector/tab.css`) mirror it by toggling the `dark`\n\t * class on `<html>`. Optional for backwards compatibility — tabs\n\t * should default to `\"dark\"` if absent (the dashboard pinned dark\n\t * mode before this field was added).\n\t */\n\ttheme: z.enum([\"light\", \"dark\"]).optional(),\n});\n\n/**\n * Dashboard tells the inspector-ui SPA which built-in tab to render. Not\n * sent to custom tabs — when the user activates a custom tab the\n * dashboard navigates the outer iframe to a different `src`.\n */\nexport const V1SetActiveTabSchema = z.object({\n\ttype: z.literal(\"set-active-tab\"),\n\tv: z.literal(1),\n\ttab: z.string(),\n});\n\n/**\n * Tab → dashboard. Sent once after the message listener is registered.\n * The dashboard hides the \"Connecting to inspector…\" overlay on receipt;\n * if it never arrives the overlay times out after 8 s.\n */\nexport const V1ReadySchema = z.object({\n\ttype: z.literal(\"ready\"),\n\tv: z.literal(1),\n});\n\n/**\n * Tab → dashboard. Sent when the tab gets a 401 on an inspector data\n * call. The dashboard refreshes the token and re-issues `v1Init`.\n */\nexport const V1TokenRefreshNeededSchema = z.object({\n\ttype: z.literal(\"token-refresh-needed\"),\n\tv: z.literal(1),\n});\n\n/**\n * Emitted by the inspector-ui SPA to tell the dashboard which tabs to\n * render in the strip. Custom tab bundles do NOT emit this — only the\n * SPA does.\n */\nexport const V1TabsAvailableSchema = z.object({\n\ttype: z.literal(\"tabs-available\"),\n\tv: z.literal(1),\n\ttabs: z.array(InspectorTabDescriptorSchema),\n});\n\n/** Discriminated union of messages a tab can RECEIVE from the dashboard. */\nexport const ShellToTabMessageSchema = z.discriminatedUnion(\"type\", [\n\tV1InitSchema,\n\tV1SetActiveTabSchema,\n]);\n\n/** Discriminated union of messages a tab can SEND to the dashboard. */\nexport const TabToShellMessageSchema = z.discriminatedUnion(\"type\", [\n\tV1ReadySchema,\n\tV1TabsAvailableSchema,\n\tV1TokenRefreshNeededSchema,\n]);\n\nexport type InspectorTabDescriptor = z.infer<\n\ttypeof InspectorTabDescriptorSchema\n>;\nexport type V1Init = z.infer<typeof V1InitSchema>;\nexport type V1SetActiveTab = z.infer<typeof V1SetActiveTabSchema>;\nexport type V1Ready = z.infer<typeof V1ReadySchema>;\nexport type V1TokenRefreshNeeded = z.infer<typeof V1TokenRefreshNeededSchema>;\nexport type V1TabsAvailable = z.infer<typeof V1TabsAvailableSchema>;\nexport type ShellToTabMessage = z.infer<typeof ShellToTabMessageSchema>;\nexport type TabToShellMessage = z.infer<typeof TabToShellMessageSchema>;\n\n/** Stable envelope protocol version. Bump only when introducing a v2 shape. */\nexport const POSTMESSAGE_PROTOCOL_VERSION = 1;\n\n/** URL query parameters the dashboard sets on the tab iframe `src`. */\nexport const SHELL_ORIGIN_PARAM = \"shellOrigin\";\nexport const ACTOR_ID_PARAM = \"actorId\";\n\n// ============================================================================\n// Inspector HTTP endpoint response schemas (source of truth).\n//\n// The dashboard parses every authenticated inspector response through\n// these schemas (`frontend/src/components/actors/actor-inspector-context.tsx`).\n// If the Rust handler emits a different shape the parse fails and the\n// dashboard surfaces an error — drift is loud.\n// ============================================================================\n\n/** `GET /inspector/state` response shape. */\nexport const InspectorStateResponseSchema = z.object({\n\t/** Current actor state (whatever shape the actor declared). */\n\tstate: z.unknown(),\n\t/**\n\t * `false` when the actor did not declare any state — `state` is then\n\t * `null` and `PATCH /inspector/state` returns an error.\n\t */\n\tisStateEnabled: z.boolean(),\n});\n\n/** `POST /inspector/action/<name>` request body. */\nexport const InspectorActionRequestSchema = z\n\t.object({\n\t\t/** Positional arguments. Mutually exclusive with `properties`. */\n\t\targs: z.array(z.unknown()).optional(),\n\t\t/** Keyed arguments. Mutually exclusive with `args`. */\n\t\tproperties: z.record(z.string(), z.unknown()).optional(),\n\t})\n\t.refine(\n\t\t(body) => !(body.args !== undefined && body.properties !== undefined),\n\t\t\"Use either `args` or `properties`, not both\",\n\t);\n\n/** `POST /inspector/action/<name>` response shape. */\nexport const InspectorActionResponseSchema = z.object({\n\toutput: z.unknown(),\n});\n\n/** `GET /inspector/rpcs` response shape — the list of action names. */\nexport const InspectorRpcsResponseSchema = z.object({\n\trpcs: z.array(z.string()),\n});\n\n/** One connection record in `GET /inspector/connections`. */\nexport const InspectorConnectionSchema = z.object({\n\tconnectionType: z.string().nullable(),\n\tid: z.string(),\n\tdetails: z.object({\n\t\tconnectionType: z.string().nullable(),\n\t\tparams: z.unknown(),\n\t\tstateEnabled: z.boolean(),\n\t\tstate: z.unknown(),\n\t\tsubscriptions: z.number(),\n\t\tisHibernatable: z.boolean(),\n\t}),\n});\n\n/** `GET /inspector/connections` response shape. */\nexport const InspectorConnectionsResponseSchema = z.object({\n\tconnections: z.array(InspectorConnectionSchema),\n});\n\n/** One queued message in `GET /inspector/queue`. */\nexport const InspectorQueueMessageSchema = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tcreatedAtMs: z.number(),\n});\n\n/** `GET /inspector/queue` response shape. */\nexport const InspectorQueueResponseSchema = z.object({\n\tsize: z.number(),\n\tmaxSize: z.number(),\n\t/** `true` if `?limit=N` truncated the message list below `size`. */\n\ttruncated: z.boolean(),\n\tmessages: z.array(InspectorQueueMessageSchema),\n});\n\n/** `GET /inspector/tab-config` response shape. */\nexport const InspectorTabConfigResponseSchema = z.object({\n\ttabs: z.array(\n\t\tz.object({\n\t\t\tid: z.string(),\n\t\t\tlabel: z.string().optional(),\n\t\t\ticon: z.string().nullable().optional(),\n\t\t\thidden: z.boolean().optional(),\n\t\t}),\n\t),\n});\n\nexport type InspectorStateResponse = z.infer<\n\ttypeof InspectorStateResponseSchema\n>;\nexport type InspectorActionRequest = z.infer<\n\ttypeof InspectorActionRequestSchema\n>;\nexport type InspectorActionResponse = z.infer<\n\ttypeof InspectorActionResponseSchema\n>;\nexport type InspectorRpcsResponse = z.infer<typeof InspectorRpcsResponseSchema>;\nexport type InspectorConnection = z.infer<typeof InspectorConnectionSchema>;\nexport type InspectorConnectionsResponse = z.infer<\n\ttypeof InspectorConnectionsResponseSchema\n>;\nexport type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;\nexport type InspectorQueueResponse = z.infer<\n\ttypeof InspectorQueueResponseSchema\n>;\nexport type InspectorTabConfigResponse = z.infer<\n\ttypeof InspectorTabConfigResponseSchema\n>;\n"],"mappings":";;;;;;;;;;AAgCA,SAAS,SAAS;AAmDX,IAAM,+BAA+B,EAAE,OAAO;AAAA,EACpD,IAAI,EAAE,OAAO;AAAA,EACb,OAAO,EAAE,OAAO;AAAA,EAChB,MAAM,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQf,UAAU,EAAE,QAAQ,EAAE,SAAS;AAChC,CAAC;AAOM,IAAM,eAAe,EAAE,OAAO;AAAA,EACpC,MAAM,EAAE,QAAQ,MAAM;AAAA,EACtB,GAAG,EAAE,QAAQ,CAAC;AAAA;AAAA,EAEd,SAAS,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,WAAW,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKpB,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;A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Q,EAAE,QAAQ,EAAE,SAAS;AAAA,IAC9B,CAAC;AAAA,EACF;AACD,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/inspector-tab/mod.ts"],"sourcesContent":["/**\n * Type and schema declarations for custom Rivet inspector tabs.\n *\n * Everything here is **derived from runtime Zod schemas** that the\n * dashboard and rivetkit itself use, so the published types cannot\n * drift from the wire format. There are three sources of truth:\n *\n * 1. The `inspector.tabs[]` actor-config Zod schemas in\n * `../actor/config.ts` — re-exported below. These validate the\n * authoring surface (`defineActor({ inspector: { tabs: [...] } })`).\n * 2. The dashboard ↔ tab postMessage envelopes defined in this file.\n * The inspector-ui SPA (`frontend/apps/inspector-ui/src/bridge.ts`)\n * imports the same schemas to validate messages at runtime, so any\n * change here lands on both ends in lockstep.\n * 3. The inspector HTTP endpoint response schemas defined in this\n * file. The dashboard parses every response through them; if the\n * Rust handler ever emits a different shape, the dashboard fails\n * loudly at the parse step instead of silently casting `unknown`.\n *\n * Tab bundles import these types for autocomplete and compile-time\n * safety:\n *\n * ```ts\n * import type {\n * ShellToTabMessage,\n * TabToShellMessage,\n * V1Init,\n * InspectorStateResponse,\n * } from \"rivetkit/inspector-tab\";\n * ```\n */\n\nimport { z } from \"zod\";\n\n// ============================================================================\n// Re-exported from `../actor/config.ts` — the authoring schema for\n// `defineActor({ inspector: { tabs: [...] } })`.\n// ============================================================================\n\nexport type { ActorInspectorConfig } from \"../actor/config\";\nexport {\n\tActorInspectorConfigSchema,\n\tBUILTIN_INSPECTOR_TAB_IDS,\n\tBuiltinInspectorTabIdSchema,\n\tCustomInspectorTabEntrySchema,\n\tHideInspectorTabEntrySchema,\n\tInspectorTabEntrySchema,\n} from \"../actor/config\";\n\nimport type {\n\tCustomInspectorTabEntrySchema,\n\tHideInspectorTabEntrySchema,\n\tInspectorTabEntrySchema,\n} from \"../actor/config\";\n\n/** One entry in the actor's `inspector.tabs[]` declaration. */\nexport type ActorInspectorTabEntry = z.input<typeof InspectorTabEntrySchema>;\n/** A custom-tab entry — adds a new tab to the dashboard strip. */\nexport type ActorCustomInspectorTabEntry = z.input<\n\ttypeof CustomInspectorTabEntrySchema\n>;\n/** A hide modifier — removes a built-in tab from the strip. */\nexport type ActorHideInspectorTabEntry = z.input<\n\ttypeof HideInspectorTabEntrySchema\n>;\n/** Union of the six built-in inspector tab ids. */\nexport type BuiltinInspectorTabId =\n\t| \"workflow\"\n\t| \"database\"\n\t| \"state\"\n\t| \"queue\"\n\t| \"connections\"\n\t| \"console\";\n\n// ============================================================================\n// Dashboard ↔ tab postMessage envelope (source of truth).\n//\n// These Zod schemas are imported by `frontend/apps/inspector-ui/src/bridge.ts`\n// and used to validate inbound messages at runtime. Changes here flow to\n// both sides in a single commit.\n// ============================================================================\n\n/** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */\nexport const InspectorTabDescriptorSchema = z.object({\n\tid: z.string(),\n\tlabel: z.string(),\n\ticon: z.string(),\n\t/**\n\t * `true` for author-shipped custom tabs; absent or `false` for\n\t * built-in tabs the SPA renders. Lets the dashboard route the\n\t * iframe `src` to `/inspector/custom-tabs/<id>/` for custom tabs and\n\t * `/inspector/ui/` for built-ins without the dashboard needing to\n\t * know which ids are built-in.\n\t */\n\tisCustom: z.boolean().optional(),\n});\n\n/**\n * Initial handshake from the dashboard. Sent on first mount and again on\n * every token refresh. Tabs MUST accept late `init` messages and replace\n * the cached token.\n */\nexport const V1InitSchema = z.object({\n\ttype: z.literal(\"init\"),\n\tv: z.literal(1),\n\t/** The actor this tab is mounted for. */\n\tactorId: z.string(),\n\t/**\n\t * Per-actor inspector bearer token. Tabs include it as\n\t * `Authorization: Bearer ${authToken}` on every authenticated fetch.\n\t */\n\tauthToken: z.string(),\n\t/**\n\t * Outer Rivet API token. Optional; not required for inspector HTTP\n\t * routes but available to tabs that want to call the engine REST API.\n\t */\n\trivetToken: z.string().optional(),\n\t/**\n\t * The tab id the dashboard wants active at mount time. Multi-view\n\t * tabs may read this to seed their initial route; most tabs ignore it.\n\t */\n\tactiveTab: z.string().optional(),\n\t/**\n\t * Dashboard's currently active theme. Tabs that use the shared\n\t * stylesheet (`/inspector/tab.css`) mirror it by toggling the `dark`\n\t * class on `<html>`. Optional for backwards compatibility — tabs\n\t * should default to `\"dark\"` if absent (the dashboard pinned dark\n\t * mode before this field was added).\n\t */\n\ttheme: z.enum([\"light\", \"dark\"]).optional(),\n});\n\n/**\n * Dashboard tells the inspector-ui SPA which built-in tab to render. Not\n * sent to custom tabs — when the user activates a custom tab the\n * dashboard navigates the outer iframe to a different `src`.\n */\nexport const V1SetActiveTabSchema = z.object({\n\ttype: z.literal(\"set-active-tab\"),\n\tv: z.literal(1),\n\ttab: z.string(),\n});\n\n/**\n * Tab → dashboard. Sent once after the message listener is registered.\n * The dashboard hides the \"Connecting to inspector…\" overlay on receipt;\n * if it never arrives the overlay times out after 8 s.\n */\nexport const V1ReadySchema = z.object({\n\ttype: z.literal(\"ready\"),\n\tv: z.literal(1),\n});\n\n/**\n * Tab → dashboard. Sent when the tab gets a 401 on an inspector data\n * call. The dashboard refreshes the token and re-issues `v1Init`.\n */\nexport const V1TokenRefreshNeededSchema = z.object({\n\ttype: z.literal(\"token-refresh-needed\"),\n\tv: z.literal(1),\n});\n\n/**\n * Emitted by the inspector-ui SPA to tell the dashboard which tabs to\n * render in the strip. Custom tab bundles do NOT emit this — only the\n * SPA does.\n */\nexport const V1TabsAvailableSchema = z.object({\n\ttype: z.literal(\"tabs-available\"),\n\tv: z.literal(1),\n\ttabs: z.array(InspectorTabDescriptorSchema),\n});\n\n/** Discriminated union of messages a tab can RECEIVE from the dashboard. */\nexport const ShellToTabMessageSchema = z.discriminatedUnion(\"type\", [\n\tV1InitSchema,\n\tV1SetActiveTabSchema,\n]);\n\n/** Discriminated union of messages a tab can SEND to the dashboard. */\nexport const TabToShellMessageSchema = z.discriminatedUnion(\"type\", [\n\tV1ReadySchema,\n\tV1TabsAvailableSchema,\n\tV1TokenRefreshNeededSchema,\n]);\n\nexport type InspectorTabDescriptor = z.infer<\n\ttypeof InspectorTabDescriptorSchema\n>;\nexport type V1Init = z.infer<typeof V1InitSchema>;\nexport type V1SetActiveTab = z.infer<typeof V1SetActiveTabSchema>;\nexport type V1Ready = z.infer<typeof V1ReadySchema>;\nexport type V1TokenRefreshNeeded = z.infer<typeof V1TokenRefreshNeededSchema>;\nexport type V1TabsAvailable = z.infer<typeof V1TabsAvailableSchema>;\nexport type ShellToTabMessage = z.infer<typeof ShellToTabMessageSchema>;\nexport type TabToShellMessage = z.infer<typeof TabToShellMessageSchema>;\n\n/** Stable envelope protocol version. Bump only when introducing a v2 shape. */\nexport const POSTMESSAGE_PROTOCOL_VERSION = 1;\n\n/** URL query parameters the dashboard sets on the tab iframe `src`. */\nexport const SHELL_ORIGIN_PARAM = \"shellOrigin\";\nexport const ACTOR_ID_PARAM = \"actorId\";\n\n// ============================================================================\n// Inspector HTTP endpoint response schemas (source of truth).\n//\n// The dashboard parses every authenticated inspector response through\n// these schemas (`frontend/src/components/actors/actor-inspector-context.tsx`).\n// If the Rust handler emits a different shape the parse fails and the\n// dashboard surfaces an error — drift is loud.\n// ============================================================================\n\n/** `GET /inspector/state` response shape. */\nexport const InspectorStateResponseSchema = z.object({\n\t/** Current actor state (whatever shape the actor declared). */\n\tstate: z.unknown(),\n\t/**\n\t * `false` when the actor did not declare any state — `state` is then\n\t * `null` and `PATCH /inspector/state` returns an error.\n\t */\n\tisStateEnabled: z.boolean(),\n});\n\n/** `POST /inspector/action/<name>` request body. */\nexport const InspectorActionRequestSchema = z\n\t.object({\n\t\t/** Positional arguments. Mutually exclusive with `properties`. */\n\t\targs: z.array(z.unknown()).optional(),\n\t\t/** Keyed arguments. Mutually exclusive with `args`. */\n\t\tproperties: z.record(z.string(), z.unknown()).optional(),\n\t})\n\t.refine(\n\t\t(body) => !(body.args !== undefined && body.properties !== undefined),\n\t\t\"Use either `args` or `properties`, not both\",\n\t);\n\n/** `POST /inspector/action/<name>` response shape. */\nexport const InspectorActionResponseSchema = z.object({\n\toutput: z.unknown(),\n});\n\n/** `GET /inspector/rpcs` response shape — the list of action names. */\nexport const InspectorRpcsResponseSchema = z.object({\n\trpcs: z.array(z.string()),\n});\n\n/** One connection record in `GET /inspector/connections`. */\nexport const InspectorConnectionSchema = z.object({\n\tconnectionType: z.string().nullable(),\n\tid: z.string(),\n\tdetails: z.object({\n\t\tconnectionType: z.string().nullable(),\n\t\tparams: z.unknown(),\n\t\tstateEnabled: z.boolean(),\n\t\tstate: z.unknown(),\n\t\tsubscriptions: z.number(),\n\t\tisHibernatable: z.boolean(),\n\t}),\n});\n\n/** `GET /inspector/connections` response shape. */\nexport const InspectorConnectionsResponseSchema = z.object({\n\tconnections: z.array(InspectorConnectionSchema),\n});\n\n/** One queued message in `GET /inspector/queue`. */\nexport const InspectorQueueMessageSchema = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tcreatedAtMs: z.number(),\n});\n\n/** `GET /inspector/queue` response shape. */\nexport const InspectorQueueResponseSchema = z.object({\n\tsize: z.number(),\n\tmaxSize: z.number(),\n\t/** `true` if `?limit=N` truncated the message list below `size`. */\n\ttruncated: z.boolean(),\n\tmessages: z.array(InspectorQueueMessageSchema),\n});\n\nexport type InspectorStateResponse = z.infer<\n\ttypeof InspectorStateResponseSchema\n>;\nexport type InspectorActionRequest = z.infer<\n\ttypeof InspectorActionRequestSchema\n>;\nexport type InspectorActionResponse = z.infer<\n\ttypeof InspectorActionResponseSchema\n>;\nexport type InspectorRpcsResponse = z.infer<typeof InspectorRpcsResponseSchema>;\nexport type InspectorConnection = z.infer<typeof InspectorConnectionSchema>;\nexport type InspectorConnectionsResponse = z.infer<\n\ttypeof InspectorConnectionsResponseSchema\n>;\nexport type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;\nexport type InspectorQueueResponse = z.infer<\n\ttypeof InspectorQueueResponseSchema\n>;\n"],"mappings":";;;;;;;;;;AAgCA,SAAS,SAAS;AAmDX,IAAM,+BAA+B,EAAE,OAA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CAAC;AAGM,IAAM,8BAA8B,EAAE,OAAO;AAAA,EACnD,IAAI,EAAE,OAAO;AAAA,EACb,MAAM,EAAE,OAAO;AAAA,EACf,aAAa,EAAE,OAAO;AACvB,CAAC;AAGM,IAAM,+BAA+B,EAAE,OAAO;AAAA,EACpD,MAAM,EAAE,OAAO;AAAA,EACf,SAAS,EAAE,OAAO;AAAA;AAAA,EAElB,WAAW,EAAE,QAAQ;AAAA,EACrB,UAAU,EAAE,MAAM,2BAA2B;AAC9C,CAAC;","names":[]}
|
package/dist/tsup/mod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } var _class; var _class2; var _class3;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLIZO2BE3cjs = require('./chunk-LIZO2BE3.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ var _chunk3MHDOUD7cjs = require('./chunk-3MHDOUD7.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkQ3DY23PNcjs = require('./chunk-Q3DY23PN.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -33,9 +33,9 @@ var _chunkVE2X4KMGcjs = require('./chunk-VE2X4KMG.cjs');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
37
|
-
require('./chunk-
|
|
38
|
-
|
|
36
|
+
var _chunkQIRZKXPNcjs = require('./chunk-QIRZKXPN.cjs');
|
|
37
|
+
require('./chunk-GRXM3FQX.cjs');
|
|
38
|
+
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
@@ -64,7 +64,7 @@ require('./chunk-VEJGWALU.cjs');
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
var
|
|
67
|
+
var _chunkSNTYTMHEcjs = require('./chunk-SNTYTMHE.cjs');
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
|
|
@@ -77,10 +77,11 @@ var _chunkMLFI5BLTcjs = require('./chunk-MLFI5BLT.cjs');
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
var _chunk4FC7TVS6cjs = require('./chunk-4FC7TVS6.cjs');
|
|
80
|
+
require('./chunk-ZA7FLHKH.cjs');
|
|
80
81
|
|
|
81
82
|
// src/actor/log.ts
|
|
82
83
|
function loggerWithoutContext() {
|
|
83
|
-
return
|
|
84
|
+
return _chunkSNTYTMHEcjs.getLogger.call(void 0, "actor-runtime");
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
// src/actor/definition.ts
|
|
@@ -212,7 +213,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
212
213
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
213
214
|
var _ws = require('hono/ws');
|
|
214
215
|
function logger() {
|
|
215
|
-
return
|
|
216
|
+
return _chunkSNTYTMHEcjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
216
217
|
}
|
|
217
218
|
var InlineWebSocketAdapter = class {
|
|
218
219
|
#handler;
|
|
@@ -383,7 +384,7 @@ function isLocalEngineEndpoint(endpoint) {
|
|
|
383
384
|
|
|
384
385
|
// src/registry/log.ts
|
|
385
386
|
function logger2() {
|
|
386
|
-
return
|
|
387
|
+
return _chunkSNTYTMHEcjs.getLogger.call(void 0, "registry");
|
|
387
388
|
}
|
|
388
389
|
|
|
389
390
|
// src/serverless/configure.ts
|
|
@@ -429,8 +430,8 @@ async function configureServerlessPool(config) {
|
|
|
429
430
|
);
|
|
430
431
|
}
|
|
431
432
|
const customConfig = config.configurePool;
|
|
432
|
-
const clientConfig =
|
|
433
|
-
const dcsRes = await
|
|
433
|
+
const clientConfig = _chunkQ3DY23PNcjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
434
|
+
const dcsRes = await _chunkQ3DY23PNcjs.getDatacenters.call(void 0, clientConfig);
|
|
434
435
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
435
436
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
436
437
|
const headers = {
|
|
@@ -452,7 +453,7 @@ async function configureServerlessPool(config) {
|
|
|
452
453
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
453
454
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
454
455
|
};
|
|
455
|
-
await
|
|
456
|
+
await _chunkQ3DY23PNcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
456
457
|
datacenters: Object.fromEntries(
|
|
457
458
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
458
459
|
)
|
|
@@ -469,7 +470,7 @@ async function configureServerlessPool(config) {
|
|
|
469
470
|
logger2().warn({
|
|
470
471
|
msg: "serverless pool configuration attempt failed",
|
|
471
472
|
attempts,
|
|
472
|
-
error:
|
|
473
|
+
error: _chunkSNTYTMHEcjs.stringifyError.call(void 0, error)
|
|
473
474
|
});
|
|
474
475
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
475
476
|
}
|
|
@@ -477,7 +478,7 @@ async function configureServerlessPool(config) {
|
|
|
477
478
|
logger2().error({
|
|
478
479
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
479
480
|
attempts,
|
|
480
|
-
error:
|
|
481
|
+
error: _chunkSNTYTMHEcjs.stringifyError.call(void 0, lastError)
|
|
481
482
|
});
|
|
482
483
|
throw lastError;
|
|
483
484
|
}
|
|
@@ -489,20 +490,20 @@ var _zod = require('zod');
|
|
|
489
490
|
var _v4 = require('zod/v4');
|
|
490
491
|
var warnedMissingVersion = false;
|
|
491
492
|
var EnvoyConfigSchema = _v4.z.object({
|
|
492
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
493
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkSNTYTMHEcjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
493
494
|
version: _v4.z.number().default(() => {
|
|
494
|
-
const version =
|
|
495
|
+
const version = _chunkSNTYTMHEcjs.getRivetEnvoyVersion.call(void 0, );
|
|
495
496
|
if (version !== void 0) return version;
|
|
496
|
-
if (
|
|
497
|
+
if (_chunkSNTYTMHEcjs.getNodeEnv.call(void 0, ) === "production" && !warnedMissingVersion) {
|
|
497
498
|
warnedMissingVersion = true;
|
|
498
|
-
|
|
499
|
+
_chunkSNTYTMHEcjs.getLogger.call(void 0, "rivetkit").error(
|
|
499
500
|
"RIVET_ENVOY_VERSION is not set. Actors will not be versioned, which means they won't be drained on deploy. This is only needed when self-hosting or using a custom envoy (not needed for Rivet Compute). Set this as a build arg in your Dockerfile. See https://rivet.dev/docs/actors/versions"
|
|
500
501
|
);
|
|
501
502
|
}
|
|
502
503
|
return 1;
|
|
503
504
|
}),
|
|
504
505
|
// Deprecated.
|
|
505
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
506
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkSNTYTMHEcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
506
507
|
envoyKey: _v4.z.string().optional()
|
|
507
508
|
});
|
|
508
509
|
|
|
@@ -540,7 +541,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
540
541
|
*
|
|
541
542
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
542
543
|
*/
|
|
543
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
544
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkSNTYTMHEcjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
544
545
|
/**
|
|
545
546
|
* Token that clients should use when connecting via the public endpoint.
|
|
546
547
|
*
|
|
@@ -548,7 +549,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
548
549
|
*
|
|
549
550
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
550
551
|
*/
|
|
551
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
552
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkSNTYTMHEcjs.getRivetPublicToken.call(void 0, ))))
|
|
552
553
|
// There is no publicNamespace config option because the frontend and backend
|
|
553
554
|
// cannot use different namespaces. The namespace is extracted from the
|
|
554
555
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -602,7 +603,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
602
603
|
* Runtime binding to use for RivetKit core.
|
|
603
604
|
* */
|
|
604
605
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
605
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
606
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunkSNTYTMHEcjs.getRivetkitRuntime.call(void 0, )));
|
|
606
607
|
if (rawRuntime === void 0) {
|
|
607
608
|
return "auto";
|
|
608
609
|
}
|
|
@@ -639,7 +640,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
639
640
|
* */
|
|
640
641
|
logging: _zod.z.object({
|
|
641
642
|
baseLogger: _zod.z.custom().optional(),
|
|
642
|
-
level:
|
|
643
|
+
level: _chunkSNTYTMHEcjs.LogLevelSchema.optional()
|
|
643
644
|
}).optional().default(() => ({})),
|
|
644
645
|
// MARK: Routing
|
|
645
646
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -657,9 +658,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
657
658
|
*
|
|
658
659
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
659
660
|
*/
|
|
660
|
-
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
661
|
-
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
662
|
-
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
661
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkSNTYTMHEcjs.getRivetEngine.call(void 0, ))), () => ( _chunkSNTYTMHEcjs.getRivetEndpoint.call(void 0, )))),
|
|
662
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkSNTYTMHEcjs.getRivetToken.call(void 0, )))),
|
|
663
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkSNTYTMHEcjs.getRivetNamespace.call(void 0, )))),
|
|
663
664
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
664
665
|
// MARK: Client
|
|
665
666
|
// TODO:
|
|
@@ -699,21 +700,21 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
699
700
|
*
|
|
700
701
|
* Starts the full Rust engine process locally.
|
|
701
702
|
*/
|
|
702
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
703
|
+
startEngine: _zod.z.boolean().default(() => _chunkSNTYTMHEcjs.getRivetRunEngine.call(void 0, )),
|
|
703
704
|
/**
|
|
704
705
|
* @experimental
|
|
705
706
|
*
|
|
706
707
|
* Host to bind the spawned local engine process to.
|
|
707
708
|
*/
|
|
708
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
709
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkSNTYTMHEcjs.getRivetRunEngineHost.call(void 0, ), () => ( ENGINE_HOST))),
|
|
709
710
|
/**
|
|
710
711
|
* @experimental
|
|
711
712
|
*
|
|
712
713
|
* Port to bind the spawned local engine process to.
|
|
713
714
|
*/
|
|
714
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
715
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkSNTYTMHEcjs.getRivetRunEnginePort.call(void 0, ), () => ( ENGINE_PORT))),
|
|
715
716
|
/** @experimental */
|
|
716
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
717
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkSNTYTMHEcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkSNTYTMHEcjs.VERSION))),
|
|
717
718
|
/**
|
|
718
719
|
* @experimental
|
|
719
720
|
*
|
|
@@ -761,7 +762,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
761
762
|
}))
|
|
762
763
|
}).transform((config, ctx) => {
|
|
763
764
|
var _a, _b, _c;
|
|
764
|
-
const isDevEnv =
|
|
765
|
+
const isDevEnv = _chunkSNTYTMHEcjs.isDev.call(void 0, );
|
|
765
766
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
766
767
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
767
768
|
ctx.addIssue({
|
|
@@ -771,7 +772,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
771
772
|
});
|
|
772
773
|
}
|
|
773
774
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
774
|
-
const parsedEndpoint = config.endpoint ?
|
|
775
|
+
const parsedEndpoint = config.endpoint ? _chunkQ3DY23PNcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
775
776
|
endpoint: config.endpoint,
|
|
776
777
|
path: ["endpoint"],
|
|
777
778
|
namespace: config.namespace,
|
|
@@ -799,7 +800,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
799
800
|
);
|
|
800
801
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
801
802
|
const token = _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token));
|
|
802
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
803
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkQ3DY23PNcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
803
804
|
endpoint: config.serverless.publicEndpoint,
|
|
804
805
|
path: ["serverless", "publicEndpoint"]
|
|
805
806
|
}) : void 0;
|
|
@@ -927,7 +928,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
927
928
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
928
929
|
sqlite: DocSqliteConfigSchema,
|
|
929
930
|
logging: _zod.z.object({
|
|
930
|
-
level:
|
|
931
|
+
level: _chunkSNTYTMHEcjs.LogLevelSchema.optional().describe(
|
|
931
932
|
"Log level for RivetKit. Default: 'warn'"
|
|
932
933
|
)
|
|
933
934
|
}).optional().describe("Logging configuration."),
|
|
@@ -1696,6 +1697,9 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1696
1697
|
async actorQueueInspectMessages(ctx) {
|
|
1697
1698
|
return await asNativeActorContext(ctx).queue().inspectMessages();
|
|
1698
1699
|
}
|
|
1700
|
+
async actorQueueReset(ctx) {
|
|
1701
|
+
await asNativeActorContext(ctx).queue().reset();
|
|
1702
|
+
}
|
|
1699
1703
|
actorScheduleAfter(ctx, durationMs, actionName, args) {
|
|
1700
1704
|
asNativeActorContext(ctx).schedule().after(durationMs, actionName, toNapiBuffer(args));
|
|
1701
1705
|
}
|
|
@@ -2343,6 +2347,10 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2343
2347
|
const queue2 = childHandle(asWasmActorContext(ctx), "queue");
|
|
2344
2348
|
return await callHandleAsync(queue2, "inspectMessages");
|
|
2345
2349
|
}
|
|
2350
|
+
async actorQueueReset(ctx) {
|
|
2351
|
+
const queue2 = childHandle(asWasmActorContext(ctx), "queue");
|
|
2352
|
+
await callHandleAsync(queue2, "reset");
|
|
2353
|
+
}
|
|
2346
2354
|
actorScheduleAfter(ctx, durationMs, actionName, args) {
|
|
2347
2355
|
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
2348
2356
|
callHandle(schedule, "after", wasmNumber(durationMs), actionName, args);
|
|
@@ -2650,7 +2658,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
2650
2658
|
}).catch((error) => {
|
|
2651
2659
|
logger2().warn({
|
|
2652
2660
|
msg: "deferred native sleep cleanup failed",
|
|
2653
|
-
error:
|
|
2661
|
+
error: _chunkSNTYTMHEcjs.stringifyError.call(void 0, error)
|
|
2654
2662
|
});
|
|
2655
2663
|
});
|
|
2656
2664
|
return;
|
|
@@ -2760,10 +2768,10 @@ function decodeValue(value) {
|
|
|
2760
2768
|
if (!value || value.length === 0) {
|
|
2761
2769
|
return void 0;
|
|
2762
2770
|
}
|
|
2763
|
-
return
|
|
2771
|
+
return _chunkQIRZKXPNcjs.decodeCborCompat.call(void 0, value);
|
|
2764
2772
|
}
|
|
2765
2773
|
function encodeValue(value) {
|
|
2766
|
-
return
|
|
2774
|
+
return _chunkQIRZKXPNcjs.encodeCborCompat.call(void 0, value);
|
|
2767
2775
|
}
|
|
2768
2776
|
function normalizeArgs(value) {
|
|
2769
2777
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -2799,7 +2807,7 @@ function isStructuredBridgeError(error) {
|
|
|
2799
2807
|
return _chunk4FC7TVS6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
2800
2808
|
}
|
|
2801
2809
|
function encodeNativeCallbackError(error) {
|
|
2802
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
2810
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunkSNTYTMHEcjs.deconstructError.call(void 0, error, true);
|
|
2803
2811
|
const bridgeError = new Error(_chunk4FC7TVS6cjs.encodeBridgeRivetError.call(void 0, structuredError), {
|
|
2804
2812
|
cause: error instanceof Error ? error : void 0
|
|
2805
2813
|
});
|
|
@@ -2849,7 +2857,7 @@ function decodeWorkflowCbor(data) {
|
|
|
2849
2857
|
return null;
|
|
2850
2858
|
}
|
|
2851
2859
|
try {
|
|
2852
|
-
return
|
|
2860
|
+
return _chunkQIRZKXPNcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
2853
2861
|
} catch (e4) {
|
|
2854
2862
|
return null;
|
|
2855
2863
|
}
|
|
@@ -2948,13 +2956,21 @@ function serializeWorkflowEntryKind(kind) {
|
|
|
2948
2956
|
originalName: kind.val.originalName
|
|
2949
2957
|
}
|
|
2950
2958
|
};
|
|
2959
|
+
case "WorkflowVersionCheckEntry":
|
|
2960
|
+
return {
|
|
2961
|
+
tag: kind.tag,
|
|
2962
|
+
val: {
|
|
2963
|
+
resolved: kind.val.resolved,
|
|
2964
|
+
latest: kind.val.latest
|
|
2965
|
+
}
|
|
2966
|
+
};
|
|
2951
2967
|
}
|
|
2952
2968
|
}
|
|
2953
2969
|
function serializeWorkflowHistoryForJson(data) {
|
|
2954
2970
|
if (data === null) {
|
|
2955
2971
|
return null;
|
|
2956
2972
|
}
|
|
2957
|
-
const history =
|
|
2973
|
+
const history = _chunkLIZO2BE3cjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
2958
2974
|
return jsonSafe({
|
|
2959
2975
|
nameRegistry: [...history.nameRegistry],
|
|
2960
2976
|
entries: history.entries.map((entry) => ({
|
|
@@ -3095,12 +3111,12 @@ var NativeConnAdapter = class {
|
|
|
3095
3111
|
this.#writeState(nextValue, { writeNative: true });
|
|
3096
3112
|
},
|
|
3097
3113
|
(newValue) => {
|
|
3098
|
-
|
|
3114
|
+
_chunkQIRZKXPNcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
3099
3115
|
}
|
|
3100
3116
|
);
|
|
3101
3117
|
}
|
|
3102
3118
|
set state(value) {
|
|
3103
|
-
|
|
3119
|
+
_chunkQIRZKXPNcjs.assertJsonCompatValue.call(void 0, value);
|
|
3104
3120
|
this.#writeState(value, { writeNative: true });
|
|
3105
3121
|
}
|
|
3106
3122
|
initializeState(value) {
|
|
@@ -4050,7 +4066,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4050
4066
|
},
|
|
4051
4067
|
(newValue) => {
|
|
4052
4068
|
this.#assertCanMutateState();
|
|
4053
|
-
|
|
4069
|
+
_chunkQIRZKXPNcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4054
4070
|
}
|
|
4055
4071
|
);
|
|
4056
4072
|
}
|
|
@@ -4061,7 +4077,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4061
4077
|
throw stateNotEnabledError();
|
|
4062
4078
|
}
|
|
4063
4079
|
this.#assertCanMutateState();
|
|
4064
|
-
|
|
4080
|
+
_chunkQIRZKXPNcjs.assertJsonCompatValue.call(void 0, value);
|
|
4065
4081
|
this.#writeState(value, { scheduleSave: true });
|
|
4066
4082
|
}
|
|
4067
4083
|
initializeState(value) {
|
|
@@ -4326,7 +4342,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4326
4342
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
4327
4343
|
logger2().warn({
|
|
4328
4344
|
msg: "keepAwake promise rejected",
|
|
4329
|
-
error:
|
|
4345
|
+
error: _chunkSNTYTMHEcjs.stringifyError.call(void 0, error)
|
|
4330
4346
|
});
|
|
4331
4347
|
}).then(() => null);
|
|
4332
4348
|
try {
|
|
@@ -4781,9 +4797,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
4781
4797
|
const actionHandlers = Object.fromEntries(
|
|
4782
4798
|
Object.entries(_nullishCoalesce(config.actions, () => ( {}))).map(([name, handler]) => [name, handler])
|
|
4783
4799
|
);
|
|
4784
|
-
const createClient = () =>
|
|
4785
|
-
new (0,
|
|
4786
|
-
|
|
4800
|
+
const createClient = () => _chunkQ3DY23PNcjs.createClientWithDriver.call(void 0,
|
|
4801
|
+
new (0, _chunkQ3DY23PNcjs.RemoteEngineControlClient)(
|
|
4802
|
+
_chunkQ3DY23PNcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
4787
4803
|
),
|
|
4788
4804
|
{ encoding: "bare" }
|
|
4789
4805
|
);
|
|
@@ -4859,7 +4875,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
4859
4875
|
}
|
|
4860
4876
|
);
|
|
4861
4877
|
};
|
|
4862
|
-
const isPublicPerActorPath = jsRequest.method === "GET" &&
|
|
4878
|
+
const isPublicPerActorPath = jsRequest.method === "GET" && url.pathname.startsWith("/inspector/custom-tabs/");
|
|
4863
4879
|
if (!isPublicPerActorPath) {
|
|
4864
4880
|
try {
|
|
4865
4881
|
await runtime.actorVerifyInspectorAuth(
|
|
@@ -4935,6 +4951,45 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
4935
4951
|
messages
|
|
4936
4952
|
});
|
|
4937
4953
|
}
|
|
4954
|
+
if (url.pathname === "/inspector/queue" && jsRequest.method === "DELETE") {
|
|
4955
|
+
await runtime.actorQueueReset(ctx);
|
|
4956
|
+
return jsonResponse({});
|
|
4957
|
+
}
|
|
4958
|
+
if (url.pathname === "/inspector/queue" && jsRequest.method === "POST") {
|
|
4959
|
+
let body;
|
|
4960
|
+
try {
|
|
4961
|
+
body = await jsRequest.json();
|
|
4962
|
+
} catch (e5) {
|
|
4963
|
+
return errorResponse(
|
|
4964
|
+
new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
4965
|
+
"actor",
|
|
4966
|
+
"invalid_request",
|
|
4967
|
+
"Invalid inspector JSON body",
|
|
4968
|
+
{ public: true }
|
|
4969
|
+
),
|
|
4970
|
+
400
|
|
4971
|
+
);
|
|
4972
|
+
}
|
|
4973
|
+
const name = _nullishCoalesce(body.name, () => ( ""));
|
|
4974
|
+
if (name === "") {
|
|
4975
|
+
return errorResponse(
|
|
4976
|
+
new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
4977
|
+
"actor",
|
|
4978
|
+
"invalid_request",
|
|
4979
|
+
"Queue message name must not be empty",
|
|
4980
|
+
{ public: true }
|
|
4981
|
+
),
|
|
4982
|
+
400
|
|
4983
|
+
);
|
|
4984
|
+
}
|
|
4985
|
+
const cbor = _chunkQIRZKXPNcjs.encodeCborCompat.call(void 0, _nullishCoalesce(body.body, () => ( null)));
|
|
4986
|
+
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
4987
|
+
return jsonResponse({
|
|
4988
|
+
id: message.id().toString(),
|
|
4989
|
+
name: message.name(),
|
|
4990
|
+
createdAtMs: message.createdAt()
|
|
4991
|
+
});
|
|
4992
|
+
}
|
|
4938
4993
|
if (url.pathname === "/inspector/traces" && jsRequest.method === "GET") {
|
|
4939
4994
|
return jsonResponse({ otlp: [], clamped: false });
|
|
4940
4995
|
}
|
|
@@ -5507,7 +5562,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5507
5562
|
new Response(null, { status: 404 })
|
|
5508
5563
|
);
|
|
5509
5564
|
}
|
|
5510
|
-
const rawConnParams = jsRequest.headers.get(
|
|
5565
|
+
const rawConnParams = jsRequest.headers.get(_chunkQ3DY23PNcjs.HEADER_CONN_PARAMS);
|
|
5511
5566
|
let requestCtx;
|
|
5512
5567
|
let conn;
|
|
5513
5568
|
try {
|
|
@@ -5734,7 +5789,7 @@ async function buildServeConfig(config) {
|
|
|
5734
5789
|
poolName: config.envoy.poolName,
|
|
5735
5790
|
handleInspectorHttpInRuntime: true,
|
|
5736
5791
|
serverlessBasePath: config.serverless.basePath,
|
|
5737
|
-
serverlessPackageVersion:
|
|
5792
|
+
serverlessPackageVersion: _chunkSNTYTMHEcjs.VERSION,
|
|
5738
5793
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
5739
5794
|
serverlessClientNamespace: config.publicNamespace,
|
|
5740
5795
|
serverlessClientToken: config.publicToken,
|
|
@@ -5747,19 +5802,19 @@ async function buildServeConfig(config) {
|
|
|
5747
5802
|
} catch (error) {
|
|
5748
5803
|
logger2().warn({
|
|
5749
5804
|
msg: "could not resolve a local engine binary; if a local engine must be spawned it will fail with engine.binary_unavailable \u2014 set RIVET_ENGINE_BINARY_PATH or install the @rivetkit/engine-cli platform package",
|
|
5750
|
-
error:
|
|
5805
|
+
error: _chunkSNTYTMHEcjs.stringifyError.call(void 0, error)
|
|
5751
5806
|
});
|
|
5752
5807
|
}
|
|
5753
5808
|
serveConfig.engineHost = config.engineHost;
|
|
5754
5809
|
serveConfig.enginePort = config.enginePort;
|
|
5755
5810
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
5756
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
5811
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunkSNTYTMHEcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
5757
5812
|
}
|
|
5758
5813
|
return serveConfig;
|
|
5759
5814
|
}
|
|
5760
5815
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
5761
5816
|
var _a;
|
|
5762
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
5817
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkSNTYTMHEcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
5763
5818
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
5764
5819
|
}
|
|
5765
5820
|
if (runtime.kind === "napi") {
|
|
@@ -5821,7 +5876,11 @@ var Registry = class {
|
|
|
5821
5876
|
#shutdownInFlight = null;
|
|
5822
5877
|
#signalHandlers = {};
|
|
5823
5878
|
constructor(config, deps) {
|
|
5879
|
+
var _a;
|
|
5824
5880
|
this.#config = config;
|
|
5881
|
+
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
5882
|
+
_chunkSNTYTMHEcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
5883
|
+
}
|
|
5825
5884
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
5826
5885
|
this.routes = {
|
|
5827
5886
|
health: () => this.#healthRoute(),
|
|
@@ -6044,8 +6103,8 @@ var Registry = class {
|
|
|
6044
6103
|
* ```
|
|
6045
6104
|
*/
|
|
6046
6105
|
async listen(opts = {}) {
|
|
6047
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => (
|
|
6048
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => (
|
|
6106
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkSNTYTMHEcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
6107
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkSNTYTMHEcjs.getRivetkitPublicDir.call(void 0, )));
|
|
6049
6108
|
const config = this.parseConfig();
|
|
6050
6109
|
const configuredRegistryPromise = buildConfiguredRegistry(config);
|
|
6051
6110
|
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
@@ -6073,7 +6132,7 @@ var Registry = class {
|
|
|
6073
6132
|
return jsonRouteResponse(503, {
|
|
6074
6133
|
status: "not_started",
|
|
6075
6134
|
runtime: "rivetkit",
|
|
6076
|
-
version:
|
|
6135
|
+
version: _chunkSNTYTMHEcjs.VERSION
|
|
6077
6136
|
});
|
|
6078
6137
|
}
|
|
6079
6138
|
const { runtime, registry } = configured;
|
|
@@ -6081,7 +6140,7 @@ var Registry = class {
|
|
|
6081
6140
|
return jsonRouteResponse(501, {
|
|
6082
6141
|
status: "unsupported",
|
|
6083
6142
|
runtime: "rivetkit",
|
|
6084
|
-
version:
|
|
6143
|
+
version: _chunkSNTYTMHEcjs.VERSION
|
|
6085
6144
|
});
|
|
6086
6145
|
}
|
|
6087
6146
|
const response = await runtime.registryHealth(registry);
|
|
@@ -6319,8 +6378,8 @@ var Registry = class {
|
|
|
6319
6378
|
* ```
|
|
6320
6379
|
*/
|
|
6321
6380
|
start() {
|
|
6322
|
-
if (
|
|
6323
|
-
const publicDir = _nullishCoalesce(
|
|
6381
|
+
if (_chunkSNTYTMHEcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
6382
|
+
const publicDir = _nullishCoalesce(_chunkSNTYTMHEcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
6324
6383
|
this.listen({ publicDir }).catch((error) => {
|
|
6325
6384
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
6326
6385
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -6341,7 +6400,7 @@ var Registry = class {
|
|
|
6341
6400
|
};
|
|
6342
6401
|
console.log();
|
|
6343
6402
|
console.log(
|
|
6344
|
-
` RivetKit ${
|
|
6403
|
+
` RivetKit ${_chunkSNTYTMHEcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
6345
6404
|
);
|
|
6346
6405
|
if (config.namespace !== "default") {
|
|
6347
6406
|
logLine("Namespace", config.namespace);
|
|
@@ -6416,5 +6475,5 @@ function setup(input) {
|
|
|
6416
6475
|
|
|
6417
6476
|
|
|
6418
6477
|
|
|
6419
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
6478
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkQ3DY23PNcjs.ALLOWED_PUBLIC_HEADERS; exports.ActorDefinition = ActorDefinition; exports.ActorError = _chunk4FC7TVS6cjs.RivetError; exports.ActorsSchema = ActorsSchema; exports.DocConfigurePoolSchema = DocConfigurePoolSchema; exports.DocEnvoyConfigSchema = DocEnvoyConfigSchema; exports.DocRegistryConfigSchema = DocRegistryConfigSchema; exports.DocServerlessConfigSchema = DocServerlessConfigSchema; exports.DocSqliteConfigSchema = DocSqliteConfigSchema; exports.InlineWebSocketAdapter = InlineWebSocketAdapter; exports.Registry = Registry; exports.RegistryConfigSchema = RegistryConfigSchema; exports.RivetError = _chunk4FC7TVS6cjs.RivetError; exports.RuntimeKindSchema = RuntimeKindSchema; exports.SqliteBackendSchema = SqliteBackendSchema; exports.SqliteConfigSchema = SqliteConfigSchema; exports.TestConfigSchema = TestConfigSchema; exports.UserError = _chunk4FC7TVS6cjs.UserError; exports.WasmRuntimeConfigSchema = WasmRuntimeConfigSchema; exports.actor = actor; exports.buildActorNames = buildActorNames; exports.createClientWithDriver = _chunkQ3DY23PNcjs.createClientWithDriver; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkSNTYTMHEcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkSNTYTMHEcjs.toUint8Array;
|
|
6420
6479
|
//# sourceMappingURL=mod.cjs.map
|