maritime-cli 1.7.0 → 1.8.0

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/AGENTS.md CHANGED
@@ -50,6 +50,16 @@ The failure object is:
50
50
  { "ok": false, "error": { "code": "not_authenticated", "message": "…", "status": 401 } }
51
51
  ```
52
52
 
53
+ `error.code` is the backend's own code whenever it sent one (for example
54
+ `seat_limit` on a billing refusal), otherwise a generic code derived from the
55
+ HTTP status. `error.message` is always the backend's message verbatim.
56
+
57
+ `email_not_verified` (status 403) means the account has not clicked the link
58
+ in its verification email. Deploy, start, restart, key creation and computer
59
+ creation are refused until it does. `error.message` names the address and
60
+ the fix. A human runs `maritime login --resend` to get the link again; the
61
+ token in hand works for everything after the click.
62
+
53
63
  Always read stdout for results and branch on the exit code. Never parse human text.
54
64
 
55
65
  ### Exit codes
@@ -153,8 +163,7 @@ maritime create my-agent \
153
163
  --ram 2048 \ # RAM in MB
154
164
  --cpu 1.5 \ # vCPU cores (fractional OK)
155
165
  --idle 600 \ # auto-sleep 600s after the last request
156
- --disk 20 \ # workspace SSD in GB (clamped to the plan cap)
157
- --max-compute 120 # hard cap: sleep after 120 compute-min / billing period
166
+ --disk 20 # workspace SSD in GB
158
167
  # …or keep it resident:
159
168
  maritime create my-agent --always-on # never auto-sleep (mutually exclusive with --idle)
160
169
  ```
@@ -162,13 +171,13 @@ maritime create my-agent --always-on # never auto-sleep (mutually exclusive wi
162
171
  `--idle`/`--always-on` control how long the agent stays up after a request.
163
172
  This overrides the platform's default serverless idle cap, so an orchestrator
164
173
  that dispatches a long job and waits for a webhook won't be slept out from under
165
- the wait. `--disk` and `--max-compute` are per-agent overrides on top of the
166
- owner's account plan (disk is clamped to the plan's storage cap; the compute cap
167
- auto-sleeps the agent for the rest of the billing period when hit).
174
+ the wait. Every agent includes 2 GB RAM and 5 GB SSD; `--ram` above 2048,
175
+ `--disk` above 5, and `--always-on` are paid add-ons, so on the free plan they
176
+ come back as a `402` telling you to upgrade (see Billing refusals below).
168
177
  `status <agent> --json` echoes `memMb`, `vcpus`, `idleTtlSeconds`
169
- (`0` = always-on, `null` = platform default), `diskMb`, and `computeMinutesLimit`.
178
+ (`0` = always-on, `null` = platform default) and `diskMb`.
170
179
 
171
- ## Fleets: `create --count`
180
+ ## Batches: `create --count`
172
181
 
173
182
  `maritime create <name> --count <n>` (n = 2-50) spins up **n identical agents**
174
183
  in a single call. `<name>` becomes the prefix, so agents are named
@@ -181,11 +190,11 @@ maritime create swarm --template openclaw --count 5 --idle 3600 --json
181
190
 
182
191
  Flags supported alongside `--count > 1`: `--template`,
183
192
  `--idle`/`--always-on`, `--repo`, and `-e/--env` (applied to every agent).
184
- In the fleet path `--idle 0` means always-on (same as `--always-on`).
193
+ In the batch path `--idle 0` means always-on (same as `--always-on`).
185
194
  Any other `create` flag (`--branch`, `--public`, `--port`, `--framework`,
186
- `--ram`, `--cpu`, `--disk`, `--max-compute`) combined with `--count > 1` is a
187
- usage error (exit `4`); nothing is silently dropped. `--count` above 50 is
188
- also exit `4`; the 50-agent cap is enforced server-side too.
195
+ `--ram`, `--cpu`, `--disk`) combined with `--count > 1` is a usage error
196
+ (exit `4`); nothing is silently dropped. `--count` above 50 is also exit `4`;
197
+ the 50-agent cap is enforced server-side too.
189
198
 
190
199
  Success shape (`--json`, the backend response verbatim):
191
200
 
@@ -193,25 +202,45 @@ Success shape (`--json`, the backend response verbatim):
193
202
  {
194
203
  "created": [{ "id": "…", "name": "swarm-1", "status": "deploying" }],
195
204
  "failed": [{ "name": "swarm-3", "error": "…" }],
196
- "requested": 5,
197
- "monthlyCostCents": 500
205
+ "requested": 5
198
206
  }
199
207
  ```
200
208
 
201
209
  Exit codes: `0` = **all** requested agents created (`failed` empty);
202
- `1` = partial or none, so inspect `created`/`failed` on stdout. Billing/limit
210
+ `1` = partial or none, so inspect `created`/`failed` on stdout. Limit
203
211
  rejections surface as the standard error object on stderr with exit `1`:
204
- `402` → `error.code = "insufficient_balance"` (each agent bills $1/mo from the
205
- wallet; n agents need n×$1 available), `403` → `error.code =
206
- "fleet_cap_exceeded"`.
212
+ `402` → `error.code = "seat_limit"` (your plan's agent cap; see Billing
213
+ refusals below), `403` → `error.code = "fleet_cap_exceeded"` (the 50-agent
214
+ per-call cap).
207
215
 
208
216
  ```bash
209
- # Recipe: spin up a 5-agent fleet, then fan a message out to every member
217
+ # Recipe: spin up 5 agents, then fan a message out to every one of them
210
218
  maritime create swarm --template openclaw --count 5 --idle 3600 --json \
211
219
  | jq -r '.created[].name' \
212
220
  | xargs -I{} maritime chat {} "introduce yourself" --json
