total-recall-brain 3.13.0 → 3.13.2

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 (152) hide show
  1. package/README.md +91 -108
  2. package/bin/antigravity.mjs +81 -52
  3. package/bin/total-recall.mjs +32 -57
  4. package/extension/background.js +1 -1
  5. package/extension/options/options.js +9 -3
  6. package/extension/sidepanel/sidepanel.js +0 -2
  7. package/frontend/index.html +4 -3
  8. package/frontend/package.json +1 -0
  9. package/frontend/src/App.tsx +109 -152
  10. package/frontend/src/api.ts +605 -23
  11. package/frontend/src/components/BrainSelector.tsx +211 -199
  12. package/frontend/src/components/DocumentEditorModal.tsx +57 -0
  13. package/frontend/src/components/DocumentTable.tsx +47 -0
  14. package/frontend/src/components/Graph3D.tsx +120 -71
  15. package/frontend/src/components/UsageChart.tsx +3 -3
  16. package/frontend/src/components/brand/BrandMark.tsx +95 -0
  17. package/frontend/src/index.css +286 -86
  18. package/frontend/src/pages/ApiKeysPage.tsx +1878 -215
  19. package/frontend/src/pages/ChatPage.tsx +103 -45
  20. package/frontend/src/pages/DesignDocsPage.tsx +5 -5
  21. package/frontend/src/pages/FilesPage.tsx +10 -6
  22. package/frontend/src/pages/GraphPage.tsx +5 -3
  23. package/frontend/src/pages/HelpPage.tsx +2 -2
  24. package/frontend/src/pages/InboxPage.tsx +82 -0
  25. package/frontend/src/pages/InstructionsPage.tsx +1 -1
  26. package/frontend/src/pages/IntegrationsPage.tsx +21 -10
  27. package/frontend/src/pages/LoginPage.tsx +95 -77
  28. package/frontend/src/pages/MemoryPage.tsx +31 -8
  29. package/frontend/src/pages/OnboardingPage.tsx +690 -0
  30. package/frontend/src/pages/OpenWikiPage.tsx +412 -323
  31. package/frontend/src/pages/SettingsPage.tsx +825 -922
  32. package/frontend/src/pages/SkillsPage.tsx +272 -147
  33. package/frontend/src/pages/UsagePage.tsx +23 -31
  34. package/frontend/src/pages/VaultPage.tsx +223 -0
  35. package/frontend/src/types.ts +13 -0
  36. package/package.json +4 -4
  37. package/scaffold/.agent/skills/total-recall/SKILL.md +43 -4
  38. package/scaffold/.agent/skills/total-recall/modules/README.md +10 -0
  39. package/scaffold/.agent/skills/total-recall/modules/agents/README.md +5 -0
  40. package/scaffold/.agent/skills/total-recall/{skills/tr-cli-agents → modules/agents}/agents.yml +8 -0
  41. package/scaffold/.agent/skills/total-recall/modules/skill-deploy/README.md +9 -0
  42. package/scaffold/.agent/skills/total-recall/openwiki/README.md +10 -0
  43. package/scaffold/.agent/skills/total-recall/openwiki/architecture.md +5 -0
  44. package/scaffold/.agent/skills/total-recall/openwiki/ide.md +10 -0
  45. package/scaffold/.agent/skills/total-recall/openwiki/memory.md +11 -0
  46. package/scaffold/.agent/skills/total-recall/openwiki/secrets.md +7 -0
  47. package/scaffold/.agent/skills/total-recall/openwiki/skills.md +7 -0
  48. package/src/cli/brain.mjs +63 -5
  49. package/src/cli/connect.mjs +11 -19
  50. package/src/cli/daemon.mjs +5 -4
  51. package/src/cli/deploy-ui.mjs +8 -3
  52. package/src/cli/deploy.mjs +84 -27
  53. package/src/cli/ingest/index.mjs +1 -1
  54. package/src/cli/init.mjs +63 -34
  55. package/src/cli/remember.mjs +3 -3
  56. package/src/cli/secret.mjs +812 -0
  57. package/src/cli/setup.mjs +34 -7
  58. package/src/cli/share.mjs +2 -2
  59. package/src/cli/skill.mjs +396 -35
  60. package/src/cli/sync.mjs +4 -4
  61. package/src/cli/task.mjs +287 -0
  62. package/src/core/clarity-rewriter.mjs +5 -5
  63. package/src/core/config.mjs +44 -2
  64. package/src/core/conflict-detector.mjs +5 -5
  65. package/src/core/crons.mjs +54 -0
  66. package/src/core/daemon-loop.mjs +87 -235
  67. package/src/core/dream.mjs +170 -10
  68. package/src/core/env-import.mjs +456 -0
  69. package/src/core/fact-seeker.mjs +14 -14
  70. package/src/core/import-rules.mjs +20 -7
  71. package/src/core/inference-engine.mjs +3 -3
  72. package/src/core/migrate.mjs +14 -8
  73. package/src/core/okf-adapter.mjs +2 -2
  74. package/src/core/operation-validator.mjs +39 -331
  75. package/src/core/optimizer.mjs +7 -0
  76. package/src/core/post-mortem.mjs +2 -2
  77. package/src/core/project-brain.mjs +349 -0
  78. package/src/core/provider-catalog.mjs +296 -0
  79. package/src/core/quick-capture.mjs +1 -1
  80. package/src/core/remote-vault-sync.mjs +194 -0
  81. package/src/core/research-queue.mjs +7 -11
  82. package/src/core/runtime.mjs +33 -9
  83. package/src/core/scheduler.mjs +59 -5
  84. package/src/core/schema.mjs +14 -0
  85. package/src/core/search.mjs +1 -1
  86. package/src/core/secrets-env-export.mjs +323 -0
  87. package/src/core/secrets-rotate.mjs +245 -0
  88. package/src/core/secrets-store.mjs +645 -0
  89. package/src/core/semantic-index.mjs +3 -3
  90. package/src/core/skills-registry.mjs +1062 -0
  91. package/src/core/source-adapters.mjs +4 -1
  92. package/src/core/ssss-host-extension.mjs +94 -0
  93. package/src/core/ssss-kernel-bridge.mjs +530 -0
  94. package/src/core/surface.mjs +14 -0
  95. package/src/core/task-envelope.mjs +298 -0
  96. package/src/core/task-executors.mjs +600 -0
  97. package/src/core/validated-write.mjs +124 -56
  98. package/src/core/vault.mjs +21 -34
  99. package/src/core/webauthn-store.mjs +272 -0
  100. package/src/server/api.mjs +26 -16
  101. package/src/server/auth.mjs +51 -0
  102. package/src/server/index.mjs +3 -3
  103. package/src/server/keys.mjs +30 -4
  104. package/src/server/rest.mjs +198 -25
  105. package/src/server/route-manifest.json +156 -0
  106. package/src/server/routes/_shared.mjs +40 -1
  107. package/src/server/routes/docs.mjs +260 -0
  108. package/src/server/routes/memory.mjs +145 -32
  109. package/src/server/routes/research.mjs +30 -0
  110. package/src/server/routes/secrets.mjs +470 -0
  111. package/src/server/routes/share.mjs +2 -2
  112. package/src/server/routes/skills.mjs +452 -54
  113. package/src/server/routes/sync.mjs +48 -0
  114. package/src/server/routes/webauthn.mjs +184 -0
  115. package/src/server/update-route-manifest.mjs +39 -0
  116. package/templates/onboarding-interview.md +32 -22
  117. package/templates/openwiki/README.md +10 -0
  118. package/templates/openwiki/architecture.md +5 -0
  119. package/templates/openwiki/ide.md +10 -0
  120. package/templates/openwiki/memory.md +11 -0
  121. package/templates/openwiki/secrets.md +7 -0
  122. package/templates/openwiki/skills.md +7 -0
  123. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/SKILL.md +0 -121
  124. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/antigravity.txt +0 -20
  125. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/claude.txt +0 -58
  126. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/codex.txt +0 -81
  127. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/gemini.txt +0 -44
  128. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/scripts/.gitkeep +0 -0
  129. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/subagents/.gitkeep +0 -0
  130. package/scaffold/.agent/skills/total-recall/skills/tr-research/SKILL.md +0 -338
  131. package/scaffold/.agent/skills/total-recall/skills/tr-skill/SKILL.md +0 -282
  132. package/scaffold/.agent/skills/total-recall/skills/tr-skill/assets/skill-template/SKILL.md +0 -20
  133. package/scaffold/.agent/skills/total-recall/skills/tr-skill/evals/evals.json +0 -20
  134. package/scaffold/.agent/skills/total-recall/skills/tr-skill/hooks/on-skill-add.sh +0 -14
  135. package/scaffold/.agent/skills/total-recall/skills/tr-skill/hooks/on-skill-delete.sh +0 -14
  136. package/scaffold/.agent/skills/total-recall/skills/tr-skill/learnings/.gitkeep +0 -0
  137. package/scaffold/.agent/skills/total-recall/skills/tr-skill/references/.gitkeep +0 -0
  138. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/.gitkeep +0 -0
  139. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/create-skill.sh +0 -65
  140. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/enforce-skill-optimization.mjs +0 -135
  141. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/skill-watcher.mjs +0 -64
  142. package/scaffold/.agent/skills/total-recall/skills/tr-skill/subagents/audit-all-skills.md +0 -62
  143. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/SKILL.md +0 -298
  144. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/evals/evals.json +0 -17
  145. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/references/CHANGELOG.md +0 -124
  146. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/references/ssss-spec.md +0 -1325
  147. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/scripts/validate-schema.mjs +0 -232
  148. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/subagents/audit-ssss-node.md +0 -9
  149. /package/scaffold/.agent/skills/total-recall/{skills/tr-cli-agents/evals → modules/skill-deploy/scripts}/.gitkeep +0 -0
  150. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/find-skills.mjs +0 -0
  151. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/install-skill.mjs +0 -0
  152. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/scan-skill.mjs +0 -0
