@vellumai/assistant 0.4.10 → 0.4.12
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/ARCHITECTURE.md +418 -378
- package/Dockerfile +1 -1
- package/README.md +16 -9
- package/package.json +1 -1
- package/src/__tests__/account-registry.test.ts +1 -0
- package/src/__tests__/actor-token-service.test.ts +1 -0
- package/src/__tests__/app-builder-tool-scripts.test.ts +1 -0
- package/src/__tests__/asset-materialize-tool.test.ts +7 -0
- package/src/__tests__/asset-search-tool.test.ts +7 -0
- package/src/__tests__/browser-fill-credential.test.ts +1 -0
- package/src/__tests__/call-start-guardian-guard.test.ts +1 -0
- package/src/__tests__/channel-approval-routes.test.ts +29 -0
- package/src/__tests__/channel-guardian.test.ts +2143 -1546
- package/src/__tests__/channel-retry-sweep.test.ts +169 -14
- package/src/__tests__/claude-code-tool-profiles.test.ts +1 -0
- package/src/__tests__/computer-use-tools.test.ts +1 -0
- package/src/__tests__/contacts-tools.test.ts +1 -0
- package/src/__tests__/conversation-attention-telegram.test.ts +1 -0
- package/src/__tests__/credential-policy-validate.test.ts +97 -0
- package/src/__tests__/credential-security-e2e.test.ts +1 -0
- package/src/__tests__/credential-vault-unit.test.ts +1 -0
- package/src/__tests__/credential-vault.test.ts +1 -0
- package/src/__tests__/delete-managed-skill-tool.test.ts +1 -0
- package/src/__tests__/file-edit-tool.test.ts +1 -0
- package/src/__tests__/file-read-tool.test.ts +1 -0
- package/src/__tests__/file-write-tool.test.ts +1 -0
- package/src/__tests__/followup-tools.test.ts +1 -0
- package/src/__tests__/gateway-only-guard.test.ts +1 -1
- package/src/__tests__/guardian-control-plane-policy.test.ts +5 -4
- package/src/__tests__/guardian-grant-minting.test.ts +3 -0
- package/src/__tests__/guardian-principal-id-roundtrip.test.ts +4 -3
- package/src/__tests__/guardian-routing-state.test.ts +8 -0
- package/src/__tests__/guardian-verify-setup-skill-regression.test.ts +75 -61
- package/src/__tests__/headless-browser-interactions.test.ts +1 -0
- package/src/__tests__/headless-browser-navigate.test.ts +1 -0
- package/src/__tests__/headless-browser-read-tools.test.ts +1 -0
- package/src/__tests__/headless-browser-snapshot.test.ts +1 -0
- package/src/__tests__/host-file-edit-tool.test.ts +1 -0
- package/src/__tests__/host-file-read-tool.test.ts +1 -0
- package/src/__tests__/host-file-write-tool.test.ts +1 -0
- package/src/__tests__/host-shell-tool.test.ts +1 -0
- package/src/__tests__/lifecycle-docs-guard.test.ts +207 -0
- package/src/__tests__/managed-skill-lifecycle.test.ts +1 -0
- package/src/__tests__/media-reuse-story.e2e.test.ts +8 -0
- package/src/__tests__/messaging-send-tool.test.ts +1 -0
- package/src/__tests__/playbook-execution.test.ts +1 -0
- package/src/__tests__/playbook-tools.test.ts +1 -0
- package/src/__tests__/registry.test.ts +235 -187
- package/src/__tests__/relay-server.test.ts +4 -0
- package/src/__tests__/scaffold-managed-skill-tool.test.ts +1 -0
- package/src/__tests__/schedule-tools.test.ts +1 -0
- package/src/__tests__/secret-onetime-send.test.ts +4 -0
- package/src/__tests__/secret-scanner-executor.test.ts +2 -0
- package/src/__tests__/secure-keys.test.ts +27 -0
- package/src/__tests__/send-notification-tool.test.ts +2 -0
- package/src/__tests__/session-agent-loop.test.ts +521 -256
- package/src/__tests__/session-surfaces-task-progress.test.ts +1 -0
- package/src/__tests__/session-tool-setup-app-refresh.test.ts +1 -0
- package/src/__tests__/session-tool-setup-memory-scope.test.ts +1 -0
- package/src/__tests__/session-tool-setup-side-effect-flag.test.ts +1 -0
- package/src/__tests__/shell-credential-ref.test.ts +1 -0
- package/src/__tests__/shell-tool-proxy-mode.test.ts +1 -0
- package/src/__tests__/skill-load-feature-flag.test.ts +1 -0
- package/src/__tests__/skill-load-tool.test.ts +1 -0
- package/src/__tests__/skill-script-runner-host.test.ts +1 -0
- package/src/__tests__/skill-script-runner-sandbox.test.ts +1 -0
- package/src/__tests__/skill-script-runner.test.ts +1 -0
- package/src/__tests__/skill-tool-factory.test.ts +1 -0
- package/src/__tests__/skills.test.ts +334 -276
- package/src/__tests__/starter-task-flow.test.ts +7 -17
- package/src/__tests__/subagent-tools.test.ts +1 -1
- package/src/__tests__/swarm-recursion.test.ts +1 -0
- package/src/__tests__/swarm-session-integration.test.ts +1 -0
- package/src/__tests__/swarm-tool.test.ts +1 -0
- package/src/__tests__/task-management-tools.test.ts +1 -0
- package/src/__tests__/task-tools.test.ts +1 -0
- package/src/__tests__/terminal-tools.test.ts +1 -0
- package/src/__tests__/tool-approval-handler.test.ts +2 -2
- package/src/__tests__/tool-execution-abort-cleanup.test.ts +1 -0
- package/src/__tests__/tool-execution-pipeline.benchmark.test.ts +1 -0
- package/src/__tests__/tool-executor-lifecycle-events.test.ts +2 -0
- package/src/__tests__/tool-executor-shell-integration.test.ts +1 -0
- package/src/__tests__/tool-executor.test.ts +1 -0
- package/src/__tests__/trust-context-guards.test.ts +218 -0
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +6 -0
- package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +6 -0
- package/src/__tests__/trusted-contact-multichannel.test.ts +1 -0
- package/src/__tests__/trusted-contact-verification.test.ts +1 -0
- package/src/__tests__/view-image-tool.test.ts +1 -0
- package/src/agent/loop.ts +9 -2
- package/src/calls/guardian-dispatch.ts +4 -4
- package/src/cli/mcp.ts +183 -3
- package/src/config/bundled-skills/agentmail/SKILL.md +4 -4
- package/src/config/bundled-skills/chatgpt-import/tools/chatgpt-import.ts +449 -0
- package/src/config/bundled-skills/doordash/SKILL.md +171 -0
- package/src/config/bundled-skills/doordash/__tests__/doordash-client.test.ts +203 -0
- package/src/config/bundled-skills/doordash/__tests__/doordash-session.test.ts +164 -0
- package/src/config/bundled-skills/doordash/doordash-cli.ts +1193 -0
- package/src/config/bundled-skills/doordash/doordash-entry.ts +22 -0
- package/src/config/bundled-skills/doordash/lib/cart-queries.ts +787 -0
- package/src/config/bundled-skills/doordash/lib/client.ts +1071 -0
- package/src/config/bundled-skills/doordash/lib/order-queries.ts +85 -0
- package/src/config/bundled-skills/doordash/lib/queries.ts +28 -0
- package/src/config/bundled-skills/doordash/lib/query-extractor.ts +94 -0
- package/src/config/bundled-skills/doordash/lib/search-queries.ts +203 -0
- package/src/config/bundled-skills/doordash/lib/session.ts +93 -0
- package/src/config/bundled-skills/doordash/lib/shared/errors.ts +61 -0
- package/src/config/bundled-skills/doordash/lib/shared/ipc.ts +32 -0
- package/src/config/bundled-skills/doordash/lib/shared/network-recorder.ts +380 -0
- package/src/config/bundled-skills/doordash/lib/shared/platform.ts +35 -0
- package/src/config/bundled-skills/doordash/lib/shared/recording-store.ts +43 -0
- package/src/config/bundled-skills/doordash/lib/shared/recording-types.ts +49 -0
- package/src/config/bundled-skills/doordash/lib/shared/truncate.ts +6 -0
- package/src/config/bundled-skills/doordash/lib/store-queries.ts +246 -0
- package/src/config/bundled-skills/doordash/lib/types.ts +367 -0
- package/src/config/bundled-skills/google-calendar/SKILL.md +4 -5
- package/src/config/bundled-skills/google-oauth-setup/SKILL.md +42 -41
- package/src/config/bundled-skills/messaging/SKILL.md +59 -42
- package/src/config/bundled-skills/messaging/TOOLS.json +2 -2
- package/src/config/bundled-skills/messaging/tools/gmail-archive-by-query.ts +5 -1
- package/src/config/bundled-skills/messaging/tools/gmail-batch-archive.ts +11 -2
- package/src/config/bundled-skills/messaging/tools/gmail-sender-digest.ts +10 -3
- package/src/config/bundled-skills/messaging/tools/gmail-unsubscribe.ts +5 -1
- package/src/config/bundled-skills/messaging/tools/messaging-archive-by-sender.ts +5 -1
- package/src/config/bundled-skills/messaging/tools/messaging-sender-digest.ts +2 -1
- package/src/config/bundled-skills/notion/SKILL.md +240 -0
- package/src/config/bundled-skills/notion-oauth-setup/SKILL.md +127 -0
- package/src/config/bundled-skills/oauth-setup/SKILL.md +144 -0
- package/src/config/bundled-skills/phone-calls/SKILL.md +91 -162
- package/src/config/bundled-skills/skills-catalog/SKILL.md +32 -29
- package/src/config/{vellum-skills → bundled-skills}/sms-setup/SKILL.md +29 -22
- package/src/config/{vellum-skills → bundled-skills}/telegram-setup/SKILL.md +17 -14
- package/src/config/{vellum-skills → bundled-skills}/twilio-setup/SKILL.md +21 -6
- package/src/config/bundled-tool-registry.ts +281 -267
- package/src/config/system-prompt.ts +4 -2
- package/src/daemon/computer-use-session.ts +1 -0
- package/src/daemon/handlers/skills.ts +334 -234
- package/src/daemon/ipc-contract/messages.ts +2 -0
- package/src/daemon/ipc-contract/surfaces.ts +2 -0
- package/src/daemon/lifecycle.ts +358 -221
- package/src/daemon/response-tier.ts +2 -0
- package/src/daemon/server.ts +453 -193
- package/src/daemon/session-agent-loop-handlers.ts +42 -2
- package/src/daemon/session-agent-loop.ts +4 -1
- package/src/daemon/session-lifecycle.ts +3 -0
- package/src/daemon/session-memory.ts +2 -2
- package/src/daemon/session-process.ts +1 -0
- package/src/daemon/session-runtime-assembly.ts +2 -2
- package/src/daemon/session-surfaces.ts +22 -20
- package/src/daemon/session-tool-setup.ts +2 -1
- package/src/daemon/session.ts +5 -2
- package/src/mcp/client.ts +55 -6
- package/src/mcp/manager.ts +9 -0
- package/src/mcp/mcp-oauth-provider.ts +347 -0
- package/src/memory/channel-delivery-store.ts +1 -0
- package/src/memory/db-init.ts +4 -0
- package/src/memory/delivery-status.ts +43 -0
- package/src/memory/guardian-bindings.ts +3 -3
- package/src/memory/migrations/127-guardian-principal-id-not-null.ts +108 -0
- package/src/memory/migrations/index.ts +1 -0
- package/src/memory/migrations/registry.ts +6 -0
- package/src/memory/schema.ts +1 -1
- package/src/messaging/outreach-classifier.ts +12 -5
- package/src/messaging/provider-types.ts +2 -0
- package/src/messaging/providers/gmail/adapter.ts +9 -3
- package/src/messaging/providers/gmail/client.ts +2 -0
- package/src/runtime/actor-trust-resolver.ts +13 -4
- package/src/runtime/channel-retry-sweep.ts +31 -14
- package/src/runtime/guardian-context-resolver.ts +25 -64
- package/src/runtime/guardian-outbound-actions.ts +399 -108
- package/src/runtime/guardian-vellum-migration.ts +1 -23
- package/src/runtime/guardian-verification-templates.ts +66 -30
- package/src/runtime/http-errors.ts +33 -20
- package/src/runtime/http-server.ts +706 -291
- package/src/runtime/http-types.ts +26 -16
- package/src/runtime/local-actor-identity.ts +4 -6
- package/src/runtime/middleware/actor-token.ts +2 -8
- package/src/runtime/routes/channel-route-shared.ts +0 -1
- package/src/runtime/routes/inbound-message-handler.ts +3 -4
- package/src/runtime/routes/secret-routes.ts +57 -2
- package/src/runtime/routes/surface-action-routes.ts +66 -0
- package/src/runtime/routes/trust-rules-routes.ts +140 -0
- package/src/runtime/tool-grant-request-helper.ts +1 -1
- package/src/security/keychain-to-encrypted-migration.ts +59 -0
- package/src/security/secure-keys.ts +17 -0
- package/src/skills/frontmatter.ts +9 -7
- package/src/tools/apps/executors.ts +2 -1
- package/src/tools/credentials/policy-validate.ts +22 -0
- package/src/tools/guardian-control-plane-policy.ts +2 -2
- package/src/tools/tool-manifest.ts +44 -42
- package/src/tools/types.ts +10 -1
- package/src/__tests__/skill-mirror-parity.test.ts +0 -176
- package/src/config/vellum-skills/catalog.json +0 -63
- package/src/config/vellum-skills/chatgpt-import/tools/chatgpt-import.ts +0 -295
- package/src/skills/vellum-catalog-remote.ts +0 -166
- package/src/tools/skills/vellum-catalog.ts +0 -168
- /package/src/config/{vellum-skills → bundled-skills}/chatgpt-import/SKILL.md +0 -0
- /package/src/config/{vellum-skills → bundled-skills}/chatgpt-import/TOOLS.json +0 -0
- /package/src/config/{vellum-skills → bundled-skills}/deploy-fullstack-vercel/SKILL.md +0 -0
- /package/src/config/{vellum-skills → bundled-skills}/document-writer/SKILL.md +0 -0
- /package/src/config/{vellum-skills → bundled-skills}/guardian-verify-setup/SKILL.md +0 -0
- /package/src/config/{vellum-skills → bundled-skills}/slack-oauth-setup/SKILL.md +0 -0
- /package/src/config/{vellum-skills → bundled-skills}/trusted-contacts/SKILL.md +0 -0
|
@@ -43,7 +43,8 @@ export async function run(input: Record<string, unknown>, _context: ToolContext)
|
|
|
43
43
|
senders,
|
|
44
44
|
total_scanned: result.totalScanned,
|
|
45
45
|
query_used: result.queryUsed,
|
|
46
|
-
|
|
46
|
+
...(result.truncated ? { truncated: true } : {}),
|
|
47
|
+
note: `message_count reflects emails found per sender within the ${result.totalScanned} messages scanned. Use the message_ids array with the archive tool to archive exactly these messages.`,
|
|
47
48
|
}));
|
|
48
49
|
});
|
|
49
50
|
} catch (e) {
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Notion"
|
|
3
|
+
description: "Read and write Notion pages and databases using the Notion API"
|
|
4
|
+
user-invocable: false
|
|
5
|
+
metadata: {"vellum": {"emoji": "📝"}}
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You have access to the Notion API via the stored OAuth token for `integration:notion`. Use `bash` with `network_mode: "proxied"` to call the Notion API — the proxy automatically injects the Bearer token for `api.notion.com`.
|
|
9
|
+
|
|
10
|
+
## Authentication
|
|
11
|
+
|
|
12
|
+
The Notion access token is stored securely and never exposed as plaintext. Use the credential proxy to inject the Bearer token automatically.
|
|
13
|
+
|
|
14
|
+
**Step 1 — Get the credential ID:**
|
|
15
|
+
```
|
|
16
|
+
credential_store action=list
|
|
17
|
+
```
|
|
18
|
+
Find the entry with `service: "integration:notion"` and `field: "access_token"`. Note its `credential_id`.
|
|
19
|
+
|
|
20
|
+
If no such entry exists, tell the user: "Notion is not connected yet. Load the **notion-oauth-setup** skill to set it up first."
|
|
21
|
+
|
|
22
|
+
**Step 2 — Make authenticated API calls via the proxy:**
|
|
23
|
+
|
|
24
|
+
Use `bash` with `network_mode: "proxied"` and `credential_ids: ["<credential_id>"]`. The proxy automatically injects `Authorization: Bearer <token>` and any required headers into requests to `api.notion.com`.
|
|
25
|
+
|
|
26
|
+
Example:
|
|
27
|
+
```
|
|
28
|
+
bash:
|
|
29
|
+
network_mode: proxied
|
|
30
|
+
credential_ids: ["<credential_id from step 1>"]
|
|
31
|
+
command: |
|
|
32
|
+
curl -s -X POST https://api.notion.com/v1/search \
|
|
33
|
+
-H "Notion-Version: 2022-06-28" \
|
|
34
|
+
-H "Content-Type: application/json" \
|
|
35
|
+
-d '{}'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
All Notion API calls go to `https://api.notion.com/v1/`. Always include the `Notion-Version: 2022-06-28` header.
|
|
39
|
+
|
|
40
|
+
## Reading Pages
|
|
41
|
+
|
|
42
|
+
### Get a page by ID
|
|
43
|
+
```
|
|
44
|
+
GET https://api.notion.com/v1/pages/{page_id}
|
|
45
|
+
```
|
|
46
|
+
Returns page properties. Use the page ID from a Notion URL — the last segment of the URL, e.g. for `https://notion.so/My-Page-abc123def456` the ID is `abc123def456` (formatted as UUID: `abc123de-f456-...`).
|
|
47
|
+
|
|
48
|
+
### Get page content (blocks)
|
|
49
|
+
```
|
|
50
|
+
GET https://api.notion.com/v1/blocks/{block_id}/children?page_size=100
|
|
51
|
+
```
|
|
52
|
+
Pages are blocks too — use the page ID as the `block_id`. Iterates through the page's child blocks. Use `start_cursor` for pagination when `has_more` is `true`.
|
|
53
|
+
|
|
54
|
+
**Block types and how to render them:**
|
|
55
|
+
- `paragraph`: Read `paragraph.rich_text[].plain_text`
|
|
56
|
+
- `heading_1`, `heading_2`, `heading_3`: Read `heading_N.rich_text[].plain_text`
|
|
57
|
+
- `bulleted_list_item`, `numbered_list_item`: Read `*.rich_text[].plain_text`
|
|
58
|
+
- `to_do`: Read `to_do.rich_text[].plain_text` and `to_do.checked`
|
|
59
|
+
- `toggle`: Read `toggle.rich_text[].plain_text`; children are nested blocks
|
|
60
|
+
- `code`: Read `code.rich_text[].plain_text` and `code.language`
|
|
61
|
+
- `quote`: Read `quote.rich_text[].plain_text`
|
|
62
|
+
- `callout`: Read `callout.rich_text[].plain_text`
|
|
63
|
+
- `divider`: Render as `---`
|
|
64
|
+
- `image`: Read `image.external.url` or `image.file.url`
|
|
65
|
+
- `child_page`: Read `child_page.title`; use its `id` to recursively fetch if needed
|
|
66
|
+
|
|
67
|
+
## Searching
|
|
68
|
+
|
|
69
|
+
### Search pages and databases
|
|
70
|
+
```
|
|
71
|
+
POST https://api.notion.com/v1/search
|
|
72
|
+
{
|
|
73
|
+
"query": "your search term",
|
|
74
|
+
"filter": { "value": "page", "property": "object" },
|
|
75
|
+
"sort": { "direction": "descending", "timestamp": "last_edited_time" },
|
|
76
|
+
"page_size": 10
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
Omit `filter` to search both pages and databases. Use `filter.value: "database"` to search only databases.
|
|
80
|
+
|
|
81
|
+
Returns `results[]` with `id`, `url`, `properties.title` (for pages), and `title[]` (for databases).
|
|
82
|
+
|
|
83
|
+
## Reading Databases
|
|
84
|
+
|
|
85
|
+
### Get database metadata
|
|
86
|
+
```
|
|
87
|
+
GET https://api.notion.com/v1/databases/{database_id}
|
|
88
|
+
```
|
|
89
|
+
Returns the database schema (all property definitions).
|
|
90
|
+
|
|
91
|
+
### Query a database
|
|
92
|
+
```
|
|
93
|
+
POST https://api.notion.com/v1/databases/{database_id}/query
|
|
94
|
+
{
|
|
95
|
+
"filter": {
|
|
96
|
+
"property": "Status",
|
|
97
|
+
"select": { "equals": "In Progress" }
|
|
98
|
+
},
|
|
99
|
+
"sorts": [
|
|
100
|
+
{ "property": "Created", "direction": "descending" }
|
|
101
|
+
],
|
|
102
|
+
"page_size": 20
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
Omit `filter` to retrieve all rows. Returns `results[]` where each item is a page (database row).
|
|
106
|
+
|
|
107
|
+
**Extracting property values from database rows:**
|
|
108
|
+
- `title`: `properties.Name.title[].plain_text`
|
|
109
|
+
- `rich_text`: `properties.Notes.rich_text[].plain_text`
|
|
110
|
+
- `number`: `properties.Price.number`
|
|
111
|
+
- `select`: `properties.Status.select.name`
|
|
112
|
+
- `multi_select`: `properties.Tags.multi_select[].name`
|
|
113
|
+
- `date`: `properties.Due.date.start` (ISO 8601)
|
|
114
|
+
- `checkbox`: `properties.Done.checkbox`
|
|
115
|
+
- `url`: `properties.Link.url`
|
|
116
|
+
- `email`: `properties.Email.email`
|
|
117
|
+
- `people`: `properties.Owner.people[].name`
|
|
118
|
+
- `relation`: `properties.Projects.relation[].id` (array of page IDs)
|
|
119
|
+
|
|
120
|
+
## Creating Pages
|
|
121
|
+
|
|
122
|
+
### Create a new page
|
|
123
|
+
```
|
|
124
|
+
POST https://api.notion.com/v1/pages
|
|
125
|
+
{
|
|
126
|
+
"parent": { "page_id": "<parent_page_id>" },
|
|
127
|
+
"properties": {
|
|
128
|
+
"title": {
|
|
129
|
+
"title": [{ "text": { "content": "My New Page" } }]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"children": [
|
|
133
|
+
{
|
|
134
|
+
"object": "block",
|
|
135
|
+
"type": "paragraph",
|
|
136
|
+
"paragraph": {
|
|
137
|
+
"rich_text": [{ "text": { "content": "Page content here." } }]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For database rows, use `"parent": { "database_id": "<database_id>" }` and include the database's required properties.
|
|
145
|
+
|
|
146
|
+
## Updating Pages
|
|
147
|
+
|
|
148
|
+
### Update page properties
|
|
149
|
+
```
|
|
150
|
+
PATCH https://api.notion.com/v1/pages/{page_id}
|
|
151
|
+
{
|
|
152
|
+
"properties": {
|
|
153
|
+
"Status": { "select": { "name": "Done" } },
|
|
154
|
+
"Due": { "date": { "start": "2024-12-31" } }
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Append blocks to a page
|
|
160
|
+
```
|
|
161
|
+
PATCH https://api.notion.com/v1/blocks/{block_id}/children
|
|
162
|
+
{
|
|
163
|
+
"children": [
|
|
164
|
+
{
|
|
165
|
+
"object": "block",
|
|
166
|
+
"type": "paragraph",
|
|
167
|
+
"paragraph": {
|
|
168
|
+
"rich_text": [{ "text": { "content": "Appended content." } }]
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"object": "block",
|
|
173
|
+
"type": "heading_2",
|
|
174
|
+
"heading_2": {
|
|
175
|
+
"rich_text": [{ "text": { "content": "A heading" } }]
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"object": "block",
|
|
180
|
+
"type": "bulleted_list_item",
|
|
181
|
+
"bulleted_list_item": {
|
|
182
|
+
"rich_text": [{ "text": { "content": "A bullet point" } }]
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"object": "block",
|
|
187
|
+
"type": "to_do",
|
|
188
|
+
"to_do": {
|
|
189
|
+
"rich_text": [{ "text": { "content": "A task" } }],
|
|
190
|
+
"checked": false
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Update a block's content
|
|
198
|
+
```
|
|
199
|
+
PATCH https://api.notion.com/v1/blocks/{block_id}
|
|
200
|
+
{
|
|
201
|
+
"paragraph": {
|
|
202
|
+
"rich_text": [{ "text": { "content": "Updated text." } }]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Delete (archive) a block
|
|
208
|
+
```
|
|
209
|
+
DELETE https://api.notion.com/v1/blocks/{block_id}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Archive / Delete Pages
|
|
213
|
+
|
|
214
|
+
Notion does not permanently delete pages via the API — it archives them:
|
|
215
|
+
```
|
|
216
|
+
PATCH https://api.notion.com/v1/pages/{page_id}
|
|
217
|
+
{
|
|
218
|
+
"archived": true
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Pagination
|
|
223
|
+
|
|
224
|
+
When a response includes `"has_more": true`, pass `"start_cursor": response.next_cursor` in the next request to get the next page of results.
|
|
225
|
+
|
|
226
|
+
## Error Handling
|
|
227
|
+
|
|
228
|
+
- **401 Unauthorized**: The access token is missing or expired. Ask the user to reconnect Notion via the **notion-oauth-setup** skill.
|
|
229
|
+
- **403 Forbidden**: The integration doesn't have access to the requested page or database. Remind the user that they need to share the page/database with the "Vellum Assistant" integration in Notion (via the Share menu → "Add connections").
|
|
230
|
+
- **404 Not Found**: The page or database ID doesn't exist or the integration can't see it. Verify the ID and check sharing settings.
|
|
231
|
+
- **400 Bad Request**: Check the request body structure. The Notion API error response includes a `message` field with details.
|
|
232
|
+
- **429 Too Many Requests**: Wait a few seconds and retry.
|
|
233
|
+
|
|
234
|
+
## Tips
|
|
235
|
+
|
|
236
|
+
- Notion page IDs in URLs are formatted without hyphens. The API accepts both forms: `abc123def456...` or `abc123de-f456-...`.
|
|
237
|
+
- When extracting IDs from Notion URLs, strip any query parameters and trailing path components after the 32-character ID segment.
|
|
238
|
+
- Always include `Notion-Version: 2022-06-28` header to get stable API behavior.
|
|
239
|
+
- For rich text, concatenate all `plain_text` values in the array to get the full text content.
|
|
240
|
+
- When creating content with rich text formatting (bold, italic, links), use the `annotations` and `href` fields in rich_text objects.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Notion OAuth Setup"
|
|
3
|
+
description: "Create a Notion integration and OAuth credentials for Notion integration using browser automation"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
includes: ["browser", "public-ingress"]
|
|
6
|
+
metadata: {"vellum": {"emoji": "🔑"}}
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are helping your user create a Notion integration (OAuth app) so Vellum can connect to their Notion workspace. Walk through each step below using `browser_navigate`, `browser_snapshot`, `browser_screenshot`, `browser_click`, `browser_type`, and `browser_extract` tools.
|
|
10
|
+
|
|
11
|
+
**Tone:** Be friendly and reassuring throughout. Narrate what you're doing in plain language so the user always knows what's happening. After each step, briefly confirm what was accomplished before moving on.
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
Before starting, check that `ingress.publicBaseUrl` is configured (Settings > Public Ingress, or `INGRESS_PUBLIC_BASE_URL` env var). If it is not set, load and execute the **public-ingress** skill first (`skill_load` with `skill: "public-ingress"`) to set up an ngrok tunnel and persist the public URL. The OAuth redirect URI depends on this value.
|
|
16
|
+
|
|
17
|
+
## Before You Start
|
|
18
|
+
|
|
19
|
+
Tell the user:
|
|
20
|
+
- "I'll walk you through creating a Notion integration so Vellum can read and write pages and databases in your workspace. The whole process takes a few minutes."
|
|
21
|
+
- "I'll be automating the Notion integrations page in the browser — you'll be able to see everything I'm doing."
|
|
22
|
+
- "I'll ask for your approval before each major step, so nothing happens without your say-so."
|
|
23
|
+
- "No sensitive credentials will be shown in the conversation."
|
|
24
|
+
|
|
25
|
+
## Step 1: Navigate to Notion Integrations
|
|
26
|
+
|
|
27
|
+
Tell the user: "First, let me open the Notion integrations page."
|
|
28
|
+
|
|
29
|
+
Use `browser_navigate` to go to `https://www.notion.so/my-integrations`.
|
|
30
|
+
|
|
31
|
+
Take a `browser_screenshot` to show the user what loaded, then take a `browser_snapshot` to check the page state:
|
|
32
|
+
- **If a sign-in page appears:** Tell the user "Please sign in to your Notion account in the browser window. Let me know when you're done." Wait for their confirmation, then take another snapshot.
|
|
33
|
+
- **If the integrations dashboard loads:** Tell the user "Notion integrations page is loaded. Let's create your integration!" and continue to Step 2.
|
|
34
|
+
|
|
35
|
+
## Step 2: Create a New Integration
|
|
36
|
+
|
|
37
|
+
**Ask for approval before proceeding.** Use `ui_show` with `surface_type: "confirmation"` and this message:
|
|
38
|
+
|
|
39
|
+
> **Create a Notion Integration**
|
|
40
|
+
>
|
|
41
|
+
> I'm about to create a new Notion integration called "Vellum Assistant". This integration will only have the capabilities you approve — it won't access any pages or databases until you explicitly share them with it or authorize it via OAuth.
|
|
42
|
+
|
|
43
|
+
Wait for the user to approve. If they decline, explain that the integration is required for OAuth and offer to try again or cancel.
|
|
44
|
+
|
|
45
|
+
Once approved:
|
|
46
|
+
1. Click "New integration" (or the "+" button)
|
|
47
|
+
2. Select "Public" as the integration type (required for OAuth)
|
|
48
|
+
3. Enter integration name: "Vellum Assistant"
|
|
49
|
+
4. Select the user's workspace
|
|
50
|
+
5. Click "Submit" or "Create"
|
|
51
|
+
|
|
52
|
+
Take a `browser_screenshot` to show the result.
|
|
53
|
+
|
|
54
|
+
Tell the user: "Integration created! Now let's configure the OAuth settings."
|
|
55
|
+
|
|
56
|
+
## Step 3: Configure OAuth Settings
|
|
57
|
+
|
|
58
|
+
Navigate to the integration's "Distribution" or "OAuth Domain & URIs" tab.
|
|
59
|
+
|
|
60
|
+
**Ask for approval before proceeding.** Use `ui_show` with `surface_type: "confirmation"` and this message:
|
|
61
|
+
|
|
62
|
+
> **Configure OAuth Redirect URI**
|
|
63
|
+
>
|
|
64
|
+
> I'm about to add the OAuth redirect URI to your Notion integration. This allows Notion to send the authorization code back to Vellum after you approve the connection.
|
|
65
|
+
|
|
66
|
+
Wait for the user to approve.
|
|
67
|
+
|
|
68
|
+
Once approved:
|
|
69
|
+
1. Find the "Redirect URIs" field
|
|
70
|
+
2. Enter `${ingress.publicBaseUrl}/webhooks/oauth/callback` (e.g. `https://abc123.ngrok-free.app/webhooks/oauth/callback`). Read the `ingress.publicBaseUrl` value from the assistant's workspace config (Settings > Public Ingress) or the `INGRESS_PUBLIC_BASE_URL` environment variable.
|
|
71
|
+
3. Save the settings
|
|
72
|
+
|
|
73
|
+
Take a `browser_snapshot` to confirm.
|
|
74
|
+
|
|
75
|
+
Tell the user: "Redirect URI configured. Now let's get your OAuth credentials."
|
|
76
|
+
|
|
77
|
+
## Step 4: Extract Client ID and Client Secret
|
|
78
|
+
|
|
79
|
+
Stay on the integration settings page and navigate to the "Secrets" or "OAuth Clients" section.
|
|
80
|
+
|
|
81
|
+
Use `browser_extract` to read:
|
|
82
|
+
1. **OAuth client_id** — this is the integration's OAuth client ID
|
|
83
|
+
2. **OAuth client_secret** — click "Show" or "Reveal" first, then extract the value
|
|
84
|
+
|
|
85
|
+
**Important:** Notion requires a client secret for the token exchange (sent via HTTP Basic Auth). Both values are needed.
|
|
86
|
+
|
|
87
|
+
Tell the user: "Credentials extracted! Now let's connect your Notion workspace."
|
|
88
|
+
|
|
89
|
+
## Step 5: Connect Notion
|
|
90
|
+
|
|
91
|
+
Tell the user: "Opening Notion authorization so you can grant Vellum access to your workspace. You'll see a Notion consent page — just click 'Allow access'."
|
|
92
|
+
|
|
93
|
+
Use the `credential_store` tool to connect Notion via OAuth2:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
action: "oauth2_connect"
|
|
97
|
+
service: "integration:notion"
|
|
98
|
+
client_id: "<the extracted OAuth client_id>"
|
|
99
|
+
client_secret: "<the extracted OAuth client_secret>"
|
|
100
|
+
auth_url: "https://api.notion.com/v1/oauth/authorize"
|
|
101
|
+
token_url: "https://api.notion.com/v1/oauth/token"
|
|
102
|
+
scopes: []
|
|
103
|
+
extra_params: {"owner": "user"}
|
|
104
|
+
token_endpoint_auth_method: "client_secret_basic"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This will open the Notion authorization page in the user's browser. Wait for the flow to complete.
|
|
108
|
+
|
|
109
|
+
## Step 6: Celebrate!
|
|
110
|
+
|
|
111
|
+
Once connected, tell the user:
|
|
112
|
+
|
|
113
|
+
"**Notion is connected!** You're all set. You can now read and write pages and databases in your Notion workspace through Vellum. Try asking me to list your databases or read a specific page!"
|
|
114
|
+
|
|
115
|
+
Summarize what was accomplished:
|
|
116
|
+
- Created a Notion public integration called "Vellum Assistant"
|
|
117
|
+
- Configured the OAuth redirect URI
|
|
118
|
+
- Connected your Notion workspace with read and write access
|
|
119
|
+
|
|
120
|
+
## Error Handling
|
|
121
|
+
|
|
122
|
+
- **Page load failures:** Retry navigation once. If it still fails, tell the user and ask them to check their internet connection.
|
|
123
|
+
- **"Public" integration type not available:** The user may need to enable public integrations in their workspace settings. Guide them to Workspace Settings > Integrations.
|
|
124
|
+
- **Element not found for click/type:** Take a fresh `browser_snapshot` to re-assess the page layout. Notion's UI may have changed; adapt your selectors.
|
|
125
|
+
- **User declines an approval gate:** Don't push back. Explain briefly why the step matters, offer to try again, or cancel gracefully.
|
|
126
|
+
- **OAuth flow timeout or failure:** Tell the user what happened and offer to retry. The integration is already created, so they only need to re-run the connect step.
|
|
127
|
+
- **Any unexpected state:** Take a `browser_screenshot` and `browser_snapshot`, describe what you see, and ask the user for guidance.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "OAuth Setup"
|
|
3
|
+
description: "Connect any OAuth service — create app credentials and authorize via browser automation"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
includes: ["browser"]
|
|
6
|
+
metadata: {"vellum": {"emoji": "🔑"}}
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are helping the user connect an OAuth-based service to Vellum. This is a generic setup flow that works for any provider with a well-known OAuth config.
|
|
10
|
+
|
|
11
|
+
**Tone:** Be friendly and reassuring throughout. Narrate what you're doing in plain language so the user always knows what's happening. After each step, briefly confirm what was accomplished before moving on.
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
|
|
15
|
+
You will be given a `service` name (e.g., "discord", "linear", "spotify"). If not provided, ask the user which service they want to connect.
|
|
16
|
+
|
|
17
|
+
## Step 1: Read the service config
|
|
18
|
+
|
|
19
|
+
Use `credential_store` with `action: "describe"` and `service: "<name>"` to get the well-known OAuth config. This returns:
|
|
20
|
+
- `scopes` — permissions to request
|
|
21
|
+
- `redirectUri` — the callback URL to register
|
|
22
|
+
- `callbackTransport` — loopback or gateway
|
|
23
|
+
- `requiresClientSecret` — whether a client secret is needed
|
|
24
|
+
- `authUrl` / `tokenUrl` — OAuth endpoints
|
|
25
|
+
|
|
26
|
+
It may also include a `setup` object with rich metadata:
|
|
27
|
+
- `setup.displayName` — the provider's name
|
|
28
|
+
- `setup.dashboardUrl` — where to create the app
|
|
29
|
+
- `setup.appType` — what kind of app to create
|
|
30
|
+
- `setup.requiresClientSecret` — whether a client secret is needed
|
|
31
|
+
- `setup.notes` — provider-specific guidance
|
|
32
|
+
|
|
33
|
+
If no config is found, tell the user this service doesn't have a pre-configured setup and offer to help them configure it manually via `oauth2_connect`.
|
|
34
|
+
|
|
35
|
+
## Step 2: Choose the flow based on setup metadata
|
|
36
|
+
|
|
37
|
+
### If `setup` metadata is present (rich flow)
|
|
38
|
+
|
|
39
|
+
Continue to Step 3 (Rich Flow).
|
|
40
|
+
|
|
41
|
+
### If `setup` metadata is absent (manual flow)
|
|
42
|
+
|
|
43
|
+
The provider has OAuth config (endpoints, scopes) but no setup automation metadata. Guide the user through a manual app creation:
|
|
44
|
+
|
|
45
|
+
1. Tell the user: "I have the OAuth endpoints and scopes for this service, but I don't have developer dashboard automation for it. You'll need to create an OAuth app manually."
|
|
46
|
+
2. Provide the details they need:
|
|
47
|
+
- **Scopes to request:** list the `scopes` from the config
|
|
48
|
+
- **Redirect URI:** show the `redirectUri` value
|
|
49
|
+
- **Whether a client secret is required:** use the top-level `requiresClientSecret` field
|
|
50
|
+
3. Ask the user to:
|
|
51
|
+
- Go to the provider's developer dashboard
|
|
52
|
+
- Create an OAuth app (name it "Vellum Assistant")
|
|
53
|
+
- Set the redirect URI
|
|
54
|
+
- Configure the required scopes
|
|
55
|
+
- Copy the Client ID (and Client Secret if required)
|
|
56
|
+
4. Once they provide the credentials, skip to **Step 8: Connect**.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Rich Flow (when `setup` is present)
|
|
61
|
+
|
|
62
|
+
### Step 3: Tell the user what's happening
|
|
63
|
+
|
|
64
|
+
Tell the user:
|
|
65
|
+
- "I'll walk you through creating a {setup.appType} so Vellum can connect to {setup.displayName}. The whole process takes a few minutes."
|
|
66
|
+
- "I'll be automating the {setup.displayName} developer dashboard in the browser — you'll be able to see everything I'm doing."
|
|
67
|
+
- "I'll ask for your approval before each major step, so nothing happens without your say-so."
|
|
68
|
+
|
|
69
|
+
### Step 4: Navigate to the developer dashboard
|
|
70
|
+
|
|
71
|
+
Use `browser_navigate` to go to `setup.dashboardUrl`.
|
|
72
|
+
|
|
73
|
+
Take a `browser_screenshot` and `browser_snapshot`:
|
|
74
|
+
- **If a sign-in page appears:** Tell the user to sign in and wait for confirmation.
|
|
75
|
+
- **If the dashboard loads:** Continue to Step 5.
|
|
76
|
+
|
|
77
|
+
### Step 5: Create an app
|
|
78
|
+
|
|
79
|
+
**Ask for approval before proceeding.** Use `ui_show` with `surface_type: "confirmation"` explaining what you're about to create.
|
|
80
|
+
|
|
81
|
+
Once approved:
|
|
82
|
+
1. Find and click the "Create App" / "New Application" / "New Integration" button (adapt to the provider's UI)
|
|
83
|
+
2. Name it "Vellum Assistant"
|
|
84
|
+
3. Follow any guidance from `setup.notes`
|
|
85
|
+
4. Complete the creation flow
|
|
86
|
+
|
|
87
|
+
Take a `browser_screenshot` to confirm.
|
|
88
|
+
|
|
89
|
+
### Step 6: Configure scopes/permissions
|
|
90
|
+
|
|
91
|
+
**Ask for approval before proceeding.** List the `scopes` from the config and explain what each grants.
|
|
92
|
+
|
|
93
|
+
Once approved, navigate to the OAuth/permissions section and add each scope. Follow `setup.notes` for any provider-specific guidance (e.g., "User Token Scopes" vs "Bot Token Scopes").
|
|
94
|
+
|
|
95
|
+
Take a `browser_screenshot` after adding all scopes.
|
|
96
|
+
|
|
97
|
+
### Step 7: Set redirect URL
|
|
98
|
+
|
|
99
|
+
Check the `redirectUri` from the config:
|
|
100
|
+
- If it mentions "not currently configured", `GATEWAY_BASE_URL`, or `INGRESS_PUBLIC_BASE_URL` — the user needs a public gateway URL configured. Check if one is set; if not, load the `public-ingress` skill first.
|
|
101
|
+
- If it says "automatic" — skip this step entirely (no redirect URI needed).
|
|
102
|
+
- Otherwise, enter the `redirectUri` exactly as provided.
|
|
103
|
+
|
|
104
|
+
Take a `browser_snapshot` to confirm.
|
|
105
|
+
|
|
106
|
+
### Step 7b: Extract credentials
|
|
107
|
+
|
|
108
|
+
Navigate to the app's credentials/settings section.
|
|
109
|
+
|
|
110
|
+
Use `browser_extract` to read:
|
|
111
|
+
1. **Client ID** (or equivalent)
|
|
112
|
+
2. **Client Secret** (if `requiresClientSecret` is true) — click "Show"/"Reveal" first if needed
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Step 8: Connect
|
|
117
|
+
|
|
118
|
+
Tell the user you're opening the authorization page.
|
|
119
|
+
|
|
120
|
+
Use `credential_store` with:
|
|
121
|
+
```
|
|
122
|
+
action: "oauth2_connect"
|
|
123
|
+
service: "<service name>"
|
|
124
|
+
client_id: "<extracted client ID>"
|
|
125
|
+
client_secret: "<extracted client secret>" (if required)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Everything else (endpoints, scopes, params) is auto-filled from the well-known config. Wait for the flow to complete.
|
|
129
|
+
|
|
130
|
+
## Step 9: Celebrate!
|
|
131
|
+
|
|
132
|
+
Once connected, tell the user:
|
|
133
|
+
- If `setup` is present: "**{setup.displayName} is connected!** You're all set."
|
|
134
|
+
- If `setup` is absent: "**{service} is connected!** You're all set."
|
|
135
|
+
|
|
136
|
+
Summarize what was accomplished.
|
|
137
|
+
|
|
138
|
+
## Error Handling
|
|
139
|
+
|
|
140
|
+
- **Page load failures:** Retry once. If it still fails, ask the user to check their connection.
|
|
141
|
+
- **Element not found:** Take a fresh `browser_snapshot`. The provider's UI may have changed — adapt dynamically.
|
|
142
|
+
- **User declines an approval gate:** Don't push back. Explain why it matters, offer to retry or cancel.
|
|
143
|
+
- **OAuth flow timeout or failure:** Offer to retry. The app is already created, so only the connect step needs to be re-run.
|
|
144
|
+
- **Any unexpected state:** Take a `browser_screenshot` and `browser_snapshot`, describe what you see, and ask for guidance.
|