(opts: {
userTimezone: string
connectorsInfo: string
gitRepoUrl: string | null
environmentsInfo: string
createdEnvironment: EnvironmentResource | null
setupNotes: string[]
needsGitHubAccessReminder: boolean
userArgs: string
})
| 133 | } |
| 134 | |
| 135 | function buildPrompt(opts: { |
| 136 | userTimezone: string |
| 137 | connectorsInfo: string |
| 138 | gitRepoUrl: string | null |
| 139 | environmentsInfo: string |
| 140 | createdEnvironment: EnvironmentResource | null |
| 141 | setupNotes: string[] |
| 142 | needsGitHubAccessReminder: boolean |
| 143 | userArgs: string |
| 144 | }): string { |
| 145 | const { |
| 146 | userTimezone, |
| 147 | connectorsInfo, |
| 148 | gitRepoUrl, |
| 149 | environmentsInfo, |
| 150 | createdEnvironment, |
| 151 | setupNotes, |
| 152 | needsGitHubAccessReminder, |
| 153 | userArgs, |
| 154 | } = opts |
| 155 | // When the user passes args, the initial AskUserQuestion dialog is skipped. |
| 156 | // Setup notes must surface in the prompt body instead, otherwise they're |
| 157 | // computed and silently discarded (regression vs. the old hard-block). |
| 158 | const setupNotesSection = |
| 159 | userArgs && setupNotes.length > 0 |
| 160 | ? `\n## Setup Notes\n\n${formatSetupNotes(setupNotes)}\n` |
| 161 | : '' |
| 162 | const initialQuestion = |
| 163 | setupNotes.length > 0 |
| 164 | ? `${formatSetupNotes(setupNotes)}\n\n${BASE_QUESTION}` |
| 165 | : BASE_QUESTION |
| 166 | const firstStep = userArgs |
| 167 | ? `The user has already told you what they want (see User Request at the bottom). Skip the initial question and go directly to the matching workflow.` |
| 168 | : `Your FIRST action must be a single ${ASK_USER_QUESTION_TOOL_NAME} tool call (no preamble). Use this EXACT string for the \`question\` field — do not paraphrase or shorten it: |
| 169 | |
| 170 | ${jsonStringify(initialQuestion)} |
| 171 | |
| 172 | Set \`header: "Action"\` and offer the four actions (create/list/update/run) as options. After the user picks, follow the matching workflow below.` |
| 173 | |
| 174 | return `# Schedule Remote Agents |
| 175 | |
| 176 | You are helping the user schedule, update, list, or run **remote** Claude Code agents. These are NOT local cron jobs — each trigger spawns a fully isolated remote session (CCR) in Anthropic's cloud infrastructure on a cron schedule. The agent runs in a sandboxed environment with its own git checkout, tools, and optional MCP connections. |
| 177 | |
| 178 | ## First Step |
| 179 | |
| 180 | ${firstStep} |
| 181 | ${setupNotesSection} |
| 182 | |
| 183 | ## What You Can Do |
| 184 | |
| 185 | Use the \`${REMOTE_TRIGGER_TOOL_NAME}\` tool (load it first with \`ToolSearch select:${REMOTE_TRIGGER_TOOL_NAME}\`; auth is handled in-process — do not use curl): |
| 186 | |
| 187 | - \`{action: "list"}\` — list all triggers |
| 188 | - \`{action: "get", trigger_id: "..."}\` — fetch one trigger |
| 189 | - \`{action: "create", body: {...}}\` — create a trigger |
| 190 | - \`{action: "update", trigger_id: "...", body: {...}}\` — partial update |
| 191 | - \`{action: "run", trigger_id: "..."}\` — run a trigger now |
| 192 |
no test coverage detected