@cat-factory/contracts 0.6.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 (166) hide show
  1. package/LICENSE +21 -0
  2. package/dist/accounts.d.ts +103 -0
  3. package/dist/accounts.d.ts.map +1 -0
  4. package/dist/accounts.js +102 -0
  5. package/dist/accounts.js.map +1 -0
  6. package/dist/agent-config.d.ts +77 -0
  7. package/dist/agent-config.d.ts.map +1 -0
  8. package/dist/agent-config.js +78 -0
  9. package/dist/agent-config.js.map +1 -0
  10. package/dist/api-keys.d.ts +44 -0
  11. package/dist/api-keys.d.ts.map +1 -0
  12. package/dist/api-keys.js +49 -0
  13. package/dist/api-keys.js.map +1 -0
  14. package/dist/auth.d.ts +24 -0
  15. package/dist/auth.d.ts.map +1 -0
  16. package/dist/auth.js +15 -0
  17. package/dist/auth.js.map +1 -0
  18. package/dist/board-scan.d.ts +89 -0
  19. package/dist/board-scan.d.ts.map +1 -0
  20. package/dist/board-scan.js +122 -0
  21. package/dist/board-scan.js.map +1 -0
  22. package/dist/bootstrap.d.ts +168 -0
  23. package/dist/bootstrap.d.ts.map +1 -0
  24. package/dist/bootstrap.js +148 -0
  25. package/dist/bootstrap.js.map +1 -0
  26. package/dist/clarity.d.ts +75 -0
  27. package/dist/clarity.d.ts.map +1 -0
  28. package/dist/clarity.js +66 -0
  29. package/dist/clarity.js.map +1 -0
  30. package/dist/companion.d.ts +32 -0
  31. package/dist/companion.d.ts.map +1 -0
  32. package/dist/companion.js +43 -0
  33. package/dist/companion.js.map +1 -0
  34. package/dist/consensus.d.ts +195 -0
  35. package/dist/consensus.d.ts.map +1 -0
  36. package/dist/consensus.js +164 -0
  37. package/dist/consensus.js.map +1 -0
  38. package/dist/documents.d.ts +197 -0
  39. package/dist/documents.d.ts.map +1 -0
  40. package/dist/documents.js +161 -0
  41. package/dist/documents.js.map +1 -0
  42. package/dist/entities.d.ts +1691 -0
  43. package/dist/entities.d.ts.map +1 -0
  44. package/dist/entities.js +853 -0
  45. package/dist/entities.js.map +1 -0
  46. package/dist/environments.d.ts +426 -0
  47. package/dist/environments.d.ts.map +1 -0
  48. package/dist/environments.js +190 -0
  49. package/dist/environments.js.map +1 -0
  50. package/dist/events.d.ts +98 -0
  51. package/dist/events.d.ts.map +1 -0
  52. package/dist/events.js +2 -0
  53. package/dist/events.js.map +1 -0
  54. package/dist/fragment-library.d.ts +123 -0
  55. package/dist/fragment-library.d.ts.map +1 -0
  56. package/dist/fragment-library.js +88 -0
  57. package/dist/fragment-library.js.map +1 -0
  58. package/dist/github.d.ts +215 -0
  59. package/dist/github.d.ts.map +1 -0
  60. package/dist/github.js +204 -0
  61. package/dist/github.js.map +1 -0
  62. package/dist/index.d.ts +41 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +41 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/iteration-cap.d.ts +17 -0
  67. package/dist/iteration-cap.d.ts.map +1 -0
  68. package/dist/iteration-cap.js +25 -0
  69. package/dist/iteration-cap.js.map +1 -0
  70. package/dist/localModels.d.ts +54 -0
  71. package/dist/localModels.d.ts.map +1 -0
  72. package/dist/localModels.js +79 -0
  73. package/dist/localModels.js.map +1 -0
  74. package/dist/merge.d.ts +106 -0
  75. package/dist/merge.d.ts.map +1 -0
  76. package/dist/merge.js +129 -0
  77. package/dist/merge.js.map +1 -0
  78. package/dist/model-defaults.d.ts +23 -0
  79. package/dist/model-defaults.d.ts.map +1 -0
  80. package/dist/model-defaults.js +34 -0
  81. package/dist/model-defaults.js.map +1 -0
  82. package/dist/notifications.d.ts +136 -0
  83. package/dist/notifications.d.ts.map +1 -0
  84. package/dist/notifications.js +125 -0
  85. package/dist/notifications.js.map +1 -0
  86. package/dist/observability.d.ts +271 -0
  87. package/dist/observability.d.ts.map +1 -0
  88. package/dist/observability.js +152 -0
  89. package/dist/observability.js.map +1 -0
  90. package/dist/personal-subscriptions.d.ts +66 -0
  91. package/dist/personal-subscriptions.d.ts.map +1 -0
  92. package/dist/personal-subscriptions.js +70 -0
  93. package/dist/personal-subscriptions.js.map +1 -0
  94. package/dist/primitives.d.ts +57 -0
  95. package/dist/primitives.d.ts.map +1 -0
  96. package/dist/primitives.js +66 -0
  97. package/dist/primitives.js.map +1 -0
  98. package/dist/provisioning.d.ts +46 -0
  99. package/dist/provisioning.d.ts.map +1 -0
  100. package/dist/provisioning.js +107 -0
  101. package/dist/provisioning.js.map +1 -0
  102. package/dist/recurring.d.ts +117 -0
  103. package/dist/recurring.d.ts.map +1 -0
  104. package/dist/recurring.js +99 -0
  105. package/dist/recurring.js.map +1 -0
  106. package/dist/release.d.ts +60 -0
  107. package/dist/release.d.ts.map +1 -0
  108. package/dist/release.js +75 -0
  109. package/dist/release.js.map +1 -0
  110. package/dist/requests.d.ts +451 -0
  111. package/dist/requests.d.ts.map +1 -0
  112. package/dist/requests.js +231 -0
  113. package/dist/requests.js.map +1 -0
  114. package/dist/requirements.d.ts +127 -0
  115. package/dist/requirements.d.ts.map +1 -0
  116. package/dist/requirements.js +137 -0
  117. package/dist/requirements.js.map +1 -0
  118. package/dist/runners.d.ts +387 -0
  119. package/dist/runners.d.ts.map +1 -0
  120. package/dist/runners.js +117 -0
  121. package/dist/runners.js.map +1 -0
  122. package/dist/sandbox.d.ts +300 -0
  123. package/dist/sandbox.d.ts.map +1 -0
  124. package/dist/sandbox.js +243 -0
  125. package/dist/sandbox.js.map +1 -0
  126. package/dist/service-fragment-defaults.d.ts +16 -0
  127. package/dist/service-fragment-defaults.d.ts.map +1 -0
  128. package/dist/service-fragment-defaults.js +23 -0
  129. package/dist/service-fragment-defaults.js.map +1 -0
  130. package/dist/services.d.ts +81 -0
  131. package/dist/services.d.ts.map +1 -0
  132. package/dist/services.js +77 -0
  133. package/dist/services.js.map +1 -0
  134. package/dist/slack.d.ts +104 -0
  135. package/dist/slack.d.ts.map +1 -0
  136. package/dist/slack.js +98 -0
  137. package/dist/slack.js.map +1 -0
  138. package/dist/snapshot.d.ts +522 -0
  139. package/dist/snapshot.d.ts.map +1 -0
  140. package/dist/snapshot.js +104 -0
  141. package/dist/snapshot.js.map +1 -0
  142. package/dist/spec.d.ts +174 -0
  143. package/dist/spec.d.ts.map +1 -0
  144. package/dist/spec.js +173 -0
  145. package/dist/spec.js.map +1 -0
  146. package/dist/tasks.d.ts +150 -0
  147. package/dist/tasks.d.ts.map +1 -0
  148. package/dist/tasks.js +146 -0
  149. package/dist/tasks.js.map +1 -0
  150. package/dist/testing.d.ts +67 -0
  151. package/dist/testing.d.ts.map +1 -0
  152. package/dist/testing.js +64 -0
  153. package/dist/testing.js.map +1 -0
  154. package/dist/tracker.d.ts +18 -0
  155. package/dist/tracker.d.ts.map +1 -0
  156. package/dist/tracker.js +24 -0
  157. package/dist/tracker.js.map +1 -0
  158. package/dist/vendor-credentials.d.ts +37 -0
  159. package/dist/vendor-credentials.d.ts.map +1 -0
  160. package/dist/vendor-credentials.js +40 -0
  161. package/dist/vendor-credentials.js.map +1 -0
  162. package/dist/workspace-settings.d.ts +36 -0
  163. package/dist/workspace-settings.d.ts.map +1 -0
  164. package/dist/workspace-settings.js +41 -0
  165. package/dist/workspace-settings.js.map +1 -0
  166. package/package.json +31 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAkB5B,0DAA0D;AAC1D,eAAO,MAAM,oBAAoB,iDAAiC,CAAA;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAMvE;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;IAErC,iCAAiC;;IAEjC,uCAAuC;;IAEvC,yDAAyD;;;;;;;;IAEzD,6CAA6C;;IAE7C,mDAAmD;;IAEnD;;;;OAIG;;aAEH,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW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AAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEpE,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB;;aAE5B,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEtE,iEAAiE;AACjE,eAAO,MAAM,cAAc;;;;aAIzB,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CAAA;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;IAGpC,sDAAsD;;aAEtD,CAAA;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
