@zelari/core 0.7.11 → 0.7.14

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 (138) hide show
  1. package/dist/agents/councilApi.d.ts +135 -0
  2. package/dist/agents/councilApi.d.ts.map +1 -1
  3. package/dist/agents/councilApi.js +520 -7
  4. package/dist/agents/councilApi.js.map +1 -1
  5. package/dist/agents/roles.d.ts.map +1 -1
  6. package/dist/agents/roles.js +11 -3
  7. package/dist/agents/roles.js.map +1 -1
  8. package/dist/agents/toolSchemas.d.ts.map +1 -1
  9. package/dist/agents/toolSchemas.js +32 -3
  10. package/dist/agents/toolSchemas.js.map +1 -1
  11. package/dist/core/AgentHarness.d.ts +21 -0
  12. package/dist/core/AgentHarness.d.ts.map +1 -1
  13. package/dist/core/AgentHarness.js +177 -8
  14. package/dist/core/AgentHarness.js.map +1 -1
  15. package/dist/core/tools/builtin/filesystem.d.ts.map +1 -1
  16. package/dist/core/tools/builtin/filesystem.js +4 -2
  17. package/dist/core/tools/builtin/filesystem.js.map +1 -1
  18. package/dist/council/completion/buildCompletion.d.ts +23 -0
  19. package/dist/council/completion/buildCompletion.d.ts.map +1 -0
  20. package/dist/council/completion/buildCompletion.js +75 -0
  21. package/dist/council/completion/buildCompletion.js.map +1 -0
  22. package/dist/council/completion/index.d.ts +3 -0
  23. package/dist/council/completion/index.d.ts.map +1 -0
  24. package/dist/council/completion/index.js +3 -0
  25. package/dist/council/completion/index.js.map +1 -0
  26. package/dist/council/completion/types.d.ts +38 -0
  27. package/dist/council/completion/types.d.ts.map +1 -0
  28. package/dist/council/completion/types.js +2 -0
  29. package/dist/council/completion/types.js.map +1 -0
  30. package/dist/council/index.d.ts +4 -0
  31. package/dist/council/index.d.ts.map +1 -1
  32. package/dist/council/index.js +4 -0
  33. package/dist/council/index.js.map +1 -1
  34. package/dist/council/lessons/index.d.ts +7 -0
  35. package/dist/council/lessons/index.d.ts.map +1 -0
  36. package/dist/council/lessons/index.js +7 -0
  37. package/dist/council/lessons/index.js.map +1 -0
  38. package/dist/council/lessons/io.d.ts +5 -0
  39. package/dist/council/lessons/io.d.ts.map +1 -0
  40. package/dist/council/lessons/io.js +30 -0
  41. package/dist/council/lessons/io.js.map +1 -0
  42. package/dist/council/lessons/isAnswerLeak.d.ts +7 -0
  43. package/dist/council/lessons/isAnswerLeak.d.ts.map +1 -0
  44. package/dist/council/lessons/isAnswerLeak.js +26 -0
  45. package/dist/council/lessons/isAnswerLeak.js.map +1 -0
  46. package/dist/council/lessons/recallLessons.d.ts +8 -0
  47. package/dist/council/lessons/recallLessons.d.ts.map +1 -0
  48. package/dist/council/lessons/recallLessons.js +56 -0
  49. package/dist/council/lessons/recallLessons.js.map +1 -0
  50. package/dist/council/lessons/recordFailure.d.ts +7 -0
  51. package/dist/council/lessons/recordFailure.d.ts.map +1 -0
  52. package/dist/council/lessons/recordFailure.js +86 -0
  53. package/dist/council/lessons/recordFailure.js.map +1 -0
  54. package/dist/council/lessons/signatures.d.ts +6 -0
  55. package/dist/council/lessons/signatures.d.ts.map +1 -0
  56. package/dist/council/lessons/signatures.js +31 -0
  57. package/dist/council/lessons/signatures.js.map +1 -0
  58. package/dist/council/lessons/types.d.ts +27 -0
  59. package/dist/council/lessons/types.d.ts.map +1 -0
  60. package/dist/council/lessons/types.js +2 -0
  61. package/dist/council/lessons/types.js.map +1 -0
  62. package/dist/council/modeBanners.d.ts +24 -1
  63. package/dist/council/modeBanners.d.ts.map +1 -1
  64. package/dist/council/modeBanners.js +31 -4
  65. package/dist/council/modeBanners.js.map +1 -1
  66. package/dist/council/scope/extractTaskScope.d.ts +35 -0
  67. package/dist/council/scope/extractTaskScope.d.ts.map +1 -0
  68. package/dist/council/scope/extractTaskScope.js +174 -0
  69. package/dist/council/scope/extractTaskScope.js.map +1 -0
  70. package/dist/council/scope/index.d.ts +3 -0
  71. package/dist/council/scope/index.d.ts.map +1 -0
  72. package/dist/council/scope/index.js +3 -0
  73. package/dist/council/scope/index.js.map +1 -0
  74. package/dist/council/scope/nfrSpecWarn.d.ts +6 -0
  75. package/dist/council/scope/nfrSpecWarn.d.ts.map +1 -0
  76. package/dist/council/scope/nfrSpecWarn.js +21 -0
  77. package/dist/council/scope/nfrSpecWarn.js.map +1 -0
  78. package/dist/council/verification/autofix.d.ts +12 -0
  79. package/dist/council/verification/autofix.d.ts.map +1 -0
  80. package/dist/council/verification/autofix.js +41 -0
  81. package/dist/council/verification/autofix.js.map +1 -0
  82. package/dist/council/verification/citeVerify.d.ts +13 -0
  83. package/dist/council/verification/citeVerify.d.ts.map +1 -0
  84. package/dist/council/verification/citeVerify.js +73 -0
  85. package/dist/council/verification/citeVerify.js.map +1 -0
  86. package/dist/council/verification/completion.d.ts +19 -0
  87. package/dist/council/verification/completion.d.ts.map +1 -0
  88. package/dist/council/verification/completion.js +50 -0
  89. package/dist/council/verification/completion.js.map +1 -0
  90. package/dist/council/verification/degraded.d.ts +26 -0
  91. package/dist/council/verification/degraded.d.ts.map +1 -0
  92. package/dist/council/verification/degraded.js +35 -0
  93. package/dist/council/verification/degraded.js.map +1 -0
  94. package/dist/council/verification/honesty.d.ts +6 -0
  95. package/dist/council/verification/honesty.d.ts.map +1 -0
  96. package/dist/council/verification/honesty.js +28 -0
  97. package/dist/council/verification/honesty.js.map +1 -0
  98. package/dist/council/verification/implementationDelivery.d.ts +26 -0
  99. package/dist/council/verification/implementationDelivery.d.ts.map +1 -0
  100. package/dist/council/verification/implementationDelivery.js +70 -0
  101. package/dist/council/verification/implementationDelivery.js.map +1 -0
  102. package/dist/council/verification/index.d.ts +15 -0
  103. package/dist/council/verification/index.d.ts.map +1 -0
  104. package/dist/council/verification/index.js +15 -0
  105. package/dist/council/verification/index.js.map +1 -0
  106. package/dist/council/verification/inlineJsAutofix.d.ts +8 -0
  107. package/dist/council/verification/inlineJsAutofix.d.ts.map +1 -0
  108. package/dist/council/verification/inlineJsAutofix.js +85 -0
  109. package/dist/council/verification/inlineJsAutofix.js.map +1 -0
  110. package/dist/council/verification/microGate.d.ts +18 -0
  111. package/dist/council/verification/microGate.d.ts.map +1 -0
  112. package/dist/council/verification/microGate.js +81 -0
  113. package/dist/council/verification/microGate.js.map +1 -0
  114. package/dist/council/verification/motionAutofix.d.ts +8 -0
  115. package/dist/council/verification/motionAutofix.d.ts.map +1 -0
  116. package/dist/council/verification/motionAutofix.js +160 -0
  117. package/dist/council/verification/motionAutofix.js.map +1 -0
  118. package/dist/council/verification/parseCssMotion.d.ts +22 -0
  119. package/dist/council/verification/parseCssMotion.d.ts.map +1 -0
  120. package/dist/council/verification/parseCssMotion.js +142 -0
  121. package/dist/council/verification/parseCssMotion.js.map +1 -0
  122. package/dist/council/verification/runChecks.d.ts +10 -0
  123. package/dist/council/verification/runChecks.d.ts.map +1 -0
  124. package/dist/council/verification/runChecks.js +254 -0
  125. package/dist/council/verification/runChecks.js.map +1 -0
  126. package/dist/council/verification/synthesisAudit.d.ts +14 -0
  127. package/dist/council/verification/synthesisAudit.d.ts.map +1 -0
  128. package/dist/council/verification/synthesisAudit.js +106 -0
  129. package/dist/council/verification/synthesisAudit.js.map +1 -0
  130. package/dist/council/verification/tiers.d.ts +8 -0
  131. package/dist/council/verification/tiers.d.ts.map +1 -0
  132. package/dist/council/verification/tiers.js +46 -0
  133. package/dist/council/verification/tiers.js.map +1 -0
  134. package/dist/council/verification/types.d.ts +53 -0
  135. package/dist/council/verification/types.d.ts.map +1 -0
  136. package/dist/council/verification/types.js +5 -0
  137. package/dist/council/verification/types.js.map +1 -0
  138. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import type { LessonRecord } from './types.js';
