@lumerahq/cli 0.32.8 → 0.32.9-dev.1

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  userContextHeaders
3
- } from "./chunk-ZJ7M7JD3.js";
3
+ } from "./chunk-W57NUJFJ.js";
4
4
  import {
5
5
  fetchWithRetry
6
6
  } from "./chunk-FJFIWC7G.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createApiClient,
6
6
  isApiErrorStatus
7
- } from "./chunk-ZJ7M7JD3.js";
7
+ } from "./chunk-W57NUJFJ.js";
8
8
  import {
9
9
  findProjectRoot,
10
10
  getAppName
@@ -281,6 +281,13 @@ var ApiClient = class {
281
281
  });
282
282
  }
283
283
  // Agents
284
+ async getModels() {
285
+ const result = await this.request("/api/models");
286
+ return {
287
+ models: result.models || [],
288
+ deprecated_models: result.deprecated_models || []
289
+ };
290
+ }
284
291
  async listAgents(opts) {
285
292
  const params = new URLSearchParams({ limit: "100" });
286
293
  if (opts?.project_id) params.set("project_id", opts.project_id);
@@ -2,9 +2,9 @@ import {
2
2
  deps,
3
3
  syncDeps,
4
4
  syncResourceShareDeps
5
- } from "./chunk-HS63O4MH.js";
5
+ } from "./chunk-5JNNUIVJ.js";
6
6
  import "./chunk-2CR762KB.js";
7
- import "./chunk-ZJ7M7JD3.js";
7
+ import "./chunk-W57NUJFJ.js";
8
8
  import "./chunk-JLVVHTBY.js";
9
9
  import "./chunk-FJFIWC7G.js";
10
10
  import "./chunk-PNKVD2UK.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  dev
3
- } from "./chunk-KE26WWAQ.js";
3
+ } from "./chunk-3MAALYAP.js";
4
4
  import {
5
5
  syncDeps
6
- } from "./chunk-HS63O4MH.js";
6
+ } from "./chunk-5JNNUIVJ.js";
7
7
  import {
8
8
  loadEnv
9
9
  } from "./chunk-2CR762KB.js";
