chatroom-cli 1.142.0 → 1.143.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.
package/dist/index.js CHANGED
@@ -31581,6 +31581,140 @@ var init_Ref = __esm(() => {
31581
31581
  }));
31582
31582
  });
31583
31583
 
31584
+ // ../../node_modules/.pnpm/effect@4.0.1/node_modules/effect/dist/Semaphore.js
31585
+ var exports_Semaphore = {};
31586
+ __export(exports_Semaphore, {
31587
+ withPermitsIfAvailable: () => withPermitsIfAvailable,
31588
+ withPermits: () => withPermits,
31589
+ withPermit: () => withPermit,
31590
+ takeIfAvailable: () => takeIfAvailable,
31591
+ take: () => take,
31592
+ resize: () => resize,
31593
+ releaseAll: () => releaseAll,
31594
+ release: () => release,
31595
+ makeUnsafe: () => makeUnsafe6,
31596
+ make: () => make12
31597
+ });
31598
+
31599
+ class SemaphoreImpl {
31600
+ waiters = /* @__PURE__ */ new Set;
31601
+ taken = 0;
31602
+ permits;
31603
+ constructor(permits) {
31604
+ this.permits = permits;
31605
+ }
31606
+ get free() {
31607
+ return this.permits - this.taken;
31608
+ }
31609
+ take(n) {
31610
+ const take = suspend(() => {
31611
+ if (this.free < n) {
31612
+ return waitForPermits(this, n, take);
31613
+ }
31614
+ this.taken += n;
31615
+ return succeed3(n);
31616
+ });
31617
+ return take;
31618
+ }
31619
+ takeIfAvailable(n) {
31620
+ return suspend(() => {
31621
+ if (this.free < n)
31622
+ return succeed3(false);
31623
+ this.taken += n;
31624
+ return succeed3(true);
31625
+ });
31626
+ }
31627
+ releaseUnsafe(fiber3, n) {
31628
+ this.taken -= n;
31629
+ if (this.waiters.size > 0) {
31630
+ fiber3.currentDispatcher.scheduleTask(() => {
31631
+ for (const observer of this.waiters) {
31632
+ if (this.free <= 0)
31633
+ break;
31634
+ observer();
31635
+ }
31636
+ }, 0);
31637
+ }
31638
+ return this.free;
31639
+ }
31640
+ resize(permits) {
31641
+ return withFiber((fiber3) => {
31642
+ this.permits = permits;
31643
+ if (this.free < 0)
31644
+ return void_;
31645
+ this.releaseUnsafe(fiber3, 0);
31646
+ return void_;
31647
+ });
31648
+ }
31649
+ release(n) {
31650
+ return withFiber((fiber3) => succeed3(this.releaseUnsafe(fiber3, n)));
31651
+ }
31652
+ get releaseAll() {
31653
+ return withFiber((fiber3) => succeed3(this.releaseUnsafe(fiber3, this.taken)));
31654
+ }
31655
+ withPermits(n) {
31656
+ return (self2) => uninterruptibleMask((restore) => {
31657
+ const acquire = suspend(() => {
31658
+ if (this.free < n) {
31659
+ const wait = waitForPermits(this, n, void_);
31660
+ return flatMap(restore(wait), () => acquire);
31661
+ }
31662
+ this.taken += n;
31663
+ return onExitPrimitive(restore(self2), () => {
31664
+ this.releaseUnsafe(getCurrentFiber(), n);
31665
+ return;
31666
+ }, true);
31667
+ });
31668
+ return acquire;
31669
+ });
31670
+ }
31671
+ withPermit = /* @__PURE__ */ this.withPermits(1);
31672
+ withPermitsIfAvailable(n) {
31673
+ return (self2) => uninterruptibleMask((restore) => {
31674
+ if (this.free < n)
31675
+ return succeedNone;
31676
+ this.taken += n;
31677
+ return onExitPrimitive(restore(asSome(self2)), () => {
31678
+ this.releaseUnsafe(getCurrentFiber(), n);
31679
+ return;
31680
+ }, true);
31681
+ });
31682
+ }
31683
+ }
31684
+ var makeUnsafe6 = (permits) => new SemaphoreImpl(permits), waitForPermits = (self2, n, effect2) => callback((resume) => {
31685
+ if (self2.free >= n)
31686
+ return resume(effect2);
31687
+ const observer = () => {
31688
+ if (self2.free < n)
31689
+ return;
31690
+ self2.waiters.delete(observer);
31691
+ resume(effect2);
31692
+ };
31693
+ self2.waiters.add(observer);
31694
+ return sync(() => {
31695
+ self2.waiters.delete(observer);
31696
+ });
31697
+ }), make12 = (permits) => sync(() => new SemaphoreImpl(permits)), resize, withPermits = (self2, permits, effect2) => {
31698
+ const withPermits2 = self2.withPermits(permits);
31699
+ return effect2 ? withPermits2(effect2) : withPermits2;
31700
+ }, withPermit = (self2, effect2) => {
31701
+ if (!effect2)
31702
+ return self2.withPermit;
31703
+ return self2.withPermit(effect2);
31704
+ }, withPermitsIfAvailable = (self2, permits, effect2) => {
31705
+ const withPermits2 = self2.withPermitsIfAvailable(permits);
31706
+ return effect2 ? withPermits2(effect2) : withPermits2;
31707
+ }, take, takeIfAvailable, release, releaseAll = (self2) => self2.releaseAll;
31708
+ var init_Semaphore = __esm(() => {
31709
+ init_Function();
31710
+ init_core();
31711
+ init_effect();
31712
+ resize = /* @__PURE__ */ dual(2, (self2, permits) => self2.resize(permits));
31713
+ take = /* @__PURE__ */ dual(2, (self2, permits) => self2.take(permits));
31714
+ takeIfAvailable = /* @__PURE__ */ dual(2, (self2, permits) => self2.takeIfAvailable(permits));
31715
+ release = /* @__PURE__ */ dual(2, (self2, permits) => self2.release(permits));
31716
+ });
31717
+
31584
31718
  // ../../node_modules/.pnpm/effect@4.0.1/node_modules/effect/dist/index.js
