p-backlog 0.14.5 → 0.14.6

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.
Files changed (25) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +3 -2
  3. package/README.ru.md +3 -2
  4. package/dist/cli.js +260 -203
  5. package/dist/web/assets/{CodeTab-rgZ3oazM.js → CodeTab-_hswvGhR.js} +1 -1
  6. package/dist/web/assets/{CostTab-DR8zJt7h.js → CostTab-B45am3iT.js} +1 -1
  7. package/dist/web/assets/{EffectTab-DHdQSIlQ.js → EffectTab-BWrxZuDh.js} +1 -1
  8. package/dist/web/assets/{Figure-C2iLoqkF.js → Figure-C7mZic1d.js} +1 -1
  9. package/dist/web/assets/{OverviewTab-uNqeJSFu.js → OverviewTab-DPfu4cwL.js} +1 -1
  10. package/dist/web/assets/{Page-lpBrfWDj.js → Page-BY5pJG0W.js} +5 -5
  11. package/dist/web/assets/{QualityTab-hbgPdBwD.js → QualityTab-CeAPraBM.js} +1 -1
  12. package/dist/web/assets/{ShareBar-BXak6vBR.js → ShareBar-Do4ChaCM.js} +1 -1
  13. package/dist/web/assets/{StatsPage-CO1e1tAe.js → StatsPage-BVEaoI_Q.js} +1 -1
  14. package/dist/web/assets/{StatsTabState-ChT0Ee4K.js → StatsTabState-BnBfyJUZ.js} +1 -1
  15. package/dist/web/assets/{StatsTable-C0PeMtyw.js → StatsTable-DvgWwXbV.js} +1 -1
  16. package/dist/web/assets/{UnavailableRepos-CykRKvjj.js → UnavailableRepos-CSItGhrg.js} +1 -1
  17. package/dist/web/assets/{index-BuEw4eHx.js → index-C3BHVlUw.js} +2 -2
  18. package/dist/web/assets/start-D7vHv3Nm.js +257 -0
  19. package/dist/web/assets/{start-BvKCcZHI.css → start-Dt9zi6Yh.css} +1 -1
  20. package/dist/web/assets/{use-grain-panel-BrOKdaLI.js → use-grain-panel-BU4IiIEr.js} +7 -7
  21. package/dist/web/assets/web-paths-CUpod7kw.js +1 -0
  22. package/dist/web/index.html +1 -1
  23. package/package.json +1 -1
  24. package/dist/web/assets/start-CmS4D9jZ.js +0 -257
  25. package/dist/web/assets/web-paths-B6f4e9Br.js +0 -1
