forge-openclaw-plugin 0.2.4 → 0.2.7

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.
Files changed (117) hide show
  1. package/README.md +113 -5
  2. package/dist/assets/board-CzgvdLO8.js +6 -0
  3. package/dist/assets/board-CzgvdLO8.js.map +1 -0
  4. package/dist/assets/favicon-BCHm9dUV.ico +0 -0
  5. package/dist/assets/index-8d_oM8fL.js +27 -0
  6. package/dist/assets/index-8d_oM8fL.js.map +1 -0
  7. package/dist/assets/index-D4A_bq8m.css +1 -0
  8. package/dist/assets/motion-STUd1O46.js +10 -0
  9. package/dist/assets/motion-STUd1O46.js.map +1 -0
  10. package/dist/assets/plus-jakarta-sans-latin-ext-wght-normal-DmpS2jIq.woff2 +0 -0
  11. package/dist/assets/plus-jakarta-sans-latin-wght-normal-eXO_dkmS.woff2 +0 -0
  12. package/dist/assets/plus-jakarta-sans-vietnamese-wght-normal-qRpaaN48.woff2 +0 -0
  13. package/dist/assets/sora-latin-ext-wght-normal-CawQDOvP.woff2 +0 -0
  14. package/dist/assets/sora-latin-wght-normal-DdqRvwsR.woff2 +0 -0
  15. package/dist/assets/space-grotesk-latin-500-normal-CNSSEhBt.woff +0 -0
  16. package/dist/assets/space-grotesk-latin-500-normal-lFbtlQH6.woff2 +0 -0
  17. package/dist/assets/space-grotesk-latin-700-normal-CwsQ-cCU.woff +0 -0
  18. package/dist/assets/space-grotesk-latin-700-normal-RjhwGPKo.woff2 +0 -0
  19. package/dist/assets/space-grotesk-latin-ext-500-normal-3dgZTiw9.woff +0 -0
  20. package/dist/assets/space-grotesk-latin-ext-500-normal-DUe3BAxM.woff2 +0 -0
  21. package/dist/assets/space-grotesk-latin-ext-700-normal-BQnZhY3m.woff2 +0 -0
  22. package/dist/assets/space-grotesk-latin-ext-700-normal-HVCqSBdx.woff +0 -0
  23. package/dist/assets/space-grotesk-vietnamese-500-normal-BTqKIpxg.woff +0 -0
  24. package/dist/assets/space-grotesk-vietnamese-500-normal-BmEvtly_.woff2 +0 -0
  25. package/dist/assets/space-grotesk-vietnamese-700-normal-DMty7AZE.woff2 +0 -0
  26. package/dist/assets/space-grotesk-vietnamese-700-normal-Duxec5Rn.woff +0 -0
  27. package/dist/assets/table-CtNlETLc.js +23 -0
  28. package/dist/assets/table-CtNlETLc.js.map +1 -0
  29. package/dist/assets/ui-ThzkR_oW.js +46 -0
  30. package/dist/assets/ui-ThzkR_oW.js.map +1 -0
  31. package/dist/assets/vendor-CRS-psbw.css +1 -0
  32. package/dist/assets/vendor-DyHAI6nk.js +423 -0
  33. package/dist/assets/vendor-DyHAI6nk.js.map +1 -0
  34. package/dist/assets/viz-BJuBCz_G.js +34 -0
  35. package/dist/assets/viz-BJuBCz_G.js.map +1 -0
  36. package/dist/favicon.ico +0 -0
  37. package/dist/favicon.png +0 -0
  38. package/dist/index.html +29 -0
  39. package/dist/openclaw/api-client.d.ts +8 -0
  40. package/dist/openclaw/api-client.js +31 -4
  41. package/dist/openclaw/local-runtime.d.ts +3 -0
  42. package/dist/openclaw/local-runtime.js +135 -0
  43. package/dist/openclaw/parity.d.ts +4 -4
  44. package/dist/openclaw/parity.js +23 -33
  45. package/dist/openclaw/plugin-entry-shared.d.ts +4 -2
  46. package/dist/openclaw/plugin-entry-shared.js +51 -9
  47. package/dist/openclaw/routes.d.ts +12 -3
  48. package/dist/openclaw/routes.js +156 -924
  49. package/dist/openclaw/tools.js +242 -1100
  50. package/dist/server/app.js +2450 -0
  51. package/dist/server/db.js +313 -0
  52. package/dist/server/e2e-server.js +20 -0
  53. package/dist/server/errors.js +15 -0
  54. package/dist/server/index.js +16 -0
  55. package/dist/server/managers/base.js +17 -0
  56. package/dist/server/managers/contracts.js +47 -0
  57. package/dist/server/managers/platform/api-gateway-manager.js +11 -0
  58. package/dist/server/managers/platform/audit-manager.js +15 -0
  59. package/dist/server/managers/platform/authentication-manager.js +56 -0
  60. package/dist/server/managers/platform/authorization-manager.js +56 -0
  61. package/dist/server/managers/platform/background-job-manager.js +10 -0
  62. package/dist/server/managers/platform/configuration-manager.js +33 -0
  63. package/dist/server/managers/platform/database-manager.js +14 -0
  64. package/dist/server/managers/platform/event-bus-manager.js +7 -0
  65. package/dist/server/managers/platform/external-service-manager.js +11 -0
  66. package/dist/server/managers/platform/health-manager.js +7 -0
  67. package/dist/server/managers/platform/migration-manager.js +8 -0
  68. package/dist/server/managers/platform/search-index-manager.js +4 -0
  69. package/dist/server/managers/platform/secrets-manager.js +19 -0
  70. package/dist/server/managers/platform/session-manager.js +121 -0
  71. package/dist/server/managers/platform/storage-manager.js +16 -0
  72. package/dist/server/managers/platform/token-manager.js +37 -0
  73. package/dist/server/managers/platform/transaction-manager.js +8 -0
  74. package/dist/server/managers/platform/trusted-network.js +39 -0
  75. package/dist/server/managers/runtime.js +56 -0
  76. package/dist/server/managers/type-guards.js +4 -0
  77. package/dist/server/openapi.js +3512 -0
  78. package/dist/server/psyche-types.js +395 -0
  79. package/dist/server/repositories/activity-events.js +157 -0
  80. package/dist/server/repositories/collaboration.js +497 -0
  81. package/dist/server/repositories/comments.js +176 -0
  82. package/dist/server/repositories/deleted-entities.js +192 -0
  83. package/dist/server/repositories/domains.js +30 -0
  84. package/dist/server/repositories/event-log.js +64 -0
  85. package/dist/server/repositories/goals.js +159 -0
  86. package/dist/server/repositories/projects.js +214 -0
  87. package/dist/server/repositories/psyche.js +1356 -0
  88. package/dist/server/repositories/rewards.js +675 -0
  89. package/dist/server/repositories/settings.js +399 -0
  90. package/dist/server/repositories/tags.js +160 -0
  91. package/dist/server/repositories/task-runs.js +488 -0
  92. package/dist/server/repositories/tasks.js +413 -0
  93. package/dist/server/services/context.js +214 -0
  94. package/dist/server/services/dashboard.js +170 -0
  95. package/dist/server/services/entity-crud.js +576 -0
  96. package/dist/server/services/gamification.js +215 -0
  97. package/dist/server/services/insights.js +91 -0
  98. package/dist/server/services/projects.js +75 -0
  99. package/dist/server/services/psyche.js +63 -0
  100. package/dist/server/services/relations.js +28 -0
  101. package/dist/server/services/reviews.js +88 -0
  102. package/dist/server/services/run-recovery.js +13 -0
  103. package/dist/server/services/tagging.js +49 -0
  104. package/dist/server/services/task-run-watchdog.js +92 -0
  105. package/dist/server/services/work-time.js +176 -0
  106. package/dist/server/types.js +999 -0
  107. package/dist/server/web.js +91 -0
  108. package/openclaw.plugin.json +21 -9
  109. package/package.json +17 -4
  110. package/server/migrations/001_core.sql +333 -0
  111. package/server/migrations/002_psyche.sql +241 -0
  112. package/server/migrations/003_timer_execution.sql +18 -0
  113. package/server/migrations/004_psyche_linked_entities.sql +5 -0
  114. package/server/migrations/005_adaptive_schemas.sql +157 -0
  115. package/server/migrations/006_psyche_auth_setting.sql +4 -0
  116. package/server/migrations/007_deleted_entities.sql +16 -0
  117. package/skills/forge-openclaw/SKILL.md +189 -275
