@pedrocivita/tocket 2.6.3 → 2.6.5

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 (51) hide show
  1. package/README.md +29 -1
  2. package/dist/commands/doctor.cmd.js +3 -3
  3. package/dist/commands/doctor.cmd.js.map +1 -1
  4. package/dist/commands/handoff.cmd.js +51 -1
  5. package/dist/commands/handoff.cmd.js.map +1 -1
  6. package/dist/commands/init.cmd.js +3 -2
  7. package/dist/commands/init.cmd.js.map +1 -1
  8. package/dist/commands/packs.cmd.d.ts +2 -0
  9. package/dist/commands/packs.cmd.js +58 -0
  10. package/dist/commands/packs.cmd.js.map +1 -0
  11. package/dist/commands/suite.cmd.js +9 -8
  12. package/dist/commands/suite.cmd.js.map +1 -1
  13. package/dist/eval/triage-eval.js +2 -1
  14. package/dist/eval/triage-eval.js.map +1 -1
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/templates/memory-bank.js +12 -0
  18. package/dist/templates/memory-bank.js.map +1 -1
  19. package/dist/tests/agents.test.js +15 -1
  20. package/dist/tests/agents.test.js.map +1 -1
  21. package/dist/tests/attention.test.d.ts +1 -0
  22. package/dist/tests/attention.test.js +268 -0
  23. package/dist/tests/attention.test.js.map +1 -0
  24. package/dist/tests/context.test.js +10 -1
  25. package/dist/tests/context.test.js.map +1 -1
  26. package/dist/tests/decide.test.js +5 -5
  27. package/dist/tests/decide.test.js.map +1 -1
  28. package/dist/tests/doctor.test.js +2 -1
  29. package/dist/tests/doctor.test.js.map +1 -1
  30. package/dist/tests/helpers.d.ts +2 -0
  31. package/dist/tests/helpers.js +5 -1
  32. package/dist/tests/helpers.js.map +1 -1
  33. package/dist/tests/helpers.test.js +8 -1
  34. package/dist/tests/helpers.test.js.map +1 -1
  35. package/dist/tests/init.test.js +51 -22
  36. package/dist/tests/init.test.js.map +1 -1
  37. package/dist/tests/memory-bank.test.js +5 -0
  38. package/dist/tests/memory-bank.test.js.map +1 -1
  39. package/dist/utils/agents.d.ts +2 -0
  40. package/dist/utils/agents.js +12 -2
  41. package/dist/utils/agents.js.map +1 -1
  42. package/dist/utils/attention.d.ts +155 -0
  43. package/dist/utils/attention.js +695 -0
  44. package/dist/utils/attention.js.map +1 -0
  45. package/dist/utils/context.d.ts +2 -0
  46. package/dist/utils/context.js +21 -0
  47. package/dist/utils/context.js.map +1 -1
  48. package/dist/utils/decide.d.ts +1 -1
  49. package/dist/utils/decide.js +2 -11
  50. package/dist/utils/decide.js.map +1 -1
  51. package/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ /** Meta-attention: Jev (or the stub) scores context chunks and gotcha packs. */
