@cat-factory/contracts 0.292.2 → 0.294.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 (35) hide show
  1. package/dist/environments-kubernetes.d.ts +32 -0
  2. package/dist/environments-kubernetes.d.ts.map +1 -1
  3. package/dist/environments-kubernetes.js +8 -0
  4. package/dist/environments-kubernetes.js.map +1 -1
  5. package/dist/environments.d.ts +22 -0
  6. package/dist/environments.d.ts.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/public-api.d.ts +48 -0
  12. package/dist/public-api.d.ts.map +1 -1
  13. package/dist/public-api.js +12 -0
  14. package/dist/public-api.js.map +1 -1
  15. package/dist/public-provisioning.d.ts +698 -0
  16. package/dist/public-provisioning.d.ts.map +1 -0
  17. package/dist/public-provisioning.js +431 -0
  18. package/dist/public-provisioning.js.map +1 -0
  19. package/dist/routes/environmentUserHandlers.d.ts +6 -0
  20. package/dist/routes/environmentUserHandlers.d.ts.map +1 -1
  21. package/dist/routes/environments.d.ts +21 -0
  22. package/dist/routes/environments.d.ts.map +1 -1
  23. package/dist/routes/index.d.ts +1 -0
  24. package/dist/routes/index.d.ts.map +1 -1
  25. package/dist/routes/index.js +1 -0
  26. package/dist/routes/index.js.map +1 -1
  27. package/dist/routes/public-api.d.ts +14 -0
  28. package/dist/routes/public-api.d.ts.map +1 -1
  29. package/dist/routes/public-board.d.ts +14 -0
  30. package/dist/routes/public-board.d.ts.map +1 -1
  31. package/dist/routes/public-provisioning.d.ts +540 -0
  32. package/dist/routes/public-provisioning.d.ts.map +1 -0
  33. package/dist/routes/public-provisioning.js +128 -0
  34. package/dist/routes/public-provisioning.js.map +1 -0
  35. package/package.json +1 -1
