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.
- package/README.md +25 -4
- package/dist/cli.js +32 -2
- package/dist/commands/login.d.ts +1 -0
- package/dist/commands/login.js +115 -0
- package/dist/commands/logout.d.ts +1 -0
- package/dist/commands/logout.js +13 -0
- package/dist/commands/sync.d.ts +8 -0
- package/dist/commands/sync.js +127 -0
- package/dist/lib/api-client.d.ts +40 -0
- package/dist/lib/api-client.js +117 -0
- package/dist/lib/cloud-sync.d.ts +33 -0
- package/dist/lib/cloud-sync.js +176 -0
- package/dist/lib/credentials.d.ts +53 -0
- package/dist/lib/credentials.js +201 -0
- package/dist/lib/llm-extractor.d.ts +1 -1
- package/dist/lib/llm-extractor.js +20 -12
- package/dist/lib/store.d.ts +32 -2
- package/dist/lib/store.js +133 -11
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +45 -0
- package/dist/proxy/action-parser.d.ts +10 -2
- package/dist/proxy/action-parser.js +4 -2
- package/dist/proxy/forwarder.d.ts +7 -1
- package/dist/proxy/forwarder.js +157 -7
- package/dist/proxy/request-processor.d.ts +4 -3
- package/dist/proxy/request-processor.js +7 -5
- package/dist/proxy/response-processor.js +26 -5
- package/dist/proxy/server.d.ts +5 -1
- package/dist/proxy/server.js +667 -104
- package/package.json +18 -3
|
@@ -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
|
|
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()
|
|
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) {
|
package/dist/proxy/server.d.ts
CHANGED
|
@@ -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(
|
|
11
|
+
export declare function startServer(options?: {
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
}): Promise<FastifyInstance>;
|