31585
31719
  var init_dist = __esm(() => {
31586
31720
  init_Cause();
@@ -31592,6 +31726,7 @@ var init_dist = __esm(() => {
31592
31726
  init_ManagedRuntime();
31593
31727
  init_Ref();
31594
31728
  init_Schedule();
31729
+ init_Semaphore();
31595
31730
  });
31596
31731
 
31597
31732
  // src/commands/auth-login/auth-login-service.ts
@@ -51536,7 +51671,7 @@ var init_stop_agent_confirmed_adapter = __esm(() => {
51536
51671
 
51537
51672
  // src/daemon/domain/usecase/stop-agent-targets.ts
51538
51673
  async function stopAgentTargets(deps, args2) {
51539
- const release = await deps.barrier.acquire(args2.chatroomId);
51674
+ const release2 = await deps.barrier.acquire(args2.chatroomId);
51540
51675
  try {
51541
51676
  const targets = args2.targets ?? [];
51542
51677
  const outcomes = [];
@@ -51564,7 +51699,7 @@ async function stopAgentTargets(deps, args2) {
51564
51699
  }));
51565
51700
  return { targets: outcomes, failures };
51566
51701
  } finally {
51567
- release();
51702
+ release2();
51568
51703
  }
51569
51704
  }
51570
51705
  var init_stop_agent_targets = __esm(() => {
@@ -74949,7 +75084,7 @@ var init_coordinator_reviewer_chat = __esm(() => {
74949
75084
 
74950
75085
  // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-specifier-code.ts
74951
75086
  function getCoordinatorSpecifierCodeTemplate(_query) {
74952
- return `Instructions (not part of the message): Delegate ONE work package to the \`specifier\`. The specifier turns it into file-level builder slices, drives the builder through every build pass, and hands one consolidated report back to you. Clear every required gate first (researcher, triage, architect, uiux-engineer, game-asset-designer) and include the decisions from their briefs, citing message ids — the specifier cannot contact those roles. Do not write file-level code instructions yourself; state outcomes, constraints, and acceptance criteria. Each package starts the specifier in a fresh session: include everything it needs, or name the message ids it must read with \`chatroom messages download\`.
75087
+ return `Instructions (not part of the message): Delegate ONE work package to the \`specifier\`. The specifier plans the package as file-level builder slices, drives the builder through ONE slice, and hands a slice report back to you that names the slices still to do. Send each remaining slice as a new work package that names the slice to build. Clear every required gate first (researcher, triage, architect, uiux-engineer, game-asset-designer) and include the decisions from their briefs, citing message ids — the specifier cannot contact those roles. Do not write file-level code instructions yourself; state outcomes, constraints, and acceptance criteria. Each package starts the specifier in a fresh session: include everything it needs, or name the message ids it must read with \`chatroom messages download\`.
74953
75088
 
74954
75089
  ${getDelegationBriefIntro()}
74955
75090
 
@@ -74981,7 +75116,7 @@ ${getFileReferenceGuidanceComment()}
74981
75116
  <commit, branch, push, and PR expectations from the user; or \`None stated.\`>
74982
75117
 
74983
75118
  ## History pointers
74984
- <message ids or a \`--since-message-id\` anchor the specifier should download for context; or \`None.\`>
75119
+ <message ids or a \`--since-message-id\` anchor the specifier should download for context, including the prior slice report when this package continues a slice plan; or \`None.\`>
74985
75120
  \`\`\``;
74986
75121
  }
74987
75122
  var init_coordinator_specifier_code = () => {};
@@ -75248,7 +75383,7 @@ var init_specifier_builder_chat = __esm(() => {
75248
75383
  function getSpecifierCoordinatorChatTemplate(_query) {
75249
75384
  return `Instructions (not part of the message): chat response for the coordinator —
75250
75385
  \`\`\`markdown
75251
- <write only the concise status the coordinator needs: what was delivered, blockers, and decisions it must make; do not add handoff XML sections, proofs, or report headings>
75386
+ <write only the concise status the coordinator needs: what this slice delivered, the slices still to do, blockers, and decisions it must make; do not add handoff XML sections, proofs, or report headings>
75252
75387
  \`\`\``;
75253
75388
  }
75254
75389
 
@@ -75258,7 +75393,7 @@ function getSpecifierCoordinatorCodeTemplate(query) {
75258
75393
 
75259
75394
  \`\`\`markdown
75260
75395
  ## Summary
75261
- <what this work package delivered, or why it stopped, in plain terms>
75396
+ <what this slice delivered, or why it stopped, in plain terms; say which slice of the package this report covers>
75262
75397
 
75263
75398
  ## Template Disclosure Confirmation
75264
75399
  - [ ] I confirm that I have seen this template at the start of this work package, before driving the builder
@@ -75269,17 +75404,20 @@ ${getRoleGuidanceDisclosureBlock({
75269
75404
  })}
75270
75405
 
75271
75406
  ## What exists today
75272
- ${getHandoffNotApplicableSectionComment("Describe current state after this work package")}
75273
- <current state after this work package: what the user can now do, what is in place, how the system behaves>
75407
+ ${getHandoffNotApplicableSectionComment("Describe current state after this slice")}
75408
+ <current state after this slice: what the user can now do, what is in place, how the system behaves>
75409
+
75410
+ ## Slice delivered
75411
+ <the one builder slice this report covers: builder handoff message id, commits, files changed, rework rounds>
75274
75412
 
75275
- ## Slices delivered
75276
- <one entry per builder slice: builder handoff message id, commits, files changed, rework rounds>
75413
+ ## Slices still to do
75414
+ <the remaining slices of this work package, in build order, each with its goal and the files it touches; or \`None — the package is complete.\`>
75277
75415
 
75278
75416
  ${getHandoffQualityPrinciplesSectionBlock("work")}
75279
75417
 
75280
75418
  ## Proof of Completion
75281
75419
  ${getFileReferenceProofOfCompletionExample()}
75282
- <for each acceptance criterion in the work package: met / not met, with evidence (test names and output, commands run, commits)>
75420
+ <for each acceptance criterion in the work package: met / not met / left to a remaining slice, with evidence (test names and output, commands run, commits)>
75283
75421
 
75284
75422
  ## Code Change Verification
75285
75423
  ${CODE_CHANGE_VERIFICATION_CONFIRMATION}
@@ -76374,13 +76512,13 @@ var init_templates = __esm(() => {
76374
76512
  specifier: {
76375
76513
  role: "specifier",
76376
76514
  title: "Specifier",
76377
- description: "You are the specifier responsible for turning the coordinator's work package into detailed, code-level builder briefs and driving the builder through every build pass; you do not implement code.",
76515
+ description: "You are the specifier responsible for turning the coordinator's work package into a slice plan and code-level builder briefs, and for driving the builder through one slice per session; you do not implement code.",
76378
76516
  responsibilities: [
76379
76517
  "Inspect the repository to ground the work package",
76380
76518
  "Split the package into file-level builder slices",
76381
76519
  "Review each builder slice against the brief and acceptance criteria",
76382
76520
  "Send rework to the builder with specific feedback",
76383
- "Report the completed package or blockers to the coordinator"
76521
+ "Report each reviewed slice, with the slices still to do, or blockers to the coordinator"
76384
76522
  ],
76385
76523
  defaultHandoffTarget: "builder"
76386
76524
  },
@@ -87907,12 +88045,11 @@ var init_agent_lifecycle_outbox_runtime = __esm(() => {
87907
88045
 
87908
88046
  // src/daemon/entry/daemon-services.ts
87909
88047
  function DaemonMutableStateServiceLive(init2) {
87910
- return exports_Layer.effect(DaemonMutableStateService, exports_Effect.gen(function* () {
87911
- return {
87912
- lastPushedModels: yield* exports_Ref.make(init2.lastPushedModels),
87913
- lastPushedHarnessFingerprint: yield* exports_Ref.make(init2.lastPushedHarnessFingerprint)
87914
- };
87915
- }));
88048
+ return exports_Layer.succeed(DaemonMutableStateService, {
88049
+ lastPushedModels: exports_Ref.makeUnsafe(init2.lastPushedModels),
88050
+ lastPushedHarnessFingerprint: exports_Ref.makeUnsafe(init2.lastPushedHarnessFingerprint),
88051
+ modelsPushLock: exports_Semaphore.makeUnsafe(1)
88052
+ });
87916
88053
  }
87917
88054
  var AgentLifecycleOutboxService, AgentLifecycleOutboxServiceLive = (registry3, machineId) => exports_Layer.succeed(AgentLifecycleOutboxService, {
87918
88055
  enqueue: (fact) => exports_Effect.promise(() => enqueueAgentLifecycleFact(registry3, machineId, fact)),
@@ -96880,17 +97017,20 @@ var pushModelsSnapshotMutationEffect = (models, modelDiff, nextHarnessFingerprin
96880
97017
  const message = getErrorMessage(error51);
96881
97018
  console.warn(`[${formatTimestamp2()}] ⚠️ Model refresh failed: ${message}`);
96882
97019
  return { kind: "failed", message };
96883
- }))), refreshModelsEffect, discoverAndPushHarnessModelsEffect = (harness, service4, catalog) => exports_Effect.gen(function* () {
97020
+ }))), commitModelsSnapshotEffect = (buildNext, options) => exports_Effect.gen(function* () {
96884
97021
  const mutable = yield* DaemonMutableStateService;
97022
+ return yield* mutable.modelsPushLock.withPermits(1)(exports_Effect.gen(function* () {
97023
+ const next2 = buildNext(yield* exports_Ref.get(mutable.lastPushedModels));
97024
+ const outcome = yield* pushModelsSnapshotIfChangedEffect(next2, options);
97025
+ if (outcome.kind === "pushed") {
97026
+ yield* exports_Ref.set(mutable.lastPushedModels, outcome.snapshot.lastPushedModels);
97027
+ yield* exports_Ref.set(mutable.lastPushedHarnessFingerprint, outcome.snapshot.lastPushedHarnessFingerprint);
97028
+ }
97029
+ return outcome;
97030
+ }));
97031
+ }), refreshModelsEffect, discoverAndPushHarnessModelsEffect = (harness, service4, catalog) => exports_Effect.gen(function* () {
96885
97032
  const result3 = yield* exports_Effect.promise(() => discoverModelsForHarness(harness, service4));
96886
- const next2 = nextSnapshotAfterHarness(yield* exports_Ref.get(mutable.lastPushedModels), harness, result3, catalog);
96887
- const pushOutcome = yield* pushModelsSnapshotIfChangedEffect(next2, {
96888
- logPrefix: `${harness} models updated`
96889
- });
96890
- if (pushOutcome.kind === "pushed") {
96891
- yield* exports_Ref.set(mutable.lastPushedModels, pushOutcome.snapshot.lastPushedModels);
96892
- yield* exports_Ref.set(mutable.lastPushedHarnessFingerprint, pushOutcome.snapshot.lastPushedHarnessFingerprint);
96893
- }
97033
+ yield* commitModelsSnapshotEffect((current) => nextSnapshotAfterHarness(current, harness, result3, catalog), { logPrefix: `${harness} models updated` });
96894
97034
  }), startBackgroundModelDiscoveryEffect;
96895
97035
  var init_models_refresh = __esm(() => {
96896
97036
  init_dist();
@@ -96901,7 +97041,6 @@ var init_models_refresh = __esm(() => {
96901
97041
  init_convex_error();
96902
97042
  refreshModelsEffect = exports_Effect.gen(function* () {
96903
97043
  const session2 = yield* DaemonSessionService;
96904
- const mutable = yield* DaemonMutableStateService;
96905
97044
  if (!session2.config) {
96906
97045
  return { kind: "noop" };
96907
97046
  }
@@ -96919,15 +97058,13 @@ var init_models_refresh = __esm(() => {
96919
97058
  });
96920
97059
  ctxConfig.availableHarnesses = freshConfig.availableHarnesses;
96921
97060
  ctxConfig.harnessVersions = freshConfig.harnessVersions;
96922
- return yield* pushModelsSnapshotIfChangedEffect(models);
97061
+ return yield* commitModelsSnapshotEffect(() => models);
96923
97062
  }).pipe(exports_Effect.catch((error51) => exports_Effect.sync(() => {
96924
97063
  const message = getErrorMessage(error51);
96925
97064
  console.warn(`[${formatTimestamp2()}] ⚠️ Model refresh failed: ${message}`);
96926
97065
  return { kind: "failed", message };
96927
97066
  })));
96928
97067
  if (outcome.kind === "pushed") {
96929
- yield* exports_Ref.set(mutable.lastPushedModels, outcome.snapshot.lastPushedModels);
96930
- yield* exports_Ref.set(mutable.lastPushedHarnessFingerprint, outcome.snapshot.lastPushedHarnessFingerprint);
96931
97068
  return {
96932
97069
  kind: "pushed",
96933
97070
  snapshot: outcome.snapshot
@@ -101067,8 +101204,8 @@ async function drainPendingFileTreeReleaseRequests(session2, fileTree) {
101067
101204
  if (!releases?.length)
101068
101205
  return;
101069
101206
  const releasesByDir = new Set;
101070
- for (const release of releases) {
101071
- releasesByDir.add(normalizeWorkingDirForLookup(release.workingDir));
101207
+ for (const release2 of releases) {
101208
+ releasesByDir.add(normalizeWorkingDirForLookup(release2.workingDir));
101072
101209
  }
101073
101210
  let successCount = 0;
101074
101211
  for (const normalized of releasesByDir) {
@@ -123748,4 +123885,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
123748
123885
  });
123749
123886
  program2.parse();
123750
123887
 
123751
- //# debugId=5F161EC999138A6E64756E2164756E21
123888
+ //# debugId=A53D39B9C99789DF64756E2164756E21