pm-orchestrator-runner 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +108 -0
  3. package/dist/cli/cli-interface.d.ts +150 -0
  4. package/dist/cli/cli-interface.d.ts.map +1 -0
  5. package/dist/cli/cli-interface.js +606 -0
  6. package/dist/cli/cli-interface.js.map +1 -0
  7. package/dist/cli/index.d.ts +13 -0
  8. package/dist/cli/index.d.ts.map +1 -0
  9. package/dist/cli/index.js +243 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/cli/llm-sentinel.d.ts +15 -0
  12. package/dist/cli/llm-sentinel.d.ts.map +1 -0
  13. package/dist/cli/llm-sentinel.js +184 -0
  14. package/dist/cli/llm-sentinel.js.map +1 -0
  15. package/dist/config/configuration-manager.d.ts +149 -0
  16. package/dist/config/configuration-manager.d.ts.map +1 -0
  17. package/dist/config/configuration-manager.js +241 -0
  18. package/dist/config/configuration-manager.js.map +1 -0
  19. package/dist/continuation/continuation-control-manager.d.ts +154 -0
  20. package/dist/continuation/continuation-control-manager.d.ts.map +1 -0
  21. package/dist/continuation/continuation-control-manager.js +303 -0
  22. package/dist/continuation/continuation-control-manager.js.map +1 -0
  23. package/dist/core/runner-core.d.ts +474 -0
  24. package/dist/core/runner-core.d.ts.map +1 -0
  25. package/dist/core/runner-core.js +1311 -0
  26. package/dist/core/runner-core.js.map +1 -0
  27. package/dist/errors/error-codes.d.ts +105 -0
  28. package/dist/errors/error-codes.d.ts.map +1 -0
  29. package/dist/errors/error-codes.js +198 -0
  30. package/dist/errors/error-codes.js.map +1 -0
  31. package/dist/errors/runner-error.d.ts +14 -0
  32. package/dist/errors/runner-error.d.ts.map +1 -0
  33. package/dist/errors/runner-error.js +33 -0
  34. package/dist/errors/runner-error.js.map +1 -0
  35. package/dist/evidence/evidence-manager.d.ts +112 -0
  36. package/dist/evidence/evidence-manager.d.ts.map +1 -0
  37. package/dist/evidence/evidence-manager.js +337 -0
  38. package/dist/evidence/evidence-manager.js.map +1 -0
  39. package/dist/executor/claude-code-executor.d.ts +136 -0
  40. package/dist/executor/claude-code-executor.d.ts.map +1 -0
  41. package/dist/executor/claude-code-executor.js +643 -0
  42. package/dist/executor/claude-code-executor.js.map +1 -0
  43. package/dist/executor/deterministic-executor.d.ts +40 -0
  44. package/dist/executor/deterministic-executor.d.ts.map +1 -0
  45. package/dist/executor/deterministic-executor.js +269 -0
  46. package/dist/executor/deterministic-executor.js.map +1 -0
  47. package/dist/lifecycle/lifecycle-controller.d.ts +270 -0
  48. package/dist/lifecycle/lifecycle-controller.d.ts.map +1 -0
  49. package/dist/lifecycle/lifecycle-controller.js +596 -0
  50. package/dist/lifecycle/lifecycle-controller.js.map +1 -0
  51. package/dist/limits/resource-limit-manager.d.ts +200 -0
  52. package/dist/limits/resource-limit-manager.d.ts.map +1 -0
  53. package/dist/limits/resource-limit-manager.js +376 -0
  54. package/dist/limits/resource-limit-manager.js.map +1 -0
  55. package/dist/locks/lock-manager.d.ts +116 -0
  56. package/dist/locks/lock-manager.d.ts.map +1 -0
  57. package/dist/locks/lock-manager.js +306 -0
  58. package/dist/locks/lock-manager.js.map +1 -0
  59. package/dist/logging/index.d.ts +8 -0
  60. package/dist/logging/index.d.ts.map +1 -0
  61. package/dist/logging/index.js +22 -0
  62. package/dist/logging/index.js.map +1 -0
  63. package/dist/logging/sensitive-data-masker.d.ts +90 -0
  64. package/dist/logging/sensitive-data-masker.d.ts.map +1 -0
  65. package/dist/logging/sensitive-data-masker.js +228 -0
  66. package/dist/logging/sensitive-data-masker.js.map +1 -0
  67. package/dist/logging/task-log-manager.d.ts +215 -0
  68. package/dist/logging/task-log-manager.d.ts.map +1 -0
  69. package/dist/logging/task-log-manager.js +743 -0
  70. package/dist/logging/task-log-manager.js.map +1 -0
  71. package/dist/mediation/fail-closed-runner.d.ts +131 -0
  72. package/dist/mediation/fail-closed-runner.d.ts.map +1 -0
  73. package/dist/mediation/fail-closed-runner.js +245 -0
  74. package/dist/mediation/fail-closed-runner.js.map +1 -0
  75. package/dist/mediation/llm-client-with-evidence.d.ts +123 -0
  76. package/dist/mediation/llm-client-with-evidence.d.ts.map +1 -0
  77. package/dist/mediation/llm-client-with-evidence.js +245 -0
  78. package/dist/mediation/llm-client-with-evidence.js.map +1 -0
  79. package/dist/mediation/llm-client.d.ts +102 -0
  80. package/dist/mediation/llm-client.d.ts.map +1 -0
  81. package/dist/mediation/llm-client.js +206 -0
  82. package/dist/mediation/llm-client.js.map +1 -0
  83. package/dist/mediation/llm-evidence-manager.d.ts +108 -0
  84. package/dist/mediation/llm-evidence-manager.d.ts.map +1 -0
  85. package/dist/mediation/llm-evidence-manager.js +230 -0
  86. package/dist/mediation/llm-evidence-manager.js.map +1 -0
  87. package/dist/mediation/llm-mediation-layer.d.ts +175 -0
  88. package/dist/mediation/llm-mediation-layer.d.ts.map +1 -0
  89. package/dist/mediation/llm-mediation-layer.js +315 -0
  90. package/dist/mediation/llm-mediation-layer.js.map +1 -0
  91. package/dist/mediation/llm-sentinel.d.ts +107 -0
  92. package/dist/mediation/llm-sentinel.d.ts.map +1 -0
  93. package/dist/mediation/llm-sentinel.js +187 -0
  94. package/dist/mediation/llm-sentinel.js.map +1 -0
  95. package/dist/mediation/real-llm-mediation-layer.d.ts +104 -0
  96. package/dist/mediation/real-llm-mediation-layer.d.ts.map +1 -0
  97. package/dist/mediation/real-llm-mediation-layer.js +322 -0
  98. package/dist/mediation/real-llm-mediation-layer.js.map +1 -0
  99. package/dist/mediation/verdict-reporter.d.ts +61 -0
  100. package/dist/mediation/verdict-reporter.d.ts.map +1 -0
  101. package/dist/mediation/verdict-reporter.js +178 -0
  102. package/dist/mediation/verdict-reporter.js.map +1 -0
  103. package/dist/models/enums.d.ts +133 -0
  104. package/dist/models/enums.d.ts.map +1 -0
  105. package/dist/models/enums.js +201 -0
  106. package/dist/models/enums.js.map +1 -0
  107. package/dist/models/evidence.d.ts +60 -0
  108. package/dist/models/evidence.d.ts.map +1 -0
  109. package/dist/models/evidence.js +135 -0
  110. package/dist/models/evidence.js.map +1 -0
  111. package/dist/models/execution-result.d.ts +89 -0
  112. package/dist/models/execution-result.d.ts.map +1 -0
  113. package/dist/models/execution-result.js +197 -0
  114. package/dist/models/execution-result.js.map +1 -0
  115. package/dist/models/file-lock.d.ts +62 -0
  116. package/dist/models/file-lock.d.ts.map +1 -0
  117. package/dist/models/file-lock.js +133 -0
  118. package/dist/models/file-lock.js.map +1 -0
  119. package/dist/models/index.d.ts +12 -0
  120. package/dist/models/index.d.ts.map +1 -0
  121. package/dist/models/index.js +91 -0
  122. package/dist/models/index.js.map +1 -0
  123. package/dist/models/repl/index.d.ts +7 -0
  124. package/dist/models/repl/index.d.ts.map +1 -0
  125. package/dist/models/repl/index.js +32 -0
  126. package/dist/models/repl/index.js.map +1 -0
  127. package/dist/models/repl/model-registry.d.ts +73 -0
  128. package/dist/models/repl/model-registry.d.ts.map +1 -0
  129. package/dist/models/repl/model-registry.js +116 -0
  130. package/dist/models/repl/model-registry.js.map +1 -0
  131. package/dist/models/repl/repl-state.d.ts +86 -0
  132. package/dist/models/repl/repl-state.d.ts.map +1 -0
  133. package/dist/models/repl/repl-state.js +152 -0
  134. package/dist/models/repl/repl-state.js.map +1 -0
  135. package/dist/models/repl/task-log.d.ts +247 -0
  136. package/dist/models/repl/task-log.d.ts.map +1 -0
  137. package/dist/models/repl/task-log.js +178 -0
  138. package/dist/models/repl/task-log.js.map +1 -0
  139. package/dist/models/session.d.ts +71 -0
  140. package/dist/models/session.d.ts.map +1 -0
  141. package/dist/models/session.js +140 -0
  142. package/dist/models/session.js.map +1 -0
  143. package/dist/models/supporting.d.ts +97 -0
  144. package/dist/models/supporting.d.ts.map +1 -0
  145. package/dist/models/supporting.js +208 -0
  146. package/dist/models/supporting.js.map +1 -0
  147. package/dist/models/task.d.ts +77 -0
  148. package/dist/models/task.d.ts.map +1 -0
  149. package/dist/models/task.js +170 -0
  150. package/dist/models/task.js.map +1 -0
  151. package/dist/output/output-control-manager.d.ts +217 -0
  152. package/dist/output/output-control-manager.d.ts.map +1 -0
  153. package/dist/output/output-control-manager.js +378 -0
  154. package/dist/output/output-control-manager.js.map +1 -0
  155. package/dist/pool/agent-pool.d.ts +284 -0
  156. package/dist/pool/agent-pool.d.ts.map +1 -0
  157. package/dist/pool/agent-pool.js +451 -0
  158. package/dist/pool/agent-pool.js.map +1 -0
  159. package/dist/repl/commands/index.d.ts +12 -0
  160. package/dist/repl/commands/index.d.ts.map +1 -0
  161. package/dist/repl/commands/index.js +26 -0
  162. package/dist/repl/commands/index.js.map +1 -0
  163. package/dist/repl/commands/init.d.ts +31 -0
  164. package/dist/repl/commands/init.d.ts.map +1 -0
  165. package/dist/repl/commands/init.js +234 -0
  166. package/dist/repl/commands/init.js.map +1 -0
  167. package/dist/repl/commands/keys.d.ts +63 -0
  168. package/dist/repl/commands/keys.d.ts.map +1 -0
  169. package/dist/repl/commands/keys.js +114 -0
  170. package/dist/repl/commands/keys.js.map +1 -0
  171. package/dist/repl/commands/logs.d.ts +91 -0
  172. package/dist/repl/commands/logs.d.ts.map +1 -0
  173. package/dist/repl/commands/logs.js +200 -0
  174. package/dist/repl/commands/logs.js.map +1 -0
  175. package/dist/repl/commands/model.d.ts +85 -0
  176. package/dist/repl/commands/model.d.ts.map +1 -0
  177. package/dist/repl/commands/model.js +225 -0
  178. package/dist/repl/commands/model.js.map +1 -0
  179. package/dist/repl/commands/models.d.ts +50 -0
  180. package/dist/repl/commands/models.d.ts.map +1 -0
  181. package/dist/repl/commands/models.js +180 -0
  182. package/dist/repl/commands/models.js.map +1 -0
  183. package/dist/repl/commands/provider.d.ts +79 -0
  184. package/dist/repl/commands/provider.d.ts.map +1 -0
  185. package/dist/repl/commands/provider.js +291 -0
  186. package/dist/repl/commands/provider.js.map +1 -0
  187. package/dist/repl/commands/session.d.ts +50 -0
  188. package/dist/repl/commands/session.d.ts.map +1 -0
  189. package/dist/repl/commands/session.js +152 -0
  190. package/dist/repl/commands/session.js.map +1 -0
  191. package/dist/repl/commands/status.d.ts +55 -0
  192. package/dist/repl/commands/status.d.ts.map +1 -0
  193. package/dist/repl/commands/status.js +182 -0
  194. package/dist/repl/commands/status.js.map +1 -0
  195. package/dist/repl/index.d.ts +6 -0
  196. package/dist/repl/index.d.ts.map +1 -0
  197. package/dist/repl/index.js +25 -0
  198. package/dist/repl/index.js.map +1 -0
  199. package/dist/repl/repl-interface.d.ts +371 -0
  200. package/dist/repl/repl-interface.d.ts.map +1 -0
  201. package/dist/repl/repl-interface.js +1214 -0
  202. package/dist/repl/repl-interface.js.map +1 -0
  203. package/dist/session/session-manager.d.ts +85 -0
  204. package/dist/session/session-manager.d.ts.map +1 -0
  205. package/dist/session/session-manager.js +217 -0
  206. package/dist/session/session-manager.js.map +1 -0
  207. package/dist/supervisor/executor-supervisor.d.ts +90 -0
  208. package/dist/supervisor/executor-supervisor.d.ts.map +1 -0
  209. package/dist/supervisor/executor-supervisor.js +223 -0
  210. package/dist/supervisor/executor-supervisor.js.map +1 -0
  211. package/dist/supervisor/index.d.ts +5 -0
  212. package/dist/supervisor/index.d.ts.map +1 -0
  213. package/dist/supervisor/index.js +9 -0
  214. package/dist/supervisor/index.js.map +1 -0
  215. package/package.json +57 -0
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Real LLM Mediation Layer
3
+ *
4
+ * Uses REAL LLM API calls (no stubs/mocks) to:
5
+ * 1. Generate natural language questions from structured reason codes
6
+ * 2. Normalize free-form user input into structured tasks
7
+ *
8
+ * ARCHITECTURAL RULES:
9
+ * - This layer sits ABOVE Runner Core
10
+ * - Runner Core returns ONLY structured signals (no conversational text)
11
+ * - This layer generates ALL human-readable text via LLM
12
+ * - Output structure is ALWAYS stable regardless of LLM text variation
13
+ */
14
+ import { LLMClient, LLMProvider } from './llm-client';
15
+ import { ClarificationReason, RunnerSignal, ParsedUserResponse, NormalizedTask, MediationOutput } from './llm-mediation-layer';
16
+ /**
17
+ * Configuration for Real LLM Mediation Layer
18
+ */
19
+ export interface RealLLMConfig {
20
+ provider?: LLMProvider;
21
+ model?: string;
22
+ temperature?: number;
23
+ }
24
+ /**
25
+ * Real LLM Mediation Layer
26
+ *
27
+ * IMPORTANT: This class makes REAL API calls to LLM providers.
28
+ * - No stubs or mocks
29
+ * - temperature > 0 for non-deterministic output
30
+ * - Output varies every call, but structure remains stable
31
+ */
32
+ export declare class RealLLMMediationLayer {
33
+ private readonly client;
34
+ constructor(config?: RealLLMConfig);
35
+ /**
36
+ * Get the LLM client (for testing/inspection)
37
+ */
38
+ getClient(): LLMClient;
39
+ /**
40
+ * Process Runner signal and generate appropriate output using LLM
41
+ *
42
+ * @param signal - Structured signal from Runner Core
43
+ * @returns Mediation output with LLM-generated question
44
+ */
45
+ processRunnerSignal(signal: RunnerSignal): Promise<MediationOutput>;
46
+ /**
47
+ * Parse and normalize user response using LLM
48
+ *
49
+ * @param userInput - Raw user input string
50
+ * @param context - Context from previous clarification
51
+ * @returns Parsed user response (structure is stable regardless of LLM variation)
52
+ */
53
+ parseUserResponse(userInput: string, context: {
54
+ clarification_reason?: ClarificationReason;
55
+ target_file?: string;
56
+ original_prompt?: string;
57
+ }): Promise<ParsedUserResponse>;
58
+ /**
59
+ * Normalize user response into explicit task for Runner
60
+ *
61
+ * @param originalPrompt - Original user prompt
62
+ * @param signal - Runner signal that triggered clarification
63
+ * @param parsedResponse - Parsed user response
64
+ * @returns Normalized task (structure is always stable)
65
+ */
66
+ normalizeToTask(originalPrompt: string, signal: RunnerSignal, parsedResponse: ParsedUserResponse): Promise<NormalizedTask | null>;
67
+ /**
68
+ * Generate question via LLM from clarification reason
69
+ *
70
+ * Each call may produce different text, but conveys the same meaning.
71
+ */
72
+ private generateQuestion;
73
+ /**
74
+ * Generate status message via LLM
75
+ */
76
+ private generateStatusMessage;
77
+ /**
78
+ * Generate explicit prompt for Runner
79
+ */
80
+ private generateExplicitPrompt;
81
+ /**
82
+ * Get human-readable description for clarification reason
83
+ */
84
+ private getReasonDescription;
85
+ /**
86
+ * Get suggested responses for clarification reason
87
+ */
88
+ private getSuggestedResponses;
89
+ /**
90
+ * Build prompt for parsing user response
91
+ */
92
+ private buildParsePrompt;
93
+ /**
94
+ * Parse LLM classification response into ParsedUserResponse
95
+ *
96
+ * This is the NORMALIZATION step - ensures stable structure regardless of LLM variation
97
+ */
98
+ private parseClassificationResponse;
99
+ /**
100
+ * Generate alternative file name (deterministic, no LLM)
101
+ */
102
+ private generateAlternativeName;
103
+ }
104
+ //# sourceMappingURL=real-llm-mediation-layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"real-llm-mediation-layer.d.ts","sourceRoot":"","sources":["../../src/mediation/real-llm-mediation-layer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAElB,cAAc,EACd,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAEvB,MAAM,CAAC,EAAE,aAAa;IAQlC;;OAEG;IACH,SAAS,IAAI,SAAS;IAItB;;;;;OAKG;IACG,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAqBzE;;;;;;OAMG;IACG,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;QAAE,oBAAoB,CAAC,EAAE,mBAAmB,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,GACtG,OAAO,CAAC,kBAAkB,CAAC;IA4B9B;;;;;;;OAOG;IACG,eAAe,CACnB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,kBAAkB,GACjC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IA6DjC;;;;OAIG;YACW,gBAAgB;IA0B9B;;OAEG;YACW,qBAAqB;IA8BnC;;OAEG;YACW,sBAAsB;IAiBpC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAY7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAoBxB;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAgCnC;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAehC"}
@@ -0,0 +1,322 @@
1
+ "use strict";
2
+ /**
3
+ * Real LLM Mediation Layer
4
+ *
5
+ * Uses REAL LLM API calls (no stubs/mocks) to:
6
+ * 1. Generate natural language questions from structured reason codes
7
+ * 2. Normalize free-form user input into structured tasks
8
+ *
9
+ * ARCHITECTURAL RULES:
10
+ * - This layer sits ABOVE Runner Core
11
+ * - Runner Core returns ONLY structured signals (no conversational text)
12
+ * - This layer generates ALL human-readable text via LLM
13
+ * - Output structure is ALWAYS stable regardless of LLM text variation
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.RealLLMMediationLayer = void 0;
17
+ const llm_client_1 = require("./llm-client");
18
+ /**
19
+ * Real LLM Mediation Layer
20
+ *
21
+ * IMPORTANT: This class makes REAL API calls to LLM providers.
22
+ * - No stubs or mocks
23
+ * - temperature > 0 for non-deterministic output
24
+ * - Output varies every call, but structure remains stable
25
+ */
26
+ class RealLLMMediationLayer {
27
+ client;
28
+ constructor(config) {
29
+ this.client = llm_client_1.LLMClient.fromEnv(config?.provider ?? 'openai', config?.model, { temperature: config?.temperature ?? 0.7 });
30
+ }
31
+ /**
32
+ * Get the LLM client (for testing/inspection)
33
+ */
34
+ getClient() {
35
+ return this.client;
36
+ }
37
+ /**
38
+ * Process Runner signal and generate appropriate output using LLM
39
+ *
40
+ * @param signal - Structured signal from Runner Core
41
+ * @returns Mediation output with LLM-generated question
42
+ */
43
+ async processRunnerSignal(signal) {
44
+ // If no clarification needed, generate status message via LLM
45
+ if (!signal.clarification_needed) {
46
+ const statusMessage = await this.generateStatusMessage(signal);
47
+ return {
48
+ needs_user_input: false,
49
+ status_message: statusMessage,
50
+ };
51
+ }
52
+ // Generate question via LLM based on clarification reason
53
+ const question = await this.generateQuestion(signal);
54
+ const suggestedResponses = this.getSuggestedResponses(signal.clarification_reason);
55
+ return {
56
+ needs_user_input: true,
57
+ question,
58
+ suggested_responses: suggestedResponses,
59
+ };
60
+ }
61
+ /**
62
+ * Parse and normalize user response using LLM
63
+ *
64
+ * @param userInput - Raw user input string
65
+ * @param context - Context from previous clarification
66
+ * @returns Parsed user response (structure is stable regardless of LLM variation)
67
+ */
68
+ async parseUserResponse(userInput, context) {
69
+ const prompt = this.buildParsePrompt(userInput, context);
70
+ const response = await this.client.chat([
71
+ {
72
+ role: 'system',
73
+ content: `You are a response parser. Analyze the user's response and classify it into exactly one of these types:
74
+ - "overwrite": User wants to overwrite an existing file
75
+ - "new_name": User wants to create with a new/different name
76
+ - "cancel": User wants to cancel the operation
77
+ - "specify_file": User specified a file name or path
78
+ - "specify_action": User specified what action to take
79
+ - "unknown": Cannot determine user's intent
80
+
81
+ Respond with ONLY a JSON object in this exact format:
82
+ {"type": "<type>", "file_name": "<extracted_file_name_if_any>", "action": "<extracted_action_if_any>"}
83
+
84
+ Do not include any explanation, only the JSON.`,
85
+ },
86
+ {
87
+ role: 'user',
88
+ content: prompt,
89
+ },
90
+ ]);
91
+ return this.parseClassificationResponse(response.content, userInput);
92
+ }
93
+ /**
94
+ * Normalize user response into explicit task for Runner
95
+ *
96
+ * @param originalPrompt - Original user prompt
97
+ * @param signal - Runner signal that triggered clarification
98
+ * @param parsedResponse - Parsed user response
99
+ * @returns Normalized task (structure is always stable)
100
+ */
101
+ async normalizeToTask(originalPrompt, signal, parsedResponse) {
102
+ if (parsedResponse.type === 'cancel') {
103
+ return null;
104
+ }
105
+ const context = {
106
+ original_prompt: originalPrompt,
107
+ clarification_reason: signal.clarification_reason,
108
+ user_response: parsedResponse.raw_input,
109
+ };
110
+ // Map parsed response to normalized task
111
+ // This mapping is DETERMINISTIC - no LLM involved
112
+ // Structure is always stable regardless of how we got here
113
+ switch (parsedResponse.type) {
114
+ case 'overwrite':
115
+ return {
116
+ explicit_prompt: await this.generateExplicitPrompt('overwrite', signal.target_file, originalPrompt),
117
+ target_file: signal.target_file,
118
+ action: 'overwrite',
119
+ original_context: context,
120
+ };
121
+ case 'new_name':
122
+ const newFileName = parsedResponse.new_file_name || this.generateAlternativeName(signal.target_file);
123
+ return {
124
+ explicit_prompt: await this.generateExplicitPrompt('create_new', newFileName, originalPrompt),
125
+ target_file: newFileName,
126
+ action: 'create_new',
127
+ original_context: context,
128
+ };
129
+ case 'specify_file':
130
+ return {
131
+ explicit_prompt: await this.generateExplicitPrompt('create', parsedResponse.new_file_name, originalPrompt),
132
+ target_file: parsedResponse.new_file_name,
133
+ action: 'create',
134
+ original_context: context,
135
+ };
136
+ case 'specify_action':
137
+ return {
138
+ explicit_prompt: parsedResponse.specified_action || originalPrompt,
139
+ action: 'modify',
140
+ original_context: context,
141
+ };
142
+ default:
143
+ // Unknown response - return original prompt with context
144
+ return {
145
+ explicit_prompt: originalPrompt,
146
+ action: 'create',
147
+ original_context: context,
148
+ };
149
+ }
150
+ }
151
+ // ============================================================
152
+ // Private LLM-powered methods
153
+ // ============================================================
154
+ /**
155
+ * Generate question via LLM from clarification reason
156
+ *
157
+ * Each call may produce different text, but conveys the same meaning.
158
+ */
159
+ async generateQuestion(signal) {
160
+ const reasonDescription = this.getReasonDescription(signal.clarification_reason);
161
+ const response = await this.client.chat([
162
+ {
163
+ role: 'system',
164
+ content: `You are a helpful assistant that generates natural Japanese questions.
165
+ Generate a clear, polite question to ask the user for clarification.
166
+ The question should be natural and conversational.
167
+ Respond with ONLY the question text, no explanations.`,
168
+ },
169
+ {
170
+ role: 'user',
171
+ content: `Generate a Japanese question for this situation:
172
+
173
+ Reason: ${reasonDescription}
174
+ ${signal.target_file ? `Target file: ${signal.target_file}` : ''}
175
+ ${signal.original_prompt ? `Original request: ${signal.original_prompt}` : ''}
176
+
177
+ Generate a natural Japanese question to ask the user.`,
178
+ },
179
+ ]);
180
+ return response.content.trim();
181
+ }
182
+ /**
183
+ * Generate status message via LLM
184
+ */
185
+ async generateStatusMessage(signal) {
186
+ if (!signal.execution_result) {
187
+ return 'タスクを処理中です。';
188
+ }
189
+ const result = signal.execution_result;
190
+ let context = `Status: ${result.status}`;
191
+ if (result.verified_files && result.verified_files.length > 0) {
192
+ const existingFiles = result.verified_files.filter(f => f.exists).map(f => f.path);
193
+ if (existingFiles.length > 0) {
194
+ context += `\nCreated files: ${existingFiles.join(', ')}`;
195
+ }
196
+ }
197
+ const response = await this.client.chat([
198
+ {
199
+ role: 'system',
200
+ content: `You are a helpful assistant that generates natural Japanese status messages.
201
+ Generate a brief, clear status message based on the task result.
202
+ Respond with ONLY the message text, no explanations.`,
203
+ },
204
+ {
205
+ role: 'user',
206
+ content: `Generate a Japanese status message for this result:\n${context}`,
207
+ },
208
+ ]);
209
+ return response.content.trim();
210
+ }
211
+ /**
212
+ * Generate explicit prompt for Runner
213
+ */
214
+ async generateExplicitPrompt(action, targetFile, originalPrompt) {
215
+ // For simplicity and stability, use template-based prompts
216
+ // This ensures the structure passed to Runner is always predictable
217
+ switch (action) {
218
+ case 'overwrite':
219
+ return `${targetFile} を上書きして作成してください。元のリクエスト: ${originalPrompt}`;
220
+ case 'create_new':
221
+ return `${targetFile} を新規作成してください。元のリクエスト: ${originalPrompt}`;
222
+ case 'create':
223
+ return `${targetFile} を作成してください。元のリクエスト: ${originalPrompt}`;
224
+ }
225
+ }
226
+ /**
227
+ * Get human-readable description for clarification reason
228
+ */
229
+ getReasonDescription(reason) {
230
+ switch (reason) {
231
+ case 'target_file_exists':
232
+ return 'A file with the same name already exists. Need to decide whether to overwrite or create with a new name.';
233
+ case 'target_file_ambiguous':
234
+ return 'Cannot determine which file to target from the request. Need the user to specify a file name or path.';
235
+ case 'target_action_ambiguous':
236
+ return 'Cannot determine what action to take. Need the user to clarify what they want to do.';
237
+ case 'missing_required_info':
238
+ return 'Missing required information to proceed. Need the user to provide more details.';
239
+ default:
240
+ return 'Need clarification from the user.';
241
+ }
242
+ }
243
+ /**
244
+ * Get suggested responses for clarification reason
245
+ */
246
+ getSuggestedResponses(reason) {
247
+ switch (reason) {
248
+ case 'target_file_exists':
249
+ return ['overwrite', 'new', 'cancel'];
250
+ case 'target_file_ambiguous':
251
+ case 'target_action_ambiguous':
252
+ case 'missing_required_info':
253
+ default:
254
+ return [];
255
+ }
256
+ }
257
+ /**
258
+ * Build prompt for parsing user response
259
+ */
260
+ buildParsePrompt(userInput, context) {
261
+ let prompt = `User input: "${userInput}"\n\n`;
262
+ if (context.clarification_reason) {
263
+ prompt += `Context: We asked about "${this.getReasonDescription(context.clarification_reason)}"\n`;
264
+ }
265
+ if (context.target_file) {
266
+ prompt += `Target file: ${context.target_file}\n`;
267
+ }
268
+ if (context.original_prompt) {
269
+ prompt += `Original request: ${context.original_prompt}\n`;
270
+ }
271
+ prompt += '\nClassify this response into one of the types.';
272
+ return prompt;
273
+ }
274
+ /**
275
+ * Parse LLM classification response into ParsedUserResponse
276
+ *
277
+ * This is the NORMALIZATION step - ensures stable structure regardless of LLM variation
278
+ */
279
+ parseClassificationResponse(llmResponse, rawInput) {
280
+ try {
281
+ // Extract JSON from response (LLM might include extra text)
282
+ const jsonMatch = llmResponse.match(/\{[^}]+\}/);
283
+ if (!jsonMatch) {
284
+ return { type: 'unknown', raw_input: rawInput };
285
+ }
286
+ const parsed = JSON.parse(jsonMatch[0]);
287
+ // Validate and normalize type
288
+ const validTypes = ['overwrite', 'new_name', 'cancel', 'specify_file', 'specify_action', 'unknown'];
289
+ const type = validTypes.includes(parsed.type)
290
+ ? parsed.type
291
+ : 'unknown';
292
+ return {
293
+ type,
294
+ new_file_name: parsed.file_name || undefined,
295
+ specified_action: parsed.action || undefined,
296
+ raw_input: rawInput,
297
+ };
298
+ }
299
+ catch {
300
+ // If JSON parsing fails, return unknown
301
+ return { type: 'unknown', raw_input: rawInput };
302
+ }
303
+ }
304
+ /**
305
+ * Generate alternative file name (deterministic, no LLM)
306
+ */
307
+ generateAlternativeName(originalFile) {
308
+ if (!originalFile) {
309
+ return 'new_file.txt';
310
+ }
311
+ const ext = originalFile.includes('.')
312
+ ? originalFile.substring(originalFile.lastIndexOf('.'))
313
+ : '';
314
+ const baseName = originalFile.includes('.')
315
+ ? originalFile.substring(0, originalFile.lastIndexOf('.'))
316
+ : originalFile;
317
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-').substring(0, 19);
318
+ return `${baseName}_${timestamp}${ext}`;
319
+ }
320
+ }
321
+ exports.RealLLMMediationLayer = RealLLMMediationLayer;
322
+ //# sourceMappingURL=real-llm-mediation-layer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"real-llm-mediation-layer.js","sourceRoot":"","sources":["../../src/mediation/real-llm-mediation-layer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,6CAAsD;AAmBtD;;;;;;;GAOG;AACH,MAAa,qBAAqB;IACf,MAAM,CAAY;IAEnC,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,sBAAS,CAAC,OAAO,CAC7B,MAAM,EAAE,QAAQ,IAAI,QAAQ,EAC5B,MAAM,EAAE,KAAK,EACb,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,IAAI,GAAG,EAAE,CAC5C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,mB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test categories:
5
+ * - REPL: COMPLETE if core tests pass (no API key required)
6
+ * - Real LLM: COMPLETE only if:
7
+ * 1. GATE: OPEN (LLM_TEST_MODE=1 + API key present)
8
+ * 2. At least one successful LLM evidence exists
9
+ * 3. Evidence integrity verified
10
+ *
11
+ * This ensures honest reporting - Real LLM cannot be marked COMPLETE
12
+ * without actual API calls being made and verified.
13
+ */
14
+ export interface VerdictResult {
15
+ category: 'REPL' | 'REAL_LLM';
16
+ verdict: 'COMPLETE' | 'INCOMPLETE' | 'SKIPPED';
17
+ reason: string;
18
+ details: {
19
+ gate_status?: 'OPEN' | 'CLOSED';
20
+ real_calls_made: boolean;
21
+ evidence_count?: number;
22
+ evidence_verified?: boolean;
23
+ skip_reason?: string;
24
+ };
25
+ }
26
+ export interface CombinedVerdict {
27
+ repl: VerdictResult;
28
+ real_llm: VerdictResult;
29
+ summary: string;
30
+ }
31
+ export interface ExecutionGate {
32
+ canExecute: boolean;
33
+ skipReason?: string;
34
+ provider?: string;
35
+ envVar?: string;
36
+ }
37
+ /**
38
+ * Check execution gate for Real LLM tests
39
+ */
40
+ export declare function checkExecutionGate(): ExecutionGate;
41
+ /**
42
+ * Generate REPL verdict (based on core test pass rate)
43
+ */
44
+ export declare function generateREPLVerdict(coreTestsPassed: boolean): VerdictResult;
45
+ /**
46
+ * Generate Real LLM verdict (requires gate open + evidence)
47
+ */
48
+ export declare function generateRealLLMVerdict(gate: ExecutionGate, evidenceCount?: number, evidenceVerified?: boolean): VerdictResult;
49
+ /**
50
+ * Generate combined verdict with formatted output
51
+ */
52
+ export declare function generateCombinedVerdict(coreTestsPassed: boolean, evidenceCount?: number, evidenceVerified?: boolean): CombinedVerdict;
53
+ /**
54
+ * Format verdict summary for console output
55
+ */
56
+ export declare function formatVerdictSummary(repl: VerdictResult, real_llm: VerdictResult): string;
57
+ /**
58
+ * Print verdict to console
59
+ */
60
+ export declare function printVerdict(verdict: CombinedVerdict): void;
61
+ //# sourceMappingURL=verdict-reporter.d.ts.map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