@exactjs/core 0.6.1 → 0.6.3
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/AGENTS.md +12 -14
- package/README.md +6 -8
- package/dist/client/component-contract/continuation-validation.d.ts +5 -0
- package/dist/client/component-contract/continuation-validation.d.ts.map +1 -1
- package/dist/client/component-contract/continuation-validation.js +7 -0
- package/dist/client/component-contract/continuation-validation.js.map +1 -1
- package/dist/client/component-contract/contract-validation.d.ts.map +1 -1
- package/dist/client/component-contract/contract-validation.js +4 -1
- package/dist/client/component-contract/contract-validation.js.map +1 -1
- package/dist/client/component-contracts.d.ts +5 -0
- package/dist/client/component-contracts.d.ts.map +1 -1
- package/dist/client/component-contracts.js.map +1 -1
- package/dist/client/framework/component-contract-validation.d.ts +1 -1
- package/dist/client/framework/component-contract-validation.d.ts.map +1 -1
- package/dist/client/framework/component-contract-validation.js +1 -1
- package/dist/client/framework/component-contract-validation.js.map +1 -1
- package/dist/client/framework/operation-protocol.d.ts +9 -0
- package/dist/client/framework/operation-protocol.d.ts.map +1 -1
- package/dist/client/framework/operation-protocol.js.map +1 -1
- package/dist/client/framework/server-task-helpers.d.ts +1 -0
- package/dist/client/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/client/framework/server-task-helpers.js +1 -0
- package/dist/client/framework/server-task-helpers.js.map +1 -1
- package/dist/client/framework/task-frames.d.ts +2 -1
- package/dist/client/framework/task-frames.d.ts.map +1 -1
- package/dist/client/framework/task-frames.js +1 -0
- package/dist/client/framework/task-frames.js.map +1 -1
- package/dist/client/runtime/tasks.d.ts +1 -0
- package/dist/client/runtime/tasks.d.ts.map +1 -1
- package/dist/client/runtime/tasks.js +1 -0
- package/dist/client/runtime/tasks.js.map +1 -1
- package/dist/client/tasks/contracts.d.ts +2 -0
- package/dist/client/tasks/contracts.d.ts.map +1 -1
- package/dist/client/tasks/contracts.js.map +1 -1
- package/dist/client/tasks/frame-continuation.d.ts +1 -1
- package/dist/client/tasks/frame-continuation.d.ts.map +1 -1
- package/dist/client/tasks/frame-continuation.js +21 -10
- package/dist/client/tasks/frame-continuation.js.map +1 -1
- package/dist/client/tasks/frame-runtime.d.ts +2 -2
- package/dist/client/tasks/frame-runtime.d.ts.map +1 -1
- package/dist/client/tasks/frame-runtime.js +14 -6
- package/dist/client/tasks/frame-runtime.js.map +1 -1
- package/dist/client/tasks/progress-bindings.d.ts +20 -0
- package/dist/client/tasks/progress-bindings.d.ts.map +1 -0
- package/dist/client/tasks/progress-bindings.js +51 -0
- package/dist/client/tasks/progress-bindings.js.map +1 -0
- package/dist/client/tasks/progress-receiver.d.ts +24 -0
- package/dist/client/tasks/progress-receiver.d.ts.map +1 -0
- package/dist/client/tasks/progress-receiver.js +71 -0
- package/dist/client/tasks/progress-receiver.js.map +1 -0
- package/dist/client/tasks/resources.d.ts.map +1 -1
- package/dist/client/tasks/resources.js +6 -3
- package/dist/client/tasks/resources.js.map +1 -1
- package/dist/client/tasks/scheduled-reactions.d.ts.map +1 -1
- package/dist/client/tasks/scheduled-reactions.js +9 -2
- package/dist/client/tasks/scheduled-reactions.js.map +1 -1
- package/dist/component-contract/continuation-validation.d.ts +5 -0
- package/dist/component-contract/continuation-validation.d.ts.map +1 -1
- package/dist/component-contract/continuation-validation.js +7 -0
- package/dist/component-contract/continuation-validation.js.map +1 -1
- package/dist/component-contract/contract-validation.d.ts.map +1 -1
- package/dist/component-contract/contract-validation.js +4 -1
- package/dist/component-contract/contract-validation.js.map +1 -1
- package/dist/component-contracts.d.ts +5 -0
- package/dist/component-contracts.d.ts.map +1 -1
- package/dist/component-contracts.js.map +1 -1
- package/dist/framework/component-contract-validation.d.ts +1 -1
- package/dist/framework/component-contract-validation.d.ts.map +1 -1
- package/dist/framework/component-contract-validation.js +1 -1
- package/dist/framework/component-contract-validation.js.map +1 -1
- package/dist/framework/operation-protocol.d.ts +9 -0
- package/dist/framework/operation-protocol.d.ts.map +1 -1
- package/dist/framework/operation-protocol.js.map +1 -1
- package/dist/framework/server-task-helpers.d.ts +1 -0
- package/dist/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/framework/server-task-helpers.js +1 -0
- package/dist/framework/server-task-helpers.js.map +1 -1
- package/dist/framework/task-frames.d.ts +2 -1
- package/dist/framework/task-frames.d.ts.map +1 -1
- package/dist/framework/task-frames.js +1 -0
- package/dist/framework/task-frames.js.map +1 -1
- package/dist/runtime/tasks.d.ts +1 -0
- package/dist/runtime/tasks.d.ts.map +1 -1
- package/dist/runtime/tasks.js +1 -0
- package/dist/runtime/tasks.js.map +1 -1
- package/dist/server/component-contract/continuation-validation.d.ts +5 -0
- package/dist/server/component-contract/continuation-validation.d.ts.map +1 -1
- package/dist/server/component-contract/continuation-validation.js +7 -0
- package/dist/server/component-contract/continuation-validation.js.map +1 -1
- package/dist/server/component-contract/contract-validation.d.ts.map +1 -1
- package/dist/server/component-contract/contract-validation.js +4 -1
- package/dist/server/component-contract/contract-validation.js.map +1 -1
- package/dist/server/component-contracts.d.ts +5 -0
- package/dist/server/component-contracts.d.ts.map +1 -1
- package/dist/server/component-contracts.js.map +1 -1
- package/dist/server/framework/component-contract-validation.d.ts +1 -1
- package/dist/server/framework/component-contract-validation.d.ts.map +1 -1
- package/dist/server/framework/component-contract-validation.js +1 -1
- package/dist/server/framework/component-contract-validation.js.map +1 -1
- package/dist/server/framework/operation-protocol.d.ts +9 -0
- package/dist/server/framework/operation-protocol.d.ts.map +1 -1
- package/dist/server/framework/operation-protocol.js.map +1 -1
- package/dist/server/framework/server-task-helpers.d.ts +1 -0
- package/dist/server/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/server/framework/server-task-helpers.js +1 -0
- package/dist/server/framework/server-task-helpers.js.map +1 -1
- package/dist/server/framework/task-frames.d.ts +2 -1
- package/dist/server/framework/task-frames.d.ts.map +1 -1
- package/dist/server/framework/task-frames.js +1 -0
- package/dist/server/framework/task-frames.js.map +1 -1
- package/dist/server/runtime/tasks.d.ts +1 -0
- package/dist/server/runtime/tasks.d.ts.map +1 -1
- package/dist/server/runtime/tasks.js +1 -0
- package/dist/server/runtime/tasks.js.map +1 -1
- package/dist/server/tasks/contracts.d.ts +2 -0
- package/dist/server/tasks/contracts.d.ts.map +1 -1
- package/dist/server/tasks/contracts.js.map +1 -1
- package/dist/server/tasks/frame-continuation.d.ts +1 -1
- package/dist/server/tasks/frame-continuation.d.ts.map +1 -1
- package/dist/server/tasks/frame-continuation.js +21 -10
- package/dist/server/tasks/frame-continuation.js.map +1 -1
- package/dist/server/tasks/frame-runtime.d.ts +2 -2
- package/dist/server/tasks/frame-runtime.d.ts.map +1 -1
- package/dist/server/tasks/frame-runtime.js +14 -6
- package/dist/server/tasks/frame-runtime.js.map +1 -1
- package/dist/server/tasks/progress-bindings.d.ts +20 -0
- package/dist/server/tasks/progress-bindings.d.ts.map +1 -0
- package/dist/server/tasks/progress-bindings.js +51 -0
- package/dist/server/tasks/progress-bindings.js.map +1 -0
- package/dist/server/tasks/progress-receiver.d.ts +24 -0
- package/dist/server/tasks/progress-receiver.d.ts.map +1 -0
- package/dist/server/tasks/progress-receiver.js +71 -0
- package/dist/server/tasks/progress-receiver.js.map +1 -0
- package/dist/server/tasks/resources.d.ts.map +1 -1
- package/dist/server/tasks/resources.js +6 -3
- package/dist/server/tasks/resources.js.map +1 -1
- package/dist/server/tasks/scheduled-reactions.d.ts.map +1 -1
- package/dist/server/tasks/scheduled-reactions.js +9 -2
- package/dist/server/tasks/scheduled-reactions.js.map +1 -1
- package/dist/tasks/contracts.d.ts +2 -0
- package/dist/tasks/contracts.d.ts.map +1 -1
- package/dist/tasks/contracts.js.map +1 -1
- package/dist/tasks/frame-continuation.d.ts +1 -1
- package/dist/tasks/frame-continuation.d.ts.map +1 -1
- package/dist/tasks/frame-continuation.js +21 -10
- package/dist/tasks/frame-continuation.js.map +1 -1
- package/dist/tasks/frame-runtime.d.ts +2 -2
- package/dist/tasks/frame-runtime.d.ts.map +1 -1
- package/dist/tasks/frame-runtime.js +14 -6
- package/dist/tasks/frame-runtime.js.map +1 -1
- package/dist/tasks/progress-bindings.d.ts +20 -0
- package/dist/tasks/progress-bindings.d.ts.map +1 -0
- package/dist/tasks/progress-bindings.js +51 -0
- package/dist/tasks/progress-bindings.js.map +1 -0
- package/dist/tasks/progress-receiver.d.ts +24 -0
- package/dist/tasks/progress-receiver.d.ts.map +1 -0
- package/dist/tasks/progress-receiver.js +71 -0
- package/dist/tasks/progress-receiver.js.map +1 -0
- package/dist/tasks/resources.d.ts.map +1 -1
- package/dist/tasks/resources.js +6 -3
- package/dist/tasks/resources.js.map +1 -1
- package/dist/tasks/scheduled-reactions.d.ts.map +1 -1
- package/dist/tasks/scheduled-reactions.js +9 -2
- package/dist/tasks/scheduled-reactions.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/component/error-boundary.js.map +0 -1
- package/dist/server/component/error-boundary.js.map +0 -1
|
@@ -156,4 +156,5 @@ function rejectedTaskFrameExecution(error) {
|
|
|
156
156
|
export function runWithTaskFrame(frame, work) {
|
|
157
157
|
return withTaskFrameRecord(frame, work);
|
|
158
158
|
}
|
|
159
|
+
export { attachTaskProgressReporter, taskProgressReceiverForHost } from '../tasks/progress-bindings.js';
|
|
159
160
|
//# sourceMappingURL=task-frames.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-frames.js","sourceRoot":"","sources":["../../../src/framework/task-frames.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACN,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EAEnB,MAAM,2BAA2B,CAAC;AA2DnC,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB;IAC/B,OAAO,sBAAsB,EAAgC,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC3B,OAA4B,EAC5B,KAA2B;IAE3B,OAAO,wBAAwB,CAAC,OAAO,EAAE,KAAK,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AS,0BAA0B,CAAI,KAAc;IACpD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,OAAO,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAI,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AACvE,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,gBAAgB,CAAI,KAAqB,EAAE,IAAa;IACvE,OAAO,mBAAmB,CAAC,KAAmC,EAAE,IAAI,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import type { TaskContext } from '../tasks/contracts.js';\nimport { TaskCancellation } from '../tasks/cancellation.js';\nimport {\n\tattachTaskFrameSettlement,\n\tcurrentTaskFrameRecord,\n\texecuteTaskFrame,\n\twithTaskFrameRecord,\n\ttype TaskFrameRecord\n} from '../tasks/frame-runtime.js';\n\ndeclare const taskFrameTokenBrand: unique symbol;\n\n/** Opaque authority identifying a live task frame. */\nexport interface TaskFrameToken {\n\treadonly [taskFrameTokenBrand]: true;\n}\n\n/** Framework-owned child frame policy. */\nexport interface RunTaskFrameOptions {\n\treadonly parent?: TaskFrameToken;\n\treadonly kind: string;\n\treadonly label?: string;\n\treadonly generation?: number;\n\treadonly detached?: boolean;\n\treadonly priority?: 'immediate' | 'normal' | 'deferred';\n\treadonly readiness?: 'blocking' | 'nonblocking';\n}\n\n/** Terminal structural outcome reported to framework coordinators. */\nexport type TaskFrameOutcome<T> =\n\t| { readonly status: 'fulfilled'; readonly value: T }\n\t| { readonly status: 'rejected'; readonly error: unknown }\n\t| { readonly status: 'cancelled'; readonly reason: unknown };\n\n/** Foreground readiness outcome reported exactly once. */\nexport type TaskForegroundOutcome =\n\t| { readonly status: 'ready' }\n\t| { readonly status: 'rejected'; readonly error: unknown }\n\t| { readonly status: 'cancelled'; readonly reason: unknown };\n\n/**\n * Structurally settled framework work with cooperative cancellation.\n *\n * Cancelling aborts the frame and every attached descendant. The promise does\n * not settle until foreground work, descendants, and cleanup have responded.\n */\nexport interface TaskFrameExecution<T> extends Promise<T> {\n\t/** Signal inherited by the frame's context and attached descendants. */\n\treadonly signal: AbortSignal;\n\n\t/** Requests cooperative cancellation while preserving structural settlement. */\n\tcancel(reason?: unknown): void;\n}\n\n/** Work and settlement hooks for a framework-created task frame. */\nexport interface RunTaskFrameHooks<T> {\n\twork(context: TaskContext): T | Promise<T>;\n\tafterForeground?(outcome: TaskForegroundOutcome): void | Promise<void>;\n\tafterChildren?(outcome: TaskFrameOutcome<T>): void | Promise<void>;\n}\n\n/** Atomically reserved frame that must be run or released exactly once. */\nexport interface TaskFrameReservation extends Disposable {\n\trun<T>(work: (context: TaskContext) => T | Promise<T>): TaskFrameExecution<T>;\n\tcancel(reason?: unknown): void;\n}\n\n/** Captures the synchronously active opaque task frame. */\nexport function captureTaskFrame(): TaskFrameToken | undefined {\n\treturn currentTaskFrameRecord() as TaskFrameToken | undefined;\n}\n\n/**\n * Runs framework work in a structurally attached, cooperatively cancelable\n * task frame.\n */\nexport function runTaskFrame<T>(\n\toptions: RunTaskFrameOptions,\n\thooks: RunTaskFrameHooks<T>\n): TaskFrameExecution<T> {\n\treturn createTaskFrameExecution(options, hooks, false);\n}\n\n/** Creates the cancelable public execution around one internal frame. */\nfunction createTaskFrameExecution<T>(\n\toptions: RunTaskFrameOptions,\n\thooks: RunTaskFrameHooks<T>,\n\tparentReserved: boolean\n): TaskFrameExecution<T> {\n\tconst controller = new AbortController();\n\tconst execution = runTaskFrameInternal(options, hooks, parentReserved, controller);\n\tconst parent = options.detached\n\t\t? undefined\n\t\t: ((options.parent as TaskFrameRecord | undefined) ?? currentTaskFrameRecord());\n\tif (parent && !parentReserved && parent.producerOpen && !parent.settled)\n\t\tattachTaskFrameSettlement(parent, execution);\n\treturn exposeTaskFrameExecution(execution, controller);\n}\n\n/** Adds framework cancellation authority to a native settlement promise. */\nfunction exposeTaskFrameExecution<T>(\n\texecution: Promise<T>,\n\tcontroller: AbortController\n): TaskFrameExecution<T> {\n\tlet settled = false;\n\tvoid execution.then(\n\t\t() => {\n\t\t\tsettled = true;\n\t\t},\n\t\t() => {\n\t\t\tsettled = true;\n\t\t}\n\t);\n\treturn Object.defineProperties(execution, {\n\t\tsignal: {\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\tvalue: controller.signal,\n\t\t\twritable: false\n\t\t},\n\t\tcancel: {\n\t\t\tconfigurable: false,\n\t\t\tenumerable: false,\n\t\t\tvalue(reason?: unknown) {\n\t\t\t\tif (!settled) controller.abort(reason);\n\t\t\t},\n\t\t\twritable: false\n\t\t}\n\t}) as TaskFrameExecution<T>;\n}\n\nasync function runTaskFrameInternal<T>(\n\toptions: RunTaskFrameOptions,\n\thooks: RunTaskFrameHooks<T>,\n\tparentReserved: boolean,\n\tcontroller: AbortController\n): Promise<T> {\n\tlet foregroundReported = false;\n\tlet childrenReported = false;\n\ttry {\n\t\tconst value = await executeTaskFrame(\n\t\t\t{\n\t\t\t\tparent: options.parent as TaskFrameRecord | undefined,\n\t\t\t\tparentReserved,\n\t\t\t\tcontroller,\n\t\t\t\tgeneration: options.generation,\n\t\t\t\tdetached: options.detached,\n\t\t\t\tkind: options.kind,\n\t\t\t\tlabel: options.label,\n\t\t\t\tpriority: options.priority,\n\t\t\t\treadiness: options.readiness\n\t\t\t},\n\t\t\tasync (context) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await hooks.work(context);\n\t\t\t\t\tforegroundReported = true;\n\t\t\t\t\tawait hooks.afterForeground?.({ status: 'ready' });\n\t\t\t\t\treturn result;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!foregroundReported) {\n\t\t\t\t\t\tforegroundReported = true;\n\t\t\t\t\t\tawait hooks.afterForeground?.(foregroundOutcome(controller.signal, error));\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tchildrenReported = true;\n\t\tawait hooks.afterChildren?.({ status: 'fulfilled', value });\n\t\treturn value;\n\t} catch (error) {\n\t\tif (!foregroundReported) {\n\t\t\tforegroundReported = true;\n\t\t\tawait hooks.afterForeground?.(foregroundOutcome(controller.signal, error));\n\t\t}\n\t\tif (!childrenReported) {\n\t\t\tchildrenReported = true;\n\t\t\tawait hooks.afterChildren?.(structuralOutcome(controller.signal, error));\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/** Classifies foreground failure using the frame's cancellation authority. */\nfunction foregroundOutcome(signal: AbortSignal, error: unknown): TaskForegroundOutcome {\n\treturn signal.aborted || error instanceof TaskCancellation\n\t\t? { status: 'cancelled', reason: cancellationReason(signal, error) }\n\t\t: { status: 'rejected', error };\n}\n\n/** Classifies structural failure using the frame's cancellation authority. */\nfunction structuralOutcome<T>(signal: AbortSignal, error: unknown): TaskFrameOutcome<T> {\n\treturn error instanceof TaskCancellation\n\t\t? { status: 'cancelled', reason: cancellationReason(signal, error) }\n\t\t: { status: 'rejected', error };\n}\n\n/** Preserves the originating abort reason after runtime cancellation wrapping. */\nfunction cancellationReason(signal: AbortSignal, error: unknown): unknown {\n\tif (error instanceof TaskCancellation) return error.reason;\n\treturn signal.aborted ? signal.reason : error;\n}\n\n/** Reserves an attached child before handing work to an external scheduler. */\nexport function reserveTaskFrame(options: RunTaskFrameOptions): TaskFrameReservation {\n\tconst parent = (options.parent as TaskFrameRecord | undefined) ?? currentTaskFrameRecord();\n\tif (!parent) throw new Error('A task frame reservation requires an active or explicit parent');\n\tlet used = false;\n\tlet release!: () => void;\n\tconst placeholder = new Promise<void>((resolve) => {\n\t\trelease = resolve;\n\t});\n\tattachTaskFrameSettlement(parent, placeholder);\n\treturn {\n\t\trun<T>(work: (context: TaskContext) => T | Promise<T>): TaskFrameExecution<T> {\n\t\t\tif (used)\n\t\t\t\treturn rejectedTaskFrameExecution(new Error('Task frame reservation was already released'));\n\t\t\tused = true;\n\t\t\tconst execution = createTaskFrameExecution(\n\t\t\t\t{ ...options, parent: parent as unknown as TaskFrameToken },\n\t\t\t\t{ work },\n\t\t\t\ttrue\n\t\t\t);\n\t\t\t// Keep the atomic placeholder until the public execution, including\n\t\t\t// its structural finalizer, has settled.\n\t\t\tvoid execution.then(release, release);\n\t\t\treturn execution;\n\t\t},\n\t\tcancel() {\n\t\t\tif (used) return;\n\t\t\tused = true;\n\t\t\trelease();\n\t\t},\n\t\t[Symbol.dispose]() {\n\t\t\tif (used) return;\n\t\t\tused = true;\n\t\t\trelease();\n\t\t}\n\t};\n}\n\n/** Creates a settled execution for invalid reservation reuse. */\nfunction rejectedTaskFrameExecution<T>(error: unknown): TaskFrameExecution<T> {\n\tconst controller = new AbortController();\n\treturn exposeTaskFrameExecution(Promise.reject<T>(error), controller);\n}\n\n/** Restores a captured frame for one synchronous callback segment. */\nexport function runWithTaskFrame<T>(frame: TaskFrameToken, work: () => T): T {\n\treturn withTaskFrameRecord(frame as unknown as TaskFrameRecord, work);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"task-frames.js","sourceRoot":"","sources":["../../../src/framework/task-frames.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACN,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EAEnB,MAAM,2BAA2B,CAAC;AA2DnC,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB;IAC/B,OAAO,sBAAsB,EAAgC,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC3B,OAA4B,EAC5B,KAA2B;IAE3B,OAAO,wBAAwB,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,yEAAyE;AACzE,SAAS,wBAAwB,CAChC,OAA4B,EAC5B,KAA2B,EAC3B,cAAuB;IAEvB,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IACnF,MAAM,MAAM,GAAG,OAAO,CA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,CAAC;AACvE,CAAC;AAED,OAAO,EACN,0BAA0B,EAC1B,2BAA2B,EAC3B,MAAM,+BAA+B,CAAC","sourcesContent":["import type { TaskContext } from '../tasks/contracts.js';\nimport { TaskCancellation } from '../tasks/cancellation.js';\nimport {\n\tattachTaskFrameSettlement,\n\tcurrentTaskFrameRecord,\n\texecuteTaskFrame,\n\twithTaskFrameRecord,\n\ttype TaskFrameRecord\n} from '../tasks/frame-runtime.js';\n\ndeclare const taskFrameTokenBrand: unique symbol;\n\n/** Opaque authority identifying a live task frame. */\nexport interface TaskFrameToken {\n\treadonly [taskFrameTokenBrand]: true;\n}\n\n/** Framework-owned child frame policy. */\nexport interface RunTaskFrameOptions {\n\treadonly parent?: TaskFrameToken;\n\treadonly kind: string;\n\treadonly label?: string;\n\treadonly generation?: number;\n\treadonly detached?: boolean;\n\treadonly priority?: 'immediate' | 'normal' | 'deferred';\n\treadonly readiness?: 'blocking' | 'nonblocking';\n}\n\n/** Terminal structural outcome reported to framework coordinators. */\nexport type TaskFrameOutcome<T> =\n\t| { readonly status: 'fulfilled'; readonly value: T }\n\t| { readonly status: 'rejected'; readonly error: unknown }\n\t| { readonly status: 'cancelled'; readonly reason: unknown };\n\n/** Foreground readiness outcome reported exactly once. */\nexport type TaskForegroundOutcome =\n\t| { readonly status: 'ready' }\n\t| { readonly status: 'rejected'; readonly error: unknown }\n\t| { readonly status: 'cancelled'; readonly reason: unknown };\n\n/**\n * Structurally settled framework work with cooperative cancellation.\n *\n * Cancelling aborts the frame and every attached descendant. The promise does\n * not settle until foreground work, descendants, and cleanup have responded.\n */\nexport interface TaskFrameExecution<T> extends Promise<T> {\n\t/** Signal inherited by the frame's context and attached descendants. */\n\treadonly signal: AbortSignal;\n\n\t/** Requests cooperative cancellation while preserving structural settlement. */\n\tcancel(reason?: unknown): void;\n}\n\n/** Work and settlement hooks for a framework-created task frame. */\nexport interface RunTaskFrameHooks<T> {\n\twork(context: TaskContext): T | Promise<T>;\n\tafterForeground?(outcome: TaskForegroundOutcome): void | Promise<void>;\n\tafterChildren?(outcome: TaskFrameOutcome<T>): void | Promise<void>;\n}\n\n/** Atomically reserved frame that must be run or released exactly once. */\nexport interface TaskFrameReservation extends Disposable {\n\trun<T>(work: (context: TaskContext) => T | Promise<T>): TaskFrameExecution<T>;\n\tcancel(reason?: unknown): void;\n}\n\n/** Captures the synchronously active opaque task frame. */\nexport function captureTaskFrame(): TaskFrameToken | undefined {\n\treturn currentTaskFrameRecord() as TaskFrameToken | undefined;\n}\n\n/**\n * Runs framework work in a structurally attached, cooperatively cancelable\n * task frame.\n */\nexport function runTaskFrame<T>(\n\toptions: RunTaskFrameOptions,\n\thooks: RunTaskFrameHooks<T>\n): TaskFrameExecution<T> {\n\treturn createTaskFrameExecution(options, hooks, false);\n}\n\n/** Creates the cancelable public execution around one internal frame. */\nfunction createTaskFrameExecution<T>(\n\toptions: RunTaskFrameOptions,\n\thooks: RunTaskFrameHooks<T>,\n\tparentReserved: boolean\n): TaskFrameExecution<T> {\n\tconst controller = new AbortController();\n\tconst execution = runTaskFrameInternal(options, hooks, parentReserved, controller);\n\tconst parent = options.detached\n\t\t? undefined\n\t\t: ((options.parent as TaskFrameRecord | undefined) ?? currentTaskFrameRecord());\n\tif (parent && !parentReserved && parent.producerOpen && !parent.settled)\n\t\tattachTaskFrameSettlement(parent, execution);\n\treturn exposeTaskFrameExecution(execution, controller);\n}\n\n/** Adds framework cancellation authority to a native settlement promise. */\nfunction exposeTaskFrameExecution<T>(\n\texecution: Promise<T>,\n\tcontroller: AbortController\n): TaskFrameExecution<T> {\n\tlet settled = false;\n\tvoid execution.then(\n\t\t() => {\n\t\t\tsettled = true;\n\t\t},\n\t\t() => {\n\t\t\tsettled = true;\n\t\t}\n\t);\n\treturn Object.defineProperties(execution, {\n\t\tsignal: {\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\tvalue: controller.signal,\n\t\t\twritable: false\n\t\t},\n\t\tcancel: {\n\t\t\tconfigurable: false,\n\t\t\tenumerable: false,\n\t\t\tvalue(reason?: unknown) {\n\t\t\t\tif (!settled) controller.abort(reason);\n\t\t\t},\n\t\t\twritable: false\n\t\t}\n\t}) as TaskFrameExecution<T>;\n}\n\nasync function runTaskFrameInternal<T>(\n\toptions: RunTaskFrameOptions,\n\thooks: RunTaskFrameHooks<T>,\n\tparentReserved: boolean,\n\tcontroller: AbortController\n): Promise<T> {\n\tlet foregroundReported = false;\n\tlet childrenReported = false;\n\ttry {\n\t\tconst value = await executeTaskFrame(\n\t\t\t{\n\t\t\t\tparent: options.parent as TaskFrameRecord | undefined,\n\t\t\t\tparentReserved,\n\t\t\t\tcontroller,\n\t\t\t\tgeneration: options.generation,\n\t\t\t\tdetached: options.detached,\n\t\t\t\tkind: options.kind,\n\t\t\t\tlabel: options.label,\n\t\t\t\tpriority: options.priority,\n\t\t\t\treadiness: options.readiness\n\t\t\t},\n\t\t\tasync (context) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await hooks.work(context);\n\t\t\t\t\tforegroundReported = true;\n\t\t\t\t\tawait hooks.afterForeground?.({ status: 'ready' });\n\t\t\t\t\treturn result;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!foregroundReported) {\n\t\t\t\t\t\tforegroundReported = true;\n\t\t\t\t\t\tawait hooks.afterForeground?.(foregroundOutcome(controller.signal, error));\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tchildrenReported = true;\n\t\tawait hooks.afterChildren?.({ status: 'fulfilled', value });\n\t\treturn value;\n\t} catch (error) {\n\t\tif (!foregroundReported) {\n\t\t\tforegroundReported = true;\n\t\t\tawait hooks.afterForeground?.(foregroundOutcome(controller.signal, error));\n\t\t}\n\t\tif (!childrenReported) {\n\t\t\tchildrenReported = true;\n\t\t\tawait hooks.afterChildren?.(structuralOutcome(controller.signal, error));\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/** Classifies foreground failure using the frame's cancellation authority. */\nfunction foregroundOutcome(signal: AbortSignal, error: unknown): TaskForegroundOutcome {\n\treturn signal.aborted || error instanceof TaskCancellation\n\t\t? { status: 'cancelled', reason: cancellationReason(signal, error) }\n\t\t: { status: 'rejected', error };\n}\n\n/** Classifies structural failure using the frame's cancellation authority. */\nfunction structuralOutcome<T>(signal: AbortSignal, error: unknown): TaskFrameOutcome<T> {\n\treturn error instanceof TaskCancellation\n\t\t? { status: 'cancelled', reason: cancellationReason(signal, error) }\n\t\t: { status: 'rejected', error };\n}\n\n/** Preserves the originating abort reason after runtime cancellation wrapping. */\nfunction cancellationReason(signal: AbortSignal, error: unknown): unknown {\n\tif (error instanceof TaskCancellation) return error.reason;\n\treturn signal.aborted ? signal.reason : error;\n}\n\n/** Reserves an attached child before handing work to an external scheduler. */\nexport function reserveTaskFrame(options: RunTaskFrameOptions): TaskFrameReservation {\n\tconst parent = (options.parent as TaskFrameRecord | undefined) ?? currentTaskFrameRecord();\n\tif (!parent) throw new Error('A task frame reservation requires an active or explicit parent');\n\tlet used = false;\n\tlet release!: () => void;\n\tconst placeholder = new Promise<void>((resolve) => {\n\t\trelease = resolve;\n\t});\n\tattachTaskFrameSettlement(parent, placeholder);\n\treturn {\n\t\trun<T>(work: (context: TaskContext) => T | Promise<T>): TaskFrameExecution<T> {\n\t\t\tif (used)\n\t\t\t\treturn rejectedTaskFrameExecution(new Error('Task frame reservation was already released'));\n\t\t\tused = true;\n\t\t\tconst execution = createTaskFrameExecution(\n\t\t\t\t{ ...options, parent: parent as unknown as TaskFrameToken },\n\t\t\t\t{ work },\n\t\t\t\ttrue\n\t\t\t);\n\t\t\t// Keep the atomic placeholder until the public execution, including\n\t\t\t// its structural finalizer, has settled.\n\t\t\tvoid execution.then(release, release);\n\t\t\treturn execution;\n\t\t},\n\t\tcancel() {\n\t\t\tif (used) return;\n\t\t\tused = true;\n\t\t\trelease();\n\t\t},\n\t\t[Symbol.dispose]() {\n\t\t\tif (used) return;\n\t\t\tused = true;\n\t\t\trelease();\n\t\t}\n\t};\n}\n\n/** Creates a settled execution for invalid reservation reuse. */\nfunction rejectedTaskFrameExecution<T>(error: unknown): TaskFrameExecution<T> {\n\tconst controller = new AbortController();\n\treturn exposeTaskFrameExecution(Promise.reject<T>(error), controller);\n}\n\n/** Restores a captured frame for one synchronous callback segment. */\nexport function runWithTaskFrame<T>(frame: TaskFrameToken, work: () => T): T {\n\treturn withTaskFrameRecord(frame as unknown as TaskFrameRecord, work);\n}\n\nexport {\n\tattachTaskProgressReporter,\n\ttaskProgressReceiverForHost\n} from '../tasks/progress-bindings.js';\nexport type { TaskProgressReceiver } from '../tasks/progress-receiver.js';\n"]}
|
|
@@ -10,4 +10,5 @@ export { taskMutation } from '../tasks/frame-runtime.js';
|
|
|
10
10
|
export { bindTaskForHost, defineTask, invokeTask } from '../tasks/runtime.js';
|
|
11
11
|
export { mutateTaskCollection, ownTaskResource, stageTaskMutation, taskAnimationFrame, taskAwait, taskFetch, taskIdleCallback, taskInterval, taskObserver, taskTimeout } from '../tasks/resources.js';
|
|
12
12
|
export { combineTaskSignal, withAbortSignal, withTaskSignal } from '../tasks/signals.js';
|
|
13
|
+
export { createTaskProgressReporter, registerTaskProgressReceiver } from '../tasks/progress-bindings.js';
|
|
13
14
|
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/runtime/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,u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,EACZ,WAAW,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,EAC5B,MAAM,+BAA+B,CAAC"}
|
|
@@ -10,4 +10,5 @@ export { taskMutation } from '../tasks/frame-runtime.js';
|
|
|
10
10
|
export { bindTaskForHost, defineTask, invokeTask } from '../tasks/runtime.js';
|
|
11
11
|
export { mutateTaskCollection, ownTaskResource, stageTaskMutation, taskAnimationFrame, taskAwait, taskFetch, taskIdleCallback, taskInterval, taskObserver, taskTimeout } from '../tasks/resources.js';
|
|
12
12
|
export { combineTaskSignal, withAbortSignal, withTaskSignal } from '../tasks/signals.js';
|
|
13
|
+
export { createTaskProgressReporter, registerTaskProgressReceiver } from '../tasks/progress-bindings.js';
|
|
13
14
|
//# sourceMappingURL=tasks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/runtime/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,uCAAuC,EACvC,mCAAmC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["import './component-tasks.js';\n\nexport { registerComponentContinuationContexts } from '../component/context-resumption.js';\nexport { dispatchComponentContinuation } from '../component/domain.js';\nexport { activateTaskForHost } from '../tasks/activation.js';\nexport { activateComputationForHost } from '../tasks/computation-activation.js';\nexport {\n\tcreateIndexedContinuationDependency,\n\tcreateTrackedContinuationDependency\n} from '../tasks/dependency-source.js';\nexport {\n\tactivateCompiledClientLatestTaskForHost,\n\tbindCompiledClientLatestTaskForHost\n} from '../tasks/compiled-latest.js';\nexport { markComponentContinuationTask } from '../tasks/component-continuation.js';\nexport { taskMutation } from '../tasks/frame-runtime.js';\nexport { bindTaskForHost, defineTask, invokeTask } from '../tasks/runtime.js';\nexport {\n\tmutateTaskCollection,\n\townTaskResource,\n\tstageTaskMutation,\n\ttaskAnimationFrame,\n\ttaskAwait,\n\ttaskFetch,\n\ttaskIdleCallback,\n\ttaskInterval,\n\ttaskObserver,\n\ttaskTimeout\n} from '../tasks/resources.js';\nexport { combineTaskSignal, withAbortSignal, withTaskSignal } from '../tasks/signals.js';\n"]}
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/runtime/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,uCAAuC,EACvC,mCAAmC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,EAC5B,MAAM,+BAA+B,CAAC","sourcesContent":["import './component-tasks.js';\n\nexport { registerComponentContinuationContexts } from '../component/context-resumption.js';\nexport { dispatchComponentContinuation } from '../component/domain.js';\nexport { activateTaskForHost } from '../tasks/activation.js';\nexport { activateComputationForHost } from '../tasks/computation-activation.js';\nexport {\n\tcreateIndexedContinuationDependency,\n\tcreateTrackedContinuationDependency\n} from '../tasks/dependency-source.js';\nexport {\n\tactivateCompiledClientLatestTaskForHost,\n\tbindCompiledClientLatestTaskForHost\n} from '../tasks/compiled-latest.js';\nexport { markComponentContinuationTask } from '../tasks/component-continuation.js';\nexport { taskMutation } from '../tasks/frame-runtime.js';\nexport { bindTaskForHost, defineTask, invokeTask } from '../tasks/runtime.js';\nexport {\n\tmutateTaskCollection,\n\townTaskResource,\n\tstageTaskMutation,\n\ttaskAnimationFrame,\n\ttaskAwait,\n\ttaskFetch,\n\ttaskIdleCallback,\n\ttaskInterval,\n\ttaskObserver,\n\ttaskTimeout\n} from '../tasks/resources.js';\nexport { combineTaskSignal, withAbortSignal, withTaskSignal } from '../tasks/signals.js';\n\nexport {\n\tcreateTaskProgressReporter,\n\tregisterTaskProgressReceiver\n} from '../tasks/progress-bindings.js';\n"]}
|
|
@@ -17,6 +17,8 @@ export interface TaskContext {
|
|
|
17
17
|
export interface TaskContextPolicy extends TaskContext {
|
|
18
18
|
client(): TaskContextPolicy;
|
|
19
19
|
server(): TaskContextPolicy;
|
|
20
|
+
/** Declares a missable snapshot receiver for browser-initiated server work. */
|
|
21
|
+
progress(): TaskContextPolicy;
|
|
20
22
|
parallel(): TaskContextPolicy;
|
|
21
23
|
latest(): TaskContextPolicy;
|
|
22
24
|
queue(): TaskContextPolicy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/tasks/contracts.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,cAAc,GACvB,gBAAgB,GAChB,UAAU,GACV,aAAa,GACb,SAAS,GACT,WAAW,CAAC;AAEf,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,UAAU,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACnC,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnD,GAAG,CAAC,CAAC,SAAS,UAAU,GAAG,eAAe,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;CAC5D;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACrD,MAAM,IAAI,iBAAiB,CAAC;IAC5B,MAAM,IAAI,iBAAiB,C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S,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;IACxD,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;IACvD,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACrD;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,SAAS,OAAO,EAAE,CAAC;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,8EAA8E;AAC9E,MAAM,WAAW,oBAAoB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,CAAE,SAAQ,UAAU;IACvF,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/tasks/contracts.ts"],"names":[],"mappings":"","sourcesContent":["/** Describes why a task generation began. */\nexport type TaskActivation =\n\t| 'initialization'\n\t| 'reactive'\n\t| 'interaction'\n\t| 'invoked'\n\t| 'lifecycle';\n\n/** Capabilities scoped to one task frame. */\nexport interface TaskContext {\n\treadonly signal: AbortSignal;\n\treadonly generation: number;\n\treadonly activation: TaskActivation;\n\tpeek<T>(read: () => T): T;\n\toptimistic(work: () => void): void;\n\tcleanup(cleanup: () => void | Promise<void>): void;\n\town<T extends Disposable | AsyncDisposable>(resource: T): T;\n}\n\n/**\n * Declarative task policy accepted only as the default value of a final\n * {@link TaskContext} parameter in compiler-authored source.\n */\nexport interface TaskContextPolicy extends TaskContext {\n\tclient(): TaskContextPolicy;\n\tserver(): TaskContextPolicy;\n\tparallel(): TaskContextPolicy;\n\tlatest(): TaskContextPolicy;\n\tqueue(): TaskContextPolicy;\n\tkey<T>(value: T): TaskContextPolicy;\n\timmediate(): TaskContextPolicy;\n\tnormal(): TaskContextPolicy;\n\tdeferred(): TaskContextPolicy;\n\tblocking(): TaskContextPolicy;\n\tnonblocking(): TaskContextPolicy;\n\tdetached(): TaskContextPolicy;\n}\n\n/** Durable cancellation and concurrency ownership for task generations. */\nexport interface TaskOwner extends AsyncDisposable {\n\treadonly signal: AbortSignal;\n}\n\n/** Owner-bound observable state for one task definition. */\nexport interface TaskStatus<Result> {\n\treadonly pending: boolean;\n\treadonly pendingCount: number;\n\treadonly generation: number;\n\treadonly result: Result | undefined;\n\treadonly error: unknown;\n\tcancel(reason?: unknown): void;\n}\n\n/** A thenable whose result settles only after its attached task subtree. */\nexport interface TaskInvocation<Result> extends PromiseLike<Result> {\n\tthen<TResult1 = Result, TResult2 = never>(\n\t\tonFulfilled?: ((value: Result) => TResult1 | PromiseLike<TResult1>) | null,\n\t\tonRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null\n\t): TaskInvocation<TResult1 | TResult2>;\n\tcatch<TResult = never>(\n\t\tonRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null\n\t): TaskInvocation<Result | TResult>;\n\tfinally(onFinally?: (() => void) | null): TaskInvocation<Result>;\n\treadonly [Symbol.toStringTag]: 'TaskInvocation';\n}\n\n/** Callable runtime task definition. */\nexport interface TaskFunction<Args extends unknown[], Result> {\n\t(...args: Args): TaskInvocation<Result>;\n}\n\n/** Existential task function retained where authored argument tuples are not inspected. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Runtime task registries preserve arbitrary authored argument tuples through callable identity.\nexport type AnyTaskFunction<Result = unknown> = TaskFunction<any[], Result>;\n\n/** Owner-bound task callable with aggregate status. */\nexport interface BoundTaskFunction<Args extends unknown[], Result>\n\textends TaskFunction<Args, Result>,\n\t\tTaskStatus<Result> {}\n\n/** Runtime policy required when an integration defines a task outside compiled component source. */\nexport interface RuntimeTaskOptions<Args extends unknown[]> {\n\treadonly label?: string;\n\treadonly placement?: 'current' | 'client' | 'server';\n\treadonly priority?: 'immediate' | 'normal' | 'deferred';\n\treadonly concurrency?: 'parallel' | 'latest' | 'queue';\n\treadonly concurrencyKey?: (...args: Args) => unknown;\n\t/**\n\t * Compiler-generated resolver for defaulted task parameters. It evaluates\n\t * omitted defaults once per generation without subscribing the task to\n\t * reactive reads performed while resolving them.\n\t */\n\treadonly captureArguments?: (args: unknown[]) => readonly unknown[];\n\treadonly readiness?: 'blocking' | 'nonblocking';\n\treadonly detached?: boolean;\n\treadonly owner?: TaskOwner;\n}\n\n/** Reserved callback that must run or be explicitly released exactly once. */\nexport interface ReservedTaskCallback<Args extends unknown[], Result> extends Disposable {\n\t(...args: Args): Result;\n\tcancel(reason?: unknown): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/tasks/contracts.ts"],"names":[],"mappings":"","sourcesContent":["/** Describes why a task generation began. */\nexport type TaskActivation =\n\t| 'initialization'\n\t| 'reactive'\n\t| 'interaction'\n\t| 'invoked'\n\t| 'lifecycle';\n\n/** Capabilities scoped to one task frame. */\nexport interface TaskContext {\n\treadonly signal: AbortSignal;\n\treadonly generation: number;\n\treadonly activation: TaskActivation;\n\tpeek<T>(read: () => T): T;\n\toptimistic(work: () => void): void;\n\tcleanup(cleanup: () => void | Promise<void>): void;\n\town<T extends Disposable | AsyncDisposable>(resource: T): T;\n}\n\n/**\n * Declarative task policy accepted only as the default value of a final\n * {@link TaskContext} parameter in compiler-authored source.\n */\nexport interface TaskContextPolicy extends TaskContext {\n\tclient(): TaskContextPolicy;\n\tserver(): TaskContextPolicy;\n\t/** Declares a missable snapshot receiver for browser-initiated server work. */\n\tprogress(): TaskContextPolicy;\n\tparallel(): TaskContextPolicy;\n\tlatest(): TaskContextPolicy;\n\tqueue(): TaskContextPolicy;\n\tkey<T>(value: T): TaskContextPolicy;\n\timmediate(): TaskContextPolicy;\n\tnormal(): TaskContextPolicy;\n\tdeferred(): TaskContextPolicy;\n\tblocking(): TaskContextPolicy;\n\tnonblocking(): TaskContextPolicy;\n\tdetached(): TaskContextPolicy;\n}\n\n/** Durable cancellation and concurrency ownership for task generations. */\nexport interface TaskOwner extends AsyncDisposable {\n\treadonly signal: AbortSignal;\n}\n\n/** Owner-bound observable state for one task definition. */\nexport interface TaskStatus<Result> {\n\treadonly pending: boolean;\n\treadonly pendingCount: number;\n\treadonly generation: number;\n\treadonly result: Result | undefined;\n\treadonly error: unknown;\n\tcancel(reason?: unknown): void;\n}\n\n/** A thenable whose result settles only after its attached task subtree. */\nexport interface TaskInvocation<Result> extends PromiseLike<Result> {\n\tthen<TResult1 = Result, TResult2 = never>(\n\t\tonFulfilled?: ((value: Result) => TResult1 | PromiseLike<TResult1>) | null,\n\t\tonRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null\n\t): TaskInvocation<TResult1 | TResult2>;\n\tcatch<TResult = never>(\n\t\tonRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null\n\t): TaskInvocation<Result | TResult>;\n\tfinally(onFinally?: (() => void) | null): TaskInvocation<Result>;\n\treadonly [Symbol.toStringTag]: 'TaskInvocation';\n}\n\n/** Callable runtime task definition. */\nexport interface TaskFunction<Args extends unknown[], Result> {\n\t(...args: Args): TaskInvocation<Result>;\n}\n\n/** Existential task function retained where authored argument tuples are not inspected. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Runtime task registries preserve arbitrary authored argument tuples through callable identity.\nexport type AnyTaskFunction<Result = unknown> = TaskFunction<any[], Result>;\n\n/** Owner-bound task callable with aggregate status. */\nexport interface BoundTaskFunction<Args extends unknown[], Result>\n\textends TaskFunction<Args, Result>,\n\t\tTaskStatus<Result> {}\n\n/** Runtime policy required when an integration defines a task outside compiled component source. */\nexport interface RuntimeTaskOptions<Args extends unknown[]> {\n\treadonly label?: string;\n\treadonly placement?: 'current' | 'client' | 'server';\n\treadonly priority?: 'immediate' | 'normal' | 'deferred';\n\treadonly concurrency?: 'parallel' | 'latest' | 'queue';\n\treadonly concurrencyKey?: (...args: Args) => unknown;\n\t/**\n\t * Compiler-generated resolver for defaulted task parameters. It evaluates\n\t * omitted defaults once per generation without subscribing the task to\n\t * reactive reads performed while resolving them.\n\t */\n\treadonly captureArguments?: (args: unknown[]) => readonly unknown[];\n\treadonly readiness?: 'blocking' | 'nonblocking';\n\treadonly detached?: boolean;\n\treadonly owner?: TaskOwner;\n}\n\n/** Reserved callback that must run or be explicitly released exactly once. */\nexport interface ReservedTaskCallback<Args extends unknown[], Result> extends Disposable {\n\t(...args: Args): Result;\n\tcancel(reason?: unknown): void;\n}\n"]}
|
|
@@ -4,5 +4,5 @@ export declare function registerTaskFrameSignal(signal: AbortSignal, frame: Task
|
|
|
4
4
|
/** Releases continuation restoration state when its frame settles. */
|
|
5
5
|
export declare function releaseTaskFrameSignal(signal: AbortSignal): void;
|
|
6
6
|
/** Queues one serialized continuation resumption for the frame owning a task signal. */
|
|
7
|
-
export declare function resumeTaskFrameContinuation(signal: AbortSignal, resume: () => void, enter: (frame: TaskFrameRecord) => () => void): void;
|
|
7
|
+
export declare function resumeTaskFrameContinuation(signal: AbortSignal, resume: () => void, enter: (frame: TaskFrameRecord | undefined) => () => void): void;
|
|
8
8
|
//# sourceMappingURL=frame-continuation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-continuation.d.ts","sourceRoot":"","sources":["../../../src/tasks/frame-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAU5D,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAEzF;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAEhE;AAED,wFAAwF;AACxF,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,IAAI,EAClB,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"frame-continuation.d.ts","sourceRoot":"","sources":["../../../src/tasks/frame-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAU5D,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAEzF;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAEhE;AAED,wFAAwF;AACxF,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,IAAI,EAClB,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,KAAK,MAAM,IAAI,GACvD,IAAI,CAYN"}
|
|
@@ -31,15 +31,26 @@ function runNextTaskResumption() {
|
|
|
31
31
|
resumptionScheduled = false;
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
leave();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
let leave;
|
|
35
|
+
try {
|
|
36
|
+
// Cancellation may settle a frame while an earlier resumption owns the queue.
|
|
37
|
+
// Deliver the pending promise settlement without reviving that frame.
|
|
38
|
+
leave = next.enter(next.frame.settled ? undefined : next.frame);
|
|
39
|
+
next.resume();
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
// Promise resolution queues the authored continuation before the restoration job.
|
|
43
|
+
queueMicrotask(() => {
|
|
44
|
+
try {
|
|
45
|
+
leave?.();
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
if (pendingResumptions.length)
|
|
49
|
+
queueMicrotask(runNextTaskResumption);
|
|
50
|
+
else
|
|
51
|
+
resumptionScheduled = false;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
44
55
|
}
|
|
45
56
|
//# sourceMappingURL=frame-continuation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-continuation.js","sourceRoot":"","sources":["../../../src/tasks/frame-continuation.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,IAAI,OAAO,EAAgC,CAAC;AACnE,MAAM,kBAAkB,GAInB,EAAE,CAAC;AACR,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,uFAAuF;AACvF,MAAM,UAAU,uBAAuB,CAAC,MAAmB,EAAE,KAAsB;IAClF,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,sBAAsB,CAAC,MAAmB;IACzD,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,2BAA2B,CAC1C,MAAmB,EACnB,MAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"frame-continuation.js","sourceRoot":"","sources":["../../../src/tasks/frame-continuation.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,IAAI,OAAO,EAAgC,CAAC;AACnE,MAAM,kBAAkB,GAInB,EAAE,CAAC;AACR,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,uFAAuF;AACvF,MAAM,UAAU,uBAAuB,CAAC,MAAmB,EAAE,KAAsB;IAClF,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,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,CAAC,CAAC;;oBAChE,mBAAmB,GAAG,KAAK,CAAC;YAClC,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC","sourcesContent":["import type { TaskFrameRecord } from './frame-contracts.js';\n\nconst framesBySignal = new WeakMap<AbortSignal, TaskFrameRecord>();\nconst pendingResumptions: Array<{\n\treadonly frame: TaskFrameRecord;\n\treadonly resume: () => void;\n\treadonly enter: (frame: TaskFrameRecord | undefined) => () => void;\n}> = [];\nlet resumptionScheduled = false;\n\n/** Associates a frame signal with the frame restored after compiler-lowered awaits. */\nexport function registerTaskFrameSignal(signal: AbortSignal, frame: TaskFrameRecord): void {\n\tframesBySignal.set(signal, frame);\n}\n\n/** Releases continuation restoration state when its frame settles. */\nexport function releaseTaskFrameSignal(signal: AbortSignal): void {\n\tframesBySignal.delete(signal);\n}\n\n/** Queues one serialized continuation resumption for the frame owning a task signal. */\nexport function resumeTaskFrameContinuation(\n\tsignal: AbortSignal,\n\tresume: () => void,\n\tenter: (frame: TaskFrameRecord | undefined) => () => void\n): void {\n\tconst frame = framesBySignal.get(signal);\n\tif (!frame || frame.settled) {\n\t\tresume();\n\t\treturn;\n\t}\n\tpendingResumptions.push({ frame, resume, enter });\n\tif (resumptionScheduled) return;\n\tresumptionScheduled = true;\n\t// The promise-resolution job is already an asynchronous boundary. Enter the uncontended first\n\t// continuation there and retain the queue only for resolutions that overlap its authored job.\n\trunNextTaskResumption();\n}\n\n/** Serializes restoration so concurrent promise resolutions cannot exchange task ownership. */\nfunction runNextTaskResumption(): void {\n\tconst next = pendingResumptions.shift();\n\tif (!next) {\n\t\tresumptionScheduled = false;\n\t\treturn;\n\t}\n\tlet leave: (() => void) | undefined;\n\ttry {\n\t\t// Cancellation may settle a frame while an earlier resumption owns the queue.\n\t\t// Deliver the pending promise settlement without reviving that frame.\n\t\tleave = next.enter(next.frame.settled ? undefined : next.frame);\n\t\tnext.resume();\n\t} finally {\n\t\t// Promise resolution queues the authored continuation before the restoration job.\n\t\tqueueMicrotask(() => {\n\t\t\ttry {\n\t\t\t\tleave?.();\n\t\t\t} finally {\n\t\t\t\tif (pendingResumptions.length) queueMicrotask(runNextTaskResumption);\n\t\t\t\telse resumptionScheduled = false;\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
|
|
@@ -18,8 +18,8 @@ export declare function withDeferredTaskFrame<T>(materialize: () => TaskFrameRec
|
|
|
18
18
|
export declare function currentTaskOwnerRecord(): TaskOwnerRecord | undefined;
|
|
19
19
|
/** Establishes a durable host owner during component state-machine construction or adapter setup. */
|
|
20
20
|
export declare function withTaskOwnerRecord<T>(owner: TaskOwnerRecord, work: () => T): T;
|
|
21
|
-
/** Runs a synchronous segment with
|
|
22
|
-
export declare function withTaskFrameRecord<T>(frame: TaskFrameRecord, work: () => T): T;
|
|
21
|
+
/** Runs a synchronous segment with the supplied frame, or clears ambient frame ownership. */
|
|
22
|
+
export declare function withTaskFrameRecord<T>(frame: TaskFrameRecord | undefined, work: () => T): T;
|
|
23
23
|
/**
|
|
24
24
|
* Runs work in a frame, then waits for dynamically attached descendants and
|
|
25
25
|
* executes cleanup in last-in-first-out order.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-runtime.d.ts","sourceRoot":"","sources":["../../../src/tasks/frame-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO7D,OAAO,EAA0B,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAajF,OAAO,EAGN,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACX,wBAAwB,EACxB,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,MAAM,sBAAsB,CAAC;AAQ9B,kEAAkE;AAClE,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,eAAe,CAEr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W,CAAC,OAAO,CAAC,GAAG,IAAI,CAG/D;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,MAAM,GAAG,MAAM,CAGxF;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,IAAI,CAW7E;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAgB/B,kFAAkF;AAClF,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -63,18 +63,22 @@ export function withTaskOwnerRecord(owner, work) {
|
|
|
63
63
|
currentOwner = previous;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
/** Runs a synchronous segment with
|
|
66
|
+
/** Runs a synchronous segment with the supplied frame, or clears ambient frame ownership. */
|
|
67
67
|
export function withTaskFrameRecord(frame, work) {
|
|
68
|
-
if (frame
|
|
68
|
+
if (frame?.settled)
|
|
69
69
|
throw new Error('Cannot resume a settled task frame');
|
|
70
70
|
ensureScheduledWorkContextCapture();
|
|
71
71
|
const previous = currentFrame;
|
|
72
|
+
const previousMaterializer = deferredFrameMaterializer;
|
|
72
73
|
currentFrame = frame;
|
|
74
|
+
if (!frame)
|
|
75
|
+
deferredFrameMaterializer = undefined;
|
|
73
76
|
try {
|
|
74
77
|
return work();
|
|
75
78
|
}
|
|
76
79
|
finally {
|
|
77
80
|
currentFrame = previous;
|
|
81
|
+
deferredFrameMaterializer = previousMaterializer;
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
/**
|
|
@@ -88,8 +92,10 @@ export function executeTaskFrame(options, work) {
|
|
|
88
92
|
(!structuralParent.producerOpen || structuralParent.settled))
|
|
89
93
|
return Promise.reject(new Error('Cannot attach work after the parent task producer has closed'));
|
|
90
94
|
const owner = options.owner ?? structuralParent?.owner ?? createTaskOwnerRecord('implicit task invocation');
|
|
91
|
-
if (owner.disposed)
|
|
92
|
-
|
|
95
|
+
if (owner.disposed) {
|
|
96
|
+
options.controller?.abort('task-owner-disposed');
|
|
97
|
+
return Promise.reject(new TaskCancellation(options.controller?.signal.reason ?? 'task-owner-disposed'));
|
|
98
|
+
}
|
|
93
99
|
const controller = options.controller ?? new AbortController();
|
|
94
100
|
// The owner cancels its active frame controllers directly during disposal. Subscribing every
|
|
95
101
|
// frame to its durable signal would retain settled controllers until the owner itself is released.
|
|
@@ -288,12 +294,14 @@ export function taskMutation(signal, mutation) {
|
|
|
288
294
|
/** Restores the owning task frame around one compiler-lowered async continuation. */
|
|
289
295
|
export function resumeTaskFrame(signal, resume) {
|
|
290
296
|
resumeTaskFrameContinuation(signal, resume, (frame) => {
|
|
291
|
-
if (frame.settled)
|
|
292
|
-
throw new Error('Cannot resume a settled task frame');
|
|
293
297
|
const previous = currentFrame;
|
|
298
|
+
const previousMaterializer = deferredFrameMaterializer;
|
|
294
299
|
currentFrame = frame;
|
|
300
|
+
if (!frame)
|
|
301
|
+
deferredFrameMaterializer = undefined;
|
|
295
302
|
return () => {
|
|
296
303
|
currentFrame = previous;
|
|
304
|
+
deferredFrameMaterializer = previousMaterializer;
|
|
297
305
|
};
|
|
298
306
|
});
|
|
299
307
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-runtime.js","sourceRoot":"","sources":["../../../src/tasks/frame-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,8BAA8B,EAE9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,MAAM,kCAAkC,CAAC;AAC1C,O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AAM,EAAE,IAAI,CAAC;QAChD,MAAM,KAAI,CAAC;KACX,CAAC;IACF,2BAA2B,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import {\n\tsetScheduledWorkContextCapture,\n\ttype ScheduledWorkContext\n} from '@exactjs/reactive/framework/runtime';\nimport type { TaskContext, TaskOwner } from './contracts.js';\nimport { raceTaskCancellation, TaskCancellation } from './cancellation.js';\nimport {\n\tregisterTaskFrameSignal,\n\treleaseTaskFrameSignal,\n\tresumeTaskFrameContinuation\n} from './frame-continuation.js';\nimport { createTaskFrameContext, frameForTaskContext } from './frame-context.js';\nimport {\n\tpublishTaskFrameEvent,\n\ttaskFrameInspectionAttached\n} from './frame-inspection-capability.js';\nimport {\n\tregisterTaskFrameSettlement,\n\trunTaskFrameCleanups,\n\tsettleTaskFrameChildren\n} from './frame-settlement.js';\nimport { createLazyTaskOwnerRecord } from './owner-record.js';\nimport { acquireScheduledReactionBatch } from './scheduled-reactions.js';\n\nimport {\n\ttaskFrameTokenBrand,\n\ttaskOwnerBrand,\n\ttype InternalTaskFrameOptions,\n\ttype TaskFrameCleanup,\n\ttype TaskFrameRecord,\n\ttype TaskOwnerRecord\n} from './frame-contracts.js';\nexport type {\n\tInternalTaskFrameOptions,\n\tTaskActivationRegistration,\n\tTaskFrameRecord,\n\tTaskOwnerRecord\n} from './frame-contracts.js';\nlet nextFrameId = 1;\nlet currentFrame: TaskFrameRecord | undefined;\nlet currentOwner: TaskOwnerRecord | undefined;\nlet deferredFrameMaterializer: (() => TaskFrameRecord) | undefined;\nlet scheduledWorkCaptureInstalled = false;\nconst synchronousFrameErrors = new WeakMap<Promise<unknown>, { readonly error: unknown }>();\n\n/** Creates a durable task owner and its cancellation lifetime. */\nexport function createTaskOwnerRecord(label?: string): TaskOwnerRecord {\n\treturn createLazyTaskOwnerRecord(label);\n}\n\n/** Retains setup-owned cleanup until its durable task owner is disposed. */\nexport function registerTaskOwnerCleanup(owner: TaskOwnerRecord, cleanup: TaskFrameCleanup): void {\n\tif (owner.disposed) throw new Error('Task owner has been disposed');\n\towner.ownerCleanups.add(cleanup);\n}\n\n/** Validates and returns the internal representation of a public owner. */\nexport function taskOwnerRecord(owner: TaskOwner): TaskOwnerRecord {\n\tif (!(taskOwnerBrand in owner)) throw new TypeError('Task owner was not created by eXact');\n\treturn owner as TaskOwnerRecord;\n}\n\n/** Returns the frame active for the current synchronous execution segment. */\nexport function currentTaskFrameRecord(): TaskFrameRecord | undefined {\n\treturn currentFrame;\n}\n\n/** Materializes an interaction frame only when synchronous work requests structural ownership. */\nexport function materializeDeferredTaskFrame(): TaskFrameRecord | undefined {\n\treturn deferredFrameMaterializer?.();\n}\n\n/** Installs the lazy structural parent available to task and navigation operations during work. */\nexport function withDeferredTaskFrame<T>(materialize: () => TaskFrameRecord, work: () => T): T {\n\tconst previous = deferredFrameMaterializer;\n\tdeferredFrameMaterializer = materialize;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tdeferredFrameMaterializer = previous;\n\t}\n}\n\n/** Returns the durable owner supplied by the current framework host. */\nexport function currentTaskOwnerRecord(): TaskOwnerRecord | undefined {\n\treturn currentFrame?.owner ?? currentOwner;\n}\n\n/** Establishes a durable host owner during component state-machine construction or adapter setup. */\nexport function withTaskOwnerRecord<T>(owner: TaskOwnerRecord, work: () => T): T {\n\tconst previous = currentOwner;\n\tcurrentOwner = owner;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tcurrentOwner = previous;\n\t}\n}\n\n/** Runs a synchronous segment with one frame as ambient context. */\nexport function withTaskFrameRecord<T>(frame: TaskFrameRecord, work: () => T): T {\n\tif (frame.settled) throw new Error('Cannot resume a settled task frame');\n\tensureScheduledWorkContextCapture();\n\tconst previous = currentFrame;\n\tcurrentFrame = frame;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tcurrentFrame = previous;\n\t}\n}\n\n/**\n * Runs work in a frame, then waits for dynamically attached descendants and\n * executes cleanup in last-in-first-out order.\n */\nexport function executeTaskFrame<T>(\n\toptions: InternalTaskFrameOptions,\n\twork: (context: TaskContext) => T | PromiseLike<T>\n): Promise<T> {\n\tconst structuralParent = options.detached ? undefined : (options.parent ?? currentFrame);\n\tif (\n\t\tstructuralParent &&\n\t\t!options.parentReserved &&\n\t\t(!structuralParent.producerOpen || structuralParent.settled)\n\t)\n\t\treturn Promise.reject(\n\t\t\tnew Error('Cannot attach work after the parent task producer has closed')\n\t\t);\n\tconst owner =\n\t\toptions.owner ?? structuralParent?.owner ?? createTaskOwnerRecord('implicit task invocation');\n\tif (owner.disposed) return Promise.reject(new Error('Task owner has been disposed'));\n\tconst controller = options.controller ?? new AbortController();\n\t// The owner cancels its active frame controllers directly during disposal. Subscribing every\n\t// frame to its durable signal would retain settled controllers until the owner itself is released.\n\tif (structuralParent) linkAbort(structuralParent.controller.signal, controller);\n\n\tlet resolveSettlement!: () => void;\n\tlet rejectSettlement!: (error: unknown) => void;\n\tconst settlement = new Promise<void>((resolve, reject) => {\n\t\tresolveSettlement = resolve;\n\t\trejectSettlement = reject;\n\t});\n\tconst frame: TaskFrameRecord = {\n\t\t[taskFrameTokenBrand]: true as const,\n\t\tid: nextFrameId++,\n\t\towner,\n\t\tparent: structuralParent,\n\t\tcontroller,\n\t\t...(options.label === undefined ? {} : { label: options.label }),\n\t\t...(options.sourceEntityId === undefined ? {} : { sourceEntityId: options.sourceEntityId }),\n\t\tactivation: options.activation ?? 'invoked',\n\t\tgeneration: options.generation ?? 1,\n\t\tplacement: options.placement ?? 'current',\n\t\tconcurrency: options.concurrency ?? 'parallel',\n\t\tpriority: options.priority ?? structuralParent?.priority ?? 'normal',\n\t\treadiness:\n\t\t\toptions.readiness ??\n\t\t\t(options.priority === 'deferred'\n\t\t\t\t? 'nonblocking'\n\t\t\t\t: (structuralParent?.readiness ?? 'blocking')),\n\t\tkind: options.kind ?? 'task',\n\t\tproducerOpen: true,\n\t\tsettled: false,\n\t\tstartedAt: monotonicTimestamp()\n\t};\n\tif (options.publicContext !== false)\n\t\t(frame as { context: TaskContext }).context = createTaskFrameContext(frame, options);\n\tregisterTaskFrameSignal(controller.signal, frame);\n\tregisterTaskFrameSettlement(frame, settlement);\n\towner.frames.add(frame);\n\tconst inspectedAtStart = taskFrameInspectionAttached(frame);\n\tif (inspectedAtStart) {\n\t\tpublishTaskFrameEvent(frame, 'task.frame.enter');\n\t\tpublishTaskFrameEvent(frame, 'task.start', undefined, {\n\t\t\tkind: 'start',\n\t\t\targuments: options.inspectionArguments\n\t\t});\n\t} else uninspectedSynchronousFrames.add(frame);\n\tif (structuralParent) {\n\t\t(structuralParent.children ??= new Set()).add(settlement);\n\t\tvoid settlement\n\t\t\t.finally(() => structuralParent.children?.delete(settlement))\n\t\t\t.catch(() => undefined);\n\t} else {\n\t\t// Root settlement is observed through executeTaskFrame's returned\n\t\t// promise; the internal structural signal has no parent consumer.\n\t\tvoid settlement.catch(() => undefined);\n\t}\n\n\tlet directResult: T | PromiseLike<T>;\n\tlet synchronousError: unknown;\n\ttry {\n\t\tif (controller.signal.aborted) throw new TaskCancellation(controller.signal.reason);\n\t\tdirectResult = withTaskFrameRecord(frame, () => work(frame.context!));\n\t} catch (error) {\n\t\tsynchronousError = error;\n\t\tdirectResult = Promise.reject(error);\n\t} finally {\n\t\tuninspectedSynchronousFrames.delete(frame);\n\t}\n\tconst execution = raceTaskCancellation(controller.signal, directResult);\n\n\tconst result = execution.then(\n\t\tasync (value) => {\n\t\t\tframe.producerOpen = false;\n\t\t\tpublishTaskFrameEvent(frame, 'task.foreground-settle');\n\t\t\tlet structuralError: unknown;\n\t\t\tlet structuralFailed = false;\n\t\t\ttry {\n\t\t\t\tawait settleTaskFrameChildren(frame);\n\t\t\t} catch (error) {\n\t\t\t\tstructuralError = error;\n\t\t\t\tstructuralFailed = true;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait runTaskFrameCleanups(frame);\n\t\t\t} catch (cleanupError) {\n\t\t\t\tif (!structuralFailed) throw cleanupError;\n\t\t\t\tif (structuralError && typeof structuralError === 'object')\n\t\t\t\t\tObject.defineProperty(structuralError, 'suppressed', {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue: [cleanupError]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (controller.signal.aborted) throw new TaskCancellation(controller.signal.reason);\n\t\t\tif (structuralFailed) throw structuralError;\n\t\t\treturn value;\n\t\t},\n\t\tasync (error) => {\n\t\t\tconst outcomeError =\n\t\t\t\tcontroller.signal.aborted && !(error instanceof TaskCancellation)\n\t\t\t\t\t? new TaskCancellation(controller.signal.reason)\n\t\t\t\t\t: error;\n\t\t\tframe.producerOpen = false;\n\t\t\tpublishTaskFrameEvent(frame, 'task.foreground-settle');\n\t\t\tcontroller.abort(error);\n\t\t\tlet childError: unknown;\n\t\t\tlet childFailed = false;\n\t\t\ttry {\n\t\t\t\tawait settleTaskFrameChildren(frame);\n\t\t\t} catch (error) {\n\t\t\t\tchildError = error;\n\t\t\t\tchildFailed = true;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait runTaskFrameCleanups(frame);\n\t\t\t} catch (cleanupError) {\n\t\t\t\tif (outcomeError && typeof outcomeError === 'object')\n\t\t\t\t\tObject.defineProperty(outcomeError, 'suppressed', {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue: [cleanupError]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (outcomeError === undefined && childFailed) throw childError;\n\t\t\tthrow outcomeError;\n\t\t}\n\t);\n\tconst output = result.then(\n\t\t(value) => {\n\t\t\tframe.settled = true;\n\t\t\treleaseTaskFrameSignal(controller.signal);\n\t\t\towner.frames.delete(frame);\n\t\t\tresolveSettlement();\n\t\t\tpublishTaskFrameEvent(frame, 'task.frame.exit');\n\t\t\tpublishTaskFrameEvent(frame, 'task.structural-settle');\n\t\t\tpublishTaskFrameEvent(frame, 'task.settle', undefined, {\n\t\t\t\tkind: 'outcome',\n\t\t\t\tstatus: 'settled',\n\t\t\t\tvalue\n\t\t\t});\n\t\t\treturn value;\n\t\t},\n\t\t(error) => {\n\t\t\tframe.settled = true;\n\t\t\treleaseTaskFrameSignal(controller.signal);\n\t\t\towner.frames.delete(frame);\n\t\t\tif (options.propagateFailure?.() === false) resolveSettlement();\n\t\t\telse rejectSettlement(error);\n\t\t\tpublishTaskFrameEvent(frame, 'task.frame.exit');\n\t\t\tconst cancelled = error instanceof TaskCancellation;\n\t\t\tpublishTaskFrameEvent(frame, cancelled ? 'task.cancel' : 'task.fail', error, {\n\t\t\t\tkind: 'outcome',\n\t\t\t\tstatus: cancelled ? 'cancelled' : 'failed',\n\t\t\t\tvalue: error\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t);\n\tif (synchronousError !== undefined) {\n\t\tsynchronousFrameErrors.set(output, { error: synchronousError });\n\t\t// Callers that preserve a synchronous host contract rethrow this error\n\t\t// immediately. The frame still settles asynchronously to release ownership.\n\t\tvoid output.catch(() => undefined);\n\t}\n\treturn output;\n}\n\n/** Returns an error thrown before a task frame's producer yielded to asynchronous work. */\nexport function taskFrameSynchronousError(\n\texecution: PromiseLike<unknown>\n): { readonly error: unknown } | undefined {\n\treturn execution instanceof Promise ? synchronousFrameErrors.get(execution) : undefined;\n}\n\n/** Adds a structural contribution to a frame before its producer closes. */\nexport function attachTaskFrameSettlement(\n\tframe: TaskFrameRecord,\n\tsettlement: PromiseLike<unknown>\n): void {\n\tif (frame.settled || !frame.producerOpen)\n\t\tthrow new Error('Cannot attach work after the task frame producer has closed');\n\tconst normalized = Promise.resolve(settlement).then(() => undefined);\n\t(frame.children ??= new Set()).add(normalized);\n\tvoid normalized.finally(() => frame.children?.delete(normalized)).catch(() => undefined);\n}\n\n/** Adds structural work to the synchronously active task frame, when present. */\nexport function joinTask(settlement: PromiseLike<unknown>): void {\n\tconst frame = currentTaskFrameRecord() ?? materializeDeferredTaskFrame();\n\tif (frame) attachTaskFrameSettlement(frame, settlement);\n}\n\n/** Publishes a task-owned mutation only while its generation remains current. */\nexport function taskMutation<Result>(signal: AbortSignal, mutation: () => Result): Result {\n\tif (signal.aborted) throw new TaskCancellation(signal.reason);\n\treturn mutation();\n}\n\n/** Restores the owning task frame around one compiler-lowered async continuation. */\nexport function resumeTaskFrame(signal: AbortSignal, resume: () => void): void {\n\tresumeTaskFrameContinuation(signal, resume, (frame) => {\n\t\tif (frame.settled) throw new Error('Cannot resume a settled task frame');\n\t\tconst previous = currentFrame;\n\t\tcurrentFrame = frame;\n\t\treturn () => {\n\t\t\tcurrentFrame = previous;\n\t\t};\n\t});\n}\n\nexport { frameForTaskContext };\nconst interactiveReactionContexts = new WeakMap<TaskFrameRecord, ScheduledWorkContext>();\nconst uninspectedSynchronousFrames = new WeakSet<TaskFrameRecord>();\n\nfunction linkAbort(signal: AbortSignal, target: AbortController): void {\n\tif (signal.aborted) {\n\t\ttarget.abort(signal.reason);\n\t\treturn;\n\t}\n\tsignal.addEventListener('abort', () => target.abort(signal.reason), { once: true });\n}\n\nfunction monotonicTimestamp(): number {\n\treturn globalThis.performance?.now() ?? Date.now();\n}\n\n/** Allocates one process-local frame identity for internal consequence frames. */\nexport function allocateTaskFrameId(): number {\n\treturn nextFrameId++;\n}\n\nfunction ensureScheduledWorkContextCapture(): void {\n\tif (scheduledWorkCaptureInstalled) return;\n\tscheduledWorkCaptureInstalled = true;\n\tsetScheduledWorkContextCapture((priority) => {\n\t\tconst parent = currentTaskFrameRecord();\n\t\tif (!parent || !parent.producerOpen || parent.settled) return undefined;\n\t\tif (priority === 'interactive' && uninspectedSynchronousFrames.has(parent))\n\t\t\treturn interactiveReactionContext(parent);\n\t\treturn acquireScheduledReactionBatch(parent);\n\t});\n}\n\n/** Reuses an open interaction producer for consequences drained inside the same DOM callback. */\nfunction interactiveReactionContext(parent: TaskFrameRecord): ScheduledWorkContext {\n\tlet context = interactiveReactionContexts.get(parent);\n\tif (context) return context;\n\tcontext = {\n\t\trun: (work) => withTaskFrameRecord(parent, work),\n\t\tcancel() {}\n\t};\n\tinteractiveReactionContexts.set(parent, context);\n\treturn context;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"frame-runtime.js","sourceRoot":"","sources":["../../../src/tasks/frame-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,8BAA8B,EAE9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EACN,mBAAmB,EACnB,cAAc,EAKd,MAAM,sBAAsB,CAAC;AAO9B,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,YAAyC,CAAC;AAC9C,IAAI,YAAyC,CAAC;AAC9C,IAAI,yBAA8D,CAAC;AACnE,IAAI,6BAA6B,GAAG,KAAK,CAAC;AAC1C,MAAM,sBAAsB,GAAG,IAAI,OAAO,EAAiD,CAAC;AAE5F,kEAAkE;AAClE,MAAM,UAAU,qBAAqB,CAAC,KAAc;IACnD,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,wBAAwB,CAAC,KAAsB,EAAE,OAAyB;IACzF,IAAI,KAAK,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;I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GAAG,EAAE,CAAC;AACpD,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB;IAClC,OAAO,WAAW,EAAE,CAAC;AACtB,CAAC;AAED,SAAS,iCAAiC;IACzC,IAAI,6BAA6B;QAAE,OAAO;IAC1C,6BAA6B,GAAG,IAAI,CAAC;IACrC,8BAA8B,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,sBAAsB,EAAE,CAAC;QACxC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QACxE,IAAI,QAAQ,KAAK,aAAa,IAAI,4BAA4B,CAAC,GAAG,CAAC,MAAM,CAAC;YACzE,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAC3C,OAAO,6BAA6B,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,SAAS,0BAA0B,CAAC,MAAuB;IAC1D,IAAI,OAAO,GAAG,2BAA2B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,OAAO,GAAG;QACT,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC;QAChD,MAAM,KAAI,CAAC;KACX,CAAC;IACF,2BAA2B,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import {\n\tsetScheduledWorkContextCapture,\n\ttype ScheduledWorkContext\n} from '@exactjs/reactive/framework/runtime';\nimport type { TaskContext, TaskOwner } from './contracts.js';\nimport { raceTaskCancellation, TaskCancellation } from './cancellation.js';\nimport {\n\tregisterTaskFrameSignal,\n\treleaseTaskFrameSignal,\n\tresumeTaskFrameContinuation\n} from './frame-continuation.js';\nimport { createTaskFrameContext, frameForTaskContext } from './frame-context.js';\nimport {\n\tpublishTaskFrameEvent,\n\ttaskFrameInspectionAttached\n} from './frame-inspection-capability.js';\nimport {\n\tregisterTaskFrameSettlement,\n\trunTaskFrameCleanups,\n\tsettleTaskFrameChildren\n} from './frame-settlement.js';\nimport { createLazyTaskOwnerRecord } from './owner-record.js';\nimport { acquireScheduledReactionBatch } from './scheduled-reactions.js';\n\nimport {\n\ttaskFrameTokenBrand,\n\ttaskOwnerBrand,\n\ttype InternalTaskFrameOptions,\n\ttype TaskFrameCleanup,\n\ttype TaskFrameRecord,\n\ttype TaskOwnerRecord\n} from './frame-contracts.js';\nexport type {\n\tInternalTaskFrameOptions,\n\tTaskActivationRegistration,\n\tTaskFrameRecord,\n\tTaskOwnerRecord\n} from './frame-contracts.js';\nlet nextFrameId = 1;\nlet currentFrame: TaskFrameRecord | undefined;\nlet currentOwner: TaskOwnerRecord | undefined;\nlet deferredFrameMaterializer: (() => TaskFrameRecord) | undefined;\nlet scheduledWorkCaptureInstalled = false;\nconst synchronousFrameErrors = new WeakMap<Promise<unknown>, { readonly error: unknown }>();\n\n/** Creates a durable task owner and its cancellation lifetime. */\nexport function createTaskOwnerRecord(label?: string): TaskOwnerRecord {\n\treturn createLazyTaskOwnerRecord(label);\n}\n\n/** Retains setup-owned cleanup until its durable task owner is disposed. */\nexport function registerTaskOwnerCleanup(owner: TaskOwnerRecord, cleanup: TaskFrameCleanup): void {\n\tif (owner.disposed) throw new Error('Task owner has been disposed');\n\towner.ownerCleanups.add(cleanup);\n}\n\n/** Validates and returns the internal representation of a public owner. */\nexport function taskOwnerRecord(owner: TaskOwner): TaskOwnerRecord {\n\tif (!(taskOwnerBrand in owner)) throw new TypeError('Task owner was not created by eXact');\n\treturn owner as TaskOwnerRecord;\n}\n\n/** Returns the frame active for the current synchronous execution segment. */\nexport function currentTaskFrameRecord(): TaskFrameRecord | undefined {\n\treturn currentFrame;\n}\n\n/** Materializes an interaction frame only when synchronous work requests structural ownership. */\nexport function materializeDeferredTaskFrame(): TaskFrameRecord | undefined {\n\treturn deferredFrameMaterializer?.();\n}\n\n/** Installs the lazy structural parent available to task and navigation operations during work. */\nexport function withDeferredTaskFrame<T>(materialize: () => TaskFrameRecord, work: () => T): T {\n\tconst previous = deferredFrameMaterializer;\n\tdeferredFrameMaterializer = materialize;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tdeferredFrameMaterializer = previous;\n\t}\n}\n\n/** Returns the durable owner supplied by the current framework host. */\nexport function currentTaskOwnerRecord(): TaskOwnerRecord | undefined {\n\treturn currentFrame?.owner ?? currentOwner;\n}\n\n/** Establishes a durable host owner during component state-machine construction or adapter setup. */\nexport function withTaskOwnerRecord<T>(owner: TaskOwnerRecord, work: () => T): T {\n\tconst previous = currentOwner;\n\tcurrentOwner = owner;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tcurrentOwner = previous;\n\t}\n}\n\n/** Runs a synchronous segment with the supplied frame, or clears ambient frame ownership. */\nexport function withTaskFrameRecord<T>(frame: TaskFrameRecord | undefined, work: () => T): T {\n\tif (frame?.settled) throw new Error('Cannot resume a settled task frame');\n\tensureScheduledWorkContextCapture();\n\tconst previous = currentFrame;\n\tconst previousMaterializer = deferredFrameMaterializer;\n\tcurrentFrame = frame;\n\tif (!frame) deferredFrameMaterializer = undefined;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tcurrentFrame = previous;\n\t\tdeferredFrameMaterializer = previousMaterializer;\n\t}\n}\n\n/**\n * Runs work in a frame, then waits for dynamically attached descendants and\n * executes cleanup in last-in-first-out order.\n */\nexport function executeTaskFrame<T>(\n\toptions: InternalTaskFrameOptions,\n\twork: (context: TaskContext) => T | PromiseLike<T>\n): Promise<T> {\n\tconst structuralParent = options.detached ? undefined : (options.parent ?? currentFrame);\n\tif (\n\t\tstructuralParent &&\n\t\t!options.parentReserved &&\n\t\t(!structuralParent.producerOpen || structuralParent.settled)\n\t)\n\t\treturn Promise.reject(\n\t\t\tnew Error('Cannot attach work after the parent task producer has closed')\n\t\t);\n\tconst owner =\n\t\toptions.owner ?? structuralParent?.owner ?? createTaskOwnerRecord('implicit task invocation');\n\tif (owner.disposed) {\n\t\toptions.controller?.abort('task-owner-disposed');\n\t\treturn Promise.reject(\n\t\t\tnew TaskCancellation(options.controller?.signal.reason ?? 'task-owner-disposed')\n\t\t);\n\t}\n\tconst controller = options.controller ?? new AbortController();\n\t// The owner cancels its active frame controllers directly during disposal. Subscribing every\n\t// frame to its durable signal would retain settled controllers until the owner itself is released.\n\tif (structuralParent) linkAbort(structuralParent.controller.signal, controller);\n\n\tlet resolveSettlement!: () => void;\n\tlet rejectSettlement!: (error: unknown) => void;\n\tconst settlement = new Promise<void>((resolve, reject) => {\n\t\tresolveSettlement = resolve;\n\t\trejectSettlement = reject;\n\t});\n\tconst frame: TaskFrameRecord = {\n\t\t[taskFrameTokenBrand]: true as const,\n\t\tid: nextFrameId++,\n\t\towner,\n\t\tparent: structuralParent,\n\t\tcontroller,\n\t\t...(options.label === undefined ? {} : { label: options.label }),\n\t\t...(options.sourceEntityId === undefined ? {} : { sourceEntityId: options.sourceEntityId }),\n\t\tactivation: options.activation ?? 'invoked',\n\t\tgeneration: options.generation ?? 1,\n\t\tplacement: options.placement ?? 'current',\n\t\tconcurrency: options.concurrency ?? 'parallel',\n\t\tpriority: options.priority ?? structuralParent?.priority ?? 'normal',\n\t\treadiness:\n\t\t\toptions.readiness ??\n\t\t\t(options.priority === 'deferred'\n\t\t\t\t? 'nonblocking'\n\t\t\t\t: (structuralParent?.readiness ?? 'blocking')),\n\t\tkind: options.kind ?? 'task',\n\t\tproducerOpen: true,\n\t\tsettled: false,\n\t\tstartedAt: monotonicTimestamp()\n\t};\n\tif (options.publicContext !== false)\n\t\t(frame as { context: TaskContext }).context = createTaskFrameContext(frame, options);\n\tregisterTaskFrameSignal(controller.signal, frame);\n\tregisterTaskFrameSettlement(frame, settlement);\n\towner.frames.add(frame);\n\tconst inspectedAtStart = taskFrameInspectionAttached(frame);\n\tif (inspectedAtStart) {\n\t\tpublishTaskFrameEvent(frame, 'task.frame.enter');\n\t\tpublishTaskFrameEvent(frame, 'task.start', undefined, {\n\t\t\tkind: 'start',\n\t\t\targuments: options.inspectionArguments\n\t\t});\n\t} else uninspectedSynchronousFrames.add(frame);\n\tif (structuralParent) {\n\t\t(structuralParent.children ??= new Set()).add(settlement);\n\t\tvoid settlement\n\t\t\t.finally(() => structuralParent.children?.delete(settlement))\n\t\t\t.catch(() => undefined);\n\t} else {\n\t\t// Root settlement is observed through executeTaskFrame's returned\n\t\t// promise; the internal structural signal has no parent consumer.\n\t\tvoid settlement.catch(() => undefined);\n\t}\n\n\tlet directResult: T | PromiseLike<T>;\n\tlet synchronousError: unknown;\n\ttry {\n\t\tif (controller.signal.aborted) throw new TaskCancellation(controller.signal.reason);\n\t\tdirectResult = withTaskFrameRecord(frame, () => work(frame.context!));\n\t} catch (error) {\n\t\tsynchronousError = error;\n\t\tdirectResult = Promise.reject(error);\n\t} finally {\n\t\tuninspectedSynchronousFrames.delete(frame);\n\t}\n\tconst execution = raceTaskCancellation(controller.signal, directResult);\n\n\tconst result = execution.then(\n\t\tasync (value) => {\n\t\t\tframe.producerOpen = false;\n\t\t\tpublishTaskFrameEvent(frame, 'task.foreground-settle');\n\t\t\tlet structuralError: unknown;\n\t\t\tlet structuralFailed = false;\n\t\t\ttry {\n\t\t\t\tawait settleTaskFrameChildren(frame);\n\t\t\t} catch (error) {\n\t\t\t\tstructuralError = error;\n\t\t\t\tstructuralFailed = true;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait runTaskFrameCleanups(frame);\n\t\t\t} catch (cleanupError) {\n\t\t\t\tif (!structuralFailed) throw cleanupError;\n\t\t\t\tif (structuralError && typeof structuralError === 'object')\n\t\t\t\t\tObject.defineProperty(structuralError, 'suppressed', {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue: [cleanupError]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (controller.signal.aborted) throw new TaskCancellation(controller.signal.reason);\n\t\t\tif (structuralFailed) throw structuralError;\n\t\t\treturn value;\n\t\t},\n\t\tasync (error) => {\n\t\t\tconst outcomeError =\n\t\t\t\tcontroller.signal.aborted && !(error instanceof TaskCancellation)\n\t\t\t\t\t? new TaskCancellation(controller.signal.reason)\n\t\t\t\t\t: error;\n\t\t\tframe.producerOpen = false;\n\t\t\tpublishTaskFrameEvent(frame, 'task.foreground-settle');\n\t\t\tcontroller.abort(error);\n\t\t\tlet childError: unknown;\n\t\t\tlet childFailed = false;\n\t\t\ttry {\n\t\t\t\tawait settleTaskFrameChildren(frame);\n\t\t\t} catch (error) {\n\t\t\t\tchildError = error;\n\t\t\t\tchildFailed = true;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait runTaskFrameCleanups(frame);\n\t\t\t} catch (cleanupError) {\n\t\t\t\tif (outcomeError && typeof outcomeError === 'object')\n\t\t\t\t\tObject.defineProperty(outcomeError, 'suppressed', {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue: [cleanupError]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (outcomeError === undefined && childFailed) throw childError;\n\t\t\tthrow outcomeError;\n\t\t}\n\t);\n\tconst output = result.then(\n\t\t(value) => {\n\t\t\tframe.settled = true;\n\t\t\treleaseTaskFrameSignal(controller.signal);\n\t\t\towner.frames.delete(frame);\n\t\t\tresolveSettlement();\n\t\t\tpublishTaskFrameEvent(frame, 'task.frame.exit');\n\t\t\tpublishTaskFrameEvent(frame, 'task.structural-settle');\n\t\t\tpublishTaskFrameEvent(frame, 'task.settle', undefined, {\n\t\t\t\tkind: 'outcome',\n\t\t\t\tstatus: 'settled',\n\t\t\t\tvalue\n\t\t\t});\n\t\t\treturn value;\n\t\t},\n\t\t(error) => {\n\t\t\tframe.settled = true;\n\t\t\treleaseTaskFrameSignal(controller.signal);\n\t\t\towner.frames.delete(frame);\n\t\t\tif (options.propagateFailure?.() === false) resolveSettlement();\n\t\t\telse rejectSettlement(error);\n\t\t\tpublishTaskFrameEvent(frame, 'task.frame.exit');\n\t\t\tconst cancelled = error instanceof TaskCancellation;\n\t\t\tpublishTaskFrameEvent(frame, cancelled ? 'task.cancel' : 'task.fail', error, {\n\t\t\t\tkind: 'outcome',\n\t\t\t\tstatus: cancelled ? 'cancelled' : 'failed',\n\t\t\t\tvalue: error\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t);\n\tif (synchronousError !== undefined) {\n\t\tsynchronousFrameErrors.set(output, { error: synchronousError });\n\t\t// Callers that preserve a synchronous host contract rethrow this error\n\t\t// immediately. The frame still settles asynchronously to release ownership.\n\t\tvoid output.catch(() => undefined);\n\t}\n\treturn output;\n}\n\n/** Returns an error thrown before a task frame's producer yielded to asynchronous work. */\nexport function taskFrameSynchronousError(\n\texecution: PromiseLike<unknown>\n): { readonly error: unknown } | undefined {\n\treturn execution instanceof Promise ? synchronousFrameErrors.get(execution) : undefined;\n}\n\n/** Adds a structural contribution to a frame before its producer closes. */\nexport function attachTaskFrameSettlement(\n\tframe: TaskFrameRecord,\n\tsettlement: PromiseLike<unknown>\n): void {\n\tif (frame.settled || !frame.producerOpen)\n\t\tthrow new Error('Cannot attach work after the task frame producer has closed');\n\tconst normalized = Promise.resolve(settlement).then(() => undefined);\n\t(frame.children ??= new Set()).add(normalized);\n\tvoid normalized.finally(() => frame.children?.delete(normalized)).catch(() => undefined);\n}\n\n/** Adds structural work to the synchronously active task frame, when present. */\nexport function joinTask(settlement: PromiseLike<unknown>): void {\n\tconst frame = currentTaskFrameRecord() ?? materializeDeferredTaskFrame();\n\tif (frame) attachTaskFrameSettlement(frame, settlement);\n}\n\n/** Publishes a task-owned mutation only while its generation remains current. */\nexport function taskMutation<Result>(signal: AbortSignal, mutation: () => Result): Result {\n\tif (signal.aborted) throw new TaskCancellation(signal.reason);\n\treturn mutation();\n}\n\n/** Restores the owning task frame around one compiler-lowered async continuation. */\nexport function resumeTaskFrame(signal: AbortSignal, resume: () => void): void {\n\tresumeTaskFrameContinuation(signal, resume, (frame) => {\n\t\tconst previous = currentFrame;\n\t\tconst previousMaterializer = deferredFrameMaterializer;\n\t\tcurrentFrame = frame;\n\t\tif (!frame) deferredFrameMaterializer = undefined;\n\t\treturn () => {\n\t\t\tcurrentFrame = previous;\n\t\t\tdeferredFrameMaterializer = previousMaterializer;\n\t\t};\n\t});\n}\n\nexport { frameForTaskContext };\nconst interactiveReactionContexts = new WeakMap<TaskFrameRecord, ScheduledWorkContext>();\nconst uninspectedSynchronousFrames = new WeakSet<TaskFrameRecord>();\n\nfunction linkAbort(signal: AbortSignal, target: AbortController): void {\n\tif (signal.aborted) {\n\t\ttarget.abort(signal.reason);\n\t\treturn;\n\t}\n\tsignal.addEventListener('abort', () => target.abort(signal.reason), { once: true });\n}\n\nfunction monotonicTimestamp(): number {\n\treturn globalThis.performance?.now() ?? Date.now();\n}\n\n/** Allocates one process-local frame identity for internal consequence frames. */\nexport function allocateTaskFrameId(): number {\n\treturn nextFrameId++;\n}\n\nfunction ensureScheduledWorkContextCapture(): void {\n\tif (scheduledWorkCaptureInstalled) return;\n\tscheduledWorkCaptureInstalled = true;\n\tsetScheduledWorkContextCapture((priority) => {\n\t\tconst parent = currentTaskFrameRecord();\n\t\tif (!parent || !parent.producerOpen || parent.settled) return undefined;\n\t\tif (priority === 'interactive' && uninspectedSynchronousFrames.has(parent))\n\t\t\treturn interactiveReactionContext(parent);\n\t\treturn acquireScheduledReactionBatch(parent);\n\t});\n}\n\n/** Reuses an open interaction producer for consequences drained inside the same DOM callback. */\nfunction interactiveReactionContext(parent: TaskFrameRecord): ScheduledWorkContext {\n\tlet context = interactiveReactionContexts.get(parent);\n\tif (context) return context;\n\tcontext = {\n\t\trun: (work) => withTaskFrameRecord(parent, work),\n\t\tcancel() {}\n\t};\n\tinteractiveReactionContexts.set(parent, context);\n\treturn context;\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RuntimeTaskOptions, TaskContext } from './contracts.js';
|
|
2
|
+
import type { AnyComponentInstance } from '../component/contracts.js';
|
|
3
|
+
import { type TaskProgressReceiver } from './progress-receiver.js';
|
|
4
|
+
/** Compiler-owned receiver work. Only validated snapshot arguments reach this boundary. */
|
|
5
|
+
export type TaskProgressWork = (snapshot: unknown, task: TaskContext) => void | Promise<void>;
|
|
6
|
+
type ProgressReceiverOptions = Pick<RuntimeTaskOptions<[unknown]>, 'label' | 'priority' | 'readiness'>;
|
|
7
|
+
/** Registers one compiled receiver against its durable component, without activating it. */
|
|
8
|
+
export declare function registerTaskProgressReceiver<Snapshot>(host: object, id: string, work: (snapshot: Snapshot, task: TaskContext) => void | Promise<void>, options: ProgressReceiverOptions): (snapshot: Snapshot) => void;
|
|
9
|
+
/** Binds a server frame to its trusted, invocation-local progress transport. */
|
|
10
|
+
export declare function attachTaskProgressReporter(task: TaskContext, report: (id: string, snapshot: unknown) => void): void;
|
|
11
|
+
/**
|
|
12
|
+
* Captures explicit server progress authority while an executor establishes its lexical tasks.
|
|
13
|
+
* SSR has no transport and therefore creates a no-op. Retained callbacks stop at cancellation
|
|
14
|
+
* or settlement even if application code invokes them after the originating frame has closed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createTaskProgressReporter(id: string, task?: TaskContext): (snapshot: unknown) => void;
|
|
17
|
+
/** Creates an isolated receiver lane for a validated operation and live component instance. */
|
|
18
|
+
export declare function taskProgressReceiverForHost(host: AnyComponentInstance, id: string, signal: AbortSignal): TaskProgressReceiver<unknown>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=progress-bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-bindings.d.ts","sourceRoot":"","sources":["../../../src/tasks/progress-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKtE,OAAO,EAA8B,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE/F,2FAA2F;AAC3F,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9F,KAAK,uBAAuB,GAAG,IAAI,CAClC,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC,EAC7B,OAAO,GAAG,UAAU,GAAG,WAAW,CAClC,CAAC;AAOF,4FAA4F;AAC5F,wBAAgB,4BAA4B,CAAC,QAAQ,EACpD,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACrE,OAAO,EAAE,uBAAuB,GAC9B,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAQ9B;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,GAC7C,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACzC,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE,WAAW,GAChB,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAO7B;AAED,+FAA+F;AAC/F,wBAAgB,2BAA2B,CAC1C,IAAI,EAAE,oBAAoB,EAC1B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,WAAW,GACjB,oBAAoB,CAAC,OAAO,CAAC,CAgB/B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { componentLogMethod } from '../component/log.js';
|
|
2
|
+
import { frameForTaskContext } from './frame-runtime.js';
|
|
3
|
+
import { taskOwnerForHost } from './owner-hosts.js';
|
|
4
|
+
import { createTaskProgressReceiver } from './progress-receiver.js';
|
|
5
|
+
const receivers = new WeakMap();
|
|
6
|
+
const reporters = new WeakMap();
|
|
7
|
+
/** Registers one compiled receiver against its durable component, without activating it. */
|
|
8
|
+
export function registerTaskProgressReceiver(host, id, work, options) {
|
|
9
|
+
let registry = receivers.get(host);
|
|
10
|
+
if (!registry)
|
|
11
|
+
receivers.set(host, (registry = new Map()));
|
|
12
|
+
if (registry.has(id))
|
|
13
|
+
throw new Error(`Duplicate task progress receiver ${id}`);
|
|
14
|
+
registry.set(id, { work: work, options });
|
|
15
|
+
return () => {
|
|
16
|
+
throw new Error('Progress receivers are invoked by server continuation progress');
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Binds a server frame to its trusted, invocation-local progress transport. */
|
|
20
|
+
export function attachTaskProgressReporter(task, report) {
|
|
21
|
+
reporters.set(frameForTaskContext(task), report);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Captures explicit server progress authority while an executor establishes its lexical tasks.
|
|
25
|
+
* SSR has no transport and therefore creates a no-op. Retained callbacks stop at cancellation
|
|
26
|
+
* or settlement even if application code invokes them after the originating frame has closed.
|
|
27
|
+
*/
|
|
28
|
+
export function createTaskProgressReporter(id, task) {
|
|
29
|
+
const ownedFrame = task && frameForTaskContext(task);
|
|
30
|
+
const report = ownedFrame && reporters.get(ownedFrame);
|
|
31
|
+
return (snapshot) => {
|
|
32
|
+
if (ownedFrame && !ownedFrame.settled && !ownedFrame.controller.signal.aborted)
|
|
33
|
+
report?.(id, snapshot);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Creates an isolated receiver lane for a validated operation and live component instance. */
|
|
37
|
+
export function taskProgressReceiverForHost(host, id, signal) {
|
|
38
|
+
const owner = taskOwnerForHost(host);
|
|
39
|
+
const receiver = receivers.get(host)?.get(id);
|
|
40
|
+
if (!owner || !receiver)
|
|
41
|
+
throw new Error(`Unknown component task progress receiver ${id}`);
|
|
42
|
+
return createTaskProgressReceiver({
|
|
43
|
+
owner,
|
|
44
|
+
signal,
|
|
45
|
+
...receiver.options,
|
|
46
|
+
label: receiver.options.label ?? id,
|
|
47
|
+
receive: receiver.work,
|
|
48
|
+
onError: (error) => componentLogMethod(host, 'error')?.(() => ['Task progress receiver failed', error, { receiver: id }])
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=progress-bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-bindings.js","sourceRoot":"","sources":["../../../src/tasks/progress-bindings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAA6B,MAAM,wBAAwB,CAAC;AAS/F,MAAM,SAAS,GAAG,IAAI,OAAO,EAG1B,CAAC;AACJ,MAAM,SAAS,GAAG,IAAI,OAAO,EAA4D,CAAC;AAE1F,4FAA4F;AAC5F,MAAM,UAAU,4BAA4B,CAC3C,IAAY,EACZ,EAAU,EACV,IAAqE,EACrE,OAAgC;IAEhC,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,QAAQ;QAAE,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;IAC3D,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;IAChF,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAwB,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9D,OAAO,GAAG,EAAE;QACX,M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CAClB,kBAAkB,CACjB,IAAI,EACJ,OAAO,CACP,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,+BAA+B,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;KACtE,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { RuntimeTaskOptions, TaskContext } from './contracts.js';\nimport type { AnyComponentInstance } from '../component/contracts.js';\nimport { componentLogMethod } from '../component/log.js';\nimport { frameForTaskContext } from './frame-runtime.js';\nimport type { TaskFrameRecord } from './frame-contracts.js';\nimport { taskOwnerForHost } from './owner-hosts.js';\nimport { createTaskProgressReceiver, type TaskProgressReceiver } from './progress-receiver.js';\n\n/** Compiler-owned receiver work. Only validated snapshot arguments reach this boundary. */\nexport type TaskProgressWork = (snapshot: unknown, task: TaskContext) => void | Promise<void>;\n\ntype ProgressReceiverOptions = Pick<\n\tRuntimeTaskOptions<[unknown]>,\n\t'label' | 'priority' | 'readiness'\n>;\nconst receivers = new WeakMap<\n\tobject,\n\tMap<string, { work: TaskProgressWork; options: ProgressReceiverOptions }>\n>();\nconst reporters = new WeakMap<TaskFrameRecord, (id: string, snapshot: unknown) => void>();\n\n/** Registers one compiled receiver against its durable component, without activating it. */\nexport function registerTaskProgressReceiver<Snapshot>(\n\thost: object,\n\tid: string,\n\twork: (snapshot: Snapshot, task: TaskContext) => void | Promise<void>,\n\toptions: ProgressReceiverOptions\n): (snapshot: Snapshot) => void {\n\tlet registry = receivers.get(host);\n\tif (!registry) receivers.set(host, (registry = new Map()));\n\tif (registry.has(id)) throw new Error(`Duplicate task progress receiver ${id}`);\n\tregistry.set(id, { work: work as TaskProgressWork, options });\n\treturn () => {\n\t\tthrow new Error('Progress receivers are invoked by server continuation progress');\n\t};\n}\n\n/** Binds a server frame to its trusted, invocation-local progress transport. */\nexport function attachTaskProgressReporter(\n\ttask: TaskContext,\n\treport: (id: string, snapshot: unknown) => void\n): void {\n\treporters.set(frameForTaskContext(task), report);\n}\n\n/**\n * Captures explicit server progress authority while an executor establishes its lexical tasks.\n * SSR has no transport and therefore creates a no-op. Retained callbacks stop at cancellation\n * or settlement even if application code invokes them after the originating frame has closed.\n */\nexport function createTaskProgressReporter(\n\tid: string,\n\ttask?: TaskContext\n): (snapshot: unknown) => void {\n\tconst ownedFrame = task && frameForTaskContext(task);\n\tconst report = ownedFrame && reporters.get(ownedFrame);\n\treturn (snapshot) => {\n\t\tif (ownedFrame && !ownedFrame.settled && !ownedFrame.controller.signal.aborted)\n\t\t\treport?.(id, snapshot);\n\t};\n}\n\n/** Creates an isolated receiver lane for a validated operation and live component instance. */\nexport function taskProgressReceiverForHost(\n\thost: AnyComponentInstance,\n\tid: string,\n\tsignal: AbortSignal\n): TaskProgressReceiver<unknown> {\n\tconst owner = taskOwnerForHost(host);\n\tconst receiver = receivers.get(host)?.get(id);\n\tif (!owner || !receiver) throw new Error(`Unknown component task progress receiver ${id}`);\n\treturn createTaskProgressReceiver({\n\t\towner,\n\t\tsignal,\n\t\t...receiver.options,\n\t\tlabel: receiver.options.label ?? id,\n\t\treceive: receiver.work,\n\t\tonError: (error) =>\n\t\t\tcomponentLogMethod(\n\t\t\t\thost,\n\t\t\t\t'error'\n\t\t\t)?.(() => ['Task progress receiver failed', error, { receiver: id }])\n\t});\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TaskContext, TaskOwner } from './contracts.js';
|
|
2
|
+
/** One replaceable observation lane, owned by an originating invocation. */
|
|
3
|
+
export interface TaskProgressReceiver<Snapshot> {
|
|
4
|
+
/** Offers a captured snapshot, replacing any snapshot which has not started. */
|
|
5
|
+
report(snapshot: Snapshot): void;
|
|
6
|
+
/** Fences publication immediately; asynchronous cleanup does not delay the caller. */
|
|
7
|
+
close(reason?: unknown): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Serializes asynchronous progress activations while retaining only the latest pending value.
|
|
11
|
+
* Each activation is an ordinary task with independent staged publication and structural children.
|
|
12
|
+
* It belongs to the durable component owner, but never extends the originating invocation.
|
|
13
|
+
* Callers must capture/validate snapshots before offering them and route errors to diagnostics.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTaskProgressReceiver<Snapshot>(options: {
|
|
16
|
+
readonly owner: TaskOwner;
|
|
17
|
+
readonly signal: AbortSignal;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly priority?: 'immediate' | 'normal' | 'deferred';
|
|
20
|
+
readonly readiness?: 'blocking' | 'nonblocking';
|
|
21
|
+
readonly receive: (snapshot: Snapshot, task: TaskContext) => void | Promise<void>;
|
|
22
|
+
readonly onError: (error: unknown) => void;
|
|
23
|
+
}): TaskProgressReceiver<Snapshot>;
|
|
24
|
+
//# sourceMappingURL=progress-receiver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-receiver.d.ts","sourceRoot":"","sources":["../../../src/tasks/progress-receiver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK7D,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB,CAAC,QAAQ;IAC7C,gFAAgF;IAChF,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACjC,sFAAsF;IACtF,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,EAAE;IAC7D,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;IACxD,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC3C,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAoEjC"}
|