@thehammer/schema-mcp-server 1.0.9 → 1.0.10

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.
@@ -38,6 +38,31 @@ export declare function getTemplatePreviewHtml(templateId: number, teamObjectId?
38
38
  export declare function getStyleList(): Promise<ApiResponse>;
39
39
  export declare function listQualityGateItems(): Promise<ApiResponse>;
40
40
  export declare function submitQualityGateReview(itemId: number, status: string, analysis: string, message?: string): Promise<ApiResponse>;
41
+ /**
42
+ * Check (or kick off) quality gate review for a single category.
43
+ *
44
+ * NON-BLOCKING. A single HTTP round-trip. The agent NEVER waits inside MCP —
45
+ * blocking hides dispatch failures behind timeouts and ties up the agent when
46
+ * it could be doing other productive work.
47
+ *
48
+ * Returns one of:
49
+ * - `passed` — all items green (cache hit or fresh review)
50
+ * - `failed` — items need fixes; response includes each item's `analysis`
51
+ * - `running` — a reviewer is dispatched (or already in flight); call again later
52
+ * - `error` — a prior reviewer dispatch failed at this iteration; manual
53
+ * intervention needed. Do NOT retry on this category; surface to the user
54
+ * via an annotation.
55
+ *
56
+ * Recommended pattern:
57
+ * 1. Call `quality_gate(A)` — reviewer is launched by the backend on the
58
+ * first running-with-pending-items response
59
+ * 2. Do other productive work (work on other categories, read annotations,
60
+ * preview templates, call `quality_gate(B)` in parallel)
61
+ * 3. Call `quality_gate(A)` again later to poll. The backend is idempotent:
62
+ * won't launch a second reviewer while the first is running.
63
+ * 4. When the agent has no other productive work, it still polls — each poll
64
+ * is cheap, short, and carries minimal context.
65
+ */
41
66
  export declare function callQualityGate(category: string, message?: string): Promise<ApiResponse>;
42
67
  /**
43
68
  * Orchestrator finalization — mandatory last action before exit.
@@ -180,55 +180,33 @@ export async function submitQualityGateReview(itemId, status, analysis, message)
180
180
  /**
181
181
  * Check (or kick off) quality gate review for a single category.
182
182
  *
183
- * BLOCKING BY DESIGN. This call dispatches a reviewer (if one isn't already
184
- * running) and then polls the backend until the gate for that category reaches
185
- * a terminal state (`passed`, `failed`, or `error`). The agent sees exactly
186
- * one call per category — no polling loop in agent context, no wasted context
187
- * on intermediate `running` responses.
183
+ * NON-BLOCKING. A single HTTP round-trip. The agent NEVER waits inside MCP
184
+ * blocking hides dispatch failures behind timeouts and ties up the agent when
185
+ * it could be doing other productive work.
188
186
  *
189
187
  * Returns one of:
190
- * - `passed` — all items green (cache hit or fresh review)
191
- * - `failed` — items need fixes (with `analysis`)
192
- * - `error` — a prior reviewer dispatch failed at this iteration; manual
193
- * intervention needed (the agent must surface this to the user)
188
+ * - `passed` — all items green (cache hit or fresh review)
189
+ * - `failed` — items need fixes; response includes each item's `analysis`
190
+ * - `running` — a reviewer is dispatched (or already in flight); call again later
191
+ * - `error` a prior reviewer dispatch failed at this iteration; manual
192
+ * intervention needed. Do NOT retry on this category; surface to the user
193
+ * via an annotation.
194
194
  *
195
- * Polling cadence: POLL_INTERVAL_MS between requests, capped at MAX_POLL_MS
196
- * total wall time. If the cap is reached the function returns a synthetic
197
- * `timeout` status so the agent doesn't hang forever.
195
+ * Recommended pattern:
196
+ * 1. Call `quality_gate(A)` reviewer is launched by the backend on the
197
+ * first running-with-pending-items response
198
+ * 2. Do other productive work (work on other categories, read annotations,
199
+ * preview templates, call `quality_gate(B)` in parallel)
200
+ * 3. Call `quality_gate(A)` again later to poll. The backend is idempotent:
201
+ * won't launch a second reviewer while the first is running.
202
+ * 4. When the agent has no other productive work, it still polls — each poll
203
+ * is cheap, short, and carries minimal context.
198
204
  */
199
- const QUALITY_GATE_POLL_INTERVAL_MS = 3_000;
200
- const QUALITY_GATE_MAX_POLL_MS = 15 * 60 * 1_000; // 15 minutes
201
205
  export async function callQualityGate(category, message) {
202
- const terminal = new Set(["passed", "failed", "error", "timeout"]);
203
- const deadline = Date.now() + QUALITY_GATE_MAX_POLL_MS;
204
- let attempt = 0;
205
- while (true) {
206
- attempt += 1;
207
- // Only pass the agent-authored message on the FIRST call — subsequent
208
- // polls are internal and shouldn't spam the backend logs with duplicates.
209
- const body = { category };
210
- if (attempt === 1 && message) {
211
- body.message = message;
212
- }
213
- const result = await apiRequest("POST", mcpPath("quality-gate"), body);
214
- const status = String(result.status ?? "");
215
- if (terminal.has(status)) {
216
- return result;
217
- }
218
- if (status !== "running") {
219
- // Unknown status — surface it verbatim so bugs are loud rather
220
- // than swallowed by the polling loop.
221
- return result;
222
- }
223
- if (Date.now() >= deadline) {
224
- return {
225
- ...result,
226
- status: "timeout",
227
- message: `quality_gate(${category}) did not reach a terminal state within ${QUALITY_GATE_MAX_POLL_MS / 1000}s. The reviewer dispatch may be stuck — check dispatch status and retry.`,
228
- };
229
- }
230
- await new Promise((resolve) => setTimeout(resolve, QUALITY_GATE_POLL_INTERVAL_MS));
231
- }
206
+ return apiRequest("POST", mcpPath("quality-gate"), {
207
+ category,
208
+ message,
209
+ });
232
210
  }
233
211
  /**
234
212
  * Orchestrator finalization — mandatory last action before exit.
package/dist/index.js CHANGED
@@ -681,20 +681,18 @@ if (shouldRegister("quality_gate_submit_review"))
681
681
  return jsonResult(result);
682
682
  });
683
683
  if (shouldRegister("quality_gate"))
684
- server.tool("quality_gate", "Run the quality gate for a single category (schema, directive, or template). " +
685
- "BLOCKING — this call dispatches a reviewer (if one isn't already running) and waits " +
686
- "until the gate reaches a terminal state. You receive ONE response per call: never " +
687
- "poll the same category repeatedly. Response statuses: " +
688
- "'passed' means all items are green (safe to move on); " +
684
+ server.tool("quality_gate", "Dispatch or poll the quality gate for a single category (schema, directive, or template). " +
685
+ "NON-BLOCKING — the call returns immediately. Response statuses: " +
686
+ "'passed' means all items in the category are green (safe to move on); " +
687
+ "'running' means a reviewer was dispatched (or one is already in flight) — do other " +
688
+ "productive work, then call this tool again later to check status; " +
689
689
  "'failed' means items need fixes — read each item's `analysis`, apply fixes via " +
690
690
  "mutation tools (which auto-invalidate the category), then call this tool again; " +
691
691
  "'error' means the reviewer dispatch itself failed — surface the error to the user " +
692
- "and stop (do NOT retry the same category); " +
693
- "'timeout' means the call hit its 15-minute wall-time cap the reviewer may be " +
694
- "stuck, report it and move on. " +
695
- "Parallelism is still available via concurrent tool calls for DIFFERENT categories " +
696
- "(e.g. schema + directive in parallel). Do NOT call this tool twice for the same " +
697
- "category before the first call returns.", {
692
+ "via an annotation and stop on that category (do NOT retry). " +
693
+ "You may call this for multiple categories in parallel. The backend is idempotent " +
694
+ "calling while a reviewer is running returns 'running' without launching a duplicate. " +
695
+ "When you have no other productive work, continue polling each call is cheap.", {
698
696
  category: z
699
697
  .enum(["schema", "directive", "template"])
700
698
  .describe("The quality gate category to check. Must be one of: schema, directive, template."),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thehammer/schema-mcp-server",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "MCP server for Schema Builder - translates Claude Code tool calls into Laravel API requests",
5
5
  "license": "MIT",
6
6
  "repository": {