@stackmemoryai/stackmemory 0.2.6 ā 0.2.8
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/README.md +262 -83
- package/dist/scripts/cancel-duplicate-tasks.d.ts +7 -0
- package/dist/scripts/cancel-duplicate-tasks.d.ts.map +1 -0
- package/dist/scripts/cancel-duplicate-tasks.js +172 -0
- package/dist/scripts/cancel-duplicate-tasks.js.map +1 -0
- package/dist/scripts/list-linear-tasks.d.ts +6 -0
- package/dist/scripts/list-linear-tasks.d.ts.map +1 -0
- package/dist/scripts/list-linear-tasks.js +121 -0
- package/dist/scripts/list-linear-tasks.js.map +1 -0
- package/dist/scripts/merge-linear-duplicates-safe.d.ts +7 -0
- package/dist/scripts/merge-linear-duplicates-safe.d.ts.map +1 -0
- package/dist/scripts/merge-linear-duplicates-safe.js +267 -0
- package/dist/scripts/merge-linear-duplicates-safe.js.map +1 -0
- package/dist/scripts/show-linear-summary.d.ts +6 -0
- package/dist/scripts/show-linear-summary.d.ts.map +1 -0
- package/dist/scripts/show-linear-summary.js +120 -0
- package/dist/scripts/show-linear-summary.js.map +1 -0
- package/dist/scripts/status.js +6 -2
- package/dist/scripts/status.js.map +1 -1
- package/dist/src/cli/auto-detect.d.ts +61 -0
- package/dist/src/cli/auto-detect.d.ts.map +1 -0
- package/dist/src/cli/auto-detect.js +350 -0
- package/dist/src/cli/auto-detect.js.map +1 -0
- package/dist/src/cli/claude-sm.d.ts +7 -0
- package/dist/src/cli/claude-sm.d.ts.map +1 -0
- package/dist/src/cli/claude-sm.js +357 -0
- package/dist/src/cli/claude-sm.js.map +1 -0
- package/dist/src/cli/commands/config.d.ts +6 -0
- package/dist/src/cli/commands/config.d.ts.map +1 -0
- package/dist/src/cli/commands/config.js +224 -0
- package/dist/src/cli/commands/config.js.map +1 -0
- package/dist/src/cli/commands/context.d.ts +7 -0
- package/dist/src/cli/commands/context.d.ts.map +1 -0
- package/dist/src/cli/commands/context.js +365 -0
- package/dist/src/cli/commands/context.js.map +1 -0
- package/dist/src/cli/commands/linear-test.d.ts +6 -0
- package/dist/src/cli/commands/linear-test.d.ts.map +1 -0
- package/dist/src/cli/commands/linear-test.js +123 -0
- package/dist/src/cli/commands/linear-test.js.map +1 -0
- package/dist/src/cli/commands/linear.d.ts +6 -0
- package/dist/src/cli/commands/linear.d.ts.map +1 -0
- package/dist/src/cli/commands/linear.js +393 -0
- package/dist/src/cli/commands/linear.js.map +1 -0
- package/dist/src/cli/commands/log.d.ts +7 -0
- package/dist/src/cli/commands/log.d.ts.map +1 -0
- package/dist/src/cli/commands/log.js +168 -0
- package/dist/src/cli/commands/log.js.map +1 -0
- package/dist/src/cli/commands/onboard.d.ts +8 -0
- package/dist/src/cli/commands/onboard.d.ts.map +1 -0
- package/dist/src/cli/commands/onboard.js +363 -0
- package/dist/src/cli/commands/onboard.js.map +1 -0
- package/dist/src/cli/commands/projects.js +1 -1
- package/dist/src/cli/commands/projects.js.map +1 -1
- package/dist/src/cli/commands/search.d.ts +7 -0
- package/dist/src/cli/commands/search.d.ts.map +1 -0
- package/dist/src/cli/commands/search.js +162 -0
- package/dist/src/cli/commands/search.js.map +1 -0
- package/dist/src/cli/commands/session.d.ts +7 -0
- package/dist/src/cli/commands/session.d.ts.map +1 -0
- package/dist/src/cli/commands/session.js +222 -0
- package/dist/src/cli/commands/session.js.map +1 -0
- package/dist/src/cli/commands/tasks.d.ts +7 -0
- package/dist/src/cli/commands/tasks.d.ts.map +1 -0
- package/dist/src/cli/commands/tasks.js +229 -0
- package/dist/src/cli/commands/tasks.js.map +1 -0
- package/dist/src/cli/commands/webhook.d.ts +3 -0
- package/dist/src/cli/commands/webhook.d.ts.map +1 -0
- package/dist/src/cli/commands/webhook.js +157 -0
- package/dist/src/cli/commands/webhook.js.map +1 -0
- package/dist/src/cli/commands/worktree.d.ts +8 -0
- package/dist/src/cli/commands/worktree.d.ts.map +1 -0
- package/dist/src/cli/commands/worktree.js +339 -0
- package/dist/src/cli/commands/worktree.js.map +1 -0
- package/dist/src/cli/index.d.ts +2 -1
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js +337 -50
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/utils/viewer.d.ts.map +1 -1
- package/dist/src/cli/utils/viewer.js +3 -1
- package/dist/src/cli/utils/viewer.js.map +1 -1
- package/dist/src/core/config/config-manager.d.ts +95 -0
- package/dist/src/core/config/config-manager.d.ts.map +1 -0
- package/dist/src/core/config/config-manager.js +359 -0
- package/dist/src/core/config/config-manager.js.map +1 -0
- package/dist/src/core/config/types.d.ts +72 -0
- package/dist/src/core/config/types.d.ts.map +1 -0
- package/dist/src/core/config/types.js +127 -0
- package/dist/src/core/config/types.js.map +1 -0
- package/dist/src/core/context/auto-context.d.ts +22 -0
- package/dist/src/core/context/auto-context.d.ts.map +1 -0
- package/dist/src/core/context/auto-context.js +77 -0
- package/dist/src/core/context/auto-context.js.map +1 -0
- package/dist/src/core/context/compaction-handler.d.ts +119 -0
- package/dist/src/core/context/compaction-handler.d.ts.map +1 -0
- package/dist/src/core/context/compaction-handler.js +306 -0
- package/dist/src/core/context/compaction-handler.js.map +1 -0
- package/dist/src/core/context/frame-manager.d.ts +4 -0
- package/dist/src/core/context/frame-manager.d.ts.map +1 -1
- package/dist/src/core/context/frame-manager.js +350 -144
- package/dist/src/core/context/frame-manager.js.map +1 -1
- package/dist/src/core/context/model-aware-compaction.d.ts +101 -0
- package/dist/src/core/context/model-aware-compaction.d.ts.map +1 -0
- package/dist/src/core/context/model-aware-compaction.js +616 -0
- package/dist/src/core/context/model-aware-compaction.js.map +1 -0
- package/dist/src/core/errors/index.d.ts +135 -0
- package/dist/src/core/errors/index.d.ts.map +1 -0
- package/dist/src/core/errors/index.js +274 -0
- package/dist/src/core/errors/index.js.map +1 -0
- package/dist/src/core/errors/recovery.d.ts +86 -0
- package/dist/src/core/errors/recovery.d.ts.map +1 -0
- package/dist/src/core/errors/recovery.js +274 -0
- package/dist/src/core/errors/recovery.js.map +1 -0
- package/dist/src/core/projects/project-manager.d.ts.map +1 -1
- package/dist/src/core/projects/project-manager.js +240 -122
- package/dist/src/core/projects/project-manager.js.map +1 -1
- package/dist/src/core/query/query-parser.d.ts +104 -0
- package/dist/src/core/query/query-parser.d.ts.map +1 -0
- package/dist/src/core/query/query-parser.js +347 -0
- package/dist/src/core/query/query-parser.js.map +1 -0
- package/dist/src/core/retrieval/index.d.ts +8 -0
- package/dist/src/core/retrieval/index.d.ts.map +1 -0
- package/dist/src/core/retrieval/index.js +8 -0
- package/dist/src/core/retrieval/index.js.map +1 -0
- package/dist/src/core/retrieval/llm-context-retrieval.d.ts +71 -0
- package/dist/src/core/retrieval/llm-context-retrieval.d.ts.map +1 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js +545 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js.map +1 -0
- package/dist/src/core/retrieval/summary-generator.d.ts +63 -0
- package/dist/src/core/retrieval/summary-generator.d.ts.map +1 -0
- package/dist/src/core/retrieval/summary-generator.js +622 -0
- package/dist/src/core/retrieval/summary-generator.js.map +1 -0
- package/dist/src/core/retrieval/types.d.ts +257 -0
- package/dist/src/core/retrieval/types.d.ts.map +1 -0
- package/dist/src/core/retrieval/types.js +18 -0
- package/dist/src/core/retrieval/types.js.map +1 -0
- package/dist/src/core/session/index.d.ts +2 -0
- package/dist/src/core/session/index.d.ts.map +1 -0
- package/dist/src/core/session/index.js +2 -0
- package/dist/src/core/session/index.js.map +1 -0
- package/dist/src/core/session/session-manager.d.ts +69 -0
- package/dist/src/core/session/session-manager.d.ts.map +1 -0
- package/dist/src/core/session/session-manager.js +311 -0
- package/dist/src/core/session/session-manager.js.map +1 -0
- package/dist/src/core/trace/trace-detector.d.ts +108 -0
- package/dist/src/core/trace/trace-detector.d.ts.map +1 -0
- package/dist/src/core/trace/trace-detector.demo.d.ts +5 -0
- package/dist/src/core/trace/trace-detector.demo.d.ts.map +1 -0
- package/dist/src/core/trace/trace-detector.demo.js +145 -0
- package/dist/src/core/trace/trace-detector.demo.js.map +1 -0
- package/dist/src/core/trace/trace-detector.js +425 -0
- package/dist/src/core/trace/trace-detector.js.map +1 -0
- package/dist/src/core/trace/trace-store.d.ts +60 -0
- package/dist/src/core/trace/trace-store.d.ts.map +1 -0
- package/dist/src/core/trace/trace-store.js +323 -0
- package/dist/src/core/trace/trace-store.js.map +1 -0
- package/dist/src/core/trace/types.d.ts +81 -0
- package/dist/src/core/trace/types.d.ts.map +1 -0
- package/dist/src/core/trace/types.js +70 -0
- package/dist/src/core/trace/types.js.map +1 -0
- package/dist/src/core/utils/update-checker.d.ts.map +1 -1
- package/dist/src/core/utils/update-checker.js +82 -25
- package/dist/src/core/utils/update-checker.js.map +1 -1
- package/dist/src/core/worktree/worktree-manager.d.ts +110 -0
- package/dist/src/core/worktree/worktree-manager.d.ts.map +1 -0
- package/dist/src/core/worktree/worktree-manager.js +456 -0
- package/dist/src/core/worktree/worktree-manager.js.map +1 -0
- package/dist/src/features/analytics/core/analytics-service.d.ts +6 -0
- package/dist/src/features/analytics/core/analytics-service.d.ts.map +1 -1
- package/dist/src/features/analytics/core/analytics-service.js +125 -10
- package/dist/src/features/analytics/core/analytics-service.js.map +1 -1
- package/dist/src/features/analytics/queries/metrics-queries.d.ts.map +1 -1
- package/dist/src/features/analytics/queries/metrics-queries.js +220 -163
- package/dist/src/features/analytics/queries/metrics-queries.js.map +1 -1
- package/dist/src/features/browser/browser-mcp.d.ts.map +1 -1
- package/dist/src/features/browser/browser-mcp.js +3 -0
- package/dist/src/features/browser/browser-mcp.js.map +1 -1
- package/dist/src/features/tasks/pebbles-task-store.d.ts +4 -0
- package/dist/src/features/tasks/pebbles-task-store.d.ts.map +1 -1
- package/dist/src/features/tasks/pebbles-task-store.js +299 -141
- package/dist/src/features/tasks/pebbles-task-store.js.map +1 -1
- package/dist/src/integrations/linear/client.d.ts +28 -1
- package/dist/src/integrations/linear/client.d.ts.map +1 -1
- package/dist/src/integrations/linear/client.js +87 -0
- package/dist/src/integrations/linear/client.js.map +1 -1
- package/dist/src/integrations/linear/sync-manager.d.ts +76 -0
- package/dist/src/integrations/linear/sync-manager.d.ts.map +1 -0
- package/dist/src/integrations/linear/sync-manager.js +223 -0
- package/dist/src/integrations/linear/sync-manager.js.map +1 -0
- package/dist/src/integrations/linear/sync-service.d.ts +25 -0
- package/dist/src/integrations/linear/sync-service.d.ts.map +1 -0
- package/dist/src/integrations/linear/sync-service.js +198 -0
- package/dist/src/integrations/linear/sync-service.js.map +1 -0
- package/dist/src/integrations/linear/sync.d.ts +23 -1
- package/dist/src/integrations/linear/sync.d.ts.map +1 -1
- package/dist/src/integrations/linear/sync.js +156 -9
- package/dist/src/integrations/linear/sync.js.map +1 -1
- package/dist/src/integrations/linear/types.d.ts +75 -0
- package/dist/src/integrations/linear/types.d.ts.map +1 -0
- package/dist/src/integrations/linear/types.js +2 -0
- package/dist/src/integrations/linear/types.js.map +1 -0
- package/dist/src/integrations/linear/webhook-server.d.ts +32 -0
- package/dist/src/integrations/linear/webhook-server.d.ts.map +1 -0
- package/dist/src/integrations/linear/webhook-server.js +188 -0
- package/dist/src/integrations/linear/webhook-server.js.map +1 -0
- package/dist/src/integrations/linear/webhook.d.ts +95 -0
- package/dist/src/integrations/linear/webhook.d.ts.map +1 -0
- package/dist/src/integrations/linear/webhook.js +204 -0
- package/dist/src/integrations/linear/webhook.js.map +1 -0
- package/dist/src/integrations/mcp/server.d.ts +14 -0
- package/dist/src/integrations/mcp/server.d.ts.map +1 -1
- package/dist/src/integrations/mcp/server.js +849 -61
- package/dist/src/integrations/mcp/server.js.map +1 -1
- package/dist/src/integrations/mcp/trace-test.d.ts +5 -0
- package/dist/src/integrations/mcp/trace-test.d.ts.map +1 -0
- package/dist/src/integrations/mcp/trace-test.js +54 -0
- package/dist/src/integrations/mcp/trace-test.js.map +1 -0
- package/dist/src/servers/production/auth-middleware.d.ts +2 -2
- package/dist/src/servers/production/auth-middleware.d.ts.map +1 -1
- package/dist/src/servers/production/auth-middleware.js +1 -1
- package/dist/src/servers/production/auth-middleware.js.map +1 -1
- package/dist/src/services/config-service.d.ts +44 -0
- package/dist/src/services/config-service.d.ts.map +1 -0
- package/dist/src/services/config-service.js +61 -0
- package/dist/src/services/config-service.js.map +1 -0
- package/dist/src/services/context-service.d.ts +17 -0
- package/dist/src/services/context-service.d.ts.map +1 -0
- package/dist/src/services/context-service.js +88 -0
- package/dist/src/services/context-service.js.map +1 -0
- package/dist/src/types/task.d.ts +27 -0
- package/dist/src/types/task.d.ts.map +1 -0
- package/dist/src/types/task.js +2 -0
- package/dist/src/types/task.js.map +1 -0
- package/dist/src/utils/logger.d.ts +13 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +52 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/package.json +24 -10
- package/dist/attention-scoring/src/attention-tracker.d.ts +0 -79
- package/dist/attention-scoring/src/attention-tracker.d.ts.map +0 -1
- package/dist/attention-scoring/src/attention-tracker.js +0 -488
- package/dist/attention-scoring/src/attention-tracker.js.map +0 -1
- package/dist/attention-scoring/src/mcp-integration.d.ts +0 -56
- package/dist/attention-scoring/src/mcp-integration.d.ts.map +0 -1
- package/dist/attention-scoring/src/mcp-integration.js +0 -369
- package/dist/attention-scoring/src/mcp-integration.js.map +0 -1
- package/dist/index.js +0 -382
- package/dist/p2p-sync/src/p2p-sync.d.ts +0 -81
- package/dist/p2p-sync/src/p2p-sync.d.ts.map +0 -1
- package/dist/p2p-sync/src/p2p-sync.js +0 -457
- package/dist/p2p-sync/src/p2p-sync.js.map +0 -1
- package/dist/p2p-sync/src/team-context-sync.d.ts +0 -99
- package/dist/p2p-sync/src/team-context-sync.d.ts.map +0 -1
- package/dist/p2p-sync/src/team-context-sync.js +0 -491
- package/dist/p2p-sync/src/team-context-sync.js.map +0 -1
- package/dist/src/analytics/api/analytics-api.d.ts +0 -24
- package/dist/src/analytics/api/analytics-api.d.ts.map +0 -1
- package/dist/src/analytics/api/analytics-api.js +0 -279
- package/dist/src/analytics/api/analytics-api.js.map +0 -1
- package/dist/src/analytics/core/analytics-service.d.ts +0 -23
- package/dist/src/analytics/core/analytics-service.d.ts.map +0 -1
- package/dist/src/analytics/core/analytics-service.js +0 -160
- package/dist/src/analytics/core/analytics-service.js.map +0 -1
- package/dist/src/analytics/index.d.ts +0 -12
- package/dist/src/analytics/index.d.ts.map +0 -1
- package/dist/src/analytics/index.js +0 -11
- package/dist/src/analytics/index.js.map +0 -1
- package/dist/src/analytics/queries/metrics-queries.d.ts +0 -11
- package/dist/src/analytics/queries/metrics-queries.d.ts.map +0 -1
- package/dist/src/analytics/queries/metrics-queries.js +0 -179
- package/dist/src/analytics/queries/metrics-queries.js.map +0 -1
- package/dist/src/analytics/types/metrics.d.ts +0 -60
- package/dist/src/analytics/types/metrics.d.ts.map +0 -1
- package/dist/src/analytics/types/metrics.js +0 -2
- package/dist/src/analytics/types/metrics.js.map +0 -1
- package/dist/src/beads/beads-task-store.d.ts +0 -117
- package/dist/src/beads/beads-task-store.d.ts.map +0 -1
- package/dist/src/beads/beads-task-store.js +0 -318
- package/dist/src/beads/beads-task-store.js.map +0 -1
- package/dist/src/beads/task-aware-context.d.ts +0 -103
- package/dist/src/beads/task-aware-context.d.ts.map +0 -1
- package/dist/src/beads/task-aware-context.js +0 -395
- package/dist/src/beads/task-aware-context.js.map +0 -1
- package/dist/src/beads-task-store.d.ts +0 -117
- package/dist/src/beads-task-store.d.ts.map +0 -1
- package/dist/src/beads-task-store.js +0 -318
- package/dist/src/beads-task-store.js.map +0 -1
- package/dist/src/cli/analytics-viewer.d.ts +0 -3
- package/dist/src/cli/analytics-viewer.d.ts.map +0 -1
- package/dist/src/cli/analytics-viewer.js +0 -89
- package/dist/src/cli/analytics-viewer.js.map +0 -1
- package/dist/src/cli/cli.d.ts +0 -7
- package/dist/src/cli/cli.d.ts.map +0 -1
- package/dist/src/cli/cli.js +0 -704
- package/dist/src/cli/cli.js.map +0 -1
- package/dist/src/cli/project-commands.d.ts +0 -8
- package/dist/src/cli/project-commands.d.ts.map +0 -1
- package/dist/src/cli/project-commands.js +0 -212
- package/dist/src/cli/project-commands.js.map +0 -1
- package/dist/src/cli.d.ts +0 -7
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js +0 -73
- package/dist/src/cli.js.map +0 -1
- package/dist/src/core/error-handler.d.ts +0 -46
- package/dist/src/core/error-handler.d.ts.map +0 -1
- package/dist/src/core/error-handler.js +0 -212
- package/dist/src/core/error-handler.js.map +0 -1
- package/dist/src/core/frame-manager.d.ts +0 -106
- package/dist/src/core/frame-manager.d.ts.map +0 -1
- package/dist/src/core/frame-manager.js +0 -387
- package/dist/src/core/frame-manager.js.map +0 -1
- package/dist/src/core/logger.d.ts +0 -24
- package/dist/src/core/logger.d.ts.map +0 -1
- package/dist/src/core/logger.js +0 -121
- package/dist/src/core/logger.js.map +0 -1
- package/dist/src/core/logger.test.d.ts +0 -2
- package/dist/src/core/logger.test.d.ts.map +0 -1
- package/dist/src/core/logger.test.js +0 -31
- package/dist/src/core/logger.test.js.map +0 -1
- package/dist/src/core/progress-tracker.d.ts +0 -95
- package/dist/src/core/progress-tracker.d.ts.map +0 -1
- package/dist/src/core/progress-tracker.js +0 -178
- package/dist/src/core/progress-tracker.js.map +0 -1
- package/dist/src/core/project-manager.d.ts +0 -130
- package/dist/src/core/project-manager.d.ts.map +0 -1
- package/dist/src/core/project-manager.js +0 -582
- package/dist/src/core/project-manager.js.map +0 -1
- package/dist/src/core/update-checker.d.ts +0 -38
- package/dist/src/core/update-checker.d.ts.map +0 -1
- package/dist/src/core/update-checker.js +0 -156
- package/dist/src/core/update-checker.js.map +0 -1
- package/dist/src/error-handler.d.ts +0 -42
- package/dist/src/error-handler.d.ts.map +0 -1
- package/dist/src/error-handler.js +0 -155
- package/dist/src/error-handler.js.map +0 -1
- package/dist/src/frame-manager.d.ts +0 -106
- package/dist/src/frame-manager.d.ts.map +0 -1
- package/dist/src/frame-manager.js +0 -361
- package/dist/src/frame-manager.js.map +0 -1
- package/dist/src/integrations/browser-mcp.d.ts +0 -94
- package/dist/src/integrations/browser-mcp.d.ts.map +0 -1
- package/dist/src/integrations/browser-mcp.js +0 -431
- package/dist/src/integrations/browser-mcp.js.map +0 -1
- package/dist/src/integrations/linear-auth.d.ts +0 -99
- package/dist/src/integrations/linear-auth.d.ts.map +0 -1
- package/dist/src/integrations/linear-auth.js +0 -319
- package/dist/src/integrations/linear-auth.js.map +0 -1
- package/dist/src/integrations/linear-auto-sync.d.ts +0 -77
- package/dist/src/integrations/linear-auto-sync.d.ts.map +0 -1
- package/dist/src/integrations/linear-auto-sync.js +0 -268
- package/dist/src/integrations/linear-auto-sync.js.map +0 -1
- package/dist/src/integrations/linear-client.d.ts +0 -86
- package/dist/src/integrations/linear-client.d.ts.map +0 -1
- package/dist/src/integrations/linear-client.js +0 -277
- package/dist/src/integrations/linear-client.js.map +0 -1
- package/dist/src/integrations/linear-config.d.ts +0 -51
- package/dist/src/integrations/linear-config.d.ts.map +0 -1
- package/dist/src/integrations/linear-config.js +0 -103
- package/dist/src/integrations/linear-config.js.map +0 -1
- package/dist/src/integrations/linear-sync.d.ts +0 -97
- package/dist/src/integrations/linear-sync.d.ts.map +0 -1
- package/dist/src/integrations/linear-sync.js +0 -391
- package/dist/src/integrations/linear-sync.js.map +0 -1
- package/dist/src/logger.d.ts +0 -24
- package/dist/src/logger.d.ts.map +0 -1
- package/dist/src/logger.js +0 -120
- package/dist/src/logger.js.map +0 -1
- package/dist/src/mcp/mcp-server.d.ts +0 -40
- package/dist/src/mcp/mcp-server.d.ts.map +0 -1
- package/dist/src/mcp/mcp-server.js +0 -828
- package/dist/src/mcp/mcp-server.js.map +0 -1
- package/dist/src/mcp-server.d.ts +0 -32
- package/dist/src/mcp-server.d.ts.map +0 -1
- package/dist/src/mcp-server.js +0 -441
- package/dist/src/mcp-server.js.map +0 -1
- package/dist/src/pebbles/pebbles-task-store.d.ts +0 -117
- package/dist/src/pebbles/pebbles-task-store.d.ts.map +0 -1
- package/dist/src/pebbles/pebbles-task-store.js +0 -335
- package/dist/src/pebbles/pebbles-task-store.js.map +0 -1
- package/dist/src/pebbles/task-aware-context.d.ts +0 -103
- package/dist/src/pebbles/task-aware-context.d.ts.map +0 -1
- package/dist/src/pebbles/task-aware-context.js +0 -412
- package/dist/src/pebbles/task-aware-context.js.map +0 -1
- package/dist/src/railway/index.d.ts +0 -7
- package/dist/src/railway/index.d.ts.map +0 -1
- package/dist/src/railway/index.js +0 -401
- package/dist/src/railway/index.js.map +0 -1
- package/dist/src/runway/auth/auth-middleware.d.ts +0 -66
- package/dist/src/runway/auth/auth-middleware.d.ts.map +0 -1
- package/dist/src/runway/auth/auth-middleware.js +0 -337
- package/dist/src/runway/auth/auth-middleware.js.map +0 -1
- package/dist/src/runway/server/runway-mcp-server.d.ts +0 -46
- package/dist/src/runway/server/runway-mcp-server.d.ts.map +0 -1
- package/dist/src/runway/server/runway-mcp-server.js +0 -601
- package/dist/src/runway/server/runway-mcp-server.js.map +0 -1
- package/dist/src/runway.bak/auth/auth-middleware.d.ts +0 -66
- package/dist/src/runway.bak/auth/auth-middleware.d.ts.map +0 -1
- package/dist/src/runway.bak/auth/auth-middleware.js +0 -337
- package/dist/src/runway.bak/auth/auth-middleware.js.map +0 -1
- package/dist/src/runway.bak/server/runway-mcp-server.d.ts +0 -46
- package/dist/src/runway.bak/server/runway-mcp-server.d.ts.map +0 -1
- package/dist/src/runway.bak/server/runway-mcp-server.js +0 -601
- package/dist/src/runway.bak/server/runway-mcp-server.js.map +0 -1
- package/dist/src/task-aware-context.d.ts +0 -103
- package/dist/src/task-aware-context.d.ts.map +0 -1
- package/dist/src/task-aware-context.js +0 -395
- package/dist/src/task-aware-context.js.map +0 -1
|
@@ -12,11 +12,13 @@ import { join, dirname } from 'path';
|
|
|
12
12
|
import { execSync } from 'child_process';
|
|
13
13
|
import { FrameManager } from '../../core/context/frame-manager.js';
|
|
14
14
|
import { PebblesTaskStore, } from '../../features/tasks/pebbles-task-store.js';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// import { LinearSyncEngine, DEFAULT_SYNC_CONFIG } from '../integrations/linear/sync.js';
|
|
15
|
+
import { LinearAuthManager } from '../linear/auth.js';
|
|
16
|
+
import { LinearSyncEngine, DEFAULT_SYNC_CONFIG } from '../linear/sync.js';
|
|
18
17
|
import { logger } from '../../core/monitoring/logger.js';
|
|
19
18
|
import { BrowserMCPIntegration } from '../../features/browser/browser-mcp.js';
|
|
19
|
+
import { TraceDetector } from '../../core/trace/trace-detector.js';
|
|
20
|
+
import { LLMContextRetrieval } from '../../core/retrieval/index.js';
|
|
21
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
20
22
|
// ============================================
|
|
21
23
|
// Simple Local MCP Server
|
|
22
24
|
// ============================================
|
|
@@ -26,12 +28,13 @@ class LocalStackMemoryMCP {
|
|
|
26
28
|
projectRoot;
|
|
27
29
|
frameManager;
|
|
28
30
|
taskStore;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// private linearSync: LinearSyncEngine;
|
|
31
|
+
linearAuthManager;
|
|
32
|
+
linearSync;
|
|
32
33
|
projectId;
|
|
33
34
|
contexts = new Map();
|
|
34
35
|
browserMCP;
|
|
36
|
+
traceDetector;
|
|
37
|
+
contextRetrieval;
|
|
35
38
|
constructor() {
|
|
36
39
|
// Find project root (where .git is)
|
|
37
40
|
this.projectRoot = this.findProjectRoot();
|
|
@@ -49,13 +52,9 @@ class LocalStackMemoryMCP {
|
|
|
49
52
|
this.frameManager = new FrameManager(this.db, this.projectId);
|
|
50
53
|
// Initialize task store
|
|
51
54
|
this.taskStore = new PebblesTaskStore(this.projectRoot, this.db);
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// this.taskStore,
|
|
56
|
-
// this.linearAuthManager,
|
|
57
|
-
// DEFAULT_SYNC_CONFIG
|
|
58
|
-
// );
|
|
55
|
+
// Initialize Linear integration
|
|
56
|
+
this.linearAuthManager = new LinearAuthManager(this.projectRoot);
|
|
57
|
+
this.linearSync = new LinearSyncEngine(this.taskStore, this.linearAuthManager, DEFAULT_SYNC_CONFIG);
|
|
59
58
|
// Initialize MCP server
|
|
60
59
|
this.server = new Server({
|
|
61
60
|
name: 'stackmemory-local',
|
|
@@ -70,6 +69,10 @@ class LocalStackMemoryMCP {
|
|
|
70
69
|
headless: process.env.BROWSER_HEADLESS !== 'false',
|
|
71
70
|
defaultViewport: { width: 1280, height: 720 },
|
|
72
71
|
});
|
|
72
|
+
// Initialize Trace Detector with database persistence
|
|
73
|
+
this.traceDetector = new TraceDetector({}, undefined, this.db);
|
|
74
|
+
// Initialize LLM Context Retrieval
|
|
75
|
+
this.contextRetrieval = new LLMContextRetrieval(this.db, this.frameManager, this.projectId);
|
|
73
76
|
this.setupHandlers();
|
|
74
77
|
this.loadInitialContext();
|
|
75
78
|
// Initialize Browser MCP with this server
|
|
@@ -92,6 +95,8 @@ class LocalStackMemoryMCP {
|
|
|
92
95
|
return process.cwd();
|
|
93
96
|
}
|
|
94
97
|
initDB() {
|
|
98
|
+
// Note: Don't create frames table here - FrameManager handles the schema
|
|
99
|
+
// with the full run_id, project_id, parent_frame_id columns
|
|
95
100
|
this.db.exec(`
|
|
96
101
|
CREATE TABLE IF NOT EXISTS contexts (
|
|
97
102
|
id TEXT PRIMARY KEY,
|
|
@@ -103,13 +108,6 @@ class LocalStackMemoryMCP {
|
|
|
103
108
|
access_count INTEGER DEFAULT 1
|
|
104
109
|
);
|
|
105
110
|
|
|
106
|
-
CREATE TABLE IF NOT EXISTS frames (
|
|
107
|
-
frame_id TEXT PRIMARY KEY,
|
|
108
|
-
task TEXT NOT NULL,
|
|
109
|
-
status TEXT DEFAULT 'active',
|
|
110
|
-
created_at INTEGER DEFAULT (unixepoch())
|
|
111
|
-
);
|
|
112
|
-
|
|
113
111
|
CREATE TABLE IF NOT EXISTS attention_log (
|
|
114
112
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
115
113
|
context_id TEXT,
|
|
@@ -388,7 +386,7 @@ class LocalStackMemoryMCP {
|
|
|
388
386
|
},
|
|
389
387
|
{
|
|
390
388
|
name: 'get_active_tasks',
|
|
391
|
-
description: 'Get currently active tasks',
|
|
389
|
+
description: 'Get currently active tasks synced from Linear',
|
|
392
390
|
inputSchema: {
|
|
393
391
|
type: 'object',
|
|
394
392
|
properties: {
|
|
@@ -396,6 +394,30 @@ class LocalStackMemoryMCP {
|
|
|
396
394
|
type: 'string',
|
|
397
395
|
description: 'Filter by specific frame ID',
|
|
398
396
|
},
|
|
397
|
+
status: {
|
|
398
|
+
type: 'string',
|
|
399
|
+
enum: [
|
|
400
|
+
'pending',
|
|
401
|
+
'in_progress',
|
|
402
|
+
'completed',
|
|
403
|
+
'blocked',
|
|
404
|
+
'cancelled',
|
|
405
|
+
],
|
|
406
|
+
description: 'Filter by status',
|
|
407
|
+
},
|
|
408
|
+
priority: {
|
|
409
|
+
type: 'string',
|
|
410
|
+
enum: ['low', 'medium', 'high', 'urgent'],
|
|
411
|
+
description: 'Filter by priority',
|
|
412
|
+
},
|
|
413
|
+
search: {
|
|
414
|
+
type: 'string',
|
|
415
|
+
description: 'Search in task title or description',
|
|
416
|
+
},
|
|
417
|
+
limit: {
|
|
418
|
+
type: 'number',
|
|
419
|
+
description: 'Max number of tasks to return (default: 20)',
|
|
420
|
+
},
|
|
399
421
|
},
|
|
400
422
|
},
|
|
401
423
|
},
|
|
@@ -425,6 +447,175 @@ class LocalStackMemoryMCP {
|
|
|
425
447
|
required: ['taskId', 'dependsOnId'],
|
|
426
448
|
},
|
|
427
449
|
},
|
|
450
|
+
{
|
|
451
|
+
name: 'linear_sync',
|
|
452
|
+
description: 'Sync tasks with Linear',
|
|
453
|
+
inputSchema: {
|
|
454
|
+
type: 'object',
|
|
455
|
+
properties: {
|
|
456
|
+
direction: {
|
|
457
|
+
type: 'string',
|
|
458
|
+
enum: ['bidirectional', 'to_linear', 'from_linear'],
|
|
459
|
+
description: 'Sync direction',
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: 'linear_update_task',
|
|
466
|
+
description: 'Update a Linear task status',
|
|
467
|
+
inputSchema: {
|
|
468
|
+
type: 'object',
|
|
469
|
+
properties: {
|
|
470
|
+
issueId: {
|
|
471
|
+
type: 'string',
|
|
472
|
+
description: 'Linear issue ID or identifier (e.g., STA-34)',
|
|
473
|
+
},
|
|
474
|
+
status: {
|
|
475
|
+
type: 'string',
|
|
476
|
+
enum: ['todo', 'in-progress', 'done', 'canceled'],
|
|
477
|
+
description: 'New status for the task',
|
|
478
|
+
},
|
|
479
|
+
title: {
|
|
480
|
+
type: 'string',
|
|
481
|
+
description: 'Update task title (optional)',
|
|
482
|
+
},
|
|
483
|
+
description: {
|
|
484
|
+
type: 'string',
|
|
485
|
+
description: 'Update task description (optional)',
|
|
486
|
+
},
|
|
487
|
+
priority: {
|
|
488
|
+
type: 'number',
|
|
489
|
+
enum: [1, 2, 3, 4],
|
|
490
|
+
description: 'Priority (1=urgent, 2=high, 3=medium, 4=low)',
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
required: ['issueId'],
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
name: 'linear_get_tasks',
|
|
498
|
+
description: 'Get Linear tasks',
|
|
499
|
+
inputSchema: {
|
|
500
|
+
type: 'object',
|
|
501
|
+
properties: {
|
|
502
|
+
status: {
|
|
503
|
+
type: 'string',
|
|
504
|
+
enum: ['todo', 'in-progress', 'done', 'all'],
|
|
505
|
+
description: 'Filter by status',
|
|
506
|
+
},
|
|
507
|
+
limit: {
|
|
508
|
+
type: 'number',
|
|
509
|
+
description: 'Maximum number of tasks to return',
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
name: 'linear_status',
|
|
516
|
+
description: 'Get Linear integration status',
|
|
517
|
+
inputSchema: {
|
|
518
|
+
type: 'object',
|
|
519
|
+
properties: {},
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: 'get_traces',
|
|
524
|
+
description: 'Get detected traces (bundled tool call sequences)',
|
|
525
|
+
inputSchema: {
|
|
526
|
+
type: 'object',
|
|
527
|
+
properties: {
|
|
528
|
+
type: {
|
|
529
|
+
type: 'string',
|
|
530
|
+
enum: [
|
|
531
|
+
'search_driven',
|
|
532
|
+
'error_recovery',
|
|
533
|
+
'feature_implementation',
|
|
534
|
+
'refactoring',
|
|
535
|
+
'testing',
|
|
536
|
+
'exploration',
|
|
537
|
+
'debugging',
|
|
538
|
+
'documentation',
|
|
539
|
+
'build_deploy',
|
|
540
|
+
'unknown',
|
|
541
|
+
],
|
|
542
|
+
description: 'Filter by trace type',
|
|
543
|
+
},
|
|
544
|
+
minScore: {
|
|
545
|
+
type: 'number',
|
|
546
|
+
description: 'Minimum importance score (0-1)',
|
|
547
|
+
},
|
|
548
|
+
limit: {
|
|
549
|
+
type: 'number',
|
|
550
|
+
description: 'Maximum number of traces to return',
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: 'get_trace_statistics',
|
|
557
|
+
description: 'Get statistics about detected traces',
|
|
558
|
+
inputSchema: {
|
|
559
|
+
type: 'object',
|
|
560
|
+
properties: {},
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
name: 'flush_traces',
|
|
565
|
+
description: 'Flush any pending trace and finalize detection',
|
|
566
|
+
inputSchema: {
|
|
567
|
+
type: 'object',
|
|
568
|
+
properties: {},
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
name: 'compress_old_traces',
|
|
573
|
+
description: 'Compress traces older than specified hours',
|
|
574
|
+
inputSchema: {
|
|
575
|
+
type: 'object',
|
|
576
|
+
properties: {
|
|
577
|
+
ageHours: {
|
|
578
|
+
type: 'number',
|
|
579
|
+
description: 'Age threshold in hours (default: 24)',
|
|
580
|
+
},
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
name: 'smart_context',
|
|
586
|
+
description: 'LLM-driven context retrieval - intelligently selects relevant frames based on query',
|
|
587
|
+
inputSchema: {
|
|
588
|
+
type: 'object',
|
|
589
|
+
properties: {
|
|
590
|
+
query: {
|
|
591
|
+
type: 'string',
|
|
592
|
+
description: 'Natural language query describing what context you need',
|
|
593
|
+
},
|
|
594
|
+
tokenBudget: {
|
|
595
|
+
type: 'number',
|
|
596
|
+
description: 'Maximum tokens to use for context (default: 4000)',
|
|
597
|
+
},
|
|
598
|
+
forceRefresh: {
|
|
599
|
+
type: 'boolean',
|
|
600
|
+
description: 'Force refresh of cached summaries',
|
|
601
|
+
},
|
|
602
|
+
},
|
|
603
|
+
required: ['query'],
|
|
604
|
+
},
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
name: 'get_summary',
|
|
608
|
+
description: 'Get compressed summary of project memory for analysis',
|
|
609
|
+
inputSchema: {
|
|
610
|
+
type: 'object',
|
|
611
|
+
properties: {
|
|
612
|
+
forceRefresh: {
|
|
613
|
+
type: 'boolean',
|
|
614
|
+
description: 'Force refresh of cached summary',
|
|
615
|
+
},
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
},
|
|
428
619
|
],
|
|
429
620
|
};
|
|
430
621
|
});
|
|
@@ -437,32 +628,132 @@ class LocalStackMemoryMCP {
|
|
|
437
628
|
}),
|
|
438
629
|
}), async (request) => {
|
|
439
630
|
const { name, arguments: args } = request.params;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
return this.handleAddAnchor(args);
|
|
451
|
-
case 'get_hot_stack':
|
|
452
|
-
return this.handleGetHotStack(args);
|
|
453
|
-
case 'create_task':
|
|
454
|
-
return this.handleCreateTask(args);
|
|
455
|
-
case 'update_task_status':
|
|
456
|
-
return this.handleUpdateTaskStatus(args);
|
|
457
|
-
case 'get_active_tasks':
|
|
458
|
-
return this.handleGetActiveTasks(args);
|
|
459
|
-
case 'get_task_metrics':
|
|
460
|
-
return this.handleGetTaskMetrics(args);
|
|
461
|
-
case 'add_task_dependency':
|
|
462
|
-
return this.handleAddTaskDependency(args);
|
|
463
|
-
default:
|
|
464
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
631
|
+
const callId = uuidv4();
|
|
632
|
+
const startTime = Date.now();
|
|
633
|
+
// Log tool call event before execution
|
|
634
|
+
const currentFrameId = this.frameManager.getCurrentFrameId();
|
|
635
|
+
if (currentFrameId) {
|
|
636
|
+
this.frameManager.addEvent('tool_call', {
|
|
637
|
+
tool_name: name,
|
|
638
|
+
arguments: args,
|
|
639
|
+
timestamp: startTime,
|
|
640
|
+
});
|
|
465
641
|
}
|
|
642
|
+
// Create ToolCall for trace detection
|
|
643
|
+
const toolCall = {
|
|
644
|
+
id: callId,
|
|
645
|
+
tool: name,
|
|
646
|
+
arguments: args,
|
|
647
|
+
timestamp: startTime,
|
|
648
|
+
};
|
|
649
|
+
let result;
|
|
650
|
+
let error;
|
|
651
|
+
try {
|
|
652
|
+
switch (name) {
|
|
653
|
+
case 'get_context':
|
|
654
|
+
result = await this.handleGetContext(args);
|
|
655
|
+
break;
|
|
656
|
+
case 'add_decision':
|
|
657
|
+
result = await this.handleAddDecision(args);
|
|
658
|
+
break;
|
|
659
|
+
case 'start_frame':
|
|
660
|
+
result = await this.handleStartFrame(args);
|
|
661
|
+
break;
|
|
662
|
+
case 'close_frame':
|
|
663
|
+
result = await this.handleCloseFrame(args);
|
|
664
|
+
break;
|
|
665
|
+
case 'add_anchor':
|
|
666
|
+
result = await this.handleAddAnchor(args);
|
|
667
|
+
break;
|
|
668
|
+
case 'get_hot_stack':
|
|
669
|
+
result = await this.handleGetHotStack(args);
|
|
670
|
+
break;
|
|
671
|
+
case 'create_task':
|
|
672
|
+
result = await this.handleCreateTask(args);
|
|
673
|
+
break;
|
|
674
|
+
case 'update_task_status':
|
|
675
|
+
result = await this.handleUpdateTaskStatus(args);
|
|
676
|
+
break;
|
|
677
|
+
case 'get_active_tasks':
|
|
678
|
+
result = await this.handleGetActiveTasks(args);
|
|
679
|
+
break;
|
|
680
|
+
case 'get_task_metrics':
|
|
681
|
+
result = await this.handleGetTaskMetrics(args);
|
|
682
|
+
break;
|
|
683
|
+
case 'add_task_dependency':
|
|
684
|
+
result = await this.handleAddTaskDependency(args);
|
|
685
|
+
break;
|
|
686
|
+
case 'linear_sync':
|
|
687
|
+
result = await this.handleLinearSync(args);
|
|
688
|
+
break;
|
|
689
|
+
case 'linear_update_task':
|
|
690
|
+
result = await this.handleLinearUpdateTask(args);
|
|
691
|
+
break;
|
|
692
|
+
case 'linear_get_tasks':
|
|
693
|
+
result = await this.handleLinearGetTasks(args);
|
|
694
|
+
break;
|
|
695
|
+
case 'linear_status':
|
|
696
|
+
result = await this.handleLinearStatus(args);
|
|
697
|
+
break;
|
|
698
|
+
case 'get_traces':
|
|
699
|
+
result = await this.handleGetTraces(args);
|
|
700
|
+
break;
|
|
701
|
+
case 'get_trace_statistics':
|
|
702
|
+
result = await this.handleGetTraceStatistics(args);
|
|
703
|
+
break;
|
|
704
|
+
case 'flush_traces':
|
|
705
|
+
result = await this.handleFlushTraces(args);
|
|
706
|
+
break;
|
|
707
|
+
case 'compress_old_traces':
|
|
708
|
+
result = await this.handleCompressOldTraces(args);
|
|
709
|
+
break;
|
|
710
|
+
case 'smart_context':
|
|
711
|
+
result = await this.handleSmartContext(args);
|
|
712
|
+
break;
|
|
713
|
+
case 'get_summary':
|
|
714
|
+
result = await this.handleGetSummary(args);
|
|
715
|
+
break;
|
|
716
|
+
default:
|
|
717
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
catch (err) {
|
|
721
|
+
error = err;
|
|
722
|
+
toolCall.error = err.message || String(err);
|
|
723
|
+
throw err;
|
|
724
|
+
}
|
|
725
|
+
finally {
|
|
726
|
+
const endTime = Date.now();
|
|
727
|
+
// Log tool result event after execution (success or failure)
|
|
728
|
+
// Skip for close_frame since the frame no longer exists after closing
|
|
729
|
+
if (currentFrameId && name !== 'close_frame') {
|
|
730
|
+
try {
|
|
731
|
+
this.frameManager.addEvent('tool_result', {
|
|
732
|
+
tool_name: name,
|
|
733
|
+
success: !error,
|
|
734
|
+
result: error ? { error: error.message } : result,
|
|
735
|
+
timestamp: endTime,
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
catch {
|
|
739
|
+
// Frame may have been closed, ignore logging error
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
// Update tool call with results and add to trace detector
|
|
743
|
+
toolCall.result = error ? undefined : result;
|
|
744
|
+
toolCall.duration = endTime - startTime;
|
|
745
|
+
// Extract files affected if available from result or args
|
|
746
|
+
if (args.file_path || args.path) {
|
|
747
|
+
toolCall.filesAffected = [args.file_path || args.path].filter(Boolean);
|
|
748
|
+
}
|
|
749
|
+
else if (result?.files) {
|
|
750
|
+
const files = result.files;
|
|
751
|
+
toolCall.filesAffected = Array.isArray(files) ? files : [files];
|
|
752
|
+
}
|
|
753
|
+
// Add to trace detector
|
|
754
|
+
this.traceDetector.addToolCall(toolCall);
|
|
755
|
+
}
|
|
756
|
+
return result;
|
|
466
757
|
});
|
|
467
758
|
}
|
|
468
759
|
async handleGetContext(args) {
|
|
@@ -712,31 +1003,70 @@ class LocalStackMemoryMCP {
|
|
|
712
1003
|
}
|
|
713
1004
|
}
|
|
714
1005
|
async handleGetActiveTasks(args) {
|
|
715
|
-
const { frameId } = args;
|
|
716
|
-
|
|
717
|
-
|
|
1006
|
+
const { frameId, status, priority, search, limit = 20 } = args;
|
|
1007
|
+
let tasks = this.taskStore.getActiveTasks(frameId);
|
|
1008
|
+
// Apply filters
|
|
1009
|
+
if (status) {
|
|
1010
|
+
tasks = tasks.filter((t) => t.status === status);
|
|
1011
|
+
}
|
|
1012
|
+
if (priority) {
|
|
1013
|
+
tasks = tasks.filter((t) => t.priority === priority);
|
|
1014
|
+
}
|
|
1015
|
+
if (search) {
|
|
1016
|
+
const searchLower = search.toLowerCase();
|
|
1017
|
+
tasks = tasks.filter((t) => t.title.toLowerCase().includes(searchLower) ||
|
|
1018
|
+
(t.description && t.description.toLowerCase().includes(searchLower)));
|
|
1019
|
+
}
|
|
1020
|
+
// Sort by priority (urgent first) then by created_at
|
|
1021
|
+
const priorityOrder = { urgent: 0, high: 1, medium: 2, low: 3 };
|
|
1022
|
+
tasks.sort((a, b) => {
|
|
1023
|
+
const pa = priorityOrder[a.priority] ?? 2;
|
|
1024
|
+
const pb = priorityOrder[b.priority] ?? 2;
|
|
1025
|
+
if (pa !== pb)
|
|
1026
|
+
return pa - pb;
|
|
1027
|
+
return b.created_at - a.created_at;
|
|
1028
|
+
});
|
|
1029
|
+
// Limit results
|
|
1030
|
+
tasks = tasks.slice(0, limit);
|
|
1031
|
+
if (tasks.length === 0) {
|
|
718
1032
|
return {
|
|
719
1033
|
content: [
|
|
720
1034
|
{
|
|
721
1035
|
type: 'text',
|
|
722
|
-
text:
|
|
723
|
-
? `š No
|
|
724
|
-
: 'š No active tasks
|
|
1036
|
+
text: search
|
|
1037
|
+
? `š No tasks matching "${search}"`
|
|
1038
|
+
: 'š No active tasks found',
|
|
725
1039
|
},
|
|
726
1040
|
],
|
|
727
1041
|
};
|
|
728
1042
|
}
|
|
729
|
-
let response =
|
|
730
|
-
|
|
731
|
-
const
|
|
732
|
-
|
|
1043
|
+
let response = `š **Tasks** (${tasks.length} found)\n\n`;
|
|
1044
|
+
tasks.forEach((task) => {
|
|
1045
|
+
const priorityIcon = { urgent: 'š“', high: 'š ', medium: 'š”', low: 'š¢' }[task.priority] ||
|
|
1046
|
+
'āŖ';
|
|
1047
|
+
const statusIcon = {
|
|
1048
|
+
pending: 'ā³',
|
|
1049
|
+
in_progress: 'š',
|
|
1050
|
+
completed: 'ā
',
|
|
1051
|
+
blocked: 'š«',
|
|
1052
|
+
cancelled: 'ā',
|
|
1053
|
+
}[task.status] || 'āŖ';
|
|
733
1054
|
const effort = task.estimated_effort
|
|
734
|
-
? ` (
|
|
1055
|
+
? ` (~${task.estimated_effort}m)`
|
|
735
1056
|
: '';
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
1057
|
+
// Extract Linear ID from title if present
|
|
1058
|
+
const linearMatch = task.title.match(/\[ENG-\d+\]/);
|
|
1059
|
+
const linearId = linearMatch ? linearMatch[0] : '';
|
|
1060
|
+
const title = linearId
|
|
1061
|
+
? task.title.replace(linearId, '').trim()
|
|
1062
|
+
: task.title;
|
|
1063
|
+
response += `${statusIcon} ${priorityIcon} **${linearId || task.id}** ${title}${effort}\n`;
|
|
1064
|
+
if (task.description) {
|
|
1065
|
+
const desc = task.description.split('\n')[0].slice(0, 100);
|
|
1066
|
+
response += ` ${desc}${task.description.length > 100 ? '...' : ''}\n`;
|
|
1067
|
+
}
|
|
1068
|
+
if (task.tags && task.tags.length > 0) {
|
|
1069
|
+
response += ` š·ļø ${task.tags.join(', ')}\n`;
|
|
740
1070
|
}
|
|
741
1071
|
response += '\n';
|
|
742
1072
|
});
|
|
@@ -807,6 +1137,464 @@ class LocalStackMemoryMCP {
|
|
|
807
1137
|
};
|
|
808
1138
|
}
|
|
809
1139
|
}
|
|
1140
|
+
// Linear Integration Handlers
|
|
1141
|
+
async handleLinearSync(args) {
|
|
1142
|
+
try {
|
|
1143
|
+
const tokens = this.linearAuthManager.loadTokens();
|
|
1144
|
+
if (!tokens) {
|
|
1145
|
+
return {
|
|
1146
|
+
content: [
|
|
1147
|
+
{
|
|
1148
|
+
type: 'text',
|
|
1149
|
+
text: 'ā Linear not authenticated. Run: stackmemory linear setup',
|
|
1150
|
+
},
|
|
1151
|
+
],
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
const syncConfig = { ...DEFAULT_SYNC_CONFIG, enabled: true };
|
|
1155
|
+
if (args.direction) {
|
|
1156
|
+
syncConfig.direction = args.direction;
|
|
1157
|
+
}
|
|
1158
|
+
// Update sync engine configuration for this sync
|
|
1159
|
+
this.linearSync.updateConfig(syncConfig);
|
|
1160
|
+
const result = await this.linearSync.sync();
|
|
1161
|
+
return {
|
|
1162
|
+
content: [
|
|
1163
|
+
{
|
|
1164
|
+
type: 'text',
|
|
1165
|
+
text: `ā
Linear sync completed\n- To Linear: ${result.synced.toLinear} tasks\n- From Linear: ${result.synced.fromLinear} tasks\n- Updated: ${result.synced.updated} tasks`,
|
|
1166
|
+
},
|
|
1167
|
+
],
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
catch (error) {
|
|
1171
|
+
return {
|
|
1172
|
+
content: [
|
|
1173
|
+
{
|
|
1174
|
+
type: 'text',
|
|
1175
|
+
text: `ā Linear sync failed: ${error.message}`,
|
|
1176
|
+
},
|
|
1177
|
+
],
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
async handleLinearUpdateTask(args) {
|
|
1182
|
+
try {
|
|
1183
|
+
const { LinearClient } = await import('../linear/client.js');
|
|
1184
|
+
const tokens = this.linearAuthManager.loadTokens();
|
|
1185
|
+
if (!tokens) {
|
|
1186
|
+
return {
|
|
1187
|
+
content: [
|
|
1188
|
+
{
|
|
1189
|
+
type: 'text',
|
|
1190
|
+
text: 'ā Linear not authenticated. Run: stackmemory linear setup',
|
|
1191
|
+
},
|
|
1192
|
+
],
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
const client = new LinearClient({
|
|
1196
|
+
apiKey: tokens.accessToken,
|
|
1197
|
+
});
|
|
1198
|
+
// Find the issue
|
|
1199
|
+
let issue = await client.getIssue(args.issueId);
|
|
1200
|
+
if (!issue) {
|
|
1201
|
+
issue = await client.findIssueByIdentifier(args.issueId);
|
|
1202
|
+
}
|
|
1203
|
+
if (!issue) {
|
|
1204
|
+
return {
|
|
1205
|
+
content: [
|
|
1206
|
+
{
|
|
1207
|
+
type: 'text',
|
|
1208
|
+
text: `ā Linear issue ${args.issueId} not found`,
|
|
1209
|
+
},
|
|
1210
|
+
],
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
const updates = {};
|
|
1214
|
+
// Handle status update
|
|
1215
|
+
if (args.status) {
|
|
1216
|
+
const team = await client.getTeam();
|
|
1217
|
+
const states = await client.getWorkflowStates(team.id);
|
|
1218
|
+
const statusMap = {
|
|
1219
|
+
todo: 'unstarted',
|
|
1220
|
+
'in-progress': 'started',
|
|
1221
|
+
done: 'completed',
|
|
1222
|
+
canceled: 'cancelled',
|
|
1223
|
+
};
|
|
1224
|
+
const targetType = statusMap[args.status] || args.status;
|
|
1225
|
+
const targetState = states.find((s) => s.type === targetType);
|
|
1226
|
+
if (!targetState) {
|
|
1227
|
+
return {
|
|
1228
|
+
content: [
|
|
1229
|
+
{
|
|
1230
|
+
type: 'text',
|
|
1231
|
+
text: `ā Invalid status: ${args.status}`,
|
|
1232
|
+
},
|
|
1233
|
+
],
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
updates.stateId = targetState.id;
|
|
1237
|
+
}
|
|
1238
|
+
if (args.title)
|
|
1239
|
+
updates.title = args.title;
|
|
1240
|
+
if (args.description)
|
|
1241
|
+
updates.description = args.description;
|
|
1242
|
+
if (args.priority)
|
|
1243
|
+
updates.priority = args.priority;
|
|
1244
|
+
const updatedIssue = await client.updateIssue(issue.id, updates);
|
|
1245
|
+
// Auto-sync to local tasks after update
|
|
1246
|
+
this.linearSync.updateConfig({
|
|
1247
|
+
...DEFAULT_SYNC_CONFIG,
|
|
1248
|
+
enabled: true,
|
|
1249
|
+
direction: 'from_linear',
|
|
1250
|
+
});
|
|
1251
|
+
const syncResult = await this.linearSync.sync();
|
|
1252
|
+
let response = `ā
Updated ${updatedIssue.identifier}: ${updatedIssue.title}\n`;
|
|
1253
|
+
if (args.status) {
|
|
1254
|
+
response += `Status: ${updatedIssue.state.name}\n`;
|
|
1255
|
+
}
|
|
1256
|
+
response += `URL: ${updatedIssue.url}\n`;
|
|
1257
|
+
response += `\nš Local sync: ${syncResult.synced.fromLinear} new, ${syncResult.synced.updated} updated`;
|
|
1258
|
+
return {
|
|
1259
|
+
content: [
|
|
1260
|
+
{
|
|
1261
|
+
type: 'text',
|
|
1262
|
+
text: response,
|
|
1263
|
+
},
|
|
1264
|
+
],
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
catch (error) {
|
|
1268
|
+
return {
|
|
1269
|
+
content: [
|
|
1270
|
+
{
|
|
1271
|
+
type: 'text',
|
|
1272
|
+
text: `ā Failed to update Linear task: ${error.message}`,
|
|
1273
|
+
},
|
|
1274
|
+
],
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
async handleLinearGetTasks(args) {
|
|
1279
|
+
try {
|
|
1280
|
+
const { LinearClient } = await import('../linear/client.js');
|
|
1281
|
+
const tokens = this.linearAuthManager.loadTokens();
|
|
1282
|
+
if (!tokens) {
|
|
1283
|
+
return {
|
|
1284
|
+
content: [
|
|
1285
|
+
{
|
|
1286
|
+
type: 'text',
|
|
1287
|
+
text: 'ā Linear not authenticated. Run: stackmemory linear setup',
|
|
1288
|
+
},
|
|
1289
|
+
],
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
const client = new LinearClient({
|
|
1293
|
+
apiKey: tokens.accessToken,
|
|
1294
|
+
});
|
|
1295
|
+
let stateType = undefined;
|
|
1296
|
+
if (args.status && args.status !== 'all') {
|
|
1297
|
+
const statusMap = {
|
|
1298
|
+
todo: 'unstarted',
|
|
1299
|
+
'in-progress': 'started',
|
|
1300
|
+
done: 'completed',
|
|
1301
|
+
};
|
|
1302
|
+
stateType = statusMap[args.status] || args.status;
|
|
1303
|
+
}
|
|
1304
|
+
const issues = await client.getIssues({
|
|
1305
|
+
stateType,
|
|
1306
|
+
limit: args.limit || 20,
|
|
1307
|
+
});
|
|
1308
|
+
if (!issues || issues.length === 0) {
|
|
1309
|
+
return {
|
|
1310
|
+
content: [
|
|
1311
|
+
{
|
|
1312
|
+
type: 'text',
|
|
1313
|
+
text: 'No Linear tasks found',
|
|
1314
|
+
},
|
|
1315
|
+
],
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
let response = `š **Linear Tasks** (${issues.length} items)\n\n`;
|
|
1319
|
+
issues.forEach((issue) => {
|
|
1320
|
+
const priority = issue.priority ? `P${issue.priority}` : '-';
|
|
1321
|
+
response += `- **${issue.identifier}**: ${issue.title}\n`;
|
|
1322
|
+
response += ` Status: ${issue.state.name} | Priority: ${priority}\n`;
|
|
1323
|
+
if (issue.assignee) {
|
|
1324
|
+
response += ` Assignee: ${issue.assignee.name}\n`;
|
|
1325
|
+
}
|
|
1326
|
+
response += ` ${issue.url}\n\n`;
|
|
1327
|
+
});
|
|
1328
|
+
return {
|
|
1329
|
+
content: [
|
|
1330
|
+
{
|
|
1331
|
+
type: 'text',
|
|
1332
|
+
text: response,
|
|
1333
|
+
},
|
|
1334
|
+
],
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
catch (error) {
|
|
1338
|
+
return {
|
|
1339
|
+
content: [
|
|
1340
|
+
{
|
|
1341
|
+
type: 'text',
|
|
1342
|
+
text: `ā Failed to get Linear tasks: ${error.message}`,
|
|
1343
|
+
},
|
|
1344
|
+
],
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
async handleLinearStatus(_args) {
|
|
1349
|
+
try {
|
|
1350
|
+
const { LinearClient } = await import('../linear/client.js');
|
|
1351
|
+
const tokens = this.linearAuthManager.loadTokens();
|
|
1352
|
+
if (!tokens) {
|
|
1353
|
+
return {
|
|
1354
|
+
content: [
|
|
1355
|
+
{
|
|
1356
|
+
type: 'text',
|
|
1357
|
+
text: 'ā Linear integration not configured\nRun: stackmemory linear setup',
|
|
1358
|
+
},
|
|
1359
|
+
],
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
try {
|
|
1363
|
+
const client = new LinearClient({
|
|
1364
|
+
apiKey: tokens.accessToken,
|
|
1365
|
+
});
|
|
1366
|
+
const viewer = await client.getViewer();
|
|
1367
|
+
const team = await client.getTeam();
|
|
1368
|
+
return {
|
|
1369
|
+
content: [
|
|
1370
|
+
{
|
|
1371
|
+
type: 'text',
|
|
1372
|
+
text: `ā
**Linear Integration Status**\n\nConnected as: ${viewer.name} (${viewer.email})\nTeam: ${team.name} (${team.key})\nTokens: Valid`,
|
|
1373
|
+
},
|
|
1374
|
+
],
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
catch (error) {
|
|
1378
|
+
return {
|
|
1379
|
+
content: [
|
|
1380
|
+
{
|
|
1381
|
+
type: 'text',
|
|
1382
|
+
text: `ā ļø Linear configured but connection failed: ${error.message}`,
|
|
1383
|
+
},
|
|
1384
|
+
],
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
catch (error) {
|
|
1389
|
+
return {
|
|
1390
|
+
content: [
|
|
1391
|
+
{
|
|
1392
|
+
type: 'text',
|
|
1393
|
+
text: `ā Linear status check failed: ${error.message}`,
|
|
1394
|
+
},
|
|
1395
|
+
],
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
async handleGetTraces(args) {
|
|
1400
|
+
const { type, minScore, limit = 20 } = args;
|
|
1401
|
+
// Flush pending traces first
|
|
1402
|
+
this.traceDetector.flush();
|
|
1403
|
+
let traces = this.traceDetector.getTraces();
|
|
1404
|
+
// Apply filters
|
|
1405
|
+
if (type) {
|
|
1406
|
+
traces = traces.filter((t) => t.type === type);
|
|
1407
|
+
}
|
|
1408
|
+
if (minScore !== undefined) {
|
|
1409
|
+
traces = traces.filter((t) => t.score >= minScore);
|
|
1410
|
+
}
|
|
1411
|
+
// Sort by score and limit
|
|
1412
|
+
traces = traces.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
1413
|
+
// Format traces for display
|
|
1414
|
+
const formattedTraces = traces.map((trace) => ({
|
|
1415
|
+
id: trace.id,
|
|
1416
|
+
type: trace.type,
|
|
1417
|
+
score: trace.score.toFixed(2),
|
|
1418
|
+
summary: trace.summary,
|
|
1419
|
+
toolCount: trace.tools.length,
|
|
1420
|
+
duration: `${((trace.metadata.endTime - trace.metadata.startTime) / 1000).toFixed(1)}s`,
|
|
1421
|
+
filesModified: trace.metadata.filesModified.length,
|
|
1422
|
+
hasErrors: trace.metadata.errorsEncountered.length > 0,
|
|
1423
|
+
compressed: !!trace.compressed,
|
|
1424
|
+
}));
|
|
1425
|
+
return {
|
|
1426
|
+
content: [
|
|
1427
|
+
{
|
|
1428
|
+
type: 'text',
|
|
1429
|
+
text: `Found ${formattedTraces.length} traces:\n\n${formattedTraces
|
|
1430
|
+
.map((t) => `[${t.type}] Score: ${t.score} | Tools: ${t.toolCount} | Duration: ${t.duration}\n ${t.summary}`)
|
|
1431
|
+
.join('\n\n')}`,
|
|
1432
|
+
},
|
|
1433
|
+
],
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
async handleGetTraceStatistics(args) {
|
|
1437
|
+
this.traceDetector.flush();
|
|
1438
|
+
const stats = this.traceDetector.getStatistics();
|
|
1439
|
+
const typeBreakdown = Object.entries(stats.tracesByType)
|
|
1440
|
+
.map(([type, count]) => ` ${type}: ${count}`)
|
|
1441
|
+
.join('\n');
|
|
1442
|
+
return {
|
|
1443
|
+
content: [
|
|
1444
|
+
{
|
|
1445
|
+
type: 'text',
|
|
1446
|
+
text: `**Trace Statistics**\n\nTotal Traces: ${stats.totalTraces}
|
|
1447
|
+
Average Score: ${stats.averageScore.toFixed(2)}
|
|
1448
|
+
Average Length: ${stats.averageLength.toFixed(1)} tools
|
|
1449
|
+
High Importance (>0.7): ${stats.highImportanceCount}
|
|
1450
|
+
Compressed: ${stats.compressedCount}
|
|
1451
|
+
|
|
1452
|
+
**Trace Types:**
|
|
1453
|
+
${typeBreakdown}`,
|
|
1454
|
+
},
|
|
1455
|
+
],
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
async handleFlushTraces(args) {
|
|
1459
|
+
this.traceDetector.flush();
|
|
1460
|
+
return {
|
|
1461
|
+
content: [
|
|
1462
|
+
{
|
|
1463
|
+
type: 'text',
|
|
1464
|
+
text: 'Pending traces have been flushed and finalized.',
|
|
1465
|
+
},
|
|
1466
|
+
],
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
async handleCompressOldTraces(args) {
|
|
1470
|
+
const { ageHours = 24 } = args;
|
|
1471
|
+
const compressedCount = this.traceDetector.compressOldTraces(ageHours);
|
|
1472
|
+
return {
|
|
1473
|
+
content: [
|
|
1474
|
+
{
|
|
1475
|
+
type: 'text',
|
|
1476
|
+
text: `Compressed ${compressedCount} traces older than ${ageHours} hours.`,
|
|
1477
|
+
},
|
|
1478
|
+
],
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
async handleSmartContext(args) {
|
|
1482
|
+
const { query, tokenBudget = 4000, forceRefresh = false } = args;
|
|
1483
|
+
try {
|
|
1484
|
+
const result = await this.contextRetrieval.retrieveContext(query, {
|
|
1485
|
+
tokenBudget,
|
|
1486
|
+
forceRefresh,
|
|
1487
|
+
});
|
|
1488
|
+
// Log the retrieval
|
|
1489
|
+
const currentFrameId = this.frameManager.getCurrentFrameId();
|
|
1490
|
+
if (currentFrameId) {
|
|
1491
|
+
this.frameManager.addEvent('observation', {
|
|
1492
|
+
action: 'smart_context',
|
|
1493
|
+
query,
|
|
1494
|
+
framesRetrieved: result.frames.length,
|
|
1495
|
+
tokenUsage: result.tokenUsage,
|
|
1496
|
+
confidence: result.analysis.confidenceScore,
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
// Build response with metadata
|
|
1500
|
+
let response = result.context;
|
|
1501
|
+
response += `\n\n---\nš **Retrieval Stats**\n`;
|
|
1502
|
+
response += `- Frames included: ${result.frames.length}\n`;
|
|
1503
|
+
response += `- Tokens used: ${result.tokenUsage.used}/${result.tokenUsage.budget}\n`;
|
|
1504
|
+
response += `- Confidence: ${(result.analysis.confidenceScore * 100).toFixed(0)}%\n`;
|
|
1505
|
+
response += `- Time: ${result.metadata.retrievalTimeMs}ms`;
|
|
1506
|
+
return {
|
|
1507
|
+
content: [
|
|
1508
|
+
{
|
|
1509
|
+
type: 'text',
|
|
1510
|
+
text: response,
|
|
1511
|
+
},
|
|
1512
|
+
],
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
catch (error) {
|
|
1516
|
+
return {
|
|
1517
|
+
content: [
|
|
1518
|
+
{
|
|
1519
|
+
type: 'text',
|
|
1520
|
+
text: `ā Context retrieval failed: ${error.message}`,
|
|
1521
|
+
},
|
|
1522
|
+
],
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
async handleGetSummary(args) {
|
|
1527
|
+
const { forceRefresh = false } = args;
|
|
1528
|
+
try {
|
|
1529
|
+
const summary = this.contextRetrieval.getSummary(forceRefresh);
|
|
1530
|
+
// Format the summary for display
|
|
1531
|
+
let response = 'š **Compressed Memory Summary**\n\n';
|
|
1532
|
+
// Recent session
|
|
1533
|
+
response += '## Recent Session\n';
|
|
1534
|
+
response += `- Frames: ${summary.recentSession.frames.length}\n`;
|
|
1535
|
+
response += `- Time range: ${new Date(summary.recentSession.timeRange.start).toLocaleString()} - ${new Date(summary.recentSession.timeRange.end).toLocaleString()}\n`;
|
|
1536
|
+
if (summary.recentSession.dominantOperations.length > 0) {
|
|
1537
|
+
response += `- Dominant ops: ${summary.recentSession.dominantOperations
|
|
1538
|
+
.slice(0, 5)
|
|
1539
|
+
.map((o) => `${o.operation}(${o.count})`)
|
|
1540
|
+
.join(', ')}\n`;
|
|
1541
|
+
}
|
|
1542
|
+
if (summary.recentSession.filesTouched.length > 0) {
|
|
1543
|
+
response += `- Files touched: ${summary.recentSession.filesTouched
|
|
1544
|
+
.slice(0, 5)
|
|
1545
|
+
.map((f) => f.path)
|
|
1546
|
+
.join(', ')}\n`;
|
|
1547
|
+
}
|
|
1548
|
+
if (summary.recentSession.errorsEncountered.length > 0) {
|
|
1549
|
+
response += `- Errors: ${summary.recentSession.errorsEncountered.length}\n`;
|
|
1550
|
+
}
|
|
1551
|
+
// Historical patterns
|
|
1552
|
+
response += '\n## Historical Patterns\n';
|
|
1553
|
+
response += `- Topic counts: ${Object.keys(summary.historicalPatterns.topicFrameCounts).length} topics\n`;
|
|
1554
|
+
if (summary.historicalPatterns.keyDecisions.length > 0) {
|
|
1555
|
+
response += `\n### Key Decisions (${summary.historicalPatterns.keyDecisions.length})\n`;
|
|
1556
|
+
summary.historicalPatterns.keyDecisions.slice(0, 5).forEach((d) => {
|
|
1557
|
+
response += `- ${d.text.substring(0, 80)}${d.text.length > 80 ? '...' : ''}\n`;
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
if (summary.historicalPatterns.recurringIssues.length > 0) {
|
|
1561
|
+
response += `\n### Recurring Issues (${summary.historicalPatterns.recurringIssues.length})\n`;
|
|
1562
|
+
summary.historicalPatterns.recurringIssues.slice(0, 3).forEach((i) => {
|
|
1563
|
+
response += `- ${i.issueType} (${i.occurrenceCount} times)\n`;
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
// Queryable indices
|
|
1567
|
+
response += '\n## Available Indices\n';
|
|
1568
|
+
response += `- By time: ${Object.keys(summary.queryableIndices.byTimeframe).length} periods\n`;
|
|
1569
|
+
response += `- By file: ${Object.keys(summary.queryableIndices.byFile).length} files\n`;
|
|
1570
|
+
response += `- By topic: ${Object.keys(summary.queryableIndices.byTopic).length} topics\n`;
|
|
1571
|
+
response += `- By error: ${Object.keys(summary.queryableIndices.byErrorType).length} error types\n`;
|
|
1572
|
+
// Stats
|
|
1573
|
+
response += `\n## Stats\n`;
|
|
1574
|
+
response += `- Total frames: ${summary.stats.totalFrames}\n`;
|
|
1575
|
+
response += `- Total anchors: ${summary.stats.totalAnchors}\n`;
|
|
1576
|
+
response += `- Total events: ${summary.stats.totalEvents}\n`;
|
|
1577
|
+
response += `- Generated: ${new Date(summary.generatedAt).toLocaleString()}`;
|
|
1578
|
+
return {
|
|
1579
|
+
content: [
|
|
1580
|
+
{
|
|
1581
|
+
type: 'text',
|
|
1582
|
+
text: response,
|
|
1583
|
+
},
|
|
1584
|
+
],
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
catch (error) {
|
|
1588
|
+
return {
|
|
1589
|
+
content: [
|
|
1590
|
+
{
|
|
1591
|
+
type: 'text',
|
|
1592
|
+
text: `ā Failed to get summary: ${error.message}`,
|
|
1593
|
+
},
|
|
1594
|
+
],
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
810
1598
|
async start() {
|
|
811
1599
|
const transport = new StdioServerTransport();
|
|
812
1600
|
await this.server.connect(transport);
|