pi-harness-runtime 1.1.16 → 1.1.26

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.
Files changed (105) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +76 -18
  3. package/harness/e2e/auto-test-loop.ts +815 -0
  4. package/harness/e2e/tools-detector.test.ts +156 -0
  5. package/harness/e2e/tools-detector.ts +801 -0
  6. package/harness/glm-quota-logger.ts +20 -23
  7. package/harness/index.ts +42 -0
  8. package/harness/loop-runtime.ts +49 -13
  9. package/harness/skill-sync.test.ts +57 -0
  10. package/harness/skill-sync.ts +247 -0
  11. package/harness/ssh-hang-recovery.ts +280 -0
  12. package/package.json +1 -1
  13. package/packages/a2a-adapter/package.json +1 -1
  14. package/packages/architecture-generator/package.json +1 -1
  15. package/packages/auth/package.json +1 -1
  16. package/packages/autonomous-refactor/package.json +1 -1
  17. package/packages/autonomous-runtime/package.json +1 -1
  18. package/packages/cache-strategy/package.json +1 -1
  19. package/packages/capability-registry/package.json +1 -1
  20. package/packages/checkpoint/package.json +1 -1
  21. package/packages/cli-plugin-sdk/package.json +1 -1
  22. package/packages/clipboard/package.json +1 -1
  23. package/packages/clipboard-plugin/package.json +1 -1
  24. package/packages/code-generation/package.json +1 -1
  25. package/packages/code-review/package.json +1 -1
  26. package/packages/codex-adapter/package.json +1 -1
  27. package/packages/config-capture/package.json +1 -1
  28. package/packages/context-compiler/package.json +1 -1
  29. package/packages/context-discovery/package.json +1 -1
  30. package/packages/context-manager/package.json +1 -1
  31. package/packages/cookie-sanitizer/package.json +1 -1
  32. package/packages/cost-optimizer/package.json +1 -1
  33. package/packages/dependency-analyzer/package.json +1 -1
  34. package/packages/django-plugin/package.json +1 -1
  35. package/packages/doc-generator/package.json +1 -1
  36. package/packages/evaluation-engine/package.json +1 -1
  37. package/packages/evaluation-runner/package.json +1 -1
  38. package/packages/event-bus/package.json +1 -1
  39. package/packages/event-store/package.json +1 -1
  40. package/packages/experience-replay/package.json +1 -1
  41. package/packages/feedback-collector/package.json +1 -1
  42. package/packages/file-copy-helper/package.json +1 -1
  43. package/packages/framework-detector/package.json +1 -1
  44. package/packages/framework-plugin-sdk/package.json +1 -1
  45. package/packages/frappe-plugin/package.json +1 -1
  46. package/packages/generic-web-plugin/package.json +1 -1
  47. package/packages/health-monitor/package.json +1 -1
  48. package/packages/intent-analyzer/package.json +1 -1
  49. package/packages/knowledge-graph/package.json +1 -1
  50. package/packages/knowledge-retrieval/package.json +1 -1
  51. package/packages/laravel-plugin/package.json +1 -1
  52. package/packages/learning-engine/package.json +1 -1
  53. package/packages/mcp-adapter/package.json +1 -1
  54. package/packages/memory-engine/package.json +1 -1
  55. package/packages/milestone-manager/package.json +1 -1
  56. package/packages/model-registry/package.json +1 -1
  57. package/packages/nextjs-plugin/package.json +1 -1
  58. package/packages/notification/package.json +1 -1
  59. package/packages/observability/package.json +1 -1
  60. package/packages/okf-indexer/package.json +1 -1
  61. package/packages/performance-optimizer/package.json +1 -1
  62. package/packages/privilege-broker/package.json +1 -1
  63. package/packages/project-analyzer/package.json +1 -1
  64. package/packages/project-bootstrap/package.json +1 -1
  65. package/packages/projection-engine/package.json +1 -1
  66. package/packages/prompt-compiler/package.json +1 -1
  67. package/packages/prompt-versioning/package.json +1 -1
  68. package/packages/provider-adapter-sdk/package.json +1 -1
  69. package/packages/provider-router/package.json +1 -1
  70. package/packages/provider-selector/package.json +1 -1
  71. package/packages/providers/package.json +1 -1
  72. package/packages/quota-manager/package.json +1 -1
  73. package/packages/rate-limiter/package.json +1 -1
  74. package/packages/react-vite-plugin/package.json +1 -1
  75. package/packages/release-manager/package.json +1 -1
  76. package/packages/requirement-compiler/package.json +1 -1
  77. package/packages/runtime/package.json +1 -1
  78. package/packages/scheduler/package.json +1 -1
  79. package/packages/scheduler-adapter/package.json +1 -1
  80. package/packages/session/package.json +1 -1
  81. package/packages/session-api/package.json +1 -1
  82. package/packages/session-export/package.json +1 -1
  83. package/packages/shared-context/package.json +1 -1
  84. package/packages/skill-mcp-client/package.json +28 -0
  85. package/packages/skill-mcp-client/src/client.ts +171 -0
  86. package/packages/skill-mcp-client/src/errors.ts +75 -0
  87. package/packages/skill-mcp-client/src/index.ts +13 -0
  88. package/packages/skill-mcp-client/src/types.ts +123 -0
  89. package/packages/skill-registry/package.json +1 -1
  90. package/packages/sprint-planner/package.json +1 -1
  91. package/packages/subscription-engine/package.json +1 -1
  92. package/packages/task-compiler/package.json +1 -1
  93. package/packages/tencentdb-memory/package.json +1 -1
  94. package/packages/tencentdb-sync/package.json +1 -1
  95. package/packages/test-data-generator/package.json +1 -1
  96. package/packages/test-generator/package.json +1 -1
  97. package/packages/todo-bd-sync/package.json +1 -1
  98. package/packages/token-estimation/package.json +1 -1
  99. package/packages/token-optimizer/package.json +1 -1
  100. package/packages/tui/package.json +1 -1
  101. package/packages/types/package.json +1 -1
  102. package/packages/workflow-events/package.json +1 -1
  103. package/packages/workspace-scanner/package.json +1 -1
  104. package/packages/worktree/package.json +1 -1
  105. package/packages/write-review/package.json +1 -1
