Skip to content

Commit c61cbb0

Browse files
committed
Merge branch 'staging' into dev
2 parents 3252736 + 4074109 commit c61cbb0

File tree

246 files changed

+21682
-990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+21682
-990
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
ecr_repo_secret: ECR_REALTIME
127127
steps:
128128
- name: Checkout code
129-
uses: actions/checkout@v4
129+
uses: actions/checkout@v6
130130

131131
- name: Configure AWS credentials
132132
uses: aws-actions/configure-aws-credentials@v4
@@ -200,7 +200,7 @@ jobs:
200200
# Build ARM64 images for GHCR (main branch only, runs in parallel)
201201
build-ghcr-arm64:
202202
name: Build ARM64 (GHCR Only)
203-
needs: [test-build, detect-version]
203+
needs: [detect-version]
204204
runs-on: blacksmith-8vcpu-ubuntu-2404-arm
205205
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
206206
permissions:
@@ -219,7 +219,7 @@ jobs:
219219

220220
steps:
221221
- name: Checkout code
222-
uses: actions/checkout@v4
222+
uses: actions/checkout@v6
223223

224224
- name: Login to GHCR
225225
uses: docker/login-action@v3
@@ -322,10 +322,10 @@ jobs:
322322
outputs:
323323
docs_changed: ${{ steps.filter.outputs.docs }}
324324
steps:
325-
- uses: actions/checkout@v4
325+
- uses: actions/checkout@v6
326326
with:
327327
fetch-depth: 2 # Need at least 2 commits to detect changes
328-
- uses: dorny/paths-filter@v3
328+
- uses: dorny/paths-filter@v4
329329
id: filter
330330
with:
331331
filters: |
@@ -352,7 +352,7 @@ jobs:
352352
contents: write
353353
steps:
354354
- name: Checkout code
355-
uses: actions/checkout@v4
355+
uses: actions/checkout@v6
356356
with:
357357
fetch-depth: 0
358358

.github/workflows/docs-embeddings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919

2020
- name: Setup Bun
2121
uses: oven-sh/setup-bun@v2

.github/workflows/i18n.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Checkout repository
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818
with:
1919
ref: staging
2020
token: ${{ secrets.GH_PAT }}
@@ -115,7 +115,7 @@ jobs:
115115

116116
steps:
117117
- name: Checkout repository
118-
uses: actions/checkout@v4
118+
uses: actions/checkout@v6
119119
with:
120120
ref: staging
121121

.github/workflows/images.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
steps:
3333
- name: Checkout code
34-
uses: actions/checkout@v4
34+
uses: actions/checkout@v6
3535

3636
- name: Configure AWS credentials
3737
uses: aws-actions/configure-aws-credentials@v4
@@ -117,7 +117,7 @@ jobs:
117117

118118
steps:
119119
- name: Checkout code
120-
uses: actions/checkout@v4
120+
uses: actions/checkout@v6
121121

122122
- name: Login to GHCR
123123
uses: docker/login-action@v3

.github/workflows/migrations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818

1919
- name: Setup Bun
2020
uses: oven-sh/setup-bun@v2

.github/workflows/publish-cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: blacksmith-4vcpu-ubuntu-2404
1515
steps:
1616
- name: Checkout repository
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818

1919
- name: Setup Bun
2020
uses: oven-sh/setup-bun@v2

.github/workflows/publish-python-sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: blacksmith-4vcpu-ubuntu-2404
1515
steps:
1616
- name: Checkout repository
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818

1919
- name: Setup Python
2020
uses: actions/setup-python@v5

.github/workflows/publish-ts-sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: blacksmith-4vcpu-ubuntu-2404
1515
steps:
1616
- name: Checkout repository
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818

1919
- name: Setup Bun
2020
uses: oven-sh/setup-bun@v2

.github/workflows/test-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818

1919
- name: Setup Bun
2020
uses: oven-sh/setup-bun@v2

apps/docs/content/docs/en/blocks/human-in-the-loop.mdx

