@aexhq/sdk 0.13.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/LICENSE +201 -0
- package/README.md +160 -0
- package/dist/_contracts/connection-ticket.d.ts +21 -0
- package/dist/_contracts/connection-ticket.js +49 -0
- package/dist/_contracts/event-envelope.d.ts +276 -0
- package/dist/_contracts/event-envelope.js +324 -0
- package/dist/_contracts/event-stream-client.d.ts +47 -0
- package/dist/_contracts/event-stream-client.js +141 -0
- package/dist/_contracts/http.d.ts +35 -0
- package/dist/_contracts/http.js +114 -0
- package/dist/_contracts/index.d.ts +28 -0
- package/dist/_contracts/index.js +29 -0
- package/dist/_contracts/managed-key.d.ts +74 -0
- package/dist/_contracts/managed-key.js +110 -0
- package/dist/_contracts/operations.d.ts +237 -0
- package/dist/_contracts/operations.js +632 -0
- package/dist/_contracts/provider-support.d.ts +220 -0
- package/dist/_contracts/provider-support.js +90 -0
- package/dist/_contracts/proxy-protocol.d.ts +257 -0
- package/dist/_contracts/proxy-protocol.js +234 -0
- package/dist/_contracts/proxy-validation.d.ts +19 -0
- package/dist/_contracts/proxy-validation.js +51 -0
- package/dist/_contracts/run-artifacts.d.ts +47 -0
- package/dist/_contracts/run-artifacts.js +101 -0
- package/dist/_contracts/run-config.d.ts +304 -0
- package/dist/_contracts/run-config.js +659 -0
- package/dist/_contracts/run-cost.d.ts +125 -0
- package/dist/_contracts/run-cost.js +616 -0
- package/dist/_contracts/run-custody.d.ts +226 -0
- package/dist/_contracts/run-custody.js +465 -0
- package/dist/_contracts/run-record.d.ts +127 -0
- package/dist/_contracts/run-record.js +177 -0
- package/dist/_contracts/run-retention.d.ts +213 -0
- package/dist/_contracts/run-retention.js +484 -0
- package/dist/_contracts/run-unit.d.ts +194 -0
- package/dist/_contracts/run-unit.js +215 -0
- package/dist/_contracts/runner-event.d.ts +114 -0
- package/dist/_contracts/runner-event.js +187 -0
- package/dist/_contracts/runtime-manifest.d.ts +106 -0
- package/dist/_contracts/runtime-manifest.js +98 -0
- package/dist/_contracts/runtime-security-profile.d.ts +27 -0
- package/dist/_contracts/runtime-security-profile.js +82 -0
- package/dist/_contracts/runtime-sizes.d.ts +144 -0
- package/dist/_contracts/runtime-sizes.js +136 -0
- package/dist/_contracts/runtime-types.d.ts +212 -0
- package/dist/_contracts/runtime-types.js +2 -0
- package/dist/_contracts/sdk-errors.d.ts +34 -0
- package/dist/_contracts/sdk-errors.js +52 -0
- package/dist/_contracts/sdk-secrets.d.ts +31 -0
- package/dist/_contracts/sdk-secrets.js +220 -0
- package/dist/_contracts/side-effect-audit.d.ts +129 -0
- package/dist/_contracts/side-effect-audit.js +494 -0
- package/dist/_contracts/sse.d.ts +74 -0
- package/dist/_contracts/sse.js +0 -0
- package/dist/_contracts/stable.d.ts +26 -0
- package/dist/_contracts/stable.js +44 -0
- package/dist/_contracts/status.d.ts +19 -0
- package/dist/_contracts/status.js +61 -0
- package/dist/_contracts/submission.d.ts +383 -0
- package/dist/_contracts/submission.js +1380 -0
- package/dist/agents-md.d.ts +46 -0
- package/dist/agents-md.js +83 -0
- package/dist/agents-md.js.map +1 -0
- package/dist/asset-upload.d.ts +66 -0
- package/dist/asset-upload.js +168 -0
- package/dist/asset-upload.js.map +1 -0
- package/dist/bundle.d.ts +33 -0
- package/dist/bundle.js +89 -0
- package/dist/bundle.js.map +1 -0
- package/dist/cli.mjs +4140 -0
- package/dist/cli.mjs.sha256 +1 -0
- package/dist/client.d.ts +460 -0
- package/dist/client.js +857 -0
- package/dist/client.js.map +1 -0
- package/dist/fetch-archive.d.ts +16 -0
- package/dist/fetch-archive.js +170 -0
- package/dist/fetch-archive.js.map +1 -0
- package/dist/file.d.ts +57 -0
- package/dist/file.js +153 -0
- package/dist/file.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +84 -0
- package/dist/mcp-server.js +114 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/node-fs.d.ts +12 -0
- package/dist/node-fs.js +44 -0
- package/dist/node-fs.js.map +1 -0
- package/dist/proxy-endpoint.d.ts +131 -0
- package/dist/proxy-endpoint.js +147 -0
- package/dist/proxy-endpoint.js.map +1 -0
- package/dist/skill.d.ts +117 -0
- package/dist/skill.js +169 -0
- package/dist/skill.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.js +10 -0
- package/dist/version.js.map +1 -0
- package/docs/cleanup.md +38 -0
- package/docs/credentials.md +153 -0
- package/docs/events.md +76 -0
- package/docs/mcp.md +47 -0
- package/docs/outputs.md +157 -0
- package/docs/product-boundaries.md +57 -0
- package/docs/provider-runtime-capabilities.md +103 -0
- package/docs/quickstart.md +110 -0
- package/docs/release.md +99 -0
- package/docs/run-config.md +53 -0
- package/docs/run-record.md +39 -0
- package/docs/skills.md +139 -0
- package/docs/testing.md +29 -0
- package/package.json +47 -0
package/docs/skills.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Skills
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Skills
|
|
6
|
+
|
|
7
|
+
Skill inputs accepted by the platform:
|
|
8
|
+
|
|
9
|
+
- provider-managed Anthropic prebuilt Agent Skills (`pdf`, `xlsx`,
|
|
10
|
+
`docx`, `pptx` — see the
|
|
11
|
+
[Anthropic Agent Skills overview](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview)
|
|
12
|
+
for the live catalog). Note that Anthropic web search is a Messages
|
|
13
|
+
API *tool* (`{ type: "web_search_…" }`), not an Agent Skill, and is
|
|
14
|
+
not currently exposed through `submitRun`;
|
|
15
|
+
- existing custom provider skill IDs;
|
|
16
|
+
- workspace skill bundles (persistent, referenced by `skl_*` id);
|
|
17
|
+
- inline-supplied bundles passed directly at `submitRun` — these
|
|
18
|
+
persist on aex as workspace skills with auto-suffixed names,
|
|
19
|
+
one row per submission (see "Inline supply" below).
|
|
20
|
+
|
|
21
|
+
**Routing at session create:** bundles that contain `SKILL.md` at the
|
|
22
|
+
bundle root are registered with Anthropic's Skills API
|
|
23
|
+
(`POST /v1/skills`) and surface to the agent as auto-discoverable
|
|
24
|
+
skills. Bundles without `SKILL.md` mount under
|
|
25
|
+
`/mnt/session/uploads/aex/assets/<skl_id>/<rel-path>` in the agent
|
|
26
|
+
container — the agent reads them by explicit path reference in the
|
|
27
|
+
prompt.
|
|
28
|
+
|
|
29
|
+
The platform also mounts the `aex` CLI at
|
|
30
|
+
`/mnt/session/uploads/aex/aex` and a per-run manifest at
|
|
31
|
+
`/mnt/session/uploads/aex/index.json` on **every** run. Skills
|
|
32
|
+
invoke the managed HTTP proxy via
|
|
33
|
+
`node /mnt/session/uploads/aex/aex proxy …` — see
|
|
34
|
+
`credentials.md` for the policy/auth model.
|
|
35
|
+
|
|
36
|
+
## Inline supply at `submitRun`
|
|
37
|
+
|
|
38
|
+
`Skill.fromFiles({name, files})` and `Skill.fromPath(rootDir, {name})`
|
|
39
|
+
build an **unstaged** `Skill`. The instance carries the canonicalised
|
|
40
|
+
zip bytes and the `sha256:<hex>` content hash:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { AexClient, Skill } from "@aexhq/sdk";
|
|
44
|
+
|
|
45
|
+
const client = new AexClient({ apiToken });
|
|
46
|
+
|
|
47
|
+
await client.submitRun({
|
|
48
|
+
model, prompt,
|
|
49
|
+
skills: [await Skill.fromFiles({ name: "rules", files })],
|
|
50
|
+
secrets: { anthropic: { apiKey } }
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`client.submitRun` walks the `skills` array, sends a multipart body
|
|
55
|
+
alongside the JSON submission, and materializes the bytes to
|
|
56
|
+
content-addressable, workspace-scoped R2 storage before the run lands.
|
|
57
|
+
The BFF re-canonicalises the bundle, verifies the advisory hash, and
|
|
58
|
+
persists it as a workspace skill — but with an **auto-suffixed name**
|
|
59
|
+
(`rules-x8q7lk2`) so repeated supplies of the same logical skill across
|
|
60
|
+
many runs produce distinct `skl_*` rows. This is by design: a
|
|
61
|
+
submitted skill is a **per-run artifact**.
|
|
62
|
+
|
|
63
|
+
`contentHash` is `sha256:<hex>` of the canonical bundle zip (the SDK
|
|
64
|
+
normalises file order, mtime, and permissions before hashing).
|
|
65
|
+
Identical inputs always produce the same hash, so the same bytes are a
|
|
66
|
+
no-op upload (content-addressable dedup) on subsequent runs. There is no
|
|
67
|
+
separate workspace pre-upload step.
|
|
68
|
+
|
|
69
|
+
### What auto-suffix looks like
|
|
70
|
+
|
|
71
|
+
Submit `Skill.fromFiles({ name: "rules", files })` three times across
|
|
72
|
+
three runs and the dashboard shows three distinct skills:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
rules-x8q7lk2
|
|
76
|
+
rules-mp2vqa1
|
|
77
|
+
rules-az3lkmt
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Same prefix, different suffix. Each is a real workspace skill — you
|
|
81
|
+
can list, get, download, and delete it through the regular
|
|
82
|
+
`client.skills.*` verbs.
|
|
83
|
+
|
|
84
|
+
### Deletion semantics
|
|
85
|
+
|
|
86
|
+
Soft-deleting a skill (`client.skills.delete(skl_id)` or the
|
|
87
|
+
dashboard's Delete button) marks the row tombstoned. Existing runs
|
|
88
|
+
that pinned a snapshot of the skill keep working — they read from
|
|
89
|
+
`run_skill_snapshots` which preserves the name, hash, size, and
|
|
90
|
+
manifest. The run detail view shows a "deleted" badge for those
|
|
91
|
+
orphan references; the download endpoint returns
|
|
92
|
+
**HTTP 410 Gone** with `{ error: { code: "skill_deleted", … } }`
|
|
93
|
+
when the caller tries to fetch the bytes of a deleted skill.
|
|
94
|
+
|
|
95
|
+
New `submitRun` calls referencing a soft-deleted `skl_*` id are
|
|
96
|
+
rejected before insertion.
|
|
97
|
+
|
|
98
|
+
## Fetch from a signed URL (`Skill.fromUrl`)
|
|
99
|
+
|
|
100
|
+
When your app runs in the cloud with limited storage, you may not want to
|
|
101
|
+
bundle skill bytes with it. Host the skill yourself as a **zip archive**
|
|
102
|
+
(with `SKILL.md` at the archive root) and hand the SDK a temporary signed
|
|
103
|
+
URL — e.g. an S3 presigned URL:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import { AexClient, Skill } from "@aexhq/sdk";
|
|
107
|
+
|
|
108
|
+
const client = new AexClient({ apiToken });
|
|
109
|
+
|
|
110
|
+
await client.submitRun({
|
|
111
|
+
model, prompt,
|
|
112
|
+
skills: [
|
|
113
|
+
await Skill.fromUrl(signedUrl, { name: "rules", sha256: "sha256:<hex>" })
|
|
114
|
+
],
|
|
115
|
+
secrets: { anthropic: { apiKey } }
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`Skill.fromUrl` fetches the archive **in the SDK process** — the URL is
|
|
120
|
+
caller-controlled, so there is no server-side fetch — optionally verifies the
|
|
121
|
+
download against `sha256`, unzips it, and reduces it to the same files map as
|
|
122
|
+
`Skill.fromFiles`. A URL-sourced skill and the identical local skill therefore
|
|
123
|
+
produce the **same canonical asset** and dedup against each other.
|
|
124
|
+
|
|
125
|
+
- The archive must contain `SKILL.md` at its root, or inside a single
|
|
126
|
+
top-level folder, which is stripped automatically. Anything else is
|
|
127
|
+
rejected with an error listing the archive's actual top-level entries.
|
|
128
|
+
- The signed URL only needs to be valid **for this call**. `client.submitRun`
|
|
129
|
+
snapshots the bytes into the run immediately, so the URL can expire
|
|
130
|
+
afterwards with no effect on the run.
|
|
131
|
+
- `sha256` is an optional source-integrity check on the downloaded archive
|
|
132
|
+
(distinct from the canonical bundle hash); a mismatch fails fast before the
|
|
133
|
+
unzip. Signed-URL query strings are never echoed in error messages.
|
|
134
|
+
- The same upload caps apply (10 MB compressed / 50 MB decompressed /
|
|
135
|
+
1000 files); `Skill.fromUrl` materialises the whole bundle, it is not a
|
|
136
|
+
streaming mount.
|
|
137
|
+
|
|
138
|
+
`Skill.fromUrl` is universal (Node 18+ / browser): it uses the global `fetch`,
|
|
139
|
+
or pass one via `{ fetch }`.
|
package/docs/testing.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Testing
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Testing
|
|
6
|
+
|
|
7
|
+
aex uses test-first development.
|
|
8
|
+
For repository changes, default the first meaningful test to blackbox behavior
|
|
9
|
+
from requirements, public contracts, docs, logs, or user-visible evidence before
|
|
10
|
+
reading or changing implementation.
|
|
11
|
+
|
|
12
|
+
Workspace-wide commands:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
pnpm lint # typecheck/build prerequisites + lint
|
|
16
|
+
pnpm test # unit, all packages, deterministic
|
|
17
|
+
pnpm test:user:offline # clean install of packed/published SDK, no live API
|
|
18
|
+
pnpm test:user # live hosted API user tests
|
|
19
|
+
pnpm test:user:heavy # explicit heavy live canary
|
|
20
|
+
pnpm run docs:build # generated docs + Next build
|
|
21
|
+
pnpm run pack:sdk # SDK publish dry-run + public boundary check
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Unit tests are deterministic and may use fakes. Offline user tests install the
|
|
25
|
+
packed or published SDK into clean temp projects and do not need provider
|
|
26
|
+
credentials. Live user tests run against a hosted aex API and fail loudly
|
|
27
|
+
when required env is missing: `AEX_API_URL`, `AEX_API_TOKEN`,
|
|
28
|
+
`DEEPSEEK_API_KEY`, and exactly one of `AEX_USER_TEST_TARBALL` or
|
|
29
|
+
`AEX_USER_TEST_VERSION`.
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aexhq/sdk",
|
|
3
|
+
"version": "0.13.6",
|
|
4
|
+
"description": "TypeScript SDK for running autonomous agent sessions across providers (Anthropic, OpenAI, DeepSeek, Gemini, Mistral) behind one interface.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/aexhq/aex.git"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"aex": "./dist/cli.mjs"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"docs",
|
|
26
|
+
"examples"
|
|
27
|
+
],
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@aexhq/contracts": "0.13.6"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"fflate": "0.8.2"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "node ./scripts/clean-dist.mjs && pnpm --filter @aexhq/contracts run build && pnpm --filter @aexhq/cli run build && tsc -p tsconfig.build.json && node ./scripts/bundle-cli.mjs && node ./scripts/inline-contracts.mjs",
|
|
39
|
+
"lint": "tsc --noEmit",
|
|
40
|
+
"test": "pnpm test:unit",
|
|
41
|
+
"test:unit": "vitest run test/unit",
|
|
42
|
+
"test:security": "vitest run test/security",
|
|
43
|
+
"test:property": "vitest run --passWithNoTests property",
|
|
44
|
+
"test:coverage": "vitest run --coverage test/unit",
|
|
45
|
+
"publish:dry-run": "pnpm publish --dry-run --no-git-checks"
|
|
46
|
+
}
|
|
47
|
+
}
|