lua-cli 3.20.0 → 3.22.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
@@ -8,8 +8,13 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
8
8
  if (typeof require !== "undefined") return require.apply(this, arguments);
9
9
  throw Error('Dynamic require of "' + x + '" is not supported');
10
10
  });
11
- var __esm = (fn, res) => function __init() {
12
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
+ var __esm = (fn, res, err) => function __init() {
12
+ if (err) throw err[0];
13
+ try {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ } catch (e) {
16
+ throw err = [e], e;
17
+ }
13
18
  };
14
19
  var __export = (target, all) => {
15
20
  for (var name in all)
@@ -1449,7 +1454,8 @@ Feel free to add, remove, or rename sections. Your persona can be a single parag
1449
1454
  "mcp",
1450
1455
  "rag",
1451
1456
  "device",
1452
- "device-trigger"
1457
+ "device-trigger",
1458
+ "model-resolver"
1453
1459
  ];
1454
1460
  VoiceNameSchema = z.string().regex(/^[a-zA-Z0-9_-]+$/, "Voice name must contain only alphanumeric characters, underscores, or hyphens").min(1).max(64);
1455
1461
  PluginProviderSchema = z.enum([
@@ -3006,6 +3012,18 @@ var init_skill_handler = __esm({
3006
3012
  return toolData;
3007
3013
  }).filter(Boolean);
3008
3014
  const sourceArchive = buildSourceArchive(archiveEntries);
3015
+ let condition;
3016
+ let conditionS3Hash;
3017
+ if (skill.hasCondition) {
3018
+ const skillCode = loadArtifact(skill, projectPath);
3019
+ if (bundleAccumulator) {
3020
+ const rawGzip = compressForPushRaw(skillCode);
3021
+ conditionS3Hash = hashBundle(rawGzip);
3022
+ bundleAccumulator.set(conditionS3Hash, rawGzip);
3023
+ } else {
3024
+ condition = compressForPush(skillCode);
3025
+ }
3026
+ }
3009
3027
  return {
3010
3028
  name: skill.name,
3011
3029
  description: skill.description,
@@ -3014,6 +3032,12 @@ var init_skill_handler = __esm({
3014
3032
  context: skill.context
3015
3033
  } : {},
3016
3034
  tools,
3035
+ ...condition ? {
3036
+ condition
3037
+ } : {},
3038
+ ...conditionS3Hash ? {
3039
+ conditionS3Hash
3040
+ } : {},
3017
3041
  ...sourceArchive ? {
3018
3042
  sourceArchive,
3019
3043
  archiveSchemaVersion: SOURCE_ARCHIVE_SCHEMA_VERSION
@@ -6928,14 +6952,24 @@ var init_skill_plugin = __esm({
6928
6952
  // 2. Residual super-edge cases — `stripSuperCallsInConstructors` covers
6929
6953
  // top-level `super(...)` only; `super.method()` mid-constructor and
6930
6954
  // `field = super.x` survive a strip and explode at runtime.
6931
- // MAINTENANCE: this whitelist also assumes skills are JSON-only artifacts (via
6932
- // `buildArtifact`). If skills ever migrate to bundled JS, this drop will silently
6933
- // lose `tools` from skill bundlesre-evaluate.
6955
+ // MAINTENANCE: a skill WITH a `condition` is bundled through esbuild (see
6956
+ // `buildArtifact`), so every field the runtime needs off the bundle must be
6957
+ // listed here or it is silently dropped. `tools` stays out by design the
6958
+ // compiler resolves tool refs separately via `resolveArrayRefs`. The
6959
+ // whitelist only governs config literals; `dropClassMembers` is the same
6960
+ // drop for the class-definition shape, where a `tools = [...]` field or a
6961
+ // `this.addTool(...)` call would otherwise keep the tool imports live.
6934
6962
  crossFileRewrite = {
6935
6963
  fields: [
6936
6964
  "name",
6937
6965
  "description",
6938
- "context"
6966
+ "context",
6967
+ "condition"
6968
+ ],
6969
+ dropClassMembers: [
6970
+ "tools",
6971
+ "addTool",
6972
+ "addTools"
6939
6973
  ]
6940
6974
  };
6941
6975
  supportsClassDefinition = true;
@@ -6992,7 +7026,12 @@ var init_skill_plugin = __esm({
6992
7026
  pattern: "class-definition",
6993
7027
  context,
6994
7028
  toolRefs,
6995
- toolRefSourcePaths: Object.keys(toolRefSourcePaths).length > 0 ? toolRefSourcePaths : void 0
7029
+ toolRefSourcePaths: Object.keys(toolRefSourcePaths).length > 0 ? toolRefSourcePaths : void 0,
7030
+ // Emitted only when present so a condition-less skill's JSON artifact
7031
+ // stays byte-identical to pre-feature output.
7032
+ ...findClassMember(classDecl, "condition", "either") !== void 0 ? {
7033
+ hasCondition: true
7034
+ } : {}
6996
7035
  }
6997
7036
  };
6998
7037
  }
@@ -7048,7 +7087,10 @@ var init_skill_plugin = __esm({
7048
7087
  pattern,
7049
7088
  context,
7050
7089
  toolRefs,
7051
- toolRefSourcePaths: Object.keys(toolRefSourcePaths).length > 0 ? toolRefSourcePaths : void 0
7090
+ toolRefSourcePaths: Object.keys(toolRefSourcePaths).length > 0 ? toolRefSourcePaths : void 0,
7091
+ ...config.getProperty("condition") !== void 0 ? {
7092
+ hasCondition: true
7093
+ } : {}
7052
7094
  }
7053
7095
  };
7054
7096
  }
@@ -7193,13 +7235,19 @@ var init_skill_plugin = __esm({
7193
7235
  return rest;
7194
7236
  }
7195
7237
  /**
7196
- * Skills have no executable code and their artifact is never loaded at
7197
- * runtime (see `SkillHandler.prepareForPush` — it loads tool artifacts
7198
- * but never the skill's own). Emit a JSON metadata artifact instead of
7199
- * running esbuild on `new LuaSkill({...})`, which would otherwise bundle
7200
- * a non-executable shell (LuaSkill is stripped as an external import).
7238
+ * A skill without a `condition` has no executable code and its artifact is
7239
+ * never loaded at runtime (see `SkillHandler.prepareForPush` — it loads tool
7240
+ * artifacts, plus the skill's own only when it has a condition). Emit a JSON
7241
+ * metadata artifact instead of running esbuild on `new LuaSkill({...})`,
7242
+ * which would otherwise bundle a non-executable shell (LuaSkill is stripped
7243
+ * as an external import).
7244
+ *
7245
+ * A skill WITH a condition returns undefined to fall through to the standard
7246
+ * `generateEntryPoint → bundler.bundle → postProcess` esbuild path, same as
7247
+ * `AgentPlugin` with a model resolver.
7201
7248
  */
7202
7249
  async buildArtifact(metadata) {
7250
+ if (metadata.metadata.hasCondition) return void 0;
7203
7251
  const code = JSON.stringify({
7204
7252
  kind: metadata.kind,
7205
7253
  name: metadata.name,
@@ -7216,6 +7264,32 @@ var init_skill_plugin = __esm({
7216
7264
  };
7217
7265
  }
7218
7266
  /**
7267
+ * Project the class instance onto the skill primitive shape. Binds
7268
+ * `condition` to the instance so `this` references resolve correctly,
7269
+ * mirroring `ToolPlugin`. Skills have no `execute`, so the base shape
7270
+ * doesn't apply.
7271
+ */
7272
+ getClassDefinitionPrimitiveShape(metadata) {
7273
+ return `{
7274
+ kind: 'skill',
7275
+ name: __lua_instance__.name ?? ${JSON.stringify(metadata.name)},
7276
+ description: __lua_instance__.description ?? ${JSON.stringify(metadata.description)},
7277
+ context: __lua_instance__.context,
7278
+ condition: typeof __lua_instance__.condition === 'function' ? __lua_instance__.condition.bind(__lua_instance__) : undefined,
7279
+ }`;
7280
+ }
7281
+ /**
7282
+ * Runtime validation — a skill only reaches the bundled path when it
7283
+ * declares a condition, so the bundle must expose a callable one.
7284
+ */
7285
+ getRuntimeValidation(metadata) {
7286
+ if (!metadata.metadata.hasCondition) return "";
7287
+ return `
7288
+ if (typeof primitive.primitive?.condition !== 'function') {
7289
+ throw new Error('[Lua] Invalid skill artifact: condition is not a function');
7290
+ }`;
7291
+ }
7292
+ /**
7219
7293
  * Resolve tool references from this skill.
7220
7294
  *
7221
7295
  * Skills reference tools by class/variable name. This method:
@@ -7299,7 +7373,8 @@ var init_skill_plugin = __esm({
7299
7373
  return {
7300
7374
  ...this.baseManifestFields(compiled),
7301
7375
  context: skillMetadata.context,
7302
- tools: toolNames
7376
+ tools: toolNames,
7377
+ hasCondition: skillMetadata.hasCondition || false
7303
7378
  };
7304
7379
  }
7305
7380
  };
@@ -8115,7 +8190,7 @@ function rewriteCrossFileCallsInSourceFile(sf, specs, sdkBaseClassNames) {
8115
8190
  node.replaceWithText(buildBareObjectLiteral(spec, objArg));
8116
8191
  progressed = true;
8117
8192
  }
8118
- stripSdkExtendsClauses(sf, sdkBaseClassNames, aliasMap);
8193
+ stripSdkExtendsClauses(sf, sdkBaseClassNames, aliasMap, specs);
8119
8194
  }
8120
8195
  function warnUnsupportedNamespaceImports(sf) {
8121
8196
  for (const imp of sf.getImportDeclarations()) {
@@ -8135,20 +8210,29 @@ function warnUnsupportedNamespaceImports(sf) {
8135
8210
  }));
8136
8211
  }
8137
8212
  }
8138
- function stripSdkExtendsClauses(sf, sdkBaseClassNames, aliasMap) {
8139
- const matchesSdkClass = /* @__PURE__ */ __name((text) => {
8213
+ function stripSdkExtendsClauses(sf, sdkBaseClassNames, aliasMap, specs) {
8214
+ const matchSdkClass = /* @__PURE__ */ __name((text) => {
8140
8215
  const canonical = aliasMap.get(text) ?? text;
8141
- return sdkBaseClassNames.has(canonical);
8142
- }, "matchesSdkClass");
8216
+ return sdkBaseClassNames.has(canonical) ? canonical : void 0;
8217
+ }, "matchSdkClass");
8218
+ const dropNamesFor = /* @__PURE__ */ __name((canonical) => {
8219
+ const spec = specs.find((s) => s.classNames.includes(canonical));
8220
+ if (!spec?.dropClassMembers?.length) return void 0;
8221
+ return new Set(spec.dropClassMembers);
8222
+ }, "dropNamesFor");
8223
+ const strip = /* @__PURE__ */ __name((classNode, canonical) => {
8224
+ classNode.removeExtends();
8225
+ const dropNames = dropNamesFor(canonical);
8226
+ if (dropNames) stripDroppedClassMembers(classNode, dropNames);
8227
+ stripSuperCallsInConstructors(classNode);
8228
+ }, "strip");
8143
8229
  for (const classDecl of sf.getClasses()) {
8144
8230
  const ext = classDecl.getExtends();
8145
8231
  if (!ext) continue;
8146
8232
  const expr = ext.getExpression();
8147
8233
  if (!Node15.isIdentifier(expr)) continue;
8148
- if (matchesSdkClass(expr.getText())) {
8149
- classDecl.removeExtends();
8150
- stripSuperCallsInConstructors(classDecl);
8151
- }
8234
+ const canonical = matchSdkClass(expr.getText());
8235
+ if (canonical) strip(classDecl, canonical);
8152
8236
  }
8153
8237
  sf.forEachDescendant((n) => {
8154
8238
  if (!Node15.isClassExpression(n)) return;
@@ -8156,11 +8240,31 @@ function stripSdkExtendsClauses(sf, sdkBaseClassNames, aliasMap) {
8156
8240
  if (!ext) return;
8157
8241
  const expr = ext.getExpression();
8158
8242
  if (!Node15.isIdentifier(expr)) return;
8159
- if (matchesSdkClass(expr.getText())) {
8160
- n.removeExtends();
8161
- stripSuperCallsInConstructors(n);
8162
- }
8243
+ const canonical = matchSdkClass(expr.getText());
8244
+ if (canonical) strip(n, canonical);
8245
+ });
8246
+ }
8247
+ function stripDroppedClassMembers(classNode, dropNames) {
8248
+ for (const prop of classNode.getProperties()) {
8249
+ if (dropNames.has(prop.getName())) prop.remove();
8250
+ }
8251
+ const statements = [];
8252
+ classNode.forEachDescendant((n) => {
8253
+ if (!Node15.isExpressionStatement(n)) return;
8254
+ if (isThisRootedCallTo(n.getExpression(), dropNames)) statements.push(n);
8163
8255
  });
8256
+ for (const stmt of statements) stmt.remove();
8257
+ }
8258
+ function isThisRootedCallTo(expression, dropNames) {
8259
+ let current = expression;
8260
+ let matched = false;
8261
+ while (Node15.isCallExpression(current)) {
8262
+ const callee = current.getExpression();
8263
+ if (!Node15.isPropertyAccessExpression(callee)) return false;
8264
+ if (dropNames.has(callee.getName())) matched = true;
8265
+ current = callee.getExpression();
8266
+ }
8267
+ return matched && current.getKind() === ts3.SyntaxKind.ThisKeyword;
8164
8268
  }
8165
8269
  function stripSuperCallsInConstructors(classNode) {
8166
8270
  for (const ctor of classNode.getConstructors()) {
@@ -8267,6 +8371,8 @@ function buildBareObjectLiteral(spec, arg) {
8267
8371
  if (init) parts.push(`${f}: ${init.getText()}`);
8268
8372
  } else if (prop && Node15.isShorthandPropertyAssignment(prop)) {
8269
8373
  parts.push(`${f}: ${prop.getName()}`);
8374
+ } else if (prop && Node15.isMethodDeclaration(prop)) {
8375
+ parts.push(prop.getText());
8270
8376
  }
8271
8377
  }
8272
8378
  return `{ ${parts.join(", ")} }`;
@@ -8336,6 +8442,8 @@ var init_primitive_rewrite = __esm({
8336
8442
  __name(rewriteCrossFileCallsInSourceFile, "rewriteCrossFileCallsInSourceFile");
8337
8443
  __name(warnUnsupportedNamespaceImports, "warnUnsupportedNamespaceImports");
8338
8444
  __name(stripSdkExtendsClauses, "stripSdkExtendsClauses");
8445
+ __name(stripDroppedClassMembers, "stripDroppedClassMembers");
8446
+ __name(isThisRootedCallTo, "isThisRootedCallTo");
8339
8447
  __name(stripSuperCallsInConstructors, "stripSuperCallsInConstructors");
8340
8448
  __name(warnRemainingSuperReferences, "warnRemainingSuperReferences");
8341
8449
  __name(buildSdkAliasMap, "buildSdkAliasMap");
@@ -8358,16 +8466,19 @@ function buildCrossFileSpecs(plugins = pluginRegistry.getAll()) {
8358
8466
  ...plugin.legacyClassNames
8359
8467
  ];
8360
8468
  const defineFunction = plugin.defineFunction || void 0;
8469
+ const dropClassMembers = plugin.crossFileRewrite.dropClassMembers;
8361
8470
  if ("copyAllFields" in plugin.crossFileRewrite && plugin.crossFileRewrite.copyAllFields) {
8362
8471
  specs.push({
8363
8472
  classNames,
8364
8473
  defineFunction,
8474
+ dropClassMembers,
8365
8475
  mode: "copyAllFields"
8366
8476
  });
8367
8477
  } else if ("fields" in plugin.crossFileRewrite) {
8368
8478
  specs.push({
8369
8479
  classNames,
8370
8480
  defineFunction,
8481
+ dropClassMembers,
8371
8482
  mode: "whitelist",
8372
8483
  fields: plugin.crossFileRewrite.fields
8373
8484
  });
@@ -20197,6 +20308,22 @@ function buildSandboxProcess(opts) {
20197
20308
  const nextTickFn = /* @__PURE__ */ __name4((cb, ...args2) => {
20198
20309
  process.nextTick(cb, ...args2);
20199
20310
  }, "nextTickFn");
20311
+ const buildStdioStub = /* @__PURE__ */ __name4((fd) => {
20312
+ const stub = {
20313
+ fd,
20314
+ isTTY: false,
20315
+ write: /* @__PURE__ */ __name4(() => true, "write"),
20316
+ end: /* @__PURE__ */ __name4(() => stub, "end"),
20317
+ on: /* @__PURE__ */ __name4(() => stub, "on"),
20318
+ once: /* @__PURE__ */ __name4(() => stub, "once"),
20319
+ removeListener: /* @__PURE__ */ __name4(() => stub, "removeListener"),
20320
+ cork: /* @__PURE__ */ __name4(() => {
20321
+ }, "cork"),
20322
+ uncork: /* @__PURE__ */ __name4(() => {
20323
+ }, "uncork")
20324
+ };
20325
+ return stub;
20326
+ }, "buildStdioStub");
20200
20327
  const proc = {
20201
20328
  env: opts.envVars,
20202
20329
  version: process.version,
@@ -20206,6 +20333,8 @@ function buildSandboxProcess(opts) {
20206
20333
  platform: process.platform,
20207
20334
  arch: process.arch,
20208
20335
  pid: process.pid,
20336
+ stdout: buildStdioStub(1),
20337
+ stderr: buildStdioStub(2),
20209
20338
  nextTick: nextTickFn,
20210
20339
  hrtime: hrtimeFn,
20211
20340
  // Lie — don't leak host filesystem layout. Skills should not depend on
@@ -21021,6 +21150,106 @@ function runBundleInContext(context, source, options) {
21021
21150
  }
21022
21151
  __name(runBundleInContext, "runBundleInContext");
21023
21152
  __name4(runBundleInContext, "runBundleInContext");
21153
+ var USER_CODE_ERROR_CODE = "USER_CODE_ERROR";
21154
+ var PLATFORM_VM_ERROR_CODE = "PLATFORM_VM_ERROR";
21155
+ var UserCodeError = class extends Error {
21156
+ static {
21157
+ __name(this, "UserCodeError");
21158
+ }
21159
+ static {
21160
+ __name4(this, "UserCodeError");
21161
+ }
21162
+ code = USER_CODE_ERROR_CODE;
21163
+ source;
21164
+ constructor(source, cause) {
21165
+ super(cause instanceof Error ? cause.message : String(cause), {
21166
+ cause
21167
+ });
21168
+ this.name = "UserCodeError";
21169
+ this.source = source;
21170
+ if (cause instanceof Error && cause.stack) {
21171
+ this.stack = cause.stack;
21172
+ }
21173
+ }
21174
+ };
21175
+ function isUserCodeError(error) {
21176
+ if (!error || typeof error !== "object") return false;
21177
+ return error.code === USER_CODE_ERROR_CODE;
21178
+ }
21179
+ __name(isUserCodeError, "isUserCodeError");
21180
+ __name4(isUserCodeError, "isUserCodeError");
21181
+ function isPlatformVmError(error) {
21182
+ if (!error || typeof error !== "object") return false;
21183
+ return error.code === PLATFORM_VM_ERROR_CODE;
21184
+ }
21185
+ __name(isPlatformVmError, "isPlatformVmError");
21186
+ __name4(isPlatformVmError, "isPlatformVmError");
21187
+ var DEFAULT_MAX_CAUSE_DEPTH = 10;
21188
+ function findUserCodeErrorInCauseChain(value, maxDepth = DEFAULT_MAX_CAUSE_DEPTH) {
21189
+ let current = value;
21190
+ for (let depth = 0; depth < maxDepth; depth++) {
21191
+ if (isUserCodeError(current)) return current;
21192
+ if (!current || typeof current !== "object") return null;
21193
+ const next = current.cause;
21194
+ if (next === current || next === value) return null;
21195
+ current = next;
21196
+ }
21197
+ return null;
21198
+ }
21199
+ __name(findUserCodeErrorInCauseChain, "findUserCodeErrorInCauseChain");
21200
+ __name4(findUserCodeErrorInCauseChain, "findUserCodeErrorInCauseChain");
21201
+ var MissingPrimitiveCodeError = class extends Error {
21202
+ static {
21203
+ __name(this, "MissingPrimitiveCodeError");
21204
+ }
21205
+ static {
21206
+ __name4(this, "MissingPrimitiveCodeError");
21207
+ }
21208
+ code = PLATFORM_VM_ERROR_CODE;
21209
+ source;
21210
+ // The message reaches the customer's vmExecutionLogs dashboard (via Mastra's
21211
+ // re-wrap → LuaMastraLogger.logToMongo), so it must be customer-safe: no
21212
+ // internal ticket refs, no jargon, and it must NOT imply the customer's code
21213
+ // is at fault (it isn't — the artifact exists; delivery failed). Internal
21214
+ // triage keys off the error NAME + PLATFORM_VM_ERROR code + ERROR level, not
21215
+ // this prose.
21216
+ constructor(source) {
21217
+ super(`This ${source}'s code could not be loaded due to a temporary platform issue and was not executed. Please try again shortly.`);
21218
+ this.name = "MissingPrimitiveCodeError";
21219
+ this.source = source;
21220
+ }
21221
+ };
21222
+ function assertPrimitiveCodePresent(code, source) {
21223
+ if (typeof code !== "string" || code.length === 0) {
21224
+ throw new MissingPrimitiveCodeError(source);
21225
+ }
21226
+ }
21227
+ __name(assertPrimitiveCodePresent, "assertPrimitiveCodePresent");
21228
+ __name4(assertPrimitiveCodePresent, "assertPrimitiveCodePresent");
21229
+ async function withUserCodeBoundary(source, fn) {
21230
+ try {
21231
+ return await fn();
21232
+ } catch (cause) {
21233
+ if (isUserCodeError(cause)) throw cause;
21234
+ if (isPlatformVmError(cause)) throw cause;
21235
+ throw new UserCodeError(source, cause);
21236
+ }
21237
+ }
21238
+ __name(withUserCodeBoundary, "withUserCodeBoundary");
21239
+ __name4(withUserCodeBoundary, "withUserCodeBoundary");
21240
+ function logUserCodeOrError(logger, message, error, context = {}) {
21241
+ if (isUserCodeError(error)) {
21242
+ logger.warn(`${message} (user code)`, {
21243
+ ...context,
21244
+ source: error.source,
21245
+ error: error.message
21246
+ });
21247
+ } else {
21248
+ logger.error(message, error, context);
21249
+ }
21250
+ }
21251
+ __name(logUserCodeOrError, "logUserCodeOrError");
21252
+ __name4(logUserCodeOrError, "logUserCodeOrError");
21024
21253
 
21025
21254
  // src/utils/env-loader.utils.ts
21026
21255
  import path15 from "path";
@@ -22142,66 +22371,89 @@ var ALIAS_MAP = {
22142
22371
  del: "delete"
22143
22372
  })
22144
22373
  },
22145
- "marketplace.role": {
22374
+ "marketplace.noun": {
22146
22375
  canonical: [
22147
- "create",
22148
- "install"
22376
+ "skill",
22377
+ "template"
22149
22378
  ],
22150
22379
  aliases: lowerKeys({
22151
- creator: "create",
22152
- new: "create",
22153
- publish: "create",
22154
- installer: "install",
22155
- consumer: "install",
22156
- use: "install"
22380
+ skills: "skill",
22381
+ templates: "template",
22382
+ "agent-template": "template",
22383
+ "agent-templates": "template"
22157
22384
  })
22158
22385
  },
22159
- "marketplace.action.create": {
22386
+ // Flat skill-marketplace action namespace. `list`/`publish`/`edit`/`unlist`/
22387
+ // `unpublish`/`mine` are the old creator actions; `search`/`view`/`install`/
22388
+ // `update`/`uninstall`/`installed` are the old installer actions.
22389
+ "marketplace.skill.action": {
22160
22390
  canonical: [
22161
22391
  "list",
22162
22392
  "publish",
22163
- "update",
22393
+ "edit",
22164
22394
  "unlist",
22165
22395
  "unpublish",
22166
- "view"
22396
+ "mine",
22397
+ "search",
22398
+ "view",
22399
+ "install",
22400
+ "update",
22401
+ "uninstall",
22402
+ "installed"
22167
22403
  ],
22168
22404
  aliases: lowerKeys({
22169
22405
  ls: "list",
22170
22406
  l: "list",
22171
22407
  new: "publish",
22172
22408
  submit: "publish",
22173
- edit: "update",
22174
- modify: "update",
22409
+ modify: "edit",
22175
22410
  hide: "unlist",
22176
- delete: "unpublish",
22177
- remove: "unpublish",
22178
- rm: "unpublish",
22411
+ delist: "unlist",
22412
+ retract: "unpublish",
22413
+ deprecate: "unpublish",
22414
+ my: "mine",
22415
+ "my-listings": "mine",
22416
+ listed: "mine",
22417
+ find: "search",
22179
22418
  show: "view",
22180
- info: "view"
22419
+ info: "view",
22420
+ details: "view",
22421
+ add: "install",
22422
+ upgrade: "update",
22423
+ remove: "uninstall",
22424
+ rm: "uninstall",
22425
+ delete: "uninstall"
22181
22426
  })
22182
22427
  },
22183
- "marketplace.action.install": {
22428
+ "template.action": {
22184
22429
  canonical: [
22185
- "search",
22430
+ "create",
22431
+ "publish",
22186
22432
  "view",
22433
+ "versions",
22187
22434
  "install",
22188
- "update",
22189
- "uninstall",
22190
- "installed"
22435
+ "apply",
22436
+ "status",
22437
+ "installed",
22438
+ "uninstall"
22191
22439
  ],
22192
22440
  aliases: lowerKeys({
22193
- find: "search",
22441
+ new: "create",
22442
+ publish_version: "publish",
22443
+ submit: "publish",
22194
22444
  show: "view",
22195
22445
  info: "view",
22446
+ details: "view",
22447
+ history: "versions",
22196
22448
  add: "install",
22197
- edit: "update",
22198
- upgrade: "update",
22449
+ deploy: "apply",
22450
+ "fleet-apply": "apply",
22451
+ rollout: "apply",
22452
+ ls: "installed",
22453
+ list: "installed",
22199
22454
  remove: "uninstall",
22200
22455
  rm: "uninstall",
22201
- delete: "uninstall",
22202
- list: "installed",
22203
- ls: "installed",
22204
- l: "installed"
22456
+ delete: "uninstall"
22205
22457
  })
22206
22458
  },
22207
22459
  "models.action": {
@@ -25806,16 +26058,14 @@ var ChatApi = class extends HttpClient {
25806
26058
  }
25807
26059
  }
25808
26060
  /**
25809
- * Clears conversation history for an agent
26061
+ * Clears the authenticated user's conversation history for an agent
25810
26062
  * @param agentId - The unique identifier of the agent
25811
- * @param targetIdentifier - Optional user identifier to clear history for specific user
25812
26063
  * @param threadId - Optional thread ID to clear a specific conversation thread
25813
26064
  * @returns Promise resolving to an ApiResponse with confirmation
25814
26065
  * @throws Error if the agent is not found or the clear operation fails
25815
26066
  */
25816
- async clearHistory(agentId, targetIdentifier, threadId) {
26067
+ async clearHistory(agentId, threadId) {
25817
26068
  const params = new URLSearchParams();
25818
- if (targetIdentifier) params.set("targetIdentifier", targetIdentifier);
25819
26069
  if (threadId) params.set("threadId", threadId);
25820
26070
  const query = params.toString() ? `?${params.toString()}` : "";
25821
26071
  const url = `/chat/history/${agentId}${query}`;
@@ -26984,7 +27234,7 @@ __name(startChatLoop, "startChatLoop");
26984
27234
  async function clearOnExit(chatEnv) {
26985
27235
  try {
26986
27236
  const chatApi = new ChatApi(BASE_URLS.CHAT, chatEnv.apiKey);
26987
- const response = await chatApi.clearHistory(chatEnv.agentId, void 0, chatEnv.threadId);
27237
+ const response = await chatApi.clearHistory(chatEnv.agentId, chatEnv.threadId);
26988
27238
  if (response.success) {
26989
27239
  const scope = chatEnv.threadId ? ` for thread "${chatEnv.threadId}"` : "";
26990
27240
  console.log(`
@@ -27248,22 +27498,22 @@ init_analytics();
27248
27498
  async function chatClearCommand(options, command) {
27249
27499
  return withErrorHandling(async () => {
27250
27500
  const resolvedOptions = options ?? {};
27501
+ if (resolvedOptions.user) {
27502
+ throw new Error("The --user option was removed: cross-user history clear is no longer supported. This command only clears your own chat history \u2014 re-run it without --user.");
27503
+ }
27251
27504
  const { agentId, apiKey } = await initializeCommand();
27252
- const targetIdentifier = resolvedOptions.user;
27253
27505
  const threadId = resolvedOptions.thread ?? command?.parent?.opts()?.thread;
27254
27506
  const force = !!resolvedOptions.force;
27255
- const userContext = targetIdentifier ? `for user ${targetIdentifier}` : "for your current user";
27256
27507
  const threadContext = threadId ? ` in thread "${threadId}"` : "";
27257
- const context = `${userContext}${threadContext}`;
27258
27508
  if (!force) {
27259
27509
  console.log(`
27260
- \u26A0\uFE0F WARNING: This will clear conversation history ${context}!`);
27510
+ \u26A0\uFE0F WARNING: This will clear your conversation history${threadContext}!`);
27261
27511
  console.log("\u26A0\uFE0F This action cannot be undone.\n");
27262
27512
  const confirmAnswer = await safePrompt([
27263
27513
  {
27264
27514
  type: "confirm",
27265
27515
  name: "confirm",
27266
- message: `Are you sure you want to clear the conversation history ${context}?`,
27516
+ message: `Are you sure you want to clear your conversation history${threadContext}?`,
27267
27517
  default: false
27268
27518
  }
27269
27519
  ]);
@@ -27273,16 +27523,15 @@ async function chatClearCommand(options, command) {
27273
27523
  }
27274
27524
  writeProgress("\u{1F504} Clearing conversation history...");
27275
27525
  const chatApi = new ChatApi(BASE_URLS.CHAT, apiKey);
27276
- const response = await chatApi.clearHistory(agentId, targetIdentifier, threadId);
27526
+ const response = await chatApi.clearHistory(agentId, threadId);
27277
27527
  if (!response.success) {
27278
27528
  throw new Error(response.error?.message || "Failed to clear conversation history");
27279
27529
  }
27280
- writeSuccess(`\u2705 Conversation history cleared successfully ${context}`);
27281
- console.log(`\u{1F4A1} The chat history has been completely removed ${context}.
27530
+ writeSuccess(`\u2705 Your conversation history has been cleared${threadContext}`);
27531
+ console.log(`\u{1F4A1} Your chat history has been completely removed${threadContext}.
27282
27532
  `);
27283
27533
  trackEvent("cli_chat_cleared", {
27284
27534
  force_mode: force,
27285
- has_user_target: !!targetIdentifier,
27286
27535
  has_thread_target: !!threadId
27287
27536
  });
27288
27537
  }, "chat clear");
@@ -37233,48 +37482,828 @@ init_developer_api_service();
37233
37482
  init_semver();
37234
37483
  init_analytics();
37235
37484
  import inquirer14 from "inquirer";
37236
- async function marketplaceCommand(role, action, options) {
37237
- return withErrorHandling(async () => {
37238
- const { config, apiKey } = await initializeCommand();
37239
- const marketplaceApi = new MarketplaceApiService(apiKey);
37240
- let selectedRole = null;
37241
- if (role) {
37242
- const normalizedRole = validateOrSuggest("marketplace.role", role);
37243
- selectedRole = normalizedRole === "create" ? "creator" : "installer";
37244
- }
37245
- if (selectedRole && action) {
37246
- if (selectedRole === "creator") {
37247
- const normalizedAction = validateOrSuggest("marketplace.action.create", action);
37248
- await executeCreatorActionNonInteractive(marketplaceApi, config, apiKey, normalizedAction, options || {});
37249
- } else {
37250
- const normalizedAction = validateOrSuggest("marketplace.action.install", action);
37251
- await executeInstallerActionNonInteractive(marketplaceApi, config, apiKey, normalizedAction, options || {});
37485
+
37486
+ // src/commands/template.ts
37487
+ init_cli();
37488
+ import { readFileSync as readFileSync13 } from "fs";
37489
+
37490
+ // src/api/template.api.service.ts
37491
+ init_constants();
37492
+ var TemplateApiService = class {
37493
+ static {
37494
+ __name(this, "TemplateApiService");
37495
+ }
37496
+ apiKey;
37497
+ baseUrl = BASE_URLS.API;
37498
+ constructor(apiKey) {
37499
+ this.apiKey = apiKey;
37500
+ }
37501
+ async _fetch(endpoint, options = {}) {
37502
+ const url = `${this.baseUrl}${endpoint}`;
37503
+ const headers = {
37504
+ Authorization: `Bearer ${this.apiKey}`,
37505
+ "Content-Type": "application/json",
37506
+ ...options.headers
37507
+ };
37508
+ const response = await fetch(url, {
37509
+ ...options,
37510
+ headers
37511
+ });
37512
+ if (!response.ok) {
37513
+ const errorText = await response.text();
37514
+ throw new Error(`API Error: ${response.status} ${response.statusText} - ${errorText}`);
37515
+ }
37516
+ if (response.status === 204) {
37517
+ return null;
37518
+ }
37519
+ return response.json();
37520
+ }
37521
+ async createTemplate(data) {
37522
+ return this._fetch("/marketplace/templates", {
37523
+ method: "POST",
37524
+ body: JSON.stringify(data)
37525
+ });
37526
+ }
37527
+ async createVersion(templateId, data) {
37528
+ return this._fetch(`/marketplace/templates/${templateId}/versions`, {
37529
+ method: "POST",
37530
+ body: JSON.stringify(data)
37531
+ });
37532
+ }
37533
+ async listTemplates() {
37534
+ return this._fetch("/marketplace/templates");
37535
+ }
37536
+ async getTemplate(templateId) {
37537
+ return this._fetch(`/marketplace/templates/${templateId}`);
37538
+ }
37539
+ async getVersions(templateId) {
37540
+ return this._fetch(`/marketplace/templates/${templateId}/versions`);
37541
+ }
37542
+ async getVersion(templateId, version) {
37543
+ return this._fetch(`/marketplace/templates/${templateId}/versions/${version}`);
37544
+ }
37545
+ async install(templateId, agentId, data) {
37546
+ return this._fetch(`/marketplace/templates/${templateId}/install/${agentId}`, {
37547
+ method: "POST",
37548
+ body: JSON.stringify(data)
37549
+ });
37550
+ }
37551
+ async apply(templateId, data) {
37552
+ return this._fetch(`/marketplace/templates/${templateId}/apply`, {
37553
+ method: "POST",
37554
+ body: JSON.stringify(data)
37555
+ });
37556
+ }
37557
+ async getApplyRun(templateId, runId) {
37558
+ return this._fetch(`/marketplace/templates/${templateId}/apply-runs/${runId}`);
37559
+ }
37560
+ async getInstalls(templateId, page, limit) {
37561
+ const params = new URLSearchParams();
37562
+ if (page !== void 0) params.set("page", String(page));
37563
+ if (limit !== void 0) params.set("limit", String(limit));
37564
+ const query = params.toString();
37565
+ return this._fetch(`/marketplace/templates/${templateId}/installs${query ? `?${query}` : ""}`);
37566
+ }
37567
+ async getAllInstalls(templateId) {
37568
+ const pageSize = 1e3;
37569
+ const all = [];
37570
+ for (let page = 1; ; page++) {
37571
+ const batch = await this.getInstalls(templateId, page, pageSize);
37572
+ all.push(...batch);
37573
+ if (batch.length < pageSize) return all;
37574
+ }
37575
+ }
37576
+ async getAgentTemplates(agentId) {
37577
+ return this._fetch(`/marketplace/templates/agent/${agentId}`);
37578
+ }
37579
+ async uninstall(templateId, agentId) {
37580
+ return this._fetch(`/marketplace/templates/${templateId}/installs/${agentId}`, {
37581
+ method: "DELETE"
37582
+ });
37583
+ }
37584
+ };
37585
+
37586
+ // src/commands/template.ts
37587
+ init_command_utils();
37588
+ init_analytics();
37589
+ function showTemplateUsage() {
37590
+ console.log("\nUsage:");
37591
+ console.log(" lua marketplace template Interactive mode");
37592
+ console.log(" lua marketplace template <action> [options] Non-interactive mode");
37593
+ console.log("\nActions:");
37594
+ console.log(" create --name <n> --display-name <n> [--description <text>] [--visibility public|private]");
37595
+ console.log(" publish --template-id <id> [--source-version <n>] [--changelog <text>] [--env-contract KEY=desc,...]");
37596
+ console.log(" view --template-id <id> [--version <n>] [--json]");
37597
+ console.log(" versions --template-id <id> [--json]");
37598
+ console.log(" install --template-id <id> [--version <n>] [--env-vars k=v,...] --force");
37599
+ console.log(" apply --template-id <id> [--version <n>] (--agents a,b | --file <path> | --all-installed) --force [--no-wait]");
37600
+ console.log(" status --template-id <id> [--json]");
37601
+ console.log(" installed [--json]");
37602
+ console.log(" uninstall --template-id <id> --force");
37603
+ }
37604
+ __name(showTemplateUsage, "showTemplateUsage");
37605
+ async function templateCommand(action, options = {}) {
37606
+ const { config, apiKey } = await initializeCommand();
37607
+ const templateApi = new TemplateApiService(apiKey);
37608
+ let selectedAction;
37609
+ if (action) {
37610
+ selectedAction = validateOrSuggest("template.action", action);
37611
+ } else {
37612
+ const answer = await safePrompt([
37613
+ {
37614
+ type: "list",
37615
+ name: "action",
37616
+ message: "What would you like to do?",
37617
+ choices: [
37618
+ {
37619
+ name: "Create a template from this agent",
37620
+ value: "create"
37621
+ },
37622
+ {
37623
+ name: "Publish a new template version",
37624
+ value: "publish"
37625
+ },
37626
+ {
37627
+ name: "View a template",
37628
+ value: "view"
37629
+ },
37630
+ {
37631
+ name: "List a template\u2019s versions",
37632
+ value: "versions"
37633
+ },
37634
+ {
37635
+ name: "Install a template onto this agent",
37636
+ value: "install"
37637
+ },
37638
+ {
37639
+ name: "Apply a template to a fleet of agents",
37640
+ value: "apply"
37641
+ },
37642
+ {
37643
+ name: "View a template\u2019s fleet install status",
37644
+ value: "status"
37645
+ },
37646
+ {
37647
+ name: "List templates installed on this agent",
37648
+ value: "installed"
37649
+ },
37650
+ {
37651
+ name: "Uninstall a template from this agent",
37652
+ value: "uninstall"
37653
+ },
37654
+ {
37655
+ name: "Exit",
37656
+ value: "exit"
37657
+ }
37658
+ ]
37252
37659
  }
37660
+ ]);
37661
+ if (!answer || answer.action === "exit") {
37662
+ console.log("\n\u{1F44B} Goodbye!\n");
37253
37663
  return;
37254
37664
  }
37255
- if (selectedRole) {
37256
- if (selectedRole === "creator") {
37257
- await handleCreatorActions(marketplaceApi, config, apiKey);
37258
- } else {
37259
- await handleInstallerActions(marketplaceApi, config, apiKey);
37665
+ selectedAction = answer.action;
37666
+ }
37667
+ switch (selectedAction) {
37668
+ case "create":
37669
+ await templateCreateAction(templateApi, config, options);
37670
+ break;
37671
+ case "publish":
37672
+ await templatePublishAction(templateApi, options);
37673
+ break;
37674
+ case "view":
37675
+ await templateViewAction(templateApi, options);
37676
+ break;
37677
+ case "versions":
37678
+ await templateVersionsAction(templateApi, options);
37679
+ break;
37680
+ case "install":
37681
+ await templateInstallAction(templateApi, config, options);
37682
+ break;
37683
+ case "apply":
37684
+ await templateApplyAction(templateApi, options);
37685
+ break;
37686
+ case "status":
37687
+ await templateStatusAction(templateApi, options);
37688
+ break;
37689
+ case "installed":
37690
+ await templateInstalledAction(templateApi, config, options);
37691
+ break;
37692
+ case "uninstall":
37693
+ await templateUninstallAction(templateApi, config, options);
37694
+ break;
37695
+ default:
37696
+ showTemplateUsage();
37697
+ }
37698
+ trackEvent("cli_template_action", {
37699
+ action: selectedAction,
37700
+ non_interactive: !!action
37701
+ });
37702
+ }
37703
+ __name(templateCommand, "templateCommand");
37704
+ function sleep2(ms) {
37705
+ return new Promise((resolve6) => setTimeout(resolve6, ms));
37706
+ }
37707
+ __name(sleep2, "sleep");
37708
+ async function resolveTemplateId(templateApi, options, message) {
37709
+ if (options.templateId) return options.templateId;
37710
+ writeProgress("\u{1F504} Loading your templates...");
37711
+ const { templates } = await templateApi.listTemplates();
37712
+ if (!templates.length) {
37713
+ throw new Error("You haven't created any templates yet. Run `lua marketplace template create` first.");
37714
+ }
37715
+ const answer = await safePrompt([
37716
+ {
37717
+ type: "list",
37718
+ name: "template",
37719
+ message,
37720
+ choices: templates.map((t) => ({
37721
+ name: `${t.displayName} (${t.name})`,
37722
+ value: t
37723
+ }))
37724
+ }
37725
+ ]);
37726
+ if (!answer) throw new Error("Cancelled.");
37727
+ return answer.template.id;
37728
+ }
37729
+ __name(resolveTemplateId, "resolveTemplateId");
37730
+ function parseKeyValuePairs(raw) {
37731
+ const result = {};
37732
+ for (const pair of raw.split(",")) {
37733
+ const [key, ...valueParts] = pair.split("=");
37734
+ if (key && valueParts.length > 0) {
37735
+ result[key.trim()] = valueParts.join("=").trim();
37736
+ }
37737
+ }
37738
+ return result;
37739
+ }
37740
+ __name(parseKeyValuePairs, "parseKeyValuePairs");
37741
+ function parseEnvContract(raw) {
37742
+ if (!raw || raw.length === 0) return void 0;
37743
+ const result = {};
37744
+ for (const entry of raw) {
37745
+ for (const pair of entry.split(",")) {
37746
+ const trimmed = pair.trim();
37747
+ if (!trimmed) continue;
37748
+ const eqIdx = trimmed.indexOf("=");
37749
+ if (eqIdx === -1) continue;
37750
+ let key = trimmed.slice(0, eqIdx).trim();
37751
+ const description = trimmed.slice(eqIdx + 1).trim();
37752
+ let required = true;
37753
+ if (key.endsWith("?")) {
37754
+ required = false;
37755
+ key = key.slice(0, -1).trim();
37756
+ }
37757
+ if (!key) continue;
37758
+ result[key] = {
37759
+ description,
37760
+ required
37761
+ };
37762
+ }
37763
+ }
37764
+ return Object.keys(result).length > 0 ? result : void 0;
37765
+ }
37766
+ __name(parseEnvContract, "parseEnvContract");
37767
+ function printManifestSummary(content) {
37768
+ console.log(` Skills: ${content.skills.length}`);
37769
+ console.log(` Webhooks: ${content.webhooks.length}`);
37770
+ console.log(` Jobs: ${content.jobs.length}`);
37771
+ console.log(` Preprocessors: ${content.preprocessors.length}`);
37772
+ console.log(` Postprocessors: ${content.postprocessors.length}`);
37773
+ console.log(` Triggers: ${content.triggers.length}`);
37774
+ console.log(` Model: ${content.model ?? "(unchanged)"}`);
37775
+ }
37776
+ __name(printManifestSummary, "printManifestSummary");
37777
+ function printManifestDetail(content, envContract) {
37778
+ const sections = [
37779
+ {
37780
+ name: "Skills",
37781
+ items: content.skills
37782
+ },
37783
+ {
37784
+ name: "Webhooks",
37785
+ items: content.webhooks
37786
+ },
37787
+ {
37788
+ name: "Jobs",
37789
+ items: content.jobs
37790
+ },
37791
+ {
37792
+ name: "Preprocessors",
37793
+ items: content.preprocessors
37794
+ },
37795
+ {
37796
+ name: "Postprocessors",
37797
+ items: content.postprocessors
37798
+ },
37799
+ {
37800
+ name: "Triggers",
37801
+ items: content.triggers
37802
+ }
37803
+ ];
37804
+ for (const { name, items } of sections) {
37805
+ console.log(`
37806
+ ${name}:`);
37807
+ if (items.length === 0) {
37808
+ console.log(" (none)");
37809
+ continue;
37810
+ }
37811
+ for (const item of items) {
37812
+ console.log(` ${item.name ?? item.key} \u2014 v${item.version} (${item.key})`);
37813
+ }
37814
+ }
37815
+ console.log(`
37816
+ Model: ${content.model ?? "(none)"}`);
37817
+ console.log(`
37818
+ Env contract:`);
37819
+ const entries = envContract ? Object.entries(envContract) : [];
37820
+ if (entries.length === 0) {
37821
+ console.log(" (none)");
37822
+ } else {
37823
+ for (const [key, meta] of entries) {
37824
+ const optionalTag = meta.required ? "" : " (optional)";
37825
+ const example = meta.example ? ` \u2014 e.g. ${meta.example}` : "";
37826
+ console.log(` ${key}${optionalTag}: ${meta.description}${example}`);
37827
+ }
37828
+ }
37829
+ }
37830
+ __name(printManifestDetail, "printManifestDetail");
37831
+ async function templateCreateAction(templateApi, config, options) {
37832
+ const agentId = config.agent?.agentId;
37833
+ if (!agentId) throw new Error("Agent ID not found in configuration.");
37834
+ let { name, displayName, description, visibility } = options;
37835
+ if (visibility && visibility !== "public" && visibility !== "private") {
37836
+ throw new Error('Invalid --visibility: must be "public" or "private"');
37837
+ }
37838
+ const questions = [];
37839
+ if (!name) {
37840
+ questions.push({
37841
+ type: "input",
37842
+ name: "name",
37843
+ message: "Template name (internal identifier):",
37844
+ validate: /* @__PURE__ */ __name((input) => input && input.trim().length > 0 ? true : "Name cannot be empty.", "validate")
37845
+ });
37846
+ }
37847
+ if (!displayName) {
37848
+ questions.push({
37849
+ type: "input",
37850
+ name: "displayName",
37851
+ message: "Display name:",
37852
+ validate: /* @__PURE__ */ __name((input) => input && input.trim().length > 0 ? true : "Display name cannot be empty.", "validate")
37853
+ });
37854
+ }
37855
+ if (description === void 0) {
37856
+ questions.push({
37857
+ type: "input",
37858
+ name: "description",
37859
+ message: "Description (optional):"
37860
+ });
37861
+ }
37862
+ if (!visibility) {
37863
+ questions.push({
37864
+ type: "list",
37865
+ name: "visibility",
37866
+ message: "Who can see and install this template?",
37867
+ choices: [
37868
+ {
37869
+ name: "Private \u2014 only your org can find and install it",
37870
+ value: "private"
37871
+ },
37872
+ {
37873
+ name: "Public \u2014 anyone can find and install it",
37874
+ value: "public"
37875
+ }
37876
+ ],
37877
+ default: "private"
37878
+ });
37879
+ }
37880
+ if (questions.length > 0) {
37881
+ const answers = await safePrompt(questions);
37882
+ if (!answers) throw new Error("Cancelled.");
37883
+ name = name ?? answers.name;
37884
+ displayName = displayName ?? answers.displayName;
37885
+ description = description ?? answers.description;
37886
+ visibility = visibility ?? answers.visibility;
37887
+ }
37888
+ if (!name || !displayName) {
37889
+ throw new Error("Missing required options: --name and --display-name");
37890
+ }
37891
+ writeProgress("\u{1F504} Creating template...");
37892
+ const template = await templateApi.createTemplate({
37893
+ sourceAgentId: agentId,
37894
+ name,
37895
+ displayName,
37896
+ description: description || void 0,
37897
+ visibility
37898
+ });
37899
+ if (options.json) {
37900
+ console.log(JSON.stringify(template, null, 2));
37901
+ return;
37902
+ }
37903
+ writeSuccess(`\u2705 Template "${template.displayName}" created!`);
37904
+ writeInfo(`Template ID: ${template.id}`);
37905
+ writeInfo(`Visibility: ${template.visibility === "private" ? "\u{1F512} Private" : "\u{1F310} Public"}`);
37906
+ writeHintBlock({
37907
+ headline: "Publish a version to make it installable:",
37908
+ lines: [
37909
+ {
37910
+ label: "Publish:",
37911
+ command: `lua marketplace template publish --template-id ${template.id}`
37260
37912
  }
37913
+ ],
37914
+ when: "success"
37915
+ });
37916
+ }
37917
+ __name(templateCreateAction, "templateCreateAction");
37918
+ async function templatePublishAction(templateApi, options) {
37919
+ const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to publish a version for?");
37920
+ const sourceAgentVersion = options.sourceVersion ? Number.parseInt(options.sourceVersion, 10) : void 0;
37921
+ if (options.sourceVersion && (!Number.isFinite(sourceAgentVersion) || sourceAgentVersion <= 0)) {
37922
+ throw new Error(`Invalid --source-version "${options.sourceVersion}": must be a positive integer.`);
37923
+ }
37924
+ const envContract = parseEnvContract(options.envContract);
37925
+ writeProgress("\u{1F504} Publishing template version...");
37926
+ const version = await templateApi.createVersion(templateId, {
37927
+ sourceAgentVersion,
37928
+ changelog: options.changelog || void 0,
37929
+ envContract
37930
+ });
37931
+ if (options.json) {
37932
+ console.log(JSON.stringify(version, null, 2));
37933
+ return;
37934
+ }
37935
+ writeSuccess(`\u2705 Published v${version.version}`);
37936
+ writeInfo(`Frozen from agent version v${version.sourceAgentVersion}`);
37937
+ console.log("\nManifest:");
37938
+ printManifestSummary(version.content);
37939
+ const envCount = version.envContract ? Object.keys(version.envContract).length : 0;
37940
+ console.log(` Env contract: ${envCount} var(s)`);
37941
+ }
37942
+ __name(templatePublishAction, "templatePublishAction");
37943
+ async function templateViewAction(templateApi, options) {
37944
+ const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to view?");
37945
+ if (options.version) {
37946
+ const versionNum = Number.parseInt(options.version, 10);
37947
+ if (!Number.isFinite(versionNum) || versionNum <= 0) {
37948
+ throw new Error(`Invalid --version "${options.version}": must be a positive integer.`);
37949
+ }
37950
+ const version = await templateApi.getVersion(templateId, versionNum).catch(() => null);
37951
+ if (!version) throw new Error(`Version v${versionNum} not found for this template.`);
37952
+ if (options.json) {
37953
+ console.log(JSON.stringify(version, null, 2));
37261
37954
  return;
37262
37955
  }
37263
- let exit = false;
37264
- while (!exit) {
37265
- const roleAnswer = await safePrompt([
37956
+ console.log(`
37957
+ ${"=".repeat(60)}`);
37958
+ console.log(`Template v${version.version} \u2014 ${templateId}`);
37959
+ console.log(`${"=".repeat(60)}`);
37960
+ if (version.changelog) console.log(`
37961
+ Changelog: ${version.changelog}`);
37962
+ printManifestDetail(version.content, version.envContract);
37963
+ return;
37964
+ }
37965
+ const template = await templateApi.getTemplate(templateId);
37966
+ if (options.json) {
37967
+ console.log(JSON.stringify(template, null, 2));
37968
+ return;
37969
+ }
37970
+ console.log(`
37971
+ ${"=".repeat(60)}`);
37972
+ console.log(`\u{1F4E6} ${template.displayName}`);
37973
+ console.log(`${"=".repeat(60)}
37974
+ `);
37975
+ console.log(`ID: ${template.id}`);
37976
+ console.log(`Name: ${template.name}`);
37977
+ if (template.description) console.log(`Description: ${template.description}`);
37978
+ console.log(`Visibility: ${template.visibility === "private" ? "\u{1F512} Private" : "\u{1F310} Public"}`);
37979
+ console.log(`Listed: ${template.listed ? "Yes" : "No"}`);
37980
+ console.log(`Installs: ${template.installCount}`);
37981
+ if (template.latestVersion != null) console.log(`Latest version: v${template.latestVersion}`);
37982
+ console.log(`Created: ${new Date(template.createdAt).toLocaleDateString()}`);
37983
+ console.log(`
37984
+ ${"=".repeat(60)}
37985
+ `);
37986
+ }
37987
+ __name(templateViewAction, "templateViewAction");
37988
+ async function templateVersionsAction(templateApi, options) {
37989
+ const templateId = await resolveTemplateId(templateApi, options, "Which template\u2019s versions would you like to see?");
37990
+ const versions = await templateApi.getVersions(templateId);
37991
+ if (options.json) {
37992
+ console.log(JSON.stringify(versions, null, 2));
37993
+ return;
37994
+ }
37995
+ if (versions.length === 0) {
37996
+ writeInfo("(no versions yet \u2014 run `lua marketplace template publish` to make one)");
37997
+ return;
37998
+ }
37999
+ const sorted = [
38000
+ ...versions
38001
+ ].sort((a, b) => b.version - a.version);
38002
+ for (const v of sorted) {
38003
+ console.log(`v${v.version} \u2014 from agent v${v.sourceAgentVersion} \u2014 ${new Date(v.createdAt).toLocaleString()}`);
38004
+ if (v.changelog) console.log(` ${v.changelog}`);
38005
+ }
38006
+ }
38007
+ __name(templateVersionsAction, "templateVersionsAction");
38008
+ async function templateInstallAction(templateApi, config, options) {
38009
+ const agentId = config.agent?.agentId;
38010
+ if (!agentId) throw new Error("Agent ID not found in configuration.");
38011
+ const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to install?");
38012
+ const version = options.version ? Number.parseInt(options.version, 10) : void 0;
38013
+ const envValues = options.envVars ? parseKeyValuePairs(options.envVars) : void 0;
38014
+ if (!options.force) {
38015
+ writeInfo("\n\u{1F4CB} Install Summary:");
38016
+ writeInfo(` Template: ${templateId}`);
38017
+ writeInfo(` Version: ${version ?? "(latest)"}`);
38018
+ writeInfo(` Agent: ${agentId}`);
38019
+ if (envValues && Object.keys(envValues).length > 0) {
38020
+ writeInfo(` Env values: ${Object.keys(envValues).length} configured`);
38021
+ }
38022
+ console.error("\n\u274C Use --force to confirm installation");
38023
+ throw new Error("This action requires --force to confirm");
38024
+ }
38025
+ writeProgress("\u{1F504} Installing template...");
38026
+ const install = await templateApi.install(templateId, agentId, {
38027
+ version,
38028
+ envValues,
38029
+ allowCreatorUpdates: options.allowCreatorUpdates,
38030
+ skipEnvCheck: options.skipEnvCheck
38031
+ });
38032
+ if (options.json) {
38033
+ console.log(JSON.stringify(install, null, 2));
38034
+ return;
38035
+ }
38036
+ writeSuccess(`\u2705 Template installed! (v${install.installedVersion})`);
38037
+ if (install.appliedAgentVersion != null) {
38038
+ writeInfo(`Applied as agent version v${install.appliedAgentVersion}.`);
38039
+ }
38040
+ writeHintBlock({
38041
+ headline: "Roll back this agent to a prior state anytime:",
38042
+ lines: [
38043
+ {
38044
+ label: "Rollback:",
38045
+ command: "lua version promote <n>"
38046
+ }
38047
+ ],
38048
+ when: "success"
38049
+ });
38050
+ }
38051
+ __name(templateInstallAction, "templateInstallAction");
38052
+ function formatApplyResultTable(targets) {
38053
+ const header = {
38054
+ agentId: "AGENT ID",
38055
+ status: "STATUS",
38056
+ localAgentVersion: "LOCAL VERSION",
38057
+ error: "ERROR"
38058
+ };
38059
+ const rows = targets.map((t) => ({
38060
+ agentId: t.agentId,
38061
+ status: t.status,
38062
+ localAgentVersion: t.localAgentVersion != null ? `v${t.localAgentVersion}` : "\u2014",
38063
+ error: t.error ?? ""
38064
+ }));
38065
+ const cols = [
38066
+ "agentId",
38067
+ "status",
38068
+ "localAgentVersion",
38069
+ "error"
38070
+ ];
38071
+ const widths = {};
38072
+ for (const c of cols) {
38073
+ widths[c] = Math.max(header[c].length, ...rows.map((r) => r[c].length));
38074
+ }
38075
+ const fmt = /* @__PURE__ */ __name((r) => cols.map((c) => r[c].padEnd(widths[c])).join(" ").trimEnd(), "fmt");
38076
+ return [
38077
+ fmt(header),
38078
+ ...rows.map(fmt)
38079
+ ];
38080
+ }
38081
+ __name(formatApplyResultTable, "formatApplyResultTable");
38082
+ function resolveApplyTargets(options) {
38083
+ if (options.agents) {
38084
+ return options.agents.split(",").map((s) => s.trim()).filter(Boolean);
38085
+ }
38086
+ if (options.file) {
38087
+ const contents = readFileSync13(options.file, "utf-8");
38088
+ return contents.split("\n").map((s) => s.trim()).filter(Boolean);
38089
+ }
38090
+ return null;
38091
+ }
38092
+ __name(resolveApplyTargets, "resolveApplyTargets");
38093
+ async function templateApplyAction(templateApi, options) {
38094
+ const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to apply?");
38095
+ let targets = resolveApplyTargets(options);
38096
+ if (!targets && options.allInstalled) {
38097
+ writeProgress("\u{1F504} Loading install ledger...");
38098
+ const installs = await templateApi.getAllInstalls(templateId);
38099
+ targets = installs.map((i) => i.agentId);
38100
+ }
38101
+ if (!targets) {
38102
+ throw new Error("Provide targets via --agents <a,b,c>, --file <path>, or --all-installed");
38103
+ }
38104
+ if (targets.length === 0) {
38105
+ writeInfo("No target agents resolved \u2014 nothing to apply.");
38106
+ return;
38107
+ }
38108
+ writeInfo(`Resolved ${targets.length} target agent(s): ${targets.join(", ")}`);
38109
+ const template = await templateApi.getTemplate(templateId);
38110
+ if (!template.latestVersion) {
38111
+ throw new Error("This template has no published versions. Run `lua marketplace template publish` first.");
38112
+ }
38113
+ const versionNum = options.version ? Number.parseInt(options.version, 10) : template.latestVersion;
38114
+ const versionObj = await templateApi.getVersion(templateId, versionNum).catch(() => null);
38115
+ if (!versionObj) throw new Error(`Version v${versionNum} not found for this template.`);
38116
+ if (!options.force) {
38117
+ console.log(`
38118
+ Apply plan:`);
38119
+ console.log(` Template: ${template.displayName} (${templateId})`);
38120
+ console.log(` Version: v${versionObj.version}`);
38121
+ console.log(` Targets: ${targets.length}`);
38122
+ console.log("\nManifest:");
38123
+ printManifestSummary(versionObj.content);
38124
+ const isTTY = Boolean(process.stdin.isTTY && process.stdout.isTTY);
38125
+ const isCi = isCiModeEnabled();
38126
+ if (isTTY && !isCi) {
38127
+ const confirmed = await confirmAction(`
38128
+ Apply v${versionObj.version} to ${targets.length} agent(s)?`);
38129
+ if (!confirmed) {
38130
+ writeInfo("Aborted.");
38131
+ return;
38132
+ }
38133
+ } else {
38134
+ throw new Error("This action requires --force to confirm (non-interactive mode)");
38135
+ }
38136
+ }
38137
+ writeProgress("\u{1F504} Starting apply run...");
38138
+ const { runId } = await templateApi.apply(templateId, {
38139
+ version: versionObj.version,
38140
+ targets,
38141
+ skipEnvCheck: options.skipEnvCheck
38142
+ });
38143
+ if (options.wait === false) {
38144
+ if (options.json) {
38145
+ console.log(JSON.stringify({
38146
+ runId
38147
+ }, null, 2));
38148
+ } else {
38149
+ writeSuccess(`\u2705 Apply run started: ${runId}`);
38150
+ }
38151
+ return;
38152
+ }
38153
+ writeProgress("\u{1F504} Waiting for apply run to complete...");
38154
+ const waitDeadline = Date.now() + 30 * 60 * 1e3;
38155
+ let run = await templateApi.getApplyRun(templateId, runId);
38156
+ while (run.status === "running") {
38157
+ if (Date.now() > waitDeadline) {
38158
+ throw new Error(`Apply run ${runId} still running after 30 minutes \u2014 a crashed worker can leave a run stuck. Check later with: lua marketplace template status --template-id ${templateId}`);
38159
+ }
38160
+ await sleep2(3e3);
38161
+ run = await templateApi.getApplyRun(templateId, runId);
38162
+ }
38163
+ if (options.json) {
38164
+ console.log(JSON.stringify(run, null, 2));
38165
+ } else {
38166
+ console.log(`
38167
+ Apply run ${run.status} (${run.id})`);
38168
+ for (const line of formatApplyResultTable(run.targets)) {
38169
+ console.log(line);
38170
+ }
38171
+ }
38172
+ const failedCount = run.targets.filter((t) => t.status === "failed").length;
38173
+ if (failedCount > 0) {
38174
+ throw new Error(`Apply run finished with ${failedCount} failed target(s).`);
38175
+ }
38176
+ }
38177
+ __name(templateApplyAction, "templateApplyAction");
38178
+ async function templateStatusAction(templateApi, options) {
38179
+ const templateId = await resolveTemplateId(templateApi, options, "Which template\u2019s fleet status would you like to see?");
38180
+ const installs = await templateApi.getAllInstalls(templateId);
38181
+ if (options.json) {
38182
+ console.log(JSON.stringify(installs, null, 2));
38183
+ return;
38184
+ }
38185
+ if (installs.length === 0) {
38186
+ writeInfo("No agents have installed this template yet.");
38187
+ return;
38188
+ }
38189
+ const header = {
38190
+ agentId: "AGENT ID",
38191
+ installedVersion: "TEMPLATE VERSION",
38192
+ appliedAgentVersion: "AGENT VERSION",
38193
+ status: "STATUS",
38194
+ appliedAt: "APPLIED AT"
38195
+ };
38196
+ const rows = installs.map((i) => ({
38197
+ agentId: i.agentId,
38198
+ installedVersion: `v${i.installedVersion}`,
38199
+ appliedAgentVersion: i.appliedAgentVersion != null ? `v${i.appliedAgentVersion}` : "\u2014",
38200
+ status: i.status,
38201
+ appliedAt: new Date(i.appliedAt).toISOString().slice(0, 16).replace("T", " ")
38202
+ }));
38203
+ const cols = [
38204
+ "agentId",
38205
+ "installedVersion",
38206
+ "appliedAgentVersion",
38207
+ "status",
38208
+ "appliedAt"
38209
+ ];
38210
+ const widths = {};
38211
+ for (const c of cols) {
38212
+ widths[c] = Math.max(header[c].length, ...rows.map((r) => r[c].length));
38213
+ }
38214
+ const fmt = /* @__PURE__ */ __name((r) => cols.map((c) => r[c].padEnd(widths[c])).join(" ").trimEnd(), "fmt");
38215
+ console.log(fmt(header));
38216
+ for (const r of rows) console.log(fmt(r));
38217
+ writeInfo("\n\u{1F4A1} Per-agent rollback: run `lua version promote <n>` directly on that agent.");
38218
+ }
38219
+ __name(templateStatusAction, "templateStatusAction");
38220
+ async function templateInstalledAction(templateApi, config, options) {
38221
+ const agentId = config.agent?.agentId;
38222
+ if (!agentId) throw new Error("Agent ID not found in configuration.");
38223
+ const summaries = await templateApi.getAgentTemplates(agentId);
38224
+ if (options.json) {
38225
+ console.log(JSON.stringify(summaries, null, 2));
38226
+ return;
38227
+ }
38228
+ if (summaries.length === 0) {
38229
+ writeInfo("\u{1F4E6} No templates installed on this agent.");
38230
+ return;
38231
+ }
38232
+ console.log(`
38233
+ \u{1F4CA} ${summaries.length} template(s) installed on this agent:
38234
+ `);
38235
+ for (const s of summaries) {
38236
+ console.log(`\u{1F4E6} ${s.displayName} (${s.templateId})`);
38237
+ console.log(` Installed version: v${s.installedVersion}`);
38238
+ console.log(` Status: ${s.status}`);
38239
+ console.log(` Applied: ${new Date(s.appliedAt).toLocaleString()}`);
38240
+ console.log("");
38241
+ }
38242
+ }
38243
+ __name(templateInstalledAction, "templateInstalledAction");
38244
+ async function templateUninstallAction(templateApi, config, options) {
38245
+ const agentId = config.agent?.agentId;
38246
+ if (!agentId) throw new Error("Agent ID not found in configuration.");
38247
+ const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to uninstall?");
38248
+ if (!options.force) {
38249
+ console.error(`
38250
+ \u274C Use --force to confirm uninstalling template ${templateId} from this agent`);
38251
+ throw new Error("This action requires --force to confirm");
38252
+ }
38253
+ writeProgress("\u{1F504} Uninstalling template...");
38254
+ await templateApi.uninstall(templateId, agentId);
38255
+ writeSuccess("\u2705 Template uninstalled from this agent.");
38256
+ }
38257
+ __name(templateUninstallAction, "templateUninstallAction");
38258
+
38259
+ // src/commands/marketplace.ts
38260
+ var SKILL_ACTIONS = [
38261
+ "list",
38262
+ "publish",
38263
+ "edit",
38264
+ "unlist",
38265
+ "unpublish",
38266
+ "mine",
38267
+ "search",
38268
+ "view",
38269
+ "install",
38270
+ "update",
38271
+ "uninstall",
38272
+ "installed"
38273
+ ];
38274
+ var INTERACTIVE_SKILL_ACTIONS = SKILL_ACTIONS.filter((a) => a !== "view");
38275
+ var SKILL_ACTION_LABELS = {
38276
+ search: "Browse & search for skills",
38277
+ install: "Install a skill",
38278
+ update: "Update an installed skill",
38279
+ uninstall: "Uninstall a skill",
38280
+ installed: "List installed skills",
38281
+ list: "List a new skill on the Marketplace",
38282
+ publish: "Publish a new version of a skill",
38283
+ edit: "Edit metadata for a listed skill",
38284
+ unlist: "Unlist a skill from the Marketplace",
38285
+ unpublish: "Unpublish a skill version",
38286
+ mine: "View my listed skills"
38287
+ };
38288
+ async function marketplaceCommand(noun, action, options = {}) {
38289
+ return withErrorHandling(async () => {
38290
+ let domain;
38291
+ if (noun) {
38292
+ domain = validateOrSuggest("marketplace.noun", noun);
38293
+ } else {
38294
+ const domainAnswer = await safePrompt([
37266
38295
  {
37267
38296
  type: "list",
37268
- name: "role",
37269
- message: "What would you like to do?",
38297
+ name: "domain",
38298
+ message: "What would you like to browse?",
37270
38299
  choices: [
37271
38300
  {
37272
- name: "As a Creator (Publish & Manage your skills)",
37273
- value: "creator"
38301
+ name: "Skills",
38302
+ value: "skill"
37274
38303
  },
37275
38304
  {
37276
- name: "As an Installer (Find & Install skills)",
37277
- value: "installer"
38305
+ name: "Agent templates",
38306
+ value: "template"
37278
38307
  },
37279
38308
  {
37280
38309
  name: "Exit",
@@ -37283,26 +38312,67 @@ async function marketplaceCommand(role, action, options) {
37283
38312
  ]
37284
38313
  }
37285
38314
  ]);
37286
- if (!roleAnswer || roleAnswer.role === "exit") {
37287
- exit = true;
38315
+ if (!domainAnswer || domainAnswer.domain === "exit") {
37288
38316
  console.log("\n\u{1F44B} Goodbye!\n");
37289
- continue;
38317
+ return;
37290
38318
  }
37291
- if (roleAnswer.role === "creator") {
37292
- await handleCreatorActions(marketplaceApi, config, apiKey);
37293
- } else if (roleAnswer.role === "installer") {
37294
- await handleInstallerActions(marketplaceApi, config, apiKey);
38319
+ domain = domainAnswer.domain;
38320
+ }
38321
+ if (domain === "template") {
38322
+ return templateCommand(action, options);
38323
+ }
38324
+ return skillMarketplaceCommand(action, options);
38325
+ }, "marketplace");
38326
+ }
38327
+ __name(marketplaceCommand, "marketplaceCommand");
38328
+ async function skillMarketplaceCommand(action, options = {}) {
38329
+ const { config, apiKey } = await initializeCommand();
38330
+ const marketplaceApi = new MarketplaceApiService(apiKey);
38331
+ if (action) {
38332
+ const selectedAction = validateOrSuggest("marketplace.skill.action", action);
38333
+ await executeSkillActionNonInteractive(marketplaceApi, config, apiKey, selectedAction, options);
38334
+ trackEvent("cli_marketplace_action", {
38335
+ domain: "skill",
38336
+ action: selectedAction,
38337
+ non_interactive: true
38338
+ });
38339
+ return;
38340
+ }
38341
+ let exit = false;
38342
+ while (!exit) {
38343
+ const answer = await safePrompt([
38344
+ {
38345
+ type: "list",
38346
+ name: "action",
38347
+ message: "What would you like to do?",
38348
+ choices: [
38349
+ ...INTERACTIVE_SKILL_ACTIONS.map((a) => ({
38350
+ name: SKILL_ACTION_LABELS[a],
38351
+ value: a
38352
+ })),
38353
+ {
38354
+ name: "Exit",
38355
+ value: "exit"
38356
+ }
38357
+ ]
37295
38358
  }
38359
+ ]);
38360
+ if (!answer || answer.action === "exit") {
38361
+ exit = true;
38362
+ console.log("\n\u{1F44B} Goodbye!\n");
38363
+ continue;
37296
38364
  }
38365
+ const selectedAction = answer.action;
38366
+ await executeSkillActionInteractive(marketplaceApi, config, apiKey, selectedAction);
37297
38367
  trackEvent("cli_marketplace_action", {
37298
- role: role || "interactive",
37299
- action: action || null,
37300
- non_interactive: !!(selectedRole && action)
38368
+ domain: "skill",
38369
+ action: selectedAction,
38370
+ non_interactive: false
37301
38371
  });
37302
- }, "marketplace");
38372
+ }
37303
38373
  }
37304
- __name(marketplaceCommand, "marketplaceCommand");
37305
- async function executeCreatorActionNonInteractive(marketplaceApi, config, apiKey, action, options) {
38374
+ __name(skillMarketplaceCommand, "skillMarketplaceCommand");
38375
+ async function executeSkillActionNonInteractive(marketplaceApi, config, apiKey, action, options) {
37306
38376
  switch (action) {
37307
38377
  case "list":
37308
38378
  await listSkillNonInteractive(marketplaceApi, config, apiKey, options);
@@ -37310,7 +38380,7 @@ async function executeCreatorActionNonInteractive(marketplaceApi, config, apiKey
37310
38380
  case "publish":
37311
38381
  await publishVersionNonInteractive(marketplaceApi, config, apiKey, options);
37312
38382
  break;
37313
- case "update":
38383
+ case "edit":
37314
38384
  await updateMetadataNonInteractive(marketplaceApi, options);
37315
38385
  break;
37316
38386
  case "unlist":
@@ -37319,14 +38389,9 @@ async function executeCreatorActionNonInteractive(marketplaceApi, config, apiKey
37319
38389
  case "unpublish":
37320
38390
  await unpublishVersionNonInteractive(marketplaceApi, options);
37321
38391
  break;
37322
- case "view":
38392
+ case "mine":
37323
38393
  await viewMyListedSkillsNonInteractive(marketplaceApi, options);
37324
38394
  break;
37325
- }
37326
- }
37327
- __name(executeCreatorActionNonInteractive, "executeCreatorActionNonInteractive");
37328
- async function executeInstallerActionNonInteractive(marketplaceApi, config, apiKey, action, options) {
37329
- switch (action) {
37330
38395
  case "search":
37331
38396
  await searchSkillsNonInteractive(marketplaceApi, options);
37332
38397
  break;
@@ -37347,14 +38412,58 @@ async function executeInstallerActionNonInteractive(marketplaceApi, config, apiK
37347
38412
  break;
37348
38413
  }
37349
38414
  }
37350
- __name(executeInstallerActionNonInteractive, "executeInstallerActionNonInteractive");
38415
+ __name(executeSkillActionNonInteractive, "executeSkillActionNonInteractive");
38416
+ async function executeSkillActionInteractive(marketplaceApi, config, apiKey, action) {
38417
+ switch (action) {
38418
+ case "list":
38419
+ await listSkillOnMarketplace(marketplaceApi, config, apiKey);
38420
+ break;
38421
+ case "publish":
38422
+ await publishSkillVersion(marketplaceApi, config, apiKey);
38423
+ break;
38424
+ case "edit":
38425
+ await updateSkillMetadata(marketplaceApi, config);
38426
+ break;
38427
+ case "unlist":
38428
+ await unlistSkillFromMarketplace(marketplaceApi);
38429
+ break;
38430
+ case "unpublish":
38431
+ await unpublishSkillVersion(marketplaceApi);
38432
+ break;
38433
+ case "mine":
38434
+ await viewMyListedSkills(marketplaceApi);
38435
+ break;
38436
+ case "search":
38437
+ await searchMarketplaceSkills(marketplaceApi);
38438
+ break;
38439
+ case "install":
38440
+ await installMarketplaceSkill(marketplaceApi, config, apiKey);
38441
+ break;
38442
+ case "update":
38443
+ await updateInstalledSkill(marketplaceApi, config, apiKey);
38444
+ break;
38445
+ case "uninstall":
38446
+ await uninstallMarketplaceSkill(marketplaceApi, config);
38447
+ break;
38448
+ case "installed":
38449
+ await listInstalledSkills(marketplaceApi, config);
38450
+ break;
38451
+ case "view":
38452
+ break;
38453
+ }
38454
+ }
38455
+ __name(executeSkillActionInteractive, "executeSkillActionInteractive");
37351
38456
  async function listSkillNonInteractive(marketplaceApi, config, apiKey, options) {
37352
- const { skillName, displayName } = options;
38457
+ const { skillName, displayName, visibility } = options;
37353
38458
  if (!skillName || !displayName) {
37354
38459
  console.error("\u274C Missing required options");
37355
- console.log("\nUsage: lua marketplace create list --skill-name <name> --display-name <name>");
38460
+ console.log("\nUsage: lua marketplace skill list --skill-name <name> --display-name <name>");
37356
38461
  throw new Error("Missing required options");
37357
38462
  }
38463
+ if (visibility && visibility !== "public" && visibility !== "private") {
38464
+ console.error('\u274C Invalid --visibility: must be "public" or "private"');
38465
+ throw new Error('Invalid --visibility: must be "public" or "private"');
38466
+ }
37358
38467
  const agentId = config.agent?.agentId;
37359
38468
  if (!agentId) {
37360
38469
  console.error("\u274C Agent ID not found in configuration.");
@@ -37385,10 +38494,12 @@ async function listSkillNonInteractive(marketplaceApi, config, apiKey, options)
37385
38494
  writeProgress("\u{1F504} Listing skill on marketplace...");
37386
38495
  const marketplaceSkill = await marketplaceApi.listSkill({
37387
38496
  skillId: skill.id,
37388
- displayName
38497
+ displayName,
38498
+ visibility
37389
38499
  });
37390
38500
  writeSuccess(`\u2705 Skill "${marketplaceSkill.displayName}" listed successfully!`);
37391
38501
  writeInfo(`Marketplace Skill ID: ${marketplaceSkill.id}`);
38502
+ writeInfo(`Visibility: ${marketplaceSkill.visibility === "private" ? "\u{1F512} Private" : "\u{1F310} Public"}`);
37392
38503
  writeInfo("\u{1F4A1} You can now publish a version to make it installable.");
37393
38504
  }
37394
38505
  __name(listSkillNonInteractive, "listSkillNonInteractive");
@@ -37396,7 +38507,7 @@ async function publishVersionNonInteractive(marketplaceApi, config, apiKey, opti
37396
38507
  const { marketplaceId, versionId, changelog, envVarsJson } = options;
37397
38508
  if (!marketplaceId || !versionId) {
37398
38509
  console.error("\u274C Missing required options");
37399
- console.log("\nUsage: lua marketplace create publish --marketplace-id <id> --version-id <id> [--changelog <text>]");
38510
+ console.log("\nUsage: lua marketplace skill publish --marketplace-id <id> --version-id <id> [--changelog <text>]");
37400
38511
  throw new Error("Missing required options");
37401
38512
  }
37402
38513
  let envVars;
@@ -37423,7 +38534,7 @@ async function updateMetadataNonInteractive(marketplaceApi, options) {
37423
38534
  const { marketplaceId, displayName } = options;
37424
38535
  if (!marketplaceId) {
37425
38536
  console.error("\u274C Missing required option: --marketplace-id");
37426
- console.log("\nUsage: lua marketplace create update --marketplace-id <id> --display-name <name>");
38537
+ console.log("\nUsage: lua marketplace skill edit --marketplace-id <id> --display-name <name>");
37427
38538
  throw new Error("Missing required option: --marketplace-id");
37428
38539
  }
37429
38540
  if (!displayName) {
@@ -37441,12 +38552,12 @@ async function unlistSkillNonInteractive(marketplaceApi, options) {
37441
38552
  const { marketplaceId, force } = options;
37442
38553
  if (!marketplaceId) {
37443
38554
  console.error("\u274C Missing required option: --marketplace-id");
37444
- console.log("\nUsage: lua marketplace create unlist --marketplace-id <id> [--force]");
38555
+ console.log("\nUsage: lua marketplace skill unlist --marketplace-id <id> [--force]");
37445
38556
  throw new Error("Missing required option: --marketplace-id");
37446
38557
  }
37447
38558
  if (!force) {
37448
38559
  console.error("\u274C This action requires --force to confirm");
37449
- console.log("\nUsage: lua marketplace create unlist --marketplace-id <id> --force");
38560
+ console.log("\nUsage: lua marketplace skill unlist --marketplace-id <id> --force");
37450
38561
  throw new Error("This action requires --force to confirm");
37451
38562
  }
37452
38563
  writeProgress("\u{1F504} Unlisting skill...");
@@ -37459,7 +38570,7 @@ async function unpublishVersionNonInteractive(marketplaceApi, options) {
37459
38570
  const { marketplaceId, versionId, force } = options;
37460
38571
  if (!marketplaceId || !versionId) {
37461
38572
  console.error("\u274C Missing required options");
37462
- console.log("\nUsage: lua marketplace create unpublish --marketplace-id <id> --version-id <id> [--force]");
38573
+ console.log("\nUsage: lua marketplace skill unpublish --marketplace-id <id> --version-id <id> [--force]");
37463
38574
  throw new Error("Missing required options");
37464
38575
  }
37465
38576
  if (!force) {
@@ -37492,6 +38603,7 @@ async function viewMyListedSkillsNonInteractive(marketplaceApi, options) {
37492
38603
  console.log(`${statusIcon} ${skill.displayName} (${skill.name})`);
37493
38604
  console.log(` ID: ${skill.id}`);
37494
38605
  console.log(` Status: ${statusText}`);
38606
+ console.log(` Visibility: ${skill.visibility === "private" ? "\u{1F512} Private" : "\u{1F310} Public"}`);
37495
38607
  if (skill.versions && skill.versions.length > 0) {
37496
38608
  const publishedVersions = skill.versions.filter((v) => v.published);
37497
38609
  console.log(` Versions: ${publishedVersions.length} published / ${skill.versions.length} total`);
@@ -37540,7 +38652,7 @@ async function viewSkillNonInteractive(marketplaceApi, options) {
37540
38652
  const { marketplaceId } = options;
37541
38653
  if (!marketplaceId) {
37542
38654
  console.error("\u274C Missing required option: --marketplace-id");
37543
- console.log("\nUsage: lua marketplace install view --marketplace-id <id>");
38655
+ console.log("\nUsage: lua marketplace skill view --marketplace-id <id>");
37544
38656
  throw new Error("Missing required option: --marketplace-id");
37545
38657
  }
37546
38658
  writeProgress("\u{1F504} Loading skill details...");
@@ -37584,7 +38696,7 @@ async function installSkillNonInteractive(marketplaceApi, config, options) {
37584
38696
  const { marketplaceId, versionId, envVars, force } = options;
37585
38697
  if (!marketplaceId || !versionId) {
37586
38698
  console.error("\u274C Missing required options");
37587
- console.log("\nUsage: lua marketplace install install --marketplace-id <id> --version-id <id> [--env-vars <k=v,...>]");
38699
+ console.log("\nUsage: lua marketplace skill install --marketplace-id <id> --version-id <id> [--env-vars <k=v,...>]");
37588
38700
  throw new Error("Missing required options");
37589
38701
  }
37590
38702
  const agentId = config.agent?.agentId;
@@ -37641,7 +38753,7 @@ async function updateInstalledSkillNonInteractive(marketplaceApi, config, apiKey
37641
38753
  const { skillName, versionId, envVars } = options;
37642
38754
  if (!skillName) {
37643
38755
  console.error("\u274C Missing required option: --skill-name");
37644
- console.log("\nUsage: lua marketplace install update --skill-name <name> [--version-id <id>] [--env-vars <k=v,...>]");
38756
+ console.log("\nUsage: lua marketplace skill update --skill-name <name> [--version-id <id>] [--env-vars <k=v,...>]");
37645
38757
  throw new Error("Missing required option: --skill-name");
37646
38758
  }
37647
38759
  const agentId = config.agent?.agentId;
@@ -37693,7 +38805,7 @@ async function uninstallSkillNonInteractive(marketplaceApi, config, options) {
37693
38805
  const { skillName, force } = options;
37694
38806
  if (!skillName) {
37695
38807
  console.error("\u274C Missing required option: --skill-name");
37696
- console.log("\nUsage: lua marketplace install uninstall --skill-name <name> [--force]");
38808
+ console.log("\nUsage: lua marketplace skill uninstall --skill-name <name> [--force]");
37697
38809
  throw new Error("Missing required option: --skill-name");
37698
38810
  }
37699
38811
  const agentId = config.agent?.agentId;
@@ -37756,86 +38868,6 @@ async function listInstalledSkillsNonInteractive(marketplaceApi, config, options
37756
38868
  }
37757
38869
  }
37758
38870
  __name(listInstalledSkillsNonInteractive, "listInstalledSkillsNonInteractive");
37759
- async function handleCreatorActions(marketplaceApi, config, apiKey) {
37760
- let back = false;
37761
- while (!back) {
37762
- const creatorAnswer = await safePrompt([
37763
- {
37764
- type: "list",
37765
- name: "action",
37766
- message: "Creator Menu:",
37767
- choices: [
37768
- {
37769
- name: "List a new skill on the Marketplace",
37770
- value: "list"
37771
- },
37772
- {
37773
- name: "Publish a new version of a skill",
37774
- value: "publish"
37775
- },
37776
- {
37777
- name: "Update metadata for a listed skill",
37778
- value: "update"
37779
- },
37780
- {
37781
- name: "Unlist a skill from the Marketplace",
37782
- value: "unlist"
37783
- },
37784
- {
37785
- name: "Unpublish a skill version",
37786
- value: "unpublish"
37787
- },
37788
- {
37789
- name: "View my listed skills",
37790
- value: "view"
37791
- },
37792
- {
37793
- name: "Back",
37794
- value: "back"
37795
- }
37796
- ]
37797
- }
37798
- ]);
37799
- if (!creatorAnswer || creatorAnswer.action === "back") {
37800
- back = true;
37801
- continue;
37802
- }
37803
- switch (creatorAnswer.action) {
37804
- case "list":
37805
- await listSkillOnMarketplace(marketplaceApi, config, apiKey);
37806
- continue;
37807
- case "publish":
37808
- await publishSkillVersion(marketplaceApi, config, apiKey);
37809
- continue;
37810
- case "update":
37811
- await updateSkillMetadata(marketplaceApi, config);
37812
- continue;
37813
- case "unlist":
37814
- await unlistSkillFromMarketplace(marketplaceApi);
37815
- continue;
37816
- case "unpublish":
37817
- await unpublishSkillVersion(marketplaceApi);
37818
- continue;
37819
- case "view":
37820
- await viewMyListedSkills(marketplaceApi);
37821
- continue;
37822
- // Other cases will be added here
37823
- default:
37824
- console.log(`
37825
- Action '${creatorAnswer.action}' is not implemented yet.
37826
- `);
37827
- await safePrompt([
37828
- {
37829
- type: "input",
37830
- name: "continue",
37831
- message: "Press Enter to continue..."
37832
- }
37833
- ]);
37834
- continue;
37835
- }
37836
- }
37837
- }
37838
- __name(handleCreatorActions, "handleCreatorActions");
37839
38871
  async function listSkillOnMarketplace(marketplaceApi, config, apiKey) {
37840
38872
  const agentId = config.agent?.agentId;
37841
38873
  if (!agentId) {
@@ -37898,9 +38930,29 @@ async function listSkillOnMarketplace(marketplaceApi, config, apiKey) {
37898
38930
  }
37899
38931
  ]);
37900
38932
  if (!metadata) return;
38933
+ const visibilityAnswer = await safePrompt([
38934
+ {
38935
+ type: "list",
38936
+ name: "visibility",
38937
+ message: "Who can see and install this skill?",
38938
+ choices: [
38939
+ {
38940
+ name: "Public \u2014 anyone can find and install it",
38941
+ value: "public"
38942
+ },
38943
+ {
38944
+ name: "Private \u2014 only you (and your org) can find and install it",
38945
+ value: "private"
38946
+ }
38947
+ ],
38948
+ default: "public"
38949
+ }
38950
+ ]);
38951
+ if (!visibilityAnswer) return;
37901
38952
  const payload = {
37902
38953
  skillId: skillToList.id,
37903
- displayName: metadata.displayName
38954
+ displayName: metadata.displayName,
38955
+ visibility: visibilityAnswer.visibility
37904
38956
  };
37905
38957
  try {
37906
38958
  writeProgress("\nListing skill on the marketplace...");
@@ -37908,6 +38960,7 @@ async function listSkillOnMarketplace(marketplaceApi, config, apiKey) {
37908
38960
  writeSuccess(`
37909
38961
  \u2705 Skill "${marketplaceSkill.displayName}" listed successfully!`);
37910
38962
  writeInfo(`Marketplace Skill ID: ${marketplaceSkill.id}`);
38963
+ writeInfo(`Visibility: ${marketplaceSkill.visibility === "private" ? "\u{1F512} Private" : "\u{1F310} Public"}`);
37911
38964
  writeInfo("\u{1F4A1} You can now publish a version to make it installable.\n");
37912
38965
  } catch (error) {
37913
38966
  console.error(`
@@ -38278,6 +39331,7 @@ async function viewMyListedSkills(marketplaceApi) {
38278
39331
  const statusText = skill.listed ? "Listed" : "Unlisted";
38279
39332
  console.log(`${statusIcon} ${skill.displayName} (${skill.name})`);
38280
39333
  console.log(` Status: ${statusText}`);
39334
+ console.log(` Visibility: ${skill.visibility === "private" ? "\u{1F512} Private" : "\u{1F310} Public"}`);
38281
39335
  if (skill.description) {
38282
39336
  console.log(` Description: ${skill.description}`);
38283
39337
  }
@@ -38509,79 +39563,6 @@ async function configureEnvVar(varName, envVars) {
38509
39563
  `);
38510
39564
  }
38511
39565
  __name(configureEnvVar, "configureEnvVar");
38512
- async function handleInstallerActions(marketplaceApi, config, apiKey) {
38513
- let back = false;
38514
- while (!back) {
38515
- const installerAnswer = await safePrompt([
38516
- {
38517
- type: "list",
38518
- name: "action",
38519
- message: "Installer Menu:",
38520
- choices: [
38521
- {
38522
- name: "Browse & Search for skills",
38523
- value: "search"
38524
- },
38525
- {
38526
- name: "Install a skill from the Marketplace",
38527
- value: "install"
38528
- },
38529
- {
38530
- name: "Update an installed skill",
38531
- value: "update"
38532
- },
38533
- {
38534
- name: "Uninstall a skill",
38535
- value: "uninstall"
38536
- },
38537
- {
38538
- name: "List my currently installed skills",
38539
- value: "installed"
38540
- },
38541
- {
38542
- name: "Back",
38543
- value: "back"
38544
- }
38545
- ]
38546
- }
38547
- ]);
38548
- if (!installerAnswer || installerAnswer.action === "back") {
38549
- back = true;
38550
- continue;
38551
- }
38552
- switch (installerAnswer.action) {
38553
- case "search":
38554
- await searchMarketplaceSkills(marketplaceApi);
38555
- continue;
38556
- case "install":
38557
- await installMarketplaceSkill(marketplaceApi, config, apiKey);
38558
- continue;
38559
- case "update":
38560
- await updateInstalledSkill(marketplaceApi, config, apiKey);
38561
- continue;
38562
- case "uninstall":
38563
- await uninstallMarketplaceSkill(marketplaceApi, config);
38564
- continue;
38565
- case "installed":
38566
- await listInstalledSkills(marketplaceApi, config);
38567
- continue;
38568
- // Other cases will be added here
38569
- default:
38570
- console.log(`
38571
- Action '${installerAnswer.action}' is not implemented yet.
38572
- `);
38573
- await safePrompt([
38574
- {
38575
- type: "input",
38576
- name: "continue",
38577
- message: "Press Enter to continue..."
38578
- }
38579
- ]);
38580
- continue;
38581
- }
38582
- }
38583
- }
38584
- __name(handleInstallerActions, "handleInstallerActions");
38585
39566
  var MARKETPLACE_PAGE_SIZE = 10;
38586
39567
  async function browseAndSelectSkill(marketplaceApi, purpose, publishedVersionsOnly) {
38587
39568
  try {
@@ -44946,20 +45927,21 @@ Examples:
44946
45927
  }
44947
45928
  __name(setupAuthCommands, "setupAuthCommands");
44948
45929
  function setupMarketplaceCommands(program2) {
44949
- program2.command("marketplace [role] [action]").description("\u{1F6CD}\uFE0F Browse, install, and manage marketplace skills").option("--skill-name <name>", "Skill name (for creator list, installer update/uninstall)").option("--display-name <name>", "Display name (for creator list/update)").option("--marketplace-id <id>", "Marketplace skill ID").option("--version-id <id>", "Version ID (for publish/install)").option("--changelog <text>", "Changelog for version (for publish)").option("--env-vars-json <json>", "JSON string with env var metadata (for creator publish)").option("--env-vars <pairs>", "Comma-separated key=value pairs (for installer)").option("--query <text>", "Search query (for search)").option("--page <n>", "Page number (for search)").option("--limit <n>", "Results per page (for search)").option("--json", "Output as JSON").option("--force", "Skip confirmation prompts").addHelpText("after", `
45930
+ 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("--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("--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) => [
45931
+ ...previous,
45932
+ val
45933
+ ], []).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", "Skip env-contract validation (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").addHelpText("after", `
44950
45934
  Arguments:
44951
- role Optional: 'create' or 'install' (prompts if not provided)
45935
+ noun Optional: 'skill' or 'template' (prompts if not provided)
44952
45936
  action Optional: specific action for non-interactive mode
44953
45937
 
44954
- Creator Actions:
44955
- list --skill-name <name> --display-name <name>
45938
+ Skill Actions:
45939
+ list --skill-name <name> --display-name <name> [--visibility public|private]
44956
45940
  publish --marketplace-id <id> --version-id <id> [--changelog <text>] [--env-vars-json <json>]
44957
- update --marketplace-id <id> --display-name <name>
45941
+ edit --marketplace-id <id> --display-name <name>
44958
45942
  unlist --marketplace-id <id> --force
44959
45943
  unpublish --marketplace-id <id> --version-id <id> --force
44960
- view [--json]
44961
-
44962
- Installer Actions:
45944
+ mine [--json]
44963
45945
  search [--query <text>] [--page <n>] [--limit <n>] [--json]
44964
45946
  view --marketplace-id <id> [--json]
44965
45947
  install --marketplace-id <id> --version-id <id> [--env-vars <k=v,...>] --force
@@ -44967,18 +45949,32 @@ Installer Actions:
44967
45949
  uninstall --skill-name <name> --force
44968
45950
  installed [--json]
44969
45951
 
45952
+ Template Actions:
45953
+ create --name <n> --display-name <n> [--description <text>] [--visibility public|private]
45954
+ publish --template-id <id> [--source-version <n>] [--changelog <text>] [--env-contract KEY=desc,...]
45955
+ view --template-id <id> [--version <n>] [--json]
45956
+ versions --template-id <id> [--json]
45957
+ install --template-id <id> [--version <n>] [--env-vars <k=v,...>] --force
45958
+ apply --template-id <id> [--version <n>] (--agents <a,b,c> | --file <path> | --all-installed) --force [--no-wait]
45959
+ status --template-id <id> [--json]
45960
+ installed [--json]
45961
+ uninstall --template-id <id> --force
45962
+
44970
45963
  Examples:
44971
- $ lua marketplace Interactive selection
44972
- $ lua marketplace create Creator menu
44973
- $ lua marketplace install Installer menu
44974
- $ lua marketplace create view View my listed skills
44975
- $ lua marketplace create list --skill-name mySkill --display-name "My Skill"
44976
- $ lua marketplace create publish --marketplace-id xyz --version-id v1
44977
- $ lua marketplace create unlist --marketplace-id xyz --force
44978
- $ lua marketplace install search --query "CRM"
44979
- $ lua marketplace install view --marketplace-id xyz --json
44980
- $ lua marketplace install install --marketplace-id xyz --version-id v1 --force
44981
- $ lua marketplace install installed --json
45964
+ $ lua marketplace Interactive domain selection
45965
+ $ lua marketplace skill Skill action menu
45966
+ $ lua marketplace skill mine View my listed skills
45967
+ $ lua marketplace skill list --skill-name mySkill --display-name "My Skill"
45968
+ $ lua marketplace skill publish --marketplace-id xyz --version-id v1
45969
+ $ lua marketplace skill unlist --marketplace-id xyz --force
45970
+ $ lua marketplace skill search --query "CRM"
45971
+ $ lua marketplace skill view --marketplace-id xyz --json
45972
+ $ lua marketplace skill install --marketplace-id xyz --version-id v1 --force
45973
+ $ lua marketplace skill installed --json
45974
+ $ lua marketplace template Template action menu
45975
+ $ lua marketplace template create --name support-bot --display-name "Support Bot"
45976
+ $ lua marketplace template publish --template-id xyz --changelog "Add refund skill"
45977
+ $ lua marketplace template apply --template-id xyz --all-installed --force
44982
45978
  `).action(marketplaceCommand);
44983
45979
  }
44984
45980
  __name(setupMarketplaceCommands, "setupMarketplaceCommands");
@@ -45121,20 +46117,16 @@ Examples:
45121
46117
  $ lua chat -b "Hello" "What is the weather?" "Tell me a joke" -d 2000 -e sandbox Batch test
45122
46118
  $ lua chat --agent-version 3 -m "test" Preview agent version 3 in an isolated thread
45123
46119
  `).action(chatCommand);
45124
- chatCmd.command("clear").description("Clear conversation history").option("--user <identifier>", "User ID, email, or mobile number of the user whose history to clear").option("-t, --thread <id>", "Clear a specific thread's history instead of all history").option("--force", "Skip confirmation prompt").addHelpText("after", `
46120
+ chatCmd.command("clear").description("Clear your conversation history").option("--user <identifier>", "[removed] cross-user history clear is no longer supported").option("-t, --thread <id>", "Clear a specific thread's history instead of all history").option("--force", "Skip confirmation prompt").addHelpText("after", `
45125
46121
  Examples:
45126
- $ lua chat clear Clear history
45127
- $ lua chat clear --force Clear history without confirmation
45128
- $ lua chat clear --user <userId> Clear user's history by user ID
45129
- $ lua chat clear --user <email> Clear user's history by email
45130
- $ lua chat clear --user <mobile> Clear user's history by mobile number
45131
- $ lua chat clear --user <userId> --force Clear user's history without confirmation
46122
+ $ lua chat clear Clear your history
46123
+ $ lua chat clear --force Clear your history without confirmation
45132
46124
  $ lua chat clear --thread <threadId> Clear a specific thread's history
45133
46125
  $ lua chat clear --thread <threadId> --force Clear a specific thread's history without confirmation
45134
46126
 
45135
46127
  Notes:
45136
- - User identifier can be UUID, email address, or mobile number
45137
- - Mobile numbers should be in international format without + (e.g., 919876543210)
46128
+ - This command only clears YOUR OWN conversation history
46129
+ - The --user option was removed: cross-user history clear is no longer supported
45138
46130
  `).action(chatClearCommand);
45139
46131
  program2.command("env [environment]").description("\u2699\uFE0F Manage environment variables").option("-k, --key <name>", "Environment variable key").option("-v, --value <value>", "Environment variable value").option("-d, --delete", "Delete the specified key").option("--list", "List all environment variables").addHelpText("after", `
45140
46132
  Arguments:
@@ -45689,7 +46681,7 @@ if (isBareInvocation || isHelpInvocation) {
45689
46681
  });
45690
46682
  }
45691
46683
  var program = new Command();
45692
- program.showSuggestionAfterError().name("lua").description("Lua AI - Build and deploy AI agents with superpowers").version(CLI_VERSION).option("--ci", "CI/CD mode: fail loudly on missing required flags instead of prompting").addHelpText("after", `
46684
+ program.showSuggestionAfterError().name("lua").description("Lua AI - Build and deploy AI agents with superpowers").version(CLI_VERSION, "-V, --cli-version").option("--ci", "CI/CD mode: fail loudly on missing required flags instead of prompting").addHelpText("after", `
45693
46685
  Categories:
45694
46686
  \u{1F510} Authentication Manage API keys and authentication
45695
46687
  \u{1F680} Project Setup Initialize and configure projects
@@ -45731,7 +46723,8 @@ Examples:
45731
46723
  $ lua evals \u{1F4CA} Open evaluations dashboard
45732
46724
  $ lua docs \u{1F4D6} Open documentation
45733
46725
  $ lua completion \u{1F3AF} Enable shell autocomplete
45734
- $ lua marketplace \u{1F6CD}\uFE0F Interact with the Lua Marketplace
46726
+ $ lua marketplace \u{1F6CD}\uFE0F Interact with the Lua Marketplace (skills & agent templates)
46727
+ $ lua marketplace template \u{1F9E9} Create, publish, and apply marketplace agent templates
45735
46728
 
45736
46729
  \u{1F319} Documentation: https://docs.heylua.ai
45737
46730
  \u{1F319} Support: https://heylua.ai/support
@@ -45745,5 +46738,10 @@ program.hook("preAction", (thisCommand) => {
45745
46738
  setupAuthCommands(program);
45746
46739
  setupSkillCommands(program);
45747
46740
  setupMarketplaceCommands(program);
46741
+ var rawArgs = process.argv.slice(2);
46742
+ if (rawArgs.length === 1 && rawArgs[0] === "--version") {
46743
+ console.log(CLI_VERSION);
46744
+ process.exit(0);
46745
+ }
45748
46746
  program.parse(process.argv);
45749
46747
  //# sourceMappingURL=index.js.map