@amoree-code/ocean 2.13.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/application/upkeep/nightly-upkeep.js +1 -1
  2. package/dist/infrastructure/process/service.js +17 -0
  3. package/dist/interfaces/cli/brief-command.js +1 -1
  4. package/dist/interfaces/cli/command-registry.js +2 -1
  5. package/dist/interfaces/cli/harvest-command.js +4 -3
  6. package/dist/interfaces/cli/help-command.js +5 -5
  7. package/dist/interfaces/cli/scorecard-command.js +1 -1
  8. package/dist/interfaces/cli/setup-command.js +20 -2
  9. package/dist/interfaces/cli/tasks-command.js +31 -1
  10. package/node_modules/@ocean/brain/dist/memory/brain-dump.js +196 -26
  11. package/node_modules/@ocean/brain/dist/memory/routing.json +3 -3
  12. package/node_modules/@ocean/brain/package.json +1 -1
  13. package/node_modules/@ocean/context/package.json +1 -1
  14. package/node_modules/@ocean/core/dist/shared/paths.js +12 -1
  15. package/node_modules/@ocean/core/package.json +1 -1
  16. package/node_modules/@ocean/loop/dist/tasks/archive-tasks.js +1 -1
  17. package/node_modules/@ocean/loop/dist/tasks/sync-task-prs.js +122 -0
  18. package/node_modules/@ocean/loop/package.json +1 -1
  19. package/node_modules/@ocean/market/package.json +1 -1
  20. package/node_modules/@ocean/services/dist/brief/brief.js +2 -2
  21. package/node_modules/@ocean/services/dist/day/day.js +6 -5
  22. package/node_modules/@ocean/services/dist/distill/distill.js +8 -8
  23. package/node_modules/@ocean/services/dist/harvest/harvest.js +56 -31
  24. package/node_modules/@ocean/services/dist/hygiene/hygiene.js +2 -2
  25. package/node_modules/@ocean/services/dist/scorecard/scorecard.js +2 -2
  26. package/node_modules/@ocean/services/dist/upkeep/upkeep.js +2 -2
  27. package/node_modules/@ocean/services/package.json +1 -1
  28. package/ocean-marketplace.json +38 -38
  29. package/package.json +7 -7
  30. package/skills/core/daily-harvest/SKILL.md +3 -3
  31. package/skills/core/weekly-review/SKILL.md +1 -1
  32. package/templates/workspace/charter/policies/task.md +4 -1
