lua-cli 3.42.0 → 3.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -17839,6 +17839,19 @@ var init_types = __esm({
17839
17839
 
17840
17840
  // src/api/http.client.ts
17841
17841
  import { randomUUID as randomUUID3 } from "crypto";
17842
+ function abortedResponse() {
17843
+ return {
17844
+ success: false,
17845
+ error: {
17846
+ message: "Request aborted",
17847
+ code: REQUEST_ABORTED_CODE,
17848
+ statusCode: 0
17849
+ }
17850
+ };
17851
+ }
17852
+ function isAborted(signal) {
17853
+ return !!signal && signal.aborted === true;
17854
+ }
17842
17855
  async function classifyErrorResponse(response) {
17843
17856
  let errorData;
17844
17857
  try {
@@ -17994,7 +18007,7 @@ function coreDrainApiRetryDelayMs(error) {
17994
18007
  const delayMs = retryAfterSeconds * 1e3;
17995
18008
  return Math.min(Math.max(0, delayMs), CORE_DRAINING_MAX_RETRY_MS);
17996
18009
  }
17997
- var DEFAULT_REQUEST_TIMEOUT_MS, HttpClient;
18010
+ var DEFAULT_REQUEST_TIMEOUT_MS, REQUEST_ABORTED_CODE, HttpClient;
17998
18011
  var init_http_client = __esm({
17999
18012
  "src/api/http.client.ts"() {
18000
18013
  "use strict";
@@ -18005,6 +18018,9 @@ var init_http_client = __esm({
18005
18018
  init_lua_fetch();
18006
18019
  init_request_credential();
18007
18020
  DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
18021
+ REQUEST_ABORTED_CODE = "REQUEST_ABORTED";
18022
+ __name(abortedResponse, "abortedResponse");
18023
+ __name(isAborted, "isAborted");
18008
18024
  HttpClient = class {
18009
18025
  static {
18010
18026
  __name(this, "HttpClient");
@@ -18027,9 +18043,17 @@ var init_http_client = __esm({
18027
18043
  * @private
18028
18044
  */
18029
18045
  async request(url, options = {}, overrides) {
18046
+ const callerSignal = overrides?.signal;
18047
+ if (isAborted(callerSignal)) return abortedResponse();
18030
18048
  const controller = new AbortController();
18031
18049
  const timeoutMs = overrides?.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
18032
18050
  const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
18051
+ const onCallerAbort = /* @__PURE__ */ __name(() => controller.abort(), "onCallerAbort");
18052
+ if (typeof callerSignal?.addEventListener === "function") {
18053
+ callerSignal.addEventListener("abort", onCallerAbort, {
18054
+ once: true
18055
+ });
18056
+ }
18033
18057
  try {
18034
18058
  const authorization = this.requestCredential ? `Bearer ${await bearerFor(this.requestCredential)}` : void 0;
18035
18059
  const response = await luaFetch(url, {
@@ -18051,6 +18075,7 @@ var init_http_client = __esm({
18051
18075
  try {
18052
18076
  data = await response.json();
18053
18077
  } catch (jsonError) {
18078
+ if (isAborted(callerSignal)) throw jsonError;
18054
18079
  data = {};
18055
18080
  }
18056
18081
  if (typeof data === "object" && data !== null && "success" in data) {
@@ -18068,6 +18093,9 @@ var init_http_client = __esm({
18068
18093
  if (isAccessDeniedError(error)) {
18069
18094
  throw error;
18070
18095
  }
18096
+ if (isAborted(callerSignal)) {
18097
+ return abortedResponse();
18098
+ }
18071
18099
  if (error instanceof DOMException && error.name === "AbortError") {
18072
18100
  return {
18073
18101
  success: false,
@@ -18084,9 +18112,36 @@ var init_http_client = __esm({
18084
18112
  statusCode: 0
18085
18113
  }
18086
18114
  };
18115
+ } finally {
18116
+ clearTimeout(timeoutId);
18117
+ if (typeof callerSignal?.removeEventListener === "function") {
18118
+ callerSignal.removeEventListener("abort", onCallerAbort);
18119
+ }
18087
18120
  }
18088
18121
  }
18089
18122
  /**
18123
+ * A backoff wait the caller's signal can cut short (BAC-1097): resolves at `ms` or on abort, whichever is
18124
+ * first, and never leaves the timer or the listener behind. The caller re-checks `signal.aborted` afterwards.
18125
+ * @private
18126
+ */
18127
+ sleep(ms, signal) {
18128
+ if (isAborted(signal)) return Promise.resolve();
18129
+ const listenable = typeof signal?.addEventListener === "function";
18130
+ return new Promise((resolve7) => {
18131
+ const onAbort = /* @__PURE__ */ __name(() => {
18132
+ clearTimeout(timer);
18133
+ resolve7();
18134
+ }, "onAbort");
18135
+ const timer = setTimeout(() => {
18136
+ if (listenable) signal.removeEventListener("abort", onAbort);
18137
+ resolve7();
18138
+ }, ms);
18139
+ if (listenable) signal.addEventListener("abort", onAbort, {
18140
+ once: true
18141
+ });
18142
+ });
18143
+ }
18144
+ /**
18090
18145
  * Non-2xx classification shared by `request` and `httpStream` (WF-204): 401s become
18091
18146
  * `AuthenticationError` (ownership vs credential), 403s throw, everything else returns the
18092
18147
  * `{ success:false, error }` envelope with the server body spread in.
@@ -18154,19 +18209,22 @@ var init_http_client = __esm({
18154
18209
  }
18155
18210
  }
18156
18211
  let lastResult = null;
18212
+ const signal = overrides?.signal;
18157
18213
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
18214
+ if (isAborted(signal)) return abortedResponse();
18158
18215
  try {
18159
18216
  const result = await this.request(url, options, overrides);
18160
18217
  if (result.success || !result.error || !this.isRetryableStatus(result.error.statusCode || 0)) {
18161
18218
  return result;
18162
18219
  }
18220
+ if (isAborted(signal)) return result;
18163
18221
  lastResult = result;
18164
18222
  } catch (error) {
18165
18223
  throw error;
18166
18224
  }
18167
18225
  if (attempt < maxRetries) {
18168
18226
  const backoff = this.retryDelayMs(attempt, lastResult?.error, options.method);
18169
- await new Promise((resolve7) => setTimeout(resolve7, backoff));
18227
+ await this.sleep(backoff, signal);
18170
18228
  }
18171
18229
  }
18172
18230
  return lastResult;
@@ -18215,7 +18273,8 @@ var init_http_client = __esm({
18215
18273
  async httpPostCoreDrainRetry(url, data, headers, overrides) {
18216
18274
  const first = await this.httpPostOnce(url, data, headers, overrides);
18217
18275
  if (!isCoreDrainApiError(first.error)) return first;
18218
- await new Promise((resolve7) => setTimeout(resolve7, coreDrainApiRetryDelayMs(first.error)));
18276
+ await this.sleep(coreDrainApiRetryDelayMs(first.error), overrides?.signal);
18277
+ if (isAborted(overrides?.signal)) return abortedResponse();
18219
18278
  return this.httpPostOnce(url, data, headers, overrides);
18220
18279
  }
18221
18280
  /**
@@ -20702,6 +20761,23 @@ function setCiMode(enabled) {
20702
20761
  function isCiModeEnabled() {
20703
20762
  return isCiMode;
20704
20763
  }
20764
+ function setJsonOutputRequested(enabled) {
20765
+ jsonOutputRequested = enabled;
20766
+ }
20767
+ function isJsonOutputRequested() {
20768
+ return jsonOutputRequested;
20769
+ }
20770
+ function commandRequestedJson(command) {
20771
+ for (let current = command; current; current = current.parent) {
20772
+ if (current.getOptionValueSource("json") === "cli" && current.getOptionValue("json")) return true;
20773
+ }
20774
+ return false;
20775
+ }
20776
+ function registerJsonErrorEnvelope(program2) {
20777
+ program2.hook("preAction", (_thisCommand, actionCommand) => {
20778
+ setJsonOutputRequested(commandRequestedJson(actionCommand));
20779
+ });
20780
+ }
20705
20781
  async function showUpdateWarningIfNeeded(versionCheckPromise) {
20706
20782
  try {
20707
20783
  const result = await versionCheckPromise;
@@ -20777,7 +20853,8 @@ async function withErrorHandling(commandFn, commandName, opts) {
20777
20853
  }
20778
20854
  let json2 = false;
20779
20855
  try {
20780
- json2 = typeof opts?.json === "function" ? !!opts.json() : !!opts?.json;
20856
+ if (opts?.json === void 0) json2 = isJsonOutputRequested();
20857
+ else json2 = typeof opts.json === "function" ? !!opts.json() : !!opts.json;
20781
20858
  } catch {
20782
20859
  }
20783
20860
  const reported = reportCliError(error, {
@@ -20801,7 +20878,7 @@ function writeSuccess(message) {
20801
20878
  function writeError(message) {
20802
20879
  process.stderr.write("\r\x1B[K" + message + "\n");
20803
20880
  }
20804
- var isCiMode;
20881
+ var isCiMode, jsonOutputRequested;
20805
20882
  var init_cli = __esm({
20806
20883
  "src/utils/cli.ts"() {
20807
20884
  "use strict";
@@ -20815,6 +20892,11 @@ var init_cli = __esm({
20815
20892
  isCiMode = false;
20816
20893
  __name(setCiMode, "setCiMode");
20817
20894
  __name(isCiModeEnabled, "isCiModeEnabled");
20895
+ jsonOutputRequested = false;
20896
+ __name(setJsonOutputRequested, "setJsonOutputRequested");
20897
+ __name(isJsonOutputRequested, "isJsonOutputRequested");
20898
+ __name(commandRequestedJson, "commandRequestedJson");
20899
+ __name(registerJsonErrorEnvelope, "registerJsonErrorEnvelope");
20818
20900
  __name(showUpdateWarningIfNeeded, "showUpdateWarningIfNeeded");
20819
20901
  __name(withErrorHandling, "withErrorHandling");
20820
20902
  __name(clearPromptLines, "clearPromptLines");
@@ -32961,10 +33043,15 @@ var init_webhook_api_service = __esm({
32961
33043
  });
32962
33044
 
32963
33045
  // src/instances/user.instance.ts
33046
+ function omit(source, key) {
33047
+ const { [key]: _dropped, ...rest } = source;
33048
+ return rest;
33049
+ }
32964
33050
  var UserDataInstance;
32965
33051
  var init_user_instance = __esm({
32966
33052
  "src/instances/user.instance.ts"() {
32967
33053
  "use strict";
33054
+ __name(omit, "omit");
32968
33055
  UserDataInstance = class {
32969
33056
  static {
32970
33057
  __name(this, "UserDataInstance");
@@ -32980,7 +33067,12 @@ var init_user_instance = __esm({
32980
33067
  * @returns Proxied instance that allows direct access to data properties
32981
33068
  */
32982
33069
  constructor(api, data, profile) {
32983
- this.data = data && typeof data === "object" ? data : {};
33070
+ Object.defineProperty(this, "data", {
33071
+ value: data && typeof data === "object" ? data : {},
33072
+ writable: true,
33073
+ enumerable: false,
33074
+ configurable: true
33075
+ });
32984
33076
  Object.defineProperty(this, "userAPI", {
32985
33077
  value: api,
32986
33078
  writable: true,
@@ -33092,7 +33184,8 @@ var init_user_instance = __esm({
33092
33184
  */
33093
33185
  async update(data) {
33094
33186
  try {
33095
- const response = await this.userAPI.update(data);
33187
+ const payload = data && data.data === this.data ? omit(data, "data") : data;
33188
+ const response = await this.userAPI.update(payload);
33096
33189
  this.data = response;
33097
33190
  return this.data;
33098
33191
  } catch (error) {
@@ -34993,6 +35086,29 @@ var init_ai_api_service = __esm({
34993
35086
  }
34994
35087
  return result.data;
34995
35088
  }
35089
+ async image(body) {
35090
+ return this.httpPost(`/developer/ai/${this.agentId}/image`, body, {});
35091
+ }
35092
+ /**
35093
+ * Handles the simplified-vs-full-options branching for `AI.image`.
35094
+ * Simplified (`AI.image(prompt, options?)`) returns the hosted CDN url string; the options overload
35095
+ * (`AI.image({ prompt, ... })`) returns the full `{ url, model, provider }`.
35096
+ */
35097
+ async imageForSandbox(promptOrOptions, options) {
35098
+ const simplified = typeof promptOrOptions === "string";
35099
+ const body = simplified ? {
35100
+ prompt: promptOrOptions,
35101
+ ...options
35102
+ } : promptOrOptions;
35103
+ const result = await this.image(body);
35104
+ if (!result.success) {
35105
+ throw new Error(result.error?.message || "AI image generation failed");
35106
+ }
35107
+ if (!result.data) {
35108
+ throw new Error("AI image generation failed: empty response");
35109
+ }
35110
+ return simplified ? result.data.url : result.data;
35111
+ }
34996
35112
  };
34997
35113
  }
34998
35114
  });
@@ -35379,6 +35495,12 @@ var init_connection_requests_api_service = __esm({
35379
35495
  });
35380
35496
 
35381
35497
  // src/api/agents.api.service.ts
35498
+ function isAborted2(signal) {
35499
+ return !!signal && signal.aborted === true;
35500
+ }
35501
+ function abortReason2(signal) {
35502
+ return signal.reason ?? new DOMException("The operation was aborted", "AbortError");
35503
+ }
35382
35504
  function toInvocationOutput(data, callerThreadId) {
35383
35505
  const toolNames = /* @__PURE__ */ new Set();
35384
35506
  for (const step3 of Array.isArray(data.steps) ? data.steps : []) {
@@ -35464,9 +35586,15 @@ var init_agents_api_service = __esm({
35464
35586
  });
35465
35587
  if (body.identifier) query.set("identifier", body.identifier);
35466
35588
  const chatBody = this.toChatGenerateBody(body);
35467
- return this.httpPostCoreDrainRetry(`/chat/generate/${targetAgentId}?${query.toString()}`, chatBody, {}, typeof body.timeoutMs === "number" ? {
35468
- timeoutMs: body.timeoutMs
35469
- } : void 0);
35589
+ const overrides = {
35590
+ ...typeof body.timeoutMs === "number" ? {
35591
+ timeoutMs: body.timeoutMs
35592
+ } : {},
35593
+ ...body.signal ? {
35594
+ signal: body.signal
35595
+ } : {}
35596
+ };
35597
+ return this.httpPostCoreDrainRetry(`/chat/generate/${targetAgentId}?${query.toString()}`, chatBody, {}, Object.keys(overrides).length > 0 ? overrides : void 0);
35470
35598
  }
35471
35599
  /**
35472
35600
  * Sandbox overload: mirrors the `AI.generate` pattern where the simplified
@@ -35477,8 +35605,10 @@ var init_agents_api_service = __esm({
35477
35605
  const input = typeof promptOrInput === "string" ? {
35478
35606
  prompt: promptOrInput
35479
35607
  } : promptOrInput;
35608
+ if (isAborted2(input.signal)) throw abortReason2(input.signal);
35480
35609
  const result = await this.invoke(targetAgentId, input);
35481
35610
  if (!result.success) {
35611
+ if (isAborted2(input.signal)) throw abortReason2(input.signal);
35482
35612
  throw new Error(result.error?.message || "Agent invocation failed");
35483
35613
  }
35484
35614
  if (!result.data) {
@@ -35724,6 +35854,8 @@ var init_agents_api_service = __esm({
35724
35854
  };
35725
35855
  }
35726
35856
  };
35857
+ __name(isAborted2, "isAborted");
35858
+ __name(abortReason2, "abortReason");
35727
35859
  __name(toInvocationOutput, "toInvocationOutput");
35728
35860
  __name(runSummary, "runSummary");
35729
35861
  __name(supervisedCheck, "supervisedCheck");
@@ -38093,9 +38225,7 @@ __name(parseAgentVersionFlag, "parseAgentVersionFlag");
38093
38225
 
38094
38226
  // src/commands/configure.ts
38095
38227
  init_cli();
38096
-
38097
- // src/utils/auth-flows.ts
38098
- import inquirer from "inquirer";
38228
+ init_cli_error();
38099
38229
 
38100
38230
  // src/services/auth.ts
38101
38231
  import "dotenv/config";
@@ -38193,6 +38323,44 @@ __name(verifyOTPAndGetToken, "verifyOTPAndGetToken");
38193
38323
  // src/utils/auth-flows.ts
38194
38324
  init_credential_operational_context();
38195
38325
  init_analytics();
38326
+
38327
+ // src/utils/prompt-handler.ts
38328
+ init_cli();
38329
+ import inquirer from "inquirer";
38330
+ async function safePrompt(questions) {
38331
+ if (isCiModeEnabled()) {
38332
+ throw new Error("Interactive prompt required but --ci flag is set. Provide all required flags or arguments.");
38333
+ }
38334
+ if (!process.stdin.isTTY && !isCiModeEnabled()) {
38335
+ console.warn("\u26A0\uFE0F Warning: stdin is not a TTY. Interactive prompts may not work correctly.");
38336
+ console.warn("\u{1F4A1} Tip: Use --ci flag in CI/CD environments to fail loudly on missing required flags.");
38337
+ }
38338
+ try {
38339
+ await new Promise((resolve7) => setTimeout(resolve7, 10));
38340
+ const answers = await inquirer.prompt(questions);
38341
+ return answers;
38342
+ } catch (error) {
38343
+ if (error.name === "ExitPromptError" || error.message?.includes("SIGINT")) {
38344
+ process.exit(0);
38345
+ }
38346
+ throw error;
38347
+ }
38348
+ }
38349
+ __name(safePrompt, "safePrompt");
38350
+ async function confirmAction(message) {
38351
+ const answer = await safePrompt([
38352
+ {
38353
+ type: "confirm",
38354
+ name: "confirmed",
38355
+ message,
38356
+ default: false
38357
+ }
38358
+ ]);
38359
+ return answer?.confirmed ?? false;
38360
+ }
38361
+ __name(confirmAction, "confirmAction");
38362
+
38363
+ // src/utils/auth-flows.ts
38196
38364
  init_cli();
38197
38365
  init_firebase_session();
38198
38366
  init_request_credential();
@@ -38236,7 +38404,7 @@ async function completeEmailLogin(signInToken, email) {
38236
38404
  }
38237
38405
  __name(completeEmailLogin, "completeEmailLogin");
38238
38406
  async function handleApiKeyAuth() {
38239
- const { apiKey } = await inquirer.prompt([
38407
+ const { apiKey } = await safePrompt([
38240
38408
  {
38241
38409
  type: "password",
38242
38410
  name: "apiKey",
@@ -38279,7 +38447,7 @@ async function handleEmailOtpVerify(email, otp) {
38279
38447
  }
38280
38448
  __name(handleEmailOtpVerify, "handleEmailOtpVerify");
38281
38449
  async function handleEmailAuth() {
38282
- const { email } = await inquirer.prompt([
38450
+ const { email } = await safePrompt([
38283
38451
  {
38284
38452
  type: "input",
38285
38453
  name: "email",
@@ -38295,7 +38463,7 @@ async function handleEmailAuth() {
38295
38463
  __name(handleEmailAuth, "handleEmailAuth");
38296
38464
  async function verifyOTPWithRetry(email) {
38297
38465
  for (let attempt = 1; attempt <= OTP_CONFIG.MAX_ATTEMPTS; attempt += 1) {
38298
- const { pin } = await inquirer.prompt([
38466
+ const { pin } = await safePrompt([
38299
38467
  {
38300
38468
  type: "input",
38301
38469
  name: "pin",
@@ -38315,7 +38483,7 @@ async function verifyOTPWithRetry(email) {
38315
38483
  }
38316
38484
  __name(verifyOTPWithRetry, "verifyOTPWithRetry");
38317
38485
  async function promptAuthMethod() {
38318
- const { authMethod } = await inquirer.prompt([
38486
+ const { authMethod } = await safePrompt([
38319
38487
  {
38320
38488
  type: "list",
38321
38489
  name: "authMethod",
@@ -38356,6 +38524,9 @@ async function configureCommand(options = {}) {
38356
38524
  await handleEmailOtpRequest(email);
38357
38525
  }
38358
38526
  } else {
38527
+ if (isCiModeEnabled()) {
38528
+ throw CliError.usage("lua auth configure needs an interactive prompt and --ci is set.", "Pass --api-key <key>, or --email <email> [--otp <code>]");
38529
+ }
38359
38530
  authMethod = await promptAuthMethod();
38360
38531
  clearPromptLines(2);
38361
38532
  if (authMethod === "api-key") {
@@ -38378,46 +38549,9 @@ init_credential_operational_context();
38378
38549
  init_command_utils();
38379
38550
  init_cli_error();
38380
38551
  init_cli();
38381
- import inquirer4 from "inquirer";
38382
38552
  import { writeFileSync as writeFileSync7, existsSync as existsSync8 } from "fs";
38383
38553
  import { join as join8 } from "path";
38384
38554
 
38385
- // src/utils/prompt-handler.ts
38386
- init_cli();
38387
- import inquirer2 from "inquirer";
38388
- async function safePrompt(questions) {
38389
- if (isCiModeEnabled()) {
38390
- throw new Error("Interactive prompt required but --ci flag is set. Provide all required flags or arguments.");
38391
- }
38392
- if (!process.stdin.isTTY && !isCiModeEnabled()) {
38393
- console.warn("\u26A0\uFE0F Warning: stdin is not a TTY. Interactive prompts may not work correctly.");
38394
- console.warn("\u{1F4A1} Tip: Use --ci flag in CI/CD environments to fail loudly on missing required flags.");
38395
- }
38396
- try {
38397
- await new Promise((resolve7) => setTimeout(resolve7, 10));
38398
- const answers = await inquirer2.prompt(questions);
38399
- return answers;
38400
- } catch (error) {
38401
- if (error.name === "ExitPromptError" || error.message?.includes("SIGINT")) {
38402
- process.exit(0);
38403
- }
38404
- throw error;
38405
- }
38406
- }
38407
- __name(safePrompt, "safePrompt");
38408
- async function confirmAction(message) {
38409
- const answer = await safePrompt([
38410
- {
38411
- type: "confirm",
38412
- name: "confirmed",
38413
- message,
38414
- default: false
38415
- }
38416
- ]);
38417
- return answer?.confirmed ?? false;
38418
- }
38419
- __name(confirmAction, "confirmAction");
38420
-
38421
38555
  // src/utils/governance-scaffold.ts
38422
38556
  import { readFileSync as readFileSync8, writeFileSync as writeFileSync6, existsSync as existsSync6 } from "fs";
38423
38557
  import { join as join6 } from "path";
@@ -38532,10 +38666,10 @@ ${src}`;
38532
38666
  __name(injectGovernanceIntoAgent, "injectGovernanceIntoAgent");
38533
38667
 
38534
38668
  // src/utils/init-prompts.ts
38535
- import inquirer3 from "inquirer";
38669
+ import inquirer2 from "inquirer";
38536
38670
  import chalk from "chalk";
38537
38671
  async function promptAgentChoice() {
38538
- const { agentChoice } = await inquirer3.prompt([
38672
+ const { agentChoice } = await safePrompt([
38539
38673
  {
38540
38674
  type: "list",
38541
38675
  name: "agentChoice",
@@ -38564,7 +38698,7 @@ async function promptOrganizationSelection(orgs) {
38564
38698
  name: org.registeredName || org.name || "Unknown Organization",
38565
38699
  value: org
38566
38700
  }));
38567
- const { selectedOrg } = await inquirer3.prompt([
38701
+ const { selectedOrg } = await safePrompt([
38568
38702
  {
38569
38703
  type: "list",
38570
38704
  name: "selectedOrg",
@@ -38583,7 +38717,7 @@ async function promptAgentSelection(org) {
38583
38717
  name: agent.name,
38584
38718
  value: agent
38585
38719
  }));
38586
- const { selectedAgent } = await inquirer3.prompt([
38720
+ const { selectedAgent } = await safePrompt([
38587
38721
  {
38588
38722
  type: "list",
38589
38723
  name: "selectedAgent",
@@ -38597,7 +38731,7 @@ __name(promptAgentSelection, "promptAgentSelection");
38597
38731
  async function promptMetadataCollection(requiredFields) {
38598
38732
  const metadata = {};
38599
38733
  for (const field of requiredFields) {
38600
- const { [field]: value3 } = await inquirer3.prompt([
38734
+ const { [field]: value3 } = await safePrompt([
38601
38735
  {
38602
38736
  type: "input",
38603
38737
  name: field,
@@ -38611,7 +38745,7 @@ async function promptMetadataCollection(requiredFields) {
38611
38745
  }
38612
38746
  __name(promptMetadataCollection, "promptMetadataCollection");
38613
38747
  async function promptAgentName() {
38614
- const { agentName } = await inquirer3.prompt([
38748
+ const { agentName } = await safePrompt([
38615
38749
  {
38616
38750
  type: "input",
38617
38751
  name: "agentName",
@@ -38638,7 +38772,7 @@ async function promptModelSelection(models) {
38638
38772
  ];
38639
38773
  for (const provider of providers) {
38640
38774
  const providerModels = models.filter((m) => m.provider === provider);
38641
- choices.push(new inquirer3.Separator(` \u2500\u2500 ${provider} \u2500\u2500`));
38775
+ choices.push(new inquirer2.Separator(` \u2500\u2500 ${provider} \u2500\u2500`));
38642
38776
  for (const m of providerModels) {
38643
38777
  choices.push({
38644
38778
  name: `${chalk.bold(m.code)} ${chalk.gray(m.description)}`,
@@ -38647,7 +38781,7 @@ async function promptModelSelection(models) {
38647
38781
  });
38648
38782
  }
38649
38783
  }
38650
- const { selectedModel } = await inquirer3.prompt([
38784
+ const { selectedModel } = await safePrompt([
38651
38785
  {
38652
38786
  type: "list",
38653
38787
  name: "selectedModel",
@@ -38680,7 +38814,7 @@ __name(displayPersonaInstructions, "displayPersonaInstructions");
38680
38814
  async function promptDuplicateOptions(sourceOrg, allOrgs, sourceAgentName) {
38681
38815
  let targetOrg = sourceOrg;
38682
38816
  if (allOrgs.length > 1) {
38683
- const { sameOrg } = await inquirer3.prompt([
38817
+ const { sameOrg } = await safePrompt([
38684
38818
  {
38685
38819
  type: "list",
38686
38820
  name: "sameOrg",
@@ -38704,7 +38838,7 @@ async function promptDuplicateOptions(sourceOrg, allOrgs, sourceAgentName) {
38704
38838
  }
38705
38839
  }
38706
38840
  const defaultName = `${sourceAgentName} (Copy)`;
38707
- const { newName } = await inquirer3.prompt([
38841
+ const { newName } = await safePrompt([
38708
38842
  {
38709
38843
  type: "input",
38710
38844
  name: "newName",
@@ -38713,7 +38847,7 @@ async function promptDuplicateOptions(sourceOrg, allOrgs, sourceAgentName) {
38713
38847
  validate: /* @__PURE__ */ __name((input) => input.trim().length > 0 || "Name is required", "validate")
38714
38848
  }
38715
38849
  ]);
38716
- const { includedBuckets } = await inquirer3.prompt([
38850
+ const { includedBuckets } = await safePrompt([
38717
38851
  {
38718
38852
  type: "checkbox",
38719
38853
  name: "includedBuckets",
@@ -38757,7 +38891,7 @@ async function promptDuplicateOptions(sourceOrg, allOrgs, sourceAgentName) {
38757
38891
  console.log(chalk.white(` Including: ${includedBuckets.length > 0 ? includedBuckets.join(", ") : "core agent definition only"}`));
38758
38892
  console.log(chalk.cyan("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"));
38759
38893
  console.log("");
38760
- const { confirmed } = await inquirer3.prompt([
38894
+ const { confirmed } = await safePrompt([
38761
38895
  {
38762
38896
  type: "confirm",
38763
38897
  name: "confirmed",
@@ -41032,7 +41166,7 @@ async function initCommand(options = {}) {
41032
41166
  writeError("\n\u26A0\uFE0F You don't have access to the agent in this project");
41033
41167
  writeInfo(` Agent ID: ${existingAgentId}
41034
41168
  `);
41035
- const { action } = await inquirer4.prompt([
41169
+ const { action } = await safePrompt([
41036
41170
  {
41037
41171
  type: "list",
41038
41172
  name: "action",
@@ -41069,7 +41203,7 @@ async function initCommand(options = {}) {
41069
41203
  writeInfo("\n\u{1F4CB} Found existing project configuration");
41070
41204
  writeInfo(` Current Agent ID: ${existingAgentId}
41071
41205
  `);
41072
- const { wantSwitch } = await inquirer4.prompt([
41206
+ const { wantSwitch } = await safePrompt([
41073
41207
  {
41074
41208
  type: "list",
41075
41209
  name: "wantSwitch",
@@ -41356,7 +41490,7 @@ __name(createNewAgentNonInteractive, "createNewAgentNonInteractive");
41356
41490
  async function createNewAgentFlow(apiKey, organizations, promoCode) {
41357
41491
  const agentTypes = await fetchAgentTypes(apiKey);
41358
41492
  const selectedAgentType = selectBaseAgentType(agentTypes);
41359
- const { orgChoice } = await inquirer4.prompt([
41493
+ const { orgChoice } = await safePrompt([
41360
41494
  {
41361
41495
  type: "list",
41362
41496
  name: "orgChoice",
@@ -41387,7 +41521,7 @@ async function createNewAgentFlow(apiKey, organizations, promoCode) {
41387
41521
  }
41388
41522
  }
41389
41523
  if (!orgId) {
41390
- const { organizationName } = await inquirer4.prompt([
41524
+ const { organizationName } = await safePrompt([
41391
41525
  {
41392
41526
  type: "input",
41393
41527
  name: "organizationName",
@@ -41515,7 +41649,7 @@ async function promptPersonaReplacement(existingYaml, newPersona) {
41515
41649
  }
41516
41650
  writeInfo("\n\u{1F4DD} Persona Configuration:");
41517
41651
  writeInfo(" Existing persona found in project");
41518
- const { replacePersona } = await inquirer4.prompt([
41652
+ const { replacePersona } = await safePrompt([
41519
41653
  {
41520
41654
  type: "confirm",
41521
41655
  name: "replacePersona",
@@ -41535,7 +41669,7 @@ async function checkAndRestoreBackup(apiKey, agentId, options) {
41535
41669
  }
41536
41670
  const conflicts = checkRestoreConflicts(manifest, targetDir);
41537
41671
  if (!options.autoRestore && conflicts.existingFiles.length > 0) {
41538
- const { confirm } = await inquirer4.prompt([
41672
+ const { confirm } = await safePrompt([
41539
41673
  {
41540
41674
  type: "confirm",
41541
41675
  name: "confirm",
@@ -41584,7 +41718,7 @@ __name(checkAndRestoreBackup, "checkAndRestoreBackup");
41584
41718
  init_request_credential();
41585
41719
  init_cli();
41586
41720
  init_analytics();
41587
- import inquirer5 from "inquirer";
41721
+ import inquirer3 from "inquirer";
41588
41722
  function report(result, requested) {
41589
41723
  const deleted = result.sessionCleared || result.apiKeyCleared;
41590
41724
  if (!deleted) {
@@ -41618,7 +41752,7 @@ async function destroyCommand(options) {
41618
41752
  });
41619
41753
  return;
41620
41754
  }
41621
- const { confirm } = await inquirer5.prompt([
41755
+ const { confirm } = await inquirer3.prompt([
41622
41756
  {
41623
41757
  type: "confirm",
41624
41758
  name: "confirm",
@@ -41767,7 +41901,7 @@ async function sessionsRevokeCommand(sessionId) {
41767
41901
  __name(sessionsRevokeCommand, "sessionsRevokeCommand");
41768
41902
 
41769
41903
  // src/commands/apiKey.ts
41770
- import inquirer6 from "inquirer";
41904
+ import inquirer4 from "inquirer";
41771
41905
  init_request_credential();
41772
41906
  init_cli();
41773
41907
  init_analytics();
@@ -41793,7 +41927,7 @@ async function apiKeyCommand(options) {
41793
41927
  });
41794
41928
  return;
41795
41929
  }
41796
- const { confirm } = await inquirer6.prompt([
41930
+ const { confirm } = await inquirer4.prompt([
41797
41931
  {
41798
41932
  type: "confirm",
41799
41933
  name: "confirm",
@@ -48425,7 +48559,7 @@ async function compileCommand(options) {
48425
48559
  __name(compileCommand, "compileCommand");
48426
48560
 
48427
48561
  // src/commands/test.ts
48428
- import inquirer7 from "inquirer";
48562
+ import inquirer5 from "inquirer";
48429
48563
 
48430
48564
  // src/commands/test-output.helpers.ts
48431
48565
  import { inspect } from "util";
@@ -51093,7 +51227,7 @@ async function promptToolSelection(tools) {
51093
51227
  name: tool.skillName ? `${tool.name} (${tool.skillName}) - ${tool.description}` : `${tool.name} - ${tool.description}`,
51094
51228
  value: tool
51095
51229
  }));
51096
- const { selectedTool } = await inquirer7.prompt([
51230
+ const { selectedTool } = await inquirer5.prompt([
51097
51231
  {
51098
51232
  type: "list",
51099
51233
  name: "selectedTool",
@@ -52968,17 +53102,20 @@ function pushAllExitCode(variant) {
52968
53102
  return variant === "partial" || variant === "error" ? CLI_EXIT.ERROR : void 0;
52969
53103
  }
52970
53104
  __name(pushAllExitCode, "pushAllExitCode");
52971
- function formatPushFailureSummary(failedItems) {
53105
+ function formatPushFailureSummary(failedItems, opts = {}) {
52972
53106
  if (failedItems.length === 0) return "";
53107
+ const includeLogsHint = opts.includeLogsHint !== false;
52973
53108
  const lines = [];
52974
53109
  lines.push(`
52975
53110
  \u26A0\uFE0F ${failedItems.length} component(s) failed to push:`);
52976
53111
  for (const item of failedItems) {
52977
53112
  lines.push(` ${item.kind} "${item.name}": ${item.error}`);
52978
- lines.push(` \u{1F4A1} Diagnose: ${buildLogsCommand({
52979
- primitiveType: item.kind,
52980
- name: item.name
52981
- })}`);
53113
+ if (includeLogsHint) {
53114
+ lines.push(` \u{1F4A1} Diagnose: ${buildLogsCommand({
53115
+ primitiveType: item.kind,
53116
+ name: item.name
53117
+ })}`);
53118
+ }
52982
53119
  }
52983
53120
  return lines.join("\n");
52984
53121
  }
@@ -53996,7 +54133,9 @@ ${icon} Pushing ${items.length} ${handler.displayName}(s)...`);
53996
54133
  }
53997
54134
  }
53998
54135
  if (failedItems.length > 0) {
53999
- console.error(formatPushFailureSummary(failedItems));
54136
+ console.error(formatPushFailureSummary(failedItems, {
54137
+ includeLogsHint: false
54138
+ }));
54000
54139
  }
54001
54140
  const agentPushResult = await agentHandler.pushAgentConfig(apiKey, agentId, manifest);
54002
54141
  if (agentPushResult.persona?.success) {
@@ -54217,7 +54356,6 @@ init_cli_error();
54217
54356
  // src/utils/deploy-helpers.ts
54218
54357
  init_cli();
54219
54358
  init_cli_error();
54220
- import inquirer8 from "inquirer";
54221
54359
  function formatVersionChoice(version) {
54222
54360
  const currentIndicator = version.isCurrent ? " (CURRENT)" : "";
54223
54361
  const date = new Date(version.createdDate).toLocaleDateString();
@@ -54228,8 +54366,17 @@ function sortVersionsByDate(versions) {
54228
54366
  return versions.sort((a, b) => new Date(b.createdDate).getTime() - new Date(a.createdDate).getTime());
54229
54367
  }
54230
54368
  __name(sortVersionsByDate, "sortVersionsByDate");
54369
+ function assertDeployInputsForCi(options, ci = isCiModeEnabled()) {
54370
+ if (!ci) return;
54371
+ const hints = [];
54372
+ if (!options.version) hints.push("Pass --set-version <version|latest>");
54373
+ if (!options.force) hints.push("Pass --force: --ci never auto-confirms a deploy to all users");
54374
+ if (hints.length === 0) return;
54375
+ throw CliError.usage("lua deploy cannot prompt under --ci.", hints.join("\n"));
54376
+ }
54377
+ __name(assertDeployInputsForCi, "assertDeployInputsForCi");
54231
54378
  async function promptVersionSelection(versions) {
54232
- const { selectedVersion } = await inquirer8.prompt([
54379
+ const { selectedVersion } = await safePrompt([
54233
54380
  {
54234
54381
  type: "list",
54235
54382
  name: "selectedVersion",
@@ -54245,7 +54392,7 @@ async function promptVersionSelection(versions) {
54245
54392
  }
54246
54393
  __name(promptVersionSelection, "promptVersionSelection");
54247
54394
  async function confirmDeployment() {
54248
- const { confirmed } = await inquirer8.prompt([
54395
+ const { confirmed } = await safePrompt([
54249
54396
  {
54250
54397
  type: "confirm",
54251
54398
  name: "confirmed",
@@ -54452,6 +54599,7 @@ async function deployCommand(type, cmdObj) {
54452
54599
  }
54453
54600
  selectedType = answer.type;
54454
54601
  }
54602
+ assertDeployInputsForCi(options);
54455
54603
  const apiKey = await requireAuthOrExit();
54456
54604
  let personaDeployed = false;
54457
54605
  let versionedOutcome = null;
@@ -54875,7 +55023,7 @@ __name(deployAllCommand, "deployAllCommand");
54875
55023
  // src/commands/chat.ts
54876
55024
  init_cli();
54877
55025
  import * as readline from "readline";
54878
- import inquirer9 from "inquirer";
55026
+ import inquirer6 from "inquirer";
54879
55027
 
54880
55028
  // src/api/chat.api.service.ts
54881
55029
  init_http_client();
@@ -55976,7 +56124,7 @@ async function chatCommand(cmdObj) {
55976
56124
  selectedEnvironment = envResolution.environment;
55977
56125
  break;
55978
56126
  case "prompt": {
55979
- const { environment } = await inquirer9.prompt([
56127
+ const { environment } = await inquirer6.prompt([
55980
56128
  {
55981
56129
  type: "list",
55982
56130
  name: "environment",
@@ -56555,7 +56703,7 @@ init_command_utils();
56555
56703
  init_developer_api_service();
56556
56704
  import fs19 from "fs";
56557
56705
  import path27 from "path";
56558
- import inquirer10 from "inquirer";
56706
+ import inquirer7 from "inquirer";
56559
56707
  init_analytics();
56560
56708
  init_cli_error();
56561
56709
  function resolveEnvironment(env, hasNonInteractiveFlags) {
@@ -56652,7 +56800,7 @@ async function envCommand(env, cmdObj) {
56652
56800
  selectedEnvironment = envResolution.environment;
56653
56801
  break;
56654
56802
  case "prompt":
56655
- const { environment } = await inquirer10.prompt([
56803
+ const { environment } = await inquirer7.prompt([
56656
56804
  {
56657
56805
  type: "list",
56658
56806
  name: "environment",
@@ -56842,7 +56990,7 @@ async function manageEnvironmentVariables(context) {
56842
56990
  const variables = await loadEnvironmentVariables(context);
56843
56991
  console.log("\n" + "=".repeat(60));
56844
56992
  displayVariables(variables, context, true);
56845
- const { action } = await inquirer10.prompt([
56993
+ const { action } = await inquirer7.prompt([
56846
56994
  {
56847
56995
  type: "list",
56848
56996
  name: "action",
@@ -56937,7 +57085,7 @@ async function saveProductionEnvVariables(context, variables) {
56937
57085
  }
56938
57086
  __name(saveProductionEnvVariables, "saveProductionEnvVariables");
56939
57087
  async function addVariable(context, currentVariables) {
56940
- const answers = await inquirer10.prompt([
57088
+ const answers = await inquirer7.prompt([
56941
57089
  {
56942
57090
  type: "input",
56943
57091
  name: "key",
@@ -56978,7 +57126,7 @@ async function updateVariable(context, currentVariables) {
56978
57126
  console.log("\n\u2139\uFE0F No variables to update.\n");
56979
57127
  return;
56980
57128
  }
56981
- const { selectedKey } = await inquirer10.prompt([
57129
+ const { selectedKey } = await inquirer7.prompt([
56982
57130
  {
56983
57131
  type: "list",
56984
57132
  name: "selectedKey",
@@ -56990,7 +57138,7 @@ async function updateVariable(context, currentVariables) {
56990
57138
  }
56991
57139
  ]);
56992
57140
  const currentVariable = currentVariables.find((v) => v.key === selectedKey);
56993
- const { newValue } = await inquirer10.prompt([
57141
+ const { newValue } = await inquirer7.prompt([
56994
57142
  {
56995
57143
  type: "input",
56996
57144
  name: "newValue",
@@ -57019,7 +57167,7 @@ async function deleteVariable(context, currentVariables) {
57019
57167
  console.log("\n\u2139\uFE0F No variables to delete.\n");
57020
57168
  return;
57021
57169
  }
57022
- const { selectedKey } = await inquirer10.prompt([
57170
+ const { selectedKey } = await inquirer7.prompt([
57023
57171
  {
57024
57172
  type: "list",
57025
57173
  name: "selectedKey",
@@ -57030,7 +57178,7 @@ async function deleteVariable(context, currentVariables) {
57030
57178
  }))
57031
57179
  }
57032
57180
  ]);
57033
- const { confirm } = await inquirer10.prompt([
57181
+ const { confirm } = await inquirer7.prompt([
57034
57182
  {
57035
57183
  type: "confirm",
57036
57184
  name: "confirm",
@@ -57063,7 +57211,7 @@ async function viewVariable(currentVariables) {
57063
57211
  console.log("\n\u2139\uFE0F No variables to view.\n");
57064
57212
  return;
57065
57213
  }
57066
- const { selectedKey } = await inquirer10.prompt([
57214
+ const { selectedKey } = await inquirer7.prompt([
57067
57215
  {
57068
57216
  type: "list",
57069
57217
  name: "selectedKey",
@@ -57080,7 +57228,7 @@ async function viewVariable(currentVariables) {
57080
57228
  console.log("=".repeat(60));
57081
57229
  console.log(variable.value);
57082
57230
  console.log("=".repeat(60) + "\n");
57083
- await inquirer10.prompt([
57231
+ await inquirer7.prompt([
57084
57232
  {
57085
57233
  type: "input",
57086
57234
  name: "continue",
@@ -57094,7 +57242,6 @@ __name(viewVariable, "viewVariable");
57094
57242
  init_dist();
57095
57243
  init_cli();
57096
57244
  init_constants();
57097
- import inquirer11 from "inquirer";
57098
57245
  init_command_utils();
57099
57246
  init_compiler2();
57100
57247
  init_artifact_loader();
@@ -57396,7 +57543,7 @@ async function viewPersonaInteractive(persona) {
57396
57543
  console.log("No persona configured.");
57397
57544
  }
57398
57545
  console.log("=".repeat(60) + "\n");
57399
- await inquirer11.prompt([
57546
+ await safePrompt([
57400
57547
  {
57401
57548
  type: "input",
57402
57549
  name: "continue",
@@ -57520,7 +57667,7 @@ async function viewVersionDetailsInteractive(version) {
57520
57667
  console.log("=".repeat(60) + "\n");
57521
57668
  console.log(version.persona);
57522
57669
  console.log("\n" + "=".repeat(60) + "\n");
57523
- await inquirer11.prompt([
57670
+ await safePrompt([
57524
57671
  {
57525
57672
  type: "input",
57526
57673
  name: "continue",
@@ -59077,7 +59224,7 @@ async function docsCommand() {
59077
59224
  __name(docsCommand, "docsCommand");
59078
59225
 
59079
59226
  // src/commands/channels.ts
59080
- import inquirer12 from "inquirer";
59227
+ import inquirer8 from "inquirer";
59081
59228
  import open5 from "open";
59082
59229
  init_cli();
59083
59230
  init_command_utils();
@@ -59590,7 +59737,7 @@ async function executeNonInteractive3(agentApi, agentId, action) {
59590
59737
  }
59591
59738
  __name(executeNonInteractive3, "executeNonInteractive");
59592
59739
  async function channelsInteractive(agentApi, agentId, apiKey, config) {
59593
- const { operation } = await inquirer12.prompt([
59740
+ const { operation } = await inquirer8.prompt([
59594
59741
  {
59595
59742
  type: "list",
59596
59743
  name: "operation",
@@ -59676,7 +59823,7 @@ async function listChannelsInteractive(agentApi, agentId, config) {
59676
59823
  name: "\u2190 Back to main menu",
59677
59824
  value: -1
59678
59825
  });
59679
- const { selectedIndex } = await inquirer12.prompt([
59826
+ const { selectedIndex } = await inquirer8.prompt([
59680
59827
  {
59681
59828
  type: "list",
59682
59829
  name: "selectedIndex",
@@ -59853,7 +60000,7 @@ function displayEmailDetails(channel) {
59853
60000
  }
59854
60001
  __name(displayEmailDetails, "displayEmailDetails");
59855
60002
  async function createChannel(agentApi, agentId) {
59856
- const { channelType } = await inquirer12.prompt([
60003
+ const { channelType } = await inquirer8.prompt([
59857
60004
  {
59858
60005
  type: "list",
59859
60006
  name: "channelType",
@@ -59907,7 +60054,7 @@ async function createChannel(agentApi, agentId) {
59907
60054
  __name(createChannel, "createChannel");
59908
60055
  async function createWhatsAppChannel(agentApi, agentId) {
59909
60056
  writeInfo("\u{1F4F1} Creating WhatsApp Channel\n");
59910
- const answers = await inquirer12.prompt([
60057
+ const answers = await inquirer8.prompt([
59911
60058
  {
59912
60059
  type: "input",
59913
60060
  name: "phoneNumberId",
@@ -59959,7 +60106,7 @@ async function createWhatsAppChannel(agentApi, agentId) {
59959
60106
  __name(createWhatsAppChannel, "createWhatsAppChannel");
59960
60107
  async function createFacebookChannel(agentApi, agentId) {
59961
60108
  writeInfo("\u{1F4AC} Creating Facebook Messenger Channel\n");
59962
- const answers = await inquirer12.prompt([
60109
+ const answers = await inquirer8.prompt([
59963
60110
  {
59964
60111
  type: "password",
59965
60112
  name: "accessToken",
@@ -60001,7 +60148,7 @@ async function createFacebookChannel(agentApi, agentId) {
60001
60148
  __name(createFacebookChannel, "createFacebookChannel");
60002
60149
  async function createEmailChannel(agentApi, agentId) {
60003
60150
  writeInfo("\u{1F4E7} Creating Email Channel\n");
60004
- const { mode } = await inquirer12.prompt([
60151
+ const { mode } = await inquirer8.prompt([
60005
60152
  {
60006
60153
  type: "list",
60007
60154
  name: "mode",
@@ -60019,7 +60166,7 @@ async function createEmailChannel(agentApi, agentId) {
60019
60166
  }
60020
60167
  ]);
60021
60168
  clearPromptLines(2);
60022
- const { displayName } = await inquirer12.prompt([
60169
+ const { displayName } = await inquirer8.prompt([
60023
60170
  {
60024
60171
  type: "input",
60025
60172
  name: "displayName",
@@ -60037,7 +60184,7 @@ async function createEmailChannel(agentApi, agentId) {
60037
60184
  }
60038
60185
  };
60039
60186
  if (mode === "existing") {
60040
- const { email } = await inquirer12.prompt([
60187
+ const { email } = await inquirer8.prompt([
60041
60188
  {
60042
60189
  type: "input",
60043
60190
  name: "email",
@@ -60133,7 +60280,7 @@ var SLACK_AGENT_PROMPTS_MAX = 4;
60133
60280
  var SLACK_AGENT_PROMPT_TITLE_MAX = 75;
60134
60281
  var SLACK_AGENT_PROMPT_MESSAGE_MAX = 2e3;
60135
60282
  async function promptSlackAgentMode(current) {
60136
- const { enabled } = await inquirer12.prompt([
60283
+ const { enabled } = await inquirer8.prompt([
60137
60284
  {
60138
60285
  type: "confirm",
60139
60286
  name: "enabled",
@@ -60142,7 +60289,7 @@ async function promptSlackAgentMode(current) {
60142
60289
  }
60143
60290
  ]);
60144
60291
  if (!enabled) return null;
60145
- const { description } = await inquirer12.prompt([
60292
+ const { description } = await inquirer8.prompt([
60146
60293
  {
60147
60294
  type: "input",
60148
60295
  name: "description",
@@ -60159,7 +60306,7 @@ async function promptSlackAgentMode(current) {
60159
60306
  }
60160
60307
  const prompts = [];
60161
60308
  while (prompts.length < SLACK_AGENT_PROMPTS_MAX) {
60162
- const { title } = await inquirer12.prompt([
60309
+ const { title } = await inquirer8.prompt([
60163
60310
  {
60164
60311
  type: "input",
60165
60312
  name: "title",
@@ -60168,7 +60315,7 @@ async function promptSlackAgentMode(current) {
60168
60315
  }
60169
60316
  ]);
60170
60317
  if (!title.trim()) break;
60171
- const { message } = await inquirer12.prompt([
60318
+ const { message } = await inquirer8.prompt([
60172
60319
  {
60173
60320
  type: "input",
60174
60321
  name: "message",
@@ -60191,7 +60338,7 @@ async function promptSlackAgentMode(current) {
60191
60338
  }
60192
60339
  __name(promptSlackAgentMode, "promptSlackAgentMode");
60193
60340
  async function offerToOpen(url, question) {
60194
- const { openIt } = await inquirer12.prompt([
60341
+ const { openIt } = await inquirer8.prompt([
60195
60342
  {
60196
60343
  type: "confirm",
60197
60344
  name: "openIt",
@@ -60203,7 +60350,7 @@ async function offerToOpen(url, question) {
60203
60350
  }
60204
60351
  __name(offerToOpen, "offerToOpen");
60205
60352
  async function startSlackApp(agentApi, agentId, kind) {
60206
- const { source } = await inquirer12.prompt([
60353
+ const { source } = await inquirer8.prompt([
60207
60354
  {
60208
60355
  type: "list",
60209
60356
  name: "source",
@@ -60263,7 +60410,7 @@ __name(printManifestUpdate, "printManifestUpdate");
60263
60410
  async function createSlackPrivateChannel(agentApi, agentId) {
60264
60411
  writeInfo("\u{1F512} Creating Private Slack Channel\n");
60265
60412
  const { existingApp, agentMode } = await startSlackApp(agentApi, agentId, "private");
60266
- const answers = await inquirer12.prompt([
60413
+ const answers = await inquirer8.prompt([
60267
60414
  {
60268
60415
  type: "password",
60269
60416
  name: "accessToken",
@@ -60308,7 +60455,7 @@ __name(createSlackPrivateChannel, "createSlackPrivateChannel");
60308
60455
  async function createSlackPublicChannel(agentApi, agentId) {
60309
60456
  writeInfo("\u{1F310} Creating Public Slack Channel\n");
60310
60457
  const { existingApp, agentMode } = await startSlackApp(agentApi, agentId, "public");
60311
- const answers = await inquirer12.prompt([
60458
+ const answers = await inquirer8.prompt([
60312
60459
  {
60313
60460
  type: "input",
60314
60461
  name: "appId",
@@ -60392,7 +60539,7 @@ async function slackConnectionActions(agentApi, agentId, channel) {
60392
60539
  name: "\u2190 Back",
60393
60540
  value: "back"
60394
60541
  });
60395
- const { action } = await inquirer12.prompt([
60542
+ const { action } = await inquirer8.prompt([
60396
60543
  {
60397
60544
  type: "list",
60398
60545
  name: "action",
@@ -60424,7 +60571,7 @@ async function slackConnectionActions(agentApi, agentId, channel) {
60424
60571
  writeSuccess(`\u2705 Agent mode ${agentMode ? "saved" : "turned off"}. It takes effect once Slack has the new manifest:`);
60425
60572
  printManifestUpdate(response.data.manifestUrl ?? slackManifestEditorUrl(channel.data.appId, channel.data.teamId), response.data.manifest);
60426
60573
  } else if (action === "secret") {
60427
- const { signingSecret } = await inquirer12.prompt([
60574
+ const { signingSecret } = await inquirer8.prompt([
60428
60575
  slackSigningSecretPrompt()
60429
60576
  ]);
60430
60577
  const response = await agentApi.saveSlackSigningSecret(agentId, channel.identifier, signingSecret.trim());
@@ -60461,7 +60608,7 @@ __name(slackConnectionActions, "slackConnectionActions");
60461
60608
  // src/commands/logs.ts
60462
60609
  init_cli();
60463
60610
  init_command_utils();
60464
- import inquirer13 from "inquirer";
60611
+ import inquirer9 from "inquirer";
60465
60612
  import chalk2 from "chalk";
60466
60613
  init_device_api_service();
60467
60614
  init_constants();
@@ -60961,7 +61108,7 @@ async function nonInteractiveLogs(logsApi, agentId, apiKey, options) {
60961
61108
  }
60962
61109
  __name(nonInteractiveLogs, "nonInteractiveLogs");
60963
61110
  async function interactiveLogs(logsApi, agentId, apiKey) {
60964
- const { viewType } = await inquirer13.prompt([
61111
+ const { viewType } = await inquirer9.prompt([
60965
61112
  {
60966
61113
  type: "list",
60967
61114
  name: "viewType",
@@ -60989,7 +61136,7 @@ __name(interactiveLogs, "interactiveLogs");
60989
61136
  async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
60990
61137
  let keepFiltering = true;
60991
61138
  while (keepFiltering) {
60992
- const { filterType } = await inquirer13.prompt([
61139
+ const { filterType } = await inquirer9.prompt([
60993
61140
  {
60994
61141
  type: "list",
60995
61142
  name: "filterType",
@@ -60999,7 +61146,7 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
60999
61146
  name: "\u{1F4CB} All logs",
61000
61147
  value: "all"
61001
61148
  },
61002
- new inquirer13.Separator(),
61149
+ new inquirer9.Separator(),
61003
61150
  {
61004
61151
  name: "Skills",
61005
61152
  value: "skill"
@@ -61024,7 +61171,7 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61024
61171
  name: "Devices",
61025
61172
  value: "device"
61026
61173
  },
61027
- new inquirer13.Separator(),
61174
+ new inquirer9.Separator(),
61028
61175
  {
61029
61176
  name: "\u{1F4AC} User Messages",
61030
61177
  value: "user_message"
@@ -61057,12 +61204,12 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61057
61204
  name: "\u{1F4DE} Voice Calls",
61058
61205
  value: "calls"
61059
61206
  },
61060
- new inquirer13.Separator(),
61207
+ new inquirer9.Separator(),
61061
61208
  {
61062
61209
  name: "\u2190 Back",
61063
61210
  value: "back"
61064
61211
  },
61065
- new inquirer13.Separator()
61212
+ new inquirer9.Separator()
61066
61213
  ]
61067
61214
  }
61068
61215
  ]);
@@ -61095,7 +61242,7 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61095
61242
  `);
61096
61243
  continue;
61097
61244
  }
61098
- const { selectedId } = await inquirer13.prompt([
61245
+ const { selectedId } = await inquirer9.prompt([
61099
61246
  {
61100
61247
  type: "list",
61101
61248
  name: "selectedId",
@@ -61105,17 +61252,17 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61105
61252
  name: `All ${capitalizedType}s`,
61106
61253
  value: "all"
61107
61254
  },
61108
- new inquirer13.Separator(),
61255
+ new inquirer9.Separator(),
61109
61256
  ...items.map((item) => ({
61110
61257
  name: item.name,
61111
61258
  value: item.id
61112
61259
  })),
61113
- new inquirer13.Separator(),
61260
+ new inquirer9.Separator(),
61114
61261
  {
61115
61262
  name: "\u2190 Back",
61116
61263
  value: "back"
61117
61264
  },
61118
- new inquirer13.Separator()
61265
+ new inquirer9.Separator()
61119
61266
  ]
61120
61267
  }
61121
61268
  ]);
@@ -61144,7 +61291,7 @@ async function viewAgentLogsInteractive(logsApi, agentId, filters = {}) {
61144
61291
  }
61145
61292
  const data = response.data;
61146
61293
  displayLogsCore(data.logs, data.pagination, "All Agent Logs", true);
61147
- const { action } = await inquirer13.prompt([
61294
+ const { action } = await inquirer9.prompt([
61148
61295
  {
61149
61296
  type: "list",
61150
61297
  name: "action",
@@ -61199,7 +61346,7 @@ async function handleNavigation(action, pagination, setPage) {
61199
61346
  if (pagination.hasNextPage) setPage(pagination.nextPage);
61200
61347
  return true;
61201
61348
  case "goto":
61202
- const { page } = await inquirer13.prompt({
61349
+ const { page } = await inquirer9.prompt({
61203
61350
  type: "number",
61204
61351
  name: "page",
61205
61352
  message: `Enter page number (1-${pagination.totalPages}):`,
@@ -68829,6 +68976,21 @@ function priorAttemptTail(a) {
68829
68976
  return `${parts.length ? ` \u2014 ${parts.join(" \xB7 ")}` : ""}${e?.providerMessage ? ` \u2014 ${e.providerMessage}` : ""}`;
68830
68977
  }
68831
68978
  __name(priorAttemptTail, "priorAttemptTail");
68979
+ function budgetTokensParts(b) {
68980
+ const n2 = /* @__PURE__ */ __name((v) => v.toLocaleString("en-US"), "n");
68981
+ const split = [
68982
+ typeof b.uncachedInputTokens === "number" ? `${n2(b.uncachedInputTokens)} uncached` : void 0,
68983
+ typeof b.cachedInputTokens === "number" ? `${n2(b.cachedInputTokens)} cached` : void 0
68984
+ ].filter((p) => !!p);
68985
+ const input = `${n2(b.inputTokens)}${b.maxInputTokens !== void 0 ? ` of ${n2(b.maxInputTokens)}` : ""} input tokens${split.length ? ` (${split.join(" / ")})` : ""}`;
68986
+ return typeof b.outputTokens === "number" ? [
68987
+ input,
68988
+ `${n2(b.outputTokens)} output tokens`
68989
+ ] : [
68990
+ input
68991
+ ];
68992
+ }
68993
+ __name(budgetTokensParts, "budgetTokensParts");
68832
68994
  function stepFailureLine(e) {
68833
68995
  if (!e || !e.reason && e.providerStatus === void 0 && !e.providerMessage) return void 0;
68834
68996
  const b = e.budget;
@@ -68837,7 +68999,7 @@ function stepFailureLine(e) {
68837
68999
  e.providerStatus !== void 0 ? `HTTP ${e.providerStatus}` : void 0,
68838
69000
  e.model ? `model ${e.model}` : void 0,
68839
69001
  e.turnIndex !== void 0 ? `message ${e.turnIndex}${e.assistantTurns !== void 0 ? ` (${e.assistantTurns} replies)` : ""}${b?.maxMessages !== void 0 ? ` of ${b.maxMessages}` : ""}` : void 0,
68840
- b ? `${b.inputTokens.toLocaleString("en-US")}${b.maxInputTokens !== void 0 ? ` of ${b.maxInputTokens.toLocaleString("en-US")}` : ""} input tokens` : void 0,
69002
+ ...b ? budgetTokensParts(b) : [],
68841
69003
  e.providerRetries ? `${e.providerRetries} provider ${e.providerRetries === 1 ? "retry" : "retries"}` : void 0
68842
69004
  ].filter((p) => !!p);
68843
69005
  return `${parts.join(" \xB7 ")}${e.providerMessage ? `${parts.length ? " \u2014 " : ""}${e.providerMessage}` : ""}`;
@@ -68850,7 +69012,7 @@ function attemptCountersLine(c) {
68850
69012
  const replies = c.assistantTurns ?? b?.assistantTurns;
68851
69013
  const parts = [
68852
69014
  messages !== void 0 ? `message ${messages}${replies !== void 0 ? ` (${replies} replies)` : ""}${b?.maxMessages !== void 0 ? ` of ${b.maxMessages}` : ""}` : void 0,
68853
- b ? `${b.inputTokens.toLocaleString("en-US")}${b.maxInputTokens !== void 0 ? ` of ${b.maxInputTokens.toLocaleString("en-US")}` : ""} input tokens` : void 0,
69015
+ ...b ? budgetTokensParts(b) : [],
68854
69016
  c.repairRounds ? `${c.repairRounds} repair ${c.repairRounds === 1 ? "round" : "rounds"}` : void 0,
68855
69017
  c.providerRetries ? `${c.providerRetries} provider ${c.providerRetries === 1 ? "retry" : "retries"}` : void 0
68856
69018
  ].filter((p) => !!p);
@@ -71793,12 +71955,13 @@ async function recomposeCore(ctx, name, _o) {
71793
71955
  return WORKFLOW_EXIT.OK;
71794
71956
  }
71795
71957
  const saved = d.composed?.saved;
71796
- const version = saved?.version ?? saved?.versionId ?? "(new)";
71958
+ const savedVersion = saved?.version ?? saved?.versionId;
71959
+ const version = savedVersion ?? "(new)";
71797
71960
  writeSuccess(`\u2705 ${wf.name} recomposed \u2192 version ${version} \xB7 ${rewrittenCount} agent step${rewrittenCount === 1 ? "" : "s"} rewritten`);
71798
71961
  if (saved?.supersededBy) {
71799
71962
  writeInfo(`\u2139\uFE0F a concurrent recompose already holds the pin at version ${saved.supersededBy} \u2014 that is what runs.`);
71800
71963
  }
71801
- for (const line of recomposeNextSteps(wf, version)) console.log(line);
71964
+ for (const line of recomposeNextSteps(wf, savedVersion)) console.log(line);
71802
71965
  return WORKFLOW_EXIT.OK;
71803
71966
  }
71804
71967
  __name(recomposeCore, "recomposeCore");
@@ -73606,7 +73769,7 @@ init_skills_api_service();
73606
73769
  init_developer_api_service();
73607
73770
  init_semver();
73608
73771
  init_analytics();
73609
- import inquirer14 from "inquirer";
73772
+ import inquirer10 from "inquirer";
73610
73773
 
73611
73774
  // src/commands/template.ts
73612
73775
  init_cli();
@@ -73734,6 +73897,54 @@ init_command_utils();
73734
73897
  init_analytics();
73735
73898
  init_files();
73736
73899
  init_cli_error();
73900
+
73901
+ // src/commands/template-install-flags.ts
73902
+ init_cli_error();
73903
+ var PERSONA_HINT = "Use --persona-vars NAME=value[,NAME=value...] (repeatable)";
73904
+ var ACCEPT_HINT = "e.g. skills/refund-skill (the primitives named in the 409 MODIFIED_SINCE_INSTALL response)";
73905
+ function parsePersonaVars(raw) {
73906
+ if (!raw || raw.length === 0) return void 0;
73907
+ const result = {};
73908
+ for (const entry of raw) {
73909
+ for (const pair of entry.split(/,(?=\s*[A-Za-z_][A-Za-z0-9_]*\s*=)/)) {
73910
+ const trimmed2 = pair.trim();
73911
+ if (!trimmed2) continue;
73912
+ const eqIdx = trimmed2.indexOf("=");
73913
+ if (eqIdx === -1) {
73914
+ throw CliError.usage(`Invalid --persona-vars entry "${trimmed2}": expected KEY=value`, PERSONA_HINT);
73915
+ }
73916
+ const key = trimmed2.slice(0, eqIdx).trim();
73917
+ if (!key) {
73918
+ throw CliError.usage(`Invalid --persona-vars entry "${trimmed2}": the variable name is empty`, PERSONA_HINT);
73919
+ }
73920
+ if (Object.prototype.hasOwnProperty.call(result, key)) {
73921
+ throw CliError.usage(`Duplicate --persona-vars key "${key}"`, PERSONA_HINT);
73922
+ }
73923
+ result[key] = trimmed2.slice(eqIdx + 1).trim();
73924
+ }
73925
+ }
73926
+ return Object.keys(result).length > 0 ? result : void 0;
73927
+ }
73928
+ __name(parsePersonaVars, "parsePersonaVars");
73929
+ function parseAcceptModified(raw) {
73930
+ if (!raw || raw.length === 0) return void 0;
73931
+ const result = [];
73932
+ for (const entry of raw) {
73933
+ for (const part of entry.split(",")) {
73934
+ const trimmed2 = part.trim();
73935
+ if (!trimmed2) continue;
73936
+ const slash = trimmed2.indexOf("/");
73937
+ if (slash <= 0 || slash === trimmed2.length - 1) {
73938
+ throw CliError.usage(`Invalid --accept-modified entry "${trimmed2}": expected kind/key`, ACCEPT_HINT);
73939
+ }
73940
+ if (!result.includes(trimmed2)) result.push(trimmed2);
73941
+ }
73942
+ }
73943
+ return result.length > 0 ? result : void 0;
73944
+ }
73945
+ __name(parseAcceptModified, "parseAcceptModified");
73946
+
73947
+ // src/commands/template.ts
73737
73948
  function showTemplateUsage() {
73738
73949
  console.log("\nUsage:");
73739
73950
  console.log(" lua marketplace template Interactive mode");
@@ -73744,7 +73955,7 @@ function showTemplateUsage() {
73744
73955
  console.log(" publish --template-id <id> [--source-version <n>] [--changelog <text>] [--env-contract KEY=desc,...] [--skip-auto-apply]");
73745
73956
  console.log(" view --template-id <id> [--version <n>] [--json]");
73746
73957
  console.log(" versions --template-id <id> [--json]");
73747
- console.log(" install --template-id <id> [--version <n>] [--env-vars k=v,...] --force");
73958
+ console.log(" install --template-id <id> [--version <n>] [--env-vars k=v,...] [--persona-vars K=v,...] [--accept-modified kind/key,...] --force");
73748
73959
  console.log(" apply --template-id <id> [--version <n>] (--agents a,b | --file <path> | --all-installed) --force [--no-wait]");
73749
73960
  console.log(" status --template-id <id> [--json]");
73750
73961
  console.log(" health --template-id <id> [--window-days <n>] [--json] Fleet workflow health per install (R46)");
@@ -74360,6 +74571,8 @@ async function templateInstallAction(templateApi, config, options) {
74360
74571
  const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to install?", false);
74361
74572
  const version = options.version ? Number.parseInt(options.version, 10) : void 0;
74362
74573
  const envValues = options.envVars ? parseKeyValuePairs(options.envVars) : void 0;
74574
+ const personaVars = parsePersonaVars(options.personaVars);
74575
+ const acceptModifiedPrimitives = parseAcceptModified(options.acceptModified);
74363
74576
  if (!options.force) {
74364
74577
  writeInfo("\n\u{1F4CB} Install Summary:");
74365
74578
  writeInfo(` Template: ${templateId}`);
@@ -74368,6 +74581,12 @@ async function templateInstallAction(templateApi, config, options) {
74368
74581
  if (envValues && Object.keys(envValues).length > 0) {
74369
74582
  writeInfo(` Env values: ${Object.keys(envValues).length} configured`);
74370
74583
  }
74584
+ if (personaVars) {
74585
+ writeInfo(` Persona vars: ${Object.keys(personaVars).length} configured`);
74586
+ }
74587
+ if (acceptModifiedPrimitives) {
74588
+ writeInfo(` Accepting modified: ${acceptModifiedPrimitives.join(", ")}`);
74589
+ }
74371
74590
  throw CliError.usage("This action requires --force to confirm", "Use --force to confirm installation");
74372
74591
  }
74373
74592
  if (options.skipEnvCheck) {
@@ -74377,7 +74596,9 @@ async function templateInstallAction(templateApi, config, options) {
74377
74596
  const install = await templateApi.install(templateId, agentId, {
74378
74597
  version,
74379
74598
  envValues,
74380
- allowCreatorUpdates: options.allowCreatorUpdates
74599
+ allowCreatorUpdates: options.allowCreatorUpdates,
74600
+ personaVars,
74601
+ acceptModifiedPrimitives
74381
74602
  });
74382
74603
  if (options.json) {
74383
74604
  console.log(JSON.stringify(install, null, 2));
@@ -75059,12 +75280,12 @@ __name(transferOwnershipNonInteractive, "transferOwnershipNonInteractive");
75059
75280
  async function viewListedSkillsNonInteractive(marketplaceApi, options, mode) {
75060
75281
  writeProgress(mode === "authored" ? "\u{1F504} Loading skills you authored..." : "\u{1F504} Loading this organization's skills...");
75061
75282
  const skills = mode === "authored" ? await marketplaceApi.getCreatorSkills() : await marketplaceApi.getOrgSkills();
75062
- if (!skills || skills.length === 0) {
75063
- writeInfo(mode === "authored" ? "\u{1F4E6} You haven't authored any marketplace skills yet." : "\u{1F4E6} This organization doesn't own any marketplace skills yet.");
75283
+ if (options.json) {
75284
+ console.log(JSON.stringify(skills ?? [], null, 2));
75064
75285
  return;
75065
75286
  }
75066
- if (options.json) {
75067
- console.log(JSON.stringify(skills, null, 2));
75287
+ if (!skills || skills.length === 0) {
75288
+ writeInfo(mode === "authored" ? "\u{1F4E6} You haven't authored any marketplace skills yet." : "\u{1F4E6} This organization doesn't own any marketplace skills yet.");
75068
75289
  return;
75069
75290
  }
75070
75291
  console.log(mode === "authored" ? `
@@ -75293,12 +75514,12 @@ async function listInstalledSkillsNonInteractive(marketplaceApi, config, options
75293
75514
  }
75294
75515
  writeProgress("\u{1F504} Loading installed marketplace skills...");
75295
75516
  const skills = await marketplaceApi.getInstalledSkills(agentId);
75296
- if (!skills || skills.length === 0) {
75297
- writeInfo("\u{1F4E6} No marketplace skills installed on this agent.");
75517
+ if (options.json) {
75518
+ console.log(JSON.stringify(skills ?? [], null, 2));
75298
75519
  return;
75299
75520
  }
75300
- if (options.json) {
75301
- console.log(JSON.stringify(skills, null, 2));
75521
+ if (!skills || skills.length === 0) {
75522
+ writeInfo("\u{1F4E6} No marketplace skills installed on this agent.");
75302
75523
  return;
75303
75524
  }
75304
75525
  console.log(`
@@ -75901,7 +76122,7 @@ async function handleEnvVarConfiguration(initialEnvVars) {
75901
76122
  name: "Delete a variable",
75902
76123
  value: "delete"
75903
76124
  },
75904
- new inquirer14.Separator(),
76125
+ new inquirer10.Separator(),
75905
76126
  {
75906
76127
  name: "Finish and continue",
75907
76128
  value: "done"
@@ -75938,7 +76159,7 @@ async function handleEnvVarAction(action, envVars, detectedKeys) {
75938
76159
  name: `From .env file: ${key}`,
75939
76160
  value: key
75940
76161
  })),
75941
- new inquirer14.Separator(),
76162
+ new inquirer10.Separator(),
75942
76163
  {
75943
76164
  name: "Manually enter a variable name",
75944
76165
  value: "manual"
@@ -75983,7 +76204,7 @@ async function handleEnvVarAction(action, envVars, detectedKeys) {
75983
76204
  message: "Which variable do you want to edit?",
75984
76205
  choices: [
75985
76206
  ...keys,
75986
- new inquirer14.Separator(),
76207
+ new inquirer10.Separator(),
75987
76208
  {
75988
76209
  name: "Back",
75989
76210
  value: "back"
@@ -76005,7 +76226,7 @@ async function handleEnvVarAction(action, envVars, detectedKeys) {
76005
76226
  message: "Which variable do you want to delete?",
76006
76227
  choices: [
76007
76228
  ...keys,
76008
- new inquirer14.Separator(),
76229
+ new inquirer10.Separator(),
76009
76230
  {
76010
76231
  name: "Back",
76011
76232
  value: "back"
@@ -76108,7 +76329,7 @@ async function browseAndSelectSkill(marketplaceApi, purpose, publishedVersionsOn
76108
76329
  }))
76109
76330
  ];
76110
76331
  if (hasNextPage || hasPrevPage) {
76111
- choices.push(new inquirer14.Separator());
76332
+ choices.push(new inquirer10.Separator());
76112
76333
  if (hasPrevPage) {
76113
76334
  choices.push({
76114
76335
  name: `\u2190 Previous page (${currentPage - 1}/${totalPages})`,
@@ -76126,7 +76347,7 @@ async function browseAndSelectSkill(marketplaceApi, purpose, publishedVersionsOn
76126
76347
  });
76127
76348
  }
76128
76349
  }
76129
- choices.push(new inquirer14.Separator());
76350
+ choices.push(new inquirer10.Separator());
76130
76351
  choices.push({
76131
76352
  name: "\u2190 Back to menu",
76132
76353
  value: {
@@ -77476,6 +77697,11 @@ var CALLBACK_PORT = 19837;
77476
77697
  var CALLBACK_HOST = "127.0.0.1";
77477
77698
  var CALLBACK_URL = `http://${CALLBACK_HOST}:${CALLBACK_PORT}/callback`;
77478
77699
  var AGENT_WEBHOOK_URL = `${BASE_URLS.API}/webhook/unifiedto/data`;
77700
+ var DEFAULT_HIDE_SENSITIVE = false;
77701
+ function coerceHideSensitive(raw) {
77702
+ return raw === "true";
77703
+ }
77704
+ __name(coerceHideSensitive, "coerceHideSensitive");
77479
77705
  var DEFAULT_VIRTUAL_WEBHOOK_INTERVAL = 1;
77480
77706
  var VIRTUAL_WEBHOOK_INTERVAL_CHOICES = [
77481
77707
  {
@@ -77702,7 +77928,7 @@ async function executeNonInteractive12(context, action, cmdOptions) {
77702
77928
  connectionId: cmdOptions?.connectionId,
77703
77929
  authMethod: cmdOptions?.authMethod,
77704
77930
  scopes: cmdOptions?.scopes,
77705
- hideSensitive: cmdOptions?.hideSensitive === "true",
77931
+ hideSensitive: coerceHideSensitive(cmdOptions?.hideSensitive),
77706
77932
  hideSensitiveProvided: cmdOptions?.hideSensitive !== void 0,
77707
77933
  accountLabel: cmdOptions?.accountLabel,
77708
77934
  scope: cmdOptions?.scope,
@@ -78308,7 +78534,7 @@ async function connectIntegrationFlow(context, options = {}) {
78308
78534
  });
78309
78535
  console.log("\nYou will enter these on the Unified.to authorization page.\n");
78310
78536
  }
78311
- let hideSensitive = false;
78537
+ let hideSensitive = DEFAULT_HIDE_SENSITIVE;
78312
78538
  if (userScope) {
78313
78539
  } else if (options.hideSensitive !== void 0) {
78314
78540
  hideSensitive = options.hideSensitive;
@@ -78318,7 +78544,7 @@ async function connectIntegrationFlow(context, options = {}) {
78318
78544
  type: "confirm",
78319
78545
  name: "hide",
78320
78546
  message: "Hide sensitive data (PII) from MCP tools?",
78321
- default: false
78547
+ default: DEFAULT_HIDE_SENSITIVE
78322
78548
  }
78323
78549
  ]);
78324
78550
  if (sensitiveAnswer) {
@@ -78533,7 +78759,7 @@ Integration: ${selectedIntegration.name}`);
78533
78759
  }
78534
78760
  }
78535
78761
  __name(connectIntegrationFlow, "connectIntegrationFlow");
78536
- async function finalizeConnection(context, integration, connectionId, scopes, hideSensitive = false, webhookConfig = {
78762
+ async function finalizeConnection(context, integration, connectionId, scopes, hideSensitive = DEFAULT_HIDE_SENSITIVE, webhookConfig = {
78537
78763
  triggers: [],
78538
78764
  webhookUrl: "",
78539
78765
  isCustomWebhook: false
@@ -79117,7 +79343,7 @@ async function updateConnectionFlow(context, options = {}) {
79117
79343
  console.log(`
79118
79344
  \u2713 Will request ${selectedScopes.length} scope(s)`);
79119
79345
  }
79120
- let hideSensitive = false;
79346
+ let hideSensitive = DEFAULT_HIDE_SENSITIVE;
79121
79347
  if (options.hideSensitive !== void 0) {
79122
79348
  hideSensitive = options.hideSensitive;
79123
79349
  } else {
@@ -79126,7 +79352,7 @@ async function updateConnectionFlow(context, options = {}) {
79126
79352
  type: "confirm",
79127
79353
  name: "hide",
79128
79354
  message: "Hide sensitive data (PII) from MCP tools?",
79129
- default: false
79355
+ default: DEFAULT_HIDE_SENSITIVE
79130
79356
  }
79131
79357
  ]);
79132
79358
  if (sensitiveAnswer) {
@@ -82109,7 +82335,7 @@ init_command_utils();
82109
82335
  init_files();
82110
82336
  init_cli();
82111
82337
  init_constants();
82112
- import inquirer15 from "inquirer";
82338
+ import inquirer11 from "inquirer";
82113
82339
  init_lua_fetch();
82114
82340
  init_request_credential();
82115
82341
  async function sourceListCommand(opts) {
@@ -82155,7 +82381,7 @@ async function sourceRollbackCommand(opts) {
82155
82381
  const dlBlobs = opts.downloadBlobs ?? downloadBlobsParallel;
82156
82382
  const restore = opts.restoreFiles ?? defaultRestore;
82157
82383
  if (!opts.force) {
82158
- const { confirm } = await inquirer15.prompt([
82384
+ const { confirm } = await inquirer11.prompt([
82159
82385
  {
82160
82386
  type: "confirm",
82161
82387
  name: "confirm",
@@ -82348,8 +82574,18 @@ function parseVersion2(arg) {
82348
82574
  __name(parseVersion2, "parseVersion");
82349
82575
 
82350
82576
  // src/commands/version.ts
82577
+ function parsePersonaVersionOption(raw) {
82578
+ if (raw === void 0) return void 0;
82579
+ const text = String(raw).trim().replace(/^v/i, "");
82580
+ if (!/^\d+$/.test(text)) {
82581
+ throw new Error(`--persona-version must be a persona version number (got "${raw}").`);
82582
+ }
82583
+ return Number(text);
82584
+ }
82585
+ __name(parsePersonaVersionOption, "parsePersonaVersionOption");
82351
82586
  async function versionCreateCommand(options = {}) {
82352
82587
  return withErrorHandling(async () => {
82588
+ const personaVersion = parsePersonaVersionOption(options.personaVersion);
82353
82589
  const { apiKey, agentId } = await initializeCommand();
82354
82590
  let config = readYamlConfig();
82355
82591
  let backupVersion = config?.backup?.activeVersion;
@@ -82385,7 +82621,10 @@ async function versionCreateCommand(options = {}) {
82385
82621
  const result = await api.createVersion({
82386
82622
  message,
82387
82623
  sourceManifestVersion: backupVersion,
82388
- commitHash: options.commitHash
82624
+ commitHash: options.commitHash,
82625
+ ...personaVersion !== void 0 ? {
82626
+ personaVersion
82627
+ } : {}
82389
82628
  });
82390
82629
  if (!result.success || !result.data) {
82391
82630
  const errCode = result.error?.code;
@@ -82395,6 +82634,9 @@ async function versionCreateCommand(options = {}) {
82395
82634
  }
82396
82635
  throw new Error(result.error?.message ?? "Failed to create version");
82397
82636
  }
82637
+ if (personaVersion !== void 0 && result.data.snapshot?.persona?.version !== personaVersion) {
82638
+ throw new Error(`v${result.data.version} was created but pins persona version ${String(result.data.snapshot?.persona?.version ?? "none")}, not ${personaVersion}: this server does not support --persona-version. Do not promote v${result.data.version}; delete it with \`lua version delete ${result.data.version}\`.`);
82639
+ }
82398
82640
  writeInfo(`\u2713 Created v${result.data.version} (staged). Run \`lua version promote v${result.data.version}\` to deploy.`);
82399
82641
  try {
82400
82642
  const gitResult = await tryGitCommit({
@@ -83648,7 +83890,13 @@ function setupMarketplaceCommands(program2) {
83648
83890
  program2.command("marketplace [noun] [action]").description("\u{1F6CD}\uFE0F Browse, install, and manage marketplace skills and agent templates").option("--skill-name <name>", "Skill name (for skill list/update/uninstall)").option("--marketplace-id <id>", "Marketplace skill ID").option("--new-org-id <id>", "Destination organization ID (for skill transfer)").option("--version-id <id>", "Version ID (for skill publish/install)").option("--env-vars-json <json>", "JSON string with env var metadata (for skill publish)").option("--query <text>", "Search query (for skill search)").option("--page <n>", "Page number (for skill search)").option("--limit <n>", "Results per page (for skill search)").option("--name <name>", "Template name, an internal identifier (for template create)").option("--description <text>", "Description (for template create)").option("--template-id <id>", "Template ID").option("--window-days <n>", "Fleet-health window in days (template health, R46)").option("--source-version <n>", "Agent version to freeze into this template version (default: active) (for template publish)").option("--env-contract <pair>", "KEY=description env contract entry, repeatable; use KEY?=description for optional (for template publish)", (val, previous) => [
83649
83891
  ...previous,
83650
83892
  val
83651
- ], []).option("--skip-auto-apply", "Publish without auto-updating the installs that consented to creator updates (for template publish)").option("--version <n>", "Template version (for template view/install/apply)").option("--allow-creator-updates", "Allow the template creator to push future updates onto this install").option("--skip-env-check", "Deprecated no-op: the env-contract check is server-enforced; use `lua env` to satisfy the contract (for template install/apply)").option("--agents <ids>", "Comma-separated target agent IDs (for template apply)").option("--file <path>", "Path to a file with one target agent ID per line (for template apply)").option("--all-installed", "Target every agent that already has this template installed (for template apply)").option("--no-wait", "Print the apply runId immediately instead of polling for completion (for template apply)").option("--display-name <name>", "Display name (for skill list/edit, template create)").option("--visibility <visibility>", "Who can see and install it: public or private (for skill list, template create)").option("--changelog <text>", "Changelog for this version (for skill/template publish)").option("--env-vars <pairs>", "Comma-separated key=value pairs (for skill/template install/update)").option("--json", "Output as JSON").option("--force", "Skip confirmation prompts").option("--yes", "Auto-confirm ONLY the template-publish consequence prompt (section clear/narrow); unlike --force it skips no other confirmation").addHelpText("after", `
83893
+ ], []).option("--skip-auto-apply", "Publish without auto-updating the installs that consented to creator updates (for template publish)").option("--version <n>", "Template version (for template view/install/apply)").option("--allow-creator-updates", "Allow the template creator to push future updates onto this install").option("--persona-vars <pairs>", "Comma-separated KEY=value answers for the template's persona {{vars}}; repeatable, put a value containing ',KEY=' in its own occurrence (for template install)", (val, previous) => [
83894
+ ...previous ?? [],
83895
+ val
83896
+ ]).option("--accept-modified <entries>", "Comma-separated kind/key primitives you allow the install to overwrite after a 409 MODIFIED_SINCE_INSTALL; repeatable (for template install)", (val, previous) => [
83897
+ ...previous ?? [],
83898
+ val
83899
+ ]).option("--skip-env-check", "Deprecated no-op: the env-contract check is server-enforced; use `lua env` to satisfy the contract (for template install/apply)").option("--agents <ids>", "Comma-separated target agent IDs (for template apply)").option("--file <path>", "Path to a file with one target agent ID per line (for template apply)").option("--all-installed", "Target every agent that already has this template installed (for template apply)").option("--no-wait", "Print the apply runId immediately instead of polling for completion (for template apply)").option("--display-name <name>", "Display name (for skill list/edit, template create)").option("--visibility <visibility>", "Who can see and install it: public or private (for skill list, template create)").option("--changelog <text>", "Changelog for this version (for skill/template publish)").option("--env-vars <pairs>", "Comma-separated key=value pairs (for skill/template install/update)").option("--json", "Output as JSON").option("--force", "Skip confirmation prompts").option("--yes", "Auto-confirm ONLY the template-publish consequence prompt (section clear/narrow); unlike --force it skips no other confirmation").addHelpText("after", `
83652
83900
  Arguments:
83653
83901
  noun Optional: 'skill' or 'template' (prompts if not provided)
83654
83902
  action Optional: specific action for non-interactive mode
@@ -83674,7 +83922,7 @@ Template Actions:
83674
83922
  publish --template-id <id> [--source-version <n>] [--changelog <text>] [--env-contract KEY=desc,...]
83675
83923
  view --template-id <id> [--version <n>] [--json]
83676
83924
  versions --template-id <id> [--json]
83677
- install --template-id <id> [--version <n>] [--env-vars <k=v,...>] --force
83925
+ install --template-id <id> [--version <n>] [--env-vars <k=v,...>] [--persona-vars <K=v,...>] [--accept-modified <kind/key,...>] --force
83678
83926
  apply --template-id <id> [--version <n>] (--agents <a,b,c> | --file <path> | --all-installed) --force [--no-wait]
83679
83927
  status --template-id <id> [--json]
83680
83928
  installed [--json]
@@ -83696,6 +83944,7 @@ Examples:
83696
83944
  $ lua marketplace template Template action menu
83697
83945
  $ lua marketplace template create --name support-bot --display-name "Support Bot"
83698
83946
  $ lua marketplace template publish --template-id xyz --changelog "Add refund skill"
83947
+ $ lua marketplace template install --template-id xyz --persona-vars COMPANY_NAME=Acme,TONE=warm --force
83699
83948
  $ lua marketplace template apply --template-id xyz --all-installed --force
83700
83949
  `).action(marketplaceCommand);
83701
83950
  }
@@ -84270,7 +84519,7 @@ Examples:
84270
84519
  $ lua mcp deactivate --server-name api-server Deactivate a server
84271
84520
  $ lua mcp delete --server-name old-server Delete a server
84272
84521
  `).action(mcpCommand);
84273
- program2.command("integrations [action] [subaction]").description("\u{1F517} Connect third-party integrations via Unified.to").option("--integration <type>", "Integration type (e.g., linear, googlecalendar)").option("--auth-method <method>", "Authentication method: 'oauth' or 'token'").option("--scopes <scopes>", "Comma-separated OAuth scopes (or 'all' for all scopes)").option("--hide-sensitive <bool>", "Hide sensitive data from MCP tools (default: true)").option("--account-label <label>", "Account label used to distinguish multiple connected accounts").option("--scope <scope>", "Who owns the connection: 'agent' (default) or 'user'").option("--force", "Skip the confirmation prompt (for convert)").option("--forget", "Also forget what a personal connection (--scope user) added to memory on disconnect (default: false, memories kept)").option("--connection-id <id>", "Exact connection ID to update, disconnect, convert or pause/resume").option("--connection <id>", "Connection ID for trigger").option("--webhook-id <id>", "Trigger ID to delete/pause/resume").option("--object <type>", "Object type for webhook (e.g., task_task, calendar_event)").option("--event <type>", "Event type for webhook: created, updated, or deleted").option("--hook-url <url>", "Custom webhook URL (default: agent trigger)").option("--interval <minutes>", "Polling interval in minutes for virtual webhooks, 1-2880 (default 1; e.g. 1, 5, 15, 60, 1440, 2880)").option("--triggers <events>", "Comma-separated triggers (e.g., task_task.created,task_task.updated)").option("--custom-webhook", "Use custom webhook URL instead of agent trigger").option("--json", "Output as JSON (for list, info, requests and webhooks list/events commands)").option("--reason <text>", "Optional reason for pausing a trigger").addHelpText("after", `
84522
+ program2.command("integrations [action] [subaction]").description("\u{1F517} Connect third-party integrations via Unified.to").option("--integration <type>", "Integration type (e.g., linear, googlecalendar)").option("--auth-method <method>", "Authentication method: 'oauth' or 'token'").option("--scopes <scopes>", "Comma-separated OAuth scopes (or 'all' for all scopes)").option("--hide-sensitive <bool>", "Hide sensitive data from MCP tools (default: false; pass 'true' to hide)").option("--account-label <label>", "Account label used to distinguish multiple connected accounts").option("--scope <scope>", "Who owns the connection: 'agent' (default) or 'user'").option("--force", "Skip the confirmation prompt (for convert)").option("--forget", "Also forget what a personal connection (--scope user) added to memory on disconnect (default: false, memories kept)").option("--connection-id <id>", "Exact connection ID to update, disconnect, convert or pause/resume").option("--connection <id>", "Connection ID for trigger").option("--webhook-id <id>", "Trigger ID to delete/pause/resume").option("--object <type>", "Object type for webhook (e.g., task_task, calendar_event)").option("--event <type>", "Event type for webhook: created, updated, or deleted").option("--hook-url <url>", "Custom webhook URL (default: agent trigger)").option("--interval <minutes>", "Polling interval in minutes for virtual webhooks, 1-2880 (default 1; e.g. 1, 5, 15, 60, 1440, 2880)").option("--triggers <events>", "Comma-separated triggers (e.g., task_task.created,task_task.updated)").option("--custom-webhook", "Use custom webhook URL instead of agent trigger").option("--json", "Output as JSON (for list, info, requests and webhooks list/events commands)").option("--reason <text>", "Optional reason for pausing a trigger").addHelpText("after", `
84274
84523
  Arguments:
84275
84524
  action Optional: 'connect', 'update', 'list', 'available', 'info', 'disconnect',
84276
84525
  'convert', 'webhooks' (alias: 'triggers'), or 'mcp'
@@ -84285,7 +84534,7 @@ Options:
84285
84534
  create later. Publishing an agent removes its access.
84286
84535
  --auth-method <method> Authentication method: 'oauth' or 'token'
84287
84536
  --scopes <scopes> Comma-separated OAuth scopes, or 'all' for all available scopes
84288
- --hide-sensitive <bool> Hide sensitive data from MCP tools (default: true, use 'false' to show)
84537
+ --hide-sensitive <bool> Hide sensitive data from MCP tools (default: false, use 'true' to hide)
84289
84538
  --triggers <events> Comma-separated triggers to enable (e.g., task_task.created,task_task.updated)
84290
84539
  --custom-webhook Use custom webhook URL instead of agent trigger
84291
84540
  --hook-url <url> Custom webhook URL (use with --custom-webhook)
@@ -84476,11 +84725,12 @@ Examples:
84476
84725
  `).action(voiceTestCommand);
84477
84726
  voice.command("list").description("List LuaVoice primitives in the compiled manifest").option("--json", "Output as JSON").action(voiceListCommand);
84478
84727
  const versionGroup = program2.command("version").description("\u{1F3F7}\uFE0F Manage agent versions \u2014 atomic snapshots of agent state");
84479
- versionGroup.command("create").description("Snapshot current staged state into a new version").option("-m, --message <message>", "Optional description for this version").option("--auto-push", "Push first if local changes are not yet staged").option("--commit-hash <hash>", "Optional git commit hash to associate with this version").addHelpText("after", `
84728
+ versionGroup.command("create").description("Snapshot current staged state into a new version").option("-m, --message <message>", "Optional description for this version").option("--auto-push", "Push first if local changes are not yet staged").option("--commit-hash <hash>", "Optional git commit hash to associate with this version").option("--persona-version <n>", "Pin this persona version (staged or published) instead of the newest published one").addHelpText("after", `
84480
84729
  Examples:
84481
84730
  $ lua version create Snapshot current state
84482
84731
  $ lua version create -m "Add FAQ skill" Include a description
84483
84732
  $ lua version create --auto-push Push then snapshot in one step
84733
+ $ lua version create --persona-version 7 Pin staged persona v7 (practice it before go-live)
84484
84734
  `).action((opts) => versionCreateCommand(opts));
84485
84735
  versionGroup.command("list").description("List versions of the current agent").option("--all", "Show all versions (no server-side cap)").option("--limit <n>", "Cap output to this many entries", (v) => parseInt(v, 10)).option("--status <status>", "Filter by status: active | staged | superseded | deleted | all", "all").option("--json", "Output as JSON").addHelpText("after", `
84486
84736
  Examples:
@@ -84677,6 +84927,7 @@ program.hook("preAction", (thisCommand) => {
84677
84927
  setCiMode(true);
84678
84928
  }
84679
84929
  });
84930
+ registerJsonErrorEnvelope(program);
84680
84931
  setupAuthCommands(program);
84681
84932
  setupSkillCommands(program);
84682
84933
  setupMarketplaceCommands(program);