@zukhruf/pool 0.8.18 → 0.8.20
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/README.md +271 -0
- package/dist/climbing.d.ts.map +1 -1
- package/dist/climbing.js +10 -2
- package/dist/climbing.js.map +1 -1
- package/dist/computer-store.d.ts +7 -0
- package/dist/computer-store.d.ts.map +1 -0
- package/dist/computer-store.js +29 -0
- package/dist/computer-store.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pool.d.ts.map +1 -1
- package/dist/pool.js +20 -305
- package/dist/pool.js.map +1 -1
- package/dist/slots.d.ts +52 -0
- package/dist/slots.d.ts.map +1 -0
- package/dist/slots.js +339 -0
- package/dist/slots.js.map +1 -0
- package/dist/worker-kind.d.ts +19 -0
- package/dist/worker-kind.d.ts.map +1 -0
- package/dist/worker-kind.js +28 -0
- package/dist/worker-kind.js.map +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -124,6 +124,261 @@ The pool measures the time of each job, waits before it replaces a worker that e
|
|
|
124
124
|
|
|
125
125
|
An eviction of your own gets the clock of the pool as the third argument of `idle(busy, evict, clock)`, so the pool and its eviction always run on one clock. See [ADR 0008](./docs/adr/0008-the-pool-measures-and-waits-on-the-clock-that-the-caller-gives.md).
|
|
126
126
|
|
|
127
|
+
## One pool for the computer
|
|
128
|
+
|
|
129
|
+
Design for review (backlog #3527). `WorkerKind` and `computerStore` are built. The rest is not built yet. The text above tells what the package does today. [ADR 0011](./docs/adr/0011-every-pool-is-a-pool-for-the-computer-and-one-owner-pulls-its-jobs-from-a-store-that-every-host-writes-to.md) to [ADR 0026](./docs/adr/0026-start-accepts-a-job-now-and-a-job-handle-reads-its-output-later-from-any-host.md) record the design. The tickets and the research named here are in the pool map, `.scratch/one-pool-for-the-computer/` at the workspace root, which git does not track.
|
|
130
|
+
|
|
131
|
+
Today each host builds its own pool, so several hosts on one computer run several full pools, and they compete for one Neural Engine (#2896, #3868). In the design, every pool is a pool for the computer. On each computer, one host owns the workers of a pool. Every host writes its jobs to one store, and only the owner takes them. A job is data, so it can go from one host to another. The pool for the computer replaces the pool of today: `use((worker) => …)` goes away.
|
|
132
|
+
|
|
133
|
+
The words of the design are in [CONTEXT.md](./CONTEXT.md), section "The pool for the computer".
|
|
134
|
+
|
|
135
|
+
### Define the worker kind
|
|
136
|
+
|
|
137
|
+
A worker kind names the pool and holds its job rules. Export it from a module with no native code, so a host that cannot run the worker program can import it too:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import { WorkerKind } from '@zukhruf/pool';
|
|
141
|
+
|
|
142
|
+
export const vision = new WorkerKind<{ path: string }, { text: string }>({
|
|
143
|
+
name: 'vision',
|
|
144
|
+
revision: 1, // raise it when run changes in a way that matters
|
|
145
|
+
policy: 'exclusive', // identical inputs share one job
|
|
146
|
+
retryLimit: 2,
|
|
147
|
+
expireInSeconds: 120,
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The rule names are pg-boss's queue options, with pg-boss's meaning. Each one is required. See [ADR 0014](./docs/adr/0014-pool-and-pool-workers-take-one-worker-kind.md).
|
|
152
|
+
|
|
153
|
+
### Send jobs, and offer workers
|
|
154
|
+
|
|
155
|
+
A host that can run the worker program sends jobs and offers its workers:
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
import { availableParallelism } from 'node:os';
|
|
159
|
+
|
|
160
|
+
import {
|
|
161
|
+
HillClimbing,
|
|
162
|
+
IdleTimeout,
|
|
163
|
+
LeaderFirst,
|
|
164
|
+
Pool,
|
|
165
|
+
PoolWorkers,
|
|
166
|
+
computerStore,
|
|
167
|
+
} from '@zukhruf/pool';
|
|
168
|
+
|
|
169
|
+
const store = computerStore(process.env);
|
|
170
|
+
const { availableMemory } = process;
|
|
171
|
+
|
|
172
|
+
await using ocr = new Pool({ kind: vision, store, clock: globalThis });
|
|
173
|
+
await using workers = new PoolWorkers({
|
|
174
|
+
kind: vision,
|
|
175
|
+
store,
|
|
176
|
+
clock: globalThis,
|
|
177
|
+
create: () => new VisionWorker('/path/to/vision-worker'),
|
|
178
|
+
size: new HillClimbing({
|
|
179
|
+
memoryPerWorker: 2 * 1024 ** 3,
|
|
180
|
+
computer: { availableParallelism, availableMemory },
|
|
181
|
+
}),
|
|
182
|
+
startup: new LeaderFirst(),
|
|
183
|
+
eviction: new IdleTimeout({ after: 300_000 }),
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const { text } = await ocr.run({ path: '/tmp/receipt.png' }, { signal });
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
A host that answers at once starts the job, and reads its output later, from this host or another:
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
const { id } = await ocr.start({ path: '/tmp/receipt.png' });
|
|
193
|
+
// later, in any host with a Pool of the same kind
|
|
194
|
+
const { text } = await ocr.handle(id).result({ signal });
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
A host that cannot run the worker program only sends. To reach the workers of another computer, it gives a shared Postgres store:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
await using ocr = new Pool({
|
|
201
|
+
kind: vision,
|
|
202
|
+
store: 'postgres://…',
|
|
203
|
+
clock: globalThis,
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
A test gives a store of its own, so it never joins the user's pool:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
await using scratch = await mkdtempDisposable(join(tmpdir(), 'pool-'));
|
|
211
|
+
const store = join(scratch.path, 'store.sqlite');
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### The API
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
import type { Clock } from '@zukhruf/async';
|
|
218
|
+
|
|
219
|
+
export class WorkerKind<Input, Output> {
|
|
220
|
+
constructor(options: {
|
|
221
|
+
name: string;
|
|
222
|
+
revision: number;
|
|
223
|
+
policy: 'standard' | 'exclusive';
|
|
224
|
+
retryLimit: number;
|
|
225
|
+
expireInSeconds: number;
|
|
226
|
+
});
|
|
227
|
+
readonly name: string;
|
|
228
|
+
readonly revision: number;
|
|
229
|
+
readonly policy: 'standard' | 'exclusive';
|
|
230
|
+
readonly retryLimit: number;
|
|
231
|
+
readonly expireInSeconds: number;
|
|
232
|
+
/** The queue of this revision in the store: `<name>.r<revision>`. */
|
|
233
|
+
readonly queue: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** Sends jobs of one kind to the store, and waits for their outputs. */
|
|
237
|
+
export class Pool<Input, Output> implements AsyncDisposable {
|
|
238
|
+
constructor(options: {
|
|
239
|
+
kind: WorkerKind<Input, Output>;
|
|
240
|
+
store: string;
|
|
241
|
+
clock: Clock;
|
|
242
|
+
});
|
|
243
|
+
/** Sends the job, and resolves when the store has it. */
|
|
244
|
+
start(input: Input): Promise<JobHandle<Output>>;
|
|
245
|
+
/** The handle of a job of this kind and revision that any host started. */
|
|
246
|
+
handle(id: string): JobHandle<Output>;
|
|
247
|
+
/** start, then result. The abort of signal cancels the job. */
|
|
248
|
+
run(input: Input, options?: { signal?: AbortSignal }): Promise<Output>;
|
|
249
|
+
/** The jobs of the kind in the store, the same from every host. */
|
|
250
|
+
stats(): Promise<JobCounts>;
|
|
251
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Offers this host's workers. Owns them while this host leads. */
|
|
255
|
+
export class PoolWorkers<Input, Output> implements AsyncDisposable {
|
|
256
|
+
constructor(options: {
|
|
257
|
+
kind: WorkerKind<Input, Output>;
|
|
258
|
+
store: string;
|
|
259
|
+
clock: Clock;
|
|
260
|
+
create: () => Worker<Input, Output>;
|
|
261
|
+
size: Sizing;
|
|
262
|
+
startup: Startup;
|
|
263
|
+
eviction: Eviction;
|
|
264
|
+
});
|
|
265
|
+
/** This host's slots: zero in each count while it does not own. */
|
|
266
|
+
readonly stats: PoolStats;
|
|
267
|
+
/** Resolves when this host owns and its startup workers are ready. */
|
|
268
|
+
ready(): Promise<void>;
|
|
269
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface Worker<Input, Output> {
|
|
273
|
+
run(input: Input): Promise<Output>;
|
|
274
|
+
ready?(): Promise<unknown>;
|
|
275
|
+
exited(): Promise<unknown>;
|
|
276
|
+
kill(): void;
|
|
277
|
+
close(): Promise<void>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** A job in the store, by its id. */
|
|
281
|
+
export interface JobHandle<Output> {
|
|
282
|
+
readonly id: string;
|
|
283
|
+
/** Waits for the output. The abort of signal ends only this wait. */
|
|
284
|
+
result(options?: { signal?: AbortSignal }): Promise<Output>;
|
|
285
|
+
/** A leave for a shared job; a drop or a kill for any other job. */
|
|
286
|
+
cancel(): Promise<void>;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface JobCounts {
|
|
290
|
+
readonly waiting: number;
|
|
291
|
+
readonly running: number;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** The store of this computer, for the user of env: zukhruf-pool/store.sqlite in the user's state folder for process.platform. */
|
|
295
|
+
export function computerStore(env: Record<string, string | undefined>): string;
|
|
296
|
+
|
|
297
|
+
export class JobFailedError extends Error {
|
|
298
|
+
readonly failure: { readonly name: string; readonly message: string };
|
|
299
|
+
}
|
|
300
|
+
export class JobCancelledError extends Error {}
|
|
301
|
+
export class JobNotFoundError extends Error {}
|
|
302
|
+
export class DeprecatedRevisionError extends Error {}
|
|
303
|
+
export class DisposedError extends Error {}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### The rules
|
|
307
|
+
|
|
308
|
+
- **One owner.** On each computer, one host owns the workers of a pool. `PoolWorkers` campaigns in a `SqliteElection` of [`@zukhruf/election`](../election/README.md), with the claim files in the folder of the store. The other hosts with a `PoolWorkers` are standbys ([ADR 0011](./docs/adr/0011-every-pool-is-a-pool-for-the-computer-and-one-owner-pulls-its-jobs-from-a-store-that-every-host-writes-to.md)).
|
|
309
|
+
- **The two roles.** `Pool` sends. `PoolWorkers` offers workers and has no `run`. They meet only through the worker kind and the store, as BullMQ's `Queue` and `Worker` meet through the queue name ([ADR 0013](./docs/adr/0013-pool-sends-jobs-and-pool-workers-offers-the-workers-of-its-host.md)).
|
|
310
|
+
- **A job is data.** The input and the output are JSON. A file goes by reference: a path on one computer. The code of a job is the worker's `run` ([ADR 0012](./docs/adr/0012-a-job-is-data-and-the-worker-kind-runs-it.md)).
|
|
311
|
+
- **The store** is a required address. A path of a SQLite file is the store of one computer, through [`@zukhruf/sqlite-queue`](../sqlite/queue/README.md). A `postgres://` address joins computers, through pg-boss. `computerStore(env)` gives `zukhruf-pool/store.sqlite` in the user's state folder: `$HOME/Library/Application Support` on macOS, `$XDG_STATE_HOME` (or `$HOME/.local/state`) on Linux, `%LOCALAPPDATA%` on Windows. It reads `process.platform`, and takes `env` as its input, as Go's `os.UserConfigDir` reads `runtime.GOOS`. Every `Pool` and `PoolWorkers` opens the store and creates the queue of its revision ([ADR 0015](./docs/adr/0015-the-store-is-a-required-input-and-computer-store-gives-the-store-of-the-computer.md)).
|
|
312
|
+
- **The cap.** The owner's sizing caps the jobs of its computer. The store keeps no count of running jobs. A new owner starts its sizing fresh ([ADR 0016](./docs/adr/0016-the-owners-sizing-caps-the-jobs-of-its-computer.md)).
|
|
313
|
+
- **The owner asks, then takes.** It calls `fetch(name, { batchSize: free })` on the queue of its revision for its free workers, settles each job with `complete` or `fail` by its attempt, and calls `touch` for each running job every 5 s on a heartbeat of 10 s. It fetches when a worker becomes free, at a "new job" wake, and at the backstop ([ADR 0017](./docs/adr/0017-the-owner-asks-then-takes-as-many-jobs-as-it-has-free-workers.md)).
|
|
314
|
+
- **News travels by push.** Two channels for each pool: "a new job", with the revision, which the owner hears, and "an output", with the job id, which each waiting `Pool` hears. On one computer they go through [`@zukhruf/sqlite-notify`](../sqlite/notify/README.md), across computers through Postgres `LISTEN` / `NOTIFY`. The store is the truth, and a wake only says "read the store". A backstop each second on one computer finds a lost wake, and a job that the store's monitor failed ([ADR 0018](./docs/adr/0018-news-travels-by-push-through-the-notify-of-the-store-with-a-backstop.md)).
|
|
315
|
+
- **`run` waits** for the output. The kind's `retryLimit` decides how often a job runs again, its `expireInSeconds` limits one run, and the caller's `signal` limits only the caller's wait. With no owner anywhere, the job waits in the store. `run` is `start`, then `result` ([ADR 0019](./docs/adr/0019-run-waits-and-a-failed-job-rejects-with-the-pools-error.md)).
|
|
316
|
+
- **Accept now, read later.** `start(input)` resolves with a `JobHandle { id, result({ signal }), cancel() }`, and `handle(id)` gives the handle of a job from any host, as Temporal's `start` and `getHandle`. The job outlives the host that started it. A handle reads the job until the store's retention ends: 7 days after the job settled ([ADR 0026](./docs/adr/0026-start-accepts-a-job-now-and-a-job-handle-reads-its-output-later-from-any-host.md)).
|
|
317
|
+
- **A cancel.** The caller's abort of a shared job is a leave: its `run` rejects, and the job runs to its end for the other callers. The abort of any other job drops it when it waits, and kills its worker when it runs. `cancel()` of a handle does the same ([ADR 0020](./docs/adr/0020-a-cancel-of-a-shared-job-is-a-leave-and-of-any-other-job-a-drop-or-a-kill.md); Ezz, 2026-11-14: "we need to follow top perfoerms").
|
|
318
|
+
- **A caller that is gone.** Each job of a `run` carries its caller's address: a pipe of [`@zukhruf/pipes`](../pipes/README.md) that the waiting `Pool` serves. A job of `start` carries none. The owner connects to it before it starts the job, and keeps the connection while the job runs. A refused connect or a close is a cancel of that caller ([ADR 0021](./docs/adr/0021-a-caller-whose-host-is-gone-cancels-its-jobs-and-the-owner-learns-it-from-a-closed-connection.md)).
|
|
319
|
+
- **Revisions.** Each revision has its own queue, `<name>.r<revision>`, so an older owner never fetches a job of a newer revision, as Temporal routes a task by its build id. An owner refuses a job of an older revision with `DeprecatedRevisionError`. An owner that hears a wake of a newer revision finishes its running jobs and resigns ([ADR 0022](./docs/adr/0022-the-newest-revision-takes-over-and-an-owner-refuses-a-job-of-an-older-revision.md)).
|
|
320
|
+
- **Ownership moves** only by the owner's own act or its end. A standby starts no workers until it owns. A clean owner finishes its jobs and resigns. The jobs of a dead owner come back by their heartbeat. `ready()` never resolves on a standby ([ADR 0023](./docs/adr/0023-ownership-moves-only-by-the-owners-own-act-or-its-end-and-a-standby-stays-cold.md)).
|
|
321
|
+
- **A hung owner** is ended by the election: a standby that hears no heartbeat on the leader's pipe for 15 s kills the leader's process. A late `complete` of the old owner affects 0 rows ([ADR 0024](./docs/adr/0024-a-hung-owner-is-ended-by-the-election-and-its-late-acts-are-fenced.md)).
|
|
322
|
+
- **Many computers** share one Postgres store, and each computer elects its own owner. It is built only when a second computer is real ([ADR 0025](./docs/adr/0025-many-computers-share-one-postgres-store-and-each-computer-keeps-its-own-owner.md)).
|
|
323
|
+
|
|
324
|
+
### Errors
|
|
325
|
+
|
|
326
|
+
| Error | When `run` or `result` rejects with it |
|
|
327
|
+
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
328
|
+
| `JobFailedError` | The job failed its last run. `failure` has the name and the message that the owner stored, for example the worker's error or "job timed out". |
|
|
329
|
+
| `DeprecatedRevisionError` | The owner runs a newer revision of the kind, and refused this job. Update the host. |
|
|
330
|
+
| `JobCancelledError` | The job was cancelled, by `cancel()` of a handle or by the abort of a `run`. |
|
|
331
|
+
| `JobNotFoundError` | The store has no job with the id: it was deleted after the retention, it belongs to another revision, or it never existed. |
|
|
332
|
+
| `DisposedError` | The host disposed its `Pool` while the `run` or the `result` waited. |
|
|
333
|
+
| The reason of `signal` | The caller's signal aborted. |
|
|
334
|
+
|
|
335
|
+
### The gaps that come first
|
|
336
|
+
|
|
337
|
+
Each gap that the design found goes to the package that must have it, and is built before the pool (Ezz, 2026-11-13: "Anything that is missing then goes to the appropriate package").
|
|
338
|
+
|
|
339
|
+
| Gap | Home | State |
|
|
340
|
+
| ------------------------------------------------------------------ | ------------------------ | --------------------------------------------------- |
|
|
341
|
+
| The socket address of a program of one computer | `@zukhruf/pipes` | Built (#2496) |
|
|
342
|
+
| A claim that is not atomic across connections | `@zukhruf/sqlite-queue` | Built (#3700) |
|
|
343
|
+
| pg-boss's `fetch` and `complete` | `@zukhruf/sqlite-queue` | Built (#4313) |
|
|
344
|
+
| pg-boss's `touch` | `@zukhruf/sqlite-queue` | Built (#4370) |
|
|
345
|
+
| No `LISTEN` / `NOTIFY` on a SQLite file | `@zukhruf/sqlite-notify` | Built (#4333) |
|
|
346
|
+
| `useListenNotify` across instances on one file | `@zukhruf/sqlite-queue` | Built (#4334). The pool does not use it (ADR 0018). |
|
|
347
|
+
| A standby that polls, and a hung leader that nobody ends | `@zukhruf/election` | Built (#4371) |
|
|
348
|
+
| An older release that rebuilds a newer file | `@zukhruf/sqlite-queue` | Built (#4369) |
|
|
349
|
+
| A count of the jobs of a queue by state, pg-boss's `getQueueStats` | `@zukhruf/sqlite-queue` | Not built. `pool.stats()` needs it (#2888). |
|
|
350
|
+
| A job from `findJobs` carries a `signal`, and pg-boss's does not | `@zukhruf/sqlite-queue` | Fixed (#4331) |
|
|
351
|
+
| A write that waits more than the busy timeout of 5 s fails | `@zukhruf/sqlite-queue` | Open risk (#4355) |
|
|
352
|
+
| A synced commit on macOS is a plain `fsync` | `@zukhruf/sqlite-queue` | Open risk (#4351) |
|
|
353
|
+
| Nothing ran on Windows | each package | Deferred (#4340) |
|
|
354
|
+
|
|
355
|
+
### Decided
|
|
356
|
+
|
|
357
|
+
The three open features, and the three items that the records did not decide, were decided on 2026-11-16 (backlog #3527, "DECISIONS 2026-11-16").
|
|
358
|
+
|
|
359
|
+
1. **Accept a job now, and read its output later: yes, in Temporal's shape.** Ezz: "learn from memoroies what is my style and pick". His recorded rule for a standard package: put a capability in or out for a reason of its domain, never because no consumer needs it yet. Every leading job system has it: Temporal's `start` and `getHandle`, Celery's `AsyncResult`, BullMQ's `Job.fromId` and `waitUntilFinished`, pg-boss's `send` id and `findJobs`, and Azure Asynchronous Request-Reply. Temporal's shape maps one-to-one onto pg-boss ([ADR 0026](./docs/adr/0026-start-accepts-a-job-now-and-a-job-handle-reads-its-output-later-from-any-host.md)).
|
|
360
|
+
2. **A result cache: no cache in the pool.** Ezz: "No cache in the pool (Recommended)". A host that wants one keeps it above the pool, keyed by content, as Bazel keeps its action cache above its workers.
|
|
361
|
+
3. **Cancel a running job with no kill: kill only for now.** Ezz: "Kill only for now (Recommended)". A cancel signal on the worker's `run` comes later, as Bazel sends `cancel: true` to a worker that declares `supports-worker-cancellation`. The trigger is a costly kind that cannot be shared, with a worker that can cancel ([ADR 0020](./docs/adr/0020-a-cancel-of-a-shared-job-is-a-leave-and-of-any-other-job-a-drop-or-a-kill.md)).
|
|
362
|
+
|
|
363
|
+
Decided by the leaders (Ezz: "I trust your recommendation ... follow the top performers"):
|
|
364
|
+
|
|
365
|
+
4. **The address on each job** is a pipe of `@zukhruf/pipes` that each waiting `Pool` serves, as gRPC learns of a gone client from the caller's own stream. `@zukhruf/sqlite-notify` does not change ([ADR 0021](./docs/adr/0021-a-caller-whose-host-is-gone-cancels-its-jobs-and-the-owner-learns-it-from-a-closed-connection.md)).
|
|
366
|
+
5. **A queue for each worker revision**, so an older owner never fetches a job of a newer revision, as Temporal worker versioning routes a task by its build id and Amazon SWF by the version ([ADR 0022](./docs/adr/0022-the-newest-revision-takes-over-and-an-owner-refuses-a-job-of-an-older-revision.md)).
|
|
367
|
+
6. **`computerStore(env)` reads `process.platform`**, and takes `env` as its input, as Go's `os.UserConfigDir` reads `runtime.GOOS` ([ADR 0015](./docs/adr/0015-the-store-is-a-required-input-and-computer-store-gives-the-store-of-the-computer.md)).
|
|
368
|
+
|
|
369
|
+
### Moving the hosts
|
|
370
|
+
|
|
371
|
+
A plan, not code. The hosts that move are elt and context-compiler (map, Revision 2026-11-13). trashbot is not in use, stays on `@zukhruf/pool` 0.6.15, and does not move.
|
|
372
|
+
|
|
373
|
+
1. **zukhruf, before the pool**: Ezz reviews ADR 0011 to ADR 0026. `@zukhruf/sqlite-queue` gets pg-boss's `getQueueStats(name)` with its parity tests, because `pool.stats()` needs it (#2888). #4331 is fixed.
|
|
374
|
+
2. **zukhruf, the pool**: `WorkerKind`, `Pool` with `start`, `handle` and `run`, `PoolWorkers` and `computerStore`, with tests of several real hosts on one computer: each test with its own store file, real worker processes and the real clock. `use` and its tests go. The recipes change to the new API, and this section becomes the README. Then a release.
|
|
375
|
+
3. **elt**: a `vision` kind (`exclusive`, with retries) and a `transcription` kind (`standard`) in modules with no native code. The worker classes implement `run`. `ImageFormat` takes a `Pool` of the `vision` kind, in place of `Pool<VisionWorker>` (`image-format.ts:56`). `local-transcription-model.ts:85` gives the path of its wav to `run`.
|
|
376
|
+
4. **context-compiler**: the server (`apps/server/src/startup.ts:11`) and the CLI (`apps/cli/src/parsing.ts:61`) build a `Pool` and a `PoolWorkers` of the `vision` kind with `computerStore(process.env)`. `packages/connectors/connector/src/transcription.ts:96` does the same for transcription. Each host disposes them at a termination signal, through `@zukhruf/shutdown`.
|
|
377
|
+
5. **elt and context-compiler** move to the new release of `@zukhruf` in one step, and release together.
|
|
378
|
+
6. **A measure**: the contention benchmark of 2026-11-02 runs again with two hosts on one store. One owner's sizing then caps the computer.
|
|
379
|
+
|
|
380
|
+
Many computers come after map ticket 14, when a second computer is real.
|
|
381
|
+
|
|
127
382
|
## Recipes
|
|
128
383
|
|
|
129
384
|
1. [Let the pool find how many workers pay](./docs/recipes/find-how-many-workers-pay.md)
|
|
@@ -143,3 +398,19 @@ An eviction of your own gets the clock of the pool as the third argument of `idl
|
|
|
143
398
|
- [ADR 0008](./docs/adr/0008-the-pool-measures-and-waits-on-the-clock-that-the-caller-gives.md): the pool measures and waits on the clock that the caller gives.
|
|
144
399
|
- [ADR 0009](./docs/adr/0009-a-sizing-reads-the-capacity-from-the-computer-that-the-caller-gives.md): a sizing reads the capacity from the computer that the caller gives.
|
|
145
400
|
- [ADR 0010](./docs/adr/0010-an-eager-pool-starts-a-worker-again-after-its-warm-up-fails.md): an eager pool starts a worker again after its warm-up fails.
|
|
401
|
+
- [ADR 0011](./docs/adr/0011-every-pool-is-a-pool-for-the-computer-and-one-owner-pulls-its-jobs-from-a-store-that-every-host-writes-to.md): every pool is a pool for the computer, and one owner pulls its jobs from a store that every host writes to (proposed).
|
|
402
|
+
- [ADR 0012](./docs/adr/0012-a-job-is-data-and-the-worker-kind-runs-it.md): a job is data, and the worker kind runs it (proposed).
|
|
403
|
+
- [ADR 0013](./docs/adr/0013-pool-sends-jobs-and-pool-workers-offers-the-workers-of-its-host.md): `Pool` sends jobs, and `PoolWorkers` offers the workers of its host (proposed).
|
|
404
|
+
- [ADR 0014](./docs/adr/0014-pool-and-pool-workers-take-one-worker-kind.md): `Pool` and `PoolWorkers` take one worker kind (proposed).
|
|
405
|
+
- [ADR 0015](./docs/adr/0015-the-store-is-a-required-input-and-computer-store-gives-the-store-of-the-computer.md): the store is a required input, and `computerStore` gives the store of the computer (proposed).
|
|
406
|
+
- [ADR 0016](./docs/adr/0016-the-owners-sizing-caps-the-jobs-of-its-computer.md): the owner's sizing caps the jobs of its computer (proposed).
|
|
407
|
+
- [ADR 0017](./docs/adr/0017-the-owner-asks-then-takes-as-many-jobs-as-it-has-free-workers.md): the owner asks, then takes as many jobs as it has free workers (proposed).
|
|
408
|
+
- [ADR 0018](./docs/adr/0018-news-travels-by-push-through-the-notify-of-the-store-with-a-backstop.md): news travels by push through the notify of the store, with a backstop (proposed).
|
|
409
|
+
- [ADR 0019](./docs/adr/0019-run-waits-and-a-failed-job-rejects-with-the-pools-error.md): `run` waits, and a failed job rejects with the pool's error (proposed).
|
|
410
|
+
- [ADR 0020](./docs/adr/0020-a-cancel-of-a-shared-job-is-a-leave-and-of-any-other-job-a-drop-or-a-kill.md): a cancel of a shared job is a leave, and of any other job a drop or a kill (proposed).
|
|
411
|
+
- [ADR 0021](./docs/adr/0021-a-caller-whose-host-is-gone-cancels-its-jobs-and-the-owner-learns-it-from-a-closed-connection.md): a caller whose host is gone cancels its jobs, and the owner learns it from a closed connection (proposed).
|
|
412
|
+
- [ADR 0022](./docs/adr/0022-the-newest-revision-takes-over-and-an-owner-refuses-a-job-of-an-older-revision.md): the newest revision takes over, and an owner refuses a job of an older revision (proposed).
|
|
413
|
+
- [ADR 0023](./docs/adr/0023-ownership-moves-only-by-the-owners-own-act-or-its-end-and-a-standby-stays-cold.md): ownership moves only by the owner's own act or its end, and a standby stays cold (proposed).
|
|
414
|
+
- [ADR 0024](./docs/adr/0024-a-hung-owner-is-ended-by-the-election-and-its-late-acts-are-fenced.md): a hung owner is ended by the election, and its late acts are fenced (proposed).
|
|
415
|
+
- [ADR 0025](./docs/adr/0025-many-computers-share-one-postgres-store-and-each-computer-keeps-its-own-owner.md): many computers share one Postgres store, and each computer keeps its own owner (proposed).
|
|
416
|
+
- [ADR 0026](./docs/adr/0026-start-accepts-a-job-now-and-a-job-handle-reads-its-output-later-from-any-host.md): `start` accepts a job now, and a `JobHandle` reads its output later from any host (proposed).
|
package/dist/climbing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"climbing.d.ts","sourceRoot":"","sources":["../src/climbing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"climbing.d.ts","sourceRoot":"","sources":["../src/climbing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsBlD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAkBD,8BAAsB,QAAS,YAAW,MAAM;;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAkBb,OAAO,EAAE,eAAe;IAQpC,IAAI,OAAO,IAAI,MAAM,CAGpB;IAID,IAAI,IAAI,IAAI,MAAM,CAKjB;IAED,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,MAAM,GAAG,IAAI;IA+EvD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIlD,SAAS,CAAC,QAAQ,CAAC,IAAI,CACrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO;IAGV,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGtC"}
|
package/dist/climbing.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Backoff } from '@zukhruf/async';
|
|
1
2
|
import { capacity } from "./capacity.js";
|
|
2
3
|
// A window of jobs ends after both, so the sizes of the files it held do not
|
|
3
4
|
// decide alone.
|
|
@@ -7,6 +8,14 @@ const span = 2_000;
|
|
|
7
8
|
// to this many, as .NET's hill climbing waits up to ten times longer when
|
|
8
9
|
// more threads hurt: each step with one more warms up a worker for nothing.
|
|
9
10
|
const longestPause = 16;
|
|
11
|
+
// Each pause is 0.5 to 1.5 times its length, so that processes which run the
|
|
12
|
+
// same climbing take their steps apart.
|
|
13
|
+
const pause = new Backoff({
|
|
14
|
+
initial: span,
|
|
15
|
+
multiplier: 2,
|
|
16
|
+
max: span * longestPause,
|
|
17
|
+
jitter: { kind: 'ratio', ratio: 0.5 },
|
|
18
|
+
});
|
|
10
19
|
// Finds how many workers pay by trying more or fewer, step after step, for as
|
|
11
20
|
// long as the pool runs. Work that changes while it is measured, as when files
|
|
12
21
|
// arrive grouped by kind, would decide a plain before and after, so each step
|
|
@@ -129,8 +138,7 @@ export class Climbing {
|
|
|
129
138
|
this.#calm = 0;
|
|
130
139
|
else if (this.#unpaid === 0) {
|
|
131
140
|
this.#direction = this.#direction === 'more' ? 'fewer' : 'more';
|
|
132
|
-
|
|
133
|
-
this.#resume = finished + span * windows * (0.5 + Math.random());
|
|
141
|
+
this.#resume = finished + pause.duration(this.#calm++);
|
|
134
142
|
this.#step = 'pause';
|
|
135
143
|
}
|
|
136
144
|
}
|
package/dist/climbing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"climbing.js","sourceRoot":"","sources":["../src/climbing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG/D,6EAA6E;AAC7E,gBAAgB;AAChB,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB,4EAA4E;AAC5E,0EAA0E;AAC1E,4EAA4E;AAC5E,MAAM,YAAY,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"climbing.js","sourceRoot":"","sources":["../src/climbing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAwB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG/D,6EAA6E;AAC7E,gBAAgB;AAChB,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB,4EAA4E;AAC5E,0EAA0E;AAC1E,4EAA4E;AAC5E,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,6EAA6E;AAC7E,wCAAwC;AACxC,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC;IACxB,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,CAAC;IACb,GAAG,EAAE,IAAI,GAAG,YAAY;IACxB,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE;CACtC,CAAC,CAAC;AAWH,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,4E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I,CAAC,UAAU,GAAG,MAAM,CAAC;QACpC,OAAO,IAAI,IAAI,IAAI,CAAC;IACtB,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IAaD,4DAA4D;IAClD,KAAK,CAAC,IAAY;QAC1B,OAAO,IAAI,GAAG,CAAC,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The store of this computer for the user of env: `zukhruf-pool/store.sqlite`
|
|
3
|
+
* in the user's state folder for process.platform (ADR 0015). Throws when a
|
|
4
|
+
* variable that the platform needs is not set, as Go's `os.UserConfigDir`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function computerStore(env: Record<string, string | undefined>): string;
|
|
7
|
+
//# sourceMappingURL=computer-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computer-store.d.ts","sourceRoot":"","sources":["../src/computer-store.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAE7E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
* The store of this computer for the user of env: `zukhruf-pool/store.sqlite`
|
|
4
|
+
* in the user's state folder for process.platform (ADR 0015). Throws when a
|
|
5
|
+
* variable that the platform needs is not set, as Go's `os.UserConfigDir`.
|
|
6
|
+
*/
|
|
7
|
+
export function computerStore(env) {
|
|
8
|
+
return join(stateFolder(env), 'zukhruf-pool', 'store.sqlite');
|
|
9
|
+
}
|
|
10
|
+
function stateFolder(env) {
|
|
11
|
+
switch (process.platform) {
|
|
12
|
+
case 'darwin':
|
|
13
|
+
return join(home(env), 'Library', 'Application Support');
|
|
14
|
+
case 'win32':
|
|
15
|
+
if (!env.LOCALAPPDATA)
|
|
16
|
+
throw new Error('%LOCALAPPDATA% is not defined');
|
|
17
|
+
return env.LOCALAPPDATA;
|
|
18
|
+
default:
|
|
19
|
+
// The XDG Base Directory specification: an unset or empty
|
|
20
|
+
// XDG_STATE_HOME means ~/.local/state.
|
|
21
|
+
return env.XDG_STATE_HOME || join(home(env), '.local', 'state');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function home(env) {
|
|
25
|
+
if (!env.HOME)
|
|
26
|
+
throw new Error('$HOME is not defined');
|
|
27
|
+
return env.HOME;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=computer-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computer-store.js","sourceRoot":"","sources":["../src/computer-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAuC;IACnE,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,WAAW,CAAC,GAAuC;IAC1D,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC;QAC3D,KAAK,OAAO;YACV,IAAI,CAAC,GAAG,CAAC,YAAY;gBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACxE,OAAO,GAAG,CAAC,YAAY,CAAC;QAC1B;YACE,0DAA0D;YAC1D,uCAAuC;YACvC,OAAO,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;AACH,CAAC;AAED,SAAS,IAAI,CAAC,GAAuC;IACnD,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACvD,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ export { Pool } from './pool.ts';
|
|
|
12
12
|
export type { PoolStats } from './pool-stats.ts';
|
|
13
13
|
export { Resources } from './resources.ts';
|
|
14
14
|
export type { Computer } from './capacity.ts';
|
|
15
|
+
export { computerStore } from './computer-store.ts';
|
|
15
16
|
export type { Sample, Sizing } from './sizing.ts';
|
|
16
17
|
export type { Startup } from './startup.ts';
|
|
17
18
|
export type { Worker } from './worker.ts';
|
|
19
|
+
export { WorkerKind } from './worker-kind.ts';
|
|
18
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAi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EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,4 +9,6 @@ export { OrderedReady } from "./ordered-ready.js";
|
|
|
9
9
|
export { Parallel } from "./parallel.js";
|
|
10
10
|
export { Pool } from "./pool.js";
|
|
11
11
|
export { Resources } from "./resources.js";
|
|
12
|
+
export { computerStore } from "./computer-store.js";
|
|
13
|
+
export { WorkerKind } from "./worker-kind.js";
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/pool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAS1C,qBAAa,IAAI,CAAC,CAAC,SAAS,MAAM,CAAE,YAAW,eAAe;;gBAKhD,OAAO,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,QAAQ,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC,CAAC;QAChB,oHAAoH;QACpH,KAAK,EAAE,KAAK,CAAC;KACd;IAaD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,IAAI,KAAK,IAAI,SAAS,CAErB;IAID,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAiClE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7C"}
|