@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 +1 @@
|
|
|
1
|
-
import{lstat as
|
|
1
|
+
import{lstat as g,readdir as w,stat as f}from"node:fs/promises";import{homedir as P}from"node:os";import o from"node:path";import{classifyAgent as k,classifyAsset as x}from"../watch/classifier.js";import{PluginModsSniffer as S}from"../watch/plugin-mods.js";import{installedPluginNamespaces as $}from"./global-config.js";const b=["commands","agents","workflows","rules","output-styles","hooks","themes","routines","plugins"],j=["CLAUDE.md","settings.json","settings.local.json"],A=["prompts"],v=["config.toml","AGENTS.md"],D=new Set(["skills","node_modules",".git"]),F=new Set(["marketplaces","data",".in_use"]),p=".claude/plugins",L=`${p}/`,M=6,E=10,N=5e3,T=[{prefix:".claude",dirs:b,files:j},{prefix:".codex",dirs:A,files:v}];async function d(s,e,a){try{const l=await g(s),t=l.isSymbolicLink(),i=t?await f(s):l;if(!i.isFile())return null;let r=x(e);return r==="plugin"&&(r=a.refine(r,e,s)),{absPath:s,relPath:e,category:r,agent:k(e),mtimeMs:i.mtimeMs,...t?{isSymlink:!0}:{}}}catch{return null}}async function u(s,e,a,l,t){if(a>l)return[];let i;try{i=await w(s,{withFileTypes:!0})}catch{return[]}return(await Promise.all(i.map(async r=>{const m=o.join(s,r.name),n=`${e}/${r.name}`;if(r.isDirectory())return h(n,r.name)?[]:u(m,n,a+1,l,t);if(r.isSymbolicLink())try{if((await f(m)).isDirectory())return h(n,r.name)?[]:u(m,n,a+1,l,t)}catch{return[]}const c=await d(m,n,t);return c?[c]:[]}))).flat()}function h(s,e){return D.has(e)?!0:s.startsWith(L)&&F.has(e)}export async function listGlobalFileAssets(s=P()){const e=new S({revalidate:!1}),a=(await Promise.all(T.map(async t=>{const i=o.join(s,...t.prefix.split("/")),[r,m]=await Promise.all([Promise.all(t.files.map(n=>d(o.join(i,n),`${t.prefix}/${n}`,e))),Promise.all(t.dirs.map(n=>{const c=`${t.prefix}/${n}`,y=c===p?E:M;return u(o.join(i,n),c,1,y,e)}))]);return[...r.filter(n=>n!==null),...m.flat()]}))).flat(),l=await $(s);return a.sort((t,i)=>t.relPath.localeCompare(i.relPath)),a.slice(0,N).map(t=>{const i=_(t.absPath,l);return i?{...t,namespace:i}:t})}function _(s,e){let a;for(const l of e){const t=o.relative(o.resolve(l.dir),o.resolve(s));t===""||t.startsWith("..")||o.isAbsolute(t)||(!a||l.dir.length>a.dir.length)&&(a=l)}return a?.namespace}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { type Harness, type HooksConfig, type InitComponents, type MCPConfig, type Preset } from '@weavecode/core';
|
|
2
2
|
import { type SyncClass } from './git-classify.js';
|
|
3
|
-
/**
|
|
4
|
-
* init 生成物的漂移检测与自动落盘——`weave init` 写过的文件里,**不进 git 的**
|
|
5
|
-
* 由同步域自动刷新(自愈),**会进 git 的**只报不写、dashboard 提醒用户去终端
|
|
6
|
-
* 跑 `weave init`(保留「生成 + commit」流程)。
|
|
7
|
-
*
|
|
8
|
-
* 期望态不在此处拼:落点与内容全经 harness 的 `generateInitFiles`(与 init 落盘
|
|
9
|
-
* 同一套生成器),statusline 那条走 statusline 模块自己的生成器与落点。本模块只
|
|
10
|
-
* 做「盘上 vs 期望」的比对与按 git 归类分流。
|
|
11
|
-
*/
|
|
12
3
|
export interface InitFileUpdate {
|
|
13
4
|
/** 项目根相对路径(posix)。 */
|
|
14
5
|
relPath: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{mkdir as
|
|
2
|
-
`)){const n
|
|
1
|
+
import{mkdir as w,readFile as m,writeFile as g}from"node:fs/promises";import l from"node:path";import{DEFAULT_HOOKS as u,DEFAULT_MCP as E,HARNESS_KEYS as P,detectPlatform as C,isHarness as S,resolveComponents as v}from"@weavecode/core";import{WEAVE_CONTENT_MARKER as h,generateInitFiles as O}from"@weavecode/harness";import{gitClassify as j}from"./git-classify.js";import{generateStatuslineScript as A}from"../statusline/generator.js";import{readStatuslineConfig as k,statuslineScriptRelPath as x}from"../statusline/manager.js";import{WEAVE_VERSION as V}from"../version.js";const F=[/^\s*\*\s*@version weave@\S+\s*$/gm,/^\s*const WEAVE_VERSION = .*$/gm];function y(t){return F.reduce((e,n)=>e.replace(n,""),t)}function I(t){const e={};for(const n of t.split(`
|
|
2
|
+
`)){const r=n.indexOf(":");if(r<=0)continue;const a=n.slice(0,r).trim(),s=n.slice(r+1).trim();if(a)try{e[a]=JSON.parse(s)}catch{e[a]=s}}return e}function R(t){if(typeof t!="object"||t===null)return u;const e=t,n=Object.fromEntries(Object.keys(u).filter(r=>typeof u[r]=="boolean"&&!(r in e)).map(r=>[r,!1]));return{...u,...n,...e}}export async function readInitRuntime(t){let e;try{e=await m(l.join(t,".weave","config.yaml"),"utf-8")}catch{e=""}const n=I(e),r=n.preset,a=n.components,s=n.hooks,i=n.mcp,c=n.harnesses;return{initVersion:typeof n.initVersion=="string"?n.initVersion:null,preset:r==="minimal"||r==="full"||r==="default"?r:"default",harnesses:Array.isArray(c)?c.filter(S):[],components:v(r==="minimal"||r==="full"||r==="default"?r:"default",typeof a=="object"&&a!==null?a:void 0),hooks:R(s),mcp:{...E,...typeof i=="object"&&i!==null?i:{}}}}function _(){return C()}function b(t,e){return{projectPath:t,version:V,platform:_(),components:e.components,hooks:e.hooks,mcp:e.mcp}}async function N(t,e){if(!e.components.helpers)return[];const n=await k(t);return[{relPath:x(),weaveMarker:h,content:A(n)}]}async function M(t){try{return await m(t,"utf-8")}catch{return null}}function T(t,e){return t.merge?e===null?t.content:t.merge(e,t.content):e!==null&&!e.includes(t.weaveMarker??h)?null:t.content}async function H(t){try{return await m(l.join(t,".weave","config.yaml"),"utf-8"),!0}catch{return!1}}export async function detectInitFileUpdates(t){if(!await H(t))return[];const e=await readInitRuntime(t),n=b(t,e),r=e.harnesses.length>0?e.harnesses:[P[0]],a=[...await N(t,e)];for(const o of r)a.push(...await O(o,n));const s=[];for(const o of a){const p=l.join(t,...o.relPath.split("/")),d=await M(p),f=T(o,d);s.push({relPath:o.relPath,targetPath:p,outdated:f!==null&&y(f)!==y(d??""),syncClass:null,expectedContent:f})}const i=s.filter(o=>o.outdated),c=await j(t,i.map(o=>o.relPath));for(const o of i)o.syncClass=c.classOf(o.relPath);return s}export async function applyInitFile(t){return t.syncClass!=="auto"||!t.outdated||t.expectedContent===null?!1:(await w(l.dirname(t.targetPath),{recursive:!0}),await g(t.targetPath,t.expectedContent,"utf-8"),!0)}export function needsInit(t){return t.some(e=>e.syncClass==="manual"&&e.outdated)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{mkdir as
|
|
1
|
+
import{mkdir as l,readFile as f,writeFile as y}from"node:fs/promises";import r from"node:path";const i=r.join(".weave","installed.json"),s=t=>[t.category,t.name,t.agent,t.assetCategory??""].join("\0");function g(t){if(!t||typeof t!="object")return!1;const a=t;return(a.category==="skill"||a.category==="mcp"||a.category==="file")&&typeof a.name=="string"&&a.name!==""&&typeof a.agent=="string"}export async function readInstalledLedger(t){try{const a=JSON.parse(await f(r.join(t,i),"utf-8"));return Array.isArray(a.assets)?a.assets.filter(g):[]}catch{return[]}}export async function recordInstalled(t,a){const n=await readInstalledLedger(t);n.some(e=>s(e)===s(a))||await o(t,[...n,a])}export async function forgetInstalled(t,a){const n=await readInstalledLedger(t),e=n.filter(c=>s(c)!==s(a));e.length!==n.length&&await o(t,e)}async function o(t,a){const n=r.join(t,i);await l(r.dirname(n),{recursive:!0}),await y(n,`${JSON.stringify({version:1,assets:a},null,2)}
|
|
2
2
|
`,"utf-8")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cp as
|
|
1
|
+
import{cp as m,rm as j,readFile as h,access as S,mkdir as E}from"node:fs/promises";import{homedir as c}from"node:os";import i from"node:path";import{FILE_ASSET_SPECS as w,fileAssetTargetDir as y}from"./file-assets.js";import{assetSurfaceFor as l}from"../surfaces.js";import{forgetInstalled as d,recordInstalled as p}from"./install-ledger.js";import{installForm as g,removeInstalled as k}from"../market/install-link.js";export class InstallConflictError extends Error{constructor(e){super(e),this.name="InstallConflictError"}}export class AssetNotFoundError extends Error{constructor(e){super(e),this.name="AssetNotFoundError"}}function u(t){if(!t||t.includes("/")||t.includes("\\")||t.includes("..")||t.includes(i.sep))throw new Error(`Invalid asset name: "${t}"`)}async function x(t){try{return await S(t),!0}catch{return!1}}function $(t){return l(t).projectSkillsRoots()}export async function installSkill(t,e,r,a="claude"){u(r);const o=$(a);for(const s of o)if(await g(i.join(t,s,r))!=="absent")throw new InstallConflictError(`Skill "${r}" is already installed${a==="codex"?" (Codex)":""}`);const n=i.join(t,o[0],r);return await m(e,n,{recursive:!0}),await p(t,{category:"skill",name:r,agent:a}),n}export async function uninstallSkill(t,e,r="claude"){u(e);let a;for(const o of $(r)){const n=i.join(t,o,e);if(await g(n)!=="absent"){a=n;break}}if(!a)throw new AssetNotFoundError(`Skill "${e}" is not installed${r==="codex"?" (Codex)":""}`);await k(a),await d(t,{category:"skill",name:e,agent:r})}export async function installFileAsset(t,e,r,a,o="claude",n="project"){u(r);const s=y(e,o,n,t,c()),f=i.join(s,`${r}${w[e].ext}`);if(await x(f))throw new InstallConflictError(`${e} "${r}" is already installed`);return await E(s,{recursive:!0}),await m(a,f),n==="project"&&await p(t,{category:"file",name:r,agent:o,assetCategory:e}),f}export async function uninstallFileAsset(t,e,r,a="claude",o="project"){u(r);const n=y(e,a,o,t,c()),s=i.join(n,`${r}${w[e].ext}`);if(!await x(s))throw new AssetNotFoundError(`${e} "${r}" is not installed`);await j(s,{force:!0}),o==="project"&&await d(t,{category:"file",name:r,agent:a,assetCategory:e})}export async function installMcp(t,e,r){if(e in await readMcpServers(t))throw new InstallConflictError(`MCP server "${e}" is already configured`);await l("claude").mcpWrite("project",t,c(),e,r),await p(t,{category:"mcp",name:e,agent:"claude"})}export async function uninstallMcp(t,e){if(!await l("claude").mcpRemove("project",t,c(),e))throw new AssetNotFoundError(`MCP server "${e}" is not configured`);await d(t,{category:"mcp",name:e,agent:"claude"})}export async function readMcpJson(t){try{const e=await h(t,"utf-8"),r=JSON.parse(e);return r&&typeof r=="object"?r:{}}catch{return{}}}export async function readMcpServers(t){return l("claude").mcpRead("project",t,c())}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getLibraryScan as u}from"./scan-cache.js";export async function buildLibraryIndex(e){const
|
|
1
|
+
import{getLibraryScan as u}from"./scan-cache.js";export async function buildLibraryIndex(e){const n=new Map,i=new Map,s=new Map;for(const t of e){const m=t.kind==="skill"||t.kind==="both",d=t.kind==="mcp"||t.kind==="both";let o;try{o=await u(t.path)}catch{continue}if(m){for(const a of o.skills)n.has(a.name)||n.set(a.name,{name:a.name,libraryId:t.id,libraryPath:t.path,dirPath:a.dirPath});for(const a of Object.values(o.files))for(const r of a){const c=`${r.category}/${r.name}`;s.has(c)||s.set(c,{name:r.name,category:r.category,libraryId:t.id,libraryPath:t.path,filePath:r.filePath})}}if(d){for(const a of o.mcp)if(!i.has(a.name)){const{name:r,command:c,args:f,env:l,sourcePath:h}=a,p={command:c,...f&&{args:f},...l&&{env:l}};i.set(a.name,{name:r,libraryId:t.id,libraryPath:t.path,config:p,sourcePath:h})}}}return{skills:n,mcp:i,files:s}}export function findSkillSource(e,n){return e.skills.get(n)}export function findMcpSource(e,n){return e.mcp.get(n)}export function findFileAssetSource(e,n,i){return e.files.get(`${n}/${i}`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{homedir as
|
|
1
|
+
import{homedir as m}from"node:os";import{readMcpEnableMap as u,mcpOverrideOf as d,resolveMcpEffective as h}from"./settings-mcp.js";import{assetSurfaces as n}from"../surfaces.js";import{BUILTIN_MCP_SERVERS as S}from"./builtin-mcp.js";import{readDaemonState as b}from"../daemon/state.js";export async function readMcpRows(c){const p=await u(c),o=[];for(const e of n()){const s=e.mcpScopes();for(const a of s){const t=e.harness==="claude"&&a==="project"?p:null,l=await e.mcpRead(a,c,m()).catch(()=>({}));for(const[r,i]of Object.entries(l))o.push({key:r,category:"mcp",harness:e.harness,scope:a,installScopes:s,enable:t?d(t,r):null,effective:t?h(t,r):!0,detail:i})}}const f=b()?.port;for(const e of n())for(const s of S)e.harness==="claude"&&(o.some(a=>a.harness==="claude"&&a.key===s.name)||o.push({key:s.name,category:"mcp",harness:"claude",scope:"user",installScopes:["user"],install:"absent",enable:null,effective:!1,detail:{url:`http://127.0.0.1:${f??6420}${s.path}`},builtin:!0}));return o}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"node:path";import{marketIdOf as t}from"../market/identity.js";import{marketDir as e}from"../market/manifest.js";export async function installPluginPack(a,r){const n=t(r.dir);return a.globalInstall(r.dir,{name:r.name,version:r.version,description:r.description,...n?{marketplace:{name:n,dir:o.join(e(),n)}}:{}})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pluginSurfaces as b,pluginStateSurfaces as g}from"../surfaces.js";const u=["user","project","local"],
|
|
1
|
+
import{pluginSurfaces as b,pluginStateSurfaces as g}from"../surfaces.js";const u=["user","project","local"],y=(s,e)=>e in s?s[e]?"on":"off":"inherit";function S(s,e){for(let n=u.length-1;n>=0;n--){const o=s[u[n]][e];if(o!==void 0)return o}return!1}export async function readPluginRows(s){const e=[],n=b();for(const{harness:o,surface:a}of n){const f=a.pluginScopes(),[t,c]=await Promise.all([a.readInstalled().catch(()=>({})),a.readEnabledOverrides(s).catch(()=>({user:{},project:{},local:{}}))]),p=new Set(Object.keys(t));for(const r of u)for(const l of Object.keys(c[r]))p.add(l);for(const r of p){const l=t[r],d=S(c,r);for(const i of f)e.push({key:r,category:"plugin",harness:o,scope:i,installScopes:f,install:l?.some(h=>(h.scope??"user")===i)?"installed":"absent",enable:y(c[i],r),effective:d})}}for(const{harness:o,state:a}of g()){if(n.some(t=>t.harness===o))continue;const f=await a.readGlobalEnabled().catch(()=>({}));for(const[t,c]of Object.entries(f))e.push({key:t,category:"plugin",harness:o,scope:"user",installScopes:[],enable:c?"on":"off",effective:c})}return e}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cp as f,mkdir as
|
|
1
|
+
import{cp as f,mkdir as h,readdir as d,readFile as P,rm as w}from"node:fs/promises";import{homedir as j}from"node:os";import r from"node:path";import{WEAVE_PLUGIN_MANIFEST as y,WeavePluginManifestSchema as k}from"@weavecode/core";import{assetSurfaceFor as v}from"../surfaces.js";const F={skills:"skill",commands:"command",agents:"agent"};async function S(t){const e=[];let s;try{s=await d(t)}catch{return e}for(const o of s){const i=r.join(t,o);try{const c=JSON.parse(await P(r.join(i,y),"utf8")),a=k.safeParse(c);a.success&&e.push({dir:i,manifest:a.data})}catch{}}return e}function E(t,e,s){const o=[];if(!s.templates)return o;const i=v("claude"),c=r.join(t,...i.projectSkillsRoots()[0].split("/"));for(const[a,l]of Object.entries(s.templates)){const n=F[a];if(n)for(const p of l??[]){const u=r.resolve(e,p);if(!u.startsWith(r.resolve(e)+r.sep))continue;const m=r.basename(u),g=n==="skill"?c:i.targetDir(n,"project",t,j());o.push({pluginId:s.id,category:n,name:m.replace(/\.md$/,""),sourcePath:u,targetPath:r.join(g,m)})}}return o}export async function detectPluginTemplateUpdates(t,e){const s=[],o=r.join(t,".weave","plugins");for(const{dir:i,manifest:c}of await S(o))for(const a of E(t,i,c)){const[l,n]=a.category==="skill"?await Promise.all([e.get(a.sourcePath),e.get(a.targetPath)]):await Promise.all([e.getFile(a.sourcePath),e.getFile(a.targetPath)]);s.push({...a,outdated:l!==n})}return s}export async function materializePluginTemplate(t){if(t.category==="skill"){await w(t.targetPath,{recursive:!0,force:!0}),await f(t.sourcePath,t.targetPath,{recursive:!0});return}await h(r.dirname(t.targetPath),{recursive:!0}),await f(t.sourcePath,t.targetPath)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readFile as
|
|
1
|
+
import{readFile as i,writeFile as e,mkdir as s}from"node:fs/promises";import a from"node:path";const o=".weave",u="config.json";export const DEFAULT_PROJECT_CONFIG={lastSyncAt:null};function c(t){return a.join(t,o,u)}function f(t){return{lastSyncAt:t.lastSyncAt??DEFAULT_PROJECT_CONFIG.lastSyncAt}}export async function readProjectConfig(t){try{const n=await i(c(t),"utf-8");return f(JSON.parse(n))}catch{return DEFAULT_PROJECT_CONFIG}}export async function writeProjectConfig(t,n){const r=a.join(t,o);await s(r,{recursive:!0}),await e(c(t),`${JSON.stringify(n,null,2)}
|
|
2
2
|
`,"utf-8")}export async function markSynced(t,n){const r=await readProjectConfig(t);await writeProjectConfig(t,{...r,lastSyncAt:n})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as
|
|
1
|
+
import{readFile as c,stat as p}from"node:fs/promises";import{homedir as h}from"node:os";import s from"node:path";import{AssetNotFoundError as n}from"./installer.js";import{assetSurfaces as w}from"../surfaces.js";export class PathEscapeError extends Error{constructor(e){super(e),this.name="PathEscapeError"}}export class FileTooLargeError extends Error{constructor(e){super(e),this.name="FileTooLargeError"}}export const MAX_BYTES=512*1024;export function resolveWithinProject(r,e){const o=s.normalize(e).replace(/\\/g,"/");if(s.isAbsolute(e))throw new PathEscapeError(`Absolute paths are not allowed: "${e}"`);if(o.split("/").some(i=>i===".."))throw new PathEscapeError(`Path traversal is not allowed: "${e}"`);const t=s.join(r,o),a=r.endsWith(s.sep)?r:r+s.sep;if(t!==r&&!t.startsWith(a))throw new PathEscapeError(`Resolved path escapes the project: "${e}"`);return t}export function resolveProjectFile(r,e){const o=s.normalize(e).replace(/\\/g,"/"),t=w().flatMap(i=>i.projectSkillsRoots().map(l=>l.split("/")[0])),a=o.split("/")[0]??"";if(!(o===".mcp.json"||o==="CLAUDE.md"||o==="AGENTS.md"||t.includes(a)||o===".weave"||o.startsWith(".weave/")))throw new PathEscapeError(`Path is outside the allowed roots: "${e}"`);return resolveWithinProject(r,o)}export async function readProjectFile(r,e){const o=resolveProjectFile(r,e);let t;try{t=await p(o)}catch{throw new n(`File not found: "${e}"`)}if(!t.isFile())throw new n(`Not a file: "${e}"`);if(t.size>MAX_BYTES)throw new FileTooLargeError(`File exceeds ${MAX_BYTES} bytes: "${e}"`);return{content:await c(o,"utf-8"),size:t.size}}export async function readGlobalFile(r){return readProjectFile(h(),r)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mkdir as
|
|
1
|
+
import{mkdir as p,readFile as w,rm as l,writeFile as m}from"node:fs/promises";import{existsSync as v}from"node:fs";import n from"node:path";import{scanLibraryFileAssets as g,scanLibraryMcp as A,scanLibraryPlugins as b,scanLibrarySkills as d}from"./scanner.js";const u="scans.json",y=1;function i(t){const r=n.resolve(t);return n.join(n.dirname(r),".weave-scans",n.basename(r))}const a=new Map,o=new Map;export async function scanLibrary(t){const{plugins:r,packRoots:s}=await b(t),[e,c,f]=await Promise.all([d(t,s),A(t,s),g(t,s)]);return{plugins:r,packRoots:s,skills:e,mcp:c,files:f}}export async function getLibraryScan(t){const r=n.resolve(t),s=a.get(r);if(s)return s;const e=o.get(r);if(e)return e;const c=k(r);o.set(r,c);try{return await c}finally{o.delete(r)}}async function k(t){if(!v(t)){try{await l(i(t),{recursive:!0,force:!0})}catch{}const e=await scanLibrary(t);return a.set(t,e),e}const r=await S(t);if(r)return a.set(t,r),r;const s=await scanLibrary(t);return await L(t,s),a.set(t,s),s}async function S(t){try{const r=JSON.parse(await w(n.join(i(t),u),"utf8"));return!r||r.version!==y||r.root!==t||!Array.isArray(r.plugins)||!Array.isArray(r.packRoots)||!Array.isArray(r.skills)||!Array.isArray(r.mcp)||!r.files||typeof r.files!="object"?null:r}catch{return null}}async function L(t,r){try{await p(i(t),{recursive:!0}),await m(n.join(i(t),u),JSON.stringify({version:y,root:t,...r}),"utf8")}catch{}}export async function invalidateScan(t){const r=n.resolve(t);a.delete(r);const s=o.get(r);s&&await s.catch(()=>{}),await l(i(r),{recursive:!0,force:!0}),a.delete(r)}export function clearScanCache(){a.clear()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readdir as
|
|
1
|
+
import{readdir as p,readFile as k,stat as F}from"node:fs/promises";import{join as c,basename as u,relative as l,dirname as j}from"node:path";import{FILE_ASSET_SPECS as P,FILE_ASSET_CATEGORIES as h}from"./file-assets.js";import{hasNonEmptyModules as L}from"../watch/plugin-mods.js";import{parseToolkitPack as E}from"../hooks/toolkit-scan.js";import{marketIdOf as O}from"../market/identity.js";import{pluginSurfaceFor as T}from"../surfaces.js";function x(e){if(!(!(e.ccPack||e.kind==="mod")||!e.targets.includes("claude")))return T("claude").pluginKey(e.name,O(e.dir))}const y=new Set(["node_modules",".git","dist","build",".next","coverage",".cache"]);async function d(e){try{return(await F(e)).isFile()}catch{return!1}}async function C(e){if(await d(c(e,".claude-plugin","plugin.json"))||await d(c(e,"weave-plugin.json")))return!0;try{const t=JSON.parse(await k(c(e,"hooks","hooks.json"),"utf8"));return L(t)}catch{return!1}}const I=10;export async function scanLibraryPlugins(e){const t=[],a=[],o=async(n,r)=>{if(await C(n)){a.push(l(e,n).replace(/\\/g,"/"));const s=await E(n,{root:e,provenance:"market"},"");if(s){const m=[];for(const w of s.skills)await d(c(n,"skills",w,"SKILL.md"))&&m.push(w);const f=x(s);t.push({name:s.name,version:s.version,...s.description?{description:s.description}:{},...f?{key:f}:{},dirPath:s.dir,relPath:l(e,n).replace(/\\/g,"/"),ccPack:s.ccPack,weavePack:s.weavePack,kind:s.kind,components:s.components,targets:s.targets,skills:m})}return}if(r>=I)return;let i;try{i=await p(n,{withFileTypes:!0})}catch{return}for(const s of i)s.isDirectory()&&(s.name.startsWith(".")||y.has(s.name)||await o(c(n,s.name),r+1))};return await o(e,0),{plugins:t.sort((n,r)=>n.relPath.localeCompare(r.relPath)),packRoots:a.sort((n,r)=>n.localeCompare(r))}}function g(e,t){return!t||t.length===0?!1:t.some(a=>a===""||e===a||e.startsWith(`${a}/`))}export async function scanLibrarySkills(e,t){const a=[];return await b(e,e,a,t),a.sort((o,n)=>o.name.localeCompare(n.name))}async function b(e,t,a,o){if(g(l(e,t).replace(/\\/g,"/"),o))return;let n;try{n=await p(t,{withFileTypes:!0})}catch{return}if(n.some(r=>r.isFile()&&r.name==="SKILL.md")){a.push({name:u(t),dirPath:t,relPath:l(e,t).replace(/\\/g,"/"),group:l(e,j(t)).replace(/\\/g,"/")});return}for(const r of n)r.isDirectory()&&(r.name.startsWith(".")||y.has(r.name)||await b(e,c(t,r.name),a,o))}export async function scanLibraryMcp(e,t){const a=[];await v(e,e,a,t);const o=[];for(const n of a)try{const r=JSON.parse(await k(n.abs,"utf-8"));$(r,n,o)}catch{}return o.sort((n,r)=>n.name.localeCompare(r.name))}async function v(e,t,a,o){if(g(l(e,t).replace(/\\/g,"/"),o))return;let n;try{n=await p(t,{withFileTypes:!0})}catch{return}for(const r of n)if(r.isDirectory()){if(r.name.startsWith(".")||y.has(r.name))continue;await v(e,c(t,r.name),a,o)}else if(r.isFile()){const i=r.name.replace(/\.mcp\.json$/i,"").replace(/\.json$/i,""),s=/\.mcp\.json$/i.test(r.name),m=u(t)==="mcp"&&/\.json$/i.test(r.name);(s||m)&&i&&a.push({abs:c(t,r.name),rel:l(e,c(t,r.name)).replace(/\\/g,"/")})}}function $(e,t,a){const o=t.rel.replace(/\.mcp\.json$/i,"").replace(/\.json$/i,"").replace(/^.*\//,"");if(e&&typeof e=="object"&&!Array.isArray(e)){const n=e,r=n.mcpServers;if(r&&typeof r=="object"&&!Array.isArray(r)){for(const[s,m]of Object.entries(r)){const f=S(s,m);f&&a.push({...f,sourcePath:t.abs,relPath:t.rel})}return}const i=S(o,n);i&&a.push({...i,sourcePath:t.abs,relPath:t.rel})}}function S(e,t){if(!t||typeof t!="object"||Array.isArray(t))return null;const a=t;if(typeof a.command!="string"||!a.command)return null;const o={name:e,command:a.command};if(Array.isArray(a.args)&&(o.args=a.args.filter(n=>typeof n=="string")),a.env&&typeof a.env=="object"&&!Array.isArray(a.env)){const n={};for(const[r,i]of Object.entries(a.env))typeof i=="string"&&(n[r]=i);Object.keys(n).length&&(o.env=n)}return o}const W=Object.fromEntries(h.flatMap(e=>Object.values(P[e].dirs).map(t=>t?.project).filter(t=>t!==void 0).map(t=>[u(t),e])));export async function scanLibraryFileAssets(e,t){const a={};for(const o of h)a[o]=[];await A(e,e,a,t);for(const o of h)a[o].sort((n,r)=>n.name.localeCompare(r.name));return a}async function A(e,t,a,o){if(g(l(e,t).replace(/\\/g,"/"),o))return;let n;try{n=await p(t,{withFileTypes:!0})}catch{return}if(n.some(i=>i.isFile()&&i.name==="SKILL.md"))return;const r=W[u(t)];if(r){const i=P[r];for(const s of n){if(!s.isFile()||!s.name.endsWith(i.ext))continue;const m=s.name.slice(0,-i.ext.length);if(!m)continue;const f=c(t,s.name);a[r].push({name:m,filePath:f,relPath:l(e,f).replace(/\\/g,"/"),group:l(e,j(t)).replace(/\\/g,"/"),category:r})}return}for(const i of n)i.isDirectory()&&(i.name.startsWith(".")||y.has(i.name)||await A(e,c(t,i.name),a,o))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readFile as f,writeFile as u,mkdir as b,access as p}from"node:fs/promises";import o from"node:path";const c=".claude/settings.json";async function
|
|
2
|
-
`,"utf-8")}export async function readMcpEnableMap(
|
|
1
|
+
import{readFile as f,writeFile as u,mkdir as b,access as p}from"node:fs/promises";import o from"node:path";const c=".claude/settings.json";async function v(n){try{return await p(n),!0}catch{return!1}}async function d(n){const e=o.join(n,c);if(!await v(e))return{};try{const t=JSON.parse(await f(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}async function y(n,e){const t=o.join(n,c);await b(o.dirname(t),{recursive:!0}),await u(t,`${JSON.stringify(e,null,2)}
|
|
2
|
+
`,"utf-8")}export async function readMcpEnableMap(n){const e=await d(n),t=i(e.enabledMcpjsonServers),r=i(e.disabledMcpjsonServers),a={};for(const s of t)a[s]="enabled";for(const s of r)a[s]="disabled";return{overrides:a,enableAll:e.enableAllProjectMcpServers===!0}}const M={enabled:"on",disabled:"off",default:"inherit"},S={on:"enabled",off:"disabled",inherit:"default"};export function mcpOverrideOf(n,e){return M[n.overrides[e]??"default"]}export function resolveMcpEffective(n,e){const t=n.overrides[e];return t==="enabled"?!0:t==="disabled"?!1:n.enableAll}export async function setMcpEnableState(n,e,t){const r=await d(n),a=new Set(i(r.enabledMcpjsonServers)),s=new Set(i(r.disabledMcpjsonServers));a.delete(e),s.delete(e),t==="enabled"?a.add(e):t==="disabled"&&s.add(e),l(r,"enabledMcpjsonServers",a),l(r,"disabledMcpjsonServers",s),await y(n,r)}export function setMcpEnableOverride(n,e,t){return setMcpEnableState(n,e,S[t])}function i(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"):[]}function l(n,e,t){t.size===0?delete n[e]:n[e]=[...t].sort()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readdir as g,stat as w}from"node:fs/promises";import{homedir as
|
|
1
|
+
import{readdir as g,stat as w}from"node:fs/promises";import{homedir as k}from"node:os";import u from"node:path";import{hashMcpConfig as p}from"./fingerprint.js";import{buildLibraryIndex as h,findSkillSource as y,findMcpSource as f,findFileAssetSource as b}from"./library-index.js";import{readMcpServers as x}from"./installer.js";import{readGlobalMcpServers as F,readGlobalSkills as P}from"./global-config.js";import{readCodexMcpServers as v}from"./codex-toml.js";import{FILE_ASSET_CATEGORIES as C,FILE_ASSET_SPECS as E}from"./file-assets.js";import{assetSurfaces as j}from"../surfaces.js";import{readInstalledLedger as T}from"./install-ledger.js";import{detectPluginTemplateUpdates as U}from"./plugin-templates.js";import{detectInitFileUpdates as A,needsInit as L}from"./init-files.js";export async function detectUpdates(n,a,i,o){const s=o??await h(a),[e,t,d,r,l]=await Promise.all([detectSkillUpdates(n,i,s),D(n,s),detectFileAssetUpdates(n,i,s),U(n,i),A(n)]);await M(n,{skills:e,mcp:t,files:d},s);const m=e.filter(c=>!c.custom&&c.outdated).length+t.filter(c=>!c.custom&&c.outdated).length+d.filter(c=>!c.custom&&c.outdated).length+r.filter(c=>c.outdated).length+l.filter(c=>c.outdated&&c.syncClass==="auto").length;return{skills:e,mcp:t,files:d,pluginTemplates:r,initFiles:l,available:m,needsInit:L(l)}}export async function detectProjectUpdateCounts(n,a,i){const o=await h(a),s={};for(const e of n){const t=await detectUpdates(e.path,a,i,o);s[e.id]={available:t.available,needsInit:t.needsInit}}return s}async function M(n,a,i){for(const o of await T(n)){if(o.category==="skill"){if(!y(i,o.name)||a.skills.some(e=>e.scope==="project"&&e.name===o.name&&e.agent===o.agent))continue;a.skills.push({name:o.name,scope:"project",agent:o.agent,outdated:!0,custom:!1,missing:!0});continue}if(o.category==="mcp"){if(!f(i,o.name)||a.mcp.some(e=>e.scope==="project"&&e.name===o.name))continue;a.mcp.push({name:o.name,scope:"project",outdated:!0,custom:!1,missing:!0});continue}const s=o.assetCategory;s===void 0||!b(i,s,o.name)||a.files.some(e=>e.scope==="project"&&e.category===s&&e.name===o.name)||a.files.push({category:s,name:o.name,scope:"project",outdated:!0,custom:!1,missing:!0})}}async function G(n){let a;try{a=await g(n,{withFileTypes:!0})}catch{return[]}const i=[];for(const o of a)if(!(!o.isDirectory()&&!o.isSymbolicLink()))try{(await w(u.join(n,o.name))).isDirectory()&&i.push(o.name)}catch{}return i}export async function detectSkillUpdates(n,a,i){const o=k(),s=[...j().map(t=>({dir:u.join(n,...t.projectSkillsRoots()[0].split("/")),scope:"project",agent:t.harness})),...j().map(t=>({dir:t.globalSkillsRoots(o)[0],scope:"user",agent:t.harness}))],e=[];for(const t of s)for(const d of await G(t.dir)){const r=u.join(t.dir,d),l=y(i,d);if(!l){e.push({name:d,scope:t.scope,agent:t.agent,outdated:!1,custom:!0});continue}const[m,c]=await Promise.all([a.get(r),a.get(l.dirPath)]);e.push({name:d,scope:t.scope,agent:t.agent,outdated:m!==c,custom:!1,sourceDir:l.dirPath,libraryId:l.libraryId})}return e}export async function detectFileAssetUpdates(n,a,i){const o=[];for(const s of C){const e=E[s],t=e.dirs.claude?.project;if(!t)continue;const d=u.join(n,...t.split("/"));let r;try{r=(await g(d,{withFileTypes:!0})).filter(l=>l.isFile()&&l.name.endsWith(e.ext)).map(l=>l.name)}catch{continue}for(const l of r){const m=l.slice(0,-e.ext.length),c=b(i,s,m);if(!c){o.push({category:s,name:m,scope:"project",outdated:!1,custom:!0});continue}const[S,I]=await Promise.all([a.getFile(u.join(d,l)),a.getFile(c.filePath)]);o.push({category:s,name:m,scope:"project",outdated:S!==I,custom:!1,libraryId:c.libraryId})}}return o}async function D(n,a){const[i,o,s]=await Promise.all([x(n).catch(()=>({})),F().catch(()=>({})),v().catch(()=>({}))]),e=[];for(const[t,d]of Object.entries(i)){const r=f(a,t);r?e.push({name:t,scope:"project",outdated:p(d)!==p(r.config),custom:!1,libraryId:r.libraryId}):e.push({name:t,scope:"project",outdated:!1,custom:!0})}for(const[t,d]of Object.entries(o)){const r=f(a,t);r?e.push({name:t,scope:"user",outdated:p(d)!==p(r.config),custom:!1,libraryId:r.libraryId}):e.push({name:t,scope:"user",outdated:!1,custom:!0})}for(const[t,d]of Object.entries(s)){const r=f(a,t);r?e.push({name:t,scope:"user",agent:"codex",outdated:p(d)!==p(r.config),custom:!1,libraryId:r.libraryId}):e.push({name:t,scope:"user",agent:"codex",outdated:!1,custom:!0})}return e}export{P as readGlobalSkills};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i from"node:path";import{lstat as u,realpath as s}from"node:fs/promises";import{builtinMarketRoot as c}from"@weavecode/templates";import{WEAVE_MARKETPLACE as m}from"@weavecode/harness";import{marketDir as f}from"./manifest.js";import{linkOrCopy as p,removeInstalled as h}from"./install-link.js";export const BUILTIN_MARKET_ID=m;export function builtinMarketDir(r){return i.join(f(r),BUILTIN_MARKET_ID)}export function builtinPacksDir(r){return i.join(builtinMarketDir(r),"plugins")}export function builtinRulesDir(r){return i.join(builtinMarketDir(r),"rules")}export function isBuiltinMarketDir(r,n){return i.resolve(r)===i.resolve(builtinMarketDir(n))}export async function ensureBuiltinMarket(r){const n=r.libraries.dataRoot,a=c(),t=builtinMarketDir(n);r.libraries.add({path:t,kind:"both"});const l=await s(a),e=await u(t).catch(()=>null);if(e){if(e.isSymbolicLink()&&await s(t).catch(()=>null)===l)return{changed:!1,form:"link"};await h(t)}try{return{changed:!0,form:await p(a,t)}}catch(o){return{changed:!1,error:o instanceof Error?o.message:String(o)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"node:path";import{marketDir as s}from"./manifest.js";export function marketIdOf(e,o=s()){const t=r.relative(r.resolve(o),r.resolve(e));return t===""||t.startsWith("..")||r.isAbsolute(t)?void 0:t.split(r.sep)[0]||void 0}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{execFile as
|
|
2
|
-
`):r instanceof Error?r.message:String(r)).trim()||"unknown error"}export const defaultGitExec=async(r,t,
|
|
1
|
+
import{execFile as G}from"node:child_process";import{cp as y,mkdir as D,readdir as M,rename as b,rm as p,stat as B}from"node:fs/promises";import u from"node:path";import{promisify as P}from"node:util";import{getDataRoot as h}from"../db/paths.js";import{isInsideDir as v,toRelPosix as E}from"./resolve.js";import{isBuiltinMarketDir as z}from"./builtin.js";import{marketDir as x,readManifest as F,writeManifest as w}from"./manifest.js";const O=P(G),I=6e4,R=2e3;export function slugifyResourceId(r){const t=r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9][a-z0-9-]*$/.test(t)?t:"resource"}export function assertSafeGitUrl(r){const t=r.trim();if(!t)throw new Error("Missing git URL");if(t.includes("--upload-pack"))throw new Error("Invalid git URL (--upload-pack rejected)");if(!(t.startsWith("https://")||t.startsWith("ssh://")||/^git@[^:/\s]+:/.test(t)))throw new Error(`Unsupported git URL (allowed: https/ssh): ${t}`);if(/[\s\r\n\t]/.test(t))throw new Error("Invalid git URL (whitespace)");return t}function l(){return new Date().toISOString()}function k(r){return r.length>R?`${r.slice(0,R)}\u2026(truncated)`:r}function d(r,t){if(!v(r,t))throw new Error(`Import target escapes the market directory: ${r}`)}async function S(r){try{return await B(r),!0}catch{return!1}}async function A(r,t){let a=u.join(t,r),i=1;for(;await S(a);)i+=1,a=u.join(t,`${r}-${i}`);return a}async function j(r,t){let a;try{a=await M(r,{withFileTypes:!0})}catch{return null}for(const i of a){if(!i.isDirectory())continue;const e=u.join(r,i.name);if((await F(e))?.origin===t)return e}return null}async function g(r,t,a,i,e=!1){const n=a.dataRoot??h(),o=E(r,n),s=a.libraries.add({path:o,kind:"both"});return{id:u.basename(r),dir:r,relPath:o,manifest:t,libraryId:s.id,reused:i,refreshed:e}}async function H(r,t,a){const i=`${t}.refresh-tmp`;await p(i,{recursive:!0,force:!0}),await y(r,i,{recursive:!0}),d(u.resolve(i),a),await p(t,{recursive:!0,force:!0}),await b(i,t)}export async function importFromDir(r,t){const a=t.dataRoot??h(),i=u.resolve(r);if(!(await B(i).catch(()=>null))?.isDirectory())throw new Error(`Not a directory: ${r}`);const e=x(a);if(v(i,e))throw new Error("\u4E0D\u80FD\u628A\u8D44\u6E90\u5E02\u573A\u7684\u5B58\u50A8\u76EE\u5F55\u5F53\u6765\u6E90\u5BFC\u5165\uFF1A\u5176\u4E2D\u7684\u8D44\u6E90\u5DF2\u5728\u5217\u8868\u4E2D\uFF08\u5185\u7F6E\u4ED3\u843D\u70B9 / \u5DF2\u5BFC\u5165\u7684\u526F\u672C\uFF09");const n=await j(e,i);if(n){const c=await F(n);await H(i,n,e);const f={...c,importedAt:l()};return await w(n,f),g(n,f,t,!0,!0)}const o=await A(slugifyResourceId(u.basename(i)),e);d(o,e),await D(u.dirname(o),{recursive:!0}),await y(i,o,{recursive:!0});const s={source:"dir",origin:i,importedAt:l()};return await w(o,s),d(u.resolve(o),e),g(o,s,t,!1)}export async function importFromGit(r,t){const a=t.dataRoot??h(),i=assertSafeGitUrl(r),e=x(a),n=await j(e,i);if(n){const f=await F(n),m=`${n}.refresh-tmp`;await p(m,{recursive:!0,force:!0});const L=["clone","--depth","1",i,m];try{await(t.execGit??defaultGitExec)("git",L,{timeout:I,maxBuffer:4*1024*1024,windowsHide:!0})}catch(U){throw new Error(`git clone failed: ${k(C(U))}`)}d(u.resolve(m),e),await p(n,{recursive:!0,force:!0}),await b(m,n);const $={...f,importedAt:l()};return await w(n,$),g(n,$,t,!0,!0)}const o=await A(slugifyResourceId(T(i)),e);d(o,e),await D(e,{recursive:!0});const s=["clone","--depth","1",i,o];try{await(t.execGit??defaultGitExec)("git",s,{timeout:I,maxBuffer:4*1024*1024,windowsHide:!0})}catch(f){throw new Error(`git clone failed: ${k(C(f))}`)}d(u.resolve(o),e);const c={source:"git",origin:i,importedAt:l()};return await w(o,c),g(o,c,t,!1)}export async function importLibraryIntoMarket(r,t){const a=t.dataRoot??h(),i=u.isAbsolute(r.path)?r.path:u.join(a,r.path),e=u.resolve(i),n=x(a);if(!await S(e))throw new Error(`Source directory not found: ${e}`);if(z(e,a))throw new Error("\u5185\u7F6E\u4ED3\u4E0D\u53EF\u8FC1\u5165\uFF1A\u5B83\u968F\u5305\u53D1\u5E03\u3001\u65E0\u5916\u90E8\u6765\u6E90\uFF0C\u4E14\u843D\u70B9\u662F\u94FE\u63A5\uFF08\u5199\u5165\u4F1A\u6539\u5230\u5305\u5185\u5BB9\uFF09");if(v(e,n)){let c=await F(e);return c||(c={source:"dir",origin:e,importedAt:l()},await w(e,c)),{id:u.basename(e),dir:e,relPath:E(e,a),manifest:c,libraryId:r.id,reused:!0,refreshed:!1}}const o=await A(slugifyResourceId(u.basename(e)),n);d(o,n),await D(u.dirname(o),{recursive:!0}),await y(e,o,{recursive:!0});const s={source:"dir",origin:e,importedAt:l()};return await w(o,s),t.libraries.setPath(r.id,E(o,a)),{id:u.basename(o),dir:o,relPath:E(o,a),manifest:s,libraryId:r.id,reused:!1,refreshed:!1}}function T(r){const t=r.split(/[?#]/)[0],a=t.lastIndexOf("/"),i=t.lastIndexOf(":");return(a>i?t.slice(a+1):t.slice(i+1)).replace(/\.git$/,"")||"repo"}function C(r){const t=r,a=[t?.stderr,t?.stdout].filter(Boolean).map(String);return(a.length?a.join(`
|
|
2
|
+
`):r instanceof Error?r.message:String(r)).trim()||"unknown error"}export const defaultGitExec=async(r,t,a)=>{const{stdout:i,stderr:e}=await O(r,t,a);return{stdout:String(i),stderr:String(e)}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stat as d}from"node:fs/promises";import{defaultGitExec as u,importFromDir as c,importFromGit as
|
|
1
|
+
import{stat as d}from"node:fs/promises";import{defaultGitExec as u,importFromDir as c,importFromGit as m}from"./import.js";import{readManifest as n,writeManifest as f}from"./manifest.js";async function w(t){try{return(await d(t)).isDirectory()}catch{return!1}}export async function refreshMarketItems(t,a){return Promise.all(t.map(async i=>{const r=await n(i.dir);if(!r)return{id:i.id,status:"skipped"};if(r.source==="dir"&&!await w(r.origin))return{id:i.id,status:"origin-missing"};try{if(r.source==="git"){const e=await m(r.origin,a),s=await p(e.dir,a.execGit??u);if(s){const o={...await n(e.dir),commit:s};return await f(e.dir,o),{id:i.id,status:"refreshed",commit:s}}return{id:i.id,status:"refreshed"}}return await c(r.origin,a),{id:i.id,status:"refreshed"}}catch{return{id:i.id,status:"failed"}}}))}async function p(t,a){try{return(await a("git",["-C",t,"rev-parse","HEAD"],{timeout:15e3,maxBuffer:1048576,windowsHide:!0})).stdout.trim()||void 0}catch{return}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"node:path";import{getDataRoot as
|
|
1
|
+
import t from"node:path";import{getDataRoot as i}from"../db/paths.js";import{marketDir as l}from"./manifest.js";import{isBuiltinMarketDir as p}from"./builtin.js";export function resolveLibraryPath(e,o=i()){if(!t.isAbsolute(e.path))return t.join(o,e.path);const r=t.resolve(e.path);return isInsideDir(r,o)?r:e.path}export function isInsideDir(e,o){const r=t.relative(t.resolve(o),t.resolve(e));return t.isAbsolute(r)?!1:r===""||r!==".."&&!r.startsWith(`..${t.sep}`)}export function toRelPosix(e,o=i()){return t.relative(t.resolve(o),t.resolve(e)).split(t.sep).join("/")}export function marketLibraryRoots(e,o=i()){const r=t.resolve(l(o)),n=new Set;for(const a of e.list()){const s=t.resolve(a.path);s===r||p(s,o)||isInsideDir(s,r)&&n.add(s)}return[...n]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stat as u}from"node:fs/promises";import m from"node:path";import{hashSkillDir as c}from"../install/fingerprint.js";import{defaultGitExec as
|
|
1
|
+
import{stat as u}from"node:fs/promises";import m from"node:path";import{hashSkillDir as c}from"../install/fingerprint.js";import{defaultGitExec as d}from"./import.js";import{readManifest as w}from"./manifest.js";const l=15e3;export const MARKET_SKIP_NAMES=new Set([".weave",".git","node_modules",".weave-market.json"]);async function p(i){try{return(await u(i)).isDirectory()}catch{return!1}}async function f(i,n){const r=m.resolve(n);if(!await p(r))return"origin-missing";const[t,a]=await Promise.all([c(i,MARKET_SKIP_NAMES),c(r,MARKET_SKIP_NAMES)]);return t===a?"uptodate":"update-available"}async function g(i,n,r){const t={timeout:l,maxBuffer:1048576,windowsHide:!0};try{const a=await r("git",["-C",i,"rev-parse","HEAD"],t),e=await r("git",["ls-remote",n,"HEAD"],t),o=a.stdout.trim(),s=e.stdout.trim().split(/\s+/)[0]??"";return!o||!s?"unknown":o===s?"uptodate":"update-available"}catch{return"unknown"}}export async function checkMarketUpdates(i,n){const r=n?.execGit??d;return Promise.all(i.map(async t=>{const a=await w(t.dir);let e;return a?a.source==="git"?e=await g(t.dir,a.origin,r):e=await f(t.dir,a.origin):e="unknown",{id:t.id,status:e,checkedAt:new Date().toISOString()}}))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{basename as
|
|
2
|
-
`,"utf-8"),{id:i.id,token:
|
|
1
|
+
import{basename as d,join as a}from"node:path";import{mkdirSync as f,writeFileSync as l}from"node:fs";import{openDatabase as p}from"./db/db.js";import{ProjectRepository as m}from"./repositories/projects.js";import{HookDispatchRepository as u}from"./repositories/hook-dispatches.js";import{HookEventRepository as h}from"./repositories/hook-events.js";import{SessionRepository as P}from"./repositories/sessions.js";import{SessionWatchRepository as w}from"./repositories/session-watches.js";import{OrchestrationRepository as j,OrchestrationRunRepository as k}from"./repositories/orchestrations.js";import{SideQuestionRepository as R}from"./repositories/side-questions.js";import{generateToken as g}from"./daemon/auth.js";import{purgeProjectPipeline as B}from"./daemon/hook-pipeline.js";import{hooksRoot as v}from"./hooks/mirror.js";export function registerProject(t,s,n){const o=p(n);try{const r=new m(o),e=r.getByPath(t)?.token??g(),i=r.register({path:t,name:d(t),token:e,source:s});return f(a(t,".weave"),{recursive:!0}),l(a(t,".weave","token"),e+`
|
|
2
|
+
`,"utf-8"),{id:i.id,token:e,path:i.path}}finally{o.close()}}export function unregisterProject(t,s,n){const o=p(s);try{const r=new m(o),e=r.getByPath(t);if(!e)return null;const i=new u(o).deleteByProject(e.id),c=new h(o).deleteByProject(e.id);new w(o).deleteByProject(e.id),new j(o).deleteByProject(e.id),new R(o).deleteByProject(e.id),new k(o).clear("all",e.id);const y=new P(o).removeByProject(e.id);return B(n??v(),e.token),r.remove(e.id),{id:e.id,name:e.name,path:e.path,purged:{events:c,dispatches:i,sessions:y}}}finally{o.close()}}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export class HookDispatchRepository{db;constructor(t){this.db=t}insert(t){const e=this.db.prepare(`INSERT INTO hook_dispatches (rule_id, event_id, session_id, prompt, status, mode, started_at)
|
|
2
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)`).run(t.ruleId,t.eventId??null,t.sessionId??null,t.prompt,t.status,t.mode,new Date().toISOString());return this.getById(Number(e.lastInsertRowid))}getById(t){const e=this.db.prepare("SELECT * FROM hook_dispatches WHERE id = ?").get(t);return e?
|
|
2
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`).run(t.ruleId,t.eventId??null,t.sessionId??null,t.prompt,t.status,t.mode,new Date().toISOString());return this.getById(Number(e.lastInsertRowid))}getById(t){const e=this.db.prepare("SELECT * FROM hook_dispatches WHERE id = ?").get(t);return e?n(e):void 0}updateStatus(t,e){const r=new Date().toISOString();return this.db.prepare(`UPDATE hook_dispatches
|
|
3
3
|
SET status = ?, output = COALESCE(?, output), error = COALESCE(?, error),
|
|
4
4
|
finished_at = CASE WHEN ? = 1 THEN ? ELSE finished_at END
|
|
5
|
-
WHERE id = ?`).run(e.status,e.output??null,e.error??null,e.finished?1:0,
|
|
6
|
-
OR event_id IN (SELECT id FROM hook_events WHERE project_id = ?)`).run(t,t).changes)}findRecentAuto(t,e,
|
|
5
|
+
WHERE id = ?`).run(e.status,e.output??null,e.error??null,e.finished?1:0,r,t),this.getById(t)}list(t={}){const e=Math.min(Math.max(t.limit??50,1),200),r=[],i=[];t.ruleId&&(r.push("rule_id = ?"),i.push(t.ruleId)),t.status&&(r.push("status = ?"),i.push(t.status)),t.sessionId&&(r.push("session_id = ?"),i.push(t.sessionId));const d=r.length>0?`WHERE ${r.join(" AND ")}`:"";return this.db.prepare(`SELECT * FROM hook_dispatches ${d} ORDER BY started_at DESC, id DESC LIMIT ?`).all(...i,e).map(n)}deleteBySession(t){return Number(this.db.prepare("DELETE FROM hook_dispatches WHERE session_id = ?").run(t).changes)}deleteByProject(t){return Number(this.db.prepare(`DELETE FROM hook_dispatches WHERE session_id IN (SELECT session_id FROM sessions WHERE project_id = ?)
|
|
6
|
+
OR event_id IN (SELECT id FROM hook_events WHERE project_id = ?)`).run(t,t).changes)}findRecentAuto(t,e,r){const i=this.db.prepare(`SELECT * FROM hook_dispatches
|
|
7
7
|
WHERE rule_id = ? AND session_id = ? AND mode = 'auto' AND started_at >= ?
|
|
8
|
-
ORDER BY started_at DESC LIMIT 1`).get(t,e,
|
|
8
|
+
ORDER BY started_at DESC LIMIT 1`).get(t,e,r);return i?n(i):void 0}}function n(s){return{id:Number(s.id),ruleId:String(s.rule_id),eventId:s.event_id==null?null:Number(s.event_id),sessionId:s.session_id==null?null:String(s.session_id),prompt:String(s.prompt),status:String(s.status),mode:String(s.mode),output:s.output==null?null:String(s.output),error:s.error==null?null:String(s.error),startedAt:String(s.started_at),finishedAt:s.finished_at==null?null:String(s.finished_at)}}
|
|
@@ -89,6 +89,12 @@ export declare class HookEventRepository {
|
|
|
89
89
|
* `ORDER BY id DESC` 倒序早停:最新对话优先,凑满 limit 即停。
|
|
90
90
|
*/
|
|
91
91
|
searchConversationTexts(q: string, limit: number): ConversationTextHit[];
|
|
92
|
+
/**
|
|
93
|
+
* 对话正文里含 needle 的全部文本(渲染块引用收集用):事件类型与正文键同
|
|
94
|
+
* searchConversationTexts,但不限条数、不排序——要的是「历史上提到过的每一个
|
|
95
|
+
* 引用」。
|
|
96
|
+
*/
|
|
97
|
+
conversationTextsContaining(needle: string): string[];
|
|
92
98
|
}
|
|
93
99
|
/** 一条聊天正文命中(全文随行带;命中窗口由路由层截)。 */
|
|
94
100
|
export interface ConversationTextHit {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import{HARNESS_LIFECYCLE as u}from"@weavecode/core";import{readDaemonSettingsSync as
|
|
2
|
-
VALUES (?, ?, ?, ?, ?, ?)`),this.pruneByCutoff=e.prepare("DELETE FROM hook_events WHERE created_at < ?")}resetPrune(){this.lastPruneDay=-1}insert(e){this.pruneExpired();const
|
|
3
|
-
FROM hook_events WHERE project_id = ? AND created_at >= ? GROUP BY at`),
|
|
1
|
+
import{HARNESS_LIFECYCLE as u}from"@weavecode/core";import{readDaemonSettingsSync as _,DEFAULT_EVENT_RETENTION_DAYS as S}from"../daemon/settings.js";export class HookEventRepository{db;lastPruneDay=-1;insertEvent;pruneByCutoff;constructor(e){this.db=e,this.insertEvent=e.prepare(`INSERT INTO hook_events (project_id, source, event_type, session_id, payload, created_at)
|
|
2
|
+
VALUES (?, ?, ?, ?, ?, ?)`),this.pruneByCutoff=e.prepare("DELETE FROM hook_events WHERE created_at < ?")}resetPrune(){this.lastPruneDay=-1}insert(e){this.pruneExpired();const r=this.insertEvent.run(e.projectId,e.source,e.eventType,e.sessionId??null,e.payload,e.createdAt??new Date().toISOString());return Number(r.lastInsertRowid)}insertMany(e){this.pruneExpired();const r=[];this.db.exec("BEGIN");try{for(const s of e){const n=this.insertEvent.run(s.projectId,s.source,s.eventType,s.sessionId??null,s.payload,s.createdAt??new Date().toISOString());r.push(Number(n.lastInsertRowid))}this.db.exec("COMMIT")}catch(s){throw this.db.exec("ROLLBACK"),s}return r}pruneExpired(){const e=Math.floor(Date.now()/864e5);if(e===this.lastPruneDay)return;this.lastPruneDay=e;const r=_().events?.retentionDays??S,s=new Date((e-r)*864e5).toISOString();this.pruneByCutoff.run(s)}listByProject(e,r=100){return this.db.prepare("SELECT * FROM hook_events WHERE project_id = ? ORDER BY created_at DESC LIMIT ?").all(e,r).map(s=>E(s))}deleteBySession(e){return Number(this.db.prepare("DELETE FROM hook_events WHERE session_id = ?").run(e).changes)}deleteByProject(e){return Number(this.db.prepare("DELETE FROM hook_events WHERE project_id = ?").run(e).changes)}countAll(){return Number(this.db.prepare("SELECT COUNT(*) AS n FROM hook_events").get().n)}countSince(e,r){const s=this.db.prepare("SELECT COUNT(*) AS n FROM hook_events WHERE project_id = ? AND created_at >= ?");let n=0;for(const o of e)n+=Number(s.get(o,r).n);return n}seriesBySecond(e,r){const s=this.db.prepare(`SELECT substr(created_at, 1, 19) AS at, COUNT(*) AS n
|
|
3
|
+
FROM hook_events WHERE project_id = ? AND created_at >= ? GROUP BY at`),n=new Map;for(const o of e)for(const t of s.all(o,r))n.set(t.at,(n.get(t.at)??0)+Number(t.n));return[...n].map(([o,t])=>({at:o,n:t})).sort((o,t)=>o.at<t.at?-1:1)}listByTools(e,r,s,n,o){if(r.length===0)return[];const t=["session_id = ?","event_type IN ('PreToolUse','PostToolUse')",`(${r.map(()=>"payload LIKE ?").join(" OR ")})`],a=[e,...r.map(p=>`%"toolName":"${p}"%`)];return s&&(t.push("payload LIKE ?"),a.push(`%${s}%`)),o!=null&&(t.push("id > ?"),a.push(o)),this.db.prepare(`SELECT * FROM hook_events WHERE ${t.join(" AND ")} ORDER BY id DESC LIMIT ?`).all(...a,n).map(p=>E(p))}listBySession(e,r=300,s,n){const o=["session_id = ?"],t=[e];return s!=null&&(o.push("id < ?"),t.push(s)),n?.length&&(o.push(`event_type IN (${n.map(()=>"?").join(",")})`),t.push(...n)),this.db.prepare(`SELECT * FROM hook_events WHERE ${o.join(" AND ")} ORDER BY id DESC LIMIT ?`).all(...t,r).map(a=>E(a)).reverse()}searchConversationTexts(e,r){const s=new Set;for(const t of Object.values(u)){s.add(t.open);for(const a of t.close)s.add(a)}const n=[...s].map(t=>`'${t}'`).join(","),o=l(e);return this.db.prepare(`SELECT id, project_id, source, event_type, session_id, payload, created_at
|
|
4
4
|
FROM hook_events
|
|
5
|
-
WHERE event_type IN (${
|
|
5
|
+
WHERE event_type IN (${n})
|
|
6
6
|
AND (COALESCE(json_extract(payload, '$.raw.prompt'), '') LIKE '%' || ? || '%' ESCAPE '\\'
|
|
7
7
|
OR COALESCE(json_extract(payload, '$.raw.last_assistant_message'), '') LIKE '%' || ? || '%' ESCAPE '\\')
|
|
8
8
|
ORDER BY id DESC
|
|
9
|
-
LIMIT ?`).all(
|
|
9
|
+
LIMIT ?`).all(o,o,r).map(t=>{const a=JSON.parse(String(t.payload)),p=d(a.raw?.prompt)??d(a.raw?.last_assistant_message)??"";return{eventId:Number(t.id),projectId:Number(t.project_id),source:String(t.source),eventType:String(t.event_type),sessionId:t.session_id==null?null:String(t.session_id),at:String(t.created_at),text:p}})}conversationTextsContaining(e){const r=new Set;for(const a of Object.values(u)){r.add(a.open);for(const p of a.close)r.add(p)}const s=[...r].map(a=>`'${a}'`).join(","),n=l(e),o=this.db.prepare(`SELECT payload FROM hook_events
|
|
10
|
+
WHERE event_type IN (${s})
|
|
11
|
+
AND (COALESCE(json_extract(payload, '$.raw.prompt'), '') LIKE '%' || ? || '%' ESCAPE '\\'
|
|
12
|
+
OR COALESCE(json_extract(payload, '$.raw.last_assistant_message'), '') LIKE '%' || ? || '%' ESCAPE '\\')`).all(n,n),t=[];for(const a of o){const p=JSON.parse(String(a.payload)),c=d(p.raw?.prompt)??d(p.raw?.last_assistant_message);c&&t.push(c)}return t}}function l(i){return i.replace(/[\\%_]/g,e=>`\\${e}`)}function d(i){return typeof i=="string"&&i.length>0?i:null}function E(i){return{id:Number(i.id),projectId:Number(i.project_id),source:String(i.source),eventType:String(i.event_type),sessionId:i.session_id==null?null:String(i.session_id),payload:String(i.payload),createdAt:String(i.created_at)}}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{randomUUID as s}from"node:crypto";import{HookRuleSchema as
|
|
1
|
+
import{randomUUID as s}from"node:crypto";import{HookRuleSchema as n}from"@weavecode/core";export class HookRuleRepository{db;constructor(e){this.db=e}create(e){const r=new Date().toISOString(),o=n.parse({id:s(),name:e.name,enabled:e.enabled??!0,priority:e.priority??0,projectId:e.projectId,source:e.source,filter:e.filter??{},handler:e.handler,timeoutMs:e.timeoutMs??1e4,record:e.record??e.handler.type!=="log",origin:e.origin??"user",pluginId:e.pluginId??null});return this.insertRow(o,r,r),o}upsertPluginRule(e){const r=new Date().toISOString(),o=this.getById(e.id);if(!o)return this.insertRow(e,r,r),e;const t=n.parse({...e,enabled:o.enabled});return this.db.prepare(`UPDATE hook_rules SET name = ?, enabled = ?, priority = ?, project_id = ?,
|
|
2
2
|
source = ?, filter = ?, handler = ?, timeout_ms = ?, record = ?,
|
|
3
3
|
origin = ?, plugin_id = ?, updated_at = ?
|
|
4
|
-
WHERE id = ?`).run(
|
|
4
|
+
WHERE id = ?`).run(t.name,t.enabled?1:0,t.priority,t.projectId,JSON.stringify(t.source),JSON.stringify(t.filter),JSON.stringify(t.handler),t.timeoutMs,t.record?1:0,t.origin,t.pluginId,r,t.id),t}removeByPlugin(e){const r=this.db.prepare("DELETE FROM hook_rules WHERE plugin_id = ?").run(e);return Number(r.changes)}listByPlugin(e){return this.db.prepare("SELECT * FROM hook_rules WHERE plugin_id = ? ORDER BY created_at ASC").all(e).map(d).filter(r=>r!==void 0)}getById(e){const r=this.db.prepare("SELECT * FROM hook_rules WHERE id = ?").get(e);return r?d(r):void 0}list(e){return(e===void 0?this.db.prepare("SELECT * FROM hook_rules ORDER BY priority DESC, created_at ASC").all():this.db.prepare("SELECT * FROM hook_rules WHERE project_id IS NULL OR project_id = ? ORDER BY priority DESC, created_at ASC").all(e)).map(d).filter(r=>r!==void 0)}update(e,r){const o=this.getById(e);if(!o)return;const t=n.parse({...o,...r,id:e,projectId:"projectId"in r?r.projectId:o.projectId});return this.db.prepare(`UPDATE hook_rules SET name = ?, enabled = ?, priority = ?, project_id = ?,
|
|
5
5
|
source = ?, filter = ?, handler = ?, timeout_ms = ?, record = ?, updated_at = ?
|
|
6
|
-
WHERE id = ?`).run(
|
|
6
|
+
WHERE id = ?`).run(t.name,t.enabled?1:0,t.priority,t.projectId,JSON.stringify(t.source),JSON.stringify(t.filter),JSON.stringify(t.handler),t.timeoutMs,t.record?1:0,new Date().toISOString(),e),t}setEnabled(e,r){const o=this.db.prepare("UPDATE hook_rules SET enabled = ?, updated_at = ? WHERE id = ?").run(r?1:0,new Date().toISOString(),e);if(Number(o.changes)!==0)return this.getById(e)}remove(e){const r=this.db.prepare("DELETE FROM hook_rules WHERE id = ?").run(e);return Number(r.changes)>0}insertRow(e,r,o){this.db.prepare(`INSERT INTO hook_rules (id, name, enabled, priority, project_id, source, filter, handler,
|
|
7
7
|
timeout_ms, record, origin, plugin_id, created_at, updated_at)
|
|
8
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(e.id,e.name,e.enabled?1:0,e.priority,e.projectId,JSON.stringify(e.source),JSON.stringify(e.filter),JSON.stringify(e.handler),e.timeoutMs,e.record?1:0,e.origin,e.pluginId,
|
|
8
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(e.id,e.name,e.enabled?1:0,e.priority,e.projectId,JSON.stringify(e.source),JSON.stringify(e.filter),JSON.stringify(e.handler),e.timeoutMs,e.record?1:0,e.origin,e.pluginId,r,o)}}function d(i){try{return n.parse({id:String(i.id),name:String(i.name),enabled:Number(i.enabled)===1,priority:Number(i.priority),projectId:i.project_id==null?null:Number(i.project_id),source:JSON.parse(String(i.source)),filter:JSON.parse(String(i.filter??"{}")),handler:JSON.parse(String(i.handler)),timeoutMs:Number(i.timeout_ms),record:Number(i.record)===1,origin:i.origin??"user",pluginId:i.plugin_id==null?null:String(i.plugin_id)})}catch{return}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i from"node:path";import{getDataRoot as h}from"../db/paths.js";import{isInsideDir as o,resolveLibraryPath as
|
|
1
|
+
import i from"node:path";import{getDataRoot as h}from"../db/paths.js";import{isInsideDir as o,resolveLibraryPath as p,toRelPosix as d}from"../market/resolve.js";export class LibraryRepository{db;dataRoot;constructor(t,r=h()){this.db=t,this.dataRoot=r}add(t){return this.getByPath(t.path)||(this.db.prepare("INSERT OR IGNORE INTO libraries (path, kind, added_at) VALUES (?, ?, ?)").run(this.writeForm(t.path),t.kind,new Date().toISOString()),this.getByPath(t.path))}getByPath(t){for(const r of new Set([t,this.writeForm(t)])){const s=this.db.prepare("SELECT * FROM libraries WHERE path = ?").get(r);if(s)return this.resolveRow(a(s))}}getById(t){const r=this.db.prepare("SELECT * FROM libraries WHERE id = ?").get(t);return r?this.resolveRow(a(r)):void 0}list(){return this.db.prepare("SELECT * FROM libraries ORDER BY added_at DESC").all().map(t=>this.resolveRow(a(t)))}setPath(t,r){this.db.prepare("UPDATE libraries SET path = ? WHERE id = ?").run(this.writeForm(r),t)}remove(t){this.db.prepare("DELETE FROM libraries WHERE id = ?").run(t)}writeForm(t){return i.isAbsolute(t)&&o(t,this.dataRoot)?d(t,this.dataRoot):t}resolveRow(t){if(!i.isAbsolute(t.path))return{...t,path:p(t,this.dataRoot)};const r=i.resolve(t.path);return o(r,this.dataRoot)?(this.db.prepare("UPDATE libraries SET path = ? WHERE id = ?").run(d(r,this.dataRoot),t.id),{...t,path:r}):t}}function a(e){return{id:Number(e.id),path:String(e.path),kind:e.kind,addedAt:String(e.added_at)}}
|