agent-steward 0.0.2 → 0.0.3

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 (180) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/CROSS_PLATFORM.md +11 -9
  3. package/README.md +9 -8
  4. package/ROADMAP-STRATEGY.md +93 -44
  5. package/ROADMAP.md +114 -999
  6. package/dist/core/cron-to-schtasks.d.ts +0 -8
  7. package/dist/core/cron-to-schtasks.d.ts.map +1 -1
  8. package/dist/core/cron-to-schtasks.js +11 -86
  9. package/dist/core/dry-run.js +1 -1
  10. package/dist/core/file-watcher.js +9 -9
  11. package/dist/core/git-trigger.js +4 -4
  12. package/dist/core/lock.js +2 -4
  13. package/dist/core/one-shot.d.ts +27 -5
  14. package/dist/core/one-shot.d.ts.map +1 -1
  15. package/dist/core/one-shot.js +53 -10
  16. package/dist/core/otel.js +2 -2
  17. package/dist/core/ps-wrapper.d.ts +1 -1
  18. package/dist/core/ps-wrapper.d.ts.map +1 -1
  19. package/dist/core/ps-wrapper.js +55 -35
  20. package/dist/core/record-history.js +22 -22
  21. package/dist/core/schedule-v2.d.ts +2 -2
  22. package/dist/core/schedule-v2.d.ts.map +1 -1
  23. package/dist/core/schedule-v2.js +7 -7
  24. package/dist/core/scheduler/at-fallback.d.ts +42 -0
  25. package/dist/core/scheduler/at-fallback.d.ts.map +1 -0
  26. package/dist/core/scheduler/at-fallback.js +70 -0
  27. package/dist/core/scheduler/linux.d.ts +3 -1
  28. package/dist/core/scheduler/linux.d.ts.map +1 -1
  29. package/dist/core/scheduler/linux.js +43 -7
  30. package/dist/core/scheduler/mac.d.ts +14 -8
  31. package/dist/core/scheduler/mac.d.ts.map +1 -1
  32. package/dist/core/scheduler/mac.js +71 -22
  33. package/dist/core/scheduler/posix.d.ts.map +1 -1
  34. package/dist/core/scheduler/posix.js +12 -1
  35. package/dist/core/scheduler/registry.d.ts +2 -0
  36. package/dist/core/scheduler/registry.d.ts.map +1 -1
  37. package/dist/core/scheduler/windows.d.ts +16 -3
  38. package/dist/core/scheduler/windows.d.ts.map +1 -1
  39. package/dist/core/scheduler/windows.js +249 -96
  40. package/dist/core/secrets.js +2 -2
  41. package/dist/core/self-analysis.js +55 -55
  42. package/dist/core/summary.js +1 -1
  43. package/dist/core/triage-chain.js +1 -1
  44. package/dist/core/triage-worker.js +2 -2
  45. package/dist/core/triage.js +1 -1
  46. package/dist/core/wrappers/bash.js +33 -33
  47. package/dist/db/index.d.ts +2 -0
  48. package/dist/db/index.d.ts.map +1 -1
  49. package/dist/db/index.js +9 -1
  50. package/dist/db/run-journal.d.ts +60 -0
  51. package/dist/db/run-journal.d.ts.map +1 -0
  52. package/dist/db/run-journal.js +143 -0
  53. package/dist/db/run-resume.d.ts +48 -0
  54. package/dist/db/run-resume.d.ts.map +1 -0
  55. package/dist/db/run-resume.js +137 -0
  56. package/dist/db/runs-repo.d.ts +120 -0
  57. package/dist/db/runs-repo.d.ts.map +1 -0
  58. package/dist/db/runs-repo.js +319 -0
  59. package/dist/db/schema.d.ts +16 -2
  60. package/dist/db/schema.d.ts.map +1 -1
  61. package/dist/db/schema.js +190 -35
  62. package/dist/index.d.ts +1 -1
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +66 -36
  65. package/dist/notifications.js +18 -18
  66. package/dist/profiles.d.ts +7 -3
  67. package/dist/profiles.d.ts.map +1 -1
  68. package/dist/profiles.js +85 -7
  69. package/dist/rpc.d.ts +109 -0
  70. package/dist/rpc.d.ts.map +1 -1
  71. package/dist/rpc.js +89 -0
  72. package/dist/server.d.ts +2 -2
  73. package/dist/server.d.ts.map +1 -1
  74. package/dist/server.js +20 -19
  75. package/dist/shared/jobs-view.d.ts.map +1 -1
  76. package/dist/skill.js +1 -1
  77. package/dist/task-transfer.d.ts +1 -1
  78. package/dist/task-transfer.d.ts.map +1 -1
  79. package/dist/task-transfer.js +14 -10
  80. package/dist/types.d.ts +20 -4
  81. package/dist/types.d.ts.map +1 -1
  82. package/dist/types.js +37 -9
  83. package/dist/workspaces.js +1 -1
  84. package/docs/ARCHITECTURE.md +110 -8
  85. package/docs/COMPATIBILITY.md +10 -6
  86. package/docs/CONCEPT.md +15 -3
  87. package/docs/CROSS_PLATFORM.ru.md +11 -9
  88. package/docs/CROSS_PLATFORM.zh.md +11 -9
  89. package/docs/FAQ.md +2 -2
  90. package/docs/FAQ.ru.md +2 -2
  91. package/docs/FAQ.zh.md +2 -2
  92. package/docs/FEATURES.md +5 -4
  93. package/docs/FEATURES.zh.md +5 -4
  94. package/docs/MIGRATION.md +34 -26
  95. package/docs/README.ru.md +26 -7
  96. package/docs/README.zh.md +9 -8
  97. package/docs/V1-V2-COMPATIBILITY-PLAN.md +6 -6
  98. package/gui-experimental.cjs +8 -8
  99. package/index.js +1 -0
  100. package/locales/en.json +1 -0
  101. package/locales/ru.json +1 -0
  102. package/locales/zh.json +1 -0
  103. package/package.json +31 -10
  104. package/src/core/analytics.ts +2 -2
  105. package/src/core/audit.ts +17 -17
  106. package/src/core/cron-to-schtasks.ts +14 -93
  107. package/src/core/dry-run.ts +26 -26
  108. package/src/core/file-watcher.ts +17 -17
  109. package/src/core/git-trigger.ts +9 -9
  110. package/src/core/glob.ts +1 -1
  111. package/src/core/local-ai.ts +2 -2
  112. package/src/core/lock.ts +9 -9
  113. package/src/core/matrix.ts +31 -31
  114. package/src/core/native-notify.ts +2 -2
  115. package/src/core/one-shot.ts +63 -13
  116. package/src/core/otel.ts +4 -4
  117. package/src/core/permissions.ts +5 -5
  118. package/src/core/prometheus.ts +17 -17
  119. package/src/core/ps-wrapper.ts +57 -37
  120. package/src/core/record-history.ts +40 -40
  121. package/src/core/retention.ts +3 -3
  122. package/src/core/savings.ts +1 -1
  123. package/src/core/schedule-gate.ts +12 -12
  124. package/src/core/schedule-v2.ts +24 -24
  125. package/src/core/scheduler/at-fallback.ts +113 -0
  126. package/src/core/scheduler/index.ts +3 -3
  127. package/src/core/scheduler/linux.ts +64 -13
  128. package/src/core/scheduler/logs.ts +1 -1
  129. package/src/core/scheduler/mac.ts +112 -60
  130. package/src/core/scheduler/posix.ts +15 -1
  131. package/src/core/scheduler/registry.ts +6 -4
  132. package/src/core/scheduler/windows.ts +295 -125
  133. package/src/core/secrets.ts +13 -13
  134. package/src/core/self-analysis.ts +61 -61
  135. package/src/core/session.ts +3 -3
  136. package/src/core/structured-log.ts +3 -3
  137. package/src/core/summary.ts +25 -25
  138. package/src/core/telegram.ts +16 -16
  139. package/src/core/triage-chain.ts +4 -4
  140. package/src/core/triage-compare.ts +8 -8
  141. package/src/core/triage-rules.ts +4 -4
  142. package/src/core/triage-shadow.ts +7 -7
  143. package/src/core/triage-worker.ts +6 -6
  144. package/src/core/triage.ts +23 -23
  145. package/src/core/watch-paths.ts +1 -1
  146. package/src/core/wrappers/bash.ts +41 -41
  147. package/src/db/git-state-repo.ts +1 -1
  148. package/src/db/history-repo.ts +22 -22
  149. package/src/db/index.ts +16 -6
  150. package/src/db/metrics-repo.ts +10 -10
  151. package/src/db/migrate.ts +10 -10
  152. package/src/db/recovery.ts +3 -3
  153. package/src/db/run-journal.ts +212 -0
  154. package/src/db/run-resume.ts +220 -0
  155. package/src/db/runs-repo.ts +481 -0
  156. package/src/db/schema.ts +205 -44
  157. package/src/db/settings-repo.ts +2 -2
  158. package/src/db/tasks-repo.ts +10 -10
  159. package/src/db/templates-repo.ts +7 -7
  160. package/src/gui.tsx +1 -1
  161. package/src/history.ts +4 -4
  162. package/src/i18n.ts +7 -7
  163. package/src/index.ts +341 -304
  164. package/src/integrations.ts +6 -6
  165. package/src/notifications.ts +76 -76
  166. package/src/profiles.ts +98 -7
  167. package/src/rpc.ts +96 -1
  168. package/src/schtasks.ts +2 -2
  169. package/src/server.ts +43 -42
  170. package/src/settings.ts +44 -44
  171. package/src/shared/jobs-view.ts +60 -60
  172. package/src/skill.ts +1 -1
  173. package/src/task-transfer.ts +58 -56
  174. package/src/templates.ts +1 -1
  175. package/src/types.ts +45 -10
  176. package/src/workspaces.ts +16 -16
  177. package/dist/core/self-analysis.test.d.ts +0 -2
  178. package/dist/core/self-analysis.test.d.ts.map +0 -1
  179. package/dist/core/self-analysis.test.js +0 -219
  180. package/dist/gui-experimental.cjs +0 -1
