llm-mock-server 1.0.6 → 1.0.7
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/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,730 +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-7.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: 7
|
|
7
|
-
Batch name: Package Organization
|
|
8
|
-
Batch dimensions: package_organization, high_level_elegance
|
|
9
|
-
Batch rationale: file placement, directory boundaries, architectural layering
|
|
10
|
-
|
|
11
|
-
Files assigned:
|
|
12
|
-
- vitest.config.ts
|
|
13
|
-
- src/cli-validators.ts
|
|
14
|
-
- src/cli.ts
|
|
15
|
-
- src/history.ts
|
|
16
|
-
- test/cli-validators.test.ts
|
|
17
|
-
- test/history.test.ts
|
|
18
|
-
- test/loader.test.ts
|
|
19
|
-
- src/formats/anthropic/index.ts
|
|
20
|
-
- src/formats/anthropic/parse.ts
|
|
21
|
-
- src/formats/anthropic/schema.ts
|
|
22
|
-
- src/formats/request-helpers.ts
|
|
23
|
-
- src/formats/serialize-helpers.ts
|
|
24
|
-
- src/formats/openai/index.ts
|
|
25
|
-
- src/formats/openai/parse.ts
|
|
26
|
-
- src/formats/responses/index.ts
|
|
27
|
-
- src/formats/responses/parse.ts
|
|
28
|
-
|
|
29
|
-
Task requirements:
|
|
30
|
-
1. Read the blind packet and follow `system_prompt` constraints exactly.
|
|
31
|
-
1a. If previously flagged issues are listed above, use them as context for your review.
|
|
32
|
-
Verify whether each still applies to the current code. Do not re-report fixed or
|
|
33
|
-
wontfix issues. Use them as starting points to look deeper — inspect adjacent code
|
|
34
|
-
and related modules for defects the prior review may have missed.
|
|
35
|
-
1c. Think structurally: when you spot multiple individual issues that share a common
|
|
36
|
-
root cause (missing abstraction, duplicated pattern, inconsistent convention),
|
|
37
|
-
explain the deeper structural issue in the finding, not just the surface symptom.
|
|
38
|
-
If the pattern is significant enough, report the structural issue as its own finding
|
|
39
|
-
with appropriate fix_scope ('multi_file_refactor' or 'architectural_change') and
|
|
40
|
-
use `root_cause_cluster` to connect related symptom findings together.
|
|
41
|
-
2. Evaluate ONLY listed files and ONLY listed dimensions for this batch.
|
|
42
|
-
3. Return 0-10 high-quality findings for this batch (empty array allowed).
|
|
43
|
-
3a. Do not suppress real defects to keep scores high; report every material issue you can support with evidence.
|
|
44
|
-
3b. Do not default to 100. Reserve 100 for genuinely exemplary evidence in this batch.
|
|
45
|
-
4. Score/finding consistency is required: broader or more severe findings MUST lower dimension scores.
|
|
46
|
-
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`.
|
|
47
|
-
5. Every finding must include `related_files` with at least 2 files when possible.
|
|
48
|
-
6. Every finding must include `dimension`, `identifier`, `summary`, `evidence`, `suggestion`, and `confidence`.
|
|
49
|
-
7. Every finding must include `impact_scope` and `fix_scope`.
|
|
50
|
-
8. Every scored dimension MUST include dimension_notes with concrete evidence.
|
|
51
|
-
9. If a dimension score is >85.0, include `issues_preventing_higher_score` in dimension_notes.
|
|
52
|
-
10. Use exactly one decimal place for every assessment and abstraction sub-axis score.
|
|
53
|
-
9a. For package_organization, ground scoring in objective structure signals from `holistic_context.structure` (root_files fan_in/fan_out roles, directory_profiles, coupling_matrix). Prefer thresholded evidence (for example: fan_in < 5 for root stragglers, import-affinity > 60%, directories > 10 files with mixed concerns).
|
|
54
|
-
9b. Suggestions must include a staged reorg plan (target folders, move order, and import-update/validation commands).
|
|
55
|
-
11. Ignore prior chat context and any target-threshold assumptions.
|
|
56
|
-
12. Do not edit repository files.
|
|
57
|
-
13. Return ONLY valid JSON, no markdown fences.
|
|
58
|
-
|
|
59
|
-
Scope enums:
|
|
60
|
-
- impact_scope: "local" | "module" | "subsystem" | "codebase"
|
|
61
|
-
- fix_scope: "single_edit" | "multi_file_refactor" | "architectural_change"
|
|
62
|
-
|
|
63
|
-
Output schema:
|
|
64
|
-
{
|
|
65
|
-
"batch": "Package Organization",
|
|
66
|
-
"batch_index": 7,
|
|
67
|
-
"assessments": {"<dimension>": <0-100 with one decimal place>},
|
|
68
|
-
"dimension_notes": {
|
|
69
|
-
"<dimension>": {
|
|
70
|
-
"evidence": ["specific code observations"],
|
|
71
|
-
"impact_scope": "local|module|subsystem|codebase",
|
|
72
|
-
"fix_scope": "single_edit|multi_file_refactor|architectural_change",
|
|
73
|
-
"confidence": "high|medium|low",
|
|
74
|
-
"issues_preventing_higher_score": "required when score >85.0",
|
|
75
|
-
"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
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
"findings": [{
|
|
79
|
-
"dimension": "<dimension>",
|
|
80
|
-
"identifier": "short_id",
|
|
81
|
-
"summary": "one-line defect summary",
|
|
82
|
-
"related_files": ["relative/path.py"],
|
|
83
|
-
"evidence": ["specific code observation"],
|
|
84
|
-
"suggestion": "concrete fix recommendation",
|
|
85
|
-
"confidence": "high|medium|low",
|
|
86
|
-
"impact_scope": "local|module|subsystem|codebase",
|
|
87
|
-
"fix_scope": "single_edit|multi_file_refactor|architectural_change",
|
|
88
|
-
"root_cause_cluster": "optional_cluster_name_when_supported_by_history"
|
|
89
|
-
}],
|
|
90
|
-
"retrospective": {
|
|
91
|
-
"root_causes": ["optional: concise root-cause hypotheses"],
|
|
92
|
-
"likely_symptoms": ["optional: identifiers that look symptom-level"],
|
|
93
|
-
"possible_false_positives": ["optional: prior concept keys likely mis-scoped"]
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
STDOUT:
|
|
99
|
-
{"batch":"Package Organization","batch_index":7,"assessments":{"package_organization":80.0,"high_level_elegance":83.0},"dimension_notes":{"package_organization":{"evidence":["holistic_context.structure.directory_profiles shows `src/` has `file_count: 11` with mixed concerns (cli, server/runtime, history, loader, logger, rule-engine).","holistic_context.structure.coupling_matrix shows bidirectional edges `src/ → src/formats/` (3) and `src/formats/ → src/` (3), indicating a blurred boundary between core runtime and format-specific code."],"impact_scope":"subsystem","fix_scope":"multi_file_refactor","confidence":"high"},"high_level_elegance":{"evidence":["Top-level `src/` bundles CLI entry (`cli.ts`), CLI validators (`cli-validators.ts`), and runtime/state (`history.ts`) in a single flat folder, making ownership boundaries non-obvious for newcomers.","Format-specific areas are cleanly grouped under `src/formats/*`, but core runtime files remain flat, which weakens the overall domain-aligned decomposition."],"impact_scope":"subsystem","fix_scope":"multi_file_refactor","confidence":"medium"}},"findings":[{"dimension":"package_organization","identifier":"flat_src_root_mixed_concerns","summary":"`src/` is a flat folder with mixed CLI/runtime/history concerns, obscuring ownership boundaries.","related_files":["src/cli.ts","src/history.ts","src/cli-validators.ts"],"evidence":["`holistic_context.structure.directory_profiles` lists 11 files in `src/` spanning CLI (`cli.ts`), history/state (`history.ts`), and core runtime (`mock-server.ts`, `rule-engine.ts`).","`holistic_context.structure.coupling_matrix` shows `src/ ↔ src/formats/` bidirectional imports, which is a typical signal of missing subpackage boundaries."],"suggestion":"Staged reorg plan: 1) Create `src/cli/` and `src/server/` folders. 2) Move CLI files first: `src/cli.ts` → `src/cli/index.ts`, `src/cli-validators.ts` → `src/cli/validators.ts`. 3) Move runtime/state next: `src/history.ts` → `src/server/history.ts` (and later other runtime files like `mock-server.ts`, `rule-engine.ts` if desired). 4) Update import paths using `rg \"./cli-validators|./history\" src test` and edit imports to new locations. 5) Validate with `npm test` (vitest) and, if available, `npm run build` to ensure path resolution is correct.","confidence":"high","impact_scope":"subsystem","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"},{"dimension":"package_organization","identifier":"cli_validators_not_colocated","summary":"CLI-only validators live at `src/` root despite being used only by the CLI entrypoint.","related_files":["src/cli.ts","src/cli-validators.ts","test/cli-validators.test.ts"],"evidence":["`src/cli-validators.ts` is imported only by `src/cli.ts` and its dedicated test (`test/cli-validators.test.ts`).","No other modules consume `cli-validators.ts`, indicating it belongs inside a CLI-focused subpackage rather than the root."],"suggestion":"Staged reorg plan: 1) Create `src/cli/`. 2) Move `src/cli-validators.ts` → `src/cli/validators.ts`. 3) Update `src/cli.ts` to import from `./cli/validators.js` (or `./cli/validators.js` after moving `cli.ts` as part of a broader CLI folder move). 4) Update `test/cli-validators.test.ts` to import from `../src/cli/validators.js`. 5) Validate with `npm test` to ensure CLI parsing tests still pass.","confidence":"high","impact_scope":"module","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"},{"dimension":"high_level_elegance","identifier":"ownership_boundaries_blurred_by_root_layout","summary":"Top-level decomposition mixes CLI and runtime concerns, weakening domain-aligned ownership.","related_files":["src/cli.ts","src/history.ts"],"evidence":["CLI entry (`src/cli.ts`) and runtime/state (`src/history.ts`) sit side-by-side at the root, making the top-level package map less expressive than the format-specific subfolders under `src/formats/*`.","The flat root layout requires readers to scan files to infer domains instead of discovering boundaries through folder structure."],"suggestion":"Staged reorg plan: 1) Introduce explicit domain folders such as `src/cli/` and `src/runtime/` (or `src/server/`). 2) Move `src/cli.ts` (and `src/cli-validators.ts`) into `src/cli/` first, then move `src/history.ts` into `src/runtime/` alongside related runtime modules. 3) Update imports via `rg \"\\./cli|\\./history\" src test` and edit to new paths. 4) Validate with `npm test` and, if applicable, `npm run build` to confirm the public entrypoints still resolve correctly.","confidence":"medium","impact_scope":"subsystem","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"}],"retrospective":{"root_causes":["Flat `src/` root mixes multiple domains without subpackages, reducing navigability and ownership clarity."],"likely_symptoms":["cli_validators_not_colocated"],"possible_false_positives":[]}}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
STDERR:
|
|
103
|
-
OpenAI Codex v0.114.0 (research preview)
|
|
104
|
-
--------
|
|
105
|
-
workdir: /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server
|
|
106
|
-
model: gpt-5.2-codex
|
|
107
|
-
provider: openai
|
|
108
|
-
approval: never
|
|
109
|
-
sandbox: workspace-write [workdir, /tmp, $TMPDIR, /Users/suyash.x.srijan/.codex/memories]
|
|
110
|
-
reasoning effort: low
|
|
111
|
-
reasoning summaries: none
|
|
112
|
-
session id: 019cf2e1-a1ef-7f73-8929-8e27fff89196
|
|
113
|
-
--------
|
|
114
|
-
user
|
|
115
|
-
You are a focused subagent reviewer for a single holistic investigation batch.
|
|
116
|
-
|
|
117
|
-
Repository root: /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server
|
|
118
|
-
Blind packet: /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server/.desloppify/review_packet_blind.json
|
|
119
|
-
Batch index: 7
|
|
120
|
-
Batch name: Package Organization
|
|
121
|
-
Batch dimensions: package_organization, high_level_elegance
|
|
122
|
-
Batch rationale: file placement, directory boundaries, architectural layering
|
|
123
|
-
|
|
124
|
-
Files assigned:
|
|
125
|
-
- vitest.config.ts
|
|
126
|
-
- src/cli-validators.ts
|
|
127
|
-
- src/cli.ts
|
|
128
|
-
- src/history.ts
|
|
129
|
-
- test/cli-validators.test.ts
|
|
130
|
-
- test/history.test.ts
|
|
131
|
-
- test/loader.test.ts
|
|
132
|
-
- src/formats/anthropic/index.ts
|
|
133
|
-
- src/formats/anthropic/parse.ts
|
|
134
|
-
- src/formats/anthropic/schema.ts
|
|
135
|
-
- src/formats/request-helpers.ts
|
|
136
|
-
- src/formats/serialize-helpers.ts
|
|
137
|
-
- src/formats/openai/index.ts
|
|
138
|
-
- src/formats/openai/parse.ts
|
|
139
|
-
- src/formats/responses/index.ts
|
|
140
|
-
- src/formats/responses/parse.ts
|
|
141
|
-
|
|
142
|
-
Task requirements:
|
|
143
|
-
1. Read the blind packet and follow `system_prompt` constraints exactly.
|
|
144
|
-
1a. If previously flagged issues are listed above, use them as context for your review.
|
|
145
|
-
Verify whether each still applies to the current code. Do not re-report fixed or
|
|
146
|
-
wontfix issues. Use them as starting points to look deeper — inspect adjacent code
|
|
147
|
-
and related modules for defects the prior review may have missed.
|
|
148
|
-
1c. Think structurally: when you spot multiple individual issues that share a common
|
|
149
|
-
root cause (missing abstraction, duplicated pattern, inconsistent convention),
|
|
150
|
-
explain the deeper structural issue in the finding, not just the surface symptom.
|
|
151
|
-
If the pattern is significant enough, report the structural issue as its own finding
|
|
152
|
-
with appropriate fix_scope ('multi_file_refactor' or 'architectural_change') and
|
|
153
|
-
use `root_cause_cluster` to connect related symptom findings together.
|
|
154
|
-
2. Evaluate ONLY listed files and ONLY listed dimensions for this batch.
|
|
155
|
-
3. Return 0-10 high-quality findings for this batch (empty array allowed).
|
|
156
|
-
3a. Do not suppress real defects to keep scores high; report every material issue you can support with evidence.
|
|
157
|
-
3b. Do not default to 100. Reserve 100 for genuinely exemplary evidence in this batch.
|
|
158
|
-
4. Score/finding consistency is required: broader or more severe findings MUST lower dimension scores.
|
|
159
|
-
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`.
|
|
160
|
-
5. Every finding must include `related_files` with at least 2 files when possible.
|
|
161
|
-
6. Every finding must include `dimension`, `identifier`, `summary`, `evidence`, `suggestion`, and `confidence`.
|
|
162
|
-
7. Every finding must include `impact_scope` and `fix_scope`.
|
|
163
|
-
8. Every scored dimension MUST include dimension_notes with concrete evidence.
|
|
164
|
-
9. If a dimension score is >85.0, include `issues_preventing_higher_score` in dimension_notes.
|
|
165
|
-
10. Use exactly one decimal place for every assessment and abstraction sub-axis score.
|
|
166
|
-
9a. For package_organization, ground scoring in objective structure signals from `holistic_context.structure` (root_files fan_in/fan_out roles, directory_profiles, coupling_matrix). Prefer thresholded evidence (for example: fan_in < 5 for root stragglers, import-affinity > 60%, directories > 10 files with mixed concerns).
|
|
167
|
-
9b. Suggestions must include a staged reorg plan (target folders, move order, and import-update/validation commands).
|
|
168
|
-
11. Ignore prior chat context and any target-threshold assumptions.
|
|
169
|
-
12. Do not edit repository files.
|
|
170
|
-
13. Return ONLY valid JSON, no markdown fences.
|
|
171
|
-
|
|
172
|
-
Scope enums:
|
|
173
|
-
- impact_scope: "local" | "module" | "subsystem" | "codebase"
|
|
174
|
-
- fix_scope: "single_edit" | "multi_file_refactor" | "architectural_change"
|
|
175
|
-
|
|
176
|
-
Output schema:
|
|
177
|
-
{
|
|
178
|
-
"batch": "Package Organization",
|
|
179
|
-
"batch_index": 7,
|
|
180
|
-
"assessments": {"<dimension>": <0-100 with one decimal place>},
|
|
181
|
-
"dimension_notes": {
|
|
182
|
-
"<dimension>": {
|
|
183
|
-
"evidence": ["specific code observations"],
|
|
184
|
-
"impact_scope": "local|module|subsystem|codebase",
|
|
185
|
-
"fix_scope": "single_edit|multi_file_refactor|architectural_change",
|
|
186
|
-
"confidence": "high|medium|low",
|
|
187
|
-
"issues_preventing_higher_score": "required when score >85.0",
|
|
188
|
-
"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
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
"findings": [{
|
|
192
|
-
"dimension": "<dimension>",
|
|
193
|
-
"identifier": "short_id",
|
|
194
|
-
"summary": "one-line defect summary",
|
|
195
|
-
"related_files": ["relative/path.py"],
|
|
196
|
-
"evidence": ["specific code observation"],
|
|
197
|
-
"suggestion": "concrete fix recommendation",
|
|
198
|
-
"confidence": "high|medium|low",
|
|
199
|
-
"impact_scope": "local|module|subsystem|codebase",
|
|
200
|
-
"fix_scope": "single_edit|multi_file_refactor|architectural_change",
|
|
201
|
-
"root_cause_cluster": "optional_cluster_name_when_supported_by_history"
|
|
202
|
-
}],
|
|
203
|
-
"retrospective": {
|
|
204
|
-
"root_causes": ["optional: concise root-cause hypotheses"],
|
|
205
|
-
"likely_symptoms": ["optional: identifiers that look symptom-level"],
|
|
206
|
-
"possible_false_positives": ["optional: prior concept keys likely mis-scoped"]
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
mcp startup: no servers
|
|
211
|
-
exec
|
|
212
|
-
/bin/zsh -lc ls in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
213
|
-
LICENCE
|
|
214
|
-
README.md
|
|
215
|
-
coverage
|
|
216
|
-
dist
|
|
217
|
-
docs
|
|
218
|
-
node_modules
|
|
219
|
-
package-lock.json
|
|
220
|
-
package.json
|
|
221
|
-
scorecard.png
|
|
222
|
-
src
|
|
223
|
-
test
|
|
224
|
-
tsconfig.json
|
|
225
|
-
tsconfig.test.json
|
|
226
|
-
vitest.config.ts
|
|
227
|
-
exec
|
|
228
|
-
/bin/zsh -lc 'cat .desloppify/review_packet_blind.json' in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
229
|
-
{
|
|
230
|
-
"command": "review",
|
|
231
|
-
"mode": "holistic",
|
|
232
|
-
"language": "typescript",
|
|
233
|
-
"dimensions": [
|
|
234
|
-
"cross_module_architecture",
|
|
235
|
-
"convention_outlier",
|
|
236
|
-
"error_consistency",
|
|
237
|
-
"abstraction_fitness",
|
|
238
|
-
"api_surface_coherence",
|
|
239
|
-
"authorization_consistency",
|
|
240
|
-
"ai_generated_debt",
|
|
241
|
-
"incomplete_migration",
|
|
242
|
-
"package_organization",
|
|
243
|
-
"high_level_elegance",
|
|
244
|
-
"mid_level_elegance",
|
|
245
|
-
"low_level_elegance",
|
|
246
|
-
"design_coherence"
|
|
247
|
-
],
|
|
248
|
-
"dimension_prompts": {
|
|
249
|
-
|
|
250
|
-
thinking
|
|
251
|
-
**Preparing to review key files**
|
|
252
|
-
exec
|
|
253
|
-
/bin/zsh -lc "sed -n '1,240p' src/cli.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
254
|
-
#!/usr/bin/env node
|
|
255
|
-
|
|
256
|
-
import { watch } from "node:fs";
|
|
257
|
-
import { createRequire } from "node:module";
|
|
258
|
-
import { Command } from "commander";
|
|
259
|
-
import pc from "picocolors";
|
|
260
|
-
import { MockServer } from "./mock-server.js";
|
|
261
|
-
import { Logger } from "./logger.js";
|
|
262
|
-
import {
|
|
263
|
-
parsePort,
|
|
264
|
-
parseHost,
|
|
265
|
-
parseLogLevel,
|
|
266
|
-
parseChunkSize,
|
|
267
|
-
parseLatency,
|
|
268
|
-
} from "./cli-validators.js";
|
|
269
|
-
|
|
270
|
-
const require = createRequire(import.meta.url);
|
|
271
|
-
const { version } = require("../package.json") as { version: string };
|
|
272
|
-
|
|
273
|
-
const WATCH_DEBOUNCE_MS = 100;
|
|
274
|
-
exec
|
|
275
|
-
/bin/zsh -lc "sed -n '1,260p' src/history.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
276
|
-
import type { MockRequest } from "./types.js";
|
|
277
|
-
|
|
278
|
-
/** A recorded request with the rule that matched and when it happened. */
|
|
279
|
-
export interface RecordedRequest {
|
|
280
|
-
readonly request: MockRequest;
|
|
281
|
-
/** The rule that matched, or `undefined` if the fallback was used. */
|
|
282
|
-
readonly rule: string | undefined;
|
|
283
|
-
readonly timestamp: number;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Records every request the server handles.
|
|
288
|
-
* Iterable and has fluent query methods for test assertions.
|
|
289
|
-
*
|
|
290
|
-
* @example
|
|
291
|
-
* ```ts
|
|
292
|
-
* expect(server.history.count()).toBe(3);
|
|
293
|
-
* expect(server.history.last()?.request.lastMessage).toBe("hello");
|
|
294
|
-
* const matched = server.history.where(r => r.rule !== undefined);
|
|
295
|
-
* ```
|
|
296
|
-
exec
|
|
297
|
-
/bin/zsh -lc "sed -n '1,240p' vitest.config.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
298
|
-
import { defineConfig } from "vitest/config";
|
|
299
|
-
|
|
300
|
-
export default defineConfig({
|
|
301
|
-
test: {
|
|
302
|
-
globals: true,
|
|
303
|
-
testTimeout: 10_000,
|
|
304
|
-
coverage: {
|
|
305
|
-
provider: "v8",
|
|
306
|
-
include: ["src/**/*.ts"],
|
|
307
|
-
exclude: [
|
|
308
|
-
"src/cli.ts",
|
|
309
|
-
"src/types.ts",
|
|
310
|
-
"src/types/**",
|
|
311
|
-
"src/formats/types.ts",
|
|
312
|
-
],
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
|
-
});
|
|
316
|
-
exec
|
|
317
|
-
/bin/zsh -lc "sed -n '1,260p' src/cli-validators.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
318
|
-
import { isIP } from "node:net";
|
|
319
|
-
import { lookup } from "node:dns/promises";
|
|
320
|
-
import { LEVEL_PRIORITY, type LogLevel } from "./logger.js";
|
|
321
|
-
|
|
322
|
-
const VALID_LOG_LEVELS = Object.keys(LEVEL_PRIORITY) as LogLevel[];
|
|
323
|
-
|
|
324
|
-
function isLogLevel(value: string): value is LogLevel {
|
|
325
|
-
return value in LEVEL_PRIORITY;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const MAX_PORT = 65535;
|
|
329
|
-
|
|
330
|
-
export function parsePort(value: string): number {
|
|
331
|
-
const port = parseInt(value, 10);
|
|
332
|
-
if (isNaN(port) || port < 1 || port > MAX_PORT) {
|
|
333
|
-
throw new Error(`Invalid port "${value}". Must be 1-${String(MAX_PORT)}.`);
|
|
334
|
-
}
|
|
335
|
-
return port;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
exec
|
|
339
|
-
/bin/zsh -lc "sed -n '1,260p' src/formats/serialize-helpers.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
340
|
-
import type { ReplyObject } from "../types.js";
|
|
341
|
-
|
|
342
|
-
export const MS_PER_SECOND = 1000;
|
|
343
|
-
const BASE_36 = 36;
|
|
344
|
-
export const DEFAULT_USAGE = { input: 10, output: 5 } as const;
|
|
345
|
-
|
|
346
|
-
export function splitText(text: string, chunkSize: number): string[] {
|
|
347
|
-
if (chunkSize <= 0 || text.length <= chunkSize) return [text];
|
|
348
|
-
const chunks: string[] = [];
|
|
349
|
-
for (let i = 0; i < text.length; i += chunkSize) {
|
|
350
|
-
chunks.push(text.slice(i, i + chunkSize));
|
|
351
|
-
}
|
|
352
|
-
return chunks;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
export function genId(prefix: string): string {
|
|
356
|
-
return `${prefix}_${Date.now().toString(BASE_36)}`;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
export function toolId(
|
|
360
|
-
exec
|
|
361
|
-
/bin/zsh -lc "sed -n '1,260p' src/formats/anthropic/index.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
362
|
-
import type { Format } from "../types.js";
|
|
363
|
-
import { isStreaming } from "../request-helpers.js";
|
|
364
|
-
import { parseRequest } from "./parse.js";
|
|
365
|
-
import { serialize, serializeComplete, serializeError } from "./serialize.js";
|
|
366
|
-
|
|
367
|
-
export const anthropicFormat: Format = {
|
|
368
|
-
name: "anthropic",
|
|
369
|
-
route: "/v1/messages",
|
|
370
|
-
parseRequest,
|
|
371
|
-
isStreaming,
|
|
372
|
-
serialize,
|
|
373
|
-
serializeComplete,
|
|
374
|
-
serializeError,
|
|
375
|
-
};
|
|
376
|
-
exec
|
|
377
|
-
/bin/zsh -lc "sed -n '1,260p' src/formats/request-helpers.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
378
|
-
import type { FormatName, Message, MockRequest, ToolDef } from "../types.js";
|
|
379
|
-
|
|
380
|
-
function asRecord(body: unknown): Record<string, unknown> {
|
|
381
|
-
if (typeof body === "object" && body !== null)
|
|
382
|
-
return body as Record<string, unknown>;
|
|
383
|
-
return {};
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
export function isStreaming(body: unknown): boolean {
|
|
387
|
-
return asRecord(body)["stream"] !== false;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
export interface RequestMeta {
|
|
391
|
-
readonly headers: Readonly<Record<string, string | undefined>>;
|
|
392
|
-
readonly path: string;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
const EMPTY_META: RequestMeta = { headers: {}, path: "" };
|
|
396
|
-
|
|
397
|
-
interface ParsedBody {
|
|
398
|
-
exec
|
|
399
|
-
/bin/zsh -lc "sed -n '1,260p' src/formats/anthropic/parse.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
400
|
-
import type { MockRequest, Message, ToolDef } from "../../types.js";
|
|
401
|
-
import { buildMockRequest, type RequestMeta } from "../request-helpers.js";
|
|
402
|
-
import { AnthropicRequestSchema, type AnthropicRequest } from "./schema.js";
|
|
403
|
-
|
|
404
|
-
function extractSystem(system: AnthropicRequest["system"]): Message[] {
|
|
405
|
-
if (system == null) return [];
|
|
406
|
-
if (typeof system === "string")
|
|
407
|
-
return system ? [{ role: "system", content: system }] : [];
|
|
408
|
-
const text = system.map((b) => b.text).join("\n");
|
|
409
|
-
return text ? [{ role: "system", content: text }] : [];
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
function extractContent(
|
|
413
|
-
content: AnthropicRequest["messages"][number]["content"],
|
|
414
|
-
): {
|
|
415
|
-
content: string;
|
|
416
|
-
toolCallId?: string | undefined;
|
|
417
|
-
} {
|
|
418
|
-
if (typeof content === "string") return { content };
|
|
419
|
-
const text = content
|
|
420
|
-
|
|
421
|
-
thinking
|
|
422
|
-
**Identifying need for anthropic schema**
|
|
423
|
-
exec
|
|
424
|
-
/bin/zsh -lc "sed -n '1,260p' src/formats/anthropic/schema.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
425
|
-
import { z } from "zod";
|
|
426
|
-
|
|
427
|
-
export {
|
|
428
|
-
AnthropicRequestSchema,
|
|
429
|
-
type AnthropicRequest,
|
|
430
|
-
} from "llm-schemas/anthropic";
|
|
431
|
-
|
|
432
|
-
const ResponseContentBlockSchema = z.object({
|
|
433
|
-
type: z.string(),
|
|
434
|
-
text: z.string().optional(),
|
|
435
|
-
thinking: z.string().optional(),
|
|
436
|
-
id: z.string().optional(),
|
|
437
|
-
name: z.string().optional(),
|
|
438
|
-
input: z.unknown().optional(),
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
export const AnthropicMessageStartSchema = z.object({
|
|
442
|
-
message: z.object({
|
|
443
|
-
id: z.string(),
|
|
444
|
-
type: z.literal("message"),
|
|
445
|
-
|
|
446
|
-
thinking
|
|
447
|
-
**Identifying needed files**
|
|
448
|
-
|
|
449
|
-
The next step is to locate the OpenAI integration and response-handling files to proceed.
|
|
450
|
-
exec
|
|
451
|
-
/bin/zsh -lc "sed -n '1,220p' src/formats/openai/index.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
452
|
-
import type { Format } from "../types.js";
|
|
453
|
-
import { isStreaming } from "../request-helpers.js";
|
|
454
|
-
import { parseRequest } from "./parse.js";
|
|
455
|
-
import { serialize, serializeComplete, serializeError } from "./serialize.js";
|
|
456
|
-
|
|
457
|
-
export const openaiFormat: Format = {
|
|
458
|
-
name: "openai",
|
|
459
|
-
route: "/v1/chat/completions",
|
|
460
|
-
parseRequest,
|
|
461
|
-
isStreaming,
|
|
462
|
-
serialize,
|
|
463
|
-
serializeComplete,
|
|
464
|
-
serializeError,
|
|
465
|
-
};
|
|
466
|
-
exec
|
|
467
|
-
/bin/zsh -lc "sed -n '1,260p' src/formats/openai/parse.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
468
|
-
import type { MockRequest, Message, ToolDef } from "../../types.js";
|
|
469
|
-
import { buildMockRequest, type RequestMeta } from "../request-helpers.js";
|
|
470
|
-
import { OpenAIRequestSchema, type OpenAIRequest } from "./schema.js";
|
|
471
|
-
|
|
472
|
-
function extractContent(
|
|
473
|
-
content: OpenAIRequest["messages"][number]["content"],
|
|
474
|
-
): string {
|
|
475
|
-
if (content == null) return "";
|
|
476
|
-
if (typeof content === "string") return content;
|
|
477
|
-
return content
|
|
478
|
-
.filter((p) => p.type === "text" && p.text !== undefined)
|
|
479
|
-
.map((p) => p.text!)
|
|
480
|
-
.join("\n");
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
function parseMessages(req: OpenAIRequest): readonly Message[] {
|
|
484
|
-
return req.messages.map((m) => ({
|
|
485
|
-
role: m.role === "developer" ? "system" : (m.role ?? "user"),
|
|
486
|
-
content: extractContent(m.content),
|
|
487
|
-
...(m.tool_call_id !== undefined && { toolCallId: m.tool_call_id }),
|
|
488
|
-
exec
|
|
489
|
-
/bin/zsh -lc "sed -n '1,220p' src/formats/responses/index.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
490
|
-
import type { Format } from "../types.js";
|
|
491
|
-
import { isStreaming } from "../request-helpers.js";
|
|
492
|
-
import { parseRequest } from "./parse.js";
|
|
493
|
-
import { serialize, serializeComplete, serializeError } from "./serialize.js";
|
|
494
|
-
|
|
495
|
-
export const responsesFormat: Format = {
|
|
496
|
-
name: "responses",
|
|
497
|
-
route: "/v1/responses",
|
|
498
|
-
parseRequest,
|
|
499
|
-
isStreaming,
|
|
500
|
-
serialize,
|
|
501
|
-
serializeComplete,
|
|
502
|
-
serializeError,
|
|
503
|
-
};
|
|
504
|
-
exec
|
|
505
|
-
/bin/zsh -lc "sed -n '1,260p' src/formats/responses/parse.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
506
|
-
import type { MockRequest, Message, ToolDef } from "../../types.js";
|
|
507
|
-
import { buildMockRequest, type RequestMeta } from "../request-helpers.js";
|
|
508
|
-
import {
|
|
509
|
-
ResponsesRequestSchema,
|
|
510
|
-
FunctionToolSchema,
|
|
511
|
-
type ResponsesRequest,
|
|
512
|
-
} from "./schema.js";
|
|
513
|
-
|
|
514
|
-
function extractInputContent(
|
|
515
|
-
content: string | Record<string, unknown>[],
|
|
516
|
-
): string {
|
|
517
|
-
if (typeof content === "string") return content;
|
|
518
|
-
return content
|
|
519
|
-
.filter((b) => b["type"] === "input_text" || b["type"] === "text")
|
|
520
|
-
.map((b) => String(b["text"] ?? ""))
|
|
521
|
-
.join("\n");
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
function parseInput(req: ResponsesRequest): readonly Message[] {
|
|
525
|
-
const instructions: Message[] = req.instructions
|
|
526
|
-
|
|
527
|
-
thinking
|
|
528
|
-
**Noting missing tests**
|
|
529
|
-
exec
|
|
530
|
-
/bin/zsh -lc "sed -n '1,220p' test/cli-validators.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
531
|
-
import { describe, it, expect } from "vitest";
|
|
532
|
-
import {
|
|
533
|
-
parsePort,
|
|
534
|
-
parseHost,
|
|
535
|
-
parseChunkSize,
|
|
536
|
-
parseLogLevel,
|
|
537
|
-
parseLatency,
|
|
538
|
-
} from "../src/cli-validators.js";
|
|
539
|
-
|
|
540
|
-
describe("parsePort", () => {
|
|
541
|
-
it("parses a valid port", () => {
|
|
542
|
-
expect(parsePort("5555")).toBe(5555);
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
it("accepts port 1", () => {
|
|
546
|
-
expect(parsePort("1")).toBe(1);
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
it("accepts port 65535", () => {
|
|
550
|
-
expect(parsePort("65535")).toBe(65535);
|
|
551
|
-
exec
|
|
552
|
-
/bin/zsh -lc "sed -n '1,260p' test/history.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
553
|
-
import { describe, it, expect, beforeEach } from "vitest";
|
|
554
|
-
import { RequestHistory, type RecordedRequest } from "../src/history.js";
|
|
555
|
-
import { makeReq } from "./helpers/make-req.js";
|
|
556
|
-
|
|
557
|
-
describe("RequestHistory", () => {
|
|
558
|
-
let history: RequestHistory;
|
|
559
|
-
|
|
560
|
-
beforeEach(() => {
|
|
561
|
-
history = new RequestHistory();
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
describe("record()", () => {
|
|
565
|
-
it("adds an entry", () => {
|
|
566
|
-
history.record(makeReq(), "rule-1");
|
|
567
|
-
expect(history.count()).toBe(1);
|
|
568
|
-
});
|
|
569
|
-
|
|
570
|
-
it("adds multiple entries in order", () => {
|
|
571
|
-
history.record(makeReq({ lastMessage: "first" }), "r1");
|
|
572
|
-
history.record(makeReq({ lastMessage: "second" }), "r2");
|
|
573
|
-
exec
|
|
574
|
-
/bin/zsh -lc "sed -n '1,260p' test/loader.test.ts" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
575
|
-
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
576
|
-
import { writeFile, mkdir, rm } from "node:fs/promises";
|
|
577
|
-
import { join } from "node:path";
|
|
578
|
-
import { RuleEngine } from "../src/rule-engine.js";
|
|
579
|
-
import { loadRulesFromPath } from "../src/loader.js";
|
|
580
|
-
import type { MockRequest } from "../src/types.js";
|
|
581
|
-
import { makeReq } from "./helpers/make-req.js";
|
|
582
|
-
|
|
583
|
-
const tmpDir = join(import.meta.dirname, ".tmp-loader-test");
|
|
584
|
-
|
|
585
|
-
describe("Loader", () => {
|
|
586
|
-
let engine: RuleEngine;
|
|
587
|
-
|
|
588
|
-
beforeEach(async () => {
|
|
589
|
-
engine = new RuleEngine();
|
|
590
|
-
await mkdir(tmpDir, { recursive: true });
|
|
591
|
-
});
|
|
592
|
-
|
|
593
|
-
afterEach(async () => {
|
|
594
|
-
await rm(tmpDir, { recursive: true, force: true });
|
|
595
|
-
|
|
596
|
-
thinking
|
|
597
|
-
**Planning package reorganization using holistic context**
|
|
598
|
-
|
|
599
|
-
I'm deciding to organize formats by subfolders with shared helpers alongside, keeping CLI and history at root. To confirm package structure and placement, I'll extract and analyze the holistic_context.structure data from the packet JSON using jq.
|
|
600
|
-
exec
|
|
601
|
-
/bin/zsh -lc "python - <<'PY'
|
|
602
|
-
import json
|
|
603
|
-
with open('.desloppify/review_packet_blind.json') as f:
|
|
604
|
-
data=json.load(f)
|
|
605
|
-
struct=data.get('holistic_context',{}).get('structure',{})
|
|
606
|
-
print(struct.keys())
|
|
607
|
-
PY" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server exited 127 in 0ms:
|
|
608
|
-
zsh:1: command not found: python
|
|
609
|
-
|
|
610
|
-
thinking
|
|
611
|
-
**Confirming non-Python approach**
|
|
612
|
-
exec
|
|
613
|
-
/bin/zsh -lc "jq '.holistic_context.structure | keys' .desloppify/review_packet_blind.json" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
614
|
-
[
|
|
615
|
-
"coupling_matrix",
|
|
616
|
-
"directory_profiles",
|
|
617
|
-
"root_files"
|
|
618
|
-
]
|
|
619
|
-
|
|
620
|
-
thinking
|
|
621
|
-
**Planning JSON extraction**
|
|
622
|
-
|
|
623
|
-
I'm considering using jq to extract the root_files entries to get relevant file values for processing.
|
|
624
|
-
exec
|
|
625
|
-
/bin/zsh -lc "jq '.holistic_context.structure.root_files' .desloppify/review_packet_blind.json" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
626
|
-
[
|
|
627
|
-
{
|
|
628
|
-
"file": "vitest.config.ts",
|
|
629
|
-
"loc": 18,
|
|
630
|
-
"fan_in": 0,
|
|
631
|
-
"fan_out": 0,
|
|
632
|
-
"role": "peripheral"
|
|
633
|
-
}
|
|
634
|
-
]
|
|
635
|
-
|
|
636
|
-
thinking
|
|
637
|
-
**Identifying key config and data files**
|
|
638
|
-
|
|
639
|
-
Noticed only vitest.config.ts in the root, so next is extracting directory profiles and coupling matrix from src/formats as planned.
|
|
640
|
-
exec
|
|
641
|
-
/bin/zsh -lc "jq '.holistic_context.structure.directory_profiles' .desloppify/review_packet_blind.json" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
642
|
-
{
|
|
643
|
-
"src/": {
|
|
644
|
-
"file_count": 11,
|
|
645
|
-
"files": [
|
|
646
|
-
"cli-validators.ts",
|
|
647
|
-
"cli.ts",
|
|
648
|
-
"history.ts",
|
|
649
|
-
"index.ts",
|
|
650
|
-
"loader.ts",
|
|
651
|
-
"logger.ts",
|
|
652
|
-
"mock-server.ts",
|
|
653
|
-
"route-handler.ts",
|
|
654
|
-
"rule-engine.ts",
|
|
655
|
-
"sse-writer.ts",
|
|
656
|
-
"types.ts"
|
|
657
|
-
],
|
|
658
|
-
"total_loc": 1273,
|
|
659
|
-
"avg_fan_in": 3.8,
|
|
660
|
-
"avg_fan_out": 2.9,
|
|
661
|
-
"zones": {
|
|
662
|
-
|
|
663
|
-
thinking
|
|
664
|
-
**Identifying need for coupling matrix**
|
|
665
|
-
exec
|
|
666
|
-
/bin/zsh -lc "jq '.holistic_context.structure.coupling_matrix' .desloppify/review_packet_blind.json" in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
667
|
-
{
|
|
668
|
-
"test/ → src/": 8,
|
|
669
|
-
"src/formats/anthropic/ → src/formats/": 5,
|
|
670
|
-
"src/formats/openai/ → src/formats/": 5,
|
|
671
|
-
"src/formats/responses/ → src/formats/": 5,
|
|
672
|
-
"src/ → src/formats/": 3,
|
|
673
|
-
"src/ → src/types/": 3,
|
|
674
|
-
"src/formats/ → src/": 3,
|
|
675
|
-
"test/ → test/helpers/": 3,
|
|
676
|
-
"src/formats/anthropic/ → src/": 2,
|
|
677
|
-
"src/formats/openai/ → src/": 2,
|
|
678
|
-
"src/formats/responses/ → src/": 2,
|
|
679
|
-
"test/formats/ → src/formats/anthropic/": 2,
|
|
680
|
-
"test/formats/ → src/formats/openai/": 2,
|
|
681
|
-
"test/formats/ → src/formats/": 2,
|
|
682
|
-
"test/formats/ → src/formats/responses/": 2,
|
|
683
|
-
"src/ → src/formats/responses/": 1,
|
|
684
|
-
"src/ → src/formats/openai/": 1,
|
|
685
|
-
"src/ → src/formats/anthropic/": 1,
|
|
686
|
-
"test/formats/ → src/": 1
|
|
687
|
-
|
|
688
|
-
thinking
|
|
689
|
-
**Analyzing package coupling for helper placement**
|
|
690
|
-
|
|
691
|
-
I've identified reciprocal imports between core src/ and src/formats, suggesting tight coupling; I'm investigating request-helper usage with searches to determine if format helpers should move for clearer package boundaries.
|
|
692
|
-
exec
|
|
693
|
-
/bin/zsh -lc 'rg "request-helpers" -n src test' in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 335ms:
|
|
694
|
-
test/formats/parse-helpers.test.ts:14:} from "../../src/formats/request-helpers.js";
|
|
695
|
-
src/formats/responses/index.ts:2:import { isStreaming } from "../request-helpers.js";
|
|
696
|
-
src/formats/openai/parse.ts:2:import { buildMockRequest, type RequestMeta } from "../request-helpers.js";
|
|
697
|
-
src/formats/types.ts:7:import type { RequestMeta } from "./request-helpers.js";
|
|
698
|
-
src/formats/responses/parse.ts:2:import { buildMockRequest, type RequestMeta } from "../request-helpers.js";
|
|
699
|
-
src/formats/anthropic/index.ts:2:import { isStreaming } from "../request-helpers.js";
|
|
700
|
-
src/formats/openai/index.ts:2:import { isStreaming } from "../request-helpers.js";
|
|
701
|
-
src/formats/anthropic/parse.ts:2:import { buildMockRequest, type RequestMeta } from "../request-helpers.js";
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
thinking
|
|
705
|
-
**Analyzing package organization and coupling**
|
|
706
|
-
|
|
707
|
-
I'm noting bidirectional dependencies between src/formats and src/ root due to shared helpers and types, which creates unclear boundaries but might be acceptable given the small project size and usage patterns. Next, I'll consider import evidence to confirm if CLI-specific files should be relocated for clearer package structure.
|
|
708
|
-
thinking
|
|
709
|
-
**Considering restructuring shared types and CLI validators**
|
|
710
|
-
|
|
711
|
-
I'm evaluating moving shared types to a dedicated folder to reduce circular dependencies and relocating CLI validators from the root to src/cli for clearer organization, based on their limited usage; I'll verify import patterns to support these changes and adjust package organization scores accordingly.
|
|
712
|
-
exec
|
|
713
|
-
/bin/zsh -lc 'rg "cli-validators" -n src test' in /Users/suyash.x.srijan/Documents/Personal_Projects/llm-mock-server succeeded in 0ms:
|
|
714
|
-
src/cli.ts:15:} from "./cli-validators.js";
|
|
715
|
-
test/cli-validators.test.ts:8:} from "../src/cli-validators.js";
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
thinking
|
|
719
|
-
**Identifying mixed concerns in src directory**
|
|
720
|
-
|
|
721
|
-
The src directory has over 10 files mixing CLI, server, rules, and formats, indicating a flat structure with mixed concerns; reorganizing into subfolders like cli/, server/, and rules/ will improve clarity and ownership.
|
|
722
|
-
thinking
|
|
723
|
-
**Refining package organization and elegance findings**
|
|
724
|
-
|
|
725
|
-
I'm detailing two package organization findings about the flat src/ and CLI validator placement, plus one high-level elegance finding on blurred ownership due to mixed src/ structure; each will include evidence, root cause cluster, and a staged reorg plan with folder targets, move order, and import-update/test commands.
|
|
726
|
-
codex
|
|
727
|
-
{"batch":"Package Organization","batch_index":7,"assessments":{"package_organization":80.0,"high_level_elegance":83.0},"dimension_notes":{"package_organization":{"evidence":["holistic_context.structure.directory_profiles shows `src/` has `file_count: 11` with mixed concerns (cli, server/runtime, history, loader, logger, rule-engine).","holistic_context.structure.coupling_matrix shows bidirectional edges `src/ → src/formats/` (3) and `src/formats/ → src/` (3), indicating a blurred boundary between core runtime and format-specific code."],"impact_scope":"subsystem","fix_scope":"multi_file_refactor","confidence":"high"},"high_level_elegance":{"evidence":["Top-level `src/` bundles CLI entry (`cli.ts`), CLI validators (`cli-validators.ts`), and runtime/state (`history.ts`) in a single flat folder, making ownership boundaries non-obvious for newcomers.","Format-specific areas are cleanly grouped under `src/formats/*`, but core runtime files remain flat, which weakens the overall domain-aligned decomposition."],"impact_scope":"subsystem","fix_scope":"multi_file_refactor","confidence":"medium"}},"findings":[{"dimension":"package_organization","identifier":"flat_src_root_mixed_concerns","summary":"`src/` is a flat folder with mixed CLI/runtime/history concerns, obscuring ownership boundaries.","related_files":["src/cli.ts","src/history.ts","src/cli-validators.ts"],"evidence":["`holistic_context.structure.directory_profiles` lists 11 files in `src/` spanning CLI (`cli.ts`), history/state (`history.ts`), and core runtime (`mock-server.ts`, `rule-engine.ts`).","`holistic_context.structure.coupling_matrix` shows `src/ ↔ src/formats/` bidirectional imports, which is a typical signal of missing subpackage boundaries."],"suggestion":"Staged reorg plan: 1) Create `src/cli/` and `src/server/` folders. 2) Move CLI files first: `src/cli.ts` → `src/cli/index.ts`, `src/cli-validators.ts` → `src/cli/validators.ts`. 3) Move runtime/state next: `src/history.ts` → `src/server/history.ts` (and later other runtime files like `mock-server.ts`, `rule-engine.ts` if desired). 4) Update import paths using `rg \"./cli-validators|./history\" src test` and edit imports to new locations. 5) Validate with `npm test` (vitest) and, if available, `npm run build` to ensure path resolution is correct.","confidence":"high","impact_scope":"subsystem","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"},{"dimension":"package_organization","identifier":"cli_validators_not_colocated","summary":"CLI-only validators live at `src/` root despite being used only by the CLI entrypoint.","related_files":["src/cli.ts","src/cli-validators.ts","test/cli-validators.test.ts"],"evidence":["`src/cli-validators.ts` is imported only by `src/cli.ts` and its dedicated test (`test/cli-validators.test.ts`).","No other modules consume `cli-validators.ts`, indicating it belongs inside a CLI-focused subpackage rather than the root."],"suggestion":"Staged reorg plan: 1) Create `src/cli/`. 2) Move `src/cli-validators.ts` → `src/cli/validators.ts`. 3) Update `src/cli.ts` to import from `./cli/validators.js` (or `./cli/validators.js` after moving `cli.ts` as part of a broader CLI folder move). 4) Update `test/cli-validators.test.ts` to import from `../src/cli/validators.js`. 5) Validate with `npm test` to ensure CLI parsing tests still pass.","confidence":"high","impact_scope":"module","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"},{"dimension":"high_level_elegance","identifier":"ownership_boundaries_blurred_by_root_layout","summary":"Top-level decomposition mixes CLI and runtime concerns, weakening domain-aligned ownership.","related_files":["src/cli.ts","src/history.ts"],"evidence":["CLI entry (`src/cli.ts`) and runtime/state (`src/history.ts`) sit side-by-side at the root, making the top-level package map less expressive than the format-specific subfolders under `src/formats/*`.","The flat root layout requires readers to scan files to infer domains instead of discovering boundaries through folder structure."],"suggestion":"Staged reorg plan: 1) Introduce explicit domain folders such as `src/cli/` and `src/runtime/` (or `src/server/`). 2) Move `src/cli.ts` (and `src/cli-validators.ts`) into `src/cli/` first, then move `src/history.ts` into `src/runtime/` alongside related runtime modules. 3) Update imports via `rg \"\\./cli|\\./history\" src test` and edit to new paths. 4) Validate with `npm test` and, if applicable, `npm run build` to confirm the public entrypoints still resolve correctly.","confidence":"medium","impact_scope":"subsystem","fix_scope":"multi_file_refactor","root_cause_cluster":"flat_src_root"}],"retrospective":{"root_causes":["Flat `src/` root mixes multiple domains without subpackages, reducing navigability and ownership clarity."],"likely_symptoms":["cli_validators_not_colocated"],"possible_false_positives":[]}}
|
|
728
|
-
tokens used
|
|
729
|
-
39,904
|
|
730
|
-
|