213
221
  ```
214
222
 
223
+ ## Billing refusals (`402`)
224
+
225
+ Your plan sets how many agents you may have (the free plan includes 3) and
226
+ whether you can use the paid add-ons (extra RAM, extra SSD, always-on). When a
227
+ create is refused for a billing reason, the CLI exits `1` and writes the
228
+ standard error object with `error.status = 402` and the server's own
229
+ `error.code`, usually `"seat_limit"`.
230
+
231
+ **`error.message` is the server's sentence, verbatim.** It already names the
232
+ fix and carries the link, for example:
233
+
234
+ ```json
235
+ { "ok": false, "error": { "code": "seat_limit", "status": 402,
236
+ "message": "You are on the free plan, which includes 3 agents (you have 3). Delete an agent you no longer need, or upgrade to a paid plan to create more: https://maritime.sh/billing" } }
237
+ ```
238
+
239
+ Show that message to your user unchanged rather than writing your own reason:
240
+ the same code covers several distinct gates (plan agent cap, add-ons needing a
241
+ paid plan, a lapsed plan, an identity agent needing your own `INKBOX_API_KEY`)
242
+ and only the message tells them which one they hit.
243
+
215
244
  ## Environment variables
216
245
 
217
246
  Values are secret (encrypted) by default. Env changes apply on the next
@@ -246,7 +275,7 @@ Observe: `status`, `logs`
246
275
 
247
276
  Advanced / ops (hidden from `--help`, still fully supported): `start`, `stop`,
248
277
  `restart`, `sleep`, `exec <agent> <cmd...>`, `info`, `history`,
249
- `triggers`, `blueprint`, `templates`. You rarely need these: lifecycle is
278
+ `triggers`, `templates`. You rarely need these: lifecycle is
250
279
  automatic (idle-sleep + auto-wake on `chat`).
251
280
 
252
281
  Run `maritime <cmd> --help` for flags. Every command accepts the global
package/dist/api.d.ts CHANGED
@@ -2,7 +2,11 @@ type JsonRecord = Record<string, unknown>;
2
2
  export declare class CliHttpError extends Error {
3
3
  status: number;
4
4
  detail: string;
5
- constructor(status: number, detail: string);
5
+ /** Machine-readable error code from the server when present, e.g.
6
+ * 'seat_limit' when the account hit its plan's agent cap, needs a paid
7
+ * plan for an add-on, or has a lapsed plan. */
8
+ code?: string;
9
+ constructor(status: number, detail: string, code?: string);
6
10
  }
7
11
  export interface CliUser {
8
12
  id: string;
package/dist/api.js CHANGED
@@ -4,10 +4,15 @@ import { fail, EXIT } from './output.js';
4
4
  export class CliHttpError extends Error {
5
5
  status;
6
6
  detail;
7
- constructor(status, detail) {
7
+ /** Machine-readable error code from the server when present, e.g.
8
+ * 'seat_limit' when the account hit its plan's agent cap, needs a paid
9
+ * plan for an add-on, or has a lapsed plan. */
10
+ code;
11
+ constructor(status, detail, code) {
8
12
  super(detail);
9
13
  this.status = status;
10
14
  this.detail = detail;
15
+ this.code = code;
11
16
  }
12
17
  }
13
18
  function isErrorWithMessage(error) {
@@ -77,7 +82,7 @@ async function maybeRefreshToken(token) {
77
82
  }
78
83
  }
79
84
  catch {
80
- // Refresh failed silently — continue with current token
85
+ // Refresh failed silently, continue with current token
81
86
  }
82
87
  return token;
83
88
  }
@@ -138,7 +143,8 @@ async function handleResponse(response) {
138
143
  const detail = typeof payload.detail === 'string'
139
144
  ? payload.detail
140
145
  : `Request failed with status ${response.status}`;
141
- throw new CliHttpError(response.status, detail);
146
+ const code = typeof payload.code === 'string' ? payload.code : undefined;
147
+ throw new CliHttpError(response.status, detail, code);
142
148
  }
143
149
  return payload;
144
150
  }
@@ -3,11 +3,7 @@ import chalk from 'chalk';
3
3
  import { authGet, authPost, CliHttpError } from '../api.js';
4
4
  import { promptForValue } from '../prompt.js';
5
5
  import { isJsonMode, outputResult, fail, handleError, makeSpinner, EXIT } from '../output.js';
6
- const FLEET_CAP = 50;
7
- /** Format integer cents as a dollar string ($5 or $7.50). */
8
- function formatDollars(cents) {
9
- return cents % 100 === 0 ? `$${cents / 100}` : `$${(cents / 100).toFixed(2)}`;
10
- }
6
+ const BATCH_CAP = 50;
11
7
  function parseEnvPairs(pairs) {
12
8
  return pairs.map((pair) => {
13
9
  const eqIdx = pair.indexOf('=');
@@ -29,35 +25,34 @@ export const createCommand = new Command('create')
29
25
  .argument('[name]', 'Agent name')
30
26
  .option('-t, --template <template>', 'Template to base the agent on (see `maritime templates`)')
31
27
  .option('-e, --env <pairs...>', 'Environment variables (KEY=value)')
32
- .option('--count <n>', 'Spin up N identical agents in one call (fleet). Names become <name>-1..<name>-N')
28
+ .option('--count <n>', 'Spin up N identical agents in one call. Names become <name>-1..<name>-N')
33
29
  .option('-r, --repo <url>', 'Deploy from a GitHub repo (must contain a Dockerfile)')
34
30
  .option('-b, --branch <branch>', 'Git branch to deploy (with --repo)')
35
31
  .option('--public', 'Serve a public, no-login web URL for this agent (web apps)')
36
32
  .option('--port <n>', 'Port your app listens on (exposed publicly; default 8080)')
37
- // Advanced overrides — kept fully working but off the main --help so the
33
+ // Advanced overrides, kept fully working but off the main --help so the
38
34
  // happy path stays flag-free. By default the platform picks the applicable
39
35
  // size for the framework and auto-sleeps when idle; you only reach for these
40
36
  // to hand-tune a specific agent (e.g. a reseller dialing RAM per client).
41
37
  .addOption(new Option('-n, --name <name>', 'Agent name (alias for the positional argument)').hideHelp())
42
38
  .addOption(new Option('--framework <framework>', 'Framework (default: custom)').hideHelp())
43
- .addOption(new Option('--ram <mb>', 'RAM in MB (per-agent override of the default)').hideHelp())
39
+ .addOption(new Option('--ram <mb>', 'RAM in MB (2048 included; above that is a paid add-on)').hideHelp())
44
40
  .addOption(new Option('--cpu <cores>', 'vCPU cores, e.g. 0.5 or 2 (per-agent override)').hideHelp())
45
41
  .addOption(new Option('--idle <seconds>', 'Auto-sleep this many seconds after the last request').hideHelp())
46
- .addOption(new Option('--always-on', 'Never auto-sleep (mutually exclusive with --idle)').hideHelp())
47
- .addOption(new Option('--disk <gb>', 'Workspace SSD size in GB (per-agent override)').hideHelp())
48
- .addOption(new Option('--max-compute <minutes>', 'Hard cap: auto-sleep after N compute-minutes per billing period').hideHelp())
42
+ .addOption(new Option('--always-on', 'Never auto-sleep (a paid add-on; mutually exclusive with --idle)').hideHelp())
43
+ .addOption(new Option('--disk <gb>', 'Workspace SSD size in GB (5 included; above that is a paid add-on)').hideHelp())
49
44
  .addHelpText('after', `