@@ -0,0 +1,122 @@
1
+ import { readdir, readFile, writeFile } from "node:fs/promises";
2
+ import { resolveWithin } from "@ocean/core/shared/paths.js";
3
+ import { completionIssues } from "./archive-tasks.js";
4
+ // States the sync may move. `blocked`, `done` and `cancelled` are the owner's or the gate's.
5
+ const SYNCED = new Set(["todo", "active", "paused", "in-qa"]);
6
+ const PR_URL = /https:\/\/github\.com\/([\w.-]+\/[\w.-]+)\/pull\/(\d+)/g;
7
+ export function prLinks(source) {
8
+ const seen = new Map();
9
+ for (const match of source.matchAll(PR_URL)) {
10
+ const repo = match[1];
11
+ const number = Number(match[2]);
12
+ const url = `https://github.com/${repo}/pull/${number}`;
13
+ if (!seen.has(url))
14
+ seen.set(url, { url, repo, number });
15
+ }
16
+ return [...seen.values()];
17
+ }
18
+ // The state the linked PRs call for, or null when they call for no move. Closed-unmerged PRs
19
+ // do not count: a task whose only PR was closed is left alone.
20
+ export function targetState(states) {
21
+ if (states.includes("OPEN"))
22
+ return "in-qa";
23
+ if (states.includes("MERGED"))
24
+ return "done";
25
+ return null;
26
+ }
27
+ function field(source, name) {
28
+ const end = source.indexOf("\n---", 4);
29
+ const head = end > 0 ? source.slice(0, end) : source;
30
+ return head.match(new RegExp(`^${name}:\\s*(.+)$`, "m"))?.[1]?.trim();
31
+ }
32
+ function withState(source, state, note, day) {
33
+ let next = source
34
+ .replace(/^state:\s*.+$/m, `state: ${state}`)
35
+ .replace(/^updated:\s*.+$/m, `updated: ${day}`);
36
+ const log = /^## Log[ \t]*\r?\n\r?\n?/m.exec(next);
37
+ if (log) {
38
+ const at = log.index + log[0].length;
39
+ next = `${next.slice(0, at)}- ${day} — ${note}\n\n${next.slice(at)}`;
40
+ }
41
+ return next;
42
+ }
43
+ export async function syncTaskPrs(root, options) {
44
+ const result = { changed: [], skipped: [] };
45
+ const day = (options.now ?? new Date()).toISOString().slice(0, 10);
46
+ let entries;
47
+ try {
48
+ entries = await readdir(root, { withFileTypes: true });
49
+ }
50
+ catch {
51
+ return result;
52
+ }
53
+ for (const entry of entries) {
54
+ if (!entry.isDirectory() || entry.name === "archive")
55
+ continue;
56
+ const file = resolveWithin(root, entry.name, "task.md");
57
+ let source;
58
+ try {
59
+ source = await readFile(file, "utf8");
60
+ }
61
+ catch {
62
+ continue;
63
+ }
64
+ const id = field(source, "id") ?? entry.name;
65
+ const from = field(source, "state") ?? "";
66
+ if (!SYNCED.has(from))
67
+ continue;
68
+ const links = prLinks(source);
69
+ if (!links.length)
70
+ continue;
71
+ let states;
72
+ try {
73
+ states = await Promise.all(links.map((link) => options.fetchPr(link)));
74
+ }
75
+ catch (error) {
76
+ result.skipped.push({
77
+ id,
78
+ reason: error instanceof Error ? error.message : String(error),
79
+ });
80
+ continue;
81
+ }
82
+ const to = targetState(states);
83
+ if (!to || to === from)
84
+ continue;
85
+ const prs = links.map((link, index) => `${link.url} (${states[index]})`);
86
+ if (to === "in-qa") {
87
+ result.changed.push({ id, from, to, prs });
88
+ if (options.apply)
89
+ await writeFile(file, withState(source, "in-qa", `${from} → in-qa (sync): PR open.`, day));
90
+ continue;
91
+ }
92
+ // Every linked PR is merged: the completion gate decides whether it is done. Its cheap
93
+ // checks run first, so a task that cannot complete is not re-verified on every sync.
94
+ const issues = completionIssues(source);
95
+ if (!issues.length && !options.apply) {
96
+ result.changed.push({ id, from, to, prs });
97
+ continue;
98
+ }
99
+ let reason = issues.length
100
+ ? `Cannot complete ${id}: ${issues.join("; ")}`
101
+ : undefined;
102
+ if (!reason) {
103
+ try {
104
+ await options.complete(entry.name, root);
105
+ result.changed.push({ id, from, to, prs });
106
+ continue;
107
+ }
108
+ catch (error) {
109
+ reason = error instanceof Error ? error.message : String(error);
110
+ }
111
+ }
112
+ // Refused: the task waits in `in-qa`. The log gets a line only when the state moves.
113
+ result.skipped.push({ id, reason });
114
+ if (from === "in-qa")
115
+ continue;
116
+ result.changed.push({ id, from, to: "in-qa", prs, reason });
117
+ if (options.apply)
118
+ await writeFile(file, withState(await readFile(file, "utf8"), "in-qa", `${from} → in-qa (sync): PR merged, not completed: ${reason}`, day));
119
+ }
120
+ return result;
121
+ }
122
+ //# sourceMappingURL=sync-task-prs.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/loop",
3
- "version": "2.13.0",
3
+ "version": "2.15.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/market",
3
- "version": "2.13.0",
3
+ "version": "2.15.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -2,14 +2,14 @@ import { createHash } from "node:crypto";
2
2
  import { mkdir, readdir, readFile, stat } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { atomicWrite, parseFrontmatter } from "@ocean/core/shared/fs-utils.js";
