@workser/cli 0.6.12 → 0.6.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workser/cli",
3
- "version": "0.6.12",
3
+ "version": "0.6.14",
4
4
  "description": "Workser CLI — give your local AI agent native DevOps & infrastructure on Workser. The agent runs `workser …` to provision, deploy, and manage real apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,7 +30,8 @@ load.
30
30
  | Build an automation, or use Gmail/Slack/Stripe/Sheets | `workflow …`, `app …` | `workser help automation` |
31
31
  | Generate an image | `image …` | `workser help images` |
32
32
  | Hand a subtask to another agent | `agent …` | `workser help roles` |
33
- | Remember or recall something across conversations | `memory …` | `workser help memory` |
33
+ | Ship an AI agent inside the user's app | `cloud-agent …` | `workser help cloud-agents` |
34
+ | Recall across conversations; leave this task's team a fact | `memory …`, `workser note` | `workser help memory` |
34
35
  | Record finished output, or ask the user a question | `artifact …`, `ask` | `workser help deliverables` |
35
36
  | Control this machine — files, shell, screen, browser | `tool …` | `workser help computer-use` |
36
37
 
@@ -43,7 +44,7 @@ come from the CLI itself, so they match the version you are running.
43
44
  workser status # connection + pinned project + latest deploy
44
45
  workser whoami # who am I / which workspace
45
46
  workser project show # the project pinned to this directory
46
- workser project list # the workspace's projects (read)
47
+ workser project list # your organization's projects
47
48
  workser verify # run typecheck/lint/build — gate "done" on this
48
49
  workser doctor # resolved endpoint, mode, token presence, project
49
50
  workser login # authenticate outside Orbit (CI/standalone)
@@ -52,24 +53,25 @@ workser logout # clear a saved standalone session
52
53
 
53
54
  ## Scope (read this)
54
55
 
55
- You operate on **one project's own infrastructure**. You *can* provision and use it:
56
- create the Neon database, read its connection string, browse its tables / rows / run
57
- SQL, provision the bucket + auth, deploy, set env vars, manage files. Sensitive
58
- actions are **gated** — the daemon may return `error.code = "awaiting_approval"`
59
- (exit 5); say so, stop, don't loop (rule 5).
56
+ You operate on **a project's own infrastructure**, and you *can* provision and
57
+ use it: database, bucket, auth, deploys, env vars, files. Sensitive actions are
58
+ **gated** (`awaiting_approval`, exit 5) see rule 5.
60
59
 
61
60
  What you **cannot** do is administer the project set or destroy config:
62
61
  `project create` · `project use` · `env rm` · `domain set` return
63
62
  `error.code = "owner_only"` (exit 6). Tell the user it's an owner action to do in
64
- Orbit, then continue with what you can. The project is already selected; you don't
65
- pick or switch it.
63
+ Orbit, then continue.
64
+
65
+ **One organization.** The folder (or the project open in Workser) sets it. You
66
+ may move between its projects — `--project <id>`, or `cd`. Another org
67
+ returns `error.code = "out_of_scope"` (exit 7) and runs nothing.
66
68
 
67
69
  ## Golden rules
68
70
 
69
71
  1. **Always pass `--json`.** Output is then a single stable line:
70
72
  `{"ok":true,"data":...}` or `{"ok":false,"error":{"code","message",...}}`. Parse it.
71
73
  2. **Orient first.** Run `workser status --json` to see the connection, the pinned
72
- project, and the latest deploy before acting. You don't pick or switch projects.
74
+ project, and the latest deploy before acting.
73
75
  For anything beyond a trivial edit, also read what the project already knows:
74
76
  `workser decision list --json` (what was already decided, so you don't quietly
75
77
  reverse it), and `workser design show --json` before writing UI. This project
@@ -80,10 +82,10 @@ pick or switch it.
80
82
  `doc create`, plus `decision create` for a real tradeoff. A plan in your
81
83
  reply alone is gone when the conversation scrolls. How to correct a wrong
82
84
  row, and what not to link: `workser help sdlc-entities`.
