@requence/service 0.7.1 → 0.8.1
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/CHANGELOG.md +36 -0
- package/README.md +15 -0
- package/build/{chunk-6w7td62p.js → chunk-8r349zge.js} +46 -3
- package/build/chunk-8r349zge.js.map +11 -0
- package/build/cli.js +17 -7
- package/build/cli.js.map +3 -3
- package/build/index.js +1261 -446
- package/build/index.js.map +28 -14
- package/build/types/helpers/src/index.d.ts +8 -2
- package/build/types/helpers/src/index.d.ts.map +1 -1
- package/build/types/helpers/src/jsonschema/validate.d.ts +1 -5
- package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -1
- package/build/types/helpers/src/jsonschema/zod.d.ts +11 -1
- package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/NodeTree.d.ts +450 -144
- package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/command.d.ts +364 -142
- package/build/types/helpers/src/protocol/command.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/configurationScript.d.ts +10 -0
- package/build/types/helpers/src/protocol/configurationScript.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/helpers.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/index.d.ts +4 -0
- package/build/types/helpers/src/protocol/index.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/logicLanguages.d.ts +19 -0
- package/build/types/helpers/src/protocol/logicLanguages.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/loopDetection.d.ts +23 -0
- package/build/types/helpers/src/protocol/loopDetection.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/nodeType.d.ts +73 -27
- package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/taskOptions.d.ts +4 -1
- package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/templateNodeTypes.d.ts +36 -20
- package/build/types/helpers/src/protocol/templateNodeTypes.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/treeNodes.d.ts +476 -164
- package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/update.d.ts +22 -22
- package/build/types/helpers/src/protocol/validateTreeStructure.d.ts +22 -0
- package/build/types/helpers/src/protocol/validateTreeStructure.d.ts.map +1 -0
- package/build/types/helpers/src/utils/amqpHeartbeat.d.ts +3 -0
- package/build/types/helpers/src/utils/amqpHeartbeat.d.ts.map +1 -0
- package/build/types/helpers/src/utils/amqpPublishRetry.d.ts +5 -0
- package/build/types/helpers/src/utils/amqpPublishRetry.d.ts.map +1 -0
- package/build/types/helpers/src/utils/claimCheckObject.d.ts +40 -0
- package/build/types/helpers/src/utils/claimCheckObject.d.ts.map +1 -0
- package/build/types/helpers/src/utils/debounce.d.ts.map +1 -1
- package/build/types/helpers/src/{files → utils}/fileObject.d.ts.map +1 -1
- package/build/types/helpers/src/{files → utils}/isValidMimeType.d.ts.map +1 -1
- package/build/types/helpers/src/utils/mapData.d.ts +1 -1
- package/build/types/helpers/src/utils/mapData.d.ts.map +1 -1
- package/build/types/helpers/src/{files → utils}/streamObject.d.ts.map +1 -1
- package/build/types/helpers/src/utils/variableRef.d.ts +19 -0
- package/build/types/helpers/src/utils/variableRef.d.ts.map +1 -0
- package/build/types/helpers/src/utils/variableScriptPatterns.d.ts +125 -0
- package/build/types/helpers/src/utils/variableScriptPatterns.d.ts.map +1 -0
- package/build/types/service/src/boundary.d.ts +75 -0
- package/build/types/service/src/boundary.d.ts.map +1 -0
- package/build/types/service/src/createAmqpConnection.d.ts +21 -4
- package/build/types/service/src/createAmqpConnection.d.ts.map +1 -1
- package/build/types/service/src/errors.d.ts +31 -0
- package/build/types/service/src/errors.d.ts.map +1 -1
- package/build/types/service/src/helpers.d.ts +59 -56
- package/build/types/service/src/helpers.d.ts.map +1 -1
- package/build/types/service/src/index.d.ts +7 -1
- package/build/types/service/src/index.d.ts.map +1 -1
- package/build/types/service/src/transformer.d.ts +16 -0
- package/build/types/service/src/transformer.d.ts.map +1 -0
- package/package.json +6 -3
- package/build/chunk-6w7td62p.js.map +0 -10
- package/build/types/helpers/src/files/RequenceFile.d.ts +0 -40
- package/build/types/helpers/src/files/RequenceFile.d.ts.map +0 -1
- package/build/types/helpers/src/files/RequenceStream.d.ts +0 -32
- package/build/types/helpers/src/files/RequenceStream.d.ts.map +0 -1
- package/build/types/helpers/src/files/index.d.ts +0 -7
- package/build/types/helpers/src/files/index.d.ts.map +0 -1
- package/build/types/helpers/src/files/mapOutput.d.ts +0 -10
- package/build/types/helpers/src/files/mapOutput.d.ts.map +0 -1
- package/build/types/helpers/src/files/types.d.ts +0 -4
- package/build/types/helpers/src/files/types.d.ts.map +0 -1
- package/build/types/helpers/src/utils/createObjectProxy.d.ts +0 -2
- package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +0 -1
- package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +0 -8
- package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +0 -1
- package/build/types/service/src/mapInput.d.ts +0 -2
- package/build/types/service/src/mapInput.d.ts.map +0 -1
- /package/build/types/helpers/src/{files → utils}/fileObject.d.ts +0 -0
- /package/build/types/helpers/src/{files → utils}/isValidMimeType.d.ts +0 -0
- /package/build/types/helpers/src/{files → utils}/streamObject.d.ts +0 -0
package/build/index.js.map
CHANGED
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../../helpers/src/utils/guards.ts", "../../helpers/src/utils/mapData.ts", "../../helpers/src/utils/requenceCallback.ts", "../../helpers/src/files/
|
|
3
|
+
"sources": ["../src/index.ts", "../../helpers/src/utils/guards.ts", "../../helpers/src/utils/mapData.ts", "../../helpers/src/utils/fileObject.ts", "../../helpers/src/utils/streamObject.ts", "../../helpers/src/utils/claimCheckObject.ts", "../../helpers/src/utils/requenceCallback.ts", "../../helpers/src/utils/amqpHeartbeat.ts", "../src/createAmqpConnection.ts", "../../files/src/errors.ts", "../../files/src/streamFraming.ts", "../../files/src/remoteBody.ts", "../../files/src/RequenceFile.ts", "../../files/src/RequenceStream.ts", "../../files/src/handlers/transport.ts", "../../files/src/handlers/fileHandler.ts", "../../files/src/withRequenceStreams.ts", "../../files/src/handlers/streamHandler.ts", "../../files/src/handlers/claimCheckHandler.ts", "../../files/src/sanitizeLogData.ts", "../../callbacks/src/handler.ts", "../../transformer/src/errors.ts", "../../transformer/src/guards.ts", "../../transformer/src/walk.ts", "../../transformer/src/transform.ts", "../src/transformer.ts", "../src/boundary.ts", "../src/helpers.ts", "../src/utils.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import fs from 'node:fs'\n\nimport { deobfuscate } from '@requence/helpers'\nimport type { AmqpConnectionManagerOptions } from 'amqp-connection-manager'\n\nimport createAmqpConnection, {\n type ConnectionApi,\n type MessageHandler,\n connectionOptionsSchema,\n} from './createAmqpConnection.ts'\n\nexport { RequenceFile, RequenceStream } from '@requence/
|
|
5
|
+
"import fs from 'node:fs'\nimport type { ConnectionOptions as TlsConnectionOptions } from 'node:tls'\n\nimport { deobfuscate } from '@requence/helpers'\nimport type { AmqpConnectionManagerOptions } from 'amqp-connection-manager'\n\nimport createAmqpConnection, {\n type ConnectionApi,\n type MessageHandler,\n connectionOptionsSchema,\n} from './createAmqpConnection.ts'\n\nexport { RequenceFile, RequenceStream } from '@requence/files'\nexport {\n createCallback,\n type RequenceCallback,\n type WrappedRequenceCallback,\n} from '@requence/helpers'\nexport * from './errors.ts'\nexport * from './utils.ts'\n\nexport { MessageHandler } from './createAmqpConnection.ts'\n// Undocumented — privileged consumers (the reserved requence-logic runtime)\n// cast their handler context to this; see helpers.ts.\nexport type { PrivilegedContext, PrivilegedSends } from './helpers.ts'\nexport type ServiceApi<\n V extends keyof RequenceService.Version | (string & {}),\n> = ConnectionApi<V>\n\ninterface ServiceOptions<V extends string> {\n accessToken?: string\n devToken?: string\n version: V\n prefetch?: number\n connectionTimeout?: number\n /** heartbeat interval in seconds — defaults to 30 */\n heartbeatInterval?: number\n silent?: boolean\n connectionOptions?: AmqpConnectionManagerOptions['connectionOptions']\n /** Max serialized body size in bytes before a PayloadTooLargeError is thrown. */\n maxMessageSize?: number\n // Undocumented (privileged consumers): skip file/stream/callback\n // rehydration on ingress; claim-checks still resolve. See helpers.ts.\n passthroughByteReferences?: boolean\n}\n\n// TLS connection options overridable via the environment. These are a\n// fallback only: a value supplied in code through `connectionOptions` always\n// wins (see resolveConnectionOptions). `CA` carries inline PEM, `CA_FILE` a\n// path to a PEM file (inline wins when both are set); `REJECT_UNAUTHORIZED`\n// disables certificate verification when falsy (\"false\"/\"0\"/\"no\").\nfunction resolveConnectionOptions(\n connectionOptions: AmqpConnectionManagerOptions['connectionOptions'],\n): AmqpConnectionManagerOptions['connectionOptions'] {\n const rejectEnv = process.env.REJECT_UNAUTHORIZED\n const caEnv = process.env.CA\n const caFileEnv = process.env.CA_FILE\n\n const tlsDefaults: TlsConnectionOptions = {}\n if (rejectEnv !== undefined) {\n tlsDefaults.rejectUnauthorized = !/^(false|0|no)$/i.test(rejectEnv.trim())\n }\n if (caEnv) {\n tlsDefaults.ca = caEnv\n } else if (caFileEnv) {\n tlsDefaults.ca = fs.readFileSync(caFileEnv)\n }\n\n if (Object.keys(tlsDefaults).length === 0) {\n return connectionOptions\n }\n\n // Env defaults first, code-supplied options last → code overrides env.\n return { ...tlsDefaults, ...connectionOptions }\n}\n\nlet pkgJson: any | null\nfunction loadPkgJson() {\n if (!pkgJson) {\n pkgJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'))\n }\n return pkgJson\n}\n\nexport function createService<\n V extends keyof RequenceService.Version | (string & {}),\n>(version: V, messageHandler: MessageHandler<V>): ServiceApi<V>\nexport function createService<\n V extends keyof RequenceService.Version | (string & {}),\n>(options: ServiceOptions<V>, messageHandler: MessageHandler<V>): ServiceApi<V>\nexport function createService<\n V extends keyof RequenceService.Version | (string & {}),\n>(\n optionsOrVersion: ServiceOptions<V> | string,\n optionalMessageHandler?: MessageHandler<V>,\n) {\n let options: ServiceOptions<V>\n let messageHandler: MessageHandler<V>\n if (typeof optionsOrVersion === 'string') {\n options = {\n version: optionsOrVersion as V,\n }\n messageHandler = optionalMessageHandler as MessageHandler<V>\n } else {\n options = optionsOrVersion\n messageHandler = optionalMessageHandler as MessageHandler<V>\n }\n\n let token =\n options.accessToken ??\n process.env.REQUENCE_SERVICE_ACCESS_TOKEN ??\n process.env.REQUENCE_ACCESS_TOKEN\n\n if (!token) {\n try {\n const pkgJson = loadPkgJson()\n token =\n pkgJson.requence?.service?.accessToken ?? pkgJson.requence?.accessToken\n } catch {\n //\n }\n }\n\n let devToken =\n options.devToken ??\n process.env.REQUENCE_SERVICE_DEV_TOKEN ??\n process.env.REQUENCE_DEV_TOKEN\n\n if (!devToken) {\n try {\n const pkgJson = loadPkgJson()\n devToken =\n pkgJson.requence?.service?.devToken ?? pkgJson.requence?.devToken\n } catch {\n //\n }\n }\n\n if (!token) {\n throw new Error('no access token provided')\n }\n\n const parts = deobfuscate(token)\n\n if (parts.length < 2 || parts[0] !== 'service') {\n throw new Error('invalid access token')\n }\n const url = parts[1]\n let devOverlay: string | undefined\n\n if (devToken) {\n const devParts = deobfuscate(devToken)\n if (devParts[0] !== 'api') {\n throw new Error(\n 'invalid dev token: please provide a personal access token',\n )\n }\n if (devParts[2] !== parts[2]) {\n throw new Error(\n 'invalid dev token: access token and dev token belong to different requence instances',\n )\n }\n devOverlay = devParts[1]\n }\n\n const envMaxMessageSize = process.env.REQUENCE_MAX_MESSAGE_SIZE\n ? Number(process.env.REQUENCE_MAX_MESSAGE_SIZE)\n : undefined\n\n return createAmqpConnection<V>(\n connectionOptionsSchema.parse({\n ...options,\n connectionOptions: resolveConnectionOptions(options.connectionOptions),\n maxMessageSize: options.maxMessageSize ?? envMaxMessageSize,\n url,\n devOverlay,\n }),\n messageHandler,\n )\n}\n",
|
|
6
6
|
"import { z } from 'zod/v4'\n\nconst recordSchema = z.record(z.string(), z.unknown())\nexport function isRecord(data: unknown): data is Record<string, unknown> {\n return recordSchema.safeParse(data).success\n}\n\nconst uuidSchema = z.uuid()\nexport function isUuid(data: unknown): data is string {\n return uuidSchema.safeParse(data).success\n}\n",
|
|
7
|
-
"import { isRecord } from './guards.ts'\n\ntype DataVistor<T> = (\n data: T,\n path: Array<string | number>,\n) => Promise<any> | any\n\ninterface DataVistors {\n Null?: DataVistor<null>\n String?: DataVistor<string>\n Number?: DataVistor<number>\n Object?: DataVistor<object>\n Array?: DataVistor<Array<any>>\n Buffer?: DataVistor<
|
|
8
|
-
"import { z } from 'zod/v4'\n\nconst callbackObjectSchema = z.object({\n sourceId: z.string(),\n outputName: z.string().nullable(),\n propertyPath: z.array(z.union([z.string(), z.int()])),\n callbackId: z.uuid(),\n __REQUENCE_type: z.literal('RequenceCallback'),\n})\n\nexport type CallbackObject = z.infer<typeof callbackObjectSchema>\n\nexport function isCallbackObject(data: unknown): data is CallbackObject {\n return callbackObjectSchema.safeParse(data).success\n}\n\nexport type RequenceCallback<T> = (arg: T) => void\nexport type WrappedRequenceCallback<T> = RequenceCallback<T> & {\n response(): Promise<T>\n}\n\nexport function createCallback<T>(\n callback?: (arg: T) => void,\n): WrappedRequenceCallback<T> {\n const { promise, resolve } = Promise.withResolvers<T>()\n\n const executor = (arg: T) => {\n resolve(arg)\n callback?.(arg)\n }\n\n return Object.assign(executor, {\n response() {\n return promise\n },\n })\n}\n",
|
|
7
|
+
"import { isRecord } from './guards.ts'\n\ntype DataVistor<T> = (\n data: T,\n path: Array<string | number>,\n) => Promise<any> | any\n\ninterface DataVistors {\n Null?: DataVistor<null>\n String?: DataVistor<string>\n Number?: DataVistor<number>\n Object?: DataVistor<object>\n Array?: DataVistor<Array<any>>\n Buffer?: DataVistor<Uint8Array>\n Function?: DataVistor<(...args: any[]) => any>\n Symbol?: DataVistor<symbol>\n}\n\ntype HasPromiseVistor<T extends DataVistors, Then, Else> = T[keyof T] extends (\n ...args: any[]\n) => any\n ? Promise<any> extends ReturnType<T[keyof T]>\n ? Then\n : Else\n : Else\n\nfunction resolve<T>(value: T | Promise<T>, onResolve: (value: T) => void) {\n if (value instanceof Promise) {\n return Promise.resolve()\n .then(() => value)\n .then(onResolve)\n }\n return onResolve(value)\n}\n\nfunction notUndefined(value: unknown, fallback: unknown) {\n return resolve(value, (resolvedValue) =>\n typeof resolvedValue === 'undefined' ? fallback : resolvedValue,\n )\n}\n\nclass AbortMapData extends Error {}\n\nexport function mapData<\n Output,\n Input = unknown,\n V extends DataVistors = DataVistors,\n>(\n data: Input,\n visitors: V,\n): HasPromiseVistor<\n V,\n Promise<unknown extends Output ? Input : Output>,\n unknown extends Output ? Input : Output\n> {\n let aborted = false\n const traverseData = (data: any, path: Array<string | number>): any => {\n if (aborted) {\n return data\n }\n try {\n if (Array.isArray(data)) {\n return resolve(visitors.Array?.(data, path), (resolvedData) => {\n if (resolvedData) {\n return resolvedData\n }\n const items = data.map((item, index) =>\n traverseData(item, [...path, index]),\n )\n if (items.some((item) => item instanceof Promise)) {\n return Promise.all(items)\n }\n\n return items\n })\n }\n if (data === null) {\n return notUndefined(visitors.Null?.(data, path), data)\n }\n const runtimeBuffer = (\n globalThis as { Buffer?: { isBuffer(obj: unknown): boolean } }\n ).Buffer\n if (runtimeBuffer?.isBuffer(data)) {\n return notUndefined(visitors.Buffer?.(data as Uint8Array, path), data)\n }\n if (typeof data === 'string') {\n return notUndefined(visitors.String?.(data, path), data)\n }\n if (typeof data === 'number') {\n return notUndefined(visitors.Number?.(data, path), data)\n }\n if (typeof data === 'symbol') {\n return notUndefined(visitors.Symbol?.(data, path), data)\n }\n if (typeof data === 'function') {\n return notUndefined(visitors.Function?.(data, path), data)\n }\n if (isRecord(data)) {\n return resolve(visitors.Object?.({ ...data }, path), (resolvedData) => {\n const nextData = resolvedData ?? data\n if (!isRecord(nextData)) {\n return nextData\n }\n const entries = Object.entries(nextData).map(([key, value]) => [\n key,\n traverseData(value, [...path, key]),\n ])\n\n if (entries.some(([, value]) => value instanceof Promise)) {\n return Promise.all(\n entries.map(([key, value]) =>\n Promise.resolve()\n .then(() => value)\n .then((resolvedValue) => [key, resolvedValue]),\n ),\n ).then((entries) => Object.fromEntries(entries))\n }\n\n return Object.fromEntries(entries)\n })\n }\n if (typeof data === 'object' && data) {\n return notUndefined(visitors.Object?.(data, path), data)\n }\n return data\n } catch (error) {\n if (error instanceof AbortMapData) {\n aborted = true\n return data\n }\n throw error\n }\n }\n\n return traverseData(data, [])\n}\n\nmapData.abort = () => {\n throw new AbortMapData()\n}\n",
|
|
9
8
|
"import { z } from 'zod/v4'\n\nconst fileObjectSchema = z.object({\n size: z.int().positive(),\n mime: z.string(),\n url: z.url(),\n __REQUENCE_type: z.literal('RequenceFile'),\n})\n\nexport type FileObject = z.infer<typeof fileObjectSchema>\n\nexport function toFileObject(fileInfo: {\n size: number\n mime: string\n url: string\n}): FileObject {\n return {\n ...fileInfo,\n __REQUENCE_type: 'RequenceFile',\n }\n}\n\nexport function isFileObject(data: unknown): data is FileObject {\n return fileObjectSchema.safeParse(data).success\n}\n",
|
|
10
|
-
"import type { FileObject } from './index.ts'\nimport type { MainMimeType, SubMimeType, ValidMimeType } from './types.ts'\n\ninterface RequenceFilePropertyBag<T> extends Omit<BlobPropertyBag, 'type'> {\n type: T\n}\n\nexport interface RequenceFileType<A, B> {\n size: number\n mimeType: string\n mainMimeType: A\n subMimeType: B\n text(): Promise<string>\n json(): Promise<unknown>\n blob(): Promise<Blob>\n arrayBuffer(): Promise<ArrayBuffer>\n}\n\nexport class RequenceFile<\n T extends `${string}/${string}` = '*/*',\n A = MainMimeType<T>,\n B = SubMimeType<T>,\n> implements RequenceFileType<A, B> {\n #data: Blob\n #file: FileObject | null = null\n constructor(\n blobParts: BlobPart[],\n options?: RequenceFilePropertyBag<ValidMimeType<T>>,\n ) {\n this.#data = new Blob(blobParts, options)\n }\n\n /** @internal */\n static fromFileObject<T extends `${string}/${string}`>(file: FileObject) {\n const instance = new this([], { type: 'x/x' })\n instance.#file = file\n return instance as RequenceFile<T>\n }\n\n /** @internal */\n get fileObject() {\n return this.#file\n }\n\n get size() {\n return this.#file?.size ?? this.#data.size\n }\n\n get mimeType() {\n return this.#file?.mime ?? this.#data.type\n }\n\n get mainMimeType() {\n return this.mimeType.split('/')[0] as A\n }\n\n get subMimeType() {\n return this.mimeType.split('/')[1] as B\n }\n\n async text() {\n if (this.#file) {\n return fetch(this.#file.url).then((response) => response.text())\n }\n return this.#data.text()\n }\n\n async json() {\n if (this.#file) {\n return fetch(this.#file.url).then((response) => response.json())\n }\n return JSON.parse(await this.text())\n }\n\n async blob() {\n if (this.#file) {\n return fetch(this.#file.url).then((response) => response.blob())\n }\n return this.#data\n }\n\n async arrayBuffer() {\n if (this.#file) {\n return fetch(this.#file.url).then((response) => response.arrayBuffer())\n }\n return this.#data.arrayBuffer()\n }\n\n toString() {\n return `RequenceFile<${this.mimeType}>`\n }\n\n toJSON() {\n return `RequenceFile<${this.mimeType}>`\n }\n}\n",
|
|
11
|
-
"import type { StreamObject } from './index.ts'\nimport type { MainMimeType, SubMimeType, ValidMimeType } from './types.ts'\n\nexport interface RequenceStreamType<A, B> {\n mimeType: string\n mainMimeType: A\n subMimeType: B\n stream(): ReadableStream\n}\n\ninterface RequenceStreamOptions<T> {\n type: T\n}\n\nexport class RequenceStream<\n T extends `${string}/${string}` = '*/*',\n A = MainMimeType<T>,\n B = SubMimeType<T>,\n> implements RequenceStreamType<A, B> {\n #data: ReadableStream\n #stream: StreamObject | null = null\n #options: RequenceStreamOptions<any>\n\n constructor(\n stream: ReadableStream,\n options: RequenceStreamOptions<ValidMimeType<T>>,\n ) {\n this.#data = stream\n this.#options = options\n }\n\n /** @internal */\n static fromStreamObject<T extends `${string}/${string}`>(\n stream: StreamObject,\n ) {\n const instance = new this(null as unknown as ReadableStream, {\n type: 'x/x',\n })\n instance.#stream = stream\n return instance as unknown as RequenceStream<T>\n }\n\n /** @internal */\n get streamObject() {\n return this.#stream\n }\n\n get mimeType() {\n return this.#stream?.mime ?? this.#options.type\n }\n\n get mainMimeType() {\n return this.mimeType.split('/')[0] as A\n }\n\n get subMimeType() {\n return this.mimeType.split('/')[1] as B\n }\n\n stream() {\n if (this.#stream) {\n const { readable, writable } = new TransformStream()\n\n fetch(this.#stream.url).then((response) =>\n response.body?.pipeTo(writable),\n )\n\n return readable\n }\n return this.#data\n }\n\n asyncIterable(): AsyncIterable<Uint8Array> {\n const reader = this.stream().getReader()\n\n return {\n [Symbol.asyncIterator]() {\n return {\n async next() {\n return reader.read() as Promise<IteratorResult<Uint8Array>>\n },\n async return() {\n reader.cancel()\n reader.releaseLock()\n return { done: true, value: null }\n },\n }\n },\n }\n }\n\n toString() {\n return `RequenceStream<${this.mimeType}>`\n }\n\n toJSON() {\n return `RequenceStream<${this.mimeType}>`\n }\n}\n",
|
|
12
9
|
"import { z } from 'zod/v4'\n\nconst streamObjectSchema = z.object({\n mime: z.string(),\n url: z.string().url(),\n __REQUENCE_type: z.literal('RequenceStream'),\n})\n\nexport type StreamObject = z.infer<typeof streamObjectSchema>\n\nexport function isStreamObject(data: unknown): data is StreamObject {\n return streamObjectSchema.safeParse(data).success\n}\n\nexport function toStreamObject(streamInfo: {\n mime: string\n url: string\n}): StreamObject {\n return {\n ...streamInfo,\n __REQUENCE_type: 'RequenceStream',\n }\n}\n",
|
|
13
|
-
"import {
|
|
14
|
-
"import {
|
|
15
|
-
"import { type MaybePromise, deobfuscate, obfuscate } from '@requence/helpers'\nimport { type Options, connect } from 'amqp-connection-manager'\nimport type { ConfirmChannel } from 'amqplib'\nimport { z } from 'zod/v4'\n\nimport { RequenceConnectionError } from './errors.ts'\nimport createContextHelper, {\n AbortError,\n type ContextHelper,\n type JSONValue,\n RetryError,\n SkipError,\n handlerStorage,\n processData,\n unwrapResult,\n} from './helpers.ts'\nimport { libVersion } from './macro.ts' with { type: 'macro' }\nimport mapInput from './mapInput.ts'\n\ntype InternalNamedOutput = '__internal_named_output__'\n\ntype Input<V extends keyof RequenceService.Version> =\n RequenceService.Version[V]['input']\ntype Configuration<V extends keyof RequenceService.Version> =\n RequenceService.Version[V]['configuration']\ntype OutputName<\n V extends keyof RequenceService.Version,\n K = keyof RequenceService.Version[V]['outputs'],\n> = K extends '__default__' ? null : K\n\ntype OutputValue<\n V extends keyof RequenceService.Version,\n O extends OutputName<V>,\n ON = O extends null ? '__default__' : O,\n> = ON extends keyof RequenceService.Version[V]['outputs']\n ? RequenceService.Version[V]['outputs'][ON]\n : never\n\ninterface ServiceContextHelper<\n V extends keyof RequenceService.Version,\n> extends Omit<\n ContextHelper,\n 'input' | 'configuration' | 'getData' | 'getConfiguration' | 'toOutput'\n> {\n input: Input<V>\n configuration: Configuration<V>\n\n toOutput<O extends OutputName<V>>(\n name: O,\n value: OutputValue<V, O>,\n ): InternalNamedOutput\n}\n\ntype ApiOutputName<V> = V extends keyof RequenceService.Version\n ? OutputName<V>\n : string | null\ntype ApiOutputValue<V, O> = V extends keyof RequenceService.Version\n ? O extends OutputName<V>\n ? OutputValue<V, O>\n : unknown\n : unknown\n\ninterface ActorApi<V> {\n sendToOutput<O extends ApiOutputName<V>>(\n outputName: O,\n data: ApiOutputValue<V, O>,\n ): void\n send(data: ApiOutputValue<V, null>): void\n abort(error: string | Error): void\n}\n\nexport interface ConnectionApi<V> {\n close(): Promise<void>\n open(): Promise<ConnectionApi<V>>\n act(\n messageKey: string,\n actor: (\n api: ActorApi<V>,\n ) =>\n | ApiOutputValue<V, null>\n | Promise<ApiOutputValue<V, null>>\n | void\n | Promise<void>\n | AsyncGenerator<ApiOutputValue<V, null>>\n | Generator<ApiOutputValue<V, null>>,\n ): Promise<void>\n}\n\nconst messageKeySchema = z\n .string()\n .transform((str) => deobfuscate(str))\n .pipe(z.tuple([z.uuid(), z.uuid()]).rest(z.string()))\n .transform((arr) => ({\n taskId: arr[0],\n messageId: arr[1],\n uploadUrl: arr[2] || undefined,\n streamUrl: arr[3] || undefined,\n }))\n\nconst headerSchema = z\n .object({\n properties: z.object({\n correlationId: z.uuid(),\n headers: z.object({\n taskId: z.uuid(),\n mode: z.enum(['LINEAR', 'CONTINUOUS']).default('LINEAR'),\n }),\n }),\n })\n .transform((msg) => ({\n messageId: msg.properties.correlationId,\n taskId: msg.properties.headers.taskId,\n mode: msg.properties.headers.mode,\n }))\n\nconst payloadSchema = z\n .object({ content: z.instanceof(Buffer) })\n .transform((msg) => JSON.parse(msg.content.toString()))\n .pipe(\n z.object({\n input: z.unknown(),\n configuration: z.unknown(),\n options: z.object({\n uploadUrl: z.url().optional(),\n streamUrl: z.url().optional(),\n }),\n }),\n )\n\nconst backchannelMessageSchema = z\n .object({\n content: z\n .instanceof(Buffer)\n .transform((content) => JSON.parse(content.toString()))\n .pipe(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('stop'),\n }),\n z.object({\n type: z.literal('callback'),\n callbackId: z.uuid(),\n arg: z.any(),\n }),\n ]),\n ),\n properties: z.object({\n correlationId: z.string(),\n }),\n })\n .transform((message) => ({\n payload: message.content,\n messageId: message.properties.correlationId,\n }))\n\nconst abortSymbol = Symbol()\n\nexport const connectionOptionsSchema = z.object({\n url: z.union([\n z\n .string()\n .regex(/^amqps?:\\/\\/(.+):(.+)@(.+)$/)\n .transform((str) => new URL(str)),\n z\n .instanceof(URL)\n .refine((url) => url.protocol.match(/^amqps?:/), 'Wrong protocol'),\n ]),\n version: z.string(),\n devOverlay: z.string().optional(),\n silent: z.boolean().optional(),\n prefetch: z.number().int().optional(),\n connectionTimeout: z.number().positive().default(3_000),\n connectionOptions: z.any().optional(),\n})\n\nexport type ConnectionOptions = z.output<typeof connectionOptionsSchema>\n\ntype MessageHandlerContext<V> = V extends keyof RequenceService.Version\n ? ServiceContextHelper<V>\n : ContextHelper\ntype MessageHandlerReturnValue<\n V,\n O = null,\n> = V extends keyof RequenceService.Version\n ? O extends OutputName<V>\n ? OutputValue<V, O> | InternalNamedOutput\n : void\n : JSONValue\n\ntype MessageHandlerFunction<V> = (\n context: MessageHandlerContext<V>,\n) => MaybePromise<MessageHandlerReturnValue<V> | void>\n\ntype MessageHandlerGenerator<V> = (\n context: MessageHandlerContext<V>,\n) => Generator<\n MessageHandlerReturnValue<V>,\n MessageHandlerReturnValue<V> | void,\n void\n>\ntype MessageHandlerAsyncGenerator<V> = (\n context: MessageHandlerContext<V>,\n) => AsyncGenerator<\n MessageHandlerReturnValue<V>,\n MessageHandlerReturnValue<V> | void,\n void\n>\n\nexport type MessageHandler<V> = V extends keyof RequenceService.Version\n ? RequenceService.Version[V]['mode'] extends 'LINEAR'\n ? MessageHandlerFunction<V>\n :\n | MessageHandlerAsyncGenerator<V>\n | MessageHandlerGenerator<V>\n | MessageHandlerFunction<V>\n :\n | MessageHandlerAsyncGenerator<V>\n | MessageHandlerGenerator<V>\n | MessageHandlerFunction<V>\n\nfunction isMessageHandlerGenerator<V extends keyof RequenceService.Version>(\n // oxlint-disable-next-line typescript/no-unsafe-function-type\n handler: Function,\n): handler is MessageHandlerGenerator<V> | MessageHandlerAsyncGenerator<V> {\n return (\n handler.constructor.name === 'GeneratorFunction' ||\n handler.constructor.name === 'AsyncGeneratorFunction'\n )\n}\n\nconst activeMessages = new Map<string, Promise<void>>()\n\nexport default function createConnection<V>(\n {\n url,\n version,\n prefetch = 1,\n silent = false,\n connectionTimeout,\n connectionOptions,\n devOverlay = '',\n }: ConnectionOptions,\n messageHandler: MessageHandler<V>,\n) {\n const baseQueue = `${url.username}@${version}`\n const queue = devOverlay\n ? `${baseQueue}-dev-overlay-${devOverlay}`\n : baseQueue\n const exchange = url.username\n const connection = connect(url.toString(), { connectionOptions })\n\n const connectedPromise = new Promise<void>((resolve, reject) => {\n const unsubscribe = () => {\n clearTimeout(timeout)\n connection.removeListener('connect', handleConnect)\n connection.removeListener('connectFailed', handleConnectFailed)\n }\n\n const timeout = setTimeout(() => {\n handleConnectFailed({\n err: new RequenceConnectionError('Requence connection timeout'),\n })\n }, connectionTimeout)\n\n const handleConnect = () => {\n unsubscribe()\n resolve()\n }\n\n const handleConnectFailed = ({ err }: { err: Error }) => {\n unsubscribe()\n if (\n err.message.startsWith(\n 'Handshake terminated by server: 403 (ACCESS-REFUSED)',\n )\n ) {\n reject(new RequenceConnectionError('Invalid service credentials'))\n } else {\n reject(err)\n }\n }\n\n connection.addListener('connect', handleConnect)\n connection.addListener('connectFailed', handleConnectFailed)\n })\n\n const connectionId = crypto.randomUUID()\n const backchannelQueue = `${baseQueue}-backchannel-${connectionId}`\n const generatorTerminators = new Map<string, (reason: string) => void>()\n const callbacks = new Map<string, (...args: any[]) => void>()\n\n const channelWrapper = connection.createChannel({\n async setup(channel: ConfirmChannel) {\n if (devOverlay) {\n await channel.assertQueue(queue)\n await channel.bindQueue(queue, 'service', queue)\n }\n await channel.checkExchange(exchange)\n await channel.checkExchange(`${exchange}-retry`)\n await channel.checkQueue(queue)\n await channel.prefetch(prefetch)\n\n await channel.assertQueue(backchannelQueue, {\n exclusive: true,\n })\n\n await channel.bindQueue(backchannelQueue, 'service', backchannelQueue)\n\n await channel.consume(\n backchannelQueue,\n async (message) => {\n const result = backchannelMessageSchema.safeParse(message)\n\n if (!result.success) {\n return\n }\n\n const backchannelMessage = result.data\n\n switch (backchannelMessage.payload.type) {\n case 'stop': {\n generatorTerminators.get(backchannelMessage.messageId)?.(\n 'task stopped',\n )\n break\n }\n case 'callback': {\n callbacks.get(backchannelMessage.payload.callbackId)?.(\n backchannelMessage.payload.arg,\n )\n break\n }\n }\n },\n {\n noAck: true,\n },\n )\n },\n })\n\n const publish = ({\n data,\n outputName,\n messageId,\n priority,\n ...headers\n }: {\n index: number\n data?: unknown\n outputName?: string | null\n messageId: string\n taskId: string\n priority?: number\n version: string\n debugMethod?: 'log' | 'warn' | 'info' | 'error'\n debug?: boolean\n connectionId?: string\n callbackId?: string\n propertyPath?: (string | number)[]\n begin?: boolean\n deferred?: boolean\n done?: boolean\n }) =>\n channelWrapper.publish(\n exchange,\n '',\n Buffer.from(JSON.stringify(data ?? null)),\n {\n correlationId: messageId,\n contentType: 'application/json',\n persistent: true,\n priority,\n headers: {\n outputName: outputName ?? null,\n connectionId,\n libVersion: libVersion(),\n ...headers,\n },\n },\n )\n\n channelWrapper.addSetup(async (channel: ConfirmChannel) => {\n channel.consume(queue, async (message) => {\n if (!message) {\n return\n }\n\n let publishIndex = 0\n let acked = false\n let terminated = false\n const donePromises: Array<Promise<void>> = []\n const registeredCallbackIds = new Set<string>()\n let resolveActiveMessage = () => {}\n\n const { messageId, taskId, mode } = headerSchema.parse(message)\n\n try {\n let deferred = false\n let deferredReason: string | null = null\n\n const messageExecution = Promise.withResolvers<void>()\n activeMessages.set(messageId, messageExecution.promise)\n messageExecution.promise.then(() => {\n activeMessages.delete(messageId)\n })\n resolveActiveMessage = () => {\n messageExecution.resolve()\n }\n\n const payload = payloadSchema.parse(message)\n\n const [extendedContext, terminatePromise] = createContextHelper({\n taskId,\n input: mapInput(payload.input),\n configuration: mapInput(payload.configuration),\n onLog(debugMethod, data) {\n publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data,\n debugMethod,\n priority: message.properties.priority,\n debug: true,\n })\n },\n onDefer(reason) {\n deferred = true\n deferredReason = reason || null\n\n return obfuscate(\n taskId,\n messageId,\n payload.options.uploadUrl ?? '',\n payload.options.streamUrl ?? '',\n )\n },\n onCallback(params) {\n publish({\n index: 0,\n version,\n taskId,\n messageId,\n data: params.arg,\n outputName: params.outputName,\n connectionId: params.sourceId,\n callbackId: params.callbackId,\n propertyPath: params.propertyPath,\n })\n },\n }) as unknown as [\n MessageHandlerContext<V>,\n PromiseWithResolvers<string>,\n ]\n\n await publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n priority: message.properties.priority,\n begin: true,\n })\n\n if (\n isMessageHandlerGenerator(messageHandler) &&\n mode === 'CONTINUOUS'\n ) {\n // CONTINUOUS generator: ACK immediately, operator watchdog supervises\n channel.ack(message)\n acked = true\n\n const generator = messageHandler(extendedContext)\n const terminationPromise = Promise.withResolvers<typeof abortSymbol>()\n generatorTerminators.set(messageId, (reason) => {\n terminated = true\n // Suppress native AbortError that may reject generator.return() when\n // context.terminated.signal fires and cancels a pending await inside\n // the generator (e.g. node:timers/promises setTimeout with { signal }).\n ;(generator.return() as Promise<unknown>).catch(\n (error: unknown) => {\n if (\n terminated &&\n error instanceof Error &&\n error.name === 'AbortError' &&\n !(error instanceof AbortError)\n ) {\n return\n }\n throw error\n },\n )\n terminationPromise.resolve(abortSymbol)\n terminatePromise.resolve(reason)\n })\n\n await handlerStorage.run(\n extendedContext as ContextHelper,\n async () => {\n while (true) {\n type IterResult = IteratorResult<\n MessageHandlerReturnValue<V, null>,\n void | MessageHandlerReturnValue<V, null>\n >\n // Catch native AbortError from context.terminated.signal so\n // generator implementations don't need their own try/catch.\n const nextPromise = Promise.resolve(generator.next()).then(\n (r) => r,\n (error: unknown) => {\n if (\n terminated &&\n error instanceof Error &&\n error.name === 'AbortError' &&\n !(error instanceof AbortError)\n ) {\n return { value: undefined, done: true } as IterResult\n }\n throw error\n },\n )\n const next = await Promise.race([\n terminationPromise.promise,\n nextPromise,\n ])\n if (next === abortSymbol) {\n break\n }\n\n const { value: result, done } = next\n\n if (deferred) {\n deferred = false\n console.warn(\n 'returning a value in a deferred message resets the deferred status',\n )\n }\n\n const donePromise = Promise.withResolvers<void>()\n donePromises.push(donePromise.promise)\n\n const { value, outputName } = await unwrapResult({\n result,\n options: payload.options,\n onDone: donePromise.resolve,\n onCallback: (callback) => {\n const callbackId = crypto.randomUUID()\n registeredCallbackIds.add(callbackId)\n callbacks.set(callbackId, callback)\n return {\n sourceId: connectionId,\n callbackId,\n }\n },\n })\n\n if (!done || typeof value !== 'undefined') {\n publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: value,\n priority: message.properties.priority,\n outputName,\n })\n }\n\n if (done) {\n break\n }\n }\n },\n )\n } else {\n const result = await handlerStorage.run(\n extendedContext as ContextHelper,\n () => messageHandler(extendedContext),\n )\n const donePromise = Promise.withResolvers<void>()\n donePromises.push(donePromise.promise)\n const { value, outputName } = await unwrapResult({\n result,\n options: payload.options,\n onDone: donePromise.resolve,\n onCallback: () => {\n throw new Error(\n 'callbacks can only be used in generator functions',\n )\n },\n })\n if (deferred && value) {\n console.warn(\n 'returning a value in a deferred message resets the deferred status',\n )\n deferred = false\n }\n\n if (!deferred || value) {\n publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: value,\n priority: message.properties.priority,\n outputName,\n })\n }\n }\n\n await new Promise<void>((resolve) => {\n setImmediate(async () => {\n if (!deferred) {\n await Promise.allSettled(donePromises)\n }\n\n await publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: deferredReason,\n priority: message.properties.priority,\n deferred,\n done: !deferred,\n })\n\n if (!acked) {\n channel.ack(message)\n }\n resolve()\n })\n })\n } catch (error) {\n if (error instanceof SkipError) {\n if (!acked) {\n channel.nack(message)\n }\n return\n }\n if (error instanceof RetryError) {\n if (!acked) {\n channel.ack(message)\n }\n const properties: Options.Publish = {\n ...message.properties,\n expiration: error.delay || 1_000, // 1s\n }\n channel.publish(\n `${exchange}-retry`,\n version, // to other services\n message.content,\n properties,\n )\n\n return\n }\n\n if (error instanceof AbortError && error.message.length > 0) {\n if (!acked) {\n channelWrapper.ack(message)\n }\n channelWrapper.publish(\n `${exchange}-retry`,\n 'operator', //back to operator\n error.message,\n {\n ...message.properties,\n contentType: 'text/plain',\n headers: {\n ...message.properties.headers,\n index: publishIndex++,\n libVersion: libVersion(),\n abort: true,\n },\n },\n )\n\n return\n }\n\n // Native AbortError thrown when context.terminated.signal fires\n // (e.g. node:timers/promises setTimeout with { signal: context.terminated.signal }).\n // Only suppress when actually in a terminated state — otherwise a\n // different AbortSignal caused the error and it should propagate.\n if (\n terminated &&\n error instanceof Error &&\n error.name === 'AbortError' &&\n !(error instanceof AbortError)\n ) {\n if (!acked) {\n channel.ack(message)\n }\n return\n }\n\n if (error instanceof Error) {\n if (!silent) {\n console.error('Encountered an error inside service handler:')\n console.error(error)\n }\n\n if (!acked) {\n channel.ack(message)\n }\n channel.publish(\n `${exchange}-retry`,\n 'operator', // back to operator\n message.content,\n {\n ...message.properties,\n headers: {\n ...message.properties.headers,\n version,\n exception: true,\n index: publishIndex++,\n libVersion: libVersion(),\n 'error-message': error.message || 'error in service handler',\n },\n },\n )\n\n return\n }\n } finally {\n generatorTerminators.delete(messageId)\n registeredCallbackIds.forEach((id) => callbacks.delete(id))\n resolveActiveMessage()\n }\n })\n })\n\n const activeMessageKeys = new Set<string>()\n const api: ConnectionApi<V> = {\n close: async () => {\n await channelWrapper.close()\n await connection.close()\n },\n open: () => connectedPromise.then(() => api),\n\n async act(messageKey, actor) {\n if (activeMessageKeys.has(messageKey)) {\n throw new Error('a defer key can only be used once')\n }\n\n activeMessageKeys.add(messageKey)\n\n let publishIndex = 0\n const { taskId, messageId, ...options } =\n messageKeySchema.parse(messageKey)\n\n const activeMessage = async () => {\n if (activeMessages.has(messageId)) {\n await activeMessages.get(messageId)\n }\n }\n\n const registeredCallbackIds = new Set<string>()\n const donePromises: Array<Promise<unknown>> = []\n\n const sendApi = {\n async sendToOutput(outputName: string, data: unknown) {\n await activeMessage()\n const donePromise = Promise.withResolvers<void>()\n donePromises.push(donePromise.promise)\n donePromises.push(\n publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: await processData({\n outputName: outputName as string | null,\n data,\n options,\n onDone: donePromise.resolve,\n onCallback: (callback) => {\n const callbackId = crypto.randomUUID()\n registeredCallbackIds.add(callbackId)\n callbacks.set(callbackId, callback)\n\n return {\n sourceId: connectionId,\n callbackId,\n }\n },\n }),\n outputName: outputName as string | null,\n }),\n )\n },\n async send(data: unknown) {\n await activeMessage()\n const donePromise = Promise.withResolvers<void>()\n donePromises.push(donePromise.promise)\n donePromises.push(\n publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: await processData({\n outputName: null,\n data,\n options,\n onDone: donePromise.resolve,\n onCallback: (callback) => {\n const callbackId = crypto.randomUUID()\n registeredCallbackIds.add(callbackId)\n callbacks.set(callbackId, callback)\n return {\n sourceId: connectionId,\n callbackId,\n }\n },\n }),\n }),\n )\n },\n async abort(error: string | Error) {\n await activeMessage()\n channelWrapper.publish(\n `${exchange}-retry`,\n 'operator',\n error instanceof Error ? error.message : error,\n {\n persistent: true,\n correlationId: messageId,\n expiration: 0,\n priority: 0,\n contentType: 'text/plain',\n headers: {\n taskId,\n libVersion: libVersion(),\n index: publishIndex++,\n abort: true,\n },\n },\n )\n },\n }\n\n const result = await actor(sendApi as ActorApi<V>)\n\n if (\n result != null &&\n typeof result === 'object' &&\n (Symbol.asyncIterator in result || Symbol.iterator in result)\n ) {\n // Generator: iterate and send each yielded value\n const iterable = result as AsyncIterable<unknown> | Iterable<unknown>\n for await (const value of iterable) {\n if (value !== undefined) {\n await sendApi.send(value)\n }\n }\n } else if (result !== undefined) {\n await sendApi.send(result)\n }\n\n await new Promise((resolve) => setImmediate(resolve))\n await activeMessage()\n\n while (true) {\n const promiseCount = donePromises.length\n await Promise.allSettled(donePromises)\n if (promiseCount === donePromises.length) {\n break\n }\n }\n\n registeredCallbackIds.forEach((id) => callbacks.delete(id))\n\n await publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n done: true,\n })\n\n activeMessageKeys.delete(messageKey)\n },\n }\n\n return api\n}\n",
|
|
16
|
-
"export class RequenceConnectionError extends Error {}\n",
|
|
17
|
-
"
|
|
18
|
-
"import {
|
|
10
|
+
"import { z } from 'zod/v4'\n\nconst claimCheckObjectSchema = z.object({\n url: z.url(),\n size: z.int().positive(),\n __REQUENCE_type: z.literal('ClaimCheck'),\n})\n\n/**\n * Reference left behind by the oversized-message claim-check: the value was\n * offloaded to the files service and is fetched back (and re-walked) on\n * ingress by the `ClaimCheck` value handler.\n */\nexport type ClaimCheckObject = z.infer<typeof claimCheckObjectSchema>\n\nexport function toClaimCheckObject(info: {\n url: string\n size: number\n}): ClaimCheckObject {\n return {\n ...info,\n __REQUENCE_type: 'ClaimCheck',\n }\n}\n\nexport function isClaimCheckObject(data: unknown): data is ClaimCheckObject {\n return claimCheckObjectSchema.safeParse(data).success\n}\n\n/**\n * JSON-schema equivalent of the reference shape, for claim-check-aware\n * validation: a subschema position holding a `ClaimCheck` reference is\n * validated against this instead of the declared subschema (shape validation\n * of the offloaded value is deferred to the consumer after rehydration).\n */\nexport const claimCheckJsonSchema = {\n type: 'object',\n properties: {\n url: { type: 'string' },\n size: { type: 'integer' },\n __REQUENCE_type: { const: 'ClaimCheck' },\n },\n required: ['url', 'size', '__REQUENCE_type'],\n} as const\n",
|
|
11
|
+
"import { z } from 'zod/v4'\n\nconst callbackObjectSchema = z.object({\n sourceId: z.string(),\n outputName: z.string().nullable(),\n propertyPath: z.array(z.union([z.string(), z.int()])),\n callbackId: z.uuid(),\n __REQUENCE_type: z.literal('RequenceCallback'),\n})\n\nexport type CallbackObject = z.infer<typeof callbackObjectSchema>\n\nexport function isCallbackObject(data: unknown): data is CallbackObject {\n return callbackObjectSchema.safeParse(data).success\n}\n\nexport type RequenceCallback<T> = (arg: T) => void\nexport type WrappedRequenceCallback<T> = RequenceCallback<T> & {\n response(): Promise<T>\n}\n\nexport function createCallback<T>(\n callback?: (arg: T) => void,\n): WrappedRequenceCallback<T> {\n const { promise, resolve } = Promise.withResolvers<T>()\n\n const executor = (arg: T) => {\n resolve(arg)\n callback?.(arg)\n }\n\n return Object.assign(executor, {\n response() {\n return promise\n },\n })\n}\n",
|
|
12
|
+
"// The negotiated AMQP heartbeat is the CLIENT's choice: the broker sets no\n// `heartbeat` in `deploy/swarm/rabbitmq/rabbitmq.conf`, so its own 60s default\n// is only a ceiling. `amqp-connection-manager` defaults to 5s, which makes any\n// event-loop stall longer than 10s (two missed intervals) fatal to every\n// connection in the deployment at once — that is what dropped eight connections\n// simultaneously in the 2026-07-30 incident.\n//\n// 30s tolerates ~60s of stall: longer than any GC/IO pause that does not already\n// mean the process is dead, short enough that a genuinely wedged client is still\n// reaped.\nexport const DEFAULT_AMQP_HEARTBEAT_SECONDS = 30\n\n// Sets the heartbeat as a URL query parameter, which is the one mechanism every\n// client understands: plain `amqplib` reads it during negotiation, and\n// `amqp-connection-manager` appends its own 5s default only when the param is\n// absent (`dist/cjs/AmqpConnectionManager.js`), so this wins there too.\n//\n// Non-destructive by design — an explicit `?heartbeat=` in the configured URL\n// always wins, and the input URL is never mutated.\nexport function withAmqpHeartbeat(url: URL): URL {\n const next = new URL(url.toString())\n if (!next.searchParams.has('heartbeat')) {\n next.searchParams.set('heartbeat', String(DEFAULT_AMQP_HEARTBEAT_SECONDS))\n }\n return next\n}\n",
|
|
13
|
+
"import type { CallbackIngressContext } from '@requence/callbacks'\nimport {\n DEFAULT_AMQP_HEARTBEAT_SECONDS,\n type MaybePromise,\n deobfuscate,\n obfuscate,\n} from '@requence/helpers'\nimport { type Options, connect } from 'amqp-connection-manager'\nimport type { ConfirmChannel, ConsumeMessage } from 'amqplib'\nimport { z } from 'zod/v4'\n\nimport {\n type OutboundBoundary,\n createInboundBoundary,\n createOutboundBoundary,\n} from './boundary.ts'\nimport { PayloadTooLargeError, RequenceConnectionError } from './errors.ts'\nimport createContextHelper, {\n AbortError,\n type ContextHelper,\n type JSONValue,\n RetryError,\n SkipError,\n handlerStorage,\n unwrapOutputValue,\n} from './helpers.ts'\nimport { libVersion } from './macro.ts' with { type: 'macro' }\nimport { passthroughInboundTransformer } from './transformer.ts'\n\ntype InternalNamedOutput = '__internal_named_output__'\n\ntype Input<V extends keyof RequenceService.Version> =\n RequenceService.Version[V]['input']\ntype Configuration<V extends keyof RequenceService.Version> =\n RequenceService.Version[V]['configuration']\ntype OutputName<\n V extends keyof RequenceService.Version,\n K = keyof RequenceService.Version[V]['outputs'],\n> = K extends '__default__' ? null : K\n\ntype OutputValue<\n V extends keyof RequenceService.Version,\n O extends OutputName<V>,\n ON = O extends null ? '__default__' : O,\n> = ON extends keyof RequenceService.Version[V]['outputs']\n ? RequenceService.Version[V]['outputs'][ON]\n : never\n\ninterface ServiceContextHelper<\n V extends keyof RequenceService.Version,\n> extends Omit<\n ContextHelper,\n 'input' | 'configuration' | 'getData' | 'getConfiguration' | 'toOutput'\n> {\n input: Input<V>\n configuration: Configuration<V>\n\n toOutput<O extends OutputName<V>>(\n name: O,\n value: OutputValue<V, O>,\n ): InternalNamedOutput\n}\n\ntype ApiOutputName<V> = V extends keyof RequenceService.Version\n ? OutputName<V>\n : string | null\ntype ApiOutputValue<V, O> = V extends keyof RequenceService.Version\n ? O extends OutputName<V>\n ? OutputValue<V, O>\n : unknown\n : unknown\n\ninterface ActorApi<V> {\n sendToOutput<O extends ApiOutputName<V>>(\n outputName: O,\n data: ApiOutputValue<V, O>,\n options?: { overwrite?: boolean },\n ): void\n send(data: ApiOutputValue<V, null>, options?: { overwrite?: boolean }): void\n // Publishes a state writeback (`state: true` header). The operator honors\n // it only for privileged nodes; ordinary services' state messages are\n // ignored there.\n sendState(state: unknown): void\n abort(error: string | Error): void\n}\n\nexport interface ConnectionApi<V> {\n close(): Promise<void>\n open(): Promise<ConnectionApi<V>>\n act(\n messageKey: string,\n actor: (\n api: ActorApi<V>,\n ) =>\n | ApiOutputValue<V, null>\n | Promise<ApiOutputValue<V, null>>\n | void\n | Promise<void>\n | AsyncGenerator<ApiOutputValue<V, null>>\n | Generator<ApiOutputValue<V, null>>,\n ): Promise<void>\n}\n\nexport const messageKeySchema = z\n .string()\n .transform((str) => deobfuscate(str))\n .pipe(z.tuple([z.uuid(), z.uuid()]).rest(z.string()))\n .transform((arr) => ({\n taskId: arr[0],\n messageId: arr[1],\n uploadUrl: arr[2] || undefined,\n streamUrl: arr[3] || undefined,\n // Byte limits appended to the defer key alongside the transport URLs.\n // Old 4-part keys (pre-limits) parse with both absent → consumer defaults.\n maxPayloadSize:\n arr[4] && Number.isFinite(Number(arr[4])) ? Number(arr[4]) : undefined,\n maxFileSize:\n arr[5] && Number.isFinite(Number(arr[5])) ? Number(arr[5]) : undefined,\n }))\n\nconst headerSchema = z\n .object({\n properties: z.object({\n correlationId: z.uuid(),\n headers: z.object({\n taskId: z.uuid(),\n mode: z.enum(['LINEAR', 'CONTINUOUS']).default('LINEAR'),\n }),\n }),\n })\n .transform((msg) => ({\n messageId: msg.properties.correlationId,\n taskId: msg.properties.headers.taskId,\n mode: msg.properties.headers.mode,\n }))\n\nconst payloadSchema = z\n .object({ content: z.instanceof(Buffer) })\n .transform((msg) => JSON.parse(msg.content.toString()))\n .pipe(\n z.object({\n input: z.unknown(),\n configuration: z.unknown(),\n options: z.object({\n uploadUrl: z.url().optional(),\n streamUrl: z.url().optional(),\n maxPayloadSize: z.number().optional(),\n maxFileSize: z.number().optional(),\n }),\n }),\n )\n\nconst backchannelMessageSchema = z\n .object({\n content: z\n .instanceof(Buffer)\n .transform((content) => JSON.parse(content.toString()))\n .pipe(\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('stop'),\n }),\n z.object({\n type: z.literal('callback'),\n callbackId: z.uuid(),\n arg: z.any(),\n }),\n ]),\n ),\n properties: z.object({\n correlationId: z.string(),\n }),\n })\n .transform((message) => ({\n payload: message.content,\n messageId: message.properties.correlationId,\n }))\n\nconst abortSymbol = Symbol()\n\nexport const connectionOptionsSchema = z.object({\n url: z.union([\n z\n .string()\n .regex(/^amqps?:\\/\\/(.+):(.+)@(.+)$/)\n .transform((str) => new URL(str)),\n z\n .instanceof(URL)\n .refine((url) => url.protocol.match(/^amqps?:/), 'Wrong protocol'),\n ]),\n version: z.string(),\n devOverlay: z.string().optional(),\n silent: z.boolean().optional(),\n prefetch: z.number().int().optional(),\n connectionTimeout: z.number().positive().default(3_000),\n heartbeatInterval: z.number().int().positive().optional(),\n connectionOptions: z.any().optional(),\n // Hard cap on the serialized message body. A body above this is rejected with a\n // clear PayloadTooLargeError *before* it reaches the broker — the broker itself\n // only signals oversize by tearing down the connection, which amqplib surfaces\n // as an opaque \"channel closed\". Set to match the broker's max_message_size.\n maxMessageSize: z\n .number()\n .int()\n .positive()\n .default(128 * 1024 * 1024), // RabbitMQ's historical default max_message_size\n // Undocumented (privileged consumers): skip file/stream/callback rehydration\n // on ingress — claim-checks still resolve; byte references reach the handler\n // as raw `__REQUENCE_type` wire objects. See helpers.ts.\n passthroughByteReferences: z.boolean().optional(),\n})\n\nexport type PrivilegedConnectionOptions = z.output<\n typeof connectionOptionsSchema\n>\nexport type ConnectionOptions = Omit<\n PrivilegedConnectionOptions,\n 'passthroughByteReferences'\n>\n\ntype MessageHandlerContext<V> = V extends keyof RequenceService.Version\n ? ServiceContextHelper<V>\n : ContextHelper\ntype MessageHandlerReturnValue<\n V,\n O = null,\n> = V extends keyof RequenceService.Version\n ? O extends OutputName<V>\n ? OutputValue<V, O> | InternalNamedOutput\n : void\n : JSONValue\n\ntype MessageHandlerFunction<V> = (\n context: MessageHandlerContext<V>,\n) => MaybePromise<MessageHandlerReturnValue<V> | void>\n\ntype MessageHandlerGenerator<V> = (\n context: MessageHandlerContext<V>,\n) => Generator<\n MessageHandlerReturnValue<V>,\n MessageHandlerReturnValue<V> | void,\n void\n>\ntype MessageHandlerAsyncGenerator<V> = (\n context: MessageHandlerContext<V>,\n) => AsyncGenerator<\n MessageHandlerReturnValue<V>,\n MessageHandlerReturnValue<V> | void,\n void\n>\n\nexport type MessageHandler<V> = V extends keyof RequenceService.Version\n ? RequenceService.Version[V]['mode'] extends 'LINEAR'\n ? MessageHandlerFunction<V>\n :\n | MessageHandlerAsyncGenerator<V>\n | MessageHandlerGenerator<V>\n | MessageHandlerFunction<V>\n :\n | MessageHandlerAsyncGenerator<V>\n | MessageHandlerGenerator<V>\n | MessageHandlerFunction<V>\n\nfunction isMessageHandlerGenerator<V extends keyof RequenceService.Version>(\n // oxlint-disable-next-line typescript/no-unsafe-function-type\n handler: Function,\n): handler is MessageHandlerGenerator<V> | MessageHandlerAsyncGenerator<V> {\n return (\n handler.constructor.name === 'GeneratorFunction' ||\n handler.constructor.name === 'AsyncGeneratorFunction'\n )\n}\n\nconst activeMessages = new Map<string, Promise<void>>()\n\n// A delivery tag belongs to the exact channel that delivered the message. When\n// that channel closes (e.g. the connection dropped mid-processing), amqplib\n// turns ack/nack into a synchronous `IllegalOperationError: Channel closed`.\n// The broker has already requeued the delivery for redelivery, so there is\n// nothing left to acknowledge — and we must NOT route this through the\n// reconnecting channelWrapper, which would send the stale tag on the new\n// channel and trip a 406 PRECONDITION_FAILED that kills the fresh channel.\nfunction isChannelClosedError(error: unknown): boolean {\n return error instanceof Error && error.name === 'IllegalOperationError'\n}\n\nfunction safeAck(channel: ConfirmChannel, message: ConsumeMessage) {\n try {\n channel.ack(message)\n } catch (error) {\n if (!isChannelClosedError(error)) {\n throw error\n }\n }\n}\n\nfunction safeNack(channel: ConfirmChannel, message: ConsumeMessage) {\n try {\n channel.nack(message)\n } catch (error) {\n if (!isChannelClosedError(error)) {\n throw error\n }\n }\n}\n\nexport default function createConnection<V>(\n {\n url,\n version,\n prefetch = 1,\n silent = false,\n connectionTimeout,\n // Without a default this is `undefined` and amqp-connection-manager falls\n // back to 5s, which makes any event-loop stall >10s fatal to the connection.\n // Defaulted here rather than per service so every deployed service converges\n // on the same interval on its next release.\n heartbeatInterval = DEFAULT_AMQP_HEARTBEAT_SECONDS,\n connectionOptions,\n devOverlay = '',\n maxMessageSize,\n ...rest\n }: ConnectionOptions,\n messageHandler: MessageHandler<V>,\n) {\n const passthroughByteReferences =\n (rest as PrivilegedConnectionOptions).passthroughByteReferences ?? false\n const baseQueue = `${url.username}@${version}`\n const queue = devOverlay\n ? `${baseQueue}-dev-overlay-${devOverlay}`\n : baseQueue\n const exchange = url.username\n const connection = connect(url.toString(), {\n connectionOptions,\n heartbeatIntervalInSeconds: heartbeatInterval,\n })\n\n // amqp-connection-manager auto-reconnects, but without a listener a mid-\n // processing disconnect is completely silent: the raw amqplib channel that an\n // in-flight handler closed over is torn down, and the broker requeues every\n // unacked delivery. Surface it so the drop is at least observable.\n connection.on('disconnect', ({ err }: { err?: Error }) => {\n if (!silent && err) {\n console.error('Requence AMQP connection lost:', err.message)\n }\n })\n\n const connectedPromise = new Promise<void>((resolve, reject) => {\n const unsubscribe = () => {\n clearTimeout(timeout)\n connection.removeListener('connect', handleConnect)\n connection.removeListener('connectFailed', handleConnectFailed)\n }\n\n const timeout = setTimeout(() => {\n handleConnectFailed({\n err: new RequenceConnectionError('Requence connection timeout'),\n })\n }, connectionTimeout)\n\n const handleConnect = () => {\n unsubscribe()\n resolve()\n }\n\n const handleConnectFailed = ({ err }: { err: Error }) => {\n unsubscribe()\n if (\n err.message.startsWith(\n 'Handshake terminated by server: 403 (ACCESS-REFUSED)',\n )\n ) {\n reject(new RequenceConnectionError('Invalid service credentials'))\n } else {\n reject(err)\n }\n }\n\n connection.addListener('connect', handleConnect)\n connection.addListener('connectFailed', handleConnectFailed)\n })\n\n const connectionId = crypto.randomUUID()\n const backchannelQueue = `${baseQueue}-backchannel-${connectionId}`\n const generatorTerminators = new Map<string, (reason: string) => void>()\n // Each registry entry keeps the invocation dispatcher of the message that\n // registered the callback. Entries are deleted when that message settles,\n // so a stored dispatcher is live exactly as long as its callback is — this\n // is what lets a nested function in a callback argument reconstruct as\n // invokable (chaining): its invocations egress through the registering\n // message's context (results stream → operator → peer backchannel).\n const callbacks = new Map<\n string,\n {\n callback: (...args: any[]) => void\n onCallbackInvoke: CallbackIngressContext['onCallbackInvoke']\n }\n >()\n\n // Backchannel ingress (concept invariant 2): a callback argument was\n // egress-transformed by the invoking side (files/streams → references,\n // oversized values → claim-checks), so it must rehydrate here before\n // reaching user code. Connection-scoped: the callback owner is typically a\n // CONTINUOUS service whose lifetime differs from any single message, so no\n // per-message signal applies. `onCallbackInvoke` is supplied per call from\n // the registry entry, so nested functions reconstruct invokable.\n // Passthrough consumers (the logic runtime's guest channel) keep byte/callback\n // references raw here too — claim-checks still resolve, but files/streams/\n // callbacks reach the registered callback as their JSON-safe wire objects so\n // they can cross the guest's process boundary.\n const backchannelInbound = createInboundBoundary(\n passthroughByteReferences\n ? { transformer: passthroughInboundTransformer }\n : {},\n )\n\n const channelWrapper = connection.createChannel({\n async setup(channel: ConfirmChannel) {\n if (devOverlay) {\n await channel.assertQueue(queue)\n await channel.bindQueue(queue, 'service', queue)\n }\n await channel.checkExchange(exchange)\n await channel.checkExchange(`${exchange}-retry`)\n await channel.checkQueue(queue)\n await channel.prefetch(prefetch)\n\n await channel.assertQueue(backchannelQueue, {\n exclusive: true,\n })\n\n await channel.bindQueue(backchannelQueue, 'service', backchannelQueue)\n\n await channel.consume(\n backchannelQueue,\n async (message) => {\n const result = backchannelMessageSchema.safeParse(message)\n\n if (!result.success) {\n return\n }\n\n const backchannelMessage = result.data\n\n switch (backchannelMessage.payload.type) {\n case 'stop': {\n generatorTerminators.get(backchannelMessage.messageId)?.(\n 'task stopped',\n )\n break\n }\n case 'callback': {\n const entry = callbacks.get(backchannelMessage.payload.callbackId)\n if (!entry) {\n break\n }\n let arg: unknown\n try {\n arg = await backchannelInbound(backchannelMessage.payload.arg, {\n onCallbackInvoke: entry.onCallbackInvoke,\n })\n } catch (error) {\n // The backchannel consumes with noAck and outside any message\n // context, so a failed rehydration has no failure channel.\n // Never hand user code a raw reference — log and drop the\n // invocation instead.\n console.warn(\n `dropped callback invocation |${backchannelMessage.payload.callbackId}|: argument rehydration failed`,\n error instanceof Error ? error.message : error,\n )\n break\n }\n entry.callback(arg)\n break\n }\n }\n },\n {\n noAck: true,\n },\n )\n },\n })\n\n // ChannelWrapper is an EventEmitter; an unhandled 'error' would otherwise\n // propagate. Observe it rather than letting it surface as an uncaught error.\n channelWrapper.on('error', (err: Error) => {\n if (!silent) {\n console.error('Requence AMQP channel error:', err.message)\n }\n })\n\n const publish = ({\n data,\n outputName,\n messageId,\n priority,\n ...headers\n }: {\n index: number\n data?: unknown\n outputName?: string | null\n messageId: string\n taskId: string\n priority?: number\n version: string\n debugMethod?: 'log' | 'warn' | 'info' | 'error'\n debug?: boolean\n connectionId?: string\n callbackId?: string\n propertyPath?: (string | number)[]\n begin?: boolean\n deferred?: boolean\n done?: boolean\n // Privileged result protocol: `overwrite` marks a data message whose\n // value replaces (instead of merges into) downstream aggregation;\n // `state` marks a nodeStates writeback. The operator honors both only\n // for privileged nodes. Flow through via `...headers`.\n overwrite?: boolean\n state?: boolean\n // Per-attempt id: identifies this consume-handler invocation so the\n // operator can fence a superseded attempt's stragglers on the same\n // messageId. Flows through via `...headers`.\n epoch?: string\n }) => {\n const body = Buffer.from(JSON.stringify(data ?? null))\n\n // Guard the body size before it hits the broker. An oversized publish makes\n // RabbitMQ drop the whole connection, which amqplib reports as a generic\n // \"channel closed\" for every in-flight message — impossible to attribute to\n // size after the fact. Rejecting here yields a precise, catchable error and\n // leaves the connection intact for other messages.\n if (body.byteLength > maxMessageSize) {\n return Promise.reject(\n new PayloadTooLargeError(body.byteLength, maxMessageSize),\n )\n }\n\n return channelWrapper.publish(exchange, '', body, {\n correlationId: messageId,\n contentType: 'application/json',\n persistent: true,\n priority,\n headers: {\n outputName: outputName ?? null,\n connectionId,\n libVersion: libVersion(),\n ...headers,\n },\n })\n }\n\n // The privileged send API (unit 05 headers), shared by the main-path handler\n // context and act()'s ActorApi: imperative data/state publishes through the\n // caller's outbound boundary, enrolled in its ledger so `settle()` gates the\n // done marker on them — a final state emission mechanically flushes before\n // `done`. `epoch`/`priority` are main-path-only and omitted from the\n // published headers when absent, keeping act()'s output byte-identical.\n const buildSendApi = (deps: {\n outbound: OutboundBoundary\n registerCallback: (callback: (...args: any[]) => void) => {\n sourceId: string\n callbackId: string\n }\n taskId: string\n messageId: string\n nextIndex: () => number\n epoch?: string\n priority?: number\n // act() only: wait for the deferring message's own processing to finish.\n gate?: () => Promise<void>\n }) => {\n const base = {\n ...(deps.epoch === undefined ? {} : { epoch: deps.epoch }),\n ...(deps.priority === undefined ? {} : { priority: deps.priority }),\n }\n return {\n async sendToOutput(\n outputName: string,\n data: unknown,\n options?: { overwrite?: boolean },\n ) {\n await deps.gate?.()\n deps.outbound.track(\n publish({\n index: deps.nextIndex(),\n version,\n messageId: deps.messageId,\n taskId: deps.taskId,\n data: await deps.outbound.send(data, {\n outputName: outputName as string | null,\n onCallback: deps.registerCallback,\n }),\n outputName: outputName as string | null,\n // only set when requested — omitted publishes stay identical\n ...(options?.overwrite ? { overwrite: true } : {}),\n ...base,\n }),\n )\n },\n async send(data: unknown, options?: { overwrite?: boolean }) {\n await deps.gate?.()\n deps.outbound.track(\n publish({\n index: deps.nextIndex(),\n version,\n messageId: deps.messageId,\n taskId: deps.taskId,\n data: await deps.outbound.send(data, {\n outputName: null,\n onCallback: deps.registerCallback,\n }),\n ...(options?.overwrite ? { overwrite: true } : {}),\n ...base,\n }),\n )\n },\n async sendState(state: unknown) {\n await deps.gate?.()\n deps.outbound.track(\n publish({\n // out-of-band like callback publishes: state bypasses the\n // operator's ordered dispatch buffer, so it must not consume a\n // publishIndex slot — `done` would otherwise wait on a gap.\n index: 0,\n version,\n messageId: deps.messageId,\n taskId: deps.taskId,\n // through the outbound boundary: a large state blob offloads\n // via claim-check like any large body, and the tracked publish\n // is settled before `done` goes out.\n data: await deps.outbound.send(state, { outputName: null }),\n state: true,\n ...base,\n }),\n )\n },\n }\n }\n\n channelWrapper.addSetup(async (channel: ConfirmChannel) => {\n channel.consume(queue, async (message) => {\n if (!message) {\n return\n }\n\n let publishIndex = 0\n let acked = false\n let terminated = false\n const registeredCallbackIds = new Set<string>()\n let resolveActiveMessage = () => {}\n // Captured for the finally block; header parsing now happens inside the\n // try so a malformed header goes through the error handling below instead\n // of throwing out of this async consumer as an unhandled rejection.\n let messageIdForCleanup: string | undefined\n // One epoch per consume-handler invocation (declared out here so the\n // catch-branch republishes can stamp it too). On redelivery/reconnect a\n // second invocation gets a fresh epoch, letting the operator tell the\n // attempts apart and fence the superseded one.\n const epoch = crypto.randomUUID()\n\n try {\n const { messageId, taskId, mode } = headerSchema.parse(message)\n messageIdForCleanup = messageId\n\n let deferred = false\n let deferredReason: string | null = null\n\n const messageExecution = Promise.withResolvers<void>()\n activeMessages.set(messageId, messageExecution.promise)\n messageExecution.promise.then(() => {\n activeMessages.delete(messageId)\n })\n resolveActiveMessage = () => {\n messageExecution.resolve()\n }\n\n const payload = payloadSchema.parse(message)\n\n // The per-message abort controller is hoisted out of\n // createContextHelper so the outbound boundary can share its signal.\n const abortController = new AbortController()\n\n // One callback registrar for every egress sub-path (result, deferred\n // send, callback arg). Registered callbacks carry this message's\n // dispatcher so nested functions in their invocation arguments\n // reconstruct invokable (chaining).\n const registerCallback = (callback: (...args: any[]) => void) => {\n const callbackId = crypto.randomUUID()\n registeredCallbackIds.add(callbackId)\n callbacks.set(callbackId, {\n callback,\n onCallbackInvoke: dispatchInvocation,\n })\n return { sourceId: connectionId, callbackId }\n }\n\n // The component's single outbound boundary: owns ctx construction,\n // the background-upload ledger (done-gate) and the fail policy.\n // Fail-hard sends surface via outbound.settle() before the done\n // marker + ack; best-effort (log) sends degrade to warnings.\n const outbound = createOutboundBoundary({\n uploadUrl: payload.options.uploadUrl,\n streamUrl: payload.options.streamUrl,\n maxPayloadSize: payload.options.maxPayloadSize,\n maxFileSize: payload.options.maxFileSize,\n signal: abortController.signal,\n warn: (msg, error) =>\n console.warn(\n `${msg} (task ${taskId})`,\n error instanceof Error ? error.message : (error ?? ''),\n ),\n })\n\n // This message's single invocation egress: callback arguments are\n // real node output (they carry an outputName), so they go through the\n // same boundary as results — nested files offload, nested functions\n // become callbacks. The send + publish are tracked in the boundary's\n // ledger, so a failure fails the task at the settle gate. Used both\n // for callbacks arriving in this message's input (via\n // createContextHelper) and for callbacks this message registers\n // (chained invocations dispatched from the backchannel).\n const dispatchInvocation = (params: {\n sourceId: string\n callbackId: string\n outputName: string | null\n propertyPath: (string | number)[]\n arg: unknown\n }) => {\n outbound.track(\n outbound\n .send(params.arg, {\n outputName: params.outputName,\n onCallback: registerCallback,\n })\n .then((data) =>\n publish({\n index: 0,\n version,\n taskId,\n messageId,\n data,\n outputName: params.outputName,\n connectionId: params.sourceId,\n callbackId: params.callbackId,\n propertyPath: params.propertyPath,\n epoch,\n }),\n ),\n )\n }\n\n const [extendedContext, terminatePromise] = (await createContextHelper({\n taskId,\n // Rehydration (FileObject/StreamObject -> RequenceFile/RequenceStream)\n // happens inside createContextHelper via its inbound boundary — the\n // signal-aware pass whose instances reach the handler.\n input: payload.input,\n configuration: payload.configuration,\n abortController,\n passthroughByteReferences,\n // Privileged send API on the handler ctx (runtime-only, hidden from\n // the ContextHelper type): shares this message's outbound boundary,\n // publishIndex counter, epoch and priority.\n sends: {\n ...buildSendApi({\n outbound,\n registerCallback,\n taskId,\n messageId,\n nextIndex: () => publishIndex++,\n epoch,\n priority: message.properties.priority,\n }),\n // Passthrough consumers hold raw callback wire refs — this is\n // their invocation egress, routed through the same\n // dispatchInvocation as a rehydrated callback call (fire-and-\n // forget; the outbound ledger settles the publish).\n invokeCallback: (ref, arg) =>\n dispatchInvocation({\n sourceId: ref.sourceId,\n callbackId: ref.callbackId,\n outputName: ref.outputName,\n propertyPath: ref.propertyPath,\n arg,\n }),\n options: payload.options,\n },\n onLog(debugMethod, data) {\n // Best-effort: a debug log must never fail the task. The boundary\n // sanitizes the payload (functions/opaque instances → labels),\n // degrades offload failures to warnings, and keeps the done-gate\n // waiting for the upload without letting it fail the task. On a\n // transform error it resolves `undefined` and nothing is published.\n void outbound.send(data, { bestEffort: true }).then((mapped) => {\n if (mapped === undefined) {\n return\n }\n publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: mapped,\n debugMethod,\n priority: message.properties.priority,\n debug: true,\n epoch,\n })\n })\n },\n onDefer(reason) {\n deferred = true\n deferredReason = reason || null\n\n return obfuscate(\n taskId,\n messageId,\n payload.options.uploadUrl ?? '',\n payload.options.streamUrl ?? '',\n payload.options.maxPayloadSize?.toString() ?? '',\n payload.options.maxFileSize?.toString() ?? '',\n )\n },\n onCallback: dispatchInvocation,\n })) as unknown as [\n MessageHandlerContext<V>,\n PromiseWithResolvers<string>,\n ]\n\n await publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n priority: message.properties.priority,\n begin: true,\n epoch,\n })\n\n if (isMessageHandlerGenerator(messageHandler)) {\n if (mode === 'CONTINUOUS') {\n // CONTINUOUS: ACK immediately, operator watchdog supervises. A\n // LINEAR message stays unacked until done — prefetch keeps\n // bounding concurrent work and the broker redelivers on a crash.\n safeAck(channel, message)\n acked = true\n }\n\n const generator = messageHandler(extendedContext)\n const terminationPromise = Promise.withResolvers<typeof abortSymbol>()\n generatorTerminators.set(messageId, (reason) => {\n terminated = true\n // Suppress native AbortError that may reject generator.return() when\n // context.terminated.signal fires and cancels a pending await inside\n // the generator (e.g. node:timers/promises setTimeout with { signal }).\n ;(generator.return() as Promise<unknown>).catch(\n (error: unknown) => {\n if (\n terminated &&\n error instanceof Error &&\n error.name === 'AbortError' &&\n !(error instanceof AbortError)\n ) {\n return\n }\n throw error\n },\n )\n terminationPromise.resolve(abortSymbol)\n terminatePromise.resolve(reason)\n })\n\n await handlerStorage.run(\n extendedContext as ContextHelper,\n async () => {\n while (true) {\n type IterResult = IteratorResult<\n MessageHandlerReturnValue<V, null>,\n void | MessageHandlerReturnValue<V, null>\n >\n // Catch native AbortError from context.terminated.signal so\n // generator implementations don't need their own try/catch.\n const nextPromise = Promise.resolve(generator.next()).then(\n (r) => r,\n (error: unknown) => {\n if (\n terminated &&\n error instanceof Error &&\n error.name === 'AbortError' &&\n !(error instanceof AbortError)\n ) {\n return { value: undefined, done: true } as IterResult\n }\n throw error\n },\n )\n const next = await Promise.race([\n terminationPromise.promise,\n nextPromise,\n ])\n if (next === abortSymbol) {\n break\n }\n\n const { value: result, done } = next\n\n if (deferred) {\n deferred = false\n console.warn(\n 'returning a value in a deferred message resets the deferred status',\n )\n }\n\n const { value: rawValue, outputName } =\n unwrapOutputValue(result)\n const value = await outbound.send(rawValue, {\n outputName,\n onCallback: registerCallback,\n })\n\n if (!done || typeof value !== 'undefined') {\n await publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: value,\n priority: message.properties.priority,\n outputName,\n epoch,\n })\n }\n\n if (done) {\n break\n }\n }\n },\n )\n } else {\n const result = await handlerStorage.run(\n extendedContext as ContextHelper,\n () => messageHandler(extendedContext),\n )\n const { value: rawValue, outputName } = unwrapOutputValue(result)\n const value = await outbound.send(rawValue, {\n outputName,\n onCallback: () => {\n throw new Error(\n 'callbacks can only be used in generator functions',\n )\n },\n })\n if (deferred && value) {\n console.warn(\n 'returning a value in a deferred message resets the deferred status',\n )\n deferred = false\n }\n\n if (!deferred || value) {\n await publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: value,\n priority: message.properties.priority,\n outputName,\n epoch,\n })\n }\n }\n\n await new Promise<void>((resolve, reject) => {\n setImmediate(async () => {\n try {\n // The boundary's settle gate: waits for every tracked background\n // upload/publish, then throws an AggregateError on any fail-hard\n // failure — which surfaces here and reaches the outer catch ->\n // exception republish -> throwServiceError -> failNode. The done\n // marker + ack only happen once every upload succeeded.\n if (!deferred) {\n await outbound.settle()\n }\n\n await publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n data: deferredReason,\n priority: message.properties.priority,\n deferred,\n done: !deferred,\n epoch,\n })\n\n if (!acked) {\n safeAck(channel, message)\n }\n resolve()\n } catch (error) {\n reject(error)\n }\n })\n })\n } catch (error) {\n if (error instanceof SkipError) {\n if (!acked) {\n safeNack(channel, message)\n }\n return\n }\n if (error instanceof RetryError) {\n if (!acked) {\n safeAck(channel, message)\n }\n const properties: Options.Publish = {\n ...message.properties,\n expiration: error.delay || 1_000, // 1s\n }\n channelWrapper\n .publish(\n `${exchange}-retry`,\n version, // to other services\n message.content,\n properties,\n )\n .catch((publishError: unknown) => {\n if (!silent) {\n console.error(\n 'Failed to republish message for retry:',\n publishError,\n )\n }\n })\n\n return\n }\n\n if (error instanceof AbortError && error.message.length > 0) {\n if (!acked) {\n safeAck(channel, message)\n }\n channelWrapper\n .publish(\n `${exchange}-retry`,\n 'operator', //back to operator\n error.message,\n {\n ...message.properties,\n contentType: 'text/plain',\n headers: {\n ...message.properties.headers,\n index: publishIndex++,\n libVersion: libVersion(),\n abort: true,\n },\n },\n )\n .catch((publishError: unknown) => {\n if (!silent) {\n console.error('Failed to publish abort message:', publishError)\n }\n })\n\n return\n }\n\n // Native AbortError thrown when context.terminated.signal fires\n // (e.g. node:timers/promises setTimeout with { signal: context.terminated.signal }).\n // Only suppress when actually in a terminated state — otherwise a\n // different AbortSignal caused the error and it should propagate.\n if (\n terminated &&\n error instanceof Error &&\n error.name === 'AbortError' &&\n !(error instanceof AbortError)\n ) {\n if (!acked) {\n safeAck(channel, message)\n }\n return\n }\n\n if (error instanceof Error) {\n if (!silent) {\n console.error('Encountered an error inside service handler:')\n console.error(error)\n }\n\n if (!acked) {\n safeAck(channel, message)\n }\n channelWrapper\n .publish(\n `${exchange}-retry`,\n 'operator', // back to operator\n message.content,\n {\n ...message.properties,\n headers: {\n ...message.properties.headers,\n version,\n exception: true,\n index: publishIndex++,\n libVersion: libVersion(),\n 'error-message': error.message || 'error in service handler',\n },\n },\n )\n .catch((publishError: unknown) => {\n if (!silent) {\n console.error(\n 'Failed to publish exception message:',\n publishError,\n )\n }\n })\n\n return\n }\n } finally {\n if (messageIdForCleanup) {\n generatorTerminators.delete(messageIdForCleanup)\n }\n registeredCallbackIds.forEach((id) => callbacks.delete(id))\n resolveActiveMessage()\n }\n })\n })\n\n const activeMessageKeys = new Set<string>()\n const api: ConnectionApi<V> = {\n close: async () => {\n await channelWrapper.close()\n await connection.close()\n },\n open: () => connectedPromise.then(() => api),\n\n async act(messageKey, actor) {\n if (activeMessageKeys.has(messageKey)) {\n throw new Error('a defer key can only be used once')\n }\n\n activeMessageKeys.add(messageKey)\n\n let publishIndex = 0\n const { taskId, messageId, ...options } =\n messageKeySchema.parse(messageKey)\n\n const activeMessage = async () => {\n if (activeMessages.has(messageId)) {\n await activeMessages.get(messageId)\n }\n }\n\n const registeredCallbackIds = new Set<string>()\n // The deferred path's own outbound boundary: its ledger replaces the\n // old donePromises/uploadErrors pair — errors are caught at\n // registration time (nothing sits unhandled during long generator\n // iteration) and surfaced by settle() after the loop.\n const outbound = createOutboundBoundary(options)\n const registerCallback = (callback: (...args: any[]) => void) => {\n const callbackId = crypto.randomUUID()\n registeredCallbackIds.add(callbackId)\n callbacks.set(callbackId, {\n callback,\n onCallbackInvoke: dispatchInvocation,\n })\n return { sourceId: connectionId, callbackId }\n }\n\n // Deferred-path analogue of the main path's dispatchInvocation: chained\n // invocations of callbacks registered here egress through this deferred\n // message's context (no epoch, matching its other publishes).\n const dispatchInvocation = (params: {\n sourceId: string\n callbackId: string\n outputName: string | null\n propertyPath: (string | number)[]\n arg: unknown\n }) => {\n outbound.track(\n outbound\n .send(params.arg, {\n outputName: params.outputName,\n onCallback: registerCallback,\n })\n .then((data) =>\n publish({\n index: 0,\n version,\n taskId,\n messageId,\n data,\n outputName: params.outputName,\n connectionId: params.sourceId,\n callbackId: params.callbackId,\n propertyPath: params.propertyPath,\n }),\n ),\n )\n }\n\n const sendApi = {\n // The shared privileged send API, composed with act()'s own index\n // counter and its active-message gate; no epoch/priority — the\n // deferred path's publishes never carried them.\n ...buildSendApi({\n outbound,\n registerCallback,\n taskId,\n messageId,\n nextIndex: () => publishIndex++,\n gate: activeMessage,\n }),\n async abort(error: string | Error) {\n await activeMessage()\n channelWrapper.publish(\n `${exchange}-retry`,\n 'operator',\n error instanceof Error ? error.message : error,\n {\n persistent: true,\n correlationId: messageId,\n expiration: 0,\n priority: 0,\n contentType: 'text/plain',\n headers: {\n taskId,\n libVersion: libVersion(),\n index: publishIndex++,\n abort: true,\n },\n },\n )\n },\n }\n\n const result = await actor(sendApi as ActorApi<V>)\n\n if (\n result != null &&\n typeof result === 'object' &&\n (Symbol.asyncIterator in result || Symbol.iterator in result)\n ) {\n // Generator: iterate and send each yielded value\n const iterable = result as AsyncIterable<unknown> | Iterable<unknown>\n for await (const value of iterable) {\n if (value !== undefined) {\n await sendApi.send(value)\n }\n }\n } else if (result !== undefined) {\n await sendApi.send(result)\n }\n\n await new Promise((resolve) => setImmediate(resolve))\n await activeMessage()\n\n try {\n // Settle gate: waits while sends enqueue more sends, then throws an\n // AggregateError on any failed background upload or publish.\n await outbound.settle()\n } catch (error) {\n // Do not mark the message done with a dangling reference. Signal\n // failure over the deferred-path error channel (abort -> operator\n // fails the node) and throw so act()'s caller sees it too.\n registeredCallbackIds.forEach((id) => callbacks.delete(id))\n const first =\n error instanceof AggregateError && error.errors[0] instanceof Error\n ? error.errors[0]\n : error instanceof Error\n ? error\n : new Error(String(error))\n await sendApi.abort(first)\n activeMessageKeys.delete(messageKey)\n throw error\n }\n\n registeredCallbackIds.forEach((id) => callbacks.delete(id))\n\n await publish({\n index: publishIndex++,\n version,\n messageId,\n taskId,\n done: true,\n })\n\n activeMessageKeys.delete(messageKey)\n },\n }\n\n return api\n}\n",
|
|
14
|
+
"/**\n * Thrown by a `RequenceStream` remote read when the producer terminated\n * abnormally (or vanished) mid-stream — the explicit alternative to the\n * clean-looking EOF a truncated live relay used to produce. Surfaced through\n * the framed consumer-GET protocol (see `streamFraming.ts`): a TRUNCATED\n * terminal frame, or an EOF with no terminal frame at all.\n */\nexport class RequenceStreamTruncatedError extends Error {\n constructor(message = 'stream truncated') {\n super(message)\n this.name = 'RequenceStreamTruncatedError'\n }\n}\n",
|
|
15
|
+
"import { RequenceStreamTruncatedError } from './errors.ts'\n\n/**\n * Opt-in framed protocol for the consumer stream GET, closing the\n * silent-truncation gap: the server *decides* complete-vs-truncated (Redis\n * EOS/ERR markers) but a plain HTTP body cannot state it — a mid-stream\n * producer abort and a clean end both look like EOF. A client that sends\n * `x-requence-stream-protocol: framed` receives length-prefixed frames ending\n * in an explicit terminal frame; the server echoes the header only when it\n * actually frames. Clients that don't send the header (Python SDK, older TS)\n * get today's raw bytes — compatible in both directions.\n *\n * Frame layout: `type u8 | length u32 BE | payload[length]`.\n */\nexport const STREAM_PROTOCOL_HEADER = 'x-requence-stream-protocol'\nexport const STREAM_PROTOCOL_FRAMED = 'framed'\n\nconst DATA = 0x00\n/** Terminal: the stream is complete. Nothing may follow. */\nconst END = 0x01\n/** Terminal: the producer aborted / vanished. Payload = UTF-8 reason. */\nconst TRUNCATED = 0x02\n\nconst HEADER_BYTES = 5\n\n/** 5-byte DATA frame header; write it, then the chunk itself (no copy). */\nexport function dataFrameHeader(byteLength: number): Uint8Array {\n const header = new Uint8Array(HEADER_BYTES)\n new DataView(header.buffer).setUint32(1, byteLength, false)\n header[0] = DATA\n return header\n}\n\nexport const END_FRAME: Uint8Array = new Uint8Array([END, 0, 0, 0, 0])\n\nexport function truncatedFrame(reason: string): Uint8Array {\n const payload = new TextEncoder().encode(reason)\n const frame = new Uint8Array(HEADER_BYTES + payload.byteLength)\n new DataView(frame.buffer).setUint32(1, payload.byteLength, false)\n frame[0] = TRUNCATED\n frame.set(payload, HEADER_BYTES)\n return frame\n}\n\n/**\n * Decode a framed body back into raw chunks. DATA payloads are re-emitted;\n * END terminates cleanly; TRUNCATED — and an EOF without any terminal frame\n * (transport drop, proxy cut) — error the stream with a typed\n * `RequenceStreamTruncatedError`. Frames may be split across chunk boundaries.\n */\nexport function createFrameDecoder(): TransformStream<Uint8Array, Uint8Array> {\n let buffer: Uint8Array = new Uint8Array(0)\n let terminal = false\n\n return new TransformStream<Uint8Array, Uint8Array>({\n transform(chunk, controller) {\n if (terminal) {\n if (chunk.byteLength > 0) {\n throw new Error('stream protocol error: bytes after terminal frame')\n }\n return\n }\n\n if (buffer.byteLength === 0) {\n buffer = chunk\n } else {\n const merged = new Uint8Array(buffer.byteLength + chunk.byteLength)\n merged.set(buffer, 0)\n merged.set(chunk, buffer.byteLength)\n buffer = merged\n }\n\n while (buffer.byteLength >= HEADER_BYTES) {\n const type = buffer[0]\n const length = new DataView(\n buffer.buffer,\n buffer.byteOffset,\n buffer.byteLength,\n ).getUint32(1, false)\n if (buffer.byteLength < HEADER_BYTES + length) {\n break\n }\n // slice (copy): the emitted chunk must not pin the merge buffer\n const payload = buffer.slice(HEADER_BYTES, HEADER_BYTES + length)\n buffer = buffer.subarray(HEADER_BYTES + length)\n\n switch (type) {\n case DATA: {\n if (payload.byteLength > 0) {\n controller.enqueue(payload)\n }\n break\n }\n case END: {\n terminal = true\n if (buffer.byteLength > 0) {\n throw new Error(\n 'stream protocol error: bytes after terminal frame',\n )\n }\n controller.terminate()\n return\n }\n case TRUNCATED: {\n terminal = true\n controller.error(\n new RequenceStreamTruncatedError(\n new TextDecoder().decode(payload) || undefined,\n ),\n )\n return\n }\n default: {\n throw new Error(`stream protocol error: unknown frame type ${type}`)\n }\n }\n }\n },\n flush(controller) {\n if (!terminal) {\n controller.error(\n new RequenceStreamTruncatedError(\n 'connection closed before terminal frame',\n ),\n )\n }\n },\n })\n}\n",
|
|
16
|
+
"import {\n STREAM_PROTOCOL_FRAMED,\n STREAM_PROTOCOL_HEADER,\n createFrameDecoder,\n} from './streamFraming.ts'\n\ninterface RemoteBodyOptions {\n /**\n * External (task) signal. When it aborts, the in-flight fetch is aborted so a\n * service-task teardown can cancel a hung read.\n */\n signal?: AbortSignal\n /**\n * Inactivity timeout (ms). Opt-in: only enforced when > 0. A read that\n * produces no data within the window aborts the underlying fetch so the\n * consumer errors out instead of blocking forever. Disabled by default so\n * legitimately slow/long transfers are never cut.\n */\n stallTimeoutMs?: number\n /**\n * Request the framed stream protocol (see `streamFraming.ts`): the body then\n * carries an explicit `complete|truncated` terminal signal, and a truncated\n * stream rejects with a typed `RequenceStreamTruncatedError` instead of\n * closing like a clean EOF. Falls back to the raw body when the server does\n * not echo the protocol header (older files service).\n */\n framed?: boolean\n}\n\n/**\n * Shared guarded remote read for the files service. Fetches `url` and exposes\n * the response body as a `ReadableStream` that routes EVERY failure through\n * `controller.error(...)` instead of hanging or piping an error page through as\n * content:\n *\n * - fetch rejection, a non-2xx status (body drained via `response.body?.cancel()`),\n * and a null body all error the returned stream;\n * - a mid-stream read failure surfaces as a thrown read, never a silent close;\n * - cancelling the returned stream, the external signal aborting, or the opt-in\n * stall timeout all abort the in-flight fetch (no connection leak).\n *\n * Used by both `RequenceStream` (streaming reads) and `RequenceFile` (buffered\n * reads + `stream()`).\n */\nexport function remoteBody(\n url: string,\n options: RemoteBodyOptions = {},\n): ReadableStream<Uint8Array> {\n const externalSignal = options.signal\n const timeoutMs =\n options.stallTimeoutMs && options.stallTimeoutMs > 0\n ? options.stallTimeoutMs\n : 0\n\n // Self-contained controller: cancelling the returned stream (or the external\n // task signal, or a stall timeout) aborts the in-flight fetch.\n const controller = new AbortController()\n\n let reader: ReadableStreamDefaultReader<Uint8Array> | null = null\n let timer: ReturnType<typeof setTimeout> | undefined\n let onExternalAbort: (() => void) | undefined\n\n const clearTimer = () => {\n if (timer !== undefined) {\n clearTimeout(timer)\n timer = undefined\n }\n }\n\n const cleanup = () => {\n clearTimer()\n if (externalSignal && onExternalAbort) {\n externalSignal.removeEventListener('abort', onExternalAbort)\n }\n }\n\n // Chain the task signal so a service-task teardown aborts the read.\n if (externalSignal) {\n if (externalSignal.aborted) {\n controller.abort(externalSignal.reason)\n } else {\n onExternalAbort = () => controller.abort(externalSignal.reason)\n externalSignal.addEventListener('abort', onExternalAbort, {\n once: true,\n })\n }\n }\n\n const armTimer = () => {\n if (timeoutMs <= 0) {\n return\n }\n clearTimer()\n timer = setTimeout(() => {\n controller.abort(\n new Error(`remote read stalled: no data for ${timeoutMs}ms`),\n )\n }, timeoutMs)\n }\n\n return new ReadableStream<Uint8Array>({\n async start(streamController) {\n let response: Response\n try {\n response = await fetch(url, {\n signal: controller.signal,\n headers: options.framed\n ? { [STREAM_PROTOCOL_HEADER]: STREAM_PROTOCOL_FRAMED }\n : undefined,\n })\n } catch (error) {\n cleanup()\n streamController.error(error)\n return\n }\n\n if (!response.ok) {\n // Drain the error body so the connection is released, then surface the\n // failure instead of piping the error page through as content.\n await response.body?.cancel()\n cleanup()\n streamController.error(\n new Error(\n `remote read failed: ${response.status} ${response.statusText}`,\n ),\n )\n return\n }\n\n if (!response.body) {\n cleanup()\n streamController.error(new Error('remote read response has no body'))\n return\n }\n\n // The server echoes the protocol header only when it actually frames;\n // without the echo (older server) the raw body is read as before.\n const framed =\n options.framed &&\n response.headers.get(STREAM_PROTOCOL_HEADER) === STREAM_PROTOCOL_FRAMED\n reader = framed\n ? response.body.pipeThrough(createFrameDecoder()).getReader()\n : response.body.getReader()\n },\n async pull(streamController) {\n if (!reader) {\n return\n }\n armTimer()\n try {\n const { done, value } = await reader.read()\n clearTimer()\n if (done) {\n cleanup()\n streamController.close()\n return\n }\n streamController.enqueue(value)\n } catch (error) {\n // A mid-stream connection drop, or an abort (task teardown / stall\n // timeout), surfaces as a thrown read — never a silent close.\n clearTimer()\n cleanup()\n streamController.error(error)\n }\n },\n async cancel(reason) {\n cleanup()\n controller.abort(reason)\n await reader?.cancel(reason)\n },\n })\n}\n",
|
|
17
|
+
"import type { FileObject } from '@requence/helpers'\n\nimport { remoteBody } from './remoteBody.ts'\nimport type { MainMimeType, SubMimeType, ValidMimeType } from './types.ts'\n\ninterface RequenceFilePropertyBag<T> extends Omit<BlobPropertyBag, 'type'> {\n type: T\n}\n\nexport interface RequenceFileType<A, B> {\n size: number\n mimeType: string\n mainMimeType: A\n subMimeType: B\n text(): Promise<string>\n json(): Promise<unknown>\n blob(): Promise<Blob>\n arrayBuffer(): Promise<ArrayBuffer>\n stream(): ReadableStream\n}\n\n/**\n * Inactivity timeout (ms) for a remote file read. Opt-in: only enforced when\n * `REQUENCE_FILE_STALL_TIMEOUT_MS` is set to a positive number. When enabled, a\n * read that produces no data within the window aborts the underlying fetch so\n * the consumer errors out instead of blocking forever. Disabled by default so\n * legitimately slow/large downloads are never cut.\n */\nfunction stallTimeoutMs(): number {\n const raw =\n typeof process !== 'undefined'\n ? Number(process.env?.REQUENCE_FILE_STALL_TIMEOUT_MS)\n : Number.NaN\n return Number.isFinite(raw) && raw > 0 ? raw : 0\n}\n\nexport class RequenceFile<\n T extends `${string}/${string}` = '*/*',\n A = MainMimeType<T>,\n B = SubMimeType<T>,\n> implements RequenceFileType<A, B> {\n #data: Blob\n #file: FileObject | null = null\n #signal?: AbortSignal\n constructor(\n blobParts: BlobPart[],\n options?: RequenceFilePropertyBag<ValidMimeType<T>>,\n ) {\n this.#data = new Blob(blobParts, options)\n }\n\n /** @internal */\n static fromFileObject<T extends `${string}/${string}`>(\n file: FileObject,\n signal?: AbortSignal,\n ) {\n const instance = new this([], { type: 'x/x' })\n instance.#file = file\n instance.#signal = signal\n return instance as RequenceFile<T>\n }\n\n /**\n * Egress detection for the file value handler. Covers a `RequenceFile` *and a\n * raw `Blob`* — a Blob adapts through RequenceFile, so no separate Blob\n * branch exists anywhere outside this class.\n */\n static canHandle(value: unknown): value is RequenceFile | Blob {\n return value instanceof RequenceFile || value instanceof Blob\n }\n\n /** @internal */\n get fileObject() {\n return this.#file\n }\n\n get size() {\n return this.#file?.size ?? this.#data.size\n }\n\n get mimeType() {\n return this.#file?.mime ?? this.#data.type\n }\n\n get mainMimeType() {\n return this.mimeType.split('/')[0] as A\n }\n\n get subMimeType() {\n return this.mimeType.split('/')[1] as B\n }\n\n /**\n * Byte stream of the file. For a remote file this is the guarded remote read\n * (status-checked, abortable, opt-in stall timeout) and — unlike the buffered\n * read methods — never holds the whole file in memory, so it is the path to\n * use for large files. For a local file it is the backing Blob's stream.\n */\n stream(): ReadableStream {\n if (!this.#file) {\n return this.#data.stream()\n }\n return remoteBody(this.#file.url, {\n signal: this.#signal,\n stallTimeoutMs: stallTimeoutMs(),\n })\n }\n\n /**\n * Drain the (guarded) remote stream into a single buffer. Transient only —\n * the bytes are freed once the caller is done; nothing is memoized, so a\n * multi-GB file is never retained across reads. Large files that must avoid\n * buffering entirely should use `stream()` instead.\n */\n async #bytes(): Promise<Uint8Array<ArrayBuffer>> {\n const reader = (this.stream() as ReadableStream<Uint8Array>).getReader()\n const chunks: Uint8Array[] = []\n let total = 0\n for (;;) {\n const { done, value } = await reader.read()\n if (done) {\n break\n }\n chunks.push(value)\n total += value.byteLength\n }\n const out = new Uint8Array(total)\n let offset = 0\n for (const chunk of chunks) {\n out.set(chunk, offset)\n offset += chunk.byteLength\n }\n return out\n }\n\n async text() {\n if (this.#file) {\n return new TextDecoder().decode(await this.#bytes())\n }\n return this.#data.text()\n }\n\n async json() {\n if (this.#file) {\n const text = await this.text()\n try {\n return JSON.parse(text)\n } catch (error) {\n throw new Error(\n `RequenceFile JSON parse failed for ${this.#file.url}`,\n { cause: error },\n )\n }\n }\n return JSON.parse(await this.text())\n }\n\n async blob() {\n if (this.#file) {\n return new Blob([await this.#bytes()], { type: this.#file.mime })\n }\n return this.#data\n }\n\n async arrayBuffer() {\n if (this.#file) {\n return (await this.#bytes()).buffer as ArrayBuffer\n }\n return this.#data.arrayBuffer()\n }\n\n toString() {\n return `RequenceFile<${this.mimeType}>`\n }\n}\n",
|
|
18
|
+
"import type { StreamObject } from '@requence/helpers'\n\nimport { remoteBody } from './remoteBody.ts'\nimport type { MainMimeType, SubMimeType, ValidMimeType } from './types.ts'\n\nexport interface RequenceStreamType<A, B> {\n mimeType: string\n mainMimeType: A\n subMimeType: B\n stream(): ReadableStream\n}\n\ninterface RequenceStreamOptions<T> {\n type: T\n signal?: AbortSignal\n}\n\n/**\n * Inactivity timeout (ms) for a remote stream read. Opt-in: only enforced when\n * `REQUENCE_STREAM_STALL_TIMEOUT_MS` is set to a positive number. When enabled,\n * a read that produces no data within the window aborts the underlying fetch so\n * the consumer errors out instead of blocking forever. Disabled by default so\n * legitimately slow/long streams are never cut.\n */\nfunction stallTimeoutMs(): number {\n const raw =\n typeof process !== 'undefined'\n ? Number(process.env?.REQUENCE_STREAM_STALL_TIMEOUT_MS)\n : Number.NaN\n return Number.isFinite(raw) && raw > 0 ? raw : 0\n}\n\nexport class RequenceStream<\n T extends `${string}/${string}` = '*/*',\n A = MainMimeType<T>,\n B = SubMimeType<T>,\n> implements RequenceStreamType<A, B> {\n #data: ReadableStream\n #stream: StreamObject | null = null\n #options: RequenceStreamOptions<any>\n\n constructor(\n stream: ReadableStream,\n options: RequenceStreamOptions<ValidMimeType<T>>,\n ) {\n this.#data = stream\n this.#options = options\n }\n\n /** @internal */\n static fromStreamObject<T extends `${string}/${string}`>(\n stream: StreamObject,\n signal?: AbortSignal,\n ) {\n const instance = new this(null as unknown as ReadableStream, {\n type: 'x/x',\n signal,\n })\n instance.#stream = stream\n return instance as unknown as RequenceStream<T>\n }\n\n /**\n * Egress detection for the stream value handler. Covers a `RequenceStream`\n * *and a raw `Response`* — a Response body adapts through RequenceStream, so\n * no separate Response branch exists anywhere outside this class.\n */\n static canHandle(value: unknown): value is RequenceStream | Response {\n return value instanceof RequenceStream || value instanceof Response\n }\n\n /** @internal */\n get streamObject() {\n return this.#stream\n }\n\n get mimeType() {\n return this.#stream?.mime ?? this.#options.type\n }\n\n get mainMimeType() {\n return this.mimeType.split('/')[0] as A\n }\n\n get subMimeType() {\n return this.mimeType.split('/')[1] as B\n }\n\n stream(): ReadableStream {\n if (!this.#stream) {\n return this.#data\n }\n\n return remoteBody(this.#stream.url, {\n signal: this.#options.signal,\n stallTimeoutMs: stallTimeoutMs(),\n // Framed protocol: a truncated live stream surfaces as a typed\n // RequenceStreamTruncatedError, never as a clean-looking EOF.\n framed: true,\n })\n }\n\n asyncIterable(): AsyncIterable<Uint8Array> {\n const reader = this.stream().getReader()\n\n return {\n [Symbol.asyncIterator]() {\n return {\n async next() {\n return reader.read() as Promise<IteratorResult<Uint8Array>>\n },\n async return() {\n reader.cancel()\n reader.releaseLock()\n return { done: true, value: null }\n },\n async throw() {\n reader.cancel()\n reader.releaseLock()\n return { done: true, value: null }\n },\n }\n },\n }\n }\n\n toString() {\n return `RequenceStream<${this.mimeType}>`\n }\n}\n",
|
|
19
|
+
"/**\n * Surface a non-2xx files-service response as a clear error instead of parsing\n * an error page as if it were a valid reference. Drains the body so the\n * connection is released.\n */\nexport async function assertOk(res: Response, url: string, phase: string) {\n if (res.ok) {\n return\n }\n const detail = await res.text().catch(() => '')\n throw new Error(\n `${phase} failed: ${res.status} ${res.statusText} (${url})${\n detail ? ` — ${detail}` : ''\n }`,\n )\n}\n",
|
|
20
|
+
"import type { FileObject } from '@requence/helpers'\nimport { isFileObject, toFileObject } from '@requence/helpers'\nimport type { TransformContext, ValueHandler } from '@requence/transformer'\n\nimport type { FileEgressContext } from './context.ts'\nimport { assertOk } from './transport.ts'\nimport { RequenceFile } from '../RequenceFile.ts'\n\nasync function upload(\n ctx: TransformContext,\n uploadUrl: string,\n body: BodyInit | null,\n contentType?: string | null,\n maxFileSize?: number,\n): Promise<FileObject> {\n const uploadResponse = await ctx.fetch(uploadUrl, {\n method: 'POST',\n signal: ctx.signal,\n headers: {\n ...(contentType ? { 'Content-Type': contentType } : {}),\n // Per-task cap transmitted via task options; the files service\n // enforces it (absent ⇒ its hardcoded fallback cap).\n ...(maxFileSize !== undefined\n ? { 'file-size': String(maxFileSize) }\n : {}),\n },\n body,\n })\n\n await assertOk(uploadResponse, uploadUrl, 'upload')\n\n const data = await uploadResponse.json()\n // Explicit field checks rather than `isFileObject`: the FileObject schema\n // requires a positive size, but a legitimate 0-byte file is valid here.\n if (\n !data ||\n typeof data !== 'object' ||\n typeof (data as { url?: unknown }).url !== 'string' ||\n !(data as { url: string }).url ||\n typeof (data as { mime?: unknown }).mime !== 'string' ||\n typeof (data as { size?: unknown }).size !== 'number'\n ) {\n throw new Error(`malformed upload response (${uploadUrl})`)\n }\n\n return toFileObject(data as { size: number; mime: string; url: string })\n}\n\n/**\n * Value handler owning `RequenceFile` — and, through it, raw `Blob`s (a Blob\n * adapts through RequenceFile; no separate Blob branch exists anywhere else).\n *\n * Egress uploads the bytes via the injected transport and returns the\n * `FileObject` reference (idempotent for an already-remote file). Ingress\n * reconstructs the lazy remote instance.\n */\nexport function createRequenceFileHandler(): ValueHandler<\n RequenceFile | Blob,\n FileObject | null,\n FileEgressContext\n> {\n return {\n tag: 'RequenceFile',\n\n canHandle: (value) => RequenceFile.canHandle(value),\n\n async serialize(value, ctx) {\n // Idempotent: an already-remote file keeps its existing reference.\n if (value instanceof RequenceFile && value.fileObject) {\n return value.fileObject\n }\n\n if (!ctx.uploadUrl) {\n ctx.onOffloadSkip?.()\n return null\n }\n\n try {\n if (value instanceof RequenceFile) {\n return await upload(\n ctx,\n ctx.uploadUrl,\n await value.blob(),\n value.mimeType,\n ctx.maxFileSize,\n )\n }\n return await upload(\n ctx,\n ctx.uploadUrl,\n value,\n value.type,\n ctx.maxFileSize,\n )\n } catch (error) {\n if (!(error instanceof Error)) {\n throw error\n }\n // Fail-hard by default: only swallow (to null) when a caller opts in\n // with `onOffloadFail`. Otherwise propagate so the node/task fails loudly.\n if (ctx.onOffloadFail) {\n ctx.onOffloadFail(error)\n return null\n }\n throw error\n }\n },\n\n isReference: (value): value is FileObject => isFileObject(value),\n\n deserialize(ref, ctx) {\n return RequenceFile.fromFileObject(ref as FileObject, ctx.signal)\n },\n }\n}\n",
|
|
21
|
+
"import { AsyncLocalStorage } from 'node:async_hooks'\n\n/**\n * Ambient collection scope for background stream-body uploads.\n *\n * A `RequenceStream` serializes in two beats: the reference (`StreamObject`) is\n * known right after registration, but the body keeps uploading in the\n * background — that is what lets a consumer join the stream *while* the\n * producer is still pushing. The caller, however, must not treat the transform\n * as durably complete (ack the task, mark it done) until every background body\n * upload has settled.\n *\n * `withRequenceStreams` is that collection point: the stream handler registers\n * its background upload into the ambient store, and the caller receives a\n * single `done` promise to feed its completion gate.\n */\nconst pendingUploads = new AsyncLocalStorage<Array<Promise<void>>>()\n\n/**\n * Run `fn` (typically a `transformOutbound` call) collecting every background\n * stream-body upload started within it. Returns the function's result together\n * with a `done` promise that resolves when all collected uploads settle and\n * rejects on the first failure. `value` is available immediately — publish it\n * while the bodies still stream; await `done` before acking.\n */\nexport async function withRequenceStreams<T>(\n fn: () => Promise<T> | T,\n): Promise<{ value: T; done: Promise<void> }> {\n const uploads: Array<Promise<void>> = []\n const value = await pendingUploads.run(uploads, fn)\n return { value, done: Promise.all(uploads).then(() => undefined) }\n}\n\n/**\n * Hand a background upload to the ambient scope. Returns false when no scope\n * is active — the caller (the stream handler) must then await the work inline:\n * still correct, just not live. Never fire-and-forget.\n *\n * @internal\n */\nexport function registerPendingUpload(work: Promise<void>): boolean {\n const store = pendingUploads.getStore()\n if (!store) {\n return false\n }\n store.push(work)\n return true\n}\n",
|
|
22
|
+
"import type { StreamObject } from '@requence/helpers'\nimport { isStreamObject, toStreamObject } from '@requence/helpers'\nimport type { TransformContext, ValueHandler } from '@requence/transformer'\n\nimport type { StreamEgressContext } from './context.ts'\nimport { assertOk } from './transport.ts'\nimport { RequenceStream } from '../RequenceStream.ts'\nimport { registerPendingUpload } from '../withRequenceStreams.ts'\n\nasync function registerAndUpload(\n ctx: TransformContext,\n streamUrl: string,\n stream: ReadableStream,\n contentType?: string | null,\n maxFileSize?: number,\n): Promise<{ ref: StreamObject; bodyUpload?: Promise<void> }> {\n const [testStream, dataStream] = stream.tee()\n\n // Read the first chunk before firing the body upload: nodejs closes an empty\n // duplex `half` body before the fetch executes, so we must know whether any\n // data exists. `dataStream` keeps the buffered chunk (tee), so no bytes are\n // lost. (Obsolete once we move to bun.)\n const reader = testStream.getReader()\n const { done: isEmpty } = await reader.read()\n reader.cancel()\n\n const streamResponse = await ctx.fetch(streamUrl, {\n method: 'POST',\n signal: ctx.signal,\n headers: {\n ...(contentType ? { 'Content-Type': contentType } : {}),\n // Per-task cap transmitted via task options; the files service stores\n // it with the stream and enforces it during the body upload (absent ⇒\n // its hardcoded fallback cap).\n ...(maxFileSize !== undefined\n ? { 'file-size': String(maxFileSize) }\n : {}),\n },\n })\n\n await assertOk(streamResponse, streamUrl, 'stream registration')\n\n const data = await streamResponse.json()\n if (!isStreamObject(toStreamObject(data as { mime: string; url: string }))) {\n throw new Error(`malformed stream registration response (${streamUrl})`)\n }\n\n const { mime, url } = data as { mime: string; url: string }\n\n if (isEmpty) {\n // Legitimate zero-byte stream: POST a static empty body. The duplex\n // \"wait for first byte\" workaround only applies to a streaming body.\n const emptyResponse = await ctx.fetch(url, {\n method: 'POST',\n signal: ctx.signal,\n headers: contentType ? { 'Content-Type': contentType } : {},\n body: new Uint8Array(0),\n })\n await assertOk(emptyResponse, url, 'stream body upload')\n await emptyResponse.body?.cancel()\n return { ref: toStreamObject({ mime, url }) }\n }\n\n // Not awaited here: the body streams in the background so the reference can\n // be published while data still flows. Completion/failure surfaces through\n // the returned promise, collected by `withRequenceStreams`.\n const bodyUpload = (async () => {\n const bodyResponse = await ctx.fetch(url, {\n method: 'POST',\n signal: ctx.signal,\n duplex: 'half', // not typed but needed for nodejs to handle readable streams\n body: dataStream,\n } as RequestInit)\n await assertOk(bodyResponse, url, 'stream body upload')\n await bodyResponse.body?.cancel()\n })()\n\n return { ref: toStreamObject({ mime, url }), bodyUpload }\n}\n\n/**\n * Value handler owning `RequenceStream` — and, through it, raw `Response`s (a\n * Response body adapts through RequenceStream; no separate Response branch\n * exists anywhere else).\n *\n * Egress registers the stream, returns the `StreamObject` reference\n * immediately, and pushes the body in the background (collected by the ambient\n * `withRequenceStreams` scope; without a scope the upload is awaited inline —\n * still correct, just not live). Ingress reconstructs a lazy stream that reads\n * live-or-durable.\n */\nexport function createRequenceStreamHandler(): ValueHandler<\n RequenceStream | Response,\n StreamObject | null,\n StreamEgressContext\n> {\n return {\n tag: 'RequenceStream',\n\n canHandle: (value) => RequenceStream.canHandle(value),\n\n async serialize(value, ctx) {\n // Idempotent: an already-remote stream keeps its existing reference.\n if (value instanceof RequenceStream && value.streamObject) {\n return value.streamObject\n }\n\n if (!ctx.streamUrl) {\n ctx.onOffloadSkip?.()\n return null\n }\n\n const body =\n value instanceof Response\n ? // A body-less Response is a legitimate empty stream.\n (value.body ??\n new ReadableStream({\n start(controller) {\n controller.close()\n },\n }))\n : value.stream()\n const contentType =\n value instanceof Response\n ? value.headers.get('Content-Type')\n : value.mimeType\n\n try {\n const { ref, bodyUpload } = await registerAndUpload(\n ctx,\n ctx.streamUrl,\n body,\n contentType,\n ctx.maxFileSize,\n )\n if (bodyUpload && !registerPendingUpload(bodyUpload)) {\n // No ambient scope collecting background work: await inline. Correct,\n // just not live — never fire-and-forget.\n await bodyUpload\n }\n return ref\n } catch (error) {\n if (!(error instanceof Error)) {\n throw error\n }\n // Fail-hard by default: only swallow (to null) when a caller opts in\n // with `onOffloadFail`. Otherwise propagate so the node/task fails loudly.\n if (ctx.onOffloadFail) {\n ctx.onOffloadFail(error)\n return null\n }\n throw error\n }\n },\n\n isReference: (value): value is StreamObject => isStreamObject(value),\n\n deserialize(ref, ctx) {\n return RequenceStream.fromStreamObject(ref as StreamObject, ctx.signal)\n },\n }\n}\n",
|
|
23
|
+
"import { Buffer } from 'node:buffer'\n\nimport type { ClaimCheckObject } from '@requence/helpers'\nimport { isClaimCheckObject, toClaimCheckObject } from '@requence/helpers'\nimport type {\n HandlerBundle,\n MessageHandler,\n TransformContext,\n ValueHandler,\n} from '@requence/transformer'\n\nimport type { ClaimCheckEgressContext } from './context.ts'\nimport { assertOk } from './transport.ts'\n\n/**\n * Oversized-message claim-check — one `withHandler` bundle carrying both\n * contract halves:\n *\n * - **Egress** is the bundle's `messageHandler`: it size-checks the already\n * value-serialized body and offloads oversized top-level values to the\n * files service, preserving a record body's top-level keys (the transformer\n * asserts this). A non-record body is offloaded wholesale.\n * - **Ingress** is the bundle's `valueHandler`: a reference can resurface at\n * any depth of a later message once a forwarding hop merged it into other\n * data — only the value walk finds it there.\n *\n * Offload failure always **throws** — deliberately ignoring the\n * `onOffloadFail` swallow-to-null contract, which means \"null *reference*\n * for one value\": a silently nulled body part would corrupt the message, and\n * an oversized body that cannot be offloaded fails at the broker anyway.\n * Without an `uploadUrl` on the ctx the handler skips (status quo: the broker\n * rejects the message exactly as it does today).\n */\n\n/**\n * Fallback offload threshold in bytes when the ctx carries no\n * `maxPayloadSize` (safe headroom under RabbitMQ's 16 MiB default\n * `max_message_size`). The per-task value is minted by the ui backend and\n * arrives via task options, like the upload URL.\n */\nconst DEFAULT_MAX_PAYLOAD_SIZE = 4 * 1024 * 1024\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nasync function offload(\n ctx: TransformContext,\n uploadUrl: string,\n json: string,\n): Promise<ClaimCheckObject> {\n const response = await ctx.fetch(uploadUrl, {\n method: 'POST',\n signal: ctx.signal,\n headers: { 'Content-Type': 'application/json' },\n body: json,\n })\n await assertOk(response, uploadUrl, 'claim-check offload')\n\n const data = (await response.json()) as { url?: unknown; size?: unknown }\n if (\n !data ||\n typeof data !== 'object' ||\n typeof data.url !== 'string' ||\n !data.url ||\n typeof data.size !== 'number'\n ) {\n throw new Error(`malformed claim-check offload response (${uploadUrl})`)\n }\n return toClaimCheckObject({ url: data.url, size: data.size })\n}\n\nfunction createMessageHandler(): MessageHandler<ClaimCheckEgressContext> {\n return {\n async wrapOutbound(body, ctx) {\n const maxBytes = ctx.maxPayloadSize ?? DEFAULT_MAX_PAYLOAD_SIZE\n if (maxBytes <= 0 || body === undefined) {\n return body\n }\n const json = JSON.stringify(body)\n if (json === undefined || Buffer.byteLength(json) <= maxBytes) {\n return body\n }\n const { uploadUrl } = ctx\n if (!uploadUrl) {\n ctx.onOffloadSkip?.()\n return body\n }\n\n if (!isRecord(body)) {\n return offload(ctx, uploadUrl, json)\n }\n\n // Record body: offload oversized top-level values largest-first until\n // the body fits, keys preserved. If every value is offloaded and the\n // body still exceeds the threshold there is nothing more a\n // key-preserving wrap can do — return it and let the broker decide.\n const entries = Object.entries(body)\n .map(([key, value]) => {\n const valueJson = JSON.stringify(value)\n return {\n key,\n valueJson,\n size: valueJson === undefined ? 0 : Buffer.byteLength(valueJson),\n }\n })\n .sort((a, b) => b.size - a.size)\n\n const wrapped: Record<string, unknown> = { ...body }\n let total = Buffer.byteLength(json)\n for (const entry of entries) {\n // A reference is ~100–150 bytes; offloading a value that small can\n // only grow the body. Entries are sorted largest-first, so stop.\n if (\n total <= maxBytes ||\n entry.valueJson === undefined ||\n entry.size <= 256\n ) {\n break\n }\n const ref = await offload(ctx, uploadUrl, entry.valueJson)\n wrapped[entry.key] = ref\n total += Buffer.byteLength(JSON.stringify(ref)) - entry.size\n }\n return wrapped\n },\n }\n}\n\n/**\n * Ingress half: fetch the offloaded value back and hand it to the walk. The\n * result is re-walked to a fixpoint, so references nested *inside* the\n * offloaded value (files, streams, callbacks) rehydrate as usual.\n * Reconstruction needs only `ctx.fetch`, so transport-less consumers (task\n * watchers, ui) can always unwrap.\n */\nfunction createValueHandler(): ValueHandler<unknown, ClaimCheckObject> {\n return {\n tag: 'ClaimCheck',\n\n canHandle: () => false, // egress happens at message level, never per value\n\n serialize() {\n throw new Error(\n 'ClaimCheck egress is the bundled MessageHandler (wrapOutbound); it never reaches the value walk',\n )\n },\n\n isReference: (value): value is ClaimCheckObject =>\n isClaimCheckObject(value),\n\n async deserialize(ref, ctx) {\n const response = await ctx.fetch(ref.url, { signal: ctx.signal })\n await assertOk(response, ref.url, 'claim-check fetch')\n const text = await response.text()\n try {\n return JSON.parse(text)\n } catch {\n throw new Error(`malformed claim-check payload (${ref.url})`)\n }\n },\n }\n}\n\n/** The claim-check as one composable bundle: message-wrap egress + value-walk ingress. */\nexport function createClaimCheckHandler(): HandlerBundle<\n object,\n object,\n ClaimCheckEgressContext\n> & {\n valueHandler: ValueHandler<unknown, ClaimCheckObject>\n messageHandler: MessageHandler<ClaimCheckEgressContext>\n} {\n return {\n valueHandler: createValueHandler(),\n messageHandler: createMessageHandler(),\n }\n}\n",
|
|
24
|
+
"import { mapData } from '@requence/helpers'\n\nimport { RequenceFile } from './RequenceFile.ts'\nimport { RequenceStream } from './RequenceStream.ts'\n\n/**\n * Best-effort pre-pass for log/console payloads: a log must never fail the\n * task/node or mint a live callback registration, so everything the\n * transformer would loudly reject is rendered to a readable label instead.\n * Requence types pass through untouched (the handlers offload them), plain\n * data and toJSON-serializable instances pass through (JSON parity),\n * everything else becomes a string.\n */\nexport function sanitizeLogData(data: unknown) {\n return mapData(data, {\n Function: () => '[Function]',\n Symbol: (sym) => String(sym),\n Object(obj) {\n if (RequenceFile.canHandle(obj) || RequenceStream.canHandle(obj)) {\n return undefined\n }\n const proto = Object.getPrototypeOf(obj)\n if (proto === null || proto === Object.prototype) {\n return undefined\n }\n if (typeof (obj as { toJSON?: unknown }).toJSON === 'function') {\n return undefined\n }\n return String(obj)\n },\n })\n}\n",
|
|
25
|
+
"import type { CallbackObject } from '@requence/helpers'\nimport { isCallbackObject } from '@requence/helpers'\nimport type { ValueHandler } from '@requence/transformer'\n\nimport type {\n CallbackEgressContext,\n CallbackIngressContext,\n} from './context.ts'\n\ntype ReconstructedCallback = (arg: unknown) => void\n\n/**\n * Bidirectional handler owning the `RequenceCallback` reference tag.\n *\n * Egress serializes any function into a full callback reference: identity\n * (`callbackId`/`sourceId`) comes from `ctx.onCallback`, the emission from\n * `ctx.outputName`, and the position from the walk's `path` — the reference's\n * public identity (the operator validates invocation args against the output\n * schema at `propertyPath`). A boundary that cannot register callbacks (no\n * `ctx.onCallback`) fails loud.\n *\n * Ingress reconstructs the reference into a callable function that dispatches\n * through `ctx.onCallbackInvoke` — with no `onCallbackInvoke` provided,\n * invoking the callback is a no-op; callers that forbid callbacks pass a\n * throwing implementation.\n */\nexport function createRequenceCallbackHandler(): ValueHandler<\n ReconstructedCallback,\n CallbackObject,\n CallbackEgressContext,\n CallbackIngressContext\n> {\n return {\n tag: 'RequenceCallback',\n\n canHandle: (value) => typeof value === 'function',\n\n serialize(callback, ctx, path) {\n if (!ctx.onCallback) {\n // handler throws are not path-wrapped by the transformer — carry the\n // position in the message ourselves\n throw new Error(\n `functions are not serializable on this boundary (no ctx.onCallback) at path \"${path.join('.')}\"`,\n )\n }\n return {\n ...ctx.onCallback(callback),\n outputName: ctx.outputName ?? null,\n propertyPath: [...path],\n __REQUENCE_type: 'RequenceCallback',\n }\n },\n\n isReference: (value): value is CallbackObject => isCallbackObject(value),\n\n deserialize(ref, ctx) {\n return (arg: unknown) => {\n ctx.onCallbackInvoke?.({ ...(ref as CallbackObject), arg })\n }\n },\n }\n}\n",
|
|
26
|
+
"/** A position in the message tree, as visited by the walk. */\nexport type TransformPath = ReadonlyArray<string | number>\n\n/** Render a path as a readable dotted/indexed accessor, e.g. `data.items[2].file`. */\nexport function formatPath(path: TransformPath): string {\n if (path.length === 0) {\n return '<root>'\n }\n let out = ''\n for (const segment of path) {\n out +=\n typeof segment === 'number'\n ? `[${segment}]`\n : out\n ? `.${segment}`\n : segment\n }\n return out\n}\n\n/**\n * Thrown when the transformer cannot fully resolve a message: a complex value\n * on egress that no registered `ValueHandler` claims, or a reference tag on\n * ingress that no handler owns. The message names the offending type/tag and\n * its path so the failure is diagnosable rather than a silent pass-through.\n */\nexport class TransformError extends Error {\n readonly path: TransformPath\n readonly detail: string\n\n constructor(detail: string, path: TransformPath) {\n super(`${detail} at ${formatPath(path)}`)\n this.name = 'TransformError'\n this.path = path\n this.detail = detail\n }\n}\n",
|
|
27
|
+
"/** The reference marker key. A handler's `tag` is mirrored here on the wire. */\nexport const REFERENCE_TAG_KEY = '__REQUENCE_type'\n\n/**\n * A plain data object: an object literal or a null-prototype object — never a\n * class instance (`Blob`, `RequenceFile`, …), whose prototype chain differs.\n * This is what lets the walk tell traversable structure apart from an opaque\n * complex value a handler must own.\n */\nexport function isPlainObject(\n value: unknown,\n): value is Record<string, unknown> {\n if (value === null || typeof value !== 'object') {\n return false\n }\n const proto = Object.getPrototypeOf(value)\n return proto === null || proto === Object.prototype\n}\n\n/**\n * A value that is neither a JSON primitive nor traversable structure — a class\n * instance, function, symbol, or bigint. On egress every such value must be\n * claimed by a handler; anything left over is unresolvable.\n */\nexport function isComplexValue(value: unknown): boolean {\n if (value === null) {\n return false\n }\n const type = typeof value\n if (type === 'object') {\n return !Array.isArray(value) && !isPlainObject(value)\n }\n return type === 'function' || type === 'symbol' || type === 'bigint'\n}\n\n/** Does a plain object carry the reference marker key? */\nexport function hasReferenceTag(value: unknown): boolean {\n return isPlainObject(value) && REFERENCE_TAG_KEY in value\n}\n",
|
|
28
|
+
"import type { TransformPath } from './errors.ts'\nimport { TransformError } from './errors.ts'\nimport { isPlainObject } from './guards.ts'\n\n/**\n * A visitor's verdict for one (already child-recursed) node:\n * - `recurse` — keep the node as-is (its children are already transformed).\n * - `replace` — the node was transformed; the walk re-processes the replacement\n * so a handler output that still embeds complex values / references resolves\n * to a fixpoint.\n */\nexport type WalkVerdict =\n | { readonly kind: 'recurse' }\n | { readonly kind: 'replace'; readonly value: unknown }\n\nexport const recurse: WalkVerdict = { kind: 'recurse' }\nexport const replaceWith = (value: unknown): WalkVerdict => ({\n kind: 'replace',\n value,\n})\n\nexport type WalkVisitor = (\n value: unknown,\n path: TransformPath,\n) => WalkVerdict | Promise<WalkVerdict>\n\n/**\n * Guard against a handler that returns a value it also claims: without a cap\n * the fixpoint re-walk would spin forever. Chosen well above any legitimate\n * nesting depth so it only ever fires on a genuine non-terminating handler.\n */\nconst MAX_REPLACE_DEPTH = 100\n\n/**\n * Generic async tree-walk — successor to `packages/helpers/src/utils/mapData`.\n *\n * Post-order: a node's array/record children are transformed first, then the\n * node itself is offered to `visit`. This makes both directions symmetric — a\n * serialize output is re-walked so nested complex values are offloaded, and a\n * reference's nested references are reconstructed *before* its handler\n * deserializes it. Concrete policy (what is handled, what throws) lives in the\n * visitor, keeping this purely structural.\n *\n * Identity dedupe (the same instance offloaded once) is owned by the visitor's\n * own memo; because the visitor's synchronous prefix runs before the walk\n * awaits, concurrent siblings sharing an instance can't race the memo.\n */\nexport async function walk(\n root: unknown,\n visit: WalkVisitor,\n): Promise<unknown> {\n const go = async (\n value: unknown,\n path: TransformPath,\n replaceDepth: number,\n ): Promise<unknown> => {\n let node = value\n\n if (Array.isArray(node)) {\n node = await Promise.all(\n node.map((item, index) => go(item, [...path, index], 0)),\n )\n } else if (isPlainObject(node)) {\n const entries = await Promise.all(\n Object.entries(node).map(\n async ([key, item]) =>\n [key, await go(item, [...path, key], 0)] as const,\n ),\n )\n node = Object.fromEntries(entries)\n }\n\n const verdict = await visit(node, path)\n\n if (verdict.kind === 'replace') {\n if (replaceDepth >= MAX_REPLACE_DEPTH) {\n throw new TransformError(\n 'transform did not reach a fixpoint (a handler keeps producing handleable output)',\n path,\n )\n }\n return go(verdict.value, path, replaceDepth + 1)\n }\n\n return node\n }\n\n return go(root, [], 0)\n}\n",
|
|
29
|
+
"import type { TransformContext } from './context.ts'\nimport { TransformError } from './errors.ts'\nimport { hasReferenceTag, isComplexValue, isPlainObject } from './guards.ts'\nimport type { MessageHandler } from './messageHandler.ts'\nimport type { ValueHandler } from './valueHandler.ts'\nimport type { WalkVisitor } from './walk.ts'\nimport { recurse, replaceWith, walk } from './walk.ts'\n\n/**\n * A value handler paired with an optional message handler that produces the\n * same reference tag — e.g. the claim-check, whose egress is a message-level\n * wrap and whose ingress is an ordinary value handler. Composing the pair in\n * one `withHandler` call keeps the two halves together.\n */\nexport interface HandlerBundle<\n ValueEgress extends object = object,\n ValueIngress extends object = object,\n MessageEgress extends object = object,\n> {\n valueHandler?: ValueHandler<any, any, ValueEgress, ValueIngress>\n messageHandler?: MessageHandler<MessageEgress>\n}\n\n/**\n * An immutable, composed transformer instance. There is no global registry:\n * each runtime builds its own instance from exactly the handlers it needs, and\n * the ctx types of `outbound`/`inbound` accumulate the composed handlers'\n * declared capabilities — the compiler tells a runtime which transport it must\n * supply.\n *\n * `withHandler` returns a NEW transformer; instances are never mutated, so a\n * base composition can be safely extended per call site.\n */\nexport interface Transformer<\n OutCtx extends object = object,\n InCtx extends object = object,\n> {\n /** Compose a value handler. */\n withHandler<VOut extends object, VIn extends object>(\n handler: ValueHandler<any, any, VOut, VIn>,\n ): Transformer<OutCtx & VOut, InCtx & VIn>\n /** Compose a bundle: a value handler and/or a paired message handler. */\n withHandler<\n VOut extends object = object,\n VIn extends object = object,\n MOut extends object = object,\n >(\n handler: HandlerBundle<VOut, VIn, MOut>,\n ): Transformer<OutCtx & VOut & MOut, InCtx & VIn>\n\n /**\n * Egress: complex → serializable. Value-walk (first matching `ValueHandler`\n * serializes each complex value; its output is re-walked to a fixpoint),\n * then message-wrap (every `MessageHandler.wrapOutbound`, in composition\n * order; a record body must keep its top-level keys — asserted after each\n * handler). A complex value no handler owns throws a path-annotated\n * `TransformError`.\n */\n outbound(value: unknown, ctx: TransformContext & OutCtx): Promise<unknown>\n\n /**\n * Ingress: serializable → complex. Value-walk only — there is no\n * message-level inbound hook (message-handler references are ordinary\n * references, owned by a `ValueHandler`, so they are reconstructed wherever\n * they appear). Each reference is routed by `isReference` to its handler's\n * `deserialize`; output is re-walked to a fixpoint. A reference tag no\n * handler owns throws a path-annotated `TransformError`.\n */\n inbound(value: unknown, ctx: TransformContext & InCtx): Promise<unknown>\n}\n\n/** Create an empty transformer to compose handlers onto. */\nexport function createTransformer(): Transformer {\n return build([], [])\n}\n\nfunction build(\n valueHandlers: readonly ValueHandler<any, any, any, any>[],\n messageHandlers: readonly MessageHandler<any>[],\n): Transformer<any, any> {\n const transformer: Transformer<any, any> = {\n withHandler(\n handler: ValueHandler<any, any, any, any> | HandlerBundle<any, any, any>,\n ) {\n const bundle: HandlerBundle<any, any, any> =\n 'tag' in handler ? { valueHandler: handler } : handler\n if (!bundle.valueHandler && !bundle.messageHandler) {\n throw new Error(\n 'withHandler: bundle provides neither a valueHandler nor a messageHandler',\n )\n }\n if (bundle.valueHandler) {\n // Two handlers sharing a tag is a wiring bug — the tag is the\n // on-the-wire discriminator, so a duplicate makes ingress routing\n // ambiguous. Caught here, at composition, rather than at transform time.\n const { tag } = bundle.valueHandler\n if (valueHandlers.some((existing) => existing.tag === tag)) {\n throw new Error(\n `withHandler: a ValueHandler with tag \"${tag}\" is already composed`,\n )\n }\n }\n return build(\n bundle.valueHandler\n ? [...valueHandlers, bundle.valueHandler]\n : valueHandlers,\n bundle.messageHandler\n ? [...messageHandlers, bundle.messageHandler]\n : messageHandlers,\n )\n },\n\n async outbound(value: unknown, ctx: TransformContext): Promise<unknown> {\n // Dedupe by instance identity: the same instance at multiple paths is\n // serialized once and every position gets the same reference. The memo\n // is set synchronously (before the first `await`) so concurrent siblings\n // can't race.\n const seen = new Map<object, Promise<unknown>>()\n\n const visit: WalkVisitor = (node, path) => {\n if (!isComplexValue(node)) {\n return recurse\n }\n\n const handler = valueHandlers.find((candidate) =>\n candidate.canHandle(node),\n )\n if (!handler) {\n // JSON.stringify parity: a value that declares its own JSON form via\n // `toJSON` (Date, Buffer, …) is not unresolvable — replace it with\n // that form and re-walk. Handlers match first, so a composed type\n // never falls through to its own toJSON here. Values with neither an\n // owner nor a toJSON stay a loud error: they would otherwise\n // silently collapse.\n const withToJSON = node as { toJSON?: () => unknown }\n if (\n typeof node === 'object' &&\n typeof withToJSON.toJSON === 'function'\n ) {\n return replaceWith(withToJSON.toJSON())\n }\n const label =\n node?.constructor?.name ??\n (typeof node === 'function' ? 'function' : typeof node)\n throw new TransformError(\n `no composed ValueHandler for complex value of type ${label}`,\n path,\n )\n }\n\n if (typeof node === 'object' && node !== null) {\n // The memo only ever caches object-identity values, whose references\n // are path-independent (file/stream) — the cached branch replays the\n // first-seen path. Non-object complex values (functions) bypass it,\n // so a path-bearing handler sees the correct path per occurrence. A\n // future path-bearing *object* handler must not rely on the memo.\n const cached = seen.get(node)\n if (cached) {\n return cached.then(replaceWith)\n }\n const pending = Promise.resolve(handler.serialize(node, ctx, path))\n seen.set(node, pending)\n return pending.then(replaceWith)\n }\n\n return Promise.resolve(handler.serialize(node, ctx, path)).then(\n replaceWith,\n )\n }\n\n const valueTransformed = await walk(value, visit)\n\n let body = valueTransformed\n for (const [index, handler] of messageHandlers.entries()) {\n const wrapped = await handler.wrapOutbound(body, ctx)\n assertTopLevelKeysPreserved(body, wrapped, index)\n body = wrapped\n }\n return body\n },\n\n async inbound(value: unknown, ctx: TransformContext): Promise<unknown> {\n const visit: WalkVisitor = (node, path) => {\n if (!isPlainObject(node)) {\n return recurse\n }\n\n const handler = valueHandlers.find((candidate) =>\n candidate.isReference(node),\n )\n if (handler) {\n // Passthrough handlers own the tag but keep the reference verbatim\n // (kept as-is, not re-walked — identity replacement would never\n // reach the fixpoint).\n if (handler.passthrough) {\n return recurse\n }\n return Promise.resolve(handler.deserialize(node, ctx, path)).then(\n replaceWith,\n )\n }\n\n if (hasReferenceTag(node)) {\n const tag = (node as Record<string, unknown>).__REQUENCE_type\n throw new TransformError(\n `no composed ValueHandler owns reference tag ${JSON.stringify(tag)}`,\n path,\n )\n }\n\n return recurse\n }\n\n return walk(value, visit)\n },\n }\n\n return transformer\n}\n\n/**\n * The `MessageHandler` shape constraint: a record body keeps its top-level\n * keys (values under them may become references, the record itself never\n * does), so forwarding hops that shallow-merge record bodies always see real\n * keys. A non-record body may be replaced wholesale.\n */\nfunction assertTopLevelKeysPreserved(\n body: unknown,\n wrapped: unknown,\n handlerIndex: number,\n): void {\n if (!isPlainObject(body)) {\n return\n }\n const label = `MessageHandler #${handlerIndex}`\n if (!isPlainObject(wrapped)) {\n throw new TransformError(\n `${label} replaced a record body wholesale — wrapOutbound must preserve a record's top-level keys`,\n [],\n )\n }\n const before = Object.keys(body)\n const after = new Set(Object.keys(wrapped))\n const removed = before.filter((key) => !after.has(key))\n const added = [...after].filter((key) => !before.includes(key))\n if (removed.length > 0 || added.length > 0) {\n throw new TransformError(\n `${label} changed a record body's top-level keys (removed: [${removed.join(\n ', ',\n )}], added: [${added.join(', ')}]) — wrapOutbound must preserve them`,\n [],\n )\n }\n}\n",
|
|
30
|
+
"import { createRequenceCallbackHandler } from '@requence/callbacks'\nimport {\n createClaimCheckHandler,\n createRequenceFileHandler,\n createRequenceStreamHandler,\n} from '@requence/files'\nimport { type ValueHandler, createTransformer } from '@requence/transformer'\n\n/**\n * The service runtime's composed transformer: byte references (file, stream,\n * claim-check) plus callbacks. The instance's `outbound`/`inbound` ctx types\n * accumulate the composed handlers' declared capabilities — the boundary\n * (`boundary.ts`) is the only place that builds those ctx objects.\n */\nexport const transformer = createTransformer()\n .withHandler(createRequenceFileHandler())\n .withHandler(createRequenceStreamHandler())\n .withHandler(createRequenceCallbackHandler())\n .withHandler(createClaimCheckHandler())\n\n// Owns a reference tag on ingress but keeps the reference verbatim (the\n// transformer would otherwise fail loud on the unowned tag). Inbound-only.\nconst passthroughHandler = (handler: {\n tag: string\n isReference(value: unknown): boolean\n}): ValueHandler => ({\n tag: handler.tag,\n passthrough: true,\n canHandle: () => false,\n serialize() {\n throw new Error(`passthrough handler \"${handler.tag}\" is inbound-only`)\n },\n isReference: (value): value is unknown => handler.isReference(value),\n deserialize(ref) {\n // unreachable — `passthrough: true` keeps the reference verbatim\n return ref\n },\n})\n\n/**\n * Inbound chain for passthrough consumers (the logic runtime): claim-checks\n * still resolve — a state seed may arrive as a ClaimCheck reference — but\n * file/stream/callback references stay raw `__REQUENCE_type` wire objects,\n * JSON-safe for forwarding across a process boundary the full instances could\n * not cross. A tag owned by none of these still fails loud.\n */\nexport const passthroughInboundTransformer = createTransformer()\n .withHandler(passthroughHandler(createRequenceFileHandler()))\n .withHandler(passthroughHandler(createRequenceStreamHandler()))\n .withHandler(passthroughHandler(createRequenceCallbackHandler()))\n .withHandler(createClaimCheckHandler())\n",
|
|
31
|
+
"import type {\n CallbackEgressContext,\n CallbackIngressContext,\n} from '@requence/callbacks'\nimport { sanitizeLogData, withRequenceStreams } from '@requence/files'\n\nimport { transformer } from './transformer.ts'\n\n/**\n * The service runtime's two serialization chokepoints (issue 07): one\n * outbound boundary and one inbound boundary, both delegating to the\n * runtime's composed transformer instance (`transformer.ts`). Every sub-path\n * (main result, deferred send, log, callback arg) routes through them. The\n * boundary owns ctx construction, the background-upload done-gate, and the\n * fail policy — this is *service policy*, which is why it lives here and not\n * in a shared package; call sites only say *what* to send and on which\n * emission.\n */\n\ntype OutboundCtx = Parameters<typeof transformer.outbound>[1]\ntype InboundCtx = Parameters<typeof transformer.inbound>[1]\n\nexport interface OutboundBoundaryOptions {\n uploadUrl?: string\n streamUrl?: string\n /** Claim-check offload threshold in bytes, transmitted via task options. */\n maxPayloadSize?: number\n /** Upload/stream cap in bytes, transmitted via task options. */\n maxFileSize?: number\n signal?: AbortSignal\n fetch?: typeof globalThis.fetch\n /** Sink for best-effort degradation notices. Defaults to `console.warn`. */\n warn?(message: string, error?: unknown): void\n}\n\nexport interface OutboundSendOptions {\n /** The emission this value belongs to (embedded in callback references). */\n outputName?: string | null\n /** Callback registrar for this emission; absent ⇒ functions fail loud. */\n onCallback?: CallbackEgressContext['onCallback']\n /**\n * Log policy: sanitize the payload first (functions/opaque instances become\n * labels), degrade offload failures to warnings, and never reject — a log\n * line must not fail the task. On a transform error resolves to `undefined`\n * (callers skip publishing).\n */\n bestEffort?: boolean\n}\n\nexport interface OutboundBoundary {\n /**\n * Serialize a value through the composed transformer inside a\n * `withRequenceStreams` scope. The returned promise resolves with the\n * serialized value as soon as references exist (stream bodies may still be\n * uploading); background completion is tracked in the boundary's ledger and\n * surfaced by `settle()`.\n */\n send(data: unknown, opts?: OutboundSendOptions): Promise<unknown>\n /** Enroll an external promise (e.g. a publish) in the done-gate. */\n track(promise: Promise<unknown>): void\n /**\n * The done-gate: wait until the ledger stops growing (sends may enqueue\n * more sends), then throw an `AggregateError` if any fail-hard work failed.\n * Ledger entries are pre-caught at registration time, so nothing ever\n * rejects unhandled while the gate is not yet attached.\n */\n settle(): Promise<void>\n}\n\nexport function createOutboundBoundary(\n base: OutboundBoundaryOptions,\n): OutboundBoundary {\n const warn =\n base.warn ??\n ((message: string, error?: unknown) =>\n error === undefined\n ? console.warn(message)\n : console.warn(message, error))\n\n const ledger: Array<Promise<void>> = []\n const errors: Error[] = []\n\n const track = (promise: Promise<unknown>) => {\n ledger.push(\n promise.then(\n () => {},\n (error: unknown) => {\n errors.push(error instanceof Error ? error : new Error(String(error)))\n },\n ),\n )\n }\n\n return {\n track,\n\n async send(data, opts = {}) {\n const ctx: OutboundCtx = {\n fetch: base.fetch ?? globalThis.fetch,\n signal: base.signal,\n uploadUrl: base.uploadUrl,\n streamUrl: base.streamUrl,\n maxPayloadSize: base.maxPayloadSize,\n maxFileSize: base.maxFileSize,\n outputName: opts.outputName ?? null,\n onCallback: opts.onCallback,\n ...(opts.bestEffort\n ? {\n onOffloadFail: (error: Error) =>\n warn('offload failed (best-effort log path):', error),\n onOffloadSkip: () =>\n warn('offload skipped: no upload transport configured'),\n }\n : {}),\n }\n\n if (opts.bestEffort) {\n try {\n const { value, done } = await withRequenceStreams(() =>\n transformer.outbound(sanitizeLogData(data), ctx),\n )\n // resolve-only: the gate waits for the upload but cannot fail on it\n ledger.push(\n done.then(\n () => {},\n (error: unknown) => warn('log stream upload failed:', error),\n ),\n )\n return value\n } catch (error) {\n warn('log offload errored:', error)\n return undefined\n }\n }\n\n const { value, done } = await withRequenceStreams(() =>\n transformer.outbound(data, ctx),\n )\n track(done)\n return value\n },\n\n async settle() {\n for (;;) {\n const count = ledger.length\n await Promise.all(ledger)\n if (count === ledger.length) {\n break\n }\n }\n if (errors.length > 0) {\n const failed = errors.splice(0)\n throw new AggregateError(failed, failed[0].message)\n }\n },\n }\n}\n\nexport interface InboundBoundaryOptions {\n fetch?: typeof globalThis.fetch\n /** Cancellation for lazy remote reads of reconstructed values. */\n signal?: AbortSignal\n /** Per-boundary rehydration timeout; composed with `signal` per call. */\n timeoutMs?: number\n /** Default invocation dispatch for reconstructed callbacks. */\n onCallbackInvoke?: CallbackIngressContext['onCallbackInvoke']\n /**\n * Transformer override for this boundary; defaults to the full composed\n * chain. Passthrough consumers substitute the claim-check-only instance\n * (`transformer.ts`) so byte references stay raw wire objects.\n */\n transformer?: { inbound(data: unknown, ctx: InboundCtx): Promise<unknown> }\n}\n\nexport interface InboundReceiveOptions {\n onCallbackInvoke?: CallbackIngressContext['onCallbackInvoke']\n}\n\n/**\n * The single place the service's ingress cancellation/timeout policy lives:\n * every inbound transform of the runtime goes through one of these.\n */\nexport function createInboundBoundary(base: InboundBoundaryOptions = {}) {\n return (\n data: unknown,\n opts: InboundReceiveOptions = {},\n ): Promise<unknown> => {\n const timeout =\n base.timeoutMs && base.timeoutMs > 0\n ? AbortSignal.timeout(base.timeoutMs)\n : undefined\n const signal =\n base.signal && timeout\n ? AbortSignal.any([base.signal, timeout])\n : (timeout ?? base.signal)\n\n const ctx: InboundCtx = {\n fetch: base.fetch ?? globalThis.fetch,\n signal,\n onCallbackInvoke: opts.onCallbackInvoke ?? base.onCallbackInvoke,\n }\n return (base.transformer ?? transformer).inbound(data, ctx)\n }\n}\n",
|
|
32
|
+
"import { AsyncLocalStorage } from 'node:async_hooks'\n\nimport type { CallbackObject } from '@requence/helpers'\n\nimport { createInboundBoundary } from './boundary.ts'\nimport { passthroughInboundTransformer } from './transformer.ts'\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | { [x: string]: JSONValue }\n | Array<JSONValue>\n | null\n | undefined\n\nexport class RetryError extends Error {\n constructor(public delay?: number) {\n super()\n }\n}\n\nexport class SkipError extends Error {}\n\nexport class AbortError extends Error {}\n\nconst OUTPUT_VALUE = Symbol('output_value')\n\ntype OutputValue = {\n [OUTPUT_VALUE]: string | null\n value: any\n}\n\nfunction isOutputValue(value: unknown): value is OutputValue {\n return value !== null && typeof value === 'object' && OUTPUT_VALUE in value\n}\n\n/**\n * Unwrap the `context.toOutput(...)` symbol wrapper into its raw value and\n * output name. Pure — serialization happens at the component's outbound\n * boundary (`createOutboundBoundary`), not here.\n */\nexport function unwrapOutputValue(result: unknown): {\n value: unknown\n outputName: string | null\n} {\n if (isOutputValue(result)) {\n return { value: result.value, outputName: result[OUTPUT_VALUE] }\n }\n return { value: result, outputName: null }\n}\n\n// The privileged send API (unit 05 headers, main-path variant). Runtime-attached\n// to every handler context but deliberately absent from the inferred\n// `ContextHelper` type — ordinary services must not discover it via typing.\n// Privileged consumers (the reserved requence-logic runtime) cast their context\n// to `PrivilegedContext`.\nexport interface PrivilegedSends {\n send(data: unknown, options?: { overwrite?: boolean }): void\n sendToOutput(\n name: string,\n data: unknown,\n options?: { overwrite?: boolean },\n ): void\n sendState(state: unknown): void\n // Fire-and-forget invocation of a raw RequenceCallback wire ref (todo/11):\n // passthrough consumers receive callback refs un-rehydrated, so this is\n // their dispatch path. The arg goes through the message's outbound boundary\n // like any callback invocation; failures surface at the settle gate, not\n // here.\n invokeCallback(ref: CallbackObject, arg: unknown): void\n // The dispatch's transport options (payload.options, verbatim) so a\n // privileged consumer can forward upload targets across its own boundary.\n options: {\n uploadUrl?: string\n streamUrl?: string\n maxPayloadSize?: number\n maxFileSize?: number\n }\n}\n\nexport default async function createContextHelper(options: {\n taskId: string\n input: unknown\n configuration: unknown\n // Hoisted per-message controller (shared with the outbound boundary);\n // created here when the caller does not provide one.\n abortController?: AbortController\n // Skip file/stream/callback rehydration on ingress (claim-checks still\n // resolve): byte references reach the handler as their raw JSON-safe\n // `__REQUENCE_type` wire objects. Used by consumers that forward values\n // across a JSON process boundary (the logic runtime's guest channel).\n passthroughByteReferences?: boolean\n onLog: (method: 'log' | 'warn' | 'info' | 'error', data: any[]) => void\n onDefer: (reason?: string) => string\n onCallback: (params: {\n sourceId: string\n callbackId: string\n outputName: string | null\n propertyPath: (string | number)[]\n arg: unknown\n }) => void\n sends: PrivilegedSends\n}) {\n const terminatePromise = Promise.withResolvers<string>()\n const abortController = options.abortController ?? new AbortController()\n terminatePromise.promise.then(() => abortController.abort())\n\n const terminated = Object.assign(terminatePromise.promise, {\n signal: abortController.signal,\n })\n\n // Rehydration (FileObject/StreamObject → RequenceFile/RequenceStream,\n // RequenceCallback → function) — the component's single signal-aware\n // inbound boundary, called once per inbound sub-path. Passthrough mode swaps\n // in the chain that resolves claim-checks but keeps byte references raw.\n const inbound = createInboundBoundary({\n signal: abortController.signal,\n ...(options.passthroughByteReferences\n ? { transformer: passthroughInboundTransformer }\n : {}),\n })\n const [input, configuration] = await Promise.all([\n inbound(options.input, { onCallbackInvoke: options.onCallback }),\n inbound(options.configuration, {\n onCallbackInvoke: () => {\n throw new Error('configuration may not have callbacks')\n },\n }),\n ])\n\n const context = {\n taskId: options.taskId,\n input,\n configuration,\n\n toOutput(name: string | null, value: unknown): OutputValue {\n return {\n [OUTPUT_VALUE]: name,\n value,\n }\n },\n defer: options.onDefer,\n\n debug: {\n log(...data: any[]) {\n options.onLog('log', data)\n },\n info(...data: any[]) {\n options.onLog('info', data)\n },\n warn(...data: any[]) {\n options.onLog('warn', data)\n },\n error(...data: any[]) {\n options.onLog('error', data)\n },\n },\n retry(delay?: number) {\n throw new RetryError(delay)\n },\n abort(reason?: string) {\n throw new AbortError(reason)\n },\n skip() {\n throw new SkipError()\n },\n terminated,\n }\n\n // Attached at runtime only: `context`'s inferred type (and therefore the\n // public `ContextHelper`) must not include the privileged send API.\n Object.assign(context, options.sends)\n\n return [context, terminatePromise] as const\n}\n\nexport type ContextHelper = Awaited<ReturnType<typeof createContextHelper>>[0]\n\n// Undocumented — the context shape privileged consumers (requence-logic) cast\n// to. The send methods are present at runtime on every handler context but\n// hidden from `ContextHelper`; the operator honors their `state`/`overwrite`\n// headers only for privileged nodes.\nexport type PrivilegedContext = ContextHelper & PrivilegedSends\n\nexport const handlerStorage = new AsyncLocalStorage<ContextHelper>()\n",
|
|
19
33
|
"import { handlerStorage } from './helpers.ts'\n\nfunction isAsyncIterable<T>(\n iterable: Iterable<T> | AsyncIterable<T>,\n): iterable is AsyncIterable<T> {\n return typeof (iterable as any)[Symbol.asyncIterator] === 'function'\n}\n\nexport function wrapIterable<T extends Iterable<any> | AsyncIterable<any>>(\n iterable: T,\n): T {\n const context = handlerStorage.getStore()\n\n if (!context) {\n return iterable\n }\n\n let terminated = false\n\n context.terminated.then(() => {\n terminated = true\n })\n\n if (isAsyncIterable(iterable)) {\n return {\n [Symbol.asyncIterator]() {\n const iterator = iterable[Symbol.asyncIterator]()\n\n return {\n async next() {\n const result = await Promise.race([\n context.terminated,\n iterator.next(),\n ])\n\n if (terminated) {\n return { done: true, value: undefined }\n }\n\n return result\n },\n }\n },\n } as T\n }\n\n return {\n [Symbol.iterator]() {\n const iterator = iterable[Symbol.iterator]()\n\n return {\n next() {\n if (terminated) {\n return { done: true, value: undefined }\n }\n const result = iterator.next()\n return result\n },\n }\n },\n } as T\n}\n\nexport function asyncEventEmitter<T>(initial: Array<T> = []) {\n const context = handlerStorage.getStore()\n\n let terminated = false\n context?.terminated.then(() => {\n terminated = true\n })\n\n let resolve: (value: T) => void\n const initialValues = structuredClone(initial)\n return {\n push: (value: T) => {\n if (resolve) {\n resolve(value)\n } else {\n initialValues.push(value)\n }\n },\n [Symbol.asyncIterator](): AsyncIterator<T> {\n return {\n async next() {\n if (initialValues.length > 0) {\n return { value: initialValues.shift()!, done: false }\n }\n const defer = Promise.withResolvers<T>()\n resolve = defer.resolve\n\n if (context) {\n const value = await Promise.race([\n defer.promise,\n context.terminated,\n ])\n\n return terminated\n ? { done: true, value: undefined }\n : { done: false, value: value as Awaited<T> }\n }\n\n return { value: await defer.promise, done: false }\n },\n }\n },\n }\n}\n"
|
|
20
34
|
],
|
|
21
|
-
"mappings": ";;;;;;AAAA;;;ACAA;AAEA,IAAM,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC9C,SAAS,QAAQ,CAAC,MAAgD;AAAA,EACvE,OAAO,aAAa,UAAU,IAAI,EAAE;AAAA;AAGtC,IAAM,aAAa,EAAE,KAAK;;;ACmB1B,SAAS,OAAU,CAAC,OAAuB,WAA+B;AAAA,EACxE,IAAI,iBAAiB,SAAS;AAAA,IAC5B,OAAO,QAAQ,QAAQ,EACpB,KAAK,MAAM,KAAK,EAChB,KAAK,SAAS;AAAA,EACnB;AAAA,EACA,OAAO,UAAU,KAAK;AAAA;AAGxB,SAAS,YAAY,CAAC,OAAgB,UAAmB;AAAA,EACvD,OAAO,QAAQ,OAAO,CAAC,kBACrB,OAAO,kBAAkB,cAAc,WAAW,aACpD;AAAA;AAAA;AAGF,MAAM,qBAAqB,MAAM;AAAC;AAE3B,SAAS,OAIf,CACC,MACA,UAKA;AAAA,EACA,IAAI,UAAU;AAAA,EACd,MAAM,eAAe,CAAC,OAAW,SAAsC;AAAA,IACrE,IAAI,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