grov 0.1.2 → 0.2.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.
Files changed (39) hide show
  1. package/README.md +73 -88
  2. package/dist/cli.js +23 -37
  3. package/dist/commands/capture.js +1 -1
  4. package/dist/commands/disable.d.ts +1 -0
  5. package/dist/commands/disable.js +14 -0
  6. package/dist/commands/drift-test.js +56 -68
  7. package/dist/commands/init.js +29 -17
  8. package/dist/commands/proxy-status.d.ts +1 -0
  9. package/dist/commands/proxy-status.js +32 -0
  10. package/dist/commands/unregister.js +7 -1
  11. package/dist/lib/correction-builder-proxy.d.ts +16 -0
  12. package/dist/lib/correction-builder-proxy.js +125 -0
  13. package/dist/lib/correction-builder.js +1 -1
  14. package/dist/lib/drift-checker-proxy.d.ts +63 -0
  15. package/dist/lib/drift-checker-proxy.js +373 -0
  16. package/dist/lib/drift-checker.js +1 -1
  17. package/dist/lib/hooks.d.ts +11 -0
  18. package/dist/lib/hooks.js +33 -0
  19. package/dist/lib/llm-extractor.d.ts +60 -11
  20. package/dist/lib/llm-extractor.js +431 -98
  21. package/dist/lib/settings.d.ts +19 -0
  22. package/dist/lib/settings.js +63 -0
  23. package/dist/lib/store.d.ts +201 -43
  24. package/dist/lib/store.js +653 -90
  25. package/dist/proxy/action-parser.d.ts +58 -0
  26. package/dist/proxy/action-parser.js +196 -0
  27. package/dist/proxy/config.d.ts +26 -0
  28. package/dist/proxy/config.js +67 -0
  29. package/dist/proxy/forwarder.d.ts +24 -0
  30. package/dist/proxy/forwarder.js +119 -0
  31. package/dist/proxy/index.d.ts +1 -0
  32. package/dist/proxy/index.js +30 -0
  33. package/dist/proxy/request-processor.d.ts +12 -0
  34. package/dist/proxy/request-processor.js +120 -0
  35. package/dist/proxy/response-processor.d.ts +14 -0
  36. package/dist/proxy/response-processor.js +138 -0
  37. package/dist/proxy/server.d.ts +9 -0
  38. package/dist/proxy/server.js +904 -0
  39. package/package.json +8 -3
