@hasna/skills 0.5.8 → 0.5.9

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.
@@ -211,7 +211,7 @@ export interface RunServiceGovernance {
211
211
  events?: RunEventEmitter;
212
212
  /** Resource envelope this run requests, checked against the org ceilings. */
213
213
  quota?: RunQuota;
214
- /** Estimated cost in cents, reserved before dispatch. */
214
+ /** Estimated integer cents (0..2147483647), reserved before dispatch. */
215
215
  estimatedCents?: number;
216
216
  }
217
217
  /** Current implementation: the store's own atomic transitions, plus the optional admission chain. */
@@ -9,8 +9,10 @@
9
9
  * actual cost is charged (status "charged") or, when nothing was used, the
10
10
  * reservation is released ("released") - the unused half never lingers.
11
11
  *
12
- * All numbers are cents; a ceiling is a finite integer, never an open-ended
13
- * budget.
12
+ * Each reservation or charge uses integer cents from 0 through 2147483647,
13
+ * matching the supported PostgreSQL and SQLite schema. Monthly ceilings and
14
+ * aggregates may exceed that per-row limit but must remain JavaScript-safe
15
+ * nonnegative integers. Invalid amounts throw RangeError before store access.
14
16
  */
15
17
  import type { ApiPrincipal } from "../server/types.js";
16
18
  import { type RunQuota, type SpendCeilings } from "./governance.js";
@@ -19,6 +21,7 @@ export interface SpendAdmissionInput {
19
21
  principal: ApiPrincipal;
20
22
  slug: string;
21
23
  quota?: RunQuota;
24
+ /** Integer cents from 0 through 2147483647; omission estimates zero. */
22
25
  estimatedCents?: number;
23
26
  now?: Date;
24
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/skills",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Skills library for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -40,7 +40,9 @@
40
40
  "docs/skill-standard.md",
41
41
  "schemas/",
42
42
  "LICENSE",
43
- "README.md"
43
+ "README.md",
44
+ "!dist/**/*test-utils.d.ts",
45
+ "!dist/**/*fixtures.d.ts"
44
46
  ],
45
47
  "main": "./dist/index.js",
46
48
  "types": "./dist/index.d.ts",
@@ -1,43 +0,0 @@
1
- export declare const CLI_PATH: string;
2
- export declare const EXPECTED_ALL_SKILL_COUNT: number;
3
- export declare const EXPECTED_BASIC_SKILL_COUNT: 8;
4
- export declare const EXPECTED_POPULATED_CATEGORY_COUNT: number;
5
- export declare const PACKAGE_VERSION: string;
6
- /**
7
- * Retained for the ~36 call sites that already pass it. NEW TESTS DO NOT NEED IT:
8
- * every test file calls useDefaultTestTimeout(), so a subprocess test written
9
- * with no timeout argument is already covered — which is the point, because
10
- * remembering to annotate the next one is exactly what did not happen.
11
- *
12
- * Aliased rather than left at its old 15000 so this constant can never sit BELOW
13
- * the suite default and quietly give the slowest tests in the suite the tightest
14
- * ceiling in it.
15
- */
16
- export declare const SLOW_TEST_TIMEOUT = 30000;
17
- export declare const CLEAN_CLI_HOME: string;
18
- /**
19
- * The one line an opted-in local install is allowed to print on stderr.
20
- *
21
- * Local mode is opt-in only and announces itself (owner ruling 2026-09-04,
22
- * hasna/apps#1720; class-patch order 2026-09-06): with the explicit
23
- * `HASNA_SKILLS_LOCAL=1` opt-in and no API credential or URL, the CLI says
24
- * once, per process, that it is running on this machine. The harness below
25
- * passes the opt-in itself, so the suite's local runs are deliberate ones —
26
- * and "stderr is empty" remains the wrong assertion for a local command. Use
27
- * {@link stderrWithoutLocalNotice}, which strips exactly this line and nothing
28
- * else, so an unexpected warning still fails the test it would have failed
29
- * before.
30
- */
31
- export declare const LOCAL_MODE_NOTICE_MARKER = "skills: local mode";
32
- /** `stderr` with the single local-mode notice line removed. */
33
- export declare function stderrWithoutLocalNotice(stderr: string): string;
34
- export declare function runCli(args: string[], env?: Record<string, string>): Promise<{
35
- stdout: string;
36
- stderr: string;
37
- exitCode: number;
38
- }>;
39
- export declare function runCliInCwd(args: string[], cwd: string, env?: Record<string, string>): Promise<{
40
- stdout: string;
41
- stderr: string;
42
- exitCode: number;
43
- }>;
@@ -1,31 +0,0 @@
1
- import { type GovernanceStore } from "../sdk/governance-store.js";
2
- import type { ApiPrincipal, SkillsProductStore } from "./types.js";
3
- export declare const TEST_DATABASE_URL_ENV = "HASNA_SKILLS_TEST_DATABASE_URL";
4
- export interface SeedApiKey {
5
- token: string;
6
- principal: Partial<ApiPrincipal>;
7
- }
8
- export interface StoreFixture {
9
- store: SkillsProductStore;
10
- /**
11
- * Governance store over the same database as `store`, for surfaces that need
12
- * the append-only lifecycle ledger and ceiling reads (cancellation).
13
- */
14
- governanceStore: GovernanceStore;
15
- /** True when the server must be told it is allowed to run on this store. */
16
- allowEphemeralStore: boolean;
17
- close(): Promise<void>;
18
- }
19
- export interface StoreBackendFixture {
20
- name: string;
21
- create(seed?: SeedApiKey[]): Promise<StoreFixture>;
22
- }
23
- /** Human-readable reasons a backend is absent from the current run. */
24
- export declare function storeBackendNotices(): string[];
25
- /**
26
- * Every backend testable in this environment.
27
- *
28
- * Async because Postgres availability can only be established by connecting; a
29
- * top-level await in the test file keeps that out of the describe bodies.
30
- */
31
- export declare function resolveStoreBackends(): Promise<StoreBackendFixture[]>;