@github-tools/sdk 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
- import { J as ToolOverrides, n as createGithubAgent, t as CreateGithubAgentOptions } from "./agents-C6nqZiYp.mjs";
2
- import { ApprovalConfig, GithubToolPreset, GithubTools, GithubToolsOptions, GithubWriteToolName, createGithubTools } from "./index.mjs";
3
- import * as ai from "ai";
1
+ import { $ as CommitToolOptions, Q as CommitIdentity, a as GithubWriteToolName, c as createGithubAgent, i as GithubToolsOptions, n as GithubToolPreset, nt as ToolOverrides, o as createGithubTools, r as GithubTools, s as CreateGithubAgentOptions, t as ApprovalConfig } from "./index-ikP-LT-3.mjs";
2
+ import * as _$ai from "ai";
4
3
  import { FinishReason, LanguageModelResponseMetadata, LanguageModelUsage, ModelMessage, StepResult, StopCondition, ToolSet } from "ai";
5
4
  import { CompatibleLanguageModel, DurableAgentOptions, DurableAgentStreamOptions, DurableAgentStreamResult } from "@workflow/ai/agent";
6
5
 
@@ -86,6 +85,21 @@ type CreateDurableGithubAgentOptions = Omit<DurableAgentOptions, 'model' | 'tool
86
85
  requireApproval?: ApprovalConfig;
87
86
  instructions?: string;
88
87
  additionalInstructions?: string;
88
+ /**
89
+ * Default author for commit-creating tools.
90
+ * Falls back to the authenticated user when omitted.
91
+ */
92
+ author?: CommitIdentity;
93
+ /**
94
+ * Default committer for commit-creating tools.
95
+ * Falls back to the authenticated user when omitted.
96
+ */
97
+ committer?: CommitIdentity;
98
+ /**
99
+ * Co-authors to attribute on all commits.
100
+ * Added as "Co-authored-by" trailers to commit messages.
101
+ */
102
+ coAuthors?: CommitIdentity[];
89
103
  };
