@fabrika/builder 0.8.1 → 0.9.0-cloudflare.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.
Files changed (50) hide show
  1. package/daemon/src/platform-remote.ts +3 -0
  2. package/decisions/technologies/zerops-fabrika-auth.md +1 -1
  3. package/decisions/technologies/zerops-platform.md +4 -3
  4. package/package.json +12 -11
  5. package/types/cli/src/bin.d.ts +3 -0
  6. package/types/cli/src/build-status.d.ts +20 -0
  7. package/types/cli/src/catalog.d.ts +9 -0
  8. package/types/cli/src/commands/advance.d.ts +1 -0
  9. package/types/cli/src/commands/build.d.ts +1 -0
  10. package/types/cli/src/commands/ensure-daemon.d.ts +1 -0
  11. package/types/cli/src/commands/gate.d.ts +1 -0
  12. package/types/cli/src/commands/induce.d.ts +1 -0
  13. package/types/cli/src/commands/init.d.ts +1 -0
  14. package/types/cli/src/commands/next.d.ts +1 -0
  15. package/types/cli/src/commands/platform.d.ts +2 -0
  16. package/types/cli/src/config.d.ts +16 -0
  17. package/types/cli/src/context.d.ts +13 -0
  18. package/types/cli/src/daemon-client.d.ts +36 -0
  19. package/types/cli/src/daemon-lifecycle.d.ts +16 -0
  20. package/types/cli/src/derive.d.ts +17 -0
  21. package/types/cli/src/errors.d.ts +2 -0
  22. package/types/cli/src/index.d.ts +7 -0
  23. package/types/cli/src/induce.d.ts +16 -0
  24. package/types/cli/src/inject-skills.d.ts +23 -0
  25. package/types/cli/src/issues.d.ts +12 -0
  26. package/types/cli/src/layout.d.ts +21 -0
  27. package/types/cli/src/packet.d.ts +32 -0
  28. package/types/cli/src/phase-state.d.ts +6 -0
  29. package/types/cli/src/platform-client.d.ts +24 -0
  30. package/types/cli/src/skeletons.d.ts +11 -0
  31. package/types/daemon/src/admission.d.ts +1 -0
  32. package/types/daemon/src/bin.d.ts +2 -0
  33. package/types/daemon/src/build-stream.d.ts +14 -0
  34. package/types/daemon/src/handlers.d.ts +15 -0
  35. package/types/daemon/src/index.d.ts +23 -0
  36. package/types/daemon/src/paths.d.ts +10 -0
  37. package/types/daemon/src/phases.d.ts +21 -0
  38. package/types/daemon/src/platform-compiler.d.ts +1 -0
  39. package/types/daemon/src/platform-remote.d.ts +279 -0
  40. package/types/daemon/src/platform-routes.d.ts +3 -0
  41. package/types/daemon/src/platform-source.d.ts +7 -0
  42. package/types/daemon/src/platform-storage.d.ts +38 -0
  43. package/types/daemon/src/platform.d.ts +43 -0
  44. package/types/daemon/src/static.d.ts +2 -0
  45. package/types/index.d.ts +2 -0
  46. package/types/shared/index.d.ts +2324 -0
  47. package/types/shared/phases.d.ts +25 -0
  48. package/types/shared/urls.d.ts +4 -0
  49. package/ui/dist/assets/{client.j37h210g.js → client.v5z73zge.js} +26 -26
  50. package/ui/dist/index.html +1 -1
@@ -1,5 +1,6 @@
1
1
  import { createRpcClient, type RpcFetch } from '@fabrika/app'
