forge-openclaw-plugin 0.2.26 → 0.2.27
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 +59 -3
- package/dist/assets/{board-ta0rUHOf.js → board-C6jCchjI.js} +2 -2
- package/dist/assets/{board-ta0rUHOf.js.map → board-C6jCchjI.js.map} +1 -1
- package/dist/assets/index-DVvS8iiU.css +1 -0
- package/dist/assets/index-zYB-9Dfo.js +85 -0
- package/dist/assets/index-zYB-9Dfo.js.map +1 -0
- package/dist/assets/knowledge-graph-layout.worker-DRvzPxhP.js +2 -0
- package/dist/assets/knowledge-graph-layout.worker-DRvzPxhP.js.map +1 -0
- package/dist/assets/{motion-fBKPB6yw.js → motion-DFHrH2rd.js} +2 -2
- package/dist/assets/{motion-fBKPB6yw.js.map → motion-DFHrH2rd.js.map} +1 -1
- package/dist/assets/{table-C-IGTQni.js → table-ZL7Di_u3.js} +2 -2
- package/dist/assets/{table-C-IGTQni.js.map → table-ZL7Di_u3.js.map} +1 -1
- package/dist/assets/{ui-DInOpaYF.js → ui-CKNPpz7q.js} +2 -2
- package/dist/assets/{ui-DInOpaYF.js.map → ui-CKNPpz7q.js.map} +1 -1
- package/dist/assets/vendor-DoNZuFhn.js +1247 -0
- package/dist/assets/vendor-DoNZuFhn.js.map +1 -0
- package/dist/index.html +7 -7
- package/dist/openclaw/local-runtime.js +16 -0
- package/dist/openclaw/routes.d.ts +27 -0
- package/dist/openclaw/routes.js +16 -12
- package/dist/server/server/migrations/037_workbench_public_inputs_and_run_inputs.sql +5 -0
- package/dist/server/server/migrations/038_data_management_settings.sql +11 -0
- package/dist/server/server/migrations/039_life_force_and_action_points.sql +114 -0
- package/dist/server/server/migrations/040_screen_time_domain.sql +89 -0
- package/dist/server/server/migrations/041_companion_source_states.sql +21 -0
- package/dist/server/server/migrations/042_movement_boxes.sql +47 -0
- package/dist/server/server/migrations/043_movement_box_overlap_overrides.sql +26 -0
- package/dist/server/server/src/app.js +1684 -117
- package/dist/server/server/src/connectors/box-registry.js +44 -9
- package/dist/server/server/src/data-management-types.js +107 -0
- package/dist/server/server/src/db.js +68 -4
- package/dist/server/server/src/demo-data.js +2 -2
- package/dist/server/server/src/health.js +702 -18
- package/dist/server/server/src/managers/platform/llm-manager.js +7 -4
- package/dist/server/server/src/managers/platform/mock-workbench-provider.js +149 -0
- package/dist/server/server/src/managers/platform/secrets-manager.js +18 -1
- package/dist/server/server/src/managers/runtime.js +9 -0
- package/dist/server/server/src/movement.js +1971 -112
- package/dist/server/server/src/openapi.js +489 -1
- package/dist/server/server/src/psyche-types.js +9 -1
- package/dist/server/server/src/repositories/activity-events.js +8 -0
- package/dist/server/server/src/repositories/ai-connectors.js +522 -74
- package/dist/server/server/src/repositories/habits.js +37 -1
- package/dist/server/server/src/repositories/model-settings.js +13 -3
- package/dist/server/server/src/repositories/notes.js +3 -0
- package/dist/server/server/src/repositories/settings.js +380 -18
- package/dist/server/server/src/repositories/tasks.js +170 -10
- package/dist/server/server/src/runtime-data-root.js +82 -0
- package/dist/server/server/src/screen-time.js +802 -0
- package/dist/server/server/src/services/data-management.js +788 -0
- package/dist/server/server/src/services/entity-crud.js +205 -2
- package/dist/server/server/src/services/knowledge-graph.js +1455 -0
- package/dist/server/server/src/services/life-force-model.js +197 -0
- package/dist/server/server/src/services/life-force.js +1270 -0
- package/dist/server/server/src/services/psyche-observation-calendar.js +383 -16
- package/dist/server/server/src/types.js +286 -13
- package/dist/server/server/src/web.js +228 -13
- package/dist/server/src/components/customization/utility-widgets.js +136 -27
- package/dist/server/src/components/ui/info-tooltip.js +25 -0
- package/dist/server/src/components/workbench-boxes/calendar/calendar-boxes.js +78 -0
- package/dist/server/src/components/workbench-boxes/goals/goals-boxes.js +62 -0
- package/dist/server/src/components/workbench-boxes/habits/habits-boxes.js +62 -0
- package/dist/server/src/components/workbench-boxes/health/health-boxes.js +63 -8
- package/dist/server/src/components/workbench-boxes/insights/insights-boxes.js +50 -0
- package/dist/server/src/components/workbench-boxes/kanban/kanban-boxes.js +62 -54
- package/dist/server/src/components/workbench-boxes/movement/movement-boxes.js +18 -8
- package/dist/server/src/components/workbench-boxes/notes/notes-boxes.js +56 -38
- package/dist/server/src/components/workbench-boxes/overview/overview-boxes.js +65 -0
- package/dist/server/src/components/workbench-boxes/preferences/preferences-boxes.js +78 -0
- package/dist/server/src/components/workbench-boxes/projects/projects-boxes.js +35 -30
- package/dist/server/src/components/workbench-boxes/psyche/psyche-boxes.js +88 -0
- package/dist/server/src/components/workbench-boxes/questionnaires/questionnaires-boxes.js +61 -0
- package/dist/server/src/components/workbench-boxes/review/review-boxes.js +53 -0
- package/dist/server/src/components/workbench-boxes/shared/define-workbench-box.js +3 -1
- package/dist/server/src/components/workbench-boxes/shared/generic-node-view.js +39 -3
- package/dist/server/src/components/workbench-boxes/strategies/strategies-boxes.js +62 -0
- package/dist/server/src/components/workbench-boxes/tasks/tasks-boxes.js +76 -0
- package/dist/server/src/components/workbench-boxes/today/today-boxes.js +47 -32
- package/dist/server/src/components/workbench-boxes/wiki/wiki-boxes.js +60 -0
- package/dist/server/src/lib/api.js +280 -21
- package/dist/server/src/lib/data-management-types.js +1 -0
- package/dist/server/src/lib/entity-visuals.js +279 -0
- package/dist/server/src/lib/knowledge-graph-types.js +276 -0
- package/dist/server/src/lib/knowledge-graph.js +470 -0
- package/dist/server/src/lib/schemas.js +4 -0
- package/dist/server/src/lib/snapshot-normalizer.js +43 -1
- package/dist/server/src/lib/workbench/contracts.js +229 -0
- package/dist/server/src/lib/workbench/nodes.js +200 -0
- package/dist/server/src/lib/workbench/registry.js +52 -5
- package/dist/server/src/lib/workbench/runtime.js +254 -38
- package/dist/server/src/lib/workbench/tool-catalog.js +68 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/server/migrations/037_workbench_public_inputs_and_run_inputs.sql +5 -0
- package/server/migrations/038_data_management_settings.sql +11 -0
- package/server/migrations/039_life_force_and_action_points.sql +114 -0
- package/server/migrations/040_screen_time_domain.sql +89 -0
- package/server/migrations/041_companion_source_states.sql +21 -0
- package/server/migrations/042_movement_boxes.sql +47 -0
- package/server/migrations/043_movement_box_overlap_overrides.sql +26 -0
- package/skills/forge-openclaw/SKILL.md +24 -11
- package/skills/forge-openclaw/entity_conversation_playbooks.md +210 -34
- package/skills/forge-openclaw/psyche_entity_playbooks.md +113 -17
- package/dist/assets/index-Ro0ZF_az.css +0 -1
- package/dist/assets/index-ytlpSj23.js +0 -79
- package/dist/assets/index-ytlpSj23.js.map +0 -1
- package/dist/assets/vendor-lE3tZJcC.js +0 -876
- package/dist/assets/vendor-lE3tZJcC.js.map +0 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { Bot, CalendarDays, Compass, FileText, FolderOpen, GitBranch, Heart, ListTodo, Network, NotebookPen, PanelTop, Quote, RefreshCw, Repeat, Route, Shapes, Sparkles, StickyNote, Target, Timer, Workflow } from "lucide-react";
|
|
2
|
+
export const ENTITY_KINDS = [
|
|
3
|
+
"goal",
|
|
4
|
+
"project",
|
|
5
|
+
"task",
|
|
6
|
+
"strategy",
|
|
7
|
+
"habit",
|
|
8
|
+
"tag",
|
|
9
|
+
"note",
|
|
10
|
+
"wiki_page",
|
|
11
|
+
"wiki_space",
|
|
12
|
+
"insight",
|
|
13
|
+
"calendar_event",
|
|
14
|
+
"work_block",
|
|
15
|
+
"timebox",
|
|
16
|
+
"value",
|
|
17
|
+
"pattern",
|
|
18
|
+
"behavior",
|
|
19
|
+
"belief",
|
|
20
|
+
"mode",
|
|
21
|
+
"mode_session",
|
|
22
|
+
"report",
|
|
23
|
+
"event_type",
|
|
24
|
+
"emotion",
|
|
25
|
+
"workbench",
|
|
26
|
+
"functor",
|
|
27
|
+
"chat"
|
|
28
|
+
];
|
|
29
|
+
const ENTITY_VISUAL_SEEDS = [
|
|
30
|
+
{
|
|
31
|
+
kind: "goal",
|
|
32
|
+
label: "Goal",
|
|
33
|
+
icon: Target,
|
|
34
|
+
iconName: "Target",
|
|
35
|
+
accentRgb: [251, 191, 36]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
kind: "project",
|
|
39
|
+
label: "Project",
|
|
40
|
+
icon: FolderOpen,
|
|
41
|
+
iconName: "FolderOpen",
|
|
42
|
+
accentRgb: [56, 189, 248]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
kind: "task",
|
|
46
|
+
label: "Task",
|
|
47
|
+
icon: ListTodo,
|
|
48
|
+
iconName: "ListTodo",
|
|
49
|
+
accentRgb: [129, 140, 248]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
kind: "strategy",
|
|
53
|
+
label: "Strategy",
|
|
54
|
+
icon: GitBranch,
|
|
55
|
+
iconName: "GitBranch",
|
|
56
|
+
accentRgb: [34, 211, 238]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
kind: "habit",
|
|
60
|
+
label: "Habit",
|
|
61
|
+
icon: RefreshCw,
|
|
62
|
+
iconName: "RefreshCw",
|
|
63
|
+
accentRgb: [45, 212, 191]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
kind: "tag",
|
|
67
|
+
label: "Tag",
|
|
68
|
+
icon: PanelTop,
|
|
69
|
+
iconName: "PanelTop",
|
|
70
|
+
accentRgb: [163, 230, 53]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
kind: "note",
|
|
74
|
+
label: "Note",
|
|
75
|
+
icon: NotebookPen,
|
|
76
|
+
iconName: "NotebookPen",
|
|
77
|
+
accentRgb: [148, 163, 184]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
kind: "wiki_page",
|
|
81
|
+
label: "Wiki Page",
|
|
82
|
+
icon: StickyNote,
|
|
83
|
+
iconName: "StickyNote",
|
|
84
|
+
accentRgb: [125, 211, 252]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
kind: "wiki_space",
|
|
88
|
+
label: "Wiki Space",
|
|
89
|
+
icon: Network,
|
|
90
|
+
iconName: "Network",
|
|
91
|
+
accentRgb: [99, 102, 241]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
kind: "insight",
|
|
95
|
+
label: "Insight",
|
|
96
|
+
icon: Sparkles,
|
|
97
|
+
iconName: "Sparkles",
|
|
98
|
+
accentRgb: [244, 63, 94]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
kind: "calendar_event",
|
|
102
|
+
label: "Calendar Event",
|
|
103
|
+
icon: CalendarDays,
|
|
104
|
+
iconName: "CalendarDays",
|
|
105
|
+
accentRgb: [14, 165, 233]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
kind: "work_block",
|
|
109
|
+
label: "Work Block",
|
|
110
|
+
icon: PanelTop,
|
|
111
|
+
iconName: "PanelTop",
|
|
112
|
+
accentRgb: [16, 185, 129]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
kind: "timebox",
|
|
116
|
+
label: "Timebox",
|
|
117
|
+
icon: Timer,
|
|
118
|
+
iconName: "Timer",
|
|
119
|
+
accentRgb: [244, 114, 182]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
kind: "value",
|
|
123
|
+
label: "Value",
|
|
124
|
+
icon: Heart,
|
|
125
|
+
iconName: "Heart",
|
|
126
|
+
accentRgb: [52, 211, 153]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
kind: "pattern",
|
|
130
|
+
label: "Pattern",
|
|
131
|
+
icon: Repeat,
|
|
132
|
+
iconName: "Repeat",
|
|
133
|
+
accentRgb: [251, 113, 133]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
kind: "behavior",
|
|
137
|
+
label: "Behavior",
|
|
138
|
+
icon: Route,
|
|
139
|
+
iconName: "Route",
|
|
140
|
+
accentRgb: [251, 146, 60]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
kind: "belief",
|
|
144
|
+
label: "Belief",
|
|
145
|
+
icon: Quote,
|
|
146
|
+
iconName: "Quote",
|
|
147
|
+
accentRgb: [167, 139, 250]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
kind: "mode",
|
|
151
|
+
label: "Mode",
|
|
152
|
+
icon: Shapes,
|
|
153
|
+
iconName: "Shapes",
|
|
154
|
+
accentRgb: [217, 70, 239]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
kind: "mode_session",
|
|
158
|
+
label: "Mode Session",
|
|
159
|
+
icon: Compass,
|
|
160
|
+
iconName: "Compass",
|
|
161
|
+
accentRgb: [192, 132, 252]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
kind: "report",
|
|
165
|
+
label: "Report",
|
|
166
|
+
icon: FileText,
|
|
167
|
+
iconName: "FileText",
|
|
168
|
+
accentRgb: [96, 165, 250]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
kind: "event_type",
|
|
172
|
+
label: "Event Type",
|
|
173
|
+
icon: CalendarDays,
|
|
174
|
+
iconName: "CalendarDays",
|
|
175
|
+
accentRgb: [45, 212, 191]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
kind: "emotion",
|
|
179
|
+
label: "Emotion",
|
|
180
|
+
icon: Heart,
|
|
181
|
+
iconName: "Heart",
|
|
182
|
+
accentRgb: [248, 113, 113]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
kind: "workbench",
|
|
186
|
+
label: "Workbench",
|
|
187
|
+
icon: Workflow,
|
|
188
|
+
iconName: "Workflow",
|
|
189
|
+
accentRgb: [45, 212, 191]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
kind: "functor",
|
|
193
|
+
label: "Functor",
|
|
194
|
+
icon: Sparkles,
|
|
195
|
+
iconName: "Sparkles",
|
|
196
|
+
accentRgb: [250, 204, 21]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
kind: "chat",
|
|
200
|
+
label: "Chat",
|
|
201
|
+
icon: Bot,
|
|
202
|
+
iconName: "Bot",
|
|
203
|
+
accentRgb: [129, 140, 248]
|
|
204
|
+
}
|
|
205
|
+
];
|
|
206
|
+
function toHex(rgb) {
|
|
207
|
+
return `#${rgb.map((value) => value.toString(16).padStart(2, "0")).join("")}`;
|
|
208
|
+
}
|
|
209
|
+
function toRgbaVar(kind, rgb, alpha) {
|
|
210
|
+
return `rgba(var(--forge-entity-${kind}-rgb,${rgb.join(",")}),${alpha})`;
|
|
211
|
+
}
|
|
212
|
+
function createEntityVisual(seed) {
|
|
213
|
+
return {
|
|
214
|
+
kind: seed.kind,
|
|
215
|
+
label: seed.label,
|
|
216
|
+
icon: seed.icon,
|
|
217
|
+
iconName: seed.iconName,
|
|
218
|
+
colorToken: {
|
|
219
|
+
cssVariable: `--forge-entity-${seed.kind}-rgb`,
|
|
220
|
+
rgb: seed.accentRgb,
|
|
221
|
+
hex: toHex(seed.accentRgb)
|
|
222
|
+
},
|
|
223
|
+
iconClassName: `text-[${toRgbaVar(seed.kind, seed.accentRgb, 0.96)}]`,
|
|
224
|
+
nameClassName: `text-[${toRgbaVar(seed.kind, seed.accentRgb, 0.96)}]`,
|
|
225
|
+
badgeClassName: `border-[${toRgbaVar(seed.kind, seed.accentRgb, 0.24)}] ` +
|
|
226
|
+
`bg-[linear-gradient(135deg,${toRgbaVar(seed.kind, seed.accentRgb, 0.24)},${toRgbaVar(seed.kind, seed.accentRgb, 0.08)})] text-white`,
|
|
227
|
+
subtleBadgeClassName: `border-[${toRgbaVar(seed.kind, seed.accentRgb, 0.18)}] ` +
|
|
228
|
+
`bg-[${toRgbaVar(seed.kind, seed.accentRgb, 0.08)}] text-[${toRgbaVar(seed.kind, seed.accentRgb, 0.92)}]`,
|
|
229
|
+
buttonClassName: `border-[${toRgbaVar(seed.kind, seed.accentRgb, 0.2)}] ` +
|
|
230
|
+
`bg-[${toRgbaVar(seed.kind, seed.accentRgb, 0.12)}] text-white hover:bg-[${toRgbaVar(seed.kind, seed.accentRgb, 0.18)}]`
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const ENTITY_VISUALS = Object.fromEntries(ENTITY_VISUAL_SEEDS.map((seed) => [seed.kind, createEntityVisual(seed)]));
|
|
234
|
+
const CRUD_ENTITY_KIND_MAP = {
|
|
235
|
+
goal: "goal",
|
|
236
|
+
project: "project",
|
|
237
|
+
task: "task",
|
|
238
|
+
strategy: "strategy",
|
|
239
|
+
habit: "habit",
|
|
240
|
+
tag: "tag",
|
|
241
|
+
note: "note",
|
|
242
|
+
insight: "insight",
|
|
243
|
+
calendar_event: "calendar_event",
|
|
244
|
+
work_block_template: "work_block",
|
|
245
|
+
task_timebox: "timebox",
|
|
246
|
+
psyche_value: "value",
|
|
247
|
+
behavior_pattern: "pattern",
|
|
248
|
+
behavior: "behavior",
|
|
249
|
+
belief_entry: "belief",
|
|
250
|
+
mode_profile: "mode",
|
|
251
|
+
mode_guide_session: "mode_session",
|
|
252
|
+
event_type: "event_type",
|
|
253
|
+
emotion_definition: "emotion",
|
|
254
|
+
trigger_report: "report"
|
|
255
|
+
};
|
|
256
|
+
export function getEntityVisual(kind) {
|
|
257
|
+
return ENTITY_VISUALS[kind];
|
|
258
|
+
}
|
|
259
|
+
export function getEntityVisualCatalog() {
|
|
260
|
+
return ENTITY_KINDS.map((kind) => getEntityVisual(kind));
|
|
261
|
+
}
|
|
262
|
+
export function isEntityKind(value) {
|
|
263
|
+
return ENTITY_KINDS.includes(value);
|
|
264
|
+
}
|
|
265
|
+
export function getEntityKindForCrudEntityType(entityType, options) {
|
|
266
|
+
if (entityType === "note" && options?.noteKind === "wiki") {
|
|
267
|
+
return "wiki_page";
|
|
268
|
+
}
|
|
269
|
+
return CRUD_ENTITY_KIND_MAP[entityType] ?? null;
|
|
270
|
+
}
|
|
271
|
+
export function getEntityKindForWorkbenchFlowKind(kind) {
|
|
272
|
+
return kind === "chat" ? "chat" : "functor";
|
|
273
|
+
}
|
|
274
|
+
export function getEntityButtonClassName(kind, selected) {
|
|
275
|
+
const visual = getEntityVisual(kind);
|
|
276
|
+
return selected
|
|
277
|
+
? `border ${visual.buttonClassName}`
|
|
278
|
+
: "border border-white/8 bg-white/[0.05] text-white/62 hover:bg-white/[0.08] hover:text-white";
|
|
279
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
export const KNOWLEDGE_GRAPH_HIERARCHY_LANES = [
|
|
2
|
+
{
|
|
3
|
+
id: "goals",
|
|
4
|
+
label: "Goals",
|
|
5
|
+
kinds: ["goal"]
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
id: "strategies",
|
|
9
|
+
label: "Strategies",
|
|
10
|
+
kinds: ["strategy"]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "projects",
|
|
14
|
+
label: "Projects",
|
|
15
|
+
kinds: ["project"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "tasks",
|
|
19
|
+
label: "Tasks",
|
|
20
|
+
kinds: ["task"]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "wiki-spaces",
|
|
24
|
+
label: "Wiki Spaces",
|
|
25
|
+
kinds: ["wiki_space"]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "knowledge",
|
|
29
|
+
label: "Wiki Pages / Notes",
|
|
30
|
+
kinds: ["wiki_page", "note"]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "support",
|
|
34
|
+
label: "Habits / Insights / Tags",
|
|
35
|
+
kinds: ["habit", "insight", "tag"]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "calendar",
|
|
39
|
+
label: "Calendar",
|
|
40
|
+
kinds: ["calendar_event", "work_block", "timebox"]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "values",
|
|
44
|
+
label: "Values",
|
|
45
|
+
kinds: ["value"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "patterns",
|
|
49
|
+
label: "Patterns",
|
|
50
|
+
kinds: ["pattern"]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "behaviors",
|
|
54
|
+
label: "Behaviors",
|
|
55
|
+
kinds: ["behavior"]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "beliefs",
|
|
59
|
+
label: "Beliefs",
|
|
60
|
+
kinds: ["belief"]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "modes",
|
|
64
|
+
label: "Modes / Mode Sessions",
|
|
65
|
+
kinds: ["mode", "mode_session"]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "reports",
|
|
69
|
+
label: "Reports / Event Types / Emotions",
|
|
70
|
+
kinds: ["report", "event_type", "emotion"]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "workbench",
|
|
74
|
+
label: "Workbench / Functors / Chats",
|
|
75
|
+
kinds: ["workbench", "functor", "chat"]
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
export const KNOWLEDGE_GRAPH_HIERARCHY_ORDER = KNOWLEDGE_GRAPH_HIERARCHY_LANES.flatMap((lane) => [...lane.kinds]);
|
|
79
|
+
export const KNOWLEDGE_GRAPH_RELATION_LABELS = {
|
|
80
|
+
goal_project: "Goal to project",
|
|
81
|
+
goal_task: "Goal to task",
|
|
82
|
+
project_task: "Project to task",
|
|
83
|
+
tag_goal: "Tag to goal",
|
|
84
|
+
tag_task: "Tag to task",
|
|
85
|
+
tag_strategy: "Tag to strategy",
|
|
86
|
+
value_goal: "Value to goal",
|
|
87
|
+
value_project: "Value to project",
|
|
88
|
+
value_task: "Value to task",
|
|
89
|
+
strategy_target: "Strategy target",
|
|
90
|
+
strategy_step: "Strategy step",
|
|
91
|
+
strategy_link: "Strategy context",
|
|
92
|
+
habit_link: "Habit link",
|
|
93
|
+
note_link: "Note link",
|
|
94
|
+
wiki_parent: "Wiki parent",
|
|
95
|
+
wiki_link: "Wiki link",
|
|
96
|
+
calendar_link: "Calendar link",
|
|
97
|
+
timebox_task: "Timebox to task",
|
|
98
|
+
timebox_project: "Timebox to project",
|
|
99
|
+
pattern_value: "Pattern to value",
|
|
100
|
+
pattern_belief: "Pattern to belief",
|
|
101
|
+
pattern_mode: "Pattern to mode",
|
|
102
|
+
behavior_pattern: "Behavior to pattern",
|
|
103
|
+
behavior_value: "Behavior to value",
|
|
104
|
+
behavior_belief: "Behavior to belief",
|
|
105
|
+
behavior_mode: "Behavior to mode",
|
|
106
|
+
belief_value: "Belief to value",
|
|
107
|
+
belief_behavior: "Belief to behavior",
|
|
108
|
+
belief_mode: "Belief to mode",
|
|
109
|
+
belief_report: "Belief to report",
|
|
110
|
+
mode_pattern: "Mode to pattern",
|
|
111
|
+
mode_behavior: "Mode to behavior",
|
|
112
|
+
mode_value: "Mode to value",
|
|
113
|
+
report_value: "Report to value",
|
|
114
|
+
report_pattern: "Report to pattern",
|
|
115
|
+
report_goal: "Report to goal",
|
|
116
|
+
report_project: "Report to project",
|
|
117
|
+
report_task: "Report to task",
|
|
118
|
+
report_behavior: "Report to behavior",
|
|
119
|
+
report_belief: "Report to belief",
|
|
120
|
+
report_mode: "Report to mode",
|
|
121
|
+
report_event_type: "Report to event type",
|
|
122
|
+
report_emotion: "Report to emotion",
|
|
123
|
+
mode_session_mode: "Mode session to mode",
|
|
124
|
+
workbench_flow: "Workbench flow",
|
|
125
|
+
workbench_surface: "Workbench surface",
|
|
126
|
+
workbench_route: "Workbench route"
|
|
127
|
+
};
|
|
128
|
+
export const KNOWLEDGE_GRAPH_RELATION_FAMILY_LABELS = {
|
|
129
|
+
structural: "Structure",
|
|
130
|
+
contextual: "Context",
|
|
131
|
+
taxonomy: "Taxonomy",
|
|
132
|
+
workspace: "Workspace"
|
|
133
|
+
};
|
|
134
|
+
export const KNOWLEDGE_GRAPH_RELATION_FAMILY_MAP = {
|
|
135
|
+
goal_project: "structural",
|
|
136
|
+
goal_task: "structural",
|
|
137
|
+
project_task: "structural",
|
|
138
|
+
tag_goal: "taxonomy",
|
|
139
|
+
tag_task: "taxonomy",
|
|
140
|
+
tag_strategy: "taxonomy",
|
|
141
|
+
value_goal: "contextual",
|
|
142
|
+
value_project: "contextual",
|
|
143
|
+
value_task: "contextual",
|
|
144
|
+
strategy_target: "structural",
|
|
145
|
+
strategy_step: "structural",
|
|
146
|
+
strategy_link: "contextual",
|
|
147
|
+
habit_link: "contextual",
|
|
148
|
+
note_link: "contextual",
|
|
149
|
+
wiki_parent: "structural",
|
|
150
|
+
wiki_link: "contextual",
|
|
151
|
+
calendar_link: "contextual",
|
|
152
|
+
timebox_task: "structural",
|
|
153
|
+
timebox_project: "contextual",
|
|
154
|
+
pattern_value: "contextual",
|
|
155
|
+
pattern_belief: "contextual",
|
|
156
|
+
pattern_mode: "contextual",
|
|
157
|
+
behavior_pattern: "structural",
|
|
158
|
+
behavior_value: "contextual",
|
|
159
|
+
behavior_belief: "contextual",
|
|
160
|
+
behavior_mode: "contextual",
|
|
161
|
+
belief_value: "contextual",
|
|
162
|
+
belief_behavior: "contextual",
|
|
163
|
+
belief_mode: "contextual",
|
|
164
|
+
belief_report: "contextual",
|
|
165
|
+
mode_pattern: "contextual",
|
|
166
|
+
mode_behavior: "contextual",
|
|
167
|
+
mode_value: "contextual",
|
|
168
|
+
report_value: "contextual",
|
|
169
|
+
report_pattern: "contextual",
|
|
170
|
+
report_goal: "contextual",
|
|
171
|
+
report_project: "contextual",
|
|
172
|
+
report_task: "contextual",
|
|
173
|
+
report_behavior: "contextual",
|
|
174
|
+
report_belief: "contextual",
|
|
175
|
+
report_mode: "contextual",
|
|
176
|
+
report_event_type: "taxonomy",
|
|
177
|
+
report_emotion: "taxonomy",
|
|
178
|
+
mode_session_mode: "taxonomy",
|
|
179
|
+
workbench_flow: "workspace",
|
|
180
|
+
workbench_surface: "workspace",
|
|
181
|
+
workbench_route: "workspace"
|
|
182
|
+
};
|
|
183
|
+
export function buildKnowledgeGraphNodeId(entityType, entityId) {
|
|
184
|
+
return `${entityType}:${entityId}`;
|
|
185
|
+
}
|
|
186
|
+
export function parseKnowledgeGraphFocusValue(value) {
|
|
187
|
+
if (!value) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const separatorIndex = value.indexOf(":");
|
|
191
|
+
if (separatorIndex <= 0 || separatorIndex >= value.length - 1) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
entityType: value.slice(0, separatorIndex),
|
|
196
|
+
entityId: value.slice(separatorIndex + 1)
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
export function formatKnowledgeGraphFocusValue(entityType, entityId) {
|
|
200
|
+
return `${entityType}:${entityId}`;
|
|
201
|
+
}
|
|
202
|
+
export function getKnowledgeGraphEntityHref(entityType, entityId, options) {
|
|
203
|
+
switch (entityType) {
|
|
204
|
+
case "goal":
|
|
205
|
+
return `/goals/${entityId}`;
|
|
206
|
+
case "project":
|
|
207
|
+
return `/projects/${entityId}`;
|
|
208
|
+
case "task":
|
|
209
|
+
return `/tasks/${entityId}`;
|
|
210
|
+
case "strategy":
|
|
211
|
+
return `/strategies/${entityId}`;
|
|
212
|
+
case "habit":
|
|
213
|
+
return `/habits?focus=${encodeURIComponent(entityId)}`;
|
|
214
|
+
case "tag":
|
|
215
|
+
return `/tags?focus=${encodeURIComponent(entityId)}`;
|
|
216
|
+
case "insight":
|
|
217
|
+
return `/insights`;
|
|
218
|
+
case "calendar_event":
|
|
219
|
+
case "work_block_template":
|
|
220
|
+
case "task_timebox":
|
|
221
|
+
return `/calendar`;
|
|
222
|
+
case "event_type":
|
|
223
|
+
case "emotion_definition":
|
|
224
|
+
return "/psyche/reports";
|
|
225
|
+
case "psyche_value":
|
|
226
|
+
return `/psyche/values?focus=${encodeURIComponent(entityId)}#values-atlas`;
|
|
227
|
+
case "behavior_pattern":
|
|
228
|
+
return `/psyche/patterns?focus=${encodeURIComponent(entityId)}#pattern-lanes`;
|
|
229
|
+
case "behavior":
|
|
230
|
+
return `/psyche/behaviors?focus=${encodeURIComponent(entityId)}#behavior-columns`;
|
|
231
|
+
case "belief_entry":
|
|
232
|
+
return `/psyche/schemas-beliefs?focus=${encodeURIComponent(entityId)}`;
|
|
233
|
+
case "mode_profile":
|
|
234
|
+
return `/psyche/modes?focus=${encodeURIComponent(entityId)}`;
|
|
235
|
+
case "mode_guide_session":
|
|
236
|
+
return `/psyche/modes`;
|
|
237
|
+
case "trigger_report":
|
|
238
|
+
return `/psyche/reports/${encodeURIComponent(entityId)}`;
|
|
239
|
+
case "note":
|
|
240
|
+
if (options?.noteKind === "wiki" && options.noteSlug) {
|
|
241
|
+
const search = options.noteSpaceId && options.noteSpaceId.trim().length > 0
|
|
242
|
+
? `?spaceId=${encodeURIComponent(options.noteSpaceId)}`
|
|
243
|
+
: "";
|
|
244
|
+
return `/wiki/page/${encodeURIComponent(options.noteSlug)}${search}`;
|
|
245
|
+
}
|
|
246
|
+
return `/notes?entityType=note&entityId=${encodeURIComponent(entityId)}`;
|
|
247
|
+
case "wiki_space":
|
|
248
|
+
return `/wiki?spaceId=${encodeURIComponent(entityId)}`;
|
|
249
|
+
case "workbench_flow":
|
|
250
|
+
return `/workbench/${encodeURIComponent(entityId)}`;
|
|
251
|
+
case "workbench_surface":
|
|
252
|
+
return entityId === "workbench"
|
|
253
|
+
? "/workbench"
|
|
254
|
+
: `/workbench?surface=${encodeURIComponent(entityId)}`;
|
|
255
|
+
default:
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
export function buildKnowledgeGraphFocusHref(entityType, entityId, options) {
|
|
260
|
+
const search = new URLSearchParams();
|
|
261
|
+
search.set("focus", formatKnowledgeGraphFocusValue(entityType, entityId));
|
|
262
|
+
if (options?.view && options.view !== "graph") {
|
|
263
|
+
search.set("view", options.view);
|
|
264
|
+
}
|
|
265
|
+
if (options?.query?.trim()) {
|
|
266
|
+
search.set("q", options.query.trim());
|
|
267
|
+
}
|
|
268
|
+
for (const kind of options?.kinds ?? []) {
|
|
269
|
+
search.append("kind", kind);
|
|
270
|
+
}
|
|
271
|
+
for (const relation of options?.relations ?? []) {
|
|
272
|
+
search.append("relation", relation);
|
|
273
|
+
}
|
|
274
|
+
const query = search.toString();
|
|
275
|
+
return query.length > 0 ? `/knowledge-graph?${query}` : "/knowledge-graph";
|
|
276
|
+
}
|