@lightcone-ai/daemon 0.14.4 → 0.14.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.14.4",
3
+ "version": "0.14.5",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -1024,6 +1024,23 @@ export class AgentManager {
1024
1024
  return res.json();
1025
1025
  }
1026
1026
 
1027
+ async _postInternalPublishJobComplete({ jobId, ok, result, error }) {
1028
+ const url = `${this.serverUrl.replace(/\/$/, '')}/internal/publish-jobs/${encodeURIComponent(jobId)}/complete`;
1029
+ const res = await fetch(url, {
1030
+ method: 'POST',
1031
+ headers: {
1032
+ 'Content-Type': 'application/json',
1033
+ Authorization: `Bearer ${this.machineApiKey}`,
1034
+ },
1035
+ body: JSON.stringify({ ok, result, error }),
1036
+ });
1037
+ if (!res.ok) {
1038
+ const text = await res.text();
1039
+ throw new Error(`publish job complete failed (${res.status}): ${text}`);
1040
+ }
1041
+ return res.json();
1042
+ }
1043
+
1027
1044
  async _handlePublishJob(msg, connection) {
1028
1045
  const job = normalizeObject(msg.job);
1029
1046
  const jobId = String(job.id ?? '').trim();
@@ -1054,9 +1071,8 @@ export class AgentManager {
1054
1071
  job,
1055
1072
  });
1056
1073
 
1057
- await this._postInternalActionComplete({
1058
- agentId,
1059
- actionId,
1074
+ await this._postInternalPublishJobComplete({
1075
+ jobId,
1060
1076
  ok: true,
1061
1077
  result: publishResult.completionResult,
1062
1078
  error: null,
@@ -1073,9 +1089,8 @@ export class AgentManager {
1073
1089
  } catch (err) {
1074
1090
  const errorMessage = err?.message ?? String(err);
1075
1091
  try {
1076
- await this._postInternalActionComplete({
1077
- agentId,
1078
- actionId,
1092
+ await this._postInternalPublishJobComplete({
1093
+ jobId,
1079
1094
  ok: false,
1080
1095
  result: null,
1081
1096
  error: errorMessage,
package/src/connection.js CHANGED
@@ -32,6 +32,18 @@ function detectRuntimes() {
32
32
  return runtimes;
33
33
  }
34
34
 
35
+ function parseOptionalDeviceHints() {
36
+ const raw = String(process.env.LIGHTCONE_DEVICE_HINTS ?? '').trim();
37
+ if (!raw) return {};
38
+ try {
39
+ const parsed = JSON.parse(raw);
40
+ return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
41
+ } catch {
42
+ console.warn('[Connection] Ignoring invalid LIGHTCONE_DEVICE_HINTS (must be JSON object)');
43
+ return {};
44
+ }
45
+ }
46
+
35
47
  export class DaemonConnection {
36
48
  constructor({ serverUrl, machineApiKey, onMessage }) {
37
49
  this.serverUrl = serverUrl.replace(/^http/, 'ws');
@@ -86,13 +98,27 @@ export class DaemonConnection {
86
98
 
87
99
  _sendReady() {
88
100
  const runtimes = detectRuntimes();
89
- console.log(`[Connection] Ready host=${os.hostname()} runtimes=[${runtimes.join(',')}] v${DAEMON_VERSION}`);
101
+ const hostname = os.hostname();
102
+ const platform = os.platform();
103
+ const arch = os.arch();
104
+ const release = os.release();
105
+ const envDeviceType = String(process.env.LIGHTCONE_DEVICE_TYPE ?? '').trim();
106
+ const deviceHints = {
107
+ platform,
108
+ arch,
109
+ release,
110
+ ...(envDeviceType ? { deviceType: envDeviceType } : {}),
111
+ ...parseOptionalDeviceHints(),
112
+ };
113
+
114
+ console.log(`[Connection] Ready — host=${hostname} runtimes=[${runtimes.join(',')}] v${DAEMON_VERSION}`);
90
115
  this.send({
91
116
  type: 'ready',
92
- hostname: os.hostname(),
93
- os: `${os.platform()} ${os.arch()}`,
117
+ hostname,
118
+ os: `${platform} ${arch}`,
94
119
  runtimes,
95
120
  daemonVersion: DAEMON_VERSION,
121
+ deviceHints,
96
122
  });
97
123
  }
98
124