@drisp/cli 0.5.13 → 0.5.15
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-7Y5PWAKW.js → WorkflowInstallWizard-AY4CPQS2.js} +2 -2
- package/dist/athena-gateway.js +3 -3
- package/dist/{chunk-MRAM6EYI.js → chunk-D4W7RB25.js} +2 -2
- package/dist/{chunk-7E54JMXH.js → chunk-SOW2QPXY.js} +234 -105
- package/dist/{chunk-BUNMENOT.js → chunk-UAZ2R7F3.js} +90 -40
- package/dist/{chunk-BTY7MYYT.js → chunk-WRHKXH5M.js} +2 -2
- package/dist/cli.js +30 -19
- package/dist/dashboard-daemon.js +3 -3
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
installWorkflowPlugins,
|
|
9
9
|
resolveWorkflow,
|
|
10
10
|
writeGlobalConfig
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SOW2QPXY.js";
|
|
12
12
|
|
|
13
13
|
// src/setup/steps/WorkflowInstallWizard.tsx
|
|
14
14
|
import { useState, useEffect, useCallback, useRef } from "react";
|
|
@@ -92,4 +92,4 @@ function WorkflowInstallWizard({ source, onDone }) {
|
|
|
92
92
|
export {
|
|
93
93
|
WorkflowInstallWizard as default
|
|
94
94
|
};
|
|
95
|
-
//# sourceMappingURL=WorkflowInstallWizard-
|
|
95
|
+
//# sourceMappingURL=WorkflowInstallWizard-AY4CPQS2.js.map
|
package/dist/athena-gateway.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
loadOrCreateToken,
|
|
4
4
|
requireTokenForBind,
|
|
5
5
|
timingSafeTokenEqual
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-D4W7RB25.js";
|
|
7
7
|
import {
|
|
8
8
|
CHANNEL_REQUEST_ID_REGEX,
|
|
9
9
|
createUdsServerTransport,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
trackGatewayTransportConnect,
|
|
20
20
|
trackGatewayTransportDisconnect,
|
|
21
21
|
writeGatewayTrace
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WRHKXH5M.js";
|
|
23
23
|
|
|
24
24
|
// src/gateway/daemon.ts
|
|
25
25
|
import fs4 from "fs";
|
|
@@ -2440,7 +2440,7 @@ var cachedVersion = null;
|
|
|
2440
2440
|
function readVersion() {
|
|
2441
2441
|
if (cachedVersion !== null) return cachedVersion;
|
|
2442
2442
|
try {
|
|
2443
|
-
const injected = "0.5.
|
|
2443
|
+
const injected = "0.5.15";
|
|
2444
2444
|
if (typeof injected === "string" && injected.length > 0) {
|
|
2445
2445
|
cachedVersion = injected;
|
|
2446
2446
|
return cachedVersion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isLoopbackHost
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WRHKXH5M.js";
|
|
4
4
|
|
|
5
5
|
// src/gateway/auth.ts
|
|
6
6
|
import crypto from "crypto";
|
|
@@ -73,4 +73,4 @@ export {
|
|
|
73
73
|
timingSafeTokenEqual,
|
|
74
74
|
requireTokenForBind
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-D4W7RB25.js.map
|
|
@@ -1,12 +1,150 @@
|
|
|
1
1
|
// src/infra/plugins/workflowResolver.ts
|
|
2
|
-
import
|
|
2
|
+
import fs3 from "fs";
|
|
3
3
|
import path2 from "path";
|
|
4
4
|
|
|
5
5
|
// src/infra/plugins/marketplaceShared.ts
|
|
6
|
-
import { execFileSync } from "child_process";
|
|
7
|
-
import
|
|
6
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
7
|
+
import fs2 from "fs";
|
|
8
8
|
import os from "os";
|
|
9
9
|
import path from "path";
|
|
10
|
+
|
|
11
|
+
// src/infra/plugins/marketplaceRefresh.ts
|
|
12
|
+
import { execFileSync } from "child_process";
|
|
13
|
+
import fs from "fs";
|
|
14
|
+
var MarketplaceRefreshError = class extends Error {
|
|
15
|
+
kind;
|
|
16
|
+
marketplace;
|
|
17
|
+
constructor(outcome) {
|
|
18
|
+
super(outcome.message);
|
|
19
|
+
this.name = "MarketplaceRefreshError";
|
|
20
|
+
this.kind = outcome.kind;
|
|
21
|
+
this.marketplace = outcome.marketplace;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var NETWORK_OR_AUTH_SIGNATURES = [
|
|
25
|
+
"could not resolve host",
|
|
26
|
+
"could not resolve proxy",
|
|
27
|
+
"couldn\u2019t resolve host",
|
|
28
|
+
"name or service not known",
|
|
29
|
+
"temporary failure in name resolution",
|
|
30
|
+
"failed to connect",
|
|
31
|
+
"connection timed out",
|
|
32
|
+
"connection refused",
|
|
33
|
+
"connection reset",
|
|
34
|
+
"network is unreachable",
|
|
35
|
+
"network unavailable",
|
|
36
|
+
"unable to access",
|
|
37
|
+
"ssl certificate problem",
|
|
38
|
+
"gnutls_handshake",
|
|
39
|
+
"authentication failed",
|
|
40
|
+
"could not read username",
|
|
41
|
+
"could not read password",
|
|
42
|
+
"permission denied (publickey)",
|
|
43
|
+
"terminal prompts disabled",
|
|
44
|
+
"invalid username or password",
|
|
45
|
+
"403 forbidden",
|
|
46
|
+
"access denied",
|
|
47
|
+
"repository not found",
|
|
48
|
+
"remote: not found"
|
|
49
|
+
];
|
|
50
|
+
function classifyGitFailure(message) {
|
|
51
|
+
const haystack = message.toLowerCase();
|
|
52
|
+
for (const signature of NETWORK_OR_AUTH_SIGNATURES) {
|
|
53
|
+
if (haystack.includes(signature)) {
|
|
54
|
+
return "network-or-auth";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return "unrecoverable-cache";
|
|
58
|
+
}
|
|
59
|
+
function repoUrlFor(owner, repo) {
|
|
60
|
+
return `https://github.com/${owner}/${repo}.git`;
|
|
61
|
+
}
|
|
62
|
+
var GIT_STDIO = ["ignore", "ignore", "pipe"];
|
|
63
|
+
function gitFailureText(error) {
|
|
64
|
+
const err = error;
|
|
65
|
+
const stderr = err.stderr == null ? "" : err.stderr.toString().trim();
|
|
66
|
+
const message = err.message ?? "";
|
|
67
|
+
return stderr ? `${message} ${stderr}`.trim() : message;
|
|
68
|
+
}
|
|
69
|
+
function cloneInto(repoUrl, repoDir) {
|
|
70
|
+
fs.mkdirSync(repoDir, { recursive: true });
|
|
71
|
+
try {
|
|
72
|
+
execFileSync("git", ["clone", "--depth", "1", repoUrl, repoDir], {
|
|
73
|
+
stdio: GIT_STDIO
|
|
74
|
+
});
|
|
75
|
+
} catch (error) {
|
|
76
|
+
fs.rmSync(repoDir, { recursive: true, force: true });
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function failureOutcome(kind, marketplace, cause, backupDir) {
|
|
81
|
+
const message = kind === "network-or-auth" ? `Could not refresh the "${marketplace}" marketplace: the remote could not be reached (connectivity or authentication problem). ${cause}` : `Could not refresh the "${marketplace}" marketplace: the cached copy is corrupt and could not be rebuilt.${backupDir ? ` Previous cache preserved at ${backupDir}.` : ""} ${cause}`;
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
kind,
|
|
85
|
+
marketplace,
|
|
86
|
+
message,
|
|
87
|
+
cause,
|
|
88
|
+
...backupDir ? { backupDir } : {}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function refreshMarketplaceRepo(owner, repo) {
|
|
92
|
+
const marketplace = `${owner}/${repo}`;
|
|
93
|
+
const repoDir = marketplaceRepoCacheDir(owner, repo);
|
|
94
|
+
const repoUrl = repoUrlFor(owner, repo);
|
|
95
|
+
if (!fs.existsSync(repoDir)) {
|
|
96
|
+
try {
|
|
97
|
+
cloneInto(repoUrl, repoDir);
|
|
98
|
+
return { ok: true, repoDir };
|
|
99
|
+
} catch (cloneError) {
|
|
100
|
+
const cause = gitFailureText(cloneError);
|
|
101
|
+
return failureOutcome(classifyGitFailure(cause), marketplace, cause);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
execFileSync("git", ["pull", "--ff-only"], {
|
|
106
|
+
cwd: repoDir,
|
|
107
|
+
stdio: GIT_STDIO
|
|
108
|
+
});
|
|
109
|
+
return { ok: true, repoDir };
|
|
110
|
+
} catch {
|
|
111
|
+
const backupDir = `${repoDir}.backup-${Date.now()}`;
|
|
112
|
+
try {
|
|
113
|
+
fs.renameSync(repoDir, backupDir);
|
|
114
|
+
cloneInto(repoUrl, repoDir);
|
|
115
|
+
return { ok: true, repoDir, selfHealed: true, backupDir };
|
|
116
|
+
} catch (recoveryError) {
|
|
117
|
+
const cause = gitFailureText(recoveryError);
|
|
118
|
+
return failureOutcome(
|
|
119
|
+
classifyGitFailure(cause),
|
|
120
|
+
marketplace,
|
|
121
|
+
cause,
|
|
122
|
+
backupDir
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function ensureFailureOutcome(kind, marketplace, cause) {
|
|
128
|
+
const message = kind === "network-or-auth" ? `Could not reach the "${marketplace}" marketplace: the remote could not be reached (connectivity or authentication problem). ${cause}` : `Could not clone the "${marketplace}" marketplace: the local cache could not be created. ${cause}`;
|
|
129
|
+
return { ok: false, kind, marketplace, message, cause };
|
|
130
|
+
}
|
|
131
|
+
function ensureRepo(owner, repo) {
|
|
132
|
+
const repoDir = marketplaceRepoCacheDir(owner, repo);
|
|
133
|
+
if (!fs.existsSync(repoDir)) {
|
|
134
|
+
const marketplace = `${owner}/${repo}`;
|
|
135
|
+
try {
|
|
136
|
+
cloneInto(repoUrlFor(owner, repo), repoDir);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
const cause = gitFailureText(error);
|
|
139
|
+
throw new MarketplaceRefreshError(
|
|
140
|
+
ensureFailureOutcome(classifyGitFailure(cause), marketplace, cause)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return repoDir;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/infra/plugins/marketplaceShared.ts
|
|
10
148
|
var MARKETPLACE_REF_RE = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/;
|
|
11
149
|
var MARKETPLACE_SLUG_RE = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/;
|
|
12
150
|
function marketplacesCacheDir() {
|
|
@@ -23,17 +161,17 @@ function resolvePluginManifestPath(repoDir) {
|
|
|
23
161
|
"marketplace.json"
|
|
24
162
|
);
|
|
25
163
|
const legacyManifestPath = resolveLegacyPluginManifestPath(repoDir);
|
|
26
|
-
return
|
|
164
|
+
return fs2.existsSync(preferredManifestPath) ? preferredManifestPath : legacyManifestPath;
|
|
27
165
|
}
|
|
28
166
|
function resolveLegacyPluginManifestPath(repoDir) {
|
|
29
167
|
return path.join(repoDir, ".claude-plugin", "marketplace.json");
|
|
30
168
|
}
|
|
31
169
|
function readManifest(manifestPath) {
|
|
32
|
-
if (!
|
|
170
|
+
if (!fs2.existsSync(manifestPath)) {
|
|
33
171
|
throw new Error(`Marketplace manifest not found: ${manifestPath}`);
|
|
34
172
|
}
|
|
35
173
|
return JSON.parse(
|
|
36
|
-
|
|
174
|
+
fs2.readFileSync(manifestPath, "utf-8")
|
|
37
175
|
);
|
|
38
176
|
}
|
|
39
177
|
function entryRelativeSourcePath(entry, pluginName) {
|
|
@@ -91,7 +229,7 @@ function resolvePluginDirFromManifest(pluginName, repoDir, manifestPath) {
|
|
|
91
229
|
repoDir,
|
|
92
230
|
entryRelativeSourcePath(entry, pluginName)
|
|
93
231
|
);
|
|
94
|
-
if (!
|
|
232
|
+
if (!fs2.existsSync(pluginDir)) {
|
|
95
233
|
throw new Error(`Plugin source directory not found: ${pluginDir}`);
|
|
96
234
|
}
|
|
97
235
|
return pluginDir;
|
|
@@ -140,9 +278,9 @@ function resolvePluginVersionFromDir(pluginDir) {
|
|
|
140
278
|
path.join(pluginDir, ".claude-plugin", "plugin.json")
|
|
141
279
|
];
|
|
142
280
|
for (const manifestPath of manifestPaths) {
|
|
143
|
-
if (!
|
|
281
|
+
if (!fs2.existsSync(manifestPath)) continue;
|
|
144
282
|
try {
|
|
145
|
-
const manifest = JSON.parse(
|
|
283
|
+
const manifest = JSON.parse(fs2.readFileSync(manifestPath, "utf-8"));
|
|
146
284
|
if (typeof manifest.version === "string" && manifest.version.length > 0) {
|
|
147
285
|
return manifest.version;
|
|
148
286
|
}
|
|
@@ -153,12 +291,12 @@ function resolvePluginVersionFromDir(pluginDir) {
|
|
|
153
291
|
}
|
|
154
292
|
function resolvePackagedArtifactLayout(pluginRoot, version) {
|
|
155
293
|
const releasePath = path.join(pluginRoot, "dist", version, "release.json");
|
|
156
|
-
if (!
|
|
294
|
+
if (!fs2.existsSync(releasePath)) {
|
|
157
295
|
return void 0;
|
|
158
296
|
}
|
|
159
297
|
try {
|
|
160
298
|
const release = JSON.parse(
|
|
161
|
-
|
|
299
|
+
fs2.readFileSync(releasePath, "utf-8")
|
|
162
300
|
);
|
|
163
301
|
if (release.version !== version) {
|
|
164
302
|
return void 0;
|
|
@@ -179,7 +317,7 @@ function resolvePackagedArtifactLayout(pluginRoot, version) {
|
|
|
179
317
|
if (!isPathWithinRoot(releaseDir, claudeArtifactDir) || !isPathWithinRoot(releaseDir, resolvedCodexMarketplacePath) || !isPathWithinRoot(releaseDir, codexPluginDir)) {
|
|
180
318
|
return void 0;
|
|
181
319
|
}
|
|
182
|
-
if (!
|
|
320
|
+
if (!fs2.existsSync(claudeArtifactDir) || !fs2.existsSync(resolvedCodexMarketplacePath) || !fs2.existsSync(codexPluginDir)) {
|
|
183
321
|
return void 0;
|
|
184
322
|
}
|
|
185
323
|
return {
|
|
@@ -191,27 +329,9 @@ function resolvePackagedArtifactLayout(pluginRoot, version) {
|
|
|
191
329
|
return void 0;
|
|
192
330
|
}
|
|
193
331
|
}
|
|
194
|
-
function ensureRepo(owner, repo) {
|
|
195
|
-
const repoDir = marketplaceRepoCacheDir(owner, repo);
|
|
196
|
-
if (!fs.existsSync(repoDir)) {
|
|
197
|
-
const repoUrl = `https://github.com/${owner}/${repo}.git`;
|
|
198
|
-
fs.mkdirSync(repoDir, { recursive: true });
|
|
199
|
-
try {
|
|
200
|
-
execFileSync("git", ["clone", "--depth", "1", repoUrl, repoDir], {
|
|
201
|
-
stdio: "ignore"
|
|
202
|
-
});
|
|
203
|
-
} catch (error) {
|
|
204
|
-
fs.rmSync(repoDir, { recursive: true, force: true });
|
|
205
|
-
throw new Error(
|
|
206
|
-
`Failed to clone marketplace repo ${owner}/${repo}: ${error.message}`
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return repoDir;
|
|
211
|
-
}
|
|
212
332
|
function requireGitForMarketplace(kind) {
|
|
213
333
|
try {
|
|
214
|
-
|
|
334
|
+
execFileSync2("git", ["--version"], { stdio: "ignore" });
|
|
215
335
|
} catch {
|
|
216
336
|
throw new Error(
|
|
217
337
|
`git is not installed. Install git to use marketplace ${kind}.`
|
|
@@ -270,14 +390,14 @@ var WorkflowVersionNotFoundError = class extends Error {
|
|
|
270
390
|
function resolveWorkflowManifestPath(repoDir) {
|
|
271
391
|
const preferred = path2.join(repoDir, ".athena-workflow", "marketplace.json");
|
|
272
392
|
const legacy = path2.join(repoDir, ".claude-plugin", "marketplace.json");
|
|
273
|
-
return
|
|
393
|
+
return fs3.existsSync(preferred) ? preferred : legacy;
|
|
274
394
|
}
|
|
275
395
|
function preferCanonicalWorkflowPath(repoDir, workflowPath) {
|
|
276
396
|
const relativePath = path2.relative(repoDir, workflowPath);
|
|
277
397
|
const segments = relativePath.split(path2.sep);
|
|
278
398
|
if (segments[0] !== ".workflows") return workflowPath;
|
|
279
399
|
const canonical = path2.join(repoDir, "workflows", ...segments.slice(1));
|
|
280
|
-
return
|
|
400
|
+
return fs3.existsSync(canonical) ? canonical : workflowPath;
|
|
281
401
|
}
|
|
282
402
|
function resolveWorkflowEntryPath(entry, manifest, repoDir) {
|
|
283
403
|
if (typeof entry.source !== "string") {
|
|
@@ -297,7 +417,7 @@ function resolveWorkflowEntryPath(entry, manifest, repoDir) {
|
|
|
297
417
|
);
|
|
298
418
|
}
|
|
299
419
|
const resolved = preferCanonicalWorkflowPath(repoDir, workflowPath);
|
|
300
|
-
if (!
|
|
420
|
+
if (!fs3.existsSync(resolved)) {
|
|
301
421
|
throw new Error(`Workflow source not found: ${resolved}`);
|
|
302
422
|
}
|
|
303
423
|
return resolved;
|
|
@@ -331,7 +451,7 @@ function listWorkflowEntriesFromManifest(repoDir, manifestPath, source) {
|
|
|
331
451
|
function findMarketplaceRepoDir(startPath) {
|
|
332
452
|
let currentDir = path2.resolve(startPath);
|
|
333
453
|
for (; ; ) {
|
|
334
|
-
if (
|
|
454
|
+
if (fs3.existsSync(resolveWorkflowManifestPath(currentDir)) || fs3.existsSync(resolvePluginManifestPath(currentDir))) {
|
|
335
455
|
return currentDir;
|
|
336
456
|
}
|
|
337
457
|
const parentDir = path2.dirname(currentDir);
|
|
@@ -342,7 +462,7 @@ function findMarketplaceRepoDir(startPath) {
|
|
|
342
462
|
function resolveWorkflowMarketplaceSource(source) {
|
|
343
463
|
const trimmed = source.trim();
|
|
344
464
|
const resolvedPath = path2.resolve(trimmed);
|
|
345
|
-
if (!
|
|
465
|
+
if (!fs3.existsSync(resolvedPath) && isMarketplaceSlug(trimmed)) {
|
|
346
466
|
const slashIdx = trimmed.indexOf("/");
|
|
347
467
|
return {
|
|
348
468
|
kind: "remote",
|
|
@@ -388,10 +508,10 @@ function resolveMarketplaceWorkflow(ref) {
|
|
|
388
508
|
function gatherMarketplaceWorkflowSources(source) {
|
|
389
509
|
const trimmed = source.trim();
|
|
390
510
|
const resolvedPath = path2.resolve(trimmed);
|
|
391
|
-
if (
|
|
392
|
-
return [{ kind: "filesystem", workflowPath:
|
|
511
|
+
if (fs3.existsSync(resolvedPath) && fs3.statSync(resolvedPath).isFile()) {
|
|
512
|
+
return [{ kind: "filesystem", workflowPath: fs3.realpathSync(resolvedPath) }];
|
|
393
513
|
}
|
|
394
|
-
if (!
|
|
514
|
+
if (!fs3.existsSync(resolvedPath) && isMarketplaceSlug(trimmed)) {
|
|
395
515
|
const slashIdx = trimmed.indexOf("/");
|
|
396
516
|
const owner = trimmed.slice(0, slashIdx);
|
|
397
517
|
const repo = trimmed.slice(slashIdx + 1);
|
|
@@ -421,7 +541,7 @@ function gatherMarketplaceWorkflowSources(source) {
|
|
|
421
541
|
`Marketplace source not found: ${trimmed}. Expected a marketplace repo root, a path inside one, or an owner/repo slug.`
|
|
422
542
|
);
|
|
423
543
|
}
|
|
424
|
-
const canonicalRepoDir =
|
|
544
|
+
const canonicalRepoDir = fs3.realpathSync(repoDir);
|
|
425
545
|
const manifestPath = resolveWorkflowManifestPath(canonicalRepoDir);
|
|
426
546
|
return listWorkflowEntriesFromManifest(canonicalRepoDir, manifestPath, {
|
|
427
547
|
kind: "local",
|
|
@@ -485,8 +605,8 @@ function resolveWorkflowInstall(sourceOrName, configuredSources) {
|
|
|
485
605
|
};
|
|
486
606
|
}
|
|
487
607
|
const resolvedPath = path2.resolve(sourceOrName);
|
|
488
|
-
if (
|
|
489
|
-
return { kind: "filesystem", workflowPath:
|
|
608
|
+
if (fs3.existsSync(resolvedPath) && fs3.statSync(resolvedPath).isFile()) {
|
|
609
|
+
return { kind: "filesystem", workflowPath: fs3.realpathSync(resolvedPath) };
|
|
490
610
|
}
|
|
491
611
|
const { bareName, pinnedVersion } = parseBareWorkflowName(sourceOrName);
|
|
492
612
|
if (bareName.includes("/") || bareName.includes("\\")) {
|
|
@@ -530,13 +650,9 @@ function resolveWorkflowInstall(sourceOrName, configuredSources) {
|
|
|
530
650
|
return allListings[0];
|
|
531
651
|
}
|
|
532
652
|
|
|
533
|
-
// src/infra/plugins/
|
|
653
|
+
// src/infra/plugins/versionedPluginResolution.ts
|
|
534
654
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
535
655
|
import fs4 from "fs";
|
|
536
|
-
|
|
537
|
-
// src/infra/plugins/versionedPluginResolution.ts
|
|
538
|
-
import { execFileSync as execFileSync2 } from "child_process";
|
|
539
|
-
import fs3 from "fs";
|
|
540
656
|
import os2 from "os";
|
|
541
657
|
import path3 from "path";
|
|
542
658
|
var PLUGIN_NPM_SCOPE = "@athenaflow";
|
|
@@ -554,7 +670,7 @@ function resolveVersionedPluginDir(owner, repo, pluginName, version) {
|
|
|
554
670
|
pluginName,
|
|
555
671
|
version
|
|
556
672
|
);
|
|
557
|
-
return
|
|
673
|
+
return fs4.existsSync(cacheDir) ? cacheDir : void 0;
|
|
558
674
|
}
|
|
559
675
|
function fetchPluginPackage(owner, repo, pluginName, version) {
|
|
560
676
|
const npmPkg = pluginNpmPackageName(pluginName);
|
|
@@ -565,46 +681,46 @@ function fetchPluginPackage(owner, repo, pluginName, version) {
|
|
|
565
681
|
pluginName,
|
|
566
682
|
version
|
|
567
683
|
);
|
|
568
|
-
if (
|
|
684
|
+
if (fs4.existsSync(destDir)) {
|
|
569
685
|
return destDir;
|
|
570
686
|
}
|
|
571
687
|
const cacheBase = versionedPluginCacheDir();
|
|
572
|
-
|
|
573
|
-
const tmpDir =
|
|
688
|
+
fs4.mkdirSync(cacheBase, { recursive: true });
|
|
689
|
+
const tmpDir = fs4.mkdtempSync(path3.join(cacheBase, ".tmp-"));
|
|
574
690
|
try {
|
|
575
|
-
const tarball =
|
|
691
|
+
const tarball = execFileSync3(
|
|
576
692
|
"npm",
|
|
577
693
|
["pack", `${npmPkg}@${version}`, "--pack-destination", tmpDir],
|
|
578
694
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
579
695
|
).trim();
|
|
580
696
|
const tarballPath = path3.join(tmpDir, tarball);
|
|
581
|
-
if (!
|
|
697
|
+
if (!fs4.existsSync(tarballPath)) {
|
|
582
698
|
throw new Error(`npm pack did not produce expected tarball: ${tarball}`);
|
|
583
699
|
}
|
|
584
700
|
const extractDir = path3.join(tmpDir, "extracted");
|
|
585
|
-
|
|
586
|
-
|
|
701
|
+
fs4.mkdirSync(extractDir, { recursive: true });
|
|
702
|
+
execFileSync3("tar", ["xzf", tarballPath, "-C", extractDir], {
|
|
587
703
|
stdio: "ignore"
|
|
588
704
|
});
|
|
589
705
|
const packageDir = path3.join(extractDir, "package");
|
|
590
|
-
if (!
|
|
706
|
+
if (!fs4.existsSync(packageDir)) {
|
|
591
707
|
throw new Error(
|
|
592
708
|
"Extracted tarball does not contain a package/ directory"
|
|
593
709
|
);
|
|
594
710
|
}
|
|
595
|
-
|
|
711
|
+
fs4.mkdirSync(path3.dirname(destDir), { recursive: true });
|
|
596
712
|
try {
|
|
597
|
-
|
|
713
|
+
fs4.renameSync(packageDir, destDir);
|
|
598
714
|
} catch (error) {
|
|
599
715
|
const code = typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
600
|
-
if ((code === "EEXIST" || code === "ENOTEMPTY") &&
|
|
716
|
+
if ((code === "EEXIST" || code === "ENOTEMPTY") && fs4.existsSync(destDir)) {
|
|
601
717
|
return destDir;
|
|
602
718
|
}
|
|
603
719
|
throw error;
|
|
604
720
|
}
|
|
605
721
|
return destDir;
|
|
606
722
|
} finally {
|
|
607
|
-
|
|
723
|
+
fs4.rmSync(tmpDir, { recursive: true, force: true });
|
|
608
724
|
}
|
|
609
725
|
}
|
|
610
726
|
function resolvePackagedArtifactsOrThrow(pluginName, version, pluginRoot, stage) {
|
|
@@ -648,7 +764,7 @@ function resolveMarketplaceSourceFallback(ref, pluginName, version, repoDir) {
|
|
|
648
764
|
);
|
|
649
765
|
}
|
|
650
766
|
function describeSourceFallbackRejection(owner, repo, pluginName, version, repoDir) {
|
|
651
|
-
if (!
|
|
767
|
+
if (!fs4.existsSync(repoDir)) {
|
|
652
768
|
return `source fallback was unavailable because marketplace repo ${owner}/${repo} is not cached locally`;
|
|
653
769
|
}
|
|
654
770
|
let entry;
|
|
@@ -701,7 +817,7 @@ function resolveVersionedMarketplacePluginTarget(ref, version, sourceRepoDir, op
|
|
|
701
817
|
npmError = error;
|
|
702
818
|
}
|
|
703
819
|
const repoDir = sourceRepoDir ?? ensureRepo(owner, repo);
|
|
704
|
-
const fallbackTarget =
|
|
820
|
+
const fallbackTarget = fs4.existsSync(repoDir) ? resolveMarketplaceSourceFallback(ref, pluginName, version, repoDir) : void 0;
|
|
705
821
|
if (fallbackTarget) {
|
|
706
822
|
return fallbackTarget;
|
|
707
823
|
}
|
|
@@ -724,44 +840,6 @@ function refreshVersionedMarketplacePluginTarget(ref, version, sourceRepoDir) {
|
|
|
724
840
|
}
|
|
725
841
|
|
|
726
842
|
// src/infra/plugins/marketplace.ts
|
|
727
|
-
function pullMarketplaceRepo(owner, repo) {
|
|
728
|
-
const repoDir = marketplaceRepoCacheDir(owner, repo);
|
|
729
|
-
const repoUrl = `https://github.com/${owner}/${repo}.git`;
|
|
730
|
-
if (!fs4.existsSync(repoDir)) {
|
|
731
|
-
cloneMarketplaceRepo(owner, repo, repoUrl, repoDir);
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
try {
|
|
735
|
-
execFileSync3("git", ["pull", "--ff-only"], {
|
|
736
|
-
cwd: repoDir,
|
|
737
|
-
stdio: "ignore"
|
|
738
|
-
});
|
|
739
|
-
return;
|
|
740
|
-
} catch (pullError) {
|
|
741
|
-
const backupDir = `${repoDir}.backup-${Date.now()}`;
|
|
742
|
-
try {
|
|
743
|
-
fs4.renameSync(repoDir, backupDir);
|
|
744
|
-
cloneMarketplaceRepo(owner, repo, repoUrl, repoDir);
|
|
745
|
-
} catch (recoveryError) {
|
|
746
|
-
throw new Error(
|
|
747
|
-
`Failed to refresh marketplace repo ${owner}/${repo}: ${pullError.message}. Recovery clone failed: ${recoveryError.message}. Preserved previous cache at ${backupDir}.`
|
|
748
|
-
);
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
function cloneMarketplaceRepo(owner, repo, repoUrl, repoDir) {
|
|
753
|
-
fs4.mkdirSync(repoDir, { recursive: true });
|
|
754
|
-
try {
|
|
755
|
-
execFileSync3("git", ["clone", "--depth", "1", repoUrl, repoDir], {
|
|
756
|
-
stdio: "ignore"
|
|
757
|
-
});
|
|
758
|
-
} catch (error) {
|
|
759
|
-
fs4.rmSync(repoDir, { recursive: true, force: true });
|
|
760
|
-
throw new Error(
|
|
761
|
-
`Failed to clone marketplace repo ${owner}/${repo}: ${error.message}`
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
843
|
function resolveMarketplacePlugin(ref) {
|
|
766
844
|
requireGitForMarketplace("plugins");
|
|
767
845
|
const { pluginName, owner, repo } = parseRef(ref);
|
|
@@ -1464,13 +1542,22 @@ function installWorkflowFromSource(source, name) {
|
|
|
1464
1542
|
writeWorkflowSourceMetadata(destDir, metadata);
|
|
1465
1543
|
return workflowName;
|
|
1466
1544
|
}
|
|
1467
|
-
function reResolveFromMetadata(metadata) {
|
|
1545
|
+
function reResolveFromMetadata(metadata, refresh = refreshMarketplaceRepo, onSelfHeal) {
|
|
1468
1546
|
if (metadata.kind === "marketplace-remote") {
|
|
1469
1547
|
const slug = metadata.ref.slice(metadata.ref.indexOf("@") + 1);
|
|
1470
1548
|
const slashIdx = slug.indexOf("/");
|
|
1471
1549
|
const owner = slug.slice(0, slashIdx);
|
|
1472
1550
|
const repo = slug.slice(slashIdx + 1);
|
|
1473
|
-
|
|
1551
|
+
const refreshed = refresh(owner, repo);
|
|
1552
|
+
if (!refreshed.ok) {
|
|
1553
|
+
throw new MarketplaceRefreshError(refreshed);
|
|
1554
|
+
}
|
|
1555
|
+
if (refreshed.selfHealed) {
|
|
1556
|
+
onSelfHeal?.({
|
|
1557
|
+
marketplace: `${owner}/${repo}`,
|
|
1558
|
+
backupDir: refreshed.backupDir
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1474
1561
|
return resolveWorkflowInstall(metadata.ref, []);
|
|
1475
1562
|
}
|
|
1476
1563
|
if (metadata.kind === "marketplace-local") {
|
|
@@ -1493,7 +1580,7 @@ function reResolveFromMetadata(metadata) {
|
|
|
1493
1580
|
}
|
|
1494
1581
|
return { kind: "filesystem", workflowPath: metadata.path };
|
|
1495
1582
|
}
|
|
1496
|
-
function updateWorkflow(name) {
|
|
1583
|
+
function updateWorkflow(name, refresh = refreshMarketplaceRepo, onSelfHeal) {
|
|
1497
1584
|
const workflowDir = path7.join(registryDir(), name);
|
|
1498
1585
|
const metadata = readWorkflowSourceMetadata(workflowDir);
|
|
1499
1586
|
if (!metadata) {
|
|
@@ -1501,11 +1588,52 @@ function updateWorkflow(name) {
|
|
|
1501
1588
|
`Workflow "${name}" has no recorded source. Reinstall it with: athena-flow workflow install <source>`
|
|
1502
1589
|
);
|
|
1503
1590
|
}
|
|
1504
|
-
const source = reResolveFromMetadata(metadata);
|
|
1591
|
+
const source = reResolveFromMetadata(metadata, refresh, onSelfHeal);
|
|
1505
1592
|
const installedName = installWorkflowFromSource(source, name);
|
|
1506
1593
|
refreshPinnedWorkflowPlugins(resolveWorkflow(installedName));
|
|
1507
1594
|
return installedName;
|
|
1508
1595
|
}
|
|
1596
|
+
function updateWorkflows(names) {
|
|
1597
|
+
const refreshCache = /* @__PURE__ */ new Map();
|
|
1598
|
+
const refresh = (owner, repo) => {
|
|
1599
|
+
const key = `${owner}/${repo}`;
|
|
1600
|
+
const cached = refreshCache.get(key);
|
|
1601
|
+
if (cached) return cached;
|
|
1602
|
+
const outcome = refreshMarketplaceRepo(owner, repo);
|
|
1603
|
+
refreshCache.set(key, outcome);
|
|
1604
|
+
return outcome;
|
|
1605
|
+
};
|
|
1606
|
+
const upgraded = [];
|
|
1607
|
+
const marketplaceFailures = [];
|
|
1608
|
+
const reportedMarketplaces = /* @__PURE__ */ new Set();
|
|
1609
|
+
const workflowFailures = [];
|
|
1610
|
+
const selfHealed = [];
|
|
1611
|
+
const selfHealedMarketplaces = /* @__PURE__ */ new Set();
|
|
1612
|
+
const onSelfHeal = (info) => {
|
|
1613
|
+
if (!selfHealedMarketplaces.has(info.marketplace)) {
|
|
1614
|
+
selfHealedMarketplaces.add(info.marketplace);
|
|
1615
|
+
selfHealed.push(info);
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
for (const name of names) {
|
|
1619
|
+
try {
|
|
1620
|
+
upgraded.push(updateWorkflow(name, refresh, onSelfHeal));
|
|
1621
|
+
} catch (error) {
|
|
1622
|
+
if (error instanceof MarketplaceRefreshError) {
|
|
1623
|
+
if (!reportedMarketplaces.has(error.marketplace)) {
|
|
1624
|
+
reportedMarketplaces.add(error.marketplace);
|
|
1625
|
+
marketplaceFailures.push({ marketplace: error.marketplace, error });
|
|
1626
|
+
}
|
|
1627
|
+
} else {
|
|
1628
|
+
workflowFailures.push({
|
|
1629
|
+
name,
|
|
1630
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
return { upgraded, marketplaceFailures, workflowFailures, selfHealed };
|
|
1636
|
+
}
|
|
1509
1637
|
function listWorkflows() {
|
|
1510
1638
|
const dir = registryDir();
|
|
1511
1639
|
const installed = fs9.existsSync(dir) ? fs9.readdirSync(dir, { withFileTypes: true }).filter(
|
|
@@ -2103,9 +2231,10 @@ export {
|
|
|
2103
2231
|
resolveWorkflow,
|
|
2104
2232
|
installWorkflowFromSource,
|
|
2105
2233
|
updateWorkflow,
|
|
2234
|
+
updateWorkflows,
|
|
2106
2235
|
listWorkflows,
|
|
2107
2236
|
removeWorkflow,
|
|
2108
2237
|
compileWorkflowPlan,
|
|
2109
2238
|
collectMcpServersWithOptions
|
|
2110
2239
|
};
|
|
2111
|
-
//# sourceMappingURL=chunk-
|
|
2240
|
+
//# sourceMappingURL=chunk-SOW2QPXY.js.map
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
traceGatewayFrame,
|
|
24
24
|
trackGatewayTransportReconnect,
|
|
25
25
|
writeGatewayTrace
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WRHKXH5M.js";
|
|
27
27
|
import {
|
|
28
28
|
compileWorkflowPlan,
|
|
29
29
|
createWorkflowRunner,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
resolveWorkflow,
|
|
35
35
|
resolveWorkflowInstall,
|
|
36
36
|
resolveWorkflowPlugins
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-SOW2QPXY.js";
|
|
38
38
|
|
|
39
39
|
// src/infra/daemon/stateDir.ts
|
|
40
40
|
import fs from "fs";
|
|
@@ -3058,6 +3058,24 @@ function validateConflicts(config) {
|
|
|
3058
3058
|
return warnings;
|
|
3059
3059
|
}
|
|
3060
3060
|
|
|
3061
|
+
// src/core/compaction/handoffInstructions.ts
|
|
3062
|
+
var HANDOFF_COMPACT_INSTRUCTIONS = `When compacting this conversation, write the compacted summary as a handoff so a fresh agent can continue the work without re-reading the history. Preserve:
|
|
3063
|
+
- The current task and goal, and where it stands right now.
|
|
3064
|
+
- Decisions already made (and why) and any open questions still to resolve.
|
|
3065
|
+
- Files and locations touched, referenced by path \u2014 do not paste file contents.
|
|
3066
|
+
- A "Suggested next steps / skills" section naming what to do or invoke next.
|
|
3067
|
+
|
|
3068
|
+
Reference existing artifacts (PRDs, plans, ADRs, issues, commits, diffs) by path or URL instead of duplicating their content. Redact secrets \u2014 API keys, passwords, tokens, or personally identifiable information.`;
|
|
3069
|
+
var HANDOFF_COMPACT_PROMPT = `Summarize the conversation so far as a handoff document that lets a fresh agent continue the work without re-reading the history.
|
|
3070
|
+
|
|
3071
|
+
Include:
|
|
3072
|
+
- The current task and goal, and its present status.
|
|
3073
|
+
- Decisions already made (with rationale) and any open questions still to resolve.
|
|
3074
|
+
- Files and locations touched, referenced by path \u2014 do not reproduce file contents.
|
|
3075
|
+
- A "Suggested next steps / skills" section naming what to do or invoke next.
|
|
3076
|
+
|
|
3077
|
+
Reference existing artifacts (PRDs, plans, ADRs, issues, commits, diffs) by path or URL rather than duplicating them. Redact any sensitive information such as API keys, passwords, tokens, or personally identifiable information.`;
|
|
3078
|
+
|
|
3061
3079
|
// src/harnesses/claude/process/spawn.ts
|
|
3062
3080
|
function makePreflightError(failureCode, message) {
|
|
3063
3081
|
const error = new Error(message);
|
|
@@ -3110,6 +3128,20 @@ function runSpawnPreflight(hookSocketPath) {
|
|
|
3110
3128
|
}
|
|
3111
3129
|
validateSocketPath(hookSocketPath);
|
|
3112
3130
|
}
|
|
3131
|
+
var HANDOFF_COMPACT_SYSTEM_PROMPT = `## Compact Instructions
|
|
3132
|
+
|
|
3133
|
+
${HANDOFF_COMPACT_INSTRUCTIONS}`;
|
|
3134
|
+
function appendHandoffCompactInstructions(config) {
|
|
3135
|
+
return {
|
|
3136
|
+
...config,
|
|
3137
|
+
appendSystemPrompt: [
|
|
3138
|
+
config.appendSystemPrompt,
|
|
3139
|
+
HANDOFF_COMPACT_SYSTEM_PROMPT
|
|
3140
|
+
].filter(
|
|
3141
|
+
(part) => typeof part === "string" && part.length > 0
|
|
3142
|
+
).join("\n\n")
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3113
3145
|
function spawnClaude(options) {
|
|
3114
3146
|
const {
|
|
3115
3147
|
prompt,
|
|
@@ -3130,13 +3162,13 @@ function spawnClaude(options) {
|
|
|
3130
3162
|
const hookSocketPath = explicitHookSocketPath ?? resolveHookSocketPath(instanceId);
|
|
3131
3163
|
runSpawnPreflight(hookSocketPath);
|
|
3132
3164
|
const isolationConfig = resolveIsolationConfig(isolation);
|
|
3133
|
-
const streamingConfig = {
|
|
3165
|
+
const streamingConfig = appendHandoffCompactInstructions({
|
|
3134
3166
|
...isolationConfig,
|
|
3135
3167
|
// Athena depends on the stream-json event feed for live token/context
|
|
3136
3168
|
// updates, so opt in unless a caller explicitly disables it.
|
|
3137
3169
|
verbose: isolationConfig.verbose ?? true,
|
|
3138
3170
|
includePartialMessages: isolationConfig.includePartialMessages ?? true
|
|
3139
|
-
};
|
|
3171
|
+
});
|
|
3140
3172
|
const portableAuth = resolveRuntimeAuthOverlay({ cwd: projectDir });
|
|
3141
3173
|
const { settingsPath, cleanup } = generateHookSettings(void 0, portableAuth);
|
|
3142
3174
|
registerCleanupOnExit(cleanup);
|
|
@@ -6671,6 +6703,9 @@ function buildCodexPromptOptions(input) {
|
|
|
6671
6703
|
plugins: resolveCodexWorkflowPlugins(input.workflowPlan),
|
|
6672
6704
|
config: {
|
|
6673
6705
|
model_auto_compact_token_limit: 175e3,
|
|
6706
|
+
// Steer Codex's history compaction toward a handoff-style summary.
|
|
6707
|
+
// `compact_prompt` replaces the default summarization prompt.
|
|
6708
|
+
compact_prompt: HANDOFF_COMPACT_PROMPT,
|
|
6674
6709
|
...resolveCodexMcpConfig(input.pluginMcpConfig, input.workflowPlan) ?? {}
|
|
6675
6710
|
},
|
|
6676
6711
|
ephemeral: input.ephemeral,
|
|
@@ -11362,40 +11397,33 @@ var CURSOR_OFF = "\x1B[27m";
|
|
|
11362
11397
|
function cursorToVisualPosition(value, cursorOffset, width) {
|
|
11363
11398
|
if (width <= 0) return { line: 0, col: cursorOffset, totalLines: 1 };
|
|
11364
11399
|
const segments = value.split("\n");
|
|
11400
|
+
const segmentPieces = segments.map((seg) => wrapSegmentPieces(seg, width));
|
|
11401
|
+
const totalLines = segmentPieces.reduce((sum, ps) => sum + ps.length, 0);
|
|
11365
11402
|
let visualLine = 0;
|
|
11366
11403
|
let globalOffset = 0;
|
|
11367
11404
|
for (let s = 0; s < segments.length; s++) {
|
|
11368
11405
|
const seg = segments[s];
|
|
11406
|
+
const pieces = segmentPieces[s];
|
|
11369
11407
|
const segEnd = globalOffset + seg.length;
|
|
11370
11408
|
if (cursorOffset <= segEnd) {
|
|
11371
11409
|
const posInSeg = cursorOffset - globalOffset;
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11410
|
+
for (let p = 0; p < pieces.length; p++) {
|
|
11411
|
+
const piece = pieces[p];
|
|
11412
|
+
const end = piece.start + piece.text.length;
|
|
11413
|
+
if (posInSeg < end || p === pieces.length - 1) {
|
|
11414
|
+
return {
|
|
11415
|
+
line: visualLine + p,
|
|
11416
|
+
col: posInSeg - piece.start,
|
|
11417
|
+
totalLines
|
|
11418
|
+
};
|
|
11419
|
+
}
|
|
11375
11420
|
}
|
|
11376
|
-
const lineInSeg = Math.min(
|
|
11377
|
-
Math.floor(posInSeg / width),
|
|
11378
|
-
segmentVisualLines(seg.length, width) - 1
|
|
11379
|
-
);
|
|
11380
|
-
const colInLine = posInSeg - lineInSeg * width;
|
|
11381
|
-
return { line: visualLine + lineInSeg, col: colInLine, totalLines: totalLines2 };
|
|
11382
11421
|
}
|
|
11383
|
-
visualLine +=
|
|
11422
|
+
visualLine += pieces.length;
|
|
11384
11423
|
globalOffset = segEnd + 1;
|
|
11385
11424
|
}
|
|
11386
|
-
const totalLines = wrapText(value, width).length;
|
|
11387
11425
|
return { line: Math.max(0, totalLines - 1), col: 0, totalLines };
|
|
11388
11426
|
}
|
|
11389
|
-
function segmentVisualLines(segLen, width) {
|
|
11390
|
-
return segLen === 0 ? 1 : Math.ceil(segLen / width);
|
|
11391
|
-
}
|
|
11392
|
-
function countSegmentVisualLines(segments, fromIdx, width) {
|
|
11393
|
-
let count = 0;
|
|
11394
|
-
for (let i = fromIdx; i < segments.length; i++) {
|
|
11395
|
-
count += segmentVisualLines(segments[i].length, width);
|
|
11396
|
-
}
|
|
11397
|
-
return count;
|
|
11398
|
-
}
|
|
11399
11427
|
function visualPositionToOffset(value, targetLine, targetCol, width) {
|
|
11400
11428
|
if (width <= 0) return targetCol;
|
|
11401
11429
|
const segments = value.split("\n");
|
|
@@ -11403,14 +11431,12 @@ function visualPositionToOffset(value, targetLine, targetCol, width) {
|
|
|
11403
11431
|
let globalOffset = 0;
|
|
11404
11432
|
for (let s = 0; s < segments.length; s++) {
|
|
11405
11433
|
const seg = segments[s];
|
|
11406
|
-
const
|
|
11407
|
-
if (targetLine < visualLine +
|
|
11408
|
-
const
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
}
|
|
11413
|
-
visualLine += numWrappedLines;
|
|
11434
|
+
const pieces = wrapSegmentPieces(seg, width);
|
|
11435
|
+
if (targetLine < visualLine + pieces.length) {
|
|
11436
|
+
const piece = pieces[targetLine - visualLine];
|
|
11437
|
+
return globalOffset + piece.start + Math.min(targetCol, piece.text.length);
|
|
11438
|
+
}
|
|
11439
|
+
visualLine += pieces.length;
|
|
11414
11440
|
globalOffset += seg.length + 1;
|
|
11415
11441
|
}
|
|
11416
11442
|
return value.length;
|
|
@@ -11456,16 +11482,40 @@ function renderInputLines(value, cursorOffset, width, showCursor, placeholder) {
|
|
|
11456
11482
|
return fit(line, width);
|
|
11457
11483
|
});
|
|
11458
11484
|
}
|
|
11485
|
+
function wrapSegmentPieces(segment, width) {
|
|
11486
|
+
if (segment.length === 0) return [{ text: "", start: 0 }];
|
|
11487
|
+
if (isSimpleAscii(segment)) {
|
|
11488
|
+
const pieces2 = [];
|
|
11489
|
+
for (let i2 = 0; i2 < segment.length; i2 += width) {
|
|
11490
|
+
pieces2.push({ text: segment.slice(i2, i2 + width), start: i2 });
|
|
11491
|
+
}
|
|
11492
|
+
return pieces2;
|
|
11493
|
+
}
|
|
11494
|
+
const pieces = [];
|
|
11495
|
+
let pieceStart = 0;
|
|
11496
|
+
let pieceWidth = 0;
|
|
11497
|
+
let i = 0;
|
|
11498
|
+
while (i < segment.length) {
|
|
11499
|
+
const cp = segment.codePointAt(i);
|
|
11500
|
+
const chLen = cp > 65535 ? 2 : 1;
|
|
11501
|
+
const charWidth = cachedStringWidth(segment.slice(i, i + chLen));
|
|
11502
|
+
if (pieceWidth > 0 && pieceWidth + charWidth > width) {
|
|
11503
|
+
pieces.push({ text: segment.slice(pieceStart, i), start: pieceStart });
|
|
11504
|
+
pieceStart = i;
|
|
11505
|
+
pieceWidth = 0;
|
|
11506
|
+
}
|
|
11507
|
+
pieceWidth += charWidth;
|
|
11508
|
+
i += chLen;
|
|
11509
|
+
}
|
|
11510
|
+
pieces.push({ text: segment.slice(pieceStart), start: pieceStart });
|
|
11511
|
+
return pieces;
|
|
11512
|
+
}
|
|
11459
11513
|
function wrapText(text, width) {
|
|
11460
11514
|
if (width <= 0) return [text];
|
|
11461
11515
|
const lines = [];
|
|
11462
11516
|
for (const segment of text.split("\n")) {
|
|
11463
|
-
|
|
11464
|
-
lines.push(
|
|
11465
|
-
continue;
|
|
11466
|
-
}
|
|
11467
|
-
for (let i = 0; i < segment.length; i += width) {
|
|
11468
|
-
lines.push(segment.slice(i, i + width));
|
|
11517
|
+
for (const piece of wrapSegmentPieces(segment, width)) {
|
|
11518
|
+
lines.push(piece.text);
|
|
11469
11519
|
}
|
|
11470
11520
|
}
|
|
11471
11521
|
return lines;
|
|
@@ -18187,4 +18237,4 @@ export {
|
|
|
18187
18237
|
startUdsServer,
|
|
18188
18238
|
sendUdsRequest
|
|
18189
18239
|
};
|
|
18190
|
-
//# sourceMappingURL=chunk-
|
|
18240
|
+
//# sourceMappingURL=chunk-UAZ2R7F3.js.map
|
|
@@ -170,7 +170,7 @@ function isLoopbackHost(host) {
|
|
|
170
170
|
|
|
171
171
|
// src/infra/telemetry/client.ts
|
|
172
172
|
import { PostHog } from "posthog-node";
|
|
173
|
-
var POSTHOG_API_KEY = true ? "" : "";
|
|
173
|
+
var POSTHOG_API_KEY = true ? "phc_4UifMvZlZcJdgf3uDqzgEdIlQt98yAeUqVX5tobJcuD\n" : "";
|
|
174
174
|
var POSTHOG_HOST = "https://us.i.posthog.com";
|
|
175
175
|
var client = null;
|
|
176
176
|
var deviceId = null;
|
|
@@ -772,4 +772,4 @@ export {
|
|
|
772
772
|
trackSetupCompleted,
|
|
773
773
|
refreshDashboardAccessToken
|
|
774
774
|
};
|
|
775
|
-
//# sourceMappingURL=chunk-
|
|
775
|
+
//# sourceMappingURL=chunk-WRHKXH5M.js.map
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "./chunk-HXBCZAP7.js";
|
|
3
3
|
import {
|
|
4
4
|
rotateGatewayToken
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-D4W7RB25.js";
|
|
6
6
|
import {
|
|
7
7
|
CREDENTIAL_SOURCES_TRIED,
|
|
8
8
|
EXEC_EXIT_CODE,
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
writeAttachmentMirror,
|
|
98
98
|
writeGatewayClientConfig,
|
|
99
99
|
wsClientOptionsForEndpoint
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-UAZ2R7F3.js";
|
|
101
101
|
import {
|
|
102
102
|
generateId as generateId2
|
|
103
103
|
} from "./chunk-BTKQ67RE.js";
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
trackTelemetryOptedOut,
|
|
122
122
|
writeDashboardClientConfig,
|
|
123
123
|
writeGatewayTrace
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-WRHKXH5M.js";
|
|
125
125
|
import {
|
|
126
126
|
McpOptionsStep,
|
|
127
127
|
StepSelector,
|
|
@@ -153,10 +153,11 @@ import {
|
|
|
153
153
|
resolveWorkflowInstall,
|
|
154
154
|
resolveWorkflowMarketplaceSource,
|
|
155
155
|
updateWorkflow,
|
|
156
|
+
updateWorkflows,
|
|
156
157
|
useWorkflowSessionController,
|
|
157
158
|
writeGlobalConfig,
|
|
158
159
|
writeProjectConfig
|
|
159
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-SOW2QPXY.js";
|
|
160
161
|
|
|
161
162
|
// src/app/entry/cli.tsx
|
|
162
163
|
import { render } from "ink";
|
|
@@ -12127,6 +12128,7 @@ function runWorkflowCommand(input, deps = {}) {
|
|
|
12127
12128
|
const remove = deps.removeWorkflow ?? removeWorkflow;
|
|
12128
12129
|
const resolveInstalledWorkflow = deps.resolveWorkflow ?? resolveWorkflow;
|
|
12129
12130
|
const upgrade = deps.updateWorkflow ?? updateWorkflow;
|
|
12131
|
+
const upgradeAll = deps.updateWorkflows ?? updateWorkflows;
|
|
12130
12132
|
const gatherSources = deps.gatherMarketplaceWorkflowSources ?? gatherMarketplaceWorkflowSources;
|
|
12131
12133
|
const readGlobal = deps.readGlobalConfig ?? readGlobalConfig;
|
|
12132
12134
|
const readProject = deps.readProjectConfig ?? readConfig;
|
|
@@ -12134,6 +12136,12 @@ function runWorkflowCommand(input, deps = {}) {
|
|
|
12134
12136
|
const writeProject = deps.writeProjectConfig ?? writeProjectConfig;
|
|
12135
12137
|
const logError = deps.logError ?? console.error;
|
|
12136
12138
|
const logOut = deps.logOut ?? console.log;
|
|
12139
|
+
const logWarn = deps.logWarn ?? console.warn;
|
|
12140
|
+
const warnSelfHeal = (info) => {
|
|
12141
|
+
logWarn(
|
|
12142
|
+
`Warning: rebuilt the cached copy of marketplace ${info.marketplace} because it was unusable.${info.backupDir ? ` Previous cache preserved at ${info.backupDir}.` : ""}`
|
|
12143
|
+
);
|
|
12144
|
+
};
|
|
12137
12145
|
const fmtError = (error) => `Error: ${error instanceof Error ? error.message : String(error)}`;
|
|
12138
12146
|
const formatWorkflowLabel = (name) => {
|
|
12139
12147
|
try {
|
|
@@ -12229,7 +12237,7 @@ function runWorkflowCommand(input, deps = {}) {
|
|
|
12229
12237
|
const name = input.subcommandArgs[0];
|
|
12230
12238
|
if (name) {
|
|
12231
12239
|
try {
|
|
12232
|
-
const updatedName = upgrade(name);
|
|
12240
|
+
const updatedName = upgrade(name, void 0, warnSelfHeal);
|
|
12233
12241
|
logOut(
|
|
12234
12242
|
`Upgraded workflow: ${formatWorkflowLabel(updatedName)}${formatSourceSuffix(updatedName)}`
|
|
12235
12243
|
);
|
|
@@ -12245,19 +12253,22 @@ function runWorkflowCommand(input, deps = {}) {
|
|
|
12245
12253
|
logOut("No installed workflows to upgrade.");
|
|
12246
12254
|
return 0;
|
|
12247
12255
|
}
|
|
12248
|
-
|
|
12249
|
-
for (const
|
|
12250
|
-
|
|
12251
|
-
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12256
|
+
const report = upgradeAll(all);
|
|
12257
|
+
for (const upgradedName of report.upgraded) {
|
|
12258
|
+
logOut(
|
|
12259
|
+
`Upgraded workflow: ${formatWorkflowLabel(upgradedName)}${formatSourceSuffix(upgradedName)}`
|
|
12260
|
+
);
|
|
12261
|
+
}
|
|
12262
|
+
for (const info of report.selfHealed) {
|
|
12263
|
+
warnSelfHeal(info);
|
|
12264
|
+
}
|
|
12265
|
+
for (const { error } of report.marketplaceFailures) {
|
|
12266
|
+
logError(fmtError(error));
|
|
12267
|
+
}
|
|
12268
|
+
for (const { name: failedName, error } of report.workflowFailures) {
|
|
12269
|
+
logError(`Failed to upgrade "${failedName}": ${fmtError(error)}`);
|
|
12259
12270
|
}
|
|
12260
|
-
return
|
|
12271
|
+
return report.marketplaceFailures.length + report.workflowFailures.length > 0 ? 1 : 0;
|
|
12261
12272
|
}
|
|
12262
12273
|
case "remove": {
|
|
12263
12274
|
const name = input.subcommandArgs[0];
|
|
@@ -12670,7 +12681,7 @@ var cachedVersion = null;
|
|
|
12670
12681
|
function readPackageVersion() {
|
|
12671
12682
|
if (cachedVersion !== null) return cachedVersion;
|
|
12672
12683
|
try {
|
|
12673
|
-
const injected = "0.5.
|
|
12684
|
+
const injected = "0.5.15";
|
|
12674
12685
|
if (typeof injected === "string" && injected.length > 0) {
|
|
12675
12686
|
cachedVersion = injected;
|
|
12676
12687
|
return cachedVersion;
|
|
@@ -15417,7 +15428,7 @@ Available commands: ${[...KNOWN_COMMANDS].join(", ")}`
|
|
|
15417
15428
|
await exitWith(1);
|
|
15418
15429
|
return;
|
|
15419
15430
|
}
|
|
15420
|
-
const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-
|
|
15431
|
+
const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-AY4CPQS2.js");
|
|
15421
15432
|
const { waitUntilExit } = render(
|
|
15422
15433
|
/* @__PURE__ */ jsx25(
|
|
15423
15434
|
WorkflowInstallWizard,
|
package/dist/dashboard-daemon.js
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
ensureDaemonStateDir,
|
|
4
4
|
runDashboardRuntimeDaemon,
|
|
5
5
|
startUdsServer
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UAZ2R7F3.js";
|
|
7
7
|
import "./chunk-BTKQ67RE.js";
|
|
8
8
|
import {
|
|
9
9
|
readDashboardClientConfig,
|
|
10
10
|
refreshDashboardAccessToken
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-WRHKXH5M.js";
|
|
12
|
+
import "./chunk-SOW2QPXY.js";
|
|
13
13
|
|
|
14
14
|
// src/infra/daemon/logFile.ts
|
|
15
15
|
import fs from "fs";
|