@operad-io/pool 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @operad-io/pool
2
+
3
+ **The pool plugin: workers shared by runs.** Shares a set of workers between runs so that each agent's limits are kept across flows.
4
+
5
+ This package is part of [operad](https://github.com/operad-io/operad). Most people install only [`@operad-io/cli`](https://www.npmjs.com/package/@operad-io/cli).
6
+
7
+ ## Documentation
8
+
9
+ - User guide: [docs/user/dev.md](https://github.com/operad-io/operad/blob/main/docs/user/dev.md)
10
+ - Website: <https://operad.io>
11
+
12
+ MIT licensed.
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@operad-io/pool",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
7
7
  },
8
8
  "dependencies": {
9
- "@operad-io/engine": "0.0.1"
9
+ "@operad-io/engine": "0.1.1"
10
10
  },
11
- "description": "operad: the pool plugin, workers shared by runs (in development)",
11
+ "description": "operad: the pool plugin, workers shared by runs",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/operad-io/operad.git",
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  * its own `count` in the repository and the home-wide cap on its harness.
6
6
  */
7
7
 
8
+ import pkg from "../package.json" with { type: "json" };
8
9
  import { definePlugin, isRecord, type PluginStepResult, type StepContext, type StepRunOptions } from "@operad-io/engine";
9
10
  import { reportWorkerPlaced } from "@operad-io/engine/platform";
10
11
  import { join } from "node:path";
@@ -204,7 +205,7 @@ export function createPoolPlugin(options: PoolPluginOptions = {}) {
204
205
  return definePlugin({
205
206
  name: "pool",
206
207
  kind: "stage",
207
- version: "0.0.0",
208
+ version: pkg.version,
208
209
  settings: POOL_SETTINGS,
209
210
  steps: [
210
211
  {
@@ -274,11 +275,15 @@ export function createPoolPlugin(options: PoolPluginOptions = {}) {
274
275
  const first = await attempt(ctx, prefix, candidates, params, options);
275
276
  if (first.kind === "aborted") return interrupted();
276
277
  const name = first.worker.fallback;
278
+ // A throw is not a trigger: the harness reports a process that
279
+ // cannot start as a failed result with reason `missing` or `spawn`,
280
+ // and anything else thrown is the step's own error. It fails the
281
+ // work, as it does when the worker has no fallback.
277
282
  const triggered =
278
283
  name !== undefined &&
279
284
  !ctx.signal.aborted &&
280
- (first.kind === "threw" ||
281
- modelUnavailable(first.result.data) ||
285
+ first.kind === "result" &&
286
+ (modelUnavailable(first.result.data) ||
282
287
  (first.result.result === "failed" && harnessDidNotStart(first.result.data)));
283
288
  if (!triggered) {
284
289
  if (first.kind === "threw") throw first.error;