@oss-autopilot/core 3.42.5 → 3.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/dist/cli-pre-action.js +8 -3
  2. package/dist/cli-registry.js +428 -27
  3. package/dist/cli.bundle.cjs +212 -156
  4. package/dist/commands/check-integration.js +5 -1
  5. package/dist/commands/cleanup.d.ts +80 -0
  6. package/dist/commands/cleanup.js +334 -0
  7. package/dist/commands/comments.d.ts +14 -1
  8. package/dist/commands/comments.js +17 -5
  9. package/dist/commands/config.d.ts +2 -0
  10. package/dist/commands/config.js +63 -6
  11. package/dist/commands/daily-dismiss-filter.d.ts +7 -0
  12. package/dist/commands/daily-dismiss-filter.js +17 -1
  13. package/dist/commands/daily-ledger.d.ts +150 -0
  14. package/dist/commands/daily-ledger.js +248 -0
  15. package/dist/commands/daily-recent-prs.d.ts +26 -0
  16. package/dist/commands/daily-recent-prs.js +55 -0
  17. package/dist/commands/daily-render.d.ts +2 -1
  18. package/dist/commands/daily-render.js +4 -1
  19. package/dist/commands/daily.d.ts +5 -1
  20. package/dist/commands/daily.js +83 -93
  21. package/dist/commands/dashboard-cache.d.ts +2 -0
  22. package/dist/commands/dashboard-cache.js +33 -8
  23. package/dist/commands/dashboard-data.js +113 -69
  24. package/dist/commands/dashboard-gist-sync.js +3 -1
  25. package/dist/commands/dashboard-lifecycle.d.ts +36 -8
  26. package/dist/commands/dashboard-lifecycle.js +132 -39
  27. package/dist/commands/dashboard-process.d.ts +49 -1
  28. package/dist/commands/dashboard-process.js +111 -12
  29. package/dist/commands/dashboard-server.js +89 -23
  30. package/dist/commands/detect-formatters.js +1 -0
  31. package/dist/commands/dismiss.js +11 -7
  32. package/dist/commands/doctor.d.ts +15 -1
  33. package/dist/commands/doctor.js +66 -5
  34. package/dist/commands/draft.d.ts +77 -0
  35. package/dist/commands/draft.js +218 -0
  36. package/dist/commands/eval.js +1 -0
  37. package/dist/commands/fork-prune.d.ts +58 -0
  38. package/dist/commands/fork-prune.js +247 -0
  39. package/dist/commands/guidelines.d.ts +69 -2
  40. package/dist/commands/guidelines.js +158 -14
  41. package/dist/commands/index.d.ts +29 -4
  42. package/dist/commands/index.js +20 -3
  43. package/dist/commands/issue-thread.d.ts +46 -0
  44. package/dist/commands/issue-thread.js +123 -0
  45. package/dist/commands/ledger-backfill.d.ts +9 -0
  46. package/dist/commands/ledger-backfill.js +44 -1
  47. package/dist/commands/list-mark-done.d.ts +2 -1
  48. package/dist/commands/list-mark-done.js +3 -1
  49. package/dist/commands/list-move-tier.d.ts +2 -1
  50. package/dist/commands/list-move-tier.js +3 -1
  51. package/dist/commands/local-repos.js +10 -5
  52. package/dist/commands/locate-issue-list.d.ts +40 -17
  53. package/dist/commands/locate-issue-list.js +148 -88
  54. package/dist/commands/move.js +7 -1
  55. package/dist/commands/overnight-handoff.d.ts +17 -7
  56. package/dist/commands/overnight-handoff.js +36 -14
  57. package/dist/commands/overnight-push-prep.d.ts +14 -8
  58. package/dist/commands/overnight-push-prep.js +107 -35
  59. package/dist/commands/overnight-tool-rules.d.ts +54 -0
  60. package/dist/commands/overnight-tool-rules.js +217 -0
  61. package/dist/commands/overnight.d.ts +5 -6
  62. package/dist/commands/overnight.js +61 -140
  63. package/dist/commands/parse-list.js +7 -1
  64. package/dist/commands/policy.d.ts +90 -0
  65. package/dist/commands/policy.js +276 -0
  66. package/dist/commands/pr-create.d.ts +48 -0
  67. package/dist/commands/pr-create.js +200 -0
  68. package/dist/commands/pr-preflight.d.ts +69 -0
  69. package/dist/commands/pr-preflight.js +348 -0
  70. package/dist/commands/repo-vet.d.ts +9 -0
  71. package/dist/commands/repo-vet.js +36 -11
  72. package/dist/commands/scout-bridge.js +18 -8
  73. package/dist/commands/search.js +7 -0
  74. package/dist/commands/setup.d.ts +3 -3
  75. package/dist/commands/setup.js +160 -48
  76. package/dist/commands/skip-add.js +10 -1
  77. package/dist/commands/startup.d.ts +12 -3
  78. package/dist/commands/startup.js +82 -49
  79. package/dist/commands/state-cmd.d.ts +2 -0
  80. package/dist/commands/state-cmd.js +5 -1
  81. package/dist/commands/stats.js +1 -0
  82. package/dist/commands/status.js +6 -0
  83. package/dist/commands/strategy.js +1 -0
  84. package/dist/commands/validation.d.ts +5 -0
  85. package/dist/commands/validation.js +5 -0
  86. package/dist/commands/vet-list.d.ts +6 -0
  87. package/dist/commands/vet-list.js +26 -1
  88. package/dist/commands/vet.d.ts +20 -0
  89. package/dist/commands/vet.js +133 -2
  90. package/dist/commands/work.d.ts +4 -0
  91. package/dist/commands/work.js +34 -11
  92. package/dist/core/__fixtures__/prompt-injection-payloads.js +31 -0
  93. package/dist/core/anti-llm-policy.d.ts +3 -0
  94. package/dist/core/anti-llm-policy.js +3 -0
  95. package/dist/core/auth.js +2 -0
  96. package/dist/core/ci-analysis.d.ts +7 -2
  97. package/dist/core/ci-analysis.js +76 -21
  98. package/dist/core/commit-date.d.ts +45 -0
  99. package/dist/core/commit-date.js +45 -0
  100. package/dist/core/compliance-score.d.ts +3 -0
  101. package/dist/core/compliance-score.js +13 -9
  102. package/dist/core/config-registry.d.ts +27 -2
  103. package/dist/core/config-registry.js +94 -7
  104. package/dist/core/contributing.d.ts +2 -3
  105. package/dist/core/contributing.js +2 -3
  106. package/dist/core/daily-logic.d.ts +30 -5
  107. package/dist/core/daily-logic.js +68 -19
  108. package/dist/core/errors.d.ts +37 -3
  109. package/dist/core/errors.js +54 -5
  110. package/dist/core/fork-prune.d.ts +149 -0
  111. package/dist/core/fork-prune.js +333 -0
  112. package/dist/core/gist-health.d.ts +15 -3
  113. package/dist/core/gist-health.js +8 -0
  114. package/dist/core/gist-state-store.d.ts +24 -4
  115. package/dist/core/gist-state-store.js +98 -51
  116. package/dist/core/github-stats.d.ts +110 -16
  117. package/dist/core/github-stats.js +295 -110
  118. package/dist/core/http-cache.d.ts +0 -10
  119. package/dist/core/http-cache.js +0 -19
  120. package/dist/core/index.d.ts +13 -6
  121. package/dist/core/index.js +16 -6
  122. package/dist/core/issue-conversation.d.ts +8 -2
  123. package/dist/core/issue-conversation.js +31 -12
  124. package/dist/core/local-config.d.ts +95 -0
  125. package/dist/core/local-config.js +270 -0
  126. package/dist/core/merged-pr-notes.d.ts +2 -2
  127. package/dist/core/pacing.d.ts +41 -0
  128. package/dist/core/pacing.js +115 -0
  129. package/dist/core/pagination.d.ts +55 -0
  130. package/dist/core/pagination.js +59 -0
  131. package/dist/core/paths.d.ts +7 -0
  132. package/dist/core/paths.js +9 -0
  133. package/dist/core/pr-assembly.d.ts +2 -0
  134. package/dist/core/pr-assembly.js +6 -2
  135. package/dist/core/pr-graphql.d.ts +53 -4
  136. package/dist/core/pr-graphql.js +87 -14
  137. package/dist/core/pr-monitor.d.ts +35 -12
  138. package/dist/core/pr-monitor.js +110 -26
  139. package/dist/core/pr-preflight.d.ts +154 -0
  140. package/dist/core/pr-preflight.js +753 -0
  141. package/dist/core/pr-quality-rubric.d.ts +0 -6
  142. package/dist/core/pr-quality-rubric.js +0 -8
  143. package/dist/core/pr-template.d.ts +2 -0
  144. package/dist/core/pr-template.js +5 -1
  145. package/dist/core/prose-script.d.ts +72 -0
  146. package/dist/core/prose-script.js +223 -0
  147. package/dist/core/repo-policy.d.ts +111 -0
  148. package/dist/core/repo-policy.js +428 -0
  149. package/dist/core/repo-score-manager.d.ts +66 -0
  150. package/dist/core/repo-score-manager.js +140 -1
  151. package/dist/core/review-analysis.d.ts +49 -21
  152. package/dist/core/review-analysis.js +89 -15
  153. package/dist/core/reviewed-prs-fetch.js +11 -29
  154. package/dist/core/reviewed-prs.js +8 -15
  155. package/dist/core/stale-data.d.ts +78 -0
  156. package/dist/core/stale-data.js +153 -0
  157. package/dist/core/state-persistence.d.ts +62 -27
  158. package/dist/core/state-persistence.js +338 -119
  159. package/dist/core/state-schema.d.ts +152 -210
  160. package/dist/core/state-schema.js +232 -80
  161. package/dist/core/state.d.ts +81 -8
  162. package/dist/core/state.js +239 -46
  163. package/dist/core/status-determination.js +32 -12
  164. package/dist/core/strategy.js +3 -1
  165. package/dist/core/types.d.ts +22 -1
  166. package/dist/core/types.js +1 -0
  167. package/dist/core/untrusted-content.d.ts +30 -11
  168. package/dist/core/untrusted-content.js +95 -42
  169. package/dist/core/urls.d.ts +33 -0
  170. package/dist/core/urls.js +94 -0
  171. package/dist/dashboard/assets/chart-panel-B-nLVgzQ.js +3 -0
  172. package/dist/dashboard/assets/index-5IvMGokL.js +55 -0
  173. package/dist/dashboard/index.html +1 -1
  174. package/dist/formatters/json.d.ts +432 -10
  175. package/dist/formatters/json.js +156 -1
  176. package/package.json +6 -6
  177. package/dist/core/ci-enforced-tools.d.ts +0 -35
  178. package/dist/core/ci-enforced-tools.js +0 -109
  179. package/dist/core/comment-decision.d.ts +0 -79
  180. package/dist/core/comment-decision.js +0 -82
  181. package/dist/core/extraction-categories.d.ts +0 -55
  182. package/dist/core/extraction-categories.js +0 -108
  183. package/dist/core/follow-up-history.d.ts +0 -40
  184. package/dist/core/follow-up-history.js +0 -71
  185. package/dist/core/issue-effort.d.ts +0 -29
  186. package/dist/core/issue-effort.js +0 -47
  187. package/dist/core/maintainer-hints.d.ts +0 -23
  188. package/dist/core/maintainer-hints.js +0 -36
  189. package/dist/core/workflow-state.d.ts +0 -56
  190. package/dist/core/workflow-state.js +0 -101
  191. package/dist/dashboard/assets/chart-panel-DPKNBUts.js +0 -3
  192. package/dist/dashboard/assets/index-B25bZOYX.js +0 -55
