@awebai/oats 0.43.3 → 0.44.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.
Files changed (34) hide show
  1. package/bin/oats.mjs +98 -27
  2. package/docs/capabilities.md +7 -1
  3. package/docs/configuration.md +65 -0
  4. package/docs/desktop-cli-api.md +149 -4
  5. package/docs/desktop.md +47 -0
  6. package/docs/execution-targets.md +75 -0
  7. package/docs/implementation.md +14 -1
  8. package/docs/oats-local.schema.json +19 -1
  9. package/docs/oats-workspace.schema.json +1 -1
  10. package/docs/release-notes/v0.44.0.md +161 -0
  11. package/docs/release-notes/v0.44.1.md +47 -0
  12. package/docs/schedules.md +27 -9
  13. package/docs/souls-and-instances.md +7 -0
  14. package/lib/core.mjs +253 -87
  15. package/lib/instance-events.mjs +1 -1
  16. package/lib/instance-inspect.mjs +39 -6
  17. package/lib/launch-prompt-fixtures/README.md +49 -0
  18. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/frame-05-channel-seeded.txt +35 -0
  19. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/frame-06-first-after-channel.txt +35 -0
  20. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/frame-07-after-channel-200ms.txt +35 -0
  21. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/frame-08-installed-after-channel-200ms.txt +35 -0
  22. package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/manifest.json +77 -0
  23. package/lib/launch-prompt-fixtures.mjs +114 -0
  24. package/lib/launch-prompt-policy.mjs +73 -0
  25. package/lib/launch-prompt-transport.mjs +102 -0
  26. package/lib/launch-prompts.mjs +216 -0
  27. package/lib/operator-coverage.mjs +134 -0
  28. package/lib/remote.mjs +15 -9
  29. package/lib/schedule.mjs +57 -10
  30. package/lib/teams-verbs.mjs +3 -3
  31. package/lib/triggers.mjs +2 -2
  32. package/lib/workspace.mjs +20 -2
  33. package/package.json +1 -1
  34. package/skills/oats-getting-started/SKILL.md +15 -0
@@ -11,12 +11,11 @@ import { readFileSync } from "node:fs";
11
11
  import YAML from "yaml";
12
12
  import { parseConfigData } from "./config-data.mjs";
13
13
  import { oatsError } from "./errors.mjs";
14
- import { validateLocal } from "./workspace.mjs";
14
+ import { teamLabelProblem, validateLocal } from "./workspace.mjs";
15
15
  import { TEAM_ID_RE, localTeamsClosed, soulTeams, teamModel, teamProblems, teamReferences } from "./teams.mjs";
16
16
  import { writeFileAtomic } from "./packages.mjs";
17
17
 
18
18
  export const TEAMS_API = 2, SOUL_TEAMS_API = 2;
19
- const LABEL_RE = /^[a-z0-9][a-z0-9._-]*$/;
20
19
  const isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
21
20
  const byCodepoint = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
22
21
  function fail(code, message, details) { const e = oatsError(code, message, details); e.details = details; return e; }
@@ -125,7 +124,8 @@ function editLocal(ctx, { verb, writes }, mutate) {
125
124
  }
126
125
 
127
126
  const assertLabel = (label) => {
128
- if (typeof label !== "string" || !LABEL_RE.test(label)) throw fail("E_BAD_ARGS", `${JSON.stringify(label)} is not a team label (lowercase letters, digits, and . _ - after the first)`, { label });
127
+ const problem = teamLabelProblem(label);
128
+ if (problem) throw fail("E_BAD_ARGS", `not a team label (lowercase letters, digits, and . _ - after the first; at most 64 characters): ${problem}`, { label });
129
129
  };
130
130
 
131
131
  /** `oats teams add <label> --team <id> [--description <d>]` → { changed, local }. */