2
2
  import {
3
+ APP_ENV_KINDS,
3
4
  type AppEnvDto,
4
5
  type ControlRpcContract,
5
6
  type JsonValue,
@@ -46,6 +47,8 @@ const environmentsSchema = z.object({
46
47
  items: z.array(z.object({
47
48
  appId: storedTextSchema,
48
49
  env: storedTextSchema,
50
+ // A Control older than the field has standard environments only.
51
+ kind: z.enum(APP_ENV_KINDS).default('standard'),
49
52
  domain: storedTextSchema.nullable(),
50
53
  publicOrigin: storedTextSchema.nullable(),
51
54
  // A Control older than the field lists none.
@@ -7,7 +7,7 @@ provides: [authentication, authorization, proxy-enforcement]
7
7
  requires: [zerops-platform]
8
8
  recommends: []
9
9
  conflicts: [propustka, cloudflare-access, auth-password-kv]
10
- npm: ["@fabrika/app@0.8.1", "@fabrika/db@0.8.1", "zod@^3.25.76"]
10
+ npm: ["@fabrika/app@0.9.0-cloudflare.1", "@fabrika/db@0.9.0-cloudflare.1", "zod@^3.25.76"]
11
11
  status: wip
12
12
  sources:
13
13
  - where: "packages/app/skill/SKILL.md in fabrika-platform (the `fabrika-app` skill)"
@@ -7,7 +7,7 @@ provides: [platform, private-services, managed-deploy]
7
7
  requires: [bun, postgres]
8
8
  recommends: []
9
9
  conflicts: [cloudflare]
10
- npm: ["@fabrika/provider-zerops@0.8.1", "@fabrika/app@0.8.1", "@fabrika/cli@0.8.1"]
10
+ npm: ["@fabrika/provider-zerops@0.9.0-cloudflare.1", "@fabrika/app@0.9.0-cloudflare.1", "@fabrika/cli@0.9.0-cloudflare.1"]
11
11
  status: wip
12
12
  sources:
13
13
  - where: "examples/zerops-app/fabrika.config.ts + zerops.yaml in fabrika-platform"
@@ -43,12 +43,13 @@ truth: stable `id`, `schema`, `pipeline` and `target` with `platform: 'zerops'`.
43
43
  `zerops.yaml` keeps only `setup`, `build.base`, `build.os` and the SPA's
44
44
  `build.buildCommands`; every other key is refused. The platform generates the
45
45
  rest: a frozen install, the application's `bun test`, a reinstall, the
46
- generated entrypoint, `fabrika-check`, `tsc`, the deploy gate on the contract's
46
+ generated entrypoint, `tsc` (with `web/`), `fabrika-check`, the deploy gate on the contract's
47
47
  health path, and the `run` section. Its init commands run `fabrika db migrate`,
48
48
  `fabrika db codegen --verify` and `fabrika db test-isolation`, then its
49
49
  start script runs `fabrika/entry.generated.ts`; each `c.cron` job becomes a crontab entry
50
50
  `fabrika job run <name>`. The build has no database, so the database tests skip
51
- there and run at container start.
51
+ there; only the generated isolation tests run again, at container start. Run
52
+ the rest against a test database before you push.
52
53
  - Commit the Bun lockfile at the app repository root, and commit what
53
54
  `fabrika db codegen` and `fabrika db test-scaffold` write. Never edit a
54
55
  generated file (`fabrika/entry.generated.ts`, `src/db/schema.generated.ts`, the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/builder",
3
- "version": "0.8.1",
3
+ "version": "0.9.0-cloudflare.1",
4
4
  "type": "module",
5
5
  "description": "Local-first guided application design and agent-assisted implementation.",
6
6
  "license": "MIT",
@@ -25,17 +25,18 @@
25
25
  "stacks",
26
26
  "README.md",
27
27
  "BUILD-CONTRACT.md",
28
- "LICENSE"
28
+ "LICENSE",
29
+ "types"
29
30
  ],
30
31
  "exports": {
31
32
  ".": {
32
33
  "bun": "./index.ts",
33
- "types": "./index.ts",
34
+ "types": "./types/index.d.ts",
34
35
  "default": "./index.ts"
35
36
  },
36
37
  "./daemon": {
37
38
  "bun": "./daemon/src/index.ts",
38
- "types": "./daemon/src/index.ts",
39
+ "types": "./types/daemon/src/index.d.ts",
39
40
  "default": "./daemon/src/index.ts"
40
41
  }
41
42
  },
@@ -47,13 +48,13 @@
47
48
  },
48
49
  "dependencies": {
49
50
  "zod": "^3.25.76",
50
- "@fabrika/annotations": "0.8.1",
51
- "@fabrika/app": "0.8.1",
52
- "@fabrika/auth-core": "0.8.1",
53
- "@fabrika/canvas-kernel": "0.8.1",
54
- "@fabrika/control-contract": "0.8.1",
55
- "@fabrika/daemon-kit": "0.8.1",
56
- "@fabrika/provider-zerops": "0.8.1",
51
+ "@fabrika/annotations": "0.9.0-cloudflare.1",
52
+ "@fabrika/app": "0.9.0-cloudflare.1",
53
+ "@fabrika/auth-core": "0.9.0-cloudflare.1",
54
+ "@fabrika/canvas-kernel": "0.9.0-cloudflare.1",
55
+ "@fabrika/control-contract": "0.9.0-cloudflare.1",
56
+ "@fabrika/daemon-kit": "0.9.0-cloudflare.1",
57
+ "@fabrika/provider-zerops": "0.9.0-cloudflare.1",
57
58
  "preact": "^10.25.0"
58
59
  }
59
60
  }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export declare const BUILDER_USAGE = "fabrika builder \u2014 guided application builder\n\nUsage:\n fabrika builder init [dir] [--profile <stack>] [--agent all|claude|codex]\n [--session=<id>] [--no-open] [--no-daemon] [--json]\n Scaffold .fabrika/, install agent support, open dashboard\n fabrika builder next [--json] Print the task packet for the current derived phase\n fabrika builder init [dir] --url=<origin> [--no-open] Initialize zerops-app and begin human consent\n [--no-daemon] Offline init only; incompatible with --url\n fabrika builder connect --url=<origin> [--no-open] [--json]\n fabrika builder status [--json] Read connection and deployment status\n fabrika builder disconnect [--json] Remove local custody; revoke separately in console\n fabrika builder deploy [--wait] [--timeout=<seconds>] [--json]\n fabrika builder preview --url=<url> | --clear [--json]\n Platform commands also accept --dir=<project>\n Results are sanitized JSON; wait defaults to 600 seconds\n --no-open returns the local dashboard URL, never approval proof\n All commands accept --help and never prompt for input\n fabrika builder advance [--force] Validate outputs and gate, then print the next phase\n fabrika builder gate open <name> --view <f.jsx> Push a canvas gate and open the dashboard\n fabrika builder gate wait [--gate <n>] [--timeout] Wait for submitted gate feedback\n fabrika builder ensure-daemon Start the daemon if it is not running\n fabrika builder induce [--force] Derive issues from opice skeleton metadata\n fabrika builder build [--issue <ID>] [--assisted] Run the assisted per-issue build driver\n\nEnvironment:\n FABRIKA_PORT Daemon port (default 19410)\n FABRIKA_SESSION_ID Session id (fallback: stable hash of repo abs path)\n FABRIKA_DATA_DIR Persistent daemon/session data (default ~/.fabrika)\n FABRIKA_TIMEOUT gate wait timeout in ms (default 3600000)";
3
+ export declare function runBuilderCli(argv: readonly string[]): Promise<number>;
@@ -0,0 +1,20 @@
1
+ import type { Issue } from './issues';
2
+ export type IssueStatus = 'done' | 'blocked';
3
+ export interface BuildRecord {
4
+ status: IssueStatus;
5
+ reason?: string;
6
+ at: string;
7
+ }
8
+ export type BuildBoard = Record<string, BuildRecord>;
9
+ export declare function readBoard(fabrikaDir: string): BuildBoard;
10
+ export declare function writeBoard(fabrikaDir: string, board: BuildBoard): void;
11
+ export declare function record(fabrikaDir: string, id: string, status: IssueStatus, reason: string | undefined, at: string): BuildBoard;
12
+ export interface BuildPlan {
13
+ done: Issue[];
14
+ blocked: Issue[];
15
+ ready: Issue[];
16
+ waiting: Issue[];
17
+ next: Issue | null;
18
+ complete: boolean;
19
+ }
20
+ export declare function planBuild(issues: Issue[], board: BuildBoard): BuildPlan;
@@ -0,0 +1,9 @@
1
+ export declare function resolveCatalogRoot(): string | null;
2
+ export interface StackPointer {
3
+ profile: string;
4
+ root: string;
5
+ stackFile: string;
6
+ stackFileExists: boolean;
7
+ decisionsDir: string;
8
+ }
9
+ export declare function resolveStackPointer(profile: string): StackPointer | null;
@@ -0,0 +1 @@
1
+ export declare function cmdAdvance(argv: string[]): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function cmdBuild(argv: string[]): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function cmdEnsureDaemon(_argv: string[]): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function cmdGate(argv: string[]): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function cmdInduce(argv: string[]): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function cmdInit(argv: string[]): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function cmdNext(argv: string[]): Promise<number>;
@@ -0,0 +1,2 @@
1
+ export type PlatformCommand = 'connect' | 'status' | 'disconnect' | 'deploy' | 'preview';
2
+ export declare function cmdPlatform(command: PlatformCommand, argv: string[]): Promise<number>;
@@ -0,0 +1,16 @@
1
+ export declare const DAEMON_PORT: number;
2
+ export declare const BASE_URL: string;
3
+ export declare const WS_URL: string;
4
+ export declare const TIMEOUT_MS: number;
5
+ export declare const NEUTRAL_DATA_DIR: string;
6
+ export declare const DATA_DIR: string;
7
+ export declare const SESSIONS_DIR: string;
8
+ export declare const TEMP_DIR: string;
9
+ export declare const PID_FILE: string;
10
+ export declare const FABRIKA_DIRNAME = ".fabrika";
11
+ export declare function resolveDataDir(opts?: {
12
+ home?: string;
13
+ explicit?: string;
14
+ }): string;
15
+ export declare function getSessionId(explicit?: string, recorded?: string, repoRoot?: string): string;
16
+ export declare function hashRepoPath(repoRoot: string): string;
@@ -0,0 +1,13 @@
1
+ import type { BuilderProjectConnection } from '../../shared';
2
+ export interface CommandContext {
3
+ repoRoot: string;
4
+ fabrikaDir: string;
5
+ sessionId: string;
6
+ profile: string;
7
+ initialized: boolean;
8
+ connection?: BuilderProjectConnection;
9
+ }
10
+ export declare function resolveContext(opts?: {
11
+ dir?: string;
12
+ session?: string;
13
+ }): CommandContext;
@@ -0,0 +1,36 @@
1
+ import type { PhaseState } from './derive';
2
+ export declare function fetchPhase(fabrikaDir: string, sessionId?: string): Promise<PhaseState | null>;
3
+ export interface PlanResult {
4
+ ok: boolean;
5
+ browserUrl?: string;
6
+ revision?: number;
7
+ isNew?: boolean;
8
+ canvasFiles?: string[];
9
+ gate?: string;
10
+ error?: string;
11
+ errors?: Record<string, string>;
12
+ }
13
+ export type PlanSource = {
14
+ view: string;
15
+ directory?: never;
16
+ } | {
17
+ directory: string;
18
+ view?: never;
19
+ };
20
+ export declare function pushPlan(sessionId: string, body: PlanSource & {
21
+ projectRoot: string;
22
+ label?: string;
23
+ gate?: string;
24
+ }): Promise<PlanResult & {
25
+ reachable: boolean;
26
+ }>;
27
+ export declare function peekFeedback(sessionId: string): Promise<string | null>;
28
+ export declare function consumeFeedback(sessionId: string): Promise<string | null>;
29
+ export interface BuildEvent {
30
+ issue?: string;
31
+ status: string;
32
+ message?: string;
33
+ ts?: number;
34
+ }
35
+ export declare function postBuildEvent(event: BuildEvent): Promise<boolean>;
36
+ export declare function waitForFeedback(sessionId: string, timeoutMs?: number): Promise<string>;
@@ -0,0 +1,16 @@
1
+ import { type DaemonLifecycleConfig } from '@fabrika/daemon-kit';
2
+ import type { z } from 'zod';
3
+ import { healthInfoSchema } from '../../shared';
4
+ export type DaemonHealthInfo = z.output<typeof healthInfoSchema> & {
5
+ pid: number;
6
+ };
7
+ export declare function healthMatchesDataRoot(info: {
8
+ sessionsDir: string;
9
+ }, expectedSessionsDir?: string): boolean;
10
+ export declare const daemonLifecycleConfig: DaemonLifecycleConfig<DaemonHealthInfo>;
11
+ export declare const daemon: import("@fabrika/daemon-kit").DaemonLifecycle<DaemonHealthInfo>;
12
+ export declare function ensureDaemon(opts?: {
13
+ quiet?: boolean;
14
+ }): Promise<boolean>;
15
+ export declare function isDaemonRunning(): Promise<boolean>;
16
+ export declare function openBrowser(url: string, fallbackUrl?: string): void;
@@ -0,0 +1,17 @@
1
+ import { type Phase, type PhaseId } from '../../shared/phases';
2
+ export interface PhaseState {
3
+ current: PhaseId;
4
+ index: number;
5
+ completed: PhaseId[];
6
+ reads: string[];
7
+ produces: string[];
8
+ gate: boolean;
9
+ satisfied: boolean;
10
+ }
11
+ export type GateProbe = (phase: Phase) => boolean;
12
+ export declare const offlineGateProbe: GateProbe;
13
+ export declare function matchGlob(repoRoot: string, glob: string): string[];
14
+ export declare function isNonEmptyFile(p: string): boolean;
15
+ export declare function producesSatisfied(repoRoot: string, phase: Phase): boolean;
16
+ export declare function resolveReads(repoRoot: string, phase: Phase): string[];
17
+ export declare function derivePhase(repoRoot: string, gateProbe?: GateProbe): PhaseState;
@@ -0,0 +1,2 @@
1
+ export declare class BuilderCliError extends Error {
2
+ }
@@ -0,0 +1,7 @@
1
+ export { type Phase, PHASE_COUNT, PHASE_IDS, phaseById, type PhaseId, phaseIndex, PHASES } from '../../shared/phases';
2
+ export { resolveCatalogRoot, resolveStackPointer, type StackPointer } from './catalog';
3
+ export { BASE_URL, DAEMON_PORT, DATA_DIR, FABRIKA_DIRNAME, getSessionId, hashRepoPath, NEUTRAL_DATA_DIR, resolveDataDir, TEMP_DIR, WS_URL, } from './config';
4
+ export { derivePhase, type GateProbe, isNonEmptyFile, matchGlob, offlineGateProbe, type PhaseState, producesSatisfied, resolveReads } from './derive';
5
+ export { type AgentHost, injectAgentSupport, type InjectOptions, type InjectResult, injectSkills, parseAgentHosts, resolveSkillSource, } from './inject-skills';
6
+ export { configPath, EXTERNAL_DIRS, type FabrikaConfig, fabrikaDir, findRepoRoot, type InitResult, isInitialized, LAYER_DIRS, readConfig, scaffold, } from './layout';
7
+ export { type PacketJson, packetJson, type RenderOpts, renderPacket } from './packet';
@@ -0,0 +1,16 @@
1
+ import type { StackPointer } from './catalog';
2
+ import type { Skeleton } from './skeletons';
3
+ export interface InducedIssue {
4
+ id: string;
5
+ goal: string;
6
+ satisfies: string[];
7
+ dependsOn: string[];
8
+ touches: string[];
9
+ body: string;
10
+ kind: 'foundation' | 'feature';
11
+ }
12
+ export interface InduceOpts {
13
+ stack?: StackPointer;
14
+ }
15
+ export declare function induceIssues(skeletons: Skeleton[], opts?: InduceOpts): InducedIssue[];
16
+ export declare function renderIssue(issue: InducedIssue): string;
@@ -0,0 +1,23 @@
1
+ export type AgentHost = 'claude' | 'codex';
2
+ export interface InjectOptions {
3
+ hosts?: AgentHost[];
4
+ }
5
+ /** Where the installed `fabrika-app` skill came from: the application's own `@fabrika/app`, or the builder's. */
6
+ export interface AppSkillSource {
7
+ from: 'application' | 'builder';
8
+ version: string;
9
+ }
10
+ export interface InjectResult {
11
+ sourceDir: string | null;
12
+ hosts: AgentHost[];
13
+ appSkill: AppSkillSource | null;
14
+ written: string[];
15
+ updated: string[];
16
+ skipped: string[];
17
+ preserved: string[];
18
+ }
19
+ export declare function resolveSkillSource(): string | null;
20
+ export declare function parseAgentHosts(value?: string): AgentHost[];
21
+ export declare function injectAgentSupport(repoRoot: string, opts?: InjectOptions): InjectResult;
22
+ export declare function injectSkills(repoRoot: string): InjectResult;
23
+ export declare function manifestRelativePath(repoRoot: string): string;
@@ -0,0 +1,12 @@
1
+ export interface Issue {
2
+ id: string;
3
+ path: string;
4
+ goal: string;
5
+ satisfies: string[];
6
+ dependsOn: string[];
7
+ touches: string[];
8
+ body: string;
9
+ }
10
+ export declare function readIssues(fabrikaDir: string): Issue[];
11
+ export declare function parseIssue(path: string): Issue;
12
+ export declare function isReady(issue: Issue, knownIds: Set<string>): boolean;
@@ -0,0 +1,21 @@
1
+ import { type BuilderProjectConfig } from '../../shared';
2
+ export declare const LAYER_DIRS: string[];
3
+ export declare const EXTERNAL_DIRS: string[];
4
+ export type FabrikaConfig = BuilderProjectConfig;
5
+ export declare function fabrikaDir(repoRoot: string): string;
6
+ export declare function configPath(repoRoot: string): string;
7
+ export declare function isInitialized(repoRoot: string): boolean;
8
+ export declare function readConfig(repoRoot: string): FabrikaConfig | null;
9
+ export interface InitResult {
10
+ repoRoot: string;
11
+ fabrikaDir: string;
12
+ config: FabrikaConfig;
13
+ createdDirs: string[];
14
+ createdConfig: boolean;
15
+ alreadyInitialized: boolean;
16
+ }
17
+ export declare function scaffold(repoRoot: string, opts?: {
18
+ profile?: string;
19
+ sessionId?: string;
20
+ }): InitResult;
21
+ export declare function findRepoRoot(start?: string): string | null;
@@ -0,0 +1,32 @@
1
+ import type { BuilderProjectConnection } from '../../shared';
2
+ import { type PhaseId } from '../../shared/phases';
3
+ import { type StackPointer } from './catalog';
4
+ import type { PhaseState } from './derive';
5
+ export interface RenderOpts {
6
+ profile?: string;
7
+ connection?: BuilderProjectConnection;
8
+ }
9
+ export declare function renderPacket(state: PhaseState, opts?: RenderOpts): string;
10
+ export interface PacketJson {
11
+ phase: PhaseId;
12
+ index: number;
13
+ number: number;
14
+ title: string;
15
+ reads: string[];
16
+ produces: string[];
17
+ gate: boolean;
18
+ gateView: string | null;
19
+ skills: string[];
20
+ completed: PhaseId[];
21
+ satisfied: boolean;
22
+ stack: StackPointer | null;
23
+ platform: ReturnType<typeof connectionContext> | null;
24
+ }
25
+ export declare function packetJson(state: PhaseState, opts?: RenderOpts): PacketJson;
26
+ declare function connectionContext(connection: BuilderProjectConnection): {
27
+ controlOrigin: string;
28
+ provider: string;
29
+ app: import("@fabrika/control-contract").AppDto;
30
+ environment: import("@fabrika/control-contract").BuilderConnectionEnvironmentDto;
31
+ };
32
+ export {};
@@ -0,0 +1,6 @@
1
+ import { type PhaseState } from './derive';
2
+ export interface ResolvedPhase {
3
+ state: PhaseState;
4
+ source: 'daemon' | 'offline';
5
+ }
6
+ export declare function resolvePhaseState(repoRoot: string, fabrikaDir: string, sessionId?: string): Promise<ResolvedPhase>;
@@ -0,0 +1,24 @@
1
+ import { type BuilderPlatformStatus, builderProjectPath } from '../../shared';
2
+ export declare function platformRequest(sessionId: string, suffix: Parameters<typeof builderProjectPath>[1], body?: object, timeoutMs?: number): Promise<BuilderPlatformStatus>;
3
+ export declare function publicPlatformStatus(status: BuilderPlatformStatus): {
4
+ pairing: {
5
+ expiresAt?: number | undefined;
6
+ status: "cancelled" | "expired" | "pending" | "approved" | "failed" | "connected" | "recovery_required";
7
+ } | null;
8
+ deployment: {
9
+ message: null;
10
+ status: "preparing" | "pending" | "running" | "awaiting_approval" | "succeeded" | "failed" | "cancelled";
11
+ runId: string | null;
12
+ commitSha: string | null;
13
+ appUrl: string | null;
14
+ consoleUrl: string | null;
15
+ } | null;
16
+ sessionId: string;
17
+ projectRoot: string;
18
+ connection: import("../../shared").BuilderProjectConnection | null;
19
+ credential: {
20
+ available: boolean;
21
+ expiresAt: number | null;
22
+ };
23
+ previewUrl: string | null;
24
+ };
@@ -0,0 +1,11 @@
1
+ export interface Skeleton {
2
+ file: string;
3
+ name: string;
4
+ url?: string;
5
+ seeds: string[];
6
+ roles: string[];
7
+ feature?: string;
8
+ invariants: string[];
9
+ }
10
+ export declare function readSkeletons(testsBrowserDir: string): Skeleton[];
11
+ export declare function parseSkeletons(file: string): Skeleton[];
@@ -0,0 +1 @@
1
+ export declare function admitRequest(req: Request, url: URL, port: number): Response | null;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};
@@ -0,0 +1,14 @@
1
+ export interface BuildEvent {
2
+ issue?: string;
3
+ status: 'queued' | 'running' | 'passed' | 'failed' | 'blocked' | 'info';
4
+ message?: string;
5
+ at?: string;
6
+ data?: Record<string, unknown>;
7
+ }
8
+ export declare class BuildStream {
9
+ private events;
10
+ private subscribers;
11
+ append(ev: BuildEvent): BuildEvent;
12
+ history(): BuildEvent[];
13
+ subscribe(fn: (ev: BuildEvent) => void): () => void;
14
+ }
@@ -0,0 +1,15 @@
1
+ import { type SessionManager } from '@fabrika/canvas-kernel/server';
2
+ import { type Route } from '@fabrika/daemon-kit';
3
+ import type { BuildStream } from './build-stream';
4
+ import { BuilderPlatform } from './platform';
5
+ export interface HandlerContext {
6
+ sessionManager: SessionManager;
7
+ broadcastPlanUpdate: (id: string) => void;
8
+ broadcastRevisionUpdate: (id: string) => void;
9
+ buildStream: BuildStream;
10
+ sessionsDir: string;
11
+ port: number;
12
+ version: string;
13
+ platform?: BuilderPlatform;
14
+ }
15
+ export declare function createHandlers(ctx: HandlerContext): Route[];
@@ -0,0 +1,23 @@
1
+ import { SessionManager, type WSData } from '@fabrika/canvas-kernel/server';
2
+ import { type BuilderPlatformOptions } from './platform';
3
+ export { type Phase, type PhaseId, PHASES } from '../../shared/phases';
4
+ export type { BuildEvent } from './build-stream';
5
+ export { derivePhaseState, type PhaseState } from './phases';
6
+ export interface GateRecord {
7
+ name: string;
8
+ revision: number;
9
+ hasFeedback: boolean;
10
+ consumed: boolean;
11
+ }
12
+ export interface StartDaemonOptions {
13
+ port?: number;
14
+ sessionsDir?: string;
15
+ platform?: BuilderPlatformOptions;
16
+ }
17
+ export interface RunningDaemon {
18
+ server: import('bun').Server<WSData>;
19
+ port: number;
20
+ sessionManager: SessionManager;
21
+ stop(): void;
22
+ }
23
+ export declare function startDaemon(opts?: StartDaemonOptions): RunningDaemon;
@@ -0,0 +1,10 @@
1
+ export declare const NEUTRAL_DATA_DIR: string;
2
+ export declare function resolveDataDir(argv?: readonly string[], env?: NodeJS.ProcessEnv): string;
3
+ export declare const paths: import("@fabrika/canvas-kernel/server").CanvasPaths;
4
+ export declare const DATA_DIR: string;
5
+ export declare const SESSIONS_DIR: string;
6
+ export declare const TEMP_DIR: string;
7
+ export declare const PID_FILE: string;
8
+ export declare const COMPILE_TEMP_DIR: string;
9
+ export declare const UPLOADS_DIR: string;
10
+ export declare const DEFAULT_PORT: number;
@@ -0,0 +1,21 @@
1
+ import { type Phase, type PhaseId } from '../../shared/phases';
2
+ export interface PhaseState {
3
+ current: PhaseId;
4
+ index: number;
5
+ completed: PhaseId[];
6
+ reads: string[];
7
+ produces: string[];
8
+ gate: boolean;
9
+ gateName?: string;
10
+ satisfied: boolean;
11
+ }
12
+ export interface GateOracle {
13
+ getLatestUnconsumedFeedback(sessionId: string): {
14
+ revision: number;
15
+ feedback: string;
16
+ } | null;
17
+ hasGateRevision?(sessionId: string, gateName: string): boolean;
18
+ }
19
+ export declare function producesSatisfied(phase: Phase, repoRoot: string): boolean;
20
+ export declare function gateSatisfied(phase: Phase, sessionId: string, oracle?: GateOracle): boolean;
21
+ export declare function derivePhaseState(fabrikaDir: string, sessionId?: string, oracle?: GateOracle): PhaseState;
@@ -0,0 +1 @@
1
+ export {};