@weavecode/weave 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/encodeurl/README.md +14 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/encodeurl/index.js +5 -10
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/encodeurl/package.json +10 -6
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/CHANGELOG.md +42 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/README.md +38 -10
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/dist/qs.js +18 -18
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/parse.js +16 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/utils.js +13 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.cjs +6 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.mjs +6 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/package.json +10 -10
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/decrypt.d.ts +3 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/verify.d.ts +3 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +8 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +1 -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.d.ts +2 -0
- package/node_modules/@weavecode/cli/dist/commands/daemon.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/dashboard.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/msg.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/scan.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/uninstall.js +1 -1
- package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +4 -4
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +5 -1
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +5 -5
- package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
- package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +3 -3
- package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
- package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
- package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
- package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
- package/node_modules/@weavecode/cli/dist/init/provision.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
- package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
- package/node_modules/@weavecode/cli/dist/parser.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
- package/node_modules/@weavecode/cli/package.json +5 -5
- package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
- package/node_modules/@weavecode/core/dist/harness.d.ts +14 -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.js +1 -1
- package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
- package/node_modules/@weavecode/core/dist/utils/logger.js +1 -1
- package/node_modules/@weavecode/core/package.json +1 -1
- package/node_modules/@weavecode/harness/dist/claude/assets.js +4 -4
- package/node_modules/@weavecode/harness/dist/claude/capture.js +9 -9
- package/node_modules/@weavecode/harness/dist/claude/commands.d.ts +3 -0
- package/node_modules/@weavecode/harness/dist/claude/commands.js +2 -3
- package/node_modules/@weavecode/harness/dist/claude/config.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/edits.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/images.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/index.d.ts +1 -0
- 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.d.ts +0 -11
- 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.d.ts +8 -0
- package/node_modules/@weavecode/harness/dist/claude/rewind.js +1 -0
- package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/side-question.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +39 -18
- 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.d.ts +26 -0
- package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.js +2 -0
- 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 +49 -1
- 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.d.ts +19 -13
- package/node_modules/@weavecode/server/dist/config/profiles.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/ai-config.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/ai-context.js +6 -6
- package/node_modules/@weavecode/server/dist/daemon/ai-routes.js +4 -4
- package/node_modules/@weavecode/server/dist/daemon/api-log.js +3 -3
- package/node_modules/@weavecode/server/dist/daemon/auth-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/auto-start.js +6 -6
- package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/config-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/cron.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/dashboard-auth.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/dashboard-pusher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/data-bus.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/decision-config.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/entry.js +7 -1
- package/node_modules/@weavecode/server/dist/daemon/fs-browser.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/http.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/liveness.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/mcp-orchestration.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/narration-watcher.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/backend.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/launch.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/pty-terminals.js +4 -4
- 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.d.ts +2 -0
- package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/project-files.d.ts +12 -6
- 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/market.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/orchestration.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/path-refs.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/project-files.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.d.ts +3 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/watches.js +1 -1
- 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.d.ts +5 -4
- package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/settings.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/snapshot-refresher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/sse-hub.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/state.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/static.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/terminal-topology-refresher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/tls.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/toolkit-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/upload-sessions.js +1 -1
- package/node_modules/@weavecode/server/dist/db/db.js +6 -2
- package/node_modules/@weavecode/server/dist/db/layout.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/answer-keys.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/bus.d.ts +3 -1
- package/node_modules/@weavecode/server/dist/hooks/bus.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/dashboard-rate.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/decision-judge.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.d.ts +12 -6
- package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/channels.d.ts +3 -3
- package/node_modules/@weavecode/server/dist/hooks/delivery/channels.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/keys.d.ts +19 -9
- 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.d.ts +2 -2
- package/node_modules/@weavecode/server/dist/hooks/delivery/relay.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/send.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/delivery/views.d.ts +3 -1
- package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/dispatcher.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.d.ts +45 -38
- package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +5 -3
- package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
- package/node_modules/@weavecode/server/dist/hooks/orchestration-engine.js +7 -7
- package/node_modules/@weavecode/server/dist/hooks/orchestration-graph.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/plugin-installer.js +3 -3
- package/node_modules/@weavecode/server/dist/hooks/plugin-loader.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/plugin-project-state.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/prompt-flusher.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/promptbox.js +8 -8
- package/node_modules/@weavecode/server/dist/hooks/push-notify.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/question-tracker.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/registry.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/resume-runner.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/side-questions.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/synthetic-sessions.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/toolkit-scan.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
- package/node_modules/@weavecode/server/dist/hooks/watch-engine.js +1 -1
- package/node_modules/@weavecode/server/dist/install/apply-update.js +1 -1
- package/node_modules/@weavecode/server/dist/install/capabilities.js +1 -1
- package/node_modules/@weavecode/server/dist/install/codex-toml.js +1 -1
- package/node_modules/@weavecode/server/dist/install/file-assets.js +1 -1
- package/node_modules/@weavecode/server/dist/install/fingerprint.js +1 -1
- package/node_modules/@weavecode/server/dist/install/global-config.js +1 -1
- package/node_modules/@weavecode/server/dist/install/global-file-assets.js +1 -1
- package/node_modules/@weavecode/server/dist/install/init-files.js +2 -2
- package/node_modules/@weavecode/server/dist/install/install-ledger.js +1 -1
- package/node_modules/@weavecode/server/dist/install/installer.js +1 -1
- package/node_modules/@weavecode/server/dist/install/library-index.js +1 -1
- package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-install.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-rows.js +1 -1
- package/node_modules/@weavecode/server/dist/install/plugin-templates.js +1 -1
- package/node_modules/@weavecode/server/dist/install/project-config.js +1 -1
- package/node_modules/@weavecode/server/dist/install/reader.js +1 -1
- package/node_modules/@weavecode/server/dist/install/scan-cache.js +1 -1
- package/node_modules/@weavecode/server/dist/install/scanner.js +1 -1
- package/node_modules/@weavecode/server/dist/install/settings-mcp.js +2 -2
- package/node_modules/@weavecode/server/dist/install/updates.js +1 -1
- package/node_modules/@weavecode/server/dist/market/builtin.js +1 -1
- package/node_modules/@weavecode/server/dist/market/identity.js +1 -1
- package/node_modules/@weavecode/server/dist/market/import.js +2 -2
- package/node_modules/@weavecode/server/dist/market/refresh.js +1 -1
- package/node_modules/@weavecode/server/dist/market/resolve.js +1 -1
- package/node_modules/@weavecode/server/dist/market/updates.js +1 -1
- package/node_modules/@weavecode/server/dist/registry.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/hook-dispatches.js +5 -5
- package/node_modules/@weavecode/server/dist/repositories/hook-events.d.ts +1 -1
- package/node_modules/@weavecode/server/dist/repositories/hook-events.js +5 -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 +2 -2
- package/node_modules/@weavecode/server/dist/repositories/push-subscriptions.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/session-watches.js +4 -4
- package/node_modules/@weavecode/server/dist/repositories/sessions.d.ts +11 -1
- package/node_modules/@weavecode/server/dist/repositories/sessions.js +4 -2
- package/node_modules/@weavecode/server/dist/repositories/uploads.d.ts +14 -4
- package/node_modules/@weavecode/server/dist/repositories/uploads.js +11 -11
- package/node_modules/@weavecode/server/dist/statusline/cache-sweeper.js +1 -1
- package/node_modules/@weavecode/server/dist/statusline/generator.js +1 -1
- package/node_modules/@weavecode/server/dist/statusline/manager.js +3 -3
- package/node_modules/@weavecode/server/dist/surfaces.d.ts +3 -1
- 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-DA-K085F.js → abnfDiagram-WEYOIA3C-CbIFQh0R.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{arc-BI1jnmdZ.js → arc-DH8-rYAa.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{architectureDiagram-ZHVYKT53-DbdBgric.js → architectureDiagram-ZHVYKT53-qnv6S0sc.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-BPRBmzb-.js → blockDiagram-RJAE7QA3-pT5eO-cB.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-C4D5sRs1.js → c4Diagram-XDPPPE54-DHDBDMb1.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/channel-BHPeeuzN.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-9ZSKiNU3.js → chunk-2E7WHVMD-CT951PH5.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-i0AOjw_8.js → chunk-2Q5K7J3B-E5AD7_ZY.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-DTpLfX1H.js → chunk-4EMNKR2T-DWz9qkcy.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-55XCU76K-COQYRD4q.js → chunk-55XCU76K-D-SgWD8w.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-VsftEbvo.js → chunk-5VM5RSS4-ci6YzbO5.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-DonektJN.js → chunk-JWPE2WC7-CY4mr2f4.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-CaKUwuul.js → chunk-VQ5W62QI-CON8zyg8.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-XXDRQBXY-DXH3D_MT.js → chunk-XXDRQBXY-DXXXZ4pW.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-ZCHMQSOR-COwyAuGn.js → chunk-ZCHMQSOR-CukvPvkM.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-DEvMZ6mX.js → classDiagram-v2-4MYWR3UA-GiWZ9xtF.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cose-bilkent-JH36ORCC-6JBJHfH6.js → cose-bilkent-JH36ORCC-D7aJ-akq.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-C4GM4sjT.js → cynefin-EF2NZ3EQ-9B__MaRM.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{cynefinDiagram-WF24UDRP-Cqgi0MBP.js → cynefinDiagram-WF24UDRP-B2ujZh2k.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{dagre-NK4GIZVX-CljrnkCY.js → dagre-NK4GIZVX-nHaB6IWf.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-CBK3MWTC-C3PyOj5J.js → diagram-CBK3MWTC-xKfjDvgr.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-I5XIIV2D-I5brQlaZ.js → diagram-I5XIIV2D-BHT2-5mY.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-BX9uFNbU.js → diagram-ODIL2UCW-CckywF4W.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-y7D-VmqJ.js → diagram-PFBEJUXE-Dpjlc7Wh.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-RJA3I4VV-DLUL8W42.js → diagram-RJA3I4VV-M6WznOaW.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-DLCC3ILi.js → diagram-TYUNFSNR-DgRJ3zL1.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ebnfDiagram-V4P3TTPT-D7vALia7.js → ebnfDiagram-V4P3TTPT-BzzVN__a.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ-Ct2_hatz.js → elk-QONTBCTQ-Ch6Gs9G9.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-DxLai58T.js → erDiagram-KYQIGQAA-COxT-Pxb.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-AWn2IHrF.js → flowDiagram-IUGLLWBU-CJVWnTBa.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ganttDiagram-R7GPNTJY-DmRHd4Wz.js → ganttDiagram-R7GPNTJY-BkRpWPUl.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{gitGraphDiagram-PDYL7XHY-Ccj-t3zg.js → gitGraphDiagram-PDYL7XHY-Ba8BJcvZ.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/index-CtifxEiF.css +11 -0
- package/node_modules/@weavecode/server/web/dist/assets/index-FwH9INgS.js +1090 -0
- package/node_modules/@weavecode/server/web/dist/assets/{infoDiagram-MVDRKAX5-BHquFlQa.js → infoDiagram-MVDRKAX5-HTQ5FUNK.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-CVogEbdm.js → ishikawaDiagram-HPEHV2GE-BNjEDIZy.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-DC9XG9oh.js → journeyDiagram-BOSHW7O7-Cao6h91a.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-C_eu7DC_.js → kanban-definition-FNSA4HC5-CXIx2CHQ.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{linear-keTbWHJ-.js → linear-65WmlvQb.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-4sbg0MnY.js → mermaid.core-D39fi_iR.js} +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-kMQS0S2l.js → mindmap-definition-6OY57UG3-DHqpz_AK.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{pegDiagram-ECIUJNBX-DcUFoEwP.js → pegDiagram-ECIUJNBX-Cpy1nsER.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{pieDiagram-GNMPY74T-BQJ7WDCx.js → pieDiagram-GNMPY74T-B1IyNqzr.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-C7Oi1-sq.js → quadrantDiagram-D57K4MC3-zSM6o7mB.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{railroadDiagram-Y72NRBL7-CEF2QbOF.js → railroadDiagram-Y72NRBL7-oM4XJIwA.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-CTjjFS7X.js → requirementDiagram-EQYSW5RA-CbCLBjHf.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-j0S5kubS.js → sankeyDiagram-SY24JHO5-BucVk6EP.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-B76EsZp4.js → sequenceDiagram-BLEHNHQU-Dg8CYEnT.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{sizeCapture-INFHLROL-r0DZuqAy.js → sizeCapture-INFHLROL-C51zb7Oc.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-B4DR9LHz.js → stateDiagram-v2-A6IESKWZ-BvK2l3is.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{swimlanes-B3ENRKFQ-Dbcl85ro.js → swimlanes-B3ENRKFQ-Ds7QOfXW.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-ByBF02UJ.js +8 -0
- package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-BlBXXRNf.js → timeline-definition-JXYKGLGB-CadU4Qq4.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-Ck1M0dpc.js → usecaseDiagram-WPOLBNNX-BYuZwTDZ.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-N8B-ohWk.js → vennDiagram-Q3Y3IDCW-C7zgxe07.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-DX-AMXq_.js → wardleyDiagram-IVAIDKWA-DA4Otf4s.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-4fgL48Yl.js → xychartDiagram-4URNHDU4-Bs5YGwMU.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/index.html +2 -2
- package/node_modules/@weavecode/server/web/dist/sw.js +14 -12
- package/node_modules/@weavecode/templates/package.json +2 -2
- package/package.json +6 -6
- package/node_modules/@weavecode/server/web/dist/assets/channel-DcCJrvon.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/index-BSxzia7U.js +0 -1031
- package/node_modules/@weavecode/server/web/dist/assets/index-CEpJpR7P.css +0 -11
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-CZ_6SSBd.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as
|
|
1
|
+
import{spawn as p}from"node:child_process";import{defaultKill as f}from"../headless-runner.js";import{tmpdir as l}from"node:os";import{isImageMediaType as w}from"../../repositories/uploads.js";export function wireTextOf(e,t){const o=e.attachments;return!o||o.length===0?e.text:t(e.sessionId)?.attach?.composePrompt(e.text,o)??e.text}export function hasImages(e){return(e.attachments??[]).some(t=>w(t.mediaType))}export function spawnOnce(e,t,o,i){const u=i??((a,n,r)=>p(a,[...n],r));return new Promise((a,n)=>{const r=u(e,t,{cwd:l(),windowsHide:!0,stdio:["ignore","pipe","pipe"]}),d=[];r.stdout?.on("data",s=>d.push(s)),r.stderr?.on("data",s=>d.push(s));const m=setTimeout(()=>{if(r.pid!==void 0)try{f(r.pid)}catch{}n(new Error(`queue timeout after ${o}ms`))},o);r.on("error",s=>{clearTimeout(m),n(s)}),r.on("exit",s=>{if(clearTimeout(m),s===0){a();return}const c=Buffer.concat(d).toString("utf8").slice(-500);n(new Error(`queue exit ${s}${c?`: ${c}`:""}`))})})}export function settleDelivered(e,t,o){const i={...t,status:"delivered",via:o,settledAt:new Date().toISOString()};return e.setMemory(i),e.awaitAck(t.sessionId,t.id),e.commandModeOf(t.text,t.sessionId)?e.armCommandAck(t.id):e.armAckWatch(i),e.emit({kind:"message.delivered",messageId:t.id,sessionId:t.sessionId,at:new Date().toISOString()}),i}
|
|
@@ -2,20 +2,28 @@ import type { MessagingSurface } from '@weavecode/harness';
|
|
|
2
2
|
import type { ProjectRepository } from '../../repositories/projects.js';
|
|
3
3
|
import type { SessionRepository } from '../../repositories/sessions.js';
|
|
4
4
|
import type { HookEventRepository } from '../../repositories/hook-events.js';
|
|
5
|
-
import type { AnswerResult,
|
|
5
|
+
import type { AnswerResult, PromptTerminal } from '../message-deliverer.js';
|
|
6
6
|
/**
|
|
7
7
|
* 键序注入域(会话控制面)的共享落点解析与常量:作答 / 中断 / 关 pane / 模式 /
|
|
8
8
|
* 模型 / 思考强度 / 旁路会话全部经由「会话 → 项目 → 终端通道 → pane」这一条
|
|
9
9
|
* 解析链,失败原因是**可判定的语义拒绝**(404/409),调用方原样回给 HTTP。
|
|
10
10
|
*/
|
|
11
|
-
/**
|
|
11
|
+
/** 裸 ESC(没有开 Kitty 键盘协议的宿主用它;claude 里连打两次是历史回退菜单)。 */
|
|
12
12
|
export declare const ESC = "\u001B";
|
|
13
|
+
/** Kitty **键盘协议**的 Esc(CSI 27 u)。claude 的 TUI 开着该协议,
|
|
14
|
+
* 裸 `0x1b` 会被当成一个转义序列的开头丢掉——手按 Esc 有效、注入裸 ESC 无效的
|
|
15
|
+
* 真因就在这里(2026-10-30 活体实测:`ESC[27u` 1 秒内中断,裸 `0x1b` 观察 8 秒
|
|
16
|
+
* 纹丝不动)。同理 Ctrl+C 的真实按键形态是 `ESC[99;5u`。 */
|
|
17
|
+
export declare const ESC_KITTY = "\u001B[27u";
|
|
18
|
+
/** Kitty 键盘协议的 Ctrl+C(CSI 99;5 u):宿主开着该协议时裸 `0x03` 不被认。 */
|
|
19
|
+
export declare const CTRL_C_KITTY = "\u001B[99;5u";
|
|
13
20
|
/** 执行模式切换键 = 一记 Shift+Tab(固定死在服务端,不当参数收)。 */
|
|
14
21
|
export declare const SHIFT_TAB = "\u001B[Z";
|
|
15
22
|
/** 手动提交键 = 一记回车(提交宿主输入框里现成的内容;与层② 补打同一字节)。 */
|
|
16
23
|
export declare const ENTER = "\r";
|
|
17
|
-
/**
|
|
18
|
-
|
|
24
|
+
/** 中断梯子的兜底档 = 一记 Ctrl+B。纯控制字节、不属于任何转义序列,宿主开着
|
|
25
|
+
* Kitty 键盘协议也照收(该窗口屏上提示的正是 `(ctrl+b to run in background)`)。 */
|
|
26
|
+
export declare const CTRL_B = "\u0002";
|
|
19
27
|
/** 模型名形态:不含空白/控制字符、≤128 字符(贴宿主 `/model` 的 `\S*` 文法)。 */
|
|
20
28
|
export declare const MODEL_NAME: RegExp;
|
|
21
29
|
export declare const modelCommand: (name: string) => string;
|
|
@@ -37,22 +45,24 @@ export interface KeysTargetDeps {
|
|
|
37
45
|
hookEvents: Pick<HookEventRepository, 'listBySession'>;
|
|
38
46
|
/** 层② 通道现取(null = 未装配)。 */
|
|
39
47
|
terminalChannel(): PromptTerminal | null;
|
|
40
|
-
/** pane 定位(locator 优先、标题+cwd
|
|
48
|
+
/** pane 定位(locator 优先、标题+cwd 回落)。 */
|
|
41
49
|
terminalPaneFor(session: {
|
|
42
50
|
sessionId: string;
|
|
43
51
|
title: string | null;
|
|
44
52
|
}, project: {
|
|
45
53
|
path: string;
|
|
46
|
-
}
|
|
54
|
+
}): Promise<{
|
|
47
55
|
id: string;
|
|
48
56
|
} | null>;
|
|
57
|
+
/** 该会话的 pane 定位是否被另一个会话占着(fork 继承同一 env);有值 = 不可击键。 */
|
|
58
|
+
paneEnvConflictOf?(sessionId: string): string | null;
|
|
49
59
|
}
|
|
50
60
|
/**
|
|
51
61
|
* 键序注入路径(作答 / 中断 / 关 pane / 模式 / 模型 / 档位 / 旁路)共用的落点解析。
|
|
52
62
|
* 两条 409 是给用户看的(web 直拼在「停止失败:」这类动作名后面),故写成中文
|
|
53
63
|
* 修法,动作名随调用方换。
|
|
54
64
|
*/
|
|
55
|
-
export declare function sessionKeysTarget(deps: KeysTargetDeps, sessionId: string, action?: string
|
|
65
|
+
export declare function sessionKeysTarget(deps: KeysTargetDeps, sessionId: string, action?: string): Promise<{
|
|
56
66
|
ok: true;
|
|
57
67
|
terminal: PromptTerminal;
|
|
58
68
|
paneId: string;
|
|
@@ -63,12 +73,12 @@ export declare function sessionKeysTarget(deps: KeysTargetDeps, sessionId: strin
|
|
|
63
73
|
export declare function effortLevelsOf(hookEvents: Pick<HookEventRepository, 'listBySession'>, sessionId: string): string[];
|
|
64
74
|
/** 旁路会话面(claude = `/btw`)现取:判不出 harness / 面缺席 = null。 */
|
|
65
75
|
export declare function sideQuestionSurfaceOf(hookEvents: Pick<HookEventRepository, 'listBySession'>, sessionId: string, surfaceFor: ((harness: import('@weavecode/core').Harness) => MessagingSurface) | undefined): MessagingSurface | null;
|
|
66
|
-
/** pane 定位(层② 共用):locator 优先、标题+cwd
|
|
76
|
+
/** pane 定位(层② 共用):locator 优先、标题+cwd 回落。 */
|
|
67
77
|
export declare function locateTerminalPane(terminal: PromptTerminal | null, paneEnvs: ReadonlyMap<string, Record<string, string>>, session: {
|
|
68
78
|
sessionId: string;
|
|
69
79
|
title: string | null;
|
|
70
80
|
}, project: {
|
|
71
81
|
path: string;
|
|
72
|
-
}
|
|
82
|
+
}): Promise<{
|
|
73
83
|
id: string;
|
|
74
84
|
} | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HARNESS_SESSION_CONTROL as
|
|
1
|
+
import{HARNESS_SESSION_CONTROL as f,isHarness as c}from"@weavecode/core";import{normalizeDirKey as E}from"../../daemon/opener.js";export const ESC="\x1B",ESC_KITTY="\x1B[27u",CTRL_C_KITTY="\x1B[99;5u",SHIFT_TAB="\x1B[Z",ENTER="\r",CTRL_B="",MODEL_NAME=/^[^\s\x00-\x1f\x7f]{1,128}$/,modelCommand=u=>`/model ${u}`,effortCommand=u=>`/effort ${u}`,ANSWER_ATOM=/^(?:[1-9]|y|n|d|\t|\r|\x1b\[B|\x1b\[Z)$/,ANSWER_TEXT=/^[^\x00-\x1f\x7f]*$/,ANSWER_ATOM_GAP_MS=120,sleep=u=>new Promise(n=>setTimeout(n,u));export async function sessionKeysTarget(u,n,t="\u51FB\u952E"){const e=u.sessions.getBySessionId(n);if(!e)return{ok:!1,status:404,error:"Session not found"};if(e.projectId==null)return{ok:!1,status:400,error:"Session is not bound to a project"};const r=u.projects.getById(e.projectId);if(!r)return{ok:!1,status:404,error:"Project not found"};const i=u.terminalChannel();if(!i)return{ok:!1,status:409,error:`\u7EC8\u7AEF\u901A\u9053\u672A\u88C5\u914D\uFF0C\u65E0\u6CD5\u8FDC\u7A0B${t}`};const s=u.paneEnvConflictOf?.(n)??null;if(s)return{ok:!1,status:409,error:`\u8FD9\u4E2A\u4F1A\u8BDD\u7684\u7EC8\u7AEF\u5B9A\u4F4D\u88AB\u53E6\u4E00\u4E2A\u4F1A\u8BDD\uFF08${s.slice(0,8)}\uFF09\u5360\u7740\uFF08fork \u7EE7\u627F\u4E86\u540C\u4E00\u4E2A pane\uFF09\uFF0C\u4E3A\u907F\u514D\u628A${t}\u6253\u8FDB\u522B\u4EBA\u7684\u7EC8\u7AEF\u5DF2\u62D2\u7EDD`};const l=await u.terminalPaneFor(e,r);return l?{ok:!0,terminal:i,paneId:l.id}:{ok:!1,status:409,error:`\u627E\u4E0D\u5230\u4F1A\u8BDD\u6240\u5728\u7684\u7EC8\u7AEF\u7A97\u53E3\u2014\u2014\u8FD9\u4E2A\u4F1A\u8BDD\u6240\u5728\u7EC8\u7AEF\u6CA1\u6709\u53EF\u7528\u7684\u8FDC\u7A0B${t}\u901A\u9053`}}export function effortLevelsOf(u,n){const t=u.listBySession(n,1),e=t[t.length-1]?.source;return c(e)?f[e]?.effortLevels??[]:[]}export function sideQuestionSurfaceOf(u,n,t){const e=u.listBySession(n,1),r=e[e.length-1]?.source;return c(r)?t?.(r)??null:null}export async function locateTerminalPane(u,n,t,e){if(!u)return null;const r=n.get(t.sessionId);if(r){const o=await u.locatePane?.(r).catch(()=>null);if(o)return{id:o}}if(!t.title)return null;const i=t.title.replace(/^[✻✽✶✳✢⋅◦✦✧∘◐◑◒◓*]+\s*/,""),s=E(e.path,process.platform);let l;try{l=await u.listPanes()}catch{return null}const a=l.filter(o=>o.title!=null&&o.cwd!=null&&s!=null&&o.title.replace(/^[✻✽✶✳✢⋅◦✦✧∘◐◑◒◓*]+\s*/,"")===i&&E(o.cwd,process.platform)===s);return a.length===1?a[0]:null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pidAliveOf as f}from"../../daemon/claude-liveness.js";import{combinedLivenessOf as
|
|
1
|
+
import{pidAliveOf as f}from"../../daemon/claude-liveness.js";import{combinedLivenessOf as m}from"../../daemon/liveness.js";import{appendPromptbox as c,removePromptboxEntries as p}from"../promptbox.js";export const OFFLINE_ERROR="Session is not running";export function appendQueueEntry(n,s,e){c(n,s,[{id:e.id,sessionId:e.sessionId,text:e.text,oneWay:e.oneWay===!0,...e.forceTerminal===!0?{forceTerminal:!0}:{},...e.attachments&&e.attachments.length>0?{attachments:e.attachments}:{}}])}export function sessionJudgedDead(n,s,e=m()){const o=n.livenessRowOf(s);return o?f(o,e)===!1:!1}export function failOffline(n,s,e){const o=new Date().toISOString(),i={...e,status:"failed",reason:"offline",error:OFFLINE_ERROR,settledAt:o};return n.set(e.id,i),s({kind:"message.finished",messageId:e.id,sessionId:e.sessionId,status:"failed",at:o}),i}export function failQueuedOffline(n,s,e,o,i,a){const r=n.sessions.getBySessionId(i),d=r?.projectId==null?null:n.projects.getById(r.projectId);if(!(!d||a.length===0)){for(const t of a)failOffline(e,o,{id:t.id,sessionId:i,text:t.text,...t.attachments&&t.attachments.length>0?{attachments:t.attachments}:{},mode:"prompt",oneWay:t.oneWay===!0,channel:"prompt",status:"pending",at:t.at});p(s,d.token,new Set(a.map(t=>t.id)))}}
|
|
@@ -23,8 +23,8 @@ export interface RelayDeps {
|
|
|
23
23
|
awaitAck(sessionId: string, messageId: string): void;
|
|
24
24
|
/** 暂停闸(失败时置)。 */
|
|
25
25
|
stall(sessionId: string, msg: PipeMessage, reason: 'failed'): void;
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/** 命令形态判定(触发符表归能力面)。 */
|
|
27
|
+
commandModeOf(text: string, sessionId: string): unknown;
|
|
28
28
|
armAckWatch(msg: PipeMessage): void;
|
|
29
29
|
armCommandAck(messageId: string, onRelease: (sessionId: string) => void): void;
|
|
30
30
|
/** 中继闸释放后若还有积压,续排下一批。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{tmpdir as
|
|
1
|
+
import{tmpdir as r}from"node:os";export function runRelay(e,i,n,s,o){try{return e.headless.run({sessionId:`prompt-relay:${i.sessionId}`,cwd:r(),prompt:n.instruction(s,o,{oneWay:i.oneWay===!0}),spec:{supported:!0,bin:n.bin,args:()=>[...n.args],promptStdin:!0},bin:e.bin??process.env.WEAVE_CLAUDE_BIN??n.bin,timeoutMs:e.relayTimeoutMs??0,detached:!1,onSettle:t=>settleRelay(e,i.id,t)})}catch(t){return settleRelay(e,i.id,{status:"failed",output:null,error:t instanceof Error?t.message:String(t)}),!0}}export function settleRelay(e,i,n){const s=e.getMemory(i);if(!s)return;if(n.status==="succeeded"){e.onReleased(s.sessionId);const t={...s,status:"delivered",settledAt:new Date().toISOString()};e.setMemory(t),e.commandModeOf(s.text,s.sessionId)?e.armCommandAck(i,e.onReleased):e.armAckWatch(t),e.emit({kind:"message.delivered",messageId:i,sessionId:s.sessionId,at:new Date().toISOString()});return}if(s.acked===!0){const t=new Date().toISOString();e.setMemory({...s,status:"delivered",settledAt:t}),e.emit({kind:"message.delivered",messageId:i,sessionId:s.sessionId,at:t});return}const o={...s,status:"failed",error:n.error??`prompt relay ${n.status}`,settledAt:new Date().toISOString()};e.setMemory(o),e.stall(s.sessionId,o,"failed"),e.emit({kind:"message.finished",messageId:i,sessionId:s.sessionId,status:"failed",at:new Date().toISOString()})}export{r as tmpdir};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{appendOutbox as
|
|
1
|
+
import{appendOutbox as p}from"../mirror.js";export function resolveChannel(e,s,n,o,t){if(n==="prompt")return t.prompt||t.queuedPrompt||s()?"prompt":{reason:t.unsupportedReasons?.prompt??`Harness "${t.harness}" has no native prompt channel and the configured terminal cannot inject text`};if(n==="inject"||n==="headless")return(n==="inject"?t.inject:t.headless)?n:{reason:unsupportedReason(t,n)};const i=e.turnOpenOf(o)?"inject":"headless";return(i==="inject"?t.inject:t.headless)?i:{reason:unsupportedReason(t,i)}}export function unsupportedReason(e,s){return e.unsupportedReasons?.[s]??`Harness "${e.harness}" does not support the ${s} messaging channel`}export function renderEnvelope(e,s,n){return n.renderEnvelope?.(e,s)??`[weave message] from=${s.fromLabel} at=${s.at} mode=${s.mode}
|
|
2
2
|
|
|
3
|
-
${e}`}export function deliverInject(e,
|
|
3
|
+
${e}`}export function deliverInject(e,s,n,o,t,i){const d=renderEnvelope(i,o,t);p(e.hooksDir,n,[{sessionId:s.sessionId,text:d}]);const r={...s,status:"injected",settledAt:new Date().toISOString()};return e.memory.set(r.id,r),e.bus.emit({kind:"message.delivered",messageId:r.id,sessionId:s.sessionId,at:new Date().toISOString()}),{ok:!0,messageId:r.id,status:"injected",message:r}}export function deliverHeadless(e,s,n,o,t,i){const d=t.headless,r={...s,status:"running"};e.memory.set(r.id,r);const u={settled:!1};try{e.headless.run({sessionId:r.sessionId,cwd:n,prompt:renderEnvelope(i,o,t),spec:d,bin:e.bin??process.env.WEAVE_CLAUDE_BIN??d.bin,timeoutMs:e.timeoutMs,onSettle:a=>m(e,r,u,a)})||m(e,r,u,{status:"failed",output:null,error:"Session already has a running run"})}catch(a){m(e,r,u,{status:"failed",output:null,error:a instanceof Error?a.message:String(a)})}return{ok:!0,messageId:r.id,status:"running",message:e.memory.get(r.id)}}function m(e,s,n,o){if(n.settled)return;n.settled=!0;const t=e.memory.get(s.id);if(t)try{e.memory.set(s.id,{...t,status:o.status,output:o.output,error:o.error,settledAt:new Date().toISOString()}),e.bus.emit({kind:"message.finished",messageId:s.id,sessionId:s.sessionId,status:o.status,at:new Date().toISOString()})}catch{}}
|
|
@@ -6,11 +6,13 @@ import type { PipeMessage } from '../message-deliverer.js';
|
|
|
6
6
|
* 在途视图(GET /sessions/:id/messages 的数据面):promptbox 待递送 ∪ 内存态——
|
|
7
7
|
* 终态短时驻留(delivered/injected/succeeded 在 settledAt+ttl 内可见,展示
|
|
8
8
|
* via/acked),failed/timeout/暂停闸成因常驻。历史在会话自己的转录里。
|
|
9
|
+
* 例外:已执行的斜杠命令(/rewind 类,宿主不回 UPS)也常驻——它们没有认领
|
|
10
|
+
* 事件可退场,TTL 一到就消失会让「刚才那条命令呢」无从查起。
|
|
9
11
|
*/
|
|
10
12
|
export declare function listVisible(deps: {
|
|
11
13
|
sessions: Pick<SessionRepository, 'getBySessionId'>;
|
|
12
14
|
projects: Pick<ProjectRepository, 'getById'>;
|
|
13
|
-
}, hooksDir: string, memory: ReadonlyMap<string, PipeMessage>, sessionId: string, ttlMs: number): PipeMessage[];
|
|
15
|
+
}, hooksDir: string, memory: ReadonlyMap<string, PipeMessage>, sessionId: string, ttlMs: number, isCommandInput?: (text: string) => boolean): PipeMessage[];
|
|
14
16
|
/**
|
|
15
17
|
* 在途计数(sessionId → 条数):队列 pending(未送达)∪ 内存 delivering/running
|
|
16
18
|
* (在飞)。会话行角标用——终态(injected/delivered/succeeded/…)不计。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{combinedLivenessOf as
|
|
1
|
+
import{combinedLivenessOf as p}from"../../daemon/liveness.js";import{readAllPromptbox as m,readPromptbox as g}from"../promptbox.js";import{sessionJudgedDead as h}from"./queue.js";function I(n,s){return{id:s.id,sessionId:n,text:s.text,...s.attachments&&s.attachments.length>0?{attachments:s.attachments}:{},mode:"prompt",oneWay:s.oneWay===!0,...s.forceTerminal===!0?{forceTerminal:!0}:{},channel:"prompt",status:"pending",at:s.at}}export function listVisible(n,s,o,i,e,u=()=>!1){const f=Date.now(),r=[],a=n.sessions.getBySessionId(i);if(a?.projectId!=null){const t=n.projects.getById(a.projectId);if(t)for(const c of g(s,t.token))c.sessionId===i&&r.push(I(i,c))}for(const t of o.values()){if(t.sessionId!==i)continue;if(t.stalled===!0||t.status==="delivering"||t.status==="running"){r.push(t);continue}if(t.status==="failed"||t.status==="timeout"){r.push(t);continue}const c=t.settledAt?Date.parse(t.settledAt):NaN,l=t.status==="delivered"&&t.acked!==!0,d=t.status==="delivered"&&t.acked===!0&&u(t.text);(l||d||!Number.isNaN(c)&&f-c<e)&&r.push(t)}return r.sort((t,c)=>t.at<c.at?-1:1)}export function listInflightCounts(n,s){const o=new Map,i=e=>{o.set(e,(o.get(e)??0)+1)};for(const e of m(n))i(e.sessionId);for(const e of s.values())(e.status==="delivering"||e.status==="running")&&i(e.sessionId);return o}export async function sessionTerminals(n,s,o,i,e){const u={};if(e&&e.size>0){for(const a of e)u[a]=null;e.clear()}if(!s?.locateScreens||o.size===0)return u;const f={},r=n.livenessOf?.()??p();for(const[a,t]of o){if(h(n.sessions,a,r)){o.delete(a),i(),u[a]=null;continue}f[a]=t}return{...u,...await s.locateScreens(f)}}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{INJECTABLE_EVENTS as b,TITLE_EFFECTIVE_EVENTS as S,hookSourceHarness as w}from"@weavecode/core";import{createPluginLogger as P}from"./plugin-loader.js";import{readHooksEnabled as k}from"../daemon/settings.js";import{effective as v,pluginsStateOf as
|
|
2
|
-
${
|
|
3
|
-
${
|
|
1
|
+
import{INJECTABLE_EVENTS as b,TITLE_EFFECTIVE_EVENTS as S,hookSourceHarness as w}from"@weavecode/core";import{createPluginLogger as P}from"./plugin-loader.js";import{readHooksEnabled as k}from"../daemon/settings.js";import{effective as v,pluginsStateOf as j}from"./plugin-project-state.js";import{postJson as D,runWebhook as T}from"./handlers/webhook.js";import{DISPATCH_MARKER as I,extractFilePath as h,isCrossProjectPath as W,matchesAnyGlob as C,projectLabel as O,renderTemplate as E,templateVars as A}from"./match.js";function $(c){if(!c)return null;const t=c.match(/\{[\s\S]*\}/);if(t)try{const i=JSON.parse(t[0]);if(typeof i.label=="string"&&i.label.trim())return i.label.trim()}catch{}const s=/label\s*[:=]\s*"?([A-Za-z0-9_-]+)/i.exec(c);return s?s[1]:null}const y=6e4,N=10*6e4,x=4,H=4,L=3e3;export class HookDispatcher{deps;runningWebhooks=new Set;lastClassifyAt=new Map;recentPool=new Map;activeWebhooks=0;pendingWebhooks=[];activePlugins=0;pendingPlugins=[];constructor(t){this.deps=t}async onIngest(t){try{if(!k())return{};this.deps.plugins?.notifyEvent?.(t.payload.eventType,t.payload,t.sessionId);const s={};if(t.sessionId){const e=_(t.payload);let n=null;if(e===null&&this.deps.sessionTitleOf)try{n=await this.deps.sessionTitleOf(t.sessionId)}catch{}const r=e??n;r!==null&&this.deps.sessions.applyReportedTitle(t.sessionId,r)&&this.deps.bus.emit({kind:"session.renamed",sessionId:t.sessionId,title:r,at:new Date().toISOString()});const d=this.deps.sessions.getBySessionId(t.sessionId)?.pendingTitle;if(d){s.sessionTitle=d;const p=S[t.source].includes(t.payload.eventType);(t.deliveredTitle===d&&p||e!==null)&&this.deps.sessions.confirmPendingTitle(t.sessionId,d)&&this.deps.bus.emit({kind:"session.renamed",sessionId:t.sessionId,title:d,at:new Date().toISOString()})}}const i=this.match(t);if(i.length===0)return s;const a=[],o=[],l=Date.now(),u=l+L;for(const e of i)if(this.deps.bus.emit({kind:"rule.matched",ruleId:e.id,eventId:t.eventId,sessionId:t.sessionId,at:new Date(l).toISOString()}),e.handler.type!=="log"){if(e.handler.type==="manual"||e.handler.type==="inject"){if(this.dedupe(e,t,l))continue;const n=E(e.handler.template,A({event:t.payload.eventType,tool:t.payload.toolName,filePath:h(t.payload.toolInput),cwd:t.payload.cwd,session:t.sessionId,project:O(t.project.path),rule:e.name}))+`
|
|
2
|
+
${I}`,r=e.handler.type==="inject"?"injected":"pending";this.createDispatch(e,t,{prompt:n,status:r,mode:e.handler.type==="inject"?"auto":"manual"}),e.handler.type==="inject"&&(e.filter.crossProjectOnly?o.push(n):a.push(n));continue}if(e.handler.type==="webhook"){if(this.runningWebhooks.has(e.id))continue;this.runningWebhooks.add(e.id);const n=this.createDispatch(e,t,{prompt:`webhook ${e.handler.url}`,status:"running",mode:"auto"});this.deps.bus.emit({kind:"dispatch.started",ruleId:e.id,dispatchId:n.id,sessionId:t.sessionId,at:new Date().toISOString()}),this.runWebhookAsync(e,this.summary(e,t),n.id);continue}if(e.handler.type==="classify"){const n=this.turnText(t);if(!n)continue;const r=e.handler,d=n.toLowerCase();if(r.prefilter&&r.prefilter.length>0&&!r.prefilter.some(m=>d.includes(m.toLowerCase())))continue;const p=`classify:${e.id}`,f=r.cooldownMs??N;if(l-(this.lastClassifyAt.get(p)??0)<f||this.runningWebhooks.has(p))continue;this.lastClassifyAt.set(p,l),this.runningWebhooks.add(p);const g=this.createDispatch(e,t,{prompt:`classify \u2192 ${r.routes.map(m=>m.label).join("/")}`,status:"running",mode:"auto"});this.deps.bus.emit({kind:"dispatch.started",ruleId:e.id,dispatchId:g.id,sessionId:t.sessionId,at:new Date().toISOString()}),this.runClassifyAsync(e,t,g.id,n);continue}if(e.handler.type==="plugin"){const n=this.deps.plugins;if(!n)continue;const r=n.getHandler(e.handler.pluginId,e.handler.handlerType);if(!r||this.dedupe(e,t,l))continue;if(!this.injectable(t)){this.runPluginDetached(e,t,n,r);continue}const d=u-Date.now();if(d<=0)continue;const p=await this.runPluginHandler(e,t,n,r,d);if(!p)continue;p.prompt&&this.createDispatch(e,t,{prompt:p.prompt+`
|
|
3
|
+
${I}`,status:"pending",mode:"auto"}),p.additionalContext&&o.push(p.additionalContext)}}return(a.length>0||o.length>0)&&(s.additionalContext=[...a,...o].join(`
|
|
4
4
|
|
|
5
5
|
`)),o.length>0&&(s.deferred=o.join(`
|
|
6
6
|
|
|
7
|
-
`)),s}catch{return{}}}createDispatch(
|
|
8
|
-
${
|
|
7
|
+
`)),s}catch{return{}}}createDispatch(t,s,i){const a=this.deps.dispatches.insert({ruleId:t.id,eventId:s.eventId,sessionId:s.sessionId,...i});return this.deps.bus.emit({kind:"dispatch.created",ruleId:t.id,dispatchId:a.id,status:i.status,mode:a.mode,sessionId:s.sessionId,at:a.startedAt}),a}dedupe(t,s,i){const a=`${t.id}:${s.sessionId??""}`,o=this.recentPool.get(a);return o!==void 0&&i-o<y?!0:(this.recentPool.set(a,i),this.trimDedupe(i),!1)}match(t){const s=this.deps.pluginStates,i=s?j(t.project.meta).enabled:null;let a=null;return this.deps.registry.candidates(t.payload.eventType,s?{includeDisabled:!0}:void 0).filter(o=>{const l=w(o.source);if(l!==null&&l!=="any"&&l!==t.source||o.projectId!==null&&o.projectId!==t.project.id)return!1;if(o.pluginId!==null){if(!o.enabled&&i?.[o.pluginId]!==!0||s&&!v(t.project,o.pluginId,{states:s}))return!1}else if(!o.enabled)return!1;const u=o.filter;if(u.toolNames?.length&&(!t.payload.toolName||!u.toolNames.includes(t.payload.toolName)))return!1;if(u.pathGlobs?.length){const e=h(t.payload.toolInput);if(!e||!C(e,u.pathGlobs))return!1}if(u.crossProjectOnly){const e=h(t.payload.toolInput)??t.payload.cwd;if(!e||(a??=this.deps.projects.list().map(n=>n.path).filter(n=>n!==t.project.path),!W(e,t.project.path,a)))return!1}return!0})}injectable(t){const s=t.payload.eventType;return s!==null&&b[t.source].includes(s)}async runPluginHandler(t,s,i,a,o){if(t.handler.type!=="plugin")return;const{pluginId:l}=t.handler,u=P(l),e=o===void 0?t.timeoutMs:Math.min(t.timeoutMs,o);let n;try{const r=(async()=>{await this.acquirePluginSlot();try{return await a.execute({event:s.payload,rule:t,config:i.getConfig(l),logger:u})}finally{this.releasePluginSlot()}})(),d=await Promise.race([r,new Promise((p,f)=>{n=setTimeout(()=>f(new Error("plugin handler timeout")),e)})]);return d&&typeof d=="object"?d:void 0}catch{return}finally{n&&clearTimeout(n)}}async runPluginDetached(t,s,i,a){try{const o=await this.runPluginHandler(t,s,i,a);if(!o?.prompt)return;this.createDispatch(t,s,{prompt:o.prompt+`
|
|
8
|
+
${I}`,status:"pending",mode:"auto"})}catch{}}summary(t,s){return{ruleId:t.id,ruleName:t.name,projectId:s.project.id,sessionId:s.sessionId,event:s.payload.eventType,toolName:s.payload.toolName,filePath:h(s.payload.toolInput),cwd:s.payload.cwd,at:new Date().toISOString()}}turnText(t){const s=t.payload.raw?.last_assistant_message;return typeof s=="string"?s.trim():""}async runClassifyAsync(t,s,i,a){const o=t.handler;if(o.type!=="classify")return;const l=`classify:${t.id}`;try{const u=await this.deps.classify?.({sessionId:s.sessionId??"",prompt:`${o.prompt}
|
|
9
9
|
|
|
10
10
|
\u672C\u8F6E\u6700\u7EC8\u8F93\u51FA\uFF1A
|
|
11
|
-
${a.slice(0,8e3)}`}),
|
|
11
|
+
${a.slice(0,8e3)}`}),e=$(u),n=e?o.routes.find(d=>d.label.toLowerCase()===e.toLowerCase()):void 0;if(!n){this.deps.dispatches.updateStatus(i,{status:"succeeded",output:e?`label=${e} (no route)`:"no label",finished:!0}),this.deps.bus.emit({kind:"dispatch.finished",ruleId:t.id,dispatchId:i,status:"succeeded",sessionId:s.sessionId,at:new Date().toISOString()});return}const r=await D(n.url,n.secret,{...this.summary(t,s),label:e,verdict:u?.slice(0,500)},this.deps.fetchImpl);this.deps.dispatches.updateStatus(i,{status:r.status,output:`label=${e} ${r.output??""}`.trim(),error:r.error??null,finished:!0}),this.deps.bus.emit({kind:"dispatch.finished",ruleId:t.id,dispatchId:i,status:r.status,sessionId:s.sessionId,at:new Date().toISOString()})}catch(u){this.deps.dispatches.updateStatus(i,{status:"failed",error:String(u),finished:!0}),this.deps.bus.emit({kind:"dispatch.finished",ruleId:t.id,dispatchId:i,status:"failed",sessionId:s.sessionId,at:new Date().toISOString()})}finally{this.runningWebhooks.delete(l)}}async runWebhookAsync(t,s,i){await this.acquireWebhookSlot();try{const a=await T(t,s,this.deps.fetchImpl);this.deps.dispatches.updateStatus(i,{status:a.status,output:a.output??null,error:a.error??null,finished:!0}),this.deps.bus.emit({kind:"dispatch.finished",ruleId:t.id,dispatchId:i,status:a.status,sessionId:s.sessionId,at:new Date().toISOString()})}catch(a){this.deps.dispatches.updateStatus(i,{status:"failed",error:String(a),finished:!0}),this.deps.bus.emit({kind:"dispatch.finished",ruleId:t.id,dispatchId:i,status:"failed",sessionId:s.sessionId,at:new Date().toISOString()})}finally{this.runningWebhooks.delete(t.id),this.releaseWebhookSlot()}}acquireWebhookSlot(){return this.activeWebhooks<x?(this.activeWebhooks++,Promise.resolve()):new Promise(t=>{this.pendingWebhooks.push(()=>{this.activeWebhooks++,t()})})}releaseWebhookSlot(){this.activeWebhooks--;const t=this.pendingWebhooks.shift();t&&t()}acquirePluginSlot(){return this.activePlugins<H?(this.activePlugins++,Promise.resolve()):new Promise(t=>{this.pendingPlugins.push(()=>{this.activePlugins++,t()})})}releasePluginSlot(){this.activePlugins--;const t=this.pendingPlugins.shift();t&&t()}trimDedupe(t){if(!(this.recentPool.size<1e3))for(const[s,i]of this.recentPool)t-i>=y&&this.recentPool.delete(s)}}function _(c){const t=c.raw;if(typeof t!="object"||t===null)return null;const s=t.session_title;return typeof s=="string"&&s.length>0?s:null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isSyntheticSession as
|
|
1
|
+
import{isSyntheticSession as f,registerSyntheticSession as S,syntheticSessionIds as g}from"./synthetic-sessions.js";const y=8e3;export function createEdgeExtract(s){const d=s.concurrency??4;let o=0;return{supports(t){const r=s.harnessOf(t);return r?s.surfaceFor(r).headless?.extractArgs!=null:!1},run({sessionId:t,prompt:r}){if(o>=d)return Promise.resolve(null);const i=s.harnessOf(t),c=s.sessions.getBySessionId(t);if(!i||!c?.projectId)return Promise.resolve(null);const u=s.projects.getById(c.projectId),n=s.surfaceFor(i).headless,l=process.env.WEAVE_CLAUDE_BIN??n?.bin;if(!u||!n?.extractArgs||!l)return Promise.resolve(null);const h=S();return s.onSyntheticChange(),o++,new Promise(m=>{let a=!1;const p=e=>{a||(a=!0,o--,m(e))};s.headless.run({sessionId:h,cwd:u.path,prompt:r,spec:n,bin:l,argsOf:e=>n.extractArgs(t,e),timeoutMs:s.timeoutMs??12e4,onSettle:e=>{p(e.status==="succeeded"&&e.output?.trim()?e.output.trim().slice(0,y):null)}})||p(null)})}}}export{f as isSyntheticSession,g as syntheticSessionIds};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHmac as l}from"node:crypto";const c=5e3,
|
|
1
|
+
import{createHmac as l}from"node:crypto";const c=5e3,d=4096;export async function postJson(o,s,n,e=fetch){let r;try{r=new URL(o)}catch{return{ok:!1,status:"failed",error:`invalid url: ${o}`}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,status:"failed",error:`unsupported protocol: ${r.protocol}`};const u=JSON.stringify(n),i={"content-type":"application/json","user-agent":"weave-daemon"};s&&(i["x-weave-signature"]=`sha256=${l("sha256",s).update(u).digest("hex")}`);try{const t=await e(r,{method:"POST",headers:i,body:u,signal:AbortSignal.timeout(c)}),a=(await t.text()).slice(0,d);return t.ok?{ok:!0,status:"succeeded",output:a||`HTTP ${t.status}`}:{ok:!1,status:"failed",error:`HTTP ${t.status}`,output:a}}catch(t){const a=t instanceof Error&&(t.name==="TimeoutError"||t.name==="AbortError");return{ok:!1,status:a?"timeout":"failed",error:a?`webhook timed out after ${c}ms`:String(t)}}}export async function runWebhook(o,s,n=fetch){const e=o.handler;return e.type!=="webhook"?{ok:!1,status:"failed",error:`rule ${o.id} is not a webhook handler`}:postJson(e.url,e.secret,s,n)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{spawn as k}from"node:child_process";const
|
|
2
|
-
${
|
|
1
|
+
import{spawn as k}from"node:child_process";const L=3e5,y=32*1024,E=2e3;export class HeadlessRunner{spawnImpl;killImpl;active=new Set;livePids=new Map;constructor(t={}){this.spawnImpl=t.spawnImpl??k,this.killImpl=t.killImpl??defaultKill}isBusy(t){return this.active.has(t)}killAll(){let t=0;for(const e of this.livePids.values())try{this.killImpl(e),t++}catch{}return this.livePids.clear(),t}run(t){if(this.active.has(t.sessionId))return!1;this.active.add(t.sessionId);const e={settled:!1};try{this.watch(t,e)}catch(n){this.settle(t,e,{status:"failed",output:null,error:P(n)})}return!0}watch(t,e){const n=t.timeoutMs??L,a=t.spec.promptStdin===!0,f=t.argsOf?t.argsOf(t.sessionId):t.spec.args(t.sessionId,a?"":t.prompt),d=a&&process.platform==="win32"&&!/[\s"\\/]/.test(t.bin),T=(t.detached??!0)&&!d,m={cwd:t.cwd,detached:T,windowsHide:!0,shell:d,stdio:[a?"pipe":"ignore","pipe","pipe"],env:(()=>{const s={...process.env,WEAVE_HOOK_DISPATCH:"1"};return delete s.CLAUDE_CODE_CHILD_SESSION,s})()},i=d?this.spawnImpl([t.bin,...f].join(" "),[],m):this.spawnImpl(t.bin,f,m);if(i.pid!==void 0&&this.livePids.set(t.sessionId,i.pid),a){i.stdin?.on("error",()=>{});try{i.stdin?.write(t.prompt),i.stdin?.end()}catch{}}const I=[],p=[];let w=0,v=0;const g=(s,o,l)=>{if(o>=y)return o;const c=y-o;return s.push(l.length>c?l.subarray(0,c):l),o+Math.min(l.length,c)},h=()=>Buffer.concat([...I,...p]).toString("utf8"),H=()=>{const s=Buffer.concat(p).toString("utf8");return s.length>E?s.slice(-E):s};i.stdout?.on("data",s=>{w=g(I,w,s)}),i.stderr?.on("data",s=>{v=g(p,v,s)});const u=n>0?setTimeout(()=>{if(i.pid!==void 0)try{this.killImpl(i.pid)}catch{}this.settle(t,e,{status:"timeout",output:h(),error:`Timeout after ${n}ms`})},n):null;i.on("error",s=>{u!==null&&clearTimeout(u),this.settle(t,e,{status:"failed",output:h(),error:P(s)})}),i.on("exit",(s,o)=>{u!==null&&clearTimeout(u);const l=h();if(s===0){this.settle(t,e,{status:"succeeded",output:l,error:null});return}const c=s!==null?`exit ${s}`:`exit signal ${o??"unknown"}`,S=H();this.settle(t,e,{status:"failed",output:l,error:S?`${c}
|
|
2
|
+
${S}`:c})})}settle(t,e,n){if(!e.settled){e.settled=!0,this.active.delete(t.sessionId),this.livePids.delete(t.sessionId);try{t.onSettle(n)}catch{}}}}export function defaultKill(r){if(process.platform==="win32"){try{k("taskkill",["/PID",String(r),"/T","/F"],{windowsHide:!0,stdio:"ignore"}).on("error",()=>{})}catch{}return}try{process.kill(-r,"SIGKILL")}catch{try{process.kill(r,"SIGKILL")}catch{}}}function P(r){return r instanceof Error?r.message:String(r)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`,{encoding:"utf8",mode:384}),
|
|
1
|
+
import k from"node:net";import{chmodSync as m,mkdirSync as y,readFileSync as S,renameSync as b,writeFileSync as d}from"node:fs";import{dirname as x}from"node:path";export function inboxSocketPathOf(s){return s.startsWith("uds:")?s.slice(4):s}export function deliverViaInboxSocket(s,t,e,o={}){const c=o.platform??process.platform,n=o.timeoutMs??3e3,u=inboxSocketPathOf(t.socket);return s.requiresAuthOn(c)&&!t.token?Promise.reject(new Error(`inbox delivery requires a token on platform "${c}"`)):new Promise((a,l)=>{const p=s.frame({token:t.token,text:e});let f=!1;const h=r=>{f||(f=!0,i.destroy(),l(r))},i=k.connect(u);i.setTimeout(n),i.on("timeout",()=>h(new Error(`inbox socket timeout after ${n}ms`))),i.on("error",r=>h(r)),i.on("connect",()=>{i.write(p,r=>{r?h(r):i.end()})}),i.on("close",()=>{f||(f=!0,a())})})}export const INBOX_TARGETS_FILE="inbox-targets.json";function g(s){try{const t=JSON.parse(S(s,"utf8"));if(typeof t!="object"||t===null)return{};const e={};for(const[o,c]of Object.entries(t)){const n=c;typeof n?.socket!="string"||!n.socket||(e[o]={socket:n.socket,token:typeof n.token=="string"&&n.token?n.token:null})}return e}catch{return{}}}export class InboxSocketRegistry{file;bySession;persisted;constructor(t){this.file=t;const e=t?g(t):{};this.bySession=new Map(Object.entries(e)),this.persisted=JSON.stringify(e)}set(t,e){const o=this.bySession.get(t);if(!e?.socket){o&&(this.bySession.delete(t),this.persist());return}o&&o.socket===e.socket&&o.token===e.token||(this.bySession.set(t,e),this.persist())}get(t){return this.bySession.get(t)}forget(t){this.bySession.delete(t)&&this.persist()}persist(){if(!this.file)return;const t=JSON.stringify(Object.fromEntries(this.bySession));if(t!==this.persisted)try{y(x(this.file),{recursive:!0});const e=`${this.file}.tmp`;d(e,`${t}
|
|
2
|
+
`,{encoding:"utf8",mode:384}),b(e,this.file),m(this.file,384),this.persisted=t}catch{}}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as
|
|
2
|
-
`)}catch{return[]}const
|
|
1
|
+
import{existsSync as I,readdirSync as v,readFileSync as j,renameSync as h,unlinkSync as b,writeFileSync as E}from"node:fs";import{join as d}from"node:path";import{isMainThread as T,parentPort as m,Worker as P,workerData as k}from"node:worker_threads";import{createRuntimeRegistry as x,effortLevelOf as M,frameFacts as O,permissionModeOf as D,startedModelOf as W,switchedModelOf as A}from"@weavecode/harness";import{HARNESS_LIFECYCLE as F,isHarness as g}from"@weavecode/core";import{getLogsDir as R}from"../db/paths.js";import{projectHarnessIds as L}from"../daemon/project-harnesses.js";import{openDatabase as _}from"../db/db.js";import{HookEventRepository as C}from"../repositories/hook-events.js";import{ProjectRepository as N}from"../repositories/projects.js";import{SessionRepository as B}from"../repositories/sessions.js";import{appendOutbox as X}from"./mirror.js";import{isSyntheticSession as H,replaceSyntheticSessions as U}from"./synthetic-sessions.js";export const INBOX_TICK_MS=200,INBOX_CLAIM_SUFFIX=".claim.jsonl",INBOX_FAILED_SUFFIX=".failed.jsonl";const $=5;export function drainInboxOnce(t,n=new Map){const e=d(t.hooksDir,"inbox");let i;try{i=v(e)}catch{return[]}const o=[];for(const c of i)c.endsWith(INBOX_FAILED_SUFFIX)||c.endsWith(".tmp")||c.endsWith(INBOX_CLAIM_SUFFIX)||c.endsWith(".jsonl")&&o.push(c);const r=[];for(const c of i)c.endsWith(INBOX_CLAIM_SUFFIX)&&r.push(...w(t,d(e,c),n));for(const c of o){const a=d(e,`${c.slice(0,-6)}${INBOX_CLAIM_SUFFIX}`);if(!I(a)){try{h(d(e,c),a)}catch{continue}r.push(...w(t,a,n))}}return r}function w(t,n,e){let i;try{i=j(n,"utf8").split(`
|
|
2
|
+
`)}catch{return[]}const o=new Map;for(const p of i){const u=p.trim();if(!u)continue;const s=z(u);if(!s)continue;const l=o.get(s.token)??{lines:[],inputs:[],delivered:[],terminals:[],messaging:[]};if(l.lines.push(u),l.project||(l.project=t.projects.getByToken(s.token),o.set(s.token,l)),!l.project||l.project.archivedAt)continue;const y=s.report&&typeof s.report=="object"?t.adapters.find(f=>f.source===s.report.source):void 0;if(!(!y||!s.report.eventType))try{const f=y.normalize(s.report,l.project.id);if(H(f.sessionId))continue;l.inputs.push(f),l.delivered.push(s.report.deliveredTitle??null),l.terminals.push(s.terminalEnv),l.messaging.push(s.messaging)}catch{}}const r=[],c=[];for(const p of o.values())if(!(!p.project||p.inputs.length===0))try{const u=S(t,p.project,p.inputs);for(let s=0;s<p.inputs.length;s++)r.push({eventId:u[s],projectId:p.project.id,input:p.inputs[s],deliveredTitle:p.delivered[s]??null,messaging:p.messaging[s]??null,terminalEnv:p.terminals[s]??null})}catch{c.push(...p.lines)}if(c.length===0){e.delete(n);try{b(n)}catch{}return r}const a=(e.get(n)??0)+1;if(e.set(n,a),a>=$){e.delete(n);try{h(n,n.replace(INBOX_CLAIM_SUFFIX,INBOX_FAILED_SUFFIX))}catch{}return r}try{E(n,c.join(`
|
|
3
3
|
`)+`
|
|
4
|
-
`)}catch{}return r}function
|
|
4
|
+
`)}catch{}return r}function S(t,n,e){const i=t.hookEvents.insertMany(e),o=new Map;for(const r of e){if(!r.sessionId)continue;const c=o.get(r.sessionId),a=r.createdAt;(!o.has(r.sessionId)||a&&(!c||a>c))&&o.set(r.sessionId,a)}for(const[r,c]of o)t.hookSessions.touch(r,n.id,c);return i}export const LOGS_TICK_MS=1e3;export async function pollLogsOnce(t){if(t.sources.length===0)return[];const n=new Map;for(const i of t.projects.list()){const o=await L(i.path);t.sources.some(r=>o.includes(r.harness))&&n.set(i.path,i)}if(n.size===0)return[];const e=[];for(const i of t.sources){const o=t.adapters.find(a=>a.source===i.harness);if(!o)continue;let r;try{r=await i.poll({stateDir:d(t.logsDir,i.harness),cwdWhitelist:[...n.keys()]})}catch{continue}const c=new Map;for(const a of r){const p=a.report.cwd?n.get(a.report.cwd):void 0;if(p)try{const u=o.normalize(a.report,p.id);u.createdAt=a.at;const s=c.get(p);s?s.push(u):c.set(p,[u])}catch{}}for(const[a,p]of c)try{const u=S(t,a,p);for(let s=0;s<p.length;s++)e.push({eventId:u[s],projectId:a.id,input:p[s]})}catch(u){console.error("[weave] log ingest failed:",u)}}return e}function z(t){try{const n=JSON.parse(t);if(!n||typeof n.token!="string"||!n.token||!n.report||typeof n.report!="object")return null;const e=n.messaging?.socket,i=typeof e=="string"&&e?{socket:e,token:typeof n.messaging?.token=="string"?n.messaging.token:null}:null;return{token:n.token,report:n.report,messaging:i,terminalEnv:K(n.terminal)}}catch{return null}}function K(t){if(typeof t!="object"||t===null)return null;const n={};for(const[e,i]of Object.entries(t))typeof i=="string"&&i&&(n[e]=i);return Object.keys(n).length>0?n:null}export function unparkFailedInbox(t){const n=d(t,"inbox");let e;try{e=v(n)}catch{return 0}let i=0;for(const o of e){if(!o.endsWith(INBOX_FAILED_SUFFIX))continue;const r=d(n,`${o.slice(0,-INBOX_FAILED_SUFFIX.length)}${INBOX_CLAIM_SUFFIX}`);if(!I(r))try{h(d(n,o),r),i++}catch{}}return i}export function handleIngestedRecords(t,n){for(const e of n){const i=t.projects.getById(e.projectId);if(!i)continue;t.dashboardRate?.record();let o=null;try{o=JSON.parse(e.input.payload)}catch{o=null}if(t.bus?.emit({kind:"event.ingested",eventId:e.eventId,projectId:i.id,sessionId:e.input.sessionId??null,eventType:e.input.eventType,...O(o),at:e.input.createdAt??new Date().toISOString()}),e.input.sessionId){t.questionTracker?.onEvent({sessionId:e.input.sessionId,source:e.input.source,payload:o}),t.sideQuestions?.onEvent({sessionId:e.input.sessionId,source:e.input.source,eventType:e.input.eventType,payload:o,eventId:e.eventId}),t.watchEngine?.onEvent({sessionId:e.input.sessionId,eventType:e.input.eventType,source:e.input.source}),t.orchestrationEngine?.onEvent({sessionId:e.input.sessionId,eventType:e.input.eventType,source:e.input.source}),e.messaging&&t.messagePipe?.noteInboxSocket?.(e.input.sessionId,e.messaging),t.sessionProbe?.noteTranscript(e.input.sessionId,o?.transcriptPath??null);const r=A(e.input.eventType,o?.raw);r&&t.sessionProbe?.noteModel?.(e.input.sessionId,r.to);const c=W(e.input.eventType,o?.raw);c&&t.sessionProbe?.sessionStarted?.(e.input.sessionId,c.model);const a=M(o?.raw);a&&t.sessionProbe?.noteEffort?.(e.input.sessionId,a);const p=D(o?.raw);if(p&&t.sessionProbe?.noteMode?.(e.input.sessionId,p),e.terminalEnv||g(e.input.source)){const s=e.input.source;g(s)&&t.paneEnvSource?.(s)==="launch"?t.messagePipe?.claimPendingOrigin?.(e.input.sessionId,s,e.projectId):e.terminalEnv&&t.messagePipe?.notePaneEnv?.(e.input.sessionId,e.terminalEnv)}if(e.input.eventType==="UserPromptSubmit"){const s=t.messagePipe?.onSessionPrompt?.(e.input.sessionId,J(o)??"",e.eventId)??[];s.length>0&&t.uploads?.linkToEvent(e.eventId,s)}else t.messagePipe?.noteActivity?.(e.input.sessionId);const u=g(e.input.source)?F[e.input.source].sessionExit:null;u!==null&&e.input.eventType===u&&(t.messagePipe?.sessionExited?.(e.input.sessionId),t.terminalTopologyKick?.()),t.messagePipe?.hasQueued(e.input.sessionId)&&t.messagePipe.flushSession(e.input.sessionId)}t.dispatcher&&t.dispatcher.onIngest({eventId:e.eventId,project:i,sessionId:e.input.sessionId??null,payload:o??{eventType:e.input.eventType,toolName:null,toolInput:null,toolResponse:null,cwd:null,transcriptPath:null,raw:null},source:e.input.source,deliveredTitle:e.deliveredTitle??null}).then(r=>{r.deferred&&e.input.sessionId&&X(t.hooksDir,i.token,[{sessionId:e.input.sessionId,text:r.deferred}])}).catch(()=>{})}}function J(t){const n=t?.raw;return typeof n?.prompt=="string"&&n.prompt?n.prompt:null}export function startInboxWorker(t){return new P(new URL(import.meta.url),{workerData:{inboxWorker:!0,...t}})}if(!T&&k?.inboxWorker===!0){const t=k,n=_(t.dbPath),e=x(),i=new N(n),o={hooksDir:t.hooksDir,projects:i,hookEvents:new C(n),hookSessions:new B(n),adapters:e.byCapability("events").flatMap(s=>s.events??[])};m?.on("message",s=>{s?.type==="synthetic-sessions"&&Array.isArray(s.ids)&&U(s.ids)});const r=new Map,c=()=>{try{const s=drainInboxOnce(o,r);s.length>0&&m?.postMessage(s)}catch(s){console.error("[weave] inbox drain failed:",s)}};c(),setInterval(c,t.tickMs??INBOX_TICK_MS);const a={projects:i,hookEvents:o.hookEvents,hookSessions:o.hookSessions,adapters:o.adapters,logsDir:R(),sources:e.byCapability("logs").flatMap(s=>s.logs??[])};let p=!1;const u=()=>{p||(p=!0,pollLogsOnce(a).then(s=>{s.length>0&&m?.postMessage(s)}).catch(s=>console.error("[weave] log poll failed:",s)).finally(()=>{p=!1}))};a.sources.length>0&&(u(),setInterval(u,LOGS_TICK_MS))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i from"node:path";export const DISPATCH_MARKER="<!--weave-dispatch-->";const c=t=>process.platform==="win32"?t.toLowerCase():t;export function normalizePosix(t){return t.replace(/\\/g,"/")}function p(t){return/[.+^${}()|[\]\\]/.test(t)?`\\${t}`:t}const s=new Map;export function globToRegex(t){const o=s.get(t);if(o)return o;let n="";for(let r=0;r<t.length;r++){const l=t[r];l==="*"?t[r+1]==="*"?(r++,t[r+1]==="/"?(r++,n+="(?:.*/)?"):n+=".*"):n+="[^/]*":l==="?"?n+="[^/]":n+=p(l)}const e=new RegExp(`^${n}$`,"i");return s.set(t,e),e}export function matchGlob(t,o){return globToRegex(o).test(normalizePosix(t))}export function extractFilePath(t){if(typeof t!="object"||t===null)return null;const o=t;for(const n of["file_path","notebook_path","filePath"]){const e=o[n];if(typeof e=="string"&&e.length>0)return e}return null}function u(t,o){const n=c(normalizePosix(t)),e=c(normalizePosix(o).replace(/\/+$/,""));return n===e||n.startsWith(`${e}/`)}export function isCrossProjectPath(t,o,n){const e=c(normalizePosix(o));return u(t,o)?!1:n.some(r=>c(normalizePosix(r))!==e&&u(t,r))}export function renderTemplate(t,o){return t.replace(/\{(\w+)\}/g,(n,e)=>{const r=o[e];return r==null?n:String(r)})}export function templateVars(t){return{event:t.event,tool:t.tool,file:t.filePath?normalizePosix(t.filePath):null,cwd:t.cwd?normalizePosix(t.cwd):null,session:t.session,project:t.project,rule:t.rule}}export function matchesAnyGlob(t,o){return o.some(n=>matchGlob(t,n))}export function projectLabel(t){return i.basename(normalizePosix(t).replace(/\/+$/,""))||t}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Harness } from '@weavecode/core';
|
|
2
|
-
import { type MessagingSurface } from '@weavecode/harness';
|
|
2
|
+
import { type CommandsSurface, type MessagingSurface } from '@weavecode/harness';
|
|
3
3
|
import type { HookEventRepository } from '../repositories/hook-events.js';
|
|
4
4
|
import type { ProjectRepository } from '../repositories/projects.js';
|
|
5
5
|
import type { SessionRepository } from '../repositories/sessions.js';
|
|
@@ -143,6 +143,9 @@ export interface MessageDelivererDeps {
|
|
|
143
143
|
hooksDir?: string;
|
|
144
144
|
/** 能力面访问器(测试注入);缺省 surfaces.ts 模块级 registry。 */
|
|
145
145
|
surfaceFor?: (harness: Harness) => MessagingSurface;
|
|
146
|
+
/** 命令面访问器(测试注入);缺省 surfaces.ts 模块级 registry——命令形态的
|
|
147
|
+
* 触发符表由它答(`/` 斜杠命令、`!` bash 模式),投递闸按它分流回执窗口。 */
|
|
148
|
+
commandsFor?: (harness: Harness) => CommandsSurface | null;
|
|
146
149
|
/** 层② 终端 send-text 通道(装配侧按 TerminalBackend 能力注入;缺省无兜底)。 */
|
|
147
150
|
terminal?: PromptTerminal;
|
|
148
151
|
/** 冲洗节流:同一会话两次投递之间的最小间隔(毫秒);缺省 1000。Claude Code 对
|
|
@@ -159,6 +162,8 @@ export interface MessageDelivererDeps {
|
|
|
159
162
|
ackStallReleaseMs?: number;
|
|
160
163
|
/** 斜杠命令等回执的短窗口(毫秒);缺省 5s——过了仍无 UPS 即按内建命令收。 */
|
|
161
164
|
commandAckGraceMs?: number;
|
|
165
|
+
/** 中断后读屏确认的等待(毫秒);缺省 1.2s——没看到「已中断」就补一记 Ctrl+C。 */
|
|
166
|
+
interruptVerifyMs?: number;
|
|
162
167
|
/** 该会话此刻是否挂着阻塞式模态框(questions 槽;QuestionTracker 是唯一实现)。
|
|
163
168
|
* 模态框在场时层② 的文本与回车会被它吃掉:投出去只换来一条「已发出却没回执」
|
|
164
169
|
* 的假送达,回车还可能替用户按下某个选项。缺省 = 不判(测试与无 tracker 装配)。 */
|
|
@@ -206,11 +211,6 @@ export type AnswerResult = {
|
|
|
206
211
|
status: 400 | 404 | 409;
|
|
207
212
|
error: string;
|
|
208
213
|
};
|
|
209
|
-
/**
|
|
210
|
-
* 层② 定位来源:both = pane env 优先、标题+cwd 回落(投递路径的常规口径);
|
|
211
|
-
* locator = 只认 env;heuristic = 只按标题+cwd(中断补打用,见 interrupt)。
|
|
212
|
-
*/
|
|
213
|
-
export type PaneTargetSource = 'both' | 'locator' | 'heuristic';
|
|
214
214
|
/** 通道现况:ready = 现在就能投;unknown = 判不动(终端只剩标题/cwd 回落,被动面看不出来)。 */
|
|
215
215
|
interface ChannelState<R extends string> {
|
|
216
216
|
status: 'ready' | 'unavailable' | 'unknown';
|
|
@@ -223,7 +223,7 @@ export interface SessionDeliveryDiagnosis {
|
|
|
223
223
|
inbox: ChannelState<'no-mechanism' | 'no-credentials' | 'auth-token-required'>;
|
|
224
224
|
queue: ChannelState<'no-mechanism'>;
|
|
225
225
|
relay: ChannelState<'no-mechanism' | 'no-peer-name'>;
|
|
226
|
-
terminal: ChannelState<'no-backend' | 'no-pane-env'>;
|
|
226
|
+
terminal: ChannelState<'no-backend' | 'no-pane-env' | 'pane-env-conflict'>;
|
|
227
227
|
/** 该会话有没有上报过 pane 定位 env。 */
|
|
228
228
|
paneEnvReported: boolean;
|
|
229
229
|
/** 队列里压着的行数。 */
|
|
@@ -231,21 +231,6 @@ export interface SessionDeliveryDiagnosis {
|
|
|
231
231
|
/** 暂停闸是否已置(未回执超窗 / 投递失败)。 */
|
|
232
232
|
stalled: boolean;
|
|
233
233
|
}
|
|
234
|
-
/**
|
|
235
|
-
* 作答键序白名单(安全闸):逐个**原子**验形态——作答面不能变成任意键序注入
|
|
236
|
-
* 通道(键序若打进已关的模态框会漏进输入框执行)。原子要么是宿主的键(选项
|
|
237
|
-
* 序号 / Tab / 回车 / 下移 / 预览面的 `n` 备注键),要么是自定义输入行的文本
|
|
238
|
-
* (无控制字符——CR/LF/ESC 混进来就成了任意键序注入,不只是打字)。原子表本身
|
|
239
|
-
* 由 harness 规格拼装(选项 keys / textFocus / textTail),这里只验形态。
|
|
240
|
-
*/
|
|
241
|
-
/**
|
|
242
|
-
* 斜杠命令(宿主内建命令与 skill/插件命令都算):判据跟宿主一致——**trim 后以
|
|
243
|
-
* `/` 开头**(命令只在最前面生效)。两者的回执行为不同:内建命令(`/compact`、
|
|
244
|
-
* `/model`、`/effort`…)由宿主内部执行、**不发 UserPromptSubmit**,而 skill/插件
|
|
245
|
-
* 命令会把敲的那行原样报一条 UPS(实测 0.6s)。故不能一律当「无回执」收,见
|
|
246
|
-
* `armCommandAck` 的短窗口。
|
|
247
|
-
*/
|
|
248
|
-
export declare function isSlashCommand(text: string): boolean;
|
|
249
234
|
export declare class MessageDeliverer {
|
|
250
235
|
private readonly deps;
|
|
251
236
|
private readonly headless;
|
|
@@ -271,6 +256,12 @@ export declare class MessageDeliverer {
|
|
|
271
256
|
* sessionTerminals() 报完即焚;会话再发事件(resume)会重新 notePaneEnv。
|
|
272
257
|
*/
|
|
273
258
|
private readonly revokedPaneEnvs;
|
|
259
|
+
/**
|
|
260
|
+
* sessionId → 占着同一 pane 定位的另一个会话(fork 继承同一份 env):有值 =
|
|
261
|
+
* 这个会话的终端定位不可信,投递/击键一律如实拒绝,绝不打进别人的终端。
|
|
262
|
+
* 只在内存:重启后由下一个事件重新裁决(窗口内可能漏一次,可接受)。
|
|
263
|
+
*/
|
|
264
|
+
private readonly paneEnvConflicts;
|
|
274
265
|
/** 上次落盘的 pane env(hook 每次事件都上报,值没变就不重写盘)。 */
|
|
275
266
|
private persistedPaneEnvs;
|
|
276
267
|
/**
|
|
@@ -369,8 +360,16 @@ export declare class MessageDeliverer {
|
|
|
369
360
|
/**
|
|
370
361
|
* hook 旁路上报的会话 pane 定位 env(**每个 hook 事件覆盖刷新**:会话换 pane /
|
|
371
362
|
* resume 到新窗口后,下一次事件就把定位改过来,与 inbox 凭据同一自愈口径)。
|
|
363
|
+
*
|
|
364
|
+
* **同一份 env 只归一个会话**:claude 的 fork 会让新会话继承旧会话的 pane env
|
|
365
|
+
* (实测 pane 0 同时挂在 256de1f1 与 fork 出的 f59a061a 名下),照着投递就会把
|
|
366
|
+
* 消息打进别人终端、而目标永远收不到。裁决 = 先到先得:前持有者还有活动就
|
|
367
|
+
* 不让位(本会话记成冲突,投递/击键如实 409);前持有者静默超过
|
|
368
|
+
* `PANE_CLAIM_HANDOVER_MS` 才让位(那才是真的退出了)。
|
|
372
369
|
*/
|
|
373
370
|
notePaneEnv(sessionId: string, env: Record<string, string>): void;
|
|
371
|
+
/** 该会话的终端定位是否被另一个会话占着(fork 继承同一 pane);有值 = 不可投递。 */
|
|
372
|
+
paneEnvConflictOf(sessionId: string): string | null;
|
|
374
373
|
/**
|
|
375
374
|
* 记一条起点候选(weave 起会话的 spawn 回执)。只为 paneEnvSource='launch'
|
|
376
375
|
* 的 harness 而来(调用侧闸):'hook' 的 harness env 精确,起点只会引入过期源。
|
|
@@ -445,21 +444,29 @@ export declare class MessageDeliverer {
|
|
|
445
444
|
*/
|
|
446
445
|
answer(sessionId: string, atoms: readonly string[]): Promise<AnswerResult>;
|
|
447
446
|
/**
|
|
448
|
-
* 中断目标会话正在跑的回合(dashboard
|
|
449
|
-
*
|
|
450
|
-
*
|
|
447
|
+
* 中断目标会话正在跑的回合(dashboard 停止按钮):按 `INTERRUPT_KEYS` 的梯子
|
|
448
|
+
* 逐记试,每记之后读屏,看到「已停」就收手。
|
|
449
|
+
*
|
|
450
|
+
* **为什么梯子第一记是 Kitty 编码的 Esc**(2026-10-30 活体实测定案):claude 的
|
|
451
|
+
* TUI 开着 Kitty 键盘协议,手按 Esc 送出的其实是 `ESC[27u`,而裸 `0x1b` 会被
|
|
452
|
+
* 当成一个未完成的转义序列丢掉——这就是「TUI 里手按能停、weave 注入不停」的
|
|
453
|
+
* 真因。同一个正在跑的工具上逐键单测:裸 ESC 观察 8 秒无效、裸 Ctrl+C 观察
|
|
454
|
+
* 12 秒无效,`ESC[27u` 与 `ESC[99;5u` 各自 1 秒内落 `Interrupted`。
|
|
451
455
|
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
|
|
459
|
-
|
|
456
|
+
* 后续两记是兜底:裸 ESC(没开该协议的宿主)、Ctrl+B(实测在工具执行窗口里
|
|
457
|
+
* 也能直接落 `Interrupted`,纯控制字节,任何协议下都无歧义)。不再发第二记
|
|
458
|
+
* 裸 ESC——claude 里两记 Esc 是历史回退菜单。读屏拿不到(无读屏能力的后端)
|
|
459
|
+
* 就不往下打,不凭猜继续注入。键序固定死在服务端,不当参数收。
|
|
460
|
+
*
|
|
461
|
+
* 结果**只认正面证据**:屏上写着 `Interrupted` 或状态行落到 `· done` 才算停;
|
|
462
|
+
* 否则 `confirmed:false`,UI 把「没停」如实说出来。「没挂 esc to interrupt」
|
|
463
|
+
* 当判停会漏判(工具间隙那一拍屏上本来就没有它),故不作判据。
|
|
464
|
+
*/
|
|
465
|
+
interrupt(sessionId: string): Promise<{
|
|
460
466
|
ok: true;
|
|
461
467
|
paneId: string;
|
|
462
468
|
sent: boolean;
|
|
469
|
+
confirmed: boolean;
|
|
463
470
|
} | Extract<AnswerResult, {
|
|
464
471
|
ok: false;
|
|
465
472
|
}>>;
|
|
@@ -482,8 +489,9 @@ export declare class MessageDeliverer {
|
|
|
482
489
|
*/
|
|
483
490
|
pressEnter(sessionId: string): Promise<AnswerResult>;
|
|
484
491
|
/**
|
|
485
|
-
* 手动硬中断(Ctrl+C 键帽):往 pane 打一记 Ctrl+C。与 ESC
|
|
486
|
-
*
|
|
492
|
+
* 手动硬中断(Ctrl+C 键帽):往 pane 打一记 Ctrl+C。与 ESC 同源——宿主开着
|
|
493
|
+
* Kitty 键盘协议,真实按键是 `ESC[99;5u`,裸 `0x03` 不被认(2026-10-30 实测:
|
|
494
|
+
* 手按 Ctrl+C 能停、注入裸 0x03 不能)。不落转录标记,只报送出。
|
|
487
495
|
*/
|
|
488
496
|
pressCtrlC(sessionId: string): Promise<AnswerResult>;
|
|
489
497
|
/**
|
|
@@ -573,6 +581,8 @@ export declare class MessageDeliverer {
|
|
|
573
581
|
forgetProject(projectId: number): number;
|
|
574
582
|
/** harness 归属 = 最新事件 source(open-terminal 同口径)。 */
|
|
575
583
|
private surfaceOfSession;
|
|
584
|
+
/** 这段输入命中哪种命令形态(触发符表归能力面);null = 普通 prompt。 */
|
|
585
|
+
private commandModeOf;
|
|
576
586
|
/**
|
|
577
587
|
* mode → 实际通道。prompt = 层① 原生 || 层② 终端通道(都没有才 409);
|
|
578
588
|
* auto 的忙/闲基准 = turnOpenOf,忙 → inject(无通道才拒绝,绝不无头抢占),
|
|
@@ -584,9 +594,6 @@ export declare class MessageDeliverer {
|
|
|
584
594
|
* 与标题是否漂移无关,也覆盖从没上报过标题的会话;后端已做存在性校验)→
|
|
585
595
|
* ② 回落「标题(剥 spinner 前缀,字符集含 ◐ 等输入等待态)+ 项目 cwd」启发式
|
|
586
596
|
* (无定位能力的终端 / 老 hook),歧义拒绝不打。
|
|
587
|
-
*
|
|
588
|
-
* `source='heuristic'` 跳过 ①:只给中断的补打用——① 命中的 pane 活着但已经
|
|
589
|
-
* 不是这个会话(换过窗口),宿主对那一记毫无反应,此时只剩「按标题认回来」一条路。
|
|
590
597
|
*/
|
|
591
598
|
private terminalPaneFor;
|
|
592
599
|
/** 层② 通道现取(装配期注入;与 settings 的 preset 无关,只有「没装」才是 null)。 */
|