@pedrocivita/tocket 2.4.0 → 2.6.3
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 +229 -18
- package/dist/commands/agents-md.cmd.d.ts +2 -0
- package/dist/commands/agents-md.cmd.js +166 -0
- package/dist/commands/agents-md.cmd.js.map +1 -0
- package/dist/commands/dashboard.js +2 -0
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/decide.cmd.d.ts +2 -0
- package/dist/commands/decide.cmd.js +70 -0
- package/dist/commands/decide.cmd.js.map +1 -0
- package/dist/commands/diff.cmd.d.ts +15 -0
- package/dist/commands/diff.cmd.js +106 -0
- package/dist/commands/diff.cmd.js.map +1 -0
- package/dist/commands/doctor.cmd.d.ts +13 -0
- package/dist/commands/doctor.cmd.js +159 -11
- package/dist/commands/doctor.cmd.js.map +1 -1
- package/dist/commands/eject.cmd.d.ts +1 -1
- package/dist/commands/eject.cmd.js +3 -1
- package/dist/commands/eject.cmd.js.map +1 -1
- package/dist/commands/generate.cmd.js +7 -1
- package/dist/commands/generate.cmd.js.map +1 -1
- package/dist/commands/handoff.cmd.d.ts +14 -0
- package/dist/commands/handoff.cmd.js +131 -0
- package/dist/commands/handoff.cmd.js.map +1 -0
- package/dist/commands/init.cmd.js +64 -11
- package/dist/commands/init.cmd.js.map +1 -1
- package/dist/commands/scaffold.cmd.d.ts +2 -0
- package/dist/commands/scaffold.cmd.js +118 -0
- package/dist/commands/scaffold.cmd.js.map +1 -0
- package/dist/commands/suite.cmd.d.ts +2 -0
- package/dist/commands/suite.cmd.js +386 -0
- package/dist/commands/suite.cmd.js.map +1 -0
- package/dist/commands/validate.cmd.js +1 -0
- package/dist/commands/validate.cmd.js.map +1 -1
- package/dist/commands/work.cmd.d.ts +2 -0
- package/dist/commands/work.cmd.js +48 -0
- package/dist/commands/work.cmd.js.map +1 -0
- package/dist/eval/decide-eval.d.ts +28 -0
- package/dist/eval/decide-eval.js +34 -0
- package/dist/eval/decide-eval.js.map +1 -0
- package/dist/eval/triage-eval.d.ts +46 -0
- package/dist/eval/triage-eval.js +174 -0
- package/dist/eval/triage-eval.js.map +1 -0
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.js +360 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/templates/memory-bank.d.ts +11 -0
- package/dist/templates/memory-bank.js +456 -329
- package/dist/templates/memory-bank.js.map +1 -1
- package/dist/tests/agents.test.js +59 -1
- package/dist/tests/agents.test.js.map +1 -1
- package/dist/tests/decide.test.d.ts +1 -0
- package/dist/tests/decide.test.js +483 -0
- package/dist/tests/decide.test.js.map +1 -0
- package/dist/tests/diff.test.d.ts +1 -0
- package/dist/tests/diff.test.js +119 -0
- package/dist/tests/diff.test.js.map +1 -0
- package/dist/tests/doctor.test.js +73 -1
- package/dist/tests/doctor.test.js.map +1 -1
- package/dist/tests/eject.test.js +3 -0
- package/dist/tests/eject.test.js.map +1 -1
- package/dist/tests/git.test.js +32 -1
- package/dist/tests/git.test.js.map +1 -1
- package/dist/tests/handoff.test.d.ts +1 -0
- package/dist/tests/handoff.test.js +97 -0
- package/dist/tests/handoff.test.js.map +1 -0
- package/dist/tests/helpers.d.ts +4 -0
- package/dist/tests/helpers.js +9 -0
- package/dist/tests/helpers.js.map +1 -0
- package/dist/tests/helpers.test.d.ts +1 -0
- package/dist/tests/helpers.test.js +16 -0
- package/dist/tests/helpers.test.js.map +1 -0
- package/dist/tests/init.test.js +53 -2
- package/dist/tests/init.test.js.map +1 -1
- package/dist/tests/loop.test.d.ts +1 -0
- package/dist/tests/loop.test.js +153 -0
- package/dist/tests/loop.test.js.map +1 -0
- package/dist/tests/memory-bank.test.js +53 -1
- package/dist/tests/memory-bank.test.js.map +1 -1
- package/dist/tests/suite.test.d.ts +1 -0
- package/dist/tests/suite.test.js +199 -0
- package/dist/tests/suite.test.js.map +1 -0
- package/dist/tests/triage.test.d.ts +1 -0
- package/dist/tests/triage.test.js +152 -0
- package/dist/tests/triage.test.js.map +1 -0
- package/dist/tests/work.test.d.ts +1 -0
- package/dist/tests/work.test.js +276 -0
- package/dist/tests/work.test.js.map +1 -0
- package/dist/tests/xml.test.d.ts +1 -0
- package/dist/tests/xml.test.js +139 -0
- package/dist/tests/xml.test.js.map +1 -0
- package/dist/utils/agents.d.ts +23 -0
- package/dist/utils/agents.js +82 -0
- package/dist/utils/agents.js.map +1 -1
- package/dist/utils/appmaps.d.ts +65 -0
- package/dist/utils/appmaps.js +280 -0
- package/dist/utils/appmaps.js.map +1 -0
- package/dist/utils/decide.d.ts +178 -0
- package/dist/utils/decide.js +623 -0
- package/dist/utils/decide.js.map +1 -0
- package/dist/utils/git.d.ts +2 -0
- package/dist/utils/git.js +35 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/jev.d.ts +83 -0
- package/dist/utils/jev.js +190 -0
- package/dist/utils/jev.js.map +1 -0
- package/dist/utils/triage.d.ts +87 -0
- package/dist/utils/triage.js +241 -0
- package/dist/utils/triage.js.map +1 -0
- package/dist/utils/work.d.ts +72 -0
- package/dist/utils/work.js +225 -0
- package/dist/utils/work.js.map +1 -0
- package/dist/utils/xml.d.ts +22 -0
- package/dist/utils/xml.js +54 -0
- package/dist/utils/xml.js.map +1 -0
- package/package.json +53 -50
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/** Generic Choice/Noul decisions. File-first; writes only under `.context/decisions/`. */
|
|
2
|
+
import { type JevQuestion } from "./jev.js";
|
|
3
|
+
export declare const DECIDE_SCHEMA = "tocket.decide/v0";
|
|
4
|
+
export declare const DECISIONS_DIR = ".context/decisions";
|
|
5
|
+
export declare const DECISIONS_README = "README.md";
|
|
6
|
+
export declare const STUB_MODEL = "stub-v0";
|
|
7
|
+
/** Codila chief.py default: only route research/write at or above this confidence. */
|
|
8
|
+
export declare const DEFAULT_CONFIDENCE_THRESHOLD = 0.85;
|
|
9
|
+
export declare const QUEUE_DESTINATIONS: readonly ["research", "write", "review"];
|
|
10
|
+
export declare const HIGH_CONFIDENCE_ROUTES: readonly ["research", "write"];
|
|
11
|
+
export declare const BOUNDED_FORKS: readonly ["agent", "model", "tool", "action", "human"];
|
|
12
|
+
export declare const DECIDE_LOOP = "state-questions-action-verify";
|
|
13
|
+
export declare const RANK_WIDE_MIN = 5;
|
|
14
|
+
/** Well-known Choice names for the file-first tool-risk gate (AutoMode pattern, not LangChain APIs). */
|
|
15
|
+
export declare const TOOL_GATE_NAMES: readonly ["tool_gate", "action_gate"];
|
|
16
|
+
export declare const TOOL_GATE_OPTIONS: readonly ["allow", "block", "ask"];
|
|
17
|
+
export type QueueDestination = (typeof QUEUE_DESTINATIONS)[number];
|
|
18
|
+
export type BoundedFork = (typeof BOUNDED_FORKS)[number];
|
|
19
|
+
export type DecideMode = "active" | "shadow" | "dry-run";
|
|
20
|
+
export type DecideSource = "jev" | "stub";
|
|
21
|
+
export type DecideSemantics = "handoff" | "log-only";
|
|
22
|
+
export type DecideHandoffStatus = "queued" | "logged";
|
|
23
|
+
export type DecidePrimitive = "choice" | "noul" | "score";
|
|
24
|
+
export type ToolGate = (typeof TOOL_GATE_OPTIONS)[number];
|
|
25
|
+
export type ToolGateName = (typeof TOOL_GATE_NAMES)[number];
|
|
26
|
+
export interface DecideChoiceSpec {
|
|
27
|
+
name: string;
|
|
28
|
+
options: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface DecideNoulSpec {
|
|
31
|
+
name: string;
|
|
32
|
+
}
|
|
33
|
+
export interface DecideScoreSpec {
|
|
34
|
+
name: string;
|
|
35
|
+
min: number;
|
|
36
|
+
max: number;
|
|
37
|
+
}
|
|
38
|
+
export interface DecideChoiceAnswer {
|
|
39
|
+
type: "choice";
|
|
40
|
+
choice: string;
|
|
41
|
+
confidence: number;
|
|
42
|
+
rationale: string;
|
|
43
|
+
probabilities?: Record<string, number>;
|
|
44
|
+
}
|
|
45
|
+
export interface DecideNoulAnswer {
|
|
46
|
+
type: "noul";
|
|
47
|
+
noul: number;
|
|
48
|
+
confidence: number;
|
|
49
|
+
rationale: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DecideScoreAnswer {
|
|
52
|
+
type: "score";
|
|
53
|
+
score: number;
|
|
54
|
+
confidence: number;
|
|
55
|
+
rationale: string;
|
|
56
|
+
}
|
|
57
|
+
export type DecideAnswer = DecideChoiceAnswer | DecideNoulAnswer | DecideScoreAnswer;
|
|
58
|
+
export interface DecideRecord {
|
|
59
|
+
schema: typeof DECIDE_SCHEMA;
|
|
60
|
+
id: string;
|
|
61
|
+
generated_at: string;
|
|
62
|
+
mode: DecideMode;
|
|
63
|
+
source: DecideSource;
|
|
64
|
+
model: string;
|
|
65
|
+
/** Codila-style router: selected option (first Choice). */
|
|
66
|
+
choice: string | null;
|
|
67
|
+
confidence: number;
|
|
68
|
+
/** Queue hint: research | write | review. Low-confidence research/write becomes review. */
|
|
69
|
+
destination: QueueDestination;
|
|
70
|
+
gated: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Tool-risk gate from a `tool_gate` / `action_gate` Choice (`allow|block|ask`).
|
|
73
|
+
* Null when the handoff has no gate question. Independent of Codila `gated`.
|
|
74
|
+
*/
|
|
75
|
+
tool_gate: ToolGate | null;
|
|
76
|
+
confidence_threshold: number;
|
|
77
|
+
/** handoff = workers may consume; log-only = shadow/dry-run (Tocket does not run workers). */
|
|
78
|
+
semantics: DecideSemantics;
|
|
79
|
+
status: DecideHandoffStatus;
|
|
80
|
+
/** Always false: Jev decides; LLMs create; agents act. This CLI only writes a file. */
|
|
81
|
+
executes: false;
|
|
82
|
+
loop: typeof DECIDE_LOOP;
|
|
83
|
+
fork: BoundedFork;
|
|
84
|
+
primitives: DecidePrimitive[];
|
|
85
|
+
batched: boolean;
|
|
86
|
+
rank_wide: boolean;
|
|
87
|
+
narrow: string | null;
|
|
88
|
+
state_summary: string;
|
|
89
|
+
state: unknown;
|
|
90
|
+
questions: Record<string, JevQuestion>;
|
|
91
|
+
answers: Record<string, DecideAnswer>;
|
|
92
|
+
}
|
|
93
|
+
export interface RunDecideOptions {
|
|
94
|
+
cwd: string;
|
|
95
|
+
state?: string;
|
|
96
|
+
fromPath?: string;
|
|
97
|
+
choices?: string[];
|
|
98
|
+
nouls?: string[];
|
|
99
|
+
scores?: string[];
|
|
100
|
+
fork?: string;
|
|
101
|
+
dryRun?: boolean;
|
|
102
|
+
shadow?: boolean;
|
|
103
|
+
id?: string;
|
|
104
|
+
confidenceThreshold?: number;
|
|
105
|
+
apiKey?: string | null;
|
|
106
|
+
now?: () => string;
|
|
107
|
+
fetchImpl?: typeof fetch;
|
|
108
|
+
}
|
|
109
|
+
export declare class DecideError extends Error {
|
|
110
|
+
constructor(message: string);
|
|
111
|
+
}
|
|
112
|
+
export declare function parseChoiceSpec(spec: string): DecideChoiceSpec;
|
|
113
|
+
export declare function parseNoulSpec(spec: string): DecideNoulSpec;
|
|
114
|
+
export declare function parseScoreSpec(spec: string): DecideScoreSpec;
|
|
115
|
+
export declare function parseFork(raw?: string): BoundedFork;
|
|
116
|
+
export declare function choiceCriterion(option: string): string;
|
|
117
|
+
export declare function isQueueDestination(value: string): value is QueueDestination;
|
|
118
|
+
export declare function isHighConfidenceRoute(value: string): boolean;
|
|
119
|
+
export declare function isToolGateName(name: string): boolean;
|
|
120
|
+
export declare function isToolGate(value: string | null | undefined): value is ToolGate;
|
|
121
|
+
export declare function parseToolGate(value: unknown): ToolGate | null;
|
|
122
|
+
/** Read a well-known `tool_gate` / `action_gate` Choice from answers. */
|
|
123
|
+
export declare function extractToolGate(answers: Record<string, DecideAnswer>): ToolGate | null;
|
|
124
|
+
export declare function resolveRecordToolGate(record: {
|
|
125
|
+
tool_gate?: ToolGate | null;
|
|
126
|
+
answers?: Record<string, DecideAnswer>;
|
|
127
|
+
}): ToolGate | null;
|
|
128
|
+
export declare function toolGateRefusesApply(gate: ToolGate | null): boolean;
|
|
129
|
+
export declare function parseConfidenceThreshold(raw?: string | number): number;
|
|
130
|
+
export declare function primaryChoice(answers: Record<string, DecideAnswer>): {
|
|
131
|
+
choice: string | null;
|
|
132
|
+
confidence: number;
|
|
133
|
+
};
|
|
134
|
+
/** Codila gate: research/write only when confidence >= threshold; otherwise review. */
|
|
135
|
+
export declare function resolveDestination(choice: string | null, confidence: number, threshold?: number, fork?: BoundedFork): {
|
|
136
|
+
destination: QueueDestination;
|
|
137
|
+
gated: boolean;
|
|
138
|
+
};
|
|
139
|
+
export declare function resolveSemantics(mode: DecideMode): {
|
|
140
|
+
semantics: DecideSemantics;
|
|
141
|
+
status: DecideHandoffStatus;
|
|
142
|
+
};
|
|
143
|
+
export declare function slugId(value: string): string;
|
|
144
|
+
export declare function fileTimestamp(iso: string): string;
|
|
145
|
+
export declare function summarizeState(state: unknown): string;
|
|
146
|
+
export declare function stateBlob(state: unknown): string;
|
|
147
|
+
export declare function parseStateInput(raw: string): unknown;
|
|
148
|
+
export declare function loadState(options: {
|
|
149
|
+
state?: string;
|
|
150
|
+
fromPath?: string;
|
|
151
|
+
}): unknown;
|
|
152
|
+
export declare function buildQuestions(choices: DecideChoiceSpec[], nouls: DecideNoulSpec[], scores?: DecideScoreSpec[]): Record<string, JevQuestion>;
|
|
153
|
+
export declare function stubChoice(name: string, options: string[], state: unknown): DecideChoiceAnswer;
|
|
154
|
+
export declare function stubNoul(_name: string, state: unknown): DecideNoulAnswer;
|
|
155
|
+
export declare function stubScore(name: string, min: number, max: number, state: unknown): DecideScoreAnswer;
|
|
156
|
+
export declare function stubAnswers(questions: Record<string, JevQuestion>, state: unknown): Record<string, DecideAnswer>;
|
|
157
|
+
export declare function isInsideContext(cwd: string, targetPath: string): boolean;
|
|
158
|
+
export declare function decisionOutputPath(cwd: string, generatedAt: string, id: string, destination?: QueueDestination): string;
|
|
159
|
+
export declare function defaultDecisionId(choices: DecideChoiceSpec[], nouls: DecideNoulSpec[], scores?: DecideScoreSpec[]): string;
|
|
160
|
+
export declare function listPrimitives(questions: Record<string, JevQuestion>): DecidePrimitive[];
|
|
161
|
+
export declare function choiceOptionCount(questions: Record<string, JevQuestion>): number;
|
|
162
|
+
export declare function resolveDecideMode(options: {
|
|
163
|
+
dryRun?: boolean;
|
|
164
|
+
shadow?: boolean;
|
|
165
|
+
apiKey?: string;
|
|
166
|
+
}): {
|
|
167
|
+
useLive: boolean;
|
|
168
|
+
mode: DecideMode;
|
|
169
|
+
};
|
|
170
|
+
export declare function prettyDecideJson(value: unknown): string;
|
|
171
|
+
export declare function decisionsReadmeStub(): string;
|
|
172
|
+
export declare function parseDecideRecord(raw: string): DecideRecord;
|
|
173
|
+
export declare function formatDecideSummary(record: DecideRecord, relPath: string): string;
|
|
174
|
+
export declare function runDecide(options: RunDecideOptions): Promise<{
|
|
175
|
+
record: DecideRecord;
|
|
176
|
+
outPath: string;
|
|
177
|
+
}>;
|
|
178
|
+
export declare function toRepoRelative(cwd: string, outPath: string): string;
|