50
45
  Examples:
51
46
  maritime create researcher
52
47
  maritime create acme-bot --template openclaw --json
53
48
  maritime create my-app --repo https://github.com/you/app --public # public web agent
54
49
  maritime create client-x -e OPENAI_API_KEY=sk-...
55
- maritime create swarm --template openclaw --count 5 # fleet: swarm-1..swarm-5`)
50
+ maritime create swarm --template openclaw --count 5 # swarm-1..swarm-5`)
56
51
  .action(async (nameArg, opts) => {
57
52
  try {
58
53
  let name = nameArg || opts.name;
59
54
  let templateId = opts.template;
60
- // --count: fleet spin-up. 1 (default) = the classic single-agent path.
55
+ // --count: batch spin-up. 1 (default) = the classic single-agent path.
61
56
  let count = 1;
62
57
  if (opts.count !== undefined) {
63
58
  const n = Number(opts.count);
@@ -67,8 +62,8 @@ Examples:
67
62
  exitCode: EXIT.USAGE,
68
63
  });
69
64
  }
70
- if (n > FLEET_CAP) {
71
- fail('Fleet spin-ups are capped at 50 agents. Contact us if you need more. We keep the cap to protect shared server capacity.', { code: 'usage', exitCode: EXIT.USAGE });
65
+ if (n > BATCH_CAP) {
66
+ fail('Batch creates are capped at 50 agents. Contact us if you need more. We keep the cap to protect shared server capacity.', { code: 'usage', exitCode: EXIT.USAGE });
72
67
  }
73
68
  count = n;
74
69
  }
@@ -107,10 +102,10 @@ Examples:
107
102
  // Templates fetch failed; continue without template
108
103
  }
109
104
  }
110
- // ── Fleet path (--count > 1): one POST /api/fleet/batch call ──
105
+ // ── Batch path (--count > 1): one POST /api/fleet/batch call ──
111
106
  if (count > 1) {
112
107
  // The batch endpoint only understands a subset of create's flags.
113
- // Anything it can't honor is a hard usage error — never silently dropped.
108
+ // Anything it can't honor is a hard usage error, never silently dropped.
114
109
  const unsupported = [];
115
110
  if (opts.branch !== undefined)
116
111
  unsupported.push('--branch');
@@ -126,11 +121,9 @@ Examples:
126
121
  unsupported.push('--cpu');
127
122
  if (opts.disk !== undefined)
128
123
  unsupported.push('--disk');
129
- if (opts.maxCompute !== undefined)
130
- unsupported.push('--max-compute');
131
124
  if (unsupported.length > 0) {
132
125
  fail(`${unsupported.join(', ')} cannot be combined with --count > 1. ` +
133
- 'Fleet spin-ups support --template, --idle/--always-on, --repo, and -e/--env.', { code: 'usage', exitCode: EXIT.USAGE });
126
+ 'Batch creates support --template, --idle/--always-on, --repo, and -e/--env.', { code: 'usage', exitCode: EXIT.USAGE });
134
127
  }
135
128
  if (opts.alwaysOn && opts.idle !== undefined) {
136
129
  fail('--always-on and --idle are mutually exclusive.', { code: 'usage', exitCode: EXIT.USAGE });
@@ -155,19 +148,21 @@ Examples:
155
148
  }
156
149
  batchBody.idleTtlSeconds = secs; // 0 = always-on
157
150
  }
158
- const spinner = await makeSpinner(`Creating fleet ${chalk.bold(name)} × ${count}...`);
151
+ const spinner = await makeSpinner(`Creating ${chalk.bold(name)} × ${count}...`);
159
152
  let result;
160
153
  try {
161
154
  result = await authPost('/api/fleet/batch', batchBody);
162
155
  }
