pi-harness-runtime 0.10.11 → 0.10.12
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/cli.ts +111 -0
- package/footer-status.ts +204 -0
- package/harness/agent-handoff.ts +189 -0
- package/harness/auto-compact.ts +309 -0
- package/harness/auto-quota-resume.ts +132 -0
- package/harness/autonomous-review.ts +88 -0
- package/harness/blackboard.ts +291 -0
- package/harness/context-compact-orchestrator.ts +551 -0
- package/harness/context-window-manager.ts +464 -0
- package/harness/continue-prompt.ts +242 -0
- package/harness/e2e/index.ts +44 -0
- package/harness/e2e/minimax-quota-parser.ts +88 -0
- package/harness/e2e/minimax-quota-scraper.ts +609 -0
- package/harness/e2e/openai-quota-scraper.ts +447 -0
- package/harness/e2e/playwright-runner.ts +204 -0
- package/harness/e2e/quota-status.ts +194 -0
- package/harness/e2e/test-engine.ts +398 -0
- package/harness/forked-summarizer.ts +304 -0
- package/harness/herdr-agents.ts +91 -0
- package/harness/index.ts +232 -0
- package/harness/job-state-machine.ts +363 -0
- package/harness/loop-code-agent.ts +284 -0
- package/harness/loop-controller.ts +201 -0
- package/harness/loop-review-agent.ts +295 -0
- package/harness/loop-runtime.ts +760 -0
- package/harness/loop-types.ts +118 -0
- package/harness/master-planner.ts +327 -0
- package/harness/notification-events.ts +299 -0
- package/harness/output-limit-handler.ts +316 -0
- package/harness/partial-recovery.ts +531 -0
- package/harness/project-detector/detector.ts +328 -0
- package/harness/repair-engine.ts +340 -0
- package/harness/session-memory.ts +401 -0
- package/harness/task-graph.d.ts +51 -0
- package/harness/task-graph.ts +143 -0
- package/mirror.ts +278 -0
- package/package.json +8 -12
- package/packages/a2a-adapter/src/agent.ts +139 -0
- package/packages/a2a-adapter/src/client.ts +107 -0
- package/packages/a2a-adapter/src/discovery.ts +106 -0
- package/packages/a2a-adapter/src/index.ts +38 -0
- package/packages/a2a-adapter/src/protocol.ts +46 -0
- package/packages/a2a-adapter/src/transport.ts +142 -0
- package/packages/a2a-adapter/src/types.ts +117 -0
- package/packages/auth/src/minimax-browser-auth.ts +1109 -0
- package/packages/auth/src/run-minimax-auth.ts +150 -0
- package/packages/autonomous-refactor/src/detector.ts +219 -0
- package/packages/autonomous-refactor/src/index.ts +16 -0
- package/packages/autonomous-refactor/src/planner.ts +99 -0
- package/packages/autonomous-refactor/src/types.ts +57 -0
- package/packages/autonomous-runtime/src/inbox.ts +266 -0
- package/packages/autonomous-runtime/src/index.ts +22 -0
- package/packages/autonomous-runtime/src/lease.ts +318 -0
- package/packages/autonomous-runtime/src/types.ts +257 -0
- package/packages/cache-strategy/src/cache.ts +213 -0
- package/packages/cache-strategy/src/index.ts +6 -0
- package/packages/cache-strategy/src/types.ts +40 -0
- package/packages/capability-registry/src/defaults.ts +247 -0
- package/packages/capability-registry/src/index.ts +43 -0
- package/packages/capability-registry/src/query.ts +99 -0
- package/packages/capability-registry/src/registry.ts +222 -0
- package/packages/capability-registry/src/types.d.ts +47 -0
- package/packages/capability-registry/src/types.js +10 -0
- package/packages/capability-registry/src/types.ts +83 -0
- package/packages/checkpoint/src/checkpoint-manager.ts +33 -0
- package/packages/checkpoint/src/differ.ts +281 -0
- package/packages/checkpoint/src/engine.ts +532 -0
- package/packages/checkpoint/src/index.ts +48 -0
- package/packages/checkpoint/src/storage.ts +439 -0
- package/packages/checkpoint/src/types.ts +348 -0
- package/packages/cli-plugin-sdk/src/index.ts +169 -0
- package/packages/cli-plugin-sdk/src/plugin-fs.ts +91 -0
- package/packages/cli-plugin-sdk/src/registry.ts +55 -0
- package/packages/cli-plugin-sdk/src/types.ts +32 -0
- package/packages/clipboard/dist/src/clipboard.d.ts +11 -0
- package/packages/clipboard/dist/src/clipboard.js +51 -0
- package/packages/clipboard/dist/src/copy-sync.d.ts +27 -0
- package/packages/clipboard/dist/src/copy-sync.js +170 -0
- package/packages/clipboard/dist/src/gist-relay.d.ts +48 -0
- package/packages/clipboard/dist/src/gist-relay.js +186 -0
- package/packages/clipboard/dist/src/github-login.d.ts +16 -0
- package/packages/clipboard/dist/src/github-login.js +69 -0
- package/packages/clipboard/dist/src/index.d.ts +4 -0
- package/packages/clipboard/dist/src/index.js +3 -0
- package/packages/clipboard/dist/src/types.d.ts +13 -0
- package/packages/clipboard/dist/src/types.js +5 -0
- package/packages/clipboard/src/clipboard.ts +59 -0
- package/packages/clipboard/src/copy-sync.ts +201 -0
- package/packages/clipboard/src/gist-relay.ts +240 -0
- package/packages/clipboard/src/github-login.ts +107 -0
- package/packages/clipboard/src/index.ts +3 -0
- package/packages/clipboard/src/types.ts +14 -0
- package/packages/code-generation/src/faker.ts +461 -0
- package/packages/code-generation/src/generator.ts +421 -0
- package/packages/code-generation/src/index.ts +56 -0
- package/packages/code-generation/src/templates/ejs-renderer.ts +142 -0
- package/packages/code-generation/src/templates/registry.ts +174 -0
- package/packages/code-generation/src/types.ts +373 -0
- package/packages/code-review/src/engine.ts +408 -0
- package/packages/code-review/src/index.ts +46 -0
- package/packages/code-review/src/reports/html.ts +143 -0
- package/packages/code-review/src/reports/markdown.ts +197 -0
- package/packages/code-review/src/reports/text.ts +171 -0
- package/packages/code-review/src/types.ts +324 -0
- package/packages/codex-adapter/src/executor.ts +83 -0
- package/packages/codex-adapter/src/index.ts +16 -0
- package/packages/codex-adapter/src/provider.ts +213 -0
- package/packages/codex-adapter/src/types.ts +118 -0
- package/packages/config-capture/src/index.ts +357 -0
- package/packages/context-compiler/src/budget.ts +122 -0
- package/packages/context-compiler/src/cache.ts +134 -0
- package/packages/context-compiler/src/compiler.ts +314 -0
- package/packages/context-compiler/src/deduplicate.ts +171 -0
- package/packages/context-compiler/src/filter.ts +135 -0
- package/packages/context-compiler/src/index.ts +61 -0
- package/packages/context-compiler/src/okf-loader.ts +86 -0
- package/packages/context-compiler/src/score.ts +130 -0
- package/packages/context-compiler/src/types.ts +246 -0
- package/packages/context-discovery/dist/src/discover.d.ts +3 -0
- package/packages/context-discovery/dist/src/discover.js +42 -0
- package/packages/context-discovery/dist/src/discovery.d.ts +28 -0
- package/packages/context-discovery/dist/src/discovery.js +21 -0
- package/packages/context-discovery/dist/src/index.d.ts +3 -0
- package/packages/context-discovery/dist/src/index.js +2 -0
- package/packages/context-discovery/dist/src/types.d.ts +16 -0
- package/packages/context-discovery/dist/src/types.js +2 -0
- package/packages/context-discovery/src/discover.ts +42 -0
- package/packages/context-discovery/src/discovery.ts +44 -0
- package/packages/context-discovery/src/index.ts +2 -0
- package/packages/context-discovery/src/types.ts +15 -0
- package/packages/context-manager/src/compaction.ts +139 -0
- package/packages/context-manager/src/core.ts +85 -0
- package/packages/context-manager/src/index.ts +22 -0
- package/packages/context-manager/src/types.ts +44 -0
- package/packages/cookie-sanitizer/src/atomic-write.ts +79 -0
- package/packages/cookie-sanitizer/src/detect-format.ts +102 -0
- package/packages/cookie-sanitizer/src/index.ts +89 -0
- package/packages/cookie-sanitizer/src/infer-provider.ts +103 -0
- package/packages/cookie-sanitizer/src/normalize.ts +92 -0
- package/packages/cookie-sanitizer/src/parse-json.ts +122 -0
- package/packages/cookie-sanitizer/src/parse-netscape.ts +118 -0
- package/packages/cookie-sanitizer/src/sync.ts +312 -0
- package/packages/cookie-sanitizer/src/types.ts +101 -0
- package/packages/cookie-sanitizer/src/watcher.ts +180 -0
- package/packages/cost-optimizer/src/budget.ts +138 -0
- package/packages/cost-optimizer/src/config.ts +34 -0
- package/packages/cost-optimizer/src/forecast.ts +59 -0
- package/packages/cost-optimizer/src/index.ts +74 -0
- package/packages/cost-optimizer/src/optimizer.ts +277 -0
- package/packages/cost-optimizer/src/selection.ts +264 -0
- package/packages/cost-optimizer/src/tracker.ts +122 -0
- package/packages/cost-optimizer/src/types.ts +134 -0
- package/packages/dependency-analyzer/dist/src/analyzer.d.ts +17 -0
- package/packages/dependency-analyzer/dist/src/analyzer.js +119 -0
- package/packages/dependency-analyzer/dist/src/imports.d.ts +12 -0
- package/packages/dependency-analyzer/dist/src/imports.js +73 -0
- package/packages/dependency-analyzer/dist/src/index.d.ts +4 -0
- package/packages/dependency-analyzer/dist/src/index.js +3 -0
- package/packages/dependency-analyzer/dist/src/types.d.ts +28 -0
- package/packages/dependency-analyzer/dist/src/types.js +5 -0
- package/packages/dependency-analyzer/src/analyzer.ts +140 -0
- package/packages/dependency-analyzer/src/imports.ts +93 -0
- package/packages/dependency-analyzer/src/index.ts +9 -0
- package/packages/dependency-analyzer/src/types.ts +38 -0
- package/packages/django-plugin/src/analyzer.ts +284 -0
- package/packages/django-plugin/src/index.ts +39 -0
- package/packages/django-plugin/src/types.ts +35 -0
- package/packages/doc-generator/src/detector.ts +113 -0
- package/packages/doc-generator/src/docs.ts +158 -0
- package/packages/doc-generator/src/index.ts +7 -0
- package/packages/doc-generator/src/types.ts +58 -0
- package/packages/evaluation-engine/src/engine.ts +488 -0
- package/packages/evaluation-engine/src/index.ts +23 -0
- package/packages/evaluation-engine/src/types.ts +136 -0
- package/packages/evaluation-runner/src/index.ts +6 -0
- package/packages/evaluation-runner/src/runner.ts +182 -0
- package/packages/evaluation-runner/src/types.ts +51 -0
- package/packages/event-bus/dist/src/bus.d.ts +15 -0
- package/packages/event-bus/dist/src/bus.js +98 -0
- package/packages/event-bus/dist/src/herdr-bus.d.ts +121 -0
- package/packages/event-bus/dist/src/herdr-bus.js +322 -0
- package/packages/event-bus/dist/src/index.d.ts +6 -0
- package/packages/event-bus/dist/src/index.js +4 -0
- package/packages/event-bus/dist/src/types.d.ts +27 -0
- package/packages/event-bus/dist/src/types.js +10 -0
- package/packages/event-bus/src/bus.ts +111 -0
- package/packages/event-bus/src/herdr-bus.ts +525 -0
- package/packages/event-bus/src/index.ts +38 -0
- package/packages/event-bus/src/types.ts +59 -0
- package/packages/event-store/dist/src/index.d.ts +3 -0
- package/packages/event-store/dist/src/index.js +2 -0
- package/packages/event-store/dist/src/store.d.ts +15 -0
- package/packages/event-store/dist/src/store.js +139 -0
- package/packages/event-store/dist/src/types.d.ts +48 -0
- package/packages/event-store/dist/src/types.js +5 -0
- package/packages/event-store/src/index.ts +11 -0
- package/packages/event-store/src/store.ts +168 -0
- package/packages/event-store/src/types.d.ts +48 -0
- package/packages/event-store/src/types.js +5 -0
- package/packages/event-store/src/types.ts +65 -0
- package/packages/experience-replay/src/index.ts +19 -0
- package/packages/experience-replay/src/replay.ts +348 -0
- package/packages/experience-replay/src/types.ts +128 -0
- package/packages/feedback-collector/src/collector.ts +160 -0
- package/packages/feedback-collector/src/index.ts +6 -0
- package/packages/feedback-collector/src/types.ts +51 -0
- package/packages/framework-detector/src/detector.ts +586 -0
- package/packages/framework-detector/src/index.ts +46 -0
- package/packages/framework-detector/src/signatures/registry.ts +648 -0
- package/packages/framework-detector/src/types.ts +299 -0
- package/packages/framework-plugin-sdk/src/index.ts +45 -0
- package/packages/framework-plugin-sdk/src/manager.ts +525 -0
- package/packages/framework-plugin-sdk/src/types.ts +449 -0
- package/packages/frappe-plugin/src/analyzer.ts +454 -0
- package/packages/frappe-plugin/src/index.ts +72 -0
- package/packages/frappe-plugin/src/types.ts +135 -0
- package/packages/generic-web-plugin/src/analyzer.ts +347 -0
- package/packages/generic-web-plugin/src/index.ts +61 -0
- package/packages/generic-web-plugin/src/types.ts +41 -0
- package/packages/health-monitor/src/index.ts +16 -0
- package/packages/health-monitor/src/monitor.ts +216 -0
- package/packages/health-monitor/src/types.ts +45 -0
- package/packages/intent-analyzer/dist/src/analyzer.d.ts +13 -0
- package/packages/intent-analyzer/dist/src/analyzer.js +239 -0
- package/packages/intent-analyzer/dist/src/index.d.ts +3 -0
- package/packages/intent-analyzer/dist/src/index.js +2 -0
- package/packages/intent-analyzer/dist/src/types.d.ts +26 -0
- package/packages/intent-analyzer/dist/src/types.js +7 -0
- package/packages/intent-analyzer/src/analyzer.ts +259 -0
- package/packages/intent-analyzer/src/index.ts +8 -0
- package/packages/intent-analyzer/src/types.ts +44 -0
- package/packages/knowledge-retrieval/src/index.ts +18 -0
- package/packages/knowledge-retrieval/src/mcp-client.ts +212 -0
- package/packages/knowledge-retrieval/src/types.ts +112 -0
- package/packages/laravel-plugin/src/analyzer.ts +323 -0
- package/packages/laravel-plugin/src/index.ts +40 -0
- package/packages/laravel-plugin/src/types.ts +24 -0
- package/packages/learning-engine/src/engine.ts +391 -0
- package/packages/learning-engine/src/index.ts +26 -0
- package/packages/learning-engine/src/types.ts +201 -0
- package/packages/mcp-adapter/src/index.ts +20 -0
- package/packages/mcp-adapter/src/server.ts +273 -0
- package/packages/mcp-adapter/src/tools.ts +220 -0
- package/packages/mcp-adapter/src/types.ts +79 -0
- package/packages/memory-engine/src/engine.ts +615 -0
- package/packages/memory-engine/src/index.ts +20 -0
- package/packages/memory-engine/src/types.ts +159 -0
- package/packages/model-registry/src/cost.ts +80 -0
- package/packages/model-registry/src/defaults.ts +178 -0
- package/packages/model-registry/src/index.ts +57 -0
- package/packages/model-registry/src/query.ts +85 -0
- package/packages/model-registry/src/registry.ts +188 -0
- package/packages/model-registry/src/types.d.ts +63 -0
- package/packages/model-registry/src/types.js +5 -0
- package/packages/model-registry/src/types.ts +69 -0
- package/packages/nextjs-plugin/src/analyzer.ts +247 -0
- package/packages/nextjs-plugin/src/index.ts +41 -0
- package/packages/nextjs-plugin/src/types.ts +36 -0
- package/packages/notification/src/adapters/email-adapter.ts +126 -0
- package/packages/notification/src/adapters/ntfy-adapter.ts +100 -0
- package/packages/notification/src/adapters/telegram-adapter.ts +107 -0
- package/packages/notification/src/adapters/webhook-adapter.ts +75 -0
- package/packages/notification/src/base-adapter.ts +75 -0
- package/packages/notification/src/index.ts +9 -0
- package/packages/notification/src/notification-center.ts +286 -0
- package/packages/notification/src/types.ts +89 -0
- package/packages/observability/src/alerts.ts +355 -0
- package/packages/observability/src/health.ts +325 -0
- package/packages/observability/src/index.ts +79 -0
- package/packages/observability/src/logger.ts +373 -0
- package/packages/observability/src/metrics.ts +475 -0
- package/packages/observability/src/tracer.ts +336 -0
- package/packages/observability/src/types.ts +391 -0
- package/packages/okf-indexer/src/cli.ts +25 -0
- package/packages/okf-indexer/src/indexer.ts +186 -0
- package/packages/performance-optimizer/src/index.ts +20 -0
- package/packages/performance-optimizer/src/optimizer.ts +428 -0
- package/packages/performance-optimizer/src/types.ts +112 -0
- package/packages/privilege-broker/src/approval.ts +70 -0
- package/packages/privilege-broker/src/audit.ts +142 -0
- package/packages/privilege-broker/src/executor.ts +110 -0
- package/packages/privilege-broker/src/index.ts +46 -0
- package/packages/privilege-broker/src/registry.ts +98 -0
- package/packages/privilege-broker/src/types.ts +105 -0
- package/packages/project-analyzer/src/analyzer.ts +683 -0
- package/packages/project-analyzer/src/cache.ts +329 -0
- package/packages/project-analyzer/src/command-discovery.ts +239 -0
- package/packages/project-analyzer/src/index.ts +123 -0
- package/packages/project-analyzer/src/plugins/index.ts +16 -0
- package/packages/project-analyzer/src/rule-discovery.ts +282 -0
- package/packages/project-analyzer/src/signals.ts +355 -0
- package/packages/project-analyzer/src/types.ts +412 -0
- package/packages/project-analyzer/src/walker.ts +366 -0
- package/packages/projection-engine/dist/src/engine.d.ts +61 -0
- package/packages/projection-engine/dist/src/engine.js +87 -0
- package/packages/projection-engine/dist/src/index.d.ts +2 -0
- package/packages/projection-engine/dist/src/index.js +2 -0
- package/packages/projection-engine/dist/src/project.d.ts +3 -0
- package/packages/projection-engine/dist/src/project.js +24 -0
- package/packages/projection-engine/dist/src/types.d.ts +55 -0
- package/packages/projection-engine/dist/src/types.js +5 -0
- package/packages/projection-engine/src/engine.ts +134 -0
- package/packages/projection-engine/src/index.ts +8 -0
- package/packages/projection-engine/src/project.ts +24 -0
- package/packages/projection-engine/src/types.d.ts +55 -0
- package/packages/projection-engine/src/types.js +5 -0
- package/packages/projection-engine/src/types.ts +60 -0
- package/packages/prompt-compiler/src/budget.ts +170 -0
- package/packages/prompt-compiler/src/compiler.ts +188 -0
- package/packages/prompt-compiler/src/deduplicate.ts +84 -0
- package/packages/prompt-compiler/src/index.ts +50 -0
- package/packages/prompt-compiler/src/normalize.ts +140 -0
- package/packages/prompt-compiler/src/render.ts +105 -0
- package/packages/prompt-compiler/src/section-builder.ts +279 -0
- package/packages/prompt-compiler/src/types.ts +263 -0
- package/packages/prompt-compiler/src/validate.ts +157 -0
- package/packages/prompt-versioning/src/index.ts +6 -0
- package/packages/prompt-versioning/src/types.ts +41 -0
- package/packages/prompt-versioning/src/versioning.ts +149 -0
- package/packages/provider-adapter-sdk/dist/src/builder.d.ts +140 -0
- package/packages/provider-adapter-sdk/dist/src/builder.js +332 -0
- package/packages/provider-adapter-sdk/dist/src/errors.d.ts +71 -0
- package/packages/provider-adapter-sdk/dist/src/errors.js +111 -0
- package/packages/provider-adapter-sdk/dist/src/index.d.ts +15 -0
- package/packages/provider-adapter-sdk/dist/src/index.js +19 -0
- package/packages/provider-adapter-sdk/dist/src/registry.d.ts +108 -0
- package/packages/provider-adapter-sdk/dist/src/registry.js +301 -0
- package/packages/provider-adapter-sdk/dist/src/tester.d.ts +71 -0
- package/packages/provider-adapter-sdk/dist/src/tester.js +392 -0
- package/packages/provider-adapter-sdk/dist/src/types.d.ts +182 -0
- package/packages/provider-adapter-sdk/dist/src/types.js +11 -0
- package/packages/provider-adapter-sdk/src/builder.ts +442 -0
- package/packages/provider-adapter-sdk/src/errors.ts +153 -0
- package/packages/provider-adapter-sdk/src/index.ts +84 -0
- package/packages/provider-adapter-sdk/src/registry.ts +486 -0
- package/packages/provider-adapter-sdk/src/tester.ts +483 -0
- package/packages/provider-adapter-sdk/src/types.ts +293 -0
- package/packages/provider-router/dist/capability-registry/src/types.d.ts +47 -0
- package/packages/provider-router/dist/capability-registry/src/types.js +10 -0
- package/packages/provider-router/dist/provider-router/src/index.d.ts +23 -0
- package/packages/provider-router/dist/provider-router/src/index.js +25 -0
- package/packages/provider-router/dist/provider-router/src/policy.d.ts +10 -0
- package/packages/provider-router/dist/provider-router/src/policy.js +45 -0
- package/packages/provider-router/dist/provider-router/src/provider-router.d.ts +56 -0
- package/packages/provider-router/dist/provider-router/src/provider-router.js +222 -0
- package/packages/provider-router/dist/provider-router/src/strategies.d.ts +19 -0
- package/packages/provider-router/dist/provider-router/src/strategies.js +110 -0
- package/packages/provider-router/dist/provider-router/src/types.d.ts +91 -0
- package/packages/provider-router/dist/provider-router/src/types.js +10 -0
- package/packages/provider-router/dist/src/index.d.ts +23 -0
- package/packages/provider-router/dist/src/index.js +25 -0
- package/packages/provider-router/dist/src/policy.d.ts +10 -0
- package/packages/provider-router/dist/src/policy.js +45 -0
- package/packages/provider-router/dist/src/provider-router.d.ts +56 -0
- package/packages/provider-router/dist/src/provider-router.js +222 -0
- package/packages/provider-router/dist/src/strategies.d.ts +19 -0
- package/packages/provider-router/dist/src/strategies.js +110 -0
- package/packages/provider-router/dist/src/types.d.ts +91 -0
- package/packages/provider-router/dist/src/types.js +10 -0
- package/packages/provider-router/dist/types/src/runtime-types.d.ts +412 -0
- package/packages/provider-router/dist/types/src/runtime-types.js +2 -0
- package/packages/provider-router/src/index.ts +49 -0
- package/packages/provider-router/src/policy.ts +50 -0
- package/packages/provider-router/src/provider-router.ts +315 -0
- package/packages/provider-router/src/strategies.ts +158 -0
- package/packages/provider-router/src/types.ts +130 -0
- package/packages/provider-selector/src/index.ts +13 -0
- package/packages/provider-selector/src/selector.ts +120 -0
- package/packages/provider-selector/src/types.ts +33 -0
- package/packages/providers/dist/src/adapters.d.ts +133 -0
- package/packages/providers/dist/src/adapters.js +236 -0
- package/packages/providers/dist/src/deepagents-adapter.d.ts +78 -0
- package/packages/providers/dist/src/deepagents-adapter.js +323 -0
- package/packages/providers/dist/src/glm-usage.d.ts +102 -0
- package/packages/providers/dist/src/glm-usage.js +197 -0
- package/packages/providers/dist/src/index.d.ts +11 -0
- package/packages/providers/dist/src/index.js +11 -0
- package/packages/providers/dist/src/openai-usage.d.ts +103 -0
- package/packages/providers/dist/src/openai-usage.js +208 -0
- package/packages/providers/dist/src/provider-id.d.ts +46 -0
- package/packages/providers/dist/src/provider-id.js +113 -0
- package/packages/providers/src/adapters.ts +362 -0
- package/packages/providers/src/deepagents-adapter.ts +458 -0
- package/packages/providers/src/glm-usage.ts +248 -0
- package/packages/providers/src/index.ts +11 -0
- package/packages/providers/src/openai-usage.ts +263 -0
- package/packages/providers/src/provider-id.ts +129 -0
- package/packages/quota-manager/dist/src/examples/tui-usage-integration.d.ts +35 -0
- package/packages/quota-manager/dist/src/examples/tui-usage-integration.js +73 -0
- package/packages/quota-manager/dist/src/index.d.ts +8 -0
- package/packages/quota-manager/dist/src/index.js +8 -0
- package/packages/quota-manager/dist/src/quota-manager.d.ts +70 -0
- package/packages/quota-manager/dist/src/quota-manager.js +260 -0
- package/packages/quota-manager/dist/src/tui-usage-monitor.d.ts +96 -0
- package/packages/quota-manager/dist/src/tui-usage-monitor.js +268 -0
- package/packages/quota-manager/src/examples/tui-usage-integration.ts +72 -0
- package/packages/quota-manager/src/index.ts +8 -0
- package/packages/quota-manager/src/quota-manager.ts +336 -0
- package/packages/quota-manager/src/tui-usage-monitor.ts +355 -0
- package/packages/rate-limiter/src/index.ts +6 -0
- package/packages/rate-limiter/src/limiter.ts +122 -0
- package/packages/rate-limiter/src/types.ts +41 -0
- package/packages/react-vite-plugin/src/analyzer.ts +226 -0
- package/packages/react-vite-plugin/src/index.ts +39 -0
- package/packages/react-vite-plugin/src/types.ts +28 -0
- package/packages/release-manager/src/changelog.ts +148 -0
- package/packages/release-manager/src/index.ts +21 -0
- package/packages/release-manager/src/types.ts +50 -0
- package/packages/release-manager/src/version.ts +52 -0
- package/packages/requirement-compiler/src/ambiguity-detector.ts +302 -0
- package/packages/requirement-compiler/src/classifier.ts +145 -0
- package/packages/requirement-compiler/src/compiler.ts +328 -0
- package/packages/requirement-compiler/src/extractor.ts +155 -0
- package/packages/requirement-compiler/src/index.ts +36 -0
- package/packages/requirement-compiler/src/normalizer.ts +161 -0
- package/packages/requirement-compiler/src/risk-detector.ts +58 -0
- package/packages/requirement-compiler/src/types.ts +596 -0
- package/packages/runtime/dist/src/command-executor.d.ts +129 -0
- package/packages/runtime/dist/src/command-executor.js +383 -0
- package/packages/runtime/dist/src/index.d.ts +11 -0
- package/packages/runtime/dist/src/index.js +11 -0
- package/packages/runtime/dist/src/local-runtime-agent.d.ts +111 -0
- package/packages/runtime/dist/src/local-runtime-agent.js +356 -0
- package/packages/runtime/dist/src/policy-engine.d.ts +203 -0
- package/packages/runtime/dist/src/policy-engine.js +592 -0
- package/packages/runtime/dist/src/runtime-api.d.ts +137 -0
- package/packages/runtime/dist/src/runtime-api.js +454 -0
- package/packages/runtime/dist/src/workspace-manager.d.ts +162 -0
- package/packages/runtime/dist/src/workspace-manager.js +451 -0
- package/packages/runtime/src/command-executor.ts +523 -0
- package/packages/runtime/src/index.ts +11 -0
- package/packages/runtime/src/local-runtime-agent.ts +480 -0
- package/packages/runtime/src/policy-engine.ts +813 -0
- package/packages/runtime/src/runtime-api.ts +665 -0
- package/packages/runtime/src/workspace-manager.ts +591 -0
- package/packages/scheduler/src/scheduler.ts +50 -0
- package/packages/scheduler-adapter/src/cron.ts +123 -0
- package/packages/scheduler-adapter/src/index.ts +9 -0
- package/packages/scheduler-adapter/src/interface.ts +61 -0
- package/packages/scheduler-adapter/src/internal.ts +99 -0
- package/packages/scheduler-adapter/src/systemd.ts +221 -0
- package/packages/session/src/history.ts +353 -0
- package/packages/session/src/index.ts +53 -0
- package/packages/session/src/manager.ts +481 -0
- package/packages/session/src/policy.ts +363 -0
- package/packages/session/src/store.ts +348 -0
- package/packages/session/src/types.ts +275 -0
- package/packages/session-api/dist/src/api.d.ts +83 -0
- package/packages/session-api/dist/src/api.js +49 -0
- package/packages/session-api/dist/src/index.d.ts +2 -0
- package/packages/session-api/dist/src/index.js +2 -0
- package/packages/session-api/dist/src/types.d.ts +22 -0
- package/packages/session-api/dist/src/types.js +5 -0
- package/packages/session-api/src/api.ts +117 -0
- package/packages/session-api/src/index.ts +1 -0
- package/packages/session-api/src/types.ts +23 -0
- package/packages/session-export/dist/src/exporter.d.ts +28 -0
- package/packages/session-export/dist/src/exporter.js +42 -0
- package/packages/session-export/dist/src/index.d.ts +2 -0
- package/packages/session-export/dist/src/index.js +2 -0
- package/packages/session-export/dist/src/types.d.ts +20 -0
- package/packages/session-export/dist/src/types.js +5 -0
- package/packages/session-export/src/exporter.ts +81 -0
- package/packages/session-export/src/index.ts +1 -0
- package/packages/session-export/src/types.ts +22 -0
- package/packages/shared-context/src/index.ts +7 -0
- package/packages/shared-context/src/shared-context.ts +42 -0
- package/packages/skill-registry/src/defaults.ts +146 -0
- package/packages/skill-registry/src/index.ts +48 -0
- package/packages/skill-registry/src/matching.ts +118 -0
- package/packages/skill-registry/src/registry.ts +211 -0
- package/packages/skill-registry/src/types.ts +97 -0
- package/packages/sprint-planner/src/decomposer.ts +57 -0
- package/packages/sprint-planner/src/index.ts +16 -0
- package/packages/sprint-planner/src/planner.ts +150 -0
- package/packages/sprint-planner/src/types.ts +59 -0
- package/packages/subscription-engine/dist/src/engine.d.ts +13 -0
- package/packages/subscription-engine/dist/src/engine.js +40 -0
- package/packages/subscription-engine/dist/src/index.d.ts +2 -0
- package/packages/subscription-engine/dist/src/index.js +2 -0
- package/packages/subscription-engine/dist/src/subscriptions.d.ts +19 -0
- package/packages/subscription-engine/dist/src/subscriptions.js +39 -0
- package/packages/subscription-engine/dist/src/types.d.ts +24 -0
- package/packages/subscription-engine/dist/src/types.js +5 -0
- package/packages/subscription-engine/src/engine.ts +55 -0
- package/packages/subscription-engine/src/index.ts +6 -0
- package/packages/subscription-engine/src/subscriptions.ts +55 -0
- package/packages/subscription-engine/src/types.ts +27 -0
- package/packages/task-compiler/src/command-policy.ts +193 -0
- package/packages/task-compiler/src/compiler.ts +114 -0
- package/packages/task-compiler/src/decompose.ts +265 -0
- package/packages/task-compiler/src/file-scope.ts +240 -0
- package/packages/task-compiler/src/graph.ts +144 -0
- package/packages/task-compiler/src/index.ts +38 -0
- package/packages/task-compiler/src/types.ts +225 -0
- package/packages/task-compiler/src/validate.ts +218 -0
- package/packages/task-compiler/src/verification.ts +248 -0
- package/packages/tencentdb-memory/src/client.ts +130 -0
- package/packages/tencentdb-memory/src/index.ts +32 -0
- package/packages/tencentdb-memory/src/loader.ts +150 -0
- package/packages/tencentdb-memory/src/mcp-tools.ts +213 -0
- package/packages/tencentdb-memory/src/types.ts +101 -0
- package/packages/tencentdb-sync/src/cli.ts +363 -0
- package/packages/tencentdb-sync/src/client.ts +268 -0
- package/packages/tencentdb-sync/src/config.ts +139 -0
- package/packages/tencentdb-sync/src/index.ts +15 -0
- package/packages/test-data-generator/src/faker-adapter.ts +657 -0
- package/packages/test-data-generator/src/generator.ts +461 -0
- package/packages/test-data-generator/src/index.ts +48 -0
- package/packages/test-data-generator/src/types.ts +421 -0
- package/packages/test-generator/src/generator.ts +144 -0
- package/packages/test-generator/src/index.ts +11 -0
- package/packages/test-generator/src/types.ts +39 -0
- package/packages/todo-bd-sync/src/detector.ts +171 -0
- package/packages/todo-bd-sync/src/extension.ts +129 -0
- package/packages/todo-bd-sync/src/index.ts +401 -0
- package/packages/todo-bd-sync/src/sync.ts +322 -0
- package/packages/todo-bd-sync/src/task-analyzer.ts +314 -0
- package/packages/todo-bd-sync/src/todo-reminder.ts +418 -0
- package/packages/todo-bd-sync/src/types.ts +137 -0
- package/packages/token-estimation/src/index.ts +192 -0
- package/packages/token-optimizer/src/index.ts +15 -0
- package/packages/token-optimizer/src/optimizer.ts +150 -0
- package/packages/token-optimizer/src/types.ts +47 -0
- package/packages/types/src/agent-worker-types.d.ts +206 -0
- package/packages/types/src/agent-worker-types.js +41 -0
- package/packages/types/src/agent-worker-types.ts +264 -0
- package/packages/types/src/ai-providers.d.ts +36 -0
- package/packages/types/src/ai-providers.js +66 -0
- package/packages/types/src/ai-providers.ts +73 -0
- package/packages/types/src/runtime-types.d.ts +418 -0
- package/packages/types/src/runtime-types.js +3 -0
- package/packages/types/src/runtime-types.ts +588 -0
- package/packages/workflow-events/dist/src/events.d.ts +38 -0
- package/packages/workflow-events/dist/src/events.js +55 -0
- package/packages/workflow-events/dist/src/index.d.ts +2 -0
- package/packages/workflow-events/dist/src/index.js +2 -0
- package/packages/workflow-events/dist/src/pipeline.d.ts +21 -0
- package/packages/workflow-events/dist/src/pipeline.js +36 -0
- package/packages/workflow-events/dist/src/types.d.ts +110 -0
- package/packages/workflow-events/dist/src/types.js +5 -0
- package/packages/workflow-events/src/events.ts +86 -0
- package/packages/workflow-events/src/index.ts +19 -0
- package/packages/workflow-events/src/pipeline.ts +41 -0
- package/packages/workflow-events/src/types.d.ts +110 -0
- package/packages/workflow-events/src/types.js +5 -0
- package/packages/workflow-events/src/types.ts +139 -0
- package/packages/workspace-scanner/dist/src/detect.d.ts +3 -0
- package/packages/workspace-scanner/dist/src/detect.js +60 -0
- package/packages/workspace-scanner/dist/src/git.d.ts +7 -0
- package/packages/workspace-scanner/dist/src/git.js +75 -0
- package/packages/workspace-scanner/dist/src/index.d.ts +5 -0
- package/packages/workspace-scanner/dist/src/index.js +4 -0
- package/packages/workspace-scanner/dist/src/scanner.d.ts +11 -0
- package/packages/workspace-scanner/dist/src/scanner.js +59 -0
- package/packages/workspace-scanner/dist/src/types.d.ts +35 -0
- package/packages/workspace-scanner/dist/src/types.js +5 -0
- package/packages/workspace-scanner/src/detect.ts +77 -0
- package/packages/workspace-scanner/src/git.ts +83 -0
- package/packages/workspace-scanner/src/index.ts +9 -0
- package/packages/workspace-scanner/src/scanner.ts +73 -0
- package/packages/workspace-scanner/src/types.ts +48 -0
- package/packages/worktree/dist/src/index.d.ts +7 -0
- package/packages/worktree/dist/src/index.js +7 -0
- package/packages/worktree/dist/src/worktree.d.ts +88 -0
- package/packages/worktree/dist/src/worktree.js +239 -0
- package/packages/worktree/src/index.ts +7 -0
- package/packages/worktree/src/worktree.ts +290 -0
- package/packages/write-review/src/blackboard.ts +249 -0
- package/packages/write-review/src/gate.ts +169 -0
- package/packages/write-review/src/index.ts +18 -0
- package/packages/write-review/src/injection.ts +170 -0
- package/packages/write-review/src/review.ts +206 -0
- package/packages/write-review/src/trigger.ts +133 -0
- package/packages/write-review/src/types.ts +90 -0
- package/proactive-compact.ts +90 -0
- package/prompts/tencentdb-connect.md +35 -0
- package/prompts/tencentdb-setup.md +101 -0
- package/prompts/tencentdb.md +88 -0
- package/renderer.ts +205 -0
- package/skills/harness-runtime/SKILL.md +237 -0
- package/status-parsers.ts +84 -0
- package/tracker.ts +72 -0
- package/windows.ts +121 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation Runner — Core (RFC-0020)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
EvaluationCase,
|
|
7
|
+
EvaluationConfig,
|
|
8
|
+
EvaluationInput,
|
|
9
|
+
EvaluatorFn,
|
|
10
|
+
EvaluationReport,
|
|
11
|
+
EvaluationResult,
|
|
12
|
+
EvaluationSuite,
|
|
13
|
+
} from "./types.js";
|
|
14
|
+
|
|
15
|
+
let _runCounter = 0;
|
|
16
|
+
function nextRunId(): string {
|
|
17
|
+
return `run-${Date.now()}-${++_runCounter}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class EvaluationRunner {
|
|
21
|
+
private evaluators = new Map<string, EvaluatorFn>();
|
|
22
|
+
private config: Required<EvaluationConfig>;
|
|
23
|
+
|
|
24
|
+
constructor(config: EvaluationConfig = {}) {
|
|
25
|
+
this.config = {
|
|
26
|
+
timeoutMs: config.timeoutMs ?? 30_000,
|
|
27
|
+
retries: config.retries ?? 1,
|
|
28
|
+
parallel: config.parallel ?? false,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
registerEvaluator(name: string, fn: EvaluatorFn): void {
|
|
33
|
+
this.evaluators.set(name, fn);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async runSuite(
|
|
37
|
+
suite: EvaluationSuite,
|
|
38
|
+
execute: (input: EvaluationInput) => Promise<string>,
|
|
39
|
+
): Promise<EvaluationReport> {
|
|
40
|
+
const results: EvaluationResult[] = [];
|
|
41
|
+
const cases = suite.cases;
|
|
42
|
+
|
|
43
|
+
if (this.config.parallel) {
|
|
44
|
+
const promises = cases.map((c) => this.runCase(c, execute));
|
|
45
|
+
const all = await Promise.allSettled(promises);
|
|
46
|
+
for (const r of all) {
|
|
47
|
+
if (r.status === "fulfilled") results.push(...r.value);
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
for (const c of cases) {
|
|
51
|
+
const r = await this.runCase(c, execute);
|
|
52
|
+
results.push(...r);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const passed = results.filter((r) => r.passed).length;
|
|
57
|
+
const summary: EvaluationReport["summary"] = {};
|
|
58
|
+
|
|
59
|
+
for (const r of results) {
|
|
60
|
+
if (!summary[r.metric]) {
|
|
61
|
+
summary[r.metric] = { count: 0, avgScore: 0 };
|
|
62
|
+
}
|
|
63
|
+
const s = summary[r.metric];
|
|
64
|
+
s.count++;
|
|
65
|
+
s.avgScore = (s.avgScore * (s.count - 1) + r.score) / s.count;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
suiteId: suite.id,
|
|
70
|
+
runAt: new Date().toISOString(),
|
|
71
|
+
total: results.length,
|
|
72
|
+
passed,
|
|
73
|
+
failed: results.length - passed,
|
|
74
|
+
results,
|
|
75
|
+
summary,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private async runCase(
|
|
80
|
+
c: EvaluationCase,
|
|
81
|
+
execute: (input: EvaluationInput) => Promise<string>,
|
|
82
|
+
): Promise<EvaluationResult[]> {
|
|
83
|
+
const start = Date.now();
|
|
84
|
+
let output: string;
|
|
85
|
+
try {
|
|
86
|
+
output = await Promise.race([
|
|
87
|
+
execute(c.input),
|
|
88
|
+
new Promise<string>((_, reject) =>
|
|
89
|
+
setTimeout(() => reject(new Error("timeout")), this.config.timeoutMs),
|
|
90
|
+
),
|
|
91
|
+
]);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
return c.evaluators.map((name) => ({
|
|
94
|
+
runId: nextRunId(),
|
|
95
|
+
metric: name,
|
|
96
|
+
score: 0,
|
|
97
|
+
passed: false,
|
|
98
|
+
details: err instanceof Error ? err.message : "unknown error",
|
|
99
|
+
latencyMs: Date.now() - start,
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const results: EvaluationResult[] = [];
|
|
104
|
+
for (const name of c.evaluators) {
|
|
105
|
+
const fn = this.evaluators.get(name);
|
|
106
|
+
if (!fn) {
|
|
107
|
+
results.push({
|
|
108
|
+
runId: nextRunId(),
|
|
109
|
+
metric: name,
|
|
110
|
+
score: 0,
|
|
111
|
+
passed: false,
|
|
112
|
+
details: `Evaluator not registered: ${name}`,
|
|
113
|
+
latencyMs: Date.now() - start,
|
|
114
|
+
});
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
for (let attempt = 0; attempt < this.config.retries; attempt++) {
|
|
119
|
+
try {
|
|
120
|
+
const r = await fn(c.input, output);
|
|
121
|
+
results.push(r);
|
|
122
|
+
break;
|
|
123
|
+
} catch (err) {
|
|
124
|
+
if (attempt === this.config.retries - 1) {
|
|
125
|
+
results.push({
|
|
126
|
+
runId: nextRunId(),
|
|
127
|
+
metric: name,
|
|
128
|
+
score: 0,
|
|
129
|
+
passed: false,
|
|
130
|
+
details: err instanceof Error ? err.message : "unknown error",
|
|
131
|
+
latencyMs: Date.now() - start,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return results;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
listEvaluators(): string[] {
|
|
141
|
+
return [...this.evaluators.keys()];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Built-in evaluators
|
|
146
|
+
export const exactMatchEvaluator: EvaluatorFn = async (input, output) => {
|
|
147
|
+
const expected = input.expectedOutput ?? "";
|
|
148
|
+
return {
|
|
149
|
+
runId: nextRunId(),
|
|
150
|
+
metric: "exact-match",
|
|
151
|
+
score: output === expected ? 1 : 0,
|
|
152
|
+
passed: output === expected,
|
|
153
|
+
details: output === expected ? "exact match" : "output differs from expected",
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const substringMatchEvaluator: EvaluatorFn = async (input, output) => {
|
|
158
|
+
const expected = input.expectedOutput ?? "";
|
|
159
|
+
const found = expected.length > 0 && output.includes(expected);
|
|
160
|
+
return {
|
|
161
|
+
runId: nextRunId(),
|
|
162
|
+
metric: "substring-match",
|
|
163
|
+
score: found ? 1 : 0,
|
|
164
|
+
passed: found,
|
|
165
|
+
details: found ? "expected substring found" : "expected substring not found",
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const lengthEvaluator: EvaluatorFn = async (input, output) => {
|
|
170
|
+
const min = (input.metadata?.["minLength"] as number) ?? 0;
|
|
171
|
+
const max = (input.metadata?.["maxLength"] as number) ?? Infinity;
|
|
172
|
+
const len = output.length;
|
|
173
|
+
const passed = len >= min && len <= max;
|
|
174
|
+
const score = passed ? 1 : Math.max(0, 1 - Math.abs(len - (min + max) / 2) / max);
|
|
175
|
+
return {
|
|
176
|
+
runId: nextRunId(),
|
|
177
|
+
metric: "length-check",
|
|
178
|
+
score,
|
|
179
|
+
passed,
|
|
180
|
+
details: `length ${len}, expected ${min}-${max}`,
|
|
181
|
+
};
|
|
182
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation Runner — Types (RFC-0020)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface EvaluationInput {
|
|
6
|
+
prompt: string;
|
|
7
|
+
expectedOutput?: string;
|
|
8
|
+
metadata?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface EvaluationResult {
|
|
12
|
+
runId: string;
|
|
13
|
+
metric: string;
|
|
14
|
+
score: number;
|
|
15
|
+
passed: boolean;
|
|
16
|
+
details?: string;
|
|
17
|
+
latencyMs?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface EvaluationSuite {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
cases: EvaluationCase[];
|
|
24
|
+
thresholds: Record<string, number>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface EvaluationCase {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
input: EvaluationInput;
|
|
31
|
+
expected?: string;
|
|
32
|
+
evaluators: string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type EvaluatorFn = (input: EvaluationInput, output: string) => Promise<EvaluationResult>
|
|
36
|
+
|
|
37
|
+
export interface EvaluationReport {
|
|
38
|
+
suiteId: string;
|
|
39
|
+
runAt: string;
|
|
40
|
+
total: number;
|
|
41
|
+
passed: number;
|
|
42
|
+
failed: number;
|
|
43
|
+
results: EvaluationResult[];
|
|
44
|
+
summary: Record<string, { count: number; avgScore: number }>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface EvaluationConfig {
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
retries?: number;
|
|
50
|
+
parallel?: boolean;
|
|
51
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Bus — pub/sub implementation
|
|
3
|
+
*/
|
|
4
|
+
import type { Subscriber, Subscription, EventPayload } from "./types.js";
|
|
5
|
+
export declare class EventBus {
|
|
6
|
+
private readonly subs;
|
|
7
|
+
private readonly byTopic;
|
|
8
|
+
publish<T>(topic: string, data: T, source?: string): string;
|
|
9
|
+
subscribe<T>(topic: string, subscriber: Subscriber<T>, filter?: (data: T) => boolean, priority?: number): string;
|
|
10
|
+
unsubscribe(subscriptionId: string): void;
|
|
11
|
+
unsubscribeAll(topic?: string): void;
|
|
12
|
+
replay(topic: string, events: EventPayload<unknown>[]): void;
|
|
13
|
+
getSubscribers(topic?: string): Subscription[];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=bus.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Bus — pub/sub implementation
|
|
3
|
+
*/
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
export class EventBus {
|
|
6
|
+
subs = new Map();
|
|
7
|
+
byTopic = new Map();
|
|
8
|
+
publish(topic, data, source = "system") {
|
|
9
|
+
const eventId = randomUUID();
|
|
10
|
+
const timestamp = new Date().toISOString();
|
|
11
|
+
const payload = {
|
|
12
|
+
topic,
|
|
13
|
+
data,
|
|
14
|
+
timestamp,
|
|
15
|
+
eventId,
|
|
16
|
+
source,
|
|
17
|
+
};
|
|
18
|
+
const topicIds = this.byTopic.get(topic) ?? new Set();
|
|
19
|
+
const wildcardIds = this.byTopic.get("*") ?? new Set();
|
|
20
|
+
const matches = [];
|
|
21
|
+
for (const sid of [...topicIds, ...wildcardIds]) {
|
|
22
|
+
const sub = this.subs.get(sid);
|
|
23
|
+
if (!sub || !sub.active)
|
|
24
|
+
continue;
|
|
25
|
+
if (sub.filter && !sub.filter(data))
|
|
26
|
+
continue;
|
|
27
|
+
matches.push({ sub, payload });
|
|
28
|
+
}
|
|
29
|
+
matches.sort((a, b) => b.sub.priority - a.sub.priority);
|
|
30
|
+
for (const { sub } of matches) {
|
|
31
|
+
try {
|
|
32
|
+
sub.subscriber(payload);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
sub.active = false;
|
|
36
|
+
this.subs.delete(sub.id);
|
|
37
|
+
this.byTopic.get(sub.topic)?.delete(sub.id);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return eventId;
|
|
41
|
+
}
|
|
42
|
+
subscribe(topic, subscriber, filter, priority = 0) {
|
|
43
|
+
const id = randomUUID();
|
|
44
|
+
const sub = {
|
|
45
|
+
id,
|
|
46
|
+
topic,
|
|
47
|
+
subscriber: subscriber,
|
|
48
|
+
filter: filter,
|
|
49
|
+
priority,
|
|
50
|
+
active: true,
|
|
51
|
+
};
|
|
52
|
+
this.subs.set(id, sub);
|
|
53
|
+
if (!this.byTopic.has(topic))
|
|
54
|
+
this.byTopic.set(topic, new Set());
|
|
55
|
+
this.byTopic.get(topic).add(id);
|
|
56
|
+
return id;
|
|
57
|
+
}
|
|
58
|
+
unsubscribe(subscriptionId) {
|
|
59
|
+
const sub = this.subs.get(subscriptionId);
|
|
60
|
+
if (!sub)
|
|
61
|
+
return;
|
|
62
|
+
sub.active = false;
|
|
63
|
+
this.subs.delete(subscriptionId);
|
|
64
|
+
this.byTopic.get(sub.topic)?.delete(subscriptionId);
|
|
65
|
+
}
|
|
66
|
+
unsubscribeAll(topic) {
|
|
67
|
+
if (topic) {
|
|
68
|
+
const ids = this.byTopic.get(topic);
|
|
69
|
+
if (ids) {
|
|
70
|
+
for (const id of ids)
|
|
71
|
+
this.unsubscribe(id);
|
|
72
|
+
this.byTopic.delete(topic);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
for (const id of this.subs.keys())
|
|
77
|
+
this.unsubscribe(id);
|
|
78
|
+
this.byTopic.clear();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
replay(topic, events) {
|
|
82
|
+
for (const event of events) {
|
|
83
|
+
if (event.topic === topic || topic === "*") {
|
|
84
|
+
this.publish(event.topic, event.data, event.source);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
getSubscribers(topic) {
|
|
89
|
+
if (topic) {
|
|
90
|
+
const ids = this.byTopic.get(topic) ?? new Set();
|
|
91
|
+
return [...ids]
|
|
92
|
+
.map((id) => this.subs.get(id))
|
|
93
|
+
.filter((s) => s !== undefined);
|
|
94
|
+
}
|
|
95
|
+
return [...this.subs.values()].filter((s) => s.active);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=bus.js.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HerdrEventBus — File-based cross-process event bus for herdr tabs.
|
|
3
|
+
*
|
|
4
|
+
* Uses JSONL files in a shared workspace so separate pi processes
|
|
5
|
+
* (coding agent, review agent, etc.) can communicate.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* Workspace (shared dir)
|
|
9
|
+
* ├── events.jsonl # Append-only event log
|
|
10
|
+
* ├── subscriptions/ # Per-agent subscription markers
|
|
11
|
+
* └── payloads/ # Event payload files
|
|
12
|
+
*
|
|
13
|
+
* Flow:
|
|
14
|
+
* 1. Agent publishes event → append to events.jsonl + write payload
|
|
15
|
+
* 2. Other agents poll events.jsonl → process matching events
|
|
16
|
+
* 3. Each agent tracks last-read offset in subscriptions/{agentId}.json
|
|
17
|
+
*/
|
|
18
|
+
import type { EventPayload } from "./types.js";
|
|
19
|
+
export interface HerdrBusConfig {
|
|
20
|
+
workspace: string;
|
|
21
|
+
pollIntervalMs?: number;
|
|
22
|
+
agentId: string;
|
|
23
|
+
}
|
|
24
|
+
export interface HerdrSubscription {
|
|
25
|
+
id: string;
|
|
26
|
+
topic: string;
|
|
27
|
+
lastOffset: number;
|
|
28
|
+
filter?: (data: unknown) => boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare class HerdrEventBus {
|
|
31
|
+
private readonly workspace;
|
|
32
|
+
private readonly agentId;
|
|
33
|
+
private readonly pollIntervalMs;
|
|
34
|
+
private readonly subscriptions;
|
|
35
|
+
private polling;
|
|
36
|
+
private pollTimer?;
|
|
37
|
+
constructor(config: HerdrBusConfig);
|
|
38
|
+
private ensureDirs;
|
|
39
|
+
subscribe(topic: string, filter?: (data: unknown) => boolean): string;
|
|
40
|
+
unsubscribe(id: string): void;
|
|
41
|
+
publish<T>(topic: string, data: T): string;
|
|
42
|
+
startPolling(handler: (payload: EventPayload<unknown>) => void | Promise<void>): void;
|
|
43
|
+
stopPolling(): void;
|
|
44
|
+
private pollEvents;
|
|
45
|
+
private readNewEvents;
|
|
46
|
+
private subscriptionsPath;
|
|
47
|
+
private saveSubscriptions;
|
|
48
|
+
private loadSubscriptions;
|
|
49
|
+
getSubscribedTopics(): string[];
|
|
50
|
+
getWorkspace(): string;
|
|
51
|
+
}
|
|
52
|
+
export declare function getHerdrWorkspace(): string;
|
|
53
|
+
export declare function createHerdrBus(agentId: string): HerdrEventBus;
|
|
54
|
+
export interface HerdrWorkspace {
|
|
55
|
+
root: string;
|
|
56
|
+
code: string;
|
|
57
|
+
reviews: string;
|
|
58
|
+
payloads: string;
|
|
59
|
+
subscriptions: string;
|
|
60
|
+
}
|
|
61
|
+
export declare function getHerdrWorkspacePaths(): HerdrWorkspace;
|
|
62
|
+
export declare function ensureHerdrWorkspace(): HerdrWorkspace;
|
|
63
|
+
export type LoopVerdict = "approved" | "changes_requested" | "blocked";
|
|
64
|
+
export interface LoopConfig {
|
|
65
|
+
loopId: string;
|
|
66
|
+
writeCount: number;
|
|
67
|
+
reviewCount: number;
|
|
68
|
+
prompt: string;
|
|
69
|
+
nextReviewAfter: number;
|
|
70
|
+
createdAt: string;
|
|
71
|
+
}
|
|
72
|
+
export interface CodeTickPayload {
|
|
73
|
+
loopId: string;
|
|
74
|
+
iteration: number;
|
|
75
|
+
prompt: string;
|
|
76
|
+
}
|
|
77
|
+
export interface CodeWrittenPayload {
|
|
78
|
+
loopId: string;
|
|
79
|
+
iteration: number;
|
|
80
|
+
files: string[];
|
|
81
|
+
summary?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface ReviewTickPayload {
|
|
84
|
+
loopId: string;
|
|
85
|
+
iteration: number;
|
|
86
|
+
codeFiles: string[];
|
|
87
|
+
}
|
|
88
|
+
export interface ReviewCompletedPayload {
|
|
89
|
+
loopId: string;
|
|
90
|
+
iteration: number;
|
|
91
|
+
verdict: LoopVerdict;
|
|
92
|
+
message: string;
|
|
93
|
+
reportFile: string;
|
|
94
|
+
}
|
|
95
|
+
export interface LoopEarlyExitPayload {
|
|
96
|
+
loopId: string;
|
|
97
|
+
reason: LoopVerdict;
|
|
98
|
+
message: string;
|
|
99
|
+
}
|
|
100
|
+
export interface LoopFinishedPayload {
|
|
101
|
+
loopId: string;
|
|
102
|
+
summary: string;
|
|
103
|
+
iterations: {
|
|
104
|
+
writes: number;
|
|
105
|
+
reviews: number;
|
|
106
|
+
finalVerdict: LoopVerdict;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export declare function publishLoopStarted(bus: HerdrEventBus, config: LoopConfig): string;
|
|
110
|
+
export declare function publishCodeTick(bus: HerdrEventBus, loopId: string, iteration: number, prompt: string): string;
|
|
111
|
+
export declare function publishCodeWritten(bus: HerdrEventBus, loopId: string, iteration: number, files: string[], summary?: string): string;
|
|
112
|
+
export declare function publishReviewTick(bus: HerdrEventBus, loopId: string, iteration: number, codeFiles: string[]): string;
|
|
113
|
+
export declare function publishReviewCompleted(bus: HerdrEventBus, loopId: string, iteration: number, verdict: LoopVerdict, message: string, reportFile: string): string;
|
|
114
|
+
export declare function publishLoopEarlyExit(bus: HerdrEventBus, loopId: string, reason: LoopVerdict, message: string): string;
|
|
115
|
+
export declare function publishLoopFinished(bus: HerdrEventBus, loopId: string, summary: string, writes: number, reviews: number, finalVerdict: LoopVerdict): string;
|
|
116
|
+
export declare function parseVerdict(content: string): LoopVerdict | null;
|
|
117
|
+
export declare function parseVerdictMessage(content: string): string;
|
|
118
|
+
export declare function publishCodeWrittenSimple(bus: HerdrEventBus, taskId: string, files: string[], branch?: string): string;
|
|
119
|
+
export declare function publishReviewRequestedSimple(bus: HerdrEventBus, taskId: string, codeTaskId: string): string;
|
|
120
|
+
export declare function publishReviewCompletedSimple(bus: HerdrEventBus, taskId: string, reportFile: string, status: "approved" | "changes_requested" | "failed"): string;
|
|
121
|
+
//# sourceMappingURL=herdr-bus.d.ts.map
|