pi-harness-runtime 1.1.406 → 1.1.408
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/index.ts +145 -0
- package/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- 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/package.json +1 -1
- 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/package.json +1 -1
- 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/package.json +1 -1
- 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/package.json +1 -1
- 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/package.json +1 -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/package.json +1 -1
- 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/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/permission-mode/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- 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/package.json +1 -1
- 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/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/package.json +1 -1
- 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/telegram/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/dist/changed-files.d.ts +45 -0
- package/packages/tooling-preference/dist/changed-files.d.ts.map +1 -0
- package/packages/tooling-preference/dist/changed-files.js +125 -0
- package/packages/tooling-preference/dist/changed-files.js.map +1 -0
- package/packages/tooling-preference/dist/index.d.ts +2 -0
- package/packages/tooling-preference/dist/index.d.ts.map +1 -1
- package/packages/tooling-preference/dist/index.js +2 -0
- package/packages/tooling-preference/dist/index.js.map +1 -1
- package/packages/tooling-preference/dist/quality-check.d.ts +75 -0
- package/packages/tooling-preference/dist/quality-check.d.ts.map +1 -0
- package/packages/tooling-preference/dist/quality-check.js +216 -0
- package/packages/tooling-preference/dist/quality-check.js.map +1 -0
- package/packages/tooling-preference/package.json +1 -1
- package/packages/tooling-preference/src/changed-files.ts +147 -0
- package/packages/tooling-preference/src/index.ts +19 -0
- package/packages/tooling-preference/src/quality-check.ts +279 -0
- package/packages/tooling-preference/tests/changed-files.test.ts +124 -0
- package/packages/tooling-preference/tests/quality-check.test.ts +272 -0
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/two-phase-review/dist/classify.d.ts +56 -0
- package/packages/two-phase-review/dist/classify.d.ts.map +1 -0
- package/packages/two-phase-review/dist/classify.js +108 -0
- package/packages/two-phase-review/dist/classify.js.map +1 -0
- package/packages/two-phase-review/dist/index.d.ts +20 -0
- package/packages/two-phase-review/dist/index.d.ts.map +1 -0
- package/packages/two-phase-review/dist/index.js +14 -0
- package/packages/two-phase-review/dist/index.js.map +1 -0
- package/packages/two-phase-review/dist/rules.d.ts +81 -0
- package/packages/two-phase-review/dist/rules.d.ts.map +1 -0
- package/packages/two-phase-review/dist/rules.js +195 -0
- package/packages/two-phase-review/dist/rules.js.map +1 -0
- package/packages/two-phase-review/dist/runtime.d.ts +70 -0
- package/packages/two-phase-review/dist/runtime.d.ts.map +1 -0
- package/packages/two-phase-review/dist/runtime.js +298 -0
- package/packages/two-phase-review/dist/runtime.js.map +1 -0
- package/packages/two-phase-review/dist/scope.d.ts +68 -0
- package/packages/two-phase-review/dist/scope.d.ts.map +1 -0
- package/packages/two-phase-review/dist/scope.js +205 -0
- package/packages/two-phase-review/dist/scope.js.map +1 -0
- package/packages/two-phase-review/dist/signals.d.ts +74 -0
- package/packages/two-phase-review/dist/signals.d.ts.map +1 -0
- package/packages/two-phase-review/dist/signals.js +297 -0
- package/packages/two-phase-review/dist/signals.js.map +1 -0
- package/packages/two-phase-review/dist/state.d.ts +72 -0
- package/packages/two-phase-review/dist/state.d.ts.map +1 -0
- package/packages/two-phase-review/dist/state.js +238 -0
- package/packages/two-phase-review/dist/state.js.map +1 -0
- package/packages/two-phase-review/dist/types.d.ts +62 -0
- package/packages/two-phase-review/dist/types.d.ts.map +1 -0
- package/packages/two-phase-review/dist/types.js +9 -0
- package/packages/two-phase-review/dist/types.js.map +1 -0
- package/packages/two-phase-review/package.json +21 -0
- package/packages/two-phase-review/src/classify.ts +129 -0
- package/packages/two-phase-review/src/index.ts +110 -0
- package/packages/two-phase-review/src/rules.ts +236 -0
- package/packages/two-phase-review/src/runtime.ts +392 -0
- package/packages/two-phase-review/src/scope.ts +247 -0
- package/packages/two-phase-review/src/signals.ts +340 -0
- package/packages/two-phase-review/src/state.ts +280 -0
- package/packages/two-phase-review/src/types.ts +72 -0
- package/packages/two-phase-review/test/classify.test.ts +102 -0
- package/packages/two-phase-review/test/helpers.ts +72 -0
- package/packages/two-phase-review/test/rules.test.ts +150 -0
- package/packages/two-phase-review/test/runtime.test.ts +362 -0
- package/packages/two-phase-review/test/scope.test.ts +186 -0
- package/packages/two-phase-review/test/signals.test.ts +183 -0
- package/packages/two-phase-review/test/state.test.ts +201 -0
- package/packages/types/package.json +1 -1
- package/packages/voice-api/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- 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/dist/worktree.d.ts +31 -0
- package/packages/worktree/dist/worktree.d.ts.map +1 -1
- package/packages/worktree/dist/worktree.js +21 -8
- package/packages/worktree/dist/worktree.js.map +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/worktree/src/worktree.ts +49 -8
- package/packages/worktree/test/worktree.test.ts +27 -27
- package/packages/write-review/package.json +1 -1
- package/packages/worktree/worktree.ts +0 -293
package/index.ts
CHANGED
|
@@ -373,6 +373,78 @@ let _extensionApi: ExtensionAPI | null = null;
|
|
|
373
373
|
/** How long an unanswered proposal stays quiet before it is offered again. */
|
|
374
374
|
const TOOLING_PROPOSAL_COOLDOWN_MS = 30 * 24 * 60 * 60 * 1000;
|
|
375
375
|
|
|
376
|
+
// --- two-phase-review: implementation first, review as a second phase -----
|
|
377
|
+
|
|
378
|
+
/** The package of the two-phase workflow. */
|
|
379
|
+
type TwoPhaseModule = typeof import("./packages/two-phase-review/dist/index.js");
|
|
380
|
+
|
|
381
|
+
/** The todo shape the workflow needs. */
|
|
382
|
+
type TwoPhaseTodoLike = import("./packages/two-phase-review/dist/index.js").TodoLike;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Load the two-phase review package.
|
|
386
|
+
*/
|
|
387
|
+
async function loadTwoPhaseModule(): Promise<TwoPhaseModule | null> {
|
|
388
|
+
try {
|
|
389
|
+
return await import("./packages/two-phase-review/dist/index.js");
|
|
390
|
+
} catch (error) {
|
|
391
|
+
logToFile("[TwoPhase]", `package unavailable: ${oneLineError(error)}`);
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Register the two-phase workflow in the session.
|
|
398
|
+
*
|
|
399
|
+
* The wiring itself lives in the package (it is tested there). The session
|
|
400
|
+
* only provides the todo list of the session and the workspace.
|
|
401
|
+
*/
|
|
402
|
+
async function initTwoPhaseReview(pi: ExtensionAPI): Promise<void> {
|
|
403
|
+
const mod = await loadTwoPhaseModule();
|
|
404
|
+
if (!mod) return;
|
|
405
|
+
|
|
406
|
+
/** Read the todo list of the session (the local one, never bd). */
|
|
407
|
+
const readTodos = async (ctx: unknown): Promise<{
|
|
408
|
+
available: boolean;
|
|
409
|
+
todos: TwoPhaseTodoLike[];
|
|
410
|
+
reason?: string;
|
|
411
|
+
}> => {
|
|
412
|
+
try {
|
|
413
|
+
const jev = await import("./packages/jev-judge/dist/index.js");
|
|
414
|
+
const provider = jev.createTodoProvider(ctx as never);
|
|
415
|
+
const availability = await provider.availability();
|
|
416
|
+
if (!availability.available) {
|
|
417
|
+
return {
|
|
418
|
+
available: false,
|
|
419
|
+
todos: [],
|
|
420
|
+
reason: availability.error ?? "the todo provider is not available",
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
const snapshot = await provider.getSnapshot();
|
|
424
|
+
return { available: true, todos: (snapshot.items ?? []) as TwoPhaseTodoLike[] };
|
|
425
|
+
} catch (error) {
|
|
426
|
+
return { available: false, todos: [], reason: oneLineError(error) };
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
try {
|
|
431
|
+
await mod.initTwoPhaseReview({
|
|
432
|
+
pi,
|
|
433
|
+
readTodos,
|
|
434
|
+
workspaceRoot: () => {
|
|
435
|
+
try {
|
|
436
|
+
return realpathSync(process.cwd());
|
|
437
|
+
} catch {
|
|
438
|
+
return process.cwd();
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
log: (message: string) => logToFile("[TwoPhase]", message),
|
|
442
|
+
});
|
|
443
|
+
} catch (error) {
|
|
444
|
+
logToFile("[TwoPhase]", `runtime not registered: ${oneLineError(error)}`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
376
448
|
/**
|
|
377
449
|
* Load the tooling preference package and watch for the session start.
|
|
378
450
|
*
|
|
@@ -530,6 +602,70 @@ async function startBiomeImplementation(
|
|
|
530
602
|
}
|
|
531
603
|
}
|
|
532
604
|
|
|
605
|
+
/** The last time a quality check ran - the check is not repeated in a loop. */
|
|
606
|
+
let _toolingCheckAt = 0;
|
|
607
|
+
/** Is a quality check running right now? */
|
|
608
|
+
let _toolingCheckRunning = false;
|
|
609
|
+
/** The shortest time between two quality checks. */
|
|
610
|
+
const TOOLING_CHECK_INTERVAL_MS = 15_000;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Run the post-change quality check of the workspace.
|
|
614
|
+
*
|
|
615
|
+
* The check honors the saved preference: Biome when the user asked for it,
|
|
616
|
+
* the project's own script otherwise. It never writes, it never blocks the
|
|
617
|
+
* session and it never runs without a decision of the user.
|
|
618
|
+
*/
|
|
619
|
+
async function maybeRunToolingCheck(ctx: ExtensionContext): Promise<void> {
|
|
620
|
+
const store = _toolingStore;
|
|
621
|
+
if (!store || _toolingCheckRunning) return;
|
|
622
|
+
const now = Date.now();
|
|
623
|
+
if (now - _toolingCheckAt < TOOLING_CHECK_INTERVAL_MS) return;
|
|
624
|
+
|
|
625
|
+
let workspaceRoot: string;
|
|
626
|
+
try {
|
|
627
|
+
workspaceRoot = realpathSync(process.cwd());
|
|
628
|
+
} catch {
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
try {
|
|
633
|
+
const mod = await import("./packages/tooling-preference/dist/index.js");
|
|
634
|
+
const userKey = mod.buildToolingUserKey(readToolingIdentity());
|
|
635
|
+
const record = store.read(userKey, workspaceRoot);
|
|
636
|
+
// Without a decision of the user no tool is selected, so nothing runs.
|
|
637
|
+
if (!record?.decision) return;
|
|
638
|
+
|
|
639
|
+
const changed = mod.detectChangedJsTsFiles(workspaceRoot);
|
|
640
|
+
if (!changed.detected || changed.files.length === 0) return;
|
|
641
|
+
|
|
642
|
+
const context = mod.detectToolingContext(workspaceRoot);
|
|
643
|
+
const plan = mod.selectQualityCheck({
|
|
644
|
+
context,
|
|
645
|
+
preference: record.decision,
|
|
646
|
+
files: changed.files,
|
|
647
|
+
});
|
|
648
|
+
if (plan.tool === "none") return;
|
|
649
|
+
|
|
650
|
+
_toolingCheckRunning = true;
|
|
651
|
+
_toolingCheckAt = now;
|
|
652
|
+
try {
|
|
653
|
+
const result = mod.runQualityCheck(plan, {
|
|
654
|
+
cwd: workspaceRoot,
|
|
655
|
+
timeoutMs: 60_000,
|
|
656
|
+
});
|
|
657
|
+
const line = mod.formatQualityCheckStatus(result);
|
|
658
|
+
logToFile("[ToolingCheck]", line);
|
|
659
|
+
// The status line names the tool and says whether the check ran.
|
|
660
|
+
ctx.ui.setStatus("harness-tooling", line);
|
|
661
|
+
} finally {
|
|
662
|
+
_toolingCheckRunning = false;
|
|
663
|
+
}
|
|
664
|
+
} catch (error) {
|
|
665
|
+
logToFile("[ToolingCheck]", `check failed: ${oneLineError(error)}`);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
533
669
|
async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
534
670
|
addHarnessMessage("Jev", "initializing", "wait");
|
|
535
671
|
try {
|
|
@@ -3949,6 +4085,12 @@ export default async function (pi: ExtensionAPI) {
|
|
|
3949
4085
|
// The proposal is a decision of its own: it never pauses the work.
|
|
3950
4086
|
void initToolingPreference(pi);
|
|
3951
4087
|
|
|
4088
|
+
// --- two-phase-review: implementation first, review as a second phase ----
|
|
4089
|
+
// A review signal during the implementation is queued, never executed.
|
|
4090
|
+
// The handlers are registered before the extension is ready, so a session
|
|
4091
|
+
// that starts right away is already covered.
|
|
4092
|
+
await initTwoPhaseReview(pi);
|
|
4093
|
+
|
|
3952
4094
|
// --- telegram-notifications: Telegram bot for harness event notifications ----
|
|
3953
4095
|
// Collect promise so we can wait for initialization before showing startup notification
|
|
3954
4096
|
asyncInitPromises.push(
|
|
@@ -5988,6 +6130,9 @@ Run \`bd ready\` to see current bd issues.
|
|
|
5988
6130
|
void maybeAutoFetchQuota(ctx.model?.id ?? null);
|
|
5989
6131
|
maybeTriggerProactiveCompact(ctx);
|
|
5990
6132
|
maybeNotifyContextUsage(ctx);
|
|
6133
|
+
// The quality check of the workspace runs after the turn: it never
|
|
6134
|
+
// writes and it never steers the session.
|
|
6135
|
+
void maybeRunToolingCheck(ctx);
|
|
5991
6136
|
});
|
|
5992
6137
|
|
|
5993
6138
|
pi.on("agent_end", () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/capability-registry",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.408",
|
|
4
4
|
"description": "Capability Registry for pi-harness-runtime — tracks model capabilities and enables capability-based routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|