@weavecode/weave 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/dist/index.cjs +31 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/dist/index.mjs +31 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.cjs +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.mjs +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/README.md +39 -39
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/dist/ipv6.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/context.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/helper/css/common.js +3 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/hono-base.js +4 -10
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/hono.js +0 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/csrf/index.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/mount/index.js +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +13 -11
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +39 -51
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +15 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/utils/jwt/jwt.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/utils/mount.js +35 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/utils/url.js +10 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/validator/validator.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/context.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/helper/css/common.js +3 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/hono-base.js +4 -10
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/hono.js +0 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/basic-auth/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/csrf/index.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/jwk/jwk.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/jwt/jwt.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/language/language.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/mount/index.js +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/reg-exp-router/node.js +13 -11
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +5 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/reg-exp-router/router.js +40 -52
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/reg-exp-router/trie.js +15 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/middleware/mount/index.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/utils/url.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/utils/jwt/jwt.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/utils/mount.js +34 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/utils/url.js +10 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/validator/validator.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +3 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/deflate.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/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 +3 -3
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +7 -0
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +3 -3
- package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
- package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +5 -5
- package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
- package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
- package/node_modules/@weavecode/cli/dist/init/git-exclude.d.ts +20 -0
- package/node_modules/@weavecode/cli/dist/init/git-exclude.js +7 -0
- package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
- package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/instruction-files.d.ts +14 -0
- package/node_modules/@weavecode/cli/dist/init/instruction-files.js +1 -0
- package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
- package/node_modules/@weavecode/cli/dist/init/provision.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
- package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
- package/node_modules/@weavecode/cli/dist/parser.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
- package/node_modules/@weavecode/cli/package.json +5 -5
- package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
- package/node_modules/@weavecode/core/dist/harness.d.ts +115 -0
- package/node_modules/@weavecode/core/dist/harness.js +1 -1
- package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
- package/node_modules/@weavecode/core/dist/index.js +1 -1
- package/node_modules/@weavecode/core/dist/platform.js +1 -1
- package/node_modules/@weavecode/core/dist/types.d.ts +4 -4
- package/node_modules/@weavecode/core/dist/types.js +1 -1
- package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
- package/node_modules/@weavecode/core/package.json +1 -1
- package/node_modules/@weavecode/harness/dist/claude/assets.js +3 -3
- package/node_modules/@weavecode/harness/dist/claude/capture.js +9 -9
- package/node_modules/@weavecode/harness/dist/claude/commands.d.ts +2 -0
- package/node_modules/@weavecode/harness/dist/claude/commands.js +3 -2
- package/node_modules/@weavecode/harness/dist/claude/config.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/edits.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/images.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/liveness.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/mcp-gen.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/messaging.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/narration.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/peers.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/plan.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/plugins.js +4 -4
- package/node_modules/@weavecode/harness/dist/claude/prompt-inbox.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/prompt.js +3 -3
- package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/resume.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/rewind.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/side-question.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/statusline/generator.d.ts +6 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +21 -14
- package/node_modules/@weavecode/harness/dist/claude/statusline/git-cache.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/statusline/surface.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/transcript.js +7 -7
- package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/capture.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/commands.js +4 -4
- package/node_modules/@weavecode/harness/dist/codex/config.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/detect.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/event-source.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/images.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/index.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/liveness.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/mcp.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/messaging.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/narration.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/plugin-state.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/plugins.js +3 -3
- package/node_modules/@weavecode/harness/dist/codex/provision.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/questions.js +2 -2
- package/node_modules/@weavecode/harness/dist/codex/rollout.js +5 -5
- package/node_modules/@weavecode/harness/dist/codex/side-question.js +4 -4
- package/node_modules/@weavecode/harness/dist/codex/titles.js +4 -4
- package/node_modules/@weavecode/harness/dist/codex/toml.js +13 -13
- package/node_modules/@weavecode/harness/dist/codex/transcript.js +2 -2
- package/node_modules/@weavecode/harness/dist/driver.d.ts +6 -0
- package/node_modules/@weavecode/harness/dist/driver.js +1 -1
- package/node_modules/@weavecode/harness/dist/init/generated.js +2 -2
- package/node_modules/@weavecode/harness/dist/init/pipeline.js +1 -1
- package/node_modules/@weavecode/harness/dist/registry-wiring.js +1 -1
- package/node_modules/@weavecode/harness/dist/shared/install-link.js +1 -1
- package/node_modules/@weavecode/harness/dist/shared/json-cap.js +1 -1
- package/node_modules/@weavecode/harness/package.json +2 -2
- package/node_modules/@weavecode/server/dist/config/dotted.js +1 -1
- package/node_modules/@weavecode/server/dist/config/profiles.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/ai-config.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/ai-context.js +6 -6
- package/node_modules/@weavecode/server/dist/daemon/ai-routes.js +4 -4
- package/node_modules/@weavecode/server/dist/daemon/api-log.js +3 -3
- package/node_modules/@weavecode/server/dist/daemon/auth-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/auto-start.js +3 -3
- package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/config-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/cron.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/dashboard-auth.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/dashboard-pusher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/decision-config.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/entry.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/fs-browser.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/http.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/liveness.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/mcp-orchestration.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/narration-watcher.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/pty-terminals.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/shared.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/wezterm-mux.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/wt.js +3 -3
- package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/pet-seed.d.ts +4 -0
- package/node_modules/@weavecode/server/dist/daemon/pet-seed.js +2 -0
- package/node_modules/@weavecode/server/dist/daemon/pet-window.d.ts +17 -0
- package/node_modules/@weavecode/server/dist/daemon/pet-window.js +2 -0
- package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/project-files.d.ts +1 -1
- package/node_modules/@weavecode/server/dist/daemon/project-files.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/project-harnesses.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/project-updates-refresher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/prompt-images.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/hooks-admin.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/installations.d.ts +29 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/installations.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/market.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/orchestration.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/path-refs.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/pets.d.ts +3 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/pets.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/project-files.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/projects.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/search.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/session-control.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/session-insights.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/settings-statusline.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/uploads.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.js +2 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/watches.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/server.d.ts +4 -0
- package/node_modules/@weavecode/server/dist/daemon/server.js +8 -8
- package/node_modules/@weavecode/server/dist/daemon/session-open.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/settings.d.ts +21 -0
- 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.d.ts +4 -1
- package/node_modules/@weavecode/server/dist/db/db.js +2 -2
- package/node_modules/@weavecode/server/dist/db/layout.d.ts +5 -0
- package/node_modules/@weavecode/server/dist/db/layout.js +2 -1
- package/node_modules/@weavecode/server/dist/db/paths.d.ts +9 -0
- package/node_modules/@weavecode/server/dist/db/paths.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/answer-keys.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/dashboard-rate.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/decision-judge.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/channels.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/keys.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/queue.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/relay.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/send.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/dispatcher.js +6 -6
- package/node_modules/@weavecode/server/dist/hooks/edge-extract.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/handlers/webhook.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/headless-runner.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/inbox-socket.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/inbox-worker.js +3 -3
- package/node_modules/@weavecode/server/dist/hooks/match.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +5 -5
- package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
- package/node_modules/@weavecode/server/dist/hooks/orchestration-engine.js +7 -7
- package/node_modules/@weavecode/server/dist/hooks/orchestration-graph.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/plugin-installer.js +3 -3
- package/node_modules/@weavecode/server/dist/hooks/plugin-loader.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/plugin-project-state.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/prompt-flusher.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/promptbox.js +8 -8
- package/node_modules/@weavecode/server/dist/hooks/push-notify.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/question-tracker.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/registry.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/resume-runner.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/side-questions.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/synthetic-sessions.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/toolkit-scan.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
- package/node_modules/@weavecode/server/dist/hooks/watch-engine.js +1 -1
- package/node_modules/@weavecode/server/dist/index.d.ts +1 -1
- 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.d.ts +0 -9
- package/node_modules/@weavecode/server/dist/install/init-files.js +2 -2
- package/node_modules/@weavecode/server/dist/install/install-ledger.js +1 -1
- package/node_modules/@weavecode/server/dist/install/installer.js +1 -1
- package/node_modules/@weavecode/server/dist/install/library-index.js +1 -1
- package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-install.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-rows.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-templates.js +1 -1
- package/node_modules/@weavecode/server/dist/install/project-config.js +1 -1
- package/node_modules/@weavecode/server/dist/install/reader.js +1 -1
- package/node_modules/@weavecode/server/dist/install/scan-cache.js +1 -1
- package/node_modules/@weavecode/server/dist/install/scanner.js +1 -1
- package/node_modules/@weavecode/server/dist/install/settings-mcp.js +2 -2
- package/node_modules/@weavecode/server/dist/install/updates.js +1 -1
- package/node_modules/@weavecode/server/dist/market/builtin.js +1 -1
- package/node_modules/@weavecode/server/dist/market/identity.js +1 -1
- package/node_modules/@weavecode/server/dist/market/import.js +2 -2
- package/node_modules/@weavecode/server/dist/market/refresh.js +1 -1
- package/node_modules/@weavecode/server/dist/market/resolve.js +1 -1
- package/node_modules/@weavecode/server/dist/market/updates.js +1 -1
- package/node_modules/@weavecode/server/dist/registry.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/hook-dispatches.js +4 -4
- package/node_modules/@weavecode/server/dist/repositories/hook-events.d.ts +6 -0
- package/node_modules/@weavecode/server/dist/repositories/hook-events.js +8 -5
- package/node_modules/@weavecode/server/dist/repositories/hook-rules.js +4 -4
- package/node_modules/@weavecode/server/dist/repositories/libraries.js +1 -1
- package/node_modules/@weavecode/server/dist/repositories/orchestrations.js +7 -7
- package/node_modules/@weavecode/server/dist/repositories/plugin-states.js +1 -1
- package/node_modules/@weavecode/server/dist/repositories/projects.js +1 -1
- package/node_modules/@weavecode/server/dist/repositories/push-subscriptions.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/session-watches.js +4 -4
- package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/uploads.js +11 -11
- package/node_modules/@weavecode/server/dist/statusline/cache-sweeper.js +1 -1
- package/node_modules/@weavecode/server/dist/statusline/generator.js +1 -1
- package/node_modules/@weavecode/server/dist/statusline/manager.js +3 -3
- package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/cache.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/classifier.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/plugin-mods.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/sync-scheduler.js +1 -1
- package/node_modules/@weavecode/server/dist/watch/watch-service.js +1 -1
- package/node_modules/@weavecode/server/package.json +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/abnfDiagram-WEYOIA3C-S1lL1V_n.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{arc-CRZTRyjb.js → arc-CoTNHyHV.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/architectureDiagram-ZHVYKT53-C6ttfnzW.js +36 -0
- package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-BIH8mSIZ.js → blockDiagram-RJAE7QA3-CYr3Cpu9.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-5YoKWFOD.js → c4Diagram-XDPPPE54-BFS7PhLD.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/channel-DxQHp3Yc.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-B653kMXt.js → chunk-2E7WHVMD-DJ7X_Shu.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-f_A4_eDz.js → chunk-2Q5K7J3B-B8nr2rdz.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-v5j5qNGj.js → chunk-4EMNKR2T-DmnZmUMU.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-55XCU76K-Xz9a8dmp.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-BeROhLXN.js → chunk-5VM5RSS4-Dg9mg7pf.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-D6dXb_jr.js → chunk-JWPE2WC7-CmjTZO8o.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-CnHdSEMi.js → chunk-VQ5W62QI-D3YDdJ3E.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-XXDRQBXY-s1OG9sqW.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/chunk-ZCHMQSOR-C3hINQU3.js +2 -0
- package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-DQe1b_k8.js → classDiagram-v2-4MYWR3UA-BTsbYrVl.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/cose-bilkent-JH36ORCC-C0W8Y-jI.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-OZotFKUu.js → cynefin-EF2NZ3EQ-stAu4Rh-.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/cynefinDiagram-WF24UDRP-CqYibiiv.js +62 -0
- package/node_modules/@weavecode/server/web/dist/assets/dagre-NK4GIZVX-qqcoJAqB.js +4 -0
- package/node_modules/@weavecode/server/web/dist/assets/diagram-CBK3MWTC-D0YTopb7.js +24 -0
- package/node_modules/@weavecode/server/web/dist/assets/diagram-I5XIIV2D-Csvw6aYr.js +24 -0
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-D9A6W8oB.js → diagram-ODIL2UCW-Dl0tYLkF.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-PeI-eyu2.js → diagram-PFBEJUXE-BCPSWZPe.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/diagram-RJA3I4VV-ETg-BrAJ.js +41 -0
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-D5KieEw5.js → diagram-TYUNFSNR-_M6ZxBG7.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/ebnfDiagram-V4P3TTPT-C-e_W7qx.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ-D3xrVg0U.js → elk-QONTBCTQ-B5TBharB.js} +3 -3
- package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-y_V1cor7.js → erDiagram-KYQIGQAA-D08rj2pv.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-BJ8Z0MkF.js → flowDiagram-IUGLLWBU-BALTxsKh.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/ganttDiagram-R7GPNTJY-Cts193jT.js +292 -0
- package/node_modules/@weavecode/server/web/dist/assets/gitGraphDiagram-PDYL7XHY-L9qYUX0v.js +106 -0
- package/node_modules/@weavecode/server/web/dist/assets/infoDiagram-MVDRKAX5-Bv47rgU0.js +2 -0
- package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-ChEnND76.js → ishikawaDiagram-HPEHV2GE-Da8_s6cs.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-DHcNtpYF.js → journeyDiagram-BOSHW7O7-Bj3CjZOf.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-Dft7qpW5.js → kanban-definition-FNSA4HC5-D1hicmMu.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/linear-CWQg2iA1.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/main-XLn3EZFh.css +11 -0
- package/node_modules/@weavecode/server/web/dist/assets/main-bsb0lQoL.js +1096 -0
- package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-D_Dp_Kl2.js → mermaid.core-C-wP0Zg2.js} +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-CM6OAd_-.js → mindmap-definition-6OY57UG3-Dk0VKqre.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/modulepreload-polyfill-B5Qt9EMX.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/pegDiagram-ECIUJNBX-Bp1K_F9z.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/pet-J6izA90s.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/pieDiagram-GNMPY74T-BZ4rGy3t.js +39 -0
- package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-D8pQ_PU2.js → quadrantDiagram-D57K4MC3-B4N5KRsR.js} +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/railroadDiagram-Y72NRBL7-C8nx8oHf.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-C90DU5Ny.js → requirementDiagram-EQYSW5RA-VSH57d0d.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-B_poYGgJ.js → sankeyDiagram-SY24JHO5-jUb1hcya.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-DDW7b2Dn.js → sequenceDiagram-BLEHNHQU-E2BioCNi.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/sizeCapture-INFHLROL-BdKrbRmI.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-CkVMAyxG.js → stateDiagram-v2-A6IESKWZ-tFz7uNM7.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/swimlanes-B3ENRKFQ-B9BAPDWw.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-DQ2NPLl9.js +8 -0
- package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-DnhkRGLb.js → timeline-definition-JXYKGLGB-CofNnFTK.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-_TdIjC6Z.js → usecaseDiagram-WPOLBNNX-DOvjhJjJ.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-FzgsymXB.js → vennDiagram-Q3Y3IDCW-BcFHWnhS.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-BwqimStC.js → wardleyDiagram-IVAIDKWA-Bz2aqRAs.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-CFjjVPIV.js → xychartDiagram-4URNHDU4-DpNF6Vsq.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/index.html +3 -2
- package/node_modules/@weavecode/server/web/dist/pet.html +130 -0
- package/node_modules/@weavecode/templates/dist/index.d.ts +2 -0
- package/node_modules/@weavecode/templates/dist/index.js +1 -1
- package/node_modules/@weavecode/templates/dist/resources/pets/weave-spider/pet.json +7 -0
- package/node_modules/@weavecode/templates/dist/resources/pets/weave-spider/spritesheet.png +0 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/.claude-plugin/marketplace.json +6 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-pet-hatcher/.claude-plugin/plugin.json +8 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-pet-hatcher/skills/weave-pet-hatcher/SKILL.md +121 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-pet-hatcher/skills/weave-pet-hatcher/scripts/assemble-pet.mjs +308 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-pet-hatcher/weave.json +4 -0
- package/node_modules/@weavecode/templates/package.json +2 -2
- package/package.json +11 -7
- package/scripts/preinstall.mjs +108 -0
- package/node_modules/@weavecode/server/web/dist/assets/abnfDiagram-WEYOIA3C-DDeQkTf5.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/architectureDiagram-ZHVYKT53-Dj54DE3O.js +0 -36
- package/node_modules/@weavecode/server/web/dist/assets/channel-5VM93AJ8.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-55XCU76K-CgEqeP7j.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-XXDRQBXY-BkG_e6PE.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-ZCHMQSOR-DxR-fxzs.js +0 -2
- package/node_modules/@weavecode/server/web/dist/assets/cose-bilkent-JH36ORCC-DThrA8S5.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/cynefinDiagram-WF24UDRP-DJjq2hfT.js +0 -62
- package/node_modules/@weavecode/server/web/dist/assets/dagre-NK4GIZVX-C2vH93HT.js +0 -4
- package/node_modules/@weavecode/server/web/dist/assets/diagram-CBK3MWTC-DrF_ScM-.js +0 -24
- package/node_modules/@weavecode/server/web/dist/assets/diagram-I5XIIV2D-D1qoUJ4t.js +0 -24
- package/node_modules/@weavecode/server/web/dist/assets/diagram-RJA3I4VV-DITY0Rd8.js +0 -41
- package/node_modules/@weavecode/server/web/dist/assets/ebnfDiagram-V4P3TTPT-DDylK-gz.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/ganttDiagram-R7GPNTJY-C0q-CS1T.js +0 -292
- package/node_modules/@weavecode/server/web/dist/assets/gitGraphDiagram-PDYL7XHY-BYTComiB.js +0 -106
- package/node_modules/@weavecode/server/web/dist/assets/index-BKxAxaVG.js +0 -1091
- package/node_modules/@weavecode/server/web/dist/assets/index-C0Sd4MH7.css +0 -11
- package/node_modules/@weavecode/server/web/dist/assets/infoDiagram-MVDRKAX5-DtixgjLP.js +0 -2
- package/node_modules/@weavecode/server/web/dist/assets/linear-DEo11t-X.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/pegDiagram-ECIUJNBX-_QkY0h8Q.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/pieDiagram-GNMPY74T-ZGr5vtDj.js +0 -39
- package/node_modules/@weavecode/server/web/dist/assets/railroadDiagram-Y72NRBL7-DUIo-WmA.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/sizeCapture-INFHLROL-CmKoqX6K.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/swimlanes-B3ENRKFQ-Dm_Omzky.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-Bjj8ZA4d.js +0 -8
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{cp as
|
|
2
|
-
`,"utf8")}async function
|
|
3
|
-
`,"utf8")}export async function searchPlugins(t){const{indexes:
|
|
1
|
+
import{cp as x,mkdir as p,readFile as E,readdir as P,rm as m,writeFile as j}from"node:fs/promises";import{existsSync as F,readdirSync as N,rmSync as O}from"node:fs";import s from"node:path";import{spawn as T}from"node:child_process";import{WEAVE_PLUGIN_MANIFEST as h,WeavePluginManifestSchema as I}from"@weavecode/core";import{getPluginsDir as J,getTmpDir as $}from"../db/paths.js";export function globalPluginRoot(){return J()}export function pruneInstallTmp(){const t=$();let e;try{e=N(t)}catch{return}for(const n of e)if(n.startsWith("install-"))try{O(s.join(t,n),{recursive:!0,force:!0})}catch{}}function A(t){return s.join(t??globalPluginRoot(),"installed.json")}async function D(t){try{const e=JSON.parse(await E(A(t),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}async function B(t,e){const n=e??globalPluginRoot();await p(n,{recursive:!0}),await j(A(e),JSON.stringify(t,null,2)+`
|
|
2
|
+
`,"utf8")}async function S(t){try{const e=JSON.parse(await E(s.join(t,h),"utf8"));return I.safeParse(e).success?e:null}catch{return null}}async function W(t){const e=[],n=await S(t);if(n)return[{dir:t,manifest:n}];let i;try{i=await P(t)}catch{return e}for(const u of i){const r=s.join(t,u),o=await S(r);o&&e.push({dir:r,manifest:o})}return e}function _(t,e,n,i=6e4){return new Promise((u,r)=>{const o=T(t,e,{cwd:n,windowsHide:!0,stdio:["ignore","pipe","pipe"]});let a="";const l=setTimeout(()=>{o.kill(),r(new Error(`${t} ${e.join(" ")} \u8D85\u65F6\uFF08${i}ms\uFF09`))},i);o.stderr?.on("data",c=>a+=c.toString()),o.on("error",c=>{clearTimeout(l),r(c)}),o.on("close",c=>{clearTimeout(l),c===0?u():r(new Error(`${t} \u9000\u51FA\u7801 ${c}: ${a.slice(0,500)}`))})})}export function isGitSource(t){return/^(https?:\/\/|git@|ssh:\/\/|git:\/\/)/.test(t)||t.endsWith(".git")}export async function installPlugin(t,e){const n=[];let i,u;if(isGitSource(t)){n.push(`\u4ECE ${t} \u5B89\u88C5\u7684\u63D2\u4EF6\u672A\u7ECF\u6C99\u7BB1\u9694\u79BB\uFF0C\u8BF7\u786E\u8BA4\u6765\u6E90\u53EF\u4FE1`);const r=s.join($(),`install-${Date.now()}`);await p(r,{recursive:!0}),await _("git",["clone","--depth","1",t,s.join(r,"repo")]),i=s.join(r,"repo"),u=()=>m(r,{recursive:!0,force:!0})}else if(i=s.resolve(t),!F(i))throw new Error(`\u672C\u5730\u8DEF\u5F84\u4E0D\u5B58\u5728: ${i}`);try{const r=await W(i);if(r.length===0)throw new Error(`\u672A\u627E\u5230 ${h}\uFF08src \u6216\u5176\u4E00\u7EA7\u5B50\u76EE\u5F55\uFF09`);const o=e?.root??globalPluginRoot();await p(o,{recursive:!0});const a=await D(e?.root),l=[];for(const{dir:c,manifest:y}of r){const f=String(y.id),g=s.join(o,f);s.resolve(g).startsWith(s.resolve(o)+s.sep)&&(await m(g,{recursive:!0,force:!0}),await x(c,g,{recursive:!0,filter:w=>!w.includes("node_modules")&&!w.includes(`${s.sep}.git`)}));const d={id:f,name:String(y.name??f),version:String(y.version??"0.0.0"),source:t,dir:f,installedAt:new Date().toISOString()},v=a.findIndex(w=>w.id===f);v>=0?a[v]=d:a.push(d),l.push({id:f,name:d.name,version:d.version,dir:f})}return await B(a,e?.root),{installed:l,warnings:n}}finally{u&&await u()}}export async function uninstallPlugin(t,e){const n=e?.root??globalPluginRoot(),i=await D(e?.root),u=i.find(o=>o.id===t),r=u?s.join(n,u.dir):s.join(n,t);return F(r)?(await m(r,{recursive:!0,force:!0}),u&&await B(i.filter(o=>o.id!==t),e?.root),!0):!1}export async function exportPlugin(t,e,n){const i=s.join(n?.root??globalPluginRoot(),t);if(!F(i))throw new Error(`\u63D2\u4EF6\u76EE\u5F55\u4E0D\u5B58\u5728: ${i}`);if(!await S(i))throw new Error(`\u63D2\u4EF6\u7F3A\u5C11\u5408\u6CD5 ${h}: ${t}`);const u=s.join(s.resolve(e),t);return await m(u,{recursive:!0,force:!0}),await x(i,u,{recursive:!0,filter:r=>!r.includes("node_modules")&&!r.includes(`${s.sep}.git`)}),u}function C(t){return s.join(t??globalPluginRoot(),"sources.json")}export function parseSources(t){if(Array.isArray(t))return{indexes:t.filter(e=>typeof e=="string")};if(t&&typeof t=="object"){const e=t.indexes;return{indexes:Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}}return{indexes:[]}}export async function readSourcesFile(t){try{return parseSources(JSON.parse(await E(C(t),"utf8")))}catch{return{indexes:[]}}}export async function writeSourcesFile(t,e){const n=e??globalPluginRoot();await p(n,{recursive:!0}),await j(C(e),JSON.stringify(t,null,2)+`
|
|
3
|
+
`,"utf8")}export async function searchPlugins(t){const{indexes:e}=await readSourcesFile(),n=[];for(const i of e)try{const u=await fetch(i,{signal:AbortSignal.timeout(1e4)});if(!u.ok)continue;const r=await u.json();for(const o of r.plugins??[]){const a=`${o.id} ${o.name} ${o.description??""}`.toLowerCase();(!t||a.includes(t.toLowerCase()))&&n.push(o)}}catch{}return n}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as j}from"node:fs";import{readFile as $,readdir as C}from"node:fs/promises";import d from"node:path";import{pathToFileURL as D}from"node:url";import{watch as P}from"chokidar";import{builtinRulesDir as W}from"../market/builtin.js";import{HARNESS_EVENT_UNION as I,HookRuleSchema as B,PluginRuleEntrySchema as T,WEAVE_PLUGIN_MANIFEST as A,WeavePluginManifestSchema as k}from"@weavecode/core";import{getDataRoot as O,getPluginsDir as M}from"../db/paths.js";import{marketLibraryRoots as N}from"../market/resolve.js";import{validateHandler as x}from"./registry.js";import{builtinToolkitRoot as H,discoverToolkitSources as U,discoverWeavePackDirs as L}from"./toolkit-scan.js";export function createPluginLogger(u){return{debug:e=>console.debug(`[plugin:${u}] ${e}`),info:e=>console.info(`[plugin:${u}] ${e}`),warn:e=>console.warn(`[plugin:${u}] ${e}`),error:e=>console.error(`[plugin:${u}] ${e}`)}}const R="@file:";function _(){return d.resolve(H())}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,n){const i=d.resolve(e);this.roots.set(i,{scope:s,projectId:n});let o;try{o=await C(i)}catch{return[]}const t=this.priorIdsUnder(i),c=[];for(const p of o){const l=d.join(i,p);if(this.roots.has(d.resolve(l))||d.resolve(l)===_())continue;const g=await this.loadOne(l,s,n,p);this.plugins.set(g.id,g),c.push(g)}return this.finalizeScan(t,c)}async loadToolkitRoot(e,s,n){const i=d.resolve(e);this.roots.set(i,{scope:s,projectId:n,deep:!0});const o=await L(i),t=this.priorIdsUnder(i),c=[];for(const p of o){await this.ensureToolkitDefaultDisabled(p);const l=await this.loadOne(p,s,n,d.basename(p));this.plugins.set(l.id,l),c.push(l)}return this.finalizeScan(t,c)}async ensureToolkitDefaultDisabled(e){try{const s=JSON.parse(await $(d.join(e,A),"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(n=>n!==e&&n.startsWith(e+d.sep));return new Set([...this.plugins.values()].filter(n=>n.dir.startsWith(e+d.sep)?!s.some(i=>n.dir.startsWith(i+d.sep)):!1).map(n=>n.id))}finalizeScan(e,s){const n=new Set(s.map(o=>o.id));let i=!1;for(const o of e)n.has(o)||(this.deps.rules.removeByPlugin(o),this.unloadHandlers(o),this.configs.delete(o),this.plugins.delete(o),i=!0,this.emitReload({pluginId:o,status:"rejected",ruleCount:0,removed:!0}));(i||s.length>0)&&this.deps.registry.load();for(const o of s)this.emitReload({pluginId:o.id,status:o.status,ruleCount:o.ruleCount,at:new Date().toISOString()});return s}watchRoots(e=1e3){if(this.watchStop)return this.watchStop;const s=new Map,n=[...this.roots.entries()].filter(([i])=>j(i)).map(([i,o])=>{const t=o.deep?6:o.projectId!==null?3:2,c=P(i,{ignoreInitial:!0,depth:t});return c.on("all",()=>{const p=s.get(i);p&&clearTimeout(p),s.set(i,setTimeout(()=>{s.delete(i);const l=this.roots.get(i);l&&(l.deep?this.loadToolkitRoot(i,l.scope,l.projectId):this.loadRoot(i,l.scope,l.projectId)).catch(()=>{})},e))}),c.on("error",()=>{}),c});return this.watchStop=()=>{for(const i of s.values())clearTimeout(i);s.clear();for(const i of n)i.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 n=this.plugins.get(e);if(!n)return!1;this.deps.states.setEnabled(e,s);for(const o of this.deps.rules.listByPlugin(e))this.deps.rules.setEnabled(o.id,s);this.deps.registry.load();const i=s?n.error?"rejected":"active":"disabled";return this.plugins.set(e,{...n,status:i}),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,n){for(const[i,o]of this.subscribers){if(!o.events.has(e))continue;const t=this.configs.get(i)??{};(async()=>{await o.sub.onEvent({eventType:e,payload:s,sessionId:n,config:t,logger:createPluginLogger(i)})})().catch(()=>{})}}emitReload(e){this.deps.bus?.emit({kind:"plugin.reloaded",at:new Date().toISOString(),...e})}async loadOne(e,s,n,i){const o=(r,a,h=i,y="0.0.0")=>{const v=this.plugins.get(r);return v&&v.dir===e&&(this.deps.rules.removeByPlugin(r),this.unloadHandlers(r),this.configs.delete(r)),{id:r,name:h,version:y,dir:e,scope:s,projectId:n,status:"rejected",error:a,ruleCount:0}};let t;try{const r=JSON.parse(await $(d.join(e,A),"utf8")),a=k.safeParse(r);if(!a.success)return o(i,`manifest \u6821\u9A8C\u5931\u8D25: ${a.error.issues[0]?.message??""}`);t=a.data}catch(r){return o(i,`manifest \u8BFB\u53D6\u5931\u8D25: ${r instanceof Error?r.message:String(r)}`)}if(s!=="builtin"&&t.id.startsWith("weave-"))return o(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 o(t.id,`\u91CD\u590D\u7684\u63D2\u4EF6 id\uFF08\u5DF2\u7531 ${c.dir} \u6CE8\u518C\uFF09`,t.name,t.version);const p=(t.requires?.events??[]).filter(r=>!I.includes(r));if(p.length>0)return o(t.id,`requires.events \u542B\u672A\u77E5\u4E8B\u4EF6: ${p.join(", ")}`,t.name,t.version);const l=[];for(const r of t.rules)try{const a=JSON.parse(await $(this.resolveWithin(e,r),"utf8"));if(!Array.isArray(a))throw new Error(`${r} \u4E0D\u662F\u6570\u7EC4`);l.push(...a)}catch(a){return o(t.id,`\u89C4\u5219\u6587\u4EF6 ${r}: ${a instanceof Error?a.message:String(a)}`,t.name,t.version)}const g=new Map;for(const r of t.handlers)try{const a=this.resolveWithin(e,r.entry),h=(await import(`${D(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`);g.set(`${t.id}:${r.type}`,h)}catch(a){return o(t.id,`handler ${r.type} \u52A0\u8F7D\u5931\u8D25: ${a instanceof Error?a.message:String(a)}`,t.name,t.version)}let F;if(t.subscribe){const r=t.subscribe.events.filter(a=>!I.includes(a));if(r.length>0)return o(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(`${D(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`);F={events:new Set(t.subscribe.events),sub:h}}catch(a){return o(t.id,`subscriber \u52A0\u8F7D\u5931\u8D25: ${a instanceof Error?a.message:String(a)}`,t.name,t.version)}}const S=[];for(let r=0;r<l.length;r++){const a=l[r],h=typeof a=="object"&&a!==null&&"handler"in a?{...a,handler:z(a.handler,t.id)}:a,y=T.safeParse(h);if(!y.success)return o(t.id,`\u89C4\u5219 #${r} \u6821\u9A8C\u5931\u8D25: ${y.error.issues[0]?.message??""}`,t.name,t.version);const v=y.data;let f=v.handler;if(f.type==="plugin"&&!g.has(`${t.id}:${f.handlerType}`))return o(t.id,`\u89C4\u5219 #${r} \u5F15\u7528\u672A\u58F0\u660E\u7684 handler "${f.handlerType}"`,t.name,t.version);if((f.type==="inject"||f.type==="manual")&&f.template.startsWith(R)){const w=f.template.slice(R.length);try{const b=await $(this.resolveWithin(e,w),"utf8");f={...f,template:b}}catch(b){return o(t.id,`\u89C4\u5219 #${r} \u6A21\u677F ${w}: ${b instanceof Error?b.message:String(b)}`,t.name,t.version)}}let E;try{E=B.parse({...v,handler:f,id:`plugin:${t.id}:${r}`,projectId:n,enabled:v.enabled??!0,priority:v.priority??0,origin:s==="builtin"?"builtin":"plugin",pluginId:t.id}),x(E.source,E.handler)}catch(w){return o(t.id,`\u89C4\u5219 #${r}: ${w instanceof Error?w.message:String(w)}`,t.name,t.version)}S.push(E)}const m=this.deps.states.get(t.id);try{for(const r of S)this.deps.rules.upsertPluginRule(r)}catch(r){return this.deps.rules.removeByPlugin(t.id),o(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 g)this.handlers.set(r,a);return this.configs.set(t.id,{...t.config??{},...m?.config??{}}),F&&!(m&&!m.enabled)&&this.subscribers.set(t.id,F),{id:t.id,name:t.name,version:t.version,dir:e,scope:s,projectId:n,status:m&&!m.enabled?"disabled":"active",ruleCount:S.length}}resolveWithin(e,s){const n=d.resolve(e),i=d.resolve(n,s);if(i!==n&&!i.startsWith(n+d.sep))throw new Error(`\u8DEF\u5F84\u8D8A\u51FA\u63D2\u4EF6\u76EE\u5F55: ${s}`);return i}}function z(u,e){if(typeof u!="object"||u===null)return u;const s=u;return s.type!=="plugin"||s.pluginId!==void 0?u:{...s,pluginId:e}}export async function registerPluginRoots(u,e,s){const n=[],i=U();if(e.libraries)for(const t of N(e.libraries))i.push({root:t,provenance:"market"});const o=new Set;for(const t of i){const c=d.resolve(t.root);o.has(c)||(o.add(c),n.push(...await u.loadToolkitRoot(t.root,t.provenance==="builtin"?"builtin":"user",null)))}n.push(...await u.loadRoot(W(O()),"builtin",null)),n.push(...await u.loadRoot(M(),"user",null));for(const t of s)n.push(...await u.loadRoot(d.join(t.path,".weave","plugins"),"project",t.id));return n}export async function loadAllPlugins(u,e){const s=new WeavePluginLoader(u),n=await registerPluginRoots(s,u,e);return{loader:s,loaded:n}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function pluginsStateOf(
|
|
1
|
+
export function pluginsStateOf(r){const t={syncedAt:null,enabled:{}};if(r==null)return t;try{const n=JSON.parse(r);if(!n||typeof n!="object"||Array.isArray(n))return t;const e=n.plugins;if(!e||typeof e!="object"||Array.isArray(e))return t;const o=e,c=o.enabled,s={};if(c&&typeof c=="object"&&!Array.isArray(c))for(const[l,a]of Object.entries(c))typeof a=="boolean"&&(s[l]=a);return{syncedAt:typeof o.syncedAt=="string"?o.syncedAt:null,enabled:s}}catch{return t}}export function effective(r,t,n){const e=pluginsStateOf(r.meta);return Object.hasOwn(e.enabled,t)?e.enabled[t]:e.syncedAt!==null?!1:n.states.get(t)?.enabled??n.defaultEnabled??!0}export function setProjectEnabled(r,t,n,e){const o=pluginsStateOf(r.meta);e.projects.setMeta(r.id,{plugins:{syncedAt:o.syncedAt,enabled:{...o.enabled,[t]:n}}})}export function syncPlugins(r,t,n){const e={...pluginsStateOf(r.meta).enabled};for(const c of t)Object.hasOwn(e,c)||(e[c]=!1);const o=n.now??new Date().toISOString();return n.projects.setMeta(r.id,{plugins:{syncedAt:o,enabled:e}}),o}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PROMPT_FLUSH_INTERVAL_MS=15e3;export function startPromptFlusher(
|
|
1
|
+
export const PROMPT_FLUSH_INTERVAL_MS=15e3;export function startPromptFlusher(e){const t=setInterval(()=>{e.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 y,renameSync as m,writeFileSync as h}from"node:fs";import{join as f}from"node:path";import{hookShardId as l}from"./mirror.js";export const PROMPTBOX_MAX_LINES=200;export function promptboxPathOf(n,r){return f(n,"promptbox",`${r}.jsonl`)}function d(n){const r=[];for(const s of n.split(`
|
|
2
|
+
`))if(s.trim())try{const t=JSON.parse(s);if(typeof t.id=="string"&&typeof t.sessionId=="string"&&typeof t.text=="string"){const e=t.images,c=(Array.isArray(t.attachments)?t.attachments:Array.isArray(e)?e:[]).filter(i=>{const o=i;return typeof o?.id=="string"&&typeof o?.name=="string"&&typeof o?.mediaType=="string"&&typeof o?.path=="string"});r.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 r}export function appendPromptbox(n,r,s){if(s.length!==0)try{const t=promptboxPathOf(n,l(r));g(f(n,"promptbox"),{recursive:!0});let e=[];try{e=u(t,"utf8").split(`
|
|
3
|
+
`).filter(a=>a.trim())}catch{e=[]}const c=new Date().toISOString();for(const a of s)e.push(JSON.stringify({...a,at:c}));const i=e.slice(-PROMPTBOX_MAX_LINES),o=`${t}.tmp`;h(o,i.length?i.join(`
|
|
4
4
|
`)+`
|
|
5
|
-
`:""),
|
|
6
|
-
`).filter(
|
|
5
|
+
`:""),m(o,t)}catch{}}export function readPromptbox(n,r){try{return d(u(promptboxPathOf(n,l(r)),"utf8"))}catch{return[]}}export function removePromptboxEntries(n,r,s){if(s.size!==0)try{const t=promptboxPathOf(n,l(r));let e;try{e=u(t,"utf8").split(`
|
|
6
|
+
`).filter(o=>o.trim())}catch{return}const c=e.filter(o=>{try{return!s.has(JSON.parse(o).id??"")}catch{return!1}}),i=`${t}.tmp`;h(i,c.length?c.join(`
|
|
7
7
|
`)+`
|
|
8
|
-
`:""),
|
|
9
|
-
`).filter(
|
|
8
|
+
`:""),m(i,t)}catch{}}export function readAllPromptbox(n){const r=f(n,"promptbox");let s;try{s=y(r)}catch{return[]}const t=[];for(const e of s)if(e.endsWith(".jsonl"))try{t.push(...d(u(f(r,e),"utf8")))}catch{continue}return t}export function scanQueuedSessionIds(n){return new Set(readAllPromptbox(n).map(r=>r.sessionId))}export function removePromptboxBySession(n,r){const s=f(n,"promptbox");let t;try{t=y(s)}catch{return 0}let e=0;for(const c of t){if(!c.endsWith(".jsonl"))continue;const i=f(s,c);let o;try{o=u(i,"utf8").split(`
|
|
9
|
+
`).filter(p=>p.trim())}catch{continue}const a=o.filter(p=>{try{return JSON.parse(p).sessionId!==r}catch{return!1}});if(a.length!==o.length){e+=o.length-a.length;try{const p=`${i}.tmp`;h(p,a.length?a.join(`
|
|
10
10
|
`)+`
|
|
11
|
-
`:""),
|
|
11
|
+
`:""),m(p,i)}catch{}}}return e}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{chmodSync as
|
|
2
|
-
`,{encoding:"utf8",mode:384}),d(
|
|
1
|
+
import{chmodSync as r,existsSync as c,mkdirSync as p,readFileSync as l,renameSync as d,writeFileSync as u}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(s){this.deps=s,this.vapid=m(s.keysPath??h()),s.bus.subscribe(t=>this.onBus(t))}publicKey(){return this.vapid.publicKey}onBus(s){const t=this.payloadFor(s);if(!t)return;const e=this.deps.subscriptions.list();e.length!==0&&this.pushAll(e,JSON.stringify(t))}payloadFor(s){return s.kind==="watch.fired"?s.watcherSessionId!==null?null:{title:"weave",body:`Session ${this.labelOf(s.targetSessionId)} ${f(s.reason)}`,tag:`weave-watch-${s.targetSessionId}`,url:"/"}:s.kind==="question.pending"?{title:"weave",body:`Session ${this.labelOf(s.sessionId)} is waiting for your answer`,tag:`weave-question-${s.sessionId}`,url:"/"}:null}labelOf(s){return this.deps.sessions.getBySessionId(s)?.title??s.slice(0,8)}async pushAll(s,t){for(const e of s)try{await(this.deps.send??b)(e,t,this.vapid)}catch(o){const a=o.statusCode;(a===404||a===410)&&this.deps.subscriptions.deleteByEndpoint(e.endpoint)}}}async function b(i,s,t){n.setVapidDetails("mailto:weave@localhost",t.publicKey,t.privateKey),await n.sendNotification({endpoint:i.endpoint,keys:{p256dh:i.p256dh,auth:i.auth}},s,{TTL:3600})}function m(i){if(c(i))try{const e=JSON.parse(l(i,"utf8"));if(typeof e.publicKey=="string"&&e.publicKey&&typeof e.privateKey=="string"&&e.privateKey)return{publicKey:e.publicKey,privateKey:e.privateKey}}catch{}const s=n.generateVAPIDKeys();p(y.dirname(i),{recursive:!0});const t=`${i}.tmp`;u(t,`${JSON.stringify(s,null,2)}
|
|
2
|
+
`,{encoding:"utf8",mode:384}),d(t,i);try{r(i,384)}catch{}return s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isHarness as
|
|
1
|
+
import{isHarness as h}from"@weavecode/core";import{permissionModeOf as c}from"@weavecode/harness";import{blockingPromptFor as f}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 h(e)?this.deps.surfaceFor?.(e)??f(e):null}onEvent(e){const s=e.payload;if(!s)return;const n=this.specOf(e.source);if(!n)return;const t=e.sessionId,i=typeof s.toolName=="string"?s.toolName:null,d=c(s.raw);if(d&&this.permissionMode.set(t,d),s.eventType==="PreToolUse"){if(i&&this.lastPreTool.set(t,{toolName:i,toolInput:s.toolInput}),i&&n.blockingTools.includes(i)){const l=this.pending.get(t),r={sessionId:t,harness:this.harnessOf(e.source),kind:"question",questions:n.parseQuestions(i,s.toolInput),at:new Date().toISOString()};this.pending.set(t,r),!this.seeding&&l?.kind!=="question"&&this.deps.onPending?.(r)}return}if(s.eventType==="Notification"){if(n.permissionNotificationType&&I(s.raw)===n.permissionNotificationType){const l=this.permissionMode.get(t);if(l!=null&&n.silentPermissionModes.includes(l))return;const r=this.lastPreTool.get(t);if(this.pending.get(t)?.kind==="question"&&r!=null&&n.blockingTools.includes(r.toolName))return;const a=this.lastPreTool.get(t)??{toolName:null,toolInput:null};this.pending.set(t,{sessionId:t,harness:this.harnessOf(e.source),kind:"permission",questions:[n.permissionQuestion({...a,message:m(s.raw),permissionMode:l??null})],at:new Date().toISOString()})}return}const p=n.eventQuestion(s.eventType,{raw:s.raw,toolName:i,toolInput:s.toolInput});if(p){const l=this.pending.get(t),r={sessionId:t,harness:this.harnessOf(e.source),kind:"switch",questions:[p],at:new Date().toISOString()};this.pending.set(t,r),!this.seeding&&l?.kind!=="switch"&&this.deps.onPending?.(r);return}const u=this.pending.get(t);if(u){if(u.kind!=="question"){this.pending.delete(t),this.lastPreTool.delete(t);return}(s.eventType==="PostToolUse"&&i!=null&&n.blockingTools.includes(i)||s.eventType==="UserPromptSubmit"||s.eventType==="Stop")&&(this.pending.delete(t),this.lastPreTool.delete(t))}}seedFromDb(){this.seeding=!0;try{for(const e of this.deps.sessions.list())for(const s of this.deps.hookEvents.listBySession(e.sessionId,g)){let n=null;try{n=JSON.parse(s.payload)}catch{n=null}this.onEvent({sessionId:e.sessionId,source:s.source,payload:n})}}finally{this.seeding=!1}}snapshot(){return[...this.pending.values()].filter(e=>!this.dropIfInterrupted(e)).sort((e,s)=>e.at<s.at?1:-1)}get(e){const s=this.pending.get(e);return s?this.dropIfInterrupted(s)?null:s: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 I(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 a,hookSourceHarness as c,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(t=>({...t,source:s(t.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=c(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=a[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 a}from"@weavecode/harness";import{HeadlessRunner as o}from"./headless-runner.js";export class ResumeRunner{deps;headless;claudeBin;resumeSpec;timeoutMs;constructor(s){this.deps=s,this.headless=s.headless??new o({spawnImpl:s.spawnImpl,killImpl:s.killImpl}),this.resumeSpec=s.resumeSpec??a,this.claudeBin=s.claudeBin??process.env.WEAVE_CLAUDE_BIN??this.resumeSpec.bin,this.timeoutMs=s.timeoutMs}async run(s,e){const t=this.deps.dispatches.getById(s);if(!t)return{ok:!1,status:404,error:"Dispatch not found"};if(t.status!=="pending"&&t.status!=="injected")return{ok:!1,status:409,error:`Dispatch is ${t.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 u=this.deps.projects.getById(r.projectId);if(!u)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 n={settled:!1};try{this.deps.dispatches.updateStatus(s,{status:"running"}),this.deps.bus?.emit({kind:"dispatch.started",ruleId:t.ruleId,dispatchId:s,sessionId:e,at:new Date().toISOString()}),this.headless.run({sessionId:e,cwd:u.path,prompt:t.prompt,spec:this.resumeSpec,bin:this.claudeBin,timeoutMs:this.timeoutMs,onSettle:i=>this.settle(t,e,n,i)})||this.settle(t,e,n,{status:"failed",output:null,error:"Session already has a running dispatch"})}catch(i){this.settle(t,e,n,{status:"failed",output:null,error:i instanceof Error?i.message:String(i)})}return{ok:!0,dispatchId:s}}settle(s,e,t,r){if(!t.settled){t.settled=!0;try{this.deps.dispatches.updateStatus(s.id,{status:r.status,output:r.output,error:r.error,finished:!0}),this.deps.bus?.emit({kind:"dispatch.finished",ruleId:s.ruleId,dispatchId:s.id,status:r.status,sessionId:e,at:new Date().toISOString()})}catch{}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function purgeSession(e,
|
|
1
|
+
export function purgeSession(e,s){const n=e.events.deleteBySession(s);e.uploads?.pruneUnreferenced();const o=e.dispatches?.deleteBySession(s)??0,t=e.deliverer?.forgetSession(s)??0;return e.watches?.deleteBySession(s),e.orchestrations?.deleteMentioningSession(s),e.questions?.forgetSession(s),e.sideQuestions?.deleteBySession(s),e.probe?.forget(s),e.sessions.remove(s),{events:n,dispatches:o,messages:t}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isHarness as
|
|
1
|
+
import{isHarness as S}from"@weavecode/core";import{messagingSurfaceFor as I}from"../surfaces.js";export const SIDE_ANSWER_WINDOW_MS=10*6e4,SIDE_SETTLE_WINDOW_MS=3e4;const c=/\p{Script=Han}/u;function l(t){const e=t.toLowerCase().replace(/\s+/g,""),s=new Set;for(let n=0;n<e.length-1;n++)s.add(e.slice(n,n+2));return s}function g(t,e){const s=l(t),n=l(e);if(s.size===0||n.size===0)return 0;let r=0;for(const o of s)n.has(o)&&r++;return 2*r/(s.size+n.size)}export function answerScore(t,e){let s=0;return c.test(t)===c.test(e)&&(s+=2),e.length>=120&&(s+=1),g(t,e)>=.15&&(s+=1),s}const w=new Map;function f(t,e,s){const n=w.get(e.id);n&&clearTimeout(n),setTimeout(()=>{w.delete(e.id);const r=t.repo.getById(e.id);r?.status==="answered"&&r.answerEventId===e.answerEventId&&t.settle?.(r)},Math.max(0,s+SIDE_SETTLE_WINDOW_MS-(t.now?.()??Date.now()))).unref?.()}export function claimSideAnswer(t,e){if(!S(e.source))return null;const s=(t.surfaceFor?.(e.source)??I(e.source)).sideQuestion?.answerOf(e.eventType,e.payload);if(!s)return null;const n=t.now?.()??Date.now(),r=new Date(n-SIDE_ANSWER_WINDOW_MS).toISOString(),o=t.repo.claim(e.sessionId,s,e.eventId,r);if(o)return p(t,o),f(t,o,n),o;const u=new Date(n-SIDE_SETTLE_WINDOW_MS).toISOString(),i=t.repo.list(e.sessionId,{limit:5}).find(d=>d.status==="answered"&&(d.answeredAt??"")>=u);if(!i||i.answer==null||answerScore(i.question,s)<=answerScore(i.question,i.answer))return null;const a=t.repo.supersede(i.id,s,e.eventId,u);return a?(p(t,a),f(t,a,n),a):null}function p(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,s){return t.repo.expirePending(new Date((t.now?.()??Date.now())-SIDE_ANSWER_WINDOW_MS).toISOString()),t.repo.list(e,s)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID as
|
|
1
|
+
import{randomUUID as r}from"node:crypto";const o=30*6e4,n=new Map;export function registerSyntheticSession(e=`sx-${r()}`){return n.set(e,Date.now()+o),e}export function isSyntheticSession(e){if(!e)return!1;const t=n.get(e);return t===void 0?!1:t<Date.now()?(n.delete(e),!1):!0}export function syntheticSessionIds(){return[...n.keys()]}export function replaceSyntheticSessions(e){n.clear();for(const t of e)n.set(t,Date.now()+o)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as
|
|
1
|
+
import{readFile as M,readdir as d,stat as y}from"node:fs/promises";import a from"node:path";import{WEAVE_PLUGIN_MANIFEST as w,WeavePluginManifestSchema as I,HARNESS_KEYS as G}from"@weavecode/core";import{builtinPacksDir as J}from"../market/builtin.js";import{getDataRoot as K}from"../db/paths.js";import{hasNonEmptyModules as P}from"../watch/plugin-mods.js";const T=".claude-plugin",D="plugin.json",L="weave.json",A=2,O=10,F=["claude"];export function builtinToolkitRoot(){return a.resolve(J(K()))}async function k(n){try{return(await y(n)).isDirectory()}catch{return!1}}async function m(n){try{const t=JSON.parse(await M(n,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}export async function isToolkitPackDir(n){return await S(n)?!0:await k(a.join(n,"skills"))||await k(a.join(n,"commands"))||await k(a.join(n,"agents"))}async function S(n){if(await m(a.join(n,T,D)))return!0;try{return await y(a.join(n,w)),!0}catch{}return P(await m(a.join(n,"hooks","hooks.json")))}async function V(n){try{return(await d(n,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort()}catch{return[]}}async function b(n){try{return(await d(n,{withFileTypes:!0})).filter(t=>t.isFile()&&t.name.endsWith(".md")).map(t=>t.name.replace(/\.md$/,"")).sort()}catch{return[]}}function C(n){if(!Array.isArray(n)||n.length===0)return F;const t=n.filter(c=>G.includes(c));return t.length>0?t:F}export async function parseToolkitPack(n,t,c){const e=a.basename(n),i=await m(a.join(n,T,D)),r=await m(a.join(n,w)),o=await m(a.join(n,L)),p=await V(a.join(n,"skills")),s=await b(a.join(n,"commands")),E=await b(a.join(n,"agents")),f=await m(a.join(n,"hooks","hooks.json")),j=P(f),v=!!f&&typeof f.hooks=="object"&&f.hooks!==null,u=[];if(p.length>0&&u.push("skill"),s.length>0&&u.push("command"),E.length>0&&u.push("agent"),j?u.push("mod"):v&&u.push("hook"),r&&u.push("rule"),u.length===0)return null;const h=typeof o?.kind=="string"?o.kind:null,N=h&&["skill","hook","mod","rule","surface"].includes(h)?h:j?"mod":v?"hook":r&&!i?"rule":p.length>0?"skill":"surface",l=r?I.safeParse(r):null,W=l?.success?l.data.id:e,R=(typeof i?.name=="string"?i.name:void 0)??(l?.success?l.data.name:void 0)??e,_=(l?.success?l.data.version:void 0)??(typeof i?.version=="string"?i.version:void 0)??"0.0.0",g=(typeof i?.description=="string"?i.description:void 0)??(l?.success?l.data.description:void 0);return{id:W,name:R,version:_,...g?{description:g}:{},scope:c,dir:n,provenance:t.provenance,sourceRoot:t.root,targets:C(o?.targets),kind:N,components:u,ccPack:!!i,weavePack:!!r,skills:p}}function x(n){return n==="node_modules"||n.startsWith(".")}export async function discoverToolkitPacks(n){const t=n.provenance==="market",c=t?O:A,e=async(i,r,o)=>{if(await isToolkitPackDir(i)&&!(r===0&&t&&!await S(i))){const s=await parseToolkitPack(i,n,o);return s?[s]:[]}if(r>=c)return[];let p;try{p=await d(i,{withFileTypes:!0})}catch{return[]}return(await Promise.all(p.filter(s=>s.isDirectory()&&!x(s.name)).map(s=>e(a.join(i,s.name),r+1,r===0?s.name:o)))).flat()};return e(n.root,0,"")}export function discoverToolkitSources(){return[{root:builtinToolkitRoot(),provenance:"builtin"}]}export async function discoverWeavePackDirs(n){const t=[],c=async(e,i)=>{try{await y(a.join(e,w)),t.push(e);return}catch{}if(i>=A)return;let r;try{r=await d(e,{withFileTypes:!0})}catch{return}for(const o of r)!o.isDirectory()||x(o.name)||await c(a.join(e,o.name),i+1)};return await c(n,0),t}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{cp as
|
|
2
|
-
`,"utf8")):
|
|
3
|
-
`)!==
|
|
4
|
-
`)&&this.deps.projects.setMeta(t.id,{toolkit:{enabled:o}})}pluginSurface(){return this.deps.pluginSurface
|
|
5
|
-
`,"utf8"),
|
|
1
|
+
import{cp as D,mkdir as b,readFile as I,readdir as h,rm as w,writeFile as x}from"node:fs/promises";import{spawn as P}from"node:child_process";import{homedir as M}from"node:os";import c from"node:path";import{hashFile as g}from"../install/fingerprint.js";import{fileAssetTargetDir as H}from"../install/file-assets.js";import{assetSurfaceFor as $,pluginSurfaceFor as q}from"../surfaces.js";import{marketLibraryRoots as A}from"../market/resolve.js";import{marketIdOf as m}from"../market/identity.js";import{installPluginPack as N}from"../install/plugin-install.js";import{effective as _,setProjectEnabled as O}from"./plugin-project-state.js";import{builtinToolkitRoot as L,discoverToolkitPacks as V}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 K=1e4;export function isVersionAtLeast(r,t){const e=r.split(".").map(a=>Number.parseInt(a,10));for(let a=0;a<t.length;a++){const s=Number.isFinite(e[a])?e[a]:0;if(s>t[a])return!0;if(s<t[a])return!1}return!0}let y;function W(r){if(!(r.exitCode!==null||r.signalCode!==null)){if(process.platform==="win32"&&r.pid!==void 0){P("taskkill",["/pid",String(r.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref();return}r.kill("SIGKILL")}}export async function detectClaudeVersion(){if(y&&Date.now()-y.at<6e5)return y.value;const r=await new Promise(t=>{let e="";const a=process.platform==="win32"?P("claude --version",{windowsHide:!0,shell:!0,stdio:["ignore","pipe","pipe"]}):P("claude",["--version"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),s=setTimeout(()=>{W(a),t(null)},5e3);a.stdout?.on("data",i=>e+=i.toString()),a.on("error",()=>{clearTimeout(s),t(null)}),a.on("close",()=>{clearTimeout(s);const i=/(\d+\.\d+\.\d+)/.exec(e);t(i?i[1]:null)})});return r!==null&&(y={value:r,at:Date.now()}),r}async function S(r,t,e){let a;try{a=await h(c.join(r,...t.split("/").filter(Boolean)),{withFileTypes:!0})}catch{return}for(const s of a){if(s.name==="node_modules"||s.name===".git")continue;const i=t?`${t}/${s.name}`:s.name;s.isDirectory()?await S(r,i,e):e.push({rel:i,abs:c.join(r,...i.split("/"))})}}const f=r=>r.ccPack||r.kind==="mod";async function R(r,t){const e=[];if(t.skills.length>0)for(const a of t.targets){if(a==="claude"&&f(t))continue;const s=$(a).projectSkillsRoots()[0];for(const i of t.skills){const o=[];await S(c.join(t.dir,"skills",i),"",o);for(const n of o)e.push({src:n.abs,rel:`${s}/${i}/${n.rel}`})}}if(!f(t))for(const a of t.targets)for(const[s,i]of[["commands","command"],["agents","agent"]]){const o=c.join(t.dir,s),n=[];if(await S(o,"",n),n.length===0)continue;const l=J(i,a,r);if(l)for(const u of n){const k=u.rel.split("/").pop();e.push({src:u.abs,rel:j(c.relative(r,c.join(l,k)))})}}return e}function J(r,t,e){try{return H(r,t,"project",e,M())}catch{return null}}function j(r){return r.split(c.sep).join("/")}function C(r,t){return c.join(r,".weave","toolkit",`${t}.json`)}async function v(r){try{const t=JSON.parse(await I(r,"utf8"));return t&&typeof t=="object"&&typeof t.packId=="string"?t:null}catch{return null}}export async function projectFileNamespaces(r){const t=new Map,e=c.join(r,".weave","toolkit");let a;try{a=await h(e)}catch{return t}for(const s of a){if(!s.endsWith(".json"))continue;const i=await v(c.join(e,s)),o=i?m(i.sourceDir):void 0;if(!(!i||!o))for(const n of Object.keys(i.files))t.set(n,o)}return t}export async function projectPackFiles(r){const t=new Map,e=c.join(r,".weave","toolkit");let a;try{a=await h(e)}catch{return t}for(const s of a){if(!s.endsWith(".json"))continue;const i=await v(c.join(e,s));if(i)for(const[o,n]of Object.entries(i.files))typeof n=="string"&&t.set(o,n)}return t}async function T(r){try{return await I(r),!0}catch{return!1}}async function B(r,t){const e=new Set;for(const s of t){let i=c.posix.dirname(s);for(;i&&i!=="."&&i!=="/";)e.add(i),i=c.posix.dirname(i)}const a=[...e].sort((s,i)=>i.split("/").length-s.split("/").length);for(const s of a){const i=c.join(r,...s.split("/"));try{(await h(i)).length===0&&await w(i,{recursive:!0,force:!0})}catch{}}}export function evaluateModHostGate(r){return process.env.WEAVE_SKIP_MOD_VERSION_CHECK==="1"?{ok:!0}:r?isVersionAtLeast(r,MIN_MOD_HOST_VERSION)?{ok:!0}:{ok:!1,message:`\u5BBF\u4E3B Claude Code ${r} \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 t=[{root:this.deps.builtinRoot??L(),provenance:"builtin"}];if(this.deps.libraries)for(const a of A(this.deps.libraries))t.push({root:a,provenance:"market"});const e=new Set;return t.filter(a=>{const s=c.resolve(a.root);return e.has(s)?!1:(e.add(s),!0)})}async allPacks(){const t=this.sources(),e=t.map(n=>c.resolve(n.root)).join("|"),a=Date.now(),s=this.packsCache;if(s&&s.key===e&&a-s.at<K)return s.packs;const i=Promise.all(t.map(n=>V(n))).then(n=>n.flat()),o={at:a,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),a=await this.allPacks(),s=await Promise.all(a.map(i=>this.packInfo(e,i)));return await this.healMeta(e,s),{packs:s,legacyCopies:await this.scanLegacyCopies(e)}}async enable(t,e,a){const s=this.requireProject(t),i=await this.resolvePack(e,a),o=[];if(i.kind==="mod"&&i.targets.includes("claude")){const d=this.deps.claudeVersion??detectClaudeVersion,p=evaluateModHostGate(await d());if(!p.ok)throw new ToolkitError(p.message??"mod host gate","host-version");p.warning&&o.push(p.warning)}const n=s.path;if(f(i)&&i.targets.includes("claude")){const d=this.pluginSurface();await N(d,i),await d.setProjectEnabled(n,i.name,!0,m(i.dir))}const l=C(n,i.id),u=await this.readRecordHealed(n,i.id),k=u??{packId:i.id,provenance:i.provenance,sourceRoot:i.sourceRoot,sourceDir:i.dir,enabledAt:new Date().toISOString(),files:{}};let E=u===null;const F=await R(n,i);for(const d of F){const p=c.join(n,...d.rel.split("/"));if(k.files[d.rel]!==void 0){await T(p)||(await b(c.dirname(p),{recursive:!0}),await D(d.src,p));continue}await g(p)==="missing"&&(await b(c.dirname(p),{recursive:!0}),await D(d.src,p),k.files[d.rel]=await g(d.src),E=!0)}return F.length>0?E&&(await b(c.dirname(l),{recursive:!0}),await x(l,JSON.stringify(k,null,2)+`
|
|
2
|
+
`,"utf8")):u&&await w(l,{force:!0}),i.weavePack&&O(s,i.id,!0,{projects:this.deps.projects}),this.rememberEnabled(s,i.id,!0),{pack:await this.packInfo(this.requireProject(t),i),warnings:o}}async disable(t,e,a){const s=this.requireProject(t),i=await this.resolvePack(e,a);return await this.applyDisabled(s,i),{pack:await this.packInfo(this.requireProject(t),i),warnings:[]}}async applyDisabled(t,e){await this.removePackFiles(t,e,e.sourceRoot),f(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,a){const s=this.requireProject(t),i=await this.resolvePack(e,a);return await this.applyDisabled(s,i),f(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,a){const s=C(t.path,e.id),i=await v(s);if(!i||a&&c.resolve(i.sourceRoot)!==c.resolve(a))return;const o=[];for(const[n,l]of Object.entries(i.files)){const u=c.join(t.path,...n.split("/"));await g(u)===l&&(await w(u,{force:!0}),o.push(n))}await w(s,{force:!0}),await B(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 a=(await this.allPacks()).filter(i=>i.id===t);if(e){const i=a.find(o=>c.resolve(o.sourceRoot)===c.resolve(e));if(i)return i}const s=a.find(i=>i.provenance==="builtin")??a[0];if(!s)throw new ToolkitError(`Toolkit pack not found: ${t}`,"not-found");return s}async computeEnabled(t,e){const a=[],s=await this.readRecordHealed(t.path,e.id);if((await R(t.path,e)).length>0){let i=!!s;if(s){for(const o of Object.keys(s.files))if(!await T(c.join(t.path,...o.split("/")))){i=!1;break}}a.push(i)}if(f(e)&&e.targets.includes("claude")){const i=this.pluginSurface(),o=m(e.dir);a.push(await i.isInstalled(e.name,o)&&await i.readProjectEnabled(t.path,e.name,o))}return e.weavePack&&a.push(_(t,e.id,{states:this.deps.states,defaultEnabled:!1})),a.length>0?a.every(Boolean):!1}async installedScopes(t){const e=(await this.pluginSurface().readInstalled())[t];return!e||e.length===0?void 0:[...new Set(e.map(a=>a.scope??"user"))]}async packInfo(t,e){const a=await this.computeEnabled(t,e),s=m(e.dir),i=f(e)&&e.targets.includes("claude")?this.pluginSurface().pluginKey(e.name,s):void 0,o=i?await this.installedScopes(i):void 0,n={...e,...s?{namespace:s}:{},enabled:a,installed:await this.computeInstalled(t,e,a),...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&&(n.weave={status:l.status,ruleCount:l.ruleCount,...l.error?{error:l.error}:{}})}return n}async computeInstalled(t,e,a){return e.weavePack&&!f(e)?!0:f(e)&&e.targets.includes("claude")?this.pluginSurface().isInstalled(e.name,m(e.dir)):a||!!await this.readRecordHealed(t.path,e.id)}enabledIndex(t){const e=this.deps.projects.getMeta(t.id)?.toolkit,a=e&&typeof e=="object"?e.enabled:void 0;return Array.isArray(a)?a.filter(s=>typeof s=="string"):[]}rememberEnabled(t,e,a){const s=new Set(this.enabledIndex(t));a?s.add(e):s.delete(e),this.deps.projects.setMeta(t.id,{toolkit:{enabled:[...s].sort()}})}async healMeta(t,e){const a=[...new Set(e.filter(n=>n.enabled).map(n=>n.id))].sort(),s=[...new Set(this.enabledIndex(t))].sort(),i=new Set(e.map(n=>n.id)),o=[...new Set([...s.filter(n=>!i.has(n)),...a])].sort();o.join(`
|
|
3
|
+
`)!==s.join(`
|
|
4
|
+
`)&&this.deps.projects.setMeta(t.id,{toolkit:{enabled:o}})}pluginSurface(){return this.deps.pluginSurface??q("claude")}async readRecordHealed(t,e){const a=C(t,e),s=await v(a);if(!s)return null;const i=j(c.relative(t,this.pluginSurface().projectPluginDir(t))),o=Object.keys(s.files).filter(l=>l.startsWith(`${i}/`));if(o.length===0)return s;const n=[];for(const l of o){const u=c.join(t,...l.split("/"));await g(u)===s.files[l]&&(await w(u,{force:!0}),n.push(l)),delete s.files[l]}return await B(t,n),await x(a,JSON.stringify(s,null,2)+`
|
|
5
|
+
`,"utf8"),s}async scanLegacyCopies(t){const e=this.pluginSurface().projectPluginDir(t.path);let a;try{a=await h(e,{withFileTypes:!0})}catch{return[]}return a.map(s=>j(c.relative(t.path,c.join(e,s.name)))).sort()}async cleanupLegacyCopies(t){const e=this.requireProject(t),a=this.pluginSurface().projectPluginDir(e.path);let s;try{s=await h(a,{withFileTypes:!0})}catch{return{removed:[]}}const i=[];for(const o of s){const n=c.join(a,o.name);await w(n,{recursive:!0,force:!0}),i.push(j(c.relative(e.path,n)))}try{(await h(a)).length===0&&await w(a,{recursive:!0,force:!0})}catch{}return{removed:i.sort()}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HARNESS_LIFECYCLE as o}from"@weavecode/core";import{messagingSurfaceFor as
|
|
1
|
+
import{HARNESS_LIFECYCLE as o}from"@weavecode/core";import{messagingSurfaceFor as a}from"../surfaces.js";import{pidAliveOf as c}from"../daemon/claude-liveness.js";import{combinedLivenessOf as l}from"../daemon/liveness.js";const u=1e3;export class WatchEngine{deps;lastHitAt=new Map;constructor(e){this.deps=e,e.bus.subscribe(s=>this.onBus(s))}onEvent(e){try{const s=(this.deps.surfaceFor?.(e.source)??a(e.source)).idleSignals.includes(e.eventType),i=o[e.source].close.includes(e.eventType);if(!s&&!i)return;for(const t of this.deps.watches.listPendingByTarget(e.sessionId))i&&t.onEvents.includes("turnEnd")?this.fire(t,"turnEnd"):s&&t.onEvents.includes("idle")&&this.fire(t,"idle")}catch{}}onBus(e){if(e.kind==="message.finished"&&!(e.status!=="failed"&&e.status!=="timeout"))try{for(const s of this.deps.watches.listPendingByTarget(e.sessionId))s.onEvents.includes("messageFailed")&&this.fire(s,"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(),s=new Map(this.deps.sessions.listWithCounts().map(t=>[t.sessionId,t]));let i=0;for(const t of this.deps.watches.listPending()){if(t.remaining===null||!t.onEvents.includes("idle")&&!t.onEvents.includes("turnEnd"))continue;const n=s.get(t.targetSessionId);n&&c(n,e)!==!1||this.fire(t,"idle")&&i++}return i}catch{return 0}}fire(e,s){const i=Date.now(),t=this.lastHitAt.get(e.id);if(t!==void 0&&i-t<u)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 r=new Date(i).toISOString();return this.deps.bus.emit({kind:"watch.fired",watchId:e.id,targetSessionId:e.targetSessionId,watcherSessionId:e.watcherSessionId,reason:s,at:r}),e.watcherSessionId==null||this.deps.deliverer.send({toSessionId:e.watcherSessionId,text:e.notify??this.defaultNotify(e.targetSessionId,s),fromKind:"session",fromSessionId:e.targetSessionId,mode:"inject"}).catch(()=>{}),!0}defaultNotify(e,s){return`Session ${this.deps.sessions.getBySessionId(e)?.title??e.slice(0,8)} ${watchReasonPhrase(s)} (trigger=watch:${e})`}}export function watchReasonPhrase(d){return d==="messageFailed"?"had a failed message delivery":d==="turnEnd"?"finished its turn":"is now idle"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* surface.
|
|
7
7
|
*/
|
|
8
8
|
export { openDatabase } from './db/db.js';
|
|
9
|
-
export { getDataDir, getDbPath, getDaemonStatePath, getAuthPath, getInitialPasswordPath } from './db/paths.js';
|
|
9
|
+
export { getDataDir, getDbPath, getDaemonStatePath, getAuthPath, getInitialPasswordPath, getVisualizationsDir, } from './db/paths.js';
|
|
10
10
|
export { ensureDataLayout, migrateDataLayout } from './db/layout.js';
|
|
11
11
|
export type { LayoutMigration } from './db/layout.js';
|
|
12
12
|
export { ProjectRepository } from './repositories/projects.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{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
|
+
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,getVisualizationsDir}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 g,cp as y,mkdir as d}from"node:fs/promises";import{homedir as p}from"node:os";import f from"node:path";import{applyStatuslineConfig as w}from"../statusline/manager.js";import{readStatuslineConfig as S}from"../statusline/manager.js";import{buildLibraryIndex as l,findSkillSource as h,findMcpSource as k,findFileAssetSource as b}from"./library-index.js";import{detectUpdates as j}from"./updates.js";import{materializePluginTemplate as E}from"./plugin-templates.js";import{applyInitFile as F}from"./init-files.js";import{FILE_ASSET_SPECS as $,fileAssetTargetDir as x,isFileAssetCategory as A}from"./file-assets.js";import{assetSurfaceFor as u}from"../surfaces.js";export async function applyUpdate(t,o,m,n){const s=m??(n?await l(n):await l([])),a=o.agent??"claude";if(o.category==="skill"){const e=h(s,o.name);if(!e)throw new Error(`No library source for skill "${o.name}"`);const c=o.scope==="user"?u(a).globalSkillsRoots(p())[0]:f.join(t,...u(a).projectSkillsRoots()[0].split("/")),i=f.join(c,o.name);await g(i,{recursive:!0,force:!0}),await y(e.dirPath,i,{recursive:!0});return}if(A(o.category)){const e=b(s,o.category,o.name);if(!e)throw new Error(`No library source for ${o.category} "${o.name}"`);const c=x(o.category,a,o.scope,t,p());await d(c,{recursive:!0});const i=f.join(c,`${o.name}${$[o.category].ext}`);await g(i,{force:!0}),await y(e.filePath,i);return}const r=k(s,o.name);if(!r)throw new Error(`No library source for MCP "${o.name}"`);await u(a).mcpWrite(o.scope,t,p(),o.name,r.config)}export async function syncAll(t,o,m,n){const s=n??await l(o),a=await j(t,o,m,s),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},s),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},s),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},s),r.push({category:e.category,name:e.name,scope:e.scope}));for(const e of a.pluginTemplates)e.outdated&&(await E(e),r.push({category:e.category,name:e.name,scope:"project"}));for(const e of a.initFiles)await F(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 i,configSurfaces as j,statuslineSurfaces as E}from"../surfaces.js";function u(o,c){return p.join("~",p.relative(c,o)).split(p.sep).join("/")}export function installCapabilities(){const o=m(),c={};for(const s of S){const e=h[s].dirs,r=[];for(const t of l){const n=e[t];if(!n)continue;const a=[];n.project&&a.push("project"),n.user&&a.push("user"),a.length>0&&r.push({harness:t,scopes:a})}c[s]={surfaces:r}}c.skill={surfaces:i().map(s=>{const e=[],r={},t=s.projectSkillsRoots()[0];t&&(e.push("project"),r.project=t);const n=s.globalSkillsRoots(o)[0];return n&&(e.push("user"),r.user=u(n,o)),{harness:s.harness,scopes:e,dest:r}})},c.mcp={surfaces:i().map(s=>{const e={},r=s.mcpDest("project",o),t=s.mcpDest("user",o);return r&&(e.project=r),t&&(e.user=u(t,o)),{harness:s.harness,scopes:s.mcpScopes(),dest:e}}).filter(s=>s.scopes.length>0)};const f=E().map(({harness:s,surface:e})=>({harness:s,tui:e.tui,segments:[...e.segments]}));return{categories:c,statusline:f,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 n}from"../surfaces.js";import{codexMcpExists as p,readCodexMcpServers as x,removeCodexMcpServer as c,writeCodexMcpServer as d}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 n("codex").userConfigFile(e)}export function readCodexMcpServers(e=codexConfigFile()){return x(e)}export function codexMcpExists(e,r=codexConfigFile()){return p(e,r)}export function writeCodexMcpServer(e,r,o=codexConfigFile()){return d(e,r,o)}export function removeCodexMcpServer(e,r=codexConfigFile()){return c(e,r)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assetSurfaceFor as
|
|
1
|
+
import{assetSurfaceFor as S}from"../surfaces.js";export{FILE_ASSET_SPECS,FILE_ASSET_CATEGORIES,isFileAssetCategory}from"@weavecode/harness";export function fileAssetTargetDir(r,e,t,s,o){return S(e).targetDir(r,t,s,o)}
|
|
@@ -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(
|
|
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(a,t=f){const r=h("sha256"),e=[];await p(a,a,e,t),e.sort((i,n)=>i.rel.localeCompare(n.rel));for(const i of e){r.update(i.rel),r.update("\0");let n;try{n=await u(i.abs)}catch{continue}r.update(n),r.update("\0")}return r.digest("hex")}async function p(a,t,r,e){let i;try{i=await m(t,{withFileTypes:!0})}catch{return}const n=[];for(const s of i)s.name.startsWith(".")&&e.has(s.name)||(!e.has(s.name)&&s.isDirectory()?n.push(p(a,c.join(t,s.name),r,e)):s.isFile()&&r.push({rel:c.relative(a,t).replace(/\\/g,"/")+"/"+s.name,abs:c.join(t,s.name)}));await Promise.all(n)}export async function maxMtimeDir(a,t=f){let r;try{r=await m(a,{withFileTypes:!0})}catch{return 0}return(await Promise.all(r.map(async e=>{if(e.name.startsWith(".")&&t.has(e.name))return 0;const i=c.join(a,e.name);if(e.isDirectory())return maxMtimeDir(i,t);if(!e.isFile())return 0;try{return(await l(i)).mtimeMs}catch{return 0}}))).reduce((e,i)=>Math.max(e,i),0)}export function hashMcpConfig(a){return h("sha256").update(JSON.stringify(o(a))).digest("hex")}export async function hashFile(a){try{const t=await u(a);return h("sha256").update(t).digest("hex")}catch{return"missing"}}function o(a){if(Array.isArray(a))return a.map(o);if(a&&typeof a=="object"){const t={};for(const r of Object.keys(a).sort())t[r]=o(a[r]);return t}return a}export class FingerprintCache{cache=new Map;fileCache=new Map;async get(t){const r=await maxMtimeDir(t),e=this.cache.get(t);if(e&&e.maxMtime===r)return e.hash;const i=await hashSkillDir(t);return this.cache.set(t,{maxMtime:r,hash:i}),i}async getFile(t){let r;try{r=(await l(t)).mtimeMs}catch{return"missing"}const e=this.fileCache.get(t);if(e&&e.maxMtime===r)return e.hash;const i=await hashFile(t);return this.fileCache.set(t,{maxMtime:r,hash:i}),i}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 w,access as J,stat as S,realpath as G}from"node:fs/promises";import{homedir as f}from"node:os";import s from"node:path";import{AssetNotFoundError as b}from"./installer.js";import{readClaudeJson as K}from"@weavecode/harness";import{FileTooLargeError as O,MAX_BYTES as v}from"./reader.js";import{assetSurfaceFor as m,assetSurfaces as $,pluginStateFor as k,pluginSurfaceFor as D}from"../surfaces.js";import{installForm as R,linkOrCopy as W,removeInstalled as B}from"../market/install-link.js";export{ClaudeJsonCorruptError}from"@weavecode/harness";const z=".claude.json",N=".claude/plugins/installed_plugins.json";function I(){return s.join(f(),z)}function x(){return m("claude").globalSkillsRoots(f())[0]}function L(t=f()){return s.join(t,N)}function _(){return m("claude").userConfigFile(f())}function T(){return m("codex").globalSkillsRoots(f())[0]}function X(){return m("codex").globalSkillsRoots(f())}function P(){const t=m("codex").pluginCacheDir?.(f());if(!t)throw new Error("codex has no plugin cache surface");return t}export function globalPersonalSkillRootsOwned(){return $().flatMap(t=>t.globalSkillsRoots(f()).map(e=>({harness:t.harness,root:e})))}export function globalPersonalSkillRoots(){return globalPersonalSkillRootsOwned().map(t=>t.root)}async function M(t){try{return await J(t),!0}catch{return!1}}async function y(t){try{return(await S(t)).isDirectory()}catch{return!1}}export function readGlobalClaudeJson(){return K(f())}export async function readGlobalMcpServers(){const t=(await readGlobalClaudeJson()).mcpServers;return!t||typeof t!="object"||Array.isArray(t)?{}:t}export async function writeGlobalMcpServer(t,e){await m("claude").mcpWrite("user","",f(),t,e)}export async function removeGlobalMcpServer(t){await m("claude").mcpRemove("user","",f(),t)}export async function readGlobalSkills(){const t=x();try{const e=await w(t,{withFileTypes:!0}),n=[];for(const a of e)!a.isDirectory()&&!a.isSymbolicLink()||await y(s.join(t,a.name))&&n.push(a.name);return n.sort((a,o)=>a.localeCompare(o))}catch{return[]}}export async function installGlobalSkill(t,e,n="claude"){const a=m(n).globalSkillsRoots(f())[0],o=s.join(a,e);if(await M(o))throw new Error(`Global ${n} skill "${e}" already exists`);return await W(t,o),o}export async function uninstallGlobalSkill(t,e="claude"){const n=m(e).globalSkillsRoots(f())[0];await B(s.join(n,t))}async function j(t=f()){const e=L(t);if(!await M(e))return{};try{const n=JSON.parse(await E(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}}async function A(t){if(!await y(t))return[];let e;try{e=await w(t,{withFileTypes:!0})}catch{return[]}const n=[];for(const a of e){if(a.name.startsWith(".")||!a.isDirectory()&&!a.isSymbolicLink())continue;const o=s.join(t,a.name);if(!await y(o))continue;const r=await R(o);r!=="absent"&&n.push({name:a.name,dir:o,form:r})}return n.sort((a,o)=>a.name.localeCompare(o.name))}export async function installedPluginNamespaces(t=f()){const e=(await j(t)).plugins;if(!e||typeof e!="object"||Array.isArray(e))return[];const n=[];for(const[a,o]of Object.entries(e)){const{market:r}=D("claude").parsePluginKey(a);for(const i of Array.isArray(o)?o:[])i&&typeof i.installPath=="string"&&n.push({dir:i.installPath,namespace:r})}return n}async function Y(){const t=(await j()).plugins;if(!t||typeof t!="object"||Array.isArray(t))return[];const e=[];for(const[n,a]of Object.entries(t)){const o=Array.isArray(a)?a:[];if(o.length===0)continue;const r=[...o].filter(p=>p&&typeof p.installPath=="string").pop();if(!r?.installPath)continue;const i=await A(s.join(r.installPath,"skills")),{name:l,market:u}=D("claude").parsePluginKey(n);e.push({source:"claude-plugin",label:l,namespace:u,skills:i,pluginKey:n})}return e.sort((n,a)=>n.label.localeCompare(a.label))}async function q(){const t=new Map;for(const e of X())for(const n of await A(e))t.has(n.name)||t.set(n.name,n);return{source:"codex-personal",label:"Codex \xB7 \u4E2A\u4EBA",skills:[...t.values()].sort((e,n)=>e.name.localeCompare(n.name))}}async function H(){const t=P();if(!await y(t))return[];const e=[];let n;try{n=await w(t,{withFileTypes:!0})}catch{return[]}for(const a of n){if(!a.isDirectory()&&!a.isSymbolicLink())continue;const o=s.join(t,a.name);let r;try{r=await w(o,{withFileTypes:!0})}catch{continue}for(const i of r){if(!i.isDirectory()&&!i.isSymbolicLink())continue;const l=s.join(o,i.name);let u;try{u=await w(l,{withFileTypes:!0})}catch{continue}const p=u.filter(h=>h.isDirectory()||h.isSymbolicLink());if(p.length===0)continue;const d=p.map(h=>h.name).sort().pop(),c=await A(s.join(l,d,"skills")),g=`${i.name}@${a.name}`;e.push({source:"codex-plugin",label:i.name,namespace:a.name,skills:c,pluginKey:g})}}return e.sort((a,o)=>a.label.localeCompare(o.label))}async function Q(){const t=x(),e=await readGlobalSkills(),n=[];for(const a of e){const o=s.join(t,a),r=await R(o);r!=="absent"&&n.push({name:a,dir:o,form:r})}return{source:"claude-personal",label:"Claude Code \xB7 \u4E2A\u4EBA",skills:n}}export async function readGlobalSkillGroups(){const[t,e,n,a,o,r]=await Promise.all([Q(),Y(),q(),H(),readClaudePluginEnabled(),readCodexPluginEnabled()]),i=(l,u)=>({...l,enabled:l.pluginKey?u[l.pluginKey]??!1:void 0});return[t,...e.map(l=>i(l,o)),n,...a.map(l=>i(l,r))]}export async function resolveGlobalSkillDir(t,e,n){if(t==="claude-personal"){const c=s.join(x(),e);return await y(c)?c:null}if(t==="codex-personal"){const c=s.join(T(),e);return await y(c)?c:null}if(t==="claude-plugin"){if(!n)return null;const c=(await j()).plugins;if(!c||typeof c!="object"||Array.isArray(c))return null;const g=c[n],h=[...Array.isArray(g)?g:[]].filter(C=>C&&typeof C.installPath=="string").pop();if(!h?.installPath)return null;const F=s.join(h.installPath,"skills",e);return await y(F)?F:null}if(!n)return null;const a=n.lastIndexOf("@");if(a<=0)return null;const o=n.slice(0,a),r=n.slice(a+1),i=s.join(P(),r,o);if(!await y(i))return null;let l;try{l=await w(i,{withFileTypes:!0})}catch{return null}const u=l.filter(c=>c.isDirectory()||c.isSymbolicLink());if(u.length===0)return null;const p=u.map(c=>c.name).sort().pop(),d=s.join(i,p,"skills",e);return await y(d)?d:null}function U(t){const e=s.resolve(t),n=f();return $().find(a=>{const o=[...a.globalSkillsRoots(n)],r=a.pluginCacheDir?.(n);return r&&o.push(r),o.some(i=>e===s.resolve(i)||e.startsWith(s.resolve(i)+s.sep))})?.harness??"claude"}export async function listGlobalSkillFiles(t){const e=U(t),n=[],a=async(o,r)=>{let i;try{i=await w(o,{withFileTypes:!0})}catch{return}for(const l of i){if(l.name.startsWith("."))continue;const u=s.join(o,l.name),p=r?`${r}/${l.name}`:l.name;if((l.isDirectory()||l.isSymbolicLink())&&await y(u))await a(u,p);else if(l.isFile()||l.isSymbolicLink())try{const d=await S(u);d.isFile()&&n.push({absPath:u,relPath:p,category:"skill",agent:e,mtimeMs:d.mtimeMs})}catch{}}};return await a(t,""),n.sort((o,r)=>o.relPath.localeCompare(r.relPath))}export async function readGlobalSkillFile(t,e){const n=s.normalize(e).replace(/\\/g,"/");if(s.isAbsolute(e))throw new b(`Absolute paths are not allowed: "${e}"`);if(n.split("/").some(u=>u===".."))throw new b(`Path traversal is not allowed: "${e}"`);const a=s.join(t,n);let o;try{o=await S(a)}catch{throw new b(`File not found: "${e}"`)}if(!o.isFile())throw new b(`Not a file: "${e}"`);if(o.size>v)throw new O(`File exceeds ${v} bytes: "${e}"`);let r=t,i=a;try{[r,i]=await Promise.all([G(t),G(a)])}catch{throw new b(`File not found: "${e}"`)}const l=r.endsWith(s.sep)?r:r+s.sep;if(i!==r&&!i.startsWith(l))throw new b(`Resolved path escapes the skill directory: "${e}"`);return{content:await E(a,"utf-8"),size:o.size}}export async function readClaudePluginEnabled(){return k("claude").readGlobalEnabled()}export async function writeClaudePluginEnabled(t,e){return k("claude").writeGlobalEnabled(t,e)}export async function readCodexPluginEnabled(){return k("codex").readGlobalEnabled()}export async function writeCodexPluginEnabled(t,e){return k("codex").writeGlobalEnabled(t,e)}export{x as globalSkillsPath,I as claudeJsonPath,L as claudePluginsJsonPath,_ as claudeSettingsPath,T as codexSkillsPath,P as codexPluginsCachePath};
|