maritime-cli 1.9.0 → 2.0.1
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/README.md +16 -0
- package/archives/checksums.txt +6 -0
- package/archives/maritime_2.0.1_darwin_amd64.tar.gz +0 -0
- package/archives/maritime_2.0.1_darwin_arm64.tar.gz +0 -0
- package/archives/maritime_2.0.1_linux_amd64.tar.gz +0 -0
- package/archives/maritime_2.0.1_linux_arm64.tar.gz +0 -0
- package/archives/maritime_2.0.1_windows_amd64.zip +0 -0
- package/archives/maritime_2.0.1_windows_arm64.zip +0 -0
- package/bin/maritime.js +40 -0
- package/install.js +131 -0
- package/package.json +23 -37
- package/AGENTS.md +0 -361
- package/SKILL.md +0 -181
- package/dist/api.d.ts +0 -30
- package/dist/api.js +0 -246
- package/dist/bundled.d.ts +0 -11
- package/dist/bundled.js +0 -25
- package/dist/commands/chat.d.ts +0 -2
- package/dist/commands/chat.js +0 -120
- package/dist/commands/create.d.ts +0 -2
- package/dist/commands/create.js +0 -310
- package/dist/commands/delete.d.ts +0 -2
- package/dist/commands/delete.js +0 -43
- package/dist/commands/deploy.d.ts +0 -2
- package/dist/commands/deploy.js +0 -180
- package/dist/commands/env.d.ts +0 -2
- package/dist/commands/env.js +0 -368
- package/dist/commands/exec.d.ts +0 -2
- package/dist/commands/exec.js +0 -31
- package/dist/commands/guide.d.ts +0 -2
- package/dist/commands/guide.js +0 -75
- package/dist/commands/history.d.ts +0 -2
- package/dist/commands/history.js +0 -56
- package/dist/commands/info.d.ts +0 -2
- package/dist/commands/info.js +0 -78
- package/dist/commands/init.d.ts +0 -2
- package/dist/commands/init.js +0 -143
- package/dist/commands/keys.d.ts +0 -2
- package/dist/commands/keys.js +0 -90
- package/dist/commands/link.d.ts +0 -4
- package/dist/commands/link.js +0 -65
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/list.js +0 -55
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.js +0 -368
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/logout.js +0 -12
- package/dist/commands/logs.d.ts +0 -2
- package/dist/commands/logs.js +0 -89
- package/dist/commands/message.d.ts +0 -8
- package/dist/commands/message.js +0 -75
- package/dist/commands/open.d.ts +0 -2
- package/dist/commands/open.js +0 -25
- package/dist/commands/restart.d.ts +0 -2
- package/dist/commands/restart.js +0 -26
- package/dist/commands/signup.d.ts +0 -2
- package/dist/commands/signup.js +0 -72
- package/dist/commands/sleep.d.ts +0 -2
- package/dist/commands/sleep.js +0 -22
- package/dist/commands/start.d.ts +0 -2
- package/dist/commands/start.js +0 -27
- package/dist/commands/status.d.ts +0 -2
- package/dist/commands/status.js +0 -69
- package/dist/commands/stop.d.ts +0 -2
- package/dist/commands/stop.js +0 -26
- package/dist/commands/templates.d.ts +0 -2
- package/dist/commands/templates.js +0 -40
- package/dist/commands/triggers.d.ts +0 -2
- package/dist/commands/triggers.js +0 -89
- package/dist/commands/whoami.d.ts +0 -2
- package/dist/commands/whoami.js +0 -76
- package/dist/config.d.ts +0 -2
- package/dist/config.js +0 -14
- package/dist/context.d.ts +0 -39
- package/dist/context.js +0 -110
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -186
- package/dist/interactive.d.ts +0 -1
- package/dist/interactive.js +0 -66
- package/dist/output.d.ts +0 -80
- package/dist/output.js +0 -176
- package/dist/prompt.d.ts +0 -2
- package/dist/prompt.js +0 -62
- package/dist/resolve.d.ts +0 -16
- package/dist/resolve.js +0 -59
- package/dist/version-check.d.ts +0 -20
- package/dist/version-check.js +0 -81
- package/dist/websocket.d.ts +0 -22
- package/dist/websocket.js +0 -89
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# maritime-cli
|
|
2
|
+
|
|
3
|
+
The Maritime command line client. This package ships the `maritime` binary
|
|
4
|
+
for every supported platform and unpacks the one for yours at install time,
|
|
5
|
+
after checking its SHA-256.
|
|
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
|
+
Every command name from maritime-cli 1.x keeps working.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
db571b75258dcc13f10deee1fcb2b0d0338ba3d08213b69c26cce783eb313830 maritime_2.0.1_darwin_amd64.tar.gz
|
|
2
|
+
1f6b25fcfe5e5771d3f40bee2ef00a6ff11fe654224d002134d6befd4607ea77 maritime_2.0.1_darwin_arm64.tar.gz
|
|
3
|
+
c41a060161f5bdb20b58af5feff7098da69187b9c03b83f909c300ab98797efc maritime_2.0.1_linux_amd64.tar.gz
|
|
4
|
+
53eb11396800f22b41486291fb8874eb9755cbdc40c7a5802347789b4c606719 maritime_2.0.1_linux_arm64.tar.gz
|
|
5
|
+
f58e42877b03dbc05cfa053af1db8a6ea9fd492d78cc7e6faea3b5c924f12ea8 maritime_2.0.1_windows_amd64.zip
|
|
6
|
+
6a913ff1ff4d3352da061fbdcfc38699c975bbaa3aac04abb4a362951bfd6bf3 maritime_2.0.1_windows_arm64.zip
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/maritime.js
ADDED
|
@@ -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,131 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
// Unpacks the Maritime CLI binary for this platform next to this file.
|
|
3
|
+
//
|
|
4
|
+
// The package ships the release archives for every platform under archives/
|
|
5
|
+
// together with their checksums.txt, so an install needs no network. When a
|
|
6
|
+
// bundled archive is missing, the archive is downloaded from
|
|
7
|
+
// MARITIME_CLI_DOWNLOAD_BASE, or from the GitHub release of this version.
|
|
8
|
+
// Either way the SHA-256 is verified before anything is unpacked.
|
|
9
|
+
//
|
|
10
|
+
// Runs as the package's postinstall step. Running it again is safe: an
|
|
11
|
+
// existing binary of the right version is kept.
|
|
12
|
+
|
|
13
|
+
const { createHash } = require('node:crypto')
|
|
14
|
+
const fs = require('node:fs')
|
|
15
|
+
const os = require('node:os')
|
|
16
|
+
const path = require('node:path')
|
|
17
|
+
const { execFileSync } = require('node:child_process')
|
|
18
|
+
|
|
19
|
+
const pkg = require('./package.json')
|
|
20
|
+
const VERSION = pkg.version
|
|
21
|
+
const RELEASE_TAG = `cli-v${VERSION}`
|
|
22
|
+
const DEFAULT_BASE = `https://github.com/maritime-sh/maritime/releases/download/${RELEASE_TAG}`
|
|
23
|
+
const VENDOR_DIR = path.join(__dirname, 'vendor')
|
|
24
|
+
const ARCHIVE_DIR = path.join(__dirname, 'archives')
|
|
25
|
+
const MARKER = path.join(VENDOR_DIR, 'version')
|
|
26
|
+
const CHECKSUMS = 'checksums.txt'
|
|
27
|
+
const SHA256_HEX_LENGTH = 64
|
|
28
|
+
const DOWNLOAD_TIMEOUT_MS = 120000
|
|
29
|
+
|
|
30
|
+
const PLATFORMS = { darwin: 'darwin', linux: 'linux', win32: 'windows' }
|
|
31
|
+
const ARCHES = { x64: 'amd64', arm64: 'arm64' }
|
|
32
|
+
|
|
33
|
+
/** Returns the archive name for this machine, or throws for an unsupported one. */
|
|
34
|
+
function archiveName() {
|
|
35
|
+
const goos = PLATFORMS[process.platform]
|
|
36
|
+
const goarch = ARCHES[process.arch]
|
|
37
|
+
if (!goos || !goarch) {
|
|
38
|
+
throw new Error(`maritime-cli has no binary for ${process.platform}/${process.arch}`)
|
|
39
|
+
}
|
|
40
|
+
const ext = goos === 'windows' ? 'zip' : 'tar.gz'
|
|
41
|
+
return `maritime_${VERSION}_${goos}_${goarch}.${ext}`
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Returns the installed binary path for this machine. */
|
|
45
|
+
function binaryPath() {
|
|
46
|
+
return path.join(VENDOR_DIR, process.platform === 'win32' ? 'maritime.exe' : 'maritime')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Returns the bundled file, or fetches it from base when it is not bundled. */
|
|
50
|
+
async function obtain(base, name) {
|
|
51
|
+
const bundled = path.join(ARCHIVE_DIR, name)
|
|
52
|
+
if (fs.existsSync(bundled)) {
|
|
53
|
+
return fs.readFileSync(bundled)
|
|
54
|
+
}
|
|
55
|
+
return download(`${base}/${name}`)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Fetches url and returns its body as a Buffer. */
|
|
59
|
+
async function download(url) {
|
|
60
|
+
const controller = new AbortController()
|
|
61
|
+
const timer = setTimeout(() => controller.abort(), DOWNLOAD_TIMEOUT_MS)
|
|
62
|
+
try {
|
|
63
|
+
const response = await fetch(url, { redirect: 'follow', signal: controller.signal })
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
throw new Error(`${url}: HTTP ${response.status}`)
|
|
66
|
+
}
|
|
67
|
+
return Buffer.from(await response.arrayBuffer())
|
|
68
|
+
} finally {
|
|
69
|
+
clearTimeout(timer)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Returns the expected SHA-256 of name from the checksums file text. */
|
|
74
|
+
function expectedChecksum(checksums, name) {
|
|
75
|
+
for (const line of checksums.split('\n')) {
|
|
76
|
+
const [hash, file] = line.trim().split(/\s+/)
|
|
77
|
+
if (file === name && hash && hash.length === SHA256_HEX_LENGTH) {
|
|
78
|
+
return hash
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
throw new Error(`${CHECKSUMS} has no entry for ${name}`)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Unpacks archive (tar.gz or zip) into dir with the system tar. */
|
|
85
|
+
function extract(archive, dir) {
|
|
86
|
+
// bsdtar on macOS and Windows 10+, GNU tar on Linux; all read both formats.
|
|
87
|
+
execFileSync('tar', ['-xf', archive, '-C', dir], { stdio: 'inherit' })
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function install() {
|
|
91
|
+
const name = archiveName()
|
|
92
|
+
const bin = binaryPath()
|
|
93
|
+
if (fs.existsSync(bin) && fs.existsSync(MARKER) && fs.readFileSync(MARKER, 'utf8').trim() === VERSION) {
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
const base = (process.env.MARITIME_CLI_DOWNLOAD_BASE || DEFAULT_BASE).replace(/\/+$/, '')
|
|
97
|
+
const [archive, checksums] = await Promise.all([
|
|
98
|
+
obtain(base, name),
|
|
99
|
+
obtain(base, CHECKSUMS),
|
|
100
|
+
])
|
|
101
|
+
const actual = createHash('sha256').update(archive).digest('hex')
|
|
102
|
+
const expected = expectedChecksum(checksums.toString('utf8'), name)
|
|
103
|
+
if (actual !== expected) {
|
|
104
|
+
throw new Error(`${name}: SHA-256 ${actual} does not match ${CHECKSUMS} (${expected})`)
|
|
105
|
+
}
|
|
106
|
+
fs.rmSync(VENDOR_DIR, { recursive: true, force: true })
|
|
107
|
+
fs.mkdirSync(VENDOR_DIR, { recursive: true })
|
|
108
|
+
const tmp = path.join(os.tmpdir(), `maritime-cli-${process.pid}-${name}`)
|
|
109
|
+
fs.writeFileSync(tmp, archive)
|
|
110
|
+
try {
|
|
111
|
+
extract(tmp, VENDOR_DIR)
|
|
112
|
+
} finally {
|
|
113
|
+
fs.rmSync(tmp, { force: true })
|
|
114
|
+
}
|
|
115
|
+
if (!fs.existsSync(bin)) {
|
|
116
|
+
throw new Error(`${name} did not contain ${path.basename(bin)}`)
|
|
117
|
+
}
|
|
118
|
+
if (process.platform !== 'win32') {
|
|
119
|
+
fs.chmodSync(bin, 0o755)
|
|
120
|
+
}
|
|
121
|
+
fs.writeFileSync(MARKER, `${VERSION}\n`)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
module.exports = { install, binaryPath }
|
|
125
|
+
|
|
126
|
+
if (require.main === module) {
|
|
127
|
+
install().catch((error) => {
|
|
128
|
+
console.error(`maritime-cli: ${error.message}`)
|
|
129
|
+
process.exit(1)
|
|
130
|
+
})
|
|
131
|
+
}
|
package/package.json
CHANGED
|
@@ -1,50 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maritime-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Maritime
|
|
5
|
-
"
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"author": "mariagorskikh",
|
|
3
|
+
"version": "2.0.1",
|
|
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/
|
|
8
|
+
"url": "https://github.com/maritime-sh/maritime.git",
|
|
9
|
+
"directory": "cli/npm"
|
|
11
10
|
},
|
|
12
|
-
"
|
|
13
|
-
"ai",
|
|
14
|
-
"agents",
|
|
15
|
-
"deploy",
|
|
16
|
-
"cli",
|
|
17
|
-
"maritime"
|
|
18
|
-
],
|
|
11
|
+
"homepage": "https://maritime.sh",
|
|
19
12
|
"bin": {
|
|
20
|
-
"maritime": "
|
|
13
|
+
"maritime": "bin/maritime.js"
|
|
21
14
|
},
|
|
22
15
|
"files": [
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
16
|
+
"bin",
|
|
17
|
+
"install.js",
|
|
18
|
+
"archives",
|
|
19
|
+
"README.md"
|
|
26
20
|
],
|
|
27
|
-
"engines": {
|
|
28
|
-
"node": ">=20.12"
|
|
29
|
-
},
|
|
30
21
|
"scripts": {
|
|
31
|
-
"
|
|
32
|
-
"dev": "tsx src/index.ts",
|
|
33
|
-
"prepublishOnly": "npm run build"
|
|
22
|
+
"postinstall": "node install.js"
|
|
34
23
|
},
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"chalk": "^5.3.0",
|
|
38
|
-
"commander": "^12.0.0",
|
|
39
|
-
"conf": "^12.0.0",
|
|
40
|
-
"open": "^10.0.0",
|
|
41
|
-
"ora": "^8.0.0",
|
|
42
|
-
"ws": "^8.16.0"
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
43
26
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
"os": [
|
|
28
|
+
"darwin",
|
|
29
|
+
"linux",
|
|
30
|
+
"win32"
|
|
31
|
+
],
|
|
32
|
+
"cpu": [
|
|
33
|
+
"x64",
|
|
34
|
+
"arm64"
|
|
35
|
+
]
|
|
50
36
|
}
|
package/AGENTS.md
DELETED
|
@@ -1,361 +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
|
-
### No browser: `maritime login --device`
|
|
38
|
-
|
|
39
|
-
When the machine has no browser and no reachable localhost callback (a
|
|
40
|
-
headless box, a container, an AI coding agent's sandbox), sign in with a
|
|
41
|
-
device code. `maritime login` with no flags switches to this flow by itself
|
|
42
|
-
when there is no TTY, when `SSH_CONNECTION` or `CI` is set, when `--json` is
|
|
43
|
-
passed, or when the browser cannot be opened.
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
maritime login --device --json
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
The CLI prints one JSON line on **stderr** first, so a program can show the
|
|
50
|
-
code to its human:
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
{"ok":true,"action":"device_code","user_code":"XXXX-XXXX","verification_uri_complete":"https://maritime.sh/cli/device?code=XXXX-XXXX","expires_in":900}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
The human opens that URL while signed in and clicks Approve. The CLI polls
|
|
57
|
-
every 5 seconds, stores the token, and then prints the single result on
|
|
58
|
-
stdout:
|
|
59
|
-
|
|
60
|
-
```json
|
|
61
|
-
{ "ok": true, "action": "login", "method": "device", "user": "you@example.com" }
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
The code expires after 15 minutes. Denial or expiry ends the command with
|
|
65
|
-
exit `2` and `error.code` = `access_denied` or `expired_token`. The token it
|
|
66
|
-
stores is the 30-day login JWT; mint an `mk_` key afterwards for anything
|
|
67
|
-
long-lived.
|
|
68
|
-
|
|
69
|
-
### New account: `maritime signup`
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
maritime signup -e you@example.com -p '<password>' --json
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Non-interactive (`--json` or no TTY) with email or password missing is a
|
|
76
|
-
usage error (exit `4`); the command never prompts in that case. Success
|
|
77
|
-
stores the token and prints:
|
|
78
|
-
|
|
79
|
-
```json
|
|
80
|
-
{ "ok": true, "action": "signup", "user": "you@example.com", "emailVerified": false,
|
|
81
|
-
"next": "Verify your email: we sent a link to you@example.com. Deploys and API keys are refused until the link is clicked. Run `maritime login --resend` to send it again." }
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
The account is signed in but unverified: `deploy`, `start`, `restart`, key
|
|
85
|
-
creation and computer creation answer `403 email_not_verified` until the
|
|
86
|
-
human clicks the link in the email (see above). `create` and `chat` work
|
|
87
|
-
before that.
|
|
88
|
-
|
|
89
|
-
## Output contract: always pass `--json`
|
|
90
|
-
|
|
91
|
-
With `--json`, every command obeys a strict contract:
|
|
92
|
-
|
|
93
|
-
| Channel | On success | On failure |
|
|
94
|
-
|---|---|---|
|
|
95
|
-
| **stdout** | a single JSON value, nothing else | empty |
|
|
96
|
-
| **stderr** | empty | a single JSON error object |
|
|
97
|
-
| **exit code** | `0` | non-zero (see below) |
|
|
98
|
-
|
|
99
|
-
The failure object is:
|
|
100
|
-
|
|
101
|
-
```json
|
|
102
|
-
{ "ok": false, "error": { "code": "not_authenticated", "message": "…", "status": 401 } }
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
`error.code` is the backend's own code whenever it sent one (for example
|
|
106
|
-
`seat_limit` on a billing refusal), otherwise a generic code derived from the
|
|
107
|
-
HTTP status. `error.message` is always the backend's message verbatim.
|
|
108
|
-
|
|
109
|
-
`email_not_verified` (status 403) means the account has not clicked the link
|
|
110
|
-
in its verification email. Deploy, start, restart, key creation and computer
|
|
111
|
-
creation are refused until it does. `error.message` names the address and
|
|
112
|
-
the fix. A human runs `maritime login --resend` to get the link again; the
|
|
113
|
-
token in hand works for everything after the click.
|
|
114
|
-
|
|
115
|
-
Always read stdout for results and branch on the exit code. Never parse human text.
|
|
116
|
-
|
|
117
|
-
### Exit codes
|
|
118
|
-
|
|
119
|
-
| Code | Meaning |
|
|
120
|
-
|---|---|
|
|
121
|
-
| `0` | success |
|
|
122
|
-
| `1` | generic error (request failed, server error, network) |
|
|
123
|
-
| `2` | auth error (not logged in, token expired/invalid) |
|
|
124
|
-
| `3` | not found (no such agent) |
|
|
125
|
-
| `4` | usage error (missing/invalid arguments) |
|
|
126
|
-
|
|
127
|
-
## The project model: a directory is an agent
|
|
128
|
-
|
|
129
|
-
Like `vercel` / `railway`, you can link a directory to an agent and then run
|
|
130
|
-
commands without naming it. Two files:
|
|
131
|
-
|
|
132
|
-
- **`maritime.json`**: committed config describing the agent: `name`,
|
|
133
|
-
`template` (or `framework`), persona `instructions`, env `["KEY", …]` (keys
|
|
134
|
-
only). The source of truth.
|
|
135
|
-
- **`.maritime/project.json`**: machine-local link (git-ignored) pointing at
|
|
136
|
-
the agent this directory operates on.
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
maritime init <name> --json # scaffold maritime.json + AGENTS.md, create + link
|
|
140
|
-
maritime link <agent> --json # link this dir to an existing agent
|
|
141
|
-
maritime deploy --json # reconcile the agent to maritime.json, then ship
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Once linked, the `<agent>` argument is **optional on every command**. It falls
|
|
145
|
-
back to the linked agent (resolved by walking up from the cwd):
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
maritime chat "what's open?" --json # talks to the linked agent
|
|
149
|
-
maritime logs --json # linked agent's logs
|
|
150
|
-
maritime env set FOO=bar --json # linked agent's env (KEY=value ⇒ no agent token)
|
|
151
|
-
maritime status --json # linked agent's detail
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
For automation you can ignore linking entirely and pass `<agent>` on every call
|
|
155
|
-
(below). To target a different agent from inside a linked dir, pass it
|
|
156
|
-
explicitly: `-a/--agent` on `chat`, or the positional name on commands that take
|
|
157
|
-
a single agent.
|
|
158
|
-
|
|
159
|
-
## The interaction primitive: `chat`
|
|
160
|
-
|
|
161
|
-
Send a message to a deployed agent and get its reply. Sleeping serverless
|
|
162
|
-
agents are auto-woken by the backend.
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
# explicit agent + message
|
|
166
|
-
maritime chat <agent> "summarize today's incidents" --json
|
|
167
|
-
|
|
168
|
-
# linked dir: positionals are the message, target = linked agent
|
|
169
|
-
maritime chat "summarize today's incidents" --json
|
|
170
|
-
|
|
171
|
-
# message piped via stdin (best for long / multi-line prompts)
|
|
172
|
-
cat prompt.txt | maritime chat <agent> --json
|
|
173
|
-
|
|
174
|
-
# multi-turn: thread a conversation id
|
|
175
|
-
maritime chat <agent> "and the one before that?" --conversation-id abc123 --json
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
`<agent>` is a name (exact match), an ID prefix, or (omitted) the linked agent.
|
|
179
|
-
|
|
180
|
-
Success shape:
|
|
181
|
-
|
|
182
|
-
```json
|
|
183
|
-
{ "ok": true, "agentId": "…", "agentName": "…", "conversationId": null, "response": "…the agent's reply…" }
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
Without `--json`, `chat` prints only the reply text on stdout (clean for piping).
|
|
187
|
-
|
|
188
|
-
### Messaging AS an end-user: `message`
|
|
189
|
-
|
|
190
|
-
`chat` targets one agent; `message` routes by YOUR end-user id through the
|
|
191
|
-
agent's project front door: the same `--user` always reaches the same
|
|
192
|
-
dedicated agent, and an unknown id gets one assigned/spawned per the
|
|
193
|
-
project's `newChatPolicy`.
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
maritime message <agent> --user cust_42 "where is my order?" --json | jq -r '.reply'
|
|
197
|
-
maritime message <agent> --user cust_42 --wait 0 "hi" --json # ack now; reply via message.reply webhook
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
`status:"replied"` carries `.reply` inline; `"provisioning"`/`"queued"` means
|
|
201
|
-
the user's agent is still booting. Poll the message id or subscribe to the
|
|
202
|
-
`message.reply` webhook (`POST /api/v1/webhooks`).
|
|
203
|
-
|
|
204
|
-
## Sizing (optional)
|
|
205
|
-
|
|
206
|
-
You don't size agents. `maritime create <name>` picks an applicable size for the
|
|
207
|
-
framework, and the agent auto-sleeps when idle and wakes on the next `chat`.
|
|
208
|
-
|
|
209
|
-
For hand-tuning one agent (e.g. a reseller dialing resources per client), `create`
|
|
210
|
-
accepts optional per-agent overrides. They're hidden from `--help` but fully
|
|
211
|
-
supported; omitted flags get the platform defaults.
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
maritime create my-agent \
|
|
215
|
-
--ram 2048 \ # RAM in MB
|
|
216
|
-
--cpu 1.5 \ # vCPU cores (fractional OK)
|
|
217
|
-
--idle 600 \ # auto-sleep 600s after the last request
|
|
218
|
-
--disk 20 # workspace SSD in GB
|
|
219
|
-
# …or keep it resident:
|
|
220
|
-
maritime create my-agent --always-on # never auto-sleep (mutually exclusive with --idle)
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
`--idle`/`--always-on` control how long the agent stays up after a request.
|
|
224
|
-
This overrides the platform's default serverless idle cap, so an orchestrator
|
|
225
|
-
that dispatches a long job and waits for a webhook won't be slept out from under
|
|
226
|
-
the wait. Every agent includes 2 GB RAM and 5 GB SSD; `--ram` above 2048,
|
|
227
|
-
`--disk` above 5, and `--always-on` are paid add-ons, so on the free plan they
|
|
228
|
-
come back as a `402` telling you to upgrade (see Billing refusals below).
|
|
229
|
-
`status <agent> --json` echoes `memMb`, `vcpus`, `idleTtlSeconds`
|
|
230
|
-
(`0` = always-on, `null` = platform default) and `diskMb`.
|
|
231
|
-
|
|
232
|
-
## Batches: `create --count`
|
|
233
|
-
|
|
234
|
-
`maritime create <name> --count <n>` (n = 2-50) spins up **n identical agents**
|
|
235
|
-
in a single call. `<name>` becomes the prefix, so agents are named
|
|
236
|
-
`<name>-1` … `<name>-n`. `--count 1` (the default) is the classic single-agent
|
|
237
|
-
path, unchanged.
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
maritime create swarm --template openclaw --count 5 --idle 3600 --json
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Flags supported alongside `--count > 1`: `--template`,
|
|
244
|
-
`--idle`/`--always-on`, `--repo`, and `-e/--env` (applied to every agent).
|
|
245
|
-
In the batch path `--idle 0` means always-on (same as `--always-on`).
|
|
246
|
-
Any other `create` flag (`--branch`, `--public`, `--port`, `--framework`,
|
|
247
|
-
`--ram`, `--cpu`, `--disk`) combined with `--count > 1` is a usage error
|
|
248
|
-
(exit `4`); nothing is silently dropped. `--count` above 50 is also exit `4`;
|
|
249
|
-
the 50-agent cap is enforced server-side too.
|
|
250
|
-
|
|
251
|
-
Success shape (`--json`, the backend response verbatim):
|
|
252
|
-
|
|
253
|
-
```json
|
|
254
|
-
{
|
|
255
|
-
"created": [{ "id": "…", "name": "swarm-1", "status": "deploying" }],
|
|
256
|
-
"failed": [{ "name": "swarm-3", "error": "…" }],
|
|
257
|
-
"requested": 5
|
|
258
|
-
}
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
Exit codes: `0` = **all** requested agents created (`failed` empty);
|
|
262
|
-
`1` = partial or none, so inspect `created`/`failed` on stdout. Limit
|
|
263
|
-
rejections surface as the standard error object on stderr with exit `1`:
|
|
264
|
-
`402` → `error.code = "seat_limit"` (your plan's agent cap; see Billing
|
|
265
|
-
refusals below), `403` → `error.code = "fleet_cap_exceeded"` (the 50-agent
|
|
266
|
-
per-call cap).
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
# Recipe: spin up 5 agents, then fan a message out to every one of them
|
|
270
|
-
maritime create swarm --template openclaw --count 5 --idle 3600 --json \
|
|
271
|
-
| jq -r '.created[].name' \
|
|
272
|
-
| xargs -I{} maritime chat {} "introduce yourself" --json
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Billing refusals (`402`)
|
|
276
|
-
|
|
277
|
-
Your plan sets how many agents you may have (the free plan includes 3) and
|
|
278
|
-
whether you can use the paid add-ons (extra RAM, extra SSD, always-on). When a
|
|
279
|
-
create is refused for a billing reason, the CLI exits `1` and writes the
|
|
280
|
-
standard error object with `error.status = 402` and the server's own
|
|
281
|
-
`error.code`, usually `"seat_limit"`.
|
|
282
|
-
|
|
283
|
-
**`error.message` is the server's sentence, verbatim.** It already names the
|
|
284
|
-
fix and carries the link, for example:
|
|
285
|
-
|
|
286
|
-
```json
|
|
287
|
-
{ "ok": false, "error": { "code": "seat_limit", "status": 402,
|
|
288
|
-
"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" } }
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
Show that message to your user unchanged rather than writing your own reason:
|
|
292
|
-
the same code covers several distinct gates (plan agent cap, add-ons needing a
|
|
293
|
-
paid plan, a lapsed plan, an identity agent needing your own `INKBOX_API_KEY`)
|
|
294
|
-
and only the message tells them which one they hit.
|
|
295
|
-
|
|
296
|
-
## Environment variables
|
|
297
|
-
|
|
298
|
-
Values are secret (encrypted) by default. Env changes apply on the next
|
|
299
|
-
container boot unless you `--reload` (hot-reload into the running container).
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
# one or many at once
|
|
303
|
-
maritime env set <agent> OPENAI_API_KEY=sk-… LOG_LEVEL=debug --no-secret --json
|
|
304
|
-
|
|
305
|
-
# bulk upload a whole .env file (or pipe one via stdin), then hot-reload
|
|
306
|
-
maritime env import <agent> ./prod.env --reload --json
|
|
307
|
-
cat prod.env | maritime env import <agent> - --reload --json
|
|
308
|
-
|
|
309
|
-
maritime env list <agent> --json
|
|
310
|
-
maritime env remove <agent> OPENAI_API_KEY --reload --json
|
|
311
|
-
maritime env reload <agent> --json # hot-reload without changing values
|
|
312
|
-
maritime env pull <agent> .env --json # write env to a local .env (secret VALUES masked)
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
`import`/`set` return `{ok, uploaded:[…], failed:[{key,error}], reloaded}`.
|
|
316
|
-
A partial failure exits `1` with the failed keys listed in `failed`. In a linked
|
|
317
|
-
dir the agent is implied: `maritime env set FOO=bar --json`, `maritime env pull`.
|
|
318
|
-
|
|
319
|
-
## Command map
|
|
320
|
-
|
|
321
|
-
Project: `init`, `link`, `deploy` (a directory ⇄ an agent)
|
|
322
|
-
Auth / keys: `login`, `logout`, `whoami`, `keys {create,list,revoke}`
|
|
323
|
-
Lifecycle: `create`, `list`, `deploy`, `delete`
|
|
324
|
-
Interaction: `chat`/`send`, `message` (per-end-user front door)
|
|
325
|
-
Config: `env {set,import,list,remove,reload,pull}`
|
|
326
|
-
Observe: `status`, `logs`
|
|
327
|
-
|
|
328
|
-
Advanced / ops (hidden from `--help`, still fully supported): `start`, `stop`,
|
|
329
|
-
`restart`, `sleep`, `exec <agent> <cmd...>`, `info`, `history`,
|
|
330
|
-
`triggers`, `templates`. You rarely need these: lifecycle is
|
|
331
|
-
automatic (idle-sleep + auto-wake on `chat`).
|
|
332
|
-
|
|
333
|
-
Run `maritime <cmd> --help` for flags. Every command accepts the global
|
|
334
|
-
`--json` and `--verbose`.
|
|
335
|
-
|
|
336
|
-
## Recipes
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
# Is an agent healthy?
|
|
340
|
-
maritime status my-agent --json | jq -r '.status'
|
|
341
|
-
|
|
342
|
-
# Create, then talk to it
|
|
343
|
-
ID=$(maritime create researcher --template openclaw --json | jq -r '.id')
|
|
344
|
-
maritime chat "$ID" "introduce yourself" --json | jq -r '.response'
|
|
345
|
-
|
|
346
|
-
# Run a shell command inside the container
|
|
347
|
-
maritime exec my-agent ls /data --json | jq -r '.stdout'
|
|
348
|
-
|
|
349
|
-
# Tail recent error logs as JSON
|
|
350
|
-
maritime logs my-agent --level error --json
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
## Notes for agents
|
|
354
|
-
|
|
355
|
-
- `delete` refuses to run non-interactively without `--yes` (exit `4`); pass
|
|
356
|
-
`--yes` deliberately.
|
|
357
|
-
- `create` needs a name (positional `<name>`, or `--name`) when non-interactive (exit `4`).
|
|
358
|
-
- Non-2xx that the backend reports inside a body (e.g. agent not running for
|
|
359
|
-
`chat`) surfaces as `error.code = "agent_unavailable"`, exit `1`.
|
|
360
|
-
- The API base URL can be overridden with `MARITIME_API_URL` (default
|
|
361
|
-
`https://api.maritime.sh`).
|