@dual-os/sdk 0.8.0-next.1 → 0.8.0-next.3
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/AgentChannel.d.ts +18 -929
- package/dist/AgentChannel.d.ts.map +1 -1
- package/dist/AgentChannel.js +23 -157
- package/dist/AgentChannel.js.map +1 -1
- package/dist/AgentChannelConformance.d.ts +8 -500
- package/dist/AgentChannelConformance.d.ts.map +1 -1
- package/dist/AgentChannelConformance.js +3 -3
- package/dist/AgentChannelConformance.js.map +1 -1
- package/dist/AgentChannelRuntime.d.ts.map +1 -1
- package/dist/AgentChannelRuntime.js +6 -7
- package/dist/AgentChannelRuntime.js.map +1 -1
- package/dist/PluginRuntime.d.ts +305 -9
- package/dist/PluginRuntime.d.ts.map +1 -1
- package/dist/PluginRuntime.js +9 -3
- package/dist/PluginRuntime.js.map +1 -1
- package/dist/internal/dual/registry.d.ts +1 -3
- package/dist/internal/dual/registry.d.ts.map +1 -1
- package/dist/internal/dual/registry.js.map +1 -1
- package/dist/internal/plugin-handlers.js +4 -2
- package/dist/internal/plugin-handlers.js.map +1 -1
- package/dist/remote-runtime.d.ts +292 -10
- package/dist/remote-runtime.d.ts.map +1 -1
- package/dist/remote-runtime.js +9 -15
- package/dist/remote-runtime.js.map +1 -1
- package/package.json +1 -1
- package/src/AgentChannel.ts +23 -149
- package/src/AgentChannelConformance.ts +2 -6
- package/src/AgentChannelRuntime.ts +9 -13
- package/src/PluginRuntime.ts +9 -4
- package/src/internal/dual/registry.ts +0 -2
- package/src/internal/plugin-handlers.ts +5 -2
- package/src/remote-runtime.ts +12 -23
package/dist/remote-runtime.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { AuthMethodHookError, ExpectedOAuth2MethodError, OAuth2RefreshTokenUnavailableError } from "./AuthMethod.js";
|
|
2
|
+
import { ActionHandlerError, RetryableActionHandlerError } from "./Action.js";
|
|
1
3
|
import { ChannelError } from "./AgentChannel.js";
|
|
2
|
-
import { Service } from "./ConnectionResolver.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { ConnectionIdNotAllowedError, ConnectionReauthorizationRequiredError, ConnectionRequiredError, ConnectionResolverStoreError, ConnectionSelectionRequiredError, InvalidConnectionIdError, InvalidResolvedConnectionError, Service } from "./ConnectionResolver.js";
|
|
5
|
+
import { ActionHandlerNotFoundError, ActionNotFoundError, InvalidActionInputError, InvalidActionOutputError } from "./internal/dual/invoke.js";
|
|
6
|
+
import { AuthMethodNotFoundError, Service as Service$1 } from "./DualRuntime.js";
|
|
5
7
|
import { Service as Service$2 } from "./Files.js";
|
|
6
8
|
import "./remote-runtime.js";
|
|
7
9
|
import { Effect, Layer, Schema } from "effect";
|
|
@@ -276,7 +278,7 @@ export declare const Request: Schema.Struct<{
|
|
|
276
278
|
}>]>]>;
|
|
277
279
|
}>;
|
|
278
280
|
export type Failure = typeof Failure.Type;
|
|
279
|
-
export declare const Failure: Schema.Struct<{
|
|
281
|
+
export declare const Failure: Schema.Union<readonly [typeof ActionHandlerError, typeof RetryableActionHandlerError, Schema.Struct<{
|
|
280
282
|
readonly category: Schema.Literals<readonly ["validation", "connection", "handler", "initialization", "protocol"]>;
|
|
281
283
|
/** The Agent Channel failure the host rebuilds as its `ChannelError`. */
|
|
282
284
|
readonly channel: Schema.optionalKey<Schema.Struct<{
|
|
@@ -292,7 +294,7 @@ export declare const Failure: Schema.Struct<{
|
|
|
292
294
|
readonly retryable: Schema.Boolean;
|
|
293
295
|
/** The provider's HTTP status, kept so the host can report why a provider rejected the call. */
|
|
294
296
|
readonly status: Schema.optionalKey<Schema.Int>;
|
|
295
|
-
}>;
|
|
297
|
+
}>]>;
|
|
296
298
|
export type Response = typeof Response.Type;
|
|
297
299
|
export declare const Response: Schema.Union<readonly [Schema.TaggedStruct<"success", {
|
|
298
300
|
readonly identity: Schema.Struct<{
|
|
@@ -304,7 +306,7 @@ export declare const Response: Schema.Union<readonly [Schema.TaggedStruct<"succe
|
|
|
304
306
|
}>;
|
|
305
307
|
readonly value: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
306
308
|
}>, Schema.TaggedStruct<"failure", {
|
|
307
|
-
readonly error: Schema.Struct<{
|
|
309
|
+
readonly error: Schema.Union<readonly [typeof ActionHandlerError, typeof RetryableActionHandlerError, Schema.Struct<{
|
|
308
310
|
readonly category: Schema.Literals<readonly ["validation", "connection", "handler", "initialization", "protocol"]>;
|
|
309
311
|
/** The Agent Channel failure the host rebuilds as its `ChannelError`. */
|
|
310
312
|
readonly channel: Schema.optionalKey<Schema.Struct<{
|
|
@@ -320,7 +322,7 @@ export declare const Response: Schema.Union<readonly [Schema.TaggedStruct<"succe
|
|
|
320
322
|
readonly retryable: Schema.Boolean;
|
|
321
323
|
/** The provider's HTTP status, kept so the host can report why a provider rejected the call. */
|
|
322
324
|
readonly status: Schema.optionalKey<Schema.Int>;
|
|
323
|
-
}>;
|
|
325
|
+
}>]>;
|
|
324
326
|
readonly identity: Schema.Struct<{
|
|
325
327
|
readonly artifactDigest: Schema.String;
|
|
326
328
|
readonly invocationId: Schema.NonEmptyString;
|
|
@@ -528,7 +530,7 @@ export declare const execute: (request: {
|
|
|
528
530
|
value: Schema.Json;
|
|
529
531
|
} | {
|
|
530
532
|
_tag: "failure";
|
|
531
|
-
error:
|
|
533
|
+
error: ActionHandlerError | RetryableActionHandlerError | {
|
|
532
534
|
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
533
535
|
readonly channel?: {
|
|
534
536
|
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
@@ -542,7 +544,7 @@ export declare const execute: (request: {
|
|
|
542
544
|
readonly retryAfterSeconds?: number;
|
|
543
545
|
readonly retryable: boolean;
|
|
544
546
|
readonly status?: number;
|
|
545
|
-
} |
|
|
547
|
+
} | (ActionHandlerError & {
|
|
546
548
|
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
547
549
|
readonly channel?: {
|
|
548
550
|
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
@@ -556,7 +558,287 @@ export declare const execute: (request: {
|
|
|
556
558
|
readonly retryAfterSeconds?: number;
|
|
557
559
|
readonly retryable: boolean;
|
|
558
560
|
readonly status?: number;
|
|
559
|
-
}
|
|
561
|
+
}) | (ActionHandlerNotFoundError & {
|
|
562
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
563
|
+
readonly channel?: {
|
|
564
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
565
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
566
|
+
};
|
|
567
|
+
readonly code: string;
|
|
568
|
+
readonly fields?: readonly {
|
|
569
|
+
readonly path: string;
|
|
570
|
+
}[];
|
|
571
|
+
readonly message: string;
|
|
572
|
+
readonly retryAfterSeconds?: number;
|
|
573
|
+
readonly retryable: boolean;
|
|
574
|
+
readonly status?: number;
|
|
575
|
+
}) | (ActionNotFoundError & {
|
|
576
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
577
|
+
readonly channel?: {
|
|
578
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
579
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
580
|
+
};
|
|
581
|
+
readonly code: string;
|
|
582
|
+
readonly fields?: readonly {
|
|
583
|
+
readonly path: string;
|
|
584
|
+
}[];
|
|
585
|
+
readonly message: string;
|
|
586
|
+
readonly retryAfterSeconds?: number;
|
|
587
|
+
readonly retryable: boolean;
|
|
588
|
+
readonly status?: number;
|
|
589
|
+
}) | (AuthMethodHookError & {
|
|
590
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
591
|
+
readonly channel?: {
|
|
592
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
593
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
594
|
+
};
|
|
595
|
+
readonly code: string;
|
|
596
|
+
readonly fields?: readonly {
|
|
597
|
+
readonly path: string;
|
|
598
|
+
}[];
|
|
599
|
+
readonly message: string;
|
|
600
|
+
readonly retryAfterSeconds?: number;
|
|
601
|
+
readonly retryable: boolean;
|
|
602
|
+
readonly status?: number;
|
|
603
|
+
}) | (AuthMethodNotFoundError & {
|
|
604
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
605
|
+
readonly channel?: {
|
|
606
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
607
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
608
|
+
};
|
|
609
|
+
readonly code: string;
|
|
610
|
+
readonly fields?: readonly {
|
|
611
|
+
readonly path: string;
|
|
612
|
+
}[];
|
|
613
|
+
readonly message: string;
|
|
614
|
+
readonly retryAfterSeconds?: number;
|
|
615
|
+
readonly retryable: boolean;
|
|
616
|
+
readonly status?: number;
|
|
617
|
+
}) | (ChannelError & {
|
|
618
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
619
|
+
readonly channel?: {
|
|
620
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
621
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
622
|
+
};
|
|
623
|
+
readonly code: string;
|
|
624
|
+
readonly fields?: readonly {
|
|
625
|
+
readonly path: string;
|
|
626
|
+
}[];
|
|
627
|
+
readonly message: string;
|
|
628
|
+
readonly retryAfterSeconds?: number;
|
|
629
|
+
readonly retryable: boolean;
|
|
630
|
+
readonly status?: number;
|
|
631
|
+
}) | (ConnectionIdNotAllowedError & {
|
|
632
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
633
|
+
readonly channel?: {
|
|
634
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
635
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
636
|
+
};
|
|
637
|
+
readonly code: string;
|
|
638
|
+
readonly fields?: readonly {
|
|
639
|
+
readonly path: string;
|
|
640
|
+
}[];
|
|
641
|
+
readonly message: string;
|
|
642
|
+
readonly retryAfterSeconds?: number;
|
|
643
|
+
readonly retryable: boolean;
|
|
644
|
+
readonly status?: number;
|
|
645
|
+
}) | (ConnectionReauthorizationRequiredError & {
|
|
646
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
647
|
+
readonly channel?: {
|
|
648
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
649
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
650
|
+
};
|
|
651
|
+
readonly code: string;
|
|
652
|
+
readonly fields?: readonly {
|
|
653
|
+
readonly path: string;
|
|
654
|
+
}[];
|
|
655
|
+
readonly message: string;
|
|
656
|
+
readonly retryAfterSeconds?: number;
|
|
657
|
+
readonly retryable: boolean;
|
|
658
|
+
readonly status?: number;
|
|
659
|
+
}) | (ConnectionRequiredError & {
|
|
660
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
661
|
+
readonly channel?: {
|
|
662
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
663
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
664
|
+
};
|
|
665
|
+
readonly code: string;
|
|
666
|
+
readonly fields?: readonly {
|
|
667
|
+
readonly path: string;
|
|
668
|
+
}[];
|
|
669
|
+
readonly message: string;
|
|
670
|
+
readonly retryAfterSeconds?: number;
|
|
671
|
+
readonly retryable: boolean;
|
|
672
|
+
readonly status?: number;
|
|
673
|
+
}) | (ConnectionResolverStoreError & {
|
|
674
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
675
|
+
readonly channel?: {
|
|
676
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
677
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
678
|
+
};
|
|
679
|
+
readonly code: string;
|
|
680
|
+
readonly fields?: readonly {
|
|
681
|
+
readonly path: string;
|
|
682
|
+
}[];
|
|
683
|
+
readonly message: string;
|
|
684
|
+
readonly retryAfterSeconds?: number;
|
|
685
|
+
readonly retryable: boolean;
|
|
686
|
+
readonly status?: number;
|
|
687
|
+
}) | (ConnectionSelectionRequiredError & {
|
|
688
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
689
|
+
readonly channel?: {
|
|
690
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
691
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
692
|
+
};
|
|
693
|
+
readonly code: string;
|
|
694
|
+
readonly fields?: readonly {
|
|
695
|
+
readonly path: string;
|
|
696
|
+
}[];
|
|
697
|
+
readonly message: string;
|
|
698
|
+
readonly retryAfterSeconds?: number;
|
|
699
|
+
readonly retryable: boolean;
|
|
700
|
+
readonly status?: number;
|
|
701
|
+
}) | (ExpectedOAuth2MethodError & {
|
|
702
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
703
|
+
readonly channel?: {
|
|
704
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
705
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
706
|
+
};
|
|
707
|
+
readonly code: string;
|
|
708
|
+
readonly fields?: readonly {
|
|
709
|
+
readonly path: string;
|
|
710
|
+
}[];
|
|
711
|
+
readonly message: string;
|
|
712
|
+
readonly retryAfterSeconds?: number;
|
|
713
|
+
readonly retryable: boolean;
|
|
714
|
+
readonly status?: number;
|
|
715
|
+
}) | (InvalidActionInputError & {
|
|
716
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
717
|
+
readonly channel?: {
|
|
718
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
719
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
720
|
+
};
|
|
721
|
+
readonly code: string;
|
|
722
|
+
readonly fields?: readonly {
|
|
723
|
+
readonly path: string;
|
|
724
|
+
}[];
|
|
725
|
+
readonly message: string;
|
|
726
|
+
readonly retryAfterSeconds?: number;
|
|
727
|
+
readonly retryable: boolean;
|
|
728
|
+
readonly status?: number;
|
|
729
|
+
}) | (InvalidActionOutputError & {
|
|
730
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
731
|
+
readonly channel?: {
|
|
732
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
733
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
734
|
+
};
|
|
735
|
+
readonly code: string;
|
|
736
|
+
readonly fields?: readonly {
|
|
737
|
+
readonly path: string;
|
|
738
|
+
}[];
|
|
739
|
+
readonly message: string;
|
|
740
|
+
readonly retryAfterSeconds?: number;
|
|
741
|
+
readonly retryable: boolean;
|
|
742
|
+
readonly status?: number;
|
|
743
|
+
}) | (InvalidConnectionIdError & {
|
|
744
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
745
|
+
readonly channel?: {
|
|
746
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
747
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
748
|
+
};
|
|
749
|
+
readonly code: string;
|
|
750
|
+
readonly fields?: readonly {
|
|
751
|
+
readonly path: string;
|
|
752
|
+
}[];
|
|
753
|
+
readonly message: string;
|
|
754
|
+
readonly retryAfterSeconds?: number;
|
|
755
|
+
readonly retryable: boolean;
|
|
756
|
+
readonly status?: number;
|
|
757
|
+
}) | (InvalidResolvedConnectionError & {
|
|
758
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
759
|
+
readonly channel?: {
|
|
760
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
761
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
762
|
+
};
|
|
763
|
+
readonly code: string;
|
|
764
|
+
readonly fields?: readonly {
|
|
765
|
+
readonly path: string;
|
|
766
|
+
}[];
|
|
767
|
+
readonly message: string;
|
|
768
|
+
readonly retryAfterSeconds?: number;
|
|
769
|
+
readonly retryable: boolean;
|
|
770
|
+
readonly status?: number;
|
|
771
|
+
}) | (OAuth2RefreshTokenUnavailableError & {
|
|
772
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
773
|
+
readonly channel?: {
|
|
774
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
775
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
776
|
+
};
|
|
777
|
+
readonly code: string;
|
|
778
|
+
readonly fields?: readonly {
|
|
779
|
+
readonly path: string;
|
|
780
|
+
}[];
|
|
781
|
+
readonly message: string;
|
|
782
|
+
readonly retryAfterSeconds?: number;
|
|
783
|
+
readonly retryable: boolean;
|
|
784
|
+
readonly status?: number;
|
|
785
|
+
}) | (RetryableActionHandlerError & {
|
|
786
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
787
|
+
readonly channel?: {
|
|
788
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
789
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
790
|
+
};
|
|
791
|
+
readonly code: string;
|
|
792
|
+
readonly fields?: readonly {
|
|
793
|
+
readonly path: string;
|
|
794
|
+
}[];
|
|
795
|
+
readonly message: string;
|
|
796
|
+
readonly retryAfterSeconds?: number;
|
|
797
|
+
readonly retryable: boolean;
|
|
798
|
+
readonly status?: number;
|
|
799
|
+
}) | (Schema.SchemaError & {
|
|
800
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
801
|
+
readonly channel?: {
|
|
802
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
803
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
804
|
+
};
|
|
805
|
+
readonly code: string;
|
|
806
|
+
readonly fields?: readonly {
|
|
807
|
+
readonly path: string;
|
|
808
|
+
}[];
|
|
809
|
+
readonly message: string;
|
|
810
|
+
readonly retryAfterSeconds?: number;
|
|
811
|
+
readonly retryable: boolean;
|
|
812
|
+
readonly status?: number;
|
|
813
|
+
}) | ({
|
|
814
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
815
|
+
readonly channel?: {
|
|
816
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
817
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
818
|
+
};
|
|
819
|
+
readonly code: string;
|
|
820
|
+
readonly fields?: readonly {
|
|
821
|
+
readonly path: string;
|
|
822
|
+
}[];
|
|
823
|
+
readonly message: string;
|
|
824
|
+
readonly retryAfterSeconds?: number;
|
|
825
|
+
readonly retryable: boolean;
|
|
826
|
+
readonly status?: number;
|
|
827
|
+
} & ActionHandlerError) | ({
|
|
828
|
+
readonly category: "connection" | "handler" | "initialization" | "protocol" | "validation";
|
|
829
|
+
readonly channel?: {
|
|
830
|
+
readonly code: "handler_unavailable" | "invalid_auth" | "invalid_definition" | "invalid_input" | "invalid_result" | "not_found" | "provider_failure" | "unsupported_feature";
|
|
831
|
+
readonly providerCode?: "rate_limited" | "rejected" | "unauthorized" | "unavailable" | "unknown_completion" | "window_closed";
|
|
832
|
+
};
|
|
833
|
+
readonly code: string;
|
|
834
|
+
readonly fields?: readonly {
|
|
835
|
+
readonly path: string;
|
|
836
|
+
}[];
|
|
837
|
+
readonly message: string;
|
|
838
|
+
readonly retryAfterSeconds?: number;
|
|
839
|
+
readonly retryable: boolean;
|
|
840
|
+
readonly status?: number;
|
|
841
|
+
} & RetryableActionHandlerError);
|
|
560
842
|
identity: {
|
|
561
843
|
readonly artifactDigest: string;
|
|
562
844
|
readonly invocationId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-runtime.d.ts","names":["Files.Service","ConnectionResolver.Service","AgentChannel.ChannelError","DualRuntime.
|
|
1
|
+
{"version":3,"file":"remote-runtime.d.ts","names":["Files.Service","ConnectionResolver.Service","DualRuntime.ActionHandlerNotFoundError","DualRuntime.ActionNotFoundError","_$__AuthMethod_ts0.AuthMethodHookError","DualRuntime.AuthMethodNotFoundError","AgentChannel.ChannelError","ConnectionResolver.ConnectionIdNotAllowedError","ConnectionResolver.ConnectionReauthorizationRequiredError","ConnectionResolver.ConnectionRequiredError","ConnectionResolver.ConnectionResolverStoreError","ConnectionResolver.ConnectionSelectionRequiredError","_$__AuthMethod_ts0.ExpectedOAuth2MethodError","DualRuntime.InvalidActionInputError","DualRuntime.InvalidActionOutputError","ConnectionResolver.InvalidConnectionIdError","ConnectionResolver.InvalidResolvedConnectionError","_$__AuthMethod_ts0.OAuth2RefreshTokenUnavailableError","DualRuntime.Service"],"sources":["../src/remote-runtime.ts"],"mappings":";;;;;;;;;;;;YA6BY,kBAAkB,SAAS;qBAC1B,UAAQ,OAAA;;;;;;;YAoDT,mBAAmB,UAAU;qBAC5B,WAAS,OAAA,gBAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAeV,oBAAoB,WAAW;qBAC9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Struct({
|
|
|
117
117
|
identity: Identity,
|
|
118
118
|
operation: Operation
|
|
119
119
|
});
|
|
120
|
-
const
|
|
120
|
+
const RuntimeFailure = Schema.Struct({
|
|
121
121
|
category: Schema.Literals([
|
|
122
122
|
"validation",
|
|
123
123
|
"connection",
|
|
@@ -138,6 +138,11 @@ const Failure = Schema.Struct({
|
|
|
138
138
|
/** The provider's HTTP status, kept so the host can report why a provider rejected the call. */
|
|
139
139
|
status: Schema.optionalKey(Schema.Int)
|
|
140
140
|
});
|
|
141
|
+
const Failure = Schema.Union([
|
|
142
|
+
ActionHandlerError,
|
|
143
|
+
RetryableActionHandlerError,
|
|
144
|
+
RuntimeFailure
|
|
145
|
+
]);
|
|
141
146
|
const Response = Schema.Union([Schema.TaggedStruct("success", {
|
|
142
147
|
identity: Identity,
|
|
143
148
|
value: Schema.optionalKey(Schema.Json)
|
|
@@ -146,6 +151,7 @@ const Response = Schema.Union([Schema.TaggedStruct("success", {
|
|
|
146
151
|
identity: Identity
|
|
147
152
|
})]);
|
|
148
153
|
function failure(error) {
|
|
154
|
+
if (Schema.is(ActionHandlerError)(error) || Schema.is(RetryableActionHandlerError)(error)) return error;
|
|
149
155
|
if (Schema.is(ChannelError)(error)) return {
|
|
150
156
|
category: "handler",
|
|
151
157
|
channel: Option.match(Option.fromUndefinedOr(error.providerCode), {
|
|
@@ -159,7 +165,7 @@ function failure(error) {
|
|
|
159
165
|
message: "Agent Channel operation failed",
|
|
160
166
|
retryable: false
|
|
161
167
|
};
|
|
162
|
-
if (Schema.is(FileError)(error)
|
|
168
|
+
if (Schema.is(FileError)(error)) return {
|
|
163
169
|
category: "handler",
|
|
164
170
|
code: "FileError",
|
|
165
171
|
message: "A Dual Files operation failed",
|
|
@@ -172,16 +178,6 @@ function failure(error) {
|
|
|
172
178
|
message: "Plugin action validation failed",
|
|
173
179
|
retryable: false
|
|
174
180
|
};
|
|
175
|
-
if (Schema.is(RetryableActionHandlerError)(error)) return {
|
|
176
|
-
category: "handler",
|
|
177
|
-
code: error._tag,
|
|
178
|
-
message: "Plugin handler failed",
|
|
179
|
-
retryable: true,
|
|
180
|
-
...Option.match(Option.fromUndefinedOr(error.retryAfterSeconds), {
|
|
181
|
-
onNone: () => ({}),
|
|
182
|
-
onSome: (seconds) => ({ retryAfterSeconds: seconds })
|
|
183
|
-
})
|
|
184
|
-
};
|
|
185
181
|
const tag = Predicate.hasProperty(error, "_tag") && Predicate.isString(error._tag) ? error._tag : "PluginHandlerError";
|
|
186
182
|
return {
|
|
187
183
|
category: pipe(Match.value(tag), Match.when("SchemaError", () => "validation"), Match.whenOr("InvalidTriggerConfigError", "InvalidTriggerStateError", "InvalidTriggerOutputError", () => "validation"), Match.whenOr("ConnectionRequiredError", "InvalidConnectionIdError", "InvalidResolvedConnectionError", "ConnectionIdNotAllowedError", "AuthMethodNotFoundError", "AuthMethodHookError", "ExpectedOAuth2MethodError", "OAuth2RefreshTokenUnavailableError", () => "connection"), Match.orElse(() => "handler")),
|
|
@@ -200,7 +196,6 @@ function failure(error) {
|
|
|
200
196
|
"OAuth2RefreshTokenUnavailableError",
|
|
201
197
|
"ActionNotFoundError",
|
|
202
198
|
"ActionHandlerNotFoundError",
|
|
203
|
-
"ActionHandlerError",
|
|
204
199
|
"TriggerNotFoundError",
|
|
205
200
|
"UnsupportedTriggerRuntimeError",
|
|
206
201
|
"FileError",
|
|
@@ -208,8 +203,7 @@ function failure(error) {
|
|
|
208
203
|
"SandboxRequestNotAllowedError"
|
|
209
204
|
], tag) ? tag : "PluginHandlerError",
|
|
210
205
|
message: "Plugin operation failed",
|
|
211
|
-
retryable: false
|
|
212
|
-
...Schema.is(ActionHandlerError)(error) && Schema.is(Schema.Int)(error.status) ? { status: error.status } : {}
|
|
206
|
+
retryable: false
|
|
213
207
|
};
|
|
214
208
|
}
|
|
215
209
|
const unavailableFiles = Service$2.of({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-runtime.js","names":["AgentChannel.VerifiedIdentity","AuthMethodExecution.JsonRequest","AgentChannel.ErrorCode","AgentChannel.FailureCode","AgentChannel.ChannelError","Files.FileError","DualRuntime.InvalidActionInputError","DualRuntime.InvalidActionOutputError","Files.Service","Files.File","ConnectionResolver.Service","DualRuntime.Service"],"sources":["../src/remote-runtime.ts"],"sourcesContent":["/**\n * Data-only SDK lifecycle requests for an installed, isolated integration plugin.\n *\n * @since 0.3.0\n */\nimport {\n Array,\n Cause,\n Effect,\n Layer,\n Match,\n Option,\n Predicate,\n Redacted,\n Schema,\n flow,\n pipe,\n} from \"effect\";\n\nimport { HttpClient, HttpClientRequest } from \"effect/http\";\nimport type { HttpClientResponse } from \"effect/http\";\n\nimport { ActionHandlerError, RetryableActionHandlerError } from \"./Action.ts\";\nimport * as AgentChannel from \"./AgentChannel.ts\";\nimport { AuthMethodExecution } from \"./AuthMethodExecution.ts\";\nimport { ConnectionResolver } from \"./ConnectionResolver.ts\";\nimport { DualRuntime } from \"./DualRuntime.ts\";\nimport { Files } from \"./Files.ts\";\n\nexport type Identity = typeof Identity.Type;\nexport const Identity = Schema.Struct({\n artifactDigest: Schema.String.check(Schema.isPattern(/^[a-f0-9]{128}$/u)),\n invocationId: Schema.NonEmptyString,\n organizationId: Schema.NonEmptyString,\n pluginKey: Schema.NonEmptyString,\n pluginVersion: Schema.NonEmptyString,\n});\n\nconst connection = Schema.Struct({\n connectionId: Schema.NonEmptyString,\n material: Schema.Json,\n methodId: Schema.NonEmptyString,\n providerId: Schema.NonEmptyString,\n setup: Schema.optionalKey(Schema.Json),\n});\nconst context = Schema.Struct({\n actor: Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"user\"), userId: Schema.NonEmptyString }),\n Schema.Struct({ kind: Schema.Literal(\"system\"), reason: Schema.optionalKey(Schema.String) }),\n ]),\n metadata: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),\n source: Schema.Struct({\n kind: Schema.NonEmptyString,\n metadata: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),\n subjectId: Schema.optionalKey(Schema.String),\n }),\n tenant: Schema.Struct({ organizationId: Schema.NonEmptyString, teamId: Schema.NonEmptyString }),\n});\nconst trigger = {\n config: Schema.Json,\n state: Schema.optionalKey(Schema.Json),\n triggerId: Schema.NonEmptyString,\n};\nconst webhook = { ...trigger, webhookUrl: Schema.String };\nconst channel = {\n channelId: Schema.NonEmptyString,\n definitionSettings: Schema.Json,\n deploymentSettings: Schema.Json,\n};\nconst delivery = {\n ...webhook,\n request: Schema.Struct({\n body: Schema.Json,\n headers: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),\n method: Schema.optionalKey(Schema.String),\n query: Schema.optionalKey(\n Schema.Record(Schema.String, Schema.Union([Schema.String, Schema.Array(Schema.String)])),\n ),\n rawBody: Schema.Uint8ArrayFromBase64,\n url: Schema.optionalKey(Schema.String),\n }),\n};\nexport type Operation = typeof Operation.Type;\nexport const Operation = Schema.Union([\n Schema.TaggedStruct(\"invoke\", { actionId: Schema.NonEmptyString, input: Schema.Json }),\n Schema.TaggedStruct(\"activate\", webhook),\n Schema.TaggedStruct(\"deactivate\", webhook),\n Schema.TaggedStruct(\"verify\", delivery),\n Schema.TaggedStruct(\"parse\", delivery),\n Schema.TaggedStruct(\"poll\", trigger),\n Schema.TaggedStruct(\"channelCheckAccess\", {\n ...channel,\n identity: AgentChannel.VerifiedIdentity,\n }),\n Schema.TaggedStruct(\"channelExecute\", { ...channel, command: Schema.Json }),\n AuthMethodExecution.JsonRequest,\n]);\n/** Where this call reads and stores the caller's files, and the token that lets it. */\nexport type FileAccess = typeof FileAccess.Type;\nexport const FileAccess = Schema.Struct({ token: Schema.NonEmptyString, url: Schema.String });\nexport type Request = typeof Request.Type;\nexport const Request = Schema.Struct({\n connection: Schema.optionalKey(connection),\n context,\n files: Schema.optionalKey(FileAccess),\n identity: Identity,\n operation: Operation,\n});\n\nexport type Failure = typeof Failure.Type;\nexport const Failure = Schema.Struct({\n category: Schema.Literals([\"validation\", \"connection\", \"handler\", \"initialization\", \"protocol\"]),\n /** The Agent Channel failure the host rebuilds as its `ChannelError`. */\n channel: Schema.optionalKey(\n Schema.Struct({\n code: AgentChannel.ErrorCode,\n providerCode: Schema.optionalKey(AgentChannel.FailureCode),\n }),\n ),\n code: Schema.String,\n fields: Schema.optionalKey(Schema.Array(Schema.Struct({ path: Schema.String }))),\n message: Schema.String,\n retryAfterSeconds: Schema.optionalKey(Schema.Finite),\n retryable: Schema.Boolean,\n /** The provider's HTTP status, kept so the host can report why a provider rejected the call. */\n status: Schema.optionalKey(Schema.Int),\n});\nexport type Response = typeof Response.Type;\nexport const Response = Schema.Union([\n Schema.TaggedStruct(\"success\", { identity: Identity, value: Schema.optionalKey(Schema.Json) }),\n Schema.TaggedStruct(\"failure\", { error: Failure, identity: Identity }),\n]);\n\n// Plugin causes and schema descriptions can contain credentials or submitted input.\nexport function failure(error: unknown): Failure {\n if (Schema.is(AgentChannel.ChannelError)(error)) {\n return {\n category: \"handler\",\n channel: Option.match(Option.fromUndefinedOr(error.providerCode), {\n onNone: () => ({ code: error.code }),\n onSome: providerCode => ({ code: error.code, providerCode }),\n }),\n code: error._tag,\n message: \"Agent Channel operation failed\",\n retryable: false,\n };\n }\n if (\n Schema.is(Files.FileError)(error) ||\n (Schema.is(ActionHandlerError)(error) && Schema.is(Files.FileError)(error.cause))\n ) {\n return {\n category: \"handler\",\n code: \"FileError\",\n message: \"A Dual Files operation failed\",\n retryable: false,\n };\n }\n if (\n Schema.is(DualRuntime.InvalidActionInputError)(error) ||\n Schema.is(DualRuntime.InvalidActionOutputError)(error)\n ) {\n return {\n category: \"validation\",\n code: error._tag,\n fields: Array.map(error.fields, field => ({ path: field.path })),\n message: \"Plugin action validation failed\",\n retryable: false,\n };\n }\n if (Schema.is(RetryableActionHandlerError)(error)) {\n return {\n category: \"handler\",\n code: error._tag,\n message: \"Plugin handler failed\",\n retryable: true,\n ...Option.match(Option.fromUndefinedOr(error.retryAfterSeconds), {\n onNone: () => ({}),\n onSome: seconds => ({ retryAfterSeconds: seconds }),\n }),\n };\n }\n const tag =\n Predicate.hasProperty(error, \"_tag\") && Predicate.isString(error._tag)\n ? error._tag\n : \"PluginHandlerError\";\n const category = pipe(\n Match.value(tag),\n Match.when(\"SchemaError\", () => \"validation\" as const),\n Match.whenOr(\n \"InvalidTriggerConfigError\",\n \"InvalidTriggerStateError\",\n \"InvalidTriggerOutputError\",\n () => \"validation\" as const,\n ),\n Match.whenOr(\n \"ConnectionRequiredError\",\n \"InvalidConnectionIdError\",\n \"InvalidResolvedConnectionError\",\n \"ConnectionIdNotAllowedError\",\n \"AuthMethodNotFoundError\",\n \"AuthMethodHookError\",\n \"ExpectedOAuth2MethodError\",\n \"OAuth2RefreshTokenUnavailableError\",\n () => \"connection\" as const,\n ),\n Match.orElse(() => \"handler\" as const),\n );\n return {\n category,\n code: Array.contains(\n [\n \"SchemaError\",\n \"InvalidTriggerConfigError\",\n \"InvalidTriggerStateError\",\n \"InvalidTriggerOutputError\",\n \"ConnectionRequiredError\",\n \"InvalidConnectionIdError\",\n \"InvalidResolvedConnectionError\",\n \"ConnectionIdNotAllowedError\",\n \"AuthMethodNotFoundError\",\n \"AuthMethodHookError\",\n \"ExpectedOAuth2MethodError\",\n \"OAuth2RefreshTokenUnavailableError\",\n \"ActionNotFoundError\",\n \"ActionHandlerNotFoundError\",\n \"ActionHandlerError\",\n \"TriggerNotFoundError\",\n \"UnsupportedTriggerRuntimeError\",\n \"FileError\",\n \"SandboxAccessNotDeclaredError\",\n \"SandboxRequestNotAllowedError\",\n ],\n tag,\n )\n ? tag\n : \"PluginHandlerError\",\n message: \"Plugin operation failed\",\n retryable: false,\n ...(Schema.is(ActionHandlerError)(error) && Schema.is(Schema.Int)(error.status)\n ? { status: error.status }\n : {}),\n };\n}\n\nconst unavailableFiles = Files.Service.of({\n read: () =>\n Effect.fail(Files.FileError.make({ message: \"Dual Files is not available to this operation\" })),\n write: () =>\n Effect.fail(Files.FileError.make({ message: \"Dual Files is not available to this operation\" })),\n});\nexport const filesUnavailable = Layer.succeed(Files.Service, unavailableFiles);\n\nconst FileFailure = Schema.Struct({ message: Schema.String });\n\n// The host's file routes do the reading and storing, as the caller the token names.\nfunction filesService(access: FileAccess, http: HttpClient.HttpClient) {\n const client = HttpClient.mapRequest(\n http,\n flow(\n HttpClientRequest.prependUrl(`${access.url}/api/plugin-files`),\n HttpClientRequest.bearerToken(access.token),\n ),\n );\n function call<A>(\n request: HttpClientRequest.HttpClientRequest,\n read: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<A, unknown>,\n ) {\n return pipe(\n Effect.gen(function* () {\n const response = yield* client.execute(request);\n if (response.status < 200 || response.status >= 300) {\n return yield* Files.FileError.make(\n yield* Schema.decodeUnknownEffect(FileFailure)(yield* response.json),\n );\n }\n return yield* read(response);\n }),\n Effect.mapError(cause =>\n Schema.is(Files.FileError)(cause)\n ? cause\n : Files.FileError.make({\n cause: Redacted.make(cause),\n message: \"Cannot reach Dual Files\",\n }),\n ),\n );\n }\n return Files.Service.of({\n read: file =>\n call(HttpClientRequest.get(`/${encodeURIComponent(file.id)}`), response =>\n Effect.map(response.arrayBuffer, buffer => new Uint8Array(buffer)),\n ),\n write: file =>\n call(\n pipe(\n HttpClientRequest.post(\"\", { urlParams: { name: file.name } }),\n HttpClientRequest.bodyUint8Array(file.bytes, file.contentType ?? undefined),\n ),\n response => Effect.flatMap(response.json, Schema.decodeUnknownEffect(Files.File)),\n ),\n });\n}\n\nfunction connectionService(request: Request) {\n return ConnectionResolver.Service.of({\n resolve: input => {\n const selected = request.connection;\n if (selected === undefined) {\n return Effect.fail(ConnectionResolver.ConnectionRequiredError.make(input.target));\n }\n if (\n selected.providerId !== input.target.providerId ||\n (input.connectionId !== undefined && input.connectionId !== selected.connectionId)\n ) {\n return Effect.fail(\n ConnectionResolver.InvalidConnectionIdError.make({\n ...input.target,\n connectionId: input.connectionId ?? selected.connectionId,\n }),\n );\n }\n return Effect.succeed({ ...selected, encoding: \"json\" as const, setup: selected.setup });\n },\n });\n}\nexport function connectionLayer(request: Request) {\n return Layer.succeed(ConnectionResolver.Service, connectionService(request));\n}\n\nconst run = Effect.fnUntraced(\n function* (request: Request) {\n const runtime = yield* DualRuntime.Service;\n const connectionId = Option.match(Option.fromUndefinedOr(request.connection), {\n onNone: () => ({}),\n onSome: selected => ({ connectionId: selected.connectionId }),\n });\n const target = {\n ...connectionId,\n context: request.context,\n pluginKey: request.identity.pluginKey,\n };\n const operation = request.operation;\n if (operation._tag === \"invoke\") {\n return yield* runtime.invokeJson({ ...operation, ...target });\n }\n if (operation._tag === \"poll\") {\n const result = yield* flow(\n runtime.pollTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n if (result.state === undefined) return { events: result.events, meta: result.meta };\n return result;\n }\n if (operation._tag === \"activate\") {\n const result = yield* flow(\n runtime.activateTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n if (result.state === undefined) return { meta: result.meta };\n return result;\n }\n if (operation._tag === \"deactivate\") {\n return yield* flow(\n runtime.deactivateTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n }\n if (operation._tag === \"verify\") {\n return yield* flow(\n runtime.verifyTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n }\n if (operation._tag === \"parse\") {\n const result = yield* flow(\n runtime.parseTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n if (result.state === undefined) return { events: result.events, meta: result.meta };\n return result;\n }\n if (operation._tag === \"channelCheckAccess\") {\n return yield* runtime.checkAccessAgentChannel({\n channelId: operation.channelId,\n definitionSettings: operation.definitionSettings,\n deploymentSettings: operation.deploymentSettings,\n identity: operation.identity,\n ...connectionId,\n });\n }\n if (operation._tag === \"channelExecute\") {\n return yield* runtime.executeAgentChannel({\n channelId: operation.channelId,\n command: operation.command,\n definitionSettings: operation.definitionSettings,\n deploymentSettings: operation.deploymentSettings,\n ...connectionId,\n });\n }\n\n return yield* runtime.executeAuthJson(operation);\n },\n Effect.mapError(error => (Schema.is(Failure)(error) ? error : failure(error))),\n);\n\n/** Execute only in the guest after importing and building its installed plugin. */\nexport const execute = Effect.fn(\"RemoteRuntime.execute\")(function* (request: Request) {\n // The guest runner supplies its fetch client; a host calling in-process has no file routes to reach.\n const http = yield* Effect.serviceOption(HttpClient.HttpClient);\n if (request.identity.organizationId !== request.context.tenant.organizationId) {\n return {\n _tag: \"failure\",\n error: {\n category: \"protocol\",\n code: \"OrganizationMismatch\",\n message: \"Invocation organization does not match its context\",\n retryable: false,\n },\n identity: request.identity,\n } satisfies Response;\n }\n return yield* pipe(\n run(request),\n Effect.provideService(ConnectionResolver.Service, connectionService(request)),\n Effect.provideService(\n Files.Service,\n pipe(\n Option.fromUndefinedOr(request.files),\n Option.flatMap(access => Option.map(http, client => filesService(access, client))),\n Option.getOrElse(() => unavailableFiles),\n ),\n ),\n Effect.flatMap(\n Effect.fnUntraced(function* (value) {\n if (value === undefined) {\n return { _tag: \"success\", identity: request.identity } satisfies Response;\n }\n return {\n _tag: \"success\",\n identity: request.identity,\n value: yield* pipe(\n Schema.decodeUnknownEffect(Schema.Json)(value),\n Effect.mapError(failure),\n ),\n } satisfies Response;\n }),\n ),\n Effect.catch(error =>\n Effect.succeed({ _tag: \"failure\", error, identity: request.identity } satisfies Response),\n ),\n Effect.catchCauseIf(\n cause => !Cause.hasInterrupts(cause),\n () =>\n Effect.succeed({\n _tag: \"failure\",\n error: {\n category: \"handler\",\n code: \"PluginDefect\",\n message: \"Plugin operation failed\",\n retryable: false,\n },\n identity: request.identity,\n } satisfies Response),\n ),\n );\n});\n\nexport * as RemoteRuntime from \"./remote-runtime.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,WAAW,OAAO,OAAO;CACpC,gBAAgB,OAAO,OAAO,MAAM,OAAO,UAAU,kBAAkB,CAAC;CACxE,cAAc,OAAO;CACrB,gBAAgB,OAAO;CACvB,WAAW,OAAO;CAClB,eAAe,OAAO;AACxB,CAAC;AAED,MAAM,a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BAAoB,OAAO,IAAI,CAAC,CAAC,KAAK,GAC7C,OAAO,SAAS,OAAO,CACzB;EACF;CACF,CAAC,CACH,GACA,OAAO,OAAM,UACX,OAAO,QAAQ;EAAE,MAAM;EAAW;EAAO,UAAU,QAAQ;CAAS,CAAoB,CAC1F,GACA,OAAO,cACL,UAAS,CAAC,MAAM,cAAc,KAAK,SAEjC,OAAO,QAAQ;EACb,MAAM;EACN,OAAO;GACL,UAAU;GACV,MAAM;GACN,SAAS;GACT,WAAW;EACb;EACA,UAAU,QAAQ;CACpB,CAAoB,CACxB,CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"remote-runtime.js","names":["AgentChannel.VerifiedIdentity","AuthMethodExecution.JsonRequest","AgentChannel.ErrorCode","AgentChannel.FailureCode","AgentChannel.ChannelError","Files.FileError","DualRuntime.InvalidActionInputError","DualRuntime.InvalidActionOutputError","Files.Service","Files.File","ConnectionResolver.Service","DualRuntime.Service"],"sources":["../src/remote-runtime.ts"],"sourcesContent":["/**\n * Data-only SDK lifecycle requests for an installed, isolated integration plugin.\n *\n * @since 0.3.0\n */\nimport {\n Array,\n Cause,\n Effect,\n Layer,\n Match,\n Option,\n Predicate,\n Redacted,\n Schema,\n flow,\n pipe,\n} from \"effect\";\n\nimport { HttpClient, HttpClientRequest } from \"effect/http\";\nimport type { HttpClientResponse } from \"effect/http\";\n\nimport { ActionHandlerError, RetryableActionHandlerError } from \"./Action.ts\";\nimport * as AgentChannel from \"./AgentChannel.ts\";\nimport { AuthMethodExecution } from \"./AuthMethodExecution.ts\";\nimport { ConnectionResolver } from \"./ConnectionResolver.ts\";\nimport { DualRuntime } from \"./DualRuntime.ts\";\nimport { Files } from \"./Files.ts\";\n\nexport type Identity = typeof Identity.Type;\nexport const Identity = Schema.Struct({\n artifactDigest: Schema.String.check(Schema.isPattern(/^[a-f0-9]{128}$/u)),\n invocationId: Schema.NonEmptyString,\n organizationId: Schema.NonEmptyString,\n pluginKey: Schema.NonEmptyString,\n pluginVersion: Schema.NonEmptyString,\n});\n\nconst connection = Schema.Struct({\n connectionId: Schema.NonEmptyString,\n material: Schema.Json,\n methodId: Schema.NonEmptyString,\n providerId: Schema.NonEmptyString,\n setup: Schema.optionalKey(Schema.Json),\n});\nconst context = Schema.Struct({\n actor: Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"user\"), userId: Schema.NonEmptyString }),\n Schema.Struct({ kind: Schema.Literal(\"system\"), reason: Schema.optionalKey(Schema.String) }),\n ]),\n metadata: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),\n source: Schema.Struct({\n kind: Schema.NonEmptyString,\n metadata: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),\n subjectId: Schema.optionalKey(Schema.String),\n }),\n tenant: Schema.Struct({ organizationId: Schema.NonEmptyString, teamId: Schema.NonEmptyString }),\n});\nconst trigger = {\n config: Schema.Json,\n state: Schema.optionalKey(Schema.Json),\n triggerId: Schema.NonEmptyString,\n};\nconst webhook = { ...trigger, webhookUrl: Schema.String };\nconst channel = {\n channelId: Schema.NonEmptyString,\n definitionSettings: Schema.Json,\n deploymentSettings: Schema.Json,\n};\nconst delivery = {\n ...webhook,\n request: Schema.Struct({\n body: Schema.Json,\n headers: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),\n method: Schema.optionalKey(Schema.String),\n query: Schema.optionalKey(\n Schema.Record(Schema.String, Schema.Union([Schema.String, Schema.Array(Schema.String)])),\n ),\n rawBody: Schema.Uint8ArrayFromBase64,\n url: Schema.optionalKey(Schema.String),\n }),\n};\nexport type Operation = typeof Operation.Type;\nexport const Operation = Schema.Union([\n Schema.TaggedStruct(\"invoke\", { actionId: Schema.NonEmptyString, input: Schema.Json }),\n Schema.TaggedStruct(\"activate\", webhook),\n Schema.TaggedStruct(\"deactivate\", webhook),\n Schema.TaggedStruct(\"verify\", delivery),\n Schema.TaggedStruct(\"parse\", delivery),\n Schema.TaggedStruct(\"poll\", trigger),\n Schema.TaggedStruct(\"channelCheckAccess\", {\n ...channel,\n identity: AgentChannel.VerifiedIdentity,\n }),\n Schema.TaggedStruct(\"channelExecute\", { ...channel, command: Schema.Json }),\n AuthMethodExecution.JsonRequest,\n]);\n/** Where this call reads and stores the caller's files, and the token that lets it. */\nexport type FileAccess = typeof FileAccess.Type;\nexport const FileAccess = Schema.Struct({ token: Schema.NonEmptyString, url: Schema.String });\nexport type Request = typeof Request.Type;\nexport const Request = Schema.Struct({\n connection: Schema.optionalKey(connection),\n context,\n files: Schema.optionalKey(FileAccess),\n identity: Identity,\n operation: Operation,\n});\n\nconst RuntimeFailure = Schema.Struct({\n category: Schema.Literals([\"validation\", \"connection\", \"handler\", \"initialization\", \"protocol\"]),\n /** The Agent Channel failure the host rebuilds as its `ChannelError`. */\n channel: Schema.optionalKey(\n Schema.Struct({\n code: AgentChannel.ErrorCode,\n providerCode: Schema.optionalKey(AgentChannel.FailureCode),\n }),\n ),\n code: Schema.String,\n fields: Schema.optionalKey(Schema.Array(Schema.Struct({ path: Schema.String }))),\n message: Schema.String,\n retryAfterSeconds: Schema.optionalKey(Schema.Finite),\n retryable: Schema.Boolean,\n /** The provider's HTTP status, kept so the host can report why a provider rejected the call. */\n status: Schema.optionalKey(Schema.Int),\n});\nexport type Failure = typeof Failure.Type;\nexport const Failure = Schema.Union([\n ActionHandlerError,\n RetryableActionHandlerError,\n RuntimeFailure,\n]);\nexport type Response = typeof Response.Type;\nexport const Response = Schema.Union([\n Schema.TaggedStruct(\"success\", { identity: Identity, value: Schema.optionalKey(Schema.Json) }),\n Schema.TaggedStruct(\"failure\", { error: Failure, identity: Identity }),\n]);\n\n// Declared Action failures reach the host intact; the host owns public error filtering.\nexport function failure(error: unknown): Failure {\n if (Schema.is(ActionHandlerError)(error) || Schema.is(RetryableActionHandlerError)(error)) {\n return error;\n }\n if (Schema.is(AgentChannel.ChannelError)(error)) {\n return {\n category: \"handler\",\n channel: Option.match(Option.fromUndefinedOr(error.providerCode), {\n onNone: () => ({ code: error.code }),\n onSome: providerCode => ({ code: error.code, providerCode }),\n }),\n code: error._tag,\n message: \"Agent Channel operation failed\",\n retryable: false,\n };\n }\n if (Schema.is(Files.FileError)(error)) {\n return {\n category: \"handler\",\n code: \"FileError\",\n message: \"A Dual Files operation failed\",\n retryable: false,\n };\n }\n if (\n Schema.is(DualRuntime.InvalidActionInputError)(error) ||\n Schema.is(DualRuntime.InvalidActionOutputError)(error)\n ) {\n return {\n category: \"validation\",\n code: error._tag,\n fields: Array.map(error.fields, field => ({ path: field.path })),\n message: \"Plugin action validation failed\",\n retryable: false,\n };\n }\n const tag =\n Predicate.hasProperty(error, \"_tag\") && Predicate.isString(error._tag)\n ? error._tag\n : \"PluginHandlerError\";\n const category = pipe(\n Match.value(tag),\n Match.when(\"SchemaError\", () => \"validation\" as const),\n Match.whenOr(\n \"InvalidTriggerConfigError\",\n \"InvalidTriggerStateError\",\n \"InvalidTriggerOutputError\",\n () => \"validation\" as const,\n ),\n Match.whenOr(\n \"ConnectionRequiredError\",\n \"InvalidConnectionIdError\",\n \"InvalidResolvedConnectionError\",\n \"ConnectionIdNotAllowedError\",\n \"AuthMethodNotFoundError\",\n \"AuthMethodHookError\",\n \"ExpectedOAuth2MethodError\",\n \"OAuth2RefreshTokenUnavailableError\",\n () => \"connection\" as const,\n ),\n Match.orElse(() => \"handler\" as const),\n );\n return {\n category,\n code: Array.contains(\n [\n \"SchemaError\",\n \"InvalidTriggerConfigError\",\n \"InvalidTriggerStateError\",\n \"InvalidTriggerOutputError\",\n \"ConnectionRequiredError\",\n \"InvalidConnectionIdError\",\n \"InvalidResolvedConnectionError\",\n \"ConnectionIdNotAllowedError\",\n \"AuthMethodNotFoundError\",\n \"AuthMethodHookError\",\n \"ExpectedOAuth2MethodError\",\n \"OAuth2RefreshTokenUnavailableError\",\n \"ActionNotFoundError\",\n \"ActionHandlerNotFoundError\",\n \"TriggerNotFoundError\",\n \"UnsupportedTriggerRuntimeError\",\n \"FileError\",\n \"SandboxAccessNotDeclaredError\",\n \"SandboxRequestNotAllowedError\",\n ],\n tag,\n )\n ? tag\n : \"PluginHandlerError\",\n message: \"Plugin operation failed\",\n retryable: false,\n };\n}\n\nconst unavailableFiles = Files.Service.of({\n read: () =>\n Effect.fail(Files.FileError.make({ message: \"Dual Files is not available to this operation\" })),\n write: () =>\n Effect.fail(Files.FileError.make({ message: \"Dual Files is not available to this operation\" })),\n});\nexport const filesUnavailable = Layer.succeed(Files.Service, unavailableFiles);\n\nconst FileFailure = Schema.Struct({ message: Schema.String });\n\n// The host's file routes do the reading and storing, as the caller the token names.\nfunction filesService(access: FileAccess, http: HttpClient.HttpClient) {\n const client = HttpClient.mapRequest(\n http,\n flow(\n HttpClientRequest.prependUrl(`${access.url}/api/plugin-files`),\n HttpClientRequest.bearerToken(access.token),\n ),\n );\n function call<A>(\n request: HttpClientRequest.HttpClientRequest,\n read: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<A, unknown>,\n ) {\n return pipe(\n Effect.gen(function* () {\n const response = yield* client.execute(request);\n if (response.status < 200 || response.status >= 300) {\n return yield* Files.FileError.make(\n yield* Schema.decodeUnknownEffect(FileFailure)(yield* response.json),\n );\n }\n return yield* read(response);\n }),\n Effect.mapError(cause =>\n Schema.is(Files.FileError)(cause)\n ? cause\n : Files.FileError.make({\n cause: Redacted.make(cause),\n message: \"Cannot reach Dual Files\",\n }),\n ),\n );\n }\n return Files.Service.of({\n read: file =>\n call(HttpClientRequest.get(`/${encodeURIComponent(file.id)}`), response =>\n Effect.map(response.arrayBuffer, buffer => new Uint8Array(buffer)),\n ),\n write: file =>\n call(\n pipe(\n HttpClientRequest.post(\"\", { urlParams: { name: file.name } }),\n HttpClientRequest.bodyUint8Array(file.bytes, file.contentType ?? undefined),\n ),\n response => Effect.flatMap(response.json, Schema.decodeUnknownEffect(Files.File)),\n ),\n });\n}\n\nfunction connectionService(request: Request) {\n return ConnectionResolver.Service.of({\n resolve: input => {\n const selected = request.connection;\n if (selected === undefined) {\n return Effect.fail(ConnectionResolver.ConnectionRequiredError.make(input.target));\n }\n if (\n selected.providerId !== input.target.providerId ||\n (input.connectionId !== undefined && input.connectionId !== selected.connectionId)\n ) {\n return Effect.fail(\n ConnectionResolver.InvalidConnectionIdError.make({\n ...input.target,\n connectionId: input.connectionId ?? selected.connectionId,\n }),\n );\n }\n return Effect.succeed({ ...selected, encoding: \"json\" as const, setup: selected.setup });\n },\n });\n}\nexport function connectionLayer(request: Request) {\n return Layer.succeed(ConnectionResolver.Service, connectionService(request));\n}\n\nconst run = Effect.fnUntraced(\n function* (request: Request) {\n const runtime = yield* DualRuntime.Service;\n const connectionId = Option.match(Option.fromUndefinedOr(request.connection), {\n onNone: () => ({}),\n onSome: selected => ({ connectionId: selected.connectionId }),\n });\n const target = {\n ...connectionId,\n context: request.context,\n pluginKey: request.identity.pluginKey,\n };\n const operation = request.operation;\n if (operation._tag === \"invoke\") {\n return yield* runtime.invokeJson({ ...operation, ...target });\n }\n if (operation._tag === \"poll\") {\n const result = yield* flow(\n runtime.pollTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n if (result.state === undefined) return { events: result.events, meta: result.meta };\n return result;\n }\n if (operation._tag === \"activate\") {\n const result = yield* flow(\n runtime.activateTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n if (result.state === undefined) return { meta: result.meta };\n return result;\n }\n if (operation._tag === \"deactivate\") {\n return yield* flow(\n runtime.deactivateTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n }\n if (operation._tag === \"verify\") {\n return yield* flow(\n runtime.verifyTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n }\n if (operation._tag === \"parse\") {\n const result = yield* flow(\n runtime.parseTrigger,\n Effect.mapError(failure),\n )({ ...operation, ...target });\n if (result.state === undefined) return { events: result.events, meta: result.meta };\n return result;\n }\n if (operation._tag === \"channelCheckAccess\") {\n return yield* runtime.checkAccessAgentChannel({\n channelId: operation.channelId,\n definitionSettings: operation.definitionSettings,\n deploymentSettings: operation.deploymentSettings,\n identity: operation.identity,\n ...connectionId,\n });\n }\n if (operation._tag === \"channelExecute\") {\n return yield* runtime.executeAgentChannel({\n channelId: operation.channelId,\n command: operation.command,\n definitionSettings: operation.definitionSettings,\n deploymentSettings: operation.deploymentSettings,\n ...connectionId,\n });\n }\n\n return yield* runtime.executeAuthJson(operation);\n },\n Effect.mapError(error => (Schema.is(Failure)(error) ? error : failure(error))),\n);\n\n/** Execute only in the guest after importing and building its installed plugin. */\nexport const execute = Effect.fn(\"RemoteRuntime.execute\")(function* (request: Request) {\n // The guest runner supplies its fetch client; a host calling in-process has no file routes to reach.\n const http = yield* Effect.serviceOption(HttpClient.HttpClient);\n if (request.identity.organizationId !== request.context.tenant.organizationId) {\n return {\n _tag: \"failure\",\n error: {\n category: \"protocol\",\n code: \"OrganizationMismatch\",\n message: \"Invocation organization does not match its context\",\n retryable: false,\n },\n identity: request.identity,\n } satisfies Response;\n }\n return yield* pipe(\n run(request),\n Effect.provideService(ConnectionResolver.Service, connectionService(request)),\n Effect.provideService(\n Files.Service,\n pipe(\n Option.fromUndefinedOr(request.files),\n Option.flatMap(access => Option.map(http, client => filesService(access, client))),\n Option.getOrElse(() => unavailableFiles),\n ),\n ),\n Effect.flatMap(\n Effect.fnUntraced(function* (value) {\n if (value === undefined) {\n return { _tag: \"success\", identity: request.identity } satisfies Response;\n }\n return {\n _tag: \"success\",\n identity: request.identity,\n value: yield* pipe(\n Schema.decodeUnknownEffect(Schema.Json)(value),\n Effect.mapError(failure),\n ),\n } satisfies Response;\n }),\n ),\n Effect.catch(error =>\n Effect.succeed({ _tag: \"failure\", error, identity: request.identity } satisfies Response),\n ),\n Effect.catchCauseIf(\n cause => !Cause.hasInterrupts(cause),\n () =>\n Effect.succeed({\n _tag: \"failure\",\n error: {\n category: \"handler\",\n code: \"PluginDefect\",\n message: \"Plugin operation failed\",\n retryable: false,\n },\n identity: request.identity,\n } satisfies Response),\n ),\n );\n});\n\nexport * as RemoteRuntime from \"./remote-runtime.ts\";\n"],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