@aexhq/sdk 0.52.0 → 0.53.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 +99 -41
- package/dist/client/aex.d.ts +6 -1
- package/dist/client/aex.js +51 -10
- package/dist/client/aex.js.map +1 -1
- package/dist/client/credentials.d.ts +3 -3
- package/dist/client/credentials.js +8 -8
- package/dist/client/credentials.js.map +1 -1
- package/dist/client/routing.d.ts +1 -1
- package/dist/client/routing.js +2 -5
- package/dist/client/routing.js.map +1 -1
- package/dist/files/workspace-files.d.ts +55 -0
- package/dist/files/workspace-files.js +150 -0
- package/dist/files/workspace-files.js.map +1 -0
- package/dist/generated/errors.js +2 -17
- package/dist/generated/errors.js.map +1 -1
- package/dist/generated/models.d.ts +248 -796
- package/dist/generated/models.js +4 -4
- package/dist/generated/models.js.map +1 -1
- package/dist/generated/resources.d.ts +72 -519
- package/dist/generated/resources.js +49 -428
- package/dist/generated/resources.js.map +1 -1
- package/dist/generated/routes.d.ts +4 -4
- package/dist/generated/routes.js +190 -1600
- package/dist/generated/routes.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/transport/transport.d.ts +9 -1
- package/dist/transport/transport.js +79 -1
- package/dist/transport/transport.js.map +1 -1
- package/package.json +1 -5
- package/dist/node/session-file-limits.d.ts +0 -4
- package/dist/node/session-file-limits.js +0 -7
- package/dist/node/session-file-limits.js.map +0 -1
- package/dist/node/session-files.d.ts +0 -80
- package/dist/node/session-files.js +0 -254
- package/dist/node/session-files.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,72 +1,130 @@
|
|
|
1
1
|
# @aexhq/sdk
|
|
2
2
|
|
|
3
|
-
The zero-dependency TypeScript SDK for AEX
|
|
3
|
+
The zero-dependency TypeScript SDK for the session-centered AEX public API.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm
|
|
6
|
+
npm install @aexhq/sdk
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
import { Aex, assertId, newId } from "@aexhq/sdk";
|
|
9
|
+
## Quickstart
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
```ts
|
|
12
|
+
import { Aex, newId } from "@aexhq/sdk";
|
|
13
13
|
|
|
14
|
+
const aex = new Aex({ apiKey: process.env.AEX_WORKSPACE_API_KEY! });
|
|
14
15
|
const session = await aex.sessions.sessionCreate({
|
|
15
16
|
body: {
|
|
16
17
|
provider: "openai",
|
|
17
18
|
model: process.env.AEX_MODEL!,
|
|
18
|
-
|
|
19
|
-
"provider_credential",
|
|
20
|
-
process.env.AEX_PROVIDER_CREDENTIAL_ID,
|
|
21
|
-
),
|
|
19
|
+
providerApiKey: process.env.AEX_PROVIDER_API_KEY!,
|
|
22
20
|
},
|
|
23
21
|
idempotencyKey: crypto.randomUUID(),
|
|
24
22
|
});
|
|
25
23
|
|
|
24
|
+
const committed = (async () => {
|
|
25
|
+
for await (const frame of aex.sessions.sessionMessagesStream({
|
|
26
|
+
sessionId: session.id,
|
|
27
|
+
})) {
|
|
28
|
+
if (frame.kind === "committed" && frame.message?.role === "assistant") {
|
|
29
|
+
return frame.message;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
throw new Error("message stream ended before the assistant committed");
|
|
33
|
+
})();
|
|
34
|
+
|
|
26
35
|
await aex.sessions.sessionMessageSend({
|
|
27
36
|
sessionId: session.id,
|
|
28
37
|
body: { text: "Inspect the tests and summarize the failures." },
|
|
29
38
|
idempotencyKey: crypto.randomUUID(),
|
|
30
39
|
});
|
|
40
|
+
console.log(await committed);
|
|
31
41
|
|
|
32
|
-
await aex.sessions.
|
|
42
|
+
await aex.sessions.sessionTerminate({
|
|
33
43
|
sessionId: session.id,
|
|
34
44
|
body: {},
|
|
35
45
|
operationId: newId("operation"),
|
|
36
46
|
});
|
|
37
47
|
```
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
Session creation takes an exact provider/model pair and a write-only
|
|
50
|
+
`providerApiKey`. The key is encrypted for that session, never returned, and
|
|
51
|
+
never reused by another session. Supported provider families are OpenAI,
|
|
52
|
+
Anthropic, DeepSeek, xAI, Meta, Moonshot AI, and Alibaba.
|
|
53
|
+
|
|
54
|
+
## Client surface
|
|
55
|
+
|
|
56
|
+
Regional session and file calls use a workspace `apiKey`. Central bootstrap,
|
|
57
|
+
API-key, and billing calls use a GitHub `dashboardSession`. A client may hold
|
|
58
|
+
both; the SDK sends each credential only to its owning API plane.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const aex = new Aex({
|
|
62
|
+
apiKey: process.env.AEX_WORKSPACE_API_KEY!,
|
|
63
|
+
dashboardSession: process.env.AEX_DASHBOARD_SESSION!,
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Generated namespaces are `apiKeys`, `auth`, `billing`, `bootstrap`, `registry`,
|
|
68
|
+
`sessions`, and `uploads`. `aex.workspaceFiles` adds verified convenience
|
|
69
|
+
helpers for the latest-only file API. `ROUTES` and `aex.execute(...)` expose the
|
|
70
|
+
same generated contract without a second handwritten route table.
|
|
71
|
+
|
|
72
|
+
## Sessions and sandboxes
|
|
73
|
+
|
|
74
|
+
A session is the only public execution resource. It owns committed messages,
|
|
75
|
+
one active root message, durable tool effects, native subagents, frozen file
|
|
76
|
+
mounts, sandbox state, and telemetry. There is no public run resource.
|
|
77
|
+
|
|
78
|
+
The default sandbox starts preparing in the background when session creation
|
|
79
|
+
commits, then suspends when no tool call is waiting. A sandbox tool call waits
|
|
80
|
+
for the exact generation to become ready and resumes it when required. Set
|
|
81
|
+
`sandbox.enabled` to `false` to allocate no sandbox; sandbox-only tools then
|
|
82
|
+
return a structured error the model can handle.
|
|
83
|
+
|
|
84
|
+
Cancel stops active work and returns the session to idle. Terminate destroys
|
|
85
|
+
sandbox compute while retaining messages and telemetry. Delete irreversibly
|
|
86
|
+
removes session-owned content; independent workspace files remain.
|
|
87
|
+
|
|
88
|
+
## Files, tools, and MCP
|
|
89
|
+
|
|
90
|
+
`aex.workspaceFiles` provides `put`, `upload`, `get`, `list`, `download`, and
|
|
91
|
+
`delete`. Each logical name has only one current value. Inputs may be inline
|
|
92
|
+
text or bytes, an HTTPS URL, or a direct multipart upload. Session creation
|
|
93
|
+
freezes selected names and mount paths, so later overwrites do not change an
|
|
94
|
+
existing session.
|
|
95
|
+
|
|
96
|
+
Messages are text-only. Upload arbitrary images, PDFs, video, archives, or
|
|
97
|
+
source and tell the model which path under `/workspace` to inspect.
|
|
98
|
+
|
|
99
|
+
The built-in tool surface is Bash, file read/edit/write, MCP,
|
|
100
|
+
`storage.persist`, and native create/wait/stop subagent tools. Configure remote
|
|
101
|
+
Streamable HTTP or sandbox-process MCP per session. Large tool results keep a
|
|
102
|
+
bounded preview and the full bytes at a sandbox path; `storage.persist`
|
|
103
|
+
publishes a chosen sandbox file as the latest workspace value. Native
|
|
104
|
+
subagents are bounded to 12 child identities per session lifetime and depth 3.
|
|
105
|
+
|
|
106
|
+
`sessionMessageSend` accepts optional native JSON Schema output through
|
|
107
|
+
`responseFormat`. Strict structured output is admitted only for a qualified
|
|
108
|
+
provider/model capability; AEX does not present prompt emulation as strict.
|
|
109
|
+
|
|
110
|
+
## Streaming, telemetry, and billing
|
|
111
|
+
|
|
112
|
+
`sessionMessagesStream` emits bounded preview, gap, committed, reconcile, and
|
|
113
|
+
heartbeat frames. Committed messages preserve provider-neutral text, tool-call,
|
|
114
|
+
and tool-result parts.
|
|
115
|
+
|
|
116
|
+
Session telemetry is available as a live stream, retained replay, and verified
|
|
117
|
+
compressed download. Billing resources expose prepaid balance, saved-card
|
|
118
|
+
display metadata, hosted card setup and top-up, immutable transactions, and
|
|
119
|
+
usage. Billing methods require `dashboardSession`; session and file methods
|
|
120
|
+
require `apiKey`.
|
|
121
|
+
|
|
122
|
+
See the [AEX documentation](https://aex.dev/docs) for complete examples.
|
|
123
|
+
|
|
124
|
+
## Status
|
|
125
|
+
|
|
126
|
+
AEX is in active prelaunch development. Expect breaking changes and do not rely
|
|
127
|
+
on the hosted service for production workloads yet.
|
|
70
128
|
|
|
71
129
|
## License
|
|
72
130
|
|
package/dist/client/aex.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type AexTransport } from "../transport/transport.js";
|
|
2
2
|
import { type RouteId } from "../generated/routes.js";
|
|
3
3
|
import { GeneratedResources, type ExecuteOptions } from "../generated/resources.js";
|
|
4
|
+
import { WorkspaceFiles } from "../files/workspace-files.js";
|
|
4
5
|
export interface AexOptions {
|
|
5
|
-
readonly apiKey
|
|
6
|
+
readonly apiKey?: string;
|
|
7
|
+
readonly dashboardSession?: string;
|
|
6
8
|
readonly centralBaseUrl?: string;
|
|
7
9
|
readonly regionalBaseUrl?: string;
|
|
8
10
|
readonly workspaceId?: string;
|
|
@@ -22,9 +24,12 @@ export interface AexOptions {
|
|
|
22
24
|
export declare class Aex extends GeneratedResources {
|
|
23
25
|
#private;
|
|
24
26
|
readonly transport: AexTransport;
|
|
27
|
+
/** Latest-only workspace files, including verified direct upload/download helpers. */
|
|
28
|
+
readonly workspaceFiles: WorkspaceFiles;
|
|
25
29
|
constructor(apiKey: string, options?: Omit<AexOptions, "apiKey">);
|
|
26
30
|
constructor(options: AexOptions);
|
|
27
31
|
execute<T>(routeId: RouteId, bindings?: Readonly<Record<string, string>>, options?: ExecuteOptions): Promise<T>;
|
|
32
|
+
stream<T>(routeId: RouteId, bindings?: Readonly<Record<string, string>>, options?: ExecuteOptions): AsyncIterable<T>;
|
|
28
33
|
static buildInfo(): Readonly<{
|
|
29
34
|
packageVersion: string;
|
|
30
35
|
contractDigest: string;
|
package/dist/client/aex.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DashboardSession, WorkspaceApiKey } from "./credentials.js";
|
|
2
2
|
import { resolveCentralBaseUrl, resolveRegionalBaseUrl } from "./routing.js";
|
|
3
3
|
import { FetchTransport } from "../transport/transport.js";
|
|
4
4
|
import { CONTRACT_DIGEST, ROUTES } from "../generated/routes.js";
|
|
5
5
|
import { GeneratedResources } from "../generated/resources.js";
|
|
6
|
-
|
|
6
|
+
import { WorkspaceFiles } from "../files/workspace-files.js";
|
|
7
|
+
import { apiErrorFromResponse } from "../transport/errors.js";
|
|
8
|
+
const SDK_VERSION = "0.53.1";
|
|
7
9
|
/**
|
|
8
10
|
* The client.
|
|
9
11
|
*
|
|
@@ -15,26 +17,55 @@ const SDK_VERSION = "0.52.0";
|
|
|
15
17
|
*/
|
|
16
18
|
export class Aex extends GeneratedResources {
|
|
17
19
|
transport;
|
|
18
|
-
|
|
20
|
+
/** Latest-only workspace files, including verified direct upload/download helpers. */
|
|
21
|
+
workspaceFiles;
|
|
22
|
+
#apiKey;
|
|
23
|
+
#dashboardSession;
|
|
19
24
|
#signal;
|
|
20
25
|
constructor(apiKeyOrOptions, rest = {}) {
|
|
21
26
|
super();
|
|
22
27
|
const options = typeof apiKeyOrOptions === "string"
|
|
23
28
|
? { ...rest, apiKey: apiKeyOrOptions }
|
|
24
29
|
: apiKeyOrOptions;
|
|
25
|
-
this.#
|
|
30
|
+
this.#apiKey = options.apiKey ? WorkspaceApiKey.parse(options.apiKey) : undefined;
|
|
31
|
+
this.#dashboardSession = options.dashboardSession
|
|
32
|
+
? DashboardSession.parse(options.dashboardSession)
|
|
33
|
+
: undefined;
|
|
34
|
+
if (!this.#apiKey && !this.#dashboardSession) {
|
|
35
|
+
throw new TypeError("Aex requires apiKey or dashboardSession");
|
|
36
|
+
}
|
|
26
37
|
this.#signal = options.signal;
|
|
27
38
|
if (options.transport) {
|
|
28
39
|
this.transport = options.transport;
|
|
29
40
|
}
|
|
30
41
|
else {
|
|
42
|
+
const regional = resolveRegionalBaseUrl(this.#apiKey ?? this.#dashboardSession, options);
|
|
31
43
|
this.transport = new FetchTransport({
|
|
32
44
|
central: resolveCentralBaseUrl(options.centralBaseUrl),
|
|
33
|
-
regional:
|
|
45
|
+
...(regional ? { regional } : {}),
|
|
34
46
|
}, options.fetch);
|
|
35
47
|
}
|
|
48
|
+
this.workspaceFiles = new WorkspaceFiles(this, options.fetch);
|
|
36
49
|
}
|
|
37
50
|
async execute(routeId, bindings = {}, options = {}) {
|
|
51
|
+
const request = this.#request(routeId, bindings, options);
|
|
52
|
+
const response = await this.transport.execute(request);
|
|
53
|
+
if (response.status < 200 || response.status >= 300) {
|
|
54
|
+
throw apiErrorFromResponse(routeId, response.status, response.body, response.headers);
|
|
55
|
+
}
|
|
56
|
+
return response.body;
|
|
57
|
+
}
|
|
58
|
+
async *stream(routeId, bindings = {}, options = {}) {
|
|
59
|
+
const request = this.#request(routeId, bindings, options);
|
|
60
|
+
const response = await this.transport.stream(request);
|
|
61
|
+
if (response.status < 200 || response.status >= 300) {
|
|
62
|
+
throw apiErrorFromResponse(routeId, response.status, response.error, response.headers);
|
|
63
|
+
}
|
|
64
|
+
if (!response.frames)
|
|
65
|
+
throw new TypeError(`stream route ${routeId} returned no frame body`);
|
|
66
|
+
yield* response.frames;
|
|
67
|
+
}
|
|
68
|
+
#request(routeId, bindings, options) {
|
|
38
69
|
const route = ROUTES[routeId];
|
|
39
70
|
let path = route.path;
|
|
40
71
|
for (const [name, value] of Object.entries(bindings)) {
|
|
@@ -43,11 +74,23 @@ export class Aex extends GeneratedResources {
|
|
|
43
74
|
const query = new URLSearchParams(options.query ?? {}).toString();
|
|
44
75
|
if (query)
|
|
45
76
|
path = `${path}?${query}`;
|
|
77
|
+
const transport = route.transport;
|
|
78
|
+
const credential = route.plane === "regional" ? this.#apiKey : this.#dashboardSession;
|
|
79
|
+
if (!credential && routeId !== "dashboard_session_create") {
|
|
80
|
+
throw new TypeError(route.plane === "regional"
|
|
81
|
+
? "a workspace API key is required for regional routes"
|
|
82
|
+
: "a dashboard session is required for central routes");
|
|
83
|
+
}
|
|
46
84
|
const headers = new Headers({
|
|
47
|
-
|
|
48
|
-
|
|
85
|
+
accept: transport === "binary"
|
|
86
|
+
? "application/octet-stream"
|
|
87
|
+
: transport === "ndjson"
|
|
88
|
+
? "application/x-ndjson"
|
|
89
|
+
: "application/json",
|
|
49
90
|
"Aex-Client": `aex-sdk/${SDK_VERSION}`,
|
|
50
91
|
});
|
|
92
|
+
if (credential)
|
|
93
|
+
headers.set("authorization", credential.authorizationHeader());
|
|
51
94
|
if (options.idempotencyKey)
|
|
52
95
|
headers.set("Idempotency-Key", options.idempotencyKey);
|
|
53
96
|
if (options.operationId)
|
|
@@ -66,7 +109,7 @@ export class Aex extends GeneratedResources {
|
|
|
66
109
|
bytes = encodeCanonicalJson(options.body);
|
|
67
110
|
}
|
|
68
111
|
}
|
|
69
|
-
|
|
112
|
+
return {
|
|
70
113
|
routeId,
|
|
71
114
|
method: route.method,
|
|
72
115
|
path,
|
|
@@ -74,8 +117,6 @@ export class Aex extends GeneratedResources {
|
|
|
74
117
|
...(bytes ? { body: bytes } : {}),
|
|
75
118
|
...(this.#signal ? { signal: this.#signal } : {}),
|
|
76
119
|
};
|
|
77
|
-
const response = await this.transport.execute(request);
|
|
78
|
-
return response.body;
|
|
79
120
|
}
|
|
80
121
|
static buildInfo() {
|
|
81
122
|
return Object.freeze({ packageVersion: SDK_VERSION, contractDigest: CONTRACT_DIGEST, sourceSha: "development" });
|
package/dist/client/aex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aex.js","sourceRoot":"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AK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAgC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACvE,MAAM,MAAM,GAAI,KAAiC,CAAC,GAAG,CAAC,CAAC;QACvD,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -15,11 +15,11 @@ export declare class WorkspaceApiKey extends Credential {
|
|
|
15
15
|
workspaceId(): string;
|
|
16
16
|
regionalBaseUrl(): string;
|
|
17
17
|
}
|
|
18
|
-
export declare class
|
|
18
|
+
export declare class DashboardSession extends Credential {
|
|
19
19
|
private constructor();
|
|
20
|
-
static parse(value: string):
|
|
20
|
+
static parse(value: string): DashboardSession;
|
|
21
21
|
}
|
|
22
|
-
export type ParsedCredential = WorkspaceApiKey |
|
|
22
|
+
export type ParsedCredential = WorkspaceApiKey | DashboardSession;
|
|
23
23
|
export declare function parseCredential(value: string): ParsedCredential;
|
|
24
24
|
export declare function regionalHost(region: RegionCode): string;
|
|
25
25
|
export {};
|
|
@@ -5,7 +5,7 @@ const SECRET = "([A-Za-z0-9_-]{42}[AEIMQUYcgkosw048])";
|
|
|
5
5
|
// region that serves it and the workspace it authorizes, so a regional endpoint
|
|
6
6
|
// can address every row it must read without a central round trip first.
|
|
7
7
|
const WORKSPACE_KEY = new RegExp(`^aex_wk_(use1|use2|usw2|apne1|euw1)_${BODY}_${BODY}_${SECRET}$`);
|
|
8
|
-
const
|
|
8
|
+
const DASHBOARD_SESSION = new RegExp(`^aex_ds_${BODY}_${SECRET}$`);
|
|
9
9
|
const CROCKFORD = "0123456789abcdefghjkmnpqrstvwxyz";
|
|
10
10
|
const HOSTS = Object.freeze({
|
|
11
11
|
use1: "https://us-east-1.api.aex.dev",
|
|
@@ -55,24 +55,24 @@ export class WorkspaceApiKey extends Credential {
|
|
|
55
55
|
return HOSTS[this.#region];
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
export class
|
|
58
|
+
export class DashboardSession extends Credential {
|
|
59
59
|
constructor(value) {
|
|
60
60
|
super(value);
|
|
61
61
|
}
|
|
62
62
|
static parse(value) {
|
|
63
|
-
const match =
|
|
63
|
+
const match = DASHBOARD_SESSION.exec(value);
|
|
64
64
|
if (!match || !isUuid7Body(match[1] ?? "")) {
|
|
65
|
-
throw new AexConfigError("invalid credential: expected an
|
|
65
|
+
throw new AexConfigError("invalid credential: expected an aex_ds_ dashboard session");
|
|
66
66
|
}
|
|
67
|
-
return new
|
|
67
|
+
return new DashboardSession(value);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
export function parseCredential(value) {
|
|
71
71
|
if (value.startsWith("aex_wk_"))
|
|
72
72
|
return WorkspaceApiKey.parse(value);
|
|
73
|
-
if (value.startsWith("
|
|
74
|
-
return
|
|
75
|
-
throw new AexConfigError("invalid credential: expected prefix aex_wk_ or
|
|
73
|
+
if (value.startsWith("aex_ds_"))
|
|
74
|
+
return DashboardSession.parse(value);
|
|
75
|
+
throw new AexConfigError("invalid credential: expected prefix aex_wk_ or aex_ds_");
|
|
76
76
|
}
|
|
77
77
|
export function regionalHost(region) {
|
|
78
78
|
return HOSTS[region];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/client/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG,uCAAuC,CAAC;AACvD,+EAA+E;AAC/E,gFAAgF;AAChF,yEAAyE;AACzE,MAAM,aAAa,GAAG,IAAI,MAAM,CAC9B,uCAAuC,IAAI,IAAI,IAAI,IAA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IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;AACpE,CAAC"}
|
package/dist/client/routing.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export interface RegionalRoutingOptions {
|
|
|
3
3
|
readonly regionalBaseUrl?: string;
|
|
4
4
|
readonly workspaceId?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function resolveRegionalBaseUrl(credential: ParsedCredential, options: RegionalRoutingOptions): string;
|
|
6
|
+
export declare function resolveRegionalBaseUrl(credential: ParsedCredential, options: RegionalRoutingOptions): string | undefined;
|
|
7
7
|
export declare function resolveCentralBaseUrl(value?: string): string;
|
package/dist/client/routing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WorkspaceApiKey } from "./credentials.js";
|
|
2
2
|
import { AexConfigError } from "../transport/errors.js";
|
|
3
3
|
function validateBaseUrl(value) {
|
|
4
4
|
let url;
|
|
@@ -18,10 +18,7 @@ export function resolveRegionalBaseUrl(credential, options) {
|
|
|
18
18
|
return validateBaseUrl(options.regionalBaseUrl);
|
|
19
19
|
if (credential instanceof WorkspaceApiKey)
|
|
20
20
|
return credential.regionalBaseUrl();
|
|
21
|
-
|
|
22
|
-
throw new AexConfigError("an account token with workspaceId must resolve placement through workspace_get before regional I/O");
|
|
23
|
-
}
|
|
24
|
-
throw new AexConfigError("an account token requires regionalBaseUrl or workspaceId for regional routes");
|
|
21
|
+
return undefined;
|
|
25
22
|
}
|
|
26
23
|
export function resolveCentralBaseUrl(value = "https://api.aex.dev") {
|
|
27
24
|
return validateBaseUrl(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/client/routing.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/client/routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,SAAS,eAAe,CAAC,KAAa;IACpC,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,cAAc,CAAC,wCAAwC,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACxF,MAAM,IAAI,cAAc,CAAC,gEAAgE,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,UAA4B,EAC5B,OAA+B;IAE/B,IAAI,OAAO,CAAC,eAAe;QAAE,OAAO,eAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7E,IAAI,UAAU,YAAY,eAAe;QAAE,OAAO,UAAU,CAAC,eAAe,EAAE,CAAC;IAC/E,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAK,GAAG,qBAAqB;IACjE,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ResourceExecutor } from "../generated/resources.js";
|
|
2
|
+
/** Inline, URL and direct-upload inputs accepted by the latest-only file API. */
|
|
3
|
+
export type WorkspaceFileInput = {
|
|
4
|
+
readonly type: "bytes";
|
|
5
|
+
readonly bytes: Uint8Array;
|
|
6
|
+
} | {
|
|
7
|
+
readonly type: "text";
|
|
8
|
+
readonly text: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly type: "url";
|
|
11
|
+
readonly url: string;
|
|
12
|
+
};
|
|
13
|
+
/** One current workspace-file response. No public version identity exists. */
|
|
14
|
+
export interface CurrentWorkspaceFile {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly state: "pending" | "ready" | "failed";
|
|
17
|
+
readonly value?: {
|
|
18
|
+
readonly content: {
|
|
19
|
+
readonly sha256: string;
|
|
20
|
+
readonly sizeBytes: string;
|
|
21
|
+
};
|
|
22
|
+
readonly mediaType: string;
|
|
23
|
+
readonly mode: "0644" | "0755";
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface WorkspaceFilePutOptions {
|
|
27
|
+
readonly mediaType?: string;
|
|
28
|
+
readonly mode?: "0644" | "0755";
|
|
29
|
+
readonly idempotencyKey?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Convenience surface over the seven latest-only file/upload operations.
|
|
33
|
+
*
|
|
34
|
+
* Direct object-store transfers replay only the exact signed headers returned
|
|
35
|
+
* by Aex. The guest is never given AWS credentials; `storage.persist` uses the
|
|
36
|
+
* same private grant shape from inside Tool Mux.
|
|
37
|
+
*/
|
|
38
|
+
export declare class WorkspaceFiles {
|
|
39
|
+
#private;
|
|
40
|
+
constructor(executor: ResourceExecutor, fetchLike?: typeof fetch);
|
|
41
|
+
put(name: string, input: WorkspaceFileInput, options?: WorkspaceFilePutOptions): Promise<CurrentWorkspaceFile>;
|
|
42
|
+
/** Uploads arbitrary bytes and publishes them to the admitted logical name. */
|
|
43
|
+
upload(name: string, bytes: Uint8Array, options?: WorkspaceFilePutOptions): Promise<CurrentWorkspaceFile>;
|
|
44
|
+
get(name: string): Promise<CurrentWorkspaceFile>;
|
|
45
|
+
list(query?: {
|
|
46
|
+
readonly cursor?: string;
|
|
47
|
+
readonly limit?: number;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
readonly items: ReadonlyArray<CurrentWorkspaceFile>;
|
|
50
|
+
readonly nextCursor?: string;
|
|
51
|
+
}>;
|
|
52
|
+
delete(name: string): Promise<void>;
|
|
53
|
+
/** Downloads and verifies the exact current ready bytes. */
|
|
54
|
+
download(name: string): Promise<Uint8Array>;
|
|
55
|
+
}
|