heyio 4.0.4 → 4.0.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/daemon/cli.js
CHANGED
|
@@ -80,7 +80,7 @@ var init_constants = __esm({
|
|
|
80
80
|
"packages/shared/dist/constants.js"() {
|
|
81
81
|
"use strict";
|
|
82
82
|
APP_NAME = "io";
|
|
83
|
-
APP_VERSION = "4.0.
|
|
83
|
+
APP_VERSION = "4.0.5";
|
|
84
84
|
API_PORT = 7777;
|
|
85
85
|
API_HOST = "0.0.0.0";
|
|
86
86
|
DEFAULT_MODEL = "gpt-4o";
|
|
@@ -31174,7 +31174,7 @@ var require_view = __commonJS({
|
|
|
31174
31174
|
var dirname9 = path.dirname;
|
|
31175
31175
|
var basename6 = path.basename;
|
|
31176
31176
|
var extname4 = path.extname;
|
|
31177
|
-
var
|
|
31177
|
+
var join15 = path.join;
|
|
31178
31178
|
var resolve5 = path.resolve;
|
|
31179
31179
|
module2.exports = View;
|
|
31180
31180
|
function View(name, options2) {
|
|
@@ -31236,12 +31236,12 @@ var require_view = __commonJS({
|
|
|
31236
31236
|
};
|
|
31237
31237
|
View.prototype.resolve = function resolve6(dir, file2) {
|
|
31238
31238
|
var ext = this.ext;
|
|
31239
|
-
var path2 =
|
|
31239
|
+
var path2 = join15(dir, file2);
|
|
31240
31240
|
var stat4 = tryStat(path2);
|
|
31241
31241
|
if (stat4 && stat4.isFile()) {
|
|
31242
31242
|
return path2;
|
|
31243
31243
|
}
|
|
31244
|
-
path2 =
|
|
31244
|
+
path2 = join15(dir, basename6(file2, ext), "index" + ext);
|
|
31245
31245
|
stat4 = tryStat(path2);
|
|
31246
31246
|
if (stat4 && stat4.isFile()) {
|
|
31247
31247
|
return path2;
|
|
@@ -34946,7 +34946,7 @@ var require_send = __commonJS({
|
|
|
34946
34946
|
var Stream = __require("stream");
|
|
34947
34947
|
var util = __require("util");
|
|
34948
34948
|
var extname4 = path.extname;
|
|
34949
|
-
var
|
|
34949
|
+
var join15 = path.join;
|
|
34950
34950
|
var normalize = path.normalize;
|
|
34951
34951
|
var resolve5 = path.resolve;
|
|
34952
34952
|
var sep = path.sep;
|
|
@@ -35118,7 +35118,7 @@ var require_send = __commonJS({
|
|
|
35118
35118
|
return res;
|
|
35119
35119
|
}
|
|
35120
35120
|
parts = path2.split(sep);
|
|
35121
|
-
path2 = normalize(
|
|
35121
|
+
path2 = normalize(join15(root, path2));
|
|
35122
35122
|
} else {
|
|
35123
35123
|
if (UP_PATH_REGEXP.test(path2)) {
|
|
35124
35124
|
debug('malicious path "%s"', path2);
|
|
@@ -35251,7 +35251,7 @@ var require_send = __commonJS({
|
|
|
35251
35251
|
if (err) return self.onStatError(err);
|
|
35252
35252
|
return self.error(404);
|
|
35253
35253
|
}
|
|
35254
|
-
var p =
|
|
35254
|
+
var p = join15(path2, self._index[i]);
|
|
35255
35255
|
debug('stat "%s"', p);
|
|
35256
35256
|
fs.stat(p, function(err2, stat4) {
|
|
35257
35257
|
if (err2) return next(err2);
|
|
@@ -51727,13 +51727,20 @@ async function installSkill(request) {
|
|
|
51727
51727
|
const directory = join3(SKILLS_DIR, directoryName);
|
|
51728
51728
|
const existing = installedSkills.find((skill2) => skill2.id === id);
|
|
51729
51729
|
let entryFile = existing?.entryFile ?? null;
|
|
51730
|
-
|
|
51731
|
-
|
|
51730
|
+
let resolvedUrl = request.url;
|
|
51731
|
+
if (source === "skillssh" && resolvedUrl) {
|
|
51732
|
+
const fetchResult = await fetch(resolvedUrl);
|
|
51733
|
+
if (!fetchResult.ok) {
|
|
51734
|
+
resolvedUrl = await resolveSkillsShUrl(request) ?? resolvedUrl;
|
|
51735
|
+
}
|
|
51736
|
+
}
|
|
51737
|
+
if (resolvedUrl) {
|
|
51738
|
+
const response = await fetch(resolvedUrl);
|
|
51732
51739
|
if (!response.ok) {
|
|
51733
|
-
throw new Error(`Failed to fetch skill from ${
|
|
51740
|
+
throw new Error(`Failed to fetch skill from ${resolvedUrl} (${response.status})`);
|
|
51734
51741
|
}
|
|
51735
51742
|
const body = await response.text();
|
|
51736
|
-
entryFile = chooseEntryFileName(
|
|
51743
|
+
entryFile = chooseEntryFileName(resolvedUrl, response.headers.get("content-type"));
|
|
51737
51744
|
await mkdir3(directory, { recursive: true });
|
|
51738
51745
|
await writeFile2(join3(directory, entryFile), body, "utf8");
|
|
51739
51746
|
} else {
|
|
@@ -51820,6 +51827,42 @@ function chooseEntryFileName(url2, contentType) {
|
|
|
51820
51827
|
function isMissingFileError2(error51) {
|
|
51821
51828
|
return !!error51 && typeof error51 === "object" && "code" in error51 && error51.code === "ENOENT";
|
|
51822
51829
|
}
|
|
51830
|
+
async function resolveSkillsShUrl(request) {
|
|
51831
|
+
const slug = request.slug?.trim();
|
|
51832
|
+
if (!slug) return null;
|
|
51833
|
+
try {
|
|
51834
|
+
const searchResponse = await fetch(
|
|
51835
|
+
`https://skills.sh/api/search?q=${encodeURIComponent(slug)}&limit=10`,
|
|
51836
|
+
{ signal: AbortSignal.timeout(1e4) }
|
|
51837
|
+
);
|
|
51838
|
+
if (!searchResponse.ok) return null;
|
|
51839
|
+
const data = await searchResponse.json();
|
|
51840
|
+
const match = data.skills?.find(
|
|
51841
|
+
(s) => s.skillId === slug || s.name === slug || s.id.endsWith(`/${slug}`)
|
|
51842
|
+
);
|
|
51843
|
+
if (!match?.source) return null;
|
|
51844
|
+
const headers = {
|
|
51845
|
+
Accept: "application/vnd.github.v3+json",
|
|
51846
|
+
"User-Agent": "io-daemon"
|
|
51847
|
+
};
|
|
51848
|
+
if (process.env.GITHUB_TOKEN) {
|
|
51849
|
+
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
|
51850
|
+
}
|
|
51851
|
+
const treeResponse = await fetch(
|
|
51852
|
+
`https://api.github.com/repos/${match.source}/git/trees/main?recursive=1`,
|
|
51853
|
+
{ headers, signal: AbortSignal.timeout(15e3) }
|
|
51854
|
+
);
|
|
51855
|
+
if (!treeResponse.ok) return null;
|
|
51856
|
+
const treeData = await treeResponse.json();
|
|
51857
|
+
const skillFile = treeData.tree?.find(
|
|
51858
|
+
(entry) => entry.type === "blob" && entry.path.endsWith(`/${match.skillId}/SKILL.md`)
|
|
51859
|
+
);
|
|
51860
|
+
if (!skillFile) return null;
|
|
51861
|
+
return `https://raw.githubusercontent.com/${match.source}/main/${skillFile.path}`;
|
|
51862
|
+
} catch {
|
|
51863
|
+
return null;
|
|
51864
|
+
}
|
|
51865
|
+
}
|
|
51823
51866
|
async function discoverSkillsSh(query) {
|
|
51824
51867
|
if (!query) return [];
|
|
51825
51868
|
const endpoint = `https://skills.sh/api/search?q=${encodeURIComponent(query)}&limit=50`;
|
|
@@ -51911,11 +51954,16 @@ var init_skills = __esm({
|
|
|
51911
51954
|
router6.post("/api/skills/install", async (req, res) => {
|
|
51912
51955
|
try {
|
|
51913
51956
|
const body = req.body;
|
|
51914
|
-
if (!body?.url && !(body?.source && body?.slug)) {
|
|
51957
|
+
if (!body?.url && !(body?.source && (body?.slug || body?.skillId || body?.name))) {
|
|
51915
51958
|
res.status(400).json({ error: "Provide url or source+slug to install a skill" });
|
|
51916
51959
|
return;
|
|
51917
51960
|
}
|
|
51918
|
-
const
|
|
51961
|
+
const normalized = {
|
|
51962
|
+
url: body.url,
|
|
51963
|
+
source: body.source,
|
|
51964
|
+
slug: body.slug || body.skillId || body.name
|
|
51965
|
+
};
|
|
51966
|
+
const result = await installSkill(normalized);
|
|
51919
51967
|
res.status(result.created ? 201 : 200).json(result.skill);
|
|
51920
51968
|
} catch (error51) {
|
|
51921
51969
|
const statusCode = error51 instanceof Error && /Invalid skill|fetch/i.test(error51.message) ? 400 : 500;
|
|
@@ -60003,7 +60051,7 @@ var init_websocket = __esm({
|
|
|
60003
60051
|
// packages/daemon/src/api/server.ts
|
|
60004
60052
|
import { existsSync as existsSync2 } from "node:fs";
|
|
60005
60053
|
import { createServer } from "node:http";
|
|
60006
|
-
import { dirname as dirname4, resolve as resolve2 } from "node:path";
|
|
60054
|
+
import { dirname as dirname4, join as join5, resolve as resolve2 } from "node:path";
|
|
60007
60055
|
import { fileURLToPath } from "node:url";
|
|
60008
60056
|
function createApiServer(config2) {
|
|
60009
60057
|
const app = (0, import_express10.default)();
|
|
@@ -60041,6 +60089,9 @@ function createApiServer(config2) {
|
|
|
60041
60089
|
});
|
|
60042
60090
|
if (existsSync2(webDirectory)) {
|
|
60043
60091
|
app.use(import_express10.default.static(webDirectory));
|
|
60092
|
+
app.get("*", (_req, res) => {
|
|
60093
|
+
res.sendFile(join5(webDirectory, "index.html"));
|
|
60094
|
+
});
|
|
60044
60095
|
}
|
|
60045
60096
|
app.use((error51, _req, res, next) => {
|
|
60046
60097
|
if (res.headersSent) {
|
|
@@ -62123,7 +62174,7 @@ var require_thread_stream = __commonJS({
|
|
|
62123
62174
|
var { version: version2 } = require_package();
|
|
62124
62175
|
var { EventEmitter: EventEmitter2 } = __require("events");
|
|
62125
62176
|
var { Worker } = __require("worker_threads");
|
|
62126
|
-
var { join:
|
|
62177
|
+
var { join: join15 } = __require("path");
|
|
62127
62178
|
var { pathToFileURL: pathToFileURL2 } = __require("url");
|
|
62128
62179
|
var { wait } = require_wait();
|
|
62129
62180
|
var {
|
|
@@ -62166,7 +62217,7 @@ var require_thread_stream = __commonJS({
|
|
|
62166
62217
|
function createWorker(stream, opts) {
|
|
62167
62218
|
const { filename, workerData } = opts;
|
|
62168
62219
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
62169
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
62220
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join15(__dirname, "lib", "worker.js");
|
|
62170
62221
|
const worker = new Worker(toExecute, {
|
|
62171
62222
|
...opts.workerOpts,
|
|
62172
62223
|
trackUnmanagedFds: false,
|
|
@@ -62569,7 +62620,7 @@ var require_transport = __commonJS({
|
|
|
62569
62620
|
"use strict";
|
|
62570
62621
|
var { createRequire } = __require("module");
|
|
62571
62622
|
var getCallers = require_caller();
|
|
62572
|
-
var { join:
|
|
62623
|
+
var { join: join15, isAbsolute: isAbsolute2, sep } = __require("node:path");
|
|
62573
62624
|
var sleep = require_atomic_sleep();
|
|
62574
62625
|
var onExit = require_on_exit_leak_free();
|
|
62575
62626
|
var ThreadStream = require_thread_stream();
|
|
@@ -62632,7 +62683,7 @@ var require_transport = __commonJS({
|
|
|
62632
62683
|
throw new Error("only one of target or targets can be specified");
|
|
62633
62684
|
}
|
|
62634
62685
|
if (targets) {
|
|
62635
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
62686
|
+
target = bundlerOverrides["pino-worker"] || join15(__dirname, "worker.js");
|
|
62636
62687
|
options2.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
62637
62688
|
return {
|
|
62638
62689
|
...dest,
|
|
@@ -62650,7 +62701,7 @@ var require_transport = __commonJS({
|
|
|
62650
62701
|
});
|
|
62651
62702
|
});
|
|
62652
62703
|
} else if (pipeline) {
|
|
62653
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
62704
|
+
target = bundlerOverrides["pino-worker"] || join15(__dirname, "worker.js");
|
|
62654
62705
|
options2.pipelines = [pipeline.map((dest) => {
|
|
62655
62706
|
return {
|
|
62656
62707
|
...dest,
|
|
@@ -62672,7 +62723,7 @@ var require_transport = __commonJS({
|
|
|
62672
62723
|
return origin;
|
|
62673
62724
|
}
|
|
62674
62725
|
if (origin === "pino/file") {
|
|
62675
|
-
return
|
|
62726
|
+
return join15(__dirname, "..", "file.js");
|
|
62676
62727
|
}
|
|
62677
62728
|
let fixTarget2;
|
|
62678
62729
|
for (const filePath of callers) {
|
|
@@ -63661,7 +63712,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
63661
63712
|
return circularValue;
|
|
63662
63713
|
}
|
|
63663
63714
|
let res = "";
|
|
63664
|
-
let
|
|
63715
|
+
let join15 = ",";
|
|
63665
63716
|
const originalIndentation = indentation;
|
|
63666
63717
|
if (Array.isArray(value)) {
|
|
63667
63718
|
if (value.length === 0) {
|
|
@@ -63675,7 +63726,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
63675
63726
|
indentation += spacer;
|
|
63676
63727
|
res += `
|
|
63677
63728
|
${indentation}`;
|
|
63678
|
-
|
|
63729
|
+
join15 = `,
|
|
63679
63730
|
${indentation}`;
|
|
63680
63731
|
}
|
|
63681
63732
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -63683,13 +63734,13 @@ ${indentation}`;
|
|
|
63683
63734
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
63684
63735
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
63685
63736
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
63686
|
-
res +=
|
|
63737
|
+
res += join15;
|
|
63687
63738
|
}
|
|
63688
63739
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
63689
63740
|
res += tmp !== void 0 ? tmp : "null";
|
|
63690
63741
|
if (value.length - 1 > maximumBreadth) {
|
|
63691
63742
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
63692
|
-
res += `${
|
|
63743
|
+
res += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
63693
63744
|
}
|
|
63694
63745
|
if (spacer !== "") {
|
|
63695
63746
|
res += `
|
|
@@ -63710,7 +63761,7 @@ ${originalIndentation}`;
|
|
|
63710
63761
|
let separator = "";
|
|
63711
63762
|
if (spacer !== "") {
|
|
63712
63763
|
indentation += spacer;
|
|
63713
|
-
|
|
63764
|
+
join15 = `,
|
|
63714
63765
|
${indentation}`;
|
|
63715
63766
|
whitespace = " ";
|
|
63716
63767
|
}
|
|
@@ -63724,13 +63775,13 @@ ${indentation}`;
|
|
|
63724
63775
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
63725
63776
|
if (tmp !== void 0) {
|
|
63726
63777
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
63727
|
-
separator =
|
|
63778
|
+
separator = join15;
|
|
63728
63779
|
}
|
|
63729
63780
|
}
|
|
63730
63781
|
if (keyLength > maximumBreadth) {
|
|
63731
63782
|
const removedKeys = keyLength - maximumBreadth;
|
|
63732
63783
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
63733
|
-
separator =
|
|
63784
|
+
separator = join15;
|
|
63734
63785
|
}
|
|
63735
63786
|
if (spacer !== "" && separator.length > 1) {
|
|
63736
63787
|
res = `
|
|
@@ -63771,7 +63822,7 @@ ${originalIndentation}`;
|
|
|
63771
63822
|
}
|
|
63772
63823
|
const originalIndentation = indentation;
|
|
63773
63824
|
let res = "";
|
|
63774
|
-
let
|
|
63825
|
+
let join15 = ",";
|
|
63775
63826
|
if (Array.isArray(value)) {
|
|
63776
63827
|
if (value.length === 0) {
|
|
63777
63828
|
return "[]";
|
|
@@ -63784,7 +63835,7 @@ ${originalIndentation}`;
|
|
|
63784
63835
|
indentation += spacer;
|
|
63785
63836
|
res += `
|
|
63786
63837
|
${indentation}`;
|
|
63787
|
-
|
|
63838
|
+
join15 = `,
|
|
63788
63839
|
${indentation}`;
|
|
63789
63840
|
}
|
|
63790
63841
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -63792,13 +63843,13 @@ ${indentation}`;
|
|
|
63792
63843
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
63793
63844
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
63794
63845
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
63795
|
-
res +=
|
|
63846
|
+
res += join15;
|
|
63796
63847
|
}
|
|
63797
63848
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
63798
63849
|
res += tmp !== void 0 ? tmp : "null";
|
|
63799
63850
|
if (value.length - 1 > maximumBreadth) {
|
|
63800
63851
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
63801
|
-
res += `${
|
|
63852
|
+
res += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
63802
63853
|
}
|
|
63803
63854
|
if (spacer !== "") {
|
|
63804
63855
|
res += `
|
|
@@ -63811,7 +63862,7 @@ ${originalIndentation}`;
|
|
|
63811
63862
|
let whitespace = "";
|
|
63812
63863
|
if (spacer !== "") {
|
|
63813
63864
|
indentation += spacer;
|
|
63814
|
-
|
|
63865
|
+
join15 = `,
|
|
63815
63866
|
${indentation}`;
|
|
63816
63867
|
whitespace = " ";
|
|
63817
63868
|
}
|
|
@@ -63820,7 +63871,7 @@ ${indentation}`;
|
|
|
63820
63871
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
63821
63872
|
if (tmp !== void 0) {
|
|
63822
63873
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
63823
|
-
separator =
|
|
63874
|
+
separator = join15;
|
|
63824
63875
|
}
|
|
63825
63876
|
}
|
|
63826
63877
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -63878,20 +63929,20 @@ ${originalIndentation}`;
|
|
|
63878
63929
|
indentation += spacer;
|
|
63879
63930
|
let res2 = `
|
|
63880
63931
|
${indentation}`;
|
|
63881
|
-
const
|
|
63932
|
+
const join16 = `,
|
|
63882
63933
|
${indentation}`;
|
|
63883
63934
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
63884
63935
|
let i = 0;
|
|
63885
63936
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
63886
63937
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
63887
63938
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
63888
|
-
res2 +=
|
|
63939
|
+
res2 += join16;
|
|
63889
63940
|
}
|
|
63890
63941
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
63891
63942
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
63892
63943
|
if (value.length - 1 > maximumBreadth) {
|
|
63893
63944
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
63894
|
-
res2 += `${
|
|
63945
|
+
res2 += `${join16}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
63895
63946
|
}
|
|
63896
63947
|
res2 += `
|
|
63897
63948
|
${originalIndentation}`;
|
|
@@ -63907,16 +63958,16 @@ ${originalIndentation}`;
|
|
|
63907
63958
|
return '"[Object]"';
|
|
63908
63959
|
}
|
|
63909
63960
|
indentation += spacer;
|
|
63910
|
-
const
|
|
63961
|
+
const join15 = `,
|
|
63911
63962
|
${indentation}`;
|
|
63912
63963
|
let res = "";
|
|
63913
63964
|
let separator = "";
|
|
63914
63965
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
63915
63966
|
if (isTypedArrayWithEntries(value)) {
|
|
63916
|
-
res += stringifyTypedArray(value,
|
|
63967
|
+
res += stringifyTypedArray(value, join15, maximumBreadth);
|
|
63917
63968
|
keys = keys.slice(value.length);
|
|
63918
63969
|
maximumPropertiesToStringify -= value.length;
|
|
63919
|
-
separator =
|
|
63970
|
+
separator = join15;
|
|
63920
63971
|
}
|
|
63921
63972
|
if (deterministic) {
|
|
63922
63973
|
keys = sort(keys, comparator);
|
|
@@ -63927,13 +63978,13 @@ ${indentation}`;
|
|
|
63927
63978
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
63928
63979
|
if (tmp !== void 0) {
|
|
63929
63980
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
63930
|
-
separator =
|
|
63981
|
+
separator = join15;
|
|
63931
63982
|
}
|
|
63932
63983
|
}
|
|
63933
63984
|
if (keyLength > maximumBreadth) {
|
|
63934
63985
|
const removedKeys = keyLength - maximumBreadth;
|
|
63935
63986
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
63936
|
-
separator =
|
|
63987
|
+
separator = join15;
|
|
63937
63988
|
}
|
|
63938
63989
|
if (separator !== "") {
|
|
63939
63990
|
res = `
|
|
@@ -66963,7 +67014,7 @@ var require_pino_pretty = __commonJS({
|
|
|
66963
67014
|
});
|
|
66964
67015
|
|
|
66965
67016
|
// packages/daemon/src/logging/logger.ts
|
|
66966
|
-
import { join as
|
|
67017
|
+
import { join as join6 } from "node:path";
|
|
66967
67018
|
function shouldPrettyPrint(logLevel) {
|
|
66968
67019
|
return process.env.NODE_ENV !== "production" || process.env.LOG_LEVEL === "debug" || logLevel === "debug" || logLevel === "trace";
|
|
66969
67020
|
}
|
|
@@ -67010,7 +67061,7 @@ var init_logger = __esm({
|
|
|
67010
67061
|
init_paths();
|
|
67011
67062
|
import_pino = __toESM(require_pino(), 1);
|
|
67012
67063
|
import_pino_pretty = __toESM(require_pino_pretty(), 1);
|
|
67013
|
-
LOG_FILE_PATH =
|
|
67064
|
+
LOG_FILE_PATH = join6(LOGS_DIR, "io.log");
|
|
67014
67065
|
rootLogger = null;
|
|
67015
67066
|
}
|
|
67016
67067
|
});
|
|
@@ -67608,7 +67659,7 @@ var init_reset = __esm({
|
|
|
67608
67659
|
// packages/daemon/src/copilot/client.ts
|
|
67609
67660
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
67610
67661
|
import { mkdirSync as mkdirSync2 } from "node:fs";
|
|
67611
|
-
import { join as
|
|
67662
|
+
import { join as join7 } from "node:path";
|
|
67612
67663
|
import { CopilotClient } from "@github/copilot-sdk";
|
|
67613
67664
|
function readTokenFromEnvironment() {
|
|
67614
67665
|
const token = process.env.GITHUB_TOKEN?.trim();
|
|
@@ -67694,7 +67745,7 @@ var init_client = __esm({
|
|
|
67694
67745
|
"use strict";
|
|
67695
67746
|
init_paths();
|
|
67696
67747
|
COPILOT_AUTH_ERROR_HINT = "Set GITHUB_TOKEN or authenticate with the GitHub CLI (`gh auth login`) so `gh auth token` returns a valid token.";
|
|
67697
|
-
COPILOT_BASE_DIRECTORY =
|
|
67748
|
+
COPILOT_BASE_DIRECTORY = join7(DATA_DIR, "copilot-sdk");
|
|
67698
67749
|
copilotClientSingleton = null;
|
|
67699
67750
|
copilotClientInitPromise = null;
|
|
67700
67751
|
}
|
|
@@ -67854,7 +67905,7 @@ var init_session = __esm({
|
|
|
67854
67905
|
|
|
67855
67906
|
// packages/daemon/src/skills/loader.ts
|
|
67856
67907
|
import { readFile as readFile4, readdir as readdir2 } from "node:fs/promises";
|
|
67857
|
-
import { basename as basename3, dirname as dirname5, join as
|
|
67908
|
+
import { basename as basename3, dirname as dirname5, join as join8 } from "node:path";
|
|
67858
67909
|
async function scanSkills() {
|
|
67859
67910
|
const skillFilePaths = await collectSkillFiles(SKILLS_DIR);
|
|
67860
67911
|
const skills = await Promise.all(skillFilePaths.map((filePath) => readSkillFromFile(filePath)));
|
|
@@ -67865,7 +67916,7 @@ async function collectSkillFiles(directory) {
|
|
|
67865
67916
|
const entries = await readdir2(directory, { withFileTypes: true });
|
|
67866
67917
|
const skillFiles = [];
|
|
67867
67918
|
for (const entry of entries) {
|
|
67868
|
-
const entryPath =
|
|
67919
|
+
const entryPath = join8(directory, entry.name);
|
|
67869
67920
|
if (entry.isDirectory()) {
|
|
67870
67921
|
skillFiles.push(...await collectSkillFiles(entryPath));
|
|
67871
67922
|
continue;
|
|
@@ -67909,7 +67960,7 @@ var init_loader = __esm({
|
|
|
67909
67960
|
|
|
67910
67961
|
// packages/daemon/src/skills/manager.ts
|
|
67911
67962
|
import { mkdir as mkdir5, readFile as readFile5, rm as rm3, writeFile as writeFile4 } from "node:fs/promises";
|
|
67912
|
-
import { basename as basename4, dirname as dirname6, join as
|
|
67963
|
+
import { basename as basename4, dirname as dirname6, join as join9 } from "node:path";
|
|
67913
67964
|
async function installSkill2(url2) {
|
|
67914
67965
|
const response = await fetch(url2);
|
|
67915
67966
|
if (!response.ok) {
|
|
@@ -67919,8 +67970,8 @@ async function installSkill2(url2) {
|
|
|
67919
67970
|
}
|
|
67920
67971
|
const skillMarkdown = await response.text();
|
|
67921
67972
|
const skillId = getSkillIdFromUrl(url2);
|
|
67922
|
-
const skillDirectory =
|
|
67923
|
-
const skillPath =
|
|
67973
|
+
const skillDirectory = join9(SKILLS_DIR, skillId);
|
|
67974
|
+
const skillPath = join9(skillDirectory, "SKILL.md");
|
|
67924
67975
|
const parsed = (0, import_gray_matter3.default)(skillMarkdown);
|
|
67925
67976
|
const installedSkill = {
|
|
67926
67977
|
id: skillId,
|
|
@@ -67934,7 +67985,7 @@ async function installSkill2(url2) {
|
|
|
67934
67985
|
return installedSkill;
|
|
67935
67986
|
}
|
|
67936
67987
|
async function removeSkill2(id) {
|
|
67937
|
-
await rm3(
|
|
67988
|
+
await rm3(join9(SKILLS_DIR, id), { recursive: true, force: true });
|
|
67938
67989
|
const lockFile = await readSkillsLock();
|
|
67939
67990
|
lockFile.skills = lockFile.skills.filter((skill) => skill.id !== id);
|
|
67940
67991
|
await writeSkillsLock2(lockFile);
|
|
@@ -68546,7 +68597,7 @@ var init_history = __esm({
|
|
|
68546
68597
|
// packages/daemon/src/execution/agent.ts
|
|
68547
68598
|
import { exec as exec2 } from "node:child_process";
|
|
68548
68599
|
import { mkdir as mkdir7, readFile as readFile7, readdir as readdir4, stat as stat3, writeFile as writeFile6 } from "node:fs/promises";
|
|
68549
|
-
import { dirname as dirname8, extname as extname3, isAbsolute, join as
|
|
68600
|
+
import { dirname as dirname8, extname as extname3, isAbsolute, join as join10, relative as relative3, resolve as resolve4 } from "node:path";
|
|
68550
68601
|
import { promisify as promisify2 } from "node:util";
|
|
68551
68602
|
import {
|
|
68552
68603
|
CopilotClient as CopilotClient2,
|
|
@@ -68612,7 +68663,7 @@ async function collectFiles(directory, recursive, output2) {
|
|
|
68612
68663
|
if (output2.length >= MAX_LIST_RESULTS) {
|
|
68613
68664
|
return;
|
|
68614
68665
|
}
|
|
68615
|
-
const fullPath =
|
|
68666
|
+
const fullPath = join10(directory, entry.name);
|
|
68616
68667
|
output2.push(fullPath);
|
|
68617
68668
|
if (recursive && entry.isDirectory()) {
|
|
68618
68669
|
await collectFiles(fullPath, recursive, output2);
|
|
@@ -68969,7 +69020,7 @@ Return strict JSON in this shape:
|
|
|
68969
69020
|
// packages/daemon/src/execution/planning.ts
|
|
68970
69021
|
import { exec as exec3 } from "node:child_process";
|
|
68971
69022
|
import { access, readFile as readFile8 } from "node:fs/promises";
|
|
68972
|
-
import { join as
|
|
69023
|
+
import { join as join11 } from "node:path";
|
|
68973
69024
|
import { promisify as promisify3 } from "node:util";
|
|
68974
69025
|
import { CopilotClient as CopilotClient3, approveAll as approveAll3 } from "@github/copilot-sdk";
|
|
68975
69026
|
async function fileExists(path) {
|
|
@@ -68982,7 +69033,7 @@ async function fileExists(path) {
|
|
|
68982
69033
|
}
|
|
68983
69034
|
async function buildRepoContext(repoPath) {
|
|
68984
69035
|
for (const candidate of README_CANDIDATES) {
|
|
68985
|
-
const readmePath =
|
|
69036
|
+
const readmePath = join11(repoPath, candidate);
|
|
68986
69037
|
if (await fileExists(readmePath)) {
|
|
68987
69038
|
const content = await readFile8(readmePath, "utf8");
|
|
68988
69039
|
return content.slice(0, MAX_REPO_CONTEXT_LENGTH);
|
|
@@ -69116,7 +69167,7 @@ var init_planning = __esm({
|
|
|
69116
69167
|
// packages/daemon/src/execution/worktree.ts
|
|
69117
69168
|
import { exec as exec4 } from "node:child_process";
|
|
69118
69169
|
import { mkdir as mkdir8, rm as rm4 } from "node:fs/promises";
|
|
69119
|
-
import { join as
|
|
69170
|
+
import { join as join12 } from "node:path";
|
|
69120
69171
|
import { promisify as promisify4 } from "node:util";
|
|
69121
69172
|
function sanitizeBranchName(branchName) {
|
|
69122
69173
|
return branchName.replace(/[^a-zA-Z0-9._-]+/g, "-");
|
|
@@ -69133,7 +69184,7 @@ async function branchExists(repoPath, branchName) {
|
|
|
69133
69184
|
return output2.length > 0;
|
|
69134
69185
|
}
|
|
69135
69186
|
function getWorktreePath(repoPath, branchName) {
|
|
69136
|
-
return
|
|
69187
|
+
return join12(repoPath, ".worktrees", sanitizeBranchName(branchName));
|
|
69137
69188
|
}
|
|
69138
69189
|
async function listWorktrees(repoPath) {
|
|
69139
69190
|
const output2 = await runGit("git worktree list --porcelain", repoPath);
|
|
@@ -69183,7 +69234,7 @@ async function listWorktrees(repoPath) {
|
|
|
69183
69234
|
}
|
|
69184
69235
|
async function createWorktree(repoPath, branchName, baseBranch) {
|
|
69185
69236
|
const worktreePath = getWorktreePath(repoPath, branchName);
|
|
69186
|
-
await mkdir8(
|
|
69237
|
+
await mkdir8(join12(repoPath, ".worktrees"), { recursive: true });
|
|
69187
69238
|
const existing = (await listWorktrees(repoPath)).find(
|
|
69188
69239
|
(worktree) => worktree.path === worktreePath
|
|
69189
69240
|
);
|
|
@@ -69205,7 +69256,7 @@ async function createWorktree(repoPath, branchName, baseBranch) {
|
|
|
69205
69256
|
}
|
|
69206
69257
|
}
|
|
69207
69258
|
async function cleanupWorktree(worktreePath) {
|
|
69208
|
-
const parentRepoPath =
|
|
69259
|
+
const parentRepoPath = join12(worktreePath, "..", "..");
|
|
69209
69260
|
try {
|
|
69210
69261
|
await runGit(`git worktree remove ${JSON.stringify(worktreePath)}`, parentRepoPath);
|
|
69211
69262
|
} catch (error51) {
|
|
@@ -69244,7 +69295,7 @@ var init_worktree = __esm({
|
|
|
69244
69295
|
// packages/daemon/src/execution/pr.ts
|
|
69245
69296
|
import { exec as exec5 } from "node:child_process";
|
|
69246
69297
|
import { rm as rm5, writeFile as writeFile7 } from "node:fs/promises";
|
|
69247
|
-
import { join as
|
|
69298
|
+
import { join as join13 } from "node:path";
|
|
69248
69299
|
import { promisify as promisify5 } from "node:util";
|
|
69249
69300
|
async function runCommand(command, cwd) {
|
|
69250
69301
|
const { stdout } = await execAsync5(command, {
|
|
@@ -69258,7 +69309,7 @@ function extractUrl(output2) {
|
|
|
69258
69309
|
}
|
|
69259
69310
|
function buildBodyFilePath(repoPath, branchName) {
|
|
69260
69311
|
const safeBranchName = branchName.replace(/[^a-zA-Z0-9._-]+/g, "-");
|
|
69261
|
-
return
|
|
69312
|
+
return join13(repoPath, `.io-pr-body-${safeBranchName}.md`);
|
|
69262
69313
|
}
|
|
69263
69314
|
function buildPrBody(objective, plan, taskSummaries, qaOutcome) {
|
|
69264
69315
|
const tasks = taskSummaries.map((summary) => `- ${summary}`).join("\n") || "- No task summaries recorded.";
|
|
@@ -69591,7 +69642,7 @@ var init_tasks = __esm({
|
|
|
69591
69642
|
// packages/daemon/src/execution/runner.ts
|
|
69592
69643
|
import { exec as exec7 } from "node:child_process";
|
|
69593
69644
|
import { access as access2 } from "node:fs/promises";
|
|
69594
|
-
import { basename as basename5, join as
|
|
69645
|
+
import { basename as basename5, join as join14 } from "node:path";
|
|
69595
69646
|
import { promisify as promisify7 } from "node:util";
|
|
69596
69647
|
async function pathExists(path) {
|
|
69597
69648
|
try {
|
|
@@ -69611,12 +69662,12 @@ async function runGit2(command, cwd) {
|
|
|
69611
69662
|
async function resolveRepoPath(repoUrl, repoName) {
|
|
69612
69663
|
const candidates = [
|
|
69613
69664
|
process.cwd(),
|
|
69614
|
-
|
|
69615
|
-
|
|
69616
|
-
|
|
69665
|
+
join14(process.cwd(), repoName),
|
|
69666
|
+
join14(process.cwd(), "repos", repoName),
|
|
69667
|
+
join14(process.cwd(), "..", repoName)
|
|
69617
69668
|
];
|
|
69618
69669
|
for (const candidate of candidates) {
|
|
69619
|
-
if (!await pathExists(
|
|
69670
|
+
if (!await pathExists(join14(candidate, ".git"))) {
|
|
69620
69671
|
continue;
|
|
69621
69672
|
}
|
|
69622
69673
|
const remoteUrl = await runGit2("git remote get-url origin", candidate).catch(() => "");
|
|
@@ -70650,12 +70701,25 @@ var init_orchestrator = __esm({
|
|
|
70650
70701
|
}
|
|
70651
70702
|
async refreshSession(model, systemPrompt) {
|
|
70652
70703
|
await this.disconnectSession();
|
|
70653
|
-
|
|
70654
|
-
|
|
70655
|
-
|
|
70656
|
-
|
|
70657
|
-
|
|
70658
|
-
|
|
70704
|
+
try {
|
|
70705
|
+
this.activeSession = await createSession({
|
|
70706
|
+
model,
|
|
70707
|
+
systemPrompt,
|
|
70708
|
+
tools: createBoundOrchestratorTools(this.config)
|
|
70709
|
+
});
|
|
70710
|
+
this.activeModel = model;
|
|
70711
|
+
} catch (error51) {
|
|
70712
|
+
if (model !== DEFAULT_MODEL) {
|
|
70713
|
+
this.activeSession = await createSession({
|
|
70714
|
+
model: DEFAULT_MODEL,
|
|
70715
|
+
systemPrompt,
|
|
70716
|
+
tools: createBoundOrchestratorTools(this.config)
|
|
70717
|
+
});
|
|
70718
|
+
this.activeModel = DEFAULT_MODEL;
|
|
70719
|
+
} else {
|
|
70720
|
+
throw error51;
|
|
70721
|
+
}
|
|
70722
|
+
}
|
|
70659
70723
|
}
|
|
70660
70724
|
async disconnectSession() {
|
|
70661
70725
|
if (!this.activeSession) {
|