siduri 1.0.0 → 1.0.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 (44) hide show
  1. package/README.md +7 -6
  2. package/dist/clean-machine-smoke.test.js +3 -3
  3. package/dist/configurators/archive.d.ts +2 -0
  4. package/dist/configurators/{memory.js → archive.js} +3 -3
  5. package/dist/configurators/index.d.ts +1 -1
  6. package/dist/configurators/index.js +4 -3
  7. package/dist/configurators.test.js +3 -3
  8. package/dist/generator.js +19 -19
  9. package/dist/generator.test.js +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +8 -5
  12. package/dist/release-check.js +2 -2
  13. package/dist/runtime-parity.test.js +3 -3
  14. package/dist/web-dist/404/index.html +1 -1
  15. package/dist/web-dist/404.html +1 -1
  16. package/dist/web-dist/__next.__PAGE__.txt +31 -29
  17. package/dist/web-dist/__next._full.txt +20 -19
  18. package/dist/web-dist/__next._tree.txt +1 -1
  19. package/dist/web-dist/_next/static/chunks/app/chat/{page-ab56048b707a3ddd.js → page-4d90641844cd9fed.js} +1 -1
  20. package/dist/web-dist/_next/static/chunks/app/operator/page-e18364329865cb68.js +1 -0
  21. package/dist/web-dist/_not-found/__next._full.txt +1 -1
  22. package/dist/web-dist/_not-found/__next._not-found.__PAGE__.txt +1 -1
  23. package/dist/web-dist/_not-found/__next._tree.txt +1 -1
  24. package/dist/web-dist/_not-found/index.html +1 -1
  25. package/dist/web-dist/_not-found/index.txt +1 -1
  26. package/dist/web-dist/chat/__next._full.txt +2 -2
  27. package/dist/web-dist/chat/__next._tree.txt +1 -1
  28. package/dist/web-dist/chat/__next.chat.__PAGE__.txt +2 -2
  29. package/dist/web-dist/chat/index.html +1 -1
  30. package/dist/web-dist/chat/index.txt +2 -2
  31. package/dist/web-dist/index.html +1 -1
  32. package/dist/web-dist/index.txt +20 -19
  33. package/dist/web-dist/operator/__next._full.txt +2 -2
  34. package/dist/web-dist/operator/__next._tree.txt +1 -1
  35. package/dist/web-dist/operator/__next.operator.__PAGE__.txt +2 -2
  36. package/dist/web-dist/operator/index.html +1 -1
  37. package/dist/web-dist/operator/index.txt +2 -2
  38. package/package.json +7 -7
  39. package/dist/clean-machine-e2e.test.d.ts +0 -1
  40. package/dist/clean-machine-e2e.test.js +0 -160
  41. package/dist/configurators/memory.d.ts +0 -2
  42. package/dist/web-dist/_next/static/chunks/app/operator/page-6b2d0ba884183ad7.js +0 -1
  43. /package/dist/web-dist/_next/static/{4aL_iP3FHsLSyHzCnRQYD → 6myq7R-xRemzP7dQD6m1Q}/_buildManifest.js +0 -0
  44. /package/dist/web-dist/_next/static/{4aL_iP3FHsLSyHzCnRQYD → 6myq7R-xRemzP7dQD6m1Q}/_ssgManifest.js +0 -0