163
156
  catch (error) {
164
- spinner.fail('Failed to create fleet');
157
+ spinner.fail('Failed to create agents');
165
158
  if (error instanceof CliHttpError && (error.status === 402 || error.status === 403)) {
166
- // 402 = wallet can't cover count × $1/mo; 403 = server-enforced cap.
167
- // Both are request failures, not auth failures → exit 1.
159
+ // 402 = the plan's agent cap (code seat_limit); the server's detail
160
+ // is already a complete sentence naming the fix and the billing
161
+ // link, so print it verbatim. 403 = the server-enforced batch cap.
162
+ // Both are request failures, not auth failures, so exit 1.
168
163
  fail(error.detail, {
169
164
  status: error.status,
170
- code: error.status === 402 ? 'insufficient_balance' : 'fleet_cap_exceeded',
165
+ code: error.code ?? (error.status === 402 ? 'seat_limit' : 'fleet_cap_exceeded'),
171
166
  exitCode: EXIT.ERROR,
172
167
  });
173
168
  }
@@ -199,10 +194,7 @@ Examples:
199
194
  console.log(' ' + chalk.bold(f.name.padEnd(24)) + chalk.red(f.error));
200
195
  }
201
196
  }
202
- console.log('\n ' +
203
- `${result.created.length}/${result.requested} created` +
204
- chalk.dim(' · ') +
205
- `${formatDollars(result.monthlyCostCents)}/mo`);
197
+ console.log('\n ' + `${result.created.length}/${result.requested} created`);
206
198
  console.log();
207
199
  });
208
200
  // Exit contract: 0 = all created, 1 = partial or none.
@@ -217,8 +209,14 @@ Examples:
217
209
  body.framework = opts.framework;
218
210
  if (opts.env)
219
211
  body.initialEnvVars = parseEnvPairs(opts.env);
220
- if (opts.repo)
212
+ if (opts.repo) {
221
213
  body.githubRepo = opts.repo;
214
+ // Source builds need a chance to identify their runtime before boot.
215
+ // This preserves an explicit framework or template, while allowing an
216
+ // OpenClaw repository to receive its required gateway credential.
217
+ if (!templateId && !opts.framework)
218
+ body.framework = 'auto';
219
+ }
222
220
  if (opts.branch)
223
221
  body.branch = opts.branch;
224
222
  if (opts.public) {
@@ -266,13 +264,6 @@ Examples:
266
264
  }
267
265
  body.diskGb = gb;
268
266
  }
269
- if (opts.maxCompute !== undefined) {
270
- const mins = Number(opts.maxCompute);
271
- if (!Number.isFinite(mins) || mins <= 0) {
272
- fail('--max-compute must be a positive number of minutes.', { code: 'usage', exitCode: 4 });
273
- }
274
- body.computeMinutesLimit = mins;
275
- }
276
267
  const spinner = await makeSpinner(`Creating agent ${chalk.bold(name)}...`);
277
268
  let agent;
278
269
  try {
@@ -280,6 +271,18 @@ Examples:
280
271
  }
281
272
  catch (error) {
282
273
  spinner.fail('Failed to create agent');
274
+ if (error instanceof CliHttpError && error.status === 402) {
275
+ // Billing gate, not a crash. The server's detail is already a
276
+ // complete user-ready sentence naming the fix (e.g. the free plan
277
+ // includes 3 agents: delete one or upgrade) and carrying
278
+ // https://maritime.sh/billing, so print it verbatim rather than
279
+ // guessing at a reason here.
280
+ fail(error.detail, {
281
+ status: 402,
282
+ code: error.code ?? 'payment_required',
283
+ exitCode: EXIT.ERROR,
284
+ });
285
+ }
283
286
  throw error;
284
287
  }
285
288
  spinner.succeed(chalk.green('Created ') + chalk.bold(agent.name) + chalk.dim(` (${agent.id})`));
@@ -295,8 +298,6 @@ Examples:
295
298
  }
296
299
  if (agent.diskMb)
297
300
  res.push(`disk ${(agent.diskMb / 1024).toFixed(1)}GB`);
298
- if (agent.computeMinutesLimit)
299
- res.push(`cap ${agent.computeMinutesLimit}min`);
300
301
  if (res.length)
301
302
  console.log(chalk.dim(` Resources: ${res.join(' | ')}`));
302
303
  if (agent.publicUrl)