package/dist/lib/hooks.js CHANGED
@@ -256,3 +256,36 @@ export function unregisterGrovHooks() {
256
256
  export function getSettingsPath() {
257
257
  return SETTINGS_PATH;
258
258
  }
259
+ /**
260
+ * Set or remove ANTHROPIC_BASE_URL in settings.json env section.
261
+ * This allows users to just type 'claude' instead of setting env var manually.
262
+ */
263
+ export function setProxyEnv(enable) {
264
+ const settings = readClaudeSettings();
265
+ const PROXY_URL = 'http://127.0.0.1:8080';
266
+ if (enable) {
267
+ // Add env.ANTHROPIC_BASE_URL
268
+ if (!settings.env) {
269
+ settings.env = {};
270
+ }
271
+ if (settings.env.ANTHROPIC_BASE_URL === PROXY_URL) {
272
+ return { action: 'unchanged' };
273
+ }
274
+ settings.env.ANTHROPIC_BASE_URL = PROXY_URL;
275
+ writeClaudeSettings(settings);
276
+ return { action: 'added' };
277
+ }
278
+ else {
279
+ // Remove env.ANTHROPIC_BASE_URL
280
+ if (!settings.env?.ANTHROPIC_BASE_URL) {
281
+ return { action: 'unchanged' };
282
+ }
283
+ delete settings.env.ANTHROPIC_BASE_URL;
284
+ // Clean up empty env object
285
+ if (Object.keys(settings.env).length === 0) {
286
+ delete settings.env;
287
+ }
288
+ writeClaudeSettings(settings);
289
+ return { action: 'removed' };
290
+ }
291
+ }
@@ -1,5 +1,5 @@
1
1
  import type { ParsedSession } from './jsonl-parser.js';
2
- import type { TaskStatus } from './store.js';
2
+ import type { TaskStatus, SessionState, StepRecord } from './store.js';
3
3
  export interface ExtractedReasoning {
4
4
  task: string;
5
5
  goal: string;
@@ -17,6 +17,23 @@ export interface ExtractedReasoning {
17
17
  * Check if LLM extraction is available (OpenAI API key set)
18
18
  */
19
19
  export declare function isLLMAvailable(): boolean;
20
+ export interface ExtractedIntent {
21
+ goal: string;
22
+ expected_scope: string[];
23
+ constraints: string[];
24
+ success_criteria?: string[];
25
+ keywords: string[];
26
+ }
27
+ /**
28
+ * Extract intent from first user prompt using Haiku
29
+ * Called once at session start to populate session_states
30
+ * Falls back to basic extraction if API unavailable (for hook compatibility)
31
+ */
32
+ export declare function extractIntent(firstPrompt: string): Promise<ExtractedIntent>;
33
+ /**
34
+ * Check if intent extraction is available
35
+ */
36
+ export declare function isIntentExtractionAvailable(): boolean;
20
37
  /**
21
38
  * Check if Anthropic API is available (for drift detection)
22
39
  */
@@ -34,17 +51,49 @@ export declare function extractReasoning(session: ParsedSession): Promise<Extrac
34
51
  */
35
52
  export declare function classifyTaskStatus(session: ParsedSession): Promise<TaskStatus>;
36
53
  /**
37
- * Extracted intent from first prompt
54
+ * Check if session summary generation is available
38
55
  */
39
- export interface ExtractedIntent {
40
- goal: string;
41
- expected_scope: string[];
42
- constraints: string[];
43
- success_criteria: string[];
44
- keywords: string[];
56
+ export declare function isSummaryAvailable(): boolean;
57
+ /**
58
+ * Generate session summary for CLEAR operation
59
+ * Reference: plan_proxy_local.md Section 2.3, 4.5
60
+ */
61
+ export declare function generateSessionSummary(sessionState: SessionState, steps: StepRecord[]): Promise<string>;
62
+ /**
63
+ * Task analysis result from Haiku
64
+ */
65
+ export interface TaskAnalysis {
66
+ action: 'continue' | 'new_task' | 'subtask' | 'parallel_task' | 'task_complete' | 'subtask_complete';
67
+ topic_match?: 'YES' | 'NO';
68
+ task_id: string;
69
+ current_goal: string;
70
+ parent_task_id?: string;
71
+ reasoning: string;
72
+ step_reasoning?: string;
45
73
  }
46
74
  /**
47
- * Extract intent from a prompt using Claude Haiku
48
- * Falls back to basic extraction if API unavailable
75
+ * Check if task analysis is available
76
+ */
77
+ export declare function isTaskAnalysisAvailable(): boolean;
78
+ /**
79
+ * Analyze task context to determine task status
80
+ * Called after each main model response to orchestrate sessions
81
+ * Also compresses reasoning for steps if assistantResponse > 1000 chars
82
+ */
83
+ export declare function analyzeTaskContext(currentSession: SessionState | null, latestUserMessage: string, recentSteps: StepRecord[], assistantResponse: string): Promise<TaskAnalysis>;
84
+ export interface ExtractedReasoningAndDecisions {
85
+ reasoning_trace: string[];
86
+ decisions: Array<{
87
+ choice: string;
88
+ reason: string;
89
+ }>;
90
+ }
91
+ /**
92
+ * Check if reasoning extraction is available
93
+ */
94
+ export declare function isReasoningExtractionAvailable(): boolean;
95
+ /**
96
+ * Extract reasoning trace and decisions from steps
97
+ * Called at task_complete to populate team memory with rich context
49
98
  */
50
- export declare function extractIntent(prompt: string): Promise<ExtractedIntent>;
99
+ export declare function extractReasoningAndDecisions(stepsReasoning: string[], originalGoal: string): Promise<ExtractedReasoningAndDecisions>;