switchroom 0.20.10 → 0.20.11

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 (52) hide show
  1. package/dist/agent-scheduler/index.js +65 -2
  2. package/dist/auth-broker/index.js +185 -23
  3. package/dist/cli/notion-write-pretool.mjs +65 -2
  4. package/dist/cli/self-improve-apply-guard-pretool.mjs +357 -92
  5. package/dist/cli/self-improve-stop.mjs +889 -7
  6. package/dist/cli/skill-validate-pretool.mjs +82 -3
  7. package/dist/cli/switchroom.js +3669 -2107
  8. package/dist/host-control/main.js +67 -4
  9. package/dist/vault/approvals/kernel-server.js +66 -3
  10. package/dist/vault/broker/server.js +66 -3
  11. package/package.json +1 -1
  12. package/profiles/_shared/agent-self-service.md.hbs +15 -22
  13. package/profiles/_shared/delegation-golden-rule.md.hbs +1 -1
  14. package/profiles/_shared/dev-protocol.md.hbs +1 -1
  15. package/profiles/_shared/execution-discipline.md.hbs +4 -4
  16. package/profiles/_shared/vault-protocol.md.hbs +2 -18
  17. package/profiles/default/CLAUDE.md.hbs +3 -5
  18. package/telegram-plugin/auto-fallback-fleet.ts +37 -2
  19. package/telegram-plugin/dist/gateway/gateway.js +1405 -918
  20. package/telegram-plugin/fallback-card-collapse.ts +1 -0
  21. package/telegram-plugin/gateway/auth-command.ts +11 -1
  22. package/telegram-plugin/gateway/callback-query-handlers.ts +100 -0
  23. package/telegram-plugin/gateway/eval-case-proposal-card.ts +86 -0
  24. package/telegram-plugin/gateway/fleet-fallback-notice-cooldown.test.ts +74 -0
  25. package/telegram-plugin/gateway/fleet-fallback-notice-cooldown.ts +71 -0
  26. package/telegram-plugin/gateway/gateway.ts +85 -90
  27. package/telegram-plugin/gateway/ipc-protocol.ts +43 -0
  28. package/telegram-plugin/gateway/ipc-server.ts +28 -0
  29. package/telegram-plugin/gateway/narrative-lane.ts +33 -2
  30. package/telegram-plugin/gateway/privacy-reset.test.ts +216 -0
  31. package/telegram-plugin/gateway/privacy-reset.ts +87 -0
  32. package/telegram-plugin/gateway/privacy-state.test.ts +165 -0
  33. package/telegram-plugin/gateway/privacy-state.ts +206 -0
  34. package/telegram-plugin/gateway/self-improve-proposal-wiring.ts +176 -0
  35. package/telegram-plugin/gateway/stale-pin-sweep-wiring.ts +24 -14
  36. package/telegram-plugin/gateway/stale-pin-sweep.test.ts +123 -26
  37. package/telegram-plugin/gateway/stale-pin-sweep.ts +48 -32
  38. package/telegram-plugin/gateway/throttle-tier-wiring.ts +15 -4
  39. package/telegram-plugin/slot-banner-driver.ts +42 -5
  40. package/telegram-plugin/tests/auto-fallback-fleet.test.ts +24 -0
  41. package/telegram-plugin/tests/gateway-handler-registration-wiring.test.ts +2 -0
  42. package/telegram-plugin/tests/narrative-lane-golden.test.ts +97 -0
  43. package/telegram-plugin/tests/privacy-reset-call-sites.test.ts +120 -0
  44. package/telegram-plugin/tests/status-pin-store.test.ts +25 -0
  45. package/telegram-plugin/tests/throttle-tier.test.ts +16 -0
  46. package/telegram-plugin/tests/turn-flush-safety.test.ts +67 -0
  47. package/telegram-plugin/throttle-tier.ts +12 -3
  48. package/telegram-plugin/turn-flush-safety.ts +97 -0
  49. package/vendor/hindsight-memory/scripts/retain.py +306 -0
  50. package/vendor/hindsight-memory/scripts/subagent_retain.py +29 -1
  51. package/vendor/hindsight-memory/scripts/tests/test_private_mode.py +415 -0
  52. package/vendor/hindsight-memory/scripts/tests/test_self_improve_correction_tag.py +167 -0
@@ -159,6 +159,18 @@ export type FleetFallbackOutcome =
159
159
  oldLabel: string;
160
160
  announcement: string;
161
161
  oldQuota: QuotaUtilization | null;
162
+ }
163
+ | {
164
+ /** The triggering agent has a strict pin (`auth.strict`) — the broker
165
+ * marked its account but deliberately did not roll it. Distinct from
166
+ * 'no-eligible-target' so the gateway can apply its own notice
167
+ * cooldown: like all-blocked, this is a no-op outcome the ~60s
168
+ * quota_wall_detected re-trigger would otherwise re-broadcast for
169
+ * the life of the wall. */
170
+ kind: 'strict-pinned';
171
+ oldLabel: string;
172
+ announcement: string;
173
+ oldQuota: QuotaUtilization | null;
162
174
  };
163
175
 
164
176
  export interface FleetFallbackDeps {
@@ -177,7 +189,14 @@ export interface FleetFallbackDeps {
177
189
  * /auth button uses) is gated to admin agents, so a non-admin agent that
178
190
  * 429'd could never self-heal. mark-exhausted derives the account from the
179
191
  * caller's own identity, so it needs no admin. */
180
- failover: () => Promise<{ rolledTo: string | null; rolled: string[] }>;
192
+ failover: () => Promise<{
193
+ rolledTo: string | null;
194
+ rolled: string[];
195
+ /** True when the triggering agent has a strict pin (`auth.strict`): its
196
+ * null `rolledTo` means it rides out the wall on its own account — NOT
197
+ * a fleet-wide all-blocked. Absent from pre-flag brokers → false. */
198
+ callerPinnedStrict?: boolean;
199
+ }>;
181
200
  /** Agent that triggered this fallback (for the announcement byline). */
182
201
  triggerAgent: string;
183
202
  /** Operator timezone for absolute reset times in the announcement. */
@@ -259,7 +278,23 @@ export async function runFleetAutoFallback(
259
278
  // choice (same `nextHealthyAccount` selection /auth rotate uses) rather than
260
279
  // picking here, so the announcement matches what actually happened. Caller
261
280
  // catches and surfaces failures — we don't double-wrap.
262
- const { rolledTo } = await deps.failover();
281
+ const { rolledTo, callerPinnedStrict } = await deps.failover();
282
+
283
+ if (!rolledTo && callerPinnedStrict) {
284
+ // Strict pin: the broker marked the account but deliberately did not roll
285
+ // the caller (agents.<name>.auth.strict). Rendering the all-blocked card
286
+ // here would tell the operator the whole fleet is exhausted while the
287
+ // snapshots in that very card show healthy accounts.
288
+ return {
289
+ kind: 'strict-pinned',
290
+ oldLabel: oldSnap.label,
291
+ oldQuota: oldSnap.quota,
292
+ announcement:
293
+ `_**${escapeMarkdown(deps.triggerAgent)}** is strictly pinned to ` +
294
+ `${escapeMarkdown(oldSnap.label)} (\`auth.strict\`) — riding out the wall ` +
295
+ `on its own account. The rest of the fleet is unaffected._`,
296
+ };
297
+ }
263
298
 
264
299
  if (!rolledTo) {
265
300
  // All-blocked path: the broker found no non-exhausted fallback. The active