picked 0.0.111-next.2 → 0.0.111-next.4

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.
Files changed (78) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/docs/explanation/app-authentication.md +178 -0
  3. package/docs/explanation/apps.md +169 -0
  4. package/docs/explanation/conditions-and-the-logic-engine.md +12 -2
  5. package/docs/explanation/feature-flag-allocation.md +5 -3
  6. package/docs/how-to/apps/add-a-page-to-the-dashboard.md +257 -0
  7. package/docs/how-to/apps/add-a-workflow-tool.md +199 -0
  8. package/docs/how-to/apps/add-an-mcp-server-to-an-app.md +210 -0
  9. package/docs/how-to/apps/connect-a-third-party-service-with-oauth.md +307 -0
  10. package/docs/how-to/apps/create-an-app-in-the-dashboard.md +162 -0
  11. package/docs/how-to/apps/deploy-an-app.md +201 -0
  12. package/docs/how-to/apps/develop-an-app-locally.md +152 -0
  13. package/docs/how-to/apps/host-an-app-on-vercel.md +226 -0
  14. package/docs/how-to/apps/install-an-app.md +116 -0
  15. package/docs/how-to/apps/link-to-an-installation-from-your-site.md +134 -0
  16. package/docs/how-to/apps/read-project-data-from-an-app.md +225 -0
  17. package/docs/how-to/apps/rotate-an-app-key.md +130 -0
  18. package/docs/how-to/apps/run-code-when-a-workspace-publishes.md +148 -0
  19. package/docs/how-to/apps/store-data-for-an-installation.md +230 -0
  20. package/docs/how-to/apps/test-an-app.md +359 -0
  21. package/docs/how-to/apps/upgrade-or-uninstall-an-app.md +97 -0
  22. package/docs/how-to/apps/use-an-app-tool-in-a-workflow.md +112 -0
  23. package/docs/index.md +6 -3
  24. package/docs/reference/apps/app-kit.md +811 -0
  25. package/docs/reference/apps/environment.md +116 -0
  26. package/docs/reference/apps/manifest.md +311 -0
  27. package/docs/reference/apps/protocol.md +497 -0
  28. package/docs/reference/dashboard/apps.md +504 -0
  29. package/docs/reference/dashboard/external-apis.md +5 -0
  30. package/docs/reference/dashboard/features.mdx +5 -5
  31. package/docs/reference/dashboard/labels.md +25 -8
  32. package/docs/reference/dashboard/lead-search.md +6 -6
  33. package/docs/reference/dashboard/reports.mdx +13 -5
  34. package/docs/reference/dashboard/workflow-tools.md +14 -0
  35. package/docs/reference/glossary.md +153 -140
  36. package/docs/reference/management-api/authentication.md +36 -27
  37. package/docs/reference/management-api/authorization-and-scopes.md +73 -21
  38. package/docs/reference/management-api/schema/api-key.md +10 -10
  39. package/docs/reference/management-api/schema/app.md +726 -0
  40. package/docs/reference/management-api/schema/auth.md +7 -7
  41. package/docs/reference/management-api/schema/common.md +54 -35
  42. package/docs/reference/management-api/schema/feature.md +1 -1
  43. package/docs/reference/management-api/schema/feedback.md +1 -1
  44. package/docs/reference/management-api/schema/index.md +35 -20
  45. package/docs/reference/management-api/schema/label.md +31 -8
  46. package/docs/reference/management-api/schema/organization.md +66 -66
  47. package/docs/reference/management-api/schema/project.md +5 -5
  48. package/docs/reference/management-api/schema/report.md +1 -1
  49. package/docs/reference/management-api/schema/shopify.md +19 -19
  50. package/docs/reference/management-api/schema/tenant-branding.md +16 -0
  51. package/docs/reference/management-api/schema/workflow.md +6 -1
  52. package/docs/reference/management-api/schema/workspace.md +2 -2
  53. package/docs/reference/sdk/analytics-events.md +42 -36
  54. package/docs/reference/sdk/conditions.md +3 -3
  55. package/docs/reference/sdk/fields.md +5 -4
  56. package/docs/reference/sdk/index.md +4 -4
  57. package/docs/reference/sdk/plugins/create-experience.md +11 -9
  58. package/docs/reference/sdk/plugins/hotjar.md +2 -2
  59. package/docs/reference/sdk/plugins/sentry.md +2 -2
  60. package/docs/reference/sdk/plugins/shopify.md +2 -2
  61. package/docs/reference/sdk/predicates.md +5 -5
  62. package/docs/reference/sdk/ssr/index.md +4 -3
  63. package/docs/reference/sdk/ssr/rendering-and-hydration.md +30 -0
  64. package/docs/reference/sdk/type-generation.md +24 -19
  65. package/docs/reference/tools/admin-api-client.md +15 -0
  66. package/docs/reference/tools/cli.md +192 -41
  67. package/docs/reference/tools/mcp.md +30 -9
  68. package/docs/tutorials/first-app.md +308 -0
  69. package/package.json +4 -4
  70. package/docs/explanation/how-pickedql-works.md +0 -76
  71. package/docs/how-to/analytics/index.md +0 -324
  72. package/docs/reference/management-api/schema/analytics.md +0 -75
  73. package/docs/reference/pickedql/data-sources.md +0 -174
  74. package/docs/reference/pickedql/dimensions.md +0 -103
  75. package/docs/reference/pickedql/filtering.md +0 -64
  76. package/docs/reference/pickedql/index.md +0 -18
  77. package/docs/reference/pickedql/schema.md +0 -172
  78. package/docs/reference/pickedql/virtual-functions.md +0 -248
