robotrock 0.8.4 → 0.9.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.
- package/README.md +56 -0
- package/dist/ai/index.d.ts +4 -4
- package/dist/ai/index.js +398 -202
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/trigger.d.ts +3 -3
- package/dist/ai/trigger.js +398 -202
- package/dist/ai/trigger.js.map +1 -1
- package/dist/ai/workflow.d.ts +3 -3
- package/dist/ai/workflow.js +399 -203
- package/dist/ai/workflow.js.map +1 -1
- package/dist/{client-D-XEBOWd.d.ts → client-Cy7YLxms.d.ts} +17 -9
- package/dist/index.d.ts +76 -9
- package/dist/index.js +337 -208
- package/dist/index.js.map +1 -1
- package/dist/otel-platform-DzHyHkGk.d.ts +108 -0
- package/dist/schemas/index.d.ts +162 -104
- package/dist/schemas/index.js +39 -114
- package/dist/schemas/index.js.map +1 -1
- package/dist/{tool-approval-bridge-BKDY5NAY.d.ts → tool-approval-bridge-G765kMJR.d.ts} +1 -1
- package/dist/trigger/index.d.ts +6 -4
- package/dist/trigger/index.js +308 -145
- package/dist/trigger/index.js.map +1 -1
- package/dist/{trigger-CsOLTjsH.d.ts → trigger-D0shjqk0.d.ts} +2 -2
- package/dist/workflow/index.d.ts +6 -4
- package/dist/workflow/index.js +302 -142
- package/dist/workflow/index.js.map +1 -1
- package/package.json +1 -5
- package/dist/handler-webhook-BqEi6Bk-.d.ts +0 -16
- package/dist/otel/index.d.ts +0 -49
- package/dist/otel/index.js +0 -633
- package/dist/otel/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -186,6 +186,9 @@ await robotrock.cancelTask("task_...");
|
|
|
186
186
|
import {
|
|
187
187
|
verifyRobotRockWebhook,
|
|
188
188
|
RobotRockWebhookError,
|
|
189
|
+
isPlatformTerminalAction,
|
|
190
|
+
isPlatformRejectRequestAction,
|
|
191
|
+
parsePlatformRejectRequestData,
|
|
189
192
|
type RobotRockWebhookPayload,
|
|
190
193
|
} from "robotrock";
|
|
191
194
|
|
|
@@ -193,6 +196,19 @@ export async function POST(request: Request) {
|
|
|
193
196
|
try {
|
|
194
197
|
const payload: RobotRockWebhookPayload = await verifyRobotRockWebhook(request);
|
|
195
198
|
console.log(payload.action.id, payload.headers["x-request-id"]);
|
|
199
|
+
|
|
200
|
+
// Always stop the agent for inbox platform actions (not your task's approve/reject ids)
|
|
201
|
+
if (isPlatformRejectRequestAction(payload.action.id)) {
|
|
202
|
+
const { feedback } = parsePlatformRejectRequestData(payload.action.data) ?? {
|
|
203
|
+
feedback: "",
|
|
204
|
+
};
|
|
205
|
+
// log and abort — do not continue the workflow
|
|
206
|
+
return Response.json({ ok: true, stopped: true, feedback });
|
|
207
|
+
}
|
|
208
|
+
if (isPlatformTerminalAction(payload.action.id)) {
|
|
209
|
+
return Response.json({ ok: true, stopped: true });
|
|
210
|
+
}
|
|
211
|
+
|
|
196
212
|
return Response.json({ ok: true });
|
|
197
213
|
} catch (error) {
|
|
198
214
|
if (error instanceof RobotRockWebhookError) {
|
|
@@ -203,6 +219,46 @@ export async function POST(request: Request) {
|
|
|
203
219
|
}
|
|
204
220
|
```
|
|
205
221
|
|
|
222
|
+
## Platform terminal actions
|
|
223
|
+
|
|
224
|
+
Reviewers can close a task from the inbox **without** choosing one of your defined actions. These reserved `action.id` values arrive on webhooks, polling, and `getTask()` — **always stop your agent** when you see them:
|
|
225
|
+
|
|
226
|
+
| Constant | Action ID | Meaning |
|
|
227
|
+
|----------|-----------|---------|
|
|
228
|
+
| `PLATFORM_MARK_DONE_ACTION_ID` | `robotrock:mark-done` | Closed manually; `data` is `{}` |
|
|
229
|
+
| `PLATFORM_REJECT_REQUEST_ACTION_ID` | `robotrock:reject-request` | Bad request; `data.feedback` is required |
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import {
|
|
233
|
+
isPlatformTerminalAction,
|
|
234
|
+
parseHandledOutcome,
|
|
235
|
+
assertNotPlatformRejectRequest,
|
|
236
|
+
shouldStopAgentForHandledAction,
|
|
237
|
+
} from "robotrock";
|
|
238
|
+
|
|
239
|
+
const result = await robotrock.sendToHuman({ ... });
|
|
240
|
+
|
|
241
|
+
if (result.mode === "handled") {
|
|
242
|
+
assertNotPlatformRejectRequest(result.actionId, result.data); // throws PlatformRejectRequestError
|
|
243
|
+
|
|
244
|
+
if (shouldStopAgentForHandledAction(result.actionId)) {
|
|
245
|
+
return; // mark-done or reject-request — do not continue
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const outcome = parseHandledOutcome({
|
|
249
|
+
actionId: result.actionId,
|
|
250
|
+
data: result.data,
|
|
251
|
+
handledBy: result.handledBy,
|
|
252
|
+
handledAt: result.handledAt,
|
|
253
|
+
});
|
|
254
|
+
if (outcome.source === "platform") {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
See [Platform actions](https://docs.robotrock.io/webhooks#platform-action-ids) in the docs.
|
|
261
|
+
|
|
206
262
|
## Trigger.dev
|
|
207
263
|
|
|
208
264
|
Install `@trigger.dev/sdk`, re-export SDK tasks from your `trigger/` directory, and call them with `triggerAndWait()`:
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as CreateRobotRockAiToolsOptions, R as RobotRockAiTools, a as approveByHumanTool, c as createRobotRockAiTools, b as createSendToHumanTool, d as createSendUpdateTool } from '../trigger-
|
|
2
|
-
import { p as RobotRockToolCallInfo, F as FormatToolApprovalTaskOptions, H as HumanToolResult } from '../tool-approval-bridge-
|
|
3
|
-
export { q as APPROVE_BY_HUMAN_ACTIONS, A as ApproveByHumanToolDurableOptions, a as ApproveByHumanToolOptions, e as CreateSendToHumanToolDurableOptions, C as CreateSendToHumanToolOptions, f as CreateSendUpdateToolDurableOptions, c as CreateSendUpdateToolOptions, s as ResolveToolApprovalsOptions, g as RobotRockAiContext, h as RobotRockAiMode, i as RobotRockAiPollingContext, j as RobotRockAiTriggerContext, R as RobotRockAiWorkflowContext, t as RobotRockToolApprovalConfig, u as RobotRockToolApprovalDecision, v as RunWithRobotRockApprovalsOptions, w as SendUpdateToolResult, T as ToolApprovalRequestPart, k as applyRobotRockToolApprovalToTools, x as approveByHumanForAi, y as approveByHumanInputSchema, z as collectApprovalRequests, B as createRobotRockAiTriggerContext, l as createRobotRockAiWorkflowContext, m as createRobotRockNeedsApproval, n as createRobotRockToolApproval, D as normalizeRobotRockAiContext, r as resolveToolApprovalsViaRobotRock, o as runWithRobotRockApprovals, E as sendToHumanForAi, G as sendToHumanToolInputSchema, I as sendUpdateForAi, J as sendUpdateToolInputSchema } from '../tool-approval-bridge-
|
|
4
|
-
import { a as SendToHumanInput } from '../client-
|
|
1
|
+
export { C as CreateRobotRockAiToolsOptions, R as RobotRockAiTools, a as approveByHumanTool, c as createRobotRockAiTools, b as createSendToHumanTool, d as createSendUpdateTool } from '../trigger-D0shjqk0.js';
|
|
2
|
+
import { p as RobotRockToolCallInfo, F as FormatToolApprovalTaskOptions, H as HumanToolResult } from '../tool-approval-bridge-G765kMJR.js';
|
|
3
|
+
export { q as APPROVE_BY_HUMAN_ACTIONS, A as ApproveByHumanToolDurableOptions, a as ApproveByHumanToolOptions, e as CreateSendToHumanToolDurableOptions, C as CreateSendToHumanToolOptions, f as CreateSendUpdateToolDurableOptions, c as CreateSendUpdateToolOptions, s as ResolveToolApprovalsOptions, g as RobotRockAiContext, h as RobotRockAiMode, i as RobotRockAiPollingContext, j as RobotRockAiTriggerContext, R as RobotRockAiWorkflowContext, t as RobotRockToolApprovalConfig, u as RobotRockToolApprovalDecision, v as RunWithRobotRockApprovalsOptions, w as SendUpdateToolResult, T as ToolApprovalRequestPart, k as applyRobotRockToolApprovalToTools, x as approveByHumanForAi, y as approveByHumanInputSchema, z as collectApprovalRequests, B as createRobotRockAiTriggerContext, l as createRobotRockAiWorkflowContext, m as createRobotRockNeedsApproval, n as createRobotRockToolApproval, D as normalizeRobotRockAiContext, r as resolveToolApprovalsViaRobotRock, o as runWithRobotRockApprovals, E as sendToHumanForAi, G as sendToHumanToolInputSchema, I as sendUpdateForAi, J as sendUpdateToolInputSchema } from '../tool-approval-bridge-G765kMJR.js';
|
|
4
|
+
import { a as SendToHumanInput } from '../client-Cy7YLxms.js';
|
|
5
5
|
import { DiscriminatedApprovalResult } from '../schemas/index.js';
|
|
6
6
|
import 'ai';
|
|
7
7
|
import 'zod';
|