@corenel/harness 0.13.0 → 0.14.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 (65) hide show
  1. package/dist/audit/recorder.d.ts +6 -1
  2. package/dist/audit/recorder.d.ts.map +1 -1
  3. package/dist/audit/recorder.js +9 -2
  4. package/dist/audit/recorder.js.map +1 -1
  5. package/dist/audit/runAudit.d.ts.map +1 -1
  6. package/dist/audit/runAudit.js +2 -0
  7. package/dist/audit/runAudit.js.map +1 -1
  8. package/dist/conversation.d.ts +33 -0
  9. package/dist/conversation.d.ts.map +1 -1
  10. package/dist/conversation.js +44 -1
  11. package/dist/conversation.js.map +1 -1
  12. package/dist/core/compactHistory.d.ts +27 -18
  13. package/dist/core/compactHistory.d.ts.map +1 -1
  14. package/dist/core/compactHistory.js +106 -40
  15. package/dist/core/compactHistory.js.map +1 -1
  16. package/dist/core/foldBlocks.d.ts +43 -0
  17. package/dist/core/foldBlocks.d.ts.map +1 -0
  18. package/dist/core/foldBlocks.js +114 -0
  19. package/dist/core/foldBlocks.js.map +1 -0
  20. package/dist/core/foldTypes.d.ts +25 -0
  21. package/dist/core/foldTypes.d.ts.map +1 -0
  22. package/dist/core/foldTypes.js +2 -0
  23. package/dist/core/foldTypes.js.map +1 -0
  24. package/dist/core/loop.d.ts +19 -5
  25. package/dist/core/loop.d.ts.map +1 -1
  26. package/dist/core/loop.js +140 -69
  27. package/dist/core/loop.js.map +1 -1
  28. package/dist/core/recovery.d.ts +1 -0
  29. package/dist/core/recovery.d.ts.map +1 -1
  30. package/dist/core/recovery.js +12 -0
  31. package/dist/core/recovery.js.map +1 -1
  32. package/dist/core/summarize.d.ts +9 -3
  33. package/dist/core/summarize.d.ts.map +1 -1
  34. package/dist/core/summarize.js +97 -42
  35. package/dist/core/summarize.js.map +1 -1
  36. package/dist/guardrail/permission-service.d.ts.map +1 -1
  37. package/dist/guardrail/permission-service.js +11 -2
  38. package/dist/guardrail/permission-service.js.map +1 -1
  39. package/dist/sessions/directivesStore.d.ts +9 -0
  40. package/dist/sessions/directivesStore.d.ts.map +1 -0
  41. package/dist/sessions/directivesStore.js +54 -0
  42. package/dist/sessions/directivesStore.js.map +1 -0
  43. package/dist/sessions/fileSessionStore.d.ts +2 -2
  44. package/dist/sessions/fileSessionStore.d.ts.map +1 -1
  45. package/dist/sessions/fileSessionStore.js +19 -8
  46. package/dist/sessions/fileSessionStore.js.map +1 -1
  47. package/dist/sessions/foldStorage.d.ts +15 -0
  48. package/dist/sessions/foldStorage.d.ts.map +1 -0
  49. package/dist/sessions/foldStorage.js +121 -0
  50. package/dist/sessions/foldStorage.js.map +1 -0
  51. package/dist/sessions/jsonl.d.ts +6 -0
  52. package/dist/sessions/jsonl.d.ts.map +1 -1
  53. package/dist/sessions/jsonl.js +15 -1
  54. package/dist/sessions/jsonl.js.map +1 -1
  55. package/dist/sidecar/server.d.ts.map +1 -1
  56. package/dist/sidecar/server.js +11 -1
  57. package/dist/sidecar/server.js.map +1 -1
  58. package/dist/tools/foldTools.d.ts +5 -0
  59. package/dist/tools/foldTools.d.ts.map +1 -0
  60. package/dist/tools/foldTools.js +123 -0
  61. package/dist/tools/foldTools.js.map +1 -0
  62. package/dist/tools/skillTool.d.ts.map +1 -1
  63. package/dist/tools/skillTool.js +7 -2
  64. package/dist/tools/skillTool.js.map +1 -1
  65. package/package.json +2 -2