90
104
  /**
91
105
  * Create a pre-configured durable GitHub agent powered by Vercel Workflow SDK's `DurableAgent`.
@@ -140,9 +154,12 @@ declare function createDurableGithubAgent({
140
154
  requireApproval,
141
155
  instructions,
142
156
  additionalInstructions,
157
+ author,
158
+ committer,
159
+ coAuthors,
143
160
  ...agentOptions
144
161
  }: CreateDurableGithubAgentOptions): DurableGithubAgent<Partial<{
145
- getRepository: ai.Tool<{
162
+ getRepository: _$ai.Tool<{
146
163
  owner: string;
147
164
  repo: string;
148
165
  }, {
@@ -159,7 +176,7 @@ declare function createDurableGithubAgent({
159
176
  createdAt: string;
160
177
  updatedAt: string;
161
178
  }>;
162
- listBranches: ai.Tool<{
179
+ listBranches: _$ai.Tool<{
163
180
  owner: string;
164
181
  repo: string;
165
182
  perPage: number;
@@ -168,7 +185,7 @@ declare function createDurableGithubAgent({
168
185
  sha: string;
169
186
  protected: boolean;
170
187
  }[]>;
171
- getFileContent: ai.Tool<{
188
+ getFileContent: _$ai.Tool<{
172
189
  owner: string;
173
190
  repo: string;
174
191
  path: string;
@@ -199,7 +216,7 @@ declare function createDurableGithubAgent({
199
216
  content: string;
200
217
  entries?: undefined;
201
218
  }>;
202
- listPullRequests: ai.Tool<{
219
+ listPullRequests: _$ai.Tool<{
203
220
  owner: string;
204
221
  repo: string;
205
222
  state: "open" | "closed" | "all";
@@ -216,7 +233,7 @@ declare function createDurableGithubAgent({
216
233
  createdAt: string;
217
234
  updatedAt: string;
218
235
  }[]>;
219
- getPullRequest: ai.Tool<{
236
+ getPullRequest: _$ai.Tool<{
220
237
  owner: string;
221
238
  repo: string;
222
239
  pullNumber: number;
@@ -239,7 +256,7 @@ declare function createDurableGithubAgent({
239
256
  updatedAt: string;
240
257
  mergedAt: string | null;
241
258
  }>;
242
- listIssues: ai.Tool<{
259
+ listIssues: _$ai.Tool<{
243
260
  owner: string;
244
261
  repo: string;
245
262
  state: "open" | "closed" | "all";
@@ -255,7 +272,7 @@ declare function createDurableGithubAgent({
255
272
  createdAt: string;
256
273
  updatedAt: string;
257
274
  }[]>;
258
- getIssue: ai.Tool<{
275
+ getIssue: _$ai.Tool<{
259
276
  owner: string;
260
277
  repo: string;
261
278
  issueNumber: number;
@@ -273,7 +290,7 @@ declare function createDurableGithubAgent({
273
290
  updatedAt: string;
274
291
  closedAt: string | null;
275
292
  }>;
276
- searchCode: ai.Tool<{
293
+ searchCode: _$ai.Tool<{
277
294
  query: string;
278
295
  perPage: number;
279
296
  }, {
@@ -286,7 +303,7 @@ declare function createDurableGithubAgent({
286
303
  sha: string;
287
304
  }[];
288
305
  }>;
289
- searchRepositories: ai.Tool<{
306
+ searchRepositories: _$ai.Tool<{
290
307
  query: string;
291
308
  perPage: number;
292
309
  order: "asc" | "desc";
@@ -304,7 +321,7 @@ declare function createDurableGithubAgent({
304
321
  topics: string[] | undefined;
305
322
  }[];
306
323
  }>;
307
- listCommits: ai.Tool<{
324
+ listCommits: _$ai.Tool<{
308
325
  owner: string;
309
326
  repo: string;
310
327
  perPage: number;
@@ -321,7 +338,7 @@ declare function createDurableGithubAgent({
321
338
  date: string | undefined;
322
339
  url: string;
323
340
  }[]>;
324
- getCommit: ai.Tool<{
341
+ getCommit: _$ai.Tool<{
325
342
  owner: string;
326
343
  repo: string;
327
344
  ref: string;
@@ -345,7 +362,7 @@ declare function createDurableGithubAgent({
345
362
  patch: string | undefined;
346
363
  }[] | undefined;
347
364
  }>;
348
- getBlame: ai.Tool<{
365
+ getBlame: _$ai.Tool<{
349
366
  owner: string;
350
367
  repo: string;
351
368
  path: string;
@@ -382,7 +399,7 @@ declare function createDurableGithubAgent({
382
399
  }[];
383
400
  error?: undefined;
384
401
  }>;
385
- createBranch: ai.Tool<{
402
+ createBranch: _$ai.Tool<{
386
403
  owner: string;
387
404
  repo: string;
388
405
  branch: string;
@@ -392,7 +409,7 @@ declare function createDurableGithubAgent({
392
409
  sha: string;
393
410
  url: string;
394
411
  }>;
395
- forkRepository: ai.Tool<{
412
+ forkRepository: _$ai.Tool<{
396
413
  owner: string;
397
414
  repo: string;
398
415
  organization?: string | undefined;
@@ -410,7 +427,7 @@ declare function createDurableGithubAgent({
410
427
  url: string;
411
428
  } | null;
412
429
  }>;
413
- createRepository: ai.Tool<{
430
+ createRepository: _$ai.Tool<{
414
431
  name: string;
415
432
  isPrivate: boolean;
416
433
  autoInit: boolean;
@@ -429,7 +446,7 @@ declare function createDurableGithubAgent({
429
446
  private: boolean;
430
447
  createdAt: string;
431
448
  }>;
432
- createOrUpdateFile: ai.Tool<{
449
+ createOrUpdateFile: _$ai.Tool<{
433
450
  owner: string;
434
451
  repo: string;
435
452
  path: string;
@@ -443,7 +460,7 @@ declare function createDurableGithubAgent({
443
460
  commitSha: string | undefined;
444
461
  commitUrl: string | undefined;
445
462
  }>;
446
- createPullRequest: ai.Tool<{
463
+ createPullRequest: _$ai.Tool<{
447
464
  owner: string;
448
465
  repo: string;
449
466
  title: string;
@@ -460,7 +477,7 @@ declare function createDurableGithubAgent({
460
477
  branch: string;
461
478
  base: string;
462
479
  }>;
463
- mergePullRequest: ai.Tool<{
480
+ mergePullRequest: _$ai.Tool<{
464
481
  owner: string;
465
482
  repo: string;
466
483
  pullNumber: number;
@@ -472,7 +489,7 @@ declare function createDurableGithubAgent({
472
489
  message: string;
473
490
  sha: string;
474
491
  }>;
475
- addPullRequestComment: ai.Tool<{
492
+ addPullRequestComment: _$ai.Tool<{
476
493
  owner: string;
477
494
  repo: string;
478
495
  pullNumber: number;
@@ -484,7 +501,7 @@ declare function createDurableGithubAgent({
484
501
  author: string | undefined;
485
502
  createdAt: string;
486
503
  }>;
487
- listPullRequestFiles: ai.Tool<{
504
+ listPullRequestFiles: _$ai.Tool<{
488
505
  owner: string;
489
506
  repo: string;
490
507
  pullNumber: number;
@@ -498,7 +515,7 @@ declare function createDurableGithubAgent({
498
515
  changes: number;
499
516
  patch: string | undefined;
500
517
  }[]>;
501
- listPullRequestReviews: ai.Tool<{
518
+ listPullRequestReviews: _$ai.Tool<{
502
519
  owner: string;
503
520
  repo: string;
504
521
  pullNumber: number;
@@ -512,7 +529,7 @@ declare function createDurableGithubAgent({
512
529
  url: string;
513
530
  submittedAt: string | undefined;
514
531
  }[]>;
515
- createPullRequestReview: ai.Tool<{
532
+ createPullRequestReview: _$ai.Tool<{
516
533
  owner: string;
517
534
  repo: string;
518
535
  pullNumber: number;
@@ -532,7 +549,7 @@ declare function createDurableGithubAgent({
532
549
  author: string | undefined;
533
550
  submittedAt: string | undefined;
534
551
  }>;
535
- createIssue: ai.Tool<{
552
+ createIssue: _$ai.Tool<{
536
553
  owner: string;
537
554
  repo: string;
538
555
  title: string;
@@ -546,7 +563,7 @@ declare function createDurableGithubAgent({
546
563
  state: string;
547
564
  labels: (string | undefined)[];
548
565
  }>;
549
- addIssueComment: ai.Tool<{
566
+ addIssueComment: _$ai.Tool<{
550
567
  owner: string;
551
568
  repo: string;
552
569
  issueNumber: number;
@@ -558,7 +575,7 @@ declare function createDurableGithubAgent({
558
575
  author: string | undefined;
559
576
  createdAt: string;
560
577
  }>;
561
- closeIssue: ai.Tool<{
578
+ closeIssue: _$ai.Tool<{
562
579
  owner: string;
563
580
  repo: string;
564
581
  issueNumber: number;
@@ -570,7 +587,7 @@ declare function createDurableGithubAgent({
570
587
  url: string;
571
588
  closedAt: string | null;
572
589
  }>;
573
- listLabels: ai.Tool<{
590
+ listLabels: _$ai.Tool<{
574
591
  owner: string;
575
592
  repo: string;
576
593
  perPage: number;
@@ -580,7 +597,7 @@ declare function createDurableGithubAgent({
580
597
  color: string;
581
598
  description: string | null;
582
599
  }[]>;
583
- addLabels: ai.Tool<{
600
+ addLabels: _$ai.Tool<{
584
601
  owner: string;
585
602
  repo: string;
586
603
  issueNumber: number;
@@ -590,7 +607,7 @@ declare function createDurableGithubAgent({
590
607
  color: string;
591
608
  description: string | null;
592
609
  }[]>;
593
- removeLabel: ai.Tool<{
610
+ removeLabel: _$ai.Tool<{
594
611
  owner: string;
595
612
  repo: string;
596
613
  issueNumber: number;
@@ -600,7 +617,7 @@ declare function createDurableGithubAgent({
600
617
  label: string;
601
618
  issueNumber: number;
602
619
  }>;
603
- listGists: ai.Tool<{
620
+ listGists: _$ai.Tool<{
604
621
  perPage: number;
605
622
  page: number;
606
623
  username?: string | undefined;
@@ -615,7 +632,7 @@ declare function createDurableGithubAgent({
615
632
  createdAt: string;
616
633
  updatedAt: string;
617
634
  }[]>;
618
- getGist: ai.Tool<{
635
+ getGist: _$ai.Tool<{
619
636
  gistId: string;
620
637
  }, {
621
638
  id: string | undefined;
@@ -633,7 +650,7 @@ declare function createDurableGithubAgent({
633
650
  createdAt: string | undefined;
634
651
  updatedAt: string | undefined;
635
652
  }>;
636
- listGistComments: ai.Tool<{
653
+ listGistComments: _$ai.Tool<{
637
654
  gistId: string;
638
655
  perPage: number;
639
656
  page: number;
@@ -645,7 +662,7 @@ declare function createDurableGithubAgent({
645
662
  createdAt: string;
646
663
  updatedAt: string;
647
664
  }[]>;
648
- createGist: ai.Tool<{
665
+ createGist: _$ai.Tool<{
649
666
  files: Record<string, {
650
667
  content: string;
651
668
  }>;
@@ -659,7 +676,7 @@ declare function createDurableGithubAgent({
659
676
  files: string[];
660
677
  owner: string | undefined;
661
678
  }>;
662
- updateGist: ai.Tool<{
679
+ updateGist: _$ai.Tool<{
663
680
  gistId: string;
664
681
  description?: string | undefined;
665
682
  files?: Record<string, {
@@ -672,13 +689,13 @@ declare function createDurableGithubAgent({
672
689
  url: string | undefined;
673
690
  files: string[];
674
691
  }>;
675
- deleteGist: ai.Tool<{
692
+ deleteGist: _$ai.Tool<{
676
693
  gistId: string;
677
694
  }, {
678
695
  deleted: boolean;
679
696
  gistId: string;
680
697
  }>;
681
- createGistComment: ai.Tool<{
698
+ createGistComment: _$ai.Tool<{
682
699
  gistId: string;
683
700
  body: string;
684
701
  }, {
@@ -688,7 +705,7 @@ declare function createDurableGithubAgent({
688
705
  author: string | undefined;
689
706
  createdAt: string;
690
707
  }>;
691
- listWorkflows: ai.Tool<{
708
+ listWorkflows: _$ai.Tool<{
692
709
  owner: string;
693
710
  repo: string;
694
711
  perPage: number;
@@ -705,7 +722,7 @@ declare function createDurableGithubAgent({
705
722
  updatedAt: string;
706
723
  }[];
707
724
  }>;
708
- listWorkflowRuns: ai.Tool<{
725
+ listWorkflowRuns: _$ai.Tool<{
709
726
  owner: string;
710
727
  repo: string;
711
728
  perPage: number;
@@ -731,7 +748,7 @@ declare function createDurableGithubAgent({
731
748
  runAttempt: number | undefined;
732
749
  }[];
733
750
  }>;
734
- getWorkflowRun: ai.Tool<{
751
+ getWorkflowRun: _$ai.Tool<{
735
752
  owner: string;
736
753
  repo: string;
737
754
  runId: number;
@@ -751,7 +768,7 @@ declare function createDurableGithubAgent({
751
768
  updatedAt: string;
752
769
  runStartedAt: string | undefined;
753
770
  }>;
754
- listWorkflowJobs: ai.Tool<{
771
+ listWorkflowJobs: _$ai.Tool<{
755
772
  owner: string;
756
773
  repo: string;
757
774
  runId: number;
@@ -779,7 +796,7 @@ declare function createDurableGithubAgent({
779
796
  }[] | undefined;
780
797
  }[];
781
798
  }>;
782
- triggerWorkflow: ai.Tool<{
799
+ triggerWorkflow: _$ai.Tool<{
783
800
  owner: string;
784
801
  repo: string;
785
802
  workflowId: string | number;
@@ -790,7 +807,7 @@ declare function createDurableGithubAgent({
790
807
  workflowId: string | number;
791
808
  ref: string;
792
809
  }>;
793
- cancelWorkflowRun: ai.Tool<{
810
+ cancelWorkflowRun: _$ai.Tool<{
794
811
  owner: string;
795
812
  repo: string;
796
813
  runId: number;
@@ -798,7 +815,7 @@ declare function createDurableGithubAgent({
798
815
  cancelled: boolean;
799
816
  runId: number;
800
817
  }>;
801
- rerunWorkflowRun: ai.Tool<{
818
+ rerunWorkflowRun: _$ai.Tool<{
802
819
  owner: string;
803
820
  repo: string;
804
821
  runId: number;
@@ -810,5 +827,5 @@ declare function createDurableGithubAgent({
810
827
  }>;
811
828
  }>>;
812
829
  //#endregion
813
- export { type ApprovalConfig, CreateDurableGithubAgentOptions, type CreateGithubAgentOptions, DurableGithubAgent, DurableGithubAgentGenerateResult, type GithubToolPreset, type GithubTools, type GithubToolsOptions, type GithubWriteToolName, type ToolOverrides, createDurableGithubAgent, createGithubAgent, createGithubTools };
830
+ export { type ApprovalConfig, type CommitIdentity, type CommitToolOptions, CreateDurableGithubAgentOptions, type CreateGithubAgentOptions, DurableGithubAgent, DurableGithubAgentGenerateResult, type GithubToolPreset, type GithubTools, type GithubToolsOptions, type GithubWriteToolName, type ToolOverrides, createDurableGithubAgent, createGithubAgent, createGithubTools };
814
831
  //# sourceMappingURL=workflow.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.mts","names":[],"sources":["../src/workflow.ts"],"mappings":";;;;;;;;;;UAUiB,gCAAA,gBAAgD,OAAA,GAAU,OAAA;EACzE,IAAA;EACA,YAAA,EAAc,YAAA;EACd,KAAA,EAAO,kBAAA;EACP,KAAA,EAAO,UAAA,CAAW,MAAA;EAClB,QAAA,EAAU,6BAAA;IAAkC,QAAA,EAAU,YAAA;EAAA;AAAA;;;;;;;;;;;cAa3C,kBAAA,gBAAkC,OAAA,GAAU,OAAA;EAAA,QAC/C,KAAA;EAAA,QACA,MAAA;EAAA,QACA,aAAA;EAAA,QACA,UAAA;EAAA,QACA,MAAA;cAEI,OAAA,EAAS,mBAAA,CAAoB,MAAA;EApB/B;EAAA,IA6BN,KAAA,CAAA,GAAS,MAAA;EA7ByC;;;AAaxD;EAwBE,MAAA,sBAA4B,MAAA,GAAS,MAAA,yCAAA,CACnC,OAAA,EAAS,yBAAA,CAA0B,YAAA,EAAc,MAAA,EAAQ,cAAA,IACxD,OAAA,CAAQ,wBAAA,CAAyB,YAAA,EAAc,MAAA;EA1BrB;;;;;;;;;;;;;;;;;;;;EAkDvB,QAAA,CAAA;IAAW,MAAA;IAAQ;EAAA;IAAc,MAAA;IAAgB,QAAA,GAAW,aAAA,CAAc,MAAA,IAAU,KAAA,CAAM,aAAA,CAAc,MAAA;EAAA,IAAa,OAAA,CAAQ,gCAAA,CAAiC,MAAA;AAAA;;;;;;;KAoC1J,+BAAA,GACV,IAAA,CAAK,mBAAA;EACH,KAAA,WAAgB,uBAAA,UAAiC,OAAA,CAAQ,uBAAA;EArFnD;;;;EA0FN,KAAA;EACA,MAAA,GAAS,gBAAA,GAAmB,gBAAA;EAC5B,eAAA,GAAkB,cAAA;EAClB,YAAA;EACA,sBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAXJ;;;;;;;;;;;;;;;iBA4DgB,wBAAA,CAAA;EACd,KAAA;EACA,KAAA;EACA,MAAA;EACA,eAAA;EACA,YAAA;EACA,sBAAA;EAAA,GACG;AAAA,GACF,+BAAA,GAA+B,kBAAA,CAAA,OAAA;iBAAA,EAAA,CAAA,IAAA"}
1
+ {"version":3,"file":"workflow.d.mts","names":[],"sources":["../src/workflow.ts"],"mappings":";;;;;;;;AAWA;UAAiB,gCAAA,gBAAgD,OAAA,GAAU,OAAA;EACzE,IAAA;EACA,YAAA,EAAc,YAAA;EACd,KAAA,EAAO,kBAAA;EACP,KAAA,EAAO,UAAA,CAAW,MAAA;EAClB,QAAA,EAAU,6BAAA;IAAkC,QAAA,EAAU,YAAA;EAAA;AAAA;;;;;;;;;;;cAa3C,kBAAA,gBAAkC,OAAA,GAAU,OAAA;EAAA,QAC/C,KAAA;EAAA,QACA,MAAA;EAAA,QACA,aAAA;EAAA,QACA,UAAA;EAAA,QACA,MAAA;cAEI,OAAA,EAAS,mBAAA,CAAoB,MAAA;EApBa;EAAA,IA6BlD,KAAA,CAAA,GAAS,MAAA;EA7BqD;AAapE;;;EAwBE,MAAA,sBAA4B,MAAA,GAAS,MAAA,yCAAA,CACnC,OAAA,EAAS,yBAAA,CAA0B,YAAA,EAAc,MAAA,EAAQ,cAAA,IACxD,OAAA,CAAQ,wBAAA,CAAyB,YAAA,EAAc,MAAA;EA1BK;;;;;;;;;;;;;;;;;;;;EAkDjD,QAAA,CAAA;IAAW,MAAA;IAAQ;EAAA;IAAc,MAAA;IAAgB,QAAA,GAAW,aAAA,CAAc,MAAA,IAAU,KAAA,CAAM,aAAA,CAAc,MAAA;EAAA,IAAa,OAAA,CAAQ,gCAAA,CAAiC,MAAA;AAAA;;;;;;;KAoC1J,+BAAA,GACV,IAAA,CAAK,mBAAA;EACH,KAAA,WAAgB,uBAAA,UAAiC,OAAA,CAAQ,uBAAA;EAnFnD;;;;EAwFN,KAAA;EACA,MAAA,GAAS,gBAAA,GAAmB,gBAAA;EAC5B,eAAA,GAAkB,cAAA;EAClB,YAAA;EACA,sBAAA;EAzE0B;;;;EA8E1B,MAAA,GAAS,cAAA;EA7E0B;;;;EAkFnC,SAAA,GAAY,cAAA;EAjFH;;;;EAsFT,SAAA,GAAY,cAAA;AAAA;;;;;;;;;;;;;;;AA1BhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2EgB,wBAAA,CAAA;EACd,KAAA;EACA,KAAA;EACA,MAAA;EACA,eAAA;EACA,YAAA;EACA,sBAAA;EACA,MAAA;EACA,SAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,+BAAA,GAA+B,kBAAA,CAAA,OAAA;iBAAA,IAAA,CAAA,IAAA"}
package/dist/workflow.mjs CHANGED
@@ -1,7 +1,5 @@
1
- import { n as resolveInstructions, t as createGithubAgent } from "./agents-D9aKsd_7.mjs";
2
- import { createGithubTools } from "./index.mjs";
1
+ import { n as createGithubAgent, r as resolveInstructions, t as createGithubTools } from "./src--pAdGYqY.mjs";
3
2
  import { DurableAgent } from "@workflow/ai/agent";
4
-
5
3
  //#region src/workflow.ts
6
4
  /**
7
5
  * A wrapper around the Workflow SDK's `DurableAgent` that adds a non-streaming
@@ -124,11 +122,14 @@ var DurableGithubAgent = class {
124
122
  * }
125
123
  * ```
126
124
  */
