@w3kits-com/plugin-opendesign 0.1.11 → 0.1.12

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 (124) hide show
  1. package/dist/404/index.html +1 -1
  2. package/dist/404.html +1 -1
  3. package/dist/__next.$oc$slug.__PAGE__.txt +1 -1
  4. package/dist/__next.$oc$slug.txt +1 -1
  5. package/dist/__next._full.txt +1 -1
  6. package/dist/__next._head.txt +1 -1
  7. package/dist/__next._index.txt +1 -1
  8. package/dist/__next._tree.txt +1 -1
  9. package/dist/__w3kits/webcontainer-runtime/package.json +6 -1
  10. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/browser-vfs/dist/index.d.ts +108 -0
  11. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/browser-vfs/dist/index.d.ts.map +1 -0
  12. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/browser-vfs/dist/index.mjs +413 -0
  13. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/browser-vfs/package.json +12 -0
  14. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/artifact-id.d.ts +5 -0
  15. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/artifact-id.d.ts.map +1 -0
  16. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/events.d.ts +250 -0
  17. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/events.d.ts.map +1 -0
  18. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/index.d.ts +4 -0
  19. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/index.d.ts.map +1 -0
  20. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/index.mjs +186 -0
  21. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/public-params.d.ts +26 -0
  22. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/analytics/public-params.d.ts.map +1 -0
  23. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/app-config.d.ts +44 -0
  24. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/app-config.d.ts.map +1 -0
  25. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/artifacts.d.ts +34 -0
  26. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/artifacts.d.ts.map +1 -0
  27. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/chat.d.ts +158 -0
  28. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/chat.d.ts.map +1 -0
  29. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/comments.d.ts +65 -0
  30. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/comments.d.ts.map +1 -0
  31. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/connectionTest.d.ts +49 -0
  32. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/connectionTest.d.ts.map +1 -0
  33. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/connectionTest.mjs +83 -0
  34. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/connectors.d.ts +133 -0
  35. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/connectors.d.ts.map +1 -0
  36. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/files.d.ts +43 -0
  37. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/files.d.ts.map +1 -0
  38. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/finalize.d.ts +50 -0
  39. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/finalize.d.ts.map +1 -0
  40. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/finalize.mjs +5 -0
  41. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/live-artifacts.d.ts +151 -0
  42. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/live-artifacts.d.ts.map +1 -0
  43. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/mcp.d.ts +117 -0
  44. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/mcp.d.ts.map +1 -0
  45. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/memory.d.ts +233 -0
  46. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/memory.d.ts.map +1 -0
  47. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/orbit.d.ts +22 -0
  48. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/orbit.d.ts.map +1 -0
  49. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/orbit.mjs +0 -0
  50. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/projects.d.ts +286 -0
  51. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/projects.d.ts.map +1 -0
  52. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/providerModels.d.ts +19 -0
  53. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/providerModels.d.ts.map +1 -0
  54. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/providerModels.mjs +0 -0
  55. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/proxy.d.ts +24 -0
  56. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/proxy.d.ts.map +1 -0
  57. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/registry.d.ts +156 -0
  58. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/registry.d.ts.map +1 -0
  59. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/research.d.ts +35 -0
  60. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/research.d.ts.map +1 -0
  61. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/research.mjs +9 -0
  62. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/routines.d.ts +104 -0
  63. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/routines.d.ts.map +1 -0
  64. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/version.d.ts +11 -0
  65. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/api/version.d.ts.map +1 -0
  66. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/common.d.ts +33 -0
  67. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/common.d.ts.map +1 -0
  68. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/critique.d.ts +344 -0
  69. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/critique.d.ts.map +1 -0
  70. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/critique.mjs +182 -0
  71. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/errors.d.ts +40 -0
  72. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/errors.d.ts.map +1 -0
  73. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/examples.d.ts +20 -0
  74. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/examples.d.ts.map +1 -0
  75. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/index.d.ts +31 -0
  76. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/index.d.ts.map +1 -0
  77. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/index.mjs +2072 -0
  78. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/deck-framework.d.ts +39 -0
  79. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/deck-framework.d.ts.map +1 -0
  80. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/directions.d.ts +69 -0
  81. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/directions.d.ts.map +1 -0
  82. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/discovery.d.ts +2 -0
  83. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/discovery.d.ts.map +1 -0
  84. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/media-contract.d.ts +2 -0
  85. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/media-contract.d.ts.map +1 -0
  86. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/official-system.d.ts +12 -0
  87. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/official-system.d.ts.map +1 -0
  88. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/system.d.ts +58 -0
  89. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/prompts/system.d.ts.map +1 -0
  90. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/sse/chat.d.ts +96 -0
  91. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/sse/chat.d.ts.map +1 -0
  92. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/sse/common.d.ts +8 -0
  93. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/sse/common.d.ts.map +1 -0
  94. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/sse/proxy.d.ts +6 -0
  95. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/sse/proxy.d.ts.map +1 -0
  96. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/tasks.d.ts +12 -0
  97. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/dist/tasks.d.ts.map +1 -0
  98. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/contracts/package.json +40 -0
  99. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/platform/dist/index.d.ts +68 -0
  100. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/platform/dist/index.d.ts.map +1 -0
  101. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/platform/dist/index.mjs +397 -0
  102. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/platform/package.json +12 -0
  103. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/sidecar/dist/index.d.ts +144 -0
  104. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/sidecar/dist/index.d.ts.map +1 -0
  105. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/sidecar/dist/index.mjs +412 -0
  106. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/sidecar/package.json +12 -0
  107. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/sidecar-proto/dist/index.d.ts +291 -0
  108. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/sidecar-proto/dist/index.d.ts.map +1 -0
  109. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/sidecar-proto/dist/index.mjs +315 -0
  110. package/dist/__w3kits/webcontainer-runtime/workspace-packages/@open-design/sidecar-proto/package.json +12 -0
  111. package/dist/_not-found/__next._full.txt +1 -1
  112. package/dist/_not-found/__next._head.txt +1 -1
  113. package/dist/_not-found/__next._index.txt +1 -1
  114. package/dist/_not-found/__next._not-found.__PAGE__.txt +1 -1
  115. package/dist/_not-found/__next._not-found.txt +1 -1
  116. package/dist/_not-found/__next._tree.txt +1 -1
  117. package/dist/_not-found/index.html +1 -1
  118. package/dist/_not-found/index.txt +1 -1
  119. package/dist/index.html +1 -1
  120. package/dist/index.txt +1 -1
  121. package/package.json +1 -1
  122. /package/dist/_next/static/{DJnxTGY7DiPmoowmfZmqQ → 5BA5jEbmoqCfBPFzdjNtN}/_buildManifest.js +0 -0
  123. /package/dist/_next/static/{DJnxTGY7DiPmoowmfZmqQ → 5BA5jEbmoqCfBPFzdjNtN}/_clientMiddlewareManifest.js +0 -0
  124. /package/dist/_next/static/{DJnxTGY7DiPmoowmfZmqQ → 5BA5jEbmoqCfBPFzdjNtN}/_ssgManifest.js +0 -0