@@ -47,16 +47,21 @@ function parseDotenv(text) {
47
47
  async function uploadVars(agentId, pairs, isSecret) {
48
48
  const uploaded = [];
49
49
  const failed = [];
50
+ // The backend warns when a deploy is mid-flight: that boot reads env at
51
+ // container start and may miss these values. One warning covers the batch.
52
+ let warning = null;
50
53
  for (const { key, value } of pairs) {
51
54
  try {
52
- await authPost(`/api/agents/${agentId}/env`, { key, value, is_secret: isSecret });
55
+ const resp = await authPost(`/api/agents/${agentId}/env`, { key, value, is_secret: isSecret });
56
+ if (resp?.warning)
57
+ warning = resp.warning;
53
58
  uploaded.push(key);
54
59
  }
55
60
  catch (error) {
56
61
  failed.push({ key, error: error instanceof Error ? error.message : String(error) });
57
62
  }
58
63
  }
59
- return { uploaded, failed };
64
+ return { uploaded, failed, warning };
60
65
  }
61
66
  /** Hot-reload env into the running container (falls back to restart server-side). */
62
67
  async function reloadEnv(agentId) {
@@ -126,7 +131,7 @@ envCommand
126
131
  const pairs = pairTokens.map(parsePair);
127
132
  const agent = await resolveAgent(target);
128
133
  const spinner = await makeSpinner(`Setting ${pairs.length} var${pairs.length === 1 ? '' : 's'} for ${agent.name}...`);
129
- const { uploaded, failed } = await uploadVars(agent.id, pairs, opts.secret);
134
+ const { uploaded, failed, warning } = await uploadVars(agent.id, pairs, opts.secret);
130
135
  let reloaded = false;
131
136
  if (opts.reload && uploaded.length > 0) {
132
137
  try {
@@ -141,9 +146,11 @@ envCommand
141
146
  spinner.fail(`Set ${uploaded.length}, failed ${failed.length}`);
142
147
  else
143
148
  spinner.succeed(`Set ${uploaded.length} var${uploaded.length === 1 ? '' : 's'} for ${chalk.bold(agent.name)}`);
144
- outputResult({ ok: failed.length === 0, agentId: agent.id, uploaded, failed, reloaded }, () => {
149
+ outputResult({ ok: failed.length === 0, agentId: agent.id, uploaded, failed, reloaded, warning }, () => {
145
150
  for (const f of failed)
146
151
  console.error(chalk.red(` ${f.key}: ${f.error}`));
152
+ if (warning)
153
+ console.log(chalk.yellow(` ${warning}`));
147
154
  if (reloaded)
148
155
  console.log(chalk.dim(' Reloaded into running container.'));
149
156
  else if (opts.reload)
@@ -205,7 +212,7 @@ envCommand
205
212
  }
206
213
  const agent = await resolveAgent(target);
207
214
  const spinner = await makeSpinner(`Importing ${pairs.length} vars into ${agent.name}...`);
208
- const { uploaded, failed } = await uploadVars(agent.id, pairs, !opts.plain);
215
+ const { uploaded, failed, warning } = await uploadVars(agent.id, pairs, !opts.plain);
209
216
  let reloaded = false;
210
217
  if (opts.reload && uploaded.length > 0) {
211
218
  try {
@@ -220,9 +227,11 @@ envCommand
220
227
  spinner.fail(`Imported ${uploaded.length}, failed ${failed.length}`);
221
228
  else
222
229
  spinner.succeed(`Imported ${uploaded.length} vars into ${chalk.bold(agent.name)}`);
223
- outputResult({ ok: failed.length === 0, agentId: agent.id, uploaded, failed, reloaded }, () => {
230
+ outputResult({ ok: failed.length === 0, agentId: agent.id, uploaded, failed, reloaded, warning }, () => {
224
231
  for (const f of failed)
225
232
  console.error(chalk.red(` ${f.key}: ${f.error}`));
233
+ if (warning)
234
+ console.log(chalk.yellow(` ${warning}`));
226
235
  if (reloaded)
227
236
  console.log(chalk.dim(' Reloaded into running container.'));
228
237
  else if (opts.reload)
@@ -13,9 +13,10 @@ const CONTRACT = {
13
13
  auth: 'Set the MARITIME_TOKEN env var to a long-lived API key (mk_…, minted via `maritime keys create`) or a login JWT. The CLI reads it before anything else; never run interactive login in automation.',
14
14
  json: 'Pass --json on every command. Success → one JSON value on stdout, stderr empty. Failure → one JSON object {ok:false,error:{code,message,status?}} on stderr, stdout empty.',
15
15
  exitCodes: { '0': 'ok', '1': 'error', '2': 'auth', '3': 'not_found', '4': 'usage' },
16
+ billing: 'A plan sets how many machines you may have (the free plan includes 3). A machine is one micro-VM: an agent is a machine and so is a Computer, and both draw on the same count. When a create is refused for a billing reason the CLI exits 1 with error.status 402 and error.code from the server, usually seat_limit. error.message is the server sentence verbatim: it already names the fix (delete an agent, upgrade, renew a lapsed plan, or add your own INKBOX_API_KEY) and carries https://maritime.sh/billing. Surface it to your user unchanged instead of writing your own reason.',
16
17
  interaction: 'Talk to a deployed agent with `maritime chat <agent> <message>` (or pipe the message via stdin). Returns the reply text (or {response} under --json). Sleeping serverless agents auto-wake. To message AS one of YOUR end-users (sticky per-user agents via the project front door), use `maritime message <agent> --user <externalUserId> <message>`; status:replied carries .reply inline; provisioning/queued means the reply arrives via the message.reply webhook.',
17
- resources: 'create accepts per-agent overrides: --ram <mb>, --cpu <cores>, --idle <seconds> | --always-on, --disk <gb>, --max-compute <minutes>. Omitted = platform defaults.',
18
- fleet: 'create --count <n> (2-50) spins up n identical agents named <name>-1..<name>-n in one call. Supported alongside --count: --template, --idle/--always-on, --repo, -e/--env; other create flags exit 4. --json returns {created:[{id,name,status}],failed:[{name,error}],requested,monthlyCostCents}. Exit 0 = all created, 1 = partial/none (402 insufficient wallet balance, 403 over the 50-agent cap → exit 1).',
18
+ resources: 'create accepts per-agent overrides: --ram <mb>, --cpu <cores>, --idle <seconds> | --always-on, --disk <gb>. Omitted = platform defaults. Above the included 2 GB RAM / 5 GB SSD, and for --always-on, these are paid add-ons that need a plan; the 402 below says so.',
19
+ fleet: 'create --count <n> (2-50) spins up n identical agents named <name>-1..<name>-n in one call. Supported alongside --count: --template, --idle/--always-on, --repo, -e/--env; other create flags exit 4. --json returns {created:[{id,name,status}],failed:[{name,error}],requested}. Exit 0 = all created, 1 = partial/none. A 402 means a billing gate closed (error.code seat_limit): error.message is the complete server sentence naming the fix and the https://maritime.sh/billing link, so show it as-is. 403 over the 50-agent cap also exits 1.',
19
20
  project: 'A directory can be linked to an agent (like vercel/railway). `maritime init <name>` scaffolds maritime.json + AGENTS.md and links it; `maritime link <agent>` links an existing one; `maritime deploy` reconciles the agent to maritime.json. Once linked, the <agent> argument is optional on every command (resolved from .maritime/project.json, walking up from cwd).',
20
21
  apiBase: 'Override the API base with MARITIME_API_URL (default https://api.maritime.sh).',
21
22
  };
@@ -81,5 +82,6 @@ export const guideCommand = new Command('guide')
81
82
  console.log(` JSON: ${CONTRACT.json}`);
82
83
  console.log(` Chat: ${CONTRACT.interaction}`);
83
84
  console.log(` Limits: ${CONTRACT.resources}`);
85
+ console.log(` Billing: ${CONTRACT.billing}`);
84
86
  console.log('\n Run `maritime guide --json` for the full structured manifest.');
85
87
  });
@@ -30,6 +30,11 @@ export const infoCommand = new Command('info')
30
30
  const rows = [
31
31
  ['ID', chalk.dim(agent.id)],
32
32
  ['Status', statusColor(agent.status)],
33
+ [
34
+ 'Sleep',
35
+ agent.sleepPolicy ??
36
+ (agent.idleTtlSeconds != null && agent.idleTtlSeconds <= 0 ? 'always-on' : 'auto-sleep'),
37
+ ],
33
38
  ['Framework', agent.framework],
34
39
  ['Created', agent.createdAt ? new Date(agent.createdAt).toLocaleString() : 'n/a'],
35
40
  ];
@@ -2,6 +2,11 @@ import { Command } from 'commander';
2
2
  import chalk from 'chalk';
3
3
  import { authGet } from '../api.js';
4
4
  import { isJsonMode, outputJson, handleError } from '../output.js';
5
+ function sleepPolicyOf(a) {
6
+ if (a.sleepPolicy)
7
+ return a.sleepPolicy;
8
+ return a.idleTtlSeconds != null && a.idleTtlSeconds <= 0 ? 'always-on' : 'auto-sleep';
9
+ }
5
10
  const statusColors = {
6
11
  active: chalk.green,
7
12
  sleeping: chalk.blue,
@@ -26,9 +31,10 @@ export const listCommand = new Command('list')
26
31
  console.log('\n ' +
27
32
  chalk.dim('NAME'.padEnd(24)) +
28
33
  chalk.dim('STATUS'.padEnd(12)) +
34
+ chalk.dim('SLEEP'.padEnd(12)) +
29
35
  chalk.dim('FRAMEWORK'.padEnd(20)) +
30
36
  chalk.dim('CREATED'));
31
- console.log(chalk.dim(' ' + '\u2500'.repeat(80)));
37
+ console.log(chalk.dim(' ' + '\u2500'.repeat(88)));
32
38
  for (const a of agents) {
33
39
  const colorFn = statusColors[a.status] || chalk.white;
34
40
  const created = a.createdAt ? new Date(a.createdAt).toLocaleDateString() : '';
@@ -37,6 +43,7 @@ export const listCommand = new Command('list')
37
43
  console.log(' ' +
38
44
  chalk.bold(name.padEnd(24)) +
39
45
  colorFn(a.status.padEnd(12)) +
46
+ sleepPolicyOf(a).padEnd(12) +
40
47
  fw.padEnd(20) +
41
48
  chalk.dim(created));
42
49
  }
@@ -5,7 +5,7 @@ import chalk from 'chalk';
5
5
  import open from 'open';
6
6
  import { config } from '../config.js';
7
7
  import { CliHttpError, getApiUrl, postJson } from '../api.js';
8
- import { makeSpinner } from '../output.js';
8
+ import { EXIT, fail, handleError, makeSpinner, outputResult } from '../output.js';
9
9
  import { promptForPassword, promptForValue } from '../prompt.js';
10
10
  const APP_URL = process.env.MARITIME_APP_URL || 'https://maritime.sh';
11
11
  const TIMEOUT_MS = 120_000;
@@ -75,12 +75,41 @@ function browserLogin() {
75
75
  });
76
76
  });
77
77
  }
78
+ /**
79
+ * Asks the server to send the email verification link again.
80
+ *
81
+ * The server always answers ok, also for an address with no account or an
82
+ * address that is already verified, so "Sent" does not confirm an account.
83
+ *
84
+ * @param emailFlag The value of `-e`. When absent, the email of the stored login is used.
85
+ */
86
+ async function resendVerification(emailFlag) {
87
+ const email = (emailFlag ?? config.get('user') ?? '').trim();
88
+ if (!email) {
89
+ fail('No email to send to. Run `maritime login --resend -e <email>`.', {
90
+ code: 'email_required',
91
+ exitCode: EXIT.USAGE,
92
+ });
93
+ }
94
+ try {
95
+ await postJson('/api/auth/resend-verification', { email });
96
+ }
97
+ catch (error) {
98
+ handleError(error);
99
+ }
100
+ outputResult({ ok: true, action: 'resend_verification', email }, `Sent. Check ${email}.`);
101
+ }
78
102
  export const loginCommand = new Command('login')
79
103
  .description('Authenticate with Maritime')
80
104
  .option('-e, --email <email>', 'Email address (for non-interactive login)')
81
105
  .option('-p, --password <password>', 'Password (for non-interactive login)')
82
106
  .option('-t, --token <token>', `Paste a token from ${APP_URL}/cli/auth (works for SSO / headless / CI)`)
107
+ .option('--resend', 'Send the email verification link again (uses -e, else the logged-in email)')
83
108
  .action(async (opts) => {
109
+ if (opts.resend) {
110
+ await resendVerification(opts.email);
111
+ return;
112
+ }
84
113
  // 1. Token paste — the universal path. Works for any account, including
85
114
  // OAuth-only (Google/GitHub) users who have no password to type.
86
115
  // Generate one at <app>/cli/auth.
@@ -30,7 +30,8 @@ export const signupCommand = new Command('signup')
30
30
  config.set('userId', auth.user.id);
31
31
  config.set('apiUrl', process.env.MARITIME_API_URL || 'https://api.maritime.sh');
32
32
  spinner.succeed(chalk.green('Authenticated as ') + chalk.bold(auth.user.email));
33
- console.log(chalk.dim('\nToken saved. You can now deploy agents.'));
33
+ console.log(chalk.dim('\nToken saved.'));
34
+ console.log(`Verify your email to deploy: we sent a link to ${auth.user.email}.`);
34
35
  }
35
36
  catch (error) {
36
37
  spinner.fail('Signup failed');
@@ -32,9 +32,6 @@ export const statusCommand = new Command('status')
32
32
  const idle = agent.idleTtlSeconds <= 0 ? 'always-on' : `${agent.idleTtlSeconds}s after request`;
33
33
  console.log(` ${'Idle:'.padEnd(16)} ${idle}`);
34
34
  }
35
- if (agent.computeMinutesLimit) {
36
- console.log(` ${'Compute cap:'.padEnd(16)} ${agent.computeMinutesLimit} min / period`);
37
- }
38
35
  console.log(` ${'ID:'.padEnd(16)} ${chalk.dim(agent.id)}`);
39
36
  if (agent.invocationCount !== undefined) {
40
37
  console.log(` ${'Invocations:'.padEnd(16)} ${agent.invocationCount}`);
@@ -39,14 +39,24 @@ const triggerListCmd = new Command('list')
39
39
  const triggerCreateCmd = new Command('create')
40
40
  .description('Create a trigger for an agent')
41
41
  .argument('<agent>', 'Agent name or ID')
42
- .requiredOption('--type <type>', 'Trigger type (webhook, cron, email)')
42
+ .requiredOption('--type <type>', 'Trigger type (webhook, cron, telegram, discord)')
43
43
  .option('--cron <expression>', 'Cron expression (for cron triggers)')
44
+ .option('--prompt <text>', 'Message delivered to the agent on each fire (cron triggers only, max 2000 chars)')
44
45
  .action(async (agentArg, opts) => {
45
46
  try {
47
+ if (opts.prompt !== undefined && opts.type !== 'cron') {
48
+ handleError(new Error('--prompt applies to cron triggers only'));
49
+ return;
50
+ }
46
51
  const agent = await resolveAgent(agentArg);
47
52
  const body = { type: opts.type };
53
+ const config = {};
48
54
  if (opts.cron)
49
- body.config = { cron: opts.cron };
55
+ config.cron = opts.cron;
56
+ if (opts.prompt)
57
+ config.prompt = opts.prompt;
58
+ if (Object.keys(config).length > 0)
59
+ body.config = config;
50
60
  const trigger = await authPost(`/api/agents/${agent.id}/triggers`, body);
51
61
  if (isJsonMode()) {
52
62
  outputJson(trigger);
package/dist/index.js CHANGED
@@ -27,7 +27,6 @@ import { chatCommand } from './commands/chat.js';
27
27
  import { messageCommand } from './commands/message.js';
28
28
  import { historyCommand } from './commands/history.js';
29
29
  import { triggersCommand } from './commands/triggers.js';
30
- import { blueprintCommand } from './commands/blueprint.js';
31
30
  import { sleepCommand } from './commands/sleep.js';
32
31
  import { checkForUpdates, printUpdateNotice, versionCheckSettled } from './version-check.js';
33
32
  import { guideCommand } from './commands/guide.js';
@@ -91,7 +90,6 @@ program.addCommand(execCommand, HIDDEN);
91
90
  program.addCommand(infoCommand, HIDDEN);
92
91
  program.addCommand(historyCommand, HIDDEN);
93
92
  program.addCommand(triggersCommand, HIDDEN);
94
- program.addCommand(blueprintCommand, HIDDEN);
95
93
  program.addCommand(templatesCommand, HIDDEN);
96
94
  program.addCommand(openCommand, HIDDEN);
97
95
  // Make the programmatic contract discoverable from the first thing an agent
@@ -16,7 +16,6 @@ const COMMANDS = [
16
16
  { name: 'triggers', value: 'triggers', description: 'Manage triggers', needsAgent: false },
17
17
  { name: 'templates', value: 'templates', description: 'Browse templates', needsAgent: false },
18
18
  { name: 'history', value: 'history', description: 'View deploy history', needsAgent: true },
19
- { name: 'blueprint', value: 'blueprint', description: 'Manage templates', needsAgent: false },
20
19
  { name: 'open', value: 'open', description: 'Open agent in browser', needsAgent: true },
21
20
  { name: 'whoami', value: 'whoami', description: 'Show current user', needsAgent: false },
22
21
  { name: 'logout', value: 'logout', description: 'Log out', needsAgent: false },
package/dist/output.js CHANGED
@@ -79,6 +79,8 @@ function errorCodeForStatus(status) {
79
79
  case 401:
80
80
  case 403:
81
81
  return 'unauthorized';
82
+ case 402:
83
+ return 'payment_required';
82
84
  case 404:
83
85
  return 'not_found';
84
86
  case 409:
@@ -125,9 +127,14 @@ export function handleError(error) {
125
127
  if (error instanceof ExitSignal)
126
128
  throw error;
127
129
  if (error instanceof CliHttpError) {
130
+ // The server's own code wins when it sent one: a 402 that says
131
+ // `seat_limit` tells the caller exactly which gate closed, where the
132
+ // status-derived fallback would only say `payment_required`. The
133
+ // message is always the server's detail verbatim, which for billing
134
+ // gates is already a complete sentence naming the fix.
128
135
  fail(error.detail, {
129
136
  status: error.status,
130
- code: errorCodeForStatus(error.status),
137
+ code: error.code ?? errorCodeForStatus(error.status),
131
138
  exitCode: exitCodeForStatus(error.status),
132
139
  });
133
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maritime-cli",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Maritime CLI - Deploy and talk to AI agents from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const blueprintCommand: Command;
@@ -1,92 +0,0 @@
1
- import { Command } from 'commander';
2
- import chalk from 'chalk';
3
- import { authGet, authPost } from '../api.js';
4
- import { resolveAgent } from '../resolve.js';
5
- import { isJsonMode, outputJson, handleError, makeSpinner } from '../output.js';
6
- const blueprintListCmd = new Command('list')
7
- .description('List your templates')
8
- .action(async () => {
9
- try {
10
- const blueprints = await authGet('/api/blueprints');
11
- if (isJsonMode()) {
12
- outputJson(blueprints);
13
- return;
14
- }
15
- if (blueprints.length === 0) {
16
- console.log(chalk.dim('No blueprints found.'));
17
- return;
18
- }
19
- console.log('\n ' +
20
- chalk.dim('NAME'.padEnd(24)) +
21
- chalk.dim('STATUS'.padEnd(12)) +
22
- chalk.dim('VISIBILITY'.padEnd(14)) +
23
- chalk.dim('FRAMEWORK'));
24
- console.log(chalk.dim(' ' + '\u2500'.repeat(62)));
25
- for (const bp of blueprints) {
26
- console.log(' ' +
27
- chalk.bold(bp.name.padEnd(24)) +
28
- bp.status.padEnd(12) +
29
- bp.visibility.padEnd(14) +
30
- bp.framework);
31
- }
32
- console.log();
33
- }
34
- catch (error) {
35
- handleError(error);
36
- }
37
- });
38
- const blueprintCreateCmd = new Command('create')
39
- .description('Create a template from an agent')
40
- .argument('<agent>', 'Agent name or ID')
41
- .option('--name <name>', 'Blueprint name')
42
- .option('--visibility <vis>', 'Visibility (private, unlisted, public)', 'private')
43
- .action(async (agentArg, opts) => {
44
- try {
45
- const agent = await resolveAgent(agentArg);
46
- const spinner = await makeSpinner('Creating blueprint...');
47
- const blueprint = await authPost('/api/blueprints', {
48
- agentId: agent.id,
49
- name: opts.name || agent.name,
50
- visibility: opts.visibility,
51
- });
52
- spinner.succeed(chalk.green('Blueprint created: ') + chalk.bold(blueprint.name));
53
- if (isJsonMode()) {
54
- outputJson(blueprint);
55
- }
56
- else {
57
- console.log(chalk.dim(` ID: ${blueprint.id}`));
58
- }
59
- }
60
- catch (error) {
61
- handleError(error);
62
- }
63
- });
64
- const blueprintDeployCmd = new Command('deploy')
65
- .description('Deploy a new agent from a template')
66
- .argument('<slug>', 'Blueprint slug or ID')
67
- .option('--name <name>', 'Name for the new agent')
68
- .action(async (slug, opts) => {
69
- try {
70
- const spinner = await makeSpinner('Deploying from blueprint...');
71
- const body = {};
72
- if (opts.name)
73
- body.name = opts.name;
74
- const result = await authPost(`/api/marketplace/${encodeURIComponent(slug)}/deploy`, body);
75
- spinner.succeed(chalk.green('Agent created: ') + chalk.bold(result.name));
76
- if (isJsonMode()) {
77
- outputJson(result);
78
- }
79
- else {
80
- console.log(chalk.dim(` Agent ID: ${result.agentId}`));
81
- }
82
- }
83
- catch (error) {
84
- handleError(error);
85
- }
86
- });
87
- export const blueprintCommand = new Command('blueprint')
88
- .alias('bp')
89
- .description('Manage templates')
90
- .addCommand(blueprintListCmd)
91
- .addCommand(blueprintCreateCmd)
92
- .addCommand(blueprintDeployCmd);
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const scaleCommand: Command;
@@ -1,32 +0,0 @@
1
- import { Command } from 'commander';
2
- import chalk from 'chalk';
3
- import { authPut } from '../api.js';
4
- import { resolveAgent } from '../resolve.js';
5
- import { isJsonMode, outputJson, handleError, fail, EXIT } from '../output.js';
6
- const VALID_TIERS = ['smart', 'extended', 'always_on'];
7
- export const scaleCommand = new Command('scale')
8
- .description('Change an agent tier')
9
- .argument('<agent>', 'Agent name or ID')
10
- .argument('<tier>', 'Target tier (smart, extended, always_on)')
11
- .action(async (agentArg, tier) => {
12
- if (!VALID_TIERS.includes(tier)) {
13
- fail(`Invalid tier "${tier}". Must be one of: ${VALID_TIERS.join(', ')}`, {
14
- code: 'usage',
15
- exitCode: EXIT.USAGE,
16
- });
17
- }
18
- try {
19
- const agent = await resolveAgent(agentArg);
20
- const result = await authPut(`/api/agents/${agent.id}`, {
21
- tier,
22
- });
23
- if (isJsonMode()) {
24
- outputJson(result);
25
- return;
26
- }
27
- console.log(chalk.green('Tier updated:') + ` ${chalk.bold(agent.name)} is now ${chalk.bold(tier)}`);
28
- }
29
- catch (error) {
30
- handleError(error);
31
- }
32
- });