@boxrouter/sdk 0.0.0-stage → 0.12.190
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/LICENSE +202 -0
- package/NOTICE +40 -0
- package/README.md +508 -2
- package/dist/addresses.d.ts +5 -0
- package/dist/addresses.js +10 -0
- package/dist/api-error.d.ts +62 -0
- package/dist/api-error.js +264 -0
- package/dist/boxrouter.d.ts +68 -0
- package/dist/boxrouter.js +291 -0
- package/dist/browser-session/index.d.ts +17 -0
- package/dist/browser-session/index.js +48 -0
- package/dist/browser-session/operations.gen.d.ts +272 -0
- package/dist/browser-session/operations.gen.js +58 -0
- package/dist/browser-session/responseContracts/api_keys.d.ts +2 -0
- package/dist/browser-session/responseContracts/api_keys.js +10 -0
- package/dist/browser-session/responseContracts/credits.d.ts +2 -0
- package/dist/browser-session/responseContracts/credits.js +8 -0
- package/dist/browser-session/responseContracts/github.d.ts +2 -0
- package/dist/browser-session/responseContracts/github.js +11 -0
- package/dist/browser-session/responseContracts/identity.d.ts +2 -0
- package/dist/browser-session/responseContracts/identity.js +30 -0
- package/dist/browser-session/responseContracts/organizations.d.ts +2 -0
- package/dist/browser-session/responseContracts/organizations.js +17 -0
- package/dist/browser-session/responseContracts/privacy.d.ts +2 -0
- package/dist/browser-session/responseContracts/privacy.js +7 -0
- package/dist/browser-session/responseContracts.gen.d.ts +3 -0
- package/dist/browser-session/responseContracts.gen.js +10 -0
- package/dist/browser-session/responseValidators/api_keys-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/api_keys-diagnostics.d.cts +4 -0
- package/dist/browser-session/responseValidators/api_keys.cjs +2 -0
- package/dist/browser-session/responseValidators/api_keys.d.cts +4 -0
- package/dist/browser-session/responseValidators/credits-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/credits-diagnostics.d.cts +3 -0
- package/dist/browser-session/responseValidators/credits.cjs +2 -0
- package/dist/browser-session/responseValidators/credits.d.cts +3 -0
- package/dist/browser-session/responseValidators/github-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/github-diagnostics.d.cts +3 -0
- package/dist/browser-session/responseValidators/github.cjs +2 -0
- package/dist/browser-session/responseValidators/github.d.cts +3 -0
- package/dist/browser-session/responseValidators/identity-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/identity-diagnostics.d.cts +23 -0
- package/dist/browser-session/responseValidators/identity.cjs +2 -0
- package/dist/browser-session/responseValidators/identity.d.cts +23 -0
- package/dist/browser-session/responseValidators/organizations-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/organizations-diagnostics.d.cts +15 -0
- package/dist/browser-session/responseValidators/organizations.cjs +2 -0
- package/dist/browser-session/responseValidators/organizations.d.cts +15 -0
- package/dist/browser-session/responseValidators/privacy-diagnostics.cjs +1 -0
- package/dist/browser-session/responseValidators/privacy-diagnostics.d.cts +2 -0
- package/dist/browser-session/responseValidators/privacy.cjs +2 -0
- package/dist/browser-session/responseValidators/privacy.d.cts +2 -0
- package/dist/client/client.gen.d.ts +2 -0
- package/dist/client/client.gen.js +168 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.js +17 -0
- package/dist/client/types.gen.d.ts +120 -0
- package/dist/client/types.gen.js +3 -0
- package/dist/client/utils.gen.d.ts +37 -0
- package/dist/client/utils.gen.js +239 -0
- package/dist/client.gen.d.ts +12 -0
- package/dist/client.gen.js +6 -0
- package/dist/command-check.gen.d.ts +14 -0
- package/dist/command-check.gen.js +23 -0
- package/dist/command-input.gen.d.ts +6 -0
- package/dist/command-input.gen.js +45 -0
- package/dist/core/auth.gen.d.ts +25 -0
- package/dist/core/auth.gen.js +18 -0
- package/dist/core/binaryStream.d.ts +8 -0
- package/dist/core/binaryStream.js +76 -0
- package/dist/core/bodySerializer.gen.d.ts +25 -0
- package/dist/core/bodySerializer.gen.js +60 -0
- package/dist/core/commandValidators.cjs +1 -0
- package/dist/core/commandValidators.d.cts +14 -0
- package/dist/core/eventValidation.d.ts +17 -0
- package/dist/core/eventValidation.js +56 -0
- package/dist/core/eventValidators.cjs +1 -0
- package/dist/core/eventValidators.d.cts +2 -0
- package/dist/core/json.d.ts +3 -0
- package/dist/core/json.js +33 -0
- package/dist/core/params.gen.d.ts +43 -0
- package/dist/core/params.gen.js +112 -0
- package/dist/core/pathSerializer.gen.d.ts +33 -0
- package/dist/core/pathSerializer.gen.js +115 -0
- package/dist/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/core/queryKeySerializer.gen.js +98 -0
- package/dist/core/responseContracts/actions.d.ts +2 -0
- package/dist/core/responseContracts/actions.js +30 -0
- package/dist/core/responseContracts/agents.d.ts +2 -0
- package/dist/core/responseContracts/agents.js +7 -0
- package/dist/core/responseContracts/artifacts.d.ts +2 -0
- package/dist/core/responseContracts/artifacts.js +8 -0
- package/dist/core/responseContracts/commands.d.ts +2 -0
- package/dist/core/responseContracts/commands.js +6 -0
- package/dist/core/responseContracts/credits.d.ts +2 -0
- package/dist/core/responseContracts/credits.js +27 -0
- package/dist/core/responseContracts/files.d.ts +2 -0
- package/dist/core/responseContracts/files.js +15 -0
- package/dist/core/responseContracts/github.d.ts +2 -0
- package/dist/core/responseContracts/github.js +8 -0
- package/dist/core/responseContracts/images.d.ts +2 -0
- package/dist/core/responseContracts/images.js +8 -0
- package/dist/core/responseContracts/launchRuns.d.ts +2 -0
- package/dist/core/responseContracts/launchRuns.js +10 -0
- package/dist/core/responseContracts/launches.d.ts +2 -0
- package/dist/core/responseContracts/launches.js +10 -0
- package/dist/core/responseContracts/operations.d.ts +2 -0
- package/dist/core/responseContracts/operations.js +7 -0
- package/dist/core/responseContracts/previews.d.ts +2 -0
- package/dist/core/responseContracts/previews.js +8 -0
- package/dist/core/responseContracts/pricing.d.ts +2 -0
- package/dist/core/responseContracts/pricing.js +6 -0
- package/dist/core/responseContracts/processes.d.ts +2 -0
- package/dist/core/responseContracts/processes.js +11 -0
- package/dist/core/responseContracts/provider_accounts.d.ts +2 -0
- package/dist/core/responseContracts/provider_accounts.js +13 -0
- package/dist/core/responseContracts/providers.d.ts +2 -0
- package/dist/core/responseContracts/providers.js +6 -0
- package/dist/core/responseContracts/routing.d.ts +2 -0
- package/dist/core/responseContracts/routing.js +8 -0
- package/dist/core/responseContracts/sandboxes.d.ts +2 -0
- package/dist/core/responseContracts/sandboxes.js +15 -0
- package/dist/core/responseContracts/secrets.d.ts +2 -0
- package/dist/core/responseContracts/secrets.js +8 -0
- package/dist/core/responseContracts/spend_limits.d.ts +2 -0
- package/dist/core/responseContracts/spend_limits.js +8 -0
- package/dist/core/responseContracts/terminals.d.ts +2 -0
- package/dist/core/responseContracts/terminals.js +11 -0
- package/dist/core/responseContracts/usage.d.ts +2 -0
- package/dist/core/responseContracts/usage.js +7 -0
- package/dist/core/responseContracts/volumes.d.ts +2 -0
- package/dist/core/responseContracts/volumes.js +19 -0
- package/dist/core/responseContracts.gen.d.ts +3 -0
- package/dist/core/responseContracts.gen.js +27 -0
- package/dist/core/responseModes.d.ts +19 -0
- package/dist/core/responseModes.js +13 -0
- package/dist/core/responseValidation.d.ts +44 -0
- package/dist/core/responseValidation.js +174 -0
- package/dist/core/responseValidators/actions-diagnostics.cjs +4 -0
- package/dist/core/responseValidators/actions-diagnostics.d.cts +24 -0
- package/dist/core/responseValidators/actions.cjs +2 -0
- package/dist/core/responseValidators/actions.d.cts +24 -0
- package/dist/core/responseValidators/agents-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/agents-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/agents.cjs +2 -0
- package/dist/core/responseValidators/agents.d.cts +2 -0
- package/dist/core/responseValidators/artifacts-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/artifacts-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/artifacts.cjs +2 -0
- package/dist/core/responseValidators/artifacts.d.cts +2 -0
- package/dist/core/responseValidators/commands-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/commands-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/commands.cjs +2 -0
- package/dist/core/responseValidators/commands.d.cts +1 -0
- package/dist/core/responseValidators/compact.cjs +122 -0
- package/dist/core/responseValidators/credits-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/credits-diagnostics.d.cts +21 -0
- package/dist/core/responseValidators/credits.cjs +2 -0
- package/dist/core/responseValidators/credits.d.cts +21 -0
- package/dist/core/responseValidators/files-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/files-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/files.cjs +2 -0
- package/dist/core/responseValidators/files.d.cts +5 -0
- package/dist/core/responseValidators/github-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/github-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/github.cjs +2 -0
- package/dist/core/responseValidators/github.d.cts +2 -0
- package/dist/core/responseValidators/images-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/images-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/images.cjs +2 -0
- package/dist/core/responseValidators/images.d.cts +3 -0
- package/dist/core/responseValidators/launchRuns-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/launchRuns-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/launchRuns.cjs +2 -0
- package/dist/core/responseValidators/launchRuns.d.cts +5 -0
- package/dist/core/responseValidators/launches-diagnostics.cjs +10 -0
- package/dist/core/responseValidators/launches-diagnostics.d.cts +5 -0
- package/dist/core/responseValidators/launches.cjs +2 -0
- package/dist/core/responseValidators/launches.d.cts +5 -0
- package/dist/core/responseValidators/operations-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/operations-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/operations.cjs +2 -0
- package/dist/core/responseValidators/operations.d.cts +2 -0
- package/dist/core/responseValidators/previews-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/previews-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/previews.cjs +2 -0
- package/dist/core/responseValidators/previews.d.cts +3 -0
- package/dist/core/responseValidators/pricing-diagnostics.cjs +7 -0
- package/dist/core/responseValidators/pricing-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/pricing.cjs +2 -0
- package/dist/core/responseValidators/pricing.d.cts +1 -0
- package/dist/core/responseValidators/processes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/processes-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/processes.cjs +2 -0
- package/dist/core/responseValidators/processes.d.cts +2 -0
- package/dist/core/responseValidators/provider_accounts-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/provider_accounts-diagnostics.d.cts +8 -0
- package/dist/core/responseValidators/provider_accounts.cjs +2 -0
- package/dist/core/responseValidators/provider_accounts.d.cts +8 -0
- package/dist/core/responseValidators/providers-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/providers-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/providers.cjs +2 -0
- package/dist/core/responseValidators/providers.d.cts +1 -0
- package/dist/core/responseValidators/routing-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/routing-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/routing.cjs +2 -0
- package/dist/core/responseValidators/routing.d.cts +3 -0
- package/dist/core/responseValidators/sandboxes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/sandboxes-diagnostics.d.cts +10 -0
- package/dist/core/responseValidators/sandboxes.cjs +2 -0
- package/dist/core/responseValidators/sandboxes.d.cts +10 -0
- package/dist/core/responseValidators/secrets-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/secrets-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/secrets.cjs +2 -0
- package/dist/core/responseValidators/secrets.d.cts +1 -0
- package/dist/core/responseValidators/spend_limits-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/spend_limits-diagnostics.d.cts +3 -0
- package/dist/core/responseValidators/spend_limits.cjs +2 -0
- package/dist/core/responseValidators/spend_limits.d.cts +3 -0
- package/dist/core/responseValidators/terminals-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/terminals-diagnostics.d.cts +2 -0
- package/dist/core/responseValidators/terminals.cjs +2 -0
- package/dist/core/responseValidators/terminals.d.cts +2 -0
- package/dist/core/responseValidators/usage-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/usage-diagnostics.d.cts +1 -0
- package/dist/core/responseValidators/usage.cjs +2 -0
- package/dist/core/responseValidators/usage.d.cts +1 -0
- package/dist/core/responseValidators/volumes-diagnostics.cjs +1 -0
- package/dist/core/responseValidators/volumes-diagnostics.d.cts +10 -0
- package/dist/core/responseValidators/volumes.cjs +2 -0
- package/dist/core/responseValidators/volumes.d.cts +10 -0
- package/dist/core/serverSentEvents.gen.d.ts +30 -0
- package/dist/core/serverSentEvents.gen.js +313 -0
- package/dist/core/streamErrors.d.ts +32 -0
- package/dist/core/streamErrors.js +51 -0
- package/dist/core/types.gen.d.ts +83 -0
- package/dist/core/types.gen.js +3 -0
- package/dist/core/utils.gen.d.ts +19 -0
- package/dist/core/utils.gen.js +93 -0
- package/dist/creation.gen.d.ts +21 -0
- package/dist/creation.gen.js +35 -0
- package/dist/data-origin.d.ts +25 -0
- package/dist/data-origin.js +57 -0
- package/dist/error-codes.gen.d.ts +2 -0
- package/dist/error-codes.gen.js +2 -0
- package/dist/idempotency.gen.d.ts +1 -0
- package/dist/idempotency.gen.js +60 -0
- package/dist/images.d.ts +74 -0
- package/dist/images.js +88 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +80 -0
- package/dist/launch-input.gen.d.ts +9 -0
- package/dist/launch-input.gen.js +83 -0
- package/dist/launch.d.ts +28 -0
- package/dist/launch.js +222 -0
- package/dist/namespace-actions.d.mts +307 -0
- package/dist/namespace-actions.mjs +595 -0
- package/dist/namespace-agents.d.mts +33 -0
- package/dist/namespace-agents.mjs +40 -0
- package/dist/namespace-artifacts.d.mts +46 -0
- package/dist/namespace-artifacts.mjs +69 -0
- package/dist/namespace-base.d.mts +7 -0
- package/dist/namespace-base.mjs +7 -0
- package/dist/namespace-commands.d.mts +57 -0
- package/dist/namespace-commands.mjs +57 -0
- package/dist/namespace-credits.d.mts +213 -0
- package/dist/namespace-credits.mjs +476 -0
- package/dist/namespace-files.d.mts +203 -0
- package/dist/namespace-files.mjs +334 -0
- package/dist/namespace-github.d.mts +50 -0
- package/dist/namespace-github.mjs +68 -0
- package/dist/namespace-images.d.mts +52 -0
- package/dist/namespace-images.mjs +78 -0
- package/dist/namespace-launch_runs.d.mts +89 -0
- package/dist/namespace-launch_runs.mjs +133 -0
- package/dist/namespace-launches.d.mts +89 -0
- package/dist/namespace-launches.mjs +133 -0
- package/dist/namespace-operations.d.mts +45 -0
- package/dist/namespace-operations.mjs +52 -0
- package/dist/namespace-previews.d.mts +79 -0
- package/dist/namespace-previews.mjs +101 -0
- package/dist/namespace-pricing.d.mts +31 -0
- package/dist/namespace-pricing.mjs +22 -0
- package/dist/namespace-processes.d.mts +125 -0
- package/dist/namespace-processes.mjs +184 -0
- package/dist/namespace-provider_accounts.d.mts +156 -0
- package/dist/namespace-provider_accounts.mjs +241 -0
- package/dist/namespace-providers.d.mts +28 -0
- package/dist/namespace-providers.mjs +24 -0
- package/dist/namespace-routing.d.mts +64 -0
- package/dist/namespace-routing.mjs +86 -0
- package/dist/namespace-sandboxes.d.mts +287 -0
- package/dist/namespace-sandboxes.mjs +402 -0
- package/dist/namespace-secrets.d.mts +46 -0
- package/dist/namespace-secrets.mjs +68 -0
- package/dist/namespace-spend_limits.d.mts +48 -0
- package/dist/namespace-spend_limits.mjs +70 -0
- package/dist/namespace-terminals.d.mts +112 -0
- package/dist/namespace-terminals.mjs +177 -0
- package/dist/namespace-usage.d.mts +46 -0
- package/dist/namespace-usage.mjs +53 -0
- package/dist/namespace-volumes.d.mts +110 -0
- package/dist/namespace-volumes.mjs +269 -0
- package/dist/operations.d.ts +14 -0
- package/dist/operations.js +31 -0
- package/dist/retry.d.ts +8 -0
- package/dist/retry.js +63 -0
- package/dist/routing-choices.gen.d.ts +132 -0
- package/dist/routing-choices.gen.js +136 -0
- package/dist/routing.d.ts +23 -0
- package/dist/routing.js +38 -0
- package/dist/sandbox-handle.gen.d.ts +8 -0
- package/dist/sandbox-handle.gen.js +14 -0
- package/dist/sandboxes.d.ts +213 -0
- package/dist/sandboxes.js +507 -0
- package/dist/sdk.gen.d.ts +2029 -0
- package/dist/sdk.gen.js +3862 -0
- package/dist/server-timing.d.ts +19 -0
- package/dist/server-timing.gen.d.ts +265 -0
- package/dist/server-timing.gen.js +254 -0
- package/dist/server-timing.js +421 -0
- package/dist/spend-limits.d.ts +17 -0
- package/dist/spend-limits.js +26 -0
- package/dist/telemetry.d.ts +51 -0
- package/dist/telemetry.gen.d.ts +1 -0
- package/dist/telemetry.gen.js +5 -0
- package/dist/telemetry.js +438 -0
- package/dist/terminal.d.ts +61 -0
- package/dist/terminal.js +266 -0
- package/dist/transfer.d.ts +75 -0
- package/dist/transfer.js +389 -0
- package/dist/types.gen.d.ts +15016 -0
- package/dist/types.gen.js +3 -0
- package/dist/user-agent.d.ts +2 -0
- package/dist/user-agent.js +18 -0
- package/dist/version.gen.d.ts +1 -0
- package/dist/version.gen.js +5 -0
- package/dist/volumes.d.ts +33 -0
- package/dist/volumes.js +221 -0
- package/dist/waits.d.ts +31 -0
- package/dist/waits.js +42 -0
- package/dist/workflow-policy.gen.d.ts +41 -0
- package/dist/workflow-policy.gen.js +45 -0
- package/package.json +135 -4
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.launchInputOptions = launchInputOptions;
|
|
7
|
+
exports.normalizeLaunchInputs = normalizeLaunchInputs;
|
|
8
|
+
exports.validateLaunchInputs = validateLaunchInputs;
|
|
9
|
+
exports.legacySecretMissing = legacySecretMissing;
|
|
10
|
+
const commandValidators_cjs_1 = __importDefault(require("./core/commandValidators.cjs"));
|
|
11
|
+
const POLICY = JSON.parse("{\"secret_names\":{\"option\":\"secret_names\",\"flag\":\"secret\",\"format\":\"name\",\"declared_field\":\"legacy_secret_names\",\"extra_field\":\"additional_secret_refs\",\"reference_field\":\"secret_name\",\"help\":\"Declared legacy names use the existing resolver; other names select saved custom secrets.\"},\"provider\":{\"option\":\"provider\",\"flag\":\"provider\",\"format\":\"name\",\"request_path\":[\"overrides\",\"placement\",\"preferences\",\"only\"],\"help\":\"Pin the launch to one provider.\"},\"credential_delivery\":{\"option\":\"credential_delivery\",\"flag\":\"credential-delivery\",\"format\":\"enum\",\"schema\":\"CredentialDeliveryPolicy\",\"request_field\":\"credential_delivery\",\"help\":\"Choose whether environment fallback is allowed.\"},\"retry\":{\"condition\":\"legacySecretMissing\",\"error_code\":\"secret_missing\",\"name_source\":\"manifest.secrets\",\"exclude_referenced_names\":true}}");
|
|
12
|
+
const DELIVERY_VALUES = ["prefer_native", "require_native"];
|
|
13
|
+
function launchInputOptions(options) {
|
|
14
|
+
return {
|
|
15
|
+
secret_names: options.secretNames,
|
|
16
|
+
provider: options.provider,
|
|
17
|
+
credential_delivery: options.credentialDelivery,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function normalizeLaunchInputs(options, declaredSecrets) {
|
|
21
|
+
if (declaredSecrets.some(name => typeof name !== 'string' || !name))
|
|
22
|
+
throw new TypeError('Invalid launch input');
|
|
23
|
+
const declared = [...new Set(declaredSecrets)];
|
|
24
|
+
const extra = Object.create(null);
|
|
25
|
+
const secretPolicy = POLICY.secret_names;
|
|
26
|
+
const names = options[secretPolicy.option];
|
|
27
|
+
if (names != null) {
|
|
28
|
+
if (!Array.isArray(names) || names.some(name => typeof name !== 'string' || !name))
|
|
29
|
+
throw new TypeError('Invalid launch input');
|
|
30
|
+
for (const name of names)
|
|
31
|
+
if (!declared.includes(name))
|
|
32
|
+
extra[name] = { [secretPolicy.reference_field]: name };
|
|
33
|
+
}
|
|
34
|
+
const result = { [secretPolicy.declared_field]: declared };
|
|
35
|
+
if (Object.keys(extra).length)
|
|
36
|
+
result[secretPolicy.extra_field] = extra;
|
|
37
|
+
const providerPolicy = POLICY.provider;
|
|
38
|
+
const provider = options[providerPolicy.option];
|
|
39
|
+
if (provider != null) {
|
|
40
|
+
if (typeof provider !== 'string' || !provider)
|
|
41
|
+
throw new TypeError('Invalid launch input');
|
|
42
|
+
const path = providerPolicy.request_path;
|
|
43
|
+
if (!Array.isArray(path) || path.length === 0)
|
|
44
|
+
throw new TypeError('Invalid launch input');
|
|
45
|
+
const target = path.slice(0, -1).reduce((node, segment) => {
|
|
46
|
+
const child = node[segment];
|
|
47
|
+
if (!child || typeof child !== 'object' || Array.isArray(child))
|
|
48
|
+
node[segment] = {};
|
|
49
|
+
return node[segment];
|
|
50
|
+
}, result);
|
|
51
|
+
target[path[path.length - 1]] = [provider];
|
|
52
|
+
}
|
|
53
|
+
const deliveryPolicy = POLICY.credential_delivery;
|
|
54
|
+
const delivery = options[deliveryPolicy.option];
|
|
55
|
+
if (delivery != null) {
|
|
56
|
+
if (typeof delivery !== 'string' || !DELIVERY_VALUES.includes(delivery))
|
|
57
|
+
throw new TypeError('Invalid launch input');
|
|
58
|
+
result[deliveryPolicy.request_field] = delivery;
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function validateLaunchInputs(value) {
|
|
63
|
+
if (!commandValidators_cjs_1.default.launch_inputs(value))
|
|
64
|
+
throw new TypeError('Invalid launch input');
|
|
65
|
+
}
|
|
66
|
+
function legacySecretMissing(error, request) {
|
|
67
|
+
if (!error || typeof error !== 'object')
|
|
68
|
+
return false;
|
|
69
|
+
const body = 'error' in error && error.error && typeof error.error === 'object' ? error.error : error;
|
|
70
|
+
const code = 'code' in body ? body.code : undefined;
|
|
71
|
+
const details = 'details' in body ? body.details : undefined;
|
|
72
|
+
if (code !== 'secret_missing' || !Array.isArray(request.legacy_secret_names) || !details || typeof details !== 'object' || !('names' in details) || !Array.isArray(details.names) || !details.names.length)
|
|
73
|
+
return false;
|
|
74
|
+
const declared = new Set(request.legacy_secret_names);
|
|
75
|
+
const refs = request.additional_secret_refs;
|
|
76
|
+
if (refs != null && (typeof refs !== 'object' || Array.isArray(refs)))
|
|
77
|
+
return false;
|
|
78
|
+
const saved = new Set(Object.keys(refs ?? {}));
|
|
79
|
+
for (const ref of Object.values(refs ?? {}))
|
|
80
|
+
if (ref && typeof ref === 'object' && 'secret_name' in ref)
|
|
81
|
+
saved.add(ref.secret_name);
|
|
82
|
+
return details.names.every(name => typeof name === 'string' && declared.has(name) && !saved.has(name));
|
|
83
|
+
}
|
package/dist/launch.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BoxRouterApi } from './sdk.gen';
|
|
2
|
+
import type { AgentManifest, Launch, LaunchOperation, LaunchSourceManifest } from './types.gen';
|
|
3
|
+
import { type LaunchInputOptions } from './launch-input.gen';
|
|
4
|
+
import type { PrivateImage } from './images';
|
|
5
|
+
export interface LaunchOptions extends LaunchInputOptions {
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
idempotencyKey?: string;
|
|
8
|
+
repo?: string;
|
|
9
|
+
/** An OCI reference, or the `image` of `privateImage()`; spread `privateImage()` to add its login. */
|
|
10
|
+
image?: string | PrivateImage['image'];
|
|
11
|
+
/** The login for a private `image`; request-only, used once for the setup and never stored. */
|
|
12
|
+
registry_credentials?: PrivateImage['registry_credentials'];
|
|
13
|
+
manifest?: AgentManifest | LaunchSourceManifest;
|
|
14
|
+
name?: string;
|
|
15
|
+
command?: string;
|
|
16
|
+
lifetime?: number;
|
|
17
|
+
onProgress?: (operation: LaunchOperation) => void;
|
|
18
|
+
resolveSecret?: (name: string) => Promise<string> | string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve an agent and wait until its launch operation settles. Returns the launch result, with
|
|
22
|
+
* `interactive` resolved, and the command its terminal starts (none when the launch runs unattended).
|
|
23
|
+
* Rejects with a TimeoutError when the launch is still pending after its bound.
|
|
24
|
+
*/
|
|
25
|
+
export declare function launchAgent(api: BoxRouterApi, agent: string | undefined, options?: LaunchOptions): Promise<{
|
|
26
|
+
launch: Launch;
|
|
27
|
+
terminalCommand: string | undefined;
|
|
28
|
+
}>;
|
package/dist/launch.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.launchAgent = launchAgent;
|
|
4
|
+
const api_error_1 = require("./api-error");
|
|
5
|
+
const launch_input_gen_1 = require("./launch-input.gen");
|
|
6
|
+
const workflow_policy_gen_1 = require("./workflow-policy.gen");
|
|
7
|
+
const waits_1 = require("./waits");
|
|
8
|
+
function _launch_pending(operation) {
|
|
9
|
+
return workflow_policy_gen_1.LAUNCH_PENDING.includes(operation.status);
|
|
10
|
+
}
|
|
11
|
+
/** Whether the launch runs attended: the launch's own answer, else the manifest's, else yes. */
|
|
12
|
+
function _launch_interactive(launch, manifest) {
|
|
13
|
+
return (launch.interactive ?? manifest.interactive ?? true) !== false;
|
|
14
|
+
}
|
|
15
|
+
/** The command a launched sandbox's terminal starts; none for an unattended launch. */
|
|
16
|
+
function _launch_terminal_command(manifest, launch) {
|
|
17
|
+
if (!_launch_interactive(launch, manifest))
|
|
18
|
+
return undefined;
|
|
19
|
+
const resolvedSourceCommand = launch.phases.find(phase => phase.name === 'source')?.command;
|
|
20
|
+
return resolvedSourceCommand || ('command' in manifest ? manifest.command : undefined) || undefined;
|
|
21
|
+
}
|
|
22
|
+
function _launch_code(repo) {
|
|
23
|
+
if (repo === undefined)
|
|
24
|
+
return undefined;
|
|
25
|
+
if (!repo || /\s|\0/.test(repo))
|
|
26
|
+
throw new TypeError('Repository override must use owner/repo@ref');
|
|
27
|
+
const separator = repo.indexOf('@');
|
|
28
|
+
const name = repo.slice(0, separator);
|
|
29
|
+
const ref = repo.slice(separator + 1);
|
|
30
|
+
if (separator < 0 || name.split('/').length !== 2 || name.split('/').some(part => !part) || !ref) {
|
|
31
|
+
throw new TypeError('Repository override must use owner/repo@ref');
|
|
32
|
+
}
|
|
33
|
+
return { repo: name, ref };
|
|
34
|
+
}
|
|
35
|
+
function _launch_source(repo) {
|
|
36
|
+
if (!repo || /\s|\0/.test(repo))
|
|
37
|
+
throw new TypeError('Repository source must use owner/repo[@ref]');
|
|
38
|
+
const separator = repo.indexOf('@');
|
|
39
|
+
const name = repo.slice(0, separator < 0 ? undefined : separator);
|
|
40
|
+
const ref = separator < 0 ? workflow_policy_gen_1.LAUNCH_SOURCE_DEFAULT_REF : repo.slice(separator + 1);
|
|
41
|
+
const parts = name.split('/');
|
|
42
|
+
if (parts.length !== 2 || parts.some(part => !part) || !ref) {
|
|
43
|
+
throw new TypeError('Repository source must use owner/repo[@ref]');
|
|
44
|
+
}
|
|
45
|
+
return { repo: name, ref, path: workflow_policy_gen_1.LAUNCH_SOURCE_MANIFEST_PATH };
|
|
46
|
+
}
|
|
47
|
+
function _launch_name(value) {
|
|
48
|
+
let candidate = value.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
49
|
+
if (!candidate || !/^[a-z]/.test(candidate))
|
|
50
|
+
candidate = `agent-${candidate}`;
|
|
51
|
+
candidate = candidate.slice(0, 63).replace(/-+$/g, '');
|
|
52
|
+
return new RegExp(workflow_policy_gen_1.LAUNCH_CUSTOM_NAME_PATTERN).test(candidate) ? candidate : 'agent';
|
|
53
|
+
}
|
|
54
|
+
function _launch_failure(operation, idempotencyKey) {
|
|
55
|
+
if (!operation.error)
|
|
56
|
+
throw new TypeError('Failed launch operation did not include its API error');
|
|
57
|
+
const response = new Response(JSON.stringify(operation.error), {
|
|
58
|
+
status: Number(operation.failure_status ?? 409),
|
|
59
|
+
headers: { 'Content-Type': 'application/json' },
|
|
60
|
+
});
|
|
61
|
+
return new api_error_1.APIError(operation.error, response, undefined, undefined, idempotencyKey);
|
|
62
|
+
}
|
|
63
|
+
function _missing_secret_names(error) {
|
|
64
|
+
const details = error.error.details;
|
|
65
|
+
if (details === null || typeof details !== 'object' || !('names' in details) ||
|
|
66
|
+
!Array.isArray(details.names) || !details.names.every(name => typeof name === 'string')) {
|
|
67
|
+
throw new TypeError('The missing-secret response did not include valid secret names');
|
|
68
|
+
}
|
|
69
|
+
return details.names;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolve an agent and wait until its launch operation settles. Returns the launch result, with
|
|
73
|
+
* `interactive` resolved, and the command its terminal starts (none when the launch runs unattended).
|
|
74
|
+
* Rejects with a TimeoutError when the launch is still pending after its bound.
|
|
75
|
+
*/
|
|
76
|
+
async function launchAgent(api, agent, options = {}) {
|
|
77
|
+
const { signal, idempotencyKey, resolveSecret } = options;
|
|
78
|
+
const { repo, image, registry_credentials: registryCredentials, manifest: inputManifest, name, command, secretNames = [], lifetime, onProgress } = options;
|
|
79
|
+
if (agent !== undefined && !agent)
|
|
80
|
+
throw new TypeError('Agent name must be nonempty');
|
|
81
|
+
if (name !== undefined && !new RegExp(workflow_policy_gen_1.LAUNCH_CUSTOM_NAME_PATTERN).test(name)) {
|
|
82
|
+
throw new TypeError('Custom agent name must be a valid slug');
|
|
83
|
+
}
|
|
84
|
+
if (secretNames.some(secret => typeof secret !== 'string' || !secret)) {
|
|
85
|
+
throw new TypeError('Secret names must be nonempty strings');
|
|
86
|
+
}
|
|
87
|
+
const inputOptions = (0, launch_input_gen_1.launchInputOptions)(options);
|
|
88
|
+
(0, launch_input_gen_1.normalizeLaunchInputs)(inputOptions, []);
|
|
89
|
+
if (agent !== undefined && (image !== undefined || inputManifest !== undefined || name !== undefined ||
|
|
90
|
+
command !== undefined)) {
|
|
91
|
+
throw new TypeError('Choose a catalog agent or one custom launch source');
|
|
92
|
+
}
|
|
93
|
+
if (agent === undefined && [image, repo, inputManifest].filter(value => value !== undefined).length !== 1) {
|
|
94
|
+
throw new TypeError('Choose exactly one of image, repository or manifest');
|
|
95
|
+
}
|
|
96
|
+
if ((typeof image === 'object' && registryCredentials === undefined) ||
|
|
97
|
+
(registryCredentials !== undefined && typeof image !== 'object' && inputManifest === undefined)) {
|
|
98
|
+
throw new TypeError('A private image needs its registry_credentials, and registry_credentials need a private image');
|
|
99
|
+
}
|
|
100
|
+
if (lifetime !== undefined && (!Number.isSafeInteger(lifetime) || lifetime < 1)) {
|
|
101
|
+
throw new TypeError('Lifetime must be a positive integer number of seconds');
|
|
102
|
+
}
|
|
103
|
+
let manifest;
|
|
104
|
+
if (agent !== undefined) {
|
|
105
|
+
manifest = (await api.agents.get({ path: { name: agent }, signal })).manifest;
|
|
106
|
+
}
|
|
107
|
+
else if (repo !== undefined) {
|
|
108
|
+
const source = _launch_source(repo);
|
|
109
|
+
manifest = {
|
|
110
|
+
name: name ?? _launch_name(source.repo.split('/').pop() ?? source.repo),
|
|
111
|
+
source,
|
|
112
|
+
...(command ? { command } : {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
else if (image !== undefined) {
|
|
116
|
+
const reference = typeof image === 'string' ? image : image.private_oci;
|
|
117
|
+
const imageName = reference.split('/').pop()?.split('@', 1)[0]?.split(':', 1)[0] ?? reference;
|
|
118
|
+
manifest = {
|
|
119
|
+
name: name ?? _launch_name(imageName),
|
|
120
|
+
image,
|
|
121
|
+
command: command || workflow_policy_gen_1.LAUNCH_DEFAULT_SHELL_COMMAND,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const supplied = inputManifest;
|
|
126
|
+
manifest = {
|
|
127
|
+
...supplied,
|
|
128
|
+
...(name === undefined ? {} : { name }),
|
|
129
|
+
...(command ? { command } : {}),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
let operation;
|
|
133
|
+
let launchPollDeadline;
|
|
134
|
+
const secretValues = {};
|
|
135
|
+
const code = agent !== undefined ? _launch_code(repo) : undefined;
|
|
136
|
+
const overrides = code || lifetime !== undefined
|
|
137
|
+
? { ...(code ? { code } : {}), ...(lifetime === undefined ? {} : { lifetime_seconds: lifetime }) }
|
|
138
|
+
: undefined;
|
|
139
|
+
const launchInputs = (0, launch_input_gen_1.normalizeLaunchInputs)(inputOptions, 'secrets' in manifest ? manifest.secrets ?? [] : []);
|
|
140
|
+
const selectionInputs = Object.fromEntries(Object.entries(launchInputs).filter(([key]) => key !== 'legacy_secret_names'));
|
|
141
|
+
(0, launch_input_gen_1.validateLaunchInputs)(selectionInputs);
|
|
142
|
+
const requestInputs = {
|
|
143
|
+
...selectionInputs,
|
|
144
|
+
...(registryCredentials === undefined ? {} : { registry_credentials: registryCredentials }),
|
|
145
|
+
};
|
|
146
|
+
const selectedOverrides = requestInputs.overrides;
|
|
147
|
+
const combinedOverrides = overrides || selectedOverrides
|
|
148
|
+
? { ...(overrides ?? {}), ...(selectedOverrides ?? {}) }
|
|
149
|
+
: undefined;
|
|
150
|
+
const key = idempotencyKey ?? globalThis.crypto.randomUUID();
|
|
151
|
+
try {
|
|
152
|
+
const body = agent !== undefined
|
|
153
|
+
? { agent, ...requestInputs, ...(combinedOverrides ? { overrides: combinedOverrides } : {}) }
|
|
154
|
+
: { manifest, ...requestInputs, ...(combinedOverrides ? { overrides: combinedOverrides } : {}) };
|
|
155
|
+
operation = await api.launches.create({
|
|
156
|
+
body,
|
|
157
|
+
headers: { 'Idempotency-Key': key },
|
|
158
|
+
signal,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (!(error instanceof api_error_1.APIError))
|
|
163
|
+
throw error;
|
|
164
|
+
if ((0, launch_input_gen_1.legacySecretMissing)(error, launchInputs)) {
|
|
165
|
+
for (const secret_name of _missing_secret_names(error)) {
|
|
166
|
+
if (resolveSecret === undefined) {
|
|
167
|
+
throw new Error(`Launch is missing secret ${secret_name}; set it in the environment or provide a resolver`);
|
|
168
|
+
}
|
|
169
|
+
const value = await resolveSecret(secret_name);
|
|
170
|
+
if (typeof value !== 'string')
|
|
171
|
+
throw new TypeError(`Secret resolver did not return text for ${secret_name}`);
|
|
172
|
+
secretValues[secret_name] = value;
|
|
173
|
+
}
|
|
174
|
+
operation = await api.launches.create({
|
|
175
|
+
body: agent !== undefined
|
|
176
|
+
? { agent, ...requestInputs, secret_values: secretValues,
|
|
177
|
+
...(combinedOverrides ? { overrides: combinedOverrides } : {}) }
|
|
178
|
+
: { manifest, ...requestInputs, secret_values: secretValues,
|
|
179
|
+
...(combinedOverrides ? { overrides: combinedOverrides } : {}) },
|
|
180
|
+
headers: { 'Idempotency-Key': key },
|
|
181
|
+
signal,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const launchTiming = waits_1.waitHooks.timing({ intervalSeconds: workflow_policy_gen_1.LAUNCH_POLL_INTERVAL_SECONDS, boundSeconds: workflow_policy_gen_1.LAUNCH_BOUND_SECONDS });
|
|
189
|
+
const launchDeadline = waits_1.waitHooks.now() + launchTiming.boundSeconds;
|
|
190
|
+
launchPollDeadline = performance.now() + workflow_policy_gen_1.LAUNCH_OPERATION_NOT_FOUND_GRACE_SECONDS * 1000;
|
|
191
|
+
onProgress?.(operation);
|
|
192
|
+
while (_launch_pending(operation)) {
|
|
193
|
+
if (waits_1.waitHooks.now() + launchTiming.intervalSeconds > launchDeadline) {
|
|
194
|
+
throw new waits_1.WaitTimeoutError(operation.id, `Launch ${operation.id} is still ${operation.status} after ${workflow_policy_gen_1.LAUNCH_BOUND_SECONDS} s; ` +
|
|
195
|
+
'read the operation before launching again');
|
|
196
|
+
}
|
|
197
|
+
await waits_1.waitHooks.sleep(launchTiming.intervalSeconds);
|
|
198
|
+
while (true) {
|
|
199
|
+
signal?.throwIfAborted();
|
|
200
|
+
try {
|
|
201
|
+
operation = await api.launches.getOperation({ path: { operation_id: operation.id }, signal });
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
const remaining = launchPollDeadline - performance.now();
|
|
206
|
+
if (!(error instanceof api_error_1.APIError) || error.response.status !== 404 || remaining <= 0)
|
|
207
|
+
throw error;
|
|
208
|
+
await new Promise(resolve => setTimeout(resolve, Math.min(workflow_policy_gen_1.LAUNCH_OPERATION_POLL_RETRY_INTERVAL_SECONDS * 1000, remaining)));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
launchPollDeadline = performance.now() + workflow_policy_gen_1.LAUNCH_OPERATION_NOT_FOUND_GRACE_SECONDS * 1000;
|
|
212
|
+
onProgress?.(operation);
|
|
213
|
+
}
|
|
214
|
+
if (operation.status === 'failed')
|
|
215
|
+
throw _launch_failure(operation, key);
|
|
216
|
+
if (operation.status !== 'succeeded' || !operation.result) {
|
|
217
|
+
throw new TypeError('Launch polling stopped before a terminal result');
|
|
218
|
+
}
|
|
219
|
+
const launch = operation.result;
|
|
220
|
+
return { launch: { ...launch, interactive: _launch_interactive(launch, manifest) },
|
|
221
|
+
terminalCommand: _launch_terminal_command(manifest, launch) };
|
|
222
|
+
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client/index.js';
|
|
2
|
+
import { HeyApiClient } from './namespace-base.mjs';
|
|
3
|
+
import type { ActionsJobsGetData, ActionsJobsGetErrors, ActionsJobsGetLogsData, ActionsJobsGetLogsErrors, ActionsJobsGetLogsResponses, ActionsJobsGetResponses, ActionsJobsGetStepLogsData, ActionsJobsGetStepLogsErrors, ActionsJobsGetStepLogsResponses, ActionsJobsGetStepsData, ActionsJobsGetStepsErrors, ActionsJobsGetStepsResponses, ActionsJobsListEventsData, ActionsJobsListEventsErrors, ActionsJobsListEventsResponses, ActionsPlacementsGetData, ActionsPlacementsGetErrors, ActionsPlacementsGetResponses, ActionsPoliciesCreateData, ActionsPoliciesCreateErrors, ActionsPoliciesCreateResponses, ActionsPoliciesDeleteData, ActionsPoliciesDeleteErrors, ActionsPoliciesDeleteResponses, ActionsPoliciesGetData, ActionsPoliciesGetErrors, ActionsPoliciesGetResponses, ActionsPoliciesListData, ActionsPoliciesListErrors, ActionsPoliciesListResponses, ActionsPoliciesUpdateData, ActionsPoliciesUpdateErrors, ActionsPoliciesUpdateResponses, ActionsPoolIdleTimeGetData, ActionsPoolIdleTimeGetErrors, ActionsPoolIdleTimeGetResponses, ActionsPreviewData, ActionsPreviewErrors, ActionsPreviewResponses, ActionsReadinessData, ActionsReadinessErrors, ActionsReadinessResponses, ActionsRepositoriesGetData, ActionsRepositoriesGetErrors, ActionsRepositoriesGetResponses, ActionsRepositoriesUpdateData, ActionsRepositoriesUpdateErrors, ActionsRepositoriesUpdateResponses, ActionsRunnerCatalogData, ActionsRunnerCatalogErrors, ActionsRunnerCatalogResponses, ActionsRunsCancelData, ActionsRunsCancelErrors, ActionsRunsCancelResponses, ActionsRunsGetData, ActionsRunsGetErrors, ActionsRunsGetResponses, ActionsRunsListData, ActionsRunsListErrors, ActionsRunsListFacetsData, ActionsRunsListFacetsErrors, ActionsRunsListFacetsResponses, ActionsRunsListJobsData, ActionsRunsListJobsErrors, ActionsRunsListJobsResponses, ActionsRunsListPlacementsData, ActionsRunsListPlacementsErrors, ActionsRunsListPlacementsResponses, ActionsRunsListResponses, ActionsRunsRerunData, ActionsRunsRerunErrors, ActionsRunsRerunFailedJobsData, ActionsRunsRerunFailedJobsErrors, ActionsRunsRerunFailedJobsResponses, ActionsRunsRerunResponses } from './types.gen.js';
|
|
4
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
5
|
+
/**
|
|
6
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
7
|
+
* individual options. This might be also useful if you want to implement a
|
|
8
|
+
* custom client.
|
|
9
|
+
*/
|
|
10
|
+
client?: Client;
|
|
11
|
+
/**
|
|
12
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
13
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
14
|
+
*/
|
|
15
|
+
meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
|
|
16
|
+
};
|
|
17
|
+
export declare class Actions extends HeyApiClient {
|
|
18
|
+
/**
|
|
19
|
+
* Read Actions runner and workspace funding readiness
|
|
20
|
+
*
|
|
21
|
+
* Requires workspace read authority. This read-only view uses the workspace's
|
|
22
|
+
* existing provider accounts and credits. Unknown source facts remain unknown;
|
|
23
|
+
* link targets appear only when an existing page can address the reported issue.
|
|
24
|
+
* When `repository_id` is supplied, readiness is scoped to that repository's saved
|
|
25
|
+
* software profile. The profile is resolved from workspace-owned settings; callers
|
|
26
|
+
* cannot select a profile through this parameter.
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
readiness<ThrowOnError extends boolean = true>(options?: Options<ActionsReadinessData, ThrowOnError>): RequestResult<ActionsReadinessResponses, ActionsReadinessErrors, ThrowOnError, 'data'>;
|
|
30
|
+
/**
|
|
31
|
+
* Read the recommended Actions runner labels and resource floors
|
|
32
|
+
*
|
|
33
|
+
* Requires workspace read authority. The catalog is fixed for a server release and does not
|
|
34
|
+
* depend on the workspace, so clients and caches may reuse it until its ETag changes. It does not assert live route availability or
|
|
35
|
+
* verified software; use readiness for that. Readiness still carries `runner_catalog` for
|
|
36
|
+
* older clients, but new clients should read this operation instead.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
runnerCatalog<ThrowOnError extends boolean = true>(options?: Options<ActionsRunnerCatalogData, ThrowOnError>): RequestResult<ActionsRunnerCatalogResponses, ActionsRunnerCatalogErrors, ThrowOnError, 'data'>;
|
|
40
|
+
/**
|
|
41
|
+
* Preview Actions label and policy eligibility
|
|
42
|
+
*
|
|
43
|
+
* Requires read authority for the linked repository in the authenticated workspace.
|
|
44
|
+
* This is a read-only evaluation of the same resolved policy and route matcher used
|
|
45
|
+
* for dispatch. It creates no runner, sandbox, reservation or billing hold. Refused
|
|
46
|
+
* and unknown results remain explicit; the preview never relaxes a requirement or
|
|
47
|
+
* claims an unverified route is eligible. It does not verify runner images. Runner image readiness is checked separately before dispatch.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
preview<ThrowOnError extends boolean = true>(options: Options<ActionsPreviewData, ThrowOnError>): RequestResult<ActionsPreviewResponses, ActionsPreviewErrors, ThrowOnError, 'data'>;
|
|
51
|
+
private _repositories?;
|
|
52
|
+
get repositories(): Repositories;
|
|
53
|
+
private _policies?;
|
|
54
|
+
get policies(): Policies;
|
|
55
|
+
private _runs?;
|
|
56
|
+
get runs(): Runs;
|
|
57
|
+
private _poolIdleTime?;
|
|
58
|
+
get poolIdleTime(): PoolIdleTime;
|
|
59
|
+
private _jobs?;
|
|
60
|
+
get jobs(): Jobs;
|
|
61
|
+
private _placements?;
|
|
62
|
+
get placements(): Placements;
|
|
63
|
+
}
|
|
64
|
+
export declare class Repositories extends HeyApiClient {
|
|
65
|
+
/**
|
|
66
|
+
* Get Actions enablement and defaults for a repository
|
|
67
|
+
*
|
|
68
|
+
* Requires read authority in the authenticated workspace. The repository must have
|
|
69
|
+
* a currently linked, verified GitHub installation. The returned ETag identifies
|
|
70
|
+
* this settings revision. A missing settings record is represented as `exists: false`,
|
|
71
|
+
* disabled with no required policy; it is not silently enabled by reading it. For
|
|
72
|
+
* `exists: false`, omit If-Match on the first write; for `exists: true`, send the
|
|
73
|
+
* returned ETag to update the existing record safely.
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
get<ThrowOnError extends boolean = true>(options: Options<ActionsRepositoriesGetData, ThrowOnError>): RequestResult<ActionsRepositoriesGetResponses, ActionsRepositoriesGetErrors, ThrowOnError, 'data'>;
|
|
77
|
+
/**
|
|
78
|
+
* Enable or update Actions defaults for a repository
|
|
79
|
+
*
|
|
80
|
+
* Requires workspace administrator authority. Browser-session calls require the CSRF
|
|
81
|
+
* token and configured Origin. The minimal enable request is `{"enabled":true}`;
|
|
82
|
+
* Actions creates its safe default settings and begins automatic image preparation
|
|
83
|
+
* without requiring a named policy, provider key, runner registration or YAML change.
|
|
84
|
+
* `policy_id` is optional and, when null, selects the workspace's current safe
|
|
85
|
+
* defaults. When the preceding read returned `exists: false`, omit If-Match to create
|
|
86
|
+
* the settings record; when it returned `exists: true`, send its ETag to update. The
|
|
87
|
+
* server rejects a write if that existence state changed after the read. An
|
|
88
|
+
* Idempotency-Key records
|
|
89
|
+
* the logical mutation: identical uncertain retries return the recorded outcome,
|
|
90
|
+
* changed input under the same key conflicts, and unknown effects are reconciled
|
|
91
|
+
* without automatic redispatch. Disabling stops new admission; it does not cancel
|
|
92
|
+
* accepted GitHub workflow runs or change their funding binding.
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
update<ThrowOnError extends boolean = true>(options: Options<ActionsRepositoriesUpdateData, ThrowOnError>): RequestResult<ActionsRepositoriesUpdateResponses, ActionsRepositoriesUpdateErrors, ThrowOnError, 'data'>;
|
|
96
|
+
}
|
|
97
|
+
export declare class Policies extends HeyApiClient {
|
|
98
|
+
/**
|
|
99
|
+
* List workspace Actions policies
|
|
100
|
+
*
|
|
101
|
+
* Requires workspace read authority. Stable ID-ordered pages may be empty; listing never changes policy or starts compute.
|
|
102
|
+
*/
|
|
103
|
+
list<ThrowOnError extends boolean = true>(options?: Options<ActionsPoliciesListData, ThrowOnError>): RequestResult<ActionsPoliciesListResponses, ActionsPoliciesListErrors, ThrowOnError, 'data'>;
|
|
104
|
+
/**
|
|
105
|
+
* Create a named workspace Actions policy
|
|
106
|
+
*
|
|
107
|
+
* Requires workspace administrator authority. Browser-session calls require the CSRF
|
|
108
|
+
* token and configured Origin. Policy settings can only narrow workspace and
|
|
109
|
+
* repository guardrails. The workspace funding choice decides the logical authority
|
|
110
|
+
* (workspace BYOK or platform managed); the actual provider, account and payer binding
|
|
111
|
+
* is confirmed separately for each attempt and is never taken from a policy. A policy
|
|
112
|
+
* cannot change supply or add accounts. Idempotency-Key replays the recorded
|
|
113
|
+
* outcome for identical input; changed input conflicts. An unknown outcome is
|
|
114
|
+
* reconciled without creating a second policy.
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
create<ThrowOnError extends boolean = true>(options: Options<ActionsPoliciesCreateData, ThrowOnError>): RequestResult<ActionsPoliciesCreateResponses, ActionsPoliciesCreateErrors, ThrowOnError, 'data'>;
|
|
118
|
+
/**
|
|
119
|
+
* Delete an unused workspace Actions policy
|
|
120
|
+
*
|
|
121
|
+
* Requires workspace administrator authority. Browser-session calls require CSRF and
|
|
122
|
+
* the configured Origin. If-Match is required. A policy referenced by repository
|
|
123
|
+
* defaults or accepted work cannot be deleted and returns 409. Idempotency-Key
|
|
124
|
+
* returns the recorded delete result for identical retries; changed input conflicts. Unknown outcomes are
|
|
125
|
+
* reconciled without repeating the deletion.
|
|
126
|
+
*
|
|
127
|
+
*/
|
|
128
|
+
delete<ThrowOnError extends boolean = true>(options: Options<ActionsPoliciesDeleteData, ThrowOnError>): RequestResult<ActionsPoliciesDeleteResponses, ActionsPoliciesDeleteErrors, ThrowOnError, 'data'>;
|
|
129
|
+
/**
|
|
130
|
+
* Get a workspace Actions policy
|
|
131
|
+
*
|
|
132
|
+
* Requires workspace read authority. The policy ID is workspace-scoped; foreign and unknown IDs both return 404.
|
|
133
|
+
*/
|
|
134
|
+
get<ThrowOnError extends boolean = true>(options: Options<ActionsPoliciesGetData, ThrowOnError>): RequestResult<ActionsPoliciesGetResponses, ActionsPoliciesGetErrors, ThrowOnError, 'data'>;
|
|
135
|
+
/**
|
|
136
|
+
* Replace a workspace Actions policy
|
|
137
|
+
*
|
|
138
|
+
* Requires workspace administrator authority. Browser-session calls require CSRF and
|
|
139
|
+
* the configured Origin. If-Match is required and must equal the latest ETag. Policy
|
|
140
|
+
* changes only narrow workspace/repository guardrails and do not mutate accepted jobs
|
|
141
|
+
* or change their supply, accounts or logical funding authority. Idempotency-Key replays an identical recorded update;
|
|
142
|
+
* changed input conflicts. A stale ETag returns 409 without writing. Unknown outcomes
|
|
143
|
+
* are reconciled, never automatically redispatched.
|
|
144
|
+
*
|
|
145
|
+
*/
|
|
146
|
+
update<ThrowOnError extends boolean = true>(options: Options<ActionsPoliciesUpdateData, ThrowOnError>): RequestResult<ActionsPoliciesUpdateResponses, ActionsPoliciesUpdateErrors, ThrowOnError, 'data'>;
|
|
147
|
+
}
|
|
148
|
+
export declare class Runs extends HeyApiClient {
|
|
149
|
+
/**
|
|
150
|
+
* List workspace Actions workflow-run projections
|
|
151
|
+
*
|
|
152
|
+
* Requires workspace read authority. Pages may be empty and default to newest-first
|
|
153
|
+
* by creation time; `sort` also supports oldest-first by creation time and longest
|
|
154
|
+
* first by duration. Equal sort values retain a stable run ID order, including
|
|
155
|
+
* across pages. A run's status and cost are BoxRouter's latest recorded evidence;
|
|
156
|
+
* this read does not poll GitHub, change a run, start a job or retry an uncertain
|
|
157
|
+
* effect.
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
160
|
+
list<ThrowOnError extends boolean = true>(options?: Options<ActionsRunsListData, ThrowOnError>): RequestResult<ActionsRunsListResponses, ActionsRunsListErrors, ThrowOnError, 'data'>;
|
|
161
|
+
/**
|
|
162
|
+
* Count the values each run filter offers
|
|
163
|
+
*
|
|
164
|
+
* For each filter of `listActionsRuns`, its values with the number of runs in the whole
|
|
165
|
+
* workspace that have the value, ignoring any active filters. A run counts once for each
|
|
166
|
+
* value it has. Requires workspace read authority; it does not poll GitHub.
|
|
167
|
+
*
|
|
168
|
+
*/
|
|
169
|
+
listFacets<ThrowOnError extends boolean = true>(options?: Options<ActionsRunsListFacetsData, ThrowOnError>): RequestResult<ActionsRunsListFacetsResponses, ActionsRunsListFacetsErrors, ThrowOnError, 'data'>;
|
|
170
|
+
/**
|
|
171
|
+
* Get a workflow-run projection and aggregate billing evidence
|
|
172
|
+
*
|
|
173
|
+
* Requires workspace read authority. Foreign and unknown run IDs both return 404; state and costs are not inferred from missing observations.
|
|
174
|
+
*/
|
|
175
|
+
get<ThrowOnError extends boolean = true>(options: Options<ActionsRunsGetData, ThrowOnError>): RequestResult<ActionsRunsGetResponses, ActionsRunsGetErrors, ThrowOnError, 'data'>;
|
|
176
|
+
/**
|
|
177
|
+
* List GitHub jobs projected for a workflow run
|
|
178
|
+
*
|
|
179
|
+
* Requires workspace read authority. Job assignment is tied to the runner GitHub actually assigns, not the job a JIT label initially requested.
|
|
180
|
+
*/
|
|
181
|
+
listJobs<ThrowOnError extends boolean = true>(options: Options<ActionsRunsListJobsData, ThrowOnError>): RequestResult<ActionsRunsListJobsResponses, ActionsRunsListJobsErrors, ThrowOnError, 'data'>;
|
|
182
|
+
/**
|
|
183
|
+
* List placements attempted for a workflow run
|
|
184
|
+
*
|
|
185
|
+
* Requires workspace read authority. Placement state, outcome, cleanup and billing evidence remain separate; uncertain effects are never replayed by this read.
|
|
186
|
+
*/
|
|
187
|
+
listPlacements<ThrowOnError extends boolean = true>(options: Options<ActionsRunsListPlacementsData, ThrowOnError>): RequestResult<ActionsRunsListPlacementsResponses, ActionsRunsListPlacementsErrors, ThrowOnError, 'data'>;
|
|
188
|
+
/**
|
|
189
|
+
* Ask GitHub to cancel the entire workflow run
|
|
190
|
+
*
|
|
191
|
+
* Requires workspace execute authority. This explicitly cancels the whole GitHub
|
|
192
|
+
* workflow run, including its other jobs; it cannot cancel only one job. GitHub
|
|
193
|
+
* remains authoritative for cancellation. A 202 means GitHub acknowledged the
|
|
194
|
+
* request, not that every job or sandbox has ended. Idempotency-Key identifies this
|
|
195
|
+
* user-authorized mutation. An identical replay returns the recorded result; changed
|
|
196
|
+
* input conflicts. Unknown outcomes are reconciled against GitHub without repeating
|
|
197
|
+
* the cancellation automatically. BoxRouter never cancels as a side effect of a
|
|
198
|
+
* read, timeout or cleanup failure.
|
|
199
|
+
*
|
|
200
|
+
*/
|
|
201
|
+
cancel<ThrowOnError extends boolean = true>(options: Options<ActionsRunsCancelData, ThrowOnError>): RequestResult<ActionsRunsCancelResponses, ActionsRunsCancelErrors, ThrowOnError, 'data'>;
|
|
202
|
+
/**
|
|
203
|
+
* Ask GitHub to rerun the entire workflow
|
|
204
|
+
*
|
|
205
|
+
* Requires workspace execute authority. This explicitly asks GitHub to rerun the
|
|
206
|
+
* entire workflow run, not one job or only failed jobs. GitHub creates and owns the
|
|
207
|
+
* new attempt. A 202 means GitHub acknowledged the request; it does not mean the new
|
|
208
|
+
* jobs have started. Idempotency-Key identifies this user-authorized mutation. An
|
|
209
|
+
* identical replay returns the recorded result; changed input conflicts. An unknown
|
|
210
|
+
* outcome is reconciled against GitHub and never automatically submitted again.
|
|
211
|
+
* Actions admission still rechecks repository binding, policy, trust and the
|
|
212
|
+
* immutable workspace/account/payer before creating any new placement.
|
|
213
|
+
*
|
|
214
|
+
*/
|
|
215
|
+
rerun<ThrowOnError extends boolean = true>(options: Options<ActionsRunsRerunData, ThrowOnError>): RequestResult<ActionsRunsRerunResponses, ActionsRunsRerunErrors, ThrowOnError, 'data'>;
|
|
216
|
+
/**
|
|
217
|
+
* Ask GitHub to rerun failed jobs and their dependents
|
|
218
|
+
*
|
|
219
|
+
* Requires workspace execute authority. This explicitly asks GitHub to rerun the failed
|
|
220
|
+
* jobs of the entire workflow run and the jobs that depend on them in a new attempt.
|
|
221
|
+
* Passed jobs rerun only when they depend on a failed job. GitHub creates and owns the new attempt. A 202 means
|
|
222
|
+
* GitHub acknowledged the request; it does not mean the new jobs have started.
|
|
223
|
+
* Idempotency-Key identifies this user-authorized mutation. An identical replay returns
|
|
224
|
+
* the recorded result; changed input conflicts. An unknown outcome is reconciled against
|
|
225
|
+
* GitHub and never automatically submitted again. A run with no failed job is refused
|
|
226
|
+
* with 409. Actions admission still rechecks repository binding, policy, trust and the
|
|
227
|
+
* immutable workspace/account/payer before creating any new placement.
|
|
228
|
+
*
|
|
229
|
+
*/
|
|
230
|
+
rerunFailedJobs<ThrowOnError extends boolean = true>(options: Options<ActionsRunsRerunFailedJobsData, ThrowOnError>): RequestResult<ActionsRunsRerunFailedJobsResponses, ActionsRunsRerunFailedJobsErrors, ThrowOnError, 'data'>;
|
|
231
|
+
}
|
|
232
|
+
export declare class PoolIdleTime extends HeyApiClient {
|
|
233
|
+
/**
|
|
234
|
+
* Get the billed time of runners that served no job
|
|
235
|
+
*
|
|
236
|
+
* Requires workspace read authority. A pooled runner can cost money while no GitHub job
|
|
237
|
+
* shows it: it sat idle until the pool drained it, or its pickup was foreign or revoked,
|
|
238
|
+
* or it failed after its sandbox existed. That time is charged to the payer and shown
|
|
239
|
+
* here, apart from every run and job. The read counts the runners that started in
|
|
240
|
+
* `[since, until)`, in total and per pool, with the same `billing` object a run carries.
|
|
241
|
+
* `idle_seconds` is each runner's lifetime from creation to its end (to now for a runner
|
|
242
|
+
* that is still alive). `until` defaults to now, `since` to 30 days before `until`, and the
|
|
243
|
+
* range may not exceed 92 days; a longer or empty range returns 400. It does not poll
|
|
244
|
+
* GitHub or a provider and does not change a runner.
|
|
245
|
+
*
|
|
246
|
+
*/
|
|
247
|
+
get<ThrowOnError extends boolean = true>(options?: Options<ActionsPoolIdleTimeGetData, ThrowOnError>): RequestResult<ActionsPoolIdleTimeGetResponses, ActionsPoolIdleTimeGetErrors, ThrowOnError, 'data'>;
|
|
248
|
+
}
|
|
249
|
+
export declare class Jobs extends HeyApiClient {
|
|
250
|
+
/**
|
|
251
|
+
* Get an Actions job projection
|
|
252
|
+
*
|
|
253
|
+
* Requires workspace read authority. The GitHub assignment is authoritative; a requested job ID is not treated as runner reservation.
|
|
254
|
+
*/
|
|
255
|
+
get<ThrowOnError extends boolean = true>(options: Options<ActionsJobsGetData, ThrowOnError>): RequestResult<ActionsJobsGetResponses, ActionsJobsGetErrors, ThrowOnError, 'data'>;
|
|
256
|
+
/**
|
|
257
|
+
* Get GitHub workflow steps for an Actions job
|
|
258
|
+
*
|
|
259
|
+
* Requires workspace execute authority. Resolves the selected workspace-owned
|
|
260
|
+
* job and its exact historical run attempt before reading the assigned GitHub
|
|
261
|
+
* workflow job. Steps preserve GitHub source order and original step numbers;
|
|
262
|
+
* position is the zero-based display order. Pending, unavailable, forbidden and
|
|
263
|
+
* removed are explicit source states. Step output is not included.
|
|
264
|
+
*
|
|
265
|
+
*/
|
|
266
|
+
getSteps<ThrowOnError extends boolean = true>(options: Options<ActionsJobsGetStepsData, ThrowOnError>): RequestResult<ActionsJobsGetStepsResponses, ActionsJobsGetStepsErrors, ThrowOnError, 'data'>;
|
|
267
|
+
/**
|
|
268
|
+
* Read a bounded prefix of the selected GitHub job log
|
|
269
|
+
*
|
|
270
|
+
* Requires workspace execute authority. Resolves the workspace-owned job,
|
|
271
|
+
* current repository binding, assigned GitHub job and exact historical attempt
|
|
272
|
+
* before fetching only that native whole-job log. At most 1 MiB is returned;
|
|
273
|
+
* partial indicates a bounded prefix. Output is transient and is not retained.
|
|
274
|
+
* Individual step log availability depends on the GitHub App/repository source.
|
|
275
|
+
*
|
|
276
|
+
*/
|
|
277
|
+
getLogs<ThrowOnError extends boolean = true>(options: Options<ActionsJobsGetLogsData, ThrowOnError>): RequestResult<ActionsJobsGetLogsResponses, ActionsJobsGetLogsErrors, ThrowOnError, 'data'>;
|
|
278
|
+
/**
|
|
279
|
+
* Read a bounded prefix of one GitHub step log
|
|
280
|
+
*
|
|
281
|
+
* Requires workspace execute authority. step_position is zero-based and is
|
|
282
|
+
* verified against the selected fresh GitHub job before this endpoint is read.
|
|
283
|
+
* GitHub may report individual step logs unavailable for an App/repository;
|
|
284
|
+
* this is returned explicitly without synthesizing output from the whole-job log.
|
|
285
|
+
* At most 1 MiB is returned and partial indicates a bounded prefix.
|
|
286
|
+
*
|
|
287
|
+
*/
|
|
288
|
+
getStepLogs<ThrowOnError extends boolean = true>(options: Options<ActionsJobsGetStepLogsData, ThrowOnError>): RequestResult<ActionsJobsGetStepLogsResponses, ActionsJobsGetStepLogsErrors, ThrowOnError, 'data'>;
|
|
289
|
+
/**
|
|
290
|
+
* List Actions step events for a job
|
|
291
|
+
*
|
|
292
|
+
* Requires workspace execute authority. Returns durable step events recorded for
|
|
293
|
+
* this workspace-owned Actions job, ordered by event time and ID. Use the
|
|
294
|
+
* continuation cursor to retrieve the next page; the list is empty when no
|
|
295
|
+
* events are available.
|
|
296
|
+
*
|
|
297
|
+
*/
|
|
298
|
+
listEvents<ThrowOnError extends boolean = true>(options: Options<ActionsJobsListEventsData, ThrowOnError>): RequestResult<ActionsJobsListEventsResponses, ActionsJobsListEventsErrors, ThrowOnError, 'data'>;
|
|
299
|
+
}
|
|
300
|
+
export declare class Placements extends HeyApiClient {
|
|
301
|
+
/**
|
|
302
|
+
* Get an Actions placement and its cost and cleanup evidence
|
|
303
|
+
*
|
|
304
|
+
* Requires workspace read authority. A completed workflow job does not prove sandbox cleanup or final charge; pending and unknown remain explicit.
|
|
305
|
+
*/
|
|
306
|
+
get<ThrowOnError extends boolean = true>(options: Options<ActionsPlacementsGetData, ThrowOnError>): RequestResult<ActionsPlacementsGetResponses, ActionsPlacementsGetErrors, ThrowOnError, 'data'>;
|
|
307
|
+
}
|