2
+ export declare const LESSONS_FILE = "lessons.jsonl";
3
+ /** Read lessons.jsonl, keeping the latest record per id. */
4
+ export declare function readLessonsDeduped(zelariRoot: string): LessonRecord[];
5
+ //# sourceMappingURL=io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../../src/council/lessons/io.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,EAAE,CAqBrE"}
@@ -0,0 +1,30 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ export const LESSONS_FILE = 'lessons.jsonl';
4
+ /** Read lessons.jsonl, keeping the latest record per id. */
5
+ export function readLessonsDeduped(zelariRoot) {
6
+ const path = join(zelariRoot, LESSONS_FILE);
7
+ try {
8
+ const raw = readFileSync(path, 'utf8');
9
+ const byId = new Map();
10
+ for (const line of raw.split(/\r?\n/)) {
11
+ if (!line.trim())
12
+ continue;
13
+ try {
14
+ const rec = JSON.parse(line);
15
+ const prev = byId.get(rec.id);
16
+ if (!prev || rec.updatedAt >= prev.updatedAt) {
17
+ byId.set(rec.id, rec);
18
+ }
19
+ }
20
+ catch {
21
+ // skip corrupt line
22
+ }
23
+ }
24
+ return [...byId.values()];
25
+ }
26
+ catch {
27
+ return [];
28
+ }
29
+ }
30
+ //# sourceMappingURL=io.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io.js","sourceRoot":"","sources":["../../../src/council/lessons/io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC;AAE5C,4DAA4D;AAC5D,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAwB,CAAC;QAC7C,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBAAE,SAAS;YAC3B,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAiB,CAAC;gBAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC9B,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBAC7C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,oBAAoB;YACtB,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface LeakCheckResult {
2
+ leak: boolean;
3
+ reason?: string;
4
+ }
5
+ /** Reject lesson text that looks like an answer leak, not methodology. */
6
+ export declare function isAnswerLeak(text: string): LeakCheckResult;
7
+ //# sourceMappingURL=isAnswerLeak.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isAnswerLeak.d.ts","sourceRoot":"","sources":["../../../src/council/lessons/isAnswerLeak.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAU1D"}
@@ -0,0 +1,26 @@
1
+ const FLAG_RE = /flag\{[^}]+\}/i;
2
+ const CHALLENGE_ANSWER_RE = /challenge[-_\s]?id\s*[:=].{0,40}answer\s*[:=]/i;
3
+ const TEST_WORKSPACE_RE = /\b(TESTMCP|T3MP3ST)\b/i;
4
+ const WIN_ABS_PATH_RE = /[A-Z]:\\[^\s'"]+/i;
5
+ const UNIX_ABS_PATH_RE = /\/(?:Users|home|tmp|var)\/[^\s'"]+/i;
6
+ const HARDCODED_BENCHMARK_RE = /\b\d{4,}\s*bytes\b/i;
7
+ /** Reject lesson text that looks like an answer leak, not methodology. */
8
+ export function isAnswerLeak(text) {
9
+ const t = text.trim();
10
+ if (!t)
11
+ return { leak: true, reason: 'empty' };
12
+ if (FLAG_RE.test(t))
13
+ return { leak: true, reason: 'flag-shaped secret' };
14
+ if (CHALLENGE_ANSWER_RE.test(t))
15
+ return { leak: true, reason: 'challenge-id + answer pair' };
16
+ if (TEST_WORKSPACE_RE.test(t))
17
+ return { leak: true, reason: 'test workspace name' };
18
+ if (WIN_ABS_PATH_RE.test(t))
19
+ return { leak: true, reason: 'absolute windows path' };
20
+ if (UNIX_ABS_PATH_RE.test(t))
21
+ return { leak: true, reason: 'absolute unix path' };
22
+ if (HARDCODED_BENCHMARK_RE.test(t))
23
+ return { leak: true, reason: 'hardcoded byte benchmark' };
24
+ return { leak: false };
25
+ }
26
+ //# sourceMappingURL=isAnswerLeak.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isAnswerLeak.js","sourceRoot":"","sources":["../../../src/council/lessons/isAnswerLeak.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACjC,MAAM,mBAAmB,GAAG,gDAAgD,CAAC;AAC7E,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AACnD,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,gBAAgB,GAAG,qCAAqC,CAAC;AAC/D,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAOrD,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACtB,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC/C,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IACzE,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC;IAC7F,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC;IACpF,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;IACpF,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAClF,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,0BAA0B,EAAE,CAAC;IAC9F,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { LessonRecord, RecallLessonsOptions } from './types.js';
2
+ /**
3
+ * Recall top lessons for council context (enforced preferred, keyword overlap).
4
+ */
5
+ export declare function recallLessons(zelariRoot: string, options?: RecallLessonsOptions): LessonRecord[];
6
+ /** Markdown block for workspace context injection. */
7
+ export declare function formatLessonsForContext(lessons: LessonRecord[]): string | null;
8
+ //# sourceMappingURL=recallLessons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recallLessons.d.ts","sourceRoot":"","sources":["../../../src/council/lessons/recallLessons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAcrE;;GAEG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,oBAAyB,GACjC,YAAY,EAAE,CAwBhB;AAED,sDAAsD;AACtD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,GAAG,IAAI,CAW9E"}
@@ -0,0 +1,56 @@
1
+ import { readLessonsDeduped } from './io.js';
2
+ function scoreLesson(lesson, taskText) {
3
+ const low = taskText.toLowerCase();
4
+ let score = lesson.tier === 'enforced' ? 10 : 1;
5
+ for (const kw of lesson.keywords) {
6
+ if (low.includes(kw.toLowerCase()))
7
+ score += 3;
8
+ }
9
+ if (low.includes(lesson.checkId.replace(/\./g, ' ')))
10
+ score += 2;
11
+ score += lesson.recurrence;
12
+ return score;
13
+ }
14
+ /**
15
+ * Recall top lessons for council context (enforced preferred, keyword overlap).
16
+ */
17
+ export function recallLessons(zelariRoot, options = {}) {
18
+ const maxLessons = options.maxLessons ?? 5;
19
+ const maxBytes = options.maxBytes ?? 2048;
20
+ const taskText = options.taskText ?? '';
21
+ const all = readLessonsDeduped(zelariRoot);
22
+ if (all.length === 0)
23
+ return [];
24
+ const ranked = [...all].sort((a, b) => {
25
+ const sa = scoreLesson(a, taskText);
26
+ const sb = scoreLesson(b, taskText);
27
+ return sb - sa;
28
+ });
29
+ const picked = [];
30
+ let bytes = 0;
31
+ for (const lesson of ranked) {
32
+ if (picked.length >= maxLessons)
33
+ break;
34
+ const line = JSON.stringify(lesson);
35
+ if (bytes + line.length > maxBytes && picked.length > 0)
36
+ break;
37
+ picked.push(lesson);
38
+ bytes += line.length;
39
+ }
40
+ return picked;
41
+ }
42
+ /** Markdown block for workspace context injection. */
43
+ export function formatLessonsForContext(lessons) {
44
+ if (lessons.length === 0)
45
+ return null;
46
+ const lines = [
47
+ '## Council lessons (methodology — not answers)',
48
+ 'Apply enforced lessons before claiming verification PASS.',
49
+ '',
50
+ ];
51
+ for (const l of lessons) {
52
+ lines.push(`- **[${l.tier}]** \`${l.checkId}\`: ${l.methodology}`);
53
+ }
54
+ return lines.join('\n');
55
+ }
56
+ //# sourceMappingURL=recallLessons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recallLessons.js","sourceRoot":"","sources":["../../../src/council/lessons/recallLessons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,SAAS,WAAW,CAAC,MAAoB,EAAE,QAAgB;IACzD,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;YAAE,KAAK,IAAI,CAAC,CAAC;IACjD,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAAE,KAAK,IAAI,CAAC,CAAC;IACjE,KAAK,IAAI,MAAM,CAAC,UAAU,CAAC;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAkB,EAClB,UAAgC,EAAE;IAElC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,I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C,CAAC,OAAO,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { VerificationCheckResult } from '../verification/types.js';
2
+ import type { CaptureFailureResult } from './types.js';
3
+ /**
4
+ * Capture a verification FAIL as a methodology lesson (append-only jsonl).
5
+ */
6
+ export declare function captureFailure(zelariRoot: string, check: VerificationCheckResult): CaptureFailureResult;
7
+ //# sourceMappingURL=recordFailure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordFailure.d.ts","sourceRoot":"","sources":["../../../src/council/lessons/recordFailure.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAuB,MAAM,0BAA0B,CAAC;AAI7F,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,YAAY,CAAC;AAgDrE;;GAEG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,uBAAuB,GAC7B,oBAAoB,CA0CtB"}
@@ -0,0 +1,86 @@
1
+ import { appendFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { isAnswerLeak } from './isAnswerLeak.js';
4
+ import { LESSONS_FILE, readLessonsDeduped } from './io.js';
5
+ import { jaccardSimilarity, normalizeForSignature, tokenizeForSignature } from './signatures.js';
6
+ const JACCARD_MERGE_THRESHOLD = 0.72;
7
+ const ENFORCED_AFTER_RECURRENCE = 2;
8
+ const METHODOLOGY = {
9
+ 'motion.keyframes': 'Grep @keyframes in targets before PASS; compositor budget allows only transform and opacity.',
10
+ 'motion.transitions': 'Grep transition properties before PASS; forbid layout-affecting props (grid-template-rows, box-shadow, etc.).',
11
+ 'css.dead-hook': 'Every classList.add must have a matching CSS rule; grep both script and style blocks.',
12
+ 'synthesis.tier-inflation': 'Verification status tier cannot exceed the report; never PASS a check prefix that still has FAIL in verification-report.',
13
+ 'synthesis.honesty': 'Claims like verificato/regressione require Evidence table with path:Lline or tool output — not prose alone.',
14
+ 'synthesis.cite-invalid': 'Every path:Lline citation must exist and be non-empty; grep before citing.',
15
+ 'synthesis.degraded-banner': 'Degraded runs must include DEGRADED_RUN banner; do not claim ready-to-commit.',
16
+ 'plan.reality': 'Milestone keywords in plan.json must appear in implementation targets before claiming compatibility.',
17
+ };
18
+ function methodologyFor(check) {
19
+ return (METHODOLOGY[check.id] ??
20
+ `When ${check.id} fails, fix the underlying issue and cite grep/tool evidence before claiming PASS.`);
21
+ }
22
+ function keywordsFrom(check, signature) {
23
+ const words = signature.split(' ').filter((w) => w.length >= 4);
24
+ const fromId = check.id.split(/[.-]/).filter((p) => p.length >= 4);
25
+ return [...new Set([...fromId, ...words])].slice(0, 12);
26
+ }
27
+ function writeLesson(zelariRoot, lesson) {
28
+ const path = join(zelariRoot, LESSONS_FILE);
29
+ appendFileSync(path, `${JSON.stringify(lesson)}\n`, 'utf8');
30
+ }
31
+ function findSimilar(lessons, signature) {
32
+ const sigTokens = tokenizeForSignature(signature);
33
+ let best = null;
34
+ let bestScore = 0;
35
+ for (const l of lessons) {
36
+ const score = jaccardSimilarity(sigTokens, tokenizeForSignature(l.signature));
37
+ if (score > bestScore) {
38
+ bestScore = score;
39
+ best = l;
40
+ }
41
+ }
42
+ return bestScore >= JACCARD_MERGE_THRESHOLD ? best : null;
43
+ }
44
+ /**
45
+ * Capture a verification FAIL as a methodology lesson (append-only jsonl).
46
+ */
47
+ export function captureFailure(zelariRoot, check) {
48
+ if (check.ok) {
49
+ return { captured: false, reason: 'check passed' };
50
+ }
51
+ const methodology = methodologyFor(check);
52
+ const leak = isAnswerLeak(`${methodology} ${check.message} ${check.evidence ?? ''}`);
53
+ if (leak.leak) {
54
+ return { captured: false, rejected: true, reason: leak.reason };
55
+ }
56
+ const signature = normalizeForSignature(check.id, check.message);
57
+ const existing = readLessonsDeduped(zelariRoot);
58
+ const similar = findSimilar(existing, signature);
59
+ const now = new Date().toISOString();
60
+ if (similar) {
61
+ const recurrence = similar.recurrence + 1;
62
+ const tier = recurrence >= ENFORCED_AFTER_RECURRENCE ? 'enforced' : similar.tier;
63
+ const updated = {
64
+ ...similar,
65
+ recurrence,
66
+ tier,
67
+ updatedAt: now,
68
+ };
69
+ writeLesson(zelariRoot, updated);
70
+ return { captured: true, lesson: updated };
71
+ }
72
+ const lesson = {
73
+ id: `lesson-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
74
+ signature,
75
+ checkId: check.id,
76
+ methodology,
77
+ tier: 'advisory',
78
+ keywords: keywordsFrom(check, signature),
79
+ recurrence: 1,
80
+ createdAt: now,
81
+ updatedAt: now,
82
+ };
83
+ writeLesson(zelariRoot, lesson);
84
+ return { captured: true, lesson };
85
+ }
86
+ //# sourceMappingURL=recordFailure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordFailure.js","sourceRoot":"","sources":["../../../src/council/lessons/recordFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGjG,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC,MAAM,WAAW,GAAiD;IAChE,kBAAkB,EAAE,8FAA8F;IAClH,oBAAoB,EAAE,+GAA+G;IACrI,eAAe,EAAE,uFAAuF;IACxG,0BAA0B,EAAE,0HAA0H;IACtJ,mBAAmB,EAAE,6GAA6G;IAClI,wBAAwB,EAAE,4EAA4E;IACtG,2BAA2B,EAAE,+EAA+E;IAC5G,cAAc,E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CAAC,IAAI,CAAC;QACjF,MAAM,OAAO,GAAiB;YAC5B,GAAG,OAAO;YACV,UAAU;YACV,IAAI;YACJ,SAAS,EAAE,GAAG;SACf,CAAC;QACF,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,MAAM,GAAiB;QAC3B,EAAE,EAAE,UAAU,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QACpE,SAAS;QACT,OAAO,EAAE,KAAK,CAAC,EAAE;QACjB,WAAW;QACX,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC;QACxC,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;KACf,CAAC;IACF,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Tokenize for Jaccard similarity (lowercase words ≥3 chars). */
2
+ export declare function tokenizeForSignature(text: string): Set<string>;
3
+ export declare function jaccardSimilarity(a: Set<string>, b: Set<string>): number;
4
+ /** Normalize check message for stable signatures (strip paths, lines, numbers). */
5
+ export declare function normalizeForSignature(checkId: string, message: string): string;
6
+ //# sourceMappingURL=signatures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatures.d.ts","sourceRoot":"","sources":["../../../src/council/lessons/signatures.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAM9D;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAQxE;AAED,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ9E"}
@@ -0,0 +1,31 @@
1
+ /** Tokenize for Jaccard similarity (lowercase words ≥3 chars). */
2
+ export function tokenizeForSignature(text) {
3
+ const out = new Set();
4
+ for (const w of text.toLowerCase().split(/\W+/)) {
5
+ if (w.length >= 3)
6
+ out.add(w);
7
+ }
8
+ return out;
9
+ }
10
+ export function jaccardSimilarity(a, b) {
11
+ if (a.size === 0 && b.size === 0)
12
+ return 1;
13
+ let inter = 0;
14
+ for (const x of a) {
15
+ if (b.has(x))
16
+ inter++;
17
+ }
18
+ const union = new Set([...a, ...b]).size;
19
+ return union === 0 ? 0 : inter / union;
20
+ }
21
+ /** Normalize check message for stable signatures (strip paths, lines, numbers). */
22
+ export function normalizeForSignature(checkId, message) {
23
+ const base = `${checkId} ${message}`
24
+ .toLowerCase()
25
+ .replace(/[A-Za-z]:\\[^\s]+/g, 'path')
26
+ .replace(/\/[\w./-]+/g, 'path')
27
+ .replace(/l\d{1,6}/gi, 'line')
28
+ .replace(/\d+/g, 'n');
29
+ return [...tokenizeForSignature(base)].sort().join(' ');
30
+ }
31
+ //# sourceMappingURL=signatures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatures.js","sourceRoot":"","sources":["../../../src/council/lessons/signatures.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC;YAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,CAAc,EAAE,CAAc;IAC9D,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC3C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,KAAK,EAAE,CAAC;IACxB,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACzC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC;AACzC,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,OAAe;IACpE,MAAM,IAAI,GAAG,GAAG,OAAO,IAAI,OAAO,EAAE;SACjC,WAAW,EAAE;SACb,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC;SACrC,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC;SAC9B,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;SAC7B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxB,OAAO,CAAC,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,27 @@
1
+ export type LessonTier = 'advisory' | 'enforced';
2
+ export interface LessonRecord {
3
+ id: string;
4
+ /** Normalized tokens for recurrence matching. */
5
+ signature: string;
6
+ checkId: string;
7
+ /** Methodology guidance — not task-specific answers. */
8
+ methodology: string;
9
+ tier: LessonTier;
10
+ keywords: string[];
11
+ recurrence: number;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ }
15
+ export interface CaptureFailureResult {
16
+ captured: boolean;
17
+ rejected?: boolean;
18
+ reason?: string;
19
+ lesson?: LessonRecord;
20
+ }
21
+ export interface RecallLessonsOptions {
22
+ maxLessons?: number;
23
+ maxBytes?: number;
24
+ /** User task text for keyword overlap scoring. */
25
+ taskText?: string;
26
+ }
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/council/lessons/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/council/lessons/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,28 @@
1
1
  import type { CouncilRunMode } from './runMode.js';
2
2
  export declare const DESIGN_PHASE_MODE_BANNER = "COUNCIL RUN MODE: design-phase.\nWorkspace tool emissions described in your role prompt are MANDATORY in this run \u2014 prose alone does not count as a deliverable. Persist artifacts via the workspace tools listed in your AVAILABLE TOOLS section.";
3
3
  export declare const IMPLEMENTATION_MODE_BANNER = "COUNCIL RUN MODE: implementation.\nPrefer write_file, edit_file, and bash for code changes. Design-phase mandatory workspace blocks in your role prompt are INACTIVE in this run \u2014 only call workspace tools when they add durable project value.";
4
- export declare function councilModeBanner(runMode: CouncilRunMode): string;
4
+ /**
5
+ * Implementation-mode banner for the SOLE implementer (the chairman, Lucifero).
6
+ * Only this member writes/edits project files, so the "who implemented" signal
7
+ * stays unambiguous and multiple agents never edit the same files.
8
+ */
9
+ export declare const IMPLEMENTATION_IMPLEMENTER_BANNER = "COUNCIL RUN MODE: implementation \u2014 you are the IMPLEMENTER.\nYou are the only member that writes code this run. Implement the solution with write_file / edit_file and verify with bash. Reconcile the specialists' analysis and Minosse's critique into working, verified changes. Design-phase mandatory workspace blocks in your role prompt are INACTIVE \u2014 only call workspace tools when they add durable project value.";
10
+ /**
11
+ * Implementation-mode banner for advisors (specialists + Minosse). They analyze,
12
+ * plan and critique; they must NOT modify project files (the implementer does).
13
+ * This prevents multi-writer chaos where several agents edit the same files and
14
+ * pile up conflicting changes.
15
+ */
16
+ export declare const IMPLEMENTATION_ADVISOR_BANNER = "COUNCIL RUN MODE: implementation \u2014 you are an ADVISOR.\nDo NOT write or edit project files (not via write_file/edit_file, and not via bash) \u2014 the final synthesizer (Lucifero) is the sole implementer. Your job is to inspect the codebase (read_file, grep_content, list_files) and produce analysis, a concrete plan, or critique that the implementer will execute. Design-phase mandatory workspace blocks in your role prompt are INACTIVE in this run.";
17
+ /**
18
+ * Pick the run-mode banner for a member.
19
+ *
20
+ * @param opts.isImplementer In implementation mode, `true` selects the
21
+ * implementer banner (chairman/Lucifero), `false` the advisor banner
22
+ * (specialists + Minosse). Omitted → the legacy generic banner (kept for
23
+ * backward compatibility with callers that don't distinguish roles).
24
+ */
25
+ export declare function councilModeBanner(runMode: CouncilRunMode, opts?: {
26
+ isImplementer?: boolean;
27
+ }): string;
5
28
  //# sourceMappingURL=modeBanners.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modeBanners.d.ts","sourceRoot":"","sources":["../../src/council/modeBanners.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,wBAAwB,4PAC6K,CAAC;AAEnN,eAAO,MAAM,0BAA0B,2PACwK,CAAC;AAEhN,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAIjE"}
1
+ {"version":3,"file":"modeBanners.d.ts","sourceRoot":"","sources":["../../src/council/modeBanners.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,wBAAwB,4PAC6K,CAAC;AAEnN,eAAO,MAAM,0BAA0B,2PACwK,CAAC;AAEhN;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,4aACmT,CAAC;AAElW;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,4cAC4V,CAAC;AAEvY;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EACvB,IAAI,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,GACjC,MAAM,CAKR"}
@@ -2,9 +2,36 @@ export const DESIGN_PHASE_MODE_BANNER = `COUNCIL RUN MODE: design-phase.
2
2
  Workspace tool emissions described in your role prompt are MANDATORY in this run — prose alone does not count as a deliverable. Persist artifacts via the workspace tools listed in your AVAILABLE TOOLS section.`;
3
3
  export const IMPLEMENTATION_MODE_BANNER = `COUNCIL RUN MODE: implementation.
4
4
  Prefer write_file, edit_file, and bash for code changes. Design-phase mandatory workspace blocks in your role prompt are INACTIVE in this run — only call workspace tools when they add durable project value.`;
5
- export function councilModeBanner(runMode) {
6
- return runMode === 'design-phase'
7
- ? DESIGN_PHASE_MODE_BANNER
8
- : IMPLEMENTATION_MODE_BANNER;
5
+ /**
6
+ * Implementation-mode banner for the SOLE implementer (the chairman, Lucifero).
7
+ * Only this member writes/edits project files, so the "who implemented" signal
8
+ * stays unambiguous and multiple agents never edit the same files.
9
+ */
10
+ export const IMPLEMENTATION_IMPLEMENTER_BANNER = `COUNCIL RUN MODE: implementation — you are the IMPLEMENTER.
11
+ You are the only member that writes code this run. Implement the solution with write_file / edit_file and verify with bash. Reconcile the specialists' analysis and Minosse's critique into working, verified changes. Design-phase mandatory workspace blocks in your role prompt are INACTIVE — only call workspace tools when they add durable project value.`;
12
+ /**
13
+ * Implementation-mode banner for advisors (specialists + Minosse). They analyze,
14
+ * plan and critique; they must NOT modify project files (the implementer does).
15
+ * This prevents multi-writer chaos where several agents edit the same files and
16
+ * pile up conflicting changes.
17
+ */
18
+ export const IMPLEMENTATION_ADVISOR_BANNER = `COUNCIL RUN MODE: implementation — you are an ADVISOR.
19
+ Do NOT write or edit project files (not via write_file/edit_file, and not via bash) — the final synthesizer (Lucifero) is the sole implementer. Your job is to inspect the codebase (read_file, grep_content, list_files) and produce analysis, a concrete plan, or critique that the implementer will execute. Design-phase mandatory workspace blocks in your role prompt are INACTIVE in this run.`;
20
+ /**
21
+ * Pick the run-mode banner for a member.
22
+ *
23
+ * @param opts.isImplementer In implementation mode, `true` selects the
24
+ * implementer banner (chairman/Lucifero), `false` the advisor banner
25
+ * (specialists + Minosse). Omitted → the legacy generic banner (kept for
26
+ * backward compatibility with callers that don't distinguish roles).
27
+ */
28
+ export function councilModeBanner(runMode, opts) {
29
+ if (runMode === 'design-phase')
30
+ return DESIGN_PHASE_MODE_BANNER;
31
+ if (opts?.isImplementer === true)
32
+ return IMPLEMENTATION_IMPLEMENTER_BANNER;
33
+ if (opts?.isImplementer === false)
34
+ return IMPLEMENTATION_ADVISOR_BANNER;
35
+ return IMPLEMENTATION_MODE_BANNER;
9
36
  }
10
37
  //# sourceMappingURL=modeBanners.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"modeBanners.js","sourceRoot":"","sources":["../../src/council/modeBanners.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAG;kNAC0K,CAAC;AAEnN,MAAM,CAAC,MAAM,0BAA0B,GAAG;+MACqK,CAAC;AAEhN,MAAM,UAAU,iBAAiB,CAAC,OAAuB;IACvD,OAAO,OAAO,KAAK,cAAc;QAC/B,CAAC,CAAC,wBAAwB;QAC1B,CAAC,CAAC,0BAA0B,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"modeBanners.js","sourceRoot":"","sources":["../../src/council/modeBanners.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAG;kNAC0K,CAAC;AAEnN,MAAM,CAAC,MAAM,0BAA0B,GAAG;+MACqK,CAAC;AAEhN;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG;iWACgT,CAAC;AAElW;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;sYACyV,CAAC;AAEvY;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAuB,EACvB,IAAkC;IAElC,IAAI,OAAO,KAAK,cAAc;QAAE,OAAO,wBAAwB,CAAC;IAChE,IAAI,IAAI,EAAE,aAAa,KAAK,IAAI;QAAE,OAAO,iCAAiC,CAAC;IAC3E,IAAI,IAAI,EAAE,aAAa,KAAK,KAAK;QAAE,OAAO,6BAA6B,CAAC;IACxE,OAAO,0BAA0B,CAAC;AACpC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { NfrSpec } from '../verification/types.js';
2
+ /** Keywords that indicate measurable NFR constraints (motion, perf, budget). */
3
+ export declare const NFR_KEYWORDS: readonly ["motion", "animation", "animate", "keyframes", "transition", "compositor", "reduced-motion", "prefers-reduced-motion", "byte budget", "bytes", "performance", "perf budget", "nfr", "layout thrash", "box-shadow", "inline js", "inline-js"];
4
+ export interface TaskScope {
5
+ /** Project-relative file targets for this task. */
6
+ targets: string[];
7
+ /** Task theme keywords (animation, motion, …). */
8
+ keywords: string[];
9
+ /** Features explicitly deferred or out of scope for this run. */
10
+ explicitOut: string[];
11
+ /** Whether NFR-style constraints appear in the user request. */
12
+ nfrRelevant: boolean;
13
+ sources: Array<'userMessage' | 'nfr-spec'>;
14
+ }
15
+ export interface ExtractTaskScopeInput {
16
+ userMessage: string;
17
+ nfrSpec?: NfrSpec | null;
18
+ /** Optional plan text (JSON string or markdown) for backlog hints. */
19
+ planText?: string;
20
+ }
21
+ /** True when the task text mentions measurable NFR themes. */
22
+ export declare function taskMatchesNfrKeywords(userMessage: string, planText?: string): boolean;
23
+ /**
24
+ * Deterministic task scope from user message + optional nfr-spec.
25
+ * No NLP — keyword overlap, file-path regex, and nfr-spec targets only.
26
+ */
27
+ export declare function extractTaskScope(input: ExtractTaskScopeInput): TaskScope;
28
+ export interface ScopeMatchInput {
29
+ name?: string;
30
+ description?: string;
31
+ id?: string;
32
+ }
33
+ /** Classify a plan task relative to extracted scope. */
34
+ export declare function classifyTaskScope(task: ScopeMatchInput, scope: TaskScope): 'in-scope' | 'backlog' | 'neutral';
35
+ //# sourceMappingURL=extractTaskScope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractTaskScope.d.ts","sourceRoot":"","sources":["../../../src/council/scope/extractTaskScope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,gFAAgF;AAChF,eAAO,MAAM,YAAY,wPAkBf,CAAC;AAgCX,MAAM,WAAW,SAAS;IACxB,mDAAmD;IACnD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iEAAiE;IACjE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gEAAgE;IAChE,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,aAAa,GAAG,UAAU,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAqED,8DAA8D;AAC9D,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAGT;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAiCxE;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,wDAAwD;AACxD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,SAAS,GACf,UAAU,GAAG,SAAS,GAAG,SAAS,CAgCpC"}