@hyperfixation/db 0.1.0 → 0.1.2

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.
@@ -6,6 +6,12 @@ import type { ClientBase, Pool } from "pg";
6
6
  export declare const APP_PAUSED_STATEMENT = "SELECT COALESCE((SELECT paused FROM hf_app_state WHERE id = 1), false) AS paused";
7
7
  /** Written by `pause`/`resume` only, inside a control-plane transaction. */
8
8
  export declare const SET_APP_PAUSED_STATEMENT = "UPDATE hf_app_state SET paused = $1, paused_by = $2 WHERE id = 1";
9
+ /**
10
+ * What a process that has built an LLM registry reports about it, for `/api/status` to read in
11
+ * whichever other process serves that route. A single column rather than a log: the only
12
+ * question it answers is what this deploy is serving now.
13
+ */
14
+ export declare const SET_LLM_MODE_STATEMENT = "UPDATE hf_app_state SET llm_mode = $1 WHERE id = 1";
9
15
  export declare class AppStateMissing extends Error {
10
16
  constructor(operation: string);
11
17
  }
package/dist/app-state.js CHANGED
@@ -5,6 +5,12 @@
5
5
  export const APP_PAUSED_STATEMENT = "SELECT COALESCE((SELECT paused FROM hf_app_state WHERE id = 1), false) AS paused";
6
6
  /** Written by `pause`/`resume` only, inside a control-plane transaction. */
7
7
  export const SET_APP_PAUSED_STATEMENT = "UPDATE hf_app_state SET paused = $1, paused_by = $2 WHERE id = 1";
8
+ /**
9
+ * What a process that has built an LLM registry reports about it, for `/api/status` to read in
10
+ * whichever other process serves that route. A single column rather than a log: the only
11
+ * question it answers is what this deploy is serving now.
12
+ */
13
+ export const SET_LLM_MODE_STATEMENT = "UPDATE hf_app_state SET llm_mode = $1 WHERE id = 1";
8
14
  export class AppStateMissing extends Error {
9
15
  constructor(operation) {
10
16
  super(`AppStateMissing: ${operation} matched no hf_app_state row; the singleton is seeded by ` +
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { UnfencedWrite, unfencedWriteOf } from "./fenced-client.js";
4
4
  export { createStepPool, StaleAttempt, FENCE_STATEMENT, STEP_POOL_SIZE, type StepDatabase, type StepPool, type StepPoolOptions, } from "./step-pool.js";
5
5
  export { assertNotInWorkflow, attemptWorkflowId, bumpAttempt, controlPlaneTx, CommitLost, ConcurrentBump, ControlPlaneInWorkflow, RunLockTimeout, RunNotFound, WorkflowIdCollision, CONTROL_PLANE_LOCK_TIMEOUT, LOCK_NOT_AVAILABLE, BUMP_STATEMENT, LOCK_RUN_STATEMENT, WORKFLOW_ID_TAKEN_STATEMENT, type BumpedAttempt, type ControlPlaneTxOptions, } from "./control-plane.js";
6
6
  export { loadSource, type SourceRowInput, type SourceRun } from "./loader.js";
7
- export { appPaused, AppStateMissing, APP_PAUSED_STATEMENT, SET_APP_PAUSED_STATEMENT, } from "./app-state.js";
7
+ export { appPaused, AppStateMissing, APP_PAUSED_STATEMENT, SET_APP_PAUSED_STATEMENT, SET_LLM_MODE_STATEMENT, } from "./app-state.js";
8
8
  /** `runBootChecks` takes these, so the type travels with `.` even though the guards do not. */
9
9
  export type { RecordTable } from "./delete-guard.js";
10
10
  /** `records.archive()` names a registered record table in SQL; it quotes it with this. */
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export { UnfencedWrite, unfencedWriteOf } from "./fenced-client.js";
4
4
  export { createStepPool, StaleAttempt, FENCE_STATEMENT, STEP_POOL_SIZE, } from "./step-pool.js";
5
5
  export { assertNotInWorkflow, attemptWorkflowId, bumpAttempt, controlPlaneTx, CommitLost, ConcurrentBump, ControlPlaneInWorkflow, RunLockTimeout, RunNotFound, WorkflowIdCollision, CONTROL_PLANE_LOCK_TIMEOUT, LOCK_NOT_AVAILABLE, BUMP_STATEMENT, LOCK_RUN_STATEMENT, WORKFLOW_ID_TAKEN_STATEMENT, } from "./control-plane.js";
6
6
  export { loadSource } from "./loader.js";
7
- export { appPaused, AppStateMissing, APP_PAUSED_STATEMENT, SET_APP_PAUSED_STATEMENT, } from "./app-state.js";
7
+ export { appPaused, AppStateMissing, APP_PAUSED_STATEMENT, SET_APP_PAUSED_STATEMENT, SET_LLM_MODE_STATEMENT, } from "./app-state.js";
8
8
  /** `records.archive()` names a registered record table in SQL; it quotes it with this. */
9
9
  export { quoteIdent } from "./roles.js";
10
10
  export { runBootChecks, checkE001, checkE002, checkE003, checkE004, checkE005, checkE006, BootCheckFailure, BOOT_CHECK_CODES, } from "./boot-checks.js";
@@ -104,6 +104,23 @@ export declare const hfAppState: import("drizzle-orm/pg-core").PgTableWithColumn
104
104
  identity: undefined;
105
105
  generated: undefined;
106
106
  }, {}, {}>;
107
+ llmMode: import("drizzle-orm/pg-core").PgColumn<{
108
+ name: "llm_mode";
109
+ tableName: "hf_app_state";
110
+ dataType: "string";
111
+ columnType: "PgText";
112
+ data: string;
113
+ driverParam: string;
114
+ notNull: false;
115
+ hasDefault: false;
116
+ isPrimaryKey: false;
117
+ isAutoincrement: false;
118
+ hasRuntimeDefault: false;
119
+ enumValues: [string, ...string[]];
120
+ baseColumn: never;
121
+ identity: undefined;
122
+ generated: undefined;
123
+ }, {}, {}>;
107
124
  };
108
125
  dialect: "pg";
109
126
  }>;
@@ -11,6 +11,10 @@ export const hfAppState = pgTable("hf_app_state", {
11
11
  budgetUsd: numeric("budget_usd", { precision: 12, scale: 4 }).notNull(),
12
12
  readTokenHash: text("read_token_hash"),
13
13
  writeTokenHash: text("write_token_hash"),
14
+ // Which provider the process that last built an LLM registry selected, so `/api/status`
15
+ // can say that a deploy with no API key is serving fixture drafts. Plain `text`, and null
16
+ // until a process reports — the web that serves the status route never builds one.
17
+ llmMode: text("llm_mode"),
14
18
  }, (t) => [check("hf_app_state_singleton", sql `${t.id} = 1`)]);
15
19
  export const hfAudit = pgTable("hf_audit", {
16
20
  id: bigint("id", { mode: "number" }).generatedAlwaysAsIdentity().primaryKey(),
@@ -0,0 +1 @@
1
+ ALTER TABLE "hf_app_state" ADD COLUMN "llm_mode" text;