gsd-pi 2.64.0-dev.f8aad9b → 2.65.0-dev.16e10d7
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/dist/headless.js +3 -1
- package/dist/mcp-server.js +6 -2
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.js +22 -7
- package/dist/resources/extensions/bg-shell/process-manager.js +6 -1
- package/dist/resources/extensions/browser-tools/capture.js +20 -1
- package/dist/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +93 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +13 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +94 -8
- package/dist/resources/extensions/gsd/auto-model-selection.js +7 -5
- package/dist/resources/extensions/gsd/auto-post-unit.js +115 -7
- package/dist/resources/extensions/gsd/auto-prompts.js +24 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +12 -8
- package/dist/resources/extensions/gsd/auto-start.js +35 -1
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +10 -0
- package/dist/resources/extensions/gsd/auto-verification.js +138 -1
- package/dist/resources/extensions/gsd/auto-worktree.js +29 -7
- package/dist/resources/extensions/gsd/auto.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +17 -4
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +34 -13
- package/dist/resources/extensions/gsd/bootstrap/notify-interceptor.js +28 -0
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +6 -4
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +5 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +12 -1
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +16 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +20 -0
- package/dist/resources/extensions/gsd/commands/catalog.js +7 -1
- package/dist/resources/extensions/gsd/commands/context.js +8 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +21 -0
- package/dist/resources/extensions/gsd/commands/handlers/notifications-handler.js +104 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
- package/dist/resources/extensions/gsd/commands-extensions.js +1 -1
- package/dist/resources/extensions/gsd/config-overlay.js +312 -0
- package/dist/resources/extensions/gsd/detection.js +1 -1
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -0
- package/dist/resources/extensions/gsd/doctor.js +2 -1
- package/dist/resources/extensions/gsd/gitignore.js +1 -0
- package/dist/resources/extensions/gsd/gsd-db.js +11 -2
- package/dist/resources/extensions/gsd/guided-flow.js +220 -29
- package/dist/resources/extensions/gsd/md-importer.js +14 -7
- package/dist/resources/extensions/gsd/notification-overlay.js +256 -0
- package/dist/resources/extensions/gsd/notification-store.js +273 -0
- package/dist/resources/extensions/gsd/notification-widget.js +56 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +17 -11
- package/dist/resources/extensions/gsd/post-execution-checks.js +407 -0
- package/dist/resources/extensions/gsd/pre-execution-checks.js +471 -0
- package/dist/resources/extensions/gsd/preferences-types.js +7 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +78 -1
- package/dist/resources/extensions/gsd/preferences.js +13 -2
- package/dist/resources/extensions/gsd/preparation.js +1092 -0
- package/dist/resources/extensions/gsd/prompt-validation.js +67 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +3 -3
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-prepared.md +424 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +4 -1
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +5 -4
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +23 -0
- package/dist/resources/extensions/gsd/prompts/rethink.md +2 -1
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +56 -23
- package/dist/resources/extensions/gsd/quick.js +19 -15
- package/dist/resources/extensions/gsd/reactive-graph.js +12 -0
- package/dist/resources/extensions/gsd/roadmap-slices.js +24 -5
- package/dist/resources/extensions/gsd/safety/content-validator.js +3 -3
- package/dist/resources/extensions/gsd/session-lock.js +23 -1
- package/dist/resources/extensions/gsd/state.js +100 -12
- package/dist/resources/extensions/gsd/templates/context-enhanced.md +138 -0
- package/dist/resources/extensions/gsd/tools/complete-slice.js +12 -3
- package/dist/resources/extensions/gsd/tools/complete-task.js +16 -4
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -5
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +5 -2
- package/dist/resources/extensions/gsd/tools/reopen-milestone.js +119 -0
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +30 -0
- package/dist/resources/extensions/gsd/tools/reopen-task.js +18 -0
- package/dist/resources/extensions/gsd/triage-resolution.js +25 -9
- package/dist/resources/extensions/gsd/verification-evidence.js +18 -0
- package/dist/resources/extensions/gsd/workflow-logger.js +8 -0
- package/dist/resources/extensions/gsd/workflow-projections.js +4 -7
- package/dist/resources/extensions/gsd/workflow-reconcile.js +2 -4
- package/dist/resources/extensions/gsd/workflow-templates.js +11 -2
- package/dist/resources/extensions/gsd/worktree-manager.js +5 -2
- package/dist/resources/extensions/gsd/worktree.js +9 -0
- package/dist/resources/extensions/shared/interview-ui.js +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +18 -17
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
- package/dist/web/standalone/.next/routes-manifest.json +6 -0
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +3 -0
- package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -0
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -0
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +18 -17
- package/dist/web/standalone/.next/server/functions-config-manifest.json +1 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/Z3TgDP0c7kG9j8CVQVGcl/_buildManifest.js +1 -0
- package/dist/web/standalone/.next/static/chunks/6502.8874bcae249c02e1.js +9 -0
- package/dist/web/standalone/.next/static/chunks/app/_global-error/page-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/boot/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/input/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/resize/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/stream/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/browse-directories/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/captures/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/cleanup/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/dev-mode/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/doctor/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/experimental/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/export-data/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/files/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/forensics/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/git/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/history/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/hooks/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/inspect/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/knowledge/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/live-state/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/notifications/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/onboarding/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/preferences/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/projects/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/recovery/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/remote-questions/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/session/browser/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/session/command/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/session/events/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/session/manage/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/settings-data/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/shutdown/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/skill-health/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/steer/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/switch-root/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/input/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/resize/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/sessions/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/stream/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/upload/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/undo/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/update/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/api/visualizer/route-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8805a20e15762c3c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-a1c1e452c6b32d04.js → webpack-9fed74684e1c5bb1.js} +1 -1
- package/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +26 -9
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +100 -4
- package/packages/pi-agent-core/src/agent-loop.ts +43 -12
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +38 -0
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +11 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js +24 -0
- package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +4 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.js +30 -19
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js +51 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +9 -9
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js +10 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +28 -5
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +15 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +18 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +40 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +64 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +10 -0
- package/packages/pi-coding-agent/src/core/resource-loader-cache-reset.test.ts +42 -0
- package/packages/pi-coding-agent/src/core/resource-loader.ts +5 -1
- package/packages/pi-coding-agent/src/core/retry-handler.test.ts +80 -0
- package/packages/pi-coding-agent/src/core/retry-handler.ts +37 -25
- package/packages/pi-coding-agent/src/core/sdk.ts +9 -9
- package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +10 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +29 -4
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +27 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +16 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +38 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js +66 -0
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js.map +1 -0
- package/packages/pi-tui/dist/components/image.d.ts +2 -0
- package/packages/pi-tui/dist/components/image.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/image.js +4 -0
- package/packages/pi-tui/dist/components/image.js.map +1 -1
- package/packages/pi-tui/dist/components/image.test.d.ts +6 -0
- package/packages/pi-tui/dist/components/image.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/image.test.js +32 -0
- package/packages/pi-tui/dist/components/image.test.js.map +1 -0
- package/packages/pi-tui/dist/components/loader.d.ts +4 -2
- package/packages/pi-tui/dist/components/loader.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/loader.js +27 -9
- package/packages/pi-tui/dist/components/loader.js.map +1 -1
- package/packages/pi-tui/dist/components/text.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/text.js +2 -0
- package/packages/pi-tui/dist/components/text.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.js +12 -1
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts +4 -0
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +35 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/__tests__/overlay-layout.test.ts +82 -0
- package/packages/pi-tui/src/components/image.test.ts +36 -0
- package/packages/pi-tui/src/components/image.ts +5 -0
- package/packages/pi-tui/src/components/loader.ts +27 -10
- package/packages/pi-tui/src/components/text.ts +1 -0
- package/packages/pi-tui/src/overlay-layout.ts +13 -1
- package/packages/pi-tui/src/tui.ts +34 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/bg-shell/bg-shell-lifecycle.ts +19 -7
- package/src/resources/extensions/bg-shell/process-manager.ts +8 -2
- package/src/resources/extensions/browser-tools/capture.ts +19 -1
- package/src/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +93 -0
- package/src/resources/extensions/gsd/auto/run-unit.ts +12 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +105 -8
- package/src/resources/extensions/gsd/auto-model-selection.ts +7 -5
- package/src/resources/extensions/gsd/auto-post-unit.ts +138 -6
- package/src/resources/extensions/gsd/auto-prompts.ts +31 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +10 -8
- package/src/resources/extensions/gsd/auto-start.ts +38 -0
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +10 -0
- package/src/resources/extensions/gsd/auto-verification.ts +190 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +28 -7
- package/src/resources/extensions/gsd/auto.ts +2 -1
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +16 -4
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +35 -13
- package/src/resources/extensions/gsd/bootstrap/notify-interceptor.ts +34 -0
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +5 -4
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +4 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +12 -1
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +20 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +28 -0
- package/src/resources/extensions/gsd/commands/catalog.ts +7 -1
- package/src/resources/extensions/gsd/commands/context.ts +7 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +24 -0
- package/src/resources/extensions/gsd/commands/handlers/notifications-handler.ts +140 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
- package/src/resources/extensions/gsd/commands-extensions.ts +1 -1
- package/src/resources/extensions/gsd/config-overlay.ts +331 -0
- package/src/resources/extensions/gsd/detection.ts +1 -1
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -0
- package/src/resources/extensions/gsd/doctor.ts +2 -1
- package/src/resources/extensions/gsd/gitignore.ts +1 -0
- package/src/resources/extensions/gsd/gsd-db.ts +13 -2
- package/src/resources/extensions/gsd/guided-flow.ts +254 -30
- package/src/resources/extensions/gsd/md-importer.ts +13 -6
- package/src/resources/extensions/gsd/notification-overlay.ts +295 -0
- package/src/resources/extensions/gsd/notification-store.ts +293 -0
- package/src/resources/extensions/gsd/notification-widget.ts +68 -0
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +19 -11
- package/src/resources/extensions/gsd/post-execution-checks.ts +539 -0
- package/src/resources/extensions/gsd/pre-execution-checks.ts +581 -0
- package/src/resources/extensions/gsd/preferences-types.ts +53 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +78 -1
- package/src/resources/extensions/gsd/preferences.ts +13 -2
- package/src/resources/extensions/gsd/preparation.ts +1419 -0
- package/src/resources/extensions/gsd/prompt-validation.ts +88 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +3 -3
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-prepared.md +424 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +4 -1
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +5 -4
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +23 -0
- package/src/resources/extensions/gsd/prompts/rethink.md +2 -1
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +56 -23
- package/src/resources/extensions/gsd/quick.ts +20 -15
- package/src/resources/extensions/gsd/reactive-graph.ts +18 -0
- package/src/resources/extensions/gsd/roadmap-slices.ts +21 -5
- package/src/resources/extensions/gsd/safety/content-validator.ts +3 -3
- package/src/resources/extensions/gsd/session-lock.ts +17 -1
- package/src/resources/extensions/gsd/state.ts +101 -11
- package/src/resources/extensions/gsd/templates/context-enhanced.md +138 -0
- package/src/resources/extensions/gsd/tests/adversarial-review-fixes.test.ts +223 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +33 -2
- package/src/resources/extensions/gsd/tests/auto-remediate-slice-status.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +41 -0
- package/src/resources/extensions/gsd/tests/complete-slice-string-coercion.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +72 -0
- package/src/resources/extensions/gsd/tests/complete-task-normalize-lists.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/defer-milestone-stamp.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/discuss-incremental-persistence.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/discuss-slice-structured-questions.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard-closed-status.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +526 -0
- package/src/resources/extensions/gsd/tests/error-success-mask.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/frontmatter-parse-noise.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/guided-flow-state-rebuild.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/import-done-milestones.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +5 -3
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +28 -30
- package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +53 -0
- package/src/resources/extensions/gsd/tests/integration-prepared-discussion.test.ts +525 -0
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/needs-remediation-revalidation.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/note-captures-executed.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/notification-store.test.ts +282 -0
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/phantom-ghost-detection.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/phantom-milestone-default-queued.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +312 -0
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +813 -0
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +1197 -0
- package/src/resources/extensions/gsd/tests/pre-execution-fail-closed.test.ts +266 -0
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +457 -0
- package/src/resources/extensions/gsd/tests/preparation.test.ts +1211 -0
- package/src/resources/extensions/gsd/tests/project-root-cwd-crash.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +83 -0
- package/src/resources/extensions/gsd/tests/prompt-builder.test.ts +669 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +7 -4
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/query-tools-db-open.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/queued-discuss-fast-path.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/reactive-graph.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/rogue-file-detection.test.ts +4 -5
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/show-config-command.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/skip-slice-state-rebuild.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/skipped-validation-completion.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/slice-sequence-insert.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/stale-lockfile-recovery.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/stale-queued-milestone.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +13 -0
- package/src/resources/extensions/gsd/tests/stash-pop-gsd-conflict.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +6 -7
- package/src/resources/extensions/gsd/tests/status-db-open.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/symlink-extension-discovery.test.ts +125 -0
- package/src/resources/extensions/gsd/tests/sync-worktree-skip-current.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +29 -1
- package/src/resources/extensions/gsd/tests/triage-resolution.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +163 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +3 -4
- package/src/resources/extensions/gsd/tests/verification-operational-gate.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/verify-artifact-tightened.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/worker-model-override.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/worktree-expected-warnings.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/worktree-integration.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/worktree-main-branch.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +16 -17
- package/src/resources/extensions/gsd/tests/worktree-sync-tasks.test.ts +13 -9
- package/src/resources/extensions/gsd/tests/worktree.test.ts +26 -9
- package/src/resources/extensions/gsd/tests/zero-slice-roadmap-guided.test.ts +19 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +13 -3
- package/src/resources/extensions/gsd/tools/complete-task.ts +16 -4
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +11 -9
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +5 -2
- package/src/resources/extensions/gsd/tools/reopen-milestone.ts +152 -0
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +27 -0
- package/src/resources/extensions/gsd/tools/reopen-task.ts +17 -0
- package/src/resources/extensions/gsd/triage-resolution.ts +29 -10
- package/src/resources/extensions/gsd/types.ts +4 -0
- package/src/resources/extensions/gsd/verification-evidence.ts +68 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +13 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +4 -6
- package/src/resources/extensions/gsd/workflow-reconcile.ts +2 -3
- package/src/resources/extensions/gsd/workflow-templates.ts +11 -2
- package/src/resources/extensions/gsd/worktree-manager.ts +4 -2
- package/src/resources/extensions/gsd/worktree.ts +10 -0
- package/src/resources/extensions/shared/interview-ui.ts +1 -1
- package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +8 -10
- package/dist/web/standalone/.next/static/F1mOwzgCW9R8N3Pt1Et87/_buildManifest.js +0 -1
- package/dist/web/standalone/.next/static/chunks/6502.7593d7797a4b3999.js +0 -9
- package/dist/web/standalone/.next/static/chunks/app/_global-error/page-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/boot/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/input/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/resize/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/stream/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/browse-directories/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/captures/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/cleanup/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/dev-mode/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/doctor/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/experimental/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/export-data/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/files/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/forensics/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/git/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/history/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/hooks/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/inspect/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/knowledge/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/live-state/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/onboarding/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/preferences/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/projects/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/recovery/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/remote-questions/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/session/browser/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/session/command/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/session/events/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/session/manage/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/settings-data/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/shutdown/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/skill-health/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/steer/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/switch-root/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/input/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/resize/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/sessions/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/stream/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/terminal/upload/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/undo/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/update/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/api/visualizer/route-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-c4cc189e7b117ea2.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-c4cc189e7b117ea2.js +0 -1
- /package/dist/web/standalone/.next/static/{F1mOwzgCW9R8N3Pt1Et87 → Z3TgDP0c7kG9j8CVQVGcl}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
// GSD Extension — Notification History Overlay
|
|
2
|
+
// Scrollable panel showing all persisted notifications with severity filtering.
|
|
3
|
+
// Toggled with Ctrl+Alt+N or opened from /gsd notifications.
|
|
4
|
+
import { truncateToWidth, visibleWidth, matchesKey, Key } from "@gsd/pi-tui";
|
|
5
|
+
import { readNotifications, markAllRead, clearNotifications, } from "./notification-store.js";
|
|
6
|
+
import { padRight, joinColumns } from "../shared/mod.js";
|
|
7
|
+
const FILTER_CYCLE = ["all", "error", "warning", "info"];
|
|
8
|
+
function severityIcon(severity) {
|
|
9
|
+
switch (severity) {
|
|
10
|
+
case "error": return "✗";
|
|
11
|
+
case "warning": return "⚠";
|
|
12
|
+
case "success": return "✓";
|
|
13
|
+
case "info":
|
|
14
|
+
default: return "●";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Word-wrap plain text to fit within maxWidth columns. */
|
|
18
|
+
function wrapText(text, maxWidth) {
|
|
19
|
+
if (text.length <= maxWidth)
|
|
20
|
+
return [text];
|
|
21
|
+
const words = text.split(/\s+/);
|
|
22
|
+
const lines = [];
|
|
23
|
+
let current = "";
|
|
24
|
+
for (const word of words) {
|
|
25
|
+
if (current.length === 0) {
|
|
26
|
+
current = word;
|
|
27
|
+
}
|
|
28
|
+
else if (current.length + 1 + word.length <= maxWidth) {
|
|
29
|
+
current += " " + word;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
lines.push(current);
|
|
33
|
+
current = word;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (current.length > 0)
|
|
37
|
+
lines.push(current);
|
|
38
|
+
// If a single word exceeds maxWidth, truncate it
|
|
39
|
+
return lines.map((l) => l.length > maxWidth ? l.slice(0, maxWidth - 1) + "…" : l);
|
|
40
|
+
}
|
|
41
|
+
function formatTimestamp(ts) {
|
|
42
|
+
try {
|
|
43
|
+
const d = new Date(ts);
|
|
44
|
+
const now = Date.now();
|
|
45
|
+
const diffMs = now - d.getTime();
|
|
46
|
+
if (diffMs < 60_000)
|
|
47
|
+
return "just now";
|
|
48
|
+
if (diffMs < 3600_000)
|
|
49
|
+
return `${Math.floor(diffMs / 60_000)}m ago`;
|
|
50
|
+
if (diffMs < 86400_000)
|
|
51
|
+
return `${Math.floor(diffMs / 3600_000)}h ago`;
|
|
52
|
+
return `${Math.floor(diffMs / 86400_000)}d ago`;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return ts.slice(11, 19); // fallback: HH:MM:SS
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export class GSDNotificationOverlay {
|
|
59
|
+
tui;
|
|
60
|
+
theme;
|
|
61
|
+
onClose;
|
|
62
|
+
cachedWidth;
|
|
63
|
+
cachedLines;
|
|
64
|
+
scrollOffset = 0;
|
|
65
|
+
filterIndex = 0;
|
|
66
|
+
entries = [];
|
|
67
|
+
refreshTimer;
|
|
68
|
+
disposed = false;
|
|
69
|
+
resizeHandler = null;
|
|
70
|
+
constructor(tui, theme, onClose) {
|
|
71
|
+
this.tui = tui;
|
|
72
|
+
this.theme = theme;
|
|
73
|
+
this.onClose = onClose;
|
|
74
|
+
// Mark all as read on open
|
|
75
|
+
markAllRead();
|
|
76
|
+
this.entries = readNotifications();
|
|
77
|
+
// Resize handler
|
|
78
|
+
this.resizeHandler = () => {
|
|
79
|
+
if (this.disposed)
|
|
80
|
+
return;
|
|
81
|
+
this.invalidate();
|
|
82
|
+
this.tui.requestRender();
|
|
83
|
+
};
|
|
84
|
+
process.stdout.on("resize", this.resizeHandler);
|
|
85
|
+
// Refresh every 3s for new notifications
|
|
86
|
+
this.refreshTimer = setInterval(() => {
|
|
87
|
+
if (this.disposed)
|
|
88
|
+
return;
|
|
89
|
+
const fresh = readNotifications();
|
|
90
|
+
if (fresh.length !== this.entries.length) {
|
|
91
|
+
this.entries = fresh;
|
|
92
|
+
markAllRead();
|
|
93
|
+
this.invalidate();
|
|
94
|
+
this.tui.requestRender();
|
|
95
|
+
}
|
|
96
|
+
}, 3000);
|
|
97
|
+
}
|
|
98
|
+
get filter() {
|
|
99
|
+
return FILTER_CYCLE[this.filterIndex];
|
|
100
|
+
}
|
|
101
|
+
get filteredEntries() {
|
|
102
|
+
if (this.filter === "all")
|
|
103
|
+
return this.entries;
|
|
104
|
+
return this.entries.filter((e) => e.severity === this.filter);
|
|
105
|
+
}
|
|
106
|
+
handleInput(data) {
|
|
107
|
+
if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c")) || matchesKey(data, Key.ctrlAlt("n"))) {
|
|
108
|
+
this.dispose();
|
|
109
|
+
this.onClose();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
// Scroll
|
|
113
|
+
if (matchesKey(data, Key.down) || matchesKey(data, "j")) {
|
|
114
|
+
this.scrollOffset++;
|
|
115
|
+
this.invalidate();
|
|
116
|
+
this.tui.requestRender();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (matchesKey(data, Key.up) || matchesKey(data, "k")) {
|
|
120
|
+
this.scrollOffset = Math.max(0, this.scrollOffset - 1);
|
|
121
|
+
this.invalidate();
|
|
122
|
+
this.tui.requestRender();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (data === "g") {
|
|
126
|
+
this.scrollOffset = 0;
|
|
127
|
+
this.invalidate();
|
|
128
|
+
this.tui.requestRender();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (data === "G") {
|
|
132
|
+
this.scrollOffset = 999;
|
|
133
|
+
this.invalidate();
|
|
134
|
+
this.tui.requestRender();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// Filter cycle
|
|
138
|
+
if (data === "f") {
|
|
139
|
+
this.filterIndex = (this.filterIndex + 1) % FILTER_CYCLE.length;
|
|
140
|
+
this.scrollOffset = 0;
|
|
141
|
+
this.invalidate();
|
|
142
|
+
this.tui.requestRender();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
// Clear all
|
|
146
|
+
if (data === "c") {
|
|
147
|
+
clearNotifications();
|
|
148
|
+
this.entries = [];
|
|
149
|
+
this.scrollOffset = 0;
|
|
150
|
+
this.invalidate();
|
|
151
|
+
this.tui.requestRender();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
render(width) {
|
|
156
|
+
if (this.cachedLines && this.cachedWidth === width) {
|
|
157
|
+
return this.cachedLines;
|
|
158
|
+
}
|
|
159
|
+
const content = this.buildContentLines(width);
|
|
160
|
+
const maxVisibleRows = Math.max(5, process.stdout.rows ? process.stdout.rows - 8 : 24) - 2;
|
|
161
|
+
const visibleContentRows = Math.min(content.length, maxVisibleRows);
|
|
162
|
+
const maxScroll = Math.max(0, content.length - visibleContentRows);
|
|
163
|
+
this.scrollOffset = Math.min(this.scrollOffset, maxScroll);
|
|
164
|
+
const visibleContent = content.slice(this.scrollOffset, this.scrollOffset + visibleContentRows);
|
|
165
|
+
const lines = this.wrapInBox(visibleContent, width);
|
|
166
|
+
this.cachedWidth = width;
|
|
167
|
+
this.cachedLines = lines;
|
|
168
|
+
return lines;
|
|
169
|
+
}
|
|
170
|
+
invalidate() {
|
|
171
|
+
this.cachedLines = undefined;
|
|
172
|
+
this.cachedWidth = undefined;
|
|
173
|
+
}
|
|
174
|
+
dispose() {
|
|
175
|
+
this.disposed = true;
|
|
176
|
+
clearInterval(this.refreshTimer);
|
|
177
|
+
if (this.resizeHandler) {
|
|
178
|
+
process.stdout.removeListener("resize", this.resizeHandler);
|
|
179
|
+
this.resizeHandler = null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
wrapInBox(inner, width) {
|
|
183
|
+
const th = this.theme;
|
|
184
|
+
const border = (s) => th.fg("borderAccent", s);
|
|
185
|
+
const innerWidth = width - 4;
|
|
186
|
+
const lines = [];
|
|
187
|
+
lines.push(border("╭" + "─".repeat(width - 2) + "╮"));
|
|
188
|
+
for (const line of inner) {
|
|
189
|
+
const truncated = truncateToWidth(line, innerWidth);
|
|
190
|
+
const padWidth = Math.max(0, innerWidth - visibleWidth(truncated));
|
|
191
|
+
lines.push(border("│") + " " + truncated + " ".repeat(padWidth) + " " + border("│"));
|
|
192
|
+
}
|
|
193
|
+
lines.push(border("╰" + "─".repeat(width - 2) + "╯"));
|
|
194
|
+
return lines;
|
|
195
|
+
}
|
|
196
|
+
buildContentLines(width) {
|
|
197
|
+
const th = this.theme;
|
|
198
|
+
const shellWidth = width - 4;
|
|
199
|
+
const contentWidth = Math.min(shellWidth, 128);
|
|
200
|
+
const sidePad = Math.max(0, Math.floor((shellWidth - contentWidth) / 2));
|
|
201
|
+
const leftMargin = " ".repeat(sidePad);
|
|
202
|
+
const lines = [];
|
|
203
|
+
const row = (content = "") => {
|
|
204
|
+
const truncated = truncateToWidth(content, contentWidth);
|
|
205
|
+
return leftMargin + padRight(truncated, contentWidth);
|
|
206
|
+
};
|
|
207
|
+
const blank = () => row("");
|
|
208
|
+
const hr = () => row(th.fg("dim", "─".repeat(contentWidth)));
|
|
209
|
+
// Header
|
|
210
|
+
const title = th.fg("accent", th.bold("Notifications"));
|
|
211
|
+
const filterLabel = this.filter === "all"
|
|
212
|
+
? th.fg("dim", "all")
|
|
213
|
+
: th.fg(this.filter === "error" ? "error" : this.filter === "warning" ? "warning" : "dim", this.filter);
|
|
214
|
+
const count = `${this.filteredEntries.length} entries`;
|
|
215
|
+
lines.push(row(joinColumns(`${title} ${th.fg("dim", "filter:")} ${filterLabel}`, th.fg("dim", count), contentWidth)));
|
|
216
|
+
lines.push(hr());
|
|
217
|
+
// Controls
|
|
218
|
+
lines.push(row(th.fg("dim", "↑/↓ scroll f filter c clear Esc close")));
|
|
219
|
+
lines.push(blank());
|
|
220
|
+
// Entries
|
|
221
|
+
const filtered = this.filteredEntries;
|
|
222
|
+
if (filtered.length === 0) {
|
|
223
|
+
lines.push(blank());
|
|
224
|
+
lines.push(row(th.fg("dim", this.entries.length === 0
|
|
225
|
+
? "No notifications yet."
|
|
226
|
+
: `No ${this.filter} notifications.`)));
|
|
227
|
+
lines.push(blank());
|
|
228
|
+
return lines;
|
|
229
|
+
}
|
|
230
|
+
for (const entry of filtered) {
|
|
231
|
+
const icon = severityIcon(entry.severity);
|
|
232
|
+
const coloredIcon = entry.severity === "error" ? th.fg("error", icon)
|
|
233
|
+
: entry.severity === "warning" ? th.fg("warning", icon)
|
|
234
|
+
: entry.severity === "success" ? th.fg("success", icon)
|
|
235
|
+
: th.fg("dim", icon);
|
|
236
|
+
const time = th.fg("dim", formatTimestamp(entry.ts));
|
|
237
|
+
const source = entry.source === "workflow-logger" ? th.fg("dim", " [engine]") : "";
|
|
238
|
+
// Measure actual prefix width for wrapping
|
|
239
|
+
const prefix = `${coloredIcon} ${time}${source} `;
|
|
240
|
+
const prefixWidth = visibleWidth(prefix);
|
|
241
|
+
const msgMaxWidth = Math.max(10, contentWidth - prefixWidth);
|
|
242
|
+
// Wrap long messages onto continuation lines indented to align with message start
|
|
243
|
+
const msgLines = wrapText(entry.message, msgMaxWidth);
|
|
244
|
+
const indent = " ".repeat(prefixWidth);
|
|
245
|
+
for (let i = 0; i < msgLines.length; i++) {
|
|
246
|
+
if (i === 0) {
|
|
247
|
+
lines.push(row(`${prefix}${msgLines[i]}`));
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
lines.push(row(`${indent}${msgLines[i]}`));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return lines;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// GSD Extension — Persistent Notification Store
|
|
2
|
+
// Captures all ctx.ui.notify() calls and workflow-logger warnings to
|
|
3
|
+
// .gsd/notifications.jsonl so they survive context resets and session restarts.
|
|
4
|
+
// Rotates at MAX_ENTRIES to prevent unbounded growth.
|
|
5
|
+
import { appendFileSync, existsSync, mkdirSync, openSync, closeSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
// ─── Constants ──────────────────────────────────────────────────────────
|
|
9
|
+
const MAX_ENTRIES = 500;
|
|
10
|
+
const FILENAME = "notifications.jsonl";
|
|
11
|
+
const LOCKFILE = "notifications.lock";
|
|
12
|
+
// ─── Module State ───────────────────────────────────────────────────────
|
|
13
|
+
let _basePath = null;
|
|
14
|
+
let _lineCount = 0; // Hint for rotation — not authoritative for public API
|
|
15
|
+
let _suppressCount = 0;
|
|
16
|
+
// ─── Public API ─────────────────────────────────────────────────────────
|
|
17
|
+
/**
|
|
18
|
+
* Initialize the notification store. Call once at session start with the
|
|
19
|
+
* project root. Seeds in-memory counters from the existing file on disk.
|
|
20
|
+
*/
|
|
21
|
+
export function initNotificationStore(basePath) {
|
|
22
|
+
_basePath = basePath;
|
|
23
|
+
// Seed line count hint for rotation — public counters read from disk
|
|
24
|
+
_lineCount = _readEntriesFromDisk(basePath).length;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Append a notification entry to the store. Synchronous — safe to call
|
|
28
|
+
* from the notify() shim which is declared void (not async).
|
|
29
|
+
*/
|
|
30
|
+
export function appendNotification(message, severity, source = "notify") {
|
|
31
|
+
if (!_basePath)
|
|
32
|
+
return;
|
|
33
|
+
if (_suppressCount > 0)
|
|
34
|
+
return;
|
|
35
|
+
const entry = {
|
|
36
|
+
id: randomUUID(),
|
|
37
|
+
ts: new Date().toISOString(),
|
|
38
|
+
severity,
|
|
39
|
+
message: message.length > 500 ? message.slice(0, 500) + "…" : message,
|
|
40
|
+
source,
|
|
41
|
+
read: false,
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
const dir = join(_basePath, ".gsd");
|
|
45
|
+
mkdirSync(dir, { recursive: true });
|
|
46
|
+
appendFileSync(join(dir, FILENAME), JSON.stringify(entry) + "\n", "utf-8");
|
|
47
|
+
_lineCount++;
|
|
48
|
+
// Rotate if hint suggests we're over limit
|
|
49
|
+
if (_lineCount > MAX_ENTRIES) {
|
|
50
|
+
_rotate();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Non-fatal — never let persistence break the caller
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Read all notification entries from disk. Returns newest-first.
|
|
59
|
+
*/
|
|
60
|
+
export function readNotifications(basePath) {
|
|
61
|
+
const bp = basePath ?? _basePath;
|
|
62
|
+
if (!bp)
|
|
63
|
+
return [];
|
|
64
|
+
return _readEntriesFromDisk(bp).reverse();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Mark all notifications as read. Atomic rewrite via temp-file + rename.
|
|
68
|
+
* Resyncs in-memory counters from disk after mutation.
|
|
69
|
+
*/
|
|
70
|
+
export function markAllRead(basePath) {
|
|
71
|
+
const bp = basePath ?? _basePath;
|
|
72
|
+
if (!bp)
|
|
73
|
+
return;
|
|
74
|
+
const entries = _readEntriesFromDisk(bp);
|
|
75
|
+
if (entries.length === 0)
|
|
76
|
+
return;
|
|
77
|
+
const hasUnread = entries.some((e) => !e.read);
|
|
78
|
+
if (!hasUnread)
|
|
79
|
+
return;
|
|
80
|
+
try {
|
|
81
|
+
_withLock(bp, () => {
|
|
82
|
+
// Re-read inside lock to get freshest state
|
|
83
|
+
const fresh = _readEntriesFromDisk(bp);
|
|
84
|
+
if (fresh.length === 0 || !fresh.some((e) => !e.read))
|
|
85
|
+
return;
|
|
86
|
+
const lines = fresh.map((e) => JSON.stringify({ ...e, read: true }));
|
|
87
|
+
_atomicWrite(bp, lines.join("\n") + "\n");
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Non-fatal
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Clear all notifications. Atomic write of empty content under lock.
|
|
96
|
+
*/
|
|
97
|
+
export function clearNotifications(basePath) {
|
|
98
|
+
const bp = basePath ?? _basePath;
|
|
99
|
+
if (!bp)
|
|
100
|
+
return;
|
|
101
|
+
try {
|
|
102
|
+
_withLock(bp, () => {
|
|
103
|
+
_atomicWrite(bp, "");
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Non-fatal
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get the current unread count. Reads from disk to stay accurate across
|
|
112
|
+
* processes (web subprocess can clear/modify the file independently).
|
|
113
|
+
*/
|
|
114
|
+
export function getUnreadCount() {
|
|
115
|
+
if (!_basePath)
|
|
116
|
+
return 0;
|
|
117
|
+
try {
|
|
118
|
+
const entries = _readEntriesFromDisk(_basePath);
|
|
119
|
+
return entries.filter((e) => !e.read).length;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get the total notification count. Reads from disk for cross-process accuracy.
|
|
127
|
+
*/
|
|
128
|
+
export function getLineCount() {
|
|
129
|
+
if (!_basePath)
|
|
130
|
+
return 0;
|
|
131
|
+
try {
|
|
132
|
+
return _readEntriesFromDisk(_basePath).length;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Temporarily suppress persistence. Use around ctx.ui.notify calls that
|
|
140
|
+
* should NOT be persisted (e.g., confirmation toasts after clear).
|
|
141
|
+
* Calls are ref-counted — nest safely.
|
|
142
|
+
*/
|
|
143
|
+
export function suppressPersistence() {
|
|
144
|
+
_suppressCount++;
|
|
145
|
+
}
|
|
146
|
+
export function unsuppressPersistence() {
|
|
147
|
+
_suppressCount = Math.max(0, _suppressCount - 1);
|
|
148
|
+
}
|
|
149
|
+
// ─── Test Helpers ───────────────────────────────────────────────────────
|
|
150
|
+
/**
|
|
151
|
+
* Reset module state. Only for use in tests.
|
|
152
|
+
*/
|
|
153
|
+
export function _resetNotificationStore() {
|
|
154
|
+
_basePath = null;
|
|
155
|
+
_lineCount = 0;
|
|
156
|
+
_suppressCount = 0;
|
|
157
|
+
}
|
|
158
|
+
// ─── Internal ───────────────────────────────────────────────────────────
|
|
159
|
+
function _readEntriesFromDisk(basePath) {
|
|
160
|
+
const filePath = join(basePath, ".gsd", FILENAME);
|
|
161
|
+
if (!existsSync(filePath))
|
|
162
|
+
return [];
|
|
163
|
+
try {
|
|
164
|
+
const content = readFileSync(filePath, "utf-8");
|
|
165
|
+
return content
|
|
166
|
+
.split("\n")
|
|
167
|
+
.filter((l) => l.length > 0)
|
|
168
|
+
.map((l) => {
|
|
169
|
+
try {
|
|
170
|
+
return JSON.parse(l);
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
.filter((e) => e !== null);
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function _rotate() {
|
|
183
|
+
if (!_basePath)
|
|
184
|
+
return;
|
|
185
|
+
try {
|
|
186
|
+
_withLock(_basePath, () => {
|
|
187
|
+
// Re-read inside lock to get freshest state
|
|
188
|
+
const entries = _readEntriesFromDisk(_basePath);
|
|
189
|
+
if (entries.length <= MAX_ENTRIES)
|
|
190
|
+
return;
|
|
191
|
+
const trimmed = entries.slice(entries.length - MAX_ENTRIES);
|
|
192
|
+
const lines = trimmed.map((e) => JSON.stringify(e));
|
|
193
|
+
_atomicWrite(_basePath, lines.join("\n") + "\n");
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
// Non-fatal
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Atomic file rewrite via temp-file + rename. Prevents partial reads
|
|
202
|
+
* by other processes (web API subprocess, parallel workers).
|
|
203
|
+
* Must be called inside _withLock for cross-process safety.
|
|
204
|
+
*/
|
|
205
|
+
function _atomicWrite(basePath, content) {
|
|
206
|
+
const dir = join(basePath, ".gsd");
|
|
207
|
+
mkdirSync(dir, { recursive: true });
|
|
208
|
+
const target = join(dir, FILENAME);
|
|
209
|
+
const tmp = target + ".tmp." + process.pid;
|
|
210
|
+
writeFileSync(tmp, content, "utf-8");
|
|
211
|
+
renameSync(tmp, target);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Acquire an exclusive lockfile for rewrite operations.
|
|
215
|
+
* Uses O_CREAT|O_EXCL for atomic creation — if the file exists, another
|
|
216
|
+
* process holds the lock. Retries briefly, then proceeds anyway (best-effort)
|
|
217
|
+
* to avoid deadlocking the UI on a stale lock.
|
|
218
|
+
*/
|
|
219
|
+
function _withLock(basePath, fn) {
|
|
220
|
+
const lockPath = join(basePath, ".gsd", LOCKFILE);
|
|
221
|
+
let fd = null;
|
|
222
|
+
const maxAttempts = 5;
|
|
223
|
+
const retryMs = 20;
|
|
224
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
225
|
+
try {
|
|
226
|
+
mkdirSync(join(basePath, ".gsd"), { recursive: true });
|
|
227
|
+
fd = openSync(lockPath, "wx");
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
if (err?.code === "EEXIST") {
|
|
232
|
+
// Check if lock is stale (older than 5s)
|
|
233
|
+
try {
|
|
234
|
+
const stat = readFileSync(lockPath, "utf-8");
|
|
235
|
+
const lockTime = parseInt(stat, 10);
|
|
236
|
+
if (Date.now() - lockTime > 5000) {
|
|
237
|
+
try {
|
|
238
|
+
unlinkSync(lockPath);
|
|
239
|
+
}
|
|
240
|
+
catch { /* race ok */ }
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch { /* can't read lock, retry */ }
|
|
245
|
+
// Wait and retry
|
|
246
|
+
const start = Date.now();
|
|
247
|
+
while (Date.now() - start < retryMs) { /* spin */ }
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
// Other error — proceed without lock
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// Only run the mutation if we actually own the lock
|
|
255
|
+
const ownsLock = fd !== null;
|
|
256
|
+
try {
|
|
257
|
+
if (ownsLock && fd !== null) {
|
|
258
|
+
// Write our PID timestamp into the lock for stale detection
|
|
259
|
+
writeFileSync(lockPath, String(Date.now()), "utf-8");
|
|
260
|
+
closeSync(fd);
|
|
261
|
+
}
|
|
262
|
+
return fn();
|
|
263
|
+
}
|
|
264
|
+
finally {
|
|
265
|
+
// Only delete the lock if we created it — never remove another process's lock
|
|
266
|
+
if (ownsLock) {
|
|
267
|
+
try {
|
|
268
|
+
unlinkSync(lockPath);
|
|
269
|
+
}
|
|
270
|
+
catch { /* best-effort cleanup */ }
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// GSD Extension — Notification Widget
|
|
2
|
+
// Always-on ambient widget rendered belowEditor showing unread count and
|
|
3
|
+
// the most recent notification message. Refreshes every 5 seconds.
|
|
4
|
+
// Widget key: "gsd-notifications", placement: "belowEditor"
|
|
5
|
+
import { getUnreadCount, readNotifications } from "./notification-store.js";
|
|
6
|
+
// ─── Pure rendering ──���────────────────────────���─────────────────────────
|
|
7
|
+
export function buildNotificationWidgetLines() {
|
|
8
|
+
const unread = getUnreadCount();
|
|
9
|
+
if (unread === 0)
|
|
10
|
+
return [];
|
|
11
|
+
const entries = readNotifications();
|
|
12
|
+
const latest = entries[0]; // newest-first
|
|
13
|
+
if (!latest)
|
|
14
|
+
return [];
|
|
15
|
+
const icon = latest.severity === "error" ? "✗" : latest.severity === "warning" ? "⚠" : "●";
|
|
16
|
+
const badge = `${unread} unread`;
|
|
17
|
+
const msgMax = 80;
|
|
18
|
+
const truncated = latest.message.length > msgMax
|
|
19
|
+
? latest.message.slice(0, msgMax - 1) + "…"
|
|
20
|
+
: latest.message;
|
|
21
|
+
return [` ${icon} [${badge}] ${truncated} (Ctrl+Alt+N to view)`];
|
|
22
|
+
}
|
|
23
|
+
// ─── Widget init ────────────────────────────────────────────────────────
|
|
24
|
+
const REFRESH_INTERVAL_MS = 5_000;
|
|
25
|
+
/**
|
|
26
|
+
* Initialize the always-on notification widget (belowEditor).
|
|
27
|
+
* Call once from session_start after the notification store is initialized.
|
|
28
|
+
*/
|
|
29
|
+
export function initNotificationWidget(ctx) {
|
|
30
|
+
if (!ctx.hasUI)
|
|
31
|
+
return;
|
|
32
|
+
// String-array fallback for RPC mode
|
|
33
|
+
ctx.ui.setWidget("gsd-notifications", buildNotificationWidgetLines(), { placement: "belowEditor" });
|
|
34
|
+
// Factory-based widget for TUI mode
|
|
35
|
+
ctx.ui.setWidget("gsd-notifications", (_tui, _theme) => {
|
|
36
|
+
let cachedLines;
|
|
37
|
+
const refresh = () => {
|
|
38
|
+
cachedLines = undefined;
|
|
39
|
+
_tui.requestRender();
|
|
40
|
+
};
|
|
41
|
+
const refreshTimer = setInterval(refresh, REFRESH_INTERVAL_MS);
|
|
42
|
+
return {
|
|
43
|
+
render(_width) {
|
|
44
|
+
if (!cachedLines)
|
|
45
|
+
cachedLines = buildNotificationWidgetLines();
|
|
46
|
+
return cachedLines;
|
|
47
|
+
},
|
|
48
|
+
invalidate() {
|
|
49
|
+
cachedLines = undefined;
|
|
50
|
+
},
|
|
51
|
+
dispose() {
|
|
52
|
+
clearInterval(refreshTimer);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}, { placement: "belowEditor" });
|
|
56
|
+
}
|
|
@@ -440,19 +440,25 @@ export function spawnWorker(basePath, milestoneId) {
|
|
|
440
440
|
return false;
|
|
441
441
|
let child;
|
|
442
442
|
try {
|
|
443
|
+
const workerEnv = {
|
|
444
|
+
...process.env,
|
|
445
|
+
GSD_MILESTONE_LOCK: milestoneId,
|
|
446
|
+
// Pass the real project root so workers don't need to re-derive it.
|
|
447
|
+
// Without this, process.cwd() resolves symlinks and the worktree
|
|
448
|
+
// path heuristic can match the user-level ~/.gsd instead of the
|
|
449
|
+
// project .gsd, causing writes to ~ and corrupting user config.
|
|
450
|
+
GSD_PROJECT_ROOT: basePath,
|
|
451
|
+
// Prevent workers from spawning their own parallel sessions
|
|
452
|
+
GSD_PARALLEL_WORKER: "1",
|
|
453
|
+
};
|
|
454
|
+
// Apply worker model override if configured, so workers use a cheaper
|
|
455
|
+
// model (e.g. Haiku) rather than inheriting the coordinator's model.
|
|
456
|
+
if (state.config.worker_model) {
|
|
457
|
+
workerEnv.GSD_WORKER_MODEL = state.config.worker_model;
|
|
458
|
+
}
|
|
443
459
|
child = spawn(process.execPath, [binPath, "headless", "--json", "auto"], {
|
|
444
460
|
cwd: worker.worktreePath,
|
|
445
|
-
env:
|
|
446
|
-
...process.env,
|
|
447
|
-
GSD_MILESTONE_LOCK: milestoneId,
|
|
448
|
-
// Pass the real project root so workers don't need to re-derive it.
|
|
449
|
-
// Without this, process.cwd() resolves symlinks and the worktree
|
|
450
|
-
// path heuristic can match the user-level ~/.gsd instead of the
|
|
451
|
-
// project .gsd, causing writes to ~ and corrupting user config.
|
|
452
|
-
GSD_PROJECT_ROOT: basePath,
|
|
453
|
-
// Prevent workers from spawning their own parallel sessions
|
|
454
|
-
GSD_PARALLEL_WORKER: "1",
|
|
455
|
-
},
|
|
461
|
+
env: workerEnv,
|
|
456
462
|
stdio: ["ignore", "pipe", "pipe"],
|
|
457
463
|
detached: false,
|
|
458
464
|
});
|