lua-cli 3.32.5 → 3.32.6
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/api-exports.d.ts +21 -0
- package/dist/api-exports.js +136 -13
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +175 -27
- package/dist/index.js.map +1 -1
- package/dist/workflow-builder.d.ts +5 -0
- package/dist/workflow-builder.js +82 -5
- package/dist/workflow-builder.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/workflows/approvals.md +1 -1
- package/package.json +2 -2
- package/template/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65,6 +65,16 @@ var init_auth_error = __esm({
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
// src/errors/cli.error.ts
|
|
68
|
+
function apiErrorDetail(error) {
|
|
69
|
+
return {
|
|
70
|
+
serverCode: error?.code,
|
|
71
|
+
issues: error?.issues,
|
|
72
|
+
upstream: error?.upstream,
|
|
73
|
+
requestId: error?.requestId,
|
|
74
|
+
vendor: error?.vendor,
|
|
75
|
+
retryAfterSeconds: error?.retryAfterSeconds
|
|
76
|
+
};
|
|
77
|
+
}
|
|
68
78
|
function isTypedCliError(error) {
|
|
69
79
|
return CliError.isCliError(error) || AuthenticationError.isAuthenticationError(error);
|
|
70
80
|
}
|
|
@@ -93,6 +103,17 @@ function debugEnabled() {
|
|
|
93
103
|
const v = process.env.LUA_DEBUG;
|
|
94
104
|
return debugFlag || v === "1" || v === "true" || v === "yes";
|
|
95
105
|
}
|
|
106
|
+
function upstreamUnavailableHint(upstream, requestId) {
|
|
107
|
+
const service = typeof upstream === "string" && upstream ? `its ${upstream} service` : "a service behind it";
|
|
108
|
+
const ref = typeof requestId === "string" && requestId ? ` If it persists, quote request ${requestId}.` : "";
|
|
109
|
+
return `The Lua API is up, but ${service} is temporarily unavailable (503 UPSTREAM_UNAVAILABLE) \u2014 retry in a moment.${ref}`;
|
|
110
|
+
}
|
|
111
|
+
function vendorUnavailableHint(vendor, requestId, retryAfterSeconds) {
|
|
112
|
+
const name = typeof vendor === "string" && vendor ? VENDOR_LABELS[vendor] ?? vendor : "a vendor it depends on";
|
|
113
|
+
const ref = typeof requestId === "string" && requestId ? ` If it persists, quote request ${requestId}.` : "";
|
|
114
|
+
const retry = typeof retryAfterSeconds === "number" ? "retry in a moment" : "the request may have applied at the vendor \u2014 check before retrying";
|
|
115
|
+
return `The Lua API is up, but ${name} is temporarily unavailable (503 VENDOR_UNAVAILABLE) \u2014 ${retry}.${ref}`;
|
|
116
|
+
}
|
|
96
117
|
function authHint(error) {
|
|
97
118
|
if (error.suppressDefaultRemediation) return void 0;
|
|
98
119
|
if (error.reason === "no_agent_access") {
|
|
@@ -263,7 +284,7 @@ function reportUnhandledCliError(error) {
|
|
|
263
284
|
process.exitCode = reported.exitCode;
|
|
264
285
|
return reported.exitCode;
|
|
265
286
|
}
|
|
266
|
-
var CLI_EXIT, CliError, HandledCliError, debugFlag, NETWORK_ERRNO, NETWORK_MESSAGE, UNAVAILABLE_HINT, CLI_EXIT_CODE_HELP;
|
|
287
|
+
var CLI_EXIT, CliError, HandledCliError, debugFlag, NETWORK_ERRNO, NETWORK_MESSAGE, UNAVAILABLE_HINT, VENDOR_LABELS, CLI_EXIT_CODE_HELP;
|
|
267
288
|
var init_cli_error = __esm({
|
|
268
289
|
"src/errors/cli.error.ts"() {
|
|
269
290
|
"use strict";
|
|
@@ -277,6 +298,7 @@ var init_cli_error = __esm({
|
|
|
277
298
|
FORBIDDEN: 10,
|
|
278
299
|
UNAVAILABLE: 11
|
|
279
300
|
};
|
|
301
|
+
__name(apiErrorDetail, "apiErrorDetail");
|
|
280
302
|
CliError = class _CliError extends Error {
|
|
281
303
|
static {
|
|
282
304
|
__name(this, "CliError");
|
|
@@ -325,7 +347,8 @@ var init_cli_error = __esm({
|
|
|
325
347
|
/**
|
|
326
348
|
* An API refusal the site already holds the status of (LUA-766) — classified by the same table the top-level
|
|
327
349
|
* classifier applies to an untyped error: 401 auth · 403 forbidden · 404 not_found · other 4xx `http_<status>`
|
|
328
|
-
* (10) · 5xx / 0 unavailable (11, with the network hint unless the site gives its own
|
|
350
|
+
* (10) · 5xx / 0 unavailable (11, with the network hint unless the site gives its own — or the body's code
|
|
351
|
+
* picks one: a 503 UPSTREAM_UNAVAILABLE names the Lua service behind the API, LUA-810) · no status `error` (1).
|
|
329
352
|
* A command that reads `response.error.statusCode` throws through here, so `lua logs` on a 503 exits 11 like
|
|
330
353
|
* every other verb instead of printing the message itself and then throwing an exit-1 `Error`.
|
|
331
354
|
*/
|
|
@@ -333,10 +356,11 @@ var init_cli_error = __esm({
|
|
|
333
356
|
const reported = classifyCliError(Object.assign(new Error(message), {
|
|
334
357
|
statusCode
|
|
335
358
|
}));
|
|
359
|
+
const codeHint = detail.serverCode === "UPSTREAM_UNAVAILABLE" ? upstreamUnavailableHint(detail.upstream, detail.requestId) : detail.serverCode === "VENDOR_UNAVAILABLE" ? vendorUnavailableHint(detail.vendor, detail.requestId, detail.retryAfterSeconds) : void 0;
|
|
336
360
|
const classHint = reported.exitCode === CLI_EXIT.UNAVAILABLE ? UNAVAILABLE_HINT : reported.hint;
|
|
337
361
|
return new _CliError(reported.code, message, {
|
|
338
362
|
exitCode: reported.exitCode,
|
|
339
|
-
hint: hint ?? classHint,
|
|
363
|
+
hint: hint ?? codeHint ?? classHint,
|
|
340
364
|
statusCode,
|
|
341
365
|
serverCode: detail.serverCode,
|
|
342
366
|
issues: detail.issues
|
|
@@ -385,6 +409,14 @@ var init_cli_error = __esm({
|
|
|
385
409
|
]);
|
|
386
410
|
NETWORK_MESSAGE = /fetch failed|socket hang up|network request failed|request timeout|ECONNREFUSED|ENOTFOUND/i;
|
|
387
411
|
UNAVAILABLE_HINT = "The Lua API could not be reached \u2014 check your network and https://status.heylua.ai, then retry.";
|
|
412
|
+
__name(upstreamUnavailableHint, "upstreamUnavailableHint");
|
|
413
|
+
VENDOR_LABELS = {
|
|
414
|
+
unified: "Unified.to",
|
|
415
|
+
github: "GitHub",
|
|
416
|
+
pusher: "Pusher",
|
|
417
|
+
google: "Google"
|
|
418
|
+
};
|
|
419
|
+
__name(vendorUnavailableHint, "vendorUnavailableHint");
|
|
388
420
|
__name(authHint, "authHint");
|
|
389
421
|
__name(numericStatus, "numericStatus");
|
|
390
422
|
__name(classifyCliError, "classifyCliError");
|
|
@@ -1113,6 +1145,18 @@ function modelUnresolvedMessage(r) {
|
|
|
1113
1145
|
}
|
|
1114
1146
|
return r.candidates.length ? `model "${r.requested}" does not resolve to an approved model \u2014 accepted forms: ${r.candidates.join(", ")}` : `model "${r.requested}" does not resolve to an approved model \u2014 accepted forms are the registry's provider-prefixed ids (provider/model) or a bare id that names exactly one of them`;
|
|
1115
1147
|
}
|
|
1148
|
+
function providerModelId(code) {
|
|
1149
|
+
const requested = typeof code === "string" ? code.trim() : "";
|
|
1150
|
+
if (!requested || isModelIdSentinel(requested)) return requested;
|
|
1151
|
+
const slash = requested.indexOf("/");
|
|
1152
|
+
if (slash <= 0) return requested;
|
|
1153
|
+
const provider = requested.slice(0, slash).toLowerCase();
|
|
1154
|
+
if (MODEL_ID_BYOK_PROVIDERS.includes(provider)) return requested;
|
|
1155
|
+
return requested.slice(slash + 1);
|
|
1156
|
+
}
|
|
1157
|
+
function providerModelFamily(code) {
|
|
1158
|
+
return providerModelId(code).toLowerCase().replace(MODEL_SNAPSHOT_SUFFIX, "");
|
|
1159
|
+
}
|
|
1116
1160
|
function isImplicitModelSelectionSource(source) {
|
|
1117
1161
|
return source !== void 0 && IMPLICIT_MODEL_SELECTION_SOURCES.includes(source);
|
|
1118
1162
|
}
|
|
@@ -1791,7 +1835,7 @@ function effectiveAgentFeatureRows(base, override) {
|
|
|
1791
1835
|
]))
|
|
1792
1836
|
};
|
|
1793
1837
|
}
|
|
1794
|
-
var __defProp2, __name2, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, MODEL_ID_BYOK_PROVIDERS, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, AGENT_LOG_SOURCES, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, EventType, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, TEMPLATE_TRIGGER_URL_ENV_PREFIX, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, TYPED_API_KEY, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_JOURNAL_PROTOCOL_VERSION, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_JOB_RANGES, WORKFLOW_JOB_RANGE_MEMBERS, WORKFLOW_SINGLE_STEP_TYPES, WORKFLOW_HITL_ENTRY_TYPES, WORKFLOW_ARM_ENTRY_TYPES, WORKFLOW_HITL_ARM_CONTAINERS, WORKFLOW_GRAPH_ENTRY_STEP_KINDS, WORKFLOW_ARM_ENTRY_STEP_KINDS, WORKFLOW_BUDGET_MAX_DURATION_SECONDS, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES;
|
|
1838
|
+
var __defProp2, __name2, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, MODEL_ID_BYOK_PROVIDERS, MODEL_SNAPSHOT_SUFFIX, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, AGENT_LOG_SOURCES, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, EventType, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, TEMPLATE_TRIGGER_URL_ENV_PREFIX, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, TYPED_API_KEY, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_JOURNAL_PROTOCOL_VERSION, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_JOB_RANGES, WORKFLOW_JOB_RANGE_MEMBERS, WORKFLOW_SINGLE_STEP_TYPES, WORKFLOW_HITL_ENTRY_TYPES, WORKFLOW_ARM_ENTRY_TYPES, WORKFLOW_HITL_ARM_CONTAINERS, WORKFLOW_GRAPH_ENTRY_STEP_KINDS, WORKFLOW_ARM_ENTRY_STEP_KINDS, WORKFLOW_BUDGET_MAX_DURATION_SECONDS, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES;
|
|
1795
1839
|
var init_dist = __esm({
|
|
1796
1840
|
"../shared-types/dist/index.mjs"() {
|
|
1797
1841
|
"use strict";
|
|
@@ -2109,6 +2153,11 @@ var init_dist = __esm({
|
|
|
2109
2153
|
__name2(normalizeModelId, "normalizeModelId");
|
|
2110
2154
|
__name(modelUnresolvedMessage, "modelUnresolvedMessage");
|
|
2111
2155
|
__name2(modelUnresolvedMessage, "modelUnresolvedMessage");
|
|
2156
|
+
__name(providerModelId, "providerModelId");
|
|
2157
|
+
__name2(providerModelId, "providerModelId");
|
|
2158
|
+
MODEL_SNAPSHOT_SUFFIX = /(?:[-@](?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])|-(?:19|20)\d{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]))$/;
|
|
2159
|
+
__name(providerModelFamily, "providerModelFamily");
|
|
2160
|
+
__name2(providerModelFamily, "providerModelFamily");
|
|
2112
2161
|
REASONING_EFFORT_VALUES = [
|
|
2113
2162
|
"off",
|
|
2114
2163
|
"minimal",
|
|
@@ -4264,7 +4313,7 @@ function fillHitl(node) {
|
|
|
4264
4313
|
if (a.onTimeout === void 0) a.onTimeout = "deny";
|
|
4265
4314
|
if (a.onDeny === void 0) a.onDeny = "continue";
|
|
4266
4315
|
if (a.excludeInitiator === void 0) a.excludeInitiator = false;
|
|
4267
|
-
if (a.editable === void 0) a.editable =
|
|
4316
|
+
if (a.editable === void 0) a.editable = approvalEditable(a);
|
|
4268
4317
|
return;
|
|
4269
4318
|
}
|
|
4270
4319
|
const w = node;
|
|
@@ -4746,7 +4795,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
4746
4795
|
}
|
|
4747
4796
|
const a = node;
|
|
4748
4797
|
checkId(a.id, path25);
|
|
4749
|
-
if (a.approver === "creator" && a.excludeInitiator === true) {
|
|
4798
|
+
if ((a.approver ?? "creator") === "creator" && a.excludeInitiator === true) {
|
|
4750
4799
|
err("approver-excludes-only-candidate", "approver:'creator' with excludeInitiator:true always excludes the only candidate", path25, a.id);
|
|
4751
4800
|
}
|
|
4752
4801
|
const editable = approvalEditable(a);
|
|
@@ -6769,6 +6818,53 @@ function rebaseItemPointer(pointer, itemsPath, index) {
|
|
|
6769
6818
|
const base = `/${itemsPath.split(".").map(escapePointer).join("/")}/${index}`;
|
|
6770
6819
|
return pointer === "/" || pointer === "" ? base : `${base}${pointer}`;
|
|
6771
6820
|
}
|
|
6821
|
+
function validateWorkflowSchedule(schedule, path25 = "/schedule") {
|
|
6822
|
+
if (schedule === void 0 || schedule === null) return [];
|
|
6823
|
+
const issue = /* @__PURE__ */ __name3((at, detail) => [
|
|
6824
|
+
{
|
|
6825
|
+
code: WORKFLOW_SCHEDULE_SHAPE_ISSUE,
|
|
6826
|
+
severity: "error",
|
|
6827
|
+
path: at,
|
|
6828
|
+
message: `${detail} \u2014 ${WORKFLOW_SCHEDULE_SHAPES_HINT}`
|
|
6829
|
+
}
|
|
6830
|
+
], "issue");
|
|
6831
|
+
if (!isObject(schedule)) {
|
|
6832
|
+
return issue(path25, `\`schedule\` is ${Array.isArray(schedule) ? "an array" : `a ${typeof schedule}`}, not a typed schedule object`);
|
|
6833
|
+
}
|
|
6834
|
+
const type = schedule.type;
|
|
6835
|
+
if (type === void 0) {
|
|
6836
|
+
const keys = Object.keys(schedule);
|
|
6837
|
+
const seen = keys.length ? ` (got { ${keys.join(", ")} })` : " (got {})";
|
|
6838
|
+
return issue(path25, `\`schedule\` carries no \`type\` discriminator${seen}`);
|
|
6839
|
+
}
|
|
6840
|
+
if (typeof type !== "string" || !WORKFLOW_SCHEDULE_TYPES.includes(type)) {
|
|
6841
|
+
return issue(path25, `\`schedule.type\` ${JSON.stringify(type)} is not one of ${WORKFLOW_SCHEDULE_TYPES.map((t) => `'${t}'`).join(" | ")}`);
|
|
6842
|
+
}
|
|
6843
|
+
switch (type) {
|
|
6844
|
+
case "cron": {
|
|
6845
|
+
if (typeof schedule.expression !== "string" || schedule.expression.trim().length === 0) {
|
|
6846
|
+
return issue(`${path25}/expression`, "a { type: 'cron' } schedule needs a non-empty string `expression`");
|
|
6847
|
+
}
|
|
6848
|
+
if (schedule.timezone !== void 0 && (typeof schedule.timezone !== "string" || schedule.timezone.length === 0)) {
|
|
6849
|
+
return issue(`${path25}/timezone`, "a { type: 'cron' } schedule's `timezone`, when given, is a non-empty IANA string");
|
|
6850
|
+
}
|
|
6851
|
+
return [];
|
|
6852
|
+
}
|
|
6853
|
+
case "interval": {
|
|
6854
|
+
const s = schedule.seconds;
|
|
6855
|
+
if (typeof s !== "number" || !Number.isFinite(s) || s <= 0) {
|
|
6856
|
+
return issue(`${path25}/seconds`, "a { type: 'interval' } schedule needs a positive number `seconds`");
|
|
6857
|
+
}
|
|
6858
|
+
return [];
|
|
6859
|
+
}
|
|
6860
|
+
case "once": {
|
|
6861
|
+
if (typeof schedule.executeAt !== "string" || Number.isNaN(Date.parse(schedule.executeAt))) {
|
|
6862
|
+
return issue(`${path25}/executeAt`, "a { type: 'once' } schedule needs an ISO-8601 string `executeAt`");
|
|
6863
|
+
}
|
|
6864
|
+
return [];
|
|
6865
|
+
}
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
6772
6868
|
function collectEnvTemplateKeys(value22) {
|
|
6773
6869
|
const keys = /* @__PURE__ */ new Set();
|
|
6774
6870
|
const walk22 = /* @__PURE__ */ __name3((v) => {
|
|
@@ -7058,7 +7154,7 @@ function needsInheritedWorkspace(graph) {
|
|
|
7058
7154
|
}
|
|
7059
7155
|
return false;
|
|
7060
7156
|
}
|
|
7061
|
-
var __defProp3, __name3, WorkflowTemplateError, TEMPLATE_PLACEHOLDER, TEMPLATE_NAMESPACES, MAP_DESCRIPTOR_KEYS, MAP_MEMBER_MALFORMED_CODE, fromInit, fromStep, value, template, fromRequest, rows, fromKnowledge, SideEffectsSchema, JobResourcesSchema, APPROVER_SPEC_MAX_USERS, ESCALATION_MAX_HOPS, TemplateBindingSchema, ApproverSpecSchema, FourEyesSchema, EscalationHopSchema, TerminalOutcomeSchema, ApprovalOnTimeoutSchema, APPROVER_SPEC_SHAPES, APPROVER_WRITTEN_MAX, USER_ID_SHAPED_RE, BINDING_ROOTS, WORKSPACE_TEMPLATE_EXPR_RE, SLEEP_UNTIL_REPLACEMENT, WORKFLOW_CAPS_DEFAULT, WORKFLOW_STEP_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_AGENT_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_FOREACH_DEFAULT_CONCURRENCY, WORKFLOW_FOREACH_DEFAULT_MAX_ITEMS, WORKFLOW_LOOP_DEFAULT_MAX_ITERATIONS, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS, WORKFLOW_SIGNAL_DEFAULT_SOURCES, clone, CONNECTION_ID_HEX_RE, WORKFLOW_JOB_TOOLS, WORKFLOW_JOB_MAX_WORKTREE_ARMS, workspaceOf, mountsWorkspace, isJobTier, jobToolsOf, schemaIsArray, isHitlNode, isSingleStep, singleId, armId, TEMPLATE_STEP_REF, EDITABLE_PATH_RE, PREDICATE_OPS, isPredicateScalar, GRAPH_HASH_PREFIX, WorkflowPlanError, isArmStep, armStepId, armStepKind, joinIdOf, containerIdOf, PATH_PLACEHOLDER, MISSING, stepIdOf, cmp, eq, ne, gt, gte, lt, lte, inSet, notIn, exists, notExists, truthy, falsy, and, or, not, CONTINUED_FAILURE_TAG, CONTINUED_FAILURE_DEFAULT_CODE, CONTINUED_FAILURE_OUTPUT_SCHEMA, CONTINUED_FAILURE_LEAF_PATHS, isHitlNode2, nodeIdOf, GOAL_JUDGE_STEP_ID, NON_LEAF_KINDS, CONDITIONAL_JOIN_ID, branchArmId, canonical, sortKeys, JOIN, entryOfJoin, FORCE_CANCEL_STALE_MS, TERMINAL, WORKFLOW_INLINE_RUN_TAG, RUN_ERROR_ISSUES_MAX, IN_FLIGHT, n, STEP_ERROR_DETAIL_KEYS, STEP_ERROR_DETAIL_MAX_BYTES, DETAIL_MAX_DEPTH, DETAIL_MAX_ITEMS, MAX_HOLIDAYS, MAX_WALK_DAYS, HHMM, YMD, MS_PER_MIN, MS_PER_DAY, MON_FRI, supportedTz, fmtCache, WEEKDAYS, JSON_PATCH_OPS, JSON_PATCH_MAX_OPS, JSON_PATCH_MAX_VALUE_BYTES, JSON_PATCH_MAX_TOTAL_BYTES, SEGMENT_RE, WORKFLOW_ENV_OVERLAY_MAX_KEYS, WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES, WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE, isEnvRef, looksLikeEmbeddedJson, ZERO, isRecord2;
|
|
7157
|
+
var __defProp3, __name3, WorkflowTemplateError, TEMPLATE_PLACEHOLDER, TEMPLATE_NAMESPACES, MAP_DESCRIPTOR_KEYS, MAP_MEMBER_MALFORMED_CODE, fromInit, fromStep, value, template, fromRequest, rows, fromKnowledge, SideEffectsSchema, JobResourcesSchema, APPROVER_SPEC_MAX_USERS, ESCALATION_MAX_HOPS, TemplateBindingSchema, ApproverSpecSchema, FourEyesSchema, EscalationHopSchema, TerminalOutcomeSchema, ApprovalOnTimeoutSchema, APPROVER_SPEC_SHAPES, APPROVER_WRITTEN_MAX, USER_ID_SHAPED_RE, BINDING_ROOTS, WORKSPACE_TEMPLATE_EXPR_RE, SLEEP_UNTIL_REPLACEMENT, WORKFLOW_CAPS_DEFAULT, WORKFLOW_STEP_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_AGENT_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_FOREACH_DEFAULT_CONCURRENCY, WORKFLOW_FOREACH_DEFAULT_MAX_ITEMS, WORKFLOW_LOOP_DEFAULT_MAX_ITERATIONS, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS, WORKFLOW_SIGNAL_DEFAULT_SOURCES, clone, CONNECTION_ID_HEX_RE, WORKFLOW_JOB_TOOLS, WORKFLOW_JOB_MAX_WORKTREE_ARMS, workspaceOf, mountsWorkspace, isJobTier, jobToolsOf, schemaIsArray, isHitlNode, isSingleStep, singleId, armId, TEMPLATE_STEP_REF, EDITABLE_PATH_RE, PREDICATE_OPS, isPredicateScalar, GRAPH_HASH_PREFIX, WorkflowPlanError, isArmStep, armStepId, armStepKind, joinIdOf, containerIdOf, PATH_PLACEHOLDER, MISSING, stepIdOf, cmp, eq, ne, gt, gte, lt, lte, inSet, notIn, exists, notExists, truthy, falsy, and, or, not, CONTINUED_FAILURE_TAG, CONTINUED_FAILURE_DEFAULT_CODE, CONTINUED_FAILURE_OUTPUT_SCHEMA, CONTINUED_FAILURE_LEAF_PATHS, isHitlNode2, nodeIdOf, GOAL_JUDGE_STEP_ID, NON_LEAF_KINDS, CONDITIONAL_JOIN_ID, branchArmId, canonical, sortKeys, JOIN, entryOfJoin, FORCE_CANCEL_STALE_MS, TERMINAL, WORKFLOW_INLINE_RUN_TAG, RUN_ERROR_ISSUES_MAX, IN_FLIGHT, n, STEP_ERROR_DETAIL_KEYS, STEP_ERROR_DETAIL_MAX_BYTES, DETAIL_MAX_DEPTH, DETAIL_MAX_ITEMS, MAX_HOLIDAYS, MAX_WALK_DAYS, HHMM, YMD, MS_PER_MIN, MS_PER_DAY, MON_FRI, supportedTz, fmtCache, WEEKDAYS, JSON_PATCH_OPS, JSON_PATCH_MAX_OPS, JSON_PATCH_MAX_VALUE_BYTES, JSON_PATCH_MAX_TOTAL_BYTES, SEGMENT_RE, WORKFLOW_SCHEDULE_TYPES, WORKFLOW_SCHEDULE_SHAPE_ISSUE, WORKFLOW_SCHEDULE_SHAPES_HINT, isObject, WORKFLOW_ENV_OVERLAY_MAX_KEYS, WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES, WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE, isEnvRef, looksLikeEmbeddedJson, ZERO, isRecord2;
|
|
7062
7158
|
var init_dist2 = __esm({
|
|
7063
7159
|
"../workflow-graph/dist/index.mjs"() {
|
|
7064
7160
|
"use strict";
|
|
@@ -7768,6 +7864,16 @@ var init_dist2 = __esm({
|
|
|
7768
7864
|
__name3(applyJsonPatch, "applyJsonPatch");
|
|
7769
7865
|
__name(rebaseItemPointer, "rebaseItemPointer");
|
|
7770
7866
|
__name3(rebaseItemPointer, "rebaseItemPointer");
|
|
7867
|
+
WORKFLOW_SCHEDULE_TYPES = [
|
|
7868
|
+
"cron",
|
|
7869
|
+
"interval",
|
|
7870
|
+
"once"
|
|
7871
|
+
];
|
|
7872
|
+
WORKFLOW_SCHEDULE_SHAPE_ISSUE = "schedule-shape-invalid";
|
|
7873
|
+
WORKFLOW_SCHEDULE_SHAPES_HINT = "`schedule` must be one of { type: 'cron', expression: '<5-field cron>', timezone?: '<IANA tz>' } | { type: 'interval', seconds: <n> } | { type: 'once', executeAt: '<ISO-8601>' }";
|
|
7874
|
+
isObject = /* @__PURE__ */ __name3((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isObject");
|
|
7875
|
+
__name(validateWorkflowSchedule, "validateWorkflowSchedule");
|
|
7876
|
+
__name3(validateWorkflowSchedule, "validateWorkflowSchedule");
|
|
7771
7877
|
WORKFLOW_ENV_OVERLAY_MAX_KEYS = 64;
|
|
7772
7878
|
WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES = 4096;
|
|
7773
7879
|
WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE = /(SECRET|TOKEN|KEY|PASSWORD)$/;
|
|
@@ -8558,9 +8664,12 @@ var init_workflow = __esm({
|
|
|
8558
8664
|
if (opts.approver === "creator" && opts.excludeInitiator === true) {
|
|
8559
8665
|
throw new LuaWorkflowBuildError("approver-excludes-only-candidate", `"${id}": approver:'creator' with excludeInitiator:true always excludes the only candidate`);
|
|
8560
8666
|
}
|
|
8561
|
-
|
|
8562
|
-
if (
|
|
8563
|
-
|
|
8667
|
+
const editable = approvalEditable(opts);
|
|
8668
|
+
if (opts.fourEyes !== void 0 && !editable) throw new LuaWorkflowBuildError("four-eyes-requires-editable", `"${id}": \`fourEyes\` requires editable:true`);
|
|
8669
|
+
if (opts.editable === false && Array.isArray(opts.editablePaths) && opts.editablePaths.length > 0) {
|
|
8670
|
+
throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": \`editablePaths\` beside editable:false is contradictory \u2014 drop the paths or set editable:true`);
|
|
8671
|
+
} else if ((opts.editablePaths !== void 0 || opts.editedPayloadSchema !== void 0) && !editable) {
|
|
8672
|
+
throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": \`editablePaths\` / \`editedPayloadSchema\` require editable:true (a non-empty editablePaths implies it)`);
|
|
8564
8673
|
}
|
|
8565
8674
|
for (const p of opts.editablePaths ?? []) {
|
|
8566
8675
|
if (!EDITABLE_PATH_RE2.test(p)) throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": editablePaths entry "${p}" is outside the grammar seg(.seg)* with [*]/[n] selectors`);
|
|
@@ -8944,10 +9053,22 @@ function serverCodeOf(code, error) {
|
|
|
8944
9053
|
}
|
|
8945
9054
|
async function refusalFromResponse(response) {
|
|
8946
9055
|
const { error } = await classifyErrorResponse(response);
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
9056
|
+
const serverCode = serverCodeOf(error?.code, error?.error);
|
|
9057
|
+
return CliError.fromStatus(
|
|
9058
|
+
error?.statusCode ?? response.status,
|
|
9059
|
+
error?.message ?? `HTTP ${response.status}: ${response.statusText}`,
|
|
9060
|
+
void 0,
|
|
9061
|
+
// LUA-810: `fromStatus` picks the UPSTREAM_UNAVAILABLE hint from the body's `upstream` / `requestId`.
|
|
9062
|
+
// LUA-812: and the VENDOR_UNAVAILABLE hint from `vendor` / `retryAfterSeconds` (whether a blind retry is safe).
|
|
9063
|
+
{
|
|
9064
|
+
serverCode,
|
|
9065
|
+
issues: error?.issues,
|
|
9066
|
+
upstream: error?.upstream,
|
|
9067
|
+
requestId: error?.requestId,
|
|
9068
|
+
vendor: error?.vendor,
|
|
9069
|
+
retryAfterSeconds: error?.retryAfterSeconds
|
|
9070
|
+
}
|
|
9071
|
+
);
|
|
8951
9072
|
}
|
|
8952
9073
|
async function* parseSseStream(body, signal) {
|
|
8953
9074
|
const reader = body.getReader();
|
|
@@ -9153,6 +9274,21 @@ var init_http_client = __esm({
|
|
|
9153
9274
|
return Math.max(100, Math.random() * exponential);
|
|
9154
9275
|
}
|
|
9155
9276
|
/**
|
|
9277
|
+
* The wait before the next attempt: the client's jittered exponential backoff, floored by the server's
|
|
9278
|
+
* `retryAfterSeconds` on a 429 (the limiter's word is final) and on an idempotent read (GET / HEAD). LUA-810: a
|
|
9279
|
+
* POST / PUT / PATCH / DELETE that met a 5xx keeps the client's own backoff — every 503 body carries
|
|
9280
|
+
* `retryAfterSeconds: 5` (`CONTROL_UNAVAILABLE`, `UPSTREAM_UNAVAILABLE`), which floored all three waits at 5 s:
|
|
9281
|
+
* a ≥15 s stall on a write that may already have landed, and retrying an ambiguous write harder does not make
|
|
9282
|
+
* it less ambiguous. The client's own schedule is ≤1 s + ≤2 s + ≤4 s.
|
|
9283
|
+
*/
|
|
9284
|
+
retryDelayMs(attempt, error, method) {
|
|
9285
|
+
const own = this.calculateBackoff(attempt);
|
|
9286
|
+
const advised = Number(error?.retryAfterSeconds ?? 0) * 1e3;
|
|
9287
|
+
const verb = (method ?? "GET").toUpperCase();
|
|
9288
|
+
const honourAdvice = error?.statusCode === 429 || verb === "GET" || verb === "HEAD";
|
|
9289
|
+
return honourAdvice ? Math.max(own, advised) : own;
|
|
9290
|
+
}
|
|
9291
|
+
/**
|
|
9156
9292
|
* Wraps request with retry logic for transient failures
|
|
9157
9293
|
* @param url - The full URL to request
|
|
9158
9294
|
* @param options - Fetch API request options
|
|
@@ -9186,8 +9322,7 @@ var init_http_client = __esm({
|
|
|
9186
9322
|
throw error;
|
|
9187
9323
|
}
|
|
9188
9324
|
if (attempt < maxRetries) {
|
|
9189
|
-
const
|
|
9190
|
-
const backoff = Math.max(this.calculateBackoff(attempt), serverDelay);
|
|
9325
|
+
const backoff = this.retryDelayMs(attempt, lastResult?.error, options.method);
|
|
9191
9326
|
await new Promise((resolve7) => setTimeout(resolve7, backoff));
|
|
9192
9327
|
}
|
|
9193
9328
|
}
|
|
@@ -26111,7 +26246,7 @@ var init_job_api_service = __esm({
|
|
|
26111
26246
|
if (response.success && response.data) {
|
|
26112
26247
|
return new JobInstance(this, response.data);
|
|
26113
26248
|
}
|
|
26114
|
-
throw CliError.fromStatus(response.error?.statusCode, response.error?.message || "Failed to get job");
|
|
26249
|
+
throw CliError.fromStatus(response.error?.statusCode, response.error?.message || "Failed to get job", void 0, apiErrorDetail(response.error));
|
|
26115
26250
|
}
|
|
26116
26251
|
/**
|
|
26117
26252
|
* Creates a new job for the agent.
|
|
@@ -27586,7 +27721,7 @@ async function fetchApprovedModelsOrThrow(apiKey, agentId, orgId) {
|
|
|
27586
27721
|
const agentApi = new AgentApi(BASE_URLS.API, apiKey);
|
|
27587
27722
|
const result = await agentApi.getApprovedModels(void 0, agentId, orgId);
|
|
27588
27723
|
if (!result.success) {
|
|
27589
|
-
throw CliError.fromStatus(result.error?.statusCode, `Could not fetch models from the server: ${result.error?.message || "Unknown error"}
|
|
27724
|
+
throw CliError.fromStatus(result.error?.statusCode, `Could not fetch models from the server: ${result.error?.message || "Unknown error"}`, void 0, apiErrorDetail(result.error));
|
|
27590
27725
|
}
|
|
27591
27726
|
return result.data ?? [];
|
|
27592
27727
|
}
|
|
@@ -45240,7 +45375,7 @@ function channelCreateError(error, alreadyConnected) {
|
|
|
45240
45375
|
return CliError.fromStatus(400, "Channel already exists", `${alreadyConnected}
|
|
45241
45376
|
Use 'lua channels' to list existing channels.`);
|
|
45242
45377
|
}
|
|
45243
|
-
return CliError.fromStatus(error?.statusCode, error?.message || "Unknown error", error?.error);
|
|
45378
|
+
return CliError.fromStatus(error?.statusCode, error?.message || "Unknown error", error?.error, apiErrorDetail(error));
|
|
45244
45379
|
}
|
|
45245
45380
|
__name(channelCreateError, "channelCreateError");
|
|
45246
45381
|
async function fetchChannelsCore(agentApi, agentId) {
|
|
@@ -46176,7 +46311,7 @@ async function nonInteractiveLogs(logsApi, agentId, apiKey, options) {
|
|
|
46176
46311
|
}
|
|
46177
46312
|
const response = await logsApi.getAgentLogs(agentId, options.limit || 20, options.page || 1, filters);
|
|
46178
46313
|
if (!response.success) {
|
|
46179
|
-
throw CliError.fromStatus(response.error?.statusCode, response.error?.message || "Unknown error");
|
|
46314
|
+
throw CliError.fromStatus(response.error?.statusCode, response.error?.message || "Unknown error", void 0, apiErrorDetail(response.error));
|
|
46180
46315
|
}
|
|
46181
46316
|
const data = response.data;
|
|
46182
46317
|
if (options.json) {
|
|
@@ -46388,7 +46523,7 @@ async function viewAgentLogsInteractive(logsApi, agentId, filters = {}) {
|
|
|
46388
46523
|
while (keepViewing) {
|
|
46389
46524
|
const response = await logsApi.getAgentLogs(agentId, limit, currentPage, filters);
|
|
46390
46525
|
if (!response.success) {
|
|
46391
|
-
throw CliError.fromStatus(response.error?.statusCode, response.error?.message || "Unknown error");
|
|
46526
|
+
throw CliError.fromStatus(response.error?.statusCode, response.error?.message || "Unknown error", void 0, apiErrorDetail(response.error));
|
|
46392
46527
|
}
|
|
46393
46528
|
const data = response.data;
|
|
46394
46529
|
displayLogsCore(data.logs, data.pagination, "All Agent Logs", true);
|
|
@@ -50912,6 +51047,7 @@ function emitJson(ctx, res) {
|
|
|
50912
51047
|
if (ctx.json) console.log(JSON.stringify(res, null, 2));
|
|
50913
51048
|
}
|
|
50914
51049
|
__name(emitJson, "emitJson");
|
|
51050
|
+
var SCHEDULE_PROVISION_FAILED_HINT = "The schedule provider (EventBridge) refused this schedule \u2014 the reason above names what to change; re-run after fixing it. This is not a connectivity problem.";
|
|
50915
51051
|
function refusalExitCode(status) {
|
|
50916
51052
|
if (status === 0 || status !== void 0 && status >= 500) return WORKFLOW_EXIT.UNAVAILABLE;
|
|
50917
51053
|
if (status === 404) return WORKFLOW_EXIT.NOT_FOUND;
|
|
@@ -50922,15 +51058,27 @@ function apiRefusal(res, verb, detail = {}) {
|
|
|
50922
51058
|
const err = res.error;
|
|
50923
51059
|
const status = err?.statusCode;
|
|
50924
51060
|
const code = err?.code ?? err?.error;
|
|
50925
|
-
const
|
|
51061
|
+
const reason = code === "SCHEDULE_PROVISION_FAILED" ? err?.reason : void 0;
|
|
51062
|
+
const serverMessage = `${err?.message ?? "Unknown error"}${typeof reason === "string" && reason ? `: ${reason}` : ""}`;
|
|
50926
51063
|
const message = detail.message ? code ? `${detail.message} (${code})` : detail.message : code ? serverMessage === code ? `${verb} failed (${code})` : `${verb} failed (${code}): ${serverMessage}` : `${verb} failed: ${serverMessage}`;
|
|
50927
51064
|
const issues = detail.issues ?? err?.issues;
|
|
50928
51065
|
const exitCode = refusalExitCode(status);
|
|
50929
51066
|
if (exitCode === WORKFLOW_EXIT.UNAVAILABLE) {
|
|
50930
|
-
return CliError.fromStatus(
|
|
50931
|
-
|
|
50932
|
-
|
|
50933
|
-
|
|
51067
|
+
return CliError.fromStatus(
|
|
51068
|
+
status,
|
|
51069
|
+
message,
|
|
51070
|
+
status === 503 && code === "CONTROL_UNAVAILABLE" ? CONTROL_UNAVAILABLE_HINT : code === "SCHEDULE_PROVISION_FAILED" ? SCHEDULE_PROVISION_FAILED_HINT : detail.hint,
|
|
51071
|
+
// LUA-810: `fromStatus` picks the UPSTREAM_UNAVAILABLE hint from `upstream` / `requestId` itself.
|
|
51072
|
+
// LUA-812: and the VENDOR_UNAVAILABLE hint from `vendor` / `retryAfterSeconds`.
|
|
51073
|
+
{
|
|
51074
|
+
serverCode: code,
|
|
51075
|
+
issues,
|
|
51076
|
+
upstream: err?.upstream,
|
|
51077
|
+
requestId: err?.requestId,
|
|
51078
|
+
vendor: err?.vendor,
|
|
51079
|
+
retryAfterSeconds: err?.retryAfterSeconds
|
|
51080
|
+
}
|
|
51081
|
+
);
|
|
50934
51082
|
}
|
|
50935
51083
|
return new CliError(exitCode === WORKFLOW_EXIT.NOT_FOUND ? "not_found" : "error", message, {
|
|
50936
51084
|
exitCode,
|
|
@@ -57123,7 +57271,7 @@ async function listSkillNonInteractive(marketplaceApi, config, apiKey, options)
|
|
|
57123
57271
|
writeProgress("\u{1F504} Verifying skill...");
|
|
57124
57272
|
const agentSkillsResponse = await skillApi.getSkills();
|
|
57125
57273
|
if (!agentSkillsResponse.success || !agentSkillsResponse.data) {
|
|
57126
|
-
throw CliError.fromStatus(agentSkillsResponse.error?.statusCode, `Failed to fetch agent skills: ${agentSkillsResponse.error?.message ?? agentSkillsResponse.message ?? "Unknown error"}
|
|
57274
|
+
throw CliError.fromStatus(agentSkillsResponse.error?.statusCode, `Failed to fetch agent skills: ${agentSkillsResponse.error?.message ?? agentSkillsResponse.message ?? "Unknown error"}`, void 0, apiErrorDetail(agentSkillsResponse.error));
|
|
57127
57275
|
}
|
|
57128
57276
|
const skill = agentSkillsResponse.data.skills?.find((s) => s.name === skillName);
|
|
57129
57277
|
if (!skill) {
|