@awebai/oats 0.70.0 → 0.70.2

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/lib/schedule.mjs CHANGED
@@ -610,8 +610,8 @@ export function resolveScheduledAgent(ws, def) {
610
610
  /** The save-time check of a local spawn job's soul (`add`, `update`): refuse what `oats spawn`
611
611
  * would refuse. A soul already under the agents root is accepted without a child, so offline
612
612
  * adds and stale cached souls stay accepted; any other name goes through spawn's own preview,
613
- * with the job's selectors (a selector the run needs, such as its repo, would otherwise fail
614
- * the preview's checks). */
613
+ * with the job's selectors (a selector the run needs, such as its repo or its yolo, would
614
+ * otherwise fail the preview's checks). */
615
615
  function confirmScheduledSoul(ws, def, io) {
616
616
  const { root, discover } = resolveScheduledAgent(ws, def);
617
617
  if (findAgent(root, def.agent)) return;
@@ -704,7 +704,9 @@ export function workspaceSpawnContext(ws) {
704
704
  catch (e) { return { kind: "local", local: null, dir: ws, error: { code: e.code || "E_WORKSPACE_SCHEMA", message: e.message } }; }
705
705
  }
706
706
  /** The `oats spawn` selectors a spawn job's run passes (beside its purpose, task and launch
707
- * flags), so a preview checks what the run will: one builder for the run and its previews.
707
+ * flag), its yolo among them, so a preview checks what the run will: one builder for the run
708
+ * and its previews. (The yolo is the run's own: a session provider's check is asked with the
709
+ * launch that is planned, and one that launches only in full mode refuses a job by it.)
708
710
  * Every value travels as ONE `--flag=value` token. */
709
711
  function spawnSelectorArgs(opts) {
710
712
  const argv = [];
@@ -713,6 +715,7 @@ function spawnSelectorArgs(opts) {
713
715
  if (opts.model) argv.push(`--model=${opts.model}`);
714
716
  if (opts.backend) argv.push(`--backend=${opts.backend}`);
715
717
  if (opts.repo) argv.push(`--repo=${opts.repo}`);
718
+ if (opts.yolo === true) argv.push("--yolo"); else if (opts.yolo === false) argv.push("--no-yolo");
716
719
  return argv;
717
720
  }
718
721
  /** The kernel's own `oats spawn <agent> --preview --json` in the deployment, with the job's
@@ -751,7 +754,6 @@ function spawnViaCli(ws, root, agent, opts, context, io) {
751
754
  // the soul is the one positional, and an option-shaped one is refused.
752
755
  if (String(agent.name).startsWith("-")) throw scheduleError("E_SCHEDULE_INVALID", `agent: ${JSON.stringify(agent.name)} is not a soul name`, { field: "agent" });
753
756
  const argv = ["spawn", agent.name, `--dir=${context.dir}`, ...(opts.discover ? [] : [`--agents-root=${root}`]), `--purpose=${opts.purpose}`, "--json", ...spawnSelectorArgs(opts)];
754
- if (opts.yolo === true) argv.push("--yolo"); else if (opts.yolo === false) argv.push("--no-yolo");
755
757
  if (opts.launch === false) argv.push("--no-launch");
756
758
  // The task is multi-line text of arbitrary size: it travels as a private file, never in argv.
757
759
  mkdirSync(join(stateDir(ws), "tasks"), { recursive: true });
@@ -502,7 +502,8 @@ const codeMessages = (list) => Array.isArray(list) && list.every((x) => exactKey
502
502
  export function checkProviderSession(binding, input, { io, timeoutMs = sessionProviderTimeout("check") } = {}) {
503
503
  if (!binding.provider.commands.check) return null;
504
504
  const answer = callSessionProvider(binding, "check", input, { io, timeoutMs });
505
- if (!answer.ok) return { unavailable: providerSaid(answer) };
505
+ // (`timedOut`: it did not answer in the time it was given, which a preview counts against its budget.)
506
+ if (!answer.ok) return { unavailable: providerSaid(answer), ...(answer.timedOut ? { timedOut: true } : {}) };
506
507
  const r = answer.result;
507
508
  const sound = exactKeys(r, ["status", "problems"], ["warnings"]) && CHECK_STATUSES.includes(r.status) && codeMessages(r.problems) && (r.warnings === undefined || codeMessages(r.warnings)) && !(r.status === "ready" && r.problems.length);
508
509
  if (!sound) return { unavailable: `${binding.capability}'s session provider ${binding.name} answered check with a result that is not { status, problems, warnings? } in the readiness words` };
@@ -517,12 +518,13 @@ export function checkProviderSession(binding, input, { io, timeoutMs = sessionPr
517
518
  * is planned, `{ harness, yolo, args, sandbox }` as its launch input will carry them, so a provider
518
519
  * can refuse HERE what it would refuse at the launch (a session it would sandbox whose allowances
519
520
  * are `unavailable` or have `missing` entries: only it knows its mode), before a restart stops
520
- * anything. */
521
- export function launchReadinessRefusal(binding, { io, launch } = {}) {
522
- const checked = checkProviderSession(binding, { home: binding.home, soul: null, settings: binding.cap.settings, ...(launch ? { launch } : {}) }, { io });
521
+ * anything. `timeoutMs`: a preview's, what is left of its budget; the refusal of a provider that
522
+ * did not answer in time carries `timedOut`. */
523
+ export function launchReadinessRefusal(binding, { io, launch, timeoutMs } = {}) {
524
+ const checked = checkProviderSession(binding, { home: binding.home, soul: null, settings: binding.cap.settings, ...(launch ? { launch } : {}) }, { io, ...(timeoutMs === undefined ? {} : { timeoutMs }) });
523
525
  if (checked === null || checked.result?.status === "ready") return null;
524
526
  const said = `${binding.capability}'s session provider ${binding.name}`;
525
- if (checked.unavailable) return { code: "E_BACKEND_NOT_READY", message: `${said} is not ready: its readiness could not be read (${checked.unavailable})` };
527
+ if (checked.unavailable) return { code: "E_BACKEND_NOT_READY", message: `${said} is not ready: its readiness could not be read (${checked.unavailable})`, ...(checked.timedOut ? { timedOut: true } : {}) };
526
528
  const own = checked.result.problems.find((x) => /^E_BACKEND_[A-Z0-9_]{1,50}$/.test(x.code));
527
529
  return { code: own?.code ?? "E_BACKEND_NOT_READY", message: `${said} is not ready (${checked.result.status})${checked.result.problems.length ? `: ${checked.result.problems.map((x) => `${x.code}: ${x.message}`).join("; ")}` : ""}` };
528
530
  }
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "oats.aweb": {
10
10
  "url": "https://github.com/awebai/oats-aweb.git",
11
- "ref": "v1.47.0",
11
+ "ref": "v1.48.0",
12
12
  "path": "oats-package"
13
13
  },
14
14
  "oats.jira": {
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "oats.framework": {
50
50
  "url": "https://github.com/awebai/oats.git",
51
- "ref": "oats-framework/v1.28.0",
51
+ "ref": "oats-framework/v1.29.0",
52
52
  "path": "oats-package"
53
53
  }
54
54
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awebai/oats",
3
- "version": "0.70.0",
3
+ "version": "0.70.2",
4
4
  "description": "OATS (Open Agent Team Specification) — durable souls, disposable instances, targetable capability packages, and the runtime-neutral oats CLI/kernel.",
5
5
  "keywords": [
6
6
  "agents",
@@ -29,3 +29,32 @@ export function sessionBackendNames(cli, inspection = null) {
29
29
  const own = Array.isArray(cli?.sessionBackends) ? listedBackends(cli.sessionBackends) : ['tmux'];
30
30
  return [...new Set([...own, ...sessionProviderNames(inspection)])];
31
31
  }
32
+
33
+ /** The session providers that launch only in full mode (`yolo: true`): the provider refuses any other launch
34
+ * at its readiness check (`E_BACKEND_SANDBOXED_MODE`), so a spawn, a schedule's run or a trigger's fire on one
35
+ * without it creates nothing. bb, today (the bb contract, A8: bb homes run in full mode only).
36
+ *
37
+ * THE ONE PLACE a client names them. The kernel does not list this: only the provider knows its mode, and it
38
+ * says so when asked about a planned launch (`oats spawn --preview`, since 0.70.1). A form does not ask that
39
+ * way: the Desktop's preview boundary admits `backend: "tmux"` alone (spawn-preview-contract.mjs
40
+ * `previewChoices`) and a preview may take the provider's whole 20 s, and a soul's readiness asks the check
41
+ * with no launch, so it reads ready. When a provider lifts the refusal, or another one adds it, change this
42
+ * list (or replace it with what the kernel then reports) and nothing else. */
43
+ export const FULL_MODE_ONLY_PROVIDERS = Object.freeze(['bb']);
44
+
45
+ /** Whether `backend` names a provider that launches only in full mode. */
46
+ export const fullModeOnly = (backend) => typeof backend === 'string' && FULL_MODE_ONLY_PROVIDERS.includes(backend);
47
+
48
+ /** What a spawn definition's permission choice means on its backend (`{ backend, yolo }`, as a schedule or a
49
+ * trigger's spawn stores them), for a backend that launches only in full mode:
50
+ *
51
+ * 'refused' `yolo: false`: every launch is refused
52
+ * 'default' no `yolo`: the launch takes its launch configuration's choice (docs/execution-targets.md
53
+ * "Permissions"), so it is refused unless that sets full mode
54
+ * null `yolo: true`, or a backend that takes any mode: nothing to say
55
+ *
56
+ * Pure: no I/O, never throws. */
57
+ export function fullModeProblem(spawn) {
58
+ if (!record(spawn) || !fullModeOnly(spawn.backend) || spawn.yolo === true) return null;
59
+ return spawn.yolo === false ? 'refused' : 'default';
60
+ }
@@ -562,7 +562,7 @@ installed CLI's catalog:
562
562
  node -e 'const c=require(process.argv[1]);console.log(c.packages["oats.framework"].ref,c.packages["oats.aweb"].ref)' "$(oats root)/package-catalog.json"
563
563
  ```
564
564
 
565
- It prints the two refs, for example `oats-framework/v1.28.0 v1.47.0`. If the
565
+ It prints the two refs, for example `oats-framework/v1.29.0 v1.48.0`. If the
566
566
  framework's version (after the `/`) is below `1.19.0`, or with aweb
567
567
  `oats.aweb`'s is below `v1.33.1`, this OATS release is older than this
568
568
  skill: stop, and tell the person to wait for the next OATS
@@ -856,8 +856,8 @@ name: acme
856
856
  members:
857
857
  - git:github.com/acme/acme-oats # the host; the setup expert adds the others
858
858
  packages:
859
- oats.framework: v1.28.0 # the installed CLI's catalog versions (below)
860
- oats.aweb: v1.47.0 # messaging: agent identities, mail and chat
859
+ oats.framework: v1.29.0 # the installed CLI's catalog versions (below)
860
+ oats.aweb: v1.48.0 # messaging: agent identities, mail and chat
861
861
  oats.machine: v0.1.1 # on a machine found-list only: the machine's steward
862
862
  defaults:
863
863
  capabilities: