@jigyasudham/veto 3.2.1 → 3.4.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/README.md +62 -7
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +4 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/agents/llm-runner.d.ts.map +1 -1
- package/dist/agents/llm-runner.js +17 -4
- package/dist/agents/llm-runner.js.map +1 -1
- package/dist/cli/context-guidance.d.ts +16 -0
- package/dist/cli/context-guidance.d.ts.map +1 -0
- package/dist/cli/context-guidance.js +20 -0
- package/dist/cli/context-guidance.js.map +1 -0
- package/dist/cli/leftover-guides.d.ts +38 -0
- package/dist/cli/leftover-guides.d.ts.map +1 -0
- package/dist/cli/leftover-guides.js +135 -0
- package/dist/cli/leftover-guides.js.map +1 -0
- package/dist/cli/statusline-hosts.d.ts +36 -0
- package/dist/cli/statusline-hosts.d.ts.map +1 -0
- package/dist/cli/statusline-hosts.js +212 -0
- package/dist/cli/statusline-hosts.js.map +1 -0
- package/dist/cli/statusline.d.ts +6 -0
- package/dist/cli/statusline.d.ts.map +1 -1
- package/dist/cli/statusline.js +51 -10
- package/dist/cli/statusline.js.map +1 -1
- package/dist/cli.js +105 -48
- package/dist/cli.js.map +1 -1
- package/dist/council/llm-council.d.ts.map +1 -1
- package/dist/council/llm-council.js +13 -8
- package/dist/council/llm-council.js.map +1 -1
- package/dist/lessons/adapters/claude.d.ts +10 -0
- package/dist/lessons/adapters/claude.d.ts.map +1 -0
- package/dist/lessons/adapters/claude.js +18 -0
- package/dist/lessons/adapters/claude.js.map +1 -0
- package/dist/lessons/adapters/codex.d.ts +7 -0
- package/dist/lessons/adapters/codex.d.ts.map +1 -0
- package/dist/lessons/adapters/codex.js +9 -0
- package/dist/lessons/adapters/codex.js.map +1 -0
- package/dist/lessons/adapters/gemini.d.ts +4 -0
- package/dist/lessons/adapters/gemini.d.ts.map +1 -0
- package/dist/lessons/adapters/gemini.js +44 -0
- package/dist/lessons/adapters/gemini.js.map +1 -0
- package/dist/lessons/adapters/index.d.ts +6 -0
- package/dist/lessons/adapters/index.d.ts.map +1 -0
- package/dist/lessons/adapters/index.js +14 -0
- package/dist/lessons/adapters/index.js.map +1 -0
- package/dist/lessons/adapters/markdown.d.ts +16 -0
- package/dist/lessons/adapters/markdown.d.ts.map +1 -0
- package/dist/lessons/adapters/markdown.js +130 -0
- package/dist/lessons/adapters/markdown.js.map +1 -0
- package/dist/lessons/adapters/types.d.ts +27 -0
- package/dist/lessons/adapters/types.d.ts.map +1 -0
- package/dist/lessons/adapters/types.js +2 -0
- package/dist/lessons/adapters/types.js.map +1 -0
- package/dist/lessons/classify.d.ts +30 -0
- package/dist/lessons/classify.d.ts.map +1 -0
- package/dist/lessons/classify.js +101 -0
- package/dist/lessons/classify.js.map +1 -0
- package/dist/lessons/discover.d.ts +19 -0
- package/dist/lessons/discover.d.ts.map +1 -0
- package/dist/lessons/discover.js +65 -0
- package/dist/lessons/discover.js.map +1 -0
- package/dist/lessons/harvest.d.ts +48 -0
- package/dist/lessons/harvest.d.ts.map +1 -0
- package/dist/lessons/harvest.js +96 -0
- package/dist/lessons/harvest.js.map +1 -0
- package/dist/lessons/identity.d.ts +23 -0
- package/dist/lessons/identity.d.ts.map +1 -0
- package/dist/lessons/identity.js +81 -0
- package/dist/lessons/identity.js.map +1 -0
- package/dist/lessons/mask.d.ts +6 -0
- package/dist/lessons/mask.d.ts.map +1 -0
- package/dist/lessons/mask.js +22 -0
- package/dist/lessons/mask.js.map +1 -0
- package/dist/lessons/select.d.ts +23 -0
- package/dist/lessons/select.d.ts.map +1 -0
- package/dist/lessons/select.js +134 -0
- package/dist/lessons/select.js.map +1 -0
- package/dist/lessons/source-project.d.ts +9 -0
- package/dist/lessons/source-project.d.ts.map +1 -0
- package/dist/lessons/source-project.js +149 -0
- package/dist/lessons/source-project.js.map +1 -0
- package/dist/lessons/store.d.ts +56 -0
- package/dist/lessons/store.d.ts.map +1 -0
- package/dist/lessons/store.js +85 -0
- package/dist/lessons/store.js.map +1 -0
- package/dist/memory/config.d.ts +14 -0
- package/dist/memory/config.d.ts.map +1 -1
- package/dist/memory/config.js +43 -0
- package/dist/memory/config.js.map +1 -1
- package/dist/memory/decisions.d.ts +34 -1
- package/dist/memory/decisions.d.ts.map +1 -1
- package/dist/memory/decisions.js +158 -13
- package/dist/memory/decisions.js.map +1 -1
- package/dist/memory/local.d.ts.map +1 -1
- package/dist/memory/local.js +38 -4
- package/dist/memory/local.js.map +1 -1
- package/dist/memory/schema.d.ts +2 -1
- package/dist/memory/schema.d.ts.map +1 -1
- package/dist/memory/schema.js +69 -0
- package/dist/memory/schema.js.map +1 -1
- package/dist/server/handlers/council.d.ts.map +1 -1
- package/dist/server/handlers/council.js +16 -2
- package/dist/server/handlers/council.js.map +1 -1
- package/dist/server/handlers/generators.d.ts.map +1 -1
- package/dist/server/handlers/generators.js +8 -0
- package/dist/server/handlers/generators.js.map +1 -1
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +44 -7
- package/dist/server/handlers/memory.js.map +1 -1
- package/dist/server/handlers/session.d.ts.map +1 -1
- package/dist/server/handlers/session.js +52 -22
- package/dist/server/handlers/session.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +12 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/definitions.d.ts +7 -3
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +4 -3
- package/dist/tools/definitions.js.map +1 -1
- package/dist/transcripts/cache.d.ts +1 -0
- package/dist/transcripts/cache.d.ts.map +1 -1
- package/dist/transcripts/cache.js +0 -0
- package/dist/transcripts/cache.js.map +1 -1
- package/dist/transcripts/claude-paths.d.ts +5 -0
- package/dist/transcripts/claude-paths.d.ts.map +1 -0
- package/dist/transcripts/claude-paths.js +21 -0
- package/dist/transcripts/claude-paths.js.map +1 -0
- package/dist/transcripts/context.d.ts +41 -0
- package/dist/transcripts/context.d.ts.map +1 -0
- package/dist/transcripts/context.js +144 -0
- package/dist/transcripts/context.js.map +1 -0
- package/dist/transcripts/discover.d.ts +12 -2
- package/dist/transcripts/discover.d.ts.map +1 -1
- package/dist/transcripts/discover.js +55 -7
- package/dist/transcripts/discover.js.map +1 -1
- package/dist/transcripts/manage.d.ts +8 -0
- package/dist/transcripts/manage.d.ts.map +1 -1
- package/dist/transcripts/manage.js +28 -13
- package/dist/transcripts/manage.js.map +1 -1
- package/dist/transcripts/mapping.d.ts.map +1 -1
- package/dist/transcripts/mapping.js +4 -2
- package/dist/transcripts/mapping.js.map +1 -1
- package/dist/transcripts/on-save.d.ts +9 -0
- package/dist/transcripts/on-save.d.ts.map +1 -1
- package/dist/transcripts/on-save.js +36 -9
- package/dist/transcripts/on-save.js.map +1 -1
- package/dist/transcripts/project-key.d.ts +4 -0
- package/dist/transcripts/project-key.d.ts.map +1 -0
- package/dist/transcripts/project-key.js +30 -0
- package/dist/transcripts/project-key.js.map +1 -0
- package/dist/transcripts/recall.d.ts +4 -0
- package/dist/transcripts/recall.d.ts.map +1 -1
- package/dist/transcripts/recall.js +6 -5
- package/dist/transcripts/recall.js.map +1 -1
- package/dist/transcripts/stopwords.d.ts +2 -0
- package/dist/transcripts/stopwords.d.ts.map +1 -0
- package/dist/transcripts/stopwords.js +8 -0
- package/dist/transcripts/stopwords.js.map +1 -0
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { LessonSource } from './adapters/index.js';
|
|
2
|
+
import type { LessonScope } from './classify.js';
|
|
3
|
+
export type LessonRow = {
|
|
4
|
+
id: string;
|
|
5
|
+
source_cli: LessonSource;
|
|
6
|
+
source_path: string;
|
|
7
|
+
section_anchor: string;
|
|
8
|
+
project_identity: string;
|
|
9
|
+
project_label: string | null;
|
|
10
|
+
scope: LessonScope;
|
|
11
|
+
kind: string;
|
|
12
|
+
text_masked: string;
|
|
13
|
+
source_hash: string;
|
|
14
|
+
source_mtime: string;
|
|
15
|
+
quarantined: number;
|
|
16
|
+
quarantine_reason: string | null;
|
|
17
|
+
created_at: string;
|
|
18
|
+
updated_at: string;
|
|
19
|
+
};
|
|
20
|
+
/** A section after masking and classification; raw memory text never reaches the store. */
|
|
21
|
+
export type HarvestedSection = {
|
|
22
|
+
anchor: string;
|
|
23
|
+
textMasked: string;
|
|
24
|
+
scope: LessonScope;
|
|
25
|
+
kind: string;
|
|
26
|
+
quarantineReason: string | null;
|
|
27
|
+
};
|
|
28
|
+
export type SyncLessonsInput = {
|
|
29
|
+
sourceCli: LessonSource;
|
|
30
|
+
sourcePath: string;
|
|
31
|
+
projectIdentity: string;
|
|
32
|
+
projectLabel: string | null;
|
|
33
|
+
sourceMtime: string;
|
|
34
|
+
sections: HarvestedSection[];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Make a source's rows exactly its current sections: insert new ones, update
|
|
38
|
+
* changed ones, delete the rest (lifetime = source). A source that failed to
|
|
39
|
+
* parse never reaches this function, so a malformed file cannot erase rows;
|
|
40
|
+
* an empty section list is a successful parse of nothing and clears them.
|
|
41
|
+
*/
|
|
42
|
+
export declare function syncLessons(input: SyncLessonsInput): {
|
|
43
|
+
inserted: number;
|
|
44
|
+
updated: number;
|
|
45
|
+
removed: number;
|
|
46
|
+
};
|
|
47
|
+
/** Delete every row whose source file is no longer among the discovered ones. */
|
|
48
|
+
export declare function purgeVanishedLessonSources(present: Array<{
|
|
49
|
+
source: LessonSource;
|
|
50
|
+
sourcePath: string;
|
|
51
|
+
}>): number;
|
|
52
|
+
export declare function disableLessonSource(source: LessonSource, reason: string): void;
|
|
53
|
+
export declare function isLessonSourceEnabled(source: LessonSource): boolean;
|
|
54
|
+
/** Hosts whose adapter tripped the format-drift canary; their rows are not served. */
|
|
55
|
+
export declare function disabledLessonSources(): Set<LessonSource>;
|
|
56
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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AG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA6B3G;AAED,iFAAiF;AACjF,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,KAAK,CAAC;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAU/G;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAI9E;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAGnE;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,IAAI,GAAG,CAAC,YAAY,CAAC,CAGzD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { getDb } from '../memory/local.js';
|
|
3
|
+
/** Per SECTION, over everything stored: an edit elsewhere in the file leaves this row alone. */
|
|
4
|
+
function sectionHash(input, section) {
|
|
5
|
+
return createHash('sha256')
|
|
6
|
+
.update(JSON.stringify([input.projectIdentity, input.projectLabel, section.scope, section.kind, section.quarantineReason, section.textMasked]))
|
|
7
|
+
.digest('hex');
|
|
8
|
+
}
|
|
9
|
+
function inTransaction(run) {
|
|
10
|
+
const db = getDb();
|
|
11
|
+
db.exec('BEGIN');
|
|
12
|
+
try {
|
|
13
|
+
const out = run();
|
|
14
|
+
db.exec('COMMIT');
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
db.exec('ROLLBACK');
|
|
19
|
+
throw err;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Make a source's rows exactly its current sections: insert new ones, update
|
|
24
|
+
* changed ones, delete the rest (lifetime = source). A source that failed to
|
|
25
|
+
* parse never reaches this function, so a malformed file cannot erase rows;
|
|
26
|
+
* an empty section list is a successful parse of nothing and clears them.
|
|
27
|
+
*/
|
|
28
|
+
export function syncLessons(input) {
|
|
29
|
+
return inTransaction(() => {
|
|
30
|
+
const db = getDb();
|
|
31
|
+
const existing = db.prepare('SELECT id, source_hash FROM lessons WHERE source_cli = ? AND source_path = ? AND section_anchor = ?');
|
|
32
|
+
const insert = db.prepare(`INSERT INTO lessons (id, source_cli, source_path, section_anchor, project_identity, project_label, scope, kind, text_masked, source_hash, source_mtime, quarantined, quarantine_reason, created_at, updated_at)
|
|
33
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
34
|
+
const update = db.prepare(`UPDATE lessons SET project_identity = ?, project_label = ?, scope = ?, kind = ?, text_masked = ?, source_hash = ?, source_mtime = ?, quarantined = ?, quarantine_reason = ?, updated_at = ? WHERE id = ?`);
|
|
35
|
+
const now = new Date().toISOString();
|
|
36
|
+
let inserted = 0;
|
|
37
|
+
let updated = 0;
|
|
38
|
+
for (const section of input.sections) {
|
|
39
|
+
const hash = sectionHash(input, section);
|
|
40
|
+
const quarantined = section.quarantineReason ? 1 : 0;
|
|
41
|
+
const row = existing.get(input.sourceCli, input.sourcePath, section.anchor);
|
|
42
|
+
if (!row) {
|
|
43
|
+
insert.run(randomUUID(), input.sourceCli, input.sourcePath, section.anchor, input.projectIdentity, input.projectLabel, section.scope, section.kind, section.textMasked, hash, input.sourceMtime, quarantined, section.quarantineReason, now, now);
|
|
44
|
+
inserted++;
|
|
45
|
+
}
|
|
46
|
+
else if (row.source_hash !== hash) {
|
|
47
|
+
update.run(input.projectIdentity, input.projectLabel, section.scope, section.kind, section.textMasked, hash, input.sourceMtime, quarantined, section.quarantineReason, now, row.id);
|
|
48
|
+
updated++;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const anchors = input.sections.map(section => section.anchor);
|
|
52
|
+
const keep = anchors.length ? ` AND section_anchor NOT IN (${anchors.map(() => '?').join(', ')})` : '';
|
|
53
|
+
const removed = Number(db.prepare(`DELETE FROM lessons WHERE source_cli = ? AND source_path = ?${keep}`)
|
|
54
|
+
.run(input.sourceCli, input.sourcePath, ...anchors).changes);
|
|
55
|
+
return { inserted, updated, removed };
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** Delete every row whose source file is no longer among the discovered ones. */
|
|
59
|
+
export function purgeVanishedLessonSources(present) {
|
|
60
|
+
const keep = new Set(present.map(p => `${p.source}\u0000${p.sourcePath}`));
|
|
61
|
+
const db = getDb();
|
|
62
|
+
const rows = db.prepare('SELECT DISTINCT source_cli, source_path FROM lessons').all();
|
|
63
|
+
const del = db.prepare('DELETE FROM lessons WHERE source_cli = ? AND source_path = ?');
|
|
64
|
+
let removed = 0;
|
|
65
|
+
for (const row of rows) {
|
|
66
|
+
if (!keep.has(`${row.source_cli}\u0000${row.source_path}`))
|
|
67
|
+
removed += Number(del.run(row.source_cli, row.source_path).changes);
|
|
68
|
+
}
|
|
69
|
+
return removed;
|
|
70
|
+
}
|
|
71
|
+
export function disableLessonSource(source, reason) {
|
|
72
|
+
getDb().prepare(`INSERT INTO lesson_source_state (source_cli, enabled, disabled_reason, checked_at) VALUES (?, 0, ?, ?)
|
|
73
|
+
ON CONFLICT(source_cli) DO UPDATE SET enabled = 0, disabled_reason = excluded.disabled_reason, checked_at = excluded.checked_at`)
|
|
74
|
+
.run(source, reason, new Date().toISOString());
|
|
75
|
+
}
|
|
76
|
+
export function isLessonSourceEnabled(source) {
|
|
77
|
+
const row = getDb().prepare('SELECT enabled FROM lesson_source_state WHERE source_cli = ?').get(source);
|
|
78
|
+
return !row || row.enabled === 1;
|
|
79
|
+
}
|
|
80
|
+
/** Hosts whose adapter tripped the format-drift canary; their rows are not served. */
|
|
81
|
+
export function disabledLessonSources() {
|
|
82
|
+
const rows = getDb().prepare('SELECT source_cli FROM lesson_source_state WHERE enabled = 0').all();
|
|
83
|
+
return new Set(rows.map(row => row.source_cli));
|
|
84
|
+
}
|
|
85
|
+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C;QACvB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,UAAU,SAAS,GAAG,CAAC,WAAW,EAAE,CAAC;YAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAClI,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAoB,EAAE,MAAc;IACtE,KAAK,EAAE,CAAC,OAAO,CAAC;oIACkH,CAAC;SAChI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAoB;IACxD,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC,OAAO,CAAC,8DAA8D,CAAC,CAAC,GAAG,CAAC,MAAM,CAAoC,CAAC;IAC3I,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,qBAAqB;IACnC,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC,OAAO,CAAC,8DAA8D,CAAC,CAAC,GAAG,EAAyC,CAAC;IAC1I,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/memory/config.d.ts
CHANGED
|
@@ -6,6 +6,15 @@ export type TranscriptsConfig = {
|
|
|
6
6
|
consent_at: string | null;
|
|
7
7
|
first_capture_at: string | null;
|
|
8
8
|
};
|
|
9
|
+
export type LessonsConfig = {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
consent_version: number;
|
|
12
|
+
consent_at: string | null;
|
|
13
|
+
cross_project: boolean;
|
|
14
|
+
cross_vendor: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const LESSONS_CONSENT_VERSION = 2;
|
|
17
|
+
export declare const DEFAULT_LESSONS: LessonsConfig;
|
|
9
18
|
export type VetoConfig = {
|
|
10
19
|
dailyTokenBudget: {
|
|
11
20
|
claude: number;
|
|
@@ -17,9 +26,14 @@ export type VetoConfig = {
|
|
|
17
26
|
auto_apply_learning: boolean;
|
|
18
27
|
compact_tools: boolean;
|
|
19
28
|
transcripts: TranscriptsConfig;
|
|
29
|
+
lessons: LessonsConfig;
|
|
20
30
|
};
|
|
21
31
|
export declare const DEFAULT_BUDGETS: VetoConfig['dailyTokenBudget'];
|
|
22
32
|
export declare const DEFAULT_TRANSCRIPTS: TranscriptsConfig;
|
|
23
33
|
export declare function getConfig(): VetoConfig;
|
|
24
34
|
export declare function setConfig(partial: Partial<VetoConfig>): void;
|
|
35
|
+
/** Explicit v2 opt-in. No version upgrade can silently enable sharing. */
|
|
36
|
+
export declare function enableLessonsSharing(): LessonsConfig;
|
|
37
|
+
export declare function disableLessonsSharing(): void;
|
|
38
|
+
export declare function isLessonsSharingEnabled(config?: LessonsConfig): boolean;
|
|
25
39
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/memory/config.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAA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AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAOjC,CAAC;AAyBF,wBAAgB,SAAS,IAAI,UAAU,CAoCtC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAc5D;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,IAAI,aAAa,CAUpD;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AAED,wBAAgB,uBAAuB,CAAC,MAAM,GAAE,aAAmC,GAAG,OAAO,CAK5F"}
|
package/dist/memory/config.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { join, dirname } from 'node:path';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
4
|
+
export const LESSONS_CONSENT_VERSION = 2;
|
|
5
|
+
export const DEFAULT_LESSONS = {
|
|
6
|
+
enabled: false,
|
|
7
|
+
consent_version: 0,
|
|
8
|
+
consent_at: null,
|
|
9
|
+
cross_project: false,
|
|
10
|
+
cross_vendor: false,
|
|
11
|
+
};
|
|
4
12
|
// VETO_CONFIG_PATH overrides the config location (tests isolate here, mirroring
|
|
5
13
|
// VETO_TEST_DB). Read per-call so the override applies even after this module
|
|
6
14
|
// has already been imported transitively.
|
|
@@ -36,6 +44,15 @@ function normalizeTranscripts(raw) {
|
|
|
36
44
|
first_capture_at: typeof raw?.first_capture_at === 'string' ? raw.first_capture_at : null,
|
|
37
45
|
};
|
|
38
46
|
}
|
|
47
|
+
function normalizeLessons(raw) {
|
|
48
|
+
return {
|
|
49
|
+
enabled: raw?.enabled === true,
|
|
50
|
+
consent_version: typeof raw?.consent_version === 'number' ? raw.consent_version : 0,
|
|
51
|
+
consent_at: typeof raw?.consent_at === 'string' ? raw.consent_at : null,
|
|
52
|
+
cross_project: raw?.cross_project === true,
|
|
53
|
+
cross_vendor: raw?.cross_vendor === true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
39
56
|
export function getConfig() {
|
|
40
57
|
if (!existsSync(configPath())) {
|
|
41
58
|
return {
|
|
@@ -44,6 +61,7 @@ export function getConfig() {
|
|
|
44
61
|
auto_apply_learning: true,
|
|
45
62
|
compact_tools: false,
|
|
46
63
|
transcripts: { ...DEFAULT_TRANSCRIPTS },
|
|
64
|
+
lessons: { ...DEFAULT_LESSONS },
|
|
47
65
|
};
|
|
48
66
|
}
|
|
49
67
|
try {
|
|
@@ -59,6 +77,7 @@ export function getConfig() {
|
|
|
59
77
|
auto_apply_learning: raw.auto_apply_learning !== false, // default true
|
|
60
78
|
compact_tools: raw.compact_tools === true, // default false
|
|
61
79
|
transcripts: normalizeTranscripts(raw.transcripts),
|
|
80
|
+
lessons: normalizeLessons(raw.lessons),
|
|
62
81
|
};
|
|
63
82
|
}
|
|
64
83
|
catch {
|
|
@@ -68,6 +87,7 @@ export function getConfig() {
|
|
|
68
87
|
auto_apply_learning: true,
|
|
69
88
|
compact_tools: false,
|
|
70
89
|
transcripts: { ...DEFAULT_TRANSCRIPTS },
|
|
90
|
+
lessons: { ...DEFAULT_LESSONS },
|
|
71
91
|
};
|
|
72
92
|
}
|
|
73
93
|
}
|
|
@@ -81,8 +101,31 @@ export function setConfig(partial) {
|
|
|
81
101
|
...(partial.dailyTokenBudget ?? {}),
|
|
82
102
|
},
|
|
83
103
|
transcripts: partial.transcripts ?? current.transcripts,
|
|
104
|
+
lessons: partial.lessons ?? current.lessons,
|
|
84
105
|
};
|
|
85
106
|
mkdirSync(dirname(configPath()), { recursive: true });
|
|
86
107
|
writeFileSync(configPath(), JSON.stringify(next, null, 2), 'utf8');
|
|
87
108
|
}
|
|
109
|
+
/** Explicit v2 opt-in. No version upgrade can silently enable sharing. */
|
|
110
|
+
export function enableLessonsSharing() {
|
|
111
|
+
const lessons = {
|
|
112
|
+
enabled: true,
|
|
113
|
+
consent_version: LESSONS_CONSENT_VERSION,
|
|
114
|
+
consent_at: new Date().toISOString(),
|
|
115
|
+
cross_project: true,
|
|
116
|
+
cross_vendor: true,
|
|
117
|
+
};
|
|
118
|
+
setConfig({ lessons });
|
|
119
|
+
return lessons;
|
|
120
|
+
}
|
|
121
|
+
export function disableLessonsSharing() {
|
|
122
|
+
const current = getConfig().lessons;
|
|
123
|
+
setConfig({ lessons: { ...current, enabled: false, cross_project: false, cross_vendor: false } });
|
|
124
|
+
}
|
|
125
|
+
export function isLessonsSharingEnabled(config = getConfig().lessons) {
|
|
126
|
+
return config.enabled
|
|
127
|
+
&& config.consent_version === LESSONS_CONSENT_VERSION
|
|
128
|
+
&& config.cross_project
|
|
129
|
+
&& config.cross_vendor;
|
|
130
|
+
}
|
|
88
131
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/memory/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/memory/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AA0B7E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,OAAO,EAAE,KAAK;IACd,eAAe,EAAE,CAAC;IAClB,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,KAAK;IACpB,YAAY,EAAE,KAAK;CACpB,CAAC;AAqBF,gFA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EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACrE,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,oBAAoB;IAClC,MAAM,OAAO,GAAkB;QAC7B,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,uBAAuB;QACxC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,IAAI;KACnB,CAAC;IACF,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACvB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;AACpG,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,SAAwB,SAAS,EAAE,CAAC,OAAO;IACjF,OAAO,MAAM,CAAC,OAAO;WAChB,MAAM,CAAC,eAAe,KAAK,uBAAuB;WAClD,MAAM,CAAC,aAAa;WACpB,MAAM,CAAC,YAAY,CAAC;AAC3B,CAAC"}
|
|
@@ -19,6 +19,8 @@ export type DriftViolation = {
|
|
|
19
19
|
line: string;
|
|
20
20
|
matched_pattern: string;
|
|
21
21
|
};
|
|
22
|
+
export declare const MAX_PATTERN_LENGTH = 200;
|
|
23
|
+
export declare function validateForbiddenPatterns(patterns: string[]): string[];
|
|
22
24
|
export declare function addConstraint(input: {
|
|
23
25
|
rule: string;
|
|
24
26
|
forbidden_patterns: string[];
|
|
@@ -29,5 +31,36 @@ export declare function addConstraint(input: {
|
|
|
29
31
|
}): DecisionConstraint;
|
|
30
32
|
export declare function listConstraints(project_dir?: string, include_inactive?: boolean): DecisionConstraint[];
|
|
31
33
|
export declare function setConstraintActive(id: string, active: boolean): boolean;
|
|
32
|
-
export declare
|
|
34
|
+
export declare const MAX_LINE_CHARS = 2000;
|
|
35
|
+
export declare const CHECK_BUDGET_MS = 2000;
|
|
36
|
+
export declare function checkDiffAgainstConstraints(diff: string, project_dir?: string, budgetMs?: number): DriftViolation[];
|
|
37
|
+
export type InvitationSource = 'council' | 'adr';
|
|
38
|
+
export type InvitationAnswer = 'accepted' | 'declined';
|
|
39
|
+
export type ConstraintInvitation = {
|
|
40
|
+
id: string;
|
|
41
|
+
source_kind: InvitationSource;
|
|
42
|
+
source_id: string | null;
|
|
43
|
+
project_dir: string | null;
|
|
44
|
+
offered_at: string;
|
|
45
|
+
answer: InvitationAnswer | null;
|
|
46
|
+
answered_at: string | null;
|
|
47
|
+
constraint_id: string | null;
|
|
48
|
+
};
|
|
49
|
+
export declare function offerInvitation(input: {
|
|
50
|
+
source_kind: InvitationSource;
|
|
51
|
+
source_id?: string;
|
|
52
|
+
project_dir?: string;
|
|
53
|
+
}): ConstraintInvitation | null;
|
|
54
|
+
export declare function getInvitation(id: string): ConstraintInvitation | null;
|
|
55
|
+
export declare function answerInvitation(id: string, answer: InvitationAnswer, constraint_id?: string): 'recorded' | 'not_found' | 'already_answered';
|
|
56
|
+
export declare function invitationStats(): {
|
|
57
|
+
offered: number;
|
|
58
|
+
accepted: number;
|
|
59
|
+
declined: number;
|
|
60
|
+
unanswered: number;
|
|
61
|
+
};
|
|
62
|
+
export declare function invitationPayload(invitation_id: string): {
|
|
63
|
+
invitation_id: string;
|
|
64
|
+
instruction: string;
|
|
65
|
+
};
|
|
33
66
|
//# sourceMappingURL=decisions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decisions.d.ts","sourceRoot":"","sources":["../../src/memory/decisions.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM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,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAIF,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,oBAAoB,GAAG,IAAI,CAQ9B;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAGrE;AAID,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,gBAAgB,EACxB,aAAa,CAAC,EAAE,MAAM,GACrB,UAAU,GAAG,WAAW,GAAG,kBAAkB,CAM/C;AAGD,wBAAgB,eAAe,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAS7G;AAKD,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM;;;EAStD"}
|
package/dist/memory/decisions.js
CHANGED
|
@@ -29,7 +29,83 @@ function normalizeDir(dir) {
|
|
|
29
29
|
return null;
|
|
30
30
|
return dir.replace(/\\/g, '/').replace(/\/+$/, '').toLowerCase();
|
|
31
31
|
}
|
|
32
|
+
// ─── Pattern safety ───────────────────────────────────────────────────────────
|
|
33
|
+
// Constraints run inside veto_diff_review and veto_ci_gate, so one bad pattern
|
|
34
|
+
// must never wedge them. addConstraint is the only way into the table, and it
|
|
35
|
+
// refuses a pattern that fails these checks; a pattern stored before they
|
|
36
|
+
// existed degrades to a literal substring match at check time instead.
|
|
37
|
+
export const MAX_PATTERN_LENGTH = 200;
|
|
38
|
+
// True when a repeated group contains a repeat of its own — (a+)+, (\w*)*,
|
|
39
|
+
// ((ab)+c){2,} — the shape behind catastrophic backtracking. Deliberately
|
|
40
|
+
// over-approximate: refusing a safe pattern costs the user one rewrite,
|
|
41
|
+
// accepting a bad one can hang every review that follows.
|
|
42
|
+
function hasNestedQuantifier(src) {
|
|
43
|
+
const groups = []; // per open group: does its body repeat anything?
|
|
44
|
+
let closedGroupRepeats = false; // the group that closed on the previous character
|
|
45
|
+
let inClass = false;
|
|
46
|
+
for (let i = 0; i < src.length; i++) {
|
|
47
|
+
const ch = src[i];
|
|
48
|
+
const afterRepeatingGroup = closedGroupRepeats;
|
|
49
|
+
closedGroupRepeats = false;
|
|
50
|
+
if (ch === '\\') {
|
|
51
|
+
i++;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (inClass) {
|
|
55
|
+
if (ch === ']')
|
|
56
|
+
inClass = false;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (ch === '[') {
|
|
60
|
+
inClass = true;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (ch === '(') {
|
|
64
|
+
groups.push(false);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (ch === ')') {
|
|
68
|
+
closedGroupRepeats = groups.pop() ?? false;
|
|
69
|
+
if (closedGroupRepeats && groups.length > 0)
|
|
70
|
+
groups[groups.length - 1] = true;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (ch === '+' || ch === '*' || (ch === '{' && /^\{\d+(,\d*)?\}/.test(src.slice(i)))) {
|
|
74
|
+
if (afterRepeatingGroup)
|
|
75
|
+
return true;
|
|
76
|
+
if (groups.length > 0)
|
|
77
|
+
groups[groups.length - 1] = true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
function compiles(pattern) {
|
|
83
|
+
try {
|
|
84
|
+
new RegExp(pattern, 'i');
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Why each pattern is unsafe to run against every future diff; [] means all are safe.
|
|
92
|
+
// A pattern that does not compile is not a problem: it is matched as plain text.
|
|
93
|
+
export function validateForbiddenPatterns(patterns) {
|
|
94
|
+
const problems = [];
|
|
95
|
+
for (const p of patterns) {
|
|
96
|
+
if (p.length > MAX_PATTERN_LENGTH) {
|
|
97
|
+
problems.push(`"${p.slice(0, 40)}…" is ${p.length} characters; the limit is ${MAX_PATTERN_LENGTH}.`);
|
|
98
|
+
}
|
|
99
|
+
else if (compiles(p) && hasNestedQuantifier(p)) {
|
|
100
|
+
problems.push(`"${p}" repeats a group that already repeats, which can hang diff review on some inputs. Drop the outer repeat — "(a+)+" matches the same lines as "a+".`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return problems;
|
|
104
|
+
}
|
|
32
105
|
export function addConstraint(input) {
|
|
106
|
+
const problems = validateForbiddenPatterns(input.forbidden_patterns);
|
|
107
|
+
if (problems.length > 0)
|
|
108
|
+
throw new Error(`Unsafe forbidden_patterns: ${problems.join(' ')}`);
|
|
33
109
|
const db = getDb();
|
|
34
110
|
const id = randomUUID();
|
|
35
111
|
const created_at = new Date().toISOString();
|
|
@@ -76,23 +152,50 @@ function scopeMatches(scope, file) {
|
|
|
76
152
|
return true;
|
|
77
153
|
}
|
|
78
154
|
}
|
|
79
|
-
// A pattern is a case-insensitive regex
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
155
|
+
// A pattern is a case-insensitive regex. One that doesn't compile — or that
|
|
156
|
+
// validateForbiddenPatterns would refuse, e.g. stored before those checks
|
|
157
|
+
// existed — degrades to a case-insensitive substring match, so user input can
|
|
158
|
+
// never break or hang the check.
|
|
159
|
+
function toMatcher(pattern) {
|
|
160
|
+
if (validateForbiddenPatterns([pattern]).length === 0) {
|
|
161
|
+
try {
|
|
162
|
+
const re = new RegExp(pattern, 'i');
|
|
163
|
+
return line => re.test(line);
|
|
164
|
+
}
|
|
165
|
+
catch { /* not a regex */ }
|
|
87
166
|
}
|
|
167
|
+
const needle = pattern.toLowerCase();
|
|
168
|
+
return line => line.toLowerCase().includes(needle);
|
|
88
169
|
}
|
|
89
|
-
|
|
90
|
-
|
|
170
|
+
// A check must finish. Only the first MAX_LINE_CHARS of each added line are
|
|
171
|
+
// tested (a minified bundle can put 100KB on one line), and once the check has
|
|
172
|
+
// run for budgetMs it stops and reports a warning — so a slow rule degrades
|
|
173
|
+
// review and CI to a warning instead of wedging them.
|
|
174
|
+
export const MAX_LINE_CHARS = 2_000;
|
|
175
|
+
export const CHECK_BUDGET_MS = 2_000;
|
|
176
|
+
export function checkDiffAgainstConstraints(diff, project_dir, budgetMs = CHECK_BUDGET_MS) {
|
|
177
|
+
const constraints = listConstraints(project_dir).map(c => ({
|
|
178
|
+
...c,
|
|
179
|
+
matchers: c.forbidden_patterns.filter(Boolean).map(pattern => ({ pattern, test: toMatcher(pattern) })),
|
|
180
|
+
}));
|
|
91
181
|
if (constraints.length === 0 || !diff.trim())
|
|
92
182
|
return [];
|
|
183
|
+
const deadline = Date.now() + budgetMs;
|
|
93
184
|
const violations = [];
|
|
94
185
|
let currentFile = '';
|
|
95
186
|
for (const raw of diff.split('\n')) {
|
|
187
|
+
if (Date.now() >= deadline) {
|
|
188
|
+
violations.push({
|
|
189
|
+
constraint_id: 'veto:check-budget',
|
|
190
|
+
rule: `Decision check stopped after ${budgetMs}ms; the rest of this diff was not checked.`,
|
|
191
|
+
why: 'A constraint is too slow for this diff. Find it with veto_decisions list, then simplify or disable it.',
|
|
192
|
+
severity: 'warn',
|
|
193
|
+
file: currentFile || '(diff)',
|
|
194
|
+
line: '',
|
|
195
|
+
matched_pattern: '',
|
|
196
|
+
});
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
96
199
|
const fileHeader = raw.match(/^\+\+\+ b\/(.+)$/);
|
|
97
200
|
if (fileHeader) {
|
|
98
201
|
currentFile = fileHeader[1];
|
|
@@ -100,12 +203,12 @@ export function checkDiffAgainstConstraints(diff, project_dir) {
|
|
|
100
203
|
}
|
|
101
204
|
if (!raw.startsWith('+') || raw.startsWith('+++'))
|
|
102
205
|
continue;
|
|
103
|
-
const line = raw.slice(1);
|
|
206
|
+
const line = raw.slice(1, 1 + MAX_LINE_CHARS);
|
|
104
207
|
for (const c of constraints) {
|
|
105
208
|
if (!scopeMatches(c.file_scope, currentFile))
|
|
106
209
|
continue;
|
|
107
|
-
for (const pattern of c.
|
|
108
|
-
if (
|
|
210
|
+
for (const { pattern, test } of c.matchers) {
|
|
211
|
+
if (test(line)) {
|
|
109
212
|
violations.push({
|
|
110
213
|
constraint_id: c.id,
|
|
111
214
|
rule: c.rule,
|
|
@@ -122,4 +225,46 @@ export function checkDiffAgainstConstraints(diff, project_dir) {
|
|
|
122
225
|
}
|
|
123
226
|
return violations;
|
|
124
227
|
}
|
|
228
|
+
// Records an offer, or returns null when this source (a council outcome) has
|
|
229
|
+
// already been offered — one question per verdict, however many tools see it.
|
|
230
|
+
export function offerInvitation(input) {
|
|
231
|
+
const db = getDb();
|
|
232
|
+
const id = randomUUID();
|
|
233
|
+
const res = db.prepare(`INSERT OR IGNORE INTO constraint_invitations (id, source_kind, source_id, project_dir, offered_at)
|
|
234
|
+
VALUES (?, ?, ?, ?, ?)`).run(id, input.source_kind, input.source_id ?? null, normalizeDir(input.project_dir), new Date().toISOString());
|
|
235
|
+
return res.changes > 0 ? getInvitation(id) : null;
|
|
236
|
+
}
|
|
237
|
+
export function getInvitation(id) {
|
|
238
|
+
const row = getDb().prepare('SELECT * FROM constraint_invitations WHERE id = ?').get(id);
|
|
239
|
+
return row ?? null;
|
|
240
|
+
}
|
|
241
|
+
// An invitation is answered once; a second answer is refused so the counts
|
|
242
|
+
// cannot drift from what the user actually said.
|
|
243
|
+
export function answerInvitation(id, answer, constraint_id) {
|
|
244
|
+
const res = getDb().prepare('UPDATE constraint_invitations SET answer = ?, answered_at = ?, constraint_id = ? WHERE id = ? AND answer IS NULL').run(answer, new Date().toISOString(), constraint_id ?? null, id);
|
|
245
|
+
if (res.changes > 0)
|
|
246
|
+
return 'recorded';
|
|
247
|
+
return getInvitation(id) ? 'already_answered' : 'not_found';
|
|
248
|
+
}
|
|
249
|
+
// Across all projects: the question is whether anyone ever says yes, not where.
|
|
250
|
+
export function invitationStats() {
|
|
251
|
+
const r = getDb().prepare(`SELECT COUNT(*) AS offered,
|
|
252
|
+
COALESCE(SUM(answer = 'accepted'), 0) AS accepted,
|
|
253
|
+
COALESCE(SUM(answer = 'declined'), 0) AS declined,
|
|
254
|
+
COALESCE(SUM(answer IS NULL), 0) AS unanswered
|
|
255
|
+
FROM constraint_invitations`).get();
|
|
256
|
+
return { offered: r.offered, accepted: r.accepted, declined: r.declined, unanswered: r.unanswered };
|
|
257
|
+
}
|
|
258
|
+
// The text a tool result carries to the host AI. Fixed wording, no derived
|
|
259
|
+
// content: the rule is written in the user's words when they say yes, so what
|
|
260
|
+
// ends up enforced is text the user authored or confirmed.
|
|
261
|
+
export function invitationPayload(invitation_id) {
|
|
262
|
+
return {
|
|
263
|
+
invitation_id,
|
|
264
|
+
instruction: 'Ask the user once, in one line, whether this verdict should become an enforceable rule: Veto would then flag any future diff that breaks it. ' +
|
|
265
|
+
'Ask only if the verdict settles a lasting choice (e.g. "we use Postgres, not Mongo"); if it settles nothing lasting, skip the question without mentioning it. ' +
|
|
266
|
+
'If they say yes, call veto_decisions with { action: "add", invitation_id, rule (in the user\'s words), forbidden_patterns, why }. ' +
|
|
267
|
+
'If they say no, call veto_decisions with { action: "decline", invitation_id }. Never raise it again for this verdict.',
|
|
268
|
+
};
|
|
269
|
+
}
|
|
125
270
|
//# sourceMappingURL=decisions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decisions.js","sourceRoot":"","sources":["../../src/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