@@ -0,0 +1,123 @@
1
+ import { turnsFromSessionMessages } from '../conversation.js';
2
+ import { normalizeDirective } from '../core/foldBlocks.js';
3
+ const EXCERPT_CHARS = 1500;
4
+ const DEFAULT_LIMIT = 5;
5
+ const MAX_LIMIT = 20;
6
+ /** Splits CHECKPOINT.md before each entry heading exactly as checkpointStore.ts
7
+ * writes it (`## ` + an ISO timestamp), so a summary carrying its own
8
+ * `## Heading` stays inside its entry. */
9
+ const CHECKPOINT_ENTRY = /\n(?=## \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z\s*$)/m;
10
+ /** A window of at most EXCERPT_CHARS around the match: every term inside it when
11
+ * they fit together, otherwise centred on the first term found. Cut ends are
12
+ * marked with an ellipsis. */
13
+ function excerpt(text, terms) {
14
+ const flat = text.replace(/\s+/g, ' ');
15
+ if (flat.length <= EXCERPT_CHARS)
16
+ return flat;
17
+ const lower = flat.toLowerCase();
18
+ const spans = terms.map((t) => ({ at: lower.indexOf(t), len: t.length })).filter((s) => s.at >= 0);
19
+ const first = spans.length ? Math.min(...spans.map((s) => s.at)) : 0;
20
+ const last = spans.length ? Math.max(...spans.map((s) => s.at + s.len)) : 0;
21
+ const span = last - first;
22
+ const lead = span <= EXCERPT_CHARS ? Math.floor((EXCERPT_CHARS - span) / 2) : Math.floor(EXCERPT_CHARS / 2);
23
+ const start = Math.max(0, Math.min(first - lead, flat.length - EXCERPT_CHARS));
24
+ const end = start + EXCERPT_CHARS;
25
+ return `${start > 0 ? '\u2026' : ''}${flat.slice(start, end)}${end < flat.length ? '\u2026' : ''}`;
26
+ }
27
+ function textOf(m) {
28
+ const c = m.content;
29
+ if (typeof c === 'string')
30
+ return c;
31
+ if (Array.isArray(c))
32
+ return c.map((p) => (p && typeof p === 'object' && typeof p.text === 'string' ? p.text : '')).join(' ');
33
+ return '';
34
+ }
35
+ export function makeRecallHistoryTool(reader) {
36
+ return {
37
+ name: 'recall_history',
38
+ roomSafe: true,
39
+ noOffload: true,
40
+ permission: 'allow',
41
+ description: 'Search THIS chat\'s full history, including parts folded out of your context, and its saved summaries. ' +
42
+ 'Every word in the query must appear. Use it when the conversation was folded and you need an exact earlier detail.',
43
+ parameters: {
44
+ type: 'object',
45
+ properties: {
46
+ query: { type: 'string', description: 'Words that must all appear (case-insensitive).' },
47
+ limit: { type: 'number', description: 'Max excerpts, default 5, max 20.' },
48
+ },
49
+ required: ['query'],
50
+ },
51
+ async run(args) {
52
+ const query = String(args.query ?? '').trim();
53
+ const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
54
+ const limit = Math.min(MAX_LIMIT, Math.max(1, Number(args.limit) || DEFAULT_LIMIT));
55
+ let raw;
56
+ let checkpoints;
57
+ try {
58
+ [raw, checkpoints] = await Promise.all([reader.messages(), reader.checkpoints()]);
59
+ }
60
+ catch (e) {
61
+ return `Error: could not read this chat's history: ${e instanceof Error ? e.message : String(e)}`;
62
+ }
63
+ const hits = [];
64
+ const turns = turnsFromSessionMessages(raw);
65
+ turns.forEach((t, ti) => {
66
+ for (const m of t.messages) {
67
+ const text = textOf(m);
68
+ if (text)
69
+ hits.push({ label: `turn ${ti + 1}, ${m.role ?? 'message'}`, text });
70
+ }
71
+ });
72
+ if (checkpoints) {
73
+ for (const section of checkpoints.split(CHECKPOINT_ENTRY)) {
74
+ const head = /^## (\S+)\s*$/.exec(section.split('\n', 1)[0]);
75
+ if (head)
76
+ hits.push({ label: `summary ${head[1]}`, text: section.slice(section.indexOf('\n') + 1).trim() });
77
+ }
78
+ }
79
+ const matches = hits.filter((h) => { const l = h.text.toLowerCase(); return terms.every((t) => l.includes(t)); }).reverse().slice(0, limit);
80
+ if (!matches.length)
81
+ return `No matches in this chat for "${query}".`;
82
+ return matches.map((h) => `[${h.label}] ${excerpt(h.text, terms)}`).join('\n');
83
+ },
84
+ };
85
+ }
86
+ export function makeUpdateDirectivesTool(file) {
87
+ return {
88
+ name: 'update_directives',
89
+ noOffload: true,
90
+ /* DECLARED mutating: it writes DIRECTIVES.md. 'allow' is only its default
91
+ * under a permissive policy; a strict one (READ_ONLY_POLICY's
92
+ * mutatingDefault) outranks it. Deliberately not roomSafe, which would let
93
+ * it past that floor. */
94
+ mutates: true,
95
+ permission: 'allow',
96
+ description: 'Add or remove standing instructions/decisions the user gave, kept across folds in DIRECTIVES.md. ' +
97
+ 'Only record what the USER decided; never invent one.',
98
+ parameters: {
99
+ type: 'object',
100
+ properties: {
101
+ add: { type: 'array', items: { type: 'string' }, description: 'Directives to add, one sentence each.' },
102
+ remove: { type: 'array', items: { type: 'string' }, description: 'Directives to remove (matched ignoring case/spacing).' },
103
+ },
104
+ },
105
+ async run(args) {
106
+ const add = Array.isArray(args.add) ? args.add.filter((x) => typeof x === 'string' && !!x.trim()) : [];
107
+ const remove = new Set((Array.isArray(args.remove) ? args.remove : []).filter((x) => typeof x === 'string').map(normalizeDirective));
108
+ const current = (await file.read()) ?? [];
109
+ const seen = new Set();
110
+ const next = [];
111
+ for (const d of [...current, ...add]) {
112
+ const k = normalizeDirective(d);
113
+ if (remove.has(k) || seen.has(k))
114
+ continue;
115
+ seen.add(k);
116
+ next.push(d.trim());
117
+ }
118
+ await file.write(next);
119
+ return `DIRECTIVES.md now has ${next.length} directive(s). Your in-context list updates at the next fold.`;
120
+ },
121
+ };
122
+ }
123
+ //# sourceMappingURL=foldTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foldTools.js","sourceRoot":"","sources":["../../tools/foldTools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB;;0CAE0C;AAC1C,MAAM,gBAAgB,GAAG,8DAA8D,CAAC;AAExF;;8BAE8B;AAC9B,SAAS,OAAO,CAAC,IAAY,EAAE,KAAe;IAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvC,IAAI,IAAI,CAAC,MAAM,IAAI,aAAa;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,G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AAC,CAAC;oBAAE,SAAS;gBAC3C,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACZ,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACtB,CAAC;YACD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACvB,OAAO,yBAAyB,IAAI,CAAC,MAAM,+DAA+D,CAAC;QAC7G,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"skillTool.d.ts","sourceRoot":"","sources":["../../tools/skillTool.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,cAAc,cAAc,CAAC;AAE1C,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAUvD;AAED,yCAAyC;AACzC,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,CAqB/D"}
1
+ {"version":3,"file":"skillTool.d.ts","sourceRoot":"","sources":["../../tools/skillTool.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,cAAc,cAAc,CAAC;AAE1C,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAevD;AAED,yCAAyC;AACzC,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,CAqB/D"}
@@ -5,8 +5,13 @@ export function skillIndex(skills) {
5
5
  return '';
6
6
  return [
7
7
  '## Skills',
8
- 'Procedures the user installed for particular kinds of work. Before starting a task, check whether one of these covers it; judge that on what the task IS, not on whether the user named the skill. '
9
- + `When one covers the task, call \`${USE_SKILL_NAME}\` with its name to load its instructions, then follow them in place of how you would otherwise go about it, and say which you are following. `
8
+ // Loading a skill is the exception. "Before starting a task, check whether
9
+ // one covers it" was read as a step before every reply: a model loaded a
10
+ // skill to answer "How are you doing today?".
11
+ 'Procedures the user installed for particular kinds of work. Most messages need no skill. '
12
+ + 'Load one only when the request is a piece of work one of these clearly covers; judge that on what the work IS, not on whether the user named the skill. '
13
+ + 'Never for conversation, greetings, questions about you, or quick answers. '
14
+ + `When one covers the work, call \`${USE_SKILL_NAME}\` with its name to load its instructions, then follow them in place of how you would otherwise go about it, and say which you are following. `
10
15
  + 'When none does, proceed normally and say nothing about them.',
11
16
  '',
12
17
  ...skills.map((s) => (s.description ? `- ${s.name}: ${s.description}` : `- ${s.name}`)),
@@ -1 +1 @@
1
- {"version":3,"file":"skillTool.js","sourceRoot":"","sources":["../../tools/skillTool.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAW1C,qFAAqF;AACrF,MAAM,UAAU,UAAU,CAAC,MAAoB;IAC7C,IAAI,CAAC,MAAM,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO;QACL,WAAW;QACX,qMAAqM;cACjM,oCAAoC,cAAc,gJAAgJ;cAClM,8DAA8D;QAClE,EAAE;QACF,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC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;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;QACD,KAAK,CAAC,GAAG,CAAC,IAAI;YACZ,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,CAAC,KAAK;gBAAE,OAAO,mBAAmB,IAAI,iBAAiB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YACnG,OAAO,YAAY,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corenel/harness",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "description": "Corenel — host-agnostic agent harness (kernel). The app resolves it via the `corenel` path alias (bypasses these exports entirely); vitest aliases it to source too. Everything else — node consumers like @corenel/cli, @corenel/term, @corenel/sidecar — resolves it through this workspace package via the exports map below, which points at dist/ unconditionally (not just at publish) so in-repo and published resolution are identical: a bundle that treats @corenel/harness as external (see packages/term/build.mjs) must see the SAME module instance node sees when it later resolves this package at runtime, and plain node cannot execute the raw .ts sources at all. Run `pnpm build` here (or let a dependent's prebuild do it) before relying on this package outside the app/vitest. NOTE: @xyflow/react and dagre are NOT dependencies here at all — this package has no .tsx files and imports neither. `react` IS a real (small) runtime dependency: `todos.ts` uses `useSyncExternalStore`. It is declared below as an OPTIONAL peer, not a hard dependency, so node-only consumers (cli/term/sidecar) aren't forced to install react; node consumers hoist it today only because something else in the tree happens to pull it in. Do not add @xyflow/react or dagre as dependencies/peers without testing a packed install end to end — an earlier attempt at that (before this package had any .tsx files) failed npm's peer resolution with ERESOLVE.",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "openai": "^4.77.0",
35
35
  "yaml": "^2.8.3",
36
- "@corenel/protocol": "0.12.0"
36
+ "@corenel/protocol": "0.13.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "react": "^18.0.0 || ^19.0.0"