127
- function createDurableGithubAgent({ model, token, preset, requireApproval, instructions, additionalInstructions, ...agentOptions }) {
125
+ function createDurableGithubAgent({ model, token, preset, requireApproval, instructions, additionalInstructions, author, committer, coAuthors, ...agentOptions }) {
128
126
  const tools = createGithubTools({
129
127
  token,
130
128
  requireApproval,
131
- preset
129
+ preset,
130
+ author,
131
+ committer,
132
+ coAuthors
132
133
  });
133
134
  const resolvedModel = typeof model === "string" || typeof model === "function" ? model : () => Promise.resolve(model);
134
135
  return new DurableGithubAgent({
@@ -142,7 +143,7 @@ function createDurableGithubAgent({ model, token, preset, requireApproval, instr
142
143
  })
143
144
  });
144
145
  }
145
-
146
146
  //#endregion
147
147
  export { DurableGithubAgent, createDurableGithubAgent, createGithubAgent, createGithubTools };
148
+
148
149
  //# sourceMappingURL=workflow.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.mjs","names":[],"sources":["../src/workflow.ts"],"sourcesContent":["import { DurableAgent } from '@workflow/ai/agent'\nimport type { CompatibleLanguageModel, DurableAgentOptions, DurableAgentStreamOptions, DurableAgentStreamResult, TelemetrySettings } from '@workflow/ai/agent'\nimport type { ToolSet, StepResult, FinishReason, LanguageModelUsage, LanguageModelResponseMetadata, ModelMessage, StopCondition } from 'ai'\nimport { createGithubTools } from './index'\nimport { resolveInstructions } from './agents'\nimport type { GithubToolPreset, ApprovalConfig } from './index'\n\n/**\n * Result of {@link DurableGithubAgent.generate}.\n */\nexport interface DurableGithubAgentGenerateResult<TTools extends ToolSet = ToolSet> {\n text: string\n finishReason: FinishReason\n usage: LanguageModelUsage\n steps: StepResult<TTools>[]\n response: LanguageModelResponseMetadata & { messages: ModelMessage[] }\n}\n\n/**\n * A wrapper around the Workflow SDK's `DurableAgent` that adds a non-streaming\n * `.generate()` method alongside the existing `.stream()`.\n *\n * - `.stream()` — delegates to `DurableAgent.stream()`, each tool call is\n * an individually retriable workflow step. Works in workflow context.\n * - `.generate()` — uses `generateText` from the AI SDK for non-streaming\n * execution. Must be called from within a `\"use step\"` function in\n * workflow context (the Workflow runtime blocks raw I/O in workflow scope).\n */\nexport class DurableGithubAgent<TTools extends ToolSet = ToolSet> {\n private agent: DurableAgent<TTools>\n private _model: DurableAgentOptions<TTools>['model']\n private _instructions?: DurableAgentOptions<TTools>['instructions']\n private _telemetry?: TelemetrySettings\n private _tools: TTools\n\n constructor(options: DurableAgentOptions<TTools>) {\n this.agent = new DurableAgent(options)\n this._model = options.model\n this._instructions = options.instructions\n this._telemetry = options.experimental_telemetry\n this._tools = options.tools ?? {} as TTools\n }\n\n /** The tool set configured for this agent. */\n get tools(): TTools {\n return this.agent.tools\n }\n\n /**\n * Stream the agent's response. Delegates directly to `DurableAgent.stream()`.\n * Works in workflow context — each tool call is a durable step.\n */\n stream<TStreamTools extends TTools = TTools, OUTPUT = never, PARTIAL_OUTPUT = never>(\n options: DurableAgentStreamOptions<TStreamTools, OUTPUT, PARTIAL_OUTPUT>,\n ): Promise<DurableAgentStreamResult<TStreamTools, OUTPUT>> {\n return this.agent.stream(options)\n }\n\n /**\n * Generate a non-streaming response using `generateText` from the AI SDK.\n *\n * In workflow context this **must** be called from within a `\"use step\"`\n * function, because the Workflow runtime blocks direct I/O (HTTP calls)\n * at the workflow scope level.\n *\n * @example\n * ```ts\n * async function agentTurn(prompt: string) {\n * \"use step\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * preset: 'code-review',\n * })\n * const { text } = await agent.generate({ prompt })\n * return text\n * }\n * ```\n */\n async generate({ prompt, stopWhen }: { prompt: string, stopWhen?: StopCondition<TTools> | Array<StopCondition<TTools>> }): Promise<DurableGithubAgentGenerateResult<TTools>> {\n const { generateText } = await import('ai')\n\n const model = typeof this._model === 'function'\n ? await this._model()\n : this._model\n\n const system = typeof this._instructions === 'string'\n ? this._instructions\n : undefined\n\n const result = await generateText({\n model: model as Parameters<typeof generateText>[0]['model'],\n tools: this._tools,\n system,\n prompt,\n stopWhen,\n experimental_telemetry: this._telemetry as Parameters<typeof generateText>[0]['experimental_telemetry'],\n })\n\n return {\n text: result.text,\n finishReason: result.finishReason,\n usage: result.usage,\n steps: result.steps as StepResult<TTools>[],\n response: result.response,\n }\n }\n}\n\n/**\n * Options for creating a durable GitHub agent via {@link createDurableGithubAgent}.\n *\n * Extends all `DurableAgentOptions` (temperature, telemetry, callbacks, etc.)\n * and adds GitHub-specific fields (token, preset, approval config).\n */\nexport type CreateDurableGithubAgentOptions =\n Omit<DurableAgentOptions, 'model' | 'tools' | 'instructions'> & {\n model: string | CompatibleLanguageModel | (() => Promise<CompatibleLanguageModel>)\n /**\n * GitHub personal access token.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: string\n preset?: GithubToolPreset | GithubToolPreset[]\n requireApproval?: ApprovalConfig\n instructions?: string\n additionalInstructions?: string\n }\n\n/**\n * Create a pre-configured durable GitHub agent powered by Vercel Workflow SDK's `DurableAgent`.\n *\n * Returns a {@link DurableGithubAgent} with two interaction modes:\n *\n * - `.stream()` — works directly in workflow scope; each tool call is a durable step.\n * - `.generate()` — uses `generateText` from the AI SDK; must be called from\n * within a `\"use step\"` function when running inside a workflow.\n *\n * **Note:** `requireApproval` is accepted for forward-compatibility but is currently\n * ignored by `DurableAgent` — the Workflow SDK does not yet support interactive tool\n * approval. All tools execute immediately without user confirmation.\n *\n * @example Streaming (chat UI — works in workflow scope)\n * ```ts\n * import { createDurableGithubAgent } from '@github-tools/sdk/workflow'\n * import { getWritable } from 'workflow'\n * import type { ModelMessage, UIMessageChunk } from 'ai'\n *\n * async function chatWorkflow(messages: ModelMessage[], token: string) {\n * \"use workflow\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * token,\n * preset: 'code-review',\n * })\n * const writable = getWritable<UIMessageChunk>()\n * await agent.stream({ messages, writable })\n * }\n * ```\n *\n * @example Non-streaming (bot / background job — needs \"use step\")\n * ```ts\n * import { createDurableGithubAgent } from '@github-tools/sdk/workflow'\n *\n * async function agentTurn(prompt: string) {\n * \"use step\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * preset: 'code-review',\n * })\n * const { text } = await agent.generate({ prompt })\n * return text\n * }\n * ```\n */\nexport function createDurableGithubAgent({\n model,\n token,\n preset,\n requireApproval,\n instructions,\n additionalInstructions,\n ...agentOptions\n}: CreateDurableGithubAgentOptions) {\n const tools = createGithubTools({ token, requireApproval, preset })\n\n const resolvedModel = typeof model === 'string' || typeof model === 'function'\n ? model\n : () => Promise.resolve(model)\n\n return new DurableGithubAgent({\n ...agentOptions as Omit<typeof agentOptions, 'toolChoice'>,\n model: resolvedModel,\n tools,\n instructions: resolveInstructions({ preset, instructions, additionalInstructions }),\n })\n}\n\nexport { createGithubTools, createGithubAgent } from './index'\nexport type { GithubTools, GithubToolsOptions, GithubToolPreset, GithubWriteToolName, ApprovalConfig, ToolOverrides } from './index'\nexport type { CreateGithubAgentOptions } from './agents'\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,IAAa,qBAAb,MAAkE;CAChE,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAER,YAAY,SAAsC;AAChD,OAAK,QAAQ,IAAI,aAAa,QAAQ;AACtC,OAAK,SAAS,QAAQ;AACtB,OAAK,gBAAgB,QAAQ;AAC7B,OAAK,aAAa,QAAQ;AAC1B,OAAK,SAAS,QAAQ,SAAS,EAAE;;;CAInC,IAAI,QAAgB;AAClB,SAAO,KAAK,MAAM;;;;;;CAOpB,OACE,SACyD;AACzD,SAAO,KAAK,MAAM,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;;;CAuBnC,MAAM,SAAS,EAAE,QAAQ,YAAoJ;EAC3K,MAAM,EAAE,iBAAiB,MAAM,OAAO;EAEtC,MAAM,QAAQ,OAAO,KAAK,WAAW,aACjC,MAAM,KAAK,QAAQ,GACnB,KAAK;EAET,MAAM,SAAS,OAAO,KAAK,kBAAkB,WACzC,KAAK,gBACL;EAEJ,MAAM,SAAS,MAAM,aAAa;GACzB;GACP,OAAO,KAAK;GACZ;GACA;GACA;GACA,wBAAwB,KAAK;GAC9B,CAAC;AAEF,SAAO;GACL,MAAM,OAAO;GACb,cAAc,OAAO;GACrB,OAAO,OAAO;GACd,OAAO,OAAO;GACd,UAAU,OAAO;GAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEL,SAAgB,yBAAyB,EACvC,OACA,OACA,QACA,iBACA,cACA,wBACA,GAAG,gBAC+B;CAClC,MAAM,QAAQ,kBAAkB;EAAE;EAAO;EAAiB;EAAQ,CAAC;CAEnE,MAAM,gBAAgB,OAAO,UAAU,YAAY,OAAO,UAAU,aAChE,cACM,QAAQ,QAAQ,MAAM;AAEhC,QAAO,IAAI,mBAAmB;EAC5B,GAAG;EACH,OAAO;EACP;EACA,cAAc,oBAAoB;GAAE;GAAQ;GAAc;GAAwB,CAAC;EACpF,CAAC"}
1
+ {"version":3,"file":"workflow.mjs","names":[],"sources":["../src/workflow.ts"],"sourcesContent":["import { DurableAgent } from '@workflow/ai/agent'\nimport type { CompatibleLanguageModel, DurableAgentOptions, DurableAgentStreamOptions, DurableAgentStreamResult, TelemetrySettings } from '@workflow/ai/agent'\nimport type { ToolSet, StepResult, FinishReason, LanguageModelUsage, LanguageModelResponseMetadata, ModelMessage, StopCondition } from 'ai'\nimport { createGithubTools } from './index'\nimport { resolveInstructions } from './agents'\nimport type { GithubToolPreset, ApprovalConfig } from './index'\nimport type { CommitIdentity } from './types'\n\n/**\n * Result of {@link DurableGithubAgent.generate}.\n */\nexport interface DurableGithubAgentGenerateResult<TTools extends ToolSet = ToolSet> {\n text: string\n finishReason: FinishReason\n usage: LanguageModelUsage\n steps: StepResult<TTools>[]\n response: LanguageModelResponseMetadata & { messages: ModelMessage[] }\n}\n\n/**\n * A wrapper around the Workflow SDK's `DurableAgent` that adds a non-streaming\n * `.generate()` method alongside the existing `.stream()`.\n *\n * - `.stream()` — delegates to `DurableAgent.stream()`, each tool call is\n * an individually retriable workflow step. Works in workflow context.\n * - `.generate()` — uses `generateText` from the AI SDK for non-streaming\n * execution. Must be called from within a `\"use step\"` function in\n * workflow context (the Workflow runtime blocks raw I/O in workflow scope).\n */\nexport class DurableGithubAgent<TTools extends ToolSet = ToolSet> {\n private agent: DurableAgent<TTools>\n private _model: DurableAgentOptions<TTools>['model']\n private _instructions?: DurableAgentOptions<TTools>['instructions']\n private _telemetry?: TelemetrySettings\n private _tools: TTools\n\n constructor(options: DurableAgentOptions<TTools>) {\n this.agent = new DurableAgent(options)\n this._model = options.model\n this._instructions = options.instructions\n this._telemetry = options.experimental_telemetry\n this._tools = options.tools ?? {} as TTools\n }\n\n /** The tool set configured for this agent. */\n get tools(): TTools {\n return this.agent.tools\n }\n\n /**\n * Stream the agent's response. Delegates directly to `DurableAgent.stream()`.\n * Works in workflow context — each tool call is a durable step.\n */\n stream<TStreamTools extends TTools = TTools, OUTPUT = never, PARTIAL_OUTPUT = never>(\n options: DurableAgentStreamOptions<TStreamTools, OUTPUT, PARTIAL_OUTPUT>,\n ): Promise<DurableAgentStreamResult<TStreamTools, OUTPUT>> {\n return this.agent.stream(options)\n }\n\n /**\n * Generate a non-streaming response using `generateText` from the AI SDK.\n *\n * In workflow context this **must** be called from within a `\"use step\"`\n * function, because the Workflow runtime blocks direct I/O (HTTP calls)\n * at the workflow scope level.\n *\n * @example\n * ```ts\n * async function agentTurn(prompt: string) {\n * \"use step\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * preset: 'code-review',\n * })\n * const { text } = await agent.generate({ prompt })\n * return text\n * }\n * ```\n */\n async generate({ prompt, stopWhen }: { prompt: string, stopWhen?: StopCondition<TTools> | Array<StopCondition<TTools>> }): Promise<DurableGithubAgentGenerateResult<TTools>> {\n const { generateText } = await import('ai')\n\n const model = typeof this._model === 'function'\n ? await this._model()\n : this._model\n\n const system = typeof this._instructions === 'string'\n ? this._instructions\n : undefined\n\n const result = await generateText({\n model: model as Parameters<typeof generateText>[0]['model'],\n tools: this._tools,\n system,\n prompt,\n stopWhen,\n experimental_telemetry: this._telemetry as Parameters<typeof generateText>[0]['experimental_telemetry'],\n })\n\n return {\n text: result.text,\n finishReason: result.finishReason,\n usage: result.usage,\n steps: result.steps as StepResult<TTools>[],\n response: result.response,\n }\n }\n}\n\n/**\n * Options for creating a durable GitHub agent via {@link createDurableGithubAgent}.\n *\n * Extends all `DurableAgentOptions` (temperature, telemetry, callbacks, etc.)\n * and adds GitHub-specific fields (token, preset, approval config).\n */\nexport type CreateDurableGithubAgentOptions =\n Omit<DurableAgentOptions, 'model' | 'tools' | 'instructions'> & {\n model: string | CompatibleLanguageModel | (() => Promise<CompatibleLanguageModel>)\n /**\n * GitHub personal access token.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: string\n preset?: GithubToolPreset | GithubToolPreset[]\n requireApproval?: ApprovalConfig\n instructions?: string\n additionalInstructions?: string\n /**\n * Default author for commit-creating tools.\n * Falls back to the authenticated user when omitted.\n */\n author?: CommitIdentity\n /**\n * Default committer for commit-creating tools.\n * Falls back to the authenticated user when omitted.\n */\n committer?: CommitIdentity\n /**\n * Co-authors to attribute on all commits.\n * Added as \"Co-authored-by\" trailers to commit messages.\n */\n coAuthors?: CommitIdentity[]\n }\n\n/**\n * Create a pre-configured durable GitHub agent powered by Vercel Workflow SDK's `DurableAgent`.\n *\n * Returns a {@link DurableGithubAgent} with two interaction modes:\n *\n * - `.stream()` — works directly in workflow scope; each tool call is a durable step.\n * - `.generate()` — uses `generateText` from the AI SDK; must be called from\n * within a `\"use step\"` function when running inside a workflow.\n *\n * **Note:** `requireApproval` is accepted for forward-compatibility but is currently\n * ignored by `DurableAgent` — the Workflow SDK does not yet support interactive tool\n * approval. All tools execute immediately without user confirmation.\n *\n * @example Streaming (chat UI — works in workflow scope)\n * ```ts\n * import { createDurableGithubAgent } from '@github-tools/sdk/workflow'\n * import { getWritable } from 'workflow'\n * import type { ModelMessage, UIMessageChunk } from 'ai'\n *\n * async function chatWorkflow(messages: ModelMessage[], token: string) {\n * \"use workflow\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * token,\n * preset: 'code-review',\n * })\n * const writable = getWritable<UIMessageChunk>()\n * await agent.stream({ messages, writable })\n * }\n * ```\n *\n * @example Non-streaming (bot / background job — needs \"use step\")\n * ```ts\n * import { createDurableGithubAgent } from '@github-tools/sdk/workflow'\n *\n * async function agentTurn(prompt: string) {\n * \"use step\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * preset: 'code-review',\n * })\n * const { text } = await agent.generate({ prompt })\n * return text\n * }\n * ```\n */\nexport function createDurableGithubAgent({\n model,\n token,\n preset,\n requireApproval,\n instructions,\n additionalInstructions,\n author,\n committer,\n coAuthors,\n ...agentOptions\n}: CreateDurableGithubAgentOptions) {\n const tools = createGithubTools({ token, requireApproval, preset, author, committer, coAuthors })\n\n const resolvedModel = typeof model === 'string' || typeof model === 'function'\n ? model\n : () => Promise.resolve(model)\n\n return new DurableGithubAgent({\n ...agentOptions as Omit<typeof agentOptions, 'toolChoice'>,\n model: resolvedModel,\n tools,\n instructions: resolveInstructions({ preset, instructions, additionalInstructions }),\n })\n}\n\nexport { createGithubTools, createGithubAgent } from './index'\nexport type { CommitIdentity, CommitToolOptions, GithubTools, GithubToolsOptions, GithubToolPreset, GithubWriteToolName, ApprovalConfig, ToolOverrides } from './index'\nexport type { CreateGithubAgentOptions } from './agents'\n"],"mappings":";;;;;;;;;;;;;AA6BA,IAAa,qBAAb,MAAkE;CAChE;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAsC;AAChD,OAAK,QAAQ,IAAI,aAAa,QAAQ;AACtC,OAAK,SAAS,QAAQ;AACtB,OAAK,gBAAgB,QAAQ;AAC7B,OAAK,aAAa,QAAQ;AAC1B,OAAK,SAAS,QAAQ,SAAS,EAAE;;;CAInC,IAAI,QAAgB;AAClB,SAAO,KAAK,MAAM;;;;;;CAOpB,OACE,SACyD;AACzD,SAAO,KAAK,MAAM,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;;;CAuBnC,MAAM,SAAS,EAAE,QAAQ,YAAoJ;EAC3K,MAAM,EAAE,iBAAiB,MAAM,OAAO;EAEtC,MAAM,QAAQ,OAAO,KAAK,WAAW,aACjC,MAAM,KAAK,QAAQ,GACnB,KAAK;EAET,MAAM,SAAS,OAAO,KAAK,kBAAkB,WACzC,KAAK,gBACL,KAAA;EAEJ,MAAM,SAAS,MAAM,aAAa;GACzB;GACP,OAAO,KAAK;GACZ;GACA;GACA;GACA,wBAAwB,KAAK;GAC9B,CAAC;AAEF,SAAO;GACL,MAAM,OAAO;GACb,cAAc,OAAO;GACrB,OAAO,OAAO;GACd,OAAO,OAAO;GACd,UAAU,OAAO;GAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFL,SAAgB,yBAAyB,EACvC,OACA,OACA,QACA,iBACA,cACA,wBACA,QACA,WACA,WACA,GAAG,gBAC+B;CAClC,MAAM,QAAQ,kBAAkB;EAAE;EAAO;EAAiB;EAAQ;EAAQ;EAAW;EAAW,CAAC;CAEjG,MAAM,gBAAgB,OAAO,UAAU,YAAY,OAAO,UAAU,aAChE,cACM,QAAQ,QAAQ,MAAM;AAEhC,QAAO,IAAI,mBAAmB;EAC5B,GAAG;EACH,OAAO;EACP;EACA,cAAc,oBAAoB;GAAE;GAAQ;GAAc;GAAwB,CAAC;EACpF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@github-tools/sdk",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "GitHub tools for the Vercel AI SDK, wrap GitHub's API as AI SDK tools ready to plug into any agent",
5
5
  "author": "HugoRCD <hugo.richard@vercel.com",
6
6
  "repository": {
@@ -46,10 +46,10 @@
46
46
  "octokit": "^5.0.5"
47
47
  },
48
48
  "peerDependencies": {
49
+ "@workflow/ai": "^4.1.0-beta.60",
49
50
  "ai": "^6.0.97",
50
- "zod": "^4.3.6",
51
51
  "workflow": "^4.2.0-beta.76",
52
- "@workflow/ai": "^4.1.0-beta.60"
52
+ "zod": "^4.3.6"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "workflow": {
@@ -60,11 +60,11 @@
60
60
  }
61
61
  },
62
62
  "devDependencies": {
63
- "@types/node": "^24.10.13",
64
- "eslint": "^9.19.0",
65
- "tsdown": "^0.20.3",
66
- "typescript": "^5.9.3",
67
- "typescript-eslint": "^8.24.0"
63
+ "@types/node": "^25.6.0",
64
+ "eslint": "^10.3.0",
65
+ "tsdown": "^0.21.10",
66
+ "typescript": "^6.0.3",
67
+ "typescript-eslint": "^8.59.2"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"