@aitne/shared 0.1.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 (114) hide show
  1. package/LICENSE +21 -0
  2. package/dist/advisor-models.d.ts +34 -0
  3. package/dist/advisor-models.d.ts.map +1 -0
  4. package/dist/advisor-models.js +39 -0
  5. package/dist/advisor-models.js.map +1 -0
  6. package/dist/agent-identity.d.ts +11 -0
  7. package/dist/agent-identity.d.ts.map +1 -0
  8. package/dist/agent-identity.js +29 -0
  9. package/dist/agent-identity.js.map +1 -0
  10. package/dist/alerts.d.ts +44 -0
  11. package/dist/alerts.d.ts.map +1 -0
  12. package/dist/alerts.js +12 -0
  13. package/dist/alerts.js.map +1 -0
  14. package/dist/backend-api-key-config.d.ts +337 -0
  15. package/dist/backend-api-key-config.d.ts.map +1 -0
  16. package/dist/backend-api-key-config.js +682 -0
  17. package/dist/backend-api-key-config.js.map +1 -0
  18. package/dist/backend.d.ts +93 -0
  19. package/dist/backend.d.ts.map +1 -0
  20. package/dist/backend.js +22 -0
  21. package/dist/backend.js.map +1 -0
  22. package/dist/branding.d.ts +96 -0
  23. package/dist/branding.d.ts.map +1 -0
  24. package/dist/branding.js +102 -0
  25. package/dist/branding.js.map +1 -0
  26. package/dist/chat-session-scope.d.ts +14 -0
  27. package/dist/chat-session-scope.d.ts.map +1 -0
  28. package/dist/chat-session-scope.js +18 -0
  29. package/dist/chat-session-scope.js.map +1 -0
  30. package/dist/date-utils.d.ts +80 -0
  31. package/dist/date-utils.d.ts.map +1 -0
  32. package/dist/date-utils.js +187 -0
  33. package/dist/date-utils.js.map +1 -0
  34. package/dist/docs-frontmatter.d.ts +51 -0
  35. package/dist/docs-frontmatter.d.ts.map +1 -0
  36. package/dist/docs-frontmatter.js +184 -0
  37. package/dist/docs-frontmatter.js.map +1 -0
  38. package/dist/docs-schema.d.ts +79 -0
  39. package/dist/docs-schema.d.ts.map +1 -0
  40. package/dist/docs-schema.js +135 -0
  41. package/dist/docs-schema.js.map +1 -0
  42. package/dist/editable-config-keys.d.ts +14 -0
  43. package/dist/editable-config-keys.d.ts.map +1 -0
  44. package/dist/editable-config-keys.js +157 -0
  45. package/dist/editable-config-keys.js.map +1 -0
  46. package/dist/exec-with-stdin.d.ts +14 -0
  47. package/dist/exec-with-stdin.d.ts.map +1 -0
  48. package/dist/exec-with-stdin.js +35 -0
  49. package/dist/exec-with-stdin.js.map +1 -0
  50. package/dist/index.d.ts +37 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +49 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/integrations-snapshot.d.ts +183 -0
  55. package/dist/integrations-snapshot.d.ts.map +1 -0
  56. package/dist/integrations-snapshot.js +757 -0
  57. package/dist/integrations-snapshot.js.map +1 -0
  58. package/dist/integrations.d.ts +675 -0
  59. package/dist/integrations.d.ts.map +1 -0
  60. package/dist/integrations.js +1656 -0
  61. package/dist/integrations.js.map +1 -0
  62. package/dist/keychain-helper-client.d.ts +31 -0
  63. package/dist/keychain-helper-client.d.ts.map +1 -0
  64. package/dist/keychain-helper-client.js +105 -0
  65. package/dist/keychain-helper-client.js.map +1 -0
  66. package/dist/log-entry.d.ts +14 -0
  67. package/dist/log-entry.d.ts.map +1 -0
  68. package/dist/log-entry.js +2 -0
  69. package/dist/log-entry.js.map +1 -0
  70. package/dist/management-domains.d.ts +369 -0
  71. package/dist/management-domains.d.ts.map +1 -0
  72. package/dist/management-domains.js +499 -0
  73. package/dist/management-domains.js.map +1 -0
  74. package/dist/process-key.d.ts +67 -0
  75. package/dist/process-key.d.ts.map +1 -0
  76. package/dist/process-key.js +366 -0
  77. package/dist/process-key.js.map +1 -0
  78. package/dist/schemas.d.ts +267 -0
  79. package/dist/schemas.d.ts.map +1 -0
  80. package/dist/schemas.js +271 -0
  81. package/dist/schemas.js.map +1 -0
  82. package/dist/secret-client-factory.d.ts +16 -0
  83. package/dist/secret-client-factory.d.ts.map +1 -0
  84. package/dist/secret-client-factory.js +111 -0
  85. package/dist/secret-client-factory.js.map +1 -0
  86. package/dist/secret-client-file.d.ts +51 -0
  87. package/dist/secret-client-file.d.ts.map +1 -0
  88. package/dist/secret-client-file.js +160 -0
  89. package/dist/secret-client-file.js.map +1 -0
  90. package/dist/secret-client-linux.d.ts +26 -0
  91. package/dist/secret-client-linux.d.ts.map +1 -0
  92. package/dist/secret-client-linux.js +63 -0
  93. package/dist/secret-client-linux.js.map +1 -0
  94. package/dist/secret-client-windows.d.ts +37 -0
  95. package/dist/secret-client-windows.d.ts.map +1 -0
  96. package/dist/secret-client-windows.js +82 -0
  97. package/dist/secret-client-windows.js.map +1 -0
  98. package/dist/secret-redaction.d.ts +3 -0
  99. package/dist/secret-redaction.d.ts.map +1 -0
  100. package/dist/secret-redaction.js +31 -0
  101. package/dist/secret-redaction.js.map +1 -0
  102. package/dist/skill-curation/decision-language.d.ts +6 -0
  103. package/dist/skill-curation/decision-language.d.ts.map +1 -0
  104. package/dist/skill-curation/decision-language.js +38 -0
  105. package/dist/skill-curation/decision-language.js.map +1 -0
  106. package/dist/skill-curation/schemas.d.ts +461 -0
  107. package/dist/skill-curation/schemas.d.ts.map +1 -0
  108. package/dist/skill-curation/schemas.js +211 -0
  109. package/dist/skill-curation/schemas.js.map +1 -0
  110. package/dist/types.d.ts +204 -0
  111. package/dist/types.d.ts.map +1 -0
  112. package/dist/types.js +54 -0
  113. package/dist/types.js.map +1 -0
  114. package/package.json +50 -0