5
- import { DAILY_DIR, KNOWLEDGE_DIR, NOTES_DIR, oceanPath, PERSONAL_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
5
+ import { KNOWLEDGE_DIR, NOTES_DIR, oceanPath, PERSONAL_DIR, REPORTS_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
6
6
  // The daily brief (T-314): what moved in the things the owner follows. Interests are files in
7
7
  // 02-personal/interests/ (`type: interest`, priority, keywords, sources); a source is a feed URL
8
8
  // (RSS or Atom) or `github:<owner>/<repo>` for that repo's releases. A seen-ledger keeps an item
9
9
  // from coming back. Daily: high-priority interests only, five items at most. Weekly: every
10
10
  // interest, fifteen at most. No model and no web search here: the brief is the feed, filtered.
11
11
  export const INTERESTS_DIR = `${PERSONAL_DIR}/interests`;
12
- const BRIEFS_DIR = `${DAILY_DIR}/briefs`;
12
+ const BRIEFS_DIR = `${REPORTS_DIR}/briefs`;
13
13
  const DAILY_LIMIT = 5;
14
14
  const WEEKLY_LIMIT = 15;
15
15
  const FETCH_TIMEOUT_MS = 10_000;
@@ -2,7 +2,7 @@ import { mkdir, readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { memoryDigest } from "@ocean/brain/memory/memory-digest.js";
4
4
  import { atomicWrite, withFileLock } from "@ocean/core/shared/fs-utils.js";
5
- import { DAILY_DIR, oceanPath, PERSONAL_DIR, } from "@ocean/core/shared/paths.js";
5
+ import { DAILY_DIR, oceanPath, PERSONAL_DIR, REPORTS_DIR, } from "@ocean/core/shared/paths.js";
6
6
  import { listTasks } from "@ocean/loop/tasks/list-tasks.js";
7
7
  import { buildBrief } from "../brief/brief.js";
8
8
  import { keepTicks, loopKey, noteFile, noteRelative, putBlock, readBlock, } from "./note.js";
@@ -12,7 +12,8 @@ import { keepTicks, loopKey, noteFile, noteRelative, putBlock, readBlock, } from
12
12
  // Written between markers under the title; rerunning replaces only that block.
13
13
  const DAY_MS = 24 * 60 * 60 * 1000;
14
14
  const AHEAD_DAYS = 30;
15
- const LOOP_DAYS = 14;
15
+ // Loops carry for three mornings; older ones stay in their session records.
16
+ const LOOP_DAYS = 3;
16
17
  const EVENT = /\b(exam|deadline|due|interview|meeting|appointment|call|submit|test)\b|موعد|امتحان|مقابلة/i;
17
18
  const OPEN_STATES = new Set([
18
19
  "active",
@@ -78,7 +79,7 @@ export async function upcoming(date) {
78
79
  .filter((line) => !seen.has(line) && seen.add(line))
79
80
  .slice(0, 8);
80
81
  }
81
- // Unticked open loops from the last two weeks of notes, oldest first; ticking one in any note
82
+ // Unticked open loops from the last three days of notes, oldest first; ticking one in any note
82
83
  // (`- [x]`) closes it everywhere.
83
84
  export async function openLoops(date) {
84
85
  const notes = [];
@@ -140,7 +141,7 @@ export async function prepareDay(options) {
140
141
  fetchText: options.fetchText,
141
142
  }).catch(() => null);
142
143
  // Items already in today's brief (an earlier run marked them seen) still lead the morning.
143
- const briefFile = oceanPath(DAILY_DIR, "briefs", `${date}.md`);
144
+ const briefFile = oceanPath(REPORTS_DIR, "briefs", `${date}.md`);
144
145
  const earlier = (await readFile(briefFile, "utf8").catch(() => ""))
145
146
  .split("\n")
146
147
  .filter((line) => line.startsWith("- **"));
@@ -154,7 +155,7 @@ export async function prepareDay(options) {
154
155
  const hasFile = Boolean(brief?.file) || earlier.length > 0;
155
156
  const briefLines = [
156
157
  ...top,
157
- ...(hasFile ? [`- Full brief: [${date}](briefs/${date}.md)`] : []),
158
+ ...(hasFile ? [`- Full brief: [${date}](reports/briefs/${date}.md)`] : []),
158
159
  ...(brief?.resurface ? [`- Look again: ${brief.resurface}`] : []),
159
160
  ...(options.news
160
161
  ? [`- ${options.news.replace(/\s+/g, " ").slice(0, 600)}`]
@@ -4,10 +4,10 @@ import { proposeMemory } from "@ocean/brain/memory/memory-write.js";
4
4
  import { MemoryContractError } from "@ocean/core/domain/mcp/memory-contract.js";
5
5
  import { cleanTitle } from "@ocean/core/shared/clean-title.js";
6
6
  import { atomicWrite, parseFrontmatter } from "@ocean/core/shared/fs-utils.js";
7
- import { DAILY_DIR, INBOX_DIR, KNOWLEDGE_DIR, oceanPath, PERSONAL_DIR, } from "@ocean/core/shared/paths.js";
7
+ import { DAILY_DIR, INBOX_DIR, KNOWLEDGE_DIR, oceanPath, PERSONAL_DIR, REPORTS_DIR, } from "@ocean/core/shared/paths.js";
8
8
  import { listMilestones } from "../express/express.js";
9
9
  // The weekly distill (T-314): a week's session records and briefs become one digest in
10
- // 01-daily/weekly/, the Decisions and Learned sections become knowledge candidates for review,
10
+ // 01-daily/reports/weekly/, the Decisions and Learned sections become knowledge candidates for review,
11
11
  // each record read is marked `distilled: true`, and inbox captures marked processed move to
12
12
  // 00-inbox/archive/<week>/. Dry run unless `apply`. Nothing is written as knowledge directly.
13
13
  const DAY = 24 * 60 * 60 * 1000;
@@ -72,7 +72,7 @@ export async function distillWeek(options) {
72
72
  const title = cleanTitle(/^# (.+)$/m.exec(text)?.[1] ?? "", fields.project || path.basename(file, ".md"));
73
73
  sessions.push({ file, text, title, status: fields.status ?? "" });
74
74
  }
75
- const briefs = (await markdownIn(oceanPath(DAILY_DIR, "briefs"))).filter((file) => inWeek(/(\d{4}-\d{2}-\d{2})/.exec(path.basename(file))?.[1]));
75
+ const briefs = (await markdownIn(oceanPath(REPORTS_DIR, "briefs"))).filter((file) => inWeek(/(\d{4}-\d{2}-\d{2})/.exec(path.basename(file))?.[1]));
76
76
  const captures = [];
77
77
  for (const file of await markdownIn(oceanPath(INBOX_DIR, "captures")))
78
78
  if (/^status:\s*processed\s*$/m.test(await readFile(file, "utf8")))
@@ -104,9 +104,9 @@ export async function distillWeek(options) {
104
104
  const learned = pick("Learned");
105
105
  const problems = pick("Problems → fixes");
106
106
  const next = pick("Next");
107
- const link = (file, label) => `[${label.replace(/[[\]]/g, "")}](../${path.relative(oceanPath(DAILY_DIR), file).split(path.sep).join("/")})`;
107
+ const link = (file, label) => `[${label.replace(/[[\]]/g, "")}](${path.relative(oceanPath(REPORTS_DIR, "weekly"), file).split(path.sep).join("/")})`;
108
108
  const list = (items) => items.map(({ item, text }) => `- ${link(item.file, item.title)}: ${text.replace(/\s+/g, " ").slice(0, 400)}`);
109
- const digestRelative = `${DAILY_DIR}/weekly/${week.label}.md`;
109
+ const digestRelative = `${REPORTS_DIR}/weekly/${week.label}.md`;
110
110
  result.digest = digestRelative;
111
111
  if (!options.apply)
112
112
  return result;
@@ -182,7 +182,7 @@ export async function reviewMonth(options) {
182
182
  const first = `${month}-01`;
183
183
  const last = `${month}-31`;
184
184
  const weeks = [];
185
- for (const file of await markdownIn(oceanPath(DAILY_DIR, "weekly"))) {
185
+ for (const file of await markdownIn(oceanPath(REPORTS_DIR, "weekly"))) {
186
186
  const fields = parseFrontmatter(await readFile(file, "utf8"));
187
187
  if (fields.type !== "weekly")
188
188
  continue;
@@ -194,7 +194,7 @@ export async function reviewMonth(options) {
194
194
  const sessions = (await markdownIn(oceanPath(DAILY_DIR, "sessions", month)))
195
195
  .length;
196
196
  const goals = await goalNames();
197
- const relative = `${DAILY_DIR}/monthly/${month}.md`;
197
+ const relative = `${REPORTS_DIR}/monthly/${month}.md`;
198
198
  const result = {
199
199
  month,
200
200
  review: relative,
@@ -213,7 +213,7 @@ export async function reviewMonth(options) {
213
213
  // The owner's answers live in this file; a rerun never overwrites them.
214
214
  if (await readFile(file, "utf8").then(() => true, () => false))
215
215
  return result;
216
- const link = (target, label) => `[${label.replace(/[[\]]/g, "")}](../${path.relative(oceanPath(DAILY_DIR), target).split(path.sep).join("/")})`;
216
+ const link = (target, label) => `[${label.replace(/[[\]]/g, "")}](${path.relative(oceanPath(REPORTS_DIR, "monthly"), target).split(path.sep).join("/")})`;
217
217
  const body = [
218
218
  "---",
219
219
  "type: monthly",
@@ -17,6 +17,11 @@ import { section } from "../distill/distill.js";
17
17
  const DAY_MS = 24 * 60 * 60 * 1000;
18
18
  const MAX_SESSION_MS = 8 * 60 * 60 * 1000;
19
19
  const MIN_ITEM = 25;
20
+ // A journal line stays one line; a session lists at most this many Next steps.
21
+ const JOURNAL_CHARS = 200;
22
+ const JOURNAL_NEXT = 3;
23
+ // "Completed." is a status, not an outcome (older closeout records wrote it on every session).
24
+ const PLACEHOLDER = /^(not stated|no objective was captured|none|n\/a|completed)\.?$/i;
20
25
  const SAME_TITLE = 0.6;
21
26
  // Where each kind of harvested item is filed, and the record type it carries.
22
27
  const KINDS = {
@@ -253,36 +258,53 @@ function dayBlock(input) {
253
258
  const byProvider = new Map();
254
259
  for (const session of input.sessions)
255
260
  byProvider.set(session.provider || "unknown", (byProvider.get(session.provider || "unknown") ?? 0) + 1);
256
- const kind = (k, label) => {
257
- const items = input.items.filter((item) => item.kind === k);
258
- return items.length
259
- ? [
260
- "",
261
- `### ${label}`,
262
- "",
263
- ...items.map((item) => {
264
- const filed = input.filed.get(item);
265
- return `- ${item.text}${filed ? ` → \`${filed}\`` : ""} (${link(item.session)})`;
266
- }),
267
- ]
268
- : [];
261
+ // One journal entry per session, newest first: what it was for, how it ended, what was
262
+ // decided, and its Next steps as open loops (carried forward a few mornings until ticked).
263
+ const line = (text) => text.length > JOURNAL_CHARS ? `${text.slice(0, JOURNAL_CHARS - 1)}…` : text;
264
+ // Goal and Outcome are prose: kept however short, unless a placeholder.
265
+ const first = (session, heading) => {
266
+ const text = clean(section(session.text, heading));
267
+ return text && !PLACEHOLDER.test(text) && !containsKnownSecret(text)
268
+ ? text
269
+ : "";
269
270
  };
270
- // Every Next a session left is an open loop: carried forward each morning until ticked.
271
- const loops = input.sessions.flatMap((session) => sectionItems(session.text, "Next").map((item) => `- [ ] ${item} (${link(session)})`));
271
+ const journal = [...input.sessions]
272
+ .sort((a, b) => b.relative.localeCompare(a.relative))
273
+ .flatMap((session) => {
274
+ const time = /(\d{4}-\d{2}-\d{2})-(\d{2})(\d{2})/.exec(path.basename(session.file));
275
+ const head = [
276
+ time ? `${time[2]}:${time[3]}` : "",
277
+ session.provider,
278
+ session.title,
279
+ ]
280
+ .filter(Boolean)
281
+ .join(" · ");
282
+ const decisions = sectionItems(session.text, KINDS.decision.heading);
283
+ const goal = first(session, "Goal");
284
+ const outcome = first(session, "Outcome");
285
+ return [
286
+ "",
287
+ `### ${head}`,
288
+ "",
289
+ ...(goal ? [`- Goal: ${line(goal)}`] : []),
290
+ ...(outcome ? [`- Outcome: ${line(outcome)}`] : []),
291
+ ...(decisions.length
292
+ ? [
293
+ `- Decided: ${line(decisions[0])}${decisions.length > 1 ? ` (+${decisions.length - 1} more)` : ""}`,
294
+ ]
295
+ : []),
296
+ ...sectionItems(session.text, "Next")
297
+ .slice(0, JOURNAL_NEXT)
298
+ .map((item) => `- [ ] ${line(item)} (${link(session)})`),
299
+ `- Record: ${link(session)}`,
300
+ ];
301
+ });
272
302
  const minutes = Object.entries(input.minutes).sort((a, b) => b[1] - a[1]);
273
303
  return [
274
304
  "## Day summary",
275
305
  "",
276
306
  `${input.sessions.length} session(s): ${[...byProvider].map(([provider, n]) => `${provider} ${n}`).join(", ") || "none"}.`,
277
- "",
278
- "### Sessions",
279
- "",
280
- ...(input.sessions.length
281
- ? input.sessions.map((session) => `- ${link(session)} — ${[session.project, session.provider, session.status].filter(Boolean).join(" · ")}`)
282
- : ["- none"]),
283
- ...kind("decision", "Decisions"),
284
- ...kind("solution", "Problems → fixes"),
285
- ...kind("discovery", "Learned"),
307
+ ...(journal.length ? ["", "## Journal", ...journal] : []),
286
308
  ...(input.captures.length
287
309
  ? ["", "### Captured", "", ...input.captures]
288
310
  : []),
@@ -292,7 +314,6 @@ function dayBlock(input) {
292
314
  `_Filed into knowledge on its own; undo with \`ocean harvest undo ${input.date}\`._`,
293
315
  ]
294
316
  : []),
295
- ...(loops.length ? ["", "## Open loops", "", ...loops] : []),
296
317
  ...(input.corrections.length
297
318
  ? [
298
319
  "",
@@ -371,7 +392,6 @@ export async function harvestDay(options) {
371
392
  await mkdir(path.dirname(file), { recursive: true });
372
393
  const body = dayBlock({
373
394
  sessions,
374
- items,
375
395
  filed,
376
396
  corrections,
377
397
  minutes,
@@ -431,17 +451,22 @@ export async function undoDay(date) {
431
451
  await rename(ledgerFile(date), stateDir("ledger", `${date}.undone.json`));
432
452
  return { removed, restored };
433
453
  }
434
- // After `days`, a harvested day leaves the working folders: the day's note to
435
- // 01-daily/archive/<YYYY-MM>/, its session records to 01-daily/sessions/archive/<YYYY-MM>/ (still
436
- // searched). Nothing is deleted, and nothing unharvested moves.
454
+ // A harvested day leaves the working folders: after `days` (a week) its note goes to
455
+ // 01-daily/archive/<YYYY-MM>/, so the root holds about the last seven days; after `sessionDays`
456
+ // (a month) its session records go to 01-daily/sessions/archive/<YYYY-MM>/ (still searched).
457
+ // Nothing is deleted, and nothing unharvested moves.
437
458
  export async function archiveHarvested(options) {
438
- const cutoff = new Date(Date.parse(options.today) - (options.days ?? 30) * DAY_MS)
459
+ const before = (days) => new Date(Date.parse(options.today) - days * DAY_MS)
439
460
  .toISOString()
440
461
  .slice(0, 10);
462
+ const cutoff = before(options.days ?? 7);
463
+ const sessionCutoff = before(options.sessionDays ?? 30);
441
464
  const moves = [];
442
465
  for (const file of await markdownIn(sessionsRoot())) {
443
466
  const fields = parseFrontmatter((await readFile(file, "utf8")).slice(0, 4096));
444
- if (fields.type !== "session" || !fields.date || fields.date >= cutoff)
467
+ if (fields.type !== "session" ||
468
+ !fields.date ||
469
+ fields.date >= sessionCutoff)
445
470
  continue;
446
471
  if (!fields.harvested)
447
472
  continue;
@@ -2,7 +2,7 @@ import { mkdir, readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { appendAudit, readAudit, sha256, } from "@ocean/brain/memory/memory-audit.js";
4
4
  import { atomicWrite, parseFrontmatter } from "@ocean/core/shared/fs-utils.js";
5
- import { DAILY_DIR, KNOWLEDGE_DIR, oceanPath, PERSONAL_DIR, PROJECTS_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
5
+ import { KNOWLEDGE_DIR, oceanPath, PERSONAL_DIR, PROJECTS_DIR, REPORTS_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
6
6
  import { setFrontmatterFields } from "@ocean/loop/tasks/task-verification.js";
7
7
  const SKIP_HOSTS = /^(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]|example\.(com|org|net)|[^/]*\.(local|test|example|invalid))$/i;
8
8
  const PLACEHOLDER = /[<>*{}$|]|\.\.\./;
@@ -84,7 +84,7 @@ export function stampFor(source, verdict, today) {
84
84
  const next = setFrontmatterFields(source, change);
85
85
  return next === source ? null : next;
86
86
  }
87
- export const hygieneFile = (month) => oceanPath(DAILY_DIR, "hygiene", `${month}.md`);
87
+ export const hygieneFile = (month) => oceanPath(REPORTS_DIR, "hygiene", `${month}.md`);
88
88
  export async function runHygiene(options) {
89
89
  const root = oceanPath();
90
90
  const cache = new Map();
@@ -1,7 +1,7 @@
1
1
  import { mkdir, readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { atomicWrite, parseFrontmatter } from "@ocean/core/shared/fs-utils.js";
4
- import { DAILY_DIR, KNOWLEDGE_DIR, listProjectDirs, oceanPath, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
4
+ import { KNOWLEDGE_DIR, listProjectDirs, oceanPath, REPORTS_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
5
5
  import { sessionTokens } from "@ocean/loop/runs/session-tokens.js";
6
6
  import { RECURRENCE_WINDOW_DAYS, } from "../journey/failures.js";
7
7
  // Moved to the loop package (T-322) so run guards can count tokens; re-exported for callers.
@@ -259,7 +259,7 @@ export async function readSearchEval() {
259
259
  }
260
260
  }
261
261
  export function scorecardFile(date) {
262
- return oceanPath(DAILY_DIR, "scorecard", `${date}.md`);
262
+ return oceanPath(REPORTS_DIR, "scorecard", `${date}.md`);
263
263
  }
264
264
  export async function writeScorecard(rows, date) {
265
265
  const file = scorecardFile(date);
@@ -1,7 +1,7 @@
1
1
  import { mkdir, readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { atomicWrite } from "@ocean/core/shared/fs-utils.js";
4
- import { DAILY_DIR, oceanPath } from "@ocean/core/shared/paths.js";
4
+ import { oceanPath, REPORTS_DIR } from "@ocean/core/shared/paths.js";
5
5
  import { scorecardFile } from "../scorecard/scorecard.js";
6
6
  const tokens = (n) => n.toLocaleString("en-US");
7
7
  const lastLine = (text) => text.trim().split(/\r?\n/).filter(Boolean).at(-1)?.slice(0, 200) ?? "";
@@ -86,7 +86,7 @@ export async function previousScorecard(date) {
86
86
  .at(-1);
87
87
  return earlier ? readFile(path.join(dir, earlier), "utf8") : null;
88
88
  }
89
- export const digestFile = (date) => oceanPath(DAILY_DIR, "digest", `${date}.md`);
89
+ export const digestFile = (date) => oceanPath(REPORTS_DIR, "digest", `${date}.md`);
90
90
  export function renderDigest(input) {
91
91
  const failed = input.results.filter((result) => !result.ok);
92
92
  const cell = (text) => text.replace(/\|/g, "\\|");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/services",
3
- "version": "2.13.0",
3
+ "version": "2.15.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {