veryfront 0.1.739 → 0.1.743

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.
Files changed (63) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/src/agent/hosted/child-tool-input.js +1 -1
  3. package/esm/src/mcp/http-transport.js +1 -1
  4. package/esm/src/mcp/session.d.ts +23 -0
  5. package/esm/src/mcp/session.d.ts.map +1 -1
  6. package/esm/src/mcp/session.js +46 -3
  7. package/esm/src/modules/manifest/route-module-manifest.d.ts.map +1 -1
  8. package/esm/src/modules/manifest/route-module-manifest.js +12 -4
  9. package/esm/src/modules/react-loader/ssr-module-loader/cross-project-import-loader.d.ts.map +1 -1
  10. package/esm/src/modules/react-loader/ssr-module-loader/cross-project-import-loader.js +2 -1
  11. package/esm/src/modules/server/cross-project-source-limit.d.ts +7 -0
  12. package/esm/src/modules/server/cross-project-source-limit.d.ts.map +1 -0
  13. package/esm/src/modules/server/cross-project-source-limit.js +46 -0
  14. package/esm/src/modules/server/module-batch-handler.d.ts.map +1 -1
  15. package/esm/src/modules/server/module-batch-handler.js +3 -4
  16. package/esm/src/modules/server/module-server.d.ts.map +1 -1
  17. package/esm/src/modules/server/module-server.js +11 -1
  18. package/esm/src/oauth/providers/base.d.ts +3 -0
  19. package/esm/src/oauth/providers/base.d.ts.map +1 -1
  20. package/esm/src/oauth/providers/base.js +24 -2
  21. package/esm/src/provider/runtime-loader/tool-input-status.d.ts.map +1 -1
  22. package/esm/src/provider/runtime-loader/tool-input-status.js +16 -8
  23. package/esm/src/rendering/context/render-context.d.ts.map +1 -1
  24. package/esm/src/rendering/context/render-context.js +7 -1
  25. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts +2 -0
  26. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -1
  27. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +23 -10
  28. package/esm/src/rendering/renderer-concurrency.d.ts.map +1 -1
  29. package/esm/src/rendering/renderer-concurrency.js +9 -2
  30. package/esm/src/security/sandbox/worker-permissions.d.ts +10 -7
  31. package/esm/src/security/sandbox/worker-permissions.d.ts.map +1 -1
  32. package/esm/src/security/sandbox/worker-permissions.js +32 -18
  33. package/esm/src/server/context/enriched-context.d.ts.map +1 -1
  34. package/esm/src/server/context/enriched-context.js +15 -3
  35. package/esm/src/server/handlers/request/api/project-discovery.js +2 -2
  36. package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
  37. package/esm/src/server/services/rendering/ssr.service.js +6 -3
  38. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts +4 -0
  39. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts.map +1 -1
  40. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.js +22 -18
  41. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts.map +1 -1
  42. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.js +27 -8
  43. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/import-rewriter.d.ts.map +1 -1
  44. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/import-rewriter.js +24 -14
  45. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts +1 -1
  46. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
  47. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +1 -1
  48. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts +4 -0
  49. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts.map +1 -1
  50. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.js +45 -37
  51. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts +5 -0
  52. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts.map +1 -1
  53. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.js +27 -2
  54. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +2 -0
  55. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
  56. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts +23 -0
  57. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts.map +1 -0
  58. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.js +188 -0
  59. package/esm/src/utils/version-constant.d.ts +1 -1
  60. package/esm/src/utils/version-constant.js +1 -1
  61. package/esm/src/workflow/worker/workflow-worker.d.ts.map +1 -1
  62. package/esm/src/workflow/worker/workflow-worker.js +9 -1
  63. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"render-sessions.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAOhG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAiCxD;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D;AAWD,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAQlE"}
1
+ {"version":3,"file":"render-sessions.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA6BH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEvE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAOhG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAiCxD;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D;AAuBD,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAQlE"}
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * @module transforms/mdx/esm-module-loader/module-fetcher/render-sessions
7
7
  */
8
+ import { AsyncLocalStorage } from "node:async_hooks";
8
9
  import { rendererLogger as globalLogger } from "../../../../utils/index.js";
9
10
  import { LOG_PREFIX_MDX_LOADER } from "../constants.js";
10
11
  import { recordSSRModules } from "../../../../modules/manifest/route-module-manifest.js";
@@ -13,6 +14,19 @@ import { recordSSRModules } from "../../../../modules/manifest/route-module-mani
13
14
  * Key: renderSessionId, Value: RenderSession