@@ -6,16 +6,20 @@
6
6
  import { AgentState } from './types.js';
7
7
  /**
8
8
  * Acquire an advisory file lock using exclusive-create (`wx` flag).
9
- * If the lock file already exists but is stale (older than LOCK_TIMEOUT_MS or corrupt),
10
- * it is removed and re-acquired.
11
- * @throws Error if the lock is held by another active process.
9
+ * A held lock is retried for about a second; a stale one (see
10
+ * {@link readStaleLock}) is taken over through an atomic rename.
11
+ * @returns The lock content written, for {@link releaseLock} and for
12
+ * re-checking ownership before the write the lock protects.
13
+ * @throws StateLockTimeoutError (a ConcurrencyError) if the lock is still
14
+ * held after the wait. Nothing has been written at that point.
12
15
  */
13
- export declare function acquireLock(lockPath: string): void;
16
+ export declare function acquireLock(lockPath: string): string;
14
17
  /**
15
- * Release an advisory file lock, but only if this process owns it.
16
- * Silently ignores missing lock files or locks owned by other processes.
18
+ * Release an advisory file lock, but only if it still holds `held`, the
19
+ * content {@link acquireLock} returned. A missing lock is ignored; any other
20
+ * failure is warned about, never thrown (this runs in a `finally`).
17
21
  */
