baro-ai 0.117.3 → 0.117.4

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
@@ -20810,7 +20810,7 @@ var require_websocket = __commonJS({
20810
20810
  var http3 = __require("http");
20811
20811
  var net = __require("net");
20812
20812
  var tls = __require("tls");
20813
- var { randomBytes: randomBytes5, createHash: createHash20 } = __require("crypto");
20813
+ var { randomBytes: randomBytes5, createHash: createHash21 } = __require("crypto");
20814
20814
  var { Duplex, Readable: Readable2 } = __require("stream");
20815
20815
  var { URL: URL2 } = __require("url");
20816
20816
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -21478,7 +21478,7 @@ var require_websocket = __commonJS({
21478
21478
  abortHandshake(websocket, socket, "Invalid Upgrade header");
21479
21479
  return;
21480
21480
  }
21481
- const digest = createHash20("sha1").update(key + GUID).digest("base64");
21481
+ const digest = createHash21("sha1").update(key + GUID).digest("base64");
21482
21482
  if (res.headers["sec-websocket-accept"] !== digest) {
21483
21483
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
21484
21484
  return;
@@ -21847,7 +21847,7 @@ var require_websocket_server = __commonJS({
21847
21847
  var EventEmitter = __require("events");
21848
21848
  var http3 = __require("http");
21849
21849
  var { Duplex } = __require("stream");
21850
- var { createHash: createHash20 } = __require("crypto");
21850
+ var { createHash: createHash21 } = __require("crypto");
21851
21851
  var extension2 = require_extension();
21852
21852
  var PerMessageDeflate2 = require_permessage_deflate();
21853
21853
  var subprotocol2 = require_subprotocol();
@@ -22154,7 +22154,7 @@ var require_websocket_server = __commonJS({
22154
22154
  );
22155
22155
  }
22156
22156
  if (this._state > RUNNING) return abortHandshake(socket, 503);
22157
- const digest = createHash20("sha1").update(key + GUID).digest("base64");
22157
+ const digest = createHash21("sha1").update(key + GUID).digest("base64");
22158
22158
  const headers = [
22159
22159
  "HTTP/1.1 101 Switching Protocols",
22160
22160
  "Upgrade: websocket",
@@ -55271,7 +55271,7 @@ function asRecord(value) {
55271
55271
  }
55272
55272
 
55273
55273
  // ../baro-orchestrator/src/execution/collective-board.ts
55274
- import { randomUUID as randomUUID5 } from "crypto";
55274
+ import { createHash as createHash14, randomUUID as randomUUID5 } from "crypto";
55275
55275
 
55276
55276
  // ../baro-orchestrator/src/planning/domain/runtime-amendments.ts
55277
55277
  import { createHash as createHash10 } from "crypto";
@@ -60257,8 +60257,13 @@ var CollectiveBoard = class extends SerializedObserver {
60257
60257
  });
60258
60258
  }
60259
60259
  executeRuntimeReplan(queued, additionalImmutableStoryIds = [], retractedStoryIds = []) {
60260
- const { proposal, requireActiveLease } = queued;
60261
- const lease = this.leases.get(proposal.sourceStoryId);
60260
+ const { requireActiveLease } = queued;
60261
+ const lease = this.leases.get(queued.proposal.sourceStoryId);
60262
+ const { proposal, selfBlock } = splitSelfDependency(
60263
+ queued.proposal,
60264
+ requireActiveLease ? lease : void 0,
60265
+ this.prd
60266
+ );
60262
60267
  const immutableStoryIds = this.runtimeImmutableStoryIds();
60263
60268
  for (const storyId of additionalImmutableStoryIds) {
60264
60269
  immutableStoryIds.add(storyId);
@@ -60287,6 +60292,7 @@ var CollectiveBoard = class extends SerializedObserver {
60287
60292
  })
60288
60293
  );
60289
60294
  this.reconcileRuntimeGraphApplication(outcome.applied);
60295
+ if (selfBlock) this.onWorkBlocked(selfBlock);
60290
60296
  return outcome;
60291
60297
  }
60292
60298
  this.emitGraphDecision(outcome.event);
@@ -61291,6 +61297,34 @@ function nonNegativeSafeInteger(value) {
61291
61297
  function nonNegativeFinite(value) {
61292
61298
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
61293
61299
  }
61300
+ function splitSelfDependency(proposal, lease, prd) {
61301
+ const source = proposal.sourceStoryId;
61302
+ const own = proposal.mutation.modifiedDeps[source];
61303
+ if (!own || !lease || lease.leaseId !== proposal.leaseId || lease.generation !== proposal.generation) return { proposal };
61304
+ const otherDeps = Object.fromEntries(
61305
+ Object.entries(proposal.mutation.modifiedDeps).filter(([storyId]) => storyId !== source)
61306
+ );
61307
+ const stripped = {
61308
+ ...proposal,
61309
+ mutation: { ...proposal.mutation, modifiedDeps: otherDeps }
61310
+ };
61311
+ if (stripped.mutation.addedStories.length === 0 && stripped.mutation.removedStoryIds.length === 0 && Object.keys(otherDeps).length === 0) return { proposal };
61312
+ const current = prd?.userStories.find(({ id }) => id === source)?.dependsOn ?? [];
61313
+ const required2 = [...new Set(own.filter((id) => !current.includes(id)))];
61314
+ if (required2.length === 0) return { proposal: stripped };
61315
+ return {
61316
+ proposal: stripped,
61317
+ selfBlock: {
61318
+ runId: proposal.runId,
61319
+ blockId: `self-${createHash14("sha256").update(proposal.proposalId).digest("hex").slice(0, 24)}`,
61320
+ storyId: source,
61321
+ leaseId: proposal.leaseId,
61322
+ generation: proposal.generation,
61323
+ requiredStoryIds: required2,
61324
+ reason: proposal.reason
61325
+ }
61326
+ };
61327
+ }
61294
61328
  function validDependencyBlock(request) {
61295
61329
  return request.blockId.trim().length > 0 && request.blockId.length <= 200 && request.reason.trim().length > 0 && request.reason.length <= 8e3 && request.requiredStoryIds.length > 0 && request.requiredStoryIds.length <= 32 && request.requiredStoryIds.every(
61296
61330
  (storyId) => storyId.trim().length > 0 && storyId.trim() === storyId && storyId.length <= 128
@@ -61349,7 +61383,7 @@ function sharedAbortCode(codes) {
61349
61383
  }
61350
61384
 
61351
61385
  // ../baro-orchestrator/src/goal/goal-guardian.ts
61352
- import { createHash as createHash14 } from "crypto";
61386
+ import { createHash as createHash15 } from "crypto";
61353
61387
  var MAX_AGGREGATE_REMEDIATIONS_PER_INVARIANT = 3;
61354
61388
  var GoalGuardian = class extends BaseObserver {
61355
61389
  constructor(opts) {
@@ -61604,7 +61638,7 @@ var GoalGuardian = class extends BaseObserver {
61604
61638
  ({ invariantId }) => !this.contract.invariants.some(({ id }) => id === invariantId)
61605
61639
  )) return false;
61606
61640
  const canonical = [...targets].sort((left, right) => left.invariantId.localeCompare(right.invariantId) || left.challengeId.localeCompare(right.challengeId));
61607
- const digest = createHash14("sha256").update(this.contract.contractId).update("\0").update(canonical.length === 1 ? canonical[0].challengeId : canonical.map(({ challengeId, invariantId }) => `${invariantId}\0${challengeId}`).join("\0")).update(retryOf ? `\0retry-of\0${retryOf}` : "").digest("hex");
61641
+ const digest = createHash15("sha256").update(this.contract.contractId).update("\0").update(canonical.length === 1 ? canonical[0].challengeId : canonical.map(({ challengeId, invariantId }) => `${invariantId}\0${challengeId}`).join("\0")).update(retryOf ? `\0retry-of\0${retryOf}` : "").digest("hex");
61608
61642
  return this.ledger.bindChallengeRemediationGroup(
61609
61643
  canonical.map(({ challengeId }) => challengeId),
61610
61644
  {
@@ -61671,7 +61705,7 @@ var GoalGuardian = class extends BaseObserver {
61671
61705
  if (this.ledger.hasOpenChallenge(invariantId)) return false;
61672
61706
  if (kind === "aggregate" && this.ledger.aggregateRemediationCount(invariantId) >= MAX_AGGREGATE_REMEDIATIONS_PER_INVARIANT) return false;
61673
61707
  const ordinal = this.ledger.challengeCount(invariantId) + 1;
61674
- const digest = createHash14("sha256").update(this.contract.contractId).update(`\0${kind}\0`).update(invariantId).update("\0").update(String(ordinal)).digest("hex");
61708
+ const digest = createHash15("sha256").update(this.contract.contractId).update(`\0${kind}\0`).update(invariantId).update("\0").update(String(ordinal)).digest("hex");
61675
61709
  const challengeId = `${kind}-${invariantId.toLowerCase()}-${digest.slice(0, 12)}`;
61676
61710
  this.ledger.raiseChallenge({
61677
61711
  challengeId,
@@ -61702,7 +61736,7 @@ var GoalGuardian = class extends BaseObserver {
61702
61736
  )) return false;
61703
61737
  const targets = uniqueReviews.map(({ invariantId, reason }) => {
61704
61738
  const ordinal = this.ledger.challengeCount(invariantId) + 1;
61705
- const digest = createHash14("sha256").update(this.contract.contractId).update("\0aggregate-group\0").update(remediationGroupId).update("\0").update(invariantId).update("\0").update(String(ordinal)).digest("hex");
61739
+ const digest = createHash15("sha256").update(this.contract.contractId).update("\0aggregate-group\0").update(remediationGroupId).update("\0").update(invariantId).update("\0").update(String(ordinal)).digest("hex");
61706
61740
  return {
61707
61741
  challengeId: `aggregate-${invariantId.toLowerCase()}-${digest.slice(0, 12)}`,
61708
61742
  invariantId,
@@ -63276,7 +63310,7 @@ function extractVerdictJson(text2) {
63276
63310
  }
63277
63311
 
63278
63312
  // ../baro-orchestrator/src/acceptance/critic-evidence.ts
63279
- import { createHash as createHash15 } from "crypto";
63313
+ import { createHash as createHash16 } from "crypto";
63280
63314
  import { constants } from "fs";
63281
63315
  import { lstat as lstat2, open, readlink, realpath } from "fs/promises";
63282
63316
  import { isAbsolute as isAbsolute6, relative as relative7, resolve as resolve10, sep as sep4 } from "path";
@@ -63816,7 +63850,7 @@ async function changedContentFingerprint(target, timeoutMs) {
63816
63850
  `changed-content fingerprint exceeds ${MAX_FINGERPRINT_PATHS} paths`
63817
63851
  );
63818
63852
  }
63819
- const hash = createHash15("sha256");
63853
+ const hash = createHash16("sha256");
63820
63854
  hashField(hash, "schema", "baro-critic-changed-content-v1");
63821
63855
  hashField(hash, "base", base);
63822
63856
  let totalBytes = 0;
@@ -65436,7 +65470,7 @@ var CriticTargetRegistry = class extends BaseObserver {
65436
65470
  var import_cross_spawn3 = __toESM(require_cross_spawn(), 1);
65437
65471
 
65438
65472
  // ../baro-orchestrator/src/harness/codex/failure-diagnostics.ts
65439
- import { createHash as createHash16 } from "crypto";
65473
+ import { createHash as createHash17 } from "crypto";
65440
65474
  import { stripVTControlCharacters } from "util";
65441
65475
  var MAX_MESSAGE_BYTES = 2 * 1024;
65442
65476
  var MAX_IDENTIFIER_BYTES = 128;
@@ -65595,7 +65629,7 @@ function mcpDiagnostic(lifecycle, item, redactionEnvironment) {
65595
65629
  const server = firstString(item, ["server", "server_name"]);
65596
65630
  const tool = firstString(item, ["tool", "tool_name", "name"]);
65597
65631
  const status = normalizedStatus(item.status);
65598
- const keyHash = createHash16("sha256");
65632
+ const keyHash = createHash17("sha256");
65599
65633
  if (id) keyHash.update("id\0").update(id);
65600
65634
  else {
65601
65635
  keyHash.update("anonymous\0").update(server ?? "?").update("\0").update(tool ?? "?");
@@ -71550,10 +71584,10 @@ var GitCoordinator = class extends SerializedObserver {
71550
71584
  };
71551
71585
 
71552
71586
  // ../baro-orchestrator/src/goal/goal-invariant-reviewer.ts
71553
- import { createHash as createHash18 } from "crypto";
71587
+ import { createHash as createHash19 } from "crypto";
71554
71588
 
71555
71589
  // ../baro-orchestrator/src/goal/goal-invariant-review-evidence.ts
71556
- import { createHash as createHash17 } from "crypto";
71590
+ import { createHash as createHash18 } from "crypto";
71557
71591
  import { constants as constants2 } from "fs";
71558
71592
  import { lstat as lstat3, open as open2, readlink as readlink2, realpath as realpath2 } from "fs/promises";
71559
71593
  import { isAbsolute as isAbsolute7, relative as relative8, resolve as resolve11, sep as sep5 } from "path";
@@ -71731,7 +71765,7 @@ async function collectStableRepositoryEvidence(cwd, baseSha, deadline) {
71731
71765
  }
71732
71766
  return {
71733
71767
  evidence: after,
71734
- fingerprint: createHash17("sha256").update("baro-goal-review-repository-v1\0").update(after, "utf8").digest("hex")
71768
+ fingerprint: createHash18("sha256").update("baro-goal-review-repository-v1\0").update(after, "utf8").digest("hex")
71735
71769
  };
71736
71770
  }
71737
71771
  async function collectLosslessRepositoryEvidence(cwdValue, baseShaValue, deadline) {
@@ -73213,7 +73247,7 @@ function parseRemediationGroups(value, verdict, violatedCriteria, groupNamespace
73213
73247
  }
73214
73248
  function deterministicRemediationGroupId(invariantIds, namespace = "legacy") {
73215
73249
  const canonical = [...invariantIds].sort();
73216
- const digest = createHash18("sha256").update("baro-goal-remediation-group-v1\0").update(namespace).update("\0").update(canonical.join("\0")).digest("hex");
73250
+ const digest = createHash19("sha256").update("baro-goal-remediation-group-v1\0").update(namespace).update("\0").update(canonical.join("\0")).digest("hex");
73217
73251
  return `goal-remediation-group-${digest.slice(0, 24)}`;
73218
73252
  }
73219
73253
  function aggregateStatus(invariants) {
@@ -76331,7 +76365,7 @@ function jsonQuotedShellArgument(value) {
76331
76365
  }
76332
76366
 
76333
76367
  // ../baro-orchestrator/src/telemetry/model-telemetry-collector.ts
76334
- import { createHash as createHash19 } from "crypto";
76368
+ import { createHash as createHash20 } from "crypto";
76335
76369
  var ModelTelemetryCollector = class extends SerializedObserver {
76336
76370
  constructor(opts) {
76337
76371
  super();
@@ -76722,7 +76756,7 @@ function routeKey(storyId, correlation) {
76722
76756
  ]) : storyId;
76723
76757
  }
76724
76758
  function terminalFingerprint2(event, correlation) {
76725
- return createHash19("sha256").update(event.type).update("\0").update(JSON.stringify(event.data)).update("\0").update(correlation ? routeKey(correlation.storyId, correlation) : "legacy").digest("hex");
76759
+ return createHash20("sha256").update(event.type).update("\0").update(JSON.stringify(event.data)).update("\0").update(correlation ? routeKey(correlation.storyId, correlation) : "legacy").digest("hex");
76726
76760
  }
76727
76761
 
76728
76762
  // ../baro-orchestrator/src/execution/operator.ts
@@ -83992,6 +84026,7 @@ function createRuntimeReplanTool(graphVersion) {
83992
84026
  },
83993
84027
  modifiedDeps: {
83994
84028
  type: "object",
84029
+ description: "Record<storyId, full dependsOn>. Started stories are immutable, except your own: when stories you add here are prerequisites of THIS story, set your own id to your dependsOn plus their ids \u2014 the Board adds them, then suspends this story and resumes it after they integrate. Stop working once that is applied.",
83995
84030
  additionalProperties: {
83996
84031
  type: "array",
83997
84032
  items: { type: "string" }
@@ -87743,7 +87778,7 @@ var StoryFactory = class extends BaseObserver {
87743
87778
  ...includeCliDagMutationCommands ? [
87744
87779
  ...graphVersion !== void 0 ? [
87745
87780
  `- The launch DAG version is ${graphVersion}. To atomically add, replace, or rewire future work and receive the Board's decision immediately: ${command} emit ${capability} --kind replan --base-version ${graphVersion} --replan-json ${JSON.stringify('{"addedStories":[],"removedStoryIds":[],"modifiedDeps":{}}')} --reason ${JSON.stringify("WHY THE PLAN MUST CHANGE")}`,
87746
- " Use the newest `graphVersion` returned by a prior decision. Active/already-started stories are immutable; express additional work as future stories.",
87781
+ " Use the newest `graphVersion` returned by a prior decision. Active/already-started stories are immutable; express additional work as future stories. The one exception is your own story: when stories you add are its prerequisites, also set `modifiedDeps` for your own id to your dependsOn plus their ids \u2014 the Board then suspends this story until they integrate, so stop work once the replan is applied.",
87747
87782
  ` If replan exits 3 or returns \`outcome_unknown\`, do not assume whether it applied. Resolve that same proposal before continuing: ${command} decision ${capability} --proposal ${JSON.stringify("PROPOSAL_ID")} --wait-ms 30000`
87748
87783
  ] : []
87749
87784
  ] : [],