@awebai/oats 0.69.18 → 0.69.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.
Files changed (52) hide show
  1. package/bin/oats.mjs +2 -2
  2. package/docs/capabilities.md +27 -14
  3. package/docs/container.md +416 -43
  4. package/docs/design/2026-09-27-team-model-v2.md +2 -2
  5. package/docs/design/2026-09-28-automations-trust.md +1 -1
  6. package/docs/desktop-cli-api.md +52 -31
  7. package/docs/desktop.md +29 -6
  8. package/docs/execution-targets.md +32 -17
  9. package/docs/implementation.md +4 -3
  10. package/docs/integrations.md +2 -2
  11. package/docs/knowledge.md +5 -5
  12. package/docs/official-catalog.md +5 -5
  13. package/docs/packages.md +13 -13
  14. package/docs/release-lane.md +6 -4
  15. package/docs/release-notes/v0.69.19.md +172 -0
  16. package/docs/release-notes/v0.69.20.md +325 -0
  17. package/docs/servers.md +6 -4
  18. package/docs/souls-and-instances.md +37 -13
  19. package/docs/tui.md +8 -8
  20. package/docs/upgrading.md +17 -5
  21. package/docs/workspaces.md +13 -7
  22. package/injects/work-directory.md +27 -2
  23. package/injects/work-workspace.md +32 -6
  24. package/lib/core.mjs +33 -197
  25. package/lib/hook-outcome.mjs +6 -0
  26. package/lib/host-run.mjs +24 -19
  27. package/lib/instance-lifecycle.mjs +3 -1
  28. package/lib/instance-listing.mjs +3 -2
  29. package/lib/launch-prompt-fixtures/README.md +6 -0
  30. package/lib/retire-admission.mjs +215 -0
  31. package/lib/servers.mjs +3 -0
  32. package/lib/session-resume-contract.mjs +1 -1
  33. package/lib/session-resume.mjs +130 -47
  34. package/lib/session-seen.mjs +3 -3
  35. package/package-catalog.json +3 -3
  36. package/package.json +3 -1
  37. package/packages/client/attributed-human.mjs +13 -0
  38. package/packages/client/deployment-data.mjs +4 -0
  39. package/packages/client/deployment-panel.mjs +2 -0
  40. package/packages/client/instance-lifecycle.mjs +6 -4
  41. package/packages/client/instance-presentation.mjs +2 -2
  42. package/packages/client/instance-tree.mjs +18 -7
  43. package/packages/client/lifecycle-confirmation.mjs +4 -2
  44. package/packages/client/lifecycle-contract.mjs +11 -6
  45. package/packages/client/remote-roster.mjs +4 -0
  46. package/packages/record/README.md +15 -2
  47. package/packages/record/docs/capture-service.md +14 -0
  48. package/packages/record/lib/canonical.mjs +2 -70
  49. package/packages/record/lib/capture-aw-unit.mjs +14 -3
  50. package/packages/record/lib/capture-aw.mjs +11 -5
  51. package/packages/record/lib/capture-health.mjs +16 -5
  52. package/skills/oats-getting-started/SKILL.md +3 -3
@@ -1,9 +1,9 @@
1
- // Canonical JSON, turn ids, and signature verification for turn.jsonl v1.
1
+ // Canonical JSON, turn ids, and signed-field consistency for turn.jsonl v1.
2
2
  // Contract: docs/turn-record-sot.md in this package. The byte rules intentionally
3
3
  // match awid message signing (sorted keys, minimal separators, no HTML
4
4
  // escaping, ensure_ascii=false) so the same canonical form serves both.
5
5
 
6
- import { createHash, createPublicKey, verify as edVerify } from "node:crypto";
6
+ import { createHash } from "node:crypto";
7
7
 
8
8
  export class CanonicalError extends Error {}
9
9
 
@@ -57,74 +57,6 @@ export function verifyTurnId(turn) {
57
57
  return typeof turn.id === "string" && turnId(turn) === turn.id;
58
58
  }
