@zuzuucodes/cli 1.4.0 → 1.6.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.
- package/bin/zuzuu.mjs +20 -4
- package/package.json +1 -1
- package/web-app/dist/auth.js +91 -0
- package/web-app/dist/server.js +16 -79
- package/web-app/dist/zuzuu-cli.js +124 -0
- package/web-app/dist/{zuzuu-api.js → zuzuu-routes.js} +158 -133
- package/web-app/web-dist/assets/CommandPalette-DhBdR7X3.js +45 -0
- package/web-app/web-dist/assets/DiffTab-CqxwSjI2.js +1 -0
- package/web-app/web-dist/assets/EditorPane-94QPFR9R.js +41 -0
- package/web-app/web-dist/assets/MonacoFile-D76epTrG.js +1 -0
- package/web-app/web-dist/assets/angular-html-BVBpGdXr.js +1 -0
- package/web-app/web-dist/assets/{angular-ts-CD_OonCa.js → angular-ts-BfdufMKP.js} +1 -1
- package/web-app/web-dist/assets/{apl-uOGC3x4e.js → apl-DWBSSoBH.js} +1 -1
- package/web-app/web-dist/assets/{astro-B6ybQmWG.js → astro-3LtMP0Sq.js} +1 -1
- package/web-app/web-dist/assets/{blade-B1QGRlVx.js → blade-llJRbbtR.js} +1 -1
- package/web-app/web-dist/assets/c-Wt1voDr2.js +1 -0
- package/web-app/web-dist/assets/{cobol-BgqgtYWn.js → cobol-x_HIyl2P.js} +1 -1
- package/web-app/web-dist/assets/{coffee-0wIRKYlr.js → coffee-CThvmt4R.js} +1 -1
- package/web-app/web-dist/assets/cpp-NtAeskI3.js +1 -0
- package/web-app/web-dist/assets/{crystal-CyTK3qFN.js → crystal-DNu_sX0G.js} +1 -1
- package/web-app/web-dist/assets/css-DJp_X0uY.js +1 -0
- package/web-app/web-dist/assets/{cssMode-B9jnrWOz.js → cssMode-ByQBaInt.js} +1 -1
- package/web-app/web-dist/assets/dist-DQqjtuhV.js +153 -0
- package/web-app/web-dist/assets/{edge-CvML9pwC.js → edge-ozw5tpLl.js} +1 -1
- package/web-app/web-dist/assets/{editor.api2-BmGoRSl4.js → editor.api2-C7skgoRB.js} +1 -1
- package/web-app/web-dist/assets/{elixir-CrjqTiSc.js → elixir-VhA6FeZt.js} +1 -1
- package/web-app/web-dist/assets/{elm-C4JtJ0Au.js → elm-dREJmIFz.js} +1 -1
- package/web-app/web-dist/assets/{erb-Cmeb-29V.js → erb-CIg6G69l.js} +1 -1
- package/web-app/web-dist/assets/{freemarker2-B5LAi19B.js → freemarker2-CBBwP9JV.js} +1 -1
- package/web-app/web-dist/assets/{git-rebase-CXqdToiP.js → git-rebase-B44mJPta.js} +1 -1
- package/web-app/web-dist/assets/{glimmer-js-Kq-kdTyV.js → glimmer-js-vH_gHG0-.js} +1 -1
- package/web-app/web-dist/assets/{glimmer-ts-D0RKLJNf.js → glimmer-ts--abOzSAQ.js} +1 -1
- package/web-app/web-dist/assets/glsl-Dv5r7kPw.js +1 -0
- package/web-app/web-dist/assets/graphql-CB4jsw2E.js +1 -0
- package/web-app/web-dist/assets/{hack-trjVF3Po.js → hack-DvEYX148.js} +1 -1
- package/web-app/web-dist/assets/haml-zE6W3STP.js +1 -0
- package/web-app/web-dist/assets/{handlebars-B8_x7Zx7.js → handlebars-CzBR2SDs.js} +1 -1
- package/web-app/web-dist/assets/{handlebars-g7ZhGhI_.js → handlebars-tXdfxEd6.js} +1 -1
- package/web-app/web-dist/assets/html-C8UlPnhE.js +1 -0
- package/web-app/web-dist/assets/{html-CfvRMgoC.js → html-DgPn1QYH.js} +1 -1
- package/web-app/web-dist/assets/{html-derivative-BYX_F_XH.js → html-derivative-CY6NRz-J.js} +1 -1
- package/web-app/web-dist/assets/{htmlMode-Bi8vSvwb.js → htmlMode-BtdIDgA2.js} +1 -1
- package/web-app/web-dist/assets/{http-BIVDpHT-.js → http-Cyd7bS_S.js} +1 -1
- package/web-app/web-dist/assets/{hurl-CFsshMju.js → hurl-CWPsiEpf.js} +1 -1
- package/web-app/web-dist/assets/index-B27_WOhS.css +2 -0
- package/web-app/web-dist/assets/index-De6DWTZM.js +7 -0
- package/web-app/web-dist/assets/java-CGc3VwQr.js +1 -0
- package/web-app/web-dist/assets/{javascript-Bxx2wV4w.js → javascript-5m05n-Be.js} +1 -1
- package/web-app/web-dist/assets/javascript-CUt1pgmJ.js +1 -0
- package/web-app/web-dist/assets/{jinja-_ZS5zWwe.js → jinja-CD-Z-FLd.js} +1 -1
- package/web-app/web-dist/assets/{jison-D8mMEpcs.js → jison-imPNup1l.js} +1 -1
- package/web-app/web-dist/assets/json-Bg9ijW3F.js +1 -0
- package/web-app/web-dist/assets/{jsonMode-C6ELX5GM.js → jsonMode-BG32YnTY.js} +1 -1
- package/web-app/web-dist/assets/jsx-CY6oMTks.js +1 -0
- package/web-app/web-dist/assets/{julia-D4h2DZrs.js → julia-Dc3O-irA.js} +1 -1
- package/web-app/web-dist/assets/{just-bMqQi3xg.js → just-BhOq_Kbv.js} +1 -1
- package/web-app/web-dist/assets/{latex-DThYi3CX.js → latex-Cu4Y1d5w.js} +1 -1
- package/web-app/web-dist/assets/lib-KIOQTlcs.js +1 -0
- package/web-app/web-dist/assets/{liquid-CUjzzP4r.js → liquid-3ZnQzTbs.js} +1 -1
- package/web-app/web-dist/assets/{liquid-CesB-zzl.js → liquid-CvXMrjlQ.js} +1 -1
- package/web-app/web-dist/assets/{lspLanguageFeatures-gTnJsses.js → lspLanguageFeatures-6KXALSrl.js} +1 -1
- package/web-app/web-dist/assets/lua-BjLEUjKY.js +1 -0
- package/web-app/web-dist/assets/{marko-yoGoLK2m.js → marko-DvhNOisQ.js} +1 -1
- package/web-app/web-dist/assets/{mdc-BvtXU6eH.js → mdc-Bm9TpL1X.js} +1 -1
- package/web-app/web-dist/assets/{mdx-DrXGQbNB.js → mdx-DffTEkNE.js} +1 -1
- package/web-app/web-dist/assets/{monaco-setup-CsR6EfHe.js → monaco-setup-DM3A5_VI.js} +3 -3
- package/web-app/web-dist/assets/{nginx-DoUz032F.js → nginx-Bhc82uuv.js} +1 -1
- package/web-app/web-dist/assets/{nim-B0Pl8B4R.js → nim-DXTVBFnF.js} +1 -1
- package/web-app/web-dist/assets/{perl-D2tfAALb.js → perl-C7veXV9z.js} +1 -1
- package/web-app/web-dist/assets/{php-BImCcX5X.js → php-BRiuMnnr.js} +1 -1
- package/web-app/web-dist/assets/{pug-BcnpC8P_.js → pug-C5hz5LQ7.js} +1 -1
- package/web-app/web-dist/assets/{python-ypRCBnvu.js → python-DyLAD3Wt.js} +1 -1
- package/web-app/web-dist/assets/{qml-DFDAunHY.js → qml-BdUV3aTS.js} +1 -1
- package/web-app/web-dist/assets/r-8R7vtdQc.js +1 -0
- package/web-app/web-dist/assets/{razor-aqrhpwqZ.js → razor-C49xQTPQ.js} +1 -1
- package/web-app/web-dist/assets/{razor-1_376SZM.js → razor-DRL52XO2.js} +1 -1
- package/web-app/web-dist/assets/react-vendor-CCIEwYL0.js +9 -0
- package/web-app/web-dist/assets/regexp-Omp9DhTb.js +1 -0
- package/web-app/web-dist/assets/{rst-2vG6f11Y.js → rst-BHX71KW9.js} +1 -1
- package/web-app/web-dist/assets/{ruby-Dj6bCFXR.js → ruby-B--HzjGU.js} +1 -1
- package/web-app/web-dist/assets/{sas-BhVZ4qL2.js → sas-DrLaYOK_.js} +1 -1
- package/web-app/web-dist/assets/scss-DdSxiZKl.js +1 -0
- package/web-app/web-dist/assets/shellscript-DwcUjJBL.js +1 -0
- package/web-app/web-dist/assets/{shellsession-CyO2fnhB.js → shellsession-CPZkydE6.js} +1 -1
- package/web-app/web-dist/assets/{soy-DIkw6E88.js → soy-Br5FhD7c.js} +1 -1
- package/web-app/web-dist/assets/sql-DNssxck8.js +1 -0
- package/web-app/web-dist/assets/{stata-DvkM932O.js → stata-DXn1tqOr.js} +1 -1
- package/web-app/web-dist/assets/{surrealql-B4-Q8tqV.js → surrealql-IeLNQw0f.js} +1 -1
- package/web-app/web-dist/assets/{svelte-p6yBy-Ki.js → svelte-DOdLCIlh.js} +1 -1
- package/web-app/web-dist/assets/{templ-C7EkuiZr.js → templ-CIwIngms.js} +1 -1
- package/web-app/web-dist/assets/{tex-DkmD8uFC.js → tex-D8QMumu5.js} +1 -1
- package/web-app/web-dist/assets/{ts-tags-U-hncHg4.js → ts-tags-BMVY4q-l.js} +1 -1
- package/web-app/web-dist/assets/{tsMode-a8OvovQd.js → tsMode-BndVBac5.js} +1 -1
- package/web-app/web-dist/assets/tsx-5Eka4NBX.js +1 -0
- package/web-app/web-dist/assets/{twig-CU0OP-IA.js → twig-C8o_5mgw.js} +1 -1
- package/web-app/web-dist/assets/{typescript-DnLjiKtn.js → typescript-B1w9vqKF.js} +1 -1
- package/web-app/web-dist/assets/typescript-DOu2WMV5.js +1 -0
- package/web-app/web-dist/assets/{vue-Db7nY3ba.js → vue-BU18DNDL.js} +1 -1
- package/web-app/web-dist/assets/{vue-html-BvAbiAw1.js → vue-html-BeluIYX0.js} +1 -1
- package/web-app/web-dist/assets/{vue-vine-BEaIQIlA.js → vue-vine-DGUAbOCX.js} +1 -1
- package/web-app/web-dist/assets/{xml-an4Nuuqq.js → xml-D8uAlVv5.js} +1 -1
- package/web-app/web-dist/assets/xml-DIqSwXR3.js +1 -0
- package/web-app/web-dist/assets/{xsl-D3NQgH22.js → xsl-Ct_-YIAy.js} +1 -1
- package/web-app/web-dist/assets/xterm-B1ffpRuj.js +36 -0
- package/web-app/web-dist/assets/xterm-addons-psDEiUMC.js +136 -0
- package/web-app/web-dist/assets/{yaml-Diiu6O9P.js → yaml-Bb7jXyQv.js} +1 -1
- package/web-app/web-dist/assets/yaml-DTtCYNlS.js +1 -0
- package/web-app/web-dist/index.html +6 -3
- package/zuzuu/actions/convert.mjs +10 -9
- package/zuzuu/actions/dispatch.mjs +12 -7
- package/zuzuu/actions/inbox.mjs +5 -5
- package/zuzuu/actions/manifest.mjs +48 -30
- package/zuzuu/actions/schema.mjs +9 -3
- package/zuzuu/actions/trail.mjs +1 -1
- package/zuzuu/commands/act-author.mjs +23 -13
- package/zuzuu/commands/act.mjs +4 -6
- package/zuzuu/commands/capture.mjs +2 -2
- package/zuzuu/commands/code.mjs +2 -2
- package/zuzuu/commands/digest.mjs +2 -2
- package/zuzuu/commands/distill.mjs +15 -16
- package/zuzuu/commands/doctor.mjs +41 -19
- package/zuzuu/commands/enable.mjs +1 -1
- package/zuzuu/commands/eval.mjs +3 -36
- package/zuzuu/commands/explain.mjs +4 -4
- package/zuzuu/commands/faculty.mjs +158 -0
- package/zuzuu/commands/generation.mjs +5 -8
- package/zuzuu/commands/hook.mjs +14 -12
- package/zuzuu/commands/inbox.mjs +1 -6
- package/zuzuu/commands/init.mjs +18 -4
- package/zuzuu/commands/knowledge.mjs +1 -1
- package/zuzuu/commands/migrations/home.mjs +96 -0
- package/zuzuu/commands/migrations/index.mjs +48 -0
- package/zuzuu/commands/migrations/items.mjs +360 -0
- package/zuzuu/commands/migrations/proposals.mjs +100 -0
- package/zuzuu/commands/proposals.mjs +131 -0
- package/zuzuu/commands/review.mjs +13 -227
- package/zuzuu/commands/session.mjs +8 -2
- package/zuzuu/commands/sessions.mjs +159 -0
- package/zuzuu/commands/status.mjs +3 -3
- package/zuzuu/commands/trace.mjs +1 -1
- package/zuzuu/{capture-core.mjs → core/capture-core.mjs} +3 -3
- package/zuzuu/{store.mjs → core/store.mjs} +1 -1
- package/zuzuu/digest/compose.mjs +96 -0
- package/zuzuu/eval/score.mjs +14 -1
- package/zuzuu/faculties/actions/index.mjs +283 -0
- package/zuzuu/faculties/guardrails/index.mjs +320 -0
- package/zuzuu/faculties/instructions/index.mjs +288 -0
- package/zuzuu/faculties/knowledge/index.mjs +185 -0
- package/zuzuu/faculties/memory/index.mjs +124 -0
- package/zuzuu/faculty/envelope.mjs +290 -0
- package/zuzuu/faculty/generation/read.mjs +206 -0
- package/zuzuu/faculty/generation/write.mjs +207 -0
- package/zuzuu/faculty/items.mjs +81 -0
- package/zuzuu/faculty/module.mjs +74 -0
- package/zuzuu/faculty/pending.mjs +63 -0
- package/zuzuu/faculty/registry.mjs +204 -18
- package/zuzuu/faculty/render.mjs +59 -0
- package/zuzuu/faculty/trail.mjs +1 -1
- package/zuzuu/guardrails/engine.mjs +137 -0
- package/zuzuu/{scaffold.mjs → home/scaffold.mjs} +110 -39
- package/zuzuu/knowledge/items.mjs +56 -91
- package/zuzuu/live/install.mjs +1 -1
- package/zuzuu/live/live-store.mjs +2 -2
- package/zuzuu/live/reconcile.mjs +2 -2
- package/zuzuu/sessions/git.mjs +47 -0
- package/zuzuu/{session-git.mjs → sessions/session-git.mjs} +5 -43
- package/web-app/web-dist/assets/DiffTab-BuWonUNJ.js +0 -1
- package/web-app/web-dist/assets/MonacoFile-CL3DhFKG.js +0 -1
- package/web-app/web-dist/assets/angular-html-CmT26mqM.js +0 -1
- package/web-app/web-dist/assets/c-BvoqrSVH.js +0 -1
- package/web-app/web-dist/assets/cpp-BXsk94m0.js +0 -1
- package/web-app/web-dist/assets/css-Z8oOGxII.js +0 -1
- package/web-app/web-dist/assets/dist-ChcDQ_7s.js +0 -153
- package/web-app/web-dist/assets/glsl-KwyfU2aa.js +0 -1
- package/web-app/web-dist/assets/graphql-DSeOUAa2.js +0 -1
- package/web-app/web-dist/assets/haml-azVoxQRV.js +0 -1
- package/web-app/web-dist/assets/html-D_7P5S4m.js +0 -1
- package/web-app/web-dist/assets/index--5yy8RbA.js +0 -267
- package/web-app/web-dist/assets/index-BVG4hgk7.css +0 -2
- package/web-app/web-dist/assets/java-D4RbCvBe.js +0 -1
- package/web-app/web-dist/assets/javascript-Cb010CKM.js +0 -1
- package/web-app/web-dist/assets/json-DWgqV4D1.js +0 -1
- package/web-app/web-dist/assets/jsx-CZjSJa1f.js +0 -1
- package/web-app/web-dist/assets/lua-TGj_6NzO.js +0 -1
- package/web-app/web-dist/assets/r-fCpuAR7u.js +0 -1
- package/web-app/web-dist/assets/regexp-B4yxx-Ty.js +0 -1
- package/web-app/web-dist/assets/scss-QdjMO_xV.js +0 -1
- package/web-app/web-dist/assets/shellscript-BnlgeVVx.js +0 -1
- package/web-app/web-dist/assets/sql-DGnQv6iD.js +0 -1
- package/web-app/web-dist/assets/tsx-MJ0-9sYG.js +0 -1
- package/web-app/web-dist/assets/typescript-C17ZkDe8.js +0 -1
- package/web-app/web-dist/assets/xml-CA9lHFQV.js +0 -1
- package/web-app/web-dist/assets/yaml-CwRYMJka.js +0 -1
- package/zuzuu/actions/adapter.mjs +0 -130
- package/zuzuu/commands/migrate.mjs +0 -225
- package/zuzuu/digest.mjs +0 -149
- package/zuzuu/faculty/generation.mjs +0 -392
- package/zuzuu/guardrails/adapter.mjs +0 -134
- package/zuzuu/guardrails.mjs +0 -89
- package/zuzuu/instructions/adapter.mjs +0 -93
- package/zuzuu/knowledge/adapter.mjs +0 -99
- package/zuzuu/memory/adapter.mjs +0 -121
- package/zuzuu/miners/actions.mjs +0 -118
- package/zuzuu/miners/guardrails.mjs +0 -179
- package/zuzuu/miners/instructions.mjs +0 -157
- package/zuzuu/miners/knowledge.mjs +0 -25
- package/zuzuu/miners/memory.mjs +0 -27
- package/zuzuu/miners/registry.mjs +0 -31
- /package/web-app/web-dist/assets/{chunk-QTnfLwEv.js → rolldown-runtime-QTnfLwEv.js} +0 -0
- /package/zuzuu/{session.mjs → core/session.mjs} +0 -0
- /package/zuzuu/{inject.mjs → home/inject.mjs} +0 -0
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
// zuzuu/miners/instructions.mjs
|
|
2
|
-
// Instructions miner (WS5-T4) — detect recurring corrective user turns across
|
|
3
|
-
// sessions and propose steering-amendment blocks for the Instructions faculty.
|
|
4
|
-
//
|
|
5
|
-
// Corrective turns are captured by mineTranscript as:
|
|
6
|
-
// correctionTurns: [{ text }] — user turns following an assistant tool action
|
|
7
|
-
// that contain corrective lexicon (e.g. "always", "never", "don't", etc.)
|
|
8
|
-
//
|
|
9
|
-
// Shape: { faculty:'instructions', aggregate(sessions, opts), propose(agentDir, aggregated) }
|
|
10
|
-
// Self-registers on import.
|
|
11
|
-
|
|
12
|
-
import { join } from 'node:path';
|
|
13
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
14
|
-
import { makeProposal, writeProposal, listProposals, isArchivedResolved } from '../faculty/proposal.mjs';
|
|
15
|
-
import { register } from './registry.mjs';
|
|
16
|
-
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
// helpers
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Normalise a correction text for grouping:
|
|
22
|
-
* lowercase, collapse whitespace, truncate to 200 chars.
|
|
23
|
-
*
|
|
24
|
-
* v1 grouping: near-identical normalised text (exact key match). Simple and
|
|
25
|
-
* deterministic; a fuzzy grouper can be earned later.
|
|
26
|
-
*
|
|
27
|
-
* @param {string} text
|
|
28
|
-
* @returns {string}
|
|
29
|
-
*/
|
|
30
|
-
function normText(text) {
|
|
31
|
-
return String(text).toLowerCase().replace(/\s+/g, ' ').trim().slice(0, 200);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Derive a proposal id fragment from a normalised text key.
|
|
36
|
-
* Keep it stable, short, and filesystem-safe.
|
|
37
|
-
*/
|
|
38
|
-
function instrId(normKey) {
|
|
39
|
-
// Use a slugified version of the first 60 chars of the normalised text,
|
|
40
|
-
// prefixed to make collisions with other faculties impossible.
|
|
41
|
-
const slug = normKey.slice(0, 60).replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '').slice(0, 50) || 'instr';
|
|
42
|
-
return 'instr-' + slug;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
// aggregate
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Group correctionTurns from mined sessions; propose when a similar correction
|
|
50
|
-
* recurs across ≥minSessions (default 2) distinct sessions.
|
|
51
|
-
*
|
|
52
|
-
* @param {Array<{sessionId:string, correctionTurns:{text:string}[]}>} sessions
|
|
53
|
-
* @param {object} opts
|
|
54
|
-
* @param {number} [opts.minSessions=2] min distinct sessions with the same normalised correction
|
|
55
|
-
* @returns {Array<{payload:{text:string}, evidence:{occurrences:number, sessions:number}}>}
|
|
56
|
-
*/
|
|
57
|
-
export function aggregate(sessions, { minSessions = 2 } = {}) {
|
|
58
|
-
// normalised text → { count, sessions: Set<sessionId>, rawText: string }
|
|
59
|
-
const stats = new Map();
|
|
60
|
-
|
|
61
|
-
for (const s of sessions) {
|
|
62
|
-
if (!Array.isArray(s.correctionTurns)) continue;
|
|
63
|
-
// Track distinct normalised texts per session to avoid double-counting
|
|
64
|
-
// the same session for the same correction text.
|
|
65
|
-
const seenInSession = new Set();
|
|
66
|
-
for (const { text } of s.correctionTurns) {
|
|
67
|
-
const key = normText(text);
|
|
68
|
-
if (!key) continue;
|
|
69
|
-
const st = stats.get(key) ?? { count: 0, sessions: new Set(), rawText: text };
|
|
70
|
-
st.count++;
|
|
71
|
-
st.sessions.add(s.sessionId);
|
|
72
|
-
seenInSession.add(key);
|
|
73
|
-
stats.set(key, st);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const candidates = [];
|
|
78
|
-
for (const [, st] of stats) {
|
|
79
|
-
if (st.sessions.size < minSessions) continue;
|
|
80
|
-
|
|
81
|
-
// Phrase the raw correction as an instruction for the steering amendment.
|
|
82
|
-
// The corrective turn text already reads like user guidance; use it directly
|
|
83
|
-
// (trimmed to 500 chars to match mineTranscript's cap).
|
|
84
|
-
const amendmentText = st.rawText.slice(0, 500).trim();
|
|
85
|
-
const id = instrId(normText(amendmentText));
|
|
86
|
-
|
|
87
|
-
candidates.push({
|
|
88
|
-
payload: { id, text: amendmentText },
|
|
89
|
-
evidence: { occurrences: st.count, sessions: st.sessions.size },
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return candidates;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// ---------------------------------------------------------------------------
|
|
97
|
-
// propose
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Write an instructions proposal into .zuzuu/instructions/proposals/ for each
|
|
101
|
-
* candidate.
|
|
102
|
-
*
|
|
103
|
-
* Idempotent:
|
|
104
|
-
* - skips if an instructions proposal with the same derived id already exists
|
|
105
|
-
* - skips if the text is already present in project.md
|
|
106
|
-
* - skips if the id is already resolved in proposals/archive/ — a rejection
|
|
107
|
-
* is remembered; re-distilling never resurrects it
|
|
108
|
-
*
|
|
109
|
-
* @param {string} agentDir
|
|
110
|
-
* @param {ReturnType<typeof aggregate>} aggregated
|
|
111
|
-
* @returns {number} count of new proposals written
|
|
112
|
-
*/
|
|
113
|
-
export function propose(agentDir, aggregated) {
|
|
114
|
-
// Collect ids of existing pending proposals for this faculty.
|
|
115
|
-
const existing = listProposals(agentDir, 'instructions');
|
|
116
|
-
const existingIds = new Set(existing.map((p) => p.payload?.id).filter(Boolean));
|
|
117
|
-
|
|
118
|
-
// Read project.md to skip amendments already applied.
|
|
119
|
-
const projectMdPath = join(agentDir, 'instructions', 'project.md');
|
|
120
|
-
const projectMdContent = existsSync(projectMdPath)
|
|
121
|
-
? readFileSync(projectMdPath, 'utf8')
|
|
122
|
-
: '';
|
|
123
|
-
|
|
124
|
-
let count = 0;
|
|
125
|
-
for (const c of aggregated) {
|
|
126
|
-
const { payload, evidence } = c;
|
|
127
|
-
|
|
128
|
-
// Idempotent: skip if already proposed.
|
|
129
|
-
if (existingIds.has(payload.id)) continue;
|
|
130
|
-
|
|
131
|
-
// Idempotent: skip if text already present in project.md.
|
|
132
|
-
if (projectMdContent.includes(payload.text)) continue;
|
|
133
|
-
|
|
134
|
-
const proposal = makeProposal({
|
|
135
|
-
faculty: 'instructions',
|
|
136
|
-
kind: 'block',
|
|
137
|
-
source: 'distill',
|
|
138
|
-
payload,
|
|
139
|
-
evidence,
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// A rejection is remembered: never resurrect an archive-resolved id.
|
|
143
|
-
if (isArchivedResolved(agentDir, 'instructions', proposal.id)) continue;
|
|
144
|
-
|
|
145
|
-
writeProposal(agentDir, proposal);
|
|
146
|
-
count++;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return count;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// ---------------------------------------------------------------------------
|
|
153
|
-
// self-register
|
|
154
|
-
|
|
155
|
-
export const miner = { faculty: 'instructions', aggregate, propose };
|
|
156
|
-
|
|
157
|
-
register(miner);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Knowledge miner (WS5-T1) — the existing source-A distill path, wrapped as a
|
|
2
|
-
// registry miner. NO behavior change: `aggregate` is the same function the
|
|
3
|
-
// golden distill test asserts on; `propose` mirrors `distillSessions` (one
|
|
4
|
-
// `createProposal` per aggregated candidate). Self-registers on import.
|
|
5
|
-
|
|
6
|
-
import { aggregate } from '../knowledge/distill.mjs';
|
|
7
|
-
import { createProposal } from '../knowledge/proposals.mjs';
|
|
8
|
-
import { register } from './registry.mjs';
|
|
9
|
-
|
|
10
|
-
/** File one knowledge proposal per aggregated candidate; return the count of
|
|
11
|
-
* actually-filed proposals (archive-resolved ids are skipped, not re-filed). */
|
|
12
|
-
export function propose(agentDir, aggregated) {
|
|
13
|
-
let count = 0;
|
|
14
|
-
for (const c of aggregated) {
|
|
15
|
-
const p = createProposal(agentDir, { candidate: c.candidate, source: 'distill', evidence: c.evidence });
|
|
16
|
-
if (p && p.status !== 'archived-skip') count++;
|
|
17
|
-
}
|
|
18
|
-
return count;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const miner = { faculty: 'knowledge', aggregate, propose };
|
|
22
|
-
|
|
23
|
-
register(miner);
|
|
24
|
-
|
|
25
|
-
export { aggregate };
|
package/zuzuu/miners/memory.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// zuzuu/miners/memory.mjs
|
|
2
|
-
// Memory miner STUB (WS5-T4) — registered no-op; deferred this pass.
|
|
3
|
-
//
|
|
4
|
-
// WHAT IT WOULD MINE (when implemented):
|
|
5
|
-
// Completed-session episodes — a Run that reached `completed` status in
|
|
6
|
-
// .zuzuu/sessions.json — would be distilled into curated episode entries at
|
|
7
|
-
// .zuzuu/memory/entries/<id>.md. Each entry captures: what was attempted,
|
|
8
|
-
// key decisions made, outcome, and a set of durable learnings. The miner
|
|
9
|
-
// would emit `memory` proposals of kind 'episode' into
|
|
10
|
-
// .zuzuu/memory/proposals/ for human review via `zuzuu review`. Deferred until
|
|
11
|
-
// the Memory substrate (off-edge Postgres/Neon or local Markdown) is
|
|
12
|
-
// established and the session lifecycle state machine is stable enough to
|
|
13
|
-
// reliably produce `completed` runs with rich enough trace data to distill.
|
|
14
|
-
//
|
|
15
|
-
// Shape: { faculty:'memory', aggregate, propose, stub:true }
|
|
16
|
-
// Self-registers on import (no-op).
|
|
17
|
-
|
|
18
|
-
import { register } from './registry.mjs';
|
|
19
|
-
|
|
20
|
-
export const miner = {
|
|
21
|
-
faculty: 'memory',
|
|
22
|
-
stub: true,
|
|
23
|
-
aggregate: () => [],
|
|
24
|
-
propose: () => 0,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
register(miner);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Miner registry (WS5-T1) — the faculty-mining plugin table.
|
|
2
|
-
//
|
|
3
|
-
// Each miner is `{ faculty, aggregate(sessions, opts) -> candidates,
|
|
4
|
-
// propose(agentDir, candidates) -> count }`. The `--all-faculties` distill driver
|
|
5
|
-
// mines every transcript once into a shared `sessions` array, then runs each
|
|
6
|
-
// registered miner's aggregate + propose. Miners self-register on import.
|
|
7
|
-
|
|
8
|
-
const miners = [];
|
|
9
|
-
|
|
10
|
-
/** Register a miner. Re-registering the same faculty replaces it (idempotent import). */
|
|
11
|
-
export function register(miner) {
|
|
12
|
-
const i = miners.findIndex((m) => m.faculty === miner.faculty);
|
|
13
|
-
if (i >= 0) miners[i] = miner;
|
|
14
|
-
else miners.push(miner);
|
|
15
|
-
return miner;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** All registered miners. */
|
|
19
|
-
export function all() {
|
|
20
|
-
return miners.slice();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** The miner for a faculty, or undefined. */
|
|
24
|
-
export function get(faculty) {
|
|
25
|
-
return miners.find((m) => m.faculty === faculty);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Clear the registry — tests only. */
|
|
29
|
-
export function reset() {
|
|
30
|
-
miners.length = 0;
|
|
31
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|