@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.
Files changed (234) hide show
  1. package/README.md +122 -226
  2. package/dist/cli/commands/agents.js +1 -32
  3. package/dist/cli/commands/benchmark.d.ts +2 -3
  4. package/dist/cli/commands/benchmark.js +1 -31
  5. package/dist/cli/commands/build-plan.js +26 -50
  6. package/dist/cli/commands/build.d.ts +2 -3
  7. package/dist/cli/commands/build.js +1 -31
  8. package/dist/cli/commands/graphs.js +177 -32
  9. package/dist/cli/commands/mcp.d.ts +1 -0
  10. package/dist/cli/commands/mcp.js +223 -126
  11. package/dist/cli/commands/project.js +10 -36
  12. package/dist/cli/commands/reset.d.ts +2 -3
  13. package/dist/cli/commands/reset.js +1 -22
  14. package/dist/cli/commands/runs.js +86 -33
  15. package/dist/cli/commands/status.js +3 -24
  16. package/dist/cli/commands/traces.js +1 -29
  17. package/dist/cli/commands/wizard.js +17 -29
  18. package/dist/cli/lib/http-client.d.ts +39 -0
  19. package/dist/cli/lib/http-client.js +73 -0
  20. package/dist/packages/build-plans/authoring/brief.d.ts +25 -4
  21. package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +42 -1
  22. package/dist/packages/build-plans/authoring/build-plan-authoring.js +470 -63
  23. package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +9 -0
  24. package/dist/packages/build-plans/authoring/build-plan-edit-session.js +27 -10
  25. package/dist/packages/build-plans/authoring/build-plan-improvement.js +62 -8
  26. package/dist/packages/build-plans/authoring/lib/build-plan-edit-utils.d.ts +1 -0
  27. package/dist/packages/build-plans/package/build-plan-definitions.d.ts +0 -1
  28. package/dist/packages/build-plans/package/build-plan-definitions.js +5 -3
  29. package/dist/packages/build-plans/package/build-plan-stage-runner.d.ts +1 -0
  30. package/dist/packages/build-plans/package/build-plan-stage-runner.js +2 -1
  31. package/dist/packages/build-plans/package/builtin-build-plan.d.ts +2 -2
  32. package/dist/packages/build-plans/package/builtin-build-plan.js +3 -3
  33. package/dist/packages/build-plans/package/context-interface.d.ts +3 -0
  34. package/dist/packages/build-plans/package/context-interface.js +5 -5
  35. package/dist/packages/build-plans/package/interf-build-plan-package.js +22 -22
  36. package/dist/packages/build-plans/package/local-build-plans.d.ts +10 -5
  37. package/dist/packages/build-plans/package/local-build-plans.js +57 -32
  38. package/dist/packages/contracts/index.d.ts +4 -3
  39. package/dist/packages/contracts/index.js +2 -1
  40. package/dist/packages/contracts/lib/context-graph-layer.d.ts +161 -0
  41. package/dist/packages/contracts/lib/context-graph-layer.js +216 -0
  42. package/dist/packages/contracts/lib/project-paths.d.ts +7 -0
  43. package/dist/packages/contracts/lib/project-paths.js +9 -0
  44. package/dist/packages/contracts/lib/project-schema.d.ts +264 -1
  45. package/dist/packages/contracts/lib/project-schema.js +38 -13
  46. package/dist/packages/contracts/lib/schema.d.ts +556 -23
  47. package/dist/packages/contracts/lib/schema.js +279 -18
  48. package/dist/packages/contracts/utils/filesystem.d.ts +1 -0
  49. package/dist/packages/contracts/utils/filesystem.js +29 -1
  50. package/dist/packages/projects/lib/schema.d.ts +6 -8
  51. package/dist/packages/projects/lib/schema.js +3 -1
  52. package/dist/packages/projects/source-config.d.ts +0 -5
  53. package/dist/packages/projects/source-config.js +9 -22
  54. package/dist/packages/runtime/actions/fields.d.ts +4 -0
  55. package/dist/packages/runtime/actions/form-builders.js +79 -31
  56. package/dist/packages/runtime/actions/form-validators.js +9 -3
  57. package/dist/packages/runtime/actions/helpers.js +3 -3
  58. package/dist/packages/runtime/actions/registry.d.ts +1 -1
  59. package/dist/packages/runtime/actions/registry.js +1 -1
  60. package/dist/packages/runtime/actions/requests.d.ts +1 -1
  61. package/dist/packages/runtime/actions/requests.js +12 -6
  62. package/dist/packages/runtime/actions/schemas.d.ts +7 -0
  63. package/dist/packages/runtime/actions/schemas.js +1 -0
  64. package/dist/packages/runtime/agent-handoff.js +8 -7
  65. package/dist/packages/runtime/agents/lib/execution-profile.d.ts +14 -0
  66. package/dist/packages/runtime/agents/lib/execution-profile.js +23 -0
  67. package/dist/packages/runtime/agents/lib/execution.js +14 -8
  68. package/dist/packages/runtime/agents/lib/executors.d.ts +1 -0
  69. package/dist/packages/runtime/agents/lib/executors.js +11 -2
  70. package/dist/packages/runtime/agents/lib/logs.d.ts +10 -0
  71. package/dist/packages/runtime/agents/lib/logs.js +32 -8
  72. package/dist/packages/runtime/agents/lib/preflight.js +4 -1
  73. package/dist/packages/runtime/agents/lib/render.d.ts +18 -0
  74. package/dist/packages/runtime/agents/lib/render.js +44 -18
  75. package/dist/packages/runtime/agents/lib/shell-templates.js +105 -63
  76. package/dist/packages/runtime/agents/lib/shells.d.ts +29 -0
  77. package/dist/packages/runtime/agents/lib/shells.js +158 -32
  78. package/dist/packages/runtime/agents/lib/source-context-scan.d.ts +10 -0
  79. package/dist/packages/runtime/agents/lib/source-context-scan.js +388 -0
  80. package/dist/packages/runtime/agents/lib/status.js +1 -14
  81. package/dist/packages/runtime/agents/lib/string-utils.d.ts +16 -0
  82. package/dist/packages/runtime/agents/lib/string-utils.js +36 -0
  83. package/dist/packages/runtime/agents/lib/types.d.ts +1 -0
  84. package/dist/packages/runtime/agents/providers/codex.js +2 -0
  85. package/dist/packages/runtime/agents/role-executors.js +2 -1
  86. package/dist/packages/runtime/auth/session-store.js +11 -3
  87. package/dist/packages/runtime/benchmark-question-draft.d.ts +3 -0
  88. package/dist/packages/runtime/benchmark-question-draft.js +57 -28
  89. package/dist/packages/runtime/build/artifact-status.d.ts +1 -1
  90. package/dist/packages/runtime/build/artifact-status.js +1 -1
  91. package/dist/packages/runtime/build/build-evidence.d.ts +2 -1
  92. package/dist/packages/runtime/build/build-evidence.js +11 -5
  93. package/dist/packages/runtime/build/build-pipeline.js +89 -5
  94. package/dist/packages/runtime/build/build-stage-plan.js +3 -1
  95. package/dist/packages/runtime/build/build-stage-runner.js +169 -32
  96. package/dist/packages/runtime/build/build-target.d.ts +3 -0
  97. package/dist/packages/runtime/build/build-target.js +25 -1
  98. package/dist/packages/runtime/build/check-evaluator.d.ts +1 -1
  99. package/dist/packages/runtime/build/check-evaluator.js +655 -4
  100. package/dist/packages/runtime/build/context-graph-paths.d.ts +13 -0
  101. package/dist/packages/runtime/build/context-graph-paths.js +27 -0
  102. package/dist/packages/runtime/build/index.d.ts +2 -2
  103. package/dist/packages/runtime/build/index.js +2 -2
  104. package/dist/packages/runtime/build/inspect-map.d.ts +10 -0
  105. package/dist/packages/runtime/build/inspect-map.js +270 -0
  106. package/dist/packages/runtime/build/lib/schema.d.ts +246 -53
  107. package/dist/packages/runtime/build/lib/schema.js +173 -15
  108. package/dist/packages/runtime/build/native-entrypoint.d.ts +2 -0
  109. package/dist/packages/runtime/build/native-entrypoint.js +286 -0
  110. package/dist/packages/runtime/build/runtime-contracts.js +9 -3
  111. package/dist/packages/runtime/build/runtime-log-paths.d.ts +3 -0
  112. package/dist/packages/runtime/build/runtime-log-paths.js +16 -0
  113. package/dist/packages/runtime/build/runtime-prompt.js +6 -4
  114. package/dist/packages/runtime/build/runtime-runs.js +63 -10
  115. package/dist/packages/runtime/build/runtime-types.d.ts +4 -1
  116. package/dist/packages/runtime/build/runtime.d.ts +3 -1
  117. package/dist/packages/runtime/build/runtime.js +3 -1
  118. package/dist/packages/runtime/build/source-files.js +11 -2
  119. package/dist/packages/runtime/build/source-inventory.d.ts +1 -0
  120. package/dist/packages/runtime/build/source-inventory.js +246 -7
  121. package/dist/packages/runtime/build/source-manifest.d.ts +11 -0
  122. package/dist/packages/runtime/build/source-manifest.js +30 -2
  123. package/dist/packages/runtime/build/stage-evidence.js +80 -11
  124. package/dist/packages/runtime/build/stage-manifest.d.ts +45 -0
  125. package/dist/packages/runtime/build/stage-manifest.js +1125 -0
  126. package/dist/packages/runtime/build/stage-reuse.js +12 -0
  127. package/dist/packages/runtime/build/stage-session.d.ts +81 -0
  128. package/dist/packages/runtime/build/stage-session.js +308 -0
  129. package/dist/packages/runtime/build/state-io.js +10 -11
  130. package/dist/packages/runtime/build/state-view.js +1 -1
  131. package/dist/packages/runtime/build/state.d.ts +1 -1
  132. package/dist/packages/runtime/build/state.js +1 -1
  133. package/dist/packages/runtime/build/summary-coverage-index.d.ts +21 -0
  134. package/dist/packages/runtime/build/summary-coverage-index.js +189 -0
  135. package/dist/packages/runtime/build/traces.js +3 -3
  136. package/dist/packages/runtime/build/validate-context-graph.d.ts +1 -1
  137. package/dist/packages/runtime/build/validate-context-graph.js +5 -5
  138. package/dist/packages/runtime/build/validate.d.ts +1 -1
  139. package/dist/packages/runtime/build/validate.js +1 -1
  140. package/dist/packages/runtime/client.d.ts +3 -3
  141. package/dist/packages/runtime/client.js +8 -13
  142. package/dist/packages/runtime/context-checks.js +13 -0
  143. package/dist/packages/runtime/context-graph-scaffold.js +2 -1
  144. package/dist/packages/runtime/context-graph-semantic-graph.d.ts +9 -0
  145. package/dist/packages/runtime/context-graph-semantic-graph.js +416 -0
  146. package/dist/packages/runtime/execution/lib/schema.d.ts +34 -31
  147. package/dist/packages/runtime/index.d.ts +2 -2
  148. package/dist/packages/runtime/index.js +1 -1
  149. package/dist/packages/runtime/native-run-handlers.d.ts +38 -0
  150. package/dist/packages/runtime/native-run-handlers.js +52 -33
  151. package/dist/packages/runtime/plan-artifact-contract.js +1 -1
  152. package/dist/packages/runtime/project-source-state.d.ts +4 -4
  153. package/dist/packages/runtime/project-source-state.js +5 -2
  154. package/dist/packages/runtime/project-store.d.ts +5 -0
  155. package/dist/packages/runtime/project-store.js +30 -3
  156. package/dist/packages/runtime/requested-artifacts.js +1 -1
  157. package/dist/packages/runtime/run-observability.js +9 -4
  158. package/dist/packages/runtime/runtime-action-proposals.js +3 -3
  159. package/dist/packages/runtime/runtime-build-plans.js +47 -3
  160. package/dist/packages/runtime/runtime-build-runs.js +9 -16
  161. package/dist/packages/runtime/runtime-caches.d.ts +26 -0
  162. package/dist/packages/runtime/runtime-caches.js +47 -0
  163. package/dist/packages/runtime/runtime-jobs.js +6 -6
  164. package/dist/packages/runtime/runtime-project-mutations.js +1 -0
  165. package/dist/packages/runtime/runtime-project-reads.d.ts +4 -1
  166. package/dist/packages/runtime/runtime-project-reads.js +229 -36
  167. package/dist/packages/runtime/runtime-proposal-helpers.js +6 -6
  168. package/dist/packages/runtime/runtime-resource-builders.d.ts +4 -2
  169. package/dist/packages/runtime/runtime-resource-builders.js +16 -14
  170. package/dist/packages/runtime/runtime-status.d.ts +14 -0
  171. package/dist/packages/runtime/runtime-status.js +15 -0
  172. package/dist/packages/runtime/runtime-verify-runs.js +6 -5
  173. package/dist/packages/runtime/runtime.d.ts +439 -22
  174. package/dist/packages/runtime/runtime.js +16 -2
  175. package/dist/packages/runtime/schemas/actions.d.ts +24 -0
  176. package/dist/packages/runtime/schemas/agents.d.ts +28 -0
  177. package/dist/packages/runtime/schemas/agents.js +33 -0
  178. package/dist/packages/runtime/schemas/build-plans.d.ts +181 -8
  179. package/dist/packages/runtime/schemas/build-plans.js +36 -2
  180. package/dist/packages/runtime/schemas/context-graphs.d.ts +1522 -0
  181. package/dist/packages/runtime/schemas/context-graphs.js +110 -0
  182. package/dist/packages/runtime/schemas/files.d.ts +7 -347
  183. package/dist/packages/runtime/schemas/files.js +1 -24
  184. package/dist/packages/runtime/schemas/index.d.ts +1 -0
  185. package/dist/packages/runtime/schemas/index.js +1 -0
  186. package/dist/packages/runtime/schemas/jobs.js +4 -0
  187. package/dist/packages/runtime/schemas/projects.d.ts +48 -21
  188. package/dist/packages/runtime/schemas/projects.js +34 -10
  189. package/dist/packages/runtime/schemas/runs.d.ts +1009 -240
  190. package/dist/packages/runtime/schemas/runs.js +17 -0
  191. package/dist/packages/runtime/service/openapi.js +1 -0
  192. package/dist/packages/runtime/service/operations.d.ts +1666 -145
  193. package/dist/packages/runtime/service/operations.js +147 -17
  194. package/dist/packages/runtime/service/routes.d.ts +11 -3
  195. package/dist/packages/runtime/service/routes.js +11 -3
  196. package/dist/packages/runtime/service/server-app-boot.js +2 -2
  197. package/dist/packages/runtime/service/server-helpers.d.ts +11 -0
  198. package/dist/packages/runtime/service/server-helpers.js +19 -0
  199. package/dist/packages/runtime/service/server-routes-action-proposals.js +4 -2
  200. package/dist/packages/runtime/service/server-routes-agents.js +19 -85
  201. package/dist/packages/runtime/service/server-routes-build-plans.js +14 -11
  202. package/dist/packages/runtime/service/server-routes-project-context.js +102 -7
  203. package/dist/packages/runtime/service/server-routes-project-jobs.js +19 -12
  204. package/dist/packages/runtime/service/server-routes-project-runs.js +5 -2
  205. package/dist/packages/runtime/service/server-routes-projects.js +6 -2
  206. package/dist/packages/runtime/service/server-routes-runs.js +11 -4
  207. package/dist/packages/runtime/verify/lib/schema.js +12 -0
  208. package/dist/packages/runtime/verify/test-file-guard.d.ts +2 -0
  209. package/dist/packages/runtime/verify/test-file-guard.js +29 -0
  210. package/dist/packages/runtime/verify/verify-execution.d.ts +7 -0
  211. package/dist/packages/runtime/verify/verify-execution.js +109 -35
  212. package/dist/packages/runtime/verify/verify-paths.d.ts +1 -0
  213. package/dist/packages/runtime/verify/verify-paths.js +4 -0
  214. package/dist/packages/runtime/verify/verify-specs.js +49 -39
  215. package/dist/packages/runtime/wire-schemas.d.ts +1 -1
  216. package/dist/packages/runtime/wire-schemas.js +1 -1
  217. package/package.json +2 -8
  218. package/public-repo/CONTRIBUTING.md +10 -3
  219. package/public-repo/README.md +122 -226
  220. package/public-repo/build-plans/interf-default/README.md +15 -12
  221. package/public-repo/build-plans/interf-default/build/stages/entrypoint/SKILL.md +74 -0
  222. package/public-repo/build-plans/interf-default/build/stages/knowledge/SKILL.md +95 -0
  223. package/public-repo/build-plans/interf-default/build/stages/summarize/SKILL.md +38 -5
  224. package/public-repo/build-plans/interf-default/build-plan.json +27 -23
  225. package/public-repo/build-plans/interf-default/build-plan.schema.json +24 -20
  226. package/public-repo/build-plans/interf-default/use/query/SKILL.md +8 -7
  227. package/public-repo/openapi/local-service.openapi.json +11637 -4213
  228. package/public-repo/skills/interf/SKILL.md +174 -134
  229. package/dist/packages/runtime/build/runtime-paths.d.ts +0 -8
  230. package/dist/packages/runtime/build/runtime-paths.js +0 -26
  231. package/dist/packages/runtime/build/state-paths.d.ts +0 -7
  232. package/dist/packages/runtime/build/state-paths.js +0 -22
  233. package/public-repo/build-plans/interf-default/build/stages/shape/SKILL.md +0 -34
  234. package/public-repo/build-plans/interf-default/build/stages/structure/SKILL.md +0 -28