18
- export declare function releaseLock(lockPath: string): void;
22
+ export declare function releaseLock(lockPath: string, held: string): void;
19
23
  /**
20
24
  * Write data to `filePath` atomically by first writing to a temporary file
21
25
  * in the same directory and then renaming. Rename is atomic on POSIX filesystems,
@@ -61,12 +65,31 @@ export interface LoadRecoveryInfo {
61
65
  reason: string;
62
66
  }
63
67
  /**
64
- * Result of {@link loadState}: the loaded state, the file's mtime for change
65
- * detection, and (only when the main file was rejected) recovery details.
68
+ * What saveState's compare-and-swap and reloadStateIfChanged compare (#2006).
69
+ * mtime alone misses two writes in one timestamp quantum (whole seconds on
70
+ * FAT and some network or synced mounts). Every write here is an atomic
71
+ * rename, which usually lands on a new inode; size catches in-place writers.
72
+ * Where the file system synthesizes or reuses inode numbers (FAT/vfat, cifs
73
+ * with noserverino, FUSE without use_ino, ext4 reusing a freed inode), or
74
+ * reports `ino` as 0 on both sides, the check degrades to mtime + size.
75
+ * `ino` is the decimal string of a bigint stat: a 64-bit NTFS file ID does
76
+ * not fit a double, and two IDs that round to the same number would match.
77
+ */
78
+ export interface StateFileIdentity {
79
+ mtimeMs: number;
80
+ ino: string;
81
+ size: number;
82
+ }
83
+ /**
84
+ * Result of {@link loadState}: the loaded state, the file's identity for
85
+ * change detection, and (only when the main file was rejected) recovery
86
+ * details. `fileId` is null only when there was no state file to take a
87
+ * baseline from. Fresh state that replaces a rejected file keeps the
88
+ * rejected file's identity, so an intervening valid write is not clobbered.
66
89
  */
