strray-ai 1.0.17 → 1.0.18

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.

Potentially problematic release.


This version of strray-ai might be problematic. Click here for more details.

Files changed (76) hide show
  1. package/opencode.json +1 -3
  2. package/package.json +2 -1
  3. package/scripts/postinstall.cjs +53 -0
  4. package/src/__tests__/agents/architect.test.ts +108 -0
  5. package/src/__tests__/agents/bug-triage-specialist.test.ts +246 -0
  6. package/src/__tests__/agents/code-reviewer.test.ts +242 -0
  7. package/src/__tests__/agents/enforcer.test.ts +179 -0
  8. package/src/__tests__/agents/index.test.ts +135 -0
  9. package/src/__tests__/agents/orchestrator.test.ts +228 -0
  10. package/src/__tests__/agents/refactorer.test.ts +248 -0
  11. package/src/__tests__/agents/security-auditor.test.ts +234 -0
  12. package/src/__tests__/agents/test-architect.test.ts +256 -0
  13. package/src/__tests__/agents/types.test.ts +210 -0
  14. package/src/__tests__/framework-enforcement-integration.test.ts +252 -0
  15. package/src/__tests__/framework-logger-persistence.test.ts +156 -0
  16. package/src/__tests__/integration/codex-enforcement-e2e.test.ts +195 -0
  17. package/src/__tests__/integration/codex-enforcement.test.ts +237 -0
  18. package/src/__tests__/integration/commit-batching-enforcement-integration.test.ts +343 -0
  19. package/src/__tests__/integration/context-providers-integration.test.ts +302 -0
  20. package/src/__tests__/integration/delegation-system.test.ts +263 -0
  21. package/src/__tests__/integration/e2e-framework-integration.test.ts +1524 -0
  22. package/src/__tests__/integration/framework-init.test.ts +327 -0
  23. package/src/__tests__/integration/json-codex-integration.test.ts +332 -0
  24. package/src/__tests__/integration/oh-my-opencode-integration.test.ts +240 -0
  25. package/src/__tests__/integration/orchestration-e2e.test.ts +176 -0
  26. package/src/__tests__/integration/orchestrator/basic-orchestrator.test.ts +53 -0
  27. package/src/__tests__/integration/orchestrator/concurrent-execution.test.ts +64 -0
  28. package/src/__tests__/integration/orchestrator/dependency-handling.test.ts +78 -0
  29. package/src/__tests__/integration/orchestrator-integration.test.ts.disabled +1279 -0
  30. package/src/__tests__/integration/postprocessor-integration.test.ts +64 -0
  31. package/src/__tests__/integration/security/security-integration.test.ts +160 -0
  32. package/src/__tests__/integration/server.test.ts +187 -0
  33. package/src/__tests__/integration/session-cleanup-validation.test.ts +612 -0
  34. package/src/__tests__/integration/session-lifecycle.test.ts +450 -0
  35. package/src/__tests__/integration/session-management.test.ts +168 -0
  36. package/src/__tests__/integration/session-monitoring-integration.test.ts +644 -0
  37. package/src/__tests__/integration/session-state-sharing.test.ts +601 -0
  38. package/src/__tests__/performance/enterprise-performance-tests.ts +1030 -0
  39. package/src/__tests__/performance/performance-system.test.ts +408 -0
  40. package/src/__tests__/plugins/marketplace-service.test.ts +1542 -0
  41. package/src/__tests__/plugins/marketplace-service.test.ts.disabled +1516 -0
  42. package/src/__tests__/postprocessor/escalation/EscalationEngine.test.ts +205 -0
  43. package/src/__tests__/postprocessor/success/SuccessHandler.test.ts +258 -0
  44. package/src/__tests__/setup.ts +220 -0
  45. package/src/__tests__/test-integration.ts +2 -0
  46. package/src/__tests__/test-processor.ts +1 -0
  47. package/src/__tests__/unit/agent-delegator.test.ts +949 -0
  48. package/src/__tests__/unit/analytics.test.ts +192 -0
  49. package/src/__tests__/unit/ast-code-parser.test.ts +342 -0
  50. package/src/__tests__/unit/benchmark.test.ts +201 -0
  51. package/src/__tests__/unit/blocked-test.test.ts +8 -0
  52. package/src/__tests__/unit/boot-orchestrator.test.ts +182 -0
  53. package/src/__tests__/unit/codebase-context-analyzer.test.ts +375 -0
  54. package/src/__tests__/unit/codex-injector.test.ts +282 -0
  55. package/src/__tests__/unit/codex-parser.test.ts +296 -0
  56. package/src/__tests__/unit/context-loader.test.ts +723 -0
  57. package/src/__tests__/unit/dependency-graph-builder.test.ts +531 -0
  58. package/src/__tests__/unit/monitoring.test.ts +115 -0
  59. package/src/__tests__/unit/orchestrator.test.ts +212 -0
  60. package/src/__tests__/unit/processor-activation.test.ts +878 -0
  61. package/src/__tests__/unit/rule-enforcer.test.ts +363 -0
  62. package/src/__tests__/unit/security/security-auditor.test.ts +226 -0
  63. package/src/__tests__/unit/security/security-hardener.test.ts +404 -0
  64. package/src/__tests__/unit/security/security-headers.test.ts +255 -0
  65. package/src/__tests__/unit/session-coordination-validator.test.ts +184 -0
  66. package/src/__tests__/unit/session-health-monitoring.test.ts +161 -0
  67. package/src/__tests__/unit/session-migration-logic.test.ts +153 -0
  68. package/src/__tests__/unit/session-migration-validator.test.ts +130 -0
  69. package/src/__tests__/unit/session-security-validator.test.ts +87 -0
  70. package/src/__tests__/unit/state-manager-persistence.test.ts +301 -0
  71. package/src/__tests__/unit/state-manager.test.ts +205 -0
  72. package/src/__tests__/utils/mock-framework.ts +392 -0
  73. package/src/__tests__/utils/mock-server.ts +72 -0
  74. package/src/__tests__/utils/test-data.ts +130 -0
  75. package/src/__tests__/utils/test-helpers.ts +640 -0
  76. package/src/__tests__/utils/test-utils.ts +241 -0
