create-loopengine 0.1.69 → 0.1.70
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/template/adapters/http.ts +2 -31
- package/template/package.json +1 -1
package/package.json
CHANGED
|
@@ -130,12 +130,11 @@ import {
|
|
|
130
130
|
setAgentApprovers,
|
|
131
131
|
listAgentSlackMembers,
|
|
132
132
|
replyPrivatelyInSlack,
|
|
133
|
+
slackArgs,
|
|
133
134
|
type MessagingDecision,
|
|
134
135
|
type DecisionOutcome,
|
|
135
136
|
type MessagingDeps,
|
|
136
137
|
handleMessagingAction,
|
|
137
|
-
agentConfirmTools,
|
|
138
|
-
setAgentConfirmTools,
|
|
139
138
|
openSlackAnswerModal,
|
|
140
139
|
parseSlackInteraction,
|
|
141
140
|
replyInSlack,
|
|
@@ -1291,28 +1290,6 @@ async function handleApproversPut(req: IncomingMessage, res: ServerResponse, age
|
|
|
1291
1290
|
}
|
|
1292
1291
|
}
|
|
1293
1292
|
|
|
1294
|
-
// Messaging tab → Confirm-required tools: tools whose approval by reply
|
|
1295
|
-
// needs a Confirm click. Admin login needed, like the approvers.
|
|
1296
|
-
async function handleConfirmToolsPut(req: IncomingMessage, res: ServerResponse, agentName: string): Promise<void> {
|
|
1297
|
-
const entry = getEntry(agentName)
|
|
1298
|
-
if (!entry) {
|
|
1299
|
-
res.writeHead(404, { 'content-type': 'application/json' }).end(JSON.stringify({ error: `unknown agent '${agentName}'` }))
|
|
1300
|
-
return
|
|
1301
|
-
}
|
|
1302
|
-
if (!secretsProtected) {
|
|
1303
|
-
res.writeHead(403, { 'content-type': 'application/json' }).end(JSON.stringify({ error: 'Changing Confirm-required tools needs LOOPENGINE_ADMIN_AUTH set on the server.' }))
|
|
1304
|
-
return
|
|
1305
|
-
}
|
|
1306
|
-
const body = await readJsonBody(req)
|
|
1307
|
-
try {
|
|
1308
|
-
const tools = setAgentConfirmTools(entry.config, body.tools)
|
|
1309
|
-
res.writeHead(200, { 'content-type': 'application/json' }).end(JSON.stringify({ tools }))
|
|
1310
|
-
} catch (err) {
|
|
1311
|
-
const status = err instanceof NotifierFileError ? 400 : 500
|
|
1312
|
-
res.writeHead(status, { 'content-type': 'application/json' }).end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }))
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
1293
|
async function handleSlackMembers(res: ServerResponse, agentName: string): Promise<void> {
|
|
1317
1294
|
const entry = getEntry(agentName)
|
|
1318
1295
|
if (!entry) {
|
|
@@ -2817,7 +2794,7 @@ async function handleSlackInteraction(req: IncomingMessage, res: ServerResponse,
|
|
|
2817
2794
|
let ran = ''
|
|
2818
2795
|
if (interaction.type === 'decide' && interaction.decision === 'approve') {
|
|
2819
2796
|
const item = (await checkpoints.get(interaction.pendingId))?.outstanding[interaction.pendingId]
|
|
2820
|
-
if (item) ran = `\nRan \`${item.tool}\` with
|
|
2797
|
+
if (item) ran = `\nRan \`${item.tool}\` with:\n${slackArgs(item.args, (await resolveAgentTool(entry.config, item.tool))?.input_schema)}`
|
|
2821
2798
|
}
|
|
2822
2799
|
const capture = captureResponse()
|
|
2823
2800
|
if (interaction.type === 'decide') await resolvePendingApproval(capture.res, interaction.pendingId, { decision: interaction.decision })
|
|
@@ -2880,7 +2857,6 @@ function slackMessagingDeps(agentName: string, entry: RegistryEntry, botToken: s
|
|
|
2880
2857
|
getHistory: (checkpoint) => sessions.getHistory(`${checkpoint.tenant}:${environment}:${checkpoint.agent}:${checkpoint.sessionId}`),
|
|
2881
2858
|
plan: process.env.LOOPENGINE_PLAN,
|
|
2882
2859
|
approvers: () => agentApprovers(entry.config),
|
|
2883
|
-
confirmTools: () => agentConfirmTools(entry.config),
|
|
2884
2860
|
decide: decideFromMessaging,
|
|
2885
2861
|
toolSchema: async (toolName) => (await resolveAgentTool(entry.config, toolName))?.input_schema,
|
|
2886
2862
|
// The same checks the console's approve-with-edits applies, plus the
|
|
@@ -3474,11 +3450,6 @@ const server = createServer(async (req, res) => {
|
|
|
3474
3450
|
await handleApproversPut(req, res, decodeURIComponent(approversMatch[1]))
|
|
3475
3451
|
return
|
|
3476
3452
|
}
|
|
3477
|
-
const confirmToolsMatch = req.method === 'PUT' && pathname.match(/^\/agents\/([^/]+)\/notifier\/confirm-tools$/)
|
|
3478
|
-
if (confirmToolsMatch) {
|
|
3479
|
-
await handleConfirmToolsPut(req, res, decodeURIComponent(confirmToolsMatch[1]))
|
|
3480
|
-
return
|
|
3481
|
-
}
|
|
3482
3453
|
const slackMembersMatch = req.method === 'GET' && pathname.match(/^\/agents\/([^/]+)\/notifier\/slack-members$/)
|
|
3483
3454
|
if (slackMembersMatch) {
|
|
3484
3455
|
await handleSlackMembers(res, decodeURIComponent(slackMembersMatch[1]))
|