59
59
 
60
- // --------------------------------------------------------------- did:key
61
-
62
- const B58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
63
-
64
- export function base58Decode(s) {
65
- let n = 0n;
66
- for (const c of s) {
67
- const i = B58_ALPHABET.indexOf(c);
68
- if (i < 0) throw new CanonicalError(`invalid base58 character ${JSON.stringify(c)}`);
69
- n = n * 58n + BigInt(i);
70
- }
71
- const bytes = [];
72
- while (n > 0n) {
73
- bytes.push(Number(n & 0xffn));
74
- n >>= 8n;
75
- }
76
- bytes.reverse();
77
- for (const c of s) {
78
- if (c === "1") bytes.unshift(0);
79
- else break;
80
- }
81
- return Uint8Array.from(bytes);
82
- }
83
-
84
- const ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
85
-
86
- export function publicKeyFromDidKey(did) {
87
- if (!did.startsWith("did:key:z")) throw new CanonicalError(`unsupported did ${did}`);
88
- const decoded = base58Decode(did.slice("did:key:z".length));
89
- if (decoded.length !== 34 || decoded[0] !== 0xed || decoded[1] !== 0x01) {
90
- throw new CanonicalError(`not an ed25519 did:key: ${did}`);
91
- }
92
- return createPublicKey({
93
- key: Buffer.concat([ED25519_SPKI_PREFIX, Buffer.from(decoded.subarray(2))]),
94
- format: "der",
95
- type: "spki",
96
- });
97
- }
98
-
99
- // Base64 signatures arrive unpadded, in either the standard or URL-safe
100
- // alphabet (awid accepts both; so do we).
101
- export function base64DecodeLoose(s) {
102
- const normalized = s.replaceAll("-", "+").replaceAll("_", "/");
103
- const padded = normalized + "=".repeat((4 - (normalized.length % 4)) % 4);
104
- return Buffer.from(padded, "base64");
105
- }
106
-
107
- // Verify an Ed25519 signature by a did:key over utf-8 payload text.
108
- // Returns boolean; malformed inputs are a failed verification, not a throw.
109
- export function verifyDidKeySignature(did, payloadText, signatureB64) {
110
- try {
111
- return edVerify(
112
- null,
113
- Buffer.from(payloadText, "utf8"),
114
- publicKeyFromDidKey(did),
115
- base64DecodeLoose(signatureB64),
116
- );
117
- } catch {
118
- return false;
119
- }
120
- }
121
-
122
- // Verify a turn's envelope signature (`sig` over the canonical core).
123
- export function verifyTurnSig(turn) {
124
- if (!turn.sig) return false;
125
- return verifyDidKeySignature(turn.sig.by, coreString(turn), turn.sig.sig);
126
- }
127
-
128
60
  // Value equality via canonical bytes — `to` may legally be an array, so a
129
61
  // reference compare would flag every multi-recipient turn read from disk.