14
15
  */
15
16
  const renderSessions = new Map();
17
+ /**
18
+ * The render session id active on the current async execution context.
19
+ * Set via {@link runInRenderSession} so concurrent SSR renders each resolve
20
+ * their own session instead of sharing whichever one started first.
21
+ */
22
+ const currentSessionIdStorage = new AsyncLocalStorage();
23
+ /**
24
+ * Run `fn` with `sessionId` bound as the active render session for all async
25
+ * work it spawns. Modules fetched inside are attributed to this session.
26
+ */
27
+ export function runInRenderSession(sessionId, fn) {
28
+ return currentSessionIdStorage.run(sessionId, fn);
29
+ }
16
30
  /**
17
31
  * Start a render session to track module loading.
18
32
  * Call this before rendering a page.
@@ -66,8 +80,19 @@ export function hasRenderSession(sessionId) {
66
80
  * Used to record modules during fetch and for per-session in-flight deduplication.
67
81
  */
68
82
  function getCurrentSession() {
69
- const firstSession = renderSessions.values().next();
70
- return firstSession.done ? null : firstSession.value;
83
+ const activeId = currentSessionIdStorage.getStore();
84
+ if (activeId !== undefined) {
85
+ return renderSessions.get(activeId) ?? null;
86
+ }
87
+ // No session bound on the async context (caller not wrapped in
88
+ // runInRenderSession). Fall back to the single-session heuristic only when
89
+ // it is unambiguous; with multiple concurrent sessions, decline rather than
90
+ // mis-attribute modules to the wrong render.
91
+ if (renderSessions.size === 1) {
92
+ const firstSession = renderSessions.values().next();
93
+ return firstSession.done ? null : firstSession.value;
94
+ }
95
+ return null;
71
96
  }
