total-recall-brain 3.41.4 → 3.41.6
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/bin/total-recall.mjs +10 -6
- package/docs/reference/cli-reference.md +18 -0
- package/frontend/dist/assets/index-4tGQfTa2.js +5605 -0
- package/frontend/dist/assets/index-DtwsDyFM.css +1 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/package.json +11 -0
- package/frontend/src/App.tsx +47 -122
- package/frontend/src/components/plugins/plugin-frame.ts +1 -0
- package/frontend/src/index.css +152 -86
- package/frontend/src/pages/HelpPage.tsx +13 -10
- package/frontend/src/pages/MemoryPage.tsx +28 -30
- package/frontend/src/pages/NetworkPage.tsx +3 -3
- package/frontend/src/pages/PluginsPage.tsx +6 -5
- package/frontend/src/pages/RulesPage.tsx +16 -12
- package/package.json +4 -3
- package/scaffold/.agent/skills/total-recall/plugins/code-quality/package-lock.json +3114 -36
- package/scaffold/.agent/skills/total-recall/plugins/code-quality/package.json +4 -1
- package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package-lock.json +3114 -36
- package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package.json +4 -1
- package/scaffold/.agent/skills/total-recall/plugins/embeddings/package-lock.json +3121 -33
- package/scaffold/.agent/skills/total-recall/plugins/embeddings/package.json +4 -1
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package-lock.json +3122 -34
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package.json +4 -1
- package/scaffold/.agent/skills/total-recall/plugins/mesh/package-lock.json +3127 -49
- package/scaffold/.agent/skills/total-recall/plugins/mesh/package.json +5 -2
- package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh.mjs +1 -1
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/capability/index.mjs +136 -7
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/cli.mjs +135 -26
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/package-lock.json +3121 -33
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/package.json +5 -2
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/plugin.json +228 -9
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/skills/meta-harness/SKILL.md +24 -30
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/alerts.mjs +29 -16
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/cascade.mjs +73 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/coordinator.mjs +182 -365
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/dispatch.mjs +33 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/documentation.mjs +40 -14
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/executor.mjs +4 -4
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/agy.mjs +187 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/claude.mjs +275 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/cline.mjs +132 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/codex.mjs +187 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/cursor.mjs +158 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/devin.mjs +157 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/dsh.mjs +183 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/grok.mjs +132 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/hermes.mjs +173 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/index.mjs +87 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/openclaw.mjs +173 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate-adapters/pi.mjs +129 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/gate.mjs +12 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/json-reply.mjs +22 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/learner.mjs +72 -70
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/model-catalog.mjs +195 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/paths.mjs +11 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/pool.mjs +36 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/review.mjs +169 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/router.mjs +136 -346
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/runtime.mjs +1 -1
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/ssss-store.mjs +20 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/telemetry.mjs +43 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/threads.mjs +156 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/worker.mjs +117 -35
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/src/worktree.mjs +51 -0
- package/scaffold/.agent/skills/total-recall/plugins/meta-harness/ui/card.js +398 -57
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/cli.mjs +304 -46
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/package-lock.json +367 -41
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/package.json +5 -2
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/plugin.json +33 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/config.mjs +2 -2
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/generate.mjs +159 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/graph.mjs +197 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/lint.mjs +153 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/mesh-vaults.mjs +261 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/refresh.mjs +151 -4
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/search.mjs +114 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/token.mjs +96 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/ui/card.js +899 -662
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/openwiki.mjs +8987 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/skills/mermaid-diagrams/SKILL.md +44 -0
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/vendor/skills/write-connector/SKILL.md +56 -0
- package/scaffold/.agent/skills/total-recall/plugins/security/package-lock.json +3097 -81
- package/scaffold/.agent/skills/total-recall/plugins/security/package.json +4 -1
- package/src/cli/agent.mjs +12 -1
- package/src/cli/compact.mjs +108 -0
- package/src/cli/connect.mjs +56 -1
- package/src/cli/context.mjs +55 -23
- package/src/cli/doctor.mjs +5 -2
- package/src/cli/forget.mjs +2 -0
- package/src/cli/harness.mjs +62 -50
- package/src/cli/memory-entry.mjs +2 -2
- package/src/cli/preflight.mjs +152 -16
- package/src/cli/release.mjs +386 -0
- package/src/cli/remember.mjs +19 -1
- package/src/cli/rules.mjs +54 -12
- package/src/cli/startup.mjs +1 -1
- package/src/cli/status.mjs +12 -2
- package/src/core/claude-hooks.mjs +41 -3
- package/src/core/cli-commands.mjs +2 -0
- package/src/core/cli-semantic-index.mjs +3 -2
- package/src/core/conflict-detector.mjs +23 -12
- package/src/core/context-compactor.mjs +145 -0
- package/src/core/context-policy.mjs +20 -0
- package/src/core/duplicate-guard.mjs +350 -0
- package/src/core/meta-harness.mjs +31 -11
- package/src/core/preflight-gate.mjs +2 -2
- package/src/core/preflight-receipt.mjs +29 -1
- package/src/core/scaffold-plugins.mjs +7 -0
- package/src/core/stdio-flush.mjs +23 -0
- package/src/core/surface.mjs +33 -10
- package/src/server/invoke-durability.mjs +39 -0
- package/src/server/invoke-write-child.mjs +25 -0
- package/src/server/routes/invoke.mjs +7 -0
- package/src/server/routes/plugins.mjs +2 -2
- package/frontend/dist/assets/index-BIQmqDKP.css +0 -1
- package/frontend/dist/assets/index-CRzjQLu7.js +0 -5631
- package/frontend/src/components/DaemonLogsTab.tsx +0 -54
- package/frontend/src/components/ResearchAgendaTab.tsx +0 -712
- package/frontend/src/components/TaskQueueTab.tsx +0 -193
- package/frontend/src/components/VoiceInput.tsx +0 -112
- package/frontend/src/pages/ChatPage.tsx +0 -1059
- package/frontend/src/pages/CollabPage.tsx +0 -470
- package/frontend/src/pages/DesignDocsPage.tsx +0 -621
- package/frontend/src/pages/FilesPage.tsx +0 -393
- package/frontend/src/pages/HealthPage.tsx +0 -359
- package/frontend/src/pages/InboxPage.tsx +0 -83
- package/frontend/src/pages/InstructionsPage.tsx +0 -583
- package/frontend/src/pages/IntegrationsPage.tsx +0 -761
- package/frontend/src/pages/MeshPage.css +0 -58
- package/frontend/src/pages/MeshPage.tsx +0 -1219
- package/frontend/src/pages/OkfPage.tsx +0 -535
- package/frontend/src/pages/SandboxPage.tsx +0 -113
- package/frontend/src/pages/SkillsPage.tsx +0 -1994
- package/frontend/src/pages/TasksPage.tsx +0 -427
- package/frontend/src/pages/UsagePage.tsx +0 -702
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/README.md +0 -65
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/cli.mjs +0 -76
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/package.json +0 -19
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/plugin.json +0 -266
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/adapters/dsh.mjs +0 -446
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/documentation.mjs +0 -152
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/executor.mjs +0 -71
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/runtime.mjs +0 -36
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/setup.mjs +0 -35
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/worker.mjs +0 -175
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/ui/DESIGN.md +0 -32
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/ui/card.js +0 -575
|
@@ -1,535 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { runSandbox } from '../api';
|
|
3
|
-
|
|
4
|
-
type OkfTab = 'import' | 'export' | 'lint';
|
|
5
|
-
type ConflictMode = 'skip' | 'warn' | 'overwrite';
|
|
6
|
-
type CategoryOverride = 'auto' | 'invariants' | 'preferences' | 'facts' | 'concepts' | 'patterns' | 'decisions' | 'lore';
|
|
7
|
-
type ExportFormat = 'directory' | 'tar.gz';
|
|
8
|
-
type ExportScope = 'all' | 'global' | 'project';
|
|
9
|
-
|
|
10
|
-
interface LintRow {
|
|
11
|
-
slug: string;
|
|
12
|
-
field: string;
|
|
13
|
-
severity: 'error' | 'warning' | 'info';
|
|
14
|
-
message: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// ─── Styles ────────────────────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
const tabBarStyle: React.CSSProperties = {
|
|
20
|
-
display: 'inline-flex',
|
|
21
|
-
gap: 0,
|
|
22
|
-
borderBottom: '1px solid var(--border)',
|
|
23
|
-
marginBottom: 24,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const tabStyle = (active: boolean): React.CSSProperties => ({
|
|
27
|
-
padding: '10px 20px',
|
|
28
|
-
background: 'transparent',
|
|
29
|
-
border: 'none',
|
|
30
|
-
borderBottom: active ? '2px solid var(--accent)' : '2px solid transparent',
|
|
31
|
-
color: active ? 'var(--text-primary)' : 'var(--text-secondary)',
|
|
32
|
-
fontWeight: active ? 600 : 400,
|
|
33
|
-
fontSize: 14,
|
|
34
|
-
cursor: 'pointer',
|
|
35
|
-
transition: 'color 0.2s, border-color 0.2s',
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const inputStyle: React.CSSProperties = {
|
|
39
|
-
background: 'var(--bg-secondary)',
|
|
40
|
-
color: 'var(--text-primary)',
|
|
41
|
-
border: '1px solid var(--border)',
|
|
42
|
-
borderRadius: 6,
|
|
43
|
-
padding: '10px 14px',
|
|
44
|
-
fontSize: 14,
|
|
45
|
-
outline: 'none',
|
|
46
|
-
width: '100%',
|
|
47
|
-
boxSizing: 'border-box',
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const selectStyle: React.CSSProperties = {
|
|
51
|
-
...inputStyle,
|
|
52
|
-
appearance: 'none',
|
|
53
|
-
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239e9e9e' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E")`,
|
|
54
|
-
backgroundRepeat: 'no-repeat',
|
|
55
|
-
backgroundPosition: 'right 12px center',
|
|
56
|
-
paddingRight: 32,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const fieldGroup: React.CSSProperties = {
|
|
60
|
-
display: 'flex',
|
|
61
|
-
flexDirection: 'column',
|
|
62
|
-
gap: 6,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const labelStyle: React.CSSProperties = {
|
|
66
|
-
fontSize: 13,
|
|
67
|
-
fontWeight: 500,
|
|
68
|
-
color: 'var(--text-secondary)',
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const cardStyle: React.CSSProperties = {
|
|
72
|
-
background: 'rgba(255,255,255,0.03)',
|
|
73
|
-
border: '1px solid var(--border)',
|
|
74
|
-
backdropFilter: 'blur(12px)',
|
|
75
|
-
borderRadius: 10,
|
|
76
|
-
padding: 24,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const outputStyle: React.CSSProperties = {
|
|
80
|
-
background: 'var(--bg-secondary)',
|
|
81
|
-
border: '1px solid var(--border)',
|
|
82
|
-
borderRadius: 8,
|
|
83
|
-
padding: 16,
|
|
84
|
-
fontFamily: 'var(--font-mono, monospace)',
|
|
85
|
-
fontSize: 13,
|
|
86
|
-
lineHeight: 1.6,
|
|
87
|
-
color: 'var(--text-secondary)',
|
|
88
|
-
whiteSpace: 'pre-wrap',
|
|
89
|
-
wordBreak: 'break-word',
|
|
90
|
-
maxHeight: 320,
|
|
91
|
-
overflowY: 'auto',
|
|
92
|
-
marginTop: 16,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const formGrid: React.CSSProperties = {
|
|
96
|
-
display: 'grid',
|
|
97
|
-
gridTemplateColumns: '1fr 1fr',
|
|
98
|
-
gap: 16,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const severityColor: Record<string, string> = {
|
|
102
|
-
error: 'var(--error)',
|
|
103
|
-
warning: 'var(--warning)',
|
|
104
|
-
info: 'var(--accent)',
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// ─── Component ─────────────────────────────────────────────────────────────────
|
|
108
|
-
|
|
109
|
-
export default function OkfPage() {
|
|
110
|
-
const [activeTab, setActiveTab] = useState<OkfTab>('import');
|
|
111
|
-
|
|
112
|
-
// ── Import state ──
|
|
113
|
-
const [importPath, setImportPath] = useState('');
|
|
114
|
-
const [conflictMode, setConflictMode] = useState<ConflictMode>('warn');
|
|
115
|
-
const [categoryOverride, setCategoryOverride] = useState<CategoryOverride>('auto');
|
|
116
|
-
const [importanceOverride, setImportanceOverride] = useState('');
|
|
117
|
-
const [importOutput, setImportOutput] = useState('');
|
|
118
|
-
const [importRunning, setImportRunning] = useState(false);
|
|
119
|
-
const [importError, setImportError] = useState(false);
|
|
120
|
-
|
|
121
|
-
// ── Export state ──
|
|
122
|
-
const [exportPath, setExportPath] = useState('');
|
|
123
|
-
const [stripMeta, setStripMeta] = useState(false);
|
|
124
|
-
const [exportFormat, setExportFormat] = useState<ExportFormat>('directory');
|
|
125
|
-
const [exportScope, setExportScope] = useState<ExportScope>('all');
|
|
126
|
-
const [exportOutput, setExportOutput] = useState('');
|
|
127
|
-
const [exportRunning, setExportRunning] = useState(false);
|
|
128
|
-
const [exportError, setExportError] = useState(false);
|
|
129
|
-
|
|
130
|
-
// ── Lint state ──
|
|
131
|
-
const [lintRows, setLintRows] = useState<LintRow[]>([]);
|
|
132
|
-
const [lintRan, setLintRan] = useState(false);
|
|
133
|
-
const [lintRunning, setLintRunning] = useState(false);
|
|
134
|
-
const [lintRawOutput, setLintRawOutput] = useState('');
|
|
135
|
-
|
|
136
|
-
// ── Handlers ──
|
|
137
|
-
|
|
138
|
-
const handleImport = async () => {
|
|
139
|
-
if (!importPath.trim()) return;
|
|
140
|
-
setImportRunning(true);
|
|
141
|
-
setImportOutput('');
|
|
142
|
-
setImportError(false);
|
|
143
|
-
try {
|
|
144
|
-
let cmd = `npx total-recall ingest okf ${JSON.stringify(importPath.trim())} --on-conflict ${conflictMode}`;
|
|
145
|
-
if (categoryOverride !== 'auto') cmd += ` --category ${categoryOverride}`;
|
|
146
|
-
const imp = parseInt(importanceOverride, 10);
|
|
147
|
-
if (imp >= 1 && imp <= 5) cmd += ` --importance ${imp}`;
|
|
148
|
-
|
|
149
|
-
const code = `
|
|
150
|
-
const { execSync } = require('child_process');
|
|
151
|
-
try {
|
|
152
|
-
const out = execSync(${JSON.stringify(cmd)}, { encoding: 'utf8', timeout: 30000 });
|
|
153
|
-
console.log(out);
|
|
154
|
-
} catch (e) {
|
|
155
|
-
console.error(e.stderr || e.message);
|
|
156
|
-
process.exit(1);
|
|
157
|
-
}`;
|
|
158
|
-
const result = await runSandbox(code, 30000);
|
|
159
|
-
setImportOutput(result.output);
|
|
160
|
-
setImportError(!result.success);
|
|
161
|
-
} catch (e) {
|
|
162
|
-
setImportOutput((e as Error).message);
|
|
163
|
-
setImportError(true);
|
|
164
|
-
} finally {
|
|
165
|
-
setImportRunning(false);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const handleExport = async () => {
|
|
170
|
-
if (!exportPath.trim()) return;
|
|
171
|
-
setExportRunning(true);
|
|
172
|
-
setExportOutput('');
|
|
173
|
-
setExportError(false);
|
|
174
|
-
try {
|
|
175
|
-
let cmd = `npx total-recall export okf ${JSON.stringify(exportPath.trim())} --format ${exportFormat} --scope ${exportScope}`;
|
|
176
|
-
if (stripMeta) cmd += ' --strip-ssss';
|
|
177
|
-
|
|
178
|
-
const code = `
|
|
179
|
-
const { execSync } = require('child_process');
|
|
180
|
-
try {
|
|
181
|
-
const out = execSync(${JSON.stringify(cmd)}, { encoding: 'utf8', timeout: 30000 });
|
|
182
|
-
console.log(out);
|
|
183
|
-
} catch (e) {
|
|
184
|
-
console.error(e.stderr || e.message);
|
|
185
|
-
process.exit(1);
|
|
186
|
-
}`;
|
|
187
|
-
const result = await runSandbox(code, 30000);
|
|
188
|
-
setExportOutput(result.output);
|
|
189
|
-
setExportError(!result.success);
|
|
190
|
-
} catch (e) {
|
|
191
|
-
setExportOutput((e as Error).message);
|
|
192
|
-
setExportError(true);
|
|
193
|
-
} finally {
|
|
194
|
-
setExportRunning(false);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const handleLint = async () => {
|
|
199
|
-
setLintRunning(true);
|
|
200
|
-
setLintRows([]);
|
|
201
|
-
setLintRawOutput('');
|
|
202
|
-
setLintRan(false);
|
|
203
|
-
try {
|
|
204
|
-
const code = `
|
|
205
|
-
const { execSync } = require('child_process');
|
|
206
|
-
try {
|
|
207
|
-
const out = execSync('npx total-recall lint okf --json', { encoding: 'utf8', timeout: 30000 });
|
|
208
|
-
console.log(out);
|
|
209
|
-
} catch (e) {
|
|
210
|
-
// lint exits non-zero if there are errors — output is still valid
|
|
211
|
-
if (e.stdout) console.log(e.stdout);
|
|
212
|
-
else console.error(e.stderr || e.message);
|
|
213
|
-
}`;
|
|
214
|
-
const result = await runSandbox(code, 30000);
|
|
215
|
-
setLintRawOutput(result.output);
|
|
216
|
-
|
|
217
|
-
// Try to parse JSON lint output
|
|
218
|
-
try {
|
|
219
|
-
const parsed = JSON.parse(result.output);
|
|
220
|
-
const rows: LintRow[] = (Array.isArray(parsed) ? parsed : parsed.issues || []).map(
|
|
221
|
-
(item: { slug?: string; field?: string; severity?: string; message?: string }) => ({
|
|
222
|
-
slug: item.slug || '—',
|
|
223
|
-
field: item.field || '—',
|
|
224
|
-
severity: (['error', 'warning', 'info'].includes(item.severity || '') ? item.severity : 'info') as LintRow['severity'],
|
|
225
|
-
message: item.message || '',
|
|
226
|
-
}),
|
|
227
|
-
);
|
|
228
|
-
setLintRows(rows);
|
|
229
|
-
} catch {
|
|
230
|
-
// Non-JSON output — show raw
|
|
231
|
-
}
|
|
232
|
-
setLintRan(true);
|
|
233
|
-
} catch (e) {
|
|
234
|
-
setLintRawOutput((e as Error).message);
|
|
235
|
-
setLintRan(true);
|
|
236
|
-
} finally {
|
|
237
|
-
setLintRunning(false);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
const lintErrors = lintRows.filter(r => r.severity === 'error').length;
|
|
242
|
-
const lintWarnings = lintRows.filter(r => r.severity === 'warning').length;
|
|
243
|
-
|
|
244
|
-
// ── Render ──
|
|
245
|
-
|
|
246
|
-
return (
|
|
247
|
-
<div className="page">
|
|
248
|
-
<div className="page-header">
|
|
249
|
-
<h1>📦 Open Knowledge Format</h1>
|
|
250
|
-
<p style={{ color: 'var(--text-secondary)', margin: '4px 0 0' }}>
|
|
251
|
-
Import, export, and lint OKF bundles for interoperable memory exchange.
|
|
252
|
-
</p>
|
|
253
|
-
</div>
|
|
254
|
-
|
|
255
|
-
{/* Tab Navigation */}
|
|
256
|
-
<div style={tabBarStyle}>
|
|
257
|
-
{(['import', 'export', 'lint'] as OkfTab[]).map(tab => (
|
|
258
|
-
<button
|
|
259
|
-
key={tab}
|
|
260
|
-
id={`okf-tab-${tab}`}
|
|
261
|
-
style={tabStyle(activeTab === tab)}
|
|
262
|
-
onClick={() => setActiveTab(tab)}
|
|
263
|
-
>
|
|
264
|
-
{tab === 'import' && '⬇ Import'}
|
|
265
|
-
{tab === 'export' && '⬆ Export'}
|
|
266
|
-
{tab === 'lint' && '🔍 Lint'}
|
|
267
|
-
</button>
|
|
268
|
-
))}
|
|
269
|
-
</div>
|
|
270
|
-
|
|
271
|
-
{/* ── Import Tab ── */}
|
|
272
|
-
{activeTab === 'import' && (
|
|
273
|
-
<div style={cardStyle}>
|
|
274
|
-
<p style={{ color: 'var(--text-secondary)', fontSize: 14, marginBottom: 20 }}>
|
|
275
|
-
Import Open Knowledge Format bundles into your memory vault.
|
|
276
|
-
</p>
|
|
277
|
-
|
|
278
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
|
279
|
-
<div style={fieldGroup}>
|
|
280
|
-
<label htmlFor="okf-import-path" style={labelStyle}>OKF Bundle Path</label>
|
|
281
|
-
<input
|
|
282
|
-
id="okf-import-path"
|
|
283
|
-
type="text"
|
|
284
|
-
placeholder="/path/to/okf-bundle"
|
|
285
|
-
value={importPath}
|
|
286
|
-
onChange={e => setImportPath(e.target.value)}
|
|
287
|
-
style={inputStyle}
|
|
288
|
-
/>
|
|
289
|
-
</div>
|
|
290
|
-
|
|
291
|
-
<div style={formGrid}>
|
|
292
|
-
<div style={fieldGroup}>
|
|
293
|
-
<label htmlFor="okf-conflict-mode" style={labelStyle}>Conflict Resolution</label>
|
|
294
|
-
<select
|
|
295
|
-
id="okf-conflict-mode"
|
|
296
|
-
value={conflictMode}
|
|
297
|
-
onChange={e => setConflictMode(e.target.value as ConflictMode)}
|
|
298
|
-
style={selectStyle}
|
|
299
|
-
>
|
|
300
|
-
<option value="skip">Skip</option>
|
|
301
|
-
<option value="warn">Warn (default)</option>
|
|
302
|
-
<option value="overwrite">Overwrite</option>
|
|
303
|
-
</select>
|
|
304
|
-
</div>
|
|
305
|
-
|
|
306
|
-
<div style={fieldGroup}>
|
|
307
|
-
<label htmlFor="okf-category-override" style={labelStyle}>Category Override</label>
|
|
308
|
-
<select
|
|
309
|
-
id="okf-category-override"
|
|
310
|
-
value={categoryOverride}
|
|
311
|
-
onChange={e => setCategoryOverride(e.target.value as CategoryOverride)}
|
|
312
|
-
style={selectStyle}
|
|
313
|
-
>
|
|
314
|
-
<option value="auto">Auto (default)</option>
|
|
315
|
-
<option value="invariants">Invariants</option>
|
|
316
|
-
<option value="preferences">Preferences</option>
|
|
317
|
-
<option value="facts">Facts</option>
|
|
318
|
-
<option value="concepts">Concepts</option>
|
|
319
|
-
<option value="patterns">Patterns</option>
|
|
320
|
-
<option value="decisions">Decisions</option>
|
|
321
|
-
<option value="lore">Lore</option>
|
|
322
|
-
</select>
|
|
323
|
-
</div>
|
|
324
|
-
</div>
|
|
325
|
-
|
|
326
|
-
<div style={{ ...fieldGroup, maxWidth: 200 }}>
|
|
327
|
-
<label htmlFor="okf-importance-override" style={labelStyle}>Importance Override (1–5)</label>
|
|
328
|
-
<input
|
|
329
|
-
id="okf-importance-override"
|
|
330
|
-
type="number"
|
|
331
|
-
min={1}
|
|
332
|
-
max={5}
|
|
333
|
-
placeholder="Optional"
|
|
334
|
-
value={importanceOverride}
|
|
335
|
-
onChange={e => setImportanceOverride(e.target.value)}
|
|
336
|
-
style={inputStyle}
|
|
337
|
-
/>
|
|
338
|
-
</div>
|
|
339
|
-
|
|
340
|
-
<button
|
|
341
|
-
id="okf-import-run"
|
|
342
|
-
className="btn btn-primary"
|
|
343
|
-
onClick={handleImport}
|
|
344
|
-
disabled={importRunning || !importPath.trim()}
|
|
345
|
-
style={{ alignSelf: 'flex-start', marginTop: 4 }}
|
|
346
|
-
>
|
|
347
|
-
{importRunning ? '⏳ Importing…' : '⬇ Import Bundle'}
|
|
348
|
-
</button>
|
|
349
|
-
</div>
|
|
350
|
-
|
|
351
|
-
{importOutput && (
|
|
352
|
-
<div id="okf-import-output" style={{ ...outputStyle, borderColor: importError ? 'var(--error)' : 'var(--border)' }}>
|
|
353
|
-
{importOutput}
|
|
354
|
-
</div>
|
|
355
|
-
)}
|
|
356
|
-
</div>
|
|
357
|
-
)}
|
|
358
|
-
|
|
359
|
-
{/* ── Export Tab ── */}
|
|
360
|
-
{activeTab === 'export' && (
|
|
361
|
-
<div style={cardStyle}>
|
|
362
|
-
<p style={{ color: 'var(--text-secondary)', fontSize: 14, marginBottom: 20 }}>
|
|
363
|
-
Export your memory vault as an Open Knowledge Format bundle.
|
|
364
|
-
</p>
|
|
365
|
-
|
|
366
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
|
367
|
-
<div style={fieldGroup}>
|
|
368
|
-
<label htmlFor="okf-export-path" style={labelStyle}>Output Path</label>
|
|
369
|
-
<input
|
|
370
|
-
id="okf-export-path"
|
|
371
|
-
type="text"
|
|
372
|
-
placeholder="/path/to/export"
|
|
373
|
-
value={exportPath}
|
|
374
|
-
onChange={e => setExportPath(e.target.value)}
|
|
375
|
-
style={inputStyle}
|
|
376
|
-
/>
|
|
377
|
-
</div>
|
|
378
|
-
|
|
379
|
-
<div style={formGrid}>
|
|
380
|
-
<div style={fieldGroup}>
|
|
381
|
-
<label htmlFor="okf-export-format" style={labelStyle}>Format</label>
|
|
382
|
-
<select
|
|
383
|
-
id="okf-export-format"
|
|
384
|
-
value={exportFormat}
|
|
385
|
-
onChange={e => setExportFormat(e.target.value as ExportFormat)}
|
|
386
|
-
style={selectStyle}
|
|
387
|
-
>
|
|
388
|
-
<option value="directory">Directory</option>
|
|
389
|
-
<option value="tar.gz">tar.gz</option>
|
|
390
|
-
</select>
|
|
391
|
-
</div>
|
|
392
|
-
|
|
393
|
-
<div style={fieldGroup}>
|
|
394
|
-
<label htmlFor="okf-export-scope" style={labelStyle}>Scope</label>
|
|
395
|
-
<select
|
|
396
|
-
id="okf-export-scope"
|
|
397
|
-
value={exportScope}
|
|
398
|
-
onChange={e => setExportScope(e.target.value as ExportScope)}
|
|
399
|
-
style={selectStyle}
|
|
400
|
-
>
|
|
401
|
-
<option value="all">All</option>
|
|
402
|
-
<option value="global">Global</option>
|
|
403
|
-
<option value="project">Project</option>
|
|
404
|
-
</select>
|
|
405
|
-
</div>
|
|
406
|
-
</div>
|
|
407
|
-
|
|
408
|
-
<label
|
|
409
|
-
htmlFor="okf-strip-meta"
|
|
410
|
-
style={{ display: 'flex', alignItems: 'center', gap: 8, cursor: 'pointer', fontSize: 14, color: 'var(--text-secondary)' }}
|
|
411
|
-
>
|
|
412
|
-
<input
|
|
413
|
-
id="okf-strip-meta"
|
|
414
|
-
type="checkbox"
|
|
415
|
-
checked={stripMeta}
|
|
416
|
-
onChange={e => setStripMeta(e.target.checked)}
|
|
417
|
-
style={{ accentColor: 'var(--accent)' }}
|
|
418
|
-
/>
|
|
419
|
-
Strip SSSS metadata
|
|
420
|
-
</label>
|
|
421
|
-
|
|
422
|
-
<button
|
|
423
|
-
id="okf-export-run"
|
|
424
|
-
className="btn btn-primary"
|
|
425
|
-
onClick={handleExport}
|
|
426
|
-
disabled={exportRunning || !exportPath.trim()}
|
|
427
|
-
style={{ alignSelf: 'flex-start', marginTop: 4 }}
|
|
428
|
-
>
|
|
429
|
-
{exportRunning ? '⏳ Exporting…' : '⬆ Export Vault'}
|
|
430
|
-
</button>
|
|
431
|
-
</div>
|
|
432
|
-
|
|
433
|
-
{exportOutput && (
|
|
434
|
-
<div id="okf-export-output" style={{ ...outputStyle, borderColor: exportError ? 'var(--error)' : 'var(--border)' }}>
|
|
435
|
-
{exportOutput}
|
|
436
|
-
</div>
|
|
437
|
-
)}
|
|
438
|
-
</div>
|
|
439
|
-
)}
|
|
440
|
-
|
|
441
|
-
{/* ── Lint Tab ── */}
|
|
442
|
-
{activeTab === 'lint' && (
|
|
443
|
-
<div style={cardStyle}>
|
|
444
|
-
<p style={{ color: 'var(--text-secondary)', fontSize: 14, marginBottom: 20 }}>
|
|
445
|
-
Run OKF compliance checks across all memory nodes.
|
|
446
|
-
</p>
|
|
447
|
-
|
|
448
|
-
<button
|
|
449
|
-
id="okf-lint-run"
|
|
450
|
-
className="btn btn-primary"
|
|
451
|
-
onClick={handleLint}
|
|
452
|
-
disabled={lintRunning}
|
|
453
|
-
style={{ marginBottom: 20 }}
|
|
454
|
-
>
|
|
455
|
-
{lintRunning ? '⏳ Checking…' : '🔍 Run Compliance Check'}
|
|
456
|
-
</button>
|
|
457
|
-
|
|
458
|
-
{lintRan && lintRows.length > 0 && (
|
|
459
|
-
<>
|
|
460
|
-
<div style={{ overflowX: 'auto' }}>
|
|
461
|
-
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: 13 }}>
|
|
462
|
-
<thead>
|
|
463
|
-
<tr style={{ borderBottom: '1px solid var(--border)' }}>
|
|
464
|
-
<th style={{ textAlign: 'left', padding: '10px 12px', color: 'var(--text-secondary)', fontWeight: 500 }}>Slug</th>
|
|
465
|
-
<th style={{ textAlign: 'left', padding: '10px 12px', color: 'var(--text-secondary)', fontWeight: 500 }}>Field</th>
|
|
466
|
-
<th style={{ textAlign: 'left', padding: '10px 12px', color: 'var(--text-secondary)', fontWeight: 500 }}>Severity</th>
|
|
467
|
-
<th style={{ textAlign: 'left', padding: '10px 12px', color: 'var(--text-secondary)', fontWeight: 500 }}>Message</th>
|
|
468
|
-
</tr>
|
|
469
|
-
</thead>
|
|
470
|
-
<tbody>
|
|
471
|
-
{lintRows.map((row, i) => (
|
|
472
|
-
<tr key={i} style={{ borderBottom: '1px solid var(--border)' }}>
|
|
473
|
-
<td style={{ padding: '10px 12px', color: 'var(--text-primary)', fontFamily: 'var(--font-mono, monospace)' }}>{row.slug}</td>
|
|
474
|
-
<td style={{ padding: '10px 12px', color: 'var(--text-secondary)' }}>{row.field}</td>
|
|
475
|
-
<td style={{ padding: '10px 12px' }}>
|
|
476
|
-
<span
|
|
477
|
-
className="badge"
|
|
478
|
-
style={{
|
|
479
|
-
background: `${severityColor[row.severity]}22`,
|
|
480
|
-
color: severityColor[row.severity],
|
|
481
|
-
padding: '3px 10px',
|
|
482
|
-
borderRadius: 4,
|
|
483
|
-
fontSize: 12,
|
|
484
|
-
fontWeight: 600,
|
|
485
|
-
textTransform: 'uppercase',
|
|
486
|
-
}}
|
|
487
|
-
>
|
|
488
|
-
{row.severity}
|
|
489
|
-
</span>
|
|
490
|
-
</td>
|
|
491
|
-
<td style={{ padding: '10px 12px', color: 'var(--text-secondary)' }}>{row.message}</td>
|
|
492
|
-
</tr>
|
|
493
|
-
))}
|
|
494
|
-
</tbody>
|
|
495
|
-
<tfoot>
|
|
496
|
-
<tr style={{ borderTop: '2px solid var(--border)' }}>
|
|
497
|
-
<td colSpan={4} style={{ padding: '12px', color: 'var(--text-secondary)', fontSize: 13 }}>
|
|
498
|
-
<strong style={{ color: 'var(--text-primary)' }}>Total: {lintRows.length}</strong>
|
|
499
|
-
{' · '}
|
|
500
|
-
<span style={{ color: 'var(--error)' }}>Errors: {lintErrors}</span>
|
|
501
|
-
{' · '}
|
|
502
|
-
<span style={{ color: 'var(--warning)' }}>Warnings: {lintWarnings}</span>
|
|
503
|
-
</td>
|
|
504
|
-
</tr>
|
|
505
|
-
</tfoot>
|
|
506
|
-
</table>
|
|
507
|
-
</div>
|
|
508
|
-
</>
|
|
509
|
-
)}
|
|
510
|
-
|
|
511
|
-
{lintRan && lintRows.length === 0 && !lintRawOutput && (
|
|
512
|
-
<div
|
|
513
|
-
id="okf-lint-pass"
|
|
514
|
-
style={{
|
|
515
|
-
textAlign: 'center',
|
|
516
|
-
padding: '40px 20px',
|
|
517
|
-
color: 'var(--success)',
|
|
518
|
-
fontSize: 15,
|
|
519
|
-
fontWeight: 500,
|
|
520
|
-
}}
|
|
521
|
-
>
|
|
522
|
-
✅ All nodes pass OKF compliance
|
|
523
|
-
</div>
|
|
524
|
-
)}
|
|
525
|
-
|
|
526
|
-
{lintRan && lintRows.length === 0 && lintRawOutput && (
|
|
527
|
-
<div id="okf-lint-output" style={outputStyle}>
|
|
528
|
-
{lintRawOutput}
|
|
529
|
-
</div>
|
|
530
|
-
)}
|
|
531
|
-
</div>
|
|
532
|
-
)}
|
|
533
|
-
</div>
|
|
534
|
-
);
|
|
535
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react'
|
|
2
|
-
import { runSandbox, fetchConfig, saveConfig } from '../api'
|
|
3
|
-
|
|
4
|
-
const DEFAULT_CODE = `// Total Recall Sandbox — JavaScript
|
|
5
|
-
// Code runs in an isolated Node.js process.
|
|
6
|
-
|
|
7
|
-
const result = Array.from({ length: 5 }, (_, i) => ({
|
|
8
|
-
index: i,
|
|
9
|
-
fibonacci: fib(i),
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
function fib(n) {
|
|
13
|
-
if (n <= 1) return n;
|
|
14
|
-
return fib(n - 1) + fib(n - 2);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
console.log(JSON.stringify(result, null, 2));
|
|
18
|
-
`
|
|
19
|
-
|
|
20
|
-
export default function SandboxPage() {
|
|
21
|
-
const [fileMode, setFileMode] = useState<'script.mjs' | 'DESIGN.md'>('script.mjs')
|
|
22
|
-
const [code, setCode] = useState(DEFAULT_CODE)
|
|
23
|
-
const [designCode, setDesignCode] = useState('# Design System\n\nPreview your markdown here.')
|
|
24
|
-
const [output, setOutput] = useState('')
|
|
25
|
-
const [isError, setIsError] = useState(false)
|
|
26
|
-
const [running, setRunning] = useState(false)
|
|
27
|
-
const [isFullscreen, setIsFullscreen] = useState(false)
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
fetchConfig('DESIGN.md').then(setDesignCode).catch(() => {})
|
|
31
|
-
}, [])
|
|
32
|
-
|
|
33
|
-
const handleRun = async () => {
|
|
34
|
-
if (fileMode === 'DESIGN.md') {
|
|
35
|
-
try {
|
|
36
|
-
await saveConfig('DESIGN.md', designCode)
|
|
37
|
-
setOutput('DESIGN.md saved successfully.')
|
|
38
|
-
setIsError(false)
|
|
39
|
-
} catch (e) {
|
|
40
|
-
setOutput((e as Error).message)
|
|
41
|
-
setIsError(true)
|
|
42
|
-
}
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
setRunning(true)
|
|
47
|
-
setOutput('')
|
|
48
|
-
try {
|
|
49
|
-
const result = await runSandbox(code)
|
|
50
|
-
setOutput(result.output)
|
|
51
|
-
setIsError(!result.success)
|
|
52
|
-
} catch (e) {
|
|
53
|
-
setOutput((e as Error).message)
|
|
54
|
-
setIsError(true)
|
|
55
|
-
} finally {
|
|
56
|
-
setRunning(false)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const toggleChat = () => {
|
|
61
|
-
window.dispatchEvent(new CustomEvent('toggle-floating-chat'))
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const containerStyle: React.CSSProperties = isFullscreen ? {
|
|
65
|
-
position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, zIndex: 9000, background: 'var(--bg-primary)'
|
|
66
|
-
} : {}
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div className="page" style={containerStyle}>
|
|
70
|
-
<div className="page-header" style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
71
|
-
<div>
|
|
72
|
-
<h1>Code Sandbox & Design</h1>
|
|
73
|
-
<p>Execute JavaScript or edit Design System</p>
|
|
74
|
-
</div>
|
|
75
|
-
<div style={{ display: 'flex', gap: 8 }}>
|
|
76
|
-
<button className="btn btn-ghost btn-sm" onClick={toggleChat}>💬 Float Agent</button>
|
|
77
|
-
<button className="btn btn-ghost btn-sm" onClick={() => setIsFullscreen(!isFullscreen)}>
|
|
78
|
-
{isFullscreen ? 'Exit Fullscreen' : 'Fullscreen'}
|
|
79
|
-
</button>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
<div className="sandbox-layout">
|
|
83
|
-
<div className="sandbox-editor">
|
|
84
|
-
<div className="sandbox-editor-header" style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
85
|
-
<select
|
|
86
|
-
value={fileMode}
|
|
87
|
-
onChange={e => setFileMode(e.target.value as 'script.mjs' | 'DESIGN.md')}
|
|
88
|
-
style={{ background: 'transparent', color: 'white', border: 'none', outline: 'none', fontWeight: 600 }}
|
|
89
|
-
>
|
|
90
|
-
<option value="script.mjs">script.mjs</option>
|
|
91
|
-
<option value="DESIGN.md">DESIGN.md</option>
|
|
92
|
-
</select>
|
|
93
|
-
<span style={{ fontFamily: 'var(--font-mono)' }}>{fileMode === 'DESIGN.md' ? 'Markdown' : 'JavaScript'}</span>
|
|
94
|
-
</div>
|
|
95
|
-
<textarea
|
|
96
|
-
id="sandbox-editor"
|
|
97
|
-
value={fileMode === 'DESIGN.md' ? designCode : code}
|
|
98
|
-
onChange={e => fileMode === 'DESIGN.md' ? setDesignCode(e.target.value) : setCode(e.target.value)}
|
|
99
|
-
spellCheck={false}
|
|
100
|
-
/>
|
|
101
|
-
</div>
|
|
102
|
-
<div className="sandbox-toolbar">
|
|
103
|
-
<button className="btn btn-primary" onClick={handleRun} disabled={running} id="sandbox-run">
|
|
104
|
-
{fileMode === 'DESIGN.md' ? '💾 Save Design' : (running ? '⏳ Running…' : '▶ Run Code')}
|
|
105
|
-
</button>
|
|
106
|
-
</div>
|
|
107
|
-
<div className={`sandbox-output ${isError ? 'error' : ''}`} id="sandbox-output">
|
|
108
|
-
{output || (fileMode === 'DESIGN.md' ? '// Output saved to ~/.agent/config/DESIGN.md' : '// Output will appear here after execution')}
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
)
|
|
113
|
-
}
|