@hizliemre/horse-code 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{app-UGFQKMLX.js → app-2GPGCDX6.js} +136 -329
- package/dist/{chunk-2DGO2BUB.js → chunk-23CLQ2KO.js} +366 -600
- package/dist/{chunk-JWAEW7AJ.js → chunk-5ZV42XGJ.js} +2 -2
- package/dist/{chunk-2SVAHH5N.js → chunk-63E73TGI.js} +2 -4
- package/dist/{chunk-DTWKSZXY.js → chunk-6OSEQOYY.js} +2 -2
- package/dist/{chunk-SSDLHWSF.js → chunk-6W4UH2BQ.js} +33 -1
- package/dist/{chunk-3XVZXTB6.js → chunk-7JMWPTJ5.js} +1818 -384
- package/dist/{chunk-YILDXPSI.js → chunk-AE36LLL2.js} +49 -25
- package/dist/{chunk-FFYBY2NA.js → chunk-KAGKX2YT.js} +2 -4
- package/dist/{chunk-4EWK7HWQ.js → chunk-KKWZBZYK.js} +10 -0
- package/dist/{chunk-TOPZL5SU.js → chunk-LLL7QWXB.js} +41 -9
- package/dist/{chunk-7TBYMFMG.js → chunk-LNW557IO.js} +2 -2
- package/dist/{chunk-IW2KBAVZ.js → chunk-LPQU436C.js} +12 -1
- package/dist/chunk-M2RKCIGV.js +11 -0
- package/dist/{chunk-NNTIACT4.js → chunk-MRZVA5JB.js} +4 -4
- package/dist/{chunk-HBSC2HT2.js → chunk-UGESK765.js} +1 -1
- package/dist/{chunk-PGOYDOI4.js → chunk-XEGQT5EN.js} +3 -5
- package/dist/{chunk-FGVJFMK5.js → chunk-ZSQ24YDJ.js} +1 -1
- package/dist/cli.js +414 -100
- package/dist/{discover-5URG7C4J.js → discover-G2Z6XC3O.js} +9 -3
- package/dist/fix-JOIXQFVP.js +33 -0
- package/dist/git-QZTDZSJY.js +8 -0
- package/dist/{ongoing-OV5XROTU.js → ongoing-WHYXPW24.js} +4 -4
- package/dist/{project-graph-IOPCSZUA.js → project-graph-5HNPRFQG.js} +2 -3
- package/dist/{run-LQOZ5I7Z.js → run-P6ZYL5JL.js} +2 -3
- package/dist/{save-skills-NSLBU33X.js → save-skills-X7U3KCPU.js} +1 -1
- package/dist/{trace-ZMB7LT7W.js → trace-X6TU3AG6.js} +2 -3
- package/dist/{trace-adopt-C6TUWFJL.js → trace-adopt-URECQWJV.js} +2 -3
- package/dist/{trace-run-F23MFTY4.js → trace-run-7U4WJZ3V.js} +6 -7
- package/dist/{triage-2J3T5PVQ.js → triage-FCYHD2AQ.js} +8 -9
- package/dist/{verify-WQ3GHION.js → verify-6SC4I77M.js} +18 -19
- package/package.json +1 -1
- package/dist/chunk-B67BK5GQ.js +0 -34
- package/dist/chunk-F2IALVBU.js +0 -212
- package/dist/chunk-O74BDQKS.js +0 -28
- package/dist/fix-HBBOTUWM.js +0 -34
- package/dist/git-VTSZALSR.js +0 -6
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// src/providers/models.ts
|
|
2
|
+
var KNOWN_FREE_PROVIDER = /^(ddgw|duckduckgo|veoaifree)/i;
|
|
3
|
+
function isFreeModel(id, name) {
|
|
4
|
+
const n = name ?? "";
|
|
5
|
+
if (/🆓/.test(n) || /\bfree\b/i.test(n)) return true;
|
|
6
|
+
if (/-free\b/i.test(id)) return true;
|
|
7
|
+
const provider = id.split("/")[0];
|
|
8
|
+
return /free/i.test(provider) || KNOWN_FREE_PROVIDER.test(provider);
|
|
9
|
+
}
|
|
4
10
|
|
|
5
11
|
// src/providers/discover.ts
|
|
6
12
|
async function fetchCatalog(opts) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FIX_ATTEMPTS,
|
|
3
|
+
cardFromFinding,
|
|
4
|
+
commitFix,
|
|
5
|
+
commitOnly,
|
|
6
|
+
describeFix,
|
|
7
|
+
describeSmallChange,
|
|
8
|
+
dirtyPaths,
|
|
9
|
+
runFix,
|
|
10
|
+
runSmallChange
|
|
11
|
+
} from "./chunk-5ZV42XGJ.js";
|
|
12
|
+
import "./chunk-7JMWPTJ5.js";
|
|
13
|
+
import "./chunk-ZSQ24YDJ.js";
|
|
14
|
+
import "./chunk-MRZVA5JB.js";
|
|
15
|
+
import "./chunk-LPQU436C.js";
|
|
16
|
+
import "./chunk-LLL7QWXB.js";
|
|
17
|
+
import "./chunk-63E73TGI.js";
|
|
18
|
+
import "./chunk-AE36LLL2.js";
|
|
19
|
+
import "./chunk-6OSEQOYY.js";
|
|
20
|
+
import "./chunk-KAGKX2YT.js";
|
|
21
|
+
import "./chunk-XEGQT5EN.js";
|
|
22
|
+
import "./chunk-6W4UH2BQ.js";
|
|
23
|
+
export {
|
|
24
|
+
FIX_ATTEMPTS,
|
|
25
|
+
cardFromFinding,
|
|
26
|
+
commitFix,
|
|
27
|
+
commitOnly,
|
|
28
|
+
describeFix,
|
|
29
|
+
describeSmallChange,
|
|
30
|
+
dirtyPaths,
|
|
31
|
+
runFix,
|
|
32
|
+
runSmallChange
|
|
33
|
+
};
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-YBWTCXUS.js";
|
|
4
4
|
import {
|
|
5
5
|
askInUserLanguage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UGESK765.js";
|
|
7
7
|
import {
|
|
8
8
|
checkpointMtime,
|
|
9
9
|
readCheckpoint
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-ZSQ24YDJ.js";
|
|
11
|
+
import "./chunk-AE36LLL2.js";
|
|
12
|
+
import "./chunk-6W4UH2BQ.js";
|
|
13
13
|
|
|
14
14
|
// src/engine/ongoing.ts
|
|
15
15
|
import { join } from "path";
|
|
@@ -24,9 +24,8 @@ import {
|
|
|
24
24
|
pruneTooling,
|
|
25
25
|
readStamp,
|
|
26
26
|
stampPath
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-B67BK5GQ.js";
|
|
27
|
+
} from "./chunk-XEGQT5EN.js";
|
|
28
|
+
import "./chunk-6W4UH2BQ.js";
|
|
30
29
|
export {
|
|
31
30
|
BUILD_IDLE_TIMEOUT_MS,
|
|
32
31
|
GRAPH_DIR,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadMigrated,
|
|
3
3
|
recordMigrated
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-B67BK5GQ.js";
|
|
4
|
+
} from "./chunk-63E73TGI.js";
|
|
5
|
+
import "./chunk-6W4UH2BQ.js";
|
|
7
6
|
|
|
8
7
|
// src/migrate/run.ts
|
|
9
8
|
import { cp, lstat, mkdir, readFile as readFile2, readlink, rm } from "fs/promises";
|
|
@@ -29,9 +29,8 @@ import {
|
|
|
29
29
|
traceRootRel,
|
|
30
30
|
traceState,
|
|
31
31
|
traceable
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-B67BK5GQ.js";
|
|
32
|
+
} from "./chunk-KAGKX2YT.js";
|
|
33
|
+
import "./chunk-6W4UH2BQ.js";
|
|
35
34
|
export {
|
|
36
35
|
GITIGNORE_MARKER,
|
|
37
36
|
MAX_TRACE_FILE_CHARS,
|
|
@@ -2,9 +2,8 @@ import {
|
|
|
2
2
|
hashContent,
|
|
3
3
|
traceDir,
|
|
4
4
|
traceRootRel
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-B67BK5GQ.js";
|
|
5
|
+
} from "./chunk-KAGKX2YT.js";
|
|
6
|
+
import "./chunk-6W4UH2BQ.js";
|
|
8
7
|
|
|
9
8
|
// src/engine/trace-adopt.ts
|
|
10
9
|
import { readFile, readdir } from "fs/promises";
|
|
@@ -6,13 +6,12 @@ import {
|
|
|
6
6
|
planFor,
|
|
7
7
|
runTraces,
|
|
8
8
|
traceableFiles
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-B67BK5GQ.js";
|
|
9
|
+
} from "./chunk-MRZVA5JB.js";
|
|
10
|
+
import "./chunk-LPQU436C.js";
|
|
11
|
+
import "./chunk-6OSEQOYY.js";
|
|
12
|
+
import "./chunk-KAGKX2YT.js";
|
|
13
|
+
import "./chunk-XEGQT5EN.js";
|
|
14
|
+
import "./chunk-6W4UH2BQ.js";
|
|
16
15
|
export {
|
|
17
16
|
TRACE_CONCURRENCY,
|
|
18
17
|
buildBrief,
|
|
@@ -8,15 +8,14 @@ import {
|
|
|
8
8
|
describeSizeDoubt,
|
|
9
9
|
sizeRequest,
|
|
10
10
|
triageFinding
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-B67BK5GQ.js";
|
|
11
|
+
} from "./chunk-LNW557IO.js";
|
|
12
|
+
import "./chunk-LLL7QWXB.js";
|
|
13
|
+
import "./chunk-63E73TGI.js";
|
|
14
|
+
import "./chunk-AE36LLL2.js";
|
|
15
|
+
import "./chunk-6OSEQOYY.js";
|
|
16
|
+
import "./chunk-KAGKX2YT.js";
|
|
17
|
+
import "./chunk-XEGQT5EN.js";
|
|
18
|
+
import "./chunk-6W4UH2BQ.js";
|
|
20
19
|
export {
|
|
21
20
|
RequestSizeSchema,
|
|
22
21
|
SIZE_ATTEMPT_MS,
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
describeFix,
|
|
4
4
|
dirtyPaths,
|
|
5
5
|
runFix
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5ZV42XGJ.js";
|
|
7
7
|
import {
|
|
8
|
-
buildAskUserTool,
|
|
9
8
|
respondIn
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M2RKCIGV.js";
|
|
11
10
|
import {
|
|
11
|
+
buildAskUserTool,
|
|
12
12
|
buildRememberTool,
|
|
13
13
|
buildSkillTool,
|
|
14
14
|
constitutionNote,
|
|
@@ -22,20 +22,20 @@ import {
|
|
|
22
22
|
specsDir,
|
|
23
23
|
verifyPaths,
|
|
24
24
|
writeFileTool
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-7JMWPTJ5.js";
|
|
26
26
|
import {
|
|
27
27
|
askInUserLanguage,
|
|
28
28
|
inUserLanguage
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-UGESK765.js";
|
|
30
|
+
import "./chunk-ZSQ24YDJ.js";
|
|
31
|
+
import "./chunk-MRZVA5JB.js";
|
|
32
32
|
import {
|
|
33
33
|
defaultGitRunner
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-LPQU436C.js";
|
|
35
35
|
import {
|
|
36
36
|
describeEscalation,
|
|
37
37
|
triageFinding
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-LNW557IO.js";
|
|
39
39
|
import {
|
|
40
40
|
BATCH_TOOLS_NOTE,
|
|
41
41
|
contextTools,
|
|
@@ -45,22 +45,21 @@ import {
|
|
|
45
45
|
projectToolsNote,
|
|
46
46
|
readFileTool,
|
|
47
47
|
reinforceUsed
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-LLL7QWXB.js";
|
|
49
|
+
import "./chunk-63E73TGI.js";
|
|
50
50
|
import {
|
|
51
51
|
ToolRegistry,
|
|
52
52
|
handedOver,
|
|
53
53
|
runToCompletion
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
import "./chunk-
|
|
56
|
-
import "./chunk-
|
|
54
|
+
} from "./chunk-AE36LLL2.js";
|
|
55
|
+
import "./chunk-6OSEQOYY.js";
|
|
56
|
+
import "./chunk-KAGKX2YT.js";
|
|
57
57
|
import {
|
|
58
58
|
loadGraphSync
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-XEGQT5EN.js";
|
|
60
60
|
import {
|
|
61
61
|
sessionBase
|
|
62
|
-
} from "./chunk-
|
|
63
|
-
import "./chunk-B67BK5GQ.js";
|
|
62
|
+
} from "./chunk-6W4UH2BQ.js";
|
|
64
63
|
|
|
65
64
|
// src/engine/verify.ts
|
|
66
65
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -197,7 +196,7 @@ function readPointer(pointerPath) {
|
|
|
197
196
|
}
|
|
198
197
|
async function trackedFiles(cwd) {
|
|
199
198
|
try {
|
|
200
|
-
const { defaultGitRunner: defaultGitRunner2 } = await import("./git-
|
|
199
|
+
const { defaultGitRunner: defaultGitRunner2 } = await import("./git-QZTDZSJY.js");
|
|
201
200
|
const r = await defaultGitRunner2(["ls-files"], cwd);
|
|
202
201
|
return r.code === 0 ? r.stdout.split("\n").filter(Boolean) : [];
|
|
203
202
|
} catch {
|
|
@@ -452,7 +451,7 @@ function describeVerify(r, branch, workdir) {
|
|
|
452
451
|
${where} ${seat}`;
|
|
453
452
|
}
|
|
454
453
|
async function currentBranchOf(cwd) {
|
|
455
|
-
const { defaultGitRunner: defaultGitRunner2 } = await import("./git-
|
|
454
|
+
const { defaultGitRunner: defaultGitRunner2 } = await import("./git-QZTDZSJY.js");
|
|
456
455
|
const r = await defaultGitRunner2(["symbolic-ref", "--short", "HEAD"], cwd);
|
|
457
456
|
return r.code === 0 && r.stdout.trim() ? r.stdout.trim() : "(detached)";
|
|
458
457
|
}
|
package/package.json
CHANGED
package/dist/chunk-B67BK5GQ.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// src/session/atomic.ts
|
|
2
|
-
import { rename, rm, writeFile } from "fs/promises";
|
|
3
|
-
import { renameSync, rmSync, writeFileSync } from "fs";
|
|
4
|
-
var seq = 0;
|
|
5
|
-
var tmpName = (path) => `${path}.${process.pid}.${seq++}.tmp`;
|
|
6
|
-
async function writeAtomic(path, data) {
|
|
7
|
-
const tmp = tmpName(path);
|
|
8
|
-
try {
|
|
9
|
-
await writeFile(tmp, data, "utf8");
|
|
10
|
-
await rename(tmp, path);
|
|
11
|
-
} catch (e) {
|
|
12
|
-
await rm(tmp, { force: true }).catch(() => {
|
|
13
|
-
});
|
|
14
|
-
throw e;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function writeAtomicSync(path, data) {
|
|
18
|
-
const tmp = tmpName(path);
|
|
19
|
-
try {
|
|
20
|
-
writeFileSync(tmp, data, "utf8");
|
|
21
|
-
renameSync(tmp, path);
|
|
22
|
-
} catch (e) {
|
|
23
|
-
try {
|
|
24
|
-
rmSync(tmp, { force: true });
|
|
25
|
-
} catch {
|
|
26
|
-
}
|
|
27
|
-
throw e;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
writeAtomic,
|
|
33
|
-
writeAtomicSync
|
|
34
|
-
};
|
package/dist/chunk-F2IALVBU.js
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildSkillTool,
|
|
3
|
-
editFileTool,
|
|
4
|
-
writeFileTool
|
|
5
|
-
} from "./chunk-3XVZXTB6.js";
|
|
6
|
-
import {
|
|
7
|
-
globTool,
|
|
8
|
-
grepTool,
|
|
9
|
-
readFileTool
|
|
10
|
-
} from "./chunk-TOPZL5SU.js";
|
|
11
|
-
import {
|
|
12
|
-
ToolRegistry,
|
|
13
|
-
runStructuredRole
|
|
14
|
-
} from "./chunk-YILDXPSI.js";
|
|
15
|
-
|
|
16
|
-
// src/engine/language.ts
|
|
17
|
-
function respondIn(language) {
|
|
18
|
-
if (!language || /^english$/i.test(language)) return "";
|
|
19
|
-
return `
|
|
20
|
-
|
|
21
|
-
Respond to the user in ${language}: everything you say to them, and every question you ask, is in ${language}. Code, identifiers, logs and commit messages keep whatever language the project uses.`;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// src/engine/writer-registry.ts
|
|
25
|
-
import { z as z2 } from "zod";
|
|
26
|
-
|
|
27
|
-
// src/engine/normalize-question.ts
|
|
28
|
-
import { z } from "zod";
|
|
29
|
-
var NormalizedQuestionSchema = z.object({
|
|
30
|
-
question: z.string().describe("The core question, concise, WITHOUT the embedded options table/list."),
|
|
31
|
-
options: z.array(z.string()).describe("Each selectable choice as a SHORT label; the recommended one first, suffixed ' (recommended)'. Empty when the question is genuinely open-ended."),
|
|
32
|
-
multiSelect: z.boolean().describe("true only if the user may pick more than one.")
|
|
33
|
-
});
|
|
34
|
-
var PROMPT = "You reformat an agent's question for a terminal UI that renders selectable options (arrow keys + Enter). Given the raw question text \u2014 which may embed choices as a markdown table, an A/B/C/D list, or a 'recommended' suggestion \u2014 extract exactly:\n- `question`: the core question, concise, WITHOUT the embedded options table/list.\n- `options`: each selectable choice as a SHORT label. If one choice is recommended, list it FIRST and append ' (recommended)'. Do NOT add an 'other' / free-text / 'answer in your own words' option \u2014 the UI already provides that.\n- `multiSelect`: true only if the user may pick several.\nIf the text is genuinely open-ended (no discrete choices), return options: []. Preserve the user's language. Return the result via submit.";
|
|
35
|
-
function looksLikeChoices(text) {
|
|
36
|
-
return /\|[^\n]*\|[^\n]*\|/.test(text) || /(^|\n)\s*[A-Ea-e][).\-:]\s/.test(text) || /(^|\n)\s*[-*]\s+\S.*(\n\s*[-*]\s+\S.*){1,}/.test(text) || /\b(option|seçenek|choice|önerilen|recommended)\b/i.test(text);
|
|
37
|
-
}
|
|
38
|
-
async function normalizeQuestion(deps, raw) {
|
|
39
|
-
const { role: agentRole, model, fallbacks, onExhausted, onFallback } = deps.roleRegistry.fallbackOpts("refiner");
|
|
40
|
-
return runStructuredRole({
|
|
41
|
-
provider: deps.provider,
|
|
42
|
-
role: agentRole,
|
|
43
|
-
model,
|
|
44
|
-
fallbacks,
|
|
45
|
-
onExhausted,
|
|
46
|
-
onFallback,
|
|
47
|
-
// This shapes the question the USER reads; a rule like "always ask in Turkish" belongs here.
|
|
48
|
-
systemPrompt: PROMPT + deps.roleRegistry.ruleSuffix(),
|
|
49
|
-
tools: new ToolRegistry(),
|
|
50
|
-
messages: [{ role: "user", content: raw }],
|
|
51
|
-
permission: deps.permission,
|
|
52
|
-
approve: deps.approve,
|
|
53
|
-
cwd: ".",
|
|
54
|
-
signal: deps.signal
|
|
55
|
-
}, NormalizedQuestionSchema);
|
|
56
|
-
}
|
|
57
|
-
function extractChoicesFrom(text) {
|
|
58
|
-
const lines = text.split("\n");
|
|
59
|
-
const rows = lines.map((l) => l.trim()).filter((l) => l.startsWith("|") && l.endsWith("|") && !/^\|[\s|:-]+\|$/.test(l)).map((l) => l.slice(1, -1).split("|").map((c) => c.trim()));
|
|
60
|
-
const body = rows.filter((cells) => cells.length >= 2 && cells[0] && cells[1]).filter((cells, i) => !(i === 0 && /^(option|seçenek|choice|alternatif)$/i.test(cells[0])));
|
|
61
|
-
if (body.length >= 2) {
|
|
62
|
-
const question = lines.filter((l) => !/^\s*\|.*\|\s*$/.test(l)).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
63
|
-
return { choices: body.map((cells) => ({ label: cells[0], description: cells.slice(1).join(" \u2014 ") })), question };
|
|
64
|
-
}
|
|
65
|
-
const isLettered = (l) => /^\s*([A-Ea-e])[).\-:]\s+(\S.*)$/.exec(l.trim());
|
|
66
|
-
const lettered = lines.map(isLettered).filter((m) => !!m).map((m) => ({ label: `${m[1].toUpperCase()} \u2014 ${m[2]}` }));
|
|
67
|
-
if (lettered.length >= 2) {
|
|
68
|
-
const question = lines.filter((l) => !isLettered(l)).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
69
|
-
return { choices: lettered, question };
|
|
70
|
-
}
|
|
71
|
-
const MARKER = /\(([A-Ea-e])\)\s*/g;
|
|
72
|
-
const marks = [...text.matchAll(MARKER)];
|
|
73
|
-
const inOrder = marks.length >= 2 && marks.every((m, i) => m[1].toUpperCase() === String.fromCharCode(65 + i));
|
|
74
|
-
if (inOrder) {
|
|
75
|
-
const first = marks[0].index ?? 0;
|
|
76
|
-
const parts = marks.map((m, i) => {
|
|
77
|
-
const start = (m.index ?? 0) + m[0].length;
|
|
78
|
-
const end = i + 1 < marks.length ? marks[i + 1].index ?? text.length : text.length;
|
|
79
|
-
return { letter: m[1].toUpperCase(), body: text.slice(start, end).trim().replace(/\s+/g, " ") };
|
|
80
|
-
}).filter((p) => p.body);
|
|
81
|
-
if (parts.length >= 2) {
|
|
82
|
-
const question = text.slice(0, first).replace(/\s*(Se\u00e7enekler|Options|Choices)\s*:?\s*$/i, "").trim();
|
|
83
|
-
return {
|
|
84
|
-
choices: parts.map((p) => ({ label: `${p.letter} \u2014 ${clipLabel(p.body)}`, description: p.body })),
|
|
85
|
-
question: question || text
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return { choices: [], question: text };
|
|
90
|
-
}
|
|
91
|
-
var clipLabel = (body) => {
|
|
92
|
-
const cut = body.replace(/^\[[^\]]*\]\s*/, "");
|
|
93
|
-
const stop = cut.search(/[—–.;:]\s/);
|
|
94
|
-
const head = stop > 12 ? cut.slice(0, stop) : cut;
|
|
95
|
-
return head.length > 72 ? `${head.slice(0, 71)}\u2026` : head;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// src/engine/writer-registry.ts
|
|
99
|
-
var askUserParams = z2.object({
|
|
100
|
-
question: z2.string(),
|
|
101
|
-
// For a multiple-choice question, list the choices here → the UI shows a selectable checkbox/radio list
|
|
102
|
-
// (arrow keys + Enter) instead of a free-text box. Omit for an open-ended question.
|
|
103
|
-
//
|
|
104
|
-
// A choice may be a plain string, or an object carrying what the label alone cannot say: a one-line
|
|
105
|
-
// `description`, and a `preview` rendered in a panel beside the list while that option is focused. Use the
|
|
106
|
-
// rich form when the decision turns on the trade-offs rather than the name (e.g. "which approach?").
|
|
107
|
-
options: z2.array(z2.union([
|
|
108
|
-
z2.string(),
|
|
109
|
-
z2.object({ label: z2.string(), description: z2.string().optional(), preview: z2.string().optional() })
|
|
110
|
-
])).optional().describe(
|
|
111
|
-
"The choices, when the question has discrete answers \u2014 the UI renders a selectable list instead of a free-text box. Omit for an open-ended question. A choice may be a plain string, or an object with a one-line `description` and a `preview` shown beside the list; use the rich form when the decision turns on trade-offs rather than on the name."
|
|
112
|
-
),
|
|
113
|
-
multiSelect: z2.boolean().optional().describe(
|
|
114
|
-
"True when the user may pick more than one (checkboxes); omitted means pick exactly one (radio)."
|
|
115
|
-
),
|
|
116
|
-
/**
|
|
117
|
-
* What the user has to DO before they can answer — one action per entry.
|
|
118
|
-
*
|
|
119
|
-
* Present ⇒ this is a hand-off, not a question: the run has stopped because only a person can carry the
|
|
120
|
-
* next step, and the UI says so rather than showing a bare "? Question".
|
|
121
|
-
*/
|
|
122
|
-
steps: z2.array(z2.string()).optional().describe(
|
|
123
|
-
'What the user has to DO before they can answer \u2014 one action per entry. Supplying this makes it a HAND-OFF rather than a question: the run has stopped because only a person can carry the next step, and the UI says so instead of showing a bare "? Question". Use it whenever you are asking someone to go and perform something and report back; leave it out when you only want an answer.'
|
|
124
|
-
)
|
|
125
|
-
});
|
|
126
|
-
var POINTS_ELSEWHERE = /\b(above|below|earlier|previously|as listed|as described)\b|yukarı|aşağı|altında|önceki|birazdan|listelenen/i;
|
|
127
|
-
var ITEM_REFERENCE = /(?:^|[^\w])(?:q|soru|question|madde|item)\s*\.?\s*(\d{1,2})\b/gi;
|
|
128
|
-
var ITEM_STATED = /^[\s>*\-–—#]*(?:q|soru|question|madde|item)\s*\.?\s*\d{1,2}\s*[:).]/gim;
|
|
129
|
-
function danglingItems(question) {
|
|
130
|
-
const referenced = new Set([...question.matchAll(ITEM_REFERENCE)].map((m) => Number(m[1])));
|
|
131
|
-
if (referenced.size < 2) return [];
|
|
132
|
-
const stated = question.match(ITEM_STATED)?.length ?? 0;
|
|
133
|
-
return stated >= referenced.size ? [] : [...referenced].sort((a, b) => a - b);
|
|
134
|
-
}
|
|
135
|
-
var ENUMERATOR = /(?:^|[^\w])\(?(\d{1,2})[).:]/g;
|
|
136
|
-
function packedQuestions(question) {
|
|
137
|
-
if ((question.match(/\?/g)?.length ?? 0) < 2) return 0;
|
|
138
|
-
const numbered = new Set([...question.matchAll(ENUMERATOR)].map((m) => Number(m[1])));
|
|
139
|
-
return numbered.size;
|
|
140
|
-
}
|
|
141
|
-
var ONE_AT_A_TIME = "This tool asks ONE question and takes ONE answer. Ask the first one on its own, with its own `options`, and call this tool again for the next once you have the answer \u2014 the answer to one of these usually changes what the next one should be.";
|
|
142
|
-
function buildAskUserTool(askUser, normalize) {
|
|
143
|
-
return {
|
|
144
|
-
name: "ask_user",
|
|
145
|
-
description: 'Ask the user ONE question and get their answer. Several decisions are several calls: ask the first, read the answer, then ask the next \u2014 the user has one answer field, so four questions in one box means four decisions they must hold in their head and answer in prose. For a multiple-choice question, pass `options` (the choices) \u2014 the UI shows a selectable list the user checks off; set `multiSelect: true` when they may pick several. Omit `options` for an open-ended (free-text) question. An option may be a plain string, or {label, description, preview} when the decision turns on trade-offs the label cannot carry \u2014 the preview is shown beside the list as the user moves the cursor. A `label` is a SHORT single line (a few words, no line breaks): it is a name for the choice, not the argument for it. Put the reasoning in `description` (one sentence) and the detail in `preview`. If you have findings to report, WRITE THEM as your message before calling this \u2014 a question that says "the evaluation is above" when you never wrote one leaves the user choosing between options whose basis they cannot see. The user may attach a free-text note to their choice, which arrives appended to the answer.\n\nWhen you need the user to DO something first \u2014 click through a screen, run a scenario, look at a network response \u2014 put each action in `steps`, one per entry, and ask in `question` for what they should report back. The user reads THIS BOX and the chat; a file you wrote is not on their screen, so "the steps above" points at nothing they can see. With `steps` the UI shows a hand-off \u2014 the numbered actions and then the question \u2014 instead of a bare question.',
|
|
146
|
-
permissionLevel: "safe",
|
|
147
|
-
parameters: askUserParams,
|
|
148
|
-
run: async (rawArgs, ctx) => {
|
|
149
|
-
const parsed = askUserParams.safeParse(rawArgs);
|
|
150
|
-
if (!parsed.success) {
|
|
151
|
-
return { content: `ask_user: invalid args: ${parsed.error.issues.map((i) => i.message).join("; ")}`, isError: true };
|
|
152
|
-
}
|
|
153
|
-
const { question, options, multiSelect, steps } = parsed.data;
|
|
154
|
-
const asker = ctx.role || ctx.model ? { asker: { ...ctx.role ? { role: ctx.role } : {}, ...ctx.model ? { model: ctx.model } : {} } } : {};
|
|
155
|
-
if (POINTS_ELSEWHERE.test(question) && !steps?.length && !ctx.said?.trim()) {
|
|
156
|
-
return {
|
|
157
|
-
content: "ask_user: this question refers to something the user cannot see. You wrote no message this turn, so there is nothing above it \u2014 and a file you wrote is not on their screen. Put what they must do in `steps` (one action per entry), or write it out in `question`, and ask again.",
|
|
158
|
-
isError: true
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
const dangling = danglingItems(question);
|
|
162
|
-
if (dangling.length && !steps?.length && !ctx.said?.trim()) {
|
|
163
|
-
return {
|
|
164
|
-
content: `ask_user: this asks the user to answer ${dangling.map((n) => `Q${n}`).join(", ")}, and none of them is on their screen \u2014 you did not write them this turn, and a file you wrote is not something they are looking at. ${ONE_AT_A_TIME}`,
|
|
165
|
-
isError: true
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
const packed = packedQuestions(question);
|
|
169
|
-
if (packed >= 2 && !steps?.length && !options?.length) {
|
|
170
|
-
return {
|
|
171
|
-
content: `ask_user: this is ${packed} questions in one box, and the user has one answer field for all of them. ${ONE_AT_A_TIME}`,
|
|
172
|
-
isError: true
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
if ((!options || options.length === 0) && !steps?.length && looksLikeChoices(question)) {
|
|
176
|
-
const found = extractChoicesFrom(question);
|
|
177
|
-
if (found.choices.length >= 2) {
|
|
178
|
-
return { content: await askUser(found.question, { options: found.choices, ...asker }), isError: false };
|
|
179
|
-
}
|
|
180
|
-
if (normalize) {
|
|
181
|
-
try {
|
|
182
|
-
const n = await normalize(question);
|
|
183
|
-
if (n.options.length > 0) {
|
|
184
|
-
return { content: await askUser(n.question, { options: n.options, multiSelect: n.multiSelect, ...asker }), isError: false };
|
|
185
|
-
}
|
|
186
|
-
} catch {
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return { content: await askUser(question, { options, multiSelect, steps, ...asker }), isError: false };
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function writerRegistry(skillRegistry, extra = []) {
|
|
195
|
-
const r = new ToolRegistry();
|
|
196
|
-
r.register(readFileTool);
|
|
197
|
-
r.register(writeFileTool);
|
|
198
|
-
r.register(editFileTool);
|
|
199
|
-
r.register(grepTool);
|
|
200
|
-
r.register(globTool);
|
|
201
|
-
r.register(buildSkillTool(skillRegistry));
|
|
202
|
-
for (const t of extra) r.register(t);
|
|
203
|
-
return r;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export {
|
|
207
|
-
respondIn,
|
|
208
|
-
normalizeQuestion,
|
|
209
|
-
extractChoicesFrom,
|
|
210
|
-
buildAskUserTool,
|
|
211
|
-
writerRegistry
|
|
212
|
-
};
|
package/dist/chunk-O74BDQKS.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// src/providers/models.ts
|
|
2
|
-
var KNOWN_FREE_PROVIDER = /^(ddgw|duckduckgo|veoaifree)/i;
|
|
3
|
-
function isFreeModel(id, name) {
|
|
4
|
-
const n = name ?? "";
|
|
5
|
-
if (/🆓/.test(n) || /\bfree\b/i.test(n)) return true;
|
|
6
|
-
if (/-free\b/i.test(id)) return true;
|
|
7
|
-
const provider = id.split("/")[0];
|
|
8
|
-
return /free/i.test(provider) || KNOWN_FREE_PROVIDER.test(provider);
|
|
9
|
-
}
|
|
10
|
-
async function listOmniRouteModels(opts) {
|
|
11
|
-
const fetchFn = opts.fetch ?? globalThis.fetch;
|
|
12
|
-
const headers = {};
|
|
13
|
-
if (opts.apiKey) headers.Authorization = `Bearer ${opts.apiKey}`;
|
|
14
|
-
const base = opts.baseUrl.replace(/\/$/, "");
|
|
15
|
-
const res = await fetchFn(`${base}/api/v1/models`, { headers });
|
|
16
|
-
if (!res.ok) throw new Error(`omniroute models ${res.status}`);
|
|
17
|
-
const body = await res.json();
|
|
18
|
-
const allow = opts.sources && opts.sources.length ? new Set(opts.sources) : void 0;
|
|
19
|
-
const kept = (body.data ?? []).filter((m) => typeof m.id === "string").filter((m) => !isFreeModel(m.id, typeof m.name === "string" ? m.name : void 0)).filter((m) => !allow || typeof m.owned_by === "string" && allow.has(m.owned_by));
|
|
20
|
-
const keptIds = new Set(kept.map((m) => m.id));
|
|
21
|
-
const ids = kept.filter((m) => !(typeof m.parent === "string" && keptIds.has(m.parent))).map((m) => m.id);
|
|
22
|
-
return [...new Set(ids)].sort();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
isFreeModel,
|
|
27
|
-
listOmniRouteModels
|
|
28
|
-
};
|
package/dist/fix-HBBOTUWM.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FIX_ATTEMPTS,
|
|
3
|
-
cardFromFinding,
|
|
4
|
-
commitFix,
|
|
5
|
-
commitOnly,
|
|
6
|
-
describeFix,
|
|
7
|
-
describeSmallChange,
|
|
8
|
-
dirtyPaths,
|
|
9
|
-
runFix,
|
|
10
|
-
runSmallChange
|
|
11
|
-
} from "./chunk-JWAEW7AJ.js";
|
|
12
|
-
import "./chunk-3XVZXTB6.js";
|
|
13
|
-
import "./chunk-FGVJFMK5.js";
|
|
14
|
-
import "./chunk-NNTIACT4.js";
|
|
15
|
-
import "./chunk-IW2KBAVZ.js";
|
|
16
|
-
import "./chunk-TOPZL5SU.js";
|
|
17
|
-
import "./chunk-2SVAHH5N.js";
|
|
18
|
-
import "./chunk-YILDXPSI.js";
|
|
19
|
-
import "./chunk-DTWKSZXY.js";
|
|
20
|
-
import "./chunk-FFYBY2NA.js";
|
|
21
|
-
import "./chunk-PGOYDOI4.js";
|
|
22
|
-
import "./chunk-SSDLHWSF.js";
|
|
23
|
-
import "./chunk-B67BK5GQ.js";
|
|
24
|
-
export {
|
|
25
|
-
FIX_ATTEMPTS,
|
|
26
|
-
cardFromFinding,
|
|
27
|
-
commitFix,
|
|
28
|
-
commitOnly,
|
|
29
|
-
describeFix,
|
|
30
|
-
describeSmallChange,
|
|
31
|
-
dirtyPaths,
|
|
32
|
-
runFix,
|
|
33
|
-
runSmallChange
|
|
34
|
-
};
|