@aexhq/sdk 0.28.1 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -7
- package/dist/_contracts/event-guards.d.ts +67 -0
- package/dist/_contracts/event-guards.js +36 -0
- package/dist/_contracts/index.d.ts +2 -0
- package/dist/_contracts/index.js +6 -0
- package/dist/_contracts/run-config.d.ts +3 -3
- package/dist/_contracts/run-config.js +2 -2
- package/dist/_contracts/run-trace.d.ts +7 -0
- package/dist/_contracts/run-trace.js +9 -0
- package/dist/_contracts/runtime-sizes.d.ts +25 -79
- package/dist/_contracts/runtime-sizes.js +18 -39
- package/dist/_contracts/runtime-types.d.ts +31 -0
- package/dist/_contracts/submission.d.ts +40 -17
- package/dist/_contracts/submission.js +45 -18
- package/dist/agents-md.d.ts +4 -1
- package/dist/agents-md.js +10 -9
- package/dist/agents-md.js.map +1 -1
- package/dist/cli.mjs +17823 -3963
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +96 -17
- package/dist/client.js +238 -79
- package/dist/client.js.map +1 -1
- package/dist/data-tools.d.ts +23 -0
- package/dist/data-tools.js +102 -13
- package/dist/data-tools.js.map +1 -1
- package/dist/file.d.ts +4 -1
- package/dist/file.js +10 -9
- package/dist/file.js.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/skill.d.ts +8 -6
- package/dist/skill.js +14 -14
- package/dist/skill.js.map +1 -1
- package/dist/tool.d.ts +4 -1
- package/dist/tool.js +10 -8
- package/dist/tool.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/concepts/agent-tools.md +7 -3
- package/docs/concepts/runs.md +1 -1
- package/docs/defaults.md +3 -2
- package/docs/events.md +32 -9
- package/docs/limits-and-quotas.md +2 -2
- package/docs/networking.md +141 -0
- package/docs/quickstart.md +19 -10
- package/docs/run-config.md +2 -2
- package/examples/chat-corpus.ts +85 -0
- package/package.json +2 -2
|
@@ -115,18 +115,27 @@ export const Providers = {
|
|
|
115
115
|
DOUBAO_CN: "doubao-cn"
|
|
116
116
|
};
|
|
117
117
|
/**
|
|
118
|
-
* Product placement
|
|
119
|
-
* city guarantees: the hosted platform maps
|
|
120
|
-
*
|
|
121
|
-
*
|
|
118
|
+
* Product placement regions accepted on run submission. These are
|
|
119
|
+
* product-level tokens, not exact city guarantees: the hosted platform maps
|
|
120
|
+
* each region to co-located managed Postgres, object storage, run-state
|
|
121
|
+
* placement, and sandbox backing.
|
|
122
|
+
*
|
|
123
|
+
* eu-west → London (Western Europe)
|
|
124
|
+
* us-west → N. California (Western North America)
|
|
125
|
+
* ap-northeast → Seoul (Northeast Asia)
|
|
126
|
+
*
|
|
127
|
+
* Prefer the {@link Regions} accessors over raw strings so a typo is a compile
|
|
128
|
+
* error, not a runtime 400.
|
|
122
129
|
*/
|
|
123
|
-
export const
|
|
124
|
-
/** Symbol-style accessors for the closed
|
|
125
|
-
export const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
export const REGIONS = ["eu-west", "us-west", "ap-northeast"];
|
|
131
|
+
/** Symbol-style accessors for the closed region set — e.g. `Regions.EU_WEST`. */
|
|
132
|
+
export const Regions = {
|
|
133
|
+
/** Western Europe — London. */
|
|
134
|
+
EU_WEST: "eu-west",
|
|
135
|
+
/** Western North America — N. California. */
|
|
136
|
+
US_WEST: "us-west",
|
|
137
|
+
/** Northeast Asia — Seoul. */
|
|
138
|
+
AP_NORTHEAST: "ap-northeast"
|
|
130
139
|
};
|
|
131
140
|
/**
|
|
132
141
|
* Customer-facing runtime selector. Optional on the wire; absent resolves
|
|
@@ -988,6 +997,19 @@ export function optionalPositiveInt(input, field) {
|
|
|
988
997
|
}
|
|
989
998
|
return input;
|
|
990
999
|
}
|
|
1000
|
+
/**
|
|
1001
|
+
* A finite positive NUMBER (fractional allowed — e.g. a USD amount like `2.5`), or
|
|
1002
|
+
* undefined when absent. Rejects non-numbers, NaN/Infinity, and `<= 0`.
|
|
1003
|
+
*/
|
|
1004
|
+
export function optionalPositiveNumber(input, field) {
|
|
1005
|
+
if (input === undefined) {
|
|
1006
|
+
return undefined;
|
|
1007
|
+
}
|
|
1008
|
+
if (typeof input !== "number" || !Number.isFinite(input) || input <= 0) {
|
|
1009
|
+
throw new Error(`${field} must be a positive finite number`);
|
|
1010
|
+
}
|
|
1011
|
+
return input;
|
|
1012
|
+
}
|
|
991
1013
|
function parseOptionalBoundedInt(input, field, min, max) {
|
|
992
1014
|
if (input === undefined) {
|
|
993
1015
|
return undefined;
|
|
@@ -1062,7 +1084,7 @@ export function parseRunSubmissionRequest(input, options = {}) {
|
|
|
1062
1084
|
}
|
|
1063
1085
|
const provider = parseRunProvider(value.provider);
|
|
1064
1086
|
const runtime = parseRuntimeKind(value.runtime);
|
|
1065
|
-
const region =
|
|
1087
|
+
const region = parseRegion(value.region);
|
|
1066
1088
|
const credentialMode = parseCredentialMode(value.credentialMode);
|
|
1067
1089
|
void options;
|
|
1068
1090
|
// Cross-field validation via the centralized runtime-support validator.
|
|
@@ -1189,7 +1211,7 @@ export function parseRunLimits(input) {
|
|
|
1189
1211
|
return undefined;
|
|
1190
1212
|
}
|
|
1191
1213
|
const value = requireRecord(input, "limits");
|
|
1192
|
-
const allowed = new Set(["maxConcurrentChildRuns", "maxSubagentDepth"]);
|
|
1214
|
+
const allowed = new Set(["maxConcurrentChildRuns", "maxSubagentDepth", "maxSpendUsd"]);
|
|
1193
1215
|
for (const key of Object.keys(value)) {
|
|
1194
1216
|
if (!allowed.has(key)) {
|
|
1195
1217
|
throw new Error(`limits.${key} is not an allowed field; permitted: ${[...allowed].join(", ")}`);
|
|
@@ -1197,23 +1219,28 @@ export function parseRunLimits(input) {
|
|
|
1197
1219
|
}
|
|
1198
1220
|
const maxConcurrentChildRuns = optionalPositiveInt(value.maxConcurrentChildRuns, "limits.maxConcurrentChildRuns");
|
|
1199
1221
|
const maxSubagentDepth = optionalPositiveInt(value.maxSubagentDepth, "limits.maxSubagentDepth");
|
|
1222
|
+
// maxSpendUsd is a USD amount (may be fractional, e.g. $2.50) so it is a positive
|
|
1223
|
+
// NUMBER, not a positive int. Clamping to the workspace/platform ceiling is the
|
|
1224
|
+
// resolver's job; here we only enforce shape + positivity.
|
|
1225
|
+
const maxSpendUsd = optionalPositiveNumber(value.maxSpendUsd, "limits.maxSpendUsd");
|
|
1200
1226
|
// Collapse an all-absent override (e.g. `limits: {}`) to `undefined` so it never
|
|
1201
1227
|
// lands an empty object on the request — matches sibling parsers (parseRunWebhook,
|
|
1202
1228
|
// parseEnvironment). The resolver supplies platform defaults for absent fields.
|
|
1203
|
-
if (maxConcurrentChildRuns === undefined && maxSubagentDepth === undefined) {
|
|
1229
|
+
if (maxConcurrentChildRuns === undefined && maxSubagentDepth === undefined && maxSpendUsd === undefined) {
|
|
1204
1230
|
return undefined;
|
|
1205
1231
|
}
|
|
1206
1232
|
return {
|
|
1207
1233
|
...(maxConcurrentChildRuns !== undefined ? { maxConcurrentChildRuns } : {}),
|
|
1208
|
-
...(maxSubagentDepth !== undefined ? { maxSubagentDepth } : {})
|
|
1234
|
+
...(maxSubagentDepth !== undefined ? { maxSubagentDepth } : {}),
|
|
1235
|
+
...(maxSpendUsd !== undefined ? { maxSpendUsd } : {})
|
|
1209
1236
|
};
|
|
1210
1237
|
}
|
|
1211
|
-
export function
|
|
1238
|
+
export function parseRegion(input) {
|
|
1212
1239
|
if (input === undefined) {
|
|
1213
1240
|
return undefined;
|
|
1214
1241
|
}
|
|
1215
|
-
if (typeof input !== "string" || !
|
|
1216
|
-
throw new Error(`region must be one of: ${
|
|
1242
|
+
if (typeof input !== "string" || !REGIONS.includes(input)) {
|
|
1243
|
+
throw new Error(`region must be one of: ${REGIONS.join(", ")} (got ${JSON.stringify(input)})`);
|
|
1217
1244
|
}
|
|
1218
1245
|
return input;
|
|
1219
1246
|
}
|
package/dist/agents-md.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ export declare class AgentsMd {
|
|
|
15
15
|
constructor(ref: AgentsMdRef | DraftAgentsMdRef, zipBytes?: Uint8Array);
|
|
16
16
|
get ref(): AgentsMdRef | DraftAgentsMdRef;
|
|
17
17
|
get isDraft(): boolean;
|
|
18
|
-
|
|
18
|
+
/** Internal: the asset id resolved on a prior submit, or undefined. */
|
|
19
|
+
get _cachedAssetId(): string | undefined;
|
|
20
|
+
/** Internal: remember the asset id resolved for this draft's bytes. */
|
|
21
|
+
_rememberAsset(assetId: string): void;
|
|
19
22
|
/**
|
|
20
23
|
* Build a draft AgentsMd from a markdown string. The SDK zips the
|
|
21
24
|
* content under the canonical filename `AGENTS.md` so the hash is a
|
package/dist/agents-md.js
CHANGED
|
@@ -15,7 +15,8 @@ import { strToU8, zipSync } from "fflate";
|
|
|
15
15
|
export class AgentsMd {
|
|
16
16
|
#ref;
|
|
17
17
|
#zipBytes;
|
|
18
|
-
|
|
18
|
+
/** Asset id cached after the first submit, so reuse skips a re-upload. */
|
|
19
|
+
#assetId;
|
|
19
20
|
constructor(ref, zipBytes) {
|
|
20
21
|
this.#ref = ref;
|
|
21
22
|
this.#zipBytes = zipBytes;
|
|
@@ -24,10 +25,15 @@ export class AgentsMd {
|
|
|
24
25
|
return this.#ref;
|
|
25
26
|
}
|
|
26
27
|
get isDraft() {
|
|
27
|
-
return this.#ref.kind === "draft"
|
|
28
|
+
return this.#ref.kind === "draft";
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
/** Internal: the asset id resolved on a prior submit, or undefined. */
|
|
31
|
+
get _cachedAssetId() {
|
|
32
|
+
return this.#assetId;
|
|
33
|
+
}
|
|
34
|
+
/** Internal: remember the asset id resolved for this draft's bytes. */
|
|
35
|
+
_rememberAsset(assetId) {
|
|
36
|
+
this.#assetId = assetId;
|
|
31
37
|
}
|
|
32
38
|
/**
|
|
33
39
|
* Build a draft AgentsMd from a markdown string. The SDK zips the
|
|
@@ -56,14 +62,9 @@ export class AgentsMd {
|
|
|
56
62
|
* `client.submit` can upload it as an asset.
|
|
57
63
|
*/
|
|
58
64
|
_takeDraftBundle() {
|
|
59
|
-
if (this.#consumed) {
|
|
60
|
-
throw new Error("AgentsMd: cannot reuse a consumed AgentsMd in submit. Build a fresh one " +
|
|
61
|
-
"via AgentsMd.fromContent(...) / AgentsMd.fromPath(...) per submit call.");
|
|
62
|
-
}
|
|
63
65
|
if (this.#ref.kind !== "draft" || !this.#zipBytes) {
|
|
64
66
|
return undefined;
|
|
65
67
|
}
|
|
66
|
-
this.#consumed = true;
|
|
67
68
|
return {
|
|
68
69
|
name: this.#ref.name,
|
|
69
70
|
contentHash: this.#ref.contentHash,
|
package/dist/agents-md.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../src/agents-md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,QAAQ;IACV,IAAI,CAAiC;IACrC,SAAS,CAAyB;IAC3C,
|
|
1
|
+
{"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../src/agents-md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,QAAQ;IACV,IAAI,CAAiC;IACrC,SAAS,CAAyB;IAC3C,0EAA0E;IAC1E,QAAQ,CAAqB;IAE7B,YAAY,GAAmC,EAAE,QAAqB;QACpE,IAAI,CAAC,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