@@ -0,0 +1,344 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Local mirror of SseTransportEvent from './sse/common'. Re-defining the
4
+ * three-field interface avoids a cross-file relative import inside this leaf
5
+ * module: the daemon walks this file via the './critique' subpath export
6
+ * under NodeNext (which requires explicit '.js' extensions), while the web
7
+ * Turbopack build refuses to rewrite '.js' to '.ts' on the same source.
8
+ * Keeping the type local makes the file self-contained for both consumers.
9
+ */
10
+ interface SseTransportEvent<Name extends string, Payload> {
11
+ id?: string;
12
+ event: Name;
13
+ data: Payload;
14
+ }
15
+ export declare const PANELIST_ROLES: readonly ["designer", "critic", "brand", "a11y", "copy"];
16
+ export type PanelistRole = typeof PANELIST_ROLES[number];
17
+ export declare const FALLBACK_POLICIES: readonly ["ship_best", "ship_last", "fail"];
18
+ export type FallbackPolicy = typeof FALLBACK_POLICIES[number];
19
+ export declare const CRITIQUE_PROTOCOL_VERSION = 1;
20
+ export declare const RoleWeights: z.ZodObject<{
21
+ designer: z.ZodNumber;
22
+ critic: z.ZodNumber;
23
+ brand: z.ZodNumber;
24
+ a11y: z.ZodNumber;
25
+ copy: z.ZodNumber;
26
+ }, "strip", z.ZodTypeAny, {
27
+ designer: number;
28
+ critic: number;
29
+ brand: number;
30
+ a11y: number;
31
+ copy: number;
32
+ }, {
33
+ designer: number;
34
+ critic: number;
35
+ brand: number;
36
+ a11y: number;
37
+ copy: number;
38
+ }>;
39
+ export type RoleWeights = z.infer<typeof RoleWeights>;
40
+ export declare const CritiqueConfigSchema: z.ZodEffects<z.ZodObject<{
41
+ enabled: z.ZodBoolean;
42
+ cast: z.ZodArray<z.ZodEnum<["designer", "critic", "brand", "a11y", "copy"]>, "many">;
43
+ maxRounds: z.ZodNumber;
44
+ scoreScale: z.ZodNumber;
45
+ scoreThreshold: z.ZodNumber;
46
+ weights: z.ZodObject<{
47
+ designer: z.ZodNumber;
48
+ critic: z.ZodNumber;
49
+ brand: z.ZodNumber;
50
+ a11y: z.ZodNumber;
51
+ copy: z.ZodNumber;
52
+ }, "strip", z.ZodTypeAny, {
53
+ designer: number;
54
+ critic: number;
55
+ brand: number;
56
+ a11y: number;
57
+ copy: number;
58
+ }, {
59
+ designer: number;
60
+ critic: number;
61
+ brand: number;
62
+ a11y: number;
63
+ copy: number;
64
+ }>;
65
+ perRoundTimeoutMs: z.ZodNumber;
66
+ totalTimeoutMs: z.ZodNumber;
67
+ parserMaxBlockBytes: z.ZodNumber;
68
+ fallbackPolicy: z.ZodEnum<["ship_best", "ship_last", "fail"]>;
69
+ protocolVersion: z.ZodNumber;
70
+ maxConcurrentRuns: z.ZodNumber;
71
+ }, "strip", z.ZodTypeAny, {
72
+ enabled: boolean;
73
+ cast: ("designer" | "critic" | "brand" | "a11y" | "copy")[];
74
+ maxRounds: number;
75
+ scoreScale: number;
76
+ scoreThreshold: number;
77
+ weights: {
78
+ designer: number;
79
+ critic: number;
80
+ brand: number;
81
+ a11y: number;
82
+ copy: number;
83
+ };
84
+ perRoundTimeoutMs: number;
85
+ totalTimeoutMs: number;
86
+ parserMaxBlockBytes: number;
87
+ fallbackPolicy: "ship_best" | "ship_last" | "fail";
88
+ protocolVersion: number;
89
+ maxConcurrentRuns: number;
90
+ }, {
91
+ enabled: boolean;
92
+ cast: ("designer" | "critic" | "brand" | "a11y" | "copy")[];
93
+ maxRounds: number;
94
+ scoreScale: number;
95
+ scoreThreshold: number;
96
+ weights: {
97
+ designer: number;
98
+ critic: number;
99
+ brand: number;
100
+ a11y: number;
101
+ copy: number;
102
+ };
103
+ perRoundTimeoutMs: number;
104
+ totalTimeoutMs: number;
105
+ parserMaxBlockBytes: number;
106
+ fallbackPolicy: "ship_best" | "ship_last" | "fail";
107
+ protocolVersion: number;
108
+ maxConcurrentRuns: number;
109
+ }>, {
110
+ enabled: boolean;
111
+ cast: ("designer" | "critic" | "brand" | "a11y" | "copy")[];
112
+ maxRounds: number;
113
+ scoreScale: number;
114
+ scoreThreshold: number;
115
+ weights: {
116
+ designer: number;
117
+ critic: number;
118
+ brand: number;
119
+ a11y: number;
120
+ copy: number;
121
+ };
122
+ perRoundTimeoutMs: number;
123
+ totalTimeoutMs: number;
124
+ parserMaxBlockBytes: number;
125
+ fallbackPolicy: "ship_best" | "ship_last" | "fail";
126
+ protocolVersion: number;
127
+ maxConcurrentRuns: number;
128
+ }, {
129
+ enabled: boolean;
130
+ cast: ("designer" | "critic" | "brand" | "a11y" | "copy")[];
131
+ maxRounds: number;
132
+ scoreScale: number;
133
+ scoreThreshold: number;
134
+ weights: {
135
+ designer: number;
136
+ critic: number;
137
+ brand: number;
138
+ a11y: number;
139
+ copy: number;
140
+ };
141
+ perRoundTimeoutMs: number;
142
+ totalTimeoutMs: number;
143
+ parserMaxBlockBytes: number;
144
+ fallbackPolicy: "ship_best" | "ship_last" | "fail";
145
+ protocolVersion: number;
146
+ maxConcurrentRuns: number;
147
+ }>;
148
+ export type CritiqueConfig = z.infer<typeof CritiqueConfigSchema>;
149
+ export declare function defaultCritiqueConfig(): CritiqueConfig;
150
+ export declare const DEGRADED_REASONS: readonly ["malformed_block", "oversize_block", "adapter_unsupported", "protocol_version_mismatch", "missing_artifact"];
151
+ export type DegradedReason = typeof DEGRADED_REASONS[number];
152
+ export declare const FAILED_CAUSES: readonly ["cli_exit_nonzero", "per_round_timeout", "total_timeout", "orchestrator_internal"];
153
+ export type FailedCause = typeof FAILED_CAUSES[number];
154
+ export declare const PARSER_WARNING_KINDS: readonly ["weak_debate", "unknown_role", "score_clamped", "composite_mismatch", "duplicate_ship"];
155
+ export type ParserWarningKind = typeof PARSER_WARNING_KINDS[number];
156
+ export declare const ROUND_DECISIONS: readonly ["continue", "ship"];
157
+ export type RoundDecision = typeof ROUND_DECISIONS[number];
158
+ export declare const SHIP_STATUSES: readonly ["shipped", "below_threshold", "timed_out", "interrupted"];
159
+ export type ShipStatus = typeof SHIP_STATUSES[number];
160
+ export type PanelEvent = {
161
+ type: 'run_started';
162
+ runId: string;
163
+ protocolVersion: number;
164
+ cast: PanelistRole[];
165
+ maxRounds: number;
166
+ threshold: number;
167
+ scale: number;
168
+ } | {
169
+ type: 'panelist_open';
170
+ runId: string;
171
+ round: number;
172
+ role: PanelistRole;
173
+ } | {
174
+ type: 'panelist_dim';
175
+ runId: string;
176
+ round: number;
177
+ role: PanelistRole;
178
+ dimName: string;
179
+ dimScore: number;
180
+ dimNote: string;
181
+ } | {
182
+ type: 'panelist_must_fix';
183
+ runId: string;
184
+ round: number;
185
+ role: PanelistRole;
186
+ text: string;
187
+ } | {
188
+ type: 'panelist_close';
189
+ runId: string;
190
+ round: number;
191
+ role: PanelistRole;
192
+ score: number;
193
+ } | {
194
+ type: 'round_end';
195
+ runId: string;
196
+ round: number;
197
+ composite: number;
198
+ mustFix: number;
199
+ decision: RoundDecision;
200
+ reason: string;
201
+ } | {
202
+ type: 'ship';
203
+ runId: string;
204
+ round: number;
205
+ composite: number;
206
+ status: ShipStatus;
207
+ artifactRef: {
208
+ projectId: string;
209
+ artifactId: string;
210
+ };
211
+ summary: string;
212
+ } | {
213
+ type: 'degraded';
214
+ runId: string;
215
+ reason: DegradedReason;
216
+ adapter: string;
217
+ } | {
218
+ type: 'interrupted';
219
+ runId: string;
220
+ bestRound: number;
221
+ composite: number;
222
+ } | {
223
+ type: 'failed';
224
+ runId: string;
225
+ cause: FailedCause;
226
+ } | {
227
+ type: 'parser_warning';
228
+ runId: string;
229
+ kind: ParserWarningKind;
230
+ position: number;
231
+ };
232
+ /**
233
+ * Strict runtime guard for the `PanelEvent` union. Validates the union tag
234
+ * (`type`), the non-empty `runId` header, every variant-specific required
235
+ * field, the membership of closed-enum fields (`role`, `status`, `reason`,
236
+ * `cause`, `kind`, `decision`), and the numeric domain of every numeric
237
+ * field (integer / positive / non-negative / range), not just finiteness.
238
+ *
239
+ * This is the single source of truth for wire-side validation. Both the web
240
+ * SSE path (`sseToPanelEvent`) and the transcript replay parser go through
241
+ * here, so a malformed frame (missing field, unknown enum value, NaN /
242
+ * Infinity score, `scale: 0` causing downstream divide-by-zero, threshold
243
+ * outside `[0, scale]`, fractional or negative round numbers) is rejected
244
+ * before any reducer or component touches it.
245
+ *
246
+ * Numeric domains enforced (lefarcen P2 on PR #1314 round 4):
247
+ *
248
+ * - `protocolVersion`, `maxRounds`, `scale`, `round`: positive integers.
249
+ * ScoreTicker divides by `scale` for inline CSS, so a `scale: 0` would
250
+ * produce Infinity and ship as broken style; rounds are 1-indexed.
251
+ * - `bestRound`, `mustFix`, `position`: non-negative integers. `bestRound:
252
+ * 0` is the valid "interrupt before any round closed" sentinel.
253
+ * - `threshold`: non-negative finite; cross-checked `threshold <= scale`
254
+ * inside `run_started`. Threshold is allowed to be fractional (e.g.
255
+ * 8.5 on a scale of 10).
256
+ * - `composite`, `score`, `dimScore`: non-negative finite. The
257
+ * `<= scale` bound is per-run state the guard does not see; downstream
258
+ * code clamps to scale on render, but a negative score is never valid.
259
+ *
260
+ * Earlier review history:
261
+ *
262
+ * - Siri-Ray round-3 P1: the original guard checked `typeof === 'string'`
263
+ * for enum fields and accepted unknown values; now validated against
264
+ * the closed-set arrays.
265
+ */
266
+ export declare function isPanelEvent(value: unknown): value is PanelEvent;
267
+ type PayloadOf<T extends PanelEvent['type']> = Omit<Extract<PanelEvent, {
268
+ type: T;
269
+ }>, 'type'>;
270
+ export type CritiqueSseEvent = SseTransportEvent<'critique.run_started', PayloadOf<'run_started'>> | SseTransportEvent<'critique.panelist_open', PayloadOf<'panelist_open'>> | SseTransportEvent<'critique.panelist_dim', PayloadOf<'panelist_dim'>> | SseTransportEvent<'critique.panelist_must_fix', PayloadOf<'panelist_must_fix'>> | SseTransportEvent<'critique.panelist_close', PayloadOf<'panelist_close'>> | SseTransportEvent<'critique.round_end', PayloadOf<'round_end'>> | SseTransportEvent<'critique.ship', PayloadOf<'ship'>> | SseTransportEvent<'critique.degraded', PayloadOf<'degraded'>> | SseTransportEvent<'critique.interrupted', PayloadOf<'interrupted'>> | SseTransportEvent<'critique.failed', PayloadOf<'failed'>> | SseTransportEvent<'critique.parser_warning', PayloadOf<'parser_warning'>>;
271
+ export declare const CRITIQUE_SSE_EVENT_NAMES: readonly ["critique.run_started", "critique.panelist_open", "critique.panelist_dim", "critique.panelist_must_fix", "critique.panelist_close", "critique.round_end", "critique.ship", "critique.degraded", "critique.interrupted", "critique.failed", "critique.parser_warning"];
272
+ export type CritiqueSseEventName = typeof CRITIQUE_SSE_EVENT_NAMES[number];
273
+ export declare function panelEventToSse(e: PanelEvent): CritiqueSseEvent;
274
+ /**
275
+ * Per-round summary persisted with each critique run. Mirrors the shape the
276
+ * orchestrator writes via decideRound; web clients consume it through the
277
+ * rerun and history endpoints, so it lives in the shared contract layer.
278
+ */
279
+ export interface CritiqueRoundSummary {
280
+ n: number;
281
+ composite: number;
282
+ mustFix: number;
283
+ decision: RoundDecision;
284
+ }
285
+ /**
286
+ * Terminal critique status persisted with each run. Superset of ShipStatus
287
+ * that also covers degraded / failed / legacy outcomes. The daemon's CHECK
288
+ * constraint also accepts the in-flight 'running' value, but that is handled
289
+ * inline by daemon-side code; the public contract surface is terminal-only
290
+ * because every consumer of this type works against finished runs.
291
+ */
292
+ export type CritiqueRunStatus = ShipStatus | 'degraded' | 'failed' | 'legacy';
293
+ /**
294
+ * Enumeration of every terminal CritiqueRunStatus value, in the order the
295
+ * UI / docs / status filters typically display them: SHIP outcomes first
296
+ * (shipped → below_threshold → timed_out → interrupted), then quality /
297
+ * lifecycle exits (degraded → failed), then the historical 'legacy' tag
298
+ * for runs created before the feature shipped. Web consumers (status
299
+ * filters, analytics dashboards) iterate this constant directly so the
300
+ * daemon stays the single source of truth on the order.
301
+ */
302
+ export declare const CRITIQUE_RUN_STATUSES: readonly ["shipped", "below_threshold", "timed_out", "interrupted", "degraded", "failed", "legacy"];
303
+ /**
304
+ * Compile-time guarantee that every `CritiqueRunStatus` variant appears in
305
+ * `CRITIQUE_RUN_STATUSES`. `satisfies` only proves each listed value is
306
+ * valid; this assertion proves the list is exhaustive, so adding a new
307
+ * variant to `CritiqueRunStatus` (or `ShipStatus`) without updating the
308
+ * array fails the build with a tuple naming the missing variants. Picked
309
+ * up from lefarcen P3 on PR #1016. The exported helper type is reusable
310
+ * by other shared enums (e.g. `PANELIST_ROLES`) once they need the same
311
+ * guard.
312
+ */
313
+ export type AssertExhaustiveValues<T extends string, U extends readonly T[]> = Exclude<T, U[number]> extends never ? true : ['Missing variants in array:', Exclude<T, U[number]>];
314
+ /**
315
+ * Internal-to-the-daemon row status. Adds the in-flight `'running'` value
316
+ * the DB CHECK constraint accepts to the public `CritiqueRunStatus` union
317
+ * so DB-row types can be precisely typed without inline `as X | 'running'`
318
+ * widens at every call site. Every public DTO continues to use the
319
+ * terminal-only `CritiqueRunStatus` so a future endpoint cannot leak a
320
+ * 'running' row through the wire. Picked up from lefarcen P2 on PR #1016.
321
+ */
322
+ export type CritiquePersistedStatus = CritiqueRunStatus | 'running';
323
+ /**
324
+ * Logical handle the daemon hands to the web layer for a critique run's
325
+ * shipped artifact. Web clients never see daemon filesystem paths; they
326
+ * fetch the artifact bytes via the `url` field, which the daemon serves
327
+ * with the right `Content-Type` header derived from `mime`. Returned by
328
+ * the rerun endpoint and the `GET /api/projects/:projectId/critique/:runId/artifact`
329
+ * route that streams the bytes.
330
+ */
331
+ export interface CritiqueArtifactRef {
332
+ /** The owning project; matches the URL segment. */
333
+ projectId: string;
334
+ /** The owning critique run; matches the URL segment. */
335
+ runId: string;
336
+ /** Content-Type announced by the agent in `<ARTIFACT mime="…">`. */
337
+ mime: string;
338
+ /** Size of the artifact body in bytes, as written to disk. */
339
+ sizeBytes: number;
340
+ /** Daemon-relative HTTP path the web layer fetches to stream the bytes. */
341
+ url: string;
342
+ }
343
+ export {};
344
+ //# sourceMappingURL=critique.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"critique.d.ts","sourceRoot":"","sources":["../src/critique.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AACH,UAAU,iBAAiB,CAAC,IAAI,SAAS,MAAM,EAAE,OAAO;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,cAAc,0DAA2D,CAAC;AACvF,MAAM,MAAM,YAAY,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,iBAAiB,6CAA8C,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAMtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAA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MAAM,CAAC;IACb,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,182 @@
1
+ // src/critique.ts
2
+ import { z } from "zod";
3
+ var PANELIST_ROLES = ["designer", "critic", "brand", "a11y", "copy"];
4
+ var FALLBACK_POLICIES = ["ship_best", "ship_last", "fail"];
5
+ var CRITIQUE_PROTOCOL_VERSION = 1;
6
+ var RoleWeights = z.object({
7
+ designer: z.number().min(0).max(1),
8
+ critic: z.number().min(0).max(1),
9
+ brand: z.number().min(0).max(1),
10
+ a11y: z.number().min(0).max(1),
11
+ copy: z.number().min(0).max(1)
12
+ });
13
+ var CritiqueConfigSchema = z.object({
14
+ enabled: z.boolean(),
15
+ cast: z.array(z.enum(PANELIST_ROLES)).min(1),
16
+ maxRounds: z.number().int().min(1).max(10),
17
+ scoreScale: z.number().int().min(1).max(100),
18
+ scoreThreshold: z.number().min(0).max(100).describe("Must be <= scoreScale; enforced by cross-field refine"),
19
+ weights: RoleWeights,
20
+ perRoundTimeoutMs: z.number().int().min(1e3),
21
+ totalTimeoutMs: z.number().int().min(1e3),
22
+ parserMaxBlockBytes: z.number().int().min(1024),
23
+ fallbackPolicy: z.enum(FALLBACK_POLICIES),
24
+ protocolVersion: z.number().int().min(1),
25
+ maxConcurrentRuns: z.number().int().min(1)
26
+ }).refine(
27
+ // Small epsilon tolerance so a fractional threshold that rounds up against an
28
+ // integer scale (e.g. 8.0 with floating-point slack) still validates. The
29
+ // semantic check is "threshold cannot meaningfully exceed scale".
30
+ (cfg) => cfg.scoreThreshold <= cfg.scoreScale + 1e-9,
31
+ { message: "scoreThreshold must be <= scoreScale" }
32
+ );
33
+ function defaultCritiqueConfig() {
34
+ return {
35
+ enabled: false,
36
+ cast: [...PANELIST_ROLES],
37
+ maxRounds: 3,
38
+ scoreScale: 10,
39
+ scoreThreshold: 8,
40
+ weights: { designer: 0, critic: 0.4, brand: 0.2, a11y: 0.2, copy: 0.2 },
41
+ perRoundTimeoutMs: 9e4,
42
+ totalTimeoutMs: 24e4,
43
+ parserMaxBlockBytes: 262144,
44
+ fallbackPolicy: "ship_best",
45
+ protocolVersion: CRITIQUE_PROTOCOL_VERSION,
46
+ // Contracts layer cannot call os.cpus(); daemon env layer overrides via OD_CRITIQUE_MAX_CONCURRENT_RUNS.
47
+ maxConcurrentRuns: 4
48
+ };
49
+ }
50
+ var DEGRADED_REASONS = [
51
+ "malformed_block",
52
+ "oversize_block",
53
+ "adapter_unsupported",
54
+ "protocol_version_mismatch",
55
+ "missing_artifact"
56
+ ];
57
+ var FAILED_CAUSES = [
58
+ "cli_exit_nonzero",
59
+ "per_round_timeout",
60
+ "total_timeout",
61
+ "orchestrator_internal"
62
+ ];
63
+ var PARSER_WARNING_KINDS = [
64
+ "weak_debate",
65
+ "unknown_role",
66
+ "score_clamped",
67
+ "composite_mismatch",
68
+ "duplicate_ship"
69
+ ];
70
+ var ROUND_DECISIONS = ["continue", "ship"];
71
+ var SHIP_STATUSES = [
72
+ "shipped",
73
+ "below_threshold",
74
+ "timed_out",
75
+ "interrupted"
76
+ ];
77
+ var PANEL_EVENT_TYPE_LIST = [
78
+ "run_started",
79
+ "panelist_open",
80
+ "panelist_dim",
81
+ "panelist_must_fix",
82
+ "panelist_close",
83
+ "round_end",
84
+ "ship",
85
+ "degraded",
86
+ "interrupted",
87
+ "failed",
88
+ "parser_warning"
89
+ ];
90
+ var PANEL_EVENT_TYPES = new Set(PANEL_EVENT_TYPE_LIST);
91
+ var PANELIST_ROLE_SET = new Set(PANELIST_ROLES);
92
+ var SHIP_STATUS_SET = new Set(SHIP_STATUSES);
93
+ var DEGRADED_REASON_SET = new Set(DEGRADED_REASONS);
94
+ var FAILED_CAUSE_SET = new Set(FAILED_CAUSES);
95
+ var PARSER_WARNING_KIND_SET = new Set(PARSER_WARNING_KINDS);
96
+ var ROUND_DECISION_SET = new Set(ROUND_DECISIONS);
97
+ var isFiniteNumber = (v) => typeof v === "number" && Number.isFinite(v);
98
+ var isNonNegativeFinite = (v) => isFiniteNumber(v) && v >= 0;
99
+ var isNonNegativeInt = (v) => isFiniteNumber(v) && Number.isInteger(v) && v >= 0;
100
+ var isPositiveInt = (v) => isFiniteNumber(v) && Number.isInteger(v) && v > 0;
101
+ var isString = (v) => typeof v === "string";
102
+ var isPanelistRole = (v) => isString(v) && PANELIST_ROLE_SET.has(v);
103
+ function isPanelEvent(value) {
104
+ if (!value || typeof value !== "object") return false;
105
+ const o = value;
106
+ const t = o["type"];
107
+ if (typeof t !== "string" || !PANEL_EVENT_TYPES.has(t)) return false;
108
+ const runId = o["runId"];
109
+ if (typeof runId !== "string" || runId.length === 0) return false;
110
+ switch (t) {
111
+ case "run_started": {
112
+ const threshold = o["threshold"];
113
+ const scale = o["scale"];
114
+ return isPositiveInt(o["protocolVersion"]) && Array.isArray(o["cast"]) && o["cast"].length > 0 && o["cast"].every(isPanelistRole) && isPositiveInt(o["maxRounds"]) && isPositiveInt(scale) && isNonNegativeFinite(threshold) && threshold <= scale;
115
+ }
116
+ case "panelist_open":
117
+ return isPositiveInt(o["round"]) && isPanelistRole(o["role"]);
118
+ case "panelist_dim":
119
+ return isPositiveInt(o["round"]) && isPanelistRole(o["role"]) && isString(o["dimName"]) && isNonNegativeFinite(o["dimScore"]) && isString(o["dimNote"]);
120
+ case "panelist_must_fix":
121
+ return isPositiveInt(o["round"]) && isPanelistRole(o["role"]) && isString(o["text"]);
122
+ case "panelist_close":
123
+ return isPositiveInt(o["round"]) && isPanelistRole(o["role"]) && isNonNegativeFinite(o["score"]);
124
+ case "round_end":
125
+ return isPositiveInt(o["round"]) && isNonNegativeFinite(o["composite"]) && isNonNegativeInt(o["mustFix"]) && isString(o["decision"]) && ROUND_DECISION_SET.has(o["decision"]) && isString(o["reason"]);
126
+ case "ship": {
127
+ const ref = o["artifactRef"];
128
+ return isPositiveInt(o["round"]) && isNonNegativeFinite(o["composite"]) && isString(o["status"]) && SHIP_STATUS_SET.has(o["status"]) && ref !== null && typeof ref === "object" && typeof ref.projectId === "string" && ref.projectId.length > 0 && typeof ref.artifactId === "string" && ref.artifactId.length > 0 && isString(o["summary"]);
129
+ }
130
+ case "degraded":
131
+ return isString(o["reason"]) && DEGRADED_REASON_SET.has(o["reason"]) && isString(o["adapter"]);
132
+ case "interrupted":
133
+ return isNonNegativeInt(o["bestRound"]) && isNonNegativeFinite(o["composite"]);
134
+ case "failed":
135
+ return isString(o["cause"]) && FAILED_CAUSE_SET.has(o["cause"]);
136
+ case "parser_warning":
137
+ return isString(o["kind"]) && PARSER_WARNING_KIND_SET.has(o["kind"]) && isNonNegativeInt(o["position"]);
138
+ }
139
+ }
140
+ var CRITIQUE_SSE_EVENT_NAMES = [
141
+ "critique.run_started",
142
+ "critique.panelist_open",
143
+ "critique.panelist_dim",
144
+ "critique.panelist_must_fix",
145
+ "critique.panelist_close",
146
+ "critique.round_end",
147
+ "critique.ship",
148
+ "critique.degraded",
149
+ "critique.interrupted",
150
+ "critique.failed",
151
+ "critique.parser_warning"
152
+ ];
153
+ function panelEventToSse(e) {
154
+ const { type, ...payload } = e;
155
+ return { event: `critique.${type}`, data: payload };
156
+ }
157
+ var CRITIQUE_RUN_STATUSES = [
158
+ "shipped",
159
+ "below_threshold",
160
+ "timed_out",
161
+ "interrupted",
162
+ "degraded",
163
+ "failed",
164
+ "legacy"
165
+ ];
166
+ export {
167
+ CRITIQUE_PROTOCOL_VERSION,
168
+ CRITIQUE_RUN_STATUSES,
169
+ CRITIQUE_SSE_EVENT_NAMES,
170
+ CritiqueConfigSchema,
171
+ DEGRADED_REASONS,
172
+ FAILED_CAUSES,
173
+ FALLBACK_POLICIES,
174
+ PANELIST_ROLES,
175
+ PARSER_WARNING_KINDS,
176
+ ROUND_DECISIONS,
177
+ RoleWeights,
178
+ SHIP_STATUSES,
179
+ defaultCritiqueConfig,
180
+ isPanelEvent,
181
+ panelEventToSse
182
+ };
@@ -0,0 +1,40 @@
1
+ import type { JsonValue } from './common.js';
2
+ export declare const API_ERROR_CODES: readonly ["BAD_REQUEST", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "CONFLICT", "PAYLOAD_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "VALIDATION_FAILED", "AGENT_UNAVAILABLE", "AGENT_AUTH_REQUIRED", "AGENT_EXECUTION_FAILED", "AGENT_PROMPT_TOO_LARGE", "PROJECT_NOT_FOUND", "FILE_NOT_FOUND", "ARTIFACT_NOT_FOUND", "ARTIFACT_REGRESSION", "UPSTREAM_UNAVAILABLE", "RATE_LIMITED", "DESKTOP_AUTH_PENDING", "TOOL_TOKEN_MISSING", "TOOL_TOKEN_INVALID", "TOOL_TOKEN_EXPIRED", "TOOL_ENDPOINT_DENIED", "TOOL_OPERATION_DENIED", "LIVE_ARTIFACT_NOT_FOUND", "LIVE_ARTIFACT_INVALID", "LIVE_ARTIFACT_STORAGE_FAILED", "LIVE_ARTIFACT_REFRESH_UNAVAILABLE", "LIVE_ARTIFACT_REFRESH_TIMEOUT", "REFRESH_LOCKED", "REFRESH_TIMED_OUT", "REFRESH_FAILED", "OUTPUT_TOO_LARGE", "TEMPLATE_BINDING_INVALID", "REDACTION_REQUIRED", "CONNECTOR_NOT_FOUND", "CONNECTOR_NOT_CONNECTED", "CONNECTOR_DISABLED", "CONNECTOR_TOOL_NOT_FOUND", "CONNECTOR_SAFETY_DENIED", "CONNECTOR_INPUT_SCHEMA_MISMATCH", "CONNECTOR_RATE_LIMITED", "CONNECTOR_OUTPUT_TOO_LARGE", "CONNECTOR_EXECUTION_FAILED", "INTERNAL_ERROR"];
3
+ export type ApiErrorCode = (typeof API_ERROR_CODES)[number];
4
+ export interface ApiError {
5
+ code: ApiErrorCode;
6
+ message: string;
7
+ details?: JsonValue;
8
+ retryable?: boolean;
9
+ requestId?: string;
10
+ taskId?: string;
11
+ }
12
+ export interface ApiErrorResponse {
13
+ error: ApiError;
14
+ }
15
+ export type ApiValidationIssue = {
16
+ /** Dot/bracket path, JSON pointer, or form field name that failed validation. */
17
+ path: string;
18
+ message: string;
19
+ code?: string;
20
+ };
21
+ export type ApiValidationErrorDetails = {
22
+ kind: 'validation';
23
+ issues: ApiValidationIssue[];
24
+ };
25
+ /** Success payload or shared error envelope for agent-facing daemon tool endpoints. */
26
+ export type AgentToolApiResponse<TSuccess> = TSuccess | ApiErrorResponse;
27
+ export type LegacyErrorResponse = {
28
+ error: string;
29
+ } | {
30
+ code: string;
31
+ error: string;
32
+ };
33
+ export type CompatibleErrorResponse = ApiErrorResponse | LegacyErrorResponse;
34
+ export interface SseErrorPayload {
35
+ message: string;
36
+ error?: ApiError;
37
+ }
38
+ export declare function createApiError(code: ApiErrorCode, message: string, init?: Omit<ApiError, 'code' | 'message'>): ApiError;
39
+ export declare function createApiErrorResponse(error: ApiError): ApiErrorResponse;
40
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,eAAe,8hCA4DlB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,oBAAoB,CAAC,QAAQ,IAAI,QAAQ,GAAG,gBAAgB,CAAC;AAEzE,MAAM,MAAM,mBAAmB,GAC3B;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpC,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAE7E,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAM,GAAG,QAAQ,CAE3H;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,GAAG,gBAAgB,CAExE"}
@@ -0,0 +1,20 @@
1
+ import type { ChatRequest } from './api/chat';
2
+ import type { ConnectorDetail } from './api/connectors';
3
+ import type { ProjectFile } from './api/files';
4
+ import type { LiveArtifact, LiveArtifactCreateInput, LiveArtifactUpdateInput } from './api/live-artifacts';
5
+ import type { HealthResponse } from './api/registry';
6
+ import type { ApiErrorResponse } from './errors';
7
+ import type { ChatSseEvent } from './sse/chat';
8
+ import type { ProxySseEvent } from './sse/proxy';
9
+ export declare const exampleChatRequest: ChatRequest;
10
+ export declare const exampleProjectFile: ProjectFile;
11
+ export declare const exampleChatSseEvents: ChatSseEvent[];
12
+ export declare const exampleProxySseEvents: ProxySseEvent[];
13
+ export declare const exampleApiErrorResponse: ApiErrorResponse;
14
+ export declare const exampleLiveArtifactValidationErrorResponse: ApiErrorResponse;
15
+ export declare const exampleHealthResponse: HealthResponse;
16
+ export declare const exampleLiveArtifact: LiveArtifact;
17
+ export declare const exampleLiveArtifactCreateInput: LiveArtifactCreateInput;
18
+ export declare const exampleLiveArtifactUpdateInput: LiveArtifactUpdateInput;
19
+ export declare const exampleConnectorDetail: ConnectorDetail;
20
+ //# sourceMappingURL=examples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../src/examples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAA6B,MAAM,UAAU,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,kBAAkB,EAAE,WAShC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,WAQhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,YAAY,EAK9C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aAAa,EAIhD,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,gBAMrC,CAAC;AAaF,eAAO,MAAM,0CAA0C,EAAE,gBAOxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,cAAgD,CAAC;AAErF,eAAO,MAAM,mBAAmB,EAAE,YAuBjC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,uBAgB5C,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,uBAI5C,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAgCpC,CAAC"}
@@ -0,0 +1,31 @@
1
+ export * from './common';
2
+ export * from './errors';
3
+ export * from './tasks';
4
+ export * from './api/app-config';
5
+ export * from './api/artifacts';
6
+ export * from './api/chat';
7
+ export * from './api/connectors';
8
+ export * from './api/comments';
9
+ export * from './api/connectionTest';
10
+ export * from './api/files';
11
+ export * from './api/finalize';
12
+ export * from './api/live-artifacts';
13
+ export * from './api/mcp';
14
+ export * from './api/memory';
15
+ export * from './api/orbit';
16
+ export * from './api/providerModels';
17
+ export * from './api/projects';
18
+ export * from './api/proxy';
19
+ export * from './api/routines';
20
+ export * from './api/registry';
21
+ export * from './api/research';
22
+ export * from './api/version';
23
+ export * from './examples';
24
+ export * from './sse/common';
25
+ export * from './sse/chat';
26
+ export * from './sse/proxy';
27
+ export * from './prompts/system';
28
+ export * from './critique';
29
+ export * from './analytics/events';
30
+ export * from './analytics/public-params';
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC"}