@aexhq/sdk 0.38.1 → 0.39.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 +1 -1
- package/dist/_contracts/index.d.ts +1 -1
- package/dist/_contracts/index.js +1 -1
- package/dist/_contracts/operations.d.ts +21 -1
- package/dist/_contracts/operations.js +43 -0
- package/dist/_contracts/run-config.d.ts +35 -10
- package/dist/_contracts/run-config.js +17 -5
- package/dist/_contracts/runtime-types.d.ts +22 -0
- package/dist/_contracts/submission.d.ts +78 -12
- package/dist/_contracts/submission.js +171 -50
- package/dist/asset-upload.d.ts +1 -1
- package/dist/asset-upload.js +1 -1
- package/dist/bundle.d.ts +9 -11
- package/dist/bundle.js +5 -6
- package/dist/bundle.js.map +1 -1
- package/dist/cli.mjs +41 -0
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +57 -13
- package/dist/client.js +141 -76
- package/dist/client.js.map +1 -1
- package/dist/fetch-archive.js +14 -14
- package/dist/fetch-archive.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/skill.d.ts +139 -0
- package/dist/skill.js +289 -0
- package/dist/skill.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/concepts/composition.md +3 -3
- package/docs/mcp.md +3 -2
- package/docs/provider-runtime-capabilities.md +1 -1
- package/docs/run-config.md +1 -1
- package/docs/skills.md +74 -44
- package/docs/vision-skills.md +3 -3
- package/package.json +1 -1
- package/dist/skill-tool.d.ts +0 -102
- package/dist/skill-tool.js +0 -190
- package/dist/skill-tool.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TOOL_NAME_PATTERN, normaliseSkillBundlePath, parseAssetRefFields, parseMcpServerRef } from "./run-config.js";
|
|
1
|
+
import { SKILL_NAME_PATTERN, SKILL_RESERVED_NAMES, TOOL_NAME_PATTERN, normaliseSkillBundlePath, parseAssetRefFields, parseMcpServerRef } from "./run-config.js";
|
|
2
2
|
import { parseRunTimeout, parseRuntimeSize } from "./runtime-sizes.js";
|
|
3
3
|
import { assertRunModelMatchesProvider, parseRunModel } from "./models.js";
|
|
4
4
|
import { parseRuntimeSecurityProfile } from "./runtime-security-profile.js";
|
|
@@ -554,7 +554,6 @@ export function parseRunSubmissionRequest(input, options = {}) {
|
|
|
554
554
|
assertNoSecretBearingFields(fieldValue, [key]);
|
|
555
555
|
}
|
|
556
556
|
const provider = parseRunProvider(value.provider);
|
|
557
|
-
void options;
|
|
558
557
|
const runtimeSize = parseRuntimeSize(value.runtimeSize);
|
|
559
558
|
const timeoutMs = parseRunTimeout(value.timeout);
|
|
560
559
|
const webhook = parseRunWebhook(value.webhook);
|
|
@@ -562,7 +561,9 @@ export function parseRunSubmissionRequest(input, options = {}) {
|
|
|
562
561
|
const machine = parseRunMachine(value.machine);
|
|
563
562
|
const secrets = parseInlineSecrets(value.secrets);
|
|
564
563
|
enforceCredentialSecretPolicy(secrets, provider);
|
|
565
|
-
const submission = parseSubmission(value.submission
|
|
564
|
+
const submission = parseSubmission(value.submission, {
|
|
565
|
+
trustedReparse: options.trustedReparse === true
|
|
566
|
+
});
|
|
566
567
|
assertRunModelMatchesProvider(provider, submission.model);
|
|
567
568
|
crossValidateSecretEnvAndValues(submission.secretEnv, secrets.envSecrets);
|
|
568
569
|
// mcpServers names must agree across the submission half and the
|
|
@@ -746,13 +747,15 @@ export function enforceCredentialSecretPolicy(secrets, provider, opts) {
|
|
|
746
747
|
throw new Error(`secrets.apiKeys["${provider}"] is required`);
|
|
747
748
|
}
|
|
748
749
|
}
|
|
749
|
-
export function parseSubmission(input) {
|
|
750
|
+
export function parseSubmission(input, options = {}) {
|
|
750
751
|
const value = requireRecord(input, "submission.submission");
|
|
751
752
|
const allowed = new Set([
|
|
752
753
|
"model",
|
|
753
754
|
"system",
|
|
754
755
|
"prompt",
|
|
755
756
|
"tools",
|
|
757
|
+
"skills",
|
|
758
|
+
"resolvedSkills",
|
|
756
759
|
"agentsMd",
|
|
757
760
|
"files",
|
|
758
761
|
"mcpServers",
|
|
@@ -773,7 +776,9 @@ export function parseSubmission(input) {
|
|
|
773
776
|
const model = parseRunModel(value.model, "submission.model");
|
|
774
777
|
const system = optionalString(value.system, "submission.system");
|
|
775
778
|
const prompt = parsePrompt(value.prompt);
|
|
776
|
-
const { tools,
|
|
779
|
+
const { tools, builtinTools } = parseTools(value.tools);
|
|
780
|
+
const skills = parseSkills(value.skills);
|
|
781
|
+
const resolvedSkills = parseResolvedSkills(value.resolvedSkills, options.trustedReparse === true);
|
|
777
782
|
const agentsMd = parseAgentsMd(value.agentsMd);
|
|
778
783
|
const files = parseFiles(value.files);
|
|
779
784
|
const mcpServers = parseMcpServers(value.mcpServers);
|
|
@@ -790,7 +795,8 @@ export function parseSubmission(input) {
|
|
|
790
795
|
...(system ? { system } : {}),
|
|
791
796
|
prompt,
|
|
792
797
|
tools,
|
|
793
|
-
...(
|
|
798
|
+
...(skills.length > 0 ? { skills } : {}),
|
|
799
|
+
...(resolvedSkills.length > 0 ? { resolvedSkills } : {}),
|
|
794
800
|
agentsMd,
|
|
795
801
|
files,
|
|
796
802
|
mcpServers,
|
|
@@ -928,6 +934,41 @@ export const BuiltinTools = {
|
|
|
928
934
|
* It is the complete closed builtin set.
|
|
929
935
|
*/
|
|
930
936
|
export const DEFAULT_BUILTIN_TOOLS = BUILTIN_TOOL_NAMES;
|
|
937
|
+
// ---------------------------------------------------------------------------
|
|
938
|
+
// The default `skills` meta-tool
|
|
939
|
+
// ---------------------------------------------------------------------------
|
|
940
|
+
/**
|
|
941
|
+
* Fixed name of the single skills meta-tool. Deliberately NOT a member of
|
|
942
|
+
* {@link BUILTIN_TOOL_NAMES} (that closed set is the customer-cherry-pickable
|
|
943
|
+
* toggle surface, pinned equal to `HANDS_TOOLS`) — the skills tool is IMPLIED by
|
|
944
|
+
* a run having ≥1 skill, not chosen, and is injected platform-side. Kept in
|
|
945
|
+
* lockstep with {@link SKILL_RESERVED_NAMES} so it can never be shadowed by a
|
|
946
|
+
* custom tool or skill of the same name.
|
|
947
|
+
*/
|
|
948
|
+
export const SKILLS_TOOL_NAME = "skills";
|
|
949
|
+
/**
|
|
950
|
+
* The single default `skills` meta-tool (list/load) the platform injects when a
|
|
951
|
+
* run references ≥1 workspace skill. Shared by the platform tool composer and
|
|
952
|
+
* kept adjacent to the reserved-name guard so the model-visible contract and the
|
|
953
|
+
* name reservation stay in one place. It replaces the former N per-skill no-arg
|
|
954
|
+
* load-tools with one arg-taking dispatcher.
|
|
955
|
+
*/
|
|
956
|
+
export const SKILLS_TOOL_DEFINITION = {
|
|
957
|
+
name: "skills",
|
|
958
|
+
description: "List and load the workspace SKILLS available to this run. Call with {action:'list'} to see each skill's " +
|
|
959
|
+
"name + description (cheap; do this first). Call with {action:'load', name:'<skill>'} to read that skill's " +
|
|
960
|
+
"full SKILL.md instructions into context before doing work the skill governs. A skill's supporting files are " +
|
|
961
|
+
"already on disk under /workspace/skills/<name>/ — load pulls the instructions; read_file/bash read the rest.",
|
|
962
|
+
input_schema: {
|
|
963
|
+
type: "object",
|
|
964
|
+
properties: {
|
|
965
|
+
action: { type: "string", enum: ["list", "load"], description: "'list' all skills, or 'load' one by name." },
|
|
966
|
+
name: { type: "string", description: "Skill name to load (required when action='load')." }
|
|
967
|
+
},
|
|
968
|
+
required: ["action"],
|
|
969
|
+
additionalProperties: false
|
|
970
|
+
}
|
|
971
|
+
};
|
|
931
972
|
/**
|
|
932
973
|
* Resolve the set of builtin tool NAMES a submission injects, deduplicated and
|
|
933
974
|
* in {@link BUILTIN_TOOL_NAMES} order.
|
|
@@ -1159,20 +1200,20 @@ function parsePrompt(input) {
|
|
|
1159
1200
|
return parts;
|
|
1160
1201
|
}
|
|
1161
1202
|
/**
|
|
1162
|
-
* Parse the `submission.tools` union: each entry is one of
|
|
1203
|
+
* Parse the `submission.tools` union: each entry is one of TWO shapes —
|
|
1163
1204
|
* (a) a BARE STRING: a builtin tool reference (validated against
|
|
1164
1205
|
* {@link BUILTIN_TOOL_NAMES}).
|
|
1165
1206
|
* (b) `{ kind:"asset", … }`: a custom tool bundle ({@link ToolRef}).
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1207
|
+
* Returns the two groups split: `tools` (custom bundles) and `builtinTools`
|
|
1208
|
+
* (the deduped builtin-name references, in {@link BUILTIN_TOOL_NAMES} order).
|
|
1209
|
+
* Tool `name`s and `assetId`s are deduped so a name/asset names at most one tool.
|
|
1210
|
+
*
|
|
1211
|
+
* Skills are NO LONGER a tool kind: a `{ kind:"skill" }` entry here is rejected
|
|
1212
|
+
* with a redirect to `submission.skills` (see {@link parseSkills}).
|
|
1172
1213
|
*/
|
|
1173
1214
|
function parseTools(input) {
|
|
1174
1215
|
if (input === undefined) {
|
|
1175
|
-
return { tools: [],
|
|
1216
|
+
return { tools: [], builtinTools: [] };
|
|
1176
1217
|
}
|
|
1177
1218
|
if (!Array.isArray(input)) {
|
|
1178
1219
|
throw new Error("submission.tools must be an array of builtin tool names or ToolRef objects");
|
|
@@ -1181,7 +1222,6 @@ function parseTools(input) {
|
|
|
1181
1222
|
const seenAssetIds = new Set();
|
|
1182
1223
|
const seenBuiltins = new Set();
|
|
1183
1224
|
const tools = [];
|
|
1184
|
-
const skillTools = [];
|
|
1185
1225
|
input.forEach((item, index) => {
|
|
1186
1226
|
const path = `submission.tools[${index}]`;
|
|
1187
1227
|
// A bare string is a builtin tool reference (e.g. BuiltinTools.web_search).
|
|
@@ -1194,41 +1234,11 @@ function parseTools(input) {
|
|
|
1194
1234
|
return;
|
|
1195
1235
|
}
|
|
1196
1236
|
const raw = requireRecord(item, path);
|
|
1197
|
-
//
|
|
1198
|
-
//
|
|
1199
|
-
//
|
|
1237
|
+
// Skills are a separate first-class input now. A skill ref must not ride the
|
|
1238
|
+
// tools union — point the caller at submission.skills instead of silently
|
|
1239
|
+
// dropping or mis-binding it.
|
|
1200
1240
|
if (raw.kind === "skill") {
|
|
1201
|
-
|
|
1202
|
-
if (key !== "kind" && key !== "assetId" && key !== "name" && key !== "description") {
|
|
1203
|
-
throw new Error(`${path}.${key} is not an allowed field for a skill tool; permitted: kind, assetId, name, description`);
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
const skillFields = parseAssetRefFields({ kind: "asset", assetId: raw.assetId, name: raw.name }, path);
|
|
1207
|
-
if (!TOOL_NAME_PATTERN.test(skillFields.name)) {
|
|
1208
|
-
throw new Error(`${path}.name must match ${TOOL_NAME_PATTERN.source}`);
|
|
1209
|
-
}
|
|
1210
|
-
if (skillFields.name.includes("__")) {
|
|
1211
|
-
throw new Error(`${path}.name must not contain "__"; that separator is reserved for MCP tools`);
|
|
1212
|
-
}
|
|
1213
|
-
if (seenNames.has(skillFields.name)) {
|
|
1214
|
-
throw new Error(`submission.tools duplicate name: ${skillFields.name}`);
|
|
1215
|
-
}
|
|
1216
|
-
seenNames.add(skillFields.name);
|
|
1217
|
-
if (seenAssetIds.has(skillFields.assetId)) {
|
|
1218
|
-
throw new Error(`submission.tools duplicate assetId: ${skillFields.assetId}`);
|
|
1219
|
-
}
|
|
1220
|
-
seenAssetIds.add(skillFields.assetId);
|
|
1221
|
-
const skillDescription = requireString(raw.description, `${path}.description`);
|
|
1222
|
-
if (skillDescription.trim().length === 0 || skillDescription.length > 2048) {
|
|
1223
|
-
throw new Error(`${path}.description must be non-empty and <= 2048 chars`);
|
|
1224
|
-
}
|
|
1225
|
-
skillTools.push({
|
|
1226
|
-
kind: "skill",
|
|
1227
|
-
assetId: skillFields.assetId,
|
|
1228
|
-
name: skillFields.name,
|
|
1229
|
-
description: skillDescription
|
|
1230
|
-
});
|
|
1231
|
-
return;
|
|
1241
|
+
throw new Error(`${path} is a skill ref; skills go in submission.skills (by name), not submission.tools`);
|
|
1232
1242
|
}
|
|
1233
1243
|
for (const key of Object.keys(raw)) {
|
|
1234
1244
|
if (key !== "kind" &&
|
|
@@ -1280,7 +1290,118 @@ function parseTools(input) {
|
|
|
1280
1290
|
});
|
|
1281
1291
|
});
|
|
1282
1292
|
const builtinTools = BUILTIN_TOOL_NAMES.filter((name) => seenBuiltins.has(name));
|
|
1283
|
-
return { tools,
|
|
1293
|
+
return { tools, builtinTools };
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Upper bound on the number of workspace skills a single run may reference.
|
|
1297
|
+
* A run's skill list is a discovery surface, not a bulk-mount channel; 64 is
|
|
1298
|
+
* generous headroom over any realistic per-run set while capping the meta-tool
|
|
1299
|
+
* `list` payload and the submit-time resolution fan-out.
|
|
1300
|
+
*/
|
|
1301
|
+
export const SKILLS_MAX = 64;
|
|
1302
|
+
/**
|
|
1303
|
+
* Parse `submission.skills`: an array of PUBLIC by-name skill refs
|
|
1304
|
+
* (`{ kind:"skill", name }`). Validates each `name` against
|
|
1305
|
+
* {@link SKILL_NAME_PATTERN}, rejects the `__` MCP separator and the reserved
|
|
1306
|
+
* skills names, dedups by name, and bounds the list at {@link SKILLS_MAX}.
|
|
1307
|
+
*/
|
|
1308
|
+
export function parseSkills(input) {
|
|
1309
|
+
if (input === undefined || input === null) {
|
|
1310
|
+
return [];
|
|
1311
|
+
}
|
|
1312
|
+
if (!Array.isArray(input)) {
|
|
1313
|
+
throw new Error("submission.skills must be an array of { kind:'skill', name } refs");
|
|
1314
|
+
}
|
|
1315
|
+
if (input.length > SKILLS_MAX) {
|
|
1316
|
+
throw new Error(`submission.skills exceeds the ${SKILLS_MAX}-skill limit (got ${input.length})`);
|
|
1317
|
+
}
|
|
1318
|
+
const seen = new Set();
|
|
1319
|
+
return input.map((item, index) => {
|
|
1320
|
+
const path = `submission.skills[${index}]`;
|
|
1321
|
+
const raw = requireRecord(item, path);
|
|
1322
|
+
for (const key of Object.keys(raw)) {
|
|
1323
|
+
if (key !== "kind" && key !== "name") {
|
|
1324
|
+
throw new Error(`${path}.${key} is not an allowed field for a skill ref; permitted: kind, name`);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
if (raw.kind !== "skill") {
|
|
1328
|
+
throw new Error(`${path}.kind must be 'skill' (got ${JSON.stringify(raw.kind)})`);
|
|
1329
|
+
}
|
|
1330
|
+
const name = requireString(raw.name, `${path}.name`);
|
|
1331
|
+
assertValidSkillName(name, `${path}.name`);
|
|
1332
|
+
if (seen.has(name)) {
|
|
1333
|
+
throw new Error(`submission.skills duplicate name: ${name}`);
|
|
1334
|
+
}
|
|
1335
|
+
seen.add(name);
|
|
1336
|
+
return { kind: "skill", name };
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Parse `submission.resolvedSkills`: the BOOT-RECORD-ONLY resolved refs
|
|
1341
|
+
* (`{ kind:"skill", assetId, name, description }`) the BFF resolver writes.
|
|
1342
|
+
* REJECTED on the public ingress path (`trusted === false`) so a caller can
|
|
1343
|
+
* never inject an asset + description; only the in-container trusted re-parse
|
|
1344
|
+
* (`trustedReparse: true`) accepts them.
|
|
1345
|
+
*/
|
|
1346
|
+
function parseResolvedSkills(input, trusted) {
|
|
1347
|
+
if (input === undefined || input === null) {
|
|
1348
|
+
return [];
|
|
1349
|
+
}
|
|
1350
|
+
if (!trusted) {
|
|
1351
|
+
throw new Error("submission.resolvedSkills is a platform-internal (boot-record) field and may not be set by callers; " +
|
|
1352
|
+
"reference workspace skills by name via submission.skills");
|
|
1353
|
+
}
|
|
1354
|
+
if (!Array.isArray(input)) {
|
|
1355
|
+
throw new Error("submission.resolvedSkills must be an array of resolved skill refs");
|
|
1356
|
+
}
|
|
1357
|
+
if (input.length > SKILLS_MAX) {
|
|
1358
|
+
throw new Error(`submission.resolvedSkills exceeds the ${SKILLS_MAX}-skill limit (got ${input.length})`);
|
|
1359
|
+
}
|
|
1360
|
+
const seenNames = new Set();
|
|
1361
|
+
const seenAssetIds = new Set();
|
|
1362
|
+
return input.map((item, index) => {
|
|
1363
|
+
const path = `submission.resolvedSkills[${index}]`;
|
|
1364
|
+
const raw = requireRecord(item, path);
|
|
1365
|
+
for (const key of Object.keys(raw)) {
|
|
1366
|
+
if (key !== "kind" && key !== "assetId" && key !== "name" && key !== "description") {
|
|
1367
|
+
throw new Error(`${path}.${key} is not an allowed field for a resolved skill ref; permitted: kind, assetId, name, description`);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
if (raw.kind !== "skill") {
|
|
1371
|
+
throw new Error(`${path}.kind must be 'skill' (got ${JSON.stringify(raw.kind)})`);
|
|
1372
|
+
}
|
|
1373
|
+
const fields = parseAssetRefFields({ kind: "asset", assetId: raw.assetId, name: raw.name }, path);
|
|
1374
|
+
assertValidSkillName(fields.name, `${path}.name`);
|
|
1375
|
+
if (seenNames.has(fields.name)) {
|
|
1376
|
+
throw new Error(`submission.resolvedSkills duplicate name: ${fields.name}`);
|
|
1377
|
+
}
|
|
1378
|
+
seenNames.add(fields.name);
|
|
1379
|
+
if (seenAssetIds.has(fields.assetId)) {
|
|
1380
|
+
throw new Error(`submission.resolvedSkills duplicate assetId: ${fields.assetId}`);
|
|
1381
|
+
}
|
|
1382
|
+
seenAssetIds.add(fields.assetId);
|
|
1383
|
+
const description = requireString(raw.description, `${path}.description`);
|
|
1384
|
+
if (description.trim().length === 0 || description.length > 2048) {
|
|
1385
|
+
throw new Error(`${path}.description must be non-empty and <= 2048 chars`);
|
|
1386
|
+
}
|
|
1387
|
+
return { kind: "skill", assetId: fields.assetId, name: fields.name, description };
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Shared skill-name gate for {@link parseSkills} / {@link parseResolvedSkills}
|
|
1392
|
+
* (and mirrored SDK-side in `Skill`): pattern + `__` MCP separator + reserved
|
|
1393
|
+
* names (`skills`, `skill`).
|
|
1394
|
+
*/
|
|
1395
|
+
function assertValidSkillName(name, field) {
|
|
1396
|
+
if (!SKILL_NAME_PATTERN.test(name)) {
|
|
1397
|
+
throw new Error(`${field} must match ${SKILL_NAME_PATTERN.source}`);
|
|
1398
|
+
}
|
|
1399
|
+
if (name.includes("__")) {
|
|
1400
|
+
throw new Error(`${field} must not contain "__"; that separator is reserved for MCP tools`);
|
|
1401
|
+
}
|
|
1402
|
+
if (SKILL_RESERVED_NAMES.has(name)) {
|
|
1403
|
+
throw new Error(`${field} must not be a reserved skills name (${[...SKILL_RESERVED_NAMES].join(", ")})`);
|
|
1404
|
+
}
|
|
1284
1405
|
}
|
|
1285
1406
|
function parseAgentsMd(input) {
|
|
1286
1407
|
if (input === undefined)
|
package/dist/asset-upload.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Asset materialization for the SDK run / session path.
|
|
3
3
|
*
|
|
4
|
-
* Every inline
|
|
4
|
+
* Every inline `Skill` / `Tool` / `AgentsMd` / `File` draft is materialized
|
|
5
5
|
* to the hosted API's content-addressable asset store before the session
|
|
6
6
|
* starts, so the wire submission carries only storage-neutral refs.
|
|
7
7
|
*
|
package/dist/asset-upload.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Asset materialization for the SDK run / session path.
|
|
3
3
|
*
|
|
4
|
-
* Every inline
|
|
4
|
+
* Every inline `Skill` / `Tool` / `AgentsMd` / `File` draft is materialized
|
|
5
5
|
* to the hosted API's content-addressable asset store before the session
|
|
6
6
|
* starts, so the wire submission carries only storage-neutral refs.
|
|
7
7
|
*
|
package/dist/bundle.d.ts
CHANGED
|
@@ -9,11 +9,10 @@ import { type ToolInputSchema } from "./_contracts/index.js";
|
|
|
9
9
|
* recomputes the canonical hash on receipt — SDK-side hashing is NOT
|
|
10
10
|
* part of any contract, so we don't expose one for workspace uploads.
|
|
11
11
|
*
|
|
12
|
-
* For
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* (mismatch → submission rejected).
|
|
12
|
+
* For workspace skills the SDK computes an advisory `sha256` of the
|
|
13
|
+
* canonicalised zip via `hashSkillBundle()` before upserting the skill by name.
|
|
14
|
+
* The platform verifies the hash against the uploaded bytes and uses it for
|
|
15
|
+
* deduplication.
|
|
17
16
|
*/
|
|
18
17
|
export interface BundledSkill {
|
|
19
18
|
readonly zip: Uint8Array;
|
|
@@ -36,11 +35,10 @@ export interface ToolBundleManifest {
|
|
|
36
35
|
}
|
|
37
36
|
export declare function bundleToolFiles(files: SkillFiles, manifest: ToolBundleManifest): BundledTool;
|
|
38
37
|
/**
|
|
39
|
-
* Compute `sha256:<hex>` of the given canonicalised zip bytes. Used by
|
|
40
|
-
* `
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* and browsers without polyfills.
|
|
38
|
+
* Compute `sha256:<hex>` of the given canonicalised zip bytes. Used by the
|
|
39
|
+
* `Skill.from*` / `File` / `AgentsMd` factories to populate the draft's
|
|
40
|
+
* `contentHash` field. The hash is advisory — the BFF verifies
|
|
41
|
+
* it against the uploaded zip; a mismatch is rejected. Web-Crypto-only so the
|
|
42
|
+
* SDK works in Bun, Node, edge runtimes, and browsers without polyfills.
|
|
45
43
|
*/
|
|
46
44
|
export declare function hashSkillBundle(zipBytes: Uint8Array): Promise<string>;
|
package/dist/bundle.js
CHANGED
|
@@ -106,12 +106,11 @@ export function bundleToolFiles(files, manifest) {
|
|
|
106
106
|
}
|
|
107
107
|
const ZIP_EPOCH = new Date(Date.UTC(1980, 0, 1));
|
|
108
108
|
/**
|
|
109
|
-
* Compute `sha256:<hex>` of the given canonicalised zip bytes. Used by
|
|
110
|
-
* `
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* and browsers without polyfills.
|
|
109
|
+
* Compute `sha256:<hex>` of the given canonicalised zip bytes. Used by the
|
|
110
|
+
* `Skill.from*` / `File` / `AgentsMd` factories to populate the draft's
|
|
111
|
+
* `contentHash` field. The hash is advisory — the BFF verifies
|
|
112
|
+
* it against the uploaded zip; a mismatch is rejected. Web-Crypto-only so the
|
|
113
|
+
* SDK works in Bun, Node, edge runtimes, and browsers without polyfills.
|
|
115
114
|
*/
|
|
116
115
|
export async function hashSkillBundle(zipBytes) {
|
|
117
116
|
const subtle = globalThis.crypto?.subtle;
|
package/dist/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAwB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAwB,MAAM,kBAAkB,CAAC;AAuBvG,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;AAK/B,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,wBAAwB,mBAAmB,CAAC,QAAQ,oBAAoB,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7G,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAAs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,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAW,CAAC;QAC/B,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1748,6 +1748,7 @@ __export(operations_exports, {
|
|
|
1748
1748
|
deleteRun: () => deleteRun,
|
|
1749
1749
|
deleteSecret: () => deleteSecret,
|
|
1750
1750
|
deleteSession: () => deleteSession,
|
|
1751
|
+
deleteSkill: () => deleteSkill,
|
|
1751
1752
|
deleteWorkspaceAsset: () => deleteWorkspaceAsset,
|
|
1752
1753
|
download: () => download,
|
|
1753
1754
|
downloadEvents: () => downloadEvents,
|
|
@@ -1770,6 +1771,7 @@ __export(operations_exports, {
|
|
|
1770
1771
|
getSecretValue: () => getSecretValue,
|
|
1771
1772
|
getSession: () => getSession,
|
|
1772
1773
|
getSessionCoordinatorTicket: () => getSessionCoordinatorTicket,
|
|
1774
|
+
getSkill: () => getSkill,
|
|
1773
1775
|
getWebhookSigningSecret: () => getWebhookSigningSecret,
|
|
1774
1776
|
listAgentsMd: () => listAgentsMd,
|
|
1775
1777
|
listFiles: () => listFiles,
|
|
@@ -1781,6 +1783,7 @@ __export(operations_exports, {
|
|
|
1781
1783
|
listSessionMessages: () => listSessionMessages,
|
|
1782
1784
|
listSessionOutputs: () => listSessionOutputs,
|
|
1783
1785
|
listSessions: () => listSessions,
|
|
1786
|
+
listSkills: () => listSkills,
|
|
1784
1787
|
normalizeOutputLinkExpiresIn: () => normalizeOutputLinkExpiresIn,
|
|
1785
1788
|
outputLink: () => outputLink,
|
|
1786
1789
|
readOutputText: () => readOutputText,
|
|
@@ -1792,6 +1795,7 @@ __export(operations_exports, {
|
|
|
1792
1795
|
submitRun: () => submitRun,
|
|
1793
1796
|
suspendSession: () => suspendSession,
|
|
1794
1797
|
uploadWorkspaceAsset: () => uploadWorkspaceAsset,
|
|
1798
|
+
upsertSkill: () => upsertSkill,
|
|
1795
1799
|
whoami: () => whoami
|
|
1796
1800
|
});
|
|
1797
1801
|
|
|
@@ -3215,6 +3219,43 @@ function unwrapSecret(result) {
|
|
|
3215
3219
|
}
|
|
3216
3220
|
return result;
|
|
3217
3221
|
}
|
|
3222
|
+
async function upsertSkill(http, args) {
|
|
3223
|
+
const result = await http.request(`/api/skills/${encodeURIComponent(args.name)}`, {
|
|
3224
|
+
method: "PUT",
|
|
3225
|
+
body: JSON.stringify({
|
|
3226
|
+
contentHash: args.contentHash,
|
|
3227
|
+
description: args.description,
|
|
3228
|
+
sizeBytes: args.sizeBytes
|
|
3229
|
+
})
|
|
3230
|
+
});
|
|
3231
|
+
if (result && typeof result === "object" && "skill" in result) {
|
|
3232
|
+
const wrapped = result;
|
|
3233
|
+
return { skill: wrapped.skill, updated: wrapped.updated === true };
|
|
3234
|
+
}
|
|
3235
|
+
return { skill: result, updated: true };
|
|
3236
|
+
}
|
|
3237
|
+
async function listSkills(http) {
|
|
3238
|
+
const result = await http.request("/api/skills");
|
|
3239
|
+
if (Array.isArray(result)) {
|
|
3240
|
+
return result;
|
|
3241
|
+
}
|
|
3242
|
+
return result.skills;
|
|
3243
|
+
}
|
|
3244
|
+
async function getSkill(http, name) {
|
|
3245
|
+
const result = await http.request(`/api/skills/${encodeURIComponent(name)}`);
|
|
3246
|
+
return unwrapSkill(result);
|
|
3247
|
+
}
|
|
3248
|
+
async function deleteSkill(http, name) {
|
|
3249
|
+
await http.request(`/api/skills/${encodeURIComponent(name)}`, {
|
|
3250
|
+
method: "DELETE"
|
|
3251
|
+
});
|
|
3252
|
+
}
|
|
3253
|
+
function unwrapSkill(result) {
|
|
3254
|
+
if (result && typeof result === "object" && "skill" in result) {
|
|
3255
|
+
return result.skill;
|
|
3256
|
+
}
|
|
3257
|
+
return result;
|
|
3258
|
+
}
|
|
3218
3259
|
function hasRun(value) {
|
|
3219
3260
|
return Boolean(value && typeof value === "object" && "run" in value);
|
|
3220
3261
|
}
|
package/dist/cli.mjs.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a2adb1e75358c6a3672cea88be6b784ad981ff9ae32b14f31d5e0dd2712cbaea cli.mjs
|
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { HttpClient, SecretString, type AexEvent, type AgentsMdRecord, type BillingCheckoutRequest, type BillingHostedSession, type BillingLedgerPage, type BillingLedgerQuery, type BillingPortalRequest, type BillingSummary, type DebugSink, type FetchLike, type FileRecord, type Output, type OutputFileType, type OutputLink, type OutputLinkOptions, type OutputQuery, type OutputText, type OutputMode, type ReadOutputTextOptions, type OutputSearchQuery, type OutputSearchPage, type Session, type SessionCreateRequest, type SessionEvent, type SessionListPage, type SessionListQuery, type SessionMessage, type SessionStateChangeAccepted, type SessionTurn, type PlatformEnvironmentInput, type PlatformSubmission, type Run, type RunModel, type RunEvent, type RunTrace, type UsageSummary, type RunWebhookDelivery, type RunProvider, type SecretRecord, type RunUnit, type BuiltinToolName, type RuntimeSize, type WebhookSigningSecret, type WebSocketFactory, type WhoAmI } from "./_contracts/index.js";
|
|
1
|
+
import { HttpClient, SecretString, type AexEvent, type AgentsMdRecord, type BillingCheckoutRequest, type BillingHostedSession, type BillingLedgerPage, type BillingLedgerQuery, type BillingPortalRequest, type BillingSummary, type DebugSink, type FetchLike, type FileRecord, type Output, type OutputFileType, type OutputLink, type OutputLinkOptions, type OutputQuery, type OutputText, type OutputMode, type ReadOutputTextOptions, type OutputSearchQuery, type OutputSearchPage, type Session, type SessionCreateRequest, type SessionEvent, type SessionListPage, type SessionListQuery, type SessionMessage, type SessionStateChangeAccepted, type SessionTurn, type PlatformEnvironmentInput, type PlatformSubmission, type Run, type RunModel, type RunEvent, type RunTrace, type UsageSummary, type RunWebhookDelivery, type RunProvider, type SecretRecord, type RunUnit, type BuiltinToolName, type RuntimeSize, type SkillRecord, type WebhookSigningSecret, type WebSocketFactory, type WhoAmI } from "./_contracts/index.js";
|
|
2
2
|
import { AgentsMd } from "./agents-md.js";
|
|
3
3
|
import { type UploadedAsset } from "./asset-upload.js";
|
|
4
4
|
import { File } from "./file.js";
|
|
5
5
|
import { McpServer } from "./mcp-server.js";
|
|
6
6
|
import { type RetryOptions } from "./retry.js";
|
|
7
7
|
import { Secret } from "./secret.js";
|
|
8
|
-
import {
|
|
8
|
+
import { Skill } from "./skill.js";
|
|
9
9
|
import { Tool } from "./tool.js";
|
|
10
10
|
export interface AexOptions {
|
|
11
11
|
/** Workspace-scoped SDK API key. */
|
|
@@ -111,10 +111,12 @@ export interface SessionOverrides {
|
|
|
111
111
|
* Everything the agent needs is spelled out at the call site:
|
|
112
112
|
*
|
|
113
113
|
* - `model` / `system` — the agent's brief.
|
|
114
|
-
* - `tools` — custom `Tool` bundles
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
114
|
+
* - `tools` — custom `Tool` bundles and builtin tool-name references; local
|
|
115
|
+
* custom-tool instances are materialized to the hosted asset store before
|
|
116
|
+
* the session lands.
|
|
117
|
+
* - `skills` — workspace skill bundles from `Skill.fromDir` / `Skill.fromUrl`
|
|
118
|
+
* / `Skill.fromFiles` / …; the SDK upserts them by name before the session
|
|
119
|
+
* lands, and the wire submission references only those names.
|
|
118
120
|
* - `agentsMd` / `files` — local composition instances
|
|
119
121
|
* (`AgentsMd.fromContent` / `File.fromBytes`, …), materialized to the
|
|
120
122
|
* hosted asset store before the session lands.
|
|
@@ -138,12 +140,17 @@ export interface SessionCreateOptions {
|
|
|
138
140
|
readonly model: RunModel;
|
|
139
141
|
readonly system?: string;
|
|
140
142
|
/**
|
|
141
|
-
* Tools available to the agent. Each entry is a custom {@link Tool} bundle
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* `BuiltinTools.<name>` so a typo is a compile error.
|
|
143
|
+
* Tools available to the agent. Each entry is a custom {@link Tool} bundle or
|
|
144
|
+
* a BUILTIN tool reference — a bare name string, preferably `BuiltinTools.<name>`
|
|
145
|
+
* so a typo is a compile error.
|
|
145
146
|
*/
|
|
146
|
-
readonly tools?: readonly (Tool |
|
|
147
|
+
readonly tools?: readonly (Tool | BuiltinToolName)[];
|
|
148
|
+
/**
|
|
149
|
+
* Workspace skills available to the agent. Build them with the `Skill.from*`
|
|
150
|
+
* factories; the SDK upserts each bundle into the workspace skill registry by
|
|
151
|
+
* name, then sends only `{ kind:"skill", name }` in the submission.
|
|
152
|
+
*/
|
|
153
|
+
readonly skills?: readonly Skill[];
|
|
147
154
|
readonly agentsMd?: readonly AgentsMd[];
|
|
148
155
|
readonly files?: readonly File[];
|
|
149
156
|
readonly mcpServers?: readonly McpServer[];
|
|
@@ -446,6 +453,20 @@ export declare class FilesClient {
|
|
|
446
453
|
get(fileId: string): Promise<FileRecord>;
|
|
447
454
|
delete(fileId: string): Promise<void>;
|
|
448
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* Workspace skill registry operations exposed under `client.skills`.
|
|
458
|
+
*
|
|
459
|
+
* Session creation normally passes `Skill.from*(...)` instances directly in the
|
|
460
|
+
* `skills` option (auto-upserted by name). This namespace is the metadata
|
|
461
|
+
* read/delete surface for the named workspace skill registry.
|
|
462
|
+
*/
|
|
463
|
+
export declare class SkillsClient {
|
|
464
|
+
#private;
|
|
465
|
+
constructor(http: HttpClient);
|
|
466
|
+
list(): Promise<readonly SkillRecord[]>;
|
|
467
|
+
get(name: string): Promise<SkillRecord>;
|
|
468
|
+
delete(name: string): Promise<void>;
|
|
469
|
+
}
|
|
449
470
|
/**
|
|
450
471
|
* Workspace secret management exposed under `client.secrets`, mirroring
|
|
451
472
|
* `client.agentsMd` / `client.files`.
|
|
@@ -504,6 +525,7 @@ export declare class Aex {
|
|
|
504
525
|
#private;
|
|
505
526
|
readonly agentsMd: AgentsMdClient;
|
|
506
527
|
readonly files: FilesClient;
|
|
528
|
+
readonly skills: SkillsClient;
|
|
507
529
|
readonly secrets: SecretsClient;
|
|
508
530
|
readonly sessions: SessionClient;
|
|
509
531
|
constructor(apiKey: string, options?: Omit<AexOptions, "apiKey">);
|
|
@@ -523,8 +545,9 @@ export declare class Aex {
|
|
|
523
545
|
/**
|
|
524
546
|
* Internal: materialize raw bytes to the content-addressable asset store
|
|
525
547
|
* (`/assets/presign` → PUT → `/assets/finalize`). Used by the session-create
|
|
526
|
-
* prepare step to upload draft skill
|
|
527
|
-
* the wire submission carries only plain `kind:"asset"`
|
|
548
|
+
* prepare step to upload draft skill / tool / agentsMd / file bundles so
|
|
549
|
+
* the wire submission carries only plain `kind:"asset"` refs (skills resolve
|
|
550
|
+
* to name-only `kind:"skill"` refs after their bytes upload).
|
|
528
551
|
* NOT part of the public API.
|
|
529
552
|
*/
|
|
530
553
|
_uploadAsset(args: {
|
|
@@ -532,6 +555,19 @@ export declare class Aex {
|
|
|
532
555
|
readonly hash: string;
|
|
533
556
|
readonly contentType?: string;
|
|
534
557
|
}): Promise<UploadedAsset>;
|
|
558
|
+
/**
|
|
559
|
+
* Internal: upsert already-uploaded skill metadata into the workspace registry.
|
|
560
|
+
* The bytes are staged through `_uploadAsset`; this call binds the content hash
|
|
561
|
+
* to a mutable workspace skill name before the run references that name.
|
|
562
|
+
*/
|
|
563
|
+
_upsertSkill(args: {
|
|
564
|
+
readonly name: string;
|
|
565
|
+
readonly contentHash: string;
|
|
566
|
+
readonly description: string;
|
|
567
|
+
readonly sizeBytes: number;
|
|
568
|
+
}): Promise<{
|
|
569
|
+
readonly updated: boolean;
|
|
570
|
+
}>;
|
|
535
571
|
/**
|
|
536
572
|
* Convenience one-shot on top of the canonical session API:
|
|
537
573
|
* open a session, send `message` as the first turn, stream until the session
|
|
@@ -583,4 +619,12 @@ export declare class Aex {
|
|
|
583
619
|
*/
|
|
584
620
|
webhookSigningSecret(): Promise<WebhookSigningSecret>;
|
|
585
621
|
}
|
|
622
|
+
/**
|
|
623
|
+
* Map `items` through `fn` with at most `limit` in flight, PRESERVING ORDER (the
|
|
624
|
+
* result at index `i` is `fn(items[i], i)` regardless of completion order). A
|
|
625
|
+
* rejection from any call propagates (the first to reject wins) once the
|
|
626
|
+
* in-flight batch settles. Exported for direct unit testing; not part of the
|
|
627
|
+
* public SDK surface (index.ts controls that).
|
|
628
|
+
*/
|
|
629
|
+
export declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
586
630
|
export type { OutputFileType, OutputLink, OutputLinkOptions, OutputQuery };
|