83
- 4. **Stay in your lane.** `error.code = "owner_only"` (exit 6) means the action is
84
- reserved for the owner in Orbit. Don't retry or look for a workaround — tell the
85
- user, then continue. Provisioning the *pinned project's own* db / bucket / auth is
86
- allowed (it may be approval-gated, not owner-only).
85
+ 4. **Stay in your lane.** On `owner_only` (exit 6) or `out_of_scope` (exit 7),
86
+ don't retry or look for a workaround — tell the user, then continue.
87
+ Provisioning the *pinned project's own* db / bucket / auth is allowed (it may
88
+ be approval-gated, not owner-only).
87
89
  5. **Approvals are normal — likely unattended, nobody watching.** An action may
88
90
  return `{"error":{"code":"awaiting_approval"}}` (exit 5). Say so, **stop this
89
91
  turn** — never a retry loop or sleep-and-recheck, it just times out. Works next
@@ -0,0 +1,77 @@
1
+ ---
2
+ topic: cloud-agents
3
+ title: Ship an agent inside the app
4
+ summary: Create an AI agent that runs on Workser and can be called from this project's apps.
5
+ commands: [cloud-agent]
6
+ ---
7
+
8
+ # Ship an agent inside the app
9
+
10
+ `workser cloud-agent` creates an AI agent that runs on **Workser's**
11
+ infrastructure, keeps its own memory and tools, and can be called from the web,
12
+ mobile, API or Python apps in this project.
13
+
14
+ **This is not `workser agent`.** That one hands a subtask to a coding agent on
15
+ this machine — a teammate helping you build. This one is a thing the project
16
+ *ships*: it works for the user after you are gone.
17
+
18
+ ```
19
+ workser cloud-agent list
20
+ workser cloud-agent create "Order desk" --instructions "..."
21
+ workser cloud-agent show <agentId>
22
+ workser cloud-agent run <agentId> "<what to do>"
23
+ workser cloud-agent runs <agentId> # recent runs
24
+ workser cloud-agent runs <runId> # one run, with what it cost
25
+ ```
26
+
27
+ Every call is scoped to the project this folder belongs to.
28
+
29
+ ## When to reach for this
30
+
31
+ When the user describes a job that **keeps happening** and needs judgement:
32
+ "check every order for stock and email me the problems", "read the LINE
33
+ messages and file them", "reconcile these invoices". That is an agent.
34
+
35
+ A one-off transformation is not an agent — write the code. A fixed sequence of
36
+ steps with no judgement in it is not an agent either — that is `workser
37
+ workflow`.
38
+
39
+ ## Calling it from the app you are building
40
+
41
+ Do NOT shell out to the CLI from app code. Use the SDK, which streams:
42
+
43
+ ```ts
44
+ import { workser } from '@workser/app';
45
+
46
+ const run = await workser.agents.run(agentId, { message }, {
47
+ referenceUserId: user.id, // who it is acting for
48
+ });
49
+
50
+ for await (const event of workser.agents.stream(run.id)) {
51
+ // event.type, event.data — forward these to the browser
52
+ }
53
+ ```
54
+
55
+ `stream()` reconnects itself through dropped connections, so the person
56
+ watching sees the agent think. See the `workser-sdk` skill, `reference/agents.md`.
57
+
58
+ ## Things that will bite you
59
+
60
+ 1. **A run costs money by the minute.** It is metered — runtime, workspace, and
61
+ a per-run fee — so a loop that starts agents is a loop that spends. Cancel
62
+ what you abandon: `workser cloud-agent runs <runId>` shows the cost.
63
+
64
+ 2. **Instructions are the product.** The agent does what its instructions say,
65
+ in the user's own words. Write them the way you would brief a new colleague:
66
+ what to do, what to leave alone, when to ask. Vague instructions are the
67
+ single biggest cause of an agent that "doesn't work".
68
+
69
+ 3. **Free plans cannot run agents at all**, and a trial has a small allowance.
70
+ A `402` with `spend_limit_reached` is not a bug — tell the user what it says
71
+ and point them at their plan.
72
+
73
+ 4. **Say who it is for.** An agent acting for one of the app's customers needs
74
+ `referenceUserId`, or its memory and audit trail belong to nobody.
75
+
76
+ 5. **Do not invent an agent the user did not ask for.** Creating one is cheap;
77
+ an agent nobody wanted, quietly costing money per run, is not.