@@ -0,0 +1,156 @@
1
+ /**
2
+ * E2E Tools Detector Tests
3
+ */
4
+
5
+ // @ts-expect-error - bun:test types
6
+ import { describe, test, expect, beforeEach, afterEach } from "bun:test";
7
+ import {
8
+ detectProjectType,
9
+ makeSmartDecision,
10
+ getE2EToolsConfig,
11
+ generateToolsPresentation,
12
+ } from "./tools-detector.js";
13
+ import { tmpdir } from "node:os";
14
+ import { mkdirSync, writeFileSync, rmSync } from "node:fs";
15
+ import { join } from "node:path";
16
+
17
+ describe("E2E Tools Detector", () => {
18
+ let tempDir: string;
19
+
20
+ beforeEach(() => {
21
+ tempDir = tmpdir() + "/e2e-test-" + Date.now();
22
+ mkdirSync(tempDir, { recursive: true });
23
+ });
24
+
25
+ afterEach(() => {
26
+ try {
27
+ rmSync(tempDir, { recursive: true });
28
+ } catch {
29
+ // Ignore cleanup errors
30
+ }
31
+ });
32
+
33
+ describe("detectProjectType", () => {
34
+ test("detects Next.js project", () => {
35
+ writeFileSync(
36
+ join(tempDir, "package.json"),
37
+ JSON.stringify({ dependencies: { next: "^14.0.0" } }),
38
+ );
39
+ mkdirSync(join(tempDir, "app"));
40
+
41
+ const type = detectProjectType(tempDir);
42
+ expect(type).toBe("nextjs");
43
+ });
44
+
45
+ test("detects React/Vite project", () => {
46
+ writeFileSync(join(tempDir, "vite.config.ts"), "export default {}");
47
+ writeFileSync(
48
+ join(tempDir, "package.json"),
49
+ JSON.stringify({ dependencies: { react: "^18.0.0" } }),
50
+ );
51
+
52
+ const type = detectProjectType(tempDir);
53
+ expect(type).toBe("react_vite");
54
+ });
55
+
56
+ test("detects Tauri project", () => {
57
+ mkdirSync(join(tempDir, "src-tauri"), { recursive: true });
58
+ writeFileSync(join(tempDir, "src-tauri/Cargo.toml"), "[package]");
59
+
60
+ const type = detectProjectType(tempDir);
61
+ expect(type).toBe("tauri");
62
+ });
63
+
64
+ test("detects Django project", () => {
65
+ writeFileSync(join(tempDir, "manage.py"), "#!/usr/bin/env python");
66
+ mkdirSync(join(tempDir, "settings.py").replace("/settings.py", ""), {
67
+ recursive: true,
68
+ });
69
+ writeFileSync(join(tempDir, "settings.py"), "DEBUG=True");
70
+
71
+ const type = detectProjectType(tempDir);
72
+ expect(type).toBe("django");
73
+ });
74
+
75
+ test("detects unknown project", () => {
76
+ const type = detectProjectType(tempDir);
77
+ expect(type).toBe("unknown");
78
+ });
79
+ });
80
+
81
+ describe("makeSmartDecision", () => {
82
+ test("suggests ask_human when no tools installed", () => {
83
+ const decision = makeSmartDecision(tempDir, "nextjs", []);
84
+ expect(decision.suggestedAction).toBe("ask_human");
85
+ expect(decision.confidence).toBeLessThan(0.5);
86
+ });
87
+
88
+ test("suggests action for Next.js with Playwright", () => {
89
+ const tools = [
90
+ {
91
+ name: "Playwright",
92
+ installed: true,
93
+ description: "E2E testing",
94
+ },
95
+ ];
96
+ const decision = makeSmartDecision(tempDir, "nextjs", tools);
97
+ expect(["auto_run", "generate_stubs", "skip"]).toContain(
98
+ decision.suggestedAction,
99
+ );
100
+ });
101
+
102
+ test("suggests ask_human for native apps without WebdriverIO", () => {
103
+ const tools = [
104
+ {
105
+ name: "ADB",
106
+ installed: true,
107
+ description: "Android Debug Bridge",
108
+ },
109
+ ];
110
+ const decision = makeSmartDecision(tempDir, "tauri", tools);
111
+ expect(decision.suggestedAction).toBe("ask_human");
112
+ });
113
+ });
114
+
115
+ describe("generateToolsPresentation", () => {
116
+ test("generates presentation with installed tools", () => {
117
+ const tools = [
118
+ {
119
+ name: "Playwright",
120
+ installed: true,
121
+ description: "E2E testing for web apps",
122
+ command: "npx playwright test",
123
+ },
124
+ {
125
+ name: "WebdriverIO",
126
+ installed: false,
127
+ description: "Mobile testing",
128
+ installHint: "npm install @wdio/cli",
129
+ },
130
+ ];
131
+ const presentation = generateToolsPresentation("nextjs", tools);
132
+
133
+ expect(presentation).toContain("Available E2E Testing Tools");
134
+ expect(presentation).toContain("Ready to Use");
135
+ expect(presentation).toContain("Playwright");
136
+ expect(presentation).toContain("not installed");
137
+ expect(presentation).toContain("npm install");
138
+ });
139
+
140
+ test("returns header only for unknown project", () => {
141
+ const presentation = generateToolsPresentation("unknown", []);
142
+ expect(presentation).toContain("E2E Testing Tools");
143
+ });
144
+ });
145
+
146
+ describe("getE2EToolsConfig", () => {
147
+ test("returns valid config", () => {
148
+ const config = getE2EToolsConfig(tempDir);
149
+ expect(config).toHaveProperty("projectRoot");
150
+ expect(config).toHaveProperty("projectType");
151
+ expect(config).toHaveProperty("detectedTools");
152
+ expect(config).toHaveProperty("recommendedTools");
153
+ expect(config).toHaveProperty("needsManualSetup");
154
+ });
155
+ });
156
+ });