llm-mock-server 1.0.6 → 1.0.8
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/README.md +1 -1
- package/dist/cli/cli.d.ts +3 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +103 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/validators.d.ts +7 -0
- package/dist/cli/validators.d.ts.map +1 -0
- package/dist/cli/validators.js +53 -0
- package/dist/cli/validators.js.map +1 -0
- package/dist/formats/anthropic/index.d.ts +1 -1
- package/dist/formats/anthropic/index.d.ts.map +1 -1
- package/dist/formats/anthropic/index.js +1 -1
- package/dist/formats/anthropic/index.js.map +1 -1
- package/dist/formats/anthropic/parse.d.ts +2 -2
- package/dist/formats/anthropic/parse.d.ts.map +1 -1
- package/dist/formats/anthropic/parse.js +4 -2
- package/dist/formats/anthropic/parse.js.map +1 -1
- package/dist/formats/anthropic/schema.d.ts +1 -1
- package/dist/formats/anthropic/schema.d.ts.map +1 -1
- package/dist/formats/anthropic/schema.js +9 -4
- package/dist/formats/anthropic/schema.js.map +1 -1
- package/dist/formats/anthropic/serialize.d.ts +2 -2
- package/dist/formats/anthropic/serialize.d.ts.map +1 -1
- package/dist/formats/anthropic/serialize.js +76 -19
- package/dist/formats/anthropic/serialize.js.map +1 -1
- package/dist/formats/openai/chat-completions/index.d.ts +3 -0
- package/dist/formats/openai/chat-completions/index.d.ts.map +1 -0
- package/dist/formats/openai/chat-completions/index.js +13 -0
- package/dist/formats/openai/chat-completions/index.js.map +1 -0
- package/dist/formats/openai/chat-completions/parse.d.ts +4 -0
- package/dist/formats/openai/chat-completions/parse.d.ts.map +1 -0
- package/dist/formats/openai/chat-completions/parse.js +33 -0
- package/dist/formats/openai/chat-completions/parse.js.map +1 -0
- package/dist/formats/openai/chat-completions/schema.d.ts +93 -0
- package/dist/formats/openai/chat-completions/schema.d.ts.map +1 -0
- package/dist/formats/openai/chat-completions/schema.js +74 -0
- package/dist/formats/openai/chat-completions/schema.js.map +1 -0
- package/dist/formats/openai/chat-completions/serialize.d.ts +10 -0
- package/dist/formats/openai/chat-completions/serialize.d.ts.map +1 -0
- package/dist/formats/openai/chat-completions/serialize.js +99 -0
- package/dist/formats/openai/chat-completions/serialize.js.map +1 -0
- package/dist/formats/openai/responses/index.d.ts +3 -0
- package/dist/formats/openai/responses/index.d.ts.map +1 -0
- package/dist/formats/openai/responses/index.js +13 -0
- package/dist/formats/openai/responses/index.js.map +1 -0
- package/dist/formats/openai/responses/parse.d.ts +4 -0
- package/dist/formats/openai/responses/parse.d.ts.map +1 -0
- package/dist/formats/openai/responses/parse.js +51 -0
- package/dist/formats/openai/responses/parse.js.map +1 -0
- package/dist/formats/openai/responses/schema.d.ts +103 -0
- package/dist/formats/openai/responses/schema.d.ts.map +1 -0
- package/dist/formats/openai/responses/schema.js +71 -0
- package/dist/formats/openai/responses/schema.js.map +1 -0
- package/dist/formats/openai/responses/serialize.d.ts +10 -0
- package/dist/formats/openai/responses/serialize.d.ts.map +1 -0
- package/dist/formats/openai/responses/serialize.js +273 -0
- package/dist/formats/openai/responses/serialize.js.map +1 -0
- package/dist/formats/request-helpers.d.ts +1 -1
- package/dist/formats/request-helpers.d.ts.map +1 -1
- package/dist/formats/request-helpers.js.map +1 -1
- package/dist/formats/serialize-helpers.d.ts +1 -1
- package/dist/formats/serialize-helpers.d.ts.map +1 -1
- package/dist/formats/serialize-helpers.js +6 -3
- package/dist/formats/serialize-helpers.js.map +1 -1
- package/dist/formats/types.d.ts +2 -1
- package/dist/formats/types.d.ts.map +1 -1
- package/dist/history.d.ts +6 -2
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +2 -0
- package/dist/history.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +26 -9
- package/dist/loader.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +12 -4
- package/dist/logger.js.map +1 -1
- package/dist/mock-server.d.ts +44 -48
- package/dist/mock-server.d.ts.map +1 -1
- package/dist/mock-server.js +37 -85
- package/dist/mock-server.js.map +1 -1
- package/dist/route-handler.d.ts +1 -1
- package/dist/route-handler.d.ts.map +1 -1
- package/dist/route-handler.js +19 -7
- package/dist/route-handler.js.map +1 -1
- package/dist/rule-builder.d.ts +21 -0
- package/dist/rule-builder.d.ts.map +1 -0
- package/dist/rule-builder.js +58 -0
- package/dist/rule-builder.js.map +1 -0
- package/dist/rule-engine.d.ts +3 -1
- package/dist/rule-engine.d.ts.map +1 -1
- package/dist/rule-engine.js +7 -2
- package/dist/rule-engine.js.map +1 -1
- package/dist/sse-writer.d.ts +1 -1
- package/dist/sse-writer.d.ts.map +1 -1
- package/dist/types/reply.d.ts +51 -8
- package/dist/types/reply.d.ts.map +1 -1
- package/dist/types/request.d.ts +21 -6
- package/dist/types/request.d.ts.map +1 -1
- package/dist/types/rule.d.ts +65 -7
- package/dist/types/rule.d.ts.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -9
- package/.claude/skills/desloppify/SKILL.md +0 -308
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/canonical_import_20260315_000801.json +0 -242
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/canonical_import_20260315_000905.json +0 -248
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/canonical_import_20260315_000917.json +0 -248
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/canonical_import_20260315_000950.json +0 -311
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/claude_launch_prompt.md +0 -17
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/review_result.json +0 -255
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/review_result.template.json +0 -22
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/reviewer_instructions.md +0 -20
- package/.desloppify/external_review_sessions/ext_20260315_000339_a6cdc3e6/session.json +0 -20
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/canonical_import_20260315_050000.json +0 -286
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/canonical_import_20260315_050028.json +0 -303
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/claude_launch_prompt.md +0 -17
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/review_result.json +0 -297
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/review_result.template.json +0 -22
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/reviewer_instructions.md +0 -20
- package/.desloppify/external_review_sessions/ext_20260315_045546_0587ea3b/session.json +0 -20
- package/.desloppify/query.json +0 -1312
- package/.desloppify/review_packet_blind.json +0 -1249
- package/.desloppify/review_packets/holistic_packet_20260315_000339.json +0 -1471
- package/.desloppify/review_packets/holistic_packet_20260315_045546.json +0 -1480
- package/.desloppify/review_packets/holistic_packet_20260315_185401.json +0 -1407
- package/.desloppify/review_packets/holistic_packet_20260315_185613.json +0 -1407
- package/.desloppify/state-typescript.json +0 -8438
- package/.desloppify/state-typescript.json.bak +0 -8432
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-1.log +0 -384
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-10.log +0 -484
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-2.log +0 -408
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-3.log +0 -416
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-4.log +0 -360
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-5.log +0 -360
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-6.log +0 -364
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-7.log +0 -428
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-8.log +0 -388
- package/.desloppify/subagents/runs/20260315_185401/logs/batch-9.log +0 -500
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-1.md +0 -83
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-10.md +0 -108
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-2.md +0 -89
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-3.md +0 -91
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-4.md +0 -77
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-5.md +0 -77
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-6.md +0 -78
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-7.md +0 -94
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-8.md +0 -84
- package/.desloppify/subagents/runs/20260315_185401/prompts/batch-9.md +0 -112
- package/.desloppify/subagents/runs/20260315_185401/results/batch-1.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-10.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-2.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-3.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-4.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-5.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-6.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-7.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-8.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/results/batch-9.raw.txt +0 -0
- package/.desloppify/subagents/runs/20260315_185401/run.log +0 -36
- package/.desloppify/subagents/runs/20260315_185401/run_summary.json +0 -156
- package/.desloppify/subagents/runs/20260315_185613/holistic_findings_merged.json +0 -741
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-1.log +0 -579
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-10.log +0 -1537
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-2.log +0 -829
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-3.log +0 -927
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-4.log +0 -429
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-5.log +0 -276
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-6.log +0 -450
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-7.log +0 -730
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-8.log +0 -698
- package/.desloppify/subagents/runs/20260315_185613/logs/batch-9.log +0 -938
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-1.md +0 -83
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-10.md +0 -108
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-2.md +0 -89
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-3.md +0 -91
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-4.md +0 -77
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-5.md +0 -77
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-6.md +0 -78
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-7.md +0 -94
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-8.md +0 -84
- package/.desloppify/subagents/runs/20260315_185613/prompts/batch-9.md +0 -112
- package/.desloppify/subagents/runs/20260315_185613/results/batch-1.raw.txt +0 -78
- package/.desloppify/subagents/runs/20260315_185613/results/batch-10.raw.txt +0 -242
- package/.desloppify/subagents/runs/20260315_185613/results/batch-2.raw.txt +0 -102
- package/.desloppify/subagents/runs/20260315_185613/results/batch-3.raw.txt +0 -94
- package/.desloppify/subagents/runs/20260315_185613/results/batch-4.raw.txt +0 -86
- package/.desloppify/subagents/runs/20260315_185613/results/batch-5.raw.txt +0 -1
- package/.desloppify/subagents/runs/20260315_185613/results/batch-6.raw.txt +0 -87
- package/.desloppify/subagents/runs/20260315_185613/results/batch-7.raw.txt +0 -1
- package/.desloppify/subagents/runs/20260315_185613/results/batch-8.raw.txt +0 -107
- package/.desloppify/subagents/runs/20260315_185613/results/batch-9.raw.txt +0 -67
- package/.desloppify/subagents/runs/20260315_185613/run.log +0 -96
- package/.desloppify/subagents/runs/20260315_185613/run_summary.json +0 -156
- package/.editorconfig +0 -12
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/docs.yml +0 -46
- package/.github/workflows/test.yml +0 -40
- package/.markdownlint.jsonc +0 -11
- package/.node-version +0 -1
- package/.oxfmtrc.json +0 -9
- package/.oxlintrc.json +0 -35
- package/docs/ARCHITECTURE.md +0 -125
- package/scorecard.png +0 -0
- package/src/cli/cli.ts +0 -141
- package/src/cli/validators.ts +0 -68
- package/src/formats/anthropic/index.ts +0 -14
- package/src/formats/anthropic/parse.ts +0 -70
- package/src/formats/anthropic/schema.ts +0 -74
- package/src/formats/anthropic/serialize.ts +0 -179
- package/src/formats/openai/chat-completions/index.ts +0 -14
- package/src/formats/openai/chat-completions/parse.ts +0 -47
- package/src/formats/openai/chat-completions/schema.ts +0 -92
- package/src/formats/openai/chat-completions/serialize.ts +0 -146
- package/src/formats/openai/responses/index.ts +0 -14
- package/src/formats/openai/responses/parse.ts +0 -73
- package/src/formats/openai/responses/schema.ts +0 -86
- package/src/formats/openai/responses/serialize.ts +0 -328
- package/src/formats/request-helpers.ts +0 -56
- package/src/formats/serialize-helpers.ts +0 -43
- package/src/formats/types.ts +0 -26
- package/src/history.ts +0 -70
- package/src/index.ts +0 -46
- package/src/loader.ts +0 -246
- package/src/logger.ts +0 -70
- package/src/mock-server.ts +0 -203
- package/src/route-handler.ts +0 -144
- package/src/rule-builder.ts +0 -73
- package/src/rule-engine.ts +0 -165
- package/src/sse-writer.ts +0 -35
- package/src/types/reply.ts +0 -92
- package/src/types/request.ts +0 -56
- package/src/types/rule.ts +0 -125
- package/src/types.ts +0 -24
- package/test/cli-validators.test.ts +0 -151
- package/test/formats/anthropic.test.ts +0 -336
- package/test/formats/openai.test.ts +0 -316
- package/test/formats/parse-helpers.test.ts +0 -315
- package/test/formats/responses.test.ts +0 -380
- package/test/helpers/make-req.ts +0 -18
- package/test/history.test.ts +0 -361
- package/test/loader.test.ts +0 -333
- package/test/logger.test.ts +0 -344
- package/test/mock-server.test.ts +0 -619
- package/test/rule-engine.test.ts +0 -229
- package/tsconfig.json +0 -24
- package/tsconfig.test.json +0 -11
- package/typedoc.json +0 -9
- package/vitest.config.ts +0 -18
|
@@ -1,829 +0,0 @@
|
|
|
1
|
-
ATTEMPT 1/3
|
|
2
|
-
$ codex exec --ephemeral -C /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server -s workspace-write -c approval_policy="never" -c model_reasoning_effort="low" -o /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/.desloppify/subagents/runs/20260315_185613/results/batch-2.raw.txt You are a focused subagent reviewer for a single holistic investigation batch.
|
|
3
|
-
|
|
4
|
-
Repository root: /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server
|
|
5
|
-
Blind packet: /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/.desloppify/review_packet_blind.json
|
|
6
|
-
Batch index: 2
|
|
7
|
-
Batch name: Conventions & Errors
|
|
8
|
-
Batch dimensions: convention_outlier, error_consistency, mid_level_elegance
|
|
9
|
-
Batch rationale: naming drift, behavioral outliers, mixed error strategies
|
|
10
|
-
|
|
11
|
-
Files assigned:
|
|
12
|
-
- src/cli.ts
|
|
13
|
-
- src/formats/anthropic/schema.ts
|
|
14
|
-
- src/formats/openai/schema.ts
|
|
15
|
-
- src/formats/responses/schema.ts
|
|
16
|
-
- src/logger.ts
|
|
17
|
-
- src/types.ts
|
|
18
|
-
- src/types/request.ts
|
|
19
|
-
- test/helpers/make-req.ts
|
|
20
|
-
- test/cli-validators.test.ts
|
|
21
|
-
- test/mock-server.test.ts
|
|
22
|
-
- test/rule-engine.test.ts
|
|
23
|
-
- src/cli-validators.ts
|
|
24
|
-
- src/history.ts
|
|
25
|
-
|
|
26
|
-
Task requirements:
|
|
27
|
-
1. Read the blind packet and follow `system_prompt` constraints exactly.
|
|
28
|
-
1a. If previously flagged issues are listed above, use them as context for your review.
|
|
29
|
-
Verify whether each still applies to the current code. Do not re-report fixed or
|
|
30
|
-
wontfix issues. Use them as starting points to look deeper — inspect adjacent code
|
|
31
|
-
and related modules for defects the prior review may have missed.
|
|
32
|
-
1c. Think structurally: when you spot multiple individual issues that share a common
|
|
33
|
-
root cause (missing abstraction, duplicated pattern, inconsistent convention),
|
|
34
|
-
explain the deeper structural issue in the finding, not just the surface symptom.
|
|
35
|
-
If the pattern is significant enough, report the structural issue as its own finding
|
|
36
|
-
with appropriate fix_scope ('multi_file_refactor' or 'architectural_change') and
|
|
37
|
-
use `root_cause_cluster` to connect related symptom findings together.
|
|
38
|
-
2. Evaluate ONLY listed files and ONLY listed dimensions for this batch.
|
|
39
|
-
3. Return 0-10 high-quality findings for this batch (empty array allowed).
|
|
40
|
-
3a. Do not suppress real defects to keep scores high; report every material issue you can support with evidence.
|
|
41
|
-
3b. Do not default to 100. Reserve 100 for genuinely exemplary evidence in this batch.
|
|
42
|
-
4. Score/finding consistency is required: broader or more severe findings MUST lower dimension scores.
|
|
43
|
-
4a. Any dimension scored below 85.0 MUST include explicit feedback: add at least one finding with the same `dimension` and a non-empty actionable `suggestion`.
|
|
44
|
-
5. Every finding must include `related_files` with at least 2 files when possible.
|
|
45
|
-
6. Every finding must include `dimension`, `identifier`, `summary`, `evidence`, `suggestion`, and `confidence`.
|
|
46
|
-
7. Every finding must include `impact_scope` and `fix_scope`.
|
|
47
|
-
8. Every scored dimension MUST include dimension_notes with concrete evidence.
|
|
48
|
-
9. If a dimension score is >85.0, include `issues_preventing_higher_score` in dimension_notes.
|
|
49
|
-
10. Use exactly one decimal place for every assessment and abstraction sub-axis score.
|
|
50
|
-
11. Ignore prior chat context and any target-threshold assumptions.
|
|
51
|
-
12. Do not edit repository files.
|
|
52
|
-
13. Return ONLY valid JSON, no markdown fences.
|
|
53
|
-
|
|
54
|
-
Scope enums:
|
|
55
|
-
- impact_scope: "local" | "module" | "subsystem" | "codebase"
|
|
56
|
-
- fix_scope: "single_edit" | "multi_file_refactor" | "architectural_change"
|
|
57
|
-
|
|
58
|
-
Output schema:
|
|
59
|
-
{
|
|
60
|
-
"batch": "Conventions & Errors",
|
|
61
|
-
"batch_index": 2,
|
|
62
|
-
"assessments": {"<dimension>": <0-100 with one decimal place>},
|
|
63
|
-
"dimension_notes": {
|
|
64
|
-
"<dimension>": {
|
|
65
|
-
"evidence": ["specific code observations"],
|
|
66
|
-
"impact_scope": "local|module|subsystem|codebase",
|
|
67
|
-
"fix_scope": "single_edit|multi_file_refactor|architectural_change",
|
|
68
|
-
"confidence": "high|medium|low",
|
|
69
|
-
"issues_preventing_higher_score": "required when score >85.0",
|
|
70
|
-
"sub_axes": {"abstraction_leverage": 0-100 with one decimal place, "indirection_cost": 0-100 with one decimal place, "interface_honesty": 0-100 with one decimal place} // required for abstraction_fitness when evidence supports it
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"findings": [{
|
|
74
|
-
"dimension": "<dimension>",
|
|
75
|
-
"identifier": "short_id",
|
|
76
|
-
"summary": "one-line defect summary",
|
|
77
|
-
"related_files": ["relative/path.py"],
|
|
78
|
-
"evidence": ["specific code observation"],
|
|
79
|
-
"suggestion": "concrete fix recommendation",
|
|
80
|
-
"confidence": "high|medium|low",
|
|
81
|
-
"impact_scope": "local|module|subsystem|codebase",
|
|
82
|
-
"fix_scope": "single_edit|multi_file_refactor|architectural_change",
|
|
83
|
-
"root_cause_cluster": "optional_cluster_name_when_supported_by_history"
|
|
84
|
-
}],
|
|
85
|
-
"retrospective": {
|
|
86
|
-
"root_causes": ["optional: concise root-cause hypotheses"],
|
|
87
|
-
"likely_symptoms": ["optional: identifiers that look symptom-level"],
|
|
88
|
-
"possible_false_positives": ["optional: prior concept keys likely mis-scoped"]
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
STDOUT:
|
|
94
|
-
{
|
|
95
|
-
"batch": "Conventions & Errors",
|
|
96
|
-
"batch_index": 2,
|
|
97
|
-
"assessments": {
|
|
98
|
-
"convention_outlier": 86.0,
|
|
99
|
-
"error_consistency": 84.0,
|
|
100
|
-
"mid_level_elegance": 90.0
|
|
101
|
-
},
|
|
102
|
-
"dimension_notes": {
|
|
103
|
-
"convention_outlier": {
|
|
104
|
-
"evidence": [
|
|
105
|
-
"Log level naming diverges: `LEVEL_PRIORITY` exposes `warning` while the logger API uses `warn`, and CLI validation only accepts `warning` (src/logger.ts, src/cli-validators.ts, src/cli.ts).",
|
|
106
|
-
"Validator API mixes sync and async parsing in the same module: `parseHost` is async while other `parse*` helpers are sync, making call sites and tests use different interaction patterns (src/cli-validators.ts, test/cli-validators.test.ts)."
|
|
107
|
-
],
|
|
108
|
-
"impact_scope": "module",
|
|
109
|
-
"fix_scope": "multi_file_refactor",
|
|
110
|
-
"confidence": "medium",
|
|
111
|
-
"issues_preventing_higher_score": "Conventions around log-level naming and validator async/sync shape are inconsistent within the CLI surface."
|
|
112
|
-
},
|
|
113
|
-
"error_consistency": {
|
|
114
|
-
"evidence": [
|
|
115
|
-
"Rules reload path resets server state before load and then only logs on failure, leaving the server running with cleared rules if reload fails (src/cli.ts, src/logger.ts)."
|
|
116
|
-
],
|
|
117
|
-
"impact_scope": "module",
|
|
118
|
-
"fix_scope": "multi_file_refactor",
|
|
119
|
-
"confidence": "medium"
|
|
120
|
-
},
|
|
121
|
-
"mid_level_elegance": {
|
|
122
|
-
"evidence": [
|
|
123
|
-
"CLI start-up output bypasses the Logger and writes directly to `console.log`, while runtime events use Logger formatting and filtering (src/cli.ts, src/logger.ts)."
|
|
124
|
-
],
|
|
125
|
-
"impact_scope": "module",
|
|
126
|
-
"fix_scope": "single_edit",
|
|
127
|
-
"confidence": "low",
|
|
128
|
-
"issues_preventing_higher_score": "Startup logging is routed through a different seam than the rest of runtime logging, making log formatting and filtering inconsistent."
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
"findings": [
|
|
132
|
-
{
|
|
133
|
-
"dimension": "convention_outlier",
|
|
134
|
-
"identifier": "log_level_naming_mismatch",
|
|
135
|
-
"summary": "Log level naming is inconsistent (`warning` vs `warn`) across CLI and Logger APIs.",
|
|
136
|
-
"related_files": [
|
|
137
|
-
"src/logger.ts",
|
|
138
|
-
"src/cli-validators.ts",
|
|
139
|
-
"src/cli.ts"
|
|
140
|
-
],
|
|
141
|
-
"evidence": [
|
|
142
|
-
"`LEVEL_PRIORITY` defines `warning`, CLI validation only accepts `warning`, but Logger exposes `warn` and labels logs as `WARN` (src/logger.ts, src/cli-validators.ts).",
|
|
143
|
-
"CLI flag `--log-level` is the public surface; a user seeing `WARN` may reasonably try `warn`, which is rejected (src/cli.ts, src/cli-validators.ts)."
|
|
144
|
-
],
|
|
145
|
-
"suggestion": "Align on one string (`warn` or `warning`) and accept both in the validator to preserve compatibility; update logger constants and CLI help text accordingly.",
|
|
146
|
-
"confidence": "medium",
|
|
147
|
-
"impact_scope": "module",
|
|
148
|
-
"fix_scope": "multi_file_refactor"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"dimension": "convention_outlier",
|
|
152
|
-
"identifier": "mixed_sync_async_parsers",
|
|
153
|
-
"summary": "CLI validators mix async and sync parsing styles, creating an API shape outlier.",
|
|
154
|
-
"related_files": [
|
|
155
|
-
"src/cli-validators.ts",
|
|
156
|
-
"test/cli-validators.test.ts"
|
|
157
|
-
],
|
|
158
|
-
"evidence": [
|
|
159
|
-
"`parseHost` is async (DNS lookup) while `parsePort`, `parseLogLevel`, `parseChunkSize`, and `parseLatency` are sync, so consumers must treat the module inconsistently (src/cli-validators.ts).",
|
|
160
|
-
"Tests reflect the split by mixing `await expect(parseHost(...))` with sync expectations for other parsers (test/cli-validators.test.ts)."
|
|
161
|
-
],
|
|
162
|
-
"suggestion": "Normalize the validator interface: either make all parsers async (returning Promises) or provide a sync `parseHostSync` and move the async lookup to the CLI entrypoint.",
|
|
163
|
-
"confidence": "low",
|
|
164
|
-
"impact_scope": "module",
|
|
165
|
-
"fix_scope": "multi_file_refactor"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"dimension": "error_consistency",
|
|
169
|
-
"identifier": "reload_rules_clears_on_error",
|
|
170
|
-
"summary": "Rules reload clears existing rules before load, and on failure only logs, leaving a running server with no rules.",
|
|
171
|
-
"related_files": [
|
|
172
|
-
"src/cli.ts",
|
|
173
|
-
"src/logger.ts"
|
|
174
|
-
],
|
|
175
|
-
"evidence": [
|
|
176
|
-
"Watch reload path does `server.reset(); await server.load(rulesPath);` inside a try/catch and only logs on error (src/cli.ts).",
|
|
177
|
-
"If `server.load` throws, prior rules are already cleared and the server continues running with an empty rule set, with no rollback (src/cli.ts)."
|
|
178
|
-
],
|
|
179
|
-
"suggestion": "Load into a temporary ruleset or only call `reset()` after a successful load; on failure, preserve the previous rules and log the error with context.",
|
|
180
|
-
"confidence": "medium",
|
|
181
|
-
"impact_scope": "module",
|
|
182
|
-
"fix_scope": "multi_file_refactor"
|
|
183
|
-
}
|
|
184
|
-
],
|
|
185
|
-
"retrospective": {
|
|
186
|
-
"root_causes": [
|
|
187
|
-
"Public CLI surface does not have a single authoritative source for naming and error-handling conventions."
|
|
188
|
-
],
|
|
189
|
-
"likely_symptoms": [
|
|
190
|
-
"log_level_naming_mismatch",
|
|
191
|
-
"mixed_sync_async_parsers"
|
|
192
|
-
],
|
|
193
|
-
"possible_false_positives": []
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
STDERR:
|
|
199
|
-
OpenAI Codex v0.114.0 (research preview)
|
|
200
|
-
--------
|
|
201
|
-
workdir: /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server
|
|
202
|
-
model: gpt-5.2-codex
|
|
203
|
-
provider: openai
|
|
204
|
-
approval: never
|
|
205
|
-
sandbox: workspace-write [workdir, /tmp, $TMPDIR, /Users/suyash.x.srijan/.codex/memories]
|
|
206
|
-
reasoning effort: low
|
|
207
|
-
reasoning summaries: none
|
|
208
|
-
session id: 019cf2db-e22f-70c2-812a-9e7b3ba28433
|
|
209
|
-
--------
|
|
210
|
-
user
|
|
211
|
-
You are a focused subagent reviewer for a single holistic investigation batch.
|
|
212
|
-
|
|
213
|
-
Repository root: /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server
|
|
214
|
-
Blind packet: /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/.desloppify/review_packet_blind.json
|
|
215
|
-
Batch index: 2
|
|
216
|
-
Batch name: Conventions & Errors
|
|
217
|
-
Batch dimensions: convention_outlier, error_consistency, mid_level_elegance
|
|
218
|
-
Batch rationale: naming drift, behavioral outliers, mixed error strategies
|
|
219
|
-
|
|
220
|
-
Files assigned:
|
|
221
|
-
- src/cli.ts
|
|
222
|
-
- src/formats/anthropic/schema.ts
|
|
223
|
-
- src/formats/openai/schema.ts
|
|
224
|
-
- src/formats/responses/schema.ts
|
|
225
|
-
- src/logger.ts
|
|
226
|
-
- src/types.ts
|
|
227
|
-
- src/types/request.ts
|
|
228
|
-
- test/helpers/make-req.ts
|
|
229
|
-
- test/cli-validators.test.ts
|
|
230
|
-
- test/mock-server.test.ts
|
|
231
|
-
- test/rule-engine.test.ts
|
|
232
|
-
- src/cli-validators.ts
|
|
233
|
-
- src/history.ts
|
|
234
|
-
|
|
235
|
-
Task requirements:
|
|
236
|
-
1. Read the blind packet and follow `system_prompt` constraints exactly.
|
|
237
|
-
1a. If previously flagged issues are listed above, use them as context for your review.
|
|
238
|
-
Verify whether each still applies to the current code. Do not re-report fixed or
|
|
239
|
-
wontfix issues. Use them as starting points to look deeper — inspect adjacent code
|
|
240
|
-
and related modules for defects the prior review may have missed.
|
|
241
|
-
1c. Think structurally: when you spot multiple individual issues that share a common
|
|
242
|
-
root cause (missing abstraction, duplicated pattern, inconsistent convention),
|
|
243
|
-
explain the deeper structural issue in the finding, not just the surface symptom.
|
|
244
|
-
If the pattern is significant enough, report the structural issue as its own finding
|
|
245
|
-
with appropriate fix_scope ('multi_file_refactor' or 'architectural_change') and
|
|
246
|
-
use `root_cause_cluster` to connect related symptom findings together.
|
|
247
|
-
2. Evaluate ONLY listed files and ONLY listed dimensions for this batch.
|
|
248
|
-
3. Return 0-10 high-quality findings for this batch (empty array allowed).
|
|
249
|
-
3a. Do not suppress real defects to keep scores high; report every material issue you can support with evidence.
|
|
250
|
-
3b. Do not default to 100. Reserve 100 for genuinely exemplary evidence in this batch.
|
|
251
|
-
4. Score/finding consistency is required: broader or more severe findings MUST lower dimension scores.
|
|
252
|
-
4a. Any dimension scored below 85.0 MUST include explicit feedback: add at least one finding with the same `dimension` and a non-empty actionable `suggestion`.
|
|
253
|
-
5. Every finding must include `related_files` with at least 2 files when possible.
|
|
254
|
-
6. Every finding must include `dimension`, `identifier`, `summary`, `evidence`, `suggestion`, and `confidence`.
|
|
255
|
-
7. Every finding must include `impact_scope` and `fix_scope`.
|
|
256
|
-
8. Every scored dimension MUST include dimension_notes with concrete evidence.
|
|
257
|
-
9. If a dimension score is >85.0, include `issues_preventing_higher_score` in dimension_notes.
|
|
258
|
-
10. Use exactly one decimal place for every assessment and abstraction sub-axis score.
|
|
259
|
-
11. Ignore prior chat context and any target-threshold assumptions.
|
|
260
|
-
12. Do not edit repository files.
|
|
261
|
-
13. Return ONLY valid JSON, no markdown fences.
|
|
262
|
-
|
|
263
|
-
Scope enums:
|
|
264
|
-
- impact_scope: "local" | "module" | "subsystem" | "codebase"
|
|
265
|
-
- fix_scope: "single_edit" | "multi_file_refactor" | "architectural_change"
|
|
266
|
-
|
|
267
|
-
Output schema:
|
|
268
|
-
{
|
|
269
|
-
"batch": "Conventions & Errors",
|
|
270
|
-
"batch_index": 2,
|
|
271
|
-
"assessments": {"<dimension>": <0-100 with one decimal place>},
|
|
272
|
-
"dimension_notes": {
|
|
273
|
-
"<dimension>": {
|
|
274
|
-
"evidence": ["specific code observations"],
|
|
275
|
-
"impact_scope": "local|module|subsystem|codebase",
|
|
276
|
-
"fix_scope": "single_edit|multi_file_refactor|architectural_change",
|
|
277
|
-
"confidence": "high|medium|low",
|
|
278
|
-
"issues_preventing_higher_score": "required when score >85.0",
|
|
279
|
-
"sub_axes": {"abstraction_leverage": 0-100 with one decimal place, "indirection_cost": 0-100 with one decimal place, "interface_honesty": 0-100 with one decimal place} // required for abstraction_fitness when evidence supports it
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
"findings": [{
|
|
283
|
-
"dimension": "<dimension>",
|
|
284
|
-
"identifier": "short_id",
|
|
285
|
-
"summary": "one-line defect summary",
|
|
286
|
-
"related_files": ["relative/path.py"],
|
|
287
|
-
"evidence": ["specific code observation"],
|
|
288
|
-
"suggestion": "concrete fix recommendation",
|
|
289
|
-
"confidence": "high|medium|low",
|
|
290
|
-
"impact_scope": "local|module|subsystem|codebase",
|
|
291
|
-
"fix_scope": "single_edit|multi_file_refactor|architectural_change",
|
|
292
|
-
"root_cause_cluster": "optional_cluster_name_when_supported_by_history"
|
|
293
|
-
}],
|
|
294
|
-
"retrospective": {
|
|
295
|
-
"root_causes": ["optional: concise root-cause hypotheses"],
|
|
296
|
-
"likely_symptoms": ["optional: identifiers that look symptom-level"],
|
|
297
|
-
"possible_false_positives": ["optional: prior concept keys likely mis-scoped"]
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
mcp startup: no servers
|
|
302
|
-
|
|
303
|
-
thinking
|
|
304
|
-
**Clarifying command approach**
|
|
305
|
-
|
|
306
|
-
I'm planning to read a blind packet by executing a direct `cat` command to access its contents without additional parsing or skills.
|
|
307
|
-
exec
|
|
308
|
-
/bin/zsh -lc 'ls -la /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/.desloppify' in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
309
|
-
total 604
|
|
310
|
-
drwxr-xr-x 9 suyash.x.srijan staff 288 Mar 15 18:56 .
|
|
311
|
-
drwxr-xr-x 27 suyash.x.srijan staff 864 Mar 15 18:53 ..
|
|
312
|
-
drwxr-xr-x 4 suyash.x.srijan staff 128 Mar 15 04:55 external_review_sessions
|
|
313
|
-
-rw------- 1 suyash.x.srijan staff 62942 Mar 15 18:56 query.json
|
|
314
|
-
-rw------- 1 suyash.x.srijan staff 58880 Mar 15 18:56 review_packet_blind.json
|
|
315
|
-
drwxr-xr-x 6 suyash.x.srijan staff 192 Mar 15 18:56 review_packets
|
|
316
|
-
-rw------- 1 suyash.x.srijan staff 244772 Mar 15 18:53 state-typescript.json
|
|
317
|
-
-rw------- 1 suyash.x.srijan staff 244772 Mar 15 18:53 state-typescript.json.bak
|
|
318
|
-
drwxr-xr-x 3 suyash.x.srijan staff 96 Mar 15 18:54 subagents
|
|
319
|
-
exec
|
|
320
|
-
/bin/zsh -lc 'cat /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/.desloppify/review_packet_blind.json' in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
321
|
-
{
|
|
322
|
-
"command": "review",
|
|
323
|
-
"mode": "holistic",
|
|
324
|
-
"language": "typescript",
|
|
325
|
-
"dimensions": [
|
|
326
|
-
"cross_module_architecture",
|
|
327
|
-
"convention_outlier",
|
|
328
|
-
"error_consistency",
|
|
329
|
-
"abstraction_fitness",
|
|
330
|
-
"api_surface_coherence",
|
|
331
|
-
"authorization_consistency",
|
|
332
|
-
"ai_generated_debt",
|
|
333
|
-
"incomplete_migration",
|
|
334
|
-
"package_organization",
|
|
335
|
-
"high_level_elegance",
|
|
336
|
-
"mid_level_elegance",
|
|
337
|
-
"low_level_elegance",
|
|
338
|
-
"design_coherence"
|
|
339
|
-
],
|
|
340
|
-
"dimension_prompts": {
|
|
341
|
-
|
|
342
|
-
thinking
|
|
343
|
-
**Checking query.json contents**
|
|
344
|
-
|
|
345
|
-
I'm reading the contents of query.json to understand what queries or configurations it holds and how it might influence the next implementation steps.
|
|
346
|
-
exec
|
|
347
|
-
/bin/zsh -lc 'cat /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/.desloppify/query.json' in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
348
|
-
{
|
|
349
|
-
"command": "review",
|
|
350
|
-
"mode": "holistic",
|
|
351
|
-
"language": "typescript",
|
|
352
|
-
"dimensions": [
|
|
353
|
-
"cross_module_architecture",
|
|
354
|
-
"convention_outlier",
|
|
355
|
-
"error_consistency",
|
|
356
|
-
"abstraction_fitness",
|
|
357
|
-
"api_surface_coherence",
|
|
358
|
-
"authorization_consistency",
|
|
359
|
-
"ai_generated_debt",
|
|
360
|
-
"incomplete_migration",
|
|
361
|
-
"package_organization",
|
|
362
|
-
"high_level_elegance",
|
|
363
|
-
"mid_level_elegance",
|
|
364
|
-
"low_level_elegance",
|
|
365
|
-
"design_coherence"
|
|
366
|
-
],
|
|
367
|
-
"dimension_prompts": {
|
|
368
|
-
|
|
369
|
-
thinking
|
|
370
|
-
**Planning file reading approach**
|
|
371
|
-
|
|
372
|
-
I'm considering using sed with cat and rg for reading files, possibly combining multiple exec commands to handle this efficiently.
|
|
373
|
-
exec
|
|
374
|
-
/bin/zsh -lc "sed -n '1,220p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/cli.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
375
|
-
#!/usr/bin/env node
|
|
376
|
-
|
|
377
|
-
import { watch } from "node:fs";
|
|
378
|
-
import { createRequire } from "node:module";
|
|
379
|
-
import { Command } from "commander";
|
|
380
|
-
import pc from "picocolors";
|
|
381
|
-
import { MockServer } from "./mock-server.js";
|
|
382
|
-
import { Logger } from "./logger.js";
|
|
383
|
-
import {
|
|
384
|
-
parsePort,
|
|
385
|
-
parseHost,
|
|
386
|
-
parseLogLevel,
|
|
387
|
-
parseChunkSize,
|
|
388
|
-
parseLatency,
|
|
389
|
-
} from "./cli-validators.js";
|
|
390
|
-
|
|
391
|
-
const require = createRequire(import.meta.url);
|
|
392
|
-
const { version } = require("../package.json") as { version: string };
|
|
393
|
-
|
|
394
|
-
const WATCH_DEBOUNCE_MS = 100;
|
|
395
|
-
exec
|
|
396
|
-
/bin/zsh -lc "sed -n '1,220p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/cli-validators.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
397
|
-
import { isIP } from "node:net";
|
|
398
|
-
import { lookup } from "node:dns/promises";
|
|
399
|
-
import { LEVEL_PRIORITY, type LogLevel } from "./logger.js";
|
|
400
|
-
|
|
401
|
-
const VALID_LOG_LEVELS = Object.keys(LEVEL_PRIORITY) as LogLevel[];
|
|
402
|
-
|
|
403
|
-
function isLogLevel(value: string): value is LogLevel {
|
|
404
|
-
return value in LEVEL_PRIORITY;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
const MAX_PORT = 65535;
|
|
408
|
-
|
|
409
|
-
export function parsePort(value: string): number {
|
|
410
|
-
const port = parseInt(value, 10);
|
|
411
|
-
if (isNaN(port) || port < 1 || port > MAX_PORT) {
|
|
412
|
-
throw new Error(`Invalid port "${value}". Must be 1-${String(MAX_PORT)}.`);
|
|
413
|
-
}
|
|
414
|
-
return port;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
exec
|
|
418
|
-
/bin/zsh -lc "sed -n '1,240p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/formats/anthropic/schema.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
419
|
-
import { z } from "zod";
|
|
420
|
-
|
|
421
|
-
export {
|
|
422
|
-
AnthropicRequestSchema,
|
|
423
|
-
type AnthropicRequest,
|
|
424
|
-
} from "llm-schemas/anthropic";
|
|
425
|
-
|
|
426
|
-
const ResponseContentBlockSchema = z.object({
|
|
427
|
-
type: z.string(),
|
|
428
|
-
text: z.string().optional(),
|
|
429
|
-
thinking: z.string().optional(),
|
|
430
|
-
id: z.string().optional(),
|
|
431
|
-
name: z.string().optional(),
|
|
432
|
-
input: z.unknown().optional(),
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
export const AnthropicMessageStartSchema = z.object({
|
|
436
|
-
message: z.object({
|
|
437
|
-
id: z.string(),
|
|
438
|
-
type: z.literal("message"),
|
|
439
|
-
exec
|
|
440
|
-
/bin/zsh -lc "sed -n '1,260p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/formats/openai/schema.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
441
|
-
import { z } from "zod";
|
|
442
|
-
|
|
443
|
-
export {
|
|
444
|
-
OpenAIRequestSchema,
|
|
445
|
-
type OpenAIRequest,
|
|
446
|
-
} from "llm-schemas/openai/chat-completions";
|
|
447
|
-
|
|
448
|
-
const ToolCallResponseSchema = z.object({
|
|
449
|
-
id: z.string(),
|
|
450
|
-
type: z.string(),
|
|
451
|
-
function: z.object({ name: z.string(), arguments: z.string() }),
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
const UsageSchema = z.object({
|
|
455
|
-
prompt_tokens: z.number(),
|
|
456
|
-
completion_tokens: z.number(),
|
|
457
|
-
total_tokens: z.number(),
|
|
458
|
-
prompt_tokens_details: z
|
|
459
|
-
.object({
|
|
460
|
-
cached_tokens: z.number().optional(),
|
|
461
|
-
exec
|
|
462
|
-
/bin/zsh -lc "sed -n '1,260p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/formats/responses/schema.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
463
|
-
import { z } from "zod";
|
|
464
|
-
|
|
465
|
-
export {
|
|
466
|
-
ResponsesRequestSchema,
|
|
467
|
-
FunctionToolSchema,
|
|
468
|
-
type ResponsesRequest,
|
|
469
|
-
} from "llm-schemas/openai/responses";
|
|
470
|
-
|
|
471
|
-
const OutputContentSchema = z.object({
|
|
472
|
-
type: z.string(),
|
|
473
|
-
text: z.string(),
|
|
474
|
-
annotations: z.array(z.unknown()).optional(),
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
const OutputItemSchema = z.object({
|
|
478
|
-
type: z.string(),
|
|
479
|
-
id: z.string().optional(),
|
|
480
|
-
status: z.string().optional(),
|
|
481
|
-
role: z.string().optional(),
|
|
482
|
-
content: z.array(OutputContentSchema).optional(),
|
|
483
|
-
exec
|
|
484
|
-
/bin/zsh -lc "sed -n '1,260p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/logger.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 410ms:
|
|
485
|
-
import pc from "picocolors";
|
|
486
|
-
|
|
487
|
-
export const LEVEL_PRIORITY = {
|
|
488
|
-
none: 0,
|
|
489
|
-
error: 1,
|
|
490
|
-
warning: 2,
|
|
491
|
-
info: 3,
|
|
492
|
-
debug: 4,
|
|
493
|
-
all: 5,
|
|
494
|
-
} as const satisfies Record<string, number>;
|
|
495
|
-
|
|
496
|
-
/** Log verbosity, from `"none"` (silent) through to `"all"` (everything). */
|
|
497
|
-
export type LogLevel = keyof typeof LEVEL_PRIORITY;
|
|
498
|
-
|
|
499
|
-
const LEVEL_STYLE = {
|
|
500
|
-
error: { label: pc.red(pc.bold("ERROR")), symbol: pc.red("✗") },
|
|
501
|
-
warn: { label: pc.yellow(pc.bold("WARN")), symbol: pc.yellow("!") },
|
|
502
|
-
info: { label: pc.cyan("INFO"), symbol: pc.cyan("●") },
|
|
503
|
-
debug: { label: pc.dim("DEBUG"), symbol: pc.dim("·") },
|
|
504
|
-
} as const;
|
|
505
|
-
exec
|
|
506
|
-
/bin/zsh -lc "sed -n '1,200p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/types.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
507
|
-
export type {
|
|
508
|
-
FormatName,
|
|
509
|
-
MockRequest,
|
|
510
|
-
Message,
|
|
511
|
-
ToolDef,
|
|
512
|
-
} from "./types/request.js";
|
|
513
|
-
export type {
|
|
514
|
-
Reply,
|
|
515
|
-
ReplyObject,
|
|
516
|
-
ErrorReply,
|
|
517
|
-
ToolCall,
|
|
518
|
-
Resolver,
|
|
519
|
-
ReplyOptions,
|
|
520
|
-
SequenceEntry,
|
|
521
|
-
} from "./types/reply.js";
|
|
522
|
-
export type {
|
|
523
|
-
Match,
|
|
524
|
-
MatchObject,
|
|
525
|
-
PendingRule,
|
|
526
|
-
RuleHandle,
|
|
527
|
-
exec
|
|
528
|
-
/bin/zsh -lc "sed -n '1,260p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/types/request.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
529
|
-
/** The LLM API wire format that was detected for a request. */
|
|
530
|
-
export type FormatName = "openai" | "anthropic" | "responses";
|
|
531
|
-
|
|
532
|
-
/** A normalised view of an incoming request, regardless of the original wire format. */
|
|
533
|
-
export interface MockRequest {
|
|
534
|
-
readonly format: FormatName;
|
|
535
|
-
readonly model: string;
|
|
536
|
-
readonly streaming: boolean;
|
|
537
|
-
/** Full conversation, normalised from whatever format came in. */
|
|
538
|
-
readonly messages: readonly Message[];
|
|
539
|
-
/** The last user message's text. This is what most matchers check. */
|
|
540
|
-
readonly lastMessage: string;
|
|
541
|
-
/** Empty string if there wasn't one. */
|
|
542
|
-
readonly systemMessage: string;
|
|
543
|
-
readonly tools?: readonly ToolDef[] | undefined;
|
|
544
|
-
/** Pulled out from `tools` for quick lookups. */
|
|
545
|
-
readonly toolNames: readonly string[];
|
|
546
|
-
/** Set when the last message was a tool result. */
|
|
547
|
-
readonly lastToolCallId: string | undefined;
|
|
548
|
-
/** The raw request body, for anything we don't extract. */
|
|
549
|
-
exec
|
|
550
|
-
/bin/zsh -lc "sed -n '1,220p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/src/history.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
551
|
-
import type { MockRequest } from "./types.js";
|
|
552
|
-
|
|
553
|
-
/** A recorded request with the rule that matched and when it happened. */
|
|
554
|
-
export interface RecordedRequest {
|
|
555
|
-
readonly request: MockRequest;
|
|
556
|
-
/** The rule that matched, or `undefined` if the fallback was used. */
|
|
557
|
-
readonly rule: string | undefined;
|
|
558
|
-
readonly timestamp: number;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Records every request the server handles.
|
|
563
|
-
* Iterable and has fluent query methods for test assertions.
|
|
564
|
-
*
|
|
565
|
-
* @example
|
|
566
|
-
* ```ts
|
|
567
|
-
* expect(server.history.count()).toBe(3);
|
|
568
|
-
* expect(server.history.last()?.request.lastMessage).toBe("hello");
|
|
569
|
-
* const matched = server.history.where(r => r.rule !== undefined);
|
|
570
|
-
* ```
|
|
571
|
-
exec
|
|
572
|
-
/bin/zsh -lc "sed -n '1,220p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/test/helpers/make-req.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
573
|
-
import type { MockRequest } from "../../src/types.js";
|
|
574
|
-
|
|
575
|
-
export function makeReq(overrides: Partial<MockRequest> = {}): MockRequest {
|
|
576
|
-
return {
|
|
577
|
-
format: "openai",
|
|
578
|
-
model: "gpt-5.4",
|
|
579
|
-
streaming: true,
|
|
580
|
-
messages: [{ role: "user", content: "hello" }],
|
|
581
|
-
lastMessage: "hello",
|
|
582
|
-
systemMessage: "",
|
|
583
|
-
toolNames: [],
|
|
584
|
-
lastToolCallId: undefined,
|
|
585
|
-
raw: {},
|
|
586
|
-
headers: {},
|
|
587
|
-
path: "/v1/chat/completions",
|
|
588
|
-
...overrides,
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
exec
|
|
592
|
-
/bin/zsh -lc "sed -n '1,240p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/test/cli-validators.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
593
|
-
import { describe, it, expect } from "vitest";
|
|
594
|
-
import {
|
|
595
|
-
parsePort,
|
|
596
|
-
parseHost,
|
|
597
|
-
parseChunkSize,
|
|
598
|
-
parseLogLevel,
|
|
599
|
-
parseLatency,
|
|
600
|
-
} from "../src/cli-validators.js";
|
|
601
|
-
|
|
602
|
-
describe("parsePort", () => {
|
|
603
|
-
it("parses a valid port", () => {
|
|
604
|
-
expect(parsePort("5555")).toBe(5555);
|
|
605
|
-
});
|
|
606
|
-
|
|
607
|
-
it("accepts port 1", () => {
|
|
608
|
-
expect(parsePort("1")).toBe(1);
|
|
609
|
-
});
|
|
610
|
-
|
|
611
|
-
it("accepts port 65535", () => {
|
|
612
|
-
expect(parsePort("65535")).toBe(65535);
|
|
613
|
-
exec
|
|
614
|
-
/bin/zsh -lc "sed -n '1,260p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/test/mock-server.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
615
|
-
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
616
|
-
import { createMock, MockServer } from "../src/index.js";
|
|
617
|
-
|
|
618
|
-
interface OpenAIResponse {
|
|
619
|
-
choices: {
|
|
620
|
-
message: { role: string; content: string };
|
|
621
|
-
finish_reason: string;
|
|
622
|
-
}[];
|
|
623
|
-
error?: { type: string; message: string };
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
interface AnthropicResponse {
|
|
627
|
-
content: { type: string; text?: string; thinking?: string }[];
|
|
628
|
-
error?: { type: string; message: string };
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
interface ResponsesAPIResponse {
|
|
632
|
-
output: { type: string; content: { type: string; text: string }[] }[];
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
exec
|
|
636
|
-
/bin/zsh -lc "sed -n '260,520p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/test/mock-server.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
637
|
-
messages: [{ role: "user", content: "hello" }],
|
|
638
|
-
stream: false,
|
|
639
|
-
}),
|
|
640
|
-
});
|
|
641
|
-
|
|
642
|
-
expect(await res.json()).toMatchObject({
|
|
643
|
-
choices: [{ message: { content: "Alpha team!" } }],
|
|
644
|
-
});
|
|
645
|
-
});
|
|
646
|
-
});
|
|
647
|
-
|
|
648
|
-
describe("rules", () => {
|
|
649
|
-
it("returns summaries of registered rules", () => {
|
|
650
|
-
server.when("hello").reply("Hi!");
|
|
651
|
-
server.when(/bye/i).reply("Goodbye!").times(3);
|
|
652
|
-
|
|
653
|
-
expect(server.rules).toEqual([
|
|
654
|
-
{ description: '"hello"', remaining: Infinity },
|
|
655
|
-
{ description: "/bye/i", remaining: 3 },
|
|
656
|
-
]);
|
|
657
|
-
exec
|
|
658
|
-
/bin/zsh -lc "sed -n '520,1040p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/test/mock-server.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
659
|
-
describe(".first()", () => {
|
|
660
|
-
it("moves a rule to the front of the match list", async () => {
|
|
661
|
-
server.when("hello").reply("First rule");
|
|
662
|
-
server.when("hello").reply("Second rule").first();
|
|
663
|
-
|
|
664
|
-
const json = await postOpenAI("hello");
|
|
665
|
-
expect(json.choices[0]!.message.content).toBe("Second rule");
|
|
666
|
-
});
|
|
667
|
-
});
|
|
668
|
-
|
|
669
|
-
describe(".times() chaining", () => {
|
|
670
|
-
it("returns RuleHandle for chaining with .first()", async () => {
|
|
671
|
-
server.when("hello").reply("Normal");
|
|
672
|
-
server.when("hello").reply("Priority one-shot").times(1).first();
|
|
673
|
-
server.fallback("Fallback.");
|
|
674
|
-
|
|
675
|
-
const j1 = await postOpenAI("hello");
|
|
676
|
-
expect(j1.choices[0]!.message.content).toBe("Priority one-shot");
|
|
677
|
-
|
|
678
|
-
const j2 = await postOpenAI("hello");
|
|
679
|
-
exec
|
|
680
|
-
/bin/zsh -lc "sed -n '1,220p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/test/rule-engine.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
681
|
-
import { describe, it, expect, beforeEach } from "vitest";
|
|
682
|
-
import { RuleEngine } from "../src/rule-engine.js";
|
|
683
|
-
import { makeReq } from "./helpers/make-req.js";
|
|
684
|
-
|
|
685
|
-
describe("RuleEngine", () => {
|
|
686
|
-
let engine: RuleEngine;
|
|
687
|
-
|
|
688
|
-
beforeEach(() => {
|
|
689
|
-
engine = new RuleEngine();
|
|
690
|
-
});
|
|
691
|
-
|
|
692
|
-
it("matches a string (substring, case-insensitive)", () => {
|
|
693
|
-
engine.add("hello", "Hi!");
|
|
694
|
-
const rule = engine.match(makeReq({ lastMessage: "say Hello world" }));
|
|
695
|
-
if (!rule) throw new Error("expected match");
|
|
696
|
-
expect(rule.description).toBe('"hello"');
|
|
697
|
-
});
|
|
698
|
-
|
|
699
|
-
it("matches a regex", () => {
|
|
700
|
-
engine.add(/explain (\w+)/i, "Here is an explanation.");
|
|
701
|
-
exec
|
|
702
|
-
/bin/zsh -lc "sed -n '220,520p' /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/test/rule-engine.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
703
|
-
});
|
|
704
|
-
|
|
705
|
-
it("strips g flag from regex inside a MatchObject", () => {
|
|
706
|
-
engine.add({ message: /hello/gi }, "Hi!");
|
|
707
|
-
expect(engine.match(makeReq())).toBeDefined();
|
|
708
|
-
expect(engine.match(makeReq())).toBeDefined();
|
|
709
|
-
expect(engine.match(makeReq())).toBeDefined();
|
|
710
|
-
});
|
|
711
|
-
});
|
|
712
|
-
});
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
thinking
|
|
716
|
-
**Identifying log level naming inconsistency**
|
|
717
|
-
|
|
718
|
-
There’s a naming mismatch between "warning" and "warn" across log level configs and methods, indicating convention drift that may need alignment. Also, error handling varies across CLI validators, with some errors caught and logged silently while others propagate, suggesting inconsistency in error flow management.
|
|
719
|
-
thinking
|
|
720
|
-
**Summarizing convention and error handling findings**
|
|
721
|
-
|
|
722
|
-
Found multiple convention outliers: log level naming mismatch ("warning" vs. "warn") across logger and CLI, and inconsistent async patterns with parseHost versus other parsers. Also found error consistency issue in watch reload swallowing errors after resetting rules, risking silent server state loss. Mid-level design shows some logging bypass and mixed sync/async seams but no strong defects.
|
|
723
|
-
codex
|
|
724
|
-
{
|
|
725
|
-
"batch": "Conventions & Errors",
|
|
726
|
-
"batch_index": 2,
|
|
727
|
-
"assessments": {
|
|
728
|
-
"convention_outlier": 86.0,
|
|
729
|
-
"error_consistency": 84.0,
|
|
730
|
-
"mid_level_elegance": 90.0
|
|
731
|
-
},
|
|
732
|
-
"dimension_notes": {
|
|
733
|
-
"convention_outlier": {
|
|
734
|
-
"evidence": [
|
|
735
|
-
"Log level naming diverges: `LEVEL_PRIORITY` exposes `warning` while the logger API uses `warn`, and CLI validation only accepts `warning` (src/logger.ts, src/cli-validators.ts, src/cli.ts).",
|
|
736
|
-
"Validator API mixes sync and async parsing in the same module: `parseHost` is async while other `parse*` helpers are sync, making call sites and tests use different interaction patterns (src/cli-validators.ts, test/cli-validators.test.ts)."
|
|
737
|
-
],
|
|
738
|
-
"impact_scope": "module",
|
|
739
|
-
"fix_scope": "multi_file_refactor",
|
|
740
|
-
"confidence": "medium",
|
|
741
|
-
"issues_preventing_higher_score": "Conventions around log-level naming and validator async/sync shape are inconsistent within the CLI surface."
|
|
742
|
-
},
|
|
743
|
-
"error_consistency": {
|
|
744
|
-
"evidence": [
|
|
745
|
-
"Rules reload path resets server state before load and then only logs on failure, leaving the server running with cleared rules if reload fails (src/cli.ts, src/logger.ts)."
|
|
746
|
-
],
|
|
747
|
-
"impact_scope": "module",
|
|
748
|
-
"fix_scope": "multi_file_refactor",
|
|
749
|
-
"confidence": "medium"
|
|
750
|
-
},
|
|
751
|
-
"mid_level_elegance": {
|
|
752
|
-
"evidence": [
|
|
753
|
-
"CLI start-up output bypasses the Logger and writes directly to `console.log`, while runtime events use Logger formatting and filtering (src/cli.ts, src/logger.ts)."
|
|
754
|
-
],
|
|
755
|
-
"impact_scope": "module",
|
|
756
|
-
"fix_scope": "single_edit",
|
|
757
|
-
"confidence": "low",
|
|
758
|
-
"issues_preventing_higher_score": "Startup logging is routed through a different seam than the rest of runtime logging, making log formatting and filtering inconsistent."
|
|
759
|
-
}
|
|
760
|
-
},
|
|
761
|
-
"findings": [
|
|
762
|
-
{
|
|
763
|
-
"dimension": "convention_outlier",
|
|
764
|
-
"identifier": "log_level_naming_mismatch",
|
|
765
|
-
"summary": "Log level naming is inconsistent (`warning` vs `warn`) across CLI and Logger APIs.",
|
|
766
|
-
"related_files": [
|
|
767
|
-
"src/logger.ts",
|
|
768
|
-
"src/cli-validators.ts",
|
|
769
|
-
"src/cli.ts"
|
|
770
|
-
],
|
|
771
|
-
"evidence": [
|
|
772
|
-
"`LEVEL_PRIORITY` defines `warning`, CLI validation only accepts `warning`, but Logger exposes `warn` and labels logs as `WARN` (src/logger.ts, src/cli-validators.ts).",
|
|
773
|
-
"CLI flag `--log-level` is the public surface; a user seeing `WARN` may reasonably try `warn`, which is rejected (src/cli.ts, src/cli-validators.ts)."
|
|
774
|
-
],
|
|
775
|
-
"suggestion": "Align on one string (`warn` or `warning`) and accept both in the validator to preserve compatibility; update logger constants and CLI help text accordingly.",
|
|
776
|
-
"confidence": "medium",
|
|
777
|
-
"impact_scope": "module",
|
|
778
|
-
"fix_scope": "multi_file_refactor"
|
|
779
|
-
},
|
|
780
|
-
{
|
|
781
|
-
"dimension": "convention_outlier",
|
|
782
|
-
"identifier": "mixed_sync_async_parsers",
|
|
783
|
-
"summary": "CLI validators mix async and sync parsing styles, creating an API shape outlier.",
|
|
784
|
-
"related_files": [
|
|
785
|
-
"src/cli-validators.ts",
|
|
786
|
-
"test/cli-validators.test.ts"
|
|
787
|
-
],
|
|
788
|
-
"evidence": [
|
|
789
|
-
"`parseHost` is async (DNS lookup) while `parsePort`, `parseLogLevel`, `parseChunkSize`, and `parseLatency` are sync, so consumers must treat the module inconsistently (src/cli-validators.ts).",
|
|
790
|
-
"Tests reflect the split by mixing `await expect(parseHost(...))` with sync expectations for other parsers (test/cli-validators.test.ts)."
|
|
791
|
-
],
|
|
792
|
-
"suggestion": "Normalize the validator interface: either make all parsers async (returning Promises) or provide a sync `parseHostSync` and move the async lookup to the CLI entrypoint.",
|
|
793
|
-
"confidence": "low",
|
|
794
|
-
"impact_scope": "module",
|
|
795
|
-
"fix_scope": "multi_file_refactor"
|
|
796
|
-
},
|
|
797
|
-
{
|
|
798
|
-
"dimension": "error_consistency",
|
|
799
|
-
"identifier": "reload_rules_clears_on_error",
|
|
800
|
-
"summary": "Rules reload clears existing rules before load, and on failure only logs, leaving a running server with no rules.",
|
|
801
|
-
"related_files": [
|
|
802
|
-
"src/cli.ts",
|
|
803
|
-
"src/logger.ts"
|
|
804
|
-
],
|
|
805
|
-
"evidence": [
|
|
806
|
-
"Watch reload path does `server.reset(); await server.load(rulesPath);` inside a try/catch and only logs on error (src/cli.ts).",
|
|
807
|
-
"If `server.load` throws, prior rules are already cleared and the server continues running with an empty rule set, with no rollback (src/cli.ts)."
|
|
808
|
-
],
|
|
809
|
-
"suggestion": "Load into a temporary ruleset or only call `reset()` after a successful load; on failure, preserve the previous rules and log the error with context.",
|
|
810
|
-
"confidence": "medium",
|
|
811
|
-
"impact_scope": "module",
|
|
812
|
-
"fix_scope": "multi_file_refactor"
|
|
813
|
-
}
|
|
814
|
-
],
|
|
815
|
-
"retrospective": {
|
|
816
|
-
"root_causes": [
|
|
817
|
-
"Public CLI surface does not have a single authoritative source for naming and error-handling conventions."
|
|
818
|
-
],
|
|
819
|
-
"likely_symptoms": [
|
|
820
|
-
"log_level_naming_mismatch",
|
|
821
|
-
"mixed_sync_async_parsers"
|
|
822
|
-
],
|
|
823
|
-
"possible_false_positives": []
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
tokens used
|
|
828
|
-
49,661
|
|
829
|
-
|