10
10
  import {
11
11
  createApiClient
12
- } from "./chunk-ZJ7M7JD3.js";
12
+ } from "./chunk-W57NUJFJ.js";
13
13
  import {
14
14
  findProjectRoot,
15
15
  getApiUrl,
package/dist/index.js CHANGED
@@ -242,32 +242,32 @@ async function main() {
242
242
  switch (command) {
243
243
  // Resource commands
244
244
  case "plan":
245
- await import("./resources-G4EVBRZV.js").then((m) => m.plan(args.slice(1)));
245
+ await import("./resources-IIOCZU23.js").then((m) => m.plan(args.slice(1)));
246
246
  break;
247
247
  case "apply":
248
- await import("./resources-G4EVBRZV.js").then((m) => m.apply(args.slice(1)));
248
+ await import("./resources-IIOCZU23.js").then((m) => m.apply(args.slice(1)));
249
249
  break;
250
250
  case "pull":
251
- await import("./resources-G4EVBRZV.js").then((m) => m.pull(args.slice(1)));
251
+ await import("./resources-IIOCZU23.js").then((m) => m.pull(args.slice(1)));
252
252
  break;
253
253
  case "destroy":
254
- await import("./resources-G4EVBRZV.js").then((m) => m.destroy(args.slice(1)));
254
+ await import("./resources-IIOCZU23.js").then((m) => m.destroy(args.slice(1)));
255
255
  break;
256
256
  case "list":
257
- await import("./resources-G4EVBRZV.js").then((m) => m.list(args.slice(1)));
257
+ await import("./resources-IIOCZU23.js").then((m) => m.list(args.slice(1)));
258
258
  break;
259
259
  case "show":
260
- await import("./resources-G4EVBRZV.js").then((m) => m.show(args.slice(1)));
260
+ await import("./resources-IIOCZU23.js").then((m) => m.show(args.slice(1)));
261
261
  break;
262
262
  case "diff":
263
- await import("./resources-G4EVBRZV.js").then((m) => m.diff(args.slice(1)));
263
+ await import("./resources-IIOCZU23.js").then((m) => m.diff(args.slice(1)));
264
264
  break;
265
265
  // Development
266
266
  case "dev":
267
- await import("./dev-ANVS25HB.js").then((m) => m.dev(args.slice(1)));
267
+ await import("./dev-CGQTW7TN.js").then((m) => m.dev(args.slice(1)));
268
268
  break;
269
269
  case "run":
270
- await import("./run-7KJPBOIY.js").then((m) => m.run(args.slice(1)));
270
+ await import("./run-4XFA5ZDJ.js").then((m) => m.run(args.slice(1)));
271
271
  break;
272
272
  case "functions":
273
273
  await import("./functions-PH4ZJA7U.js").then(
@@ -281,10 +281,10 @@ async function main() {
281
281
  break;
282
282
  // Project
283
283
  case "init":
284
- await import("./init-KACYHD23.js").then((m) => m.init(args.slice(1)));
284
+ await import("./init-S42P4A5J.js").then((m) => m.init(args.slice(1)));
285
285
  break;
286
286
  case "register":
287
- await import("./register-ZXNNU3NJ.js").then((m) => m.register(args.slice(1)));
287
+ await import("./register-GMWA4D4C.js").then((m) => m.register(args.slice(1)));
288
288
  break;
289
289
  case "templates":
290
290
  await import("./templates-LNUOTNLN.js").then((m) => m.templates(subcommand, args.slice(2)));
@@ -301,7 +301,7 @@ async function main() {
301
301
  break;
302
302
  // Dependencies
303
303
  case "deps":
304
- await import("./deps-SIZ77NYE.js").then((m) => m.deps(args.slice(1)));
304
+ await import("./deps-TNGT6JVD.js").then((m) => m.deps(args.slice(1)));
305
305
  break;
306
306
  // Feature flags (read the in-sandbox snapshot)
307
307
  case "flags":
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  createApiClient,
14
14
  validateProjectNameLength
15
- } from "./chunk-ZJ7M7JD3.js";
15
+ } from "./chunk-W57NUJFJ.js";
16
16
  import {
17
17
  getToken,
18
18
  init_auth,
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  createApiClient,
9
9
  validateProjectExternalId
10
- } from "./chunk-ZJ7M7JD3.js";
10
+ } from "./chunk-W57NUJFJ.js";
11
11
  import {
12
12
  findProjectRoot,
13
13
  getAppName,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  deploy,
3
3
  deployAppAPI
4
- } from "./chunk-KE26WWAQ.js";
4
+ } from "./chunk-3MAALYAP.js";
5
5
  import {
6
6
  syncDeps
7
- } from "./chunk-HS63O4MH.js";
7
+ } from "./chunk-5JNNUIVJ.js";
8
8
  import {
9
9
  loadEnv
10
10
  } from "./chunk-2CR762KB.js";
@@ -13,7 +13,7 @@ import {
13
13
  createApiClient,
14
14
  isApiErrorStatus,
15
15
  validateCollectionNameLength
16
- } from "./chunk-ZJ7M7JD3.js";
16
+ } from "./chunk-W57NUJFJ.js";
17
17
  import {
18
18
  findProjectRoot,
19
19
  getApiUrl,
@@ -40,6 +40,31 @@ import { dirname as dirname2, join as join2, resolve } from "path";
40
40
  import { existsSync, readFileSync, readdirSync } from "fs";
41
41
  import { basename, dirname, join } from "path";
42
42
 
43
+ // src/lib/lint/rules/agent-deprecated-model.ts
44
+ function configuredModel(config) {
45
+ if (typeof config !== "object" || config === null || Array.isArray(config)) {
46
+ return "";
47
+ }
48
+ const model = config.model;
49
+ return typeof model === "string" ? model.trim() : "";
50
+ }
51
+ var agentDeprecatedModelRule = {
52
+ id: "agent-deprecated-model",
53
+ description: "Warns when an agent model is internally routed to a replacement model.",
54
+ appliesTo: ["agent-config"],
55
+ check(target, ctx) {
56
+ const model = configuredModel(target.config);
57
+ const targetModel = ctx.deprecatedModelRoutes?.[model];
58
+ if (!model || !targetModel) return [];
59
+ return [{
60
+ ruleId: "agent-deprecated-model",
61
+ target,
62
+ severity: "warning",
63
+ message: `Model \`${model}\` is deprecated and internally routed to \`${targetModel}\`. Update this agent's config.json to use the replacement model.`
64
+ }];
65
+ }
66
+ };
67
+
43
68
  // src/lib/lint/compile-diagnostics.ts
44
69
  function compileDiagnostic(value) {
45
70
  if (!value || typeof value !== "object") return void 0;
@@ -860,6 +885,7 @@ var llmImportRule = {
860
885
 
861
886
  // src/lib/lint/registry.ts
862
887
  var ALL_RULES = [
888
+ agentDeprecatedModelRule,
863
889
  agentPolicyCompileRule,
864
890
  automationConfigRule,
865
891
  automationMainGuardRule,
@@ -974,46 +1000,84 @@ function buildHookTargets(platformDir, filterName) {
974
1000
  }
975
1001
  return targets;
976
1002
  }
977
- function buildAgentPolicyTargets(platformDir, filterName, appName) {
1003
+ function resolveAgentLintFiles(platformDir, filterName, appName) {
978
1004
  const agentsDir = join(platformDir, "agents");
979
1005
  if (!existsSync(agentsDir)) return [];
980
- const targets = [];
1006
+ const agents = [];
981
1007
  for (const entry of readdirSync(agentsDir, { withFileTypes: true })) {
982
1008
  if (!entry.isDirectory()) continue;
983
- const agentDir = join(agentsDir, entry.name);
984
- const policyPath = join(agentDir, "policy.js");
985
- const hasPolicyFile = existsSync(policyPath);
1009
+ const directoryPath = join(agentsDir, entry.name);
1010
+ const configPath = join(directoryPath, "config.json");
1011
+ let configSource;
1012
+ let config;
986
1013
  let externalID = appName ? `${appName}:${entry.name}` : "";
987
1014
  let displayName = "";
988
1015
  let policyEnabled = false;
989
- const configPath = join(agentDir, "config.json");
990
1016
  if (existsSync(configPath)) {
1017
+ configSource = readFileSync(configPath, "utf-8");
991
1018
  try {
992
- const config = JSON.parse(readFileSync(configPath, "utf-8"));
993
- if (typeof config.external_id === "string" && config.external_id.trim()) {
994
- externalID = config.external_id;
995
- }
996
- if (typeof config.name === "string") {
997
- displayName = config.name;
1019
+ config = JSON.parse(configSource);
1020
+ if (typeof config === "object" && config !== null && !Array.isArray(config)) {
1021
+ const values = config;
1022
+ if (typeof values.external_id === "string" && values.external_id.trim()) {
1023
+ externalID = values.external_id;
1024
+ }
1025
+ if (typeof values.name === "string") {
1026
+ displayName = values.name;
1027
+ }
1028
+ policyEnabled = values.policy_enabled === true;
998
1029
  }
999
- policyEnabled = config.policy_enabled === true;
1000
1030
  } catch {
1001
1031
  }
1002
1032
  }
1003
- if (!hasPolicyFile && !policyEnabled) continue;
1004
1033
  if (filterName && entry.name !== filterName && externalID !== filterName && displayName !== filterName) {
1005
1034
  continue;
1006
1035
  }
1036
+ agents.push({
1037
+ directoryPath,
1038
+ configPath,
1039
+ configSource,
1040
+ config,
1041
+ name: externalID || displayName || entry.name,
1042
+ policyEnabled
1043
+ });
1044
+ }
1045
+ return agents;
1046
+ }
1047
+ function agentConfigTargets(agents) {
1048
+ const targets = [];
1049
+ for (const agent of agents) {
1050
+ if (agent.configSource === void 0) continue;
1051
+ targets.push({
1052
+ kind: "agent-config",
1053
+ name: agent.name,
1054
+ filePath: agent.configPath,
1055
+ source: agent.configSource,
1056
+ config: agent.config
1057
+ });
1058
+ }
1059
+ return targets;
1060
+ }
1061
+ function agentPolicyTargets(agents) {
1062
+ const targets = [];
1063
+ for (const agent of agents) {
1064
+ const policyPath = join(agent.directoryPath, "policy.js");
1065
+ const hasPolicyFile = existsSync(policyPath);
1066
+ if (!hasPolicyFile && !agent.policyEnabled) continue;
1007
1067
  targets.push({
1008
1068
  kind: "agent-policy",
1009
- name: externalID || displayName || entry.name,
1069
+ name: agent.name,
1010
1070
  filePath: policyPath,
1011
1071
  source: hasPolicyFile ? readFileSync(policyPath, "utf-8") : "",
1012
- config: { policyEnabled }
1072
+ config: { policyEnabled: agent.policyEnabled }
1013
1073
  });
1014
1074
  }
1015
1075
  return targets;
1016
1076
  }
1077
+ function buildAgentTargets(platformDir, filterName, appName) {
1078
+ const agents = resolveAgentLintFiles(platformDir, filterName, appName);
1079
+ return [...agentConfigTargets(agents), ...agentPolicyTargets(agents)];
1080
+ }
1017
1081
 
1018
1082
  // src/commands/resources.ts
1019
1083
  init_auth();
@@ -1065,17 +1129,30 @@ async function lintHookFiles(api, projectRoot, platformDir, appName, filterName)
1065
1129
  throw new Error(`Found ${result.errors.length} hook lint error(s)`);
1066
1130
  }
1067
1131
  }
1068
- async function lintAgentPolicyFiles(api, projectRoot, platformDir, appName, filterName) {
1069
- const result = await safeLintPass("agent policy", async () => {
1070
- const targets = buildAgentPolicyTargets(platformDir, filterName, appName);
1132
+ async function lintAgentFiles(api, projectRoot, platformDir, appName, filterName, printWarnings = true) {
1133
+ const result = await safeLintPass("agent", async () => {
1134
+ const targets = buildAgentTargets(platformDir, filterName, appName);
1071
1135
  if (targets.length === 0) return [];
1072
- return runLint({ projectRoot, targets, api, appName });
1136
+ const deprecatedModelRoutes = {};
1137
+ try {
1138
+ for (const model of (await api.getModels()).deprecated_models) {
1139
+ deprecatedModelRoutes[model.id] = model.routed_to;
1140
+ }
1141
+ } catch (err) {
1142
+ if (process.env.LUMERA_DEBUG) {
1143
+ console.error("[lint] unable to load deprecated model routes:", err);
1144
+ }
1145
+ }
1146
+ return runLint({ projectRoot, targets, api, appName, deprecatedModelRoutes });
1073
1147
  });
1074
- if (!result || result.issues.length === 0) return;
1075
- safePrintLint(result.issues, projectRoot);
1148
+ if (!result || result.issues.length === 0) return [];
1149
+ if (printWarnings || result.errors.length > 0) {
1150
+ safePrintLint(result.issues, projectRoot);
1151
+ }
1076
1152
  if (result.errors.length > 0) {
1077
- throw new Error(`Found ${result.errors.length} agent policy lint error(s)`);
1153
+ throw new Error(`Found ${result.errors.length} agent lint error(s)`);
1078
1154
  }
1155
+ return result.issues;
1079
1156
  }
1080
1157
  var PACKAGE_MANAGERS = ["bun", "pnpm", "yarn", "npm"];
1081
1158
  var PACKAGE_MANAGER_VALUE_FLAGS = /* @__PURE__ */ new Set(["--package-manager"]);
@@ -4233,8 +4310,16 @@ async function plan(args) {
4233
4310
  if (!type || type === "hooks") {
4234
4311
  await lintHookFiles(api, projectRoot, platformDir, appName, name || void 0);
4235
4312
  }
4313
+ let agentLintWarnings = [];
4236
4314
  if (!type || type === "agents") {
4237
- await lintAgentPolicyFiles(api, projectRoot, platformDir, appName, name || void 0);
4315
+ agentLintWarnings = await lintAgentFiles(
4316
+ api,
4317
+ projectRoot,
4318
+ platformDir,
4319
+ appName,
4320
+ name || void 0,
4321
+ false
4322
+ );
4238
4323
  }
4239
4324
  await syncDeps(projectRoot, { ignorePermissionDenied: true });
4240
4325
  const allChanges = [];
@@ -4290,7 +4375,10 @@ async function plan(args) {
4290
4375
  allChanges.push(...changes);
4291
4376
  }
4292
4377
  }
4293
- const lintWarnings = await safeLint(projectRoot, localAutomations);
4378
+ const lintWarnings = [
4379
+ ...agentLintWarnings,
4380
+ ...await safeLint(projectRoot, localAutomations)
4381
+ ];
4294
4382
  if (allChanges.length === 0) {
4295
4383
  if (jsonOutput) {
4296
4384
  console.log(JSON.stringify({ changes: [], warnings: [], validationErrors: planValidationErrors, lintWarnings: serializeLintWarnings(lintWarnings, projectRoot) }));
@@ -4418,7 +4506,7 @@ async function apply(args) {
4418
4506
  await lintHookFiles(api, projectRoot, platformDir, appName, name || void 0);
4419
4507
  }
4420
4508
  if (!type || type === "agents") {
4421
- await lintAgentPolicyFiles(api, projectRoot, platformDir, appName, name || void 0);
4509
+ await lintAgentFiles(api, projectRoot, platformDir, appName, name || void 0);
4422
4510
  }
4423
4511
  await syncDeps(projectRoot, { ignorePermissionDenied: true });
4424
4512
  let collections;
@@ -5064,6 +5152,7 @@ export {
5064
5152
  convertCollectionToApiFormat,
5065
5153
  destroy,
5066
5154
  diff,
5155
+ lintAgentFiles,
5067
5156
  list,
5068
5157
  loadLocalCollections,
5069
5158
  loadLocalSkills,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-2CR762KB.js";
4
4
  import {
5
5
  createApiClient
6
- } from "./chunk-ZJ7M7JD3.js";
6
+ } from "./chunk-W57NUJFJ.js";
7
7
  import {
8
8
  findProjectRoot,
9
9
  getApiUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/cli",
3
- "version": "0.32.8",
3
+ "version": "0.32.9-dev.1",
4
4
  "description": "CLI for building and deploying Lumera apps",
5
5
  "type": "module",
6
6
  "engines": {