@dench.com/cli 3.11.56-staging.1041 → 3.11.57-staging.1046
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"revision": "
|
|
3
|
-
"builtinHash": "
|
|
2
|
+
"revision": "3abfe35e1d45143420723e37e0a340c72ebd6dff8df775fda07f5bdce8f43de1",
|
|
3
|
+
"builtinHash": "6817a0d02fe3696e4e8e98f0c62b882410ff558f085a58398453a1661ff96378",
|
|
4
4
|
"files": {
|
|
5
5
|
"SKILL.md": {
|
|
6
6
|
"sha256": "9dd78e262e1f725d703647bc5c83e021fa6fc14de31d0ed614917908a511c464",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"content": "---\nname: apps\ndescription: Build self-contained Dench Apps — `.dench.app` web apps that run inside the workspace and talk to the CRM, analytics, files, chat, integrations, notifications, billing and the full /api/v1 surface through the injected `window.dench` SDK. This is the contract — the method + permission index is generated from the runtime and cannot drift. Covers the recipe (create → write → validate), analytics-first data access (compute before objects.query), maps via dench.geo, dench.api for every v1 operation, real inbound webhooks, permissions, design tokens, theme sync, and the create/install/publish lifecycle. Load before building an in-workspace app or chat app widget.\n---\n\n# Dench Apps\n\nA Dench App is a folder ending in `.dench.app/` under the workspace's `apps/`\ndirectory — a `.dench.yaml` manifest plus `index.html` (inline CSS/JS). No\nbuild step, no deploy, no runtime package. The host injects `window.dench`\ninto the iframe; every method is a Promise.\n\n```\napps/\n pipeline-health.dench.app/\n .dench.yaml # name, icon, permissions, entry\n index.html # the bridge is auto-injected; inline everything\n```\n\n```yaml\nname: Pipeline Health\nicon: bar-chart\ndescription: Stage mix, win rate and where deals are\nentry: index.html\npermissions:\n - crm:read\n - ui\n```\n\n`window.dench.version` is the SDK semver (`2.x`); `window.dench.capabilities`\nlists every curated method. Typed autocomplete comes from the CLI package\nalready in every sandbox (types only — there is **no** `@dench.com/app-sdk`):\n\n```js\n/// <reference types=\"@dench.com/cli/app-sdk\" />\n/** @type {import(\"@dench.com/cli/app-sdk\").Dench} */\nconst dench = window.dench;\n```\n\n## The recipe (do this, in this order)\n\n1. `load_skill apps` (this file). For CRM shapes also read `references/CRM.md`.\n2. `dench apps create <slug> --name \"…\" --icon <lucide-name>` — scaffolds a\n working app (`analytics.compute` + `objects.query` + theme sync) and\n registers it. Never hand-create the folder.\n3. `write_file` `/apps/<slug>.dench.app/index.html` — one file, inline\n CSS/JS, the design tokens below, real loading/empty/error states.\n4. Need something the aliases don't cover? **Discover, never invent**:\n `await dench.api.operations({ group: \"crm\" })` lists every callable\n operation with its `permission`, `cli` and `path`; `references/API.md`\n is the same catalog. Call it as `dench.api.call(\"crm.query\", args)` or\n `dench.api.crm.query(args)`.\n5. `dench apps validate /apps/<slug>.dench.app` — parses the manifest, scans\n the JS for every `dench.*` call, and fails on a method that does not exist\n or a permission the manifest does not declare. Fix, re-run, then open it.\n\n**One donut in chat → `present_artifact({ kind: \"analytics\" })`, not an\napp.** A custom dashboard, a combo/scatter, a multi-object widget, or an\ninteractive tool → an app that still gets every number from\n`dench.analytics.compute`.\n\n## Errors\n\nEvery rejection is a `DenchBridgeError` (`err.name === \"DenchBridgeError\"`)\nwith a stable `code`:\n\n| `code` | Meaning | Fix |\n|---|---|---|\n| `permission_denied` | Method/operation needs a scope the manifest lacks (`err.permission`). | Add it to `.dench.yaml` `permissions`. |\n| `unknown_method` | No such `dench.<ns>.<method>`; message lists that namespace's real methods. | Use the index below / `api.operations()`. |\n| `unknown_operation` | `api.call` id is not a public `/api/v1` operation. | `api.operations()`. |\n| `unsupported_local` | Operation only exists in the CLI (`sessions`, `fs`, `crm import`). | Not available to apps. |\n| `validation_failed` | Args did not match the operation schema (`err.details`). | Check the request type in `app-sdk.d.ts`. |\n| `unavailable` | Host surface lacks a handler (e.g. `ui.toast` in a headless surface). | Feature-detect and degrade. |\n| `deprecated` | Removed API (`db.query`). | Use the replacement in the message. |\n| `timeout` | 30 s (300 s for streaming `chat.send`). | Retry / narrow the request. |\n| `upstream_failed` | The Dench API returned an error (`err.status`, message). | Show it. |\n\nMessages still start with the code (`permission_denied: …`) so string checks\nkeep working.\n\n## Getting data into your app (strict order)\n\nStop at the first rung that fits:\n\n1. **Anything you will DRAW or SUM → `dench.analytics.compute`.** Never\n `objects.query` a page of rows and aggregate in JS: it is slow, misses\n rows past page 1 (1000 cap, no offset) and disagrees with the strip.\n2. **CRM rows → `dench.objects.query` / `dench.objects.list`.** Filter\n server-side. Comments, tasks, watchers, views: `dench.comments.*`,\n `dench.tasks.*`, `dench.watch.*`, `dench.views.*`.\n3. **Everything else Dench knows → `dench.<alias>` or `dench.api.*`**:\n notifications, members, meetings, lists, campaigns, email, billing,\n memory, workspace, files, chat history, App Store, search /\n web / images (gateway).\n4. **Connected apps (Stripe, Gmail, Slack, GitHub, …) →\n `dench.integrations.*`.**\n5. **`dench.http.fetch` — LAST RESORT**, public unauthenticated APIs only.\n No credentials are attached; it cannot reach `dench.com/api/*`. Never\n embed keys in app source.\n6. **`dench.chat.send` — AI reasoning only** (summarize, draft, coach).\n Never a data pipe.\n\nApps must go through the bridge: same-origin `fetch(\"/api/…\")` from app code\nis unsupported and breaks when apps move to their own origin.\n\n## Analytics: `compute` first (KPIs, charts, maps)\n\n`dench.analytics.compute` runs `computePanels` — the exact query behind the\ndashboard strip above every table: same numbers, same visibility rules, same\n`period` and click-to-filter semantics. Counts, sums, averages, group-bys,\nmonth-or-coarser time series and every derived metric (won/lost/open $,\nMRR/ARR, forecast, win rate) read pre-computed buckets and are exact at any\ntable size (`source: \"aggregate\"` on the panel). Anything else scans the\nnewest rows; on a table too large for that scan the response says\n`truncated: true` and `snapshot.stale: true`, a background pass over every\nrow is kicked off, and the next call is exact (`source: \"snapshot\"`).\n**Period expansion is server-side**; never hand-build date filters.\n\n```js\n// Stored dashboard (+ the view's own dashboard when viewName is set)\nconst cfg = await dench.analytics.get(\"deal\");\ncfg.panels; cfg.fieldRoles; cfg.collapsed;\n\n// Stored panels, this month vs last month (previousValue), ad-hoc extras\nconst res = await dench.analytics.compute(\"deal\", {\n viewName: \"West Coast\", // optional: follow a saved view's filters\n period: \"this_month\", // this_week | this_month | last_month |\n // this_quarter | last_quarter | this_year | all\n panelIds: [\"tpl:sales:open-pipeline\"], // stored panels (omit for all)\n panels: [ // ad-hoc, nothing persisted\n { id: \"by-stage\", title: \"By stage\", type: \"donut\", metric: \"sum\",\n metricField: \"Amount\", groupBy: \"Stage\", sortOrder: 0 },\n { id: \"owners\", title: \"Owners\", type: \"leaderboard\", metric: \"count\",\n groupBy: \"Owner\", sortOrder: 1 },\n { id: \"new\", title: \"New / week\", type: \"line\", metric: \"count\",\n dateField: \"$createdAt\", dateBucket: \"week\", sortOrder: 2 },\n { id: \"where\", title: \"Where\", type: \"map\", metric: \"count\",\n groupBy: \"$location\", sortOrder: 3 },\n ],\n // Click-to-filter chips, same as the strip. `dimension` is the bare\n // field the click was on (a panel's groupBy / dateField; \"$location\"\n // for a map). Every panel is scoped EXCEPT those drawn along that\n // dimension, so the clicked chart keeps its full picture:\n drillFilters: [{ dimension: \"Stage\",\n filter: { id: \"drill\", conjunction: \"and\",\n rules: [{ id: \"bucket\", field: \"Stage\", operator: \"is\", value: \"Won\" }] } }],\n // A map click: filter on `$location` (the resolved place every compute\n // row carries), never on res.locationRole — that may be a relation\n // path like \"Account.HQ Location\", which is not a column.\n // { dimension: \"$location\", filter: { id: \"d\", conjunction: \"and\",\n // rules: [{ id: \"p\", field: \"$location\", operator: \"within\", value: \"California\" }] } }\n});\nres.panels[0].buckets; // [{ key, label, count, value, color? }]\nres.panels[1].value; // scalar; .previousValue when `period` is set\nres.panels[2].series; // [{ bucket, label, value, count, projected? }]\nres.panels[2].seriesGroups; // groupBy split of a time series (top 5 + Other)\nres.locationRole; // which field fed `$location` (label only; filter on `$location`)\nres.truncated; // badge numbers \"approximate\" when true\n```\n\nPanel `type`: `stat` `bar` `line` `area` `donut` `funnel` `leaderboard`\n`forecast` `map`; `metric`: `count` `sum` `avg` `min` `max` (+ `metricField`);\n`derived`: `conversion_rate` `win_rate` `won_amount` `lost_amount`\n`open_pipeline` `pipeline_forecast` `mrr` `arr` (need field roles —\n`dench.analytics.roles(objectName, { amount, stage, wonValues, … })`).\nSynthetic fields `$createdAt` and `$location` work wherever a field name goes.\nWriters: `save` / `delete` / `reorder` (object or `viewName` dashboard — the\nfirst save on an inheriting view forks it), `roles`, `collapse` / `expand`,\n`scope(objectName, viewName, \"own\" | \"shared\")`. Full model in\n`references/CRM.md` → Analytics.\n\nDraw with hand-written SVG. Leaderboard / donut buckets carry the raw key —\n`dench.ui.openEntry(objectName, id)` from a row, or re-`compute` with a\n`drillFilters` chip on click.\n\n### Maps: `compute` + `dench.geo` (never a geocoder)\n\nA `map` panel returns place-string buckets (`buckets[].key` is the raw\n`$location` value) plus `locationRole`. Placing them on shapes is the same\nclient pipeline the strip uses, exposed host-side — apps must not call an\nexternal geocoder or ship a gazetteer:\n\n```js\nconst country = await dench.geo.resolveLocation(\"Austin, TX\"); // { iso2:\"US\", id:\"840\", name }\nconst regions = await dench.geo.loadAdmin1(\"US\"); // GeoJSON features (what the map draws)\nconst state = await dench.geo.resolveRegion(\"Austin, TX\", \"US\"); // { id, name: \"Texas\", … }\n```\n\n`loadAdmin1(iso2)` returns first-level divisions (`properties.name`,\n`postal`, `lat`, `lng`); `/geo/admin1/<ISO2>.json` and `/geo/places.json`\nare also fetchable same-origin if you need the raw topology. Click-to-filter\non a shape: collect the raw place strings behind it and pass them as a\n`drillFilters` chip on `locationRole`.\n\n## CRM rows: `objects.query` vs `objects.list`\n\n```js\n// Server-side filter + sort. Resolves to an ARRAY of flat rows.\nconst customers = await dench.objects.query({\n object: \"company\",\n filter: { Type: \"Customer\", MRR: { $gt: 500 } },\n sort: [{ field: \"MRR\", dir: \"desc\" }],\n select: [\"Name\", \"MRR\", \"Health\"],\n limit: 200, // default 100, max 1000 — NO offset\n});\ncustomers[0].Name; customers[0].id; // flat: fields on the row, id at .id\n```\n\nOperators: bare value = equality; `$eq $ne $in $nin $gt $gte $lt $lte $exists\n$startsWith $endsWith $contains`, nestable with `$and` / `$or`.\n\n`objects.list(name, { page, pageSize, search })` is the only paginated\nsurface and also returns the view snapshot (`fields`, `statuses`,\n`totalCount`). Loop `page` until `entries.length < pageSize`.\n\n```js\nawait dench.objects.create(\"task\", { Title: \"Follow up\" });\nawait dench.objects.update(\"deal\", id, { Stage: \"Won\" });\nconst schema = await dench.objects.getSchema(\"deal\"); // fields, enum options\n```\n\n## `dench.api` — the whole `/api/v1` surface\n\nEvery public operation the CLI and REST API expose (~300) is callable:\n\n```js\nawait dench.api.call(\"crm.query\", { object: \"deal\", filter: { Stage: \"Won\" } });\nawait dench.api.crm.analytics.compute({ objectName: \"deal\", period: \"this_year\" });\nawait dench.api.notifications.list({ filter: \"unread\" });\nawait dench.api.billing.status();\n\nconst ops = await dench.api.operations({ group: \"meetings\" });\n// [{ id: \"meetings.list\", cli: \"dench meetings list\", method: \"GET\",\n// path: \"/meetings\", permission: \"meetings:read\", summary }]\n```\n\nRules: path parameters are ordinary args (`{ objectName, entryId, … }`).\nLocal-only CLI operations reject with `unsupported_local`. The permission is\nthe operation's scope (`<group>:read` for GET, `<group>:write` otherwise —\nsee the table). Prefer the curated aliases; they are the same calls with\npositional sugar.\n\n## Chat, agent, tools\n\n```js\nconst s = await dench.chat.createSession(\"Deal coach\");\nawait dench.chat.send(s.id, \"Summarise my top 5 deals\", {\n onEvent: (e) => { if (e.type === \"text-delta\") out.textContent += e.data; },\n});\nconst history = await dench.chat.getHistory(s.id); // { thread, messages }\nawait dench.chat.isActive(s.id); // boolean\nconst run = await dench.agent.send(\"Draft a renewal email for Acme\");\nrun.threadId; run.runId; // open with ui.navigate(`/?thread=${run.threadId}`)\nawait dench.tool.register(\"refreshBoard\", () => reload(), { description: \"Re-render\" });\n```\n\n## Integrations (connected apps)\n\n```js\nconst connections = await dench.integrations.list();\nconst found = await dench.integrations.search({ query: \"list charges\", toolkit: \"stripe\" });\nconst res = await dench.integrations.execute({ tool: \"STRIPE_LIST_CHARGES\", arguments: { limit: 100 } });\nres.data;\n```\n\n`integrations:read` covers listing, searching and read-only tools\n(FETCH/GET/LIST/SEARCH/READ/FIND). Anything else also needs\n`integrations:write`. Rejections: `not_connected`, `account_selection_required`\n(pass `connectedAccountId` from `list()`), `permission_denied`.\n\n## Inbound webhooks (real)\n\n```js\nconst hook = await dench.webhooks.register(\"stripe\");\nhook.url; // https://<workspace>/api/apps/webhooks/<app>/stripe/<token>\nhook.secret; // shown ONCE — give it to the sender for signing\ndench.webhooks.on(\"stripe\", (evt) => render(evt.body)); // polls while open\nconst backlog = await dench.webhooks.poll(\"stripe\", { since: lastSeen });\n```\n\nSenders `POST` JSON to the URL. If they sign Stripe-style\n(`X-Dench-Signature: sha256=<hmac(ts.body)>`, `X-Dench-Timestamp`), the event\ncarries `verified: true`. Events are org + app scoped and kept 7 days.\n\n## UI, storage, events, inter-app bus\n\n```js\nawait dench.ui.toast(\"Saved\", { type: \"success\" });\nawait dench.ui.navigate(\"people\"); // references/NAVIGATION.md paths\nawait dench.ui.openEntry(\"deal\", id);\nawait dench.store.set(\"filters\", { stage: \"Won\" });\ndench.events.on(\"object.entry.updated\", refresh); // also created / deleted / theme.changed\nawait dench.bus.send(\"other-app\", { hello: 1 }); // inter-app messaging\ndench.bus.on((m) => console.log(m.from, m.message));\n```\n\n`dench.apps.*` is the **App Store** (`list`, `gallery`, `create`, `install`,\n`publish`, `uninstall`, `enable`, `disable`, `pin`, `unpin`). `dench.apps.send`\n/ `dench.apps.on` remain as deprecated aliases of `dench.bus` for one major\nversion.\n\n## Permissions\n\nDeny-by-default; declare exactly what you call and nothing is implicit\n(`billing.topup` needs `billing:write`). Consented at install time. The\nscopes below are generated from the runtime:\n\n<!-- app-sdk:permissions:start -->\n| Scope | Unlocks (`dench.*` aliases) | `dench.api` groups |\n|---|---|---|\n| `agent-config:read` | `agentConfig.show` | `agent-config` |\n| `agent-config:write` | `agentConfig.edit` | `agent-config` |\n| `agent:invoke` | `agent.send`, `tool.register` | — |\n| `ai:chat` | `chat.createSession`, `chat.send`, `chat.getHistory`, `chat.getSessions`, `chat.abort`, `chat.isActive`, `chat.list`, `chat.search`, … (10) | `chat` |\n| `apps:message` | `bus.send`, `bus.on`, `bus.list`, `apps.send`, `apps.on` | — |\n| `apps:read` | `apps.list`, `apps.gallery` | `apps` |\n| `apps:write` | `apps.create`, `apps.install`, `apps.publish`, `apps.uninstall`, `apps.enable`, `apps.disable`, `apps.pin`, `apps.unpin` | `apps` |\n| `auth:write` | — | `auth` |\n| `billing:read` | `billing.status` | `billing` |\n| `billing:write` | `billing.topup`, `billing.upgrade` | `billing` |\n| `browser:read` | — | `browser` |\n| `browser:write` | — | `browser` |\n| `campaigns:read` | `campaigns.sources`, `campaigns.sourceSignals`, `campaigns.profile`, `campaigns.getDraft`, `campaigns.savedDrafts`, `campaigns.resumeDraft`, `campaigns.pendingReview`, `campaigns.todayQueue`, … (19) | `campaigns` |\n| `campaigns:write` | `campaigns.create`, `campaigns.draft`, `campaigns.search`, `campaigns.addPeople`, `campaigns.addFromSearch`, `campaigns.updateSources`, `campaigns.previewSignal`, `campaigns.saveDraft`, … (37) | `campaigns` |\n| `clipboard:read` | `clipboard.read` | — |\n| `clipboard:write` | `clipboard.write` | — |\n| `crm:read` | `objects.list`, `objects.query`, `objects.get`, `objects.getSchema`, `objects.getOptions`, `analytics.get`, `analytics.compute`, `comments.list`, … (21) | `crm` |\n| `crm:write` | `objects.create`, `objects.update`, `objects.delete`, `objects.bulkDelete`, `analytics.save`, `analytics.update`, `analytics.hide`, `analytics.show`, … (36) | `crm` |\n| `cron:schedule` | `cron.schedule`, `cron.list`, `cron.update`, `cron.run`, `cron.cancel` | `routines` |\n| `email:read` | `email.draft`, `email.senders`, `email.signature`, `email.messages`, `email.message`, `email.campaigns`, `email.campaign`, `email.identities` | `email` |\n| `email:write` | `email.createDraft`, `email.updateDraft`, `email.sendDraft`, `email.uploadAttachment`, `email.sendFromMailbox`, `email.send` | `email` |\n| `environments:read` | — | `environments` |\n| `environments:write` | — | `environments` |\n| `files:read` | `files.read`, `files.list`, `files.download` | `files` |\n| `files:write` | `files.write`, `files.delete`, `files.mkdir`, `files.move` | `files` |\n| `http:external` | `http.fetch` | — |\n| `image:write` | `images.generate`, `images.edit` | `gateway` |\n| `integrations:read` | `integrations.list`, `integrations.search`, `integrations.execute` | `gateway` |\n| `integrations:write` | — | `gateway` |\n| `lists:read` | `lists.list`, `lists.get` | `lists` |\n| `lists:write` | `lists.rename`, `lists.delete` | `lists` |\n| `meetings:read` | `meetings.list`, `meetings.transcript`, `meetings.actionItems`, `meetings.participants`, `meetings.sharing` | `meetings` |\n| `meetings:write` | `meetings.addActionItems`, `meetings.setActionItemDone`, `meetings.setSharing` | `meetings` |\n| `members:read` | `members.get`, `members.presence`, `members.activity`, `members.tasks`, `members.me` | `members` |\n| `members:write` | `members.updateMe` | `members` |\n| `memory:read` | `memory.get`, `memory.search` | `memory` |\n| `memory:write` | `memory.save` | `memory` |\n| `notifications:read` | `notifications.list`, `notifications.unreadCount`, `notifications.getPreferences` | `notifications` |\n| `notifications:write` | `notifications.read`, `notifications.readAll`, `notifications.archive`, `notifications.updatePreferences` | `notifications` |\n| `search:read` | `search.web`, `search.contents`, `search.answer` | `gateway` |\n| `secrets:read` | — | `secrets` |\n| `secrets:write` | — | `secrets` |\n| `settings:read` | — | `settings` |\n| `settings:write` | — | `settings` |\n| `store:read` | `store.get`, `store.list` | — |\n| `store:write` | `store.set`, `store.delete`, `store.clear` | — |\n| `ui` | `ui.toast`, `ui.navigate`, `ui.openEntry`, `ui.setTitle`, `ui.confirm`, `ui.prompt` | — |\n| `web:read` | `web.scrape`, `web.brand`, `web.screenshot`, `web.extract` | `gateway` |\n| `webhooks:receive` | `webhooks.register`, `webhooks.on`, `webhooks.poll`, `webhooks.list`, `webhooks.delete` | `apps` |\n| `workspace:read` | `workspace.context`, `workspace.status`, `workspace.agents`, `workspace.artifacts`, `workspace.instructions` | `workspace` |\n| `workspace:write` | — | `workspace` |\n<!-- app-sdk:permissions:end -->\n\n`<group>:write` implies `<group>:read`. Legacy names (`objects`, `database`,\n`files`, `store`, `integrations`, `agent`, `cron`, `webhooks`, `clipboard`,\n`apps`) are still honoured as aliases.\n\n## Method index (generated)\n\nEvery curated method, its permission and what it wraps. Anything not here\nand not in `dench.api.operations()` does not exist — do not invent it.\n\n<!-- app-sdk:index:start -->\n**`dench.app`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `getManifest()` | — | The parsed .dench.yaml of this app. |\n| `getTheme()` | — | Current workspace theme (\"light\" \\| \"dark\"). |\n\n**`dench.context`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `getWorkspace()` | — | Workspace name/slug the app is running in. |\n| `getAppInfo()` | — | App path, folder slug, granted permissions and manifest. |\n\n**`dench.api`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `call(operationId: K, args?: Req<K>)` | — | Call ANY public /api/v1 operation by id (e.g. \"crm.query\"). Permission is the operation's own scope. |\n| `operations(opts?: { group?: string })` | — | Runtime catalog of every callable operation: id, cli, method, path, permission. |\n\n**`dench.objects`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `list(name: string, opts?: ObjectsListOptions)` | `crm:read` | Paged rows of an object (flat `id` + field-on-row shape). |\n| `query(dsl: ObjectsQuery)` | `crm:read` | Filter/sort/select rows with the query DSL (max 1000). Aggregate with analytics.compute instead. |\n| `get(name: string, entryId: string)` | `crm:read` | One entry by id. |\n| `create(name: string, fields: Record<string, unknown>)` | `crm:write` | Create an entry. |\n| `update(name: string, entryId: string, fields: Record<string, unknown>)` | `crm:write` | Patch an entry's fields. |\n| `delete(name: string, entryId: string)` | `crm:write` | Delete one entry. |\n| `bulkDelete(name: string, entryIds: string[])` | `crm:write` | Delete many entries. |\n| `getSchema(name: string)` | `crm:read` | Object definition: fields, types, enum options, relations. |\n| `getOptions(name: string, query?: string)` | `crm:read` | Relation picker options (id + label) for an object, optionally filtered. |\n\n**`dench.analytics`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `get(objectName: string, opts?: crm.analytics.get args)` | `crm:read` | Stored dashboard: panels, field roles, collapsed flag (+ the view's own dashboard when viewName is set). → `crm.analytics.get` |\n| `compute(objectName: string, opts?: crm.analytics.compute args)` | `crm:read` | Pre-bucketed KPIs/charts/maps — the strip's own math. Stored dashboard, `panelIds`, or ad-hoc `panels`; `period` and `drillFilters` expand server-side. → `crm.analytics.compute` |\n| `save(objectName: string, panelId: string, panel: crm.analytics.save args[\"panel\"], opts?: crm.analytics.save args)` | `crm:write` | Create or update a stored panel (object dashboard, or the view's when viewName is set — first save forks an inheriting view). → `crm.analytics.save` |\n| `update(objectName: string, panelId: string, patch: crm.analytics.update args[\"patch\"], opts?: crm.analytics.update args)` | `crm:write` | Edit part of a stored panel (title, type, metric, groupBy, dateField, filters, derived, span, hidden, sortOrder …); null clears an optional key. → `crm.analytics.update` |\n| `hide(objectName: string, panelId: string, opts?: crm.analytics.hide args)` | `crm:write` | Take a chart off the strip above the table; it stays in the full analytics view. → `crm.analytics.hide` |\n| `show(objectName: string, panelId: string, opts?: crm.analytics.show args)` | `crm:write` | Bring a hidden chart back onto the strip. → `crm.analytics.show` |\n| `resize(objectName: string, panelId: string, span: crm.analytics.resize args[\"span\"], opts?: crm.analytics.resize args)` | `crm:write` | Set a card's width: span 2 (third) \\| 3 (half) \\| 4 (two thirds) \\| 6 (full) \\| null (default for the chart kind). → `crm.analytics.resize` |\n| `delete(objectName: string, panelId: string, opts?: crm.analytics.delete args)` | `crm:write` | Delete a stored panel. → `crm.analytics.delete` |\n| `reorder(objectName: string, panelIds: string[], opts?: crm.analytics.reorder args)` | `crm:write` | Persist the full panel order. → `crm.analytics.reorder` |\n| `roles(objectName: string, fieldRoles: crm.analytics.roles args[\"fieldRoles\"], opts?: crm.analytics.roles args)` | `crm:write` | Set the object's analytics setup shared by every chart and view: amount / stage / won-lost-converted / stageProbabilities / closeDate / recurrence / owner / location. Pass merge: true to change only the keys given (null clears one). → `crm.analytics.roles` |\n| `collapse(objectName: string)` | `crm:write` | Collapse the team-shared strip for this object. → `crm.analytics.collapse` |\n| `expand(objectName: string)` | `crm:write` | Expand the team-shared strip for this object. → `crm.analytics.expand` |\n| `scope(objectName: string, viewName: string, mode: crm.analytics.scope args[\"mode\"])` | `crm:write` | Flip a saved view between its \"own\" dashboard and the object's \"shared\" one. → `crm.analytics.scope` |\n\n**`dench.comments`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `list(objectName: string, entryId: string, opts?: crm.comments.list args)` | `crm:read` | Root comments on an entry (with reply previews), paged. → `crm.comments.list` |\n| `replies(commentId: string, opts?: crm.comments.replies args)` | `crm:read` | Replies under a root comment. → `crm.comments.replies` |\n| `get(commentId: string)` | `crm:read` | One comment. → `crm.comments.get` |\n| `create(objectName: string, entryId: string, body: string, opts?: crm.comments.create args)` | `crm:write` | Post a markdown comment (mention members with [@Name](/?member=<userId>), Dench with [@Dench](/?member=dench)). → `crm.comments.create` |\n| `update(commentId: string, body: string)` | `crm:write` | Edit a comment body. → `crm.comments.update` |\n| `delete(commentId: string)` | `crm:write` | Delete a comment. → `crm.comments.delete` |\n| `react(commentId: string, emoji: string)` | `crm:write` | Toggle an emoji reaction. → `crm.comments.react` |\n\n**`dench.watch`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `get(objectName: string, entryId: string)` | `crm:read` | Am I following this entry? → `crm.watch.get` |\n| `set(objectName: string, entryId: string, watching?: boolean)` | `crm:write` | Follow (default) or unfollow an entry. → `crm.watch.set` |\n\n**`dench.views`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `list(objectName: string)` | `crm:read` | Saved views of an object. → `crm.views.list` |\n| `get(objectName: string, viewName: string)` | `crm:read` | One saved view (filters, sort, columns, analytics). → `crm.views.get` |\n| `entries(objectName: string, viewName: string, opts?: crm.views.entries args)` | `crm:read` | Rows as the saved view shows them. → `crm.views.entries` |\n| `create(objectName: string, view: crm.views.create args)` | `crm:write` | Create a saved view. → `crm.views.create` |\n| `update(objectName: string, viewName: string, patch: crm.views.update args)` | `crm:write` | Update a saved view. → `crm.views.update` |\n| `delete(objectName: string, viewName: string)` | `crm:write` | Delete a saved view. → `crm.views.delete` |\n\n**`dench.tasks`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `mine(opts?: crm.tasks.mine args)` | `crm:read` | Open tasks assigned to me. → `crm.tasks.mine` |\n| `forEntry(objectName: string, entryId: string)` | `crm:read` | Tasks linked to an entry. → `crm.tasks.forEntry` |\n| `create(objectName: string, entryId: string, task: crm.tasks.createForEntry args)` | `crm:write` | Create a task on an entry. → `crm.tasks.createForEntry` |\n| `complete(entryId: string)` | `crm:write` | Mark a task done. → `crm.tasks.complete` |\n| `reopen(entryId: string)` | `crm:write` | Reopen a task. → `crm.tasks.reopen` |\n| `setPriority(entryId: string, priority: string \\| null)` | `crm:write` | Set a task's priority (one of the workspace's options) or clear it with null. → `crm.tasks.setPriority` |\n| `subtasks(entryId: string)` | `crm:read` | A task's subtasks. → `crm.tasks.subtasks.list` |\n| `createSubtask(entryId: string, subtask: crm.tasks.subtasks.create args)` | `crm:write` | Create a subtask under a task (one level deep; inherits the parent's record relations). → `crm.tasks.subtasks.create` |\n| `setParent(entryId: string, parentEntryId: string \\| null)` | `crm:write` | Nest a task under a parent, or promote it with null. → `crm.tasks.setParent` |\n| `delete(entryId: string, subtasks?: \"delete\" \\| \"keep\")` | `crm:write` | Delete a task; its subtasks go with it unless subtasks is \"keep\". → `crm.tasks.delete` |\n| `getRepeat(entryId: string)` | `crm:read` | How a task repeats (rule, RRULE, trigger, ends, next due), or null. → `crm.tasks.repeat.get` |\n| `setRepeat(entryId: string, repeat: crm.tasks.repeat.set args)` | `crm:write` | Make a task repeat or change how it repeats (JSON rule or RRULE). An undated task gets its due date anchored on the first matching day from today. → `crm.tasks.repeat.set` |\n| `clearRepeat(entryId: string)` | `crm:write` | Stop a task repeating. → `crm.tasks.repeat.clear` |\n| `skipRepeat(entryId: string)` | `crm:write` | Skip the current occurrence; the next one is created now. → `crm.tasks.repeat.skip` |\n| `pauseRepeat(entryId: string)` | `crm:write` | Pause a repeating task. → `crm.tasks.repeat.pause` |\n| `resumeRepeat(entryId: string)` | `crm:write` | Resume a paused repeating task. → `crm.tasks.repeat.resume` |\n| `series(opts?: crm.tasks.series.list args)` | `crm:read` | Every repeating-task series in the workspace. → `crm.tasks.series.list` |\n| `seriesOccurrences(seriesId: string)` | `crm:read` | Every occurrence of one series. → `crm.tasks.series.occurrences` |\n\n**`dench.notifications`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `list(opts?: notifications.list args)` | `notifications:read` | My notifications (inbox \\| unread \\| archived \\| all \\| mentions). → `notifications.list` |\n| `unreadCount()` | `notifications:read` | Unread badge count. → `notifications.unreadCount` |\n| `read(notificationId: string, read?: boolean)` | `notifications:write` | Mark one read (or unread). → `notifications.read` |\n| `readAll()` | `notifications:write` | Mark everything read. → `notifications.readAll` |\n| `archive(notificationId: string)` | `notifications:write` | Archive one notification. → `notifications.archive` |\n| `getPreferences()` | `notifications:read` | My notification preferences. → `notifications.preferences.get` |\n| `updatePreferences(patch: notifications.preferences.update args)` | `notifications:write` | Update my notification preferences. → `notifications.preferences.update` |\n\n**`dench.members`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `get(userId: string)` | `members:read` | A member's profile. → `members.get` |\n| `presence()` | `members:read` | Who is online / away / offline. → `members.presence` |\n| `activity(userId: string, opts?: members.activity args)` | `members:read` | A member's recent CRM activity. → `members.activity` |\n| `tasks(userId: string, opts?: members.tasks args)` | `members:read` | A member's open tasks. → `members.tasks` |\n| `me()` | `members:read` | My own profile. → `me.profile.get` |\n| `updateMe(patch: me.profile.update args)` | `members:write` | Update my name / tagline / timezone. → `me.profile.update` |\n\n**`dench.meetings`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `list(opts?: meetings.list args)` | `meetings:read` | Meetings (CRM `meeting` rows), newest first. → `meetings.list` |\n| `transcript(meetingEntryId: string, opts?: meetings.transcript.list args)` | `meetings:read` | Transcript segments of a meeting. → `meetings.transcript.list` |\n| `actionItems(meetingEntryId: string)` | `meetings:read` | Action items of a meeting. → `meetings.actionItems.list` |\n| `addActionItems(meetingEntryId: string, items: meetings.actionItems.add args[\"items\"])` | `meetings:write` | Add action items to a meeting. → `meetings.actionItems.add` |\n| `setActionItemDone(itemId: string, done: boolean)` | `meetings:write` | Check or uncheck an action item. → `meetings.actionItems.setDone` |\n| `participants(meetingEntryId: string)` | `meetings:read` | Participants of a meeting. → `meetings.participants.list` |\n| `sharing(meetingEntryId: string)` | `meetings:read` | Whether a meeting is shared with the whole workspace. → `meetings.sharing.get` |\n| `setSharing(meetingEntryId: string, shared: boolean)` | `meetings:write` | Share a meeting with the workspace, or take it back to owner + invitees. → `meetings.sharing.set` |\n\n**`dench.lists`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `list(opts?: lists.list args)` | `lists:read` | Saved lead lists. → `lists.list` |\n| `get(artifactId: string)` | `lists:read` | One saved list with its rows. → `lists.get` |\n| `rename(artifactId: string, title: string)` | `lists:write` | Rename a list. → `lists.rename` |\n| `delete(artifactId: string)` | `lists:write` | Delete a list. → `lists.delete` |\n\n**`dench.campaigns`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `create(opts: campaigns.create args)` | `campaigns:write` | Create a draft campaign. → `campaigns.create` |\n| `draft(opts: campaigns.drafts.create args)` | `campaigns:write` | Create an idempotent draft with available sender pools. → `campaigns.drafts.create` |\n| `search(opts: campaigns.audience.search args)` | `campaigns:write` | Search people without enrolling them. Search credits apply. → `campaigns.audience.search` |\n| `addPeople(opts: campaigns.people.addBatch args)` | `campaigns:write` | Add up to 50 selected recipients without running another search. → `campaigns.people.addBatch` |\n| `addFromSearch(opts: campaigns.people.addFromSearch args)` | `campaigns:write` | Search and add up to 50 people to an existing campaign. → `campaigns.people.addFromSearch` |\n| `sources(sequenceId: string)` | `campaigns:read` | Read the campaign's lead source. → `campaigns.sources.get` |\n| `sourceSignals(sequenceId: string)` | `campaigns:read` | Read signal choices and suggestions. → `campaigns.sources.signals` |\n| `updateSources(opts: campaigns.sources.update args)` | `campaigns:write` | Update targeting, signals, cadence or source status. → `campaigns.sources.update` |\n| `previewSignal(opts: campaigns.sources.preview args)` | `campaigns:write` | Preview a signal without enrolling people. Provider credits may apply. → `campaigns.sources.preview` |\n| `profile()` | `campaigns:read` | Read suggested campaign targeting. → `campaigns.builder.profile` |\n| `saveDraft(opts: campaigns.builder.save args)` | `campaigns:write` | Save signal-draft targeting and choices. → `campaigns.builder.save` |\n| `getDraft(draftId: string)` | `campaigns:read` | Read preview people, messages and build progress. → `campaigns.builder.get` |\n| `buildDraft(draftId: string)` | `campaigns:write` | Start a billable signal draft build. → `campaigns.builder.build` |\n| `createFromDraft(opts: campaigns.builder.create args)` | `campaigns:write` | Create a campaign from a reviewed signal draft, without launching. → `campaigns.builder.create` |\n| `setDraftOpener(opts: campaigns.builder.opener args)` | `campaigns:write` | Edit a preview person's opening line. → `campaigns.builder.opener` |\n| `autofill(opts: campaigns.builder.autofill args)` | `campaigns:write` | Translate a description into targeting. AI credits apply. → `campaigns.builder.autofill` |\n| `savedDrafts()` | `campaigns:read` | List saved, unfinished campaign drafts. → `campaigns.builder.drafts` |\n| `resumeDraft(draftId: string)` | `campaigns:read` | Read a saved draft's setup to resume it. → `campaigns.builder.resume` |\n| `discardDraft(draftId: string)` | `campaigns:write` | Discard a saved draft. → `campaigns.builder.discard` |\n| `saveOutreach(opts: campaigns.builder.outreach args)` | `campaigns:write` | Save a draft's steps, brief, senders, schedule and approval mode. → `campaigns.builder.outreach` |\n| `generateSequence(opts: campaigns.builder.sequence args)` | `campaigns:write` | Generate a draft's sequence from a brief. AI credits apply. → `campaigns.builder.sequence` |\n| `lookalike(opts: campaigns.builder.lookalike args)` | `campaigns:write` | Set up a lookalike from a best lead's LinkedIn URL. Provider credits apply. → `campaigns.builder.lookalike` |\n| `suggestVoices(opts: campaigns.builder.voices args)` | `campaigns:write` | Suggest LinkedIn experts to watch for the topics. AI credits apply. → `campaigns.builder.voices` |\n| `runSources(sequenceId: string)` | `campaigns:write` | Run a live campaign's signals now. Provider credits apply. → `campaigns.sources.run` |\n| `pendingReview(sequenceId: string)` | `campaigns:read` | People a signal found who wait for approval. → `campaigns.sources.pending` |\n| `reviewPeople(opts: campaigns.sources.review args)` | `campaigns:write` | Approve or reject people waiting for review. → `campaigns.sources.review` |\n| `todayQueue(sequenceId: string)` | `campaigns:read` | Who the campaign plans to contact today. → `campaigns.queue` |\n| `estimate(opts: campaigns.builder.estimate args)` | `campaigns:write` | Estimate audience or signal volume. → `campaigns.builder.estimate` |\n| `mailboxes()` | `campaigns:read` | Mailboxes campaigns can send from, with warm-up and daily cap. → `campaigns.accounts.email` |\n| `linkedinAccounts()` | `campaigns:read` | LinkedIn accounts campaigns can send from, with capacity. → `campaigns.accounts.linkedin` |\n| `list()` | `campaigns:read` | LinkedIn / multi-channel outreach campaigns. → `campaigns.list` |\n| `get(sequenceId: string)` | `campaigns:read` | One campaign. → `campaigns.get` |\n| `setSteps(opts: campaigns.steps.replace args)` | `campaigns:write` | Replace every step of a draft campaign. → `campaigns.steps.replace` |\n| `editSteps(opts: campaigns.steps.update args)` | `campaigns:write` | Edit launched steps in place by stepId and updatedAt. → `campaigns.steps.update` |\n| `duplicate(sequenceId: string)` | `campaigns:write` | Copy a campaign into a new draft without its people. → `campaigns.duplicate` |\n| `analytics(sequenceId: string)` | `campaigns:read` | Campaign funnel numbers. → `campaigns.analytics` |\n| `events(sequenceId: string, opts?: campaigns.events args)` | `campaigns:read` | Campaign event log. → `campaigns.events` |\n| `pause(sequenceId: string)` | `campaigns:write` | Pause a campaign. → `campaigns.pause` |\n| `resume(sequenceId: string)` | `campaigns:write` | Resume a campaign. → `campaigns.resume` |\n| `archive(sequenceId: string)` | `campaigns:write` | Archive (the app's Delete) a campaign; nothing is erased. → `campaigns.archive` |\n| `previewMessage(sequenceId: string, enrollmentId: string, stepId: string)` | `campaigns:read` | The message one person gets at one step, fields filled in. Sends nothing. → `campaigns.preview` |\n| `personalization(sequenceId: string)` | `campaigns:read` | Personalized lines, their {{keys}} and how many are written. → `campaigns.personalization.get` |\n| `setPersonalization(opts: campaigns.personalization.set args)` | `campaigns:write` | Define up to 5 personalized lines. Writing them costs credits. → `campaigns.personalization.set` |\n| `clearPersonalization(sequenceId: string)` | `campaigns:write` | Turn personalized lines off. → `campaigns.personalization.clear` |\n| `writeLines(opts: campaigns.personalization.write args)` | `campaigns:write` | Write missing (or all) personalized lines. Costs credits. → `campaigns.personalization.write` |\n| `editLine(enrollmentId: string, key: string, value: string)` | `campaigns:write` | Set one person's personalized line by hand. → `campaigns.personalization.edit` |\n| `rewriteLine(enrollmentId: string, key?: string)` | `campaigns:write` | Write a fresh line for one person. Costs credits. → `campaigns.personalization.rewrite` |\n| `syncPeople(sequenceId: string)` | `campaigns:write` | Fill people's empty contact details from their CRM records. → `campaigns.people.sync` |\n| `resumeAllPeople(sequenceId: string)` | `campaigns:write` | Resume every paused person in an active campaign. → `campaigns.people.resumeAll` |\n| `setPersonEmail(enrollmentId: string, email: string)` | `campaigns:write` | Fix a draft person's email address. → `campaigns.people.setEmail` |\n| `setPersonLinkedin(enrollmentId: string, linkedinProfileUrl: string)` | `campaigns:write` | Fix a draft person's LinkedIn profile URL. → `campaigns.people.setLinkedin` |\n| `setPersonField(enrollmentId: string, key: string, value: string)` | `campaigns:write` | Fill one {{merge field}} for a draft person. → `campaigns.people.setField` |\n| `pipeline(sequenceId: string)` | `campaigns:read` | Where the campaign's people sit in the lead pipeline. → `campaigns.pipeline` |\n| `campaignsForRecord(entryId: string)` | `campaigns:read` | The campaigns a CRM record is in, with its status in each. → `campaigns.people.forRecord` |\n| `personTimeline(enrollmentId: string)` | `campaigns:read` | Everything a campaign did for one person, step by step. → `campaigns.people.timeline` |\n| `removePerson(enrollmentId: string)` | `campaigns:write` | Remove a never-contacted person from a draft campaign. → `campaigns.people.remove` |\n\n**`dench.email`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `createDraft(draft: email.drafts.create args)` | `email:write` | Create a native mailbox draft with a stable request receipt. → `email.drafts.create` |\n| `draft(draftId: string)` | `email:read` | Read a native email draft and sync status. → `email.drafts.get` |\n| `updateDraft(input: email.drafts.update args)` | `email:write` | Save the next email draft revision. → `email.drafts.update` |\n| `sendDraft(input: email.drafts.send args)` | `email:write` | Send the frozen native email draft revision. → `email.drafts.send` |\n| `senders(opts?: email.drafts.senders args)` | `email:read` | List eligible native mailboxes. → `email.drafts.senders` |\n| `uploadAttachment(input: email.drafts.upload args)` | `email:write` | Upload attachment bytes for a native draft. → `email.drafts.upload` |\n| `signature(draftId: string)` | `email:read` | Load the selected mailbox signature for visible insertion. → `email.drafts.signature` |\n| `sendFromMailbox(message: email.native.send args)` | `email:write` | Explicitly send through a native Gmail or Outlook mailbox. → `email.native.send` |\n| `send(message: email.send args)` | `email:write` | Send one email from a verified identity. → `email.send` |\n| `messages(opts?: email.message.list args)` | `email:read` | Sent messages. → `email.message.list` |\n| `message(messageId: string)` | `email:read` | One sent message with delivery events. → `email.message.get` |\n| `campaigns(opts?: email.campaign.list args)` | `email:read` | Email campaigns. → `email.campaign.list` |\n| `campaign(campaignId: string)` | `email:read` | One email campaign. → `email.campaign.get` |\n| `identities()` | `email:read` | Verified sending identities. → `email.identity.list` |\n\n**`dench.billing`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `status()` | `billing:read` | Plan, AI balance and usage for the workspace. → `billing.status` |\n| `topup(opts?: billing.topup args)` | `billing:write` | Start an AI credit top-up (returns a Stripe URL). → `billing.topup` |\n| `upgrade(opts?: billing.upgrade args)` | `billing:write` | Upgrade the plan (returns a Stripe Checkout URL or updates in place). → `billing.upgrade` |\n\n**`dench.memory`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `get()` | `memory:read` | The workspace's saved memories (legacy shape). **Deprecated:** Use memory.search(query). |\n| `search(query: string, opts?: memory.search args)` | `memory:read` | Full-text search over saved memories. → `memory.search` |\n| `save(memory: memory.save args)` | `memory:write` | Save a memory under a stable key. → `memory.save` |\n\n**`dench.workspace`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `context()` | `workspace:read` | What this workspace has: objects, agents, integrations, next commands. → `workspace.context` |\n| `status()` | `workspace:read` | Workspace status snapshot. → `workspace.status` |\n| `agents()` | `workspace:read` | Agents in this workspace. → `workspace.agents` |\n| `artifacts(opts?: workspace.artifacts.list args)` | `workspace:read` | Recent artifacts (reports, docs, lists). → `workspace.artifacts.list` |\n| `instructions()` | `workspace:read` | Workspace instructions the agent follows. → `workspace.instructions` |\n\n**`dench.search`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `web(query: string, opts?: search.web args)` | `search:read` | Web search (gateway). → `search.web` |\n| `contents(opts: search.contents args)` | `search:read` | Fetch page contents for search results. → `search.contents` |\n| `answer(query: string, opts?: search.answer args)` | `search:read` | Answer a question from web sources. → `search.answer` |\n\n**`dench.web`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `scrape(url: string, opts?: web.scrape args)` | `web:read` | Scrape a URL to Markdown. → `web.scrape` |\n| `brand(domain: string, opts?: web.brand args)` | `web:read` | Brand kit (logo, colors, fonts) for a domain. → `web.brand` |\n| `screenshot(url: string, opts?: web.screenshot args)` | `web:read` | Screenshot a rendered page. → `web.screenshot` |\n| `extract(opts: web.extract args)` | `web:read` | Extract structured data from a page. → `web.extract` |\n\n**`dench.images`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `generate(opts: image.generate args)` | `image:write` | Generate an image from a prompt. → `image.generate` |\n| `edit(opts: image.edit args)` | `image:write` | Edit an image with a prompt. → `image.edit` |\n\n**`dench.agentConfig`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `show(section: AgentConfigSection)` | `agent-config:read` | Read one config section: \"identity\" \\| \"organisation\" \\| \"user\" \\| \"tools\" \\| \"mem\" \\| \"bootstrap\". |\n| `edit(section: AgentConfigSection, content: string)` | `agent-config:write` | Replace one config section's markdown. |\n\n**`dench.files`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `read(path: string)` | `files:read` | Read a workspace file (text inline; binary → `downloadable: true`). → `files.content` |\n| `list(dir?: string)` | `files:read` | List a directory (default /). → `files.list` |\n| `write(path: string, content: string, opts?: files.write args)` | `files:write` | Write a UTF-8 text file (creates parents). → `files.write` |\n| `delete(path: string)` | `files:write` | Delete a file or directory. → `files.delete` |\n| `mkdir(path: string)` | `files:write` | Create a directory (and parents). → `files.mkdir` |\n| `move(from: string, to: string)` | `files:write` | Move / rename a file or directory. → `files.move` |\n| `download(path: string)` | `files:read` | Short-lived signed URL for a file's bytes. → `files.downloadUrl` |\n\n**`dench.chat`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `createSession(title?: string)` | `ai:chat` | Create an empty chat thread; returns its id. |\n| `send(sessionId: string, message: string, opts?: { onEvent?: (event: ChatStreamEvent) => void })` | `ai:chat` | Send a message to a thread. With `onEvent`, text-delta chunks stream in; resolves with the full reply. |\n| `getHistory(sessionId: string, opts?: { limit?: number })` | `ai:chat` | Messages in a thread (via chat.read). → `chat.read` |\n| `getSessions(opts?: chat.list args)` | `ai:chat` | Recent threads. → `chat.list` |\n| `abort(sessionId: string)` | `ai:chat` | Stop the active run on a thread. |\n| `isActive(sessionId: string)` | `ai:chat` | Whether the thread has a running turn. |\n| `list(opts?: chat.list args)` | `ai:chat` | Recent threads (alias of getSessions). → `chat.list` |\n| `search(query: string, opts?: chat.search args)` | `ai:chat` | Full-text search across past messages. → `chat.search` |\n| `rename(threadId: string, title: string)` | `ai:chat` | Rename a thread. → `chat.rename` |\n| `delete(threadIds: string \\| string[])` | `ai:chat` | Delete one or more threads. → `chat.delete` |\n\n**`dench.agent`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `send(message: string, opts?: { title?: string; model?: string; yolo?: boolean })` | `agent:invoke` | Start a new agent turn in a fresh thread. Resolves once the run is accepted. |\n\n**`dench.tool`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `register(name: string, handler: (args: unknown) => unknown \\| Promise<unknown>, opts?: { description?: string; inputSchema?: unknown })` | `agent:invoke` | Expose a function the workspace agent can call while this app is open. |\n\n**`dench.ui`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `toast(message: string, opts?: { type?: \"success\" \\| \"error\" \\| \"info\" })` | `ui` | Show a toast. |\n| `navigate(path: string)` | `ui` | Navigate the workspace to a path (e.g. /objects/company). |\n| `openEntry(objectName: string, entryId: string)` | `ui` | Open a CRM record in the workspace. |\n| `setTitle(title: string)` | `ui` | Set the app tab title. |\n| `confirm(message: string)` | `ui` | Native confirm dialog. |\n| `prompt(message: string, defaultValue?: string)` | `ui` | Native prompt dialog. |\n\n**`dench.store`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `get(key: string)` | `store:read` | Read a per-app value. |\n| `set(key: string, value: unknown)` | `store:write` | Write a per-app value (JSON). |\n| `delete(key: string)` | `store:write` | Delete a key. |\n| `list()` | `store:read` | All keys for this app. |\n| `clear()` | `store:write` | Delete every key. |\n\n**`dench.http`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `fetch(url: string, opts?: { method?: string; headers?: Record<string, string>; body?: unknown })` | `http:external` | Fetch an external URL through the SSRF-guarded proxy. |\n\n**`dench.events`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `on(channel: string, callback: (data: unknown) => void)` | — | Subscribe to a channel (\"object.entry.created\" \\| \"object.entry.updated\" \\| \"object.entry.deleted\" \\| \"theme.changed\"). |\n| `off(channel: string, callback?: (data: unknown) => void)` | — | Unsubscribe. |\n\n**`dench.bus`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `send(targetApp: string, message: unknown)` | `apps:message` | Send a message to another open app. |\n| `on(callback: (message: { from: string; message: unknown }) => void)` | `apps:message` | Receive messages from other apps. |\n| `list()` | `apps:message` | Other apps currently open. |\n\n**`dench.apps`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `list()` | `apps:read` | Installed apps in this workspace. → `apps.list` |\n| `gallery()` | `apps:read` | Discover listings (Official + Community). → `apps.gallery` |\n| `create(opts: apps.create args)` | `apps:write` | Scaffold and register a new app. → `apps.create` |\n| `install(listingId: string)` | `apps:write` | Install a listing. → `apps.install` |\n| `publish(opts: apps.publish args)` | `apps:write` | Publish an app folder as a listing version. → `apps.publish` |\n| `uninstall(slug: string)` | `apps:write` | Uninstall an app. → `apps.uninstall` |\n| `enable(slug: string)` | `apps:write` | Enable an installed app. → `apps.setEnabled` |\n| `disable(slug: string)` | `apps:write` | Disable an installed app. → `apps.setEnabled` |\n| `pin(slug: string)` | `apps:write` | Pin an app in the rail. → `apps.setPinned` |\n| `unpin(slug: string)` | `apps:write` | Unpin an app. → `apps.setPinned` |\n| `send(targetApp: string, message: unknown)` | `apps:message` | Deprecated alias of bus.send. **Deprecated:** Use dench.bus.send. |\n| `on(eventType: \"message\", callback: (message: { from: string; message: unknown }) => void)` | `apps:message` | Deprecated alias of bus.on. **Deprecated:** Use dench.bus.on. |\n\n**`dench.cron`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `schedule(opts: CronScheduleOptions)` | `cron:schedule` | Create a scheduled agent (automation). |\n| `list()` | `cron:schedule` | Automations in the workspace. |\n| `update(jobId: string, patch: Partial<CronScheduleOptions>)` | `cron:schedule` | Update an automation. |\n| `run(jobId: string)` | `cron:schedule` | Run an automation now. |\n| `cancel(jobId: string)` | `cron:schedule` | Delete an automation. |\n\n**`dench.webhooks`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `register(hookName: string)` | `webhooks:receive` | Register an inbound webhook for this app. Returns the URL and signing secret ONCE — store the secret with the sender. |\n| `on(hookName: string, callback: (event: AppWebhookEvent) => void)` | `webhooks:receive` | Receive events for a hook while the app is open (polls every 5s). |\n| `poll(hookName: string, opts?: { since?: number; limit?: number })` | `webhooks:receive` | Events received since a timestamp. |\n| `list()` | `webhooks:receive` | This app's registered hooks (URLs, never secrets). |\n| `delete(hookName: string)` | `webhooks:receive` | Remove a hook and its stored events. |\n\n**`dench.clipboard`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `read()` | `clipboard:read` | Read clipboard text. |\n| `write(text: string)` | `clipboard:write` | Write clipboard text. |\n\n**`dench.integrations`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `list()` | `integrations:read` | Connected accounts (toolkit, status, connectedAccountId). |\n| `search(opts: { query?: string; toolkit?: string; limit?: number })` | `integrations:read` | Find tools by natural-language query and/or toolkit. |\n| `execute(opts: { tool: string; arguments?: Record<string, unknown>; connectedAccountId?: string })` | `integrations:read` | Run a tool. Write-classified tools additionally need integrations:write. |\n\n**`dench.geo`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `resolveLocation(text: string)` | — | Free text → country (ISO2 + ISO numeric). Same rules as the analytics map. |\n| `resolveRegion(text: string, iso2: string)` | — | Free text → admin-1 region (state/province) within a country. Loads that country's file on first use. |\n| `loadAdmin1(iso2: string)` | — | First-level divisions of a country as GeoJSON features (what the map draws). |\n\n**`dench.db`**\n\n| Method | Permission | Notes |\n|---|---|---|\n| `query(sql: string)` | `crm:read` | Removed. DuckDB SQL is gone — use objects.query / analytics.compute. **Deprecated:** Removed: use objects.query or analytics.compute. |\n| `execute(sql: string)` | `crm:write` | Removed. Use objects.create / update / delete. **Deprecated:** Removed: use objects.create / update / delete. |\n<!-- app-sdk:index:end -->\n\n## Official examples\n\nShipped in the gallery and kept working against this contract:\n\n- **Pipeline Health** (`crm-analytics`) — `analytics.get` + `compute(\"deal\",\n { period })` for stored stats and a donut, one ad-hoc leaderboard with\n `ui.openEntry`, `previousValue` deltas, the `truncated` badge, and a map\n drawn from `compute` buckets placed through `dench.geo`.\n- **Inbox** (`inbox`) — `notifications.list/read/archive` + `comments.list`\n on the mentioned record, `ui.openEntry` to jump in.\n- **Meeting Brief** (`meetings-brief`) — `meetings.list`, `transcript`,\n `actionItems`, `setActionItemDone`.\n- **Dench CMO** (`agents-feed`) — cron + chat + integrations, bridge-only.\n\n## Design philosophy (strict)\n\nDench Apps must feel like polished, native workspace surfaces — closer to a\nwell-crafted iOS app than a flat embedded widget. The host already owns the\nouter chrome, tab, inset, and rounded iframe frame; your app owns the inside\nsurface only. Do not add a second title bar, logo bar, browser frame, floating\ntheme toggle, or heavy app shell.\n\nAim for **striking but tasteful**: one vibrant accent, a real gradient moment,\ncrisp typography, without noise.\n\n- **Anchor on one vibrant accent.** Default to Dench denim (`#206199` light /\n `#5b9fd8` dark) or choose one per category. Derive every tint, wash, border\n glow, ring, and gradient from it with `color-mix()`.\n- **Gradients with intent.** Lead with a gradient hero/header band carrying the\n app title, a short tagline, and an icon tile. One confident gradient.\n- **iOS-style icon tiles.** Rounded-square (`border-radius` ≈ 22%), accent\n gradient, white **inline SVG** glyph (no icon fonts, no external images).\n- **Confident typography.** 18–24px semibold headings, `letter-spacing:\n -0.01em`, Inter/system stack; muted sentence-case secondary text.\n- **Clean cards, soft depth.** 1px hairlines, 12–16px radii, generous padding,\n accent-tinted hover.\n- **Accent-tinted KPI tiles** with the big value in the accent color.\n- **Polished states.** Real loading (accent spinner/skeleton), empty, error.\n- **Full dark mode, theme-synced** via `dench.app.getTheme()` +\n `theme.changed` — never `localStorage` / `prefers-color-scheme`.\n- **Respect the iframe edge.** Root `min-height: 100vh`, internal padding\n 16–24px, no outer margins. No external fonts, CSS, JS, images, or CDNs (CSP\n blocks them) — inline everything.\n\nStart every stylesheet from these tokens:\n\n```css\n:root {\n color-scheme: light;\n --accent: #206199; /* one accent drives everything */\n --accent-strong: color-mix(in srgb, var(--accent) 68%, #000);\n --on-accent: #ffffff;\n --bg: #fafaf9; --surface: #ffffff; --surface-2: #f5f5f4;\n --text: #171717; --muted: #6b7280;\n --border: rgba(28, 28, 26, 0.1); --border-strong: rgba(28, 28, 26, 0.16);\n --tint: color-mix(in srgb, var(--accent) 9%, var(--surface));\n --tint-strong: color-mix(in srgb, var(--accent) 16%, var(--surface));\n --hover: color-mix(in srgb, var(--accent) 6%, transparent);\n --ring: color-mix(in srgb, var(--accent) 30%, transparent);\n --hero-grad: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #000));\n --tile-grad: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 68%, #000));\n --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);\n --shadow-lg: 0 18px 40px -24px color-mix(in srgb, var(--accent) 55%, #000);\n --radius: 16px;\n --heat-lo: #a3e635; --heat-hi: #ef4444; /* the strip's lime → red ramp */\n}\n:root[data-theme=\"dark\"] {\n color-scheme: dark;\n --accent: #5b9fd8; --on-accent: #0b1220;\n --bg: #101010; --surface: #171717; --surface-2: #1f1f1f;\n --text: #f5f5f5; --muted: #a3a3a3;\n --border: rgba(255, 255, 255, 0.12); --border-strong: rgba(255, 255, 255, 0.2);\n --tint: color-mix(in srgb, var(--accent) 14%, var(--surface));\n --tint-strong: color-mix(in srgb, var(--accent) 22%, var(--surface));\n --hover: color-mix(in srgb, var(--accent) 12%, transparent);\n --ring: color-mix(in srgb, var(--accent) 40%, transparent);\n --hero-grad: linear-gradient(145deg, color-mix(in srgb, var(--accent) 80%, #000), color-mix(in srgb, var(--accent) 45%, #000));\n --shadow-lg: 0 18px 44px -24px rgba(0, 0, 0, 0.7);\n}\n* { box-sizing: border-box; }\nhtml, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--text);\n font-family: Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif; }\n.icon-tile { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;\n border-radius: 22%; background: var(--tile-grad); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }\n.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 22px 24px;\n background: var(--hero-grad); color: #fff; box-shadow: var(--shadow-lg); }\n.hero::after { content: \"\"; position: absolute; inset: 0; pointer-events: none;\n background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.22), transparent 55%); }\n.hero .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }\n.hero h1 { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }\n.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);\n transition: border-color .15s ease, box-shadow .15s ease; }\n.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-lg); }\n.stat { border: 1px solid var(--border); border-radius: 14px; background: var(--tint); padding: 14px 16px; }\n.stat .value { font-size: 24px; font-weight: 600; letter-spacing: -.01em; color: var(--accent); }\n.primary-button { border: 0; border-radius: 10px; padding: 9px 14px; font-weight: 600; background: var(--accent); color: var(--on-accent); cursor: pointer; }\n.primary-button:hover { background: var(--accent-strong); }\n.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--tint-strong); border-top-color: var(--accent); animation: dench-spin .7s linear infinite; }\n@keyframes dench-spin { to { transform: rotate(360deg); } }\n```\n\n## Theme sync (required)\n\n```html\n<script>\n function applyDenchTheme(theme) {\n const resolved = theme === \"dark\" ? \"dark\" : \"light\";\n document.documentElement.dataset.theme = resolved;\n document.documentElement.style.colorScheme = resolved;\n }\n async function syncDenchTheme() {\n try {\n applyDenchTheme(await window.dench.app.getTheme());\n window.dench.events.on(\"theme.changed\", ({ theme }) => applyDenchTheme(theme));\n } catch { applyDenchTheme(\"light\"); }\n }\n syncDenchTheme();\n</script>\n```\n\n> **Removed:** `dench.db.query(sql)` / `dench.db.execute(sql)` (DuckDB era)\n> now reject with `deprecated`. Use `objects.query`, `analytics.compute`, or\n> `objects.create/update/delete`.\n\n## Runtime & security\n\n- Apps render in a sandboxed iframe (`allow-scripts allow-popups allow-forms`,\n currently same-origin; a separate origin is the hardening target — the\n bridge is the only contract that survives that move). `postMessage` is the\n only privileged channel; the host checks the manifest's permissions on\n every request, and every product call goes through `POST /api/apps/sdk`,\n the same dispatcher as `/api/v1`.\n- `<a href>` opens a new tab (`<base target=\"_blank\">` is injected). Use\n `ui.navigate` / `ui.openEntry` for in-workspace navigation.\n- `http.fetch` is proxied with an SSRF guard.\n- Apps are per-org, derived from the org's filesystem (`/workspace/apps`).\n\n## Create / install / publish (lifecycle)\n\n```bash\ndench apps create pipeline-health --name \"Pipeline Health\" --icon bar-chart\ndench apps validate /apps/pipeline-health.dench.app # manifest + every dench.* call\ndench apps list | gallery | info <slug>\ndench apps publish /apps/pipeline-health.dench.app --slug pipeline-health --name \"Pipeline Health\" [--visibility org|public|official]\ndench apps install <listingId>\ndench apps uninstall | enable | disable | pin | unpin <slug>\ndench apps webhooks register|list|poll|delete <slug> [hookName]\n```\n\nSame surface over REST (`Authorization: Bearer <DENCH_API_KEY>`): `GET|POST\n/api/v1/apps`, `GET /api/v1/apps/gallery`, `POST /api/v1/apps/publish`,\n`POST /api/v1/apps/install`, `DELETE|PATCH /api/v1/apps/{slug}`, `POST\n/api/v1/apps/{slug}/pin`, `POST|GET /api/v1/apps/{slug}/webhooks`.\n\nOptional manifest keys: `template: <id>` installs a companion CRM template\nwith an official listing; `display: widget` + `widget: { width, height,\nrefreshInterval }` renders the app as a dashboard card.\n\n**In-chat widgets.** For a chart the panel model cannot express, the agent\nwrites ONE self-contained HTML file (≤ 40 KB) and calls\n`present_artifact({ kind: \"app\", title, html, permissions: [\"crm:read\", \"ui\"] })`\n— it renders in the thread with this same bridge. \"Keep as app\" copies it to\n`/apps/<slug>.dench.app`.\n\n## Related\n\n- CRM objects, fields, analytics model: [`references/CRM.md`](https://dench.com/references/CRM.md)\n- Every operation with curl: [`references/API.md`](https://dench.com/references/API.md)\n- Deep links for `ui.navigate`: [`references/NAVIGATION.md`](https://dench.com/references/NAVIGATION.md)\n- Action buttons on CRM rows: [`references/ACTIONS.md`](https://dench.com/references/ACTIONS.md)\n"
|
|
20
20
|
},
|
|
21
21
|
"references/AUTOMATIONS.md": {
|
|
22
|
-
"sha256": "
|
|
23
|
-
"content": "---\nname: automations\ndescription: Create and manage Dench automations (recurring schedules, on-demand webhooks, app-event and CRM-event triggers) via `dench cron`. Covers the trigger types, the full create/update/run/secret/events CLI surface, the trigger→action model (the fired agent gets the event as `<automation-event>` and the action — email me, ping a channel, write the CRM — lives in the prompt), inbound webhook URLs (Stripe-style HMAC signing on by default for webhook automations, with an explicit unsigned opt-out; off-until-enabled for other types), run-now + run history, and what is CLI-creatable. Load this before scheduling work, wiring webhooks, or building \"email/notify me when a CRM record is added or changes\" / \"do X when something happens in a connected app\" automations.\n---\n\n# Dench Automations Playbook\n\nA Dench **automation** is a saved trigger that runs a prompt as a fresh,\nautonomous chat-turn run when it fires. Automations live in the `triggers`\ntable and are managed with `dench cron` (aliases: `dench routine`,\n`dench routines`). The dashboard labels them \"Automations\"; the CLI calls them\ncrons/routines — same thing.\n\n> Not to be confused with `dench crm automations`, which lists the\n> deterministic CRM template rules. This playbook is about the `dench cron`\n> trigger system.\n\n## Mental Model\n\n- A trigger has a **type**, a **prompt**, an optional **schedule**, and an\n optional saved **environment**.\n- When it fires, it starts a new chat through the shared harness, seeded with\n the prompt and event payload. It uses ordinary CLI commands through the same\n execution path as a web chat. Write self-contained prompts; a scheduled run\n should have the recipient, destination and setup it needs before starting.\n- **Every automation has an inbound webhook URL**, but what a POST to it does\n depends on the type:\n - `webhook` automations are **signed by default** — `dench cron create\n --type webhook` returns the URL and a Stripe-style HMAC signing secret\n (shown once), and only signed POSTs fire them. Turning signing off\n (`--unsigned` at create, or `dench cron secret <jobId> --off`) lets anyone\n with the link run the automation; do it only when the user asks, for a\n tool that can't sign, and warn them.\n - `schedule` / `app` / `crm` automations' URLs are **off** (404) until\n you run `dench cron secret <jobId>`, which enables the URL *and* requires\n signed requests. There is no unsigned mode for these types.\n- Firing is type-agnostic: `dench cron run` (run-now) and an inbound webhook\n POST both go through the same fire path.\n\n## Trigger types\n\n| Type | Fires when | Create via |\n| --- | --- | --- |\n| `schedule` | a recurring or one-time time is reached | **CLI** or UI |\n| `webhook` | on demand, or an external system POSTs to its URL (HMAC-signed by default; unsigned only by explicit opt-out) | **CLI** or UI |\n| `app` (app event) | something happens in a connected app (new email, calendar event, …) | **CLI** or UI |\n| `crm` (CRM event) | a CRM entry is created / updated / deleted (optional field filters) | **CLI** or UI |\n\n**All four types are headless-creatable** (`dench cron create --type …`).\nApp-event automations still require the app to be **connected first** (do that\nin the dashboard → Integrations, or with `dench tool connect <toolkit>`); the\nCLI then subscribes to its events. CRM-event field filters work from the CLI —\nuse the field `_id` from `dench crm fields list <object>` in `--where` (the\nsame id the server validates against).\n\n## The `dench cron` surface\n\n```bash\n# Browse\ndench cron list [--enabled-only] [--json]\ndench cron get <jobId> [--json]\ndench cron runs <jobId> [--limit 50] [--status ok|error|skipped] [--json]\ndench cron history [--limit 50] [--status …] [--json]\ndench cron events <toolkit> [--json] # app-event slugs a connected app publishes\n\n# Create — schedule (one of --every / --cron / --at required)\ndench cron create \"Hourly health check\" --prompt \"Check uptime and post incidents.\" --every 1h\ndench cron create \"Weekday digest\" --prompt \"Summarize yesterday's CRM activity.\" --cron \"0 9 * * 1-5\"\ndench cron create \"Launch ping\" --prompt \"Send the launch tweet.\" --at 2026-05-04T17:00:00Z\n# [--description \"…\"] [--environment <name>] [--overlap skip|queue|kill_old] [--disabled] [--delete-after-run] [--json]\n\n# Create — webhook (no schedule). Signed by default; prints the URL + secret.\ndench cron create \"Inbound lead triage\" --prompt \"Triage the lead JSON payload.\" --type webhook\n# → { jobId, webhookUrl, webhookSecret, webhookAccess: \"signed\" } ← secret shown ONCE\n# --unsigned → { …, webhookAccess: \"open\", warning } ← anyone with the link can run it\n# No webhookSecret in the result (older CLI, or minting failed)? The URL accepts\n# nothing yet: run `dench cron secret <jobId>` to get the secret.\n\n# Create — app event. Discover inputs first:\ndench integrations --json # → connectedAccountId + toolkit per connected app\ndench cron events <toolkit> # → the event slugs that app publishes\ndench cron create \"New GitHub star\" --prompt \"Thank the new stargazer.\" \\\n --type app --connection <connectedAccountId> --event <triggerSlug> [--toolkit <slug>]\n# [--trigger-config '<json>'] ← optional per-event config (e.g. a repo/owner)\n\n# Create — CRM event. Discover inputs first:\ndench crm objects list # → objectId\ndench crm fields list <object> # → field _id (for --where filters)\ndench cron create \"New company added\" --prompt \"Research the new company.\" \\\n --type crm --object <objectId> --event create|update|delete\n# [--where '[{\"logic\":\"AND\",\"conditions\":[{\"fieldId\":\"<id>\",\"operator\":\"equals\",\"value\":\"x\"}]}]'] [--where-logic AND|OR]\n\n# Edit / lifecycle\ndench cron update <jobId> [--name N] [--prompt P] [--description D] \\\n [--every X | --cron EXPR | --at ISO] [--enabled true|false] [--overlap …]\n# [--environment <name> | --clear-environment]\ndench cron enable <jobId>\ndench cron disable <jobId>\ndench cron delete <jobId> [--force]\n\n# Fire on demand\ndench cron run <jobId> [--wait] [--json] # --wait blocks until the run finishes\n# A disabled (paused) automation runs once too and stays disabled; never enable it just to run it.\n\n# HMAC signing (any type). On a webhook: turns signing on / rotates the secret.\n# On schedule/app-event/CRM automations: also what makes the URL callable.\ndench cron secret <jobId> [--json] # re-running rotates (invalidates the old secret)\ndench cron secret <jobId> --off # webhook → open (unsigned: anyone with the link); other types → URL off\n```\n\nSchedule flags: `--every 30s|5m|2h|1d`, `--every-ms <ms>`, `--cron \"<5-field>\"`\n(`--tz America/New_York`), `--at <ISO8601>` (one-shot; auto-disables after firing).\n\n## Inbound webhooks — calling an automation from the outside\n\nEvery automation has an inbound URL:\n\n```\nPOST <host>/api/webhooks/automation/<jobId>\n```\n\n| Type | Default | After `dench cron secret <jobId>` | After `--off` |\n| --- | --- | --- | --- |\n| `webhook` | **signed** — HMAC required (secret from create) | **signed** — new secret, old one stops working | **open** — a plain POST fires it |\n| `schedule` / `app` / `crm` | **off** — 404 | **signed** — URL live, HMAC required | off again |\n\nA webhook made before signing became the default (or turned off with\n`--off`) is **open**: the URL is the only protection — tell the user to keep it\nprivate, or turn signing on with `dench cron secret <jobId>`. A disabled\n(paused) automation answers 403 `trigger disabled`; on a signed URL only a\ncorrectly signed request gets that far (unsigned or badly signed → 401).\n\nPlain POST to an open webhook:\n\n```bash\ncurl -X POST \"<webhookUrl>\" -H 'Content-Type: application/json' -d '{\"event\":\"ping\"}'\n# → 200 { \"ok\": true, \"status\": \"fired\", \"runId\": \"…\" }\n```\n\nWhen signing is on, the secret is **shown once and cannot be retrieved\nlater** — store it; you can only rotate it. Sign each request Stripe-style:\n\n- `X-Dench-Timestamp: <unix seconds>`\n- `X-Dench-Signature: sha256=<hex of HMAC-SHA256(`${timestamp}.${rawBody}`, secret)>`\n- 5-minute replay window; max body 32 KB; rate-limited per trigger.\n\nReady-to-run signed fire snippet (bash + openssl):\n\n```bash\nURL=\"<webhookUrl>\"; SECRET=\"<signing secret>\"\nTS=$(date +%s); BODY='{\"event\":\"ping\"}'\nSIG=$(printf '%s' \"$TS.$BODY\" | openssl dgst -sha256 -hmac \"$SECRET\" | awk '{print $NF}')\ncurl -X POST \"$URL\" \\\n -H \"X-Dench-Timestamp: $TS\" \\\n -H \"X-Dench-Signature: sha256=$SIG\" \\\n -H 'Content-Type: application/json' \\\n -d \"$BODY\"\n# → 200 { \"ok\": true, \"status\": \"fired\", \"runId\": \"…\" }\n```\n\nThe POST body is delivered to the fired agent as an `<automation-event>`\nenvelope, so the prompt can read and act on it.\n\n## Trigger → action: the prompt is the action\n\nA non-schedule automation has two halves: a **trigger** (when it fires) and an\n**action** (what it does). The trigger is the `--type` + its config. The action\nis **whatever you write in `--prompt`** — there is no separate \"action\" field.\nEvery fire starts a fresh chat through the shared harness. The agent uses CLI\ncommands for CRM, email, files, search and integrations, seeded with your prompt\nand — for app-event / CRM / inbound-webhook fires — the triggering event as an\n`<automation-event>` block. So \"do X when Y happens\" = a Y trigger + a prompt\nthat does X with the event payload.\n\nThis makes notify / digest / follow-up automations first-class. Examples of the\naction half (put these in `--prompt`):\n\n- **Email me** → `dench email send --from you@dench.com --to me@example.com\n --subject \"…\" --text \"…\"` (needs a verified identity:\n `dench email identity verify --from you@dench.com`).\n- **Message a channel** → create the automation from iMessage/Slack (it stays\n bound and each fire is delivered back automatically), or pass\n `deliver_to: imessage|slack` from web chat.\n- **Write a CRM cell / create a follow-up task / draft a reply** → use the CRM\n + email tools directly in the prompt.\n\nWorked example — \"email me whenever a company is added to the CRM\":\n\n```bash\ndench crm objects list # → objectId for \"Companies\"\ndench cron create \"Email me on new company\" \\\n --type crm --object <objectId> --event create \\\n --prompt \"A company was just added to the CRM (its fields are in the \\\n<automation-event> payload). Email me a one-line summary — company name + \\\nwebsite + owner — to me@example.com via: dench email send --from \\\nyou@dench.com --to me@example.com --subject 'New CRM company' --text '<summary>'.\"\n```\n\nFor \"when it **moves**\" (a stage/owner change), use `--event update`. An\nunfiltered `update` fires on every edit, so either narrow it with `--where` on\nthe field `_id`, or have the prompt check the `<automation-event>`'s\n`changedFields` / `previousData` and no-op (finish without emailing) when the\nfield you care about didn't change. A filtered `update` fires once, on the\nedit that makes the entry match (e.g. Status becomes Qualified), not on later\nedits while it still matches.\n\n## Execution from Dench chat\n\nUse the same `dench cron` commands above through the harness's execution tool.\nCreating, updating, running and signing automations does not require a second\nset of orchestration tools. Discover only missing identifiers with\n`dench integrations --json`, `dench cron events <toolkit>`, or the relevant CRM\nobject/field listing. Reuse identifiers already established in the conversation.\n\n## Reusable custom setup\n\nWhen an automation needs packages, scripts or a custom API credential, save a\nverified environment once and bind it to the automation. Do not ask each new run\nto reinstall packages or reconstruct configuration from memory.\n\n```sh\ndench env save openai-report --path ./openai-report --json\ndench env show openai-report --json\ndench cron create \"Morning report\" --every 1d --environment openai-report --prompt \"Run node report.mjs, save the report, and summarize it.\"\ndench cron update <jobId> --environment openai-report\ndench cron update <jobId> --clear-environment\n```\n\nEach new run chooses the latest ready revision. Running jobs keep their pinned\nrevision, and children inherit it. Dependencies start in a prepared snapshot;\ncredentials are resolved from their current encrypted versions when commands\nexecute. An update that fails verification does not replace the last ready setup.\nDeclared mutable state is scoped to this automation and uses version checks,\nso overlapping runs cannot silently overwrite each other's progress.\n\n`dench cron secret` is webhook signing only. Use `dench secrets set NAME --stdin`\nfor a custom API credential and bind its name in the environment manifest. A\nsaved memory is not a credential or installation receipt. Read\n[ENVIRONMENTS.md](https://dench.com/references/ENVIRONMENTS.md) for the manifest,\nlocal execution and state-conflict behavior.\n\n## Common patterns\n\n- \"Remind me / run every N / each morning\" → `schedule` (`--every` / `--cron`).\n- \"Run once at <time>\" → `--at` (auto-disables after it fires).\n- \"Let an external system / Stripe / GitHub / a form trigger this\" → `webhook`,\n then hand over the URL and its signing secret (signed by default). Only if\n their tool can't sign, and they ask, create it `--unsigned` (or `dench cron\n secret <jobId> --off`) and warn them anyone with the link can run it. To expose\n an existing schedule/app-event/CRM automation by URL, `dench cron secret`\n on it (always signed).\n- \"Email / ping me when a CRM record is added or changes\" → `--type crm`\n (`--event create` for added, `--event update` for changes), with the notify\n action (`dench email send`, or `deliver_to`) written into the prompt. See\n **Trigger → action** above.\n- \"Do X when something happens in <connected app>\" → `--type app`\n (`dench cron events <toolkit>` for the slug), action in the prompt.\n- \"Fire this automation now\" → `dench cron run <jobId>`.\n- \"Rotate an automation webhook signing secret\" → `dench cron secret <jobId>` again.\n- \"Rotate a custom service credential\" → `dench secrets set NAME --stdin`; reuse\n the environment without rebuilding dependencies.\n- \"Stop requiring signatures\" → `dench cron secret <jobId> --off`.\n\n## Pitfalls\n\n- **A recurring to-do is a repeating TASK, not a cron.** If the user wants a\n person reminded / assigned on a cadence (\"weekly report\", \"quarterly\n check-in\"), use `dench crm tasks repeat <taskId> weekly --on mon` (see the\n CRM reference). Reserve `dench cron` for work Dench itself performs.\n\n- **Open webhooks are protected only by their URL.** Anyone holding it can\n fire the automation (and spend credits). Keep it private, or turn on signing.\n- **Secret is one-time.** Shown at webhook create or `secret` time only.\n Lost it? Rotate with `dench cron secret` (invalidates the old one).\n- **No schedule on a webhook automation** — `--type webhook` rejects\n `--every/--cron/--at`.\n- **One-time (`--at`) auto-disables** after firing; re-enable or recreate to\n reuse.\n- **Overlap policy** (`skip` default / `queue` / `kill_old`) governs what\n happens when a fire lands while a previous run is still going. A second fire\n during an in-flight run returns `skipped:overlap_skip` — that's expected,\n not an error.\n- **Self-contained prompts.** A fired automation runs with no human to ask;\n quote concrete filters, paths, and output destinations.\n- **App-event needs a connected app** — connect it first (dashboard →\n Integrations or `dench tool connect <toolkit>`) before `dench cron events` /\n `--type app` can see or subscribe to it.\n- **CRM `--where` filters use the field `_id`** from `dench crm fields list`\n (not the field name) — that's the id the server validates against.\n"
|
|
22
|
+
"sha256": "2340b69bae8d5bf1da3ed3dab7a048c8304a2182d0d1c50c9270903ce6b35b2c",
|
|
23
|
+
"content": "---\nname: automations\ndescription: Create and manage Dench automations (recurring schedules, on-demand webhooks, app-event and CRM-event triggers) via `dench cron`. Covers the trigger types, the full create/update/run/secret/events CLI surface, the trigger→action model (the fired agent gets the event as `<automation-event>` and the action — email me, ping a channel, write the CRM — lives in the prompt), inbound webhook URLs (Stripe-style HMAC signing on by default for webhook automations, with an explicit unsigned opt-out; off-until-enabled for other types), run-now + run history, and what is CLI-creatable. Load this before scheduling work, wiring webhooks, or building \"email/notify me when a CRM record is added or changes\" / \"do X when something happens in a connected app\" automations.\n---\n\n# Dench Automations Playbook\n\nA Dench **automation** is a saved trigger that runs a prompt as a fresh,\nautonomous chat-turn run when it fires. Automations live in the `triggers`\ntable and are managed with `dench cron` (aliases: `dench routine`,\n`dench routines`). The dashboard labels them \"Automations\"; the CLI calls them\ncrons/routines — same thing.\n\n> Not to be confused with `dench crm automations`, which lists the\n> deterministic CRM template rules. This playbook is about the `dench cron`\n> trigger system.\n\n## Mental Model\n\n- A trigger has a **type**, a **prompt**, an optional **schedule**, and an\n optional saved **environment**.\n- When it fires, it starts a new chat through the shared harness, seeded with\n the prompt and event payload. It uses ordinary CLI commands through the same\n execution path as a web chat. Write self-contained prompts; a scheduled run\n should have the recipient, destination and setup it needs before starting.\n- **Every automation has an inbound webhook URL**, but what a POST to it does\n depends on the type:\n - `webhook` automations are **signed by default** — `dench cron create\n --type webhook` returns the URL and a Stripe-style HMAC signing secret\n (shown once), and only signed POSTs fire them. Turning signing off\n (`--unsigned` at create, or `dench cron secret <jobId> --off`) lets anyone\n with the link run the automation; do it only when the user asks, for a\n tool that can't sign, and warn them.\n - `schedule` / `app` / `crm` automations' URLs are **off** (404) until\n you run `dench cron secret <jobId>`, which enables the URL *and* requires\n signed requests. There is no unsigned mode for these types.\n- Firing is type-agnostic: `dench cron run` (run-now) and an inbound webhook\n POST both go through the same fire path.\n\n## Trigger types\n\n| Type | Fires when | Create via |\n| --- | --- | --- |\n| `schedule` | a recurring or one-time time is reached | **CLI** or UI |\n| `webhook` | on demand, or an external system POSTs to its URL (HMAC-signed by default; unsigned only by explicit opt-out) | **CLI** or UI |\n| `app` (app event) | something happens in a connected app (new email, calendar event, …) | **CLI** or UI |\n| `crm` (CRM event) | a CRM entry is created / updated / deleted (optional field filters) | **CLI** or UI |\n\n**All four types are headless-creatable** (`dench cron create --type …`).\nApp-event automations still require the app to be **connected first** (do that\nin the dashboard → Integrations, or with `dench tool connect <toolkit>`); the\nCLI then subscribes to its events. CRM-event field filters work from the CLI —\nuse the field `_id` from `dench crm fields list <object>` in `--where` (the\nsame id the server validates against).\n\n## The `dench cron` surface\n\n```bash\n# Browse\ndench cron list [--enabled-only] [--json]\ndench cron get <jobId> [--json]\ndench cron runs <jobId> [--limit 50] [--status ok|error|skipped] [--json]\ndench cron history [--limit 50] [--status …] [--json]\ndench cron events <toolkit> [--json] # app-event slugs a connected app publishes\n\n# Create — schedule (one of --every / --cron / --at required)\ndench cron create \"Hourly health check\" --prompt \"Check uptime and post incidents.\" --every 1h\ndench cron create \"Weekday digest\" --prompt \"Summarize yesterday's CRM activity.\" --cron \"0 9 * * 1-5\"\ndench cron create \"Launch ping\" --prompt \"Send the launch tweet.\" --at 2026-05-04T17:00:00Z\n# [--description \"…\"] [--environment <name>] [--overlap skip|queue|kill_old] [--disabled] [--delete-after-run] [--json]\n\n# Create — webhook (no schedule). Signed by default; prints the URL + secret.\ndench cron create \"Inbound lead triage\" --prompt \"Triage the lead JSON payload.\" --type webhook\n# → { jobId, webhookUrl, webhookSecret, webhookAccess: \"signed\" } ← secret shown ONCE\n# --unsigned → { …, webhookAccess: \"open\", warning } ← anyone with the link can run it\n# No webhookSecret in the result (older CLI, or minting failed)? The URL accepts\n# nothing yet: run `dench cron secret <jobId>` to get the secret.\n\n# Create — app event. Discover inputs first:\ndench integrations --json # → connectedAccountId + toolkit per connected app\ndench cron events <toolkit> # → the event slugs that app publishes\ndench cron create \"New GitHub star\" --prompt \"Thank the new stargazer.\" \\\n --type app --connection <connectedAccountId> --event <triggerSlug> [--toolkit <slug>]\n# [--trigger-config '<json>'] ← optional per-event config (e.g. a repo/owner)\n\n# Create — CRM event. Discover inputs first:\ndench crm objects list # → objectId\ndench crm fields list <object> # → field _id (for --where filters)\ndench cron create \"New company added\" --prompt \"Research the new company.\" \\\n --type crm --object <objectId> --event create|update|delete\n# [--where '[{\"logic\":\"AND\",\"conditions\":[{\"fieldId\":\"<id>\",\"operator\":\"equals\",\"value\":\"x\"}]}]'] [--where-logic AND|OR]\n\n# Edit / lifecycle\ndench cron update <jobId> [--name N] [--prompt P] [--description D] \\\n [--every X | --cron EXPR | --at ISO] [--enabled true|false] [--overlap …]\n# [--environment <name> | --clear-environment]\ndench cron enable <jobId>\ndench cron disable <jobId>\ndench cron delete <jobId> [--force]\n\n# Fire on demand\ndench cron run <jobId> [--wait] [--json] # --wait blocks until the run finishes\n# A disabled (paused) automation runs once too and stays disabled; never enable it just to run it.\n\n# HMAC signing (any type). On a webhook: turns signing on / rotates the secret.\n# On schedule/app-event/CRM automations: also what makes the URL callable.\ndench cron secret <jobId> [--json] # re-running rotates (invalidates the old secret)\ndench cron secret <jobId> --off # webhook → open (unsigned: anyone with the link); other types → URL off\n```\n\nSchedule flags: `--every 30s|5m|2h|1d`, `--every-ms <ms>`, `--cron \"<5-field>\"`\n(`--tz America/New_York`), `--at <ISO8601>` (one-shot; auto-disables after firing).\n\n## Inbound webhooks — calling an automation from the outside\n\nEvery automation has an inbound URL:\n\n```\nPOST <host>/api/webhooks/automation/<jobId>\n```\n\n| Type | Default | After `dench cron secret <jobId>` | After `--off` |\n| --- | --- | --- | --- |\n| `webhook` | **signed** — HMAC required (secret from create) | **signed** — new secret, old one stops working | **open** — a plain POST fires it |\n| `schedule` / `app` / `crm` | **off** — 404 | **signed** — URL live, HMAC required | off again |\n\nA webhook made before signing became the default (or turned off with\n`--off`) is **open**: the URL is the only protection — tell the user to keep it\nprivate, or turn signing on with `dench cron secret <jobId>`. A disabled\n(paused) automation answers 403 `trigger disabled`; on a signed URL only a\ncorrectly signed request gets that far (unsigned or badly signed → 401).\n\nPlain POST to an open webhook:\n\n```bash\ncurl -X POST \"<webhookUrl>\" -H 'Content-Type: application/json' -d '{\"event\":\"ping\"}'\n# → 200 { \"ok\": true, \"status\": \"fired\", \"runId\": \"…\" }\n```\n\nWhen signing is on, the secret is **shown once and cannot be retrieved\nlater** — store it; you can only rotate it. Sign each request Stripe-style:\n\n- `X-Dench-Timestamp: <unix seconds>`\n- `X-Dench-Signature: sha256=<hex of HMAC-SHA256(`${timestamp}.${rawBody}`, secret)>`\n- 5-minute replay window; max body 32 KB; rate-limited per trigger.\n\nReady-to-run signed fire snippet (bash + openssl):\n\n```bash\nURL=\"<webhookUrl>\"; SECRET=\"<signing secret>\"\nTS=$(date +%s); BODY='{\"event\":\"ping\"}'\nSIG=$(printf '%s' \"$TS.$BODY\" | openssl dgst -sha256 -hmac \"$SECRET\" | awk '{print $NF}')\ncurl -X POST \"$URL\" \\\n -H \"X-Dench-Timestamp: $TS\" \\\n -H \"X-Dench-Signature: sha256=$SIG\" \\\n -H 'Content-Type: application/json' \\\n -d \"$BODY\"\n# → 200 { \"ok\": true, \"status\": \"fired\", \"runId\": \"…\" }\n```\n\nThe POST body is delivered to the fired agent as an `<automation-event>`\nenvelope, so the prompt can read and act on it.\n\n## Trigger → action: the prompt is the action\n\nA non-schedule automation has two halves: a **trigger** (when it fires) and an\n**action** (what it does). The trigger is the `--type` + its config. The action\nis **whatever you write in `--prompt`** — there is no separate \"action\" field.\nEvery fire starts a fresh chat through the shared harness. The agent uses CLI\ncommands for CRM, email, files, search and integrations, seeded with your prompt\nand — for app-event / CRM / inbound-webhook fires — the triggering event as an\n`<automation-event>` block. So \"do X when Y happens\" = a Y trigger + a prompt\nthat does X with the event payload.\n\nThis makes notify / digest / follow-up automations first-class. Examples of the\naction half (put these in `--prompt`):\n\n- **Email me** → `dench email send --from you@dench.com --to me@example.com\n --subject \"…\" --text \"…\"` (needs a verified identity:\n `dench email identity verify --from you@dench.com`).\n- **Message a channel** → create the automation from iMessage/Slack (it stays\n bound and each fire is delivered back automatically), or pass\n `deliver_to: imessage` from web chat. Made from Slack, it is the asker's\n own: it runs with their access and posts back to that exact conversation,\n which must have no guests or people from outside the workspace (checked\n when it is created and again at every run; a run is skipped, with the\n reason in its history, if that changes or if the creator left that\n conversation or disconnected Slack). This works for scheduled and app-event\n automations. A personal automation can't be pointed at Slack from web chat.\n- **Write a CRM cell / create a follow-up task / draft a reply** → use the CRM\n + email tools directly in the prompt.\n\nWorked example — \"email me whenever a company is added to the CRM\":\n\n```bash\ndench crm objects list # → objectId for \"Companies\"\ndench cron create \"Email me on new company\" \\\n --type crm --object <objectId> --event create \\\n --prompt \"A company was just added to the CRM (its fields are in the \\\n<automation-event> payload). Email me a one-line summary — company name + \\\nwebsite + owner — to me@example.com via: dench email send --from \\\nyou@dench.com --to me@example.com --subject 'New CRM company' --text '<summary>'.\"\n```\n\nFor \"when it **moves**\" (a stage/owner change), use `--event update`. An\nunfiltered `update` fires on every edit, so either narrow it with `--where` on\nthe field `_id`, or have the prompt check the `<automation-event>`'s\n`changedFields` / `previousData` and no-op (finish without emailing) when the\nfield you care about didn't change. A filtered `update` fires once, on the\nedit that makes the entry match (e.g. Status becomes Qualified), not on later\nedits while it still matches.\n\n## Execution from Dench chat\n\nUse the same `dench cron` commands above through the harness's execution tool.\nCreating, updating, running and signing automations does not require a second\nset of orchestration tools. Discover only missing identifiers with\n`dench integrations --json`, `dench cron events <toolkit>`, or the relevant CRM\nobject/field listing. Reuse identifiers already established in the conversation.\n\n## Reusable custom setup\n\nWhen an automation needs packages, scripts or a custom API credential, save a\nverified environment once and bind it to the automation. Do not ask each new run\nto reinstall packages or reconstruct configuration from memory.\n\n```sh\ndench env save openai-report --path ./openai-report --json\ndench env show openai-report --json\ndench cron create \"Morning report\" --every 1d --environment openai-report --prompt \"Run node report.mjs, save the report, and summarize it.\"\ndench cron update <jobId> --environment openai-report\ndench cron update <jobId> --clear-environment\n```\n\nEach new run chooses the latest ready revision. Running jobs keep their pinned\nrevision, and children inherit it. Dependencies start in a prepared snapshot;\ncredentials are resolved from their current encrypted versions when commands\nexecute. An update that fails verification does not replace the last ready setup.\nDeclared mutable state is scoped to this automation and uses version checks,\nso overlapping runs cannot silently overwrite each other's progress.\n\n`dench cron secret` is webhook signing only. Use `dench secrets set NAME --stdin`\nfor a custom API credential and bind its name in the environment manifest. A\nsaved memory is not a credential or installation receipt. Read\n[ENVIRONMENTS.md](https://dench.com/references/ENVIRONMENTS.md) for the manifest,\nlocal execution and state-conflict behavior.\n\n## Common patterns\n\n- \"Remind me / run every N / each morning\" → `schedule` (`--every` / `--cron`).\n- \"Run once at <time>\" → `--at` (auto-disables after it fires).\n- \"Let an external system / Stripe / GitHub / a form trigger this\" → `webhook`,\n then hand over the URL and its signing secret (signed by default). Only if\n their tool can't sign, and they ask, create it `--unsigned` (or `dench cron\n secret <jobId> --off`) and warn them anyone with the link can run it. To expose\n an existing schedule/app-event/CRM automation by URL, `dench cron secret`\n on it (always signed).\n- \"Email / ping me when a CRM record is added or changes\" → `--type crm`\n (`--event create` for added, `--event update` for changes), with the notify\n action (`dench email send`, or `deliver_to`) written into the prompt. See\n **Trigger → action** above.\n- \"Do X when something happens in <connected app>\" → `--type app`\n (`dench cron events <toolkit>` for the slug), action in the prompt.\n- \"Fire this automation now\" → `dench cron run <jobId>`.\n- \"Rotate an automation webhook signing secret\" → `dench cron secret <jobId>` again.\n- \"Rotate a custom service credential\" → `dench secrets set NAME --stdin`; reuse\n the environment without rebuilding dependencies.\n- \"Stop requiring signatures\" → `dench cron secret <jobId> --off`.\n\n## Pitfalls\n\n- **A recurring to-do is a repeating TASK, not a cron.** If the user wants a\n person reminded / assigned on a cadence (\"weekly report\", \"quarterly\n check-in\"), use `dench crm tasks repeat <taskId> weekly --on mon` (see the\n CRM reference). Reserve `dench cron` for work Dench itself performs.\n\n- **Open webhooks are protected only by their URL.** Anyone holding it can\n fire the automation (and spend credits). Keep it private, or turn on signing.\n- **Secret is one-time.** Shown at webhook create or `secret` time only.\n Lost it? Rotate with `dench cron secret` (invalidates the old one).\n- **No schedule on a webhook automation** — `--type webhook` rejects\n `--every/--cron/--at`.\n- **One-time (`--at`) auto-disables** after firing; re-enable or recreate to\n reuse.\n- **Overlap policy** (`skip` default / `queue` / `kill_old`) governs what\n happens when a fire lands while a previous run is still going. A second fire\n during an in-flight run returns `skipped:overlap_skip` — that's expected,\n not an error.\n- **Self-contained prompts.** A fired automation runs with no human to ask;\n quote concrete filters, paths, and output destinations.\n- **App-event needs a connected app** — connect it first (dashboard →\n Integrations or `dench tool connect <toolkit>`) before `dench cron events` /\n `--type app` can see or subscribe to it.\n- **CRM `--where` filters use the field `_id`** from `dench crm fields list`\n (not the field name) — that's the id the server validates against.\n"
|
|
24
24
|
},
|
|
25
25
|
"references/BROWSER.md": {
|
|
26
26
|
"sha256": "adbea9443c00bf8b9efaec5a662fe4be770efb21cab0a296747651b01e42b46e",
|