@theihtisham/agent-shadow-brain 7.2.0 → 7.22.0
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/CHANGELOG.md +478 -429
- package/README.md +198 -68
- package/dist/activity-cli.d.ts +3 -0
- package/dist/activity-cli.d.ts.map +1 -0
- package/dist/activity-cli.js +78 -0
- package/dist/activity-cli.js.map +1 -0
- package/dist/adapters/index.d.ts +2 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +3 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/brain/activity-journal.d.ts +82 -0
- package/dist/brain/activity-journal.d.ts.map +1 -0
- package/dist/brain/activity-journal.js +315 -0
- package/dist/brain/activity-journal.js.map +1 -0
- package/dist/brain/activity-reporting.d.ts +14 -0
- package/dist/brain/activity-reporting.d.ts.map +1 -0
- package/dist/brain/activity-reporting.js +17 -0
- package/dist/brain/activity-reporting.js.map +1 -0
- package/dist/brain/auto-update.js +1 -1
- package/dist/brain/auto-update.js.map +1 -1
- package/dist/brain/brain-portability.js +1 -1
- package/dist/brain/brain-portability.js.map +1 -1
- package/dist/brain/client-config.d.ts +19 -0
- package/dist/brain/client-config.d.ts.map +1 -0
- package/dist/brain/client-config.js +40 -0
- package/dist/brain/client-config.js.map +1 -0
- package/dist/brain/client-integrations.d.ts +63 -0
- package/dist/brain/client-integrations.d.ts.map +1 -0
- package/dist/brain/client-integrations.js +79 -0
- package/dist/brain/client-integrations.js.map +1 -0
- package/dist/brain/context-assembly.d.ts +41 -5
- package/dist/brain/context-assembly.d.ts.map +1 -1
- package/dist/brain/context-assembly.js +366 -35
- package/dist/brain/context-assembly.js.map +1 -1
- package/dist/brain/context-efficiency.d.ts +48 -0
- package/dist/brain/context-efficiency.d.ts.map +1 -0
- package/dist/brain/context-efficiency.js +34 -0
- package/dist/brain/context-efficiency.js.map +1 -0
- package/dist/brain/context-request.d.ts +4 -0
- package/dist/brain/context-request.d.ts.map +1 -0
- package/dist/brain/context-request.js +24 -0
- package/dist/brain/context-request.js.map +1 -0
- package/dist/brain/context-retrieval.d.ts +88 -0
- package/dist/brain/context-retrieval.d.ts.map +1 -0
- package/dist/brain/context-retrieval.js +301 -0
- package/dist/brain/context-retrieval.js.map +1 -0
- package/dist/brain/feature-settings.d.ts +10 -0
- package/dist/brain/feature-settings.d.ts.map +1 -1
- package/dist/brain/feature-settings.js +18 -2
- package/dist/brain/feature-settings.js.map +1 -1
- package/dist/brain/file-identity.d.ts +4 -0
- package/dist/brain/file-identity.d.ts.map +1 -0
- package/dist/brain/file-identity.js +27 -0
- package/dist/brain/file-identity.js.map +1 -0
- package/dist/brain/global-brain.d.ts +18 -2
- package/dist/brain/global-brain.d.ts.map +1 -1
- package/dist/brain/global-brain.js +75 -7
- package/dist/brain/global-brain.js.map +1 -1
- package/dist/brain/managed-project-skills.d.ts +48 -0
- package/dist/brain/managed-project-skills.d.ts.map +1 -0
- package/dist/brain/managed-project-skills.js +230 -0
- package/dist/brain/managed-project-skills.js.map +1 -0
- package/dist/brain/mcp-presence.d.ts +50 -0
- package/dist/brain/mcp-presence.d.ts.map +1 -0
- package/dist/brain/mcp-presence.js +214 -0
- package/dist/brain/mcp-presence.js.map +1 -0
- package/dist/brain/mcp-server.d.ts +40 -1
- package/dist/brain/mcp-server.d.ts.map +1 -1
- package/dist/brain/mcp-server.js +506 -52
- package/dist/brain/mcp-server.js.map +1 -1
- package/dist/brain/mcp-stdio.d.ts +12 -0
- package/dist/brain/mcp-stdio.d.ts.map +1 -0
- package/dist/brain/mcp-stdio.js +158 -0
- package/dist/brain/mcp-stdio.js.map +1 -0
- package/dist/brain/memory-annotations.d.ts +99 -0
- package/dist/brain/memory-annotations.d.ts.map +1 -0
- package/dist/brain/memory-annotations.js +402 -0
- package/dist/brain/memory-annotations.js.map +1 -0
- package/dist/brain/memory-graph.d.ts.map +1 -1
- package/dist/brain/memory-graph.js +12 -23
- package/dist/brain/memory-graph.js.map +1 -1
- package/dist/brain/memory-inspection.d.ts +73 -0
- package/dist/brain/memory-inspection.d.ts.map +1 -0
- package/dist/brain/memory-inspection.js +131 -0
- package/dist/brain/memory-inspection.js.map +1 -0
- package/dist/brain/memory-mcp-content.d.ts +46 -0
- package/dist/brain/memory-mcp-content.d.ts.map +1 -0
- package/dist/brain/memory-mcp-content.js +95 -0
- package/dist/brain/memory-mcp-content.js.map +1 -0
- package/dist/brain/memory-sources.d.ts +8 -0
- package/dist/brain/memory-sources.d.ts.map +1 -0
- package/dist/brain/memory-sources.js +27 -0
- package/dist/brain/memory-sources.js.map +1 -0
- package/dist/brain/model-registry.d.ts +4 -5
- package/dist/brain/model-registry.d.ts.map +1 -1
- package/dist/brain/model-registry.js +22 -207
- package/dist/brain/model-registry.js.map +1 -1
- package/dist/brain/model-usage.d.ts +66 -0
- package/dist/brain/model-usage.d.ts.map +1 -0
- package/dist/brain/model-usage.js +246 -0
- package/dist/brain/model-usage.js.map +1 -0
- package/dist/brain/native-codex.d.ts +105 -0
- package/dist/brain/native-codex.d.ts.map +1 -0
- package/dist/brain/native-codex.js +292 -0
- package/dist/brain/native-codex.js.map +1 -0
- package/dist/brain/native-session-import.d.ts +56 -0
- package/dist/brain/native-session-import.d.ts.map +1 -0
- package/dist/brain/native-session-import.js +307 -0
- package/dist/brain/native-session-import.js.map +1 -0
- package/dist/brain/orchestrator.js +1 -1
- package/dist/brain/orchestrator.js.map +1 -1
- package/dist/brain/project-feedback.d.ts +63 -0
- package/dist/brain/project-feedback.d.ts.map +1 -0
- package/dist/brain/project-feedback.js +300 -0
- package/dist/brain/project-feedback.js.map +1 -0
- package/dist/brain/project-hub-contract.d.ts +332 -0
- package/dist/brain/project-hub-contract.d.ts.map +1 -0
- package/dist/brain/project-hub-contract.js +57 -0
- package/dist/brain/project-hub-contract.js.map +1 -0
- package/dist/brain/project-hub-mcp.d.ts +182 -0
- package/dist/brain/project-hub-mcp.d.ts.map +1 -0
- package/dist/brain/project-hub-mcp.js +46 -0
- package/dist/brain/project-hub-mcp.js.map +1 -0
- package/dist/brain/project-hub-pdf-worker.d.ts +13 -0
- package/dist/brain/project-hub-pdf-worker.d.ts.map +1 -0
- package/dist/brain/project-hub-pdf-worker.js +84 -0
- package/dist/brain/project-hub-pdf-worker.js.map +1 -0
- package/dist/brain/project-hub-store.d.ts +50 -0
- package/dist/brain/project-hub-store.d.ts.map +1 -0
- package/dist/brain/project-hub-store.js +257 -0
- package/dist/brain/project-hub-store.js.map +1 -0
- package/dist/brain/project-hub.d.ts +132 -0
- package/dist/brain/project-hub.d.ts.map +1 -0
- package/dist/brain/project-hub.js +403 -0
- package/dist/brain/project-hub.js.map +1 -0
- package/dist/brain/project-kit-inspection.d.ts +28 -0
- package/dist/brain/project-kit-inspection.d.ts.map +1 -0
- package/dist/brain/project-kit-inspection.js +200 -0
- package/dist/brain/project-kit-inspection.js.map +1 -0
- package/dist/brain/project-kit-paths.d.ts +13 -0
- package/dist/brain/project-kit-paths.d.ts.map +1 -0
- package/dist/brain/project-kit-paths.js +141 -0
- package/dist/brain/project-kit-paths.js.map +1 -0
- package/dist/brain/project-kit.d.ts +51 -0
- package/dist/brain/project-kit.d.ts.map +1 -0
- package/dist/brain/project-kit.js +319 -0
- package/dist/brain/project-kit.js.map +1 -0
- package/dist/brain/project-memory.d.ts +38 -0
- package/dist/brain/project-memory.d.ts.map +1 -0
- package/dist/brain/project-memory.js +76 -0
- package/dist/brain/project-memory.js.map +1 -0
- package/dist/brain/project-policy-delivery.d.ts +8 -0
- package/dist/brain/project-policy-delivery.d.ts.map +1 -0
- package/dist/brain/project-policy-delivery.js +38 -0
- package/dist/brain/project-policy-delivery.js.map +1 -0
- package/dist/brain/project-policy.d.ts +88 -0
- package/dist/brain/project-policy.d.ts.map +1 -0
- package/dist/brain/project-policy.js +267 -0
- package/dist/brain/project-policy.js.map +1 -0
- package/dist/brain/project-session-contract.d.ts +180 -0
- package/dist/brain/project-session-contract.d.ts.map +1 -0
- package/dist/brain/project-session-contract.js +50 -0
- package/dist/brain/project-session-contract.js.map +1 -0
- package/dist/brain/project-session-mcp.d.ts +145 -0
- package/dist/brain/project-session-mcp.d.ts.map +1 -0
- package/dist/brain/project-session-mcp.js +58 -0
- package/dist/brain/project-session-mcp.js.map +1 -0
- package/dist/brain/project-sessions.d.ts +97 -0
- package/dist/brain/project-sessions.d.ts.map +1 -0
- package/dist/brain/project-sessions.js +223 -0
- package/dist/brain/project-sessions.js.map +1 -0
- package/dist/brain/project-source-contract.d.ts +109 -0
- package/dist/brain/project-source-contract.d.ts.map +1 -0
- package/dist/brain/project-source-contract.js +2 -0
- package/dist/brain/project-source-contract.js.map +1 -0
- package/dist/brain/project-source-intake.d.ts +26 -0
- package/dist/brain/project-source-intake.d.ts.map +1 -0
- package/dist/brain/project-source-intake.js +457 -0
- package/dist/brain/project-source-intake.js.map +1 -0
- package/dist/brain/subconscious.d.ts +3 -1
- package/dist/brain/subconscious.d.ts.map +1 -1
- package/dist/brain/subconscious.js +8 -3
- package/dist/brain/subconscious.js.map +1 -1
- package/dist/brain/workflow-skills.d.ts +5 -5
- package/dist/brain/workflow-skills.d.ts.map +1 -1
- package/dist/brain/workflow-skills.js +3 -2
- package/dist/brain/workflow-skills.js.map +1 -1
- package/dist/cli.js +37 -3
- package/dist/cli.js.map +1 -1
- package/dist/context-cli.d.ts.map +1 -1
- package/dist/context-cli.js +49 -7
- package/dist/context-cli.js.map +1 -1
- package/dist/curation-cli.d.ts +4 -0
- package/dist/curation-cli.d.ts.map +1 -0
- package/dist/curation-cli.js +118 -0
- package/dist/curation-cli.js.map +1 -0
- package/dist/dashboard/brain-hub-actions.d.ts +2 -0
- package/dist/dashboard/brain-hub-actions.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-actions.js +234 -0
- package/dist/dashboard/brain-hub-actions.js.map +1 -0
- package/dist/dashboard/brain-hub-agent-dock.d.ts +2 -0
- package/dist/dashboard/brain-hub-agent-dock.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-agent-dock.js +255 -0
- package/dist/dashboard/brain-hub-agent-dock.js.map +1 -0
- package/dist/dashboard/brain-hub-brand-icons.d.ts +2 -0
- package/dist/dashboard/brain-hub-brand-icons.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-brand-icons.js +9 -0
- package/dist/dashboard/brain-hub-brand-icons.js.map +1 -0
- package/dist/dashboard/brain-hub-client.d.ts +2 -0
- package/dist/dashboard/brain-hub-client.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-client.js +435 -0
- package/dist/dashboard/brain-hub-client.js.map +1 -0
- package/dist/dashboard/brain-hub-context.d.ts +2 -0
- package/dist/dashboard/brain-hub-context.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-context.js +37 -0
- package/dist/dashboard/brain-hub-context.js.map +1 -0
- package/dist/dashboard/brain-hub-controls.d.ts +2 -0
- package/dist/dashboard/brain-hub-controls.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-controls.js +63 -0
- package/dist/dashboard/brain-hub-controls.js.map +1 -0
- package/dist/dashboard/brain-hub-exchanges.d.ts +2 -0
- package/dist/dashboard/brain-hub-exchanges.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-exchanges.js +82 -0
- package/dist/dashboard/brain-hub-exchanges.js.map +1 -0
- package/dist/dashboard/brain-hub-graph.d.ts +2 -0
- package/dist/dashboard/brain-hub-graph.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-graph.js +338 -0
- package/dist/dashboard/brain-hub-graph.js.map +1 -0
- package/dist/dashboard/brain-hub-html.d.ts +2 -0
- package/dist/dashboard/brain-hub-html.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-html.js +85 -0
- package/dist/dashboard/brain-hub-html.js.map +1 -0
- package/dist/dashboard/brain-hub-knowledge.d.ts +2 -0
- package/dist/dashboard/brain-hub-knowledge.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-knowledge.js +33 -0
- package/dist/dashboard/brain-hub-knowledge.js.map +1 -0
- package/dist/dashboard/brain-hub-live.d.ts +2 -0
- package/dist/dashboard/brain-hub-live.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-live.js +151 -0
- package/dist/dashboard/brain-hub-live.js.map +1 -0
- package/dist/dashboard/brain-hub-managed-skills.d.ts +2 -0
- package/dist/dashboard/brain-hub-managed-skills.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-managed-skills.js +20 -0
- package/dist/dashboard/brain-hub-managed-skills.js.map +1 -0
- package/dist/dashboard/brain-hub-native.d.ts +2 -0
- package/dist/dashboard/brain-hub-native.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-native.js +44 -0
- package/dist/dashboard/brain-hub-native.js.map +1 -0
- package/dist/dashboard/brain-hub-project-views.d.ts +2 -0
- package/dist/dashboard/brain-hub-project-views.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-project-views.js +80 -0
- package/dist/dashboard/brain-hub-project-views.js.map +1 -0
- package/dist/dashboard/brain-hub-sessions.d.ts +2 -0
- package/dist/dashboard/brain-hub-sessions.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-sessions.js +40 -0
- package/dist/dashboard/brain-hub-sessions.js.map +1 -0
- package/dist/dashboard/brain-hub-usage.d.ts +2 -0
- package/dist/dashboard/brain-hub-usage.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-usage.js +28 -0
- package/dist/dashboard/brain-hub-usage.js.map +1 -0
- package/dist/dashboard/brain-hub-views.d.ts +2 -0
- package/dist/dashboard/brain-hub-views.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-views.js +155 -0
- package/dist/dashboard/brain-hub-views.js.map +1 -0
- package/dist/dashboard/demo-workspace.d.ts +11 -0
- package/dist/dashboard/demo-workspace.d.ts.map +1 -0
- package/dist/dashboard/demo-workspace.js +178 -0
- package/dist/dashboard/demo-workspace.js.map +1 -0
- package/dist/dashboard/live-workspace-html.d.ts +2 -0
- package/dist/dashboard/live-workspace-html.d.ts.map +1 -0
- package/dist/dashboard/live-workspace-html.js +1042 -0
- package/dist/dashboard/live-workspace-html.js.map +1 -0
- package/dist/dashboard/managed-project-skills-api.d.ts +29 -0
- package/dist/dashboard/managed-project-skills-api.d.ts.map +1 -0
- package/dist/dashboard/managed-project-skills-api.js +28 -0
- package/dist/dashboard/managed-project-skills-api.js.map +1 -0
- package/dist/dashboard/native-codex-api.d.ts +83 -0
- package/dist/dashboard/native-codex-api.d.ts.map +1 -0
- package/dist/dashboard/native-codex-api.js +91 -0
- package/dist/dashboard/native-codex-api.js.map +1 -0
- package/dist/dashboard/project-feedback-html.d.ts +5 -0
- package/dist/dashboard/project-feedback-html.d.ts.map +1 -0
- package/dist/dashboard/project-feedback-html.js +216 -0
- package/dist/dashboard/project-feedback-html.js.map +1 -0
- package/dist/dashboard/project-file-watch.d.ts +46 -0
- package/dist/dashboard/project-file-watch.d.ts.map +1 -0
- package/dist/dashboard/project-file-watch.js +221 -0
- package/dist/dashboard/project-file-watch.js.map +1 -0
- package/dist/dashboard/project-hub-api.d.ts +5 -0
- package/dist/dashboard/project-hub-api.d.ts.map +1 -0
- package/dist/dashboard/project-hub-api.js +121 -0
- package/dist/dashboard/project-hub-api.js.map +1 -0
- package/dist/dashboard/project-kit-html.d.ts +4 -0
- package/dist/dashboard/project-kit-html.d.ts.map +1 -0
- package/dist/dashboard/project-kit-html.js +359 -0
- package/dist/dashboard/project-kit-html.js.map +1 -0
- package/dist/dashboard/project-live-stream.d.ts +33 -0
- package/dist/dashboard/project-live-stream.d.ts.map +1 -0
- package/dist/dashboard/project-live-stream.js +233 -0
- package/dist/dashboard/project-live-stream.js.map +1 -0
- package/dist/dashboard/project-policy-api.d.ts +37 -0
- package/dist/dashboard/project-policy-api.d.ts.map +1 -0
- package/dist/dashboard/project-policy-api.js +31 -0
- package/dist/dashboard/project-policy-api.js.map +1 -0
- package/dist/dashboard/project-session-api.d.ts +28 -0
- package/dist/dashboard/project-session-api.d.ts.map +1 -0
- package/dist/dashboard/project-session-api.js +84 -0
- package/dist/dashboard/project-session-api.js.map +1 -0
- package/dist/dashboard/project-source-api.d.ts +11 -0
- package/dist/dashboard/project-source-api.d.ts.map +1 -0
- package/dist/dashboard/project-source-api.js +67 -0
- package/dist/dashboard/project-source-api.js.map +1 -0
- package/dist/dashboard/project-workspace.d.ts +16 -0
- package/dist/dashboard/project-workspace.d.ts.map +1 -0
- package/dist/dashboard/project-workspace.js +124 -0
- package/dist/dashboard/project-workspace.js.map +1 -0
- package/dist/dashboard/server.d.ts +1 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +99 -42
- package/dist/dashboard/server.js.map +1 -1
- package/dist/dashboard/v6-dashboard-html.d.ts +1 -1
- package/dist/dashboard/v6-dashboard-html.d.ts.map +1 -1
- package/dist/dashboard/v6-dashboard-html.js +4261 -4309
- package/dist/dashboard/v6-dashboard-html.js.map +1 -1
- package/dist/dashboard/workspace-api.d.ts +12 -0
- package/dist/dashboard/workspace-api.d.ts.map +1 -1
- package/dist/dashboard/workspace-api.js +359 -41
- package/dist/dashboard/workspace-api.js.map +1 -1
- package/dist/dashboard/workspace-html.d.ts.map +1 -1
- package/dist/dashboard/workspace-html.js +1118 -135
- package/dist/dashboard/workspace-html.js.map +1 -1
- package/dist/dashboard/workspace-status.d.ts +53 -0
- package/dist/dashboard/workspace-status.d.ts.map +1 -0
- package/dist/dashboard/workspace-status.js +23 -0
- package/dist/dashboard/workspace-status.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/integration-cli.d.ts +3 -0
- package/dist/integration-cli.d.ts.map +1 -0
- package/dist/integration-cli.js +16 -0
- package/dist/integration-cli.js.map +1 -0
- package/dist/project-cli.d.ts +3 -0
- package/dist/project-cli.d.ts.map +1 -0
- package/dist/project-cli.js +100 -0
- package/dist/project-cli.js.map +1 -0
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/BRAND_ASSETS.md +36 -0
- package/docs/COMPARISON.md +22 -0
- package/docs/COMPONENTS.md +66 -0
- package/docs/CONTEXT_LAB.md +79 -0
- package/docs/FEATURES_AND_LIMITS.md +29 -0
- package/docs/INTEGRATIONS.md +70 -0
- package/docs/LEARNING.md +46 -0
- package/docs/PROJECT_KIT.md +98 -0
- package/docs/QUICKSTART.md +62 -0
- package/docs/README.md +36 -0
- package/docs/ROADMAP-v7.md +147 -0
- package/docs/SESSIONS.md +77 -0
- package/docs/SHARING.md +13 -0
- package/docs/SHOWCASE.md +87 -0
- package/docs/SOURCE_INTAKE.md +33 -0
- package/docs/STATS.md +21 -0
- package/docs/TROUBLESHOOTING.md +42 -0
- package/docs/UPGRADE_PLAN_v7.0.0.md +203 -0
- package/docs/VIRAL-PLAYBOOK.md +259 -0
- package/docs/VISUAL_GUIDE_v7.1.4.md +70 -0
- package/docs/VISUAL_GUIDE_v7.22.0.md +73 -0
- package/docs/WORKFLOW_INTEGRATION.md +21 -1
- package/docs/WORKSPACE.md +63 -70
- package/docs/assets/7.1.4-collaboration-design-preview.png +0 -0
- package/docs/assets/7.1.4-comparison.png +0 -0
- package/docs/assets/7.1.4-context-lab.png +0 -0
- package/docs/assets/7.1.4-control-room-dense-preview.png +0 -0
- package/docs/assets/7.1.4-control-room-focus-preview.png +0 -0
- package/docs/assets/7.1.4-features.png +0 -0
- package/docs/assets/7.1.4-graph.png +0 -0
- package/docs/assets/7.1.4-hub-control-room.png +0 -0
- package/docs/assets/7.1.4-hub-empty.png +0 -0
- package/docs/assets/7.1.4-hub-knowledge.png +0 -0
- package/docs/assets/7.1.4-hub-learning.png +0 -0
- package/docs/assets/7.1.4-hub-mobile.png +0 -0
- package/docs/assets/7.1.4-hub-public-docs-source.png +0 -0
- package/docs/assets/7.1.4-hub-public-docs.gif +0 -0
- package/docs/assets/7.1.4-hub-public-docs.png +0 -0
- package/docs/assets/7.1.4-hub-setup.png +0 -0
- package/docs/assets/7.1.4-hub-walkthrough.gif +0 -0
- package/docs/assets/7.1.4-integrations.png +0 -0
- package/docs/assets/7.1.4-knowledge-design-preview.png +0 -0
- package/docs/assets/7.1.4-learning-design-preview.png +0 -0
- package/docs/assets/7.1.4-learning.png +0 -0
- package/docs/assets/7.1.4-live.png +0 -0
- package/docs/assets/7.1.4-memory-review.png +0 -0
- package/docs/assets/7.1.4-mobile.png +0 -0
- package/docs/assets/7.1.4-models-design-preview.png +0 -0
- package/docs/assets/7.1.4-outcome-ranking.png +0 -0
- package/docs/assets/7.1.4-overview.png +0 -0
- package/docs/assets/7.1.4-project-kit.png +0 -0
- package/docs/assets/7.1.4-project-skill-preview.png +0 -0
- package/docs/assets/7.1.4-replay.png +0 -0
- package/docs/assets/7.1.4-setup-design-preview.png +0 -0
- package/docs/assets/7.1.4-usage-design-preview.png +0 -0
- package/docs/assets/7.22.0-agent-dock-mobile.png +0 -0
- package/docs/assets/7.22.0-agent-dock.gif +0 -0
- package/docs/assets/7.22.0-agent-dock.png +0 -0
- package/docs/assets/7.22.0-hub-exchange.png +0 -0
- package/docs/assets/7.22.0-hub-exchanges.gif +0 -0
- package/docs/assets/7.22.0-hub-graph.png +0 -0
- package/docs/assets/7.22.0-hub-mobile-empty.png +0 -0
- package/docs/assets/7.22.0-managed-skills.png +0 -0
- package/docs/assets/7.22.0-plain-evidence.png +0 -0
- package/docs/assets/7.22.0-project-controls.png +0 -0
- package/docs/assets/7.22.0-sessions.png +0 -0
- package/docs/assets/7.22.0-teach-brain.png +0 -0
- package/docs/assets/context-v7.1.3.png +0 -0
- package/docs/assets/features-v7.1.3.png +0 -0
- package/docs/assets/graph-v7.1.3.png +0 -0
- package/docs/assets/integrations-v7.1.3.png +0 -0
- package/docs/assets/live-v7.1.3.png +0 -0
- package/docs/assets/live-v7.1.4.gif +0 -0
- package/docs/assets/memory-detail-v7.1.3.png +0 -0
- package/docs/assets/overview-v7.1.3.png +0 -0
- package/docs/evaluation/CONTEXT_EVALUATION_v7.1.4.json +1818 -0
- package/docs/evaluation/CONTEXT_EVALUATION_v7.1.4.md +36 -0
- package/docs/launch/COMPONENT_MAP_v7.1.4.md +307 -0
- package/docs/launch/PROJECT_KIT_PLAN_v7.1.4.md +110 -0
- package/docs/launch/PROJECT_LEARNING_PLAN_v7.1.4.md +63 -0
- package/docs/launch/RELEASE_ACCEPTANCE_v7.22.0.md +48 -0
- package/docs/launch/RELEASE_NOTES_v7.1.3.md +40 -0
- package/docs/launch/RELEASE_NOTES_v7.1.4.md +30 -0
- package/docs/launch/RELEASE_NOTES_v7.22.0.md +53 -0
- package/docs/launch/RESEARCH_AND_PLAN_v7.1.4.md +255 -0
- package/docs/launch/RESEARCH_AND_PLAN_v7.22.0.md +672 -0
- package/package.json +135 -111
- package/skills/shadow-research/SKILL.md +2 -0
- package/skills/shadow-workflow/SKILL.md +8 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v6-dashboard-html.js","sourceRoot":"","sources":["../../src/dashboard/v6-dashboard-html.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,sFAAsF;AACtF,wFAAwF;AAExF,MAAM,CAAC,MAAM,iBAAiB,GAAG
|
|
1
|
+
{"version":3,"file":"v6-dashboard-html.js","sourceRoot":"","sources":["../../src/dashboard/v6-dashboard-html.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,sFAAsF;AACtF,wFAAwF;AAExF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqqIzB,CAAC"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import { type GlobalBrain } from '../brain/global-brain.js';
|
|
3
3
|
import { type FeatureSettingsStore } from '../brain/feature-settings.js';
|
|
4
|
+
import { type MemoryAnnotationsStore } from '../brain/memory-annotations.js';
|
|
5
|
+
import { type ActivityJournal } from '../brain/activity-journal.js';
|
|
6
|
+
import { WorkspaceRuntime } from './workspace-status.js';
|
|
7
|
+
import type { ProjectHubService } from '../brain/project-hub.js';
|
|
4
8
|
export interface WorkspaceDependencies {
|
|
5
9
|
brain?: GlobalBrain;
|
|
6
10
|
settings?: FeatureSettingsStore;
|
|
11
|
+
annotations?: MemoryAnnotationsStore;
|
|
12
|
+
projectDir?: string;
|
|
13
|
+
journal?: ActivityJournal;
|
|
14
|
+
demo?: boolean;
|
|
15
|
+
localProject?: boolean;
|
|
16
|
+
runtime?: WorkspaceRuntime;
|
|
17
|
+
hub?: ProjectHubService;
|
|
18
|
+
prepareStorage?: () => Promise<string | null>;
|
|
7
19
|
}
|
|
8
20
|
/** The workspace API reads only the memory store and dedicated feature settings. */
|
|
9
21
|
export declare function handleWorkspaceRequest(req: IncomingMessage, res: ServerResponse, dependencies?: WorkspaceDependencies): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-api.d.ts","sourceRoot":"","sources":["../../src/dashboard/workspace-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace-api.d.ts","sourceRoot":"","sources":["../../src/dashboard/workspace-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAS5E,OAAO,EAA2C,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAClH,OAAO,EAAqC,KAAK,sBAAsB,EAAiC,MAAM,gCAAgC,CAAC;AAG/I,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAKjE,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,GAAG,CAAC,EAAE,iBAAiB,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC/C;AAwFD,oFAAoF;AACpF,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,YAAY,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAkU/I"}
|
|
@@ -1,18 +1,39 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { getGlobalBrain } from '../brain/global-brain.js';
|
|
2
3
|
import { getBrainBus } from '../brain/brain-bus.js';
|
|
3
|
-
import {
|
|
4
|
+
import { assembleContextWithEfficiency } from '../brain/context-efficiency.js';
|
|
5
|
+
import { ProjectPolicyStore } from '../brain/project-policy.js';
|
|
6
|
+
import { MCPPresenceStore } from '../brain/mcp-presence.js';
|
|
7
|
+
import { enforceProjectContext } from '../brain/project-policy-delivery.js';
|
|
8
|
+
import { projectPolicyRequest } from './project-policy-api.js';
|
|
9
|
+
import { parseContextRequest } from '../brain/context-request.js';
|
|
10
|
+
import { inspectMemoryHealth } from '../brain/memory-inspection.js';
|
|
4
11
|
import { FEATURE_DEFINITIONS, getFeatureSettings } from '../brain/feature-settings.js';
|
|
12
|
+
import { memoryAnnotationsFor, memoryState } from '../brain/memory-annotations.js';
|
|
13
|
+
import { normalizeMemorySources } from '../brain/memory-sources.js';
|
|
14
|
+
import { inspectClientIntegrations } from '../brain/client-integrations.js';
|
|
15
|
+
import { activityJournalFor } from '../brain/activity-journal.js';
|
|
16
|
+
import { reportAgentActivity } from '../brain/activity-reporting.js';
|
|
17
|
+
import { inspectProject, planProjectSkill, applyProjectSkill } from '../brain/project-kit.js';
|
|
18
|
+
import { requireProjectStore, addProjectKnowledge } from '../brain/project-memory.js';
|
|
19
|
+
import { ProjectFeedbackStore } from '../brain/project-feedback.js';
|
|
20
|
+
import { WorkspaceRuntime } from './workspace-status.js';
|
|
21
|
+
import { isProjectHubRoute, handleProjectHubRequest } from './project-hub-api.js';
|
|
22
|
+
import { ModelUsageStore } from '../brain/model-usage.js';
|
|
23
|
+
import { isSourceRoute, sourceRequest } from './project-source-api.js';
|
|
24
|
+
import { isProjectSessionRoute, projectSessionRequest } from './project-session-api.js';
|
|
25
|
+
import { isManagedSkillsRoute, managedSkillsRequest } from './managed-project-skills-api.js';
|
|
26
|
+
import { isNativeCodexRoute, nativeCodexRequest } from './native-codex-api.js';
|
|
5
27
|
const INVENTORY_LIMIT = 2500;
|
|
28
|
+
const sharedRuntime = new WorkspaceRuntime('shared');
|
|
6
29
|
function sources(entry) {
|
|
7
|
-
|
|
8
|
-
const candidates = [metadata.source, metadata.sourceFile, metadata.filePath, ...(Array.isArray(metadata.sources) ? metadata.sources : [])];
|
|
9
|
-
return [...new Set(candidates.filter((item) => typeof item === 'string' && !!item.trim()))].slice(0, 8);
|
|
30
|
+
return normalizeMemorySources(entry.metadata, { limit: 8, maxChars: 500 });
|
|
10
31
|
}
|
|
11
32
|
function date(value) {
|
|
12
33
|
const time = value instanceof Date ? value.getTime() : typeof value === 'string' || typeof value === 'number' ? new Date(value).getTime() : NaN;
|
|
13
34
|
return Number.isFinite(time) ? new Date(time).toISOString() : null;
|
|
14
35
|
}
|
|
15
|
-
function summary(entry) {
|
|
36
|
+
function summary(entry, annotations) {
|
|
16
37
|
const confidence = 'confidence' in entry ? entry.confidence : undefined;
|
|
17
38
|
const matched = confidence?.explanation?.matchedKeywords ?? [];
|
|
18
39
|
const refs = sources(entry);
|
|
@@ -21,6 +42,7 @@ function summary(entry) {
|
|
|
21
42
|
category: entry.category, agent: entry.agentTool, project: entry.projectId, projectName: entry.projectName,
|
|
22
43
|
source: refs[0] ?? '', sources: refs, updatedAt: date(entry.createdAt), score: confidence?.score,
|
|
23
44
|
reasons: confidence ? [matched.length ? 'Matches: ' + matched.join(', ') : 'Ranked by importance, age, and recorded use.'] : [],
|
|
45
|
+
effectiveState: annotations ? memoryState(annotations, entry.projectId, entry.id) : 'active',
|
|
24
46
|
};
|
|
25
47
|
}
|
|
26
48
|
function bounded(value, fallback, max, min = 1) {
|
|
@@ -75,6 +97,26 @@ async function body(req) {
|
|
|
75
97
|
function settingsResponse(store) {
|
|
76
98
|
return { ...store.get(), definitions: FEATURE_DEFINITIONS };
|
|
77
99
|
}
|
|
100
|
+
async function portalActivity(dependencies, tool, projectId) {
|
|
101
|
+
const correlationId = randomUUID();
|
|
102
|
+
const journal = dependencies.journal;
|
|
103
|
+
const record = async (outcome, durationMs) => {
|
|
104
|
+
try {
|
|
105
|
+
if (!journal || !(dependencies.settings ?? getFeatureSettings()).get().features.activityRecording)
|
|
106
|
+
return false;
|
|
107
|
+
await journal.append({ kind: outcome ? 'tool-end' : 'tool-start', source: 'reported', transport: 'host',
|
|
108
|
+
projectId, agent: 'portal', sessionId: 'project-portal', tool, correlationId, ...(outcome ? { outcome, durationMs } : {}) });
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
if (!await record())
|
|
116
|
+
return undefined;
|
|
117
|
+
const started = performance.now();
|
|
118
|
+
return (outcome) => record(outcome, Math.max(0, performance.now() - started));
|
|
119
|
+
}
|
|
78
120
|
/** The workspace API reads only the memory store and dedicated feature settings. */
|
|
79
121
|
export async function handleWorkspaceRequest(req, res, dependencies = {}) {
|
|
80
122
|
const send = (data, status = 200) => {
|
|
@@ -85,9 +127,156 @@ export async function handleWorkspaceRequest(req, res, dependencies = {}) {
|
|
|
85
127
|
const url = new URL(req.url ?? '/', 'http://localhost');
|
|
86
128
|
const route = url.pathname.slice('/api/workspace/'.length);
|
|
87
129
|
const method = req.method ?? 'GET';
|
|
88
|
-
|
|
130
|
+
const expectedProject = req.headers['x-shadow-brain-project'];
|
|
131
|
+
if (method === 'POST' && expectedProject !== undefined && expectedProject !== dependencies.runtime?.project?.id) {
|
|
132
|
+
return send({ error: 'This port now serves a different project. Reload the portal before making changes.', code: 'WORKSPACE_PROJECT_CHANGED' }, 409);
|
|
133
|
+
}
|
|
134
|
+
const storageError = await dependencies.prepareStorage?.();
|
|
135
|
+
if (route === 'status' && method === 'GET')
|
|
136
|
+
return send((dependencies.runtime ?? sharedRuntime).status(dependencies.brain, !!dependencies.hub && !storageError, storageError));
|
|
137
|
+
if (storageError)
|
|
138
|
+
return send({ error: storageError, code: 'WORKSPACE_STORAGE_UNAVAILABLE' }, 503);
|
|
139
|
+
if (isProjectHubRoute(url.pathname)) {
|
|
140
|
+
const section = url.pathname.split('/')[4];
|
|
141
|
+
const tool = 'hub-' + (['documents', 'rooms', 'lessons'].includes(section) ? section : 'overview');
|
|
142
|
+
const end = method === 'POST' ? await portalActivity(dependencies, tool, dependencies.runtime?.project?.id) : undefined;
|
|
143
|
+
let outcome = 'error';
|
|
144
|
+
try {
|
|
145
|
+
await handleProjectHubRequest(req, res, dependencies.hub, url);
|
|
146
|
+
if (res.writableEnded && res.statusCode < 400)
|
|
147
|
+
outcome = 'success';
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
await end?.(outcome);
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const local = dependencies.localProject && dependencies.projectDir && dependencies.brain
|
|
155
|
+
? requireProjectStore(dependencies.projectDir, dependencies.brain) : undefined;
|
|
156
|
+
if (route === 'presence') {
|
|
157
|
+
if (method !== 'GET')
|
|
158
|
+
return send({ error: 'Use GET to inspect project MCP presence.' }, 405);
|
|
159
|
+
if (!local)
|
|
160
|
+
return send({ error: 'Open a project-local workspace to inspect MCP connections.' }, 409);
|
|
161
|
+
if ((req.headers.origin && req.headers.origin !== 'http://' + req.headers.host) ||
|
|
162
|
+
['cross-site', 'same-site'].includes(String(req.headers['sec-fetch-site'])))
|
|
163
|
+
return send({ error: 'MCP presence is available to same-origin requests.' }, 403);
|
|
164
|
+
const enabled = (dependencies.settings ?? getFeatureSettings()).get().features.activityRecording;
|
|
165
|
+
return send(new MCPPresenceStore(local.root, local.projectId).read(enabled));
|
|
166
|
+
}
|
|
167
|
+
if (isManagedSkillsRoute(route)) {
|
|
168
|
+
if (!local)
|
|
169
|
+
return send({ error: 'Open a project-local workspace to manage Project Kit skills.', code: 'MANAGED_SKILL_PROJECT_REQUIRED' }, 409);
|
|
170
|
+
return send(await managedSkillsRequest(req, route, local.root, () => body(req)));
|
|
171
|
+
}
|
|
172
|
+
if (route === 'project-policy') {
|
|
173
|
+
if (!local)
|
|
174
|
+
return send({ error: 'Open a project-local workspace to use project controls.' }, 409);
|
|
175
|
+
return send(await projectPolicyRequest(req, local.root, local.projectId, dependencies.brain, () => body(req)));
|
|
176
|
+
}
|
|
177
|
+
if (isProjectSessionRoute(route)) {
|
|
178
|
+
if (!local)
|
|
179
|
+
return send({ error: 'Open a project-local workspace to use shared sessions.', code: 'SESSION_LOCAL_PROJECT_REQUIRED' }, 409);
|
|
180
|
+
if (isNativeCodexRoute(route))
|
|
181
|
+
return send(await nativeCodexRequest(req, route, url, local.root, dependencies.brain, () => body(req)));
|
|
182
|
+
return send(await projectSessionRequest(req, route, url, local.root, dependencies.brain, () => body(req)));
|
|
183
|
+
}
|
|
184
|
+
if (isSourceRoute(route) || route === 'usage' || route === 'usage-report') {
|
|
185
|
+
if (!local)
|
|
186
|
+
return send({ error: 'Open a project-local workspace to use project sources and usage receipts.' }, 409);
|
|
187
|
+
if (isSourceRoute(route)) {
|
|
188
|
+
const end = method === 'POST' ? await portalActivity(dependencies, route === 'sources' ? 'source-preview' : 'source-review', local.projectId) : undefined;
|
|
189
|
+
let result;
|
|
190
|
+
try {
|
|
191
|
+
result = await sourceRequest(req, url, local.root, dependencies.brain);
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
await end?.('error');
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
await end?.('success');
|
|
198
|
+
return send(result);
|
|
199
|
+
}
|
|
200
|
+
const settings = dependencies.settings ?? getFeatureSettings();
|
|
201
|
+
const usage = new ModelUsageStore(local.root, local.projectId);
|
|
202
|
+
if (route === 'usage' && method === 'GET')
|
|
203
|
+
return send({ ...usage.read(), recording: settings.get().features.activityRecording });
|
|
204
|
+
if (route === 'usage-report' && method === 'POST') {
|
|
205
|
+
if (!settings.get().features.activityRecording)
|
|
206
|
+
return send({ error: 'Activity recording is disabled for this project.' }, 409);
|
|
207
|
+
if (req.headers['sec-fetch-site'] === 'cross-site')
|
|
208
|
+
return send({ error: 'Cross-origin changes are not accepted.' }, 403);
|
|
209
|
+
return send({ receipt: usage.report(await body(req)) });
|
|
210
|
+
}
|
|
211
|
+
return send({ error: 'Method not allowed.' }, 405);
|
|
212
|
+
}
|
|
213
|
+
const projectRoutes = ['project-profile', 'project-knowledge', 'project-skill-preview', 'project-skill-apply', 'project-feedback'];
|
|
214
|
+
const writes = ['memory-review', 'memory-link', 'memory-unlink'];
|
|
215
|
+
if (!['GET', 'POST'].includes(method) || (method === 'POST' && !['context', 'context-compare', 'features', 'activity-report', ...writes, ...projectRoutes.slice(1)].includes(route)))
|
|
89
216
|
return send({ error: 'Method not allowed.' }, 405);
|
|
90
217
|
const settings = dependencies.settings ?? getFeatureSettings();
|
|
218
|
+
const localActivity = () => {
|
|
219
|
+
const enabled = settings.get().features.liveActivity;
|
|
220
|
+
if (!local)
|
|
221
|
+
return activity(enabled);
|
|
222
|
+
const journal = dependencies.journal ?? activityJournalFor(dependencies.brain);
|
|
223
|
+
return { enabled, activity: enabled ? journal.read({ projectId: local.projectId, limit: 200 }).events.slice(-30).reverse().map(event => ({
|
|
224
|
+
id: event.id, type: event.kind, label: [event.tool, event.phase, event.outcome].filter(Boolean).join(' · ') || event.kind,
|
|
225
|
+
agent: event.agent ?? '', project: local.projectName, timestamp: event.timestamp,
|
|
226
|
+
})) : [] };
|
|
227
|
+
};
|
|
228
|
+
if (projectRoutes.includes(route)) {
|
|
229
|
+
if (!local)
|
|
230
|
+
return send({ error: 'Open shadow-brain project workspace for project-local knowledge and skills.' }, 409);
|
|
231
|
+
if (route === 'project-profile')
|
|
232
|
+
return send(inspectProject(local.root));
|
|
233
|
+
if (route === 'project-feedback') {
|
|
234
|
+
const feedback = new ProjectFeedbackStore(local.root, dependencies.brain);
|
|
235
|
+
if (method === 'GET')
|
|
236
|
+
return send(feedback.get());
|
|
237
|
+
const input = await body(req);
|
|
238
|
+
const { expectedRevision, kind, ...params } = input;
|
|
239
|
+
await dependencies.brain.init();
|
|
240
|
+
dependencies.brain.refresh();
|
|
241
|
+
if (dependencies.brain.getStorageHealth().lastError)
|
|
242
|
+
throw new Error('Project memory could not be read; feedback was not changed.');
|
|
243
|
+
const command = { kind: kind === 'record' ? 'upsert' : kind === 'enable' ? 'toggle' : kind, ...params };
|
|
244
|
+
return send(await feedback.update(command, expectedRevision, 'user'));
|
|
245
|
+
}
|
|
246
|
+
if (method !== 'POST')
|
|
247
|
+
return send({ error: 'Use POST for project knowledge and skill requests.' }, 405);
|
|
248
|
+
const input = await body(req);
|
|
249
|
+
if (route === 'project-skill-preview')
|
|
250
|
+
return send(planProjectSkill(local.root, input));
|
|
251
|
+
const started = Date.now();
|
|
252
|
+
const correlationId = randomUUID();
|
|
253
|
+
const recordOperation = async (outcome) => {
|
|
254
|
+
if (!settings.get().features.activityRecording)
|
|
255
|
+
return;
|
|
256
|
+
try {
|
|
257
|
+
await (dependencies.journal ?? activityJournalFor(dependencies.brain)).append({ projectId: local.projectId,
|
|
258
|
+
kind: outcome ? 'tool-end' : 'tool-start', source: 'reported', transport: 'host', agent: 'user', sessionId: 'project-portal',
|
|
259
|
+
tool: route, correlationId, ...(outcome ? { outcome, durationMs: Math.max(0, Date.now() - started) } : {}) });
|
|
260
|
+
}
|
|
261
|
+
catch { /* The committed result remains valid when optional activity recording is unavailable. */ }
|
|
262
|
+
};
|
|
263
|
+
await recordOperation();
|
|
264
|
+
let result;
|
|
265
|
+
try {
|
|
266
|
+
if (route === 'project-knowledge')
|
|
267
|
+
result = await addProjectKnowledge(local.root, dependencies.brain, input);
|
|
268
|
+
else {
|
|
269
|
+
const { expectedPlanHash, ...params } = input;
|
|
270
|
+
result = await applyProjectSkill(local.root, params, expectedPlanHash);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
await recordOperation('error');
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
await recordOperation('success');
|
|
278
|
+
return send(result);
|
|
279
|
+
}
|
|
91
280
|
if (route === 'features') {
|
|
92
281
|
if (method === 'POST') {
|
|
93
282
|
const input = await body(req);
|
|
@@ -100,73 +289,193 @@ export async function handleWorkspaceRequest(req, res, dependencies = {}) {
|
|
|
100
289
|
return send(settingsResponse(settings));
|
|
101
290
|
}
|
|
102
291
|
if (route === 'activity')
|
|
103
|
-
return send(
|
|
104
|
-
if (
|
|
292
|
+
return send(localActivity());
|
|
293
|
+
if (route === 'telemetry') {
|
|
294
|
+
const flags = settings.get().features;
|
|
295
|
+
const common = { checkedAt: new Date().toISOString(), liveEnabled: flags.liveActivity, recordingEnabled: flags.activityRecording, demo: dependencies.demo === true };
|
|
296
|
+
if (!flags.liveActivity)
|
|
297
|
+
return send({ ...common, events: [], journalId: null, revision: 0, oldestSequence: null, latestSequence: 0,
|
|
298
|
+
nextAfterSequence: 0, cursor: 0, hasMore: false, gap: false, reset: false, retainedCount: 0, droppedCount: 0 });
|
|
299
|
+
const qs = url.searchParams;
|
|
300
|
+
const cursor = qs.get('cursor');
|
|
301
|
+
const journal = dependencies.journal ?? activityJournalFor(dependencies.brain ?? getGlobalBrain());
|
|
302
|
+
const page = journal.read({ afterSequence: cursor === null ? undefined : bounded(cursor, 0, Number.MAX_SAFE_INTEGER, 0),
|
|
303
|
+
journalId: query(qs, 'journalId'), projectId: local?.projectId ?? query(qs, 'project'), limit: bounded(qs.get('limit'), 200, 200) });
|
|
304
|
+
return send({ ...common, ...page, cursor: page.nextAfterSequence });
|
|
305
|
+
}
|
|
306
|
+
if (route === 'activity-report') {
|
|
307
|
+
if (method !== 'POST')
|
|
308
|
+
return send({ error: 'Use POST to report activity.' }, 405);
|
|
309
|
+
const input = await body(req);
|
|
310
|
+
if (local && input.projectId !== undefined && input.projectId !== local.projectId)
|
|
311
|
+
throw new TypeError('This portal is pinned to its local project.');
|
|
312
|
+
if (local)
|
|
313
|
+
input.projectId = local.projectId;
|
|
314
|
+
return send(await reportAgentActivity(dependencies.brain ?? getGlobalBrain(), settings, input, dependencies.journal));
|
|
315
|
+
}
|
|
316
|
+
if (!['overview', 'memories', 'graph', 'context', 'context-compare', 'memory', 'memory-health', 'integrations', ...writes].includes(route))
|
|
105
317
|
return send({ error: 'Not found.' }, 404);
|
|
106
|
-
if (
|
|
318
|
+
if (['context', 'context-compare'].includes(route) && method !== 'POST')
|
|
107
319
|
return send({ error: 'Use POST for context assembly.' }, 405);
|
|
320
|
+
if (writes.includes(route) && method !== 'POST')
|
|
321
|
+
return send({ error: 'Use POST for memory changes.' }, 405);
|
|
322
|
+
const mutationInput = writes.includes(route) ? await body(req) : undefined;
|
|
323
|
+
if (mutationInput) {
|
|
324
|
+
if (local && mutationInput.projectId !== local.projectId)
|
|
325
|
+
throw new TypeError('This portal is pinned to its local project.');
|
|
326
|
+
if (!Number.isSafeInteger(mutationInput.expectedRevision) || Number(mutationInput.expectedRevision) < 0)
|
|
327
|
+
throw new TypeError('A current expectedRevision is required.');
|
|
328
|
+
const allowed = route === 'memory-review' ? ['projectId', 'memoryId', 'state', 'note', 'expectedRevision'] :
|
|
329
|
+
route === 'memory-link' ? ['projectId', 'fromId', 'toId', 'type', 'note', 'expectedRevision'] : ['projectId', 'memoryId', 'linkId', 'expectedRevision'];
|
|
330
|
+
if (Object.keys(mutationInput).some(key => !allowed.includes(key)))
|
|
331
|
+
throw new TypeError('Unknown memory change field.');
|
|
332
|
+
}
|
|
108
333
|
const brain = dependencies.brain ?? getGlobalBrain();
|
|
334
|
+
if (route === 'integrations')
|
|
335
|
+
return send(inspectClientIntegrations({ projectDir: dependencies.projectDir, brain, localProjectId: local?.projectId }));
|
|
336
|
+
const annotationStore = dependencies.annotations ?? memoryAnnotationsFor(brain);
|
|
109
337
|
const refresh = async () => {
|
|
110
338
|
await brain.init();
|
|
111
|
-
|
|
339
|
+
brain.refresh();
|
|
112
340
|
if (brain.getStorageHealth().lastError)
|
|
113
341
|
throw new Error('The memory store could not be read. Check storage health.');
|
|
114
342
|
};
|
|
115
|
-
if (route === 'context') {
|
|
343
|
+
if (route === 'context' || route === 'context-compare') {
|
|
116
344
|
const input = await body(req);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
throw new TypeError('Choose a project.');
|
|
121
|
-
if (input.query !== undefined && typeof input.query !== 'string')
|
|
122
|
-
throw new TypeError('Task must be text.');
|
|
123
|
-
if (input.includeCrossProject !== undefined && typeof input.includeCrossProject !== 'boolean')
|
|
124
|
-
throw new TypeError('Cross-project choice must be boolean.');
|
|
125
|
-
if (input.tokenBudget !== undefined && (!Number.isSafeInteger(input.tokenBudget) || Number(input.tokenBudget) < 0 || Number(input.tokenBudget) > 12000))
|
|
126
|
-
throw new TypeError('Token budget must be an integer from 0 to 12000.');
|
|
345
|
+
const options = parseContextRequest(input);
|
|
346
|
+
if (local && (options.projectId !== local.projectId || options.includeCrossProject === true))
|
|
347
|
+
throw new TypeError('This portal is pinned to its local project.');
|
|
127
348
|
const flags = settings.get().features;
|
|
128
349
|
if (flags.contextAssembly)
|
|
129
350
|
await refresh();
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
351
|
+
const requested = { ...options, features: flags, annotations: flags.contextAssembly ? annotationStore.get() : undefined,
|
|
352
|
+
feedback: flags.contextAssembly && local ? new ProjectFeedbackStore(local.root, brain).get() : undefined };
|
|
353
|
+
const common = local ? enforceProjectContext(local.root, brain, new ProjectPolicyStore(local.root, local.projectId).get(), requested) : requested;
|
|
354
|
+
if (route === 'context')
|
|
355
|
+
return send(assembleContextWithEfficiency(brain, common));
|
|
356
|
+
const legacy = assembleContextWithEfficiency(brain, { ...common, profile: 'legacy' });
|
|
357
|
+
const adaptive = assembleContextWithEfficiency(brain, { ...common, profile: 'adaptive' });
|
|
358
|
+
const oldIds = new Set(legacy.entries.map(entry => entry.id));
|
|
359
|
+
const newIds = new Set(adaptive.entries.map(entry => entry.id));
|
|
360
|
+
return send({ legacy, adaptive, delta: { addedIds: [...newIds].filter(id => !oldIds.has(id)),
|
|
361
|
+
removedIds: [...oldIds].filter(id => !newIds.has(id)), sharedIds: [...newIds].filter(id => oldIds.has(id)) },
|
|
362
|
+
warnings: ['Both profiles use the same memory view. Their token estimators differ; selection changes are not proof of higher accuracy.'] });
|
|
134
363
|
}
|
|
135
364
|
await refresh();
|
|
136
|
-
const
|
|
365
|
+
const annotations = annotationStore.get();
|
|
366
|
+
const qs = url.searchParams;
|
|
367
|
+
const requestedProject = local?.projectId ?? query(qs, 'project');
|
|
368
|
+
if (local && query(qs, 'project') && query(qs, 'project') !== local.projectId)
|
|
369
|
+
throw new TypeError('This portal is pinned to its local project.');
|
|
370
|
+
if (route === 'memory-health')
|
|
371
|
+
return send(inspectMemoryHealth(brain, annotations, { projectId: requestedProject, limit: bounded(qs.get('limit'), 30, 100) }));
|
|
372
|
+
if (route === 'memory') {
|
|
373
|
+
const id = query(qs, 'id');
|
|
374
|
+
if (!id || !requestedProject)
|
|
375
|
+
throw new TypeError('Memory ID and project are required.');
|
|
376
|
+
const memory = brain.getEntry(id);
|
|
377
|
+
if (!memory || memory.projectId !== requestedProject)
|
|
378
|
+
return send({ error: 'Memory not found in the selected project.' }, 404);
|
|
379
|
+
const endpoint = (memoryId) => {
|
|
380
|
+
const value = brain.getEntry(memoryId);
|
|
381
|
+
return value?.projectId === requestedProject ? value : undefined;
|
|
382
|
+
};
|
|
383
|
+
const links = annotations.links.filter(link => link.projectId === requestedProject && [link.fromId, link.toId].includes(id))
|
|
384
|
+
.map(link => ({ ...link, fromTitle: endpoint(link.fromId)?.content.slice(0, 130) ?? 'Unavailable memory',
|
|
385
|
+
toTitle: endpoint(link.toId)?.content.slice(0, 130) ?? 'Unavailable memory',
|
|
386
|
+
orphaned: !endpoint(link.fromId) || !endpoint(link.toId) }));
|
|
387
|
+
const history = annotations.history.filter(event => event.projectId === requestedProject &&
|
|
388
|
+
((event.command.kind === 'review' && event.command.memoryId === id) ||
|
|
389
|
+
(event.command.kind === 'link' && [event.command.fromId, event.command.toId].includes(id)) ||
|
|
390
|
+
(event.relation && [event.relation.fromId, event.relation.toId].includes(id))));
|
|
391
|
+
const review = annotations.reviews[id]?.projectId === requestedProject ? annotations.reviews[id] : null;
|
|
392
|
+
return send({ memory: { ...summary(memory, annotations), content: memory.content, importance: memory.importance, createdAt: date(memory.createdAt) },
|
|
393
|
+
review, effectiveState: memoryState(annotations, requestedProject, id), links, revision: annotations.revision, history,
|
|
394
|
+
warnings: links.some(link => link.orphaned) ? ['A linked memory is no longer available. Recorded supersession remains until explicitly removed.'] : [] });
|
|
395
|
+
}
|
|
396
|
+
if (writes.includes(route)) {
|
|
397
|
+
const input = mutationInput;
|
|
398
|
+
let command;
|
|
399
|
+
if (route === 'memory-review')
|
|
400
|
+
command = { kind: 'review', projectId: input.projectId, memoryId: input.memoryId, state: input.state, ...(input.note !== undefined ? { note: input.note } : {}) };
|
|
401
|
+
else if (route === 'memory-link')
|
|
402
|
+
command = { kind: 'link', projectId: input.projectId, fromId: input.fromId, toId: input.toId, type: input.type, ...(input.note !== undefined ? { note: input.note } : {}) };
|
|
403
|
+
else {
|
|
404
|
+
const memory = typeof input.memoryId === 'string' ? brain.getEntry(input.memoryId) : undefined;
|
|
405
|
+
const link = annotations.links.find(item => item.id === input.linkId && item.projectId === input.projectId && [item.fromId, item.toId].includes(String(input.memoryId)));
|
|
406
|
+
if (!memory || memory.projectId !== input.projectId || !link)
|
|
407
|
+
return send({ error: 'Relationship not found in the selected memory and project.' }, 404);
|
|
408
|
+
command = { kind: 'unlink', linkId: input.linkId };
|
|
409
|
+
}
|
|
410
|
+
const committed = await annotationStore.update(command, input.expectedRevision);
|
|
411
|
+
return send({ revision: committed.revision, updatedAt: committed.updatedAt });
|
|
412
|
+
}
|
|
413
|
+
const recentInventory = brain.timeline({ limit: INVENTORY_LIMIT, ...(local ? { projectId: local.projectId } : {}) });
|
|
414
|
+
const inventory = requestedProject ? brain.timeline({ projectId: requestedProject, limit: INVENTORY_LIMIT }) : recentInventory;
|
|
137
415
|
const projectMap = new Map();
|
|
138
|
-
|
|
416
|
+
if (local)
|
|
417
|
+
projectMap.set(local.projectId, { id: local.projectId, name: local.projectName, memories: 0, updatedAt: null });
|
|
418
|
+
for (const entry of recentInventory) {
|
|
139
419
|
const project = projectMap.get(entry.projectId) ?? { id: entry.projectId, name: entry.projectName || entry.projectId, memories: 0, updatedAt: date(entry.createdAt) };
|
|
140
420
|
project.memories++;
|
|
141
421
|
projectMap.set(entry.projectId, project);
|
|
142
422
|
}
|
|
423
|
+
if (requestedProject && inventory.length)
|
|
424
|
+
projectMap.set(requestedProject, {
|
|
425
|
+
id: requestedProject, name: inventory[0].projectName || requestedProject, memories: inventory.length, updatedAt: date(inventory[0].createdAt),
|
|
426
|
+
});
|
|
143
427
|
const projects = [...projectMap.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
144
428
|
const facets = { projects, categories: [...new Set(inventory.map(entry => entry.category))].sort(), agents: [...new Set(inventory.map(entry => entry.agentTool))].sort() };
|
|
145
|
-
const inventoryTruncated = brain.getStats().totalEntries > inventory.length;
|
|
429
|
+
const inventoryTruncated = requestedProject ? brain.timeline({ projectId: requestedProject, limit: INVENTORY_LIMIT + 1 }).length > INVENTORY_LIMIT : brain.getStats().totalEntries > inventory.length;
|
|
146
430
|
if (route === 'overview') {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
431
|
+
const scoped = inventory.filter(entry => !requestedProject || entry.projectId === requestedProject);
|
|
432
|
+
const quality = { total: scoped.length, sourceBacked: 0, active: 0, contested: 0, archived: 0, superseded: 0, reviewed: 0 };
|
|
433
|
+
for (const entry of scoped) {
|
|
434
|
+
quality[memoryState(annotations, entry.projectId, entry.id)]++;
|
|
435
|
+
if (sources(entry).length)
|
|
436
|
+
quality.sourceBacked++;
|
|
437
|
+
if (annotations.reviews[entry.id]?.projectId === entry.projectId)
|
|
438
|
+
quality.reviewed++;
|
|
439
|
+
}
|
|
440
|
+
return send({ version: '7.22.0', demo: dependencies.demo === true,
|
|
441
|
+
projectKit: local ? { available: true, projectId: local.projectId, projectName: local.projectName, root: local.root, storagePath: local.storagePath } : { available: false },
|
|
442
|
+
totals: { projects: projects.length, memories: local ? inventory.length : brain.getStats().totalEntries, agents: facets.agents.length },
|
|
443
|
+
projects, ...localActivity(), storageHealth: brain.getStorageHealth(),
|
|
444
|
+
features: settings.get().features, recentMemories: scoped.slice(0, 5).map(entry => summary(entry, annotations)), truncated: inventoryTruncated,
|
|
445
|
+
quality, scope: { projectId: requestedProject ?? null, basis: 'recent-inventory' },
|
|
150
446
|
inventoryLimit: INVENTORY_LIMIT });
|
|
151
447
|
}
|
|
152
|
-
const
|
|
153
|
-
const projectId = query(qs, 'project');
|
|
448
|
+
const projectId = requestedProject;
|
|
154
449
|
const category = query(qs, 'category');
|
|
155
450
|
const agentTool = query(qs, 'agent');
|
|
156
451
|
const search = query(qs, 'q');
|
|
157
|
-
|
|
452
|
+
let entries = search ? brain.recallScored({ projectId, category, agentTool, keywords: search.split(/\s+/), limit: INVENTORY_LIMIT })
|
|
158
453
|
: inventory.filter(entry => (!projectId || entry.projectId === projectId) && (!category || entry.category === category) && (!agentTool || entry.agentTool === agentTool));
|
|
454
|
+
const stateFilter = query(qs, 'state');
|
|
455
|
+
if (stateFilter && stateFilter !== 'all') {
|
|
456
|
+
if (!['active', 'archived', 'contested', 'superseded'].includes(stateFilter))
|
|
457
|
+
throw new TypeError('Unknown memory state.');
|
|
458
|
+
entries = entries.filter(entry => memoryState(annotations, entry.projectId, entry.id) === stateFilter);
|
|
459
|
+
}
|
|
159
460
|
if (route === 'memories') {
|
|
160
461
|
const limit = bounded(qs.get('limit'), 30, 100);
|
|
161
462
|
const offset = bounded(qs.get('offset'), 0, INVENTORY_LIMIT, 0);
|
|
162
|
-
return send({ items: entries.slice(offset, offset + limit).map(summary), total: entries.length, facets, truncated: inventoryTruncated, inventoryLimit: INVENTORY_LIMIT });
|
|
463
|
+
return send({ items: entries.slice(offset, offset + limit).map(entry => summary(entry, annotations)), total: entries.length, facets, truncated: inventoryTruncated, inventoryLimit: INVENTORY_LIMIT });
|
|
163
464
|
}
|
|
164
|
-
const limit = bounded(qs.get('limit'), 100,
|
|
465
|
+
const limit = bounded(qs.get('limit'), 100, 500);
|
|
165
466
|
const nodes = [];
|
|
166
467
|
const edges = [];
|
|
468
|
+
const selectedId = query(qs, 'memory');
|
|
469
|
+
const selected = selectedId ? brain.getEntry(selectedId) : undefined;
|
|
470
|
+
const shown = entries.slice(0, limit);
|
|
471
|
+
if (selected && (!projectId || selected.projectId === projectId) && !shown.some(entry => entry.id === selected.id)) {
|
|
472
|
+
if (shown.length >= limit)
|
|
473
|
+
shown.pop();
|
|
474
|
+
shown.unshift(selected);
|
|
475
|
+
}
|
|
167
476
|
const usedProjects = new Set();
|
|
168
477
|
const usedAgents = new Set();
|
|
169
|
-
for (const entry of
|
|
478
|
+
for (const entry of shown) {
|
|
170
479
|
const projectNode = 'project:' + entry.projectId;
|
|
171
480
|
const agentNode = 'agent:' + entry.agentTool;
|
|
172
481
|
const memoryNode = 'memory:' + entry.id;
|
|
@@ -178,16 +487,25 @@ export async function handleWorkspaceRequest(req, res, dependencies = {}) {
|
|
|
178
487
|
usedAgents.add(agentNode);
|
|
179
488
|
nodes.push({ id: agentNode, kind: 'agent', label: entry.agentTool });
|
|
180
489
|
}
|
|
181
|
-
const detail = summary(entry);
|
|
490
|
+
const detail = summary(entry, annotations);
|
|
182
491
|
nodes.push({ id: memoryNode, kind: 'memory', label: detail.title, project: entry.projectId, category: entry.category,
|
|
183
|
-
snippet: detail.snippet, source: detail.source, agent: entry.agentTool, updatedAt: detail.updatedAt });
|
|
492
|
+
memoryId: entry.id, effectiveState: detail.effectiveState, snippet: detail.snippet, source: detail.source, sources: detail.sources, agent: entry.agentTool, updatedAt: detail.updatedAt });
|
|
184
493
|
edges.push({ source: projectNode, target: memoryNode, kind: 'belongs-to' }, { source: agentNode, target: memoryNode, kind: 'recorded-by' });
|
|
185
494
|
}
|
|
186
|
-
|
|
495
|
+
const shownById = new Map(shown.map(entry => [entry.id, entry.projectId]));
|
|
496
|
+
for (const link of annotations.links) {
|
|
497
|
+
if (shownById.get(link.fromId) !== link.projectId || shownById.get(link.toId) !== link.projectId)
|
|
498
|
+
continue;
|
|
499
|
+
edges.push({ id: link.id, source: 'memory:' + link.fromId, target: 'memory:' + link.toId, kind: link.type, note: link.note });
|
|
500
|
+
}
|
|
501
|
+
return send({ nodes, edges, truncated: entries.length > limit || inventoryTruncated, shownMemories: shown.length, totalMemories: entries.length, facets });
|
|
187
502
|
}
|
|
188
503
|
catch (error) {
|
|
189
504
|
const code = error.code;
|
|
190
|
-
send({ error: error instanceof Error ? error.message : String(error), ...(code ? { code } : {}) },
|
|
505
|
+
send({ error: error instanceof Error ? error.message : String(error), ...(code ? { code } : {}) }, Number.isInteger(error.status) ? error.status :
|
|
506
|
+
code === 'FEATURE_SETTINGS_CONFLICT' || code === 'ANNOTATIONS_CONFLICT' || code?.includes('CONFLICT') || code?.includes('STALE') ? 409 : code === 'ANNOTATIONS_NOT_FOUND' ? 404 :
|
|
507
|
+
code === 'FEATURE_SETTINGS_INVALID_PATCH' || code === 'ANNOTATIONS_INVALID_COMMAND' || code === 'ACTIVITY_JOURNAL_INVALID_EVENT' ||
|
|
508
|
+
code === 'ACTIVITY_JOURNAL_INVALID_CURSOR' || error instanceof TypeError || error instanceof RangeError ? 400 : 500);
|
|
191
509
|
}
|
|
192
510
|
}
|
|
193
511
|
//# sourceMappingURL=workspace-api.js.map
|