create-loopengine 0.1.70 → 0.1.72

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-loopengine",
3
- "version": "0.1.70",
3
+ "version": "0.1.72",
4
4
  "description": "Scaffold a new loopengine agent project — a runnable HTTP server with one example agent, in your own repo.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -135,6 +135,8 @@ import {
135
135
  type DecisionOutcome,
136
136
  type MessagingDeps,
137
137
  handleMessagingAction,
138
+ settleThreadChoice,
139
+ describeChange,
138
140
  openSlackAnswerModal,
139
141
  parseSlackInteraction,
140
142
  replyInSlack,
@@ -2296,8 +2298,10 @@ async function resolvePendingApproval(res: ServerResponse, pendingId: string, bo
2296
2298
  // The agent's own history still shows the arguments it asked
2297
2299
  // for, so say when the approver changed them; otherwise its
2298
2300
  // reply describes what it asked for, not what ran.
2299
- const changed = editedArgs && JSON.stringify(editedArgs) !== JSON.stringify(item.args)
2300
- const content = changed ? `The approver changed the arguments before it ran: ${JSON.stringify(editedArgs)}. Result: ${JSON.stringify(output)}` : JSON.stringify(output)
2301
+ const changes = editedArgs ? describeChange(item.args, editedArgs) : []
2302
+ const content = changes.length
2303
+ ? `A person approved this call after changing its arguments (${changes.join('; ')}). It ran with ${JSON.stringify(editedArgs)}. Result: ${JSON.stringify(output)}`
2304
+ : JSON.stringify(output)
2301
2305
  resultBlock = { type: 'tool_result', tool_use_id: item.toolUseId, content, is_error: false }
2302
2306
  } catch (err) {
2303
2307
  resultBlock = { type: 'tool_result', tool_use_id: item.toolUseId, content: `ERROR: ${err}`, is_error: true }
@@ -2800,6 +2804,12 @@ async function handleSlackInteraction(req: IncomingMessage, res: ServerResponse,
2800
2804
  if (interaction.type === 'decide') await resolvePendingApproval(capture.res, interaction.pendingId, { decision: interaction.decision })
2801
2805
  else await answerPendingQuestion(capture.res, interaction.pendingId, { answer: interaction.answer })
2802
2806
  const outcome = await capture.done
2807
+ // A proposed change or a Confirm still waiting in the thread no longer
2808
+ // applies: replace it so its buttons don't linger.
2809
+ if (botToken && outcome.status < 400 && !outcome.body.alreadyResolved) {
2810
+ const done = interaction.type === 'decide' ? (interaction.decision === 'approve' ? 'Approved' : 'Denied') : 'Answered'
2811
+ await settleThreadChoice(slackMessagingDeps(agentName, entry, botToken), interaction.pendingId, `${done}${interaction.user ? ` by <@${interaction.user}>` : ''} with the request's own buttons.`).catch((err) => console.error('[loopengine] Slack update failed:', err))
2812
+ }
2803
2813
  if (interaction.responseUrl) {
2804
2814
  let text = slackOutcomeText(interaction.type === 'decide' ? interaction.decision : 'answer', outcome.status, outcome.body, interaction.user)
2805
2815
  if (ran && outcome.status < 400 && !outcome.body.alreadyResolved) text += ran
@@ -9,7 +9,7 @@
9
9
  "cli": "tsx adapters/cli.ts"
10
10
  },
11
11
  "dependencies": {
12
- "loopengine": "^0.1.86",
12
+ "loopengine": "^0.1.89",
13
13
  "actauth": "^0.0.12",
14
14
  "tsx": "^4.19.0",
15
15
  "typescript": "^5.7.0"