@ekairos/story 1.21.39-beta.0 → 1.21.40-beta.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/next.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export type NextConfigLike = {
2
- webpack?: (config: any, options: any) => any;
2
+ webpack?: ((config: any, options: any) => any) | null;
3
+ turbopack?: any;
3
4
  };
4
5
  type WithEkairosRuntimeOptions = {
5
6
  /**
package/dist/next.js CHANGED
@@ -1,4 +1,42 @@
1
1
  import { createRequire } from "node:module";
2
+ import { readFileSync, writeFileSync } from "node:fs";
3
+ import { dirname, relative, resolve } from "node:path";
4
+ function patchWorkflowStepRouteToImportBootstrap(bootstrapModule) {
5
+ const cwd = process.cwd();
6
+ const candidates = [
7
+ resolve(cwd, "app/.well-known/workflow/v1/step/route.js"),
8
+ resolve(cwd, "src/app/.well-known/workflow/v1/step/route.js"),
9
+ ];
10
+ const bootstrapAbs = resolve(cwd, bootstrapModule);
11
+ for (const routeFile of candidates) {
12
+ let contents;
13
+ try {
14
+ contents = readFileSync(routeFile, "utf8");
15
+ }
16
+ catch {
17
+ continue;
18
+ }
19
+ const routeDir = dirname(routeFile);
20
+ let spec = relative(routeDir, bootstrapAbs).replace(/\\/g, "/");
21
+ if (!spec.startsWith("."))
22
+ spec = `./${spec}`;
23
+ const importLine = `import "${spec}";`;
24
+ if (contents.includes(importLine))
25
+ continue;
26
+ const lines = contents.split(/\r?\n/);
27
+ let insertAt = 0;
28
+ for (let i = 0; i < lines.length; i++) {
29
+ const t = lines[i].trim();
30
+ const isComment = t.startsWith("//") || t.startsWith("/*") || t.startsWith("*") || t.startsWith("*/");
31
+ if (t === "" || isComment)
32
+ continue;
33
+ insertAt = i;
34
+ break;
35
+ }
36
+ lines.splice(insertAt, 0, importLine);
37
+ writeFileSync(routeFile, lines.join("\n"));
38
+ }
39
+ }
2
40
  function injectBootstrapIntoEntries(entries, bootstrap) {
3
41
  for (const key of Object.keys(entries)) {
4
42
  const entry = entries[key];
@@ -36,11 +74,17 @@ function injectBootstrapIntoEntries(entries, bootstrap) {
36
74
  */
37
75
  export function withEkairosRuntime(nextConfig, opts) {
38
76
  const bootstrapModule = opts.bootstrapModule;
39
- const userWebpack = nextConfig.webpack;
77
+ const userWebpack = nextConfig.webpack ?? undefined;
40
78
  return {
41
79
  ...nextConfig,
42
80
  webpack: (config, options) => {
43
81
  const out = userWebpack ? userWebpack(config, options) : config;
82
+ // Patch the generated workflow step route (esbuild output) so it imports
83
+ // the app's `ekairos.ts`, which registers `ekairosConfig` globally.
84
+ //
85
+ // This is necessary because the steps bundle is produced by @workflow/builders
86
+ // (esbuild) and does NOT run through Next's webpack entrypoints.
87
+ patchWorkflowStepRouteToImportBootstrap(bootstrapModule);
44
88
  if (!options?.isServer)
45
89
  return out;
46
90
  const req = createRequire(import.meta.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekairos/story",
3
- "version": "1.21.39-beta.0",
3
+ "version": "1.21.40-beta.0",
4
4
  "description": "Pulzar Story - Workflow-based AI Stories",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@ai-sdk/openai": "^2.0.52",
51
- "@ekairos/domain": "^1.21.39-beta.0",
51
+ "@ekairos/domain": "^1.21.40-beta.0",
52
52
  "@instantdb/admin": "^0.22.13",
53
53
  "@instantdb/core": "^0.22.13",
54
54
  "@vercel/sandbox": "^0.0.23",