@interf/compiler 0.22.0 → 0.33.0
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/README.md +268 -0
- package/dist/bin-mcp.d.ts +2 -0
- package/dist/bin-mcp.js +63 -0
- package/dist/bin-runtime.d.ts +2 -0
- package/dist/bin-runtime.js +111 -0
- package/dist/cli/commands/agents.js +4 -4
- package/dist/cli/commands/auth.d.ts +20 -0
- package/dist/cli/commands/auth.js +161 -0
- package/dist/cli/commands/benchmark.d.ts +10 -0
- package/dist/cli/commands/benchmark.js +88 -0
- package/dist/cli/commands/build-plan.js +95 -103
- package/dist/cli/commands/build.d.ts +1 -1
- package/dist/cli/commands/build.js +16 -15
- package/dist/cli/commands/doctor.js +3 -3
- package/dist/cli/commands/graphs.d.ts +2 -0
- package/dist/cli/commands/graphs.js +199 -0
- package/dist/cli/commands/login.js +4 -6
- package/dist/cli/commands/logout.js +1 -1
- package/dist/cli/commands/mcp.d.ts +3 -2
- package/dist/cli/commands/mcp.js +721 -204
- package/dist/cli/commands/project.d.ts +2 -0
- package/dist/cli/commands/project.js +202 -0
- package/dist/cli/commands/reset.d.ts +1 -1
- package/dist/cli/commands/reset.js +10 -10
- package/dist/cli/commands/runs.js +52 -26
- package/dist/cli/commands/runtime.d.ts +24 -0
- package/dist/cli/commands/runtime.js +373 -0
- package/dist/cli/commands/status.d.ts +1 -0
- package/dist/cli/commands/status.js +33 -22
- package/dist/cli/commands/traces.d.ts +2 -0
- package/dist/cli/commands/traces.js +125 -0
- package/dist/cli/commands/wizard.js +155 -150
- package/dist/cli/index.d.ts +7 -4
- package/dist/cli/index.js +13 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/packages/build-plans/authoring/brief.d.ts +517 -0
- package/dist/packages/build-plans/authoring/brief.js +89 -0
- package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +10 -10
- package/dist/packages/build-plans/authoring/build-plan-authoring.js +66 -26
- package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +1 -1
- package/dist/packages/build-plans/authoring/build-plan-edit-session.js +8 -2
- package/dist/packages/build-plans/authoring/build-plan-improvement.d.ts +9 -6
- package/dist/packages/build-plans/authoring/build-plan-improvement.js +39 -42
- package/dist/packages/build-plans/authoring/lib/build-plan-edit-utils.js +7 -7
- package/dist/packages/build-plans/build-plan-resolution.d.ts +1 -1
- package/dist/packages/build-plans/build-plan-resolution.js +3 -3
- package/dist/packages/build-plans/index.d.ts +1 -1
- package/dist/packages/build-plans/index.js +1 -1
- package/dist/packages/build-plans/package/build-plan-definitions.d.ts +14 -12
- package/dist/packages/build-plans/package/build-plan-definitions.js +40 -39
- package/dist/packages/build-plans/package/build-plan-helpers.d.ts +3 -2
- package/dist/packages/build-plans/package/build-plan-helpers.js +27 -13
- package/dist/packages/build-plans/package/build-plan-review-paths.d.ts +5 -5
- package/dist/packages/build-plans/package/build-plan-review-paths.js +15 -15
- package/dist/packages/build-plans/package/build-plan-stage-runner.d.ts +4 -4
- package/dist/packages/build-plans/package/build-plan-stage-runner.js +22 -11
- package/dist/packages/build-plans/package/builtin-build-plan.d.ts +5 -6
- package/dist/packages/build-plans/package/builtin-build-plan.js +7 -8
- package/dist/packages/build-plans/package/context-interface.d.ts +11 -9
- package/dist/packages/build-plans/package/context-interface.js +14 -33
- package/dist/packages/build-plans/package/interf-build-plan-package.d.ts +6 -17
- package/dist/packages/build-plans/package/interf-build-plan-package.js +56 -52
- package/dist/packages/build-plans/package/local-build-plans.d.ts +12 -10
- package/dist/packages/build-plans/package/local-build-plans.js +56 -31
- package/dist/packages/build-plans/package/user-build-plans.js +1 -1
- package/dist/packages/contracts/index.d.ts +4 -2
- package/dist/packages/contracts/index.js +2 -1
- package/dist/packages/contracts/lib/project-paths.d.ts +137 -0
- package/dist/packages/contracts/lib/project-paths.js +211 -0
- package/dist/packages/contracts/lib/project-schema.d.ts +160 -0
- package/dist/packages/contracts/lib/project-schema.js +113 -0
- package/dist/packages/contracts/lib/schema.d.ts +739 -80
- package/dist/packages/contracts/lib/schema.js +410 -75
- package/dist/packages/contracts/utils/parse.js +67 -0
- package/dist/packages/projects/index.d.ts +6 -0
- package/dist/packages/{project → projects}/index.js +0 -3
- package/dist/packages/{project → projects}/interf-detect.d.ts +12 -12
- package/dist/packages/{project → projects}/interf-detect.js +56 -50
- package/dist/packages/projects/interf.d.ts +2 -0
- package/dist/packages/projects/interf.js +1 -0
- package/dist/packages/projects/lib/schema.d.ts +79 -0
- package/dist/packages/projects/lib/schema.js +89 -0
- package/dist/packages/projects/source-config.d.ts +58 -0
- package/dist/packages/projects/source-config.js +352 -0
- package/dist/packages/projects/source-folders.d.ts +11 -0
- package/dist/packages/{project → projects}/source-folders.js +26 -26
- package/dist/packages/{engine → runtime}/action-planner.d.ts +1 -1
- package/dist/packages/{engine → runtime}/action-planner.js +20 -22
- package/dist/packages/runtime/action-values.d.ts +1 -0
- package/dist/packages/runtime/action-values.js +1 -0
- package/dist/packages/runtime/actions/errors.d.ts +2 -0
- package/dist/packages/runtime/actions/errors.js +12 -0
- package/dist/packages/runtime/actions/fields.d.ts +82 -0
- package/dist/packages/runtime/actions/form-builders.d.ts +14 -0
- package/dist/packages/runtime/actions/form-builders.js +619 -0
- package/dist/packages/runtime/actions/form-validators.d.ts +8 -0
- package/dist/packages/runtime/actions/form-validators.js +128 -0
- package/dist/packages/runtime/actions/helpers.d.ts +11 -0
- package/dist/packages/runtime/actions/helpers.js +80 -0
- package/dist/packages/runtime/actions/index.d.ts +8 -0
- package/dist/packages/runtime/actions/index.js +11 -0
- package/dist/packages/runtime/actions/registry.d.ts +64 -0
- package/dist/packages/runtime/actions/registry.js +62 -0
- package/dist/packages/runtime/actions/requests.d.ts +45 -0
- package/dist/packages/runtime/actions/requests.js +158 -0
- package/dist/packages/runtime/actions/schemas.d.ts +154 -0
- package/dist/packages/runtime/actions/schemas.js +36 -0
- package/dist/packages/runtime/agent-handoff.d.ts +11 -0
- package/dist/packages/runtime/agent-handoff.js +101 -0
- package/dist/packages/{engine → runtime}/agents/index.d.ts +1 -2
- package/dist/packages/{engine → runtime}/agents/index.js +1 -2
- package/dist/packages/runtime/agents/lib/args.d.ts +14 -0
- package/dist/packages/runtime/agents/lib/args.js +24 -0
- package/dist/packages/{engine → runtime}/agents/lib/constants.d.ts +4 -1
- package/dist/packages/runtime/agents/lib/constants.js +13 -0
- package/dist/packages/runtime/agents/lib/context-graph-bootstrap.d.ts +3 -0
- package/dist/packages/{engine/agents/lib/verifiable-context-bootstrap.js → runtime/agents/lib/context-graph-bootstrap.js} +5 -6
- package/dist/packages/{engine → runtime}/agents/lib/detection.d.ts +5 -0
- package/dist/packages/{engine → runtime}/agents/lib/detection.js +16 -7
- package/dist/packages/{engine → runtime}/agents/lib/execution-profile.js +8 -14
- package/dist/packages/{engine → runtime}/agents/lib/execution.js +14 -4
- package/dist/packages/{engine → runtime}/agents/lib/preflight.js +15 -13
- package/dist/packages/{engine → runtime}/agents/lib/render.js +4 -4
- package/dist/packages/runtime/agents/lib/shell-fs.d.ts +18 -0
- package/dist/packages/runtime/agents/lib/shell-fs.js +190 -0
- package/dist/packages/runtime/agents/lib/shell-paths.d.ts +16 -0
- package/dist/packages/runtime/agents/lib/shell-paths.js +63 -0
- package/dist/packages/runtime/agents/lib/shell-projection.d.ts +25 -0
- package/dist/packages/runtime/agents/lib/shell-projection.js +314 -0
- package/dist/packages/runtime/agents/lib/shell-templates.d.ts +30 -0
- package/dist/packages/runtime/agents/lib/shell-templates.js +452 -0
- package/dist/packages/runtime/agents/lib/shell-workspace.d.ts +17 -0
- package/dist/packages/runtime/agents/lib/shell-workspace.js +70 -0
- package/dist/packages/runtime/agents/lib/shells.d.ts +63 -0
- package/dist/packages/runtime/agents/lib/shells.js +383 -0
- package/dist/packages/{engine → runtime}/agents/lib/user-config.d.ts +8 -2
- package/dist/packages/{engine → runtime}/agents/lib/user-config.js +8 -2
- package/dist/packages/runtime/agents/providers/claude-code.d.ts +13 -0
- package/dist/packages/runtime/agents/providers/claude-code.js +45 -0
- package/dist/packages/runtime/agents/providers/codex.d.ts +17 -0
- package/dist/packages/runtime/agents/providers/codex.js +64 -0
- package/dist/packages/runtime/agents/providers/cursor.d.ts +9 -0
- package/dist/packages/runtime/agents/providers/cursor.js +24 -0
- package/dist/packages/runtime/agents/providers/index.d.ts +9 -0
- package/dist/packages/runtime/agents/providers/index.js +31 -0
- package/dist/packages/runtime/agents/providers/types.d.ts +50 -0
- package/dist/packages/{engine → runtime}/agents/registry.d.ts +13 -2
- package/dist/packages/{engine → runtime}/agents/registry.js +48 -10
- package/dist/packages/{engine → runtime}/agents/role-executors.d.ts +1 -1
- package/dist/packages/{engine → runtime}/agents/role-executors.js +7 -6
- package/dist/packages/{engine → runtime}/agents/role-router.js +7 -5
- package/dist/packages/runtime/auth/account-context.d.ts +52 -0
- package/dist/packages/runtime/auth/account-context.js +68 -0
- package/dist/packages/runtime/auth/auth-flow.d.ts +73 -0
- package/dist/packages/runtime/auth/auth-flow.js +189 -0
- package/dist/packages/runtime/auth/jwt-validator.d.ts +58 -0
- package/dist/packages/runtime/auth/jwt-validator.js +86 -0
- package/dist/packages/runtime/auth/keychain.d.ts +35 -0
- package/dist/packages/runtime/auth/keychain.js +85 -0
- package/dist/packages/runtime/auth/session-store.d.ts +38 -0
- package/dist/packages/runtime/auth/session-store.js +88 -0
- package/dist/packages/runtime/auth/workos-client.d.ts +58 -0
- package/dist/packages/runtime/auth/workos-client.js +87 -0
- package/dist/packages/runtime/benchmark-question-draft.d.ts +20 -0
- package/dist/packages/runtime/benchmark-question-draft.js +124 -0
- package/dist/packages/runtime/build/artifact-counts.d.ts +1 -0
- package/dist/packages/{engine → runtime}/build/artifact-counts.js +5 -9
- package/dist/packages/{engine → runtime}/build/artifact-status.d.ts +5 -5
- package/dist/packages/{engine → runtime}/build/artifact-status.js +25 -23
- package/dist/packages/runtime/build/atomic-fs.d.ts +3 -0
- package/dist/packages/runtime/build/atomic-fs.js +95 -0
- package/dist/packages/runtime/build/billing-events.d.ts +78 -0
- package/dist/packages/{engine → runtime}/build/billing-events.js +17 -19
- package/dist/packages/runtime/build/build-evidence.d.ts +15 -0
- package/dist/packages/runtime/build/build-evidence.js +173 -0
- package/dist/packages/{engine → runtime}/build/build-pipeline.d.ts +12 -8
- package/dist/packages/runtime/build/build-pipeline.js +304 -0
- package/dist/packages/{engine → runtime}/build/build-plan-primitives.d.ts +1 -1
- package/dist/packages/{engine → runtime}/build/build-plan-primitives.js +0 -1
- package/dist/packages/runtime/build/build-plan-runs.d.ts +14 -0
- package/dist/packages/runtime/build/build-plan-runs.js +31 -0
- package/dist/packages/runtime/build/build-stage-plan.d.ts +16 -0
- package/dist/packages/{engine → runtime}/build/build-stage-plan.js +28 -29
- package/dist/packages/{engine → runtime}/build/build-stage-runner.d.ts +2 -1
- package/dist/packages/runtime/build/build-stage-runner.js +165 -0
- package/dist/packages/{engine → runtime}/build/build-target.d.ts +4 -4
- package/dist/packages/runtime/build/build-target.js +16 -0
- package/dist/packages/{engine → runtime}/build/check-evaluator.d.ts +14 -16
- package/dist/packages/runtime/build/check-evaluator.js +575 -0
- package/dist/packages/runtime/build/context-graph-paths.d.ts +51 -0
- package/dist/packages/runtime/build/context-graph-paths.js +133 -0
- package/dist/packages/runtime/build/context-graph-schema.d.ts +19 -0
- package/dist/packages/runtime/build/context-graph-schema.js +39 -0
- package/dist/packages/{engine → runtime}/build/discovery.d.ts +2 -2
- package/dist/packages/{engine → runtime}/build/discovery.js +4 -4
- package/dist/packages/{engine → runtime}/build/index.d.ts +5 -3
- package/dist/packages/{engine → runtime}/build/index.js +5 -3
- package/dist/packages/{engine → runtime}/build/lib/schema.d.ts +221 -88
- package/dist/packages/{engine → runtime}/build/lib/schema.js +61 -41
- package/dist/packages/runtime/build/reset.d.ts +2 -0
- package/dist/packages/runtime/build/reset.js +62 -0
- package/dist/packages/{engine → runtime}/build/runtime-contracts.js +5 -5
- package/dist/packages/runtime/build/runtime-inventory.d.ts +7 -0
- package/dist/packages/{engine → runtime}/build/runtime-inventory.js +3 -3
- package/dist/packages/{engine → runtime}/build/runtime-paths.js +6 -6
- package/dist/packages/{engine → runtime}/build/runtime-prompt.js +7 -6
- package/dist/packages/{engine → runtime}/build/runtime-reconcile.d.ts +1 -1
- package/dist/packages/{engine → runtime}/build/runtime-reconcile.js +25 -21
- package/dist/packages/runtime/build/runtime-runs.d.ts +10 -0
- package/dist/packages/runtime/build/runtime-runs.js +265 -0
- package/dist/packages/{engine → runtime}/build/runtime-types.d.ts +6 -6
- package/dist/packages/runtime/build/runtime-types.js +1 -0
- package/dist/packages/runtime/build/runtime.d.ts +6 -0
- package/dist/packages/runtime/build/runtime.js +5 -0
- package/dist/packages/runtime/build/source-files.d.ts +58 -0
- package/dist/packages/runtime/build/source-files.js +184 -0
- package/dist/packages/runtime/build/source-inventory.d.ts +27 -0
- package/dist/packages/runtime/build/source-inventory.js +273 -0
- package/dist/packages/runtime/build/source-manifest.d.ts +52 -0
- package/dist/packages/runtime/build/source-manifest.js +192 -0
- package/dist/packages/runtime/build/stage-evidence.d.ts +22 -0
- package/dist/packages/runtime/build/stage-evidence.js +317 -0
- package/dist/packages/runtime/build/stage-reuse.d.ts +11 -0
- package/dist/packages/runtime/build/stage-reuse.js +142 -0
- package/dist/packages/runtime/build/state-artifacts.d.ts +9 -0
- package/dist/packages/runtime/build/state-artifacts.js +14 -0
- package/dist/packages/runtime/build/state-health.d.ts +4 -0
- package/dist/packages/{engine → runtime}/build/state-health.js +21 -26
- package/dist/packages/runtime/build/state-io.d.ts +12 -0
- package/dist/packages/runtime/build/state-io.js +119 -0
- package/dist/packages/{engine → runtime}/build/state-paths.d.ts +3 -1
- package/dist/packages/runtime/build/state-paths.js +22 -0
- package/dist/packages/runtime/build/state-view.d.ts +5 -0
- package/dist/packages/{engine → runtime}/build/state-view.js +60 -33
- package/dist/packages/runtime/build/state.d.ts +7 -0
- package/dist/packages/runtime/build/state.js +12 -0
- package/dist/packages/runtime/build/traces.d.ts +30 -0
- package/dist/packages/runtime/build/traces.js +133 -0
- package/dist/packages/{engine/build/validate-verifiable-context.d.ts → runtime/build/validate-context-graph.d.ts} +6 -6
- package/dist/packages/{engine/build/validate-verifiable-context.js → runtime/build/validate-context-graph.js} +48 -35
- package/dist/packages/{engine → runtime}/build/validate.d.ts +5 -5
- package/dist/packages/{engine → runtime}/build/validate.js +26 -26
- package/dist/packages/{engine → runtime}/client.d.ts +15 -15
- package/dist/packages/{engine → runtime}/client.js +41 -24
- package/dist/packages/{engine → runtime}/connection-config.d.ts +3 -2
- package/dist/packages/{engine → runtime}/connection-config.js +9 -8
- package/dist/packages/runtime/context-checks.d.ts +10 -0
- package/dist/packages/runtime/context-checks.js +114 -0
- package/dist/packages/runtime/context-graph-scaffold.d.ts +9 -0
- package/dist/packages/runtime/context-graph-scaffold.js +134 -0
- package/dist/packages/runtime/entitlement-guard.d.ts +43 -0
- package/dist/packages/runtime/entitlement-guard.js +70 -0
- package/dist/packages/{engine → runtime}/execution/index.d.ts +2 -2
- package/dist/packages/{engine → runtime}/execution/index.js +1 -1
- package/dist/packages/{engine → runtime}/execution/lib/schema.d.ts +270 -192
- package/dist/packages/{engine → runtime}/execution/lib/schema.js +35 -32
- package/dist/packages/runtime/index.d.ts +29 -0
- package/dist/packages/runtime/index.js +21 -0
- package/dist/packages/runtime/instance-paths.d.ts +30 -0
- package/dist/packages/runtime/instance-paths.js +29 -0
- package/dist/packages/{engine → runtime}/native-run-handlers.d.ts +4 -4
- package/dist/packages/{engine → runtime}/native-run-handlers.js +184 -152
- package/dist/packages/runtime/plan-artifact-contract.d.ts +17 -0
- package/dist/packages/runtime/plan-artifact-contract.js +42 -0
- package/dist/packages/runtime/project-entries.d.ts +11 -0
- package/dist/packages/runtime/project-entries.js +49 -0
- package/dist/packages/runtime/project-source-state.d.ts +26 -0
- package/dist/packages/runtime/project-source-state.js +53 -0
- package/dist/packages/runtime/project-store.d.ts +85 -0
- package/dist/packages/runtime/project-store.js +168 -0
- package/dist/packages/runtime/requested-artifacts.d.ts +7 -0
- package/dist/packages/{engine → runtime}/requested-artifacts.js +23 -1
- package/dist/packages/{engine → runtime}/run-observability.d.ts +2 -1
- package/dist/packages/{engine → runtime}/run-observability.js +166 -84
- package/dist/packages/runtime/runtime-action-proposals.d.ts +7 -0
- package/dist/packages/runtime/runtime-action-proposals.js +542 -0
- package/dist/packages/runtime/runtime-build-plans.d.ts +5 -0
- package/dist/packages/runtime/runtime-build-plans.js +131 -0
- package/dist/packages/runtime/runtime-build-runs.d.ts +47 -0
- package/dist/packages/runtime/runtime-build-runs.js +562 -0
- package/dist/packages/runtime/runtime-caches.d.ts +91 -0
- package/dist/packages/{engine → runtime}/runtime-caches.js +77 -49
- package/dist/packages/{engine → runtime}/runtime-event-applier.d.ts +3 -1
- package/dist/packages/{engine → runtime}/runtime-event-applier.js +53 -17
- package/dist/packages/runtime/runtime-executor.d.ts +22 -0
- package/dist/packages/runtime/runtime-executor.js +131 -0
- package/dist/packages/runtime/runtime-jobs.d.ts +13 -0
- package/dist/packages/runtime/runtime-jobs.js +463 -0
- package/dist/packages/runtime/runtime-observability.d.ts +11 -0
- package/dist/packages/runtime/runtime-observability.js +39 -0
- package/dist/packages/{engine → runtime}/runtime-persistence.d.ts +9 -18
- package/dist/packages/{engine → runtime}/runtime-persistence.js +25 -25
- package/dist/packages/runtime/runtime-project-mutations.d.ts +7 -0
- package/dist/packages/runtime/runtime-project-mutations.js +64 -0
- package/dist/packages/runtime/runtime-project-reads.d.ts +15 -0
- package/dist/packages/runtime/runtime-project-reads.js +381 -0
- package/dist/packages/runtime/runtime-proposal-helpers.d.ts +22 -0
- package/dist/packages/runtime/runtime-proposal-helpers.js +223 -0
- package/dist/packages/{engine → runtime}/runtime-resource-builders.d.ts +21 -16
- package/dist/packages/{engine → runtime}/runtime-resource-builders.js +48 -38
- package/dist/packages/runtime/runtime-verify-runs.d.ts +84 -0
- package/dist/packages/runtime/runtime-verify-runs.js +295 -0
- package/dist/packages/runtime/runtime.d.ts +1165 -0
- package/dist/packages/runtime/runtime.js +417 -0
- package/dist/packages/runtime/schemas/actions.d.ts +1182 -0
- package/dist/packages/runtime/schemas/actions.js +117 -0
- package/dist/packages/runtime/schemas/agents.d.ts +76 -0
- package/dist/packages/runtime/schemas/agents.js +41 -0
- package/dist/packages/runtime/schemas/build-plans.d.ts +959 -0
- package/dist/packages/runtime/schemas/build-plans.js +107 -0
- package/dist/packages/runtime/schemas/files.d.ts +567 -0
- package/dist/packages/runtime/schemas/files.js +51 -0
- package/dist/packages/runtime/schemas/index.d.ts +8 -0
- package/dist/packages/runtime/schemas/index.js +12 -0
- package/dist/packages/runtime/schemas/instance.d.ts +141 -0
- package/dist/packages/runtime/schemas/instance.js +143 -0
- package/dist/packages/runtime/schemas/jobs.d.ts +339 -0
- package/dist/packages/runtime/schemas/jobs.js +103 -0
- package/dist/packages/runtime/schemas/projects.d.ts +339 -0
- package/dist/packages/runtime/schemas/projects.js +136 -0
- package/dist/packages/runtime/schemas/runs.d.ts +2676 -0
- package/dist/packages/runtime/schemas/runs.js +98 -0
- package/dist/packages/runtime/service/index.d.ts +3 -0
- package/dist/packages/runtime/service/index.js +3 -0
- package/dist/packages/runtime/service/openapi.d.ts +7 -0
- package/dist/packages/runtime/service/openapi.js +117 -0
- package/dist/packages/runtime/service/operations.d.ts +1490 -0
- package/dist/packages/runtime/service/operations.js +245 -0
- package/dist/packages/runtime/service/routes.d.ts +106 -0
- package/dist/packages/runtime/service/routes.js +120 -0
- package/dist/packages/runtime/service/server-api-files.d.ts +10 -0
- package/dist/packages/runtime/service/server-api-files.js +85 -0
- package/dist/packages/runtime/service/server-app-boot.d.ts +4 -0
- package/dist/packages/runtime/service/server-app-boot.js +46 -0
- package/dist/packages/runtime/service/server-guards.d.ts +63 -0
- package/dist/packages/runtime/service/server-guards.js +181 -0
- package/dist/packages/runtime/service/server-helpers.d.ts +27 -0
- package/dist/packages/runtime/service/server-helpers.js +89 -0
- package/dist/packages/runtime/service/server-instance-helpers.d.ts +30 -0
- package/dist/packages/runtime/service/server-instance-helpers.js +114 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.js +43 -0
- package/dist/packages/runtime/service/server-routes-agents.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-agents.js +198 -0
- package/dist/packages/runtime/service/server-routes-auth.d.ts +33 -0
- package/dist/packages/runtime/service/server-routes-auth.js +138 -0
- package/dist/packages/runtime/service/server-routes-build-plans.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-build-plans.js +83 -0
- package/dist/packages/runtime/service/server-routes-discovery.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-discovery.js +196 -0
- package/dist/packages/runtime/service/server-routes-events.d.ts +5 -0
- package/dist/packages/runtime/service/server-routes-events.js +99 -0
- package/dist/packages/runtime/service/server-routes-project-context.d.ts +9 -0
- package/dist/packages/runtime/service/server-routes-project-context.js +192 -0
- package/dist/packages/runtime/service/server-routes-project-jobs.d.ts +9 -0
- package/dist/packages/runtime/service/server-routes-project-jobs.js +130 -0
- package/dist/packages/runtime/service/server-routes-project-runs.d.ts +14 -0
- package/dist/packages/runtime/service/server-routes-project-runs.js +85 -0
- package/dist/packages/runtime/service/server-routes-projects.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-projects.js +92 -0
- package/dist/packages/runtime/service/server-routes-runs.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-runs.js +112 -0
- package/dist/packages/runtime/service/server.d.ts +37 -0
- package/dist/packages/runtime/service/server.js +300 -0
- package/dist/packages/{engine → runtime/service}/service-registry.d.ts +5 -5
- package/dist/packages/{engine → runtime/service}/service-registry.js +7 -7
- package/dist/packages/runtime/verify/benchmark-run.d.ts +81 -0
- package/dist/packages/runtime/verify/benchmark-run.js +303 -0
- package/dist/packages/{engine → runtime}/verify/index.d.ts +2 -2
- package/dist/packages/{engine → runtime}/verify/index.js +1 -1
- package/dist/packages/{engine → runtime}/verify/lib/schema.d.ts +83 -16
- package/dist/packages/{engine → runtime}/verify/lib/schema.js +26 -18
- package/dist/packages/{engine → runtime}/verify/verify-execution.js +11 -11
- package/dist/packages/{engine → runtime}/verify/verify-paths.d.ts +4 -4
- package/dist/packages/runtime/verify/verify-paths.js +61 -0
- package/dist/packages/{engine → runtime}/verify/verify-sandbox.d.ts +1 -1
- package/dist/packages/runtime/verify/verify-sandbox.js +88 -0
- package/dist/packages/{engine → runtime}/verify/verify-specs.d.ts +2 -0
- package/dist/packages/{engine → runtime}/verify/verify-specs.js +5 -3
- package/dist/packages/runtime/verify/verify-targets.d.ts +5 -0
- package/dist/packages/{engine → runtime}/verify/verify-targets.js +12 -12
- package/dist/packages/runtime/verify/verify-types.js +1 -0
- package/dist/packages/{engine → runtime}/verify/verify.d.ts +1 -1
- package/dist/packages/{engine → runtime}/verify/verify.js +1 -1
- package/dist/packages/runtime/wire-schemas.d.ts +18 -0
- package/dist/packages/runtime/wire-schemas.js +27 -0
- package/package.json +40 -30
- package/public-repo/CONTRIBUTING.md +7 -16
- package/public-repo/README.md +175 -234
- package/public-repo/SECURITY.md +3 -4
- package/public-repo/build-plans/interf-default/README.md +19 -14
- package/public-repo/build-plans/interf-default/build/stages/shape/SKILL.md +18 -11
- package/public-repo/build-plans/interf-default/build/stages/structure/SKILL.md +12 -5
- package/public-repo/build-plans/interf-default/build/stages/summarize/SKILL.md +16 -4
- package/public-repo/build-plans/interf-default/build-plan.json +34 -28
- package/public-repo/build-plans/interf-default/build-plan.schema.json +54 -32
- package/public-repo/build-plans/interf-default/improve/SKILL.md +3 -3
- package/public-repo/build-plans/interf-default/use/query/SKILL.md +17 -11
- package/public-repo/openapi/local-service.openapi.json +6803 -0
- package/public-repo/skills/interf/SKILL.md +460 -179
- package/dist/cli/commands/prep.d.ts +0 -2
- package/dist/cli/commands/prep.js +0 -240
- package/dist/cli/commands/test.d.ts +0 -10
- package/dist/cli/commands/test.js +0 -85
- package/dist/cli/commands/web.d.ts +0 -2
- package/dist/cli/commands/web.js +0 -286
- package/dist/interf-ui/404.html +0 -1
- package/dist/interf-ui/__next.__PAGE__.txt +0 -10
- package/dist/interf-ui/__next._full.txt +0 -20
- package/dist/interf-ui/__next._head.txt +0 -5
- package/dist/interf-ui/__next._index.txt +0 -5
- package/dist/interf-ui/__next._tree.txt +0 -5
- package/dist/interf-ui/_next/static/_qJKnA0dammQ306MG_zMq/_buildManifest.js +0 -11
- package/dist/interf-ui/_next/static/_qJKnA0dammQ306MG_zMq/_clientMiddlewareManifest.js +0 -1
- package/dist/interf-ui/_next/static/_qJKnA0dammQ306MG_zMq/_ssgManifest.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0.tjb6f4golw..css +0 -3
- package/dist/interf-ui/_next/static/chunks/03~yq9q893hmn.js +0 -1
- package/dist/interf-ui/_next/static/chunks/085-n_jv2ng_q.css +0 -1
- package/dist/interf-ui/_next/static/chunks/0dn41fa_zvgsl.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0g-ea0zj5d-0k.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0gwqglc4iz583.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0haldgm65ve6l.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0nv3am99vjzn4.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0s77gt_o4jwtx.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0y5z3t-z1c8ks.js.map +0 -5
- package/dist/interf-ui/_next/static/chunks/0~a36ujuzpaz..js +0 -116
- package/dist/interf-ui/_next/static/chunks/10jeodxe4nkgj.js +0 -31
- package/dist/interf-ui/_next/static/chunks/119h2rouych2t.js +0 -1
- package/dist/interf-ui/_next/static/chunks/13c8b~m8knjsf.js +0 -1
- package/dist/interf-ui/_next/static/chunks/14dznb2qpt-ho.js +0 -91
- package/dist/interf-ui/_next/static/chunks/15z_en80lrq-3.js +0 -5
- package/dist/interf-ui/_next/static/chunks/turbopack-0p.pvcjrtq-jh.js +0 -1
- package/dist/interf-ui/_next/static/chunks/turbopack-0usj_75.8frlw.js +0 -1
- package/dist/interf-ui/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +0 -1
- package/dist/interf-ui/_next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- package/dist/interf-ui/_next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- package/dist/interf-ui/_next/static/media/worker.102zas1s52_pf.js +0 -109
- package/dist/interf-ui/_not-found/__next._full.txt +0 -15
- package/dist/interf-ui/_not-found/__next._head.txt +0 -5
- package/dist/interf-ui/_not-found/__next._index.txt +0 -5
- package/dist/interf-ui/_not-found/__next._not-found.__PAGE__.txt +0 -5
- package/dist/interf-ui/_not-found/__next._not-found.txt +0 -5
- package/dist/interf-ui/_not-found/__next._tree.txt +0 -2
- package/dist/interf-ui/_not-found.html +0 -1
- package/dist/interf-ui/_not-found.txt +0 -15
- package/dist/interf-ui/index.html +0 -1
- package/dist/interf-ui/index.txt +0 -20
- package/dist/packages/contracts/lib/preparation-paths.d.ts +0 -117
- package/dist/packages/contracts/lib/preparation-paths.js +0 -177
- package/dist/packages/engine/action-definitions.d.ts +0 -407
- package/dist/packages/engine/action-definitions.js +0 -1158
- package/dist/packages/engine/action-values.d.ts +0 -1
- package/dist/packages/engine/action-values.js +0 -1
- package/dist/packages/engine/agents/lib/args.d.ts +0 -4
- package/dist/packages/engine/agents/lib/args.js +0 -52
- package/dist/packages/engine/agents/lib/chart-guidance.d.ts +0 -1
- package/dist/packages/engine/agents/lib/chart-guidance.js +0 -8
- package/dist/packages/engine/agents/lib/constants.js +0 -28
- package/dist/packages/engine/agents/lib/schema.d.ts +0 -8
- package/dist/packages/engine/agents/lib/schema.js +0 -7
- package/dist/packages/engine/agents/lib/shells.d.ts +0 -74
- package/dist/packages/engine/agents/lib/shells.js +0 -1052
- package/dist/packages/engine/agents/lib/verifiable-context-bootstrap.d.ts +0 -3
- package/dist/packages/engine/build/artifact-counts.d.ts +0 -1
- package/dist/packages/engine/build/billing-events.d.ts +0 -89
- package/dist/packages/engine/build/build-pipeline.js +0 -175
- package/dist/packages/engine/build/build-plan-runs.d.ts +0 -14
- package/dist/packages/engine/build/build-plan-runs.js +0 -31
- package/dist/packages/engine/build/build-stage-plan.d.ts +0 -16
- package/dist/packages/engine/build/build-stage-runner.js +0 -94
- package/dist/packages/engine/build/build-target.js +0 -16
- package/dist/packages/engine/build/check-evaluator.js +0 -298
- package/dist/packages/engine/build/reset.d.ts +0 -2
- package/dist/packages/engine/build/reset.js +0 -74
- package/dist/packages/engine/build/runtime-inventory.d.ts +0 -7
- package/dist/packages/engine/build/runtime-runs.d.ts +0 -10
- package/dist/packages/engine/build/runtime-runs.js +0 -224
- package/dist/packages/engine/build/runtime.d.ts +0 -5
- package/dist/packages/engine/build/runtime.js +0 -4
- package/dist/packages/engine/build/source-files.d.ts +0 -46
- package/dist/packages/engine/build/source-files.js +0 -149
- package/dist/packages/engine/build/state-artifacts.d.ts +0 -9
- package/dist/packages/engine/build/state-artifacts.js +0 -14
- package/dist/packages/engine/build/state-health.d.ts +0 -4
- package/dist/packages/engine/build/state-io.d.ts +0 -11
- package/dist/packages/engine/build/state-io.js +0 -82
- package/dist/packages/engine/build/state-paths.js +0 -16
- package/dist/packages/engine/build/state-view.d.ts +0 -5
- package/dist/packages/engine/build/state.d.ts +0 -7
- package/dist/packages/engine/build/state.js +0 -12
- package/dist/packages/engine/build/validate-helpers.d.ts +0 -12
- package/dist/packages/engine/build/validate-helpers.js +0 -41
- package/dist/packages/engine/build/verifiable-context-paths.d.ts +0 -47
- package/dist/packages/engine/build/verifiable-context-paths.js +0 -121
- package/dist/packages/engine/build/verifiable-context-schema.d.ts +0 -21
- package/dist/packages/engine/build/verifiable-context-schema.js +0 -126
- package/dist/packages/engine/cloud-seams.d.ts +0 -115
- package/dist/packages/engine/cloud-seams.js +0 -84
- package/dist/packages/engine/index.d.ts +0 -22
- package/dist/packages/engine/index.js +0 -15
- package/dist/packages/engine/instance-paths.d.ts +0 -106
- package/dist/packages/engine/instance-paths.js +0 -171
- package/dist/packages/engine/lib/schema.d.ts +0 -6304
- package/dist/packages/engine/lib/schema.js +0 -730
- package/dist/packages/engine/preparation-store.d.ts +0 -105
- package/dist/packages/engine/preparation-store.js +0 -213
- package/dist/packages/engine/readiness-check-draft.d.ts +0 -20
- package/dist/packages/engine/readiness-check-draft.js +0 -111
- package/dist/packages/engine/requested-artifacts.d.ts +0 -5
- package/dist/packages/engine/routes.d.ts +0 -85
- package/dist/packages/engine/routes.js +0 -99
- package/dist/packages/engine/runtime-caches.d.ts +0 -76
- package/dist/packages/engine/runtime-proposal-helpers.d.ts +0 -35
- package/dist/packages/engine/runtime-proposal-helpers.js +0 -247
- package/dist/packages/engine/runtime.d.ts +0 -371
- package/dist/packages/engine/runtime.js +0 -2463
- package/dist/packages/engine/server.d.ts +0 -58
- package/dist/packages/engine/server.js +0 -1399
- package/dist/packages/engine/verify/readiness-check-run.d.ts +0 -82
- package/dist/packages/engine/verify/readiness-check-run.js +0 -265
- package/dist/packages/engine/verify/verify-paths.js +0 -61
- package/dist/packages/engine/verify/verify-sandbox.js +0 -88
- package/dist/packages/engine/verify/verify-targets.d.ts +0 -5
- package/dist/packages/engine/wire-schemas.d.ts +0 -547
- package/dist/packages/engine/wire-schemas.js +0 -59
- package/dist/packages/project/index.d.ts +0 -9
- package/dist/packages/project/interf-bootstrap.d.ts +0 -1
- package/dist/packages/project/interf-bootstrap.js +0 -1
- package/dist/packages/project/interf-scaffold.d.ts +0 -3
- package/dist/packages/project/interf-scaffold.js +0 -136
- package/dist/packages/project/interf.d.ts +0 -4
- package/dist/packages/project/interf.js +0 -3
- package/dist/packages/project/lib/schema.d.ts +0 -328
- package/dist/packages/project/lib/schema.js +0 -136
- package/dist/packages/project/preparation-entries.d.ts +0 -11
- package/dist/packages/project/preparation-entries.js +0 -49
- package/dist/packages/project/source-config.d.ts +0 -46
- package/dist/packages/project/source-config.js +0 -394
- package/dist/packages/project/source-folders.d.ts +0 -11
- package/public-repo/plugins/README.md +0 -9
- package/public-repo/plugins/interf/.claude-plugin/plugin.json +0 -21
- package/public-repo/plugins/interf/.mcp.json +0 -12
- package/public-repo/plugins/interf/README.md +0 -32
- package/public-repo/plugins/interf/skills/interf/SKILL.md +0 -376
- /package/dist/packages/{engine/agents/lib/types.js → runtime/actions/fields.js} +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/agents.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/agents.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/execution-profile.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/execution.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/executors.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/executors.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/logs.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/logs.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/preflight.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/render.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/status.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/status.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/types.d.ts +0 -0
- /package/dist/packages/{engine/build/runtime-types.js → runtime/agents/lib/types.js} +0 -0
- /package/dist/packages/{engine/verify/verify-types.js → runtime/agents/providers/types.js} +0 -0
- /package/dist/packages/{engine → runtime}/agents/role-router.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/build-execution.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/build-execution.js +0 -0
- /package/dist/packages/{engine → runtime}/build/runtime-contracts.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/runtime-paths.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/runtime-prompt.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/adapters.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/adapters.js +0 -0
- /package/dist/packages/{engine → runtime}/execution/events.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/events.js +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-execution.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-profile-presets.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-profile-presets.js +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-types.d.ts +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkOS SDK wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Reads config from env at lazy-init time. The engine and CLI never import
|
|
5
|
+
* `@workos-inc/node` directly — they go through `getWorkOS()` so the provider
|
|
6
|
+
* stays behind one seam.
|
|
7
|
+
*
|
|
8
|
+
* Two modes:
|
|
9
|
+
* - **Public Client (CLI / desktop / loopback engine)**: only
|
|
10
|
+
* `WORKOS_CLIENT_ID` required. PKCE replaces the missing client secret.
|
|
11
|
+
* This is the path `interf auth login` drives.
|
|
12
|
+
* - **Confidential Client (cloud control plane)**: both `WORKOS_API_KEY`
|
|
13
|
+
* and `WORKOS_CLIENT_ID` required. Phase 2; not exercised by the local
|
|
14
|
+
* engine.
|
|
15
|
+
*
|
|
16
|
+
* Optional `WORKOS_ISSUER` overrides the AuthKit base URL (defaults to the
|
|
17
|
+
* production WorkOS API). Used for the JWKS URL and for any direct HTTP
|
|
18
|
+
* call we make outside the SDK.
|
|
19
|
+
*/
|
|
20
|
+
import { WorkOS } from "@workos-inc/node";
|
|
21
|
+
export class WorkOSConfigError extends Error {
|
|
22
|
+
constructor(message) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = "WorkOSConfigError";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let cachedConfig = null;
|
|
28
|
+
let cachedClient = null;
|
|
29
|
+
/** Reset cached config + client. Test seam. */
|
|
30
|
+
export function resetWorkOSCache() {
|
|
31
|
+
cachedConfig = null;
|
|
32
|
+
cachedClient = null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Load + validate WorkOS config from the environment.
|
|
36
|
+
*
|
|
37
|
+
* `WORKOS_CLIENT_ID` is always required. `WORKOS_API_KEY` is optional —
|
|
38
|
+
* leave it unset for CLI/Public Client mode. Set it only on the cloud
|
|
39
|
+
* control plane.
|
|
40
|
+
*
|
|
41
|
+
* Throws WorkOSConfigError with an actionable message when the client id
|
|
42
|
+
* is missing.
|
|
43
|
+
*/
|
|
44
|
+
export function workosConfig() {
|
|
45
|
+
if (cachedConfig)
|
|
46
|
+
return cachedConfig;
|
|
47
|
+
const rawApiKey = (process.env.WORKOS_API_KEY ?? "").trim();
|
|
48
|
+
const clientId = (process.env.WORKOS_CLIENT_ID ?? "").trim();
|
|
49
|
+
const issuer = (process.env.WORKOS_ISSUER ?? "https://api.workos.com").replace(/\/$/, "");
|
|
50
|
+
if (!clientId) {
|
|
51
|
+
throw new WorkOSConfigError("Missing WORKOS_CLIENT_ID. Set it before running `interf auth login`, " +
|
|
52
|
+
"or use `interf auth login --dev-stub <email>` for local-only sessions.");
|
|
53
|
+
}
|
|
54
|
+
cachedConfig = {
|
|
55
|
+
apiKey: rawApiKey.length > 0 ? rawApiKey : null,
|
|
56
|
+
clientId,
|
|
57
|
+
issuer,
|
|
58
|
+
};
|
|
59
|
+
return cachedConfig;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get a singleton WorkOS SDK client.
|
|
63
|
+
*
|
|
64
|
+
* Public Client Mode is the default when no API key is configured —
|
|
65
|
+
* matches the upstream SDK pattern for browser / mobile / CLI / desktop
|
|
66
|
+
* apps that cannot securely store a client secret.
|
|
67
|
+
*/
|
|
68
|
+
export function getWorkOS() {
|
|
69
|
+
if (cachedClient)
|
|
70
|
+
return cachedClient;
|
|
71
|
+
const cfg = workosConfig();
|
|
72
|
+
if (cfg.apiKey) {
|
|
73
|
+
cachedClient = new WorkOS(cfg.apiKey, { clientId: cfg.clientId });
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
cachedClient = new WorkOS({ clientId: cfg.clientId });
|
|
77
|
+
}
|
|
78
|
+
return cachedClient;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Test seam — inject a stub `WorkOS` instance so tests can drive the
|
|
82
|
+
* auth flow without touching the live SDK or env. Pass `null` to
|
|
83
|
+
* restore lazy init.
|
|
84
|
+
*/
|
|
85
|
+
export function setWorkOSClientForTests(client) {
|
|
86
|
+
cachedClient = client;
|
|
87
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgentExecutor } from "./agents/lib/executors.js";
|
|
2
|
+
import type { BenchmarkCheck } from "../projects/lib/schema.js";
|
|
3
|
+
export declare function buildBenchmarkQuestionDraftPrompt(options: {
|
|
4
|
+
projectName: string;
|
|
5
|
+
sourceFolderPath: string;
|
|
6
|
+
intent?: string;
|
|
7
|
+
outputPath: string;
|
|
8
|
+
targetCount: number;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function draftBenchmarkQuestions(options: {
|
|
11
|
+
projectName: string;
|
|
12
|
+
sourceFolderPath: string;
|
|
13
|
+
intent?: string;
|
|
14
|
+
executor: AgentExecutor;
|
|
15
|
+
targetCount?: number;
|
|
16
|
+
onStatus?: (line: string) => void;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
checks: BenchmarkCheck[] | null;
|
|
19
|
+
error?: string;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const DraftBenchmarkQuestionSchema = z.object({
|
|
6
|
+
question: z.string().min(1),
|
|
7
|
+
answer: z.string().min(1),
|
|
8
|
+
}).strict();
|
|
9
|
+
const DraftBenchmarkQuestionsSchema = z.array(DraftBenchmarkQuestionSchema).min(1).max(8);
|
|
10
|
+
export function buildBenchmarkQuestionDraftPrompt(options) {
|
|
11
|
+
const normalizedIntent = options.intent?.trim();
|
|
12
|
+
const taskLines = normalizedIntent
|
|
13
|
+
? [
|
|
14
|
+
`Primary agent task: ${normalizedIntent}`,
|
|
15
|
+
"Draft benchmark questions that directly measure whether a local agent can recover the task-critical facts from the source files.",
|
|
16
|
+
"Prefer questions that would make a human confident the Context Graph is useful for that exact job.",
|
|
17
|
+
]
|
|
18
|
+
: [
|
|
19
|
+
"No primary agent task was provided.",
|
|
20
|
+
"Prefer broad, representative benchmark questions that reflect the facts a human would verify from this Source.",
|
|
21
|
+
];
|
|
22
|
+
return [
|
|
23
|
+
"You are drafting Interf benchmark questions for a local Source.",
|
|
24
|
+
"Read `runtime/source-locator.json`, then inspect the Source through your own available tools.",
|
|
25
|
+
"Draft a small set of Q&A / fact-check questions that a human can verify from the source files.",
|
|
26
|
+
"Do not ask follow-up questions.",
|
|
27
|
+
"Keep the questions concrete, explicit, and useful for measuring whether an agent can reason correctly over the files in this Source.",
|
|
28
|
+
"",
|
|
29
|
+
`Project id: ${options.projectName}`,
|
|
30
|
+
`Source locator: ${options.sourceFolderPath}`,
|
|
31
|
+
...taskLines,
|
|
32
|
+
"",
|
|
33
|
+
`Write exactly one JSON array to ${JSON.stringify(options.outputPath)}.`,
|
|
34
|
+
`Draft ${options.targetCount} benchmark questions unless the Source is too small; in that case write fewer.`,
|
|
35
|
+
"Each array item must be an object with exactly these keys:",
|
|
36
|
+
'- "question": a plain-English question answerable from this Source',
|
|
37
|
+
'- "answer": the expected correct answer in plain English',
|
|
38
|
+
"",
|
|
39
|
+
"Quality bar:",
|
|
40
|
+
"- If a primary task was provided, make most questions directly relevant to that task.",
|
|
41
|
+
"- Prefer facts, comparisons, or small derived calculations with clear expected answers.",
|
|
42
|
+
"- Prefer values that are easy for a human to cross-check in the source files.",
|
|
43
|
+
"- Prefer explicit chart labels, table cells, headings, totals, and directly stated comparisons.",
|
|
44
|
+
"- Avoid unstable superlatives unless the source itself clearly states the ranking in one place.",
|
|
45
|
+
"- Avoid questions where the expected answer depends on scanning many pages for a hidden exception or a larger outlier.",
|
|
46
|
+
"- Avoid vague essay questions, open-ended opinions, or anything requiring outside knowledge.",
|
|
47
|
+
"- Avoid duplicate questions that cover the same fact in slightly different words.",
|
|
48
|
+
"",
|
|
49
|
+
"Output rules:",
|
|
50
|
+
"- JSON only in the output file.",
|
|
51
|
+
"- No markdown fences.",
|
|
52
|
+
"- Do not print the JSON to stdout.",
|
|
53
|
+
"- Stop after writing the file.",
|
|
54
|
+
].join("\n");
|
|
55
|
+
}
|
|
56
|
+
export async function draftBenchmarkQuestions(options) {
|
|
57
|
+
const tempDir = mkdtempSync(join(tmpdir(), "interf-benchmark-question-draft-"));
|
|
58
|
+
mkdirSync(join(tempDir, "runtime"), { recursive: true });
|
|
59
|
+
const outputPath = join(tempDir, "questions.json");
|
|
60
|
+
const promptPath = join(tempDir, "prompt.txt");
|
|
61
|
+
writeFileSync(join(tempDir, "runtime", "source-locator.json"), `${JSON.stringify({
|
|
62
|
+
kind: "interf-source-locator",
|
|
63
|
+
version: 1,
|
|
64
|
+
generated_at: new Date().toISOString(),
|
|
65
|
+
project: options.projectName,
|
|
66
|
+
source: {
|
|
67
|
+
kind: "local-folder",
|
|
68
|
+
locator: options.sourceFolderPath,
|
|
69
|
+
},
|
|
70
|
+
note: "Interf does not pre-scan Source files for benchmark drafting. The drafting agent inspects this locator through its own Source access.",
|
|
71
|
+
}, null, 2)}\n`);
|
|
72
|
+
const prompt = buildBenchmarkQuestionDraftPrompt({
|
|
73
|
+
projectName: options.projectName,
|
|
74
|
+
sourceFolderPath: options.sourceFolderPath,
|
|
75
|
+
intent: options.intent,
|
|
76
|
+
outputPath,
|
|
77
|
+
targetCount: options.targetCount ?? 4,
|
|
78
|
+
});
|
|
79
|
+
writeFileSync(promptPath, `${prompt}\n`);
|
|
80
|
+
try {
|
|
81
|
+
const code = await options.executor.execute(tempDir, prompt, {
|
|
82
|
+
completionCheck: () => existsSync(outputPath),
|
|
83
|
+
onStatus: options.onStatus,
|
|
84
|
+
});
|
|
85
|
+
if (!existsSync(outputPath)) {
|
|
86
|
+
return {
|
|
87
|
+
checks: null,
|
|
88
|
+
error: code === 0
|
|
89
|
+
? "The local agent finished without writing draft benchmark questions."
|
|
90
|
+
: "The local agent did not produce draft benchmark questions.",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
let parsed;
|
|
94
|
+
try {
|
|
95
|
+
parsed = JSON.parse(readFileSync(outputPath, "utf8"));
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
return {
|
|
99
|
+
checks: null,
|
|
100
|
+
error: `Draft benchmark questions were not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const validated = DraftBenchmarkQuestionsSchema.safeParse(parsed);
|
|
104
|
+
if (!validated.success) {
|
|
105
|
+
const detail = validated.error.issues[0]?.message ?? "invalid draft benchmark questions";
|
|
106
|
+
return {
|
|
107
|
+
checks: null,
|
|
108
|
+
error: `Draft benchmark questions did not match the required shape: ${detail}`,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
checks: validated.data,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return {
|
|
117
|
+
checks: null,
|
|
118
|
+
error: error instanceof Error ? error.message : String(error),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function countBuildArtifactsAtPath(contextGraphPath: string, artifactPath: string, kind: "directory" | "file"): number;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { listFilesRecursive } from "../../contracts/utils/filesystem.js";
|
|
3
|
-
import {
|
|
3
|
+
import { contextGraphArtifactAbsolutePath } from "./context-graph-schema.js";
|
|
4
4
|
const SCAFFOLD_PLACEHOLDER_SNIPPETS = [
|
|
5
|
-
"Not yet built. Run `interf build` to build the
|
|
6
|
-
"Not yet built. Run `interf build` to build this
|
|
7
|
-
"Not yet built. Run `interf build` to build the verifiable context.",
|
|
8
|
-
"Not yet built. Run `interf build` to build this verifiable context.",
|
|
5
|
+
"Not yet built. Run `interf build` to build the Context Graph.",
|
|
6
|
+
"Not yet built. Run `interf build` to build this Context Graph.",
|
|
9
7
|
];
|
|
10
8
|
function isScaffoldPlaceholderFile(filePath) {
|
|
11
9
|
try {
|
|
@@ -16,14 +14,12 @@ function isScaffoldPlaceholderFile(filePath) {
|
|
|
16
14
|
return false;
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
|
-
export function countBuildArtifactsAtPath(
|
|
20
|
-
const absolutePath =
|
|
17
|
+
export function countBuildArtifactsAtPath(contextGraphPath, artifactPath, kind) {
|
|
18
|
+
const absolutePath = contextGraphArtifactAbsolutePath(contextGraphPath, { path: artifactPath });
|
|
21
19
|
if (!existsSync(absolutePath))
|
|
22
20
|
return 0;
|
|
23
21
|
if (kind === "file")
|
|
24
22
|
return isScaffoldPlaceholderFile(absolutePath) ? 0 : 1;
|
|
25
|
-
if (kind === "runtime")
|
|
26
|
-
return listFilesRecursive(absolutePath).length;
|
|
27
23
|
return listFilesRecursive(absolutePath)
|
|
28
24
|
.filter((filePath) => !isScaffoldPlaceholderFile(filePath))
|
|
29
25
|
.length;
|
|
@@ -2,20 +2,20 @@ import type { ArtifactStatus } from "../../contracts/lib/schema.js";
|
|
|
2
2
|
import type { BuildPlanDefinition } from "../../build-plans/package/build-plan-definitions.js";
|
|
3
3
|
import type { StageRun } from "../execution/lib/schema.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* compute per-Artifact status for a Build run.
|
|
6
6
|
*
|
|
7
7
|
* Walks the Build Plan's declared `artifacts[]` and decides
|
|
8
8
|
* `ready | not_ready | failed | skipped` for each.
|
|
9
9
|
*
|
|
10
10
|
* Mapping rules:
|
|
11
11
|
* - **shape kind = "path"**: the artifact is `ready` when the declared
|
|
12
|
-
* path exists inside `
|
|
12
|
+
* path exists inside `contextGraphPath` with the declared artifact kind,
|
|
13
13
|
* `not_ready` otherwise. Future shape kinds (value, remote-handle,
|
|
14
14
|
* confirmation) slot in here.
|
|
15
15
|
* - **`built_by_stages`** is preserved from the Build Plan declaration when
|
|
16
16
|
* present, otherwise inferred from stage `writes` that match the
|
|
17
17
|
* artifact's path.
|
|
18
|
-
* - **
|
|
18
|
+
* - **check_results** carries structured evidence from the shared check
|
|
19
19
|
* evaluator.
|
|
20
20
|
*
|
|
21
21
|
* Stage-failure short-circuit: if any stage has `status: "failed"`, all
|
|
@@ -24,7 +24,7 @@ import type { StageRun } from "../execution/lib/schema.js";
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function computeArtifactStatuses(options: {
|
|
26
26
|
buildPlan: Pick<BuildPlanDefinition<string>, "stages" | "contextInterface" | "schema">;
|
|
27
|
-
|
|
27
|
+
contextGraphPath: string;
|
|
28
28
|
stageRuns: StageRun[];
|
|
29
29
|
/**
|
|
30
30
|
* Optional runtime counts (e.g. `source_total`) passed to checks
|
|
@@ -35,7 +35,7 @@ export declare function computeArtifactStatuses(options: {
|
|
|
35
35
|
}): ArtifactStatus[];
|
|
36
36
|
/**
|
|
37
37
|
* Aggregate verdict: any artifact in `not_ready | failed | skipped`
|
|
38
|
-
* makes the
|
|
38
|
+
* makes the project `not_ready`. Used by the readiness state view
|
|
39
39
|
* once Phase D lights up the per-artifact UI.
|
|
40
40
|
*/
|
|
41
41
|
export declare function aggregateArtifactVerdict(statuses: readonly ArtifactStatus[]): "ready" | "not_ready";
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { existsSync, statSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { listFilesRecursive } from "../../contracts/utils/filesystem.js";
|
|
3
4
|
import { evaluateChecks } from "./check-evaluator.js";
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* compute per-Artifact status for a Build run.
|
|
6
7
|
*
|
|
7
8
|
* Walks the Build Plan's declared `artifacts[]` and decides
|
|
8
9
|
* `ready | not_ready | failed | skipped` for each.
|
|
9
10
|
*
|
|
10
11
|
* Mapping rules:
|
|
11
12
|
* - **shape kind = "path"**: the artifact is `ready` when the declared
|
|
12
|
-
* path exists inside `
|
|
13
|
+
* path exists inside `contextGraphPath` with the declared artifact kind,
|
|
13
14
|
* `not_ready` otherwise. Future shape kinds (value, remote-handle,
|
|
14
15
|
* confirmation) slot in here.
|
|
15
16
|
* - **`built_by_stages`** is preserved from the Build Plan declaration when
|
|
16
17
|
* present, otherwise inferred from stage `writes` that match the
|
|
17
18
|
* artifact's path.
|
|
18
|
-
* - **
|
|
19
|
+
* - **check_results** carries structured evidence from the shared check
|
|
19
20
|
* evaluator.
|
|
20
21
|
*
|
|
21
22
|
* Stage-failure short-circuit: if any stage has `status: "failed"`, all
|
|
@@ -31,7 +32,7 @@ export function computeArtifactStatuses(options) {
|
|
|
31
32
|
const anyStageFailed = options.stageRuns.some((stage) => stage.status === "failed");
|
|
32
33
|
return artifacts.map((artifact) => buildArtifactStatus({
|
|
33
34
|
artifact,
|
|
34
|
-
|
|
35
|
+
contextGraphPath: options.contextGraphPath,
|
|
35
36
|
stageWriteIndex,
|
|
36
37
|
anyStageFailed,
|
|
37
38
|
counts: options.counts,
|
|
@@ -53,16 +54,16 @@ function buildStageWriteIndex(stages) {
|
|
|
53
54
|
return index;
|
|
54
55
|
}
|
|
55
56
|
function buildArtifactStatus(options) {
|
|
56
|
-
const { artifact,
|
|
57
|
+
const { artifact, contextGraphPath, stageWriteIndex, anyStageFailed, counts } = options;
|
|
57
58
|
const builtBy = artifact.built_by_stages.length > 0
|
|
58
59
|
? artifact.built_by_stages
|
|
59
60
|
: inferBuiltByStages(artifact, stageWriteIndex);
|
|
60
61
|
const shapeStatus = resolveStatusValue({
|
|
61
62
|
artifact,
|
|
62
|
-
|
|
63
|
+
contextGraphPath,
|
|
63
64
|
anyStageFailed,
|
|
64
65
|
});
|
|
65
|
-
// Run the locked CheckKind evaluator against artifact.checks.
|
|
66
|
+
// Run the locked CheckKind evaluator against artifact.checks. CheckResults
|
|
66
67
|
// are surfaced for each declared check; if any required check fails,
|
|
67
68
|
// the artifact's status is forced to failed (or not_ready if the
|
|
68
69
|
// shape itself isn't built yet).
|
|
@@ -73,11 +74,11 @@ function buildArtifactStatus(options) {
|
|
|
73
74
|
const declaredChecks = artifact.checks ?? [];
|
|
74
75
|
const checkResult = declaredChecks.length > 0
|
|
75
76
|
? evaluateChecks(declaredChecks, {
|
|
76
|
-
rootPath:
|
|
77
|
+
rootPath: contextGraphPath,
|
|
77
78
|
targetPath,
|
|
78
79
|
counts,
|
|
79
80
|
})
|
|
80
|
-
: {
|
|
81
|
+
: { check_results: [], ready: true, failures: [] };
|
|
81
82
|
const status = (() => {
|
|
82
83
|
if (shapeStatus !== "ready")
|
|
83
84
|
return shapeStatus;
|
|
@@ -89,7 +90,7 @@ function buildArtifactStatus(options) {
|
|
|
89
90
|
artifact_id: artifact.id,
|
|
90
91
|
status,
|
|
91
92
|
built_by_stages: builtBy,
|
|
92
|
-
|
|
93
|
+
check_results: checkResult.check_results,
|
|
93
94
|
...(buildSummary(artifact, status, checkResult.failures.length)),
|
|
94
95
|
};
|
|
95
96
|
}
|
|
@@ -116,17 +117,17 @@ function inferBuiltByStages(artifact, stageWriteIndex) {
|
|
|
116
117
|
return pathOwners ?? [];
|
|
117
118
|
}
|
|
118
119
|
function resolveStatusValue(options) {
|
|
119
|
-
const { artifact,
|
|
120
|
+
const { artifact, contextGraphPath, anyStageFailed } = options;
|
|
120
121
|
if (artifact.shape.kind !== "path")
|
|
121
122
|
return "skipped";
|
|
122
|
-
const
|
|
123
|
-
const absolutePath = resolve(
|
|
123
|
+
const contextGraphRoot = resolve(contextGraphPath);
|
|
124
|
+
const absolutePath = resolve(contextGraphRoot, artifact.shape.path);
|
|
124
125
|
// Defense in depth: the schema-level `isInterfRelativePath` refine
|
|
125
126
|
// already rejects `..` and absolute paths in `ArtifactPathShape.path`,
|
|
126
127
|
// but Build Plan packages can land on disk before the schema validates
|
|
127
128
|
// (hand-edited drafts can still bypass normal package validation).
|
|
128
|
-
// Reject any resolved path that escapes the
|
|
129
|
-
if (absolutePath !==
|
|
129
|
+
// Reject any resolved path that escapes the context-graph root.
|
|
130
|
+
if (absolutePath !== contextGraphRoot && !absolutePath.startsWith(`${contextGraphRoot}/`)) {
|
|
130
131
|
return "failed";
|
|
131
132
|
}
|
|
132
133
|
if (!existsSync(absolutePath)) {
|
|
@@ -134,13 +135,14 @@ function resolveStatusValue(options) {
|
|
|
134
135
|
}
|
|
135
136
|
try {
|
|
136
137
|
const info = statSync(absolutePath);
|
|
137
|
-
//
|
|
138
|
-
// directory
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
// Directory artifacts must contain at least one real file. A bare
|
|
139
|
+
// directory is only a placeholder and should not make a mandatory
|
|
140
|
+
// graph layer look ready.
|
|
141
|
+
if (artifact.shape.artifact_kind === "directory" && info.isDirectory()) {
|
|
142
|
+
return listFilesRecursive(absolutePath, () => true).length > 0
|
|
143
|
+
? "ready"
|
|
144
|
+
: anyStageFailed ? "failed" : "not_ready";
|
|
145
|
+
}
|
|
144
146
|
if (artifact.shape.artifact_kind === "file" && info.isFile() && info.size > 0)
|
|
145
147
|
return "ready";
|
|
146
148
|
return anyStageFailed ? "failed" : "not_ready";
|
|
@@ -156,7 +158,7 @@ function describeShape(artifact) {
|
|
|
156
158
|
}
|
|
157
159
|
/**
|
|
158
160
|
* Aggregate verdict: any artifact in `not_ready | failed | skipped`
|
|
159
|
-
* makes the
|
|
161
|
+
* makes the project `not_ready`. Used by the readiness state view
|
|
160
162
|
* once Phase D lights up the per-artifact UI.
|
|
161
163
|
*/
|
|
162
164
|
export function aggregateArtifactVerdict(statuses) {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, truncateSync, writeFileSync, writeSync, } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
function removeTempFile(path) {
|
|
4
|
+
try {
|
|
5
|
+
rmSync(path, { force: true });
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
// Best-effort cleanup. Preserve the original write error.
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function replaceWithTempFile(tmpPath, targetPath) {
|
|
12
|
+
try {
|
|
13
|
+
renameSync(tmpPath, targetPath);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const code = error && typeof error === "object" && "code" in error
|
|
18
|
+
? String(error.code)
|
|
19
|
+
: "";
|
|
20
|
+
if (process.platform === "win32" && (code === "EEXIST" || code === "EPERM")) {
|
|
21
|
+
rmSync(targetPath, { force: true });
|
|
22
|
+
renameSync(tmpPath, targetPath);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function fsyncDirectory(path) {
|
|
29
|
+
if (process.platform === "win32")
|
|
30
|
+
return;
|
|
31
|
+
let fd = null;
|
|
32
|
+
try {
|
|
33
|
+
fd = openSync(path, "r");
|
|
34
|
+
fsyncSync(fd);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Directory fsync is best-effort across filesystems. The temp-file fsync
|
|
38
|
+
// above still protects readers from torn file contents.
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
if (fd !== null)
|
|
42
|
+
closeSync(fd);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function repairJsonlTail(path) {
|
|
46
|
+
if (!existsSync(path))
|
|
47
|
+
return;
|
|
48
|
+
const content = readFileSync(path, "utf8");
|
|
49
|
+
if (content.length === 0 || content.endsWith("\n"))
|
|
50
|
+
return;
|
|
51
|
+
const lastNewline = content.lastIndexOf("\n");
|
|
52
|
+
const completePrefix = lastNewline === -1 ? "" : content.slice(0, lastNewline + 1);
|
|
53
|
+
truncateSync(path, Buffer.byteLength(completePrefix, "utf8"));
|
|
54
|
+
}
|
|
55
|
+
export function writeFileAtomic(path, data, mode) {
|
|
56
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
57
|
+
const tmpPath = `${path}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 8)}.tmp`;
|
|
58
|
+
let fd = null;
|
|
59
|
+
try {
|
|
60
|
+
fd = openSync(tmpPath, "w", mode);
|
|
61
|
+
writeFileSync(fd, data);
|
|
62
|
+
fsyncSync(fd);
|
|
63
|
+
closeSync(fd);
|
|
64
|
+
fd = null;
|
|
65
|
+
replaceWithTempFile(tmpPath, path);
|
|
66
|
+
fsyncDirectory(dirname(path));
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (fd !== null) {
|
|
70
|
+
try {
|
|
71
|
+
closeSync(fd);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// Preserve the original write/rename error.
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
removeTempFile(tmpPath);
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export function writeJsonAtomic(path, value) {
|
|
82
|
+
writeFileAtomic(path, `${JSON.stringify(value, null, 2)}\n`);
|
|
83
|
+
}
|
|
84
|
+
export function appendJsonlAtomic(path, record) {
|
|
85
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
86
|
+
repairJsonlTail(path);
|
|
87
|
+
const fd = openSync(path, "a");
|
|
88
|
+
try {
|
|
89
|
+
writeSync(fd, `${JSON.stringify(record)}\n`);
|
|
90
|
+
fsyncSync(fd);
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
closeSync(fd);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ArtifactStatus } from "../../contracts/lib/schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* Per-Artifact billing event record.
|
|
5
|
+
*
|
|
6
|
+
* Emitted once per Artifact each time a Build run produces it.
|
|
7
|
+
* `account_id` is `null` for loopback engines; hosted variants can fill it
|
|
8
|
+
* from the service auth layer.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BillingEventKindSchema: z.ZodEnum<{
|
|
11
|
+
fresh: "fresh";
|
|
12
|
+
resync: "resync";
|
|
13
|
+
}>;
|
|
14
|
+
export declare const BuildBillingEventSchema: z.ZodObject<{
|
|
15
|
+
kind: z.ZodLiteral<"interf-build-billing-event">;
|
|
16
|
+
version: z.ZodLiteral<1>;
|
|
17
|
+
timestamp: z.ZodString;
|
|
18
|
+
run_id: z.ZodString;
|
|
19
|
+
project: z.ZodString;
|
|
20
|
+
artifact_id: z.ZodString;
|
|
21
|
+
build_plan_id: z.ZodString;
|
|
22
|
+
account_id: z.ZodNullable<z.ZodString>;
|
|
23
|
+
event_kind: z.ZodEnum<{
|
|
24
|
+
fresh: "fresh";
|
|
25
|
+
resync: "resync";
|
|
26
|
+
}>;
|
|
27
|
+
size_class: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
small: "small";
|
|
29
|
+
medium: "medium";
|
|
30
|
+
large: "large";
|
|
31
|
+
}>>;
|
|
32
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export type BuildBillingEvent = z.infer<typeof BuildBillingEventSchema>;
|
|
35
|
+
export type BillingEventKind = z.infer<typeof BillingEventKindSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* Sink for billing events.
|
|
38
|
+
*
|
|
39
|
+
* The local default writes an observability fixture at
|
|
40
|
+
* `.interf/runtime/billing-events/<run-id>/billing-events.jsonl`. Hosted
|
|
41
|
+
* variants can inject a remote sink through `startLocalService` options; the
|
|
42
|
+
* engine treats either implementation identically.
|
|
43
|
+
*/
|
|
44
|
+
export interface BillingEventSink {
|
|
45
|
+
emit(event: BuildBillingEvent): void;
|
|
46
|
+
}
|
|
47
|
+
export declare class JsonlBillingEventSink implements BillingEventSink {
|
|
48
|
+
private readonly logPath;
|
|
49
|
+
constructor(logPath: string);
|
|
50
|
+
emit(event: BuildBillingEvent): void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Default sink path for a run. Each Build run gets its own JSONL
|
|
54
|
+
* file under hidden runtime metadata, not beside agent-facing Artifacts.
|
|
55
|
+
*/
|
|
56
|
+
export declare function defaultBillingEventLogPath(options: {
|
|
57
|
+
projectDataDir: string;
|
|
58
|
+
projectName: string;
|
|
59
|
+
runId: string;
|
|
60
|
+
}): string;
|
|
61
|
+
/**
|
|
62
|
+
* Convert a list of per-Artifact statuses into build events for
|
|
63
|
+
* the run. Only `ready` and `failed` artifacts emit events — `skipped`
|
|
64
|
+
* and `not_ready` represent work that didn't happen and shouldn't bill.
|
|
65
|
+
*
|
|
66
|
+
* Local builds currently emit `event_kind: "fresh"` only. The `resync` value is
|
|
67
|
+
* reserved for incremental rebuilds.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildBillingEventsForRun(options: {
|
|
70
|
+
runId: string;
|
|
71
|
+
project: string;
|
|
72
|
+
buildPlanId: string;
|
|
73
|
+
accountId: string | null;
|
|
74
|
+
artifacts: readonly ArtifactStatus[];
|
|
75
|
+
startedAt?: string | null;
|
|
76
|
+
finishedAt?: string | null;
|
|
77
|
+
timestamp?: string;
|
|
78
|
+
}): BuildBillingEvent[];
|