@aexhq/sdk 0.40.4 → 0.40.6
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 +159 -159
- package/dist/_contracts/api-key.js +0 -1
- package/dist/_contracts/bundle-manifest.js +0 -1
- package/dist/_contracts/connection-ticket.js +0 -1
- package/dist/_contracts/error-codes.js +0 -1
- package/dist/_contracts/error-factory.js +0 -1
- package/dist/_contracts/event-envelope.js +0 -1
- package/dist/_contracts/event-stream-client.js +0 -1
- package/dist/_contracts/event-view.js +0 -1
- package/dist/_contracts/http.js +0 -1
- package/dist/_contracts/index.js +0 -1
- package/dist/_contracts/internal.d.ts +36 -0
- package/dist/_contracts/internal.js +155 -6
- package/dist/_contracts/models.js +0 -1
- package/dist/_contracts/operations.js +1 -2
- package/dist/_contracts/post-hook.js +0 -1
- package/dist/_contracts/provider-support.js +0 -1
- package/dist/_contracts/run-artifacts.js +0 -1
- package/dist/_contracts/run-config.js +0 -1
- package/dist/_contracts/run-cost.js +0 -1
- package/dist/_contracts/run-custody.js +0 -1
- package/dist/_contracts/run-record.js +0 -1
- package/dist/_contracts/run-retention.js +0 -1
- package/dist/_contracts/run-trace.js +0 -1
- package/dist/_contracts/run-unit.js +0 -1
- package/dist/_contracts/runner-event.js +0 -1
- package/dist/_contracts/runtime-manifest.js +0 -1
- package/dist/_contracts/runtime-security-profile.js +0 -1
- package/dist/_contracts/runtime-sizes.js +0 -1
- package/dist/_contracts/runtime-types.js +0 -1
- package/dist/_contracts/sdk-errors.js +0 -1
- package/dist/_contracts/sdk-secrets.js +0 -1
- package/dist/_contracts/side-effect-audit.js +0 -1
- package/dist/_contracts/sse.js +0 -0
- package/dist/_contracts/stable.js +0 -1
- package/dist/_contracts/status.js +0 -1
- package/dist/_contracts/submission.js +0 -1
- package/dist/_contracts/suggest.js +0 -1
- package/dist/_contracts/webhook-verify.js +0 -1
- package/dist/asset-upload.d.ts +3 -43
- package/dist/asset-upload.js +1 -109
- package/dist/asset-upload.js.map +1 -1
- package/dist/cli.mjs +354 -781
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/fetch-archive.js +76 -16
- package/dist/fetch-archive.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/authentication.md +125 -125
- package/docs/billing.md +118 -118
- package/docs/concepts/agent-tools.md +66 -66
- package/docs/concepts/composition.md +37 -37
- package/docs/concepts/providers-and-runtimes.md +54 -54
- package/docs/concepts/runs.md +49 -49
- package/docs/concepts/subagents.md +88 -88
- package/docs/credentials.md +125 -125
- package/docs/defaults.md +64 -64
- package/docs/errors.md +196 -196
- package/docs/events.md +243 -243
- package/docs/limits-and-quotas.md +144 -144
- package/docs/limits.md +50 -50
- package/docs/mcp.md +44 -44
- package/docs/networking.md +163 -163
- package/docs/outputs.md +267 -267
- package/docs/public-surface.json +77 -77
- package/docs/quickstart.md +119 -119
- package/docs/release.md +38 -38
- package/docs/retries.md +129 -129
- package/docs/run-config.md +58 -58
- package/docs/run-record.md +55 -55
- package/docs/secrets.md +125 -130
- package/docs/testing.md +35 -35
- package/docs/vision-skills.md +91 -91
- package/docs/webhooks.md +127 -131
- package/examples/feature-tour.ts +282 -282
- package/examples/spike-settle-latency.ts +125 -125
- package/package.json +1 -1
package/dist/cli.mjs.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a67b2cbba2818c579806f112ebfbfddb975b028d0950381985e0e6aa73d259ee cli.mjs
|
package/dist/fetch-archive.js
CHANGED
|
@@ -14,6 +14,8 @@ import { SKILL_BUNDLE_LIMITS } from "./_contracts/index.js";
|
|
|
14
14
|
* in error messages.
|
|
15
15
|
*/
|
|
16
16
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
17
|
+
class SkillArchiveDownloadError extends Error {
|
|
18
|
+
}
|
|
17
19
|
export async function fetchSkillArchive(url, opts = {}) {
|
|
18
20
|
if (typeof url !== "string" || url.length === 0) {
|
|
19
21
|
throw new Error("Skill.fromUrl: url is required");
|
|
@@ -36,35 +38,93 @@ export async function fetchSkillArchive(url, opts = {}) {
|
|
|
36
38
|
async function download(url, fetchImpl, timeoutMs) {
|
|
37
39
|
const controller = new AbortController();
|
|
38
40
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
39
|
-
let res;
|
|
40
41
|
try {
|
|
41
|
-
res = await fetchImpl(url, { signal: controller.signal });
|
|
42
|
+
const res = await fetchImpl(url, { signal: controller.signal });
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
throw new SkillArchiveDownloadError(`Skill.fromUrl: fetch for ${redactUrl(url)} returned HTTP ${res.status}`);
|
|
45
|
+
}
|
|
46
|
+
// Early guard on a declared size so a clearly-too-big archive fails before
|
|
47
|
+
// we buffer it. The authoritative caps are re-checked by bundleSkillFiles.
|
|
48
|
+
const declaredRaw = res.headers.get("content-length");
|
|
49
|
+
const declared = declaredRaw !== null && /^\d+$/.test(declaredRaw) ? Number(declaredRaw) : undefined;
|
|
50
|
+
if (declared !== undefined && declared > SKILL_BUNDLE_LIMITS.maxCompressedBytes) {
|
|
51
|
+
throw new SkillArchiveDownloadError(`Skill.fromUrl: archive at ${redactUrl(url)} declares ${declared} bytes, ` +
|
|
52
|
+
`exceeding the ${SKILL_BUNDLE_LIMITS.maxCompressedBytes}-byte compressed cap`);
|
|
53
|
+
}
|
|
54
|
+
const bytes = await readResponseBytes(res, url, controller.signal);
|
|
55
|
+
if (bytes.byteLength === 0) {
|
|
56
|
+
throw new SkillArchiveDownloadError(`Skill.fromUrl: archive at ${redactUrl(url)} is empty`);
|
|
57
|
+
}
|
|
58
|
+
return bytes;
|
|
42
59
|
}
|
|
43
60
|
catch (err) {
|
|
61
|
+
if (err instanceof SkillArchiveDownloadError)
|
|
62
|
+
throw err;
|
|
44
63
|
throw new Error(`Skill.fromUrl: fetch failed for ${redactUrl(url)}: ${errMessage(err)}`);
|
|
45
64
|
}
|
|
46
65
|
finally {
|
|
47
66
|
clearTimeout(timer);
|
|
48
67
|
}
|
|
49
|
-
|
|
50
|
-
|
|
68
|
+
}
|
|
69
|
+
async function readResponseBytes(res, url, signal) {
|
|
70
|
+
if (!res.body) {
|
|
71
|
+
const bytes = new Uint8Array(await withAbort(res.arrayBuffer(), signal));
|
|
72
|
+
ensureWithinCompressedCap(bytes.byteLength, url);
|
|
73
|
+
return bytes;
|
|
74
|
+
}
|
|
75
|
+
const reader = res.body.getReader();
|
|
76
|
+
const chunks = [];
|
|
77
|
+
let total = 0;
|
|
78
|
+
try {
|
|
79
|
+
while (true) {
|
|
80
|
+
const { done, value } = await withAbort(reader.read(), signal);
|
|
81
|
+
if (done)
|
|
82
|
+
break;
|
|
83
|
+
if (!value || value.byteLength === 0)
|
|
84
|
+
continue;
|
|
85
|
+
total += value.byteLength;
|
|
86
|
+
ensureWithinCompressedCap(total, url);
|
|
87
|
+
chunks.push(value);
|
|
88
|
+
}
|
|
51
89
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const declared = Number(res.headers.get("content-length"));
|
|
55
|
-
if (Number.isFinite(declared) && declared > SKILL_BUNDLE_LIMITS.maxCompressedBytes) {
|
|
56
|
-
throw new Error(`Skill.fromUrl: archive at ${redactUrl(url)} declares ${declared} bytes, ` +
|
|
57
|
-
`exceeding the ${SKILL_BUNDLE_LIMITS.maxCompressedBytes}-byte compressed cap`);
|
|
90
|
+
finally {
|
|
91
|
+
await reader.cancel().catch(() => { });
|
|
58
92
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
93
|
+
return concatBytes(chunks, total);
|
|
94
|
+
}
|
|
95
|
+
function ensureWithinCompressedCap(bytes, url) {
|
|
96
|
+
if (bytes > SKILL_BUNDLE_LIMITS.maxCompressedBytes) {
|
|
97
|
+
throw new SkillArchiveDownloadError(`Skill.fromUrl: archive at ${redactUrl(url)} is ${bytes} bytes, ` +
|
|
62
98
|
`exceeding the ${SKILL_BUNDLE_LIMITS.maxCompressedBytes}-byte compressed cap`);
|
|
63
99
|
}
|
|
64
|
-
|
|
65
|
-
|
|
100
|
+
}
|
|
101
|
+
function concatBytes(chunks, total) {
|
|
102
|
+
if (chunks.length === 1)
|
|
103
|
+
return chunks[0];
|
|
104
|
+
const out = new Uint8Array(total);
|
|
105
|
+
let offset = 0;
|
|
106
|
+
for (const chunk of chunks) {
|
|
107
|
+
out.set(chunk, offset);
|
|
108
|
+
offset += chunk.byteLength;
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
function withAbort(promise, signal) {
|
|
113
|
+
if (signal.aborted)
|
|
114
|
+
return Promise.reject(abortError());
|
|
115
|
+
return new Promise((resolve, reject) => {
|
|
116
|
+
const onAbort = () => reject(abortError());
|
|
117
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
118
|
+
promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function abortError() {
|
|
122
|
+
if (typeof DOMException === "function") {
|
|
123
|
+
return new DOMException("The operation was aborted", "AbortError");
|
|
66
124
|
}
|
|
67
|
-
|
|
125
|
+
const err = new Error("The operation was aborted");
|
|
126
|
+
err.name = "AbortError";
|
|
127
|
+
return err;
|
|
68
128
|
}
|
|
69
129
|
async function verifySha256(bytes, expected, url) {
|
|
70
130
|
const want = (expected.startsWith("sha256:") ? expected.slice("sha256:".length) : expected).toLowerCase();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-archive.js","sourceRoot":"","sources":["../src/fetch-archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAGvE;;;;;;;;;;;;GAYG;AAEH,MAAM,kBAAkB,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-archive.js","sourceRoot":"","sources":["../src/fetch-archive.ts"],"names":[],"mappings":"AAAA,O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125 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Authentication
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Authentication
|
|
6
|
-
|
|
7
|
-
Every SDK and CLI call authenticates with an **aex API key**: a bearer
|
|
8
|
-
credential that is **workspace-scoped** — the workspace is derived server-side
|
|
9
|
-
from the token, so there is no workspace parameter anywhere in the API. A
|
|
10
|
-
request either carries a valid token for a workspace or it is rejected with
|
|
11
|
-
`401 unauthorized` (see [Errors](errors.md)).
|
|
12
|
-
|
|
13
|
-
## Getting a token (invite-only beta)
|
|
14
|
-
|
|
15
|
-
aex is currently in **invite-only beta**. Workspaces and their initial API
|
|
16
|
-
tokens are provisioned by the aex team — contact <support@aex.dev> for beta
|
|
17
|
-
access. Once your workspace exists, you can create and delete additional tokens
|
|
18
|
-
in the dashboard at <https://aex.dev>.
|
|
19
|
-
|
|
20
|
-
## Using a token
|
|
21
|
-
|
|
22
|
-
Pass the token to the SDK constructor, the CLI's `--api-key` flag, or persist
|
|
23
|
-
it once with `aex login`:
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
import { Aex } from "@aexhq/sdk";
|
|
27
|
-
|
|
28
|
-
const aex = new Aex(process.env.AEX_API_KEY!);
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npx aex whoami --api-key "$AEX_API_KEY"
|
|
33
|
-
|
|
34
|
-
# or persist it once, then omit --api-key on later commands:
|
|
35
|
-
npx aex login --api-key "$AEX_API_KEY"
|
|
36
|
-
npx aex whoami
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
(`new Aex(apiKey)` is the canonical constructor; the equivalent options form is
|
|
40
|
-
documented once in [Credentials](credentials.md).)
|
|
41
|
-
|
|
42
|
-
The token travels as a standard `Authorization: Bearer` header. Treat it like
|
|
43
|
-
any other secret: keep it in environment variables or a secret manager, never
|
|
44
|
-
in run config, prompts, or committed files.
|
|
45
|
-
|
|
46
|
-
## Plane routing and the `baseUrl` guard
|
|
47
|
-
|
|
48
|
-
An aex API key is **self-describing**: it embeds the plane (`dev` / `prd`) and
|
|
49
|
-
region it was minted for. The constructor parses the key and routes accordingly,
|
|
50
|
-
with **zero network**:
|
|
51
|
-
|
|
52
|
-
- **Omit `baseUrl`** and a `prd` key routes to the canonical hosted API plane
|
|
53
|
-
(`https://api.aex.dev`). A `dev` key has no stable public host yet, so a dev
|
|
54
|
-
key with no `baseUrl` throws `CredentialValidationError` asking you to pass one.
|
|
55
|
-
- **Supply a `baseUrl` whose plane disagrees with the key** (e.g. a `dev` key
|
|
56
|
-
pointed at `https://api.aex.dev`) and the constructor throws
|
|
57
|
-
`CredentialValidationError` **before any request** — you no longer discover the
|
|
58
|
-
mismatch as a late `401 token_invalid` after a full round-trip.
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
// prd key → routes to https://api.aex.dev automatically:
|
|
62
|
-
const prd = new Aex(process.env.AEX_PRD_KEY!);
|
|
63
|
-
|
|
64
|
-
// dev key → pass the dev plane's baseUrl explicitly:
|
|
65
|
-
const dev = new Aex(process.env.AEX_DEV_KEY!, { baseUrl: process.env.AEX_DEV_URL! });
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Scopes
|
|
69
|
-
|
|
70
|
-
A token carries a set of **scopes**; every API route requires one, and a token
|
|
71
|
-
that lacks the route's scope fails with `403 insufficient_scope` naming the
|
|
72
|
-
missing scope. The customer-grantable scopes:
|
|
73
|
-
|
|
74
|
-
| Scope | Grants |
|
|
75
|
-
| --- | --- |
|
|
76
|
-
| `runs:read` | Read sessions/runs, their events and event archives, and webhook delivery ledgers. |
|
|
77
|
-
| `runs:write` | Open sessions, send turns, submit runs, suspend/resume, redeliver webhooks, reveal the webhook signing secret. |
|
|
78
|
-
| `runs:cancel` | Cancel a session/run. |
|
|
79
|
-
| `runs:delete` | Delete a session/run record. |
|
|
80
|
-
| `outputs:read` | List, read, download, and mint links for captured outputs. |
|
|
81
|
-
| `files:write` | Upload asset bytes (files, skills, AGENTS.md) staged for a run. |
|
|
82
|
-
| `files:delete` | Delete workspace asset-store entries. |
|
|
83
|
-
| `secrets:read` | List workspace secrets and read their metadata (never values). |
|
|
84
|
-
| `secrets:write` | Create, rotate, and delete workspace secrets. |
|
|
85
|
-
| `mcp:read` | List and read workspace MCP server configurations. |
|
|
86
|
-
| `mcp:write` | Create workspace MCP server configurations. |
|
|
87
|
-
| `mcp:delete` | Delete workspace MCP server configurations. |
|
|
88
|
-
| `billing:read` | Read billing state and create hosted billing sessions. |
|
|
89
|
-
| `workspaces:delete` | Owner self-service workspace hard-erase. |
|
|
90
|
-
|
|
91
|
-
Tokens may additionally carry the reserved scopes `skills:read` /
|
|
92
|
-
`skills:write` / `skills:delete`, `agentsmd:read` / `agentsmd:write` /
|
|
93
|
-
`agentsmd:delete`, and `files:read`. No API route requires them today — skill
|
|
94
|
-
and AGENTS.md asset uploads are covered by `files:write` — so treat them as
|
|
95
|
-
inert placeholders for future per-asset-type routes.
|
|
96
|
-
|
|
97
|
-
A typical automation token carries `runs:read`, `runs:write`, and
|
|
98
|
-
`outputs:read`. Grant the rest only where the workload needs them — a read-only
|
|
99
|
-
reporting token, for example, needs no `runs:write`.
|
|
100
|
-
|
|
101
|
-
## Introspection: `whoami`
|
|
102
|
-
|
|
103
|
-
`aex.whoami()` (CLI: `aex whoami`) validates the token and returns the
|
|
104
|
-
workspace id, the token's scopes, and — on current platform deployments — a
|
|
105
|
-
`limits` object with the workspace's effective admission caps
|
|
106
|
-
(`maxConcurrentRuns`, `submitRatePerMinute`, `spendCapUsd`, `monthSpendUsd`,
|
|
107
|
-
`balanceUsd`, `balanceGraceFloorUsd`, `paymentMethodStatus`), resolved by the
|
|
108
|
-
same code the submit gates enforce. Use it as a cheap credential check and to
|
|
109
|
-
anticipate `429`/`402` rejections before submitting — see
|
|
110
|
-
[Limits & quotas](limits-and-quotas.md) and [Errors](errors.md).
|
|
111
|
-
|
|
112
|
-
## Rotation and revocation
|
|
113
|
-
|
|
114
|
-
- **Rotate** by creating a new token in the dashboard, switching your
|
|
115
|
-
deployment to it, then deleting the old one. Tokens are independent — both
|
|
116
|
-
stay valid during the switch, so rotation needs no downtime.
|
|
117
|
-
- **Revoke** by deleting the token in the dashboard; deletion takes effect
|
|
118
|
-
immediately (allow up to a minute for in-flight caches to expire).
|
|
119
|
-
- Token create/delete are rate-limited per workspace (see
|
|
120
|
-
[Limits & quotas](limits-and-quotas.md)).
|
|
121
|
-
- If you cannot reach the dashboard (or suspect workspace-level compromise),
|
|
122
|
-
contact <support@aex.dev>.
|
|
123
|
-
|
|
124
|
-
Provider keys (`apiKeys`) and runtime secrets are a separate, per-call surface —
|
|
125
|
-
see [Credentials](credentials.md) and [Secrets](secrets.md).
|
|
1
|
+
---
|
|
2
|
+
title: Authentication
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Authentication
|
|
6
|
+
|
|
7
|
+
Every SDK and CLI call authenticates with an **aex API key**: a bearer
|
|
8
|
+
credential that is **workspace-scoped** — the workspace is derived server-side
|
|
9
|
+
from the token, so there is no workspace parameter anywhere in the API. A
|
|
10
|
+
request either carries a valid token for a workspace or it is rejected with
|
|
11
|
+
`401 unauthorized` (see [Errors](errors.md)).
|
|
12
|
+
|
|
13
|
+
## Getting a token (invite-only beta)
|
|
14
|
+
|
|
15
|
+
aex is currently in **invite-only beta**. Workspaces and their initial API
|
|
16
|
+
tokens are provisioned by the aex team — contact <support@aex.dev> for beta
|
|
17
|
+
access. Once your workspace exists, you can create and delete additional tokens
|
|
18
|
+
in the dashboard at <https://aex.dev>.
|
|
19
|
+
|
|
20
|
+
## Using a token
|
|
21
|
+
|
|
22
|
+
Pass the token to the SDK constructor, the CLI's `--api-key` flag, or persist
|
|
23
|
+
it once with `aex login`:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { Aex } from "@aexhq/sdk";
|
|
27
|
+
|
|
28
|
+
const aex = new Aex(process.env.AEX_API_KEY!);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx aex whoami --api-key "$AEX_API_KEY"
|
|
33
|
+
|
|
34
|
+
# or persist it once, then omit --api-key on later commands:
|
|
35
|
+
npx aex login --api-key "$AEX_API_KEY"
|
|
36
|
+
npx aex whoami
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
(`new Aex(apiKey)` is the canonical constructor; the equivalent options form is
|
|
40
|
+
documented once in [Credentials](credentials.md).)
|
|
41
|
+
|
|
42
|
+
The token travels as a standard `Authorization: Bearer` header. Treat it like
|
|
43
|
+
any other secret: keep it in environment variables or a secret manager, never
|
|
44
|
+
in run config, prompts, or committed files.
|
|
45
|
+
|
|
46
|
+
## Plane routing and the `baseUrl` guard
|
|
47
|
+
|
|
48
|
+
An aex API key is **self-describing**: it embeds the plane (`dev` / `prd`) and
|
|
49
|
+
region it was minted for. The constructor parses the key and routes accordingly,
|
|
50
|
+
with **zero network**:
|
|
51
|
+
|
|
52
|
+
- **Omit `baseUrl`** and a `prd` key routes to the canonical hosted API plane
|
|
53
|
+
(`https://api.aex.dev`). A `dev` key has no stable public host yet, so a dev
|
|
54
|
+
key with no `baseUrl` throws `CredentialValidationError` asking you to pass one.
|
|
55
|
+
- **Supply a `baseUrl` whose plane disagrees with the key** (e.g. a `dev` key
|
|
56
|
+
pointed at `https://api.aex.dev`) and the constructor throws
|
|
57
|
+
`CredentialValidationError` **before any request** — you no longer discover the
|
|
58
|
+
mismatch as a late `401 token_invalid` after a full round-trip.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
// prd key → routes to https://api.aex.dev automatically:
|
|
62
|
+
const prd = new Aex(process.env.AEX_PRD_KEY!);
|
|
63
|
+
|
|
64
|
+
// dev key → pass the dev plane's baseUrl explicitly:
|
|
65
|
+
const dev = new Aex(process.env.AEX_DEV_KEY!, { baseUrl: process.env.AEX_DEV_URL! });
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Scopes
|
|
69
|
+
|
|
70
|
+
A token carries a set of **scopes**; every API route requires one, and a token
|
|
71
|
+
that lacks the route's scope fails with `403 insufficient_scope` naming the
|
|
72
|
+
missing scope. The customer-grantable scopes:
|
|
73
|
+
|
|
74
|
+
| Scope | Grants |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `runs:read` | Read sessions/runs, their events and event archives, and webhook delivery ledgers. |
|
|
77
|
+
| `runs:write` | Open sessions, send turns, submit runs, suspend/resume, redeliver webhooks, reveal the webhook signing secret. |
|
|
78
|
+
| `runs:cancel` | Cancel a session/run. |
|
|
79
|
+
| `runs:delete` | Delete a session/run record. |
|
|
80
|
+
| `outputs:read` | List, read, download, and mint links for captured outputs. |
|
|
81
|
+
| `files:write` | Upload asset bytes (files, skills, AGENTS.md) staged for a run. |
|
|
82
|
+
| `files:delete` | Delete workspace asset-store entries. |
|
|
83
|
+
| `secrets:read` | List workspace secrets and read their metadata (never values). |
|
|
84
|
+
| `secrets:write` | Create, rotate, and delete workspace secrets. |
|
|
85
|
+
| `mcp:read` | List and read workspace MCP server configurations. |
|
|
86
|
+
| `mcp:write` | Create workspace MCP server configurations. |
|
|
87
|
+
| `mcp:delete` | Delete workspace MCP server configurations. |
|
|
88
|
+
| `billing:read` | Read billing state and create hosted billing sessions. |
|
|
89
|
+
| `workspaces:delete` | Owner self-service workspace hard-erase. |
|
|
90
|
+
|
|
91
|
+
Tokens may additionally carry the reserved scopes `skills:read` /
|
|
92
|
+
`skills:write` / `skills:delete`, `agentsmd:read` / `agentsmd:write` /
|
|
93
|
+
`agentsmd:delete`, and `files:read`. No API route requires them today — skill
|
|
94
|
+
and AGENTS.md asset uploads are covered by `files:write` — so treat them as
|
|
95
|
+
inert placeholders for future per-asset-type routes.
|
|
96
|
+
|
|
97
|
+
A typical automation token carries `runs:read`, `runs:write`, and
|
|
98
|
+
`outputs:read`. Grant the rest only where the workload needs them — a read-only
|
|
99
|
+
reporting token, for example, needs no `runs:write`.
|
|
100
|
+
|
|
101
|
+
## Introspection: `whoami`
|
|
102
|
+
|
|
103
|
+
`aex.whoami()` (CLI: `aex whoami`) validates the token and returns the
|
|
104
|
+
workspace id, the token's scopes, and — on current platform deployments — a
|
|
105
|
+
`limits` object with the workspace's effective admission caps
|
|
106
|
+
(`maxConcurrentRuns`, `submitRatePerMinute`, `spendCapUsd`, `monthSpendUsd`,
|
|
107
|
+
`balanceUsd`, `balanceGraceFloorUsd`, `paymentMethodStatus`), resolved by the
|
|
108
|
+
same code the submit gates enforce. Use it as a cheap credential check and to
|
|
109
|
+
anticipate `429`/`402` rejections before submitting — see
|
|
110
|
+
[Limits & quotas](limits-and-quotas.md) and [Errors](errors.md).
|
|
111
|
+
|
|
112
|
+
## Rotation and revocation
|
|
113
|
+
|
|
114
|
+
- **Rotate** by creating a new token in the dashboard, switching your
|
|
115
|
+
deployment to it, then deleting the old one. Tokens are independent — both
|
|
116
|
+
stay valid during the switch, so rotation needs no downtime.
|
|
117
|
+
- **Revoke** by deleting the token in the dashboard; deletion takes effect
|
|
118
|
+
immediately (allow up to a minute for in-flight caches to expire).
|
|
119
|
+
- Token create/delete are rate-limited per workspace (see
|
|
120
|
+
[Limits & quotas](limits-and-quotas.md)).
|
|
121
|
+
- If you cannot reach the dashboard (or suspect workspace-level compromise),
|
|
122
|
+
contact <support@aex.dev>.
|
|
123
|
+
|
|
124
|
+
Provider keys (`apiKeys`) and runtime secrets are a separate, per-call surface —
|
|
125
|
+
see [Credentials](credentials.md) and [Secrets](secrets.md).
|