@interf/compiler 0.33.0 → 0.50.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 +122 -226
- package/dist/cli/commands/agents.js +1 -32
- package/dist/cli/commands/benchmark.d.ts +2 -3
- package/dist/cli/commands/benchmark.js +1 -31
- package/dist/cli/commands/build-plan.js +26 -50
- package/dist/cli/commands/build.d.ts +2 -3
- package/dist/cli/commands/build.js +1 -31
- package/dist/cli/commands/graphs.js +177 -32
- package/dist/cli/commands/mcp.d.ts +1 -0
- package/dist/cli/commands/mcp.js +223 -126
- package/dist/cli/commands/project.js +10 -36
- package/dist/cli/commands/reset.d.ts +2 -3
- package/dist/cli/commands/reset.js +1 -22
- package/dist/cli/commands/runs.js +86 -33
- package/dist/cli/commands/status.js +3 -24
- package/dist/cli/commands/traces.js +1 -29
- package/dist/cli/commands/wizard.js +17 -29
- package/dist/cli/lib/http-client.d.ts +39 -0
- package/dist/cli/lib/http-client.js +73 -0
- package/dist/packages/build-plans/authoring/brief.d.ts +25 -4
- package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +42 -1
- package/dist/packages/build-plans/authoring/build-plan-authoring.js +470 -63
- package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +9 -0
- package/dist/packages/build-plans/authoring/build-plan-edit-session.js +27 -10
- package/dist/packages/build-plans/authoring/build-plan-improvement.js +62 -8
- package/dist/packages/build-plans/authoring/lib/build-plan-edit-utils.d.ts +1 -0
- package/dist/packages/build-plans/package/build-plan-definitions.d.ts +0 -1
- package/dist/packages/build-plans/package/build-plan-definitions.js +5 -3
- package/dist/packages/build-plans/package/build-plan-stage-runner.d.ts +1 -0
- package/dist/packages/build-plans/package/build-plan-stage-runner.js +2 -1
- package/dist/packages/build-plans/package/builtin-build-plan.d.ts +2 -2
- package/dist/packages/build-plans/package/builtin-build-plan.js +3 -3
- package/dist/packages/build-plans/package/context-interface.d.ts +3 -0
- package/dist/packages/build-plans/package/context-interface.js +5 -5
- package/dist/packages/build-plans/package/interf-build-plan-package.js +22 -22
- package/dist/packages/build-plans/package/local-build-plans.d.ts +10 -5
- package/dist/packages/build-plans/package/local-build-plans.js +57 -32
- package/dist/packages/contracts/index.d.ts +4 -3
- package/dist/packages/contracts/index.js +2 -1
- package/dist/packages/contracts/lib/context-graph-layer.d.ts +161 -0
- package/dist/packages/contracts/lib/context-graph-layer.js +216 -0
- package/dist/packages/contracts/lib/project-paths.d.ts +7 -0
- package/dist/packages/contracts/lib/project-paths.js +9 -0
- package/dist/packages/contracts/lib/project-schema.d.ts +264 -1
- package/dist/packages/contracts/lib/project-schema.js +38 -13
- package/dist/packages/contracts/lib/schema.d.ts +556 -23
- package/dist/packages/contracts/lib/schema.js +279 -18
- package/dist/packages/contracts/utils/filesystem.d.ts +1 -0
- package/dist/packages/contracts/utils/filesystem.js +29 -1
- package/dist/packages/projects/lib/schema.d.ts +6 -8
- package/dist/packages/projects/lib/schema.js +3 -1
- package/dist/packages/projects/source-config.d.ts +0 -5
- package/dist/packages/projects/source-config.js +9 -22
- package/dist/packages/runtime/actions/fields.d.ts +4 -0
- package/dist/packages/runtime/actions/form-builders.js +79 -31
- package/dist/packages/runtime/actions/form-validators.js +9 -3
- package/dist/packages/runtime/actions/helpers.js +3 -3
- package/dist/packages/runtime/actions/registry.d.ts +1 -1
- package/dist/packages/runtime/actions/registry.js +1 -1
- package/dist/packages/runtime/actions/requests.d.ts +1 -1
- package/dist/packages/runtime/actions/requests.js +12 -6
- package/dist/packages/runtime/actions/schemas.d.ts +7 -0
- package/dist/packages/runtime/actions/schemas.js +1 -0
- package/dist/packages/runtime/agent-handoff.js +8 -7
- package/dist/packages/runtime/agents/lib/execution-profile.d.ts +14 -0
- package/dist/packages/runtime/agents/lib/execution-profile.js +23 -0
- package/dist/packages/runtime/agents/lib/execution.js +14 -8
- package/dist/packages/runtime/agents/lib/executors.d.ts +1 -0
- package/dist/packages/runtime/agents/lib/executors.js +11 -2
- package/dist/packages/runtime/agents/lib/logs.d.ts +10 -0
- package/dist/packages/runtime/agents/lib/logs.js +32 -8
- package/dist/packages/runtime/agents/lib/preflight.js +4 -1
- package/dist/packages/runtime/agents/lib/render.d.ts +18 -0
- package/dist/packages/runtime/agents/lib/render.js +44 -18
- package/dist/packages/runtime/agents/lib/shell-templates.js +105 -63
- package/dist/packages/runtime/agents/lib/shells.d.ts +29 -0
- package/dist/packages/runtime/agents/lib/shells.js +158 -32
- package/dist/packages/runtime/agents/lib/source-context-scan.d.ts +10 -0
- package/dist/packages/runtime/agents/lib/source-context-scan.js +388 -0
- package/dist/packages/runtime/agents/lib/status.js +1 -14
- package/dist/packages/runtime/agents/lib/string-utils.d.ts +16 -0
- package/dist/packages/runtime/agents/lib/string-utils.js +36 -0
- package/dist/packages/runtime/agents/lib/types.d.ts +1 -0
- package/dist/packages/runtime/agents/providers/codex.js +2 -0
- package/dist/packages/runtime/agents/role-executors.js +2 -1
- package/dist/packages/runtime/auth/session-store.js +11 -3
- package/dist/packages/runtime/benchmark-question-draft.d.ts +3 -0
- package/dist/packages/runtime/benchmark-question-draft.js +57 -28
- package/dist/packages/runtime/build/artifact-status.d.ts +1 -1
- package/dist/packages/runtime/build/artifact-status.js +1 -1
- package/dist/packages/runtime/build/build-evidence.d.ts +2 -1
- package/dist/packages/runtime/build/build-evidence.js +11 -5
- package/dist/packages/runtime/build/build-pipeline.js +89 -5
- package/dist/packages/runtime/build/build-stage-plan.js +3 -1
- package/dist/packages/runtime/build/build-stage-runner.js +169 -32
- package/dist/packages/runtime/build/build-target.d.ts +3 -0
- package/dist/packages/runtime/build/build-target.js +25 -1
- package/dist/packages/runtime/build/check-evaluator.d.ts +1 -1
- package/dist/packages/runtime/build/check-evaluator.js +655 -4
- package/dist/packages/runtime/build/context-graph-paths.d.ts +13 -0
- package/dist/packages/runtime/build/context-graph-paths.js +27 -0
- package/dist/packages/runtime/build/index.d.ts +2 -2
- package/dist/packages/runtime/build/index.js +2 -2
- package/dist/packages/runtime/build/inspect-map.d.ts +10 -0
- package/dist/packages/runtime/build/inspect-map.js +270 -0
- package/dist/packages/runtime/build/lib/schema.d.ts +246 -53
- package/dist/packages/runtime/build/lib/schema.js +173 -15
- package/dist/packages/runtime/build/native-entrypoint.d.ts +2 -0
- package/dist/packages/runtime/build/native-entrypoint.js +286 -0
- package/dist/packages/runtime/build/runtime-contracts.js +9 -3
- package/dist/packages/runtime/build/runtime-log-paths.d.ts +3 -0
- package/dist/packages/runtime/build/runtime-log-paths.js +16 -0
- package/dist/packages/runtime/build/runtime-prompt.js +6 -4
- package/dist/packages/runtime/build/runtime-runs.js +63 -10
- package/dist/packages/runtime/build/runtime-types.d.ts +4 -1
- package/dist/packages/runtime/build/runtime.d.ts +3 -1
- package/dist/packages/runtime/build/runtime.js +3 -1
- package/dist/packages/runtime/build/source-files.js +11 -2
- package/dist/packages/runtime/build/source-inventory.d.ts +1 -0
- package/dist/packages/runtime/build/source-inventory.js +246 -7
- package/dist/packages/runtime/build/source-manifest.d.ts +11 -0
- package/dist/packages/runtime/build/source-manifest.js +30 -2
- package/dist/packages/runtime/build/stage-evidence.js +80 -11
- package/dist/packages/runtime/build/stage-manifest.d.ts +45 -0
- package/dist/packages/runtime/build/stage-manifest.js +1125 -0
- package/dist/packages/runtime/build/stage-reuse.js +12 -0
- package/dist/packages/runtime/build/stage-session.d.ts +81 -0
- package/dist/packages/runtime/build/stage-session.js +308 -0
- package/dist/packages/runtime/build/state-io.js +10 -11
- package/dist/packages/runtime/build/state-view.js +1 -1
- package/dist/packages/runtime/build/state.d.ts +1 -1
- package/dist/packages/runtime/build/state.js +1 -1
- package/dist/packages/runtime/build/summary-coverage-index.d.ts +21 -0
- package/dist/packages/runtime/build/summary-coverage-index.js +189 -0
- package/dist/packages/runtime/build/traces.js +3 -3
- package/dist/packages/runtime/build/validate-context-graph.d.ts +1 -1
- package/dist/packages/runtime/build/validate-context-graph.js +5 -5
- package/dist/packages/runtime/build/validate.d.ts +1 -1
- package/dist/packages/runtime/build/validate.js +1 -1
- package/dist/packages/runtime/client.d.ts +3 -3
- package/dist/packages/runtime/client.js +8 -13
- package/dist/packages/runtime/context-checks.js +13 -0
- package/dist/packages/runtime/context-graph-scaffold.js +2 -1
- package/dist/packages/runtime/context-graph-semantic-graph.d.ts +9 -0
- package/dist/packages/runtime/context-graph-semantic-graph.js +416 -0
- package/dist/packages/runtime/execution/lib/schema.d.ts +34 -31
- package/dist/packages/runtime/index.d.ts +2 -2
- package/dist/packages/runtime/index.js +1 -1
- package/dist/packages/runtime/native-run-handlers.d.ts +38 -0
- package/dist/packages/runtime/native-run-handlers.js +52 -33
- package/dist/packages/runtime/plan-artifact-contract.js +1 -1
- package/dist/packages/runtime/project-source-state.d.ts +4 -4
- package/dist/packages/runtime/project-source-state.js +5 -2
- package/dist/packages/runtime/project-store.d.ts +5 -0
- package/dist/packages/runtime/project-store.js +30 -3
- package/dist/packages/runtime/requested-artifacts.js +1 -1
- package/dist/packages/runtime/run-observability.js +9 -4
- package/dist/packages/runtime/runtime-action-proposals.js +3 -3
- package/dist/packages/runtime/runtime-build-plans.js +47 -3
- package/dist/packages/runtime/runtime-build-runs.js +9 -16
- package/dist/packages/runtime/runtime-caches.d.ts +26 -0
- package/dist/packages/runtime/runtime-caches.js +47 -0
- package/dist/packages/runtime/runtime-jobs.js +6 -6
- package/dist/packages/runtime/runtime-project-mutations.js +1 -0
- package/dist/packages/runtime/runtime-project-reads.d.ts +4 -1
- package/dist/packages/runtime/runtime-project-reads.js +229 -36
- package/dist/packages/runtime/runtime-proposal-helpers.js +6 -6
- package/dist/packages/runtime/runtime-resource-builders.d.ts +4 -2
- package/dist/packages/runtime/runtime-resource-builders.js +16 -14
- package/dist/packages/runtime/runtime-status.d.ts +14 -0
- package/dist/packages/runtime/runtime-status.js +15 -0
- package/dist/packages/runtime/runtime-verify-runs.js +6 -5
- package/dist/packages/runtime/runtime.d.ts +439 -22
- package/dist/packages/runtime/runtime.js +16 -2
- package/dist/packages/runtime/schemas/actions.d.ts +24 -0
- package/dist/packages/runtime/schemas/agents.d.ts +28 -0
- package/dist/packages/runtime/schemas/agents.js +33 -0
- package/dist/packages/runtime/schemas/build-plans.d.ts +181 -8
- package/dist/packages/runtime/schemas/build-plans.js +36 -2
- package/dist/packages/runtime/schemas/context-graphs.d.ts +1522 -0
- package/dist/packages/runtime/schemas/context-graphs.js +110 -0
- package/dist/packages/runtime/schemas/files.d.ts +7 -347
- package/dist/packages/runtime/schemas/files.js +1 -24
- package/dist/packages/runtime/schemas/index.d.ts +1 -0
- package/dist/packages/runtime/schemas/index.js +1 -0
- package/dist/packages/runtime/schemas/jobs.js +4 -0
- package/dist/packages/runtime/schemas/projects.d.ts +48 -21
- package/dist/packages/runtime/schemas/projects.js +34 -10
- package/dist/packages/runtime/schemas/runs.d.ts +1009 -240
- package/dist/packages/runtime/schemas/runs.js +17 -0
- package/dist/packages/runtime/service/openapi.js +1 -0
- package/dist/packages/runtime/service/operations.d.ts +1666 -145
- package/dist/packages/runtime/service/operations.js +147 -17
- package/dist/packages/runtime/service/routes.d.ts +11 -3
- package/dist/packages/runtime/service/routes.js +11 -3
- package/dist/packages/runtime/service/server-app-boot.js +2 -2
- package/dist/packages/runtime/service/server-helpers.d.ts +11 -0
- package/dist/packages/runtime/service/server-helpers.js +19 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.js +4 -2
- package/dist/packages/runtime/service/server-routes-agents.js +19 -85
- package/dist/packages/runtime/service/server-routes-build-plans.js +14 -11
- package/dist/packages/runtime/service/server-routes-project-context.js +102 -7
- package/dist/packages/runtime/service/server-routes-project-jobs.js +19 -12
- package/dist/packages/runtime/service/server-routes-project-runs.js +5 -2
- package/dist/packages/runtime/service/server-routes-projects.js +6 -2
- package/dist/packages/runtime/service/server-routes-runs.js +11 -4
- package/dist/packages/runtime/verify/lib/schema.js +12 -0
- package/dist/packages/runtime/verify/test-file-guard.d.ts +2 -0
- package/dist/packages/runtime/verify/test-file-guard.js +29 -0
- package/dist/packages/runtime/verify/verify-execution.d.ts +7 -0
- package/dist/packages/runtime/verify/verify-execution.js +109 -35
- package/dist/packages/runtime/verify/verify-paths.d.ts +1 -0
- package/dist/packages/runtime/verify/verify-paths.js +4 -0
- package/dist/packages/runtime/verify/verify-specs.js +49 -39
- package/dist/packages/runtime/wire-schemas.d.ts +1 -1
- package/dist/packages/runtime/wire-schemas.js +1 -1
- package/package.json +2 -8
- package/public-repo/CONTRIBUTING.md +10 -3
- package/public-repo/README.md +122 -226
- package/public-repo/build-plans/interf-default/README.md +15 -12
- package/public-repo/build-plans/interf-default/build/stages/entrypoint/SKILL.md +74 -0
- package/public-repo/build-plans/interf-default/build/stages/knowledge/SKILL.md +95 -0
- package/public-repo/build-plans/interf-default/build/stages/summarize/SKILL.md +38 -5
- package/public-repo/build-plans/interf-default/build-plan.json +27 -23
- package/public-repo/build-plans/interf-default/build-plan.schema.json +24 -20
- package/public-repo/build-plans/interf-default/use/query/SKILL.md +8 -7
- package/public-repo/openapi/local-service.openapi.json +11637 -4213
- package/public-repo/skills/interf/SKILL.md +174 -134
- package/dist/packages/runtime/build/runtime-paths.d.ts +0 -8
- package/dist/packages/runtime/build/runtime-paths.js +0 -26
- package/dist/packages/runtime/build/state-paths.d.ts +0 -7
- package/dist/packages/runtime/build/state-paths.js +0 -22
- package/public-repo/build-plans/interf-default/build/stages/shape/SKILL.md +0 -34
- package/public-repo/build-plans/interf-default/build/stages/structure/SKILL.md +0 -28
|
@@ -8,8 +8,8 @@ export * as client from "./client.js";
|
|
|
8
8
|
export * as runtime from "./runtime.js";
|
|
9
9
|
export * as server from "./service/server.js";
|
|
10
10
|
export * as agentHandoff from "./agent-handoff.js";
|
|
11
|
-
export type { BuildRunCreateRequest, BuildRunResource, BuildRunSummary, InterfMcpHandoff, InterfMcpServer, LocalServiceDiscovery, ContextGraphMapping, ProjectRunLinkage, ProjectResource, ProjectWireShape, BuildPlanResource, LocalJobAgent, LocalJobEvent, LocalJobEventAppendRequest, LocalJobEventType, LocalJobRunCreateRequest, LocalJobRunResource, LocalJobStatus, LocalRunHandlerResult, LocalJobStep, LocalJobType, LocalServiceConfig, LocalServiceError, LocalServiceHealth, LocalExecutorStatus, ActionClientOrigin, ActionProposalApproval, ActionProposalApprovalRequest, ActionProposalCreateRequest, ActionProposalListResponse, ActionProposalPlan, ActionProposalPlanActionType, ActionProposalResource, ActionProposalStatus, ActionProposalType, BuildPlanChangeResult, ProjectChangeResult, ProjectSetupResult, ResetRequest, ResetResult, ContextGraphResource, BuildEvidenceResource, ReadinessResource, SourceFileResource, BenchmarkQuestionDraftCreateRequest, BenchmarkQuestionDraftRuntimeRequest, BenchmarkQuestionDraftResult, VerifyRunCreateRequest, VerifyRunResource, VerifyRunStatus, RunObservabilityListResponse, RunObservabilityResource, RunArtifactsResponse, BuildPlanAuthoringCreateRequest, BuildPlanAuthoringRuntimeRequest, BuildPlanAuthoringResult, ProjectListResponse, BuildPlanListResponse, OpenPathRequest, OpenPathResponse, } from "./schemas/index.js";
|
|
12
|
-
export { BuildRunCreateRequestSchema, BuildRunResourceSchema, BuildRunSummarySchema, InterfMcpHandoffSchema, InterfMcpServerSchema, LocalServiceDiscoverySchema, ContextGraphMappingSchema, ProjectRunLinkageSchema, ProjectResourceSchema, ProjectWireShapeSchema, BuildPlanResourceSchema, LocalJobAgentSchema, LocalJobEventAppendRequestSchema, LocalJobEventSchema, LocalJobEventTypeSchema, LocalJobRunCreateRequestSchema, LocalJobRunResourceSchema, LocalJobStatusSchema, LocalRunHandlerResultSchema, LocalJobStepSchema, LocalJobTypeSchema, LocalServiceConfigSchema, LocalServiceErrorSchema, LocalServiceHealthSchema, ContextGraphResourceSchema, BuildEvidenceResourceSchema, ReadinessResourceSchema, SourceFileResourceSchema, BenchmarkQuestionDraftCreateRequestSchema, BenchmarkQuestionDraftRuntimeRequestSchema, BenchmarkQuestionDraftResultSchema, VerifyRunCreateRequestSchema, VerifyRunResourceSchema, VerifyRunStatusSchema, RunObservabilityResourceSchema, RunObservabilityListResponseSchema, RunArtifactsResponseSchema, LocalExecutorStatusSchema, ActionClientOriginSchema, ActionProposalApprovalRequestSchema, ActionProposalApprovalSchema, ActionProposalCreateRequestSchema, ActionProposalListResponseSchema, ActionProposalPlanSchema, ActionProposalPlanActionTypeSchema, ActionProposalResourceSchema, ActionProposalStatusSchema, ActionProposalTypeSchema, ResetRequestSchema, ResetResultSchema, BuildPlanAuthoringCreateRequestSchema, BuildPlanAuthoringRuntimeRequestSchema, BuildPlanAuthoringResultSchema, ProjectListResponseSchema, BuildPlanListResponseSchema, OpenPathRequestSchema, OpenPathResponseSchema, } from "./schemas/index.js";
|
|
11
|
+
export type { BuildRunCreateRequest, BuildRunResource, BuildRunSummary, InterfMcpHandoff, InterfMcpServer, LocalServiceDiscovery, ContextGraphMapping, ProjectCreateRequest, ProjectRunLinkage, ProjectResource, ProjectUpdateRequest, ProjectWireShape, BuildPlanResource, LocalJobAgent, LocalJobEvent, LocalJobEventAppendRequest, LocalJobEventType, LocalJobRunCreateRequest, LocalJobRunResource, LocalJobStatus, LocalRunHandlerResult, LocalJobStep, LocalJobType, LocalServiceConfig, LocalServiceError, LocalServiceHealth, LocalExecutorStatus, ActionClientOrigin, ActionProposalApproval, ActionProposalApprovalRequest, ActionProposalCreateRequest, ActionProposalListResponse, ActionProposalPlan, ActionProposalPlanActionType, ActionProposalResource, ActionProposalStatus, ActionProposalType, BuildPlanChangeResult, ProjectChangeResult, ProjectSetupResult, ResetRequest, ResetResult, ContextGraphResource, ContextGraphSemanticEdge, ContextGraphSemanticEdgeKind, ContextGraphSemanticGraph, ContextGraphSemanticNode, ContextGraphSemanticNodeKind, StageExecutionSession, BuildEvidenceResource, ReadinessResource, SourceFileResource, BenchmarkQuestionDraftCreateRequest, BenchmarkQuestionDraftRuntimeRequest, BenchmarkQuestionDraftResult, VerifyRunCreateRequest, VerifyRunResource, VerifyRunStatus, RunObservabilityListResponse, RunObservabilityResource, RunArtifactsResponse, BuildPlanAuthoringCreateRequest, BuildPlanAuthoringRuntimeRequest, BuildPlanAuthoringResult, ProjectListResponse, BuildPlanListResponse, OpenPathRequest, OpenPathResponse, } from "./schemas/index.js";
|
|
12
|
+
export { BuildRunCreateRequestSchema, BuildRunResourceSchema, BuildRunSummarySchema, InterfMcpHandoffSchema, InterfMcpServerSchema, LocalServiceDiscoverySchema, ContextGraphMappingSchema, ProjectCreateRequestSchema, ProjectRunLinkageSchema, ProjectResourceSchema, ProjectUpdateRequestSchema, ProjectWireShapeSchema, BuildPlanResourceSchema, LocalJobAgentSchema, LocalJobEventAppendRequestSchema, LocalJobEventSchema, LocalJobEventTypeSchema, LocalJobRunCreateRequestSchema, LocalJobRunResourceSchema, LocalJobStatusSchema, LocalRunHandlerResultSchema, LocalJobStepSchema, LocalJobTypeSchema, LocalServiceConfigSchema, LocalServiceErrorSchema, LocalServiceHealthSchema, ContextGraphResourceSchema, ContextGraphSemanticEdgeKindSchema, ContextGraphSemanticEdgeSchema, ContextGraphSemanticGraphSchema, ContextGraphSemanticNodeKindSchema, ContextGraphSemanticNodeSchema, StageExecutionSessionSchema, BuildEvidenceResourceSchema, ReadinessResourceSchema, SourceFileResourceSchema, BenchmarkQuestionDraftCreateRequestSchema, BenchmarkQuestionDraftRuntimeRequestSchema, BenchmarkQuestionDraftResultSchema, VerifyRunCreateRequestSchema, VerifyRunResourceSchema, VerifyRunStatusSchema, RunObservabilityResourceSchema, RunObservabilityListResponseSchema, RunArtifactsResponseSchema, LocalExecutorStatusSchema, ActionClientOriginSchema, ActionProposalApprovalRequestSchema, ActionProposalApprovalSchema, ActionProposalCreateRequestSchema, ActionProposalListResponseSchema, ActionProposalPlanSchema, ActionProposalPlanActionTypeSchema, ActionProposalResourceSchema, ActionProposalStatusSchema, ActionProposalTypeSchema, ResetRequestSchema, ResetResultSchema, BuildPlanAuthoringCreateRequestSchema, BuildPlanAuthoringRuntimeRequestSchema, BuildPlanAuthoringResultSchema, ProjectListResponseSchema, BuildPlanListResponseSchema, OpenPathRequestSchema, OpenPathResponseSchema, } from "./schemas/index.js";
|
|
13
13
|
export type { HttpMethod, ServiceOperation, ServiceOperationId, ServiceOperationParameter, ServiceOperationVisibility, } from "./service/operations.js";
|
|
14
14
|
export { APP_PROFILE_OPERATION_IDS, EmptyObjectSchema, SERVICE_OPERATIONS, serviceOperationById, } from "./service/operations.js";
|
|
15
15
|
export { buildOpenApiDocument, } from "./service/openapi.js";
|
|
@@ -8,7 +8,7 @@ export * as client from "./client.js";
|
|
|
8
8
|
export * as runtime from "./runtime.js";
|
|
9
9
|
export * as server from "./service/server.js";
|
|
10
10
|
export * as agentHandoff from "./agent-handoff.js";
|
|
11
|
-
export { BuildRunCreateRequestSchema, BuildRunResourceSchema, BuildRunSummarySchema, InterfMcpHandoffSchema, InterfMcpServerSchema, LocalServiceDiscoverySchema, ContextGraphMappingSchema, ProjectRunLinkageSchema, ProjectResourceSchema, ProjectWireShapeSchema, BuildPlanResourceSchema, LocalJobAgentSchema, LocalJobEventAppendRequestSchema, LocalJobEventSchema, LocalJobEventTypeSchema, LocalJobRunCreateRequestSchema, LocalJobRunResourceSchema, LocalJobStatusSchema, LocalRunHandlerResultSchema, LocalJobStepSchema, LocalJobTypeSchema, LocalServiceConfigSchema, LocalServiceErrorSchema, LocalServiceHealthSchema, ContextGraphResourceSchema, BuildEvidenceResourceSchema, ReadinessResourceSchema, SourceFileResourceSchema, BenchmarkQuestionDraftCreateRequestSchema, BenchmarkQuestionDraftRuntimeRequestSchema, BenchmarkQuestionDraftResultSchema, VerifyRunCreateRequestSchema, VerifyRunResourceSchema, VerifyRunStatusSchema, RunObservabilityResourceSchema, RunObservabilityListResponseSchema, RunArtifactsResponseSchema, LocalExecutorStatusSchema, ActionClientOriginSchema, ActionProposalApprovalRequestSchema, ActionProposalApprovalSchema, ActionProposalCreateRequestSchema, ActionProposalListResponseSchema, ActionProposalPlanSchema, ActionProposalPlanActionTypeSchema, ActionProposalResourceSchema, ActionProposalStatusSchema, ActionProposalTypeSchema, ResetRequestSchema, ResetResultSchema, BuildPlanAuthoringCreateRequestSchema, BuildPlanAuthoringRuntimeRequestSchema, BuildPlanAuthoringResultSchema, ProjectListResponseSchema, BuildPlanListResponseSchema, OpenPathRequestSchema, OpenPathResponseSchema, } from "./schemas/index.js";
|
|
11
|
+
export { BuildRunCreateRequestSchema, BuildRunResourceSchema, BuildRunSummarySchema, InterfMcpHandoffSchema, InterfMcpServerSchema, LocalServiceDiscoverySchema, ContextGraphMappingSchema, ProjectCreateRequestSchema, ProjectRunLinkageSchema, ProjectResourceSchema, ProjectUpdateRequestSchema, ProjectWireShapeSchema, BuildPlanResourceSchema, LocalJobAgentSchema, LocalJobEventAppendRequestSchema, LocalJobEventSchema, LocalJobEventTypeSchema, LocalJobRunCreateRequestSchema, LocalJobRunResourceSchema, LocalJobStatusSchema, LocalRunHandlerResultSchema, LocalJobStepSchema, LocalJobTypeSchema, LocalServiceConfigSchema, LocalServiceErrorSchema, LocalServiceHealthSchema, ContextGraphResourceSchema, ContextGraphSemanticEdgeKindSchema, ContextGraphSemanticEdgeSchema, ContextGraphSemanticGraphSchema, ContextGraphSemanticNodeKindSchema, ContextGraphSemanticNodeSchema, StageExecutionSessionSchema, BuildEvidenceResourceSchema, ReadinessResourceSchema, SourceFileResourceSchema, BenchmarkQuestionDraftCreateRequestSchema, BenchmarkQuestionDraftRuntimeRequestSchema, BenchmarkQuestionDraftResultSchema, VerifyRunCreateRequestSchema, VerifyRunResourceSchema, VerifyRunStatusSchema, RunObservabilityResourceSchema, RunObservabilityListResponseSchema, RunArtifactsResponseSchema, LocalExecutorStatusSchema, ActionClientOriginSchema, ActionProposalApprovalRequestSchema, ActionProposalApprovalSchema, ActionProposalCreateRequestSchema, ActionProposalListResponseSchema, ActionProposalPlanSchema, ActionProposalPlanActionTypeSchema, ActionProposalResourceSchema, ActionProposalStatusSchema, ActionProposalTypeSchema, ResetRequestSchema, ResetResultSchema, BuildPlanAuthoringCreateRequestSchema, BuildPlanAuthoringRuntimeRequestSchema, BuildPlanAuthoringResultSchema, ProjectListResponseSchema, BuildPlanListResponseSchema, OpenPathRequestSchema, OpenPathResponseSchema, } from "./schemas/index.js";
|
|
12
12
|
export { APP_PROFILE_OPERATION_IDS, EmptyObjectSchema, SERVICE_OPERATIONS, serviceOperationById, } from "./service/operations.js";
|
|
13
13
|
export { buildOpenApiDocument, } from "./service/openapi.js";
|
|
14
14
|
export { buildInterfMcpServers, buildInterfMcpHandoff, buildInterfMcpInstructions, } from "./agent-handoff.js";
|
|
@@ -3,11 +3,48 @@ import type { AgentExecutionProfile, AgentExecutor } from "./agents/lib/executor
|
|
|
3
3
|
import type { ProjectConfig } from "../projects/lib/schema.js";
|
|
4
4
|
import type { StageShellRetentionMode } from "./build/build-plan-runs.js";
|
|
5
5
|
import { type RunEventSink } from "./execution/events.js";
|
|
6
|
+
import { type SavedBenchmarkOutcome } from "./verify/benchmark-run.js";
|
|
6
7
|
import type { LocalServiceRunHandlers } from "./runtime.js";
|
|
7
8
|
export interface NativeLocalServiceRunHandlerOptions {
|
|
8
9
|
executor?: AgentExecutor;
|
|
9
10
|
testExecutor?: AgentExecutor;
|
|
10
11
|
}
|
|
12
|
+
export declare function testScore(outcome: SavedBenchmarkOutcome): number;
|
|
13
|
+
interface BuildPlanVariationRunResult {
|
|
14
|
+
passed: boolean;
|
|
15
|
+
attemptsRun: number;
|
|
16
|
+
failedStage: string | null;
|
|
17
|
+
bestOutcome: SavedBenchmarkOutcome | null;
|
|
18
|
+
bestGraphBackupPath: string | null;
|
|
19
|
+
bestAttempt: number;
|
|
20
|
+
fatalError: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Single mutated accumulator for the cross-variation best-build selection.
|
|
24
|
+
*
|
|
25
|
+
* Replaces the five locals (`bestOutcome`, `bestGraphBackupPath`,
|
|
26
|
+
* `bestAttempt`, `bestVariation`, plus their adoption closure) that used to be
|
|
27
|
+
* threaded through `runConfiguredBuild`. The reader now holds one object whose
|
|
28
|
+
* fields are the selected best and whose `consider` method owns the exact
|
|
29
|
+
* adopt-or-prune lifecycle:
|
|
30
|
+
*
|
|
31
|
+
* - A variation result is adopted only when it carries both a benchmark outcome
|
|
32
|
+
* and a captured backup AND strictly beats the current best by `testScore`.
|
|
33
|
+
* - On adoption the previously held backup is pruned and the new one is taken
|
|
34
|
+
* over (the source result's backup ownership is transferred away).
|
|
35
|
+
* - A non-adopted result's backup is pruned immediately.
|
|
36
|
+
*
|
|
37
|
+
* `prune` is injected so the disk-free callers (tests) can observe pruning
|
|
38
|
+
* order without touching the filesystem; production passes the real `rmSync`.
|
|
39
|
+
*/
|
|
40
|
+
export interface VariationBestTracker {
|
|
41
|
+
outcome: SavedBenchmarkOutcome | null;
|
|
42
|
+
backupPath: string | null;
|
|
43
|
+
attempt: number;
|
|
44
|
+
variation: number;
|
|
45
|
+
}
|
|
46
|
+
export declare function createVariationBestTracker(): VariationBestTracker;
|
|
47
|
+
export declare function considerVariationBest(tracker: VariationBestTracker, variation: number, result: BuildPlanVariationRunResult, prune: (backupPath: string) => void): void;
|
|
11
48
|
export declare function runConfiguredBuild(options: {
|
|
12
49
|
executor: AgentExecutor;
|
|
13
50
|
testExecutor?: AgentExecutor | null;
|
|
@@ -23,3 +60,4 @@ export declare function runConfiguredBuild(options: {
|
|
|
23
60
|
events?: RunEventSink;
|
|
24
61
|
}): Promise<boolean>;
|
|
25
62
|
export declare function createNativeLocalServiceRunHandlers(options?: NativeLocalServiceRunHandlerOptions): Pick<LocalServiceRunHandlers, "planActionProposal" | "createBuildRun" | "createVerifyRun" | "createBenchmarkQuestionDraft" | "createBuildPlanAuthoringRun">;
|
|
63
|
+
export {};
|
|
@@ -19,6 +19,7 @@ import { initializeBuildRuntimeState } from "./build/state.js";
|
|
|
19
19
|
import { benchmarkPassRate, runBenchmarkForExecutor, runSavedContextGraphBenchmark, } from "./verify/benchmark-run.js";
|
|
20
20
|
import { runBuildPlanAuthoringDraft, } from "../build-plans/authoring/build-plan-authoring.js";
|
|
21
21
|
import { draftBenchmarkQuestions, } from "./benchmark-question-draft.js";
|
|
22
|
+
import { asProjectDataDir, projectServiceJobShellsRoot, } from "../contracts/lib/project-paths.js";
|
|
22
23
|
import { planActionProposalWithExecutor, } from "./action-planner.js";
|
|
23
24
|
import { ActionProposalPlanSchema, } from "./schemas/index.js";
|
|
24
25
|
function printBuildFailure(contextGraphPath, failedStage) {
|
|
@@ -32,7 +33,7 @@ function printBuildFailure(contextGraphPath, failedStage) {
|
|
|
32
33
|
}
|
|
33
34
|
console.log(chalk.red(` ${failedStageLabel} failed.`));
|
|
34
35
|
}
|
|
35
|
-
function testScore(outcome) {
|
|
36
|
+
export function testScore(outcome) {
|
|
36
37
|
return (outcome.result.passedCases * 1000) + outcome.result.passedChecks;
|
|
37
38
|
}
|
|
38
39
|
async function buildContextGraphWithReporter(executor, contextGraphPath, options = {}) {
|
|
@@ -132,6 +133,28 @@ function restoreBestBuildState(backupPath, contextGraphPath) {
|
|
|
132
133
|
clearBuildRuntimeDerivedArtifacts(contextGraphPath);
|
|
133
134
|
initializeBuildRuntimeState(contextGraphPath);
|
|
134
135
|
}
|
|
136
|
+
export function createVariationBestTracker() {
|
|
137
|
+
return { outcome: null, backupPath: null, attempt: 0, variation: 0 };
|
|
138
|
+
}
|
|
139
|
+
export function considerVariationBest(tracker, variation, result, prune) {
|
|
140
|
+
if (result.bestOutcome &&
|
|
141
|
+
result.bestGraphBackupPath &&
|
|
142
|
+
(!tracker.outcome || testScore(result.bestOutcome) > testScore(tracker.outcome))) {
|
|
143
|
+
if (tracker.backupPath) {
|
|
144
|
+
prune(tracker.backupPath);
|
|
145
|
+
}
|
|
146
|
+
tracker.outcome = result.bestOutcome;
|
|
147
|
+
tracker.backupPath = result.bestGraphBackupPath;
|
|
148
|
+
tracker.attempt = result.bestAttempt;
|
|
149
|
+
tracker.variation = variation;
|
|
150
|
+
result.bestGraphBackupPath = null;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (result.bestGraphBackupPath) {
|
|
154
|
+
prune(result.bestGraphBackupPath);
|
|
155
|
+
result.bestGraphBackupPath = null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
135
158
|
async function runBuildPlanVariation(options) {
|
|
136
159
|
let bestOutcome = null;
|
|
137
160
|
let bestGraphBackupPath = null;
|
|
@@ -310,12 +333,19 @@ function printSelectedBuildPlanOwnership(contextGraphPath, bestVariation) {
|
|
|
310
333
|
console.log(chalk.dim(" Building this existing Context Graph again reuses that local Build Plan draft."));
|
|
311
334
|
}
|
|
312
335
|
export async function runConfiguredBuild(options) {
|
|
313
|
-
const preserveStageShells = options.preserveStageShells ?? "
|
|
336
|
+
const preserveStageShells = options.preserveStageShells ?? "always";
|
|
314
337
|
const configuredMaxAttempts = resolveBuildMaxAttempts(options.maxAttemptsOverride);
|
|
315
338
|
const maxLoops = resolveBuildMaxLoops(options.maxLoopsOverride);
|
|
316
339
|
const maxAttempts = configuredMaxAttempts ?? (maxLoops != null ? 1 : null);
|
|
317
340
|
const loopEnabled = maxAttempts != null;
|
|
318
|
-
|
|
341
|
+
// Read the persisted Interf config once for the entry path. `readInterfConfig`
|
|
342
|
+
// does fs I/O + JSON parse + zod validation, and nothing here mutates the
|
|
343
|
+
// config file before the improvement loop, so a single read drives the
|
|
344
|
+
// project-name fallback (below) and the improvement-loop config fallback
|
|
345
|
+
// identically. The in-loop read at the improvement step stays a live re-read
|
|
346
|
+
// because that loop edits the Build Plan/config between iterations.
|
|
347
|
+
const interfConfig = readInterfConfig(options.contextGraphPath);
|
|
348
|
+
const projectName = options.contextGraphConfig?.name ?? interfConfig?.name ?? "project";
|
|
319
349
|
const benchmarkSpec = buildTestSpecFromSourceFolderConfig({
|
|
320
350
|
projectDataDir: options.sourcePath,
|
|
321
351
|
targetName: projectName,
|
|
@@ -360,35 +390,19 @@ export async function runConfiguredBuild(options) {
|
|
|
360
390
|
});
|
|
361
391
|
return true;
|
|
362
392
|
}
|
|
363
|
-
|
|
364
|
-
let bestGraphBackupPath = null;
|
|
365
|
-
let bestAttempt = 0;
|
|
366
|
-
let bestVariation = 0;
|
|
393
|
+
const best = createVariationBestTracker();
|
|
367
394
|
const previousVariations = [];
|
|
368
395
|
const improvementRunId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
396
|
+
const pruneBackup = (backupPath) => rmSync(backupPath, { recursive: true, force: true });
|
|
369
397
|
try {
|
|
370
398
|
const contextGraphConfig = options.contextGraphConfig
|
|
371
399
|
?? loadContextGraphProjectConfig(options.contextGraphPath)
|
|
372
400
|
?? {
|
|
373
|
-
name:
|
|
401
|
+
name: interfConfig?.name ?? "project",
|
|
402
|
+
intent: interfConfig?.intent ?? "",
|
|
374
403
|
path: "./source-folder",
|
|
375
404
|
};
|
|
376
|
-
const adoptVariationBest = (variation, result) =>
|
|
377
|
-
if (result.bestOutcome && result.bestGraphBackupPath && (!bestOutcome || testScore(result.bestOutcome) > testScore(bestOutcome))) {
|
|
378
|
-
if (bestGraphBackupPath) {
|
|
379
|
-
rmSync(bestGraphBackupPath, { recursive: true, force: true });
|
|
380
|
-
}
|
|
381
|
-
bestOutcome = result.bestOutcome;
|
|
382
|
-
bestGraphBackupPath = result.bestGraphBackupPath;
|
|
383
|
-
bestAttempt = result.bestAttempt;
|
|
384
|
-
bestVariation = variation;
|
|
385
|
-
result.bestGraphBackupPath = null;
|
|
386
|
-
}
|
|
387
|
-
if (result.bestGraphBackupPath) {
|
|
388
|
-
rmSync(result.bestGraphBackupPath, { recursive: true, force: true });
|
|
389
|
-
result.bestGraphBackupPath = null;
|
|
390
|
-
}
|
|
391
|
-
};
|
|
405
|
+
const adoptVariationBest = (variation, result) => considerVariationBest(best, variation, result, pruneBackup);
|
|
392
406
|
const baseline = await runBuildPlanVariation({
|
|
393
407
|
executor: options.executor,
|
|
394
408
|
testExecutor: options.testExecutor,
|
|
@@ -480,7 +494,7 @@ export async function runConfiguredBuild(options) {
|
|
|
480
494
|
}));
|
|
481
495
|
if (variation.passed) {
|
|
482
496
|
printBuildPlanVariationSummary(previousVariations);
|
|
483
|
-
printSelectedBuildPlanOwnership(options.contextGraphPath,
|
|
497
|
+
printSelectedBuildPlanOwnership(options.contextGraphPath, best.variation);
|
|
484
498
|
printPostBuildNextStep({
|
|
485
499
|
contextGraphPath: options.contextGraphPath,
|
|
486
500
|
checks: benchmarkCheckCount,
|
|
@@ -490,30 +504,30 @@ export async function runConfiguredBuild(options) {
|
|
|
490
504
|
}
|
|
491
505
|
}
|
|
492
506
|
}
|
|
493
|
-
if (
|
|
494
|
-
restoreBestBuildState(
|
|
507
|
+
if (best.backupPath && best.variation > 0) {
|
|
508
|
+
restoreBestBuildState(best.backupPath, options.contextGraphPath);
|
|
495
509
|
console.log();
|
|
496
|
-
console.log(chalk.dim(` Restored the best-performing Context Graph from variation ${
|
|
510
|
+
console.log(chalk.dim(` Restored the best-performing Context Graph from variation ${best.variation}, attempt ${best.attempt}.`));
|
|
497
511
|
}
|
|
498
512
|
process.exitCode = 1;
|
|
499
513
|
console.log();
|
|
500
514
|
printBuildPlanVariationSummary(previousVariations);
|
|
501
|
-
printSelectedBuildPlanOwnership(options.contextGraphPath,
|
|
515
|
+
printSelectedBuildPlanOwnership(options.contextGraphPath, best.variation);
|
|
502
516
|
if (maxLoops != null) {
|
|
503
517
|
console.log(chalk.red(` Context Graph did not pass after ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"} per variation and ${maxLoops} Build Plan improvement loop${maxLoops === 1 ? "" : "s"}.`));
|
|
504
518
|
}
|
|
505
519
|
else {
|
|
506
520
|
console.log(chalk.red(` Context Graph did not pass within ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"}.`));
|
|
507
521
|
}
|
|
508
|
-
if (
|
|
509
|
-
console.log(chalk.dim(` Best attempt benchmark pass rate: ${benchmarkPassRate(
|
|
522
|
+
if (best.outcome) {
|
|
523
|
+
console.log(chalk.dim(` Best attempt benchmark pass rate: ${benchmarkPassRate(best.outcome)}%.`));
|
|
510
524
|
}
|
|
511
525
|
printStageShellReviewHint(options.contextGraphPath, preserveStageShells, "failure");
|
|
512
526
|
return false;
|
|
513
527
|
}
|
|
514
528
|
finally {
|
|
515
|
-
if (
|
|
516
|
-
rmSync(
|
|
529
|
+
if (best.backupPath) {
|
|
530
|
+
rmSync(best.backupPath, { recursive: true, force: true });
|
|
517
531
|
}
|
|
518
532
|
}
|
|
519
533
|
}
|
|
@@ -662,6 +676,9 @@ export function createNativeLocalServiceRunHandlers(options = {}) {
|
|
|
662
676
|
intent: request.intent,
|
|
663
677
|
executor,
|
|
664
678
|
targetCount: request.target_count,
|
|
679
|
+
// Preserve the drafting shell under the Project's durable job storage so
|
|
680
|
+
// the draft execution (prompt, reasoning, output, verdict) is inspectable.
|
|
681
|
+
preservedShellRoot: join(projectServiceJobShellsRoot(asProjectDataDir(context.sourcePath)), `benchmark-question-draft-${context.runId}`),
|
|
665
682
|
onStatus: (line) => context.emit({
|
|
666
683
|
type: "log.appended",
|
|
667
684
|
step_id: "agent-draft",
|
|
@@ -673,6 +690,8 @@ export function createNativeLocalServiceRunHandlers(options = {}) {
|
|
|
673
690
|
}
|
|
674
691
|
return {
|
|
675
692
|
checks: drafted.checks,
|
|
693
|
+
...(drafted.shellPath ? { shell_path: drafted.shellPath } : {}),
|
|
694
|
+
...(drafted.reasoningPath ? { reasoning_path: drafted.reasoningPath } : {}),
|
|
676
695
|
};
|
|
677
696
|
},
|
|
678
697
|
async createBuildPlanAuthoringRun(request, context) {
|
|
@@ -6,7 +6,7 @@ export function artifactsForBuildPlan(projectDataDir, buildPlanId) {
|
|
|
6
6
|
return [];
|
|
7
7
|
try {
|
|
8
8
|
const buildPlan = getBuildPlan(buildPlanId, { projectDataDir });
|
|
9
|
-
return [...(buildPlan.contextInterface?.artifacts ??
|
|
9
|
+
return [...(buildPlan.contextInterface?.artifacts ?? [])];
|
|
10
10
|
}
|
|
11
11
|
catch {
|
|
12
12
|
return [];
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
import type { ProjectSourceState } from "../contracts/lib/project-schema.js";
|
|
9
9
|
export interface ProjectSourceStateInput {
|
|
10
10
|
projectId: string;
|
|
11
|
-
sourceFolderPath: string;
|
|
12
11
|
contextGraphPath: string;
|
|
13
12
|
/**
|
|
14
13
|
* Hash from the last successful Build (typically the latest Context
|
|
15
|
-
*
|
|
16
|
-
* Context Graph
|
|
14
|
+
* Graph's file index hash). Omit when computing state for the latest
|
|
15
|
+
* Context Graph itself; pass null only when no Build has produced a
|
|
16
|
+
* manifest yet.
|
|
17
17
|
*/
|
|
18
|
-
lastGraphIndexHash
|
|
18
|
+
lastGraphIndexHash?: string | null;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Compute the current `ProjectSourceState`.
|
|
@@ -29,10 +29,13 @@ export function computeProjectSourceState(input) {
|
|
|
29
29
|
}
|
|
30
30
|
const sourceFiles = sourceManifestToSourceFiles(manifest);
|
|
31
31
|
const fileIndexHash = computeFileIndexHash(sourceFiles);
|
|
32
|
+
const baselineIndexHash = input.lastGraphIndexHash === undefined
|
|
33
|
+
? fileIndexHash
|
|
34
|
+
: input.lastGraphIndexHash;
|
|
32
35
|
const driftKind = (() => {
|
|
33
|
-
if (
|
|
36
|
+
if (baselineIndexHash === null)
|
|
34
37
|
return "unknown";
|
|
35
|
-
if (
|
|
38
|
+
if (baselineIndexHash === fileIndexHash)
|
|
36
39
|
return "fresh";
|
|
37
40
|
return "drifted";
|
|
38
41
|
})();
|
|
@@ -20,10 +20,12 @@ export interface ProjectCreateInput {
|
|
|
20
20
|
kind: "local-folder";
|
|
21
21
|
locator: string;
|
|
22
22
|
};
|
|
23
|
+
intent: string;
|
|
23
24
|
/** Build Plan binding. Null/undefined means "not bound yet" — bind later via update. */
|
|
24
25
|
build_plan_id?: string | null;
|
|
25
26
|
}
|
|
26
27
|
export interface ProjectUpdateInput {
|
|
28
|
+
intent?: string;
|
|
27
29
|
build_plan_id?: string | null;
|
|
28
30
|
}
|
|
29
31
|
export interface StoredProject {
|
|
@@ -33,6 +35,7 @@ export interface StoredProject {
|
|
|
33
35
|
kind: "local-folder";
|
|
34
36
|
locator: string;
|
|
35
37
|
};
|
|
38
|
+
intent: string;
|
|
36
39
|
/** Null when no Build Plan has been bound to this Project yet. */
|
|
37
40
|
buildPlanId: string | null;
|
|
38
41
|
config: ProjectConfig;
|
|
@@ -75,8 +78,10 @@ export declare function projectWireShape(stored: StoredProject): {
|
|
|
75
78
|
kind: string;
|
|
76
79
|
locator: string;
|
|
77
80
|
};
|
|
81
|
+
intent: string;
|
|
78
82
|
build_plan_id: string | null;
|
|
79
83
|
config_path: string;
|
|
84
|
+
updated_at: string | null;
|
|
80
85
|
context_graph: {
|
|
81
86
|
kind: "local-path";
|
|
82
87
|
value: string;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { existsSync, mkdirSync, readdirSync, rmSync, statSync, } from "node:fs";
|
|
16
16
|
import { resolve } from "node:path";
|
|
17
|
-
import { ProjectIdSchema, BuildPlanIdSchema, } from "../contracts/lib/schema.js";
|
|
17
|
+
import { ProjectIdSchema, BuildPlanIdSchema, ProjectIntentSchema, } from "../contracts/lib/schema.js";
|
|
18
18
|
import { projectDataDir as resolveProjectDataDir, projectConfigPath, projectContextGraphPath, projectRunContextGraphPath, projectsRoot, } from "../contracts/lib/project-paths.js";
|
|
19
19
|
import { saveSourceFolderConfig, loadSourceFolderConfig, } from "../projects/source-config.js";
|
|
20
20
|
import { assertCanCreateProject } from "./entitlement-guard.js";
|
|
@@ -28,9 +28,13 @@ function loadStoredProject(projectId) {
|
|
|
28
28
|
const config = loadSourceFolderConfig(projectDataDir);
|
|
29
29
|
if (!config)
|
|
30
30
|
return null;
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
31
|
+
const loadedProject = config.projects?.find((p) => p.name === projectId);
|
|
32
|
+
if (!loadedProject)
|
|
33
33
|
return null;
|
|
34
|
+
const intent = ProjectIntentSchema.safeParse(loadedProject.intent);
|
|
35
|
+
if (!intent.success)
|
|
36
|
+
return null;
|
|
37
|
+
const project = { ...loadedProject, intent: intent.data };
|
|
34
38
|
const sourceFolderPath = config.source_folder?.path;
|
|
35
39
|
if (!sourceFolderPath)
|
|
36
40
|
return null;
|
|
@@ -38,6 +42,7 @@ function loadStoredProject(projectId) {
|
|
|
38
42
|
id: projectId,
|
|
39
43
|
projectDataDir,
|
|
40
44
|
source: { kind: "local-folder", locator: sourceFolderPath },
|
|
45
|
+
intent: project.intent,
|
|
41
46
|
buildPlanId: project.build_plan ?? null,
|
|
42
47
|
config: project,
|
|
43
48
|
contextGraphPath: project.latest_context_graph_run_id
|
|
@@ -78,6 +83,7 @@ export function createStoredProject(runtime, input) {
|
|
|
78
83
|
if (input.build_plan_id != null) {
|
|
79
84
|
BuildPlanIdSchema.parse(input.build_plan_id);
|
|
80
85
|
}
|
|
86
|
+
const intent = ProjectIntentSchema.parse(input.intent);
|
|
81
87
|
const sourceLocator = resolve(input.source.locator);
|
|
82
88
|
ensureProjectsRoot();
|
|
83
89
|
const projectDataDir = resolveProjectDataDir(input.id);
|
|
@@ -89,6 +95,7 @@ export function createStoredProject(runtime, input) {
|
|
|
89
95
|
mkdirSync(projectDataDir, { recursive: true });
|
|
90
96
|
const project = {
|
|
91
97
|
name: input.id,
|
|
98
|
+
intent,
|
|
92
99
|
path: input.id,
|
|
93
100
|
...(input.build_plan_id ? { build_plan: input.build_plan_id } : {}),
|
|
94
101
|
};
|
|
@@ -128,8 +135,12 @@ export function updateStoredProject(projectId, patch) {
|
|
|
128
135
|
if (patch.build_plan_id !== undefined && patch.build_plan_id !== null) {
|
|
129
136
|
BuildPlanIdSchema.parse(patch.build_plan_id);
|
|
130
137
|
}
|
|
138
|
+
if (patch.intent !== undefined) {
|
|
139
|
+
ProjectIntentSchema.parse(patch.intent);
|
|
140
|
+
}
|
|
131
141
|
const nextProject = {
|
|
132
142
|
...stored.config,
|
|
143
|
+
...(patch.intent !== undefined ? { intent: ProjectIntentSchema.parse(patch.intent) } : {}),
|
|
133
144
|
...(patch.build_plan_id === null
|
|
134
145
|
? { build_plan: undefined }
|
|
135
146
|
: patch.build_plan_id !== undefined
|
|
@@ -154,14 +165,30 @@ export function rehydrateProjects(runtime) {
|
|
|
154
165
|
runtime.registerProject(stored.projectDataDir);
|
|
155
166
|
}
|
|
156
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Last-modified time of the Project's `interf.json`, ISO 8601. This is the
|
|
170
|
+
* Projects list recency signal: it advances on create, edit (intent / Build
|
|
171
|
+
* Plan change), and a successful Build (which writes `latest_context_graph_run_id`
|
|
172
|
+
* back into the config). Null when the mtime can't be read.
|
|
173
|
+
*/
|
|
174
|
+
function projectConfigUpdatedAt(configPath) {
|
|
175
|
+
try {
|
|
176
|
+
return statSync(configPath).mtime.toISOString();
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
157
182
|
/** Build the wire shape for `GET /v1/projects/<id>` given a stored Project. */
|
|
158
183
|
export function projectWireShape(stored) {
|
|
159
184
|
return {
|
|
160
185
|
id: stored.id,
|
|
161
186
|
project_id: stored.id,
|
|
162
187
|
source: stored.source,
|
|
188
|
+
intent: stored.intent,
|
|
163
189
|
build_plan_id: stored.buildPlanId,
|
|
164
190
|
config_path: stored.configPath,
|
|
191
|
+
updated_at: projectConfigUpdatedAt(stored.configPath),
|
|
165
192
|
context_graph: { kind: "local-path", value: stored.contextGraphPath },
|
|
166
193
|
context_graph_path: stored.contextGraphPath,
|
|
167
194
|
};
|
|
@@ -42,7 +42,7 @@ function titleFromArtifactId(value) {
|
|
|
42
42
|
.join(" ");
|
|
43
43
|
}
|
|
44
44
|
function labelForArtifactCheck(check) {
|
|
45
|
-
return check.description ?? titleFromArtifactId(check.id) ?? "
|
|
45
|
+
return check.description ?? titleFromArtifactId(check.id) ?? "Output diagnostic";
|
|
46
46
|
}
|
|
47
47
|
export function requestedArtifactsFromPlanArtifacts(artifacts) {
|
|
48
48
|
return artifacts.map((artifact) => ({
|
|
@@ -81,10 +81,15 @@ function runTraceStatus(status) {
|
|
|
81
81
|
return "completed";
|
|
82
82
|
}
|
|
83
83
|
function safeTraceNamePart(value) {
|
|
84
|
+
// Keep spaces so timeline labels read as human text ("Draft Build Plan")
|
|
85
|
+
// instead of dash-joined slugs ("Draft-Build-Plan-definition"). The name is
|
|
86
|
+
// only ever split on `//` and `/` downstream, so spaces are safe; it is never
|
|
87
|
+
// used as a path or correlation key.
|
|
84
88
|
return value
|
|
85
|
-
.replace(/[^a-zA-Z0-9._
|
|
89
|
+
.replace(/[^a-zA-Z0-9._/ -]+/g, " ")
|
|
86
90
|
.replace(/\/+/g, "/")
|
|
87
|
-
.replace(
|
|
91
|
+
.replace(/\s+/g, " ")
|
|
92
|
+
.replace(/^[\s-]+|[\s-]+$/g, "")
|
|
88
93
|
|| "run";
|
|
89
94
|
}
|
|
90
95
|
function interfTraceName(runType, name) {
|
|
@@ -277,10 +282,10 @@ export function buildRunToObservability(run) {
|
|
|
277
282
|
{ label: "Executor", value: executor?.display_name ?? run.backend },
|
|
278
283
|
{ label: "Stages", value: `${run.stages.filter((stage) => stage.status === "succeeded").length}/${run.stages.length}` },
|
|
279
284
|
{
|
|
280
|
-
label: "
|
|
285
|
+
label: "Coverage goals",
|
|
281
286
|
value: `${(run.context_checks ?? []).filter((check) => check.status === "passed").length}/${(run.context_checks ?? []).length}`,
|
|
282
287
|
},
|
|
283
|
-
{ label: "
|
|
288
|
+
{ label: "Outputs", value: String(artifacts.length) },
|
|
284
289
|
],
|
|
285
290
|
artifacts,
|
|
286
291
|
checks,
|
|
@@ -324,7 +324,7 @@ async function buildActionProposal(runtime, projectDataDir, request) {
|
|
|
324
324
|
status: "awaiting_approval",
|
|
325
325
|
action_type: actionType,
|
|
326
326
|
title: (usePlannerText ? plan.title : undefined) ?? `Draft Build Plan ${buildPlanId}`,
|
|
327
|
-
summary: (usePlannerText ? plan.summary : undefined) ?? "Ask the configured local executor to draft a Build Plan
|
|
327
|
+
summary: (usePlannerText ? plan.summary : undefined) ?? "Ask the configured local executor to draft a Build Plan from Project intent, requested outputs, and coverage expectations.",
|
|
328
328
|
assistant_message: (usePlannerText ? plan.assistant_message : undefined) ??
|
|
329
329
|
actionAssistantMessage(actionType, projectConfig?.name ?? null, commandPreview),
|
|
330
330
|
command_preview: commandPreview,
|
|
@@ -471,12 +471,12 @@ async function buildActionProposal(runtime, projectDataDir, request) {
|
|
|
471
471
|
if (plan.summary)
|
|
472
472
|
return plan.summary;
|
|
473
473
|
if (proposalActionType === "build")
|
|
474
|
-
return "Build a Context Graph with summaries,
|
|
474
|
+
return "Build a Context Graph with summaries, task-aware knowledge, graph entrypoints, coverage metrics, source links, and traces.";
|
|
475
475
|
if (proposalActionType === "benchmark")
|
|
476
476
|
return "Run Q&A / fact-check benchmarks against source files and Context Graph.";
|
|
477
477
|
if (proposalActionType === "benchmark-question-draft")
|
|
478
478
|
return "Ask the configured local executor to draft saved Q&A / fact-check evaluation questions.";
|
|
479
|
-
return "Ask the configured local executor to draft a Build Plan
|
|
479
|
+
return "Ask the configured local executor to draft a Build Plan from Project intent, requested outputs, and coverage expectations.";
|
|
480
480
|
})();
|
|
481
481
|
const previewValues = proposalValues;
|
|
482
482
|
const commandPreview = plan.command_preview ?? actionCommandPreview(proposalActionType, projectConfig.name, buildPlanId, previewValues);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { existsSync, rmSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
1
|
+
import { existsSync, rmSync, statSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { installUserBuildPlan, userBuildPlanExists, } from "../build-plans/package/user-build-plans.js";
|
|
3
4
|
import { asProjectDataDir, projectBuildPlansRoot, userBuildPlansRoot, } from "../contracts/lib/project-paths.js";
|
|
4
5
|
import { buildPlanIdForProjectConfig, DEFAULT_BUILD_PLAN_ID, listProjectConfigs, loadSourceFolderConfig, saveSourceFolderConfig, } from "../projects/source-config.js";
|
|
5
6
|
import { listBuildPlanChoices, } from "../build-plans/package/build-plan-definitions.js";
|
|
@@ -31,9 +32,26 @@ export function listBuildPlans(runtime, projectDataDir) {
|
|
|
31
32
|
const activeForProjects = projects
|
|
32
33
|
.filter((project) => buildPlanIdForProjectConfig(project) === buildPlan.id)
|
|
33
34
|
.map((project) => project.name);
|
|
35
|
+
// Package file mtime/birthtime give migration-free "last updated"/"created"
|
|
36
|
+
// signals so clients can sort Build Plans newest-first like Projects.
|
|
37
|
+
const sourcePath = resolveBuildPlanPackageSourcePath(projectDataDir, buildPlan.id);
|
|
38
|
+
let createdAt = null;
|
|
39
|
+
let updatedAt = null;
|
|
40
|
+
if (sourcePath) {
|
|
41
|
+
try {
|
|
42
|
+
const stat = statSync(sourcePath);
|
|
43
|
+
updatedAt = stat.mtime.toISOString();
|
|
44
|
+
createdAt = (stat.birthtimeMs > 0 ? stat.birthtime : stat.mtime).toISOString();
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Package file vanished between listing and stat — leave timestamps null.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
34
50
|
return buildBuildPlanResource({
|
|
35
51
|
id: buildPlan.id,
|
|
36
|
-
path:
|
|
52
|
+
path: sourcePath ?? buildPlan.id,
|
|
53
|
+
created_at: createdAt,
|
|
54
|
+
updated_at: updatedAt,
|
|
37
55
|
label: buildPlan.label,
|
|
38
56
|
hint: buildPlan.hint,
|
|
39
57
|
purpose: buildPlan.purpose,
|
|
@@ -41,6 +59,7 @@ export function listBuildPlans(runtime, projectDataDir) {
|
|
|
41
59
|
inputs: buildPlan.inputs,
|
|
42
60
|
source_kind: buildPlan.scope === "builtin" ? "builtin" : "local",
|
|
43
61
|
built_in: buildPlan.scope === "builtin",
|
|
62
|
+
scope: buildPlan.scope ?? "local",
|
|
44
63
|
active_for_projects: activeForProjects,
|
|
45
64
|
artifacts: buildPlan.contextInterface?.artifacts ?? [],
|
|
46
65
|
stages: buildPlan.stages.map((stage) => ({
|
|
@@ -95,6 +114,30 @@ export function applyBuildPlanChange(runtime, projectDataDir, requestValue) {
|
|
|
95
114
|
message: `Duplicated Build Plan ${buildPlanId} as ${request.new_build_plan_id}.`,
|
|
96
115
|
});
|
|
97
116
|
}
|
|
117
|
+
if (request.operation === "save") {
|
|
118
|
+
const localPath = buildPlanDefinitionPath(projectDataDir, buildPlanId);
|
|
119
|
+
if (buildPlanId === DEFAULT_BUILD_PLAN_ID || !existsSync(localPath)) {
|
|
120
|
+
throw new Error(`Build Plan "${buildPlanId}" is not a project Build Plan that can be saved to the library.`);
|
|
121
|
+
}
|
|
122
|
+
if (userBuildPlanExists(buildPlanId)) {
|
|
123
|
+
throw new Error(`Build Plan "${buildPlanId}" is already in your reusable library.`);
|
|
124
|
+
}
|
|
125
|
+
const installed = installUserBuildPlan({ sourceDir: dirname(localPath), id: buildPlanId, overwrite: false });
|
|
126
|
+
// Move (not copy): drop the project-local package so the id lives only in
|
|
127
|
+
// the user library — same plan, now reusable, still bound to the Project.
|
|
128
|
+
rmSync(dirname(localPath), { recursive: true, force: true });
|
|
129
|
+
runtime.buildPlanListingCache.invalidate(projectDataDir);
|
|
130
|
+
return BuildPlanChangeResultSchema.parse({
|
|
131
|
+
kind: "interf-build-plan-change-result",
|
|
132
|
+
version: 1,
|
|
133
|
+
operation: "save",
|
|
134
|
+
build_plan: buildPlanId,
|
|
135
|
+
updated_projects: [],
|
|
136
|
+
build_plan_path: installed.path,
|
|
137
|
+
changed: true,
|
|
138
|
+
message: `Saved Build Plan ${buildPlanId} to your reusable library.`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
98
141
|
if (request.confirmation !== buildPlanId) {
|
|
99
142
|
throw new Error(`Type ${buildPlanId} to confirm Build Plan removal.`);
|
|
100
143
|
}
|
|
@@ -113,6 +156,7 @@ export function applyBuildPlanChange(runtime, projectDataDir, requestValue) {
|
|
|
113
156
|
for (const project of updatedProjects) {
|
|
114
157
|
runtime.readinessCache.invalidateProject(projectDataDir, project.name);
|
|
115
158
|
}
|
|
159
|
+
runtime.contextGraphResourceCache.invalidateProject(projectDataDir);
|
|
116
160
|
}
|
|
117
161
|
rmSync(outputPath, { recursive: true, force: true });
|
|
118
162
|
runtime.buildPlanListingCache.invalidate(projectDataDir);
|