@weavecode/weave 0.1.3 → 0.1.4
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/express/node_modules/qs/.editorconfig +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/CHANGELOG.md +45 -22
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/README.md +26 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/dist/qs.js +27 -27
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/eslint.config.mjs +61 -50
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/formats.js +7 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/parse.js +13 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/stringify.js +5 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/utils.js +15 -7
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/package.json +6 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/dist/common.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/package.json +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/README.md +2 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/helper/css/common.js +8 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/helper/css/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/helper/route/index.js +3 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/jsx/base.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +8 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/serve-static/index.js +3 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/trie-router/node.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/utils/url.js +11 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/helper/css/common.js +8 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/helper/css/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/helper/route/index.js +3 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/jsx/base.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/bearer-auth/index.js +8 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/serve-static/index.js +3 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/trie-router/node.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/helper/testing/index.d.ts +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/hono-base.d.ts +21 -9
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/index.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/components.d.ts +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/context.d.ts +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/dom/components.d.ts +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/dom/css.d.ts +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/streaming.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/utils/ipaddr.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/utils/url.js +11 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/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/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 -1
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +14 -0
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +4 -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 +3 -3
- package/node_modules/@weavecode/cli/dist/init/executor.d.ts +5 -4
- 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/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-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.d.ts +25 -0
- package/node_modules/@weavecode/cli/dist/init/provision.js +1 -0
- 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 +13 -1
- 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.js +1 -1
- package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
- package/node_modules/@weavecode/core/dist/utils/logger.js +1 -1
- package/node_modules/@weavecode/core/package.json +1 -1
- package/node_modules/@weavecode/harness/dist/claude/assets.js +4 -4
- 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.d.ts +9 -0
- 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.d.ts +2 -0
- 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.d.ts +4 -2
- package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/liveness.d.ts +64 -0
- package/node_modules/@weavecode/harness/dist/claude/liveness.js +1 -0
- 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.d.ts +4 -0
- package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/narration.d.ts +13 -0
- package/node_modules/@weavecode/harness/dist/claude/narration.js +1 -0
- 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/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.js +14 -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.d.ts +13 -0
- package/node_modules/@weavecode/harness/dist/claude/transcript.js +7 -6
- package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/capture.d.ts +1 -2
- 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.d.ts +10 -0
- 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.d.ts +1 -1
- package/node_modules/@weavecode/harness/dist/codex/event-source.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/images.d.ts +2 -0
- package/node_modules/@weavecode/harness/dist/codex/images.js +1 -0
- package/node_modules/@weavecode/harness/dist/codex/index.d.ts +13 -2
- package/node_modules/@weavecode/harness/dist/codex/index.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/liveness.d.ts +38 -0
- package/node_modules/@weavecode/harness/dist/codex/liveness.js +1 -0
- package/node_modules/@weavecode/harness/dist/codex/mcp.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/messaging.d.ts +7 -3
- package/node_modules/@weavecode/harness/dist/codex/messaging.js +3 -3
- package/node_modules/@weavecode/harness/dist/codex/narration.d.ts +10 -0
- package/node_modules/@weavecode/harness/dist/codex/narration.js +1 -0
- 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.d.ts +12 -0
- package/node_modules/@weavecode/harness/dist/codex/provision.js +1 -0
- package/node_modules/@weavecode/harness/dist/codex/questions.d.ts +9 -0
- package/node_modules/@weavecode/harness/dist/codex/questions.js +2 -0
- package/node_modules/@weavecode/harness/dist/codex/resume.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/rollout.d.ts +8 -5
- package/node_modules/@weavecode/harness/dist/codex/rollout.js +5 -5
- package/node_modules/@weavecode/harness/dist/codex/side-question.d.ts +12 -0
- package/node_modules/@weavecode/harness/dist/codex/side-question.js +4 -0
- package/node_modules/@weavecode/harness/dist/codex/titles.d.ts +8 -0
- package/node_modules/@weavecode/harness/dist/codex/titles.js +4 -0
- 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.d.ts +162 -8
- package/node_modules/@weavecode/harness/dist/driver.js +1 -1
- package/node_modules/@weavecode/harness/dist/index.d.ts +1 -0
- package/node_modules/@weavecode/harness/dist/index.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/install.d.ts +9 -0
- package/node_modules/@weavecode/harness/dist/install.js +1 -0
- 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.d.ts +10 -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 +6 -6
- package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/claude-liveness.d.ts +4 -55
- package/node_modules/@weavecode/server/dist/daemon/claude-liveness.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/data-bus.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/fs-browser.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.d.ts +2 -0
- 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.d.ts +7 -0
- package/node_modules/@weavecode/server/dist/daemon/liveness.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/mcp-orchestration.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/narration-watcher.d.ts +28 -0
- package/node_modules/@weavecode/server/dist/daemon/narration-watcher.js +2 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.d.ts +16 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.d.ts +20 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.js +12 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.d.ts +23 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.js +2 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.d.ts +19 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.d.ts +87 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.d.ts +45 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend.d.ts +115 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/backend.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/opener/launch.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/pty-terminals.js +4 -4
- package/node_modules/@weavecode/server/dist/daemon/opener/shared.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/wezterm-mux.d.ts +8 -5
- 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.d.ts +23 -120
- package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -13
- package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/project-files.d.ts +17 -2
- package/node_modules/@weavecode/server/dist/daemon/project-files.js +2 -1
- package/node_modules/@weavecode/server/dist/daemon/project-harnesses.d.ts +2 -0
- 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/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/project-files.d.ts +6 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/project-files.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/projects.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/search.d.ts +38 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/search.js +1 -0
- 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/watches.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/server.d.ts +8 -2
- package/node_modules/@weavecode/server/dist/daemon/server.js +8 -8
- package/node_modules/@weavecode/server/dist/daemon/session-open.d.ts +10 -1
- 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 +5 -2
- package/node_modules/@weavecode/server/dist/db/layout.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/answer-keys.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/bus.d.ts +10 -0
- package/node_modules/@weavecode/server/dist/hooks/bus.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.d.ts +20 -0
- 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.d.ts +7 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/keys.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/queue.d.ts +4 -4
- 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.d.ts +3 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/dispatcher.d.ts +5 -0
- 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.d.ts +15 -0
- 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.d.ts +64 -6
- package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +3 -2
- 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.d.ts +5 -0
- 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/session-sweeper.d.ts +2 -0
- package/node_modules/@weavecode/server/dist/hooks/session-sweeper.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/index.d.ts +1 -0
- package/node_modules/@weavecode/server/dist/index.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.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 +5 -5
- package/node_modules/@weavecode/server/dist/repositories/hook-events.d.ts +19 -1
- package/node_modules/@weavecode/server/dist/repositories/hook-events.js +9 -3
- 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 +2 -2
- 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.d.ts +12 -2
- package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/side-questions.d.ts +7 -0
- package/node_modules/@weavecode/server/dist/repositories/side-questions.js +8 -5
- 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.d.ts +8 -1
- package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
- package/node_modules/@weavecode/server/dist/version.d.ts +1 -11
- package/node_modules/@weavecode/server/dist/version.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-etRkSvQM.js → abnfDiagram-WEYOIA3C-DA-K085F.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{arc-FxRZALAZ.js → arc-BI1jnmdZ.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{architectureDiagram-ZHVYKT53-5OxZ-ffz.js → architectureDiagram-ZHVYKT53-DbdBgric.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-C-CgMF0O.js → blockDiagram-RJAE7QA3-BPRBmzb-.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-B6TqN1Pw.js → c4Diagram-XDPPPE54-C4D5sRs1.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/channel-DcCJrvon.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-Bdzr5RRj.js → chunk-2E7WHVMD-9ZSKiNU3.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-gBZASjAC.js → chunk-2Q5K7J3B-i0AOjw_8.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-DSlUhKMw.js → chunk-4EMNKR2T-DTpLfX1H.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-55XCU76K-BDQ6zpGR.js → chunk-55XCU76K-COQYRD4q.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-DPnewKbl.js → chunk-5VM5RSS4-VsftEbvo.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-DagmT8Cc.js → chunk-JWPE2WC7-DonektJN.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-Da_2PxfM.js → chunk-VQ5W62QI-CaKUwuul.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-XXDRQBXY-Cdaysois.js → chunk-XXDRQBXY-DXH3D_MT.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-ZCHMQSOR-CvgYfbjU.js → chunk-ZCHMQSOR-COwyAuGn.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-ahplYD2h.js → classDiagram-v2-4MYWR3UA-DEvMZ6mX.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cose-bilkent-JH36ORCC-DFyUfgKj.js → cose-bilkent-JH36ORCC-6JBJHfH6.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-mr2qRwod.js → cynefin-EF2NZ3EQ-C4GM4sjT.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cynefinDiagram-WF24UDRP-BC26VqNp.js → cynefinDiagram-WF24UDRP-Cqgi0MBP.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{dagre-NK4GIZVX-DoKn_P1x.js → dagre-NK4GIZVX-CljrnkCY.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-CBK3MWTC-C9WfEmt3.js → diagram-CBK3MWTC-C3PyOj5J.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-I5XIIV2D-D4Ibieda.js → diagram-I5XIIV2D-I5brQlaZ.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-wsLbYLi0.js → diagram-ODIL2UCW-BX9uFNbU.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-DBioMmDk.js → diagram-PFBEJUXE-y7D-VmqJ.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-RJA3I4VV-Cl5gKsWm.js → diagram-RJA3I4VV-DLUL8W42.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-BSXOaZic.js → diagram-TYUNFSNR-DLCC3ILi.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ebnfDiagram-V4P3TTPT-CJIGOag6.js → ebnfDiagram-V4P3TTPT-D7vALia7.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ-D6nd2OVX.js → elk-QONTBCTQ-Ct2_hatz.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-gmXjWsuF.js → erDiagram-KYQIGQAA-DxLai58T.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-DWAiZ43K.js → flowDiagram-IUGLLWBU-AWn2IHrF.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ganttDiagram-R7GPNTJY-De4v6Wtt.js → ganttDiagram-R7GPNTJY-DmRHd4Wz.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{gitGraphDiagram-PDYL7XHY-CouLBWOB.js → gitGraphDiagram-PDYL7XHY-Ccj-t3zg.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/index-BSxzia7U.js +1031 -0
- package/node_modules/@weavecode/server/web/dist/assets/index-CEpJpR7P.css +11 -0
- package/node_modules/@weavecode/server/web/dist/assets/{infoDiagram-MVDRKAX5-CeMCdduD.js → infoDiagram-MVDRKAX5-BHquFlQa.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-DK6hETwg.js → ishikawaDiagram-HPEHV2GE-CVogEbdm.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-BcgwTlST.js → journeyDiagram-BOSHW7O7-DC9XG9oh.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-CTVMJNz2.js → kanban-definition-FNSA4HC5-C_eu7DC_.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{linear-CqQf5eWO.js → linear-keTbWHJ-.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-B6KZaljU.js → mermaid.core-4sbg0MnY.js} +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-cpKvrQTI.js → mindmap-definition-6OY57UG3-kMQS0S2l.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{pegDiagram-ECIUJNBX-Bv2bNqMZ.js → pegDiagram-ECIUJNBX-DcUFoEwP.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{pieDiagram-GNMPY74T-CXOnA429.js → pieDiagram-GNMPY74T-BQJ7WDCx.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-BFDUpWZb.js → quadrantDiagram-D57K4MC3-C7Oi1-sq.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{railroadDiagram-Y72NRBL7-BHoDSO0D.js → railroadDiagram-Y72NRBL7-CEF2QbOF.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-B8JGji7q.js → requirementDiagram-EQYSW5RA-CTjjFS7X.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-BbE2-6ZM.js → sankeyDiagram-SY24JHO5-j0S5kubS.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-DwK4X2MT.js → sequenceDiagram-BLEHNHQU-B76EsZp4.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sizeCapture-INFHLROL-CY10zRMe.js → sizeCapture-INFHLROL-r0DZuqAy.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-32t4Zx8b.js → stateDiagram-v2-A6IESKWZ-B4DR9LHz.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{swimlanes-B3ENRKFQ-CZlYQ8_g.js → swimlanes-B3ENRKFQ-Dbcl85ro.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-CZ_6SSBd.js +8 -0
- package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-8VsB-Jwg.js → timeline-definition-JXYKGLGB-BlBXXRNf.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-CKOTONay.js → usecaseDiagram-WPOLBNNX-Ck1M0dpc.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-BzrNjxtm.js → vennDiagram-Q3Y3IDCW-N8B-ohWk.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-CrSd-v8I.js → wardleyDiagram-IVAIDKWA-DX-AMXq_.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-t9cV9_9b.js → xychartDiagram-4URNHDU4-4fgL48Yl.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/index.html +5 -4
- package/node_modules/@weavecode/templates/package.json +2 -2
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/node_modules/@peculiar/asn1-x509-attr/package.json +3 -3
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/package.json +4 -4
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-csr/package.json +3 -3
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-ecc/package.json +3 -3
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/@peculiar/asn1-pfx/package.json +5 -5
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/@peculiar/asn1-pkcs8/package.json +3 -3
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/@peculiar/asn1-x509-attr/package.json +3 -3
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/package.json +7 -7
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-rsa/package.json +3 -3
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-schema/package.json +1 -1
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/build/cjs/time.js +1 -1
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/build/es2015/time.js +1 -1
- package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/package.json +2 -2
- package/package.json +6 -6
- package/node_modules/@weavecode/server/web/dist/assets/channel-Dv4QUMOJ.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/index-BXhLerZ4.js +0 -1008
- package/node_modules/@weavecode/server/web/dist/assets/index-BYRxC-Zz.css +0 -11
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-BlIxQLON.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as D}from"node:fs";import{readFile as S,readdir as I}from"node:fs/promises";import d from"node:path";import{pathToFileURL as P}from"node:url";import{watch as A}from"chokidar";import{builtinRulesDir as M}from"../market/builtin.js";import{HARNESS_EVENT_UNION as W,HookRuleSchema as O,PluginRuleEntrySchema as x,WEAVE_PLUGIN_MANIFEST as T,WeavePluginManifestSchema as H}from"@weavecode/core";import{getDataRoot as L,getPluginsDir as N}from"../db/paths.js";import{marketLibraryRoots as C}from"../market/resolve.js";import{validateHandler as U}from"./registry.js";import{builtinToolkitRoot as _,discoverToolkitSources as B,discoverWeavePackDirs as F}from"./toolkit-scan.js";export function createPluginLogger(l){return{debug:e=>console.debug(`[plugin:${l}] ${e}`),info:e=>console.info(`[plugin:${l}] ${e}`),warn:e=>console.warn(`[plugin:${l}] ${e}`),error:e=>console.error(`[plugin:${l}] ${e}`)}}const j="@file:";function q(){return d.resolve(_())}export class WeavePluginLoader{deps;handlers=new Map;configs=new Map;plugins=new Map;subscribers=new Map;roots=new Map;watchStop;constructor(e){this.deps=e}list(){return[...this.plugins.values()]}getHandler(e,s){return this.handlers.get(`${e}:${s}`)}getConfig(e){return this.configs.get(e)??{}}async loadRoot(e,s,o){const n=d.resolve(e);this.roots.set(n,{scope:s,projectId:o});let i;try{i=await I(n)}catch{return[]}const t=this.priorIdsUnder(n),c=[];for(const f of i){const u=d.join(n,f);if(this.roots.has(d.resolve(u))||d.resolve(u)===q())continue;const g=await this.loadOne(u,s,o,f);this.plugins.set(g.id,g),c.push(g)}return this.finalizeScan(t,c)}async loadToolkitRoot(e,s,o){const n=d.resolve(e);this.roots.set(n,{scope:s,projectId:o,deep:!0});const i=await F(n),t=this.priorIdsUnder(n),c=[];for(const f of i){await this.ensureToolkitDefaultDisabled(f);const u=await this.loadOne(f,s,o,d.basename(f));this.plugins.set(u.id,u),c.push(u)}return this.finalizeScan(t,c)}async ensureToolkitDefaultDisabled(e){try{const s=JSON.parse(await S(d.join(e,T),"utf8"));typeof s.id=="string"&&!this.deps.states.get(s.id)&&this.deps.states.setEnabled(s.id,!1)}catch{}}priorIdsUnder(e){const s=[...this.roots.keys()].filter(o=>o!==e&&o.startsWith(e+d.sep));return new Set([...this.plugins.values()].filter(o=>o.dir.startsWith(e+d.sep)?!s.some(n=>o.dir.startsWith(n+d.sep)):!1).map(o=>o.id))}finalizeScan(e,s){const o=new Set(s.map(i=>i.id));let n=!1;for(const i of e)o.has(i)||(this.deps.rules.removeByPlugin(i),this.unloadHandlers(i),this.configs.delete(i),this.plugins.delete(i),n=!0,this.emitReload({pluginId:i,status:"rejected",ruleCount:0,removed:!0}));(n||s.length>0)&&this.deps.registry.load();for(const i of s)this.emitReload({pluginId:i.id,status:i.status,ruleCount:i.ruleCount,at:new Date().toISOString()});return s}watchRoots(e=1e3){if(this.watchStop)return this.watchStop;const s=new Map,o=[...this.roots.entries()].filter(([n])=>D(n)).map(([n,i])=>{const t=i.deep?6:i.projectId!==null?3:2,c=A(n,{ignoreInitial:!0,depth:t});return c.on("all",()=>{const f=s.get(n);f&&clearTimeout(f),s.set(n,setTimeout(()=>{s.delete(n);const u=this.roots.get(n);if(!u)return;(u.deep?this.loadToolkitRoot(n,u.scope,u.projectId):this.loadRoot(n,u.scope,u.projectId)).catch(()=>{})},e))}),c.on("error",()=>{}),c});return this.watchStop=()=>{for(const n of s.values())clearTimeout(n);s.clear();for(const n of o)n.close();this.watchStop=void 0},this.watchStop}async reloadAll(){for(const[e,s]of[...this.roots])await(s.deep?this.loadToolkitRoot(e,s.scope,s.projectId):this.loadRoot(e,s.scope,s.projectId)).catch(()=>{})}stopWatching(){this.watchStop?.()}async rescanRoots(e,s){await registerPluginRoots(this,{libraries:s},e),this.stopWatching(),await this.reloadAll(),this.watchRoots()}setPluginEnabled(e,s){const o=this.plugins.get(e);if(!o)return!1;this.deps.states.setEnabled(e,s);for(const i of this.deps.rules.listByPlugin(e))this.deps.rules.setEnabled(i.id,s);this.deps.registry.load();const n=s?o.error?"rejected":"active":"disabled";return this.plugins.set(e,{...o,status:n}),this.deps.bus?.emit({kind:"plugin.toggled",pluginId:e,enabled:s,at:new Date().toISOString()}),!0}unloadHandlers(e){for(const s of[...this.handlers.keys()])s.startsWith(`${e}:`)&&this.handlers.delete(s);this.subscribers.delete(e)}notifyEvent(e,s,o){for(const[n,i]of this.subscribers){if(!i.events.has(e))continue;const t=this.configs.get(n)??{};(async()=>{await i.sub.onEvent({eventType:e,payload:s,sessionId:o,config:t,logger:createPluginLogger(n)})})().catch(()=>{})}}emitReload(e){this.deps.bus?.emit({kind:"plugin.reloaded",at:new Date().toISOString(),...e})}async loadOne(e,s,o,n){const i=(r,a,v=n,h="0.0.0")=>{const w=this.plugins.get(r);return w&&w.dir===e&&(this.deps.rules.removeByPlugin(r),this.unloadHandlers(r),this.configs.delete(r)),{id:r,name:v,version:h,dir:e,scope:s,projectId:o,status:"rejected",error:a,ruleCount:0}};let t;try{const r=JSON.parse(await S(d.join(e,T),"utf8")),a=H.safeParse(r);if(!a.success)return i(n,`manifest \u6821\u9A8C\u5931\u8D25: ${a.error.issues[0]?.message??""}`);t=a.data}catch(r){return i(n,`manifest \u8BFB\u53D6\u5931\u8D25: ${r instanceof Error?r.message:String(r)}`)}if(s!=="builtin"&&t.id.startsWith("weave-"))return i(t.id,"id \u4EE5 weave- \u5F00\u5934\u4E3A\u5185\u7F6E\u9884\u8BBE\u547D\u540D\u7A7A\u95F4\u4FDD\u7559",t.name,t.version);const c=this.plugins.get(t.id);if(c&&c.status!=="rejected"&&c.dir!==e)return i(t.id,`\u91CD\u590D\u7684\u63D2\u4EF6 id\uFF08\u5DF2\u7531 ${c.dir} \u6CE8\u518C\uFF09`,t.name,t.version);const u=(t.requires?.events??[]).filter(r=>!W.includes(r));if(u.length>0)return i(t.id,`requires.events \u542B\u672A\u77E5\u4E8B\u4EF6: ${u.join(", ")}`,t.name,t.version);const g=[];for(const r of t.rules)try{const a=JSON.parse(await S(this.resolveWithin(e,r),"utf8"));if(!Array.isArray(a))throw new Error(`${r} \u4E0D\u662F\u6570\u7EC4`);g.push(...a)}catch(a){return i(t.id,`\u89C4\u5219\u6587\u4EF6 ${r}: ${a instanceof Error?a.message:String(a)}`,t.name,t.version)}const E=new Map;for(const r of t.handlers)try{const a=this.resolveWithin(e,r.entry),h=(await import(`${P(a).href}?t=${Date.now()}`)).default;if(!h||typeof h.execute!="function")throw new Error(`${r.entry} \u7684 default \u5BFC\u51FA\u7F3A\u5C11 execute \u51FD\u6570`);if(h.type!==r.type)throw new Error(`${r.entry} \u5BFC\u51FA type="${h.type}" \u4E0E manifest \u58F0\u660E "${r.type}" \u4E0D\u7B26`);E.set(`${t.id}:${r.type}`,h)}catch(a){return i(t.id,`handler ${r.type} \u52A0\u8F7D\u5931\u8D25: ${a instanceof Error?a.message:String(a)}`,t.name,t.version)}let R;if(t.subscribe){const r=t.subscribe.events.filter(a=>!W.includes(a));if(r.length>0)return i(t.id,`subscribe.events \u542B\u672A\u77E5\u4E8B\u4EF6: ${r.join(", ")}`,t.name,t.version);try{const a=this.resolveWithin(e,t.subscribe.entry),h=(await import(`${P(a).href}?t=${Date.now()}`)).default;if(!h||typeof h.onEvent!="function")throw new Error(`${t.subscribe.entry} \u7684 default \u5BFC\u51FA\u7F3A\u5C11 onEvent \u51FD\u6570`);R={events:new Set(t.subscribe.events),sub:h}}catch(a){return i(t.id,`subscriber \u52A0\u8F7D\u5931\u8D25: ${a instanceof Error?a.message:String(a)}`,t.name,t.version)}}const k=[];for(let r=0;r<g.length;r++){const a=g[r],v=typeof a=="object"&&a!==null&&"handler"in a?{...a,handler:z(a.handler,t.id)}:a,h=x.safeParse(v);if(!h.success)return i(t.id,`\u89C4\u5219 #${r} \u6821\u9A8C\u5931\u8D25: ${h.error.issues[0]?.message??""}`,t.name,t.version);const w=h.data;let p=w.handler;if(p.type==="plugin"&&!E.has(`${t.id}:${p.handlerType}`))return i(t.id,`\u89C4\u5219 #${r} \u5F15\u7528\u672A\u58F0\u660E\u7684 handler "${p.handlerType}"`,t.name,t.version);if((p.type==="inject"||p.type==="manual")&&p.template.startsWith(j)){const y=p.template.slice(j.length);try{const b=await S(this.resolveWithin(e,y),"utf8");p={...p,template:b}}catch(b){return i(t.id,`\u89C4\u5219 #${r} \u6A21\u677F ${y}: ${b instanceof Error?b.message:String(b)}`,t.name,t.version)}}let $;try{$=O.parse({...w,handler:p,id:`plugin:${t.id}:${r}`,projectId:o,enabled:w.enabled??!0,priority:w.priority??0,origin:s==="builtin"?"builtin":"plugin",pluginId:t.id}),U($.source,$.handler)}catch(y){return i(t.id,`\u89C4\u5219 #${r}: ${y instanceof Error?y.message:String(y)}`,t.name,t.version)}k.push($)}const m=this.deps.states.get(t.id);try{for(const r of k)this.deps.rules.upsertPluginRule(r)}catch(r){return this.deps.rules.removeByPlugin(t.id),i(t.id,`\u89C4\u5219\u5165\u5E93\u5931\u8D25: ${r instanceof Error?r.message:String(r)}`,t.name,t.version)}if(m&&!m.enabled)for(const r of this.deps.rules.listByPlugin(t.id))this.deps.rules.setEnabled(r.id,!1);for(const[r,a]of E)this.handlers.set(r,a);return this.configs.set(t.id,{...t.config??{},...m?.config??{}}),R&&!(m&&!m.enabled)&&this.subscribers.set(t.id,R),{id:t.id,name:t.name,version:t.version,dir:e,scope:s,projectId:o,status:m&&!m.enabled?"disabled":"active",ruleCount:k.length}}resolveWithin(e,s){const o=d.resolve(e),n=d.resolve(o,s);if(n!==o&&!n.startsWith(o+d.sep))throw new Error(`\u8DEF\u5F84\u8D8A\u51FA\u63D2\u4EF6\u76EE\u5F55: ${s}`);return n}}function z(l,e){if(typeof l!="object"||l===null)return l;const s=l;return s.type!=="plugin"||s.pluginId!==void 0?l:{...s,pluginId:e}}export async function registerPluginRoots(l,e,s){const o=[],n=B();if(e.libraries)for(const t of C(e.libraries))n.push({root:t,provenance:"market"});const i=new Set;for(const t of n){const c=d.resolve(t.root);i.has(c)||(i.add(c),o.push(...await l.loadToolkitRoot(t.root,t.provenance==="builtin"?"builtin":"user",null)))}o.push(...await l.loadRoot(M(L()),"builtin",null)),o.push(...await l.loadRoot(N(),"user",null));for(const t of s)o.push(...await l.loadRoot(d.join(t.path,".weave","plugins"),"project",t.id));return o}export async function loadAllPlugins(l,e){const s=new WeavePluginLoader(l),o=await registerPluginRoots(s,l,e);return{loader:s,loaded:o}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function pluginsStateOf(
|
|
1
|
+
export function pluginsStateOf(s){const e={syncedAt:null,enabled:{}};if(s==null)return e;try{const t=JSON.parse(s);if(!t||typeof t!="object"||Array.isArray(t))return e;const n=t.plugins;if(!n||typeof n!="object"||Array.isArray(n))return e;const r=n,a=r.enabled,c={};if(a&&typeof a=="object"&&!Array.isArray(a))for(const[l,o]of Object.entries(a))typeof o=="boolean"&&(c[l]=o);return{syncedAt:typeof r.syncedAt=="string"?r.syncedAt:null,enabled:c}}catch{return e}}export function effective(s,e,t){const n=pluginsStateOf(s.meta);return Object.hasOwn(n.enabled,e)?n.enabled[e]:n.syncedAt!==null?!1:t.states.get(e)?.enabled??t.defaultEnabled??!0}export function setProjectEnabled(s,e,t,n){const r=pluginsStateOf(s.meta);n.projects.setMeta(s.id,{plugins:{syncedAt:r.syncedAt,enabled:{...r.enabled,[e]:t}}})}export function syncPlugins(s,e,t){const r={...pluginsStateOf(s.meta).enabled};for(const c of e)Object.hasOwn(r,c)||(r[c]=!1);const a=t.now??new Date().toISOString();return t.projects.setMeta(s.id,{plugins:{syncedAt:a,enabled:r}}),a}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PROMPT_FLUSH_INTERVAL_MS=15e3;export function startPromptFlusher(
|
|
1
|
+
export const PROMPT_FLUSH_INTERVAL_MS=15e3;export function startPromptFlusher(r){const t=setInterval(()=>{r.flushAll()},15e3);return t.unref?.(),()=>clearInterval(t)}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{mkdirSync as g,readFileSync as u,readdirSync as
|
|
2
|
-
`))if(
|
|
3
|
-
`).filter(
|
|
1
|
+
import{mkdirSync as g,readFileSync as u,readdirSync as h,renameSync as l,writeFileSync as m}from"node:fs";import{join as f}from"node:path";import{hookShardId as y}from"./mirror.js";export const PROMPTBOX_MAX_LINES=200;export function promptboxPathOf(n,e){return f(n,"promptbox",`${e}.jsonl`)}function d(n){const e=[];for(const o of n.split(`
|
|
2
|
+
`))if(o.trim())try{const t=JSON.parse(o);if(typeof t.id=="string"&&typeof t.sessionId=="string"&&typeof t.text=="string"){const r=t.images,c=(Array.isArray(t.attachments)?t.attachments:Array.isArray(r)?r:[]).filter(i=>{const s=i;return typeof s?.id=="string"&&typeof s?.name=="string"&&typeof s?.mediaType=="string"&&typeof s?.path=="string"});e.push({id:t.id,sessionId:t.sessionId,text:t.text,oneWay:t.oneWay===!0,...t.forceTerminal===!0?{forceTerminal:!0}:{},...c.length>0?{attachments:c}:{},at:typeof t.at=="string"?t.at:""})}}catch{}return e}export function appendPromptbox(n,e,o){if(o.length!==0)try{const t=promptboxPathOf(n,y(e));g(f(n,"promptbox"),{recursive:!0});let r=[];try{r=u(t,"utf8").split(`
|
|
3
|
+
`).filter(s=>s.trim())}catch{r=[]}const p=new Date().toISOString();for(const s of o)r.push(JSON.stringify({...s,at:p}));const c=r.slice(-PROMPTBOX_MAX_LINES),i=`${t}.tmp`;m(i,c.length?c.join(`
|
|
4
4
|
`)+`
|
|
5
|
-
`:""),
|
|
6
|
-
`).filter(
|
|
5
|
+
`:""),l(i,t)}catch{}}export function readPromptbox(n,e){try{return d(u(promptboxPathOf(n,y(e)),"utf8"))}catch{return[]}}export function removePromptboxEntries(n,e,o){if(o.size!==0)try{const t=promptboxPathOf(n,y(e));let r;try{r=u(t,"utf8").split(`
|
|
6
|
+
`).filter(i=>i.trim())}catch{return}const p=r.filter(i=>{try{return!o.has(JSON.parse(i).id??"")}catch{return!1}}),c=`${t}.tmp`;m(c,p.length?p.join(`
|
|
7
7
|
`)+`
|
|
8
|
-
`:""),
|
|
9
|
-
`).filter(
|
|
8
|
+
`:""),l(c,t)}catch{}}export function readAllPromptbox(n){const e=f(n,"promptbox");let o;try{o=h(e)}catch{return[]}const t=[];for(const r of o)if(r.endsWith(".jsonl"))try{t.push(...d(u(f(e,r),"utf8")))}catch{continue}return t}export function scanQueuedSessionIds(n){return new Set(readAllPromptbox(n).map(e=>e.sessionId))}export function removePromptboxBySession(n,e){const o=f(n,"promptbox");let t;try{t=h(o)}catch{return 0}let r=0;for(const p of t){if(!p.endsWith(".jsonl"))continue;const c=f(o,p);let i;try{i=u(c,"utf8").split(`
|
|
9
|
+
`).filter(a=>a.trim())}catch{continue}const s=i.filter(a=>{try{return JSON.parse(a).sessionId!==e}catch{return!1}});if(s.length!==i.length){r+=i.length-s.length;try{const a=`${c}.tmp`;m(a,s.length?s.join(`
|
|
10
10
|
`)+`
|
|
11
|
-
`:""),
|
|
11
|
+
`:""),l(a,c)}catch{}}}return r}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{chmodSync as
|
|
2
|
-
`,{encoding:"utf8",mode:384}),d(
|
|
1
|
+
import{chmodSync as a,existsSync as u,mkdirSync as p,readFileSync as c,renameSync as d,writeFileSync as l}from"node:fs";import y from"node:path";import n from"web-push";import{getPushKeysPath as h}from"../db/paths.js";import{watchReasonPhrase as f}from"./watch-engine.js";export class PushNotifier{deps;vapid;constructor(t){this.deps=t,this.vapid=w(t.keysPath??h()),t.bus.subscribe(e=>this.onBus(e))}publicKey(){return this.vapid.publicKey}onBus(t){const e=this.payloadFor(t);if(!e)return;const i=this.deps.subscriptions.list();i.length!==0&&this.pushAll(i,JSON.stringify(e))}payloadFor(t){return t.kind==="watch.fired"?t.watcherSessionId!==null?null:{title:"weave",body:`Session ${this.labelOf(t.targetSessionId)} ${f(t.reason)}`,tag:`weave-watch-${t.targetSessionId}`,url:"/"}:t.kind==="question.pending"?{title:"weave",body:`Session ${this.labelOf(t.sessionId)} is waiting for your answer`,tag:`weave-question-${t.sessionId}`,url:"/"}:null}labelOf(t){return this.deps.sessions.getBySessionId(t)?.title??t.slice(0,8)}async pushAll(t,e){for(const i of t)try{await(this.deps.send??b)(i,e,this.vapid)}catch(o){const r=o.statusCode;(r===404||r===410)&&this.deps.subscriptions.deleteByEndpoint(i.endpoint)}}}async function b(s,t,e){n.setVapidDetails("mailto:weave@localhost",e.publicKey,e.privateKey),await n.sendNotification({endpoint:s.endpoint,keys:{p256dh:s.p256dh,auth:s.auth}},t,{TTL:3600})}function w(s){if(u(s))try{const i=JSON.parse(c(s,"utf8"));if(typeof i.publicKey=="string"&&i.publicKey&&typeof i.privateKey=="string"&&i.privateKey)return{publicKey:i.publicKey,privateKey:i.privateKey}}catch{}const t=n.generateVAPIDKeys();p(y.dirname(s),{recursive:!0});const e=`${s}.tmp`;l(e,`${JSON.stringify(t,null,2)}
|
|
2
|
+
`,{encoding:"utf8",mode:384}),d(e,s);try{a(s,384)}catch{}return t}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isHarness as
|
|
1
|
+
import{isHarness as f}from"@weavecode/core";import{permissionModeOf as c}from"@weavecode/harness";import{blockingPromptFor as h}from"../surfaces.js";const g=12;export class QuestionTracker{deps;pending=new Map;lastPreTool=new Map;permissionMode=new Map;seeding=!1;constructor(e){this.deps=e}specOf(e){return f(e)?this.deps.surfaceFor?.(e)??h(e):null}onEvent(e){const t=e.payload;if(!t)return;const n=this.specOf(e.source);if(!n)return;const s=e.sessionId,i=typeof t.toolName=="string"?t.toolName:null,d=c(t.raw);if(d&&this.permissionMode.set(s,d),t.eventType==="PreToolUse"){if(i&&this.lastPreTool.set(s,{toolName:i,toolInput:t.toolInput}),i&&n.blockingTools.includes(i)){const l=this.pending.get(s),r={sessionId:s,harness:this.harnessOf(e.source),kind:"question",questions:n.parseQuestions(i,t.toolInput),at:new Date().toISOString()};this.pending.set(s,r),!this.seeding&&l?.kind!=="question"&&this.deps.onPending?.(r)}return}if(t.eventType==="Notification"){if(n.permissionNotificationType&&y(t.raw)===n.permissionNotificationType){const l=this.permissionMode.get(s);if(l!=null&&n.silentPermissionModes.includes(l))return;const r=this.lastPreTool.get(s);if(this.pending.get(s)?.kind==="question"&&r!=null&&n.blockingTools.includes(r.toolName))return;const a=this.lastPreTool.get(s)??{toolName:null,toolInput:null};this.pending.set(s,{sessionId:s,harness:this.harnessOf(e.source),kind:"permission",questions:[n.permissionQuestion({...a,message:m(t.raw),permissionMode:l??null})],at:new Date().toISOString()})}return}const p=n.eventQuestion(t.eventType,{raw:t.raw,toolName:i,toolInput:t.toolInput});if(p){const l=this.pending.get(s),r={sessionId:s,harness:this.harnessOf(e.source),kind:"switch",questions:[p],at:new Date().toISOString()};this.pending.set(s,r),!this.seeding&&l?.kind!=="switch"&&this.deps.onPending?.(r);return}const u=this.pending.get(s);if(!u)return;if(u.kind!=="question"){this.pending.delete(s),this.lastPreTool.delete(s);return}(t.eventType==="PostToolUse"&&i!=null&&n.blockingTools.includes(i)||t.eventType==="UserPromptSubmit"||t.eventType==="Stop")&&(this.pending.delete(s),this.lastPreTool.delete(s))}seedFromDb(){this.seeding=!0;try{for(const e of this.deps.sessions.list())for(const t of this.deps.hookEvents.listBySession(e.sessionId,g)){let n=null;try{n=JSON.parse(t.payload)}catch{n=null}this.onEvent({sessionId:e.sessionId,source:t.source,payload:n})}}finally{this.seeding=!1}}snapshot(){return[...this.pending.values()].filter(e=>!this.dropIfInterrupted(e)).sort((e,t)=>e.at<t.at?1:-1)}get(e){const t=this.pending.get(e);return t?this.dropIfInterrupted(t)?null:t:null}dropIfInterrupted(e){return this.deps.interruptedAt?.(e.sessionId)==null?!1:(this.pending.delete(e.sessionId),!0)}markAnswered(e){this.pending.delete(e)}forgetSession(e){this.pending.delete(e),this.lastPreTool.delete(e),this.permissionMode.delete(e)}harnessOf(e){return e}}function m(o){if(!o||typeof o!="object")return null;const e=o.message;return typeof e=="string"&&e.trim()?e:null}function y(o){if(!o||typeof o!="object")return null;const e=o.notification_type;return typeof e=="string"&&e?e:null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{INJECTABLE_EVENTS as
|
|
1
|
+
import{INJECTABLE_EVENTS as l,hookSourceHarness as u,normalizeHookRuleSource as s}from"@weavecode/core";export class HookRuleRegistry{repo;byEvent=new Map;all=[];onChange;constructor(e){this.repo=e,this.load()}load(){this.all=this.repo.list().map(e=>({...e,source:s(e.source)})),this.byEvent=new Map;for(const e of this.all){if(e.source.kind!=="hook-event")continue;const t=this.byEvent.get(e.source.event);t?t.push(e):this.byEvent.set(e.source.event,[e])}this.onChange?.()}list(e){return(e===void 0?this.all:this.repo.list(e)).map(n=>({...n,source:s(n.source)}))}get(e){return this.all.find(t=>t.id===e)}candidates(e,t){const n=this.byEvent.get(e)??[];return t?.includeDisabled?[...n]:n.filter(o=>o.enabled)}create(e){const t=s(e.source);validateHandler(t,e.handler);const n=this.repo.create({...e,source:t});return this.load(),n}update(e,t){const n=this.get(e);if(!n)return;const o=t.source?s(t.source):n.source;validateHandler(o,t.handler??n.handler);const i=this.repo.update(e,t.source?{...t,source:o}:t);return i&&this.load(),i}setEnabled(e,t){const n=this.repo.setEnabled(e,t);return n&&this.load(),n}remove(e){const t=this.repo.remove(e);return t&&this.load(),t}}export function validateHandler(r,e){const t=u(r);if(e.type==="inject"){if(t===null||t==="any")throw new Error('inject handler requires source.kind = "hook-event" with a concrete harness (legacy "claude-event" accepted; "any" rejected)');const n=l[t],o=r.kind==="claude-event"||r.kind==="hook-event"?r.event:"";if(!n.includes(o))throw new Error(`inject handler is not supported on event "${o}" (allowed: ${n.join(", ")})`);return}if(e.type==="plugin"&&t===null)throw new Error('plugin handler requires source.kind = "hook-event"')}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CLAUDE_RESUME as
|
|
1
|
+
import{CLAUDE_RESUME as o}from"@weavecode/harness";import{HeadlessRunner as l}from"./headless-runner.js";export class ResumeRunner{deps;headless;claudeBin;resumeSpec;timeoutMs;constructor(t){this.deps=t,this.headless=t.headless??new l({spawnImpl:t.spawnImpl,killImpl:t.killImpl}),this.resumeSpec=t.resumeSpec??o,this.claudeBin=t.claudeBin??process.env.WEAVE_CLAUDE_BIN??this.resumeSpec.bin,this.timeoutMs=t.timeoutMs}async run(t,e){const s=this.deps.dispatches.getById(t);if(!s)return{ok:!1,status:404,error:"Dispatch not found"};if(s.status!=="pending"&&s.status!=="injected")return{ok:!1,status:409,error:`Dispatch is ${s.status}`};const r=this.deps.sessions.getBySessionId(e);if(!r)return{ok:!1,status:404,error:"Session not found"};if(r.projectId==null)return{ok:!1,status:400,error:"Session has no project"};const a=this.deps.projects.getById(r.projectId);if(!a)return{ok:!1,status:400,error:"Project not found for session"};if(this.headless.isBusy(e))return{ok:!1,status:409,error:"Session already has a running dispatch"};const u={settled:!1};try{this.deps.dispatches.updateStatus(t,{status:"running"}),this.deps.bus?.emit({kind:"dispatch.started",ruleId:s.ruleId,dispatchId:t,sessionId:e,at:new Date().toISOString()}),this.headless.run({sessionId:e,cwd:a.path,prompt:s.prompt,spec:this.resumeSpec,bin:this.claudeBin,timeoutMs:this.timeoutMs,onSettle:n=>this.settle(s,e,u,n)})||this.settle(s,e,u,{status:"failed",output:null,error:"Session already has a running dispatch"})}catch(i){this.settle(s,e,u,{status:"failed",output:null,error:i instanceof Error?i.message:String(i)})}return{ok:!0,dispatchId:t}}settle(t,e,s,r){if(!s.settled){s.settled=!0;try{this.deps.dispatches.updateStatus(t.id,{status:r.status,output:r.output,error:r.error,finished:!0}),this.deps.bus?.emit({kind:"dispatch.finished",ruleId:t.ruleId,dispatchId:t.id,status:r.status,sessionId:e,at:new Date().toISOString()})}catch{}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function purgeSession(e,
|
|
1
|
+
export function purgeSession(e,t){const n=e.events.deleteBySession(t);e.uploads?.pruneUnreferenced();const o=e.dispatches?.deleteBySession(t)??0,r=e.deliverer?.forgetSession(t)??0;return e.watches?.deleteBySession(t),e.orchestrations?.deleteMentioningSession(t),e.questions?.forgetSession(t),e.sideQuestions?.deleteBySession(t),e.probe?.forget(t),e.sessions.remove(t),{events:n,dispatches:o,messages:r}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{purgeSession as r}from"./session-purge.js";import{
|
|
1
|
+
import{purgeSession as r}from"./session-purge.js";import{shellDiscardedByClaude as p}from"../daemon/claude-liveness.js";import{combinedLivenessOf as d}from"../daemon/liveness.js";export const SWEEP_INTERVAL_MS=5*6e4;export class SessionSweeper{deps;now;constructor(e,t=Date.now){this.deps=e,this.now=t}sweep(){const e=this.now(),t=this.deps.livenessOf?.();let i=0;for(const s of this.deps.sessions.listWithCounts()){if(t&&p(s,t,e)){r(this.deps,s.sessionId),i++;continue}const o=s.autoDeleteAt==null?null:Date.parse(s.autoDeleteAt);o==null||e<o||(r(this.deps,s.sessionId),i++)}return this.deps.uploads?.pruneUnreferenced(),this.deps.uploadSessions?.sweep(),this.deps.watchEngine?.sweepTerminated(),this.deps.orchestrationEngine?.sweepTerminated(),i}start(){this.sweep();const e=setInterval(()=>this.sweep(),SWEEP_INTERVAL_MS);return e.unref(),e}}export function startSessionSweeper(n){return new SessionSweeper({...n,livenessOf:n.livenessOf??d}).start()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isHarness as
|
|
1
|
+
import{isHarness as I}from"@weavecode/core";import{messagingSurfaceFor as g}from"../surfaces.js";export const SIDE_ANSWER_WINDOW_MS=10*6e4,SIDE_SETTLE_WINDOW_MS=3e4;const l=/\p{Script=Han}/u;function d(t){const e=t.toLowerCase().replace(/\s+/g,""),n=new Set;for(let s=0;s<e.length-1;s++)n.add(e.slice(s,s+2));return n}function D(t,e){const n=d(t),s=d(e);if(n.size===0||s.size===0)return 0;let r=0;for(const o of n)s.has(o)&&r++;return 2*r/(n.size+s.size)}export function answerScore(t,e){let n=0;return l.test(t)===l.test(e)&&(n+=2),e.length>=120&&(n+=1),D(t,e)>=.15&&(n+=1),n}const w=new Map;function S(t,e,n){const s=w.get(e.id);s&&clearTimeout(s),setTimeout(()=>{w.delete(e.id);const o=t.repo.getById(e.id);o?.status==="answered"&&o.answerEventId===e.answerEventId&&t.settle?.(o)},Math.max(0,n+SIDE_SETTLE_WINDOW_MS-(t.now?.()??Date.now()))).unref?.()}export function claimSideAnswer(t,e){if(!I(e.source))return null;const s=(t.surfaceFor?.(e.source)??g(e.source)).sideQuestion?.answerOf(e.eventType,e.payload);if(!s)return null;const r=t.now?.()??Date.now(),o=new Date(r-SIDE_ANSWER_WINDOW_MS).toISOString(),a=t.repo.claim(e.sessionId,s,e.eventId,o);if(a)return m(t,a),S(t,a,r),a;const u=new Date(r-SIDE_SETTLE_WINDOW_MS).toISOString(),i=t.repo.list(e.sessionId,{limit:5}).find(f=>f.status==="answered"&&(f.answeredAt??"")>=u);if(!i||i.answer==null||answerScore(i.question,s)<=answerScore(i.question,i.answer))return null;const c=t.repo.supersede(i.id,s,e.eventId,u);return c?(m(t,c),S(t,c,r),c):null}function m(t,e){t.bus?.emit({kind:"sideQuestion.answered",sessionId:e.sessionId,sideQuestionId:e.id,at:e.answeredAt??new Date().toISOString()})}export function readSideQuestions(t,e,n){return t.repo.expirePending(new Date((t.now?.()??Date.now())-SIDE_ANSWER_WINDOW_MS).toISOString()),t.repo.list(e,n)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID as
|
|
1
|
+
import{randomUUID as o}from"node:crypto";const r=30*6e4,t=new Map;export function registerSyntheticSession(e=`sx-${o()}`){return t.set(e,Date.now()+r),e}export function isSyntheticSession(e){if(!e)return!1;const n=t.get(e);return n===void 0?!1:n<Date.now()?(t.delete(e),!1):!0}export function syntheticSessionIds(){return[...t.keys()]}export function replaceSyntheticSessions(e){t.clear();for(const n of e)t.set(n,Date.now()+r)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as
|
|
1
|
+
import{readFile as x,readdir as h,stat as w}from"node:fs/promises";import e from"node:path";import{WEAVE_PLUGIN_MANIFEST as y,WeavePluginManifestSchema as L,HARNESS_KEYS as I}from"@weavecode/core";import{builtinPacksDir as W}from"../market/builtin.js";import{getDataRoot as J}from"../db/paths.js";import{hasNonEmptyModules as E}from"../watch/plugin-mods.js";const S=".claude-plugin",v="plugin.json",K="weave.json",_=2,O=10,D=["claude"];export function builtinToolkitRoot(){return e.resolve(W(J()))}async function d(t){try{return(await w(t)).isDirectory()}catch{return!1}}async function p(t){try{const n=JSON.parse(await x(t,"utf8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}export async function isToolkitPackDir(t){return await N(t)?!0:await d(e.join(t,"skills"))||await d(e.join(t,"commands"))||await d(e.join(t,"agents"))}async function N(t){if(await p(e.join(t,S,v)))return!0;try{return await w(e.join(t,y)),!0}catch{}return E(await p(e.join(t,"hooks","hooks.json")))}async function V(t){try{return(await h(t,{withFileTypes:!0})).filter(o=>o.isDirectory()).map(o=>o.name).sort()}catch{return[]}}async function P(t){try{return(await h(t,{withFileTypes:!0})).filter(o=>o.isFile()&&o.name.endsWith(".md")).map(o=>o.name.replace(/\.md$/,"")).sort()}catch{return[]}}function G(t){if(!Array.isArray(t)||t.length===0)return D;const n=t.filter(o=>I.includes(o));return n.length>0?n:D}export async function parseToolkitPack(t,n,o){const i=e.basename(t),a=await p(e.join(t,S,v)),s=await p(e.join(t,y)),r=await p(e.join(t,K)),m=await V(e.join(t,"skills")),g=await P(e.join(t,"commands")),c=await P(e.join(t,"agents")),f=await p(e.join(t,"hooks","hooks.json")),j=E(f),T=!!f&&typeof f.hooks=="object"&&f.hooks!==null,u=[];if(m.length>0&&u.push("skill"),g.length>0&&u.push("command"),c.length>0&&u.push("agent"),j?u.push("mod"):T&&u.push("hook"),s&&u.push("rule"),u.length===0)return null;const k=typeof r?.kind=="string"?r.kind:null,F=k&&["skill","hook","mod","rule","surface"].includes(k)?k:j?"mod":T?"hook":s&&!a?"rule":m.length>0?"skill":"surface",l=s?L.safeParse(s):null,C=l?.success?l.data.id:i,R=(typeof a?.name=="string"?a.name:void 0)??(l?.success?l.data.name:void 0)??i,b=(l?.success?l.data.version:void 0)??(typeof a?.version=="string"?a.version:void 0)??"0.0.0",A=(typeof a?.description=="string"?a.description:void 0)??(l?.success?l.data.description:void 0);return{id:C,name:R,version:b,...A?{description:A}:{},scope:o,dir:t,provenance:n.provenance,sourceRoot:n.root,targets:G(r?.targets),kind:F,components:u,ccPack:!!a,weavePack:!!s,skills:m}}function M(t){return t==="node_modules"||t.startsWith(".")}export async function discoverToolkitPacks(t){const n=t.provenance==="market",o=n?O:_,i=async(a,s,r)=>{if(await isToolkitPackDir(a)&&!(s===0&&n&&!await N(a))){const f=await parseToolkitPack(a,t,r);return f?[f]:[]}if(s>=o)return[];let m;try{m=await h(a,{withFileTypes:!0})}catch{return[]}return(await Promise.all(m.filter(c=>c.isDirectory()&&!M(c.name)).map(c=>i(e.join(a,c.name),s+1,s===0?c.name:r)))).flat()};return i(t.root,0,"")}export function discoverToolkitSources(){return[{root:builtinToolkitRoot(),provenance:"builtin"}]}export async function discoverWeavePackDirs(t){const n=[],o=async(i,a)=>{try{await w(e.join(i,y)),n.push(i);return}catch{}if(a>=_)return;let s;try{s=await h(i,{withFileTypes:!0})}catch{return}for(const r of s)!r.isDirectory()||M(r.name)||await o(e.join(i,r.name),a+1)};return await o(t,0),n}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{cp as
|
|
2
|
-
`,"utf8")):
|
|
3
|
-
`)!==
|
|
4
|
-
`)&&this.deps.projects.setMeta(t.id,{toolkit:{enabled:
|
|
5
|
-
`,"utf8"),
|
|
1
|
+
import{cp as I,mkdir as P,readFile as T,readdir as h,rm as w,writeFile as F}from"node:fs/promises";import{spawn as S}from"node:child_process";import{homedir as H}from"node:os";import c from"node:path";import{hashFile as y}from"../install/fingerprint.js";import{fileAssetTargetDir as L}from"../install/file-assets.js";import{assetSurfaceFor as N,pluginSurfaceFor as $}from"../surfaces.js";import{marketLibraryRoots as q}from"../market/resolve.js";import{marketIdOf as m}from"../market/identity.js";import{installPluginPack as A}from"../install/plugin-install.js";import{effective as V,setProjectEnabled as O}from"./plugin-project-state.js";import{builtinToolkitRoot as K,discoverToolkitPacks as B}from"./toolkit-scan.js";export class ToolkitError extends Error{code;constructor(t,e){super(t),this.code=e,this.name="ToolkitError"}}export const MIN_MOD_HOST_VERSION=[2,1,287];const W=1e4;export function isVersionAtLeast(a,t){const e=a.split(".").map(s=>Number.parseInt(s,10));for(let s=0;s<t.length;s++){const n=Number.isFinite(e[s])?e[s]:0;if(n>t[s])return!0;if(n<t[s])return!1}return!0}let b;function J(a){if(!(a.exitCode!==null||a.signalCode!==null)){if(process.platform==="win32"&&a.pid!==void 0){S("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref();return}a.kill("SIGKILL")}}export async function detectClaudeVersion(){if(b&&Date.now()-b.at<6e5)return b.value;const a=await new Promise(t=>{let e="";const s=process.platform==="win32"?S("claude --version",{windowsHide:!0,shell:!0,stdio:["ignore","pipe","pipe"]}):S("claude",["--version"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),n=setTimeout(()=>{J(s),t(null)},5e3);s.stdout?.on("data",i=>e+=i.toString()),s.on("error",()=>{clearTimeout(n),t(null)}),s.on("close",()=>{clearTimeout(n);const i=/(\d+\.\d+\.\d+)/.exec(e);t(i?i[1]:null)})});return a!==null&&(b={value:a,at:Date.now()}),a}async function C(a,t,e){let s;try{s=await h(c.join(a,...t.split("/").filter(Boolean)),{withFileTypes:!0})}catch{return}for(const n of s){if(n.name==="node_modules"||n.name===".git")continue;const i=t?`${t}/${n.name}`:n.name;n.isDirectory()?await C(a,i,e):e.push({rel:i,abs:c.join(a,...i.split("/"))})}}const p=a=>a.ccPack||a.kind==="mod";async function R(a,t){const e=[];if(t.skills.length>0)for(const s of t.targets){if(s==="claude"&&p(t))continue;const n=N(s).projectSkillsRoots()[0];for(const i of t.skills){const o=[];await C(c.join(t.dir,"skills",i),"",o);for(const r of o)e.push({src:r.abs,rel:`${n}/${i}/${r.rel}`})}}if(!p(t))for(const s of t.targets)for(const[n,i]of[["commands","command"],["agents","agent"]]){const o=c.join(t.dir,n),r=[];if(await C(o,"",r),r.length===0)continue;const l=G(i,s,a);if(l)for(const u of r){const g=u.rel.split("/").pop();e.push({src:u.abs,rel:v(c.relative(a,c.join(l,g)))})}}return e}function G(a,t,e){try{return L(a,t,"project",e,H())}catch{return null}}function v(a){return a.split(c.sep).join("/")}function x(a,t){return c.join(a,".weave","toolkit",`${t}.json`)}async function k(a){try{const t=JSON.parse(await T(a,"utf8"));return t&&typeof t=="object"&&typeof t.packId=="string"?t:null}catch{return null}}export async function projectFileNamespaces(a){const t=new Map,e=c.join(a,".weave","toolkit");let s;try{s=await h(e)}catch{return t}for(const n of s){if(!n.endsWith(".json"))continue;const i=await k(c.join(e,n)),o=i?m(i.sourceDir):void 0;if(!(!i||!o))for(const r of Object.keys(i.files))t.set(r,o)}return t}export async function projectPackFiles(a){const t=new Map,e=c.join(a,".weave","toolkit");let s;try{s=await h(e)}catch{return t}for(const n of s){if(!n.endsWith(".json"))continue;const i=await k(c.join(e,n));if(i)for(const[o,r]of Object.entries(i.files))typeof r=="string"&&t.set(o,r)}return t}async function M(a){try{return await T(a),!0}catch{return!1}}async function _(a,t){const e=new Set;for(const n of t){let i=c.posix.dirname(n);for(;i&&i!=="."&&i!=="/";)e.add(i),i=c.posix.dirname(i)}const s=[...e].sort((n,i)=>i.split("/").length-n.split("/").length);for(const n of s){const i=c.join(a,...n.split("/"));try{(await h(i)).length===0&&await w(i,{recursive:!0,force:!0})}catch{}}}export function evaluateModHostGate(a){return process.env.WEAVE_SKIP_MOD_VERSION_CHECK==="1"?{ok:!0}:a?isVersionAtLeast(a,MIN_MOD_HOST_VERSION)?{ok:!0}:{ok:!1,message:`\u5BBF\u4E3B Claude Code ${a} \u4F4E\u4E8E 2.1.287\uFF0Cmod \u5DE5\u5177\u5305\u4E0D\u843D\u76D8\uFF08\u8BF7\u5148\u5347\u7EA7 Claude Code\uFF09`}:{ok:!0,warning:"\u65E0\u6CD5\u68C0\u6D4B\u5BBF\u4E3B Claude Code \u7248\u672C\uFF0Cmod \u5DE5\u5177\u5305\u9700\u8981 \u2265 2.1.287 \u624D\u80FD\u88AB\u52A0\u8F7D"}}export class ToolkitService{deps;packsCache;constructor(t){this.deps=t}sources(){const e=[{root:this.deps.builtinRoot??K(),provenance:"builtin"}];if(this.deps.libraries)for(const n of q(this.deps.libraries))e.push({root:n,provenance:"market"});const s=new Set;return e.filter(n=>{const i=c.resolve(n.root);return s.has(i)?!1:(s.add(i),!0)})}async allPacks(){const t=this.sources(),e=t.map(r=>c.resolve(r.root)).join("|"),s=Date.now(),n=this.packsCache;if(n&&n.key===e&&s-n.at<W)return n.packs;const i=Promise.all(t.map(r=>B(r))).then(r=>r.flat()),o={at:s,key:e,packs:i};return this.packsCache=o,i.catch(()=>{this.packsCache===o&&(this.packsCache=void 0)}),i}async list(t){const e=this.requireProject(t),s=await this.allPacks(),n=await Promise.all(s.map(i=>this.packInfo(e,i)));return await this.healMeta(e,n),{packs:n,legacyCopies:await this.scanLegacyCopies(e)}}async enable(t,e,s){const n=this.requireProject(t),i=await this.resolvePack(e,s),o=[];if(i.kind==="mod"&&i.targets.includes("claude")){const d=this.deps.claudeVersion??detectClaudeVersion,f=evaluateModHostGate(await d());if(!f.ok)throw new ToolkitError(f.message??"mod host gate","host-version");f.warning&&o.push(f.warning)}const r=n.path;if(p(i)&&i.targets.includes("claude")){const d=this.pluginSurface();await A(d,i),await d.setProjectEnabled(r,i.name,!0,m(i.dir))}const u=x(r,i.id),g=await this.readRecordHealed(r,i.id),j=g??{packId:i.id,provenance:i.provenance,sourceRoot:i.sourceRoot,sourceDir:i.dir,enabledAt:new Date().toISOString(),files:{}};let E=g===null;const D=await R(r,i);for(const d of D){const f=c.join(r,...d.rel.split("/"));if(j.files[d.rel]!==void 0){await M(f)||(await P(c.dirname(f),{recursive:!0}),await I(d.src,f));continue}await y(f)==="missing"&&(await P(c.dirname(f),{recursive:!0}),await I(d.src,f),j.files[d.rel]=await y(d.src),E=!0)}return D.length>0?E&&(await P(c.dirname(u),{recursive:!0}),await F(u,JSON.stringify(j,null,2)+`
|
|
2
|
+
`,"utf8")):g&&await w(u,{force:!0}),i.weavePack&&O(n,i.id,!0,{projects:this.deps.projects}),this.rememberEnabled(n,i.id,!0),{pack:await this.packInfo(this.requireProject(t),i),warnings:o}}async disable(t,e,s){const n=this.requireProject(t),i=await this.resolvePack(e,s);return await this.applyDisabled(n,i),{pack:await this.packInfo(this.requireProject(t),i),warnings:[]}}async applyDisabled(t,e){await this.removePackFiles(t,e,e.sourceRoot),p(e)&&e.targets.includes("claude")&&await this.pluginSurface().setProjectEnabled(t.path,e.name,!1,m(e.dir)),e.weavePack&&O(t,e.id,!1,{projects:this.deps.projects}),this.rememberEnabled(t,e.id,!1)}async uninstall(t,e,s){const n=this.requireProject(t),i=await this.resolvePack(e,s);return await this.applyDisabled(n,i),p(i)&&i.targets.includes("claude")&&await this.pluginSurface().uninstall(i.name,m(i.dir)),{pack:await this.packInfo(this.requireProject(t),i),warnings:[]}}async removePackFiles(t,e,s){const n=x(t.path,e.id),i=await k(n);if(!i||s&&c.resolve(i.sourceRoot)!==c.resolve(s))return;const o=[];for(const[r,l]of Object.entries(i.files)){const u=c.join(t.path,...r.split("/"));await y(u)===l&&(await w(u,{force:!0}),o.push(r))}await w(n,{force:!0}),await _(t.path,o)}requireProject(t){const e=this.deps.projects.getById(t);if(!e)throw new ToolkitError(`Project not found: ${t}`,"not-found");return e}async resolvePack(t,e){this.packsCache=void 0;const s=(await this.allPacks()).filter(o=>o.id===t);if(e){const o=s.find(r=>c.resolve(r.sourceRoot)===c.resolve(e));if(o)return o}const i=s.find(o=>o.provenance==="builtin")??s[0];if(!i)throw new ToolkitError(`Toolkit pack not found: ${t}`,"not-found");return i}async computeEnabled(t,e){const s=[],n=await this.readRecordHealed(t.path,e.id);if((await R(t.path,e)).length>0){let o=!!n;if(n){for(const r of Object.keys(n.files))if(!await M(c.join(t.path,...r.split("/")))){o=!1;break}}s.push(o)}if(p(e)&&e.targets.includes("claude")){const o=this.pluginSurface(),r=m(e.dir);s.push(await o.isInstalled(e.name,r)&&await o.readProjectEnabled(t.path,e.name,r))}return e.weavePack&&s.push(V(t,e.id,{states:this.deps.states,defaultEnabled:!1})),s.length>0?s.every(Boolean):!1}async installedScopes(t){const e=(await this.pluginSurface().readInstalled())[t];return!e||e.length===0?void 0:[...new Set(e.map(n=>n.scope??"user"))]}async packInfo(t,e){const s=await this.computeEnabled(t,e),n=m(e.dir),i=p(e)&&e.targets.includes("claude")?this.pluginSurface().pluginKey(e.name,n):void 0,o=i?await this.installedScopes(i):void 0,r={...e,...n?{namespace:n}:{},enabled:s,installed:await this.computeInstalled(t,e,s),...i?{key:i}:{},...o&&o.length>0?{scopes:o}:{}};if(e.weavePack){const l=this.deps.plugins.list().find(u=>u.id===e.id);l&&(r.weave={status:l.status,ruleCount:l.ruleCount,...l.error?{error:l.error}:{}})}return r}async computeInstalled(t,e,s){return e.weavePack&&!p(e)?!0:p(e)&&e.targets.includes("claude")?this.pluginSurface().isInstalled(e.name,m(e.dir)):s||!!await this.readRecordHealed(t.path,e.id)}enabledIndex(t){const s=this.deps.projects.getMeta(t.id)?.toolkit,n=s&&typeof s=="object"?s.enabled:void 0;return Array.isArray(n)?n.filter(i=>typeof i=="string"):[]}rememberEnabled(t,e,s){const n=new Set(this.enabledIndex(t));s?n.add(e):n.delete(e),this.deps.projects.setMeta(t.id,{toolkit:{enabled:[...n].sort()}})}async healMeta(t,e){const s=[...new Set(e.filter(r=>r.enabled).map(r=>r.id))].sort(),n=[...new Set(this.enabledIndex(t))].sort(),i=new Set(e.map(r=>r.id)),o=[...new Set([...n.filter(r=>!i.has(r)),...s])].sort();o.join(`
|
|
3
|
+
`)!==n.join(`
|
|
4
|
+
`)&&this.deps.projects.setMeta(t.id,{toolkit:{enabled:o}})}pluginSurface(){return this.deps.pluginSurface??$("claude")}async readRecordHealed(t,e){const s=x(t,e),n=await k(s);if(!n)return null;const i=v(c.relative(t,this.pluginSurface().projectPluginDir(t))),o=Object.keys(n.files).filter(l=>l.startsWith(`${i}/`));if(o.length===0)return n;const r=[];for(const l of o){const u=c.join(t,...l.split("/"));await y(u)===n.files[l]&&(await w(u,{force:!0}),r.push(l)),delete n.files[l]}return await _(t,r),await F(s,JSON.stringify(n,null,2)+`
|
|
5
|
+
`,"utf8"),n}async scanLegacyCopies(t){const e=this.pluginSurface().projectPluginDir(t.path);let s;try{s=await h(e,{withFileTypes:!0})}catch{return[]}return s.map(n=>v(c.relative(t.path,c.join(e,n.name)))).sort()}async cleanupLegacyCopies(t){const e=this.requireProject(t),s=this.pluginSurface().projectPluginDir(e.path);let n;try{n=await h(s,{withFileTypes:!0})}catch{return{removed:[]}}const i=[];for(const o of n){const r=c.join(s,o.name);await w(r,{recursive:!0,force:!0}),i.push(v(c.relative(e.path,r)))}try{(await h(s)).length===0&&await w(s,{recursive:!0,force:!0})}catch{}return{removed:i.sort()}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HARNESS_LIFECYCLE as
|
|
1
|
+
import{HARNESS_LIFECYCLE as o}from"@weavecode/core";import{messagingSurfaceFor as c}from"../surfaces.js";import{pidAliveOf as a}from"../daemon/claude-liveness.js";import{combinedLivenessOf as l}from"../daemon/liveness.js";const f=1e3;export class WatchEngine{deps;lastHitAt=new Map;constructor(e){this.deps=e,e.bus.subscribe(t=>this.onBus(t))}onEvent(e){try{const i=(this.deps.surfaceFor?.(e.source)??c(e.source)).idleSignals.includes(e.eventType),n=o[e.source].close.includes(e.eventType);if(!i&&!n)return;for(const d of this.deps.watches.listPendingByTarget(e.sessionId))n&&d.onEvents.includes("turnEnd")?this.fire(d,"turnEnd"):i&&d.onEvents.includes("idle")&&this.fire(d,"idle")}catch{}}onBus(e){if(e.kind==="message.finished"&&!(e.status!=="failed"&&e.status!=="timeout"))try{for(const t of this.deps.watches.listPendingByTarget(e.sessionId))t.onEvents.includes("messageFailed")&&this.fire(t,"messageFailed")}catch{}}created(e){try{if(!e.onEvents.includes("idle")&&!e.onEvents.includes("turnEnd"))return;this.deps.sessions.turnOpenOf(e.targetSessionId)===!1&&this.fire(e,e.onEvents.includes("idle")?"idle":"turnEnd")}catch{}}sweepTerminated(){try{const e=this.deps.livenessOf?.()??l(),t=new Map(this.deps.sessions.listWithCounts().map(s=>[s.sessionId,s]));let i=0;for(const s of this.deps.watches.listPending()){if(s.remaining===null||!s.onEvents.includes("idle")&&!s.onEvents.includes("turnEnd"))continue;const n=t.get(s.targetSessionId);n&&a(n,e)!==!1||this.fire(s,"idle")&&i++}return i}catch{return 0}}fire(e,t){const i=Date.now(),s=this.lastHitAt.get(e.id);if(s!==void 0&&i-s<f)return!1;const n=this.deps.watches.consumeHit(e.id);if(!n)return!1;this.lastHitAt.set(e.id,i),n.firedAt!==null&&this.lastHitAt.delete(e.id);const d=new Date(i).toISOString();return this.deps.bus.emit({kind:"watch.fired",watchId:e.id,targetSessionId:e.targetSessionId,watcherSessionId:e.watcherSessionId,reason:t,at:d}),e.watcherSessionId==null||this.deps.deliverer.send({toSessionId:e.watcherSessionId,text:e.notify??this.defaultNotify(e.targetSessionId,t),fromKind:"session",fromSessionId:e.targetSessionId,mode:"inject"}).catch(()=>{}),!0}defaultNotify(e,t){return`Session ${this.deps.sessions.getBySessionId(e)?.title??e.slice(0,8)} ${watchReasonPhrase(t)} (trigger=watch:${e})`}}export function watchReasonPhrase(r){return r==="messageFailed"?"had a failed message delivery":r==="turnEnd"?"finished its turn":"is now idle"}
|
|
@@ -33,6 +33,7 @@ export { resolveStaticDir } from './daemon/static.js';
|
|
|
33
33
|
export { startDaemon } from './daemon/start.js';
|
|
34
34
|
export { registerProject, unregisterProject } from './registry.js';
|
|
35
35
|
export type { RegisterResult, UnregisterResult } from './registry.js';
|
|
36
|
+
export { probeBinVersion } from './daemon/project-harnesses.js';
|
|
36
37
|
export { classifyAsset, normalizeRelPath } from './watch/classifier.js';
|
|
37
38
|
export { WatchCache } from './watch/cache.js';
|
|
38
39
|
export { WatchService } from './watch/watch-service.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as o}from"node:fs";import{fileURLToPath as r}from"node:url";export{openDatabase}from"./db/db.js";export{getDataDir,getDbPath,getDaemonStatePath,getAuthPath,getInitialPasswordPath}from"./db/paths.js";export{ensureDataLayout,migrateDataLayout}from"./db/layout.js";export{ProjectRepository}from"./repositories/projects.js";export{HookEventRepository}from"./repositories/hook-events.js";export{SessionRepository}from"./repositories/sessions.js";export{LibraryRepository}from"./repositories/libraries.js";export{DEFAULT_PORT,DAEMON_HOST,isPortFree,findFreePort}from"./daemon/port.js";export{readDaemonState,writeDaemonState,clearDaemonState}from"./daemon/state.js";export{generateToken}from"./daemon/auth.js";export{createWeaveServer,weaveRequestHandler,DAEMON_VERSION}from"./daemon/server.js";export{accessUrls,lanIps,ensureDaemonCert,startTlsServer,daemonCertsDir}from"./daemon/tls.js";export{readDaemonSettings,writeDaemonSettings,terminalPresetsFor,resolveLocale,DEFAULT_DAEMON_SETTINGS,SUPPORTED_LOCALES,DEFAULT_LOCALE}from"./daemon/settings.js";export{resolveTerminalLaunch,resolveExplorerLaunch,openInExplorer,openInTerminal,runInTerminal,defaultProjectOpener}from"./daemon/opener.js";export{resolveStaticDir}from"./daemon/static.js";export{startDaemon}from"./daemon/start.js";export{registerProject,unregisterProject}from"./registry.js";export{classifyAsset,normalizeRelPath}from"./watch/classifier.js";export{WatchCache}from"./watch/cache.js";export{WatchService}from"./watch/watch-service.js";export{SyncScheduler}from"./watch/sync-scheduler.js";export{ClaudeCodeAdapter}from"./hooks/adapter.js";export{drainInboxOnce,handleIngestedRecords}from"./hooks/inbox-worker.js";export{MirrorWriter,hooksRoot,hookShardId,appendOutbox}from"./hooks/mirror.js";export{scanLibrarySkills,scanLibraryMcp,scanLibraryFileAssets}from"./install/scanner.js";export{FILE_ASSET_SPECS,FILE_ASSET_CATEGORIES,fileAssetTargetDir,isFileAssetCategory}from"./install/file-assets.js";export{installSkill,uninstallSkill,installFileAsset,uninstallFileAsset,installMcp,uninstallMcp,InstallConflictError,AssetNotFoundError}from"./install/installer.js";export{readMcpServers,readMcpJson}from"./install/installer.js";export{codexConfigFile,readCodexMcpServers,writeCodexMcpServer,removeCodexMcpServer,codexMcpExists,readCodexMcpFromText,upsertCodexMcpInText,removeCodexMcpFromText,upsertCodexPluginEnabledInText,parseDottedKey,sectionHeaderKey,renderTomlHeader,renderTomlKey,renderTomlString,splitTomlSections,upsertTomlSection,removeTomlSection,parseSectionEntries,CodexTomlCorruptError}from"./install/codex-toml.js";export{buildLibraryIndex,findSkillSource,findFileAssetSource}from"./install/library-index.js";export{hashSkillDir,maxMtimeDir,hashMcpConfig,hashFile,FingerprintCache}from"./install/fingerprint.js";export{projectFileNamespaces,projectPackFiles}from"./hooks/toolkit.js";export{detectUpdates,detectSkillUpdates,detectFileAssetUpdates,detectProjectUpdateCounts}from"./install/updates.js";export{detectPluginTemplateUpdates}from"./install/plugin-templates.js";export{readProjectFile,resolveProjectFile,PathEscapeError,FileTooLargeError}from"./install/reader.js";export{readGlobalClaudeJson,readGlobalMcpServers,writeGlobalMcpServer,removeGlobalMcpServer,readGlobalSkills,installGlobalSkill,uninstallGlobalSkill,ClaudeJsonCorruptError,globalPersonalSkillRoots,resolveGlobalSkillDir,listGlobalSkillFiles,readGlobalSkillFile}from"./install/global-config.js";export{readMcpEnableMap,setMcpEnableState}from"./install/settings-mcp.js";export{mcpOverrideOf,resolveMcpEffective,setMcpEnableOverride}from"./install/settings-mcp.js";export{readMcpRows}from"./install/mcp-rows.js";export{readPluginRows}from"./install/plugin-rows.js";export{installPluginPack}from"./install/plugin-install.js";export{readProjectConfig,writeProjectConfig,markSynced,DEFAULT_PROJECT_CONFIG}from"./install/project-config.js";export{applyUpdate,syncAll,refreshStatusline}from"./install/apply-update.js";export{DEFAULT_STATUSLINE_CONFIG,POWERLINE_DEFAULT_GLYPHS,SEGMENT_ORDER,LEGACY_IDENTITY_LINE,LEGACY_METRICS_LINE,NAMED_COLORS,SEGMENT_TOKENS,SEGMENT_DEFAULT_FORMAT,CONTEXT_STYLE_FORMAT,PLAIN_STATUSLINE_CONFIG}from"./statusline/config.js";export{WEAVE_VERSION}from"./version.js";export{generateStatuslineScript,statuslineCacheDir}from"./statusline/generator.js";export{StatuslineCacheSweeper,startStatuslineCacheSweeper}from"./statusline/cache-sweeper.js";export{readStatuslineConfig,writeStatuslineConfig,readGlobalStatuslineConfig,writeGlobalStatuslineConfig,applyStatuslineConfig,ensureSettingsStatusLine,readStatuslineScript}from"./statusline/manager.js";export function resolveDaemonEntry(){const e=r(new URL("./daemon/entry.js",import.meta.url));return o(e)?{path:e,isTs:!1}:{path:r(new URL("./daemon/entry.ts",import.meta.url)),isTs:!0}}export{installPlugin,uninstallPlugin,exportPlugin,searchPlugins,globalPluginRoot,isGitSource}from"./hooks/plugin-installer.js";
|
|
1
|
+
import{existsSync as o}from"node:fs";import{fileURLToPath as r}from"node:url";export{openDatabase}from"./db/db.js";export{getDataDir,getDbPath,getDaemonStatePath,getAuthPath,getInitialPasswordPath}from"./db/paths.js";export{ensureDataLayout,migrateDataLayout}from"./db/layout.js";export{ProjectRepository}from"./repositories/projects.js";export{HookEventRepository}from"./repositories/hook-events.js";export{SessionRepository}from"./repositories/sessions.js";export{LibraryRepository}from"./repositories/libraries.js";export{DEFAULT_PORT,DAEMON_HOST,isPortFree,findFreePort}from"./daemon/port.js";export{readDaemonState,writeDaemonState,clearDaemonState}from"./daemon/state.js";export{generateToken}from"./daemon/auth.js";export{createWeaveServer,weaveRequestHandler,DAEMON_VERSION}from"./daemon/server.js";export{accessUrls,lanIps,ensureDaemonCert,startTlsServer,daemonCertsDir}from"./daemon/tls.js";export{readDaemonSettings,writeDaemonSettings,terminalPresetsFor,resolveLocale,DEFAULT_DAEMON_SETTINGS,SUPPORTED_LOCALES,DEFAULT_LOCALE}from"./daemon/settings.js";export{resolveTerminalLaunch,resolveExplorerLaunch,openInExplorer,openInTerminal,runInTerminal,defaultProjectOpener}from"./daemon/opener.js";export{resolveStaticDir}from"./daemon/static.js";export{startDaemon}from"./daemon/start.js";export{registerProject,unregisterProject}from"./registry.js";export{probeBinVersion}from"./daemon/project-harnesses.js";export{classifyAsset,normalizeRelPath}from"./watch/classifier.js";export{WatchCache}from"./watch/cache.js";export{WatchService}from"./watch/watch-service.js";export{SyncScheduler}from"./watch/sync-scheduler.js";export{ClaudeCodeAdapter}from"./hooks/adapter.js";export{drainInboxOnce,handleIngestedRecords}from"./hooks/inbox-worker.js";export{MirrorWriter,hooksRoot,hookShardId,appendOutbox}from"./hooks/mirror.js";export{scanLibrarySkills,scanLibraryMcp,scanLibraryFileAssets}from"./install/scanner.js";export{FILE_ASSET_SPECS,FILE_ASSET_CATEGORIES,fileAssetTargetDir,isFileAssetCategory}from"./install/file-assets.js";export{installSkill,uninstallSkill,installFileAsset,uninstallFileAsset,installMcp,uninstallMcp,InstallConflictError,AssetNotFoundError}from"./install/installer.js";export{readMcpServers,readMcpJson}from"./install/installer.js";export{codexConfigFile,readCodexMcpServers,writeCodexMcpServer,removeCodexMcpServer,codexMcpExists,readCodexMcpFromText,upsertCodexMcpInText,removeCodexMcpFromText,upsertCodexPluginEnabledInText,parseDottedKey,sectionHeaderKey,renderTomlHeader,renderTomlKey,renderTomlString,splitTomlSections,upsertTomlSection,removeTomlSection,parseSectionEntries,CodexTomlCorruptError}from"./install/codex-toml.js";export{buildLibraryIndex,findSkillSource,findFileAssetSource}from"./install/library-index.js";export{hashSkillDir,maxMtimeDir,hashMcpConfig,hashFile,FingerprintCache}from"./install/fingerprint.js";export{projectFileNamespaces,projectPackFiles}from"./hooks/toolkit.js";export{detectUpdates,detectSkillUpdates,detectFileAssetUpdates,detectProjectUpdateCounts}from"./install/updates.js";export{detectPluginTemplateUpdates}from"./install/plugin-templates.js";export{readProjectFile,resolveProjectFile,PathEscapeError,FileTooLargeError}from"./install/reader.js";export{readGlobalClaudeJson,readGlobalMcpServers,writeGlobalMcpServer,removeGlobalMcpServer,readGlobalSkills,installGlobalSkill,uninstallGlobalSkill,ClaudeJsonCorruptError,globalPersonalSkillRoots,resolveGlobalSkillDir,listGlobalSkillFiles,readGlobalSkillFile}from"./install/global-config.js";export{readMcpEnableMap,setMcpEnableState}from"./install/settings-mcp.js";export{mcpOverrideOf,resolveMcpEffective,setMcpEnableOverride}from"./install/settings-mcp.js";export{readMcpRows}from"./install/mcp-rows.js";export{readPluginRows}from"./install/plugin-rows.js";export{installPluginPack}from"./install/plugin-install.js";export{readProjectConfig,writeProjectConfig,markSynced,DEFAULT_PROJECT_CONFIG}from"./install/project-config.js";export{applyUpdate,syncAll,refreshStatusline}from"./install/apply-update.js";export{DEFAULT_STATUSLINE_CONFIG,POWERLINE_DEFAULT_GLYPHS,SEGMENT_ORDER,LEGACY_IDENTITY_LINE,LEGACY_METRICS_LINE,NAMED_COLORS,SEGMENT_TOKENS,SEGMENT_DEFAULT_FORMAT,CONTEXT_STYLE_FORMAT,PLAIN_STATUSLINE_CONFIG}from"./statusline/config.js";export{WEAVE_VERSION}from"./version.js";export{generateStatuslineScript,statuslineCacheDir}from"./statusline/generator.js";export{StatuslineCacheSweeper,startStatuslineCacheSweeper}from"./statusline/cache-sweeper.js";export{readStatuslineConfig,writeStatuslineConfig,readGlobalStatuslineConfig,writeGlobalStatuslineConfig,applyStatuslineConfig,ensureSettingsStatusLine,readStatuslineScript}from"./statusline/manager.js";export function resolveDaemonEntry(){const e=r(new URL("./daemon/entry.js",import.meta.url));return o(e)?{path:e,isTs:!1}:{path:r(new URL("./daemon/entry.ts",import.meta.url)),isTs:!0}}export{installPlugin,uninstallPlugin,exportPlugin,searchPlugins,globalPluginRoot,isGitSource}from"./hooks/plugin-installer.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{rm as
|
|
1
|
+
import{rm as u,cp as y,mkdir as d}from"node:fs/promises";import{homedir as f}from"node:os";import l from"node:path";import{applyStatuslineConfig as w}from"../statusline/manager.js";import{readStatuslineConfig as S}from"../statusline/manager.js";import{buildLibraryIndex as g,findSkillSource as k,findMcpSource as h,findFileAssetSource as x}from"./library-index.js";import{detectUpdates as E}from"./updates.js";import{materializePluginTemplate as F}from"./plugin-templates.js";import{applyInitFile as $}from"./init-files.js";import{FILE_ASSET_SPECS as A,fileAssetTargetDir as C,isFileAssetCategory as b}from"./file-assets.js";import{assetSurfaceFor as p}from"../surfaces.js";export async function applyUpdate(t,o,m,i){const c=m??(i?await g(i):await g([])),a=o.agent??"claude";if(o.category==="skill"){const e=k(c,o.name);if(!e)throw new Error(`No library source for skill "${o.name}"`);const n=o.scope==="user"?p(a).globalSkillsRoots(f())[0]:l.join(t,...p(a).projectSkillsRoots()[0].split("/")),s=l.join(n,o.name);await u(s,{recursive:!0,force:!0}),await y(e.dirPath,s,{recursive:!0});return}if(b(o.category)){const e=x(c,o.category,o.name);if(!e)throw new Error(`No library source for ${o.category} "${o.name}"`);const n=C(o.category,a,o.scope,t,f());await d(n,{recursive:!0});const s=l.join(n,`${o.name}${A[o.category].ext}`);await u(s,{force:!0}),await y(e.filePath,s);return}const r=h(c,o.name);if(!r)throw new Error(`No library source for MCP "${o.name}"`);await p(a).mcpWrite(o.scope,t,f(),o.name,r.config)}export async function syncAll(t,o,m,i){const c=i??await g(o),a=await E(t,o,m,c),r=[];for(const e of a.skills)e.custom||!e.outdated||(await applyUpdate(t,{category:"skill",name:e.name,scope:e.scope,agent:e.agent},c),r.push({category:"skill",name:e.name,scope:e.scope,agent:e.agent}));for(const e of a.mcp)e.custom||!e.outdated||(await applyUpdate(t,{category:"mcp",name:e.name,scope:e.scope,agent:e.agent},c),r.push({category:"mcp",name:e.name,scope:e.scope,agent:e.agent}));for(const e of a.files)e.custom||!e.outdated||(await applyUpdate(t,{category:e.category,name:e.name,scope:e.scope},c),r.push({category:e.category,name:e.name,scope:e.scope}));for(const e of a.pluginTemplates)e.outdated&&(await F(e),r.push({category:e.category,name:e.name,scope:"project"}));for(const e of a.initFiles)await $(e)&&r.push({category:"init",name:e.relPath,scope:"project"});return{updated:r,skipped:0}}export async function refreshStatusline(t){const o=await S(t);await w(t,o)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import p from"node:path";import{homedir as m}from"node:os";import{HARNESS_KEYS as l}from"@weavecode/core";import{FILE_ASSET_SPECS as h,FILE_ASSET_CATEGORIES as S}from"./file-assets.js";import{assetSurfaces as
|
|
1
|
+
import p from"node:path";import{homedir as m}from"node:os";import{HARNESS_KEYS as l}from"@weavecode/core";import{FILE_ASSET_SPECS as h,FILE_ASSET_CATEGORIES as S}from"./file-assets.js";import{assetSurfaces as u,configSurfaces as j,statuslineSurfaces as E}from"../surfaces.js";function f(r,c){return p.join("~",p.relative(c,r)).split(p.sep).join("/")}export function installCapabilities(){const r=m(),c={};for(const s of S){const t=h[s].dirs,o=[];for(const e of l){const n=t[e];if(!n)continue;const i=[];n.project&&i.push("project"),n.user&&i.push("user"),i.length>0&&o.push({harness:e,scopes:i})}c[s]={surfaces:o}}c.skill={surfaces:u().map(s=>{const t=[],o={},e=s.projectSkillsRoots()[0];e&&(t.push("project"),o.project=e);const n=s.globalSkillsRoots(r)[0];return n&&(t.push("user"),o.user=f(n,r)),{harness:s.harness,scopes:t,dest:o}})},c.mcp={surfaces:u().map(s=>{const t={},o=s.mcpDest("project",r),e=s.mcpDest("user",r);return o&&(t.project=o),e&&(t.user=f(e,r)),{harness:s.harness,scopes:s.mcpScopes(),dest:t}}).filter(s=>s.scopes.length>0)};const a=E().map(({harness:s,surface:t})=>({harness:s,tui:t.tui,segments:[...t.segments]}));return{categories:c,statusline:a,config:j().map(s=>s.harness)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{homedir as t}from"node:os";import{assetSurfaceFor as
|
|
1
|
+
import{homedir as t}from"node:os";import{assetSurfaceFor as x}from"../surfaces.js";import{codexMcpExists as c,readCodexMcpServers as d,removeCodexMcpServer as n,writeCodexMcpServer as p}from"@weavecode/harness";export{CodexTomlCorruptError,parseDottedKey,sectionHeaderKey,renderTomlKey,renderTomlHeader,renderTomlString,splitTomlSections,upsertTomlSection,removeTomlSection,parseSectionEntries,upsertCodexPluginEnabledInText,readCodexMcpFromText,upsertCodexMcpInText,removeCodexMcpFromText}from"@weavecode/harness";export function codexConfigFile(e=t()){return x("codex").userConfigFile(e)}export function readCodexMcpServers(e=codexConfigFile()){return d(e)}export function codexMcpExists(e,r=codexConfigFile()){return c(e,r)}export function writeCodexMcpServer(e,r,o=codexConfigFile()){return p(e,r,o)}export function removeCodexMcpServer(e,r=codexConfigFile()){return n(e,r)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assetSurfaceFor as
|
|
1
|
+
import{assetSurfaceFor as i}from"../surfaces.js";export{FILE_ASSET_SPECS,FILE_ASSET_CATEGORIES,isFileAssetCategory}from"@weavecode/harness";export function fileAssetTargetDir(r,e,t,o,S){return i(e).targetDir(r,t,o,S)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readdir as m,readFile as u,stat as l}from"node:fs/promises";import{createHash as h}from"node:crypto";import c from"node:path";const f=new Set([".weave",".git","node_modules"]);export async function hashSkillDir(e,t=f){const
|
|
1
|
+
import{readdir as m,readFile as u,stat as l}from"node:fs/promises";import{createHash as h}from"node:crypto";import c from"node:path";const f=new Set([".weave",".git","node_modules"]);export async function hashSkillDir(e,t=f){const a=h("sha256"),r=[];await p(e,e,r,t),r.sort((n,i)=>n.rel.localeCompare(i.rel));for(const n of r){a.update(n.rel),a.update("\0");let i;try{i=await u(n.abs)}catch{continue}a.update(i),a.update("\0")}return a.digest("hex")}async function p(e,t,a,r){let n;try{n=await m(t,{withFileTypes:!0})}catch{return}const i=[];for(const s of n)s.name.startsWith(".")&&r.has(s.name)||(!r.has(s.name)&&s.isDirectory()?i.push(p(e,c.join(t,s.name),a,r)):s.isFile()&&a.push({rel:c.relative(e,t).replace(/\\/g,"/")+"/"+s.name,abs:c.join(t,s.name)}));await Promise.all(i)}export async function maxMtimeDir(e,t=f){let a;try{a=await m(e,{withFileTypes:!0})}catch{return 0}return(await Promise.all(a.map(async n=>{if(n.name.startsWith(".")&&t.has(n.name))return 0;const i=c.join(e,n.name);if(n.isDirectory())return maxMtimeDir(i,t);if(!n.isFile())return 0;try{return(await l(i)).mtimeMs}catch{return 0}}))).reduce((n,i)=>Math.max(n,i),0)}export function hashMcpConfig(e){return h("sha256").update(JSON.stringify(o(e))).digest("hex")}export async function hashFile(e){try{const t=await u(e);return h("sha256").update(t).digest("hex")}catch{return"missing"}}function o(e){if(Array.isArray(e))return e.map(o);if(e&&typeof e=="object"){const t={};for(const a of Object.keys(e).sort())t[a]=o(e[a]);return t}return e}export class FingerprintCache{cache=new Map;fileCache=new Map;async get(t){const a=await maxMtimeDir(t),r=this.cache.get(t);if(r&&r.maxMtime===a)return r.hash;const n=await hashSkillDir(t);return this.cache.set(t,{maxMtime:a,hash:n}),n}async getFile(t){let a;try{a=(await l(t)).mtimeMs}catch{return"missing"}const r=this.fileCache.get(t);if(r&&r.maxMtime===a)return r.hash;const n=await hashFile(t);return this.fileCache.set(t,{maxMtime:a,hash:n}),n}invalidate(t){this.cache.delete(t)}clear(){this.cache.clear(),this.fileCache.clear()}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as E,readdir as
|
|
1
|
+
import{readFile as E,readdir as h,access as J,stat as x,realpath as G}from"node:fs/promises";import{homedir as c}from"node:os";import l from"node:path";import{AssetNotFoundError as g}from"./installer.js";import{readClaudeJson as N}from"@weavecode/harness";import{FileTooLargeError as W,MAX_BYTES as v}from"./reader.js";import{assetSurfaceFor as y,assetSurfaces as R,pluginStateFor as k,pluginSurfaceFor as $}from"../surfaces.js";import{installForm as L,linkOrCopy as _,removeInstalled as z}from"../market/install-link.js";export{ClaudeJsonCorruptError}from"@weavecode/harness";const I=".claude.json",U=".claude/plugins/installed_plugins.json";function B(){return l.join(c(),I)}function S(){return y("claude").globalSkillsRoots(c())[0]}function M(t=c()){return l.join(t,U)}function K(){return y("claude").userConfigFile(c())}function O(){return y("codex").globalSkillsRoots(c())[0]}function X(){return y("codex").globalSkillsRoots(c())}function P(){const t=y("codex").pluginCacheDir?.(c());if(!t)throw new Error("codex has no plugin cache surface");return t}export function globalPersonalSkillRootsOwned(){return R().flatMap(t=>t.globalSkillsRoots(c()).map(n=>({harness:t.harness,root:n})))}export function globalPersonalSkillRoots(){return globalPersonalSkillRootsOwned().map(t=>t.root)}async function T(t){try{return await J(t),!0}catch{return!1}}async function m(t){try{return(await x(t)).isDirectory()}catch{return!1}}export function readGlobalClaudeJson(){return N(c())}export async function readGlobalMcpServers(){const t=(await readGlobalClaudeJson()).mcpServers;return!t||typeof t!="object"||Array.isArray(t)?{}:t}export async function writeGlobalMcpServer(t,n){await y("claude").mcpWrite("user","",c(),t,n)}export async function removeGlobalMcpServer(t){await y("claude").mcpRemove("user","",c(),t)}export async function readGlobalSkills(){const t=S();try{const n=await h(t,{withFileTypes:!0}),o=[];for(const e of n)!e.isDirectory()&&!e.isSymbolicLink()||await m(l.join(t,e.name))&&o.push(e.name);return o.sort((e,r)=>e.localeCompare(r))}catch{return[]}}export async function installGlobalSkill(t,n,o="claude"){const e=y(o).globalSkillsRoots(c())[0],r=l.join(e,n);if(await T(r))throw new Error(`Global ${o} skill "${n}" already exists`);return await _(t,r),r}export async function uninstallGlobalSkill(t,n="claude"){const o=y(n).globalSkillsRoots(c())[0];await z(l.join(o,t))}async function C(t=c()){const n=M(t);if(!await T(n))return{};try{const o=JSON.parse(await E(n,"utf-8"));return o&&typeof o=="object"&&!Array.isArray(o)?o:{}}catch{return{}}}async function j(t){if(!await m(t))return[];let n;try{n=await h(t,{withFileTypes:!0})}catch{return[]}const o=[];for(const e of n){if(e.name.startsWith(".")||!e.isDirectory()&&!e.isSymbolicLink())continue;const r=l.join(t,e.name);if(!await m(r))continue;const i=await L(r);i!=="absent"&&o.push({name:e.name,dir:r,form:i})}return o.sort((e,r)=>e.name.localeCompare(r.name))}export async function installedPluginNamespaces(t=c()){const o=(await C(t)).plugins;if(!o||typeof o!="object"||Array.isArray(o))return[];const e=[];for(const[r,i]of Object.entries(o)){const{market:s}=$("claude").parsePluginKey(r);for(const a of Array.isArray(i)?i:[])a&&typeof a.installPath=="string"&&e.push({dir:a.installPath,namespace:s})}return e}async function Y(){const n=(await C()).plugins;if(!n||typeof n!="object"||Array.isArray(n))return[];const o=[];for(const[e,r]of Object.entries(n)){const i=Array.isArray(r)?r:[];if(i.length===0)continue;const s=[...i].filter(d=>d&&typeof d.installPath=="string").pop();if(!s?.installPath)continue;const a=await j(l.join(s.installPath,"skills")),{name:u,market:p}=$("claude").parsePluginKey(e);o.push({source:"claude-plugin",label:u,namespace:p,skills:a,pluginKey:e})}return o.sort((e,r)=>e.label.localeCompare(r.label))}async function q(){const t=new Map;for(const o of X())for(const e of await j(o))t.has(e.name)||t.set(e.name,e);return{source:"codex-personal",label:"Codex \xB7 \u4E2A\u4EBA",skills:[...t.values()].sort((o,e)=>o.name.localeCompare(e.name))}}async function H(){const t=P();if(!await m(t))return[];const n=[];let o;try{o=await h(t,{withFileTypes:!0})}catch{return[]}for(const e of o){if(!e.isDirectory()&&!e.isSymbolicLink())continue;const r=l.join(t,e.name);let i;try{i=await h(r,{withFileTypes:!0})}catch{continue}for(const s of i){if(!s.isDirectory()&&!s.isSymbolicLink())continue;const a=l.join(r,s.name);let u;try{u=await h(a,{withFileTypes:!0})}catch{continue}const p=u.filter(w=>w.isDirectory()||w.isSymbolicLink());if(p.length===0)continue;const d=p.map(w=>w.name).sort().pop(),f=await j(l.join(a,d,"skills")),b=`${s.name}@${e.name}`;n.push({source:"codex-plugin",label:s.name,namespace:e.name,skills:f,pluginKey:b})}}return n.sort((e,r)=>e.label.localeCompare(r.label))}async function Q(){const t=S(),n=await readGlobalSkills(),o=[];for(const e of n){const r=l.join(t,e),i=await L(r);i!=="absent"&&o.push({name:e,dir:r,form:i})}return{source:"claude-personal",label:"Claude Code \xB7 \u4E2A\u4EBA",skills:o}}export async function readGlobalSkillGroups(){const[t,n,o,e,r,i]=await Promise.all([Q(),Y(),q(),H(),readClaudePluginEnabled(),readCodexPluginEnabled()]),s=(a,u)=>({...a,enabled:a.pluginKey?u[a.pluginKey]??!1:void 0});return[t,...n.map(a=>s(a,r)),o,...e.map(a=>s(a,i))]}export async function resolveGlobalSkillDir(t,n,o){if(t==="claude-personal"){const f=l.join(S(),n);return await m(f)?f:null}if(t==="codex-personal"){const f=l.join(O(),n);return await m(f)?f:null}if(t==="claude-plugin"){if(!o)return null;const b=(await C()).plugins;if(!b||typeof b!="object"||Array.isArray(b))return null;const w=b[o],F=[...Array.isArray(w)?w:[]].filter(D=>D&&typeof D.installPath=="string").pop();if(!F?.installPath)return null;const A=l.join(F.installPath,"skills",n);return await m(A)?A:null}if(!o)return null;const e=o.lastIndexOf("@");if(e<=0)return null;const r=o.slice(0,e),i=o.slice(e+1),s=l.join(P(),i,r);if(!await m(s))return null;let a;try{a=await h(s,{withFileTypes:!0})}catch{return null}const u=a.filter(f=>f.isDirectory()||f.isSymbolicLink());if(u.length===0)return null;const p=u.map(f=>f.name).sort().pop(),d=l.join(s,p,"skills",n);return await m(d)?d:null}function V(t){const n=l.resolve(t),o=c();return R().find(r=>{const i=[...r.globalSkillsRoots(o)],s=r.pluginCacheDir?.(o);return s&&i.push(s),i.some(a=>n===l.resolve(a)||n.startsWith(l.resolve(a)+l.sep))})?.harness??"claude"}export async function listGlobalSkillFiles(t){const n=V(t),o=[],e=async(r,i)=>{let s;try{s=await h(r,{withFileTypes:!0})}catch{return}for(const a of s){if(a.name.startsWith("."))continue;const u=l.join(r,a.name),p=i?`${i}/${a.name}`:a.name;if((a.isDirectory()||a.isSymbolicLink())&&await m(u))await e(u,p);else if(a.isFile()||a.isSymbolicLink())try{const d=await x(u);d.isFile()&&o.push({absPath:u,relPath:p,category:"skill",agent:n,mtimeMs:d.mtimeMs})}catch{}}};return await e(t,""),o.sort((r,i)=>r.relPath.localeCompare(i.relPath))}export async function readGlobalSkillFile(t,n){const o=l.normalize(n).replace(/\\/g,"/");if(l.isAbsolute(n))throw new g(`Absolute paths are not allowed: "${n}"`);if(o.split("/").some(p=>p===".."))throw new g(`Path traversal is not allowed: "${n}"`);const e=l.join(t,o);let r;try{r=await x(e)}catch{throw new g(`File not found: "${n}"`)}if(!r.isFile())throw new g(`Not a file: "${n}"`);if(r.size>v)throw new W(`File exceeds ${v} bytes: "${n}"`);let i=t,s=e;try{[i,s]=await Promise.all([G(t),G(e)])}catch{throw new g(`File not found: "${n}"`)}const a=i.endsWith(l.sep)?i:i+l.sep;if(s!==i&&!s.startsWith(a))throw new g(`Resolved path escapes the skill directory: "${n}"`);return{content:await E(e,"utf-8"),size:r.size}}export async function readClaudePluginEnabled(){return k("claude").readGlobalEnabled()}export async function writeClaudePluginEnabled(t,n){return k("claude").writeGlobalEnabled(t,n)}export async function readCodexPluginEnabled(){return k("codex").readGlobalEnabled()}export async function writeCodexPluginEnabled(t,n){return k("codex").writeGlobalEnabled(t,n)}export{S as globalSkillsPath,B as claudeJsonPath,M as claudePluginsJsonPath,K as claudeSettingsPath,O as codexSkillsPath,P as codexPluginsCachePath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{lstat as
|
|
1
|
+
import{lstat as S,readdir as _,stat as P}from"node:fs/promises";import{homedir as g}from"node:os";import c from"node:path";import{classifyAgent as w,classifyAsset as h}from"../watch/classifier.js";import{PluginModsSniffer as I}from"../watch/plugin-mods.js";import{installedPluginNamespaces as D}from"./global-config.js";const L=["commands","agents","workflows","rules","output-styles","hooks","themes","routines","plugins"],A=["CLAUDE.md","settings.json","settings.local.json"],k=["prompts"],R=["config.toml","AGENTS.md"],T=new Set(["skills","node_modules",".git"]),U=new Set(["marketplaces","data",".in_use"]),y=".claude/plugins",F=`${y}/`,N=6,O=10,$=5e3,j=[{prefix:".claude",dirs:L,files:A},{prefix:".codex",dirs:k,files:R}];async function d(s,n,o){try{const e=await S(s),a=e.isSymbolicLink(),t=a?await P(s):e;if(!t.isFile())return null;let i=h(n);return i==="plugin"&&(i=o.refine(i,n,s)),{absPath:s,relPath:n,category:i,agent:w(n),mtimeMs:t.mtimeMs,...a?{isSymlink:!0}:{}}}catch{return null}}async function f(s,n,o,e,a){if(o>e)return[];let t;try{t=await _(s,{withFileTypes:!0})}catch{return[]}return(await Promise.all(t.map(async l=>{const u=c.join(s,l.name),r=`${n}/${l.name}`;if(l.isDirectory())return E(r,l.name)?[]:f(u,r,o+1,e,a);if(l.isSymbolicLink())try{if((await P(u)).isDirectory())return E(r,l.name)?[]:f(u,r,o+1,e,a)}catch{return[]}const m=await d(u,r,a);return m?[m]:[]}))).flat()}function E(s,n){return T.has(n)?!0:s.startsWith(F)&&U.has(n)}export async function listGlobalFileAssets(s=g()){const n=new I({revalidate:!1}),e=(await Promise.all(j.map(async t=>{const i=c.join(s,...t.prefix.split("/")),[l,u]=await Promise.all([Promise.all(t.files.map(r=>d(c.join(i,r),`${t.prefix}/${r}`,n))),Promise.all(t.dirs.map(r=>{const m=`${t.prefix}/${r}`,p=m===y?O:N;return f(c.join(i,r),m,1,p,n)}))]);return[...l.filter(r=>r!==null),...u.flat()]}))).flat(),a=await D(s);return e.sort((t,i)=>t.relPath.localeCompare(i.relPath)),e.slice(0,$).map(t=>{const i=x(t.absPath,a);return i?{...t,namespace:i}:t})}function x(s,n){let o;for(const e of n){const a=c.relative(c.resolve(e.dir),c.resolve(s));a===""||a.startsWith("..")||c.isAbsolute(a)||(!o||e.dir.length>o.dir.length)&&(o=e)}return o?.namespace}
|