forge-openclaw-plugin 0.2.7 → 0.2.10
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 +73 -1
- package/dist/assets/{board-CzgvdLO8.js → board-C_m78kvK.js} +2 -2
- package/dist/assets/{board-CzgvdLO8.js.map → board-C_m78kvK.js.map} +1 -1
- package/dist/assets/index-BWtLtXwb.js +36 -0
- package/dist/assets/index-BWtLtXwb.js.map +1 -0
- package/dist/assets/index-Dp5GXY_z.css +1 -0
- package/dist/assets/{motion-STUd1O46.js → motion-CpZvZumD.js} +2 -2
- package/dist/assets/{motion-STUd1O46.js.map → motion-CpZvZumD.js.map} +1 -1
- package/dist/assets/{table-CtNlETLc.js → table-DtyXTw03.js} +2 -2
- package/dist/assets/{table-CtNlETLc.js.map → table-DtyXTw03.js.map} +1 -1
- package/dist/assets/{ui-ThzkR_oW.js → ui-BXbpiKyS.js} +2 -2
- package/dist/assets/{ui-ThzkR_oW.js.map → ui-BXbpiKyS.js.map} +1 -1
- package/dist/assets/{vendor-DyHAI6nk.js → vendor-QBH6qVEe.js} +84 -74
- package/dist/assets/vendor-QBH6qVEe.js.map +1 -0
- package/dist/assets/{viz-BJuBCz_G.js → viz-w-IMeueL.js} +2 -2
- package/dist/assets/{viz-BJuBCz_G.js.map → viz-w-IMeueL.js.map} +1 -1
- package/dist/index.html +8 -8
- package/dist/openclaw/api-client.d.ts +1 -0
- package/dist/openclaw/local-runtime.js +2 -1
- package/dist/openclaw/plugin-entry-shared.js +12 -0
- package/dist/server/app.js +104 -67
- package/dist/server/demo-data.js +49 -0
- package/dist/server/openapi.js +84 -43
- package/dist/server/psyche-types.js +1 -30
- package/dist/server/repositories/deleted-entities.js +60 -26
- package/dist/server/repositories/goals.js +2 -5
- package/dist/server/repositories/notes.js +359 -0
- package/dist/server/repositories/projects.js +2 -5
- package/dist/server/repositories/psyche.js +11 -14
- package/dist/server/repositories/task-runs.js +2 -0
- package/dist/server/repositories/tasks.js +21 -10
- package/dist/server/seed-demo.js +11 -0
- package/dist/server/services/dashboard.js +4 -1
- package/dist/server/services/entity-crud.js +27 -30
- package/dist/server/services/insights.js +5 -5
- package/dist/server/services/projects.js +3 -1
- package/dist/server/services/psyche.js +4 -4
- package/dist/server/types.js +70 -11
- package/openclaw.plugin.json +12 -1
- package/package.json +1 -1
- package/server/migrations/001_core.sql +78 -0
- package/server/migrations/002_psyche.sql +164 -13
- package/skills/forge-openclaw/SKILL.md +17 -5
- package/dist/assets/index-8d_oM8fL.js +0 -27
- package/dist/assets/index-8d_oM8fL.js.map +0 -1
- package/dist/assets/index-D4A_bq8m.css +0 -1
- package/dist/assets/vendor-DyHAI6nk.js.map +0 -1
- package/dist/server/repositories/comments.js +0 -176
- package/server/migrations/003_timer_execution.sql +0 -18
- package/server/migrations/004_psyche_linked_entities.sql +0 -5
- package/server/migrations/005_adaptive_schemas.sql +0 -157
- package/server/migrations/006_psyche_auth_setting.sql +0 -4
- package/server/migrations/007_deleted_entities.sql +0 -16
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { getDatabase } from "../db.js";
|
|
3
|
-
import { filterDeletedEntities, isEntityDeleted } from "./deleted-entities.js";
|
|
4
|
-
import { recordActivityEvent } from "./activity-events.js";
|
|
5
|
-
import { recordEventLog } from "./event-log.js";
|
|
6
|
-
import { commentSchema, commentsListQuerySchema, createCommentSchema, updateCommentSchema } from "../psyche-types.js";
|
|
7
|
-
import { activityEntityTypeSchema } from "../types.js";
|
|
8
|
-
function mapComment(row) {
|
|
9
|
-
return commentSchema.parse({
|
|
10
|
-
id: row.id,
|
|
11
|
-
entityType: row.entity_type,
|
|
12
|
-
entityId: row.entity_id,
|
|
13
|
-
anchorKey: row.anchor_key,
|
|
14
|
-
body: row.body,
|
|
15
|
-
author: row.author,
|
|
16
|
-
source: row.source,
|
|
17
|
-
createdAt: row.created_at,
|
|
18
|
-
updatedAt: row.updated_at
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function getCommentRow(commentId) {
|
|
22
|
-
return getDatabase()
|
|
23
|
-
.prepare(`SELECT id, entity_type, entity_id, anchor_key, body, author, source, created_at, updated_at
|
|
24
|
-
FROM entity_comments
|
|
25
|
-
WHERE id = ?`)
|
|
26
|
-
.get(commentId);
|
|
27
|
-
}
|
|
28
|
-
export function getCommentById(commentId) {
|
|
29
|
-
if (isEntityDeleted("comment", commentId)) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
const row = getCommentRow(commentId);
|
|
33
|
-
return row ? mapComment(row) : undefined;
|
|
34
|
-
}
|
|
35
|
-
export function listComments(query = {}) {
|
|
36
|
-
const parsed = commentsListQuerySchema.parse(query);
|
|
37
|
-
const whereClauses = [];
|
|
38
|
-
const params = [];
|
|
39
|
-
if (parsed.entityType) {
|
|
40
|
-
whereClauses.push("entity_type = ?");
|
|
41
|
-
params.push(parsed.entityType);
|
|
42
|
-
}
|
|
43
|
-
if (parsed.entityId) {
|
|
44
|
-
whereClauses.push("entity_id = ?");
|
|
45
|
-
params.push(parsed.entityId);
|
|
46
|
-
}
|
|
47
|
-
const whereSql = whereClauses.length > 0 ? `WHERE ${whereClauses.join(" AND ")}` : "";
|
|
48
|
-
const limitSql = parsed.limit ? "LIMIT ?" : "";
|
|
49
|
-
if (parsed.limit) {
|
|
50
|
-
params.push(parsed.limit);
|
|
51
|
-
}
|
|
52
|
-
const rows = getDatabase()
|
|
53
|
-
.prepare(`SELECT id, entity_type, entity_id, anchor_key, body, author, source, created_at, updated_at
|
|
54
|
-
FROM entity_comments
|
|
55
|
-
${whereSql}
|
|
56
|
-
ORDER BY created_at DESC
|
|
57
|
-
${limitSql}`)
|
|
58
|
-
.all(...params);
|
|
59
|
-
return filterDeletedEntities("comment", rows.map(mapComment));
|
|
60
|
-
}
|
|
61
|
-
export function createComment(input, context) {
|
|
62
|
-
const parsed = createCommentSchema.parse(input);
|
|
63
|
-
const now = new Date().toISOString();
|
|
64
|
-
const comment = commentSchema.parse({
|
|
65
|
-
id: `cmt_${randomUUID().replaceAll("-", "").slice(0, 10)}`,
|
|
66
|
-
entityType: parsed.entityType,
|
|
67
|
-
entityId: parsed.entityId,
|
|
68
|
-
anchorKey: parsed.anchorKey,
|
|
69
|
-
body: parsed.body,
|
|
70
|
-
author: parsed.author ?? context.actor ?? null,
|
|
71
|
-
source: context.source,
|
|
72
|
-
createdAt: now,
|
|
73
|
-
updatedAt: now
|
|
74
|
-
});
|
|
75
|
-
const entityType = activityEntityTypeSchema.parse(comment.entityType);
|
|
76
|
-
getDatabase()
|
|
77
|
-
.prepare(`INSERT INTO entity_comments (id, entity_type, entity_id, anchor_key, body, author, source, created_at, updated_at)
|
|
78
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
79
|
-
.run(comment.id, comment.entityType, comment.entityId, comment.anchorKey, comment.body, comment.author, comment.source, comment.createdAt, comment.updatedAt);
|
|
80
|
-
recordActivityEvent({
|
|
81
|
-
entityType,
|
|
82
|
-
entityId: comment.entityId,
|
|
83
|
-
eventType: "comment.created",
|
|
84
|
-
title: "Comment added",
|
|
85
|
-
description: comment.body,
|
|
86
|
-
actor: comment.author ?? null,
|
|
87
|
-
source: context.source,
|
|
88
|
-
metadata: {
|
|
89
|
-
commentId: comment.id,
|
|
90
|
-
anchorKey: comment.anchorKey ?? ""
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
recordEventLog({
|
|
94
|
-
eventKind: "comment.created",
|
|
95
|
-
entityType,
|
|
96
|
-
entityId: comment.entityId,
|
|
97
|
-
actor: comment.author ?? null,
|
|
98
|
-
source: context.source,
|
|
99
|
-
metadata: {
|
|
100
|
-
commentId: comment.id,
|
|
101
|
-
anchorKey: comment.anchorKey ?? ""
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
return comment;
|
|
105
|
-
}
|
|
106
|
-
export function updateComment(commentId, input, context) {
|
|
107
|
-
const existing = getCommentRow(commentId);
|
|
108
|
-
if (!existing) {
|
|
109
|
-
return undefined;
|
|
110
|
-
}
|
|
111
|
-
const patch = updateCommentSchema.parse(input);
|
|
112
|
-
const updatedAt = new Date().toISOString();
|
|
113
|
-
const author = patch.author ?? existing.author ?? context.actor ?? null;
|
|
114
|
-
const entityType = activityEntityTypeSchema.parse(existing.entity_type);
|
|
115
|
-
getDatabase()
|
|
116
|
-
.prepare(`UPDATE entity_comments
|
|
117
|
-
SET body = ?, author = ?, updated_at = ?
|
|
118
|
-
WHERE id = ?`)
|
|
119
|
-
.run(patch.body, author, updatedAt, commentId);
|
|
120
|
-
recordActivityEvent({
|
|
121
|
-
entityType,
|
|
122
|
-
entityId: existing.entity_id,
|
|
123
|
-
eventType: "comment.updated",
|
|
124
|
-
title: "Comment updated",
|
|
125
|
-
description: patch.body,
|
|
126
|
-
actor: author,
|
|
127
|
-
source: context.source,
|
|
128
|
-
metadata: {
|
|
129
|
-
commentId
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
recordEventLog({
|
|
133
|
-
eventKind: "comment.updated",
|
|
134
|
-
entityType,
|
|
135
|
-
entityId: existing.entity_id,
|
|
136
|
-
actor: author,
|
|
137
|
-
source: context.source,
|
|
138
|
-
metadata: {
|
|
139
|
-
commentId
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
return mapComment(getCommentRow(commentId));
|
|
143
|
-
}
|
|
144
|
-
export function deleteComment(commentId, context) {
|
|
145
|
-
const existing = getCommentRow(commentId);
|
|
146
|
-
if (!existing) {
|
|
147
|
-
return undefined;
|
|
148
|
-
}
|
|
149
|
-
const entityType = activityEntityTypeSchema.parse(existing.entity_type);
|
|
150
|
-
getDatabase()
|
|
151
|
-
.prepare(`DELETE FROM entity_comments WHERE id = ?`)
|
|
152
|
-
.run(commentId);
|
|
153
|
-
recordActivityEvent({
|
|
154
|
-
entityType,
|
|
155
|
-
entityId: existing.entity_id,
|
|
156
|
-
eventType: "comment.deleted",
|
|
157
|
-
title: "Comment deleted",
|
|
158
|
-
description: existing.body,
|
|
159
|
-
actor: context.actor ?? existing.author ?? null,
|
|
160
|
-
source: context.source,
|
|
161
|
-
metadata: {
|
|
162
|
-
commentId
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
recordEventLog({
|
|
166
|
-
eventKind: "comment.deleted",
|
|
167
|
-
entityType,
|
|
168
|
-
entityId: existing.entity_id,
|
|
169
|
-
actor: context.actor ?? existing.author ?? null,
|
|
170
|
-
source: context.source,
|
|
171
|
-
metadata: {
|
|
172
|
-
commentId
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
return mapComment(existing);
|
|
176
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
ALTER TABLE task_runs ADD COLUMN timer_mode TEXT NOT NULL DEFAULT 'unlimited';
|
|
2
|
-
ALTER TABLE task_runs ADD COLUMN planned_duration_seconds INTEGER;
|
|
3
|
-
ALTER TABLE task_runs ADD COLUMN is_current INTEGER NOT NULL DEFAULT 0;
|
|
4
|
-
|
|
5
|
-
UPDATE task_runs
|
|
6
|
-
SET timer_mode = 'unlimited',
|
|
7
|
-
planned_duration_seconds = NULL
|
|
8
|
-
WHERE timer_mode IS NULL OR timer_mode = '';
|
|
9
|
-
|
|
10
|
-
ALTER TABLE app_settings ADD COLUMN max_active_tasks INTEGER NOT NULL DEFAULT 2;
|
|
11
|
-
ALTER TABLE app_settings ADD COLUMN time_accounting_mode TEXT NOT NULL DEFAULT 'split';
|
|
12
|
-
|
|
13
|
-
CREATE INDEX IF NOT EXISTS idx_task_runs_actor_status_claimed
|
|
14
|
-
ON task_runs(actor, status, claimed_at);
|
|
15
|
-
|
|
16
|
-
CREATE UNIQUE INDEX IF NOT EXISTS idx_task_runs_single_current_per_actor
|
|
17
|
-
ON task_runs(actor)
|
|
18
|
-
WHERE status = 'active' AND is_current = 1;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
ALTER TABLE schema_catalog
|
|
2
|
-
ADD COLUMN schema_type TEXT NOT NULL DEFAULT 'maladaptive';
|
|
3
|
-
|
|
4
|
-
UPDATE schema_catalog
|
|
5
|
-
SET schema_type = 'maladaptive'
|
|
6
|
-
WHERE schema_type IS NULL OR trim(schema_type) = '';
|
|
7
|
-
|
|
8
|
-
INSERT OR IGNORE INTO schema_catalog (
|
|
9
|
-
id,
|
|
10
|
-
slug,
|
|
11
|
-
title,
|
|
12
|
-
family,
|
|
13
|
-
description,
|
|
14
|
-
schema_type,
|
|
15
|
-
created_at,
|
|
16
|
-
updated_at
|
|
17
|
-
) VALUES
|
|
18
|
-
(
|
|
19
|
-
'schema_adaptive_stable_attachment',
|
|
20
|
-
'stable_attachment',
|
|
21
|
-
'Stable Attachment',
|
|
22
|
-
'disconnection_rejection',
|
|
23
|
-
'The belief that your close relationships are stable, loyal, and enduring.',
|
|
24
|
-
'adaptive',
|
|
25
|
-
CURRENT_TIMESTAMP,
|
|
26
|
-
CURRENT_TIMESTAMP
|
|
27
|
-
),
|
|
28
|
-
(
|
|
29
|
-
'schema_adaptive_emotional_fulfilment',
|
|
30
|
-
'emotional_fulfilment',
|
|
31
|
-
'Emotional Fulfilment',
|
|
32
|
-
'disconnection_rejection',
|
|
33
|
-
'The belief that someone in your life can meet your needs for care, attachment, and emotional safety.',
|
|
34
|
-
'adaptive',
|
|
35
|
-
CURRENT_TIMESTAMP,
|
|
36
|
-
CURRENT_TIMESTAMP
|
|
37
|
-
),
|
|
38
|
-
(
|
|
39
|
-
'schema_adaptive_social_belonging',
|
|
40
|
-
'social_belonging',
|
|
41
|
-
'Social Belonging',
|
|
42
|
-
'disconnection_rejection',
|
|
43
|
-
'The belief that you belong, fit in, and are accepted in groups and relationships.',
|
|
44
|
-
'adaptive',
|
|
45
|
-
CURRENT_TIMESTAMP,
|
|
46
|
-
CURRENT_TIMESTAMP
|
|
47
|
-
),
|
|
48
|
-
(
|
|
49
|
-
'schema_adaptive_competence',
|
|
50
|
-
'competence',
|
|
51
|
-
'Competence',
|
|
52
|
-
'impaired_autonomy',
|
|
53
|
-
'The belief that you can handle daily problems, make decisions, and function capably in ordinary life.',
|
|
54
|
-
'adaptive',
|
|
55
|
-
CURRENT_TIMESTAMP,
|
|
56
|
-
CURRENT_TIMESTAMP
|
|
57
|
-
),
|
|
58
|
-
(
|
|
59
|
-
'schema_adaptive_developed_self',
|
|
60
|
-
'developed_self',
|
|
61
|
-
'Developed Self',
|
|
62
|
-
'impaired_autonomy',
|
|
63
|
-
'The belief that you can live as your own person with mature boundaries and healthy independence from your parents.',
|
|
64
|
-
'adaptive',
|
|
65
|
-
CURRENT_TIMESTAMP,
|
|
66
|
-
CURRENT_TIMESTAMP
|
|
67
|
-
),
|
|
68
|
-
(
|
|
69
|
-
'schema_adaptive_success',
|
|
70
|
-
'success',
|
|
71
|
-
'Success',
|
|
72
|
-
'impaired_autonomy',
|
|
73
|
-
'The belief that you are capable, effective, and able to do well in work, study, and achievement settings.',
|
|
74
|
-
'adaptive',
|
|
75
|
-
CURRENT_TIMESTAMP,
|
|
76
|
-
CURRENT_TIMESTAMP
|
|
77
|
-
),
|
|
78
|
-
(
|
|
79
|
-
'schema_adaptive_empathic_consideration',
|
|
80
|
-
'empathic_consideration',
|
|
81
|
-
'Empathic Consideration',
|
|
82
|
-
'other_directedness',
|
|
83
|
-
'The belief that other people matter too and that you can respect different views without losing yourself.',
|
|
84
|
-
'adaptive',
|
|
85
|
-
CURRENT_TIMESTAMP,
|
|
86
|
-
CURRENT_TIMESTAMP
|
|
87
|
-
),
|
|
88
|
-
(
|
|
89
|
-
'schema_adaptive_healthy_self_discipline',
|
|
90
|
-
'healthy_self_discipline',
|
|
91
|
-
'Healthy Self-Discipline',
|
|
92
|
-
'overvigilance_inhibition',
|
|
93
|
-
'The ability to stay with routines, persist through difficulty, and trade short-term comfort for long-term aims.',
|
|
94
|
-
'adaptive',
|
|
95
|
-
CURRENT_TIMESTAMP,
|
|
96
|
-
CURRENT_TIMESTAMP
|
|
97
|
-
),
|
|
98
|
-
(
|
|
99
|
-
'schema_adaptive_healthy_self_care',
|
|
100
|
-
'healthy_self_care',
|
|
101
|
-
'Healthy Self-Care',
|
|
102
|
-
'other_directedness',
|
|
103
|
-
'The belief that your own needs matter too and that making room for rest, care, and boundaries is legitimate.',
|
|
104
|
-
'adaptive',
|
|
105
|
-
CURRENT_TIMESTAMP,
|
|
106
|
-
CURRENT_TIMESTAMP
|
|
107
|
-
),
|
|
108
|
-
(
|
|
109
|
-
'schema_adaptive_self_directedness',
|
|
110
|
-
'self_directedness',
|
|
111
|
-
'Self-Directedness',
|
|
112
|
-
'healthy_selfhood',
|
|
113
|
-
'The belief that your own view of yourself matters more than performing for approval or admiration.',
|
|
114
|
-
'adaptive',
|
|
115
|
-
CURRENT_TIMESTAMP,
|
|
116
|
-
CURRENT_TIMESTAMP
|
|
117
|
-
),
|
|
118
|
-
(
|
|
119
|
-
'schema_adaptive_optimism',
|
|
120
|
-
'optimism',
|
|
121
|
-
'Optimism',
|
|
122
|
-
'healthy_selfhood',
|
|
123
|
-
'The belief that good outcomes are possible and that life does not need to be ruled by catastrophe.',
|
|
124
|
-
'adaptive',
|
|
125
|
-
CURRENT_TIMESTAMP,
|
|
126
|
-
CURRENT_TIMESTAMP
|
|
127
|
-
),
|
|
128
|
-
(
|
|
129
|
-
'schema_adaptive_emotional_openness',
|
|
130
|
-
'emotional_openness',
|
|
131
|
-
'Emotional Openness',
|
|
132
|
-
'healthy_selfhood',
|
|
133
|
-
'The willingness to express feelings, affection, and emotional truth with people you trust.',
|
|
134
|
-
'adaptive',
|
|
135
|
-
CURRENT_TIMESTAMP,
|
|
136
|
-
CURRENT_TIMESTAMP
|
|
137
|
-
),
|
|
138
|
-
(
|
|
139
|
-
'schema_adaptive_realistic_expectations',
|
|
140
|
-
'realistic_expectations',
|
|
141
|
-
'Realistic Expectations',
|
|
142
|
-
'overvigilance_inhibition',
|
|
143
|
-
'The belief that good enough is acceptable, goals can be realistic, and mistakes do not cancel your worth.',
|
|
144
|
-
'adaptive',
|
|
145
|
-
CURRENT_TIMESTAMP,
|
|
146
|
-
CURRENT_TIMESTAMP
|
|
147
|
-
),
|
|
148
|
-
(
|
|
149
|
-
'schema_adaptive_self_compassion',
|
|
150
|
-
'self_compassion',
|
|
151
|
-
'Self-Compassion',
|
|
152
|
-
'overvigilance_inhibition',
|
|
153
|
-
'The belief that you deserve kindness, forgiveness, and humane self-talk when you struggle or make mistakes.',
|
|
154
|
-
'adaptive',
|
|
155
|
-
CURRENT_TIMESTAMP,
|
|
156
|
-
CURRENT_TIMESTAMP
|
|
157
|
-
);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
-- Add optional psyche auth enforcement setting.
|
|
2
|
-
-- When 0 (default), psyche routes are open like goals/tasks routes.
|
|
3
|
-
-- When 1, psyche routes require scoped token or operator session.
|
|
4
|
-
ALTER TABLE app_settings ADD COLUMN psyche_auth_required INTEGER NOT NULL DEFAULT 0;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
-- Shared soft-delete/bin store for user-facing entities.
|
|
2
|
-
CREATE TABLE deleted_entities (
|
|
3
|
-
entity_type TEXT NOT NULL,
|
|
4
|
-
entity_id TEXT NOT NULL,
|
|
5
|
-
title TEXT NOT NULL,
|
|
6
|
-
subtitle TEXT NOT NULL DEFAULT '',
|
|
7
|
-
deleted_at TEXT NOT NULL,
|
|
8
|
-
deleted_by_actor TEXT,
|
|
9
|
-
deleted_source TEXT NOT NULL,
|
|
10
|
-
delete_reason TEXT NOT NULL DEFAULT '',
|
|
11
|
-
snapshot_json TEXT NOT NULL,
|
|
12
|
-
PRIMARY KEY (entity_type, entity_id)
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
CREATE INDEX idx_deleted_entities_deleted_at
|
|
16
|
-
ON deleted_entities (deleted_at DESC);
|