@@ -1,232 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { fileURLToPath, pathToFileURL } from 'node:url';
4
- import matter from 'gray-matter';
5
-
6
- const APPEND_TYPES = new Set(['conversation', 'run']);
7
- const CONTRACT_ONLY_TYPES = new Set(['operation', 'patch', 'lease']);
8
- const V2_MEMORY_REQUIRED = [
9
- 'confidence',
10
- 'importance',
11
- 'modality',
12
- 'subject',
13
- 'predicate',
14
- 'object',
15
- 'sentiment_polarity',
16
- 'sentiment_target',
17
- ];
18
-
19
- const FALLBACK_REQUIRED_BY_TYPE = {
20
- memory: ['slug', 'category', 'title', 'status', 'schema_version'],
21
- skill: ['name', 'description'],
22
- task: ['priority', 'category', 'status'],
23
- assistant: ['name'],
24
- workflow: ['name'],
25
- rule: ['name'],
26
- model: ['model_id', 'provider'],
27
- conversation: ['thread_id'],
28
- run: ['run_id', 'workflow_id'],
29
- conflict: ['conflict_id', 'status', 'new_slug', 'existing_slug', 'detected_at'],
30
- page: ['slug', 'name', 'sandbox_entry'],
31
- migration: ['migration_id', 'from_version', 'to_version', 'status', 'description'],
32
- release: ['release_id', 'version', 'schema_version', 'summary', 'released_at'],
33
- };
34
-
35
- let kernelPromise;
36
-
37
- function findRepoRoot(startDir) {
38
- let dir = path.resolve(startDir);
39
- while (true) {
40
- if (
41
- fs.existsSync(path.join(dir, 'package.json')) &&
42
- fs.existsSync(path.join(dir, 'src/core/schema.mjs'))
43
- ) {
44
- return dir;
45
- }
46
- const parent = path.dirname(dir);
47
- if (parent === dir) return null;
48
- dir = parent;
49
- }
50
- }
51
-
52
- async function loadKernel() {
53
- if (kernelPromise) return kernelPromise;
54
-
55
- kernelPromise = (async () => {
56
- const scriptDir = path.dirname(fileURLToPath(import.meta.url));
57
- const roots = [process.cwd(), scriptDir]
58
- .map(findRepoRoot)
59
- .filter(Boolean);
60
- const repoRoot = roots[0];
61
- if (!repoRoot) return { repoRoot: null, schemas: null, validateMemoryNode: null };
62
-
63
- try {
64
- const schemaUrl = pathToFileURL(path.join(repoRoot, 'src/core/schema.mjs')).href;
65
- const validatorUrl = pathToFileURL(
66
- path.join(repoRoot, 'src/core/total-recall-memory-validator.mjs')
67
- ).href;
68
- const [{ SSSS_SCHEMAS }, { validateMemoryNode }] = await Promise.all([
69
- import(schemaUrl),
70
- import(validatorUrl),
71
- ]);
72
- return { repoRoot, schemas: SSSS_SCHEMAS, validateMemoryNode };
73
- } catch {
74
- return { repoRoot, schemas: null, validateMemoryNode: null };
75
- }
76
- })();
77
-
78
- return kernelPromise;
79
- }
80
-
81
- function formatZodIssues(error) {
82
- return (error?.issues || []).map((issue) => {
83
- const field = issue.path?.length ? issue.path.join('.') : '(root)';
84
- return `${field}: ${issue.message}`;
85
- });
86
- }
87
-
88
- function addMissingFieldErrors(errors, data, fields) {
89
- for (const field of fields) {
90
- if (data[field] === undefined || data[field] === null || data[field] === '') {
91
- errors.push(`Missing required field '${field}'.`);
92
- }
93
- }
94
- }
95
-
96
- function validateFallback(data, errors, warnings) {
97
- if (!data.type) {
98
- errors.push('Missing required frontmatter field: type.');
99
- return;
100
- }
101
-
102
- if (typeof data.type !== 'string') {
103
- errors.push('Frontmatter field type must be a string.');
104
- return;
105
- }
106
-
107
- if (CONTRACT_ONLY_TYPES.has(data.type)) {
108
- errors.push(
109
- `Type '${data.type}' is a contract envelope type, not a Markdown document primitive.`
110
- );
111
- return;
112
- }
113
-
114
- const requiredFields = FALLBACK_REQUIRED_BY_TYPE[data.type];
115
- if (!requiredFields) {
116
- warnings.push(
117
- `No local fallback schema for type '${data.type}'. Implementation registry was unavailable.`
118
- );
119
- return;
120
- }
121
-
122
- addMissingFieldErrors(errors, data, requiredFields);
123
- }
124
-
125
- function validateMemoryV2(data, errors) {
126
- if (data.schema_version !== 2) {
127
- errors.push(`Expected memory schema_version: 2, got: ${data.schema_version}`);
128
- return;
129
- }
130
- addMissingFieldErrors(errors, data, V2_MEMORY_REQUIRED);
131
- }
132
-
133
- function validateMemoryPath(filePath, data, warnings) {
134
- const normalized = filePath.split(path.sep).join('/');
135
- if (!normalized.includes('/memory-vault/')) return;
136
-
137
- const parent = path.basename(path.dirname(filePath));
138
- if (data.category && parent !== data.category) {
139
- warnings.push(
140
- `Memory category '${data.category}' does not match parent directory '${parent}'.`
141
- );
142
- }
143
- }
144
-
145
- /**
146
- * Validates a single SSSS Markdown file against the Total Recall implementation
147
- * schema when available, with a scaffold-safe fallback for standalone installs.
148
- */
149
- export async function validateNode(filePath) {
150
- const target = path.resolve(filePath);
151
-
152
- try {
153
- const raw = fs.readFileSync(target, 'utf8');
154
- const parsed = matter(raw);
155
- const data = parsed.data || {};
156
- const errors = [];
157
- const warnings = [];
158
- const kernel = await loadKernel();
159
-
160
- if (!raw.trimStart().startsWith('---')) {
161
- errors.push('Missing YAML frontmatter block.');
162
- }
163
-
164
- if (data.type && CONTRACT_ONLY_TYPES.has(data.type)) {
165
- errors.push(
166
- `Type '${data.type}' is a contract envelope type, not a Markdown document primitive.`
167
- );
168
- } else if (data.type === 'memory' && kernel.validateMemoryNode) {
169
- const result = kernel.validateMemoryNode(data);
170
- if (!result.success) errors.push(...result.errors);
171
- } else if (data.type && kernel.schemas?.[data.type]) {
172
- const result = kernel.schemas[data.type].safeParse(data);
173
- if (!result.success) errors.push(...formatZodIssues(result.error));
174
- } else {
175
- validateFallback(data, errors, warnings);
176
- if (data.type === 'memory') validateMemoryV2(data, errors);
177
- }
178
-
179
- if (APPEND_TYPES.has(data.type) && parsed.content.trim().length === 0) {
180
- warnings.push(`Append-type '${data.type}' has an empty body.`);
181
- }
182
-
183
- if (data.type === 'memory') validateMemoryPath(target, data, warnings);
184
-
185
- return {
186
- valid: errors.length === 0,
187
- errors,
188
- warnings,
189
- file: target,
190
- type: data.type || null,
191
- };
192
- } catch (err) {
193
- return {
194
- valid: false,
195
- errors: [err.message],
196
- warnings: [],
197
- file: target,
198
- type: null,
199
- };
200
- }
201
- }
202
-
203
- function realPathOrPath(value) {
204
- try {
205
- return fs.realpathSync(value);
206
- } catch {
207
- return value;
208
- }
209
- }
210
-
211
- const invokedPath = process.argv[1] ? realPathOrPath(path.resolve(process.argv[1])) : null;
212
- const modulePath = realPathOrPath(fileURLToPath(import.meta.url));
213
- if (invokedPath === modulePath) {
214
- const target = process.argv[2];
215
- if (!target) {
216
- console.log('Usage: node validate-schema.mjs <path-to-ssss-node.md>');
217
- process.exit(0);
218
- }
219
-
220
- const result = await validateNode(target);
221
- if (result.warnings.length > 0) {
222
- console.warn(`Warnings for ${path.basename(result.file)}:\n${result.warnings.join('\n')}`);
223
- }
224
-
225
- if (result.valid) {
226
- console.log(`OK: SSSS node "${path.basename(result.file)}" is valid.`);
227
- process.exit(0);
228
- }
229
-
230
- console.error(`FAIL: Validation failed for "${path.basename(result.file)}":\n${result.errors.join('\n')}`);
231
- process.exit(1);
232
- }
@@ -1,9 +0,0 @@
1
- # Role: SSSS Schema Auditor
2
-
3
- You are a specialized subagent designed to audit Structured Semantic Syntax System (SSSS) nodes.
4
-
5
- ## Directives
6
- 1. Open and parse the target `.md` memory node.
7
- 2. Confirm the presence of absolute frontmatter keys: `type`, `slug`, `category`, `title`, and `schema_version`.
8
- 3. Verify that `category` matches the parent directory.
9
- 4. Report any formatting anomalies.