package/dist/tasks.js ADDED
@@ -0,0 +1,146 @@
1
+ import * as v from 'valibot';
2
+ import { credentialFieldSchema } from './documents.js';
3
+ // ---------------------------------------------------------------------------
4
+ // Task-source integration wire contracts. A workspace can connect to one or
5
+ // more external task/issue trackers (Jira, …), import individual issues
6
+ // (projected locally as structured records), and attach an issue to a board
7
+ // block as extra agent context.
8
+ //
9
+ // This is a sibling of the document-source integration, but task-shaped: an
10
+ // issue is a first-class structured entity (status / type / assignee / priority
11
+ // / labels + a Markdown description + comments), not a single page body. There
12
+ // is deliberately no planner/spawn surface — issues are linked for context, not
13
+ // expanded into board structure. Storage-only bookkeeping (the owning
14
+ // workspace, the credential bag, the soft-delete tombstone) is NOT on the wire;
15
+ // it lives in the core ports / D1 layer.
16
+ // ---------------------------------------------------------------------------
17
+ /** The external task trackers cat-factory can link to. */
18
+ export const taskSourceKindSchema = v.picklist(['jira', 'github']);
19
+ // ---- Provider self-description (drives the generic connect UI) ------------
20
+ // `credentialFieldSchema` is shared with the document-source contracts: a
21
+ // credential form field is identical regardless of what it connects to.
22
+ /**
23
+ * Everything the frontend needs to render a source's connect form and import
24
+ * box without hard-coding any provider specifics.
25
+ */
26
+ export const taskSourceDescriptorSchema = v.object({
27
+ source: taskSourceKindSchema,
28
+ /** Display name, e.g. `Jira`. */
29
+ label: v.string(),
30
+ /** Lucide icon name for the source. */
31
+ icon: v.string(),
32
+ /** Credentials required to connect, in display order. */
33
+ credentialFields: v.array(credentialFieldSchema),
34
+ /** Label for the "import an issue" input. */
35
+ refLabel: v.string(),
36
+ /** Placeholder for the "import an issue" input. */
37
+ refPlaceholder: v.string(),
38
+ /**
39
+ * Whether this source supports searching its catalogue by title/content (so
40
+ * the UI offers a search box, not just a paste-a-URL field). Optional for
41
+ * backward-compatibility; absent is treated as `false`.
42
+ */
43
+ searchable: v.optional(v.boolean()),
44
+ });
45
+ // ---- Connection + task projections ----------------------------------------
46
+ /** A workspace's connection to a task source, as exposed to clients (never the credentials). */
47
+ export const taskConnectionSchema = v.object({
48
+ source: taskSourceKindSchema,
49
+ /** A human-friendly label for what we're connected to (site URL). */
50
+ label: v.string(),
51
+ /** When the connection was established (epoch ms). */
52
+ connectedAt: v.number(),
53
+ });
54
+ /** A single comment on an issue, with its body normalized to Markdown. */
55
+ export const taskCommentSchema = v.object({
56
+ /** Comment author's display name; '' when unknown. */
57
+ author: v.string(),
58
+ /** Source-supplied creation timestamp, kept as the source's ISO string. */
59
+ createdAt: v.string(),
60
+ /** Comment body, normalized to lightweight Markdown. */
61
+ body: v.string(),
62
+ });
63
+ /** An issue imported from a source, projected locally as a structured record. */
64
+ export const sourceTaskSchema = v.object({
65
+ source: taskSourceKindSchema,
66
+ /** The source's canonical key for the issue (e.g. a Jira issue key `PROJ-123`). */
67
+ externalId: v.string(),
68
+ /** Issue summary / title. */
69
+ title: v.string(),
70
+ /** Canonical URL of the issue on the source. */
71
+ url: v.string(),
72
+ /** Workflow status name, e.g. `In Progress`. */
73
+ status: v.string(),
74
+ /** Issue type name, e.g. `Bug`. */
75
+ type: v.string(),
76
+ /** Assignee display name, or null when unassigned. */
77
+ assignee: v.nullable(v.string()),
78
+ /** Priority name, or null when none. */
79
+ priority: v.nullable(v.string()),
80
+ /** Issue labels. */
81
+ labels: v.array(v.string()),
82
+ /** Issue description, normalized to lightweight Markdown. */
83
+ description: v.string(),
84
+ /** Recent comments, oldest→newest, bodies normalized to Markdown. */
85
+ comments: v.array(taskCommentSchema),
86
+ /** A short plain-text excerpt of the issue (for list/preview rendering). */
87
+ excerpt: v.string(),
88
+ /** The board block this issue is attached to as context, if any. */
89
+ linkedBlockId: v.nullable(v.string()),
90
+ /** When this projection row was last refreshed (epoch ms). */
91
+ syncedAt: v.number(),
92
+ });
93
+ /**
94
+ * A single hit from searching a tracker. A lean shape (no description/comments)
95
+ * used to populate a picker: selecting one imports it (by `externalId`) and
96
+ * links it to a block. Distinct from {@link SourceTask} — a hit is not yet
97
+ * projected locally, so it carries no `linkedBlockId`/`syncedAt`.
98
+ */
99
+ export const taskSearchResultSchema = v.object({
100
+ source: taskSourceKindSchema,
101
+ /** The source's canonical key for the issue (re-usable as an import ref). */
102
+ externalId: v.string(),
103
+ title: v.string(),
104
+ /** Canonical URL of the issue on the source. */
105
+ url: v.string(),
106
+ /** Workflow status name, e.g. `In Progress` (may be empty). */
107
+ status: v.string(),
108
+ /** A short plain-text excerpt for the result row (may be empty). */
109
+ excerpt: v.string(),
110
+ });
111
+ // ---- Request bodies -------------------------------------------------------
112
+ /**
113
+ * Connect a workspace to a task source. The `credentials` bag is validated by
114
+ * the target provider (the `:source` is in the path), keeping the wire shape
115
+ * uniform across providers.
116
+ */
117
+ export const connectTaskSourceSchema = v.object({
118
+ credentials: v.record(v.string(), v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(2000))),
119
+ });
120
+ /** Import (fetch + persist) an issue by its key or a full issue URL. */
121
+ export const importTaskSchema = v.object({
122
+ ref: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(500)),
123
+ });
124
+ /** Search a tracker's issues by free text (title/content). */
125
+ export const searchTasksSchema = v.object({
126
+ query: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(200)),
127
+ });
128
+ /** Attach an imported issue to a task as extra agent context. */
129
+ export const linkTaskSchema = v.object({
130
+ source: taskSourceKindSchema,
131
+ externalId: v.pipe(v.string(), v.trim(), v.minLength(1)),
132
+ blockId: v.pipe(v.string(), v.trim(), v.minLength(1)),
133
+ });
134
+ /**
135
+ * Materialise an imported issue as a new board task (a leaf block) inside a
136
+ * container (service frame or module), and link the issue to it for context. The
137
+ * issue must already be imported (its key is `externalId`). The new task's
138
+ * title/description are seeded from the issue.
139
+ */
140
+ export const createTaskFromIssueSchema = v.object({
141
+ source: taskSourceKindSchema,
142
+ externalId: v.pipe(v.string(), v.trim(), v.minLength(1)),
143
+ /** The frame or module the new task is created in. */
144
+ containerId: v.pipe(v.string(), v.trim(), v.minLength(1)),
145
+ });
146
+ //# sourceMappingURL=tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,8EAA8E;AAC9E,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,gCAAgC;AAChC,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,sEAAsE;AACtE,gFAAgF;AAChF,yCAAyC;AACzC,8EAA8E;AAE9E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;AAGlE,8EAA8E;AAC9E,0EAA0E;AAC1E,wEAAwE;AAExE;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,MAAM,EAAE,oBAAoB;IAC5B,iCAAiC;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,uCAAuC;IACvC,IAAI,EAAE,CA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,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACxD,sDAAsD;IACtD,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAC1D,CAAC,CAAA"}
@@ -0,0 +1,67 @@
1
+ import * as v from 'valibot';
2
+ /** How serious a concern the Tester surfaced is. */
3
+ export declare const testConcernSeveritySchema: v.PicklistSchema<["low", "medium", "high", "critical"], undefined>;
4
+ export type TestConcernSeverity = v.InferOutput<typeof testConcernSeveritySchema>;
5
+ /** A bug or risk the Tester uncovered, to be addressed by the `fixer` before re-test. */
6
+ export declare const testConcernSchema: v.ObjectSchema<{
7
+ /** Short subject of the concern. */
8
+ readonly title: v.StringSchema<undefined>;
9
+ /** What's wrong / what was observed, concretely. */
10
+ readonly detail: v.StringSchema<undefined>;
11
+ /** Severity, so the fixer (and a human) can triage. */
12
+ readonly severity: v.PicklistSchema<["low", "medium", "high", "critical"], undefined>;
13
+ }, undefined>;
14
+ export type TestConcern = v.InferOutput<typeof testConcernSchema>;
15
+ /** The result of exercising one tested area / requirement. */
16
+ export declare const testOutcomeSchema: v.ObjectSchema<{
17
+ /** What was exercised (a requirement, scenario or area). */
18
+ readonly name: v.StringSchema<undefined>;
19
+ /** Whether it passed, failed, or could not be run. */
20
+ readonly status: v.PicklistSchema<["passed", "failed", "skipped"], undefined>;
21
+ /** Optional detail (the failure message, why it was skipped, etc.). */
22
+ readonly detail: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
23
+ }, undefined>;
24
+ export type TestOutcome = v.InferOutput<typeof testOutcomeSchema>;
25
+ /**
26
+ * A Tester's structured report. `greenlight` is the gate's verdict: true means the
27
+ * change is safe to release (no blocking concerns); false routes the run through
28
+ * the `fixer`. `tested` lists what the Tester decided to cover (this task's
29
+ * requirements plus best-judgement regression of related ones); `outcomes` are the
30
+ * per-area results; `concerns` are the bugs/risks to fix before re-testing.
31
+ */
32
+ export declare const testReportSchema: v.ObjectSchema<{
33
+ /** The gate verdict: release-ready (true) or needs fixing (false). */
34
+ readonly greenlight: v.BooleanSchema<undefined>;
35
+ /** Plain-prose overall summary of the testing session. */
36
+ readonly summary: v.StringSchema<undefined>;
37
+ /** What the Tester chose to exercise (requirements + regression areas). */
38
+ readonly tested: v.ArraySchema<v.StringSchema<undefined>, undefined>;
39
+ /** Per-area results. */
40
+ readonly outcomes: v.ArraySchema<v.ObjectSchema<{
41
+ /** What was exercised (a requirement, scenario or area). */
42
+ readonly name: v.StringSchema<undefined>;
43
+ /** Whether it passed, failed, or could not be run. */
44
+ readonly status: v.PicklistSchema<["passed", "failed", "skipped"], undefined>;
45
+ /** Optional detail (the failure message, why it was skipped, etc.). */
46
+ readonly detail: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
47
+ }, undefined>, undefined>;
48
+ /**
49
+ * Bugs/risks uncovered. A `high`/`critical` (blocking) concern implies
50
+ * `greenlight` must be false; `low`/`medium` concerns are advisory and do not, on
51
+ * their own, withhold the greenlight. The engine re-applies this rule defensively.
52
+ */
53
+ readonly concerns: v.ArraySchema<v.ObjectSchema<{
54
+ /** Short subject of the concern. */
55
+ readonly title: v.StringSchema<undefined>;
56
+ /** What's wrong / what was observed, concretely. */
57
+ readonly detail: v.StringSchema<undefined>;
58
+ /** Severity, so the fixer (and a human) can triage. */
59
+ readonly severity: v.PicklistSchema<["low", "medium", "high", "critical"], undefined>;
60
+ }, undefined>, undefined>;
61
+ /** Which environment the suite ran in, echoed back for the UI. */
62
+ readonly environment: v.OptionalSchema<v.PicklistSchema<["local", "ephemeral"], undefined>, undefined>;
63
+ }, undefined>;
64
+ export type TestReport = v.InferOutput<typeof testReportSchema>;
65
+ /** Parse-or-throw a test report payload an agent returned (the engine validates it). */
66
+ export declare function parseTestReport(value: unknown): TestReport;
67
+ //# sourceMappingURL=testing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAgB5B,oDAAoD;AACpD,eAAO,MAAM,yBAAyB,oEAAoD,CAAA;AAC1F,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEjF,yFAAyF;AACzF,eAAO,MAAM,iBAAiB;IAC5B,oCAAoC;;IAEpC,oDAAoD;;IAEpD,uDAAuD;;aAEvD,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEjE,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB;IAC5B,4DAA4D;;IAE5D,sDAAsD;;IAEtD,uEAAuE;;aAEvE,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEjE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B,sEAAsE;;IAEtE,0DAA0D;;IAE1D,2EAA2E;;IAE3E,wBAAwB;;QAvBxB,4DAA4D;;QAE5D,sDAAsD;;QAEtD,uEAAuE;;;IAqBvE;;;;OAIG;;QAxCH,oCAAoC;;QAEpC,oDAAoD;;QAEpD,uDAAuD;;;IAsCvD,kEAAkE;;aAElE,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAE1D"}
@@ -0,0 +1,64 @@
1
+ import * as v from 'valibot';
2
+ // ---------------------------------------------------------------------------
3
+ // Tester / Fixer wire contracts.
4
+ //
5
+ // The `tester` agent runs the project's tests — either against a provisioned
6
+ // ephemeral environment or with its dependencies stood up locally (the Tester's
7
+ // contributed `tester.environment` config picks which) — and returns a structured
8
+ // report of what it exercised and what it found. If the report withholds its
9
+ // greenlight (concerns/bugs surfaced), the engine dispatches the dedicated
10
+ // `fixer` agent, hands it the report, and re-runs the Tester against the fixed
11
+ // branch — looping until the Tester greenlights or the attempt budget is spent.
12
+ // This mirrors the CI → ci-fixer gate, but the gate's signal is the Tester's own
13
+ // structured report rather than GitHub check runs.
14
+ // ---------------------------------------------------------------------------
15
+ /** How serious a concern the Tester surfaced is. */
16
+ export const testConcernSeveritySchema = v.picklist(['low', 'medium', 'high', 'critical']);
17
+ /** A bug or risk the Tester uncovered, to be addressed by the `fixer` before re-test. */
18
+ export const testConcernSchema = v.object({
19
+ /** Short subject of the concern. */
20
+ title: v.string(),
21
+ /** What's wrong / what was observed, concretely. */
22
+ detail: v.string(),
23
+ /** Severity, so the fixer (and a human) can triage. */
24
+ severity: testConcernSeveritySchema,
25
+ });
26
+ /** The result of exercising one tested area / requirement. */
27
+ export const testOutcomeSchema = v.object({
28
+ /** What was exercised (a requirement, scenario or area). */
29
+ name: v.string(),
30
+ /** Whether it passed, failed, or could not be run. */
31
+ status: v.picklist(['passed', 'failed', 'skipped']),
32
+ /** Optional detail (the failure message, why it was skipped, etc.). */
33
+ detail: v.optional(v.string()),
34
+ });
35
+ /**
36
+ * A Tester's structured report. `greenlight` is the gate's verdict: true means the
37
+ * change is safe to release (no blocking concerns); false routes the run through
38
+ * the `fixer`. `tested` lists what the Tester decided to cover (this task's
39
+ * requirements plus best-judgement regression of related ones); `outcomes` are the
40
+ * per-area results; `concerns` are the bugs/risks to fix before re-testing.
41
+ */
42
+ export const testReportSchema = v.object({
43
+ /** The gate verdict: release-ready (true) or needs fixing (false). */
44
+ greenlight: v.boolean(),
45
+ /** Plain-prose overall summary of the testing session. */
46
+ summary: v.string(),
47
+ /** What the Tester chose to exercise (requirements + regression areas). */
48
+ tested: v.array(v.string()),
49
+ /** Per-area results. */
50
+ outcomes: v.array(testOutcomeSchema),
51
+ /**
52
+ * Bugs/risks uncovered. A `high`/`critical` (blocking) concern implies
53
+ * `greenlight` must be false; `low`/`medium` concerns are advisory and do not, on
54
+ * their own, withhold the greenlight. The engine re-applies this rule defensively.
55
+ */
56
+ concerns: v.array(testConcernSchema),
57
+ /** Which environment the suite ran in, echoed back for the UI. */
58
+ environment: v.optional(v.picklist(['local', 'ephemeral'])),
59
+ });
60
+ /** Parse-or-throw a test report payload an agent returned (the engine validates it). */
61
+ export function parseTestReport(value) {
62
+ return v.parse(testReportSchema, value);
63
+ }
64
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,iCAAiC;AACjC,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,kFAAkF;AAClF,6EAA6E;AAC7E,2EAA2E;AAC3E,+EAA+E;AAC/E,gFAAgF;AAChF,iFAAiF;AACjF,mDAAmD;AACnD,8EAA8E;AAE9E,oDAAoD;AACpD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;AAG1F,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,oCAAoC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,oDAAoD;IACpD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,uDAAuD;IACvD,QAAQ,EAAE,yBAAyB;CACpC,CAAC,CAAA;AAGF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,4DAA4D;IAC5D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,sDAAsD;IACtD,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACnD,uEAAuE;IACvE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC/B,CAAC,CAAA;AAGF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,sEAAsE;IACtE,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,0DAA0D;IAC1D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,2EAA2E;IAC3E,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3B,wBAAwB;IACxB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACpC,kEAAkE;IAClE,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;CAC5D,CAAC,CAAA;AAGF,wFAAwF;AACxF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CAAC,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;AACzC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import * as v from 'valibot';
2
+ export declare const trackerKindSchema: v.PicklistSchema<["github", "jira"], undefined>;
3
+ export type TrackerKind = v.InferOutput<typeof trackerKindSchema>;
4
+ /** A workspace's issue-tracker selection. `tracker: null` means none configured. */
5
+ export declare const trackerSettingsSchema: v.ObjectSchema<{
6
+ readonly tracker: v.NullableSchema<v.PicklistSchema<["github", "jira"], undefined>, undefined>;
7
+ /** Jira project key new tickets are filed under (e.g. "ENG"); null unless Jira. */
8
+ readonly jiraProjectKey: v.NullableSchema<v.StringSchema<undefined>, undefined>;
9
+ readonly updatedAt: v.NumberSchema<undefined>;
10
+ }, undefined>;
11
+ export type TrackerSettings = v.InferOutput<typeof trackerSettingsSchema>;
12
+ /** Set a workspace's issue-tracker selection. */
13
+ export declare const putTrackerSettingsSchema: v.ObjectSchema<{
14
+ readonly tracker: v.NullableSchema<v.PicklistSchema<["github", "jira"], undefined>, undefined>;
15
+ readonly jiraProjectKey: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, undefined>;
16
+ }, undefined>;
17
+ export type PutTrackerSettingsInput = v.InferOutput<typeof putTrackerSettingsSchema>;
18
+ //# sourceMappingURL=tracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../src/tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAY5B,eAAO,MAAM,iBAAiB,iDAAiC,CAAA;AAC/D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEjE,oFAAoF;AACpF,eAAO,MAAM,qBAAqB;;IAEhC,mFAAmF;;;aAGnF,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,iDAAiD;AACjD,eAAO,MAAM,wBAAwB;;;aAGnC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,24 @@
1
+ import * as v from 'valibot';
2
+ // ---------------------------------------------------------------------------
3
+ // Issue-tracker wire contracts. A workspace can designate ONE issue tracker —
4
+ // GitHub Issues or Jira — where automated flows (notably the tech-debt recurring
5
+ // pipeline's `tracker` step) file the ticket they raise before implementation
6
+ // starts. The choice is workspace-level config; the credentials it uses come from
7
+ // the existing GitHub App installation (for GitHub) or the workspace's Jira
8
+ // `task_connections` row (for Jira), so only the selection + Jira project key live
9
+ // here.
10
+ // ---------------------------------------------------------------------------
11
+ export const trackerKindSchema = v.picklist(['github', 'jira']);
12
+ /** A workspace's issue-tracker selection. `tracker: null` means none configured. */
13
+ export const trackerSettingsSchema = v.object({
14
+ tracker: v.nullable(trackerKindSchema),
15
+ /** Jira project key new tickets are filed under (e.g. "ENG"); null unless Jira. */
16
+ jiraProjectKey: v.nullable(v.string()),
17
+ updatedAt: v.number(),
18
+ });
19
+ /** Set a workspace's issue-tracker selection. */
20
+ export const putTrackerSettingsSchema = v.object({
21
+ tracker: v.nullable(trackerKindSchema),
22
+ jiraProjectKey: v.optional(v.nullable(v.pipe(v.string(), v.trim()))),
23
+ });
24
+ //# sourceMappingURL=tracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracker.js","sourceRoot":"","sources":["../src/tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAC9E,kFAAkF;AAClF,4EAA4E;AAC5E,mFAAmF;AACnF,QAAQ;AACR,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAA;AAG/D,oFAAoF;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACtC,mFAAmF;IACnF,cAAc,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAA;AAGF,iDAAiD;AACjD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACtC,cAAc,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;CACrE,CAAC,CAAA"}
@@ -0,0 +1,37 @@
1
+ import * as v from 'valibot';
2
+ /** Vendors whose subscription harnesses we support. */
3
+ export declare const subscriptionVendorSchema: v.PicklistSchema<["claude", "codex", "glm", "kimi", "deepseek"], undefined>;
4
+ export type SubscriptionVendor = v.InferOutput<typeof subscriptionVendorSchema>;
5
+ /** One pool token as exposed to clients — metadata + usage, never the secret. */
6
+ export declare const vendorCredentialSchema: v.ObjectSchema<{
7
+ readonly id: v.StringSchema<undefined>;
8
+ readonly vendor: v.PicklistSchema<["claude", "codex", "glm", "kimi", "deepseek"], undefined>;
9
+ readonly label: v.StringSchema<undefined>;
10
+ readonly createdAt: v.NumberSchema<undefined>;
11
+ readonly lastUsedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
12
+ /** Rolling-window usage so the UI can show load and rotation fairness. */
13
+ readonly inputTokens: v.NumberSchema<undefined>;
14
+ readonly outputTokens: v.NumberSchema<undefined>;
15
+ readonly requestCount: v.NumberSchema<undefined>;
16
+ }, undefined>;
17
+ export type VendorCredential = v.InferOutput<typeof vendorCredentialSchema>;
18
+ export declare const vendorCredentialListSchema: v.ArraySchema<v.ObjectSchema<{
19
+ readonly id: v.StringSchema<undefined>;
20
+ readonly vendor: v.PicklistSchema<["claude", "codex", "glm", "kimi", "deepseek"], undefined>;
21
+ readonly label: v.StringSchema<undefined>;
22
+ readonly createdAt: v.NumberSchema<undefined>;
23
+ readonly lastUsedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
24
+ /** Rolling-window usage so the UI can show load and rotation fairness. */
25
+ readonly inputTokens: v.NumberSchema<undefined>;
26
+ readonly outputTokens: v.NumberSchema<undefined>;
27
+ readonly requestCount: v.NumberSchema<undefined>;
28
+ }, undefined>, undefined>;
29
+ export type VendorCredentialList = v.InferOutput<typeof vendorCredentialListSchema>;
30
+ /** Add a token to the pool. `token` is write-only (the raw secret blob). */
31
+ export declare const addVendorCredentialSchema: v.ObjectSchema<{
32
+ readonly vendor: v.PicklistSchema<["claude", "codex", "glm", "kimi", "deepseek"], undefined>;
33
+ readonly label: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>;
34
+ readonly token: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
35
+ }, undefined>;
36
+ export type AddVendorCredentialInput = v.InferOutput<typeof addVendorCredentialSchema>;
37
+ //# sourceMappingURL=vendor-credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendor-credentials.d.ts","sourceRoot":"","sources":["../src/vendor-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAoB5B,uDAAuD;AACvD,eAAO,MAAM,wBAAwB,6EAA6D,CAAA;AAClG,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE/E,iFAAiF;AACjF,eAAO,MAAM,sBAAsB;;;;;;IAMjC,0EAA0E;;;;aAI1E,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE3E,eAAO,MAAM,0BAA0B;;;;;;IAPrC,0EAA0E;;;;yBAOH,CAAA;AACzE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEnF,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB;;;;aAIpC,CAAA;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
@@ -0,0 +1,40 @@
1
+ import * as v from 'valibot';
2
+ // ---------------------------------------------------------------------------
3
+ // Provider-subscription (vendor) credential wire contracts.
4
+ //
5
+ // A workspace connects one or more subscription credentials per vendor so the
6
+ // Claude Code / Codex harnesses can authenticate inside a per-run container
7
+ // without an API key:
8
+ // - `claude`: a long-lived OAuth token from `claude setup-token`
9
+ // (injected as CLAUDE_CODE_OAUTH_TOKEN, talks to api.anthropic.com).
10
+ // - `glm` / `kimi` / `deepseek`: a coding-plan API key for a vendor that exposes
11
+ // an Anthropic-compatible endpoint (Z.ai / Moonshot / DeepSeek), driven by
12
+ // Claude Code via ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN.
13
+ // - `codex`: the full ChatGPT `auth.json` bundle (written to $CODEX_HOME).
14
+ //
15
+ // Tokens form a pool, leased with usage-aware rotation. The raw secret is
16
+ // write-only — it is encrypted at rest and never returned; only metadata +
17
+ // rolling-window usage counters are exposed back to clients.
18
+ // ---------------------------------------------------------------------------
19
+ /** Vendors whose subscription harnesses we support. */
20
+ export const subscriptionVendorSchema = v.picklist(['claude', 'codex', 'glm', 'kimi', 'deepseek']);
21
+ /** One pool token as exposed to clients — metadata + usage, never the secret. */
22
+ export const vendorCredentialSchema = v.object({
23
+ id: v.string(),
24
+ vendor: subscriptionVendorSchema,
25
+ label: v.string(),
26
+ createdAt: v.number(),
27
+ lastUsedAt: v.nullable(v.number()),
28
+ /** Rolling-window usage so the UI can show load and rotation fairness. */
29
+ inputTokens: v.number(),
30
+ outputTokens: v.number(),
31
+ requestCount: v.number(),
32
+ });
33
+ export const vendorCredentialListSchema = v.array(vendorCredentialSchema);
34
+ /** Add a token to the pool. `token` is write-only (the raw secret blob). */
35
+ export const addVendorCredentialSchema = v.object({
36
+ vendor: subscriptionVendorSchema,
37
+ label: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(120)),
38
+ token: v.pipe(v.string(), v.trim(), v.minLength(1)),
39
+ });
40
+ //# sourceMappingURL=vendor-credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendor-credentials.js","sourceRoot":"","sources":["../src/vendor-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,4DAA4D;AAC5D,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,sBAAsB;AACtB,mEAAmE;AACnE,yEAAyE;AACzE,mFAAmF;AACnF,+EAA+E;AAC/E,iEAAiE;AACjE,6EAA6E;AAC7E,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,6DAA6D;AAC7D,8EAA8E;AAE9E,uDAAuD;AACvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;AAGlG,iFAAiF;AACjF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,wBAAwB;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,0EAA0E;IAC1E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;AAGzE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,MAAM,EAAE,wBAAwB;IAChC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACrE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CACpD,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ import * as v from 'valibot';
2
+ /**
3
+ * How the per-service running-task limit is bucketed:
4
+ * - `off` — no limit (the default).
5
+ * - `shared` — one shared cap across all task types under a service.
6
+ * - `per_type` — a separate cap per task type under a service.
7
+ */
8
+ export declare const taskLimitModeSchema: v.PicklistSchema<["off", "shared", "per_type"], undefined>;
9
+ export type TaskLimitMode = v.InferOutput<typeof taskLimitModeSchema>;
10
+ /** Per-task-type running-task caps (used when {@link taskLimitModeSchema} is `per_type`). */
11
+ export declare const taskLimitPerTypeSchema: v.RecordSchema<v.PicklistSchema<["feature", "bug", "document", "spike"], undefined>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
12
+ export type TaskLimitPerType = v.InferOutput<typeof taskLimitPerTypeSchema>;
13
+ /** A workspace's runtime settings. */
14
+ export declare const workspaceSettingsSchema: v.ObjectSchema<{
15
+ /**
16
+ * Minutes a run may wait for human input before its open notification escalates
17
+ * from `normal` (yellow) to `urgent` (red). The run itself is never auto-failed.
18
+ */
19
+ readonly waitingEscalationMinutes: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100000, undefined>]>;
20
+ /** Whether/how the per-service running-task limit is enforced. */
21
+ readonly taskLimitMode: v.PicklistSchema<["off", "shared", "per_type"], undefined>;
22
+ /** The shared cap, when {@link taskLimitMode} is `shared`. Null otherwise. */
23
+ readonly taskLimitShared: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
24
+ /** The per-type caps, when {@link taskLimitMode} is `per_type`. Null otherwise. */
25
+ readonly taskLimitPerType: v.NullableSchema<v.RecordSchema<v.PicklistSchema<["feature", "bug", "document", "spike"], undefined>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>, undefined>;
26
+ }, undefined>;
27
+ export type WorkspaceSettings = v.InferOutput<typeof workspaceSettingsSchema>;
28
+ /** Update a workspace's runtime settings (full replace of the supplied fields). */
29
+ export declare const updateWorkspaceSettingsSchema: v.ObjectSchema<{
30
+ readonly waitingEscalationMinutes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100000, undefined>]>, undefined>;
31
+ readonly taskLimitMode: v.OptionalSchema<v.PicklistSchema<["off", "shared", "per_type"], undefined>, undefined>;
32
+ readonly taskLimitShared: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>, undefined>;
33
+ readonly taskLimitPerType: v.OptionalSchema<v.NullableSchema<v.RecordSchema<v.PicklistSchema<["feature", "bug", "document", "spike"], undefined>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>, undefined>, undefined>;
34
+ }, undefined>;
35
+ export type UpdateWorkspaceSettingsInput = v.InferOutput<typeof updateWorkspaceSettingsSchema>;
36
+ //# sourceMappingURL=workspace-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-settings.d.ts","sourceRoot":"","sources":["../src/workspace-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAW5B;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,4DAA4C,CAAA;AAC5E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAIrE,6FAA6F;AAC7F,eAAO,MAAM,sBAAsB,gRAA8C,CAAA;AACjF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE3E,sCAAsC;AACtC,eAAO,MAAM,uBAAuB;IAClC;;;OAGG;;IAEH,kEAAkE;;IAElE,8EAA8E;;IAE9E,mFAAmF;;aAEnF,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E,mFAAmF;AACnF,eAAO,MAAM,6BAA6B;;;;;aAOxC,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
@@ -0,0 +1,41 @@
1
+ import * as v from 'valibot';
2
+ import { createTaskTypeSchema } from './primitives.js';
3
+ // ---------------------------------------------------------------------------
4
+ // Per-workspace runtime settings. A single settings object per workspace (lazily
5
+ // seeded from the defaults) holding the operator-tunable policies that aren't
6
+ // per-task: how long a run may wait for a human before its notification escalates
7
+ // to red, and whether/how to cap the number of tasks running concurrently under one
8
+ // service. Persisted in the `workspace_settings` table on both runtime facades.
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * How the per-service running-task limit is bucketed:
12
+ * - `off` — no limit (the default).
13
+ * - `shared` — one shared cap across all task types under a service.
14
+ * - `per_type` — a separate cap per task type under a service.
15
+ */
16
+ export const taskLimitModeSchema = v.picklist(['off', 'shared', 'per_type']);
17
+ const limitSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1000));
18
+ /** Per-task-type running-task caps (used when {@link taskLimitModeSchema} is `per_type`). */
19
+ export const taskLimitPerTypeSchema = v.record(createTaskTypeSchema, limitSchema);
20
+ /** A workspace's runtime settings. */
21
+ export const workspaceSettingsSchema = v.object({
22
+ /**
23
+ * Minutes a run may wait for human input before its open notification escalates
24
+ * from `normal` (yellow) to `urgent` (red). The run itself is never auto-failed.
25
+ */
26
+ waitingEscalationMinutes: v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(100_000)),
27
+ /** Whether/how the per-service running-task limit is enforced. */
28
+ taskLimitMode: taskLimitModeSchema,
29
+ /** The shared cap, when {@link taskLimitMode} is `shared`. Null otherwise. */
30
+ taskLimitShared: v.nullable(limitSchema),
31
+ /** The per-type caps, when {@link taskLimitMode} is `per_type`. Null otherwise. */
32
+ taskLimitPerType: v.nullable(taskLimitPerTypeSchema),
33
+ });
34
+ /** Update a workspace's runtime settings (full replace of the supplied fields). */
35
+ export const updateWorkspaceSettingsSchema = v.object({
36
+ waitingEscalationMinutes: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(100_000))),
37
+ taskLimitMode: v.optional(taskLimitModeSchema),
38
+ taskLimitShared: v.optional(v.nullable(limitSchema)),
39
+ taskLimitPerType: v.optional(v.nullable(taskLimitPerTypeSchema)),
40
+ });
41
+ //# sourceMappingURL=workspace-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-settings.js","sourceRoot":"","sources":["../src/workspace-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,C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CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CACpE;IACD,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC9C,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACpD,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;CACjE,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@cat-factory/contracts",
3
+ "version": "0.6.0",
4
+ "description": "Valibot wire contract shared between the Agent Architecture Board frontend and backend.",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "type": "module",
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "dependencies": {
22
+ "valibot": "^1.4.1"
23
+ },
24
+ "devDependencies": {
25
+ "typescript": "7.0.1-rc"
26
+ },
27
+ "scripts": {
28
+ "build": "tsc -b tsconfig.build.json",
29
+ "typecheck": "tsc -p tsconfig.json --noEmit"
30
+ }
31
+ }