Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .changeset/webhooks-2026-09-02-workspace-files.md

This file was deleted.

13 changes: 0 additions & 13 deletions .changeset/webhooks-2026-09-06-tool-call-approvals.md

This file was deleted.

20 changes: 20 additions & 0 deletions packages/webhooks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @team-plain/webhooks

## 1.9.0

### Minor Changes

- 1f854d5: Update the webhook schema to `2026-09-02`. Adds `workspaceFiles` to the message on `discussion.message_created`, so a handler can see the files a custom agent attached to the message it just sent.

Each entry carries `id`, `fileName`, `fileExtension`, `fileMimeType` and `fileSizeBytes`, all required on an entry. **The array itself is optional and the parser does not fill it in.** The schema declares `default: []`, but `parsePlainWebhook` builds Ajv without `useDefaults`, so an absent array stays absent and the generated type is `workspaceFiles?`. Read it as `message.workspaceFiles ?? []`.

The package bundles one schema version at a time, so this release only parses payloads whose `webhookMetadata.webhookTargetVersion` is the version below. Move your webhook target forward when you upgrade, or `parsePlainWebhook` returns `PlainWebhookVersionMismatchError`.

- 1f854d5: Update the webhook schema to `2026-09-06`, which carries the custom-agent tool call approval flow. Two new events, and one new field on the discussion that every discussion event already reports. **Nothing was removed.**

`discussion.tool_call_approval_requested` fires when an agent asks a human to gate a tool call: `approvalId`, `toolCallId`, `justification`, `requestedAt`, `requestedBy`, plus the `discussion`. `discussion.tool_call_approval_resolved` fires on the decision and adds `status`, `resolvedAt`, `resolvedBy` and `reviewerNote`. `status` is `APPROVED`, `DENIED` or the forward-compatible `UNKNOWN_APPROVAL_STATUS`. **`reviewerNote` is required but nullable**, so the key is always present and is `null` when the reviewer left no note; do not test for its absence. Their types are exported as `DiscussionToolCallApprovalRequestedPublicEventPayload` and `DiscussionToolCallApprovalResolvedPublicEventPayload`.

**The field worth reading carefully is `discussion.agentStatus`, because all four discussion events carry it, not only the new two.** It is `UNKNOWN`, `IDLE`, `IN_PROGRESS`, `TOOL_CALL_APPROVAL_PENDING` or `UNKNOWN_DISCUSSION_AGENT_STATUS`. It is optional and the parser does not fill it in: the schema declares `default: "UNKNOWN"`, but Ajv is built without `useDefaults`, so treat an absent value as `UNKNOWN` yourself rather than expecting the string.

On the resolved event `agentStatus` reports the status **after** the decision settled, so an approved call reads `IN_PROGRESS` and not the pending state that the decision just cleared.

The package bundles one schema version at a time, so this release only parses payloads whose `webhookMetadata.webhookTargetVersion` is `2026-09-06`. Move your webhook target to `2026-09-06` when you upgrade, or `parsePlainWebhook` returns `PlainWebhookVersionMismatchError`.

## 1.8.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/webhooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@team-plain/webhooks",
"version": "1.8.0",
"version": "1.9.0",
"description": "Webhook parsing and signature verification for Plain webhooks",
"license": "MIT",
"author": "Plain <hello@plain.com> (https://plain.com)",
Expand Down