@@ -0,0 +1,128 @@
1
+ import { defineApiContract } from '@toad-contracts/valibot';
2
+ import { connectPublicEnvironmentSchema, publicBootstrapJobSchema, publicBootstrapRepoSchema, publicEnvironmentConnectionTestSchema, publicEnvironmentConnectionViewSchema, publicMergePresetListSchema, publicVcsConnectionViewSchema, publicWiredModelListSchema, testPublicEnvironmentConnectionSchema, updatePublicServiceSchema, } from '../public-provisioning.js';
3
+ import { publicServiceSchema } from '../public-api.js';
4
+ import { errorResponses, singleStringParam, withMinScope } from './_shared.js';
5
+ // ---------------------------------------------------------------------------
6
+ // DEPLOYMENT PROVISIONING on `/api/v1`: the setup half of the surface.
7
+ //
8
+ // Its own file rather than more of `public-board.ts`, which carries what a caller does to a board
9
+ // that already exists. These come EARLIER than that: they are what a caller does to a workspace
10
+ // which has nothing to file work against yet. The split is the same one `public-board.ts` made when
11
+ // it separated setting a board up from running one task through it.
12
+ //
13
+ // **Scope: `admin` throughout, including the reads.** Two different arguments land in the same
14
+ // place. The writes create repositories, bind infrastructure credentials and change where a service
15
+ // deploys, which is board STRUCTURE and beyond, so `admin` is the floor by the same reading that
16
+ // put service creation there. The READS are `admin` for a different reason: unlike `/repos` or
17
+ // `/pipelines`, which name board content, these name what the DEPLOYMENT has wired, including the
18
+ // permissions its VCS credential holds and the clusters it can reach. That is operator-facing
19
+ // information, and a caller holding it is already at the rung that could change it.
20
+ //
21
+ // Where the reading was close, the REVERSIBLE one wins (ADR 0034): `admin` can be relaxed to `read`
22
+ // later, and a scope can never be tightened, because narrowing what a live key may do is a break
23
+ // however small it looks.
24
+ // ---------------------------------------------------------------------------
25
+ const jobIdParams = singleStringParam('jobId');
26
+ const serviceIdParams = singleStringParam('serviceId');
27
+ // ---- repo bootstrap ---------------------------------------------------------
28
+ /**
29
+ * Create a repository and adapt it with the bootstrapper agent.
30
+ *
31
+ * Asynchronous by construction, like every other agent run on this surface: it answers 201 with a
32
+ * job to poll rather than blocking for the minutes a container takes. The job's `serviceId` is the
33
+ * board frame the run materialises, so a caller can file work against the service before the
34
+ * repository itself has finished being written.
35
+ */
36
+ export const startPublicRepoBootstrapContract = withMinScope('admin', defineApiContract({
37
+ method: 'post',
38
+ pathResolver: () => '/api/v1/repos/bootstrap',
39
+ requestBodySchema: publicBootstrapRepoSchema,
40
+ responsesByStatusCode: { 201: publicBootstrapJobSchema, ...errorResponses },
41
+ }));
42
+ /** Poll one bootstrap run. Idempotent, and the only way to learn a run's outcome. */
43
+ export const getPublicRepoBootstrapContract = withMinScope('admin', defineApiContract({
44
+ method: 'get',
45
+ requestPathParamsSchema: jobIdParams,
46
+ pathResolver: ({ jobId }) => `/api/v1/repos/bootstrap/${jobId}`,
47
+ responsesByStatusCode: { 200: publicBootstrapJobSchema, ...errorResponses },
48
+ }));
49
+ // ---- the environment connection (the ENGINE half) ---------------------------
50
+ /**
51
+ * Probe a candidate connection without persisting it.
52
+ *
53
+ * Worth its own endpoint rather than letting the register call find out, because the two failures
54
+ * surface in completely different places: an unreachable apiserver or an expired token discovered
55
+ * here is a setup error a caller can act on immediately, where the same fault discovered later
56
+ * surfaces on the `deployer` step of a run that has already paid for a design pass and an
57
+ * implementation.
58
+ */
59
+ export const testPublicEnvironmentConnectionContract = withMinScope('admin', defineApiContract({
60
+ method: 'post',
61
+ pathResolver: () => '/api/v1/environments/connections/test',
62
+ requestBodySchema: testPublicEnvironmentConnectionSchema,
63
+ responsesByStatusCode: { 200: publicEnvironmentConnectionTestSchema, ...errorResponses },
64
+ }));
65
+ /**
66
+ * Bind the workspace's environment provisioning to a cluster. Idempotent: re-connecting replaces.
67
+ *
68
+ * The path is `/connections` rather than the internal `/handlers`: a caller is describing a
69
+ * connection to infrastructure, where "handler" names the engine-side object that services it, and
70
+ * a frozen surface should carry the caller's vocabulary rather than the engine's.
71
+ */
72
+ export const connectPublicEnvironmentContract = withMinScope('admin', defineApiContract({
73
+ method: 'post',
74
+ pathResolver: () => '/api/v1/environments/connections',
75
+ requestBodySchema: connectPublicEnvironmentSchema,
76
+ responsesByStatusCode: { 201: publicEnvironmentConnectionViewSchema, ...errorResponses },
77
+ }));
78
+ // ---- a service's provisioning (the SOURCE half) -----------------------------
79
+ /**
80
+ * Patch a service: its authored fields, and where its per-run manifests live.
81
+ *
82
+ * The provisioning half is why this exists. A cluster connection alone provisions nothing, because
83
+ * the platform deliberately keeps "which cluster" (one per workspace) apart from "which manifests"
84
+ * (one set per service), and a caller with no way to declare the second could connect a cluster and
85
+ * still watch every `deployer` step report an empty manifest source.
86
+ *
87
+ * No board COORDINATES here, exactly as `POST /api/v1/services` has none: position, size and
88
+ * reparenting stay off a surface that is frozen forever.
89
+ */
90
+ export const updatePublicServiceContract = withMinScope('admin', defineApiContract({
91
+ method: 'patch',
92
+ requestPathParamsSchema: serviceIdParams,
93
+ pathResolver: ({ serviceId }) => `/api/v1/services/${serviceId}`,
94
+ requestBodySchema: updatePublicServiceSchema,
95
+ responsesByStatusCode: { 200: publicServiceSchema, ...errorResponses },
96
+ }));
97
+ // ---- what this deployment has WIRED -----------------------------------------
98
+ /**
99
+ * The workspace's model catalog, with the two flags that decide whether a run can dispatch.
100
+ *
101
+ * The alternative to serving this is not a different call, it is a caller discovering an unwired
102
+ * model forty minutes into a run it has already paid for.
103
+ */
104
+ export const listPublicWiredModelsContract = withMinScope('admin', defineApiContract({
105
+ method: 'get',
106
+ pathResolver: () => '/api/v1/models',
107
+ responsesByStatusCode: { 200: publicWiredModelListSchema, ...errorResponses },
108
+ }));
109
+ /**
110
+ * The workspace's VCS connection and what it may do, or `connection: null` when nothing is
111
+ * connected. Provider-neutral: a GitLab-connected workspace answers here too, and the row's own
112
+ * `provider` says which instance it talks to.
113
+ */
114
+ export const getPublicVcsConnectionContract = withMinScope('admin', defineApiContract({
115
+ method: 'get',
116
+ pathResolver: () => '/api/v1/vcs/connection',
117
+ responsesByStatusCode: { 200: publicVcsConnectionViewSchema, ...errorResponses },
118
+ }));
119
+ /**
120
+ * The workspace's merge-preset library. The `isDefault` row is the policy a task that pins none
121
+ * resolves, so it is the one that decides whether this caller's runs can land without a person.
122
+ */
123
+ export const listPublicMergePresetsContract = withMinScope('admin', defineApiContract({
124
+ method: 'get',
125
+ pathResolver: () => '/api/v1/merge-presets',
126
+ responsesByStatusCode: { 200: publicMergePresetListSchema, ...errorResponses },
127
+ }));
128
+ //# sourceMappingURL=public-provisioning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-provisioning.js","sourceRoot":"","sources":["../../src/routes/public-provisioning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EACL,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,qCAAqC,EACrC,qCAAqC,EACrC,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,qCAAqC,EACrC,yBAAyB,GAC1B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE9E,8EAA8E;AAC9E,uEAAuE;AACvE,EAAE;AACF,kGAAkG;AAClG,gGAAgG;AAChG,oGAAoG;AACpG,oEAAoE;AACpE,EAAE;AACF,+FAA+F;AAC/F,oGAAoG;AACpG,iGAAiG;AACjG,+FAA+F;AAC/F,kGAAkG;AAClG,8FAA8F;AAC9F,oFAAoF;AACpF,EAAE;AACF,oGAAoG;AACpG,iGAAiG;AACjG,0BAA0B;AAC1B,8EAA8E;AAE9E,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;AAC9C,MAAM,eAAe,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAA;AAEtD,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,YAAY,CAC1D,OAAO,EACP,iBAAiB,CAAC;IAChB,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,GAAG,EAAE,CAAC,yBAAyB;IAC7C,iBAAiB,EAAE,yBAAyB;IAC5C,qBAAqB,EAAE,EAAE,GAAG,EA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C5C,qBAAqB,EAAE,EAAE,GAAG,EAAE,mBAAmB,EAAE,GAAG,cAAc,EAAE;CACvE,CAAC,CACH,CAAA;AAED,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,YAAY,CACvD,OAAO,EACP,iBAAiB,CAAC;IAChB,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,GAAG,EAAE,CAAC,gBAAgB;IACpC,qBAAqB,EAAE,EAAE,GAAG,EAAE,0BAA0B,EAAE,GAAG,cAAc,EAAE;CAC9E,CAAC,CACH,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,YAAY,CACxD,OAAO,EACP,iBAAiB,CAAC;IAChB,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,GAAG,EAAE,CAAC,wBAAwB;IAC5C,qBAAqB,EAAE,EAAE,GAAG,EAAE,6BAA6B,EAAE,GAAG,cAAc,EAAE;CACjF,CAAC,CACH,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,YAAY,CACxD,OAAO,EACP,iBAAiB,CAAC;IAChB,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,GAAG,EAAE,CAAC,uBAAuB;IAC3C,qBAAqB,EAAE,EAAE,GAAG,EAAE,2BAA2B,EAAE,GAAG,cAAc,EAAE;CAC/E,CAAC,CACH,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/contracts",
3
- "version": "0.292.2",
3
+ "version": "0.294.0",
4
4
  "description": "Valibot wire contract shared between the Agent Architecture Board frontend and backend.",
5
5
  "repository": {
6
6
  "type": "git",