@sirenodeck/sirenodeck 0.2.1 → 0.2.3
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/main.mjs +218 -70
- package/package.json +1 -1
- package/src/builtin-addons/coding-agents/buttons/agent/config.ts +5 -1
- package/src/builtin-addons/coding-agents/buttons/summary/config.ts +15 -6
- package/src/builtin-addons/coding-agents/global/backend.ts +55 -35
- package/src/builtin-addons/media/backend.ts +54 -0
- package/src/builtin-addons/system-status/manifest.ts +49 -0
- package/src/cli/commands/restart.ts +15 -5
- package/src/cli/commands/run.ts +33 -11
- package/src/cli/commands/start.ts +10 -5
- package/src/cli/commands/system-requirements.ts +1 -0
- package/src/cli/index.ts +14 -3
- package/src/cli/main.ts +15 -2
- package/src/cli/startup-display.ts +32 -14
- package/src/config/validation.ts +7 -1
- package/src/index.ts +1 -2
- package/src/system/providers/active-app/capture-file.ts +61 -0
- package/src/system/providers/active-app.ts +6 -0
- package/src/util/logger.ts +19 -3
- package/src/version.ts +3 -1
package/dist/main.mjs
CHANGED
|
@@ -136,7 +136,8 @@ const CONTEXT_FIELDS = [
|
|
|
136
136
|
"userDecks",
|
|
137
137
|
"addonConfigEntries",
|
|
138
138
|
"icon",
|
|
139
|
-
"fullPath"
|
|
139
|
+
"fullPath",
|
|
140
|
+
"reason"
|
|
140
141
|
];
|
|
141
142
|
const FORWARDED_CONTEXT_FIELDS = [
|
|
142
143
|
"component",
|
|
@@ -154,6 +155,14 @@ const formatLogTime = (value) => {
|
|
|
154
155
|
const pad = (n, w = 2) => String(n).padStart(w, "0");
|
|
155
156
|
return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad(d.getMilliseconds(), 3)}`;
|
|
156
157
|
};
|
|
158
|
+
const formatContextValue = (key, value) => {
|
|
159
|
+
if (key === "reason" && typeof value === "object" && value !== null) {
|
|
160
|
+
const reason = value;
|
|
161
|
+
if (typeof reason.message === "string" && reason.message.length > 0) return `${typeof reason.type === "string" ? reason.type : "Error"}: ${reason.message}`;
|
|
162
|
+
if (typeof reason.value === "string") return reason.value;
|
|
163
|
+
}
|
|
164
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
165
|
+
};
|
|
157
166
|
const formatHuman = (jsonLine, options = {}) => {
|
|
158
167
|
let entry;
|
|
159
168
|
try {
|
|
@@ -174,7 +183,7 @@ const formatHuman = (jsonLine, options = {}) => {
|
|
|
174
183
|
for (const key of CONTEXT_FIELDS) {
|
|
175
184
|
const value = entry[key];
|
|
176
185
|
if (value === void 0 || value === null) continue;
|
|
177
|
-
const display =
|
|
186
|
+
const display = formatContextValue(key, value);
|
|
178
187
|
if (display.length === 0) continue;
|
|
179
188
|
ctxParts.push(`${colorize(DIM, `${key}:`)} ${display}`);
|
|
180
189
|
}
|
|
@@ -205,7 +214,7 @@ var HumanWritable = class extends Writable {
|
|
|
205
214
|
for (const key of CONTEXT_FIELDS) {
|
|
206
215
|
const value = entry[key];
|
|
207
216
|
if (value === void 0 || value === null) continue;
|
|
208
|
-
const display =
|
|
217
|
+
const display = formatContextValue(key, value);
|
|
209
218
|
if (display.length === 0) continue;
|
|
210
219
|
ctxParts.push(`${key}: ${display}`);
|
|
211
220
|
}
|
|
@@ -318,6 +327,9 @@ const levelNameFromNumber = (level) => {
|
|
|
318
327
|
return "trace";
|
|
319
328
|
};
|
|
320
329
|
//#endregion
|
|
330
|
+
//#region package.json
|
|
331
|
+
var version$1 = "0.2.3";
|
|
332
|
+
//#endregion
|
|
321
333
|
//#region src/version.ts
|
|
322
334
|
const PACKAGE_NAME = "@sirenodeck/sirenodeck";
|
|
323
335
|
/**
|
|
@@ -326,7 +338,7 @@ const PACKAGE_NAME = "@sirenodeck/sirenodeck";
|
|
|
326
338
|
* a string that is not a runnable command. Keep the two separate.
|
|
327
339
|
*/
|
|
328
340
|
const BIN_NAME = "sirenodeck";
|
|
329
|
-
const VERSION =
|
|
341
|
+
const VERSION = version$1;
|
|
330
342
|
//#endregion
|
|
331
343
|
//#region src/util/daemon.ts
|
|
332
344
|
const writeAtomic = (path, content, mode) => {
|
|
@@ -51040,9 +51052,6 @@ const manifest$6 = {
|
|
|
51040
51052
|
//#region src/builtin-addons/internal-settings/buttons/app-info/backend.ts
|
|
51041
51053
|
var backend_default$11 = { onTap: async () => {} };
|
|
51042
51054
|
//#endregion
|
|
51043
|
-
//#region package.json
|
|
51044
|
-
var version$1 = "0.2.1";
|
|
51045
|
-
//#endregion
|
|
51046
51055
|
//#region src/builtin-addons/internal-settings/buttons/app-info/frontend.tsx
|
|
51047
51056
|
const version = typeof version$1 === "string" ? version$1 : "0.0.0";
|
|
51048
51057
|
const AppInfoButtonFrontend = ({ config }) => /* @__PURE__ */ jsxs("div", {
|
|
@@ -51666,6 +51675,18 @@ const FALLBACK_STATE = {
|
|
|
51666
51675
|
};
|
|
51667
51676
|
let provider = null;
|
|
51668
51677
|
let ctxRef$2 = null;
|
|
51678
|
+
let captureMediaState = null;
|
|
51679
|
+
let captureStage = "playing";
|
|
51680
|
+
const captureMode = () => process.env["SIRENO_CAPTURE_FAKE_MEDIA"] === "1";
|
|
51681
|
+
const setCapturePlayback = (playing) => {
|
|
51682
|
+
captureStage = playing ? "playing" : "paused";
|
|
51683
|
+
if (captureMediaState === null) return;
|
|
51684
|
+
captureMediaState = {
|
|
51685
|
+
...captureMediaState,
|
|
51686
|
+
status: playing ? "play" : "pause",
|
|
51687
|
+
isPlaying: playing
|
|
51688
|
+
};
|
|
51689
|
+
};
|
|
51669
51690
|
const mapStatus = (playStatus) => {
|
|
51670
51691
|
if (playStatus === "play" || playStatus === "pause" || playStatus === "stop") return playStatus;
|
|
51671
51692
|
return "notAvailable";
|
|
@@ -51698,6 +51719,13 @@ const globalService$3 = {
|
|
|
51698
51719
|
channel: "media:state",
|
|
51699
51720
|
intervalMs: 1e3,
|
|
51700
51721
|
poll: async (_ctx) => {
|
|
51722
|
+
if (captureMode() && captureMediaState !== null) {
|
|
51723
|
+
const stagePath = process.env["SIRENO_CAPTURE_FAKE_MEDIA_FILE"];
|
|
51724
|
+
if (stagePath !== void 0) try {
|
|
51725
|
+
if (JSON.parse((await import("node:fs")).readFileSync(stagePath, "utf8")).stage === "paused" && captureStage !== "paused") setCapturePlayback(false);
|
|
51726
|
+
} catch {}
|
|
51727
|
+
return { ...captureMediaState };
|
|
51728
|
+
}
|
|
51701
51729
|
if (provider === null) return FALLBACK_STATE;
|
|
51702
51730
|
try {
|
|
51703
51731
|
return buildState(await provider.getStatus());
|
|
@@ -51708,12 +51736,15 @@ const globalService$3 = {
|
|
|
51708
51736
|
}],
|
|
51709
51737
|
methods: {
|
|
51710
51738
|
play: wrap(async () => {
|
|
51739
|
+
if (captureMode()) return setCapturePlayback(true);
|
|
51711
51740
|
await provider?.play();
|
|
51712
51741
|
}),
|
|
51713
51742
|
pause: wrap(async () => {
|
|
51743
|
+
if (captureMode()) return setCapturePlayback(false);
|
|
51714
51744
|
await provider?.pause();
|
|
51715
51745
|
}),
|
|
51716
51746
|
toggle: wrap(async () => {
|
|
51747
|
+
if (captureMode()) return setCapturePlayback(captureMediaState?.isPlaying !== true);
|
|
51717
51748
|
await provider?.toggle();
|
|
51718
51749
|
}),
|
|
51719
51750
|
next: wrap(async () => {
|
|
@@ -51740,6 +51771,25 @@ const globalService$3 = {
|
|
|
51740
51771
|
},
|
|
51741
51772
|
onLoad: (ctx) => {
|
|
51742
51773
|
ctxRef$2 = ctx;
|
|
51774
|
+
if (captureMode()) {
|
|
51775
|
+
captureMediaState = {
|
|
51776
|
+
title: "Night Drive",
|
|
51777
|
+
artist: "Sireno Studio",
|
|
51778
|
+
source: "Demo session",
|
|
51779
|
+
status: "play",
|
|
51780
|
+
isPlaying: true,
|
|
51781
|
+
volume: 68,
|
|
51782
|
+
progress: 42,
|
|
51783
|
+
currentTime: 84,
|
|
51784
|
+
totalTime: 200,
|
|
51785
|
+
muted: false
|
|
51786
|
+
};
|
|
51787
|
+
captureStage = "playing";
|
|
51788
|
+
provider = null;
|
|
51789
|
+
return;
|
|
51790
|
+
}
|
|
51791
|
+
captureMediaState = null;
|
|
51792
|
+
captureStage = "playing";
|
|
51743
51793
|
provider = createMediaProvider(process.platform, { async run(command, args, _options) {
|
|
51744
51794
|
const shellCmd = args.length === 0 ? command : `${command} ${args.map(shellQuote).join(" ")}`;
|
|
51745
51795
|
return ctx.executor.run(shellCmd);
|
|
@@ -51748,6 +51798,7 @@ const globalService$3 = {
|
|
|
51748
51798
|
onUnload: () => {
|
|
51749
51799
|
ctxRef$2 = null;
|
|
51750
51800
|
provider = null;
|
|
51801
|
+
captureMediaState = null;
|
|
51751
51802
|
}
|
|
51752
51803
|
};
|
|
51753
51804
|
//#endregion
|
|
@@ -52002,7 +52053,10 @@ const manifest$4 = {
|
|
|
52002
52053
|
};
|
|
52003
52054
|
//#endregion
|
|
52004
52055
|
//#region src/builtin-addons/coding-agents/buttons/agent/config.ts
|
|
52005
|
-
const configSchema$4 = z.object({ slot: z.number().int().min(0).default(0).meta({
|
|
52056
|
+
const configSchema$4 = z.object({ slot: z.number().int().min(0).default(0).meta({
|
|
52057
|
+
title: "Agent slot",
|
|
52058
|
+
description: "Zero-based position in the generated session deck. Slot 0 is the first discovered session; slots are assigned dynamically, so they are not fixed to a provider or session ID."
|
|
52059
|
+
}) }).strict();
|
|
52006
52060
|
//#endregion
|
|
52007
52061
|
//#region src/builtin-addons/coding-agents/shared/state.ts
|
|
52008
52062
|
const CHANNEL = "coding-agents:agents";
|
|
@@ -52548,9 +52602,18 @@ const deckTarget = () => store().pageCount > 1 ? `${AGENTS_DECK_BASE}-p1` : AGEN
|
|
|
52548
52602
|
//#endregion
|
|
52549
52603
|
//#region src/builtin-addons/coding-agents/buttons/summary/config.ts
|
|
52550
52604
|
const configSchema$3 = z.object({
|
|
52551
|
-
showCount: z.boolean().default(true).meta({
|
|
52552
|
-
|
|
52553
|
-
|
|
52605
|
+
showCount: z.boolean().default(true).meta({
|
|
52606
|
+
title: "Show count",
|
|
52607
|
+
description: "Show the number of discovered agent sessions on the summary tile."
|
|
52608
|
+
}),
|
|
52609
|
+
attentionOnly: z.boolean().default(false).meta({
|
|
52610
|
+
title: "Attention only",
|
|
52611
|
+
description: "Show the attention state only when a session needs attention; otherwise show the normal summary."
|
|
52612
|
+
}),
|
|
52613
|
+
fallingLetters: z.boolean().default(true).meta({
|
|
52614
|
+
title: "Falling letters",
|
|
52615
|
+
description: "Show the animated falling-letter background on the summary tile."
|
|
52616
|
+
})
|
|
52554
52617
|
}).strict();
|
|
52555
52618
|
//#endregion
|
|
52556
52619
|
//#region src/builtin-addons/coding-agents/buttons/summary/backend.ts
|
|
@@ -53656,12 +53719,50 @@ const SystemStatusConfigSchema = pagesSchema(z.discriminatedUnion("type", [
|
|
|
53656
53719
|
const POLL_INTERVAL_MS$1 = 1e3;
|
|
53657
53720
|
//#endregion
|
|
53658
53721
|
//#region src/builtin-addons/system-status/manifest.ts
|
|
53722
|
+
const CAPTURE_METRIC_VALUES = {
|
|
53723
|
+
battery: 86,
|
|
53724
|
+
cpu: 42,
|
|
53725
|
+
"cpu-boost": 1,
|
|
53726
|
+
"cpu-voltages": 1180,
|
|
53727
|
+
disk: 54,
|
|
53728
|
+
"disk-io": 124e4,
|
|
53729
|
+
"fan-rpm": 1260,
|
|
53730
|
+
frequency: 3400,
|
|
53731
|
+
"gpu-temp": 58,
|
|
53732
|
+
"gpu-usage": 27,
|
|
53733
|
+
load: 1.4,
|
|
53734
|
+
network: 64,
|
|
53735
|
+
"network-read": 84e4,
|
|
53736
|
+
"network-write": 126e3,
|
|
53737
|
+
processes: 184,
|
|
53738
|
+
ram: 68,
|
|
53739
|
+
swap: 24,
|
|
53740
|
+
temperature: 54,
|
|
53741
|
+
uptime: 92400
|
|
53742
|
+
};
|
|
53743
|
+
const captureMetric = (id) => {
|
|
53744
|
+
const definition = METRICS_CATALOG[id];
|
|
53745
|
+
const value = CAPTURE_METRIC_VALUES[id];
|
|
53746
|
+
const max = definition.maxValue;
|
|
53747
|
+
return {
|
|
53748
|
+
id,
|
|
53749
|
+
label: definition.defaultLabel,
|
|
53750
|
+
available: true,
|
|
53751
|
+
value,
|
|
53752
|
+
...definition.unit !== void 0 ? { unit: definition.unit } : {},
|
|
53753
|
+
...max !== void 0 ? {
|
|
53754
|
+
max,
|
|
53755
|
+
percentage: definition.formatter === "percent" || definition.formatter === "bool" ? value : value / max * 100
|
|
53756
|
+
} : {}
|
|
53757
|
+
};
|
|
53758
|
+
};
|
|
53659
53759
|
function makePoller(metricId) {
|
|
53660
53760
|
return {
|
|
53661
53761
|
id: `metric:${metricId}`,
|
|
53662
53762
|
channel: `runtime:system-status:${metricId}`,
|
|
53663
53763
|
intervalMs: POLL_INTERVAL_MS$1,
|
|
53664
53764
|
poll: async () => {
|
|
53765
|
+
if (process.env["SIRENO_CAPTURE_FAKE_METRICS"] === "1") return captureMetric(metricId);
|
|
53665
53766
|
const { probeMetric } = await import("./live-metrics-CMf02ncg.mjs");
|
|
53666
53767
|
const result = await probeMetric(metricId);
|
|
53667
53768
|
if (result.value !== void 0 && result.available) {
|
|
@@ -54703,10 +54804,13 @@ const validateButton = (btn, registry, path, deckId, position) => {
|
|
|
54703
54804
|
};
|
|
54704
54805
|
const issues = [];
|
|
54705
54806
|
if (!registry.hasButtonType(btn.type)) {
|
|
54807
|
+
const addonName = btn.type.split(":", 1)[0];
|
|
54808
|
+
const availableTypes = registry.getAddon(addonName ?? "")?.buttonTypes;
|
|
54809
|
+
const hint = availableTypes !== void 0 ? ` Available button types for '${addonName}': ${Object.keys(availableTypes).join(", ") || "none"}. Check the type spelling.` : " Check the type spelling and confirm that its addon is installed and enabled.";
|
|
54706
54810
|
issues.push({
|
|
54707
54811
|
level: "error",
|
|
54708
54812
|
path: `${path}.type`,
|
|
54709
|
-
message: `Unknown button type: ${btn.type}`,
|
|
54813
|
+
message: `Unknown button type: ${btn.type}.${hint}`,
|
|
54710
54814
|
reason: "unknown-type",
|
|
54711
54815
|
...base
|
|
54712
54816
|
});
|
|
@@ -57356,6 +57460,11 @@ const createNullActiveAppProvider = (reason, logger) => {
|
|
|
57356
57460
|
};
|
|
57357
57461
|
};
|
|
57358
57462
|
const createActiveAppProvider = async (options) => {
|
|
57463
|
+
const captureFile = process.env["SIRENO_CAPTURE_ACTIVE_APP_FILE"];
|
|
57464
|
+
if (captureFile !== void 0) {
|
|
57465
|
+
const { createCaptureFileActiveAppProvider } = await import("./capture-file-C11RW9NA.mjs");
|
|
57466
|
+
return createCaptureFileActiveAppProvider(captureFile);
|
|
57467
|
+
}
|
|
57359
57468
|
const platform = options.platform ?? process.platform;
|
|
57360
57469
|
if (platform === "linux") {
|
|
57361
57470
|
if (options.executor === void 0) return createNullActiveAppProvider("executor-not-injected", options.logger);
|
|
@@ -59000,6 +59109,43 @@ const publishSnapshot = () => {
|
|
|
59000
59109
|
state.context?.publish(payload);
|
|
59001
59110
|
return payload;
|
|
59002
59111
|
};
|
|
59112
|
+
let captureFakeStage = null;
|
|
59113
|
+
const captureAgentsForStage = (stage) => {
|
|
59114
|
+
const statuses = stage === "updated" ? [
|
|
59115
|
+
...Array.from({ length: 8 }, () => "running"),
|
|
59116
|
+
"waiting_for_human",
|
|
59117
|
+
"waiting_for_human",
|
|
59118
|
+
"compacting"
|
|
59119
|
+
] : [
|
|
59120
|
+
"idle",
|
|
59121
|
+
...Array.from({ length: 10 }, () => "running"),
|
|
59122
|
+
"waiting_for_human"
|
|
59123
|
+
];
|
|
59124
|
+
const now = Date.now();
|
|
59125
|
+
const agents = statuses.map((status, index) => ({
|
|
59126
|
+
sessionId: `sireno-capture-${stage}-${index + 1}`,
|
|
59127
|
+
providerId: index % 2 === 0 ? "opencode" : "claude-code",
|
|
59128
|
+
title: `Showcase task ${index + 1}`,
|
|
59129
|
+
status,
|
|
59130
|
+
directory: "/works/sireno-deck",
|
|
59131
|
+
updatedAt: now - index * 1e3,
|
|
59132
|
+
createdAt: now - (index + 1) * 6e4
|
|
59133
|
+
}));
|
|
59134
|
+
return mergeSnapshot(EMPTY_SNAPSHOT, {
|
|
59135
|
+
opencode: agents.filter((agent) => agent.providerId === "opencode"),
|
|
59136
|
+
"claude-code": agents.filter((agent) => agent.providerId === "claude-code")
|
|
59137
|
+
});
|
|
59138
|
+
};
|
|
59139
|
+
const syncCaptureFakeAgents = () => {
|
|
59140
|
+
const stagePath = process.env["SIRENO_CAPTURE_FAKE_AGENTS_FILE"];
|
|
59141
|
+
let stage = "initial";
|
|
59142
|
+
if (stagePath !== void 0) try {
|
|
59143
|
+
if (JSON.parse(readFileSync(stagePath, "utf8")).stage === "updated") stage = "updated";
|
|
59144
|
+
} catch {}
|
|
59145
|
+
if (stage === captureFakeStage) return;
|
|
59146
|
+
state.lastSnapshot = captureAgentsForStage(stage);
|
|
59147
|
+
captureFakeStage = stage;
|
|
59148
|
+
};
|
|
59003
59149
|
//#endregion
|
|
59004
59150
|
//#region src/builtin-addons/global-services.ts
|
|
59005
59151
|
/**
|
|
@@ -59026,7 +59172,10 @@ const BUILTIN_GLOBAL_SERVICES = /* @__PURE__ */ new Map([["coding-agents", {
|
|
|
59026
59172
|
intervalMs: POLLER_INTERVAL_MS,
|
|
59027
59173
|
poll: async (ctx) => {
|
|
59028
59174
|
state.context = ctx;
|
|
59029
|
-
if (process.env["SIRENO_CAPTURE_FAKE_AGENTS"] === "1")
|
|
59175
|
+
if (process.env["SIRENO_CAPTURE_FAKE_AGENTS"] === "1") {
|
|
59176
|
+
syncCaptureFakeAgents();
|
|
59177
|
+
return publishSnapshot();
|
|
59178
|
+
}
|
|
59030
59179
|
await setStateFromProviders();
|
|
59031
59180
|
fireNotices(state.lastSnapshot);
|
|
59032
59181
|
return publishSnapshot();
|
|
@@ -59072,40 +59221,7 @@ const BUILTIN_GLOBAL_SERVICES = /* @__PURE__ */ new Map([["coding-agents", {
|
|
|
59072
59221
|
state.icons = registerProviderIcons();
|
|
59073
59222
|
hydratePersisted();
|
|
59074
59223
|
if (process.env["SIRENO_CAPTURE_FAKE_AGENTS"] === "1") {
|
|
59075
|
-
|
|
59076
|
-
const fake = [
|
|
59077
|
-
{
|
|
59078
|
-
sessionId: "sireno-capture-opencode-1",
|
|
59079
|
-
providerId: "opencode",
|
|
59080
|
-
title: "Refactor capture pipeline",
|
|
59081
|
-
status: "running",
|
|
59082
|
-
directory: "/works/sirenodeck",
|
|
59083
|
-
updatedAt: now,
|
|
59084
|
-
createdAt: now - 72e4
|
|
59085
|
-
},
|
|
59086
|
-
{
|
|
59087
|
-
sessionId: "sireno-capture-opencode-2",
|
|
59088
|
-
providerId: "opencode",
|
|
59089
|
-
title: "Fix flaky session tests",
|
|
59090
|
-
status: "idle",
|
|
59091
|
-
directory: "/works/sirenodeck/packages/cli",
|
|
59092
|
-
updatedAt: now - 24e4,
|
|
59093
|
-
createdAt: now - 24e5
|
|
59094
|
-
},
|
|
59095
|
-
{
|
|
59096
|
-
sessionId: "sireno-capture-claude-1",
|
|
59097
|
-
providerId: "claude-code",
|
|
59098
|
-
title: "Migrate themes",
|
|
59099
|
-
status: "waiting_for_human",
|
|
59100
|
-
directory: "/works/sirenodeck/packages/web",
|
|
59101
|
-
updatedAt: now - 12e4,
|
|
59102
|
-
createdAt: now - 54e5
|
|
59103
|
-
}
|
|
59104
|
-
];
|
|
59105
|
-
state.lastSnapshot = mergeSnapshot(state.lastSnapshot, {
|
|
59106
|
-
opencode: fake.filter((a) => a.providerId === "opencode"),
|
|
59107
|
-
"claude-code": fake.filter((a) => a.providerId === "claude-code")
|
|
59108
|
-
});
|
|
59224
|
+
syncCaptureFakeAgents();
|
|
59109
59225
|
publishSnapshot();
|
|
59110
59226
|
return;
|
|
59111
59227
|
}
|
|
@@ -59133,6 +59249,7 @@ const BUILTIN_GLOBAL_SERVICES = /* @__PURE__ */ new Map([["coding-agents", {
|
|
|
59133
59249
|
}
|
|
59134
59250
|
state.providers.clear();
|
|
59135
59251
|
state.lastSnapshot = EMPTY_SNAPSHOT;
|
|
59252
|
+
captureFakeStage = null;
|
|
59136
59253
|
state.lastSeenStatus.clear();
|
|
59137
59254
|
state.throttle.reset();
|
|
59138
59255
|
state.icons = {};
|
|
@@ -62374,10 +62491,9 @@ const loadExternalAddonsIntoRegistry = async (registry, config, configDir, homeD
|
|
|
62374
62491
|
source: issue.source,
|
|
62375
62492
|
message: issue.message
|
|
62376
62493
|
};
|
|
62377
|
-
|
|
62378
|
-
if (issue.level === "
|
|
62379
|
-
else
|
|
62380
|
-
else logger.info(payload, `addon load info — ${detail}`);
|
|
62494
|
+
if (issue.level === "error") logger.warn(payload, `Configured addon '${issue.source}' was skipped; its buttons and decks are unavailable. ${issue.message} Fix the addon entry or remove it from addons[].`);
|
|
62495
|
+
else if (issue.level === "warning") logger.warn(payload, `addon load warning — ${issue.source}: ${issue.message}`);
|
|
62496
|
+
else logger.info(payload, `addon load info — ${issue.source}: ${issue.message}`);
|
|
62381
62497
|
}
|
|
62382
62498
|
for (const loaded of result.addons) try {
|
|
62383
62499
|
registry.load(loaded.manifest);
|
|
@@ -62417,7 +62533,7 @@ const validateAndLoadConfig = async (options) => {
|
|
|
62417
62533
|
userDecks: Object.keys(config.decks),
|
|
62418
62534
|
addonConfigEntries: (config.addons ?? []).map((a) => typeof a === "string" ? a : a.src)
|
|
62419
62535
|
}, "registry: deck types loaded");
|
|
62420
|
-
const structuralErrors = validateFull(config, registry).issues.filter((i) => !i.path.includes(".config."));
|
|
62536
|
+
const structuralErrors = validateFull(config, registry).issues.filter((i) => !i.path.includes(".config.") && !(i.reason === "unknown-type" && i.deckId !== void 0));
|
|
62421
62537
|
if (structuralErrors.some((i) => i.level === "error")) throw new Error(`Config validation failed:\n${formatFullIssues(structuralErrors)}`);
|
|
62422
62538
|
const { roots: globalRoots, timedOut, timeoutMs } = probeGlobalPackageRoots();
|
|
62423
62539
|
for (const manager of timedOut) options.logger.warn({
|
|
@@ -62727,7 +62843,10 @@ const startSystemProviders = async (options, methods) => {
|
|
|
62727
62843
|
executor,
|
|
62728
62844
|
logger
|
|
62729
62845
|
}),
|
|
62730
|
-
|
|
62846
|
+
env["SIRENO_CAPTURE_DISABLE_KEYBOARD"] === "1" ? Promise.resolve({
|
|
62847
|
+
sendKey: async () => {},
|
|
62848
|
+
stop: async () => {}
|
|
62849
|
+
}) : createKeyMacroProvider({
|
|
62731
62850
|
platform,
|
|
62732
62851
|
executor,
|
|
62733
62852
|
env,
|
|
@@ -64934,6 +65053,7 @@ const systemRequirements = async (options) => {
|
|
|
64934
65053
|
};
|
|
64935
65054
|
const systemRequirementsCommand = {
|
|
64936
65055
|
command: "system-requirements",
|
|
65056
|
+
aliases: ["onboard"],
|
|
64937
65057
|
describe: "Detect system capabilities (key macro, clipboard, notification, active-app) and optionally install missing pieces",
|
|
64938
65058
|
builder: (yargs) => yargs.option("yes", {
|
|
64939
65059
|
alias: "y",
|
|
@@ -65692,9 +65812,9 @@ const start = async (options) => {
|
|
|
65692
65812
|
const { logger } = options;
|
|
65693
65813
|
if (isUnderServiceManager()) {
|
|
65694
65814
|
await runInProcess(options);
|
|
65695
|
-
return;
|
|
65815
|
+
return "started";
|
|
65696
65816
|
}
|
|
65697
|
-
if (!await runFirstRunCheckIfNeeded(options, logger)) return;
|
|
65817
|
+
if (!await runFirstRunCheckIfNeeded(options, logger)) return process.exitCode === 1 ? "blocked" : "cancelled";
|
|
65698
65818
|
try {
|
|
65699
65819
|
await offerConfigSkillOnFirstRun();
|
|
65700
65820
|
} catch (error) {
|
|
@@ -65705,7 +65825,7 @@ const start = async (options) => {
|
|
|
65705
65825
|
if (await isSocketLive(instanceLockPath(resolveDaemonPaths())) || existing !== null && isRunning(existing)) {
|
|
65706
65826
|
if (await promptConflict(existing) === "cancel") {
|
|
65707
65827
|
logger.info("start cancelled");
|
|
65708
|
-
return;
|
|
65828
|
+
return "cancelled";
|
|
65709
65829
|
}
|
|
65710
65830
|
if (isUnitInstalled()) {
|
|
65711
65831
|
const resolvedRestart = resolveConfigPath(options);
|
|
@@ -65727,7 +65847,7 @@ const start = async (options) => {
|
|
|
65727
65847
|
}
|
|
65728
65848
|
}
|
|
65729
65849
|
logger.info({ pid: restarted }, restarted === null ? "start: service manager restarted the daemon (pid not yet visible)" : "start: daemon restarted by the service manager");
|
|
65730
|
-
return;
|
|
65850
|
+
return "started";
|
|
65731
65851
|
}
|
|
65732
65852
|
if (existing !== null) await stopExisting(existing, logger);
|
|
65733
65853
|
else logger.warn("start: a daemon holds the instance lock but left no pid file — falling back to the port reap");
|
|
@@ -65766,6 +65886,7 @@ const start = async (options) => {
|
|
|
65766
65886
|
removeRuntimeStateFile();
|
|
65767
65887
|
if (isDevInvocation$1()) await startInBackground(options);
|
|
65768
65888
|
else await startProduction(options);
|
|
65889
|
+
return "started";
|
|
65769
65890
|
};
|
|
65770
65891
|
//#endregion
|
|
65771
65892
|
//#region src/device/registry.ts
|
|
@@ -65870,7 +65991,12 @@ const tryBind = (port) => new Promise((resolve) => {
|
|
|
65870
65991
|
cleanup(false);
|
|
65871
65992
|
}
|
|
65872
65993
|
});
|
|
65873
|
-
const
|
|
65994
|
+
const formatFeaturesList = (items) => ["Features", ...items.map((it) => ` ${it.name} ${it.available ? color.green("✓") : color.red("✗")}${!it.available && it.reason ? ` — ${it.reason}` : ""}`)];
|
|
65995
|
+
const printFeaturesList = (items, write = (text) => process.stdout.write(text)) => {
|
|
65996
|
+
const lines = formatFeaturesList(items);
|
|
65997
|
+
write(`${lines.slice(1).join("\n")}\n`);
|
|
65998
|
+
return lines;
|
|
65999
|
+
};
|
|
65874
66000
|
const toFeatureItem = (name, probe) => probe.reason !== void 0 ? {
|
|
65875
66001
|
name,
|
|
65876
66002
|
available: probe.available,
|
|
@@ -65902,13 +66028,15 @@ const buildStartupBanner = async (options, argv, deps = defaultBannerDeps) => {
|
|
|
65902
66028
|
toFeatureItem("exec", exec),
|
|
65903
66029
|
toFeatureItem("http", http)
|
|
65904
66030
|
];
|
|
65905
|
-
const
|
|
66031
|
+
const featuresLines = formatFeaturesList(items);
|
|
65906
66032
|
const label = deviceLabel(options.emulator, options.deviceModel, devices);
|
|
65907
|
-
intro(
|
|
66033
|
+
intro(`Starting SirenoDeck v${VERSION}`);
|
|
65908
66034
|
log$1.info(`Device: ${label}`);
|
|
65909
|
-
log$1.info(
|
|
66035
|
+
log$1.info("Features");
|
|
66036
|
+
printFeaturesList(items);
|
|
66037
|
+
if (items.some((item) => !item.available)) log$1.warn("Some features are unavailable. Run `sirenodeck onboard` to install missing dependencies.");
|
|
65910
66038
|
return {
|
|
65911
|
-
|
|
66039
|
+
featuresLines,
|
|
65912
66040
|
deviceLabel: label
|
|
65913
66041
|
};
|
|
65914
66042
|
};
|
|
@@ -66102,7 +66230,16 @@ const restart = async (options) => {
|
|
|
66102
66230
|
const snapshot = snapshotDaemonLog();
|
|
66103
66231
|
const logPath = logPathFor();
|
|
66104
66232
|
await stop({ logger });
|
|
66105
|
-
await start(startOptions);
|
|
66233
|
+
const launchResult = await start(startOptions);
|
|
66234
|
+
if (launchResult !== "started") {
|
|
66235
|
+
if (launchResult === "blocked") {
|
|
66236
|
+
const message = "Restart stopped before the daemon was launched. Resolve the requirement warning above, then retry.";
|
|
66237
|
+
logger.warn(message);
|
|
66238
|
+
process.exitCode = 1;
|
|
66239
|
+
printRestartFailed(message);
|
|
66240
|
+
}
|
|
66241
|
+
return;
|
|
66242
|
+
}
|
|
66106
66243
|
const outcome = await waitForFullStart({
|
|
66107
66244
|
port: startOptions.port ?? 52937,
|
|
66108
66245
|
tcpTimeoutMs: 3e4,
|
|
@@ -66113,7 +66250,7 @@ const restart = async (options) => {
|
|
|
66113
66250
|
printDaemonEvents(outcome.events);
|
|
66114
66251
|
if (outcome.runtimeReady && outcome.state !== null) printRestartComplete();
|
|
66115
66252
|
else {
|
|
66116
|
-
const message = outcome.tcpReady ? "daemon
|
|
66253
|
+
const message = outcome.tcpReady ? "The daemon accepted connections but did not finish startup. Check `sirenodeck logs` for the cause." : `SirenoDeck did not reopen its WebSocket on 127.0.0.1:${startOptions.port ?? 52937} within 30 seconds. Check \`sirenodeck logs\`; if another app owns the port, stop it or choose another with \`--port <port>\`.`;
|
|
66117
66254
|
logger.warn(message);
|
|
66118
66255
|
process.exitCode = 1;
|
|
66119
66256
|
printRestartFailed(message);
|
|
@@ -66151,7 +66288,7 @@ const restart = async (options) => {
|
|
|
66151
66288
|
printDaemonEvents(outcome.events);
|
|
66152
66289
|
if (outcome.runtimeReady && outcome.state !== null) printRestartComplete();
|
|
66153
66290
|
else {
|
|
66154
|
-
const message = outcome.tcpReady ? "daemon
|
|
66291
|
+
const message = outcome.tcpReady ? "The daemon accepted connections but did not finish startup. Check `sirenodeck logs` for the cause." : `SirenoDeck did not reopen its WebSocket on 127.0.0.1:${port} within 30 seconds. Check \`sirenodeck logs\`; if another app owns the port, stop it or choose another with \`--port <port>\`.`;
|
|
66155
66292
|
logger.warn(message);
|
|
66156
66293
|
process.exitCode = 1;
|
|
66157
66294
|
printRestartFailed(message);
|
|
@@ -66303,7 +66440,11 @@ const startCommand = {
|
|
|
66303
66440
|
const logSnapshot = snapshotDaemonLog();
|
|
66304
66441
|
const logPath = join(resolveDaemonPaths().runtimeDir, "service.log");
|
|
66305
66442
|
const startRequestedAt = Date.now();
|
|
66306
|
-
const
|
|
66443
|
+
const launchResult = await start(options);
|
|
66444
|
+
if (launchResult !== "started") {
|
|
66445
|
+
if (launchResult === "blocked") printStartupFailed("Startup stopped before the daemon was launched. Resolve the requirement warning above, then retry.");
|
|
66446
|
+
return;
|
|
66447
|
+
}
|
|
66307
66448
|
const outcome = await waitForFullStart({
|
|
66308
66449
|
port: options.port ?? 52937,
|
|
66309
66450
|
tcpTimeoutMs: 3e4,
|
|
@@ -66324,13 +66465,12 @@ const startCommand = {
|
|
|
66324
66465
|
printStartupFailed(message);
|
|
66325
66466
|
return;
|
|
66326
66467
|
} else {
|
|
66327
|
-
const message = `
|
|
66468
|
+
const message = `SirenoDeck did not open its WebSocket on 127.0.0.1:${options.port ?? 52937} within 30 seconds. The daemon may have exited during startup. Check \`sirenodeck logs\` for the cause; if another app is using this port, stop it or retry with \`--port <port>\`.`;
|
|
66328
66469
|
logger.warn(message);
|
|
66329
66470
|
process.exitCode = 1;
|
|
66330
66471
|
printStartupFailed(message);
|
|
66331
66472
|
return;
|
|
66332
66473
|
}
|
|
66333
|
-
await startPromise;
|
|
66334
66474
|
} catch (err) {
|
|
66335
66475
|
printStartupFailed(err);
|
|
66336
66476
|
const e = err;
|
|
@@ -66476,10 +66616,11 @@ const killChildrenAndExit = (logger, code) => {
|
|
|
66476
66616
|
};
|
|
66477
66617
|
const installProcessGuards = (logger) => {
|
|
66478
66618
|
process.on("uncaughtException", (err, origin) => {
|
|
66619
|
+
const summary = `${err.name}: ${err.message}`;
|
|
66479
66620
|
logger.fatal({
|
|
66480
66621
|
err,
|
|
66481
66622
|
origin
|
|
66482
|
-
},
|
|
66623
|
+
}, `Unexpected error: ${summary}. See the stack trace for where it occurred.`);
|
|
66483
66624
|
killChildrenAndExit(logger, 1);
|
|
66484
66625
|
});
|
|
66485
66626
|
process.on("unhandledRejection", (reason, promise) => {
|
|
@@ -66489,10 +66630,17 @@ const installProcessGuards = (logger) => {
|
|
|
66489
66630
|
stack: reason.stack
|
|
66490
66631
|
} : { value: String(reason) };
|
|
66491
66632
|
const stackDump = promise && typeof promise.stack === "string" ? promise.stack : void 0;
|
|
66633
|
+
const summary = reason instanceof Error ? `${reason.name}: ${reason.message}` : typeof reason === "string" ? reason : (() => {
|
|
66634
|
+
try {
|
|
66635
|
+
return JSON.stringify(reason) ?? String(reason);
|
|
66636
|
+
} catch {
|
|
66637
|
+
return String(reason);
|
|
66638
|
+
}
|
|
66639
|
+
})();
|
|
66492
66640
|
logger.fatal({
|
|
66493
66641
|
reason: reasonDump,
|
|
66494
66642
|
...stackDump !== void 0 ? { stack: stackDump } : {}
|
|
66495
|
-
},
|
|
66643
|
+
}, `An asynchronous operation failed: ${summary}. See the stack trace for where it originated.`);
|
|
66496
66644
|
killChildrenAndExit(logger, 1);
|
|
66497
66645
|
});
|
|
66498
66646
|
process.on("SIGTERM", () => {
|
package/package.json
CHANGED
|
@@ -6,7 +6,11 @@ export const configSchema = z
|
|
|
6
6
|
// is resolved from the live snapshot (agentAtSlot). Explicit
|
|
7
7
|
// providerId/sessionId pinning was never reachable (button ids are
|
|
8
8
|
// positional), so it's gone.
|
|
9
|
-
slot: z.number().int().min(0).default(0).meta({
|
|
9
|
+
slot: z.number().int().min(0).default(0).meta({
|
|
10
|
+
title: "Agent slot",
|
|
11
|
+
description:
|
|
12
|
+
"Zero-based position in the generated session deck. Slot 0 is the first discovered session; slots are assigned dynamically, so they are not fixed to a provider or session ID.",
|
|
13
|
+
}),
|
|
10
14
|
})
|
|
11
15
|
.strict()
|
|
12
16
|
|
|
@@ -2,12 +2,21 @@ import { z } from "zod"
|
|
|
2
2
|
|
|
3
3
|
export const configSchema = z
|
|
4
4
|
.object({
|
|
5
|
-
showCount: z.boolean().default(true).meta({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
showCount: z.boolean().default(true).meta({
|
|
6
|
+
title: "Show count",
|
|
7
|
+
description:
|
|
8
|
+
"Show the number of discovered agent sessions on the summary tile.",
|
|
9
|
+
}),
|
|
10
|
+
attentionOnly: z.boolean().default(false).meta({
|
|
11
|
+
title: "Attention only",
|
|
12
|
+
description:
|
|
13
|
+
"Show the attention state only when a session needs attention; otherwise show the normal summary.",
|
|
14
|
+
}),
|
|
15
|
+
fallingLetters: z.boolean().default(true).meta({
|
|
16
|
+
title: "Falling letters",
|
|
17
|
+
description:
|
|
18
|
+
"Show the animated falling-letter background on the summary tile.",
|
|
19
|
+
}),
|
|
11
20
|
})
|
|
12
21
|
.strict()
|
|
13
22
|
|