@@ -0,0 +1,461 @@
1
+ import { z } from "zod";
2
+ /** Bumped when the typed-payload shape changes in a non-additive way. */
3
+ export declare const SKILL_CURATION_SCHEMA_VERSION = 1;
4
+ /** Allowed section kinds (discriminator on `payload.kind`). */
5
+ export declare const SECTION_KINDS: readonly ["knowledge_layout", "routing_table", "frontmatter_schema", "search_recipes", "convention_notes", "cross_references"];
6
+ export type SectionKind = (typeof SECTION_KINDS)[number];
7
+ export declare const KnowledgeLayoutSection: z.ZodObject<{
8
+ heading: z.ZodString;
9
+ contains: z.ZodString;
10
+ example_entry: z.ZodOptional<z.ZodString>;
11
+ writers: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
+ }, z.core.$strip>;
13
+ export declare const KnowledgeLayoutFile: z.ZodObject<{
14
+ path: z.ZodString;
15
+ purpose: z.ZodString;
16
+ sections: z.ZodArray<z.ZodObject<{
17
+ heading: z.ZodString;
18
+ contains: z.ZodString;
19
+ example_entry: z.ZodOptional<z.ZodString>;
20
+ writers: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
+ }, z.core.$strip>>;
22
+ }, z.core.$strip>;
23
+ export declare const KnowledgeLayoutPayload: z.ZodObject<{
24
+ kind: z.ZodLiteral<"knowledge_layout">;
25
+ files: z.ZodArray<z.ZodObject<{
26
+ path: z.ZodString;
27
+ purpose: z.ZodString;
28
+ sections: z.ZodArray<z.ZodObject<{
29
+ heading: z.ZodString;
30
+ contains: z.ZodString;
31
+ example_entry: z.ZodOptional<z.ZodString>;
32
+ writers: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ }, z.core.$strip>>;
34
+ }, z.core.$strip>>;
35
+ }, z.core.$strip>;
36
+ export declare const RoutingTableRule: z.ZodObject<{
37
+ trigger_pattern: z.ZodString;
38
+ destination_path: z.ZodString;
39
+ destination_section: z.ZodString;
40
+ destination_mode: z.ZodEnum<{
41
+ append: "append";
42
+ replace: "replace";
43
+ append_to_file: "append_to_file";
44
+ patch_section: "patch_section";
45
+ }>;
46
+ note: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>;
48
+ export declare const RoutingTablePayload: z.ZodObject<{
49
+ kind: z.ZodLiteral<"routing_table">;
50
+ rules: z.ZodArray<z.ZodObject<{
51
+ trigger_pattern: z.ZodString;
52
+ destination_path: z.ZodString;
53
+ destination_section: z.ZodString;
54
+ destination_mode: z.ZodEnum<{
55
+ append: "append";
56
+ replace: "replace";
57
+ append_to_file: "append_to_file";
58
+ patch_section: "patch_section";
59
+ }>;
60
+ note: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strip>>;
62
+ }, z.core.$strip>;
63
+ export declare const FrontmatterRequiredField: z.ZodObject<{
64
+ key: z.ZodString;
65
+ type: z.ZodEnum<{
66
+ string: "string";
67
+ array: "array";
68
+ enum: "enum";
69
+ "iso-date": "iso-date";
70
+ }>;
71
+ example: z.ZodString;
72
+ }, z.core.$strip>;
73
+ export declare const FrontmatterConventionalField: z.ZodObject<{
74
+ key: z.ZodString;
75
+ purpose: z.ZodString;
76
+ }, z.core.$strip>;
77
+ export declare const FrontmatterFileType: z.ZodObject<{
78
+ glob: z.ZodString;
79
+ required: z.ZodArray<z.ZodObject<{
80
+ key: z.ZodString;
81
+ type: z.ZodEnum<{
82
+ string: "string";
83
+ array: "array";
84
+ enum: "enum";
85
+ "iso-date": "iso-date";
86
+ }>;
87
+ example: z.ZodString;
88
+ }, z.core.$strip>>;
89
+ conventional: z.ZodArray<z.ZodObject<{
90
+ key: z.ZodString;
91
+ purpose: z.ZodString;
92
+ }, z.core.$strip>>;
93
+ }, z.core.$strip>;
94
+ export declare const FrontmatterSchemaPayload: z.ZodObject<{
95
+ kind: z.ZodLiteral<"frontmatter_schema">;
96
+ file_types: z.ZodArray<z.ZodObject<{
97
+ glob: z.ZodString;
98
+ required: z.ZodArray<z.ZodObject<{
99
+ key: z.ZodString;
100
+ type: z.ZodEnum<{
101
+ string: "string";
102
+ array: "array";
103
+ enum: "enum";
104
+ "iso-date": "iso-date";
105
+ }>;
106
+ example: z.ZodString;
107
+ }, z.core.$strip>>;
108
+ conventional: z.ZodArray<z.ZodObject<{
109
+ key: z.ZodString;
110
+ purpose: z.ZodString;
111
+ }, z.core.$strip>>;
112
+ }, z.core.$strip>>;
113
+ }, z.core.$strip>;
114
+ export declare const SearchRecipe: z.ZodObject<{
115
+ question_shape: z.ZodString;
116
+ lookup_path: z.ZodString;
117
+ lookup_section: z.ZodOptional<z.ZodString>;
118
+ note: z.ZodOptional<z.ZodString>;
119
+ }, z.core.$strip>;
120
+ export declare const SearchRecipesPayload: z.ZodObject<{
121
+ kind: z.ZodLiteral<"search_recipes">;
122
+ recipes: z.ZodArray<z.ZodObject<{
123
+ question_shape: z.ZodString;
124
+ lookup_path: z.ZodString;
125
+ lookup_section: z.ZodOptional<z.ZodString>;
126
+ note: z.ZodOptional<z.ZodString>;
127
+ }, z.core.$strip>>;
128
+ }, z.core.$strip>;
129
+ export declare const ConventionNote: z.ZodObject<{
130
+ topic: z.ZodString;
131
+ rule: z.ZodString;
132
+ example: z.ZodOptional<z.ZodString>;
133
+ }, z.core.$strip>;
134
+ export declare const ConventionNotesPayload: z.ZodObject<{
135
+ kind: z.ZodLiteral<"convention_notes">;
136
+ notes: z.ZodArray<z.ZodObject<{
137
+ topic: z.ZodString;
138
+ rule: z.ZodString;
139
+ example: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strip>>;
141
+ }, z.core.$strip>;
142
+ export declare const CrossReference: z.ZodObject<{
143
+ from_path: z.ZodString;
144
+ to_path: z.ZodString;
145
+ relation: z.ZodString;
146
+ }, z.core.$strip>;
147
+ export declare const CrossReferencesPayload: z.ZodObject<{
148
+ kind: z.ZodLiteral<"cross_references">;
149
+ refs: z.ZodArray<z.ZodObject<{
150
+ from_path: z.ZodString;
151
+ to_path: z.ZodString;
152
+ relation: z.ZodString;
153
+ }, z.core.$strip>>;
154
+ }, z.core.$strip>;
155
+ export declare const CurationPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
156
+ kind: z.ZodLiteral<"knowledge_layout">;
157
+ files: z.ZodArray<z.ZodObject<{
158
+ path: z.ZodString;
159
+ purpose: z.ZodString;
160
+ sections: z.ZodArray<z.ZodObject<{
161
+ heading: z.ZodString;
162
+ contains: z.ZodString;
163
+ example_entry: z.ZodOptional<z.ZodString>;
164
+ writers: z.ZodOptional<z.ZodArray<z.ZodString>>;
165
+ }, z.core.$strip>>;
166
+ }, z.core.$strip>>;
167
+ }, z.core.$strip>, z.ZodObject<{
168
+ kind: z.ZodLiteral<"routing_table">;
169
+ rules: z.ZodArray<z.ZodObject<{
170
+ trigger_pattern: z.ZodString;
171
+ destination_path: z.ZodString;
172
+ destination_section: z.ZodString;
173
+ destination_mode: z.ZodEnum<{
174
+ append: "append";
175
+ replace: "replace";
176
+ append_to_file: "append_to_file";
177
+ patch_section: "patch_section";
178
+ }>;
179
+ note: z.ZodOptional<z.ZodString>;
180
+ }, z.core.$strip>>;
181
+ }, z.core.$strip>, z.ZodObject<{
182
+ kind: z.ZodLiteral<"frontmatter_schema">;
183
+ file_types: z.ZodArray<z.ZodObject<{
184
+ glob: z.ZodString;
185
+ required: z.ZodArray<z.ZodObject<{
186
+ key: z.ZodString;
187
+ type: z.ZodEnum<{
188
+ string: "string";
189
+ array: "array";
190
+ enum: "enum";
191
+ "iso-date": "iso-date";
192
+ }>;
193
+ example: z.ZodString;
194
+ }, z.core.$strip>>;
195
+ conventional: z.ZodArray<z.ZodObject<{
196
+ key: z.ZodString;
197
+ purpose: z.ZodString;
198
+ }, z.core.$strip>>;
199
+ }, z.core.$strip>>;
200
+ }, z.core.$strip>, z.ZodObject<{
201
+ kind: z.ZodLiteral<"search_recipes">;
202
+ recipes: z.ZodArray<z.ZodObject<{
203
+ question_shape: z.ZodString;
204
+ lookup_path: z.ZodString;
205
+ lookup_section: z.ZodOptional<z.ZodString>;
206
+ note: z.ZodOptional<z.ZodString>;
207
+ }, z.core.$strip>>;
208
+ }, z.core.$strip>, z.ZodObject<{
209
+ kind: z.ZodLiteral<"convention_notes">;
210
+ notes: z.ZodArray<z.ZodObject<{
211
+ topic: z.ZodString;
212
+ rule: z.ZodString;
213
+ example: z.ZodOptional<z.ZodString>;
214
+ }, z.core.$strip>>;
215
+ }, z.core.$strip>, z.ZodObject<{
216
+ kind: z.ZodLiteral<"cross_references">;
217
+ refs: z.ZodArray<z.ZodObject<{
218
+ from_path: z.ZodString;
219
+ to_path: z.ZodString;
220
+ relation: z.ZodString;
221
+ }, z.core.$strip>>;
222
+ }, z.core.$strip>], "kind">;
223
+ export type CurationPayloadValue = z.infer<typeof CurationPayload>;
224
+ export type KnowledgeLayoutValue = z.infer<typeof KnowledgeLayoutPayload>;
225
+ export type RoutingTableValue = z.infer<typeof RoutingTablePayload>;
226
+ export type FrontmatterSchemaValue = z.infer<typeof FrontmatterSchemaPayload>;
227
+ export type SearchRecipesValue = z.infer<typeof SearchRecipesPayload>;
228
+ export type ConventionNotesValue = z.infer<typeof ConventionNotesPayload>;
229
+ export type CrossReferencesValue = z.infer<typeof CrossReferencesPayload>;
230
+ export declare const BYTE_BUDGET: Record<SectionKind, number>;
231
+ export declare const CurationDeclarationSection: z.ZodObject<{
232
+ id: z.ZodString;
233
+ kind: z.ZodEnum<{
234
+ knowledge_layout: "knowledge_layout";
235
+ routing_table: "routing_table";
236
+ frontmatter_schema: "frontmatter_schema";
237
+ search_recipes: "search_recipes";
238
+ convention_notes: "convention_notes";
239
+ cross_references: "cross_references";
240
+ }>;
241
+ anchor: z.ZodString;
242
+ human_label: z.ZodString;
243
+ description: z.ZodString;
244
+ scope_paths: z.ZodArray<z.ZodString>;
245
+ }, z.core.$strip>;
246
+ export declare const CurationDeclaration: z.ZodObject<{
247
+ version: z.ZodLiteral<1>;
248
+ sections: z.ZodArray<z.ZodObject<{
249
+ id: z.ZodString;
250
+ kind: z.ZodEnum<{
251
+ knowledge_layout: "knowledge_layout";
252
+ routing_table: "routing_table";
253
+ frontmatter_schema: "frontmatter_schema";
254
+ search_recipes: "search_recipes";
255
+ convention_notes: "convention_notes";
256
+ cross_references: "cross_references";
257
+ }>;
258
+ anchor: z.ZodString;
259
+ human_label: z.ZodString;
260
+ description: z.ZodString;
261
+ scope_paths: z.ZodArray<z.ZodString>;
262
+ }, z.core.$strip>>;
263
+ }, z.core.$strip>;
264
+ export type CurationDeclarationValue = z.infer<typeof CurationDeclaration>;
265
+ export type CurationDeclarationSectionValue = z.infer<typeof CurationDeclarationSection>;
266
+ export declare const SkillCurationConfig: z.ZodObject<{
267
+ enabled: z.ZodDefault<z.ZodBoolean>;
268
+ cadence: z.ZodDefault<z.ZodEnum<{
269
+ daily: "daily";
270
+ weekly: "weekly";
271
+ monthly: "monthly";
272
+ }>>;
273
+ backend: z.ZodDefault<z.ZodEnum<{
274
+ claude: "claude";
275
+ codex: "codex";
276
+ gemini: "gemini";
277
+ }>>;
278
+ model: z.ZodDefault<z.ZodString>;
279
+ excluded_skills: z.ZodDefault<z.ZodArray<z.ZodString>>;
280
+ }, z.core.$strip>;
281
+ export type SkillCurationConfigValue = z.infer<typeof SkillCurationConfig>;
282
+ export declare const DEFAULT_SKILL_CURATION_CONFIG: SkillCurationConfigValue;
283
+ export declare const OverlayEnvelope: z.ZodObject<{
284
+ schema_version: z.ZodNumber;
285
+ skill_slug: z.ZodString;
286
+ section_id: z.ZodString;
287
+ kind: z.ZodEnum<{
288
+ knowledge_layout: "knowledge_layout";
289
+ routing_table: "routing_table";
290
+ frontmatter_schema: "frontmatter_schema";
291
+ search_recipes: "search_recipes";
292
+ convention_notes: "convention_notes";
293
+ cross_references: "cross_references";
294
+ }>;
295
+ payload: z.ZodDiscriminatedUnion<[z.ZodObject<{
296
+ kind: z.ZodLiteral<"knowledge_layout">;
297
+ files: z.ZodArray<z.ZodObject<{
298
+ path: z.ZodString;
299
+ purpose: z.ZodString;
300
+ sections: z.ZodArray<z.ZodObject<{
301
+ heading: z.ZodString;
302
+ contains: z.ZodString;
303
+ example_entry: z.ZodOptional<z.ZodString>;
304
+ writers: z.ZodOptional<z.ZodArray<z.ZodString>>;
305
+ }, z.core.$strip>>;
306
+ }, z.core.$strip>>;
307
+ }, z.core.$strip>, z.ZodObject<{
308
+ kind: z.ZodLiteral<"routing_table">;
309
+ rules: z.ZodArray<z.ZodObject<{
310
+ trigger_pattern: z.ZodString;
311
+ destination_path: z.ZodString;
312
+ destination_section: z.ZodString;
313
+ destination_mode: z.ZodEnum<{
314
+ append: "append";
315
+ replace: "replace";
316
+ append_to_file: "append_to_file";
317
+ patch_section: "patch_section";
318
+ }>;
319
+ note: z.ZodOptional<z.ZodString>;
320
+ }, z.core.$strip>>;
321
+ }, z.core.$strip>, z.ZodObject<{
322
+ kind: z.ZodLiteral<"frontmatter_schema">;
323
+ file_types: z.ZodArray<z.ZodObject<{
324
+ glob: z.ZodString;
325
+ required: z.ZodArray<z.ZodObject<{
326
+ key: z.ZodString;
327
+ type: z.ZodEnum<{
328
+ string: "string";
329
+ array: "array";
330
+ enum: "enum";
331
+ "iso-date": "iso-date";
332
+ }>;
333
+ example: z.ZodString;
334
+ }, z.core.$strip>>;
335
+ conventional: z.ZodArray<z.ZodObject<{
336
+ key: z.ZodString;
337
+ purpose: z.ZodString;
338
+ }, z.core.$strip>>;
339
+ }, z.core.$strip>>;
340
+ }, z.core.$strip>, z.ZodObject<{
341
+ kind: z.ZodLiteral<"search_recipes">;
342
+ recipes: z.ZodArray<z.ZodObject<{
343
+ question_shape: z.ZodString;
344
+ lookup_path: z.ZodString;
345
+ lookup_section: z.ZodOptional<z.ZodString>;
346
+ note: z.ZodOptional<z.ZodString>;
347
+ }, z.core.$strip>>;
348
+ }, z.core.$strip>, z.ZodObject<{
349
+ kind: z.ZodLiteral<"convention_notes">;
350
+ notes: z.ZodArray<z.ZodObject<{
351
+ topic: z.ZodString;
352
+ rule: z.ZodString;
353
+ example: z.ZodOptional<z.ZodString>;
354
+ }, z.core.$strip>>;
355
+ }, z.core.$strip>, z.ZodObject<{
356
+ kind: z.ZodLiteral<"cross_references">;
357
+ refs: z.ZodArray<z.ZodObject<{
358
+ from_path: z.ZodString;
359
+ to_path: z.ZodString;
360
+ relation: z.ZodString;
361
+ }, z.core.$strip>>;
362
+ }, z.core.$strip>], "kind">;
363
+ applied_proposal_id: z.ZodNullable<z.ZodNumber>;
364
+ applied_at: z.ZodNullable<z.ZodNumber>;
365
+ }, z.core.$strip>;
366
+ export type OverlayEnvelopeValue = z.infer<typeof OverlayEnvelope>;
367
+ export declare const SubmitProposalRequest: z.ZodObject<{
368
+ runId: z.ZodString;
369
+ skill_slug: z.ZodString;
370
+ section_id: z.ZodString;
371
+ payload: z.ZodDiscriminatedUnion<[z.ZodObject<{
372
+ kind: z.ZodLiteral<"knowledge_layout">;
373
+ files: z.ZodArray<z.ZodObject<{
374
+ path: z.ZodString;
375
+ purpose: z.ZodString;
376
+ sections: z.ZodArray<z.ZodObject<{
377
+ heading: z.ZodString;
378
+ contains: z.ZodString;
379
+ example_entry: z.ZodOptional<z.ZodString>;
380
+ writers: z.ZodOptional<z.ZodArray<z.ZodString>>;
381
+ }, z.core.$strip>>;
382
+ }, z.core.$strip>>;
383
+ }, z.core.$strip>, z.ZodObject<{
384
+ kind: z.ZodLiteral<"routing_table">;
385
+ rules: z.ZodArray<z.ZodObject<{
386
+ trigger_pattern: z.ZodString;
387
+ destination_path: z.ZodString;
388
+ destination_section: z.ZodString;
389
+ destination_mode: z.ZodEnum<{
390
+ append: "append";
391
+ replace: "replace";
392
+ append_to_file: "append_to_file";
393
+ patch_section: "patch_section";
394
+ }>;
395
+ note: z.ZodOptional<z.ZodString>;
396
+ }, z.core.$strip>>;
397
+ }, z.core.$strip>, z.ZodObject<{
398
+ kind: z.ZodLiteral<"frontmatter_schema">;
399
+ file_types: z.ZodArray<z.ZodObject<{
400
+ glob: z.ZodString;
401
+ required: z.ZodArray<z.ZodObject<{
402
+ key: z.ZodString;
403
+ type: z.ZodEnum<{
404
+ string: "string";
405
+ array: "array";
406
+ enum: "enum";
407
+ "iso-date": "iso-date";
408
+ }>;
409
+ example: z.ZodString;
410
+ }, z.core.$strip>>;
411
+ conventional: z.ZodArray<z.ZodObject<{
412
+ key: z.ZodString;
413
+ purpose: z.ZodString;
414
+ }, z.core.$strip>>;
415
+ }, z.core.$strip>>;
416
+ }, z.core.$strip>, z.ZodObject<{
417
+ kind: z.ZodLiteral<"search_recipes">;
418
+ recipes: z.ZodArray<z.ZodObject<{
419
+ question_shape: z.ZodString;
420
+ lookup_path: z.ZodString;
421
+ lookup_section: z.ZodOptional<z.ZodString>;
422
+ note: z.ZodOptional<z.ZodString>;
423
+ }, z.core.$strip>>;
424
+ }, z.core.$strip>, z.ZodObject<{
425
+ kind: z.ZodLiteral<"convention_notes">;
426
+ notes: z.ZodArray<z.ZodObject<{
427
+ topic: z.ZodString;
428
+ rule: z.ZodString;
429
+ example: z.ZodOptional<z.ZodString>;
430
+ }, z.core.$strip>>;
431
+ }, z.core.$strip>, z.ZodObject<{
432
+ kind: z.ZodLiteral<"cross_references">;
433
+ refs: z.ZodArray<z.ZodObject<{
434
+ from_path: z.ZodString;
435
+ to_path: z.ZodString;
436
+ relation: z.ZodString;
437
+ }, z.core.$strip>>;
438
+ }, z.core.$strip>], "kind">;
439
+ rationale: z.ZodString;
440
+ signal_ids: z.ZodArray<z.ZodNumber>;
441
+ }, z.core.$strip>;
442
+ export type SubmitProposalRequestValue = z.infer<typeof SubmitProposalRequest>;
443
+ /** Manual on-demand run — `POST /api/skill-curation/runs/manual`. The
444
+ * dashboard fires this when the owner clicks "Run optimization now".
445
+ * Bypasses the per-skill weight threshold and the per-section cooldown
446
+ * for skill SELECTION (see signals.ts), but proposals still require
447
+ * signal citations via the `signal_citations_valid` smoke check.
448
+ *
449
+ * Body is intentionally empty in v1 — server reads cadence/backend/model
450
+ * from `runtime_state.skill_curation.config`. Reserved for future use
451
+ * (e.g. owner-narrowed manual run targeting a specific skill). */
452
+ export declare const ManualRunRequest: z.ZodObject<{
453
+ target_skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
454
+ }, z.core.$strip>;
455
+ export type ManualRunRequestValue = z.infer<typeof ManualRunRequest>;
456
+ export declare const DiscardOrphanRequest: z.ZodObject<{
457
+ slug: z.ZodString;
458
+ section_id: z.ZodString;
459
+ }, z.core.$strip>;
460
+ export type DiscardOrphanRequestValue = z.infer<typeof DiscardOrphanRequest>;
461
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/skill-curation/schemas.ts"],"names":[],"mappings":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MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOhC,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAI/E;;;;;;;;mEAQmE;AACnE,eAAO,MAAM,gBAAgB;;iBAM3B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAIrE,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,211 @@
1
+ // Skill-curation typed payloads (P22 §1.4 — normative).
2
+ //
3
+ // These are the ONLY shapes the curation API accepts. The optimizer agent
4
+ // has no Edit/Write tools — its sole mutation surface is `POST /api/skill-
5
+ // curation/proposals` with one of the six `kind` payloads below. Bounds on
6
+ // every string and array exist to cap blast radius.
7
+ import { z } from "zod";
8
+ import { DECISION_LANGUAGE_MESSAGE, EMBEDDED_MARKER_MESSAGE, noDecisionLanguage, noEmbeddedMarkers, } from "./decision-language.js";
9
+ /** Bumped when the typed-payload shape changes in a non-additive way. */
10
+ export const SKILL_CURATION_SCHEMA_VERSION = 1;
11
+ /** Allowed section kinds (discriminator on `payload.kind`). */
12
+ export const SECTION_KINDS = [
13
+ "knowledge_layout",
14
+ "routing_table",
15
+ "frontmatter_schema",
16
+ "search_recipes",
17
+ "convention_notes",
18
+ "cross_references",
19
+ ];
20
+ // Path-shape characters that the optimizer is allowed to submit. `*` is in
21
+ // the set because `knowledge_layout.files[].path` legitimately holds glob
22
+ // entries (`projects/*.md`, `user/*.md`) per design §1.2's seed rows; the
23
+ // smoke test's `paths_resolve` check already understands globs via
24
+ // `snapshotMatchesPath`. The renderer wraps the value in backticks unchanged.
25
+ const PathRegex = /^[a-z0-9_./*-]+$/i;
26
+ const noMarkersField = (max) => z.string().max(max).refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE });
27
+ const descriptiveField = (min, max) => z.string().min(min).max(max)
28
+ .refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE })
29
+ .refine(noDecisionLanguage, { message: DECISION_LANGUAGE_MESSAGE });
30
+ // ── knowledge_layout ─────────────────────────────────────────────────────
31
+ export const KnowledgeLayoutSection = z.object({
32
+ heading: z.string().min(1).max(80).refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE }),
33
+ contains: descriptiveField(5, 200),
34
+ example_entry: noMarkersField(200).optional(),
35
+ writers: z.array(z.string().min(1).max(40)).max(10).optional(),
36
+ });
37
+ export const KnowledgeLayoutFile = z.object({
38
+ path: z.string().regex(PathRegex).max(120),
39
+ purpose: descriptiveField(5, 200),
40
+ sections: z.array(KnowledgeLayoutSection).max(20),
41
+ });
42
+ export const KnowledgeLayoutPayload = z.object({
43
+ kind: z.literal("knowledge_layout"),
44
+ files: z.array(KnowledgeLayoutFile).min(1).max(50),
45
+ });
46
+ // ── routing_table ────────────────────────────────────────────────────────
47
+ export const RoutingTableRule = z.object({
48
+ trigger_pattern: z.string().min(5).max(200)
49
+ .refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE }),
50
+ destination_path: z.string().regex(PathRegex).max(120),
51
+ destination_section: z.string().min(1).max(80),
52
+ destination_mode: z.enum(["append", "replace", "append_to_file", "patch_section"]),
53
+ note: z.string().max(150)
54
+ .refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE })
55
+ .refine(noDecisionLanguage, { message: DECISION_LANGUAGE_MESSAGE })
56
+ .optional(),
57
+ });
58
+ export const RoutingTablePayload = z.object({
59
+ kind: z.literal("routing_table"),
60
+ rules: z.array(RoutingTableRule).min(1).max(50),
61
+ });
62
+ // ── frontmatter_schema ───────────────────────────────────────────────────
63
+ export const FrontmatterRequiredField = z.object({
64
+ key: z.string().min(1).max(40),
65
+ type: z.enum(["string", "iso-date", "enum", "array"]),
66
+ example: z.string().min(1).max(120),
67
+ });
68
+ export const FrontmatterConventionalField = z.object({
69
+ key: z.string().min(1).max(40),
70
+ purpose: z.string().min(3).max(120)
71
+ .refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE })
72
+ .refine(noDecisionLanguage, { message: DECISION_LANGUAGE_MESSAGE }),
73
+ });
74
+ export const FrontmatterFileType = z.object({
75
+ glob: z.string().min(1).max(80),
76
+ required: z.array(FrontmatterRequiredField).max(10),
77
+ conventional: z.array(FrontmatterConventionalField).max(20),
78
+ });
79
+ export const FrontmatterSchemaPayload = z.object({
80
+ kind: z.literal("frontmatter_schema"),
81
+ file_types: z.array(FrontmatterFileType).min(1).max(20),
82
+ });
83
+ // ── search_recipes ───────────────────────────────────────────────────────
84
+ export const SearchRecipe = z.object({
85
+ question_shape: descriptiveField(5, 200),
86
+ lookup_path: z.string().regex(PathRegex).max(120),
87
+ lookup_section: z.string().min(1).max(80).optional(),
88
+ note: z.string().max(200)
89
+ .refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE })
90
+ .refine(noDecisionLanguage, { message: DECISION_LANGUAGE_MESSAGE })
91
+ .optional(),
92
+ });
93
+ export const SearchRecipesPayload = z.object({
94
+ kind: z.literal("search_recipes"),
95
+ recipes: z.array(SearchRecipe).min(1).max(50),
96
+ });
97
+ // ── convention_notes ─────────────────────────────────────────────────────
98
+ export const ConventionNote = z.object({
99
+ topic: z.string().min(3).max(80).refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE }),
100
+ // Tightened from 300 → 180: conventions are short statements of fact, not
101
+ // how-to instructions.
102
+ rule: descriptiveField(5, 180),
103
+ example: noMarkersField(200).optional(),
104
+ });
105
+ export const ConventionNotesPayload = z.object({
106
+ kind: z.literal("convention_notes"),
107
+ notes: z.array(ConventionNote).min(1).max(20),
108
+ });
109
+ // ── cross_references ─────────────────────────────────────────────────────
110
+ export const CrossReference = z.object({
111
+ from_path: z.string().regex(PathRegex).max(120),
112
+ to_path: z.string().regex(PathRegex).max(120),
113
+ relation: z.string().min(3).max(120)
114
+ .refine(noEmbeddedMarkers, { message: EMBEDDED_MARKER_MESSAGE })
115
+ .refine(noDecisionLanguage, { message: DECISION_LANGUAGE_MESSAGE }),
116
+ });
117
+ export const CrossReferencesPayload = z.object({
118
+ kind: z.literal("cross_references"),
119
+ refs: z.array(CrossReference).min(1).max(50),
120
+ });
121
+ // ── Discriminated union over all kinds ───────────────────────────────────
122
+ export const CurationPayload = z.discriminatedUnion("kind", [
123
+ KnowledgeLayoutPayload,
124
+ RoutingTablePayload,
125
+ FrontmatterSchemaPayload,
126
+ SearchRecipesPayload,
127
+ ConventionNotesPayload,
128
+ CrossReferencesPayload,
129
+ ]);
130
+ // ── Per-kind byte budgets (P22 §1.4.5) ───────────────────────────────────
131
+ export const BYTE_BUDGET = {
132
+ knowledge_layout: 3 * 1024,
133
+ routing_table: 2 * 1024,
134
+ frontmatter_schema: 2 * 1024,
135
+ search_recipes: 2 * 1024,
136
+ convention_notes: 1.5 * 1024,
137
+ cross_references: 1 * 1024,
138
+ };
139
+ // ── Curation declaration sidecar (curation.json) ─────────────────────────
140
+ export const CurationDeclarationSection = z.object({
141
+ id: z.string().min(1).max(80).regex(/^[a-z0-9-]+$/),
142
+ kind: z.enum(SECTION_KINDS),
143
+ anchor: z.string().min(1).max(200),
144
+ human_label: z.string().min(1).max(80),
145
+ description: z.string().min(1).max(200),
146
+ scope_paths: z.array(z.string().min(1).max(120)).min(1).max(20),
147
+ });
148
+ export const CurationDeclaration = z.object({
149
+ version: z.literal(1),
150
+ sections: z.array(CurationDeclarationSection).min(1).max(4),
151
+ });
152
+ // ── Settings (`runtime_state.skill_curation.config`) ─────────────────────
153
+ // P22 §6.2 — operator-facing config. Auto-apply is the implicit behaviour
154
+ // (every passing proposal applies); the only opt-out is `enabled = false`,
155
+ // which both stops new runs AND tells SkillsCompiler to render seed-only.
156
+ export const SkillCurationConfig = z.object({
157
+ enabled: z.boolean().default(false),
158
+ cadence: z.enum(["daily", "weekly", "monthly"]).default("weekly"),
159
+ backend: z.enum(["claude", "codex", "gemini"]).default("claude"),
160
+ model: z.string().min(1).max(120).default("claude-sonnet-4-6"),
161
+ excluded_skills: z.array(z.string().min(1).max(80)).default([]),
162
+ });
163
+ export const DEFAULT_SKILL_CURATION_CONFIG = {
164
+ enabled: false,
165
+ cadence: "weekly",
166
+ backend: "claude",
167
+ model: "claude-sonnet-4-6",
168
+ excluded_skills: [],
169
+ };
170
+ // ── Overlay envelope written to disk ─────────────────────────────────────
171
+ export const OverlayEnvelope = z.object({
172
+ schema_version: z.number().int().positive(),
173
+ skill_slug: z.string().min(1).max(80),
174
+ section_id: z.string().min(1).max(80),
175
+ kind: z.enum(SECTION_KINDS),
176
+ payload: CurationPayload,
177
+ applied_proposal_id: z.number().int().nullable(),
178
+ applied_at: z.number().int().nullable(),
179
+ });
180
+ // ── Proposal submission body (POST /api/skill-curation/proposals) ───────
181
+ export const SubmitProposalRequest = z.object({
182
+ runId: z.string().min(1).max(120),
183
+ skill_slug: z.string().min(1).max(80),
184
+ section_id: z.string().min(1).max(80),
185
+ payload: CurationPayload,
186
+ rationale: z.string().min(1).max(500),
187
+ signal_ids: z.array(z.number().int().positive()).min(1).max(50),
188
+ });
189
+ // ── §6.4 manual run trigger ──────────────────────────────────────────────
190
+ /** Manual on-demand run — `POST /api/skill-curation/runs/manual`. The
191
+ * dashboard fires this when the owner clicks "Run optimization now".
192
+ * Bypasses the per-skill weight threshold and the per-section cooldown
193
+ * for skill SELECTION (see signals.ts), but proposals still require
194
+ * signal citations via the `signal_citations_valid` smoke check.
195
+ *
196
+ * Body is intentionally empty in v1 — server reads cadence/backend/model
197
+ * from `runtime_state.skill_curation.config`. Reserved for future use
198
+ * (e.g. owner-narrowed manual run targeting a specific skill). */
199
+ export const ManualRunRequest = z.object({
200
+ /** Optional override — restrict the run to these skills only. When
201
+ * omitted, every skill with ≥1 unconsumed signal becomes a target.
202
+ * Slugs the operator excluded via /settings/self-learning are still
203
+ * filtered out regardless of this list. */
204
+ target_skills: z.array(z.string().min(1).max(80)).max(20).optional(),
205
+ });
206
+ // ── §5.4 orphan-overlay discard ────────────────────────────────────────
207
+ export const DiscardOrphanRequest = z.object({
208
+ slug: z.string().min(1).max(80),
209
+ section_id: z.string().min(1).max(80),
210
+ });
211
+ //# sourceMappingURL=schemas.js.map