pi-harness-runtime 1.1.404 → 1.1.405
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 +275 -1
- 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/dist/adapters/line-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/line-adapter.js +6 -1
- package/packages/notification/dist/adapters/line-adapter.js.map +1 -1
- package/packages/notification/dist/notification-center.d.ts.map +1 -1
- package/packages/notification/dist/notification-center.js +32 -0
- package/packages/notification/dist/notification-center.js.map +1 -1
- package/packages/notification/dist/telegram-webhook-handler.d.ts +7 -0
- package/packages/notification/dist/telegram-webhook-handler.d.ts.map +1 -1
- package/packages/notification/dist/telegram-webhook-handler.js +7 -0
- package/packages/notification/dist/telegram-webhook-handler.js.map +1 -1
- package/packages/notification/dist/types.d.ts +1 -1
- package/packages/notification/dist/types.d.ts.map +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/adapters/line-adapter.ts +7 -1
- package/packages/notification/src/notification-center.ts +30 -0
- package/packages/notification/src/telegram-webhook-handler.ts +7 -0
- package/packages/notification/src/types.ts +1 -0
- package/packages/notification/test/notification.test.ts +31 -28
- package/packages/notification/test/tooling-proposal-payload.test.ts +212 -0
- 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/detect.d.ts +62 -0
- package/packages/tooling-preference/dist/detect.d.ts.map +1 -0
- package/packages/tooling-preference/dist/detect.js +209 -0
- package/packages/tooling-preference/dist/detect.js.map +1 -0
- package/packages/tooling-preference/dist/index.d.ts +13 -0
- package/packages/tooling-preference/dist/index.d.ts.map +1 -0
- package/packages/tooling-preference/dist/index.js +13 -0
- package/packages/tooling-preference/dist/index.js.map +1 -0
- package/packages/tooling-preference/dist/proposal.d.ts +70 -0
- package/packages/tooling-preference/dist/proposal.d.ts.map +1 -0
- package/packages/tooling-preference/dist/proposal.js +137 -0
- package/packages/tooling-preference/dist/proposal.js.map +1 -0
- package/packages/tooling-preference/dist/registry.d.ts +50 -0
- package/packages/tooling-preference/dist/registry.d.ts.map +1 -0
- package/packages/tooling-preference/dist/registry.js +53 -0
- package/packages/tooling-preference/dist/registry.js.map +1 -0
- package/packages/tooling-preference/dist/store.d.ts +61 -0
- package/packages/tooling-preference/dist/store.d.ts.map +1 -0
- package/packages/tooling-preference/dist/store.js +129 -0
- package/packages/tooling-preference/dist/store.js.map +1 -0
- package/packages/tooling-preference/package.json +21 -0
- package/packages/tooling-preference/src/detect.ts +251 -0
- package/packages/tooling-preference/src/index.ts +44 -0
- package/packages/tooling-preference/src/proposal.ts +173 -0
- package/packages/tooling-preference/src/registry.ts +79 -0
- package/packages/tooling-preference/src/store.ts +162 -0
- package/packages/tooling-preference/tests/detect.test.ts +188 -0
- package/packages/tooling-preference/tests/proposal.test.ts +107 -0
- package/packages/tooling-preference/tests/registry.test.ts +51 -0
- package/packages/tooling-preference/tests/store.test.ts +99 -0
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- 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/package.json +1 -1
- package/packages/write-review/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import { ToolingRequestRegistry } from "../src/registry.ts";
|
|
3
|
+
|
|
4
|
+
const request = {
|
|
5
|
+
requestId: "biome-abc123",
|
|
6
|
+
workspaceRoot: "/work/web",
|
|
7
|
+
userKey: "user-1",
|
|
8
|
+
frameworks: ["next"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
describe("ToolingRequestRegistry", () => {
|
|
12
|
+
it("registers a proposal once", () => {
|
|
13
|
+
const registry = new ToolingRequestRegistry();
|
|
14
|
+
expect(registry.register(request)).toBe(true);
|
|
15
|
+
expect(registry.register(request)).toBe(false);
|
|
16
|
+
expect(registry.has(request.requestId)).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("lets the first answer win", () => {
|
|
20
|
+
const registry = new ToolingRequestRegistry();
|
|
21
|
+
registry.register(request);
|
|
22
|
+
|
|
23
|
+
const first = registry.claim(request.requestId, "yes", "telegram");
|
|
24
|
+
expect(first?.resolution.preference).toBe("prefer_biome");
|
|
25
|
+
expect(first?.request.workspaceRoot).toBe("/work/web");
|
|
26
|
+
|
|
27
|
+
// The second click finds nothing - the first answer stays.
|
|
28
|
+
expect(registry.claim(request.requestId, "no", "line")).toBeNull();
|
|
29
|
+
expect(registry.resolutionOf(request.requestId)?.preference).toBe("prefer_biome");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("maps a no to the current tools", () => {
|
|
33
|
+
const registry = new ToolingRequestRegistry();
|
|
34
|
+
registry.register(request);
|
|
35
|
+
const claimed = registry.claim(request.requestId, "no", "line");
|
|
36
|
+
expect(claimed?.resolution.preference).toBe("use_project_tools");
|
|
37
|
+
expect(claimed?.resolution.channel).toBe("line");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("refuses a claim for an unknown request", () => {
|
|
41
|
+
const registry = new ToolingRequestRegistry();
|
|
42
|
+
expect(registry.claim("biome-unknown", "yes")).toBeNull();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("does not register a request that was already answered", () => {
|
|
46
|
+
const registry = new ToolingRequestRegistry();
|
|
47
|
+
registry.register(request);
|
|
48
|
+
registry.claim(request.requestId, "no");
|
|
49
|
+
expect(registry.register(request)).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import {
|
|
6
|
+
shouldAskAgain,
|
|
7
|
+
ToolingPreferenceStore,
|
|
8
|
+
toolingPreferenceKey,
|
|
9
|
+
} from "../src/store.ts";
|
|
10
|
+
|
|
11
|
+
function storePath(): string {
|
|
12
|
+
return join(mkdtempSync(join(tmpdir(), "tooling-store-")), "tooling-preference.json");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe("ToolingPreferenceStore", () => {
|
|
16
|
+
it("has no record for an unknown user and workspace", () => {
|
|
17
|
+
const path = storePath();
|
|
18
|
+
const store = new ToolingPreferenceStore(path);
|
|
19
|
+
expect(store.read("user-1", "/work/web")).toBeUndefined();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("keeps the record of a user in a workspace apart", () => {
|
|
23
|
+
const path = storePath();
|
|
24
|
+
const store = new ToolingPreferenceStore(path);
|
|
25
|
+
store.recordDecision("user-1", "/work/web", "prefer_biome", "biome-1");
|
|
26
|
+
store.recordDecision("user-2", "/work/web", "use_project_tools", "biome-2");
|
|
27
|
+
store.recordDecision("user-1", "/work/other", "use_project_tools", "biome-3");
|
|
28
|
+
|
|
29
|
+
expect(store.read("user-1", "/work/web")?.decision).toBe("prefer_biome");
|
|
30
|
+
expect(store.read("user-2", "/work/web")?.decision).toBe("use_project_tools");
|
|
31
|
+
expect(store.read("user-1", "/work/other")?.decision).toBe("use_project_tools");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("remembers that the proposal was sent", () => {
|
|
35
|
+
const path = storePath();
|
|
36
|
+
const store = new ToolingPreferenceStore(path);
|
|
37
|
+
store.markAsked("user-1", "/work/web", "biome-1");
|
|
38
|
+
const record = store.read("user-1", "/work/web");
|
|
39
|
+
expect(record?.askedAt).toBeTruthy();
|
|
40
|
+
expect(record?.requestId).toBe("biome-1");
|
|
41
|
+
expect(record?.decision).toBeUndefined();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("keeps a decision across a new store instance", () => {
|
|
45
|
+
const path = storePath();
|
|
46
|
+
new ToolingPreferenceStore(path).recordDecision(
|
|
47
|
+
"user-1",
|
|
48
|
+
"/work/web",
|
|
49
|
+
"prefer_biome",
|
|
50
|
+
"biome-1",
|
|
51
|
+
"telegram",
|
|
52
|
+
);
|
|
53
|
+
const record = new ToolingPreferenceStore(path).read("user-1", "/work/web");
|
|
54
|
+
expect(record?.decision).toBe("prefer_biome");
|
|
55
|
+
expect(record?.channel).toBe("telegram");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("survives a broken store file", () => {
|
|
59
|
+
const path = storePath();
|
|
60
|
+
const store = new ToolingPreferenceStore(path);
|
|
61
|
+
store.markAsked("user-1", "/work/web", "biome-1");
|
|
62
|
+
// A store that cannot be read must not stop the harness.
|
|
63
|
+
Bun.write(path, "not json");
|
|
64
|
+
expect(store.read("user-1", "/work/web")).toBeUndefined();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("keys a record by the user and the workspace", () => {
|
|
68
|
+
expect(toolingPreferenceKey("user-1", "/work/web")).not.toBe(
|
|
69
|
+
toolingPreferenceKey("user-2", "/work/web"),
|
|
70
|
+
);
|
|
71
|
+
expect(toolingPreferenceKey("user-1", "/work/web")).toBe(
|
|
72
|
+
toolingPreferenceKey("user-1", "/work/web"),
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe("shouldAskAgain", () => {
|
|
78
|
+
const day = 24 * 60 * 60 * 1000;
|
|
79
|
+
const now = new Date("2026-10-24T12:00:00.000Z");
|
|
80
|
+
|
|
81
|
+
it("asks a workspace that was never asked", () => {
|
|
82
|
+
expect(shouldAskAgain(undefined, 30 * day, now)).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("never asks a workspace with a decision", () => {
|
|
86
|
+
const record = { decision: "prefer_biome" as const, askedAt: "2026-01-01T00:00:00.000Z" };
|
|
87
|
+
expect(shouldAskAgain(record, 30 * day, now)).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("does not ask again inside the cooldown", () => {
|
|
91
|
+
const record = { askedAt: new Date(now.getTime() - day).toISOString() };
|
|
92
|
+
expect(shouldAskAgain(record, 30 * day, now)).toBe(false);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("asks again after the cooldown", () => {
|
|
96
|
+
const record = { askedAt: new Date(now.getTime() - 31 * day).toISOString() };
|
|
97
|
+
expect(shouldAskAgain(record, 30 * day, now)).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
});
|