agent-relay-server 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ import { cleanMeta, cleanString, cleanStringArray, optionalEnum } from "../valid
6
6
  import { emitChannelActivity, emitMessageQueued, emitMessageReactionUpdated, emitNewMessage, emitTaskChanged } from "../sse";
7
7
  import { getComponentAuth, getIntegrationAuth, hasIntegrationScope, isRequestAuthorizedFor } from "../security";
8
8
  import { isRecord } from "agent-relay-sdk";
9
+ import { parseChannelRouteTarget } from "../channel-target.ts";
9
10
  import { type ChannelBinding, type ChannelBindingMode, type ChannelRouteTarget, type ChannelSummary, type IntegrationEventInput, type IntegrationSummary } from "../types";
10
11
 
11
12
  const VALID_CHANNEL_BINDING_TARGET_TYPES = ["agent", "label", "tag", "capability", "broadcast", "orchestrator", "pool", "policy"] as const;
@@ -44,14 +45,11 @@ function normalizeChannelBindingInput(body: unknown): {
44
45
  }
45
46
 
46
47
  function routeTargetFromAddress(target: string): ChannelRouteTarget {
47
- if (target.startsWith("pool:")) return { type: "pool", id: target.slice("pool:".length) };
48
- if (target.startsWith("policy:")) return { type: "policy", id: target.slice("policy:".length) };
49
- if (target.startsWith("label:")) return { type: "label", id: target.slice("label:".length) };
50
- if (target.startsWith("tag:")) return { type: "tag", id: target.slice("tag:".length) };
51
- if (target.startsWith("cap:")) return { type: "capability", id: target.slice("cap:".length) };
52
- if (target === "broadcast") return { type: "broadcast" };
53
- if (target.startsWith("orchestrator:")) throw new ValidationError("orchestrator channel targets are not supported yet");
54
- return { type: "agent", id: target };
48
+ // Canonical parser (shared with the db legacy-target path so they can't drift,
49
+ // #298), plus the routes-only rule that orchestrator: targets aren't supported yet.
50
+ const parsed = parseChannelRouteTarget(target);
51
+ if (parsed.type === "orchestrator") throw new ValidationError("orchestrator channel targets are not supported yet");
52
+ return parsed;
55
53
  }
56
54
 
57
55
  function messageTargetForChannelTarget(target: ChannelRouteTarget, binding?: ChannelBinding): string {