@geekbeer/minion 3.29.4 → 3.30.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.
@@ -126,6 +126,8 @@ async function executeSkillNode(node) {
126
126
  input_data,
127
127
  revision_feedback,
128
128
  review_history,
129
+ input_contracts,
130
+ output_contracts,
129
131
  } = node
130
132
 
131
133
  console.log(
@@ -174,16 +176,18 @@ async function executeSkillNode(node) {
174
176
  }
175
177
  }
176
178
 
177
- // 4. Run the skill with input_data context
179
+ // 4. Run the skill with input_data and contract context
178
180
  const runPayload = {
179
181
  skill_name: skillName,
180
182
  execution_id,
181
183
  workflow_name: dag_workflow_name,
182
184
  role: assigned_role,
183
- // DAG-specific: inject input_data as context
185
+ // DAG-specific: inject input_data and contracts as context
184
186
  dag_node_id: node_id,
185
187
  dag_input_data: input_data,
186
188
  dag_node_execution_id: node_execution_id,
189
+ dag_input_contracts: input_contracts || null,
190
+ dag_output_contracts: output_contracts || null,
187
191
  }
188
192
  if (revision_feedback) {
189
193
  runPayload.revision_feedback = revision_feedback
@@ -251,6 +255,7 @@ async function executeTransformNode(node) {
251
255
  assigned_role,
252
256
  input_data,
253
257
  transform_instruction,
258
+ output_contracts,
254
259
  } = node
255
260
 
256
261
  console.log(
@@ -285,7 +290,7 @@ async function executeTransformNode(node) {
285
290
 
286
291
  // 2. Create ephemeral skill from transform_instruction.
287
292
  // Write to every active plugin's skill dir so any Primary can find it.
288
- const skillContent = buildTransformSkillContent(transform_instruction, input_data)
293
+ const skillContent = buildTransformSkillContent(transform_instruction, input_data, output_contracts)
289
294
  for (const dir of ephemeralSkillDirs) {
290
295
  await fs.mkdir(dir, { recursive: true })
291
296
  await fs.writeFile(path.join(dir, 'SKILL.md'), skillContent, 'utf-8')
@@ -353,8 +358,8 @@ async function executeTransformNode(node) {
353
358
  /**
354
359
  * Build SKILL.md content for a transform node's ephemeral skill.
355
360
  */
356
- function buildTransformSkillContent(instruction, inputData) {
357
- return [
361
+ function buildTransformSkillContent(instruction, inputData, outputContracts) {
362
+ const lines = [
358
363
  '---',
359
364
  'name: dag-transform',
360
365
  'description: DAG Transform Node',
@@ -369,12 +374,31 @@ function buildTransformSkillContent(instruction, inputData) {
369
374
  '',
370
375
  '## Transform Instruction',
371
376
  instruction,
377
+ ]
378
+
379
+ if (outputContracts && outputContracts.length > 0) {
380
+ lines.push('', '## Output Contract')
381
+ lines.push('Your output MUST conform to the following contract(s):')
382
+ for (const oc of outputContracts) {
383
+ lines.push(`### ${oc.contract_name}`)
384
+ lines.push(oc.contract.description || '')
385
+ lines.push('| Field | Type | Required | Description |')
386
+ lines.push('|-------|------|----------|-------------|')
387
+ for (const f of oc.contract.fields || []) {
388
+ lines.push(`| ${f.key} | ${f.type} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |`)
389
+ }
390
+ }
391
+ }
392
+
393
+ lines.push(
372
394
  '',
373
395
  '## Task',
374
396
  'Apply the transform instruction to the input data above.',
375
397
  'Output the result as a JSON object in an "## Output Data" section with a json code block.',
376
398
  'Do NOT output anything other than the Output Data section.',
377
- ].join('\n')
399
+ )
400
+
401
+ return lines.join('\n')
378
402
  }
379
403
 
380
404
  /**
@@ -344,6 +344,9 @@ async function skillRoutes(fastify, opts) {
344
344
  revision_feedback,
345
345
  review_history,
346
346
  dag_node_execution_id,
347
+ dag_input_data,
348
+ dag_input_contracts,
349
+ dag_output_contracts,
347
350
  } = request.body || {}
348
351
 
349
352
  if (!skill_name) {
@@ -393,6 +396,9 @@ async function skillRoutes(fastify, opts) {
393
396
  if (role) runOptions.role = role
394
397
  if (revision_feedback) runOptions.revisionFeedback = revision_feedback
395
398
  if (review_history && review_history.length > 0) runOptions.reviewHistory = review_history
399
+ if (dag_input_data) runOptions.dagInputData = dag_input_data
400
+ if (dag_input_contracts) runOptions.dagInputContracts = dag_input_contracts
401
+ if (dag_output_contracts) runOptions.dagOutputContracts = dag_output_contracts
396
402
 
397
403
  // Run asynchronously — respond immediately
398
404
  const executionPromise = (async () => {
@@ -92,7 +92,38 @@ async function executeWorkflowSession(workflow, executionId, skillNames, options
92
92
  revisionContext = `## Revision Feedback\nThe reviewer requested changes to your previous output. Address the following feedback:\n${options.revisionFeedback}\n\n`
93
93
  }
94
94
 
95
- const prompt = `${rolePrefix}${revisionContext}Run the following skills in order: ${skillCommands}.`
95
+ // Inject DAG input data context (data from upstream nodes)
96
+ let dagDataContext = ''
97
+ if (options.dagInputData && Object.keys(options.dagInputData).length > 0) {
98
+ dagDataContext = `## Input Data (from upstream nodes)\nThe following data was produced by upstream steps in this workflow. Use it as context for your task.\n\`\`\`json\n${JSON.stringify(options.dagInputData, null, 2)}\n\`\`\`\n\n`
99
+ }
100
+
101
+ // Inject DAG contract context (input/output contracts from edges)
102
+ let contractContext = ''
103
+ if (options.dagInputContracts && options.dagInputContracts.length > 0) {
104
+ contractContext += '## Input Contracts\nThe input data above conforms to the following contract(s):\n'
105
+ for (const ic of options.dagInputContracts) {
106
+ contractContext += `### ${ic.contract_name}\n${ic.contract.description || ''}\n`
107
+ contractContext += '| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n'
108
+ for (const f of ic.contract.fields || []) {
109
+ contractContext += `| ${f.key} | ${f.type} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |\n`
110
+ }
111
+ }
112
+ contractContext += '\n'
113
+ }
114
+ if (options.dagOutputContracts && options.dagOutputContracts.length > 0) {
115
+ contractContext += '## Output Contract\nYour output MUST conform to the following contract(s). Include all required fields in your execution report.\n'
116
+ for (const oc of options.dagOutputContracts) {
117
+ contractContext += `### ${oc.contract_name}\n${oc.contract.description || ''}\n`
118
+ contractContext += '| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n'
119
+ for (const f of oc.contract.fields || []) {
120
+ contractContext += `| ${f.key} | ${f.type} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |\n`
121
+ }
122
+ }
123
+ contractContext += '\n'
124
+ }
125
+
126
+ const prompt = `${rolePrefix}${revisionContext}${dagDataContext}${contractContext}Run the following skills in order: ${skillCommands}.`
96
127
 
97
128
  // Exit code file to capture CLI result
98
129
  const exitCodeFile = `/tmp/tmux-exit-${sessionName}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekbeer/minion",
3
- "version": "3.29.4",
3
+ "version": "3.30.0",
4
4
  "description": "AI Agent runtime for Minion - manages status and skill deployment on VPS",
5
5
  "main": "linux/server.js",
6
6
  "bin": {
@@ -99,7 +99,38 @@ async function executeWorkflowSession(workflow, executionId, skillNames, options
99
99
  revisionContext = `## Revision Feedback\nThe reviewer requested changes to your previous output. Address the following feedback:\n${options.revisionFeedback}\n\n`
100
100
  }
101
101
 
102
- const prompt = `${rolePrefix}${revisionContext}Run the following skills in order: ${skillCommands}.`
102
+ // Inject DAG input data context (data from upstream nodes)
103
+ let dagDataContext = ''
104
+ if (options.dagInputData && Object.keys(options.dagInputData).length > 0) {
105
+ dagDataContext = `## Input Data (from upstream nodes)\nThe following data was produced by upstream steps in this workflow. Use it as context for your task.\n\`\`\`json\n${JSON.stringify(options.dagInputData, null, 2)}\n\`\`\`\n\n`
106
+ }
107
+
108
+ // Inject DAG contract context (input/output contracts from edges)
109
+ let contractContext = ''
110
+ if (options.dagInputContracts && options.dagInputContracts.length > 0) {
111
+ contractContext += '## Input Contracts\nThe input data above conforms to the following contract(s):\n'
112
+ for (const ic of options.dagInputContracts) {
113
+ contractContext += `### ${ic.contract_name}\n${ic.contract.description || ''}\n`
114
+ contractContext += '| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n'
115
+ for (const f of ic.contract.fields || []) {
116
+ contractContext += `| ${f.key} | ${f.type} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |\n`
117
+ }
118
+ }
119
+ contractContext += '\n'
120
+ }
121
+ if (options.dagOutputContracts && options.dagOutputContracts.length > 0) {
122
+ contractContext += '## Output Contract\nYour output MUST conform to the following contract(s). Include all required fields in your execution report.\n'
123
+ for (const oc of options.dagOutputContracts) {
124
+ contractContext += `### ${oc.contract_name}\n${oc.contract.description || ''}\n`
125
+ contractContext += '| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n'
126
+ for (const f of oc.contract.fields || []) {
127
+ contractContext += `| ${f.key} | ${f.type} | ${f.required ? 'Yes' : 'No'} | ${f.description || ''} |\n`
128
+ }
129
+ }
130
+ contractContext += '\n'
131
+ }
132
+
133
+ const prompt = `${rolePrefix}${revisionContext}${dagDataContext}${contractContext}Run the following skills in order: ${skillCommands}.`
103
134
 
104
135
  const logFile = logManager.getLogPath(executionId)
105
136