@gobing-ai/spur 0.2.2 → 0.2.4
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/package.json +14 -10
- package/schemas/preset.schema.json +54 -0
- package/schemas/rule-file.schema.json +49 -0
- package/schemas/state-machine-workflow.schema.json +79 -0
- package/schemas/transition-flow-workflow.schema.json +78 -0
- package/spur-cli/config/rules/boundary/dao-boundary.yaml +1 -0
- package/spur-cli/config/rules/migration/rg-dialect.yaml +1 -0
- package/spur-cli/config/rules/quality/coverage-gate.yaml +1 -0
- package/spur-cli/config/rules/quality/tsdoc-exports.yaml +1 -0
- package/spur-cli/config/rules/recommended-post-check.yaml +1 -0
- package/spur-cli/config/rules/recommended-pre-check.yaml +1 -0
- package/spur-cli/config/rules/rg-migration.yaml +1 -0
- package/spur-cli/config/rules/strict/http-boundaries.yaml +1 -0
- package/spur-cli/config/rules/strict/rule-files-structural.yaml +1 -0
- package/spur-cli/config/rules/strict/runtime-boundaries.yaml +1 -0
- package/spur-cli/config/rules/strict-check.yaml +1 -0
- package/spur-cli/config/rules/structure/protected-files.yaml +1 -0
- package/spur-cli/config/rules/structure/test-focus-skip.yaml +1 -0
- package/spur-cli/config/rules/structure/test-location.yaml +1 -0
- package/spur-cli/config/rules/surface/check-cli-surface.yaml +1 -0
- package/spur-cli/config/rules/typescript/bun-tooling.yaml +1 -0
- package/spur-cli/config/rules/typescript/no-biome-suppressions.yaml +1 -0
- package/spur-cli/config/rules/typescript/no-debugger.yaml +1 -0
- package/spur-cli/config/rules/typescript/output-boundaries.yaml +1 -0
- package/spur-cli/config/workflows/basic.yaml +1 -0
- package/spur-cli/config/workflows/feature-dev.yaml +117 -0
- package/spur.js +2177 -137
package/spur.js
CHANGED
|
@@ -2157,7 +2157,7 @@ var require_extra_typings = __commonJS((exports, module) => {
|
|
|
2157
2157
|
exports.createArgument = (name, description) => new commander.Argument(name, description);
|
|
2158
2158
|
});
|
|
2159
2159
|
|
|
2160
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.
|
|
2160
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.10/node_modules/@gobing-ai/ts-utils/dist/errors.js
|
|
2161
2161
|
var ErrorCode;
|
|
2162
2162
|
var init_errors = __esm(() => {
|
|
2163
2163
|
ErrorCode = {
|
|
@@ -2168,7 +2168,7 @@ var init_errors = __esm(() => {
|
|
|
2168
2168
|
};
|
|
2169
2169
|
});
|
|
2170
2170
|
|
|
2171
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.
|
|
2171
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.10/node_modules/@gobing-ai/ts-utils/dist/api-response.js
|
|
2172
2172
|
var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
|
|
2173
2173
|
var init_api_response = __esm(() => {
|
|
2174
2174
|
init_errors();
|
|
@@ -2191,10 +2191,10 @@ var init_api_response = __esm(() => {
|
|
|
2191
2191
|
CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
|
|
2192
2192
|
});
|
|
2193
2193
|
|
|
2194
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.
|
|
2194
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.10/node_modules/@gobing-ai/ts-utils/dist/cursor.js
|
|
2195
2195
|
var init_cursor = () => {};
|
|
2196
2196
|
|
|
2197
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.
|
|
2197
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.10/node_modules/@gobing-ai/ts-utils/dist/object.js
|
|
2198
2198
|
function isPlainObject(value) {
|
|
2199
2199
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2200
2200
|
}
|
|
@@ -2210,7 +2210,7 @@ function deepMerge(target, source) {
|
|
|
2210
2210
|
return result;
|
|
2211
2211
|
}
|
|
2212
2212
|
|
|
2213
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.
|
|
2213
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.10/node_modules/@gobing-ai/ts-utils/dist/output.js
|
|
2214
2214
|
function processStream(name) {
|
|
2215
2215
|
const proc = globalThis.process;
|
|
2216
2216
|
const stream = proc?.[name];
|
|
@@ -2231,7 +2231,7 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
|
|
|
2231
2231
|
}
|
|
2232
2232
|
var defaultStdoutTarget, defaultStderrTarget;
|
|
2233
2233
|
|
|
2234
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.
|
|
2234
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.3.10/node_modules/@gobing-ai/ts-utils/dist/index.js
|
|
2235
2235
|
var init_dist = __esm(() => {
|
|
2236
2236
|
init_api_response();
|
|
2237
2237
|
init_cursor();
|
|
@@ -23853,7 +23853,7 @@ var init_zod = __esm(() => {
|
|
|
23853
23853
|
init_external();
|
|
23854
23854
|
});
|
|
23855
23855
|
|
|
23856
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
23856
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/config.js
|
|
23857
23857
|
function parseYamlObject(text) {
|
|
23858
23858
|
let parsed;
|
|
23859
23859
|
try {
|
|
@@ -23956,7 +23956,7 @@ var init_config = __esm(() => {
|
|
|
23956
23956
|
};
|
|
23957
23957
|
});
|
|
23958
23958
|
|
|
23959
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
23959
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
23960
23960
|
import { appendFileSync, cpSync, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "fs";
|
|
23961
23961
|
import { dirname, resolve as resolvePath } from "path";
|
|
23962
23962
|
function createNodeFileSystem(root) {
|
|
@@ -31205,7 +31205,7 @@ var init_execa = __esm(() => {
|
|
|
31205
31205
|
} = getIpcExport());
|
|
31206
31206
|
});
|
|
31207
31207
|
|
|
31208
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
31208
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
|
|
31209
31209
|
import { isatty } from "tty";
|
|
31210
31210
|
|
|
31211
31211
|
class ProcessExecutor {
|
|
@@ -31446,7 +31446,7 @@ var init_process_executor = __esm(() => {
|
|
|
31446
31446
|
};
|
|
31447
31447
|
});
|
|
31448
31448
|
|
|
31449
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
31449
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/context.js
|
|
31450
31450
|
class RuntimeContext {
|
|
31451
31451
|
scope;
|
|
31452
31452
|
runtimeName;
|
|
@@ -31515,7 +31515,7 @@ var init_context = __esm(() => {
|
|
|
31515
31515
|
init_process_executor();
|
|
31516
31516
|
});
|
|
31517
31517
|
|
|
31518
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
31518
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/path.js
|
|
31519
31519
|
function normalizeSeparators(path6) {
|
|
31520
31520
|
return path6.replaceAll("\\", "/");
|
|
31521
31521
|
}
|
|
@@ -31623,7 +31623,7 @@ var init_path = __esm(() => {
|
|
|
31623
31623
|
SEP = globalThis.process?.platform === "win32" ? "\\" : "/";
|
|
31624
31624
|
});
|
|
31625
31625
|
|
|
31626
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
31626
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/fs.js
|
|
31627
31627
|
import { mkdirSync as mkdirSync2, readdirSync as readdirSync2, readFileSync as readFileSync4, rmSync as rmSync2, statSync as statSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
31628
31628
|
function nodeFsPromises() {
|
|
31629
31629
|
fsPromisesModule ??= import("fs/promises");
|
|
@@ -31805,7 +31805,7 @@ var init_fs = __esm(() => {
|
|
|
31805
31805
|
activeFileSystem = new NodeFileSystem;
|
|
31806
31806
|
});
|
|
31807
31807
|
|
|
31808
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
31808
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
|
|
31809
31809
|
async function loadStructuredConfig(path6, options = {}) {
|
|
31810
31810
|
const content = await (options.fileSystem ?? getFs()).readFile(path6);
|
|
31811
31811
|
return await parseStructuredConfig(content, path6, options);
|
|
@@ -32085,10 +32085,10 @@ var init_schema_validation = __esm(() => {
|
|
|
32085
32085
|
defaultResolve = typeof Bun !== "undefined" ? (specifier, from) => Bun.resolveSync(specifier, from) : undefined;
|
|
32086
32086
|
});
|
|
32087
32087
|
|
|
32088
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
32088
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/types.js
|
|
32089
32089
|
var init_types = () => {};
|
|
32090
32090
|
|
|
32091
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
32091
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
32092
32092
|
var init_dist3 = __esm(() => {
|
|
32093
32093
|
init_file_system_node();
|
|
32094
32094
|
init_fs();
|
|
@@ -32101,7 +32101,7 @@ var init_dist3 = __esm(() => {
|
|
|
32101
32101
|
init_types();
|
|
32102
32102
|
});
|
|
32103
32103
|
|
|
32104
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
32104
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
|
|
32105
32105
|
import { Database } from "bun:sqlite";
|
|
32106
32106
|
var init_bun_sqlite = () => {};
|
|
32107
32107
|
|
|
@@ -36327,7 +36327,7 @@ var init_bun_sqlite2 = __esm(() => {
|
|
|
36327
36327
|
init_session2();
|
|
36328
36328
|
});
|
|
36329
36329
|
|
|
36330
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
36330
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
|
|
36331
36331
|
var inboxMessages;
|
|
36332
36332
|
var init_inbox_messages = __esm(() => {
|
|
36333
36333
|
init_sqlite_core();
|
|
@@ -36346,7 +36346,7 @@ var init_inbox_messages = __esm(() => {
|
|
|
36346
36346
|
}, (table2) => [index("idx_inbox_messages_to_status").on(table2.toId, table2.status)]);
|
|
36347
36347
|
});
|
|
36348
36348
|
|
|
36349
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
36349
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/common.js
|
|
36350
36350
|
function nowTimestamp() {
|
|
36351
36351
|
return Date.now();
|
|
36352
36352
|
}
|
|
@@ -36375,7 +36375,7 @@ var init_common3 = __esm(() => {
|
|
|
36375
36375
|
appendOnlyColumns = buildAppendOnlyColumns();
|
|
36376
36376
|
});
|
|
36377
36377
|
|
|
36378
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
36378
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
|
|
36379
36379
|
var queueJobs;
|
|
36380
36380
|
var init_queue_jobs = __esm(() => {
|
|
36381
36381
|
init_sqlite_core();
|
|
@@ -36395,7 +36395,7 @@ var init_queue_jobs = __esm(() => {
|
|
|
36395
36395
|
}, (table2) => [index("queue_jobs_ready_idx").on(table2.status, table2.nextRetryAt, table2.createdAt)]);
|
|
36396
36396
|
});
|
|
36397
36397
|
|
|
36398
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
36398
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
|
|
36399
36399
|
var exports_runtime = {};
|
|
36400
36400
|
__export(exports_runtime, {
|
|
36401
36401
|
queueJobs: () => queueJobs,
|
|
@@ -36406,7 +36406,7 @@ var init_runtime = __esm(() => {
|
|
|
36406
36406
|
init_queue_jobs();
|
|
36407
36407
|
});
|
|
36408
36408
|
|
|
36409
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
36409
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
|
|
36410
36410
|
var exports_bun_sqlite = {};
|
|
36411
36411
|
__export(exports_bun_sqlite, {
|
|
36412
36412
|
BunSqliteAdapter: () => BunSqliteAdapter
|
|
@@ -36685,7 +36685,7 @@ var init_d1 = __esm(() => {
|
|
|
36685
36685
|
init_session3();
|
|
36686
36686
|
});
|
|
36687
36687
|
|
|
36688
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
36688
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
|
|
36689
36689
|
var exports_d1 = {};
|
|
36690
36690
|
__export(exports_d1, {
|
|
36691
36691
|
D1Adapter: () => D1Adapter
|
|
@@ -44432,6 +44432,64 @@ var require_src8 = __commonJS((exports) => {
|
|
|
44432
44432
|
} });
|
|
44433
44433
|
});
|
|
44434
44434
|
|
|
44435
|
+
// ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
44436
|
+
var require_src9 = __commonJS((exports, module) => {
|
|
44437
|
+
var ESC2 = "\x1B";
|
|
44438
|
+
var CSI2 = `${ESC2}[`;
|
|
44439
|
+
var beep = "\x07";
|
|
44440
|
+
var cursor2 = {
|
|
44441
|
+
to(x, y) {
|
|
44442
|
+
if (!y)
|
|
44443
|
+
return `${CSI2}${x + 1}G`;
|
|
44444
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
44445
|
+
},
|
|
44446
|
+
move(x, y) {
|
|
44447
|
+
let ret = "";
|
|
44448
|
+
if (x < 0)
|
|
44449
|
+
ret += `${CSI2}${-x}D`;
|
|
44450
|
+
else if (x > 0)
|
|
44451
|
+
ret += `${CSI2}${x}C`;
|
|
44452
|
+
if (y < 0)
|
|
44453
|
+
ret += `${CSI2}${-y}A`;
|
|
44454
|
+
else if (y > 0)
|
|
44455
|
+
ret += `${CSI2}${y}B`;
|
|
44456
|
+
return ret;
|
|
44457
|
+
},
|
|
44458
|
+
up: (count3 = 1) => `${CSI2}${count3}A`,
|
|
44459
|
+
down: (count3 = 1) => `${CSI2}${count3}B`,
|
|
44460
|
+
forward: (count3 = 1) => `${CSI2}${count3}C`,
|
|
44461
|
+
backward: (count3 = 1) => `${CSI2}${count3}D`,
|
|
44462
|
+
nextLine: (count3 = 1) => `${CSI2}E`.repeat(count3),
|
|
44463
|
+
prevLine: (count3 = 1) => `${CSI2}F`.repeat(count3),
|
|
44464
|
+
left: `${CSI2}G`,
|
|
44465
|
+
hide: `${CSI2}?25l`,
|
|
44466
|
+
show: `${CSI2}?25h`,
|
|
44467
|
+
save: `${ESC2}7`,
|
|
44468
|
+
restore: `${ESC2}8`
|
|
44469
|
+
};
|
|
44470
|
+
var scroll = {
|
|
44471
|
+
up: (count3 = 1) => `${CSI2}S`.repeat(count3),
|
|
44472
|
+
down: (count3 = 1) => `${CSI2}T`.repeat(count3)
|
|
44473
|
+
};
|
|
44474
|
+
var erase = {
|
|
44475
|
+
screen: `${CSI2}2J`,
|
|
44476
|
+
up: (count3 = 1) => `${CSI2}1J`.repeat(count3),
|
|
44477
|
+
down: (count3 = 1) => `${CSI2}J`.repeat(count3),
|
|
44478
|
+
line: `${CSI2}2K`,
|
|
44479
|
+
lineEnd: `${CSI2}K`,
|
|
44480
|
+
lineStart: `${CSI2}1K`,
|
|
44481
|
+
lines(count3) {
|
|
44482
|
+
let clear = "";
|
|
44483
|
+
for (let i2 = 0;i2 < count3; i2++)
|
|
44484
|
+
clear += this.line + (i2 < count3 - 1 ? cursor2.up() : "");
|
|
44485
|
+
if (count3)
|
|
44486
|
+
clear += cursor2.left;
|
|
44487
|
+
return clear;
|
|
44488
|
+
}
|
|
44489
|
+
};
|
|
44490
|
+
module.exports = { cursor: cursor2, scroll, erase, beep };
|
|
44491
|
+
});
|
|
44492
|
+
|
|
44435
44493
|
// ../../node_modules/.bun/@commander-js+extra-typings@14.0.0+952b9027c0112832/node_modules/@commander-js/extra-typings/esm.mjs
|
|
44436
44494
|
var import__ = __toESM(require_extra_typings(), 1);
|
|
44437
44495
|
var {
|
|
@@ -44448,11 +44506,11 @@ var {
|
|
|
44448
44506
|
Help
|
|
44449
44507
|
} = import__.default;
|
|
44450
44508
|
|
|
44451
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
44509
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/application-node.js
|
|
44452
44510
|
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
|
|
44453
44511
|
import { dirname as dirname2 } from "path";
|
|
44454
44512
|
|
|
44455
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
44513
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/adapter.js
|
|
44456
44514
|
async function createDbAdapter(config3) {
|
|
44457
44515
|
switch (config3.driver) {
|
|
44458
44516
|
case "bun-sqlite": {
|
|
@@ -44468,7 +44526,7 @@ async function createDbAdapter(config3) {
|
|
|
44468
44526
|
}
|
|
44469
44527
|
}
|
|
44470
44528
|
}
|
|
44471
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
44529
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/query-spec.js
|
|
44472
44530
|
var COMPARISON_BUILDERS = {
|
|
44473
44531
|
eq: (col, value) => eq(col, value),
|
|
44474
44532
|
ne: (col, value) => ne(col, value),
|
|
@@ -44502,7 +44560,7 @@ function compileOrderBy(orderBy) {
|
|
|
44502
44560
|
return orderBy.map((term) => term.dir === "desc" ? desc(term.col) : asc(term.col));
|
|
44503
44561
|
}
|
|
44504
44562
|
|
|
44505
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
44563
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/base-dao.js
|
|
44506
44564
|
function asSelectQuery(query) {
|
|
44507
44565
|
return query;
|
|
44508
44566
|
}
|
|
@@ -44541,7 +44599,7 @@ class BaseDao {
|
|
|
44541
44599
|
}
|
|
44542
44600
|
}
|
|
44543
44601
|
|
|
44544
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
44602
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
|
|
44545
44603
|
class EntityDao extends BaseDao {
|
|
44546
44604
|
table;
|
|
44547
44605
|
primaryKey;
|
|
@@ -44696,7 +44754,7 @@ class EntityDao extends BaseDao {
|
|
|
44696
44754
|
return { and: [where, active] };
|
|
44697
44755
|
}
|
|
44698
44756
|
}
|
|
44699
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
44757
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/inbox-message-dao.js
|
|
44700
44758
|
init_inbox_messages();
|
|
44701
44759
|
|
|
44702
44760
|
class InboxMessageDao extends EntityDao {
|
|
@@ -44764,7 +44822,7 @@ class InboxMessageDao extends EntityDao {
|
|
|
44764
44822
|
return this.findBy(inboxMessages.id, id);
|
|
44765
44823
|
}
|
|
44766
44824
|
}
|
|
44767
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
44825
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/application-node.js
|
|
44768
44826
|
init_dist3();
|
|
44769
44827
|
// ../../node_modules/.bun/@logtape+logtape@2.1.1/node_modules/@logtape/logtape/dist/context.js
|
|
44770
44828
|
var categoryPrefixSymbol = Symbol.for("logtape.categoryPrefix");
|
|
@@ -46537,7 +46595,7 @@ var ConfigError = class extends Error {
|
|
|
46537
46595
|
}
|
|
46538
46596
|
};
|
|
46539
46597
|
|
|
46540
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
46598
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/logger.js
|
|
46541
46599
|
var ROOT_CATEGORY = "app";
|
|
46542
46600
|
function toLogTapeLevel(level) {
|
|
46543
46601
|
return level === "warn" ? "warning" : level;
|
|
@@ -46584,10 +46642,10 @@ async function initializeLogger(options = {}) {
|
|
|
46584
46642
|
const lowestLevel = toLogTapeLevel(level);
|
|
46585
46643
|
const formatter = json2 ? getJsonLinesFormatter() : getTextFormatter();
|
|
46586
46644
|
const sinks = {};
|
|
46587
|
-
if (enableConsole) {
|
|
46645
|
+
if (!muted && enableConsole) {
|
|
46588
46646
|
sinks.console = getConsoleSink({ formatter });
|
|
46589
46647
|
}
|
|
46590
|
-
if (fileSink) {
|
|
46648
|
+
if (!muted && fileSink) {
|
|
46591
46649
|
sinks.file = (record2) => {
|
|
46592
46650
|
fileSink(formatter(record2));
|
|
46593
46651
|
};
|
|
@@ -46607,10 +46665,10 @@ async function initializeLogger(options = {}) {
|
|
|
46607
46665
|
}
|
|
46608
46666
|
}
|
|
46609
46667
|
|
|
46610
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
46668
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
|
|
46611
46669
|
var import_api2 = __toESM(require_src(), 1);
|
|
46612
46670
|
|
|
46613
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
46671
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/telemetry/sdk.js
|
|
46614
46672
|
var import_api = __toESM(require_src(), 1);
|
|
46615
46673
|
var CONFIG_DEFAULTS = {
|
|
46616
46674
|
enabled: true,
|
|
@@ -46643,7 +46701,7 @@ function getTracer() {
|
|
|
46643
46701
|
return import_api.trace.getTracer(TRACER_NAME, TRACER_VERSION);
|
|
46644
46702
|
}
|
|
46645
46703
|
|
|
46646
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
46704
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
|
|
46647
46705
|
async function traceAsync(name, fn, options, tracer2) {
|
|
46648
46706
|
const resolvedTracer = tracer2 ?? getTracer();
|
|
46649
46707
|
return resolvedTracer.startActiveSpan(name, options ?? {}, async (span) => {
|
|
@@ -46670,7 +46728,7 @@ function addSpanEvent(name, attributes) {
|
|
|
46670
46728
|
}
|
|
46671
46729
|
}
|
|
46672
46730
|
|
|
46673
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
46731
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/telemetry/metrics.js
|
|
46674
46732
|
var import_api3 = __toESM(require_src(), 1);
|
|
46675
46733
|
var metricsInitialized = false;
|
|
46676
46734
|
var METER_NAME = "@gobing-ai/ts-infra";
|
|
@@ -46752,7 +46810,7 @@ function shutdownMetrics() {
|
|
|
46752
46810
|
return Promise.resolve();
|
|
46753
46811
|
}
|
|
46754
46812
|
|
|
46755
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
46813
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/event-bus/event-bus.js
|
|
46756
46814
|
var _busLogger;
|
|
46757
46815
|
function busLogger() {
|
|
46758
46816
|
if (!_busLogger)
|
|
@@ -46766,10 +46824,12 @@ class EventBus {
|
|
|
46766
46824
|
asyncHandlerIds = new WeakMap;
|
|
46767
46825
|
jobQueue;
|
|
46768
46826
|
lifecycleBus;
|
|
46827
|
+
logger;
|
|
46769
46828
|
nextAsyncHandlerId = 0;
|
|
46770
46829
|
constructor(opts) {
|
|
46771
46830
|
this.jobQueue = opts?.jobQueue ?? null;
|
|
46772
46831
|
this.lifecycleBus = opts?.lifecycleBus ?? null;
|
|
46832
|
+
this.logger = opts?.logger;
|
|
46773
46833
|
}
|
|
46774
46834
|
on(event, handler, opts) {
|
|
46775
46835
|
if (opts?.async) {
|
|
@@ -46816,6 +46876,11 @@ class EventBus {
|
|
|
46816
46876
|
let syncCount = 0;
|
|
46817
46877
|
let asyncCount = 0;
|
|
46818
46878
|
let errors5 = 0;
|
|
46879
|
+
this.logger?.debug("event.emit", {
|
|
46880
|
+
event: eventName,
|
|
46881
|
+
syncHandlers: this.syncHandlers.get(event)?.size ?? 0,
|
|
46882
|
+
asyncHandlers: this.asyncHandlers.get(event)?.size ?? 0
|
|
46883
|
+
});
|
|
46819
46884
|
const syncSet = this.syncHandlers.get(event);
|
|
46820
46885
|
if (syncSet) {
|
|
46821
46886
|
syncCount = syncSet.size;
|
|
@@ -46947,7 +47012,7 @@ class EventBus {
|
|
|
46947
47012
|
}
|
|
46948
47013
|
}
|
|
46949
47014
|
|
|
46950
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
47015
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/event-bus/default-observers.js
|
|
46951
47016
|
var _obsLogger;
|
|
46952
47017
|
function obsLogger() {
|
|
46953
47018
|
if (!_obsLogger)
|
|
@@ -47006,7 +47071,7 @@ function attachDefaultObservers(lifecycleBus) {
|
|
|
47006
47071
|
attachTelemetryObserver(lifecycleBus);
|
|
47007
47072
|
}
|
|
47008
47073
|
|
|
47009
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
47074
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
|
|
47010
47075
|
class NoopSchedulerAdapter {
|
|
47011
47076
|
constructor() {}
|
|
47012
47077
|
register(_cron, _action) {}
|
|
@@ -47014,7 +47079,7 @@ class NoopSchedulerAdapter {
|
|
|
47014
47079
|
async stop() {}
|
|
47015
47080
|
}
|
|
47016
47081
|
|
|
47017
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
47082
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
|
|
47018
47083
|
function initScheduler(adapter, cronEntries) {
|
|
47019
47084
|
const resolved = adapter ?? new NoopSchedulerAdapter;
|
|
47020
47085
|
if (cronEntries) {
|
|
@@ -47025,7 +47090,7 @@ function initScheduler(adapter, cronEntries) {
|
|
|
47025
47090
|
return resolved;
|
|
47026
47091
|
}
|
|
47027
47092
|
|
|
47028
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
47093
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
|
|
47029
47094
|
function telemetryPlugin(config3) {
|
|
47030
47095
|
return {
|
|
47031
47096
|
name: "builtin:telemetry",
|
|
@@ -47115,7 +47180,7 @@ function dbPlugin(db2) {
|
|
|
47115
47180
|
};
|
|
47116
47181
|
}
|
|
47117
47182
|
|
|
47118
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
47183
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
|
|
47119
47184
|
class PluginHost {
|
|
47120
47185
|
logger;
|
|
47121
47186
|
events;
|
|
@@ -47201,7 +47266,7 @@ class PluginHost {
|
|
|
47201
47266
|
}
|
|
47202
47267
|
}
|
|
47203
47268
|
|
|
47204
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
47269
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/application/index.js
|
|
47205
47270
|
async function performShutdown(state, reason) {
|
|
47206
47271
|
if (state.stopped)
|
|
47207
47272
|
return;
|
|
@@ -47296,7 +47361,7 @@ async function runApplication(options) {
|
|
|
47296
47361
|
}
|
|
47297
47362
|
}
|
|
47298
47363
|
|
|
47299
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
47364
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/scheduler/node.js
|
|
47300
47365
|
function parseInterval(cron) {
|
|
47301
47366
|
const num = Number(cron);
|
|
47302
47367
|
if (!Number.isNaN(num))
|
|
@@ -47360,7 +47425,7 @@ class NodeSchedulerAdapter {
|
|
|
47360
47425
|
}
|
|
47361
47426
|
}
|
|
47362
47427
|
}
|
|
47363
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
47428
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
|
|
47364
47429
|
var import_api14 = __toESM(require_src(), 1);
|
|
47365
47430
|
|
|
47366
47431
|
// ../../node_modules/.bun/@opentelemetry+exporter-metrics-otlp-http@0.218.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/OTLPMetricExporterBase.js
|
|
@@ -50376,7 +50441,7 @@ class OTLPTraceExporter extends import_otlp_exporter_base2.OTLPExporterBase {
|
|
|
50376
50441
|
}), JsonTraceSerializer));
|
|
50377
50442
|
}
|
|
50378
50443
|
}
|
|
50379
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
50444
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
|
|
50380
50445
|
var import_resources2 = __toESM(require_src4(), 1);
|
|
50381
50446
|
var import_sdk_trace_node = __toESM(require_src8(), 1);
|
|
50382
50447
|
var import_semantic_conventions = __toESM(require_src2(), 1);
|
|
@@ -50427,7 +50492,7 @@ async function shutdownNodeTelemetry() {
|
|
|
50427
50492
|
await Promise.all(pending);
|
|
50428
50493
|
}
|
|
50429
50494
|
|
|
50430
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.
|
|
50495
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.3.10+b08a8f4cb39e7846/node_modules/@gobing-ai/ts-infra/dist/application-node.js
|
|
50431
50496
|
class ConfigValidationError extends Error {
|
|
50432
50497
|
constructor(message) {
|
|
50433
50498
|
super(message);
|
|
@@ -54197,7 +54262,7 @@ Font modified May 20, 2012 by patorjk to add the 0xCA0 character
|
|
|
54197
54262
|
import { stat } from "fs/promises";
|
|
54198
54263
|
import { isatty as isatty2 } from "tty";
|
|
54199
54264
|
|
|
54200
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54265
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
|
|
54201
54266
|
var claudeShim = {
|
|
54202
54267
|
name: "claude",
|
|
54203
54268
|
command: "claude",
|
|
@@ -54333,10 +54398,10 @@ function isAgentName(value) {
|
|
|
54333
54398
|
function getAgentShim(agent) {
|
|
54334
54399
|
return AGENT_SHIMS[agent];
|
|
54335
54400
|
}
|
|
54336
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54401
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
|
|
54337
54402
|
init_dist3();
|
|
54338
54403
|
|
|
54339
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54404
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
|
|
54340
54405
|
function buildIdentityPreamble(ctx) {
|
|
54341
54406
|
const sections = [
|
|
54342
54407
|
`You are agent \`${ctx.agentId}\` (${ctx.agentType}) in workspace \`${ctx.workspace}\`.`
|
|
@@ -54377,7 +54442,7 @@ function buildIdentityPreamble(ctx) {
|
|
|
54377
54442
|
`;
|
|
54378
54443
|
}
|
|
54379
54444
|
|
|
54380
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54445
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
|
|
54381
54446
|
var SLASH_COMMAND_RE = /^\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]+)(\s.*)?$/;
|
|
54382
54447
|
function isClaudeStyleSlashCommand(input) {
|
|
54383
54448
|
return SLASH_COMMAND_RE.test(input);
|
|
@@ -54401,7 +54466,7 @@ function translateSlashCommand(agent, input) {
|
|
|
54401
54466
|
}
|
|
54402
54467
|
}
|
|
54403
54468
|
|
|
54404
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54469
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
|
|
54405
54470
|
class AiRunner {
|
|
54406
54471
|
processExecutor;
|
|
54407
54472
|
defaultCwd;
|
|
@@ -54503,7 +54568,7 @@ function hasIdentityOptions(options) {
|
|
|
54503
54568
|
return options.purpose !== undefined || options.systemPrompt !== undefined || options.taskId !== undefined || options.peers !== undefined && options.peers.length > 0;
|
|
54504
54569
|
}
|
|
54505
54570
|
|
|
54506
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54571
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
|
|
54507
54572
|
var DEFAULT_TIMEOUT_MS = 5000;
|
|
54508
54573
|
var VERSION_PATTERN = /(?<version>\d+\.\d+(?:\.\d+)?)/;
|
|
54509
54574
|
|
|
@@ -54565,7 +54630,7 @@ function unavailable(name, error51) {
|
|
|
54565
54630
|
return { name, installed: false, version: null, channels: [], error: error51 };
|
|
54566
54631
|
}
|
|
54567
54632
|
|
|
54568
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54633
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
|
|
54569
54634
|
init_dist3();
|
|
54570
54635
|
|
|
54571
54636
|
class ValueError extends Error {
|
|
@@ -54660,7 +54725,7 @@ function requireRecord(source, key, fileName) {
|
|
|
54660
54725
|
return value;
|
|
54661
54726
|
}
|
|
54662
54727
|
|
|
54663
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54728
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
|
|
54664
54729
|
init_dist3();
|
|
54665
54730
|
var DEFAULT_TIMEOUT_MS2 = 5000;
|
|
54666
54731
|
var AUTH_PATTERNS = {
|
|
@@ -54779,12 +54844,12 @@ ${result.stderr}`;
|
|
|
54779
54844
|
}
|
|
54780
54845
|
}
|
|
54781
54846
|
|
|
54782
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54847
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
|
|
54783
54848
|
function formatMessage(msg) {
|
|
54784
54849
|
return `[task from=${msg.fromId ?? "operator"} id=${msg.id}] ${msg.body}`;
|
|
54785
54850
|
}
|
|
54786
54851
|
|
|
54787
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54852
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
|
|
54788
54853
|
import { Buffer as Buffer5 } from "buffer";
|
|
54789
54854
|
init_dist3();
|
|
54790
54855
|
|
|
@@ -54915,7 +54980,7 @@ class TeamAgentProcess {
|
|
|
54915
54980
|
}
|
|
54916
54981
|
}
|
|
54917
54982
|
|
|
54918
|
-
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.
|
|
54983
|
+
// ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.3.10+fbd66d84c9f9ab42/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
|
|
54919
54984
|
class TeamOrchestrator {
|
|
54920
54985
|
configDir;
|
|
54921
54986
|
inbox;
|
|
@@ -55419,11 +55484,11 @@ function etlToCostRecord(payload, source) {
|
|
|
55419
55484
|
costUsd: 0
|
|
55420
55485
|
};
|
|
55421
55486
|
}
|
|
55422
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
55487
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/index.js
|
|
55423
55488
|
init_sqlite_core();
|
|
55424
55489
|
init_common3();
|
|
55425
55490
|
|
|
55426
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
55491
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
|
|
55427
55492
|
init_sqlite_core();
|
|
55428
55493
|
|
|
55429
55494
|
// ../../node_modules/.bun/drizzle-orm@0.38.4+a0473b45aab9bf33/node_modules/drizzle-orm/mysql-core/columns/common.js
|
|
@@ -55534,10 +55599,10 @@ function p(e) {
|
|
|
55534
55599
|
return m2 || (m2 = exports_external.any()), m2;
|
|
55535
55600
|
}
|
|
55536
55601
|
|
|
55537
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
55602
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
|
|
55538
55603
|
init_sqlite_core();
|
|
55539
55604
|
|
|
55540
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
55605
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
|
|
55541
55606
|
function sqlExpressionToText(value) {
|
|
55542
55607
|
if (typeof value !== "object" || value === null || !("queryChunks" in value)) {
|
|
55543
55608
|
return;
|
|
@@ -55560,7 +55625,7 @@ function getDrizzleTableName(table2) {
|
|
|
55560
55625
|
return String(table2[nameSym]);
|
|
55561
55626
|
}
|
|
55562
55627
|
|
|
55563
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
55628
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
|
|
55564
55629
|
function quoteIdent(name) {
|
|
55565
55630
|
return `"${name.replace(/"/g, '""')}"`;
|
|
55566
55631
|
}
|
|
@@ -55651,7 +55716,7 @@ function generateCreateTableSql(table2) {
|
|
|
55651
55716
|
)`;
|
|
55652
55717
|
}
|
|
55653
55718
|
|
|
55654
|
-
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.
|
|
55719
|
+
// ../../node_modules/.bun/@gobing-ai+ts-db@0.3.10+30cfa7dfb09a2dc3/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
|
|
55655
55720
|
function defineTable(name, columns2) {
|
|
55656
55721
|
const table2 = sqliteTable(name, columns2);
|
|
55657
55722
|
let insert2;
|
|
@@ -55769,10 +55834,10 @@ var workflowStates = workflowStatesTable.table;
|
|
|
55769
55834
|
import { readdir as readdir2 } from "fs/promises";
|
|
55770
55835
|
import { join as join2 } from "path";
|
|
55771
55836
|
|
|
55772
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
55837
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
|
|
55773
55838
|
init_dist3();
|
|
55774
55839
|
|
|
55775
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
55840
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/errors.js
|
|
55776
55841
|
class WorkflowValidationError extends Error {
|
|
55777
55842
|
details;
|
|
55778
55843
|
constructor(message, details) {
|
|
@@ -55798,7 +55863,7 @@ class RunCollisionError extends Error {
|
|
|
55798
55863
|
}
|
|
55799
55864
|
}
|
|
55800
55865
|
|
|
55801
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
55866
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/run-lifecycle.js
|
|
55802
55867
|
init_dist3();
|
|
55803
55868
|
var RUNTIME_BUILTIN_KEYS = [
|
|
55804
55869
|
"workflow",
|
|
@@ -55859,13 +55924,11 @@ class RunLifecycle {
|
|
|
55859
55924
|
await this.persistence.savePhase(this.runId, stateOrNodeId, "running");
|
|
55860
55925
|
addSpanEvent("workflow.node.enter", { node: stateOrNodeId, transitionsTaken });
|
|
55861
55926
|
this.events?.emit("workflow.node.enter", { node: stateOrNodeId, transitionsTaken });
|
|
55862
|
-
this.logger.debug("entered", { node: stateOrNodeId, transitionsTaken });
|
|
55863
55927
|
}
|
|
55864
55928
|
async recordTransition(from, to, trigger) {
|
|
55865
55929
|
await this.persistence.saveTransition(this.runId, from, to, trigger);
|
|
55866
55930
|
addSpanEvent("workflow.node.transition", { from, to, ...trigger === null ? {} : { trigger } });
|
|
55867
55931
|
this.events?.emit("workflow.node.transition", { from, to, trigger });
|
|
55868
|
-
this.logger.debug("transition", { from, to, trigger });
|
|
55869
55932
|
}
|
|
55870
55933
|
async done(finalState, transitionsTaken) {
|
|
55871
55934
|
await this.persistence.savePhase(this.runId, finalState, "done");
|
|
@@ -55928,7 +55991,7 @@ class RunLifecycle {
|
|
|
55928
55991
|
}
|
|
55929
55992
|
}
|
|
55930
55993
|
|
|
55931
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
55994
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema.js
|
|
55932
55995
|
init_zod();
|
|
55933
55996
|
var RESERVED_VAR_NAMES = new Set(["task", "state", "node", "iteration", "run", "runtime"]);
|
|
55934
55997
|
var IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -56007,7 +56070,7 @@ var TransitionFlowWorkflowDefSchema = exports_external.object({
|
|
|
56007
56070
|
}).strict();
|
|
56008
56071
|
var WorkflowDefSchema = exports_external.union([StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema]);
|
|
56009
56072
|
|
|
56010
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56073
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
|
|
56011
56074
|
async function loadWorkflowDef(path8, options = {}) {
|
|
56012
56075
|
return parseWorkflowDef(await loadStructuredConfig(path8, options), path8);
|
|
56013
56076
|
}
|
|
@@ -56158,10 +56221,10 @@ function throwIfErrors(workflow, errors5) {
|
|
|
56158
56221
|
throw new WorkflowValidationError(`Workflow "${workflow.name}" is invalid: ${errors5.join("; ")}`, errors5);
|
|
56159
56222
|
}
|
|
56160
56223
|
}
|
|
56161
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56224
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
|
|
56162
56225
|
init_dist3();
|
|
56163
56226
|
|
|
56164
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
56227
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/extension/capability-registry.js
|
|
56165
56228
|
class CapabilityRegistry {
|
|
56166
56229
|
kind;
|
|
56167
56230
|
capabilities = new Map;
|
|
@@ -56192,7 +56255,7 @@ class CapabilityRegistry {
|
|
|
56192
56255
|
}
|
|
56193
56256
|
}
|
|
56194
56257
|
|
|
56195
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.
|
|
56258
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.10/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-path.js
|
|
56196
56259
|
function assertRelativeExtensionPath(path8, options = {}) {
|
|
56197
56260
|
const where = options.sourceName !== undefined ? ` declared by "${options.sourceName}"` : "";
|
|
56198
56261
|
if (/^([/\\]|[A-Za-z]:[/\\])/.test(path8)) {
|
|
@@ -56203,7 +56266,7 @@ function assertRelativeExtensionPath(path8, options = {}) {
|
|
|
56203
56266
|
}
|
|
56204
56267
|
}
|
|
56205
56268
|
|
|
56206
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56269
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
|
|
56207
56270
|
class WorkflowEngineHost {
|
|
56208
56271
|
actions = new CapabilityRegistry("workflow action");
|
|
56209
56272
|
guards = new CapabilityRegistry("workflow guard");
|
|
@@ -56248,6 +56311,7 @@ function createDefaultWorkflowEngineHost(options = {}) {
|
|
|
56248
56311
|
const host = new WorkflowEngineHost;
|
|
56249
56312
|
host.registerAction(new NoteActionRunner, "builtin");
|
|
56250
56313
|
host.registerAction(new ShellActionRunner(options.processExecutor ?? new NodeProcessExecutor), "builtin");
|
|
56314
|
+
host.registerAction(new EventEmitActionRunner, "builtin");
|
|
56251
56315
|
host.registerGuard({ kind: "always", evaluate: async () => true }, "builtin");
|
|
56252
56316
|
host.registerGuard({ kind: "never", evaluate: async () => false }, "builtin");
|
|
56253
56317
|
host.registerGuard({
|
|
@@ -56259,8 +56323,22 @@ function createDefaultWorkflowEngineHost(options = {}) {
|
|
|
56259
56323
|
|
|
56260
56324
|
class NoteActionRunner {
|
|
56261
56325
|
kind = "note";
|
|
56262
|
-
async execute(options) {
|
|
56263
|
-
|
|
56326
|
+
async execute(options, context3) {
|
|
56327
|
+
const message = String(options.message ?? "");
|
|
56328
|
+
context3?.events?.emit("workflow.hitl.note", { node: context3.stateOrNodeId, message });
|
|
56329
|
+
return { ok: true, data: { message } };
|
|
56330
|
+
}
|
|
56331
|
+
}
|
|
56332
|
+
|
|
56333
|
+
class EventEmitActionRunner {
|
|
56334
|
+
kind = "event.emit";
|
|
56335
|
+
async execute(options, context3) {
|
|
56336
|
+
const name = String(options.name ?? "");
|
|
56337
|
+
if (!name)
|
|
56338
|
+
return { ok: false, error: 'event.emit requires a non-empty "name" option' };
|
|
56339
|
+
const payload = options.payload ?? {};
|
|
56340
|
+
context3?.events?.emit("workflow.custom", { name, payload });
|
|
56341
|
+
return { ok: true, data: { name, payload } };
|
|
56264
56342
|
}
|
|
56265
56343
|
}
|
|
56266
56344
|
|
|
@@ -56272,10 +56350,12 @@ class ShellActionRunner {
|
|
|
56272
56350
|
}
|
|
56273
56351
|
async execute(options, context3) {
|
|
56274
56352
|
const command = stringOption(options, "command");
|
|
56275
|
-
const
|
|
56353
|
+
const explicitArgs = arrayOption(options, "args");
|
|
56354
|
+
const usesShell = explicitArgs.length === 0;
|
|
56355
|
+
const spawn2 = usesShell ? { command: "/bin/sh", args: ["-c", command] } : { command, args: explicitArgs };
|
|
56276
56356
|
const result = await this.processExecutor.run({
|
|
56277
|
-
command,
|
|
56278
|
-
args,
|
|
56357
|
+
command: spawn2.command,
|
|
56358
|
+
args: spawn2.args,
|
|
56279
56359
|
cwd: stringOption(options, "cwd", context3.workdir),
|
|
56280
56360
|
rejectOnError: false,
|
|
56281
56361
|
forceBuffered: true
|
|
@@ -56303,7 +56383,7 @@ function arrayOption(options, key) {
|
|
|
56303
56383
|
return value;
|
|
56304
56384
|
throw new WorkflowValidationError(`Action option "${key}" must be a string array`);
|
|
56305
56385
|
}
|
|
56306
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56386
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema-sql.js
|
|
56307
56387
|
var WORKFLOW_ENGINE_SCHEMA_SQL = `
|
|
56308
56388
|
CREATE TABLE IF NOT EXISTS runs (
|
|
56309
56389
|
id TEXT PRIMARY KEY,
|
|
@@ -56353,7 +56433,7 @@ CREATE TABLE IF NOT EXISTS workflow_states (
|
|
|
56353
56433
|
);
|
|
56354
56434
|
`.trim();
|
|
56355
56435
|
|
|
56356
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56436
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/persistence.js
|
|
56357
56437
|
async function applyWorkflowEngineSchema(db2) {
|
|
56358
56438
|
for (const statement of WORKFLOW_ENGINE_SCHEMA_SQL.split(";")) {
|
|
56359
56439
|
const sql3 = statement.trim();
|
|
@@ -56435,11 +56515,21 @@ class MemoryWorkflowPersistenceAdapter {
|
|
|
56435
56515
|
return [...this.runs.values()];
|
|
56436
56516
|
}
|
|
56437
56517
|
}
|
|
56438
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56518
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/variables.js
|
|
56439
56519
|
var TEMPLATE_REF = /\$\{([^}]+)\}/g;
|
|
56440
56520
|
function mergeVars(workflowVars = {}, overrideVars = {}) {
|
|
56441
56521
|
return { ...workflowVars, ...overrideVars };
|
|
56442
56522
|
}
|
|
56523
|
+
function mergeSetVars(vars, setVars) {
|
|
56524
|
+
if (setVars === undefined)
|
|
56525
|
+
return vars;
|
|
56526
|
+
const filtered = {};
|
|
56527
|
+
for (const [key, value] of Object.entries(setVars)) {
|
|
56528
|
+
if (typeof value === "string")
|
|
56529
|
+
filtered[key] = value;
|
|
56530
|
+
}
|
|
56531
|
+
return mergeVars(vars, filtered);
|
|
56532
|
+
}
|
|
56443
56533
|
function resolveTemplates(value, context3) {
|
|
56444
56534
|
if (typeof value === "string") {
|
|
56445
56535
|
return resolveTemplateString(value, context3);
|
|
@@ -56481,7 +56571,7 @@ function resolveOnErrorPolicy(actionOnError, workflowDefault, runOptionOverride)
|
|
|
56481
56571
|
return actionOnError ?? workflowDefault ?? runOptionOverride ?? "fail";
|
|
56482
56572
|
}
|
|
56483
56573
|
|
|
56484
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56574
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/state-machine.js
|
|
56485
56575
|
class StateMachineDriver {
|
|
56486
56576
|
options;
|
|
56487
56577
|
constructor(options) {
|
|
@@ -56494,7 +56584,7 @@ class StateMachineDriver {
|
|
|
56494
56584
|
const runId = lifecycle.runId;
|
|
56495
56585
|
const states = new Map(workflow.states.map((state) => [state.id, state]));
|
|
56496
56586
|
const terminal = new Set(workflow.terminalStates ?? []);
|
|
56497
|
-
|
|
56587
|
+
let vars = mergeVars(workflow.vars, options.vars);
|
|
56498
56588
|
const env = allowedEnv(workflow.env?.allow ?? [], options.env);
|
|
56499
56589
|
let current = states.get(workflow.initialState);
|
|
56500
56590
|
let transitionsTaken = 0;
|
|
@@ -56508,6 +56598,8 @@ class StateMachineDriver {
|
|
|
56508
56598
|
const enter = await this.runActions(current.onEnter ?? [], workflow.name, current.id, runId, vars, env, options, transitionsTaken, lifecycle, defaultOnError);
|
|
56509
56599
|
if (enter.result !== undefined)
|
|
56510
56600
|
lastActionResult = enter.result;
|
|
56601
|
+
if (enter.result?.setVars)
|
|
56602
|
+
vars = mergeSetVars(vars, enter.result.setVars);
|
|
56511
56603
|
if (enter.outcome === "terminal") {
|
|
56512
56604
|
return await lifecycle.done(current.id, transitionsTaken);
|
|
56513
56605
|
}
|
|
@@ -56530,6 +56622,8 @@ class StateMachineDriver {
|
|
|
56530
56622
|
const exit = await this.runActions(current.onExit ?? [], workflow.name, current.id, runId, vars, env, options, transitionsTaken, lifecycle, defaultOnError);
|
|
56531
56623
|
if (exit.result !== undefined)
|
|
56532
56624
|
lastActionResult = exit.result;
|
|
56625
|
+
if (exit.result?.setVars)
|
|
56626
|
+
vars = mergeSetVars(vars, exit.result.setVars);
|
|
56533
56627
|
if (exit.outcome === "fail")
|
|
56534
56628
|
return await lifecycle.fail(current.id, transitionsTaken, exit.result?.error);
|
|
56535
56629
|
transitionsTaken += 1;
|
|
@@ -56560,7 +56654,8 @@ class StateMachineDriver {
|
|
|
56560
56654
|
stateOrNodeId: stateId,
|
|
56561
56655
|
vars,
|
|
56562
56656
|
env,
|
|
56563
|
-
metadata: options.metadata
|
|
56657
|
+
metadata: options.metadata,
|
|
56658
|
+
events: options.events
|
|
56564
56659
|
});
|
|
56565
56660
|
} finally {
|
|
56566
56661
|
lifecycle.actionDone(stateId, action.kind, Date.now() - actionStartMs, last?.ok ?? false);
|
|
@@ -56587,7 +56682,7 @@ async function firstPassingTransition(transitions, host, context3) {
|
|
|
56587
56682
|
return;
|
|
56588
56683
|
}
|
|
56589
56684
|
|
|
56590
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56685
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/transition-flow.js
|
|
56591
56686
|
class TransitionFlowDriver {
|
|
56592
56687
|
options;
|
|
56593
56688
|
constructor(options) {
|
|
@@ -56600,7 +56695,7 @@ class TransitionFlowDriver {
|
|
|
56600
56695
|
const runId = lifecycle.runId;
|
|
56601
56696
|
const nodes = new Map(workflow.nodes.map((node) => [node.id, node]));
|
|
56602
56697
|
const terminal = new Set(workflow.terminalNodes ?? []);
|
|
56603
|
-
|
|
56698
|
+
let vars = mergeVars(workflow.vars, options.vars);
|
|
56604
56699
|
const env = allowedEnv(workflow.env?.allow ?? [], options.env);
|
|
56605
56700
|
let current = nodes.get(workflow.initialNode);
|
|
56606
56701
|
let transitionsTaken = 0;
|
|
@@ -56627,11 +56722,14 @@ class TransitionFlowDriver {
|
|
|
56627
56722
|
stateOrNodeId: current.id,
|
|
56628
56723
|
vars,
|
|
56629
56724
|
env,
|
|
56630
|
-
metadata: options.metadata
|
|
56725
|
+
metadata: options.metadata,
|
|
56726
|
+
events: options.events
|
|
56631
56727
|
});
|
|
56632
56728
|
} finally {
|
|
56633
56729
|
lifecycle.actionDone(current.id, current.action.kind, Date.now() - actionStartMs, lastActionResult?.ok ?? false);
|
|
56634
56730
|
}
|
|
56731
|
+
if (lastActionResult.setVars)
|
|
56732
|
+
vars = mergeSetVars(vars, lastActionResult.setVars);
|
|
56635
56733
|
if (!lastActionResult.ok) {
|
|
56636
56734
|
const policy = resolveOnErrorPolicy(current.action.onError, defaultOnError, options.onError);
|
|
56637
56735
|
if (policy === "fail") {
|
|
@@ -56678,7 +56776,7 @@ async function firstPassingEdge(edges, host, context3) {
|
|
|
56678
56776
|
return;
|
|
56679
56777
|
}
|
|
56680
56778
|
|
|
56681
|
-
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.
|
|
56779
|
+
// ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.3.10+3f1a4ed45f5d8e5a/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/service.js
|
|
56682
56780
|
class WorkflowService {
|
|
56683
56781
|
host;
|
|
56684
56782
|
persistence;
|
|
@@ -56702,10 +56800,10 @@ class WorkflowService {
|
|
|
56702
56800
|
return await this.persistence.listRuns();
|
|
56703
56801
|
}
|
|
56704
56802
|
}
|
|
56705
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.
|
|
56803
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.10+7d2c76e58a76f847/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
|
|
56706
56804
|
init_dist3();
|
|
56707
56805
|
|
|
56708
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.
|
|
56806
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.10+7d2c76e58a76f847/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/errors.js
|
|
56709
56807
|
class HistoryImportError extends Error {
|
|
56710
56808
|
details;
|
|
56711
56809
|
constructor(message, details) {
|
|
@@ -56715,7 +56813,7 @@ class HistoryImportError extends Error {
|
|
|
56715
56813
|
}
|
|
56716
56814
|
}
|
|
56717
56815
|
|
|
56718
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.
|
|
56816
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.10+7d2c76e58a76f847/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/hash.js
|
|
56719
56817
|
import { createHash } from "crypto";
|
|
56720
56818
|
function stableJson(value) {
|
|
56721
56819
|
if (Array.isArray(value)) {
|
|
@@ -56731,7 +56829,7 @@ function sha256(value) {
|
|
|
56731
56829
|
return createHash("sha256").update(stableJson(value)).digest("hex");
|
|
56732
56830
|
}
|
|
56733
56831
|
|
|
56734
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.
|
|
56832
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.10+7d2c76e58a76f847/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
|
|
56735
56833
|
var DEFAULT_REDACTION_RULES = [
|
|
56736
56834
|
{
|
|
56737
56835
|
name: "api-key",
|
|
@@ -56765,7 +56863,7 @@ function redactRecord(record2, rules = DEFAULT_REDACTION_RULES) {
|
|
|
56765
56863
|
return redactValue(record2, rules);
|
|
56766
56864
|
}
|
|
56767
56865
|
|
|
56768
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.
|
|
56866
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.10+7d2c76e58a76f847/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/schema-sql.js
|
|
56769
56867
|
var HISTORY_IMPORT_SCHEMA_SQL = `
|
|
56770
56868
|
CREATE TABLE IF NOT EXISTS history_import_checkpoint (
|
|
56771
56869
|
source TEXT NOT NULL,
|
|
@@ -56849,7 +56947,7 @@ CREATE TABLE IF NOT EXISTS history_etl_openclaw (
|
|
|
56849
56947
|
);
|
|
56850
56948
|
`.trim();
|
|
56851
56949
|
|
|
56852
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.
|
|
56950
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.10+7d2c76e58a76f847/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/sources.js
|
|
56853
56951
|
init_zod();
|
|
56854
56952
|
var sourceRecordSchema = exports_external.object({
|
|
56855
56953
|
source_record_id: exports_external.string().min(1),
|
|
@@ -56934,7 +57032,7 @@ function getSourceDefinition(source) {
|
|
|
56934
57032
|
return SOURCE_DEFINITIONS[source];
|
|
56935
57033
|
}
|
|
56936
57034
|
|
|
56937
|
-
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.
|
|
57035
|
+
// ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.3.10+7d2c76e58a76f847/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
|
|
56938
57036
|
var VALID_TABLE_NAME = /^history_etl_[a-z_]+$/;
|
|
56939
57037
|
async function applyHistoryImportSchema(db2) {
|
|
56940
57038
|
for (const statement of HISTORY_IMPORT_SCHEMA_SQL.split(";")) {
|
|
@@ -57387,7 +57485,7 @@ function buildConfigFromEnv(env = process.env) {
|
|
|
57387
57485
|
});
|
|
57388
57486
|
}
|
|
57389
57487
|
|
|
57390
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
57488
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
|
|
57391
57489
|
init_dist3();
|
|
57392
57490
|
function collectExtensions(sourceName, sourceDir, extensions) {
|
|
57393
57491
|
if (extensions === undefined)
|
|
@@ -57401,10 +57499,10 @@ function collectExtensions(sourceName, sourceDir, extensions) {
|
|
|
57401
57499
|
return refs;
|
|
57402
57500
|
}
|
|
57403
57501
|
|
|
57404
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
57502
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
|
|
57405
57503
|
init_dist3();
|
|
57406
57504
|
|
|
57407
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
57505
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
|
|
57408
57506
|
init_zod();
|
|
57409
57507
|
var SEVERITY_RANK = {
|
|
57410
57508
|
error: 3,
|
|
@@ -57471,7 +57569,7 @@ var PresetDefinitionSchema = exports_external.object({
|
|
|
57471
57569
|
extensions: ExtensionsSchema.optional()
|
|
57472
57570
|
});
|
|
57473
57571
|
|
|
57474
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
57572
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
|
|
57475
57573
|
async function loadPreset(name, options) {
|
|
57476
57574
|
const merged = await buildMergedRoots(options.roots.map((root) => resolvePath2(root)));
|
|
57477
57575
|
const presetPath = findMergedPreset(merged, name);
|
|
@@ -57681,10 +57779,10 @@ function normalizeRule(rule, _sourceDir) {
|
|
|
57681
57779
|
};
|
|
57682
57780
|
}
|
|
57683
57781
|
|
|
57684
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
57782
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
|
|
57685
57783
|
init_dist3();
|
|
57686
57784
|
|
|
57687
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
57785
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
|
|
57688
57786
|
init_dist3();
|
|
57689
57787
|
var realFileSystem = new NodeFileSystem;
|
|
57690
57788
|
function normalizeFindingPath(filePath) {
|
|
@@ -57746,7 +57844,7 @@ class TestStubFixer {
|
|
|
57746
57844
|
}
|
|
57747
57845
|
}
|
|
57748
57846
|
|
|
57749
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
57847
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
|
|
57750
57848
|
var FIX_MODE_RANK = {
|
|
57751
57849
|
none: 0,
|
|
57752
57850
|
suggest: 1,
|
|
@@ -57946,7 +58044,7 @@ function getLineRange(source, oneBasedLine) {
|
|
|
57946
58044
|
return { start, end: newline === -1 ? source.length : newline };
|
|
57947
58045
|
}
|
|
57948
58046
|
|
|
57949
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58047
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
|
|
57950
58048
|
init_dist3();
|
|
57951
58049
|
var DEFAULT_EXCLUDES = new Set([".git", "node_modules", "dist", ".coverage", ".astro", ".wrangler"]);
|
|
57952
58050
|
async function discoverFiles2(options) {
|
|
@@ -58049,7 +58147,7 @@ function parseInlineFlags(source) {
|
|
|
58049
58147
|
return { flags, rest: source.slice(match[0].length) };
|
|
58050
58148
|
}
|
|
58051
58149
|
|
|
58052
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58150
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
|
|
58053
58151
|
class AgentDetectionEvaluator {
|
|
58054
58152
|
detector;
|
|
58055
58153
|
constructor(detector = new AgentDetector) {
|
|
@@ -58072,7 +58170,7 @@ class AgentDetectionEvaluator {
|
|
|
58072
58170
|
}
|
|
58073
58171
|
}
|
|
58074
58172
|
|
|
58075
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58173
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
|
|
58076
58174
|
init_dist3();
|
|
58077
58175
|
class CoverageGateEvaluator {
|
|
58078
58176
|
fs;
|
|
@@ -58154,7 +58252,7 @@ function normalizeLcovSourcePath(workdir, filePath) {
|
|
|
58154
58252
|
return normalized.replaceAll("\\", "/");
|
|
58155
58253
|
}
|
|
58156
58254
|
|
|
58157
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58255
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
|
|
58158
58256
|
init_dist3();
|
|
58159
58257
|
class ExitCodeEvaluator {
|
|
58160
58258
|
executor;
|
|
@@ -58186,7 +58284,7 @@ class ExitCodeEvaluator {
|
|
|
58186
58284
|
}
|
|
58187
58285
|
}
|
|
58188
58286
|
|
|
58189
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58287
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
|
|
58190
58288
|
class ForbiddenImportEvaluator {
|
|
58191
58289
|
async evaluate(rule, context3) {
|
|
58192
58290
|
const config3 = rule.evaluator.config ?? {};
|
|
@@ -58258,7 +58356,7 @@ function compileEntry(entry) {
|
|
|
58258
58356
|
return { regex: new RegExp(entry.pattern), label: entry.pattern };
|
|
58259
58357
|
}
|
|
58260
58358
|
|
|
58261
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58359
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
|
|
58262
58360
|
class ImportBoundaryEvaluator {
|
|
58263
58361
|
async evaluate(rule, context3) {
|
|
58264
58362
|
const config3 = rule.evaluator.config ?? {};
|
|
@@ -58345,7 +58443,7 @@ function isStringArray(value) {
|
|
|
58345
58443
|
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
58346
58444
|
}
|
|
58347
58445
|
|
|
58348
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58446
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
|
|
58349
58447
|
init_dist3();
|
|
58350
58448
|
class PathEvaluator {
|
|
58351
58449
|
fs;
|
|
@@ -58403,7 +58501,7 @@ class PathEvaluator {
|
|
|
58403
58501
|
}
|
|
58404
58502
|
}
|
|
58405
58503
|
|
|
58406
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58504
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
|
|
58407
58505
|
class RegexEvaluator {
|
|
58408
58506
|
constructor() {}
|
|
58409
58507
|
async evaluate(rule, context3) {
|
|
@@ -58474,7 +58572,7 @@ function lineForOffset(content, offset) {
|
|
|
58474
58572
|
return line;
|
|
58475
58573
|
}
|
|
58476
58574
|
|
|
58477
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58575
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
|
|
58478
58576
|
init_dist3();
|
|
58479
58577
|
class RipgrepEvaluator {
|
|
58480
58578
|
executor;
|
|
@@ -58558,7 +58656,7 @@ function requireFindings(rule, pattern, stdout) {
|
|
|
58558
58656
|
return findings;
|
|
58559
58657
|
}
|
|
58560
58658
|
|
|
58561
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58659
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
|
|
58562
58660
|
init_dist3();
|
|
58563
58661
|
class SchemaArtifactEvaluator {
|
|
58564
58662
|
fs;
|
|
@@ -58634,7 +58732,7 @@ class SchemaArtifactEvaluator {
|
|
|
58634
58732
|
}
|
|
58635
58733
|
}
|
|
58636
58734
|
|
|
58637
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58735
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
|
|
58638
58736
|
var ASSIGN = "\\s*[=:]\\s*";
|
|
58639
58737
|
var QUOTED = (body) => `["'\`]${body}["'\`]`;
|
|
58640
58738
|
var keyworded = (keywords, value) => `(?i)(${keywords})${ASSIGN}${QUOTED(value)}`;
|
|
@@ -58699,7 +58797,7 @@ function compile(source) {
|
|
|
58699
58797
|
return new RegExp(rest, flags);
|
|
58700
58798
|
}
|
|
58701
58799
|
|
|
58702
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58800
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
|
|
58703
58801
|
init_dist3();
|
|
58704
58802
|
class SgEvaluator {
|
|
58705
58803
|
executor;
|
|
@@ -58792,7 +58890,7 @@ function parseSgJson(stdout) {
|
|
|
58792
58890
|
return results;
|
|
58793
58891
|
}
|
|
58794
58892
|
|
|
58795
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58893
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
|
|
58796
58894
|
class TypeScriptTestPathResolver {
|
|
58797
58895
|
name = "typescript";
|
|
58798
58896
|
constructor() {}
|
|
@@ -58875,7 +58973,7 @@ function testify(rel) {
|
|
|
58875
58973
|
return `${dir}test_${base2}`;
|
|
58876
58974
|
}
|
|
58877
58975
|
|
|
58878
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
58976
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
|
|
58879
58977
|
class TestLocationEvaluator {
|
|
58880
58978
|
resolvers;
|
|
58881
58979
|
constructor(resolvers) {
|
|
@@ -58943,7 +59041,7 @@ class TestLocationEvaluator {
|
|
|
58943
59041
|
}
|
|
58944
59042
|
var TYPESCRIPT_FALLBACK = new TypeScriptTestPathResolver;
|
|
58945
59043
|
|
|
58946
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
59044
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
|
|
58947
59045
|
var VALID_KINDS = ["function", "class", "type", "const", "enum", "interface"];
|
|
58948
59046
|
var KIND_PATTERN = {
|
|
58949
59047
|
function: /^export\s+(?:default\s+)?(?:async\s+)?function\s*\*?\s+([A-Za-z0-9_$]+)/,
|
|
@@ -59012,7 +59110,7 @@ function precededByJsdoc(lines, declarationLine) {
|
|
|
59012
59110
|
return false;
|
|
59013
59111
|
}
|
|
59014
59112
|
|
|
59015
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
59113
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
|
|
59016
59114
|
class JsonFormatter {
|
|
59017
59115
|
constructor() {}
|
|
59018
59116
|
format(result) {
|
|
@@ -59020,7 +59118,7 @@ class JsonFormatter {
|
|
|
59020
59118
|
}
|
|
59021
59119
|
}
|
|
59022
59120
|
|
|
59023
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
59121
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
|
|
59024
59122
|
class TextFormatter {
|
|
59025
59123
|
constructor() {}
|
|
59026
59124
|
format(result) {
|
|
@@ -59034,7 +59132,7 @@ class TextFormatter {
|
|
|
59034
59132
|
}
|
|
59035
59133
|
}
|
|
59036
59134
|
|
|
59037
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
59135
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
|
|
59038
59136
|
function registerBuiltins(host, executor) {
|
|
59039
59137
|
const path8 = new PathEvaluator;
|
|
59040
59138
|
host.evaluators.register("regex", new RegexEvaluator, "builtin");
|
|
@@ -59059,7 +59157,7 @@ function registerBuiltins(host, executor) {
|
|
|
59059
59157
|
host.formatters.register("json", new JsonFormatter, "builtin");
|
|
59060
59158
|
}
|
|
59061
59159
|
|
|
59062
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
59160
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
|
|
59063
59161
|
class RuleEngineHost {
|
|
59064
59162
|
evaluators;
|
|
59065
59163
|
formatters;
|
|
@@ -59073,7 +59171,7 @@ class RuleEngineHost {
|
|
|
59073
59171
|
}
|
|
59074
59172
|
}
|
|
59075
59173
|
|
|
59076
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
59174
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
|
|
59077
59175
|
class RuleEngine {
|
|
59078
59176
|
host;
|
|
59079
59177
|
events;
|
|
@@ -59196,7 +59294,7 @@ function effectiveFixMode(ruleMode, requestedMode) {
|
|
|
59196
59294
|
return FIX_MODE_RANK[ruleMode] <= FIX_MODE_RANK[requestedMode] ? ruleMode : requestedMode;
|
|
59197
59295
|
}
|
|
59198
59296
|
|
|
59199
|
-
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.
|
|
59297
|
+
// ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.3.10+723de5bf5f5fc534/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
|
|
59200
59298
|
init_dist3();
|
|
59201
59299
|
var BUNDLED_RULES_DIR = "rules";
|
|
59202
59300
|
var cachedRoot2;
|
|
@@ -59891,6 +59989,528 @@ ${nextBody}
|
|
|
59891
59989
|
// ../../packages/app/src/services/workflow-service.ts
|
|
59892
59990
|
import { access as access2 } from "fs/promises";
|
|
59893
59991
|
import { resolve as resolve2 } from "path";
|
|
59992
|
+
|
|
59993
|
+
// ../../packages/app/src/workflow/builtins.ts
|
|
59994
|
+
init_dist3();
|
|
59995
|
+
|
|
59996
|
+
// ../../packages/app/src/workflow/actions/agent-run.ts
|
|
59997
|
+
var KIND = "agent.run";
|
|
59998
|
+
|
|
59999
|
+
class AgentRunActionRunner {
|
|
60000
|
+
kind = KIND;
|
|
60001
|
+
agentService;
|
|
60002
|
+
constructor(agentService) {
|
|
60003
|
+
this.agentService = agentService;
|
|
60004
|
+
}
|
|
60005
|
+
async execute(options, context3) {
|
|
60006
|
+
const input = asOptionalString(options.input);
|
|
60007
|
+
const agent = asOptionalString(options.agent);
|
|
60008
|
+
const model = asOptionalString(options.model);
|
|
60009
|
+
const mode = asOptionalString(options.mode) ?? "text";
|
|
60010
|
+
const cwd = asOptionalString(options.cwd) ?? context3.workdir ?? ".";
|
|
60011
|
+
let continueFlag = asOptionalBoolean(options.continue);
|
|
60012
|
+
const latch = context3.vars.__agentSession;
|
|
60013
|
+
if (continueFlag === undefined && latch === "open") {
|
|
60014
|
+
continueFlag = true;
|
|
60015
|
+
}
|
|
60016
|
+
if (input === undefined && !continueFlag) {
|
|
60017
|
+
return {
|
|
60018
|
+
ok: false,
|
|
60019
|
+
error: `agent.run: input is required (use continue: true for resume-only, or provide a prompt)`
|
|
60020
|
+
};
|
|
60021
|
+
}
|
|
60022
|
+
const flags = {};
|
|
60023
|
+
if (agent !== undefined)
|
|
60024
|
+
flags.agent = agent;
|
|
60025
|
+
if (model !== undefined)
|
|
60026
|
+
flags.model = model;
|
|
60027
|
+
flags.mode = mode;
|
|
60028
|
+
if (cwd !== "")
|
|
60029
|
+
flags.cwd = cwd;
|
|
60030
|
+
if (continueFlag !== undefined)
|
|
60031
|
+
flags.continue = continueFlag;
|
|
60032
|
+
const exitCode = await this.agentService.run(input, flags);
|
|
60033
|
+
const ok = exitCode === 0;
|
|
60034
|
+
return {
|
|
60035
|
+
ok,
|
|
60036
|
+
data: { exitCode, agent: agent ?? "<default>" },
|
|
60037
|
+
error: ok ? undefined : `agent.run (${agent ?? "default"}) exited with code ${exitCode}`,
|
|
60038
|
+
setVars: ok ? { __agentSession: "open" } : undefined
|
|
60039
|
+
};
|
|
60040
|
+
}
|
|
60041
|
+
}
|
|
60042
|
+
function asOptionalString(value) {
|
|
60043
|
+
if (value === undefined || value === null)
|
|
60044
|
+
return;
|
|
60045
|
+
return String(value);
|
|
60046
|
+
}
|
|
60047
|
+
function asOptionalBoolean(value) {
|
|
60048
|
+
if (value === undefined || value === null)
|
|
60049
|
+
return;
|
|
60050
|
+
if (typeof value === "boolean")
|
|
60051
|
+
return value;
|
|
60052
|
+
if (value === "true")
|
|
60053
|
+
return true;
|
|
60054
|
+
if (value === "false")
|
|
60055
|
+
return false;
|
|
60056
|
+
return;
|
|
60057
|
+
}
|
|
60058
|
+
|
|
60059
|
+
// ../../packages/app/src/workflow/actions/file-exists.ts
|
|
60060
|
+
init_dist3();
|
|
60061
|
+
var KIND2 = "file.exists";
|
|
60062
|
+
|
|
60063
|
+
class FileExistsActionRunner {
|
|
60064
|
+
kind = KIND2;
|
|
60065
|
+
fileSystem;
|
|
60066
|
+
constructor(fileSystem) {
|
|
60067
|
+
this.fileSystem = fileSystem;
|
|
60068
|
+
}
|
|
60069
|
+
async execute(options, context3) {
|
|
60070
|
+
const rawPath = options.path;
|
|
60071
|
+
if (typeof rawPath !== "string") {
|
|
60072
|
+
return { ok: false, error: "file.exists: path is required" };
|
|
60073
|
+
}
|
|
60074
|
+
const negate = asBoolean(options.negate) ?? false;
|
|
60075
|
+
const resolved = joinPath(context3.workdir ?? ".", rawPath);
|
|
60076
|
+
const exists2 = await this.fileSystem.exists(resolved);
|
|
60077
|
+
const ok = negate ? !exists2 : exists2;
|
|
60078
|
+
return {
|
|
60079
|
+
ok,
|
|
60080
|
+
data: { exists: exists2, path: resolved },
|
|
60081
|
+
error: ok ? undefined : `file.exists: ${exists2 ? "file exists (negated)" : "file not found"}: ${resolved}`
|
|
60082
|
+
};
|
|
60083
|
+
}
|
|
60084
|
+
}
|
|
60085
|
+
function asBoolean(value) {
|
|
60086
|
+
if (value === undefined || value === null)
|
|
60087
|
+
return;
|
|
60088
|
+
if (typeof value === "boolean")
|
|
60089
|
+
return value;
|
|
60090
|
+
if (value === "true")
|
|
60091
|
+
return true;
|
|
60092
|
+
if (value === "false")
|
|
60093
|
+
return false;
|
|
60094
|
+
return;
|
|
60095
|
+
}
|
|
60096
|
+
|
|
60097
|
+
// ../../packages/app/src/workflow/actions/file-read.ts
|
|
60098
|
+
init_dist3();
|
|
60099
|
+
var KIND3 = "file.read";
|
|
60100
|
+
|
|
60101
|
+
class FileReadActionRunner {
|
|
60102
|
+
kind = KIND3;
|
|
60103
|
+
fileSystem;
|
|
60104
|
+
constructor(fileSystem) {
|
|
60105
|
+
this.fileSystem = fileSystem;
|
|
60106
|
+
}
|
|
60107
|
+
async execute(options, context3) {
|
|
60108
|
+
const rawPath = options.path;
|
|
60109
|
+
if (typeof rawPath !== "string") {
|
|
60110
|
+
return { ok: false, error: "file.read: path is required" };
|
|
60111
|
+
}
|
|
60112
|
+
const maxSize = asNumber(options.maxSize);
|
|
60113
|
+
const resolved = joinPath(context3.workdir ?? ".", rawPath);
|
|
60114
|
+
const stat2 = await this.fileSystem.stat(resolved);
|
|
60115
|
+
if (stat2 === null) {
|
|
60116
|
+
return { ok: false, error: `file.read: file not found: ${resolved}` };
|
|
60117
|
+
}
|
|
60118
|
+
if (maxSize !== undefined && stat2.size > maxSize) {
|
|
60119
|
+
return { ok: false, error: `file.read: file too large (${stat2.size} > ${maxSize}): ${resolved}` };
|
|
60120
|
+
}
|
|
60121
|
+
const content = await this.fileSystem.readFile(resolved);
|
|
60122
|
+
return {
|
|
60123
|
+
ok: true,
|
|
60124
|
+
data: { content, size: stat2.size, path: resolved }
|
|
60125
|
+
};
|
|
60126
|
+
}
|
|
60127
|
+
}
|
|
60128
|
+
function asNumber(value) {
|
|
60129
|
+
if (typeof value !== "number" || Number.isNaN(value))
|
|
60130
|
+
return;
|
|
60131
|
+
return value;
|
|
60132
|
+
}
|
|
60133
|
+
|
|
60134
|
+
// ../../packages/app/src/workflow/actions/hitl-confirm.ts
|
|
60135
|
+
var KIND4 = "hitl.confirm";
|
|
60136
|
+
|
|
60137
|
+
class HitlConfirmActionRunner {
|
|
60138
|
+
kind = KIND4;
|
|
60139
|
+
responder;
|
|
60140
|
+
constructor(responder) {
|
|
60141
|
+
this.responder = responder;
|
|
60142
|
+
}
|
|
60143
|
+
async execute(options, context3) {
|
|
60144
|
+
const prompt = asString2(options.prompt);
|
|
60145
|
+
if (prompt === undefined) {
|
|
60146
|
+
return { ok: false, error: "hitl.confirm: prompt is required" };
|
|
60147
|
+
}
|
|
60148
|
+
const varName = asString2(options.var) ?? "__hitlAnswer";
|
|
60149
|
+
const answer = await this.responder.respond({
|
|
60150
|
+
kind: "confirm",
|
|
60151
|
+
prompt,
|
|
60152
|
+
runId: context3.runId,
|
|
60153
|
+
node: context3.stateOrNodeId
|
|
60154
|
+
});
|
|
60155
|
+
if (answer.cancelled || answer.value === "cancel") {
|
|
60156
|
+
return { ok: false, error: "hitl.confirm cancelled" };
|
|
60157
|
+
}
|
|
60158
|
+
return {
|
|
60159
|
+
ok: true,
|
|
60160
|
+
data: { answer: answer.value },
|
|
60161
|
+
setVars: { [varName]: answer.value }
|
|
60162
|
+
};
|
|
60163
|
+
}
|
|
60164
|
+
}
|
|
60165
|
+
function asString2(value) {
|
|
60166
|
+
if (value === undefined || value === null)
|
|
60167
|
+
return;
|
|
60168
|
+
return String(value);
|
|
60169
|
+
}
|
|
60170
|
+
|
|
60171
|
+
// ../../packages/app/src/workflow/actions/hitl-input.ts
|
|
60172
|
+
var KIND5 = "hitl.input";
|
|
60173
|
+
|
|
60174
|
+
class HitlInputActionRunner {
|
|
60175
|
+
kind = KIND5;
|
|
60176
|
+
responder;
|
|
60177
|
+
constructor(responder) {
|
|
60178
|
+
this.responder = responder;
|
|
60179
|
+
}
|
|
60180
|
+
async execute(options, context3) {
|
|
60181
|
+
const prompt = asString3(options.prompt);
|
|
60182
|
+
if (prompt === undefined) {
|
|
60183
|
+
return { ok: false, error: "hitl.input: prompt is required" };
|
|
60184
|
+
}
|
|
60185
|
+
const varName = asString3(options.var) ?? "__hitlInput";
|
|
60186
|
+
const answer = await this.responder.respond({
|
|
60187
|
+
kind: "input",
|
|
60188
|
+
prompt,
|
|
60189
|
+
runId: context3.runId,
|
|
60190
|
+
node: context3.stateOrNodeId
|
|
60191
|
+
});
|
|
60192
|
+
if (answer.cancelled) {
|
|
60193
|
+
return { ok: false, error: "hitl.input cancelled" };
|
|
60194
|
+
}
|
|
60195
|
+
return {
|
|
60196
|
+
ok: true,
|
|
60197
|
+
data: { answer: answer.value },
|
|
60198
|
+
setVars: { [varName]: answer.value }
|
|
60199
|
+
};
|
|
60200
|
+
}
|
|
60201
|
+
}
|
|
60202
|
+
function asString3(value) {
|
|
60203
|
+
if (value === undefined || value === null)
|
|
60204
|
+
return;
|
|
60205
|
+
return String(value);
|
|
60206
|
+
}
|
|
60207
|
+
|
|
60208
|
+
// ../../packages/app/src/workflow/actions/hitl-select.ts
|
|
60209
|
+
var KIND6 = "hitl.select";
|
|
60210
|
+
|
|
60211
|
+
class HitlSelectActionRunner {
|
|
60212
|
+
kind = KIND6;
|
|
60213
|
+
responder;
|
|
60214
|
+
constructor(responder) {
|
|
60215
|
+
this.responder = responder;
|
|
60216
|
+
}
|
|
60217
|
+
async execute(options, context3) {
|
|
60218
|
+
const prompt = asString4(options.prompt);
|
|
60219
|
+
if (prompt === undefined) {
|
|
60220
|
+
return { ok: false, error: "hitl.select: prompt is required" };
|
|
60221
|
+
}
|
|
60222
|
+
const choiceList = asStringArray(options.options);
|
|
60223
|
+
if (choiceList === undefined || choiceList.length === 0) {
|
|
60224
|
+
return { ok: false, error: "hitl.select: options is required and must be non-empty" };
|
|
60225
|
+
}
|
|
60226
|
+
const varName = asString4(options.var) ?? "__hitlAnswer";
|
|
60227
|
+
const answer = await this.responder.respond({
|
|
60228
|
+
kind: "select",
|
|
60229
|
+
prompt,
|
|
60230
|
+
options: choiceList,
|
|
60231
|
+
runId: context3.runId,
|
|
60232
|
+
node: context3.stateOrNodeId
|
|
60233
|
+
});
|
|
60234
|
+
if (answer.cancelled) {
|
|
60235
|
+
return { ok: false, error: "hitl.select cancelled" };
|
|
60236
|
+
}
|
|
60237
|
+
return {
|
|
60238
|
+
ok: true,
|
|
60239
|
+
data: { answer: answer.value },
|
|
60240
|
+
setVars: { [varName]: answer.value }
|
|
60241
|
+
};
|
|
60242
|
+
}
|
|
60243
|
+
}
|
|
60244
|
+
function asString4(value) {
|
|
60245
|
+
if (value === undefined || value === null)
|
|
60246
|
+
return;
|
|
60247
|
+
return String(value);
|
|
60248
|
+
}
|
|
60249
|
+
function asStringArray(value) {
|
|
60250
|
+
if (!Array.isArray(value))
|
|
60251
|
+
return;
|
|
60252
|
+
return value.map((v) => String(v));
|
|
60253
|
+
}
|
|
60254
|
+
|
|
60255
|
+
// ../../packages/app/src/workflow/actions/http-request.ts
|
|
60256
|
+
var KIND7 = "http.request";
|
|
60257
|
+
var ALLOWED_METHODS = {
|
|
60258
|
+
GET: true,
|
|
60259
|
+
POST: true,
|
|
60260
|
+
PUT: true,
|
|
60261
|
+
PATCH: true,
|
|
60262
|
+
DELETE: true,
|
|
60263
|
+
HEAD: true,
|
|
60264
|
+
OPTIONS: true
|
|
60265
|
+
};
|
|
60266
|
+
var DEFAULT_TIMEOUT_MS3 = 30000;
|
|
60267
|
+
var MAX_TIMEOUT_MS = 120000;
|
|
60268
|
+
var DEFAULT_MAX_RESPONSE_BYTES = 1048576;
|
|
60269
|
+
var HEADER_NAME_RE = /^[!#$%&'*+\-.^_`|~0-9a-zA-Z]+$/;
|
|
60270
|
+
var HEADER_VALUE_RE = /^[ \t]*[!-~\x80-\xff][\t -~\x80-\xff]*$/;
|
|
60271
|
+
var PRIVATE_IP_PATTERNS = [
|
|
60272
|
+
/^127\./,
|
|
60273
|
+
/^10\./,
|
|
60274
|
+
/^172\.(1[6-9]|2\d|3[01])\./,
|
|
60275
|
+
/^192\.168\./,
|
|
60276
|
+
/^169\.254\./,
|
|
60277
|
+
/^0\./,
|
|
60278
|
+
/^100\.(6[4-9]|[7-9]\d|1[01]\d|12[0-7])\./,
|
|
60279
|
+
/^fc|^fd|^fe80:/i,
|
|
60280
|
+
/^::1$/,
|
|
60281
|
+
/^::$/
|
|
60282
|
+
];
|
|
60283
|
+
function resolveTemplate(value, vars) {
|
|
60284
|
+
return value.replace(/\$\{(vars\.)?(\w+)\}/g, (_match, _prefix, key) => {
|
|
60285
|
+
return vars[key] ?? "";
|
|
60286
|
+
});
|
|
60287
|
+
}
|
|
60288
|
+
function isPrivateHost(hostname3) {
|
|
60289
|
+
const normalized = hostname3.startsWith("[") ? hostname3.slice(1, -1) : hostname3;
|
|
60290
|
+
return PRIVATE_IP_PATTERNS.some((re) => re.test(normalized));
|
|
60291
|
+
}
|
|
60292
|
+
function redactHeaders(message) {
|
|
60293
|
+
return message.replace(/"?headers"?\s*[: ]\s*\{[^}]+\}/gi, "headers <redacted>");
|
|
60294
|
+
}
|
|
60295
|
+
|
|
60296
|
+
class HttpRequestActionRunner {
|
|
60297
|
+
kind = KIND7;
|
|
60298
|
+
requester;
|
|
60299
|
+
allowlist;
|
|
60300
|
+
constructor(requester, allowlist) {
|
|
60301
|
+
this.requester = requester;
|
|
60302
|
+
this.allowlist = allowlist;
|
|
60303
|
+
}
|
|
60304
|
+
async execute(options, context3) {
|
|
60305
|
+
const rawUrl = asRequiredString(options.url, "url");
|
|
60306
|
+
const method = (asOptionalString2(options.method) ?? "GET").toUpperCase();
|
|
60307
|
+
const rawHeaders = asRecord(options.headers) ?? {};
|
|
60308
|
+
const rawBody = asOptionalString2(options.body);
|
|
60309
|
+
const failOnStatus = asNumberArray(options.failOnStatus);
|
|
60310
|
+
const timeoutMs = asNumber2(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS3;
|
|
60311
|
+
const maxResponseBytes = asNumber2(options.maxResponseBytes) ?? DEFAULT_MAX_RESPONSE_BYTES;
|
|
60312
|
+
const redirect = asOptionalString2(options.redirect);
|
|
60313
|
+
const bodyVar = asOptionalString2(options.bodyVar);
|
|
60314
|
+
const statusVar = asOptionalString2(options.statusVar);
|
|
60315
|
+
const headersVar = asOptionalString2(options.headersVar);
|
|
60316
|
+
if (!Object.hasOwn(ALLOWED_METHODS, method)) {
|
|
60317
|
+
return { ok: false, error: `http.request: unsupported method: ${method}` };
|
|
60318
|
+
}
|
|
60319
|
+
if (timeoutMs <= 0 || timeoutMs > MAX_TIMEOUT_MS) {
|
|
60320
|
+
return {
|
|
60321
|
+
ok: false,
|
|
60322
|
+
error: `http.request: timeoutMs must be 1\u2013${MAX_TIMEOUT_MS}, got ${timeoutMs}`
|
|
60323
|
+
};
|
|
60324
|
+
}
|
|
60325
|
+
if (maxResponseBytes <= 0) {
|
|
60326
|
+
return { ok: false, error: `http.request: maxResponseBytes must be positive, got ${maxResponseBytes}` };
|
|
60327
|
+
}
|
|
60328
|
+
let url2;
|
|
60329
|
+
let body;
|
|
60330
|
+
let headers;
|
|
60331
|
+
try {
|
|
60332
|
+
url2 = resolveTemplate(rawUrl, context3.vars);
|
|
60333
|
+
body = rawBody !== undefined ? resolveTemplate(rawBody, context3.vars) : undefined;
|
|
60334
|
+
headers = {};
|
|
60335
|
+
for (const [key, value] of Object.entries(rawHeaders)) {
|
|
60336
|
+
if (!HEADER_NAME_RE.test(key)) {
|
|
60337
|
+
throw new Error(`invalid header name: ${JSON.stringify(key)}`);
|
|
60338
|
+
}
|
|
60339
|
+
if (!HEADER_VALUE_RE.test(value)) {
|
|
60340
|
+
throw new Error(`invalid header value for ${JSON.stringify(key)}`);
|
|
60341
|
+
}
|
|
60342
|
+
headers[key] = resolveTemplate(value, context3.vars);
|
|
60343
|
+
}
|
|
60344
|
+
} catch (err) {
|
|
60345
|
+
return { ok: false, error: `http.request: ${err.message}` };
|
|
60346
|
+
}
|
|
60347
|
+
let parsed;
|
|
60348
|
+
try {
|
|
60349
|
+
parsed = new URL(url2);
|
|
60350
|
+
} catch {
|
|
60351
|
+
return { ok: false, error: redactHeaders(`http.request: invalid URL: ${url2}`) };
|
|
60352
|
+
}
|
|
60353
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
60354
|
+
return {
|
|
60355
|
+
ok: false,
|
|
60356
|
+
error: `http.request: only http/https schemes allowed, got: ${parsed.protocol.replace(":", "")}`
|
|
60357
|
+
};
|
|
60358
|
+
}
|
|
60359
|
+
if (parsed.username || parsed.password) {
|
|
60360
|
+
return { ok: false, error: `http.request: URLs with embedded credentials are not allowed` };
|
|
60361
|
+
}
|
|
60362
|
+
if (this.allowlist.size === 0) {
|
|
60363
|
+
return {
|
|
60364
|
+
ok: false,
|
|
60365
|
+
error: `http.request: no host allowlist configured \u2014 outbound HTTP is denied by default`
|
|
60366
|
+
};
|
|
60367
|
+
}
|
|
60368
|
+
const origin2 = parsed.origin;
|
|
60369
|
+
const hostname3 = parsed.hostname;
|
|
60370
|
+
if (!this.allowlist.has(origin2) && !this.allowlist.has(hostname3)) {
|
|
60371
|
+
return {
|
|
60372
|
+
ok: false,
|
|
60373
|
+
error: `http.request: host not in allowlist: ${hostname3}`
|
|
60374
|
+
};
|
|
60375
|
+
}
|
|
60376
|
+
if (isPrivateHost(hostname3) && !this.allowlist.has(hostname3) && !this.allowlist.has(origin2)) {
|
|
60377
|
+
return {
|
|
60378
|
+
ok: false,
|
|
60379
|
+
error: `http.request: private/internal host not allowed unless explicitly in allowlist: ${hostname3}`
|
|
60380
|
+
};
|
|
60381
|
+
}
|
|
60382
|
+
let rawResponse;
|
|
60383
|
+
try {
|
|
60384
|
+
rawResponse = await this.requester.rawRequest(method, url2, body, {
|
|
60385
|
+
headers,
|
|
60386
|
+
timeout: timeoutMs,
|
|
60387
|
+
redirect: redirect ?? "manual",
|
|
60388
|
+
maxResponseBytes
|
|
60389
|
+
});
|
|
60390
|
+
} catch (err) {
|
|
60391
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
60392
|
+
return { ok: false, error: redactHeaders(`http.request: ${message}`) };
|
|
60393
|
+
}
|
|
60394
|
+
const status = rawResponse.status;
|
|
60395
|
+
const ok = !failOnStatus.includes(status);
|
|
60396
|
+
const setVars = {};
|
|
60397
|
+
if (statusVar)
|
|
60398
|
+
setVars[statusVar] = String(status);
|
|
60399
|
+
if (bodyVar)
|
|
60400
|
+
setVars[bodyVar] = rawResponse.body;
|
|
60401
|
+
if (headersVar)
|
|
60402
|
+
setVars[headersVar] = JSON.stringify(rawResponse.headers);
|
|
60403
|
+
return {
|
|
60404
|
+
ok,
|
|
60405
|
+
data: { status, headers: rawResponse.headers, body: rawResponse.body },
|
|
60406
|
+
error: ok ? undefined : `http.request: status ${status} is in failOnStatus`,
|
|
60407
|
+
setVars: Object.keys(setVars).length > 0 ? setVars : undefined
|
|
60408
|
+
};
|
|
60409
|
+
}
|
|
60410
|
+
}
|
|
60411
|
+
function asRequiredString(value, name) {
|
|
60412
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
60413
|
+
throw new Error(`${name} is required`);
|
|
60414
|
+
}
|
|
60415
|
+
return value;
|
|
60416
|
+
}
|
|
60417
|
+
function asOptionalString2(value) {
|
|
60418
|
+
if (value === undefined || value === null)
|
|
60419
|
+
return;
|
|
60420
|
+
return String(value);
|
|
60421
|
+
}
|
|
60422
|
+
function asNumber2(value) {
|
|
60423
|
+
if (typeof value !== "number" || Number.isNaN(value))
|
|
60424
|
+
return;
|
|
60425
|
+
return value;
|
|
60426
|
+
}
|
|
60427
|
+
function asRecord(value) {
|
|
60428
|
+
if (value === undefined || value === null)
|
|
60429
|
+
return;
|
|
60430
|
+
if (typeof value !== "object" || Array.isArray(value))
|
|
60431
|
+
return;
|
|
60432
|
+
const record2 = value;
|
|
60433
|
+
const result = {};
|
|
60434
|
+
for (const [key, val] of Object.entries(record2)) {
|
|
60435
|
+
if (typeof val === "string") {
|
|
60436
|
+
result[key] = val;
|
|
60437
|
+
}
|
|
60438
|
+
}
|
|
60439
|
+
return result;
|
|
60440
|
+
}
|
|
60441
|
+
function asNumberArray(value) {
|
|
60442
|
+
if (!Array.isArray(value))
|
|
60443
|
+
return [];
|
|
60444
|
+
return value.filter((v) => typeof v === "number" && !Number.isNaN(v));
|
|
60445
|
+
}
|
|
60446
|
+
|
|
60447
|
+
// ../../packages/app/src/workflow/utils.ts
|
|
60448
|
+
var identity5 = (s) => s;
|
|
60449
|
+
var NO_COLOR = {
|
|
60450
|
+
enabled: false,
|
|
60451
|
+
dim: identity5,
|
|
60452
|
+
red: identity5,
|
|
60453
|
+
green: identity5,
|
|
60454
|
+
yellow: identity5,
|
|
60455
|
+
cyan: identity5
|
|
60456
|
+
};
|
|
60457
|
+
|
|
60458
|
+
// ../../packages/app/src/workflow/actions/rule-check.ts
|
|
60459
|
+
var KIND8 = "rule.check";
|
|
60460
|
+
|
|
60461
|
+
class RuleCheckActionRunner {
|
|
60462
|
+
kind = KIND8;
|
|
60463
|
+
ruleService;
|
|
60464
|
+
constructor(ruleService) {
|
|
60465
|
+
this.ruleService = ruleService;
|
|
60466
|
+
}
|
|
60467
|
+
async execute(options, _context) {
|
|
60468
|
+
const preset = asString5(options.preset) ?? "recommended-pre-check";
|
|
60469
|
+
const rule = asString5(options.rule);
|
|
60470
|
+
const failOn = asString5(options.failOn) ?? "error";
|
|
60471
|
+
const result = await this.ruleService.evaluate({
|
|
60472
|
+
preset,
|
|
60473
|
+
failOn,
|
|
60474
|
+
...rule !== undefined ? { rule } : {},
|
|
60475
|
+
json: true,
|
|
60476
|
+
verbose: false,
|
|
60477
|
+
color: NO_COLOR,
|
|
60478
|
+
fixMode: "none"
|
|
60479
|
+
});
|
|
60480
|
+
const ok = result.exitCode === 0;
|
|
60481
|
+
return {
|
|
60482
|
+
ok,
|
|
60483
|
+
data: {
|
|
60484
|
+
findings: result.findings,
|
|
60485
|
+
preset: result.preset,
|
|
60486
|
+
ruleCount: result.ruleCount
|
|
60487
|
+
},
|
|
60488
|
+
error: ok ? undefined : `rule.check failed: ${result.findings.length} finding(s) at/above ${failOn}`
|
|
60489
|
+
};
|
|
60490
|
+
}
|
|
60491
|
+
}
|
|
60492
|
+
function asString5(value) {
|
|
60493
|
+
if (value === undefined || value === null)
|
|
60494
|
+
return;
|
|
60495
|
+
return String(value);
|
|
60496
|
+
}
|
|
60497
|
+
|
|
60498
|
+
// ../../packages/app/src/workflow/builtins.ts
|
|
60499
|
+
function registerSpurBuiltins(host, options) {
|
|
60500
|
+
const fileSystem = options.fileSystem ?? createNodeFileSystem();
|
|
60501
|
+
host.registerAction(new AgentRunActionRunner(options.agentService), "builtin");
|
|
60502
|
+
host.registerAction(new RuleCheckActionRunner(options.ruleService), "builtin");
|
|
60503
|
+
host.registerAction(new FileExistsActionRunner(fileSystem), "builtin");
|
|
60504
|
+
host.registerAction(new FileReadActionRunner(fileSystem), "builtin");
|
|
60505
|
+
host.registerAction(new HitlConfirmActionRunner(options.hitlResponder), "builtin");
|
|
60506
|
+
host.registerAction(new HitlSelectActionRunner(options.hitlResponder), "builtin");
|
|
60507
|
+
host.registerAction(new HitlInputActionRunner(options.hitlResponder), "builtin");
|
|
60508
|
+
if (options.httpRequester) {
|
|
60509
|
+
host.registerAction(new HttpRequestActionRunner(options.httpRequester, options.hostAllowlist ?? new Set), "builtin");
|
|
60510
|
+
}
|
|
60511
|
+
}
|
|
60512
|
+
|
|
60513
|
+
// ../../packages/app/src/services/workflow-service.ts
|
|
59894
60514
|
class WorkflowAppService {
|
|
59895
60515
|
ctx;
|
|
59896
60516
|
constructor(ctx) {
|
|
@@ -59915,11 +60535,12 @@ class WorkflowAppService {
|
|
|
59915
60535
|
};
|
|
59916
60536
|
}
|
|
59917
60537
|
}
|
|
59918
|
-
async run(file2,
|
|
60538
|
+
async run(file2, opts = {}) {
|
|
59919
60539
|
const svc = await this.createEngineService();
|
|
59920
60540
|
const result = await svc.runFile(file2, {
|
|
59921
60541
|
workdir: this.ctx.cwd,
|
|
59922
|
-
runId: runId ?? crypto.randomUUID()
|
|
60542
|
+
runId: opts.runId ?? crypto.randomUUID(),
|
|
60543
|
+
...opts.vars ? { vars: opts.vars } : {}
|
|
59923
60544
|
});
|
|
59924
60545
|
return result;
|
|
59925
60546
|
}
|
|
@@ -59929,7 +60550,15 @@ class WorkflowAppService {
|
|
|
59929
60550
|
return { runs: runs2 };
|
|
59930
60551
|
}
|
|
59931
60552
|
async createEngineService() {
|
|
59932
|
-
|
|
60553
|
+
const host = createDefaultWorkflowEngineHost();
|
|
60554
|
+
registerSpurBuiltins(host, {
|
|
60555
|
+
agentService: this.ctx.agentService(),
|
|
60556
|
+
ruleService: this.ctx.ruleService(),
|
|
60557
|
+
hitlResponder: this.ctx.hitlResponder(),
|
|
60558
|
+
httpRequester: this.ctx.httpRequester?.(),
|
|
60559
|
+
hostAllowlist: this.ctx.hostAllowlist?.()
|
|
60560
|
+
});
|
|
60561
|
+
return new WorkflowService(host, new DbWorkflowPersistenceAdapter(await this.ctx.getDb()));
|
|
59933
60562
|
}
|
|
59934
60563
|
}
|
|
59935
60564
|
async function fileExists(path8) {
|
|
@@ -60188,7 +60817,7 @@ import { join as join6, resolve as resolve3 } from "path";
|
|
|
60188
60817
|
var CLI_CONFIG = {
|
|
60189
60818
|
binaryName: "spur",
|
|
60190
60819
|
binaryLabel: "spur",
|
|
60191
|
-
binaryVersion: "0.2.
|
|
60820
|
+
binaryVersion: "0.2.4",
|
|
60192
60821
|
configDir: ".spur",
|
|
60193
60822
|
configFile: ".spur/config.yaml",
|
|
60194
60823
|
databaseFile: ".spur/spur.db"
|
|
@@ -60740,11 +61369,39 @@ function formatStatusLine(agent) {
|
|
|
60740
61369
|
}
|
|
60741
61370
|
|
|
60742
61371
|
// src/commands/workflow.ts
|
|
61372
|
+
function parseVars(raw) {
|
|
61373
|
+
if (raw === undefined) {
|
|
61374
|
+
return;
|
|
61375
|
+
}
|
|
61376
|
+
let parsed;
|
|
61377
|
+
try {
|
|
61378
|
+
parsed = JSON.parse(raw);
|
|
61379
|
+
} catch {
|
|
61380
|
+
throw new Error(`--vars must be a valid JSON object: ${raw}`);
|
|
61381
|
+
}
|
|
61382
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
61383
|
+
throw new Error(`--vars must be a JSON object, e.g. '{"taskId":"0042"}'`);
|
|
61384
|
+
}
|
|
61385
|
+
const vars = {};
|
|
61386
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
61387
|
+
if (typeof value !== "string") {
|
|
61388
|
+
throw new Error(`--vars values must be strings; "${key}" is ${typeof value}`);
|
|
61389
|
+
}
|
|
61390
|
+
vars[key] = value;
|
|
61391
|
+
}
|
|
61392
|
+
return vars;
|
|
61393
|
+
}
|
|
60743
61394
|
function registerWorkflowCommand(program2, context3) {
|
|
61395
|
+
const makeSvc = (json2) => new WorkflowAppService({
|
|
61396
|
+
cwd: context3.cwd,
|
|
61397
|
+
getDb: () => context3.getDb(),
|
|
61398
|
+
agentService: () => context3.agentService(),
|
|
61399
|
+
ruleService: () => context3.ruleService(),
|
|
61400
|
+
hitlResponder: () => context3.hitlResponder(json2)
|
|
61401
|
+
});
|
|
60744
61402
|
const workflow = program2.command("workflow").summary("validate and execute workflow YAML files");
|
|
60745
61403
|
workflow.command("validate").description("Validate a workflow definition.").argument("<file>", "Workflow YAML file").option("--no-schema", "Skip schema validation").option("--json", "Output machine-readable JSON where supported").action(async (file2, options) => {
|
|
60746
|
-
const
|
|
60747
|
-
const result = await svc.validate(file2, { validateSchema: options.schema });
|
|
61404
|
+
const result = await makeSvc().validate(file2, { validateSchema: options.schema });
|
|
60748
61405
|
if (options.json) {
|
|
60749
61406
|
context3.output.write(toJson2(result));
|
|
60750
61407
|
} else if (result.valid) {
|
|
@@ -60756,15 +61413,14 @@ ${result.errors.map((m2) => ` - ${m2}`).join(`
|
|
|
60756
61413
|
}
|
|
60757
61414
|
context3.setExitCode(result.valid ? 0 : 1);
|
|
60758
61415
|
});
|
|
60759
|
-
workflow.command("run").description("Execute a workflow definition.").argument("<file>", "Workflow YAML file").option("--run-id <id>", "Persisted run id for workflow run").option("--json", "Output machine-readable JSON where supported").action(async (file2, options) => {
|
|
60760
|
-
const
|
|
60761
|
-
const result = await
|
|
61416
|
+
workflow.command("run").description("Execute a workflow definition.").argument("<file>", "Workflow YAML file").option("--run-id <id>", "Persisted run id for workflow run").option("--vars <json>", `Per-run variable overrides as a JSON object, e.g. '{"taskId":"0042"}'`).option("--json", "Output machine-readable JSON where supported").action(async (file2, options) => {
|
|
61417
|
+
const vars = parseVars(options.vars);
|
|
61418
|
+
const result = await makeSvc(options.json).run(file2, { runId: options.runId || undefined, vars });
|
|
60762
61419
|
context3.output.write(options.json ? toJson2(result) : `workflow ${result.status}: ${result.workflowName} -> ${result.finalState}`);
|
|
60763
61420
|
context3.setExitCode(result.status === "done" ? 0 : 1);
|
|
60764
61421
|
});
|
|
60765
61422
|
workflow.command("list").description("List persisted workflow runs.").option("--json", "Output machine-readable JSON where supported").action(async (options) => {
|
|
60766
|
-
const
|
|
60767
|
-
const { runs: runs2 } = await svc.list();
|
|
61423
|
+
const { runs: runs2 } = await makeSvc().list();
|
|
60768
61424
|
if (options.json) {
|
|
60769
61425
|
context3.output.write(toJson2({ runs: runs2 }));
|
|
60770
61426
|
} else {
|
|
@@ -60982,7 +61638,1388 @@ var SpurAppConfigSchema = exports_external.object({
|
|
|
60982
61638
|
|
|
60983
61639
|
// src/context.ts
|
|
60984
61640
|
import { dirname as dirname5, join as join10, resolve as resolve4 } from "path";
|
|
61641
|
+
import { isatty as isatty3 } from "tty";
|
|
60985
61642
|
init_dist3();
|
|
61643
|
+
|
|
61644
|
+
// ../../node_modules/.bun/@clack+core@1.4.1/node_modules/@clack/core/dist/index.mjs
|
|
61645
|
+
import { styleText } from "util";
|
|
61646
|
+
import { stdout, stdin } from "process";
|
|
61647
|
+
import l__default from "readline";
|
|
61648
|
+
|
|
61649
|
+
// ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
61650
|
+
var getCodePointsLength = (() => {
|
|
61651
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
61652
|
+
return (input) => {
|
|
61653
|
+
let surrogatePairsNr = 0;
|
|
61654
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
61655
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
61656
|
+
surrogatePairsNr += 1;
|
|
61657
|
+
}
|
|
61658
|
+
return input.length - surrogatePairsNr;
|
|
61659
|
+
};
|
|
61660
|
+
})();
|
|
61661
|
+
var isFullWidth = (x) => {
|
|
61662
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
61663
|
+
};
|
|
61664
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
61665
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
61666
|
+
};
|
|
61667
|
+
|
|
61668
|
+
// ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
61669
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
61670
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
61671
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
61672
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
61673
|
+
var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
61674
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
61675
|
+
var MODIFIER_RE = /\p{M}+/gu;
|
|
61676
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
61677
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
61678
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
61679
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
61680
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
61681
|
+
const ANSI_WIDTH = 0;
|
|
61682
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
61683
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
61684
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
61685
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
61686
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
61687
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
61688
|
+
const PARSE_BLOCKS = [
|
|
61689
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
61690
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
61691
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
61692
|
+
[TAB_RE, TAB_WIDTH],
|
|
61693
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
61694
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
61695
|
+
];
|
|
61696
|
+
let indexPrev = 0;
|
|
61697
|
+
let index2 = 0;
|
|
61698
|
+
let length = input.length;
|
|
61699
|
+
let lengthExtra = 0;
|
|
61700
|
+
let truncationEnabled = false;
|
|
61701
|
+
let truncationIndex = length;
|
|
61702
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
61703
|
+
let unmatchedStart = 0;
|
|
61704
|
+
let unmatchedEnd = 0;
|
|
61705
|
+
let width = 0;
|
|
61706
|
+
let widthExtra = 0;
|
|
61707
|
+
outer:
|
|
61708
|
+
while (true) {
|
|
61709
|
+
if (unmatchedEnd > unmatchedStart || index2 >= length && index2 > indexPrev) {
|
|
61710
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index2);
|
|
61711
|
+
lengthExtra = 0;
|
|
61712
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
61713
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
61714
|
+
if (isFullWidth(codePoint)) {
|
|
61715
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
61716
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
61717
|
+
widthExtra = WIDE_WIDTH;
|
|
61718
|
+
} else {
|
|
61719
|
+
widthExtra = REGULAR_WIDTH;
|
|
61720
|
+
}
|
|
61721
|
+
if (width + widthExtra > truncationLimit) {
|
|
61722
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
61723
|
+
}
|
|
61724
|
+
if (width + widthExtra > LIMIT) {
|
|
61725
|
+
truncationEnabled = true;
|
|
61726
|
+
break outer;
|
|
61727
|
+
}
|
|
61728
|
+
lengthExtra += char.length;
|
|
61729
|
+
width += widthExtra;
|
|
61730
|
+
}
|
|
61731
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
61732
|
+
}
|
|
61733
|
+
if (index2 >= length) {
|
|
61734
|
+
break outer;
|
|
61735
|
+
}
|
|
61736
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length;i2 < l; i2++) {
|
|
61737
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
61738
|
+
BLOCK_RE.lastIndex = index2;
|
|
61739
|
+
if (BLOCK_RE.test(input)) {
|
|
61740
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index2, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index2;
|
|
61741
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
61742
|
+
if (width + widthExtra > truncationLimit) {
|
|
61743
|
+
truncationIndex = Math.min(truncationIndex, index2 + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
61744
|
+
}
|
|
61745
|
+
if (width + widthExtra > LIMIT) {
|
|
61746
|
+
truncationEnabled = true;
|
|
61747
|
+
break outer;
|
|
61748
|
+
}
|
|
61749
|
+
width += widthExtra;
|
|
61750
|
+
unmatchedStart = indexPrev;
|
|
61751
|
+
unmatchedEnd = index2;
|
|
61752
|
+
index2 = indexPrev = BLOCK_RE.lastIndex;
|
|
61753
|
+
continue outer;
|
|
61754
|
+
}
|
|
61755
|
+
}
|
|
61756
|
+
index2 += 1;
|
|
61757
|
+
}
|
|
61758
|
+
return {
|
|
61759
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
61760
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
61761
|
+
truncated: truncationEnabled,
|
|
61762
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
61763
|
+
};
|
|
61764
|
+
};
|
|
61765
|
+
var dist_default = getStringTruncatedWidth;
|
|
61766
|
+
|
|
61767
|
+
// ../../node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
61768
|
+
var NO_TRUNCATION2 = {
|
|
61769
|
+
limit: Infinity,
|
|
61770
|
+
ellipsis: "",
|
|
61771
|
+
ellipsisWidth: 0
|
|
61772
|
+
};
|
|
61773
|
+
var fastStringWidth = (input, options = {}) => {
|
|
61774
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
61775
|
+
};
|
|
61776
|
+
var dist_default2 = fastStringWidth;
|
|
61777
|
+
|
|
61778
|
+
// ../../node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
61779
|
+
var ESC = "\x1B";
|
|
61780
|
+
var CSI = "\x9B";
|
|
61781
|
+
var END_CODE = 39;
|
|
61782
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
61783
|
+
var ANSI_CSI = "[";
|
|
61784
|
+
var ANSI_OSC = "]";
|
|
61785
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
61786
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
61787
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
61788
|
+
var getClosingCode = (openingCode) => {
|
|
61789
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
61790
|
+
return 39;
|
|
61791
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
61792
|
+
return 39;
|
|
61793
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
61794
|
+
return 49;
|
|
61795
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
61796
|
+
return 49;
|
|
61797
|
+
if (openingCode === 1 || openingCode === 2)
|
|
61798
|
+
return 22;
|
|
61799
|
+
if (openingCode === 3)
|
|
61800
|
+
return 23;
|
|
61801
|
+
if (openingCode === 4)
|
|
61802
|
+
return 24;
|
|
61803
|
+
if (openingCode === 7)
|
|
61804
|
+
return 27;
|
|
61805
|
+
if (openingCode === 8)
|
|
61806
|
+
return 28;
|
|
61807
|
+
if (openingCode === 9)
|
|
61808
|
+
return 29;
|
|
61809
|
+
if (openingCode === 0)
|
|
61810
|
+
return 0;
|
|
61811
|
+
return;
|
|
61812
|
+
};
|
|
61813
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
61814
|
+
var wrapAnsiHyperlink = (url2) => `${ESC}${ANSI_ESCAPE_LINK}${url2}${ANSI_ESCAPE_BELL}`;
|
|
61815
|
+
var wrapWord = (rows, word, columns2) => {
|
|
61816
|
+
const characters = word[Symbol.iterator]();
|
|
61817
|
+
let isInsideEscape = false;
|
|
61818
|
+
let isInsideLinkEscape = false;
|
|
61819
|
+
let lastRow = rows.at(-1);
|
|
61820
|
+
let visible = lastRow === undefined ? 0 : dist_default2(lastRow);
|
|
61821
|
+
let currentCharacter = characters.next();
|
|
61822
|
+
let nextCharacter = characters.next();
|
|
61823
|
+
let rawCharacterIndex = 0;
|
|
61824
|
+
while (!currentCharacter.done) {
|
|
61825
|
+
const character = currentCharacter.value;
|
|
61826
|
+
const characterLength = dist_default2(character);
|
|
61827
|
+
if (visible + characterLength <= columns2) {
|
|
61828
|
+
rows[rows.length - 1] += character;
|
|
61829
|
+
} else {
|
|
61830
|
+
rows.push(character);
|
|
61831
|
+
visible = 0;
|
|
61832
|
+
}
|
|
61833
|
+
if (character === ESC || character === CSI) {
|
|
61834
|
+
isInsideEscape = true;
|
|
61835
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
61836
|
+
}
|
|
61837
|
+
if (isInsideEscape) {
|
|
61838
|
+
if (isInsideLinkEscape) {
|
|
61839
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
61840
|
+
isInsideEscape = false;
|
|
61841
|
+
isInsideLinkEscape = false;
|
|
61842
|
+
}
|
|
61843
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
61844
|
+
isInsideEscape = false;
|
|
61845
|
+
}
|
|
61846
|
+
} else {
|
|
61847
|
+
visible += characterLength;
|
|
61848
|
+
if (visible === columns2 && !nextCharacter.done) {
|
|
61849
|
+
rows.push("");
|
|
61850
|
+
visible = 0;
|
|
61851
|
+
}
|
|
61852
|
+
}
|
|
61853
|
+
currentCharacter = nextCharacter;
|
|
61854
|
+
nextCharacter = characters.next();
|
|
61855
|
+
rawCharacterIndex += character.length;
|
|
61856
|
+
}
|
|
61857
|
+
lastRow = rows.at(-1);
|
|
61858
|
+
if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
|
|
61859
|
+
rows[rows.length - 2] += rows.pop();
|
|
61860
|
+
}
|
|
61861
|
+
};
|
|
61862
|
+
var stringVisibleTrimSpacesRight = (string4) => {
|
|
61863
|
+
const words = string4.split(" ");
|
|
61864
|
+
let last = words.length;
|
|
61865
|
+
while (last) {
|
|
61866
|
+
if (dist_default2(words[last - 1])) {
|
|
61867
|
+
break;
|
|
61868
|
+
}
|
|
61869
|
+
last--;
|
|
61870
|
+
}
|
|
61871
|
+
if (last === words.length) {
|
|
61872
|
+
return string4;
|
|
61873
|
+
}
|
|
61874
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
61875
|
+
};
|
|
61876
|
+
var exec = (string4, columns2, options = {}) => {
|
|
61877
|
+
if (options.trim !== false && string4.trim() === "") {
|
|
61878
|
+
return "";
|
|
61879
|
+
}
|
|
61880
|
+
let returnValue = "";
|
|
61881
|
+
let escapeCode;
|
|
61882
|
+
let escapeUrl;
|
|
61883
|
+
const words = string4.split(" ");
|
|
61884
|
+
let rows = [""];
|
|
61885
|
+
let rowLength = 0;
|
|
61886
|
+
for (let index2 = 0;index2 < words.length; index2++) {
|
|
61887
|
+
const word = words[index2];
|
|
61888
|
+
if (options.trim !== false) {
|
|
61889
|
+
const row = rows.at(-1) ?? "";
|
|
61890
|
+
const trimmed = row.trimStart();
|
|
61891
|
+
if (row.length !== trimmed.length) {
|
|
61892
|
+
rows[rows.length - 1] = trimmed;
|
|
61893
|
+
rowLength = dist_default2(trimmed);
|
|
61894
|
+
}
|
|
61895
|
+
}
|
|
61896
|
+
if (index2 !== 0) {
|
|
61897
|
+
if (rowLength >= columns2 && (options.wordWrap === false || options.trim === false)) {
|
|
61898
|
+
rows.push("");
|
|
61899
|
+
rowLength = 0;
|
|
61900
|
+
}
|
|
61901
|
+
if (rowLength || options.trim === false) {
|
|
61902
|
+
rows[rows.length - 1] += " ";
|
|
61903
|
+
rowLength++;
|
|
61904
|
+
}
|
|
61905
|
+
}
|
|
61906
|
+
const wordLength = dist_default2(word);
|
|
61907
|
+
if (options.hard && wordLength > columns2) {
|
|
61908
|
+
const remainingColumns = columns2 - rowLength;
|
|
61909
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns2);
|
|
61910
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns2);
|
|
61911
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
61912
|
+
rows.push("");
|
|
61913
|
+
}
|
|
61914
|
+
wrapWord(rows, word, columns2);
|
|
61915
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
61916
|
+
continue;
|
|
61917
|
+
}
|
|
61918
|
+
if (rowLength + wordLength > columns2 && rowLength && wordLength) {
|
|
61919
|
+
if (options.wordWrap === false && rowLength < columns2) {
|
|
61920
|
+
wrapWord(rows, word, columns2);
|
|
61921
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
61922
|
+
continue;
|
|
61923
|
+
}
|
|
61924
|
+
rows.push("");
|
|
61925
|
+
rowLength = 0;
|
|
61926
|
+
}
|
|
61927
|
+
if (rowLength + wordLength > columns2 && options.wordWrap === false) {
|
|
61928
|
+
wrapWord(rows, word, columns2);
|
|
61929
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
61930
|
+
continue;
|
|
61931
|
+
}
|
|
61932
|
+
rows[rows.length - 1] += word;
|
|
61933
|
+
rowLength += wordLength;
|
|
61934
|
+
}
|
|
61935
|
+
if (options.trim !== false) {
|
|
61936
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
61937
|
+
}
|
|
61938
|
+
const preString = rows.join(`
|
|
61939
|
+
`);
|
|
61940
|
+
let inSurrogate = false;
|
|
61941
|
+
for (let i2 = 0;i2 < preString.length; i2++) {
|
|
61942
|
+
const character = preString[i2];
|
|
61943
|
+
returnValue += character;
|
|
61944
|
+
if (!inSurrogate) {
|
|
61945
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
61946
|
+
if (inSurrogate) {
|
|
61947
|
+
continue;
|
|
61948
|
+
}
|
|
61949
|
+
} else {
|
|
61950
|
+
inSurrogate = false;
|
|
61951
|
+
}
|
|
61952
|
+
if (character === ESC || character === CSI) {
|
|
61953
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
61954
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
61955
|
+
const groups = groupsResult?.groups;
|
|
61956
|
+
if (groups?.code !== undefined) {
|
|
61957
|
+
const code = Number.parseFloat(groups.code);
|
|
61958
|
+
escapeCode = code === END_CODE ? undefined : code;
|
|
61959
|
+
} else if (groups?.uri !== undefined) {
|
|
61960
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
61961
|
+
}
|
|
61962
|
+
}
|
|
61963
|
+
if (preString[i2 + 1] === `
|
|
61964
|
+
`) {
|
|
61965
|
+
if (escapeUrl) {
|
|
61966
|
+
returnValue += wrapAnsiHyperlink("");
|
|
61967
|
+
}
|
|
61968
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
|
|
61969
|
+
if (escapeCode && closingCode) {
|
|
61970
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
61971
|
+
}
|
|
61972
|
+
} else if (character === `
|
|
61973
|
+
`) {
|
|
61974
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
61975
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
61976
|
+
}
|
|
61977
|
+
if (escapeUrl) {
|
|
61978
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
61979
|
+
}
|
|
61980
|
+
}
|
|
61981
|
+
}
|
|
61982
|
+
return returnValue;
|
|
61983
|
+
};
|
|
61984
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
61985
|
+
function wrapAnsi(string4, columns2, options) {
|
|
61986
|
+
return String(string4).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns2, options)).join(`
|
|
61987
|
+
`);
|
|
61988
|
+
}
|
|
61989
|
+
|
|
61990
|
+
// ../../node_modules/.bun/@clack+core@1.4.1/node_modules/@clack/core/dist/index.mjs
|
|
61991
|
+
var import_sisteransi = __toESM(require_src9(), 1);
|
|
61992
|
+
function findCursor(s, o2, l) {
|
|
61993
|
+
if (!l.some((r) => !r.disabled))
|
|
61994
|
+
return s;
|
|
61995
|
+
const t = s + o2, n2 = Math.max(l.length - 1, 0), e = t < 0 ? n2 : t > n2 ? 0 : t;
|
|
61996
|
+
return l[e].disabled ? findCursor(e, o2 < 0 ? -1 : 1, l) : e;
|
|
61997
|
+
}
|
|
61998
|
+
function findTextCursor(s, o2, l, i2) {
|
|
61999
|
+
const t = i2.split(`
|
|
62000
|
+
`);
|
|
62001
|
+
let n2 = 0, e = s;
|
|
62002
|
+
for (const r of t) {
|
|
62003
|
+
if (e <= r.length)
|
|
62004
|
+
break;
|
|
62005
|
+
e -= r.length + 1, n2++;
|
|
62006
|
+
}
|
|
62007
|
+
for (n2 = Math.max(0, Math.min(t.length - 1, n2 + l)), e = Math.min(e, t[n2].length) + o2;e < 0 && n2 > 0; )
|
|
62008
|
+
n2--, e += t[n2].length + 1;
|
|
62009
|
+
for (;e > t[n2].length && n2 < t.length - 1; )
|
|
62010
|
+
e -= t[n2].length + 1, n2++;
|
|
62011
|
+
e = Math.max(0, Math.min(t[n2].length, e));
|
|
62012
|
+
let h2 = 0;
|
|
62013
|
+
for (let r = 0;r < n2; r++)
|
|
62014
|
+
h2 += t[r].length + 1;
|
|
62015
|
+
return h2 + e;
|
|
62016
|
+
}
|
|
62017
|
+
var a$2 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
62018
|
+
var t = [
|
|
62019
|
+
"January",
|
|
62020
|
+
"February",
|
|
62021
|
+
"March",
|
|
62022
|
+
"April",
|
|
62023
|
+
"May",
|
|
62024
|
+
"June",
|
|
62025
|
+
"July",
|
|
62026
|
+
"August",
|
|
62027
|
+
"September",
|
|
62028
|
+
"October",
|
|
62029
|
+
"November",
|
|
62030
|
+
"December"
|
|
62031
|
+
];
|
|
62032
|
+
var settings = {
|
|
62033
|
+
actions: new Set(a$2),
|
|
62034
|
+
aliases: /* @__PURE__ */ new Map([
|
|
62035
|
+
["k", "up"],
|
|
62036
|
+
["j", "down"],
|
|
62037
|
+
["h", "left"],
|
|
62038
|
+
["l", "right"],
|
|
62039
|
+
["\x03", "cancel"],
|
|
62040
|
+
["escape", "cancel"]
|
|
62041
|
+
]),
|
|
62042
|
+
messages: {
|
|
62043
|
+
cancel: "Canceled",
|
|
62044
|
+
error: "Something went wrong"
|
|
62045
|
+
},
|
|
62046
|
+
withGuide: true,
|
|
62047
|
+
date: {
|
|
62048
|
+
monthNames: [...t],
|
|
62049
|
+
messages: {
|
|
62050
|
+
required: "Please enter a valid date",
|
|
62051
|
+
invalidMonth: "There are only 12 months in a year",
|
|
62052
|
+
invalidDay: (n2, e) => `There are only ${n2} days in ${e}`,
|
|
62053
|
+
afterMin: (n2) => `Date must be on or after ${n2.toISOString().slice(0, 10)}`,
|
|
62054
|
+
beforeMax: (n2) => `Date must be on or before ${n2.toISOString().slice(0, 10)}`
|
|
62055
|
+
}
|
|
62056
|
+
}
|
|
62057
|
+
};
|
|
62058
|
+
function isActionKey(n2, e) {
|
|
62059
|
+
if (typeof n2 == "string")
|
|
62060
|
+
return settings.aliases.get(n2) === e;
|
|
62061
|
+
for (const s of n2)
|
|
62062
|
+
if (s !== undefined && isActionKey(s, e))
|
|
62063
|
+
return true;
|
|
62064
|
+
return false;
|
|
62065
|
+
}
|
|
62066
|
+
function diffLines(i2, s) {
|
|
62067
|
+
if (i2 === s)
|
|
62068
|
+
return;
|
|
62069
|
+
const e = i2.split(`
|
|
62070
|
+
`), t2 = s.split(`
|
|
62071
|
+
`), r = Math.max(e.length, t2.length), f2 = [];
|
|
62072
|
+
for (let n2 = 0;n2 < r; n2++)
|
|
62073
|
+
e[n2] !== t2[n2] && f2.push(n2);
|
|
62074
|
+
return {
|
|
62075
|
+
lines: f2,
|
|
62076
|
+
numLinesBefore: e.length,
|
|
62077
|
+
numLinesAfter: t2.length,
|
|
62078
|
+
numLines: r
|
|
62079
|
+
};
|
|
62080
|
+
}
|
|
62081
|
+
var R = globalThis.process.platform.startsWith("win");
|
|
62082
|
+
var CANCEL_SYMBOL = Symbol("clack:cancel");
|
|
62083
|
+
function isCancel(e) {
|
|
62084
|
+
return e === CANCEL_SYMBOL;
|
|
62085
|
+
}
|
|
62086
|
+
function setRawMode(e, r) {
|
|
62087
|
+
const o2 = e;
|
|
62088
|
+
o2.isTTY && o2.setRawMode(r);
|
|
62089
|
+
}
|
|
62090
|
+
var getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80;
|
|
62091
|
+
var getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20;
|
|
62092
|
+
function wrapTextWithPrefix(e, r, o2, t2 = o2, s = o2, n2) {
|
|
62093
|
+
const f2 = getColumns(e ?? stdout);
|
|
62094
|
+
return wrapAnsi(r, f2 - o2.length, {
|
|
62095
|
+
hard: true,
|
|
62096
|
+
trim: false
|
|
62097
|
+
}).split(`
|
|
62098
|
+
`).map((c4, i2, m2) => {
|
|
62099
|
+
const d = n2 ? n2(c4, i2) : c4;
|
|
62100
|
+
return i2 === 0 ? `${t2}${d}` : i2 === m2.length - 1 ? `${s}${d}` : `${o2}${d}`;
|
|
62101
|
+
}).join(`
|
|
62102
|
+
`);
|
|
62103
|
+
}
|
|
62104
|
+
function runValidation(e, n2) {
|
|
62105
|
+
if ("~standard" in e) {
|
|
62106
|
+
const a2 = e["~standard"].validate(n2);
|
|
62107
|
+
if (a2 instanceof Promise)
|
|
62108
|
+
throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
|
|
62109
|
+
return a2.issues?.at(0)?.message;
|
|
62110
|
+
}
|
|
62111
|
+
return e(n2);
|
|
62112
|
+
}
|
|
62113
|
+
|
|
62114
|
+
class V {
|
|
62115
|
+
input;
|
|
62116
|
+
output;
|
|
62117
|
+
_abortSignal;
|
|
62118
|
+
rl;
|
|
62119
|
+
opts;
|
|
62120
|
+
_render;
|
|
62121
|
+
_track = false;
|
|
62122
|
+
_prevFrame = "";
|
|
62123
|
+
_subscribers = /* @__PURE__ */ new Map;
|
|
62124
|
+
_cursor = 0;
|
|
62125
|
+
state = "initial";
|
|
62126
|
+
error = "";
|
|
62127
|
+
value;
|
|
62128
|
+
userInput = "";
|
|
62129
|
+
constructor(t2, e = true) {
|
|
62130
|
+
const { input: i2 = stdin, output: n2 = stdout, render: s, signal: r, ...o2 } = t2;
|
|
62131
|
+
this.opts = o2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i2, this.output = n2;
|
|
62132
|
+
}
|
|
62133
|
+
unsubscribe() {
|
|
62134
|
+
this._subscribers.clear();
|
|
62135
|
+
}
|
|
62136
|
+
setSubscriber(t2, e) {
|
|
62137
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
62138
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
62139
|
+
}
|
|
62140
|
+
on(t2, e) {
|
|
62141
|
+
this.setSubscriber(t2, { cb: e });
|
|
62142
|
+
}
|
|
62143
|
+
once(t2, e) {
|
|
62144
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
62145
|
+
}
|
|
62146
|
+
emit(t2, ...e) {
|
|
62147
|
+
const i2 = this._subscribers.get(t2) ?? [], n2 = [];
|
|
62148
|
+
for (const s of i2)
|
|
62149
|
+
s.cb(...e), s.once && n2.push(() => i2.splice(i2.indexOf(s), 1));
|
|
62150
|
+
for (const s of n2)
|
|
62151
|
+
s();
|
|
62152
|
+
}
|
|
62153
|
+
prompt() {
|
|
62154
|
+
return new Promise((t2) => {
|
|
62155
|
+
if (this._abortSignal) {
|
|
62156
|
+
if (this._abortSignal.aborted)
|
|
62157
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
62158
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
62159
|
+
this.state = "cancel", this.close();
|
|
62160
|
+
}, { once: true });
|
|
62161
|
+
}
|
|
62162
|
+
this.rl = l__default.createInterface({
|
|
62163
|
+
input: this.input,
|
|
62164
|
+
tabSize: 2,
|
|
62165
|
+
prompt: "",
|
|
62166
|
+
escapeCodeTimeout: 50,
|
|
62167
|
+
terminal: true
|
|
62168
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
62169
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
62170
|
+
}), this.once("cancel", () => {
|
|
62171
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
62172
|
+
});
|
|
62173
|
+
});
|
|
62174
|
+
}
|
|
62175
|
+
_isActionKey(t2, e) {
|
|
62176
|
+
return t2 === "\t";
|
|
62177
|
+
}
|
|
62178
|
+
_shouldSubmit(t2, e) {
|
|
62179
|
+
return true;
|
|
62180
|
+
}
|
|
62181
|
+
_setValue(t2) {
|
|
62182
|
+
this.value = t2, this.emit("value", this.value);
|
|
62183
|
+
}
|
|
62184
|
+
_setUserInput(t2, e) {
|
|
62185
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
62186
|
+
}
|
|
62187
|
+
_clearUserInput() {
|
|
62188
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
62189
|
+
}
|
|
62190
|
+
onKeypress(t2, e) {
|
|
62191
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
62192
|
+
if (this.opts.validate) {
|
|
62193
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
62194
|
+
i2 && (this.error = i2 instanceof Error ? i2.message : i2, this.state = "error", this.rl?.write(this.userInput));
|
|
62195
|
+
}
|
|
62196
|
+
this.state !== "error" && (this.state = "submit");
|
|
62197
|
+
}
|
|
62198
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
62199
|
+
}
|
|
62200
|
+
close() {
|
|
62201
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
62202
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
62203
|
+
}
|
|
62204
|
+
restoreCursor() {
|
|
62205
|
+
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
62206
|
+
`).length - 1;
|
|
62207
|
+
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
62208
|
+
}
|
|
62209
|
+
render() {
|
|
62210
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
62211
|
+
hard: true,
|
|
62212
|
+
trim: false
|
|
62213
|
+
});
|
|
62214
|
+
if (t2 !== this._prevFrame) {
|
|
62215
|
+
if (this.state === "initial")
|
|
62216
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
62217
|
+
else {
|
|
62218
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
62219
|
+
if (this.restoreCursor(), e) {
|
|
62220
|
+
const n2 = Math.max(0, e.numLinesAfter - i2), s = Math.max(0, e.numLinesBefore - i2);
|
|
62221
|
+
let r = e.lines.find((o2) => o2 >= n2);
|
|
62222
|
+
if (r === undefined) {
|
|
62223
|
+
this._prevFrame = t2;
|
|
62224
|
+
return;
|
|
62225
|
+
}
|
|
62226
|
+
if (e.lines.length === 1) {
|
|
62227
|
+
this.output.write(import_sisteransi.cursor.move(0, r - s)), this.output.write(import_sisteransi.erase.lines(1));
|
|
62228
|
+
const o2 = t2.split(`
|
|
62229
|
+
`);
|
|
62230
|
+
this.output.write(o2[r]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o2.length - r - 1));
|
|
62231
|
+
return;
|
|
62232
|
+
} else if (e.lines.length > 1) {
|
|
62233
|
+
if (n2 < s)
|
|
62234
|
+
r = n2;
|
|
62235
|
+
else {
|
|
62236
|
+
const h2 = r - s;
|
|
62237
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
62238
|
+
}
|
|
62239
|
+
this.output.write(import_sisteransi.erase.down());
|
|
62240
|
+
const f2 = t2.split(`
|
|
62241
|
+
`).slice(r);
|
|
62242
|
+
this.output.write(f2.join(`
|
|
62243
|
+
`)), this._prevFrame = t2;
|
|
62244
|
+
return;
|
|
62245
|
+
}
|
|
62246
|
+
}
|
|
62247
|
+
this.output.write(import_sisteransi.erase.down());
|
|
62248
|
+
}
|
|
62249
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
62250
|
+
}
|
|
62251
|
+
}
|
|
62252
|
+
}
|
|
62253
|
+
function p$1(l, e) {
|
|
62254
|
+
if (l === undefined || e.length === 0)
|
|
62255
|
+
return 0;
|
|
62256
|
+
const i2 = e.findIndex((s) => s.value === l);
|
|
62257
|
+
return i2 !== -1 ? i2 : 0;
|
|
62258
|
+
}
|
|
62259
|
+
function g(l, e) {
|
|
62260
|
+
return (e.label ?? String(e.value)).toLowerCase().includes(l.toLowerCase());
|
|
62261
|
+
}
|
|
62262
|
+
function m2(l, e) {
|
|
62263
|
+
if (e)
|
|
62264
|
+
return l ? e : e[0];
|
|
62265
|
+
}
|
|
62266
|
+
var T$1 = class T extends V {
|
|
62267
|
+
filteredOptions;
|
|
62268
|
+
multiple;
|
|
62269
|
+
isNavigating = false;
|
|
62270
|
+
selectedValues = [];
|
|
62271
|
+
focusedValue;
|
|
62272
|
+
#e = 0;
|
|
62273
|
+
#s = "";
|
|
62274
|
+
#t;
|
|
62275
|
+
#i;
|
|
62276
|
+
#n;
|
|
62277
|
+
get cursor() {
|
|
62278
|
+
return this.#e;
|
|
62279
|
+
}
|
|
62280
|
+
get userInputWithCursor() {
|
|
62281
|
+
if (!this.userInput)
|
|
62282
|
+
return styleText(["inverse", "hidden"], "_");
|
|
62283
|
+
if (this._cursor >= this.userInput.length)
|
|
62284
|
+
return `${this.userInput}\u2588`;
|
|
62285
|
+
const e = this.userInput.slice(0, this._cursor), [t2, ...i2] = this.userInput.slice(this._cursor);
|
|
62286
|
+
return `${e}${styleText("inverse", t2)}${i2.join("")}`;
|
|
62287
|
+
}
|
|
62288
|
+
get options() {
|
|
62289
|
+
return typeof this.#i == "function" ? this.#i() : this.#i;
|
|
62290
|
+
}
|
|
62291
|
+
constructor(e) {
|
|
62292
|
+
super(e), this.#i = e.options, this.#n = e.placeholder;
|
|
62293
|
+
const t2 = this.options;
|
|
62294
|
+
this.filteredOptions = [...t2], this.multiple = e.multiple === true, this.#t = typeof e.options == "function" ? e.filter : e.filter ?? g;
|
|
62295
|
+
let i2;
|
|
62296
|
+
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i2 = e.initialValue : i2 = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i2 = [this.options[0].value]), i2)
|
|
62297
|
+
for (const s of i2) {
|
|
62298
|
+
const n2 = t2.findIndex((o2) => o2.value === s);
|
|
62299
|
+
n2 !== -1 && (this.toggleSelected(s), this.#e = n2);
|
|
62300
|
+
}
|
|
62301
|
+
this.focusedValue = this.options[this.#e]?.value, this.on("key", (s, n2) => this.#l(s, n2)), this.on("userInput", (s) => this.#u(s));
|
|
62302
|
+
}
|
|
62303
|
+
_isActionKey(e, t2) {
|
|
62304
|
+
return e === "\t" || this.multiple && this.isNavigating && t2.name === "space" && e !== undefined && e !== "";
|
|
62305
|
+
}
|
|
62306
|
+
#l(e, t2) {
|
|
62307
|
+
const i2 = t2.name === "up", s = t2.name === "down", n2 = t2.name === "return", o2 = this.userInput === "" || this.userInput === "\t", u2 = this.#n, h2 = this.options, f2 = u2 !== undefined && u2 !== "" && h2.some((r) => !r.disabled && (this.#t ? this.#t(u2, r) : true));
|
|
62308
|
+
if (t2.name === "tab" && o2 && f2) {
|
|
62309
|
+
this.userInput === "\t" && this._clearUserInput(), this._setUserInput(u2, true), this.isNavigating = false;
|
|
62310
|
+
return;
|
|
62311
|
+
}
|
|
62312
|
+
i2 || s ? (this.#e = findCursor(this.#e, i2 ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n2 ? this.value = m2(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (t2.name === "tab" || this.isNavigating && t2.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
|
|
62313
|
+
}
|
|
62314
|
+
deselectAll() {
|
|
62315
|
+
this.selectedValues = [];
|
|
62316
|
+
}
|
|
62317
|
+
toggleSelected(e) {
|
|
62318
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((t2) => t2 !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
62319
|
+
}
|
|
62320
|
+
#u(e) {
|
|
62321
|
+
if (e !== this.#s) {
|
|
62322
|
+
this.#s = e;
|
|
62323
|
+
const t2 = this.options;
|
|
62324
|
+
e && this.#t ? this.filteredOptions = t2.filter((n2) => this.#t?.(e, n2)) : this.filteredOptions = [...t2];
|
|
62325
|
+
const i2 = p$1(this.focusedValue, this.filteredOptions);
|
|
62326
|
+
this.#e = findCursor(i2, 0, this.filteredOptions);
|
|
62327
|
+
const s = this.filteredOptions[this.#e];
|
|
62328
|
+
s && !s.disabled ? this.focusedValue = s.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
62329
|
+
}
|
|
62330
|
+
}
|
|
62331
|
+
};
|
|
62332
|
+
var _ = {
|
|
62333
|
+
Y: { type: "year", len: 4 },
|
|
62334
|
+
M: { type: "month", len: 2 },
|
|
62335
|
+
D: { type: "day", len: 2 }
|
|
62336
|
+
};
|
|
62337
|
+
function M(r) {
|
|
62338
|
+
return [...r].map((t2) => _[t2]);
|
|
62339
|
+
}
|
|
62340
|
+
function P(r) {
|
|
62341
|
+
const i2 = new Intl.DateTimeFormat(r, {
|
|
62342
|
+
year: "numeric",
|
|
62343
|
+
month: "2-digit",
|
|
62344
|
+
day: "2-digit"
|
|
62345
|
+
}).formatToParts(new Date(2000, 0, 15)), s = [];
|
|
62346
|
+
let n2 = "/";
|
|
62347
|
+
for (const e of i2)
|
|
62348
|
+
e.type === "literal" ? n2 = e.value.trim() || e.value : (e.type === "year" || e.type === "month" || e.type === "day") && s.push({ type: e.type, len: e.type === "year" ? 4 : 2 });
|
|
62349
|
+
return { segments: s, separator: n2 };
|
|
62350
|
+
}
|
|
62351
|
+
function p2(r) {
|
|
62352
|
+
return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
|
|
62353
|
+
}
|
|
62354
|
+
function f2(r) {
|
|
62355
|
+
return {
|
|
62356
|
+
year: p2(r.year),
|
|
62357
|
+
month: p2(r.month),
|
|
62358
|
+
day: p2(r.day)
|
|
62359
|
+
};
|
|
62360
|
+
}
|
|
62361
|
+
function c4(r, t2) {
|
|
62362
|
+
return new Date(r || 2001, t2 || 1, 0).getDate();
|
|
62363
|
+
}
|
|
62364
|
+
function b2(r) {
|
|
62365
|
+
const { year: t2, month: i2, day: s } = f2(r);
|
|
62366
|
+
if (!t2 || t2 < 0 || t2 > 9999 || !i2 || i2 < 1 || i2 > 12 || !s || s < 1)
|
|
62367
|
+
return;
|
|
62368
|
+
const n2 = new Date(Date.UTC(t2, i2 - 1, s));
|
|
62369
|
+
if (!(n2.getUTCFullYear() !== t2 || n2.getUTCMonth() !== i2 - 1 || n2.getUTCDate() !== s))
|
|
62370
|
+
return { year: t2, month: i2, day: s };
|
|
62371
|
+
}
|
|
62372
|
+
function C(r) {
|
|
62373
|
+
const t2 = b2(r);
|
|
62374
|
+
return t2 ? new Date(Date.UTC(t2.year, t2.month - 1, t2.day)) : undefined;
|
|
62375
|
+
}
|
|
62376
|
+
function T2(r, t2, i2, s) {
|
|
62377
|
+
const n2 = i2 ? {
|
|
62378
|
+
year: i2.getUTCFullYear(),
|
|
62379
|
+
month: i2.getUTCMonth() + 1,
|
|
62380
|
+
day: i2.getUTCDate()
|
|
62381
|
+
} : null, e = s ? {
|
|
62382
|
+
year: s.getUTCFullYear(),
|
|
62383
|
+
month: s.getUTCMonth() + 1,
|
|
62384
|
+
day: s.getUTCDate()
|
|
62385
|
+
} : null;
|
|
62386
|
+
return r === "year" ? { min: n2?.year ?? 1, max: e?.year ?? 9999 } : r === "month" ? {
|
|
62387
|
+
min: n2 && t2.year === n2.year ? n2.month : 1,
|
|
62388
|
+
max: e && t2.year === e.year ? e.month : 12
|
|
62389
|
+
} : {
|
|
62390
|
+
min: n2 && t2.year === n2.year && t2.month === n2.month ? n2.day : 1,
|
|
62391
|
+
max: e && t2.year === e.year && t2.month === e.month ? e.day : c4(t2.year, t2.month)
|
|
62392
|
+
};
|
|
62393
|
+
}
|
|
62394
|
+
|
|
62395
|
+
class U extends V {
|
|
62396
|
+
#i;
|
|
62397
|
+
#o;
|
|
62398
|
+
#t;
|
|
62399
|
+
#h;
|
|
62400
|
+
#u;
|
|
62401
|
+
#e = { segmentIndex: 0, positionInSegment: 0 };
|
|
62402
|
+
#n = true;
|
|
62403
|
+
#s = null;
|
|
62404
|
+
inlineError = "";
|
|
62405
|
+
get segmentCursor() {
|
|
62406
|
+
return { ...this.#e };
|
|
62407
|
+
}
|
|
62408
|
+
get segmentValues() {
|
|
62409
|
+
return { ...this.#t };
|
|
62410
|
+
}
|
|
62411
|
+
get segments() {
|
|
62412
|
+
return this.#i;
|
|
62413
|
+
}
|
|
62414
|
+
get separator() {
|
|
62415
|
+
return this.#o;
|
|
62416
|
+
}
|
|
62417
|
+
get formattedValue() {
|
|
62418
|
+
return this.#l(this.#t);
|
|
62419
|
+
}
|
|
62420
|
+
#l(t2) {
|
|
62421
|
+
return this.#i.map((i2) => t2[i2.type]).join(this.#o);
|
|
62422
|
+
}
|
|
62423
|
+
#r() {
|
|
62424
|
+
this._setUserInput(this.#l(this.#t)), this._setValue(C(this.#t) ?? undefined);
|
|
62425
|
+
}
|
|
62426
|
+
constructor(t2) {
|
|
62427
|
+
const i2 = t2.format ? { segments: M(t2.format), separator: t2.separator ?? "/" } : P(t2.locale), s = t2.separator ?? i2.separator, n2 = t2.format ? M(t2.format) : i2.segments, e = t2.initialValue ?? t2.defaultValue, m3 = e ? {
|
|
62428
|
+
year: String(e.getUTCFullYear()).padStart(4, "0"),
|
|
62429
|
+
month: String(e.getUTCMonth() + 1).padStart(2, "0"),
|
|
62430
|
+
day: String(e.getUTCDate()).padStart(2, "0")
|
|
62431
|
+
} : { year: "____", month: "__", day: "__" }, o2 = n2.map((a2) => m3[a2.type]).join(s);
|
|
62432
|
+
super({ ...t2, initialUserInput: o2 }, false), this.#i = n2, this.#o = s, this.#t = m3, this.#h = t2.minDate, this.#u = t2.maxDate, this.#r(), this.on("cursor", (a2) => this.#f(a2)), this.on("key", (a2, u2) => this.#y(a2, u2)), this.on("finalize", () => this.#p(t2));
|
|
62433
|
+
}
|
|
62434
|
+
#a() {
|
|
62435
|
+
const t2 = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i2 = this.#i[t2];
|
|
62436
|
+
if (i2)
|
|
62437
|
+
return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i2.len - 1)), { segment: i2, index: t2 };
|
|
62438
|
+
}
|
|
62439
|
+
#m(t2) {
|
|
62440
|
+
this.inlineError = "", this.#s = null;
|
|
62441
|
+
const i2 = this.#a();
|
|
62442
|
+
i2 && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i2.index + t2)), this.#e.positionInSegment = 0, this.#n = true);
|
|
62443
|
+
}
|
|
62444
|
+
#d(t2) {
|
|
62445
|
+
const i2 = this.#a();
|
|
62446
|
+
if (!i2)
|
|
62447
|
+
return;
|
|
62448
|
+
const { segment: s } = i2, n2 = this.#t[s.type], e = !n2 || n2.replace(/_/g, "") === "", m3 = Number.parseInt((n2 || "0").replace(/_/g, "0"), 10) || 0, o2 = T2(s.type, f2(this.#t), this.#h, this.#u);
|
|
62449
|
+
let a2;
|
|
62450
|
+
e ? a2 = t2 === 1 ? o2.min : o2.max : a2 = Math.max(Math.min(o2.max, m3 + t2), o2.min), this.#t = {
|
|
62451
|
+
...this.#t,
|
|
62452
|
+
[s.type]: a2.toString().padStart(s.len, "0")
|
|
62453
|
+
}, this.#n = true, this.#s = null, this.#r();
|
|
62454
|
+
}
|
|
62455
|
+
#f(t2) {
|
|
62456
|
+
if (t2)
|
|
62457
|
+
switch (t2) {
|
|
62458
|
+
case "right":
|
|
62459
|
+
return this.#m(1);
|
|
62460
|
+
case "left":
|
|
62461
|
+
return this.#m(-1);
|
|
62462
|
+
case "up":
|
|
62463
|
+
return this.#d(1);
|
|
62464
|
+
case "down":
|
|
62465
|
+
return this.#d(-1);
|
|
62466
|
+
}
|
|
62467
|
+
}
|
|
62468
|
+
#y(t2, i2) {
|
|
62469
|
+
if (i2?.name === "backspace" || i2?.sequence === "\x7F" || i2?.sequence === "\b" || t2 === "\x7F" || t2 === "\b") {
|
|
62470
|
+
this.inlineError = "";
|
|
62471
|
+
const n2 = this.#a();
|
|
62472
|
+
if (!n2)
|
|
62473
|
+
return;
|
|
62474
|
+
if (!this.#t[n2.segment.type].replace(/_/g, "")) {
|
|
62475
|
+
this.#m(-1);
|
|
62476
|
+
return;
|
|
62477
|
+
}
|
|
62478
|
+
this.#t[n2.segment.type] = "_".repeat(n2.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
|
|
62479
|
+
return;
|
|
62480
|
+
}
|
|
62481
|
+
if (i2?.name === "tab") {
|
|
62482
|
+
this.inlineError = "";
|
|
62483
|
+
const n2 = this.#a();
|
|
62484
|
+
if (!n2)
|
|
62485
|
+
return;
|
|
62486
|
+
const e = i2.shift ? -1 : 1, m3 = n2.index + e;
|
|
62487
|
+
m3 >= 0 && m3 < this.#i.length && (this.#e.segmentIndex = m3, this.#e.positionInSegment = 0, this.#n = true);
|
|
62488
|
+
return;
|
|
62489
|
+
}
|
|
62490
|
+
if (t2 && /^[0-9]$/.test(t2)) {
|
|
62491
|
+
const n2 = this.#a();
|
|
62492
|
+
if (!n2)
|
|
62493
|
+
return;
|
|
62494
|
+
const { segment: e } = n2, m3 = !this.#t[e.type].replace(/_/g, "");
|
|
62495
|
+
if (this.#n && this.#s !== null && !m3) {
|
|
62496
|
+
const h2 = this.#s + t2, d = { ...this.#t, [e.type]: h2 }, g2 = this.#g(d, e);
|
|
62497
|
+
if (g2) {
|
|
62498
|
+
this.inlineError = g2, this.#s = null, this.#n = false;
|
|
62499
|
+
return;
|
|
62500
|
+
}
|
|
62501
|
+
this.inlineError = "", this.#t[e.type] = h2, this.#s = null, this.#n = false, this.#r(), n2.index < this.#i.length - 1 && (this.#e.segmentIndex = n2.index + 1, this.#e.positionInSegment = 0, this.#n = true);
|
|
62502
|
+
return;
|
|
62503
|
+
}
|
|
62504
|
+
this.#n && !m3 && (this.#t[e.type] = "_".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
|
|
62505
|
+
const o2 = this.#t[e.type], a2 = o2.indexOf("_"), u2 = a2 >= 0 ? a2 : Math.min(this.#e.positionInSegment, e.len - 1);
|
|
62506
|
+
if (u2 < 0 || u2 >= e.len)
|
|
62507
|
+
return;
|
|
62508
|
+
let l = o2.slice(0, u2) + t2 + o2.slice(u2 + 1), D = false;
|
|
62509
|
+
if (u2 === 0 && o2 === "__" && (e.type === "month" || e.type === "day")) {
|
|
62510
|
+
const h2 = Number.parseInt(t2, 10);
|
|
62511
|
+
l = `0${t2}`, D = h2 <= (e.type === "month" ? 1 : 2);
|
|
62512
|
+
}
|
|
62513
|
+
if (e.type === "year" && (l = (o2.replace(/_/g, "") + t2).padStart(e.len, "_")), !l.includes("_")) {
|
|
62514
|
+
const h2 = { ...this.#t, [e.type]: l }, d = this.#g(h2, e);
|
|
62515
|
+
if (d) {
|
|
62516
|
+
this.inlineError = d;
|
|
62517
|
+
return;
|
|
62518
|
+
}
|
|
62519
|
+
}
|
|
62520
|
+
this.inlineError = "", this.#t[e.type] = l;
|
|
62521
|
+
const y = l.includes("_") ? undefined : b2(this.#t);
|
|
62522
|
+
if (y) {
|
|
62523
|
+
const { year: h2, month: d } = y, g2 = c4(h2, d);
|
|
62524
|
+
this.#t = {
|
|
62525
|
+
year: String(Math.max(0, Math.min(9999, h2))).padStart(4, "0"),
|
|
62526
|
+
month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
|
|
62527
|
+
day: String(Math.max(1, Math.min(g2, y.day))).padStart(2, "0")
|
|
62528
|
+
};
|
|
62529
|
+
}
|
|
62530
|
+
this.#r();
|
|
62531
|
+
const S = l.indexOf("_");
|
|
62532
|
+
D ? (this.#n = true, this.#s = t2) : S >= 0 ? this.#e.positionInSegment = S : a2 >= 0 && n2.index < this.#i.length - 1 ? (this.#e.segmentIndex = n2.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u2 + 1, e.len - 1);
|
|
62533
|
+
}
|
|
62534
|
+
}
|
|
62535
|
+
#g(t2, i2) {
|
|
62536
|
+
const { month: s, day: n2 } = f2(t2);
|
|
62537
|
+
if (i2.type === "month" && (s < 0 || s > 12))
|
|
62538
|
+
return settings.date.messages.invalidMonth;
|
|
62539
|
+
if (i2.type === "day" && (n2 < 0 || n2 > 31))
|
|
62540
|
+
return settings.date.messages.invalidDay(31, "any month");
|
|
62541
|
+
}
|
|
62542
|
+
#p(t2) {
|
|
62543
|
+
const { year: i2, month: s, day: n2 } = f2(this.#t);
|
|
62544
|
+
if (i2 && s && n2) {
|
|
62545
|
+
const e = c4(i2, s);
|
|
62546
|
+
this.#t = {
|
|
62547
|
+
...this.#t,
|
|
62548
|
+
day: String(Math.min(n2, e)).padStart(2, "0")
|
|
62549
|
+
};
|
|
62550
|
+
}
|
|
62551
|
+
this.value = C(this.#t) ?? t2.defaultValue ?? undefined;
|
|
62552
|
+
}
|
|
62553
|
+
}
|
|
62554
|
+
var u$1 = class u2 extends V {
|
|
62555
|
+
options;
|
|
62556
|
+
cursor = 0;
|
|
62557
|
+
#t;
|
|
62558
|
+
getGroupItems(t2) {
|
|
62559
|
+
return this.options.filter((r) => r.group === t2);
|
|
62560
|
+
}
|
|
62561
|
+
isGroupSelected(t2) {
|
|
62562
|
+
const r = this.getGroupItems(t2), e = this.value;
|
|
62563
|
+
return e === undefined ? false : r.every((s) => e.includes(s.value));
|
|
62564
|
+
}
|
|
62565
|
+
toggleValue() {
|
|
62566
|
+
const t2 = this.options[this.cursor];
|
|
62567
|
+
if (this.value === undefined && (this.value = []), t2.group === true) {
|
|
62568
|
+
const r = t2.value, e = this.getGroupItems(r);
|
|
62569
|
+
this.isGroupSelected(r) ? this.value = this.value.filter((s) => e.findIndex((i2) => i2.value === s) === -1) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
|
|
62570
|
+
} else {
|
|
62571
|
+
const r = this.value.includes(t2.value);
|
|
62572
|
+
this.value = r ? this.value.filter((e) => e !== t2.value) : [...this.value, t2.value];
|
|
62573
|
+
}
|
|
62574
|
+
}
|
|
62575
|
+
constructor(t2) {
|
|
62576
|
+
super(t2, false);
|
|
62577
|
+
const { options: r } = t2;
|
|
62578
|
+
this.#t = t2.selectableGroups !== false, this.options = Object.entries(r).flatMap(([e, s]) => [
|
|
62579
|
+
{ value: e, group: true, label: e },
|
|
62580
|
+
...s.map((i2) => ({ ...i2, group: e }))
|
|
62581
|
+
]), this.value = [...t2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === t2.cursorAt), this.#t ? 0 : 1), this.on("cursor", (e) => {
|
|
62582
|
+
switch (e) {
|
|
62583
|
+
case "left":
|
|
62584
|
+
case "up": {
|
|
62585
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
62586
|
+
const s = this.options[this.cursor]?.group === true;
|
|
62587
|
+
!this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
62588
|
+
break;
|
|
62589
|
+
}
|
|
62590
|
+
case "down":
|
|
62591
|
+
case "right": {
|
|
62592
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
62593
|
+
const s = this.options[this.cursor]?.group === true;
|
|
62594
|
+
!this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
62595
|
+
break;
|
|
62596
|
+
}
|
|
62597
|
+
case "space":
|
|
62598
|
+
this.toggleValue();
|
|
62599
|
+
break;
|
|
62600
|
+
}
|
|
62601
|
+
});
|
|
62602
|
+
}
|
|
62603
|
+
};
|
|
62604
|
+
var o$1 = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
|
|
62605
|
+
|
|
62606
|
+
class h2 extends V {
|
|
62607
|
+
#s = false;
|
|
62608
|
+
#t;
|
|
62609
|
+
focused = "editor";
|
|
62610
|
+
get userInputWithCursor() {
|
|
62611
|
+
if (this.state === "submit")
|
|
62612
|
+
return this.userInput;
|
|
62613
|
+
const t2 = this.userInput;
|
|
62614
|
+
if (this.cursor >= t2.length)
|
|
62615
|
+
return `${t2}\u2588`;
|
|
62616
|
+
const s = t2.slice(0, this.cursor), r = t2[this.cursor], e = t2.slice(this.cursor + 1);
|
|
62617
|
+
return r === `
|
|
62618
|
+
` ? `${s}\u2588
|
|
62619
|
+
${e}` : `${s}${styleText("inverse", r)}${e}`;
|
|
62620
|
+
}
|
|
62621
|
+
get cursor() {
|
|
62622
|
+
return this._cursor;
|
|
62623
|
+
}
|
|
62624
|
+
#r(t2) {
|
|
62625
|
+
if (this.userInput.length === 0) {
|
|
62626
|
+
this._setUserInput(t2);
|
|
62627
|
+
return;
|
|
62628
|
+
}
|
|
62629
|
+
this._setUserInput(this.userInput.slice(0, this.cursor) + t2 + this.userInput.slice(this.cursor));
|
|
62630
|
+
}
|
|
62631
|
+
#i(t2) {
|
|
62632
|
+
const s = this.value ?? "";
|
|
62633
|
+
switch (t2) {
|
|
62634
|
+
case "up":
|
|
62635
|
+
this._cursor = findTextCursor(this._cursor, 0, -1, s);
|
|
62636
|
+
return;
|
|
62637
|
+
case "down":
|
|
62638
|
+
this._cursor = findTextCursor(this._cursor, 0, 1, s);
|
|
62639
|
+
return;
|
|
62640
|
+
case "left":
|
|
62641
|
+
this._cursor = findTextCursor(this._cursor, -1, 0, s);
|
|
62642
|
+
return;
|
|
62643
|
+
case "right":
|
|
62644
|
+
this._cursor = findTextCursor(this._cursor, 1, 0, s);
|
|
62645
|
+
return;
|
|
62646
|
+
}
|
|
62647
|
+
}
|
|
62648
|
+
_shouldSubmit(t2, s) {
|
|
62649
|
+
if (this.#t)
|
|
62650
|
+
return this.focused === "submit" ? true : (this.#r(`
|
|
62651
|
+
`), this._cursor++, false);
|
|
62652
|
+
const r = this.#s;
|
|
62653
|
+
return this.#s = true, r ? (this.userInput[this.cursor - 1] === `
|
|
62654
|
+
` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#r(`
|
|
62655
|
+
`), this._cursor++, false);
|
|
62656
|
+
}
|
|
62657
|
+
constructor(t2) {
|
|
62658
|
+
super(t2, false), this.#t = t2.showSubmit ?? false, this.on("key", (s, r) => {
|
|
62659
|
+
if (r?.name && o$1.has(r.name)) {
|
|
62660
|
+
this.#i(r.name);
|
|
62661
|
+
return;
|
|
62662
|
+
}
|
|
62663
|
+
if (s === "\t" && this.#t) {
|
|
62664
|
+
this.focused = this.focused === "editor" ? "submit" : "editor";
|
|
62665
|
+
return;
|
|
62666
|
+
}
|
|
62667
|
+
if (r?.name !== "return") {
|
|
62668
|
+
if (this.#s = false, r?.name === "backspace" && this.cursor > 0) {
|
|
62669
|
+
this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
|
|
62670
|
+
return;
|
|
62671
|
+
}
|
|
62672
|
+
if (r?.name === "delete" && this.cursor < this.userInput.length) {
|
|
62673
|
+
this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
|
|
62674
|
+
return;
|
|
62675
|
+
}
|
|
62676
|
+
s && (this.#t && this.focused === "submit" && (this.focused = "editor"), this.#r(s ?? ""), this._cursor++);
|
|
62677
|
+
}
|
|
62678
|
+
}), this.on("userInput", (s) => {
|
|
62679
|
+
this._setValue(s);
|
|
62680
|
+
}), this.on("finalize", () => {
|
|
62681
|
+
this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
|
|
62682
|
+
});
|
|
62683
|
+
}
|
|
62684
|
+
}
|
|
62685
|
+
class a2 extends V {
|
|
62686
|
+
options;
|
|
62687
|
+
cursor = 0;
|
|
62688
|
+
get _selectedValue() {
|
|
62689
|
+
return this.options[this.cursor];
|
|
62690
|
+
}
|
|
62691
|
+
changeValue() {
|
|
62692
|
+
this.value = this._selectedValue.value;
|
|
62693
|
+
}
|
|
62694
|
+
constructor(t2) {
|
|
62695
|
+
super(t2, false), this.options = t2.options;
|
|
62696
|
+
const i2 = this.options.findIndex(({ value: s }) => s === t2.initialValue), e = i2 === -1 ? 0 : i2;
|
|
62697
|
+
this.cursor = this.options[e].disabled ? findCursor(e, 1, this.options) : e, this.changeValue(), this.on("cursor", (s) => {
|
|
62698
|
+
switch (s) {
|
|
62699
|
+
case "left":
|
|
62700
|
+
case "up":
|
|
62701
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
62702
|
+
break;
|
|
62703
|
+
case "down":
|
|
62704
|
+
case "right":
|
|
62705
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
62706
|
+
break;
|
|
62707
|
+
}
|
|
62708
|
+
this.changeValue();
|
|
62709
|
+
});
|
|
62710
|
+
}
|
|
62711
|
+
}
|
|
62712
|
+
class n2 extends V {
|
|
62713
|
+
get userInputWithCursor() {
|
|
62714
|
+
if (this.state === "submit")
|
|
62715
|
+
return this.userInput;
|
|
62716
|
+
const t2 = this.userInput;
|
|
62717
|
+
if (this.cursor >= t2.length)
|
|
62718
|
+
return `${this.userInput}\u2588`;
|
|
62719
|
+
const e = t2.slice(0, this.cursor), [s, ...r] = t2.slice(this.cursor);
|
|
62720
|
+
return `${e}${styleText("inverse", s)}${r.join("")}`;
|
|
62721
|
+
}
|
|
62722
|
+
get cursor() {
|
|
62723
|
+
return this._cursor;
|
|
62724
|
+
}
|
|
62725
|
+
constructor(t2) {
|
|
62726
|
+
super({
|
|
62727
|
+
...t2,
|
|
62728
|
+
initialUserInput: t2.initialUserInput ?? t2.initialValue
|
|
62729
|
+
}), this.on("userInput", (e) => {
|
|
62730
|
+
this._setValue(e);
|
|
62731
|
+
}), this.on("finalize", () => {
|
|
62732
|
+
this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
|
|
62733
|
+
});
|
|
62734
|
+
}
|
|
62735
|
+
}
|
|
62736
|
+
|
|
62737
|
+
// ../../node_modules/.bun/@clack+prompts@1.5.1/node_modules/@clack/prompts/dist/index.mjs
|
|
62738
|
+
import { styleText as styleText2, stripVTControlCharacters as stripVTControlCharacters2 } from "util";
|
|
62739
|
+
import process$1 from "process";
|
|
62740
|
+
var import_sisteransi2 = __toESM(require_src9(), 1);
|
|
62741
|
+
function isUnicodeSupported2() {
|
|
62742
|
+
if (process$1.platform !== "win32") {
|
|
62743
|
+
return process$1.env.TERM !== "linux";
|
|
62744
|
+
}
|
|
62745
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
62746
|
+
}
|
|
62747
|
+
var unicode = isUnicodeSupported2();
|
|
62748
|
+
var unicodeOr = (e, o3) => unicode ? e : o3;
|
|
62749
|
+
var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
62750
|
+
var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
62751
|
+
var S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
62752
|
+
var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
62753
|
+
var S_BAR_START = unicodeOr("\u250C", "T");
|
|
62754
|
+
var S_BAR = unicodeOr("\u2502", "|");
|
|
62755
|
+
var S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
62756
|
+
var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
62757
|
+
var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
62758
|
+
var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
62759
|
+
var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
62760
|
+
var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
62761
|
+
var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
62762
|
+
var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
62763
|
+
var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
62764
|
+
var S_BAR_H = unicodeOr("\u2500", "-");
|
|
62765
|
+
var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
62766
|
+
var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
62767
|
+
var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
62768
|
+
var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
62769
|
+
var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
62770
|
+
var S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
62771
|
+
var S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
62772
|
+
var S_WARN = unicodeOr("\u25B2", "!");
|
|
62773
|
+
var S_ERROR = unicodeOr("\u25A0", "x");
|
|
62774
|
+
var symbol2 = (e) => {
|
|
62775
|
+
switch (e) {
|
|
62776
|
+
case "initial":
|
|
62777
|
+
case "active":
|
|
62778
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
62779
|
+
case "cancel":
|
|
62780
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
62781
|
+
case "error":
|
|
62782
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
62783
|
+
case "submit":
|
|
62784
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
62785
|
+
}
|
|
62786
|
+
};
|
|
62787
|
+
var symbolBar = (e) => {
|
|
62788
|
+
switch (e) {
|
|
62789
|
+
case "initial":
|
|
62790
|
+
case "active":
|
|
62791
|
+
return styleText2("cyan", S_BAR);
|
|
62792
|
+
case "cancel":
|
|
62793
|
+
return styleText2("red", S_BAR);
|
|
62794
|
+
case "error":
|
|
62795
|
+
return styleText2("yellow", S_BAR);
|
|
62796
|
+
case "submit":
|
|
62797
|
+
return styleText2("green", S_BAR);
|
|
62798
|
+
}
|
|
62799
|
+
};
|
|
62800
|
+
var E$1 = (l, o3, g2, c5, h3, O = false) => {
|
|
62801
|
+
let r2 = o3, w = 0;
|
|
62802
|
+
if (O)
|
|
62803
|
+
for (let i2 = c5 - 1;i2 >= g2 && (r2 -= l[i2].length, w++, !(r2 <= h3)); i2--)
|
|
62804
|
+
;
|
|
62805
|
+
else
|
|
62806
|
+
for (let i2 = g2;i2 < c5 && (r2 -= l[i2].length, w++, !(r2 <= h3)); i2++)
|
|
62807
|
+
;
|
|
62808
|
+
return { lineCount: r2, removals: w };
|
|
62809
|
+
};
|
|
62810
|
+
var limitOptions = ({
|
|
62811
|
+
cursor: l,
|
|
62812
|
+
options: o3,
|
|
62813
|
+
style: g2,
|
|
62814
|
+
output: c5 = process.stdout,
|
|
62815
|
+
maxItems: h3 = Number.POSITIVE_INFINITY,
|
|
62816
|
+
columnPadding: O = 0,
|
|
62817
|
+
rowPadding: r2 = 4
|
|
62818
|
+
}) => {
|
|
62819
|
+
const i2 = getColumns(c5) - O, I = getRows(c5), C2 = styleText2("dim", "..."), x = Math.max(I - r2, 0), m3 = Math.max(Math.min(h3, x), 5);
|
|
62820
|
+
let p3 = 0;
|
|
62821
|
+
l >= m3 - 3 && (p3 = Math.max(Math.min(l - m3 + 3, o3.length - m3), 0));
|
|
62822
|
+
let f3 = m3 < o3.length && p3 > 0, u4 = m3 < o3.length && p3 + m3 < o3.length;
|
|
62823
|
+
const W = Math.min(p3 + m3, o3.length), e = [];
|
|
62824
|
+
let d = 0;
|
|
62825
|
+
f3 && d++, u4 && d++;
|
|
62826
|
+
const v = p3 + (f3 ? 1 : 0), P2 = W - (u4 ? 1 : 0);
|
|
62827
|
+
for (let t2 = v;t2 < P2; t2++) {
|
|
62828
|
+
const n3 = wrapAnsi(g2(o3[t2], t2 === l), i2, {
|
|
62829
|
+
hard: true,
|
|
62830
|
+
trim: false
|
|
62831
|
+
}).split(`
|
|
62832
|
+
`);
|
|
62833
|
+
e.push(n3), d += n3.length;
|
|
62834
|
+
}
|
|
62835
|
+
if (d > x) {
|
|
62836
|
+
let t2 = 0, n3 = 0, s = d;
|
|
62837
|
+
const M2 = l - v;
|
|
62838
|
+
let a3 = x;
|
|
62839
|
+
const T3 = () => E$1(e, s, 0, M2, a3), L = () => E$1(e, s, M2 + 1, e.length, a3, true);
|
|
62840
|
+
f3 ? ({ lineCount: s, removals: t2 } = T3(), s > a3 && (u4 || (a3 -= 1), { lineCount: s, removals: n3 } = L())) : (u4 || (a3 -= 1), { lineCount: s, removals: n3 } = L(), s > a3 && (a3 -= 1, { lineCount: s, removals: t2 } = T3())), t2 > 0 && (f3 = true, e.splice(0, t2)), n3 > 0 && (u4 = true, e.splice(e.length - n3, n3));
|
|
62841
|
+
}
|
|
62842
|
+
const b3 = [];
|
|
62843
|
+
f3 && b3.push(C2);
|
|
62844
|
+
for (const t2 of e)
|
|
62845
|
+
for (const n3 of t2)
|
|
62846
|
+
b3.push(n3);
|
|
62847
|
+
return u4 && b3.push(C2), b3;
|
|
62848
|
+
};
|
|
62849
|
+
var u4 = {
|
|
62850
|
+
light: unicodeOr("\u2500", "-"),
|
|
62851
|
+
heavy: unicodeOr("\u2501", "="),
|
|
62852
|
+
block: unicodeOr("\u2588", "#")
|
|
62853
|
+
};
|
|
62854
|
+
var c5 = (e, a3) => e.includes(`
|
|
62855
|
+
`) ? e.split(`
|
|
62856
|
+
`).map((t2) => a3(t2)).join(`
|
|
62857
|
+
`) : a3(e);
|
|
62858
|
+
var select3 = (e) => {
|
|
62859
|
+
const a3 = (t2, d) => {
|
|
62860
|
+
const s = t2.label ?? String(t2.value);
|
|
62861
|
+
switch (d) {
|
|
62862
|
+
case "disabled":
|
|
62863
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c5(s, (n3) => styleText2("gray", n3))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}`;
|
|
62864
|
+
case "selected":
|
|
62865
|
+
return `${c5(s, (n3) => styleText2("dim", n3))}`;
|
|
62866
|
+
case "active":
|
|
62867
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}`;
|
|
62868
|
+
case "cancelled":
|
|
62869
|
+
return `${c5(s, (n3) => styleText2(["strikethrough", "dim"], n3))}`;
|
|
62870
|
+
default:
|
|
62871
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c5(s, (n3) => styleText2("dim", n3))}`;
|
|
62872
|
+
}
|
|
62873
|
+
};
|
|
62874
|
+
return new a2({
|
|
62875
|
+
options: e.options,
|
|
62876
|
+
signal: e.signal,
|
|
62877
|
+
input: e.input,
|
|
62878
|
+
output: e.output,
|
|
62879
|
+
initialValue: e.initialValue,
|
|
62880
|
+
render() {
|
|
62881
|
+
const t2 = e.withGuide ?? settings.withGuide, d = `${symbol2(this.state)} `, s = `${symbolBar(this.state)} `, n3 = wrapTextWithPrefix(e.output, e.message, s, d), u5 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
62882
|
+
` : ""}${n3}
|
|
62883
|
+
`;
|
|
62884
|
+
switch (this.state) {
|
|
62885
|
+
case "submit": {
|
|
62886
|
+
const r2 = t2 ? `${styleText2("gray", S_BAR)} ` : "", l = wrapTextWithPrefix(e.output, a3(this.options[this.cursor], "selected"), r2);
|
|
62887
|
+
return `${u5}${l}`;
|
|
62888
|
+
}
|
|
62889
|
+
case "cancel": {
|
|
62890
|
+
const r2 = t2 ? `${styleText2("gray", S_BAR)} ` : "", l = wrapTextWithPrefix(e.output, a3(this.options[this.cursor], "cancelled"), r2);
|
|
62891
|
+
return `${u5}${l}${t2 ? `
|
|
62892
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
62893
|
+
}
|
|
62894
|
+
default: {
|
|
62895
|
+
const r2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = t2 ? styleText2("cyan", S_BAR_END) : "", g2 = u5.split(`
|
|
62896
|
+
`).length, h3 = t2 ? 2 : 1;
|
|
62897
|
+
return `${u5}${r2}${limitOptions({
|
|
62898
|
+
output: e.output,
|
|
62899
|
+
cursor: this.cursor,
|
|
62900
|
+
options: this.options,
|
|
62901
|
+
maxItems: e.maxItems,
|
|
62902
|
+
columnPadding: r2.length,
|
|
62903
|
+
rowPadding: g2 + h3,
|
|
62904
|
+
style: (p3, b3) => a3(p3, p3.disabled ? "disabled" : b3 ? "active" : "inactive")
|
|
62905
|
+
}).join(`
|
|
62906
|
+
${r2}`)}
|
|
62907
|
+
${l}
|
|
62908
|
+
`;
|
|
62909
|
+
}
|
|
62910
|
+
}
|
|
62911
|
+
}
|
|
62912
|
+
}).prompt();
|
|
62913
|
+
};
|
|
62914
|
+
var i2 = `${styleText2("gray", S_BAR)} `;
|
|
62915
|
+
var text3 = (t2) => new n2({
|
|
62916
|
+
validate: t2.validate,
|
|
62917
|
+
placeholder: t2.placeholder,
|
|
62918
|
+
defaultValue: t2.defaultValue,
|
|
62919
|
+
initialValue: t2.initialValue,
|
|
62920
|
+
output: t2.output,
|
|
62921
|
+
signal: t2.signal,
|
|
62922
|
+
input: t2.input,
|
|
62923
|
+
render() {
|
|
62924
|
+
const i3 = t2?.withGuide ?? settings.withGuide, s = `${`${i3 ? `${styleText2("gray", S_BAR)}
|
|
62925
|
+
` : ""}${symbol2(this.state)} `}${t2.message}
|
|
62926
|
+
`, c6 = t2.placeholder ? styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o3 = this.userInput ? this.userInputWithCursor : c6, a3 = this.value ?? "";
|
|
62927
|
+
switch (this.state) {
|
|
62928
|
+
case "error": {
|
|
62929
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i3 ? `${styleText2("yellow", S_BAR)} ` : "", d = i3 ? styleText2("yellow", S_BAR_END) : "";
|
|
62930
|
+
return `${s.trim()}
|
|
62931
|
+
${r2}${o3}
|
|
62932
|
+
${d}${n3}
|
|
62933
|
+
`;
|
|
62934
|
+
}
|
|
62935
|
+
case "submit": {
|
|
62936
|
+
const n3 = a3 ? ` ${styleText2("dim", a3)}` : "", r2 = i3 ? styleText2("gray", S_BAR) : "";
|
|
62937
|
+
return `${s}${r2}${n3}`;
|
|
62938
|
+
}
|
|
62939
|
+
case "cancel": {
|
|
62940
|
+
const n3 = a3 ? ` ${styleText2(["strikethrough", "dim"], a3)}` : "", r2 = i3 ? styleText2("gray", S_BAR) : "";
|
|
62941
|
+
return `${s}${r2}${n3}${a3.trim() ? `
|
|
62942
|
+
${r2}` : ""}`;
|
|
62943
|
+
}
|
|
62944
|
+
default: {
|
|
62945
|
+
const n3 = i3 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i3 ? styleText2("cyan", S_BAR_END) : "";
|
|
62946
|
+
return `${s}${n3}${o3}
|
|
62947
|
+
${r2}
|
|
62948
|
+
`;
|
|
62949
|
+
}
|
|
62950
|
+
}
|
|
62951
|
+
}
|
|
62952
|
+
}).prompt();
|
|
62953
|
+
|
|
62954
|
+
// src/workflow/hitl/clack-responder.ts
|
|
62955
|
+
class ClackHitlResponder {
|
|
62956
|
+
constructor() {}
|
|
62957
|
+
async respond(request) {
|
|
62958
|
+
switch (request.kind) {
|
|
62959
|
+
case "confirm": {
|
|
62960
|
+
const result = await select3({
|
|
62961
|
+
message: request.prompt,
|
|
62962
|
+
options: [
|
|
62963
|
+
{ value: "yes", label: "Yes" },
|
|
62964
|
+
{ value: "no", label: "No" },
|
|
62965
|
+
{ value: "cancel", label: "Cancel" }
|
|
62966
|
+
]
|
|
62967
|
+
});
|
|
62968
|
+
if (isCancel(result)) {
|
|
62969
|
+
return { value: "cancel", cancelled: true };
|
|
62970
|
+
}
|
|
62971
|
+
return { value: result };
|
|
62972
|
+
}
|
|
62973
|
+
case "select": {
|
|
62974
|
+
const options = (request.options ?? []).map((opt) => ({ value: opt, label: opt }));
|
|
62975
|
+
const result = await select3({
|
|
62976
|
+
message: request.prompt,
|
|
62977
|
+
options
|
|
62978
|
+
});
|
|
62979
|
+
if (isCancel(result)) {
|
|
62980
|
+
return { value: "", cancelled: true };
|
|
62981
|
+
}
|
|
62982
|
+
return { value: result };
|
|
62983
|
+
}
|
|
62984
|
+
case "input": {
|
|
62985
|
+
const result = await text3({
|
|
62986
|
+
message: request.prompt
|
|
62987
|
+
});
|
|
62988
|
+
if (isCancel(result)) {
|
|
62989
|
+
return { value: "", cancelled: true };
|
|
62990
|
+
}
|
|
62991
|
+
return { value: result ?? "" };
|
|
62992
|
+
}
|
|
62993
|
+
}
|
|
62994
|
+
}
|
|
62995
|
+
}
|
|
62996
|
+
|
|
62997
|
+
// src/workflow/hitl/default-responder.ts
|
|
62998
|
+
class DefaultHitlResponder {
|
|
62999
|
+
config;
|
|
63000
|
+
constructor(config3 = {}) {
|
|
63001
|
+
this.config = {
|
|
63002
|
+
confirmDefault: config3.confirmDefault ?? "yes",
|
|
63003
|
+
selectDefaultIndex: config3.selectDefaultIndex ?? 0,
|
|
63004
|
+
inputDefault: config3.inputDefault ?? ""
|
|
63005
|
+
};
|
|
63006
|
+
}
|
|
63007
|
+
async respond(request) {
|
|
63008
|
+
switch (request.kind) {
|
|
63009
|
+
case "confirm":
|
|
63010
|
+
return { value: this.config.confirmDefault };
|
|
63011
|
+
case "select": {
|
|
63012
|
+
const options = request.options ?? [];
|
|
63013
|
+
const idx = Math.max(0, Math.min(this.config.selectDefaultIndex, options.length - 1));
|
|
63014
|
+
return { value: options[idx] ?? "" };
|
|
63015
|
+
}
|
|
63016
|
+
case "input":
|
|
63017
|
+
return { value: this.config.inputDefault };
|
|
63018
|
+
}
|
|
63019
|
+
}
|
|
63020
|
+
}
|
|
63021
|
+
|
|
63022
|
+
// src/context.ts
|
|
60986
63023
|
function createCliContext(options) {
|
|
60987
63024
|
const cwd = resolve4(options.cwd ?? process.cwd());
|
|
60988
63025
|
const env = options.env ?? process.env;
|
|
@@ -61001,7 +63038,10 @@ function createCliContext(options) {
|
|
|
61001
63038
|
getDb: async () => {
|
|
61002
63039
|
dbPromise ??= createMigratedDbAdapter(cwd, env, options.dbUrl);
|
|
61003
63040
|
return dbPromise;
|
|
61004
|
-
}
|
|
63041
|
+
},
|
|
63042
|
+
agentService: () => new AgentService({ cwd, env, output: options.output }),
|
|
63043
|
+
ruleService: () => new RuleService({ cwd, env, fs: fs2, output: options.output }),
|
|
63044
|
+
hitlResponder: (json2) => isatty3(1) && json2 !== true ? new ClackHitlResponder : new DefaultHitlResponder
|
|
61005
63045
|
};
|
|
61006
63046
|
}
|
|
61007
63047
|
function noopSetExitCode(_code) {}
|