@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,197 @@
1
+ import * as v from 'valibot';
2
+ /** The external document sources cat-factory can link to. */
3
+ export declare const documentSourceKindSchema: v.PicklistSchema<["confluence", "notion", "github"], undefined>;
4
+ export type DocumentSourceKind = v.InferOutput<typeof documentSourceKindSchema>;
5
+ /** One credential a provider needs to connect (rendered as a form field). */
6
+ export declare const credentialFieldSchema: v.ObjectSchema<{
7
+ /** Stable key stored in the credential bag (e.g. `apiToken`). */
8
+ readonly key: v.StringSchema<undefined>;
9
+ /** Human label for the form field. */
10
+ readonly label: v.StringSchema<undefined>;
11
+ /** Optional helper text shown under the field. */
12
+ readonly help: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
13
+ /** Optional input placeholder. */
14
+ readonly placeholder: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
15
+ /** Render as a password input and never echo the value back. */
16
+ readonly secret: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
17
+ }, undefined>;
18
+ export type CredentialField = v.InferOutput<typeof credentialFieldSchema>;
19
+ /**
20
+ * Everything the frontend needs to render a source's connect form and import
21
+ * box without hard-coding any provider specifics.
22
+ */
23
+ export declare const documentSourceDescriptorSchema: v.ObjectSchema<{
24
+ readonly source: v.PicklistSchema<["confluence", "notion", "github"], undefined>;
25
+ /** Display name, e.g. `Confluence`. */
26
+ readonly label: v.StringSchema<undefined>;
27
+ /** Lucide icon name for the source. */
28
+ readonly icon: v.StringSchema<undefined>;
29
+ /** Credentials required to connect, in display order. */
30
+ readonly credentialFields: v.ArraySchema<v.ObjectSchema<{
31
+ /** Stable key stored in the credential bag (e.g. `apiToken`). */
32
+ readonly key: v.StringSchema<undefined>;
33
+ /** Human label for the form field. */
34
+ readonly label: v.StringSchema<undefined>;
35
+ /** Optional helper text shown under the field. */
36
+ readonly help: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
37
+ /** Optional input placeholder. */
38
+ readonly placeholder: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
39
+ /** Render as a password input and never echo the value back. */
40
+ readonly secret: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
41
+ }, undefined>, undefined>;
42
+ /** Label for the "import a page" input. */
43
+ readonly refLabel: v.StringSchema<undefined>;
44
+ /** Placeholder for the "import a page" input. */
45
+ readonly refPlaceholder: v.StringSchema<undefined>;
46
+ /**
47
+ * Whether this source supports searching its catalogue by title/content (so
48
+ * the UI offers a search box, not just a paste-a-URL field). Optional for
49
+ * backward-compatibility; absent is treated as `false`.
50
+ */
51
+ readonly searchable: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
52
+ }, undefined>;
53
+ export type DocumentSourceDescriptor = v.InferOutput<typeof documentSourceDescriptorSchema>;
54
+ /** A workspace's connection to a document source, as exposed to clients (never the credentials). */
55
+ export declare const documentConnectionSchema: v.ObjectSchema<{
56
+ readonly source: v.PicklistSchema<["confluence", "notion", "github"], undefined>;
57
+ /** A human-friendly label for what we're connected to (site URL, workspace name). */
58
+ readonly label: v.StringSchema<undefined>;
59
+ /** When the connection was established (epoch ms). */
60
+ readonly connectedAt: v.NumberSchema<undefined>;
61
+ }, undefined>;
62
+ export type DocumentConnection = v.InferOutput<typeof documentConnectionSchema>;
63
+ /** A page imported from a source, projected locally. */
64
+ export declare const sourceDocumentSchema: v.ObjectSchema<{
65
+ readonly source: v.PicklistSchema<["confluence", "notion", "github"], undefined>;
66
+ /** The source's stable id for the page (Confluence page id, Notion page id). */
67
+ readonly externalId: v.StringSchema<undefined>;
68
+ readonly title: v.StringSchema<undefined>;
69
+ /** Canonical URL of the page on the source. */
70
+ readonly url: v.StringSchema<undefined>;
71
+ /** A short plain-text excerpt of the body (full body stays in storage). */
72
+ readonly excerpt: v.StringSchema<undefined>;
73
+ /** The board block this document is attached to as context, if any. */
74
+ readonly linkedBlockId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
75
+ /** When this projection row was last refreshed (epoch ms). */
76
+ readonly syncedAt: v.NumberSchema<undefined>;
77
+ }, undefined>;
78
+ export type SourceDocument = v.InferOutput<typeof sourceDocumentSchema>;
79
+ /**
80
+ * A single hit from searching a source's catalogue. A lean shape (no body) used
81
+ * to populate a picker: selecting one imports it (by `externalId`) and links it
82
+ * to a block. Distinct from {@link SourceDocument} — a hit is not yet projected
83
+ * locally, so it carries no `linkedBlockId`/`syncedAt`.
84
+ */
85
+ export declare const documentSearchResultSchema: v.ObjectSchema<{
86
+ readonly source: v.PicklistSchema<["confluence", "notion", "github"], undefined>;
87
+ /** The source's stable id for the page (re-usable as an import ref). */
88
+ readonly externalId: v.StringSchema<undefined>;
89
+ readonly title: v.StringSchema<undefined>;
90
+ /** Canonical URL of the page on the source. */
91
+ readonly url: v.StringSchema<undefined>;
92
+ /** A short plain-text excerpt for the result row (may be empty). */
93
+ readonly excerpt: v.StringSchema<undefined>;
94
+ }, undefined>;
95
+ export type DocumentSearchResult = v.InferOutput<typeof documentSearchResultSchema>;
96
+ /** A proposed task within a planned frame/module. */
97
+ export declare const planTaskSchema: v.ObjectSchema<{
98
+ readonly title: v.StringSchema<undefined>;
99
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
100
+ }, undefined>;
101
+ export type PlanTask = v.InferOutput<typeof planTaskSchema>;
102
+ /** A proposed module grouping tasks within a planned frame. */
103
+ export declare const planModuleSchema: v.ObjectSchema<{
104
+ readonly name: v.StringSchema<undefined>;
105
+ readonly tasks: v.ArraySchema<v.ObjectSchema<{
106
+ readonly title: v.StringSchema<undefined>;
107
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
108
+ }, undefined>, undefined>;
109
+ }, undefined>;
110
+ export type PlanModule = v.InferOutput<typeof planModuleSchema>;
111
+ /** A proposed top-level frame (service/api/…) with its modules and loose tasks. */
112
+ export declare const planFrameSchema: v.ObjectSchema<{
113
+ readonly type: v.PicklistSchema<["frontend", "service", "api", "database", "queue", "integration", "external", "environment"], undefined>;
114
+ readonly title: v.StringSchema<undefined>;
115
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
116
+ readonly modules: v.ArraySchema<v.ObjectSchema<{
117
+ readonly name: v.StringSchema<undefined>;
118
+ readonly tasks: v.ArraySchema<v.ObjectSchema<{
119
+ readonly title: v.StringSchema<undefined>;
120
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
121
+ }, undefined>, undefined>;
122
+ }, undefined>, undefined>;
123
+ readonly tasks: v.ArraySchema<v.ObjectSchema<{
124
+ readonly title: v.StringSchema<undefined>;
125
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
126
+ }, undefined>, undefined>;
127
+ }, undefined>;
128
+ export type PlanFrame = v.InferOutput<typeof planFrameSchema>;
129
+ /**
130
+ * A proposed board structure extracted from an imported document. `planner`
131
+ * records whether an LLM produced it or the deterministic heading parser did, so
132
+ * the UI can label a preview honestly.
133
+ */
134
+ export declare const documentBoardPlanSchema: v.ObjectSchema<{
135
+ readonly source: v.PicklistSchema<["confluence", "notion", "github"], undefined>;
136
+ readonly externalId: v.StringSchema<undefined>;
137
+ readonly planner: v.PicklistSchema<["llm", "headings"], undefined>;
138
+ readonly frames: v.ArraySchema<v.ObjectSchema<{
139
+ readonly type: v.PicklistSchema<["frontend", "service", "api", "database", "queue", "integration", "external", "environment"], undefined>;
140
+ readonly title: v.StringSchema<undefined>;
141
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
142
+ readonly modules: v.ArraySchema<v.ObjectSchema<{
143
+ readonly name: v.StringSchema<undefined>;
144
+ readonly tasks: v.ArraySchema<v.ObjectSchema<{
145
+ readonly title: v.StringSchema<undefined>;
146
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
147
+ }, undefined>, undefined>;
148
+ }, undefined>, undefined>;
149
+ readonly tasks: v.ArraySchema<v.ObjectSchema<{
150
+ readonly title: v.StringSchema<undefined>;
151
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
152
+ }, undefined>, undefined>;
153
+ }, undefined>, undefined>;
154
+ }, undefined>;
155
+ export type DocumentBoardPlan = v.InferOutput<typeof documentBoardPlanSchema>;
156
+ /**
157
+ * Connect a workspace to a document source. The `credentials` bag is validated
158
+ * by the target provider (the `:source` is in the path), keeping the wire shape
159
+ * uniform across providers.
160
+ */
161
+ export declare const connectDocumentSourceSchema: v.ObjectSchema<{
162
+ readonly credentials: v.RecordSchema<v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
163
+ }, undefined>;
164
+ export type ConnectDocumentSourceInput = v.InferOutput<typeof connectDocumentSourceSchema>;
165
+ /** Import (fetch + persist) a page by its id or a full page URL. */
166
+ export declare const importDocumentSchema: v.ObjectSchema<{
167
+ readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 500, undefined>]>;
168
+ }, undefined>;
169
+ export type ImportDocumentInput = v.InferOutput<typeof importDocumentSchema>;
170
+ /** Search a source's catalogue by free text (title/content). */
171
+ export declare const searchDocumentsSchema: v.ObjectSchema<{
172
+ readonly query: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
173
+ }, undefined>;
174
+ export type SearchDocumentsInput = v.InferOutput<typeof searchDocumentsSchema>;
175
+ /** Preview the board structure a page would expand into (no writes). */
176
+ export declare const planDocumentSchema: v.ObjectSchema<{
177
+ readonly externalId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
178
+ }, undefined>;
179
+ export type PlanDocumentInput = v.InferOutput<typeof planDocumentSchema>;
180
+ /**
181
+ * Apply a previously-imported page's structure to the board. Without `frameId`
182
+ * the plan's frames are spawned at the board root; with it, the plan's modules
183
+ * and tasks are spawned inside that existing frame.
184
+ */
185
+ export declare const spawnDocumentSchema: v.ObjectSchema<{
186
+ readonly externalId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
187
+ readonly frameId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
188
+ }, undefined>;
189
+ export type SpawnDocumentInput = v.InferOutput<typeof spawnDocumentSchema>;
190
+ /** Attach an imported page to a task as extra agent context. */
191
+ export declare const linkDocumentSchema: v.ObjectSchema<{
192
+ readonly source: v.PicklistSchema<["confluence", "notion", "github"], undefined>;
193
+ readonly externalId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
194
+ readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
195
+ }, undefined>;
196
+ export type LinkDocumentInput = v.InferOutput<typeof linkDocumentSchema>;
197
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAiB5B,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,iEAAiD,CAAA;AACtF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAI/E,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;IAChC,iEAAiE;;IAEjE,sCAAsC;;IAEtC,kDAAkD;;IAElD,kCAAkC;;IAElC,gEAAgE;;aAEhE,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE;;;GAGG;AACH,eAAO,MAAM,8BAA8B;;IAEzC,uCAAuC;;IAEvC,uCAAuC;;IAEvC,yDAAyD;;QAvBzD,iEAAiE;;QAEjE,sCAAsC;;QAEtC,kDAAkD;;QAElD,kCAAkC;;QAElC,gEAAgE;;;IAiBhE,2CAA2C;;IAE3C,iDAAiD;;IAEjD;;;;OAIG;;aAEH,CAAA;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAI3F,oGAAoG;AACpG,eAAO,MAAM,wBAAwB;;IAEnC,qFAAqF;;IAErF,sDAAsD;;aAEtD,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE/E,wDAAwD;AACxD,eAAO,MAAM,oBAAoB;;IAE/B,gFAAgF;;;IAGhF,+CAA+C;;IAE/C,2EAA2E;;IAE3E,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M,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE9E,wEAAwE;AACxE,eAAO,MAAM,kBAAkB;;aAE7B,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAExE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;aAG9B,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE1E,gEAAgE;AAChE,eAAO,MAAM,kBAAkB;;;;aAI7B,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
@@ -0,0 +1,161 @@
1
+ import * as v from 'valibot';
2
+ import { blockTypeSchema } from './primitives.js';
3
+ // ---------------------------------------------------------------------------
4
+ // Document-source integration wire contracts. A workspace can connect to one or
5
+ // more external document sources (Confluence, Notion, …), import requirement /
6
+ // RFC / PRD pages from them (projected locally), expand a page into board
7
+ // structure, or attach it to a task as agent context.
8
+ //
9
+ // The shapes here are deliberately source-agnostic: a `source` discriminator
10
+ // tags every connection and document, and each provider describes the
11
+ // credentials it needs via a {@link DocumentSourceDescriptor} so the UI can be
12
+ // rendered generically. Storage-only bookkeeping (the owning workspace, the
13
+ // credential bag, the soft-delete tombstone, the cached page body) is NOT on the
14
+ // wire — it lives in the core ports / D1 layer.
15
+ // ---------------------------------------------------------------------------
16
+ /** The external document sources cat-factory can link to. */
17
+ export const documentSourceKindSchema = v.picklist(['confluence', 'notion', 'github']);
18
+ // ---- Provider self-description (drives the generic connect UI) ------------
19
+ /** One credential a provider needs to connect (rendered as a form field). */
20
+ export const credentialFieldSchema = v.object({
21
+ /** Stable key stored in the credential bag (e.g. `apiToken`). */
22
+ key: v.string(),
23
+ /** Human label for the form field. */
24
+ label: v.string(),
25
+ /** Optional helper text shown under the field. */
26
+ help: v.optional(v.string()),
27
+ /** Optional input placeholder. */
28
+ placeholder: v.optional(v.string()),
29
+ /** Render as a password input and never echo the value back. */
30
+ secret: v.optional(v.boolean()),
31
+ });
32
+ /**
33
+ * Everything the frontend needs to render a source's connect form and import
34
+ * box without hard-coding any provider specifics.
35
+ */
36
+ export const documentSourceDescriptorSchema = v.object({
37
+ source: documentSourceKindSchema,
38
+ /** Display name, e.g. `Confluence`. */
39
+ label: v.string(),
40
+ /** Lucide icon name for the source. */
41
+ icon: v.string(),
42
+ /** Credentials required to connect, in display order. */
43
+ credentialFields: v.array(credentialFieldSchema),
44
+ /** Label for the "import a page" input. */
45
+ refLabel: v.string(),
46
+ /** Placeholder for the "import a page" input. */
47
+ refPlaceholder: v.string(),
48
+ /**
49
+ * Whether this source supports searching its catalogue by title/content (so
50
+ * the UI offers a search box, not just a paste-a-URL field). Optional for
51
+ * backward-compatibility; absent is treated as `false`.
52
+ */
53
+ searchable: v.optional(v.boolean()),
54
+ });
55
+ // ---- Connection + document projections ------------------------------------
56
+ /** A workspace's connection to a document source, as exposed to clients (never the credentials). */
57
+ export const documentConnectionSchema = v.object({
58
+ source: documentSourceKindSchema,
59
+ /** A human-friendly label for what we're connected to (site URL, workspace name). */
60
+ label: v.string(),
61
+ /** When the connection was established (epoch ms). */
62
+ connectedAt: v.number(),
63
+ });
64
+ /** A page imported from a source, projected locally. */
65
+ export const sourceDocumentSchema = v.object({
66
+ source: documentSourceKindSchema,
67
+ /** The source's stable id for the page (Confluence page id, Notion page id). */
68
+ externalId: v.string(),
69
+ title: v.string(),
70
+ /** Canonical URL of the page on the source. */
71
+ url: v.string(),
72
+ /** A short plain-text excerpt of the body (full body stays in storage). */
73
+ excerpt: v.string(),
74
+ /** The board block this document is attached to as context, if any. */
75
+ linkedBlockId: v.nullable(v.string()),
76
+ /** When this projection row was last refreshed (epoch ms). */
77
+ syncedAt: v.number(),
78
+ });
79
+ /**
80
+ * A single hit from searching a source's catalogue. A lean shape (no body) used
81
+ * to populate a picker: selecting one imports it (by `externalId`) and links it
82
+ * to a block. Distinct from {@link SourceDocument} — a hit is not yet projected
83
+ * locally, so it carries no `linkedBlockId`/`syncedAt`.
84
+ */
85
+ export const documentSearchResultSchema = v.object({
86
+ source: documentSourceKindSchema,
87
+ /** The source's stable id for the page (re-usable as an import ref). */
88
+ externalId: v.string(),
89
+ title: v.string(),
90
+ /** Canonical URL of the page on the source. */
91
+ url: v.string(),
92
+ /** A short plain-text excerpt for the result row (may be empty). */
93
+ excerpt: v.string(),
94
+ });
95
+ // ---- Board plan (doc → structure) -----------------------------------------
96
+ /** A proposed task within a planned frame/module. */
97
+ export const planTaskSchema = v.object({
98
+ title: v.string(),
99
+ description: v.optional(v.string()),
100
+ });
101
+ /** A proposed module grouping tasks within a planned frame. */
102
+ export const planModuleSchema = v.object({
103
+ name: v.string(),
104
+ tasks: v.array(planTaskSchema),
105
+ });
106
+ /** A proposed top-level frame (service/api/…) with its modules and loose tasks. */
107
+ export const planFrameSchema = v.object({
108
+ type: blockTypeSchema,
109
+ title: v.string(),
110
+ description: v.optional(v.string()),
111
+ modules: v.array(planModuleSchema),
112
+ tasks: v.array(planTaskSchema),
113
+ });
114
+ /**
115
+ * A proposed board structure extracted from an imported document. `planner`
116
+ * records whether an LLM produced it or the deterministic heading parser did, so
117
+ * the UI can label a preview honestly.
118
+ */
119
+ export const documentBoardPlanSchema = v.object({
120
+ source: documentSourceKindSchema,
121
+ externalId: v.string(),
122
+ planner: v.picklist(['llm', 'headings']),
123
+ frames: v.array(planFrameSchema),
124
+ });
125
+ // ---- Request bodies -------------------------------------------------------
126
+ /**
127
+ * Connect a workspace to a document source. The `credentials` bag is validated
128
+ * by the target provider (the `:source` is in the path), keeping the wire shape
129
+ * uniform across providers.
130
+ */
131
+ export const connectDocumentSourceSchema = v.object({
132
+ credentials: v.record(v.string(), v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(2000))),
133
+ });
134
+ /** Import (fetch + persist) a page by its id or a full page URL. */
135
+ export const importDocumentSchema = v.object({
136
+ ref: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(500)),
137
+ });
138
+ /** Search a source's catalogue by free text (title/content). */
139
+ export const searchDocumentsSchema = v.object({
140
+ query: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(200)),
141
+ });
142
+ /** Preview the board structure a page would expand into (no writes). */
143
+ export const planDocumentSchema = v.object({
144
+ externalId: v.pipe(v.string(), v.trim(), v.minLength(1)),
145
+ });
146
+ /**
147
+ * Apply a previously-imported page's structure to the board. Without `frameId`
148
+ * the plan's frames are spawned at the board root; with it, the plan's modules
149
+ * and tasks are spawned inside that existing frame.
150
+ */
151
+ export const spawnDocumentSchema = v.object({
152
+ externalId: v.pipe(v.string(), v.trim(), v.minLength(1)),
153
+ frameId: v.optional(v.pipe(v.string(), v.minLength(1))),
154
+ });
155
+ /** Attach an imported page to a task as extra agent context. */
156
+ export const linkDocumentSchema = v.object({
157
+ source: documentSourceKindSchema,
158
+ externalId: v.pipe(v.string(), v.trim(), v.minLength(1)),
159
+ blockId: v.pipe(v.string(), v.trim(), v.minLength(1)),
160
+ });
161
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,0EAA0E;AAC1E,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AACtE,+EAA+E;AAC/E,4EAA4E;AAC5E,iFAAiF;AACjF,gDAAgD;AAChD,8EAA8E;AAE9E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC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