@wular/coder 0.2.12 → 0.3.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.
package/dist/sdk.d.ts ADDED
@@ -0,0 +1,734 @@
1
+ import {
2
+ C as Job,
3
+ E as CustomModelConfig,
4
+ S as Availability,
5
+ T as CoderConfig,
6
+ _ as FlowStep,
7
+ a as JobLogEntry,
8
+ c as StopSummary,
9
+ g as FlowRecord,
10
+ h as FlowEvent,
11
+ i as TaskResult,
12
+ m as DiscoveredFlow,
13
+ n as flowSdk,
14
+ o as RunOptions,
15
+ r as CoderError,
16
+ s as RunSummary,
17
+ w as TurnResult,
18
+ x as Approval,
19
+ } from './index-CUy_WPvw.js';
20
+ //#region src/lib/codex-core.d.ts
21
+ declare function getCodexAvailability(cwd: string): Availability;
22
+ //#endregion
23
+ //#region src/lib/plugins.d.ts
24
+ /** Result of a plugin install/refresh attempt. */
25
+ interface PluginResult {
26
+ marketplace: string;
27
+ installed: boolean;
28
+ note: string;
29
+ }
30
+ /** Outcome of the codex auto-update check; null when nothing to do. */
31
+ type CodexUpdateResult =
32
+ | {
33
+ updated: true;
34
+ from: string;
35
+ }
36
+ | {
37
+ updated: false;
38
+ from: string;
39
+ note: string;
40
+ }
41
+ | null;
42
+ /** Outcome of an on-demand codex install; null when codex was already present. */
43
+ type CodexInstallResult = {
44
+ installed: boolean;
45
+ note: string;
46
+ } | null;
47
+ declare function ensureCodexInstalled(availability: Availability): CodexInstallResult;
48
+ declare function ensureCodexUpToDate(availability: Availability): CodexUpdateResult;
49
+ //#endregion
50
+ //#region src/cmd/model.d.ts
51
+ interface ProbeResult {
52
+ reachable: boolean;
53
+ modelListed: boolean | null;
54
+ detail: string;
55
+ }
56
+ interface PersistedModel {
57
+ name: string;
58
+ entry: CustomModelConfig;
59
+ file: string;
60
+ probe: ProbeResult;
61
+ codex: ReturnType<typeof getCodexAvailability>;
62
+ install: ReturnType<typeof ensureCodexInstalled>;
63
+ nativeResponses: boolean;
64
+ keyMissing: boolean;
65
+ ready: boolean;
66
+ }
67
+ interface ModelWriteOptions {
68
+ baseUrl?: string;
69
+ model?: string;
70
+ envKey?: string;
71
+ workspace?: boolean;
72
+ }
73
+ //#endregion
74
+ //#region src/cmd/setup-host.d.ts
75
+ interface SetupHostReport {
76
+ codex: {
77
+ available: boolean;
78
+ detail: string;
79
+ auth: string;
80
+ loggedIn: boolean;
81
+ };
82
+ codexUpdate?: ReturnType<typeof ensureCodexUpToDate>;
83
+ claude: {
84
+ available: boolean;
85
+ detail: string;
86
+ auth: string;
87
+ loggedIn: boolean;
88
+ };
89
+ configFile: string;
90
+ runtime: string;
91
+ claudePlugin?: PluginResult;
92
+ agentsSkill?: PluginResult;
93
+ config: CoderConfig;
94
+ ready: boolean;
95
+ }
96
+ //#endregion
97
+ //#region src/cmd/upgrade.d.ts
98
+ interface UpgradeReport {
99
+ cli?: {
100
+ pm: string;
101
+ from: string | null;
102
+ to: string | null;
103
+ changed: boolean;
104
+ };
105
+ claudePlugin?: {
106
+ installed: boolean;
107
+ note: string;
108
+ from: string | null;
109
+ to: string | null;
110
+ };
111
+ agentsSkill?: {
112
+ installed: boolean;
113
+ note: string;
114
+ from: string | null;
115
+ to: string | null;
116
+ };
117
+ }
118
+ //#endregion
119
+ //#region src/cmd/jobs.d.ts
120
+ /** Filters for the task list, mirroring the CLI flags. */
121
+ interface ListOptions {
122
+ running?: boolean;
123
+ stopped?: boolean;
124
+ archived?: boolean;
125
+ /** Narrow to a workspace (matched by git root). */
126
+ dir?: string;
127
+ /** Max rows; 'all' or undefined means no limit. */
128
+ limit?: number | 'all';
129
+ }
130
+ //#endregion
131
+ //#region src/cmd/steer.d.ts
132
+ /** How a steer was applied to a task. */
133
+ type SteerOutcome = 'live' | 'queued' | 'resumed';
134
+ //#endregion
135
+ //#region src/sdk.d.ts
136
+ interface TaskRunOptions {
137
+ agent?: string;
138
+ model?: string;
139
+ effort?: string;
140
+ permissions?: string;
141
+ name?: string;
142
+ system?: string;
143
+ resume?: string;
144
+ cwd?: string;
145
+ }
146
+ /** Run and control coder tasks. Mirrors `coder task`. */
147
+ declare const task: {
148
+ /** Dispatch a task to the agent chain; returns as soon as it is live. */
149
+ run(
150
+ prompt: string,
151
+ opts?: TaskRunOptions,
152
+ ): Promise<{
153
+ taskId: string;
154
+ }>;
155
+ /**
156
+ * A task's result. With `wait`, blocks until the task is terminal (a pending
157
+ * approval throws a CoderError with code 'approval-pending'). `tail` fills
158
+ * `steps` with the last n log entries (default 0: []). Omit the id for the
159
+ * most recent task.
160
+ */
161
+ result(
162
+ id?: string,
163
+ opts?: {
164
+ wait?: boolean;
165
+ tail?: number | 'all';
166
+ cwd?: string;
167
+ },
168
+ ): Promise<TaskResult>;
169
+ /** Recent tasks (mirrors `coder list` / `coder task list`). */
170
+ list(
171
+ opts?: ListOptions & {
172
+ cwd?: string;
173
+ },
174
+ ): Job[];
175
+ /** Steer a follow-up into a task (live, queued, or resumed on its thread). */
176
+ steer(
177
+ id: string,
178
+ text: string,
179
+ opts?: {
180
+ cwd?: string;
181
+ },
182
+ ): Promise<{
183
+ taskId: string;
184
+ steered: SteerOutcome;
185
+ }>;
186
+ /** Stop a running task. */
187
+ stop(
188
+ id: string,
189
+ opts?: {
190
+ cwd?: string;
191
+ },
192
+ ): Promise<{
193
+ taskId: string;
194
+ status: 'cancelled';
195
+ interrupt: string;
196
+ }>;
197
+ /** Archive a task (hide it from the default list). */
198
+ archive(
199
+ id: string,
200
+ opts?: {
201
+ cwd?: string;
202
+ },
203
+ ): {
204
+ taskId: string;
205
+ archived: true;
206
+ };
207
+ /** Delete a task and its engine session from disk. */
208
+ delete(
209
+ id: string,
210
+ opts?: {
211
+ cwd?: string;
212
+ },
213
+ ): {
214
+ taskId: string;
215
+ deleted: boolean;
216
+ };
217
+ /** Answer a pending approval (accept, or `deny`). */
218
+ approve(
219
+ id: string,
220
+ approvalId: string,
221
+ opts?: {
222
+ deny?: boolean;
223
+ cwd?: string;
224
+ },
225
+ ): {
226
+ taskId: string;
227
+ approvalId: string;
228
+ decision: 'accept' | 'decline';
229
+ };
230
+ /** Pending approvals for a task (omit the id for the most recent task). */
231
+ approvals(
232
+ id?: string,
233
+ opts?: {
234
+ cwd?: string;
235
+ },
236
+ ): Approval[];
237
+ /** Follow a task live: an async iterable of progress log entries. `tail` replays only the last n (default 1). */
238
+ stream(
239
+ id?: string,
240
+ opts?: {
241
+ tail?: number | 'all';
242
+ cwd?: string;
243
+ },
244
+ ): AsyncGenerator<JobLogEntry>;
245
+ };
246
+ /** Manage models: custom endpoints, engine aliases, disable toggles. Mirrors `coder model`. */
247
+ declare const model: {
248
+ /** Register a custom OpenAI-compatible endpoint model. */
249
+ add: (
250
+ name: string,
251
+ opts: ModelWriteOptions & {
252
+ cwd?: string;
253
+ },
254
+ ) => Promise<PersistedModel>;
255
+ /** Update fields of a configured model entry. */
256
+ update: (
257
+ name: string,
258
+ opts: ModelWriteOptions & {
259
+ cwd?: string;
260
+ },
261
+ ) => Promise<PersistedModel>;
262
+ /** Remove a configured model entry. */
263
+ remove: (
264
+ name: string,
265
+ opts?: {
266
+ workspace?: boolean;
267
+ cwd?: string;
268
+ },
269
+ ) => {
270
+ removed: string;
271
+ file: string;
272
+ };
273
+ /** Every dispatchable model: built-ins, aliases, custom endpoints. */
274
+ list: (opts?: { cwd?: string }) => Promise<{
275
+ toggles?:
276
+ | {
277
+ name: string;
278
+ disabled: boolean;
279
+ }[]
280
+ | undefined;
281
+ codex: (
282
+ | {
283
+ alias: string;
284
+ model: string;
285
+ builtin: boolean;
286
+ disabled: boolean;
287
+ spec?: undefined;
288
+ overrides?: undefined;
289
+ }
290
+ | {
291
+ alias: string;
292
+ spec: string;
293
+ disabled: boolean;
294
+ }
295
+ )[];
296
+ claude: (
297
+ | {
298
+ alias: string;
299
+ model: string;
300
+ builtin: boolean;
301
+ disabled: boolean;
302
+ spec?: undefined;
303
+ overrides?: undefined;
304
+ }
305
+ | {
306
+ alias: string;
307
+ spec: string;
308
+ disabled: boolean;
309
+ }
310
+ )[];
311
+ custom: {
312
+ probe: ProbeResult;
313
+ baseUrl: string;
314
+ model: string;
315
+ envKey?: string | undefined;
316
+ wireApi?: 'chat' | 'responses' | undefined;
317
+ disabled?: boolean | undefined;
318
+ name: string;
319
+ }[];
320
+ }>;
321
+ /** Alias a name to an engine spec, e.g. alias('fast', 'codex:spark'). */
322
+ alias: (
323
+ name: string,
324
+ spec: string,
325
+ opts?: {
326
+ workspace?: boolean;
327
+ cwd?: string;
328
+ },
329
+ ) => {
330
+ provider: 'codex' | 'claude';
331
+ model: string;
332
+ effort?: 'low' | 'medium' | 'high' | undefined;
333
+ disabled?: boolean | undefined;
334
+ } & {
335
+ alias: string;
336
+ file: string;
337
+ };
338
+ /** Remove a user-defined alias. */
339
+ unalias: (
340
+ name: string,
341
+ opts?: {
342
+ workspace?: boolean;
343
+ cwd?: string;
344
+ },
345
+ ) => {
346
+ unaliased: string;
347
+ file: string;
348
+ };
349
+ /** Disable a model name (built-in, alias, or raw slug) without removing it. */
350
+ disable: (
351
+ name: string,
352
+ opts?: {
353
+ workspace?: boolean;
354
+ cwd?: string;
355
+ },
356
+ ) => {
357
+ name: string;
358
+ disabled: boolean;
359
+ file: string;
360
+ };
361
+ /** Re-enable a disabled model name. */
362
+ enable: (
363
+ name: string,
364
+ opts?: {
365
+ workspace?: boolean;
366
+ cwd?: string;
367
+ },
368
+ ) => {
369
+ name: string;
370
+ disabled: boolean;
371
+ file: string;
372
+ };
373
+ };
374
+ /** Read and write coder configuration. Mirrors `coder config`. */
375
+ declare const config: {
376
+ /** A config value by dotted key (or the whole effective config). */
377
+ get: (
378
+ key?: string,
379
+ opts?: {
380
+ cwd?: string;
381
+ },
382
+ ) => unknown;
383
+ /** Set a config value; `workspace` targets the repo file instead of the user file. */
384
+ set: (
385
+ key: string,
386
+ value: unknown,
387
+ opts?: {
388
+ workspace?: boolean;
389
+ cwd?: string;
390
+ },
391
+ ) => {
392
+ file: string;
393
+ key: string;
394
+ effective: unknown;
395
+ value?: unknown;
396
+ unset?: boolean;
397
+ };
398
+ };
399
+ /** Probe engines, seed the chain, install requested host plugins. */
400
+ declare function setupHost(
401
+ hosts?: string[],
402
+ opts?: {
403
+ cwd?: string;
404
+ },
405
+ ): Promise<SetupHostReport>;
406
+ /** Update the CLI and/or host plugin installs; returns what moved. */
407
+ declare function upgrade(opts?: {
408
+ cliOnly?: boolean;
409
+ pluginsOnly?: boolean;
410
+ }): Promise<UpgradeReport>;
411
+ /** List bundled docs, or return one topic's raw markdown. */
412
+ declare function docs(topic?: string):
413
+ | {
414
+ topics: {
415
+ name: string;
416
+ description: string;
417
+ }[];
418
+ }
419
+ | {
420
+ name: string;
421
+ content: string;
422
+ };
423
+ declare const _default: {
424
+ task: {
425
+ /** Dispatch a task to the agent chain; returns as soon as it is live. */
426
+ run(
427
+ prompt: string,
428
+ opts?: TaskRunOptions,
429
+ ): Promise<{
430
+ taskId: string;
431
+ }>;
432
+ /**
433
+ * A task's result. With `wait`, blocks until the task is terminal (a pending
434
+ * approval throws a CoderError with code 'approval-pending'). `tail` fills
435
+ * `steps` with the last n log entries (default 0: []). Omit the id for the
436
+ * most recent task.
437
+ */
438
+ result(
439
+ id?: string,
440
+ opts?: {
441
+ wait?: boolean;
442
+ tail?: number | 'all';
443
+ cwd?: string;
444
+ },
445
+ ): Promise<TaskResult>;
446
+ /** Recent tasks (mirrors `coder list` / `coder task list`). */
447
+ list(
448
+ opts?: ListOptions & {
449
+ cwd?: string;
450
+ },
451
+ ): Job[];
452
+ /** Steer a follow-up into a task (live, queued, or resumed on its thread). */
453
+ steer(
454
+ id: string,
455
+ text: string,
456
+ opts?: {
457
+ cwd?: string;
458
+ },
459
+ ): Promise<{
460
+ taskId: string;
461
+ steered: SteerOutcome;
462
+ }>;
463
+ /** Stop a running task. */
464
+ stop(
465
+ id: string,
466
+ opts?: {
467
+ cwd?: string;
468
+ },
469
+ ): Promise<{
470
+ taskId: string;
471
+ status: 'cancelled';
472
+ interrupt: string;
473
+ }>;
474
+ /** Archive a task (hide it from the default list). */
475
+ archive(
476
+ id: string,
477
+ opts?: {
478
+ cwd?: string;
479
+ },
480
+ ): {
481
+ taskId: string;
482
+ archived: true;
483
+ };
484
+ /** Delete a task and its engine session from disk. */
485
+ delete(
486
+ id: string,
487
+ opts?: {
488
+ cwd?: string;
489
+ },
490
+ ): {
491
+ taskId: string;
492
+ deleted: boolean;
493
+ };
494
+ /** Answer a pending approval (accept, or `deny`). */
495
+ approve(
496
+ id: string,
497
+ approvalId: string,
498
+ opts?: {
499
+ deny?: boolean;
500
+ cwd?: string;
501
+ },
502
+ ): {
503
+ taskId: string;
504
+ approvalId: string;
505
+ decision: 'accept' | 'decline';
506
+ };
507
+ /** Pending approvals for a task (omit the id for the most recent task). */
508
+ approvals(
509
+ id?: string,
510
+ opts?: {
511
+ cwd?: string;
512
+ },
513
+ ): Approval[];
514
+ /** Follow a task live: an async iterable of progress log entries. `tail` replays only the last n (default 1). */
515
+ stream(
516
+ id?: string,
517
+ opts?: {
518
+ tail?: number | 'all';
519
+ cwd?: string;
520
+ },
521
+ ): AsyncGenerator<JobLogEntry>;
522
+ };
523
+ flow: {
524
+ run(nameOrPath: string, opts?: RunOptions): Promise<RunSummary>;
525
+ list(opts?: { archived?: boolean; limit?: number }): FlowRecord[];
526
+ discover(cwd?: string): DiscoveredFlow[];
527
+ result(
528
+ runId?: string,
529
+ opts?: {
530
+ tail?: number | 'all';
531
+ },
532
+ ):
533
+ | (FlowRecord & {
534
+ steps: FlowStep[];
535
+ })
536
+ | null;
537
+ stream(
538
+ runId?: string,
539
+ opts?: {
540
+ tail?: number | 'all';
541
+ },
542
+ ): AsyncGenerator<FlowEvent>;
543
+ stop(
544
+ runId?: string,
545
+ opts?: {
546
+ keepTasks?: boolean;
547
+ },
548
+ ): Promise<StopSummary>;
549
+ resume(runId?: string, opts?: RunOptions): Promise<RunSummary>;
550
+ archive(runId: string): {
551
+ runId: string;
552
+ archived: true;
553
+ };
554
+ delete(runId: string): {
555
+ runId: string;
556
+ deleted: boolean;
557
+ };
558
+ };
559
+ model: {
560
+ /** Register a custom OpenAI-compatible endpoint model. */
561
+ add: (
562
+ name: string,
563
+ opts: ModelWriteOptions & {
564
+ cwd?: string;
565
+ },
566
+ ) => Promise<PersistedModel>;
567
+ /** Update fields of a configured model entry. */
568
+ update: (
569
+ name: string,
570
+ opts: ModelWriteOptions & {
571
+ cwd?: string;
572
+ },
573
+ ) => Promise<PersistedModel>;
574
+ /** Remove a configured model entry. */
575
+ remove: (
576
+ name: string,
577
+ opts?: {
578
+ workspace?: boolean;
579
+ cwd?: string;
580
+ },
581
+ ) => {
582
+ removed: string;
583
+ file: string;
584
+ };
585
+ /** Every dispatchable model: built-ins, aliases, custom endpoints. */
586
+ list: (opts?: { cwd?: string }) => Promise<{
587
+ toggles?:
588
+ | {
589
+ name: string;
590
+ disabled: boolean;
591
+ }[]
592
+ | undefined;
593
+ codex: (
594
+ | {
595
+ alias: string;
596
+ model: string;
597
+ builtin: boolean;
598
+ disabled: boolean;
599
+ spec?: undefined;
600
+ overrides?: undefined;
601
+ }
602
+ | {
603
+ alias: string;
604
+ spec: string;
605
+ disabled: boolean;
606
+ }
607
+ )[];
608
+ claude: (
609
+ | {
610
+ alias: string;
611
+ model: string;
612
+ builtin: boolean;
613
+ disabled: boolean;
614
+ spec?: undefined;
615
+ overrides?: undefined;
616
+ }
617
+ | {
618
+ alias: string;
619
+ spec: string;
620
+ disabled: boolean;
621
+ }
622
+ )[];
623
+ custom: {
624
+ probe: ProbeResult;
625
+ baseUrl: string;
626
+ model: string;
627
+ envKey?: string | undefined;
628
+ wireApi?: 'chat' | 'responses' | undefined;
629
+ disabled?: boolean | undefined;
630
+ name: string;
631
+ }[];
632
+ }>;
633
+ /** Alias a name to an engine spec, e.g. alias('fast', 'codex:spark'). */
634
+ alias: (
635
+ name: string,
636
+ spec: string,
637
+ opts?: {
638
+ workspace?: boolean;
639
+ cwd?: string;
640
+ },
641
+ ) => {
642
+ provider: 'codex' | 'claude';
643
+ model: string;
644
+ effort?: 'low' | 'medium' | 'high' | undefined;
645
+ disabled?: boolean | undefined;
646
+ } & {
647
+ alias: string;
648
+ file: string;
649
+ };
650
+ /** Remove a user-defined alias. */
651
+ unalias: (
652
+ name: string,
653
+ opts?: {
654
+ workspace?: boolean;
655
+ cwd?: string;
656
+ },
657
+ ) => {
658
+ unaliased: string;
659
+ file: string;
660
+ };
661
+ /** Disable a model name (built-in, alias, or raw slug) without removing it. */
662
+ disable: (
663
+ name: string,
664
+ opts?: {
665
+ workspace?: boolean;
666
+ cwd?: string;
667
+ },
668
+ ) => {
669
+ name: string;
670
+ disabled: boolean;
671
+ file: string;
672
+ };
673
+ /** Re-enable a disabled model name. */
674
+ enable: (
675
+ name: string,
676
+ opts?: {
677
+ workspace?: boolean;
678
+ cwd?: string;
679
+ },
680
+ ) => {
681
+ name: string;
682
+ disabled: boolean;
683
+ file: string;
684
+ };
685
+ };
686
+ config: {
687
+ /** A config value by dotted key (or the whole effective config). */
688
+ get: (
689
+ key?: string,
690
+ opts?: {
691
+ cwd?: string;
692
+ },
693
+ ) => unknown;
694
+ /** Set a config value; `workspace` targets the repo file instead of the user file. */
695
+ set: (
696
+ key: string,
697
+ value: unknown,
698
+ opts?: {
699
+ workspace?: boolean;
700
+ cwd?: string;
701
+ },
702
+ ) => {
703
+ file: string;
704
+ key: string;
705
+ effective: unknown;
706
+ value?: unknown;
707
+ unset?: boolean;
708
+ };
709
+ };
710
+ setupHost: typeof setupHost;
711
+ upgrade: typeof upgrade;
712
+ docs: typeof docs;
713
+ };
714
+ //#endregion
715
+ export {
716
+ type Approval,
717
+ CoderError,
718
+ type FlowEvent,
719
+ type FlowStep,
720
+ type Job,
721
+ type JobLogEntry,
722
+ type SteerOutcome,
723
+ type TaskResult,
724
+ TaskRunOptions,
725
+ type TurnResult,
726
+ config,
727
+ _default as default,
728
+ docs,
729
+ flowSdk as flow,
730
+ model,
731
+ setupHost,
732
+ task,
733
+ upgrade,
734
+ };