@pugi/sdk 0.1.0-alpha.10

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.
@@ -0,0 +1,376 @@
1
+ import { z } from 'zod';
2
+ export declare const engineTaskKindSchema: z.ZodEnum<["code", "explain", "fix", "plan", "build_task"]>;
3
+ export type EngineTaskKind = z.infer<typeof engineTaskKindSchema>;
4
+ export declare const budgetLimitSchema: z.ZodObject<{
5
+ usd: z.ZodOptional<z.ZodNumber>;
6
+ tokens: z.ZodOptional<z.ZodNumber>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ usd?: number | undefined;
9
+ tokens?: number | undefined;
10
+ }, {
11
+ usd?: number | undefined;
12
+ tokens?: number | undefined;
13
+ }>;
14
+ export type BudgetLimit = z.infer<typeof budgetLimitSchema>;
15
+ export declare const engineTaskSchema: z.ZodObject<{
16
+ id: z.ZodString;
17
+ kind: z.ZodEnum<["code", "explain", "fix", "plan", "build_task"]>;
18
+ prompt: z.ZodString;
19
+ workspaceRoot: z.ZodString;
20
+ allowedPaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
21
+ deniedPaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
22
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
23
+ id: z.ZodString;
24
+ kind: z.ZodEnum<["brief", "prd_lite", "execution_graph", "risk_review", "acceptance_criteria", "diff", "review_verdict", "test_result", "debug_export"]>;
25
+ path: z.ZodOptional<z.ZodString>;
26
+ uri: z.ZodOptional<z.ZodString>;
27
+ title: z.ZodString;
28
+ sha256: z.ZodOptional<z.ZodString>;
29
+ createdAt: z.ZodString;
30
+ }, "strip", z.ZodTypeAny, {
31
+ id: string;
32
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
33
+ title: string;
34
+ createdAt: string;
35
+ path?: string | undefined;
36
+ uri?: string | undefined;
37
+ sha256?: string | undefined;
38
+ }, {
39
+ id: string;
40
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
41
+ title: string;
42
+ createdAt: string;
43
+ path?: string | undefined;
44
+ uri?: string | undefined;
45
+ sha256?: string | undefined;
46
+ }>, "many">>;
47
+ executionGraphNodeId: z.ZodOptional<z.ZodString>;
48
+ permissionMode: z.ZodEnum<["plan", "ask", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>;
49
+ budget: z.ZodOptional<z.ZodObject<{
50
+ usd: z.ZodOptional<z.ZodNumber>;
51
+ tokens: z.ZodOptional<z.ZodNumber>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ usd?: number | undefined;
54
+ tokens?: number | undefined;
55
+ }, {
56
+ usd?: number | undefined;
57
+ tokens?: number | undefined;
58
+ }>>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ id: string;
61
+ kind: "code" | "explain" | "fix" | "plan" | "build_task";
62
+ prompt: string;
63
+ artifacts: {
64
+ id: string;
65
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
66
+ title: string;
67
+ createdAt: string;
68
+ path?: string | undefined;
69
+ uri?: string | undefined;
70
+ sha256?: string | undefined;
71
+ }[];
72
+ workspaceRoot: string;
73
+ allowedPaths: string[];
74
+ deniedPaths: string[];
75
+ permissionMode: "plan" | "ask" | "acceptEdits" | "auto" | "dontAsk" | "bypassPermissions";
76
+ executionGraphNodeId?: string | undefined;
77
+ budget?: {
78
+ usd?: number | undefined;
79
+ tokens?: number | undefined;
80
+ } | undefined;
81
+ }, {
82
+ id: string;
83
+ kind: "code" | "explain" | "fix" | "plan" | "build_task";
84
+ prompt: string;
85
+ workspaceRoot: string;
86
+ permissionMode: "plan" | "ask" | "acceptEdits" | "auto" | "dontAsk" | "bypassPermissions";
87
+ artifacts?: {
88
+ id: string;
89
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
90
+ title: string;
91
+ createdAt: string;
92
+ path?: string | undefined;
93
+ uri?: string | undefined;
94
+ sha256?: string | undefined;
95
+ }[] | undefined;
96
+ allowedPaths?: string[] | undefined;
97
+ deniedPaths?: string[] | undefined;
98
+ executionGraphNodeId?: string | undefined;
99
+ budget?: {
100
+ usd?: number | undefined;
101
+ tokens?: number | undefined;
102
+ } | undefined;
103
+ }>;
104
+ export type EngineTask = z.infer<typeof engineTaskSchema>;
105
+ export declare const engineResultSchema: z.ZodObject<{
106
+ status: z.ZodEnum<["done", "blocked", "failed"]>;
107
+ summary: z.ZodString;
108
+ filesChanged: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
109
+ patchRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
110
+ id: z.ZodString;
111
+ kind: z.ZodEnum<["brief", "prd_lite", "execution_graph", "risk_review", "acceptance_criteria", "diff", "review_verdict", "test_result", "debug_export"]>;
112
+ path: z.ZodOptional<z.ZodString>;
113
+ uri: z.ZodOptional<z.ZodString>;
114
+ title: z.ZodString;
115
+ sha256: z.ZodOptional<z.ZodString>;
116
+ createdAt: z.ZodString;
117
+ }, "strip", z.ZodTypeAny, {
118
+ id: string;
119
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
120
+ title: string;
121
+ createdAt: string;
122
+ path?: string | undefined;
123
+ uri?: string | undefined;
124
+ sha256?: string | undefined;
125
+ }, {
126
+ id: string;
127
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
128
+ title: string;
129
+ createdAt: string;
130
+ path?: string | undefined;
131
+ uri?: string | undefined;
132
+ sha256?: string | undefined;
133
+ }>, "many">>;
134
+ testsRun: z.ZodDefault<z.ZodArray<z.ZodObject<{
135
+ command: z.ZodString;
136
+ status: z.ZodEnum<["passed", "failed", "skipped"]>;
137
+ durationMs: z.ZodOptional<z.ZodNumber>;
138
+ outputRef: z.ZodOptional<z.ZodString>;
139
+ }, "strip", z.ZodTypeAny, {
140
+ status: "failed" | "passed" | "skipped";
141
+ command: string;
142
+ durationMs?: number | undefined;
143
+ outputRef?: string | undefined;
144
+ }, {
145
+ status: "failed" | "passed" | "skipped";
146
+ command: string;
147
+ durationMs?: number | undefined;
148
+ outputRef?: string | undefined;
149
+ }>, "many">>;
150
+ risks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
151
+ eventRefs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ status: "failed" | "done" | "blocked";
154
+ risks: string[];
155
+ summary: string;
156
+ testsRun: {
157
+ status: "failed" | "passed" | "skipped";
158
+ command: string;
159
+ durationMs?: number | undefined;
160
+ outputRef?: string | undefined;
161
+ }[];
162
+ filesChanged: string[];
163
+ patchRefs: {
164
+ id: string;
165
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
166
+ title: string;
167
+ createdAt: string;
168
+ path?: string | undefined;
169
+ uri?: string | undefined;
170
+ sha256?: string | undefined;
171
+ }[];
172
+ eventRefs: string[];
173
+ }, {
174
+ status: "failed" | "done" | "blocked";
175
+ summary: string;
176
+ risks?: string[] | undefined;
177
+ testsRun?: {
178
+ status: "failed" | "passed" | "skipped";
179
+ command: string;
180
+ durationMs?: number | undefined;
181
+ outputRef?: string | undefined;
182
+ }[] | undefined;
183
+ filesChanged?: string[] | undefined;
184
+ patchRefs?: {
185
+ id: string;
186
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
187
+ title: string;
188
+ createdAt: string;
189
+ path?: string | undefined;
190
+ uri?: string | undefined;
191
+ sha256?: string | undefined;
192
+ }[] | undefined;
193
+ eventRefs?: string[] | undefined;
194
+ }>;
195
+ export type EngineResult = z.infer<typeof engineResultSchema>;
196
+ export declare const engineCapabilitiesSchema: z.ZodObject<{
197
+ supportsStreaming: z.ZodBoolean;
198
+ supportsFileEdits: z.ZodBoolean;
199
+ supportsShell: z.ZodBoolean;
200
+ supportsLsp: z.ZodBoolean;
201
+ supportsSubagents: z.ZodBoolean;
202
+ }, "strip", z.ZodTypeAny, {
203
+ supportsStreaming: boolean;
204
+ supportsFileEdits: boolean;
205
+ supportsShell: boolean;
206
+ supportsLsp: boolean;
207
+ supportsSubagents: boolean;
208
+ }, {
209
+ supportsStreaming: boolean;
210
+ supportsFileEdits: boolean;
211
+ supportsShell: boolean;
212
+ supportsLsp: boolean;
213
+ supportsSubagents: boolean;
214
+ }>;
215
+ export type EngineCapabilities = z.infer<typeof engineCapabilitiesSchema>;
216
+ export declare const engineEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
217
+ type: z.ZodLiteral<"status">;
218
+ message: z.ZodString;
219
+ }, "strip", z.ZodTypeAny, {
220
+ message: string;
221
+ type: "status";
222
+ }, {
223
+ message: string;
224
+ type: "status";
225
+ }>, z.ZodObject<{
226
+ type: z.ZodLiteral<"result">;
227
+ result: z.ZodObject<{
228
+ status: z.ZodEnum<["done", "blocked", "failed"]>;
229
+ summary: z.ZodString;
230
+ filesChanged: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
231
+ patchRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
232
+ id: z.ZodString;
233
+ kind: z.ZodEnum<["brief", "prd_lite", "execution_graph", "risk_review", "acceptance_criteria", "diff", "review_verdict", "test_result", "debug_export"]>;
234
+ path: z.ZodOptional<z.ZodString>;
235
+ uri: z.ZodOptional<z.ZodString>;
236
+ title: z.ZodString;
237
+ sha256: z.ZodOptional<z.ZodString>;
238
+ createdAt: z.ZodString;
239
+ }, "strip", z.ZodTypeAny, {
240
+ id: string;
241
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
242
+ title: string;
243
+ createdAt: string;
244
+ path?: string | undefined;
245
+ uri?: string | undefined;
246
+ sha256?: string | undefined;
247
+ }, {
248
+ id: string;
249
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
250
+ title: string;
251
+ createdAt: string;
252
+ path?: string | undefined;
253
+ uri?: string | undefined;
254
+ sha256?: string | undefined;
255
+ }>, "many">>;
256
+ testsRun: z.ZodDefault<z.ZodArray<z.ZodObject<{
257
+ command: z.ZodString;
258
+ status: z.ZodEnum<["passed", "failed", "skipped"]>;
259
+ durationMs: z.ZodOptional<z.ZodNumber>;
260
+ outputRef: z.ZodOptional<z.ZodString>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ status: "failed" | "passed" | "skipped";
263
+ command: string;
264
+ durationMs?: number | undefined;
265
+ outputRef?: string | undefined;
266
+ }, {
267
+ status: "failed" | "passed" | "skipped";
268
+ command: string;
269
+ durationMs?: number | undefined;
270
+ outputRef?: string | undefined;
271
+ }>, "many">>;
272
+ risks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
273
+ eventRefs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
274
+ }, "strip", z.ZodTypeAny, {
275
+ status: "failed" | "done" | "blocked";
276
+ risks: string[];
277
+ summary: string;
278
+ testsRun: {
279
+ status: "failed" | "passed" | "skipped";
280
+ command: string;
281
+ durationMs?: number | undefined;
282
+ outputRef?: string | undefined;
283
+ }[];
284
+ filesChanged: string[];
285
+ patchRefs: {
286
+ id: string;
287
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
288
+ title: string;
289
+ createdAt: string;
290
+ path?: string | undefined;
291
+ uri?: string | undefined;
292
+ sha256?: string | undefined;
293
+ }[];
294
+ eventRefs: string[];
295
+ }, {
296
+ status: "failed" | "done" | "blocked";
297
+ summary: string;
298
+ risks?: string[] | undefined;
299
+ testsRun?: {
300
+ status: "failed" | "passed" | "skipped";
301
+ command: string;
302
+ durationMs?: number | undefined;
303
+ outputRef?: string | undefined;
304
+ }[] | undefined;
305
+ filesChanged?: string[] | undefined;
306
+ patchRefs?: {
307
+ id: string;
308
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
309
+ title: string;
310
+ createdAt: string;
311
+ path?: string | undefined;
312
+ uri?: string | undefined;
313
+ sha256?: string | undefined;
314
+ }[] | undefined;
315
+ eventRefs?: string[] | undefined;
316
+ }>;
317
+ }, "strip", z.ZodTypeAny, {
318
+ type: "result";
319
+ result: {
320
+ status: "failed" | "done" | "blocked";
321
+ risks: string[];
322
+ summary: string;
323
+ testsRun: {
324
+ status: "failed" | "passed" | "skipped";
325
+ command: string;
326
+ durationMs?: number | undefined;
327
+ outputRef?: string | undefined;
328
+ }[];
329
+ filesChanged: string[];
330
+ patchRefs: {
331
+ id: string;
332
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
333
+ title: string;
334
+ createdAt: string;
335
+ path?: string | undefined;
336
+ uri?: string | undefined;
337
+ sha256?: string | undefined;
338
+ }[];
339
+ eventRefs: string[];
340
+ };
341
+ }, {
342
+ type: "result";
343
+ result: {
344
+ status: "failed" | "done" | "blocked";
345
+ summary: string;
346
+ risks?: string[] | undefined;
347
+ testsRun?: {
348
+ status: "failed" | "passed" | "skipped";
349
+ command: string;
350
+ durationMs?: number | undefined;
351
+ outputRef?: string | undefined;
352
+ }[] | undefined;
353
+ filesChanged?: string[] | undefined;
354
+ patchRefs?: {
355
+ id: string;
356
+ kind: "brief" | "prd_lite" | "execution_graph" | "risk_review" | "acceptance_criteria" | "diff" | "review_verdict" | "test_result" | "debug_export";
357
+ title: string;
358
+ createdAt: string;
359
+ path?: string | undefined;
360
+ uri?: string | undefined;
361
+ sha256?: string | undefined;
362
+ }[] | undefined;
363
+ eventRefs?: string[] | undefined;
364
+ };
365
+ }>]>;
366
+ export type EngineEvent = z.infer<typeof engineEventSchema>;
367
+ export type EngineContext = {
368
+ sessionId: string;
369
+ signal?: AbortSignal;
370
+ };
371
+ export interface EngineAdapter {
372
+ name: string;
373
+ capabilities(): Promise<EngineCapabilities>;
374
+ run(task: EngineTask, ctx: EngineContext): AsyncIterable<EngineEvent>;
375
+ }
376
+ //# sourceMappingURL=engine-adapter.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { artifactRefSchema, testResultSchema } from './agent-contracts.js';
3
+ import { permissionModeSchema } from './permission-rules.js';
4
+ export const engineTaskKindSchema = z.enum(['code', 'explain', 'fix', 'plan', 'build_task']);
5
+ export const budgetLimitSchema = z.object({
6
+ usd: z.number().positive().optional(),
7
+ tokens: z.number().int().positive().optional(),
8
+ });
9
+ export const engineTaskSchema = z.object({
10
+ id: z.string().min(1),
11
+ kind: engineTaskKindSchema,
12
+ prompt: z.string().min(1),
13
+ workspaceRoot: z.string().min(1),
14
+ allowedPaths: z.array(z.string()).default([]),
15
+ deniedPaths: z.array(z.string()).default([]),
16
+ artifacts: z.array(artifactRefSchema).default([]),
17
+ executionGraphNodeId: z.string().min(1).optional(),
18
+ permissionMode: permissionModeSchema,
19
+ budget: budgetLimitSchema.optional(),
20
+ });
21
+ export const engineResultSchema = z.object({
22
+ status: z.enum(['done', 'blocked', 'failed']),
23
+ summary: z.string().min(1),
24
+ filesChanged: z.array(z.string()).default([]),
25
+ patchRefs: z.array(artifactRefSchema).default([]),
26
+ testsRun: z.array(testResultSchema).default([]),
27
+ risks: z.array(z.string()).default([]),
28
+ eventRefs: z.array(z.string()).default([]),
29
+ });
30
+ export const engineCapabilitiesSchema = z.object({
31
+ supportsStreaming: z.boolean(),
32
+ supportsFileEdits: z.boolean(),
33
+ supportsShell: z.boolean(),
34
+ supportsLsp: z.boolean(),
35
+ supportsSubagents: z.boolean(),
36
+ });
37
+ export const engineEventSchema = z.discriminatedUnion('type', [
38
+ z.object({
39
+ type: z.literal('status'),
40
+ message: z.string().min(1),
41
+ }),
42
+ z.object({
43
+ type: z.literal('result'),
44
+ result: engineResultSchema,
45
+ }),
46
+ ]);
47
+ //# sourceMappingURL=engine-adapter.js.map