@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.
- package/bin/oats.mjs +2 -2
- package/docs/capabilities.md +27 -14
- package/docs/container.md +416 -43
- package/docs/design/2026-09-27-team-model-v2.md +2 -2
- package/docs/design/2026-09-28-automations-trust.md +1 -1
- package/docs/desktop-cli-api.md +52 -31
- package/docs/desktop.md +29 -6
- package/docs/execution-targets.md +32 -17
- package/docs/implementation.md +4 -3
- package/docs/integrations.md +2 -2
- package/docs/knowledge.md +5 -5
- package/docs/official-catalog.md +5 -5
- package/docs/packages.md +13 -13
- package/docs/release-lane.md +6 -4
- package/docs/release-notes/v0.69.19.md +172 -0
- package/docs/release-notes/v0.69.20.md +325 -0
- package/docs/servers.md +6 -4
- package/docs/souls-and-instances.md +37 -13
- package/docs/tui.md +8 -8
- package/docs/upgrading.md +17 -5
- package/docs/workspaces.md +13 -7
- package/injects/work-directory.md +27 -2
- package/injects/work-workspace.md +32 -6
- package/lib/core.mjs +33 -197
- package/lib/hook-outcome.mjs +6 -0
- package/lib/host-run.mjs +24 -19
- package/lib/instance-lifecycle.mjs +3 -1
- package/lib/instance-listing.mjs +3 -2
- package/lib/launch-prompt-fixtures/README.md +6 -0
- package/lib/retire-admission.mjs +215 -0
- package/lib/servers.mjs +3 -0
- package/lib/session-resume-contract.mjs +1 -1
- package/lib/session-resume.mjs +130 -47
- package/lib/session-seen.mjs +3 -3
- package/package-catalog.json +3 -3
- package/package.json +3 -1
- package/packages/client/attributed-human.mjs +13 -0
- package/packages/client/deployment-data.mjs +4 -0
- package/packages/client/deployment-panel.mjs +2 -0
- package/packages/client/instance-lifecycle.mjs +6 -4
- package/packages/client/instance-presentation.mjs +2 -2
- package/packages/client/instance-tree.mjs +18 -7
- package/packages/client/lifecycle-confirmation.mjs +4 -2
- package/packages/client/lifecycle-contract.mjs +11 -6
- package/packages/client/remote-roster.mjs +4 -0
- package/packages/record/README.md +15 -2
- package/packages/record/docs/capture-service.md +14 -0
- package/packages/record/lib/canonical.mjs +2 -70
- package/packages/record/lib/capture-aw-unit.mjs +14 -3
- package/packages/record/lib/capture-aw.mjs +11 -5
- package/packages/record/lib/capture-health.mjs +16 -5
- package/skills/oats-getting-started/SKILL.md +3 -3
package/lib/session-resume.mjs
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* - Only a loss the kernel can vouch for is resumed (lib/session-seen.mjs resumeEligible, from what
|
|
11
11
|
* local listings recorded of the home): seen running for its current start, not judged by an
|
|
12
12
|
* earlier sweep, first seen lost less than 24 hours ago, and, within one boot, lost less than 24
|
|
13
|
-
* hours after it was last seen running. Any other is `skipped`, `not-seen-recently`. A
|
|
13
|
+
* hours after it was last seen running. Any other is `skipped`, `not-seen-recently`. A home the
|
|
14
|
+
* sweep started is recorded as seen running for its new start. A sweep that
|
|
14
15
|
* is not a plan judges each lost home it answered (`judgedBy`), so it is answered once.
|
|
15
16
|
* - Each home starts as a child process of this kernel (`session start --resume --home <home>
|
|
16
17
|
* --json`, its cwd the home's deployment), so each start resolves its own deployment's scope; at
|
|
@@ -20,18 +21,31 @@
|
|
|
20
21
|
* and boot id; a lock whose holder is gone, or that was taken in another boot, is taken over at
|
|
21
22
|
* once. A second sweep answers E_RESUME_BUSY; a lock that needs a person, E_RESUME_LOCK_STUCK,
|
|
22
23
|
* which `oats doctor` reports too (acquireResumeLock, resumeLockProblem).
|
|
23
|
-
* - No retry storm
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `keeps-getting-lost` without a start
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
24
|
+
* - No retry storm, and no loss given up for a cause that passes.
|
|
25
|
+
* A start counts when it launched something (`resumed`, `fresh`, `blocked`), noted as soon as
|
|
26
|
+
* that start has answered, so a sweep that is killed while other starts run has counted the
|
|
27
|
+
* ones that answered. A home is started by sweeps at most RESUME_LIMIT times in
|
|
28
|
+
* RESUME_WINDOW_MS (counted by home: each start makes a new start id), then reported
|
|
29
|
+
* `keeps-getting-lost` without a start, with `nextAttemptAt`: when the oldest counted start
|
|
30
|
+
* leaves the window a sweep starts it again.
|
|
31
|
+
* That is not for ever: a home that uses up its starts in RESUME_SPENT_HOURS hours in a row
|
|
32
|
+
* is answered `keeps-getting-lost` with no `nextAttemptAt`, and that loss is judged: no sweep
|
|
33
|
+
* starts it again, and a person does. Hours are in a row when each begins less than
|
|
34
|
+
* RESUME_WINDOW_MS after the one before it cleared; only an hour without one begins the
|
|
35
|
+
* count again. No start does, whoever makes it: a person may start a home the sweep gave up,
|
|
36
|
+
* and if it is lost again in a used-up hour it is given up again at once.
|
|
37
|
+
* A refused start launched nothing: it is not counted, and it does not judge the loss. It is
|
|
38
|
+
* noted, and a sweep tries that home and start again no sooner than RETRY_FIRST_MS after the
|
|
39
|
+
* refusal, doubled at each further refusal up to RETRY_CEILING_MS; until then a sweep reports
|
|
40
|
+
* it `start-refused-retrying` with the refusal's `code` and `message` and `nextAttemptAt`,
|
|
41
|
+
* without a start. The retries end when the loss is no longer one the kernel vouches for
|
|
42
|
+
* (first seen 24 hours ago: `not-seen-recently`).
|
|
43
|
+
* The note is one boot's (`note.json`): another boot's is replaced whole, so a reboot starts
|
|
44
|
+
* the count and the delays again. `session start --resume` run by hand is neither bounded
|
|
45
|
+
* nor counted.
|
|
32
46
|
* A current-start host-stop receipt identifies an administrative restore: a successful one
|
|
33
47
|
* bypasses the crash ceiling without spending or clearing the carried budget. A blocked or
|
|
34
|
-
* failed restore keeps its failure accounting, and eligibility
|
|
48
|
+
* failed restore keeps its failure accounting, and eligibility checks still hold.
|
|
35
49
|
* Without a boot id (neither Linux nor macOS) nothing is noted or counted: each sweep tries again.
|
|
36
50
|
* The lock and the note are kernel-private, not a contract. `plan` predicts from the note, starting
|
|
37
51
|
* nothing, taking no lock and writing no note. */
|
|
@@ -45,7 +59,7 @@ import { acquireDirLock, dirLockHeld, stuckLockRemedy } from "./dir-lock.mjs";
|
|
|
45
59
|
import { homeClaimHolder, listInstances, launchEnvRefs, missingLaunchEnvRefs, owedRetireSaid, resumeConversation } from "./core.mjs";
|
|
46
60
|
import { checkStartEnv, launchEnvChangedMessage, launchEnvMissingMessage, launchEnvUnverifiedWarning } from "./start-env.mjs";
|
|
47
61
|
import { FRESH_REASON, NOT_SWEPT, OUTCOME, RESUME_WAITING, ROW_REASON, SESSION_END } from "./session-resume-contract.mjs";
|
|
48
|
-
import { bootId, homeKey, judgeLosses, readSeen, resumeEligible, resumeStateDir, sameBoot, takenInAnotherBoot } from "./session-seen.mjs";
|
|
62
|
+
import { bootId, homeKey, judgeLosses, readSeen, recordSeen, resumeEligible, resumeStateDir, sameBoot, takenInAnotherBoot } from "./session-seen.mjs";
|
|
49
63
|
import { isAgentScopeWarning } from "./tmux-server-scope.mjs";
|
|
50
64
|
import { hostStoppedAt as readHostStoppedAt } from "./session-end.mjs";
|
|
51
65
|
|
|
@@ -54,8 +68,16 @@ export { bootId, resumeStateDir };
|
|
|
54
68
|
export const RESUME_SCHEMA = 1;
|
|
55
69
|
/** At most this many starts run at once. */
|
|
56
70
|
export const RESUME_CONCURRENCY = 4;
|
|
57
|
-
/** At most this many sweep starts of one home in
|
|
71
|
+
/** At most this many sweep starts of one home in RESUME_WINDOW_MS. */
|
|
58
72
|
export const RESUME_LIMIT = 3;
|
|
73
|
+
/** The span over which a home's sweep starts are counted. */
|
|
74
|
+
export const RESUME_WINDOW_MS = 60 * 60_000;
|
|
75
|
+
/** A home that uses up its starts in this many hours in a row is not started by a sweep again. */
|
|
76
|
+
export const RESUME_SPENT_HOURS = 3;
|
|
77
|
+
/** How long after a refused start a sweep tries it again: this after the first refusal, doubled at
|
|
78
|
+
* each further one, never more than RETRY_CEILING_MS. */
|
|
79
|
+
export const RETRY_FIRST_MS = 60_000;
|
|
80
|
+
export const RETRY_CEILING_MS = 15 * 60_000;
|
|
59
81
|
const lockPath = () => join(resumeStateDir(), "lock");
|
|
60
82
|
const notePath = () => join(resumeStateDir(), "note.json");
|
|
61
83
|
|
|
@@ -106,32 +128,66 @@ export function resumeLockProblem({ boot = bootId() } = {}) {
|
|
|
106
128
|
return { code: RESUME_LOCK_STUCK, message: `${stuck.said}: oats session resume starts nothing on this machine while it is there`, remedy: stuck.remedy };
|
|
107
129
|
}
|
|
108
130
|
|
|
109
|
-
/** This boot's note: `{ bootId, refused: [{ home, startId, code, message, at
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
|
|
131
|
+
/** This boot's note as it is stored: `{ bootId, refused: [{ home, startId, code, message, at,
|
|
132
|
+
* attempts }], starts: { <home>: [<ISO time of a sweep start that launched something>] },
|
|
133
|
+
* spent: { <home>: { hours, since } } }` (`since` the oldest counted start of the home's last
|
|
134
|
+
* used-up hour, `hours` how many such hours in a row that makes), each home by its real path
|
|
135
|
+
* (lib/session-seen.mjs homeKey); empty for another boot's note, an unreadable one, or no boot id. */
|
|
136
|
+
function readNote(boot) {
|
|
113
137
|
const note = boot ? readJson(notePath()) : undefined;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
138
|
+
const map = (v) => (v && typeof v === "object" && !Array.isArray(v) ? v : {});
|
|
139
|
+
if (!note || !sameBoot(note.bootId, boot)) return { bootId: boot, refused: [], starts: {}, spent: {} };
|
|
140
|
+
const starts = {};
|
|
141
|
+
if (note.starts && typeof note.starts === "object" && !Array.isArray(note.starts)) {
|
|
142
|
+
for (const [home, times] of Object.entries(note.starts)) if (Array.isArray(times)) starts[home] = times.filter((t) => typeof t === "string" && Number.isFinite(Date.parse(t)));
|
|
118
143
|
}
|
|
119
|
-
|
|
144
|
+
const spent = Object.fromEntries(Object.entries(map(note.spent)).filter(([, v]) => v && Number.isSafeInteger(v.hours) && v.hours > 0 && Number.isFinite(Date.parse(v.since))));
|
|
145
|
+
return { bootId: boot, refused: Array.isArray(note.refused) ? note.refused.filter((r) => r && typeof r.home === "string") : [], starts, spent };
|
|
120
146
|
}
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
147
|
+
/** The used-up hour that begins with the counted start `since`, after the home's earlier mark
|
|
148
|
+
* `mark` (a note's `spent` entry, or none) → `{ hours, since }`: the same hour again is the mark
|
|
149
|
+
* itself; an hour that begins less than RESUME_WINDOW_MS after the marked one cleared is one
|
|
150
|
+
* more in a row; any other is the first. */
|
|
151
|
+
export function spentHours(mark, since) {
|
|
152
|
+
if (mark && mark.since === since) return { hours: mark.hours, since };
|
|
153
|
+
const inARow = mark && Date.parse(since) - (Date.parse(mark.since) + RESUME_WINDOW_MS) < RESUME_WINDOW_MS;
|
|
154
|
+
return { hours: inARow ? mark.hours + 1 : 1, since };
|
|
155
|
+
}
|
|
156
|
+
/** The times in `times` that are inside the counting window at `now`, oldest first. */
|
|
157
|
+
const inWindow = (times = [], now) => times.filter((t) => now - Date.parse(t) < RESUME_WINDOW_MS).sort();
|
|
158
|
+
/** This boot's note: `{ bootId, refused, resumes: { <home>: n } }`, `refused` as it is stored
|
|
159
|
+
* (readNote) and `n` the sweep starts of the home counted at `now`: those of the last
|
|
160
|
+
* RESUME_WINDOW_MS. */
|
|
161
|
+
export function readBootNote(boot = bootId(), now = Date.now()) {
|
|
162
|
+
const note = readNote(boot), resumes = {};
|
|
163
|
+
for (const [home, times] of Object.entries(note.starts)) { const n = inWindow(times, now).length; if (n > 0) resumes[home] = n; }
|
|
164
|
+
return { bootId: boot, refused: note.refused, resumes };
|
|
165
|
+
}
|
|
166
|
+
/** When a sweep tries the refused start `prior` (a note's entry) again, in ms: RETRY_FIRST_MS
|
|
167
|
+
* after its refusal, doubled for each refusal before it, at most RETRY_CEILING_MS. An entry
|
|
168
|
+
* whose time does not read is due at once. */
|
|
169
|
+
export function retryDueAt(prior) {
|
|
170
|
+
const at = Date.parse(prior?.at);
|
|
171
|
+
if (!Number.isFinite(at)) return 0;
|
|
172
|
+
const refusals = Number.isSafeInteger(prior.attempts) && prior.attempts > 0 ? prior.attempts : 1;
|
|
173
|
+
return at + Math.min(RETRY_FIRST_MS * 2 ** Math.min(refusals - 1, 30), RETRY_CEILING_MS);
|
|
174
|
+
}
|
|
175
|
+
/** Note a sweep's `refusals` (each replacing its home's earlier entry), the `launched` homes (each
|
|
176
|
+
* a start at `now`, and the starts that left the counting window dropped) and the used-up hours
|
|
177
|
+
* it marked (`spent`: { <home>: { hours, since } }) for this boot; another boot's note is
|
|
178
|
+
* replaced whole. Nothing is written without a boot id. */
|
|
179
|
+
export function noteSweep({ refusals = [], launched = [], spent = {} }, boot = bootId(), now = Date.now()) {
|
|
180
|
+
if (!boot || (!refusals.length && !launched.length && !Object.keys(spent).length)) return;
|
|
181
|
+
const note = readNote(boot);
|
|
127
182
|
const homes = new Set(refusals.map((r) => r.home));
|
|
128
|
-
const
|
|
129
|
-
for (const home of
|
|
183
|
+
const starts = {};
|
|
184
|
+
for (const [home, times] of Object.entries(note.starts)) { const kept = inWindow(times, now); if (kept.length) starts[home] = kept; }
|
|
185
|
+
for (const home of launched) starts[home] = [...(starts[home] ?? []), new Date(now).toISOString()];
|
|
130
186
|
const path = notePath();
|
|
131
187
|
mkdirSync(resumeStateDir(), { recursive: true, mode: 0o700 });
|
|
132
188
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
133
189
|
try {
|
|
134
|
-
writeFileSync(tmp, JSON.stringify({ bootId: boot, refused: [...note.refused.filter((r) => !homes.has(r.home)), ...refusals],
|
|
190
|
+
writeFileSync(tmp, JSON.stringify({ bootId: boot, refused: [...note.refused.filter((r) => !homes.has(r.home)), ...refusals], starts, spent: { ...note.spent, ...spent } }, null, 2) + "\n", { mode: 0o600 });
|
|
135
191
|
renameSync(tmp, path);
|
|
136
192
|
} catch (e) { rmSync(tmp, { force: true }); throw e; }
|
|
137
193
|
}
|
|
@@ -166,10 +222,12 @@ function readDeployment(dir) {
|
|
|
166
222
|
|
|
167
223
|
/** The reasons of the rows a sweep answers without judging the loss, so that a later sweep may
|
|
168
224
|
* resume it: a home OATS was stopping, upgrading or retiring (`lifecycle-busy`), whose next state
|
|
169
|
-
* is that command's to decide
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
|
|
225
|
+
* is that command's to decide; a start that was refused, which launched nothing and says how the
|
|
226
|
+
* host was at that moment (`start-refused`, and `start-refused-retrying` while its delay runs);
|
|
227
|
+
* and a home whose starts of the last RESUME_WINDOW_MS used up the budget (`keeps-getting-lost`),
|
|
228
|
+
* which a sweep starts again when the window has moved on; unless it did so RESUME_SPENT_HOURS
|
|
229
|
+
* hours in a row (the sweep's `givenUp`), which is judged. */
|
|
230
|
+
const NOT_JUDGED = new Set([ROW_REASON.LIFECYCLE_BUSY, ROW_REASON.START_REFUSED, ROW_REASON.START_REFUSED_RETRYING, ROW_REASON.KEEPS_GETTING_LOST]);
|
|
173
231
|
/** Outcomes that can consume the crash budget; a successful host-stop restore is exempt below. */
|
|
174
232
|
const LAUNCHED = new Set([OUTCOME.RESUMED, OUTCOME.FRESH, OUTCOME.BLOCKED]);
|
|
175
233
|
const base = (row) => ({ deployment: row.deployment, instance: row.instance, home: row.home });
|
|
@@ -262,10 +320,11 @@ export async function resumeSessions({ deployment, plan = false, kernel, env = p
|
|
|
262
320
|
else if (row.sessionEnd === SESSION_END.LOST || (row.retirePending && row.launched === true && row.running === false)) candidates.push(row);
|
|
263
321
|
}
|
|
264
322
|
}
|
|
265
|
-
const
|
|
266
|
-
const toStart = [], hostStopped = new Set();
|
|
267
|
-
|
|
268
|
-
//
|
|
323
|
+
const now = Date.now(), note = readNote(boot);
|
|
324
|
+
const toStart = [], hostStopped = new Set(), refusedBefore = new Map(), marked = {}, givenUp = new Set();
|
|
325
|
+
const iso = (ms) => new Date(ms).toISOString();
|
|
326
|
+
// Precedence, the first that applies: not seen recently, refused and not yet due again, keeps
|
|
327
|
+
// getting lost, started. The record and the note name a home by its real path (homeKey), whatever spelling the
|
|
269
328
|
// sweep was given; a row shows the path it listed.
|
|
270
329
|
// A home OATS is stopping, upgrading or retiring, or whose retire is owed, comes first: nothing
|
|
271
330
|
// is started there. This read is only a filter (the sweep is not atomic with it): the start's
|
|
@@ -282,11 +341,21 @@ export async function resumeSessions({ deployment, plan = false, kernel, env = p
|
|
|
282
341
|
if (hostStoppedAt !== null) hostStopped.add(key);
|
|
283
342
|
if (busy) rows.push({ ...base(row), outcome: OUTCOME.SKIPPED, reason: ROW_REASON.LIFECYCLE_BUSY, message: busy });
|
|
284
343
|
else if (!fit.eligible) rows.push({ ...base(row), outcome: OUTCOME.SKIPPED, reason: ROW_REASON.NOT_SEEN_RECENTLY, message: `${row.instance} is not resumed automatically: ${fit.why}; start it by hand (oats session start --resume --home ${row.home}) if it should run` });
|
|
285
|
-
else if (prior) rows.push({ ...base(row), outcome: OUTCOME.REFUSED, reason: ROW_REASON.
|
|
286
|
-
else if (!hostStopped.has(key) && (note.
|
|
344
|
+
else if (prior && now < retryDueAt(prior)) rows.push({ ...base(row), outcome: OUTCOME.REFUSED, reason: ROW_REASON.START_REFUSED_RETRYING, code: prior.code, message: prior.message, nextAttemptAt: iso(retryDueAt(prior)) });
|
|
345
|
+
else if (!hostStopped.has(key) && inWindow(note.starts[key], now).length >= RESUME_LIMIT) {
|
|
346
|
+
const counted = inWindow(note.starts[key], now), again = iso(Date.parse(counted[0]) + RESUME_WINDOW_MS);
|
|
347
|
+
const hour = spentHours(note.spent[key], counted[0]);
|
|
348
|
+
if (!plan && (note.spent[key]?.since !== hour.since || note.spent[key]?.hours !== hour.hours)) marked[key] = hour;
|
|
349
|
+
const by = `start it by hand (oats session start --resume --home ${row.home})`;
|
|
350
|
+
if (hour.hours >= RESUME_SPENT_HOURS) {
|
|
351
|
+
givenUp.add(row.home);
|
|
352
|
+
rows.push({ ...base(row), outcome: OUTCOME.REFUSED, reason: ROW_REASON.KEEPS_GETTING_LOST, message: `${row.instance} was resumed ${counted.length} times an hour for ${hour.hours} hours in a row and was lost again each time; no sweep starts it again: ${by}` });
|
|
353
|
+
} else rows.push({ ...base(row), outcome: OUTCOME.REFUSED, reason: ROW_REASON.KEEPS_GETTING_LOST, nextAttemptAt: again, message: `${row.instance} was resumed ${counted.length} times in the last hour and was lost again each time; a sweep starts it again after ${again}, or ${by}` });
|
|
354
|
+
}
|
|
287
355
|
else if (plan) rows.push(predicted(row, env));
|
|
288
|
-
else toStart.push(row);
|
|
356
|
+
else { toStart.push(row); if (prior) refusedBefore.set(key, prior); }
|
|
289
357
|
}
|
|
358
|
+
if (Object.keys(marked).length) noteSweep({ spent: marked }, boot, now);
|
|
290
359
|
// Each start's answer is noted as it comes, under the lock (noteSweep is synchronous: two answers
|
|
291
360
|
// never interleave in it), before the sweep waits on the others. A note that cannot be written
|
|
292
361
|
// takes no more home; the lock is held until every start already running has answered, and the
|
|
@@ -299,24 +368,38 @@ export async function resumeSessions({ deployment, plan = false, kernel, env = p
|
|
|
299
368
|
// A home removed between the read and its start (a retire finished in between) is not lost:
|
|
300
369
|
// whatever its start answered.
|
|
301
370
|
const gone = answer?.ok !== true && !existsSync(row.home);
|
|
302
|
-
const answered = gone ? { ...base(row), outcome: OUTCOME.SKIPPED, reason: ROW_REASON.NOT_LOST, ...(typeof answer?.error?.code === "string" ? { code: answer.error.code } : {}) } : rowFromStart(row, answer);
|
|
303
371
|
const key = homeKey(row.home);
|
|
372
|
+
// A refusal is noted with how many times this home and start were refused, which sets when a
|
|
373
|
+
// sweep tries it again; the row says when.
|
|
374
|
+
const refusal = { home: key, startId: row.startId ?? null, at: iso(Date.now()), attempts: (refusedBefore.get(key)?.attempts ?? 0) + 1 };
|
|
375
|
+
const from = gone ? { ...base(row), outcome: OUTCOME.SKIPPED, reason: ROW_REASON.NOT_LOST, ...(typeof answer?.error?.code === "string" ? { code: answer.error.code } : {}) } : rowFromStart(row, answer);
|
|
376
|
+
const answered = from.outcome === OUTCOME.REFUSED && boot ? { ...from, nextAttemptAt: iso(retryDueAt(refusal)) } : from;
|
|
304
377
|
try {
|
|
305
378
|
noteSweep({
|
|
306
|
-
refusals: answered.outcome === OUTCOME.REFUSED ? [{
|
|
379
|
+
refusals: answered.outcome === OUTCOME.REFUSED ? [{ ...refusal, code: answered.code, message: answered.message }] : [],
|
|
307
380
|
launched: LAUNCHED.has(answered.outcome) && (!hostStopped.has(key) || answered.outcome === OUTCOME.BLOCKED) ? [key] : [],
|
|
308
381
|
}, boot);
|
|
309
382
|
} catch (e) { noteFailure ??= e; }
|
|
310
383
|
return answered;
|
|
311
384
|
}, () => noteFailure !== null || !hostRunAdmissionOpen())).filter(Boolean);
|
|
312
385
|
rows.push(...started);
|
|
313
|
-
// Each lost home this sweep answered is judged
|
|
314
|
-
// never uses one up). A plan judges nothing.
|
|
386
|
+
// Each lost home this sweep answered is judged, but for the rows of NOT_JUDGED: no later sweep
|
|
387
|
+
// resumes a judged loss (a status read never uses one up). A plan judges nothing. Judge the
|
|
388
|
+
// lost start before recording its replacement: a new start resets the record and its judgement.
|
|
315
389
|
if (!plan) {
|
|
316
390
|
const lost = new Set(candidates.map((c) => c.home)), byDeployment = new Map();
|
|
317
|
-
for (const r of rows) if (lost.has(r.home) && !NOT_JUDGED.has(r.reason)) byDeployment.set(r.deployment, [...(byDeployment.get(r.deployment) ?? []), { home: r.home, startId: candidates.find((c) => c.home === r.home).startId ?? null, outcome: r.outcome }]);
|
|
391
|
+
for (const r of rows) if (lost.has(r.home) && (!NOT_JUDGED.has(r.reason) || givenUp.has(r.home))) byDeployment.set(r.deployment, [...(byDeployment.get(r.deployment) ?? []), { home: r.home, startId: candidates.find((c) => c.home === r.home).startId ?? null, outcome: r.outcome }]);
|
|
318
392
|
for (const [dir, judged] of byDeployment) judgeLosses(join(dir, "agents"), judged, { boot });
|
|
319
393
|
}
|
|
394
|
+
// A home this sweep started is recorded as seen running for its new start. Without this,
|
|
395
|
+
// a home lost again before the next listing would have no record for its start: no later
|
|
396
|
+
// sweep would resume it, and its starts would never be counted.
|
|
397
|
+
const launchedIn = new Map();
|
|
398
|
+
for (const r of started) if (r.outcome === OUTCOME.RESUMED || r.outcome === OUTCOME.FRESH) launchedIn.set(r.deployment, (launchedIn.get(r.deployment) ?? new Set()).add(r.home));
|
|
399
|
+
for (const [dir, homes] of launchedIn) {
|
|
400
|
+
const root = join(dir, "agents");
|
|
401
|
+
try { recordSeen(root, listInstances(root).flatMap((a) => a.instances || []).map((i) => (homes.has(i.home) ? { ...i, running: true } : i)), { boot }); } catch { /* the next listing records it */ }
|
|
402
|
+
}
|
|
320
403
|
if (noteFailure) throw noteFailure;
|
|
321
404
|
rows.sort((a, b) => (a.deployment < b.deployment ? -1 : a.deployment > b.deployment ? 1 : a.home < b.home ? -1 : a.home > b.home ? 1 : 0));
|
|
322
405
|
return { schemaVersion: RESUME_SCHEMA, plan: !!plan, deployments, rows, ...(hostWide.size ? { warnings: [...hostWide].sort() } : {}) };
|
package/lib/session-seen.mjs
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* firstNotRunningAt, firstNotRunningBoot, judgedBy } } }
|
|
7
7
|
* (times ISO; boots bootId's, null without one; `judgedBy` `{ at, boot, outcome }` or null).
|
|
8
8
|
*
|
|
9
|
-
* - Observations
|
|
10
|
-
* and every other local listing)
|
|
11
|
-
* here;
|
|
9
|
+
* - Observations come from local `listInstances` calls (`oats status`, the sweep's own read
|
|
10
|
+
* and every other local listing) and from the sweep recording the homes it started: recordSeen.
|
|
11
|
+
* A status routed to another machine reads nothing here; `session start` writes nothing.
|
|
12
12
|
* - `judgedBy` has one writer, a sweep that is not a plan (judgeLosses), once its rows are known:
|
|
13
13
|
* a status read never uses up a loss.
|
|
14
14
|
* - Never in the way of what reads it: an unreadable file is an empty record (which resumes
|
package/package-catalog.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"packages": {
|
|
4
4
|
"oats.okf": {
|
|
5
5
|
"url": "https://github.com/awebai/oats-okf.git",
|
|
6
|
-
"ref": "v6.0
|
|
6
|
+
"ref": "v6.2.0",
|
|
7
7
|
"path": "oats-package"
|
|
8
8
|
},
|
|
9
9
|
"oats.aweb": {
|
|
10
10
|
"url": "https://github.com/awebai/oats-aweb.git",
|
|
11
|
-
"ref": "v1.
|
|
11
|
+
"ref": "v1.42.1",
|
|
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.
|
|
51
|
+
"ref": "oats-framework/v1.26.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.69.
|
|
3
|
+
"version": "0.69.20",
|
|
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",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"skills/",
|
|
38
38
|
"injects/",
|
|
39
39
|
"docs/",
|
|
40
|
+
"package.json",
|
|
41
|
+
"LICENSE",
|
|
40
42
|
"README.md",
|
|
41
43
|
"package-catalog.json",
|
|
42
44
|
"packages/record/bin/",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The owning human (feature spawn-attribution): a status row's `attributedHuman`, the label of the human
|
|
2
|
+
* the instance's messaging identity is attributed to, or null (docs/desktop-cli-api.md, "Attributed human").
|
|
3
|
+
* Read as the kernel gives it, under the contract's own rule for the label (a waiting claim's message rule,
|
|
4
|
+
* waiting-on-you.mjs `waitingMessage`), on a local row and again on a remote row its host relayed. Anything
|
|
5
|
+
* else (not a string, blank, a refused character, over 200 code points, or text withheld as unsafe) is null:
|
|
6
|
+
* no human, never a fault, so a malformed value can't fail the row. Pure, never throws. */
|
|
7
|
+
import { waitingMessage } from './waiting-on-you.mjs';
|
|
8
|
+
import { EVENTS_WITHHELD } from './instance-events-contract.mjs';
|
|
9
|
+
|
|
10
|
+
export function attributedHumanData(v) {
|
|
11
|
+
const label = waitingMessage(v);
|
|
12
|
+
return label === EVENTS_WITHHELD || !label?.trim() ? null : label;
|
|
13
|
+
}
|
|
@@ -8,6 +8,7 @@ import { teamRow, teamRowsOf, defaultTeamOf, TEAM_ID } from './team-rows.mjs';
|
|
|
8
8
|
import { launchOf, REPORT_FROM } from './launch-contract.mjs';
|
|
9
9
|
import { readIdentity } from './workspace-views.mjs';
|
|
10
10
|
import { waitingOnYouData } from './waiting-on-you.mjs';
|
|
11
|
+
import { attributedHumanData } from './attributed-human.mjs';
|
|
11
12
|
import { retireData } from './retire-state.mjs';
|
|
12
13
|
import { instanceColor } from './instance-presentation.mjs';
|
|
13
14
|
const text = value => typeof value === 'string' && value.length <= 8192 && !value.includes('\0');
|
|
@@ -244,6 +245,9 @@ export function deploymentStatusData(document, deployment) {
|
|
|
244
245
|
// Needs input (PR K): validated, never check()ed — an invalid claim is null (unknown), never an E_* that
|
|
245
246
|
// fails the roster. Absent stays absent.
|
|
246
247
|
if (own(instance, 'waitingOnYou')) row.waitingOnYou = waitingOnYouData(instance.waitingOnYou);
|
|
248
|
+
// Feature spawn-attribution: the owning human's label, or null. Validated, never check()ed: a malformed
|
|
249
|
+
// value is null (no human), never an E_* that fails the roster. Absent stays absent.
|
|
250
|
+
if (own(instance, 'attributedHuman')) row.attributedHuman = attributedHumanData(instance.attributedHuman);
|
|
247
251
|
return [row];
|
|
248
252
|
});
|
|
249
253
|
return out;
|
|
@@ -133,6 +133,8 @@ export function panelInstance(i) {
|
|
|
133
133
|
// Needs input (PR K): the validated claim (or null, unknown) as status reported it; absent stays absent.
|
|
134
134
|
// The client's liveness is merged before projection, so running/runtimeState beside it are the probe's.
|
|
135
135
|
...(i.waitingOnYou !== undefined ? { waitingOnYou: i.waitingOnYou } : {}),
|
|
136
|
+
// The owning human (feature spawn-attribution): the label deployment-data.mjs validated, or null; absent stays absent.
|
|
137
|
+
...(i.attributedHuman !== undefined ? { attributedHuman: i.attributedHuman } : {}),
|
|
136
138
|
// Feature instance-color: the row's colour as instanceColor reads it, present only when it is one.
|
|
137
139
|
...(instanceColor(i) !== null ? { color: instanceColor(i) } : {}),
|
|
138
140
|
// Feature instance-background (#1579): exactly true, else absent (instance-tree.mjs backgroundPlacement).
|
|
@@ -53,9 +53,9 @@ const kernelAnswered = envelope => envelope?.origin === 'kernel' && envelope.sch
|
|
|
53
53
|
* A kernel's E_LIFECYCLE_BUSY whose kernel (`features`: the answering kernel's) says who holds the claim
|
|
54
54
|
* reads by that (`holder`, busyHolder), local or remote, and names the target of `plan` the refusal is
|
|
55
55
|
* about when that is not the instance acted on (`about`). */
|
|
56
|
-
function failureReason(envelope, remote, terms, { code = envelope?.error?.code, features = null, plan = null } = {}) {
|
|
56
|
+
function failureReason(envelope, remote, terms, { code = envelope?.error?.code, features = null, plan = null, operation } = {}) {
|
|
57
57
|
const kernel = kernelAnswered(envelope), undescribed = kernel ? undescribedAnswer(code, terms) : null;
|
|
58
|
-
const reason = undescribed || lifecycleReason(code, terms), details = envelope?.error?.details;
|
|
58
|
+
const reason = undescribed || lifecycleReason(code, terms, { operation }), details = envelope?.error?.details;
|
|
59
59
|
const holder = kernel ? busyHolder(code, details, features) : null, about = holder ? busyAbout(plan, details?.home) : null;
|
|
60
60
|
const busy = holder ? { holder, ...(about ? { about } : {}) } : {};
|
|
61
61
|
const message = holder ? busyHeadline(holder) : reason.message;
|
|
@@ -140,7 +140,8 @@ export function createLifecycleBoundary({ invoke = cliLifecycle, now = () => per
|
|
|
140
140
|
if (!same(selected, current)) return denied('E_PLAN_CHANGED', selected.target);
|
|
141
141
|
if (envelope?.schemaVersion !== 1 || envelope.ok !== true) {
|
|
142
142
|
const code = envelope?.error?.code || 'E_CLI_PROTOCOL';
|
|
143
|
-
return denied(code, selected.target, { reason: failureReason(envelope, selected.remote, terms, { code, features: selected.features
|
|
143
|
+
return denied(code, selected.target, { reason: failureReason(envelope, selected.remote, terms, { code, features: selected.features,
|
|
144
|
+
operation: request.operation }) });
|
|
144
145
|
}
|
|
145
146
|
// The plan is read by the features of the kernel that made it: for a relayed plan its host's, never this computer's.
|
|
146
147
|
const data = lifecyclePlan(envelope.result, selected.target, request.operation, choices, { features: selected.features });
|
|
@@ -180,7 +181,8 @@ export function createLifecycleBoundary({ invoke = cliLifecycle, now = () => per
|
|
|
180
181
|
// children have already stopped. The user must explicitly read a new plan.
|
|
181
182
|
return failure(code, 'refused', { plan: fresh, childrenStopped });
|
|
182
183
|
}
|
|
183
|
-
if (beforeEffect.has(code)) return failure(code, 'refused', { reason: failureReason(envelope, entry.remote, terms,
|
|
184
|
+
if (beforeEffect.has(code)) return failure(code, 'refused', { reason: failureReason(envelope, entry.remote, terms,
|
|
185
|
+
{ features, plan: entry.plan, operation: entry.plan.action }) });
|
|
184
186
|
return failure('E_OUTCOME_UNKNOWN', 'unknown', { cause: failureReason(envelope, entry.remote, terms, { features }) });
|
|
185
187
|
}
|
|
186
188
|
/** The apply of this client that is running, as a reply names it. */
|
|
@@ -10,8 +10,8 @@ const RUNTIME_ORDER = Object.freeze({ running: 0, unknown: 1, stopped: 2 });
|
|
|
10
10
|
/** The panel's runtime order, a comparator for `sort`: running, then unknown (`running` null or anything not
|
|
11
11
|
* a boolean: it may be running, so it stands above the rows nobody needs to watch), then stopped; by name
|
|
12
12
|
* within each. Each row's place depends on that row alone, so it is a total order whatever `running` holds.
|
|
13
|
-
* Read by `panelInstances` (deployment-panel.mjs). The sidebar's roster orders by
|
|
14
|
-
* `rosterOrder
|
|
13
|
+
* Read by `panelInstances` (deployment-panel.mjs). The sidebar's roster orders by spawn time, newest first
|
|
14
|
+
* (instance-tree.mjs `rosterOrder`). */
|
|
15
15
|
export function byRuntimeState(a, b) {
|
|
16
16
|
return RUNTIME_ORDER[runtimeState(a)] - RUNTIME_ORDER[runtimeState(b)] || String(a.instance).localeCompare(String(b.instance));
|
|
17
17
|
}
|
|
@@ -66,11 +66,23 @@ export function resolveLinkId(fromInstance, name, byName) {
|
|
|
66
66
|
return sameRoot.length === 1 ? instanceId(sameRoot[0]) : null;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
/** When a row was spawned, in ms: its `createdAt` (the kernel's ISO time from instance.json), or null when it has
|
|
70
|
+
* none or the reader can't parse it. */
|
|
71
|
+
function spawnTime(instance) {
|
|
72
|
+
const time = typeof instance.createdAt === "string" ? Date.parse(instance.createdAt) : NaN;
|
|
73
|
+
return Number.isFinite(time) ? time : null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The roster's order, a comparator for `sort`: by spawn time, newest first (Pepe, 2026-11-13: "by spawn time not
|
|
77
|
+
* alphabetically, i.e. new to old"); a row with no readable spawn time after every row with one; then by instance
|
|
78
|
+
* name, ties broken by `instanceId`, so it is total and deterministic. It ranks roots, siblings under one parent,
|
|
79
|
+
* and so clusters (by their first root: a bundle sits where its newest root sits, so a new child never moves it).
|
|
80
|
+
* A spawn time never changes, so a start or a stop moves no row; only adding or removing one does (#1262's
|
|
81
|
+
* recognition rule, whose name order this replaces; #1083's running-first order stays out of the roster). The one
|
|
82
|
+
* place the roster's order is decided. */
|
|
73
83
|
function rosterOrder(a, b) {
|
|
84
|
+
const ta = spawnTime(a), tb = spawnTime(b);
|
|
85
|
+
if (ta !== tb) return ta === null ? 1 : tb === null ? -1 : tb - ta;
|
|
74
86
|
const ia = instanceId(a), ib = instanceId(b);
|
|
75
87
|
return String(a.instance).localeCompare(String(b.instance)) || (ia < ib ? -1 : ia > ib ? 1 : 0);
|
|
76
88
|
}
|
|
@@ -117,8 +129,7 @@ export function instanceSiblings(instances) {
|
|
|
117
129
|
* duplicate names across repos render as distinct nodes.
|
|
118
130
|
* Under one parent, the children that draw their parent line come first (same-work.mjs `drawingFirst`: on a
|
|
119
131
|
* host that declares instance-same-work, the flagged ones), each part in the roster's order (#1577). The product
|
|
120
|
-
* owner's contract (awebai/oats#1577, comment 6441606665) refines the
|
|
121
|
-
* roster-name-order-preserves-recognition) inside one parent's children only: roots, clusters and groups keep it.
|
|
132
|
+
* owner's contract (awebai/oats#1577, comment 6441606665) refines the roster's order inside one parent's children only: roots, clusters and groups keep it.
|
|
122
133
|
* Returns [{ key, instances: [{...instance, depth}] }] with clusters ranked by
|
|
123
134
|
* their first ROOT in the roster's order (`rosterOrder`), never by another member (#1262): a bundle sits where
|
|
124
135
|
* its root sits, and gaining or losing a child, or a start or a stop, moves nothing. A cluster without a root
|
|
@@ -185,7 +196,7 @@ export function clusterInstances(instances, { links = instanceLinks, roster = in
|
|
|
185
196
|
// Deterministic cluster label: the lexically-smallest ROOT name —
|
|
186
197
|
// independent of liveness, so the visible cluster name does not flip
|
|
187
198
|
// when a different member starts/stops running (review f921f7d nit).
|
|
188
|
-
// `rank` (rosterOrder: by
|
|
199
|
+
// `rank` (rosterOrder: by spawn time, newest first) governs display ORDER within the cluster.
|
|
189
200
|
const rootNames = (roots.length ? roots : members).map((i) => i.instance).sort();
|
|
190
201
|
clusters.push({ key: rootNames[0], instances: ordered, head: roots[0] ?? [...members].sort(rank)[0] });
|
|
191
202
|
}
|
|
@@ -213,8 +213,10 @@ function refusal(reason, plan, { operation, leftover }, terms) {
|
|
|
213
213
|
return { status: { headline: LEFTOVER_HELD, more: [], next: 'retire-with-force', code: reason.code }, blocks: [{ type: 'quote', text: shown.detail }] };
|
|
214
214
|
// A reason with no code reads as the table's fallback, and says that fallback's code; a code only the client
|
|
215
215
|
// raises (one the table does not know) keeps its own, so the client can word it.
|
|
216
|
-
const table = lifecycleReason(reason?.code, terms
|
|
217
|
-
const
|
|
216
|
+
const table = lifecycleReason(reason?.code, terms, { operation });
|
|
217
|
+
const own = typeof reason?.code === 'string' && reason.code ? reason.code : table.code;
|
|
218
|
+
// This code's headline must hold for every cause, even when a relayed sentence still offers force.
|
|
219
|
+
const status = remote ? { headline: remote.code === 'E_UNIDENTIFIED_INSTANCE_HOME' ? table.message : remote.message, code: remote.code } : undescribed ? { headline: undescribed.message, code: reason.code }
|
|
218
220
|
: { headline: table.message, code: own };
|
|
219
221
|
return { status: { more: [], next: null, ...status }, blocks: shown ? [{ type: 'details', reason: shown, bare: !!undescribed }] : [] };
|
|
220
222
|
}
|
|
@@ -22,9 +22,13 @@ const messages = {
|
|
|
22
22
|
E_USAGE: 'Invalid lifecycle request.', E_WORKSPACE_UNKNOWN: 'Choose an advertised workspace.',
|
|
23
23
|
E_SESSION_UNKNOWN: 'This instance is no longer in the current roster.', E_AMBIGUOUS_INSTANCE: 'Select an exact instance home.',
|
|
24
24
|
E_HOME_MISMATCH: 'The instance home no longer matches this selection.',
|
|
25
|
-
// The kernel's, for a home
|
|
26
|
-
//
|
|
27
|
-
|
|
25
|
+
// The kernel's, for a home whose record or cleanup cannot be used. Answered only before any effect.
|
|
26
|
+
// The envelope has no structured cause discriminator. Details gives the remedy; never parse its words
|
|
27
|
+
// or promise force, which cannot bypass a record that is there and cannot be read.
|
|
28
|
+
E_UNIDENTIFIED_INSTANCE_HOME: (_terms, context) => {
|
|
29
|
+
if (context?.operation !== 'retire') return "OATS couldn't find or read what it needs in this instance's home folder, so nothing was done.";
|
|
30
|
+
return "OATS can't tell what this home's capabilities created, or can't run their cleanup, so nothing was removed. Details says what may be left and how to finish.";
|
|
31
|
+
},
|
|
28
32
|
'cli-unavailable': 'Choose a compatible installed OATS CLI.',
|
|
29
33
|
E_LIFECYCLE_UNAVAILABLE: terms => `This OATS can't stop or retire instances from ${terms.name}. Update OATS.`,
|
|
30
34
|
'unsupported-remote-operation': "This computer's OATS can't route this to the server. Update OATS here.",
|
|
@@ -53,11 +57,12 @@ export const LIFECYCLE_CODES = Object.freeze(Object.keys(messages));
|
|
|
53
57
|
/** The code as the table knows it: itself, or `E_CLI_FAILED` for one it has no sentence for. Needs no terms. */
|
|
54
58
|
export const lifecycleCode = code => (Object.hasOwn(messages, code) ? code : 'E_CLI_FAILED');
|
|
55
59
|
/** The code and its sentence, in the client's terms (client-terms.mjs): a sentence that names the client is
|
|
56
|
-
* built from them.
|
|
57
|
-
|
|
60
|
+
* built from them. `context` supplies the explicit operation for a Remove's cleanup refusal;
|
|
61
|
+
* without it the unidentified-home sentence stays neutral, as it is for Stop. */
|
|
62
|
+
export function lifecycleReason(code, terms, context = {}) {
|
|
58
63
|
requireTerms(terms, 'lifecycleReason');
|
|
59
64
|
const known = lifecycleCode(code), message = messages[known];
|
|
60
|
-
return { code: known, message: typeof message === 'function' ? message(terms) : message };
|
|
65
|
+
return { code: known, message: typeof message === 'function' ? message(terms, context) : message };
|
|
61
66
|
}
|
|
62
67
|
/** A kernel's error answer whose code has no sentence here. It says "OATS answered", so it is chosen only
|
|
63
68
|
* for a code read out of the kernel's own error envelope: by where the code came from, which only the caller
|
|
@@ -2,6 +2,7 @@ import { harnessOf } from "./harness-names.mjs";
|
|
|
2
2
|
import { unsupportedSession, unsupportedSessionOrigin, hasRuntimeError } from "./instance-presentation.mjs";
|
|
3
3
|
import { madeByKernel } from "./kernel-made.mjs";
|
|
4
4
|
import { waitingOnYouData } from "./waiting-on-you.mjs";
|
|
5
|
+
import { attributedHumanData } from "./attributed-human.mjs";
|
|
5
6
|
import { retireData } from "./retire-state.mjs";
|
|
6
7
|
import { readIdentity } from "./workspace-views.mjs";
|
|
7
8
|
import { sameRepo } from "./repo-moves.mjs";
|
|
@@ -61,6 +62,9 @@ export function remotePanel(group, at) {
|
|
|
61
62
|
tmux: i.tmux || null, git: i.git || null, task: i.task || "", next: i.next || "",
|
|
62
63
|
// Needs input: only a remote kernel with the feature reports it — validated, never synthesized when absent.
|
|
63
64
|
...(Object.hasOwn(i, "waitingOnYou") ? { waitingOnYou: waitingOnYouData(i.waitingOnYou) } : {}),
|
|
65
|
+
// The owning human (feature spawn-attribution): the host's label validated again here (attributed-human.mjs),
|
|
66
|
+
// a malformed one null; a host that does not report it leaves it absent.
|
|
67
|
+
...(Object.hasOwn(i, "attributedHuman") ? { attributedHuman: attributedHumanData(i.attributedHuman) } : {}),
|
|
64
68
|
// #1247: the host's retire state, relayed unchanged when it is in the contract (retire-state.mjs), else absent.
|
|
65
69
|
...(retireData(sentRetire) ? { retire: retireData(sentRetire) } : {}),
|
|
66
70
|
// #1577: the host's same-work flag, true only (anything else reads unflagged). `sameWorkKnown` is this
|
|
@@ -19,8 +19,9 @@ the oats repo and run as `oats experimental <cmd>`. They are deliberately not
|
|
|
19
19
|
part of this package.
|
|
20
20
|
|
|
21
21
|
- **`lib/canonical.mjs`** — canonical JSON (integers only in the core),
|
|
22
|
-
`t1:` content ids,
|
|
23
|
-
message signing
|
|
22
|
+
`t1:` content ids, and consistency checks for duplicated signed fields.
|
|
23
|
+
Byte-compatible with awid message signing; capture preserves source signatures
|
|
24
|
+
verbatim and does not verify them.
|
|
24
25
|
- **`lib/store.mjs`** — the store: `streams/<owner>~<source>/journal.jsonl`
|
|
25
26
|
(owner-only append, torn-tail tolerant), `objects/sha256/` (immutable
|
|
26
27
|
blobs), `index/` (derived, never replicated). Merge is prefix extension
|
|
@@ -497,3 +498,15 @@ Anything that binds nothing is an error,
|
|
|
497
498
|
See [capture algorithms and recovery](docs/capture-service.md) for the shared
|
|
498
499
|
append-only input assumption, reset/retry commands, bounded status inventory,
|
|
499
500
|
resource accounting and v0.53.0 downgrade/re-upgrade contract.
|
|
501
|
+
|
|
502
|
+
### Sealed aw logs
|
|
503
|
+
|
|
504
|
+
A sealed client-log envelope (`v`, `key_id`, `enc`, `ct`, with optional `tag`) contains
|
|
505
|
+
ciphertext this recorder cannot read. Capture stops before that line and
|
|
506
|
+
reports a separate `sealed` count, without counting it as a projection failure
|
|
507
|
+
or advancing its cursor. Later lines wait too. Command capture sets the input
|
|
508
|
+
aside with reason “sealed, not readable by this recorder”; status reports it
|
|
509
|
+
under the set-aside count. Supply a readable source and explicitly retry the
|
|
510
|
+
set-aside input, or ignore that source. Resetting a cursor cannot decrypt it.
|
|
511
|
+
Readable lines that fail projection retain their existing consume-and-count
|
|
512
|
+
behaviour.
|
|
@@ -81,6 +81,20 @@ For a conflicting native prefix, either:
|
|
|
81
81
|
input from active set-aside entries. Removing the ignore rule later does not
|
|
82
82
|
authorize the conflict.
|
|
83
83
|
|
|
84
|
+
**Sealed aw logs.** Capture stops before a sealed client-log envelope (`v`,
|
|
85
|
+
`key_id`, `enc`, `ct`, optional `tag`) and leaves its cursor at the line's
|
|
86
|
+
start. It reports a distinct `sealed` count, and command capture sets the input
|
|
87
|
+
aside with reason `sealed, not readable by this recorder`. Later lines wait.
|
|
88
|
+
The owner can export readable JSONL with `aw log read <file>... --json`,
|
|
89
|
+
using the keychain and passphrase where the sealing key was created. The
|
|
90
|
+
recorder has no unattended decryption authority or passphrase transport. The
|
|
91
|
+
native reader may emit a readable prefix before failing, so partial stdout
|
|
92
|
+
does not prove the whole source was read.
|
|
93
|
+
|
|
94
|
+
Supply a readable source and run `capture --retry-set-aside`, or ignore the
|
|
95
|
+
source; retry and cursor reset cannot decrypt ciphertext. Readable projection
|
|
96
|
+
errors retain their existing consume-and-count behaviour.
|
|
97
|
+
|
|
84
98
|
**Oversized records.** The 8 MiB raw-record limit applies to capture beyond
|
|
85
99
|
the captured prefix. The supervised worker never allocates, captures or
|
|
86
100
|
modifies a new raw source record larger than 8 MiB. It appends and checkpoints
|