@aexhq/sdk 0.13.8 → 0.13.10

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 CHANGED
@@ -65,7 +65,7 @@ const runId = await aex.submitRun({
65
65
  model: "claude-haiku-4-5",
66
66
  system: "You are a concise automation agent.",
67
67
  prompt: "Write a short answer about agent-first SDK design.",
68
- secrets: { anthropic: { apiKey: process.env.ANTHROPIC_API_KEY! } }
68
+ secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
69
69
  });
70
70
 
71
71
  const run = await aex.wait(runId);
@@ -94,7 +94,7 @@ function summarise(topic: string) {
94
94
 
95
95
  const runId = await aex.submitRun({
96
96
  ...summarise("agent-first SDK design"),
97
- secrets: { anthropic: { apiKey: process.env.ANTHROPIC_API_KEY! } }
97
+ secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
98
98
  });
99
99
  ```
100
100
 
@@ -0,0 +1 @@
1
+ export * from "./submission.js";
@@ -0,0 +1,8 @@
1
+ // Workspace-internal entry point. Re-exports the submission building blocks
2
+ // (leaf parsers, helper validators, shared constants) so the platform-only
3
+ // `@aexhq/shared` package can reuse them instead of hand-mirroring ~1.8k lines
4
+ // of validator code. NOT part of the public `@aexhq/contracts` surface — do
5
+ // NOT add this to the package `index`; consumers reach it via the explicit
6
+ // `@aexhq/contracts/internal` subpath.
7
+ export * from "./submission.js";
8
+ //# sourceMappingURL=internal.js.map
@@ -61,16 +61,16 @@ export declare const PROVIDER_PUBLIC_SUPPORT: {
61
61
  readonly label: "Generated matrix freshness";
62
62
  readonly href: "../../../scripts/validate/capability-matrix.test.ts";
63
63
  }, {
64
- readonly label: "Installed-SDK live user matrix";
65
- readonly href: "../../../apps/user-tests/test/live/live-sdk-comprehensive.test.ts";
64
+ readonly label: "Installed-SDK Anthropic live user test";
65
+ readonly href: "../../../apps/user-tests/test/live/live-sdk-anthropic-managed.test.ts";
66
66
  }, {
67
67
  readonly label: "Runtime support validator";
68
68
  readonly href: "../../contracts/test/runtime-support.test.ts";
69
69
  }];
70
70
  readonly runtimeEvidence: {
71
71
  readonly managed: readonly [{
72
- readonly label: "Installed-SDK live user matrix";
73
- readonly href: "../../../apps/user-tests/test/live/live-sdk-comprehensive.test.ts";
72
+ readonly label: "Installed-SDK Anthropic live user test";
73
+ readonly href: "../../../apps/user-tests/test/live/live-sdk-anthropic-managed.test.ts";
74
74
  }, {
75
75
  readonly label: "Runtime support validator";
76
76
  readonly href: "../../contracts/test/runtime-support.test.ts";
@@ -98,7 +98,10 @@ export declare const PROVIDER_PUBLIC_SUPPORT: {
98
98
  readonly label: "Generated matrix freshness";
99
99
  readonly href: "../../../scripts/validate/capability-matrix.test.ts";
100
100
  }, {
101
- readonly label: "Installed-SDK live user matrix";
101
+ readonly label: "Installed-SDK DeepSeek live user test";
102
+ readonly href: "../../../apps/user-tests/test/live/live-sdk-deepseek.test.ts";
103
+ }, {
104
+ readonly label: "Installed-SDK DeepSeek comprehensive live user matrix";
102
105
  readonly href: "../../../apps/user-tests/test/live/live-sdk-comprehensive.test.ts";
103
106
  }, {
104
107
  readonly label: "Runtime support validator";
@@ -106,7 +109,10 @@ export declare const PROVIDER_PUBLIC_SUPPORT: {
106
109
  }];
107
110
  readonly runtimeEvidence: {
108
111
  readonly managed: readonly [{
109
- readonly label: "Installed-SDK live user matrix";
112
+ readonly label: "Installed-SDK DeepSeek live user test";
113
+ readonly href: "../../../apps/user-tests/test/live/live-sdk-deepseek.test.ts";
114
+ }, {
115
+ readonly label: "Installed-SDK DeepSeek comprehensive live user matrix";
110
116
  readonly href: "../../../apps/user-tests/test/live/live-sdk-comprehensive.test.ts";
111
117
  }, {
112
118
  readonly label: "Runtime support validator";
@@ -12,11 +12,28 @@ const COMMON_EVIDENCE = [
12
12
  { label: "Runtime support validator", href: "../../contracts/test/runtime-support.test.ts" },
13
13
  { label: "Generated matrix freshness", href: "../../../scripts/validate/capability-matrix.test.ts" }
14
14
  ];
15
- const LIVE_USER_MATRIX_EVIDENCE = [
16
- { label: "Installed-SDK live user matrix", href: "../../../apps/user-tests/test/live/live-sdk-comprehensive.test.ts" }
15
+ const ANTHROPIC_LIVE_USER_EVIDENCE = [
16
+ {
17
+ label: "Installed-SDK Anthropic live user test",
18
+ href: "../../../apps/user-tests/test/live/live-sdk-anthropic-managed.test.ts"
19
+ }
20
+ ];
21
+ const DEEPSEEK_LIVE_USER_EVIDENCE = [
22
+ {
23
+ label: "Installed-SDK DeepSeek live user test",
24
+ href: "../../../apps/user-tests/test/live/live-sdk-deepseek.test.ts"
25
+ },
26
+ {
27
+ label: "Installed-SDK DeepSeek comprehensive live user matrix",
28
+ href: "../../../apps/user-tests/test/live/live-sdk-comprehensive.test.ts"
29
+ }
30
+ ];
31
+ const ANTHROPIC_MANAGED_EVIDENCE = [
32
+ ...ANTHROPIC_LIVE_USER_EVIDENCE,
33
+ { label: "Runtime support validator", href: "../../contracts/test/runtime-support.test.ts" }
17
34
  ];
18
- const MANAGED_PROXY_EVIDENCE = [
19
- ...LIVE_USER_MATRIX_EVIDENCE,
35
+ const DEEPSEEK_MANAGED_EVIDENCE = [
36
+ ...DEEPSEEK_LIVE_USER_EVIDENCE,
20
37
  { label: "Runtime support validator", href: "../../contracts/test/runtime-support.test.ts" }
21
38
  ];
22
39
  export const RUNTIME_VALIDATION_SUPPORT = {
@@ -38,9 +55,9 @@ export const PROVIDER_PUBLIC_SUPPORT = {
38
55
  status: "supported",
39
56
  docsAnchor: "anthropic",
40
57
  docs: COMMON_DOCS,
41
- evidence: [...COMMON_EVIDENCE, ...MANAGED_PROXY_EVIDENCE],
58
+ evidence: [...COMMON_EVIDENCE, ...ANTHROPIC_MANAGED_EVIDENCE],
42
59
  runtimeEvidence: {
43
- managed: MANAGED_PROXY_EVIDENCE
60
+ managed: ANTHROPIC_MANAGED_EVIDENCE
44
61
  }
45
62
  },
46
63
  deepseek: {
@@ -48,9 +65,9 @@ export const PROVIDER_PUBLIC_SUPPORT = {
48
65
  status: "supported",
49
66
  docsAnchor: "deepseek",
50
67
  docs: COMMON_DOCS,
51
- evidence: [...COMMON_EVIDENCE, ...MANAGED_PROXY_EVIDENCE],
68
+ evidence: [...COMMON_EVIDENCE, ...DEEPSEEK_MANAGED_EVIDENCE],
52
69
  runtimeEvidence: {
53
- managed: MANAGED_PROXY_EVIDENCE
70
+ managed: DEEPSEEK_MANAGED_EVIDENCE
54
71
  }
55
72
  },
56
73
  openai: {
@@ -75,21 +75,6 @@ export interface PlatformPackage {
75
75
  * package installer.
76
76
  */
77
77
  export declare function packageInstallString(pkg: PlatformPackage): string;
78
- export interface PlatformAnthropicSecrets {
79
- readonly apiKey: string;
80
- }
81
- export interface PlatformDeepseekSecrets {
82
- readonly apiKey: string;
83
- }
84
- export interface PlatformOpenAISecrets {
85
- readonly apiKey: string;
86
- }
87
- export interface PlatformGeminiSecrets {
88
- readonly apiKey: string;
89
- }
90
- export interface PlatformMistralSecrets {
91
- readonly apiKey: string;
92
- }
93
78
  /**
94
79
  * Run-time provider selector. Aex exposes one customer interface
95
80
  * for every provider. All new submissions execute through the managed
@@ -148,21 +133,15 @@ export type PlatformProxyAuthValue = {
148
133
  readonly value: string;
149
134
  };
150
135
  /**
151
- * Per-run inline secrets bundle. Exactly one of `anthropic` | `deepseek`
152
- * | `openai` | `gemini` | `mistral` is required, matching the run's
153
- * `provider`; the cross-provider coupling is enforced in
154
- * `parseRunSubmissionRequest` so the wire shape stays simple and
155
- * individual provider keys remain optional in the type system.
156
- * `mcpServers` and `proxyEndpointAuth` are cross-provider (an MCP
157
- * credential is the same secret whether Anthropic or another model is
158
- * driving the MCP client).
136
+ * Per-run inline secrets bundle. `apiKey` is the BYOK provider key for the
137
+ * run's selected `provider` (required in `"byok"` credential mode, rejected
138
+ * in `"managed"` mode). A run targets exactly one provider, so the key is a
139
+ * single flat field rather than a per-provider block. `mcpServers` and
140
+ * `proxyEndpointAuth` are cross-provider (an MCP credential is the same
141
+ * secret whichever model is driving the MCP client).
159
142
  */
160
143
  export interface PlatformInlineSecrets {
161
- readonly anthropic?: PlatformAnthropicSecrets;
162
- readonly deepseek?: PlatformDeepseekSecrets;
163
- readonly openai?: PlatformOpenAISecrets;
164
- readonly gemini?: PlatformGeminiSecrets;
165
- readonly mistral?: PlatformMistralSecrets;
144
+ readonly apiKey?: string;
166
145
  readonly mcpServers?: readonly PlatformMcpServerSecret[];
167
146
  readonly proxyEndpointAuth?: readonly PlatformProxyEndpointAuth[];
168
147
  }
@@ -190,6 +169,16 @@ export interface PlatformProxyEndpoint {
190
169
  readonly perCallBudget?: number;
191
170
  readonly responseByteBudget?: number;
192
171
  }
172
+ export declare const SECRETS_KEY = "secrets";
173
+ export declare const PROXY_ENDPOINT_NAME_PATTERN: RegExp;
174
+ export declare const RESERVED_PROXY_ENDPOINT_NAMES: Set<string>;
175
+ export declare const deniedSecretFields: Set<string>;
176
+ export declare function parseProxyAuthShape(input: unknown, field: string): ProxyAuthShape;
177
+ export declare function parseProxyMethods(input: unknown, field: string): readonly ProxyMethod[];
178
+ export declare function parseProxyPathPrefixes(input: unknown, field: string): readonly string[];
179
+ export declare function parseProxyAllowedHeaders(input: unknown, field: string, authShape: ProxyAuthShape): readonly string[] | undefined;
180
+ export declare function crossValidateProxyEndpointsAndAuth(endpoints: readonly PlatformProxyEndpoint[] | undefined, auth: readonly PlatformProxyEndpointAuth[] | undefined): void;
181
+ export declare function parseInlineSecrets(input: unknown): PlatformInlineSecrets;
193
182
  /**
194
183
  * The proxy body-redactor refuses to mask any derived target string shorter
195
184
  * than this many bytes — masking a 1-byte literal would corrupt the response
@@ -199,6 +188,12 @@ export interface PlatformProxyEndpoint {
199
188
  * never silently diverge.
200
189
  */
201
190
  export declare const MIN_REDACTION_TARGET_BYTES = 4;
191
+ export declare function assertNoSecretBearingFields(input: unknown, path: readonly string[]): void;
192
+ export declare function requireRecord(input: unknown, field: string): Record<string, unknown>;
193
+ export declare function requireString(input: unknown, field: string): string;
194
+ export declare function optionalString(input: unknown, field: string): string | undefined;
195
+ export declare function optionalEnum<const T extends readonly string[]>(input: unknown, field: string, allowed: T): T[number] | undefined;
196
+ export declare function optionalPositiveInt(input: unknown, field: string): number | undefined;
202
197
  /**
203
198
  * Wire-level submission posted to /api/runs in the flat surface. The
204
199
  * `prompt` is always an array internally so the worker, the audit log,
@@ -353,6 +348,20 @@ export interface ParseRunSubmissionOptions {
353
348
  readonly managedKeyPolicy?: ManagedKeyPolicyV1;
354
349
  }
355
350
  export declare function parseRunSubmissionRequest(input: unknown, options?: ParseRunSubmissionOptions): PlatformRunSubmissionRequest;
351
+ export declare function parseRuntimeKind(input: unknown): RuntimeKind | undefined;
352
+ export declare function parseRunProvider(input: unknown): RunProvider;
353
+ /**
354
+ * Cross-check the supplied secrets bundle against the credential mode.
355
+ *
356
+ * - `"byok"`: `secrets.apiKey` (the provider key for the run's `provider`)
357
+ * MUST be present.
358
+ * - `"managed"`: `secrets.apiKey` MUST be absent — provider access is
359
+ * resolved by the managed-key policy, not a caller-supplied key.
360
+ * - MCP / proxy endpoint auth carry across providers and are not
361
+ * checked here.
362
+ */
363
+ export declare function enforceCredentialSecretPolicy(credentialMode: CredentialMode, secrets: PlatformInlineSecrets): void;
364
+ export declare function parseSubmission(input: unknown): PlatformSubmission;
356
365
  /** Assistant-output granularity values. Buffered is the platform default. */
357
366
  export declare const OUTPUT_MODES: readonly ["buffered", "stream"];
358
367
  export type OutputMode = (typeof OUTPUT_MODES)[number];
@@ -96,9 +96,9 @@ export function checkRuntimeSupported(provider, runtime) {
96
96
  void provider;
97
97
  return { ok: true };
98
98
  }
99
- const SECRETS_KEY = "secrets";
100
- const PROXY_ENDPOINT_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,62}$/;
101
- const RESERVED_PROXY_ENDPOINT_NAMES = new Set(["proxy", "aex", "internal", "admin"]);
99
+ export const SECRETS_KEY = "secrets";
100
+ export const PROXY_ENDPOINT_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,62}$/;
101
+ export const RESERVED_PROXY_ENDPOINT_NAMES = new Set(["proxy", "aex", "internal", "admin"]);
102
102
  /**
103
103
  * Headers the proxy never lets through, regardless of policy. Lowercase.
104
104
  * Anything that could re-introduce credentials, cookies, or routing
@@ -120,7 +120,7 @@ const PROXY_DENY_HEADER_LIST = new Set([
120
120
  "x-forwarded-proto",
121
121
  "x-real-ip"
122
122
  ]);
123
- const deniedSecretFields = new Set([
123
+ export const deniedSecretFields = new Set([
124
124
  "providerApiKey",
125
125
  "anthropicApiKey",
126
126
  "apiKey",
@@ -387,7 +387,7 @@ function parseProxyBaseUrl(input, field) {
387
387
  const normalized = `${parsed.origin}${parsed.pathname.replace(/\/+$/, "")}`;
388
388
  return normalized;
389
389
  }
390
- function parseProxyAuthShape(input, field) {
390
+ export function parseProxyAuthShape(input, field) {
391
391
  const value = requireRecord(input, field);
392
392
  const type = requireString(value.type, `${field}.type`);
393
393
  switch (type) {
@@ -418,7 +418,7 @@ function parseProxyAuthShape(input, field) {
418
418
  throw new Error(`${field}.type must be one of: none, bearer, basic, header, query`);
419
419
  }
420
420
  }
421
- function parseProxyMethods(input, field) {
421
+ export function parseProxyMethods(input, field) {
422
422
  if (!Array.isArray(input) || input.length === 0) {
423
423
  throw new Error(`${field} must be a non-empty array of HTTP methods`);
424
424
  }
@@ -435,7 +435,7 @@ function parseProxyMethods(input, field) {
435
435
  }
436
436
  return Array.from(seen);
437
437
  }
438
- function parseProxyPathPrefixes(input, field) {
438
+ export function parseProxyPathPrefixes(input, field) {
439
439
  if (!Array.isArray(input) || input.length === 0) {
440
440
  throw new Error(`${field} must be a non-empty array of path prefixes`);
441
441
  }
@@ -453,7 +453,7 @@ function parseProxyPathPrefixes(input, field) {
453
453
  }
454
454
  return Array.from(seen);
455
455
  }
456
- function parseProxyAllowedHeaders(input, field, authShape) {
456
+ export function parseProxyAllowedHeaders(input, field, authShape) {
457
457
  if (input === undefined) {
458
458
  return undefined;
459
459
  }
@@ -497,7 +497,7 @@ function assertOnlyKeys(value, field, allowed) {
497
497
  }
498
498
  }
499
499
  }
500
- function crossValidateProxyEndpointsAndAuth(endpoints, auth) {
500
+ export function crossValidateProxyEndpointsAndAuth(endpoints, auth) {
501
501
  const endpointsList = endpoints ?? [];
502
502
  const authList = auth ?? [];
503
503
  const endpointsByName = new Map(endpointsList.map((e) => [e.name, e]));
@@ -527,14 +527,9 @@ function crossValidateProxyEndpointsAndAuth(endpoints, auth) {
527
527
  }
528
528
  }
529
529
  }
530
- const PROVIDER_SECRET_KEYS = ["anthropic", "deepseek", "openai", "gemini", "mistral"];
531
- function parseInlineSecrets(input) {
530
+ export function parseInlineSecrets(input) {
532
531
  const value = requireRecord(input, "secrets");
533
- const allowedTopLevel = new Set([
534
- ...PROVIDER_SECRET_KEYS,
535
- "mcpServers",
536
- "proxyEndpointAuth"
537
- ]);
532
+ const allowedTopLevel = new Set(["apiKey", "mcpServers", "proxyEndpointAuth"]);
538
533
  for (const key of Object.keys(value)) {
539
534
  if (key.startsWith("__aex_")) {
540
535
  // Platform-internal namespace (e.g. __aex_proxy_token). The BFF
@@ -547,35 +542,15 @@ function parseInlineSecrets(input) {
547
542
  throw new Error(`secrets.${key} is not an allowed field; permitted: ${[...allowedTopLevel].join(", ")}`);
548
543
  }
549
544
  }
550
- const anthropic = value.anthropic !== undefined ? parseProviderSecret(value.anthropic, "anthropic") : undefined;
551
- const deepseek = value.deepseek !== undefined ? parseProviderSecret(value.deepseek, "deepseek") : undefined;
552
- const openai = value.openai !== undefined ? parseProviderSecret(value.openai, "openai") : undefined;
553
- const gemini = value.gemini !== undefined ? parseProviderSecret(value.gemini, "gemini") : undefined;
554
- const mistral = value.mistral !== undefined ? parseProviderSecret(value.mistral, "mistral") : undefined;
545
+ const apiKey = value.apiKey !== undefined ? requireString(value.apiKey, "secrets.apiKey") : undefined;
555
546
  const mcpServers = parseMcpServerSecrets(value.mcpServers);
556
547
  const proxyEndpointAuth = parseProxyEndpointAuth(value.proxyEndpointAuth);
557
548
  return {
558
- ...(anthropic ? { anthropic } : {}),
559
- ...(deepseek ? { deepseek } : {}),
560
- ...(openai ? { openai } : {}),
561
- ...(gemini ? { gemini } : {}),
562
- ...(mistral ? { mistral } : {}),
549
+ ...(apiKey !== undefined ? { apiKey } : {}),
563
550
  ...(mcpServers ? { mcpServers } : {}),
564
551
  ...(proxyEndpointAuth ? { proxyEndpointAuth } : {})
565
552
  };
566
553
  }
567
- function parseProviderSecret(input, provider) {
568
- const field = `secrets.${provider}`;
569
- const value = requireRecord(input, field);
570
- const allowed = new Set(["apiKey"]);
571
- for (const key of Object.keys(value)) {
572
- if (!allowed.has(key)) {
573
- throw new Error(`${field}.${key} is not an allowed field; permitted: apiKey`);
574
- }
575
- }
576
- const apiKey = requireString(value.apiKey, `${field}.apiKey`);
577
- return { apiKey };
578
- }
579
554
  function parseMcpServerSecrets(input) {
580
555
  if (input === undefined) {
581
556
  return undefined;
@@ -703,7 +678,7 @@ function requireSecretValue(input, field) {
703
678
  }
704
679
  return value;
705
680
  }
706
- function assertNoSecretBearingFields(input, path) {
681
+ export function assertNoSecretBearingFields(input, path) {
707
682
  if (Array.isArray(input)) {
708
683
  input.forEach((item, index) => assertNoSecretBearingFields(item, [...path, String(index)]));
709
684
  return;
@@ -718,7 +693,7 @@ function assertNoSecretBearingFields(input, path) {
718
693
  assertNoSecretBearingFields(value, [...path, key]);
719
694
  }
720
695
  }
721
- function requireRecord(input, field) {
696
+ export function requireRecord(input, field) {
722
697
  if (!isRecord(input)) {
723
698
  throw new Error(`${field} must be an object`);
724
699
  }
@@ -727,19 +702,19 @@ function requireRecord(input, field) {
727
702
  function isRecord(input) {
728
703
  return typeof input === "object" && input !== null && !Array.isArray(input);
729
704
  }
730
- function requireString(input, field) {
705
+ export function requireString(input, field) {
731
706
  if (typeof input !== "string" || input.length === 0) {
732
707
  throw new Error(`${field} must be a non-empty string`);
733
708
  }
734
709
  return input;
735
710
  }
736
- function optionalString(input, field) {
711
+ export function optionalString(input, field) {
737
712
  if (input === undefined) {
738
713
  return undefined;
739
714
  }
740
715
  return requireString(input, field);
741
716
  }
742
- function optionalEnum(input, field, allowed) {
717
+ export function optionalEnum(input, field, allowed) {
743
718
  if (input === undefined) {
744
719
  return undefined;
745
720
  }
@@ -778,7 +753,7 @@ function optionalJsonRecord(input, field) {
778
753
  }
779
754
  return value;
780
755
  }
781
- function optionalPositiveInt(input, field) {
756
+ export function optionalPositiveInt(input, field) {
782
757
  if (input === undefined) {
783
758
  return undefined;
784
759
  }
@@ -848,7 +823,7 @@ export function parseRunSubmissionRequest(input, options = {}) {
848
823
  const timeoutMs = parseRunTimeout(value.timeout);
849
824
  const proxyEndpoints = parseProxyEndpoints(value.proxyEndpoints);
850
825
  const secrets = parseInlineSecrets(value.secrets);
851
- enforceCredentialSecretPolicy(provider, credentialMode, secrets);
826
+ enforceCredentialSecretPolicy(credentialMode, secrets);
852
827
  crossValidateProxyEndpointsAndAuth(proxyEndpoints, secrets.proxyEndpointAuth);
853
828
  const submission = parseSubmission(value.submission);
854
829
  // mcpServers names must agree across the submission half and the
@@ -896,7 +871,7 @@ export function parseRunSubmissionRequest(input, options = {}) {
896
871
  secrets
897
872
  };
898
873
  }
899
- function parseRuntimeKind(input) {
874
+ export function parseRuntimeKind(input) {
900
875
  if (input === undefined) {
901
876
  return undefined;
902
877
  }
@@ -905,7 +880,7 @@ function parseRuntimeKind(input) {
905
880
  }
906
881
  return input;
907
882
  }
908
- function parseRunProvider(input) {
883
+ export function parseRunProvider(input) {
909
884
  if (input === undefined) {
910
885
  return DEFAULT_RUN_PROVIDER;
911
886
  }
@@ -915,39 +890,27 @@ function parseRunProvider(input) {
915
890
  return input;
916
891
  }
917
892
  /**
918
- * Cross-check the chosen provider against the supplied secrets bundle.
893
+ * Cross-check the supplied secrets bundle against the credential mode.
919
894
  *
920
- * - The matching provider's apiKey MUST be present.
921
- * - Every OTHER provider's secret block MUST be absent (cross-provider
922
- * secrets are explicitly rejected, not silently dropped they are
923
- * almost always a copy-paste mistake or a confused caller, and we
924
- * want to fail loud).
895
+ * - `"byok"`: `secrets.apiKey` (the provider key for the run's `provider`)
896
+ * MUST be present.
897
+ * - `"managed"`: `secrets.apiKey` MUST be absentprovider access is
898
+ * resolved by the managed-key policy, not a caller-supplied key.
925
899
  * - MCP / proxy endpoint auth carry across providers and are not
926
900
  * checked here.
927
901
  */
928
- function enforceCredentialSecretPolicy(provider, credentialMode, secrets) {
902
+ export function enforceCredentialSecretPolicy(credentialMode, secrets) {
929
903
  if (credentialMode === "managed") {
930
- for (const providerKey of PROVIDER_SECRET_KEYS) {
931
- if (secrets[providerKey] !== undefined) {
932
- throw new Error(`secrets.${providerKey} is not allowed when credentialMode is managed; provider access is resolved by the managed-key policy`);
933
- }
904
+ if (secrets.apiKey !== undefined) {
905
+ throw new Error(`secrets.apiKey is not allowed when credentialMode is managed; provider access is resolved by the managed-key policy`);
934
906
  }
935
907
  return;
936
908
  }
937
- const required = secrets[provider];
938
- if (!required?.apiKey) {
939
- throw new Error(`secrets.${provider}.apiKey is required when provider is ${provider}`);
940
- }
941
- for (const other of PROVIDER_SECRET_KEYS) {
942
- if (other === provider) {
943
- continue;
944
- }
945
- if (secrets[other] !== undefined) {
946
- throw new Error(`secrets.${other} is not allowed when provider is ${provider}; remove it or set provider to ${other}`);
947
- }
909
+ if (!secrets.apiKey) {
910
+ throw new Error(`secrets.apiKey is required when credentialMode is byok`);
948
911
  }
949
912
  }
950
- function parseSubmission(input) {
913
+ export function parseSubmission(input) {
951
914
  const value = requireRecord(input, "submission.submission");
952
915
  const allowed = new Set([
953
916
  "model",
package/dist/cli.mjs CHANGED
@@ -44,11 +44,28 @@ var COMMON_EVIDENCE = [
44
44
  { label: "Runtime support validator", href: "../../contracts/test/runtime-support.test.ts" },
45
45
  { label: "Generated matrix freshness", href: "../../../scripts/validate/capability-matrix.test.ts" }
46
46
  ];
47
- var LIVE_USER_MATRIX_EVIDENCE = [
48
- { label: "Installed-SDK live user matrix", href: "../../../apps/user-tests/test/live/live-sdk-comprehensive.test.ts" }
47
+ var ANTHROPIC_LIVE_USER_EVIDENCE = [
48
+ {
49
+ label: "Installed-SDK Anthropic live user test",
50
+ href: "../../../apps/user-tests/test/live/live-sdk-anthropic-managed.test.ts"
51
+ }
52
+ ];
53
+ var DEEPSEEK_LIVE_USER_EVIDENCE = [
54
+ {
55
+ label: "Installed-SDK DeepSeek live user test",
56
+ href: "../../../apps/user-tests/test/live/live-sdk-deepseek.test.ts"
57
+ },
58
+ {
59
+ label: "Installed-SDK DeepSeek comprehensive live user matrix",
60
+ href: "../../../apps/user-tests/test/live/live-sdk-comprehensive.test.ts"
61
+ }
49
62
  ];
50
- var MANAGED_PROXY_EVIDENCE = [
51
- ...LIVE_USER_MATRIX_EVIDENCE,
63
+ var ANTHROPIC_MANAGED_EVIDENCE = [
64
+ ...ANTHROPIC_LIVE_USER_EVIDENCE,
65
+ { label: "Runtime support validator", href: "../../contracts/test/runtime-support.test.ts" }
66
+ ];
67
+ var DEEPSEEK_MANAGED_EVIDENCE = [
68
+ ...DEEPSEEK_LIVE_USER_EVIDENCE,
52
69
  { label: "Runtime support validator", href: "../../contracts/test/runtime-support.test.ts" }
53
70
  ];
54
71
  var PROVIDER_PUBLIC_SUPPORT = {
@@ -57,9 +74,9 @@ var PROVIDER_PUBLIC_SUPPORT = {
57
74
  status: "supported",
58
75
  docsAnchor: "anthropic",
59
76
  docs: COMMON_DOCS,
60
- evidence: [...COMMON_EVIDENCE, ...MANAGED_PROXY_EVIDENCE],
77
+ evidence: [...COMMON_EVIDENCE, ...ANTHROPIC_MANAGED_EVIDENCE],
61
78
  runtimeEvidence: {
62
- managed: MANAGED_PROXY_EVIDENCE
79
+ managed: ANTHROPIC_MANAGED_EVIDENCE
63
80
  }
64
81
  },
65
82
  deepseek: {
@@ -67,9 +84,9 @@ var PROVIDER_PUBLIC_SUPPORT = {
67
84
  status: "supported",
68
85
  docsAnchor: "deepseek",
69
86
  docs: COMMON_DOCS,
70
- evidence: [...COMMON_EVIDENCE, ...MANAGED_PROXY_EVIDENCE],
87
+ evidence: [...COMMON_EVIDENCE, ...DEEPSEEK_MANAGED_EVIDENCE],
71
88
  runtimeEvidence: {
72
- managed: MANAGED_PROXY_EVIDENCE
89
+ managed: DEEPSEEK_MANAGED_EVIDENCE
73
90
  }
74
91
  },
75
92
  openai: {
@@ -3156,11 +3173,8 @@ async function runRunCmd(io2, argv) {
3156
3173
  ...runConfig.environment ? { environment: runConfig.environment } : {},
3157
3174
  ...runConfig.metadata ? { metadata: runConfig.metadata } : {}
3158
3175
  };
3159
- const providerSecrets = {
3160
- [provider]: { apiKey: providerKeyValues[provider] }
3161
- };
3162
3176
  const secrets = {
3163
- ...providerSecrets,
3177
+ apiKey: providerKeyValues[provider],
3164
3178
  ...mcpServerSecrets.length > 0 ? { mcpServers: mcpServerSecrets } : {},
3165
3179
  ...proxyAuth.length > 0 ? { proxyEndpointAuth: proxyAuth } : {}
3166
3180
  };
@@ -1 +1 @@
1
- 2e7ad715af0e691bcc91e7f403c611f03d6e9a1e0566889dd32fd4b956b71779 cli.mjs
1
+ 9219ad7c8ff381c3e9916e5f312e110d9546cedb035b5a2f65bbbd07f5e27d4f cli.mjs
package/dist/client.d.ts CHANGED
@@ -37,8 +37,9 @@ export interface AgentExecutorOptions {
37
37
  * secret is bundled into the constructor and split into
38
38
  * `secrets.proxyEndpointAuth` server-side; the public submission
39
39
  * only carries the declaration (`{ name, baseUrl, authShape, … }`).
40
- * - `secrets.<provider>.apiKey` — REQUIRED for the selected provider.
41
- * The platform never holds a long-lived provider key on your behalf.
40
+ * - `secrets.apiKey` — REQUIRED: the provider key for the selected
41
+ * `provider`. The platform never holds a long-lived provider key on
42
+ * your behalf.
42
43
  *
43
44
  * `idempotencyKey` is auto-generated when omitted; pass one explicitly
44
45
  * if you want client-driven retry safety across process restarts.
@@ -46,16 +47,16 @@ export interface AgentExecutorOptions {
46
47
  export interface SubmitRunOptions {
47
48
  /**
48
49
  * Credential source for upstream provider access. Omitted defaults to
49
- * `"byok"`, which requires `secrets.<provider>.apiKey` as today.
50
+ * `"byok"`, which requires `secrets.apiKey`.
50
51
  * `"managed"` is reserved for paid managed-key mode and currently fails
51
52
  * closed until the hosted private implementation is wired.
52
53
  */
53
54
  readonly credentialMode?: CredentialMode;
54
55
  /**
55
56
  * Provider selector. Optional — defaults to
56
- * {@link DEFAULT_RUN_PROVIDER} (`"anthropic"`). The call site must
57
- * supply the matching `secrets.<provider>.apiKey` and MUST NOT
58
- * supply any other provider's secret block.
57
+ * {@link DEFAULT_RUN_PROVIDER} (`"anthropic"`). Selects which upstream
58
+ * model route the managed provider-proxy uses; the BYOK key for it is
59
+ * supplied as `secrets.apiKey`.
59
60
  */
60
61
  readonly provider?: RunProvider;
61
62
  /**