@workglow/util 0.2.22 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js.map +1 -1
- package/dist/bun.js.map +1 -1
- package/dist/media/cpuImage.d.ts.map +1 -1
- package/dist/media/imageRasterCodecRegistry.d.ts.map +1 -1
- package/dist/media/sharpImage.server.d.ts.map +1 -1
- package/dist/media/webGpuImage.browser.d.ts.map +1 -1
- package/dist/media-browser.d.ts +6 -5
- package/dist/media-browser.d.ts.map +1 -1
- package/dist/media-browser.js +524 -509
- package/dist/media-browser.js.map +15 -15
- package/dist/media-node.js.map +9 -9
- package/dist/node.js.map +1 -1
- package/dist/worker-browser.js.map +1 -1
- package/dist/worker-bun.js.map +1 -1
- package/dist/worker-node.js.map +1 -1
- package/package.json +1 -1
package/dist/browser.js.map
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Container, globalContainer } from \"./Container\";\n\n/**\n * Service token type for type-safe dependency injection\n */\nexport interface ServiceToken<T> {\n readonly _type: T;\n readonly id: string;\n}\n\n/**\n * Create a typed service token\n * @param id Unique identifier for the service\n * @returns A typed service token\n */\nexport function createServiceToken<T>(id: string): ServiceToken<T> {\n return { id, _type: null as any };\n}\n\n/**\n * Service registry for managing and accessing services\n */\nexport class ServiceRegistry {\n public container: Container;\n\n /**\n * Create a new service registry\n * @param container Optional container to use (defaults to global container)\n */\n constructor(container: Container = globalContainer) {\n this.container = container;\n }\n\n /**\n * Register a service factory\n * @param token Service token\n * @param factory Factory function to create the service\n * @param singleton Whether the service should be a singleton\n */\n register<T>(token: ServiceToken<T>, factory: () => T, singleton = true): void {\n this.container.register(token.id, factory, singleton);\n }\n\n /**\n * Register a service factory only if the token is not already registered.\n * @param token Service token\n * @param factory Factory function to create the service\n * @param singleton Whether the service should be a singleton\n */\n registerIfAbsent<T>(token: ServiceToken<T>, factory: () => T, singleton = true): void {\n this.container.registerIfAbsent(token.id, factory, singleton);\n }\n\n /**\n * Register a service instance\n * @param token Service token\n * @param instance Service instance to register\n */\n registerInstance<T>(token: ServiceToken<T>, instance: T): void {\n this.container.registerInstance(token.id, instance);\n }\n\n /**\n * Get a service by its token\n * @param token Service token\n * @returns The service instance\n */\n get<T>(token: ServiceToken<T>): T {\n return this.container.get<T>(token.id);\n }\n\n /**\n * Check if a service is registered\n * @param token Service token\n * @returns True if the service is registered\n */\n has<T>(token: ServiceToken<T>): boolean {\n return this.container.has(token.id);\n }\n\n /**\n * Dispose all instantiated services and clear registrations.\n */\n async dispose(): Promise<void> {\n await this.container.dispose();\n }\n}\n\n/**\n * Global service registry instance\n */\nexport const globalServiceRegistry = new ServiceRegistry(globalContainer);\n",
|
|
9
9
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ServiceRegistry } from \"./ServiceRegistry\";\nimport { createServiceToken, globalServiceRegistry } from \"./ServiceRegistry\";\n\n/**\n * A compactor function that converts a resolved instance back to its string ID.\n * Returns undefined if the value cannot be compacted (e.g., missing ID field).\n *\n * @param value The resolved instance to compact\n * @param format The full format string (e.g., \"model:TextEmbedding\", \"storage:tabular\")\n * @param registry The service registry to use for lookups\n */\nexport type InputCompactorFn = (\n value: unknown,\n format: string,\n registry: ServiceRegistry\n) => string | undefined | Promise<string | undefined>;\n\n/**\n * Service token for the input compactor registry.\n * Maps format prefixes to compactor functions.\n */\nexport const INPUT_COMPACTORS =\n createServiceToken<Map<string, InputCompactorFn>>(\"task.input.compactors\");\n\n// Register default factory if not already registered\nglobalServiceRegistry.registerIfAbsent(\n INPUT_COMPACTORS,\n (): Map<string, InputCompactorFn> => new Map(),\n true\n);\n\n/**\n * Gets the global input compactor registry\n * @returns Map of format prefix to compactor function\n */\nexport function getInputCompactors(): Map<string, InputCompactorFn> {\n return globalServiceRegistry.get(INPUT_COMPACTORS);\n}\n\n/**\n * Registers an input compactor for a format prefix.\n * The compactor will be called to convert resolved instances back to string IDs.\n *\n * @param formatPrefix The format prefix to match (e.g., \"model\", \"knowledge-base\")\n * @param compactor The compactor function\n *\n * @example\n * ```typescript\n * // Register model compactor — extracts model_id from a ModelConfig\n * registerInputCompactor(\"model\", (value) => {\n * if (typeof value === \"object\" && value !== null && \"model_id\" in value) {\n * const id = (value as Record<string, unknown>).model_id;\n * return typeof id === \"string\" ? id : undefined;\n * }\n * return undefined;\n * });\n * ```\n */\nexport function registerInputCompactor(formatPrefix: string, compactor: InputCompactorFn): void {\n const compactors = getInputCompactors();\n compactors.set(formatPrefix, compactor);\n}\n",
|
|
10
10
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ServiceRegistry } from \"./ServiceRegistry\";\nimport { createServiceToken, globalServiceRegistry } from \"./ServiceRegistry\";\n\n/**\n * A resolver function that converts a string ID to an instance.\n * Returns undefined if the resolver cannot handle this format.\n * Throws an error if the ID is not found.\n *\n * @param id The string ID to resolve\n * @param format The full format string (e.g., \"model:TextEmbedding\", \"storage:tabular\")\n * @param registry The service registry to use for lookups\n */\nexport type InputResolverFn = (\n id: string,\n format: string,\n registry: ServiceRegistry\n) => unknown | Promise<unknown>;\n\n/**\n * Service token for the input resolver registry.\n * Maps format prefixes to resolver functions.\n */\nexport const INPUT_RESOLVERS =\n createServiceToken<Map<string, InputResolverFn>>(\"task.input.resolvers\");\n\n// Register default factory if not already registered\nglobalServiceRegistry.registerIfAbsent(\n INPUT_RESOLVERS,\n (): Map<string, InputResolverFn> => new Map(),\n true\n);\n\n/**\n * Gets the global input resolver registry\n * @returns Map of format prefix to resolver function\n */\nexport function getInputResolvers(): Map<string, InputResolverFn> {\n return globalServiceRegistry.get(INPUT_RESOLVERS);\n}\n\n/**\n * Registers an input resolver for a format prefix.\n * The resolver will be called for any format that starts with this prefix.\n *\n * @param formatPrefix The format prefix to match (e.g., \"model\", \"dataset\")\n * @param resolver The resolver function\n *\n * @example\n * ```typescript\n * // Register model resolver\n * registerInputResolver(\"model\", async (id, format, registry) => {\n * const modelRepo = registry.get(MODEL_REPOSITORY);\n * const model = await modelRepo.findByName(id);\n * if (!model) throw new Error(`Model \"${id}\" not found`);\n * return model;\n * });\n *\n * // Register dataset resolver\n * registerInputResolver(\"dataset\", (id, format, registry) => {\n * const datasetType = format.split(\":\")[1]; // \"tabular\", \"vector\", etc.\n * if (datasetType === \"tabular\") {\n * const datasets = registry.get(TABULAR_DATASETS);\n * const dataset = datasets.get(id);\n * if (!dataset) throw new Error(`Dataset \"${id}\" not found`);\n * return dataset;\n * }\n * throw new Error(`Unknown dataset type: ${datasetType}`);\n * });\n * ```\n */\nexport function registerInputResolver(formatPrefix: string, resolver: InputResolverFn): void {\n const resolvers = getInputResolvers();\n resolvers.set(formatPrefix, resolver);\n}\n",
|
|
11
|
-
"/**\n * @copyright\n * Copyright 2026 Steven Roussey\n * All Rights Reserved\n */\n\nexport interface PortCodec<Live = unknown, Wire = unknown> {\n serialize(value: Live): Promise<Wire>;\n deserialize(value: Wire): Promise<Live>;\n}\n\n/**\n * Codec registry shared across bundle copies via a Symbol.for key — same pattern\n * as globalContainer. Without this, split entry points (e.g. @workglow/util,\n * @workglow/util/media, @workglow/task-graph) could each see their own Map and\n * fail to find codecs registered by sibling entries.\n */\nconst GLOBAL_CODECS_KEY = Symbol.for(\"@workglow/util/di/portCodecs\");\nconst _g = globalThis as Record<symbol, unknown>;\nif (!_g[GLOBAL_CODECS_KEY]) {\n _g[GLOBAL_CODECS_KEY] = new Map<string, PortCodec>();\n}\nconst codecs = _g[GLOBAL_CODECS_KEY] as Map<string, PortCodec>;\n\nexport function registerPortCodec<Live = unknown, Wire = unknown>(\n formatPrefix: string,\n codec: PortCodec<Live, Wire
|
|
11
|
+
"/**\n * @copyright\n * Copyright 2026 Steven Roussey\n * All Rights Reserved\n */\n\nexport interface PortCodec<Live = unknown, Wire = unknown> {\n serialize(value: Live): Promise<Wire>;\n deserialize(value: Wire): Promise<Live>;\n}\n\n/**\n * Codec registry shared across bundle copies via a Symbol.for key — same pattern\n * as globalContainer. Without this, split entry points (e.g. @workglow/util,\n * @workglow/util/media, @workglow/task-graph) could each see their own Map and\n * fail to find codecs registered by sibling entries.\n */\nconst GLOBAL_CODECS_KEY = Symbol.for(\"@workglow/util/di/portCodecs\");\nconst _g = globalThis as Record<symbol, unknown>;\nif (!_g[GLOBAL_CODECS_KEY]) {\n _g[GLOBAL_CODECS_KEY] = new Map<string, PortCodec>();\n}\nconst codecs = _g[GLOBAL_CODECS_KEY] as Map<string, PortCodec>;\n\nexport function registerPortCodec<Live = unknown, Wire = unknown>(\n formatPrefix: string,\n codec: PortCodec<Live, Wire>\n): void {\n codecs.set(formatPrefix, codec as PortCodec);\n}\n\nexport function getPortCodec(format: string): PortCodec | undefined {\n if (codecs.has(format)) return codecs.get(format);\n const colon = format.indexOf(\":\");\n if (colon > 0) {\n const prefix = format.slice(0, colon);\n return codecs.get(prefix);\n }\n return undefined;\n}\n\n/** @internal — test affordance only. */\nexport function _resetPortCodecsForTests(): void {\n codecs.clear();\n}\n",
|
|
12
12
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A type that represents a listener function for an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\ntype EventListener<Events, EventType extends keyof Events> = Events[EventType];\n\n/**\n * A type that represents a list of listener functions for an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\ntype EventListeners<Events, EventType extends keyof Events> = Array<{\n listener: EventListener<Events, EventType>;\n once?: boolean;\n}>;\n\n/**\n * A type that represents the parameters of an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\nexport type EventParameters<Events, EventType extends keyof Events> = {\n [Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any\n ? P\n : never;\n}[EventType];\n\n/**\n * A type that represents the return type of the emitted method.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\nexport type EmittedReturnType<Events, EventType extends keyof Events> = EventParameters<\n Events,\n EventType\n>;\n\n/**\n * A class that implements an event emitter pattern.\n * @template EventListenerTypes - A record of event names and their corresponding listener functions\n */\nexport class EventEmitter<EventListenerTypes extends Record<string, (...args: any) => any>> {\n private listeners: {\n [Event in keyof EventListenerTypes]?: EventListeners<EventListenerTypes, Event>;\n } = {};\n private maxListeners: number = 0;\n private warnedEvents = new Set<keyof EventListenerTypes>();\n\n /**\n * Set the maximum number of listeners per event before a warning is emitted.\n * 0 means unlimited (default).\n */\n setMaxListeners(n: number): this {\n if (!Number.isFinite(n) || n < 0) {\n throw new RangeError(`\"n\" must be a non-negative finite number. Got ${n}.`);\n }\n this.maxListeners = Math.trunc(n);\n this.warnedEvents.clear();\n return this;\n }\n\n /**\n * Get the number of listeners for a specific event\n */\n listenerCount<Event extends keyof EventListenerTypes>(event: Event): number {\n return this.listeners[event]?.length ?? 0;\n }\n\n /**\n * Get all event names that have registered listeners\n */\n eventNames(): Array<keyof EventListenerTypes> {\n return (Object.keys(this.listeners) as Array<keyof EventListenerTypes>).filter(\n (k) => (this.listeners[k]?.length ?? 0) > 0\n );\n }\n\n /**\n * Remove all listeners for a specific event or all events\n * @param event - Optional event name. If not provided, removes all listeners for all events\n * @returns this, so that calls can be chained\n */\n removeAllListeners<Event extends keyof EventListenerTypes>(event?: Event): this {\n if (event) {\n delete this.listeners[event];\n this.warnedEvents.delete(event);\n } else {\n this.listeners = {};\n this.warnedEvents.clear();\n }\n return this;\n }\n\n /**\n * Adds a listener function for the event\n * @param event - The event name to listen for\n * @param listener - The listener function to add\n * @returns this, so that calls can be chained\n */\n on<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners: EventListeners<EventListenerTypes, Event> =\n this.listeners[event] || (this.listeners[event] = []);\n listeners.push({ listener });\n this.checkMaxListeners(event, listeners.length);\n return this;\n }\n\n /**\n * Removes a listener function for the event\n * @param event - The event name to remove the listener from\n * @param listener - The listener function to remove\n * @returns this, so that calls can be chained\n */\n off<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners = this.listeners[event];\n if (!listeners) return this;\n\n const index = listeners.findIndex((l) => l.listener === listener);\n if (index >= 0) {\n listeners.splice(index, 1);\n if (this.maxListeners > 0 && listeners.length <= this.maxListeners) {\n this.warnedEvents.delete(event);\n }\n }\n return this;\n }\n\n /**\n * Adds a listener function for the event that will be called only once\n * @param event - The event name to listen for\n * @param listener - The listener function to add\n * @returns this, so that calls can be chained\n */\n once<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners: EventListeners<EventListenerTypes, Event> =\n this.listeners[event] || (this.listeners[event] = []);\n listeners.push({ listener, once: true });\n this.checkMaxListeners(event, listeners.length);\n return this;\n }\n\n /**\n * Returns a promise that resolves when the event is emitted\n * @param event - The event name to listen for\n * @returns a promise that resolves to an array of all parameters of the event (empty array for events with no parameters)\n */\n waitOn<Event extends keyof EventListenerTypes>(\n event: Event\n ): Promise<EmittedReturnType<EventListenerTypes, Event>> {\n return new Promise((resolve) => {\n // Create an anonymous function that captures all arguments and passes them to resolve\n const listener = ((...args: any[]) => {\n // Always resolve with the array of arguments (which may be empty)\n resolve(args as any);\n }) as EventListener<EventListenerTypes, Event>;\n\n this.once(event, listener);\n });\n }\n\n /**\n * Emits an event with the specified name and arguments\n * @param event - The event name to emit\n * @param args - Arguments to pass to the event listeners\n */\n public emit<Event extends keyof EventListenerTypes>(\n this: EventEmitter<EventListenerTypes>,\n event: Event,\n ...args: EventParameters<EventListenerTypes, Event>\n ) {\n const listeners: EventListeners<EventListenerTypes, Event> | undefined = this.listeners[event];\n if (listeners) {\n // Snapshot the listener array to avoid issues with concurrent modification\n const snapshot = [...listeners];\n const errors: unknown[] = [];\n for (const { listener } of snapshot) {\n try {\n listener(...args);\n } catch (e) {\n errors.push(e);\n }\n }\n // Remove once listeners we just called\n this.listeners[event] = listeners.filter((l) => !l.once);\n if (this.maxListeners > 0 && (this.listeners[event]?.length ?? 0) <= this.maxListeners) {\n this.warnedEvents.delete(event);\n }\n // Re-throw errors after all listeners have been called\n if (errors.length > 1) {\n throw new AggregateError(\n errors,\n `${errors.length} listener(s) threw on \"${String(event)}\"`\n );\n } else if (errors.length === 1) {\n throw errors[0];\n }\n }\n }\n\n private checkMaxListeners<Event extends keyof EventListenerTypes>(\n event: Event,\n count: number\n ): void {\n if (this.maxListeners > 0 && count > this.maxListeners && !this.warnedEvents.has(event)) {\n this.warnedEvents.add(event);\n console.warn(\n `MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ` +\n `${count} listeners added for event \"${String(event)}\". ` +\n `Use setMaxListeners() to increase limit (current: ${this.maxListeners}).`\n );\n }\n }\n\n /**\n * Subscribes to an event and returns a function to unsubscribe\n * @param event - The event name to subscribe to\n * @param listener - The listener function to add\n * @returns a function to unsubscribe from the event\n */\n public subscribe<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): () => void {\n this.on(event, listener);\n return () => this.off(event, listener);\n }\n}\n",
|
|
13
13
|
"/**\n * @license\n * Copyright 2026 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DataPortSchema } from \"../json-schema/DataPortSchema\";\nimport { createServiceToken } from \"../di/ServiceRegistry\";\n\n/**\n * The kind of interaction being requested.\n *\n * - \"notify\": One-way message, no response expected. Fire-and-forget.\n * - \"display\": Present rich content (markdown, data, visualization hints).\n * Response optional (acknowledgment).\n * - \"elicit\": Request structured input via a form schema (MCP elicitation).\n * Response expected with user-submitted data.\n */\nexport type HumanInteractionKind = \"notify\" | \"display\" | \"elicit\";\n\n/** User action in response to an interaction (MCP-aligned for \"elicit\" kind) */\nexport type HumanResponseAction = \"accept\" | \"decline\" | \"cancel\";\n\n/**\n * A unified request sent to a human via an IHumanConnector.\n *\n * The `kind` field determines the interaction pattern. The `content` schema\n * describes WHAT to render — the UI layer interprets it based on `kind`.\n */\nexport interface IHumanRequest {\n /** Unique identifier for this request (used to correlate responses) */\n readonly requestId: string;\n /** Target human identifier — \"default\" for the main user, or a specific user/role ID */\n readonly targetHumanId: string;\n /** What kind of interaction this is */\n readonly kind: HumanInteractionKind;\n /** Explanatory message shown to the human */\n readonly message: string;\n /**\n * Content schema — describes what to render.\n *\n * For \"notify\": Describes notification content (may be empty, message suffices).\n * For \"display\": Describes the data/visualization to present. Properties contain\n * the actual data to render. Use x-ui-viewer annotations for hints.\n * For \"elicit\": Describes the form fields for user input (MCP requestedSchema).\n */\n readonly contentSchema: DataPortSchema;\n /**\n * Concrete data to display (for \"notify\" and \"display\" kinds).\n * For \"elicit\", this is typically empty — the human provides the data.\n */\n readonly contentData: Record<string, unknown> | undefined;\n /** Whether a response is expected. Default: true for \"elicit\", false for \"notify\"/\"display\". */\n readonly expectsResponse: boolean;\n /** Interaction mode: single request-response or multi-turn conversation */\n readonly mode: \"single\" | \"multi-turn\";\n /** Arbitrary context data passed through to the connector */\n readonly metadata: Record<string, unknown> | undefined;\n}\n\n/**\n * A response from a human, collected by the IHumanConnector.\n * For \"notify\"/\"display\" interactions, this may just be an acknowledgment.\n */\nexport interface IHumanResponse {\n /** Correlates to the IHumanRequest.requestId */\n readonly requestId: string;\n /**\n * The human's action:\n * - \"accept\": user submitted data or acknowledged\n * - \"decline\": user explicitly refused\n * - \"cancel\": user dismissed without choosing\n */\n readonly action: HumanResponseAction;\n /** The human's response data (present when action is \"accept\" and kind is \"elicit\") */\n readonly content: Record<string, unknown> | undefined;\n /** Whether the conversation is complete. Always true for \"single\" mode. */\n readonly done: boolean;\n}\n\n/**\n * Interface for reaching a human and sending interactions.\n *\n * Unified schema-driven: the `kind` field in IHumanRequest determines the\n * interaction pattern. The connector renders accordingly — a notification\n * toast, a data visualization, or an input form.\n */\nexport interface IHumanConnector {\n /**\n * Send an interaction to a human.\n *\n * For \"notify\" and \"display\" kinds that don't expect a response, the\n * connector may resolve immediately with action \"accept\" and no content.\n *\n * For \"elicit\" kind, blocks until the human submits, declines, or cancels.\n * Must respect the AbortSignal for cancellation.\n */\n send(request: IHumanRequest, signal: AbortSignal): Promise<IHumanResponse>;\n\n /**\n * Send a follow-up in a multi-turn conversation.\n * Only called when mode is \"multi-turn\" and the previous response had done=false.\n */\n followUp?(\n request: IHumanRequest,\n previousResponse: IHumanResponse,\n signal: AbortSignal\n ): Promise<IHumanResponse>;\n}\n\n/** Service token for resolving the IHumanConnector from ServiceRegistry */\nexport const HUMAN_CONNECTOR = createServiceToken<IHumanConnector>(\"HUMAN_CONNECTOR\");\n\n/**\n * Resolves the IHumanConnector from the execution context's ServiceRegistry.\n *\n * Throws a plain `Error` (not TaskConfigurationError, to avoid a dependency on\n * @workglow/task-graph). Callers that need a typed error may catch and rewrap.\n */\nexport function resolveHumanConnector(context: {\n readonly registry: {\n has(token: typeof HUMAN_CONNECTOR): boolean;\n get(token: typeof HUMAN_CONNECTOR): IHumanConnector;\n };\n}): IHumanConnector {\n if (!context.registry.has(HUMAN_CONNECTOR)) {\n throw new Error(\n \"HUMAN_CONNECTOR not registered. Register one via \" +\n \"registry.registerInstance(HUMAN_CONNECTOR, connector) before running a human-in-the-loop task.\"\n );\n }\n return context.registry.get(HUMAN_CONNECTOR);\n}\n",
|
|
14
14
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ILogger } from \"./ILogger\";\n\n/**\n * Log-level names in ascending severity order.\n */\nexport type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\";\n\nconst LOG_LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n fatal: 4,\n};\n\nexport interface ConsoleLoggerOptions {\n readonly bindings?: Record<string, unknown>;\n readonly level?: LogLevel;\n readonly timings?: boolean;\n}\n\n/**\n * Logger that delegates to the global `console` object.\n * When created via {@link child}, accumulated bindings are passed\n * as a second argument to every console call.\n *\n * Supports optional level filtering (messages below the configured\n * level are silently discarded) and an opt-in `timings` flag that\n * controls whether {@link time}/{@link timeEnd} produce output.\n */\nexport class ConsoleLogger implements ILogger {\n private readonly bindings: Record<string, unknown>;\n private readonly level: LogLevel;\n private readonly timings: boolean;\n\n constructor(options: ConsoleLoggerOptions = {}) {\n this.bindings = options.bindings ?? {};\n this.level = options.level ?? \"debug\";\n this.timings = options.timings ?? false;\n }\n\n private enabled(level: LogLevel): boolean {\n return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.level];\n }\n\n info(message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"info\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.info(message, merged);\n } else {\n console.info(message);\n }\n }\n\n warn(message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"warn\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.warn(message, merged);\n } else {\n console.warn(message);\n }\n }\n\n error(message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"error\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.error(message, merged);\n } else {\n console.error(message);\n }\n }\n\n debug(message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"debug\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.debug(message, merged);\n } else {\n console.debug(message);\n }\n }\n\n fatal(err: Error, message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"fatal\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.error(message, { ...merged, error: err });\n } else {\n console.error(message, { error: err });\n }\n }\n\n time(label: string, meta?: Record<string, unknown>): void {\n if (!this.timings) return;\n const merged = this.merge(meta);\n if (merged) {\n console.info(`[time] ${label}`, merged);\n }\n console.time(label);\n }\n\n timeEnd(label: string, meta?: Record<string, unknown>): void {\n if (!this.timings) return;\n console.timeEnd(label);\n const merged = this.merge(meta);\n if (merged) {\n console.info(`[timeEnd] ${label}`, merged);\n }\n }\n\n group(label: string, meta?: Record<string, unknown>): void {\n const merged = this.merge(meta);\n if (merged) {\n console.group(label, merged);\n } else {\n console.group(label);\n }\n }\n\n groupEnd(): void {\n console.groupEnd();\n }\n\n child(bindings: Record<string, unknown>): ILogger {\n return new ConsoleLogger({\n bindings: { ...this.bindings, ...bindings },\n level: this.level,\n timings: this.timings,\n });\n }\n\n private merge(meta: Record<string, unknown> | undefined): Record<string, unknown> | undefined {\n const hasBindings = Object.keys(this.bindings).length > 0;\n if (!hasBindings && !meta) return undefined;\n if (!hasBindings) return meta;\n if (!meta) return this.bindings;\n return { ...this.bindings, ...meta };\n }\n}\n",
|
package/dist/bun.js.map
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Container, globalContainer } from \"./Container\";\n\n/**\n * Service token type for type-safe dependency injection\n */\nexport interface ServiceToken<T> {\n readonly _type: T;\n readonly id: string;\n}\n\n/**\n * Create a typed service token\n * @param id Unique identifier for the service\n * @returns A typed service token\n */\nexport function createServiceToken<T>(id: string): ServiceToken<T> {\n return { id, _type: null as any };\n}\n\n/**\n * Service registry for managing and accessing services\n */\nexport class ServiceRegistry {\n public container: Container;\n\n /**\n * Create a new service registry\n * @param container Optional container to use (defaults to global container)\n */\n constructor(container: Container = globalContainer) {\n this.container = container;\n }\n\n /**\n * Register a service factory\n * @param token Service token\n * @param factory Factory function to create the service\n * @param singleton Whether the service should be a singleton\n */\n register<T>(token: ServiceToken<T>, factory: () => T, singleton = true): void {\n this.container.register(token.id, factory, singleton);\n }\n\n /**\n * Register a service factory only if the token is not already registered.\n * @param token Service token\n * @param factory Factory function to create the service\n * @param singleton Whether the service should be a singleton\n */\n registerIfAbsent<T>(token: ServiceToken<T>, factory: () => T, singleton = true): void {\n this.container.registerIfAbsent(token.id, factory, singleton);\n }\n\n /**\n * Register a service instance\n * @param token Service token\n * @param instance Service instance to register\n */\n registerInstance<T>(token: ServiceToken<T>, instance: T): void {\n this.container.registerInstance(token.id, instance);\n }\n\n /**\n * Get a service by its token\n * @param token Service token\n * @returns The service instance\n */\n get<T>(token: ServiceToken<T>): T {\n return this.container.get<T>(token.id);\n }\n\n /**\n * Check if a service is registered\n * @param token Service token\n * @returns True if the service is registered\n */\n has<T>(token: ServiceToken<T>): boolean {\n return this.container.has(token.id);\n }\n\n /**\n * Dispose all instantiated services and clear registrations.\n */\n async dispose(): Promise<void> {\n await this.container.dispose();\n }\n}\n\n/**\n * Global service registry instance\n */\nexport const globalServiceRegistry = new ServiceRegistry(globalContainer);\n",
|
|
9
9
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ServiceRegistry } from \"./ServiceRegistry\";\nimport { createServiceToken, globalServiceRegistry } from \"./ServiceRegistry\";\n\n/**\n * A compactor function that converts a resolved instance back to its string ID.\n * Returns undefined if the value cannot be compacted (e.g., missing ID field).\n *\n * @param value The resolved instance to compact\n * @param format The full format string (e.g., \"model:TextEmbedding\", \"storage:tabular\")\n * @param registry The service registry to use for lookups\n */\nexport type InputCompactorFn = (\n value: unknown,\n format: string,\n registry: ServiceRegistry\n) => string | undefined | Promise<string | undefined>;\n\n/**\n * Service token for the input compactor registry.\n * Maps format prefixes to compactor functions.\n */\nexport const INPUT_COMPACTORS =\n createServiceToken<Map<string, InputCompactorFn>>(\"task.input.compactors\");\n\n// Register default factory if not already registered\nglobalServiceRegistry.registerIfAbsent(\n INPUT_COMPACTORS,\n (): Map<string, InputCompactorFn> => new Map(),\n true\n);\n\n/**\n * Gets the global input compactor registry\n * @returns Map of format prefix to compactor function\n */\nexport function getInputCompactors(): Map<string, InputCompactorFn> {\n return globalServiceRegistry.get(INPUT_COMPACTORS);\n}\n\n/**\n * Registers an input compactor for a format prefix.\n * The compactor will be called to convert resolved instances back to string IDs.\n *\n * @param formatPrefix The format prefix to match (e.g., \"model\", \"knowledge-base\")\n * @param compactor The compactor function\n *\n * @example\n * ```typescript\n * // Register model compactor — extracts model_id from a ModelConfig\n * registerInputCompactor(\"model\", (value) => {\n * if (typeof value === \"object\" && value !== null && \"model_id\" in value) {\n * const id = (value as Record<string, unknown>).model_id;\n * return typeof id === \"string\" ? id : undefined;\n * }\n * return undefined;\n * });\n * ```\n */\nexport function registerInputCompactor(formatPrefix: string, compactor: InputCompactorFn): void {\n const compactors = getInputCompactors();\n compactors.set(formatPrefix, compactor);\n}\n",
|
|
10
10
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ServiceRegistry } from \"./ServiceRegistry\";\nimport { createServiceToken, globalServiceRegistry } from \"./ServiceRegistry\";\n\n/**\n * A resolver function that converts a string ID to an instance.\n * Returns undefined if the resolver cannot handle this format.\n * Throws an error if the ID is not found.\n *\n * @param id The string ID to resolve\n * @param format The full format string (e.g., \"model:TextEmbedding\", \"storage:tabular\")\n * @param registry The service registry to use for lookups\n */\nexport type InputResolverFn = (\n id: string,\n format: string,\n registry: ServiceRegistry\n) => unknown | Promise<unknown>;\n\n/**\n * Service token for the input resolver registry.\n * Maps format prefixes to resolver functions.\n */\nexport const INPUT_RESOLVERS =\n createServiceToken<Map<string, InputResolverFn>>(\"task.input.resolvers\");\n\n// Register default factory if not already registered\nglobalServiceRegistry.registerIfAbsent(\n INPUT_RESOLVERS,\n (): Map<string, InputResolverFn> => new Map(),\n true\n);\n\n/**\n * Gets the global input resolver registry\n * @returns Map of format prefix to resolver function\n */\nexport function getInputResolvers(): Map<string, InputResolverFn> {\n return globalServiceRegistry.get(INPUT_RESOLVERS);\n}\n\n/**\n * Registers an input resolver for a format prefix.\n * The resolver will be called for any format that starts with this prefix.\n *\n * @param formatPrefix The format prefix to match (e.g., \"model\", \"dataset\")\n * @param resolver The resolver function\n *\n * @example\n * ```typescript\n * // Register model resolver\n * registerInputResolver(\"model\", async (id, format, registry) => {\n * const modelRepo = registry.get(MODEL_REPOSITORY);\n * const model = await modelRepo.findByName(id);\n * if (!model) throw new Error(`Model \"${id}\" not found`);\n * return model;\n * });\n *\n * // Register dataset resolver\n * registerInputResolver(\"dataset\", (id, format, registry) => {\n * const datasetType = format.split(\":\")[1]; // \"tabular\", \"vector\", etc.\n * if (datasetType === \"tabular\") {\n * const datasets = registry.get(TABULAR_DATASETS);\n * const dataset = datasets.get(id);\n * if (!dataset) throw new Error(`Dataset \"${id}\" not found`);\n * return dataset;\n * }\n * throw new Error(`Unknown dataset type: ${datasetType}`);\n * });\n * ```\n */\nexport function registerInputResolver(formatPrefix: string, resolver: InputResolverFn): void {\n const resolvers = getInputResolvers();\n resolvers.set(formatPrefix, resolver);\n}\n",
|
|
11
|
-
"/**\n * @copyright\n * Copyright 2026 Steven Roussey\n * All Rights Reserved\n */\n\nexport interface PortCodec<Live = unknown, Wire = unknown> {\n serialize(value: Live): Promise<Wire>;\n deserialize(value: Wire): Promise<Live>;\n}\n\n/**\n * Codec registry shared across bundle copies via a Symbol.for key — same pattern\n * as globalContainer. Without this, split entry points (e.g. @workglow/util,\n * @workglow/util/media, @workglow/task-graph) could each see their own Map and\n * fail to find codecs registered by sibling entries.\n */\nconst GLOBAL_CODECS_KEY = Symbol.for(\"@workglow/util/di/portCodecs\");\nconst _g = globalThis as Record<symbol, unknown>;\nif (!_g[GLOBAL_CODECS_KEY]) {\n _g[GLOBAL_CODECS_KEY] = new Map<string, PortCodec>();\n}\nconst codecs = _g[GLOBAL_CODECS_KEY] as Map<string, PortCodec>;\n\nexport function registerPortCodec<Live = unknown, Wire = unknown>(\n formatPrefix: string,\n codec: PortCodec<Live, Wire
|
|
11
|
+
"/**\n * @copyright\n * Copyright 2026 Steven Roussey\n * All Rights Reserved\n */\n\nexport interface PortCodec<Live = unknown, Wire = unknown> {\n serialize(value: Live): Promise<Wire>;\n deserialize(value: Wire): Promise<Live>;\n}\n\n/**\n * Codec registry shared across bundle copies via a Symbol.for key — same pattern\n * as globalContainer. Without this, split entry points (e.g. @workglow/util,\n * @workglow/util/media, @workglow/task-graph) could each see their own Map and\n * fail to find codecs registered by sibling entries.\n */\nconst GLOBAL_CODECS_KEY = Symbol.for(\"@workglow/util/di/portCodecs\");\nconst _g = globalThis as Record<symbol, unknown>;\nif (!_g[GLOBAL_CODECS_KEY]) {\n _g[GLOBAL_CODECS_KEY] = new Map<string, PortCodec>();\n}\nconst codecs = _g[GLOBAL_CODECS_KEY] as Map<string, PortCodec>;\n\nexport function registerPortCodec<Live = unknown, Wire = unknown>(\n formatPrefix: string,\n codec: PortCodec<Live, Wire>\n): void {\n codecs.set(formatPrefix, codec as PortCodec);\n}\n\nexport function getPortCodec(format: string): PortCodec | undefined {\n if (codecs.has(format)) return codecs.get(format);\n const colon = format.indexOf(\":\");\n if (colon > 0) {\n const prefix = format.slice(0, colon);\n return codecs.get(prefix);\n }\n return undefined;\n}\n\n/** @internal — test affordance only. */\nexport function _resetPortCodecsForTests(): void {\n codecs.clear();\n}\n",
|
|
12
12
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A type that represents a listener function for an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\ntype EventListener<Events, EventType extends keyof Events> = Events[EventType];\n\n/**\n * A type that represents a list of listener functions for an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\ntype EventListeners<Events, EventType extends keyof Events> = Array<{\n listener: EventListener<Events, EventType>;\n once?: boolean;\n}>;\n\n/**\n * A type that represents the parameters of an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\nexport type EventParameters<Events, EventType extends keyof Events> = {\n [Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any\n ? P\n : never;\n}[EventType];\n\n/**\n * A type that represents the return type of the emitted method.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\nexport type EmittedReturnType<Events, EventType extends keyof Events> = EventParameters<\n Events,\n EventType\n>;\n\n/**\n * A class that implements an event emitter pattern.\n * @template EventListenerTypes - A record of event names and their corresponding listener functions\n */\nexport class EventEmitter<EventListenerTypes extends Record<string, (...args: any) => any>> {\n private listeners: {\n [Event in keyof EventListenerTypes]?: EventListeners<EventListenerTypes, Event>;\n } = {};\n private maxListeners: number = 0;\n private warnedEvents = new Set<keyof EventListenerTypes>();\n\n /**\n * Set the maximum number of listeners per event before a warning is emitted.\n * 0 means unlimited (default).\n */\n setMaxListeners(n: number): this {\n if (!Number.isFinite(n) || n < 0) {\n throw new RangeError(`\"n\" must be a non-negative finite number. Got ${n}.`);\n }\n this.maxListeners = Math.trunc(n);\n this.warnedEvents.clear();\n return this;\n }\n\n /**\n * Get the number of listeners for a specific event\n */\n listenerCount<Event extends keyof EventListenerTypes>(event: Event): number {\n return this.listeners[event]?.length ?? 0;\n }\n\n /**\n * Get all event names that have registered listeners\n */\n eventNames(): Array<keyof EventListenerTypes> {\n return (Object.keys(this.listeners) as Array<keyof EventListenerTypes>).filter(\n (k) => (this.listeners[k]?.length ?? 0) > 0\n );\n }\n\n /**\n * Remove all listeners for a specific event or all events\n * @param event - Optional event name. If not provided, removes all listeners for all events\n * @returns this, so that calls can be chained\n */\n removeAllListeners<Event extends keyof EventListenerTypes>(event?: Event): this {\n if (event) {\n delete this.listeners[event];\n this.warnedEvents.delete(event);\n } else {\n this.listeners = {};\n this.warnedEvents.clear();\n }\n return this;\n }\n\n /**\n * Adds a listener function for the event\n * @param event - The event name to listen for\n * @param listener - The listener function to add\n * @returns this, so that calls can be chained\n */\n on<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners: EventListeners<EventListenerTypes, Event> =\n this.listeners[event] || (this.listeners[event] = []);\n listeners.push({ listener });\n this.checkMaxListeners(event, listeners.length);\n return this;\n }\n\n /**\n * Removes a listener function for the event\n * @param event - The event name to remove the listener from\n * @param listener - The listener function to remove\n * @returns this, so that calls can be chained\n */\n off<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners = this.listeners[event];\n if (!listeners) return this;\n\n const index = listeners.findIndex((l) => l.listener === listener);\n if (index >= 0) {\n listeners.splice(index, 1);\n if (this.maxListeners > 0 && listeners.length <= this.maxListeners) {\n this.warnedEvents.delete(event);\n }\n }\n return this;\n }\n\n /**\n * Adds a listener function for the event that will be called only once\n * @param event - The event name to listen for\n * @param listener - The listener function to add\n * @returns this, so that calls can be chained\n */\n once<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners: EventListeners<EventListenerTypes, Event> =\n this.listeners[event] || (this.listeners[event] = []);\n listeners.push({ listener, once: true });\n this.checkMaxListeners(event, listeners.length);\n return this;\n }\n\n /**\n * Returns a promise that resolves when the event is emitted\n * @param event - The event name to listen for\n * @returns a promise that resolves to an array of all parameters of the event (empty array for events with no parameters)\n */\n waitOn<Event extends keyof EventListenerTypes>(\n event: Event\n ): Promise<EmittedReturnType<EventListenerTypes, Event>> {\n return new Promise((resolve) => {\n // Create an anonymous function that captures all arguments and passes them to resolve\n const listener = ((...args: any[]) => {\n // Always resolve with the array of arguments (which may be empty)\n resolve(args as any);\n }) as EventListener<EventListenerTypes, Event>;\n\n this.once(event, listener);\n });\n }\n\n /**\n * Emits an event with the specified name and arguments\n * @param event - The event name to emit\n * @param args - Arguments to pass to the event listeners\n */\n public emit<Event extends keyof EventListenerTypes>(\n this: EventEmitter<EventListenerTypes>,\n event: Event,\n ...args: EventParameters<EventListenerTypes, Event>\n ) {\n const listeners: EventListeners<EventListenerTypes, Event> | undefined = this.listeners[event];\n if (listeners) {\n // Snapshot the listener array to avoid issues with concurrent modification\n const snapshot = [...listeners];\n const errors: unknown[] = [];\n for (const { listener } of snapshot) {\n try {\n listener(...args);\n } catch (e) {\n errors.push(e);\n }\n }\n // Remove once listeners we just called\n this.listeners[event] = listeners.filter((l) => !l.once);\n if (this.maxListeners > 0 && (this.listeners[event]?.length ?? 0) <= this.maxListeners) {\n this.warnedEvents.delete(event);\n }\n // Re-throw errors after all listeners have been called\n if (errors.length > 1) {\n throw new AggregateError(\n errors,\n `${errors.length} listener(s) threw on \"${String(event)}\"`\n );\n } else if (errors.length === 1) {\n throw errors[0];\n }\n }\n }\n\n private checkMaxListeners<Event extends keyof EventListenerTypes>(\n event: Event,\n count: number\n ): void {\n if (this.maxListeners > 0 && count > this.maxListeners && !this.warnedEvents.has(event)) {\n this.warnedEvents.add(event);\n console.warn(\n `MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ` +\n `${count} listeners added for event \"${String(event)}\". ` +\n `Use setMaxListeners() to increase limit (current: ${this.maxListeners}).`\n );\n }\n }\n\n /**\n * Subscribes to an event and returns a function to unsubscribe\n * @param event - The event name to subscribe to\n * @param listener - The listener function to add\n * @returns a function to unsubscribe from the event\n */\n public subscribe<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): () => void {\n this.on(event, listener);\n return () => this.off(event, listener);\n }\n}\n",
|
|
13
13
|
"/**\n * @license\n * Copyright 2026 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DataPortSchema } from \"../json-schema/DataPortSchema\";\nimport { createServiceToken } from \"../di/ServiceRegistry\";\n\n/**\n * The kind of interaction being requested.\n *\n * - \"notify\": One-way message, no response expected. Fire-and-forget.\n * - \"display\": Present rich content (markdown, data, visualization hints).\n * Response optional (acknowledgment).\n * - \"elicit\": Request structured input via a form schema (MCP elicitation).\n * Response expected with user-submitted data.\n */\nexport type HumanInteractionKind = \"notify\" | \"display\" | \"elicit\";\n\n/** User action in response to an interaction (MCP-aligned for \"elicit\" kind) */\nexport type HumanResponseAction = \"accept\" | \"decline\" | \"cancel\";\n\n/**\n * A unified request sent to a human via an IHumanConnector.\n *\n * The `kind` field determines the interaction pattern. The `content` schema\n * describes WHAT to render — the UI layer interprets it based on `kind`.\n */\nexport interface IHumanRequest {\n /** Unique identifier for this request (used to correlate responses) */\n readonly requestId: string;\n /** Target human identifier — \"default\" for the main user, or a specific user/role ID */\n readonly targetHumanId: string;\n /** What kind of interaction this is */\n readonly kind: HumanInteractionKind;\n /** Explanatory message shown to the human */\n readonly message: string;\n /**\n * Content schema — describes what to render.\n *\n * For \"notify\": Describes notification content (may be empty, message suffices).\n * For \"display\": Describes the data/visualization to present. Properties contain\n * the actual data to render. Use x-ui-viewer annotations for hints.\n * For \"elicit\": Describes the form fields for user input (MCP requestedSchema).\n */\n readonly contentSchema: DataPortSchema;\n /**\n * Concrete data to display (for \"notify\" and \"display\" kinds).\n * For \"elicit\", this is typically empty — the human provides the data.\n */\n readonly contentData: Record<string, unknown> | undefined;\n /** Whether a response is expected. Default: true for \"elicit\", false for \"notify\"/\"display\". */\n readonly expectsResponse: boolean;\n /** Interaction mode: single request-response or multi-turn conversation */\n readonly mode: \"single\" | \"multi-turn\";\n /** Arbitrary context data passed through to the connector */\n readonly metadata: Record<string, unknown> | undefined;\n}\n\n/**\n * A response from a human, collected by the IHumanConnector.\n * For \"notify\"/\"display\" interactions, this may just be an acknowledgment.\n */\nexport interface IHumanResponse {\n /** Correlates to the IHumanRequest.requestId */\n readonly requestId: string;\n /**\n * The human's action:\n * - \"accept\": user submitted data or acknowledged\n * - \"decline\": user explicitly refused\n * - \"cancel\": user dismissed without choosing\n */\n readonly action: HumanResponseAction;\n /** The human's response data (present when action is \"accept\" and kind is \"elicit\") */\n readonly content: Record<string, unknown> | undefined;\n /** Whether the conversation is complete. Always true for \"single\" mode. */\n readonly done: boolean;\n}\n\n/**\n * Interface for reaching a human and sending interactions.\n *\n * Unified schema-driven: the `kind` field in IHumanRequest determines the\n * interaction pattern. The connector renders accordingly — a notification\n * toast, a data visualization, or an input form.\n */\nexport interface IHumanConnector {\n /**\n * Send an interaction to a human.\n *\n * For \"notify\" and \"display\" kinds that don't expect a response, the\n * connector may resolve immediately with action \"accept\" and no content.\n *\n * For \"elicit\" kind, blocks until the human submits, declines, or cancels.\n * Must respect the AbortSignal for cancellation.\n */\n send(request: IHumanRequest, signal: AbortSignal): Promise<IHumanResponse>;\n\n /**\n * Send a follow-up in a multi-turn conversation.\n * Only called when mode is \"multi-turn\" and the previous response had done=false.\n */\n followUp?(\n request: IHumanRequest,\n previousResponse: IHumanResponse,\n signal: AbortSignal\n ): Promise<IHumanResponse>;\n}\n\n/** Service token for resolving the IHumanConnector from ServiceRegistry */\nexport const HUMAN_CONNECTOR = createServiceToken<IHumanConnector>(\"HUMAN_CONNECTOR\");\n\n/**\n * Resolves the IHumanConnector from the execution context's ServiceRegistry.\n *\n * Throws a plain `Error` (not TaskConfigurationError, to avoid a dependency on\n * @workglow/task-graph). Callers that need a typed error may catch and rewrap.\n */\nexport function resolveHumanConnector(context: {\n readonly registry: {\n has(token: typeof HUMAN_CONNECTOR): boolean;\n get(token: typeof HUMAN_CONNECTOR): IHumanConnector;\n };\n}): IHumanConnector {\n if (!context.registry.has(HUMAN_CONNECTOR)) {\n throw new Error(\n \"HUMAN_CONNECTOR not registered. Register one via \" +\n \"registry.registerInstance(HUMAN_CONNECTOR, connector) before running a human-in-the-loop task.\"\n );\n }\n return context.registry.get(HUMAN_CONNECTOR);\n}\n",
|
|
14
14
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ILogger } from \"./ILogger\";\n\n/**\n * Log-level names in ascending severity order.\n */\nexport type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\";\n\nconst LOG_LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n fatal: 4,\n};\n\nexport interface ConsoleLoggerOptions {\n readonly bindings?: Record<string, unknown>;\n readonly level?: LogLevel;\n readonly timings?: boolean;\n}\n\n/**\n * Logger that delegates to the global `console` object.\n * When created via {@link child}, accumulated bindings are passed\n * as a second argument to every console call.\n *\n * Supports optional level filtering (messages below the configured\n * level are silently discarded) and an opt-in `timings` flag that\n * controls whether {@link time}/{@link timeEnd} produce output.\n */\nexport class ConsoleLogger implements ILogger {\n private readonly bindings: Record<string, unknown>;\n private readonly level: LogLevel;\n private readonly timings: boolean;\n\n constructor(options: ConsoleLoggerOptions = {}) {\n this.bindings = options.bindings ?? {};\n this.level = options.level ?? \"debug\";\n this.timings = options.timings ?? false;\n }\n\n private enabled(level: LogLevel): boolean {\n return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.level];\n }\n\n info(message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"info\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.info(message, merged);\n } else {\n console.info(message);\n }\n }\n\n warn(message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"warn\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.warn(message, merged);\n } else {\n console.warn(message);\n }\n }\n\n error(message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"error\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.error(message, merged);\n } else {\n console.error(message);\n }\n }\n\n debug(message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"debug\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.debug(message, merged);\n } else {\n console.debug(message);\n }\n }\n\n fatal(err: Error, message: string, meta?: Record<string, unknown>): void {\n if (!this.enabled(\"fatal\")) return;\n const merged = this.merge(meta);\n if (merged) {\n console.error(message, { ...merged, error: err });\n } else {\n console.error(message, { error: err });\n }\n }\n\n time(label: string, meta?: Record<string, unknown>): void {\n if (!this.timings) return;\n const merged = this.merge(meta);\n if (merged) {\n console.info(`[time] ${label}`, merged);\n }\n console.time(label);\n }\n\n timeEnd(label: string, meta?: Record<string, unknown>): void {\n if (!this.timings) return;\n console.timeEnd(label);\n const merged = this.merge(meta);\n if (merged) {\n console.info(`[timeEnd] ${label}`, merged);\n }\n }\n\n group(label: string, meta?: Record<string, unknown>): void {\n const merged = this.merge(meta);\n if (merged) {\n console.group(label, merged);\n } else {\n console.group(label);\n }\n }\n\n groupEnd(): void {\n console.groupEnd();\n }\n\n child(bindings: Record<string, unknown>): ILogger {\n return new ConsoleLogger({\n bindings: { ...this.bindings, ...bindings },\n level: this.level,\n timings: this.timings,\n });\n }\n\n private merge(meta: Record<string, unknown> | undefined): Record<string, unknown> | undefined {\n const hasBindings = Object.keys(this.bindings).length > 0;\n if (!hasBindings && !meta) return undefined;\n if (!hasBindings) return meta;\n if (!meta) return this.bindings;\n return { ...this.bindings, ...meta };\n }\n}\n",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpuImage.d.ts","sourceRoot":"","sources":["../../src/media/cpuImage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"cpuImage.d.ts","sourceRoot":"","sources":["../../src/media/cpuImage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,IAAI,SAAS,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQvD,qBAAa,QAAS,YAAW,SAAS;IAGpB,OAAO,CAAC,GAAG;IAF/B,QAAQ,CAAC,OAAO,EAAG,KAAK,CAAU;IAElC,OAAO,eAAmD;IAE1D,IAAI,KAAK,IAAI,MAAM,CAGlB;IACD,IAAI,MAAM,IAAI,MAAM,CAGnB;IACD,IAAI,QAAQ,IAAI,aAAa,CAG5B;IAED,uEAAuE;IACvE,SAAS,IAAI,cAAc,CAG1B;IAED,OAAa,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiBtD;IAED;mDAC+C;IAC/C,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,QAAQ,CAE5C;IAEK,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAsC5D;IAEK,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAKjF;IAED,OAAO,IAAI,IAAI,CAEd;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageRasterCodecRegistry.d.ts","sourceRoot":"","sources":["../../src/media/imageRasterCodecRegistry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxD,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACzE;
|
|
1
|
+
{"version":3,"file":"imageRasterCodecRegistry.d.ts","sourceRoot":"","sources":["../../src/media/imageRasterCodecRegistry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CA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AC9B,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webGpuImage.browser.d.ts","sourceRoot":"","sources":["../../src/media/webGpuImage.browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,IAAI,SAAS,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAED,qBAAa,WAAY,YAAW,SAAS;IAKzC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IACf,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;IAPzB,QAAQ,CAAC,OAAO,EAAG,QAAQ,CAAU;IACrC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAK;IAErC,OAAO,eAKH;IAEJ,OAAa,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAiBzD;IAED,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"webGpuImage.browser.d.ts","sourceRoot":"","sources":["../../src/media/webGpuImage.browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,IAAI,SAAS,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAED,qBAAa,WAAY,YAAW,SAAS;IAKzC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IACf,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;IAPzB,QAAQ,CAAC,OAAO,EAAG,QAAQ,CAAU;IACrC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAK;IAErC,OAAO,eAKH;IAEJ,OAAa,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAiBzD;IAED,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CA8CtC;IAED;gEAC4D;IACtD,qBAAqB,IAAI,OAAO,CAAC,WAAW,CAAC,CA8ClD;IAEK,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAG5D;IAED;;mDAE+C;IACzC,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAShF;IAED,OAAO,IAAI,IAAI,CASd;CACF"}
|
package/dist/media-browser.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import "./media/imageCacheCodec";
|
|
7
7
|
import "./media/imageHydrationResolver";
|
|
8
|
+
import type { EncodeRawPixelsOptions } from "./media/sharpImage.server";
|
|
8
9
|
export * from "./media/color";
|
|
9
10
|
export { CpuImage } from "./media/cpuImage";
|
|
10
11
|
export { rawPixelBufferToBlob, rawPixelBufferToDataUri } from "./media/encode";
|
|
@@ -13,21 +14,21 @@ export type { FilterOpFn } from "./media/filterRegistry";
|
|
|
13
14
|
export { getGpuDevice, resetGpuDeviceForTests } from "./media/gpuDevice.browser";
|
|
14
15
|
export { getGpuImageFactory, GpuImage as GpuImageFactory, registerGpuImageFactory, } from "./media/gpuImage";
|
|
15
16
|
export type { GpuImage, GpuImageBackend, GpuImageEncodeFormat, GpuImageStatic, } from "./media/gpuImage";
|
|
16
|
-
export { ImageValueSchema } from "./media/imageValueSchema";
|
|
17
17
|
export * from "./media/imageRasterCodecRegistry";
|
|
18
18
|
export type { ImageChannels } from "./media/imageTypes";
|
|
19
|
-
export type { RawPixelBuffer, RgbaPixelBuffer } from "./media/rawPixelBuffer";
|
|
20
19
|
export { imageValueFromBitmap, imageValueFromBuffer, isBrowserImageValue, isImageValue, isNodeImageValue, normalizeToImageValue, } from "./media/imageValue";
|
|
21
20
|
export type { BrowserImageValue, ImageValue, ImageValueBase, NodeImageFormat, NodeImageValue, } from "./media/imageValue";
|
|
21
|
+
export { ImageValueSchema } from "./media/imageValueSchema";
|
|
22
22
|
export * from "./media/MediaRawImage";
|
|
23
23
|
export { getPreviewBudget, previewSource, registerPreviewResizeFn, setPreviewBudget, } from "./media/previewBudget";
|
|
24
|
+
export type { RawPixelBuffer, RgbaPixelBuffer } from "./media/rawPixelBuffer";
|
|
24
25
|
export { createShaderCache, getShaderCache, PASSTHROUGH_SHADER_SRC, VERTEX_PRELUDE, } from "./media/shaderRegistry.browser";
|
|
25
26
|
export type { ShaderCache } from "./media/shaderRegistry.browser";
|
|
26
27
|
export { createTexturePool, getTexturePool, resetTexturePoolForTests, } from "./media/texturePool.browser";
|
|
27
28
|
export type { TexturePool, TexturePoolOptions } from "./media/texturePool.browser";
|
|
28
29
|
export { WebGpuImage } from "./media/webGpuImage.browser";
|
|
29
30
|
export type { ApplyParams } from "./media/webGpuImage.browser";
|
|
30
|
-
export declare function probeImageDimensions(): Promise<
|
|
31
|
-
export declare function decodeBufferToRaw(): Promise<
|
|
32
|
-
export declare function encodeRawPixels(): Promise<
|
|
31
|
+
export declare function probeImageDimensions(_: any): Promise<any>;
|
|
32
|
+
export declare function decodeBufferToRaw(_: any): Promise<any>;
|
|
33
|
+
export declare function encodeRawPixels(_: any, _options: EncodeRawPixelsOptions): Promise<any>;
|
|
33
34
|
//# sourceMappingURL=media-browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-browser.d.ts","sourceRoot":"","sources":["../src/media-browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"media-browser.d.ts","sourceRoot":"","sources":["../src/media-browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,yBAAyB,CAAC;AACjC,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGxE,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,4BAA4B,EAC5B,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EACL,kBAAkB,EAClB,QAAQ,IAAI,eAAe,EAC3B,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,QAAQ,EACR,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,cAAc,kCAAkC,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,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