72
97
  export function recordModuleToSession(normalizedPath) {
73
98
  const session = getCurrentSession();
@@ -31,6 +31,8 @@ export interface FSAdapter {
31
31
  }
32
32
  export interface NestedImportResult {
33
33
  original: string;
34
+ start: number;
35
+ end: number;
34
36
  nestedFilePath: string | null;
35
37
  nestedPath?: string;
36
38
  relativePath?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/esm-module-loader/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,E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AAC,CAAC;IACzD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C;AAeD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACtD,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Source-span replacement helpers for import rewrites.
3
+ *
4
+ * @module transforms/mdx/esm-module-loader/utils/source-spans
5
+ */
6
+ export interface SourceSpanReplacement {
7
+ start: number;
8
+ end: number;
9
+ replacement: string;
10
+ expected?: string;
11
+ }
12
+ export interface StaticImportSpan {
13
+ original: string;
14
+ path: string;
15
+ start: number;
16
+ end: number;
17
+ }
18
+ type SpecifierMatcher = (specifier: string) => string | null | undefined;
19
+ export declare function replaceSourceSpans(source: string, replacements: SourceSpanReplacement[]): string;
20
+ export declare function findStaticImportFromSpans(source: string, matcher: SpecifierMatcher): StaticImportSpan[];
21
+ export declare function findStaticSideEffectImportSpans(source: string, matcher: SpecifierMatcher): StaticImportSpan[];
22
+ export {};
23
+ //# sourceMappingURL=source-spans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-spans.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/utils/source-spans.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,KAAK,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,qBAAqB,EAAE,GACpC,MAAM,CAiBR;AAqID,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,GACxB,gBAAgB,EAAE,CAoCpB;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,GACxB,gBAAgB,EAAE,CAqCpB"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Source-span replacement helpers for import rewrites.
3
+ *
4
+ * @module transforms/mdx/esm-module-loader/utils/source-spans
5
+ */
6
+ export function replaceSourceSpans(source, replacements) {
7
+ let result = source;
8
+ const sorted = [...replacements].sort((left, right) => right.start - left.start);
9
+ for (const { start, end, replacement, expected } of sorted) {
10
+ if (start < 0 || end < start || end > source.length) {
11
+ throw new RangeError(`Invalid source replacement span: ${start}-${end}`);
12
+ }
13
+ if (expected !== undefined && source.slice(start, end) !== expected) {
14
+ throw new Error(`Source replacement span did not match expected text: ${expected}`);
15
+ }
16
+ result = result.slice(0, start) + replacement + result.slice(end);
17
+ }
18
+ return result;
19
+ }
20
+ function isIdentifierChar(char) {
21
+ return char !== undefined && /[A-Za-z0-9_$]/.test(char);
22
+ }
23
+ function isStatementKeywordAt(source, index, keyword) {
24
+ if (!source.startsWith(keyword, index))
25
+ return false;
26
+ if (isIdentifierChar(source[index - 1]) || source[index - 1] === ".")
27
+ return false;
28
+ if (isIdentifierChar(source[index + keyword.length]))
29
+ return false;
30
+ const lineStart = source.lastIndexOf("\n", index - 1) + 1;
31
+ return /^[\t ]*$/.test(source.slice(lineStart, index));
32
+ }
33
+ function skipIgnored(source, index) {
34
+ const char = source[index];
35
+ const next = source[index + 1];
36
+ if (char === "/" && next === "/") {
37
+ const newline = source.indexOf("\n", index + 2);
38
+ return newline === -1 ? source.length : newline + 1;
39
+ }
40
+ if (char === "/" && next === "*") {
41
+ const end = source.indexOf("*/", index + 2);
42
+ return end === -1 ? source.length : end + 2;
43
+ }
44
+ if (char === '"' || char === "'" || char === "`") {
45
+ let cursor = index + 1;
46
+ while (cursor < source.length) {
47
+ if (source[cursor] === "\\") {
48
+ cursor += 2;
49
+ continue;
50
+ }
51
+ if (source[cursor] === char)
52
+ return cursor + 1;
53
+ cursor++;
54
+ }
55
+ return source.length;
56
+ }
57
+ return index;
58
+ }
59
+ function skipWhitespace(source, index) {
60
+ let cursor = index;
61
+ while (/\s/.test(source[cursor] ?? ""))
62
+ cursor++;
63
+ return cursor;
64
+ }
65
+ function nextStatementCursor(source, index) {
66
+ const semicolon = source.indexOf(";", index);
67
+ const newline = source.indexOf("\n", index);
68
+ const candidates = [semicolon, newline].filter((position) => position >= 0);
69
+ if (candidates.length === 0)
70
+ return source.length;
71
+ return Math.min(...candidates) + 1;
72
+ }
73
+ function readQuotedSpecifier(source, quoteIndex) {
74
+ const quote = source[quoteIndex];
75
+ if (quote !== '"' && quote !== "'")
76
+ return null;
77
+ let cursor = quoteIndex + 1;
78
+ while (cursor < source.length) {
79
+ if (source[cursor] === "\\") {
80
+ cursor += 2;
81
+ continue;
82
+ }
83
+ if (source[cursor] === quote) {
84
+ return {
85
+ end: cursor + 1,
86
+ specifier: source.slice(quoteIndex + 1, cursor),
87
+ };
88
+ }
89
+ cursor++;
90
+ }
91
+ return null;
92
+ }
93
+ function findFromSpan(source, statementStart, matcher) {
94
+ let cursor = statementStart;
95
+ while (cursor < source.length) {
96
+ const skipped = skipIgnored(source, cursor);
97
+ if (skipped !== cursor) {
98
+ cursor = skipped;
99
+ continue;
100
+ }
101
+ if (source[cursor] === ";")
102
+ return null;
103
+ if (source.startsWith("from", cursor) &&
104
+ !isIdentifierChar(source[cursor - 1]) &&
105
+ !isIdentifierChar(source[cursor + 4])) {
106
+ const quoteIndex = skipWhitespace(source, cursor + 4);
107
+ const quoted = readQuotedSpecifier(source, quoteIndex);
108
+ if (!quoted) {
109
+ cursor++;
110
+ continue;
111
+ }
112
+ const matchedPath = matcher(quoted.specifier);
113
+ if (!matchedPath)
114
+ return null;
115
+ return {
116
+ original: source.slice(cursor, quoted.end),
117
+ path: matchedPath,
118
+ start: cursor,
119
+ end: quoted.end,
120
+ };
121
+ }
122
+ cursor++;
123
+ }
124
+ return null;
125
+ }
126
+ export function findStaticImportFromSpans(source, matcher) {
127
+ const spans = [];
128
+ let cursor = 0;
129
+ while (cursor < source.length) {
130
+ const skipped = skipIgnored(source, cursor);
131
+ if (skipped !== cursor) {
132
+ cursor = skipped;
133
+ continue;
134
+ }
135
+ const isImport = isStatementKeywordAt(source, cursor, "import");
136
+ const isExport = isStatementKeywordAt(source, cursor, "export");
137
+ if (!isImport && !isExport) {
138
+ cursor++;
139
+ continue;
140
+ }
141
+ const keywordLength = isImport ? "import".length : "export".length;
142
+ const afterKeyword = skipWhitespace(source, cursor + keywordLength);
143
+ if (isImport && source[afterKeyword] === "(") {
144
+ cursor = afterKeyword + 1;
145
+ continue;
146
+ }
147
+ const span = findFromSpan(source, afterKeyword, matcher);
148
+ if (span) {
149
+ spans.push(span);
150
+ cursor = span.end;
151
+ continue;
152
+ }
153
+ cursor = nextStatementCursor(source, afterKeyword);
154
+ }
155
+ return spans;
156
+ }
157
+ export function findStaticSideEffectImportSpans(source, matcher) {
158
+ const spans = [];
159
+ let cursor = 0;
160
+ while (cursor < source.length) {
161
+ const skipped = skipIgnored(source, cursor);
162
+ if (skipped !== cursor) {
163
+ cursor = skipped;
164
+ continue;
165
+ }
166
+ if (!isStatementKeywordAt(source, cursor, "import")) {
167
+ cursor++;
168
+ continue;
169
+ }
170
+ const quoteIndex = skipWhitespace(source, cursor + "import".length);
171
+ const quoted = readQuotedSpecifier(source, quoteIndex);
172
+ if (!quoted) {
173
+ cursor = nextStatementCursor(source, quoteIndex);
174
+ continue;
175
+ }
176
+ const matchedPath = matcher(quoted.specifier);
177
+ if (matchedPath) {
178
+ spans.push({
179
+ original: source.slice(cursor, quoted.end),
180
+ path: matchedPath,
181
+ start: cursor,
182
+ end: quoted.end,
183
+ });
184
+ }
185
+ cursor = quoted.end;
186
+ }
187
+ return spans;
188
+ }
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.739";
2
+ export declare const VERSION = "0.1.743";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.739";
4
+ export const VERSION = "0.1.743";
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-worker.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/worker/workflow-worker.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAc5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;IAIvB;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAWxB;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;YACW,IAAI;IAiDlB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,KAAK;CAId;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAEjF"}
1
+ {"version":3,"file":"workflow-worker.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/worker/workflow-worker.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAiB5D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,OAAO,EAAE,eAAe,CAAC;IAEzB,wCAAwC;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3C,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,wDAAwD;IACxD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA+BD,iCAAiC;AACjC,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,WAAW,CAAC,CAAwC;IAC5D,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,KAAK,CAAc;gBAEf,MAAM,EAAE,oBAAoB;IA6BxC;;OAEG;IACH,KAAK,IAAI,IAAI;IAiBb;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA4C3B;;OAEG;IACH,QAAQ,IAAI,WAAW;IAIvB;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAWxB;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;YACW,IAAI;IAiDlB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,KAAK;CAId;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAEjF"}
@@ -14,6 +14,8 @@ const logger = baseLogger.component("workflow-worker");
14
14
  const DEFAULT_POLL_INTERVAL_MS = 5_000;
15
15
  /** Default threshold after which a run is considered stalled */
16
16
  const DEFAULT_STALLED_THRESHOLD_MS = 60_000;
17
+ /** Maximum time stop() waits for in-flight resumes before abandoning them */
18
+ const WORKER_STOP_TIMEOUT_MS = 30_000;
17
19
  /** Implement workflow worker. */
18
20
  export class WorkflowWorker {
19
21
  config;
@@ -80,8 +82,14 @@ export class WorkflowWorker {
80
82
  clearTimeout(this.pollTimeout);
81
83
  this.pollTimeout = undefined;
82
84
  }
83
- // Wait for active resumes to complete
85
+ // Wait for active resumes to complete, but bound the wait: a hung
86
+ // resumeFn (e.g. an unreachable backend) must not block shutdown forever.
87
+ const stopDeadline = Date.now() + WORKER_STOP_TIMEOUT_MS;
84
88
  while (this.activeResumes.size > 0) {
89
+ if (Date.now() >= stopDeadline) {
90
+ logger.warn(`[WorkflowWorker] Stop timed out with ${this.activeResumes.size} active resume(s); abandoning wait`);
91
+ break;
92
+ }
85
93
  if (this.config.debug) {
86
94
  logger.debug(`[WorkflowWorker] Waiting for ${this.activeResumes.size} active resumes to complete`);
87
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.739",
3
+ "version": "0.1.743",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",