@@ -0,0 +1,241 @@
1
+ CREATE TABLE IF NOT EXISTS domains (
2
+ id TEXT PRIMARY KEY,
3
+ slug TEXT NOT NULL UNIQUE,
4
+ title TEXT NOT NULL,
5
+ description TEXT NOT NULL DEFAULT '',
6
+ theme_color TEXT NOT NULL,
7
+ sensitive INTEGER NOT NULL DEFAULT 0,
8
+ created_at TEXT NOT NULL,
9
+ updated_at TEXT NOT NULL
10
+ );
11
+
12
+ INSERT OR IGNORE INTO domains (id, slug, title, description, theme_color, sensitive, created_at, updated_at) VALUES
13
+ ('domain_health', 'health', 'Health', 'Physical vitality, recovery, and body stewardship.', '#ef4444', 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
14
+ ('domain_mastery', 'mastery', 'Mastery', 'Skill building, deliberate practice, and craft.', '#f5efe6', 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
15
+ ('domain_love', 'love', 'Love', 'Relationships, intimacy, attachment, and shared life.', '#7dd3fc', 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
16
+ ('domain_wealth', 'wealth', 'Wealth', 'Financial stability, leverage, and freedom.', '#f59e0b', 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
17
+ ('domain_creativity', 'creativity', 'Creativity', 'Original work, authorship, and expression.', '#c0c1ff', 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
18
+ ('domain_contribution', 'contribution', 'Contribution', 'Service, meaning, and impact on others.', '#4edea3', 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
19
+ ('domain_spirituality', 'spirituality', 'Spirituality', 'Inner life, ritual, meaning, and transcendence.', '#8b5cf6', 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
20
+ ('domain_adventure', 'adventure', 'Adventure', 'Novelty, courage, movement, and lived expansion.', '#fb7185', 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
21
+ ('domain_psyche', 'psyche', 'Psyche', 'Values-led therapeutic reflection, pattern change, and trigger analysis.', '#6ee7b7', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
22
+
23
+ CREATE TABLE IF NOT EXISTS psyche_values (
24
+ id TEXT PRIMARY KEY,
25
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
26
+ title TEXT NOT NULL,
27
+ description TEXT NOT NULL DEFAULT '',
28
+ valued_direction TEXT NOT NULL DEFAULT '',
29
+ why_it_matters TEXT NOT NULL DEFAULT '',
30
+ linked_goal_ids_json TEXT NOT NULL DEFAULT '[]',
31
+ linked_project_ids_json TEXT NOT NULL DEFAULT '[]',
32
+ linked_task_ids_json TEXT NOT NULL DEFAULT '[]',
33
+ committed_actions_json TEXT NOT NULL DEFAULT '[]',
34
+ created_at TEXT NOT NULL,
35
+ updated_at TEXT NOT NULL
36
+ );
37
+
38
+ CREATE TABLE IF NOT EXISTS behavior_patterns (
39
+ id TEXT PRIMARY KEY,
40
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
41
+ title TEXT NOT NULL,
42
+ description TEXT NOT NULL DEFAULT '',
43
+ target_behavior TEXT NOT NULL DEFAULT '',
44
+ cue_contexts_json TEXT NOT NULL DEFAULT '[]',
45
+ short_term_payoff TEXT NOT NULL DEFAULT '',
46
+ long_term_cost TEXT NOT NULL DEFAULT '',
47
+ preferred_response TEXT NOT NULL DEFAULT '',
48
+ linked_value_ids_json TEXT NOT NULL DEFAULT '[]',
49
+ linked_schema_labels_json TEXT NOT NULL DEFAULT '[]',
50
+ linked_mode_labels_json TEXT NOT NULL DEFAULT '[]',
51
+ created_at TEXT NOT NULL,
52
+ updated_at TEXT NOT NULL
53
+ );
54
+
55
+ CREATE TABLE IF NOT EXISTS trigger_reports (
56
+ id TEXT PRIMARY KEY,
57
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
58
+ title TEXT NOT NULL,
59
+ status TEXT NOT NULL DEFAULT 'draft',
60
+ event_situation TEXT NOT NULL DEFAULT '',
61
+ occurred_at TEXT,
62
+ emotions_json TEXT NOT NULL DEFAULT '[]',
63
+ thoughts_json TEXT NOT NULL DEFAULT '[]',
64
+ behaviors_json TEXT NOT NULL DEFAULT '[]',
65
+ consequences_json TEXT NOT NULL DEFAULT '{}',
66
+ linked_pattern_ids_json TEXT NOT NULL DEFAULT '[]',
67
+ linked_value_ids_json TEXT NOT NULL DEFAULT '[]',
68
+ linked_goal_ids_json TEXT NOT NULL DEFAULT '[]',
69
+ linked_project_ids_json TEXT NOT NULL DEFAULT '[]',
70
+ linked_task_ids_json TEXT NOT NULL DEFAULT '[]',
71
+ mode_overlays_json TEXT NOT NULL DEFAULT '[]',
72
+ schema_links_json TEXT NOT NULL DEFAULT '[]',
73
+ next_moves_json TEXT NOT NULL DEFAULT '[]',
74
+ event_type_id TEXT REFERENCES event_types(id) ON DELETE SET NULL,
75
+ custom_event_type TEXT NOT NULL DEFAULT '',
76
+ linked_behavior_ids_json TEXT NOT NULL DEFAULT '[]',
77
+ linked_belief_ids_json TEXT NOT NULL DEFAULT '[]',
78
+ linked_mode_ids_json TEXT NOT NULL DEFAULT '[]',
79
+ mode_timeline_json TEXT NOT NULL DEFAULT '[]',
80
+ created_at TEXT NOT NULL,
81
+ updated_at TEXT NOT NULL
82
+ );
83
+
84
+ CREATE TABLE IF NOT EXISTS entity_comments (
85
+ id TEXT PRIMARY KEY,
86
+ entity_type TEXT NOT NULL,
87
+ entity_id TEXT NOT NULL,
88
+ anchor_key TEXT,
89
+ body TEXT NOT NULL,
90
+ author TEXT,
91
+ source TEXT NOT NULL,
92
+ created_at TEXT NOT NULL,
93
+ updated_at TEXT NOT NULL
94
+ );
95
+
96
+ CREATE TABLE IF NOT EXISTS schema_catalog (
97
+ id TEXT PRIMARY KEY,
98
+ slug TEXT NOT NULL UNIQUE,
99
+ title TEXT NOT NULL,
100
+ family TEXT NOT NULL,
101
+ description TEXT NOT NULL DEFAULT '',
102
+ created_at TEXT NOT NULL,
103
+ updated_at TEXT NOT NULL
104
+ );
105
+
106
+ INSERT OR IGNORE INTO schema_catalog (id, slug, title, family, description, created_at, updated_at) VALUES
107
+ ('schema_abandonment', 'abandonment', 'Abandonment', 'disconnection_rejection', 'Expectation that close connection will not remain stable or available.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
108
+ ('schema_mistrust', 'mistrust_abuse', 'Mistrust / Abuse', 'disconnection_rejection', 'Expectation that others will hurt, humiliate, manipulate, or exploit.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
109
+ ('schema_emotional_deprivation', 'emotional_deprivation', 'Emotional Deprivation', 'disconnection_rejection', 'Expectation that emotional support, empathy, or protection will not be met.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
110
+ ('schema_defectiveness', 'defectiveness_shame', 'Defectiveness / Shame', 'disconnection_rejection', 'Sense of being bad, unlovable, inferior, or shameful at the core.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
111
+ ('schema_social_isolation', 'social_isolation', 'Social Isolation', 'disconnection_rejection', 'Sense of being fundamentally different, outside, or not belonging.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
112
+ ('schema_failure', 'failure', 'Failure', 'impaired_autonomy', 'Expectation of inevitable failure or inadequacy relative to peers.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
113
+ ('schema_dependence', 'dependence_incompetence', 'Dependence / Incompetence', 'impaired_autonomy', 'Belief that one cannot handle responsibilities competently without help.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
114
+ ('schema_vulnerability', 'vulnerability_to_harm', 'Vulnerability to Harm', 'impaired_autonomy', 'Exaggerated fear that catastrophe or collapse is always near.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
115
+ ('schema_subjugation', 'subjugation', 'Subjugation', 'other_directedness', 'Chronic surrender of needs or preferences to avoid conflict, guilt, or retaliation.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
116
+ ('schema_self_sacrifice', 'self_sacrifice', 'Self-Sacrifice', 'other_directedness', 'Excessive focus on meeting others'' needs at the cost of one''s own.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
117
+ ('schema_unrelenting', 'unrelenting_standards', 'Unrelenting Standards', 'overvigilance_inhibition', 'Pressure to meet very high standards and avoid mistakes at all costs.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
118
+ ('schema_punitiveness', 'punitiveness', 'Punitiveness', 'overvigilance_inhibition', 'Belief that mistakes deserve harsh punishment rather than repair.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
119
+
120
+ CREATE TABLE IF NOT EXISTS event_types (
121
+ id TEXT PRIMARY KEY,
122
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
123
+ label TEXT NOT NULL,
124
+ description TEXT NOT NULL DEFAULT '',
125
+ system INTEGER NOT NULL DEFAULT 0,
126
+ created_at TEXT NOT NULL,
127
+ updated_at TEXT NOT NULL
128
+ );
129
+
130
+ INSERT OR IGNORE INTO event_types (id, domain_id, label, description, system, created_at, updated_at) VALUES
131
+ ('event_feedback', 'domain_psyche', 'Feedback', 'Performance feedback, correction, or evaluation from someone important.', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
132
+ ('event_silence', 'domain_psyche', 'Silence after outreach', 'A meaningful delay or silence after vulnerability, initiative, or contact.', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
133
+ ('event_conflict', 'domain_psyche', 'Conflict', 'Tension, disagreement, rupture, or perceived relational threat.', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
134
+ ('event_performance', 'domain_psyche', 'Performance pressure', 'Moments where competence, output, or comparison felt sharply relevant.', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
135
+ ('event_change', 'domain_psyche', 'Unexpected change', 'Plans shifted or certainty collapsed faster than the system could adapt.', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
136
+ ('event_intimacy', 'domain_psyche', 'Intimacy', 'Closeness, exposure, or emotional contact that stirred vulnerability.', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
137
+
138
+ CREATE TABLE IF NOT EXISTS emotion_definitions (
139
+ id TEXT PRIMARY KEY,
140
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
141
+ label TEXT NOT NULL,
142
+ description TEXT NOT NULL DEFAULT '',
143
+ category TEXT NOT NULL DEFAULT '',
144
+ system INTEGER NOT NULL DEFAULT 0,
145
+ created_at TEXT NOT NULL,
146
+ updated_at TEXT NOT NULL
147
+ );
148
+
149
+ INSERT OR IGNORE INTO emotion_definitions (id, domain_id, label, description, category, system, created_at, updated_at) VALUES
150
+ ('emotion_fear', 'domain_psyche', 'Fear', 'Alarm, danger, dread, or anticipatory threat.', 'threat', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
151
+ ('emotion_sadness', 'domain_psyche', 'Sadness', 'Loss, grief, emptiness, or heaviness.', 'loss', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
152
+ ('emotion_shame', 'domain_psyche', 'Shame', 'Exposure, defectiveness, humiliation, or collapse of worth.', 'self_evaluation', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
153
+ ('emotion_guilt', 'domain_psyche', 'Guilt', 'Sense of having failed, harmed, or violated a value.', 'self_evaluation', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
154
+ ('emotion_anger', 'domain_psyche', 'Anger', 'Boundary activation, protest, frustration, or heat.', 'boundary', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
155
+ ('emotion_loneliness', 'domain_psyche', 'Loneliness', 'Disconnection, distance, or lack of emotional contact.', 'attachment', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
156
+ ('emotion_relief', 'domain_psyche', 'Relief', 'Release after pressure, fear, or ambiguity.', 'release', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
157
+ ('emotion_joy', 'domain_psyche', 'Joy', 'Warmth, pleasure, delight, or expansion.', 'positive', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
158
+ ('emotion_frustration', 'domain_psyche', 'Frustration', 'Blocked movement, thwarted desire, or pressure build-up.', 'boundary', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
159
+ ('emotion_disgust', 'domain_psyche', 'Disgust', 'Repulsion, contamination, or recoil.', 'threat', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
160
+
161
+ CREATE TABLE IF NOT EXISTS psyche_behaviors (
162
+ id TEXT PRIMARY KEY,
163
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
164
+ kind TEXT NOT NULL,
165
+ title TEXT NOT NULL,
166
+ description TEXT NOT NULL DEFAULT '',
167
+ common_cues_json TEXT NOT NULL DEFAULT '[]',
168
+ urge_story TEXT NOT NULL DEFAULT '',
169
+ short_term_payoff TEXT NOT NULL DEFAULT '',
170
+ long_term_cost TEXT NOT NULL DEFAULT '',
171
+ replacement_move TEXT NOT NULL DEFAULT '',
172
+ repair_plan TEXT NOT NULL DEFAULT '',
173
+ linked_pattern_ids_json TEXT NOT NULL DEFAULT '[]',
174
+ linked_value_ids_json TEXT NOT NULL DEFAULT '[]',
175
+ linked_schema_ids_json TEXT NOT NULL DEFAULT '[]',
176
+ linked_mode_ids_json TEXT NOT NULL DEFAULT '[]',
177
+ created_at TEXT NOT NULL,
178
+ updated_at TEXT NOT NULL
179
+ );
180
+
181
+ CREATE TABLE IF NOT EXISTS belief_entries (
182
+ id TEXT PRIMARY KEY,
183
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
184
+ schema_id TEXT REFERENCES schema_catalog(id) ON DELETE SET NULL,
185
+ statement TEXT NOT NULL,
186
+ belief_type TEXT NOT NULL,
187
+ origin_note TEXT NOT NULL DEFAULT '',
188
+ confidence INTEGER NOT NULL DEFAULT 60,
189
+ evidence_for_json TEXT NOT NULL DEFAULT '[]',
190
+ evidence_against_json TEXT NOT NULL DEFAULT '[]',
191
+ flexible_alternative TEXT NOT NULL DEFAULT '',
192
+ linked_value_ids_json TEXT NOT NULL DEFAULT '[]',
193
+ linked_behavior_ids_json TEXT NOT NULL DEFAULT '[]',
194
+ linked_mode_ids_json TEXT NOT NULL DEFAULT '[]',
195
+ linked_report_ids_json TEXT NOT NULL DEFAULT '[]',
196
+ created_at TEXT NOT NULL,
197
+ updated_at TEXT NOT NULL
198
+ );
199
+
200
+ CREATE TABLE IF NOT EXISTS mode_profiles (
201
+ id TEXT PRIMARY KEY,
202
+ domain_id TEXT NOT NULL REFERENCES domains(id) ON DELETE CASCADE,
203
+ family TEXT NOT NULL,
204
+ archetype TEXT NOT NULL DEFAULT '',
205
+ title TEXT NOT NULL,
206
+ persona TEXT NOT NULL DEFAULT '',
207
+ imagery TEXT NOT NULL DEFAULT '',
208
+ symbolic_form TEXT NOT NULL DEFAULT '',
209
+ facial_expression TEXT NOT NULL DEFAULT '',
210
+ fear TEXT NOT NULL DEFAULT '',
211
+ burden TEXT NOT NULL DEFAULT '',
212
+ protective_job TEXT NOT NULL DEFAULT '',
213
+ origin_context TEXT NOT NULL DEFAULT '',
214
+ first_appearance_at TEXT,
215
+ linked_pattern_ids_json TEXT NOT NULL DEFAULT '[]',
216
+ linked_behavior_ids_json TEXT NOT NULL DEFAULT '[]',
217
+ linked_value_ids_json TEXT NOT NULL DEFAULT '[]',
218
+ created_at TEXT NOT NULL,
219
+ updated_at TEXT NOT NULL
220
+ );
221
+
222
+ CREATE TABLE IF NOT EXISTS mode_guide_sessions (
223
+ id TEXT PRIMARY KEY,
224
+ summary TEXT NOT NULL,
225
+ answers_json TEXT NOT NULL DEFAULT '[]',
226
+ results_json TEXT NOT NULL DEFAULT '[]',
227
+ created_at TEXT NOT NULL,
228
+ updated_at TEXT NOT NULL
229
+ );
230
+
231
+ CREATE INDEX IF NOT EXISTS idx_psyche_values_domain ON psyche_values(domain_id, created_at DESC);
232
+ CREATE INDEX IF NOT EXISTS idx_behavior_patterns_domain ON behavior_patterns(domain_id, created_at DESC);
233
+ CREATE INDEX IF NOT EXISTS idx_trigger_reports_domain ON trigger_reports(domain_id, created_at DESC);
234
+ CREATE INDEX IF NOT EXISTS idx_trigger_reports_status ON trigger_reports(status, created_at DESC);
235
+ CREATE INDEX IF NOT EXISTS idx_entity_comments_target ON entity_comments(entity_type, entity_id, created_at DESC);
236
+ CREATE INDEX IF NOT EXISTS idx_event_types_domain ON event_types(domain_id, system DESC, label);
237
+ CREATE INDEX IF NOT EXISTS idx_emotion_definitions_domain ON emotion_definitions(domain_id, system DESC, label);
238
+ CREATE INDEX IF NOT EXISTS idx_psyche_behaviors_domain ON psyche_behaviors(domain_id, kind, updated_at DESC);
239
+ CREATE INDEX IF NOT EXISTS idx_belief_entries_domain ON belief_entries(domain_id, updated_at DESC);
240
+ CREATE INDEX IF NOT EXISTS idx_belief_entries_schema ON belief_entries(schema_id, updated_at DESC);
241
+ CREATE INDEX IF NOT EXISTS idx_mode_profiles_domain ON mode_profiles(domain_id, family, updated_at DESC);
@@ -0,0 +1,18 @@
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;
@@ -0,0 +1,5 @@
1
+ ALTER TABLE behavior_patterns
2
+ ADD COLUMN linked_mode_ids_json TEXT NOT NULL DEFAULT '[]';
3
+
4
+ ALTER TABLE behavior_patterns
5
+ ADD COLUMN linked_belief_ids_json TEXT NOT NULL DEFAULT '[]';
@@ -0,0 +1,157 @@
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
+ );
@@ -0,0 +1,4 @@
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;
@@ -0,0 +1,16 @@
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);