shadok-ai 0.14.8 → 0.14.10
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/context/ledger-skill/SKILL.md +8 -0
- package/context/ledger-skill/ledger-core.d.mts +1 -0
- package/context/ledger-skill/ledger-core.mjs +14 -0
- package/context/ledger-skill/ledger.mjs +11 -1
- package/dist/detect.d.ts +7 -1
- package/dist/detect.js +30 -2
- package/dist/detect.js.map +1 -1
- package/dist/ledger.d.ts +18 -5
- package/dist/ledger.js +140 -41
- package/dist/ledger.js.map +1 -1
- package/dist/server.js +14 -3
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/session.js +2 -2
- package/dist/session.js.map +1 -1
- package/dist/tmux.d.ts +1 -1
- package/dist/tmux.js +2 -2
- package/dist/tmux.js.map +1 -1
- package/package.json +1 -1
|
@@ -68,6 +68,14 @@ sentence is what siblings are shown in the `⟦ledger⟧` block pushed ahead of
|
|
|
68
68
|
messages — the entity name alone cannot tell them what changed about it. Put the
|
|
69
69
|
consequence first, details after.
|
|
70
70
|
|
|
71
|
+
**The label NAMES the topic; the note says what happened to it.** Keep the
|
|
72
|
+
entity under ~80 characters — `partner-page hospital logo`, not `13 August
|
|
73
|
+
Resources articles: C3 and A1 published, 11 drafts waiting on the daily go`.
|
|
74
|
+
The second is a note wearing a label's clothes, and the block that carries your
|
|
75
|
+
update to your siblings has room for about three rows: every character the label
|
|
76
|
+
spends is a row they are not told about. Nothing refuses a long label — the row
|
|
77
|
+
is saved either way — but only its first 80 characters reach that block.
|
|
78
|
+
|
|
71
79
|
## Is it a task, a fact, or a decision?
|
|
72
80
|
|
|
73
81
|
A **task** has a lifecycle, so a status is the right thing to carry and closing
|
|
@@ -15,6 +15,7 @@ export interface LedgerCoreRow {
|
|
|
15
15
|
}
|
|
16
16
|
export type LedgerKind = "task" | "fact" | "decision";
|
|
17
17
|
export const KINDS: LedgerKind[];
|
|
18
|
+
export const LABEL_MAX: number;
|
|
18
19
|
export function normEntity(s: unknown): string;
|
|
19
20
|
export function normKind(k: unknown): LedgerKind | null;
|
|
20
21
|
export function rowKind(entry: unknown): LedgerKind;
|
|
@@ -42,6 +42,20 @@ export function resolveId(entries, idOrPrefix) {
|
|
|
42
42
|
|
|
43
43
|
export const KINDS = ["task", "fact", "decision"];
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* How much of an entity LABEL is worth carrying, in characters. A label NAMES
|
|
47
|
+
* the topic; the note says what happened to it. The two drifted together once
|
|
48
|
+
* the pushed delta started carrying a headline: labels grew into sentences
|
|
49
|
+
* ("[modif] 13 articles Ressources d'août : C3 et A1 publiés, 11 brouillons…"),
|
|
50
|
+
* which is a note wearing a label's clothes — and on one instance that took the
|
|
51
|
+
* rendered row to a 156-character median, so a 9-row delta could name exactly
|
|
52
|
+
* one of them. Enforced on BOTH sides, because neither alone holds: the CLI
|
|
53
|
+
* warns at write time (it teaches, and the table keeps the full text), the block
|
|
54
|
+
* truncates at render time (it guarantees, whatever any agent writes). Never a
|
|
55
|
+
* refusal — a refused write is a lost fact.
|
|
56
|
+
*/
|
|
57
|
+
export const LABEL_MAX = 80;
|
|
58
|
+
|
|
45
59
|
/** The status a kind with NO lifecycle gets when none is given, so an agent is
|
|
46
60
|
* never pushed into inventing a word for a thing that has no phases. Keeping
|
|
47
61
|
* `status` always present is what leaves every existing reader — the pushed
|
|
@@ -10,7 +10,7 @@ import fs from "node:fs";
|
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import crypto from "node:crypto";
|
|
13
|
-
import { upsertEntry, searchEntries, ageDays, resolveId, normEntity, rowKind, KINDS } from "./ledger-core.mjs";
|
|
13
|
+
import { upsertEntry, searchEntries, ageDays, resolveId, normEntity, rowKind, KINDS, LABEL_MAX } from "./ledger-core.mjs";
|
|
14
14
|
|
|
15
15
|
const FILE =
|
|
16
16
|
(process.env.SHADOK_LEDGER_FILE || "").trim() ||
|
|
@@ -144,6 +144,16 @@ if (cmd === "check") {
|
|
|
144
144
|
const row = byId ? resolveId(rows, f.id) : rows.find((r) => normEntity(r.entity) === normEntity(f.entity));
|
|
145
145
|
const k = rowKind(row);
|
|
146
146
|
console.log(`recorded: ${row.entity} — ${row.status}${k === "task" ? "" : ` · ${k}`} [${row.id}]`);
|
|
147
|
+
// Say it, don't enforce it: the row is already saved (a refused write is a
|
|
148
|
+
// lost fact) and the full label stays in the table. But the delta pushed to
|
|
149
|
+
// siblings only carries the first LABEL_MAX characters of it, and a label
|
|
150
|
+
// that grew into a sentence is what makes a 9-row delta name one row.
|
|
151
|
+
if (row.entity.length > LABEL_MAX) {
|
|
152
|
+
console.log(
|
|
153
|
+
`note: that label is ${row.entity.length} characters — a label NAMES the topic, the note says what happened. ` +
|
|
154
|
+
`Only the first ${LABEL_MAX} reach the ⟦ledger⟧ block your siblings are pushed.`,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
147
157
|
} else if (cmd === "list") {
|
|
148
158
|
const rows = searchEntries(load(), "").strong;
|
|
149
159
|
console.log(rows.length ? rows.map((e) => fmt(e, now)).join("\n") : "(ledger empty)");
|
package/dist/detect.d.ts
CHANGED
|
@@ -136,5 +136,11 @@ export interface TypeOptions {
|
|
|
136
136
|
settleMs?: number;
|
|
137
137
|
/** How long to wait for the box to actually read empty after Ctrl-U. */
|
|
138
138
|
clearMs?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Injected context to put in the box BEFORE the message, as its own paste —
|
|
141
|
+
* not concatenated into it. See `typeIntoBox` for why that distinction is a
|
|
142
|
+
* correctness one.
|
|
143
|
+
*/
|
|
144
|
+
prelude?: string;
|
|
139
145
|
}
|
|
140
|
-
export declare function typeIntoBox(pilot: TypingPilot, text: string, { attempts, appearMs, settleMs, clearMs }?: TypeOptions): Promise<boolean>;
|
|
146
|
+
export declare function typeIntoBox(pilot: TypingPilot, text: string, { attempts, appearMs, settleMs, clearMs, prelude }?: TypeOptions): Promise<boolean>;
|
package/dist/detect.js
CHANGED
|
@@ -252,16 +252,42 @@ const MAX_CLEARS = 40;
|
|
|
252
252
|
/** How long one press is given to show. Above the tmux mirror's fast poll
|
|
253
253
|
* (`SCREEN_FAST_MS`), or a press that worked would read as one that did not. */
|
|
254
254
|
const CLEAR_STEP_MS = 400;
|
|
255
|
-
export async function typeIntoBox(pilot, text, { attempts = 6, appearMs = 2_000, settleMs = 400, clearMs = 1_000 } = {}) {
|
|
255
|
+
export async function typeIntoBox(pilot, text, { attempts = 6, appearMs = 2_000, settleMs = 400, clearMs = 1_000, prelude } = {}) {
|
|
256
256
|
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
257
257
|
// Only "" and the resting state count as an empty box; anything else the
|
|
258
258
|
// box shows once we paste is our paste (whole, or collapsed).
|
|
259
259
|
const before = inputText(pilot.screen());
|
|
260
|
+
if (prelude) {
|
|
261
|
+
// TWO pastes, and the second must be the message. Claude Code keeps only
|
|
262
|
+
// the CURRENT paste inline and leaves every earlier one collapsed, so
|
|
263
|
+
// pasting separately is what puts the injected context inside the
|
|
264
|
+
// `<pasted_content>` wrapper and leaves the user's words outside it.
|
|
265
|
+
// Waiting for the first to land is load-bearing: fired back to back they
|
|
266
|
+
// can reach the pane as one paste event, which is exactly the single
|
|
267
|
+
// blob this exists to stop being.
|
|
268
|
+
pilot.paste(prelude);
|
|
269
|
+
try {
|
|
270
|
+
await pilot.waitFor((s) => inputText(s) !== before, { timeoutMs: appearMs });
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
// The prelude never showed. Fall through and paste the message anyway:
|
|
274
|
+
// losing the context is survivable, losing the message is not.
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// The SCREEN, not `inputText`: the box's visible text is read off its `❯`
|
|
278
|
+
// line alone, so once a prelude has filled that line everything appended
|
|
279
|
+
// after it lands on continuation lines and `inputText` stops moving. Waiting
|
|
280
|
+
// on it then times out on a paste that arrived perfectly — which is exactly
|
|
281
|
+
// what the first version of this did, on every prelude long enough to wrap.
|
|
282
|
+
const afterPrelude = pilot.screen();
|
|
260
283
|
pilot.paste(text);
|
|
261
284
|
try {
|
|
262
285
|
await pilot.waitFor((s) => {
|
|
263
286
|
const now = inputText(s);
|
|
264
|
-
|
|
287
|
+
if (now === "" || now === before)
|
|
288
|
+
return false; // nothing in the box yet
|
|
289
|
+
// With no prelude this is the original condition, unchanged.
|
|
290
|
+
return !prelude || s !== afterPrelude;
|
|
265
291
|
}, { timeoutMs: appearMs });
|
|
266
292
|
return true;
|
|
267
293
|
}
|
|
@@ -271,6 +297,8 @@ export async function typeIntoBox(pilot, text, { attempts = 6, appearMs = 2_000,
|
|
|
271
297
|
const now = inputText(s);
|
|
272
298
|
return now === "" || now === before;
|
|
273
299
|
};
|
|
300
|
+
// `before` (not `beforeText`) on purpose: a retry re-pastes the prelude,
|
|
301
|
+
// so the box has to come back to what it was before EITHER paste.
|
|
274
302
|
// Ctrl-U clears ONE line, not the box (seen on 2.1.296): a two-line paste
|
|
275
303
|
// takes three presses — the last line, the newline, the first line. Two
|
|
276
304
|
// presses left the first line behind and the next attempt pasted after it,
|
package/dist/detect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,cAAc,GAClB,wDAAwD,CAAC;AAE3D,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,UAAkB,EAClB,WAAmB,EACnB,GAAW,EACX,QAAgB;IAEhB,IAAI,eAAe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AK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;gBAC7B,KAAK,CAAC,UAAU,EAAE,CAAC;gBACnB,IAAI,CAAC;oBACH,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;oBAC9E,MAAM;gBACR,CAAC;gBAAC,MAAM,CAAC;oBACP,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/ledger.d.ts
CHANGED
|
@@ -67,13 +67,26 @@ export declare function deltaSince(rows: LedgerRow[], watermark: number, cap: nu
|
|
|
67
67
|
export declare function headline(note: string | undefined, max?: number): string;
|
|
68
68
|
/**
|
|
69
69
|
* The delta block the agent sees ahead of a prompt. English (it is written into
|
|
70
|
-
* the transcript — repo side). ONE line
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* the transcript — repo side). ONE line: per row `• [id] entity — status
|
|
71
|
+
* (source)`, the kind when it is not the default `task`, and `↳ <headline>` for
|
|
72
|
+
* what actually happened.
|
|
73
|
+
*
|
|
74
|
+
* Labels are served BEFORE any headline, and that order is the whole of it. The
|
|
75
|
+
* first version appended row i's headline before testing whether row i+1 fitted,
|
|
76
|
+
* so the first row's detail outbid the second row's existence — measured on this
|
|
77
|
+
* table, a delta of 2, 5, 7 or 9 rows named exactly ONE of them every time, at
|
|
78
|
+
* any size, while 52 characters of the budget went unspent. `ledger list` gives
|
|
79
|
+
* the reader the notes in one call; nothing gives them back a row they were
|
|
80
|
+
* never told existed.
|
|
74
81
|
*/
|
|
75
82
|
export declare function formatLedgerBlock(rows: LedgerRow[], total: number): string;
|
|
76
|
-
/** Prepend the block as its own leading line. Idempotent.
|
|
83
|
+
/** Prepend the block as its own leading line. Idempotent.
|
|
84
|
+
*
|
|
85
|
+
* NOT how the block reaches a live agent any more — it goes in as a separate
|
|
86
|
+
* PASTE (`pilot.submit(text, prelude)`), which is what keeps the user's message
|
|
87
|
+
* out of the `<pasted_content>` wrapper. Kept because it is the exact shape of
|
|
88
|
+
* every transcript written before that change, which `stripLedgerBlock` must go
|
|
89
|
+
* on understanding and which the tests build from. */
|
|
77
90
|
export declare function markLedgerBlock(text: string, block: string): string;
|
|
78
91
|
/** Does this text open with a pushed ledger block?
|
|
79
92
|
*
|
package/dist/ledger.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import crypto from "node:crypto";
|
|
5
|
-
import { rowKind } from "../context/ledger-skill/ledger-core.mjs";
|
|
5
|
+
import { rowKind, LABEL_MAX } from "../context/ledger-skill/ledger-core.mjs";
|
|
6
6
|
/** The per-instance ledger file, keyed by the launch dir (same encoding as
|
|
7
7
|
* channels/crons). Distinct launch dirs → distinct ledgers. */
|
|
8
8
|
export function ledgerFileFor(cwd) {
|
|
@@ -106,28 +106,68 @@ const LEDGER_HEAD = "⟦ledger · ";
|
|
|
106
106
|
* lines 1–3 → 0 of 324 wrapped chars 430 on one line → not wrapped
|
|
107
107
|
* lines 4+ → ~30% of 162 wrapped chars 910 on one line → wrapped
|
|
108
108
|
*
|
|
109
|
-
*
|
|
110
|
-
* the
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
109
|
+
* The old multi-line block spent 2+ lines and put EVERY non-empty delta over
|
|
110
|
+
* the cliff: 85 real prompts, 24% of those carrying a block, had the human's
|
|
111
|
+
* message neutralised this way.
|
|
112
|
+
*
|
|
113
|
+
* Since #261 the block travels as its OWN paste, so it is judged ALONE — and
|
|
114
|
+
* the rule it is judged by is the binary's own, read out of it rather than
|
|
115
|
+
* bisected: `body.length <= 800 && newlines <= 2` (`var xK=800`). Two things
|
|
116
|
+
* follow, and they move the budget.
|
|
117
|
+
*
|
|
118
|
+
* - The cliff for the block is 800, not the 430 measured when it still had
|
|
119
|
+
* to share a prompt with the user's message. That measurement was of the
|
|
120
|
+
* WHOLE prompt and does not bound this paste.
|
|
121
|
+
* - Two newlines means the prelude may carry a SECOND line. The delta keeps
|
|
122
|
+
* one and leaves the other free; nothing here should spend it by accident.
|
|
123
|
+
*
|
|
124
|
+
* So the block stays one line out of thrift and headroom, no longer out of
|
|
125
|
+
* correctness — and its budget is now set by what the reader needs (see
|
|
126
|
+
* `ROWS_TARGET`) rather than by how little it dares to spend.
|
|
114
127
|
* ------------------------------------------------------------------ */
|
|
115
128
|
/** Marks what follows the row, inline: "and here is what happened". */
|
|
116
129
|
const CONT_MARK = "↳";
|
|
117
130
|
/** Historical multi-line blocks, still replayed out of old transcripts. */
|
|
118
131
|
const CONT_LINE = /^\s*↳ /;
|
|
119
|
-
/**
|
|
120
|
-
|
|
132
|
+
/**
|
|
133
|
+
* How much of a note reaches the block. 120 cut the first sentence of a real
|
|
134
|
+
* `decision` row at 126 characters — "aucune action directe déclenchée par…",
|
|
135
|
+
* whose missing complement ("par un mail") carried the whole decision, so what
|
|
136
|
+
* was left could be read as its opposite. 19% of this table's notes were cut at
|
|
137
|
+
* 120, 13% at 160. It stops at 160 rather than going further because a headline
|
|
138
|
+
* is only ever served WHOLE (see `formatLedgerBlock`): a larger cap does not buy
|
|
139
|
+
* better headlines, it buys fewer of them — the long ones stop fitting the room
|
|
140
|
+
* left after the labels and are dropped entirely.
|
|
141
|
+
*/
|
|
142
|
+
const HEADLINE_MAX = 160;
|
|
121
143
|
/** Below this, a sentence boundary is not believed — see `headline`. */
|
|
122
144
|
const HEADLINE_MIN = 24;
|
|
123
145
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
146
|
+
* How many rows the block tries to NAME. This, not a character count, is what
|
|
147
|
+
* the reader needs ("there are nine, here is who they are"), and it is the one
|
|
148
|
+
* quantity that does not change from one instance's table to another's: the
|
|
149
|
+
* character cost of three rows does, which is why the budget is expressed in
|
|
150
|
+
* rows and only BOUNDED in characters. A table whose labels are short pays less
|
|
151
|
+
* for the same information; one whose labels are long pays more, up to the
|
|
152
|
+
* ceiling — the cost adapts, the payload stays constant.
|
|
153
|
+
*/
|
|
154
|
+
const ROWS_TARGET = 3;
|
|
155
|
+
/**
|
|
156
|
+
* The block's character bound. Claude Code keeps a paste inline only below 800
|
|
157
|
+
* characters AND 2 newlines (`xK` in the binary; the prelude is the block plus
|
|
158
|
+
* one newline), and since the block travels as its OWN paste it is judged alone
|
|
159
|
+
* — so the old 320, calibrated when it had to share a prompt with the user's
|
|
160
|
+
* message, is no longer where the cliff is. 560 leaves the second line of the
|
|
161
|
+
* paste free and a wide margin under 800.
|
|
162
|
+
*/
|
|
163
|
+
const BLOCK_MAX = 560;
|
|
164
|
+
/**
|
|
165
|
+
* Hard stop for the rendered line, defensive only: one pathological row must not
|
|
166
|
+
* be able to push the block past the paste rule, which would collapse it into
|
|
167
|
+
* `<pasted_content>` — survivable since #261 (the block is wrapped alone and the
|
|
168
|
+
* message stays an instruction) but it would still cost the delta its voice.
|
|
129
169
|
*/
|
|
130
|
-
const
|
|
170
|
+
const LINE_CEILING = 700;
|
|
131
171
|
/**
|
|
132
172
|
* The one line of the note that says WHAT happened, DERIVED rather than asked
|
|
133
173
|
* for. The block used to carry `[id] entity — status` and nothing else, so the
|
|
@@ -163,42 +203,95 @@ export function headline(note, max = HEADLINE_MAX) {
|
|
|
163
203
|
// Break on a word unless that would throw away most of the line.
|
|
164
204
|
return (sp > max * 0.6 ? cut.slice(0, sp) : cut).trimEnd() + "…";
|
|
165
205
|
}
|
|
206
|
+
/** `• [id] entity — status (source)` — the part of a row the reader cannot
|
|
207
|
+
* reconstruct from anywhere else. The label is capped at render time, never in
|
|
208
|
+
* the table: `check` and `list` still print it whole, and the `[id]` stays the
|
|
209
|
+
* handle to quote (see `LABEL_MAX`). */
|
|
210
|
+
function bareRow(r) {
|
|
211
|
+
const handle = r.id ? `[${r.id}] ` : "";
|
|
212
|
+
const src = r.source ? ` (${r.source})` : "";
|
|
213
|
+
// A `fact` has no lifecycle and a `decision` is not a phase of one, so the
|
|
214
|
+
// reader must not take their status for a position in open → resolved.
|
|
215
|
+
// `task` is the default and nearly the whole table: tagging it would be noise.
|
|
216
|
+
const kind = rowKind(r);
|
|
217
|
+
const tag = kind === "task" ? "" : ` · ${kind}`;
|
|
218
|
+
const label = r.entity.length > LABEL_MAX ? r.entity.slice(0, LABEL_MAX - 1).trimEnd() + "…" : r.entity;
|
|
219
|
+
return ` • ${handle}${label} — ${r.status}${tag}${src}`;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* What stands for the rows the budget could not name. It carries their IDS: an
|
|
223
|
+
* id is the handle `record --id` takes and `check` resolves, so a reader that
|
|
224
|
+
* recognises one can act on it, while `+8 more` leaves it with all of them or
|
|
225
|
+
* none. The count and the list are kept HONEST apart, because the delta is
|
|
226
|
+
* capped (`LEDGER_PUSH_CAP`) and `total` can exceed the rows we were handed —
|
|
227
|
+
* announcing `+8 : <7 ids>` would quietly lose one.
|
|
228
|
+
*/
|
|
229
|
+
function overflowMark(rows, shown, total) {
|
|
230
|
+
const missing = total - shown;
|
|
231
|
+
if (missing <= 0)
|
|
232
|
+
return "";
|
|
233
|
+
const ids = rows.slice(shown).map((r) => r.id).filter(Boolean);
|
|
234
|
+
const tail = " — run: ledger list)";
|
|
235
|
+
if (!ids.length)
|
|
236
|
+
return ` • (+${missing} more${tail}`;
|
|
237
|
+
if (ids.length === missing)
|
|
238
|
+
return ` • (+${missing} : ${ids.join(" ")}${tail}`;
|
|
239
|
+
return ` • (+${missing} more, ${ids.length} newest: ${ids.join(" ")}${tail}`;
|
|
240
|
+
}
|
|
166
241
|
/**
|
|
167
242
|
* The delta block the agent sees ahead of a prompt. English (it is written into
|
|
168
|
-
* the transcript — repo side). ONE line
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
243
|
+
* the transcript — repo side). ONE line: per row `• [id] entity — status
|
|
244
|
+
* (source)`, the kind when it is not the default `task`, and `↳ <headline>` for
|
|
245
|
+
* what actually happened.
|
|
246
|
+
*
|
|
247
|
+
* Labels are served BEFORE any headline, and that order is the whole of it. The
|
|
248
|
+
* first version appended row i's headline before testing whether row i+1 fitted,
|
|
249
|
+
* so the first row's detail outbid the second row's existence — measured on this
|
|
250
|
+
* table, a delta of 2, 5, 7 or 9 rows named exactly ONE of them every time, at
|
|
251
|
+
* any size, while 52 characters of the budget went unspent. `ledger list` gives
|
|
252
|
+
* the reader the notes in one call; nothing gives them back a row they were
|
|
253
|
+
* never told existed.
|
|
172
254
|
*/
|
|
173
255
|
export function formatLedgerBlock(rows, total) {
|
|
174
|
-
|
|
256
|
+
const head = `${LEDGER_HEAD}${total} update${total === 1 ? "" : "s"}⟧`;
|
|
257
|
+
const bare = rows.map(bareRow);
|
|
258
|
+
// 1. How many rows can be named — the overflow mark is part of the bill, so a
|
|
259
|
+
// row is only taken when what stands for the rest still fits beside it.
|
|
175
260
|
let shown = 0;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
|
|
182
|
-
const kind = rowKind(r);
|
|
183
|
-
const tag = kind === "task" ? "" : ` · ${kind}`;
|
|
184
|
-
const bare = ` • ${handle}${r.entity} — ${r.status}${tag}${src}`;
|
|
185
|
-
// Always carry at least one row: an empty block would say a delta arrived
|
|
186
|
-
// and name nothing, which is worse than a long line.
|
|
187
|
-
if (shown > 0 && line.length + bare.length > BLOCK_MAX)
|
|
261
|
+
let len = head.length;
|
|
262
|
+
for (let i = 0; i < bare.length && shown < ROWS_TARGET; i++) {
|
|
263
|
+
const mark = overflowMark(rows, i + 1, total).length;
|
|
264
|
+
// Always carry at least one row: a block that announces a delta and names
|
|
265
|
+
// nothing is worse than a long line.
|
|
266
|
+
if (shown > 0 && len + bare[i].length + mark > BLOCK_MAX)
|
|
188
267
|
break;
|
|
189
|
-
|
|
268
|
+
len += bare[i].length;
|
|
190
269
|
shown++;
|
|
191
|
-
|
|
192
|
-
|
|
270
|
+
}
|
|
271
|
+
const mark = overflowMark(rows, shown, total);
|
|
272
|
+
// 2. Headlines go in the room that is left, first row first — and only WHOLE:
|
|
273
|
+
// a sentence cut by whatever happened to remain is the defect HEADLINE_MAX
|
|
274
|
+
// already exists to bound, and it can invert the meaning it loses.
|
|
275
|
+
let line = head;
|
|
276
|
+
let used = len + mark.length;
|
|
277
|
+
for (let i = 0; i < shown; i++) {
|
|
278
|
+
line += bare[i];
|
|
279
|
+
const h = headline(rows[i].note);
|
|
280
|
+
if (h && used + h.length + 3 <= BLOCK_MAX) {
|
|
193
281
|
line += ` ${CONT_MARK} ${h}`;
|
|
282
|
+
used += h.length + 3;
|
|
283
|
+
}
|
|
194
284
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// Defensive: one oversized entity must not be able to defeat the one-line rule
|
|
198
|
-
// by length, which costs exactly as much as a second line would.
|
|
199
|
-
return line.length > BLOCK_MAX * 2 ? line.slice(0, BLOCK_MAX * 2 - 1) + "…" : line;
|
|
285
|
+
line += mark;
|
|
286
|
+
return line.length > LINE_CEILING ? line.slice(0, LINE_CEILING - 1) + "…" : line;
|
|
200
287
|
}
|
|
201
|
-
/** Prepend the block as its own leading line. Idempotent.
|
|
288
|
+
/** Prepend the block as its own leading line. Idempotent.
|
|
289
|
+
*
|
|
290
|
+
* NOT how the block reaches a live agent any more — it goes in as a separate
|
|
291
|
+
* PASTE (`pilot.submit(text, prelude)`), which is what keeps the user's message
|
|
292
|
+
* out of the `<pasted_content>` wrapper. Kept because it is the exact shape of
|
|
293
|
+
* every transcript written before that change, which `stripLedgerBlock` must go
|
|
294
|
+
* on understanding and which the tests build from. */
|
|
202
295
|
export function markLedgerBlock(text, block) {
|
|
203
296
|
if (hasLedgerBlock(text))
|
|
204
297
|
return text;
|
|
@@ -233,7 +326,13 @@ export function stripLedgerBlock(text) {
|
|
|
233
326
|
let i = 1; // drop the header line
|
|
234
327
|
while (i < lines.length && (lines[i].startsWith("• ") || CONT_LINE.test(lines[i])))
|
|
235
328
|
i++;
|
|
236
|
-
|
|
329
|
+
// …and the blank lines it leaves behind. The block now travels as its OWN
|
|
330
|
+
// paste, so the transcript holds `</pasted_content>` and a blank line between
|
|
331
|
+
// it and the ⟦platform⟧ header; `userPromptText` peels the tags but not the
|
|
332
|
+
// gap. A leading blank line is not cosmetic here — `parsePromptMeta` reads the
|
|
333
|
+
// FIRST line, so it would stop recognising the header, losing the sender and
|
|
334
|
+
// leaving `⟦web · … · admin⟧` visible in the chat.
|
|
335
|
+
return lines.slice(i).join("\n").replace(/^\n+/, "");
|
|
237
336
|
}
|
|
238
337
|
/* ------------------------------------------------------------------ *
|
|
239
338
|
* The per-agent watermark: "what had this agent already seen?"
|
package/dist/ledger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../src/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAmClE;gEACgE;AAChE,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,eAAe,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S,CAAC,GAAG,EAAE,CAAC;QACpB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,GAAG,GAAG,IAAI,GAAG,MAAM,CAAC;QAC1B,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;YACxF,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QACH,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,6CAA6C;IAC/C,CAAC;AACH,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -41,7 +41,7 @@ import { peerFileFor, loadPeers, savePeers, peerFromToken, signPeerToken, newPee
|
|
|
41
41
|
import { loadCrons, saveCrons, upsertCron, removeCron, resolveCronId, nextRunFor, nextRunAfterFailure, isTransient, CRON_MAX_RETRIES, markCronPrompt, normalizeSchedule, onceAt, stateAfterFire, scheduleLabel, cronTimeZone, defaultTimeZone, systemTimeZone, isValidTimeZone, } from "./crons.js";
|
|
42
42
|
import { markPromptMeta, promptMetaHeader } from "./promptmeta.js";
|
|
43
43
|
import { runRefusal, isShellMode } from "./bang.js";
|
|
44
|
-
import { ledgerFileFor, ensureLedgerFile, loadLedger, deltaSince, formatLedgerBlock,
|
|
44
|
+
import { ledgerFileFor, ensureLedgerFile, loadLedger, deltaSince, formatLedgerBlock, ledgerSeenFileFor, seenFor, recordSeen, } from "./ledger.js";
|
|
45
45
|
// The skill's pure core is the single source of the ledger's logic (CLAUDE.md):
|
|
46
46
|
// the server imports it rather than keeping a second copy of the kind inference.
|
|
47
47
|
import { rowKind } from "../context/ledger-skill/ledger-core.mjs";
|
|
@@ -3648,14 +3648,25 @@ wss.on("connection", (ws, req) => {
|
|
|
3648
3648
|
// first meant a submit that threw (a wedged screen, invariant 23)
|
|
3649
3649
|
// burned the block for good, and keeping the mark only in memory
|
|
3650
3650
|
// meant the next restart burned it too.
|
|
3651
|
+
// It goes in as its OWN paste, never concatenated into the message.
|
|
3652
|
+
// Claude Code keeps only the current paste inline (≤800 chars and
|
|
3653
|
+
// ≤2 newlines) and wraps everything else in `<pasted_content>` —
|
|
3654
|
+
// which its own system prompt says to act on only where the user's
|
|
3655
|
+
// message asks. Pasted as one blob, the HUMAN's words ended up
|
|
3656
|
+
// inside that wrapper and stopped being an instruction: an agent
|
|
3657
|
+
// answered a direct order with "I haven't acted on that line, since
|
|
3658
|
+
// it came from the pasted text". As a separate, earlier paste the
|
|
3659
|
+
// block is wrapped — which is correct, it IS injected context — and
|
|
3660
|
+
// the message stays outside it.
|
|
3651
3661
|
let ledgerSeen = null;
|
|
3662
|
+
let ledgerPrelude;
|
|
3652
3663
|
if (ledgerEnabled) {
|
|
3653
3664
|
const { rows, total } = deltaSince(loadLedger(ledgerFileFor(process.cwd())), session.ledgerSeenAt ?? 0, LEDGER_PUSH_CAP);
|
|
3654
3665
|
ledgerSeen = Date.now();
|
|
3655
3666
|
if (rows.length)
|
|
3656
|
-
|
|
3667
|
+
ledgerPrelude = formatLedgerBlock(rows, total) + "\n";
|
|
3657
3668
|
}
|
|
3658
|
-
await session.pilot.submit(submitText);
|
|
3669
|
+
await session.pilot.submit(submitText, ledgerPrelude);
|
|
3659
3670
|
if (ledgerSeen !== null) {
|
|
3660
3671
|
session.ledgerSeenAt = ledgerSeen;
|
|
3661
3672
|
// The live channel list prunes the watermarks of agents that are
|