@vercel/factory 0.0.12 → 0.0.14
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/README.md +1 -1
- package/dist/api.d.mts +225 -0
- package/dist/api.mjs +312 -0
- package/dist/api.mjs.map +1 -0
- package/dist/{approval-DdvEKLiE.mjs → approval-JX2Px9IC.mjs} +2 -2
- package/dist/{approval-DdvEKLiE.mjs.map → approval-JX2Px9IC.mjs.map} +1 -1
- package/dist/blob/index.d.mts +4 -3
- package/dist/blob/index.mjs +21 -15
- package/dist/blob/index.mjs.map +1 -1
- package/dist/budget-DzSiIA4t.mjs +42 -0
- package/dist/budget-DzSiIA4t.mjs.map +1 -0
- package/dist/build-factory.d.mts +1 -1
- package/dist/build-factory.mjs +1 -1
- package/dist/change-D2U6v7Ek.mjs +554 -0
- package/dist/change-D2U6v7Ek.mjs.map +1 -0
- package/dist/communication-Kd9nU5RP.mjs +30 -0
- package/dist/communication-Kd9nU5RP.mjs.map +1 -0
- package/dist/connectors/index.d.mts +3 -2
- package/dist/connectors/index.mjs +53 -26
- package/dist/connectors/index.mjs.map +1 -1
- package/dist/connectors/slack.d.mts +17 -6
- package/dist/connectors/slack.mjs +99 -32
- package/dist/connectors/slack.mjs.map +1 -1
- package/dist/coordination-Cq08hb1l.mjs +76 -0
- package/dist/coordination-Cq08hb1l.mjs.map +1 -0
- package/dist/dispatch-BaZS3PT8.d.mts +76 -0
- package/dist/{driver-CrZsy7sm.d.mts → driver-BC0Mt5KG.d.mts} +2 -2
- package/dist/driver-Bbd25rNM.mjs.map +1 -1
- package/dist/engine-DFHU2Pe-.d.mts +781 -0
- package/dist/engine-WaUM2cGA.mjs +1068 -0
- package/dist/engine-WaUM2cGA.mjs.map +1 -0
- package/dist/eve/index.d.mts +289 -153
- package/dist/eve/index.mjs +378 -89
- package/dist/eve/index.mjs.map +1 -1
- package/dist/{factory-config-ifd3JxiU.mjs → factory-config-BoRXOw43.mjs} +23 -22
- package/dist/factory-config-BoRXOw43.mjs.map +1 -0
- package/dist/{factory-config-Bu4mklm9.d.mts → factory-config-D2yU3G0c.d.mts} +21 -2
- package/dist/{github-wThBfbm-.d.mts → github-C5HNBN6p.d.mts} +34 -3
- package/dist/github.d.mts +2 -2
- package/dist/github.mjs +61 -1
- package/dist/github.mjs.map +1 -1
- package/dist/{id-DwCihQr4.mjs → id-BLIkCVue.mjs} +4 -2
- package/dist/{id-DwCihQr4.mjs.map → id-BLIkCVue.mjs.map} +1 -1
- package/dist/index-Bw6hggoH.d.mts +40 -0
- package/dist/index.d.mts +291 -61
- package/dist/index.mjs +140 -783
- package/dist/index.mjs.map +1 -1
- package/dist/postgres/index.d.mts +1 -1
- package/dist/task-CcOyOJ3k.mjs +154 -0
- package/dist/task-CcOyOJ3k.mjs.map +1 -0
- package/package.json +5 -1
- package/dist/approval-CIXB8IF8.d.mts +0 -522
- package/dist/change-CFNGXVqD.mjs +0 -230
- package/dist/change-CFNGXVqD.mjs.map +0 -1
- package/dist/factory-config-ifd3JxiU.mjs.map +0 -1
- package/dist/index-Cy4jfXh5.d.mts +0 -67
- package/dist/signal-CHVEmzvI.d.mts +0 -59
package/dist/eve/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { l as AgentRouteRegistry, r as DispatchBudget, s as AgentRoute } from "../dispatch-BaZS3PT8.mjs";
|
|
2
|
+
import { St as AnswerEvent, Tt as Task, h as FactoryStores } from "../engine-DFHU2Pe-.mjs";
|
|
3
|
+
import { ApprovalPolicy, Finding } from "../index.mjs";
|
|
4
|
+
import { C as GitHubReviewComment, F as SubmittedPullRequestReview, k as PullRequestReviewComment } from "../github-C5HNBN6p.mjs";
|
|
3
5
|
import { z } from "zod";
|
|
4
6
|
//#region src/eve/fetch.d.ts
|
|
5
7
|
/** The subset of the eve sandbox handle a credentialed git operation needs. */
|
|
@@ -38,6 +40,10 @@ type FetchPullRequestResult = {
|
|
|
38
40
|
prUrl: string;
|
|
39
41
|
branch: string;
|
|
40
42
|
headSha: string;
|
|
43
|
+
baseBranch: string;
|
|
44
|
+
baseSha: string;
|
|
45
|
+
mergeBaseSha: string;
|
|
46
|
+
diffCommand: string;
|
|
41
47
|
};
|
|
42
48
|
/**
|
|
43
49
|
* The verifier's way in to the change under review. The sandbox has no
|
|
@@ -342,6 +348,19 @@ interface InvokeAgentOptions {
|
|
|
342
348
|
token?: () => Promise<string | undefined>;
|
|
343
349
|
/** Extra headers for the session request, e.g. a deployment protection bypass. */
|
|
344
350
|
headers?: (task: Task) => Record<string, string> | Promise<Record<string, string>>;
|
|
351
|
+
/**
|
|
352
|
+
* Reserve-before-execution limits for the handoff dispatch, resolved at
|
|
353
|
+
* call time. Without it, handoff tasks run outside the budget.
|
|
354
|
+
*/
|
|
355
|
+
budget?: () => DispatchBudget | undefined;
|
|
356
|
+
fetch?: typeof fetch;
|
|
357
|
+
}
|
|
358
|
+
interface DelegateAgentOptions {
|
|
359
|
+
routes: AgentRouteRegistry;
|
|
360
|
+
targetUrl: (route: AgentRoute) => string;
|
|
361
|
+
token?: (route: AgentRoute) => Promise<string | undefined>;
|
|
362
|
+
headers?: (task: Task, route: AgentRoute) => Record<string, string> | Promise<Record<string, string>>;
|
|
363
|
+
budget?: (route: AgentRoute) => DispatchBudget | undefined;
|
|
345
364
|
fetch?: typeof fetch;
|
|
346
365
|
}
|
|
347
366
|
/**
|
|
@@ -362,7 +381,7 @@ declare function invokeAgentTool(stores: FactoryStores, options: InvokeAgentOpti
|
|
|
362
381
|
}, {
|
|
363
382
|
taskId: string;
|
|
364
383
|
kind: string;
|
|
365
|
-
state: "
|
|
384
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
366
385
|
}> & {
|
|
367
386
|
execute(input: {
|
|
368
387
|
repositoryIds: string[];
|
|
@@ -374,23 +393,83 @@ declare function invokeAgentTool(stores: FactoryStores, options: InvokeAgentOpti
|
|
|
374
393
|
}, ctx: import("eve/tools").ToolContext): Promise<{
|
|
375
394
|
taskId: string;
|
|
376
395
|
kind: string;
|
|
377
|
-
state: "
|
|
396
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
397
|
+
}>;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Give a conversational agent one bounded delegation surface backed by the
|
|
401
|
+
* application's route registry. The caller selects a declared route; trusted
|
|
402
|
+
* code owns task creation, budget enforcement, and the fresh target session.
|
|
403
|
+
*/
|
|
404
|
+
declare function delegateAgentTool(stores: FactoryStores, options: DelegateAgentOptions): import("eve/tools").ToolDefinition<{
|
|
405
|
+
routeId: string;
|
|
406
|
+
repositoryIds: string[];
|
|
407
|
+
channel: string;
|
|
408
|
+
address: string;
|
|
409
|
+
brief: string;
|
|
410
|
+
signalId?: string | undefined;
|
|
411
|
+
parentTaskId?: string | undefined;
|
|
412
|
+
changeId?: string | undefined;
|
|
413
|
+
}, {
|
|
414
|
+
taskId: string;
|
|
415
|
+
childTaskIds: string[];
|
|
416
|
+
routeId: string;
|
|
417
|
+
agent: string;
|
|
418
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
419
|
+
} | {
|
|
420
|
+
taskId: string;
|
|
421
|
+
routeId: string;
|
|
422
|
+
agent: string;
|
|
423
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
424
|
+
childTaskIds?: undefined;
|
|
425
|
+
}> & {
|
|
426
|
+
execute(input: {
|
|
427
|
+
routeId: string;
|
|
428
|
+
repositoryIds: string[];
|
|
429
|
+
channel: string;
|
|
430
|
+
address: string;
|
|
431
|
+
brief: string;
|
|
432
|
+
signalId?: string | undefined;
|
|
433
|
+
parentTaskId?: string | undefined;
|
|
434
|
+
changeId?: string | undefined;
|
|
435
|
+
}, ctx: import("eve/tools").ToolContext): Promise<{
|
|
436
|
+
taskId: string;
|
|
437
|
+
childTaskIds: string[];
|
|
438
|
+
routeId: string;
|
|
439
|
+
agent: string;
|
|
440
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
441
|
+
} | {
|
|
442
|
+
taskId: string;
|
|
443
|
+
routeId: string;
|
|
444
|
+
agent: string;
|
|
445
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
446
|
+
childTaskIds?: undefined;
|
|
378
447
|
}>;
|
|
379
448
|
};
|
|
380
449
|
//#endregion
|
|
381
450
|
//#region src/eve/post-review.d.ts
|
|
382
|
-
interface
|
|
451
|
+
interface CompletedReview {
|
|
383
452
|
taskId: string;
|
|
384
453
|
changeId: string;
|
|
385
454
|
repository: string;
|
|
455
|
+
pullRequestNumber: number;
|
|
386
456
|
headSha: string;
|
|
387
457
|
verdict: "approve" | "request_changes" | "comment";
|
|
388
458
|
summary: string;
|
|
389
|
-
comments: readonly
|
|
459
|
+
comments: readonly CompletedReviewFinding[];
|
|
460
|
+
}
|
|
461
|
+
interface CompletedReviewFinding extends PullRequestReviewComment {
|
|
462
|
+
fingerprint: string;
|
|
463
|
+
key: string;
|
|
464
|
+
title: string;
|
|
465
|
+
}
|
|
466
|
+
interface PublishedReview extends CompletedReview {
|
|
390
467
|
review: SubmittedPullRequestReview;
|
|
391
468
|
}
|
|
392
469
|
interface PostReviewToolOptions {
|
|
393
470
|
tokenForRepository: (repository: string) => Promise<string>;
|
|
471
|
+
publishReviews?: boolean;
|
|
472
|
+
onCompleted?: (completed: CompletedReview) => Promise<void>;
|
|
394
473
|
onPublished?: (published: PublishedReview) => Promise<void>;
|
|
395
474
|
fetch?: typeof globalThis.fetch;
|
|
396
475
|
}
|
|
@@ -408,18 +487,18 @@ declare function postReviewTool(stores: FactoryStores, options: PostReviewToolOp
|
|
|
408
487
|
path: string;
|
|
409
488
|
line: number;
|
|
410
489
|
body: string;
|
|
490
|
+
key?: string | undefined;
|
|
491
|
+
title?: string | undefined;
|
|
411
492
|
}[];
|
|
412
493
|
}, {
|
|
413
494
|
recorded: false;
|
|
414
495
|
reason: string;
|
|
415
|
-
verdict?: undefined;
|
|
416
|
-
review?: undefined;
|
|
417
|
-
taskState?: undefined;
|
|
418
496
|
} | {
|
|
497
|
+
taskState: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
498
|
+
review?: SubmittedPullRequestReview | undefined;
|
|
419
499
|
recorded: true;
|
|
420
500
|
verdict: "approve" | "request_changes" | "comment";
|
|
421
|
-
|
|
422
|
-
taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
501
|
+
published: boolean;
|
|
423
502
|
reason?: undefined;
|
|
424
503
|
}> & {
|
|
425
504
|
execute(input: {
|
|
@@ -432,18 +511,18 @@ declare function postReviewTool(stores: FactoryStores, options: PostReviewToolOp
|
|
|
432
511
|
path: string;
|
|
433
512
|
line: number;
|
|
434
513
|
body: string;
|
|
514
|
+
key?: string | undefined;
|
|
515
|
+
title?: string | undefined;
|
|
435
516
|
}[];
|
|
436
517
|
}, ctx: import("eve/tools").ToolContext): Promise<{
|
|
437
518
|
recorded: false;
|
|
438
519
|
reason: string;
|
|
439
|
-
verdict?: undefined;
|
|
440
|
-
review?: undefined;
|
|
441
|
-
taskState?: undefined;
|
|
442
520
|
} | {
|
|
521
|
+
taskState: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
522
|
+
review?: SubmittedPullRequestReview | undefined;
|
|
443
523
|
recorded: true;
|
|
444
524
|
verdict: "approve" | "request_changes" | "comment";
|
|
445
|
-
|
|
446
|
-
taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
525
|
+
published: boolean;
|
|
447
526
|
reason?: undefined;
|
|
448
527
|
}>;
|
|
449
528
|
};
|
|
@@ -521,6 +600,14 @@ declare function reviewCommentTools<S extends CommandSandbox>(stores: FactorySto
|
|
|
521
600
|
};
|
|
522
601
|
//#endregion
|
|
523
602
|
//#region src/eve/verification.d.ts
|
|
603
|
+
interface RecordVerificationOptions {
|
|
604
|
+
presentResult?: (input: {
|
|
605
|
+
taskId: string;
|
|
606
|
+
changeId: string;
|
|
607
|
+
verdict: "pass" | "fail";
|
|
608
|
+
summary: string;
|
|
609
|
+
}) => Promise<void>;
|
|
610
|
+
}
|
|
524
611
|
/**
|
|
525
612
|
* The verifier's outcome tool. Writes evidence onto the change and moves it
|
|
526
613
|
* to ready only when the verdict is pass; a failed verdict leaves the change
|
|
@@ -531,7 +618,7 @@ declare function reviewCommentTools<S extends CommandSandbox>(stores: FactorySto
|
|
|
531
618
|
* as still in progress. Fail closed: the agent cannot mark a change ready
|
|
532
619
|
* without supplying every evidence field.
|
|
533
620
|
*/
|
|
534
|
-
declare function recordVerificationTool(stores: FactoryStores): import("eve/tools").ToolDefinition<{
|
|
621
|
+
declare function recordVerificationTool(stores: FactoryStores, options?: RecordVerificationOptions): import("eve/tools").ToolDefinition<{
|
|
535
622
|
taskId: string;
|
|
536
623
|
changeId: string;
|
|
537
624
|
verdict: "pass" | "fail";
|
|
@@ -554,8 +641,8 @@ declare function recordVerificationTool(stores: FactoryStores): import("eve/tool
|
|
|
554
641
|
} | {
|
|
555
642
|
recorded: true;
|
|
556
643
|
verdict: "pass" | "fail";
|
|
557
|
-
changeState: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "
|
|
558
|
-
taskState: "
|
|
644
|
+
changeState: "rolled_back" | "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "closed";
|
|
645
|
+
taskState: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
559
646
|
reason?: undefined;
|
|
560
647
|
}> & {
|
|
561
648
|
execute(input: {
|
|
@@ -581,8 +668,8 @@ declare function recordVerificationTool(stores: FactoryStores): import("eve/tool
|
|
|
581
668
|
} | {
|
|
582
669
|
recorded: true;
|
|
583
670
|
verdict: "pass" | "fail";
|
|
584
|
-
changeState: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "
|
|
585
|
-
taskState: "
|
|
671
|
+
changeState: "rolled_back" | "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "closed";
|
|
672
|
+
taskState: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
586
673
|
reason?: undefined;
|
|
587
674
|
}>;
|
|
588
675
|
};
|
|
@@ -619,7 +706,19 @@ interface FactoryToolsOptions {
|
|
|
619
706
|
* Gates must fail closed: when they cannot verify, they refuse.
|
|
620
707
|
*/
|
|
621
708
|
recordChangeGate?: (input: RecordChangeInput) => Promise<GateVerdict>;
|
|
709
|
+
/** Whether recorded code changes wait for an independent verification task. Default: required. */
|
|
710
|
+
verification?: "required" | "disabled";
|
|
711
|
+
/** Present the pull request after record_change persists its durable state. */
|
|
712
|
+
presentChange?: (input: {
|
|
713
|
+
taskId: string;
|
|
714
|
+
changeId: string;
|
|
715
|
+
verification: "required" | "disabled";
|
|
716
|
+
summary: string;
|
|
717
|
+
}) => Promise<void>;
|
|
718
|
+
/** Present a persisted human question through the application's Foreman communication boundary. */
|
|
719
|
+
presentQuestion?: (task: Task) => Promise<void>;
|
|
622
720
|
}
|
|
721
|
+
type PresentQuestion = NonNullable<FactoryToolsOptions["presentQuestion"]>;
|
|
623
722
|
/**
|
|
624
723
|
* The factory's store operations wrapped as eve tools. Expose a tool to an
|
|
625
724
|
* agent by re-exporting it from a file under agent/tools/, e.g.
|
|
@@ -634,7 +733,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
634
733
|
id: string;
|
|
635
734
|
repositoryIds: string[];
|
|
636
735
|
kind: string;
|
|
637
|
-
state: "
|
|
736
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
638
737
|
origin: {
|
|
639
738
|
signalId?: string | undefined;
|
|
640
739
|
parentTaskId?: string | undefined;
|
|
@@ -650,12 +749,26 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
650
749
|
area?: string | undefined;
|
|
651
750
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
652
751
|
dependsOn?: string[] | undefined;
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
752
|
+
execution?: {
|
|
753
|
+
provider: string;
|
|
754
|
+
sessionId: string;
|
|
755
|
+
environmentId?: string | undefined;
|
|
756
|
+
harness?: string | undefined;
|
|
757
|
+
traceId?: string | undefined;
|
|
657
758
|
} | undefined;
|
|
759
|
+
lastProgressAt?: string | undefined;
|
|
760
|
+
stalledAt?: string | undefined;
|
|
761
|
+
stalledReason?: string | undefined;
|
|
658
762
|
reservedUsd?: number | undefined;
|
|
763
|
+
reservedAt?: string | undefined;
|
|
764
|
+
usage?: {
|
|
765
|
+
costUsd: number;
|
|
766
|
+
inputTokens: number;
|
|
767
|
+
outputTokens: number;
|
|
768
|
+
cacheReadTokens: number;
|
|
769
|
+
cacheWriteTokens: number;
|
|
770
|
+
steps: Record<string, number>;
|
|
771
|
+
} | undefined;
|
|
659
772
|
settledUsd?: number | undefined;
|
|
660
773
|
question?: {
|
|
661
774
|
text: string;
|
|
@@ -663,6 +776,8 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
663
776
|
answer?: string | undefined;
|
|
664
777
|
answeredBy?: string | undefined;
|
|
665
778
|
} | undefined;
|
|
779
|
+
questionTaskId?: string | undefined;
|
|
780
|
+
answerEventIds?: string[] | undefined;
|
|
666
781
|
changeId?: string | undefined;
|
|
667
782
|
reportRef?: string | undefined;
|
|
668
783
|
} | {
|
|
@@ -676,7 +791,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
676
791
|
id: string;
|
|
677
792
|
repositoryIds: string[];
|
|
678
793
|
kind: string;
|
|
679
|
-
state: "
|
|
794
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
680
795
|
origin: {
|
|
681
796
|
signalId?: string | undefined;
|
|
682
797
|
parentTaskId?: string | undefined;
|
|
@@ -692,12 +807,26 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
692
807
|
area?: string | undefined;
|
|
693
808
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
694
809
|
dependsOn?: string[] | undefined;
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
810
|
+
execution?: {
|
|
811
|
+
provider: string;
|
|
812
|
+
sessionId: string;
|
|
813
|
+
environmentId?: string | undefined;
|
|
814
|
+
harness?: string | undefined;
|
|
815
|
+
traceId?: string | undefined;
|
|
699
816
|
} | undefined;
|
|
817
|
+
lastProgressAt?: string | undefined;
|
|
818
|
+
stalledAt?: string | undefined;
|
|
819
|
+
stalledReason?: string | undefined;
|
|
700
820
|
reservedUsd?: number | undefined;
|
|
821
|
+
reservedAt?: string | undefined;
|
|
822
|
+
usage?: {
|
|
823
|
+
costUsd: number;
|
|
824
|
+
inputTokens: number;
|
|
825
|
+
outputTokens: number;
|
|
826
|
+
cacheReadTokens: number;
|
|
827
|
+
cacheWriteTokens: number;
|
|
828
|
+
steps: Record<string, number>;
|
|
829
|
+
} | undefined;
|
|
701
830
|
settledUsd?: number | undefined;
|
|
702
831
|
question?: {
|
|
703
832
|
text: string;
|
|
@@ -705,6 +834,8 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
705
834
|
answer?: string | undefined;
|
|
706
835
|
answeredBy?: string | undefined;
|
|
707
836
|
} | undefined;
|
|
837
|
+
questionTaskId?: string | undefined;
|
|
838
|
+
answerEventIds?: string[] | undefined;
|
|
708
839
|
changeId?: string | undefined;
|
|
709
840
|
reportRef?: string | undefined;
|
|
710
841
|
} | {
|
|
@@ -783,7 +914,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
783
914
|
scopeMatches: boolean;
|
|
784
915
|
previewUrl?: string | undefined;
|
|
785
916
|
};
|
|
786
|
-
state: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "
|
|
917
|
+
state: "rolled_back" | "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "closed";
|
|
787
918
|
createdAt: string;
|
|
788
919
|
updatedAt: string;
|
|
789
920
|
taskId?: string | undefined;
|
|
@@ -796,7 +927,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
796
927
|
id: string;
|
|
797
928
|
repositoryIds: string[];
|
|
798
929
|
kind: string;
|
|
799
|
-
state: "
|
|
930
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
800
931
|
origin: {
|
|
801
932
|
signalId?: string | undefined;
|
|
802
933
|
parentTaskId?: string | undefined;
|
|
@@ -812,12 +943,26 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
812
943
|
area?: string | undefined;
|
|
813
944
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
814
945
|
dependsOn?: string[] | undefined;
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
946
|
+
execution?: {
|
|
947
|
+
provider: string;
|
|
948
|
+
sessionId: string;
|
|
949
|
+
environmentId?: string | undefined;
|
|
950
|
+
harness?: string | undefined;
|
|
951
|
+
traceId?: string | undefined;
|
|
819
952
|
} | undefined;
|
|
953
|
+
lastProgressAt?: string | undefined;
|
|
954
|
+
stalledAt?: string | undefined;
|
|
955
|
+
stalledReason?: string | undefined;
|
|
820
956
|
reservedUsd?: number | undefined;
|
|
957
|
+
reservedAt?: string | undefined;
|
|
958
|
+
usage?: {
|
|
959
|
+
costUsd: number;
|
|
960
|
+
inputTokens: number;
|
|
961
|
+
outputTokens: number;
|
|
962
|
+
cacheReadTokens: number;
|
|
963
|
+
cacheWriteTokens: number;
|
|
964
|
+
steps: Record<string, number>;
|
|
965
|
+
} | undefined;
|
|
821
966
|
settledUsd?: number | undefined;
|
|
822
967
|
question?: {
|
|
823
968
|
text: string;
|
|
@@ -825,6 +970,8 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
825
970
|
answer?: string | undefined;
|
|
826
971
|
answeredBy?: string | undefined;
|
|
827
972
|
} | undefined;
|
|
973
|
+
questionTaskId?: string | undefined;
|
|
974
|
+
answerEventIds?: string[] | undefined;
|
|
828
975
|
changeId?: string | undefined;
|
|
829
976
|
reportRef?: string | undefined;
|
|
830
977
|
};
|
|
@@ -855,7 +1002,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
855
1002
|
scopeMatches: boolean;
|
|
856
1003
|
previewUrl?: string | undefined;
|
|
857
1004
|
};
|
|
858
|
-
state: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "
|
|
1005
|
+
state: "rolled_back" | "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "closed";
|
|
859
1006
|
createdAt: string;
|
|
860
1007
|
updatedAt: string;
|
|
861
1008
|
taskId?: string | undefined;
|
|
@@ -868,7 +1015,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
868
1015
|
id: string;
|
|
869
1016
|
repositoryIds: string[];
|
|
870
1017
|
kind: string;
|
|
871
|
-
state: "
|
|
1018
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
872
1019
|
origin: {
|
|
873
1020
|
signalId?: string | undefined;
|
|
874
1021
|
parentTaskId?: string | undefined;
|
|
@@ -884,12 +1031,26 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
884
1031
|
area?: string | undefined;
|
|
885
1032
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
886
1033
|
dependsOn?: string[] | undefined;
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1034
|
+
execution?: {
|
|
1035
|
+
provider: string;
|
|
1036
|
+
sessionId: string;
|
|
1037
|
+
environmentId?: string | undefined;
|
|
1038
|
+
harness?: string | undefined;
|
|
1039
|
+
traceId?: string | undefined;
|
|
891
1040
|
} | undefined;
|
|
1041
|
+
lastProgressAt?: string | undefined;
|
|
1042
|
+
stalledAt?: string | undefined;
|
|
1043
|
+
stalledReason?: string | undefined;
|
|
892
1044
|
reservedUsd?: number | undefined;
|
|
1045
|
+
reservedAt?: string | undefined;
|
|
1046
|
+
usage?: {
|
|
1047
|
+
costUsd: number;
|
|
1048
|
+
inputTokens: number;
|
|
1049
|
+
outputTokens: number;
|
|
1050
|
+
cacheReadTokens: number;
|
|
1051
|
+
cacheWriteTokens: number;
|
|
1052
|
+
steps: Record<string, number>;
|
|
1053
|
+
} | undefined;
|
|
893
1054
|
settledUsd?: number | undefined;
|
|
894
1055
|
question?: {
|
|
895
1056
|
text: string;
|
|
@@ -897,6 +1058,8 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
897
1058
|
answer?: string | undefined;
|
|
898
1059
|
answeredBy?: string | undefined;
|
|
899
1060
|
} | undefined;
|
|
1061
|
+
questionTaskId?: string | undefined;
|
|
1062
|
+
answerEventIds?: string[] | undefined;
|
|
900
1063
|
changeId?: string | undefined;
|
|
901
1064
|
reportRef?: string | undefined;
|
|
902
1065
|
};
|
|
@@ -911,7 +1074,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
911
1074
|
taskState?: undefined;
|
|
912
1075
|
} | {
|
|
913
1076
|
finished: true;
|
|
914
|
-
taskState: "
|
|
1077
|
+
taskState: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
915
1078
|
reason?: undefined;
|
|
916
1079
|
}> & {
|
|
917
1080
|
execute(input: {
|
|
@@ -923,106 +1086,22 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
923
1086
|
taskState?: undefined;
|
|
924
1087
|
} | {
|
|
925
1088
|
finished: true;
|
|
926
|
-
taskState: "
|
|
1089
|
+
taskState: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
927
1090
|
reason?: undefined;
|
|
928
1091
|
}>;
|
|
929
1092
|
};
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
reason: string;
|
|
933
|
-
}, {
|
|
934
|
-
schemaVersion: 1;
|
|
935
|
-
id: string;
|
|
936
|
-
repositoryIds: string[];
|
|
937
|
-
kind: string;
|
|
938
|
-
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
939
|
-
origin: {
|
|
940
|
-
signalId?: string | undefined;
|
|
941
|
-
parentTaskId?: string | undefined;
|
|
942
|
-
operator?: string | undefined;
|
|
943
|
-
};
|
|
944
|
-
replyTo: {
|
|
945
|
-
channel: string;
|
|
946
|
-
address: string;
|
|
947
|
-
};
|
|
948
|
-
attempt: number;
|
|
949
|
-
createdAt: string;
|
|
950
|
-
updatedAt: string;
|
|
951
|
-
area?: string | undefined;
|
|
952
|
-
approval?: "required" | "granted" | "denied" | undefined;
|
|
953
|
-
dependsOn?: string[] | undefined;
|
|
954
|
-
devbox?: {
|
|
955
|
-
devboxId: string;
|
|
956
|
-
remoteId: string;
|
|
957
|
-
harness: string;
|
|
958
|
-
} | undefined;
|
|
959
|
-
reservedUsd?: number | undefined;
|
|
960
|
-
settledUsd?: number | undefined;
|
|
961
|
-
question?: {
|
|
962
|
-
text: string;
|
|
963
|
-
options: string[];
|
|
964
|
-
answer?: string | undefined;
|
|
965
|
-
answeredBy?: string | undefined;
|
|
966
|
-
} | undefined;
|
|
967
|
-
changeId?: string | undefined;
|
|
968
|
-
reportRef?: string | undefined;
|
|
969
|
-
}> & {
|
|
970
|
-
execute(input: {
|
|
971
|
-
taskId: string;
|
|
972
|
-
reason: string;
|
|
973
|
-
}, ctx: import("eve/tools").ToolContext): Promise<{
|
|
974
|
-
schemaVersion: 1;
|
|
975
|
-
id: string;
|
|
976
|
-
repositoryIds: string[];
|
|
977
|
-
kind: string;
|
|
978
|
-
state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
979
|
-
origin: {
|
|
980
|
-
signalId?: string | undefined;
|
|
981
|
-
parentTaskId?: string | undefined;
|
|
982
|
-
operator?: string | undefined;
|
|
983
|
-
};
|
|
984
|
-
replyTo: {
|
|
985
|
-
channel: string;
|
|
986
|
-
address: string;
|
|
987
|
-
};
|
|
988
|
-
attempt: number;
|
|
989
|
-
createdAt: string;
|
|
990
|
-
updatedAt: string;
|
|
991
|
-
area?: string | undefined;
|
|
992
|
-
approval?: "required" | "granted" | "denied" | undefined;
|
|
993
|
-
dependsOn?: string[] | undefined;
|
|
994
|
-
devbox?: {
|
|
995
|
-
devboxId: string;
|
|
996
|
-
remoteId: string;
|
|
997
|
-
harness: string;
|
|
998
|
-
} | undefined;
|
|
999
|
-
reservedUsd?: number | undefined;
|
|
1000
|
-
settledUsd?: number | undefined;
|
|
1001
|
-
question?: {
|
|
1002
|
-
text: string;
|
|
1003
|
-
options: string[];
|
|
1004
|
-
answer?: string | undefined;
|
|
1005
|
-
answeredBy?: string | undefined;
|
|
1006
|
-
} | undefined;
|
|
1007
|
-
changeId?: string | undefined;
|
|
1008
|
-
reportRef?: string | undefined;
|
|
1009
|
-
}>;
|
|
1010
|
-
};
|
|
1011
|
-
ask_question: import("eve/tools").ToolDefinition<{
|
|
1012
|
-
repositoryIds: string[];
|
|
1013
|
-
channel: string;
|
|
1014
|
-
address: string;
|
|
1093
|
+
request_human_input: import("eve/tools").ToolDefinition<{
|
|
1094
|
+
parentTaskId: string;
|
|
1015
1095
|
question: {
|
|
1016
1096
|
text: string;
|
|
1017
1097
|
options: string[];
|
|
1018
1098
|
};
|
|
1019
|
-
parentTaskId?: string | undefined;
|
|
1020
1099
|
}, {
|
|
1021
1100
|
schemaVersion: 1;
|
|
1022
1101
|
id: string;
|
|
1023
1102
|
repositoryIds: string[];
|
|
1024
1103
|
kind: string;
|
|
1025
|
-
state: "
|
|
1104
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
1026
1105
|
origin: {
|
|
1027
1106
|
signalId?: string | undefined;
|
|
1028
1107
|
parentTaskId?: string | undefined;
|
|
@@ -1038,12 +1117,26 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
1038
1117
|
area?: string | undefined;
|
|
1039
1118
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
1040
1119
|
dependsOn?: string[] | undefined;
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1120
|
+
execution?: {
|
|
1121
|
+
provider: string;
|
|
1122
|
+
sessionId: string;
|
|
1123
|
+
environmentId?: string | undefined;
|
|
1124
|
+
harness?: string | undefined;
|
|
1125
|
+
traceId?: string | undefined;
|
|
1045
1126
|
} | undefined;
|
|
1127
|
+
lastProgressAt?: string | undefined;
|
|
1128
|
+
stalledAt?: string | undefined;
|
|
1129
|
+
stalledReason?: string | undefined;
|
|
1046
1130
|
reservedUsd?: number | undefined;
|
|
1131
|
+
reservedAt?: string | undefined;
|
|
1132
|
+
usage?: {
|
|
1133
|
+
costUsd: number;
|
|
1134
|
+
inputTokens: number;
|
|
1135
|
+
outputTokens: number;
|
|
1136
|
+
cacheReadTokens: number;
|
|
1137
|
+
cacheWriteTokens: number;
|
|
1138
|
+
steps: Record<string, number>;
|
|
1139
|
+
} | undefined;
|
|
1047
1140
|
settledUsd?: number | undefined;
|
|
1048
1141
|
question?: {
|
|
1049
1142
|
text: string;
|
|
@@ -1051,24 +1144,23 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
1051
1144
|
answer?: string | undefined;
|
|
1052
1145
|
answeredBy?: string | undefined;
|
|
1053
1146
|
} | undefined;
|
|
1147
|
+
questionTaskId?: string | undefined;
|
|
1148
|
+
answerEventIds?: string[] | undefined;
|
|
1054
1149
|
changeId?: string | undefined;
|
|
1055
1150
|
reportRef?: string | undefined;
|
|
1056
1151
|
}> & {
|
|
1057
1152
|
execute(input: {
|
|
1058
|
-
|
|
1059
|
-
channel: string;
|
|
1060
|
-
address: string;
|
|
1153
|
+
parentTaskId: string;
|
|
1061
1154
|
question: {
|
|
1062
1155
|
text: string;
|
|
1063
1156
|
options: string[];
|
|
1064
1157
|
};
|
|
1065
|
-
parentTaskId?: string | undefined;
|
|
1066
1158
|
}, ctx: import("eve/tools").ToolContext): Promise<{
|
|
1067
1159
|
schemaVersion: 1;
|
|
1068
1160
|
id: string;
|
|
1069
1161
|
repositoryIds: string[];
|
|
1070
1162
|
kind: string;
|
|
1071
|
-
state: "
|
|
1163
|
+
state: "succeeded" | "failed" | "needs_human" | "queued" | "running" | "stalled" | "verifying" | "cancelled";
|
|
1072
1164
|
origin: {
|
|
1073
1165
|
signalId?: string | undefined;
|
|
1074
1166
|
parentTaskId?: string | undefined;
|
|
@@ -1084,12 +1176,26 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
1084
1176
|
area?: string | undefined;
|
|
1085
1177
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
1086
1178
|
dependsOn?: string[] | undefined;
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1179
|
+
execution?: {
|
|
1180
|
+
provider: string;
|
|
1181
|
+
sessionId: string;
|
|
1182
|
+
environmentId?: string | undefined;
|
|
1183
|
+
harness?: string | undefined;
|
|
1184
|
+
traceId?: string | undefined;
|
|
1091
1185
|
} | undefined;
|
|
1186
|
+
lastProgressAt?: string | undefined;
|
|
1187
|
+
stalledAt?: string | undefined;
|
|
1188
|
+
stalledReason?: string | undefined;
|
|
1092
1189
|
reservedUsd?: number | undefined;
|
|
1190
|
+
reservedAt?: string | undefined;
|
|
1191
|
+
usage?: {
|
|
1192
|
+
costUsd: number;
|
|
1193
|
+
inputTokens: number;
|
|
1194
|
+
outputTokens: number;
|
|
1195
|
+
cacheReadTokens: number;
|
|
1196
|
+
cacheWriteTokens: number;
|
|
1197
|
+
steps: Record<string, number>;
|
|
1198
|
+
} | undefined;
|
|
1093
1199
|
settledUsd?: number | undefined;
|
|
1094
1200
|
question?: {
|
|
1095
1201
|
text: string;
|
|
@@ -1097,10 +1203,29 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
1097
1203
|
answer?: string | undefined;
|
|
1098
1204
|
answeredBy?: string | undefined;
|
|
1099
1205
|
} | undefined;
|
|
1206
|
+
questionTaskId?: string | undefined;
|
|
1207
|
+
answerEventIds?: string[] | undefined;
|
|
1100
1208
|
changeId?: string | undefined;
|
|
1101
1209
|
reportRef?: string | undefined;
|
|
1102
1210
|
}>;
|
|
1103
1211
|
};
|
|
1212
|
+
answer_question: import("eve/tools").ToolDefinition<{
|
|
1213
|
+
questionTaskId: string;
|
|
1214
|
+
answer: string;
|
|
1215
|
+
}, {
|
|
1216
|
+
answerEvent: AnswerEvent;
|
|
1217
|
+
questionTask: Task;
|
|
1218
|
+
parentTask: Task | null;
|
|
1219
|
+
}> & {
|
|
1220
|
+
execute(input: {
|
|
1221
|
+
questionTaskId: string;
|
|
1222
|
+
answer: string;
|
|
1223
|
+
}, ctx: import("eve/tools").ToolContext): Promise<{
|
|
1224
|
+
answerEvent: AnswerEvent;
|
|
1225
|
+
questionTask: Task;
|
|
1226
|
+
parentTask: Task | null;
|
|
1227
|
+
}>;
|
|
1228
|
+
};
|
|
1104
1229
|
append_receipt: import("eve/tools").ToolDefinition<{
|
|
1105
1230
|
repositoryIds: string[];
|
|
1106
1231
|
kind: string;
|
|
@@ -1154,20 +1279,31 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
|
|
|
1154
1279
|
};
|
|
1155
1280
|
};
|
|
1156
1281
|
type FactoryTools = ReturnType<typeof factoryTools>;
|
|
1282
|
+
interface FactoryHooksOptions {
|
|
1283
|
+
/** Session auth attribute naming the task a dispatched session works on. Default `factoryTaskId`. */
|
|
1284
|
+
taskIdAttribute?: string;
|
|
1285
|
+
/** Present the recovery question created when a task turn ends without an outcome. */
|
|
1286
|
+
presentQuestion: PresentQuestion;
|
|
1287
|
+
}
|
|
1157
1288
|
/**
|
|
1158
1289
|
* Observe-only eve hooks that keep the ledger honest about session outcomes.
|
|
1159
1290
|
* Mount by re-exporting from agent/hooks/, e.g.
|
|
1160
|
-
* `export default factoryHooks(stores).factory;`.
|
|
1291
|
+
* `export default factoryHooks(stores, { presentQuestion }).factory;`.
|
|
1292
|
+
*
|
|
1293
|
+
* step.completed: records the step's tokens and AI Gateway cost on the bound
|
|
1294
|
+
* task. Delivery is at least once; recordUsage dedupes by (turnId, stepIndex).
|
|
1295
|
+
*
|
|
1296
|
+
* turn.completed: settles the bound task's recorded usage if the task is
|
|
1297
|
+
* already terminal (the sweep handles tasks that end later), then moves any
|
|
1298
|
+
* still-running task at this session's reply address behind a surfaced human
|
|
1299
|
+
* question, because the agent finished talking without recording an outcome.
|
|
1161
1300
|
*
|
|
1162
|
-
*
|
|
1163
|
-
* agent finished talking without recording an outcome; the task moves to
|
|
1164
|
-
* needs_human instead of rotting. The task is found by the session's
|
|
1165
|
-
* channel address, which dispatch set from the task's replyTo.
|
|
1301
|
+
* Every store call is swallowed: a hook throw fails the turn.
|
|
1166
1302
|
*/
|
|
1167
|
-
declare function factoryHooks(stores: FactoryStores): {
|
|
1168
|
-
factory: import("eve/hooks").HookDefinition<"turn.completed">;
|
|
1303
|
+
declare function factoryHooks(stores: FactoryStores, options: FactoryHooksOptions): {
|
|
1304
|
+
factory: import("eve/hooks").HookDefinition<"step.completed" | "turn.completed">;
|
|
1169
1305
|
};
|
|
1170
1306
|
type FactoryHooks = ReturnType<typeof factoryHooks>;
|
|
1171
1307
|
//#endregion
|
|
1172
|
-
export { type CommandSandbox, type DeepsecScanOptions, FactoryHooks, FactoryTools, FactoryToolsOptions, type FetchPullRequestOptions, type FetchPullRequestResult, GateVerdict, type InvokeAgentOptions, type MergeConflictPayload, type MergeConflictToolOptions, type PostReviewToolOptions, type PublishedReview, RecordChangeInput, type RecordFindingOptions, type RecordFindingResult, type ReviewCommentToolOptions, deepsecScanTool, factoryHooks, factoryTools, fetchPullRequestTool, findingFromDeepsec, invokeAgentTool, mergeConflictPayloadSchema, mergeConflictTools, postReviewTool, recordFinding, recordFindingTool, recordVerificationTool, reviewCommentTools };
|
|
1308
|
+
export { type CommandSandbox, type CompletedReview, type CompletedReviewFinding, type DeepsecScanOptions, type DelegateAgentOptions, FactoryHooks, FactoryHooksOptions, FactoryTools, FactoryToolsOptions, type FetchPullRequestOptions, type FetchPullRequestResult, GateVerdict, type InvokeAgentOptions, type MergeConflictPayload, type MergeConflictToolOptions, type PostReviewToolOptions, type PublishedReview, RecordChangeInput, type RecordFindingOptions, type RecordFindingResult, type RecordVerificationOptions, type ReviewCommentToolOptions, deepsecScanTool, delegateAgentTool, factoryHooks, factoryTools, fetchPullRequestTool, findingFromDeepsec, invokeAgentTool, mergeConflictPayloadSchema, mergeConflictTools, postReviewTool, recordFinding, recordFindingTool, recordVerificationTool, reviewCommentTools };
|
|
1173
1309
|
//# sourceMappingURL=index.d.mts.map
|