@workflow/world-local 4.0.1-beta.2 → 4.0.1-beta.21
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/LICENSE.md +201 -21
- package/dist/config.d.ts +14 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +29 -10
- package/dist/config.js.map +1 -1
- package/dist/fs.d.ts +13 -0
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +53 -11
- package/dist/fs.js.map +1 -1
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -9
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +82 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +222 -0
- package/dist/init.js.map +1 -0
- package/dist/queue.d.ts +2 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +93 -40
- package/dist/queue.js.map +1 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +147 -90
- package/dist/storage.js.map +1 -1
- package/dist/streamer.d.ts +1 -1
- package/dist/streamer.d.ts.map +1 -1
- package/dist/streamer.js +99 -20
- package/dist/streamer.js.map +1 -1
- package/package.json +12 -9
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** Package name for version tracking */
|
|
2
|
+
export declare const PACKAGE_NAME = "@workflow/world-local";
|
|
3
|
+
/** Current package version - imported at build time */
|
|
4
|
+
export declare const PACKAGE_VERSION = "4.0.1-beta.20";
|
|
5
|
+
/**
|
|
6
|
+
* Represents a parsed semantic version with optional prerelease tag.
|
|
7
|
+
*/
|
|
8
|
+
export interface ParsedVersion {
|
|
9
|
+
major: number;
|
|
10
|
+
minor: number;
|
|
11
|
+
patch: number;
|
|
12
|
+
prerelease?: string;
|
|
13
|
+
raw: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error thrown when the data directory cannot be accessed or created.
|
|
17
|
+
*/
|
|
18
|
+
export declare class DataDirAccessError extends Error {
|
|
19
|
+
readonly dataDir: string;
|
|
20
|
+
readonly code?: string;
|
|
21
|
+
constructor(message: string, dataDir: string, code?: string);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when data directory version is incompatible.
|
|
25
|
+
*/
|
|
26
|
+
export declare class DataDirVersionError extends Error {
|
|
27
|
+
readonly oldVersion: ParsedVersion;
|
|
28
|
+
readonly newVersion: ParsedVersion;
|
|
29
|
+
readonly suggestedVersion?: string;
|
|
30
|
+
constructor(message: string, oldVersion: ParsedVersion, newVersion: ParsedVersion, suggestedVersion?: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parses a version string into its components.
|
|
34
|
+
*
|
|
35
|
+
* @param versionString - Version string like "4.0.1" or "4.0.1-beta.20"
|
|
36
|
+
* @returns Parsed version object with major, minor, patch, and optional prerelease
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseVersion(versionString: string): ParsedVersion;
|
|
39
|
+
/**
|
|
40
|
+
* Formats a parsed version back to a string.
|
|
41
|
+
*/
|
|
42
|
+
export declare function formatVersion(version: ParsedVersion): string;
|
|
43
|
+
/**
|
|
44
|
+
* Parses the version file content to extract package name and version.
|
|
45
|
+
*
|
|
46
|
+
* @param content - Content like "@workflow/world-local@4.0.1-beta.20"
|
|
47
|
+
* @returns Object with packageName and version
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseVersionFile(content: string): {
|
|
50
|
+
packageName: string;
|
|
51
|
+
version: ParsedVersion;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Formats the version file content.
|
|
55
|
+
*/
|
|
56
|
+
export declare function formatVersionFile(packageName: string, version: ParsedVersion): string;
|
|
57
|
+
/**
|
|
58
|
+
* Handles version upgrades between old and new versions.
|
|
59
|
+
* This function is called when the data directory was created with a different version.
|
|
60
|
+
*
|
|
61
|
+
* @param oldVersion - The version that created the data directory
|
|
62
|
+
* @param newVersion - The current package version
|
|
63
|
+
* @throws {DataDirVersionError} If the versions are incompatible
|
|
64
|
+
*/
|
|
65
|
+
export declare function upgradeVersion(oldVersion: ParsedVersion, newVersion: ParsedVersion): void;
|
|
66
|
+
/**
|
|
67
|
+
* Ensures the data directory exists and is writable.
|
|
68
|
+
* Creates the directory if it doesn't exist.
|
|
69
|
+
*
|
|
70
|
+
* @param dataDir - The path to the data directory
|
|
71
|
+
* @throws {DataDirAccessError} If the directory cannot be created or accessed
|
|
72
|
+
*/
|
|
73
|
+
export declare function ensureDataDir(dataDir: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Initializes the data directory, ensuring it exists, is accessible,
|
|
76
|
+
* and handles version compatibility.
|
|
77
|
+
*
|
|
78
|
+
* @param dataDir - The path to the data directory
|
|
79
|
+
* @throws {DataDirAccessError} If the directory cannot be created or accessed
|
|
80
|
+
*/
|
|
81
|
+
export declare function initDataDir(dataDir: string): void;
|
|
82
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAUA,wCAAwC;AACxC,eAAO,MAAM,YAAY,0BAA0B,CAAC;AAEpD,uDAAuD;AACvD,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAK/C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAM5D;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;gBAGjC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,aAAa,EACzB,UAAU,EAAE,aAAa,EACzB,gBAAgB,CAAC,EAAE,MAAM;CAQ5B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAejE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAG5D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;CACxB,CAeA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,GACrB,MAAM,CAER;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,aAAa,EACzB,UAAU,EAAE,aAAa,GACxB,IAAI,CAKN;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CA8CnD;AAwDD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CA+CjD"}
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { accessSync, constants, mkdirSync, readFileSync, unlinkSync, writeFileSync, } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/** Package name for version tracking */
|
|
4
|
+
export const PACKAGE_NAME = '@workflow/world-local';
|
|
5
|
+
/** Current package version - imported at build time */
|
|
6
|
+
export const PACKAGE_VERSION = '4.0.1-beta.20';
|
|
7
|
+
/** Filename for storing version information in the data directory */
|
|
8
|
+
const VERSION_FILENAME = 'version.txt';
|
|
9
|
+
/**
|
|
10
|
+
* Error thrown when the data directory cannot be accessed or created.
|
|
11
|
+
*/
|
|
12
|
+
export class DataDirAccessError extends Error {
|
|
13
|
+
dataDir;
|
|
14
|
+
code;
|
|
15
|
+
constructor(message, dataDir, code) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'DataDirAccessError';
|
|
18
|
+
this.dataDir = dataDir;
|
|
19
|
+
this.code = code;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when data directory version is incompatible.
|
|
24
|
+
*/
|
|
25
|
+
export class DataDirVersionError extends Error {
|
|
26
|
+
oldVersion;
|
|
27
|
+
newVersion;
|
|
28
|
+
suggestedVersion;
|
|
29
|
+
constructor(message, oldVersion, newVersion, suggestedVersion) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = 'DataDirVersionError';
|
|
32
|
+
this.oldVersion = oldVersion;
|
|
33
|
+
this.newVersion = newVersion;
|
|
34
|
+
this.suggestedVersion = suggestedVersion;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Parses a version string into its components.
|
|
39
|
+
*
|
|
40
|
+
* @param versionString - Version string like "4.0.1" or "4.0.1-beta.20"
|
|
41
|
+
* @returns Parsed version object with major, minor, patch, and optional prerelease
|
|
42
|
+
*/
|
|
43
|
+
export function parseVersion(versionString) {
|
|
44
|
+
// Match: major.minor.patch with optional prerelease
|
|
45
|
+
const match = versionString.match(/^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/);
|
|
46
|
+
if (!match) {
|
|
47
|
+
throw new Error(`Invalid version string: "${versionString}"`);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
major: parseInt(match[1], 10),
|
|
51
|
+
minor: parseInt(match[2], 10),
|
|
52
|
+
patch: parseInt(match[3], 10),
|
|
53
|
+
prerelease: match[4],
|
|
54
|
+
raw: versionString,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Formats a parsed version back to a string.
|
|
59
|
+
*/
|
|
60
|
+
export function formatVersion(version) {
|
|
61
|
+
const base = `${version.major}.${version.minor}.${version.patch}`;
|
|
62
|
+
return version.prerelease ? `${base}-${version.prerelease}` : base;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parses the version file content to extract package name and version.
|
|
66
|
+
*
|
|
67
|
+
* @param content - Content like "@workflow/world-local@4.0.1-beta.20"
|
|
68
|
+
* @returns Object with packageName and version
|
|
69
|
+
*/
|
|
70
|
+
export function parseVersionFile(content) {
|
|
71
|
+
const trimmed = content.trim();
|
|
72
|
+
const lastAtIndex = trimmed.lastIndexOf('@');
|
|
73
|
+
if (lastAtIndex <= 0) {
|
|
74
|
+
throw new Error(`Invalid version file content: "${content}"`);
|
|
75
|
+
}
|
|
76
|
+
const packageName = trimmed.substring(0, lastAtIndex);
|
|
77
|
+
const versionString = trimmed.substring(lastAtIndex + 1);
|
|
78
|
+
return {
|
|
79
|
+
packageName,
|
|
80
|
+
version: parseVersion(versionString),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Formats the version file content.
|
|
85
|
+
*/
|
|
86
|
+
export function formatVersionFile(packageName, version) {
|
|
87
|
+
return `${packageName}@${formatVersion(version)}`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Handles version upgrades between old and new versions.
|
|
91
|
+
* This function is called when the data directory was created with a different version.
|
|
92
|
+
*
|
|
93
|
+
* @param oldVersion - The version that created the data directory
|
|
94
|
+
* @param newVersion - The current package version
|
|
95
|
+
* @throws {DataDirVersionError} If the versions are incompatible
|
|
96
|
+
*/
|
|
97
|
+
export function upgradeVersion(oldVersion, newVersion) {
|
|
98
|
+
console.log(`[world-local] Upgrading from version ${formatVersion(oldVersion)} to ${formatVersion(newVersion)}`);
|
|
99
|
+
// Future: Add migration logic here when needed
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Ensures the data directory exists and is writable.
|
|
103
|
+
* Creates the directory if it doesn't exist.
|
|
104
|
+
*
|
|
105
|
+
* @param dataDir - The path to the data directory
|
|
106
|
+
* @throws {DataDirAccessError} If the directory cannot be created or accessed
|
|
107
|
+
*/
|
|
108
|
+
export function ensureDataDir(dataDir) {
|
|
109
|
+
const absolutePath = path.resolve(dataDir);
|
|
110
|
+
// Try to create the directory if it doesn't exist
|
|
111
|
+
try {
|
|
112
|
+
mkdirSync(absolutePath, { recursive: true });
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
const nodeError = error;
|
|
116
|
+
// EEXIST is fine - directory already exists
|
|
117
|
+
if (nodeError.code !== 'EEXIST') {
|
|
118
|
+
throw new DataDirAccessError(`Failed to create data directory "${absolutePath}": ${nodeError.message}`, absolutePath, nodeError.code);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Verify the directory is accessible (readable)
|
|
122
|
+
try {
|
|
123
|
+
accessSync(absolutePath, constants.R_OK);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
const nodeError = error;
|
|
127
|
+
throw new DataDirAccessError(`Data directory "${absolutePath}" is not readable: ${nodeError.message}`, absolutePath, nodeError.code);
|
|
128
|
+
}
|
|
129
|
+
// Verify the directory is writable by attempting to write a temp file
|
|
130
|
+
const testFile = path.join(absolutePath, `.workflow-write-test-${Date.now()}`);
|
|
131
|
+
try {
|
|
132
|
+
writeFileSync(testFile, '');
|
|
133
|
+
unlinkSync(testFile);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
const nodeError = error;
|
|
137
|
+
throw new DataDirAccessError(`Data directory "${absolutePath}" is not writable: ${nodeError.message}`, absolutePath, nodeError.code);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Reads the version from the data directory's version file.
|
|
142
|
+
*
|
|
143
|
+
* @param dataDir - Path to the data directory
|
|
144
|
+
* @returns The parsed version info, or null if the file doesn't exist
|
|
145
|
+
*/
|
|
146
|
+
function readVersionFile(dataDir) {
|
|
147
|
+
const versionFilePath = path.join(path.resolve(dataDir), VERSION_FILENAME);
|
|
148
|
+
try {
|
|
149
|
+
const content = readFileSync(versionFilePath, 'utf-8');
|
|
150
|
+
return parseVersionFile(content);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
const nodeError = error;
|
|
154
|
+
if (nodeError.code === 'ENOENT') {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Writes the current version to the data directory's version file.
|
|
162
|
+
*
|
|
163
|
+
* @param dataDir - Path to the data directory
|
|
164
|
+
* @param version - The version to write
|
|
165
|
+
*/
|
|
166
|
+
function writeVersionFile(dataDir, version) {
|
|
167
|
+
const versionFilePath = path.join(path.resolve(dataDir), VERSION_FILENAME);
|
|
168
|
+
const content = formatVersionFile(PACKAGE_NAME, version);
|
|
169
|
+
writeFileSync(versionFilePath, content);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Gets the suggested downgrade version based on the old version.
|
|
173
|
+
* If a specific version is suggested in the error, use that.
|
|
174
|
+
* Otherwise, suggest the previous minor version if patch is 0,
|
|
175
|
+
* or previous major version if minor is also 0.
|
|
176
|
+
*/
|
|
177
|
+
function getSuggestedDowngradeVersion(oldVersion, suggestedVersion) {
|
|
178
|
+
if (suggestedVersion) {
|
|
179
|
+
return suggestedVersion;
|
|
180
|
+
}
|
|
181
|
+
// Suggest the old version as the downgrade target
|
|
182
|
+
return formatVersion(oldVersion);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Initializes the data directory, ensuring it exists, is accessible,
|
|
186
|
+
* and handles version compatibility.
|
|
187
|
+
*
|
|
188
|
+
* @param dataDir - The path to the data directory
|
|
189
|
+
* @throws {DataDirAccessError} If the directory cannot be created or accessed
|
|
190
|
+
*/
|
|
191
|
+
export function initDataDir(dataDir) {
|
|
192
|
+
// First ensure the directory exists and is accessible
|
|
193
|
+
ensureDataDir(dataDir);
|
|
194
|
+
const currentVersion = parseVersion(PACKAGE_VERSION);
|
|
195
|
+
// Read existing version file
|
|
196
|
+
const existingVersionInfo = readVersionFile(dataDir);
|
|
197
|
+
if (existingVersionInfo === null) {
|
|
198
|
+
// New data directory - write the current version
|
|
199
|
+
writeVersionFile(dataDir, currentVersion);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const { version: oldVersion } = existingVersionInfo;
|
|
203
|
+
// Check if versions are the same (no upgrade needed)
|
|
204
|
+
if (formatVersion(oldVersion) === formatVersion(currentVersion)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
// Attempt upgrade
|
|
208
|
+
try {
|
|
209
|
+
upgradeVersion(oldVersion, currentVersion);
|
|
210
|
+
// Upgrade succeeded - write the new version
|
|
211
|
+
writeVersionFile(dataDir, currentVersion);
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
const suggestedVersion = error instanceof DataDirVersionError ? error.suggestedVersion : undefined;
|
|
215
|
+
const downgradeTarget = getSuggestedDowngradeVersion(oldVersion, suggestedVersion);
|
|
216
|
+
console.error(`[world-local] Failed to upgrade data directory from version ${formatVersion(oldVersion)} to ${formatVersion(currentVersion)}:`, error instanceof Error ? error.message : error);
|
|
217
|
+
console.error(`[world-local] Data is not compatible with the current version. ` +
|
|
218
|
+
`Please downgrade to ${PACKAGE_NAME}@${downgradeTarget}`);
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,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AAO,CAAC,KAAK,CACX,iEAAiE;YAC/D,uBAAuB,YAAY,IAAI,eAAe,EAAE,CAC3D,CAAC;QAEF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/queue.d.ts
CHANGED
package/dist/queue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,KAAK,EAAkB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,KAAK,EAAkB,MAAM,iBAAiB,CAAC;AAKxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA4B1C,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,CAgL1D"}
|
package/dist/queue.js
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import { setTimeout } from 'node:timers/promises';
|
|
2
2
|
import { JsonTransport } from '@vercel/queue';
|
|
3
3
|
import { MessageId, ValidQueueName } from '@workflow/world';
|
|
4
|
+
import { Sema } from 'async-sema';
|
|
4
5
|
import { monotonicFactory } from 'ulid';
|
|
6
|
+
import { Agent } from 'undici';
|
|
5
7
|
import z from 'zod';
|
|
6
|
-
|
|
8
|
+
import { resolveBaseUrl } from './config.js';
|
|
9
|
+
import { PACKAGE_VERSION } from './init.js';
|
|
10
|
+
// For local queue, there is no technical limit on the message visibility lifespan,
|
|
11
|
+
// but the environment variable can be used for testing purposes to set a max visibility limit.
|
|
12
|
+
const LOCAL_QUEUE_MAX_VISIBILITY = parseInt(process.env.WORKFLOW_LOCAL_QUEUE_MAX_VISIBILITY ?? '0', 10) ||
|
|
13
|
+
Infinity;
|
|
14
|
+
// The local workers share the same Node.js process and event loop,
|
|
15
|
+
// so we need to limit concurrency to avoid overwhelming the system.
|
|
16
|
+
const DEFAULT_CONCURRENCY_LIMIT = 100;
|
|
17
|
+
const WORKFLOW_LOCAL_QUEUE_CONCURRENCY = parseInt(process.env.WORKFLOW_LOCAL_QUEUE_CONCURRENCY ?? '0', 10) ||
|
|
18
|
+
DEFAULT_CONCURRENCY_LIMIT;
|
|
19
|
+
// Create a custom agent optimized for high-concurrency local workflows:
|
|
20
|
+
// - headersTimeout: 0 allows long-running steps
|
|
21
|
+
// - connections: 100 allows many parallel connections to the same host
|
|
22
|
+
// - pipelining: 1 (default) for HTTP/1.1 compatibility
|
|
23
|
+
// - keepAliveTimeout: 30s keeps connections warm for rapid step execution
|
|
24
|
+
const httpAgent = new Agent({
|
|
25
|
+
headersTimeout: 0,
|
|
26
|
+
connections: 100,
|
|
27
|
+
keepAliveTimeout: 30_000,
|
|
28
|
+
});
|
|
29
|
+
export function createQueue(config) {
|
|
7
30
|
const transport = new JsonTransport();
|
|
8
31
|
const generateId = monotonicFactory();
|
|
32
|
+
const semaphore = new Sema(WORKFLOW_LOCAL_QUEUE_CONCURRENCY);
|
|
9
33
|
/**
|
|
10
34
|
* holds inflight messages by idempotency key to ensure
|
|
11
35
|
* that we don't queue the same message multiple times
|
|
@@ -39,42 +63,64 @@ export function createQueue(port) {
|
|
|
39
63
|
});
|
|
40
64
|
}
|
|
41
65
|
(async () => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
const token = semaphore.tryAcquire();
|
|
67
|
+
if (!token) {
|
|
68
|
+
console.warn(`[world-local]: concurrency limit (${WORKFLOW_LOCAL_QUEUE_CONCURRENCY}) reached, waiting for queue to free up`);
|
|
69
|
+
await semaphore.acquire();
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
let defaultRetriesLeft = 3;
|
|
73
|
+
const baseUrl = await resolveBaseUrl(config);
|
|
74
|
+
for (let attempt = 0; defaultRetriesLeft > 0; attempt++) {
|
|
75
|
+
defaultRetriesLeft--;
|
|
76
|
+
const response = await fetch(`${baseUrl}/.well-known/workflow/v1/${pathname}`, {
|
|
77
|
+
method: 'POST',
|
|
78
|
+
duplex: 'half',
|
|
79
|
+
dispatcher: httpAgent,
|
|
80
|
+
headers: {
|
|
81
|
+
'content-type': 'application/json',
|
|
82
|
+
'x-vqs-queue-name': queueName,
|
|
83
|
+
'x-vqs-message-id': messageId,
|
|
84
|
+
'x-vqs-message-attempt': String(attempt + 1),
|
|
85
|
+
},
|
|
86
|
+
body,
|
|
87
|
+
});
|
|
88
|
+
if (response.ok) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const text = await response.text();
|
|
92
|
+
if (response.status === 503) {
|
|
93
|
+
try {
|
|
94
|
+
const timeoutSeconds = Number(JSON.parse(text).timeoutSeconds);
|
|
95
|
+
await setTimeout(timeoutSeconds * 1000);
|
|
96
|
+
defaultRetriesLeft++;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
catch { }
|
|
65
100
|
}
|
|
66
|
-
|
|
101
|
+
console.error(`[local world] Failed to queue message`, {
|
|
102
|
+
queueName,
|
|
103
|
+
text,
|
|
104
|
+
status: response.status,
|
|
105
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
106
|
+
body: body.toString(),
|
|
107
|
+
});
|
|
67
108
|
}
|
|
68
|
-
console.error(`[
|
|
69
|
-
queueName,
|
|
70
|
-
text,
|
|
71
|
-
status: response.status,
|
|
72
|
-
headers: Object.fromEntries(response.headers.entries()),
|
|
73
|
-
body: body.toString(),
|
|
74
|
-
});
|
|
109
|
+
console.error(`[local world] Reached max retries of local world queue implementation`);
|
|
75
110
|
}
|
|
76
|
-
|
|
77
|
-
|
|
111
|
+
finally {
|
|
112
|
+
semaphore.release();
|
|
113
|
+
}
|
|
114
|
+
})()
|
|
115
|
+
.catch((err) => {
|
|
116
|
+
// Silently ignore client disconnect errors (e.g., browser refresh during streaming)
|
|
117
|
+
// These are expected and should not cause unhandled rejection warnings
|
|
118
|
+
const isAbortError = err?.name === 'AbortError' || err?.name === 'ResponseAborted';
|
|
119
|
+
if (!isAbortError) {
|
|
120
|
+
console.error('[local world] Queue operation failed:', err);
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
.finally(() => {
|
|
78
124
|
for (const fn of cleanup) {
|
|
79
125
|
fn();
|
|
80
126
|
}
|
|
@@ -90,7 +136,11 @@ export function createQueue(port) {
|
|
|
90
136
|
return async (req) => {
|
|
91
137
|
const headers = HeaderParser.safeParse(Object.fromEntries(req.headers));
|
|
92
138
|
if (!headers.success || !req.body) {
|
|
93
|
-
return Response.json({
|
|
139
|
+
return Response.json({
|
|
140
|
+
error: !req.body
|
|
141
|
+
? 'Missing request body'
|
|
142
|
+
: 'Missing required headers',
|
|
143
|
+
}, { status: 400 });
|
|
94
144
|
}
|
|
95
145
|
const queueName = headers.data['x-vqs-queue-name'];
|
|
96
146
|
const messageId = headers.data['x-vqs-message-id'];
|
|
@@ -100,10 +150,13 @@ export function createQueue(port) {
|
|
|
100
150
|
}
|
|
101
151
|
const body = await new JsonTransport().deserialize(req.body);
|
|
102
152
|
try {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
153
|
+
const result = await handler(body, { attempt, queueName, messageId });
|
|
154
|
+
let timeoutSeconds = null;
|
|
155
|
+
if (typeof result?.timeoutSeconds === 'number') {
|
|
156
|
+
timeoutSeconds = Math.min(result.timeoutSeconds, LOCAL_QUEUE_MAX_VISIBILITY);
|
|
157
|
+
}
|
|
158
|
+
if (timeoutSeconds) {
|
|
159
|
+
return Response.json({ timeoutSeconds }, { status: 503 });
|
|
107
160
|
}
|
|
108
161
|
return Response.json({ ok: true });
|
|
109
162
|
}
|
|
@@ -113,7 +166,7 @@ export function createQueue(port) {
|
|
|
113
166
|
};
|
|
114
167
|
};
|
|
115
168
|
const getDeploymentId = async () => {
|
|
116
|
-
return
|
|
169
|
+
return `dpl_local@${PACKAGE_VERSION}`;
|
|
117
170
|
};
|
|
118
171
|
return { queue, createQueueHandler, getDeploymentId };
|
|
119
172
|
}
|
package/dist/queue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAc,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,UAAU,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAc,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,mFAAmF;AACnF,+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Ae,EAAE,CAAC;AACxD,CAAC"}
|
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAEA,OAAO,EAWL,KAAK,OAAO,EAGb,MAAM,iBAAiB,CAAC;AA4NzB,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CA+VtD"}
|