@@ -0,0 +1,256 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { testArchitect } from "../../agents/test-architect.js";
3
+ import type { AgentConfig } from "../../agents/types.js";
4
+
5
+ describe("Test Architect Agent Configuration", () => {
6
+ it("should be a valid AgentConfig object", () => {
7
+ const config: AgentConfig = testArchitect;
8
+ expect(config).toBeDefined();
9
+ });
10
+
11
+ describe("Basic Configuration", () => {
12
+ it("should have correct name and model", () => {
13
+ expect(testArchitect.name).toBe("test-architect");
14
+ expect(testArchitect.model).toBe("opencode/grok-code");
15
+ });
16
+
17
+ it("should be configured as subagent mode", () => {
18
+ expect(testArchitect.mode).toBe("subagent");
19
+ });
20
+
21
+ it("should have low temperature for consistent testing decisions", () => {
22
+ expect(testArchitect.temperature).toBe(0.1);
23
+ });
24
+ });
25
+
26
+ describe("Description and System Prompt", () => {
27
+ it("should have appropriate test architect description", () => {
28
+ expect(testArchitect.description).toContain(
29
+ "StringRay Framework test architect",
30
+ );
31
+ expect(testArchitect.description).toContain("automatic test generation");
32
+ expect(testArchitect.description).toContain("coverage optimization");
33
+ expect(testArchitect.description).toContain("behavioral testing");
34
+ });
35
+
36
+ it("should have comprehensive test architect system prompt", () => {
37
+ const system = testArchitect.system;
38
+ expect(system).toContain("StringRay Test Architect");
39
+ expect(system).toContain("comprehensive testing strategy");
40
+ expect(system).toContain("quality assurance");
41
+ });
42
+ });
43
+
44
+ describe("Core Responsibilities", () => {
45
+ it("should define 6 core testing responsibilities", () => {
46
+ const system = testArchitect.system;
47
+ expect(system).toContain("Test Auto-Creation");
48
+ expect(system).toContain("Test Strategy Design");
49
+ expect(system).toContain("Coverage Optimization");
50
+ expect(system).toContain("Behavioral Testing");
51
+ expect(system).toContain("Performance Validation");
52
+ expect(system).toContain("Quality Assurance");
53
+ });
54
+
55
+ it("should specify test strategy design capabilities", () => {
56
+ const system = testArchitect.system;
57
+ expect(system).toContain("comprehensive testing plans");
58
+ expect(system).toContain("unit, integration, and E2E scenarios");
59
+ });
60
+
61
+ it("should include coverage optimization focus", () => {
62
+ const system = testArchitect.system;
63
+ expect(system).toContain("Maximize test coverage");
64
+ expect(system).toContain("minimizing redundancy");
65
+ expect(system).toContain("maintenance overhead");
66
+ });
67
+
68
+ it("should specify behavioral testing approach", () => {
69
+ const system = testArchitect.system;
70
+ expect(system).toContain("behavior validation");
71
+ expect(system).toContain("implementation details");
72
+ });
73
+
74
+ it("should include performance validation", () => {
75
+ const system = testArchitect.system;
76
+ expect(system).toContain("performance requirements");
77
+ expect(system).toContain("scalability");
78
+ });
79
+
80
+ it("should specify quality assurance goals", () => {
81
+ const system = testArchitect.system;
82
+ expect(system).toContain("85%+ test coverage");
83
+ expect(system).toContain("reliable, maintainable test suites");
84
+ });
85
+ });
86
+
87
+ describe("Key Facilities", () => {
88
+ it("should specify test coverage tracking", () => {
89
+ const system = testArchitect.system;
90
+ expect(system).toContain("Test coverage tracking");
91
+ expect(system).toContain("coverage_trends");
92
+ expect(system).toContain("test_execution_time");
93
+ expect(system).toContain("flaky_test_rate");
94
+ });
95
+
96
+ it("should include performance analytics", () => {
97
+ const system = testArchitect.system;
98
+ expect(system).toContain("Performance analytics");
99
+ expect(system).toContain("execution timing patterns");
100
+ expect(system).toContain("failure prediction models");
101
+ });
102
+
103
+ it("should define testing processor pipeline", () => {
104
+ const system = testArchitect.system;
105
+ expect(system).toContain("Processor pipeline");
106
+ expect(system).toContain("test-validation");
107
+ expect(system).toContain("coverage-analysis");
108
+ expect(system).toContain("performance-testing");
109
+ expect(system).toContain("integration-testing");
110
+ });
111
+
112
+ it("should specify alert thresholds", () => {
113
+ const system = testArchitect.system;
114
+ expect(system).toContain("Alert thresholds");
115
+ expect(system).toContain("40s response time");
116
+ expect(system).toContain("2% error rate");
117
+ expect(system).toContain("400MB memory usage");
118
+ });
119
+
120
+ it("should specify parallel execution capabilities", () => {
121
+ const system = testArchitect.system;
122
+ expect(system).toContain("Parallel test execution");
123
+ expect(system).toContain("4+ worker threads");
124
+ });
125
+ });
126
+
127
+ describe("Testing Strategy", () => {
128
+ it("should define 5-level testing strategy", () => {
129
+ const system = testArchitect.system;
130
+ expect(system).toContain("Testing Strategy");
131
+ expect(system).toContain("Unit Testing");
132
+ expect(system).toContain("Integration Testing");
133
+ expect(system).toContain("End-to-End Testing");
134
+ expect(system).toContain("Performance Testing");
135
+ expect(system).toContain("Security Testing");
136
+ });
137
+
138
+ it("should specify unit testing focus", () => {
139
+ const system = testArchitect.system;
140
+ expect(system).toContain("Pure functions");
141
+ expect(system).toContain("component isolation");
142
+ expect(system).toContain("edge case coverage");
143
+ });
144
+
145
+ it("should include integration testing", () => {
146
+ const system = testArchitect.system;
147
+ expect(system).toContain("Component interaction");
148
+ expect(system).toContain("API validation");
149
+ expect(system).toContain("data flow testing");
150
+ });
151
+
152
+ it("should specify end-to-end testing", () => {
153
+ const system = testArchitect.system;
154
+ expect(system).toContain("Complete user workflows");
155
+ expect(system).toContain("critical path validation");
156
+ });
157
+
158
+ it("should include performance testing", () => {
159
+ const system = testArchitect.system;
160
+ expect(system).toContain("Load testing");
161
+ expect(system).toContain("scalability validation");
162
+ expect(system).toContain("bottleneck identification");
163
+ });
164
+
165
+ it("should specify security testing", () => {
166
+ const system = testArchitect.system;
167
+ expect(system).toContain("Input validation");
168
+ expect(system).toContain("authentication");
169
+ expect(system).toContain("authorization testing");
170
+ });
171
+ });
172
+
173
+ describe("Testing Guidelines", () => {
174
+ it("should prioritize behavior over implementation", () => {
175
+ const system = testArchitect.system;
176
+ expect(system).toContain("behavior over implementation details");
177
+ });
178
+
179
+ it("should specify coverage requirements", () => {
180
+ const system = testArchitect.system;
181
+ expect(system).toContain("85%+ coverage");
182
+ expect(system).toContain("all test types");
183
+ });
184
+
185
+ it("should emphasize parallel execution", () => {
186
+ const system = testArchitect.system;
187
+ expect(system).toContain("parallel execution");
188
+ expect(system).toContain("efficiency");
189
+ });
190
+
191
+ it("should include predictive models", () => {
192
+ const system = testArchitect.system;
193
+ expect(system).toContain("predictive models");
194
+ expect(system).toContain("failure prevention");
195
+ });
196
+
197
+ it("should validate both positive and negative scenarios", () => {
198
+ const system = testArchitect.system;
199
+ expect(system).toContain("positive and negative test scenarios");
200
+ });
201
+ });
202
+
203
+ describe("Integration Points", () => {
204
+ it("should define comprehensive testing integration points", () => {
205
+ const system = testArchitect.system;
206
+ expect(system).toContain("Integration Points");
207
+ expect(system).toContain("Automated testing frameworks");
208
+ expect(system).toContain("Coverage analysis");
209
+ expect(system).toContain("Performance monitoring");
210
+ expect(system).toContain("CI/CD pipeline integration");
211
+ expect(system).toContain("Test result analysis");
212
+ });
213
+ });
214
+
215
+ describe("Tools Configuration", () => {
216
+ it("should have essential testing tools", () => {
217
+ expect(testArchitect.tools?.include).toContain("read");
218
+ expect(testArchitect.tools?.include).toContain("grep");
219
+ expect(testArchitect.tools?.include).toContain("lsp_*");
220
+ expect(testArchitect.tools?.include).toContain("run_terminal_cmd");
221
+ expect(testArchitect.tools?.include).toContain("write");
222
+ });
223
+
224
+ it("should have 6 testing-specific tools", () => {
225
+ expect(testArchitect.tools?.include).toHaveLength(6);
226
+ });
227
+ });
228
+
229
+ describe("Permissions Configuration", () => {
230
+ it("should allow edit operations", () => {
231
+ expect(testArchitect.permission?.edit).toBe("allow");
232
+ });
233
+
234
+ it("should have comprehensive testing permissions", () => {
235
+ const bashPerms = testArchitect.permission?.bash;
236
+ expect(bashPerms).toBeDefined();
237
+ expect(typeof bashPerms).toBe("object");
238
+
239
+ expect((bashPerms as any)?.git).toBe("allow");
240
+ expect((bashPerms as any)?.npm).toBe("allow");
241
+ expect((bashPerms as any)?.bun).toBe("allow");
242
+ expect((bashPerms as any)?.test).toBe("allow");
243
+ expect((bashPerms as any)?.coverage).toBe("allow");
244
+ });
245
+ });
246
+
247
+ describe("Testing Goal", () => {
248
+ it("should define clear testing assurance goal", () => {
249
+ const system = testArchitect.system;
250
+ expect(system).toContain("comprehensive test coverage");
251
+ expect(system).toContain("reliable validation");
252
+ expect(system).toContain("system behavior");
253
+ expect(system).toContain("performance");
254
+ });
255
+ });
256
+ });
@@ -0,0 +1,210 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import type {
3
+ ToolConfig,
4
+ PermissionConfig,
5
+ AgentConfig,
6
+ } from "../../agents/types.js";
7
+
8
+ describe("Agent Types", () => {
9
+ describe("ToolConfig", () => {
10
+ it("should allow basic include/exclude configuration", () => {
11
+ const config: ToolConfig = {
12
+ include: ["*.ts", "*.tsx"],
13
+ exclude: ["*.test.ts", "*.spec.ts"],
14
+ };
15
+
16
+ expect(config.include).toEqual(["*.ts", "*.tsx"]);
17
+ expect(config.exclude).toEqual(["*.test.ts", "*.spec.ts"]);
18
+ });
19
+
20
+ it("should allow additional properties via index signature", () => {
21
+ const config: ToolConfig = {
22
+ include: ["*.js"],
23
+ customProperty: "value",
24
+ anotherProp: 42,
25
+ };
26
+
27
+ expect(config.customProperty).toBe("value");
28
+ expect(config.anotherProp).toBe(42);
29
+ });
30
+
31
+ it("should allow empty configuration", () => {
32
+ const config: ToolConfig = {};
33
+
34
+ expect(config).toEqual({});
35
+ });
36
+ });
37
+
38
+ describe("PermissionConfig", () => {
39
+ it("should support simple permission values", () => {
40
+ const config: PermissionConfig = {
41
+ edit: "allow",
42
+ bash: "deny",
43
+ webfetch: "ask",
44
+ };
45
+
46
+ expect(config.edit).toBe("allow");
47
+ expect(config.bash).toBe("deny");
48
+ expect(config.webfetch).toBe("ask");
49
+ });
50
+
51
+ it("should support detailed bash command permissions", () => {
52
+ const config: PermissionConfig = {
53
+ bash: {
54
+ git: "allow",
55
+ "npm install": "ask",
56
+ "rm -rf": "deny",
57
+ },
58
+ };
59
+
60
+ expect(config.bash).toEqual({
61
+ git: "allow",
62
+ "npm install": "ask",
63
+ "rm -rf": "deny",
64
+ });
65
+ });
66
+
67
+ it("should allow additional permission properties", () => {
68
+ const config: PermissionConfig = {
69
+ edit: "allow",
70
+ customPermission: "value",
71
+ };
72
+
73
+ expect(config.customPermission).toBe("value");
74
+ });
75
+ });
76
+
77
+ describe("AgentConfig", () => {
78
+ const validConfig: AgentConfig = {
79
+ name: "test-agent",
80
+ model: "gpt-4",
81
+ description: "A test agent",
82
+ mode: "primary",
83
+ system: "You are a helpful assistant",
84
+ };
85
+
86
+ it("should accept minimal required configuration", () => {
87
+ expect(validConfig.name).toBe("test-agent");
88
+ expect(validConfig.model).toBe("gpt-4");
89
+ expect(validConfig.description).toBe("A test agent");
90
+ expect(validConfig.mode).toBe("primary");
91
+ expect(validConfig.system).toBe("You are a helpful assistant");
92
+ });
93
+
94
+ it("should support all optional fields", () => {
95
+ const fullConfig: AgentConfig = {
96
+ name: "full-agent",
97
+ model: "claude-3",
98
+ description: "Full featured agent",
99
+ mode: "subagent",
100
+ system: "System prompt",
101
+ temperature: 0.7,
102
+ top_p: 0.9,
103
+ tools: {
104
+ include: ["read", "write"],
105
+ exclude: ["dangerous"],
106
+ },
107
+ permission: {
108
+ edit: "allow",
109
+ bash: "ask",
110
+ },
111
+ prompt: "Custom prompt",
112
+ prompt_append: "Additional instructions",
113
+ disable: false,
114
+ color: "#ff0000",
115
+ };
116
+
117
+ expect(fullConfig.temperature).toBe(0.7);
118
+ expect(fullConfig.top_p).toBe(0.9);
119
+ expect(fullConfig.tools?.include).toEqual(["read", "write"]);
120
+ expect(fullConfig.permission?.edit).toBe("allow");
121
+ expect(fullConfig.prompt).toBe("Custom prompt");
122
+ expect(fullConfig.prompt_append).toBe("Additional instructions");
123
+ expect(fullConfig.disable).toBe(false);
124
+ expect(fullConfig.color).toBe("#ff0000");
125
+ });
126
+
127
+ it("should support all mode values", () => {
128
+ const primaryConfig: AgentConfig = { ...validConfig, mode: "primary" };
129
+ const subagentConfig: AgentConfig = { ...validConfig, mode: "subagent" };
130
+ const allConfig: AgentConfig = { ...validConfig, mode: "all" };
131
+
132
+ expect(primaryConfig.mode).toBe("primary");
133
+ expect(subagentConfig.mode).toBe("subagent");
134
+ expect(allConfig.mode).toBe("all");
135
+ });
136
+
137
+ it("should handle disable flag", () => {
138
+ const enabledConfig: AgentConfig = { ...validConfig, disable: false };
139
+ const disabledConfig: AgentConfig = { ...validConfig, disable: true };
140
+
141
+ expect(enabledConfig.disable).toBe(false);
142
+ expect(disabledConfig.disable).toBe(true);
143
+ });
144
+ });
145
+
146
+ describe("Type Safety and Serialization", () => {
147
+ it("should serialize and deserialize AgentConfig correctly", () => {
148
+ const config: AgentConfig = {
149
+ name: "serialization-test",
150
+ model: "test-model",
151
+ description: "Testing serialization",
152
+ mode: "primary",
153
+ system: "Test system",
154
+ temperature: 0.5,
155
+ tools: { include: ["test"] },
156
+ permission: { edit: "allow" },
157
+ };
158
+
159
+ const serialized = JSON.stringify(config);
160
+ const deserialized = JSON.parse(serialized) as AgentConfig;
161
+
162
+ expect(deserialized.name).toBe(config.name);
163
+ expect(deserialized.model).toBe(config.model);
164
+ expect(deserialized.temperature).toBe(config.temperature);
165
+ expect(deserialized.tools?.include).toEqual(config.tools?.include);
166
+ expect(deserialized.permission?.edit).toBe(config.permission?.edit);
167
+ });
168
+
169
+ it("should maintain type safety with complex nested structures", () => {
170
+ const config: AgentConfig = {
171
+ name: "complex-agent",
172
+ model: "advanced-model",
173
+ description: "Complex configuration test",
174
+ mode: "all",
175
+ system: "Complex system",
176
+ temperature: 0.8,
177
+ tools: {
178
+ include: ["read", "write", "execute"],
179
+ exclude: ["delete", "dangerous"],
180
+ customTool: "enabled",
181
+ timeout: 5000,
182
+ },
183
+ permission: {
184
+ edit: "allow",
185
+ bash: {
186
+ "git status": "allow",
187
+ "npm test": "allow",
188
+ sudo: "deny",
189
+ },
190
+ webfetch: "ask",
191
+ customPerm: "value",
192
+ },
193
+ prompt: "Main prompt",
194
+ prompt_append: "Additional context",
195
+ disable: false,
196
+ color: "#00ff00",
197
+ };
198
+
199
+ // TypeScript should enforce all these types at compile time
200
+ expect(typeof config.name).toBe("string");
201
+ expect(typeof config.model).toBe("string");
202
+ expect(typeof config.description).toBe("string");
203
+ expect(["primary", "subagent", "all"]).toContain(config.mode);
204
+ expect(typeof config.system).toBe("string");
205
+ expect(typeof config.temperature).toBe("number"); // This field is set in the config
206
+ expect(Array.isArray(config.tools?.include)).toBe(true);
207
+ expect(["ask", "allow", "deny"]).toContain(config.permission?.edit);
208
+ });
209
+ });
210
+ });