@@ -0,0 +1,116 @@
1
+ ---
2
+ type: reference
3
+ layout: docs
4
+ ---
5
+
6
+ # App environment variables
7
+
8
+ These environment variables configure the server of an app, and the Picked CLI when it
9
+ deploys an app.
10
+
11
+ ## App server variables
12
+
13
+ `readAppEnvironment` from `@picked/app-kit/server` reads these variables. See
14
+ [`readAppEnvironment`](/reference/apps/app-kit#readappenvironment) for its parameters and its return value.
15
+
16
+ ```ts
17
+ import { readAppEnvironment } from '@picked/app-kit/server'
18
+
19
+ const port = process.env.APP_PORT ?? '4103'
20
+ const { privateKey, pickedKeys, publicUrl, frameAncestors } = readAppEnvironment(process.env, port)
21
+ ```
22
+
23
+ | Variable | Required | Value |
24
+ | -------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
25
+ | `PICKED_APP_PRIVATE_KEY` | Yes | The `Ed25519` private key of the app, as the `base64` of its `PKCS#8 DER`. A `PKCS#8 PEM` also works. |
26
+ | `PICKED_API_URL` | See [Values when a variable is not set](#values-when-a-variable-is-not-set) | The origin of the Picked API that the app accepts requests from, for example `https://api.picked.app`. |
27
+ | `APP_PUBLIC_URL` | No | The origin of the server of the app. The app uses it in its own URLs, for example the URL of an OAuth callback. |
28
+ | `PICKED_DASHBOARD_ORIGINS` | No | The dashboard origins that can show the pages of the app in an `iframe`. A `,` separates each origin. |
29
+ | `API_PORT` | No | The port of a Picked API on your computer. |
30
+ | `DASHBOARD_PORT` | No | The port of a Picked dashboard on your computer. |
31
+
32
+ `picked app keys generate` prints a value for `PICKED_APP_PRIVATE_KEY`. See
33
+ [CLI](/reference/tools/cli).
34
+
35
+ The app reads the public keys of Picked from
36
+ `<PICKED_API_URL>/.well-known/picked-app-keys.json`. It verifies each request from Picked
37
+ with these keys. See [Public keys of Picked](/reference/apps/protocol#public-keys-of-picked).
38
+
39
+ ## Values when a variable is not set
40
+
41
+ `readAppEnvironment` uses the first source in each row that has a value. `PICKED_API_URL` is required only when no other source gives a value.
42
+
43
+ | Variable | Sources, in order |
44
+ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | `PICKED_APP_PRIVATE_KEY` | 1. The variable. 2. None: `readAppEnvironment` throws an error. |
46
+ | `PICKED_API_URL` | 1. The variable. 2. On Vercel, the related project `picked-api`. 3. When `API_PORT` is set, `http://localhost:$API_PORT`. 4. None: `readAppEnvironment` throws an error. |
47
+ | `APP_PUBLIC_URL` | 1. The variable. 2. On Vercel with `VERCEL_ENV=production`, `https://$VERCEL_PROJECT_PRODUCTION_URL`. 3. On Vercel in a different environment, `https://$VERCEL_BRANCH_URL`. 4. `http://localhost:<port>`. |
48
+ | `PICKED_DASHBOARD_ORIGINS` | 1. The variable. 2. On Vercel, the related project `picked-dashboard`. 3. When `DASHBOARD_PORT` is set, `http://localhost:$DASHBOARD_PORT` and `http://127.0.0.1:$DASHBOARD_PORT`. 4. No origin. |
49
+
50
+ `<port>` is the second argument of `readAppEnvironment`.
51
+
52
+ | Error | Cause |
53
+ | ------------------------------------------------------------------------------------------ | ------------------------------------------------- |
54
+ | `` Set PICKED_APP_PRIVATE_KEY to the app's private key, from `picked app keys generate` `` | `PICKED_APP_PRIVATE_KEY` is not set, or is empty. |
55
+ | `Set PICKED_API_URL to the Picked API the app trusts` | No source gives a value for `PICKED_API_URL`. |
56
+
57
+ `readAppEnvironment` removes each `/` at the end of `PICKED_API_URL` and `APP_PUBLIC_URL`.
58
+
59
+ ### Related projects on Vercel
60
+
61
+ On Vercel, `VERCEL_RELATED_PROJECTS` lists the related projects of the deployment.
62
+ `readAppEnvironment` reads the origin of the related projects `picked-api` and
63
+ `picked-dashboard` from it:
64
+
65
+ | `VERCEL_ENV` | Origin of the related project |
66
+ | ------------ | ------------------------------------------------------------------------------------------------------ |
67
+ | `preview` | The preview deployment of the related project for the same custom environment, or for the same branch. |
68
+ | `production` | The production alias of the related project, or its production URL. |
69
+
70
+ The related project `picked-dashboard` gives one origin only, its main host. It does not give the dashboard host of each client.
71
+
72
+ A deployment without these related projects gets no value from them. Set
73
+ `PICKED_API_URL` and `PICKED_DASHBOARD_ORIGINS` on that deployment.
74
+
75
+ ## Values for each Picked environment
76
+
77
+ The server of an app accepts requests from one Picked environment. Each Picked environment gives the app a
78
+ different app ID.
79
+
80
+ | Picked environment | `PICKED_API_URL` | `PICKED_DASHBOARD_ORIGINS` |
81
+ | ----------------------- | ---------------------------- | ------------------------------------------------------------------------------------ |
82
+ | Production | `https://api.picked.app` | `https://dashboard.picked.app,https://*.picked.app,https://dashboard.convincely.com` |
83
+ | Test (`picked-dev.app`) | `https://api.picked-dev.app` | `https://dashboard.picked-dev.app,https://*.picked-dev.app` |
84
+
85
+ `https://*.picked.app` includes the dashboard host of each client, for example
86
+ `https://aia.picked.app`. To allow fewer hosts, write each host in the list.
87
+
88
+ The production list has no `picked-dev.app` origin.
89
+
90
+ ## `frame-ancestors`
91
+
92
+ `readAppEnvironment` returns the dashboard origins as `frameAncestors`. `page` from
93
+ `@picked/app-kit/server` sends them in the `Content-Security-Policy` header of a page:
94
+
95
+ ```text
96
+ Content-Security-Policy: frame-ancestors https://dashboard.picked.app https://*.picked.app https://dashboard.convincely.com
97
+ ```
98
+
99
+ When `frameAncestors` is empty, the header is `frame-ancestors 'none'`. Then no site can
100
+ show the page in an `iframe`, and the dashboard also cannot show it. See
101
+ [`page`](/reference/apps/app-kit#responses).
102
+
103
+ ## CLI variables
104
+
105
+ `picked app deploy` and `picked app dev` read `PICKED_APP_PRIVATE_KEY` and
106
+ `PICKED_APP_PUBLIC_KEY` to register a public key with the app. See
107
+ [CLI environment variables](/reference/tools/cli#environment-variables). An app holds two
108
+ public keys at most. See [Public keys of an app](/reference/apps/protocol#public-keys-of-an-app).
109
+
110
+ ## Related
111
+
112
+ - [How to host an app on Vercel](/how-to/apps/host-an-app-on-vercel)
113
+ - [How to work on an app from your machine](/how-to/apps/develop-an-app-locally)
114
+ - [How to rotate an app key](/how-to/apps/rotate-an-app-key)
115
+ - [`@picked/app-kit`](/reference/apps/app-kit) — `readAppEnvironment` and `page`.
116
+ - [About app authentication](/explanation/app-authentication) — why the app has a private key and a public key.
@@ -0,0 +1,311 @@
1
+ ---
2
+ type: reference
3
+ layout: docs
4
+ ---
5
+
6
+ # App manifest
7
+
8
+ The app manifest declares one version of an app. It gives the name and the server of the
9
+ app. It also gives the pages, workflow tools, MCP server and events of the app, and the
10
+ access that the app asks for.
11
+
12
+ ```ts
13
+ import { defineConfig } from '@picked/config/define'
14
+
15
+ const endpoint = `http://localhost:${process.env.APP_PORT ?? '4103'}`
16
+
17
+ export default defineConfig({
18
+ app: {
19
+ handle: 'lead-insights',
20
+ name: 'Lead Insights',
21
+ description:
22
+ 'Scores leads in workflows, gives the assistant tools over the project’s leads, and shows a leads summary.',
23
+ endpoint,
24
+ scopes: ['organization_leads/read'],
25
+ slots: [{ location: 'app-home', url: `${endpoint}/`, title: 'Recent leads', height: 320 }],
26
+ mcp: { url: `${endpoint}/mcp` },
27
+ workflowTools: [
28
+ {
29
+ name: 'score_lead',
30
+ label: 'Score lead',
31
+ description:
32
+ 'Scores a lead from 0 to 100 on its email domain and company, and names its tier.',
33
+ effect: 'read',
34
+ arguments: {
35
+ email: { label: 'Email', type: 'string', required: true },
36
+ company: { label: 'Company', type: 'string' },
37
+ },
38
+ output: {
39
+ score: { label: 'Score', type: 'number' },
40
+ tier: { label: 'Tier', type: 'string', description: 'hot, warm or cold' },
41
+ },
42
+ },
43
+ ],
44
+ },
45
+ })
46
+ ```
47
+
48
+ ## The `app` section of `picked.config`
49
+
50
+ The CLI reads the manifest from the `app` section of `picked.config.ts`, `picked.config.js`
51
+ or `picked.config.json`, in that order. In a `.ts` or `.js` file, the config is the
52
+ `export default` value. A `.json` file holds the config object. A manifest that computes a
53
+ value, for example an `endpoint` from `process.env`, must be in a `.ts` or `.js` file.
54
+
55
+ `defineConfig` from `@picked/config/define` checks the types of the config. It returns the
56
+ config without changes. `@picked/config/define` reads no files. The server of the app can
57
+ use `picked.config.ts` as a module, and give `config.app` to `createAppHandler`.
58
+
59
+ The config of an app has these keys:
60
+
61
+ | Key | Type | Description |
62
+ | -------- | ------------- | ---------------------------------------------------------------------------------- |
63
+ | `app` | `AppManifest` | The manifest. [Fields](#fields) gives each field. |
64
+ | `apiUrl` | `string` | The Picked API that the CLI deploys to. The `PICKED_API_URL` variable replaces it. |
65
+
66
+ A config can also have a `projectId` and the other keys of a project config. A config can have
67
+ a `projectId`, an `app` section, or both, but it must have one of them. The
68
+ `picked generate types` and `picked pull` commands and the Vite plugin need a `projectId`.
69
+ They stop with an error when the config has no `projectId`.
70
+
71
+ The CLI checks the config before it checks the manifest. It stops with one of these errors.
72
+ `<file>` is the path of the config file:
73
+
74
+ | Error | Cause |
75
+ | ------------------------------------------------------------------------------------------------ | --------------------------------------------------- |
76
+ | ``Invalid <file>: it sets neither `projectId` (a project) nor `app` (an app). Set one or both.`` | The config has no `projectId` and no `app` section. |
77
+ | ``Invalid <file>: `app` must be the app manifest, an object.`` | The `app` section is not an object. |
78
+ | ``Invalid <file>: `app.handle` must be a non-empty string.`` | The manifest has no `handle`. |
79
+ | ``Invalid <file>: `app.name` must be a non-empty string.`` | The manifest has no `name`. |
80
+ | ``Invalid <file>: `apiUrl` must be the Picked API origin.`` | `apiUrl` is not a string, or it is empty. |
81
+
82
+ [Validation](#validation) gives the errors of the other fields.
83
+
84
+ In the dashboard, the manifest is what you enter on the **New app** page, in the form or
85
+ in **Edit as JSON**. See [New app](/reference/dashboard/apps#new-app).
86
+
87
+ ## Fields
88
+
89
+ | Field | Type | Default | Description |
90
+ | --------------- | ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
91
+ | `handle` | `string` | required | The identifier of the app in its organization. 2 to 63 characters. See [Handle](#handle). |
92
+ | `name` | `string` | required | The name that the dashboard shows. Picked removes spaces at the start and at the end. |
93
+ | `description` | `string` | none | A short text about the app. |
94
+ | `endpoint` | `string` | none | The base URL of the server of the app. See [Endpoint](#endpoint). |
95
+ | `scopes` | `string[]` | none | The Picked scopes that the tokens of an installation carry, for example `organization_leads/read`. |
96
+ | `slots` | `AppSlot[]` | none | The pages of the app that the dashboard shows in an `iframe`. See [Slots](#slots). |
97
+ | `workflowTools` | `AppWorkflowTool[]` | none | The workflow tools that the app adds to each project that it is installed on. See [Workflow tools](#workflow-tools). |
98
+ | `mcp` | `{ url: string }` | none | An MCP server for the AI agent in the dashboard. See [MCP server](#mcp-server). |
99
+ | `events` | `'workspace.published'[]` | none | The events that Picked sends to the app. See [Events](#events). |
100
+ | `offlineAccess` | `boolean` | `false` | When `true`, the app can get tokens at any time. See [`offlineAccess`](#offlineaccess). |
101
+
102
+ Picked ignores a field that is not in this table.
103
+
104
+ ## Handle
105
+
106
+ The `handle` matches `^[a-z0-9][a-z0-9-]{1,62}$`: lowercase letters, digits and hyphens. The
107
+ first character is a letter or a digit.
108
+
109
+ Each app has one handle in its organization. When you deploy a manifest with a new handle,
110
+ Picked makes a new app. When the organization has an app with that handle already, Picked
111
+ adds a version to that app.
112
+
113
+ The command `picked app dev` adds a version for development. The other ways to deploy add a
114
+ release version. When the manifest is the same as the last version of that kind, Picked adds
115
+ no version. See [How to deploy an app](/how-to/apps/deploy-an-app).
116
+
117
+ When Picked installs the app on a project, the slug of the installation is the handle. When
118
+ the project has that slug already, Picked adds a hyphen and three characters to the
119
+ handle. Each character is from `0-9` or `a-f`. An example is `lead-insights-3fa`.
120
+
121
+ ## Endpoint
122
+
123
+ The `endpoint` is the base URL of the requests that Picked sends to the app. The URL must be
124
+ one of these:
125
+
126
+ - An `https` URL.
127
+ - An `http` URL on the host `localhost`, `127.0.0.1` or `[::1]`.
128
+
129
+ The URL can have a path, for example `https://app.example.com/picked`. Picked removes each
130
+ `/` at the end of the URL. Then it adds the path of each request to the URL:
131
+
132
+ | Request | URL |
133
+ | ---------------------------------------- | ------------------------- |
134
+ | Install, upgrade and uninstall | `<endpoint>/lifecycle` |
135
+ | An event in `events` | `<endpoint>/events` |
136
+ | A call to a workflow tool named `<name>` | `<endpoint>/tools/<name>` |
137
+
138
+ For the endpoint `https://app.example.com/picked/`, Picked sends lifecycle events to
139
+ `https://app.example.com/picked/lifecycle`.
140
+
141
+ These fields need an `endpoint`: a `workflowTools` list that is not empty, and `events`.
142
+ An app without an `endpoint` has slots, an MCP server, or both.
143
+
144
+ See [Requests from Picked](/reference/apps/protocol#requests-from-picked) for the paths below
145
+ the endpoint, and [Delivery](/reference/apps/protocol#delivery) for the addresses that
146
+ Picked can send to.
147
+
148
+ ## Scopes
149
+
150
+ Each value in `scopes` is the name of a Picked scope. See
151
+ [Authorization and scopes](/reference/management-api/authorization-and-scopes) for the
152
+ names. A name that is not a Picked scope stops `appDeploy` with `Unknown scope <scope>`.
153
+
154
+ A person who installs the app must hold each scope on the project. The installation then
155
+ has these scopes. A token that Picked gives the installation carries them.
156
+
157
+ ## Slots
158
+
159
+ A slot is one page of the app that the dashboard shows in an `iframe`.
160
+
161
+ | Field | Type | Default | Description |
162
+ | ---------- | -------- | ------------------- | ----------------------------------------------------------------------------------------- |
163
+ | `location` | `string` | required | Where the dashboard shows the page. See the table below. |
164
+ | `url` | `string` | required | The URL of the page. The same rule as [`endpoint`](#endpoint) applies. |
165
+ | `title` | `string` | the name of the app | The heading above the `iframe`, and the title of the `iframe`. |
166
+ | `height` | `number` | `160` | The height of the `iframe` at the start, in pixels. The page can change it with `resize`. |
167
+
168
+ | `location` | Where the dashboard shows the page |
169
+ | ------------------------------- | ------------------------------------------------------------------------------------------ |
170
+ | `app-home` | A page of its own in the project, at `/<organization>/<project>/apps/<installation slug>`. |
171
+ | `workspace-prepublish-actions` | The publish modal of a workspace, before Picked publishes the workspace. |
172
+ | `workspace-postpublish-actions` | The publish modal of a workspace, after Picked publishes the workspace. |
173
+
174
+ On the `app-home` page, the name of the app is the page heading, and `title` is the title of
175
+ the `iframe` only.
176
+
177
+ When the app has one `app-home` slot, that slot fills its page and the dashboard ignores
178
+ `height`.
179
+
180
+ When the `url` of a slot has the origin of the dashboard, the dashboard shows an error in
181
+ place of the page. See
182
+ [Messages between the page and the dashboard](/reference/apps/protocol#messages-between-the-page-and-the-dashboard).
183
+
184
+ ## Workflow tools
185
+
186
+ Each item of `workflowTools` is one tool. A workflow node calls the tool, and Picked sends
187
+ the call to `<endpoint>/tools/<name>`.
188
+
189
+ | Field | Type | Default | Description |
190
+ | ------------- | ------------------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------- |
191
+ | `name` | `string` | required | The name of the tool in the app. It matches `^[a-z][a-z0-9_]{0,62}$`. Two tools cannot have one name. |
192
+ | `label` | `string` | required | The name of the tool in the workflow editor. |
193
+ | `description` | `string` | `''` | What the tool does, for the workflow editor. |
194
+ | `effect` | `'read' \| 'write'` | required | `write` when a call changes data outside the run. A test run calls a `write` tool only when **Execute writes** is on. |
195
+ | `arguments` | `Record<string, AppToolArgument>` | `{}` | The arguments that a node sets, by name. |
196
+ | `output` | `Record<string, AppToolOutputField>` | `{}` | The values that a call records for the nodes after it, by name. |
197
+
198
+ The name of an argument or an output value matches `^[a-zA-Z]\w{0,62}$`: a letter, then
199
+ letters, digits or `_`, 63 characters at most.
200
+
201
+ ### Arguments
202
+
203
+ | Field | Type | Default | Description |
204
+ | ------------- | ---------- | -------- | ------------------------------------------------ |
205
+ | `label` | `string` | required | The name of the argument in the workflow editor. |
206
+ | `type` | `string` | required | `string`, `number`, `boolean` or `json`. |
207
+ | `description` | `string` | `''` | The text below the field in the workflow editor. |
208
+ | `required` | `boolean` | `false` | When `true`, a node must set the argument. |
209
+ | `options` | `string[]` | none | The values that a `string` argument can have. |
210
+
211
+ ### Output
212
+
213
+ | Field | Type | Default | Description |
214
+ | ------------- | --------- | -------- | ----------------------------------------------------- |
215
+ | `label` | `string` | required | The name of the value in the workflow editor. |
216
+ | `type` | `string` | required | `string`, `number`, `boolean` or `json`. |
217
+ | `description` | `string` | `''` | What the value holds. |
218
+ | `optional` | `boolean` | `false` | When `true`, the answer of a call can omit the value. |
219
+
220
+ ### Tools in a project
221
+
222
+ Each installation of the app adds each tool of its version to the project:
223
+
224
+ | Property | Value |
225
+ | -------- | ----------------------------------------------------------------------------- |
226
+ | Name | `app.<installation slug>.<name>`, for example `app.lead-insights.score_lead`. |
227
+ | Label | `<app name>: <label>`, for example `Lead Insights: Score lead`. |
228
+ | Scope | `organization_external_apis/call`. |
229
+
230
+ See [Workflow tool calls](/reference/apps/protocol#workflow-tool-calls) for the request and
231
+ the answer.
232
+
233
+ ## MCP server
234
+
235
+ `mcp.url` is the full URL of the MCP server, for example `https://app.example.com/mcp`. The
236
+ same rule as [`endpoint`](#endpoint) applies. The host can be different from the host of
237
+ the `endpoint`, and the manifest does not need an `endpoint`. Picked sends each MCP request
238
+ of the AI agent in the dashboard to `mcp.url` without changes to the URL. See
239
+ [MCP requests](/reference/apps/protocol#mcp-requests).
240
+
241
+ ## Events
242
+
243
+ `events` lists the events that Picked sends to `<endpoint>/events`. The only value is
244
+ `workspace.published`. Picked keeps one copy of a value that the list has two times. See
245
+ [App events](/reference/apps/protocol#app-events).
246
+
247
+ ## `offlineAccess`
248
+
249
+ With `offlineAccess: true`, the server of the app can get an installation token at any
250
+ time. An example is a task that runs at fixed times. A person who installs or upgrades
251
+ the app gives consent to it. Without it, the app gets a token only during a request from
252
+ Picked. It can also get one during a request from a person on a page of the app. See
253
+ [Installation tokens](/reference/apps/protocol#installation-tokens).
254
+
255
+ ## Validation
256
+
257
+ `parseManifest` from `@picked/app-kit` checks a manifest. `picked app deploy`,
258
+ `picked app dev` and the `appDeploy` mutation use it. It returns all the problems that it
259
+ finds, not only the first.
260
+
261
+ ```ts
262
+ parseManifest(value: unknown): { ok: true; manifest: AppManifest } | { ok: false; issues: string[] }
263
+ ```
264
+
265
+ | Message | Cause |
266
+ | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
267
+ | `The manifest must be an object` | The manifest is not an object. |
268
+ | `handle must be 2-63 lower-case letters, digits and hyphens` | `handle` does not match its pattern. |
269
+ | `name is required` | `name` is not set, or has only spaces. |
270
+ | `endpoint must be an https URL, or http on localhost` | `endpoint` is not a correct URL. See [Endpoint](#endpoint). |
271
+ | `scopes must be an array of scope names` | `scopes` is not an array of strings. |
272
+ | `slots must be an array` | `slots` is not an array. |
273
+ | `slots[<n>] must be an object` | A slot is not an object. |
274
+ | `slots[<n>].location must be one of app-home, workspace-prepublish-actions, workspace-postpublish-actions` | `location` has a different value. |
275
+ | `slots[<n>].url must be an https URL, or http on localhost` | `url` is not a correct URL. See [Endpoint](#endpoint). |
276
+ | `workflowTools must be an array` | `workflowTools` is not an array. |
277
+ | `workflowTools[<n>] must be an object` | A tool is not an object. |
278
+ | `workflowTools[<n>].name must be lower-case letters, digits and underscores` | `name` does not match its pattern. |
279
+ | `workflowTools[<n>].label is required` | `label` is not set, or is empty. |
280
+ | `workflowTools[<n>].effect must be read or write` | `effect` has a different value. |
281
+ | `workflowTools[<n>].arguments must be an object keyed by field name` | `arguments` is not an object. |
282
+ | `workflowTools[<n>].output must be an object keyed by field name` | `output` is not an object. |
283
+ | `<field> is not a valid field name` | The name of an argument or an output value does not match its pattern. |
284
+ | `<field> must be an object` | An argument or an output value is not an object. |
285
+ | `<field>.label is required` | The `label` of an argument or an output value is not set, or is empty. |
286
+ | `<field>.type must be one of string, number, boolean, json` | The `type` of an argument or an output value has a different value. |
287
+ | `workflowTools need an endpoint to call` | The manifest has tools and no `endpoint`. |
288
+ | `workflowTools has two tools named <name>` | Two tools have one `name`. |
289
+ | `mcp.url must be an https URL, or http on localhost` | `mcp` is not an object, or `mcp.url` is not a correct URL. |
290
+ | `events must be an array of workspace.published` | `events` is not an array, or has a different value. |
291
+ | `events need an endpoint to send them to` | The manifest has `events` and no `endpoint`. |
292
+ | `offlineAccess must be true or false` | `offlineAccess` is not a `boolean`. |
293
+
294
+ `<n>` is the position in the array, from 0. `<field>` is the path of the argument or the
295
+ output value, for example `workflowTools[0].arguments.email`.
296
+
297
+ When a slot or a tool has a problem, `parseManifest` does not check the other fields of that
298
+ slot or tool.
299
+
300
+ The `appDeploy` mutation also refuses a scope that is not a Picked scope. See
301
+ [Scopes](#scopes).
302
+
303
+ ## Related
304
+
305
+ - [About apps](/explanation/apps) — what an app is, and how versions and installations
306
+ work.
307
+ - [`@picked/app-kit`](/reference/apps/app-kit) — `parseManifest` and the server functions.
308
+ - [App protocol](/reference/apps/protocol) — the requests that Picked sends for each field.
309
+ - [How to add a workflow tool to an app](/how-to/apps/add-a-workflow-tool)
310
+ - [How to add a page to the dashboard](/how-to/apps/add-a-page-to-the-dashboard)
311
+ - [How to deploy an app](/how-to/apps/deploy-an-app)