@rulvar/planner 1.22.0 → 1.24.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.
Files changed (2) hide show
  1. package/dist/index.js +35 -5
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as compileScript, r as scriptDiagnosticsOf, t as SANDBOX_GLOBALS } from "./compile-BtCY9wfO.js";
2
- import { ConfigError, InMemoryStore, SandboxError, ScriptRejected, createEngine, createSandboxBridge, defineWorkflow, toJournalValue } from "@rulvar/core";
2
+ import { ConfigError, InMemoryStore, SANDBOX_AGENT_OPT_KEYS, SandboxError, ScriptRejected, createEngine, createSandboxBridge, defineWorkflow, toJournalValue } from "@rulvar/core";
3
3
  import { createHash } from "node:crypto";
4
4
  import { Linter } from "eslint";
5
5
  import { toJsonDiagnostics, workflowsConfig } from "eslint-plugin-rulvar";
@@ -11,6 +11,21 @@ import { MessageChannel, Worker } from "node:worker_threads";
11
11
  * pure constant, byte-stable across runs; plan() (M6-T05) composes it
12
12
  * with profileCard(registry) and the goal. The usage examples are
13
13
  * distilled from the runnable examples/ corpus (M5-T09).
14
+ *
15
+ * The agent opts line is GENERATED from the runtime allowlist
16
+ * (`SANDBOX_AGENT_OPT_KEYS` in @rulvar/core), so the card can never
17
+ * drift from what the sandbox bridge actually accepts (v1.22.0 review
18
+ * P2-4: the hand-maintained list had silently fallen three options
19
+ * behind, and the card claimed identical calls journal as one result,
20
+ * which the ordinal semantics contradict).
21
+ *
22
+ * The tools and model semantics are pinned by the v1.23.0 review:
23
+ * string entries of `tools` are registered TOOLSET names (the profile
24
+ * card prints the valid set; profile names there are agentType values,
25
+ * and runtime resolution rejects them as unknown toolsets before any
26
+ * provider call), and `model`/`routing` are normally omitted because
27
+ * the profile card never names models, so the planner has no valid ref
28
+ * source unless the goal text itself supplies an allowlist.
14
29
  */
15
30
  const CARD = [
16
31
  "You write ONE JavaScript async-function BODY (the workflow script).",
@@ -18,11 +33,18 @@ const CARD = [
18
33
  "",
19
34
  "Available globals (the COMPLETE list; nothing else exists):",
20
35
  "- agent(prompt, opts?) -> Promise<value>: one subagent call.",
21
- " opts (JSON only): { agentType?, model?, effort?, schema?, tools?, onError?, label?, key?, estCost?, limits?, escalation?, fallback?, result? }",
36
+ ` opts (JSON only): { ${SANDBOX_AGENT_OPT_KEYS.map((key) => `${key}?`).join(", ")} }`,
22
37
  " - schema: a JSON Schema LITERAL (never a library value); the result is the validated object.",
23
- " - tools: an array of registered profile NAMES (strings only).",
38
+ " - tools: an array of registered TOOLSET names, exactly the ones the profile card lists;",
39
+ " never agent profile names (an unknown name is a typed error before any call).",
24
40
  " - onError: 'throw' | 'null' (default 'null'; a failed call yields null and the loss is recorded).",
25
- " - model: a string; agentType: a registered profile name from the profile card.",
41
+ " - agentType: a registered profile name from the profile card.",
42
+ " - model and routing: normally OMIT BOTH; the host profiles and routing decide models,",
43
+ " and the profile card never names any. Use them only when the goal text itself lists",
44
+ " allowed model refs (then routing maps invocation role to one of them, e.g.",
45
+ " { summarize: '<allowed ref>' }, and wins over the profile's own routing).",
46
+ " - memoizeOutcome: true journals this exact outcome for replay on resume EVEN when it failed (default: failures rerun).",
47
+ " - replay: 'cache' | 'never'; 'never' forces a fresh live call on every resume, 'cache' reuses any matching prior.",
26
48
  "- parallel(fns, opts?) -> Promise<values[]>: concurrent branches; fns is an array of async functions.",
27
49
  " opts: { settle?: true } returns settled outcomes instead of throwing on the first failure.",
28
50
  "- pipeline(items, ...stageFns, opts?) -> Promise<results[]>: streams items through stages.",
@@ -42,7 +64,11 @@ const CARD = [
42
64
  "- Date.now() and Math.random() ARE the seeded shims; still prefer now() and random().",
43
65
  "- Never put functions inside option objects; options are pure JSON.",
44
66
  "- Policies are declarative JSON rule tables; ladders are JSON.",
45
- "- Identical calls with identical arguments journal as ONE result; pass { key } to repeat deliberately.",
67
+ "- Every call journals as its OWN operation: identical calls share a content key but take",
68
+ " sequential ordinals (0, 1, 2, ...), so repeats always RUN, never dedupe.",
69
+ "- For deliberate repeats still pass a distinguishing { key }: it binds each result to its",
70
+ " call by identity instead of position, so editing or reordering the script cannot attach",
71
+ " an old result to the wrong call on resume.",
46
72
  "",
47
73
  "Patterns (from the runnable corpus):",
48
74
  "- Adversarial panel:",
@@ -295,6 +321,10 @@ var WorkerSandboxRunner = class {
295
321
  }
296
322
  if (message.t === "fail") {
297
323
  const wire = message.error;
324
+ if (wire.code === "config") {
325
+ settleErr(new ConfigError(wire.message));
326
+ return;
327
+ }
298
328
  const rebuilt = new Error(wire.message);
299
329
  rebuilt.name = wire.code;
300
330
  settleErr(rebuilt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/planner",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "description": "Rulvar flagship hybrid mode: plan agent, compileScript, WorkerSandboxRunner, self-repair loop.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -23,14 +23,14 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "eslint": "^9.39.4",
26
- "eslint-plugin-rulvar": "1.22.0",
27
- "@rulvar/core": "1.22.0"
26
+ "@rulvar/core": "1.24.0",
27
+ "eslint-plugin-rulvar": "1.24.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^22.20.0",
31
31
  "tsdown": "^0.22.3",
32
32
  "typescript": "~6.0.3",
33
- "@rulvar/testing": "1.22.0"
33
+ "@rulvar/testing": "1.24.0"
34
34
  },
35
35
  "repository": {
36
36
  "type": "git",