switchroom 0.20.12 → 0.20.14

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.
@@ -11408,6 +11408,7 @@ var HindsightPerOpLlmSchema = exports_external.object({
11408
11408
  }).describe("Per-operation LLM override. Every field optional; an unset field (or " + "an omitted op block) inherits the global `hindsight.llm.*`, which is " + "already the engine's fallback — switchroom emits only the vars set.");
11409
11409
  var HindsightConfigSchema = exports_external.object({
11410
11410
  gpu: exports_external.boolean().optional().describe("Force GPU passthrough for the hindsight container on (`true`) or off " + "(`false`), overriding host autodetection in BOTH directions. Absent " + "(the default) → autodetect from the persisted host-capabilities " + "verdict (`~/.switchroom/host-capabilities.json`), which enables " + "`--gpus all` only when that file proves BOTH a GPU and the nvidia " + "container toolkit. Set `true` when that verdict is wrong or unreadable " + "and you know the host has a working toolkit — switchroom cannot verify " + "it for you, and `docker run --gpus all` hard-fails container create on " + "a host without one. Set `false` to pin the container to CPU on a GPU " + "host. This is also the declarative opt-out for the recreate-time GPU " + "drop guard (`switchroom memory setup --recreate` refuses to silently " + "turn a GPU container into a CPU one). `--gpu`/`--no-gpu` on `memory " + "setup` override this for a single run."),
11411
+ mem_limit: exports_external.string().regex(/^\d+(\.\d+)?\s*[bkmgt]?b?$/i, "hindsight.mem_limit must be a docker memory size, e.g. `24g` or `16384m`").optional().describe("Hard memory cap for the hindsight container — docker `--memory` on the " + "`memory setup` path and `mem_limit:` in the emitted compose snippet. A " + "docker size string (`24g`, `16384m`). Absent → switchroom's default " + "(`HINDSIGHT_DEFAULT_MEM_LIMIT`, 16g). This is a docker HostConfig flag, " + "not a container env var, which is why it is a first-class field here " + "rather than an `env:` key. **Move it together with " + "`env.SWITCHROOM_HINDSIGHT_PG_SHARED_BUFFERS`**: Postgres pins the " + "buffer pool as unreclaimable shared memory inside this cap, so a cap " + "that does not clear `shared_buffers` by the container's app working " + "set plus its page-cache floor puts Postgres in a near-OOM " + "configuration. switchroom warns, naming both numbers, when it does " + "not. A value below the container's memory RESERVATION (4g) is " + "rejected outright — docker will not create such a container."),
11411
11412
  cp_access_key: exports_external.string().min(1).optional().describe("Access key for the hindsight control-plane DASHBOARD (upstream " + "`HINDSIGHT_CP_ACCESS_KEY`, port 9999). Literal or — strongly preferred " + "— a `vault:` reference such as `vault:hindsight_cp_access_key`, read " + "through the broker at container-launch time. This is the ONLY thing " + "that arms the dashboard's login: upstream's middleware short-circuits " + "to `next()` when the var is unset, so an unset key means the dashboard " + "has no authentication at all, not weak authentication. Because of that, " + "leaving it unset is FAIL-CLOSED: switchroom pins " + "`HINDSIGHT_CP_HOSTNAME=127.0.0.1` so the loginless dashboard is " + "reachable only from the host, and warns. Set this to serve the " + "dashboard on the LAN/tailnet."),
11412
11413
  llm: exports_external.object({
11413
11414
  provider: exports_external.string().min(1).optional().describe("Hindsight LLM provider (upstream `HINDSIGHT_API_LLM_PROVIDER`). " + "Defaults to `claude-code` (subscription-honest, broker-fed OAuth). " + "Any litellm-routable provider the upstream image supports is valid. " + "Serves as the GLOBAL default for every op absent a per-op override."),
@@ -11433,6 +11433,7 @@ var init_schema = __esm(() => {
11433
11433
  }).describe("Per-operation LLM override. Every field optional; an unset field (or " + "an omitted op block) inherits the global `hindsight.llm.*`, which is " + "already the engine's fallback — switchroom emits only the vars set.");
11434
11434
  HindsightConfigSchema = exports_external.object({
11435
11435
  gpu: exports_external.boolean().optional().describe("Force GPU passthrough for the hindsight container on (`true`) or off " + "(`false`), overriding host autodetection in BOTH directions. Absent " + "(the default) → autodetect from the persisted host-capabilities " + "verdict (`~/.switchroom/host-capabilities.json`), which enables " + "`--gpus all` only when that file proves BOTH a GPU and the nvidia " + "container toolkit. Set `true` when that verdict is wrong or unreadable " + "and you know the host has a working toolkit — switchroom cannot verify " + "it for you, and `docker run --gpus all` hard-fails container create on " + "a host without one. Set `false` to pin the container to CPU on a GPU " + "host. This is also the declarative opt-out for the recreate-time GPU " + "drop guard (`switchroom memory setup --recreate` refuses to silently " + "turn a GPU container into a CPU one). `--gpu`/`--no-gpu` on `memory " + "setup` override this for a single run."),
11436
+ mem_limit: exports_external.string().regex(/^\d+(\.\d+)?\s*[bkmgt]?b?$/i, "hindsight.mem_limit must be a docker memory size, e.g. `24g` or `16384m`").optional().describe("Hard memory cap for the hindsight container — docker `--memory` on the " + "`memory setup` path and `mem_limit:` in the emitted compose snippet. A " + "docker size string (`24g`, `16384m`). Absent → switchroom's default " + "(`HINDSIGHT_DEFAULT_MEM_LIMIT`, 16g). This is a docker HostConfig flag, " + "not a container env var, which is why it is a first-class field here " + "rather than an `env:` key. **Move it together with " + "`env.SWITCHROOM_HINDSIGHT_PG_SHARED_BUFFERS`**: Postgres pins the " + "buffer pool as unreclaimable shared memory inside this cap, so a cap " + "that does not clear `shared_buffers` by the container's app working " + "set plus its page-cache floor puts Postgres in a near-OOM " + "configuration. switchroom warns, naming both numbers, when it does " + "not. A value below the container's memory RESERVATION (4g) is " + "rejected outright — docker will not create such a container."),
11436
11437
  cp_access_key: exports_external.string().min(1).optional().describe("Access key for the hindsight control-plane DASHBOARD (upstream " + "`HINDSIGHT_CP_ACCESS_KEY`, port 9999). Literal or — strongly preferred " + "— a `vault:` reference such as `vault:hindsight_cp_access_key`, read " + "through the broker at container-launch time. This is the ONLY thing " + "that arms the dashboard's login: upstream's middleware short-circuits " + "to `next()` when the var is unset, so an unset key means the dashboard " + "has no authentication at all, not weak authentication. Because of that, " + "leaving it unset is FAIL-CLOSED: switchroom pins " + "`HINDSIGHT_CP_HOSTNAME=127.0.0.1` so the loginless dashboard is " + "reachable only from the host, and warns. Set this to serve the " + "dashboard on the LAN/tailnet."),
11437
11438
  llm: exports_external.object({
11438
11439
  provider: exports_external.string().min(1).optional().describe("Hindsight LLM provider (upstream `HINDSIGHT_API_LLM_PROVIDER`). " + "Defaults to `claude-code` (subscription-honest, broker-fed OAuth). " + "Any litellm-routable provider the upstream image supports is valid. " + "Serves as the GLOBAL default for every op absent a per-op override."),
@@ -19170,6 +19171,7 @@ var HINDSIGHT_PG_DEFAULT_EFFECTIVE_CACHE_SIZE_MIB = 12288;
19170
19171
  function pgMib(mib) {
19171
19172
  return `${mib}MB`;
19172
19173
  }
19174
+ var HINDSIGHT_PG_MIN_NON_BUFFER_MIB = HINDSIGHT_PG_APP_ANON_MIB + HINDSIGHT_PG_PAGE_CACHE_FLOOR_MIB;
19173
19175
  var HINDSIGHT_PG_EFFECTIVE_CACHE_SIZE_ENV = "SWITCHROOM_HINDSIGHT_PG_EFFECTIVE_CACHE_SIZE";
19174
19176
  var HINDSIGHT_PG_SHARED_BUFFERS_ENV = "SWITCHROOM_HINDSIGHT_PG_SHARED_BUFFERS";
19175
19177
  var HINDSIGHT_PG_FSYNC_ENV = "SWITCHROOM_HINDSIGHT_PG_FSYNC";
@@ -19217,6 +19219,7 @@ var HINDSIGHT_DEFAULT_GRAPH_SEED_MIN_SIMILARITY = 0.3;
19217
19219
  var HINDSIGHT_DEFAULT_LLM_SUPPORTS_MAX_ITEMS = "false";
19218
19220
  var HINDSIGHT_DEFAULT_RECENCY_DECAY_FUNCTION = "exponential";
19219
19221
  var HINDSIGHT_DEFAULT_RECENCY_DECAY_HALFLIFE_DAYS = 30;
19222
+ var HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION = "pg_search";
19220
19223
  var HINDSIGHT_PERF_DEFAULTS_UNGATED = [
19221
19224
  [
19222
19225
  "HINDSIGHT_API_RECALL_MAX_CANDIDATES_PER_SOURCE",
@@ -19282,7 +19285,8 @@ var HINDSIGHT_PERF_DEFAULTS_UNGATED = [
19282
19285
  [
19283
19286
  "HINDSIGHT_API_GRAPH_SEED_MIN_SIMILARITY",
19284
19287
  String(HINDSIGHT_DEFAULT_GRAPH_SEED_MIN_SIMILARITY)
19285
- ]
19288
+ ],
19289
+ ["HINDSIGHT_API_TEXT_SEARCH_EXTENSION", HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION]
19286
19290
  ];
19287
19291
  var HINDSIGHT_PERF_DEFAULTS_GPU = [
19288
19292
  ["HINDSIGHT_API_RERANKER_LOCAL_FP16", HINDSIGHT_DEFAULT_RERANKER_LOCAL_FP16],
@@ -12169,6 +12169,7 @@ var HindsightPerOpLlmSchema = exports_external.object({
12169
12169
  }).describe("Per-operation LLM override. Every field optional; an unset field (or " + "an omitted op block) inherits the global `hindsight.llm.*`, which is " + "already the engine's fallback \u2014 switchroom emits only the vars set.");
12170
12170
  var HindsightConfigSchema = exports_external.object({
12171
12171
  gpu: exports_external.boolean().optional().describe("Force GPU passthrough for the hindsight container on (`true`) or off " + "(`false`), overriding host autodetection in BOTH directions. Absent " + "(the default) \u2192 autodetect from the persisted host-capabilities " + "verdict (`~/.switchroom/host-capabilities.json`), which enables " + "`--gpus all` only when that file proves BOTH a GPU and the nvidia " + "container toolkit. Set `true` when that verdict is wrong or unreadable " + "and you know the host has a working toolkit \u2014 switchroom cannot verify " + "it for you, and `docker run --gpus all` hard-fails container create on " + "a host without one. Set `false` to pin the container to CPU on a GPU " + "host. This is also the declarative opt-out for the recreate-time GPU " + "drop guard (`switchroom memory setup --recreate` refuses to silently " + "turn a GPU container into a CPU one). `--gpu`/`--no-gpu` on `memory " + "setup` override this for a single run."),
12172
+ mem_limit: exports_external.string().regex(/^\d+(\.\d+)?\s*[bkmgt]?b?$/i, "hindsight.mem_limit must be a docker memory size, e.g. `24g` or `16384m`").optional().describe("Hard memory cap for the hindsight container \u2014 docker `--memory` on the " + "`memory setup` path and `mem_limit:` in the emitted compose snippet. A " + "docker size string (`24g`, `16384m`). Absent \u2192 switchroom's default " + "(`HINDSIGHT_DEFAULT_MEM_LIMIT`, 16g). This is a docker HostConfig flag, " + "not a container env var, which is why it is a first-class field here " + "rather than an `env:` key. **Move it together with " + "`env.SWITCHROOM_HINDSIGHT_PG_SHARED_BUFFERS`**: Postgres pins the " + "buffer pool as unreclaimable shared memory inside this cap, so a cap " + "that does not clear `shared_buffers` by the container's app working " + "set plus its page-cache floor puts Postgres in a near-OOM " + "configuration. switchroom warns, naming both numbers, when it does " + "not. A value below the container's memory RESERVATION (4g) is " + "rejected outright \u2014 docker will not create such a container."),
12172
12173
  cp_access_key: exports_external.string().min(1).optional().describe("Access key for the hindsight control-plane DASHBOARD (upstream " + "`HINDSIGHT_CP_ACCESS_KEY`, port 9999). Literal or \u2014 strongly preferred " + "\u2014 a `vault:` reference such as `vault:hindsight_cp_access_key`, read " + "through the broker at container-launch time. This is the ONLY thing " + "that arms the dashboard's login: upstream's middleware short-circuits " + "to `next()` when the var is unset, so an unset key means the dashboard " + "has no authentication at all, not weak authentication. Because of that, " + "leaving it unset is FAIL-CLOSED: switchroom pins " + "`HINDSIGHT_CP_HOSTNAME=127.0.0.1` so the loginless dashboard is " + "reachable only from the host, and warns. Set this to serve the " + "dashboard on the LAN/tailnet."),
12173
12174
  llm: exports_external.object({
12174
12175
  provider: exports_external.string().min(1).optional().describe("Hindsight LLM provider (upstream `HINDSIGHT_API_LLM_PROVIDER`). " + "Defaults to `claude-code` (subscription-honest, broker-fed OAuth). " + "Any litellm-routable provider the upstream image supports is valid. " + "Serves as the GLOBAL default for every op absent a per-op override."),
@@ -174,6 +174,7 @@ function buildSignal(kind, reason, occurrences, evidence) {
174
174
 
175
175
  // src/self-improve/review-prompt.ts
176
176
  var REVIEW_SOURCE = "self_improve_review";
177
+ var SELF_IMPROVEMENT_CARD_TITLE = "\uD83D\uDD27 **Self-improvement**";
177
178
  var REVIEW_BANNER = "[self-improvement review]";
178
179
  function isReviewTurn(text) {
179
180
  if (!text)
@@ -193,7 +194,7 @@ function isReviewTurn(text) {
193
194
  function buildReviewPrompt(signals) {
194
195
  const cfg = resolveSelfImproveConfig();
195
196
  const lines = [];
196
- lines.push(`${REVIEW_BANNER} The turn-end gate detected a learning ` + "signal \u2014 a correction or pattern that should bind on future runs. " + "Run a focused, forked review. Use ONLY memory tools (recall/retain/" + "directives) and skill read/write tools (Read/Write/Edit under your " + "own .claude/skills/, skill_* / skill-personal). Do NOT touch " + "anything else, do NOT reply to the operator, and end the turn when " + "done.");
197
+ lines.push(`${REVIEW_BANNER} The turn-end gate detected a learning ` + "signal \u2014 a correction or pattern that should bind on future runs. " + "Run a focused, forked review. Use ONLY memory tools (recall/retain/" + "directives) and skill read/write tools (Read/Write/Edit under your " + "own .claude/skills/, skill_* / skill-personal). Do NOT touch " + "anything else, and do NOT reply to the operator with tools.");
197
198
  lines.push("");
198
199
  lines.push("Signals detected this turn:");
199
200
  for (const s of signals) {
@@ -210,6 +211,17 @@ function buildReviewPrompt(signals) {
210
211
  lines.push(" 5. If this was an operator CORRECTION tied to a skill you own, turn " + "it into a regression test: run `switchroom self-improve add-eval-case " + "--skill <slug> --chat <operator chat id> " + '--prompt "<the correction framed as a test prompt>"`. The `--chat` ' + "flag is REQUIRED \u2014 pass the real operator chat id from this session's " + "context (the chat the correction arrived in), NOT the review turn's " + "own placeholder chat id, or the command is rejected. This proposes " + "the case as a one-tap card; the operator's tap runs a deterministic " + "applier that writes it (PII/secret-scanned). Do NOT Write or Edit " + "evals/evals.json yourself \u2014 a direct write is blocked, bypasses the " + "scan, and skips the operator's approval.");
211
212
  lines.push("");
212
213
  lines.push(`Rate limits in effect: <= ${cfg.maxAutoAppliesPerDay} auto-applies/day, ` + `<= ${cfg.maxOutstandingPending} outstanding pending suggestions. If a ` + "limit is reached, stop and leave a note rather than forcing the change.");
214
+ lines.push("");
215
+ lines.push("OPERATOR OUTPUT \u2014 READ CAREFULLY. You have exactly ONE operator-facing " + "message this turn, and it is the FINAL TEXT you write (not a tool call).");
216
+ lines.push(" - If you actioned NOTHING this turn (deduped, no-op, already handled, or " + "nothing worth the operator's attention), write NO final text at all \u2014 " + "end the turn SILENTLY. Do NOT narrate your reasoning; trailing reasoning " + "prose is suppressed and never reaches the operator.");
217
+ lines.push(" - If you surfaced a REAL outcome (logged a pending suggestion, applied a " + "T1, or proposed an eval case), end the turn with a SINGLE message in " + "EXACTLY this format and nothing else:");
218
+ lines.push("");
219
+ lines.push(`${SELF_IMPROVEMENT_CARD_TITLE} \u2014 <one-line outcome>`);
220
+ lines.push("- **Signal:** <what tripped the gate>");
221
+ lines.push("- **Suggestion:** <the proposed change>");
222
+ lines.push("- **Status:** <tier + whether anything auto-applied, e.g. " + '"T2, logged for your review, nothing auto-applied">');
223
+ lines.push("");
224
+ lines.push(`The leading "${SELF_IMPROVEMENT_CARD_TITLE}" line is REQUIRED verbatim \u2014 it ` + "is what marks the message as a self-improvement card. Anything not " + "starting with it is treated as raw reasoning and dropped.");
213
225
  return lines.join(`
214
226
  `);
215
227
  }