@hyperfixation/core 0.1.0 → 0.1.1
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.d.ts +1 -1
- package/dist/status.d.ts +9 -0
- package/dist/status.js +7 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { addLabel, listLabels, LABEL_ADD_OPERATION, LABEL_LIST_OPERATION, type L
|
|
|
14
14
|
export { listOutcomes, recordOutcome, OUTCOME_LIST_OPERATION, OUTCOME_RECORD_OPERATION, type OutcomeListOptions, type OutcomeRecordOptions, type OutcomeRow, } from "./outcomes.js";
|
|
15
15
|
export { pauseApp, resumeApp, PAUSED_MARKER, PAUSE_OPERATION, RESUMED_MARKER, RESUME_OPERATION, type PauseOptions, type PauseResult, type ResumeOptions, type ResumeResult, } from "./pause.js";
|
|
16
16
|
export { archiveRecord, archiveDecisionKey, assertRecordStages, displayColumnOf, ARCHIVED_MARKER, ARCHIVE_OPERATION, DEFAULT_DISPLAY_COLUMN, type ArchiveOptions, type ArchiveResult, type RecordDefinition, type StageDefinition, } from "./records.js";
|
|
17
|
-
export { appStatus, CORE_VERSION, type PeriodStatus, type QueueStatus, type StatusOptions, type StatusReport, } from "./status.js";
|
|
17
|
+
export { appStatus, CORE_VERSION, type LlmMode, type PeriodStatus, type QueueStatus, type StatusOptions, type StatusReport, } from "./status.js";
|
|
18
18
|
export { createStatusHandler, statusRouteOf, STATUS_TOKEN_ACTOR, type StatusHandlerOptions, type StatusRoute, type StatusRouteHandlers, } from "./status-route.js";
|
|
19
19
|
export { bearerToken, hashStatusToken, statusTokenMatches, STATUS_TOKEN_DIGEST, } from "./status-token.js";
|
|
20
20
|
/**
|
package/dist/status.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export interface PeriodStatus {
|
|
|
17
17
|
ledgerUsd: string;
|
|
18
18
|
driftUsd: string;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* What the app's LLM calls are being answered by, as the process that built the registry
|
|
22
|
+
* reported it. `unknown` means no process has reported — not that a key is missing.
|
|
23
|
+
*/
|
|
24
|
+
export type LlmMode = "live" | "fixtures" | "unknown";
|
|
20
25
|
export interface StatusReport {
|
|
21
26
|
/** `degraded` when there are anomalies or any period's spend disagrees with its ledger. */
|
|
22
27
|
health: "ok" | "degraded";
|
|
@@ -25,6 +30,10 @@ export interface StatusReport {
|
|
|
25
30
|
coreVersion: string;
|
|
26
31
|
paused: boolean;
|
|
27
32
|
pausedBy: string | null;
|
|
33
|
+
/** A deploy with no provider key serves fixture drafts; this is where that is visible. */
|
|
34
|
+
llm: {
|
|
35
|
+
mode: LlmMode;
|
|
36
|
+
};
|
|
28
37
|
runs: Record<RunStatus, number>;
|
|
29
38
|
queues: QueueStatus[];
|
|
30
39
|
approvals: Record<string, number>;
|
package/dist/status.js
CHANGED
|
@@ -5,7 +5,7 @@ export const CORE_VERSION = createRequire(import.meta.url)("../package.json").ve
|
|
|
5
5
|
* Every read here is a plain `SELECT` and none of them locks anything — in particular not a
|
|
6
6
|
* budget row, which is the one thing the lock order forbids any of these paths to take.
|
|
7
7
|
*/
|
|
8
|
-
const STATE_STATEMENT = "SELECT paused, paused_by, budget_usd::text AS budget_usd FROM hf_app_state WHERE id = 1";
|
|
8
|
+
const STATE_STATEMENT = "SELECT paused, paused_by, budget_usd::text AS budget_usd, llm_mode FROM hf_app_state WHERE id = 1";
|
|
9
9
|
const PERIODS_STATEMENT = "SELECT to_char(date_trunc('month', now() AT TIME ZONE 'UTC'), 'YYYY-MM') AS current_period, " +
|
|
10
10
|
"to_char(date_trunc('month', now() AT TIME ZONE 'UTC') - interval '1 month', 'YYYY-MM') " +
|
|
11
11
|
"AS previous_period";
|
|
@@ -40,6 +40,7 @@ const BUDGET_STATEMENT = "SELECT b.period, b.budget_usd::text AS budget_usd, b.s
|
|
|
40
40
|
const ANOMALIES_STATEMENT = "SELECT count(*)::int AS n FROM hf_run r " +
|
|
41
41
|
"LEFT JOIN dbos.workflow_status w ON w.workflow_uuid = r.current_workflow_id " +
|
|
42
42
|
"WHERE r.status = 'running' AND w.workflow_uuid IS NULL";
|
|
43
|
+
const LLM_MODES = ["live", "fixtures"];
|
|
43
44
|
const RUN_STATUSES = ["running", "waiting", "paused", "done", "failed"];
|
|
44
45
|
/** What `GET /api/status` answers with, and what `hf doctor` reads. */
|
|
45
46
|
export async function appStatus(pool, options) {
|
|
@@ -77,6 +78,7 @@ export async function appStatus(pool, options) {
|
|
|
77
78
|
coreVersion: CORE_VERSION,
|
|
78
79
|
paused: state.rows[0]?.paused ?? false,
|
|
79
80
|
pausedBy: state.rows[0]?.paused_by ?? null,
|
|
81
|
+
llm: { mode: llmMode(state.rows[0]?.llm_mode ?? null) },
|
|
80
82
|
runs: Object.fromEntries(RUN_STATUSES.map((status) => [status, runs[status] ?? 0])),
|
|
81
83
|
queues: queues.rows.map((row) => ({
|
|
82
84
|
name: row.name,
|
|
@@ -93,6 +95,10 @@ export async function appStatus(pool, options) {
|
|
|
93
95
|
at: new Date().toISOString(),
|
|
94
96
|
};
|
|
95
97
|
}
|
|
98
|
+
/** A stored mode this core does not know reads as `unknown`, the same as none at all. */
|
|
99
|
+
function llmMode(stored) {
|
|
100
|
+
return LLM_MODES.find((mode) => mode === stored) ?? "unknown";
|
|
101
|
+
}
|
|
96
102
|
async function counts(pool, statement) {
|
|
97
103
|
const { rows } = await pool.query(statement);
|
|
98
104
|
return Object.fromEntries(rows.map((row) => [row.status, row.n]));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperfixation/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "defineApp, registries, resolution, records, activity, tasks, labels, outcomes, and the status endpoint",
|
|
6
6
|
"repository": {
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@dbos-inc/dbos-sdk": "4.27.6",
|
|
32
|
-
"@hyperfixation/db": "0.1.
|
|
33
|
-
"@hyperfixation/workflows": "0.1.
|
|
32
|
+
"@hyperfixation/db": "0.1.1",
|
|
33
|
+
"@hyperfixation/workflows": "0.1.1",
|
|
34
34
|
"pg": "^8.23.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@hyperfixation/eslint-config": "0.1.
|
|
38
|
-
"@hyperfixation/testing": "0.1.
|
|
37
|
+
"@hyperfixation/eslint-config": "0.1.1",
|
|
38
|
+
"@hyperfixation/testing": "0.1.1",
|
|
39
39
|
"@microsoft/api-extractor": "^7.59.1",
|
|
40
40
|
"@types/pg": "^8.23.1",
|
|
41
41
|
"eslint": "^10.10.0",
|