@oathe/oathe 0.4.3 → 0.4.5
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/.claude-plugin/marketplace.json +18 -2
- package/README.md +4 -1
- package/bin/oathe.mjs +206 -34
- package/docs/PRIVACY.md +26 -4
- package/notch/Oathe Notch.app/Contents/Info.plist +1 -1
- package/notch/Oathe Notch.app/Contents/MacOS/OatheNotch +0 -0
- package/notch/README.md +4 -3
- package/package.json +3 -3
- package/plugin/.claude-plugin/plugin.json +21 -3
- package/plugin/.cursor-plugin/plugin.json +2 -2
- package/plugin/hooks/hooks.json +4 -4
- package/plugin/hooks/lib.mjs +9 -0
- package/plugin/hooks/render-board.mjs +4 -2
- package/src/blocks.mjs +10 -1
- package/src/board-render.mjs +7 -4
- package/src/breach-digest.mjs +75 -10
- package/src/config.mjs +24 -0
- package/src/context.mjs +1 -1
- package/src/device.mjs +106 -0
- package/src/doctor.mjs +110 -9
- package/src/engine-update.mjs +170 -0
- package/src/evidence-discovery.mjs +170 -0
- package/src/fence.mjs +3 -3
- package/src/harnesses/catalog.mjs +46 -4
- package/src/harnesses/claude.mjs +56 -4
- package/src/harnesses/codex-rollout.mjs +110 -21
- package/src/harnesses/codex.mjs +107 -20
- package/src/harnesses/cursor.mjs +31 -18
- package/src/harnesses/harness.mjs +82 -13
- package/src/harnesses/surfaces.mjs +2 -2
- package/src/home.mjs +174 -52
- package/src/init.mjs +27 -2
- package/src/launch.mjs +7 -9
- package/src/launchd.mjs +100 -0
- package/src/manifest.mjs +48 -6
- package/src/mcp/connection.mjs +73 -7
- package/src/mcp/daemon.mjs +123 -0
- package/src/mcp/forwarder.mjs +99 -0
- package/src/mcp/oathe-tools.mjs +392 -145
- package/src/notch-frame.mjs +118 -42
- package/src/notch.mjs +44 -41
- package/src/oathe-annotator.mjs +10 -10
- package/src/pager.mjs +144 -40
- package/src/paths.mjs +1 -0
- package/src/plans.mjs +44 -5
- package/src/registry.mjs +10 -2
- package/src/serve.mjs +82 -0
- package/src/session-host.mjs +1 -1
- package/src/sessions.mjs +39 -8
- package/src/shim.mjs +110 -0
- package/src/speaker.mjs +24 -5
- package/src/statements.mjs +116 -2
- package/src/traces.mjs +61 -19
- package/src/uninstall.mjs +20 -3
- package/src/update.mjs +48 -4
- package/src/verifier.mjs +215 -105
- package/src/verify-dispatch.mjs +86 -32
- package/src/wire.mjs +7 -1
- package/plugin/.mcp.json +0 -10
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oathe",
|
|
3
3
|
"displayName": "Oathe",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.5",
|
|
5
5
|
"description": "Claims are speech acts: your session opens on this folder's board, records progress as statements, and yields what it cannot finish. Horizons move only by deliberate acts — never by session liveness.",
|
|
6
6
|
"author": {
|
|
7
|
-
"name": "Oathe"
|
|
7
|
+
"name": "Oathe",
|
|
8
|
+
"url": "https://oathe.ai"
|
|
8
9
|
},
|
|
9
|
-
"
|
|
10
|
+
"homepage": "https://oathe.ai",
|
|
11
|
+
"repository": "https://github.com/oathe-ai/oathe",
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"claude-code",
|
|
15
|
+
"agents",
|
|
16
|
+
"multi-agent",
|
|
17
|
+
"verification",
|
|
18
|
+
"settlement",
|
|
19
|
+
"handoff",
|
|
20
|
+
"reliability",
|
|
21
|
+
"harness",
|
|
22
|
+
"codex",
|
|
23
|
+
"cursor",
|
|
24
|
+
"durable-execution",
|
|
25
|
+
"accountability",
|
|
26
|
+
"auto-save"
|
|
27
|
+
]
|
|
10
28
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oathe",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Claims are speech acts: your session opens on this folder's board, records progress as statements, and yields what it cannot finish. Horizons move only by deliberate acts — never by session liveness.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Oathe"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"mcpServers": {
|
|
10
10
|
"oathe": {
|
|
11
|
-
"command": "oathe",
|
|
11
|
+
"command": "${userHome}/.oathe/bin/oathe",
|
|
12
12
|
"args": [
|
|
13
13
|
"mcp"
|
|
14
14
|
]
|
package/plugin/hooks/hooks.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"description": "Oathe session lifecycle: the board at SessionStart, lease heartbeat at Stop, frame note before compaction. Same three events exist verbatim in Claude Code and Codex. Commands go through the oathe
|
|
2
|
+
"description": "Oathe session lifecycle: the board at SessionStart, lease heartbeat at Stop, frame note before compaction. Same three events exist verbatim in Claude Code and Codex. Commands go through the shim `oathe init` materializes at $HOME/.oathe/bin/oathe — the plugin is cached by copy, so the tree carries no machine paths, and shell-form commands expand $HOME where a GUI session's bare PATH would find no bin at all.",
|
|
3
3
|
"hooks": {
|
|
4
4
|
"SessionStart": [
|
|
5
5
|
{
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"hooks": [
|
|
8
8
|
{
|
|
9
9
|
"type": "command",
|
|
10
|
-
"command": "oathe hook render-board",
|
|
10
|
+
"command": "\"$HOME/.oathe/bin/oathe\" hook render-board",
|
|
11
11
|
"timeout": 8
|
|
12
12
|
}
|
|
13
13
|
]
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"hooks": [
|
|
19
19
|
{
|
|
20
20
|
"type": "command",
|
|
21
|
-
"command": "oathe hook heartbeat",
|
|
21
|
+
"command": "\"$HOME/.oathe/bin/oathe\" hook heartbeat",
|
|
22
22
|
"timeout": 5
|
|
23
23
|
}
|
|
24
24
|
]
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"hooks": [
|
|
30
30
|
{
|
|
31
31
|
"type": "command",
|
|
32
|
-
"command": "oathe hook frame-note",
|
|
32
|
+
"command": "\"$HOME/.oathe/bin/oathe\" hook frame-note",
|
|
33
33
|
"timeout": 5
|
|
34
34
|
}
|
|
35
35
|
]
|
package/plugin/hooks/lib.mjs
CHANGED
|
@@ -39,6 +39,11 @@ export async function readHookInput() {
|
|
|
39
39
|
return input;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/** The one sentence a session-less hook speaks — on stderr for the person, in the session
|
|
43
|
+
* context for the model (ruling 2026-09-04: fail loud so the model does the right thing). */
|
|
44
|
+
export const UNATTRIBUTED_SESSION = 'this session cannot be attributed (the harness sent no session_id: no '
|
|
45
|
+
+ 'registration, no trace link) — its claims will be refused; run `oathe init` and start a new session';
|
|
46
|
+
|
|
42
47
|
export async function buildHookContext(input, env = process.env) {
|
|
43
48
|
const paths = buildPaths(env);
|
|
44
49
|
const dialect = dialectFor(input) ?? cwdDialect;
|
|
@@ -62,6 +67,10 @@ export async function buildHookContext(input, env = process.env) {
|
|
|
62
67
|
harness: ownerOfTracePath(normalized.transcriptPath ?? ''),
|
|
63
68
|
}
|
|
64
69
|
: null;
|
|
70
|
+
// Session-lessness is reported, never swallowed (fail-soft still reports visibly): a
|
|
71
|
+
// desktop payload with no session_id left claims traceless and verification judging an
|
|
72
|
+
// empty record — silently, until 2026-09-04. One line, both lifecycle hooks ride it.
|
|
73
|
+
if (!session) process.stderr.write(`oathe hook: payload carries no session_id — ${UNATTRIBUTED_SESSION}\n`);
|
|
65
74
|
return {
|
|
66
75
|
session,
|
|
67
76
|
substrate: new Substrate({ database: config.get('db'), paths, env, config }),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// session's own dialect. Activation failing must never cost the session its board: the
|
|
6
6
|
// failure is reported on stderr and the render proceeds (hooks are the sanctioned fail-soft).
|
|
7
7
|
|
|
8
|
-
import { failSoft, emitSessionStart, ensureSessionRegistered } from './lib.mjs';
|
|
8
|
+
import { failSoft, emitSessionStart, ensureSessionRegistered, UNATTRIBUTED_SESSION } from './lib.mjs';
|
|
9
9
|
import { renderBoard } from '../../src/board-render.mjs';
|
|
10
10
|
import { WorkspaceRegistry } from '../../src/registry.mjs';
|
|
11
11
|
|
|
@@ -44,7 +44,9 @@ await failSoft(async ({ substrate, workspace, synthetic, identity, config, cwd,
|
|
|
44
44
|
// (a receipt, printed once) even when the board itself has nothing to push.
|
|
45
45
|
const visible = [message, disclosed].filter(Boolean).join('\n') || null;
|
|
46
46
|
emitSessionStart({
|
|
47
|
-
|
|
47
|
+
// The model reads the disclosure and, when there is no session, the reason its claims
|
|
48
|
+
// will be refused — before it speaks (ruling 2026-09-04).
|
|
49
|
+
context: [context, disclosed ? `_${disclosed}_` : null, session ? null : `_Oathe: ${UNATTRIBUTED_SESSION}._`].filter(Boolean).join('\n\n'),
|
|
48
50
|
message: visible,
|
|
49
51
|
dialect,
|
|
50
52
|
});
|
package/src/blocks.mjs
CHANGED
|
@@ -227,7 +227,16 @@ export class JsonArrayEntries {
|
|
|
227
227
|
}
|
|
228
228
|
const leaf = path.at(-1);
|
|
229
229
|
if (!Array.isArray(node[leaf])) node[leaf] = [];
|
|
230
|
-
|
|
230
|
+
// Owned elements CONVERGE to the current shape (review F2, 2026-09-04): an entry a
|
|
231
|
+
// prior vintage wrote (an old address) is ours by the predicate and is REPLACED, and
|
|
232
|
+
// any further owned duplicates (the mixed-vintage state observed live) are pruned —
|
|
233
|
+
// push-if-absent alone left every re-wired machine running each hook twice, once
|
|
234
|
+
// through a dead path. User elements never match `owns` and are byte-preserved.
|
|
235
|
+
const owned = node[leaf].findIndex(owns);
|
|
236
|
+
if (owned === -1) node[leaf].push(element);
|
|
237
|
+
else node[leaf][owned] = element;
|
|
238
|
+
const keep = owned === -1 ? node[leaf].length - 1 : owned;
|
|
239
|
+
node[leaf] = node[leaf].filter((el, i) => i === keep || !owns(el));
|
|
231
240
|
}
|
|
232
241
|
const content = stringifyJsonTarget(doc);
|
|
233
242
|
return { content, changed: content !== text };
|
package/src/board-render.mjs
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import { createOatheTools } from './mcp/oathe-tools.mjs';
|
|
16
16
|
import { SPEECH_ACT_RULE } from './fence.mjs';
|
|
17
|
-
import { BreachDigest, clip, rowLine, pullPointer } from './breach-digest.mjs';
|
|
17
|
+
import { BreachDigest, JUDGMENT, clip, rowLine, pullPointer } from './breach-digest.mjs';
|
|
18
18
|
|
|
19
19
|
/** The board's scope, spoken once: the folder lens, or the whole machine (R-BOARD-SCOPE). */
|
|
20
20
|
export const MACHINE_SCOPE_LABEL = 'all workspaces';
|
|
@@ -70,8 +70,8 @@ export async function renderBoard({ client, identity, workspace, config, synthet
|
|
|
70
70
|
lines.push('');
|
|
71
71
|
}
|
|
72
72
|
if (asserted.length > 0) {
|
|
73
|
-
lines.push('**Asserted (completion claimed —
|
|
74
|
-
for (const r of asserted) lines.push(`- [${r.task_id}] ${r.objective}`, ...spawned(r));
|
|
73
|
+
lines.push('**Asserted (completion claimed — a non-author verdict settles or reopens it; `oathe verify` runs it):**');
|
|
74
|
+
for (const r of asserted) lines.push(`- [${r.task_id}] ${r.objective} — ${judgmentWord(r)}`, ...spawned(r));
|
|
75
75
|
lines.push('');
|
|
76
76
|
}
|
|
77
77
|
if (held.length > 0) {
|
|
@@ -92,6 +92,9 @@ export async function renderBoard({ client, identity, workspace, config, synthet
|
|
|
92
92
|
return { context: lines.join('\n'), message: digest.push, sections, lens };
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/** The judgment an asserted row awaits, in the one table's words (UX rule 22). */
|
|
96
|
+
const judgmentWord = (r) => JUDGMENT[r.judgment]?.word ?? JUDGMENT.awaiting.word;
|
|
97
|
+
|
|
95
98
|
const BOLD = '\x1b[1m';
|
|
96
99
|
const DIM = '\x1b[2m';
|
|
97
100
|
const RESET = '\x1b[0m';
|
|
@@ -128,7 +131,7 @@ export function renderSplash({ digest = null, sections, workspace }) {
|
|
|
128
131
|
? `last: ${r.last_progress.slice(0, 26)}`
|
|
129
132
|
: `lease until ${r.lease_until}`));
|
|
130
133
|
section('OPEN', open, (r) => (r.state === 'reopened' ? 'back — incomplete, actionable' : (r.state ?? 'unclaimed')));
|
|
131
|
-
section('ASSERTED', asserted,
|
|
134
|
+
section('ASSERTED', asserted, judgmentWord);
|
|
132
135
|
section('HELD', held, (r) => r.principal_id);
|
|
133
136
|
section(`BREACHED PROMISES (${MACHINE_SCOPE_LABEL})`, digest.rows,
|
|
134
137
|
(b) => `${b.kind_word}: ${rowLine(b)} · ${b.home}`, pullPointer('splash', digest.more));
|
package/src/breach-digest.mjs
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
// Nothing about a kind is spelled twice: the glass reads the words off the frame, the
|
|
15
15
|
// renderers read them off the rows.
|
|
16
16
|
|
|
17
|
+
import { Place } from './home.mjs';
|
|
18
|
+
|
|
17
19
|
/** The resumption's word — a breach that continues into the work, and every working claim. */
|
|
18
20
|
export const CONTINUE_ACT = 'continue ↗';
|
|
19
21
|
export const KINDS = Object.freeze({
|
|
@@ -22,6 +24,35 @@ export const KINDS = Object.freeze({
|
|
|
22
24
|
overdue: Object.freeze({ word: 'never verified', bucket: 'verify', act: 'verify ↗' }),
|
|
23
25
|
quiet: Object.freeze({ word: 'quiet', bucket: 'quiet', act: CONTINUE_ACT }),
|
|
24
26
|
});
|
|
27
|
+
/** The act a stall whose engine is out of date offers instead of retry (ruling 2026-09-05). */
|
|
28
|
+
export const UPDATE_ACT = 'update ↗';
|
|
29
|
+
/** The one sentence an open-app act shows on the row it expands (ruling 2026-09-05): the line is on the clipboard, the app's word is its adapter's. */
|
|
30
|
+
export const OPEN_APP_FLASH = (app) => `command copied — paste in ${app} to continue`;
|
|
31
|
+
/**
|
|
32
|
+
* The in-flight states ON a breach — ONE table (rulings 2026-09-04/05): a system claim is held,
|
|
33
|
+
* so the machine is doing the thing the row would otherwise ask for. `verify`: a judge holds
|
|
34
|
+
* `verify:<task>`. `update`: the machine holds `update:<engine>` and the row's stall names that
|
|
35
|
+
* engine as out of date. Either way the row says so, wears no failure, offers no act (the glass
|
|
36
|
+
* never offers an act it would refuse), and is not counted (nothing to act on). The pager stamps
|
|
37
|
+
* a row's `busy_word`/`busy_detail` from here; the digest and the glass render them and add nothing.
|
|
38
|
+
*/
|
|
39
|
+
export const IN_FLIGHT = Object.freeze({
|
|
40
|
+
verify: Object.freeze({ word: 'verifying', detail: 'a verifier holds it — the verdict lands on the glass' }),
|
|
41
|
+
update: Object.freeze({
|
|
42
|
+
word: (name) => `updating ${name}`,
|
|
43
|
+
detail: (name) => `${name} is updating — the judgment re-runs when it lands`,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* The judgment an ASSERTED claim awaits (ruling 2026-09-04: nothing is invisible between done
|
|
48
|
+
* and verdict): `verifying` while a judge holds the verify claim — IN_FLIGHT.verify's word,
|
|
49
|
+
* spelled once, with the spinner — and `awaiting` until one does. Keyed by the board's
|
|
50
|
+
* `judgment`; every surface renders these words and adds nothing.
|
|
51
|
+
*/
|
|
52
|
+
export const JUDGMENT = Object.freeze({
|
|
53
|
+
verifying: Object.freeze({ word: IN_FLIGHT.verify.word, busy: true }),
|
|
54
|
+
awaiting: Object.freeze({ word: 'awaiting verdict', busy: false }),
|
|
55
|
+
});
|
|
25
56
|
/** The push buckets, in the order the one ambient line speaks them. */
|
|
26
57
|
export const BUCKET_WORDS = Object.freeze({ fix: 'to fix', verify: 'to verify', quiet: 'gone quiet' });
|
|
27
58
|
/** The kinds in sharpness order: a verdict that came back first, an unjudged assertion last. */
|
|
@@ -89,8 +120,23 @@ function pushLine(counts) {
|
|
|
89
120
|
return parts.length > 0 ? parts.join(' · ') : null;
|
|
90
121
|
}
|
|
91
122
|
|
|
123
|
+
/** A member's word: the kind's, unless its judgment is in flight. */
|
|
124
|
+
// A busy row wears the in-flight words the pager stamped (IN_FLIGHT); a busy row without them is
|
|
125
|
+
// not a row the pager made — refused, never defaulted (zero legacy, 2026-09-05).
|
|
126
|
+
const busyWords = (breach) => {
|
|
127
|
+
if (typeof breach.busy_word !== 'string' || typeof breach.busy_detail !== 'string') {
|
|
128
|
+
throw new DigestError('OATHE_DIGEST_BUSY_UNWORDED', `busy breach '${breach.task_id}' carries no busy_word/busy_detail — the pager stamps both`, { task_id: breach.task_id });
|
|
129
|
+
}
|
|
130
|
+
return { word: breach.busy_word, detail: breach.busy_detail };
|
|
131
|
+
};
|
|
132
|
+
const busyWord = (breach) => busyWords(breach).word;
|
|
133
|
+
const busyDetail = (breach) => busyWords(breach).detail;
|
|
134
|
+
const wordOf = (breach) => (breach.busy ? busyWord(breach) : KINDS[breach.kind].word);
|
|
135
|
+
|
|
92
136
|
function single(breach) {
|
|
93
|
-
return
|
|
137
|
+
return breach.busy
|
|
138
|
+
? { ...breach, busy: true, kind_word: busyWord(breach), detail: busyDetail(breach), group: null }
|
|
139
|
+
: { ...breach, busy: false, kind_word: KINDS[breach.kind].word, group: null };
|
|
94
140
|
}
|
|
95
141
|
|
|
96
142
|
/**
|
|
@@ -103,25 +149,39 @@ function groupRow(own, children) {
|
|
|
103
149
|
const members = [...(own ? [own] : []), ...children].sort(breachOrder);
|
|
104
150
|
const sortedChildren = [...children].sort(breachOrder);
|
|
105
151
|
const byKind = {};
|
|
106
|
-
|
|
152
|
+
let busyChildren = 0;
|
|
153
|
+
for (const child of children) {
|
|
154
|
+
if (child.busy) busyChildren += 1;
|
|
155
|
+
else byKind[child.kind] = (byKind[child.kind] ?? 0) + 1;
|
|
156
|
+
}
|
|
107
157
|
const shown = sortedChildren.slice(0, DIGEST_ROW_CAP);
|
|
108
158
|
const more = children.length - shown.length;
|
|
109
159
|
const lead = own ?? members[0];
|
|
110
160
|
const detail = [
|
|
111
|
-
...(own ? [own.detail] : []),
|
|
112
|
-
...shown.map((child) => `${child.task_id} · ${
|
|
161
|
+
...(own ? [own.busy ? busyDetail(own) : own.detail] : []),
|
|
162
|
+
...shown.map((child) => `${child.task_id} · ${wordOf(child)} · ${child.busy ? busyDetail(child) : child.detail}`),
|
|
113
163
|
...(more > 0 ? [`+${more} more`] : []),
|
|
114
164
|
].join('\n');
|
|
165
|
+
// The one act a verify-led group offers targets its oldest child whose judgment is NOT in
|
|
166
|
+
// flight — a child being judged is not retried; none idle → the row offers no act.
|
|
167
|
+
const retry = sortedChildren.find((child) => !child.busy)?.task_id ?? null;
|
|
115
168
|
return {
|
|
116
169
|
kind: members[0].kind,
|
|
117
|
-
kind_word: [
|
|
170
|
+
kind_word: [
|
|
171
|
+
...(own ? [wordOf(own)] : []),
|
|
172
|
+
countWords(byKind),
|
|
173
|
+
...(busyChildren > 0 ? [`${busyChildren} ${IN_FLIGHT.verify.word}`] : []),
|
|
174
|
+
].filter(Boolean).join(' · '),
|
|
118
175
|
task_id: own ? own.task_id : children[0].parent,
|
|
119
176
|
objective: own ? own.objective : children[0].parent_objective,
|
|
120
177
|
home: lead.home,
|
|
121
178
|
home_ref: lead.home_ref,
|
|
179
|
+
place: lead.place ?? null,
|
|
180
|
+
places: lead.places ?? [],
|
|
122
181
|
detail,
|
|
123
182
|
at: members[0].at,
|
|
124
|
-
|
|
183
|
+
busy: own?.busy === true,
|
|
184
|
+
group: { n: children.length, by_kind: byKind, children: shown.map((child) => child.task_id), more, retry },
|
|
125
185
|
};
|
|
126
186
|
}
|
|
127
187
|
|
|
@@ -159,8 +219,10 @@ export class BreachDigest {
|
|
|
159
219
|
}
|
|
160
220
|
}
|
|
161
221
|
this.#breaches = breaches;
|
|
222
|
+
// A judgment in flight is not a breach to act on: it keeps its row (a person sees it
|
|
223
|
+
// verifying) and leaves every count — the ambient line, attention, the model channel.
|
|
162
224
|
this.counts = Object.fromEntries(BREACH_KINDS.map((kind) => [kind, 0]));
|
|
163
|
-
for (const breach of breaches) this.counts[breach.kind] += 1;
|
|
225
|
+
for (const breach of breaches) if (!breach.busy) this.counts[breach.kind] += 1;
|
|
164
226
|
this.total = breaches.length;
|
|
165
227
|
this.push = pushLine(this.counts);
|
|
166
228
|
const { rows, rowOf } = groupSiblings(breaches);
|
|
@@ -171,9 +233,12 @@ export class BreachDigest {
|
|
|
171
233
|
}
|
|
172
234
|
|
|
173
235
|
/** This board's digest — the facts homed on `homeRef`; `null` is the whole machine (this). */
|
|
174
|
-
scoped(
|
|
175
|
-
if (
|
|
176
|
-
|
|
236
|
+
scoped(workspaceRef) {
|
|
237
|
+
if (workspaceRef === null) return this;
|
|
238
|
+
// A breach belongs to EVERY folder that ever picked its task up (ruling 2026-09-05) — the
|
|
239
|
+
// row's `places` — never only to where it resides now.
|
|
240
|
+
const here = String(Place.workspace(workspaceRef));
|
|
241
|
+
return new BreachDigest({ breaches: this.#breaches.filter((breach) => (breach.places ?? []).includes(here)) });
|
|
177
242
|
}
|
|
178
243
|
|
|
179
244
|
/** The digest over the rows `keep` accepts — a group is kept or dropped whole. */
|
package/src/config.mjs
CHANGED
|
@@ -74,6 +74,30 @@ const KEYS = Object.freeze({
|
|
|
74
74
|
// The notch feed's drift guard: `oathe notch --serve` recomputes a frame this often even
|
|
75
75
|
// when no wire event arrives (the push path is pg_notify; this is the belt to its braces).
|
|
76
76
|
notchHeartbeatSeconds: { default: 300, env: 'OATHE_NOTCH_HEARTBEAT_SECONDS', check: positiveInt },
|
|
77
|
+
// The notch restart budget: launchd's bootout returns before the old job is gone, and a
|
|
78
|
+
// bootstrap in that window is refused ("5: Input/output error") — init re-tries inside
|
|
79
|
+
// this budget, asking this often, and says NOT RUNNING past it (the 0.4.3 update left
|
|
80
|
+
// every re-wired notch unloaded because the one attempt's refusal went unread).
|
|
81
|
+
notchRestartSeconds: { default: 10, env: 'OATHE_NOTCH_RESTART_SECONDS', check: positiveInt },
|
|
82
|
+
notchRestartPollMs: { default: 100, env: 'OATHE_NOTCH_RESTART_POLL_MS', check: positiveInt },
|
|
83
|
+
// The serve daemon (connection-lane phase 2): the unix socket the device's one oathe
|
|
84
|
+
// presence answers on — null derives <oathe home>/serve.sock (src/serve.mjs); a path
|
|
85
|
+
// overrides it. The connect budget is the forwarder's ONE attempt before it falls back to
|
|
86
|
+
// the standalone stdio server (a measured fact, never a hang); the restart budget is the
|
|
87
|
+
// same launchd lesson the notch keys carry.
|
|
88
|
+
serveSocket: { default: null, env: 'OATHE_SERVE_SOCKET', check: nullOrString },
|
|
89
|
+
serveConnectMs: { default: 250, env: 'OATHE_SERVE_CONNECT_MS', check: positiveInt },
|
|
90
|
+
serveRestartSeconds: { default: 10, env: 'OATHE_SERVE_RESTART_SECONDS', check: positiveInt },
|
|
91
|
+
serveRestartPollMs: { default: 100, env: 'OATHE_SERVE_RESTART_POLL_MS', check: positiveInt },
|
|
92
|
+
// The blocking exchange, declared to the transport (ruling 2026-09-05): `done`/`verify` wait
|
|
93
|
+
// for the verdict where the work is, so every MCP client that caps a tool call must be told
|
|
94
|
+
// the budget — each adapter writes it where its client reads it (mcpToolTimeout touchpoint).
|
|
95
|
+
// 900s: ~3× the longest verify measured on the founder's substrate (p50 80s, p90 177s, max
|
|
96
|
+
// 315s over 40 runs; codex's 60s default sat below the median), finite so a wedged engine
|
|
97
|
+
// surfaces as a client timeout, never an hour-long spinner. While it waits the server says
|
|
98
|
+
// "still judging" this often — a standard MCP progress notification on the call's token.
|
|
99
|
+
mcpToolTimeoutSec: { default: 900, env: 'OATHE_MCP_TOOL_TIMEOUT_SEC', check: positiveInt },
|
|
100
|
+
mcpProgressIntervalSec: { default: 15, env: 'OATHE_MCP_PROGRESS_INTERVAL_SEC', check: positiveInt },
|
|
77
101
|
});
|
|
78
102
|
|
|
79
103
|
function nonEmptyString(v) {
|
package/src/context.mjs
CHANGED
|
@@ -20,7 +20,7 @@ export function buildContext({ env = process.env, exec, cwd = process.cwd() } =
|
|
|
20
20
|
const home = homeOf(env);
|
|
21
21
|
const config = new OatheConfig({ env, cwd });
|
|
22
22
|
const manifest = InstallManifest.load({ manifestPath: paths.manifestPath, backupsDir: paths.backupsDir });
|
|
23
|
-
const harnesses = buildAll({ home, envPath: env.PATH, paths, exec }); // the ONE roster; consumers filter by capability
|
|
23
|
+
const harnesses = buildAll({ home, envPath: env.PATH, paths, exec, config }); // the ONE roster; consumers filter by capability
|
|
24
24
|
const substrate = new Substrate({ database: config.get('db'), paths, env, config });
|
|
25
25
|
const identity = {
|
|
26
26
|
orgId: config.get('org'),
|
package/src/device.mjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// oathe — the device identity (founder ruling 2026-09-04): person → device → session. The
|
|
2
|
+
// person comes from auth at the cloud seam; the SESSION is attested on this machine by the
|
|
3
|
+
// daemon; the DEVICE is the trust unit anything outside this machine will sign against. So
|
|
4
|
+
// `oathe init` mints ONE identity under the oathe home — a random id and an ed25519 key pair,
|
|
5
|
+
// derived from no hardware, in a 0600 file — the way the shim is materialized (src/shim.mjs):
|
|
6
|
+
// an oathe-home-owned artifact with one manifest row the doctor verifies and uninstall removes.
|
|
7
|
+
// It is KEPT byte-for-byte on every re-init: re-minting would sever every prior act's device
|
|
8
|
+
// ref. A malformed file is a typed refusal, never silently replaced. No signer ships in this
|
|
9
|
+
// lane — the key is minted for enrollment, and the copy says exactly that.
|
|
10
|
+
|
|
11
|
+
import fs from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import crypto from 'node:crypto';
|
|
14
|
+
|
|
15
|
+
import { sha256Hex } from './manifest.mjs';
|
|
16
|
+
|
|
17
|
+
export const DEVICE_FORMAT = 1;
|
|
18
|
+
const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
19
|
+
|
|
20
|
+
export class OatheDeviceError extends Error {
|
|
21
|
+
constructor(code, message, details = {}) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'OatheDeviceError';
|
|
24
|
+
this.code = code;
|
|
25
|
+
this.details = details;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The identity on disk, whole — `null` when never minted; a broken file refuses typed. */
|
|
30
|
+
function readDevice(devicePath) {
|
|
31
|
+
if (!fs.existsSync(devicePath)) return null;
|
|
32
|
+
const raw = fs.readFileSync(devicePath, 'utf8');
|
|
33
|
+
let doc;
|
|
34
|
+
try {
|
|
35
|
+
doc = JSON.parse(raw);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
throw new OatheDeviceError('OATHE_DEVICE_MALFORMED',
|
|
38
|
+
`${devicePath} is not JSON (${e.message}) — the device identity is never re-minted over a `
|
|
39
|
+
+ 'broken file; move it aside and run `oathe init`', { file: devicePath });
|
|
40
|
+
}
|
|
41
|
+
if (doc?.format !== DEVICE_FORMAT || typeof doc.device_id !== 'string' || !UUID_V4.test(doc.device_id)) {
|
|
42
|
+
throw new OatheDeviceError('OATHE_DEVICE_MALFORMED',
|
|
43
|
+
`${devicePath} carries no device_id in format ${DEVICE_FORMAT} — the device identity is never `
|
|
44
|
+
+ 're-minted over a broken file; move it aside and run `oathe init`', { file: devicePath });
|
|
45
|
+
}
|
|
46
|
+
return { doc, raw };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The device id — `null` when no identity was minted (never invented at read time). */
|
|
50
|
+
export function readDeviceId({ devicePath }) {
|
|
51
|
+
return readDevice(devicePath)?.doc.device_id ?? null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Mint the identity once, keep it forever, record it as ONE manifest row.
|
|
56
|
+
* @returns {[{action: 'device-minted'|'device-kept', file: string, device_id: string}]}
|
|
57
|
+
*/
|
|
58
|
+
export function writeDevice({ devicePath, manifest, version, clock = () => new Date() }) {
|
|
59
|
+
const existing = readDevice(devicePath);
|
|
60
|
+
let raw = existing?.raw;
|
|
61
|
+
let deviceId = existing?.doc.device_id;
|
|
62
|
+
if (!existing) {
|
|
63
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync('ed25519');
|
|
64
|
+
deviceId = crypto.randomUUID();
|
|
65
|
+
raw = `${JSON.stringify({
|
|
66
|
+
format: DEVICE_FORMAT,
|
|
67
|
+
device_id: deviceId,
|
|
68
|
+
key: {
|
|
69
|
+
alg: 'ed25519',
|
|
70
|
+
public_pem: publicKey.export({ type: 'spki', format: 'pem' }),
|
|
71
|
+
private_pem: privateKey.export({ type: 'pkcs8', format: 'pem' }),
|
|
72
|
+
},
|
|
73
|
+
minted_at: clock().toISOString(),
|
|
74
|
+
}, null, 2)}\n`;
|
|
75
|
+
// Temp-then-rename with the mode on the temp write, then chmod after the rename: rename
|
|
76
|
+
// keeps a pre-existing file's mode (the shim's precedent, src/shim.mjs).
|
|
77
|
+
fs.mkdirSync(path.dirname(devicePath), { recursive: true });
|
|
78
|
+
const tmp = `${devicePath}.tmp-${process.pid}`;
|
|
79
|
+
fs.writeFileSync(tmp, raw, { mode: 0o600 });
|
|
80
|
+
fs.renameSync(tmp, devicePath);
|
|
81
|
+
}
|
|
82
|
+
fs.chmodSync(devicePath, 0o600);
|
|
83
|
+
// One device, ONE row (the shim's F1 lesson): a re-run replaces, never accumulates.
|
|
84
|
+
manifest.removeWhere((r) => r.kind === 'device-id');
|
|
85
|
+
manifest.upsert({
|
|
86
|
+
harness: 'device',
|
|
87
|
+
file: devicePath,
|
|
88
|
+
kind: 'device-id',
|
|
89
|
+
detail: { device_id: deviceId },
|
|
90
|
+
blockVersion: version,
|
|
91
|
+
sha256: sha256Hex(raw),
|
|
92
|
+
});
|
|
93
|
+
return [{ action: existing ? 'device-kept' : 'device-minted', file: devicePath, device_id: deviceId }];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Remove exactly what was recorded; absence is a stated action, never silence. */
|
|
97
|
+
export function unwireDevice({ manifest }) {
|
|
98
|
+
const rows = manifest.removeWhere((r) => r.kind === 'device-id');
|
|
99
|
+
if (rows.length === 0) return [{ action: 'device-absent' }];
|
|
100
|
+
const actions = [];
|
|
101
|
+
for (const row of rows) {
|
|
102
|
+
fs.rmSync(row.file, { force: true });
|
|
103
|
+
actions.push({ action: 'device-removed', file: row.file });
|
|
104
|
+
}
|
|
105
|
+
return actions;
|
|
106
|
+
}
|