package/src/settings.ts CHANGED
@@ -425,7 +425,7 @@ export function defaultPermissionsSettings(): PermissionSettings {
425
425
  /** Приводит настройки прав к безопасному виду. */
426
426
  function normalizePermissionsSettings(
427
427
  value: unknown,
428
- fallback: PermissionSettings
428
+ fallback: PermissionSettings,
429
429
  ): PermissionSettings {
430
430
  if (!value || typeof value !== "object" || Array.isArray(value)) {
431
431
  return { ...fallback };
@@ -439,7 +439,7 @@ function normalizePermissionsSettings(
439
439
  /** Приводит настройки аудита к безопасному виду. */
440
440
  function normalizeAuditSettings(
441
441
  value: unknown,
442
- fallback: AuditSettings
442
+ fallback: AuditSettings,
443
443
  ): AuditSettings {
444
444
  if (!value || typeof value !== "object" || Array.isArray(value)) {
445
445
  return { ...fallback };
@@ -449,7 +449,7 @@ function normalizeAuditSettings(
449
449
  enabled: typeof raw.enabled === "boolean" ? raw.enabled : fallback.enabled,
450
450
  retentionDays: normalizeRetentionLimit(
451
451
  raw.retentionDays,
452
- fallback.retentionDays
452
+ fallback.retentionDays,
453
453
  ),
454
454
  maxRecords: normalizeRetentionLimit(raw.maxRecords, fallback.maxRecords),
455
455
  };
@@ -498,7 +498,7 @@ function normalizeRetentionLimit(value: unknown, fallback: number): number {
498
498
  /** Приводит настройки ретеншна к безопасному виду. */
499
499
  function normalizeHistorySettings(
500
500
  value: unknown,
501
- fallback: HistorySettings
501
+ fallback: HistorySettings,
502
502
  ): HistorySettings {
503
503
  if (!value || typeof value !== "object" || Array.isArray(value)) {
504
504
  return { ...fallback };
@@ -514,7 +514,7 @@ function normalizeHistorySettings(
514
514
  lastCleanupAt,
515
515
  lastCleanupDeleted: normalizeRetentionLimit(
516
516
  raw.lastCleanupDeleted,
517
- fallback.lastCleanupDeleted
517
+ fallback.lastCleanupDeleted,
518
518
  ),
519
519
  };
520
520
  }
@@ -625,7 +625,7 @@ function normalizeIntInRange(
625
625
  value: unknown,
626
626
  fallback: number,
627
627
  min: number,
628
- max: number
628
+ max: number,
629
629
  ): number {
630
630
  const n = Number(value);
631
631
  if (!Number.isFinite(n)) return fallback;
@@ -637,7 +637,7 @@ function normalizeFloatInRange(
637
637
  value: unknown,
638
638
  fallback: number,
639
639
  min: number,
640
- max: number
640
+ max: number,
641
641
  ): number {
642
642
  const n = Number(value);
643
643
  if (!Number.isFinite(n)) return fallback;
@@ -670,7 +670,7 @@ function asRecord(value: unknown): Record<string, unknown> | undefined {
670
670
  /** Приводит parse_mode Telegram к допустимому значению. */
671
671
  function normalizeTelegramParseMode(
672
672
  value: unknown,
673
- fallback: TelegramParseMode
673
+ fallback: TelegramParseMode,
674
674
  ): TelegramParseMode {
675
675
  return value === "" || value === "HTML" || value === "Markdown" || value === "MarkdownV2"
676
676
  ? value
@@ -699,11 +699,11 @@ function normalizeHttpBase(value: unknown, fallback: string): string {
699
699
  function localizedTemplate(
700
700
  value: unknown,
701
701
  key: string,
702
- fallback: string
702
+ fallback: string,
703
703
  ): string {
704
704
  const raw = typeof value === "string" && value.trim() ? value : fallback;
705
705
  const builtin = SUPPORTED_LOCALES.some(
706
- (locale) => messageIn(locale, key) === raw
706
+ (locale) => messageIn(locale, key) === raw,
707
707
  );
708
708
  return builtin ? t(key) : raw;
709
709
  }
@@ -814,7 +814,7 @@ function normalizeTriageRule(value: unknown): TriageRule | null {
814
814
  /** Нормализует массив правил; undefined сохраняет встроенный набор. */
815
815
  function normalizeTriageRules(
816
816
  value: unknown,
817
- fallback: TriageRule[] | undefined
817
+ fallback: TriageRule[] | undefined,
818
818
  ): TriageRule[] | undefined {
819
819
  if (value === undefined) return fallback?.map((rule) => ({ ...rule }));
820
820
  if (!Array.isArray(value)) return fallback?.map((rule) => ({ ...rule }));
@@ -827,7 +827,7 @@ function normalizeTriageRules(
827
827
  /** Нормализует настройки shadow-режима триажа. */
828
828
  function normalizeTriageShadow(
829
829
  value: unknown,
830
- fallback: TriageShadowSettings
830
+ fallback: TriageShadowSettings,
831
831
  ): TriageShadowSettings {
832
832
  if (!value || typeof value !== "object" || Array.isArray(value)) {
833
833
  return { ...fallback };
@@ -845,7 +845,7 @@ function normalizeTriageShadow(
845
845
 
846
846
  function normalizeDedupSettings(
847
847
  value: unknown,
848
- fallback: NotificationDedupSettings
848
+ fallback: NotificationDedupSettings,
849
849
  ): NotificationDedupSettings {
850
850
  if (!value || typeof value !== "object" || Array.isArray(value)) {
851
851
  return { ...fallback };
@@ -857,7 +857,7 @@ function normalizeDedupSettings(
857
857
  raw.windowMinutes,
858
858
  fallback.windowMinutes,
859
859
  1,
860
- 10_080
860
+ 10_080,
861
861
  ),
862
862
  suppressDuplicates:
863
863
  typeof raw.suppressDuplicates === "boolean"
@@ -875,7 +875,7 @@ function normalizeDedupSettings(
875
875
  /** Нормализация настроек семантического дедупа (Спринт 31.1). */
876
876
  function normalizeEmbeddingSettings(
877
877
  value: unknown,
878
- fallback: NotificationEmbeddingSettings
878
+ fallback: NotificationEmbeddingSettings,
879
879
  ): NotificationEmbeddingSettings {
880
880
  if (!value || typeof value !== "object" || Array.isArray(value)) {
881
881
  return { ...fallback };
@@ -891,19 +891,19 @@ function normalizeEmbeddingSettings(
891
891
  raw.windowMinutes,
892
892
  fallback.windowMinutes,
893
893
  1,
894
- 10_080
894
+ 10_080,
895
895
  ),
896
896
  threshold: normalizeFloatInRange(
897
897
  raw.threshold,
898
898
  fallback.threshold,
899
899
  0,
900
- 1
900
+ 1,
901
901
  ),
902
902
  maxVectors: normalizeIntInRange(
903
903
  raw.maxVectors,
904
904
  fallback.maxVectors,
905
905
  100,
906
- 100_000
906
+ 100_000,
907
907
  ),
908
908
  };
909
909
  }
@@ -911,7 +911,7 @@ function normalizeEmbeddingSettings(
911
911
  /** Нормализует настройки саммари уведомлений (Спринт 31.3). */
912
912
  function normalizeSummarySettings(
913
913
  value: unknown,
914
- fallback: NotificationSummarySettings
914
+ fallback: NotificationSummarySettings,
915
915
  ): NotificationSummarySettings {
916
916
  if (!value || typeof value !== "object" || Array.isArray(value)) {
917
917
  return { ...fallback };
@@ -924,7 +924,7 @@ function normalizeSummarySettings(
924
924
  raw.maxCharsPerLine,
925
925
  fallback.maxCharsPerLine,
926
926
  20,
927
- 500
927
+ 500,
928
928
  ),
929
929
  timeoutMs: normalizeIntInRange(raw.timeoutMs, fallback.timeoutMs, 1000, 120_000),
930
930
  };
@@ -957,7 +957,7 @@ export function startShadow(shadow: TriageShadowSettings | undefined): TriageSha
957
957
  * получает текущий момент, выключенный — сбрасывает дату.
958
958
  */
959
959
  export function settleShadowOnSave(
960
- shadow: TriageShadowSettings | undefined
960
+ shadow: TriageShadowSettings | undefined,
961
961
  ): TriageShadowSettings {
962
962
  if (!shadow) return startShadow(undefined);
963
963
  if (!shadow.enabled) return { ...shadow, startedAt: null };
@@ -972,7 +972,7 @@ export function settleShadowOnSave(
972
972
  */
973
973
  export function normalizeTriageSettings(
974
974
  value: unknown,
975
- fallback: TriageSettings
975
+ fallback: TriageSettings,
976
976
  ): TriageSettings {
977
977
  const fallbackShadow =
978
978
  fallback.shadow ?? defaultNotifications().triage!.shadow!;
@@ -989,12 +989,12 @@ export function normalizeTriageSettings(
989
989
  raw?.timeoutMs,
990
990
  fallback.timeoutMs,
991
991
  1_000,
992
- 120_000
992
+ 120_000,
993
993
  ),
994
994
  fallback: normalizeTriageFallback(raw?.fallback, fallback.fallback),
995
995
  confidenceThreshold: normalizeConfidence(
996
996
  raw?.confidenceThreshold,
997
- fallback.confidenceThreshold
997
+ fallback.confidenceThreshold,
998
998
  ),
999
999
  ...(rules !== undefined ? { rules } : {}),
1000
1000
  shadow: normalizeTriageShadow(raw?.shadow, fallbackShadow),
@@ -1004,7 +1004,7 @@ export function normalizeTriageSettings(
1004
1004
  /** Приводит настройки уведомлений к безопасному виду. */
1005
1005
  function normalizeNotifications(
1006
1006
  value: unknown,
1007
- fallback: NotificationSettings
1007
+ fallback: NotificationSettings,
1008
1008
  ): NotificationSettings {
1009
1009
  const fallbackWebhook = fallback.webhook ?? defaultNotifications().webhook!;
1010
1010
  const fallbackTemplates = fallback.templates ?? defaultNotifications().templates!;
@@ -1078,31 +1078,31 @@ function normalizeNotifications(
1078
1078
  rawWebhook?.timeoutMs,
1079
1079
  fallbackWebhook.timeoutMs,
1080
1080
  1_000,
1081
- 120_000
1081
+ 120_000,
1082
1082
  ),
1083
1083
  retryCount: normalizeIntInRange(
1084
1084
  rawWebhook?.retryCount,
1085
1085
  fallbackWebhook.retryCount,
1086
1086
  0,
1087
- 5
1087
+ 5,
1088
1088
  ),
1089
1089
  retryDelayMs: normalizeIntInRange(
1090
1090
  rawWebhook?.retryDelayMs,
1091
1091
  fallbackWebhook.retryDelayMs,
1092
1092
  100,
1093
- 60_000
1093
+ 60_000,
1094
1094
  ),
1095
1095
  },
1096
1096
  templates: {
1097
1097
  success: localizedTemplate(
1098
1098
  rawTemplates?.success,
1099
1099
  "notify.task.success",
1100
- fallbackTemplates.success
1100
+ fallbackTemplates.success,
1101
1101
  ),
1102
1102
  error: localizedTemplate(
1103
1103
  rawTemplates?.error,
1104
1104
  "notify.task.error",
1105
- fallbackTemplates.error
1105
+ fallbackTemplates.error,
1106
1106
  ),
1107
1107
  },
1108
1108
  filters: {
@@ -1124,7 +1124,7 @@ function normalizeNotifications(
1124
1124
  : fallbackTelegram.chatId,
1125
1125
  parseMode: normalizeTelegramParseMode(
1126
1126
  rawTelegram?.parseMode,
1127
- fallbackTelegram.parseMode
1127
+ fallbackTelegram.parseMode,
1128
1128
  ),
1129
1129
  disableNotification:
1130
1130
  typeof rawTelegram?.disableNotification === "boolean"
@@ -1181,7 +1181,7 @@ function normalizeNotifications(
1181
1181
  rawMatrix?.stuckAfterMinutes,
1182
1182
  fallbackMatrix.stuckAfterMinutes,
1183
1183
  0,
1184
- 10_080
1184
+ 10_080,
1185
1185
  ),
1186
1186
  },
1187
1187
  digest: {
@@ -1196,15 +1196,15 @@ function normalizeNotifications(
1196
1196
  triage: normalizeTriageSettings(rawTriage, fallbackTriage),
1197
1197
  dedup: normalizeDedupSettings(
1198
1198
  raw.dedup,
1199
- fallback.dedup ?? defaultNotifications().dedup!
1199
+ fallback.dedup ?? defaultNotifications().dedup!,
1200
1200
  ),
1201
1201
  embedding: normalizeEmbeddingSettings(
1202
1202
  raw.embedding,
1203
- fallback.embedding ?? defaultNotifications().embedding!
1203
+ fallback.embedding ?? defaultNotifications().embedding!,
1204
1204
  ),
1205
1205
  summary: normalizeSummarySettings(
1206
1206
  raw.summary,
1207
- fallback.summary ?? defaultNotifications().summary!
1207
+ fallback.summary ?? defaultNotifications().summary!,
1208
1208
  ),
1209
1209
  };
1210
1210
  }
@@ -1212,7 +1212,7 @@ function normalizeNotifications(
1212
1212
  /** Приводит настройки интеграций к безопасному виду. */
1213
1213
  function normalizeIntegrations(
1214
1214
  value: unknown,
1215
- fallback: IntegrationSettings
1215
+ fallback: IntegrationSettings,
1216
1216
  ): IntegrationSettings {
1217
1217
  const fallbackHooks = fallback.hooks ?? defaultIntegrations().hooks;
1218
1218
  const raw = asRecord(value);
@@ -1239,13 +1239,13 @@ function normalizeIntegrations(
1239
1239
  rawHooks?.maxBodyBytes,
1240
1240
  fallbackHooks.maxBodyBytes,
1241
1241
  1_024,
1242
- MAX_HOOK_BODY_BYTES
1242
+ MAX_HOOK_BODY_BYTES,
1243
1243
  ),
1244
1244
  timestampToleranceSeconds: normalizeIntInRange(
1245
1245
  rawHooks?.timestampToleranceSeconds,
1246
1246
  fallbackHooks.timestampToleranceSeconds,
1247
1247
  0,
1248
- 86_400
1248
+ 86_400,
1249
1249
  ),
1250
1250
  },
1251
1251
  };
@@ -1264,27 +1264,27 @@ export async function loadSettings(): Promise<SchedulerSettings> {
1264
1264
  return {
1265
1265
  maxConcurrent: normalizeMaxConcurrent(
1266
1266
  parsed?.maxConcurrent,
1267
- DEFAULT_MAX_CONCURRENT
1267
+ DEFAULT_MAX_CONCURRENT,
1268
1268
  ),
1269
1269
  locale: normalizeLocaleMode(parsed?.locale, DEFAULT_LOCALE),
1270
1270
  uiLocale: normalizeLocale(parsed?.uiLocale, DEFAULT_LOCALE),
1271
1271
  winterMode: normalizeWinterMode(
1272
1272
  parsed?.winterMode,
1273
- DEFAULT_WINTER_MODE
1273
+ DEFAULT_WINTER_MODE,
1274
1274
  ),
1275
1275
  notifications: normalizeNotifications(
1276
1276
  parsed?.notifications,
1277
- fallbackNotifications
1277
+ fallbackNotifications,
1278
1278
  ),
1279
1279
  history: normalizeHistorySettings(parsed?.history, fallbackHistory),
1280
1280
  integrations: normalizeIntegrations(
1281
1281
  parsed?.integrations,
1282
- fallbackIntegrations
1282
+ fallbackIntegrations,
1283
1283
  ),
1284
1284
  audit: normalizeAuditSettings(parsed?.audit, fallbackAudit),
1285
1285
  permissions: normalizePermissionsSettings(
1286
1286
  parsed?.permissions,
1287
- fallbackPermissions
1287
+ fallbackPermissions,
1288
1288
  ),
1289
1289
  };
1290
1290
  } catch {
@@ -1304,7 +1304,7 @@ export async function loadSettings(): Promise<SchedulerSettings> {
1304
1304
 
1305
1305
  /** Сохраняет настройки (частичное обновление поверх текущих). */
1306
1306
  export async function saveSettings(
1307
- patch: Partial<SchedulerSettings>
1307
+ patch: Partial<SchedulerSettings>,
1308
1308
  ): Promise<SchedulerSettings> {
1309
1309
  const current = await loadSettings();
1310
1310
  const next: SchedulerSettings = {
@@ -1,10 +1,10 @@
1
- import { getSchedulerBackend } from "../core/scheduler/index.js"
2
- import { latestHistoryByTask, loadHistory, type HistoryRecord } from "../history.js"
1
+ import { getSchedulerBackend } from "../core/scheduler/index.js";
2
+ import { latestHistoryByTask, loadHistory, type HistoryRecord } from "../history.js";
3
3
  import {
4
4
  loadTaskDefinitions,
5
5
  type TaskDefinition,
6
- } from "../task-transfer.js"
7
- import type { ScheduledTaskInfo } from "../types.js"
6
+ } from "../task-transfer.js";
7
+ import type { ScheduledTaskInfo } from "../types.js";
8
8
 
9
9
  export type JobStatus = "running" | "success" | "error" | "partial" | "idle" | "unknown"
10
10
 
@@ -34,39 +34,39 @@ export interface JobDisplayRow {
34
34
  * чтобы задача не исчезла из панели.
35
35
  */
36
36
  export function groupJobsForDisplay(jobs: readonly JobView[]): JobDisplayRow[] {
37
- const byName = new Map<string, JobView[]>()
37
+ const byName = new Map<string, JobView[]>();
38
38
  for (const job of jobs) {
39
- const key = job.name.toLowerCase()
40
- const list = byName.get(key) ?? []
41
- list.push(job)
42
- byName.set(key, list)
39
+ const key = job.name.toLowerCase();
40
+ const list = byName.get(key) ?? [];
41
+ list.push(job);
42
+ byName.set(key, list);
43
43
  }
44
44
 
45
- const children = new Map<string, JobView[]>()
46
- const roots: JobView[] = []
45
+ const children = new Map<string, JobView[]>();
46
+ const roots: JobView[] = [];
47
47
  for (const job of jobs) {
48
- const parent = job.matrixParentId?.trim().toLowerCase()
48
+ const parent = job.matrixParentId?.trim().toLowerCase();
49
49
  if (parent && byName.has(parent) && parent !== job.name.toLowerCase()) {
50
- const list = children.get(parent) ?? []
51
- list.push(job)
52
- children.set(parent, list)
50
+ const list = children.get(parent) ?? [];
51
+ list.push(job);
52
+ children.set(parent, list);
53
53
  } else {
54
- roots.push(job)
54
+ roots.push(job);
55
55
  }
56
56
  }
57
57
 
58
- const byNameAsc = (a: JobView, b: JobView) => a.name.localeCompare(b.name)
59
- roots.sort(byNameAsc)
60
- for (const list of children.values()) list.sort(byNameAsc)
58
+ const byNameAsc = (a: JobView, b: JobView) => a.name.localeCompare(b.name);
59
+ roots.sort(byNameAsc);
60
+ for (const list of children.values()) list.sort(byNameAsc);
61
61
 
62
- const rows: JobDisplayRow[] = []
62
+ const rows: JobDisplayRow[] = [];
63
63
  for (const root of roots) {
64
- rows.push({ job: root, depth: 0 })
64
+ rows.push({ job: root, depth: 0 });
65
65
  for (const child of children.get(root.name.toLowerCase()) ?? []) {
66
- rows.push({ job: child, depth: 1 })
66
+ rows.push({ job: child, depth: 1 });
67
67
  }
68
68
  }
69
- return rows
69
+ return rows;
70
70
  }
71
71
 
72
72
  /**
@@ -76,15 +76,15 @@ export function groupJobsForDisplay(jobs: readonly JobView[]): JobDisplayRow[] {
76
76
  export function nextJobSelection(
77
77
  rows: readonly JobDisplayRow[],
78
78
  currentName: string | undefined,
79
- delta: number
79
+ delta: number,
80
80
  ): string | undefined {
81
- if (rows.length === 0) return undefined
82
- const current = currentName?.trim().toLowerCase()
83
- let index = rows.findIndex((row) => row.job.name.toLowerCase() === current)
84
- if (index === -1) index = delta > 0 ? -1 : 0
85
- const step = delta === 0 ? 1 : delta
86
- index = ((index + step) % rows.length + rows.length) % rows.length
87
- return rows[index]?.job.name
81
+ if (rows.length === 0) return undefined;
82
+ const current = currentName?.trim().toLowerCase();
83
+ let index = rows.findIndex((row) => row.job.name.toLowerCase() === current);
84
+ if (index === -1) index = delta > 0 ? -1 : 0;
85
+ const step = delta === 0 ? 1 : delta;
86
+ index = ((index + step) % rows.length + rows.length) % rows.length;
87
+ return rows[index]?.job.name;
88
88
  }
89
89
 
90
90
  /**
@@ -94,13 +94,13 @@ export function nextJobSelection(
94
94
  export function formatJobLog(
95
95
  logs: string | undefined,
96
96
  error: string | undefined,
97
- maxLines = 40
97
+ maxLines = 40,
98
98
  ): string {
99
- const source = logs?.trim() ? logs : error?.trim()
100
- if (!source) return "Лог пуст."
101
- const limit = Math.max(1, Math.min(Math.floor(maxLines), 200))
102
- const lines = source.replace(/\r\n/g, "\n").split("\n")
103
- return lines.slice(-limit).join("\n")
99
+ const source = logs?.trim() ? logs : error?.trim();
100
+ if (!source) return "Лог пуст.";
101
+ const limit = Math.max(1, Math.min(Math.floor(maxLines), 200));
102
+ const lines = source.replace(/\r\n/g, "\n").split("\n");
103
+ return lines.slice(-limit).join("\n");
104
104
  }
105
105
 
106
106
  /**
@@ -110,26 +110,26 @@ export function formatJobLog(
110
110
  export function statusIcon(status: JobStatus): string {
111
111
  switch (status) {
112
112
  case "running":
113
- return "●"
113
+ return "●";
114
114
  case "error":
115
- return "✗"
115
+ return "✗";
116
116
  case "success":
117
- return "✓"
117
+ return "✓";
118
118
  case "partial":
119
- return "◐"
119
+ return "◐";
120
120
  case "idle":
121
121
  // Задача создана, но ещё ни разу не запускалась.
122
- return "○"
122
+ return "○";
123
123
  default:
124
- return "?"
124
+ return "?";
125
125
  }
126
126
  }
127
127
 
128
128
  /** Переводит запись истории в статус панели (timeout считаем ошибкой). */
129
129
  function historyStatus(record: HistoryRecord | undefined): JobStatus {
130
- if (!record) return "idle"
131
- if (record.status === "timeout") return "error"
132
- return record.status
130
+ if (!record) return "idle";
131
+ if (record.status === "timeout") return "error";
132
+ return record.status;
133
133
  }
134
134
 
135
135
  /**
@@ -140,17 +140,17 @@ function historyStatus(record: HistoryRecord | undefined): JobStatus {
140
140
  export function buildJobsView(
141
141
  tasks: readonly ScheduledTaskInfo[],
142
142
  history: readonly HistoryRecord[],
143
- definitions: readonly TaskDefinition[]
143
+ definitions: readonly TaskDefinition[],
144
144
  ): JobView[] {
145
- const latest = latestHistoryByTask(history)
145
+ const latest = latestHistoryByTask(history);
146
146
  const defs = new Map(
147
- definitions.map((definition) => [definition.name.toLowerCase(), definition])
148
- )
147
+ definitions.map((definition) => [definition.name.toLowerCase(), definition]),
148
+ );
149
149
  return tasks.map((task) => {
150
- const name = task.taskName
151
- const record = latest.get(name.toLowerCase())
152
- const definition = defs.get(name.toLowerCase())
153
- const matrixParentId = definition?.matrixParentId?.trim()
150
+ const name = task.taskName;
151
+ const record = latest.get(name.toLowerCase());
152
+ const definition = defs.get(name.toLowerCase());
153
+ const matrixParentId = definition?.matrixParentId?.trim();
154
154
  return {
155
155
  name,
156
156
  status: historyStatus(record),
@@ -161,8 +161,8 @@ export function buildJobsView(
161
161
  ...(definition?.matrix || definition?.isMatrixParent
162
162
  ? { isMatrixParent: true }
163
163
  : {}),
164
- }
165
- })
164
+ };
165
+ });
166
166
  }
167
167
 
168
168
  /**
@@ -175,14 +175,14 @@ export function buildJobsView(
175
175
  */
176
176
  export async function getJobsView(_context: unknown): Promise<JobView[]> {
177
177
  try {
178
- const backend = getSchedulerBackend()
178
+ const backend = getSchedulerBackend();
179
179
  const [tasks, history, definitions] = await Promise.all([
180
180
  backend.listTasks(),
181
181
  loadHistory(),
182
182
  loadTaskDefinitions(),
183
- ])
184
- return buildJobsView(tasks, history, definitions)
183
+ ]);
184
+ return buildJobsView(tasks, history, definitions);
185
185
  } catch {
186
- return []
186
+ return [];
187
187
  }
188
188
  }
package/src/skill.ts CHANGED
@@ -86,7 +86,7 @@ export function loadSchedulerSkill(): SchedulerSkill | undefined {
86
86
  raw = fs.readFileSync(skillPath, "utf8");
87
87
  } catch {
88
88
  if (process.env.OPENCODE_SCHEDULER_DEBUG_SKILL) {
89
- console.error(`[windows-scheduler] Скилл не найден: ${skillPath}`);
89
+ console.error(`[agent-steward] Скилл не найден: ${skillPath}`);
90
90
  }
91
91
  return undefined;
92
92
  }