@@ -1,160 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const node_fs_1 = __importDefault(require("node:fs"));
7
- const node_path_1 = __importDefault(require("node:path"));
8
- const node_child_process_1 = require("node:child_process");
9
- const discovery_1 = require("./discovery");
10
- const generator_1 = require("./generator");
11
- describe('Phase 5: Clean-Machine Distribution & E2E Integration Suite', () => {
12
- const repoRoot = node_path_1.default.resolve(__dirname, '../../');
13
- const tempPackDir = node_path_1.default.resolve(__dirname, '../temp-packs-e2e');
14
- const cleanMachineRoot = node_path_1.default.resolve(__dirname, '../temp-clean-machine-e2e');
15
- const getPkgVer = (dir) => JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.resolve(repoRoot, dir, 'package.json'), 'utf8')).version;
16
- const ALL_CANONICAL_PACKAGES = [
17
- { filter: '@siduri-x/core', dir: 'packages/core', tarName: `siduri-x-core-${getPkgVer('packages/core')}.tgz`, isOrgan: false },
18
- { filter: '@siduri-x/brain', dir: 'packages/organs/brain', tarName: `siduri-x-brain-${getPkgVer('packages/organs/brain')}.tgz`, isOrgan: true },
19
- { filter: '@siduri-x/memory', dir: 'packages/memory', tarName: `siduri-x-memory-${getPkgVer('packages/memory')}.tgz`, isOrgan: true },
20
- { filter: '@siduri-x/knowledge', dir: 'packages/knowledge', tarName: `siduri-x-knowledge-${getPkgVer('packages/knowledge')}.tgz`, isOrgan: true },
21
- { filter: '@siduri-x/self', dir: 'packages/self', tarName: `siduri-x-self-${getPkgVer('packages/self')}.tgz`, isOrgan: true },
22
- { filter: '@siduri-x/ear', dir: 'packages/organs/ear', tarName: `siduri-x-ear-${getPkgVer('packages/organs/ear')}.tgz`, isOrgan: true },
23
- { filter: '@siduri-x/vision', dir: 'packages/organs/vision', tarName: `siduri-x-vision-${getPkgVer('packages/organs/vision')}.tgz`, isOrgan: true },
24
- { filter: '@siduri-x/hands', dir: 'packages/organs/hands', tarName: `siduri-x-hands-${getPkgVer('packages/organs/hands')}.tgz`, isOrgan: true },
25
- { filter: '@siduri-x/body', dir: 'packages/organs/body', tarName: `siduri-x-body-${getPkgVer('packages/organs/body')}.tgz`, isOrgan: true },
26
- { filter: '@siduri-x/voice', dir: 'packages/organs/voice', tarName: `siduri-x-voice-${getPkgVer('packages/organs/voice')}.tgz`, isOrgan: true },
27
- { filter: '@siduri-x/observation', dir: 'packages/organs/observation', tarName: `siduri-x-observation-${getPkgVer('packages/organs/observation')}.tgz`, isOrgan: true },
28
- { filter: '@siduri-x/mouth', dir: 'packages/organs/mouth', tarName: `siduri-x-mouth-${getPkgVer('packages/organs/mouth')}.tgz`, isOrgan: true },
29
- { filter: '@siduri-x/eknowledge', dir: 'packages/organs/eknowledge', tarName: `siduri-x-eknowledge-${getPkgVer('packages/organs/eknowledge')}.tgz`, isOrgan: true },
30
- { filter: '@vxnus/siduri', dir: 'cli', tarName: `vxnus-siduri-${getPkgVer('cli')}.tgz`, isOrgan: false },
31
- ];
32
- const getTarPath = (pkgName) => {
33
- const pkg = ALL_CANONICAL_PACKAGES.find(p => p.filter === pkgName);
34
- return node_path_1.default.join(tempPackDir, pkg.tarName);
35
- };
36
- beforeAll(() => {
37
- // 1. Prepare clean directories
38
- if (node_fs_1.default.existsSync(tempPackDir))
39
- node_fs_1.default.rmSync(tempPackDir, { recursive: true, force: true });
40
- if (node_fs_1.default.existsSync(cleanMachineRoot))
41
- node_fs_1.default.rmSync(cleanMachineRoot, { recursive: true, force: true });
42
- node_fs_1.default.mkdirSync(tempPackDir, { recursive: true });
43
- node_fs_1.default.mkdirSync(cleanMachineRoot, { recursive: true });
44
- // 2. Build all packages in repo
45
- (0, node_child_process_1.execSync)("pnpm turbo run build --filter='!web'", { cwd: repoRoot, stdio: 'pipe' });
46
- // 3. Pack each canonical package into tempPackDir
47
- for (const pkg of ALL_CANONICAL_PACKAGES) {
48
- (0, node_child_process_1.execSync)(`pnpm pack --pack-destination ${tempPackDir}`, {
49
- cwd: node_path_1.default.resolve(repoRoot, pkg.dir),
50
- stdio: 'pipe',
51
- });
52
- }
53
- }, 90000);
54
- afterAll(() => {
55
- if (node_fs_1.default.existsSync(tempPackDir))
56
- node_fs_1.default.rmSync(tempPackDir, { recursive: true, force: true });
57
- if (node_fs_1.default.existsSync(cleanMachineRoot))
58
- node_fs_1.default.rmSync(cleanMachineRoot, { recursive: true, force: true });
59
- });
60
- describe('Phase 5A: Package Artifact Verification', () => {
61
- test('all 14 packages produce valid tarballs', () => {
62
- for (const pkg of ALL_CANONICAL_PACKAGES) {
63
- const tarPath = node_path_1.default.join(tempPackDir, pkg.tarName);
64
- expect(node_fs_1.default.existsSync(tarPath)).toBe(true);
65
- }
66
- });
67
- test('packed package.json files have zero workspace:* or link: dependencies', () => {
68
- for (const pkg of ALL_CANONICAL_PACKAGES) {
69
- const tarPath = node_path_1.default.join(tempPackDir, pkg.tarName);
70
- const pkgJsonRaw = (0, node_child_process_1.execSync)(`tar -xzf ${tarPath} -O package/package.json`, { encoding: 'utf8' });
71
- const pkgJson = JSON.parse(pkgJsonRaw);
72
- const allDeps = {
73
- ...(pkgJson.dependencies || {}),
74
- ...(pkgJson.peerDependencies || {}),
75
- };
76
- for (const [depName, version] of Object.entries(allDeps)) {
77
- if (typeof version === 'string') {
78
- expect(version.startsWith('workspace:')).toBe(false);
79
- expect(version.startsWith('link:')).toBe(false);
80
- expect(version.includes('../')).toBe(false);
81
- }
82
- }
83
- }
84
- });
85
- });
86
- describe('Phase 5B & 5C & 5G: Clean-Machine Installation & Isolation Acceptance', () => {
87
- const registry = discovery_1.OrganRegistry.discover([
88
- node_path_1.default.resolve(repoRoot, 'packages/organs'),
89
- node_path_1.default.resolve(repoRoot, 'packages')
90
- ]);
91
- const brain = registry.get('brain');
92
- const hands = registry.get('hands');
93
- const memory = registry.get('memory');
94
- test('Clean Composition 1: Brain only instance installs, starts, runs doctor and db push', () => {
95
- const instanceDir = node_path_1.default.join(cleanMachineRoot, 'inst-brain-only');
96
- node_fs_1.default.mkdirSync(node_path_1.default.join(instanceDir, 'src'), { recursive: true });
97
- const files = (0, generator_1.generateInstanceFiles)({
98
- name: 'CleanBrainOnly',
99
- selectedManifests: [brain],
100
- });
101
- const pkgObj = JSON.parse(files['package.json']);
102
- pkgObj.dependencies = {
103
- '@siduri-x/core': `file:${getTarPath('@siduri-x/core')}`,
104
- '@siduri-x/brain': `file:${getTarPath('@siduri-x/brain')}`,
105
- };
106
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'package.json'), JSON.stringify(pkgObj, null, 2) + '\n');
107
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'siduri.config.json'), files['siduri.config.json']);
108
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'siduri.schema.json'), files['siduri.schema.json']);
109
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, '.env.example'), files['.env.example']);
110
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'README.md'), files['README.md']);
111
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'src/index.js'), files['src/index.js']);
112
- (0, node_child_process_1.execSync)('npm install --no-audit --no-fund', { cwd: instanceDir, stdio: 'pipe' });
113
- expect(node_fs_1.default.existsSync(node_path_1.default.join(instanceDir, 'node_modules/@siduri-x/memory'))).toBe(false);
114
- expect(node_fs_1.default.existsSync(node_path_1.default.join(instanceDir, 'node_modules/@siduri-x/hands'))).toBe(false);
115
- const doctorPass = (0, node_child_process_1.execSync)(`node ${node_path_1.default.resolve(repoRoot, 'cli/dist/index.js')} doctor`, {
116
- cwd: instanceDir,
117
- env: { ...process.env, OPENROUTER_API_KEY: 'test-key-clean' },
118
- encoding: 'utf8',
119
- });
120
- expect(doctorPass).toContain('Result: PASS');
121
- const dbPushOutput = (0, node_child_process_1.execSync)(`node ${node_path_1.default.resolve(repoRoot, 'cli/dist/index.js')} db push`, {
122
- cwd: instanceDir,
123
- encoding: 'utf8',
124
- });
125
- expect(dbPushOutput).toContain('SQLite manages schema natively. No CLI migrations required.');
126
- }, 60000);
127
- test('Clean Composition 2: Brain + Hands installs and runs doctor verifying ACTION_POLICY_SECRET', () => {
128
- const instanceDir = node_path_1.default.join(cleanMachineRoot, 'inst-brain-hands');
129
- node_fs_1.default.mkdirSync(node_path_1.default.join(instanceDir, 'src'), { recursive: true });
130
- const files = (0, generator_1.generateInstanceFiles)({
131
- name: 'CleanBrainHands',
132
- selectedManifests: [brain, hands],
133
- });
134
- const pkgObj = JSON.parse(files['package.json']);
135
- pkgObj.dependencies = {
136
- '@siduri-x/core': `file:${getTarPath('@siduri-x/core')}`,
137
- '@siduri-x/brain': `file:${getTarPath('@siduri-x/brain')}`,
138
- '@siduri-x/hands': `file:${getTarPath('@siduri-x/hands')}`,
139
- };
140
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'package.json'), JSON.stringify(pkgObj, null, 2) + '\n');
141
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'siduri.config.json'), files['siduri.config.json']);
142
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'siduri.schema.json'), files['siduri.schema.json']);
143
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, '.env.example'), files['.env.example']);
144
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'README.md'), files['README.md']);
145
- node_fs_1.default.writeFileSync(node_path_1.default.join(instanceDir, 'src/index.js'), files['src/index.js']);
146
- (0, node_child_process_1.execSync)('npm install --no-audit --no-fund', { cwd: instanceDir, stdio: 'pipe' });
147
- const doctorOutput = (0, node_child_process_1.execSync)(`node ${node_path_1.default.resolve(repoRoot, 'cli/dist/index.js')} doctor`, {
148
- cwd: instanceDir,
149
- env: {
150
- ...process.env,
151
- OPENROUTER_API_KEY: 'test-key-clean',
152
- ACTION_POLICY_SECRET: 'test-secret-clean',
153
- },
154
- encoding: 'utf8',
155
- });
156
- expect(doctorOutput).toContain('ACTION_POLICY_SECRET');
157
- expect(doctorOutput).toContain('Result: PASS');
158
- }, 60000);
159
- });
160
- });
@@ -1,2 +0,0 @@
1
- import { OrganConfiguratorContext, OrganConfigurationResult } from './types';
2
- export declare function configureMemory(_context: OrganConfiguratorContext): Promise<OrganConfigurationResult>;
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[939],{3449:(e,s,t)=>{"use strict";t.d(s,{default:()=>h});var a=t(2184),l=t(276),n=t(2914);function i({title:e,detail:s}){return(0,a.jsxs)("div",{className:"empty-state",children:[(0,a.jsx)("span",{className:"flex items-center justify-center","aria-hidden":"true",children:(0,a.jsx)(n.kN,{size:24})}),(0,a.jsx)("strong",{children:e}),(0,a.jsx)("p",{children:s})]})}var r=t(8839),c=t(3265);function o(e){return e?e.length>19?`${e.slice(0,9)}…${e.slice(-7)}`:e:"—"}function d(e){if(!e)return"—";let s=new Date(e);return Number.isNaN(s.valueOf())?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}function h(){let[e,s]=(0,l.useState)("overview"),[t,i]=(0,l.useState)({label:"Orchestrator",value:"Checking",tone:"warn"}),[c,o]=(0,l.useState)({label:"Voice",value:"Checking",tone:"warn"}),[d,h]=(0,l.useState)({label:"OBS capture",value:"Checking",tone:"warn"}),[m,x]=(0,l.useState)(""),[j,p]=(0,l.useState)([]),[f,w]=(0,l.useState)([]),[k,S]=(0,l.useState)([]),[C,T]=(0,l.useState)([]),[O,D]=(0,l.useState)([]),[E,R]=(0,l.useState)([]),[$,A]=(0,l.useState)([]),[L,I]=(0,l.useState)([]),[P,_]=(0,l.useState)([]),[z,B]=(0,l.useState)([]),[M,U]=(0,l.useState)([]),[F,J]=(0,l.useState)("all"),[q,V]=(0,l.useState)("all"),[G,Q]=(0,l.useState)(""),[H,Y]=(0,l.useState)(!0),[Z,K]=(0,l.useState)(new Set),[W,X]=(0,l.useState)("{}"),[ee,es]=(0,l.useState)(""),[et,ea]=(0,l.useState)(null),[el,en]=(0,l.useState)(null),[ei,er]=(0,l.useState)(!1);async function ec(){try{let e=new URLSearchParams;"all"!==F&&e.set("level",F),"all"!==q&&e.set("subsystem",q),G.trim()&&e.set("q",G.trim()),e.set("limit","150");let s=await (0,r.Tt)(`/system/logs?${e.toString()}`);U(s.logs||[])}catch(e){console.error("Failed to load system logs:",e)}}async function eo(){if(window.confirm("Are you sure you want to clear all system logs?"))try{await (0,r.B2)("/system/logs/clear",{}),U([]),es("Logs cleared.")}catch(e){es(`Failed to clear logs: ${e.message}`)}}async function ed(){try{let[e,s,t]=await Promise.all([(0,r.Tt)("/health"),(0,r.Tt)("/version"),(0,r.Tt)("/ready")]);i({label:"Orchestrator",value:"ok"===e.status?"Online":e.status,detail:`v${s.version}`,tone:"ok"===e.status?"good":"warn"}),x(s.version),t.dependencies?.model_provider?.ready===!1&&i(e=>({...e,detail:"Model provider degraded",tone:"warn"}))}catch{i({label:"Orchestrator",value:"Offline",detail:"Start the Python API",tone:"bad"})}try{let e=await (0,r.Tt)("/voice/health");o({label:"Voice",value:e.healthy?"Ready":"Fallback",detail:e.provider,tone:e.healthy?"good":"warn"})}catch{o({label:"Voice",value:"Unavailable",detail:"Subtitle fallback",tone:"warn"})}try{let e=await (0,r.Tt)("/obs/health");h({label:"OBS capture",value:e.connected?"Connected":e.configured?"Disconnected":"Disabled",detail:e.source_name?`Source: ${e.source_name}`:"No source configured",tone:e.connected?"good":"warn"})}catch{h({label:"OBS capture",value:"Unavailable",tone:"bad"})}}async function eh(){try{let[e,s,t,a]=await Promise.all([(0,r.Tt)("/memory/proposals"),(0,r.Tt)("/memory"),(0,r.Tt)("/memory/claims"),(0,r.Tt)("/memory/behavioral")]);p((e.proposals??[]).filter(e=>"pending"===(e.status||"").toLowerCase().replace(/_/g,"-"))),S(s.items??[]),w(t.claims??[]),T(a.directives??[])}catch{p([]),S([]),w([]),T([])}}async function em(){try{let[e,s]=await Promise.all([(0,r.Tt)("/evidence"),(0,r.Tt)("/observations")]);D(e.results??[]),R(s.observations??[])}catch{D([]),R([])}}async function ex(){try{X(JSON.stringify(await (0,r.Tt)("/me"),null,2))}catch{X("Unable to load profile.")}}async function ej(){try{let[e,s,t,a]=await Promise.all([(0,r.Tt)("/knowledge/entities").catch(()=>({entities:[]})),(0,r.Tt)("/knowledge/events").catch(()=>({events:[]})),(0,r.Tt)("/knowledge/tasks").catch(()=>({tasks:[]})),(0,r.Tt)("/knowledge/schedule").catch(()=>({items:[]}))]);A(e?.entities||[]),I(s?.events||[]),_(t?.tasks||[]),B(a?.items||[])}catch{}}async function eu(e){er(!0);try{await (0,r.B2)("/knowledge/entities",e),es(`Saved entity "${e.name}"`),await ej()}catch(e){es(`Error saving entity: ${e.message}`)}finally{er(!1)}}async function ep(e){er(!0);try{await (0,r.B2)("/knowledge/entities/delete",{id:e}),es("Entity deleted"),await ej()}catch(e){es(`Error deleting entity: ${e.message}`)}finally{er(!1)}}async function ev(e){er(!0);try{await (0,r.B2)("/knowledge/tasks",e),es(`Saved task "${e.title}"`),await ej()}catch(e){es(`Error saving task: ${e.message}`)}finally{er(!1)}}async function eb(e){let s="completed"===e.status?"todo":"completed";await ev({...e,status:s})}async function eg(e){er(!0);try{await (0,r.B2)("/knowledge/tasks/delete",{id:e}),es("Task deleted"),await ej()}catch(e){es(`Error deleting task: ${e.message}`)}finally{er(!1)}}async function eN(e){er(!0);try{await (0,r.B2)("/knowledge/events",e),es(`Logged event on stream "${e.stream}"`),await ej()}catch(e){es(`Error logging event: ${e.message}`)}finally{er(!1)}}async function ey(e){er(!0);try{await (0,r.B2)("/knowledge/schedule",e),es(`Saved schedule item "${e.title}"`),await ej()}catch(e){es(`Error saving schedule: ${e.message}`)}finally{er(!1)}}async function ef(e){er(!0);try{await (0,r.B2)("/knowledge/schedule/delete",{id:e}),es("Schedule item deleted"),await ej()}catch(e){es(`Error deleting schedule item: ${e.message}`)}finally{er(!1)}}async function ew(){er(!0);try{ea(await (0,r.B2)("/dev/mock-response"))}finally{er(!1)}}async function ek(){er(!0);try{let e=await (0,r.B2)("/dev/observe-and-respond");ea(e);let s="string"==typeof e?.metadata?.correlation_id?e.metadata.correlation_id:null;en(s)}finally{er(!1)}}async function eS(){if(el){er(!0);try{ea(await (0,r.B2)("/dev/approve-response",{correlation_id:el})),en(null)}finally{er(!1)}}}async function eC(e,s,t){await (0,r.vd)(e,{id:s.id||s.proposal_id,companionId:"default",...void 0===t?{}:{content:t}}),await eh()}async function eT(){await (0,r.vd)("/dev/mock-observation"),await em()}async function eO(){if(window.confirm("Are you sure you want to completely reset all memory? This action cannot be undone.")){er(!0);try{await (0,r.B2)("/dev/memory/reset"),await eh(),es("Memory has been completely reset.")}catch(e){es(String(e))}finally{er(!1)}}}return(0,l.useEffect)(()=>{ed(),eh(),ej(),em(),ex()},[]),(0,a.jsxs)("main",{className:"console-app",children:[(0,a.jsxs)("aside",{className:"console-sidebar",children:[(0,a.jsxs)("div",{className:"console-sidebar-header flex items-center justify-between w-full",children:[(0,a.jsxs)("a",{className:"console-brand",href:"/chat",children:[(0,a.jsx)("span",{className:"console-brand-mark",children:"S"}),(0,a.jsx)("span",{children:"SIDURI"})]}),(0,a.jsxs)("a",{href:"/chat",className:"console-mobile-back inline-flex items-center gap-1","aria-label":"Back to chat",children:[(0,a.jsx)(n.A6,{size:12}),"Chat"]})]}),(0,a.jsxs)("div",{className:"console-context",children:[(0,a.jsx)("span",{className:"console-context-dot"}),"Operator workspace"]}),(0,a.jsx)("nav",{className:"console-nav","aria-label":"Console sections",children:["overview","memory","lifedb","evidence","logs","settings"].map(t=>(0,a.jsxs)("button",{className:e===t?"active":"",onClick:()=>s(t),children:[(0,a.jsx)("span",{className:`nav-glyph nav-${t}`}),"lifedb"===t?"Life DB":t[0].toUpperCase()+t.slice(1)]},t))}),(0,a.jsxs)("div",{className:"console-sidebar-bottom",children:[(0,a.jsxs)("a",{href:"/chat",className:"inline-flex items-center gap-1",children:[(0,a.jsx)(n.A6,{size:12}),"Private chat"]}),(0,a.jsx)("span",{children:"Local operator surface"})]})]}),(0,a.jsxs)("section",{className:"console-main",children:[(0,a.jsxs)("header",{className:"console-topbar",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"console-eyebrow",children:"SIDURI / OPERATOR"}),(0,a.jsx)("h1",{children:"overview"===e?"Control room":"lifedb"===e?"Life Database (Sovereign Reality)":"logs"===e?"System Logs & Diagnostics":e[0].toUpperCase()+e.slice(1)})]}),(0,a.jsxs)("div",{className:"console-top-actions",children:[(0,a.jsxs)("a",{href:"/chat",className:"console-back-link inline-flex items-center gap-1",title:"Return to Private Chat",children:[(0,a.jsx)(n.A6,{size:12}),"Chat"]}),(0,a.jsxs)("span",{className:"console-version",children:["v",m||"—"]}),(0,a.jsx)("button",{type:"button",className:"console-refresh",onClick:()=>{ed(),eh(),ej(),em(),"logs"===e&&ec()},"aria-label":"Refresh dashboard",children:(0,a.jsx)(n.fN,{size:14})})]})]}),ee&&(0,a.jsx)("div",{className:"console-notice",children:ee}),"overview"===e&&(0,a.jsx)(b,{health:t,voice:c,obs:d,proposals:j,responseJson:et,pendingCorrelationId:el,busy:ei,onTrigger:ew,onObserve:ek,onApprove:eS,onNavigate:s}),"memory"===e&&(0,a.jsx)(u,{proposals:j,claims:f,items:k,directives:C,onAction:eC,onRefresh:eh}),"lifedb"===e&&(0,a.jsx)(g,{entities:$,events:L,tasks:P,schedule:z,busy:ei,onSaveEntity:eu,onDeleteEntity:ep,onSaveTask:ev,onToggleTask:eb,onDeleteTask:eg,onAddEvent:eN,onSaveSchedule:ey,onDeleteSchedule:ef,onRefresh:ej}),"evidence"===e&&(0,a.jsx)(v,{results:O,observations:E,onCreate:eT,onRefresh:em}),"logs"===e&&(0,a.jsx)(N,{logs:M,filterLevel:F,filterSubsystem:q,searchQuery:G,autoRefresh:H,expandedIds:Z,onToggleExpand:function(e){K(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},onChangeLevel:J,onChangeSubsystem:V,onChangeSearch:Q,onToggleAutoRefresh:()=>Y(e=>!e),onRefresh:ec,onClear:eo,onExport:function(){try{let e=new Blob([JSON.stringify(M,null,2)],{type:"application/json"}),s=URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download=`siduri-logs-${new Date().toISOString().replace(/[:.]/g,"-")}.json`,t.click(),URL.revokeObjectURL(s)}catch(e){es(`Export failed: ${e.message}`)}}}),"settings"===e&&(0,a.jsx)(y,{onResetMemory:eO,disabled:ei})]})]})}function m({status:e}){return(0,a.jsxs)("article",{className:"status-card",children:[(0,a.jsxs)("div",{className:"status-card-top",children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("i",{className:`status-dot ${e.tone??"warn"}`})]}),(0,a.jsx)("strong",{children:e.value}),(0,a.jsx)("small",{children:e.detail??"—"})]})}function x({title:e,action:s,onClick:t}){return(0,a.jsxs)("div",{className:"panel-header",children:[(0,a.jsx)("h2",{children:e}),s&&(0,a.jsxs)("button",{onClick:t,className:"inline-flex items-center gap-1",children:[s," ",(0,a.jsx)(n.fl,{size:12})]})]})}function j({label:e,count:s,tone:t}){return(0,a.jsxs)("div",{className:"queue-row",children:[(0,a.jsx)("span",{children:e}),(0,a.jsx)("b",{className:`queue-count ${t}`,children:s})]})}function u({proposals:e,claims:s,items:t,directives:l,onAction:n,onRefresh:h}){async function m(e,s){await (0,r.B2)(e,{id:s,companionId:"default"}),await h()}return(0,a.jsxs)("div",{className:"console-view",children:[(0,a.jsxs)("div",{className:"view-intro",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"console-eyebrow",children:"COMPANION MEMORY"}),(0,a.jsx)("h2",{children:"Review candidates before they become facts."}),(0,a.jsx)("p",{children:"Every candidate stays isolated until you explicitly approve it."})]}),(0,a.jsxs)("span",{className:"count-badge",children:[e.length," pending"]})]}),(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsx)("strong",{children:"Pending memory"}),(0,a.jsx)("span",{children:"Local approval queue"})]}),e.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Candidate"}),(0,a.jsx)("th",{children:"Provenance"}),(0,a.jsx)("th",{children:"Sensitivity"}),(0,a.jsx)("th",{children:"Action"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>(0,a.jsx)(p,{item:e,onAction:n},e.id||e.proposal_id))})]})}):(0,a.jsx)(i,{title:"No pending candidates",detail:"Siduri memory suggestions will appear here for review."})]}),(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsx)("strong",{children:"Behavioral Directives"}),(0,a.jsx)("span",{children:"Active behaviors and learned relationships"})]}),l.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Directive"}),(0,a.jsx)("th",{children:"Scope & Activation"}),(0,a.jsx)("th",{children:"Class"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsx)("tbody",{children:l.map(e=>{let s=e.id||e.directive_id||"";return(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{children:[(0,a.jsx)("strong",{children:(0,c.P)(e)}),(0,a.jsxs)("details",{className:"row-details",children:[(0,a.jsx)("summary",{children:o(s)}),(0,a.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag",children:e.activation||"active"})}),(0,a.jsx)("td",{children:(0,a.jsxs)("span",{className:"tag",children:[e.domain||e.category||"general"," / ",e.memory_class||e.category||"directive"]})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:`tag status-${(e.status||"").toLowerCase().replace(/_/g,"-")}`,children:e.status})}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"table-actions",children:["pending"===(e.status||"").toLowerCase()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{className:"tiny-button approve-button",onClick:()=>void m("/memory/behavioral/approve",s),children:"Approve"}),(0,a.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void m("/memory/behavioral/reject",s),children:"Reject"})]}),("active"===(e.status||"").toLowerCase()||"confirmed"===(e.status||"").toLowerCase())&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void m("/memory/behavioral/revoke",s),children:"Revoke"}),"disabled"!==e.activation&&(0,a.jsx)("button",{className:"tiny-button",onClick:()=>void m("/memory/behavioral/disable",s),children:"Disable"})]})]})})]},s)})})]})}):(0,a.jsx)(i,{title:"No behavioral directives",detail:"Behavioral rules taught in private chat will appear here."})]}),(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsx)("strong",{children:"Structured Claims"}),(0,a.jsx)("span",{children:"Queryable personal and game knowledge"})]}),s.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Subject"}),(0,a.jsx)("th",{children:"Predicate"}),(0,a.jsx)("th",{children:"Value"}),(0,a.jsx)("th",{children:"Status"})]})}),(0,a.jsx)("tbody",{children:s.slice().reverse().map(e=>{let s=e.id||e.claim_id||"";return(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{children:[(0,a.jsx)("strong",{children:e.subject}),(0,a.jsxs)("details",{className:"row-details",children:[(0,a.jsx)("summary",{children:o(s)}),(0,a.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag",children:e.predicate})}),(0,a.jsx)("td",{children:e.value}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:`tag status-${(e.status||"").toLowerCase().replace(/_/g,"-")}`,children:e.status})})]},s)})})]})}):(0,a.jsx)(i,{title:"No structured claims",detail:"Approved teachings will become queryable claims here."})]}),(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsx)("strong",{children:"Compatibility Memory Items"}),(0,a.jsx)("span",{children:"Legacy text projection"})]}),t.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Fact"}),(0,a.jsx)("th",{children:"Provenance"}),(0,a.jsx)("th",{children:"Sensitivity"}),(0,a.jsx)("th",{children:"Created"})]})}),(0,a.jsx)("tbody",{children:t.slice().reverse().map(e=>{let s=e.id||e.memory_id||"",t=e.content||(e.subject&&e.predicate?`${e.subject} ${e.predicate} ${e.value}`:e.value||"—");return(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{children:[(0,a.jsx)("strong",{children:t}),(0,a.jsxs)("details",{className:"row-details",children:[(0,a.jsx)("summary",{children:o(s)}),(0,a.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag",children:e.provenance||"conversation"})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag",children:e.sensitivity||"normal"})}),(0,a.jsx)("td",{children:d(e.created_at||e.assertedAt)})]},s)})})]})}):(0,a.jsx)(i,{title:"No compatibility items",detail:"Legacy approved memory text will appear here."})]})]})}function p({item:e,onAction:s}){let t=e.id||e.proposal_id||"",[n,i]=(0,l.useState)(e.content||"");return(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{children:[(0,a.jsx)("strong",{children:(0,c.I)(e)}),(0,a.jsxs)("details",{className:"row-details",children:[(0,a.jsxs)("summary",{children:["Edit raw record \xb7 ",o(t)]}),(0,a.jsx)("textarea",{className:"table-editor",value:n,onChange:e=>i(e.target.value),"aria-label":`Memory candidate ${t}`}),(0,a.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,a.jsx)("td",{children:e.provenance||"conversation"}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag",children:e.sensitivity||"normal"})}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"table-actions",children:[(0,a.jsx)("button",{className:"tiny-button",onClick:()=>void s("/memory/proposals/update",e,n),children:"Save"}),(0,a.jsx)("button",{className:"tiny-button approve-button",onClick:()=>void s("/memory/proposals/approve",e),children:"Approve"}),(0,a.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void s("/memory/proposals/reject",e),children:"Reject"})]})})]})}function v({results:e,observations:s,onCreate:t,onRefresh:l}){return(0,a.jsxs)("div",{className:"console-view",children:[(0,a.jsxs)("div",{className:"view-intro",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"console-eyebrow",children:"GROUNDING"}),(0,a.jsx)("h2",{children:"Evidence, with uncertainty intact."}),(0,a.jsx)("p",{children:"Inspect bounded citations and short-lived observations without exposing raw captures."})]}),(0,a.jsxs)("div",{className:"button-row",children:[(0,a.jsx)("button",{onClick:()=>void t(),children:"Create fixture"}),(0,a.jsx)("button",{className:"soft-button",onClick:()=>void l(),children:"Refresh"})]})]}),(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsx)("strong",{children:"Knowledge Base Citations"}),(0,a.jsxs)("span",{children:[e.length," results"]})]}),e.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Source"}),(0,a.jsx)("th",{children:"Revision"}),(0,a.jsx)("th",{children:"Preview"}),(0,a.jsx)("th",{children:"Link"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{children:[(0,a.jsx)("strong",{children:e.title}),(0,a.jsx)("small",{children:e.endpoint})]}),(0,a.jsx)("td",{children:e.revision||"—"}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag",children:e.preview?"Preview":"Published"})}),(0,a.jsx)("td",{children:(0,a.jsxs)("a",{className:"table-link inline-flex items-center gap-1",href:e.url,target:"_blank",rel:"noreferrer",children:["Open ",(0,a.jsx)(n.pT,{size:12})]})})]},e.url))})]})}):(0,a.jsx)(i,{title:"No evidence loaded",detail:"Create a fixture observation or refresh the source."})]}),(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsx)("strong",{children:"Current observations"}),(0,a.jsx)("span",{children:"Raw frames are never shown here"})]}),s.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Observation"}),(0,a.jsx)("th",{children:"Captured"}),(0,a.jsx)("th",{children:"Expires"}),(0,a.jsx)("th",{children:"Readings"})]})}),(0,a.jsx)("tbody",{children:s.map((e,s)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:o(e.observation_id??"observation")}),(0,a.jsx)("td",{children:d(e.observed_at)}),(0,a.jsx)("td",{children:d(e.expires_at)}),(0,a.jsx)("td",{children:Array.isArray(e.readings)?e.readings.length:0})]},e.observation_id??s))})]})}):(0,a.jsx)(i,{title:"No active observations",detail:"Observations are bounded and expire automatically."})]})]})}function b({health:e,voice:s,obs:t,proposals:l,responseJson:i,pendingCorrelationId:r,busy:c,onTrigger:o,onObserve:d,onApprove:h,onNavigate:u}){return(0,a.jsxs)("div",{className:"console-view",children:[(0,a.jsxs)("div",{className:"status-grid",children:[(0,a.jsx)(m,{status:e}),(0,a.jsx)(m,{status:s}),(0,a.jsx)(m,{status:t})]}),(0,a.jsxs)("div",{className:"console-columns",children:[(0,a.jsxs)("section",{className:"console-panel approval-panel",children:[(0,a.jsx)(x,{title:"Response gate",action:"Review policy",onClick:()=>u("settings")}),(0,a.jsxs)("div",{className:"gate-row",children:[(0,a.jsx)("span",{className:`gate-icon flex items-center justify-center ${r?"pending":"ready"}`,children:r?"!":(0,a.jsx)(n.Sr,{size:14,className:"shrink-0"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:r?"Grounded response awaiting approval":"No response awaiting approval"}),(0,a.jsx)("p",{children:r?"Public output is held until you approve it.":"Local mock responses remain private."})]})]}),(0,a.jsxs)("div",{className:"button-row",children:[(0,a.jsx)("button",{onClick:()=>void o(),disabled:c,children:"Trigger mock response"}),(0,a.jsx)("button",{className:"soft-button",onClick:()=>void d(),disabled:c,children:"Observe and respond"}),r&&(0,a.jsx)("button",{className:"approve-button",onClick:()=>void h(),children:"Approve response"})]}),null!==i&&(0,a.jsxs)("details",{className:"technical-details",children:[(0,a.jsx)("summary",{children:"Technical details"}),(0,a.jsx)("pre",{children:JSON.stringify(i,null,2)})]})]}),(0,a.jsxs)("section",{className:"console-panel queue-panel",children:[(0,a.jsx)(x,{title:"Needs attention",action:"View memory",onClick:()=>u("memory")}),(0,a.jsx)(j,{label:"Memory proposals",count:l.length,tone:l.length?"warn":"quiet"})]})]}),(0,a.jsxs)("section",{className:"console-panel quick-panel",children:[(0,a.jsx)(x,{title:"Quick actions"}),(0,a.jsxs)("div",{className:"quick-actions",children:[(0,a.jsxs)("button",{onClick:()=>u("memory"),className:"inline-flex items-center justify-between",children:["Review memory ",(0,a.jsx)("span",{children:(0,a.jsx)(n.fl,{size:12})})]}),(0,a.jsxs)("button",{onClick:()=>u("lifedb"),className:"inline-flex items-center justify-between",children:["Inspect Life DB ",(0,a.jsx)("span",{children:(0,a.jsx)(n.fl,{size:12})})]}),(0,a.jsxs)("button",{onClick:()=>u("evidence"),className:"inline-flex items-center justify-between",children:["Inspect evidence ",(0,a.jsx)("span",{children:(0,a.jsx)(n.fl,{size:12})})]}),(0,a.jsxs)("button",{onClick:()=>u("settings"),className:"inline-flex items-center justify-between",children:["Identity & Directives ",(0,a.jsx)("span",{children:(0,a.jsx)(n.fl,{size:12})})]})]})]})]})}function g({entities:e,events:s,tasks:t,schedule:r,busy:c,onSaveEntity:o,onDeleteEntity:h,onSaveTask:m,onToggleTask:x,onDeleteTask:j,onAddEvent:u,onSaveSchedule:p,onDeleteSchedule:v,onRefresh:b}){let[N,y]=(0,l.useState)("tasks"),[f,w]=(0,l.useState)("all"),[k,S]=(0,l.useState)(!1),[C,T]=(0,l.useState)(!1),[O,D]=(0,l.useState)(!1),[E,R]=(0,l.useState)(!1),[$,A]=(0,l.useState)(""),[L,I]=(0,l.useState)("1"),[P,_]=(0,l.useState)("todo"),[z,B]=(0,l.useState)(""),[M,U]=(0,l.useState)(""),[F,J]=(0,l.useState)("item"),[q,V]=(0,l.useState)("general"),[G,Q]=(0,l.useState)("{}"),[H,Y]=(0,l.useState)("finance:expense"),[Z,K]=(0,l.useState)(""),[W,X]=(0,l.useState)("{}"),[ee,es]=(0,l.useState)(""),[et,ea]=(0,l.useState)(""),[el,en]=(0,l.useState)(""),ei=t.filter(e=>"all"===f||("active"===f?"completed"!==e.status&&"cancelled"!==e.status:e.status===f));return(0,a.jsxs)("div",{className:"console-view",children:[(0,a.jsxs)("div",{className:"view-intro",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"console-eyebrow",children:"LIFE DATABASE"}),(0,a.jsx)("h2",{children:"Sovereign Reality & Structured Primitives"}),(0,a.jsx)("p",{children:"Inspect and mutate your concrete user reality: actionable tasks, static entities, telemetry events, and temporal schedules."})]}),(0,a.jsx)("div",{className:"button-row",children:(0,a.jsx)("button",{className:"soft-button",onClick:()=>void b(),disabled:c,children:"Refresh"})})]}),(0,a.jsxs)("div",{className:"lifedb-nav",children:[(0,a.jsxs)("button",{className:`lifedb-tab-btn flex items-center gap-1.5 ${"tasks"===N?"active":""}`,onClick:()=>y("tasks"),children:[(0,a.jsx)(n.Sr,{size:13,className:"shrink-0"}),(0,a.jsxs)("span",{children:["Tasks & Goals (",t.length,")"]})]}),(0,a.jsxs)("button",{className:`lifedb-tab-btn flex items-center gap-1.5 ${"entities"===N?"active":""}`,onClick:()=>y("entities"),children:[(0,a.jsx)(n.qD,{size:13,className:"shrink-0"}),(0,a.jsxs)("span",{children:["Entities & Items (",e.length,")"]})]}),(0,a.jsxs)("button",{className:`lifedb-tab-btn flex items-center gap-1.5 ${"events"===N?"active":""}`,onClick:()=>y("events"),children:[(0,a.jsx)(n.O4,{size:13,className:"shrink-0"}),(0,a.jsxs)("span",{children:["Telemetry & Events (",s.length,")"]})]}),(0,a.jsxs)("button",{className:`lifedb-tab-btn flex items-center gap-1.5 ${"schedule"===N?"active":""}`,onClick:()=>y("schedule"),children:[(0,a.jsx)(n.CT,{size:13,className:"shrink-0"}),(0,a.jsxs)("span",{children:["Schedule & Calendar (",r.length,")"]})]})]}),"tasks"===N&&(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("strong",{children:"Actionable Tasks"}),(0,a.jsx)("div",{className:"flex gap-1",children:["all","active","todo","in_progress","completed"].map(e=>(0,a.jsx)("button",{className:`px-2 py-0.5 rounded text-[10px] ${f===e?"bg-amber-500/20 text-amber-300 font-semibold":"text-gray-400 hover:text-gray-200"}`,onClick:()=>w(e),children:e.toUpperCase()},e))})]}),(0,a.jsx)("button",{className:"tiny-button flex items-center gap-1",onClick:()=>S(!k),children:k?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.US,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"Close"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.c1,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"New Task"})]})})]}),k&&(0,a.jsxs)("div",{className:"lifedb-form-card m-4",children:[(0,a.jsx)("h4",{className:"text-xs font-semibold text-amber-300 mb-2",children:"Create New Task"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3 mb-3",children:[(0,a.jsx)("input",{type:"text",placeholder:"Task title (e.g. Order fresh coffee)",value:$,onChange:e=>A(e.target.value),className:"lifedb-input md:col-span-2"}),(0,a.jsxs)("select",{value:P,onChange:e=>_(e.target.value),className:"lifedb-input",children:[(0,a.jsx)("option",{value:"todo",children:"To-Do"}),(0,a.jsx)("option",{value:"in_progress",children:"In Progress"}),(0,a.jsx)("option",{value:"completed",children:"Completed"}),(0,a.jsx)("option",{value:"cancelled",children:"Cancelled"})]}),(0,a.jsx)("input",{type:"number",placeholder:"Priority (1-5)",value:L,onChange:e=>I(e.target.value),className:"lifedb-input"})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{className:"tiny-button",onClick:()=>S(!1),children:"Cancel"}),(0,a.jsx)("button",{className:"tiny-button approve-button",disabled:!$.trim()||c,onClick:async()=>{await m({title:$.trim(),status:P,priority:Number(L)||1,targetDate:z||void 0}),A(""),S(!1)},children:"Save Task"})]})]}),ei.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{style:{width:"40px"},children:"Done"}),(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Priority"}),(0,a.jsx)("th",{children:"Target Date"}),(0,a.jsx)("th",{children:"Updated"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsx)("tbody",{children:ei.map(e=>{let s="completed"===e.status;return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("input",{type:"checkbox",checked:s,onChange:()=>void x(e),className:"cursor-pointer accent-amber-500"})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:s?"line-through text-gray-500":"font-medium text-gray-200",children:e.title})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:`lifedb-pill lifedb-pill-${e.status||"todo"}`,children:e.status||"todo"})}),(0,a.jsx)("td",{children:(0,a.jsxs)("span",{className:"tag font-mono",children:["P",e.priority??1]})}),(0,a.jsx)("td",{children:d(e.targetDate)}),(0,a.jsx)("td",{children:d(e.updatedAt)}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"table-actions",children:[(0,a.jsx)("button",{className:"tiny-button",onClick:()=>void x(e),children:s?"Reopen":"Complete"}),(0,a.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void j(e.id),children:"Delete"})]})})]},e.id)})})]})}):(0,a.jsx)(i,{title:"No tasks match filter",detail:"Tasks learned through conversation or created above will appear here."})]}),"entities"===N&&(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:"Static Entities & Inventory"}),(0,a.jsx)("span",{children:"Nouns, devices, gaming items, and contacts"})]}),(0,a.jsx)("button",{className:"tiny-button flex items-center gap-1",onClick:()=>T(!C),children:C?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.US,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"Close"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.c1,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"New Entity"})]})})]}),C&&(0,a.jsxs)("div",{className:"lifedb-form-card m-4",children:[(0,a.jsx)("h4",{className:"text-xs font-semibold text-amber-300 mb-2",children:"Create New Entity"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 mb-3",children:[(0,a.jsx)("input",{type:"text",placeholder:"Entity Name (e.g. MacBook Pro M3)",value:M,onChange:e=>U(e.target.value),className:"lifedb-input"}),(0,a.jsx)("input",{type:"text",placeholder:"Type (e.g. hardware, contact, item)",value:F,onChange:e=>J(e.target.value),className:"lifedb-input"}),(0,a.jsx)("input",{type:"text",placeholder:"Domain (e.g. workstation, gaming, home)",value:q,onChange:e=>V(e.target.value),className:"lifedb-input"})]}),(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsx)("textarea",{placeholder:'Properties JSON (e.g. {"model": "16-inch", "ram": "36GB"})',value:G,onChange:e=>Q(e.target.value),className:"lifedb-input w-full font-mono text-xs",rows:2})}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{className:"tiny-button",onClick:()=>T(!1),children:"Cancel"}),(0,a.jsx)("button",{className:"tiny-button approve-button",disabled:!M.trim()||c,onClick:async()=>{let e={};try{e=JSON.parse(G||"{}")}catch{}await o({name:M.trim(),entityType:F.trim()||"item",domain:q.trim()||"general",properties:e}),U(""),T(!1)},children:"Save Entity"})]})]}),e.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Name"}),(0,a.jsx)("th",{children:"Type"}),(0,a.jsx)("th",{children:"Domain"}),(0,a.jsx)("th",{children:"Properties"}),(0,a.jsx)("th",{children:"Updated"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-medium text-gray-200",children:e.name}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag font-mono",children:e.entityType})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag",children:e.domain})}),(0,a.jsx)("td",{children:(0,a.jsx)("pre",{className:"text-[10px] text-gray-400 font-mono max-w-xs overflow-hidden text-ellipsis whitespace-nowrap",children:JSON.stringify(e.properties||{})})}),(0,a.jsx)("td",{children:d(e.updatedAt)}),(0,a.jsx)("td",{children:(0,a.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void h(e.id),children:"Delete"})})]},e.id))})]})}):(0,a.jsx)(i,{title:"No entities recorded",detail:"Hardware, game characters, contacts, and items stored in Life DB will appear here."})]}),"events"===N&&(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:"Time-Series Events & Telemetry"}),(0,a.jsx)("span",{children:"Biometrics, finances, workout telemetry, and logs"})]}),(0,a.jsx)("button",{className:"tiny-button flex items-center gap-1",onClick:()=>D(!O),children:O?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.US,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"Close"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.c1,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"Log Event"})]})})]}),O&&(0,a.jsxs)("div",{className:"lifedb-form-card m-4",children:[(0,a.jsx)("h4",{className:"text-xs font-semibold text-amber-300 mb-2",children:"Log New Event"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 mb-3",children:[(0,a.jsx)("input",{type:"text",placeholder:"Stream (e.g. finance:expense, health:heartrate)",value:H,onChange:e=>Y(e.target.value),className:"lifedb-input"}),(0,a.jsx)("input",{type:"number",step:"any",placeholder:"Metric Value (optional, e.g. 25.5)",value:Z,onChange:e=>K(e.target.value),className:"lifedb-input"})]}),(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsx)("textarea",{placeholder:'Metadata JSON (optional, e.g. {"category": "coffee", "currency": "USD"})',value:W,onChange:e=>X(e.target.value),className:"lifedb-input w-full font-mono text-xs",rows:2})}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{className:"tiny-button",onClick:()=>D(!1),children:"Cancel"}),(0,a.jsx)("button",{className:"tiny-button approve-button",disabled:!H.trim()||c,onClick:async()=>{let e={};try{e=JSON.parse(W||"{}")}catch{}await u({stream:H.trim(),metricValue:""!==Z?Number(Z):void 0,metadata:e}),K(""),D(!1)},children:"Log Event"})]})]}),s.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Stream"}),(0,a.jsx)("th",{children:"Metric Value"}),(0,a.jsx)("th",{children:"Timestamp"}),(0,a.jsx)("th",{children:"Metadata"})]})}),(0,a.jsx)("tbody",{children:s.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-mono text-amber-400 text-xs",children:e.stream}),(0,a.jsx)("td",{className:"font-mono text-xs",children:void 0!==e.metricValue&&null!==e.metricValue?(0,a.jsx)("strong",{children:e.metricValue}):"—"}),(0,a.jsx)("td",{children:d(e.timestamp)}),(0,a.jsx)("td",{children:(0,a.jsx)("pre",{className:"text-[10px] text-gray-400 font-mono max-w-xs overflow-hidden text-ellipsis whitespace-nowrap",children:JSON.stringify(e.metadata||{})})})]},e.id))})]})}):(0,a.jsx)(i,{title:"No events logged",detail:"Telemetry and time-series events will be displayed here."})]}),"schedule"===N&&(0,a.jsxs)("section",{className:"console-panel table-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:"Calendar Commitments & Routines"}),(0,a.jsx)("span",{children:"Upcoming time intervals and schedule items"})]}),(0,a.jsx)("button",{className:"tiny-button flex items-center gap-1",onClick:()=>R(!E),children:E?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.US,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"Close"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.c1,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"New Schedule Item"})]})})]}),E&&(0,a.jsxs)("div",{className:"lifedb-form-card m-4",children:[(0,a.jsx)("h4",{className:"text-xs font-semibold text-amber-300 mb-2",children:"Create Schedule Item"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 mb-3",children:[(0,a.jsx)("input",{type:"text",placeholder:"Title (e.g. Flight to Tokyo)",value:ee,onChange:e=>es(e.target.value),className:"lifedb-input"}),(0,a.jsx)("input",{type:"text",placeholder:"Start Time (e.g. 2026-09-20T14:00:00Z)",value:et,onChange:e=>ea(e.target.value),className:"lifedb-input"}),(0,a.jsx)("input",{type:"text",placeholder:"End Time (optional)",value:el,onChange:e=>en(e.target.value),className:"lifedb-input"})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{className:"tiny-button",onClick:()=>R(!1),children:"Cancel"}),(0,a.jsx)("button",{className:"tiny-button approve-button",disabled:!ee.trim()||!et.trim()||c,onClick:async()=>{await p({title:ee.trim(),startTime:et.trim(),endTime:el.trim()||void 0,status:"active"}),es(""),ea(""),en(""),R(!1)},children:"Save Schedule"})]})]}),r.length?(0,a.jsx)("div",{className:"data-table-wrap",children:(0,a.jsxs)("table",{className:"data-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Start Time"}),(0,a.jsx)("th",{children:"End Time"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Actions"})]})}),(0,a.jsx)("tbody",{children:r.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-medium text-gray-200",children:e.title}),(0,a.jsx)("td",{children:d(e.startTime)}),(0,a.jsx)("td",{children:d(e.endTime)}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"tag font-mono",children:e.status||"active"})}),(0,a.jsx)("td",{children:(0,a.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void v(e.id),children:"Delete"})})]},e.id))})]})}):(0,a.jsx)(i,{title:"No upcoming schedule items",detail:"Calendar commitments and schedule intervals will appear here."})]})]})}function N({logs:e,filterLevel:s,filterSubsystem:t,searchQuery:r,autoRefresh:c,expandedIds:o,onToggleExpand:d,onChangeLevel:h,onChangeSubsystem:m,onChangeSearch:x,onToggleAutoRefresh:j,onRefresh:u,onClear:p,onExport:v}){let b=(0,l.useMemo)(()=>e.filter(e=>"error"===e.level).length,[e]),g=(0,l.useMemo)(()=>e.filter(e=>"warn"===e.level).length,[e]);return(0,a.jsxs)("div",{className:"console-view",children:[(0,a.jsxs)("div",{className:"view-intro",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"console-eyebrow",children:"DIAGNOSTICS & AUDIT"}),(0,a.jsx)("h2",{children:"System Logs & Diagnostics"}),(0,a.jsx)("p",{children:"Real-time audit trail of perception cycles, LLM calls, Truth Gate decisions, and tool executions."})]}),(0,a.jsxs)("div",{className:"flex gap-2 items-center flex-wrap",children:[(0,a.jsxs)("button",{className:"tiny-button flex items-center gap-1",onClick:v,title:"Download current logs as JSON",children:[(0,a.jsx)(n.s3,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"Export JSON"})]}),(0,a.jsxs)("button",{className:"tiny-button danger-button flex items-center gap-1",onClick:p,title:"Purge stored logs",children:[(0,a.jsx)(n.uc,{size:12,className:"shrink-0"}),(0,a.jsx)("span",{children:"Clear Logs"})]})]})]}),(0,a.jsxs)("section",{className:"console-panel",children:[(0,a.jsxs)("div",{className:"logs-toolbar",children:[(0,a.jsxs)("div",{className:"logs-toolbar-left",children:[(0,a.jsx)("input",{type:"text",placeholder:"Search logs, metadata...",value:r,onChange:e=>x(e.target.value),className:"logs-search-input"}),(0,a.jsxs)("select",{value:t,onChange:e=>m(e.target.value),className:"logs-select",children:[(0,a.jsx)("option",{value:"all",children:"All Subsystems"}),(0,a.jsx)("option",{value:"perception",children:"Perception"}),(0,a.jsx)("option",{value:"brain",children:"Brain / LLM"}),(0,a.jsx)("option",{value:"truth_gate",children:"Truth Gate"}),(0,a.jsx)("option",{value:"memory",children:"Memory"}),(0,a.jsx)("option",{value:"hands",children:"Hands / Tools"}),(0,a.jsx)("option",{value:"server",children:"Server"})]})]}),(0,a.jsxs)("div",{className:"logs-toolbar-right",children:[(0,a.jsx)("div",{className:"logs-level-pills",children:["all","error","warn","info","debug"].map(e=>(0,a.jsxs)("button",{type:"button",className:`log-pill ${s===e?"active":""} ${"error"===e&&b>0?"has-errors":""}`,onClick:()=>h(e),children:[e.toUpperCase(),"error"===e&&b>0&&(0,a.jsx)("span",{className:"pill-badge",children:b}),"warn"===e&&g>0&&(0,a.jsx)("span",{className:"pill-badge",children:g})]},e))}),(0,a.jsxs)("label",{className:"logs-live-toggle",children:[(0,a.jsx)("input",{type:"checkbox",checked:c,onChange:j}),(0,a.jsx)("span",{className:`live-indicator ${c?"active":""}`}),"Live (3s)"]}),(0,a.jsx)("button",{type:"button",className:"tiny-button inline-flex items-center justify-center",onClick:u,title:"Fetch latest logs",children:(0,a.jsx)(n.fN,{size:12})})]})]}),e.length>0?(0,a.jsx)("div",{className:"logs-container",children:e.map(e=>{let s=o.has(e.id),t=!!(e.metadata&&Object.keys(e.metadata).length>0),l=new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3});return(0,a.jsxs)("div",{className:`log-entry log-entry-${e.level} ${s?"expanded":""}`,children:[(0,a.jsxs)("div",{className:"log-header",onClick:()=>t&&d(e.id),style:{cursor:t?"pointer":"default"},children:[(0,a.jsx)("span",{className:"log-time",title:e.createdAt,children:l}),(0,a.jsx)("span",{className:`log-badge log-badge-${e.level}`,children:e.level.toUpperCase()}),(0,a.jsxs)("span",{className:"log-subsystem",children:["[",e.subsystem,"]"]}),(0,a.jsx)("span",{className:"log-message",children:e.message}),t&&(0,a.jsx)("span",{className:"log-expand-icon flex items-center justify-center",title:"Toggle JSON metadata",children:s?(0,a.jsx)(n.Mt,{size:12}):(0,a.jsx)(n.D3,{size:12})})]}),s&&t&&(0,a.jsxs)("div",{className:"log-metadata-card",children:[!!e.metadata?.stack&&(0,a.jsxs)("div",{className:"log-stack-trace",children:[(0,a.jsx)("strong",{children:"Stack trace:"}),(0,a.jsx)("pre",{children:String(e.metadata?.stack)})]}),(0,a.jsxs)("div",{className:"log-json-block",children:[(0,a.jsx)("strong",{children:"Payload / Metadata:"}),(0,a.jsx)("pre",{children:JSON.stringify(e.metadata,null,2)})]})]})]},e.id)})}):(0,a.jsx)(i,{title:"No system logs found",detail:r||"all"!==s||"all"!==t?"No logs match the current filters. Try resetting the search or level filter.":"No logs have been recorded yet. New perception cycles, Truth Gate decisions, and model queries will appear here."})]})]})}function y({onResetMemory:e,disabled:s}){return(0,a.jsxs)("div",{className:"console-view",children:[(0,a.jsx)("div",{className:"view-intro",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"console-eyebrow",children:"RUNTIME IDENTITY"}),(0,a.jsx)("h2",{children:"Companion Identity & Directives"}),(0,a.jsx)("p",{children:"Identity and behavioral preferences are governed dynamically through conversational teaching and reviewed in the Memory tab."})]})}),(0,a.jsxs)("section",{className:"console-panel profile-panel",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsx)("strong",{children:"Identity Directives"}),(0,a.jsx)("span",{children:"Governed Memory Model"})]}),(0,a.jsx)(i,{title:"Dynamic identity active",detail:"Siduri establishes preferences and boundaries dynamically through conversation. Use the Private Chat to teach preferences, and the Memory tab to approve or revoke directives."})]}),(0,a.jsxs)("section",{className:"console-panel profile-panel mt-6",children:[(0,a.jsxs)("div",{className:"table-toolbar",children:[(0,a.jsx)("strong",{children:"Danger Zone"}),(0,a.jsx)("span",{children:"Irreversible actions"})]}),(0,a.jsxs)("div",{className:"p-6 bg-red-900/20 border border-red-500/20 rounded-lg",children:[(0,a.jsx)("h3",{className:"text-red-400 font-medium mb-2",children:"Reset All Memory"}),(0,a.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"This will permanently delete all memory items, proposals, revisions, and claims from the database. The companion will forget all approved claims, directives, and proposals."}),(0,a.jsx)("button",{className:"bg-red-500/10 text-red-400 border border-red-500/50 hover:bg-red-500/20 px-4 py-2 rounded-md font-medium transition-colors",onClick:()=>void e(),disabled:s,children:"Reset Memory"})]})]})]})}},5064:(e,s,t)=>{Promise.resolve().then(t.bind(t,3449))}},e=>{e.O(0,[426,461,136,358],()=>e(e.s=5064)),_N_E=e.O()}]);