pi-harness-runtime 1.1.440 → 1.1.441
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/harness/e2e/auto-test-loop.ts +2 -0
- package/harness/e2e/browser-scrapers/base-browser-scraper.ts +2 -0
- package/harness/e2e/browser-scrapers/chrome-profile-manager.ts +2 -0
- package/harness/e2e/browser-scrapers/codex-browser-scraper.ts +2 -0
- package/harness/e2e/tools-detector.ts +2 -0
- package/harness/key-loader.ts +2 -0
- package/harness/langchain/checkpointer.ts +2 -0
- package/harness/langchain/cron-cli.ts +2 -0
- package/harness/langchain/graph.ts +2 -0
- package/harness/notification-center.ts +2 -0
- package/harness/secret-provider.ts +2 -0
- package/index.ts +2 -0
- package/package.json +7 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/agent-policy/dist/extension.d.ts.map +1 -1
- package/packages/agent-policy/dist/extension.js +2 -0
- package/packages/agent-policy/dist/extension.js.map +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/agent-policy/src/extension.ts +2 -0
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/dist/minimax-browser-auth.d.ts.map +1 -1
- package/packages/auth/dist/minimax-browser-auth.js +23 -1
- package/packages/auth/dist/minimax-browser-auth.js.map +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/auth/src/minimax-browser-auth.ts +30 -5
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/dist/inbox.d.ts.map +1 -1
- package/packages/autonomous-runtime/dist/inbox.js +2 -0
- package/packages/autonomous-runtime/dist/inbox.js.map +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/autonomous-runtime/src/inbox.ts +2 -0
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/dist/src/clipboard.d.ts.map +1 -1
- package/packages/clipboard/dist/src/clipboard.js +2 -0
- package/packages/clipboard/dist/src/clipboard.js.map +1 -1
- package/packages/clipboard/dist/src/copy-sync.d.ts.map +1 -1
- package/packages/clipboard/dist/src/copy-sync.js +2 -0
- package/packages/clipboard/dist/src/copy-sync.js.map +1 -1
- package/packages/clipboard/dist/src/gist-relay.d.ts.map +1 -1
- package/packages/clipboard/dist/src/gist-relay.js +2 -0
- package/packages/clipboard/dist/src/gist-relay.js.map +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard/src/clipboard.ts +2 -0
- package/packages/clipboard/src/copy-sync.ts +2 -0
- package/packages/clipboard/src/gist-relay.ts +2 -0
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/connection-runtime/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/contracts/dist/delegation-store.js +1 -4
- package/packages/contracts/dist/workspace-env.js +28 -1
- package/packages/contracts/package.json +1 -1
- package/packages/contracts/src/delegation-store.ts +9 -4
- package/packages/contracts/src/workspace-env.ts +29 -4
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/durable-review/package.json +1 -1
- package/packages/e2e-tester/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-sink/package.json +1 -1
- package/packages/event-store/dist/src/store.d.ts.map +1 -1
- package/packages/event-store/dist/src/store.js +2 -0
- package/packages/event-store/dist/src/store.js.map +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/event-store/src/store.ts +3 -0
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/dist/analyzer.d.ts.map +1 -1
- package/packages/generic-web-plugin/dist/analyzer.js +2 -0
- package/packages/generic-web-plugin/dist/analyzer.js.map +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/generic-web-plugin/src/analyzer.ts +3 -0
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/dist/mcp-client.d.ts.map +1 -1
- package/packages/knowledge-retrieval/dist/mcp-client.js +0 -1
- package/packages/knowledge-retrieval/dist/mcp-client.js.map +1 -1
- package/packages/knowledge-retrieval/package.json +1 -4
- package/packages/knowledge-retrieval/src/mcp-client.ts +0 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/mcp-adapter/dist/server.d.ts.map +1 -1
- package/packages/mcp-adapter/dist/server.js +2 -0
- package/packages/mcp-adapter/dist/server.js.map +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/mcp-adapter/src/server.ts +3 -0
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/paperclip-integration/dist/index.d.ts.map +1 -1
- package/packages/paperclip-integration/dist/index.js +2 -0
- package/packages/paperclip-integration/dist/index.js.map +1 -1
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/paperclip-integration/src/index.ts +2 -0
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/permission-mode/package.json +1 -1
- package/packages/privilege-broker/dist/audit.d.ts.map +1 -1
- package/packages/privilege-broker/dist/audit.js +2 -0
- package/packages/privilege-broker/dist/audit.js.map +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/privilege-broker/src/audit.ts +2 -0
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/dist/compiler.d.ts.map +1 -1
- package/packages/prompt-compiler/dist/compiler.js +2 -0
- package/packages/prompt-compiler/dist/compiler.js.map +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-compiler/src/compiler.ts +2 -0
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/relay/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/dist/client.d.ts.map +1 -1
- package/packages/skill-mcp-client/dist/client.js +0 -1
- package/packages/skill-mcp-client/dist/client.js.map +1 -1
- package/packages/skill-mcp-client/package.json +1 -4
- package/packages/skill-mcp-client/src/client.ts +0 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/dist/parser.d.ts.map +1 -1
- package/packages/skills/dist/parser.js +2 -0
- package/packages/skills/dist/parser.js.map +1 -1
- package/packages/skills/dist/skill-versioning.d.ts.map +1 -1
- package/packages/skills/dist/skill-versioning.js +2 -0
- package/packages/skills/dist/skill-versioning.js.map +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/skills/src/parser.ts +3 -0
- package/packages/skills/src/skill-versioning.ts +2 -0
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/tooling-preference/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/two-phase-review/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/voice-api/package.json +1 -1
- package/packages/webmcp-tester/dist/index.js +0 -2
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/webmcp-tester/src/index.ts +0 -3
- package/packages/wiki/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/dist/trigger.d.ts.map +1 -1
- package/packages/write-review/dist/trigger.js +1 -2
- package/packages/write-review/dist/trigger.js.map +1 -1
- package/packages/write-review/package.json +1 -1
- package/packages/write-review/src/trigger.ts +1 -2
- package/scripts/lib/runtime-imports.ts +189 -3
- package/scripts/telegram-webhook-server.ts +2 -0
- package/scripts/verify-package-contents.ts +148 -1
- package/harness/e2e/tools-detector.test.ts +0 -155
- package/harness/glm-quota-countdown.test.ts +0 -323
- package/harness/langchain/agents.test.ts +0 -39
- package/harness/langchain/checkpointer.test.ts +0 -243
- package/harness/langchain/daemon.test.ts +0 -459
- package/harness/langchain/model-router.test.ts +0 -191
- package/harness/langchain/ping-pong-middleware.test.ts +0 -69
- package/harness/langchain/scoreboard.test.ts +0 -267
- package/harness/langchain/status-line.test.ts +0 -106
- package/harness/langchain/surge.test.ts +0 -467
- package/harness/langchain/widget.test.ts +0 -251
- package/harness/skill-sync.test.ts +0 -57
- package/harness/ssh-detach-interceptor.test.ts +0 -263
- package/harness/ssh-hang-recovery.test.ts +0 -86
- package/packages/a2a-adapter/test/a2a.test.ts +0 -151
- package/packages/agent-policy/test/interlock.test.ts +0 -101
- package/packages/agent-policy/test/policy-retention.test.ts +0 -380
- package/packages/agent-policy/test/policy.test.ts +0 -387
- package/packages/auth/test/auth.test.ts +0 -238
- package/packages/autonomous-refactor/test/refactor.test.ts +0 -202
- package/packages/autonomous-runtime/test/types.test.ts +0 -95
- package/packages/cache-strategy/test/cache.test.ts +0 -137
- package/packages/capability-registry/test/registry.test.ts +0 -204
- package/packages/checkpoint/test/engine.test.ts +0 -265
- package/packages/cli-plugin-sdk/test/cli.test.ts +0 -45
- package/packages/code-generation/test/generator.test.ts +0 -238
- package/packages/code-review/test/engine.test.ts +0 -302
- package/packages/codex-adapter/test/provider.test.ts +0 -142
- package/packages/codex-watcher/test/watch.test.ts +0 -453
- package/packages/context-compiler/test/context-compiler.test.ts +0 -746
- package/packages/context-manager/test/context.test.ts +0 -198
- package/packages/contracts/test/delegation.test.ts +0 -350
- package/packages/contracts/test/workspace-env.test.ts +0 -802
- package/packages/cookie-sanitizer/test/infer.test.ts +0 -110
- package/packages/cookie-sanitizer/test/normalize.test.ts +0 -113
- package/packages/cookie-sanitizer/test/parse.test.ts +0 -204
- package/packages/cookie-sanitizer/test/sync.test.ts +0 -237
- package/packages/cookie-sanitizer/test/watcher.test.ts +0 -27
- package/packages/cost-optimizer/test/cost-optimizer.test.ts +0 -438
- package/packages/dependency-analyzer/test/analyzer.test.ts +0 -49
- package/packages/django-plugin/test/analyzer.test.ts +0 -195
- package/packages/doc-generator/test/docs.test.ts +0 -168
- package/packages/durable-review/test/acceptance.test.ts +0 -357
- package/packages/durable-review/test/smoke.test.ts +0 -107
- package/packages/evaluation-engine/test/engine.test.ts +0 -277
- package/packages/evaluation-runner/test/runner.test.ts +0 -168
- package/packages/event-bus/test/bus.test.ts +0 -100
- package/packages/event-store/test/store.test.ts +0 -115
- package/packages/experience-replay/test/replay.test.ts +0 -267
- package/packages/feedback-collector/test/collector.test.ts +0 -142
- package/packages/framework-detector/test/detector.test.ts +0 -75
- package/packages/framework-plugin-sdk/test/manager.test.ts +0 -320
- package/packages/frappe-plugin/test/analyzer.test.ts +0 -250
- package/packages/generic-web-plugin/test/analyzer.test.ts +0 -134
- package/packages/health-monitor/test/health.test.ts +0 -231
- package/packages/intent-analyzer/test/analyzer.test.ts +0 -72
- package/packages/intent-analyzer/test/ping-pong.test.ts +0 -96
- package/packages/jev-judge/tests/auto-continue-context.test.ts +0 -280
- package/packages/jev-judge/tests/continuation-controller.test.ts +0 -1396
- package/packages/jev-judge/tests/jev-provider-chain.test.ts +0 -536
- package/packages/jev-judge/tests/outcome-application.test.ts +0 -132
- package/packages/jev-judge/tests/question-risk.test.ts +0 -129
- package/packages/jev-judge/tests/typesafe-provider.test.ts +0 -640
- package/packages/jev-judge/tests/validation-ledger.test.ts +0 -181
- package/packages/jev-judge/tests/validation-plan.test.ts +0 -170
- package/packages/jev-judge/tests/validation-tie-breaker.test.ts +0 -88
- package/packages/laravel-plugin/test/analyzer.test.ts +0 -220
- package/packages/learning-engine/test/engine.test.ts +0 -331
- package/packages/logging/test/buffer.test.ts +0 -44
- package/packages/logging/test/classification.test.ts +0 -137
- package/packages/logging/test/config.test.ts +0 -97
- package/packages/logging/test/fanout.test.ts +0 -186
- package/packages/logging/test/identity-transport.test.ts +0 -197
- package/packages/logging/test/incidents.test.ts +0 -404
- package/packages/logging/test/ingest-schema.test.ts +0 -184
- package/packages/logging/test/integration.test.ts +0 -140
- package/packages/logging/test/log-http.test.ts +0 -246
- package/packages/logging/test/redact.test.ts +0 -109
- package/packages/logging/test/sampler.test.ts +0 -57
- package/packages/logging/test/server.test.ts +0 -444
- package/packages/logging/test/shipper.test.ts +0 -152
- package/packages/logging/test/spool.test.ts +0 -96
- package/packages/mcp-adapter/test/server.test.ts +0 -91
- package/packages/memory-engine/test/engine.test.ts +0 -456
- package/packages/model-registry/test/registry.test.ts +0 -342
- package/packages/nextjs-plugin/test/analyzer.test.ts +0 -149
- package/packages/notification/test/approval-payload.test.ts +0 -269
- package/packages/notification/test/detail-format.test.ts +0 -106
- package/packages/notification/test/notification.test.ts +0 -375
- package/packages/notification/test/pending-question-lifecycle.test.ts +0 -195
- package/packages/notification/test/pending-question.test.ts +0 -331
- package/packages/notification/test/tooling-proposal-payload.test.ts +0 -212
- package/packages/observability/test/observability.test.ts +0 -1350
- package/packages/performance-optimizer/test/optimizer.test.ts +0 -267
- package/packages/project-analyzer/test/index.test.ts +0 -1719
- package/packages/prompt-compiler/test/prompt-compiler.test.ts +0 -813
- package/packages/prompt-versioning/test/versioning.test.ts +0 -112
- package/packages/provider-adapter-sdk/test/sdk.test.ts +0 -220
- package/packages/provider-router/test/provider-router.test.ts +0 -405
- package/packages/provider-selector/test/selector.test.ts +0 -192
- package/packages/providers/test/providers.test.ts +0 -225
- package/packages/qdrant-skills/test/collection-info.test.ts +0 -165
- package/packages/qdrant-skills/test/embedder-batch.test.ts +0 -184
- package/packages/qdrant-skills/test/embedder.test.ts +0 -97
- package/packages/quota-manager/test/quota.test.ts +0 -432
- package/packages/rate-limiter/test/limiter.test.ts +0 -128
- package/packages/react-vite-plugin/test/analyzer.test.ts +0 -139
- package/packages/relay/test/client.test.ts +0 -446
- package/packages/relay/test/relay-e2e.test.ts +0 -299
- package/packages/relay/test/relay-endpoint.test.ts +0 -278
- package/packages/release-manager/test/release.test.ts +0 -215
- package/packages/requirement-compiler/test/requirement-compiler.test.ts +0 -743
- package/packages/runtime/test/runtime-api.test.ts +0 -169
- package/packages/runtime/test/runtime.test.ts +0 -297
- package/packages/scheduler/test/scheduler.test.ts +0 -125
- package/packages/session/test/manager.test.ts +0 -233
- package/packages/shared-context/test/shared-context.test.ts +0 -114
- package/packages/skill-registry/test/registry.test.ts +0 -508
- package/packages/skills/test/init-skills.test.ts +0 -114
- package/packages/skills/test/remote-skills.test.ts +0 -360
- package/packages/skills/test/remote-source.test.ts +0 -248
- package/packages/skills/test/sanitize.test.ts +0 -250
- package/packages/skills/test/vector-indexing.test.ts +0 -205
- package/packages/skills/test/vector-schema.test.ts +0 -180
- package/packages/skills/test/vector-threshold.test.ts +0 -108
- package/packages/sprint-planner/test/planner.test.ts +0 -187
- package/packages/task-compiler/test/task-compiler.test.ts +0 -628
- package/packages/test-data-generator/test/generator.test.ts +0 -265
- package/packages/test-generator/test/generator.test.ts +0 -156
- package/packages/token-estimation/test/token-estimation.test.ts +0 -207
- package/packages/token-optimizer/test/optimizer.test.ts +0 -141
- package/packages/tooling-preference/tests/changed-files.test.ts +0 -124
- package/packages/tooling-preference/tests/detect.test.ts +0 -188
- package/packages/tooling-preference/tests/proposal.test.ts +0 -107
- package/packages/tooling-preference/tests/quality-check.test.ts +0 -272
- package/packages/tooling-preference/tests/registry.test.ts +0 -51
- package/packages/tooling-preference/tests/store.test.ts +0 -99
- package/packages/trajectory/test/store.test.ts +0 -250
- package/packages/tui/test/harness-footer.test.ts +0 -559
- package/packages/tui/test/harness-header.test.ts +0 -590
- package/packages/two-phase-review/test/classify.test.ts +0 -102
- package/packages/two-phase-review/test/helpers.ts +0 -72
- package/packages/two-phase-review/test/rules.test.ts +0 -150
- package/packages/two-phase-review/test/runtime.test.ts +0 -362
- package/packages/two-phase-review/test/scope.test.ts +0 -186
- package/packages/two-phase-review/test/signals.test.ts +0 -183
- package/packages/two-phase-review/test/state.test.ts +0 -201
- package/packages/wiki/test/basic.test.ts +0 -242
- package/packages/workspace-scanner/test/scanner.test.ts +0 -43
- package/packages/worktree/test/worktree.test.ts +0 -163
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The score that decides whether a hit of the vector store is a hit.
|
|
3
|
-
*
|
|
4
|
-
* The score of a vector search is a cosine between two vectors, and its
|
|
5
|
-
* scale belongs to the model that produced them. The runtime embeds with
|
|
6
|
-
* `text-embedding-3-small`, whose cosines for a query that names a skill
|
|
7
|
-
* land between 0.31 and 0.56 - while a query about something else reaches
|
|
8
|
-
* 0.23 at most.
|
|
9
|
-
*
|
|
10
|
-
* The threshold used to be 0.5, a value of the MiniLM collection, whose
|
|
11
|
-
* vectors are not comparable. Against the runtime collection it threw away
|
|
12
|
-
* every clear match (0.47) - a search of a filled collection returned
|
|
13
|
-
* nothing at all, and the skill was invisible.
|
|
14
|
-
*
|
|
15
|
-
* The threshold therefore lives next to the model, and the tests below
|
|
16
|
-
* hold it there.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { describe, expect, it } from "bun:test";
|
|
20
|
-
import { readFileSync } from "node:fs";
|
|
21
|
-
import { fileURLToPath } from "node:url";
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
createSkillRegistry,
|
|
25
|
-
type QdrantClientLike,
|
|
26
|
-
type QdrantEmbedderLike,
|
|
27
|
-
} from "../src/loader.js";
|
|
28
|
-
import { SKILL_MIN_SCORE } from "../src/vector-schema.js";
|
|
29
|
-
|
|
30
|
-
/** A client that answers a query with the given points. */
|
|
31
|
-
function fakeClient(points: Array<{ id: number; score: number }>): QdrantClientLike {
|
|
32
|
-
return {
|
|
33
|
-
async upsert(): Promise<void> {},
|
|
34
|
-
async query(): Promise<unknown> {
|
|
35
|
-
return { points };
|
|
36
|
-
},
|
|
37
|
-
async getCollection(): Promise<unknown> {
|
|
38
|
-
return { config: { params: { vectors: { size: 1536, distance: "Cosine" } } } };
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** An embedder that returns a fixed vector. */
|
|
44
|
-
const fakeEmbedder: QdrantEmbedderLike = {
|
|
45
|
-
async createEmbedding() {
|
|
46
|
-
return { embedding: [0.1, 0.2, 0.3], tokens: 3 };
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const registryWith = (scores: number[]) =>
|
|
51
|
-
createSkillRegistry({
|
|
52
|
-
qdrantClient: fakeClient(
|
|
53
|
-
scores.map((score, index) => ({
|
|
54
|
-
id: index + 1,
|
|
55
|
-
score,
|
|
56
|
-
payload: { name: `skill-${index}`, description: "d", body: "b" },
|
|
57
|
-
})),
|
|
58
|
-
),
|
|
59
|
-
embedder: fakeEmbedder,
|
|
60
|
-
collection: "pi-harness-skills-test",
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
describe("the score that decides whether a hit is a hit", () => {
|
|
64
|
-
it("belongs to the model of the collection", () => {
|
|
65
|
-
// The measured values: a query that names a skill scores 0.31 to
|
|
66
|
-
// 0.56, a query about something else 0.10 to 0.23.
|
|
67
|
-
expect(SKILL_MIN_SCORE).toBeGreaterThan(0.23);
|
|
68
|
-
expect(SKILL_MIN_SCORE).toBeLessThan(0.31);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("keeps a clear match that the old threshold of 0.5 threw away", async () => {
|
|
72
|
-
// 0.47 is a clear match of the runtime model - and below 0.5.
|
|
73
|
-
const registry = registryWith([0.47]);
|
|
74
|
-
|
|
75
|
-
const results = await registry.findVector("approve a purchase order");
|
|
76
|
-
|
|
77
|
-
expect(results).toHaveLength(1);
|
|
78
|
-
expect(results[0].score).toBe(0.47);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("drops a hit that is noise", async () => {
|
|
82
|
-
const registry = registryWith([0.23]);
|
|
83
|
-
|
|
84
|
-
const results = await registry.findVector("cook a risotto");
|
|
85
|
-
|
|
86
|
-
expect(results).toHaveLength(0);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it("keeps the hits above it and drops the hits below it", async () => {
|
|
90
|
-
const registry = registryWith([0.55, 0.12, 0.4, 0.2]);
|
|
91
|
-
|
|
92
|
-
const results = await registry.findVector("a query");
|
|
93
|
-
|
|
94
|
-
expect(results.map((r) => r.score)).toEqual([0.55, 0.4]);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("is the threshold of the skill command too", () => {
|
|
98
|
-
// The command passed 0.5 itself, so the fix of the default would
|
|
99
|
-
// not have reached the search of the user.
|
|
100
|
-
const source = readFileSync(
|
|
101
|
-
fileURLToPath(new URL("../src/skill-commands.ts", import.meta.url)),
|
|
102
|
-
"utf8",
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
expect(source).toContain("SKILL_MIN_SCORE");
|
|
106
|
-
expect(source).not.toMatch(/findVector\([^)]*,\s*5,\s*0\.5/);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sprint Planner Tests (RFC-0074)
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { describe, it, expect } from "bun:test";
|
|
6
|
-
import {
|
|
7
|
-
planSprints,
|
|
8
|
-
createSprintConfig,
|
|
9
|
-
sortRequirements,
|
|
10
|
-
calculateVelocity,
|
|
11
|
-
decomposeRequirement,
|
|
12
|
-
assignEstimate,
|
|
13
|
-
sumPoints,
|
|
14
|
-
} from "../src/index.js";
|
|
15
|
-
import type { Requirement } from "../src/index.js";
|
|
16
|
-
|
|
17
|
-
const makeReq = (overrides?: Partial<Requirement>): Requirement => ({
|
|
18
|
-
id: `req-${Math.random().toString(36).slice(2)}`,
|
|
19
|
-
title: "Test Requirement",
|
|
20
|
-
description: "Test description",
|
|
21
|
-
priority: "medium",
|
|
22
|
-
acceptanceCriteria: [],
|
|
23
|
-
labels: [],
|
|
24
|
-
dependencies: [],
|
|
25
|
-
...overrides,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe("decomposeRequirement", () => {
|
|
29
|
-
it("creates at least 3 tasks", () => {
|
|
30
|
-
const req = makeReq();
|
|
31
|
-
const tasks = decomposeRequirement(req);
|
|
32
|
-
expect(tasks.length).toBeGreaterThanOrEqual(3);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("all tasks reference requirement ID", () => {
|
|
36
|
-
const req = makeReq({ id: "req-123" });
|
|
37
|
-
const tasks = decomposeRequirement(req);
|
|
38
|
-
for (const t of tasks) {
|
|
39
|
-
expect(t.requirementId).toBe("req-123");
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("respects custom estimate", () => {
|
|
44
|
-
const req = makeReq({ estimate: 8 });
|
|
45
|
-
const tasks = decomposeRequirement(req);
|
|
46
|
-
expect(tasks[0].estimate).toBe(8);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("creates AC tasks", () => {
|
|
50
|
-
const req = makeReq({ acceptanceCriteria: ["AC1", "AC2"] });
|
|
51
|
-
const tasks = decomposeRequirement(req);
|
|
52
|
-
expect(tasks.some((t) => t.title.includes("AC1"))).toBe(true);
|
|
53
|
-
expect(tasks.some((t) => t.title.includes("AC2"))).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe("assignEstimate", () => {
|
|
58
|
-
it("returns 1 for complexity 1", () => expect(assignEstimate(1)).toBe(1));
|
|
59
|
-
it("returns 3 for mid complexity", () => expect(assignEstimate(5)).toBe(3));
|
|
60
|
-
it("caps at 21", () => expect(assignEstimate(100)).toBe(21));
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
describe("sumPoints", () => {
|
|
64
|
-
it("sums task estimates", () => {
|
|
65
|
-
const tasks = [
|
|
66
|
-
{ estimate: 3, requirementId: "1", title: "", description: "", status: "todo", labels: [] },
|
|
67
|
-
{ estimate: 5, requirementId: "1", title: "", description: "", status: "todo", labels: [] },
|
|
68
|
-
] as any[];
|
|
69
|
-
expect(sumPoints(tasks)).toBe(8);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("treats undefined as 0", () => {
|
|
73
|
-
const tasks = [
|
|
74
|
-
{ estimate: undefined, requirementId: "1", title: "", description: "", status: "todo", labels: [] },
|
|
75
|
-
] as any[];
|
|
76
|
-
expect(sumPoints(tasks)).toBe(0);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
describe("sortRequirements", () => {
|
|
81
|
-
it("sorts critical before high before medium before low", () => {
|
|
82
|
-
const reqs = [
|
|
83
|
-
makeReq({ id: "low", priority: "low" }),
|
|
84
|
-
makeReq({ id: "critical", priority: "critical" }),
|
|
85
|
-
makeReq({ id: "high", priority: "high" }),
|
|
86
|
-
makeReq({ id: "medium", priority: "medium" }),
|
|
87
|
-
];
|
|
88
|
-
const sorted = sortRequirements(reqs, "priority-then-dependencies");
|
|
89
|
-
expect(sorted.map((r) => r.priority)).toEqual(["critical", "high", "medium", "low"]);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("respects moSCoW strategy", () => {
|
|
93
|
-
const reqs = [
|
|
94
|
-
makeReq({ id: "a", priority: "low" }),
|
|
95
|
-
makeReq({ id: "b", priority: "critical" }),
|
|
96
|
-
];
|
|
97
|
-
const sorted = sortRequirements(reqs, "moSCoW");
|
|
98
|
-
expect(sorted[0].id).toBe("b");
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
describe("createSprintConfig", () => {
|
|
103
|
-
it("has sensible defaults", () => {
|
|
104
|
-
const cfg = createSprintConfig();
|
|
105
|
-
expect(cfg.sprintDurationDays).toBe(14);
|
|
106
|
-
expect(cfg.capacityPerDay).toBe(5);
|
|
107
|
-
expect(cfg.defaultEstimate).toBe(3);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("accepts overrides", () => {
|
|
111
|
-
const cfg = createSprintConfig({ sprintDurationDays: 7 });
|
|
112
|
-
expect(cfg.sprintDurationDays).toBe(7);
|
|
113
|
-
expect(cfg.capacityPerDay).toBe(5);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
describe("planSprints", () => {
|
|
118
|
-
it("creates at least one sprint", () => {
|
|
119
|
-
const reqs = [makeReq()];
|
|
120
|
-
const result = planSprints(reqs);
|
|
121
|
-
expect(result.sprints.length).toBeGreaterThanOrEqual(1);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it("assigns all requirements to sprints", () => {
|
|
125
|
-
const reqs = [makeReq({ id: "r1" }), makeReq({ id: "r2" })];
|
|
126
|
-
const result = planSprints(reqs);
|
|
127
|
-
const assigned = new Set(result.sprints.flatMap((s) => s.tasks.map((t) => t.requirementId)));
|
|
128
|
-
expect(assigned.has("r1")).toBe(true);
|
|
129
|
-
expect(assigned.has("r2")).toBe(true);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("calculates total points", () => {
|
|
133
|
-
const reqs = [makeReq({ estimate: 5 })];
|
|
134
|
-
const result = planSprints(reqs);
|
|
135
|
-
expect(result.totalPoints).toBeGreaterThan(0);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it("handles empty list", () => {
|
|
139
|
-
const result = planSprints([]);
|
|
140
|
-
expect(result.sprints).toEqual([]);
|
|
141
|
-
expect(result.totalPoints).toBe(0);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it("includes sprint dates", () => {
|
|
145
|
-
const result = planSprints([makeReq()]);
|
|
146
|
-
expect(result.sprints[0].startDate < result.sprints[0].endDate).toBe(true);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it("prioritizes critical requirements", () => {
|
|
150
|
-
const reqs = [
|
|
151
|
-
makeReq({ id: "low1", priority: "low" }),
|
|
152
|
-
makeReq({ id: "critical1", priority: "critical" }),
|
|
153
|
-
];
|
|
154
|
-
const result = planSprints(reqs);
|
|
155
|
-
const firstReqs = new Set(result.sprints[0]?.tasks.map((t) => t.requirementId));
|
|
156
|
-
expect(firstReqs.has("critical1")).toBe(true);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
describe("calculateVelocity", () => {
|
|
161
|
-
it("returns 0 for no sprints", () => expect(calculateVelocity([])).toBe(0));
|
|
162
|
-
|
|
163
|
-
it("returns 0 when no sprints are completed", () => {
|
|
164
|
-
const sprints: any[] = [{
|
|
165
|
-
id: "s1", number: 1, name: "S1", startDate: "2024-01-01", endDate: "2024-01-14",
|
|
166
|
-
capacity: 20,
|
|
167
|
-
tasks: [{ id: "t1", requirementId: "r1", title: "t", description: "", status: "in-progress", estimate: 5, labels: [] }],
|
|
168
|
-
}];
|
|
169
|
-
expect(calculateVelocity(sprints)).toBe(0);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it("calculates velocity from completed sprints", () => {
|
|
173
|
-
const sprints: any[] = [
|
|
174
|
-
{
|
|
175
|
-
id: "s1", number: 1, name: "S1", startDate: "2024-01-01", endDate: "2024-01-14",
|
|
176
|
-
capacity: 20,
|
|
177
|
-
tasks: [{ id: "t1", requirementId: "r1", title: "t", description: "", status: "done", estimate: 8, labels: [] }],
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
id: "s2", number: 2, name: "S2", startDate: "2024-01-15", endDate: "2024-01-28",
|
|
181
|
-
capacity: 20,
|
|
182
|
-
tasks: [{ id: "t2", requirementId: "r2", title: "t", description: "", status: "done", estimate: 8, labels: [] }],
|
|
183
|
-
},
|
|
184
|
-
];
|
|
185
|
-
expect(calculateVelocity(sprints)).toBe(8);
|
|
186
|
-
});
|
|
187
|
-
});
|