@drisp/cli 0.4.1 → 0.4.2
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/{WorkflowInstallWizard-5JWVHIVJ.js → WorkflowInstallWizard-NDWLVIFI.js} +5 -3
- package/dist/athena-gateway.js +27 -113
- package/dist/chunk-2HR7FV3M.js +502 -0
- package/dist/{chunk-3FVULBV4.js → chunk-4CRZXLIP.js} +53 -117
- package/dist/chunk-6TJHAUNB.js +161 -0
- package/dist/{chunk-PSD3WBN4.js → chunk-BTKQ67RE.js} +1 -1
- package/dist/{chunk-LPG5WBPV.js → chunk-GE6PPB6Z.js} +11 -511
- package/dist/chunk-HXBCZAP7.js +1 -0
- package/dist/chunk-WHELLVBL.js +12361 -0
- package/dist/cli.js +3212 -13798
- package/dist/dashboard-daemon.js +255 -0
- package/dist/hook-forwarder.js +2 -1
- package/package.json +3 -2
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
McpOptionsStep,
|
|
3
|
-
StepStatus
|
|
3
|
+
StepStatus
|
|
4
|
+
} from "./chunk-2HR7FV3M.js";
|
|
5
|
+
import {
|
|
4
6
|
collectMcpServersWithOptions,
|
|
5
7
|
installWorkflowFromSource,
|
|
6
8
|
installWorkflowPlugins,
|
|
7
9
|
resolveWorkflow,
|
|
8
10
|
writeGlobalConfig
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GE6PPB6Z.js";
|
|
10
12
|
|
|
11
13
|
// src/setup/steps/WorkflowInstallWizard.tsx
|
|
12
14
|
import { useState, useEffect, useCallback, useRef } from "react";
|
|
@@ -90,4 +92,4 @@ function WorkflowInstallWizard({ source, onDone }) {
|
|
|
90
92
|
export {
|
|
91
93
|
WorkflowInstallWizard as default
|
|
92
94
|
};
|
|
93
|
-
//# sourceMappingURL=WorkflowInstallWizard-
|
|
95
|
+
//# sourceMappingURL=WorkflowInstallWizard-NDWLVIFI.js.map
|
package/dist/athena-gateway.js
CHANGED
|
@@ -1,110 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
loadChannelSidecars,
|
|
4
|
+
loadOrCreateToken,
|
|
5
|
+
requireTokenForBind,
|
|
6
|
+
timingSafeTokenEqual
|
|
7
|
+
} from "./chunk-6TJHAUNB.js";
|
|
2
8
|
import {
|
|
3
9
|
CHANNEL_REQUEST_ID_REGEX,
|
|
4
10
|
createUdsServerTransport,
|
|
5
11
|
generateChannelRequestId,
|
|
6
12
|
isLoopbackHost,
|
|
7
13
|
isValidChannelRequestId,
|
|
8
|
-
loadOrCreateToken,
|
|
9
14
|
refreshDashboardAccessToken,
|
|
10
|
-
requireTokenForBind,
|
|
11
15
|
resolveGatewayPaths,
|
|
12
16
|
resolveListenSpec,
|
|
13
|
-
timingSafeTokenEqual,
|
|
14
17
|
traceGatewayFrame,
|
|
15
18
|
trackGatewayRuntimeExpired,
|
|
16
19
|
trackGatewayRuntimeRebind,
|
|
17
20
|
trackGatewayTransportConnect,
|
|
18
21
|
trackGatewayTransportDisconnect,
|
|
19
22
|
writeGatewayTrace
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4CRZXLIP.js";
|
|
21
24
|
|
|
22
25
|
// src/gateway/daemon.ts
|
|
23
26
|
import crypto from "crypto";
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
// src/infra/config/channels.ts
|
|
27
|
-
import fs from "fs";
|
|
28
|
-
import os from "os";
|
|
29
|
-
import path from "path";
|
|
30
|
-
function channelSidecarDir(home = os.homedir()) {
|
|
31
|
-
return path.join(home, ".config", "athena", "channels");
|
|
32
|
-
}
|
|
33
|
-
function loadChannelSidecars(home = os.homedir()) {
|
|
34
|
-
const dir = channelSidecarDir(home);
|
|
35
|
-
const sidecars = [];
|
|
36
|
-
const errors = [];
|
|
37
|
-
let entries;
|
|
38
|
-
try {
|
|
39
|
-
entries = fs.readdirSync(dir);
|
|
40
|
-
} catch (err) {
|
|
41
|
-
const code = err.code;
|
|
42
|
-
if (code === "ENOENT") return { sidecars, errors };
|
|
43
|
-
errors.push({
|
|
44
|
-
path: dir,
|
|
45
|
-
reason: `read dir failed: ${err instanceof Error ? err.message : String(err)}`
|
|
46
|
-
});
|
|
47
|
-
return { sidecars, errors };
|
|
48
|
-
}
|
|
49
|
-
for (const entry of entries) {
|
|
50
|
-
if (!entry.endsWith(".json")) continue;
|
|
51
|
-
const full = path.join(dir, entry);
|
|
52
|
-
const name = entry.slice(0, -".json".length);
|
|
53
|
-
const result = loadOne(name, full);
|
|
54
|
-
if (result.ok) sidecars.push(result.sidecar);
|
|
55
|
-
else errors.push({ path: full, reason: result.reason });
|
|
56
|
-
}
|
|
57
|
-
return { sidecars, errors };
|
|
58
|
-
}
|
|
59
|
-
function loadOne(name, filePath) {
|
|
60
|
-
let raw;
|
|
61
|
-
try {
|
|
62
|
-
if (process.platform !== "win32") {
|
|
63
|
-
const stat = fs.statSync(filePath);
|
|
64
|
-
if ((stat.mode & 63) !== 0) {
|
|
65
|
-
return {
|
|
66
|
-
ok: false,
|
|
67
|
-
reason: `file ${filePath} is too permissive (mode ${(stat.mode & 511).toString(8)}); chmod 600`
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
raw = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
72
|
-
} catch (err) {
|
|
73
|
-
return {
|
|
74
|
-
ok: false,
|
|
75
|
-
reason: err instanceof Error ? err.message : String(err)
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
if (typeof raw !== "object" || raw === null) {
|
|
79
|
-
return { ok: false, reason: "config root must be an object" };
|
|
80
|
-
}
|
|
81
|
-
const obj = raw;
|
|
82
|
-
const userIdsRaw = obj["allowed_user_ids"];
|
|
83
|
-
const allowedUserIds = [];
|
|
84
|
-
if (userIdsRaw !== void 0) {
|
|
85
|
-
if (!Array.isArray(userIdsRaw)) {
|
|
86
|
-
return { ok: false, reason: "allowed_user_ids must be an array" };
|
|
87
|
-
}
|
|
88
|
-
for (const id of userIdsRaw) {
|
|
89
|
-
if (typeof id === "string") allowedUserIds.push(id);
|
|
90
|
-
else if (typeof id === "number") allowedUserIds.push(String(id));
|
|
91
|
-
else
|
|
92
|
-
return {
|
|
93
|
-
ok: false,
|
|
94
|
-
reason: "allowed_user_ids entries must be string or number"
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const options = {};
|
|
99
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
100
|
-
if (key === "allowed_user_ids") continue;
|
|
101
|
-
options[key] = value;
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
ok: true,
|
|
105
|
-
sidecar: { name, path: filePath, allowedUserIds, options }
|
|
106
|
-
};
|
|
107
|
-
}
|
|
27
|
+
import fs3 from "fs";
|
|
108
28
|
|
|
109
29
|
// src/gateway/adapters/console/adapter.ts
|
|
110
30
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -461,18 +381,12 @@ var ConsoleAdapter = class {
|
|
|
461
381
|
runnerId: this.opts.runnerId,
|
|
462
382
|
...workspaceId.length > 0 ? { workspaceId } : {},
|
|
463
383
|
...msg.location.peer?.id !== void 0 ? { userId: msg.location.peer.id } : {},
|
|
464
|
-
...msg.location.thread?.id !== void 0 ? {
|
|
465
|
-
conversationId: msg.location.thread.id,
|
|
466
|
-
threadId: msg.location.thread.id
|
|
467
|
-
} : {}
|
|
384
|
+
...msg.location.thread?.id !== void 0 ? { threadId: msg.location.thread.id } : {}
|
|
468
385
|
},
|
|
469
386
|
messageId,
|
|
470
387
|
idempotencyKey: msg.idempotencyKey,
|
|
471
388
|
text: msg.text
|
|
472
389
|
};
|
|
473
|
-
writeGatewayTrace(
|
|
474
|
-
`consoleAdapter send message.out runner=${this.opts.runnerId} workspace=${frame.address.workspaceId ?? ""} conversation=${frame.address.conversationId ?? ""} thread=${frame.address.threadId ?? ""} user=${frame.address.userId ?? ""} textLength=${msg.text.length} idempotencyKey=${msg.idempotencyKey}`
|
|
475
|
-
);
|
|
476
390
|
client.sendFrame(frame);
|
|
477
391
|
return {
|
|
478
392
|
providerMessageId: messageId,
|
|
@@ -2100,7 +2014,7 @@ var cachedVersion = null;
|
|
|
2100
2014
|
function readVersion() {
|
|
2101
2015
|
if (cachedVersion !== null) return cachedVersion;
|
|
2102
2016
|
try {
|
|
2103
|
-
const injected = "0.4.
|
|
2017
|
+
const injected = "0.4.2";
|
|
2104
2018
|
if (typeof injected === "string" && injected.length > 0) {
|
|
2105
2019
|
cachedVersion = injected;
|
|
2106
2020
|
return cachedVersion;
|
|
@@ -2709,8 +2623,8 @@ var Dispatcher = class {
|
|
|
2709
2623
|
};
|
|
2710
2624
|
|
|
2711
2625
|
// src/gateway/lock.ts
|
|
2712
|
-
import
|
|
2713
|
-
import
|
|
2626
|
+
import fs from "fs";
|
|
2627
|
+
import path from "path";
|
|
2714
2628
|
var GatewayAlreadyRunningError = class extends Error {
|
|
2715
2629
|
otherPid;
|
|
2716
2630
|
constructor(otherPid) {
|
|
@@ -2730,7 +2644,7 @@ function isProcessAlive(pid) {
|
|
|
2730
2644
|
}
|
|
2731
2645
|
function readPidFile(p) {
|
|
2732
2646
|
try {
|
|
2733
|
-
const text =
|
|
2647
|
+
const text = fs.readFileSync(p, "utf-8").trim();
|
|
2734
2648
|
const pid = Number.parseInt(text, 10);
|
|
2735
2649
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
2736
2650
|
} catch {
|
|
@@ -2738,12 +2652,12 @@ function readPidFile(p) {
|
|
|
2738
2652
|
}
|
|
2739
2653
|
}
|
|
2740
2654
|
function acquireLock(lockPath) {
|
|
2741
|
-
|
|
2655
|
+
fs.mkdirSync(path.dirname(lockPath), { recursive: true, mode: 448 });
|
|
2742
2656
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
2743
2657
|
try {
|
|
2744
|
-
const fd =
|
|
2745
|
-
|
|
2746
|
-
|
|
2658
|
+
const fd = fs.openSync(lockPath, "wx", 384);
|
|
2659
|
+
fs.writeSync(fd, String(process.pid) + "\n");
|
|
2660
|
+
fs.closeSync(fd);
|
|
2747
2661
|
return {
|
|
2748
2662
|
path: lockPath,
|
|
2749
2663
|
pid: process.pid,
|
|
@@ -2751,7 +2665,7 @@ function acquireLock(lockPath) {
|
|
|
2751
2665
|
try {
|
|
2752
2666
|
const pidNow = readPidFile(lockPath);
|
|
2753
2667
|
if (pidNow === process.pid) {
|
|
2754
|
-
|
|
2668
|
+
fs.unlinkSync(lockPath);
|
|
2755
2669
|
}
|
|
2756
2670
|
} catch {
|
|
2757
2671
|
}
|
|
@@ -2765,7 +2679,7 @@ function acquireLock(lockPath) {
|
|
|
2765
2679
|
throw new GatewayAlreadyRunningError(otherPid);
|
|
2766
2680
|
}
|
|
2767
2681
|
try {
|
|
2768
|
-
|
|
2682
|
+
fs.unlinkSync(lockPath);
|
|
2769
2683
|
} catch {
|
|
2770
2684
|
}
|
|
2771
2685
|
}
|
|
@@ -3133,13 +3047,13 @@ function questionFingerprint(req) {
|
|
|
3133
3047
|
}
|
|
3134
3048
|
|
|
3135
3049
|
// src/gateway/state/db.ts
|
|
3136
|
-
import
|
|
3137
|
-
import
|
|
3050
|
+
import fs2 from "fs";
|
|
3051
|
+
import path2 from "path";
|
|
3138
3052
|
import Database from "better-sqlite3";
|
|
3139
3053
|
var GATEWAY_STATE_VERSION = 1;
|
|
3140
3054
|
function openGatewayState(dbPath) {
|
|
3141
3055
|
if (dbPath !== ":memory:") {
|
|
3142
|
-
|
|
3056
|
+
fs2.mkdirSync(path2.dirname(dbPath), { recursive: true, mode: 448 });
|
|
3143
3057
|
}
|
|
3144
3058
|
const db = new Database(dbPath);
|
|
3145
3059
|
db.exec("PRAGMA journal_mode = WAL");
|
|
@@ -3147,7 +3061,7 @@ function openGatewayState(dbPath) {
|
|
|
3147
3061
|
initGatewayStateSchema(db);
|
|
3148
3062
|
if (dbPath !== ":memory:" && process.platform !== "win32") {
|
|
3149
3063
|
try {
|
|
3150
|
-
|
|
3064
|
+
fs2.chmodSync(dbPath, 384);
|
|
3151
3065
|
} catch {
|
|
3152
3066
|
}
|
|
3153
3067
|
}
|
|
@@ -3533,12 +3447,12 @@ async function startDaemon(opts) {
|
|
|
3533
3447
|
const startedAt = Date.now();
|
|
3534
3448
|
const pid = process.pid;
|
|
3535
3449
|
const paths = opts.paths ?? resolveGatewayPaths(opts.env);
|
|
3536
|
-
|
|
3537
|
-
|
|
3450
|
+
fs3.mkdirSync(paths.runDir, { recursive: true, mode: 448 });
|
|
3451
|
+
fs3.mkdirSync(paths.configDir, { recursive: true, mode: 448 });
|
|
3538
3452
|
if (process.platform !== "win32") {
|
|
3539
3453
|
try {
|
|
3540
|
-
|
|
3541
|
-
|
|
3454
|
+
fs3.chmodSync(paths.runDir, 448);
|
|
3455
|
+
fs3.chmodSync(paths.configDir, 448);
|
|
3542
3456
|
} catch {
|
|
3543
3457
|
}
|
|
3544
3458
|
}
|