@aexhq/cli 0.25.0 → 0.25.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/dist/cli.mjs CHANGED
@@ -25,11 +25,16 @@ var PROXY_RESPONSE_MODES = ["status_only", "headers_only", "full"];
25
25
  var PROXY_ENDPOINT_DEFAULTS = {
26
26
  allowHeaders: [],
27
27
  responseMode: "headers_only",
28
- maxRequestBytes: 64 * 1024,
28
+ // 10 MiB. The body is buffered into the Worker to enforce this cap, while the
29
+ // launch default fits practical multimodal/tool POSTs without every endpoint
30
+ // needing an override.
31
+ maxRequestBytes: 10 * 1024 * 1024,
29
32
  // Unlimited (0). The request body is buffered to enforce its cap, so that
30
33
  // stays finite; the response is streamed, so it does not need one.
31
34
  maxResponseBytes: 0,
32
- timeoutMs: 1e4
35
+ // 5 minutes. Long-running upstream tool/model calls should not fail under a
36
+ // development-oriented 10s ceiling; endpoints can still set a smaller value.
37
+ timeoutMs: 5 * 60 * 1e3
33
38
  };
34
39
 
35
40
  // ../contracts/dist/provider-support.js
@@ -69,7 +74,6 @@ var DEEPSEEK_MANAGED_EVIDENCE = [
69
74
  var PROVIDER_PUBLIC_SUPPORT = {
70
75
  anthropic: {
71
76
  displayName: "Anthropic",
72
- status: "supported",
73
77
  docsAnchor: "anthropic",
74
78
  docs: COMMON_DOCS,
75
79
  evidence: [...COMMON_EVIDENCE, ...ANTHROPIC_MANAGED_EVIDENCE],
@@ -79,7 +83,6 @@ var PROVIDER_PUBLIC_SUPPORT = {
79
83
  },
80
84
  deepseek: {
81
85
  displayName: "DeepSeek",
82
- status: "supported",
83
86
  docsAnchor: "deepseek",
84
87
  docs: COMMON_DOCS,
85
88
  evidence: [...COMMON_EVIDENCE, ...DEEPSEEK_MANAGED_EVIDENCE],
@@ -89,7 +92,6 @@ var PROVIDER_PUBLIC_SUPPORT = {
89
92
  },
90
93
  openai: {
91
94
  displayName: "OpenAI",
92
- status: "supported",
93
95
  docsAnchor: "openai",
94
96
  docs: COMMON_DOCS,
95
97
  evidence: COMMON_EVIDENCE,
@@ -99,7 +101,6 @@ var PROVIDER_PUBLIC_SUPPORT = {
99
101
  },
100
102
  gemini: {
101
103
  displayName: "Gemini",
102
- status: "supported",
103
104
  docsAnchor: "gemini",
104
105
  docs: COMMON_DOCS,
105
106
  evidence: COMMON_EVIDENCE,
@@ -109,7 +110,6 @@ var PROVIDER_PUBLIC_SUPPORT = {
109
110
  },
110
111
  mistral: {
111
112
  displayName: "Mistral",
112
- status: "supported",
113
113
  docsAnchor: "mistral",
114
114
  docs: COMMON_DOCS,
115
115
  evidence: COMMON_EVIDENCE,
@@ -119,7 +119,6 @@ var PROVIDER_PUBLIC_SUPPORT = {
119
119
  },
120
120
  openrouter: {
121
121
  displayName: "OpenRouter",
122
- status: "supported",
123
122
  docsAnchor: "openrouter",
124
123
  docs: COMMON_DOCS,
125
124
  evidence: COMMON_EVIDENCE,
@@ -130,7 +129,6 @@ var PROVIDER_PUBLIC_SUPPORT = {
130
129
  // Doubao (ByteDance) via the official Ark API — international BytePlus gateway.
131
130
  doubao: {
132
131
  displayName: "Doubao",
133
- status: "supported",
134
132
  docsAnchor: "doubao",
135
133
  docs: COMMON_DOCS,
136
134
  evidence: COMMON_EVIDENCE,
@@ -141,7 +139,6 @@ var PROVIDER_PUBLIC_SUPPORT = {
141
139
  // Doubao (ByteDance) via the official Ark API — China Volcengine gateway.
142
140
  "doubao-cn": {
143
141
  displayName: "Doubao (China)",
144
- status: "supported",
145
142
  docsAnchor: "doubao-cn",
146
143
  docs: COMMON_DOCS,
147
144
  evidence: COMMON_EVIDENCE,
@@ -215,9 +212,7 @@ var TERMINAL_RUN_STATUSES = [
215
212
  "failed",
216
213
  "timed_out",
217
214
  "cancelled",
218
- "cleanup_failed",
219
- "pending_delete",
220
- "deleted"
215
+ "cleanup_failed"
221
216
  ];
222
217
  var terminalRunStatuses = new Set(TERMINAL_RUN_STATUSES);
223
218
 
@@ -755,7 +750,7 @@ var RUNTIME_SECURITY_PROFILE_CONFIG = Object.freeze({
755
750
  }),
756
751
  standard: Object.freeze({
757
752
  name: "standard",
758
- defaultNetworkingMode: "limited",
753
+ defaultNetworkingMode: "open",
759
754
  allowOpenNetworking: true,
760
755
  allowRuntimePackages: true,
761
756
  allowCustomerEnvVars: true,
@@ -773,27 +768,6 @@ var RUNTIME_SECURITY_PROFILE_CONFIG = Object.freeze({
773
768
  })
774
769
  });
775
770
 
776
- // ../contracts/dist/managed-key.js
777
- var MANAGED_KEY_POLICY_SCHEMA_VERSION = 1;
778
- var BLOCKED_MANAGED_KEY_FEATURE_POLICY_V1 = Object.freeze({
779
- files: "disabled",
780
- packages: "disabled",
781
- builtins: "disabled",
782
- mcpServers: "disabled",
783
- proxyEndpoints: "disabled",
784
- openNetworking: "disabled"
785
- });
786
- var BLOCKED_MANAGED_KEY_POLICY_V1 = Object.freeze({
787
- schemaVersion: MANAGED_KEY_POLICY_SCHEMA_VERSION,
788
- credentialMode: "managed",
789
- launchStage: "blocked",
790
- privateImplementationAvailable: false,
791
- billingRequired: true,
792
- providers: Object.freeze([]),
793
- runtimes: Object.freeze([]),
794
- features: BLOCKED_MANAGED_KEY_FEATURE_POLICY_V1
795
- });
796
-
797
771
  // ../contracts/dist/submission.js
798
772
  var RUN_PROVIDERS = [
799
773
  "anthropic",
@@ -897,13 +871,9 @@ var forbiddenStringPatterns = Object.freeze([
897
871
  {
898
872
  reason: "private_resource_handle",
899
873
  // `<keyword><sep><id>` opaque handles (`session_a1B2c3D4e5`, `file_9f8e7d…`).
900
- // The keyword set overlaps ordinary English (agent/file/skill/resource/…), so
901
- // the bare shape also matched documentation prose that simply chains those
902
- // words with `_`/`-` (`agent_decision_failure`, `file_grounded`,
903
- // `session_handoff_contract`, `agent-judgment` — read straight out of a
904
- // skill-pack doc in tool-result text). The `accept` predicate keeps the shape
905
- // but requires the id segment to look minted rather than spelled — i.e. carry
906
- // a digit — so genuine handles stay flagged while dictionary-word prose does not.
874
+ // The keyword set overlaps ordinary prose, so require the id segment to
875
+ // carry a digit. That keeps genuine minted handles flagged while avoiding
876
+ // dictionary-word chains such as `agent_decision_failure`.
907
877
  regex: /\b(?:machine|session|agent|file|skill|env|resource|handle|token_hash|bearer_hash)[_:-][A-Za-z0-9][A-Za-z0-9_-]{7,}\b/i,
908
878
  accept: isMintedResourceHandle
909
879
  },
@@ -1390,6 +1360,7 @@ function extractErrorMessage(body) {
1390
1360
  var operations_exports = {};
1391
1361
  __export(operations_exports, {
1392
1362
  cancelRun: () => cancelRun,
1363
+ classifyOutput: () => classifyOutput,
1393
1364
  createAgentsMd: () => createAgentsMd,
1394
1365
  createFile: () => createFile,
1395
1366
  createOutputLink: () => createOutputLink,
@@ -1407,6 +1378,10 @@ __export(operations_exports, {
1407
1378
  downloadMetadata: () => downloadMetadata,
1408
1379
  downloadOutput: () => downloadOutput,
1409
1380
  downloadOutputs: () => downloadOutputs,
1381
+ eventArchiveLink: () => eventArchiveLink,
1382
+ filterOutputs: () => filterOutputs,
1383
+ findOutput: () => findOutput,
1384
+ findOutputs: () => findOutputs,
1410
1385
  findSkillByHash: () => findSkillByHash,
1411
1386
  findSkillByName: () => findSkillByName,
1412
1387
  getAgentsMd: () => getAgentsMd,
@@ -1423,6 +1398,8 @@ __export(operations_exports, {
1423
1398
  listRunEvents: () => listRunEvents,
1424
1399
  listSecrets: () => listSecrets,
1425
1400
  listSkills: () => listSkills,
1401
+ normalizeOutputLinkExpiresIn: () => normalizeOutputLinkExpiresIn,
1402
+ outputLink: () => outputLink,
1426
1403
  resolveOutputFileSelector: () => resolveOutputFileSelector,
1427
1404
  rotateSecret: () => rotateSecret,
1428
1405
  submitRun: () => submitRun,
@@ -2173,12 +2150,50 @@ async function listRunEvents(http, runId) {
2173
2150
  async function getCoordinatorTicket(http, runId) {
2174
2151
  return http.request(`/api/runs/${encodeURIComponent(runId)}/events/ticket`, { method: "POST" });
2175
2152
  }
2176
- async function listOutputs(http, runId) {
2153
+ async function listOutputs(http, runId, query) {
2177
2154
  const result = await http.request(`/api/runs/${encodeURIComponent(runId)}/outputs`);
2178
- return result.outputs;
2155
+ return query === void 0 ? result.outputs : filterOutputs(result.outputs, query);
2156
+ }
2157
+ async function findOutputs(http, runId, query) {
2158
+ return listOutputs(http, runId, query);
2159
+ }
2160
+ async function findOutput(http, runId, query) {
2161
+ const matches = await findOutputs(http, runId, query);
2162
+ if (matches.length === 0)
2163
+ return null;
2164
+ if (matches.length === 1)
2165
+ return matches[0];
2166
+ throw new RunStateError("findOutput: output query matched multiple files", {
2167
+ runId,
2168
+ matches: matches.map((output) => output.filename ?? output.id)
2169
+ });
2170
+ }
2171
+ async function outputLink(http, runId, selectorOrQuery, options) {
2172
+ const output = await resolveOutputLinkTarget(http, runId, selectorOrQuery);
2173
+ const expiresInSeconds = normalizeOutputLinkExpiresIn(options?.expiresIn);
2174
+ const result = await http.request(`/api/runs/${encodeURIComponent(runId)}/outputs/${encodeURIComponent(output.id)}/link`, {
2175
+ method: "POST",
2176
+ body: JSON.stringify({ expiresInSeconds })
2177
+ });
2178
+ return {
2179
+ ...result,
2180
+ expiresInSeconds: result.expiresInSeconds ?? expiresInSeconds,
2181
+ output: result.output ?? output
2182
+ };
2179
2183
  }
2180
- async function createOutputLink(http, runId, outputId) {
2181
- return http.request(`/api/runs/${encodeURIComponent(runId)}/outputs/${encodeURIComponent(outputId)}/link`, { method: "POST" });
2184
+ async function createOutputLink(http, runId, selectorOrQuery, options) {
2185
+ return outputLink(http, runId, selectorOrQuery, options);
2186
+ }
2187
+ async function eventArchiveLink(http, runId, options) {
2188
+ const expiresInSeconds = normalizeOutputLinkExpiresIn(options?.expiresIn);
2189
+ const result = await http.request(`/api/runs/${encodeURIComponent(runId)}/events/link`, {
2190
+ method: "POST",
2191
+ body: JSON.stringify({ expiresInSeconds })
2192
+ });
2193
+ return {
2194
+ ...result,
2195
+ expiresInSeconds: result.expiresInSeconds ?? expiresInSeconds
2196
+ };
2182
2197
  }
2183
2198
  function resolveOutputFileSelector(outputs, selector, runId) {
2184
2199
  if (isPathSelector(selector)) {
@@ -2263,6 +2278,171 @@ function isPathSelector(selector) {
2263
2278
  function normalizeOutputLookupPath(path) {
2264
2279
  return path.replace(/\\/g, "/").replace(/^\/+/, "");
2265
2280
  }
2281
+ function filterOutputs(outputs, query) {
2282
+ return outputs.filter((output) => outputMatchesQuery(output, query));
2283
+ }
2284
+ function classifyOutput(output) {
2285
+ const contentType = normalizeContentType(output.contentType);
2286
+ if (contentType) {
2287
+ if (contentType === "application/json" || contentType.endsWith("+json") || contentType.includes("json")) {
2288
+ return "json";
2289
+ }
2290
+ if (contentType.startsWith("text/"))
2291
+ return "text";
2292
+ if (contentType.startsWith("image/"))
2293
+ return "image";
2294
+ if (contentType.startsWith("audio/"))
2295
+ return "audio";
2296
+ if (contentType.startsWith("video/"))
2297
+ return "video";
2298
+ if (contentType === "application/pdf")
2299
+ return "pdf";
2300
+ if (contentType === "application/zip" || contentType === "application/gzip" || contentType === "application/x-gzip" || contentType === "application/x-tar" || contentType === "application/x-7z-compressed" || contentType === "application/vnd.rar" || contentType === "application/zstd") {
2301
+ return "archive";
2302
+ }
2303
+ if (contentType === "application/octet-stream")
2304
+ return "binary";
2305
+ return "unknown";
2306
+ }
2307
+ const extension = extensionOf(output.filename);
2308
+ if (!extension)
2309
+ return "unknown";
2310
+ if (["json", "jsonl", "ndjson"].includes(extension))
2311
+ return "json";
2312
+ if (["txt", "log", "md", "markdown", "csv", "tsv", "xml", "html", "htm", "yaml", "yml"].includes(extension)) {
2313
+ return "text";
2314
+ }
2315
+ if (["png", "jpg", "jpeg", "gif", "webp", "avif", "bmp", "tif", "tiff", "svg"].includes(extension)) {
2316
+ return "image";
2317
+ }
2318
+ if (["mp3", "wav", "flac", "m4a", "aac", "ogg", "oga", "opus"].includes(extension))
2319
+ return "audio";
2320
+ if (["mp4", "mov", "m4v", "webm", "mkv", "avi"].includes(extension))
2321
+ return "video";
2322
+ if (extension === "pdf")
2323
+ return "pdf";
2324
+ if (["zip", "tar", "tgz", "gz", "bz2", "xz", "7z", "rar", "zst"].includes(extension))
2325
+ return "archive";
2326
+ if (["bin", "exe", "dll", "so", "dylib", "dmg", "iso"].includes(extension))
2327
+ return "binary";
2328
+ return "unknown";
2329
+ }
2330
+ function normalizeOutputLinkExpiresIn(input = "1h") {
2331
+ if (typeof input === "number") {
2332
+ if (!Number.isFinite(input) || input <= 0) {
2333
+ throw new RunStateError("outputLink: expiresIn must be a positive number of seconds", {
2334
+ expiresIn: input
2335
+ });
2336
+ }
2337
+ return Math.floor(input);
2338
+ }
2339
+ if (input === "15m")
2340
+ return 15 * 60;
2341
+ if (input === "1h")
2342
+ return 60 * 60;
2343
+ if (input === "1d")
2344
+ return 24 * 60 * 60;
2345
+ throw new RunStateError('outputLink: expiresIn must be seconds, "15m", "1h", or "1d"', {
2346
+ expiresIn: input
2347
+ });
2348
+ }
2349
+ async function resolveOutputLinkTarget(http, runId, selectorOrQuery) {
2350
+ if (typeof selectorOrQuery === "string") {
2351
+ if (selectorOrQuery.length === 0) {
2352
+ throw new RunStateError("outputLink: selector must include an output id or query", { runId });
2353
+ }
2354
+ return { id: selectorOrQuery };
2355
+ }
2356
+ if (hasOutputId(selectorOrQuery)) {
2357
+ if (selectorOrQuery.id.length === 0) {
2358
+ throw new RunStateError("outputLink: selector must include an output id or query", { runId });
2359
+ }
2360
+ return selectorOrQuery;
2361
+ }
2362
+ if (isPathSelector(selectorOrQuery) && selectorOrQuery.match === "suffix") {
2363
+ return resolveOutputFileSelector(await listOutputs(http, runId), selectorOrQuery, runId);
2364
+ }
2365
+ const match = await findOutput(http, runId, selectorOrQuery);
2366
+ if (match)
2367
+ return match;
2368
+ throw new RunStateError("outputLink: output query matched no files", { runId });
2369
+ }
2370
+ function outputMatchesQuery(output, query) {
2371
+ const normalizedPath = typeof output.filename === "string" ? normalizeOutputQueryPath(output.filename) : "";
2372
+ if (query.path !== void 0 && normalizedPath !== normalizeOutputQueryPath(query.path)) {
2373
+ return false;
2374
+ }
2375
+ if (query.filename !== void 0) {
2376
+ const basename2 = basenameOf(normalizedPath);
2377
+ if (typeof query.filename === "string") {
2378
+ if (basename2 !== query.filename)
2379
+ return false;
2380
+ } else {
2381
+ query.filename.lastIndex = 0;
2382
+ if (!query.filename.test(basename2))
2383
+ return false;
2384
+ }
2385
+ }
2386
+ if (query.dir !== void 0 && !directoryMatches(normalizedPath, query.dir, query.recursive ?? true)) {
2387
+ return false;
2388
+ }
2389
+ if (query.extension !== void 0 && extensionOf(normalizedPath) !== normalizeExtension(query.extension)) {
2390
+ return false;
2391
+ }
2392
+ if (query.contentType !== void 0 && !contentTypeMatches(output.contentType, query.contentType)) {
2393
+ return false;
2394
+ }
2395
+ if (query.type !== void 0 && classifyOutput(output) !== query.type) {
2396
+ return false;
2397
+ }
2398
+ return true;
2399
+ }
2400
+ function hasOutputId(value) {
2401
+ return Boolean(value && typeof value === "object" && "id" in value && typeof value.id === "string");
2402
+ }
2403
+ function normalizeOutputQueryPath(path) {
2404
+ let normalized = path.replace(/\\/g, "/").replace(/^\/+/, "");
2405
+ while (normalized === "outputs" || normalized.startsWith("outputs/")) {
2406
+ normalized = normalized === "outputs" ? "" : normalized.slice("outputs/".length);
2407
+ }
2408
+ return normalized.replace(/\/+$/, "");
2409
+ }
2410
+ function basenameOf(path) {
2411
+ return path.split("/").filter(Boolean).pop() ?? "";
2412
+ }
2413
+ function directoryMatches(path, dir, recursive) {
2414
+ const normalizedDir = normalizeOutputQueryPath(dir);
2415
+ if (normalizedDir.length === 0)
2416
+ return true;
2417
+ const prefix = `${normalizedDir}/`;
2418
+ if (!path.startsWith(prefix))
2419
+ return false;
2420
+ const remainder = path.slice(prefix.length);
2421
+ return remainder.length > 0 && (recursive || !remainder.includes("/"));
2422
+ }
2423
+ function normalizeExtension(extension) {
2424
+ return extension.replace(/^\.+/, "").toLowerCase();
2425
+ }
2426
+ function extensionOf(path) {
2427
+ if (!path)
2428
+ return "";
2429
+ const basename2 = basenameOf(normalizeOutputQueryPath(path));
2430
+ const index = basename2.lastIndexOf(".");
2431
+ return index > 0 && index < basename2.length - 1 ? basename2.slice(index + 1).toLowerCase() : "";
2432
+ }
2433
+ function normalizeContentType(contentType) {
2434
+ return (contentType ?? "").split(";")[0].trim().toLowerCase();
2435
+ }
2436
+ function contentTypeMatches(actual, expected) {
2437
+ const normalizedActual = normalizeContentType(actual);
2438
+ const normalizedExpected = normalizeContentType(expected);
2439
+ if (!normalizedActual || !normalizedExpected)
2440
+ return false;
2441
+ if (normalizedExpected.endsWith("/*")) {
2442
+ return normalizedActual.startsWith(normalizedExpected.slice(0, -1));
2443
+ }
2444
+ return normalizedActual === normalizedExpected;
2445
+ }
2266
2446
  async function download(http, runId) {
2267
2447
  const [run, events, outputs] = await Promise.all([
2268
2448
  getRun(http, runId),
@@ -1 +1 @@
1
- 762430dc71b8a73c4ee49790997d44ada327ea0eec648cf7c26714ee785ba86e cli.mjs
1
+ 1b28b0b2c5ae5867dad0581510c232cf2cf956226db8efc20e66d97549a0d3b0 cli.mjs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/cli",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/aexhq/aex.git"
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "fflate": "^0.8.2",
30
- "@aexhq/contracts": "0.25.0"
30
+ "@aexhq/contracts": "0.25.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "esbuild": "^0.28.0"