package/dist/cli.js CHANGED
@@ -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 = z4.string().regex(ID_PATTERN, schemaCode("bad-id"));
935
- var taskIdList = z4.array(taskIdSchema).default([]).transform((ids) => [...new Set(ids)]);
936
- var taskFrontmatterSchema = z4.object({
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: z4.string().trim().min(1, schemaCode("empty-title")),
939
- type: z4.enum(TASK_TYPES).default("task"),
940
- status: z4.enum(TASK_STATUSES).default("backlog"),
941
- priority: z4.enum(PRIORITIES).default("medium"),
942
- category: z4.enum(TASK_CATEGORIES).optional(),
943
- tags: z4.array(z4.string()).default([]).transform(normalizeTags),
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: z4.iso.datetime({ offset: true }),
948
- source: z4.string().optional(),
949
- anchor: z4.string().optional(),
950
- closed: z4.iso.datetime({ offset: true }).optional(),
951
- resolution: z4.enum(RESOLUTIONS).optional(),
952
- reason: z4.string().optional(),
953
- verified: z4.iso.datetime({ offset: true }).optional()
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 = z4.object({
956
- name: z4.string().trim().min(1, schemaCode("empty-name")),
957
- prefix: z4.string().regex(PREFIX_PATTERN, schemaCode("bad-prefix")),
958
- repos: z4.array(z4.string()).default([]),
959
- issuedUpTo: z4.number().int().nonnegative().optional(),
960
- active: z4.boolean().default(true)
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 z5 } from "zod";
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 = z5.locales.en().localeError;
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 z6 } from "zod";
1590
- var zodRu = z6.locales.ru().localeError;
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 z7 } from "zod";
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 z7.enum([...values, UNKNOWN]).catch(UNKNOWN);
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 = z7.object({ bySymbol: z7.boolean().optional(), byAnchor: z7.boolean().optional() });
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: z7.iso.datetime({ offset: true }), task: z7.string().min(1), via: recordedEnum(CHANGE_SOURCES), undo: z7.literal(true).optional().catch(void 0) };
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 = z7.discriminatedUnion("kind", [
1941
- z7.object({
1963
+ var journalEventSchema = z8.discriminatedUnion("kind", [
1964
+ z8.object({
1942
1965
  ...eventBase,
1943
- kind: z7.literal("created"),
1944
- type: z7.enum(TASK_TYPES),
1966
+ kind: z8.literal("created"),
1967
+ type: z8.enum(TASK_TYPES),
1945
1968
  priority: recordedEnum(PRIORITIES),
1946
- tags: z7.array(z7.string()),
1947
- source: z7.string().optional(),
1948
- epic: z7.string().optional(),
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: z7.object({ branch: z7.string().optional(), commit: z7.string().min(1) }).optional()
1974
+ origin: z8.object({ branch: z8.string().optional(), commit: z8.string().min(1) }).optional()
1952
1975
  }),
1953
- z7.object({ ...eventBase, kind: z7.literal("status"), from: z7.enum(TASK_STATUSES), to: z7.enum(TASK_STATUSES), resolution: recordedEnum(RESOLUTIONS).optional() }),
1954
- z7.object({ ...eventBase, kind: z7.literal("priority"), from: recordedEnum(PRIORITIES), to: recordedEnum(PRIORITIES) }),
1955
- z7.object({ ...eventBase, kind: z7.literal("deleted"), snapshot: taskSnapshotSchema }),
1956
- z7.object({ ...eventBase, kind: z7.literal("category"), from: recordedEnum(TASK_CATEGORIES).optional(), to: recordedEnum(TASK_CATEGORIES).optional() }),
1957
- z7.object({ ...eventBase, kind: z7.literal("verified"), source: z7.string().optional(), commit: z7.string().min(1).optional().catch(void 0) }),
1958
- z7.object({
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: z7.literal("candidate"),
1961
- evidence: z7.enum(CANDIDATE_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: z7.string().trim().min(1).optional().catch(void 0)
1989
+ model: z8.string().trim().min(1).optional().catch(void 0)
1967
1990
  }),
1968
- z7.object({ ...eventBase, kind: z7.literal("candidate-gone"), evidence: z7.enum(CANDIDATE_EVIDENCE) }),
1969
- z7.object({ ...eventBase, kind: z7.literal("candidate-filtered"), symbol: z7.string() })
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 z8 } from "zod";
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 = z8.object({ name: z8.string() });
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 z9 } from "zod";
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 = z9.object({ enabledPlugins: z9.record(z9.string(), z9.unknown()).optional() });
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 z10 } from "zod";
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 = z10.record(z10.string(), z10.iso.datetime({ offset: true }));
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 z11 } from "zod";
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 = z11.record(z11.string(), z11.string());
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 z12 } from "zod";
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 = z12.record(z12.string(), z12.object({ tasks: z12.array(z12.string()), at: z12.iso.datetime({ offset: true }) }));
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 z13 } from "zod";
7342
+ import { z as z14 } from "zod";
7304
7343
  var TURN_DIGEST_LENGTH = 16;
7305
7344
  var CURSOR_COMPLETED = "completed";
7306
- var claudeEventSchema = z13.object({
7307
- cwd: z13.string(),
7308
- session_id: z13.string().optional(),
7309
- turn_id: z13.string().optional(),
7310
- stop_hook_active: z13.boolean().optional(),
7311
- last_assistant_message: z13.string().nullish(),
7312
- model: z13.string().trim().min(1).optional().catch(void 0)
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 = z13.object({
7315
- workspace_roots: z13.tuple([z13.string()], z13.string()),
7316
- conversation_id: z13.string().optional(),
7317
- generation_id: z13.string().optional(),
7318
- status: z13.string().optional(),
7319
- loop_count: z13.number().optional()
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 z14 } from "zod";
7820
- var idList = z14.array(taskIdSchema);
7821
- var taskChangesSchema = z14.strictObject({
7822
- title: z14.string().optional(),
7823
- type: z14.enum(TASK_TYPES).optional(),
7824
- status: z14.enum(TASK_STATUSES).optional(),
7825
- priority: z14.enum(PRIORITIES).optional(),
7826
- tags: z14.array(z14.string()).optional(),
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: z14.string().optional(),
7831
- category: z14.enum(TASK_CATEGORIES).nullable().optional()
7886
+ body: z15.string().optional(),
7887
+ category: z15.enum(TASK_CATEGORIES).nullable().optional()
7832
7888
  });
7833
- var projectActiveSchema = z14.strictObject({ active: z14.boolean() });
7834
- var projectDeleteSchema = z14.strictObject({ confirm: z14.string() });
7835
- var settingsRequestSchema = z14.strictObject(settingsSchema.shape);
7836
- var updateTaskRequestSchema = z14.strictObject({
7837
- version: z14.string().min(1),
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 = z14.strictObject({
7841
- status: z14.enum(TASK_STATUSES),
7842
- priority: z14.enum(PRIORITIES),
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 = z14.strictObject({
7847
- tasks: z14.array(z14.strictObject({ id: taskIdSchema, version: z14.string().min(1) })).min(1).max(BATCH_TASKS_LIMIT).refine((tasks) => new Set(tasks.map((task) => task.id)).size === tasks.length),
7848
- action: z14.discriminatedUnion("kind", [
7849
- z14.strictObject({
7850
- kind: z14.literal("close"),
7851
- reason: z14.string().transform(normalizeClosingReason).pipe(z14.string().min(1))
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
- z14.strictObject({ kind: z14.literal("priority"), priority: z14.enum(PRIORITIES) }),
7854
- z14.strictObject({ kind: z14.literal("epic"), epic: taskIdSchema.nullable() }),
7855
- z14.strictObject({ kind: z14.literal("restore"), changes: z14.record(taskIdSchema, batchPreviousSchema) })
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 z15 } from "zod";
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 = z15.object({
8367
- head: z15.string(),
8368
- main: z15.string().nullable(),
8369
- commits: z15.array(z15.object({ date: z15.string(), paths: z15.array(z15.string()) })),
8370
- units: z15.array(z15.object({ date: z15.string(), lines: z15.number() })),
8371
- lines: z15.array(z15.object({ path: z15.string(), lines: z15.number() }))
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 = z15.object({ date: z15.string(), landedAt: z15.string().optional(), byAgent: z15.boolean(), lines: z15.number(), testLines: z15.number() });
8374
- var snapshotSchema = z15.object({
8375
- version: z15.literal(CODE_CACHE_VERSION),
8376
- repos: z15.record(z15.string(), repoScanSchema),
8377
- fixes: z15.record(z15.string(), fixCommitSchema),
8378
- unsettled: z15.record(z15.string(), z15.string().nullable())
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 z16 } from "zod";
9175
- var tokenCountsSchema = z16.object({
9176
- input: z16.number(),
9177
- cacheWrite5m: z16.number(),
9178
- cacheWrite1h: z16.number(),
9179
- cacheRead: z16.number(),
9180
- output: z16.number()
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 z18 } from "zod";
9426
+ import { z as z19 } from "zod";
9371
9427
 
9372
9428
  // src/core/stats/cost/usage-state.ts
9373
- import { z as z17 } from "zod";
9374
- var estimatedKindSchema = z17.enum(["cli", "skill"]);
9375
- var usageBucketSchema = z17.object({
9376
- slot: z17.string(),
9377
- cwd: z17.string(),
9378
- model: z17.string(),
9379
- kind: z17.enum(["hook", ...estimatedKindSchema.options]),
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: z17.number()
9437
+ hookTurns: z18.number()
9382
9438
  });
9383
- var transcriptStateSchema = z17.object({
9384
- hookOpen: z17.boolean(),
9385
- lastModel: z17.string().nullable(),
9386
- lastMessageId: z17.string().nullable(),
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: z17.record(z17.string(), estimatedKindSchema),
9389
- pendingEstimates: z17.array(z17.object({ kind: estimatedKindSchema, chars: z17.number(), slot: z17.string(), cwd: z17.string() })),
9390
- codex: z17.object({ cwd: z17.string(), total: tokenCountsSchema.nullable(), toolDirectories: z17.record(z17.string(), z17.string()).optional() }).optional()
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(), 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
9451
  var USAGE_CACHE_VERSION = 7;
9396
- var bucketsSchema = z18.array(usageBucketSchema);
9397
- var worktreeTenureSchema = z18.object({ main: z18.string(), since: z18.number() });
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 = z18.union([z18.array(worktreeTenureSchema), z18.string().transform((main) => [{ main, since: SINCE_EVER }])]);
9400
- var worktreeReposSchema = z18.record(z18.string(), worktreeTenuresSchema);
9401
- var usageCacheEntrySchema = z18.object({
9402
- size: z18.number(),
9403
- mtimeMs: z18.number().optional(),
9404
- offset: z18.number(),
9405
- fingerprint: z18.string(),
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 = z18.object({
9410
- version: z18.literal(USAGE_CACHE_VERSION),
9411
- files: z18.record(z18.string(), usageCacheEntrySchema),
9412
- carried: z18.record(z18.string(), bucketsSchema).default({}),
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 = z18.object({ buckets: bucketsSchema }).transform((entry) => entry.buckets);
9416
- var salvagedCacheSchema = z18.object({
9417
- files: z18.record(z18.string(), salvagedEntrySchema.nullable().catch(null)).catch({}),
9418
- carried: z18.record(z18.string(), bucketsSchema.nullable().catch(null)).catch({}),
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 = z18.union([usageCacheSchema, salvagedCacheSchema]);
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 z19 } from "zod";
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 = z19.object({
10161
- input_tokens: z19.number().optional(),
10162
- output_tokens: z19.number().optional(),
10163
- cache_read_input_tokens: z19.number().optional(),
10164
- cache_creation_input_tokens: z19.number().optional(),
10165
- speed: z19.string().optional(),
10166
- cache_creation: z19.object({ ephemeral_5m_input_tokens: z19.number().optional(), ephemeral_1h_input_tokens: z19.number().optional() }).passthrough().optional()
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 = z19.object({ id: z19.string().optional(), model: z19.string().optional(), usage: usageSchema.optional(), content: z19.array(z19.unknown()).optional() }).passthrough();
10169
- var userMessageSchema = z19.object({ content: z19.unknown().optional() }).passthrough();
10170
- var toolUseBlockSchema = z19.object({ type: z19.literal("tool_use"), id: z19.string(), name: z19.string(), input: z19.unknown().optional() }).passthrough();
10171
- var toolResultBlockSchema = z19.object({ type: z19.literal("tool_result"), tool_use_id: z19.string().optional(), content: z19.unknown().optional() }).passthrough();
10172
- var textBlockSchema = z19.object({ type: z19.literal("text"), text: z19.string() }).passthrough();
10173
- var bashInputSchema = z19.object({ command: z19.string() }).passthrough();
10174
- var transcriptLineSchema = z19.object({ type: z19.string().optional(), timestamp: z19.string().optional(), cwd: z19.string().optional(), isMeta: z19.boolean().optional(), message: z19.unknown().optional() }).passthrough();
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,33 @@ function slotOf(timestamp) {
10296
10352
 
10297
10353
  // src/core/usage/attribute-codex.ts
10298
10354
  import { resolve as resolve4 } from "node:path";
10299
- import { z as z20 } from "zod";
10355
+ import { z as z21 } from "zod";
10300
10356
  var ROLLOUT_MARKERS = /"type"\s*:\s*"(?:session_meta|turn_context|token_count|message|function_call(?:_output)?|custom_tool_call(?:_output)?)"/u;
10301
10357
  var INLINE_SHELL_FIELDS = /\b(cmd|workdir)\s*:\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`)/gu;
10302
10358
  var APP_TOOL_CALL = /\btools\.(\w+)\s*\(/gu;
10303
10359
  var SKILL_READER = /^\s*(?:cat|sed|head|tail|nl|Get-Content)\b/iu;
10304
10360
  var STOP_HOOK_PROMPT = /^<hook_prompt hook_run_id="stop:[^"]+">\s*([\s\S]*?)<\/hook_prompt>$/u;
10305
- var rolloutSchema = z20.object({
10306
- type: z20.string(),
10307
- timestamp: z20.string(),
10308
- payload: z20.object({
10309
- type: z20.string().optional(),
10310
- cwd: z20.string().optional(),
10311
- model: z20.string().min(1).optional()
10361
+ var rolloutSchema = z21.object({
10362
+ type: z21.string(),
10363
+ timestamp: z21.string(),
10364
+ payload: z21.object({
10365
+ type: z21.string().optional(),
10366
+ cwd: z21.string().optional(),
10367
+ model: z21.string().min(1).optional()
10312
10368
  }).passthrough()
10313
10369
  });
10314
- var usageSchema2 = z20.object({
10315
- input_tokens: z20.number().nonnegative(),
10316
- cached_input_tokens: z20.number().nonnegative().default(0),
10317
- cache_write_input_tokens: z20.number().nonnegative().default(0),
10318
- output_tokens: z20.number().nonnegative()
10370
+ var usageSchema2 = z21.object({
10371
+ input_tokens: z21.number().nonnegative(),
10372
+ cached_input_tokens: z21.number().nonnegative().default(0),
10373
+ cache_write_input_tokens: z21.number().nonnegative().default(0),
10374
+ output_tokens: z21.number().nonnegative()
10319
10375
  });
10320
- var eventSchema = z20.object({ info: z20.object({ total_token_usage: usageSchema2, last_token_usage: usageSchema2.optional() }) });
10321
- var messageSchema = z20.object({ role: z20.string(), content: z20.array(z20.object({ text: z20.string().optional() })) });
10322
- var callSchema = z20.object({ name: z20.string(), call_id: z20.string(), arguments: z20.string().optional(), input: z20.string().optional() });
10323
- var shellSchema = z20.object({ cmd: z20.string().optional(), command: z20.string().optional(), workdir: z20.string().optional() });
10324
- var textOutputSchema = z20.object({ type: z20.literal("input_text"), text: z20.string() });
10325
- var resultSchema = z20.object({ call_id: z20.string(), output: z20.union([z20.string(), z20.array(z20.unknown())]) });
10376
+ var eventSchema = z21.object({ info: z21.object({ total_token_usage: usageSchema2, last_token_usage: usageSchema2.optional() }) });
10377
+ var messageSchema = z21.object({ role: z21.string(), content: z21.array(z21.object({ text: z21.string().optional() })) });
10378
+ var callSchema = z21.object({ name: z21.string(), call_id: z21.string(), arguments: z21.string().optional(), input: z21.string().optional() });
10379
+ var shellSchema = z21.object({ cmd: z21.string().optional(), command: z21.string().optional(), workdir: z21.string().optional() });
10380
+ var textOutputSchema = z21.object({ type: z21.literal("input_text"), text: z21.string() });
10381
+ var resultSchema = z21.object({ call_id: z21.string(), output: z21.union([z21.string(), z21.array(z21.unknown())]) });
10326
10382
  function attributeCodexLine(line, state) {
10327
10383
  if (!ROLLOUT_MARKERS.test(line)) return [];
10328
10384
  const event = parseJson(line, rolloutSchema);
@@ -10407,7 +10463,7 @@ function shellDetails(call) {
10407
10463
  const workdirs = [];
10408
10464
  for (const [, field, literal = ""] of call.input.matchAll(INLINE_SHELL_FIELDS)) {
10409
10465
  const fields = field === "cmd" ? commands : workdirs;
10410
- fields.push(parseJson(literal, z20.string()) ?? literal.slice(1, -1).replaceAll("\\n", "\n"));
10466
+ fields.push(parseJson(literal, z21.string()) ?? literal.slice(1, -1).replaceAll("\\n", "\n"));
10411
10467
  }
10412
10468
  if (commands.length !== tools.length || workdirs.length > 0 && commands.length !== 1) return { commands: [] };
10413
10469
  return { commands, workdir: workdirs[0] };
@@ -11210,7 +11266,7 @@ function reportFailure({ failed: failed2, code, output }, io) {
11210
11266
  }
11211
11267
 
11212
11268
  // src/cli/agents/grouped-stop-hooks.ts
11213
- import { z as z21 } from "zod";
11269
+ import { z as z22 } from "zod";
11214
11270
 
11215
11271
  // src/cli/agents/json-config.ts
11216
11272
  import { mkdir as mkdir10, readFile as readFile4, realpath } from "node:fs/promises";
@@ -11273,9 +11329,9 @@ function commandOfHook(hook) {
11273
11329
  const command2 = typeof hook === "object" && hook !== null ? hook.command : void 0;
11274
11330
  return typeof command2 === "string" ? command2 : void 0;
11275
11331
  }
11276
- var stopGroupSchema = z21.object({ hooks: z21.array(z21.unknown()).optional() }).passthrough();
11277
- var groupedConfigSchema = z21.object({
11278
- hooks: z21.object({ Stop: z21.array(stopGroupSchema).optional() }).passthrough().optional()
11332
+ var stopGroupSchema = z22.object({ hooks: z22.array(z22.unknown()).optional() }).passthrough();
11333
+ var groupedConfigSchema = z22.object({
11334
+ hooks: z22.object({ Stop: z22.array(stopGroupSchema).optional() }).passthrough().optional()
11279
11335
  }).passthrough();
11280
11336
  function refreshOurHook(lists, hook, { isOurs, isCurrent }) {
11281
11337
  const ours = lists.flatMap((list) => list.flatMap((entry, index) => isOurs(entry) ? [{ list, index, entry }] : []));
@@ -11354,11 +11410,11 @@ function removeClaudeStopHook(settings) {
11354
11410
  }
11355
11411
 
11356
11412
  // src/cli/agents/cursor-hooks.ts
11357
- import { z as z22 } from "zod";
11413
+ import { z as z23 } from "zod";
11358
11414
  var CURSOR_HOOKS_VERSION = 1;
11359
- var cursorConfigSchema = z22.object({
11360
- version: z22.number().optional(),
11361
- hooks: z22.object({ stop: z22.array(z22.unknown()).optional() }).passthrough().optional()
11415
+ var cursorConfigSchema = z23.object({
11416
+ version: z23.number().optional(),
11417
+ hooks: z23.object({ stop: z23.array(z23.unknown()).optional() }).passthrough().optional()
11362
11418
  }).passthrough();
11363
11419
  function addCursorStopHook(file, hook, ourHook) {
11364
11420
  return addStopHookIn(
@@ -11899,6 +11955,7 @@ var CLI_COMMANDS = [
11899
11955
  takeCommand,
11900
11956
  statusCommand,
11901
11957
  priorityCommand,
11958
+ probabilityCommand,
11902
11959
  categoryCommand,
11903
11960
  epicCommand,
11904
11961
  checkCommand,