maritime-cli 1.8.0 → 2.0.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.
Files changed (79) hide show
  1. package/README.md +17 -0
  2. package/bin/maritime.js +40 -0
  3. package/install.js +118 -0
  4. package/package.json +22 -36
  5. package/AGENTS.md +0 -309
  6. package/dist/api.d.ts +0 -30
  7. package/dist/api.js +0 -240
  8. package/dist/commands/chat.d.ts +0 -2
  9. package/dist/commands/chat.js +0 -120
  10. package/dist/commands/create.d.ts +0 -2
  11. package/dist/commands/create.js +0 -310
  12. package/dist/commands/delete.d.ts +0 -2
  13. package/dist/commands/delete.js +0 -43
  14. package/dist/commands/deploy.d.ts +0 -2
  15. package/dist/commands/deploy.js +0 -180
  16. package/dist/commands/env.d.ts +0 -2
  17. package/dist/commands/env.js +0 -368
  18. package/dist/commands/exec.d.ts +0 -2
  19. package/dist/commands/exec.js +0 -31
  20. package/dist/commands/guide.d.ts +0 -2
  21. package/dist/commands/guide.js +0 -87
  22. package/dist/commands/history.d.ts +0 -2
  23. package/dist/commands/history.js +0 -56
  24. package/dist/commands/info.d.ts +0 -2
  25. package/dist/commands/info.js +0 -78
  26. package/dist/commands/init.d.ts +0 -2
  27. package/dist/commands/init.js +0 -114
  28. package/dist/commands/keys.d.ts +0 -2
  29. package/dist/commands/keys.js +0 -90
  30. package/dist/commands/link.d.ts +0 -4
  31. package/dist/commands/link.js +0 -65
  32. package/dist/commands/list.d.ts +0 -2
  33. package/dist/commands/list.js +0 -55
  34. package/dist/commands/login.d.ts +0 -2
  35. package/dist/commands/login.js +0 -209
  36. package/dist/commands/logout.d.ts +0 -2
  37. package/dist/commands/logout.js +0 -12
  38. package/dist/commands/logs.d.ts +0 -2
  39. package/dist/commands/logs.js +0 -89
  40. package/dist/commands/message.d.ts +0 -8
  41. package/dist/commands/message.js +0 -75
  42. package/dist/commands/open.d.ts +0 -2
  43. package/dist/commands/open.js +0 -25
  44. package/dist/commands/restart.d.ts +0 -2
  45. package/dist/commands/restart.js +0 -26
  46. package/dist/commands/signup.d.ts +0 -2
  47. package/dist/commands/signup.js +0 -45
  48. package/dist/commands/sleep.d.ts +0 -2
  49. package/dist/commands/sleep.js +0 -22
  50. package/dist/commands/start.d.ts +0 -2
  51. package/dist/commands/start.js +0 -27
  52. package/dist/commands/status.d.ts +0 -2
  53. package/dist/commands/status.js +0 -69
  54. package/dist/commands/stop.d.ts +0 -2
  55. package/dist/commands/stop.js +0 -26
  56. package/dist/commands/templates.d.ts +0 -2
  57. package/dist/commands/templates.js +0 -40
  58. package/dist/commands/triggers.d.ts +0 -2
  59. package/dist/commands/triggers.js +0 -89
  60. package/dist/commands/whoami.d.ts +0 -2
  61. package/dist/commands/whoami.js +0 -76
  62. package/dist/config.d.ts +0 -2
  63. package/dist/config.js +0 -14
  64. package/dist/context.d.ts +0 -39
  65. package/dist/context.js +0 -110
  66. package/dist/index.d.ts +0 -2
  67. package/dist/index.js +0 -186
  68. package/dist/interactive.d.ts +0 -1
  69. package/dist/interactive.js +0 -66
  70. package/dist/output.d.ts +0 -80
  71. package/dist/output.js +0 -176
  72. package/dist/prompt.d.ts +0 -2
  73. package/dist/prompt.js +0 -62
  74. package/dist/resolve.d.ts +0 -16
  75. package/dist/resolve.js +0 -59
  76. package/dist/version-check.d.ts +0 -20
  77. package/dist/version-check.js +0 -81
  78. package/dist/websocket.d.ts +0 -22
  79. package/dist/websocket.js +0 -89
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # maritime-cli
2
+
3
+ The Maritime command line client. This package downloads the `maritime`
4
+ binary for your platform from the matching GitHub release and verifies its
5
+ SHA-256 before it runs.
6
+
7
+ ```bash
8
+ npm i -g maritime-cli
9
+ maritime auth login
10
+ ```
11
+
12
+ Documentation, the command reference, and the source live in
13
+ [cli/go](https://github.com/maritime-sh/maritime/tree/main/cli/go) of the
14
+ Maritime repository.
15
+
16
+ Set `MARITIME_CLI_DOWNLOAD_BASE` to install from a mirror of the release
17
+ assets. Every command name from maritime-cli 1.x keeps working.
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+ // Runs the Maritime CLI binary that install.js placed under vendor/, passing
4
+ // every argument through and exiting with the binary's status. When the
5
+ // binary is missing, for example after an install with --ignore-scripts, it
6
+ // is downloaded first.
7
+
8
+ const { spawn } = require('node:child_process')
9
+ const fs = require('node:fs')
10
+ const { install, binaryPath } = require('../install.js')
11
+
12
+ const SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP']
13
+ const EXIT_ON_SIGNAL = 128
14
+
15
+ async function main() {
16
+ const bin = binaryPath()
17
+ if (!fs.existsSync(bin)) {
18
+ await install()
19
+ }
20
+ const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit', windowsHide: true })
21
+ for (const signal of SIGNALS) {
22
+ process.on(signal, () => child.kill(signal))
23
+ }
24
+ child.on('error', (error) => {
25
+ console.error(`maritime-cli: cannot run ${bin}: ${error.message}`)
26
+ process.exit(1)
27
+ })
28
+ child.on('exit', (code, signal) => {
29
+ if (signal) {
30
+ process.kill(process.pid, signal)
31
+ process.exit(EXIT_ON_SIGNAL)
32
+ }
33
+ process.exit(code === null ? 1 : code)
34
+ })
35
+ }
36
+
37
+ main().catch((error) => {
38
+ console.error(`maritime-cli: ${error.message}`)
39
+ process.exit(1)
40
+ })
package/install.js ADDED
@@ -0,0 +1,118 @@
1
+ 'use strict'
2
+ // Downloads the Maritime CLI binary for this platform from the GitHub
3
+ // release that matches package.json's version, verifies its SHA-256 against
4
+ // the release's checksums.txt, and unpacks it next to this file.
5
+ //
6
+ // Runs as the package's postinstall step. Running it again is safe: an
7
+ // existing binary of the right version is kept. Set
8
+ // MARITIME_CLI_DOWNLOAD_BASE to install from a mirror of the release assets.
9
+
10
+ const { createHash } = require('node:crypto')
11
+ const fs = require('node:fs')
12
+ const os = require('node:os')
13
+ const path = require('node:path')
14
+ const { execFileSync } = require('node:child_process')
15
+
16
+ const pkg = require('./package.json')
17
+ const VERSION = pkg.version
18
+ const RELEASE_TAG = `cli-v${VERSION}`
19
+ const DEFAULT_BASE = `https://github.com/maritime-sh/maritime/releases/download/${RELEASE_TAG}`
20
+ const VENDOR_DIR = path.join(__dirname, 'vendor')
21
+ const MARKER = path.join(VENDOR_DIR, 'version')
22
+ const CHECKSUMS = 'checksums.txt'
23
+ const SHA256_HEX_LENGTH = 64
24
+ const DOWNLOAD_TIMEOUT_MS = 120000
25
+
26
+ const PLATFORMS = { darwin: 'darwin', linux: 'linux', win32: 'windows' }
27
+ const ARCHES = { x64: 'amd64', arm64: 'arm64' }
28
+
29
+ /** Returns the archive name for this machine, or throws for an unsupported one. */
30
+ function archiveName() {
31
+ const goos = PLATFORMS[process.platform]
32
+ const goarch = ARCHES[process.arch]
33
+ if (!goos || !goarch) {
34
+ throw new Error(`maritime-cli has no binary for ${process.platform}/${process.arch}`)
35
+ }
36
+ const ext = goos === 'windows' ? 'zip' : 'tar.gz'
37
+ return `maritime_${VERSION}_${goos}_${goarch}.${ext}`
38
+ }
39
+
40
+ /** Returns the installed binary path for this machine. */
41
+ function binaryPath() {
42
+ return path.join(VENDOR_DIR, process.platform === 'win32' ? 'maritime.exe' : 'maritime')
43
+ }
44
+
45
+ /** Fetches url and returns its body as a Buffer. */
46
+ async function download(url) {
47
+ const controller = new AbortController()
48
+ const timer = setTimeout(() => controller.abort(), DOWNLOAD_TIMEOUT_MS)
49
+ try {
50
+ const response = await fetch(url, { redirect: 'follow', signal: controller.signal })
51
+ if (!response.ok) {
52
+ throw new Error(`${url}: HTTP ${response.status}`)
53
+ }
54
+ return Buffer.from(await response.arrayBuffer())
55
+ } finally {
56
+ clearTimeout(timer)
57
+ }
58
+ }
59
+
60
+ /** Returns the expected SHA-256 of name from the checksums file text. */
61
+ function expectedChecksum(checksums, name) {
62
+ for (const line of checksums.split('\n')) {
63
+ const [hash, file] = line.trim().split(/\s+/)
64
+ if (file === name && hash && hash.length === SHA256_HEX_LENGTH) {
65
+ return hash
66
+ }
67
+ }
68
+ throw new Error(`${CHECKSUMS} has no entry for ${name}`)
69
+ }
70
+
71
+ /** Unpacks archive (tar.gz or zip) into dir with the system tar. */
72
+ function extract(archive, dir) {
73
+ // bsdtar on macOS and Windows 10+, GNU tar on Linux; all read both formats.
74
+ execFileSync('tar', ['-xf', archive, '-C', dir], { stdio: 'inherit' })
75
+ }
76
+
77
+ async function install() {
78
+ const name = archiveName()
79
+ const bin = binaryPath()
80
+ if (fs.existsSync(bin) && fs.existsSync(MARKER) && fs.readFileSync(MARKER, 'utf8').trim() === VERSION) {
81
+ return
82
+ }
83
+ const base = (process.env.MARITIME_CLI_DOWNLOAD_BASE || DEFAULT_BASE).replace(/\/+$/, '')
84
+ const [archive, checksums] = await Promise.all([
85
+ download(`${base}/${name}`),
86
+ download(`${base}/${CHECKSUMS}`),
87
+ ])
88
+ const actual = createHash('sha256').update(archive).digest('hex')
89
+ const expected = expectedChecksum(checksums.toString('utf8'), name)
90
+ if (actual !== expected) {
91
+ throw new Error(`${name}: SHA-256 ${actual} does not match ${CHECKSUMS} (${expected})`)
92
+ }
93
+ fs.rmSync(VENDOR_DIR, { recursive: true, force: true })
94
+ fs.mkdirSync(VENDOR_DIR, { recursive: true })
95
+ const tmp = path.join(os.tmpdir(), `maritime-cli-${process.pid}-${name}`)
96
+ fs.writeFileSync(tmp, archive)
97
+ try {
98
+ extract(tmp, VENDOR_DIR)
99
+ } finally {
100
+ fs.rmSync(tmp, { force: true })
101
+ }
102
+ if (!fs.existsSync(bin)) {
103
+ throw new Error(`${name} did not contain ${path.basename(bin)}`)
104
+ }
105
+ if (process.platform !== 'win32') {
106
+ fs.chmodSync(bin, 0o755)
107
+ }
108
+ fs.writeFileSync(MARKER, `${VERSION}\n`)
109
+ }
110
+
111
+ module.exports = { install, binaryPath }
112
+
113
+ if (require.main === module) {
114
+ install().catch((error) => {
115
+ console.error(`maritime-cli: ${error.message}`)
116
+ process.exit(1)
117
+ })
118
+ }
package/package.json CHANGED
@@ -1,49 +1,35 @@
1
1
  {
2
2
  "name": "maritime-cli",
3
- "version": "1.8.0",
4
- "description": "Maritime CLI - Deploy and talk to AI agents from your terminal",
5
- "type": "module",
6
- "license": "MIT",
7
- "author": "mariagorskikh",
3
+ "version": "2.0.0",
4
+ "description": "Maritime command line client: provision, operate, and inspect AI agents on maritime.sh.",
5
+ "license": "Apache-2.0",
8
6
  "repository": {
9
7
  "type": "git",
10
- "url": "https://github.com/mariagorskikh/maritime"
8
+ "url": "https://github.com/maritime-sh/maritime.git",
9
+ "directory": "cli/npm"
11
10
  },
12
- "keywords": [
13
- "ai",
14
- "agents",
15
- "deploy",
16
- "cli",
17
- "maritime"
18
- ],
11
+ "homepage": "https://maritime.sh",
19
12
  "bin": {
20
- "maritime": "./dist/index.js"
13
+ "maritime": "bin/maritime.js"
21
14
  },
22
15
  "files": [
23
- "dist",
24
- "AGENTS.md"
16
+ "bin",
17
+ "install.js",
18
+ "README.md"
25
19
  ],
26
- "engines": {
27
- "node": ">=20.12"
28
- },
29
20
  "scripts": {
30
- "build": "tsc && chmod +x dist/index.js",
31
- "dev": "tsx src/index.ts",
32
- "prepublishOnly": "npm run build"
21
+ "postinstall": "node install.js"
33
22
  },
34
- "dependencies": {
35
- "@inquirer/prompts": "^7.0.0",
36
- "chalk": "^5.3.0",
37
- "commander": "^12.0.0",
38
- "conf": "^12.0.0",
39
- "open": "^10.0.0",
40
- "ora": "^8.0.0",
41
- "ws": "^8.16.0"
23
+ "engines": {
24
+ "node": ">=18"
42
25
  },
43
- "devDependencies": {
44
- "@types/node": "^20.0.0",
45
- "@types/ws": "^8.5.0",
46
- "tsx": "^4.0.0",
47
- "typescript": "^5.0.0"
48
- }
26
+ "os": [
27
+ "darwin",
28
+ "linux",
29
+ "win32"
30
+ ],
31
+ "cpu": [
32
+ "x64",
33
+ "arm64"
34
+ ]
49
35
  }
package/AGENTS.md DELETED
@@ -1,309 +0,0 @@
1
- # Maritime CLI · machine interface
2
-
3
- This document is the contract for driving the `maritime` CLI from a program or
4
- an AI agent (not a human at a keyboard). It is safe to paste into an agent's
5
- system prompt as a tool spec.
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm i -g maritime-cli
11
- maritime --version
12
- ```
13
-
14
- ## Authentication (non-interactive)
15
-
16
- The CLI reads a bearer token from the `MARITIME_TOKEN` environment variable
17
- before anything else. An agent must set this and never run the interactive
18
- `login` flow.
19
-
20
- Prefer a **long-lived API key** (`mk_…`) over the JWT from `maritime login`,
21
- which expires. Mint one once as a human:
22
-
23
- ```bash
24
- maritime login # human, one time
25
- maritime keys create --name my-agent --json
26
- # → { "key": "mk_...", ... } (shown ONCE, store it)
27
- ```
28
-
29
- Then give the agent only the key:
30
-
31
- ```bash
32
- export MARITIME_TOKEN=mk_xxxxxxxxxxxxxxxxxxxxxxxx
33
- ```
34
-
35
- `mk_` keys do not expire. Rotate with `maritime keys list` / `maritime keys revoke <id>`.
36
-
37
- ## Output contract: always pass `--json`
38
-
39
- With `--json`, every command obeys a strict contract:
40
-
41
- | Channel | On success | On failure |
42
- |---|---|---|
43
- | **stdout** | a single JSON value, nothing else | empty |
44
- | **stderr** | empty | a single JSON error object |
45
- | **exit code** | `0` | non-zero (see below) |
46
-
47
- The failure object is:
48
-
49
- ```json
50
- { "ok": false, "error": { "code": "not_authenticated", "message": "…", "status": 401 } }
51
- ```
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
-
63
- Always read stdout for results and branch on the exit code. Never parse human text.
64
-
65
- ### Exit codes
66
-
67
- | Code | Meaning |
68
- |---|---|
69
- | `0` | success |
70
- | `1` | generic error (request failed, server error, network) |
71
- | `2` | auth error (not logged in, token expired/invalid) |
72
- | `3` | not found (no such agent) |
73
- | `4` | usage error (missing/invalid arguments) |
74
-
75
- ## The project model: a directory is an agent
76
-
77
- Like `vercel` / `railway`, you can link a directory to an agent and then run
78
- commands without naming it. Two files:
79
-
80
- - **`maritime.json`**: committed config describing the agent: `name`,
81
- `template` (or `framework`), persona `instructions`, env `["KEY", …]` (keys
82
- only). The source of truth.
83
- - **`.maritime/project.json`**: machine-local link (git-ignored) pointing at
84
- the agent this directory operates on.
85
-
86
- ```bash
87
- maritime init <name> --json # scaffold maritime.json + AGENTS.md, create + link
88
- maritime link <agent> --json # link this dir to an existing agent
89
- maritime deploy --json # reconcile the agent to maritime.json, then ship
90
- ```
91
-
92
- Once linked, the `<agent>` argument is **optional on every command**. It falls
93
- back to the linked agent (resolved by walking up from the cwd):
94
-
95
- ```bash
96
- maritime chat "what's open?" --json # talks to the linked agent
97
- maritime logs --json # linked agent's logs
98
- maritime env set FOO=bar --json # linked agent's env (KEY=value ⇒ no agent token)
99
- maritime status --json # linked agent's detail
100
- ```
101
-
102
- For automation you can ignore linking entirely and pass `<agent>` on every call
103
- (below). To target a different agent from inside a linked dir, pass it
104
- explicitly: `-a/--agent` on `chat`, or the positional name on commands that take
105
- a single agent.
106
-
107
- ## The interaction primitive: `chat`
108
-
109
- Send a message to a deployed agent and get its reply. Sleeping serverless
110
- agents are auto-woken by the backend.
111
-
112
- ```bash
113
- # explicit agent + message
114
- maritime chat <agent> "summarize today's incidents" --json
115
-
116
- # linked dir: positionals are the message, target = linked agent
117
- maritime chat "summarize today's incidents" --json
118
-
119
- # message piped via stdin (best for long / multi-line prompts)
120
- cat prompt.txt | maritime chat <agent> --json
121
-
122
- # multi-turn: thread a conversation id
123
- maritime chat <agent> "and the one before that?" --conversation-id abc123 --json
124
- ```
125
-
126
- `<agent>` is a name (exact match), an ID prefix, or (omitted) the linked agent.
127
-
128
- Success shape:
129
-
130
- ```json
131
- { "ok": true, "agentId": "…", "agentName": "…", "conversationId": null, "response": "…the agent's reply…" }
132
- ```
133
-
134
- Without `--json`, `chat` prints only the reply text on stdout (clean for piping).
135
-
136
- ### Messaging AS an end-user: `message`
137
-
138
- `chat` targets one agent; `message` routes by YOUR end-user id through the
139
- agent's project front door: the same `--user` always reaches the same
140
- dedicated agent, and an unknown id gets one assigned/spawned per the
141
- project's `newChatPolicy`.
142
-
143
- ```bash
144
- maritime message <agent> --user cust_42 "where is my order?" --json | jq -r '.reply'
145
- maritime message <agent> --user cust_42 --wait 0 "hi" --json # ack now; reply via message.reply webhook
146
- ```
147
-
148
- `status:"replied"` carries `.reply` inline; `"provisioning"`/`"queued"` means
149
- the user's agent is still booting. Poll the message id or subscribe to the
150
- `message.reply` webhook (`POST /api/v1/webhooks`).
151
-
152
- ## Sizing (optional)
153
-
154
- You don't size agents. `maritime create <name>` picks an applicable size for the
155
- framework, and the agent auto-sleeps when idle and wakes on the next `chat`.
156
-
157
- For hand-tuning one agent (e.g. a reseller dialing resources per client), `create`
158
- accepts optional per-agent overrides. They're hidden from `--help` but fully
159
- supported; omitted flags get the platform defaults.
160
-
161
- ```bash
162
- maritime create my-agent \
163
- --ram 2048 \ # RAM in MB
164
- --cpu 1.5 \ # vCPU cores (fractional OK)
165
- --idle 600 \ # auto-sleep 600s after the last request
166
- --disk 20 # workspace SSD in GB
167
- # …or keep it resident:
168
- maritime create my-agent --always-on # never auto-sleep (mutually exclusive with --idle)
169
- ```
170
-
171
- `--idle`/`--always-on` control how long the agent stays up after a request.
172
- This overrides the platform's default serverless idle cap, so an orchestrator
173
- that dispatches a long job and waits for a webhook won't be slept out from under
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).
177
- `status <agent> --json` echoes `memMb`, `vcpus`, `idleTtlSeconds`
178
- (`0` = always-on, `null` = platform default) and `diskMb`.
179
-
180
- ## Batches: `create --count`
181
-
182
- `maritime create <name> --count <n>` (n = 2-50) spins up **n identical agents**
183
- in a single call. `<name>` becomes the prefix, so agents are named
184
- `<name>-1` … `<name>-n`. `--count 1` (the default) is the classic single-agent
185
- path, unchanged.
186
-
187
- ```bash
188
- maritime create swarm --template openclaw --count 5 --idle 3600 --json
189
- ```
190
-
191
- Flags supported alongside `--count > 1`: `--template`,
192
- `--idle`/`--always-on`, `--repo`, and `-e/--env` (applied to every agent).
193
- In the batch path `--idle 0` means always-on (same as `--always-on`).
194
- Any other `create` flag (`--branch`, `--public`, `--port`, `--framework`,
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.
198
-
199
- Success shape (`--json`, the backend response verbatim):
200
-
201
- ```json
202
- {
203
- "created": [{ "id": "…", "name": "swarm-1", "status": "deploying" }],
204
- "failed": [{ "name": "swarm-3", "error": "…" }],
205
- "requested": 5
206
- }
207
- ```
208
-
209
- Exit codes: `0` = **all** requested agents created (`failed` empty);
210
- `1` = partial or none, so inspect `created`/`failed` on stdout. Limit
211
- rejections surface as the standard error object on stderr with exit `1`:
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).
215
-
216
- ```bash
217
- # Recipe: spin up 5 agents, then fan a message out to every one of them
218
- maritime create swarm --template openclaw --count 5 --idle 3600 --json \
219
- | jq -r '.created[].name' \
220
- | xargs -I{} maritime chat {} "introduce yourself" --json
221
- ```
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
-
244
- ## Environment variables
245
-
246
- Values are secret (encrypted) by default. Env changes apply on the next
247
- container boot unless you `--reload` (hot-reload into the running container).
248
-
249
- ```bash
250
- # one or many at once
251
- maritime env set <agent> OPENAI_API_KEY=sk-… LOG_LEVEL=debug --no-secret --json
252
-
253
- # bulk upload a whole .env file (or pipe one via stdin), then hot-reload
254
- maritime env import <agent> ./prod.env --reload --json
255
- cat prod.env | maritime env import <agent> - --reload --json
256
-
257
- maritime env list <agent> --json
258
- maritime env remove <agent> OPENAI_API_KEY --reload --json
259
- maritime env reload <agent> --json # hot-reload without changing values
260
- maritime env pull <agent> .env --json # write env to a local .env (secret VALUES masked)
261
- ```
262
-
263
- `import`/`set` return `{ok, uploaded:[…], failed:[{key,error}], reloaded}`.
264
- A partial failure exits `1` with the failed keys listed in `failed`. In a linked
265
- dir the agent is implied: `maritime env set FOO=bar --json`, `maritime env pull`.
266
-
267
- ## Command map
268
-
269
- Project: `init`, `link`, `deploy` (a directory ⇄ an agent)
270
- Auth / keys: `login`, `logout`, `whoami`, `keys {create,list,revoke}`
271
- Lifecycle: `create`, `list`, `deploy`, `delete`
272
- Interaction: `chat`/`send`, `message` (per-end-user front door)
273
- Config: `env {set,import,list,remove,reload,pull}`
274
- Observe: `status`, `logs`
275
-
276
- Advanced / ops (hidden from `--help`, still fully supported): `start`, `stop`,
277
- `restart`, `sleep`, `exec <agent> <cmd...>`, `info`, `history`,
278
- `triggers`, `templates`. You rarely need these: lifecycle is
279
- automatic (idle-sleep + auto-wake on `chat`).
280
-
281
- Run `maritime <cmd> --help` for flags. Every command accepts the global
282
- `--json` and `--verbose`.
283
-
284
- ## Recipes
285
-
286
- ```bash
287
- # Is an agent healthy?
288
- maritime status my-agent --json | jq -r '.status'
289
-
290
- # Create, then talk to it
291
- ID=$(maritime create researcher --template openclaw --json | jq -r '.id')
292
- maritime chat "$ID" "introduce yourself" --json | jq -r '.response'
293
-
294
- # Run a shell command inside the container
295
- maritime exec my-agent ls /data --json | jq -r '.stdout'
296
-
297
- # Tail recent error logs as JSON
298
- maritime logs my-agent --level error --json
299
- ```
300
-
301
- ## Notes for agents
302
-
303
- - `delete` refuses to run non-interactively without `--yes` (exit `4`); pass
304
- `--yes` deliberately.
305
- - `create` needs a name (positional `<name>`, or `--name`) when non-interactive (exit `4`).
306
- - Non-2xx that the backend reports inside a body (e.g. agent not running for
307
- `chat`) surfaces as `error.code = "agent_unavailable"`, exit `1`.
308
- - The API base URL can be overridden with `MARITIME_API_URL` (default
309
- `https://api.maritime.sh`).
package/dist/api.d.ts DELETED
@@ -1,30 +0,0 @@
1
- type JsonRecord = Record<string, unknown>;
2
- export declare class CliHttpError extends Error {
3
- status: number;
4
- 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);
10
- }
11
- export interface CliUser {
12
- id: string;
13
- email: string;
14
- name?: string | null;
15
- image?: string | null;
16
- }
17
- export interface CliAuthResponse {
18
- token: string;
19
- user: CliUser;
20
- }
21
- export declare function getApiUrl(): string;
22
- export declare function requireAuth(): string;
23
- export declare function isVerbose(): boolean;
24
- export declare function postJson<T>(path: string, body: JsonRecord): Promise<T>;
25
- export declare function authGet<T>(path: string): Promise<T>;
26
- export declare function authPost<T>(path: string, body?: JsonRecord): Promise<T>;
27
- export declare function authPut<T>(path: string, body?: JsonRecord): Promise<T>;
28
- export declare function authDelete<T = JsonRecord>(path: string): Promise<T>;
29
- export declare function publicGet<T>(path: string): Promise<T>;
30
- export {};