p-backlog 0.14.5 → 0.14.7
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/CHANGELOG.md +8 -0
- package/README.md +3 -2
- package/README.ru.md +3 -2
- package/dist/cli.js +304 -209
- package/dist/web/assets/{CodeTab-rgZ3oazM.js → CodeTab-_hswvGhR.js} +1 -1
- package/dist/web/assets/{CostTab-DR8zJt7h.js → CostTab-B45am3iT.js} +1 -1
- package/dist/web/assets/{EffectTab-DHdQSIlQ.js → EffectTab-BWrxZuDh.js} +1 -1
- package/dist/web/assets/{Figure-C2iLoqkF.js → Figure-C7mZic1d.js} +1 -1
- package/dist/web/assets/{OverviewTab-uNqeJSFu.js → OverviewTab-DPfu4cwL.js} +1 -1
- package/dist/web/assets/{Page-lpBrfWDj.js → Page-BY5pJG0W.js} +5 -5
- package/dist/web/assets/{QualityTab-hbgPdBwD.js → QualityTab-CeAPraBM.js} +1 -1
- package/dist/web/assets/{ShareBar-BXak6vBR.js → ShareBar-Do4ChaCM.js} +1 -1
- package/dist/web/assets/{StatsPage-CO1e1tAe.js → StatsPage-BVEaoI_Q.js} +1 -1
- package/dist/web/assets/{StatsTabState-ChT0Ee4K.js → StatsTabState-BnBfyJUZ.js} +1 -1
- package/dist/web/assets/{StatsTable-C0PeMtyw.js → StatsTable-DvgWwXbV.js} +1 -1
- package/dist/web/assets/{UnavailableRepos-CykRKvjj.js → UnavailableRepos-CSItGhrg.js} +1 -1
- package/dist/web/assets/{index-BuEw4eHx.js → index-C3BHVlUw.js} +2 -2
- package/dist/web/assets/start-D7vHv3Nm.js +257 -0
- package/dist/web/assets/{start-BvKCcZHI.css → start-Dt9zi6Yh.css} +1 -1
- package/dist/web/assets/{use-grain-panel-BrOKdaLI.js → use-grain-panel-BU4IiIEr.js} +7 -7
- package/dist/web/assets/web-paths-CUpod7kw.js +1 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/start-CmS4D9jZ.js +0 -257
- package/dist/web/assets/web-paths-B6f4e9Br.js +0 -1
package/dist/cli.js
CHANGED
|
@@ -116,7 +116,7 @@ var SERVE_COMMAND_NAME = "serve";
|
|
|
116
116
|
// src/cli/main.ts
|
|
117
117
|
import { homedir } from "node:os";
|
|
118
118
|
import { dirname as dirname13, resolve as resolve7 } from "node:path";
|
|
119
|
-
import { fileURLToPath } from "node:url";
|
|
119
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
120
120
|
|
|
121
121
|
// src/core/store/runs.ts
|
|
122
122
|
import { mkdir } from "node:fs/promises";
|
|
@@ -914,7 +914,29 @@ ${content}
|
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
// src/core/model/types.ts
|
|
917
|
+
import { z as z5 } from "zod";
|
|
918
|
+
|
|
919
|
+
// src/core/model/probability.ts
|
|
917
920
|
import { z as z4 } from "zod";
|
|
921
|
+
var MAX_PROBABILITY = 100;
|
|
922
|
+
var probabilitySchema = z4.number().int().min(0).max(MAX_PROBABILITY);
|
|
923
|
+
function parseProbability(value) {
|
|
924
|
+
const text = value.trim();
|
|
925
|
+
return /^\d+$/u.test(text) ? probabilitySchema.safeParse(Number(text)).data : void 0;
|
|
926
|
+
}
|
|
927
|
+
function parseProbabilityFilter(value) {
|
|
928
|
+
if (value == null) return void 0;
|
|
929
|
+
if (value === "none") return value;
|
|
930
|
+
const [lower = "", upper, ...rest] = value.split("..").map((part) => part.trim());
|
|
931
|
+
if (upper === void 0 || rest.length > 0) return void 0;
|
|
932
|
+
const min = parseProbability(lower);
|
|
933
|
+
const max = parseProbability(upper);
|
|
934
|
+
if (lower !== "" && min === void 0 || upper !== "" && max === void 0) return void 0;
|
|
935
|
+
if (min === void 0 && max === void 0 || (min ?? 0) > (max ?? MAX_PROBABILITY)) return void 0;
|
|
936
|
+
return { min, max };
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// src/core/model/types.ts
|
|
918
940
|
var TASK_TYPES = ["task", "epic"];
|
|
919
941
|
var TASK_STATUSES = ["backlog", "in-progress", "blocked", "done", "cancelled"];
|
|
920
942
|
var PRIORITIES = ["low", "medium", "high", "critical"];
|
|
@@ -931,33 +953,34 @@ function normalizeTags(tags) {
|
|
|
931
953
|
)
|
|
932
954
|
];
|
|
933
955
|
}
|
|
934
|
-
var taskIdSchema =
|
|
935
|
-
var taskIdList =
|
|
936
|
-
var taskFrontmatterSchema =
|
|
956
|
+
var taskIdSchema = z5.string().regex(ID_PATTERN, schemaCode("bad-id"));
|
|
957
|
+
var taskIdList = z5.array(taskIdSchema).default([]).transform((ids) => [...new Set(ids)]);
|
|
958
|
+
var taskFrontmatterSchema = z5.object({
|
|
937
959
|
id: taskIdSchema,
|
|
938
|
-
title:
|
|
939
|
-
type:
|
|
940
|
-
status:
|
|
941
|
-
priority:
|
|
942
|
-
|
|
943
|
-
|
|
960
|
+
title: z5.string().trim().min(1, schemaCode("empty-title")),
|
|
961
|
+
type: z5.enum(TASK_TYPES).default("task"),
|
|
962
|
+
status: z5.enum(TASK_STATUSES).default("backlog"),
|
|
963
|
+
priority: z5.enum(PRIORITIES).default("medium"),
|
|
964
|
+
probability: probabilitySchema.nullable().transform((value) => value ?? void 0).optional(),
|
|
965
|
+
category: z5.enum(TASK_CATEGORIES).optional(),
|
|
966
|
+
tags: z5.array(z5.string()).default([]).transform(normalizeTags),
|
|
944
967
|
epic: taskIdSchema.optional(),
|
|
945
968
|
blockedBy: taskIdList,
|
|
946
969
|
related: taskIdList,
|
|
947
|
-
created:
|
|
948
|
-
source:
|
|
949
|
-
anchor:
|
|
950
|
-
closed:
|
|
951
|
-
resolution:
|
|
952
|
-
reason:
|
|
953
|
-
verified:
|
|
970
|
+
created: z5.iso.datetime({ offset: true }),
|
|
971
|
+
source: z5.string().optional(),
|
|
972
|
+
anchor: z5.string().optional(),
|
|
973
|
+
closed: z5.iso.datetime({ offset: true }).optional(),
|
|
974
|
+
resolution: z5.enum(RESOLUTIONS).optional(),
|
|
975
|
+
reason: z5.string().optional(),
|
|
976
|
+
verified: z5.iso.datetime({ offset: true }).optional()
|
|
954
977
|
});
|
|
955
|
-
var projectFrontmatterSchema =
|
|
956
|
-
name:
|
|
957
|
-
prefix:
|
|
958
|
-
repos:
|
|
959
|
-
issuedUpTo:
|
|
960
|
-
active:
|
|
978
|
+
var projectFrontmatterSchema = z5.object({
|
|
979
|
+
name: z5.string().trim().min(1, schemaCode("empty-name")),
|
|
980
|
+
prefix: z5.string().regex(PREFIX_PATTERN, schemaCode("bad-prefix")),
|
|
981
|
+
repos: z5.array(z5.string()).default([]),
|
|
982
|
+
issuedUpTo: z5.number().int().nonnegative().optional(),
|
|
983
|
+
active: z5.boolean().default(true)
|
|
961
984
|
});
|
|
962
985
|
|
|
963
986
|
// src/core/model/project-file.ts
|
|
@@ -1187,7 +1210,7 @@ function hostCliEnv() {
|
|
|
1187
1210
|
}
|
|
1188
1211
|
|
|
1189
1212
|
// src/core/messages/en.ts
|
|
1190
|
-
import { z as
|
|
1213
|
+
import { z as z6 } from "zod";
|
|
1191
1214
|
|
|
1192
1215
|
// src/core/model/source.ts
|
|
1193
1216
|
var SOURCE_LINES = /:(\d+)(?:-(\d+))?$/;
|
|
@@ -1323,7 +1346,7 @@ function witnessOf(type) {
|
|
|
1323
1346
|
}
|
|
1324
1347
|
|
|
1325
1348
|
// src/core/messages/en.ts
|
|
1326
|
-
var zodEn =
|
|
1349
|
+
var zodEn = z6.locales.en().localeError;
|
|
1327
1350
|
var CATEGORY_LABELS = {
|
|
1328
1351
|
bloaters: "Bloaters",
|
|
1329
1352
|
"change-preventers": "Change preventers",
|
|
@@ -1586,8 +1609,8 @@ var coreEn = {
|
|
|
1586
1609
|
};
|
|
1587
1610
|
|
|
1588
1611
|
// src/core/messages/ru.ts
|
|
1589
|
-
import { z as
|
|
1590
|
-
var zodRu =
|
|
1612
|
+
import { z as z7 } from "zod";
|
|
1613
|
+
var zodRu = z7.locales.ru().localeError;
|
|
1591
1614
|
var CATEGORY_LABELS2 = {
|
|
1592
1615
|
bloaters: "\u0420\u0430\u0437\u0431\u0443\u0445\u0448\u0435\u0435",
|
|
1593
1616
|
"change-preventers": "\u041C\u0435\u0448\u0430\u0435\u0442 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F\u043C",
|
|
@@ -1910,11 +1933,11 @@ function taskCreation(record, created) {
|
|
|
1910
1933
|
}
|
|
1911
1934
|
|
|
1912
1935
|
// src/core/journal/events.ts
|
|
1913
|
-
import { z as
|
|
1936
|
+
import { z as z8 } from "zod";
|
|
1914
1937
|
var CHANGE_SOURCES = ["cli", "web", "check", "sweep"];
|
|
1915
1938
|
var UNKNOWN = "unknown";
|
|
1916
1939
|
function recordedEnum(values) {
|
|
1917
|
-
return
|
|
1940
|
+
return z8.enum([...values, UNKNOWN]).catch(UNKNOWN);
|
|
1918
1941
|
}
|
|
1919
1942
|
var FOUND_HOW = ["review", "incidental", "manual"];
|
|
1920
1943
|
var CANDIDATE_EVIDENCE = ["source-changed", "source-missing", "duplicate", "no-source"];
|
|
@@ -1923,7 +1946,7 @@ var CHECK_METHODS = ["symbol", "anchor", "file"];
|
|
|
1923
1946
|
var RECORDED_METHODS = [...CHECK_METHODS, UNKNOWN];
|
|
1924
1947
|
var DUPLICATE_MATCHES = ["source", "title", "symbol"];
|
|
1925
1948
|
var RECORDED_MATCHES = [...DUPLICATE_MATCHES, UNKNOWN];
|
|
1926
|
-
var legacyMethodFlagsSchema =
|
|
1949
|
+
var legacyMethodFlagsSchema = z8.object({ bySymbol: z8.boolean().optional(), byAnchor: z8.boolean().optional() });
|
|
1927
1950
|
function recordedMethodOf(marks) {
|
|
1928
1951
|
return marks.method ?? methodOfLegacyFlags(marks);
|
|
1929
1952
|
}
|
|
@@ -1931,42 +1954,42 @@ function methodOfLegacyFlags({ bySymbol, byAnchor }) {
|
|
|
1931
1954
|
if (bySymbol === true) return "symbol";
|
|
1932
1955
|
return byAnchor === true ? "anchor" : UNKNOWN;
|
|
1933
1956
|
}
|
|
1934
|
-
var eventBase = { at:
|
|
1957
|
+
var eventBase = { at: z8.iso.datetime({ offset: true }), task: z8.string().min(1), via: recordedEnum(CHANGE_SOURCES), undo: z8.literal(true).optional().catch(void 0) };
|
|
1935
1958
|
var taskSnapshotSchema = taskFrontmatterSchema.extend({
|
|
1936
1959
|
priority: recordedEnum(PRIORITIES),
|
|
1937
1960
|
category: recordedEnum(TASK_CATEGORIES).optional(),
|
|
1938
1961
|
resolution: recordedEnum(RESOLUTIONS).optional()
|
|
1939
1962
|
});
|
|
1940
|
-
var journalEventSchema =
|
|
1941
|
-
|
|
1963
|
+
var journalEventSchema = z8.discriminatedUnion("kind", [
|
|
1964
|
+
z8.object({
|
|
1942
1965
|
...eventBase,
|
|
1943
|
-
kind:
|
|
1944
|
-
type:
|
|
1966
|
+
kind: z8.literal("created"),
|
|
1967
|
+
type: z8.enum(TASK_TYPES),
|
|
1945
1968
|
priority: recordedEnum(PRIORITIES),
|
|
1946
|
-
tags:
|
|
1947
|
-
source:
|
|
1948
|
-
epic:
|
|
1969
|
+
tags: z8.array(z8.string()),
|
|
1970
|
+
source: z8.string().optional(),
|
|
1971
|
+
epic: z8.string().optional(),
|
|
1949
1972
|
category: recordedEnum(TASK_CATEGORIES).optional(),
|
|
1950
1973
|
found: recordedEnum(FOUND_HOW).optional(),
|
|
1951
|
-
origin:
|
|
1974
|
+
origin: z8.object({ branch: z8.string().optional(), commit: z8.string().min(1) }).optional()
|
|
1952
1975
|
}),
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1976
|
+
z8.object({ ...eventBase, kind: z8.literal("status"), from: z8.enum(TASK_STATUSES), to: z8.enum(TASK_STATUSES), resolution: recordedEnum(RESOLUTIONS).optional() }),
|
|
1977
|
+
z8.object({ ...eventBase, kind: z8.literal("priority"), from: recordedEnum(PRIORITIES), to: recordedEnum(PRIORITIES) }),
|
|
1978
|
+
z8.object({ ...eventBase, kind: z8.literal("deleted"), snapshot: taskSnapshotSchema }),
|
|
1979
|
+
z8.object({ ...eventBase, kind: z8.literal("category"), from: recordedEnum(TASK_CATEGORIES).optional(), to: recordedEnum(TASK_CATEGORIES).optional() }),
|
|
1980
|
+
z8.object({ ...eventBase, kind: z8.literal("verified"), source: z8.string().optional(), commit: z8.string().min(1).optional().catch(void 0) }),
|
|
1981
|
+
z8.object({
|
|
1959
1982
|
...eventBase,
|
|
1960
|
-
kind:
|
|
1961
|
-
evidence:
|
|
1983
|
+
kind: z8.literal("candidate"),
|
|
1984
|
+
evidence: z8.enum(CANDIDATE_EVIDENCE),
|
|
1962
1985
|
mode: recordedEnum(CHECK_MODES),
|
|
1963
1986
|
method: recordedEnum(CHECK_METHODS).optional(),
|
|
1964
1987
|
...legacyMethodFlagsSchema.shape,
|
|
1965
1988
|
match: recordedEnum(DUPLICATE_MATCHES).optional(),
|
|
1966
|
-
model:
|
|
1989
|
+
model: z8.string().trim().min(1).optional().catch(void 0)
|
|
1967
1990
|
}),
|
|
1968
|
-
|
|
1969
|
-
|
|
1991
|
+
z8.object({ ...eventBase, kind: z8.literal("candidate-gone"), evidence: z8.enum(CANDIDATE_EVIDENCE) }),
|
|
1992
|
+
z8.object({ ...eventBase, kind: z8.literal("candidate-filtered"), symbol: z8.string() })
|
|
1970
1993
|
]);
|
|
1971
1994
|
var SNAPSHOT_FIELDS = Object.keys(taskSnapshotSchema.shape);
|
|
1972
1995
|
function hasUnknownValue(event) {
|
|
@@ -2705,6 +2728,7 @@ function applyChanges(task, changes, now, closure) {
|
|
|
2705
2728
|
...pickDefined(changes, CHANGE_FIELDS),
|
|
2706
2729
|
epic: nextOptional(task.epic, changes.epic),
|
|
2707
2730
|
category: nextOptional(task.category, changes.category),
|
|
2731
|
+
probability: nextOptional(task.probability, changes.probability),
|
|
2708
2732
|
anchor: nextAnchor(task, changes)
|
|
2709
2733
|
};
|
|
2710
2734
|
const moved = changes.status === void 0 ? edited : changeStatus(edited, changes.status, now, closure);
|
|
@@ -2899,6 +2923,8 @@ var cliEn = {
|
|
|
2899
2923
|
},
|
|
2900
2924
|
invalidChoice: (label, allowed, value) => `${label}: expected one of ${allowed.join(", ")}, got "${value}"`,
|
|
2901
2925
|
invalidPort: (source, value) => `${source}: expected a number from 1 to 65535, got "${value}"`,
|
|
2926
|
+
invalidProbability: (value) => `Probability must be a whole number from 0 to 100, got "${value}"`,
|
|
2927
|
+
invalidProbabilityFilter: (value) => `--probability expects an inclusive range (20..80, ..80 or 20..) with bounds from 0 to 100, or none, got "${value}"`,
|
|
2902
2928
|
commandFailed: (name, reason) => `Command ${name} failed: ${reason}`,
|
|
2903
2929
|
runNotRecorded: (error) => `Could not record the run: ${error}`,
|
|
2904
2930
|
sweepConflicts: (ids) => `Tasks changed while closed tasks were swept, the sweep will run again in a day: ${ids}`,
|
|
@@ -3046,7 +3072,7 @@ var cliEn = {
|
|
|
3046
3072
|
alertsShownWriteFailed: (error) => `Could not save the shown alerts: ${error}`,
|
|
3047
3073
|
hookTurnClaimFailed: (error) => `Could not record the turn for the double-hook guard: ${error}`,
|
|
3048
3074
|
newUsage: (types, priorities, found, defaultFound) => [
|
|
3049
|
-
`--title <title> [--type ${types}] [--priority ${priorities}] [--tags a,b]`,
|
|
3075
|
+
`--title <title> [--type ${types}] [--priority ${priorities}] [--probability <0..100>] [--tags a,b]`,
|
|
3050
3076
|
`--category <category> (required for tasks) [--found ${found}, default ${defaultFound}]`,
|
|
3051
3077
|
"[--source file:line] [--epic ID] [--blocked-by ID,\u2026] [--related ID,\u2026] [--project id] [--json]",
|
|
3052
3078
|
"[--force \u2014 create anyway even if a similar open task already exists]",
|
|
@@ -3072,7 +3098,7 @@ var cliEn = {
|
|
|
3072
3098
|
fixCommitRequired: 'Provide the fix commit: --reason "Fixed in <sha>: \u2026" (the commit must be in the project repository)',
|
|
3073
3099
|
deletesAtTail: (date) => `. Will be deleted ${date}`,
|
|
3074
3100
|
afterEpicCloses: (epic) => `after epic ${epic} closes`,
|
|
3075
|
-
listUsage: () => "[--query text] [--status s,\u2026] [--tag t,\u2026] [--project id | --all-projects] [--json]",
|
|
3101
|
+
listUsage: () => "[--query text] [--status s,\u2026] [--tag t,\u2026] [--probability <min..max|none>] [--project id | --all-projects] [--json]",
|
|
3076
3102
|
parseErrorLine: (path, problems3) => `Parse error in ${path}: ${problems3}`,
|
|
3077
3103
|
noTasksFound: "No tasks found",
|
|
3078
3104
|
fixedHeader: "Fixed:",
|
|
@@ -3095,6 +3121,8 @@ var cliRu = {
|
|
|
3095
3121
|
},
|
|
3096
3122
|
invalidChoice: (label, allowed, value) => `${label}: \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F \u043E\u0434\u043D\u043E \u0438\u0437 ${allowed.join(", ")}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E \xAB${value}\xBB`,
|
|
3097
3123
|
invalidPort: (source, value) => `${source}: \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F \u0447\u0438\u0441\u043B\u043E \u043E\u0442 1 \u0434\u043E 65535, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E \xAB${value}\xBB`,
|
|
3124
|
+
invalidProbability: (value) => `\u0412\u0435\u0440\u043E\u044F\u0442\u043D\u043E\u0441\u0442\u044C \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0446\u0435\u043B\u044B\u043C \u0447\u0438\u0441\u043B\u043E\u043C \u043E\u0442 0 \u0434\u043E 100, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E \xAB${value}\xBB`,
|
|
3125
|
+
invalidProbabilityFilter: (value) => `\u0414\u043B\u044F --probability \u0443\u043A\u0430\u0436\u0438\u0442\u0435 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D \u0432\u043A\u043B\u044E\u0447\u0438\u0442\u0435\u043B\u044C\u043D\u043E (20..80, ..80 \u0438\u043B\u0438 20..) \u0441 \u0433\u0440\u0430\u043D\u0438\u0446\u0430\u043C\u0438 \u043E\u0442 0 \u0434\u043E 100 \u0438\u043B\u0438 none. \u041F\u043E\u043B\u0443\u0447\u0435\u043D\u043E \xAB${value}\xBB`,
|
|
3098
3126
|
commandFailed: (name, reason) => `\u041A\u043E\u043C\u0430\u043D\u0434\u0430 ${name} \u043D\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0430: ${reason}`,
|
|
3099
3127
|
runNotRecorded: (error) => `\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C \u0437\u0430\u043F\u0443\u0441\u043A: ${error}`,
|
|
3100
3128
|
sweepConflicts: (ids) => `\u0417\u0430\u0434\u0430\u0447\u0438 \u043C\u0435\u043D\u044F\u043B\u0438\u0441\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u0443\u0431\u043E\u0440\u043A\u0438 \u0437\u0430\u043A\u0440\u044B\u0442\u044B\u0445, \u043E\u043D\u0430 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0441\u044F \u0447\u0435\u0440\u0435\u0437 \u0441\u0443\u0442\u043A\u0438: ${ids}`,
|
|
@@ -3242,7 +3270,7 @@ var cliRu = {
|
|
|
3242
3270
|
alertsShownWriteFailed: (error) => `\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043F\u043E\u043A\u0430\u0437\u0430\u043D\u043D\u044B\u0435 \u0442\u0440\u0435\u0432\u043E\u0433\u0438: ${error}`,
|
|
3243
3271
|
hookTurnClaimFailed: (error) => `\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043C\u0435\u0442\u0438\u0442\u044C \u0445\u043E\u0434 \u0432 \u0437\u0430\u0449\u0438\u0442\u0435 \u043E\u0442 \u0434\u0432\u043E\u0439\u043D\u043E\u0433\u043E \u0445\u0443\u043A\u0430: ${error}`,
|
|
3244
3272
|
newUsage: (types, priorities, found, defaultFound) => [
|
|
3245
|
-
`--title <\u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A> [--type ${types}] [--priority ${priorities}] [--tags a,b]`,
|
|
3273
|
+
`--title <\u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A> [--type ${types}] [--priority ${priorities}] [--probability <0..100>] [--tags a,b]`,
|
|
3246
3274
|
`--category <\u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F> (\u0434\u043B\u044F \u0437\u0430\u0434\u0430\u0447 \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u0435\u043D) [--found ${found}, \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E ${defaultFound}]`,
|
|
3247
3275
|
"[--source \u0444\u0430\u0439\u043B:\u0441\u0442\u0440\u043E\u043A\u0430] [--epic ID] [--blocked-by ID,\u2026] [--related ID,\u2026] [--project id] [--json]",
|
|
3248
3276
|
"[--force \u2014 \u0441\u043E\u0437\u0434\u0430\u0442\u044C, \u0434\u0430\u0436\u0435 \u0435\u0441\u043B\u0438 \u043F\u043E\u0445\u043E\u0436\u0430\u044F \u043E\u0442\u043A\u0440\u044B\u0442\u0430\u044F \u0437\u0430\u0434\u0430\u0447\u0430 \u0443\u0436\u0435 \u0435\u0441\u0442\u044C]",
|
|
@@ -3268,7 +3296,7 @@ var cliRu = {
|
|
|
3268
3296
|
fixCommitRequired: '\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043A\u043E\u043C\u043C\u0438\u0442 \u0438\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F: --reason "\u0418\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043E \u0432 <sha>: \u2026" (\u043A\u043E\u043C\u043C\u0438\u0442 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0432 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430)',
|
|
3269
3297
|
deletesAtTail: (date) => `. \u0423\u0434\u0430\u043B\u0438\u0442\u0441\u044F ${date}`,
|
|
3270
3298
|
afterEpicCloses: (epic) => `\u043F\u043E\u0441\u043B\u0435 \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F \u044D\u043F\u0438\u043A\u0430 ${epic}`,
|
|
3271
|
-
listUsage: () => "[--query \u0442\u0435\u043A\u0441\u0442] [--status s,\u2026] [--tag t,\u2026] [--project id | --all-projects] [--json]",
|
|
3299
|
+
listUsage: () => "[--query \u0442\u0435\u043A\u0441\u0442] [--status s,\u2026] [--tag t,\u2026] [--probability <min..max|none>] [--project id | --all-projects] [--json]",
|
|
3272
3300
|
parseErrorLine: (path, problems3) => `\u041E\u0448\u0438\u0431\u043A\u0430 \u0440\u0430\u0437\u0431\u043E\u0440\u0430 ${path}: ${problems3}`,
|
|
3273
3301
|
noTasksFound: "\u0417\u0430\u0434\u0430\u0447 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",
|
|
3274
3302
|
fixedHeader: "\u0418\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043E:",
|
|
@@ -3407,6 +3435,11 @@ function parseChoice(language, value, allowed, label) {
|
|
|
3407
3435
|
if (match === void 0) throw new UsageError(cliMessages(language).invalidChoice(label, allowed, value));
|
|
3408
3436
|
return match;
|
|
3409
3437
|
}
|
|
3438
|
+
function parseProbabilityValue(language, value) {
|
|
3439
|
+
const probability = parseProbability(value);
|
|
3440
|
+
if (probability === void 0) throw new UsageError(cliMessages(language).invalidProbability(value));
|
|
3441
|
+
return probability;
|
|
3442
|
+
}
|
|
3410
3443
|
function parsePort(language, value) {
|
|
3411
3444
|
return portNumber(value) ?? invalidPort(language, "--port", value);
|
|
3412
3445
|
}
|
|
@@ -5001,6 +5034,7 @@ function draftTask(id, path, { project, input, now }) {
|
|
|
5001
5034
|
type: input.type ?? "task",
|
|
5002
5035
|
status: "backlog",
|
|
5003
5036
|
priority: input.priority ?? "medium",
|
|
5037
|
+
probability: input.probability,
|
|
5004
5038
|
category: input.category,
|
|
5005
5039
|
tags: input.tags ?? [],
|
|
5006
5040
|
epic: input.epic,
|
|
@@ -5675,7 +5709,7 @@ ${task.body}`);
|
|
|
5675
5709
|
function filterTasks(tasks, filter, index) {
|
|
5676
5710
|
const tags = (filter.tags ?? []).map(normalizeTag);
|
|
5677
5711
|
return tasks.filter(
|
|
5678
|
-
(task) => (filter.projectId === void 0 || task.projectId === filter.projectId) && (filter.query === void 0 || matchesQuery(task, filter.query)) && anyOrIncludes(filter.statuses, task.status) && anyOrIncludes(filter.priorities, task.priority) && tags.every((tag) => task.tags.includes(tag)) && matchesEpic(task, filter.epic) && (filter.type === void 0 || task.type === filter.type) && (!filter.onlyUnblocked || !isBlocked(task, index))
|
|
5712
|
+
(task) => (filter.projectId === void 0 || task.projectId === filter.projectId) && (filter.query === void 0 || matchesQuery(task, filter.query)) && anyOrIncludes(filter.statuses, task.status) && anyOrIncludes(filter.priorities, task.priority) && matchesProbability(task.probability, filter.probability) && tags.every((tag) => task.tags.includes(tag)) && matchesEpic(task, filter.epic) && (filter.type === void 0 || task.type === filter.type) && (!filter.onlyUnblocked || !isBlocked(task, index))
|
|
5679
5713
|
);
|
|
5680
5714
|
}
|
|
5681
5715
|
function sortTasks(tasks, sort, index, language) {
|
|
@@ -5732,6 +5766,11 @@ function matchesEpic(task, epic) {
|
|
|
5732
5766
|
if (epic === null) return task.epic === void 0;
|
|
5733
5767
|
return task.epic === epic;
|
|
5734
5768
|
}
|
|
5769
|
+
function matchesProbability(probability, filter) {
|
|
5770
|
+
if (filter === void 0) return true;
|
|
5771
|
+
if (filter === "none") return probability === void 0;
|
|
5772
|
+
return probability !== void 0 && probability >= (filter.min ?? 0) && probability <= (filter.max ?? MAX_PROBABILITY);
|
|
5773
|
+
}
|
|
5735
5774
|
function anyOrIncludes(allowed, value) {
|
|
5736
5775
|
return allowed === void 0 || allowed.includes(value);
|
|
5737
5776
|
}
|
|
@@ -6707,7 +6746,7 @@ async function isDirectory(path) {
|
|
|
6707
6746
|
// src/cli/skill-link.ts
|
|
6708
6747
|
import { mkdir as mkdir4, readlink as readlink2, symlink, unlink } from "node:fs/promises";
|
|
6709
6748
|
import { basename as basename8, dirname as dirname7, join as join22, resolve as resolve3 } from "node:path";
|
|
6710
|
-
import { z as
|
|
6749
|
+
import { z as z9 } from "zod";
|
|
6711
6750
|
|
|
6712
6751
|
// src/core/skill-name.ts
|
|
6713
6752
|
var SKILL_NAME = "backlog";
|
|
@@ -6721,7 +6760,7 @@ var SKILL_VARIANTS = {
|
|
|
6721
6760
|
|
|
6722
6761
|
// src/cli/skill-link.ts
|
|
6723
6762
|
var SKILL_SOURCE_DIRS = new Set(Object.values(SKILL_VARIANTS).map((variant) => variant.sourceDir));
|
|
6724
|
-
var packageManifestSchema =
|
|
6763
|
+
var packageManifestSchema = z9.object({ name: z9.string() });
|
|
6725
6764
|
function skillSourceDir(packageRoot2, language) {
|
|
6726
6765
|
return join22(packageRoot2, SKILL_SOURCES_DIR, SKILL_VARIANTS[language].sourceDir);
|
|
6727
6766
|
}
|
|
@@ -6777,10 +6816,10 @@ async function linkAgentSkill(agent, site, link2) {
|
|
|
6777
6816
|
}
|
|
6778
6817
|
|
|
6779
6818
|
// src/cli/agents/claude-plugin.ts
|
|
6780
|
-
import { z as
|
|
6819
|
+
import { z as z10 } from "zod";
|
|
6781
6820
|
var PLUGIN_NAMES = new Set(Object.values(SKILL_VARIANTS).map((variant) => variant.plugin));
|
|
6782
6821
|
var MARKETPLACE_SEPARATOR = "@";
|
|
6783
|
-
var enabledPluginsSchema =
|
|
6822
|
+
var enabledPluginsSchema = z10.object({ enabledPlugins: z10.record(z10.string(), z10.unknown()).optional() });
|
|
6784
6823
|
async function agentPluginReportingFailure(agent, places, onUnreadable) {
|
|
6785
6824
|
const settingsPath = AGENT_SPECS[agent].pluginSettingsPath;
|
|
6786
6825
|
if (settingsPath === null) return { plugin: null };
|
|
@@ -6895,7 +6934,7 @@ import { parseArgs as parseArgs2 } from "node:util";
|
|
|
6895
6934
|
|
|
6896
6935
|
// src/core/store/hook-turns.ts
|
|
6897
6936
|
import { join as join23 } from "node:path";
|
|
6898
|
-
import { z as
|
|
6937
|
+
import { z as z11 } from "zod";
|
|
6899
6938
|
|
|
6900
6939
|
// src/core/store/json-under-lock.ts
|
|
6901
6940
|
function updateJsonUnderLock(path, schema, empty, update, options) {
|
|
@@ -6914,7 +6953,7 @@ function updateJsonUnderLock(path, schema, empty, update, options) {
|
|
|
6914
6953
|
// src/core/store/hook-turns.ts
|
|
6915
6954
|
var HOOK_TURNS_FILE = ".hook-turns.json";
|
|
6916
6955
|
var CLAIM_WINDOW_MS = 6e4;
|
|
6917
|
-
var hookTurnsSchema =
|
|
6956
|
+
var hookTurnsSchema = z11.record(z11.string(), z11.iso.datetime({ offset: true }));
|
|
6918
6957
|
async function claimHookTurn(backlogRoot2, turnKey, { now, onError }) {
|
|
6919
6958
|
const outcome = await updateJsonUnderLock(
|
|
6920
6959
|
join23(backlogRoot2, HOOK_TURNS_FILE),
|
|
@@ -6932,7 +6971,7 @@ async function claimHookTurn(backlogRoot2, turnKey, { now, onError }) {
|
|
|
6932
6971
|
|
|
6933
6972
|
// src/core/store/signals-shown.ts
|
|
6934
6973
|
import { join as join24 } from "node:path";
|
|
6935
|
-
import { z as
|
|
6974
|
+
import { z as z12 } from "zod";
|
|
6936
6975
|
|
|
6937
6976
|
// src/core/model/signals-shown.ts
|
|
6938
6977
|
function markShown(shown, signals, today) {
|
|
@@ -6944,7 +6983,7 @@ function signalsToShow(signals, shown, today) {
|
|
|
6944
6983
|
|
|
6945
6984
|
// src/core/store/signals-shown.ts
|
|
6946
6985
|
var SIGNALS_SHOWN_FILE = ".signals-shown.json";
|
|
6947
|
-
var shownSchema =
|
|
6986
|
+
var shownSchema = z12.record(z12.string(), z12.string());
|
|
6948
6987
|
async function readSignalsShown(projectDir) {
|
|
6949
6988
|
return await readJsonFile(join24(projectDir, SIGNALS_SHOWN_FILE), shownSchema) ?? {};
|
|
6950
6989
|
}
|
|
@@ -6954,11 +6993,11 @@ async function rememberSignalsShown(projectDir, signals, today, onError) {
|
|
|
6954
6993
|
|
|
6955
6994
|
// src/core/store/session-shown.ts
|
|
6956
6995
|
import { join as join25 } from "node:path";
|
|
6957
|
-
import { z as
|
|
6996
|
+
import { z as z13 } from "zod";
|
|
6958
6997
|
var SESSION_SHOWN_FILE = ".candidates-shown.json";
|
|
6959
6998
|
var SESSION_RETENTION_MS = WEEK_MS;
|
|
6960
6999
|
var CODE_STATE_MARK = "@";
|
|
6961
|
-
var sessionsShownSchema =
|
|
7000
|
+
var sessionsShownSchema = z13.record(z13.string(), z13.object({ tasks: z13.array(z13.string()), at: z13.iso.datetime({ offset: true }) }));
|
|
6962
7001
|
function shownKey({ taskId, codeState }) {
|
|
6963
7002
|
return codeState === void 0 ? taskId : `${taskId}${CODE_STATE_MARK}${codeState}`;
|
|
6964
7003
|
}
|
|
@@ -7300,23 +7339,23 @@ function measuredByClosing(evidence2) {
|
|
|
7300
7339
|
|
|
7301
7340
|
// src/cli/agents/stop-event.ts
|
|
7302
7341
|
import { createHash as createHash4 } from "node:crypto";
|
|
7303
|
-
import { z as
|
|
7342
|
+
import { z as z14 } from "zod";
|
|
7304
7343
|
var TURN_DIGEST_LENGTH = 16;
|
|
7305
7344
|
var CURSOR_COMPLETED = "completed";
|
|
7306
|
-
var claudeEventSchema =
|
|
7307
|
-
cwd:
|
|
7308
|
-
session_id:
|
|
7309
|
-
turn_id:
|
|
7310
|
-
stop_hook_active:
|
|
7311
|
-
last_assistant_message:
|
|
7312
|
-
model:
|
|
7345
|
+
var claudeEventSchema = z14.object({
|
|
7346
|
+
cwd: z14.string(),
|
|
7347
|
+
session_id: z14.string().optional(),
|
|
7348
|
+
turn_id: z14.string().optional(),
|
|
7349
|
+
stop_hook_active: z14.boolean().optional(),
|
|
7350
|
+
last_assistant_message: z14.string().nullish(),
|
|
7351
|
+
model: z14.string().trim().min(1).optional().catch(void 0)
|
|
7313
7352
|
});
|
|
7314
|
-
var cursorEventSchema =
|
|
7315
|
-
workspace_roots:
|
|
7316
|
-
conversation_id:
|
|
7317
|
-
generation_id:
|
|
7318
|
-
status:
|
|
7319
|
-
loop_count:
|
|
7353
|
+
var cursorEventSchema = z14.object({
|
|
7354
|
+
workspace_roots: z14.tuple([z14.string()], z14.string()),
|
|
7355
|
+
conversation_id: z14.string().optional(),
|
|
7356
|
+
generation_id: z14.string().optional(),
|
|
7357
|
+
status: z14.string().optional(),
|
|
7358
|
+
loop_count: z14.number().optional()
|
|
7320
7359
|
});
|
|
7321
7360
|
function parseStopEvent(agent, text) {
|
|
7322
7361
|
return AGENT_SPECS[agent].stopProtocol === "cursor" ? parseCursorEvent(text) : parseClaudeEvent(text);
|
|
@@ -7557,12 +7596,15 @@ async function runList(args, io) {
|
|
|
7557
7596
|
query: { type: "string" },
|
|
7558
7597
|
status: { type: "string" },
|
|
7559
7598
|
tag: { type: "string" },
|
|
7599
|
+
probability: { type: "string" },
|
|
7560
7600
|
...SCOPE_OPTIONS,
|
|
7561
7601
|
json: { type: "boolean", default: false }
|
|
7562
7602
|
});
|
|
7563
7603
|
const requestedStatuses = splitList(values.status);
|
|
7564
7604
|
if (requestedStatuses?.length === 0) throw new UsageError(io.cli.invalidChoice("--status", TASK_STATUSES, values.status ?? ""));
|
|
7565
7605
|
const statuses = requestedStatuses?.map((status) => parseChoice(io.language, status, TASK_STATUSES, "--status")) ?? OPEN_STATUSES;
|
|
7606
|
+
const probability = parseProbabilityFilter(values.probability);
|
|
7607
|
+
if (values.probability !== void 0 && probability === void 0) throw new UsageError(io.cli.invalidProbabilityFilter(values.probability));
|
|
7566
7608
|
const loaded = await loadBacklog(io.backlogRoot);
|
|
7567
7609
|
const scope = resolveScope(loaded, io, values);
|
|
7568
7610
|
if (scope === null) return EXIT.notFound;
|
|
@@ -7574,7 +7616,7 @@ async function runList(args, io) {
|
|
|
7574
7616
|
const inScope = new Set(scope.activeIds);
|
|
7575
7617
|
const filtered = filterTasks(
|
|
7576
7618
|
loaded.tasks.filter((task) => inScope.has(task.projectId)),
|
|
7577
|
-
{ projectId, query: values.query, statuses, tags: splitList(values.tag) },
|
|
7619
|
+
{ projectId, query: values.query, statuses, tags: splitList(values.tag), probability },
|
|
7578
7620
|
index
|
|
7579
7621
|
);
|
|
7580
7622
|
const tasks = sortTasks(filtered, { key: "priority", direction: "desc" }, index, io.language);
|
|
@@ -7608,6 +7650,7 @@ var NEW_OPTIONS = {
|
|
|
7608
7650
|
title: { type: "string" },
|
|
7609
7651
|
type: { type: "string" },
|
|
7610
7652
|
priority: { type: "string" },
|
|
7653
|
+
probability: { type: "string" },
|
|
7611
7654
|
tags: { type: "string" },
|
|
7612
7655
|
category: { type: "string" },
|
|
7613
7656
|
found: { type: "string" },
|
|
@@ -7624,6 +7667,7 @@ async function runNew(args, io) {
|
|
|
7624
7667
|
if (values.title === void 0) throw new UsageError(io.cli.titleRequired);
|
|
7625
7668
|
const type = values.type === void 0 ? void 0 : parseChoice(io.language, values.type, TASK_TYPES, "--type");
|
|
7626
7669
|
const priority = values.priority === void 0 ? void 0 : parseChoice(io.language, values.priority, PRIORITIES, "--priority");
|
|
7670
|
+
const probability = values.probability === void 0 ? void 0 : parseProbabilityValue(io.language, values.probability);
|
|
7627
7671
|
const category = values.category === void 0 ? void 0 : parseChoice(io.language, values.category, TASK_CATEGORIES, "--category");
|
|
7628
7672
|
if (category === void 0 && type !== "epic") throw new UsageError(io.cli.categoryRequired);
|
|
7629
7673
|
const found = values.found === void 0 ? DEFAULT_FOUND : parseChoice(io.language, values.found, FOUND_HOW, "--found");
|
|
@@ -7642,6 +7686,7 @@ async function runNew(args, io) {
|
|
|
7642
7686
|
title: values.title,
|
|
7643
7687
|
type,
|
|
7644
7688
|
priority,
|
|
7689
|
+
probability,
|
|
7645
7690
|
category,
|
|
7646
7691
|
tags: splitList(values.tags),
|
|
7647
7692
|
source: values.source,
|
|
@@ -7698,6 +7743,16 @@ var priorityCommand = taskFieldCommand({
|
|
|
7698
7743
|
label: (task) => task.priority
|
|
7699
7744
|
});
|
|
7700
7745
|
|
|
7746
|
+
// src/cli/commands/probability.ts
|
|
7747
|
+
var NO_PROBABILITY = "none";
|
|
7748
|
+
var probabilityCommand = taskFieldCommand({
|
|
7749
|
+
name: "probability",
|
|
7750
|
+
choices: `0..100|${NO_PROBABILITY}`,
|
|
7751
|
+
parse: (language, value) => value === NO_PROBABILITY ? null : parseProbabilityValue(language, value),
|
|
7752
|
+
changes: (probability) => ({ probability }),
|
|
7753
|
+
label: (task) => task.probability === void 0 ? "\u2014" : `${task.probability}%`
|
|
7754
|
+
});
|
|
7755
|
+
|
|
7701
7756
|
// src/cli/commands/project.ts
|
|
7702
7757
|
var ACTIVE_BY_STATE = { active: true, inactive: false };
|
|
7703
7758
|
var projectCommand = {
|
|
@@ -7816,43 +7871,44 @@ import { Hono as Hono2 } from "hono";
|
|
|
7816
7871
|
import { streamSSE } from "hono/streaming";
|
|
7817
7872
|
|
|
7818
7873
|
// src/core/api/contract.ts
|
|
7819
|
-
import { z as
|
|
7820
|
-
var idList =
|
|
7821
|
-
var taskChangesSchema =
|
|
7822
|
-
title:
|
|
7823
|
-
type:
|
|
7824
|
-
status:
|
|
7825
|
-
priority:
|
|
7826
|
-
|
|
7874
|
+
import { z as z15 } from "zod";
|
|
7875
|
+
var idList = z15.array(taskIdSchema);
|
|
7876
|
+
var taskChangesSchema = z15.strictObject({
|
|
7877
|
+
title: z15.string().optional(),
|
|
7878
|
+
type: z15.enum(TASK_TYPES).optional(),
|
|
7879
|
+
status: z15.enum(TASK_STATUSES).optional(),
|
|
7880
|
+
priority: z15.enum(PRIORITIES).optional(),
|
|
7881
|
+
probability: probabilitySchema.nullable().optional(),
|
|
7882
|
+
tags: z15.array(z15.string()).optional(),
|
|
7827
7883
|
epic: taskIdSchema.nullable().optional(),
|
|
7828
7884
|
blockedBy: idList.optional(),
|
|
7829
7885
|
related: idList.optional(),
|
|
7830
|
-
body:
|
|
7831
|
-
category:
|
|
7886
|
+
body: z15.string().optional(),
|
|
7887
|
+
category: z15.enum(TASK_CATEGORIES).nullable().optional()
|
|
7832
7888
|
});
|
|
7833
|
-
var projectActiveSchema =
|
|
7834
|
-
var projectDeleteSchema =
|
|
7835
|
-
var settingsRequestSchema =
|
|
7836
|
-
var updateTaskRequestSchema =
|
|
7837
|
-
version:
|
|
7889
|
+
var projectActiveSchema = z15.strictObject({ active: z15.boolean() });
|
|
7890
|
+
var projectDeleteSchema = z15.strictObject({ confirm: z15.string() });
|
|
7891
|
+
var settingsRequestSchema = z15.strictObject(settingsSchema.shape);
|
|
7892
|
+
var updateTaskRequestSchema = z15.strictObject({
|
|
7893
|
+
version: z15.string().min(1),
|
|
7838
7894
|
changes: taskChangesSchema
|
|
7839
7895
|
});
|
|
7840
|
-
var batchPreviousSchema =
|
|
7841
|
-
status:
|
|
7842
|
-
priority:
|
|
7896
|
+
var batchPreviousSchema = z15.strictObject({
|
|
7897
|
+
status: z15.enum(TASK_STATUSES),
|
|
7898
|
+
priority: z15.enum(PRIORITIES),
|
|
7843
7899
|
epic: taskIdSchema.nullable()
|
|
7844
7900
|
});
|
|
7845
7901
|
var BATCH_TASKS_LIMIT = 500;
|
|
7846
|
-
var batchRequestSchema =
|
|
7847
|
-
tasks:
|
|
7848
|
-
action:
|
|
7849
|
-
|
|
7850
|
-
kind:
|
|
7851
|
-
reason:
|
|
7902
|
+
var batchRequestSchema = z15.strictObject({
|
|
7903
|
+
tasks: z15.array(z15.strictObject({ id: taskIdSchema, version: z15.string().min(1) })).min(1).max(BATCH_TASKS_LIMIT).refine((tasks) => new Set(tasks.map((task) => task.id)).size === tasks.length),
|
|
7904
|
+
action: z15.discriminatedUnion("kind", [
|
|
7905
|
+
z15.strictObject({
|
|
7906
|
+
kind: z15.literal("close"),
|
|
7907
|
+
reason: z15.string().transform(normalizeClosingReason).pipe(z15.string().min(1))
|
|
7852
7908
|
}),
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7909
|
+
z15.strictObject({ kind: z15.literal("priority"), priority: z15.enum(PRIORITIES) }),
|
|
7910
|
+
z15.strictObject({ kind: z15.literal("epic"), epic: taskIdSchema.nullable() }),
|
|
7911
|
+
z15.strictObject({ kind: z15.literal("restore"), changes: z15.record(taskIdSchema, batchPreviousSchema) })
|
|
7856
7912
|
])
|
|
7857
7913
|
});
|
|
7858
7914
|
|
|
@@ -8360,22 +8416,22 @@ var STATS_MEMORY_ROUTE = "/stats/memory";
|
|
|
8360
8416
|
|
|
8361
8417
|
// src/core/code/code-cache.ts
|
|
8362
8418
|
import { join as join28 } from "node:path";
|
|
8363
|
-
import { z as
|
|
8419
|
+
import { z as z16 } from "zod";
|
|
8364
8420
|
var CODE_CACHE_FILE = ".code-cache.json";
|
|
8365
8421
|
var CODE_CACHE_VERSION = 3;
|
|
8366
|
-
var repoScanSchema =
|
|
8367
|
-
head:
|
|
8368
|
-
main:
|
|
8369
|
-
commits:
|
|
8370
|
-
units:
|
|
8371
|
-
lines:
|
|
8422
|
+
var repoScanSchema = z16.object({
|
|
8423
|
+
head: z16.string(),
|
|
8424
|
+
main: z16.string().nullable(),
|
|
8425
|
+
commits: z16.array(z16.object({ date: z16.string(), paths: z16.array(z16.string()) })),
|
|
8426
|
+
units: z16.array(z16.object({ date: z16.string(), lines: z16.number() })),
|
|
8427
|
+
lines: z16.array(z16.object({ path: z16.string(), lines: z16.number() }))
|
|
8372
8428
|
});
|
|
8373
|
-
var fixCommitSchema =
|
|
8374
|
-
var snapshotSchema =
|
|
8375
|
-
version:
|
|
8376
|
-
repos:
|
|
8377
|
-
fixes:
|
|
8378
|
-
unsettled:
|
|
8429
|
+
var fixCommitSchema = z16.object({ date: z16.string(), landedAt: z16.string().optional(), byAgent: z16.boolean(), lines: z16.number(), testLines: z16.number() });
|
|
8430
|
+
var snapshotSchema = z16.object({
|
|
8431
|
+
version: z16.literal(CODE_CACHE_VERSION),
|
|
8432
|
+
repos: z16.record(z16.string(), repoScanSchema),
|
|
8433
|
+
fixes: z16.record(z16.string(), fixCommitSchema),
|
|
8434
|
+
unsettled: z16.record(z16.string(), z16.string().nullable())
|
|
8379
8435
|
});
|
|
8380
8436
|
function emptyCodeCache() {
|
|
8381
8437
|
return { repos: {}, fixes: {}, unsettled: {} };
|
|
@@ -9171,13 +9227,13 @@ function leadTimesIn(histories, span2) {
|
|
|
9171
9227
|
import { join as join30 } from "node:path";
|
|
9172
9228
|
|
|
9173
9229
|
// src/core/stats/cost/token-counts.ts
|
|
9174
|
-
import { z as
|
|
9175
|
-
var tokenCountsSchema =
|
|
9176
|
-
input:
|
|
9177
|
-
cacheWrite5m:
|
|
9178
|
-
cacheWrite1h:
|
|
9179
|
-
cacheRead:
|
|
9180
|
-
output:
|
|
9230
|
+
import { z as z17 } from "zod";
|
|
9231
|
+
var tokenCountsSchema = z17.object({
|
|
9232
|
+
input: z17.number(),
|
|
9233
|
+
cacheWrite5m: z17.number(),
|
|
9234
|
+
cacheWrite1h: z17.number(),
|
|
9235
|
+
cacheRead: z17.number(),
|
|
9236
|
+
output: z17.number()
|
|
9181
9237
|
});
|
|
9182
9238
|
var ZERO_TOKENS = { input: 0, cacheWrite5m: 0, cacheWrite1h: 0, cacheRead: 0, output: 0 };
|
|
9183
9239
|
function addTokens(a, b) {
|
|
@@ -9367,61 +9423,61 @@ function average(values) {
|
|
|
9367
9423
|
// src/core/usage/usage-cache.ts
|
|
9368
9424
|
import { mkdir as mkdir5 } from "node:fs/promises";
|
|
9369
9425
|
import { join as join29 } from "node:path";
|
|
9370
|
-
import { z as
|
|
9426
|
+
import { z as z19 } from "zod";
|
|
9371
9427
|
|
|
9372
9428
|
// src/core/stats/cost/usage-state.ts
|
|
9373
|
-
import { z as
|
|
9374
|
-
var estimatedKindSchema =
|
|
9375
|
-
var usageBucketSchema =
|
|
9376
|
-
slot:
|
|
9377
|
-
cwd:
|
|
9378
|
-
model:
|
|
9379
|
-
kind:
|
|
9429
|
+
import { z as z18 } from "zod";
|
|
9430
|
+
var estimatedKindSchema = z18.enum(["cli", "skill"]);
|
|
9431
|
+
var usageBucketSchema = z18.object({
|
|
9432
|
+
slot: z18.string(),
|
|
9433
|
+
cwd: z18.string(),
|
|
9434
|
+
model: z18.string(),
|
|
9435
|
+
kind: z18.enum(["hook", ...estimatedKindSchema.options]),
|
|
9380
9436
|
tokens: tokenCountsSchema,
|
|
9381
|
-
hookTurns:
|
|
9437
|
+
hookTurns: z18.number()
|
|
9382
9438
|
});
|
|
9383
|
-
var transcriptStateSchema =
|
|
9384
|
-
hookOpen:
|
|
9385
|
-
lastModel:
|
|
9386
|
-
lastMessageId:
|
|
9439
|
+
var transcriptStateSchema = z18.object({
|
|
9440
|
+
hookOpen: z18.boolean(),
|
|
9441
|
+
lastModel: z18.string().nullable(),
|
|
9442
|
+
lastMessageId: z18.string().nullable(),
|
|
9387
9443
|
lastMessageTokens: tokenCountsSchema.nullable().optional(),
|
|
9388
|
-
pending:
|
|
9389
|
-
pendingEstimates:
|
|
9390
|
-
codex:
|
|
9444
|
+
pending: z18.record(z18.string(), estimatedKindSchema),
|
|
9445
|
+
pendingEstimates: z18.array(z18.object({ kind: estimatedKindSchema, chars: z18.number(), slot: z18.string(), cwd: z18.string() })),
|
|
9446
|
+
codex: z18.object({ cwd: z18.string(), total: tokenCountsSchema.nullable(), desktopCommandEvents: z18.literal(true).optional(), toolDirectories: z18.record(z18.string(), z18.string()).optional() }).optional()
|
|
9391
9447
|
});
|
|
9392
9448
|
|
|
9393
9449
|
// src/core/usage/usage-cache.ts
|
|
9394
9450
|
var USAGE_CACHE_FILE = ".usage-cache.json";
|
|
9395
|
-
var USAGE_CACHE_VERSION =
|
|
9396
|
-
var bucketsSchema =
|
|
9397
|
-
var worktreeTenureSchema =
|
|
9451
|
+
var USAGE_CACHE_VERSION = 8;
|
|
9452
|
+
var bucketsSchema = z19.array(usageBucketSchema);
|
|
9453
|
+
var worktreeTenureSchema = z19.object({ main: z19.string(), since: z19.number() });
|
|
9398
9454
|
var SINCE_EVER = 0;
|
|
9399
|
-
var worktreeTenuresSchema =
|
|
9400
|
-
var worktreeReposSchema =
|
|
9401
|
-
var usageCacheEntrySchema =
|
|
9402
|
-
size:
|
|
9403
|
-
mtimeMs:
|
|
9404
|
-
offset:
|
|
9405
|
-
fingerprint:
|
|
9455
|
+
var worktreeTenuresSchema = z19.union([z19.array(worktreeTenureSchema), z19.string().transform((main) => [{ main, since: SINCE_EVER }])]);
|
|
9456
|
+
var worktreeReposSchema = z19.record(z19.string(), worktreeTenuresSchema);
|
|
9457
|
+
var usageCacheEntrySchema = z19.object({
|
|
9458
|
+
size: z19.number(),
|
|
9459
|
+
mtimeMs: z19.number().optional(),
|
|
9460
|
+
offset: z19.number(),
|
|
9461
|
+
fingerprint: z19.string(),
|
|
9406
9462
|
state: transcriptStateSchema,
|
|
9407
9463
|
buckets: bucketsSchema
|
|
9408
9464
|
});
|
|
9409
|
-
var usageCacheSchema =
|
|
9410
|
-
version:
|
|
9411
|
-
files:
|
|
9412
|
-
carried:
|
|
9465
|
+
var usageCacheSchema = z19.object({
|
|
9466
|
+
version: z19.literal(USAGE_CACHE_VERSION),
|
|
9467
|
+
files: z19.record(z19.string(), usageCacheEntrySchema),
|
|
9468
|
+
carried: z19.record(z19.string(), bucketsSchema).default({}),
|
|
9413
9469
|
worktreeRepos: worktreeReposSchema.default({})
|
|
9414
9470
|
});
|
|
9415
|
-
var salvagedEntrySchema =
|
|
9416
|
-
var salvagedCacheSchema =
|
|
9417
|
-
files:
|
|
9418
|
-
carried:
|
|
9471
|
+
var salvagedEntrySchema = z19.object({ buckets: bucketsSchema }).transform((entry) => entry.buckets);
|
|
9472
|
+
var salvagedCacheSchema = z19.object({
|
|
9473
|
+
files: z19.record(z19.string(), salvagedEntrySchema.nullable().catch(null)).catch({}),
|
|
9474
|
+
carried: z19.record(z19.string(), bucketsSchema.nullable().catch(null)).catch({}),
|
|
9419
9475
|
worktreeRepos: worktreeReposSchema.catch({})
|
|
9420
9476
|
}).transform(({ files, carried, worktreeRepos }) => {
|
|
9421
9477
|
const salvaged = [...Object.entries(carried), ...Object.entries(files)].flatMap(([path, buckets]) => buckets === null ? [] : [[path, buckets]]);
|
|
9422
9478
|
return { ...emptyUsageCache(), carried: Object.fromEntries(salvaged), worktreeRepos };
|
|
9423
9479
|
});
|
|
9424
|
-
var storedCacheSchema =
|
|
9480
|
+
var storedCacheSchema = z19.union([usageCacheSchema, salvagedCacheSchema]);
|
|
9425
9481
|
function emptyUsageCache() {
|
|
9426
9482
|
return { version: USAGE_CACHE_VERSION, files: {}, carried: {}, worktreeRepos: {} };
|
|
9427
9483
|
}
|
|
@@ -9923,7 +9979,7 @@ import { createHash as createHash6 } from "node:crypto";
|
|
|
9923
9979
|
import { basename as basename9, join as join33 } from "node:path";
|
|
9924
9980
|
|
|
9925
9981
|
// src/core/stats/cost/attribute.ts
|
|
9926
|
-
import { z as
|
|
9982
|
+
import { z as z20 } from "zod";
|
|
9927
9983
|
|
|
9928
9984
|
// src/core/stats/cost/shell-commands.ts
|
|
9929
9985
|
var ENV_ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/;
|
|
@@ -10157,21 +10213,21 @@ var PENDING_TOOL_LIMIT = 64;
|
|
|
10157
10213
|
var ZONE_OFFSETS_PER_HOUR = 4;
|
|
10158
10214
|
var ZONE_OFFSET_STEP_MS = HOUR_MS / ZONE_OFFSETS_PER_HOUR;
|
|
10159
10215
|
var BASH_TOOL = "Bash";
|
|
10160
|
-
var usageSchema =
|
|
10161
|
-
input_tokens:
|
|
10162
|
-
output_tokens:
|
|
10163
|
-
cache_read_input_tokens:
|
|
10164
|
-
cache_creation_input_tokens:
|
|
10165
|
-
speed:
|
|
10166
|
-
cache_creation:
|
|
10216
|
+
var usageSchema = z20.object({
|
|
10217
|
+
input_tokens: z20.number().optional(),
|
|
10218
|
+
output_tokens: z20.number().optional(),
|
|
10219
|
+
cache_read_input_tokens: z20.number().optional(),
|
|
10220
|
+
cache_creation_input_tokens: z20.number().optional(),
|
|
10221
|
+
speed: z20.string().optional(),
|
|
10222
|
+
cache_creation: z20.object({ ephemeral_5m_input_tokens: z20.number().optional(), ephemeral_1h_input_tokens: z20.number().optional() }).passthrough().optional()
|
|
10167
10223
|
}).passthrough();
|
|
10168
|
-
var assistantMessageSchema =
|
|
10169
|
-
var userMessageSchema =
|
|
10170
|
-
var toolUseBlockSchema =
|
|
10171
|
-
var toolResultBlockSchema =
|
|
10172
|
-
var textBlockSchema =
|
|
10173
|
-
var bashInputSchema =
|
|
10174
|
-
var transcriptLineSchema =
|
|
10224
|
+
var assistantMessageSchema = z20.object({ id: z20.string().optional(), model: z20.string().optional(), usage: usageSchema.optional(), content: z20.array(z20.unknown()).optional() }).passthrough();
|
|
10225
|
+
var userMessageSchema = z20.object({ content: z20.unknown().optional() }).passthrough();
|
|
10226
|
+
var toolUseBlockSchema = z20.object({ type: z20.literal("tool_use"), id: z20.string(), name: z20.string(), input: z20.unknown().optional() }).passthrough();
|
|
10227
|
+
var toolResultBlockSchema = z20.object({ type: z20.literal("tool_result"), tool_use_id: z20.string().optional(), content: z20.unknown().optional() }).passthrough();
|
|
10228
|
+
var textBlockSchema = z20.object({ type: z20.literal("text"), text: z20.string() }).passthrough();
|
|
10229
|
+
var bashInputSchema = z20.object({ command: z20.string() }).passthrough();
|
|
10230
|
+
var transcriptLineSchema = z20.object({ type: z20.string().optional(), timestamp: z20.string().optional(), cwd: z20.string().optional(), isMeta: z20.boolean().optional(), message: z20.unknown().optional() }).passthrough();
|
|
10175
10231
|
function newTranscriptState() {
|
|
10176
10232
|
return { hookOpen: false, lastModel: null, lastMessageId: null, lastMessageTokens: null, pending: {}, pendingEstimates: [] };
|
|
10177
10233
|
}
|
|
@@ -10296,33 +10352,48 @@ function slotOf(timestamp) {
|
|
|
10296
10352
|
|
|
10297
10353
|
// src/core/usage/attribute-codex.ts
|
|
10298
10354
|
import { resolve as resolve4 } from "node:path";
|
|
10299
|
-
import {
|
|
10300
|
-
|
|
10355
|
+
import { fileURLToPath } from "node:url";
|
|
10356
|
+
import { z as z21 } from "zod";
|
|
10357
|
+
var ROLLOUT_MARKERS = /"type"\s*:\s*"(?:session_meta|turn_context|token_count|item_completed|message|function_call(?:_output)?|custom_tool_call(?:_output)?)"/u;
|
|
10301
10358
|
var INLINE_SHELL_FIELDS = /\b(cmd|workdir)\s*:\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`)/gu;
|
|
10302
10359
|
var APP_TOOL_CALL = /\btools\.(\w+)\s*\(/gu;
|
|
10303
10360
|
var SKILL_READER = /^\s*(?:cat|sed|head|tail|nl|Get-Content)\b/iu;
|
|
10361
|
+
var SHELL_PROGRAM = /(?:^|[\\/])(?:bash|zsh|sh|dash|ksh|fish|pwsh|powershell|cmd)(?:\.exe)?$/iu;
|
|
10362
|
+
var SHELL_SCRIPT_FLAG = /^(?:-[il]*c|-command|\/c)$/iu;
|
|
10304
10363
|
var STOP_HOOK_PROMPT = /^<hook_prompt hook_run_id="stop:[^"]+">\s*([\s\S]*?)<\/hook_prompt>$/u;
|
|
10305
|
-
var rolloutSchema =
|
|
10306
|
-
type:
|
|
10307
|
-
timestamp:
|
|
10308
|
-
payload:
|
|
10309
|
-
type:
|
|
10310
|
-
cwd:
|
|
10311
|
-
model:
|
|
10364
|
+
var rolloutSchema = z21.object({
|
|
10365
|
+
type: z21.string(),
|
|
10366
|
+
timestamp: z21.string(),
|
|
10367
|
+
payload: z21.object({
|
|
10368
|
+
type: z21.string().optional(),
|
|
10369
|
+
cwd: z21.string().optional(),
|
|
10370
|
+
model: z21.string().min(1).optional(),
|
|
10371
|
+
originator: z21.string().optional(),
|
|
10372
|
+
history_mode: z21.string().optional()
|
|
10312
10373
|
}).passthrough()
|
|
10313
10374
|
});
|
|
10314
|
-
var usageSchema2 =
|
|
10315
|
-
input_tokens:
|
|
10316
|
-
cached_input_tokens:
|
|
10317
|
-
cache_write_input_tokens:
|
|
10318
|
-
output_tokens:
|
|
10375
|
+
var usageSchema2 = z21.object({
|
|
10376
|
+
input_tokens: z21.number().nonnegative(),
|
|
10377
|
+
cached_input_tokens: z21.number().nonnegative().default(0),
|
|
10378
|
+
cache_write_input_tokens: z21.number().nonnegative().default(0),
|
|
10379
|
+
output_tokens: z21.number().nonnegative()
|
|
10319
10380
|
});
|
|
10320
|
-
var eventSchema =
|
|
10321
|
-
var
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10381
|
+
var eventSchema = z21.object({ info: z21.object({ total_token_usage: usageSchema2, last_token_usage: usageSchema2.optional() }) });
|
|
10382
|
+
var completedCommandSchema = z21.object({
|
|
10383
|
+
item: z21.object({
|
|
10384
|
+
type: z21.literal("CommandExecution"),
|
|
10385
|
+
id: z21.string().startsWith("exec-"),
|
|
10386
|
+
source: z21.literal("unified_exec_startup"),
|
|
10387
|
+
cwd: z21.string().min(1),
|
|
10388
|
+
command: z21.tuple([z21.string()], z21.string()),
|
|
10389
|
+
aggregated_output: z21.string()
|
|
10390
|
+
})
|
|
10391
|
+
});
|
|
10392
|
+
var messageSchema = z21.object({ role: z21.string(), content: z21.array(z21.object({ text: z21.string().optional() })) });
|
|
10393
|
+
var callSchema = z21.object({ name: z21.string(), call_id: z21.string(), arguments: z21.string().optional(), input: z21.string().optional() });
|
|
10394
|
+
var shellSchema = z21.object({ cmd: z21.string().optional(), command: z21.string().optional(), workdir: z21.string().optional() });
|
|
10395
|
+
var textOutputSchema = z21.object({ type: z21.literal("input_text"), text: z21.string() });
|
|
10396
|
+
var resultSchema = z21.object({ call_id: z21.string(), output: z21.union([z21.string(), z21.array(z21.unknown())]) });
|
|
10326
10397
|
function attributeCodexLine(line, state) {
|
|
10327
10398
|
if (!ROLLOUT_MARKERS.test(line)) return [];
|
|
10328
10399
|
const event = parseJson(line, rolloutSchema);
|
|
@@ -10330,15 +10401,35 @@ function attributeCodexLine(line, state) {
|
|
|
10330
10401
|
const codex = state.codex ??= { cwd: "", total: null };
|
|
10331
10402
|
const { type, timestamp, payload } = event;
|
|
10332
10403
|
if (type === "session_meta" || type === "turn_context") {
|
|
10404
|
+
if (type === "session_meta" && payload.originator === "Codex Desktop" && payload.history_mode === "paginated") codex.desktopCommandEvents = true;
|
|
10333
10405
|
codex.cwd = payload.cwd ?? codex.cwd;
|
|
10334
10406
|
state.lastModel = payload.model ?? state.lastModel;
|
|
10335
10407
|
return [];
|
|
10336
10408
|
}
|
|
10337
10409
|
const context = { cwd: codex.cwd, model: state.lastModel ?? "unknown", slot: slotOf(timestamp) };
|
|
10338
10410
|
if (type === "event_msg" && payload.type === "token_count") return tokenBuckets(payload, state, codex, context);
|
|
10411
|
+
if (type === "event_msg" && payload.type === "item_completed" && codex.desktopCommandEvents && !state.hookOpen) return desktopCommandBuckets(payload, context);
|
|
10339
10412
|
if (type === "response_item") return responseBuckets(payload, state, codex, context);
|
|
10340
10413
|
return [];
|
|
10341
10414
|
}
|
|
10415
|
+
function desktopCommandBuckets(payload, context) {
|
|
10416
|
+
const completed = completedCommandSchema.safeParse(payload);
|
|
10417
|
+
if (!completed.success) return [];
|
|
10418
|
+
const { cwd, command: command2, aggregated_output: output } = completed.data.item;
|
|
10419
|
+
const [program, ...args] = command2;
|
|
10420
|
+
const script = SHELL_PROGRAM.test(program) && SHELL_SCRIPT_FLAG.test(args.at(-2) ?? "") ? args.at(-1) : program;
|
|
10421
|
+
if (script === void 0 || !invokesOnlyBacklog(script)) return [];
|
|
10422
|
+
return estimatedOutput(output.length, "cli", { ...context, cwd: commandDirectory(cwd) });
|
|
10423
|
+
}
|
|
10424
|
+
function commandDirectory(cwd) {
|
|
10425
|
+
if (!cwd.startsWith("file:")) return cwd;
|
|
10426
|
+
try {
|
|
10427
|
+
return fileURLToPath(cwd);
|
|
10428
|
+
} catch (error) {
|
|
10429
|
+
if (!(error instanceof TypeError || error instanceof URIError)) throw error;
|
|
10430
|
+
return cwd;
|
|
10431
|
+
}
|
|
10432
|
+
}
|
|
10342
10433
|
function tokenBuckets(payload, state, codex, context) {
|
|
10343
10434
|
const event = eventSchema.safeParse(payload);
|
|
10344
10435
|
if (!event.success) return [];
|
|
@@ -10383,7 +10474,7 @@ function isBacklogPrompt(text) {
|
|
|
10383
10474
|
function rememberBacklogCall(call, state, codex) {
|
|
10384
10475
|
const { commands, workdir } = shellDetails(call);
|
|
10385
10476
|
if (commands.length === 0) return;
|
|
10386
|
-
if (commands.every(invokesOnlyBacklog)) rememberToolCall(state, call.call_id, "cli");
|
|
10477
|
+
if (!(codex.desktopCommandEvents && call.name === "exec") && commands.every(invokesOnlyBacklog)) rememberToolCall(state, call.call_id, "cli");
|
|
10387
10478
|
else if (commands.every(readsBacklogSkill)) rememberToolCall(state, call.call_id, "skill");
|
|
10388
10479
|
if (workdir && Object.hasOwn(state.pending, call.call_id)) {
|
|
10389
10480
|
codex.toolDirectories ??= {};
|
|
@@ -10407,7 +10498,7 @@ function shellDetails(call) {
|
|
|
10407
10498
|
const workdirs = [];
|
|
10408
10499
|
for (const [, field, literal = ""] of call.input.matchAll(INLINE_SHELL_FIELDS)) {
|
|
10409
10500
|
const fields = field === "cmd" ? commands : workdirs;
|
|
10410
|
-
fields.push(parseJson(literal,
|
|
10501
|
+
fields.push(parseJson(literal, z21.string()) ?? literal.slice(1, -1).replaceAll("\\n", "\n"));
|
|
10411
10502
|
}
|
|
10412
10503
|
if (commands.length !== tools.length || workdirs.length > 0 && commands.length !== 1) return { commands: [] };
|
|
10413
10504
|
return { commands, workdir: workdirs[0] };
|
|
@@ -10427,8 +10518,11 @@ function toolOutputBuckets(payload, state, codex, context) {
|
|
|
10427
10518
|
Reflect.deleteProperty(directories, id);
|
|
10428
10519
|
if (state.hookOpen || kind === void 0) return [];
|
|
10429
10520
|
const chars = typeof output === "string" ? output.length : output.reduce((total, part) => total + (textOutputSchema.safeParse(part).data?.text.length ?? 0), 0);
|
|
10521
|
+
return estimatedOutput(chars, kind, { ...context, cwd });
|
|
10522
|
+
}
|
|
10523
|
+
function estimatedOutput(chars, kind, context) {
|
|
10430
10524
|
if (chars === 0) return [];
|
|
10431
|
-
return [{ ...context,
|
|
10525
|
+
return [{ ...context, kind, tokens: { ...ZERO_TOKENS, input: estimateTextTokens(chars) }, hookTurns: 0 }];
|
|
10432
10526
|
}
|
|
10433
10527
|
|
|
10434
10528
|
// src/core/usage/transcripts.ts
|
|
@@ -11210,7 +11304,7 @@ function reportFailure({ failed: failed2, code, output }, io) {
|
|
|
11210
11304
|
}
|
|
11211
11305
|
|
|
11212
11306
|
// src/cli/agents/grouped-stop-hooks.ts
|
|
11213
|
-
import { z as
|
|
11307
|
+
import { z as z22 } from "zod";
|
|
11214
11308
|
|
|
11215
11309
|
// src/cli/agents/json-config.ts
|
|
11216
11310
|
import { mkdir as mkdir10, readFile as readFile4, realpath } from "node:fs/promises";
|
|
@@ -11273,9 +11367,9 @@ function commandOfHook(hook) {
|
|
|
11273
11367
|
const command2 = typeof hook === "object" && hook !== null ? hook.command : void 0;
|
|
11274
11368
|
return typeof command2 === "string" ? command2 : void 0;
|
|
11275
11369
|
}
|
|
11276
|
-
var stopGroupSchema =
|
|
11277
|
-
var groupedConfigSchema =
|
|
11278
|
-
hooks:
|
|
11370
|
+
var stopGroupSchema = z22.object({ hooks: z22.array(z22.unknown()).optional() }).passthrough();
|
|
11371
|
+
var groupedConfigSchema = z22.object({
|
|
11372
|
+
hooks: z22.object({ Stop: z22.array(stopGroupSchema).optional() }).passthrough().optional()
|
|
11279
11373
|
}).passthrough();
|
|
11280
11374
|
function refreshOurHook(lists, hook, { isOurs, isCurrent }) {
|
|
11281
11375
|
const ours = lists.flatMap((list) => list.flatMap((entry, index) => isOurs(entry) ? [{ list, index, entry }] : []));
|
|
@@ -11354,11 +11448,11 @@ function removeClaudeStopHook(settings) {
|
|
|
11354
11448
|
}
|
|
11355
11449
|
|
|
11356
11450
|
// src/cli/agents/cursor-hooks.ts
|
|
11357
|
-
import { z as
|
|
11451
|
+
import { z as z23 } from "zod";
|
|
11358
11452
|
var CURSOR_HOOKS_VERSION = 1;
|
|
11359
|
-
var cursorConfigSchema =
|
|
11360
|
-
version:
|
|
11361
|
-
hooks:
|
|
11453
|
+
var cursorConfigSchema = z23.object({
|
|
11454
|
+
version: z23.number().optional(),
|
|
11455
|
+
hooks: z23.object({ stop: z23.array(z23.unknown()).optional() }).passthrough().optional()
|
|
11362
11456
|
}).passthrough();
|
|
11363
11457
|
function addCursorStopHook(file, hook, ourHook) {
|
|
11364
11458
|
return addStopHookIn(
|
|
@@ -11899,6 +11993,7 @@ var CLI_COMMANDS = [
|
|
|
11899
11993
|
takeCommand,
|
|
11900
11994
|
statusCommand,
|
|
11901
11995
|
priorityCommand,
|
|
11996
|
+
probabilityCommand,
|
|
11902
11997
|
categoryCommand,
|
|
11903
11998
|
epicCommand,
|
|
11904
11999
|
checkCommand,
|
|
@@ -11970,7 +12065,7 @@ async function readStdin() {
|
|
|
11970
12065
|
}
|
|
11971
12066
|
var home = homedir();
|
|
11972
12067
|
var backlogRoot = resolveBacklogRoot(process.env, home);
|
|
11973
|
-
var cliPath =
|
|
12068
|
+
var cliPath = fileURLToPath2(import.meta.url);
|
|
11974
12069
|
var packageRoot = resolve7(dirname13(cliPath), "..");
|
|
11975
12070
|
var argv = process.argv.slice(2);
|
|
11976
12071
|
var warn = (line) => void process.stderr.write(`${line}
|