@somewhere-cloud/cli 0.38.154 → 0.38.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/docs/adopt.md +39 -0
- package/dist/docs/analytics.md +161 -0
- package/dist/docs/api-reference.md +339 -0
- package/dist/docs/api-surface.md +2067 -0
- package/dist/docs/app-mcp.md +162 -0
- package/dist/docs/architecture-patterns.md +334 -0
- package/dist/docs/auth-client.md +531 -0
- package/dist/docs/billing.md +76 -0
- package/dist/docs/browser.md +639 -0
- package/dist/docs/calendar.md +298 -0
- package/dist/docs/changes.md +323 -0
- package/dist/docs/cli.md +407 -0
- package/dist/docs/common-mistakes.md +199 -0
- package/dist/docs/connect-agent.md +72 -0
- package/dist/docs/cors.md +114 -0
- package/dist/docs/cron.md +167 -0
- package/dist/docs/database-engine.md +167 -0
- package/dist/docs/declared-data.md +1656 -0
- package/dist/docs/declared-files.md +475 -0
- package/dist/docs/deploy-intelligence.md +188 -0
- package/dist/docs/deploy.md +733 -0
- package/dist/docs/design-system.md +273 -0
- package/dist/docs/dev-environments.md +496 -0
- package/dist/docs/domain-ownership.md +31 -0
- package/dist/docs/domains.md +370 -0
- package/dist/docs/feedback.md +88 -0
- package/dist/docs/file-tools.md +116 -0
- package/dist/docs/functions.md +489 -0
- package/dist/docs/getting-started.md +238 -0
- package/dist/docs/github.md +95 -0
- package/dist/docs/google-calendar.md +212 -0
- package/dist/docs/groups.md +836 -0
- package/dist/docs/guarantees.md +58 -0
- package/dist/docs/handled-for-you.md +224 -0
- package/dist/docs/inspect.md +171 -0
- package/dist/docs/limits.md +68 -0
- package/dist/docs/live-data.md +197 -0
- package/dist/docs/live.md +92 -0
- package/dist/docs/local-dev.md +30 -0
- package/dist/docs/migration-supabase.md +58 -0
- package/dist/docs/payments.md +1102 -0
- package/dist/docs/portability.md +194 -0
- package/dist/docs/postgres.md +301 -0
- package/dist/docs/pricing-comparison.md +42 -0
- package/dist/docs/pricing.md +39 -0
- package/dist/docs/project-groups.md +107 -0
- package/dist/docs/projects.md +380 -0
- package/dist/docs/recipe-ai-agent.md +112 -0
- package/dist/docs/recipe-ai-features.md +227 -0
- package/dist/docs/recipe-ai-receipts.md +783 -0
- package/dist/docs/recipe-background-jobs.md +369 -0
- package/dist/docs/recipe-booking.md +348 -0
- package/dist/docs/recipe-csv-import.md +390 -0
- package/dist/docs/recipe-ecommerce.md +127 -0
- package/dist/docs/recipe-email.md +282 -0
- package/dist/docs/recipe-escalation.md +133 -0
- package/dist/docs/recipe-file-uploads.md +159 -0
- package/dist/docs/recipe-import-app.md +110 -0
- package/dist/docs/recipe-login.md +457 -0
- package/dist/docs/recipe-multi-chat.md +198 -0
- package/dist/docs/recipe-paid-api.md +161 -0
- package/dist/docs/recipe-pdfs.md +205 -0
- package/dist/docs/recipe-push-notifications.md +107 -0
- package/dist/docs/recipe-seo.md +200 -0
- package/dist/docs/recipe-signed-in-app.md +330 -0
- package/dist/docs/render.md +99 -0
- package/dist/docs/rooms.md +554 -0
- package/dist/docs/sdk.md +287 -0
- package/dist/docs/sdks.md +24 -0
- package/dist/docs/search.md +199 -0
- package/dist/docs/security-model.md +168 -0
- package/dist/docs/setup.md +212 -0
- package/dist/docs/smoke.md +102 -0
- package/dist/docs/speed.md +298 -0
- package/dist/docs/sql-compatibility.md +96 -0
- package/dist/docs/sw.agent.md +248 -0
- package/dist/docs/sw.ai.md +1291 -0
- package/dist/docs/sw.auth.md +1811 -0
- package/dist/docs/sw.billing.md +171 -0
- package/dist/docs/sw.db.md +2128 -0
- package/dist/docs/sw.email.md +661 -0
- package/dist/docs/sw.endpoint.md +187 -0
- package/dist/docs/sw.env.md +303 -0
- package/dist/docs/sw.fetch.md +115 -0
- package/dist/docs/sw.fs.md +424 -0
- package/dist/docs/sw.groups.md +836 -0
- package/dist/docs/sw.image.md +69 -0
- package/dist/docs/sw.jobs.md +520 -0
- package/dist/docs/sw.logs.md +61 -0
- package/dist/docs/sw.mail.md +106 -0
- package/dist/docs/sw.notifications.md +78 -0
- package/dist/docs/sw.push.md +161 -0
- package/dist/docs/sw.rateLimit.md +67 -0
- package/dist/docs/sw.web.md +128 -0
- package/dist/docs/tasks.md +269 -0
- package/dist/docs/test.md +220 -0
- package/dist/docs/tool-reference-account.md +7 -0
- package/dist/docs/tool-reference-ai.md +121 -0
- package/dist/docs/tool-reference-analytics.md +37 -0
- package/dist/docs/tool-reference-api.md +19 -0
- package/dist/docs/tool-reference-artifacts.md +35 -0
- package/dist/docs/tool-reference-auth.md +163 -0
- package/dist/docs/tool-reference-browser.md +114 -0
- package/dist/docs/tool-reference-code.md +26 -0
- package/dist/docs/tool-reference-connect.md +21 -0
- package/dist/docs/tool-reference-cron.md +48 -0
- package/dist/docs/tool-reference-db.md +282 -0
- package/dist/docs/tool-reference-domains.md +107 -0
- package/dist/docs/tool-reference-email.md +55 -0
- package/dist/docs/tool-reference-env.md +19 -0
- package/dist/docs/tool-reference-feedback.md +56 -0
- package/dist/docs/tool-reference-fs.md +265 -0
- package/dist/docs/tool-reference-github.md +57 -0
- package/dist/docs/tool-reference-groups.md +85 -0
- package/dist/docs/tool-reference-help.md +29 -0
- package/dist/docs/tool-reference-jobs.md +39 -0
- package/dist/docs/tool-reference-live.md +48 -0
- package/dist/docs/tool-reference-logs.md +16 -0
- package/dist/docs/tool-reference-payments.md +44 -0
- package/dist/docs/tool-reference-project.md +706 -0
- package/dist/docs/tool-reference-push.md +78 -0
- package/dist/docs/tool-reference-rate-limit.md +18 -0
- package/dist/docs/tool-reference-search.md +68 -0
- package/dist/docs/tool-reference-security.md +42 -0
- package/dist/docs/tool-reference-smoke.md +17 -0
- package/dist/docs/tool-reference-stock-photos.md +20 -0
- package/dist/docs/tool-reference-tasks.md +73 -0
- package/dist/docs/tool-reference-telegram.md +32 -0
- package/dist/docs/tool-reference-usage.md +9 -0
- package/dist/docs/tool-reference-web.md +71 -0
- package/dist/docs/tool-reference-webhooks.md +9 -0
- package/dist/docs/troubleshooting.md +411 -0
- package/dist/docs/typed-functions.md +94 -0
- package/dist/docs/verify-before-deploy.md +67 -0
- package/dist/docs/vs-supabase.md +75 -0
- package/dist/docs/vs-vercel.md +103 -0
- package/dist/lib/bundle.js +303 -221
- package/dist/lib/bundle.js.map +3 -3
- package/dist/types/lib/test-session.d.ts +8 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +3 -2
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# Tasks — shared context for work
|
|
2
|
+
|
|
3
|
+
sw.tasks keeps direction, working rules, current work and delivery evidence in
|
|
4
|
+
the same project. An agent can read what matters, follow related work and leave
|
|
5
|
+
the next agent a current summary. `description` holds the intent;
|
|
6
|
+
`status_note` holds what is true now; comments hold evidence.
|
|
7
|
+
|
|
8
|
+
Start a board scan with `tasks_list`:
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{"project_id":"my-app","view":"board","limit":50,"include_superseded":false}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Work rows contain the title, type, status, health, waiting state and current
|
|
15
|
+
note, without descriptions or comments. `page` reports the total, ordering and
|
|
16
|
+
next cursor. `tasks_overview` adds a short view of direction, SOPs, recorded
|
|
17
|
+
priorities, active work and shipping. `project_id` accepts a project ID or slug;
|
|
18
|
+
`default` selects the shared organization board for callers with access.
|
|
19
|
+
|
|
20
|
+
Filter by an exact label with `label`. For work tagged `needs-review` and
|
|
21
|
+
assigned to `alex`, pass both filters to `tasks_list` or run
|
|
22
|
+
`somewhere tasks list -p my-app --assignee alex --label needs-review`.
|
|
23
|
+
The REST equivalent is `GET /v1/tasks?project_id=my-app&assignee=alex&label=needs-review`.
|
|
24
|
+
A label search without `assignee` checks up to the 1,000 most recently added
|
|
25
|
+
tasks. When older tasks were skipped, `page.partial` is true and
|
|
26
|
+
`page.candidate_note` explains how to narrow the search.
|
|
27
|
+
|
|
28
|
+
Create a piece of work with `tasks_create`:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{"project_id":"my-app","title":"Verify the welcome email","status":"in_progress","status_note":"The email is implemented; checking signup and retry behavior next."}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use the returned ID as `task_id` in `tasks_update`. Record progress by replacing
|
|
35
|
+
the note, and attach receipts as a comment in the same call:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{"project_id":"my-app","task_id":"<returned task ID>","status_note":"Signup and retries pass; ready for the copy decision.","waiting_on":"product_decision","comment":"Two test signups received the message once. Retrying delivery produced no duplicate."}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The status note stays separate from the comment. Earlier field values remain
|
|
42
|
+
in activity history, so updating the summary retains the previous state.
|
|
43
|
+
|
|
44
|
+
## Current state and waiting
|
|
45
|
+
|
|
46
|
+
`status` applies to work records only. It is `backlog`, `open`, `in_progress`, `blocked`, `needs_review`, `done`
|
|
47
|
+
or `archived`. `priority` is `low`, `normal`, `high` or `urgent`.
|
|
48
|
+
`health` records `on_track`, `at_risk` or `off_track` independently of status.
|
|
49
|
+
`assignee` identifies who owns the work.
|
|
50
|
+
|
|
51
|
+
`waiting_on` records `human`, `product_decision` or `external`. Put the action
|
|
52
|
+
or decision needed in `status_note`; clear the wait with `null` or an empty
|
|
53
|
+
string when it is resolved. A wait does not change the assignee or status.
|
|
54
|
+
Closing through an ordinary status update clears an omitted wait.
|
|
55
|
+
|
|
56
|
+
## Ask the person for something
|
|
57
|
+
|
|
58
|
+
When only the person can do the next thing (create an account, approve a
|
|
59
|
+
charge, press a button elsewhere, decide), record it in one call. An ask said
|
|
60
|
+
only in chat is lost; a recorded one shows in their dashboard under "Waiting
|
|
61
|
+
for you", with your steps and who asked.
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{"project_id":"my-app","title":"Create a GitHub sign-in app for my-app","waiting_on":"human","status_note":"1. Open github.com/settings/developers and press New OAuth App.\n2. Set the callback address to https://my-app.somewhere.cloud/auth/github/callback.\n3. Press Register application, then press Done here.","description":"Sign in with GitHub needs a client id only the account owner can create.","author":"Claude Code"}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`title` is what is needed, in one line. `status_note` is the steps: numbered,
|
|
68
|
+
one per line, plain words, exact addresses. `description` is why. `author` is
|
|
69
|
+
the name you go by; the platform records how you were signed in beside it, as
|
|
70
|
+
`asked_by`. `waiting_on` is `human` for an action, `product_decision` for a
|
|
71
|
+
choice. `tasks_update` takes the same fields on an existing task. Never ask for
|
|
72
|
+
a secret in the reply (collaborators and agents can read it); `env_request`
|
|
73
|
+
collects secrets.
|
|
74
|
+
|
|
75
|
+
Keep the list true. When you no longer need something from the person, withdraw
|
|
76
|
+
the ask: clear `waiting_on` with a one-line `status_note` saying why. When the
|
|
77
|
+
need has changed, replace it in one call: create the new ask with `supersedes`
|
|
78
|
+
set to the old task's id (or set `superseded_by` on the old task). The old ask
|
|
79
|
+
leaves their list at once and the new one says it replaces an earlier request.
|
|
80
|
+
Closing or archiving the task removes it too. Nothing leaves the list by age.
|
|
81
|
+
Posting something for the person is the moment to tidy what is already waiting:
|
|
82
|
+
the write's answer lists their other open asks in the project under
|
|
83
|
+
`suggestions` (`still_waiting`), oldest first.
|
|
84
|
+
|
|
85
|
+
The person answers with Done, I can't do this or This is no longer needed, and
|
|
86
|
+
an optional note, in the dashboard or through any agent they ask. That clears
|
|
87
|
+
`waiting_on` and makes `status_note` the answer: `Done.`, `Not doing this.` or
|
|
88
|
+
`No longer needed.`, then their note. Read it
|
|
89
|
+
with `tasks_get` or a board scan, continue, and write the new state to
|
|
90
|
+
`status_note`. A comment on the task, or closing it, is read the same way.
|
|
91
|
+
|
|
92
|
+
`tasks_list` with `waiting: "me"` lists what is waiting for the signed-in person across their
|
|
93
|
+
projects (HTTP `GET /v1/account/waiting`). Use `next_cursor` as `cursor` to continue.
|
|
94
|
+
`limit` is the number of projects per call and defaults to 25. Larger limits are
|
|
95
|
+
reduced to 25. The response includes tasks from readable projects, and
|
|
96
|
+
`unread_projects` names any projects that could not be read. Retry one by
|
|
97
|
+
passing its `project_id`. Each project's list is kept for up to ten minutes and read again after a call
|
|
98
|
+
once it is a minute old, so a new item shows on the call after that one; with `project_id`
|
|
99
|
+
it reads that project at once. An answer given through Somewhere shows at once. `answered`
|
|
100
|
+
lists what was answered and by which credential (`answered_by`).
|
|
101
|
+
Answer for them with `tasks_update` (`answer`: `done`, `cannot` or `not_needed`, and `note`;
|
|
102
|
+
HTTP `POST /v1/tasks/<id>/answer`). Never answer `done` unless the person did
|
|
103
|
+
it or told you to.
|
|
104
|
+
|
|
105
|
+
The board defaults to unfinished records. Human and product-decision waits,
|
|
106
|
+
review work and blocked work sort before routine work, then priority and
|
|
107
|
+
creation time decide the order. A status filter can include closed work;
|
|
108
|
+
`sort: "updated"` or `"created"` selects recency instead. `waiting_on: "human"`
|
|
109
|
+
with `view: "board"` returns the human-input queue. `type`, `area`, `assignee` and `parent_id` narrow
|
|
110
|
+
the same read. Board rows show their type so guidance is distinguishable from work.
|
|
111
|
+
|
|
112
|
+
On the shared organization board, founder assignee aliases resolve to `founder`.
|
|
113
|
+
`founder-decision` also sets a product-decision wait on unfinished work,
|
|
114
|
+
replacing any previous wait unless `waiting_on` is supplied in the same write.
|
|
115
|
+
Customer-project assignees keep their own values.
|
|
116
|
+
|
|
117
|
+
## Direction, links and supersession
|
|
118
|
+
|
|
119
|
+
`tasks_overview` reads direction and work together. `memory_search` searches
|
|
120
|
+
durable guidance; `memory_save` records it. Direction types are `vision`, `philosophy`, `decision`, `directive`, `sop`,
|
|
121
|
+
`principle`, `policy` and `stance` (case and surrounding
|
|
122
|
+
whitespace do not matter). They are relevant until explicitly replaced, regardless
|
|
123
|
+
of historical status. Current payloads omit their `status` and `completed_at`.
|
|
124
|
+
Supplying a status for direction is refused, including in bulk updates.
|
|
125
|
+
`include_archived` includes archived work only; `include_superseded: true` includes
|
|
126
|
+
replaced records. Ordinary `tasks_list` shows relevant direction; `include_superseded: false`
|
|
127
|
+
excludes replaced records.
|
|
128
|
+
|
|
129
|
+
For a focused memory read: `memory_search({ project_id: "my-app", q: "welcome email" })`.
|
|
130
|
+
|
|
131
|
+
Set `parent_id` for a sub-task. `tasks_update` accepts `relationship`, for
|
|
132
|
+
example `{"type":"implements","task_id":"<SOP ID>"}`, to connect work to its
|
|
133
|
+
guidance. `tasks_get` returns linked guidance; `view: "relationships"` pages
|
|
134
|
+
related records and replacement pointers without their discussion bodies.
|
|
135
|
+
Links carry context; the agent decides which guidance applies.
|
|
136
|
+
|
|
137
|
+
Set `superseded_by` on the older record to its replacement ID. A `supersedes`
|
|
138
|
+
relationship points from replacement to older record. Both forms are honored
|
|
139
|
+
in current memory and the overview. A direction replacement counts only while its
|
|
140
|
+
named record exists. A dangling link does not hide direction. Reads with
|
|
141
|
+
`include_superseded: true` report broken target IDs in `dangling_replacement_ids`
|
|
142
|
+
on each affected direction record; reads never clear those links. Old records remain readable. Guidance
|
|
143
|
+
revisions preserve earlier text; a task's `guidance_context` can record the
|
|
144
|
+
revision used or a scoped exception. Retrieve that source with `tasks_get`
|
|
145
|
+
before recording its revision ID.
|
|
146
|
+
|
|
147
|
+
## Archive, supersede or delete
|
|
148
|
+
|
|
149
|
+
Direction is never archived or closed: name its replacement with `superseded_by`
|
|
150
|
+
or a `supersedes` link. Bulk deletion refuses each direction ID and continues with
|
|
151
|
+
work. An owner may delete a mistaken direction record by full ID with a reason,
|
|
152
|
+
unless direction names it as a replacement; change that link first.
|
|
153
|
+
|
|
154
|
+
Archive and supersede keep work history: an archived or replaced record stays
|
|
155
|
+
readable and searchable, so anyone can see how the work got here. Use them for
|
|
156
|
+
anything that was real, even if it was abandoned or replaced.
|
|
157
|
+
|
|
158
|
+
Delete is only for records that should never have existed: a duplicate, a
|
|
159
|
+
mistake, wrong direction. `tasks_delete` takes a required `reason`. The task,
|
|
160
|
+
its comments, activity and links leave lists, search, history, counts, memory
|
|
161
|
+
and other tasks' relationships on the next read; children are detached and replacement
|
|
162
|
+
pointers cleared.
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{"project_id":"my-app","task_id":"<task ID>","reason":"Duplicate of <other task ID>"}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
For 30 days `tasks_restore` brings it all back, including comments and links. It
|
|
169
|
+
takes the full task ID; a prefix is refused. Without `task_id` it lists deleted tasks with who deleted them, why, and
|
|
170
|
+
`purge_at`. Trash is purged after the 30-day recovery period. Links to tasks that no
|
|
171
|
+
longer exist, or that would now form a cycle, are not restored and are listed in
|
|
172
|
+
`not_restored`. For direction, a missing, conflicting or unpreservable replacement
|
|
173
|
+
link refuses the whole restore, naming its target IDs. Nothing is restored and
|
|
174
|
+
no replacement link is cleared.
|
|
175
|
+
|
|
176
|
+
Only the board owner can delete or restore, through their own account sign-in:
|
|
177
|
+
the dashboard, the CLI (`somewhere tasks delete|restore|deleted`) or an agent
|
|
178
|
+
signed in with that account. Collaborators, deployed functions, project-limited
|
|
179
|
+
CLI sessions and scope-limited keys get `TASK_DELETE_FORBIDDEN`.
|
|
180
|
+
|
|
181
|
+
## Types
|
|
182
|
+
|
|
183
|
+
Types are labels for retrieval; custom labels are supported.
|
|
184
|
+
|
|
185
|
+
vision — why the organization exists.
|
|
186
|
+
philosophy — a belief guiding trade-offs, including why it matters.
|
|
187
|
+
directive — a rule or instruction, including what it supersedes.
|
|
188
|
+
decision — a steer from the person who owns the project: their words, what it changes, what it replaces, the work it governs.
|
|
189
|
+
sop — how to carry out a recurring job.
|
|
190
|
+
spec — what to build and its acceptance criteria.
|
|
191
|
+
roadmap — direction and outcomes for work ahead.
|
|
192
|
+
epic — a larger outcome grouping related tasks.
|
|
193
|
+
task — a concrete piece of current work.
|
|
194
|
+
bug — behavior that needs correction.
|
|
195
|
+
report — an observation, incident or customer finding.
|
|
196
|
+
principle — a reusable rule for making decisions.
|
|
197
|
+
learning — a lesson supported by experience or evidence.
|
|
198
|
+
supplier — facts about an external service or supplier.
|
|
199
|
+
content — a draft or plan for published material.
|
|
200
|
+
policy — a standing rule governing operations.
|
|
201
|
+
stance — a position on a subject and its reasoning.
|
|
202
|
+
When the person who owns the project changes direction, parks or picks something, or overrules a plan, record it as a decision the same day, quoting them.
|
|
203
|
+
|
|
204
|
+
## Read only the detail needed
|
|
205
|
+
|
|
206
|
+
`tasks_get` returns current state and history counts. `view: "history"` with
|
|
207
|
+
`kind: "comments"` or `"activity"` returns newest entries first.
|
|
208
|
+
`view: "field"` expands a field named in `omitted`; its `content` is JSON text.
|
|
209
|
+
For saved guidance text, history supports `revisions` and `reviews`.
|
|
210
|
+
|
|
211
|
+
For continuation, repeat the filters and view with `page.next_cursor` as
|
|
212
|
+
`cursor`. Expand one page at a time. Task-list ordering is live: edits can move
|
|
213
|
+
rows between pages; restart for a fresh queue. `truncated_fields` on board rows
|
|
214
|
+
and `omitted` on detailed reads name content available through field expansion.
|
|
215
|
+
`view: "full"` requests complete fields and history.
|
|
216
|
+
|
|
217
|
+
## Closing work
|
|
218
|
+
|
|
219
|
+
Close with `tasks_update`, using the real outcome and verification evidence:
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
{"project_id":"my-app","task_id":"<task ID>","status":"done","status_note":"The welcome email is live and signup is verified.","resolution_note":"Delivered the welcome email and retry fix in release v12. Verified two signups and a repeated delivery; each account received one message."}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`resolution_note` is saved as a comment and included in configured resolution
|
|
226
|
+
notifications. `shipped_in` records a release tag; tasks requiring deployment
|
|
227
|
+
evidence use `deployment_project_id` and `deployment_version` to link a
|
|
228
|
+
verified deployment. Release mentions trigger a closure-review suggestion;
|
|
229
|
+
they do not close the task.
|
|
230
|
+
|
|
231
|
+
Write responses also suggest missing current-state notes, similar guidance
|
|
232
|
+
and recently copied evidence. Supersession and closure remain explicit writes.
|
|
233
|
+
Comment appends are not retry-safe: after an uncertain response, inspect history
|
|
234
|
+
before retrying.
|
|
235
|
+
|
|
236
|
+
## From a deployed function
|
|
237
|
+
|
|
238
|
+
The same records are available through `sw.tasks`. `listPage` returns both
|
|
239
|
+
rows and continuation metadata; `get` takes the same view options:
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
const board = await sw.tasks.listPage({ view: 'board', limit: 50 });
|
|
243
|
+
const task = board.data[0];
|
|
244
|
+
if (task) {
|
|
245
|
+
const current = await sw.tasks.get(task.id, { view: 'current' });
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
The no-options runtime `get` and `list` return full records. Bounded reads use
|
|
250
|
+
an explicit view. `sw.tasks.update(id, fields)` sets state;
|
|
251
|
+
`sw.tasks.comment(id, body)` appends evidence. Deployed functions cannot delete
|
|
252
|
+
tasks: `sw.tasks.delete` is refused with `TASK_DELETE_FORBIDDEN`.
|
|
253
|
+
|
|
254
|
+
## Notifications
|
|
255
|
+
|
|
256
|
+
Task mutations publish on the project's signed system channel. Optional email
|
|
257
|
+
and webhook settings use `tasks_settings_update` or `sw.tasks.settings.update`.
|
|
258
|
+
If the settings tool is outside the default surface, `catalog({ load: "tasks" })` loads it.
|
|
259
|
+
The returned `webhook_secret` signs `X-Somewhere-Signature`; save it when setting
|
|
260
|
+
the webhook. The header is `t=<milliseconds>,v1=<hex>`, where hex is HMAC-SHA256
|
|
261
|
+
over `<milliseconds>.<raw body>` using `webhook_secret`. Verify the raw bytes
|
|
262
|
+
before parsing. Settings reads do not return the secret. An empty `webhook_url`
|
|
263
|
+
clears the webhook and its secret.
|
|
264
|
+
|
|
265
|
+
## Deletion and recovery
|
|
266
|
+
|
|
267
|
+
Deletion is gone from normal task reads on the next read; restorable for 30 days; purged after. Other tasks retain their history. Deletion removes attachment references, never the underlying files. Raw database dumps are exact copies and may include trash until purge.
|
|
268
|
+
|
|
269
|
+
`tasks_delete` accepts one full `task_id` (a prefix is refused) or up to 200 full `task_ids`, with `project_id` and a required `reason`. Bulk deletion returns one result per ID; each ID succeeds or is refused on its own, so one refusal does not undo the others. It uses the same owner authority and protection as single deletion. Tasks referenced as guidance by live tasks cannot be deleted; the refusal names the referencing tasks.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Testing your app
|
|
2
|
+
|
|
3
|
+
Load when: testing the deployed app or an open preview from your own Node or Playwright script, or reading the platform smoke check.
|
|
4
|
+
|
|
5
|
+
## Write a test for your app
|
|
6
|
+
|
|
7
|
+
Install the test helper with `npm install -D @somewhere-cloud/cli`. In the
|
|
8
|
+
linked app folder, save your script in the `tests/` folder and run it with
|
|
9
|
+
Node. Import the installed package so each call runs in the same process.
|
|
10
|
+
The helper creates signed-in test users and sends their calls to the linked app. For an open preview, use
|
|
11
|
+
`openTestApp({ preview: true })`.
|
|
12
|
+
|
|
13
|
+
This example uses the app's own task and membership routes. A member can
|
|
14
|
+
read the task, the stranger gets 404, and the owner reads back the stored
|
|
15
|
+
title after the update.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import assert from 'node:assert/strict';
|
|
19
|
+
import { openTestApp } from '@somewhere-cloud/cli/testing';
|
|
20
|
+
|
|
21
|
+
const app = await openTestApp();
|
|
22
|
+
try {
|
|
23
|
+
const [owner, member, stranger] = await app.users(3);
|
|
24
|
+
const id = await app.create(owner, 'tasks', { title: 'Draft' });
|
|
25
|
+
const task = '/api/tasks/' + encodeURIComponent(id);
|
|
26
|
+
|
|
27
|
+
// Use the same membership route the app uses.
|
|
28
|
+
const membership = task + '/members';
|
|
29
|
+
const grant = await owner.session.post(membership, { user_id: member.id });
|
|
30
|
+
assert.equal(grant.status, 204);
|
|
31
|
+
app.onCleanup('task membership', async () => {
|
|
32
|
+
const removed = await owner.session.request(membership, {
|
|
33
|
+
method: 'DELETE',
|
|
34
|
+
headers: { 'Content-Type': 'application/json' },
|
|
35
|
+
body: JSON.stringify({ user_id: member.id }),
|
|
36
|
+
});
|
|
37
|
+
assert.equal(removed.status, 204);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const readAsMember = await member.session.request(task);
|
|
41
|
+
assert.equal(readAsMember.status, 200);
|
|
42
|
+
assert.equal((await readAsMember.json()).title, 'Draft');
|
|
43
|
+
await stranger.session.expectRefused('GET ' + task, undefined, { allowed: member.session });
|
|
44
|
+
|
|
45
|
+
const save = await owner.session.request(task, {
|
|
46
|
+
method: 'PATCH',
|
|
47
|
+
headers: { 'Content-Type': 'application/json' },
|
|
48
|
+
body: JSON.stringify({ title: 'Ready for review' }),
|
|
49
|
+
});
|
|
50
|
+
assert.equal(save.status, 204);
|
|
51
|
+
const stored = await owner.session.data('tasks', { operation: 'get', id });
|
|
52
|
+
assert.equal(stored.status, 200);
|
|
53
|
+
assert.equal((await stored.json()).data.title, 'Ready for review');
|
|
54
|
+
console.log('Member read, stranger hidden, and owner update verified.');
|
|
55
|
+
} finally {
|
|
56
|
+
await app.cleanup();
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- **Playwright.** Pass `storageState: await owner.session.storageState()` to
|
|
61
|
+
`browser.newContext()`. Open the page and call `waitForApp(page, 'signed-in')`
|
|
62
|
+
before interacting with it.
|
|
63
|
+
- **Private fields.** [Check for leaked fields](#privacy-checks-that-say-where-a-secret-leaked)
|
|
64
|
+
with `app.plantMarker()` and `assertNoLeak()`.
|
|
65
|
+
- **Jobs.** `await app.runJob({ schedule: 'daily-digest' })` or
|
|
66
|
+
`await app.runJob({ handler: '/api/jobs/import', payload: { batch: 1 } })`
|
|
67
|
+
submits once and waits. Check `status`, `job_id`, `request_id` and
|
|
68
|
+
`timed_out`. Keep an unknown admission for investigation.
|
|
69
|
+
- **Cleanup.** Put `await app.cleanup()` in `finally`. It removes the rows
|
|
70
|
+
made with `app.create()` or `app.plantMarker()`, then the test users.
|
|
71
|
+
Register cleanup for records your custom routes create with `app.onCleanup()`.
|
|
72
|
+
|
|
73
|
+
## After an edit
|
|
74
|
+
|
|
75
|
+
After a backend edit, run `somewhere deploy` from the linked app folder. Then
|
|
76
|
+
use the test helper to check the changed response on the live app.
|
|
77
|
+
|
|
78
|
+
This example checks that the public `/api/ping` route returns `ready` in its
|
|
79
|
+
`version` field. Save it as `tests/ping.js` and run `node tests/ping.js` from the linked app folder.
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
import assert from 'node:assert/strict';
|
|
83
|
+
import { openTestApp } from '@somewhere-cloud/cli/testing';
|
|
84
|
+
|
|
85
|
+
const app = await openTestApp();
|
|
86
|
+
const response = await app.anonymous.request('/api/ping');
|
|
87
|
+
assert.equal(response.status, 200);
|
|
88
|
+
assert.equal((await response.json()).version, 'ready');
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Before handing over, confirm the full smoke check for the final deploy with
|
|
92
|
+
`somewhere test`.
|
|
93
|
+
|
|
94
|
+
## Saved checks, run by the platform after every deploy
|
|
95
|
+
|
|
96
|
+
Save a journey as `checks/<plain-name>.json` in the app's folder and deploy. After every
|
|
97
|
+
live deploy, Somewhere runs each saved check in its own browser (up to five; nothing to
|
|
98
|
+
install). The result is part of the deploy's one sentence (`access_check` on
|
|
99
|
+
`GET /v1/deploy/log`). `POST /v1/deploy/checks { "project_id": "…" }` runs the check now
|
|
100
|
+
on the live release. A failing check warns; it never stops a deploy.
|
|
101
|
+
|
|
102
|
+
Run `somewhere test` to read the latest smoke check. Add `--again` to start a fresh
|
|
103
|
+
run. The final line is JSON with `outcome` and `counts`. With `--json`, the
|
|
104
|
+
same fields are included in the one-line report.
|
|
105
|
+
|
|
106
|
+
| Exit | Outcome | What you get |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| 0 | `passed` | Checks passed. Warnings leave the exit status unchanged. |
|
|
109
|
+
| 1 | `failed` | A named check failed. Its result gives the actor, what was sent, and what came back. |
|
|
110
|
+
| 2 | `could_not_check` | A check could not finish or cleanup could not be confirmed. The result names test data that may remain. |
|
|
111
|
+
|
|
112
|
+
An access probe that sees another test user's data runs once more as the
|
|
113
|
+
same actor. If the responses disagree, the result says “Inconsistent: tell
|
|
114
|
+
us” and gives the request IDs. The report summarizes what each response
|
|
115
|
+
showed and leaves out row contents and credentials. A crash warning
|
|
116
|
+
identifies a request with a platform-recorded function exception.
|
|
117
|
+
An app function or API route that returns 5xx without a matching error record
|
|
118
|
+
shows its HTTP status and any available request ID.
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{ "actions": [
|
|
122
|
+
{ "fill": "[data-testid=note-title]", "value": "Lunch with Ana 42" },
|
|
123
|
+
{ "click": "[data-testid=note-save]" },
|
|
124
|
+
{ "expect": { "selector": "[data-testid=note-item]", "text": "Lunch with Ana 42" } } ],
|
|
125
|
+
"viewports": ["desktop", "mobile"],
|
|
126
|
+
"signed_in": true }
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- **Format:** the `actions` format `somewhere verify --flow` runs. `viewports` defaults to
|
|
130
|
+
`["desktop"]`.
|
|
131
|
+
- **Who runs it:** `"signed_in": true` runs it as a test user the platform creates and
|
|
132
|
+
removes. Without it, the check runs signed out.
|
|
133
|
+
- **Custom routes.** Saved checks run their steps as written. Use your app's
|
|
134
|
+
own tests to check who can call an endpoint.
|
|
135
|
+
- **Writing it:** give each check one plain name and find controls by `data-testid`, so
|
|
136
|
+
renaming a button does not break it.
|
|
137
|
+
|
|
138
|
+
## Run a schedule on your preview
|
|
139
|
+
|
|
140
|
+
From a folder with an open preview, run `somewhere cron run daily-digest --preview --wait`.
|
|
141
|
+
The handler uses the registered schedule's payload and can change preview data.
|
|
142
|
+
The CLI describes mail, payment and network behavior before starting, then
|
|
143
|
+
reports the job status, duration and IDs. An unknown admission is never retried.
|
|
144
|
+
|
|
145
|
+
Use `somewhere cron run daily-digest --preview --twice` to see repeat behavior.
|
|
146
|
+
It waits for the first run to finish, starts a second, and shows which declared
|
|
147
|
+
table row counts changed after each run. The observations
|
|
148
|
+
can include concurrent preview writes and do not establish retry safety.
|
|
149
|
+
Connector agents can use `cron_run` with both preview IDs and
|
|
150
|
+
`preview_test: "inspect"` for the notice. Show it and pass it as `notice` with
|
|
151
|
+
`preview_test: "run"` to submit once. Inspect with the returned `job_id` for status. Use `row_counts: true`
|
|
152
|
+
on inspections to read counts before admission and after a terminal job.
|
|
153
|
+
|
|
154
|
+
## Test with an ordinary Playwright script
|
|
155
|
+
|
|
156
|
+
Use `openTestApp()` with your own Playwright browser. Pass an actor's
|
|
157
|
+
`storageState()` to the browser context and call `waitForApp(page, 'signed-in')`
|
|
158
|
+
before checking the signed-in UI. To test the sign-up form itself, start with a
|
|
159
|
+
signed-out context and drive the form with Playwright.
|
|
160
|
+
|
|
161
|
+
`openAppTest()` from `@somewhere-cloud/cli/script` supports existing Node test scripts.
|
|
162
|
+
|
|
163
|
+
### Privacy checks that say where a secret leaked
|
|
164
|
+
|
|
165
|
+
Using the test users above, import `assertNoLeak` from
|
|
166
|
+
`@somewhere-cloud/cli/testing`. Choose a writable private text field and a
|
|
167
|
+
route that includes the test row in the member's task list.
|
|
168
|
+
|
|
169
|
+
```js
|
|
170
|
+
const marker = await app.plantMarker(owner, 'tasks', 'private_note', { title: 'Draft' });
|
|
171
|
+
const response = await member.session.request('/api/tasks');
|
|
172
|
+
assert.equal(response.status, 200);
|
|
173
|
+
await assertNoLeak(marker, [response]);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
For a browser page, import `captureResponses` from the same package and set
|
|
177
|
+
`const seen = captureResponses(page)` before navigation. Pass `await seen.all()`
|
|
178
|
+
to `assertNoLeak()` after the responses you want to check have arrived. A failure
|
|
179
|
+
names the response without printing its body.
|
|
180
|
+
|
|
181
|
+
## Run Playwright Test specs with `somewhere test` (optional)
|
|
182
|
+
|
|
183
|
+
The Playwright Test fixtures in `@somewhere-cloud/cli/testing` support existing Playwright Test suites.
|
|
184
|
+
|
|
185
|
+
## Testing access rules
|
|
186
|
+
|
|
187
|
+
To send a data request as an actor, call `actor.session.data(table, request)`.
|
|
188
|
+
It supplies the app's origin and the release's data contract. Read the HTTP
|
|
189
|
+
status and JSON body from the returned `Response`. Scoped reads include
|
|
190
|
+
`access.filtered: true`, including when they return rows.
|
|
191
|
+
|
|
192
|
+
### Prove a refusal
|
|
193
|
+
|
|
194
|
+
Create a fixture the owner can read, then run these checks with an unrelated user.
|
|
195
|
+
|
|
196
|
+
```js
|
|
197
|
+
const id = await app.create(owner, 'notes', { title: 'Draft' });
|
|
198
|
+
await stranger.session.expectRefused('notes', { operation: 'get', id }, { allowed: owner.session });
|
|
199
|
+
await stranger.session.expectRefused('notes', { operation: 'delete', id }, { allowed: owner.session });
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
`allowed` is the positive control. An empty read requires the same read to
|
|
203
|
+
return data for that session. An update or delete returning 404 requires the
|
|
204
|
+
control session to see the same row before and after the attempt. For a custom
|
|
205
|
+
route, pass `'METHOD /path'` and its JSON body, or `undefined` for a GET. A 404
|
|
206
|
+
requires the same call to succeed for the control session. Choose a fixture
|
|
207
|
+
route where a successful control call has safe effects. Malformed requests and
|
|
208
|
+
stale contracts fail the assertion.
|
|
209
|
+
|
|
210
|
+
## Two users sharing through the app
|
|
211
|
+
|
|
212
|
+
Platform-made users are visible to this app's `sw.auth.server.listUsers` by
|
|
213
|
+
email or id. They are verified, so they can also join built-in groups; the
|
|
214
|
+
verified-email requirement still applies. Other projects cannot look them up.
|
|
215
|
+
|
|
216
|
+
The complete team app and its spec are `somewhere docs sw.groups --section team-example`:
|
|
217
|
+
the owner invites test users by email, each one's next groups read shows the
|
|
218
|
+
team, and the spec checks members, outsiders, removal and leaving.
|
|
219
|
+
|
|
220
|
+
Test-user cleanup removes identities, sessions and platform-owned role grants and group memberships; rows in your app’s own tables remain your app’s data and must be removed by your test when needed. A test user who is the only owner of a group is not deleted: an explicit cleanup answers `LAST_OWNER` naming the group, and the automatic 24-hour expiry leaves that user in place. Delete the group (or make another test user its owner) in your test's teardown.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Account tool reference
|
|
2
|
+
|
|
3
|
+
Use the section for the tool and connection in the current workflow. Each tool’s input schema defines the accepted arguments.
|
|
4
|
+
|
|
5
|
+
## connector-link-email
|
|
6
|
+
|
|
7
|
+
Save the current connector session's work to a recoverable account. This requires an email address supplied by the user and sends that address a one-click verification link. Nothing is merged or unlocked until the human clicks: before verification the email remains unverified; afterward the account is saved, or the session is merged into an existing account for that email. Returns { sent: true }. Repeated calls are rate-limited and become a no-op once the account is saved.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Ai tool reference
|
|
2
|
+
|
|
3
|
+
Use the section for the tool and connection in the current workflow. Each tool’s input schema defines the accepted arguments.
|
|
4
|
+
|
|
5
|
+
## ai-complete
|
|
6
|
+
|
|
7
|
+
Call a platform AI model for a project. ai_catalog lists current models and prices; docs({topic:"sw.ai"}) explains the full contract.
|
|
8
|
+
|
|
9
|
+
With neither provider nor model, the call uses free gpt-6-luna: 10 requests/minute and 200/day per project owner on every plan, 8,192 estimated input tokens including system/tools/history, and at most 1,024 output tokens. Standard service, reasoning disabled, 20-second provider deadline including the body. No paid fallback, BYOK charge, or automatic paid repair.
|
|
10
|
+
|
|
11
|
+
Explicit provider/model selection uses that model's normal billing path, including explicitly selecting gpt-6-luna. Included workers-ai models retain their separate limits. ai_catalog lists the valid model IDs.
|
|
12
|
+
|
|
13
|
+
messages is a JSON-stringified array of {role,content}. For text use result.text; result.content contains text/tool_use blocks. With response_schema, the result carries result.parsed and result.parse_error. Paid OpenAI/Anthropic responses may report pending cost: unknown is not zero, and repeating a successful model call does not settle accounting.
|
|
14
|
+
|
|
15
|
+
Tool-capable models accept Anthropic-shaped tool definitions and tool_result messages. A caller-chosen conversation_id together with subject_type and subject_id retains history under that scope; that caller key continues the conversation on later ai_complete calls. ai_conversation_list, ai_conversation_delete, and ai_conversation_fork take the same scope. Later turns send only new messages. History works across supported providers. Free-default overflow truncates history for the request and never runs paid summarization. For larger conversations and explicit paid compaction read docs({topic:"sw.ai"}).
|
|
16
|
+
|
|
17
|
+
Structured output: pass response_schema as a JSON-stringified JSON Schema, without caller tools or streaming.
|
|
18
|
+
|
|
19
|
+
## ai-conversation-list
|
|
20
|
+
|
|
21
|
+
List the saved AI conversations for one subject, or fetch one with its messages. subject_type and subject_id are required so conversation history never falls back to a project-wide view. Without conversation_id it lists (most-recently-updated first; each row includes id, created_at, updated_at, message_count, summarized_message_count, and summary_updated_at). With conversation_id it fetches that single conversation — returns its summary (rolling text from compaction:"summarize", null otherwise), summary_updated_at, and the message log in chronological order. By default a fetch returns only live (non-summarized) messages, matching what the model sees on the next call; include_summarized:true also returns rows folded into the summary.
|
|
22
|
+
|
|
23
|
+
## ai-conversation-fork
|
|
24
|
+
|
|
25
|
+
Branch one subject-owned AI conversation under a new id without losing the original. subject_type and subject_id are required and rechecked against the source row. It backs "regenerate from this point" or "what if I asked differently" UIs. up_to_message_id (the numeric id from ai_conversation_list messages[]) truncates the copy at that message inclusive; omitted, the full history is copied. Returns 404 if the source is missing or belongs to another subject, 409 if the new id is already in use.
|
|
26
|
+
|
|
27
|
+
## ai-embed
|
|
28
|
+
|
|
29
|
+
Need custom semantic similarity, clustering, or recommendation math? ai_embed turns text into vectors you control. For a managed FAQ/catalog/RAG index, search_upsert is the managed path — it embeds and indexes content for you. Returns an array of float vectors. Free via provider:"workers-ai" (bge-base-en-v1.5, bge-large-en-v1.5, bge-small-en-v1.5, qwen3-embedding-0.6b, embeddinggemma-300m). It accepts one string or up to 100 strings. No activation required for free models. Rate limits: Free tier 10/min and 200/day; Builder tier 200/min and 10,000/day.
|
|
30
|
+
|
|
31
|
+
## ai-transcribe
|
|
32
|
+
|
|
33
|
+
**Accepting voice notes, meeting recordings, interviews, or audio uploads?** `ai_transcribe` turns audio into text from base64 bytes or a public URL, returning the transcription, duration, and cost.
|
|
34
|
+
|
|
35
|
+
Rates by plan at /v1/pricing. Activation required: `ai_transcribe`.
|
|
36
|
+
|
|
37
|
+
**Example:**
|
|
38
|
+
|
|
39
|
+
Example transcript or fragment
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
{
|
|
43
|
+
"project_id": "my-saas",
|
|
44
|
+
"audio_url": "https://my-saas.somewhere.site/uploads/recording.mp3"
|
|
45
|
+
}
|
|
46
|
+
// Returns: { "text": "Hello, this is a test recording...", "duration_seconds": 45, "cost": { "total": "$0.000394" } }
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## ai-tts
|
|
50
|
+
|
|
51
|
+
Synthesize speech from text. Returns audio bytes as base64, or saves to a storage path.
|
|
52
|
+
|
|
53
|
+
Without `model`, the free default voice is used — no activation, no bill, nothing to choose.
|
|
54
|
+
|
|
55
|
+
- `inworld-tts-2-flash` (default) — free: 166 English voices by name (default Ashley; e.g. Dennis, Olivia, Duncan). A Kokoro voice id maps to a similar voice. Up to 2,000 chars per call. `word_timings: true` also returns per-word start/end seconds.
|
|
56
|
+
- `hexgrad/Kokoro-82M` — free: 28 English voices by id (default af_bella). Up to 8,000 chars.
|
|
57
|
+
- `ResembleAI/chatterbox-turbo` — free: one built-in voice (no `voice` argument). Up to 8,000 chars.
|
|
58
|
+
|
|
59
|
+
All are free within fair-use limits; ai_catalog lists every voice. A voice whose provider is down returns VOICE_UNAVAILABLE; nothing is substituted.
|
|
60
|
+
|
|
61
|
+
Activation required: `ai_tts`.
|
|
62
|
+
|
|
63
|
+
**Example:**
|
|
64
|
+
|
|
65
|
+
Example transcript or fragment
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
{
|
|
69
|
+
"project_id": "my-saas",
|
|
70
|
+
"voice": "Ashley",
|
|
71
|
+
"text": "Welcome to our app! Let's get started.",
|
|
72
|
+
"storage": "/audio/welcome.mp3"
|
|
73
|
+
}
|
|
74
|
+
// Returns: { "storage_path": "/audio/welcome.mp3", "size_bytes": 40320, "cost": { "total": "$0.00" } }
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## ai-generate-image
|
|
78
|
+
|
|
79
|
+
**Need a hero, product image, social card, thumbnail, or draft visual?** `ai_generate_image` creates it from a text prompt without wiring a separate image provider. Returns image bytes (base64) or a stored path plus cost.
|
|
80
|
+
|
|
81
|
+
Two managed models, priced in `ai_catalog`. Which model: omit `model` for fast, low-cost drafts (`@cf/black-forest-labs/flux-1-schnell`, fixed 1024×1024, billed per tile and step); `gpt-image-2.5-flare` suits final assets, legible text, UI mockups or a transparent background (reserves balance up front; a successful call uses reported token usage capped at that reservation, or the calculator estimate when usage is missing). Failed GPT Image calls return the reservation; an unconfirmed return is reported as `settlement: 'unconfirmed'`. Earlier retired managed models are refused with a message naming the default. For any other model, bring your own provider: store the vendor's key as a project secret and call the vendor from your own function; there is no managed AI charge on that path (the vendor bills you directly; your function's ordinary platform usage still applies).
|
|
82
|
+
|
|
83
|
+
**Inline rendering:** Pass `inline: true` to get the image as an MCP image content block alongside the JSON result. An MCP client that supports image content blocks can render it directly. Default `inline: false` keeps the response lightweight (base64 only when not stored).
|
|
84
|
+
|
|
85
|
+
**Example:**
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"project_id": "my-saas",
|
|
90
|
+
"prompt": "A minimalist logo for a fitness app, clean lines, blue and white",
|
|
91
|
+
"inline": true
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## ai-catalog
|
|
96
|
+
|
|
97
|
+
List every AI model the platform offers — feature, model id, provider, pricing string, and whether it's free for Builders. Paid-model rates vary by plan and are listed at /v1/pricing. It lists what is available before a model is chosen for `ai_complete`, `ai_tts`, `ai_generate_image`, or embeddings.
|
|
98
|
+
|
|
99
|
+
Read-only. No activation needed.
|
|
100
|
+
|
|
101
|
+
**Example:**
|
|
102
|
+
|
|
103
|
+
Example transcript or fragment
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
{}
|
|
107
|
+
// Returns: { "free_tier": { ... }, "markup_rate": 0.05, "models": [{ "feature": "tts", "model": "hexgrad/Kokoro-82M", "provider": "deepinfra", ... }, ...] }
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## ai-usage
|
|
111
|
+
|
|
112
|
+
Return this month's AI spend broken down by feature (transcribe, tts, generate_image, complete). Read-only; no charges.
|
|
113
|
+
|
|
114
|
+
**Example:**
|
|
115
|
+
|
|
116
|
+
Example transcript or fragment
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
{}
|
|
120
|
+
// Returns: { "complete": { "calls": 142, "cost": "$0.23" }, "tts": { "calls": 12, "cost": "$0.003" }, ... }
|
|
121
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Analytics tool reference
|
|
2
|
+
|
|
3
|
+
Use the section for the tool and connection in the current workflow. Each tool’s input schema defines the accepted arguments.
|
|
4
|
+
|
|
5
|
+
## analytics-track
|
|
6
|
+
|
|
7
|
+
**Building anything with users?** `analytics_track` gives the app per-event product analytics with one call. Track the moment a user signs up, starts checkout, purchases, publishes, or completes another product action; `analytics_query` returns it within seconds. Up to 20 numeric properties are automatically aggregatable (sum/avg).
|
|
8
|
+
|
|
9
|
+
**Example:**
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"project_id": "my-saas",
|
|
14
|
+
"event": "purchase_completed",
|
|
15
|
+
"user_id": "u_alice",
|
|
16
|
+
"properties": { "amount": 49.99, "plan": "pro", "source": "landing_page" }
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## analytics-query
|
|
21
|
+
|
|
22
|
+
Query product analytics. Filter by event name and time range; group by hour, day, event, or user. Returns aggregated counts and numeric sums.
|
|
23
|
+
|
|
24
|
+
**Example:**
|
|
25
|
+
|
|
26
|
+
Example transcript or fragment
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
{
|
|
30
|
+
"project_id": "my-saas",
|
|
31
|
+
"event": "purchase_completed",
|
|
32
|
+
"from": "2026-04-01",
|
|
33
|
+
"to": "2026-04-20",
|
|
34
|
+
"group_by": "day"
|
|
35
|
+
}
|
|
36
|
+
// Returns: [{ "date": "2026-04-01", "count": 12, "sum_amount": 587.88 }, ...]
|
|
37
|
+
```
|