@biznetgio/neo-app 0.4.46 → 0.4.47
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/package.json +1 -1
- package/src/mcp/tools.js +10 -4
package/package.json
CHANGED
package/src/mcp/tools.js
CHANGED
|
@@ -1406,23 +1406,29 @@ export const TOOLS = [
|
|
|
1406
1406
|
},
|
|
1407
1407
|
{
|
|
1408
1408
|
name: 'neo_wait_operation',
|
|
1409
|
-
description: 'Wait for a stack apply (
|
|
1409
|
+
description: 'Wait for an operation — a stack apply (neo_apply_stack) OR a project deletion (neo_apply_project_deletion) — to finish: polls until the status is terminal (applied | partial | failed) or the timeout elapses, then returns the final operation with per-resource status (secrets redacted). Pass afterRevision to also return as soon as the operation advances past a revision you already saw (resume observation after a disconnect). Convenience over polling neo_get_operation yourself.',
|
|
1410
1410
|
mutating: false,
|
|
1411
1411
|
schema: {
|
|
1412
1412
|
type: 'object',
|
|
1413
|
-
properties: {
|
|
1413
|
+
properties: {
|
|
1414
|
+
operationId: str('Operation id (= plan id)'),
|
|
1415
|
+
timeoutMs: int('Max wait in milliseconds (default 180000)'),
|
|
1416
|
+
afterRevision: int('Return as soon as the operation revision exceeds this (resume observation); omit to wait for a terminal status'),
|
|
1417
|
+
},
|
|
1414
1418
|
required: ['operationId'],
|
|
1415
1419
|
},
|
|
1416
1420
|
async call(api, args) {
|
|
1417
1421
|
const deadline = Date.now() + (args.timeoutMs && args.timeoutMs > 0 ? args.timeoutMs : 180000);
|
|
1418
1422
|
const terminal = new Set(['applied', 'partial', 'failed']);
|
|
1423
|
+
const after = Number.isInteger(args.afterRevision) ? args.afterRevision : undefined;
|
|
1419
1424
|
let op;
|
|
1420
1425
|
for (;;) {
|
|
1421
1426
|
op = redactSecrets((await api.get(`/api/v1/plans/${args.operationId}`)).data);
|
|
1422
|
-
|
|
1427
|
+
const advanced = after !== undefined && typeof op.revision === 'number' && op.revision > after;
|
|
1428
|
+
if (terminal.has(op.status) || advanced || Date.now() >= deadline) break;
|
|
1423
1429
|
await new Promise((r) => setTimeout(r, 5000));
|
|
1424
1430
|
}
|
|
1425
|
-
if (op && !terminal.has(op.status)) return { ...op, timedOut: true, note: 'still in progress at timeout — call neo_get_operation again' };
|
|
1431
|
+
if (op && !terminal.has(op.status) && Date.now() >= deadline) return { ...op, timedOut: true, note: 'still in progress at timeout — call neo_get_operation again' };
|
|
1426
1432
|
return op;
|
|
1427
1433
|
},
|
|
1428
1434
|
},
|