@@ -1,11 +1,11 @@
1
1
  import { resolve } from "node:path";
2
- import { RunListingCache, ReadinessCache, MtimeListingCache, BuildPlanListingCache, } from "./runtime-caches.js";
2
+ import { RunListingCache, ReadinessCache, MtimeListingCache, BuildPlanListingCache, ContextGraphResourceCache, } from "./runtime-caches.js";
3
3
  import { LocalServiceHealthSchema, } from "./schemas/index.js";
4
4
  import { buildLocalServiceUrl, } from "./service/routes.js";
5
5
  import { resolveConfiguredSourceFolderPath } from "../projects/source-config.js";
6
6
  import { getExecutorStatus, getAgentsRegistry, patchAgentsRoleMap, registerCustomAgent, selectExecutor, setAgentPrefs, unregisterCustomAgent, } from "./runtime-executor.js";
7
7
  import { applyBuildPlanChange, getBuildPlanResource, listBuildPlans, } from "./runtime-build-plans.js";
8
- import { computeProjectReadiness, getProject, getProjectReadiness, getReadiness, getContextGraph, listProjectReadiness, listProjects, listReadiness, listSourceFiles, listContextGraphs, getLatestContextGraph, } from "./runtime-project-reads.js";
8
+ import { computeProjectReadiness, getProject, getProjectReadiness, getReadiness, getContextGraph, getContextGraphHandoff, listProjectReadiness, listProjects, listReadiness, listSourceFiles, listContextGraphs, getLatestContextGraph, listLatestContextGraphStageSessions, } from "./runtime-project-reads.js";
9
9
  import { applyReset, defaultProjectId, ensureContextGraphForRun, resolveProjectConfig, } from "./runtime-project-mutations.js";
