@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.
@@ -15,14 +15,7 @@ export const Key = Schema.NonEmptyString.check(
15
15
  Schema.isMaxLength(512),
16
16
  Schema.isPattern(/^[^\p{Cc}]+$/u),
17
17
  );
18
- /**
19
- * The command and result schemas a version uses. Absent means the original protocol, whose
20
- * projection stays byte-identical for contracts already published with it. `v2` adds the stop
21
- * event, conversation reads and output operations.
22
- */
23
- export const Protocol = Schema.Literals(["v2"]);
24
- export type Protocol = typeof Protocol.Type;
25
- /** What a `v2` destination can show. Every channel shows `present_outcome`. */
18
+ /** What a destination can show. Every channel shows `present_outcome`. */
26
19
  export const OperationKind = Schema.Literals([
27
20
  "present_outcome",
28
21
  "create_message",
@@ -43,9 +36,9 @@ export const Features = Schema.Struct({
43
36
  /** Maximum Unicode code points per physical text message, including server-added prefixes. */
44
37
  maxTextLength: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),
45
38
  mentions: Schema.Boolean,
46
- /** `v2` only: the output operations every destination of this version shows. */
39
+ /** Every definition declares operations; retired catalog contracts still decode without them. */
47
40
  operations: Schema.optionalKey(Schema.Array(OperationKind)),
48
- /** `v2` only: whether `read_context` returns the conversation's earlier messages. */
41
+ /** Whether `read_context` returns the conversation's earlier messages. */
49
42
  readContext: Schema.optionalKey(Schema.Boolean),
50
43
  replies: Schema.Boolean,
51
44
  /** Maximum age of the original responding input before preparation and delivery. */
@@ -193,9 +186,7 @@ export const Echo = Schema.Struct({
193
186
  messageKey: Key,
194
187
  timestamp: Timestamp,
195
188
  });
196
- export const Event = Schema.Union([Message, Echo, DeliveryUpdate]);
197
- export type Event = typeof Event.Type;
198
- /** `v2`: the sender asked the agent to stop working in this conversation. Access applies. */
189
+ /** The sender asked the agent to stop working in this conversation. Access applies. */
199
190
  export const Stop = Schema.Struct({
200
191
  ...VerifiedIdentity.fields,
201
192
  eventKey: Key,
@@ -203,10 +194,10 @@ export const Stop = Schema.Struct({
203
194
  kind: Schema.Literal("stop"),
204
195
  timestamp: Timestamp,
205
196
  });
206
- export const EventV2 = Schema.Union([Message, Echo, DeliveryUpdate, Stop]);
207
- export type EventV2 = typeof EventV2.Type;
197
+ export const Event = Schema.Union([Message, Echo, DeliveryUpdate, Stop]);
198
+ export type Event = typeof Event.Type;
208
199
 
209
- /** The reactions every `v2` provider can show. Each provider maps them to its own emoji. */
200
+ /** The reactions every provider can show. Each provider maps them to its own emoji. */
210
201
  export const Reaction = Schema.Literals([
211
202
  "thumbs_up",
212
203
  "thumbs_down",
@@ -235,7 +226,7 @@ export const Plan = Schema.Struct({
235
226
  });
236
227
  export type Plan = typeof Plan.Type;
237
228
  /**
238
- * One piece of `v2` output. A `reference` is the `providerDeliveryKey` the provider returned for
229
+ * One piece of output. A `reference` is the `providerDeliveryKey` the provider returned for
239
230
  * the message or plan it made; only that provider reads it.
240
231
  */
241
232
  export const Operation = Schema.Union([
@@ -346,30 +337,6 @@ export class ChannelError extends Schema.TaggedError<ChannelError>()("AgentChann
346
337
  }
347
338
 
348
339
  const installedCommandSchema = <State extends Schema.Top>(state: State) => {
349
- const operation = { extensions: Schema.optionalKey(Extensions), operationKey: Key };
350
- const installed = { ...operation, installationKey: Key, state };
351
- return Schema.Union([
352
- Schema.Struct({
353
- kind: Schema.Literal("activate"),
354
- ...operation,
355
- ingressUrl: HttpUrl,
356
- state: Schema.optionalKey(state),
357
- }),
358
- Schema.Struct({ kind: Schema.Literal("deactivate"), ...installed }),
359
- Schema.Struct({ kind: Schema.Literal("receive"), ...installed, request: Request }),
360
- Schema.Struct({
361
- kind: Schema.Literal("deliver"),
362
- ...installed,
363
- deliveryKey: Key,
364
- destination: Destination,
365
- content: Content,
366
- /** Original responding input timestamp; retries must preserve this reference. */
367
- responseToTimestamp: Schema.optionalKey(Timestamp),
368
- }),
369
- ]);
370
- };
371
-
372
- const installedCommandSchemaV2 = <State extends Schema.Top>(state: State) => {
373
340
  const operation = { extensions: Schema.optionalKey(Extensions), operationKey: Key };
374
341
  const installed = { ...operation, installationKey: Key, state };
375
342
  return Schema.Union([
@@ -453,60 +420,6 @@ const installedResultSchema = <State extends Schema.Top>(state: State) => {
453
420
  "window_closed",
454
421
  ]),
455
422
  }),
456
- ]);
457
- };
458
- // `v2` keeps every `v1` result except `receive`, which also carries stop events.
459
- const installedResultSchemaV2 = <State extends Schema.Top>(state: State) => {
460
- const operation = { extensions: Schema.optionalKey(Extensions), operationKey: Key };
461
- return Schema.Union([
462
- Schema.Struct({
463
- kind: Schema.Literal("activate"),
464
- ...operation,
465
- installationKey: Key,
466
- state,
467
- /** Durable read-only provider state that the host must persist before retrying activation. */
468
- checkpoint: Schema.optionalKey(Schema.Literal(true)),
469
- /** The host must observe a verified webhook handshake before cutover. */
470
- verification: Schema.optionalKey(Schema.Literal("ingress")),
471
- }),
472
- Schema.Struct({ kind: Schema.Literal("deactivate"), ...operation }),
473
- Schema.Struct({
474
- kind: Schema.Literal("receive"),
475
- ...operation,
476
- verified: Schema.Literal(true),
477
- deniedEventKeys: Schema.optionalKey(Schema.Array(Key).check(Schema.isMaxLength(100))),
478
- events: Schema.Array(EventV2).check(Schema.isMaxLength(100)),
479
- response: Schema.optionalKey(WebhookResponse),
480
- /** A provider-native setup challenge or ping proved the configured ingress. */
481
- activationProof: Schema.optionalKey(Schema.Literal("verified")),
482
- }),
483
- Schema.Struct({
484
- kind: Schema.Literal("deliver"),
485
- ...operation,
486
- deliveryKey: Key,
487
- status: Schema.Literal("succeeded"),
488
- providerDeliveryKey: Key,
489
- }),
490
- Schema.Struct({
491
- kind: Schema.Literal("deliver"),
492
- ...operation,
493
- deliveryKey: Key,
494
- status: Schema.Literal("pending"),
495
- providerDeliveryKey: Key,
496
- }),
497
- Schema.Struct({
498
- kind: Schema.Literal("deliver"),
499
- ...operation,
500
- deliveryKey: Key,
501
- status: Schema.Literal("failed"),
502
- code: Schema.Literals([
503
- "rejected",
504
- "unauthorized",
505
- "rate_limited",
506
- "unavailable",
507
- "window_closed",
508
- ]),
509
- }),
510
423
  Schema.Struct({
511
424
  kind: Schema.Literal("read_context"),
512
425
  ...operation,
@@ -535,29 +448,19 @@ export const commandSchema = <State extends Schema.Top>(state: State) =>
535
448
  Schema.Union([installedCommandSchema(state), readAssetCommand(state)]);
536
449
  export const resultSchema = <State extends Schema.Top>(state: State) =>
537
450
  Schema.Union([installedResultSchema(state), readAssetResult]);
538
- export const commandSchemaV2 = <State extends Schema.Top>(state: State) =>
539
- Schema.Union([installedCommandSchemaV2(state), readAssetCommand(state)]);
540
- export const resultSchemaV2 = <State extends Schema.Top>(state: State) =>
541
- Schema.Union([installedResultSchemaV2(state), readAssetResult]);
542
451
  export type Command<State extends Schema.Top = Schema.Unknown> = ReturnType<
543
452
  typeof commandSchema<State>
544
453
  >["Type"];
545
454
  export type Result<State extends Schema.Top = Schema.Unknown> = ReturnType<
546
455
  typeof resultSchema<State>
547
456
  >["Type"];
548
- export type CommandV2<State extends Schema.Top = Schema.Unknown> = ReturnType<
549
- typeof commandSchemaV2<State>
550
- >["Type"];
551
- export type ResultV2<State extends Schema.Top = Schema.Unknown> = ReturnType<
552
- typeof resultSchemaV2<State>
553
- >["Type"];
554
457
  /** Maximum UTF-8 bytes in an ordinary Channel command or result, including its JSON envelope. */
555
458
  export const resultByteLimit = 2_097_152;
556
459
  /** Keep the newest context messages within the checked result budget, oldest first. */
557
460
  export function contextResult(
558
461
  operationKey: string,
559
462
  context: readonly ContextMessage[],
560
- ): Extract<ResultV2, { readonly kind: "read_context" }> {
463
+ ): Extract<Result, { readonly kind: "read_context" }> {
561
464
  const messages: ContextMessage[] = [];
562
465
  const result = { kind: "read_context" as const, messages, operationKey };
563
466
  const encoder = new TextEncoder();
@@ -572,25 +475,8 @@ export function contextResult(
572
475
  }
573
476
  return result;
574
477
  }
575
- /** The command and result schemas of a Channel's protocol. */
576
- export const schemasFor = (definition: Pick<Definition, "protocol" | "state">) =>
577
- definition.protocol === "v2"
578
- ? {
579
- command: commandSchemaV2(definition.state),
580
- result: resultSchemaV2(definition.state),
581
- typeResult: resultSchemaV2(Schema.toType(definition.state)),
582
- }
583
- : {
584
- command: commandSchema(definition.state),
585
- result: resultSchema(definition.state),
586
- typeResult: resultSchema(Schema.toType(definition.state)),
587
- };
588
-
589
- /**
590
- * Encoded, JSON-safe runtime result suitable for host persistence. It accepts both protocols;
591
- * a `v1` result decodes unchanged.
592
- */
593
- export const CheckedResult = resultSchemaV2(Schema.Json);
478
+ /** Encoded, JSON-safe runtime result suitable for host persistence. */
479
+ export const CheckedResult = resultSchema(Schema.Json);
594
480
  export type CheckedResult = typeof CheckedResult.Type;
595
481
 
596
482
  /** Immutable catalog projection. Live schemas remain the execution validators. */
@@ -599,10 +485,11 @@ export const Contract = Schema.Struct({
599
485
  deploymentSettingsSchemaJson: Schema.Json,
600
486
  exposure: Exposure,
601
487
  extensionsSchemaJson: Schema.Record(Schema.String, Schema.Json),
602
- featuresJson: Features,
488
+ featuresJson: Features.check(
489
+ Schema.makeFilter(features => (features.operations ?? []).includes("present_outcome")),
490
+ ),
603
491
  operationInputSchemaJson: Schema.Json,
604
492
  operationOutputSchemaJson: Schema.Json,
605
- protocol: Schema.optionalKey(Protocol),
606
493
  requiredChecks: RequiredChecks,
607
494
  stateSchemaJson: Schema.Json,
608
495
  });
@@ -614,8 +501,6 @@ export interface Definition<
614
501
  State extends Schema.Top = Schema.Top,
615
502
  Methods extends readonly AuthMethod.Any[] = readonly AuthMethod.Any[],
616
503
  > {
617
- /** Absent for the original protocol. Publish a new release to change it. */
618
- readonly protocol?: Protocol;
619
504
  readonly definitionSettings: Settings;
620
505
  readonly deploymentSettings: Mappings;
621
506
  readonly state: State;
@@ -632,9 +517,8 @@ export const projectContract = (
632
517
  definition: Definition,
633
518
  project: (schema: Schema.Top) => unknown = schema =>
634
519
  Schema.toJsonSchemaDocument(schema, { onExcessProperty: "error" }),
635
- ): Contract => {
636
- const schemas = schemasFor(definition);
637
- return Schema.decodeUnknownSync(Contract)(
520
+ ): Contract =>
521
+ Schema.decodeUnknownSync(Contract)(
638
522
  {
639
523
  definitionSettingsSchemaJson: project(definition.definitionSettings),
640
524
  deploymentSettingsSchemaJson: project(definition.deploymentSettings),
@@ -643,15 +527,13 @@ export const projectContract = (
643
527
  Object.entries(definition.extensions ?? {}).map(([key, schema]) => [key, project(schema)]),
644
528
  ),
645
529
  featuresJson: definition.features,
646
- operationInputSchemaJson: project(schemas.command),
647
- operationOutputSchemaJson: project(schemas.result),
648
- ...(definition.protocol === undefined ? {} : { protocol: definition.protocol }),
530
+ operationInputSchemaJson: project(commandSchema(definition.state)),
531
+ operationOutputSchemaJson: project(resultSchema(definition.state)),
649
532
  requiredChecks: definition.requiredChecks,
650
533
  stateSchemaJson: project(definition.state),
651
534
  },
652
535
  { onExcessProperty: "error" },
653
536
  );
654
- };
655
537
  export interface Any extends Pipeable.Pipeable {
656
538
  readonly [TypeId]: TypeId;
657
539
  readonly identifier: string;
@@ -680,14 +562,10 @@ export type HandlerContext<D extends Definition> = {
680
562
  : number extends D["authMethods"]["length"]
681
563
  ? { readonly auth?: ResolvedAuth<D["authMethods"]> }
682
564
  : { readonly auth: ResolvedAuth<D["authMethods"]> });
683
- /** The command a Channel's handler receives, by its protocol. */
684
- export type CommandFor<D extends Definition> = D extends { readonly protocol: "v2" }
685
- ? CommandV2<D["state"]>
686
- : Command<D["state"]>;
687
- /** The result a Channel's handler returns, by its protocol. */
688
- export type ResultFor<D extends Definition> = D extends { readonly protocol: "v2" }
689
- ? ResultV2<D["state"]>
690
- : Result<D["state"]>;
565
+ /** The command a Channel's handler receives. */
566
+ export type CommandFor<D extends Definition> = Command<D["state"]>;
567
+ /** The result a Channel's handler returns. */
568
+ export type ResultFor<D extends Definition> = Result<D["state"]>;
691
569
  export interface RuntimeContract<D extends Definition, R = never> {
692
570
  readonly verify: (
693
571
  request: Request,
@@ -789,14 +667,10 @@ const DefinitionSchema = Schema.Struct({
789
667
  ),
790
668
  ),
791
669
  features: Features,
792
- protocol: Schema.optionalKey(Protocol),
793
670
  requiredChecks: RequiredChecks,
794
671
  state: SchemaDefinition,
795
672
  }).check(
796
- Schema.makeFilter(({ features, protocol }) => {
797
- if (protocol === undefined) {
798
- return features.operations === undefined && features.readContext === undefined;
799
- }
673
+ Schema.makeFilter(({ features }) => {
800
674
  const operations = features.operations ?? [];
801
675
  return (
802
676
  operations.includes("present_outcome") &&
@@ -4,11 +4,7 @@ import { Effect, Schema } from "effect";
4
4
  import * as AgentChannel from "./AgentChannel.ts";
5
5
  import * as DualRuntime from "./DualRuntime.ts";
6
6
 
7
- // Either protocol: the runtime checks each command against the Channel's own protocol.
8
- const Command = Schema.Union([
9
- AgentChannel.commandSchema(Schema.Json),
10
- AgentChannel.commandSchemaV2(Schema.Json),
11
- ]);
7
+ const Command = AgentChannel.commandSchema(Schema.Json);
12
8
  export const Fixture = Schema.Struct({
13
9
  activate: Command,
14
10
  channelId: AgentChannel.Key,
@@ -113,7 +109,7 @@ export const run = Effect.fn("AgentChannelConformance.run")(function* (input: Fi
113
109
  if (
114
110
  first.kind !== "receive" ||
115
111
  nextReceipt.kind !== "receive" ||
116
- !Schema.toEquivalence(Schema.Array(AgentChannel.EventV2))(first.events, nextReceipt.events)
112
+ !Schema.toEquivalence(Schema.Array(AgentChannel.Event))(first.events, nextReceipt.events)
117
113
  ) {
118
114
  return yield* new ConformanceError({ command: kind, rule: "stable_events" });
119
115
  }
@@ -187,12 +187,10 @@ const checkMessage = (
187
187
 
188
188
  const checkDelivery = (
189
189
  features: AgentChannel.Features,
190
- command: Extract<AgentChannel.Command | AgentChannel.CommandV2, { kind: "deliver" }>,
190
+ command: Extract<AgentChannel.Command, { kind: "deliver" }>,
191
191
  ): boolean =>
192
- "content" in command
193
- ? checkMessage(features, command.destination, command.content)
194
- : checkMessage(features, command.destination, { text: "" }) &&
195
- (features.operations ?? []).includes(command.operation.kind);
192
+ checkMessage(features, command.destination, { text: "" }) &&
193
+ (features.operations ?? []).includes(command.operation.kind);
196
194
 
197
195
  const Material = Schema.Struct({
198
196
  connectionId: AgentChannel.Key,
@@ -390,9 +388,8 @@ export const layer = <P extends Plugin.Any>(
390
388
  request.deploymentSettings,
391
389
  "invalid_input",
392
390
  );
393
- const schemas = AgentChannel.schemasFor(definition);
394
- const command: AgentChannel.Command | AgentChannel.CommandV2 = yield* decodeData(
395
- schemas.command,
391
+ const command: AgentChannel.Command = yield* decodeData(
392
+ AgentChannel.commandSchema(definition.state),
396
393
  request.command,
397
394
  "invalid_input",
398
395
  );
@@ -405,7 +402,6 @@ export const layer = <P extends Plugin.Any>(
405
402
  }
406
403
  if (
407
404
  command.kind === "deliver" &&
408
- "operation" in command &&
409
405
  command.operation.kind === "set_reaction" &&
410
406
  command.operation.target.kind === "activation" &&
411
407
  command.activationMessageKey === undefined
@@ -485,8 +481,8 @@ export const layer = <P extends Plugin.Any>(
485
481
  handler.value,
486
482
  Effect.suspend(() => handler.value.runtime.execute(command, adapterContext)),
487
483
  );
488
- const result: AgentChannel.Result | AgentChannel.ResultV2 = yield* decodeData(
489
- schemas.typeResult,
484
+ const result: AgentChannel.Result = yield* decodeData(
485
+ AgentChannel.resultSchema(Schema.toType(definition.state)),
490
486
  output,
491
487
  "invalid_result",
492
488
  kind === "read_asset",
@@ -507,7 +503,7 @@ export const layer = <P extends Plugin.Any>(
507
503
  ) {
508
504
  return yield* fail("invalid_result");
509
505
  }
510
- const allowedEvents: AgentChannel.EventV2[] = [];
506
+ const allowedEvents: AgentChannel.Event[] = [];
511
507
  const deniedEventKeys: string[] = [];
512
508
  if (result.kind === "receive") {
513
509
  if (result.deniedEventKeys !== undefined) return yield* fail("invalid_result");
@@ -563,7 +559,7 @@ export const layer = <P extends Plugin.Any>(
563
559
  }
564
560
  // Store the encoded state so subsequent pinned commands can decode it exactly once.
565
561
  const encoded = yield* safe(
566
- Schema.encodeUnknownEffect(schemas.result)(
562
+ Schema.encodeUnknownEffect(AgentChannel.resultSchema(definition.state))(
567
563
  result.kind === "receive"
568
564
  ? {
569
565
  ...result,
@@ -368,12 +368,17 @@ const executeAuth = Effect.fnUntraced(
368
368
  ),
369
369
  Effect.catch(error => {
370
370
  const cause = error._tag === "AuthMethodHookError" ? error.cause : error;
371
+ const failure = RemoteRuntime.failure(error);
372
+ if (Schema.is(OAuthGrantRejected)(cause) && !("_tag" in failure)) {
373
+ return Effect.succeed({
374
+ _tag: "failure" as const,
375
+ error: { ...failure, code: "OAuthGrantRejected" },
376
+ identity: request.identity,
377
+ });
378
+ }
371
379
  return Effect.succeed({
372
380
  _tag: "failure" as const,
373
- error: {
374
- ...RemoteRuntime.failure(error),
375
- ...(Schema.is(OAuthGrantRejected)(cause) ? { code: "OAuthGrantRejected" } : {}),
376
- },
381
+ error: failure,
377
382
  identity: request.identity,
378
383
  });
379
384
  }),
@@ -106,8 +106,6 @@ export interface MaterializedChannelCapabilityVersion {
106
106
  readonly extensionsSchemaJson: Readonly<Record<string, unknown>>;
107
107
  readonly featuresJson: AgentChannel.Features;
108
108
  readonly exposure: typeof AgentChannel.Exposure.Type;
109
- /** Absent for the original protocol. */
110
- readonly protocol?: AgentChannel.Protocol;
111
109
  readonly requiredChecks: typeof AgentChannel.RequiredChecks.Type;
112
110
  }
113
111
  export type MaterializedCapabilityVersion =
@@ -112,8 +112,11 @@ export const toHandlers = (
112
112
  handlers: Declarations,
113
113
  ): Effect.Effect<Context.Context<never>> =>
114
114
  Effect.gen(function* () {
115
- const services = withoutGroups(yield* Effect.context());
116
- const map = new Map<string, unknown>();
115
+ const context = yield* Effect.context();
116
+ const services = withoutGroups(context);
117
+ // Composed capability layers of the same plugin share one handler group.
118
+ const inherited = context.mapUnsafe.get(handlerGroupKey(plugin.identifier));
119
+ const map = new Map(Predicate.isMap(inherited) ? inherited : []);
117
120
  // A declared but invalid handler, such as `null` from JavaScript, fails when it is used.
118
121
  const find = (kind: string, declarations: unknown, localId: string) => {
119
122
  const handler = getNestedHandler(declarations, localId);
@@ -107,8 +107,7 @@ export const Request = Schema.Struct({
107
107
  operation: Operation,
108
108
  });
109
109
 
110
- export type Failure = typeof Failure.Type;
111
- export const Failure = Schema.Struct({
110
+ const RuntimeFailure = Schema.Struct({
112
111
  category: Schema.Literals(["validation", "connection", "handler", "initialization", "protocol"]),
113
112
  /** The Agent Channel failure the host rebuilds as its `ChannelError`. */
114
113
  channel: Schema.optionalKey(
@@ -125,14 +124,23 @@ export const Failure = Schema.Struct({
125
124
  /** The provider's HTTP status, kept so the host can report why a provider rejected the call. */
126
125
  status: Schema.optionalKey(Schema.Int),
127
126
  });
127
+ export type Failure = typeof Failure.Type;
128
+ export const Failure = Schema.Union([
129
+ ActionHandlerError,
130
+ RetryableActionHandlerError,
131
+ RuntimeFailure,
132
+ ]);
128
133
  export type Response = typeof Response.Type;
129
134
  export const Response = Schema.Union([
130
135
  Schema.TaggedStruct("success", { identity: Identity, value: Schema.optionalKey(Schema.Json) }),
131
136
  Schema.TaggedStruct("failure", { error: Failure, identity: Identity }),
132
137
  ]);
133
138
 
134
- // Plugin causes and schema descriptions can contain credentials or submitted input.
139
+ // Declared Action failures reach the host intact; the host owns public error filtering.
135
140
  export function failure(error: unknown): Failure {
141
+ if (Schema.is(ActionHandlerError)(error) || Schema.is(RetryableActionHandlerError)(error)) {
142
+ return error;
143
+ }
136
144
  if (Schema.is(AgentChannel.ChannelError)(error)) {
137
145
  return {
138
146
  category: "handler",
@@ -145,10 +153,7 @@ export function failure(error: unknown): Failure {
145
153
  retryable: false,
146
154
  };
147
155
  }
148
- if (
149
- Schema.is(Files.FileError)(error) ||
150
- (Schema.is(ActionHandlerError)(error) && Schema.is(Files.FileError)(error.cause))
151
- ) {
156
+ if (Schema.is(Files.FileError)(error)) {
152
157
  return {
153
158
  category: "handler",
154
159
  code: "FileError",
@@ -168,18 +173,6 @@ export function failure(error: unknown): Failure {
168
173
  retryable: false,
169
174
  };
170
175
  }
171
- if (Schema.is(RetryableActionHandlerError)(error)) {
172
- return {
173
- category: "handler",
174
- code: error._tag,
175
- message: "Plugin handler failed",
176
- retryable: true,
177
- ...Option.match(Option.fromUndefinedOr(error.retryAfterSeconds), {
178
- onNone: () => ({}),
179
- onSome: seconds => ({ retryAfterSeconds: seconds }),
180
- }),
181
- };
182
- }
183
176
  const tag =
184
177
  Predicate.hasProperty(error, "_tag") && Predicate.isString(error._tag)
185
178
  ? error._tag
@@ -224,7 +217,6 @@ export function failure(error: unknown): Failure {
224
217
  "OAuth2RefreshTokenUnavailableError",
225
218
  "ActionNotFoundError",
226
219
  "ActionHandlerNotFoundError",
227
- "ActionHandlerError",
228
220
  "TriggerNotFoundError",
229
221
  "UnsupportedTriggerRuntimeError",
230
222
  "FileError",
@@ -237,9 +229,6 @@ export function failure(error: unknown): Failure {
237
229
  : "PluginHandlerError",
238
230
  message: "Plugin operation failed",
239
231
  retryable: false,
240
- ...(Schema.is(ActionHandlerError)(error) && Schema.is(Schema.Int)(error.status)
241
- ? { status: error.status }
242
- : {}),
243
232
  };
244
233
  }
245
234