@drisp/cli 0.4.4 → 0.4.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/dist/athena-gateway.js +195 -160
- package/dist/{chunk-6TJHAUNB.js → chunk-M44KEGM7.js} +15 -3
- package/dist/{chunk-JAPBSL7D.js → chunk-PJUDHH4R.js} +275 -148
- package/dist/cli.js +112 -4
- package/dist/dashboard-daemon.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import "./chunk-HXBCZAP7.js";
|
|
|
3
3
|
import {
|
|
4
4
|
channelSidecarDir,
|
|
5
5
|
rotateGatewayToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-M44KEGM7.js";
|
|
7
7
|
import {
|
|
8
8
|
CREDENTIAL_SOURCES_TRIED,
|
|
9
9
|
EXEC_EXIT_CODE,
|
|
@@ -50,10 +50,12 @@ import {
|
|
|
50
50
|
probeSkipReason,
|
|
51
51
|
processRegistry,
|
|
52
52
|
progressGlyphs,
|
|
53
|
+
readAttachmentMirror,
|
|
53
54
|
readGatewayClientConfig,
|
|
54
55
|
readPidLock,
|
|
55
56
|
register,
|
|
56
57
|
registerCleanupOnExit,
|
|
58
|
+
removeAttachmentMirror,
|
|
57
59
|
resolveClaudeBinary,
|
|
58
60
|
resolveClaudeSettingsSurfacePaths,
|
|
59
61
|
resolveHarnessAdapter,
|
|
@@ -68,9 +70,10 @@ import {
|
|
|
68
70
|
startSessionBridge,
|
|
69
71
|
supportsSessionApproval,
|
|
70
72
|
todoGlyphSet,
|
|
73
|
+
writeAttachmentMirror,
|
|
71
74
|
writeGatewayClientConfig,
|
|
72
75
|
wsClientOptionsForEndpoint
|
|
73
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-PJUDHH4R.js";
|
|
74
77
|
import {
|
|
75
78
|
generateId as generateId2
|
|
76
79
|
} from "./chunk-BTKQ67RE.js";
|
|
@@ -15933,6 +15936,8 @@ Subcommands:
|
|
|
15933
15936
|
so the daemon starts automatically on login.
|
|
15934
15937
|
doctor Verify pairing health. With --runner <id>, also confirms the
|
|
15935
15938
|
runner is bound to this instance.
|
|
15939
|
+
list Print the local attachment mirror (the runners the dashboard
|
|
15940
|
+
reported as bound to this instance at the last pair/refresh).
|
|
15936
15941
|
console enable <runnerId>
|
|
15937
15942
|
Configure the console channel for a runner (opinionated;
|
|
15938
15943
|
writes the sidecar and reloads the gateway).
|
|
@@ -15959,7 +15964,7 @@ var cachedVersion = null;
|
|
|
15959
15964
|
function readPackageVersion() {
|
|
15960
15965
|
if (cachedVersion !== null) return cachedVersion;
|
|
15961
15966
|
try {
|
|
15962
|
-
const injected = "0.4.
|
|
15967
|
+
const injected = "0.4.5";
|
|
15963
15968
|
if (typeof injected === "string" && injected.length > 0) {
|
|
15964
15969
|
cachedVersion = injected;
|
|
15965
15970
|
return cachedVersion;
|
|
@@ -16002,6 +16007,9 @@ async function runDashboardCommand(input, deps = {}) {
|
|
|
16002
16007
|
const writeConfig = deps.writeConfig ?? ((c2) => writeDashboardClientConfig(c2));
|
|
16003
16008
|
const removeConfig = deps.removeConfig ?? (() => removeDashboardClientConfig());
|
|
16004
16009
|
const configPath = deps.configPath ?? (() => dashboardClientConfigPath());
|
|
16010
|
+
const readMirror = deps.readMirror ?? (() => readAttachmentMirror());
|
|
16011
|
+
const writeMirror = deps.writeMirror ?? ((m) => writeAttachmentMirror(m));
|
|
16012
|
+
const removeMirror = deps.removeMirror ?? (() => removeAttachmentMirror());
|
|
16005
16013
|
const packageVersion = deps.packageVersion ?? readPackageVersion();
|
|
16006
16014
|
const { subcommand, subcommandArgs, flags } = input;
|
|
16007
16015
|
if (!subcommand || subcommand === "help" || subcommand === "--help") {
|
|
@@ -16093,6 +16101,22 @@ async function runDashboardCommand(input, deps = {}) {
|
|
|
16093
16101
|
pairedAt: now()
|
|
16094
16102
|
};
|
|
16095
16103
|
writeConfig(config);
|
|
16104
|
+
try {
|
|
16105
|
+
writeMirror({
|
|
16106
|
+
instanceId: parsed.instanceId,
|
|
16107
|
+
fetchedAt: now(),
|
|
16108
|
+
attachments: (parsed.runners ?? []).map((r) => ({
|
|
16109
|
+
runnerId: r.runnerId,
|
|
16110
|
+
...r.name !== void 0 ? { name: r.name } : {},
|
|
16111
|
+
...r.executionTarget !== void 0 ? { executionTarget: r.executionTarget } : {},
|
|
16112
|
+
...r.remoteInstanceId !== void 0 ? { remoteInstanceId: r.remoteInstanceId } : {}
|
|
16113
|
+
}))
|
|
16114
|
+
});
|
|
16115
|
+
} catch (err) {
|
|
16116
|
+
logError(
|
|
16117
|
+
`dashboard pair: failed to write attachment mirror: ${err instanceof Error ? err.message : String(err)}`
|
|
16118
|
+
);
|
|
16119
|
+
}
|
|
16096
16120
|
const daemonStart = await (deps.startRuntimeDaemon ?? defaultStartRuntimeDaemon)({
|
|
16097
16121
|
log: (msg) => logOut(msg)
|
|
16098
16122
|
});
|
|
@@ -16810,14 +16834,22 @@ async function runDashboardCommand(input, deps = {}) {
|
|
|
16810
16834
|
return 1;
|
|
16811
16835
|
}
|
|
16812
16836
|
const dir = (deps.channelDir ?? channelSidecarDir)();
|
|
16837
|
+
const target = path7.join(dir, `console-${runnerId}.json`);
|
|
16838
|
+
const legacyTarget = path7.join(dir, "console.json");
|
|
16813
16839
|
let previousBroker;
|
|
16814
|
-
const target = path7.join(dir, "console.json");
|
|
16815
16840
|
try {
|
|
16816
16841
|
const existing = JSON.parse(fs7.readFileSync(target, "utf-8"));
|
|
16817
16842
|
if (typeof existing.broker_url === "string") {
|
|
16818
16843
|
previousBroker = existing.broker_url;
|
|
16819
16844
|
}
|
|
16820
16845
|
} catch {
|
|
16846
|
+
try {
|
|
16847
|
+
const legacy = JSON.parse(fs7.readFileSync(legacyTarget, "utf-8"));
|
|
16848
|
+
if (typeof legacy.broker_url === "string" && legacy.runner_id === runnerId) {
|
|
16849
|
+
previousBroker = legacy.broker_url;
|
|
16850
|
+
}
|
|
16851
|
+
} catch {
|
|
16852
|
+
}
|
|
16821
16853
|
}
|
|
16822
16854
|
try {
|
|
16823
16855
|
fs7.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
@@ -16828,6 +16860,8 @@ async function runDashboardCommand(input, deps = {}) {
|
|
|
16828
16860
|
return 1;
|
|
16829
16861
|
}
|
|
16830
16862
|
const payload = {
|
|
16863
|
+
kind: "console",
|
|
16864
|
+
instance_id: `console:${runnerId}`,
|
|
16831
16865
|
broker_url: brokerUrl,
|
|
16832
16866
|
runner_id: runnerId,
|
|
16833
16867
|
dashboard_config: true
|
|
@@ -16848,6 +16882,13 @@ async function runDashboardCommand(input, deps = {}) {
|
|
|
16848
16882
|
);
|
|
16849
16883
|
return 1;
|
|
16850
16884
|
}
|
|
16885
|
+
try {
|
|
16886
|
+
const legacy = JSON.parse(fs7.readFileSync(legacyTarget, "utf-8"));
|
|
16887
|
+
if (legacy.runner_id === runnerId) {
|
|
16888
|
+
fs7.unlinkSync(legacyTarget);
|
|
16889
|
+
}
|
|
16890
|
+
} catch {
|
|
16891
|
+
}
|
|
16851
16892
|
const reload = await (deps.reloadGatewayChannels ?? defaultReloadGatewayChannels)();
|
|
16852
16893
|
if (flags.json) {
|
|
16853
16894
|
logOut(
|
|
@@ -16882,6 +16923,72 @@ async function runDashboardCommand(input, deps = {}) {
|
|
|
16882
16923
|
);
|
|
16883
16924
|
return 2;
|
|
16884
16925
|
}
|
|
16926
|
+
if (subcommand === "list") {
|
|
16927
|
+
if (subcommandArgs.length > 0) {
|
|
16928
|
+
logError(`dashboard list: unexpected argument ${subcommandArgs[0]}`);
|
|
16929
|
+
return 2;
|
|
16930
|
+
}
|
|
16931
|
+
const config = readConfig2();
|
|
16932
|
+
if (!config) {
|
|
16933
|
+
if (flags.json) {
|
|
16934
|
+
logOut(JSON.stringify({ ok: false, paired: false }));
|
|
16935
|
+
} else {
|
|
16936
|
+
logError(
|
|
16937
|
+
'dashboard list: not paired. Run "drisp dashboard pair" first.'
|
|
16938
|
+
);
|
|
16939
|
+
}
|
|
16940
|
+
return 1;
|
|
16941
|
+
}
|
|
16942
|
+
const mirror = readMirror();
|
|
16943
|
+
if (!mirror) {
|
|
16944
|
+
if (flags.json) {
|
|
16945
|
+
logOut(
|
|
16946
|
+
JSON.stringify({
|
|
16947
|
+
ok: true,
|
|
16948
|
+
paired: true,
|
|
16949
|
+
instanceId: config.instanceId,
|
|
16950
|
+
attachments: [],
|
|
16951
|
+
mirror: null
|
|
16952
|
+
})
|
|
16953
|
+
);
|
|
16954
|
+
} else {
|
|
16955
|
+
logOut(
|
|
16956
|
+
`dashboard list: paired as ${config.instanceId}, no attachment mirror on disk.`
|
|
16957
|
+
);
|
|
16958
|
+
logOut(
|
|
16959
|
+
"dashboard list: re-run `drisp dashboard pair` to refresh the mirror."
|
|
16960
|
+
);
|
|
16961
|
+
}
|
|
16962
|
+
return 0;
|
|
16963
|
+
}
|
|
16964
|
+
if (flags.json) {
|
|
16965
|
+
logOut(
|
|
16966
|
+
JSON.stringify({
|
|
16967
|
+
ok: true,
|
|
16968
|
+
paired: true,
|
|
16969
|
+
instanceId: mirror.instanceId,
|
|
16970
|
+
fetchedAt: mirror.fetchedAt,
|
|
16971
|
+
attachments: mirror.attachments
|
|
16972
|
+
})
|
|
16973
|
+
);
|
|
16974
|
+
} else {
|
|
16975
|
+
logOut(`dashboard: instance ${mirror.instanceId}`);
|
|
16976
|
+
logOut(
|
|
16977
|
+
`dashboard: mirror fetched ${new Date(mirror.fetchedAt).toISOString()}`
|
|
16978
|
+
);
|
|
16979
|
+
if (mirror.attachments.length === 0) {
|
|
16980
|
+
logOut("dashboard: no runners attached.");
|
|
16981
|
+
} else {
|
|
16982
|
+
logOut(`dashboard: ${mirror.attachments.length} runner(s) attached:`);
|
|
16983
|
+
for (const a of mirror.attachments) {
|
|
16984
|
+
const label = a.name ? `${a.name} (${a.runnerId})` : a.runnerId;
|
|
16985
|
+
const target = a.executionTarget ? ` [${a.executionTarget}]` : "";
|
|
16986
|
+
logOut(` - ${label}${target}`);
|
|
16987
|
+
}
|
|
16988
|
+
}
|
|
16989
|
+
}
|
|
16990
|
+
return 0;
|
|
16991
|
+
}
|
|
16885
16992
|
if (subcommand === "unpair") {
|
|
16886
16993
|
if (subcommandArgs.length > 0) {
|
|
16887
16994
|
logError(`dashboard unpair: unexpected argument ${subcommandArgs[0]}`);
|
|
@@ -16953,6 +17060,7 @@ async function runDashboardCommand(input, deps = {}) {
|
|
|
16953
17060
|
}
|
|
16954
17061
|
}
|
|
16955
17062
|
removeConfig();
|
|
17063
|
+
removeMirror();
|
|
16956
17064
|
if (flags.json) {
|
|
16957
17065
|
logOut(
|
|
16958
17066
|
JSON.stringify({
|
package/dist/dashboard-daemon.js
CHANGED