(defaultDirectory)
| 1627 | if (name === "loop-stop" || name === "loop-remove") return await stopLoop(directory, client, sessionID, args), handled() |
| 1628 | if (name === "loop-clear") return await stopLoop(directory, client, sessionID, "all"), handled() |
| 1629 | if (name === "loop-status") return await statusLoop(directory, client, sessionID), handled() |
| 1630 | if (name === "loop-logs") return await logsLoop(directory, client, sessionID), handled() |
| 1631 | if (name === "loop-help") return await helpLoop(client, sessionID), handled() |
| 1632 | if (name === "loop-now") return await runNow(directory, client, sessionID, args), handled() |
| 1633 | if (name === "loop-pause") return await updateJobState(directory, client, sessionID, args, (job) => ({ ...job, paused: true }), "Paused"), handled() |
| 1634 | if (name === "loop-resume") return await updateJobState(directory, client, sessionID, args, (job) => ({ ...job, paused: false, lastRunAt: 0 }), "Resumed"), handled() |
| 1635 | if (name === "loop-doctor") return await doctorLoop(directory, client, sessionID), handled() |
| 1636 | if (name === "loop-init") return await initLoop(directory, client, sessionID, args), handled() |
| 1637 | if (name === "loop-export") return await exportLoop(directory, client, sessionID), handled() |
| 1638 | handledCommands.delete(commandKey(sessionID, name, args)) |
| 1639 | return false |
| 1640 | } |
| 1641 | |
| 1642 | function goalTools(defaultDirectory) { |
| 1643 | return { |
| 1644 | opencode_loop_goal_complete: tool({ |
| 1645 | description: "Mark the current OpenCode Loop experimental goal as completed. Use only after acceptance criteria are satisfied and you have evidence from tests, typecheck, build, or code inspection.", |
| 1646 | args: { |
| 1647 | summary: tool.schema.string().describe("Short human-readable summary of what was completed."), |
| 1648 | evidence: tool.schema.string().describe("Concrete evidence that the goal is complete, such as commands run, passing checks, files changed, and important results."), |
| 1649 | }, |
| 1650 | execute: async (args, context) => { |
| 1651 | const result = await setGoalComplete(context.directory || defaultDirectory, context.sessionID, args) |
| 1652 | return { title: result.ok ? "Goal completed" : "Goal not found", output: result.message } |
| 1653 | }, |
| 1654 | }), |
| 1655 | opencode_loop_goal_blocked: tool({ |
| 1656 | description: "Mark the current OpenCode Loop experimental goal as blocked when user input or manual intervention is required.", |
| 1657 | args: { |
| 1658 | reason: tool.schema.string().describe("Why the goal is blocked."), |
| 1659 | needed: tool.schema.string().describe("What user input, credential, decision, or manual action is needed to continue."), |
| 1660 | }, |
| 1661 | execute: async (args, context) => { |
| 1662 | const result = await setGoalBlocked(context.directory || defaultDirectory, context.sessionID, args) |
| 1663 | return { title: result.ok ? "Goal blocked" : "Goal not found", output: result.message } |
| 1664 | }, |
| 1665 | }), |
| 1666 | opencode_loop_goal_progress: tool({ |
| 1667 | description: "Record meaningful progress on the current OpenCode Loop experimental goal without completing it.", |
| 1668 | args: { |
no test coverage detected