130
62
  function sameValue(a, b) {
@@ -2,7 +2,7 @@
2
2
  // Explicit per-file public APIs keep their full-reprojection defaults.
3
3
  import { closeSync, constants, fstatSync, openSync } from "node:fs";
4
4
  import { basename } from "node:path";
5
- import { awBoundaryWitness, awLogLines, awStream } from "./capture-aw.mjs";
5
+ import { awBoundaryWitness, awLogLines, awStream, SEALED_AW_LOG_REASON } from "./capture-aw.mjs";
6
6
  import { captureContext } from "./capture-context.mjs";
7
7
  import { CAPTURE_POLICY } from "./capture-budget.mjs";
8
8
  import { fileVersion, statVersion, sameVersion } from "./derived-state.mjs";
@@ -27,7 +27,8 @@ export function captureAwUnit(store, { owner, path, kind = "comm", selfName, wor
27
27
  return { ...result, ignored: true, complete: true };
28
28
  }
29
29
  const blocked = state.get("set-aside", key);
30
- if (blocked && !blocked.retry) return { ...result, setAside: blocked };
30
+ if (blocked && !blocked.retry) return { ...result, setAside: blocked,
31
+ ...(blocked.reason === SEALED_AW_LOG_REASON ? { sealed: 1 } : {}) };
31
32
  const fd = openSync(path, constants.O_RDONLY | constants.O_NONBLOCK);
32
33
  try {
33
34
  const observe = () => {
@@ -85,7 +86,7 @@ export function captureAwUnit(store, { owner, path, kind = "comm", selfName, wor
85
86
  };
86
87
  const project = kind === "comm" ? entry => projectCommLogEntry(entry, { selfName: account }) :
87
88
  entry => projectInteractionLogEntry(entry, { selfName, workspace });
88
- let bytes = 0, records = 0, scanned = false, oversized = null;
89
+ let bytes = 0, records = 0, scanned = false, oversized = null, sealed = null;
89
90
  const turns = [], iterator = awLogLines(chunks(), { start: unitStart, maxBytes: maxRecordBytes, frontier: job.frontier ?? 0 });
90
91
  try {
91
92
  while (records < maxRecords && bytes < maxBytes && !stopped()) {
@@ -93,6 +94,11 @@ export function captureAwUnit(store, { owner, path, kind = "comm", selfName, wor
93
94
  if (next.done) { scanned = true; break; }
94
95
  const record = next.value;
95
96
  if (records && bytes + record.bytes > maxBytes) break;
97
+ if (record.sealed) {
98
+ result.entries++; result.sealed = 1; sealed = record.start;
99
+ if (work) work.sourceRecords = (work.sourceRecords ?? 0) + 1;
100
+ break;
101
+ }
96
102
  records++; bytes += record.bytes; job.bytes = record.end;
97
103
  if (work) work.sourceRecords = (work.sourceRecords ?? 0) + 1;
98
104
  if (record.skipped) result.skipped++;
@@ -125,6 +131,11 @@ export function captureAwUnit(store, { owner, path, kind = "comm", selfName, wor
125
131
  if (blocked && (job.bytes > blocked.offset || atEnd)) state.delete("set-aside", key);
126
132
  if (scanned || atEnd) state.delete("aw-unit", key);
127
133
  else state.set("aw-unit", key, job);
134
+ if (sealed !== null) {
135
+ const row = { owner, source: "aw", path, offset: sealed, reason: SEALED_AW_LOG_REASON, retry: false };
136
+ state.set("set-aside", key, row);
137
+ return { ...result, setAside: row };
138
+ }
128
139
  if (oversized !== null) {
129
140
  // Not captured past its exact start. Later records wait for an edited
130
141
  // source or an ignore of the whole input.
@@ -29,6 +29,8 @@ import {
29
29
  import { loadIgnore } from "./ignore.mjs";
30
30
  import { bufferLines, fileChunks } from "./file-lines.mjs";
31
31
 
32
+ export const SEALED_AW_LOG_REASON = "sealed, not readable by this recorder";
33
+
32
34
  export function defaultCommLogDir(home = homedir()) {
33
35
  return join(home, ".config", "aw", "logs");
34
36
  }
@@ -52,7 +54,7 @@ export function listCommLogs(dir = defaultCommLogDir()) {
52
54
  // interior bad line is skipped and counted (`onSkipped`), never fatal.
53
55
  function* logEntries(fd, start, end, onSkipped, onConsumed) {
54
56
  for (const record of awLogLines(fileChunks(fd, { start, end, size: 65536 }), { start })) {
55
- if (!record.final) onConsumed(record.end);
57
+ if (!record.final && !record.sealed) onConsumed(record.end);
56
58
  if (record.skipped) onSkipped();
57
59
  if (record.parsed) yield record;
58
60
  }
@@ -74,7 +76,10 @@ export function* awLogLines(chunks, { start = 0, maxBytes = Infinity, frontier =
74
76
  const text = line.toString("utf8");
75
77
  if (text.trim() === "") { yield record; continue; }
76
78
  const entry = JSON.parse(text);
77
- yield { ...record, entry, parsed: true };
79
+ // Sealed aw client-log envelopes are ciphertext, not projection errors.
80
+ const sealed = entry !== null && typeof entry === "object" &&
81
+ ["v", "key_id", "enc", "ct"].every(key => Object.hasOwn(entry, key));
82
+ yield { ...record, entry, parsed: true, ...(sealed ? { sealed: true } : {}) };
78
83
  } catch {
79
84
  yield { ...record, skipped: !final };
80
85
  }
@@ -117,7 +122,7 @@ function captureLogFile(store, { streamId, path, project, knownIds, incremental
117
122
  if (old.dev === version.dev && old.ino === version.ino && (version.size > old.size || sameVersion(old, version)) &&
118
123
  previous.bytes <= end && boundaryWitness(fd, previous.bytes) === previous.witness) start = previous.bytes;
119
124
  }
120
- let entries = 0, skipped = 0, failed = 0, appended = 0, batch = [], batchBytes = 0, consumed = start, complete = false;
125
+ let entries = 0, skipped = 0, failed = 0, appended = 0, batch = [], batchBytes = 0, consumed = start, complete = false, sealed = 0;
121
126
  const checkpoint = () => {
122
127
  if (!incremental) return;
123
128
  const bytes = consumed;
@@ -141,6 +146,7 @@ function captureLogFile(store, { streamId, path, project, knownIds, incremental
141
146
  flush(); consumed = scanned;
142
147
  }
143
148
  entries++;
149
+ if (record.sealed) { consumed = record.start; sealed++; break; }
144
150
  let turn;
145
151
  // Projection refusal consumes this complete entry just like a skipped
146
152
  // malformed line. Resetting source cursors is the explicit retry path;
@@ -154,9 +160,9 @@ function captureLogFile(store, { streamId, path, project, knownIds, incremental
154
160
  }
155
161
  // Complete refused/malformed/blank lines are consumed; an unfinished final
156
162
  // fragment keeps its starting boundary so later growth can finish it.
157
- complete = true;
163
+ complete = sealed === 0;
158
164
  flush();
159
- return { entries, appended, skipped, failed };
165
+ return { entries, appended, skipped, failed, ...(sealed ? { sealed } : {}) };
160
166
  } finally { try { if (!captureContext(store)) state?.close(); } finally { closeSync(fd); } }
161
167
  }
162
168
 
@@ -1,5 +1,6 @@
1
1
  // Package-owned offline diagnosis. No writable DB/store, lock acquisition,
2
2
  // manager, repair or capture; warnings never publish new run evidence.
3
+ import { SEALED_AW_LOG_REASON } from "./capture-aw.mjs";
3
4
  import { homedir, hostname, platform as hostPlatform } from "node:os";
4
5
  import { join } from "node:path";
5
6
  import { readCaptureStatus } from "./capture-status.mjs";
@@ -14,6 +15,7 @@ export const SET_ASIDE_REMEDY = setAsideRemedy("turn-record", "<root>");
14
15
  // Retry re-reads an unchanged oversized record and sets it aside again: only an
15
16
  // edited source or an ignore of the whole input moves past it.
16
17
  const oversizedRemedy = (command, root) => `Edit the source so no record exceeds 8 MiB, leaving its captured prefix unchanged, then run ${command} capture --retry-set-aside; or add the whole input to ${root}/ignore, which discards the whole input, its records after the oversized one included, and later turns from that session.`;
18
+ const sealedRemedy = (command, root) => `supply a readable source and run ${command} capture --retry-set-aside, or add the source to ${join(root, "ignore")}; retry cannot decrypt ciphertext.`;
17
19
  // The one rule for remedy wording: the kernel's own entry points say `oats`,
18
20
  // the standalone package says `turn-record`. Each entry point states which it is.
19
21
  export const captureRemedyCommand = viaKernel => viaKernel ? "oats" : "turn-record";
@@ -77,11 +79,20 @@ function diagnose(root, { home = homedir(), platform = hostPlatform(), now = Dat
77
79
  // Remedies follow each listed entry's reason. Reasons beyond the bounded
78
80
  // sample are unknown here, so a truncated list says so rather than guess.
79
81
  const oversized = backlog.setAside.filter(entry => entry.reason === "record-too-large").length;
80
- const others = backlog.setAsideCount - oversized, general = setAsideRemedy(command, root);
81
- const message = !oversized ? general + (backlog.truncated ? ` Unlisted entries: see each entry's reason; record-too-large entries need: ${oversizedRemedy(command, root)}` : "") :
82
- `${oversized} listed as record-too-large: ${oversizedRemedy(command, root)}` + (!others ? "" : backlog.truncated ?
83
- ` The other ${others}, including unlisted entries: see each entry's reason; record-too-large entries need the edit-or-ignore remedy above. Otherwise: ${general}` :
84
- ` The other ${others}: ${general}`);
82
+ const sealed = backlog.setAside.filter(entry => entry.reason === SEALED_AW_LOG_REASON).length;
83
+ const others = backlog.setAsideCount - oversized - sealed;
84
+ const general = setAsideRemedy(command, root), parts = [];
85
+ if (oversized) parts.push(`${oversized} listed as record-too-large: ${oversizedRemedy(command, root)}`);
86
+ if (sealed) parts.push(`${sealed} listed as ${SEALED_AW_LOG_REASON}: ${sealedRemedy(command, root)}`);
87
+ if (!parts.length) parts.push(general);
88
+ else if (others) {
89
+ if (backlog.truncated) {
90
+ const oversizedNote = oversized ? "record-too-large entries need the edit-or-ignore remedy above. " : "";
91
+ parts.push(`The other ${others}, including unlisted entries: see each entry's reason; ${oversizedNote}Otherwise: ${general}`);
92
+ } else parts.push(`The other ${others}: ${general}`);
93
+ }
94
+ if (backlog.truncated) parts.push(`Unlisted entries: see each entry's reason; record-too-large entries need: ${oversizedRemedy(command, root)} Sealed entries (${SEALED_AW_LOG_REASON}) need: ${sealedRemedy(command, root)}`);
95
+ const message = parts.join(" ");
85
96
  rows.push({ code: "capture-input-set-aside", message: `${backlog.setAsideCount} capture inputs set aside. ${message}` });
86
97
  }
87
98
 
@@ -533,7 +533,7 @@ installed CLI's catalog:
533
533
  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"
534
534
  ```
535
535
 
536
- It prints the two refs, for example `oats-framework/v1.25.0 v1.41.0`. If the
536
+ It prints the two refs, for example `oats-framework/v1.26.0 v1.42.1`. If the
537
537
  framework's version (after the `/`) is below `1.19.0`, or with aweb
538
538
  `oats.aweb`'s is below `v1.33.1`, this OATS release is older than this
539
539
  skill: stop, and tell the person to wait for the next OATS
@@ -770,8 +770,8 @@ name: acme
770
770
  members:
771
771
  - git:github.com/acme/acme-oats # the host; the setup expert adds the others
772
772
  packages:
773
- oats.framework: v1.25.0 # the installed CLI's catalog versions (below)
774
- oats.aweb: v1.41.0 # messaging: agent identities, mail and chat
773
+ oats.framework: v1.26.0 # the installed CLI's catalog versions (below)
774
+ oats.aweb: v1.42.1 # messaging: agent identities, mail and chat
775
775
  oats.machine: v0.1.1 # on a machine found-list only: the machine's steward
776
776
  defaults:
777
777
  capabilities: