@potential-guide/task-sdk 0.0.0 → 0.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +78 -2
- package/dist/binding.d.ts +7 -0
- package/dist/binding.d.ts.map +1 -0
- package/dist/binding.js +3 -0
- package/dist/binding.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +499 -0
- package/dist/index.js.map +1 -0
- package/package.json +32 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shazhou-ww
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Task SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@potential-guide/task-sdk` provides only the generation-scoped Task Worker
|
|
4
|
+
runtime (`runTask`, `RunFailure`) and callback/context types. Its only runtime
|
|
5
|
+
dependency is `@potential-guide/task-protocol`.
|
|
6
|
+
|
|
7
|
+
Build, artifact validation and publishing belong to
|
|
8
|
+
[pguide task-bundle](../pguide-task-bundle/README.md), not the SDK.
|
|
9
|
+
Use `task.build.yaml`, a TypeBox contract and a typed callback to generate the
|
|
10
|
+
complete self-contained artifact. The SDK has no author-build scripts, tool subpaths
|
|
11
|
+
or author examples; tooling fixtures live with the author CLI.
|
|
12
|
+
|
|
13
|
+
New entries explicitly `import { runTask } from "@potential-guide/task-sdk"`
|
|
14
|
+
and call `runTask(callback)`. The builder binds the verified declaration
|
|
15
|
+
into the SDK, not through author configuration or
|
|
16
|
+
`workerData`. A custom wrapper may delegate to `runTask` without builder
|
|
17
|
+
recognition or configuration changes.
|
|
18
|
+
The Engine validates input and business messages before dispatch, and validates
|
|
19
|
+
checkpoint, complete and RunFailure result evidence before acceptance or storage.
|
|
20
|
+
The Worker trusts those input/message checks; it contains no automatic business
|
|
21
|
+
Schema validator, schema-runtime, projection engine, or Ajv dependency.
|
|
22
|
+
Build-time contract, reference and budget checks remain in the author tools.
|
|
23
|
+
|
|
24
|
+
The Engine also checks JSON shape, nesting/node and byte limits, and log/progress
|
|
25
|
+
payloads. The SDK forwards host-validated input/messages and sends author outputs
|
|
26
|
+
without walking or normalizing their payloads. Queue bounds, generation/Run routing,
|
|
27
|
+
declaration equality, cancellation and resource streams remain in the SDK.
|
|
28
|
+
Startup declaration comparison still uses canonical JSON; it is not business
|
|
29
|
+
payload validation.
|
|
30
|
+
|
|
31
|
+
IPC uses Node's structured clone: sendable non-JSON values (such as cycles,
|
|
32
|
+
BigInt and Date) are rejected by the host. Values that cannot be cloned, such as
|
|
33
|
+
functions, reject locally with `invalid_payload`; failed sends do not consume
|
|
34
|
+
message IDs or pending credits. Structured clone may evaluate getters and normalize
|
|
35
|
+
custom objects before the host sees them. Authors should send plain JSON data;
|
|
36
|
+
the host validates the received representation, not the original object descriptors.
|
|
37
|
+
Receiver byte limits govern acceptance, not the memory allocated while cloning
|
|
38
|
+
or transporting a message.
|
|
39
|
+
A rejected checkpoint remains a failed output even if the callback catches its
|
|
40
|
+
promise. Rejected completion becomes a failure report; rejected failure evidence
|
|
41
|
+
is re-reported using the host's error without that evidence. Normal completion or
|
|
42
|
+
failure release follows an acknowledged terminal fact; cancellation retains its
|
|
43
|
+
stopping/release path, and an unavailable terminal channel reports uncertainty.
|
|
44
|
+
Custom hosts must implement the same full validation and negative-ACK lifecycle,
|
|
45
|
+
not simply acknowledge every frame. Authors may import their own validators;
|
|
46
|
+
those business dependencies remain bundled and are separately attributable.
|
|
47
|
+
|
|
48
|
+
The host owns CID parsing, supported codec/hash checks, DAG verification and
|
|
49
|
+
Bundle-relative path resolution. The Worker treats the host-verified CID as an
|
|
50
|
+
opaque, nonempty string of at most 256 characters and echoes it in the ready
|
|
51
|
+
handshake; it does not import a CID parser. Declaration equality is still checked
|
|
52
|
+
against the build-locked binding, and the host must match the handshake against
|
|
53
|
+
its verified Bundle before dispatching a Run.
|
|
54
|
+
|
|
55
|
+
`context.log({level, message, fields?})` provides async typed diagnostic receipts,
|
|
56
|
+
independent of business outputs. The sole **v1** declaration includes its dedicated
|
|
57
|
+
channel; the project is unreleased and evolves v1 in place. Removed v2 and future
|
|
58
|
+
schema URLs are rejected, not aliased. Disabled/custom-host diagnostics remain
|
|
59
|
+
unavailable. See [Run Logs](../../docs/task-run-logs.md) and the author's
|
|
60
|
+
[diagnostics example](../pguide-task-bundle/examples/low-level/check-diagnostics/callback.ts).
|
|
61
|
+
|
|
62
|
+
`context.bundle.read(relativePath, {signal?})` always returns a standard
|
|
63
|
+
`ReadableStream<Uint8Array>`. It is demand-driven, supports cancellation and
|
|
64
|
+
surfaces creation/midstream errors. Buffer explicitly when needed:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const chunks: Uint8Array[] = [];
|
|
68
|
+
for await (const chunk of context.bundle.read("resources/data.bin")) chunks.push(chunk);
|
|
69
|
+
const bytes = Buffer.concat(chunks);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Resources belong to the current root; absolute paths, traversal and absent files
|
|
73
|
+
fail. Do not locate resources with `__dirname`, `import.meta.url` or cwd:
|
|
74
|
+
Workers may execute verified CommonJS source in memory without a Bundle directory.
|
|
75
|
+
Bundle bytes are immutable. Runtime output belongs outside the Bundle.
|
|
76
|
+
Workers are isolation/lifecycle boundaries, not security sandboxes.
|
|
77
|
+
|
|
78
|
+
The generation-scoped message contract is documented in
|
|
79
|
+
[`docs/task-bundle-worker.md`](https://github.com/shazhou-ww/potential-guide/blob/main/docs/task-bundle-worker.md).
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResolvedTaskBundle } from "@potential-guide/task-protocol/worker";
|
|
2
|
+
export interface TaskBinding {
|
|
3
|
+
declaration: ResolvedTaskBundle;
|
|
4
|
+
}
|
|
5
|
+
/** Replaced by the Bundle builder, never supplied by author code or workerData. */
|
|
6
|
+
export declare const binding: TaskBinding | undefined;
|
|
7
|
+
//# sourceMappingURL=binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED,mFAAmF;AACnF,eAAO,MAAM,OAAO,EAAE,WAAW,GAAG,SAAqB,CAAC"}
|
package/dist/binding.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../src/binding.ts"],"names":[],"mappings":"AAMA,mFAAmF;AACnF,MAAM,CAAC,MAAM,OAAO,GAA4B,SAAS,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Json, type RunContext } from "@potential-guide/task-protocol/worker";
|
|
2
|
+
export interface TaskContext<Message extends Json = never> extends RunContext<Message> {
|
|
3
|
+
readonly bundle: {
|
|
4
|
+
read(path: string, options?: {
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}): ReadableStream<Uint8Array>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export type TaskCallback<Input = Json, Result = Json, Message extends Json = never> = (input: Input, context: TaskContext<Message>) => Promise<Result>;
|
|
10
|
+
export type { RunContext, RunLogInput, RunLogReceipt, RunMessage, RunProgress, } from "@potential-guide/task-protocol/worker";
|
|
11
|
+
export { RunFailure } from "@potential-guide/task-protocol/worker";
|
|
12
|
+
/** Authors explicitly select this wrapper; the builder binds contracts, not startup. */
|
|
13
|
+
export declare function runTask<Input = Json, Result = Json, Message extends Json = never>(callback: TaskCallback<Input, Result, Message>): void;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,IAAI,EAGT,KAAK,UAAU,EAQhB,MAAM,uCAAuC,CAAC;AAG/C,MAAM,WAAW,WAAW,CAAC,OAAO,SAAS,IAAI,GAAG,KAAK,CAAE,SAAQ,UAAU,CAAC,OAAO,CAAC;IACpF,QAAQ,CAAC,MAAM,EAAE;QACf,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;KACpF,CAAC;CACH;AACD,MAAM,MAAM,YAAY,CAAC,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,SAAS,IAAI,GAAG,KAAK,IAAI,CACpF,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,KAC1B,OAAO,CAAC,MAAM,CAAC,CAAC;AACrB,YAAY,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAoCnE,wFAAwF;AACxF,wBAAgB,OAAO,CAAC,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,SAAS,IAAI,GAAG,KAAK,EAC/E,QAAQ,EAAE,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,GAC7C,IAAI,CA8cN"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
2
|
+
import { canonical, json, RunFailure, TaskError, taskSchemaUri, } from "@potential-guide/task-protocol/worker";
|
|
3
|
+
import { binding } from "./binding.js";
|
|
4
|
+
export { RunFailure } from "@potential-guide/task-protocol/worker";
|
|
5
|
+
class Inbox {
|
|
6
|
+
capacity;
|
|
7
|
+
queue = [];
|
|
8
|
+
waiter;
|
|
9
|
+
closed = false;
|
|
10
|
+
constructor(capacity) {
|
|
11
|
+
this.capacity = capacity;
|
|
12
|
+
}
|
|
13
|
+
push(value) {
|
|
14
|
+
if (this.closed || this.queue.length >= this.capacity)
|
|
15
|
+
throw new Error("Task inbox unavailable.");
|
|
16
|
+
if (this.waiter) {
|
|
17
|
+
this.waiter({ done: false, value });
|
|
18
|
+
this.waiter = undefined;
|
|
19
|
+
}
|
|
20
|
+
else
|
|
21
|
+
this.queue.push(value);
|
|
22
|
+
}
|
|
23
|
+
close() {
|
|
24
|
+
this.closed = true;
|
|
25
|
+
this.queue = [];
|
|
26
|
+
this.waiter?.({ done: true, value: undefined });
|
|
27
|
+
this.waiter = undefined;
|
|
28
|
+
}
|
|
29
|
+
[Symbol.asyncIterator]() {
|
|
30
|
+
return {
|
|
31
|
+
next: () => {
|
|
32
|
+
const value = this.queue.shift();
|
|
33
|
+
if (value)
|
|
34
|
+
return Promise.resolve({ done: false, value });
|
|
35
|
+
if (this.closed)
|
|
36
|
+
return Promise.resolve({ done: true, value: undefined });
|
|
37
|
+
if (this.waiter)
|
|
38
|
+
return Promise.reject(new Error("Task inbox has one consumer."));
|
|
39
|
+
return new Promise((resolve) => {
|
|
40
|
+
this.waiter = resolve;
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Authors explicitly select this wrapper; the builder binds contracts, not startup. */
|
|
47
|
+
export function runTask(callback) {
|
|
48
|
+
if (!binding)
|
|
49
|
+
throw new Error("Task SDK requires a build-locked Bundle binding.");
|
|
50
|
+
const { declaration } = binding;
|
|
51
|
+
const port = parentPort;
|
|
52
|
+
if (!port || declaration.$schema !== taskSchemaUri)
|
|
53
|
+
throw new Error("Unsupported Task Worker.");
|
|
54
|
+
const config = workerData;
|
|
55
|
+
if (typeof config.generation !== "string" ||
|
|
56
|
+
!config.generation ||
|
|
57
|
+
!Number.isSafeInteger(config.maxInFlight) ||
|
|
58
|
+
config.maxInFlight <= 0 ||
|
|
59
|
+
!Number.isSafeInteger(config.maxPayloadBytes) ||
|
|
60
|
+
config.maxPayloadBytes <= 0 ||
|
|
61
|
+
typeof config.bundle?.cid !== "string" ||
|
|
62
|
+
!config.bundle.cid ||
|
|
63
|
+
config.bundle.cid.length > 256)
|
|
64
|
+
throw new Error("Invalid trusted Task Worker configuration.");
|
|
65
|
+
if (!config.bundle ||
|
|
66
|
+
canonical(json(config.bundle.declaration, 1_048_576)) !==
|
|
67
|
+
canonical(json(declaration, 1_048_576)))
|
|
68
|
+
throw new Error("Task Worker declaration differs from verified Bundle.");
|
|
69
|
+
const controller = new AbortController();
|
|
70
|
+
const inbox = new Inbox(config.maxInFlight);
|
|
71
|
+
const tasks = new Map();
|
|
72
|
+
const pending = new Map();
|
|
73
|
+
let sequence = 0;
|
|
74
|
+
let runId;
|
|
75
|
+
let finishing = false;
|
|
76
|
+
let queued = 0;
|
|
77
|
+
let cleanupUncertain = false;
|
|
78
|
+
let output = Promise.resolve();
|
|
79
|
+
let outputError;
|
|
80
|
+
let readSequence = 0;
|
|
81
|
+
const reads = new Map();
|
|
82
|
+
function readBundle(path, options = {}) {
|
|
83
|
+
const id = ++readSequence;
|
|
84
|
+
const signal = options.signal
|
|
85
|
+
? AbortSignal.any([controller.signal, options.signal])
|
|
86
|
+
: controller.signal;
|
|
87
|
+
let cleanup = () => { };
|
|
88
|
+
const cancel = () => {
|
|
89
|
+
cleanup();
|
|
90
|
+
reads.get(id)?.reject(new DOMException("Bundle read canceled.", "AbortError"));
|
|
91
|
+
reads.delete(id);
|
|
92
|
+
port.postMessage({
|
|
93
|
+
generation: config.generation,
|
|
94
|
+
runId,
|
|
95
|
+
kind: "bundle-cancel",
|
|
96
|
+
readId: id,
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
return new ReadableStream({
|
|
100
|
+
start(stream) {
|
|
101
|
+
const abort = () => {
|
|
102
|
+
cancel();
|
|
103
|
+
stream.error(signal.reason);
|
|
104
|
+
};
|
|
105
|
+
cleanup = () => signal.removeEventListener("abort", abort);
|
|
106
|
+
if (signal.aborted) {
|
|
107
|
+
stream.error(signal.reason);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
111
|
+
},
|
|
112
|
+
async pull(stream) {
|
|
113
|
+
try {
|
|
114
|
+
if (finishing)
|
|
115
|
+
throw new TaskError("run_finished", "Bundle stream is closed.");
|
|
116
|
+
signal.throwIfAborted();
|
|
117
|
+
const item = await new Promise((resolve, reject) => {
|
|
118
|
+
reads.set(id, { resolve, reject });
|
|
119
|
+
port.postMessage({
|
|
120
|
+
generation: config.generation,
|
|
121
|
+
runId,
|
|
122
|
+
kind: "bundle-pull",
|
|
123
|
+
readId: id,
|
|
124
|
+
path,
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
if (item.done) {
|
|
128
|
+
cleanup();
|
|
129
|
+
stream.close();
|
|
130
|
+
}
|
|
131
|
+
else if (item.chunk instanceof Uint8Array)
|
|
132
|
+
stream.enqueue(item.chunk);
|
|
133
|
+
else
|
|
134
|
+
throw new TaskError("invalid_bundle", "Invalid Bundle stream chunk.");
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
cancel();
|
|
138
|
+
stream.error(error);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
cancel,
|
|
142
|
+
}, { highWaterMark: 0 });
|
|
143
|
+
}
|
|
144
|
+
let logSequence = 0;
|
|
145
|
+
const logPending = new Map();
|
|
146
|
+
let droppedLogs = 0;
|
|
147
|
+
let reportedDroppedLogs = 0;
|
|
148
|
+
let dropScheduled = false;
|
|
149
|
+
let dropReportingClosed = false;
|
|
150
|
+
let finalDropSent = false;
|
|
151
|
+
let dropPending;
|
|
152
|
+
function flushDroppedLogs() {
|
|
153
|
+
if (dropPending ||
|
|
154
|
+
dropReportingClosed ||
|
|
155
|
+
finishing ||
|
|
156
|
+
controller.signal.aborted ||
|
|
157
|
+
droppedLogs <= reportedDroppedLogs)
|
|
158
|
+
return;
|
|
159
|
+
const id = ++logSequence;
|
|
160
|
+
const count = droppedLogs;
|
|
161
|
+
const timer = setTimeout(() => {
|
|
162
|
+
// Keep the unknown in-flight identity: timeout cannot authorize another queued frame.
|
|
163
|
+
dropReportingClosed = true;
|
|
164
|
+
}, 1000);
|
|
165
|
+
dropPending = { id, count, timer };
|
|
166
|
+
try {
|
|
167
|
+
port.postMessage({
|
|
168
|
+
generation: config.generation,
|
|
169
|
+
runId,
|
|
170
|
+
kind: "log-drop",
|
|
171
|
+
logId: id,
|
|
172
|
+
count,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
clearTimeout(timer);
|
|
177
|
+
dropPending = undefined;
|
|
178
|
+
dropReportingClosed = true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function scheduleDroppedLogs() {
|
|
182
|
+
if (dropScheduled ||
|
|
183
|
+
dropPending ||
|
|
184
|
+
dropReportingClosed ||
|
|
185
|
+
finishing ||
|
|
186
|
+
controller.signal.aborted)
|
|
187
|
+
return;
|
|
188
|
+
dropScheduled = true;
|
|
189
|
+
queueMicrotask(() => {
|
|
190
|
+
dropScheduled = false;
|
|
191
|
+
flushDroppedLogs();
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function finishDroppedLogs() {
|
|
195
|
+
if (finalDropSent || droppedLogs <= reportedDroppedLogs)
|
|
196
|
+
return;
|
|
197
|
+
finalDropSent = true;
|
|
198
|
+
// One terminal cumulative snapshot is bounded even when the ordinary acknowledgment is lost.
|
|
199
|
+
try {
|
|
200
|
+
port.postMessage({
|
|
201
|
+
generation: config.generation,
|
|
202
|
+
runId,
|
|
203
|
+
kind: "log-drop",
|
|
204
|
+
logId: ++logSequence,
|
|
205
|
+
count: droppedLogs,
|
|
206
|
+
final: true,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
/* Disconnected tail remains unknown; required outputs never wait for this snapshot. */
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function settleLogs() {
|
|
214
|
+
if (dropPending)
|
|
215
|
+
clearTimeout(dropPending.timer);
|
|
216
|
+
dropPending = undefined;
|
|
217
|
+
dropReportingClosed = true;
|
|
218
|
+
for (const operation of logPending.values()) {
|
|
219
|
+
clearTimeout(operation.timer);
|
|
220
|
+
operation.resolve({ state: "unavailable", reason: "channel" });
|
|
221
|
+
}
|
|
222
|
+
logPending.clear();
|
|
223
|
+
}
|
|
224
|
+
async function log(value) {
|
|
225
|
+
if (finishing || controller.signal.aborted)
|
|
226
|
+
return { state: "unavailable", reason: "channel" };
|
|
227
|
+
if (logPending.size >= Math.min(config.maxInFlight, 16)) {
|
|
228
|
+
droppedLogs = Math.min(Number.MAX_SAFE_INTEGER, droppedLogs + 1);
|
|
229
|
+
scheduleDroppedLogs();
|
|
230
|
+
return { state: "dropped", reason: "capacity" };
|
|
231
|
+
}
|
|
232
|
+
const id = logSequence + 1;
|
|
233
|
+
return new Promise((resolve, reject) => {
|
|
234
|
+
const timer = setTimeout(() => {
|
|
235
|
+
logPending.delete(id);
|
|
236
|
+
resolve({ state: "unavailable", reason: "timeout" });
|
|
237
|
+
}, 1000);
|
|
238
|
+
logPending.set(id, { resolve, reject, timer });
|
|
239
|
+
try {
|
|
240
|
+
port.postMessage({
|
|
241
|
+
generation: config.generation,
|
|
242
|
+
runId,
|
|
243
|
+
kind: "log",
|
|
244
|
+
logId: id,
|
|
245
|
+
value,
|
|
246
|
+
});
|
|
247
|
+
logSequence = id;
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
clearTimeout(timer);
|
|
251
|
+
logPending.delete(id);
|
|
252
|
+
if (error instanceof Error && error.name === "DataCloneError")
|
|
253
|
+
reject(new TaskError("invalid_payload", "Task payload cannot be cloned for IPC."));
|
|
254
|
+
else
|
|
255
|
+
resolve({ state: "unavailable", reason: "channel" });
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function request(kind, value) {
|
|
260
|
+
if (pending.size >= config.maxInFlight)
|
|
261
|
+
return Promise.reject(new Error("Task channel capacity exceeded."));
|
|
262
|
+
const id = sequence + 1;
|
|
263
|
+
const operation = new Promise((resolve, reject) => {
|
|
264
|
+
pending.set(id, { resolve, reject });
|
|
265
|
+
});
|
|
266
|
+
try {
|
|
267
|
+
port.postMessage({ generation: config.generation, runId, id, kind, value });
|
|
268
|
+
sequence = id;
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
pending
|
|
272
|
+
.get(id)
|
|
273
|
+
?.reject(error instanceof Error && error.name === "DataCloneError"
|
|
274
|
+
? new TaskError("invalid_payload", "Task payload cannot be cloned for IPC.")
|
|
275
|
+
: error instanceof Error
|
|
276
|
+
? error
|
|
277
|
+
: new Error("Task send failed."));
|
|
278
|
+
pending.delete(id);
|
|
279
|
+
}
|
|
280
|
+
return operation;
|
|
281
|
+
}
|
|
282
|
+
function enqueue(kind, value) {
|
|
283
|
+
if (finishing)
|
|
284
|
+
return Promise.reject(new TaskError("run_finished", "Task is finishing."));
|
|
285
|
+
if (queued >= config.maxInFlight)
|
|
286
|
+
return Promise.reject(new Error("Task channel capacity exceeded."));
|
|
287
|
+
queued++;
|
|
288
|
+
const operation = output
|
|
289
|
+
.then(() => request(kind, value))
|
|
290
|
+
.catch((error) => {
|
|
291
|
+
outputError ??= error;
|
|
292
|
+
throw error;
|
|
293
|
+
})
|
|
294
|
+
.finally(() => {
|
|
295
|
+
queued--;
|
|
296
|
+
});
|
|
297
|
+
output = operation;
|
|
298
|
+
void operation.catch(() => { });
|
|
299
|
+
return operation;
|
|
300
|
+
}
|
|
301
|
+
port.postMessage({
|
|
302
|
+
generation: config.generation,
|
|
303
|
+
kind: "ready",
|
|
304
|
+
value: {
|
|
305
|
+
$schema: declaration.$schema,
|
|
306
|
+
cid: config.bundle.cid,
|
|
307
|
+
inputSchema: declaration.inputSchema,
|
|
308
|
+
resultSchema: declaration.resultSchema,
|
|
309
|
+
messageSchema: declaration.messageSchema,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
port.on("message", (envelope) => {
|
|
313
|
+
if (!envelope || envelope.generation !== config.generation)
|
|
314
|
+
return;
|
|
315
|
+
if (envelope.kind === "bundle-data") {
|
|
316
|
+
const read = reads.get(envelope.readId);
|
|
317
|
+
if (!read)
|
|
318
|
+
return;
|
|
319
|
+
reads.delete(envelope.readId);
|
|
320
|
+
if (envelope.error)
|
|
321
|
+
read.reject(new TaskError(envelope.error.code, envelope.error.message));
|
|
322
|
+
else
|
|
323
|
+
read.resolve(envelope);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (envelope.kind === "log-drop-ack") {
|
|
327
|
+
if (envelope.runId !== runId || !dropPending || envelope.logId !== dropPending.id)
|
|
328
|
+
return;
|
|
329
|
+
const operation = dropPending;
|
|
330
|
+
clearTimeout(operation.timer);
|
|
331
|
+
dropPending = undefined;
|
|
332
|
+
if (envelope.error || envelope.value?.state === "unavailable") {
|
|
333
|
+
dropReportingClosed = true;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
reportedDroppedLogs = operation.count;
|
|
337
|
+
dropReportingClosed = false;
|
|
338
|
+
scheduleDroppedLogs();
|
|
339
|
+
}
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (envelope.kind === "log-ack") {
|
|
343
|
+
if (envelope.runId !== runId)
|
|
344
|
+
return;
|
|
345
|
+
const operation = logPending.get(envelope.logId);
|
|
346
|
+
if (!operation)
|
|
347
|
+
return;
|
|
348
|
+
logPending.delete(envelope.logId);
|
|
349
|
+
clearTimeout(operation.timer);
|
|
350
|
+
if (envelope.error)
|
|
351
|
+
operation.reject(new TaskError(envelope.error.code, envelope.error.message));
|
|
352
|
+
else
|
|
353
|
+
operation.resolve(envelope.value);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if (envelope.kind === "ack") {
|
|
357
|
+
const operation = pending.get(envelope.id);
|
|
358
|
+
if (!operation)
|
|
359
|
+
return;
|
|
360
|
+
pending.delete(envelope.id);
|
|
361
|
+
if (envelope.error)
|
|
362
|
+
operation.reject(new TaskError(envelope.error.code, envelope.error.message));
|
|
363
|
+
else
|
|
364
|
+
operation.resolve();
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (envelope.kind === "ping") {
|
|
368
|
+
port.postMessage({ generation: config.generation, kind: "pong" });
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
if (envelope.runId !== runId && envelope.kind !== "run")
|
|
372
|
+
return;
|
|
373
|
+
if (envelope.kind === "cancel") {
|
|
374
|
+
port.postMessage({ generation: config.generation, runId, kind: "stopping" });
|
|
375
|
+
controller.abort();
|
|
376
|
+
settleLogs();
|
|
377
|
+
inbox.close();
|
|
378
|
+
for (const task of tasks.values())
|
|
379
|
+
task.abort();
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (envelope.kind === "withdraw") {
|
|
383
|
+
const task = tasks.get(envelope.taskId) ?? new AbortController();
|
|
384
|
+
tasks.set(envelope.taskId, task);
|
|
385
|
+
task.abort();
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
if (envelope.kind === "message") {
|
|
389
|
+
const message = envelope.value;
|
|
390
|
+
const task = tasks.get(message.taskId) ?? new AbortController();
|
|
391
|
+
tasks.set(message.taskId, task);
|
|
392
|
+
let confirmed = false;
|
|
393
|
+
const confirm = (state, reason) => {
|
|
394
|
+
if (confirmed || task.signal.aborted)
|
|
395
|
+
return Promise.reject(new Error("Message unavailable."));
|
|
396
|
+
confirmed = true;
|
|
397
|
+
return enqueue("message-confirm", {
|
|
398
|
+
taskId: message.taskId,
|
|
399
|
+
messageId: message.messageId,
|
|
400
|
+
state,
|
|
401
|
+
...(reason === undefined ? {} : { reason }),
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
inbox.push(Object.freeze({
|
|
405
|
+
messageId: message.messageId,
|
|
406
|
+
taskId: message.taskId,
|
|
407
|
+
caller: Object.freeze(message.caller),
|
|
408
|
+
signal: task.signal,
|
|
409
|
+
payload: message.payload,
|
|
410
|
+
accept: () => confirm("accepted"),
|
|
411
|
+
reject: (reason) => confirm("rejected", reason),
|
|
412
|
+
}));
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (envelope.kind !== "run" || runId !== undefined)
|
|
416
|
+
return;
|
|
417
|
+
runId = envelope.runId;
|
|
418
|
+
const context = Object.freeze({
|
|
419
|
+
runId: envelope.runId,
|
|
420
|
+
...(envelope.identity
|
|
421
|
+
? { generation: envelope.identity.generation, startedAt: envelope.identity.startedAt }
|
|
422
|
+
: {}),
|
|
423
|
+
scope: envelope.scope,
|
|
424
|
+
signal: controller.signal,
|
|
425
|
+
messages: inbox,
|
|
426
|
+
bundle: Object.freeze({ read: readBundle }),
|
|
427
|
+
progress: (value) => enqueue("progress", value),
|
|
428
|
+
checkpoint: (value) => enqueue("checkpoint", value),
|
|
429
|
+
log,
|
|
430
|
+
});
|
|
431
|
+
const reportFailure = async (reason) => {
|
|
432
|
+
const error = reason;
|
|
433
|
+
cleanupUncertain ||=
|
|
434
|
+
error instanceof TaskError &&
|
|
435
|
+
["reclamation_failed", "reclamation_unknown"].includes(error.code);
|
|
436
|
+
const evidence = error instanceof RunFailure ? error.result : undefined;
|
|
437
|
+
const failure = (reason, result) => ({
|
|
438
|
+
code: reason instanceof TaskError ? reason.code.slice(0, 128) : "run_failed",
|
|
439
|
+
message: reason instanceof Error ? reason.message.slice(0, 512) : "Task callback failed.",
|
|
440
|
+
...(result === undefined ? {} : { result }),
|
|
441
|
+
});
|
|
442
|
+
try {
|
|
443
|
+
await request("failed", failure(error, evidence));
|
|
444
|
+
}
|
|
445
|
+
catch (rejected) {
|
|
446
|
+
// A rejected evidence frame is not a terminal fact. Report the host's
|
|
447
|
+
// rejection without the rejected evidence before requesting release.
|
|
448
|
+
await request("failed", failure(rejected));
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
void (async () => {
|
|
452
|
+
try {
|
|
453
|
+
const value = await callback(envelope.input, context);
|
|
454
|
+
finishing = true;
|
|
455
|
+
finishDroppedLogs();
|
|
456
|
+
await output;
|
|
457
|
+
if (outputError !== undefined)
|
|
458
|
+
throw outputError;
|
|
459
|
+
await request("complete", value);
|
|
460
|
+
}
|
|
461
|
+
catch (caught) {
|
|
462
|
+
finishing = true;
|
|
463
|
+
finishDroppedLogs();
|
|
464
|
+
await output.catch(() => { });
|
|
465
|
+
cleanupUncertain ||=
|
|
466
|
+
caught instanceof TaskError &&
|
|
467
|
+
["reclamation_failed", "reclamation_unknown"].includes(caught.code);
|
|
468
|
+
const error = outputError ?? caught;
|
|
469
|
+
if (controller.signal.aborted &&
|
|
470
|
+
error instanceof Error &&
|
|
471
|
+
(error.name === "AbortError" ||
|
|
472
|
+
(error instanceof TaskError && ["ABORT_ERR", "run_canceled"].includes(error.code))))
|
|
473
|
+
return;
|
|
474
|
+
await reportFailure(error);
|
|
475
|
+
}
|
|
476
|
+
})().then(() => {
|
|
477
|
+
inbox.close();
|
|
478
|
+
controller.abort();
|
|
479
|
+
settleLogs();
|
|
480
|
+
for (const task of tasks.values())
|
|
481
|
+
task.abort();
|
|
482
|
+
port.postMessage({
|
|
483
|
+
generation: config.generation,
|
|
484
|
+
runId,
|
|
485
|
+
kind: cleanupUncertain ? "uncertain" : "released",
|
|
486
|
+
});
|
|
487
|
+
port.close();
|
|
488
|
+
}, () => {
|
|
489
|
+
inbox.close();
|
|
490
|
+
controller.abort();
|
|
491
|
+
settleLogs();
|
|
492
|
+
for (const task of tasks.values())
|
|
493
|
+
task.abort();
|
|
494
|
+
port.postMessage({ generation: config.generation, runId, kind: "uncertain" });
|
|
495
|
+
port.close();
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,SAAS,EAET,IAAI,EAGJ,UAAU,EAKV,SAAS,EACT,aAAa,GACd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAkBvC,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE,MAAM,KAAK;IAIoB;IAHrB,KAAK,GAAuB,EAAE,CAAC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ACT,MAAM,aAAa,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC,CAAC,EAAE,CAAC,IAAI,CACP,GAAG,EAAE;YACH,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,UAAU,EAAE,CAAC;YACb,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE;gBAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YAChD,IAAI,CAAC,WAAW,CAAC;gBACf,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,KAAK;gBACL,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU;aAClD,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,EACD,GAAG,EAAE;YACH,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,UAAU,EAAE,CAAC;YACb,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE;gBAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YAChD,IAAI,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;YAC9E,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@potential-guide/task-sdk",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-rc.0",
|
|
4
|
+
"description": "Generation-scoped Task Worker runtime and author callback types.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=22.13.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@potential-guide/task-protocol": "^0.1.0-rc.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
5
28
|
"license": "MIT",
|
|
6
29
|
"repository": {
|
|
7
30
|
"type": "git",
|
|
8
31
|
"url": "git+https://github.com/shazhou-ww/potential-guide.git",
|
|
9
32
|
"directory": "packages/task-sdk"
|
|
10
33
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc -b",
|
|
36
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
37
|
+
"lint": "biome lint .",
|
|
38
|
+
"test": "tsx --test \"test/*.test.ts\"",
|
|
39
|
+
"typecheck": "tsc -b --pretty false"
|
|
13
40
|
}
|
|
14
|
-
}
|
|
41
|
+
}
|