@ratio-mcp/dev-server 1.5.0 → 1.6.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.
- package/README.md +118 -0
- package/dist/schemas/app-distribution.json +36 -0
- package/dist/schemas/customers.json +26 -0
- package/dist/schemas/discounts.json +81 -0
- package/dist/schemas/draft_orders.json +112 -0
- package/dist/schemas/loyalty.json +147 -0
- package/dist/schemas/oauth.json +71 -0
- package/dist/schemas/orders.json +597 -102
- package/dist/schemas/product_reviews.json +45 -0
- package/dist/schemas/products.json +401 -118
- package/dist/schemas/tags.json +98 -0
- package/dist/schemas/variants.json +112 -0
- package/dist/schemas/webhooks.json +148 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +39 -5
- package/dist/server.js.map +1 -1
- package/dist/services/app-state-sync.d.ts +34 -0
- package/dist/services/app-state-sync.d.ts.map +1 -0
- package/dist/services/app-state-sync.js +85 -0
- package/dist/services/app-state-sync.js.map +1 -0
- package/dist/services/elicitation.d.ts +25 -0
- package/dist/services/elicitation.d.ts.map +1 -0
- package/dist/services/elicitation.js +101 -0
- package/dist/services/elicitation.js.map +1 -0
- package/dist/services/flow-profiles.d.ts +46 -0
- package/dist/services/flow-profiles.d.ts.map +1 -0
- package/dist/services/flow-profiles.js +100 -0
- package/dist/services/flow-profiles.js.map +1 -0
- package/dist/services/questionnaire.d.ts +89 -0
- package/dist/services/questionnaire.d.ts.map +1 -0
- package/dist/services/questionnaire.js +167 -0
- package/dist/services/questionnaire.js.map +1 -0
- package/dist/services/session-state.d.ts +17 -0
- package/dist/services/session-state.d.ts.map +1 -1
- package/dist/services/session-state.js +26 -1
- package/dist/services/session-state.js.map +1 -1
- package/dist/services/tool-guard.d.ts +15 -18
- package/dist/services/tool-guard.d.ts.map +1 -1
- package/dist/services/tool-guard.js +150 -97
- package/dist/services/tool-guard.js.map +1 -1
- package/dist/tools/app-management.d.ts.map +1 -1
- package/dist/tools/app-management.js +181 -33
- package/dist/tools/app-management.js.map +1 -1
- package/dist/tools/codegen.d.ts.map +1 -1
- package/dist/tools/codegen.js +21 -0
- package/dist/tools/codegen.js.map +1 -1
- package/dist/tools/gather-requirements.d.ts.map +1 -1
- package/dist/tools/gather-requirements.js +5 -3
- package/dist/tools/gather-requirements.js.map +1 -1
- package/dist/tools/get-status.d.ts.map +1 -1
- package/dist/tools/get-status.js +45 -34
- package/dist/tools/get-status.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/lifecycle.d.ts.map +1 -1
- package/dist/tools/lifecycle.js +6 -3
- package/dist/tools/lifecycle.js.map +1 -1
- package/dist/tools/reference-data.d.ts +16 -0
- package/dist/tools/reference-data.d.ts.map +1 -1
- package/dist/tools/reference-data.js +12 -8
- package/dist/tools/reference-data.js.map +1 -1
- package/dist/tools/requirements.d.ts.map +1 -1
- package/dist/tools/requirements.js +17 -9
- package/dist/tools/requirements.js.map +1 -1
- package/dist/tools/submission.d.ts.map +1 -1
- package/dist/tools/submission.js +50 -13
- package/dist/tools/submission.js.map +1 -1
- package/dist/tools/webhooks.d.ts.map +1 -1
- package/dist/tools/webhooks.js +3 -1
- package/dist/tools/webhooks.js.map +1 -1
- package/dist/utils/logger.d.ts +3 -2
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +19 -10
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/schema-resources.d.ts +8 -0
- package/dist/utils/schema-resources.d.ts.map +1 -0
- package/dist/utils/schema-resources.js +25 -0
- package/dist/utils/schema-resources.js.map +1 -0
- package/package.json +3 -3
- package/dist/orchestrated-index.d.ts +0 -11
- package/dist/orchestrated-index.d.ts.map +0 -1
- package/dist/orchestrated-index.js +0 -33
- package/dist/orchestrated-index.js.map +0 -1
- package/dist/orchestrated-server.d.ts +0 -21
- package/dist/orchestrated-server.d.ts.map +0 -1
- package/dist/orchestrated-server.js +0 -101
- package/dist/orchestrated-server.js.map +0 -1
- package/dist/services/orchestrator.d.ts +0 -63
- package/dist/services/orchestrator.d.ts.map +0 -1
- package/dist/services/orchestrator.js +0 -845
- package/dist/services/orchestrator.js.map +0 -1
- package/dist/services/response-formatter.d.ts +0 -24
- package/dist/services/response-formatter.d.ts.map +0 -1
- package/dist/services/response-formatter.js +0 -311
- package/dist/services/response-formatter.js.map +0 -1
- package/dist/tools/agent-chat.d.ts +0 -9
- package/dist/tools/agent-chat.d.ts.map +0 -1
- package/dist/tools/agent-chat.js +0 -465
- package/dist/tools/agent-chat.js.map +0 -1
package/dist/tools/agent-chat.js
DELETED
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { allDevTools } from './index.js';
|
|
3
|
-
import { getNextStep, getCurrentPhase, canSkipPhase, } from '../services/orchestrator.js';
|
|
4
|
-
import { getSession, recordToolSuccess, resetSession, } from '../services/session-state.js';
|
|
5
|
-
import { formatSuccess, formatInputNeeded, formatError, formatComplete, } from '../services/response-formatter.js';
|
|
6
|
-
import { logger } from '../utils/logger.js';
|
|
7
|
-
/**
|
|
8
|
-
* Input schema for the agent-chat tool.
|
|
9
|
-
* This is the single unified tool that replaces all 24+ individual tools.
|
|
10
|
-
*/
|
|
11
|
-
const agentChatSchema = z.object({
|
|
12
|
-
message: z.string().describe('The user message or intent. Can be natural language like "I want to build an order management app" ' +
|
|
13
|
-
'OR structured input like providing app details. For the very first message, just say what you want to build.'),
|
|
14
|
-
input_data: z
|
|
15
|
-
.record(z.unknown())
|
|
16
|
-
.optional()
|
|
17
|
-
.describe('Structured input data when the orchestrator requests specific fields. ' +
|
|
18
|
-
'For example: { "email": "dev@example.com", "password": "pass123" } for login, ' +
|
|
19
|
-
'or { "name": "My App", "description": "..." } for app creation. ' +
|
|
20
|
-
'The previous response will tell you exactly which fields are needed.'),
|
|
21
|
-
action: z
|
|
22
|
-
.enum(['next', 'skip', 'status', 'reset'])
|
|
23
|
-
.default('next')
|
|
24
|
-
.describe('Action to take: "next" = proceed with flow (default), ' +
|
|
25
|
-
'"skip" = skip current optional phase (only webhooks), ' +
|
|
26
|
-
'"status" = show current progress without advancing, ' +
|
|
27
|
-
'"reset" = start over from scratch'),
|
|
28
|
-
});
|
|
29
|
-
/**
|
|
30
|
-
* Normalize input field names so each tool always receives its canonical fields.
|
|
31
|
-
*
|
|
32
|
-
* The LLM can send reasonable variants like "categories" or "categoryIds"
|
|
33
|
-
* instead of the exact "category_ids" the Zod schema expects. Instead of
|
|
34
|
-
* scattering fallback logic in every tool handler, we fix it once here — the
|
|
35
|
-
* same way the backend DTO enforces a single canonical field via class-validator.
|
|
36
|
-
*
|
|
37
|
-
* Rules per tool are explicit and easy to audit.
|
|
38
|
-
*/
|
|
39
|
-
function normalizeToolInput(toolName, args) {
|
|
40
|
-
const normalized = { ...args };
|
|
41
|
-
if (toolName === 'create_app' || toolName === 'update_app') {
|
|
42
|
-
// Canonical field: category_ids (array of slugs)
|
|
43
|
-
// LLM may send: categories, categoryIds, category_slugs
|
|
44
|
-
if (!normalized.category_ids) {
|
|
45
|
-
const value = normalized.categories ??
|
|
46
|
-
normalized.categoryIds ??
|
|
47
|
-
normalized.category_slugs;
|
|
48
|
-
if (value) {
|
|
49
|
-
normalized.category_ids = value;
|
|
50
|
-
delete normalized.categories;
|
|
51
|
-
delete normalized.categoryIds;
|
|
52
|
-
delete normalized.category_slugs;
|
|
53
|
-
logger.info(`[normalizeToolInput] Mapped variant field to category_ids for ${toolName}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (toolName === 'build_frontend') {
|
|
58
|
-
// If project_path doesn't contain a package.json but has a /frontend
|
|
59
|
-
// sub-directory, the scaffold tool returned the parent path — adjust
|
|
60
|
-
// to point at the actual frontend dir. This mirrors the backend's
|
|
61
|
-
// approach of resolving paths at the controller layer.
|
|
62
|
-
// (Handled at runtime in the tool itself — see build.ts fix.)
|
|
63
|
-
}
|
|
64
|
-
return normalized;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Handler for the unified agent-chat tool.
|
|
68
|
-
* Orchestrates the entire Ratio app development lifecycle through a single interface.
|
|
69
|
-
*/
|
|
70
|
-
async function handleAgentChat(input) {
|
|
71
|
-
try {
|
|
72
|
-
const { message, input_data, action } = input;
|
|
73
|
-
const inputData = input_data;
|
|
74
|
-
const actionType = action || 'next';
|
|
75
|
-
logger.info(`agent-chat: action=${actionType}, hasInputData=${!!inputData}, messageLen=${String(message).length}`);
|
|
76
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
77
|
-
// Capture app description from early messages for later use
|
|
78
|
-
// (e.g., "I want to build an order management app")
|
|
79
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
80
|
-
const session = getSession();
|
|
81
|
-
const msgStr = String(message || '').trim();
|
|
82
|
-
if (msgStr.length > 10 && !session.context.appDescription) {
|
|
83
|
-
// Store the developer's initial description — used by gather_requirements
|
|
84
|
-
session.context.appDescription = msgStr;
|
|
85
|
-
logger.info(`Captured app description: "${msgStr.substring(0, 80)}..."`);
|
|
86
|
-
}
|
|
87
|
-
// Also capture from input_data.description if provided during app creation
|
|
88
|
-
if (inputData?.description && !session.context.appDescription) {
|
|
89
|
-
session.context.appDescription = String(inputData.description);
|
|
90
|
-
}
|
|
91
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
92
|
-
// Capture auth_mode from input_data (login or signup)
|
|
93
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
94
|
-
if (inputData?.auth_mode && !session.context.authMode) {
|
|
95
|
-
const mode = String(inputData.auth_mode).toLowerCase();
|
|
96
|
-
if (mode === 'login' || mode === 'signup') {
|
|
97
|
-
session.context.authMode = mode;
|
|
98
|
-
logger.info(`Captured auth_mode: ${mode}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
102
|
-
// Action: reset
|
|
103
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
104
|
-
if (actionType === 'reset') {
|
|
105
|
-
resetSession();
|
|
106
|
-
logger.info('Session reset by user');
|
|
107
|
-
return {
|
|
108
|
-
message: 'Session reset. Starting fresh! Tell me about the app you want to build.',
|
|
109
|
-
phase: 'auth',
|
|
110
|
-
progress: { current: 0, total: 15, percentage: 0 },
|
|
111
|
-
needsInput: true,
|
|
112
|
-
inputPrompt: 'What kind of app would you like to build? (e.g., "order management app", "inventory tracking system")',
|
|
113
|
-
inputFields: ['message'],
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
117
|
-
// Action: status
|
|
118
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
119
|
-
if (actionType === 'status') {
|
|
120
|
-
const currentPhase = getCurrentPhase();
|
|
121
|
-
const orchestratorResult = getNextStep(inputData);
|
|
122
|
-
return {
|
|
123
|
-
message: `Current phase: ${orchestratorResult.phase_description}. ${orchestratorResult.message}`,
|
|
124
|
-
phase: currentPhase,
|
|
125
|
-
progress: orchestratorResult.progress,
|
|
126
|
-
needsInput: orchestratorResult.needsInput,
|
|
127
|
-
inputPrompt: orchestratorResult.inputPrompt,
|
|
128
|
-
inputFields: orchestratorResult.inputFields,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
132
|
-
// Action: skip
|
|
133
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
134
|
-
if (actionType === 'skip') {
|
|
135
|
-
const currentPhase = getCurrentPhase();
|
|
136
|
-
// Check if this phase can be skipped
|
|
137
|
-
if (!canSkipPhase(currentPhase)) {
|
|
138
|
-
return {
|
|
139
|
-
message: `Cannot skip "${currentPhase}" phase. This phase is required.`,
|
|
140
|
-
phase: currentPhase,
|
|
141
|
-
progress: { current: 0, total: 15, percentage: 0 },
|
|
142
|
-
needsInput: false,
|
|
143
|
-
error: `Phase "${currentPhase}" is mandatory and cannot be skipped.`,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
// Mark phase as complete and advance
|
|
147
|
-
const session = getSession();
|
|
148
|
-
if (currentPhase === 'webhooks') {
|
|
149
|
-
session.context.webhooksConfigured = true;
|
|
150
|
-
recordToolSuccess('skip_webhooks', { skipped: true });
|
|
151
|
-
logger.info('Webhooks phase skipped');
|
|
152
|
-
}
|
|
153
|
-
// Get the next step after skipping
|
|
154
|
-
const nextOrchestrationResult = getNextStep();
|
|
155
|
-
if (nextOrchestrationResult.phase === 'complete') {
|
|
156
|
-
return formatComplete();
|
|
157
|
-
}
|
|
158
|
-
return formatInputNeeded(nextOrchestrationResult);
|
|
159
|
-
}
|
|
160
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
161
|
-
// Action: next (main flow)
|
|
162
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
163
|
-
if (actionType === 'next') {
|
|
164
|
-
// Step 1: Get orchestrator guidance
|
|
165
|
-
const orchestratorResult = getNextStep(inputData);
|
|
166
|
-
logger.info(`Orchestrator returned phase=${orchestratorResult.phase}, tool=${orchestratorResult.toolToCall}, needsInput=${orchestratorResult.needsInput}`);
|
|
167
|
-
// Step 2: Check if we're done
|
|
168
|
-
if (orchestratorResult.phase === 'complete') {
|
|
169
|
-
logger.info('Application development complete');
|
|
170
|
-
return formatComplete();
|
|
171
|
-
}
|
|
172
|
-
// Step 3: Check if user input is required
|
|
173
|
-
if (orchestratorResult.needsInput && !inputData) {
|
|
174
|
-
logger.info(`Input needed for ${orchestratorResult.toolToCall}: fields=${orchestratorResult.inputFields}`);
|
|
175
|
-
return formatInputNeeded(orchestratorResult);
|
|
176
|
-
}
|
|
177
|
-
// Step 4: Execute the tool
|
|
178
|
-
const toolName = orchestratorResult.toolToCall;
|
|
179
|
-
let toolArgs = { ...orchestratorResult.toolArgs };
|
|
180
|
-
logger.info(`[agent-chat] ── TOOL EXECUTION ──`);
|
|
181
|
-
logger.info(`[agent-chat] Tool: ${toolName}`);
|
|
182
|
-
logger.info(`[agent-chat] Orchestrator args: ${JSON.stringify(orchestratorResult.toolArgs)}`);
|
|
183
|
-
// If user provided input, merge it with orchestrator-provided args
|
|
184
|
-
if (inputData) {
|
|
185
|
-
logger.info(`[agent-chat] User inputData: ${JSON.stringify(inputData)}`);
|
|
186
|
-
toolArgs = { ...toolArgs, ...inputData };
|
|
187
|
-
logger.info(`[agent-chat] Merged args: ${JSON.stringify(toolArgs)}`);
|
|
188
|
-
}
|
|
189
|
-
// ── Normalize input field names ──────────────────────────────────
|
|
190
|
-
toolArgs = normalizeToolInput(toolName, toolArgs);
|
|
191
|
-
logger.info(`[agent-chat] Normalized args: ${JSON.stringify(toolArgs)}`);
|
|
192
|
-
// Find the tool from the registry
|
|
193
|
-
const tool = allDevTools.find((t) => t.name === toolName);
|
|
194
|
-
if (!tool) {
|
|
195
|
-
logger.error(`Tool not found: ${toolName}`);
|
|
196
|
-
return formatError(orchestratorResult, new Error(`Tool "${toolName}" not found in registry`), toolName);
|
|
197
|
-
}
|
|
198
|
-
// Validate & apply Zod defaults before executing.
|
|
199
|
-
// Direct MCP tool calls go through Zod automatically, but agent_chat
|
|
200
|
-
// bypasses that — so we parse here to ensure .default() values,
|
|
201
|
-
// type coercions, and validations all apply consistently.
|
|
202
|
-
let validatedArgs = toolArgs;
|
|
203
|
-
try {
|
|
204
|
-
validatedArgs = tool.inputSchema.parse(toolArgs);
|
|
205
|
-
logger.info(`[agent-chat] Zod validation passed for ${toolName}`);
|
|
206
|
-
}
|
|
207
|
-
catch (zodError) {
|
|
208
|
-
// If Zod rejects the input, log it but still try with raw args
|
|
209
|
-
// (some tools handle loose input gracefully)
|
|
210
|
-
logger.warn(`[agent-chat] Zod validation failed for ${toolName}, using raw args: ${zodError instanceof Error ? zodError.message : String(zodError)}`);
|
|
211
|
-
}
|
|
212
|
-
// Execute the tool
|
|
213
|
-
let toolResult;
|
|
214
|
-
const startTime = Date.now();
|
|
215
|
-
try {
|
|
216
|
-
toolResult = await tool.handler(validatedArgs);
|
|
217
|
-
const duration = Date.now() - startTime;
|
|
218
|
-
logger.info(`[agent-chat] Tool ${toolName} succeeded in ${duration}ms`);
|
|
219
|
-
logger.info(`[agent-chat] Tool ${toolName} result keys: ${toolResult ? JSON.stringify(Object.keys(toolResult)) : 'null'}`);
|
|
220
|
-
logger.debug(`[agent-chat] Tool ${toolName} full result: ${JSON.stringify(toolResult)?.slice(0, 3000)}`);
|
|
221
|
-
}
|
|
222
|
-
catch (error) {
|
|
223
|
-
const duration = Date.now() - startTime;
|
|
224
|
-
logger.error(`[agent-chat] Tool ${toolName} FAILED in ${duration}ms: ${error instanceof Error ? error.message : String(error)}`);
|
|
225
|
-
if (error instanceof Error && error.stack) {
|
|
226
|
-
logger.error(`[agent-chat] Stack: ${error.stack}`);
|
|
227
|
-
}
|
|
228
|
-
// If get_access_token fails, clear the stale auth code and allow re-request
|
|
229
|
-
if (toolName === 'get_access_token') {
|
|
230
|
-
const session = getSession();
|
|
231
|
-
session.context.authCode = undefined;
|
|
232
|
-
session.context.authCodeRedirectUri = undefined;
|
|
233
|
-
session.completedTools.delete('request_auth_code');
|
|
234
|
-
logger.info(`[agent-chat] Cleared stale authCode after ${toolName} failure — will re-request on next attempt`);
|
|
235
|
-
}
|
|
236
|
-
return formatError(orchestratorResult, error instanceof Error ? error : new Error(String(error)), toolName);
|
|
237
|
-
}
|
|
238
|
-
// Step 5: Check if the tool returned a soft error (error: true in result)
|
|
239
|
-
const resultObj = toolResult;
|
|
240
|
-
if (resultObj && resultObj.error === true) {
|
|
241
|
-
logger.error(`[agent-chat] Tool ${toolName} returned soft error: ${resultObj.message || 'Unknown error'}`);
|
|
242
|
-
return formatError(orchestratorResult, new Error(String(resultObj.message || `Tool "${toolName}" returned an error`)), toolName);
|
|
243
|
-
}
|
|
244
|
-
// Step 6: Record success and get next step
|
|
245
|
-
logger.info(`[agent-chat] Recording success for ${toolName} and getting next step...`);
|
|
246
|
-
recordToolSuccess(toolName, toolResult);
|
|
247
|
-
const nextOrchestrationResult = getNextStep();
|
|
248
|
-
logger.info(`[agent-chat] Next step after ${toolName}: phase=${nextOrchestrationResult.phase}, tool=${nextOrchestrationResult.toolToCall}`);
|
|
249
|
-
// Step 6a: Auto-chain request_auth_code → get_access_token
|
|
250
|
-
// Auth codes expire very quickly, so we must exchange immediately
|
|
251
|
-
// without returning to the LLM (which adds minutes of delay).
|
|
252
|
-
if (toolName === 'request_auth_code' &&
|
|
253
|
-
nextOrchestrationResult.toolToCall === 'get_access_token' &&
|
|
254
|
-
!nextOrchestrationResult.needsInput) {
|
|
255
|
-
logger.info(`[agent-chat] ── AUTO-CHAINING: request_auth_code → get_access_token ──`);
|
|
256
|
-
const chainToolName = 'get_access_token';
|
|
257
|
-
const chainTool = allDevTools.find((t) => t.name === chainToolName);
|
|
258
|
-
if (chainTool) {
|
|
259
|
-
let chainArgs = { ...nextOrchestrationResult.toolArgs };
|
|
260
|
-
chainArgs = normalizeToolInput(chainToolName, chainArgs);
|
|
261
|
-
logger.info(`[agent-chat] Chain tool args: ${JSON.stringify(chainArgs)}`);
|
|
262
|
-
try {
|
|
263
|
-
const chainValidatedArgs = chainTool.inputSchema.parse(chainArgs);
|
|
264
|
-
logger.info(`[agent-chat] Zod validation passed for chained ${chainToolName}`);
|
|
265
|
-
const chainStartTime = Date.now();
|
|
266
|
-
const chainResult = await chainTool.handler(chainValidatedArgs);
|
|
267
|
-
const chainDuration = Date.now() - chainStartTime;
|
|
268
|
-
logger.info(`[agent-chat] Chained tool ${chainToolName} succeeded in ${chainDuration}ms`);
|
|
269
|
-
// Check for soft error
|
|
270
|
-
const chainResultObj = chainResult;
|
|
271
|
-
if (chainResultObj && chainResultObj.error === true) {
|
|
272
|
-
logger.error(`[agent-chat] Chained ${chainToolName} returned soft error, clearing stale auth code`);
|
|
273
|
-
const session = getSession();
|
|
274
|
-
session.context.authCode = undefined;
|
|
275
|
-
session.context.authCodeRedirectUri = undefined;
|
|
276
|
-
return formatError(nextOrchestrationResult, new Error(String(chainResultObj.message || 'Token exchange failed')), chainToolName);
|
|
277
|
-
}
|
|
278
|
-
// Record success and continue
|
|
279
|
-
recordToolSuccess(chainToolName, chainResult);
|
|
280
|
-
const afterChainResult = getNextStep();
|
|
281
|
-
logger.info(`[agent-chat] Next step after auto-chain: phase=${afterChainResult.phase}, tool=${afterChainResult.toolToCall}`);
|
|
282
|
-
if (afterChainResult.phase === 'complete') {
|
|
283
|
-
return formatComplete();
|
|
284
|
-
}
|
|
285
|
-
return formatSuccess(afterChainResult, chainResult, chainToolName);
|
|
286
|
-
}
|
|
287
|
-
catch (chainError) {
|
|
288
|
-
logger.error(`[agent-chat] Chained ${chainToolName} FAILED: ${chainError instanceof Error ? chainError.message : String(chainError)}`);
|
|
289
|
-
// Clear the stale auth code so the orchestrator requests a fresh one on retry
|
|
290
|
-
const session = getSession();
|
|
291
|
-
session.context.authCode = undefined;
|
|
292
|
-
session.context.authCodeRedirectUri = undefined;
|
|
293
|
-
// Also remove request_auth_code from completed tools so it re-runs
|
|
294
|
-
session.completedTools.delete('request_auth_code');
|
|
295
|
-
logger.info(`[agent-chat] Cleared stale authCode and removed request_auth_code from completed tools`);
|
|
296
|
-
return formatError(nextOrchestrationResult, chainError instanceof Error ? chainError : new Error(String(chainError)), chainToolName);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
// Step 6b: Check if we're now complete
|
|
301
|
-
if (nextOrchestrationResult.phase === 'complete') {
|
|
302
|
-
logger.info('Application development complete after tool execution');
|
|
303
|
-
return formatComplete();
|
|
304
|
-
}
|
|
305
|
-
// Step 7: Return success with what's next
|
|
306
|
-
const successResponse = formatSuccess(nextOrchestrationResult, toolResult, toolName);
|
|
307
|
-
logger.info(`Returning success response. Next phase: ${nextOrchestrationResult.phase}`);
|
|
308
|
-
return successResponse;
|
|
309
|
-
}
|
|
310
|
-
// Default fallback (should not reach here with valid action enum)
|
|
311
|
-
return {
|
|
312
|
-
message: 'Invalid action. Please use "next", "skip", "status", or "reset".',
|
|
313
|
-
phase: getCurrentPhase(),
|
|
314
|
-
progress: { current: 0, total: 15, percentage: 0 },
|
|
315
|
-
needsInput: false,
|
|
316
|
-
error: `Unknown action: ${actionType}`,
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
catch (error) {
|
|
320
|
-
logger.error(`Unexpected error in agent-chat: ${error instanceof Error ? error.message : String(error)}`);
|
|
321
|
-
return {
|
|
322
|
-
message: 'An unexpected error occurred. Please try again or reset the session.',
|
|
323
|
-
phase: getCurrentPhase(),
|
|
324
|
-
progress: { current: 0, total: 15, percentage: 0 },
|
|
325
|
-
needsInput: false,
|
|
326
|
-
error: error instanceof Error ? error.message : String(error),
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* The unified agent-chat tool definition.
|
|
332
|
-
* This single tool replaces all 24+ individual dev tools by orchestrating them intelligently.
|
|
333
|
-
*/
|
|
334
|
-
export const agentChatTool = {
|
|
335
|
-
name: 'agent_chat',
|
|
336
|
-
description: `Unified interface for the entire Ratio app development lifecycle.
|
|
337
|
-
|
|
338
|
-
This is the SINGLE tool for building Ratio apps from start to finish. Instead of juggling 24+ individual tools, use this one conversational interface.
|
|
339
|
-
|
|
340
|
-
## The Workflow (9 Phases)
|
|
341
|
-
1. **Authentication** - Log in or sign up for your Ratio developer account
|
|
342
|
-
2. **App Setup** - Create your application and select categories
|
|
343
|
-
3. **Requirements** - Define your app's OAuth scopes and API access
|
|
344
|
-
4. **Webhooks** (optional) - Configure webhook subscriptions for real-time events
|
|
345
|
-
5. **Frontend Build** - Scaffold, build, and submit your React frontend
|
|
346
|
-
6. **Review Wait** - Your app goes under admin review
|
|
347
|
-
7. **Publish & OAuth** - Publish your approved app and complete the OAuth flow
|
|
348
|
-
8. **Backend Codegen** - Auto-generate NestJS backend from your scopes
|
|
349
|
-
9. **Complete** - You're done! Your app is live
|
|
350
|
-
|
|
351
|
-
## How to Use This Tool
|
|
352
|
-
|
|
353
|
-
### First Message
|
|
354
|
-
Just tell me what you want to build:
|
|
355
|
-
\`\`\`
|
|
356
|
-
{
|
|
357
|
-
"message": "I want to build an order management app",
|
|
358
|
-
"action": "next"
|
|
359
|
-
}
|
|
360
|
-
\`\`\`
|
|
361
|
-
|
|
362
|
-
### When Input is Requested
|
|
363
|
-
I'll ask for specific information. Provide it like this:
|
|
364
|
-
\`\`\`
|
|
365
|
-
{
|
|
366
|
-
"message": "Your email and password",
|
|
367
|
-
"input_data": {
|
|
368
|
-
"email": "dev@example.com",
|
|
369
|
-
"password": "yourpassword"
|
|
370
|
-
},
|
|
371
|
-
"action": "next"
|
|
372
|
-
}
|
|
373
|
-
\`\`\`
|
|
374
|
-
|
|
375
|
-
### Special Actions
|
|
376
|
-
- **"next"** (default): Proceed with the current step and advance to the next one
|
|
377
|
-
- **"skip"**: Skip the current phase (only webhooks can be skipped; it's optional)
|
|
378
|
-
- **"status"**: Check where you are without advancing
|
|
379
|
-
- **"reset"**: Start completely over from scratch
|
|
380
|
-
|
|
381
|
-
## Examples
|
|
382
|
-
|
|
383
|
-
### Start a new app
|
|
384
|
-
\`\`\`
|
|
385
|
-
{
|
|
386
|
-
"message": "Build a product inventory system",
|
|
387
|
-
"action": "next"
|
|
388
|
-
}
|
|
389
|
-
\`\`\`
|
|
390
|
-
|
|
391
|
-
### Choose login or signup
|
|
392
|
-
\`\`\`
|
|
393
|
-
{
|
|
394
|
-
"message": "I have an account",
|
|
395
|
-
"input_data": { "auth_mode": "login" },
|
|
396
|
-
"action": "next"
|
|
397
|
-
}
|
|
398
|
-
\`\`\`
|
|
399
|
-
or for new accounts:
|
|
400
|
-
\`\`\`
|
|
401
|
-
{
|
|
402
|
-
"message": "I need to create an account",
|
|
403
|
-
"input_data": { "auth_mode": "signup" },
|
|
404
|
-
"action": "next"
|
|
405
|
-
}
|
|
406
|
-
\`\`\`
|
|
407
|
-
|
|
408
|
-
### Provide credentials when asked
|
|
409
|
-
\`\`\`
|
|
410
|
-
{
|
|
411
|
-
"message": "Logging in",
|
|
412
|
-
"input_data": {
|
|
413
|
-
"email": "john@company.com",
|
|
414
|
-
"password": "mypassword"
|
|
415
|
-
},
|
|
416
|
-
"action": "next"
|
|
417
|
-
}
|
|
418
|
-
\`\`\`
|
|
419
|
-
|
|
420
|
-
### Skip optional webhooks phase
|
|
421
|
-
\`\`\`
|
|
422
|
-
{
|
|
423
|
-
"message": "Skip webhooks for now",
|
|
424
|
-
"action": "skip"
|
|
425
|
-
}
|
|
426
|
-
\`\`\`
|
|
427
|
-
|
|
428
|
-
### Check current progress
|
|
429
|
-
\`\`\`
|
|
430
|
-
{
|
|
431
|
-
"message": "Where are we?",
|
|
432
|
-
"action": "status"
|
|
433
|
-
}
|
|
434
|
-
\`\`\`
|
|
435
|
-
|
|
436
|
-
### Start over
|
|
437
|
-
\`\`\`
|
|
438
|
-
{
|
|
439
|
-
"message": "Start fresh",
|
|
440
|
-
"action": "reset"
|
|
441
|
-
}
|
|
442
|
-
\`\`\`
|
|
443
|
-
|
|
444
|
-
## Response Format
|
|
445
|
-
You'll get back a response with:
|
|
446
|
-
- \`message\` - Status/result description
|
|
447
|
-
- \`phase\` - Your current phase
|
|
448
|
-
- \`progress\` - Percentage of overall completion
|
|
449
|
-
- \`needsInput\` - Whether you need to provide data
|
|
450
|
-
- \`inputPrompt\` - What information is needed (if asking)
|
|
451
|
-
- \`inputFields\` - Which fields to fill
|
|
452
|
-
- \`data\` - Extracted results from the last tool (masked for security)
|
|
453
|
-
|
|
454
|
-
## Tips
|
|
455
|
-
- Follow the orchestrator's guidance on what's needed next
|
|
456
|
-
- Input fields are always listed in the response
|
|
457
|
-
- Sensitive data (tokens, secrets) is automatically masked in responses
|
|
458
|
-
- If you make a mistake, just provide the correct data on the next call
|
|
459
|
-
- Webhooks are optional; you can configure them later in the dashboard`,
|
|
460
|
-
inputSchema: agentChatSchema,
|
|
461
|
-
handler: handleAgentChat,
|
|
462
|
-
};
|
|
463
|
-
// Re-export allDevTools for any code that needs access to the underlying tools
|
|
464
|
-
export { allDevTools };
|
|
465
|
-
//# sourceMappingURL=agent-chat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat.js","sourceRoot":"","sources":["../../src/tools/agent-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,GAEb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,YAAY,GACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,GAGf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAC1B,qGAAqG;QACrG,8GAA8G,CAC/G;IACD,UAAU,EAAE,CAAC;SACV,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACnB,QAAQ,EAAE;SACV,QAAQ,CACP,wEAAwE;QACxE,gFAAgF;QAChF,kEAAkE;QAClE,sEAAsE,CACvE;IACH,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SACzC,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CACP,wDAAwD;QACxD,wDAAwD;QACxD,sDAAsD;QACtD,mCAAmC,CACpC;CACJ,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,SAAS,kBAAkB,CACzB,QAAgB,EAChB,IAA6B;IAE7B,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;IAE/B,IAAI,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,YAA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