grov 0.2.3 → 0.5.2

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.
@@ -1,6 +1,7 @@
1
1
  // Response processor - handles team memory save triggers and cleanup
2
2
  // Reference: plan_proxy_local.md Section 4.6
3
- import { getSessionState, getValidatedSteps, deleteStepsForSession, deleteSessionState, createTask, } from '../lib/store.js';
3
+ import { getSessionState, getValidatedSteps, deleteStepsForSession, deleteSessionState, createTask, markTaskSynced, setTaskSyncError, } from '../lib/store.js';
4
+ import { syncTask } from '../lib/cloud-sync.js';
4
5
  import { extractReasoning, isLLMAvailable, extractReasoningAndDecisions, isReasoningExtractionAvailable, } from '../lib/llm-extractor.js';
5
6
  /**
6
7
  * Save session to team memory
@@ -12,13 +13,29 @@ export async function saveToTeamMemory(sessionId, triggerReason) {
12
13
  return;
13
14
  }
14
15
  const steps = getValidatedSteps(sessionId);
15
- if (steps.length === 0 && triggerReason !== 'abandoned') {
16
+ // Allow saving if: has steps OR has final_response OR is abandoned
17
+ const hasFinalResponse = sessionState.final_response && sessionState.final_response.length > 100;
18
+ if (steps.length === 0 && !hasFinalResponse && triggerReason !== 'abandoned') {
16
19
  return; // Nothing to save
17
20
  }
18
21
  // Build task data from session state and steps
19
22
  const taskData = await buildTaskFromSession(sessionState, steps, triggerReason);
20
23
  // Create task in team memory
21
- createTask(taskData);
24
+ const task = createTask(taskData);
25
+ // Fire-and-forget cloud sync; never block capture path
26
+ syncTask(task)
27
+ .then((success) => {
28
+ if (success) {
29
+ markTaskSynced(task.id);
30
+ }
31
+ else {
32
+ setTaskSyncError(task.id, 'Sync not enabled or team not configured');
33
+ }
34
+ })
35
+ .catch((err) => {
36
+ const message = err instanceof Error ? err.message : 'Unknown sync error';
37
+ setTaskSyncError(task.id, message);
38
+ });
22
39
  }
23
40
  /**
24
41
  * Build task data from session state and steps
@@ -53,12 +70,16 @@ async function buildTaskFromSession(sessionState, steps, triggerReason) {
53
70
  let reasoningTrace = basicReasoningTrace;
54
71
  let decisions = [];
55
72
  let constraints = sessionState.constraints || [];
56
- if (isReasoningExtractionAvailable() && steps.length > 0) {
73
+ if (isReasoningExtractionAvailable()) {
57
74
  try {
58
- // Collect reasoning from steps
75
+ // Collect reasoning from steps + final response
59
76
  const stepsReasoning = steps
60
77
  .map(s => s.reasoning)
61
78
  .filter((r) => !!r && r.length > 10);
79
+ // Include final response (contains the actual analysis/conclusion)
80
+ if (sessionState.final_response && sessionState.final_response.length > 100) {
81
+ stepsReasoning.push(sessionState.final_response);
82
+ }
62
83
  if (stepsReasoning.length > 0) {
63
84
  const extracted = await extractReasoningAndDecisions(stepsReasoning, sessionState.original_goal || '');
64
85
  if (extracted.reasoning_trace.length > 0) {
@@ -1,9 +1,13 @@
1
1
  import { FastifyInstance } from 'fastify';
2
+ export declare function setDebugMode(enabled: boolean): void;
2
3
  /**
3
4
  * Create and configure the Fastify server
4
5
  */
5
6
  export declare function createServer(): FastifyInstance;
6
7
  /**
7
8
  * Start the proxy server
9
+ * @param options.debug - Enable debug logging to grov-proxy.log
8
10
  */
9
- export declare function startServer(): Promise<FastifyInstance>;
11
+ export declare function startServer(options?: {
12
+ debug?: boolean;
13
+ }): Promise<FastifyInstance>;