Lines changed: 93 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Defines the fields approvers fill in when responding. This data becomes availabl
7878
}
7979
```
8080

81-
Access resume data in downstream blocks using `<blockId.resumeInput.fieldName>`.
81+
Access resume data in downstream blocks using `<blockId.fieldName>`.
8282

8383
## Approval Methods
8484

@@ -93,11 +93,12 @@ Access resume data in downstream blocks using `<blockId.resumeInput.fieldName>`.
9393
<Tab>
9494
### REST API
9595

96-
Programmatically resume workflows using the resume endpoint. The `contextId` is available from the block's `resumeEndpoint` output or from the paused execution detail.
96+
Programmatically resume workflows using the resume endpoint. The `contextId` is available from the block's `resumeEndpoint` output or from the `_resume` object in the paused execution response.
9797

9898
```bash
9999
POST /api/resume/{workflowId}/{executionId}/{contextId}
100100
Content-Type: application/json
101+
X-API-Key: your-api-key
101102

102103
{
103104
"input": {
@@ -107,23 +108,56 @@ Access resume data in downstream blocks using `<blockId.resumeInput.fieldName>`.
107108
}
108109
```
109110

110-
The response includes a new `executionId` for the resumed execution:
111+
The resume endpoint automatically respects the execution mode used in the original execute call:
112+
113+
- **Sync mode** (default) — The response waits for the remaining workflow to complete and returns the full result:
114+
115+
```json
116+
{
117+
"success": true,
118+
"status": "completed",
119+
"executionId": "<resumeExecutionId>",
120+
"output": { ... },
121+
"metadata": { "duration": 1234, "startTime": "...", "endTime": "..." }
122+
}
123+
```
124+
125+
If the resumed workflow hits another HITL block, the response returns `"status": "paused"` with new `_resume` URLs in the output.
126+
127+
- **Stream mode** (`stream: true` on the original execute call) — The resume response streams SSE events with `selectedOutputs` chunks, just like the initial execution.
128+
129+
- **Async mode** (`X-Execution-Mode: async` on the original execute call) — The resume dispatches execution to a background worker and returns immediately with `202`, including a `jobId` and `statusUrl` for polling:
111130

112131
```json
113132
{
114-
"status": "started",
133+
"success": true,
134+
"async": true,
135+
"jobId": "<jobId>",
115136
"executionId": "<resumeExecutionId>",
116-
"message": "Resume execution started."
137+
"message": "Resume execution queued",
138+
"statusUrl": "/api/jobs/<jobId>"
117139
}
118140
```
119141

120-
To poll execution progress after resuming, connect to the SSE stream:
142+
#### Polling execution status
143+
144+
Poll the `statusUrl` from the async response to check when the resume completes:
121145

122146
```bash
123-
GET /api/workflows/{workflowId}/executions/{resumeExecutionId}/stream
147+
GET /api/jobs/{jobId}
148+
X-API-Key: your-api-key
124149
```
125150

126-
Build custom approval UIs or integrate with existing systems.
151+
Returns job status and, when completed, the full workflow output.
152+
153+
To check on a paused execution's pause points and resume links:
154+
155+
```bash
156+
GET /api/resume/{workflowId}/{executionId}
157+
X-API-Key: your-api-key
158+
```
159+
160+
Returns the paused execution detail with all pause points, their statuses, and resume links. Returns `404` when the execution has completed and is no longer paused.
127161
</Tab>
128162
<Tab>
129163
### Webhook
@@ -132,6 +166,53 @@ Access resume data in downstream blocks using `<blockId.resumeInput.fieldName>`.
132166
</Tab>
133167
</Tabs>
134168

169+
## API Execute Behavior
170+
171+
When triggering a workflow via the execute API (`POST /api/workflows/{id}/execute`), HITL blocks cause the execution to pause and return the `_resume` data in the response:
172+
173+
<Tabs items={['Sync (JSON)', 'Stream (SSE)', 'Async']}>
174+
<Tab>
175+
The response includes the full pause data with resume URLs:
176+
177+
```json
178+
{
179+
"success": true,
180+
"executionId": "<executionId>",
181+
"output": {
182+
"data": {
183+
"operation": "human",
184+
"_resume": {
185+
"apiUrl": "/api/resume/{workflowId}/{executionId}/{contextId}",
186+
"uiUrl": "/resume/{workflowId}/{executionId}",
187+
"contextId": "<contextId>",
188+
"executionId": "<executionId>",
189+
"workflowId": "<workflowId>"
190+
}
191+
}
192+
}
193+
}
194+
```
195+
</Tab>
196+
<Tab>
197+
Blocks before the HITL stream their `selectedOutputs` normally. When execution pauses, the final SSE event includes `status: "paused"` and the `_resume` data:
198+
199+
```
200+
data: {"blockId":"agent1","chunk":"streamed content..."}
201+
data: {"event":"final","data":{"success":true,"output":{...,"_resume":{...}},"status":"paused"}}
202+
data: "[DONE]"
203+
```
204+
205+
On resume, blocks after the HITL stream their `selectedOutputs` the same way.
206+
207+
<Callout type="info">
208+
HITL blocks are automatically excluded from the `selectedOutputs` dropdown since their data is always included in the pause response.
209+
</Callout>
210+
</Tab>
211+
<Tab>
212+
Returns `202` immediately. Use the polling endpoint to check when the execution pauses.
213+
</Tab>
214+
</Tabs>
215+
135216
## Common Use Cases
136217

137218
**Content Approval** - Review AI-generated content before publishing
@@ -161,9 +242,9 @@ Agent (Generate) → Human in the Loop (QA) → Gmail (Send)
161242
**`response`** - Display data shown to the approver (json)
162243
**`submission`** - Form submission data from the approver (json)
163244
**`submittedAt`** - ISO timestamp when the workflow was resumed
164-
**`resumeInput.*`** - All fields defined in Resume Form become available after the workflow resumes
245+
**`<fieldName>`** - All fields defined in Resume Form become available at the top level after the workflow resumes
165246

166-
Access using `<blockId.resumeInput.fieldName>`.
247+
Access using `<blockId.fieldName>`.
167248

168249
## Example
169250

@@ -187,7 +268,7 @@ Access using `<blockId.resumeInput.fieldName>`.
187268
**Downstream Usage:**
188269
```javascript
189270
// Condition block
190-
<approval1.resumeInput.approved> === true
271+
<approval1.approved> === true
191272
```
192273
The example below shows an approval portal as seen by an approver after the workflow is paused. Approvers can review the data and provide inputs as a part of the workflow resumption. The approval portal can be accessed directly via the unique URL, `<blockId.url>`.
193274

@@ -204,7 +285,7 @@ The example below shows an approval portal as seen by an approver after the work
204285
<FAQ items={[
205286
{ question: "How long does the workflow stay paused?", answer: "The workflow pauses indefinitely until a human provides input through the approval portal, the REST API, or a webhook. There is no automatic timeout — it will wait until someone responds." },
206287
{ question: "What notification channels can I use to alert approvers?", answer: "You can configure notifications through Slack, Gmail, Microsoft Teams, SMS (via Twilio), or custom webhooks. Include the approval URL in your notification message so approvers can access the portal directly." },
207-
{ question: "How do I access the approver's input in downstream blocks?", answer: "Use the syntax <blockId.resumeInput.fieldName> to reference specific fields from the resume form. For example, if your block ID is 'approval1' and the form has an 'approved' field, use <approval1.resumeInput.approved>." },
288+
{ question: "How do I access the approver's input in downstream blocks?", answer: "Use the syntax <blockId.fieldName> to reference specific fields from the resume form. For example, if your block name is 'approval1' and the form has an 'approved' field, use <approval1.approved>." },
208289
{ question: "Can I chain multiple Human in the Loop blocks for multi-stage approvals?", answer: "Yes. You can place multiple Human in the Loop blocks in sequence to create multi-stage approval workflows. Each block pauses independently and can have its own notification configuration and resume form fields." },
209290
{ question: "Can I resume the workflow programmatically without the portal?", answer: "Yes. Each block exposes a resume API endpoint that you can call with a POST request containing the form data as JSON. This lets you build custom approval UIs or integrate with existing systems like Jira or ServiceNow." },
210291
{ question: "What outputs are available after the workflow resumes?", answer: "The block outputs include the approval portal URL, the resume API endpoint URL, the display data shown to the approver, the form submission data, the raw resume input, and an ISO timestamp of when the workflow was resumed." },

0 commit comments

Comments
 (0)