@compilr-dev/sdk 0.10.15 → 0.10.17

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.
@@ -283,6 +283,20 @@ function validateQuestion(node, allNodes, errors) {
283
283
  nodeId: node.id,
284
284
  });
285
285
  }
286
+ // Proposal options exist to compare tradeoffs — they MUST have at
287
+ // least one pro or one con. An option with neither is a sign the
288
+ // agent should have used single mode with `choices[].description`
289
+ // (a label + explanation) rather than proposal mode (which is for
290
+ // comparing tradeoffs).
291
+ const hasPros = Array.isArray(opt.pros) && opt.pros.length > 0;
292
+ const hasCons = Array.isArray(opt.cons) && opt.cons.length > 0;
293
+ if (!hasPros && !hasCons) {
294
+ errors.push({
295
+ code: 'INVALID_NODE_TYPE',
296
+ message: `Question '${node.id}' option at index ${String(i)} ('${typeof opt.label === 'string' ? opt.label : opt.id}') has no pros or cons. Proposal mode is for comparing tradeoffs — every option needs at least one pro OR one con. If your options are just label + description (no tradeoffs to compare), use single mode with choices[].description instead.`,
297
+ nodeId: node.id,
298
+ });
299
+ }
286
300
  if (opt.icon !== undefined)
287
301
  checkIcon(opt.icon, node.id, errors);
288
302
  }
@@ -651,9 +665,15 @@ export function createInteractiveFlowTool(handler) {
651
665
  ' "next": "<nodeId>" // OR { "byAnswer": { "yes": "<id>", "no": "<id>" }, "default": "<id>" }\n' +
652
666
  ' }\n' +
653
667
  ' input.mode can be: single | multi | text | proposal\n' +
654
- ' - single/multi: choices[] required, each with id + label\n' +
655
- ' - proposal: options[] with id + label + optional pros[] + cons[]\n' +
656
- ' - text: placeholder + multiline optional\n\n' +
668
+ ' - single: choices[] (id + label, optional description + icon).\n' +
669
+ ' PICK THIS for "pick one from a list" even when each option has\n' +
670
+ ' a description. Descriptions belong on choices, not in proposal.\n' +
671
+ ' - multi: choices[] (same shape as single), optional min/max.\n' +
672
+ ' - proposal: options[] (id + label + pros[] + cons[]).\n' +
673
+ ' PICK THIS ONLY when each option has tradeoffs to compare\n' +
674
+ ' (at least one pro OR one con per option). If your options\n' +
675
+ ' are just label + description (no tradeoffs), use single mode.\n' +
676
+ ' - text: placeholder + multiline optional.\n\n' +
657
677
  '2. INFO (show, no input):\n' +
658
678
  ' { "type": "info", "id": "<id>", "title": "<header>", "body": "<markdown>", "next": "<nodeId>" }\n\n' +
659
679
  '3. BRANCH (pure routing, no UI):\n' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.10.15",
3
+ "version": "0.10.17",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "node": ">=20.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@compilr-dev/agents": "^0.5.8",
59
+ "@compilr-dev/agents": "^0.5.9",
60
60
  "@compilr-dev/logger": "^0.1.0",
61
61
  "@compilr-dev/sdk": "^0.10.2",
62
62
  "ajv": "^6.14.0",