package/lib/triggers.mjs CHANGED
@@ -32,6 +32,7 @@ import { readDefinitions, writeDefinitions, stateDir, withScopeLock, childEnv, p
32
32
  import { herdrSettingRemoved } from "./errors.mjs";
33
33
  import { MODEL_RE, automationError, baseRow, localEntry, localId, parseOwner, qualifiedId, soulOriginOf, validateDescription } from "./automations.mjs";
34
34
  import { lockedPackageRef } from "./packages.mjs";
35
+ import { teamLabelProblem } from "./workspace.mjs";
35
36
 
36
37
  export const TRIGGER_API = 1;
37
38
  export const TRIGGER_SOURCES = Object.freeze(["github.pull_request"]);
@@ -39,7 +40,6 @@ export const PR_EVENTS = Object.freeze(["opened", "reopened", "ready_for_review"
39
40
  /** The ONLY fields a purpose/task template may name. */
40
41
  export const TEMPLATE_FIELDS = Object.freeze(["repo", "number", "url", "event", "headSha", "trigger"]);
41
42
  const ID_RE = /^[a-z0-9-]{1,40}$/;
42
- const LABEL_RE = /^[a-z0-9][a-z0-9._-]*$/;
43
43
  const SOUL_RE = /^(?:[a-z0-9][a-z0-9._-]*\/)?[a-z0-9]+(?:-[a-z0-9]+)*$/;
44
44
  const HARNESSES = new Set(["pi", "claude", "codex"]);
45
45
  /** A launch configuration name (oats-local.yaml launch-configs, docs/oats-local.schema.json). */
@@ -121,7 +121,7 @@ export function validateTrigger(def, { backendSource = "the trigger's spawn.back
121
121
  if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(sample) || sample.length > 40) throw invalid("spawn.purpose", `must render to a slug of at most 40 characters (use {number}, {event} or {trigger}); "${purpose}" renders like "${sample}"`);
122
122
  checkTemplate(sp.task, "spawn.task");
123
123
  const teams = sp.teams === undefined ? [] : sp.teams;
124
- if (!Array.isArray(teams) || teams.some((t) => typeof t !== "string" || !LABEL_RE.test(t)) || new Set(teams).size !== teams.length) throw invalid("spawn.teams", "a list of distinct team labels");
124
+ if (!Array.isArray(teams) || teams.some((t) => teamLabelProblem(t) !== null) || new Set(teams).size !== teams.length) throw invalid("spawn.teams", "a list of distinct team labels");
125
125
  if (sp.launchConfig !== undefined && (typeof sp.launchConfig !== "string" || !LAUNCH_CONFIG_RE.test(sp.launchConfig))) throw invalid("spawn.launchConfig", "the name of a launch configuration on the running host (oats-local.yaml launch-configs)");
126
126
  if (sp.harness !== undefined && !HARNESSES.has(sp.harness)) throw invalid("spawn.harness", "pi, claude or codex");
127
127
  if (sp.model !== undefined && (typeof sp.model !== "string" || !MODEL_RE.test(sp.model))) throw invalid("spawn.model", "a model id: a letter or digit, then letters, digits and . _ : / @ + - [ ] (at most 128 characters)");
package/lib/workspace.mjs CHANGED
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { readFileSync, existsSync } from "node:fs";
14
14
  import { dirname, join, resolve } from "node:path";
15
+ import { launchPromptPolicyProblems } from "./launch-prompt-policy.mjs";
15
16
  import { recordLocalInput } from "./local-inputs.mjs";
16
17
  import { parseConfigData } from "./config-data.mjs";
17
18
  import { oatsError } from "./errors.mjs";
@@ -129,7 +130,7 @@ export function validateAgainst(schema, value, { root = schema, path = "" } = {}
129
130
  }
130
131
  if (typeof v === "string") {
131
132
  if (s.minLength !== undefined && v.length < s.minLength) push(p, `must be at least ${s.minLength} character(s)`);
132
- if (s.maxLength !== undefined && v.length > s.maxLength) push(p, `must be at most ${s.maxLength} character(s)`);
133
+ if (s.maxLength !== undefined && v.length > s.maxLength) push(p, `${show(v.length > 80 ? `${v.slice(0, 80)}…` : v)} is ${v.length} characters: must be at most ${s.maxLength}`);
133
134
  if (s.pattern && !regexOf(s.pattern).test(v)) push(p, `${show(v)} does not match ${s.pattern}`);
134
135
  } else if (typeof v === "number") {
135
136
  if (s.minimum !== undefined && v < s.minimum) push(p, `must be >= ${s.minimum}`);
@@ -260,6 +261,12 @@ function sharedLabelProblems(value, problems) {
260
261
  if (Array.isArray(entry.teams)) entry.teams.forEach((label, i) => known(label, `${at}/teams/${i}`));
261
262
  }
262
263
  }
264
+ /** A team label as both schemas define it ($defs.label: the pattern, at most 64 characters): null when valid, else
265
+ * the problem. Every kernel place that accepts a label checks it here, never with its own grammar. */
266
+ export function teamLabelProblem(label) {
267
+ const problems = validateAgainst(schemaFor("workspace").$defs.label, label);
268
+ return problems.length ? problems.map((x) => x.message).join("; ") : null;
269
+ }
263
270
  export function validateMembership(value) { return withRemovedKeys(validateAgainst(schemaFor("membership"), value), value, REMOVED_KEYS.membership); }
264
271
 
265
272
  /** Keys 0.30 (team model v2) and 0.38.0 (team model 3) removed: each is a schema problem naming its replacement, in place of
@@ -320,7 +327,8 @@ function fromProblems(remote, capabilities, path, problems, { here }) {
320
327
  if (key !== from) problems.push({ path: at, message: `${show(from)} is not a canonical repo key (expected <host>/<path> as parseRepoRef(...).key${key ? `, e.g. ${show(key)}` : ""}); \`here\`, \`package\` or a key are the only forms` });
321
328
  }
322
329
  }
323
- /** Schema + domain problems for an oats-local.yaml value: settings[<cap>] may not carry the removed `byTeam` key. */
330
+ /** Schema + domain problems for oats-local.yaml: reserved provider keys and
331
+ * filesystem-dependent canonical home paths supplement the JSON schema. */
324
332
  export function validateLocal(value) {
325
333
  const problems = withRemovedKeys(validateAgainst(schemaFor("local"), value), value, REMOVED_KEYS.local);
326
334
  if (isObject(value) && isObject(value.settings)) for (const [cap, payload] of Object.entries(value.settings)) reservedKeyProblems(payload, `/settings/${pointerKey(cap)}`, problems);
@@ -331,6 +339,16 @@ export function validateLocal(value) {
331
339
  problems.push({ path: `/launch-configs/${pointerKey(name)}/runtime`, reason: "harness-conflict", message: `harness ${show(entry.harness)} and runtime ${show(entry.runtime)} disagree: \`runtime\` is the pre-0.27 name of \`harness\` — keep one` });
332
340
  }
333
341
  }
342
+ if (isObject(value) && Object.hasOwn(value, "launchPromptAnswers")) {
343
+ // Shape is checked by the schema; add filesystem-dependent canonical-home checks.
344
+ for (const problem of launchPromptPolicyProblems(value.launchPromptAnswers)) {
345
+ if (problem.reason === "unsupported-launch-prompt") {
346
+ const index = problems.findIndex((p) => p.path === problem.path);
347
+ if (index !== -1) problems.splice(index, 1);
348
+ problems.push(problem);
349
+ } else if (problem.reason === "noncanonical-home") problems.push(problem);
350
+ }
351
+ }
334
352
  return problems;
335
353
  }
336
354
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awebai/oats",
3
- "version": "0.43.3",
3
+ "version": "0.44.1",
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",
@@ -171,6 +171,21 @@ oats spawn backend-expert --task "First concrete task"
171
171
  oats status
172
172
  ```
173
173
 
174
+ Before configuring unattended development-channel confirmation, read
175
+ `docs/configuration.md#exact-home-launch-prompt-consent`. The sole opt-in is
176
+ `oats-local.yaml` `launchPromptAnswers.homes.<absolute-canonical-home>.awebDevelopmentChannel`;
177
+ it defaults false and requires the owner's explicit authorization for that home.
178
+ Never infer consent from provider development mode, harness trust settings or
179
+ a request to spawn. `workspaceTrust` is unsupported; remove it and handle
180
+ folder trust with the harness (separate automation work: oats#712). Folder-trust
181
+ and API-key questions remain unexpected and blocked. Only the qualified Claude
182
+ 2.1.289 executable digest, `darwin-arm64` platform and 110x35 geometry documented
183
+ there can match the exact aweb development-channel frame. A reported version
184
+ alone is insufficient. Preview reports policy without terminal input;
185
+ `--no-launch` never answers. If launch returns `E_SPAWN_INCOMPLETE`, inspect the
186
+ retained home/pane: do not respawn, repeat keys or treat `launched:false` as an
187
+ absent process.
188
+
174
189
  Create and spawn only when asked. After the first spawn, the `oats.setup`
175
190
  skills carry the rest of the deployment (messaging, more souls, rebuilds); the
176
191
  `oats.authoring` package teaches writing capabilities, skills and souls. The