pulseed 0.1.1 → 0.1.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/dist/adapters/agent-profile-loader.d.ts +26 -0
- package/dist/adapters/agent-profile-loader.d.ts.map +1 -0
- package/dist/adapters/agent-profile-loader.js +88 -0
- package/dist/adapters/agent-profile-loader.js.map +1 -0
- package/dist/adapters/claude-code-cli.d.ts.map +1 -1
- package/dist/adapters/claude-code-cli.js +3 -1
- package/dist/adapters/claude-code-cli.js.map +1 -1
- package/dist/adapters/mcp-client-manager.d.ts +22 -0
- package/dist/adapters/mcp-client-manager.d.ts.map +1 -0
- package/dist/adapters/mcp-client-manager.js +131 -0
- package/dist/adapters/mcp-client-manager.js.map +1 -0
- package/dist/adapters/mcp-datasource.d.ts +20 -0
- package/dist/adapters/mcp-datasource.d.ts.map +1 -0
- package/dist/adapters/mcp-datasource.js +116 -0
- package/dist/adapters/mcp-datasource.js.map +1 -0
- package/dist/adapters/openai-codex.d.ts.map +1 -1
- package/dist/adapters/openai-codex.js +3 -1
- package/dist/adapters/openai-codex.js.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/config.js +2 -1
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/daemon.d.ts +1 -0
- package/dist/cli/commands/daemon.d.ts.map +1 -1
- package/dist/cli/commands/daemon.js +110 -3
- package/dist/cli/commands/daemon.js.map +1 -1
- package/dist/cli/commands/goal-dispatch.d.ts.map +1 -1
- package/dist/cli/commands/goal-dispatch.js +15 -1
- package/dist/cli/commands/goal-dispatch.js.map +1 -1
- package/dist/cli/commands/goal-raw.d.ts +1 -0
- package/dist/cli/commands/goal-raw.d.ts.map +1 -1
- package/dist/cli/commands/goal-raw.js +3 -3
- package/dist/cli/commands/goal-raw.js.map +1 -1
- package/dist/cli/commands/goal-utils.d.ts +4 -2
- package/dist/cli/commands/goal-utils.d.ts.map +1 -1
- package/dist/cli/commands/goal-utils.js +53 -25
- package/dist/cli/commands/goal-utils.js.map +1 -1
- package/dist/cli/commands/goal-write.d.ts.map +1 -1
- package/dist/cli/commands/goal-write.js +38 -5
- package/dist/cli/commands/goal-write.js.map +1 -1
- package/dist/cli/commands/run.d.ts +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +2 -2
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +18 -0
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/suggest.d.ts.map +1 -1
- package/dist/cli/commands/suggest.js +20 -8
- package/dist/cli/commands/suggest.js.map +1 -1
- package/dist/cli/setup.d.ts +2 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +22 -6
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js +5 -0
- package/dist/cli/utils.js.map +1 -1
- package/dist/cli-runner.d.ts.map +1 -1
- package/dist/cli-runner.js +45 -2
- package/dist/cli-runner.js.map +1 -1
- package/dist/core-loop.d.ts +4 -1
- package/dist/core-loop.d.ts.map +1 -1
- package/dist/core-loop.js +12 -4
- package/dist/core-loop.js.map +1 -1
- package/dist/drive/gap-calculator.d.ts +1 -1
- package/dist/drive/gap-calculator.d.ts.map +1 -1
- package/dist/drive/gap-calculator.js +12 -3
- package/dist/drive/gap-calculator.js.map +1 -1
- package/dist/drive/progress-predictor.d.ts +24 -0
- package/dist/drive/progress-predictor.d.ts.map +1 -0
- package/dist/drive/progress-predictor.js +93 -0
- package/dist/drive/progress-predictor.js.map +1 -0
- package/dist/drive/stall-detector.d.ts +8 -1
- package/dist/drive/stall-detector.d.ts.map +1 -1
- package/dist/drive/stall-detector.js +42 -2
- package/dist/drive/stall-detector.js.map +1 -1
- package/dist/execution/adapter-layer.d.ts +2 -0
- package/dist/execution/adapter-layer.d.ts.map +1 -1
- package/dist/execution/adapter-layer.js.map +1 -1
- package/dist/execution/task-executor.d.ts.map +1 -1
- package/dist/execution/task-executor.js +34 -3
- package/dist/execution/task-executor.js.map +1 -1
- package/dist/execution/task-lifecycle.d.ts +4 -0
- package/dist/execution/task-lifecycle.d.ts.map +1 -1
- package/dist/execution/task-lifecycle.js +12 -3
- package/dist/execution/task-lifecycle.js.map +1 -1
- package/dist/execution/task-prompt-builder.d.ts.map +1 -1
- package/dist/execution/task-prompt-builder.js +3 -0
- package/dist/execution/task-prompt-builder.js.map +1 -1
- package/dist/execution/task-verifier.d.ts.map +1 -1
- package/dist/execution/task-verifier.js +23 -3
- package/dist/execution/task-verifier.js.map +1 -1
- package/dist/goal/goal-decomposer.js +1 -1
- package/dist/goal/goal-decomposer.js.map +1 -1
- package/dist/goal/goal-negotiator.d.ts.map +1 -1
- package/dist/goal/goal-negotiator.js +42 -55
- package/dist/goal/goal-negotiator.js.map +1 -1
- package/dist/goal/goal-refiner.d.ts.map +1 -1
- package/dist/goal/goal-refiner.js +10 -0
- package/dist/goal/goal-refiner.js.map +1 -1
- package/dist/goal/goal-suggest.d.ts +7 -0
- package/dist/goal/goal-suggest.d.ts.map +1 -1
- package/dist/goal/goal-suggest.js +48 -8
- package/dist/goal/goal-suggest.js.map +1 -1
- package/dist/goal/negotiator-steps.d.ts.map +1 -1
- package/dist/goal/negotiator-steps.js +3 -4
- package/dist/goal/negotiator-steps.js.map +1 -1
- package/dist/goal/subgoal-curriculum.d.ts +30 -0
- package/dist/goal/subgoal-curriculum.d.ts.map +1 -0
- package/dist/goal/subgoal-curriculum.js +53 -0
- package/dist/goal/subgoal-curriculum.js.map +1 -0
- package/dist/goal/tree-loop-orchestrator.d.ts.map +1 -1
- package/dist/goal/tree-loop-orchestrator.js +3 -2
- package/dist/goal/tree-loop-orchestrator.js.map +1 -1
- package/dist/knowledge/memory-persistence.d.ts.map +1 -1
- package/dist/knowledge/memory-persistence.js +18 -3
- package/dist/knowledge/memory-persistence.js.map +1 -1
- package/dist/llm/llm-client.d.ts +2 -1
- package/dist/llm/llm-client.d.ts.map +1 -1
- package/dist/llm/llm-client.js +4 -2
- package/dist/llm/llm-client.js.map +1 -1
- package/dist/llm/provider-config.d.ts +4 -0
- package/dist/llm/provider-config.d.ts.map +1 -1
- package/dist/llm/provider-config.js +42 -2
- package/dist/llm/provider-config.js.map +1 -1
- package/dist/llm/provider-factory.d.ts.map +1 -1
- package/dist/llm/provider-factory.js +4 -5
- package/dist/llm/provider-factory.js.map +1 -1
- package/dist/loop/core-loop-phases-b.d.ts.map +1 -1
- package/dist/loop/core-loop-phases-b.js +6 -0
- package/dist/loop/core-loop-phases-b.js.map +1 -1
- package/dist/loop/core-loop-phases.d.ts.map +1 -1
- package/dist/loop/core-loop-phases.js +9 -4
- package/dist/loop/core-loop-phases.js.map +1 -1
- package/dist/loop/core-loop-types.d.ts +2 -0
- package/dist/loop/core-loop-types.d.ts.map +1 -1
- package/dist/loop/core-loop-types.js.map +1 -1
- package/dist/mcp-server/index.d.ts +4 -0
- package/dist/mcp-server/index.d.ts.map +1 -0
- package/dist/mcp-server/index.js +66 -0
- package/dist/mcp-server/index.js.map +1 -0
- package/dist/mcp-server/tools.d.ts +35 -0
- package/dist/mcp-server/tools.d.ts.map +1 -0
- package/dist/mcp-server/tools.js +160 -0
- package/dist/mcp-server/tools.js.map +1 -0
- package/dist/observation/observation-apply.d.ts.map +1 -1
- package/dist/observation/observation-apply.js +5 -1
- package/dist/observation/observation-apply.js.map +1 -1
- package/dist/observation/observation-engine.d.ts +4 -2
- package/dist/observation/observation-engine.d.ts.map +1 -1
- package/dist/observation/observation-engine.js +14 -6
- package/dist/observation/observation-engine.js.map +1 -1
- package/dist/observation/observation-llm.d.ts +10 -2
- package/dist/observation/observation-llm.d.ts.map +1 -1
- package/dist/observation/observation-llm.js +89 -10
- package/dist/observation/observation-llm.js.map +1 -1
- package/dist/observation/workspace-context.d.ts +1 -1
- package/dist/observation/workspace-context.d.ts.map +1 -1
- package/dist/observation/workspace-context.js +41 -9
- package/dist/observation/workspace-context.js.map +1 -1
- package/dist/orchestrator/goal-loop.d.ts +33 -0
- package/dist/orchestrator/goal-loop.d.ts.map +1 -0
- package/dist/orchestrator/goal-loop.js +72 -0
- package/dist/orchestrator/goal-loop.js.map +1 -0
- package/dist/prompt/context-assembler.js +3 -3
- package/dist/prompt/context-assembler.js.map +1 -1
- package/dist/prompt/purposes/strategy.d.ts +71 -26
- package/dist/prompt/purposes/strategy.d.ts.map +1 -1
- package/dist/prompt/purposes/strategy.js +34 -8
- package/dist/prompt/purposes/strategy.js.map +1 -1
- package/dist/reflection/dream-consolidation.d.ts +11 -0
- package/dist/reflection/dream-consolidation.d.ts.map +1 -0
- package/dist/reflection/dream-consolidation.js +61 -0
- package/dist/reflection/dream-consolidation.js.map +1 -0
- package/dist/reflection/evening-catchup.d.ts +13 -0
- package/dist/reflection/evening-catchup.d.ts.map +1 -0
- package/dist/reflection/evening-catchup.js +116 -0
- package/dist/reflection/evening-catchup.js.map +1 -0
- package/dist/reflection/index.d.ts +7 -0
- package/dist/reflection/index.d.ts.map +1 -0
- package/dist/reflection/index.js +6 -0
- package/dist/reflection/index.js.map +1 -0
- package/dist/reflection/morning-planning.d.ts +13 -0
- package/dist/reflection/morning-planning.d.ts.map +1 -0
- package/dist/reflection/morning-planning.js +107 -0
- package/dist/reflection/morning-planning.js.map +1 -0
- package/dist/reflection/types.d.ts +168 -0
- package/dist/reflection/types.d.ts.map +1 -0
- package/dist/reflection/types.js +58 -0
- package/dist/reflection/types.js.map +1 -0
- package/dist/reflection/weekly-review.d.ts +11 -0
- package/dist/reflection/weekly-review.d.ts.map +1 -0
- package/dist/reflection/weekly-review.js +114 -0
- package/dist/reflection/weekly-review.js.map +1 -0
- package/dist/runtime/cron-scheduler.d.ts +13 -0
- package/dist/runtime/cron-scheduler.d.ts.map +1 -0
- package/dist/runtime/cron-scheduler.js +90 -0
- package/dist/runtime/cron-scheduler.js.map +1 -0
- package/dist/runtime/daemon-runner.d.ts +34 -0
- package/dist/runtime/daemon-runner.d.ts.map +1 -1
- package/dist/runtime/daemon-runner.js +207 -4
- package/dist/runtime/daemon-runner.js.map +1 -1
- package/dist/runtime/event-server.d.ts +17 -2
- package/dist/runtime/event-server.d.ts.map +1 -1
- package/dist/runtime/event-server.js +214 -6
- package/dist/runtime/event-server.js.map +1 -1
- package/dist/runtime/hook-manager.d.ts +41 -0
- package/dist/runtime/hook-manager.d.ts.map +1 -0
- package/dist/runtime/hook-manager.js +167 -0
- package/dist/runtime/hook-manager.js.map +1 -0
- package/dist/runtime/notification-batcher.d.ts +28 -0
- package/dist/runtime/notification-batcher.d.ts.map +1 -0
- package/dist/runtime/notification-batcher.js +100 -0
- package/dist/runtime/notification-batcher.js.map +1 -0
- package/dist/runtime/notification-dispatcher.d.ts +5 -0
- package/dist/runtime/notification-dispatcher.d.ts.map +1 -1
- package/dist/runtime/notification-dispatcher.js +22 -0
- package/dist/runtime/notification-dispatcher.js.map +1 -1
- package/dist/runtime/trigger-mapper.d.ts +26 -0
- package/dist/runtime/trigger-mapper.d.ts.map +1 -0
- package/dist/runtime/trigger-mapper.js +89 -0
- package/dist/runtime/trigger-mapper.js.map +1 -0
- package/dist/strategy/strategy-helpers.d.ts +6 -0
- package/dist/strategy/strategy-helpers.d.ts.map +1 -1
- package/dist/strategy/strategy-helpers.js +20 -0
- package/dist/strategy/strategy-helpers.js.map +1 -1
- package/dist/strategy/strategy-manager-base.d.ts.map +1 -1
- package/dist/strategy/strategy-manager-base.js +16 -8
- package/dist/strategy/strategy-manager-base.js.map +1 -1
- package/dist/tui/app.d.ts.map +1 -1
- package/dist/tui/app.js +3 -2
- package/dist/tui/app.js.map +1 -1
- package/dist/tui/approval-overlay.d.ts.map +1 -1
- package/dist/tui/approval-overlay.js +5 -4
- package/dist/tui/approval-overlay.js.map +1 -1
- package/dist/tui/chat.d.ts.map +1 -1
- package/dist/tui/chat.js +6 -19
- package/dist/tui/chat.js.map +1 -1
- package/dist/tui/dashboard.d.ts.map +1 -1
- package/dist/tui/dashboard.js +3 -24
- package/dist/tui/dashboard.js.map +1 -1
- package/dist/tui/entry.d.ts.map +1 -1
- package/dist/tui/entry.js +3 -1
- package/dist/tui/entry.js.map +1 -1
- package/dist/tui/help-overlay.d.ts.map +1 -1
- package/dist/tui/help-overlay.js +2 -1
- package/dist/tui/help-overlay.js.map +1 -1
- package/dist/tui/markdown-renderer.d.ts.map +1 -1
- package/dist/tui/markdown-renderer.js +5 -4
- package/dist/tui/markdown-renderer.js.map +1 -1
- package/dist/tui/report-view.d.ts.map +1 -1
- package/dist/tui/report-view.js +1 -25
- package/dist/tui/report-view.js.map +1 -1
- package/dist/tui/theme.d.ts +47 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +116 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/types/agent-profile.d.ts +32 -0
- package/dist/types/agent-profile.d.ts.map +1 -0
- package/dist/types/agent-profile.js +16 -0
- package/dist/types/agent-profile.js.map +1 -0
- package/dist/types/core.d.ts +1 -1
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js +2 -0
- package/dist/types/core.js.map +1 -1
- package/dist/types/cron.d.ts +59 -0
- package/dist/types/cron.d.ts.map +1 -0
- package/dist/types/cron.js +13 -0
- package/dist/types/cron.js.map +1 -0
- package/dist/types/daemon.d.ts +47 -0
- package/dist/types/daemon.d.ts.map +1 -1
- package/dist/types/daemon.js +11 -0
- package/dist/types/daemon.js.map +1 -1
- package/dist/types/data-source.d.ts +9 -9
- package/dist/types/data-source.d.ts.map +1 -1
- package/dist/types/data-source.js +1 -1
- package/dist/types/data-source.js.map +1 -1
- package/dist/types/hook.d.ts +142 -0
- package/dist/types/hook.d.ts.map +1 -0
- package/dist/types/hook.js +43 -0
- package/dist/types/hook.js.map +1 -0
- package/dist/types/mcp.d.ts +170 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +30 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/notification.d.ts +37 -0
- package/dist/types/notification.d.ts.map +1 -1
- package/dist/types/notification.js +7 -0
- package/dist/types/notification.js.map +1 -1
- package/dist/types/stall.d.ts +3 -3
- package/dist/types/strategy.d.ts +12 -12
- package/dist/types/trigger.d.ts +77 -0
- package/dist/types/trigger.d.ts.map +1 -0
- package/dist/types/trigger.js +21 -0
- package/dist/types/trigger.js.map +1 -0
- package/package.json +8 -3
- package/dist/prompt/slot-definitions 2.d.ts +0 -33
- package/dist/prompt/slot-definitions 2.d.ts.map +0 -1
- package/dist/prompt/slot-definitions 2.js +0 -332
- package/dist/prompt/slot-definitions 2.js.map +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as fsp from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { writeJsonFileAtomic } from "../utils/json-io.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { CatchupReportSchema } from "./types.js";
|
|
6
|
+
// ─── LLM response schema ───
|
|
7
|
+
const LLMCatchupResponseSchema = z.object({
|
|
8
|
+
progress_summary: z.string(),
|
|
9
|
+
completions: z.array(z.string()).default([]),
|
|
10
|
+
stalls: z.array(z.string()).default([]),
|
|
11
|
+
concerns: z.array(z.string()).default([]),
|
|
12
|
+
});
|
|
13
|
+
// ─── Helpers ───
|
|
14
|
+
function todayISO() {
|
|
15
|
+
return new Date().toISOString().slice(0, 10);
|
|
16
|
+
}
|
|
17
|
+
async function loadGoalSummaries(stateManager) {
|
|
18
|
+
const goalIds = await stateManager.listGoalIds();
|
|
19
|
+
const summaries = [];
|
|
20
|
+
for (const id of goalIds) {
|
|
21
|
+
const goal = await stateManager.loadGoal(id);
|
|
22
|
+
if (!goal || goal.status !== "active")
|
|
23
|
+
continue;
|
|
24
|
+
const gapHistory = await stateManager.loadGapHistory(id);
|
|
25
|
+
const latest = gapHistory.at(-1);
|
|
26
|
+
const gapScore = latest
|
|
27
|
+
? Math.max(...latest.gap_vector.map((g) => g.normalized_weighted_gap))
|
|
28
|
+
: 0;
|
|
29
|
+
summaries.push({
|
|
30
|
+
goal_id: goal.id,
|
|
31
|
+
title: goal.title,
|
|
32
|
+
status: goal.status,
|
|
33
|
+
gap_score: Math.min(1, Math.max(0, gapScore)),
|
|
34
|
+
stall_level: 0,
|
|
35
|
+
dimensions_count: goal.dimensions.length,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return summaries;
|
|
39
|
+
}
|
|
40
|
+
// ─── Main ───
|
|
41
|
+
export async function runEveningCatchup(deps) {
|
|
42
|
+
const { stateManager, llmClient, baseDir, notificationDispatcher, hookManager } = deps;
|
|
43
|
+
const date = todayISO();
|
|
44
|
+
const now = new Date().toISOString();
|
|
45
|
+
const goalSummaries = await loadGoalSummaries(stateManager);
|
|
46
|
+
let progressSummary = "No active goals to review.";
|
|
47
|
+
let completions = [];
|
|
48
|
+
let stalls = [];
|
|
49
|
+
let concerns = [];
|
|
50
|
+
if (goalSummaries.length > 0) {
|
|
51
|
+
// Load morning report if available for comparison
|
|
52
|
+
const morningPath = path.join(baseDir, "reflections", `morning-${date}.json`);
|
|
53
|
+
let morningData = null;
|
|
54
|
+
try {
|
|
55
|
+
const raw = await fsp.readFile(morningPath, "utf-8");
|
|
56
|
+
morningData = JSON.parse(raw);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// No morning report available
|
|
60
|
+
}
|
|
61
|
+
const prompt = `You are PulSeed's evening catch-up assistant. Review today's goal progress.
|
|
62
|
+
|
|
63
|
+
Current goal state:
|
|
64
|
+
${JSON.stringify(goalSummaries, null, 2)}
|
|
65
|
+
|
|
66
|
+
${morningData ? `Morning plan:\n${JSON.stringify(morningData, null, 2)}\n` : ""}
|
|
67
|
+
|
|
68
|
+
Summarize the day's progress. List any completions, stalls, or concerns.
|
|
69
|
+
|
|
70
|
+
Respond with JSON:
|
|
71
|
+
{ "progress_summary": string, "completions": [string], "stalls": [string], "concerns": [string] }`;
|
|
72
|
+
try {
|
|
73
|
+
const response = await llmClient.sendMessage([{ role: "user", content: prompt }]);
|
|
74
|
+
const parsed = llmClient.parseJSON(response.content, LLMCatchupResponseSchema);
|
|
75
|
+
progressSummary = parsed.progress_summary;
|
|
76
|
+
completions = parsed.completions ?? [];
|
|
77
|
+
stalls = parsed.stalls ?? [];
|
|
78
|
+
concerns = parsed.concerns ?? [];
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// LLM error — return partial report
|
|
82
|
+
progressSummary = "Unable to generate summary due to LLM error.";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const report = CatchupReportSchema.parse({
|
|
86
|
+
date,
|
|
87
|
+
created_at: now,
|
|
88
|
+
goals_reviewed: goalSummaries.length,
|
|
89
|
+
progress_summary: progressSummary,
|
|
90
|
+
completions,
|
|
91
|
+
stalls,
|
|
92
|
+
concerns,
|
|
93
|
+
});
|
|
94
|
+
// Persist report
|
|
95
|
+
const reflectionsDir = path.join(baseDir, "reflections");
|
|
96
|
+
await fsp.mkdir(reflectionsDir, { recursive: true });
|
|
97
|
+
await writeJsonFileAtomic(path.join(reflectionsDir, `evening-${date}.json`), report);
|
|
98
|
+
void hookManager?.emit("ReflectionComplete", { data: { type: "evening_catchup" } });
|
|
99
|
+
// Notify
|
|
100
|
+
if (notificationDispatcher && goalSummaries.length > 0) {
|
|
101
|
+
const now2 = new Date().toISOString();
|
|
102
|
+
await notificationDispatcher.dispatch({
|
|
103
|
+
id: `evening-catchup-${date}`,
|
|
104
|
+
report_type: "daily_summary",
|
|
105
|
+
goal_id: null,
|
|
106
|
+
title: `Evening Catch-up — ${date}`,
|
|
107
|
+
content: progressSummary,
|
|
108
|
+
verbosity: "standard",
|
|
109
|
+
generated_at: now2,
|
|
110
|
+
delivered_at: null,
|
|
111
|
+
read: false,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return report;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=evening-catchup.js.map
|
|
@@ -0,0 +1 @@
|
|
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MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC;QACvC,IAAI;QACJ,UAAU,EAAE,GAAG;QACf,cAAc,EAAE,aAAa,CAAC,MAAM;QACpC,gBAAgB,EAAE,eAAe;QACjC,WAAW;QACX,MAAM;QACN,QAAQ;KACT,CAAC,CAAC;IAEH,iBAAiB;IACjB,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACzD,MAAM,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,MAAM,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,IAAI,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;IAErF,KAAK,WAAW,EAAE,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAEpF,SAAS;IACT,IAAI,sBAAsB,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACtC,MAAM,sBAAsB,CAAC,QAAQ,CAAC;YACpC,EAAE,EAAE,mBAAmB,IAAI,EAAE;YAC7B,WAAW,EAAE,eAAe;YAC5B,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,sBAAsB,IAAI,EAAE;YACnC,OAAO,EAAE,eAAe;YACxB,SAAS,EAAE,UAAU;YACrB,YAAY,EAAE,IAAI;YAClB,YAAY,EAAE,IAAI;YAClB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { runMorningPlanning } from "./morning-planning.js";
|
|
2
|
+
export { runEveningCatchup } from "./evening-catchup.js";
|
|
3
|
+
export { runDreamConsolidation } from "./dream-consolidation.js";
|
|
4
|
+
export { runWeeklyReview } from "./weekly-review.js";
|
|
5
|
+
export type { GoalSummary, PlanningReport, CatchupReport, ConsolidationReport, WeeklyReviewReport, } from "./types.js";
|
|
6
|
+
export { GoalSummarySchema, PlanningReportSchema, CatchupReportSchema, ConsolidationReportSchema, WeeklyReviewReportSchema, } from "./types.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reflection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { runMorningPlanning } from "./morning-planning.js";
|
|
2
|
+
export { runEveningCatchup } from "./evening-catchup.js";
|
|
3
|
+
export { runDreamConsolidation } from "./dream-consolidation.js";
|
|
4
|
+
export { runWeeklyReview } from "./weekly-review.js";
|
|
5
|
+
export { GoalSummarySchema, PlanningReportSchema, CatchupReportSchema, ConsolidationReportSchema, WeeklyReviewReportSchema, } from "./types.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reflection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQrD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StateManager } from "../state-manager.js";
|
|
2
|
+
import type { ILLMClient } from "../llm/llm-client.js";
|
|
3
|
+
import type { INotificationDispatcher } from "../runtime/notification-dispatcher.js";
|
|
4
|
+
import type { PlanningReport } from "./types.js";
|
|
5
|
+
import type { HookManager } from "../runtime/hook-manager.js";
|
|
6
|
+
export declare function runMorningPlanning(deps: {
|
|
7
|
+
stateManager: StateManager;
|
|
8
|
+
llmClient: ILLMClient;
|
|
9
|
+
baseDir: string;
|
|
10
|
+
notificationDispatcher?: INotificationDispatcher;
|
|
11
|
+
hookManager?: HookManager;
|
|
12
|
+
}): Promise<PlanningReport>;
|
|
13
|
+
//# sourceMappingURL=morning-planning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"morning-planning.d.ts","sourceRoot":"","sources":["../../src/reflection/morning-planning.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAsD9D,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;IACjD,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GAAG,OAAO,CAAC,cAAc,CAAC,CAmE1B"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as fsp from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { writeJsonFileAtomic } from "../utils/json-io.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { PlanningReportSchema } from "./types.js";
|
|
6
|
+
// ─── LLM response schema ───
|
|
7
|
+
const LLMPlanningResponseSchema = z.object({
|
|
8
|
+
priorities: z.array(z.object({
|
|
9
|
+
goal_id: z.string(),
|
|
10
|
+
priority: z.enum(["high", "medium", "low"]),
|
|
11
|
+
reasoning: z.string(),
|
|
12
|
+
})),
|
|
13
|
+
suggestions: z.array(z.string()).default([]),
|
|
14
|
+
concerns: z.array(z.string()).default([]),
|
|
15
|
+
});
|
|
16
|
+
// ─── Helpers ───
|
|
17
|
+
function todayISO() {
|
|
18
|
+
return new Date().toISOString().slice(0, 10);
|
|
19
|
+
}
|
|
20
|
+
function aggregateGapScore(gaps) {
|
|
21
|
+
if (gaps.length === 0)
|
|
22
|
+
return 0;
|
|
23
|
+
return Math.max(...gaps.map((g) => g.normalized_weighted_gap));
|
|
24
|
+
}
|
|
25
|
+
async function buildGoalSummaries(stateManager) {
|
|
26
|
+
const goalIds = await stateManager.listGoalIds();
|
|
27
|
+
const summaries = [];
|
|
28
|
+
for (const id of goalIds) {
|
|
29
|
+
const goal = await stateManager.loadGoal(id);
|
|
30
|
+
if (!goal || goal.status !== "active")
|
|
31
|
+
continue;
|
|
32
|
+
const gapHistory = await stateManager.loadGapHistory(id);
|
|
33
|
+
const latest = gapHistory.at(-1);
|
|
34
|
+
const gapScore = latest ? aggregateGapScore(latest.gap_vector) : 0;
|
|
35
|
+
summaries.push({
|
|
36
|
+
goal_id: goal.id,
|
|
37
|
+
title: goal.title,
|
|
38
|
+
status: goal.status,
|
|
39
|
+
gap_score: Math.min(1, Math.max(0, gapScore)),
|
|
40
|
+
stall_level: 0,
|
|
41
|
+
dimensions_count: goal.dimensions.length,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return summaries;
|
|
45
|
+
}
|
|
46
|
+
// ─── Main ───
|
|
47
|
+
export async function runMorningPlanning(deps) {
|
|
48
|
+
const { stateManager, llmClient, baseDir, notificationDispatcher, hookManager } = deps;
|
|
49
|
+
const date = todayISO();
|
|
50
|
+
const now = new Date().toISOString();
|
|
51
|
+
const goalSummaries = await buildGoalSummaries(stateManager);
|
|
52
|
+
let priorities = [];
|
|
53
|
+
let suggestions = [];
|
|
54
|
+
let concerns = [];
|
|
55
|
+
if (goalSummaries.length > 0) {
|
|
56
|
+
const prompt = `You are PulSeed's morning planner. Review these active goals and create a daily plan.
|
|
57
|
+
|
|
58
|
+
Goals:
|
|
59
|
+
${JSON.stringify(goalSummaries, null, 2)}
|
|
60
|
+
|
|
61
|
+
For each goal, assign priority (high/medium/low) with reasoning.
|
|
62
|
+
List any suggestions for new actions or concerns.
|
|
63
|
+
|
|
64
|
+
Respond with JSON matching this schema:
|
|
65
|
+
{ "priorities": [{"goal_id": string, "priority": "high"|"medium"|"low", "reasoning": string}], "suggestions": [string], "concerns": [string] }`;
|
|
66
|
+
try {
|
|
67
|
+
const response = await llmClient.sendMessage([{ role: "user", content: prompt }]);
|
|
68
|
+
const parsed = llmClient.parseJSON(response.content, LLMPlanningResponseSchema);
|
|
69
|
+
priorities = parsed.priorities;
|
|
70
|
+
suggestions = parsed.suggestions ?? [];
|
|
71
|
+
concerns = parsed.concerns ?? [];
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// LLM error — return partial report with empty priorities
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const report = PlanningReportSchema.parse({
|
|
78
|
+
date,
|
|
79
|
+
created_at: now,
|
|
80
|
+
goals_reviewed: goalSummaries.length,
|
|
81
|
+
priorities,
|
|
82
|
+
suggestions,
|
|
83
|
+
concerns,
|
|
84
|
+
});
|
|
85
|
+
// Persist report
|
|
86
|
+
const reflectionsDir = path.join(baseDir, "reflections");
|
|
87
|
+
await fsp.mkdir(reflectionsDir, { recursive: true });
|
|
88
|
+
await writeJsonFileAtomic(path.join(reflectionsDir, `morning-${date}.json`), report);
|
|
89
|
+
void hookManager?.emit("ReflectionComplete", { data: { type: "morning_planning" } });
|
|
90
|
+
// Notify
|
|
91
|
+
if (notificationDispatcher && goalSummaries.length > 0) {
|
|
92
|
+
const now2 = new Date().toISOString();
|
|
93
|
+
await notificationDispatcher.dispatch({
|
|
94
|
+
id: `morning-planning-${date}`,
|
|
95
|
+
report_type: "daily_summary",
|
|
96
|
+
goal_id: null,
|
|
97
|
+
title: `Morning Planning — ${date}`,
|
|
98
|
+
content: `Reviewed ${goalSummaries.length} goals. ${concerns.length} concern(s).`,
|
|
99
|
+
verbosity: "standard",
|
|
100
|
+
generated_at: now2,
|
|
101
|
+
delivered_at: null,
|
|
102
|
+
read: false,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return report;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=morning-planning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"morning-planning.js","sourceRoot":"","sources":["../../src/reflection/morning-planning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlD,8BAA8B;AAE9B,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,UAA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AC;YACpC,EAAE,EAAE,oBAAoB,IAAI,EAAE;YAC9B,WAAW,EAAE,eAAe;YAC5B,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,sBAAsB,IAAI,EAAE;YACnC,OAAO,EAAE,YAAY,aAAa,CAAC,MAAM,WAAW,QAAQ,CAAC,MAAM,cAAc;YACjF,SAAS,EAAE,UAAU;YACrB,YAAY,EAAE,IAAI;YAClB,YAAY,EAAE,IAAI;YAClB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const GoalSummarySchema: z.ZodObject<{
|
|
3
|
+
goal_id: z.ZodString;
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
status: z.ZodString;
|
|
6
|
+
gap_score: z.ZodNumber;
|
|
7
|
+
stall_level: z.ZodNumber;
|
|
8
|
+
dimensions_count: z.ZodNumber;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
status: string;
|
|
11
|
+
title: string;
|
|
12
|
+
goal_id: string;
|
|
13
|
+
gap_score: number;
|
|
14
|
+
stall_level: number;
|
|
15
|
+
dimensions_count: number;
|
|
16
|
+
}, {
|
|
17
|
+
status: string;
|
|
18
|
+
title: string;
|
|
19
|
+
goal_id: string;
|
|
20
|
+
gap_score: number;
|
|
21
|
+
stall_level: number;
|
|
22
|
+
dimensions_count: number;
|
|
23
|
+
}>;
|
|
24
|
+
export type GoalSummary = z.infer<typeof GoalSummarySchema>;
|
|
25
|
+
export declare const PlanningReportSchema: z.ZodObject<{
|
|
26
|
+
date: z.ZodString;
|
|
27
|
+
created_at: z.ZodString;
|
|
28
|
+
goals_reviewed: z.ZodNumber;
|
|
29
|
+
priorities: z.ZodArray<z.ZodObject<{
|
|
30
|
+
goal_id: z.ZodString;
|
|
31
|
+
priority: z.ZodEnum<["high", "medium", "low"]>;
|
|
32
|
+
reasoning: z.ZodString;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
goal_id: string;
|
|
35
|
+
reasoning: string;
|
|
36
|
+
priority: "low" | "high" | "medium";
|
|
37
|
+
}, {
|
|
38
|
+
goal_id: string;
|
|
39
|
+
reasoning: string;
|
|
40
|
+
priority: "low" | "high" | "medium";
|
|
41
|
+
}>, "many">;
|
|
42
|
+
suggestions: z.ZodArray<z.ZodString, "many">;
|
|
43
|
+
concerns: z.ZodArray<z.ZodString, "many">;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
date: string;
|
|
46
|
+
created_at: string;
|
|
47
|
+
suggestions: string[];
|
|
48
|
+
goals_reviewed: number;
|
|
49
|
+
priorities: {
|
|
50
|
+
goal_id: string;
|
|
51
|
+
reasoning: string;
|
|
52
|
+
priority: "low" | "high" | "medium";
|
|
53
|
+
}[];
|
|
54
|
+
concerns: string[];
|
|
55
|
+
}, {
|
|
56
|
+
date: string;
|
|
57
|
+
created_at: string;
|
|
58
|
+
suggestions: string[];
|
|
59
|
+
goals_reviewed: number;
|
|
60
|
+
priorities: {
|
|
61
|
+
goal_id: string;
|
|
62
|
+
reasoning: string;
|
|
63
|
+
priority: "low" | "high" | "medium";
|
|
64
|
+
}[];
|
|
65
|
+
concerns: string[];
|
|
66
|
+
}>;
|
|
67
|
+
export type PlanningReport = z.infer<typeof PlanningReportSchema>;
|
|
68
|
+
export declare const CatchupReportSchema: z.ZodObject<{
|
|
69
|
+
date: z.ZodString;
|
|
70
|
+
created_at: z.ZodString;
|
|
71
|
+
goals_reviewed: z.ZodNumber;
|
|
72
|
+
progress_summary: z.ZodString;
|
|
73
|
+
completions: z.ZodArray<z.ZodString, "many">;
|
|
74
|
+
stalls: z.ZodArray<z.ZodString, "many">;
|
|
75
|
+
concerns: z.ZodArray<z.ZodString, "many">;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
date: string;
|
|
78
|
+
created_at: string;
|
|
79
|
+
stalls: string[];
|
|
80
|
+
goals_reviewed: number;
|
|
81
|
+
concerns: string[];
|
|
82
|
+
progress_summary: string;
|
|
83
|
+
completions: string[];
|
|
84
|
+
}, {
|
|
85
|
+
date: string;
|
|
86
|
+
created_at: string;
|
|
87
|
+
stalls: string[];
|
|
88
|
+
goals_reviewed: number;
|
|
89
|
+
concerns: string[];
|
|
90
|
+
progress_summary: string;
|
|
91
|
+
completions: string[];
|
|
92
|
+
}>;
|
|
93
|
+
export type CatchupReport = z.infer<typeof CatchupReportSchema>;
|
|
94
|
+
export declare const ConsolidationReportSchema: z.ZodObject<{
|
|
95
|
+
date: z.ZodString;
|
|
96
|
+
created_at: z.ZodString;
|
|
97
|
+
goals_consolidated: z.ZodNumber;
|
|
98
|
+
entries_compressed: z.ZodNumber;
|
|
99
|
+
stale_entries_found: z.ZodNumber;
|
|
100
|
+
revalidation_tasks_created: z.ZodNumber;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
date: string;
|
|
103
|
+
created_at: string;
|
|
104
|
+
entries_compressed: number;
|
|
105
|
+
goals_consolidated: number;
|
|
106
|
+
stale_entries_found: number;
|
|
107
|
+
revalidation_tasks_created: number;
|
|
108
|
+
}, {
|
|
109
|
+
date: string;
|
|
110
|
+
created_at: string;
|
|
111
|
+
entries_compressed: number;
|
|
112
|
+
goals_consolidated: number;
|
|
113
|
+
stale_entries_found: number;
|
|
114
|
+
revalidation_tasks_created: number;
|
|
115
|
+
}>;
|
|
116
|
+
export type ConsolidationReport = z.infer<typeof ConsolidationReportSchema>;
|
|
117
|
+
export declare const WeeklyReviewReportSchema: z.ZodObject<{
|
|
118
|
+
week: z.ZodString;
|
|
119
|
+
created_at: z.ZodString;
|
|
120
|
+
goals_reviewed: z.ZodNumber;
|
|
121
|
+
rankings: z.ZodArray<z.ZodObject<{
|
|
122
|
+
goal_id: z.ZodString;
|
|
123
|
+
progress_rate: z.ZodNumber;
|
|
124
|
+
strategy_effectiveness: z.ZodEnum<["high", "medium", "low"]>;
|
|
125
|
+
recommendation: z.ZodString;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
goal_id: string;
|
|
128
|
+
progress_rate: number;
|
|
129
|
+
strategy_effectiveness: "low" | "high" | "medium";
|
|
130
|
+
recommendation: string;
|
|
131
|
+
}, {
|
|
132
|
+
goal_id: string;
|
|
133
|
+
progress_rate: number;
|
|
134
|
+
strategy_effectiveness: "low" | "high" | "medium";
|
|
135
|
+
recommendation: string;
|
|
136
|
+
}>, "many">;
|
|
137
|
+
suggested_additions: z.ZodArray<z.ZodString, "many">;
|
|
138
|
+
suggested_removals: z.ZodArray<z.ZodString, "many">;
|
|
139
|
+
summary: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
created_at: string;
|
|
142
|
+
summary: string;
|
|
143
|
+
goals_reviewed: number;
|
|
144
|
+
week: string;
|
|
145
|
+
rankings: {
|
|
146
|
+
goal_id: string;
|
|
147
|
+
progress_rate: number;
|
|
148
|
+
strategy_effectiveness: "low" | "high" | "medium";
|
|
149
|
+
recommendation: string;
|
|
150
|
+
}[];
|
|
151
|
+
suggested_additions: string[];
|
|
152
|
+
suggested_removals: string[];
|
|
153
|
+
}, {
|
|
154
|
+
created_at: string;
|
|
155
|
+
summary: string;
|
|
156
|
+
goals_reviewed: number;
|
|
157
|
+
week: string;
|
|
158
|
+
rankings: {
|
|
159
|
+
goal_id: string;
|
|
160
|
+
progress_rate: number;
|
|
161
|
+
strategy_effectiveness: "low" | "high" | "medium";
|
|
162
|
+
recommendation: string;
|
|
163
|
+
}[];
|
|
164
|
+
suggested_additions: string[];
|
|
165
|
+
suggested_removals: string[];
|
|
166
|
+
}>;
|
|
167
|
+
export type WeeklyReviewReport = z.infer<typeof WeeklyReviewReportSchema>;
|
|
168
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reflection/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAQ9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIhE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAI5E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAenC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// ─── GoalSummary ───
|
|
3
|
+
export const GoalSummarySchema = z.object({
|
|
4
|
+
goal_id: z.string(),
|
|
5
|
+
title: z.string(),
|
|
6
|
+
status: z.string(),
|
|
7
|
+
gap_score: z.number().min(0).max(1),
|
|
8
|
+
stall_level: z.number().int().min(0).max(3),
|
|
9
|
+
dimensions_count: z.number().int().min(0),
|
|
10
|
+
});
|
|
11
|
+
// ─── PlanningReport ───
|
|
12
|
+
export const PlanningReportSchema = z.object({
|
|
13
|
+
date: z.string(),
|
|
14
|
+
created_at: z.string(),
|
|
15
|
+
goals_reviewed: z.number().int().min(0),
|
|
16
|
+
priorities: z.array(z.object({
|
|
17
|
+
goal_id: z.string(),
|
|
18
|
+
priority: z.enum(["high", "medium", "low"]),
|
|
19
|
+
reasoning: z.string(),
|
|
20
|
+
})),
|
|
21
|
+
suggestions: z.array(z.string()),
|
|
22
|
+
concerns: z.array(z.string()),
|
|
23
|
+
});
|
|
24
|
+
// ─── CatchupReport ───
|
|
25
|
+
export const CatchupReportSchema = z.object({
|
|
26
|
+
date: z.string(),
|
|
27
|
+
created_at: z.string(),
|
|
28
|
+
goals_reviewed: z.number().int().min(0),
|
|
29
|
+
progress_summary: z.string(),
|
|
30
|
+
completions: z.array(z.string()),
|
|
31
|
+
stalls: z.array(z.string()),
|
|
32
|
+
concerns: z.array(z.string()),
|
|
33
|
+
});
|
|
34
|
+
// ─── ConsolidationReport ───
|
|
35
|
+
export const ConsolidationReportSchema = z.object({
|
|
36
|
+
date: z.string(),
|
|
37
|
+
created_at: z.string(),
|
|
38
|
+
goals_consolidated: z.number().int().min(0),
|
|
39
|
+
entries_compressed: z.number().int().min(0),
|
|
40
|
+
stale_entries_found: z.number().int().min(0),
|
|
41
|
+
revalidation_tasks_created: z.number().int().min(0),
|
|
42
|
+
});
|
|
43
|
+
// ─── WeeklyReviewReport ───
|
|
44
|
+
export const WeeklyReviewReportSchema = z.object({
|
|
45
|
+
week: z.string(),
|
|
46
|
+
created_at: z.string(),
|
|
47
|
+
goals_reviewed: z.number().int().min(0),
|
|
48
|
+
rankings: z.array(z.object({
|
|
49
|
+
goal_id: z.string(),
|
|
50
|
+
progress_rate: z.number().min(0).max(1),
|
|
51
|
+
strategy_effectiveness: z.enum(["high", "medium", "low"]),
|
|
52
|
+
recommendation: z.string(),
|
|
53
|
+
})),
|
|
54
|
+
suggested_additions: z.array(z.string()),
|
|
55
|
+
suggested_removals: z.array(z.string()),
|
|
56
|
+
summary: z.string(),
|
|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AAC,CAAC,CAAC;CACpD,CAAC,CAAC;AAGH,6BAA6B;AAE7B,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,CAAC,CAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACvC,sBAAsB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;KAC3B,CAAC,CACH;IACD,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACxC,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StateManager } from "../state-manager.js";
|
|
2
|
+
import type { ILLMClient } from "../llm/llm-client.js";
|
|
3
|
+
import type { INotificationDispatcher } from "../runtime/notification-dispatcher.js";
|
|
4
|
+
import type { WeeklyReviewReport } from "./types.js";
|
|
5
|
+
export declare function runWeeklyReview(deps: {
|
|
6
|
+
stateManager: StateManager;
|
|
7
|
+
llmClient: ILLMClient;
|
|
8
|
+
baseDir: string;
|
|
9
|
+
notificationDispatcher?: INotificationDispatcher;
|
|
10
|
+
}): Promise<WeeklyReviewReport>;
|
|
11
|
+
//# sourceMappingURL=weekly-review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weekly-review.d.ts","sourceRoot":"","sources":["../../src/reflection/weekly-review.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA4CrD,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;CAClD,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAwF9B"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as fsp from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { writeJsonFileAtomic } from "../utils/json-io.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { WeeklyReviewReportSchema } from "./types.js";
|
|
6
|
+
// ─── LLM response schema ───
|
|
7
|
+
const LLMWeeklyResponseSchema = z.object({
|
|
8
|
+
rankings: z.array(z.object({
|
|
9
|
+
goal_id: z.string(),
|
|
10
|
+
progress_rate: z.number().min(0).max(1),
|
|
11
|
+
strategy_effectiveness: z.enum(["high", "medium", "low"]),
|
|
12
|
+
recommendation: z.string(),
|
|
13
|
+
})),
|
|
14
|
+
suggested_additions: z.array(z.string()).default([]),
|
|
15
|
+
suggested_removals: z.array(z.string()).default([]),
|
|
16
|
+
summary: z.string(),
|
|
17
|
+
});
|
|
18
|
+
// ─── Helpers ───
|
|
19
|
+
function getISOWeek(date) {
|
|
20
|
+
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
21
|
+
const day = d.getUTCDay() || 7;
|
|
22
|
+
d.setUTCDate(d.getUTCDate() + 4 - day);
|
|
23
|
+
const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
|
|
24
|
+
const week = Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);
|
|
25
|
+
return `${d.getUTCFullYear()}-W${String(week).padStart(2, "0")}`;
|
|
26
|
+
}
|
|
27
|
+
function computeWeeklyDelta(gapHistory) {
|
|
28
|
+
if (gapHistory.length < 2)
|
|
29
|
+
return 0;
|
|
30
|
+
const recent = gapHistory.at(-1);
|
|
31
|
+
const prior = gapHistory.at(-2);
|
|
32
|
+
const latest = Math.max(...recent.gap_vector.map((g) => g.normalized_weighted_gap));
|
|
33
|
+
const previous = Math.max(...prior.gap_vector.map((g) => g.normalized_weighted_gap));
|
|
34
|
+
// positive delta = gap is closing (progress)
|
|
35
|
+
return Math.min(1, Math.max(0, previous - latest));
|
|
36
|
+
}
|
|
37
|
+
// ─── Main ───
|
|
38
|
+
export async function runWeeklyReview(deps) {
|
|
39
|
+
const { stateManager, llmClient, baseDir, notificationDispatcher } = deps;
|
|
40
|
+
const now = new Date().toISOString();
|
|
41
|
+
const week = getISOWeek(new Date());
|
|
42
|
+
// Build per-goal summaries
|
|
43
|
+
const goalIds = await stateManager.listGoalIds();
|
|
44
|
+
const goalSummaries = [];
|
|
45
|
+
for (const id of goalIds) {
|
|
46
|
+
const goal = await stateManager.loadGoal(id);
|
|
47
|
+
if (!goal || goal.status !== "active")
|
|
48
|
+
continue;
|
|
49
|
+
const gapHistory = await stateManager.loadGapHistory(id);
|
|
50
|
+
const weekly_delta = computeWeeklyDelta(gapHistory);
|
|
51
|
+
goalSummaries.push({
|
|
52
|
+
goal_id: goal.id,
|
|
53
|
+
title: goal.title,
|
|
54
|
+
weekly_delta,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
let rankings = [];
|
|
58
|
+
let suggested_additions = [];
|
|
59
|
+
let suggested_removals = [];
|
|
60
|
+
let summary = "";
|
|
61
|
+
if (goalSummaries.length > 0) {
|
|
62
|
+
const prompt = `You are PulSeed's weekly reviewer. Analyze this week's goal progress and provide a strategic review.
|
|
63
|
+
|
|
64
|
+
Goals (weekly_delta = how much gap closed this week, 0-1):
|
|
65
|
+
${JSON.stringify(goalSummaries, null, 2)}
|
|
66
|
+
|
|
67
|
+
Rank each goal by progress_rate (0-1). Assess strategy_effectiveness (high/medium/low).
|
|
68
|
+
Suggest new goal additions or removals where appropriate.
|
|
69
|
+
Write a brief summary of the week.
|
|
70
|
+
|
|
71
|
+
Respond with JSON matching this schema:
|
|
72
|
+
{ "rankings": [{"goal_id": string, "progress_rate": number, "strategy_effectiveness": "high"|"medium"|"low", "recommendation": string}], "suggested_additions": [string], "suggested_removals": [string], "summary": string }`;
|
|
73
|
+
try {
|
|
74
|
+
const response = await llmClient.sendMessage([{ role: "user", content: prompt }]);
|
|
75
|
+
const parsed = llmClient.parseJSON(response.content, LLMWeeklyResponseSchema);
|
|
76
|
+
rankings = parsed.rankings;
|
|
77
|
+
suggested_additions = parsed.suggested_additions ?? [];
|
|
78
|
+
suggested_removals = parsed.suggested_removals ?? [];
|
|
79
|
+
summary = parsed.summary;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// LLM error — return partial report with empty rankings
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const report = WeeklyReviewReportSchema.parse({
|
|
86
|
+
week,
|
|
87
|
+
created_at: now,
|
|
88
|
+
goals_reviewed: goalSummaries.length,
|
|
89
|
+
rankings,
|
|
90
|
+
suggested_additions,
|
|
91
|
+
suggested_removals,
|
|
92
|
+
summary,
|
|
93
|
+
});
|
|
94
|
+
// Persist report
|
|
95
|
+
const reflectionsDir = path.join(baseDir, "reflections");
|
|
96
|
+
await fsp.mkdir(reflectionsDir, { recursive: true });
|
|
97
|
+
await writeJsonFileAtomic(path.join(reflectionsDir, `weekly-${week}.json`), report);
|
|
98
|
+
// Notify
|
|
99
|
+
if (notificationDispatcher && goalSummaries.length > 0) {
|
|
100
|
+
await notificationDispatcher.dispatch({
|
|
101
|
+
id: `weekly-review-${week}`,
|
|
102
|
+
report_type: "weekly_report",
|
|
103
|
+
goal_id: null,
|
|
104
|
+
title: `Weekly Review — ${week}`,
|
|
105
|
+
content: `Reviewed ${goalSummaries.length} goals. ${suggested_removals.length} removal(s) suggested.`,
|
|
106
|
+
verbosity: "standard",
|
|
107
|
+
generated_at: now,
|
|
108
|
+
delivered_at: null,
|
|
109
|
+
read: false,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return report;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=weekly-review.js.map
|