forge-openclaw-plugin 0.2.15 → 0.2.19
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 +39 -4
- package/dist/assets/{board-C_m78kvK.js → board-8L3uX7_O.js} +2 -2
- package/dist/assets/{board-C_m78kvK.js.map → board-8L3uX7_O.js.map} +1 -1
- package/dist/assets/index-Cj1IBH_w.js +36 -0
- package/dist/assets/index-Cj1IBH_w.js.map +1 -0
- package/dist/assets/index-DQT6EbuS.css +1 -0
- package/dist/assets/{motion-CpZvZumD.js → motion-1GAqqi8M.js} +2 -2
- package/dist/assets/{motion-CpZvZumD.js.map → motion-1GAqqi8M.js.map} +1 -1
- package/dist/assets/{table-DtyXTw03.js → table-DBGlgRjk.js} +2 -2
- package/dist/assets/{table-DtyXTw03.js.map → table-DBGlgRjk.js.map} +1 -1
- package/dist/assets/{ui-BXbpiKyS.js → ui-iTluWjC4.js} +2 -2
- package/dist/assets/{ui-BXbpiKyS.js.map → ui-iTluWjC4.js.map} +1 -1
- package/dist/assets/{vendor-QBH6qVEe.js → vendor-BvM2F9Dp.js} +151 -81
- package/dist/assets/vendor-BvM2F9Dp.js.map +1 -0
- package/dist/assets/{viz-w-IMeueL.js → viz-CNeunkfu.js} +2 -2
- package/dist/assets/{viz-w-IMeueL.js.map → viz-CNeunkfu.js.map} +1 -1
- package/dist/index.html +8 -8
- package/dist/openclaw/local-runtime.js +142 -9
- package/dist/openclaw/parity.js +1 -0
- package/dist/openclaw/plugin-entry-shared.js +7 -1
- package/dist/openclaw/routes.js +7 -0
- package/dist/openclaw/tools.js +198 -16
- package/dist/server/app.js +2615 -251
- package/dist/server/managers/platform/secrets-manager.js +44 -1
- package/dist/server/managers/runtime.js +3 -1
- package/dist/server/openapi.js +2212 -170
- package/dist/server/repositories/calendar.js +1101 -0
- package/dist/server/repositories/deleted-entities.js +10 -2
- package/dist/server/repositories/habits.js +358 -0
- package/dist/server/repositories/notes.js +161 -28
- package/dist/server/repositories/projects.js +45 -13
- package/dist/server/repositories/rewards.js +176 -6
- package/dist/server/repositories/settings.js +47 -5
- package/dist/server/repositories/task-runs.js +46 -10
- package/dist/server/repositories/tasks.js +25 -9
- package/dist/server/repositories/weekly-reviews.js +109 -0
- package/dist/server/repositories/work-adjustments.js +105 -0
- package/dist/server/services/calendar-runtime.js +1301 -0
- package/dist/server/services/context.js +16 -6
- package/dist/server/services/dashboard.js +6 -3
- package/dist/server/services/entity-crud.js +116 -3
- package/dist/server/services/gamification.js +66 -18
- package/dist/server/services/insights.js +2 -1
- package/dist/server/services/projects.js +32 -8
- package/dist/server/services/reviews.js +17 -2
- package/dist/server/services/work-time.js +27 -0
- package/dist/server/types.js +1069 -45
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/server/migrations/003_habits.sql +30 -0
- package/server/migrations/004_habit_links.sql +8 -0
- package/server/migrations/005_habit_psyche_links.sql +24 -0
- package/server/migrations/006_work_adjustments.sql +14 -0
- package/server/migrations/007_weekly_review_closures.sql +17 -0
- package/server/migrations/008_calendar_execution.sql +147 -0
- package/server/migrations/009_true_calendar_events.sql +195 -0
- package/server/migrations/010_calendar_selection_state.sql +6 -0
- package/server/migrations/011_calendar_timezone_backfill.sql +11 -0
- package/server/migrations/012_work_block_ranges.sql +7 -0
- package/server/migrations/013_microsoft_local_auth_settings.sql +8 -0
- package/server/migrations/014_note_tags_and_ephemeral.sql +8 -0
- package/skills/forge-openclaw/SKILL.md +130 -10
- package/skills/forge-openclaw/cron_jobs.md +395 -0
- package/dist/assets/index-BWtLtXwb.js +0 -36
- package/dist/assets/index-BWtLtXwb.js.map +0 -1
- package/dist/assets/index-Dp5GXY_z.css +0 -1
- package/dist/assets/vendor-QBH6qVEe.js.map +0 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { listActivityEvents } from "../repositories/activity-events.js";
|
|
2
2
|
import { listGoals } from "../repositories/goals.js";
|
|
3
|
+
import { listHabits } from "../repositories/habits.js";
|
|
3
4
|
import { listTasks } from "../repositories/tasks.js";
|
|
5
|
+
import { getWeeklyReviewClosure } from "../repositories/weekly-reviews.js";
|
|
4
6
|
import { buildGamificationProfile } from "./gamification.js";
|
|
5
7
|
import { weeklyReviewPayloadSchema } from "../types.js";
|
|
6
|
-
function startOfWeek(date) {
|
|
8
|
+
export function startOfWeek(date) {
|
|
7
9
|
const clone = new Date(date);
|
|
8
10
|
const day = clone.getDay();
|
|
9
11
|
const delta = day === 0 ? -6 : 1 - day;
|
|
@@ -19,6 +21,9 @@ function addDays(date, days) {
|
|
|
19
21
|
function formatRange(start, end) {
|
|
20
22
|
return `${start.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${end.toLocaleDateString("en-US", { month: "short", day: "numeric" })}`;
|
|
21
23
|
}
|
|
24
|
+
function toDateOnly(date) {
|
|
25
|
+
return date.toISOString().slice(0, 10);
|
|
26
|
+
}
|
|
22
27
|
function dailyBuckets(tasks, start) {
|
|
23
28
|
return Array.from({ length: 7 }, (_, index) => {
|
|
24
29
|
const current = addDays(start, index);
|
|
@@ -36,9 +41,11 @@ function dailyBuckets(tasks, start) {
|
|
|
36
41
|
export function getWeeklyReviewPayload(now = new Date()) {
|
|
37
42
|
const goals = listGoals();
|
|
38
43
|
const tasks = listTasks();
|
|
39
|
-
const gamification = buildGamificationProfile(goals, tasks, now);
|
|
44
|
+
const gamification = buildGamificationProfile(goals, tasks, listHabits(), now);
|
|
40
45
|
const weekStart = startOfWeek(now);
|
|
41
46
|
const weekEnd = addDays(weekStart, 6);
|
|
47
|
+
const weekKey = toDateOnly(weekStart);
|
|
48
|
+
const closure = getWeeklyReviewClosure(weekKey);
|
|
42
49
|
const weekTasks = tasks.filter((task) => task.updatedAt >= weekStart.toISOString() && task.updatedAt <= addDays(weekEnd, 1).toISOString());
|
|
43
50
|
const completedTasks = weekTasks.filter((task) => task.completedAt !== null);
|
|
44
51
|
const buckets = dailyBuckets(tasks, weekStart);
|
|
@@ -61,6 +68,9 @@ export function getWeeklyReviewPayload(now = new Date()) {
|
|
|
61
68
|
return weeklyReviewPayloadSchema.parse({
|
|
62
69
|
generatedAt: now.toISOString(),
|
|
63
70
|
windowLabel: formatRange(weekStart, weekEnd),
|
|
71
|
+
weekKey,
|
|
72
|
+
weekStartDate: weekKey,
|
|
73
|
+
weekEndDate: toDateOnly(weekEnd),
|
|
64
74
|
momentumSummary: {
|
|
65
75
|
totalXp,
|
|
66
76
|
focusHours: buckets.reduce((sum, bucket) => sum + bucket.focusHours, 0),
|
|
@@ -83,6 +93,11 @@ export function getWeeklyReviewPayload(now = new Date()) {
|
|
|
83
93
|
title: "Review Completion Bonus",
|
|
84
94
|
summary: "Finalizing the review locks the current cycle into evidence.",
|
|
85
95
|
rewardXp: 250
|
|
96
|
+
},
|
|
97
|
+
completion: {
|
|
98
|
+
finalized: closure !== null,
|
|
99
|
+
finalizedAt: closure?.createdAt ?? null,
|
|
100
|
+
finalizedBy: closure?.actor ?? null
|
|
86
101
|
}
|
|
87
102
|
});
|
|
88
103
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getDatabase } from "../db.js";
|
|
2
|
+
import { listTaskWorkAdjustmentSecondsMap } from "../repositories/work-adjustments.js";
|
|
2
3
|
function readTimeAccountingMode() {
|
|
3
4
|
try {
|
|
4
5
|
const row = getDatabase()
|
|
@@ -132,6 +133,9 @@ export function computeWorkTime(now = new Date()) {
|
|
|
132
133
|
const existing = taskSummaries.get(timing.row.task_id) ?? {
|
|
133
134
|
totalTrackedSeconds: 0,
|
|
134
135
|
totalCreditedSeconds: 0,
|
|
136
|
+
liveTrackedSeconds: 0,
|
|
137
|
+
liveCreditedSeconds: 0,
|
|
138
|
+
manualAdjustedSeconds: 0,
|
|
135
139
|
activeRunCount: 0,
|
|
136
140
|
hasCurrentRun: false,
|
|
137
141
|
currentRunId: null
|
|
@@ -139,11 +143,28 @@ export function computeWorkTime(now = new Date()) {
|
|
|
139
143
|
taskSummaries.set(timing.row.task_id, {
|
|
140
144
|
totalTrackedSeconds: existing.totalTrackedSeconds + elapsedWallSeconds,
|
|
141
145
|
totalCreditedSeconds: roundCreditedSeconds(existing.totalCreditedSeconds + creditedSeconds),
|
|
146
|
+
liveTrackedSeconds: existing.liveTrackedSeconds + elapsedWallSeconds,
|
|
147
|
+
liveCreditedSeconds: roundCreditedSeconds(existing.liveCreditedSeconds + creditedSeconds),
|
|
148
|
+
manualAdjustedSeconds: existing.manualAdjustedSeconds,
|
|
142
149
|
activeRunCount: existing.activeRunCount + (timing.row.status === "active" ? 1 : 0),
|
|
143
150
|
hasCurrentRun: existing.hasCurrentRun || isCurrent,
|
|
144
151
|
currentRunId: isCurrent ? timing.row.id : existing.currentRunId
|
|
145
152
|
});
|
|
146
153
|
}
|
|
154
|
+
const adjustmentSecondsByTaskId = listTaskWorkAdjustmentSecondsMap();
|
|
155
|
+
for (const [taskId, adjustmentSeconds] of adjustmentSecondsByTaskId.entries()) {
|
|
156
|
+
const existing = taskSummaries.get(taskId) ?? emptyTaskTimeSummary();
|
|
157
|
+
taskSummaries.set(taskId, {
|
|
158
|
+
totalTrackedSeconds: Math.max(0, existing.totalTrackedSeconds + adjustmentSeconds),
|
|
159
|
+
totalCreditedSeconds: roundCreditedSeconds(Math.max(0, existing.totalCreditedSeconds + adjustmentSeconds)),
|
|
160
|
+
liveTrackedSeconds: existing.liveTrackedSeconds,
|
|
161
|
+
liveCreditedSeconds: existing.liveCreditedSeconds,
|
|
162
|
+
manualAdjustedSeconds: existing.manualAdjustedSeconds + adjustmentSeconds,
|
|
163
|
+
activeRunCount: existing.activeRunCount,
|
|
164
|
+
hasCurrentRun: existing.hasCurrentRun,
|
|
165
|
+
currentRunId: existing.currentRunId
|
|
166
|
+
});
|
|
167
|
+
}
|
|
147
168
|
return {
|
|
148
169
|
mode,
|
|
149
170
|
runMetrics,
|
|
@@ -154,6 +175,9 @@ export function emptyTaskTimeSummary() {
|
|
|
154
175
|
return {
|
|
155
176
|
totalTrackedSeconds: 0,
|
|
156
177
|
totalCreditedSeconds: 0,
|
|
178
|
+
liveTrackedSeconds: 0,
|
|
179
|
+
liveCreditedSeconds: 0,
|
|
180
|
+
manualAdjustedSeconds: 0,
|
|
157
181
|
activeRunCount: 0,
|
|
158
182
|
hasCurrentRun: false,
|
|
159
183
|
currentRunId: null
|
|
@@ -168,6 +192,9 @@ export function sumTaskTimeSummaries(taskIds, summaries) {
|
|
|
168
192
|
return {
|
|
169
193
|
totalTrackedSeconds: accumulator.totalTrackedSeconds + summary.totalTrackedSeconds,
|
|
170
194
|
totalCreditedSeconds: roundCreditedSeconds(accumulator.totalCreditedSeconds + summary.totalCreditedSeconds),
|
|
195
|
+
liveTrackedSeconds: accumulator.liveTrackedSeconds + summary.liveTrackedSeconds,
|
|
196
|
+
liveCreditedSeconds: roundCreditedSeconds(accumulator.liveCreditedSeconds + summary.liveCreditedSeconds),
|
|
197
|
+
manualAdjustedSeconds: accumulator.manualAdjustedSeconds + summary.manualAdjustedSeconds,
|
|
171
198
|
activeRunCount: accumulator.activeRunCount + summary.activeRunCount,
|
|
172
199
|
hasCurrentRun: accumulator.hasCurrentRun || summary.hasCurrentRun,
|
|
173
200
|
currentRunId: accumulator.currentRunId ?? summary.currentRunId
|