baro-ai 0.117.1 → 0.117.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.
package/dist/cli.mjs CHANGED
@@ -60108,7 +60108,12 @@ var CollectiveBoard = class extends SerializedObserver {
60108
60108
  baseGraphVersion: this.runtimeReplans.graphVersion,
60109
60109
  reason: `autonomous remediation for ${invariantIds.join(", ")}: ` + remediation.reason,
60110
60110
  mutation: {
60111
- addedStories: [remediation.story],
60111
+ addedStories: [
60112
+ this.withRemediationPrerequisites(
60113
+ remediation.story,
60114
+ invariantIds
60115
+ )
60116
+ ],
60112
60117
  removedStoryIds: [],
60113
60118
  modifiedDeps: {}
60114
60119
  }
@@ -60162,6 +60167,23 @@ var CollectiveBoard = class extends SerializedObserver {
60162
60167
  else this.scheduleNextWave();
60163
60168
  }
60164
60169
  }
60170
+ /**
60171
+ * A remediation waits for every queued, not-yet-integrated story already
60172
+ * working the same invariants — e.g. the chain a surgeon split out of the
60173
+ * previous remediation. Running beside that chain, it re-attempts work
60174
+ * whose prerequisite has not landed and the review rejects it every turn
60175
+ * (#199). Leased stories are left out: the story that raised the challenge
60176
+ * is one, and a remediation must not wait on its own source.
60177
+ */
60178
+ withRemediationPrerequisites(story, invariantIds) {
60179
+ const targets = new Set(invariantIds);
60180
+ const prerequisites = (this.prd?.userStories ?? []).filter((candidate) => candidate.id !== story.id && !candidate.passes && !this.completed.includes(candidate.id) && !this.failed.has(candidate.id) && !this.leases.has(candidate.id) && (candidate.goalInvariantIds ?? []).some((id) => targets.has(id))).map(({ id }) => id);
60181
+ if (prerequisites.length === 0) return story;
60182
+ return {
60183
+ ...story,
60184
+ dependsOn: [.../* @__PURE__ */ new Set([...story.dependsOn, ...prerequisites])].sort()
60185
+ };
60186
+ }
60165
60187
  emitGoalRemediationAdmitted(remediation, graphVersion, disposition) {
60166
60188
  this.emit(
60167
60189
  GoalInvariantRemediationAdmitted.create({
@@ -61243,7 +61265,8 @@ function addUnique(values, value) {
61243
61265
  if (!values.includes(value)) values.push(value);
61244
61266
  }
61245
61267
  function sameRemediationStory(current, expected) {
61246
- return current.id === expected.id && current.priority === expected.priority && current.title === expected.title && current.description === expected.description && sameStrings(current.dependsOn, expected.dependsOn) && current.retries === (expected.retries ?? 2) && sameStrings(current.acceptance, expected.acceptance ?? []) && sameStrings(current.tests, expected.tests ?? []) && sameStrings(
61268
+ return current.id === expected.id && current.priority === expected.priority && current.title === expected.title && current.description === expected.description && // Admission may add same-invariant prerequisites to the proposal.
61269
+ expected.dependsOn.every((id) => current.dependsOn.includes(id)) && sameStrings(current.acceptance, expected.acceptance ?? []) && sameStrings(current.tests, expected.tests ?? []) && sameStrings(
61247
61270
  current.goalInvariantIds ?? [],
61248
61271
  expected.goalInvariantIds ?? []
61249
61272
  ) && current.model === expected.model;
@@ -62016,6 +62039,7 @@ function boundedChallengeReason(reason) {
62016
62039
  const cut = sentenceEnd > MAX_CRITERION_REASON_CHARS / 2 ? window2.slice(0, sentenceEnd + 1) : window2.slice(0, Math.max(window2.lastIndexOf(" "), 1));
62017
62040
  return `${cut} \u2026 [truncated; the full reasoning is in the story description]`;
62018
62041
  }
62042
+ var REMEDIATION_STORY_RETRIES = 0;
62019
62043
  function legacyRemediationStory(storyId, { challenge, invariant }) {
62020
62044
  return {
62021
62045
  id: storyId,
@@ -62025,7 +62049,7 @@ function legacyRemediationStory(storyId, { challenge, invariant }) {
62025
62049
  Observed risk: ${challenge.reason}
62026
62050
  Implement the smallest correct fix and focused regression evidence; preserve every other GoalContract invariant.`,
62027
62051
  dependsOn: [],
62028
- retries: 2,
62052
+ retries: REMEDIATION_STORY_RETRIES,
62029
62053
  acceptance: [
62030
62054
  `[${invariant.id}] ${invariant.text}`,
62031
62055
  `Challenge ${challenge.challengeId} is addressed: ${boundedChallengeReason(challenge.reason)}`,
@@ -62047,7 +62071,7 @@ function groupedRemediationStory(storyId, targets) {
62047
62071
  ` + targets.map(({ challenge, invariant }) => `[${invariant.id}] ${invariant.text}
62048
62072
  Observed risk: ${challenge.reason}`).join("\n") + "\nImplement the smallest correct fix and focused regression evidence; preserve every other GoalContract invariant.",
62049
62073
  dependsOn: [],
62050
- retries: 2,
62074
+ retries: REMEDIATION_STORY_RETRIES,
62051
62075
  acceptance: [
62052
62076
  ...targets.map(({ invariant }) => `[${invariant.id}] ${invariant.text}`),
62053
62077
  ...targets.map(({ challenge }) => `Challenge ${challenge.challengeId} is addressed: ${boundedChallengeReason(challenge.reason)}`),
@@ -63932,7 +63956,13 @@ async function assertNoSymlinkParents(cwd, absolute) {
63932
63956
  let current = resolve10(cwd);
63933
63957
  for (const part of parts.slice(0, -1)) {
63934
63958
  current = resolve10(current, part);
63935
- const stat2 = await lstat2(current);
63959
+ let stat2;
63960
+ try {
63961
+ stat2 = await lstat2(current);
63962
+ } catch (error) {
63963
+ if (errorCode(error) === "ENOENT") return;
63964
+ throw error;
63965
+ }
63936
63966
  if (stat2.isSymbolicLink() || !stat2.isDirectory()) {
63937
63967
  throw new Error(
63938
63968
  "fingerprint path has a symlink or non-directory parent"