2
+ import { type DecideMode, type DecideSemantics } from "./decide.js";
3
+ export declare const ATTENTION_SCHEMA = "tocket.attention/v0";
4
+ export declare const ATTENTION_DIR = ".context/attention";
5
+ export declare const HANDOFFS_DIR = ".context/handoffs";
6
+ export declare const GOTCHAS_DIR = ".context/gotchas";
7
+ export declare const ACTIVE_PACKS_REL = ".context/active/packs.md";
8
+ export declare const DEFAULT_THRESHOLD = 0.5;
9
+ export declare const SCORE_MIN = 0;
10
+ export declare const SCORE_MAX = 1;
11
+ export declare const MAX_CHUNK_CHARS = 700;
12
+ export declare const DECISION_CHUNK_LIMIT = 5;
13
+ export declare class AttentionError extends Error {
14
+ constructor(message: string);
15
+ }
16
+ export type AttentionSource = "stub" | "jev";
17
+ export type ChunkIntent = "relevant" | "load";
18
+ export interface ContextChunk {
19
+ id: string;
20
+ label: string;
21
+ source: string;
22
+ heading: string;
23
+ text: string;
24
+ intent: ChunkIntent;
25
+ }
26
+ export interface ScoredChunk extends ContextChunk {
27
+ noul: number;
28
+ score: number;
29
+ kept: boolean;
30
+ rationale: string;
31
+ }
32
+ export interface AttentionChunk {
33
+ id: string;
34
+ label: string;
35
+ source: string;
36
+ intent: ChunkIntent;
37
+ noul: number;
38
+ score: number;
39
+ kept: boolean;
40
+ rationale: string;
41
+ preview: string;
42
+ }
43
+ export interface AttentionRecord {
44
+ schema: typeof ATTENTION_SCHEMA;
45
+ id: string;
46
+ generated_at: string;
47
+ query: string;
48
+ threshold: number;
49
+ source: AttentionSource;
50
+ mode: DecideMode;
51
+ semantics: DecideSemantics;
52
+ model: string;
53
+ executes: false;
54
+ kind: "handoff" | "packs";
55
+ chunks: AttentionChunk[];
56
+ packs?: AttentionChunk[];
57
+ }
58
+ export interface JudgeResult {
59
+ chunks: ScoredChunk[];
60
+ source: AttentionSource;
61
+ mode: DecideMode;
62
+ semantics: DecideSemantics;
63
+ model: string;
64
+ }
65
+ export declare function parseThreshold(value?: string): number;
66
+ /** Kept when Noul >= threshold OR Score >= the same fraction of the score range (mid at 0.5). */
67
+ export declare function chunkKept(noul: number, score: number, threshold: number, scoreMin?: number, scoreMax?: number): boolean;
68
+ export declare function relevanceTokens(text: string): string[];
69
+ /** Deterministic overlap. No network. Unrelated chunks stay under the default 0.5 cutoff. */
70
+ export declare function stubRelevance(query: string, chunkText: string): {
71
+ noul: number;
72
+ score: number;
73
+ rationale: string;
74
+ };
75
+ /** Split a markdown file into small labeled chunks (## / ###, then paragraphs). */
76
+ export declare function splitMarkdown(source: string, markdown: string, intent?: ChunkIntent, maxChars?: number): ContextChunk[];
77
+ export declare function collectContextChunks(cwd: string): ContextChunk[];
78
+ export declare function collectGotchaPacks(cwd: string): ContextChunk[];
79
+ export declare function queryFromFocus(content: string): string;
80
+ export declare function judgeChunks(options: {
81
+ query: string;
82
+ chunks: ContextChunk[];
83
+ threshold: number;
84
+ dryRun?: boolean;
85
+ shadow?: boolean;
86
+ apiKey?: string | null;
87
+ fetchImpl?: typeof fetch;
88
+ }): Promise<JudgeResult>;
89
+ export declare function attentionReadme(): string;
90
+ export declare function attentionOutputPath(cwd: string, generatedAt: string, id: string): string;
91
+ export declare function handoffOutputPath(cwd: string, generatedAt: string, id: string): string;
92
+ export declare function activePacksPath(cwd: string): string;
93
+ export declare function buildAwareHandoffMarkdown(input: {
94
+ projectName: string;
95
+ query: string;
96
+ focus: string;
97
+ branch: string;
98
+ recentCommits: string[];
99
+ modifiedFiles: string[];
100
+ context: ScoredChunk[];
101
+ packs: ScoredChunk[];
102
+ threshold: number;
103
+ source: AttentionSource;
104
+ mode: DecideMode;
105
+ attentionRel: string;
106
+ }): string;
107
+ export declare function buildPacksMarkdown(input: {
108
+ query: string;
109
+ packs: ScoredChunk[];
110
+ threshold: number;
111
+ source: AttentionSource;
112
+ mode: DecideMode;
113
+ attentionRel: string;
114
+ }): string;
115
+ export declare function formatAwareSummary(record: AttentionRecord, handoffRel: string, attentionRel: string): string;
116
+ export declare function formatPacksSummary(record: AttentionRecord, packsRel: string): string;
117
+ export interface AwareHandoffInput {
118
+ cwd: string;
119
+ query?: string;
120
+ focus?: string;
121
+ projectName?: string;
122
+ branch?: string;
123
+ recentCommits?: string[];
124
+ modifiedFiles?: string[];
125
+ threshold?: number;
126
+ dryRun?: boolean;
127
+ shadow?: boolean;
128
+ apiKey?: string | null;
129
+ id?: string;
130
+ now?: () => string;
131
+ fetchImpl?: typeof fetch;
132
+ }
133
+ export declare function runAwareHandoff(options: AwareHandoffInput): Promise<{
134
+ markdown: string;
135
+ record: AttentionRecord;
136
+ attentionPath: string;
137
+ handoffPath: string;
138
+ }>;
139
+ export declare function runPacksLoad(options: {
140
+ cwd: string;
141
+ query?: string;
142
+ focus?: string;
143
+ threshold?: number;
144
+ dryRun?: boolean;
145
+ shadow?: boolean;
146
+ apiKey?: string | null;
147
+ id?: string;
148
+ now?: () => string;
149
+ fetchImpl?: typeof fetch;
150
+ }): Promise<{
151
+ markdown: string;
152
+ record: AttentionRecord;
153
+ attentionPath: string;
154
+ packsPath: string;
155
+ }>;