heyio 4.1.3 → 4.2.0
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 +233 -112
- package/dist/daemon/index.js +230 -109
- package/dist/web/assets/{index-CZ5uBH6R.js → index-3rp2-GCY.js} +2 -2
- package/dist/web/assets/index-GBOuiOLx.css +9 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-DxpOSxN9.css +0 -9
package/dist/daemon/index.js
CHANGED
|
@@ -79,7 +79,7 @@ var init_constants = __esm({
|
|
|
79
79
|
"packages/shared/dist/constants.js"() {
|
|
80
80
|
"use strict";
|
|
81
81
|
APP_NAME = "io";
|
|
82
|
-
APP_VERSION = "4.
|
|
82
|
+
APP_VERSION = "4.2.0";
|
|
83
83
|
API_PORT = 7777;
|
|
84
84
|
API_HOST = "0.0.0.0";
|
|
85
85
|
DEFAULT_MODEL = "gpt-4o";
|
|
@@ -9207,8 +9207,8 @@ var require_CronFileParser = __commonJS({
|
|
|
9207
9207
|
* @throws If file cannot be read
|
|
9208
9208
|
*/
|
|
9209
9209
|
static async parseFile(filePath) {
|
|
9210
|
-
const { readFile:
|
|
9211
|
-
const data = await
|
|
9210
|
+
const { readFile: readFile10 } = await Promise.resolve().then(() => __importStar(__require("fs/promises")));
|
|
9211
|
+
const data = await readFile10(filePath, "utf8");
|
|
9212
9212
|
return _CronFileParser.#parseContent(data);
|
|
9213
9213
|
}
|
|
9214
9214
|
/**
|
|
@@ -28106,7 +28106,7 @@ var require_view = __commonJS({
|
|
|
28106
28106
|
var dirname9 = path.dirname;
|
|
28107
28107
|
var basename6 = path.basename;
|
|
28108
28108
|
var extname4 = path.extname;
|
|
28109
|
-
var
|
|
28109
|
+
var join17 = path.join;
|
|
28110
28110
|
var resolve5 = path.resolve;
|
|
28111
28111
|
module2.exports = View;
|
|
28112
28112
|
function View(name, options2) {
|
|
@@ -28168,14 +28168,14 @@ var require_view = __commonJS({
|
|
|
28168
28168
|
};
|
|
28169
28169
|
View.prototype.resolve = function resolve6(dir, file2) {
|
|
28170
28170
|
var ext = this.ext;
|
|
28171
|
-
var path2 =
|
|
28172
|
-
var
|
|
28173
|
-
if (
|
|
28171
|
+
var path2 = join17(dir, file2);
|
|
28172
|
+
var stat5 = tryStat(path2);
|
|
28173
|
+
if (stat5 && stat5.isFile()) {
|
|
28174
28174
|
return path2;
|
|
28175
28175
|
}
|
|
28176
|
-
path2 =
|
|
28177
|
-
|
|
28178
|
-
if (
|
|
28176
|
+
path2 = join17(dir, basename6(file2, ext), "index" + ext);
|
|
28177
|
+
stat5 = tryStat(path2);
|
|
28178
|
+
if (stat5 && stat5.isFile()) {
|
|
28179
28179
|
return path2;
|
|
28180
28180
|
}
|
|
28181
28181
|
};
|
|
@@ -28224,9 +28224,9 @@ var require_etag = __commonJS({
|
|
|
28224
28224
|
}
|
|
28225
28225
|
return obj && typeof obj === "object" && "ctime" in obj && toString.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number";
|
|
28226
28226
|
}
|
|
28227
|
-
function stattag(
|
|
28228
|
-
var mtime =
|
|
28229
|
-
var size =
|
|
28227
|
+
function stattag(stat5) {
|
|
28228
|
+
var mtime = stat5.mtime.getTime().toString(16);
|
|
28229
|
+
var size = stat5.size.toString(16);
|
|
28230
28230
|
return '"' + size + "-" + mtime + '"';
|
|
28231
28231
|
}
|
|
28232
28232
|
}
|
|
@@ -31878,7 +31878,7 @@ var require_send = __commonJS({
|
|
|
31878
31878
|
var Stream = __require("stream");
|
|
31879
31879
|
var util = __require("util");
|
|
31880
31880
|
var extname4 = path.extname;
|
|
31881
|
-
var
|
|
31881
|
+
var join17 = path.join;
|
|
31882
31882
|
var normalize = path.normalize;
|
|
31883
31883
|
var resolve5 = path.resolve;
|
|
31884
31884
|
var sep = path.sep;
|
|
@@ -32050,7 +32050,7 @@ var require_send = __commonJS({
|
|
|
32050
32050
|
return res;
|
|
32051
32051
|
}
|
|
32052
32052
|
parts = path2.split(sep);
|
|
32053
|
-
path2 = normalize(
|
|
32053
|
+
path2 = normalize(join17(root, path2));
|
|
32054
32054
|
} else {
|
|
32055
32055
|
if (UP_PATH_REGEXP.test(path2)) {
|
|
32056
32056
|
debug('malicious path "%s"', path2);
|
|
@@ -32081,8 +32081,8 @@ var require_send = __commonJS({
|
|
|
32081
32081
|
this.sendFile(path2);
|
|
32082
32082
|
return res;
|
|
32083
32083
|
};
|
|
32084
|
-
SendStream.prototype.send = function send3(path2,
|
|
32085
|
-
var len =
|
|
32084
|
+
SendStream.prototype.send = function send3(path2, stat5) {
|
|
32085
|
+
var len = stat5.size;
|
|
32086
32086
|
var options2 = this.options;
|
|
32087
32087
|
var opts = {};
|
|
32088
32088
|
var res = this.res;
|
|
@@ -32094,7 +32094,7 @@ var require_send = __commonJS({
|
|
|
32094
32094
|
return;
|
|
32095
32095
|
}
|
|
32096
32096
|
debug('pipe "%s"', path2);
|
|
32097
|
-
this.setHeader(path2,
|
|
32097
|
+
this.setHeader(path2, stat5);
|
|
32098
32098
|
this.type(path2);
|
|
32099
32099
|
if (this.isConditionalGET()) {
|
|
32100
32100
|
if (this.isPreconditionFailure()) {
|
|
@@ -32150,16 +32150,16 @@ var require_send = __commonJS({
|
|
|
32150
32150
|
var i = 0;
|
|
32151
32151
|
var self = this;
|
|
32152
32152
|
debug('stat "%s"', path2);
|
|
32153
|
-
fs.stat(path2, function onstat(err,
|
|
32153
|
+
fs.stat(path2, function onstat(err, stat5) {
|
|
32154
32154
|
var pathEndsWithSep = path2[path2.length - 1] === sep;
|
|
32155
32155
|
if (err && err.code === "ENOENT" && !extname4(path2) && !pathEndsWithSep) {
|
|
32156
32156
|
return next(err);
|
|
32157
32157
|
}
|
|
32158
32158
|
if (err) return self.onStatError(err);
|
|
32159
|
-
if (
|
|
32159
|
+
if (stat5.isDirectory()) return self.redirect(path2);
|
|
32160
32160
|
if (pathEndsWithSep) return self.error(404);
|
|
32161
|
-
self.emit("file", path2,
|
|
32162
|
-
self.send(path2,
|
|
32161
|
+
self.emit("file", path2, stat5);
|
|
32162
|
+
self.send(path2, stat5);
|
|
32163
32163
|
});
|
|
32164
32164
|
function next(err) {
|
|
32165
32165
|
if (self._extensions.length <= i) {
|
|
@@ -32167,11 +32167,11 @@ var require_send = __commonJS({
|
|
|
32167
32167
|
}
|
|
32168
32168
|
var p = path2 + "." + self._extensions[i++];
|
|
32169
32169
|
debug('stat "%s"', p);
|
|
32170
|
-
fs.stat(p, function(err2,
|
|
32170
|
+
fs.stat(p, function(err2, stat5) {
|
|
32171
32171
|
if (err2) return next(err2);
|
|
32172
|
-
if (
|
|
32173
|
-
self.emit("file", p,
|
|
32174
|
-
self.send(p,
|
|
32172
|
+
if (stat5.isDirectory()) return next();
|
|
32173
|
+
self.emit("file", p, stat5);
|
|
32174
|
+
self.send(p, stat5);
|
|
32175
32175
|
});
|
|
32176
32176
|
}
|
|
32177
32177
|
};
|
|
@@ -32183,13 +32183,13 @@ var require_send = __commonJS({
|
|
|
32183
32183
|
if (err) return self.onStatError(err);
|
|
32184
32184
|
return self.error(404);
|
|
32185
32185
|
}
|
|
32186
|
-
var p =
|
|
32186
|
+
var p = join17(path2, self._index[i]);
|
|
32187
32187
|
debug('stat "%s"', p);
|
|
32188
|
-
fs.stat(p, function(err2,
|
|
32188
|
+
fs.stat(p, function(err2, stat5) {
|
|
32189
32189
|
if (err2) return next(err2);
|
|
32190
|
-
if (
|
|
32191
|
-
self.emit("file", p,
|
|
32192
|
-
self.send(p,
|
|
32190
|
+
if (stat5.isDirectory()) return next();
|
|
32191
|
+
self.emit("file", p, stat5);
|
|
32192
|
+
self.send(p, stat5);
|
|
32193
32193
|
});
|
|
32194
32194
|
}
|
|
32195
32195
|
next();
|
|
@@ -32220,9 +32220,9 @@ var require_send = __commonJS({
|
|
|
32220
32220
|
debug("content-type %s", type2);
|
|
32221
32221
|
res.setHeader("Content-Type", type2);
|
|
32222
32222
|
};
|
|
32223
|
-
SendStream.prototype.setHeader = function setHeader(path2,
|
|
32223
|
+
SendStream.prototype.setHeader = function setHeader(path2, stat5) {
|
|
32224
32224
|
var res = this.res;
|
|
32225
|
-
this.emit("headers", res, path2,
|
|
32225
|
+
this.emit("headers", res, path2, stat5);
|
|
32226
32226
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
32227
32227
|
debug("accept ranges");
|
|
32228
32228
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -32236,12 +32236,12 @@ var require_send = __commonJS({
|
|
|
32236
32236
|
res.setHeader("Cache-Control", cacheControl);
|
|
32237
32237
|
}
|
|
32238
32238
|
if (this._lastModified && !res.getHeader("Last-Modified")) {
|
|
32239
|
-
var modified =
|
|
32239
|
+
var modified = stat5.mtime.toUTCString();
|
|
32240
32240
|
debug("modified %s", modified);
|
|
32241
32241
|
res.setHeader("Last-Modified", modified);
|
|
32242
32242
|
}
|
|
32243
32243
|
if (this._etag && !res.getHeader("ETag")) {
|
|
32244
|
-
var val = etag(
|
|
32244
|
+
var val = etag(stat5);
|
|
32245
32245
|
debug("etag %s", val);
|
|
32246
32246
|
res.setHeader("ETag", val);
|
|
32247
32247
|
}
|
|
@@ -49462,7 +49462,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49462
49462
|
if (!(this instanceof SonicBoom)) {
|
|
49463
49463
|
return new SonicBoom(opts);
|
|
49464
49464
|
}
|
|
49465
|
-
let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir:
|
|
49465
|
+
let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir: mkdir11, retryEAGAIN, fsync, contentMode, mode } = opts || {};
|
|
49466
49466
|
fd = fd || dest;
|
|
49467
49467
|
this._len = 0;
|
|
49468
49468
|
this.fd = -1;
|
|
@@ -49487,7 +49487,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49487
49487
|
this.append = append || false;
|
|
49488
49488
|
this.mode = mode;
|
|
49489
49489
|
this.retryEAGAIN = retryEAGAIN || (() => true);
|
|
49490
|
-
this.mkdir =
|
|
49490
|
+
this.mkdir = mkdir11 || false;
|
|
49491
49491
|
let fsWriteSync;
|
|
49492
49492
|
let fsWrite;
|
|
49493
49493
|
if (contentMode === kContentModeBuffer) {
|
|
@@ -50205,7 +50205,7 @@ var require_thread_stream = __commonJS({
|
|
|
50205
50205
|
var { version: version2 } = require_package();
|
|
50206
50206
|
var { EventEmitter: EventEmitter2 } = __require("events");
|
|
50207
50207
|
var { Worker } = __require("worker_threads");
|
|
50208
|
-
var { join:
|
|
50208
|
+
var { join: join17 } = __require("path");
|
|
50209
50209
|
var { pathToFileURL: pathToFileURL2 } = __require("url");
|
|
50210
50210
|
var { wait } = require_wait();
|
|
50211
50211
|
var {
|
|
@@ -50248,7 +50248,7 @@ var require_thread_stream = __commonJS({
|
|
|
50248
50248
|
function createWorker(stream, opts) {
|
|
50249
50249
|
const { filename, workerData } = opts;
|
|
50250
50250
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
50251
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
50251
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join17(__dirname, "lib", "worker.js");
|
|
50252
50252
|
const worker = new Worker(toExecute, {
|
|
50253
50253
|
...opts.workerOpts,
|
|
50254
50254
|
trackUnmanagedFds: false,
|
|
@@ -50651,7 +50651,7 @@ var require_transport = __commonJS({
|
|
|
50651
50651
|
"use strict";
|
|
50652
50652
|
var { createRequire } = __require("module");
|
|
50653
50653
|
var getCallers = require_caller();
|
|
50654
|
-
var { join:
|
|
50654
|
+
var { join: join17, isAbsolute: isAbsolute2, sep } = __require("node:path");
|
|
50655
50655
|
var sleep = require_atomic_sleep();
|
|
50656
50656
|
var onExit = require_on_exit_leak_free();
|
|
50657
50657
|
var ThreadStream = require_thread_stream();
|
|
@@ -50714,7 +50714,7 @@ var require_transport = __commonJS({
|
|
|
50714
50714
|
throw new Error("only one of target or targets can be specified");
|
|
50715
50715
|
}
|
|
50716
50716
|
if (targets) {
|
|
50717
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
50717
|
+
target = bundlerOverrides["pino-worker"] || join17(__dirname, "worker.js");
|
|
50718
50718
|
options2.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
50719
50719
|
return {
|
|
50720
50720
|
...dest,
|
|
@@ -50732,7 +50732,7 @@ var require_transport = __commonJS({
|
|
|
50732
50732
|
});
|
|
50733
50733
|
});
|
|
50734
50734
|
} else if (pipeline) {
|
|
50735
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
50735
|
+
target = bundlerOverrides["pino-worker"] || join17(__dirname, "worker.js");
|
|
50736
50736
|
options2.pipelines = [pipeline.map((dest) => {
|
|
50737
50737
|
return {
|
|
50738
50738
|
...dest,
|
|
@@ -50754,7 +50754,7 @@ var require_transport = __commonJS({
|
|
|
50754
50754
|
return origin;
|
|
50755
50755
|
}
|
|
50756
50756
|
if (origin === "pino/file") {
|
|
50757
|
-
return
|
|
50757
|
+
return join17(__dirname, "..", "file.js");
|
|
50758
50758
|
}
|
|
50759
50759
|
let fixTarget2;
|
|
50760
50760
|
for (const filePath of callers) {
|
|
@@ -51743,7 +51743,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
51743
51743
|
return circularValue;
|
|
51744
51744
|
}
|
|
51745
51745
|
let res = "";
|
|
51746
|
-
let
|
|
51746
|
+
let join17 = ",";
|
|
51747
51747
|
const originalIndentation = indentation;
|
|
51748
51748
|
if (Array.isArray(value)) {
|
|
51749
51749
|
if (value.length === 0) {
|
|
@@ -51757,7 +51757,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
51757
51757
|
indentation += spacer;
|
|
51758
51758
|
res += `
|
|
51759
51759
|
${indentation}`;
|
|
51760
|
-
|
|
51760
|
+
join17 = `,
|
|
51761
51761
|
${indentation}`;
|
|
51762
51762
|
}
|
|
51763
51763
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -51765,13 +51765,13 @@ ${indentation}`;
|
|
|
51765
51765
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
51766
51766
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
51767
51767
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
51768
|
-
res +=
|
|
51768
|
+
res += join17;
|
|
51769
51769
|
}
|
|
51770
51770
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
51771
51771
|
res += tmp !== void 0 ? tmp : "null";
|
|
51772
51772
|
if (value.length - 1 > maximumBreadth) {
|
|
51773
51773
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
51774
|
-
res += `${
|
|
51774
|
+
res += `${join17}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
51775
51775
|
}
|
|
51776
51776
|
if (spacer !== "") {
|
|
51777
51777
|
res += `
|
|
@@ -51792,7 +51792,7 @@ ${originalIndentation}`;
|
|
|
51792
51792
|
let separator = "";
|
|
51793
51793
|
if (spacer !== "") {
|
|
51794
51794
|
indentation += spacer;
|
|
51795
|
-
|
|
51795
|
+
join17 = `,
|
|
51796
51796
|
${indentation}`;
|
|
51797
51797
|
whitespace = " ";
|
|
51798
51798
|
}
|
|
@@ -51806,13 +51806,13 @@ ${indentation}`;
|
|
|
51806
51806
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
51807
51807
|
if (tmp !== void 0) {
|
|
51808
51808
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
51809
|
-
separator =
|
|
51809
|
+
separator = join17;
|
|
51810
51810
|
}
|
|
51811
51811
|
}
|
|
51812
51812
|
if (keyLength > maximumBreadth) {
|
|
51813
51813
|
const removedKeys = keyLength - maximumBreadth;
|
|
51814
51814
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
51815
|
-
separator =
|
|
51815
|
+
separator = join17;
|
|
51816
51816
|
}
|
|
51817
51817
|
if (spacer !== "" && separator.length > 1) {
|
|
51818
51818
|
res = `
|
|
@@ -51853,7 +51853,7 @@ ${originalIndentation}`;
|
|
|
51853
51853
|
}
|
|
51854
51854
|
const originalIndentation = indentation;
|
|
51855
51855
|
let res = "";
|
|
51856
|
-
let
|
|
51856
|
+
let join17 = ",";
|
|
51857
51857
|
if (Array.isArray(value)) {
|
|
51858
51858
|
if (value.length === 0) {
|
|
51859
51859
|
return "[]";
|
|
@@ -51866,7 +51866,7 @@ ${originalIndentation}`;
|
|
|
51866
51866
|
indentation += spacer;
|
|
51867
51867
|
res += `
|
|
51868
51868
|
${indentation}`;
|
|
51869
|
-
|
|
51869
|
+
join17 = `,
|
|
51870
51870
|
${indentation}`;
|
|
51871
51871
|
}
|
|
51872
51872
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -51874,13 +51874,13 @@ ${indentation}`;
|
|
|
51874
51874
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
51875
51875
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
51876
51876
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
51877
|
-
res +=
|
|
51877
|
+
res += join17;
|
|
51878
51878
|
}
|
|
51879
51879
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
51880
51880
|
res += tmp !== void 0 ? tmp : "null";
|
|
51881
51881
|
if (value.length - 1 > maximumBreadth) {
|
|
51882
51882
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
51883
|
-
res += `${
|
|
51883
|
+
res += `${join17}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
51884
51884
|
}
|
|
51885
51885
|
if (spacer !== "") {
|
|
51886
51886
|
res += `
|
|
@@ -51893,7 +51893,7 @@ ${originalIndentation}`;
|
|
|
51893
51893
|
let whitespace = "";
|
|
51894
51894
|
if (spacer !== "") {
|
|
51895
51895
|
indentation += spacer;
|
|
51896
|
-
|
|
51896
|
+
join17 = `,
|
|
51897
51897
|
${indentation}`;
|
|
51898
51898
|
whitespace = " ";
|
|
51899
51899
|
}
|
|
@@ -51902,7 +51902,7 @@ ${indentation}`;
|
|
|
51902
51902
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
51903
51903
|
if (tmp !== void 0) {
|
|
51904
51904
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
51905
|
-
separator =
|
|
51905
|
+
separator = join17;
|
|
51906
51906
|
}
|
|
51907
51907
|
}
|
|
51908
51908
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -51960,20 +51960,20 @@ ${originalIndentation}`;
|
|
|
51960
51960
|
indentation += spacer;
|
|
51961
51961
|
let res2 = `
|
|
51962
51962
|
${indentation}`;
|
|
51963
|
-
const
|
|
51963
|
+
const join18 = `,
|
|
51964
51964
|
${indentation}`;
|
|
51965
51965
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
51966
51966
|
let i = 0;
|
|
51967
51967
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
51968
51968
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
51969
51969
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
51970
|
-
res2 +=
|
|
51970
|
+
res2 += join18;
|
|
51971
51971
|
}
|
|
51972
51972
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
51973
51973
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
51974
51974
|
if (value.length - 1 > maximumBreadth) {
|
|
51975
51975
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
51976
|
-
res2 += `${
|
|
51976
|
+
res2 += `${join18}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
51977
51977
|
}
|
|
51978
51978
|
res2 += `
|
|
51979
51979
|
${originalIndentation}`;
|
|
@@ -51989,16 +51989,16 @@ ${originalIndentation}`;
|
|
|
51989
51989
|
return '"[Object]"';
|
|
51990
51990
|
}
|
|
51991
51991
|
indentation += spacer;
|
|
51992
|
-
const
|
|
51992
|
+
const join17 = `,
|
|
51993
51993
|
${indentation}`;
|
|
51994
51994
|
let res = "";
|
|
51995
51995
|
let separator = "";
|
|
51996
51996
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
51997
51997
|
if (isTypedArrayWithEntries(value)) {
|
|
51998
|
-
res += stringifyTypedArray(value,
|
|
51998
|
+
res += stringifyTypedArray(value, join17, maximumBreadth);
|
|
51999
51999
|
keys = keys.slice(value.length);
|
|
52000
52000
|
maximumPropertiesToStringify -= value.length;
|
|
52001
|
-
separator =
|
|
52001
|
+
separator = join17;
|
|
52002
52002
|
}
|
|
52003
52003
|
if (deterministic) {
|
|
52004
52004
|
keys = sort(keys, comparator);
|
|
@@ -52009,13 +52009,13 @@ ${indentation}`;
|
|
|
52009
52009
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
52010
52010
|
if (tmp !== void 0) {
|
|
52011
52011
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
52012
|
-
separator =
|
|
52012
|
+
separator = join17;
|
|
52013
52013
|
}
|
|
52014
52014
|
}
|
|
52015
52015
|
if (keyLength > maximumBreadth) {
|
|
52016
52016
|
const removedKeys = keyLength - maximumBreadth;
|
|
52017
52017
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
52018
|
-
separator =
|
|
52018
|
+
separator = join17;
|
|
52019
52019
|
}
|
|
52020
52020
|
if (separator !== "") {
|
|
52021
52021
|
res = `
|
|
@@ -77118,6 +77118,18 @@ var MIGRATIONS = [
|
|
|
77118
77118
|
"CREATE INDEX IF NOT EXISTS idx_squad_instances_status ON squad_instances(status)",
|
|
77119
77119
|
"CREATE INDEX IF NOT EXISTS idx_squad_instances_objective_id ON squad_instances(objective_id)"
|
|
77120
77120
|
]
|
|
77121
|
+
},
|
|
77122
|
+
{
|
|
77123
|
+
version: 4,
|
|
77124
|
+
name: "denormalize-usage-names",
|
|
77125
|
+
statements: [
|
|
77126
|
+
"ALTER TABLE token_usage ADD COLUMN squad_name TEXT",
|
|
77127
|
+
"ALTER TABLE token_usage ADD COLUMN agent_name TEXT",
|
|
77128
|
+
`UPDATE token_usage SET
|
|
77129
|
+
squad_name = (SELECT s.name FROM squads s WHERE s.id = token_usage.squad_id),
|
|
77130
|
+
agent_name = (SELECT sm.name FROM squad_members sm WHERE sm.id = token_usage.agent_id)
|
|
77131
|
+
WHERE squad_id IS NOT NULL OR agent_id IS NOT NULL`
|
|
77132
|
+
]
|
|
77121
77133
|
}
|
|
77122
77134
|
];
|
|
77123
77135
|
var client = null;
|
|
@@ -77418,6 +77430,35 @@ async function getMembers(squadId, db) {
|
|
|
77418
77430
|
});
|
|
77419
77431
|
return result.rows.map((row) => mapMember(row));
|
|
77420
77432
|
}
|
|
77433
|
+
async function getMember(memberId, db) {
|
|
77434
|
+
const database = db ?? await getDatabase();
|
|
77435
|
+
const result = await database.execute({
|
|
77436
|
+
sql: "SELECT * FROM squad_members WHERE id = ? LIMIT 1",
|
|
77437
|
+
args: [memberId]
|
|
77438
|
+
});
|
|
77439
|
+
const row = result.rows[0];
|
|
77440
|
+
return row ? mapMember(row) : null;
|
|
77441
|
+
}
|
|
77442
|
+
async function updateMember(memberId, data, db) {
|
|
77443
|
+
const database = db ?? await getDatabase();
|
|
77444
|
+
const sets = [];
|
|
77445
|
+
const args = [];
|
|
77446
|
+
if (data.systemPrompt !== void 0) {
|
|
77447
|
+
sets.push("system_prompt = ?");
|
|
77448
|
+
args.push(data.systemPrompt);
|
|
77449
|
+
}
|
|
77450
|
+
if (data.model !== void 0) {
|
|
77451
|
+
sets.push("model = ?");
|
|
77452
|
+
args.push(data.model || null);
|
|
77453
|
+
}
|
|
77454
|
+
if (sets.length === 0) return getMember(memberId, database);
|
|
77455
|
+
args.push(memberId);
|
|
77456
|
+
await database.execute({
|
|
77457
|
+
sql: `UPDATE squad_members SET ${sets.join(", ")} WHERE id = ?`,
|
|
77458
|
+
args
|
|
77459
|
+
});
|
|
77460
|
+
return getMember(memberId, database);
|
|
77461
|
+
}
|
|
77421
77462
|
async function getSquadRow(id, db) {
|
|
77422
77463
|
const result = await db.execute({
|
|
77423
77464
|
sql: "SELECT * FROM squads WHERE id = ? LIMIT 1",
|
|
@@ -77816,8 +77857,8 @@ async function recordUsage(data, db) {
|
|
|
77816
77857
|
createdAt: data.createdAt ?? nowIso()
|
|
77817
77858
|
};
|
|
77818
77859
|
await database.execute({
|
|
77819
|
-
sql: `INSERT INTO token_usage (id, squad_id, agent_id, model, input_tokens, output_tokens, cost, premium_request_cost, token_unit_cost, created_at)
|
|
77820
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
77860
|
+
sql: `INSERT INTO token_usage (id, squad_id, agent_id, model, input_tokens, output_tokens, cost, premium_request_cost, token_unit_cost, squad_name, agent_name, created_at)
|
|
77861
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
77821
77862
|
args: [
|
|
77822
77863
|
usage.id,
|
|
77823
77864
|
usage.squadId,
|
|
@@ -77828,6 +77869,8 @@ async function recordUsage(data, db) {
|
|
|
77828
77869
|
usage.cost,
|
|
77829
77870
|
data.premiumRequestCost ?? null,
|
|
77830
77871
|
data.tokenUnitCost ?? null,
|
|
77872
|
+
data.squadName ?? null,
|
|
77873
|
+
data.agentName ?? null,
|
|
77831
77874
|
usage.createdAt
|
|
77832
77875
|
]
|
|
77833
77876
|
});
|
|
@@ -77892,8 +77935,8 @@ async function getUsageRecords(params = {}, db) {
|
|
|
77892
77935
|
const result = await database.execute({
|
|
77893
77936
|
sql: `SELECT tu.model, tu.input_tokens, tu.output_tokens, tu.cost,
|
|
77894
77937
|
tu.created_at, tu.squad_id, tu.agent_id,
|
|
77895
|
-
COALESCE(s.name, '') AS squad_name,
|
|
77896
|
-
COALESCE(sm.name, '') AS agent_name
|
|
77938
|
+
COALESCE(s.name, tu.squad_name, '') AS squad_name,
|
|
77939
|
+
COALESCE(sm.name, tu.agent_name, '') AS agent_name
|
|
77897
77940
|
FROM token_usage tu
|
|
77898
77941
|
LEFT JOIN squads s ON s.id = tu.squad_id
|
|
77899
77942
|
LEFT JOIN squad_members sm ON sm.id = tu.agent_id
|
|
@@ -79357,10 +79400,10 @@ async function spawnInstance(input) {
|
|
|
79357
79400
|
async function startInstance(instanceId, repoPath, baseBranch) {
|
|
79358
79401
|
const branchName = `squad/instance-${instanceId.slice(0, 8)}`;
|
|
79359
79402
|
try {
|
|
79360
|
-
const { exec:
|
|
79361
|
-
const { promisify:
|
|
79362
|
-
const
|
|
79363
|
-
await
|
|
79403
|
+
const { exec: exec9 } = await import("node:child_process");
|
|
79404
|
+
const { promisify: promisify9 } = await import("node:util");
|
|
79405
|
+
const execAsync9 = promisify9(exec9);
|
|
79406
|
+
await execAsync9(`git fetch origin && git pull origin ${baseBranch}`, {
|
|
79364
79407
|
cwd: repoPath,
|
|
79365
79408
|
maxBuffer: 10 * 1024 * 1024
|
|
79366
79409
|
});
|
|
@@ -79689,6 +79732,26 @@ router7.get("/api/squads/:id/members", async (req, res) => {
|
|
|
79689
79732
|
});
|
|
79690
79733
|
}
|
|
79691
79734
|
});
|
|
79735
|
+
router7.put("/api/squads/:id/members/:memberId", async (req, res) => {
|
|
79736
|
+
try {
|
|
79737
|
+
const member = await getMember(req.params.memberId);
|
|
79738
|
+
if (!member) {
|
|
79739
|
+
res.status(404).json({ error: "Member not found" });
|
|
79740
|
+
return;
|
|
79741
|
+
}
|
|
79742
|
+
const { systemPrompt, model } = req.body;
|
|
79743
|
+
const updated = await updateMember(member.id, {
|
|
79744
|
+
systemPrompt,
|
|
79745
|
+
model: model === "" ? null : model
|
|
79746
|
+
});
|
|
79747
|
+
res.status(200).json(updated);
|
|
79748
|
+
} catch (error51) {
|
|
79749
|
+
res.status(500).json({
|
|
79750
|
+
error: "Failed to update member",
|
|
79751
|
+
details: error51 instanceof Error ? error51.message : "Unknown error"
|
|
79752
|
+
});
|
|
79753
|
+
}
|
|
79754
|
+
});
|
|
79692
79755
|
router7.post("/api/squads/:id/objectives", async (req, res) => {
|
|
79693
79756
|
try {
|
|
79694
79757
|
const squad = await resolveSquad(req.params.id);
|
|
@@ -82063,10 +82126,16 @@ var executeSkillsToolCall = async (toolName, rawArgs) => {
|
|
|
82063
82126
|
|
|
82064
82127
|
// packages/daemon/src/orchestrator/tools/squad.ts
|
|
82065
82128
|
init_dist();
|
|
82129
|
+
init_paths();
|
|
82066
82130
|
init_zod();
|
|
82131
|
+
import { exec as exec8 } from "node:child_process";
|
|
82132
|
+
import { mkdir as mkdir10, readFile as readFile9, readdir as readdir6, stat as stat4 } from "node:fs/promises";
|
|
82133
|
+
import { join as join16 } from "node:path";
|
|
82134
|
+
import { promisify as promisify8 } from "node:util";
|
|
82067
82135
|
|
|
82068
82136
|
// packages/daemon/src/execution/runner.ts
|
|
82069
82137
|
init_dist();
|
|
82138
|
+
init_paths();
|
|
82070
82139
|
import { exec as exec7 } from "node:child_process";
|
|
82071
82140
|
import { access as access2 } from "node:fs/promises";
|
|
82072
82141
|
import { basename as basename5, join as join15 } from "node:path";
|
|
@@ -82162,7 +82231,8 @@ function mergeUsage(target, usage) {
|
|
|
82162
82231
|
target.models.push(usage.model);
|
|
82163
82232
|
}
|
|
82164
82233
|
}
|
|
82165
|
-
async function persistUsage(member, usageEvents) {
|
|
82234
|
+
async function persistUsage(member, usageEvents, squadName) {
|
|
82235
|
+
const resolvedSquadName = squadName ?? (member.squadId ? (await getSquad(member.squadId))?.name : null) ?? null;
|
|
82166
82236
|
for (const usage of usageEvents) {
|
|
82167
82237
|
const model = usage.model;
|
|
82168
82238
|
const pricing = await getModelPricing(model);
|
|
@@ -82175,7 +82245,9 @@ async function persistUsage(member, usageEvents) {
|
|
|
82175
82245
|
) : 0;
|
|
82176
82246
|
await recordUsage({
|
|
82177
82247
|
squadId: member.squadId,
|
|
82248
|
+
squadName: resolvedSquadName,
|
|
82178
82249
|
agentId: member.id,
|
|
82250
|
+
agentName: member.name,
|
|
82179
82251
|
model,
|
|
82180
82252
|
inputTokens: usage.inputTokens ?? 0,
|
|
82181
82253
|
outputTokens: usage.outputTokens ?? 0,
|
|
@@ -83039,7 +83111,11 @@ async function runGit2(command, cwd) {
|
|
|
83039
83111
|
return stdout.trim();
|
|
83040
83112
|
}
|
|
83041
83113
|
async function resolveRepoPath(repoUrl, repoName) {
|
|
83114
|
+
const urlSegments = repoUrl.replace(/\.git$/i, "").split("/").filter(Boolean);
|
|
83115
|
+
const owner = urlSegments.at(-2) ?? "";
|
|
83116
|
+
const managedDir = owner && repoName ? join15(DATA_DIR, "repos", `${owner}--${repoName}`) : null;
|
|
83042
83117
|
const candidates = [
|
|
83118
|
+
...managedDir ? [managedDir] : [],
|
|
83043
83119
|
process.cwd(),
|
|
83044
83120
|
join15(process.cwd(), repoName),
|
|
83045
83121
|
join15(process.cwd(), "repos", repoName),
|
|
@@ -83529,6 +83605,15 @@ Role: ${memberDefinition.description}`
|
|
|
83529
83605
|
}
|
|
83530
83606
|
|
|
83531
83607
|
// packages/daemon/src/orchestrator/tools/squad.ts
|
|
83608
|
+
var execAsync8 = promisify8(exec8);
|
|
83609
|
+
async function pathExists2(path) {
|
|
83610
|
+
try {
|
|
83611
|
+
await stat4(path);
|
|
83612
|
+
return true;
|
|
83613
|
+
} catch {
|
|
83614
|
+
return false;
|
|
83615
|
+
}
|
|
83616
|
+
}
|
|
83532
83617
|
var hireSquadSchema = external_exports.object({
|
|
83533
83618
|
repoUrl: external_exports.string().trim().min(1)
|
|
83534
83619
|
});
|
|
@@ -83590,58 +83675,94 @@ async function buildRepoAnalysis(repoUrl) {
|
|
|
83590
83675
|
);
|
|
83591
83676
|
return lines.join("\n");
|
|
83592
83677
|
}
|
|
83593
|
-
const
|
|
83594
|
-
|
|
83595
|
-
|
|
83678
|
+
const repoDir = join16(DATA_DIR, "repos", `${owner}--${name}`);
|
|
83679
|
+
try {
|
|
83680
|
+
await mkdir10(join16(DATA_DIR, "repos"), { recursive: true });
|
|
83681
|
+
if (await pathExists2(join16(repoDir, ".git"))) {
|
|
83682
|
+
await execAsync8("git pull --ff-only", { cwd: repoDir, timeout: 3e4 }).catch(
|
|
83683
|
+
() => void 0
|
|
83684
|
+
);
|
|
83685
|
+
} else {
|
|
83686
|
+
await execAsync8(`git clone --depth 50 ${normalized} "${repoDir}"`, {
|
|
83687
|
+
timeout: 6e4
|
|
83688
|
+
});
|
|
83689
|
+
}
|
|
83690
|
+
} catch {
|
|
83691
|
+
lines.push("Unable to clone repository locally; falling back to basic analysis.");
|
|
83692
|
+
lines.push("Based on the repository name, propose roles that match common project patterns.");
|
|
83693
|
+
return lines.join("\n");
|
|
83596
83694
|
}
|
|
83597
83695
|
try {
|
|
83598
|
-
const
|
|
83599
|
-
|
|
83600
|
-
|
|
83601
|
-
|
|
83602
|
-
|
|
83603
|
-
|
|
83604
|
-
}
|
|
83605
|
-
const treeRes = await fetch(
|
|
83606
|
-
`https://api.github.com/repos/${owner}/${name}/git/trees/HEAD?recursive=false`,
|
|
83607
|
-
{ headers }
|
|
83608
|
-
);
|
|
83609
|
-
if (treeRes.ok) {
|
|
83610
|
-
const tree = await treeRes.json();
|
|
83611
|
-
const rootFiles = (tree.tree ?? []).filter((entry) => entry.type === "blob").map((entry) => entry.path);
|
|
83612
|
-
const rootDirs = (tree.tree ?? []).filter((entry) => entry.type === "tree").map((entry) => entry.path);
|
|
83613
|
-
if (rootFiles.length) lines.push(`Root files: ${rootFiles.join(", ")}`);
|
|
83614
|
-
if (rootDirs.length) lines.push(`Root directories: ${rootDirs.join(", ")}`);
|
|
83615
|
-
}
|
|
83616
|
-
const manifests = [
|
|
83696
|
+
const rootEntries = await readdir6(repoDir, { withFileTypes: true });
|
|
83697
|
+
const rootFiles = rootEntries.filter((e) => e.isFile()).map((e) => e.name);
|
|
83698
|
+
const rootDirs = rootEntries.filter((e) => e.isDirectory() && e.name !== ".git").map((e) => e.name);
|
|
83699
|
+
if (rootFiles.length) lines.push(`Root files: ${rootFiles.join(", ")}`);
|
|
83700
|
+
if (rootDirs.length) lines.push(`Root directories: ${rootDirs.join(", ")}`);
|
|
83701
|
+
const manifestFiles = [
|
|
83617
83702
|
"package.json",
|
|
83618
83703
|
"Cargo.toml",
|
|
83619
83704
|
"go.mod",
|
|
83620
83705
|
"requirements.txt",
|
|
83621
|
-
"pyproject.toml"
|
|
83706
|
+
"pyproject.toml",
|
|
83707
|
+
"Gemfile",
|
|
83708
|
+
"pom.xml",
|
|
83709
|
+
"build.gradle",
|
|
83710
|
+
"composer.json",
|
|
83711
|
+
"Makefile",
|
|
83712
|
+
"Dockerfile",
|
|
83713
|
+
"docker-compose.yml",
|
|
83714
|
+
"docker-compose.yaml",
|
|
83715
|
+
".github/workflows"
|
|
83622
83716
|
];
|
|
83623
|
-
for (const manifest of
|
|
83717
|
+
for (const manifest of manifestFiles) {
|
|
83718
|
+
const fullPath = join16(repoDir, manifest);
|
|
83624
83719
|
try {
|
|
83625
|
-
const
|
|
83626
|
-
|
|
83627
|
-
|
|
83628
|
-
|
|
83629
|
-
if (fileRes.ok) {
|
|
83630
|
-
const file2 = await fileRes.json();
|
|
83631
|
-
if (file2.content && file2.encoding === "base64") {
|
|
83632
|
-
const decoded = Buffer.from(file2.content, "base64").toString("utf8");
|
|
83633
|
-
lines.push(`
|
|
83720
|
+
const fileStat = await stat4(fullPath);
|
|
83721
|
+
if (fileStat.isFile()) {
|
|
83722
|
+
const content = await readFile9(fullPath, "utf8");
|
|
83723
|
+
lines.push(`
|
|
83634
83724
|
--- ${manifest} ---
|
|
83635
|
-
${
|
|
83636
|
-
|
|
83725
|
+
${content.slice(0, 3e3)}`);
|
|
83726
|
+
} else if (fileStat.isDirectory()) {
|
|
83727
|
+
const children = await readdir6(fullPath);
|
|
83728
|
+
lines.push(`
|
|
83729
|
+
--- ${manifest}/ ---
|
|
83730
|
+
${children.join(", ")}`);
|
|
83637
83731
|
}
|
|
83638
83732
|
} catch {
|
|
83639
83733
|
}
|
|
83640
83734
|
}
|
|
83735
|
+
const srcDirs = rootDirs.filter(
|
|
83736
|
+
(d) => ["src", "lib", "app", "packages", "crates", "cmd", "internal"].includes(d)
|
|
83737
|
+
);
|
|
83738
|
+
for (const srcDir of srcDirs) {
|
|
83739
|
+
try {
|
|
83740
|
+
const srcEntries = await readdir6(join16(repoDir, srcDir), { withFileTypes: true });
|
|
83741
|
+
const srcFiles = srcEntries.filter((e) => e.isFile()).map((e) => e.name);
|
|
83742
|
+
const srcSubDirs = srcEntries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
83743
|
+
lines.push(`
|
|
83744
|
+
--- ${srcDir}/ ---`);
|
|
83745
|
+
if (srcSubDirs.length) lines.push(` Directories: ${srcSubDirs.join(", ")}`);
|
|
83746
|
+
if (srcFiles.length) lines.push(` Files: ${srcFiles.slice(0, 30).join(", ")}`);
|
|
83747
|
+
} catch {
|
|
83748
|
+
}
|
|
83749
|
+
}
|
|
83750
|
+
const readmeCandidates = ["README.md", "README.rst", "README.txt", "README"];
|
|
83751
|
+
for (const readme of readmeCandidates) {
|
|
83752
|
+
try {
|
|
83753
|
+
const content = await readFile9(join16(repoDir, readme), "utf8");
|
|
83754
|
+
lines.push(`
|
|
83755
|
+
--- ${readme} (excerpt) ---
|
|
83756
|
+
${content.slice(0, 1500)}`);
|
|
83757
|
+
break;
|
|
83758
|
+
} catch {
|
|
83759
|
+
}
|
|
83760
|
+
}
|
|
83641
83761
|
} catch {
|
|
83762
|
+
lines.push("Filesystem scan failed; using minimal info.");
|
|
83642
83763
|
}
|
|
83643
83764
|
lines.push(
|
|
83644
|
-
"\nBased on the above repository structure, propose roles that match the project's actual technology stack."
|
|
83765
|
+
"\nBased on the above repository structure and contents, propose roles that match the project's actual technology stack and architecture."
|
|
83645
83766
|
);
|
|
83646
83767
|
return lines.join("\n");
|
|
83647
83768
|
}
|