67
90
  export interface LoadStateResult {
68
91
  state: AgentState;
69
- mtimeMs: number;
92
+ fileId: StateFileIdentity | null;
70
93
  recovery?: LoadRecoveryInfo;
71
94
  }
72
95
  /**
@@ -77,39 +100,51 @@ export interface LoadStateResult {
77
100
  * dropped silently. `source` names the copy in the warning.
78
101
  */
79
102
  export declare function warnMalformedWorkClaims(raw: unknown, state: AgentState, source: string): void;
103
+ /**
104
+ * Refuse stored state whose schema version is above this release's. Treating
105
+ * it as invalid would restore an older backup (or fresh state) over newer
106
+ * data. `source` names the copy in the message.
107
+ */
108
+ export declare function assertNotNewerVersion(raw: unknown, source: string): void;
80
109
  /**
81
110
  * Load state from file, or create initial state if none exists.
82
111
  * If the main state file is corrupted, attempts to restore from the most recent backup.
83
112
  * Performs migration from legacy ./data/ location if needed.
84
- * @returns Object with the loaded state, the file's mtime (for change detection),
113
+ * @returns Object with the loaded state, the file's identity (for change detection),
85
114
  * and recovery details when the main file was rejected.
86
- * @throws Error when the state file exists but cannot be read due to a
87
- * permission error (EACCES/EPERM) — that is an environment problem, not
88
- * corruption, so restore-or-fresh would mask it and risk clobbering data.
115
+ * @throws Error when the state file exists but cannot be read due to a file
116
+ * system error (EACCES/EPERM get guidance, others are rethrown as they are)
117
+ * or was written by a newer release. Neither is corruption, so
118
+ * restore-or-fresh would mask it and risk clobbering data. No file is touched.
89
119
  */