10
10
  import { createBuildPlanAuthoringRun, createBenchmarkQuestionDraftRun, finalizeInterruptedJobRuns, getJob, getJobEvents, listJobs, } from "./runtime-jobs.js";
11
11
  import { cancelBuildRun, createBuildRun, expireIdempotencyKeyForTesting, finalizeInterruptedBuildRuns, findIdempotentBuildRun, getBuildRun, getBuildRunArtifacts, getBuildRunEvents, getBuildRunEvidence, listBuildRuns, listBuildRunsForProject, recordIdempotentBuildRun, } from "./runtime-build-runs.js";
@@ -88,6 +88,14 @@ export class LocalServiceRuntime {
88
88
  readinessCache = new ReadinessCache();
89
89
  sourceFilesCache = new MtimeListingCache();
90
90
  buildPlanListingCache = new BuildPlanListingCache();
91
+ /**
92
+ * Per-Build-run Context Graph resource cache. A succeeded Build's graph is
93
+ * immutable, so the full `ContextGraphResource` (readiness join, semantic
94
+ * graph, evidence, validation) is memoized keyed by run id + graph-manifest
95
+ * mtime. Busted on Build completion and Build Plan change via
96
+ * `invalidateProject` on the matching write paths.
97
+ */
98
+ contextGraphResourceCache = new ContextGraphResourceCache();
91
99
  constructor(options) {
92
100
  this.host = options.host;
93
101
  this.port = options.port;
@@ -280,6 +288,12 @@ export class LocalServiceRuntime {
280
288
  getLatestContextGraph(projectDataDir, projectName) {
281
289
  return getLatestContextGraph(this, projectDataDir, projectName);
282
290
  }
291
+ listLatestContextGraphStageSessions(projectDataDir, projectName) {
292
+ return listLatestContextGraphStageSessions(this, projectDataDir, projectName);
293
+ }
294
+ getContextGraphHandoff(projectDataDir, projectName) {
295
+ return getContextGraphHandoff(this, projectDataDir, projectName);
296
+ }
283
297
  // ─── Build Plans ───────────────────────────────────────────────────
284
298
  listBuildPlans(projectDataDir) {
285
299
  return listBuildPlans(this, projectDataDir);
@@ -369,6 +369,9 @@ export declare const ActionProposalResourceSchema: z.ZodDiscriminatedUnion<[z.Zo
369
369
  frontmatter_required_keys: "frontmatter_required_keys";
370
370
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
371
371
  source_refs_required: "source_refs_required";
372
+ summary_backlinks_present: "summary_backlinks_present";
373
+ knowledge_web_connectivity: "knowledge_web_connectivity";
374
+ graph_notes_connected: "graph_notes_connected";
372
375
  wikilinks_valid: "wikilinks_valid";
373
376
  must_not_contain: "must_not_contain";
374
377
  must_contain: "must_contain";
@@ -436,6 +439,9 @@ export declare const ActionProposalResourceSchema: z.ZodDiscriminatedUnion<[z.Zo
436
439
  frontmatter_required_keys: "frontmatter_required_keys";
437
440
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
438
441
  source_refs_required: "source_refs_required";
442
+ summary_backlinks_present: "summary_backlinks_present";
443
+ knowledge_web_connectivity: "knowledge_web_connectivity";
444
+ graph_notes_connected: "graph_notes_connected";
439
445
  wikilinks_valid: "wikilinks_valid";
440
446
  must_not_contain: "must_not_contain";
441
447
  must_contain: "must_contain";
@@ -535,6 +541,9 @@ export declare const ActionProposalResourceSchema: z.ZodDiscriminatedUnion<[z.Zo
535
541
  frontmatter_required_keys: "frontmatter_required_keys";
536
542
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
537
543
  source_refs_required: "source_refs_required";
544
+ summary_backlinks_present: "summary_backlinks_present";
545
+ knowledge_web_connectivity: "knowledge_web_connectivity";
546
+ graph_notes_connected: "graph_notes_connected";
538
547
  wikilinks_valid: "wikilinks_valid";
539
548
  must_not_contain: "must_not_contain";
540
549
  must_contain: "must_contain";
@@ -602,6 +611,9 @@ export declare const ActionProposalResourceSchema: z.ZodDiscriminatedUnion<[z.Zo
602
611
  frontmatter_required_keys: "frontmatter_required_keys";
603
612
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
604
613
  source_refs_required: "source_refs_required";
614
+ summary_backlinks_present: "summary_backlinks_present";
615
+ knowledge_web_connectivity: "knowledge_web_connectivity";
616
+ graph_notes_connected: "graph_notes_connected";
605
617
  wikilinks_valid: "wikilinks_valid";
606
618
  must_not_contain: "must_not_contain";
607
619
  must_contain: "must_contain";
@@ -916,6 +928,9 @@ export declare const ActionProposalListResponseSchema: z.ZodObject<{
916
928
  frontmatter_required_keys: "frontmatter_required_keys";
917
929
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
918
930
  source_refs_required: "source_refs_required";
931
+ summary_backlinks_present: "summary_backlinks_present";
932
+ knowledge_web_connectivity: "knowledge_web_connectivity";
933
+ graph_notes_connected: "graph_notes_connected";
919
934
  wikilinks_valid: "wikilinks_valid";
920
935
  must_not_contain: "must_not_contain";
921
936
  must_contain: "must_contain";
@@ -983,6 +998,9 @@ export declare const ActionProposalListResponseSchema: z.ZodObject<{
983
998
  frontmatter_required_keys: "frontmatter_required_keys";
984
999
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
985
1000
  source_refs_required: "source_refs_required";
1001
+ summary_backlinks_present: "summary_backlinks_present";
1002
+ knowledge_web_connectivity: "knowledge_web_connectivity";
1003
+ graph_notes_connected: "graph_notes_connected";
986
1004
  wikilinks_valid: "wikilinks_valid";
987
1005
  must_not_contain: "must_not_contain";
988
1006
  must_contain: "must_contain";
@@ -1082,6 +1100,9 @@ export declare const ActionProposalListResponseSchema: z.ZodObject<{
1082
1100
  frontmatter_required_keys: "frontmatter_required_keys";
1083
1101
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
1084
1102
  source_refs_required: "source_refs_required";
1103
+ summary_backlinks_present: "summary_backlinks_present";
1104
+ knowledge_web_connectivity: "knowledge_web_connectivity";
1105
+ graph_notes_connected: "graph_notes_connected";
1085
1106
  wikilinks_valid: "wikilinks_valid";
1086
1107
  must_not_contain: "must_not_contain";
1087
1108
  must_contain: "must_contain";
@@ -1149,6 +1170,9 @@ export declare const ActionProposalListResponseSchema: z.ZodObject<{
1149
1170
  frontmatter_required_keys: "frontmatter_required_keys";
1150
1171
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
1151
1172
  source_refs_required: "source_refs_required";
1173
+ summary_backlinks_present: "summary_backlinks_present";
1174
+ knowledge_web_connectivity: "knowledge_web_connectivity";
1175
+ graph_notes_connected: "graph_notes_connected";
1152
1176
  wikilinks_valid: "wikilinks_valid";
1153
1177
  must_not_contain: "must_not_contain";
1154
1178
  must_contain: "must_contain";
@@ -29,6 +29,34 @@ export declare const LocalExecutorStatusSchema: z.ZodObject<{
29
29
  export declare const LocalExecutorSelectRequestSchema: z.ZodObject<{
30
30
  agent: z.ZodString;
31
31
  }, z.core.$strict>;
32
+ /** `POST /v1/agents` — register a custom execution agent. */
33
+ export declare const CustomAgentRegisterRequestSchema: z.ZodObject<{
34
+ name: z.ZodString;
35
+ display_name: z.ZodString;
36
+ command: z.ZodString;
37
+ }, z.core.$strict>;
38
+ /**
39
+ * `PATCH /v1/agents/role-map` — map canonical roles to agent names. Keys are
40
+ * role ids; values are agent names, or `""` to clear a mapping. The non-empty
41
+ * mappings are applied; clears remove the role. Validated here so a non-string
42
+ * value is rejected at the boundary with a parse error.
43
+ */
44
+ export declare const AgentRoleMapPatchSchema: z.ZodRecord<z.ZodString, z.ZodString>;
45
+ /**
46
+ * `PATCH /v1/agents/<name>` — update an agent's stored prefs. Mirrors the wire
47
+ * tolerance of the prior handler: `env_vars` is an object of string→string (or
48
+ * null to clear); `model`/`effort` accept a string, `null`, or `""`. Reuses the
49
+ * canonical `AgentPrefsSchema` env_vars value rule. The route normalizes `""`
50
+ * and an empty `env_vars` map exactly as before after this parse.
51
+ */
52
+ export declare const AgentPrefsPatchSchema: z.ZodObject<{
53
+ env_vars: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
54
+ model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ effort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
+ }, z.core.$strict>;
57
+ export type CustomAgentRegisterRequest = z.infer<typeof CustomAgentRegisterRequestSchema>;
58
+ export type AgentRoleMapPatch = z.infer<typeof AgentRoleMapPatchSchema>;
59
+ export type AgentPrefsPatch = z.infer<typeof AgentPrefsPatchSchema>;
32
60
  export declare const InterfMcpServerSchema: z.ZodObject<{
33
61
  kind: z.ZodEnum<{
34
62
  "mcp-stdio": "mcp-stdio";
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { AgentPrefsSchema } from "../../contracts/lib/schema.js";
2
3
  import { LocalJobAgentSchema } from "./jobs.js";
3
4
  export const LocalExecutorOptionSchema = LocalJobAgentSchema.extend({
4
5
  current: z.boolean(),
@@ -15,6 +16,38 @@ export const LocalExecutorStatusSchema = z.object({
15
16
  export const LocalExecutorSelectRequestSchema = z.object({
16
17
  agent: z.string().min(1),
17
18
  }).strict();
19
+ // ───────────────────────────────────────────────────────────────────────────
20
+ // Agent registry request bodies — parsed at the route boundary so the agent
21
+ // POST/PATCH handlers validate against one declared shape instead of
22
+ // hand-rolled `typeof` checks (matching the projects/build-plans routes).
23
+ // ───────────────────────────────────────────────────────────────────────────
24
+ /** `POST /v1/agents` — register a custom execution agent. */
25
+ export const CustomAgentRegisterRequestSchema = z.object({
26
+ name: z.string().min(1),
27
+ display_name: z.string().min(1),
28
+ command: z.string().min(1),
29
+ }).strict();
30
+ /**
31
+ * `PATCH /v1/agents/role-map` — map canonical roles to agent names. Keys are
32
+ * role ids; values are agent names, or `""` to clear a mapping. The non-empty
33
+ * mappings are applied; clears remove the role. Validated here so a non-string
34
+ * value is rejected at the boundary with a parse error.
35
+ */
36
+ export const AgentRoleMapPatchSchema = z.record(z.string(), z.string());
37
+ /**
38
+ * `PATCH /v1/agents/<name>` — update an agent's stored prefs. Mirrors the wire
39
+ * tolerance of the prior handler: `env_vars` is an object of string→string (or
40
+ * null to clear); `model`/`effort` accept a string, `null`, or `""`. Reuses the
41
+ * canonical `AgentPrefsSchema` env_vars value rule. The route normalizes `""`
42
+ * and an empty `env_vars` map exactly as before after this parse.
43
+ */
44
+ export const AgentPrefsPatchSchema = z.object({
45
+ // Same env_vars value rule as the canonical AgentPrefsSchema, made nullable so
46
+ // an explicit `null` clears prefs (the route's existing tolerance).
47
+ env_vars: AgentPrefsSchema.shape.env_vars.unwrap().nullable().optional(),
48
+ model: z.string().nullable().optional(),
49
+ effort: z.string().nullable().optional(),
50
+ }).strict();
18
51
  export const InterfMcpServerSchema = z.object({
19
52
  kind: z.enum(["mcp-stdio", "skill", "http"]),
20
53
  label: z.string().min(1),
@@ -50,6 +50,9 @@ export declare const BuildPlanResourceSchema: z.ZodObject<{
50
50
  frontmatter_required_keys: "frontmatter_required_keys";
51
51
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
52
52
  source_refs_required: "source_refs_required";
53
+ summary_backlinks_present: "summary_backlinks_present";
54
+ knowledge_web_connectivity: "knowledge_web_connectivity";
55
+ graph_notes_connected: "graph_notes_connected";
53
56
  wikilinks_valid: "wikilinks_valid";
54
57
  must_not_contain: "must_not_contain";
55
58
  must_contain: "must_contain";
@@ -117,6 +120,9 @@ export declare const BuildPlanResourceSchema: z.ZodObject<{
117
120
  frontmatter_required_keys: "frontmatter_required_keys";
118
121
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
119
122
  source_refs_required: "source_refs_required";
123
+ summary_backlinks_present: "summary_backlinks_present";
124
+ knowledge_web_connectivity: "knowledge_web_connectivity";
125
+ graph_notes_connected: "graph_notes_connected";
120
126
  wikilinks_valid: "wikilinks_valid";
121
127
  must_not_contain: "must_not_contain";
122
128
  must_contain: "must_contain";
@@ -140,7 +146,7 @@ export declare const BuildPlanResourceSchema: z.ZodObject<{
140
146
  output?: {
141
147
  checks: {
142
148
  id: string;
143
- kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
149
+ kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "summary_backlinks_present" | "knowledge_web_connectivity" | "graph_notes_connected" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
144
150
  required: boolean;
145
151
  description?: string | undefined;
146
152
  params?: Record<string, unknown> | undefined;
@@ -172,7 +178,7 @@ export declare const BuildPlanResourceSchema: z.ZodObject<{
172
178
  };
173
179
  checks: {
174
180
  id: string;
175
- kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
181
+ kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "summary_backlinks_present" | "knowledge_web_connectivity" | "graph_notes_connected" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
176
182
  required: boolean;
177
183
  description?: string | undefined;
178
184
  params?: Record<string, unknown> | undefined;
@@ -207,7 +213,7 @@ export declare const BuildPlanResourceSchema: z.ZodObject<{
207
213
  output?: {
208
214
  checks: {
209
215
  id: string;
210
- kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
216
+ kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "summary_backlinks_present" | "knowledge_web_connectivity" | "graph_notes_connected" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
211
217
  required: boolean;
212
218
  description?: string | undefined;
213
219
  params?: Record<string, unknown> | undefined;
@@ -261,7 +267,7 @@ export declare const BuildPlanResourceSchema: z.ZodObject<{
261
267
  };
262
268
  checks: {
263
269
  id: string;
264
- kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
270
+ kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "summary_backlinks_present" | "knowledge_web_connectivity" | "graph_notes_connected" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
265
271
  required: boolean;
266
272
  description?: string | undefined;
267
273
  params?: Record<string, unknown> | undefined;
@@ -282,6 +288,13 @@ export declare const BuildPlanResourceSchema: z.ZodObject<{
282
288
  local: "local";
283
289
  }>>;
284
290
  built_in: z.ZodDefault<z.ZodBoolean>;
291
+ scope: z.ZodDefault<z.ZodEnum<{
292
+ builtin: "builtin";
293
+ user: "user";
294
+ local: "local";
295
+ }>>;
296
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
298
  active_for_projects: z.ZodDefault<z.ZodArray<z.ZodString>>;
286
299
  context_checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
287
300
  id: z.ZodString;
@@ -315,6 +328,9 @@ export declare const BuildPlanResourceSchema: z.ZodObject<{
315
328
  frontmatter_required_keys: "frontmatter_required_keys";
316
329
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
317
330
  source_refs_required: "source_refs_required";
331
+ summary_backlinks_present: "summary_backlinks_present";
332
+ knowledge_web_connectivity: "knowledge_web_connectivity";
333
+ graph_notes_connected: "graph_notes_connected";
318
334
  wikilinks_valid: "wikilinks_valid";
319
335
  must_not_contain: "must_not_contain";
320
336
  must_contain: "must_contain";
@@ -349,6 +365,10 @@ export declare const BuildPlanChangeCreateRequestSchema: z.ZodDiscriminatedUnion
349
365
  operation: z.ZodLiteral<"remove">;
350
366
  build_plan: z.ZodString;
351
367
  confirmation: z.ZodString;
368
+ }, z.core.$strict>, z.ZodObject<{
369
+ action_type: z.ZodOptional<z.ZodLiteral<"build-plan-change">>;
370
+ operation: z.ZodLiteral<"save">;
371
+ build_plan: z.ZodString;
352
372
  }, z.core.$strict>], "operation">;
353
373
  export declare const BuildPlanChangeResultSchema: z.ZodObject<{
354
374
  kind: z.ZodLiteral<"interf-build-plan-change-result">;
@@ -356,6 +376,7 @@ export declare const BuildPlanChangeResultSchema: z.ZodObject<{
356
376
  operation: z.ZodEnum<{
357
377
  remove: "remove";
358
378
  duplicate: "duplicate";
379
+ save: "save";
359
380
  }>;
360
381
  build_plan: z.ZodString;
361
382
  new_build_plan_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -397,6 +418,9 @@ export declare const BuildPlanAuthoringCreateRequestSchema: z.ZodObject<{
397
418
  frontmatter_required_keys: "frontmatter_required_keys";
398
419
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
399
420
  source_refs_required: "source_refs_required";
421
+ summary_backlinks_present: "summary_backlinks_present";
422
+ knowledge_web_connectivity: "knowledge_web_connectivity";
423
+ graph_notes_connected: "graph_notes_connected";
400
424
  wikilinks_valid: "wikilinks_valid";
401
425
  must_not_contain: "must_not_contain";
402
426
  must_contain: "must_contain";
@@ -464,6 +488,9 @@ export declare const BuildPlanAuthoringCreateRequestSchema: z.ZodObject<{
464
488
  frontmatter_required_keys: "frontmatter_required_keys";
465
489
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
466
490
  source_refs_required: "source_refs_required";
491
+ summary_backlinks_present: "summary_backlinks_present";
492
+ knowledge_web_connectivity: "knowledge_web_connectivity";
493
+ graph_notes_connected: "graph_notes_connected";
467
494
  wikilinks_valid: "wikilinks_valid";
468
495
  must_not_contain: "must_not_contain";
469
496
  must_contain: "must_contain";
@@ -516,6 +543,9 @@ export declare const BuildPlanAuthoringRuntimeRequestSchema: z.ZodObject<{
516
543
  frontmatter_required_keys: "frontmatter_required_keys";
517
544
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
518
545
  source_refs_required: "source_refs_required";
546
+ summary_backlinks_present: "summary_backlinks_present";
547
+ knowledge_web_connectivity: "knowledge_web_connectivity";
548
+ graph_notes_connected: "graph_notes_connected";
519
549
  wikilinks_valid: "wikilinks_valid";
520
550
  must_not_contain: "must_not_contain";
521
551
  must_contain: "must_contain";
@@ -583,6 +613,9 @@ export declare const BuildPlanAuthoringRuntimeRequestSchema: z.ZodObject<{
583
613
  frontmatter_required_keys: "frontmatter_required_keys";
584
614
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
585
615
  source_refs_required: "source_refs_required";
616
+ summary_backlinks_present: "summary_backlinks_present";
617
+ knowledge_web_connectivity: "knowledge_web_connectivity";
618
+ graph_notes_connected: "graph_notes_connected";
586
619
  wikilinks_valid: "wikilinks_valid";
587
620
  must_not_contain: "must_not_contain";
588
621
  must_contain: "must_contain";
@@ -602,6 +635,129 @@ export declare const BuildPlanAuthoringRuntimeRequestSchema: z.ZodObject<{
602
635
  hint: z.ZodOptional<z.ZodString>;
603
636
  source_folder_path: z.ZodString;
604
637
  }, z.core.$strict>;
638
+ export declare const ProjectBuildPlanAuthoringCreateRequestSchema: z.ZodObject<{
639
+ checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
640
+ id: z.ZodOptional<z.ZodString>;
641
+ label: z.ZodString;
642
+ description: z.ZodOptional<z.ZodString>;
643
+ evidence: z.ZodOptional<z.ZodString>;
644
+ evidence_expectation: z.ZodOptional<z.ZodString>;
645
+ backed_by_artifact_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
646
+ required: z.ZodDefault<z.ZodBoolean>;
647
+ }, z.core.$strict>>>;
648
+ label: z.ZodString;
649
+ context_checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
650
+ id: z.ZodOptional<z.ZodString>;
651
+ label: z.ZodString;
652
+ description: z.ZodOptional<z.ZodString>;
653
+ evidence: z.ZodOptional<z.ZodString>;
654
+ evidence_expectation: z.ZodOptional<z.ZodString>;
655
+ backed_by_artifact_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
656
+ required: z.ZodDefault<z.ZodBoolean>;
657
+ }, z.core.$strict>>>;
658
+ requested_artifacts: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
659
+ id: z.ZodOptional<z.ZodString>;
660
+ title: z.ZodString;
661
+ purpose: z.ZodOptional<z.ZodString>;
662
+ description: z.ZodOptional<z.ZodString>;
663
+ checks: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
664
+ label: z.ZodString;
665
+ }, z.core.$strict>]>>>;
666
+ output: z.ZodOptional<z.ZodObject<{
667
+ path: z.ZodOptional<z.ZodString>;
668
+ shape: z.ZodOptional<z.ZodObject<{
669
+ kind: z.ZodLiteral<"path">;
670
+ path: z.ZodString;
671
+ artifact_kind: z.ZodEnum<{
672
+ file: "file";
673
+ directory: "directory";
674
+ }>;
675
+ }, z.core.$strict>>;
676
+ checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
677
+ id: z.ZodString;
678
+ kind: z.ZodEnum<{
679
+ file_exists: "file_exists";
680
+ source_manifest_valid: "source_manifest_valid";
681
+ min_file_count: "min_file_count";
682
+ min_file_count_matches_source: "min_file_count_matches_source";
683
+ source_summary_folders: "source_summary_folders";
684
+ source_page_coverage: "source_page_coverage";
685
+ frontmatter_valid: "frontmatter_valid";
686
+ frontmatter_required_keys: "frontmatter_required_keys";
687
+ frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
688
+ source_refs_required: "source_refs_required";
689
+ summary_backlinks_present: "summary_backlinks_present";
690
+ knowledge_web_connectivity: "knowledge_web_connectivity";
691
+ graph_notes_connected: "graph_notes_connected";
692
+ wikilinks_valid: "wikilinks_valid";
693
+ must_not_contain: "must_not_contain";
694
+ must_contain: "must_contain";
695
+ qa_match: "qa_match";
696
+ }>;
697
+ description: z.ZodOptional<z.ZodString>;
698
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
699
+ required: z.ZodDefault<z.ZodBoolean>;
700
+ }, z.core.$strict>>>;
701
+ stage_hint: z.ZodOptional<z.ZodString>;
702
+ }, z.core.$strict>>;
703
+ }, z.core.$strict>>>>;
704
+ user_prep_instructions: z.ZodOptional<z.ZodString>;
705
+ source_context: z.ZodOptional<z.ZodNullable<z.ZodObject<{
706
+ summary: z.ZodOptional<z.ZodString>;
707
+ items: z.ZodDefault<z.ZodArray<z.ZodObject<{
708
+ name: z.ZodOptional<z.ZodString>;
709
+ path: z.ZodOptional<z.ZodString>;
710
+ kind: z.ZodOptional<z.ZodString>;
711
+ page_count: z.ZodOptional<z.ZodNumber>;
712
+ note: z.ZodOptional<z.ZodString>;
713
+ }, z.core.$strict>>>;
714
+ observations: z.ZodDefault<z.ZodArray<z.ZodString>>;
715
+ limitations: z.ZodDefault<z.ZodArray<z.ZodString>>;
716
+ }, z.core.$strict>>>;
717
+ artifact_requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
718
+ id: z.ZodString;
719
+ description: z.ZodOptional<z.ZodString>;
720
+ shape: z.ZodObject<{
721
+ kind: z.ZodLiteral<"path">;
722
+ path: z.ZodString;
723
+ artifact_kind: z.ZodEnum<{
724
+ file: "file";
725
+ directory: "directory";
726
+ }>;
727
+ }, z.core.$strict>;
728
+ checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
729
+ id: z.ZodString;
730
+ kind: z.ZodEnum<{
731
+ file_exists: "file_exists";
732
+ source_manifest_valid: "source_manifest_valid";
733
+ min_file_count: "min_file_count";
734
+ min_file_count_matches_source: "min_file_count_matches_source";
735
+ source_summary_folders: "source_summary_folders";
736
+ source_page_coverage: "source_page_coverage";
737
+ frontmatter_valid: "frontmatter_valid";
738
+ frontmatter_required_keys: "frontmatter_required_keys";
739
+ frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
740
+ source_refs_required: "source_refs_required";
741
+ summary_backlinks_present: "summary_backlinks_present";
742
+ knowledge_web_connectivity: "knowledge_web_connectivity";
743
+ graph_notes_connected: "graph_notes_connected";
744
+ wikilinks_valid: "wikilinks_valid";
745
+ must_not_contain: "must_not_contain";
746
+ must_contain: "must_contain";
747
+ qa_match: "qa_match";
748
+ }>;
749
+ description: z.ZodOptional<z.ZodString>;
750
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
751
+ required: z.ZodDefault<z.ZodBoolean>;
752
+ }, z.core.$strict>>>;
753
+ stage_hint: z.ZodOptional<z.ZodString>;
754
+ }, z.core.$strict>>>;
755
+ build_plan_id: z.ZodString;
756
+ hint: z.ZodOptional<z.ZodString>;
757
+ base_build_plan_id: z.ZodOptional<z.ZodString>;
758
+ reference_build_plan_id: z.ZodOptional<z.ZodString>;
759
+ intent: z.ZodOptional<z.ZodString>;
760
+ }, z.core.$strict>;
605
761
  export declare const BuildPlanAuthoringResultSchema: z.ZodObject<{
606
762
  status: z.ZodEnum<{
607
763
  updated: "updated";
@@ -659,6 +815,9 @@ export declare const BuildPlanListResponseSchema: z.ZodObject<{
659
815
  frontmatter_required_keys: "frontmatter_required_keys";
660
816
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
661
817
  source_refs_required: "source_refs_required";
818
+ summary_backlinks_present: "summary_backlinks_present";
819
+ knowledge_web_connectivity: "knowledge_web_connectivity";
820
+ graph_notes_connected: "graph_notes_connected";
662
821
  wikilinks_valid: "wikilinks_valid";
663
822
  must_not_contain: "must_not_contain";
664
823
  must_contain: "must_contain";
@@ -726,6 +885,9 @@ export declare const BuildPlanListResponseSchema: z.ZodObject<{
726
885
  frontmatter_required_keys: "frontmatter_required_keys";
727
886
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
728
887
  source_refs_required: "source_refs_required";
888
+ summary_backlinks_present: "summary_backlinks_present";
889
+ knowledge_web_connectivity: "knowledge_web_connectivity";
890
+ graph_notes_connected: "graph_notes_connected";
729
891
  wikilinks_valid: "wikilinks_valid";
730
892
  must_not_contain: "must_not_contain";
731
893
  must_contain: "must_contain";
@@ -749,7 +911,7 @@ export declare const BuildPlanListResponseSchema: z.ZodObject<{
749
911
  output?: {
750
912
  checks: {
751
913
  id: string;
752
- kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
914
+ kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "summary_backlinks_present" | "knowledge_web_connectivity" | "graph_notes_connected" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
753
915
  required: boolean;
754
916
  description?: string | undefined;
755
917
  params?: Record<string, unknown> | undefined;
@@ -781,7 +943,7 @@ export declare const BuildPlanListResponseSchema: z.ZodObject<{
781
943
  };
782
944
  checks: {
783
945
  id: string;
784
- kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
946
+ kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "summary_backlinks_present" | "knowledge_web_connectivity" | "graph_notes_connected" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
785
947
  required: boolean;
786
948
  description?: string | undefined;
787
949
  params?: Record<string, unknown> | undefined;
@@ -816,7 +978,7 @@ export declare const BuildPlanListResponseSchema: z.ZodObject<{
816
978
  output?: {
817
979
  checks: {
818
980
  id: string;
819
- kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
981
+ kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "summary_backlinks_present" | "knowledge_web_connectivity" | "graph_notes_connected" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
820
982
  required: boolean;
821
983
  description?: string | undefined;
822
984
  params?: Record<string, unknown> | undefined;
@@ -870,7 +1032,7 @@ export declare const BuildPlanListResponseSchema: z.ZodObject<{
870
1032
  };
871
1033
  checks: {
872
1034
  id: string;
873
- kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
1035
+ kind: "file_exists" | "source_manifest_valid" | "min_file_count" | "min_file_count_matches_source" | "source_summary_folders" | "source_page_coverage" | "frontmatter_valid" | "frontmatter_required_keys" | "frontmatter_nonempty_keys" | "source_refs_required" | "summary_backlinks_present" | "knowledge_web_connectivity" | "graph_notes_connected" | "wikilinks_valid" | "must_not_contain" | "must_contain" | "qa_match";
874
1036
  required: boolean;
875
1037
  description?: string | undefined;
876
1038
  params?: Record<string, unknown> | undefined;
@@ -891,6 +1053,13 @@ export declare const BuildPlanListResponseSchema: z.ZodObject<{
891
1053
  local: "local";
892
1054
  }>>;
893
1055
  built_in: z.ZodDefault<z.ZodBoolean>;
1056
+ scope: z.ZodDefault<z.ZodEnum<{
1057
+ builtin: "builtin";
1058
+ user: "user";
1059
+ local: "local";
1060
+ }>>;
1061
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1062
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
894
1063
  active_for_projects: z.ZodDefault<z.ZodArray<z.ZodString>>;
895
1064
  context_checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
896
1065
  id: z.ZodString;
@@ -924,6 +1093,9 @@ export declare const BuildPlanListResponseSchema: z.ZodObject<{
924
1093
  frontmatter_required_keys: "frontmatter_required_keys";
925
1094
  frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
926
1095
  source_refs_required: "source_refs_required";
1096
+ summary_backlinks_present: "summary_backlinks_present";
1097
+ knowledge_web_connectivity: "knowledge_web_connectivity";
1098
+ graph_notes_connected: "graph_notes_connected";
927
1099
  wikilinks_valid: "wikilinks_valid";
928
1100
  must_not_contain: "must_not_contain";
929
1101
  must_contain: "must_contain";
@@ -954,6 +1126,7 @@ export type BuildPlanChangeResult = z.infer<typeof BuildPlanChangeResultSchema>;
954
1126
  export type BuildPlanAuthoringArtifactRequirement = z.infer<typeof BuildPlanAuthoringArtifactRequirementSchema>;
955
1127
  export type BuildPlanContextCheckDraft = z.infer<typeof BuildPlanContextCheckDraftSchema>;
956
1128
  export type BuildPlanAuthoringCreateRequest = z.infer<typeof BuildPlanAuthoringCreateRequestSchema>;
1129
+ export type ProjectBuildPlanAuthoringCreateRequest = z.infer<typeof ProjectBuildPlanAuthoringCreateRequestSchema>;
957
1130
  export type BuildPlanAuthoringRuntimeRequest = z.infer<typeof BuildPlanAuthoringRuntimeRequestSchema>;
958
1131
  export type BuildPlanAuthoringResult = z.infer<typeof BuildPlanAuthoringResultSchema>;
959
1132
  export type BuildPlanListResponse = z.infer<typeof BuildPlanListResponseSchema>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BuildPlanAuthoringBriefInputSchema, BuildPlanAuthoringBriefSchema, } from "../../build-plans/authoring/brief.js";
3
- import { ArtifactSchema, ContextCheckDeclarationSchema, ArtifactIdSchema, ProjectIdSchema, BuildPlanIdSchema, } from "../../contracts/lib/schema.js";
3
+ import { ArtifactSchema, ContextCheckDeclarationSchema, ArtifactIdSchema, ProjectIdSchema, ProjectIntentSchema, BuildPlanIdSchema, } from "../../contracts/lib/schema.js";
4
4
  export { BuildPlanAuthoringArtifactRequirementSchema, BuildPlanAuthoringBriefInputSchema, BuildPlanAuthoringBriefSchema, BuildPlanContextCheckDraftSchema, RequestedArtifactSchema, SourceContextSchema, } from "../../build-plans/authoring/brief.js";
5
5
  /** Body of `POST /v1/build-plans` — save a Build Plan definition by path. */
6
6
  export const BuildPlanSaveRequestSchema = z.object({
@@ -28,6 +28,23 @@ export const BuildPlanResourceSchema = z.object({
28
28
  }).strict()).default([]),
29
29
  source_kind: z.enum(["builtin", "local"]).default("local"),
30
30
  built_in: z.boolean().default(false),
31
+ /**
32
+ * Where the Build Plan lives:
33
+ * - `builtin` — shipped reusable Plan (interf-default, …)
34
+ * - `user` — saved to the reusable library by the user
35
+ * - `local` — project-scoped (a draft for one Project, not reusable)
36
+ * The Build Plans library lists `builtin` + `user`; `local` plans stay with
37
+ * their Project until the user Saves them (promotes `local` → `user`).
38
+ */
39
+ scope: z.enum(["builtin", "user", "local"]).default("local"),
40
+ /**
41
+ * Package file timestamps (ISO 8601), so clients can sort Build Plans
42
+ * newest-first the way Projects sort by config mtime. `updated_at` is the
43
+ * package mtime; `created_at` is its birthtime (falls back to mtime). Null
44
+ * when the package file can't be stat'd.
45
+ */
46
+ created_at: z.string().min(1).nullable().optional(),
47
+ updated_at: z.string().min(1).nullable().optional(),
31
48
  active_for_projects: z.array(ProjectIdSchema).default([]),
32
49
  context_checks: z.array(ContextCheckDeclarationSchema).default([]),
33
50
  artifacts: z.array(ArtifactSchema).default([]),
@@ -62,11 +79,17 @@ export const BuildPlanChangeCreateRequestSchema = z.discriminatedUnion("operatio
62
79
  build_plan: BuildPlanIdSchema,
63
80
  confirmation: BuildPlanIdSchema,
64
81
  }).strict(),
82
+ z.object({
83
+ action_type: z.literal("build-plan-change").optional(),
84
+ // Promote a project-scoped (local) Build Plan to the reusable user library.
85
+ operation: z.literal("save"),
86
+ build_plan: BuildPlanIdSchema,
87
+ }).strict(),
65
88
  ]);
66
89
  export const BuildPlanChangeResultSchema = z.object({
67
90
  kind: z.literal("interf-build-plan-change-result"),
68
91
  version: z.literal(1),
69
- operation: z.enum(["duplicate", "remove"]),
92
+ operation: z.enum(["duplicate", "remove", "save"]),
70
93
  build_plan: BuildPlanIdSchema,
71
94
  new_build_plan_id: BuildPlanIdSchema.nullable().optional(),
72
95
  updated_projects: z.array(ProjectIdSchema).default([]),
@@ -94,6 +117,17 @@ export const BuildPlanAuthoringCreateRequestSchema = BuildPlanAuthoringBriefInpu
94
117
  export const BuildPlanAuthoringRuntimeRequestSchema = BuildPlanAuthoringCreateRequestSchema.extend({
95
118
  source_folder_path: z.string().min(1),
96
119
  }).strict();
120
+ export const ProjectBuildPlanAuthoringCreateRequestSchema = BuildPlanAuthoringCreateRequestSchema
121
+ .omit({ project: true, source_folder_path: true })
122
+ .extend({
123
+ /**
124
+ * Project-scoped routes default this from the saved Project intent when
125
+ * omitted. Clients may still override it when the draft is explicitly
126
+ * narrower than the Project's standing agent task.
127
+ */
128
+ intent: ProjectIntentSchema.optional(),
129
+ })
130
+ .strict();
97
131
  export const BuildPlanAuthoringResultSchema = z.object({
98
132
  status: z.enum(["updated", "no-change", "invalid", "executor-failed"]),
99
133
  changed: z.boolean(),