@lumerahq/cli 0.19.17 → 0.19.19
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/{chunk-MDCAEFUH.js → chunk-ML7XB7Z2.js} +8 -0
- package/dist/{chunk-VOIZWYZD.js → chunk-PY4J2U2M.js} +21 -3
- package/dist/{chunk-4WZMUFC7.js → chunk-S7FJU4GM.js} +1 -1
- package/dist/{deps-KVHWZARX.js → deps-H4QYLGM7.js} +2 -2
- package/dist/{dev-PONRO7VN.js → dev-O6TXHGAK.js} +3 -3
- package/dist/index.js +12 -12
- package/dist/{init-KJOWD2KQ.js → init-HUV5ZJAE.js} +1 -1
- package/dist/{register-QBRKXWNX.js → register-OZDOFUPF.js} +1 -1
- package/dist/{resources-M6R2RFSW.js → resources-FLFD64X2.js} +18 -4
- package/dist/{run-R6MO23U7.js → run-NR3725J2.js} +1 -1
- package/package.json +1 -1
|
@@ -25,6 +25,12 @@ while (__pkgDir !== "/") {
|
|
|
25
25
|
}
|
|
26
26
|
var pkg = JSON.parse(readFileSync(resolve(__pkgDir, "package.json"), "utf-8"));
|
|
27
27
|
var CLI_USER_AGENT = `lumera-cli/${pkg.version}`;
|
|
28
|
+
var USER_CONTEXT_ENV = "LUMERA_USER_ID";
|
|
29
|
+
var USER_CONTEXT_HEADER = "X-Lumera-User-Id";
|
|
30
|
+
function userContextHeaders() {
|
|
31
|
+
const userID = process.env[USER_CONTEXT_ENV]?.trim();
|
|
32
|
+
return userID ? { [USER_CONTEXT_HEADER]: userID } : {};
|
|
33
|
+
}
|
|
28
34
|
var ApiError = class extends Error {
|
|
29
35
|
status;
|
|
30
36
|
body;
|
|
@@ -67,6 +73,7 @@ var ApiClient = class {
|
|
|
67
73
|
"User-Agent": CLI_USER_AGENT,
|
|
68
74
|
"X-Lumera-Client": "lumera-cli",
|
|
69
75
|
...this.projectExternalId ? { "X-Lumera-Project": this.projectExternalId } : {},
|
|
76
|
+
...userContextHeaders(),
|
|
70
77
|
...options.headers
|
|
71
78
|
};
|
|
72
79
|
const method = (options.method || "GET").toUpperCase();
|
|
@@ -357,6 +364,7 @@ function createApiClient(token, baseUrl, projectExternalId) {
|
|
|
357
364
|
}
|
|
358
365
|
|
|
359
366
|
export {
|
|
367
|
+
userContextHeaders,
|
|
360
368
|
ApiError,
|
|
361
369
|
isApiErrorStatus,
|
|
362
370
|
createApiClient
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
userContextHeaders
|
|
3
|
+
} from "./chunk-ML7XB7Z2.js";
|
|
1
4
|
import {
|
|
2
5
|
fetchWithRetry
|
|
3
6
|
} from "./chunk-FJFIWC7G.js";
|
|
@@ -38,6 +41,16 @@ function resolveVersion(cwd) {
|
|
|
38
41
|
}
|
|
39
42
|
return formatTimestampVersion();
|
|
40
43
|
}
|
|
44
|
+
function resolveGitSha(cwd) {
|
|
45
|
+
try {
|
|
46
|
+
return execSync("git rev-parse HEAD", {
|
|
47
|
+
cwd,
|
|
48
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
49
|
+
}).toString().trim();
|
|
50
|
+
} catch {
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
41
54
|
async function createTarball(distDir) {
|
|
42
55
|
return new Promise((resolve2, reject) => {
|
|
43
56
|
const chunks = [];
|
|
@@ -56,7 +69,8 @@ async function ensureAppRecord(apiBase, token, appName, appTitle) {
|
|
|
56
69
|
{
|
|
57
70
|
headers: {
|
|
58
71
|
Authorization: `Bearer ${token}`,
|
|
59
|
-
"X-Lumera-Client": "lumera-cli"
|
|
72
|
+
"X-Lumera-Client": "lumera-cli",
|
|
73
|
+
...userContextHeaders()
|
|
60
74
|
}
|
|
61
75
|
}
|
|
62
76
|
);
|
|
@@ -75,7 +89,8 @@ async function ensureAppRecord(apiBase, token, appName, appTitle) {
|
|
|
75
89
|
headers: {
|
|
76
90
|
Authorization: `Bearer ${token}`,
|
|
77
91
|
"Content-Type": "application/json",
|
|
78
|
-
"X-Lumera-Client": "lumera-cli"
|
|
92
|
+
"X-Lumera-Client": "lumera-cli",
|
|
93
|
+
...userContextHeaders()
|
|
79
94
|
},
|
|
80
95
|
body: JSON.stringify(appData)
|
|
81
96
|
});
|
|
@@ -104,11 +119,14 @@ async function deploy(options) {
|
|
|
104
119
|
const formData = new FormData();
|
|
105
120
|
formData.append("tarball", new Blob([new Uint8Array(tarball)]), "dist.tar.gz");
|
|
106
121
|
formData.append("version", version);
|
|
122
|
+
const gitSha = resolveGitSha(dirname(distDir));
|
|
123
|
+
if (gitSha) formData.append("git_sha", gitSha);
|
|
107
124
|
const res = await fetchWithRetry(`${apiUrl}/custom-apps/${appName}/deploy`, {
|
|
108
125
|
method: "POST",
|
|
109
126
|
headers: {
|
|
110
127
|
Authorization: `Bearer ${token}`,
|
|
111
|
-
"X-Lumera-Client": "lumera-cli"
|
|
128
|
+
"X-Lumera-Client": "lumera-cli",
|
|
129
|
+
...userContextHeaders()
|
|
112
130
|
},
|
|
113
131
|
body: formData
|
|
114
132
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deps,
|
|
3
3
|
syncDeps
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-S7FJU4GM.js";
|
|
5
5
|
import "./chunk-2CR762KB.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-ML7XB7Z2.js";
|
|
7
7
|
import "./chunk-ZH3NVYEQ.js";
|
|
8
8
|
import "./chunk-FJFIWC7G.js";
|
|
9
9
|
import "./chunk-PNKVD2UK.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dev
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PY4J2U2M.js";
|
|
4
4
|
import {
|
|
5
5
|
syncDeps
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S7FJU4GM.js";
|
|
7
7
|
import {
|
|
8
8
|
loadEnv
|
|
9
9
|
} from "./chunk-2CR762KB.js";
|
|
10
10
|
import {
|
|
11
11
|
createApiClient
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ML7XB7Z2.js";
|
|
13
13
|
import {
|
|
14
14
|
findProjectRoot,
|
|
15
15
|
getApiUrl,
|
package/dist/index.js
CHANGED
|
@@ -219,39 +219,39 @@ async function main() {
|
|
|
219
219
|
switch (command) {
|
|
220
220
|
// Resource commands
|
|
221
221
|
case "plan":
|
|
222
|
-
await import("./resources-
|
|
222
|
+
await import("./resources-FLFD64X2.js").then((m) => m.plan(args.slice(1)));
|
|
223
223
|
break;
|
|
224
224
|
case "apply":
|
|
225
|
-
await import("./resources-
|
|
225
|
+
await import("./resources-FLFD64X2.js").then((m) => m.apply(args.slice(1)));
|
|
226
226
|
break;
|
|
227
227
|
case "pull":
|
|
228
|
-
await import("./resources-
|
|
228
|
+
await import("./resources-FLFD64X2.js").then((m) => m.pull(args.slice(1)));
|
|
229
229
|
break;
|
|
230
230
|
case "destroy":
|
|
231
|
-
await import("./resources-
|
|
231
|
+
await import("./resources-FLFD64X2.js").then((m) => m.destroy(args.slice(1)));
|
|
232
232
|
break;
|
|
233
233
|
case "list":
|
|
234
|
-
await import("./resources-
|
|
234
|
+
await import("./resources-FLFD64X2.js").then((m) => m.list(args.slice(1)));
|
|
235
235
|
break;
|
|
236
236
|
case "show":
|
|
237
|
-
await import("./resources-
|
|
237
|
+
await import("./resources-FLFD64X2.js").then((m) => m.show(args.slice(1)));
|
|
238
238
|
break;
|
|
239
239
|
case "diff":
|
|
240
|
-
await import("./resources-
|
|
240
|
+
await import("./resources-FLFD64X2.js").then((m) => m.diff(args.slice(1)));
|
|
241
241
|
break;
|
|
242
242
|
// Development
|
|
243
243
|
case "dev":
|
|
244
|
-
await import("./dev-
|
|
244
|
+
await import("./dev-O6TXHGAK.js").then((m) => m.dev(args.slice(1)));
|
|
245
245
|
break;
|
|
246
246
|
case "run":
|
|
247
|
-
await import("./run-
|
|
247
|
+
await import("./run-NR3725J2.js").then((m) => m.run(args.slice(1)));
|
|
248
248
|
break;
|
|
249
249
|
// Project
|
|
250
250
|
case "init":
|
|
251
|
-
await import("./init-
|
|
251
|
+
await import("./init-HUV5ZJAE.js").then((m) => m.init(args.slice(1)));
|
|
252
252
|
break;
|
|
253
253
|
case "register":
|
|
254
|
-
await import("./register-
|
|
254
|
+
await import("./register-OZDOFUPF.js").then((m) => m.register(args.slice(1)));
|
|
255
255
|
break;
|
|
256
256
|
case "templates":
|
|
257
257
|
await import("./templates-LNUOTNLN.js").then((m) => m.templates(subcommand, args.slice(2)));
|
|
@@ -268,7 +268,7 @@ async function main() {
|
|
|
268
268
|
break;
|
|
269
269
|
// Dependencies
|
|
270
270
|
case "deps":
|
|
271
|
-
await import("./deps-
|
|
271
|
+
await import("./deps-H4QYLGM7.js").then((m) => m.deps(args.slice(1)));
|
|
272
272
|
break;
|
|
273
273
|
// Auth
|
|
274
274
|
case "login":
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deploy
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PY4J2U2M.js";
|
|
4
4
|
import {
|
|
5
5
|
syncDeps
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S7FJU4GM.js";
|
|
7
7
|
import {
|
|
8
8
|
loadEnv
|
|
9
9
|
} from "./chunk-2CR762KB.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiError,
|
|
12
12
|
createApiClient
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ML7XB7Z2.js";
|
|
14
14
|
import {
|
|
15
15
|
findProjectRoot,
|
|
16
16
|
getApiUrl,
|
|
@@ -805,6 +805,8 @@ function stripNamespacePrefix(name, appName) {
|
|
|
805
805
|
}
|
|
806
806
|
return name;
|
|
807
807
|
}
|
|
808
|
+
var AGENT_IDLE_REAP_TIMEOUT_MIN_SECONDS = 10;
|
|
809
|
+
var AGENT_IDLE_REAP_TIMEOUT_MAX_SECONDS = 900;
|
|
808
810
|
function buildCollectionIdMap(collections, appName) {
|
|
809
811
|
const result = /* @__PURE__ */ new Map();
|
|
810
812
|
const add = (key, id) => {
|
|
@@ -2222,6 +2224,13 @@ function loadLocalAgents(platformDir, filterName, appName) {
|
|
|
2222
2224
|
errors.push(`${entry.name}: missing name in config.json`);
|
|
2223
2225
|
continue;
|
|
2224
2226
|
}
|
|
2227
|
+
if (config.idle_reap_timeout_seconds !== void 0) {
|
|
2228
|
+
const seconds = config.idle_reap_timeout_seconds;
|
|
2229
|
+
if (!Number.isInteger(seconds) || seconds !== 0 && (seconds < AGENT_IDLE_REAP_TIMEOUT_MIN_SECONDS || seconds > AGENT_IDLE_REAP_TIMEOUT_MAX_SECONDS)) {
|
|
2230
|
+
errors.push(`${entry.name}: idle_reap_timeout_seconds must be 0 or between ${AGENT_IDLE_REAP_TIMEOUT_MIN_SECONDS} and ${AGENT_IDLE_REAP_TIMEOUT_MAX_SECONDS}`);
|
|
2231
|
+
continue;
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2225
2234
|
let systemPrompt = readFileSync2(promptPath, "utf-8");
|
|
2226
2235
|
let policyScript = existsSync2(policyPath) ? readFileSync2(policyPath, "utf-8") : "";
|
|
2227
2236
|
if (appName) {
|
|
@@ -2291,6 +2300,7 @@ async function planAgents(api, localAgents, projectId) {
|
|
|
2291
2300
|
if ((remote.description || "") !== (agent.description || "")) diffs.push("description");
|
|
2292
2301
|
if ((remote.system_prompt || "").trim() !== systemPrompt.trim()) diffs.push("system_prompt");
|
|
2293
2302
|
if ((remote.model || "") !== (agent.model || "")) diffs.push("model");
|
|
2303
|
+
if ((remote.idle_reap_timeout_seconds ?? 0) !== (agent.idle_reap_timeout_seconds ?? 0)) diffs.push("idle_reap_timeout_seconds");
|
|
2294
2304
|
if ((remote.policy_script || "").trim() !== (policyScript || "").trim()) diffs.push("policy_script");
|
|
2295
2305
|
if ((remote.policy_enabled || false) !== (agent.policy_enabled || false)) diffs.push("policy_enabled");
|
|
2296
2306
|
if ((remote.policy_description || "") !== (agent.policy_description || "")) diffs.push("policy_description");
|
|
@@ -2383,6 +2393,7 @@ async function applyAgents(api, localAgents, projectId) {
|
|
|
2383
2393
|
description: agent.description || "",
|
|
2384
2394
|
system_prompt: systemPrompt,
|
|
2385
2395
|
model: agent.model || "",
|
|
2396
|
+
idle_reap_timeout_seconds: agent.idle_reap_timeout_seconds ?? 0,
|
|
2386
2397
|
skill_ids: skillIds,
|
|
2387
2398
|
policy_script: policyScript || "",
|
|
2388
2399
|
policy_enabled: agent.policy_enabled || false,
|
|
@@ -2440,6 +2451,7 @@ async function pullAgents(api, platformDir, filterName, projectId) {
|
|
|
2440
2451
|
};
|
|
2441
2452
|
if (agent.description) config.description = agent.description;
|
|
2442
2453
|
if (agent.model) config.model = agent.model;
|
|
2454
|
+
if (agent.idle_reap_timeout_seconds) config.idle_reap_timeout_seconds = agent.idle_reap_timeout_seconds;
|
|
2443
2455
|
if (skillSlugs.length > 0) config.skills = skillSlugs;
|
|
2444
2456
|
if (agent.policy_enabled) config.policy_enabled = true;
|
|
2445
2457
|
writeFileSync(join2(agentDir, "config.json"), JSON.stringify(config, null, 2) + "\n");
|
|
@@ -3684,11 +3696,13 @@ async function diff(args) {
|
|
|
3684
3696
|
console.log(` description: ${pc2.red(remote.description || "(empty)")} \u2192 ${pc2.green(local.agent.description || "(empty)")}`);
|
|
3685
3697
|
if ((remote.model || "") !== (local.agent.model || ""))
|
|
3686
3698
|
console.log(` model: ${pc2.red(remote.model || "(default)")} \u2192 ${pc2.green(local.agent.model || "(default)")}`);
|
|
3699
|
+
if ((remote.idle_reap_timeout_seconds ?? 0) !== (local.agent.idle_reap_timeout_seconds ?? 0))
|
|
3700
|
+
console.log(` idle_reap_timeout_seconds: ${pc2.red(String(remote.idle_reap_timeout_seconds ?? 0))} \u2192 ${pc2.green(String(local.agent.idle_reap_timeout_seconds ?? 0))}`);
|
|
3687
3701
|
if ((remote.policy_enabled || false) !== (local.agent.policy_enabled || false))
|
|
3688
3702
|
console.log(` policy_enabled: ${pc2.red(String(remote.policy_enabled || false))} \u2192 ${pc2.green(String(local.agent.policy_enabled || false))}`);
|
|
3689
3703
|
const promptChanged = (remote.system_prompt || "").trim() !== local.systemPrompt.trim();
|
|
3690
3704
|
const policyChanged = (remote.policy_script || "").trim() !== (local.policyScript || "").trim();
|
|
3691
|
-
if (!promptChanged && !policyChanged && remote.name === local.agent.name && (remote.description || "") === (local.agent.description || "") && (remote.model || "") === (local.agent.model || "") && (remote.policy_enabled || false) === (local.agent.policy_enabled || false)) {
|
|
3705
|
+
if (!promptChanged && !policyChanged && remote.name === local.agent.name && (remote.description || "") === (local.agent.description || "") && (remote.model || "") === (local.agent.model || "") && (remote.idle_reap_timeout_seconds ?? 0) === (local.agent.idle_reap_timeout_seconds ?? 0) && (remote.policy_enabled || false) === (local.agent.policy_enabled || false)) {
|
|
3692
3706
|
console.log(pc2.green(` \u2713 No changes`));
|
|
3693
3707
|
} else {
|
|
3694
3708
|
if (promptChanged) renderFullDiff("system_prompt.md", remote.system_prompt || "", local.systemPrompt);
|