90
120
  export declare function loadState(): LoadStateResult;
91
121
  /**
92
122
  * Persist state to disk, creating a timestamped backup of the previous
93
123
  * state file first. Retains at most 10 backup files.
94
124
  *
95
- * When `expectedMtimeMs` is provided (non-null, non-zero), implements
96
- * optimistic compare-and-swap: if the on-disk file has been modified since
97
- * the caller last loaded it, throws `ConcurrencyError` instead of
98
- * overwriting. This prevents the classic read-modify-write lost-update
99
- * race across processes (see issue #1030). Pass `null` / `0` to disable
100
- * the check (first write, or when the caller has already reloaded).
125
+ * When `expected` is provided (non-null), implements optimistic
126
+ * compare-and-swap: if the on-disk file's identity (mtime, inode, size)
127
+ * differs from the one the caller last loaded or saved, throws
128
+ * `ConcurrencyError` instead of overwriting. This prevents the classic
129
+ * read-modify-write lost-update race across processes (see issues #1030,
130
+ * #2006). Pass `null` to disable the check (no file at load).
101
131
  *
102
132
  * The check runs *inside* the advisory lock so the compare-and-swap is
103
133
  * atomic with respect to the write.
104
134
  *
105
- * @returns The file's mtime after writing (for change detection).
106
- * @throws ConcurrencyError when `expectedMtimeMs` is provided and the
107
- * on-disk mtime no longer matches.
135
+ * @returns The file's identity after writing (for change detection).
136
+ * @throws ConcurrencyError when `expected` is provided and the on-disk
137
+ * identity no longer matches, or the file cannot be stat'ed.
108
138
  */
109
- export declare function saveState(state: Readonly<AgentState>, expectedMtimeMs?: number | null): number;
139
+ export declare function saveState(state: Readonly<AgentState>, expected?: StateFileIdentity | null): StateFileIdentity;
110
140
  /**
111
141
  * Re-read state from disk if the file has been modified since the last load/save.
112
- * Uses mtime comparison (single statSync call) to avoid unnecessary JSON parsing.
113
- * @returns The new state and mtime if reloaded, or null if no change detected.
142
+ * Compares file identity (single statSync call) to avoid unnecessary JSON parsing;
143
+ * a null baseline always reloads.
144
+ * @returns The new state and identity if reloaded, or null if no change detected
145
+ * (or the file is gone).
146
+ * @throws What {@link loadState} throws, after one retry for transient
147
+ * resource errors: a newer-version state file or a persistent file system
148
+ * error must reach the caller, not be served as stale state.
114
149
  */
115
- export declare function reloadStateIfChanged(lastLoadedMtimeMs: number): LoadStateResult | null;
150
+ export declare function reloadStateIfChanged(lastLoaded: StateFileIdentity | null): LoadStateResult | null;