@weavecode/weave 0.1.8 → 0.1.9
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/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/dist/index.cjs +31 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/dist/index.mjs +31 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.cjs +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.mjs +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/README.md +39 -39
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/dist/ipv6.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/package.json +1 -1
- package/node_modules/@weavecode/cli/dist/cli.js +4 -4
- package/node_modules/@weavecode/cli/dist/commands/chpass.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/daemon-auth.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/daemon.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/dashboard.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/msg.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/scan.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/uninstall.js +1 -1
- package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +2 -2
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +7 -0
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +3 -3
- package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
- package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +5 -5
- package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
- package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
- package/node_modules/@weavecode/cli/dist/init/git-exclude.d.ts +20 -0
- package/node_modules/@weavecode/cli/dist/init/git-exclude.js +7 -0
- package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
- package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/instruction-files.d.ts +14 -0
- package/node_modules/@weavecode/cli/dist/init/instruction-files.js +1 -0
- package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
- package/node_modules/@weavecode/cli/dist/init/provision.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
- package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
- package/node_modules/@weavecode/cli/dist/parser.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
- package/node_modules/@weavecode/cli/package.json +5 -5
- package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
- package/node_modules/@weavecode/core/dist/harness.d.ts +37 -0
- package/node_modules/@weavecode/core/dist/harness.js +1 -1
- package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
- package/node_modules/@weavecode/core/dist/index.js +1 -1
- package/node_modules/@weavecode/core/dist/platform.js +1 -1
- package/node_modules/@weavecode/core/dist/types.d.ts +4 -4
- package/node_modules/@weavecode/core/dist/types.js +1 -1
- package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
- package/node_modules/@weavecode/core/package.json +1 -1
- package/node_modules/@weavecode/harness/dist/claude/assets.js +3 -3
- package/node_modules/@weavecode/harness/dist/claude/capture.js +9 -9
- package/node_modules/@weavecode/harness/dist/claude/commands.js +3 -3
- package/node_modules/@weavecode/harness/dist/claude/config.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/edits.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/images.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/liveness.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/mcp-gen.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/messaging.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/narration.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/peers.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/plan.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/plugins.js +4 -4
- package/node_modules/@weavecode/harness/dist/claude/prompt-inbox.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/prompt.js +3 -3
- package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/resume.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/rewind.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/side-question.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/statusline/generator.d.ts +6 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +21 -14
- package/node_modules/@weavecode/harness/dist/claude/statusline/git-cache.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/statusline/surface.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/transcript.js +7 -7
- package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/capture.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/commands.js +4 -4
- package/node_modules/@weavecode/harness/dist/codex/config.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/detect.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/event-source.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/images.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/index.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/liveness.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/mcp.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/messaging.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/narration.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/plugin-state.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/plugins.js +3 -3
- package/node_modules/@weavecode/harness/dist/codex/provision.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/questions.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/rollout.js +5 -5
- package/node_modules/@weavecode/harness/dist/codex/side-question.js +4 -4
- package/node_modules/@weavecode/harness/dist/codex/titles.js +4 -4
- package/node_modules/@weavecode/harness/dist/codex/toml.js +13 -13
- package/node_modules/@weavecode/harness/dist/codex/transcript.js +2 -2
- package/node_modules/@weavecode/harness/dist/driver.js +1 -1
- package/node_modules/@weavecode/harness/dist/init/generated.js +2 -2
- package/node_modules/@weavecode/harness/dist/init/pipeline.js +1 -1
- package/node_modules/@weavecode/harness/dist/registry-wiring.js +1 -1
- package/node_modules/@weavecode/harness/dist/shared/install-link.js +1 -1
- package/node_modules/@weavecode/harness/dist/shared/json-cap.js +1 -1
- package/node_modules/@weavecode/harness/dist/zcode/assets.js +1 -1
- package/node_modules/@weavecode/harness/dist/zcode/capture.js +3 -3
- package/node_modules/@weavecode/harness/dist/zcode/mcp.js +2 -2
- package/node_modules/@weavecode/harness/package.json +2 -2
- package/node_modules/@weavecode/server/dist/config/dotted.js +1 -1
- package/node_modules/@weavecode/server/dist/config/profiles.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/ai-config.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/ai-context.js +6 -6
- package/node_modules/@weavecode/server/dist/daemon/ai-routes.js +4 -4
- package/node_modules/@weavecode/server/dist/daemon/api-log.js +3 -3
- package/node_modules/@weavecode/server/dist/daemon/auth-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/auto-start.js +3 -3
- package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/config-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/cron.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/dashboard-auth.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/dashboard-pusher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/decision-config.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/entry.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/fs-browser.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/http.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/liveness.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/mcp-orchestration.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/narration-watcher.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/launch.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/pty-terminals.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/shared.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/wezterm-mux.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/wt.js +3 -3
- package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/pet-seed.d.ts +4 -6
- package/node_modules/@weavecode/server/dist/daemon/pet-seed.js +2 -1
- package/node_modules/@weavecode/server/dist/daemon/pet-window.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/project-files.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/project-harnesses.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/project-updates-refresher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/prompt-images.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/hooks-admin.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/installations.d.ts +29 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/installations.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/market.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/orchestration.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/path-refs.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/pets.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/project-files.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/projects.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/search.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/session-control.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/session-insights.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/settings-statusline.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/uploads.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/routes/watches.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/server.d.ts +2 -0
- package/node_modules/@weavecode/server/dist/daemon/server.js +8 -8
- package/node_modules/@weavecode/server/dist/daemon/session-open.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/settings.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/snapshot-refresher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/sse-hub.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/state.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/static.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/terminal-topology-refresher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/tls.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/toolkit-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/upload-sessions.js +1 -1
- package/node_modules/@weavecode/server/dist/db/db.js +2 -2
- package/node_modules/@weavecode/server/dist/db/layout.d.ts +5 -0
- package/node_modules/@weavecode/server/dist/db/layout.js +2 -1
- package/node_modules/@weavecode/server/dist/db/paths.d.ts +5 -0
- package/node_modules/@weavecode/server/dist/db/paths.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/answer-keys.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/dashboard-rate.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/decision-judge.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/channels.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/keys.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/queue.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/relay.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/send.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/dispatcher.js +6 -6
- package/node_modules/@weavecode/server/dist/hooks/edge-extract.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/handlers/webhook.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/headless-runner.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/inbox-socket.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/inbox-worker.js +3 -3
- package/node_modules/@weavecode/server/dist/hooks/match.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +5 -5
- package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
- package/node_modules/@weavecode/server/dist/hooks/orchestration-engine.js +7 -7
- package/node_modules/@weavecode/server/dist/hooks/orchestration-graph.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/plugin-installer.js +3 -3
- package/node_modules/@weavecode/server/dist/hooks/plugin-loader.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/plugin-project-state.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/prompt-flusher.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/promptbox.js +8 -8
- package/node_modules/@weavecode/server/dist/hooks/push-notify.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/question-tracker.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/registry.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/resume-runner.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/side-questions.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/synthetic-sessions.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/toolkit-scan.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
- package/node_modules/@weavecode/server/dist/hooks/watch-engine.js +1 -1
- package/node_modules/@weavecode/server/dist/install/apply-update.js +1 -1
- package/node_modules/@weavecode/server/dist/install/capabilities.js +1 -1
- package/node_modules/@weavecode/server/dist/install/codex-toml.js +1 -1
- package/node_modules/@weavecode/server/dist/install/file-assets.js +1 -1
- package/node_modules/@weavecode/server/dist/install/fingerprint.js +1 -1
- package/node_modules/@weavecode/server/dist/install/global-config.js +1 -1
- package/node_modules/@weavecode/server/dist/install/global-file-assets.js +1 -1
- package/node_modules/@weavecode/server/dist/install/init-files.d.ts +0 -9
- package/node_modules/@weavecode/server/dist/install/init-files.js +2 -2
- package/node_modules/@weavecode/server/dist/install/install-ledger.js +1 -1
- package/node_modules/@weavecode/server/dist/install/installer.js +1 -1
- package/node_modules/@weavecode/server/dist/install/library-index.js +1 -1
- package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-install.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-rows.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-templates.js +1 -1
- package/node_modules/@weavecode/server/dist/install/project-config.js +1 -1
- package/node_modules/@weavecode/server/dist/install/reader.js +1 -1
- package/node_modules/@weavecode/server/dist/install/scan-cache.js +1 -1
- package/node_modules/@weavecode/server/dist/install/scanner.js +1 -1
- package/node_modules/@weavecode/server/dist/install/settings-mcp.js +2 -2
- package/node_modules/@weavecode/server/dist/install/updates.js +1 -1
- package/node_modules/@weavecode/server/dist/market/builtin.js +1 -1
- package/node_modules/@weavecode/server/dist/market/identity.js +1 -1
- package/node_modules/@weavecode/server/dist/market/import.js +2 -2
- package/node_modules/@weavecode/server/dist/market/refresh.js +1 -1
- package/node_modules/@weavecode/server/dist/market/resolve.js +1 -1
- package/node_modules/@weavecode/server/dist/market/updates.js +1 -1
- package/node_modules/@weavecode/server/dist/registry.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/hook-dispatches.js +4 -4
- package/node_modules/@weavecode/server/dist/repositories/hook-events.js +6 -6
- package/node_modules/@weavecode/server/dist/repositories/hook-rules.js +4 -4
- package/node_modules/@weavecode/server/dist/repositories/libraries.js +1 -1
- package/node_modules/@weavecode/server/dist/repositories/orchestrations.js +7 -7
- package/node_modules/@weavecode/server/dist/repositories/plugin-states.js +1 -1
- package/node_modules/@weavecode/server/dist/repositories/projects.js +1 -1
- package/node_modules/@weavecode/server/dist/repositories/push-subscriptions.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/session-watches.js +4 -4
- package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/uploads.js +11 -11
- package/node_modules/@weavecode/server/dist/statusline/cache-sweeper.js +1 -1
- package/node_modules/@weavecode/server/dist/statusline/generator.js +1 -1
- package/node_modules/@weavecode/server/dist/statusline/manager.js +3 -3
- package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/cache.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/classifier.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/plugin-mods.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/sync-scheduler.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/watch-service.js +1 -1
- package/node_modules/@weavecode/server/package.json +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/{abnfDiagram-WEYOIA3C-t5OQjhuS.js → abnfDiagram-WEYOIA3C-S1lL1V_n.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{arc-De-uH_Q9.js → arc-CoTNHyHV.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{architectureDiagram-ZHVYKT53-ImPclD43.js → architectureDiagram-ZHVYKT53-C6ttfnzW.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-B5xEQs6X.js → blockDiagram-RJAE7QA3-CYr3Cpu9.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-DP8MjIgJ.js → c4Diagram-XDPPPE54-BFS7PhLD.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/channel-DxQHp3Yc.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-C3UFIDyj.js → chunk-2E7WHVMD-DJ7X_Shu.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-Bgw-3YfG.js → chunk-2Q5K7J3B-B8nr2rdz.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-Dy_Wq9qn.js → chunk-4EMNKR2T-DmnZmUMU.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-55XCU76K-D32C0DXX.js → chunk-55XCU76K-Xz9a8dmp.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-Dpmi-9Gi.js → chunk-5VM5RSS4-Dg9mg7pf.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-CEYXaZDX.js → chunk-JWPE2WC7-CmjTZO8o.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-A616Pgzo.js → chunk-VQ5W62QI-D3YDdJ3E.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-XXDRQBXY-CnxFMLWV.js → chunk-XXDRQBXY-s1OG9sqW.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-ZCHMQSOR-BhjCTig8.js → chunk-ZCHMQSOR-C3hINQU3.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-rzlq5tPv.js → classDiagram-v2-4MYWR3UA-BTsbYrVl.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cose-bilkent-JH36ORCC-CxWQXzj8.js → cose-bilkent-JH36ORCC-C0W8Y-jI.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-AFHjx2wU.js → cynefin-EF2NZ3EQ-stAu4Rh-.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cynefinDiagram-WF24UDRP-Bp_Oaf9U.js → cynefinDiagram-WF24UDRP-CqYibiiv.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{dagre-NK4GIZVX-7oUPIU35.js → dagre-NK4GIZVX-qqcoJAqB.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-CBK3MWTC-D_rS_rSY.js → diagram-CBK3MWTC-D0YTopb7.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-I5XIIV2D-Duc_cKMb.js → diagram-I5XIIV2D-Csvw6aYr.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-DA0XFVXm.js → diagram-ODIL2UCW-Dl0tYLkF.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-D1U0Xhtt.js → diagram-PFBEJUXE-BCPSWZPe.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-RJA3I4VV-CbDFY871.js → diagram-RJA3I4VV-ETg-BrAJ.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-jPg9AxQv.js → diagram-TYUNFSNR-_M6ZxBG7.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ebnfDiagram-V4P3TTPT-ZHfGTB0N.js → ebnfDiagram-V4P3TTPT-C-e_W7qx.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ-C-ESJrUi.js → elk-QONTBCTQ-B5TBharB.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-DGK7TeHj.js → erDiagram-KYQIGQAA-D08rj2pv.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-CVV4rL8v.js → flowDiagram-IUGLLWBU-BALTxsKh.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ganttDiagram-R7GPNTJY-CuAwNvbm.js → ganttDiagram-R7GPNTJY-Cts193jT.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{gitGraphDiagram-PDYL7XHY-D_15Wtf-.js → gitGraphDiagram-PDYL7XHY-L9qYUX0v.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{infoDiagram-MVDRKAX5-ClqhbrCa.js → infoDiagram-MVDRKAX5-Bv47rgU0.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-CUJ891JX.js → ishikawaDiagram-HPEHV2GE-Da8_s6cs.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-B4skiMu-.js → journeyDiagram-BOSHW7O7-Bj3CjZOf.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-UNGJR_y_.js → kanban-definition-FNSA4HC5-D1hicmMu.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{linear-BEB-UwbR.js → linear-CWQg2iA1.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/main-XLn3EZFh.css +11 -0
- package/node_modules/@weavecode/server/web/dist/assets/main-bsb0lQoL.js +1096 -0
- package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-knGXJfjz.js → mermaid.core-C-wP0Zg2.js} +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-CEldbr3a.js → mindmap-definition-6OY57UG3-Dk0VKqre.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{pegDiagram-ECIUJNBX-cNCkGLx3.js → pegDiagram-ECIUJNBX-Bp1K_F9z.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/pet-J6izA90s.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{pieDiagram-GNMPY74T-CfMEFiQD.js → pieDiagram-GNMPY74T-BZ4rGy3t.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-knmi2rwP.js → quadrantDiagram-D57K4MC3-B4N5KRsR.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{railroadDiagram-Y72NRBL7-BJ7AzhEo.js → railroadDiagram-Y72NRBL7-C8nx8oHf.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-Dte2LGQM.js → requirementDiagram-EQYSW5RA-VSH57d0d.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-3noLaWgd.js → sankeyDiagram-SY24JHO5-jUb1hcya.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-CclOWTTc.js → sequenceDiagram-BLEHNHQU-E2BioCNi.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sizeCapture-INFHLROL-B82sbLhA.js → sizeCapture-INFHLROL-BdKrbRmI.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-BXfVDwSN.js → stateDiagram-v2-A6IESKWZ-tFz7uNM7.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{swimlanes-B3ENRKFQ-D4lKZaeV.js → swimlanes-B3ENRKFQ-B9BAPDWw.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-DQ2NPLl9.js +8 -0
- package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-D6H6zP5b.js → timeline-definition-JXYKGLGB-CofNnFTK.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-D2J2bKo_.js → usecaseDiagram-WPOLBNNX-DOvjhJjJ.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-pdRbIkpB.js → vennDiagram-Q3Y3IDCW-BcFHWnhS.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-Cyd2QPMf.js → wardleyDiagram-IVAIDKWA-Bz2aqRAs.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-Bd4BkwVM.js → xychartDiagram-4URNHDU4-DpNF6Vsq.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/index.html +2 -2
- package/node_modules/@weavecode/server/web/dist/pet.html +80 -10
- package/node_modules/@weavecode/templates/dist/resources/pets/weave-spider/pet.json +1 -1
- package/node_modules/@weavecode/templates/dist/resources/pets/weave-spider/spritesheet.png +0 -0
- package/node_modules/@weavecode/templates/package.json +2 -2
- package/package.json +6 -6
- package/scripts/preinstall.mjs +60 -22
- package/node_modules/@weavecode/server/web/dist/assets/channel-C0RGiobt.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/main-B_0jS_Gz.js +0 -1096
- package/node_modules/@weavecode/server/web/dist/assets/main-Czzlavi4.css +0 -11
- package/node_modules/@weavecode/server/web/dist/assets/pet-DJCpIDM5.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-DbdFh_d6.js +0 -8
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{randomBytes as
|
|
1
|
+
import{randomBytes as E}from"node:crypto";export const ORCH_RUN_RETENTION_DAYS=7,ORCH_RUN_KEEP_PER_ORCH=100;function h(s){let e;try{e=JSON.parse(String(s))}catch{return[]}if(!Array.isArray(e))return[];const t=[];for(const r of e){if(typeof r!="object"||r===null)continue;const n=r;if(typeof n.id!="string"||!n.id)continue;const i={id:n.id,kind:n.kind==="webhook"?"webhook":n.kind==="trigger"?"trigger":"session"};typeof n.webhookToken=="string"&&n.webhookToken&&(i.webhookToken=n.webhookToken),typeof n.url=="string"&&n.url&&(i.url=n.url),typeof n.secret=="string"&&n.secret&&(i.secret=n.secret),n.autoFire===!0&&(i.autoFire=!0),t.push(i)}return t}export function graphDirections(s,e){const t=new Set(e.map(n=>n.to)),r=new Set(e.map(n=>n.from));return{entries:s.filter(n=>!t.has(n.id)),exits:s.filter(n=>!r.has(n.id))}}export function pendingCountsOf(s){const e={};for(const[t,r]of Object.entries(s.pending))r.length>0&&(e[t]=r.length);return e}export function toRunSummary(s){const{state:e,...t}=s;return{...t,pendingCounts:pendingCountsOf(e)}}function d(){return E(18).toString("base64url")}function p(){return{pending:{},events:[]}}export class OrchestrationRepository{db;constructor(e){this.db=e}insert(e){const t=new Date().toISOString(),r=l(this.db,e.nodes,e.edges),n=this.db.prepare(`INSERT INTO orchestrations
|
|
2
2
|
(name, project_id, start_text, nodes, edges, enabled, cron, created_at, updated_at)
|
|
3
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(e.name,e.projectId,e.startText,JSON.stringify(
|
|
3
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(e.name,e.projectId,e.startText,JSON.stringify(r),JSON.stringify(e.edges),e.enabled===!1?0:1,e.cron??null,t,t);return this.getById(Number(n.lastInsertRowid))}getById(e){const t=this.db.prepare("SELECT * FROM orchestrations WHERE id = ?").get(e);return t?u(t):void 0}getByNodeToken(e){for(const t of this.list()){const r=t.nodes.find(n=>n.kind==="webhook"&&n.webhookToken===e);if(r)return{row:t,nodeId:r.id}}}list(){return this.db.prepare("SELECT * FROM orchestrations ORDER BY id").all().map(u)}listByProject(e){return this.db.prepare("SELECT * FROM orchestrations WHERE project_id = ? ORDER BY id").all(e).map(u)}update(e,t){const r=this.getById(e);if(!r)return;const n=l(this.db,t.nodes??r.nodes,t.edges??r.edges);return this.db.prepare(`UPDATE orchestrations
|
|
4
4
|
SET name = ?, project_id = ?, start_text = ?, nodes = ?, edges = ?, enabled = ?, cron = ?, updated_at = ?
|
|
5
|
-
WHERE id = ?`).run(t.name??
|
|
5
|
+
WHERE id = ?`).run(t.name??r.name,t.projectId??r.projectId,t.startText??r.startText,JSON.stringify(n),JSON.stringify(t.edges??r.edges),t.enabled??r.enabled?1:0,t.cron===void 0?r.cron:t.cron,new Date().toISOString(),e),this.getById(e)}setCronFired(e,t){this.db.prepare("UPDATE orchestrations SET last_cron_at = ? WHERE id = ?").run(t,e)}rotateNodeToken(e,t){const r=this.getById(e);if(!r||!r.nodes.find(a=>a.id===t&&a.kind==="webhook"))return null;const n=this.allTokens();let i=d();for(;n.has(i);)i=d();const o=r.nodes.map(a=>a.id===t?{...a,webhookToken:i}:a);return this.db.prepare("UPDATE orchestrations SET nodes = ?, updated_at = ? WHERE id = ?").run(JSON.stringify(o),new Date().toISOString(),e),i}allTokens(){const e=new Set;for(const t of this.list())for(const r of t.nodes)r.webhookToken&&e.add(r.webhookToken);return e}deleteById(e){return Number(this.db.prepare("DELETE FROM orchestrations WHERE id = ?").run(e).changes)===1}deleteMentioningSession(e){const t=this.list().filter(r=>r.nodes.some(n=>n.kind==="session"&&n.id===e));return this.deleteAll(t)}deleteByProject(e){return this.deleteAll(this.listByProject(e))}deleteAll(e){const t=this.db.prepare("DELETE FROM orchestrations WHERE id = ?");return e.reduce((r,n)=>r+Number(t.run(n.id).changes),0)}}function l(s,e,t){const r=new Set(t.map(i=>i.to)),n=new Set;try{for(const i of s.prepare("SELECT nodes FROM orchestrations").all())for(const o of h(i.nodes))o.webhookToken&&n.add(o.webhookToken)}catch{}return e.map(i=>{if(i.kind!=="webhook"||i.webhookToken||r.has(i.id))return i;let o=d();for(;n.has(o);)o=d();return n.add(o),{...i,webhookToken:o}})}export class OrchestrationRunRepository{db;constructor(e){this.db=e}insert(e){const t=new Date().toISOString(),r=this.db.prepare(`INSERT INTO orchestration_runs
|
|
6
6
|
(orchestration_id, orchestration_name, project_id, trigger, status, deliveries, state, created_at, updated_at)
|
|
7
|
-
VALUES (?, ?, ?, ?, 'running', 0, ?, ?, ?)`).run(e.orchestrationId,e.orchestrationName,e.projectId,e.trigger,JSON.stringify(
|
|
8
|
-
WHERE id = ? AND status = 'running'`).run(JSON.stringify(t),
|
|
7
|
+
VALUES (?, ?, ?, ?, 'running', 0, ?, ?, ?)`).run(e.orchestrationId,e.orchestrationName,e.projectId,e.trigger,JSON.stringify(p()),t,t);return this.getById(Number(r.lastInsertRowid))}getById(e){const t=this.db.prepare("SELECT * FROM orchestration_runs WHERE id = ?").get(e);return t?c(t):void 0}listRunning(){return this.db.prepare("SELECT * FROM orchestration_runs WHERE status = 'running' ORDER BY id").all().map(c)}query(e){const t=Math.min(Math.max(e.limit??30,1),200),r=[],n=[];e.orchestrationId!=null&&(r.push("orchestration_id = ?"),n.push(e.orchestrationId)),e.projectId!=null&&(r.push("project_id = ?"),n.push(e.projectId)),e.status&&(r.push("status = ?"),n.push(e.status)),e.text&&(r.push("orchestration_name LIKE ?"),n.push(`%${e.text}%`)),e.before!=null&&(r.push("id < ?"),n.push(e.before));const i=r.length>0?`WHERE ${r.join(" AND ")}`:"",o=this.db.prepare(`SELECT * FROM orchestration_runs ${i} ORDER BY id DESC LIMIT ?`).all(...n,t+1).map(c),a=o.slice(0,t);return{runs:a,nextBefore:o.length>t?a[a.length-1].id:null}}updateState(e,t,r){return Number(this.db.prepare(`UPDATE orchestration_runs SET state = ?, deliveries = ?, updated_at = ?
|
|
8
|
+
WHERE id = ? AND status = 'running'`).run(JSON.stringify(t),r,new Date().toISOString(),e).changes)===1}finish(e,t,r=null,n){const i=new Date().toISOString();return Number(this.db.prepare(`UPDATE orchestration_runs
|
|
9
9
|
SET status = ?, error = ?, state = COALESCE(?, state), finished_at = ?, updated_at = ?
|
|
10
|
-
WHERE id = ? AND status = 'running'`).run(t,n
|
|
10
|
+
WHERE id = ? AND status = 'running'`).run(t,r,n?JSON.stringify(n):null,i,i,e).changes)===1}prune(e=new Date){const t=new Date(e.getTime()-ORCH_RUN_RETENTION_DAYS*864e5).toISOString(),r=Number(this.db.prepare("DELETE FROM orchestration_runs WHERE status <> 'running' AND created_at < ?").run(t).changes),n=Number(this.db.prepare(`DELETE FROM orchestration_runs
|
|
11
11
|
WHERE status <> 'running' AND id IN (
|
|
12
12
|
SELECT id FROM (
|
|
13
13
|
SELECT id, ROW_NUMBER() OVER (PARTITION BY orchestration_id ORDER BY id DESC) AS rn
|
|
14
14
|
FROM orchestration_runs
|
|
15
15
|
) WHERE rn > ?
|
|
16
|
-
)`).run(ORCH_RUN_KEEP_PER_ORCH).changes);return n
|
|
16
|
+
)`).run(ORCH_RUN_KEEP_PER_ORCH).changes);return r+n}clear(e,t){const r=[],n=[];e==="finished"&&r.push("status <> 'running'"),t!=null&&(r.push("project_id = ?"),n.push(t));const i=r.length>0?`WHERE ${r.join(" AND ")}`:"";return Number(this.db.prepare(`DELETE FROM orchestration_runs ${i}`).run(...n).changes)}}function u(s){return{id:Number(s.id),name:String(s.name),projectId:Number(s.project_id),startText:String(s.start_text??""),nodes:h(s.nodes),edges:g(s.edges,[]),enabled:Number(s.enabled??1)!==0,cron:s.cron==null?null:String(s.cron),lastCronAt:s.last_cron_at==null?null:String(s.last_cron_at),createdAt:String(s.created_at),updatedAt:String(s.updated_at)}}function c(s){const e=g(s.state,p());return{id:Number(s.id),orchestrationId:Number(s.orchestration_id),orchestrationName:String(s.orchestration_name),projectId:Number(s.project_id),trigger:String(s.trigger),status:String(s.status),deliveries:Number(s.deliveries),state:{pending:e.pending??{},events:e.events??[]},error:s.error==null?null:String(s.error),createdAt:String(s.created_at),finishedAt:s.finished_at==null?null:String(s.finished_at),updatedAt:String(s.updated_at)}}function g(s,e){try{return JSON.parse(String(s))}catch{return e}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export class PluginStateRepository{db;constructor(
|
|
1
|
+
export class PluginStateRepository{db;constructor(e){this.db=e}get(e){const t=this.db.prepare("SELECT * FROM plugin_states WHERE id = ?").get(e);if(t)return{id:String(t.id),enabled:Number(t.enabled)===1,config:JSON.parse(String(t.config??"{}")),updatedAt:String(t.updated_at)}}list(){return this.db.prepare("SELECT * FROM plugin_states ORDER BY id ASC").all().map(e=>({id:String(e.id),enabled:Number(e.enabled)===1,config:JSON.parse(String(e.config??"{}")),updatedAt:String(e.updated_at)}))}setEnabled(e,t){this.upsert(e,{enabled:t})}setConfig(e,t){this.upsert(e,{config:t})}remove(e){this.db.prepare("DELETE FROM plugin_states WHERE id = ?").run(e)}upsert(e,t){const i=this.get(e),n=new Date().toISOString(),d=t.enabled??i?.enabled??!0,r=t.config??i?.config??{};i?this.db.prepare("UPDATE plugin_states SET enabled = ?, config = ?, updated_at = ? WHERE id = ?").run(d?1:0,JSON.stringify(r),n,e):this.db.prepare("INSERT INTO plugin_states (id, enabled, config, updated_at) VALUES (?, ?, ?, ?)").run(e,d?1:0,JSON.stringify(r),n)}}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{resolve as o}from"node:path";export function projectKey(r){return o(r)}export class ProjectRepository{db;constructor(e){this.db=e}register(e){const t=new Date().toISOString(),s=projectKey(e.path);return this.db.prepare(`INSERT INTO projects (path, name, token, source, registered_at, last_seen_at)
|
|
2
2
|
VALUES (?, ?, ?, ?, ?, ?)
|
|
3
|
-
ON CONFLICT(path) DO UPDATE SET last_seen_at = excluded.last_seen_at`).run(s,e.name,e.token,e.source,t,t),this.getByPath(s)}getByPath(e){const t=this.db.prepare("SELECT * FROM projects WHERE path = ?").get(projectKey(e));return t?
|
|
3
|
+
ON CONFLICT(path) DO UPDATE SET last_seen_at = excluded.last_seen_at`).run(s,e.name,e.token,e.source,t,t),this.getByPath(s)}getByPath(e){const t=this.db.prepare("SELECT * FROM projects WHERE path = ?").get(projectKey(e));return t?a(t):void 0}getByToken(e){const t=this.db.prepare("SELECT * FROM projects WHERE token = ?").get(e);return t?a(t):void 0}getById(e){const t=this.db.prepare("SELECT * FROM projects WHERE id = ?").get(e);return t?a(t):void 0}list(){return this.db.prepare("SELECT * FROM projects WHERE archived_at IS NULL ORDER BY sort_order IS NULL, sort_order ASC, registered_at DESC").all().map(e=>a(e))}listArchived(){return this.db.prepare("SELECT * FROM projects WHERE archived_at IS NOT NULL ORDER BY archived_at DESC").all().map(e=>a(e))}setOrder(e){this.db.exec("BEGIN");try{this.db.exec("UPDATE projects SET sort_order = NULL");const t=this.db.prepare("UPDATE projects SET sort_order = ? WHERE id = ?");e.forEach((s,n)=>{t.run(n,s)}),this.db.exec("COMMIT")}catch(t){throw this.db.exec("ROLLBACK"),t}}touch(e){this.db.prepare("UPDATE projects SET last_seen_at = ? WHERE id = ?").run(new Date().toISOString(),e)}remove(e){this.db.prepare("DELETE FROM projects WHERE id = ?").run(e)}setArchived(e,t){return(t?this.db.prepare("UPDATE projects SET archived_at = ?, sort_order = NULL WHERE id = ?").run(new Date().toISOString(),e):this.db.prepare("UPDATE projects SET archived_at = NULL WHERE id = ?").run(e)).changes>0}getMeta(e){const t=this.db.prepare("SELECT meta FROM projects WHERE id = ?").get(e);if(!t||t.meta==null)return null;try{const s=JSON.parse(String(t.meta));return s&&typeof s=="object"&&!Array.isArray(s)?s:null}catch{return null}}setMeta(e,t){const s={...this.getMeta(e)??{},...t};this.db.prepare("UPDATE projects SET meta = ? WHERE id = ?").run(JSON.stringify(s),e)}}function a(r){return{id:Number(r.id),path:String(r.path),name:String(r.name),token:String(r.token),source:r.source,registeredAt:String(r.registered_at),lastSeenAt:r.last_seen_at==null?null:String(r.last_seen_at),meta:r.meta==null?null:String(r.meta),sortOrder:r.sort_order==null?null:Number(r.sort_order),archivedAt:r.archived_at==null?null:String(r.archived_at)}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class PushSubscriptionRepository{db;constructor(
|
|
1
|
+
export class PushSubscriptionRepository{db;constructor(t){this.db=t}upsert(t){return this.db.prepare(`INSERT INTO push_subscriptions (endpoint, p256dh, auth, user_agent, created_at)
|
|
2
2
|
VALUES (?, ?, ?, ?, ?)
|
|
3
3
|
ON CONFLICT(endpoint) DO UPDATE SET p256dh = excluded.p256dh, auth = excluded.auth,
|
|
4
|
-
user_agent = excluded.user_agent`).run(
|
|
4
|
+
user_agent = excluded.user_agent`).run(t.endpoint,t.p256dh,t.auth,t.userAgent??null,new Date().toISOString()),this.getById(t.endpoint)}getById(t){const n=this.db.prepare("SELECT * FROM push_subscriptions WHERE endpoint = ?").get(t);return n?r(n):void 0}list(){return this.db.prepare("SELECT * FROM push_subscriptions ORDER BY created_at, endpoint").all().map(r)}deleteByEndpoint(t){return Number(this.db.prepare("DELETE FROM push_subscriptions WHERE endpoint = ?").run(t).changes)===1}}function r(e){return{endpoint:String(e.endpoint),p256dh:String(e.p256dh),auth:String(e.auth),userAgent:e.user_agent==null?null:String(e.user_agent),createdAt:String(e.created_at)}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const WATCH_ON_VALUES=["idle","turnEnd","messageFailed"],DEFAULT_WATCH_ON=["idle"];export class SessionWatchRepository{db;constructor(e){this.db=e}insert(e){const
|
|
2
|
-
VALUES (?, ?, ?, ?, ?, ?)`).run(e.watcherSessionId,e.targetSessionId,e.notify,JSON.stringify(e.onEvents?.length?e.onEvents:DEFAULT_WATCH_ON),e.times===void 0?1:e.times,new Date().toISOString());return this.getById(Number(
|
|
3
|
-
WHERE id = ? AND fired_at IS NULL AND remaining > 0`).run(e).changes)===1)return this.db.prepare("UPDATE session_watches SET fired_at = ? WHERE id = ? AND remaining = 0 AND fired_at IS NULL").run(new Date().toISOString(),e),this.getById(e)??null;const
|
|
1
|
+
export const WATCH_ON_VALUES=["idle","turnEnd","messageFailed"],DEFAULT_WATCH_ON=["idle"];export class SessionWatchRepository{db;constructor(e){this.db=e}insert(e){const n=this.db.prepare(`INSERT INTO session_watches (watcher_session_id, target_session_id, notify, on_events, remaining, created_at)
|
|
2
|
+
VALUES (?, ?, ?, ?, ?, ?)`).run(e.watcherSessionId,e.targetSessionId,e.notify,JSON.stringify(e.onEvents?.length?e.onEvents:DEFAULT_WATCH_ON),e.times===void 0?1:e.times,new Date().toISOString());return this.getById(Number(n.lastInsertRowid))}getById(e){const n=this.db.prepare("SELECT * FROM session_watches WHERE id = ?").get(e);return n?s(n):void 0}listPendingByTarget(e){return this.db.prepare("SELECT * FROM session_watches WHERE target_session_id = ? AND fired_at IS NULL").all(e).map(s)}listPending(){return this.db.prepare("SELECT * FROM session_watches WHERE fired_at IS NULL ORDER BY id").all().map(s)}consumeHit(e){if(Number(this.db.prepare(`UPDATE session_watches SET remaining = remaining - 1
|
|
3
|
+
WHERE id = ? AND fired_at IS NULL AND remaining > 0`).run(e).changes)===1)return this.db.prepare("UPDATE session_watches SET fired_at = ? WHERE id = ? AND remaining = 0 AND fired_at IS NULL").run(new Date().toISOString(),e),this.getById(e)??null;const n=this.getById(e);return n&&n.remaining===null&&n.firedAt===null?n:null}updateById(e,n){const i=this.getById(e);if(!(!i||i.firedAt!==null))return this.db.prepare("UPDATE session_watches SET on_events = ?, remaining = ? WHERE id = ? AND fired_at IS NULL").run(JSON.stringify(n.onEvents??i.onEvents),n.remaining,e),this.getById(e)}deleteById(e){return Number(this.db.prepare("DELETE FROM session_watches WHERE id = ?").run(e).changes)===1}deleteBySession(e){return Number(this.db.prepare("DELETE FROM session_watches WHERE target_session_id = ? OR watcher_session_id = ?").run(e,e).changes)}deleteByProject(e){return Number(this.db.prepare(`DELETE FROM session_watches
|
|
4
4
|
WHERE target_session_id IN (SELECT session_id FROM sessions WHERE project_id = ?)
|
|
5
|
-
OR watcher_session_id IN (SELECT session_id FROM sessions WHERE project_id = ?)`).run(e,e).changes)}}function
|
|
5
|
+
OR watcher_session_id IN (SELECT session_id FROM sessions WHERE project_id = ?)`).run(e,e).changes)}}function s(t){return{id:Number(t.id),watcherSessionId:t.watcher_session_id==null?null:String(t.watcher_session_id),targetSessionId:String(t.target_session_id),onEvents:parseOn(t.on_events),remaining:t.remaining==null?null:Number(t.remaining),notify:t.notify==null?null:String(t.notify),firedAt:t.fired_at==null?null:String(t.fired_at),createdAt:String(t.created_at)}}export function parseOn(t){if(typeof t!="string"||!t)return[...DEFAULT_WATCH_ON];try{const e=JSON.parse(t);if(!Array.isArray(e))return[...DEFAULT_WATCH_ON];const n=e.filter(i=>WATCH_ON_VALUES.includes(i));return n.length?n:[...DEFAULT_WATCH_ON]}catch{return[...DEFAULT_WATCH_ON]}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{HARNESS_COMPACTION as h,HARNESS_LIFECYCLE as
|
|
1
|
+
import{HARNESS_COMPACTION as h,HARNESS_LIFECYCLE as d,HARNESS_TOOL_EVENTS as A,isHarness as p}from"@weavecode/core";import{readDaemonSettingsSync as N,DEFAULT_SESSION_IDLE_DAYS as L}from"../daemon/settings.js";export const PROMPTLESS_GRACE_MS=60*6e4;function C(){return(N().sessions?.idleDays??L)*864e5}function S(i){const e=new Set;for(const n of Object.values(d)){for(const o of n.close)e.add(o);for(const o of n.sessionMarkers)e.add(o);n.sessionExit&&e.add(n.sessionExit)}const s=[...e].map(n=>`'${n}'`).join(","),t=Object.values(h).filter(n=>n.end&&n.endSource).map(n=>`(${i}.event_type = '${n.end}' AND COALESCE(json_extract(${i}.payload, '$.raw.source'), '') = '${n.endSource}')`).join(" OR ");return`${i}.event_type IN (${s})${t?` AND NOT (${t})`:""}`}function c(i){const e=new Set;for(const t of Object.values(d))e.add(t.open);const s=[...e].map(t=>`'${t}'`).join(",");return`${i}.event_type IN (${s}) AND COALESCE(json_extract(${i}.payload, '$.raw.prompt'), '') NOT LIKE '<task-notification>%'`}function R(i){const e=new Set;for(const t of Object.values(A))for(const n of t)e.add(n);const s=[...e].map(t=>`'${t}'`).join(",");return`${i}.event_type IN (${s})`}export class SessionRepository{db;constructor(e){this.db=e}touch(e,s,t){const n=t??new Date().toISOString();return this.db.prepare(`INSERT INTO sessions (session_id, project_id, last_seen_at, created_at)
|
|
2
2
|
VALUES (?, ?, ?, ?)
|
|
3
3
|
ON CONFLICT(session_id) DO UPDATE SET
|
|
4
4
|
last_seen_at = MAX(sessions.last_seen_at, excluded.last_seen_at),
|
|
5
|
-
project_id = COALESCE(sessions.project_id, excluded.project_id)`).run(e,s??null,n,n),this.getBySessionId(e)}getBySessionId(e){const s=this.db.prepare("SELECT * FROM sessions WHERE session_id = ?").get(e);return s?_(s):void 0}countAll(){return Number(this.db.prepare("SELECT COUNT(*) AS n FROM sessions").get().n)}list(e){return(e===void 0?this.db.prepare("SELECT * FROM sessions ORDER BY created_at DESC LIMIT 200").all():this.db.prepare("SELECT * FROM sessions WHERE project_id = ? ORDER BY created_at DESC LIMIT 200").all(e)).map(_)}searchByTitle(e,s){const t=`%${e.replace(/[\\%_]/g,
|
|
5
|
+
project_id = COALESCE(sessions.project_id, excluded.project_id)`).run(e,s??null,n,n),this.getBySessionId(e)}getBySessionId(e){const s=this.db.prepare("SELECT * FROM sessions WHERE session_id = ?").get(e);return s?_(s):void 0}countAll(){return Number(this.db.prepare("SELECT COUNT(*) AS n FROM sessions").get().n)}list(e){return(e===void 0?this.db.prepare("SELECT * FROM sessions ORDER BY created_at DESC LIMIT 200").all():this.db.prepare("SELECT * FROM sessions WHERE project_id = ? ORDER BY created_at DESC LIMIT 200").all(e)).map(_)}searchByTitle(e,s){const t=`%${e.replace(/[\\%_]/g,n=>`\\${n}`)}%`;return this.db.prepare("SELECT * FROM sessions WHERE title LIKE ? ESCAPE '\\' ORDER BY last_seen_at DESC LIMIT ?").all(t,s).map(_)}listWithCounts(e,s){const t=`SELECT s.*, (SELECT COUNT(*) FROM hook_events e WHERE e.session_id = s.session_id) AS event_count, (SELECT e2.source FROM hook_events e2 WHERE e2.session_id = s.session_id ORDER BY e2.id DESC LIMIT 1) AS harness, (SELECT e5.event_type FROM hook_events e5 WHERE e5.session_id = s.session_id ORDER BY e5.id DESC LIMIT 1) AS last_event_type, (SELECT MAX(e3.id) FROM hook_events e3 WHERE e3.session_id = s.session_id AND ${c("e3")}) AS last_ups, (SELECT MAX(e6.id) FROM hook_events e6 WHERE e6.session_id = s.session_id AND ${S("e6")}) AS last_close, (SELECT MAX(e7.id) FROM hook_events e7 WHERE e7.session_id = s.session_id AND ${R("e7")}) AS last_tool, (SELECT MAX(e4.id) FROM hook_events e4 WHERE e4.session_id = s.session_id AND e4.event_type IN ('Stop', 'StopFailure', 'SessionEnd')) AS last_stop FROM sessions s`,n=[],o=[];return e!==void 0&&(n.push("s.project_id = ?"),o.push(e)),s&&s.length>0&&(n.push(`s.session_id IN (${s.map(()=>"?").join(",")})`),o.push(...s)),this.db.prepare(`${t}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY s.created_at DESC LIMIT 200`).all(...o).map(r=>{const a=r.harness,l=r.last_ups,E=r.last_close,u=r.last_tool,T=r.last_stop,O=r.last_event_type;return{..._(r),eventCount:Number(r.event_count??0),harness:p(a)?a:null,turnOpen:l!=null&&(E==null||Number(l)>Number(E))||u!=null&&(E==null||Number(u)>Number(E)),lastEventType:O??null,hasRun:l!=null||T!=null,autoDeleteAt:new Date(Date.parse(String(r.last_seen_at))+(l==null?PROMPTLESS_GRACE_MS:C())).toISOString(),promptless:l==null}})}turnOpenOf(e){const s=this.db.prepare(`SELECT (SELECT MAX(e3.id) FROM hook_events e3 WHERE e3.session_id = ? AND ${c("e3")}) AS last_ups, (SELECT MAX(e6.id) FROM hook_events e6 WHERE e6.session_id = ? AND ${S("e6")}) AS last_close, (SELECT MAX(e7.id) FROM hook_events e7 WHERE e7.session_id = ? AND ${R("e7")}) AS last_tool`).get(e,e,e);if(!this.getBySessionId(e))return null;const t=s?.last_ups??null,n=s?.last_close??null,o=s?.last_tool??null;return t!=null&&(n==null||Number(t)>Number(n))||o!=null&&(n==null||Number(o)>Number(n))}hasRunOf(e){const s=this.db.prepare("SELECT EXISTS(SELECT 1 FROM hook_events e WHERE e.session_id = ? AND e.event_type IN ('UserPromptSubmit','Stop','StopFailure','SessionEnd')) AS hit").get(e);return Number(s?.hit??0)>0}lastMainEventAtOf(e){const s=[...new Set(Object.values(d).map(n=>n.subagentStop))].map(n=>`'${n}'`).join(","),t=this.db.prepare(`SELECT created_at FROM hook_events
|
|
6
6
|
WHERE session_id = ? AND event_type NOT IN (${s})
|
|
7
7
|
ORDER BY id DESC LIMIT 1`).get(e);return t?String(t.created_at):null}livenessRowOf(e){const s=this.db.prepare("SELECT s.session_id, s.last_seen_at, COUNT(e.id) AS event_count, (SELECT e2.source FROM hook_events e2 WHERE e2.session_id = s.session_id ORDER BY e2.id DESC LIMIT 1) AS harness, (SELECT e5.event_type FROM hook_events e5 WHERE e5.session_id = s.session_id ORDER BY e5.id DESC LIMIT 1) AS last_event_type FROM sessions s LEFT JOIN hook_events e ON e.session_id = s.session_id WHERE s.session_id = ? GROUP BY s.session_id").get(e);if(!s)return null;const t=s.harness;return{sessionId:String(s.session_id),harness:p(t)?t:null,lastSeenAt:String(s.last_seen_at),lastEventType:s.last_event_type==null?null:String(s.last_event_type),eventCount:Number(s.event_count??0)}}setPendingTitle(e,s){const t=this.getBySessionId(e);if(t)return t.pendingTitle===s?t:t.title===s?(t.pendingTitle!=null&&this.db.prepare("UPDATE sessions SET pending_title = NULL WHERE session_id = ?").run(e),this.getBySessionId(e)):(this.db.prepare("UPDATE sessions SET title = ?, pending_title = ? WHERE session_id = ?").run(s,s,e),this.getBySessionId(e))}applyReportedTitle(e,s){const t=this.getBySessionId(e);return t?t.pendingTitle!=null?s===t.pendingTitle?(this.db.prepare("UPDATE sessions SET title = ?, pending_title = NULL WHERE session_id = ?").run(s,e),t.title!==s):!1:s!=null&&s!==t.title?(this.db.prepare("UPDATE sessions SET title = ? WHERE session_id = ?").run(s,e),!0):!1:!1}confirmPendingTitle(e,s){return this.db.prepare("UPDATE sessions SET title = ?, pending_title = NULL WHERE session_id = ? AND pending_title = ?").run(s,e,s).changes>0}setTitle(e,s){return this.db.prepare("UPDATE sessions SET title = ?, pending_title = NULL WHERE session_id = ?").run(s,e),this.getBySessionId(e)}remove(e){this.db.prepare("DELETE FROM sessions WHERE session_id = ?").run(e)}removeByProject(e){return Number(this.db.prepare("DELETE FROM sessions WHERE project_id = ?").run(e).changes)}}function _(i){return{sessionId:String(i.session_id),projectId:i.project_id==null?null:Number(i.project_id),title:i.title==null?null:String(i.title),pendingTitle:i.pending_title==null?null:String(i.pending_title),lastSeenAt:String(i.last_seen_at),createdAt:String(i.created_at)}}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import{createHash as m}from"node:crypto";import{createReadStream as y,mkdirSync as
|
|
2
|
-
ON CONFLICT(id) DO NOTHING`).run(
|
|
3
|
-
ON CONFLICT(id) DO NOTHING`).run(
|
|
4
|
-
WHERE created_at <= ? AND id NOT IN (SELECT upload_id FROM event_images)`).all(new Date(
|
|
1
|
+
import{createHash as m}from"node:crypto";import{createReadStream as y,mkdirSync as p,readFileSync as _,writeFileSync as S,existsSync as o,renameSync as N,rmSync as u,statSync as O}from"node:fs";import l from"node:path";import{getUploadsDir as b}from"../db/paths.js";export const UPLOAD_IMAGE_TYPES=["image/png","image/jpeg","image/gif","image/webp"],UPLOAD_MEDIA_TYPES=UPLOAD_IMAGE_TYPES;export function isImageMediaType(a){return UPLOAD_IMAGE_TYPES.includes(a)}export const UPLOAD_MAX_BYTES=10*1024*1024,UPLOAD_FILE_MAX_BYTES=512*1024*1024;export function maxUploadBytes(a){return isImageMediaType(a)?UPLOAD_MAX_BYTES:UPLOAD_FILE_MAX_BYTES}export const UPLOAD_CLEANUP_GRACE_MS=5*6e4,UPLOAD_ORPHAN_GRACE_MS=60*6e4;const T={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp"},I=48,C=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;function A(a){const e=(a.split(/[\\/]/).pop()??"").replace(/\.[A-Za-z0-9]{1,10}$/,"").replace(/[\u0000-\u001f<>:"|?*]/g,"-").replace(/\s+/g,"-").replace(/^[.-]+/,"").replace(/[.-]+$/,"").slice(0,I);return e?C.test(e)?`_${e}`:e:""}function f(a,e){if(isImageMediaType(a))return T[a];const i=/\.([A-Za-z0-9]{1,10})$/.exec(e);return i?`.${i[1].toLowerCase()}`:".bin"}export class UploadRepository{db;dir;constructor(e,i=b()){this.db=e,this.dir=i}get defaultDir(){return this.dir}save(e){const i=m("sha256").update(e.bytes).digest("hex"),t=this.getById(i);if(t){const n=this.pathOf(t);return o(n)||(p(this.dirOf(t),{recursive:!0}),S(this.filePath(t.id,t.mediaType,t.name,this.dirOf(t)),e.bytes)),t}const r=e.dir??this.dir;p(r,{recursive:!0});const s=this.filePath(i,e.mediaType,e.name,r);return o(s)||S(s,e.bytes),this.db.prepare(`INSERT INTO uploads (id, media_type, name, size, created_at, dir) VALUES (?, ?, ?, ?, ?, ?)
|
|
2
|
+
ON CONFLICT(id) DO NOTHING`).run(i,e.mediaType,e.name,e.bytes.length,new Date().toISOString(),e.dir??null),this.getById(i)}async adoptFromFile(e){const i=m("sha256");await new Promise((E,h)=>{y(e.file).on("data",g=>i.update(g)).on("end",()=>E()).on("error",h)});const t=i.digest("hex"),r=O(e.file).size,s=this.getById(t);if(s){const E=this.pathOf(s);return o(E)?u(e.file,{force:!0}):(p(this.dirOf(s),{recursive:!0}),N(e.file,this.filePath(s.id,s.mediaType,s.name,this.dirOf(s)))),s}const n=e.dir??this.dir;p(n,{recursive:!0});const d=this.filePath(t,e.mediaType,e.name,n);return o(d)?u(e.file,{force:!0}):N(e.file,d),this.db.prepare(`INSERT INTO uploads (id, media_type, name, size, created_at, dir) VALUES (?, ?, ?, ?, ?, ?)
|
|
3
|
+
ON CONFLICT(id) DO NOTHING`).run(t,e.mediaType,e.name,r,new Date().toISOString(),e.dir??null),this.getById(t)}getById(e){const i=this.db.prepare("SELECT * FROM uploads WHERE id = ?").get(e);return i?c(i):void 0}filePath(e,i,t,r=this.dir){const s=A(t),n=e.slice(0,16);return l.join(r,`${s?`${s}-${n}`:n}${f(i,t)}`)}pathOf(e){const i=this.filePath(e.id,e.mediaType,e.name,this.dirOf(e));if(o(i))return i;const t=l.join(this.dirOf(e),`${e.id}${f(e.mediaType,e.name)}`);return o(t)?t:i}dirOf(e){return e.dir??this.dir}refsOf(e){const i=[];for(const t of e){const r=this.getById(t);if(!r)return null;i.push({id:r.id,name:r.name,mediaType:r.mediaType,path:this.pathOf(r)})}return i}fileStatOf(e){const i=this.getById(e);if(!i)return;const t=this.pathOf(i);if(o(t))return{row:i,file:t,size:O(t).size}}fileOf(e){const i=this.getById(e);if(!i)return;const t=this.pathOf(i);if(o(t))return{row:i,bytes:_(t)}}linkToEvent(e,i){const t=this.db.prepare("INSERT INTO event_images (event_id, upload_id) VALUES (?, ?) ON CONFLICT DO NOTHING");for(const r of i)t.run(e,r)}pruneUnreferenced(e=UPLOAD_ORPHAN_GRACE_MS,i=Date.now()){const t=this.db.prepare(`SELECT id, media_type, name, dir FROM uploads
|
|
4
|
+
WHERE created_at <= ? AND id NOT IN (SELECT upload_id FROM event_images)`).all(new Date(i-e).toISOString()),r=this.db.prepare("DELETE FROM uploads WHERE id = ?");for(const s of t)u(this.pathOf({id:s.id,mediaType:s.media_type,name:s.name,dir:s.dir}),{force:!0}),r.run(s.id);return t.length}imagesBySession(e){const i=this.db.prepare(`SELECT e.event_id AS eventId, u.* FROM event_images e
|
|
5
5
|
JOIN uploads u ON u.id = e.upload_id
|
|
6
6
|
JOIN hook_events h ON h.id = e.event_id
|
|
7
7
|
WHERE h.session_id = ?
|
|
8
|
-
ORDER BY e.event_id, u.created_at`).all(e),
|
|
8
|
+
ORDER BY e.event_id, u.created_at`).all(e),t=new Map;for(const r of i){const s=Number(r.eventId),n=t.get(s)??[];n.push(c(r)),t.set(s,n)}return t}uploadsBySession(e){const i=this.db.prepare(`SELECT DISTINCT u.* FROM event_images e
|
|
9
9
|
JOIN uploads u ON u.id = e.upload_id
|
|
10
10
|
JOIN hook_events h ON h.id = e.event_id
|
|
11
11
|
WHERE h.session_id = ?
|
|
12
|
-
ORDER BY u.created_at`).all(e);return
|
|
12
|
+
ORDER BY u.created_at`).all(e);return i.length===0?null:i.map(c)}sessionBreakdown(e){const i=this.db.prepare(`SELECT u.media_type AS mediaType, COUNT(DISTINCT u.id) AS n, SUM(u.size) AS bytes
|
|
13
13
|
FROM event_images e
|
|
14
14
|
JOIN uploads u ON u.id = e.upload_id
|
|
15
15
|
JOIN hook_events h ON h.id = e.event_id
|
|
16
16
|
WHERE h.session_id = ?
|
|
17
|
-
GROUP BY u.media_type`).all(e);if(
|
|
17
|
+
GROUP BY u.media_type`).all(e);if(i.length===0)return null;let t={count:0,bytes:0};for(const s of i)isImageMediaType(String(s.mediaType))&&(t={count:t.count+Number(s.n),bytes:t.bytes+Number(s.bytes)});const r={count:i.reduce((s,n)=>s+Number(n.n),0),bytes:i.reduce((s,n)=>s+Number(n.bytes),0)};return{images:t,files:{count:r.count-t.count,bytes:r.bytes-t.bytes}}}usageBySession(){return this.db.prepare(`SELECT h.session_id AS sessionId, COUNT(DISTINCT u.id) AS count, COALESCE(SUM(u.size), 0) AS bytes
|
|
18
18
|
FROM event_images e
|
|
19
19
|
JOIN uploads u ON u.id = e.upload_id
|
|
20
20
|
JOIN hook_events h ON h.id = e.event_id
|
|
21
21
|
GROUP BY h.session_id
|
|
22
|
-
ORDER BY bytes DESC`).all().map(
|
|
23
|
-
WHERE created_at <= ? AND id NOT IN (SELECT upload_id FROM event_images)`).get(new Date(
|
|
22
|
+
ORDER BY bytes DESC`).all().map(e=>({sessionId:String(e.sessionId),count:Number(e.count),bytes:Number(e.bytes)}))}removeMany(e){const i=this.db.prepare("DELETE FROM uploads WHERE id = ?");let t=0;for(const r of e){const s=this.getById(r);s&&(u(this.pathOf(s),{force:!0}),t+=Number(i.run(r).changes))}return t}unreferencedStats(e=UPLOAD_CLEANUP_GRACE_MS,i=Date.now()){const t=this.db.prepare(`SELECT COUNT(*) AS n, COALESCE(SUM(size), 0) AS bytes FROM uploads
|
|
23
|
+
WHERE created_at <= ? AND id NOT IN (SELECT upload_id FROM event_images)`).get(new Date(i-e).toISOString());return{count:Number(t.n),bytes:Number(t.bytes)}}overview(e=UPLOAD_CLEANUP_GRACE_MS,i=Date.now()){const t=new Date(i-e).toISOString(),r=this.db.prepare(`SELECT COUNT(*) AS n, COALESCE(SUM(size), 0) AS bytes,
|
|
24
24
|
COALESCE(SUM(CASE WHEN media_type IN ('image/png','image/jpeg','image/gif','image/webp') THEN size ELSE 0 END), 0) AS imgBytes,
|
|
25
25
|
COALESCE(SUM(CASE WHEN media_type IN ('image/png','image/jpeg','image/gif','image/webp') THEN 1 ELSE 0 END), 0) AS imgN,
|
|
26
26
|
COALESCE(SUM(CASE WHEN id IN (SELECT upload_id FROM event_images) THEN size ELSE 0 END), 0) AS refBytes,
|
|
27
27
|
COALESCE(SUM(CASE WHEN id IN (SELECT upload_id FROM event_images) THEN 1 ELSE 0 END), 0) AS refN,
|
|
28
28
|
COALESCE(SUM(CASE WHEN created_at <= ? AND id NOT IN (SELECT upload_id FROM event_images) THEN size ELSE 0 END), 0) AS unrefBytes,
|
|
29
29
|
COALESCE(SUM(CASE WHEN created_at <= ? AND id NOT IN (SELECT upload_id FROM event_images) THEN 1 ELSE 0 END), 0) AS unrefN
|
|
30
|
-
FROM uploads`).get(
|
|
31
|
-
WHERE created_at <= ? AND id NOT IN (SELECT upload_id FROM event_images)`).all(new Date(i
|
|
30
|
+
FROM uploads`).get(t,t),s={count:Number(r.n),bytes:Number(r.bytes)},n={count:Number(r.imgN),bytes:Number(r.imgBytes)};return{total:s,images:n,files:{count:s.count-n.count,bytes:s.bytes-n.bytes},referenced:{count:Number(r.refN),bytes:Number(r.refBytes)},unreferenced:{count:Number(r.unrefN),bytes:Number(r.unrefBytes)}}}cleanupUnreferenced(e,i=UPLOAD_CLEANUP_GRACE_MS,t=Date.now()){const r=this.db.prepare(`SELECT id, media_type, name, dir FROM uploads
|
|
31
|
+
WHERE created_at <= ? AND id NOT IN (SELECT upload_id FROM event_images)`).all(new Date(t-i).toISOString()),s=this.db.prepare("DELETE FROM uploads WHERE id = ?");let n=0;for(const d of r)u(this.pathOf({id:d.id,mediaType:d.media_type,name:d.name,dir:d.dir}),{force:!0}),n+=Number(s.run(d.id).changes),e(n,r.length);return n}}function c(a){return{id:String(a.id),mediaType:String(a.media_type),name:String(a.name),size:Number(a.size),createdAt:String(a.created_at),dir:a.dir==null?null:String(a.dir)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as l,readdirSync as w,readFileSync as d,renameSync as L,statSync as m,unlinkSync as j,writeFileSync as D}from"node:fs";import E from"node:os";import S from"node:path";import{statuslineCacheDir as _}from"./generator.js";export const SWEEP_INTERVAL_MS=10*6e4,FILE_STALE_MS=1440*6e4,TMP_STALE_MS=60*6e4;const x=["weave-sl-","weave-slc-"];export const LEGACY_STALE_MS=60*6e4;export class StatuslineCacheSweeper{dir;tmpDir;now;constructor(t=_(),e=E.tmpdir(),s=Date.now){this.dir=t,this.tmpDir=e,this.now=s}sweep(){return this.sweepCacheDir()+this.sweepLegacyTmp()}sweepCacheDir(){if(!l(this.dir))return 0;const t=this.now();let e=0;for(const s of y(this.dir)){const r=S.join(this.dir,s);if(s.endsWith(".tmp")){f(r,t,TMP_STALE_MS)&&(o(r),e++);continue}if(!s.endsWith(".json"))continue;if(f(r,t,FILE_STALE_MS)){o(r),e++;continue}let c;try{c=JSON.parse(d(r,"utf8"))}catch{o(r),e++;continue}const a=c.git??{},p=c.tokens??{};let h=!1;for(const[n,u]of Object.entries(a))(!u||typeof u.expires!="number"||u.expires<t)&&(delete a[n],h=!0);for(const n of Object.keys(p))this.transcriptLive(n,t)||(delete p[n],h=!0);if(Object.keys(a).length===0&&Object.keys(p).length===0){o(r),e++;continue}if(h){const n=`${r}.${process.pid}.tmp`;try{D(n,JSON.stringify({...c,git:a,tokens:p})),L(n,r)}catch{}}}return e}transcriptLive(t,e){try{return e-m(t).mtimeMs<=FILE_STALE_MS}catch{return!1}}sweepLegacyTmp(){const t=this.now();let e=0;for(const s of y(this.tmpDir)){if(!s.endsWith(".json")||!x.some(c=>s.startsWith(c)))continue;const r=S.join(this.tmpDir,s);f(r,t,LEGACY_STALE_MS)&&(o(r),e++)}return e}start(){this.sweep();const t=setInterval(()=>this.sweep(),SWEEP_INTERVAL_MS);return t.unref(),t}}export function startStatuslineCacheSweeper(){return new StatuslineCacheSweeper().start()}function y(i){try{return w(i)}catch{return[]}}function f(i,t,e){try{return t-m(i).mtimeMs>e}catch{return!1}}function o(i){try{j(i)}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateStatuslineScript as r}from"@weavecode/harness";import{getStatuslineDir as i}from"../db/paths.js";import{WEAVE_VERSION as n}from"../version.js";export function statuslineCacheDir(){return i()}export function generateStatuslineScript(t,e={}){return r(t,{cacheDir:e.cacheDir??statuslineCacheDir(),version:n})}
|
|
1
|
+
import{generateStatuslineScript as r}from"@weavecode/harness";import{getStatuslineDir as i,getVersionStampPath as a}from"../db/paths.js";import{WEAVE_VERSION as n}from"../version.js";export function statuslineCacheDir(){return i()}export function generateStatuslineScript(t,e={}){return r(t,{cacheDir:e.cacheDir??statuslineCacheDir(),version:n,versionFile:a()})}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{readFile as f,writeFile as
|
|
2
|
-
`,"utf-8")}export async function readStatuslineConfig(t){const e=await readGlobalStatuslineConfig();try{const
|
|
3
|
-
`,"utf-8")}export async function writeStatuslineScript(t,e){const
|
|
1
|
+
import{readFile as f,writeFile as p,mkdir as d}from"node:fs/promises";import{homedir as h}from"node:os";import l from"node:path";import{DEFAULT_STATUSLINE_CONFIG as a,LEGACY_IDENTITY_LINE as C,LEGACY_METRICS_LINE as x,NAMED_COLORS as v,SEGMENT_ORDER as b}from"./config.js";import{generateStatuslineScript as j,statuslineCacheDir as N}from"./generator.js";import{statuslineSurfaceFor as E}from"../surfaces.js";const w=".weave",y="statusline.json",S="statusline.json",s=E("claude");export function statuslineScriptRelPath(){return s.scriptRelPath}let u=l.join(h(),".weave");export function setGlobalStatuslineDir(t){u=t}export async function readGlobalStatuslineConfig(){try{const t=await f(l.join(u,S),"utf-8");return{...c(JSON.parse(t)),source:"global"}}catch{return a}}export async function writeGlobalStatuslineConfig(t){await d(u,{recursive:!0});const e={...c(t),source:"global"};await p(l.join(u,S),`${JSON.stringify(e,null,2)}
|
|
2
|
+
`,"utf-8")}export async function readStatuslineConfig(t){const e=await readGlobalStatuslineConfig();try{const r=await f(l.join(t,w,y),"utf-8"),n=JSON.parse(r);return n.source==="custom"?c(n):e}catch{return e}}export async function writeStatuslineConfig(t,e){const r=l.join(t,w);await d(r,{recursive:!0});const n=(e.source??"global")==="global"?{source:"global"}:c(e);await p(l.join(r,y),`${JSON.stringify(n,null,2)}
|
|
3
|
+
`,"utf-8")}export async function writeStatuslineScript(t,e){const r=l.join(t,s.scriptRelPath);return await d(l.dirname(r),{recursive:!0}),await p(r,e,"utf-8"),r}export async function readStatuslineScript(t){try{return await f(l.join(t,s.scriptRelPath),"utf-8")}catch{return""}}export function readStatuslineFacts(t){return s.facts?.(N(),t)??null}export async function ensureSettingsStatusLine(t,e=30){await s.wire(t,{scriptPath:l.join(t,s.scriptRelPath),refreshInterval:e})}export async function applyStatuslineConfig(t,e){await writeStatuslineConfig(t,e);const r=(e.source??"global")==="global"?await readGlobalStatuslineConfig():c(e),n=j(r);await writeStatuslineScript(t,n),await ensureSettingsStatusLine(t,r.refreshInterval)}function I(t){let e,r=!1;if(t.lines?.length)e=t.lines.map(o=>[...o]);else if(t.order?.length){r=!0;const o=t.order;t.layout==="multi"?e=[C.filter(i=>o.includes(i)),x.filter(i=>o.includes(i))].filter(i=>i.length>0):e=[o]}else r=!0,e=a.lines.map(o=>[...o]);const n=new Set;if(e=e.map(o=>o.filter(i=>!b.includes(i)||n.has(i)?!1:(n.add(i),!0))),e.length===0&&(e=[[]]),r){const o=b.filter(i=>{if(n.has(i))return!1;const m=t.segments?.[i];return typeof m?.enabled=="boolean"?m.enabled:a.segments[i].enabled});o.length&&(e[0]=[...e[0],...o])}return e}const $=/^#[0-9a-fA-F]{6}$/,L=/^#([0-9a-fA-F]{3})$/,_=/^ansi256:(\d{1,3})$/;function g(t,e){if(typeof t!="string")return e;if(v.includes(t))return t;const r=_.exec(t);if(r){const o=Number(r[1]);return o>=0&&o<=255?`ansi256:${o}`:e}if($.test(t))return t.toLowerCase();const n=L.exec(t);if(n){const[,o]=n;return`#${o[0]}${o[0]}${o[1]}${o[1]}${o[2]}${o[2]}`.toLowerCase()}return e}function F(t,e){if(!t||typeof t!="object")return{...e};const r=t,n={...e,...r,color:g(r.color,e.color),backgroundColor:r.backgroundColor==null?null:g(r.backgroundColor,e.backgroundColor??"gray")};return(typeof r.label!="string"||r.label==="")&&delete n.label,(typeof r.format!="string"||r.format==="")&&delete n.format,r.metric!=="session"&&r.metric!=="context"&&delete n.metric,r.window!=="five_hour"&&r.window!=="seven_day"&&r.window!=="spend"&&delete n.window,n}function T(t){const e=a.bar;if(!t||typeof t!="object")return{...e};const r=t,n=Math.round(Number(r.cells));return{cells:Number.isFinite(n)?Math.max(1,Math.min(40,n)):e.cells,fill:typeof r.fill=="string"&&r.fill!==""?r.fill:e.fill,empty:typeof r.empty=="string"&&r.empty!==""?r.empty:e.empty}}function c(t){const e={...a.segments};for(const n of Object.keys(e))e[n]=F(t.segments?.[n],e[n]);const r=t.refreshInterval;return{separator:t.separator??a.separator,align:t.align??a.align,logoText:a.logoText,logoColor:g(t.logoColor,a.logoColor),powerline:{...t.powerline,enabled:t.powerline?.enabled??a.powerline.enabled},lines:I(t),refreshInterval:r!=null&&r>=1?r:a.refreshInterval,source:t.source??a.source,bar:T(t.bar),divider:typeof t.divider=="string"?t.divider:a.divider,labelSeparator:typeof t.labelSeparator=="string"?t.labelSeparator:a.labelSeparator,segments:e}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRuntimeRegistry as
|
|
1
|
+
import{createRuntimeRegistry as n}from"@weavecode/harness";const r=n();export function assetSurfaceFor(e){const t=r.get(e)?.assets;if(!t)throw new Error(`no asset surface registered for harness: ${e}`);return t}export function assetSurfaces(){return r.all().map(e=>e.assets).filter(e=>e!==void 0)}export function pluginSurfaceFor(e){const t=r.get(e)?.plugins;if(!t)throw new Error(`no plugin surface registered for harness: ${e}`);return t}export function pluginSurfaces(){return r.all().filter(e=>e.plugins!==void 0).map(e=>({harness:e.id,surface:e.plugins}))}export function pluginStateFor(e){const t=r.get(e)?.pluginState;if(!t)throw new Error(`no plugin state surface registered for harness: ${e}`);return t}export function pluginStateSurfaces(){return r.all().filter(e=>e.pluginState!==void 0).map(e=>({harness:e.id,state:e.pluginState}))}export function messagingSurfaceFor(e){const t=r.get(e)?.messaging;if(!t)throw new Error(`no messaging surface registered for harness: ${e}`);return t}export function messagingSurfaces(){return r.all().filter(e=>e.messaging!==void 0).map(e=>({harness:e.id,surface:e.messaging}))}export function captureSurfaces(){return r.all().filter(e=>e.capture!==void 0).map(e=>({harness:e.id,surface:e.capture}))}export function blockingPromptFor(e){return r.get(e)?.questions??null}export function statuslineSurfaceFor(e){return r.get(e)?.statusline??null}export function statuslineSurfaces(){return r.all().filter(e=>e.statusline!==void 0).map(e=>({harness:e.id,surface:e.statusline}))}export function configSurfaceFor(e){return r.get(e)?.config??null}export function editSurfaceFor(e){return r.get(e)?.edits??null}export function imagesSurfaceFor(e){return r.get(e)?.images??null}export function narrationSurfaceFor(e){return r.get(e)?.narration??null}export function rewindSurfaceFor(e){return r.get(e)?.rewind??null}export function commandsSurfaceFor(e){return r.get(e)?.commands??null}export function configSurfaces(){return r.all().filter(e=>e.config!==void 0).map(e=>({harness:e.id,surface:e.config}))}export function sessionTitleSurfaceFor(e){return r.get(e)?.titles??null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export class WatchCache{byProject=new Map;upsert(e,t){let r=this.byProject.get(e);r||(r=new Map,this.byProject.set(e,r)),r.set(t.relPath,t)}remove(e,t){this.byProject.get(e)?.delete(t)}list(e){const t=this.byProject.get(e);return t?[...t.values()].sort((r,
|
|
1
|
+
export class WatchCache{byProject=new Map;upsert(e,t){let r=this.byProject.get(e);r||(r=new Map,this.byProject.set(e,r)),r.set(t.relPath,t)}remove(e,t){this.byProject.get(e)?.delete(t)}list(e){const t=this.byProject.get(e);return t?[...t.values()].sort((r,l)=>r.relPath.localeCompare(l.relPath)):[]}clear(e){this.byProject.delete(e)}clearAll(){this.byProject.clear()}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assetSurfaces as
|
|
1
|
+
import{assetSurfaces as r}from"../surfaces.js";export function classifyAsset(s){const t=normalizeRelPath(s);if(t===".mcp.json")return"mcp";if(t.startsWith(".claude/skills/")||t.startsWith(".codex/skills/")||t.startsWith(".agents/skills/"))return"skill";if(t===".claude/settings.json"||t===".claude/settings.local.json"||t===".codex/config.toml")return"settings";if(t.startsWith(".claude/commands/")||t.startsWith(".codex/prompts/"))return"command";if(t.startsWith(".claude/agents/"))return"agent";if(t.startsWith(".claude/helpers/"))return"helper";if(t.startsWith(".claude/workflows/"))return"workflow";if(t.startsWith(".claude/rules/"))return"rule";if(t.startsWith(".claude/output-styles/"))return"output-style";if(t.startsWith(".claude/plugins/")||t.startsWith(".weave/plugins/"))return"plugin";const e=t.slice(t.lastIndexOf("/")+1);return e==="CLAUDE.md"||e==="AGENTS.md"?"instructions":"other"}export function classifyAgent(s){const t=normalizeRelPath(s);return r().find(e=>e.classify(t))?.harness??"claude"}export function normalizeRelPath(s){let t=s.replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);for(;t.startsWith("/");)t=t.slice(1);return t}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync as
|
|
1
|
+
import{readFileSync as c,statSync as u,existsSync as a}from"node:fs";import n from"node:path";const h=8;export class PluginModsSniffer{cache=new Map;verdicts=new Map;revalidate;constructor(e={}){this.revalidate=e.revalidate??!0}refine(e,t,s){return e!=="plugin"?e:this.sniff(n.dirname(s))?"mods":"plugin"}sniff(e){if(!this.revalidate){const s=this.verdicts.get(e);if(s!==void 0)return s}const t=this.walkUp(e);return this.revalidate||this.verdicts.set(e,t),t}walkUp(e){let t=e;for(let s=0;s<h;s++){if(f(t))return!1;if(this.hooksMods(t))return!0;if(a(n.join(t,".claude-plugin","plugin.json")))return!1;const i=n.dirname(t);if(i===t)return!1;t=i}return!1}hooksMods(e){const t=n.join(e,"hooks","hooks.json"),s=this.cache.get(e);let i=-1;if(a(t))try{i=u(t).mtimeMs}catch{}if(i===-1)return s?.hooksMtimeMs!==-1&&this.cache.set(e,{mods:!1,hooksMtimeMs:-1}),!1;if(s&&s.hooksMtimeMs===i)return s.mods;const o=d(t);return this.cache.set(e,{mods:o,hooksMtimeMs:i}),o}}function f(r){if(n.basename(r)!=="plugins")return!1;const e=n.basename(n.dirname(r));return e===".claude"||e===".weave"}export function hasNonEmptyModules(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const e=r.modules;return Array.isArray(e)&&e.length>0}function d(r){try{return hasNonEmptyModules(JSON.parse(c(r,"utf8")))}catch{return!1}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FingerprintCache as
|
|
1
|
+
import{FingerprintCache as a}from"../install/fingerprint.js";import{buildLibraryIndex as e}from"../install/library-index.js";import{detectUpdates as n}from"../install/updates.js";import{syncAll as c}from"../install/apply-update.js";import{markSynced as h}from"../install/project-config.js";import{syncPlugins as o}from"../hooks/plugin-project-state.js";export class SyncScheduler{projects;libraries;timer;intervalMs;cache;plugins;onSynced;running=!1;constructor(s,r,t={}){this.projects=s,this.libraries=r,this.intervalMs=t.intervalMs??6e4,this.cache=t.cache??new a,this.plugins=t.plugins,this.onSynced=t.onSynced}start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs))}stop(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}async tick(){if(!this.running&&this.libraries){this.running=!0;try{const s=this.libraries.list(),r=await e(s),t=this.plugins?.list().map(i=>i.id);for(const i of this.projects.list()){if(t)try{o(i,t,{projects:this.projects})}catch{}(await n(i.path,s,this.cache,r)).available!==0&&(await c(i.path,s,this.cache,r),await h(i.path,new Date().toISOString()),this.onSynced?.())}}finally{this.running=!1}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EventEmitter as
|
|
1
|
+
import{EventEmitter as p}from"node:events";import{existsSync as b,lstatSync as w,readdirSync as P,realpathSync as y,statSync as f,watch as d}from"node:fs";import h from"node:path";import{watch as j}from"chokidar";import{WatchCache as v}from"./cache.js";import{classifyAgent as R,classifyAsset as S,normalizeRelPath as g}from"./classifier.js";import{PluginModsSniffer as T}from"./plugin-mods.js";import{globalPersonalSkillRootsOwned as M}from"../install/global-config.js";import{assetSurfaces as G}from"../surfaces.js";const k="<global>",I=new T;export function shouldIgnore(c){return c===""||c==="."||c===".weave"||c.startsWith(".weave/")?!1:G().every(e=>e.ignore(c))}export class WatchService{projects;emitter=new p;watchers=new Map;cache=new v;debounceMs;reconcileMs;isIgnored;globalRootSource;timers=new Map;pending=new Map;reconcileTimer;globalRoots=new Map;globalPending=new Map;globalTimer;constructor(e,t={}){this.projects=e,this.debounceMs=t.debounceMs??300,this.reconcileMs=t.reconcileMs??5e3,this.isIgnored=t.isIgnored??shouldIgnore,this.globalRootSource=t.globalRootSource??M}start(){this.reconcile(),this.reconcileTimer=setInterval(()=>this.reconcile(),this.reconcileMs)}stop(){for(const e of this.watchers.values())e.close();this.watchers.clear();for(const e of[...this.globalRoots.keys()])this.unwatchGlobalRoot(e);for(const e of this.timers.values())clearTimeout(e);this.timers.clear(),this.pending.clear(),this.globalPending.clear(),this.globalTimer&&(clearTimeout(this.globalTimer),this.globalTimer=void 0),this.cache.clearAll(),this.reconcileTimer&&(clearInterval(this.reconcileTimer),this.reconcileTimer=void 0)}reconcile(){const e=new Set(this.projects.list().map(t=>t.path));for(const t of e)this.watchers.has(t)||(this.watchProject(t),this.watchers.has(t)&&this.emitter.emit("project",{action:"added",projectPath:t}));for(const t of[...this.watchers.keys()])e.has(t)||(this.unwatchProject(t),this.emitter.emit("project",{action:"removed",projectPath:t}));this.reconcileGlobalRoots()}reconcileGlobalRoots(){const e=this.globalRootSource(),t=new Set(e.map(s=>s.root));for(const{harness:s,root:o}of e){if(this.globalRoots.has(o)){this.syncGlobalEntries(o);continue}b(o)&&this.watchGlobalRoot(o,s)}for(const s of[...this.globalRoots.keys()])(!t.has(s)||!b(s))&&this.unwatchGlobalRoot(s)}getAssets(e){return this.cache.list(e)}subscribe(e){return this.emitter.on("change",e),()=>this.emitter.off("change",e)}subscribeProjects(e){return this.emitter.on("project",e),()=>this.emitter.off("project",e)}watchProject(e){if(!b(e))return;const t=this.projects.getByPath(e)?.name??h.basename(e),s=j(".",{cwd:e,ignored:o=>this.isIgnored(g(h.relative(e,o))),ignoreInitial:!1,awaitWriteFinish:{stabilityThreshold:200,pollInterval:50}});this.watchers.set(e,s),s.on("add",o=>this.onFile(e,t,o,"add")),s.on("change",o=>this.onFile(e,t,o,"change")),s.on("unlink",o=>this.onFile(e,t,o,"unlink")),s.on("error",o=>this.emitter.emit("watch-error",o))}unwatchProject(e){const t=this.watchers.get(e);t&&(t.close(),this.watchers.delete(e));const s=this.timers.get(e);s&&(clearTimeout(s),this.timers.delete(e)),this.pending.delete(e),this.cache.clear(e)}watchGlobalRoot(e,t){const s=d(e,(o,i)=>{this.syncGlobalEntries(e),i&&this.emitGlobalPath(e,g(String(i)))});s.on("error",o=>this.emitter.emit("watch-error",o)),this.globalRoots.set(e,{harness:t,root:s,entries:new Map}),this.syncGlobalEntries(e)}syncGlobalEntries(e){const t=this.globalRoots.get(e);if(!t)return;let s;try{s=P(e)}catch{return}const o=new Set;for(const i of s){if(i.startsWith("."))continue;const r=h.join(e,i);let a;try{if(!f(r).isDirectory())continue;a=y(r)}catch{continue}o.add(i);const l=t.entries.get(i);if(l?.real===a)continue;l&&(l.watcher.close(),t.entries.delete(i));const n=d(a,{recursive:!0},(u,m)=>{m&&this.emitGlobalPath(e,g(h.join(i,String(m))))});n.on("error",()=>{n.close(),t.entries.delete(i)}),t.entries.set(i,{real:a,watcher:n})}for(const[i,r]of t.entries)o.has(i)||(r.watcher.close(),t.entries.delete(i))}unwatchGlobalRoot(e){const t=this.globalRoots.get(e);if(t){t.root.close();for(const s of t.entries.values())s.watcher.close();this.globalRoots.delete(e)}}emitGlobalPath(e,t){if(!t||t.split("/").some(i=>i.startsWith(".")))return;const s=h.join(e,t);let o="unlink";try{if(!f(s).isFile())return;o="change"}catch{}this.enqueueGlobal({projectPath:k,projectName:"global",category:"skill",agent:this.globalRoots.get(e)?.harness??"claude",relPath:t,absPath:s,kind:o})}enqueueGlobal(e){this.globalPending.set(e.absPath,e),this.globalTimer&&clearTimeout(this.globalTimer),this.globalTimer=setTimeout(()=>this.flushGlobal(),this.debounceMs)}flushGlobal(){this.globalTimer=void 0;for(const e of this.globalPending.values())this.emitter.emit("change",e);this.globalPending.clear()}onFile(e,t,s,o){const i=g(s),r=h.join(e,i);let a=S(i);o!=="unlink"&&a==="plugin"&&(a=I.refine(a,i,r));const l=R(i);let n;if(o==="unlink")this.cache.remove(e,i);else try{const u=w(r);n=u.isSymbolicLink()||void 0;const m=n?f(r).mtimeMs:u.mtimeMs;this.cache.upsert(e,{absPath:r,relPath:i,category:a,agent:l,mtimeMs:m,...n?{isSymlink:!0}:{}})}catch{this.cache.remove(e,i)}this.enqueue(e,{projectPath:e,projectName:t,category:a,agent:l,relPath:i,absPath:r,kind:o,...n?{isSymlink:!0}:{}})}enqueue(e,t){let s=this.pending.get(e);s||(s=new Map,this.pending.set(e,s)),s.set(t.relPath,t);const o=this.timers.get(e);o&&clearTimeout(o),this.timers.set(e,setTimeout(()=>this.flush(e),this.debounceMs))}flush(e){this.timers.delete(e);const t=this.pending.get(e);if(this.pending.delete(e),!!t)for(const s of t.values())this.emitter.emit("change",s)}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weavecode/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Weave daemon — HTTP server, SQLite data layer, and hook ingestion",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
24
|
-
"@weavecode/core": "^0.1.
|
|
25
|
-
"@weavecode/harness": "^0.1.
|
|
26
|
-
"@weavecode/templates": "^0.1.
|
|
24
|
+
"@weavecode/core": "^0.1.9",
|
|
25
|
+
"@weavecode/harness": "^0.1.9",
|
|
26
|
+
"@weavecode/templates": "^0.1.9",
|
|
27
27
|
"chokidar": "^4.0.0",
|
|
28
28
|
"selfsigned": "^5.5.0",
|
|
29
29
|
"smol-toml": "^1.3.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-2E7WHVMD-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-2E7WHVMD-DJ7X_Shu.js";import{p as f}from"./chunk-JWPE2WC7-CmjTZO8o.js";import{_ as n,l as o}from"./mermaid.core-C-wP0Zg2.js";import"./main-bsb0lQoL.js";import{M as c,b as d}from"./cynefin-EF2NZ3EQ-stAu4Rh-.js";import"./modulepreload-polyfill-B5Qt9EMX.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a5 as ln,a6 as an,a7 as H,a8 as j,a9 as B,aa as un,ab as g,ac as tn,ad as L,ae as _,af as rn,ag as o,ah as on,ai as sn,aj as fn}from"./mermaid.core-
|
|
1
|
+
import{a5 as ln,a6 as an,a7 as H,a8 as j,a9 as B,aa as un,ab as g,ac as tn,ad as L,ae as _,af as rn,ag as o,ah as on,ai as sn,aj as fn}from"./mermaid.core-C-wP0Zg2.js";function cn(l){return l.innerRadius}function gn(l){return l.outerRadius}function yn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,E,q,v,A,C,a){var I=E-l,i=q-h,n=C-v,d=a-A,u=d*I-n*i;if(!(u*u<g))return u=(n*(h-A)-d*(l-v))/u,[l+u*I,h+u*i]}function W(l,h,E,q,v,A,C){var a=l-E,I=h-q,i=(C?A:-A)/L(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,F=(u+f)/2,t=(s+c)/2,m=f-u,y=c-s,R=m*m+y*y,T=v-A,P=u*c-f*s,O=(y<0?-1:1)*L(on(0,T*T*R-P*P)),S=(P*y-m*O)/R,z=(-P*m-y*O)/R,w=(P*y+m*O)/R,p=(-P*m+y*O)/R,x=S-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(S=w,z=p),{cx:S,cy:z,x01:-n,y01:-d,x11:S*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=gn,E=B(0),q=null,v=yn,A=dn,C=mn,a=null,I=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,F=rn(c-f),t=c>f;if(a||(a=n=I()),s<u&&(d=s,s=u,u=d),!(s>g))a.moveTo(0,0);else if(F>tn-g)a.moveTo(s*H(f),s*j(f)),a.arc(0,0,s,f,c,!t),u>g&&(a.moveTo(u*H(c),u*j(c)),a.arc(0,0,u,c,f,t));else{var m=f,y=c,R=f,T=c,P=F,O=F,S=C.apply(this,arguments)/2,z=S>g&&(q?+q.apply(this,arguments):L(u*u+s*s)),w=_(rn(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(z>g){var G=sn(z/u*j(S)),M=sn(z/s*j(S));(P-=G*2)>g?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(O-=M*2)>g?(M*=t?1:-1,m+=M,y-=M):(O=0,m=y=(f+c)/2)}var J=s*H(m),K=s*j(m),N=u*H(T),Q=u*j(T);if(w>g){var U=s*H(y),V=s*j(y),X=u*H(R),Y=u*j(R),D;if(F<an)if(D=pn(J,K,X,Y,U,V,N,Q)){var Z=J-D[0],$=K-D[1],b=U-D[0],k=V-D[1],nn=1/j(fn((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(D[0]*D[0]+D[1]*D[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}O>g?x>g?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,y,!t)):a.moveTo(J,K),!(u>g)||!(P>g)?a.lineTo(N,Q):p>g?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[H(d)*n,j(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:B(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:B(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|