@relayfile/relay-helpers 0.4.3 → 0.4.5

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.
Files changed (54) hide show
  1. package/README.md +36 -0
  2. package/dist/generated/clients.d.ts +33 -34
  3. package/dist/generated/clients.d.ts.map +1 -1
  4. package/dist/generated/clients.js +1 -2
  5. package/dist/generated/clients.js.map +1 -1
  6. package/dist/generic.d.ts +4 -3
  7. package/dist/generic.d.ts.map +1 -1
  8. package/dist/generic.js +30 -0
  9. package/dist/generic.js.map +1 -1
  10. package/dist/github.d.ts +33 -2
  11. package/dist/github.d.ts.map +1 -1
  12. package/dist/github.js +53 -0
  13. package/dist/github.js.map +1 -1
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/linear.d.ts +2 -2
  19. package/dist/linear.d.ts.map +1 -1
  20. package/dist/linear.js +24 -4
  21. package/dist/linear.js.map +1 -1
  22. package/dist/preview-transport.test.d.ts +2 -0
  23. package/dist/preview-transport.test.d.ts.map +1 -0
  24. package/dist/preview-transport.test.js +175 -0
  25. package/dist/preview-transport.test.js.map +1 -0
  26. package/dist/provider-client.d.ts +3 -2
  27. package/dist/provider-client.d.ts.map +1 -1
  28. package/dist/provider-client.js.map +1 -1
  29. package/dist/reddit.d.ts +12 -0
  30. package/dist/reddit.d.ts.map +1 -0
  31. package/dist/reddit.js +42 -0
  32. package/dist/reddit.js.map +1 -0
  33. package/dist/reddit.test.d.ts +2 -0
  34. package/dist/reddit.test.d.ts.map +1 -0
  35. package/dist/reddit.test.js +62 -0
  36. package/dist/reddit.test.js.map +1 -0
  37. package/dist/relay-helpers.test.js +16 -0
  38. package/dist/relay-helpers.test.js.map +1 -1
  39. package/dist/slack.d.ts +2 -2
  40. package/dist/slack.d.ts.map +1 -1
  41. package/dist/slack.js +4 -1
  42. package/dist/slack.js.map +1 -1
  43. package/dist/telegram.d.ts +3 -2
  44. package/dist/telegram.d.ts.map +1 -1
  45. package/dist/telegram.js.map +1 -1
  46. package/dist/transport.d.ts +86 -0
  47. package/dist/transport.d.ts.map +1 -0
  48. package/dist/transport.js +192 -0
  49. package/dist/transport.js.map +1 -0
  50. package/dist/types.d.ts +39 -0
  51. package/dist/types.d.ts.map +1 -0
  52. package/dist/types.js +3 -0
  53. package/dist/types.js.map +1 -0
  54. package/package.json +14 -3
@@ -0,0 +1,86 @@
1
+ import type { IntegrationClientOptions, WritebackResult } from '@relayfile/adapter-core/vfs-client';
2
+ import type { PreviewAccess, PreviewAction, PreviewParameters } from './types.js';
3
+ export type { EffectPolicyV1, PreviewAccess, PreviewAction, PreviewParameters, PreviewSimulatedReceipt, } from './types.js';
4
+ export type RelayTransportParameters = PreviewParameters;
5
+ export interface RelayTransportRequest {
6
+ provider: string;
7
+ resource: string;
8
+ parameters: RelayTransportParameters;
9
+ path: string;
10
+ }
11
+ export interface RelayTransportWriteRequest extends RelayTransportRequest {
12
+ body: unknown;
13
+ }
14
+ /**
15
+ * The provider-helper IO boundary. Implementations may use a Relayfile mount,
16
+ * a remote Relayfile API, or a side-effect-free recorder. This type has no
17
+ * Workforce dependency and is safe for runtimes to import directly.
18
+ */
19
+ export interface RelayTransport {
20
+ read<T = unknown>(request: RelayTransportRequest): Promise<T>;
21
+ list<T = unknown>(request: RelayTransportRequest): Promise<T[]>;
22
+ write(request: RelayTransportWriteRequest): Promise<WritebackResult>;
23
+ }
24
+ /** Options accepted by every relay-helper client factory. */
25
+ export interface RelayClientOptions extends IntegrationClientOptions {
26
+ /**
27
+ * Explicit helper transport. It takes precedence over mount and HTTP options
28
+ * and over every ambient Relayfile/provider credential.
29
+ */
30
+ transport?: RelayTransport;
31
+ }
32
+ export interface PreviewTransportOptions {
33
+ /** Data keyed by canonical Relayfile path for preview reads and lists. */
34
+ fixtures?: Readonly<Record<string, unknown>> | ReadonlyMap<string, unknown>;
35
+ /** Override deterministic fake identifiers when a consumer needs a fixture convention. */
36
+ idFactory?: (request: RelayTransportWriteRequest, sequence: number) => string;
37
+ /** Override deterministic timestamps. Sequence numbers start at one. */
38
+ timestampFactory?: (sequence: number) => string;
39
+ }
40
+ /**
41
+ * Side-effect-free provider transport used by local preview and test runs.
42
+ * It never inspects environment variables and never delegates to fetch or the
43
+ * filesystem. Writes are recorded and receive deterministic simulated IDs so
44
+ * later writes can safely refer to earlier ones.
45
+ */
46
+ export declare class PreviewTransport implements RelayTransport {
47
+ readonly actions: PreviewAction[];
48
+ readonly accesses: PreviewAccess[];
49
+ private sequence;
50
+ private readonly data;
51
+ private readonly writtenPaths;
52
+ private readonly receiptsByReference;
53
+ private readonly idFactory;
54
+ private readonly timestampFactory;
55
+ constructor(options?: PreviewTransportOptions);
56
+ seed(path: string, value: unknown): this;
57
+ read<T = unknown>(request: RelayTransportRequest): Promise<T>;
58
+ list<T = unknown>(request: RelayTransportRequest): Promise<T[]>;
59
+ write(request: RelayTransportWriteRequest): Promise<WritebackResult>;
60
+ clear(): void;
61
+ private resolveParentReference;
62
+ }
63
+ /** Return the process-scoped transport used by legacy no-argument clients. */
64
+ export declare function getProcessRelayTransport(): RelayTransport | undefined;
65
+ /** Set or clear the process-scoped transport used by legacy no-argument clients. */
66
+ export declare function setProcessRelayTransport(transport: RelayTransport | undefined): void;
67
+ /** Compatibility name used by the preview runtime integration. */
68
+ export declare function setPreviewTransport(transport: RelayTransport): void;
69
+ /** Clear the process-scoped preview transport. */
70
+ export declare function clearPreviewTransport(): void;
71
+ /**
72
+ * Bind a process transport and return a restoration callback. Nested bindings
73
+ * restore correctly; the callback will not overwrite a newer binding.
74
+ */
75
+ export declare function bindRelayTransport(transport: RelayTransport): () => void;
76
+ /** Convenience name for the common process-scoped preview binding. */
77
+ export declare const bindPreviewTransport: typeof bindRelayTransport;
78
+ /** Explicit constructor injection always wins over the process binding. */
79
+ export declare function resolveRelayTransport(options: RelayClientOptions): RelayTransport | undefined;
80
+ /**
81
+ * Capture explicit constructor injection while resolving the process binding
82
+ * lazily for every operation. The lazy half is essential for handlers that
83
+ * construct a no-argument client at module load before a Run binds preview.
84
+ */
85
+ export declare function createRelayTransportResolver(options: RelayClientOptions): () => RelayTransport | undefined;
86
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAChE,KAAK,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACtE;AAED,6DAA6D;AAC7D,MAAM,WAAW,kBAAmB,SAAQ,wBAAwB;IAClE;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED,MAAM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AwB,IAAI,cAAc,GAAG,SAAS,CAErE;AAED,oFAAoF;AACpF,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAEpF;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,CAEnE;AAED,kDAAkD;AAClD,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,cAAc,GAAG,MAAM,IAAI,CAMxE;AAED,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,2BAAqB,CAAC;AAEvD,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,GAAG,cAAc,GAAG,SAAS,CAE7F;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,kBAAkB,GAC1B,MAAM,cAAc,GAAG,SAAS,CAGlC"}
@@ -0,0 +1,192 @@
1
+ function isRecord(value) {
2
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
3
+ }
4
+ function stablePart(value) {
5
+ const normalized = value.toLowerCase().replace(/[^a-z0-9]+/gu, '-').replace(/^-|-$/gu, '');
6
+ return normalized || 'action';
7
+ }
8
+ function defaultId(request, sequence) {
9
+ return `preview-${stablePart(request.provider)}-${stablePart(request.resource)}-${String(sequence).padStart(4, '0')}`;
10
+ }
11
+ function defaultTimestamp(sequence) {
12
+ return new Date(Date.UTC(2000, 0, 1) + sequence - 1).toISOString();
13
+ }
14
+ function collectionRecordPath(path, id) {
15
+ return path.endsWith('.json') ? path : `${path.replace(/\/+$/u, '')}/${encodeURIComponent(id)}.json`;
16
+ }
17
+ /**
18
+ * Side-effect-free provider transport used by local preview and test runs.
19
+ * It never inspects environment variables and never delegates to fetch or the
20
+ * filesystem. Writes are recorded and receive deterministic simulated IDs so
21
+ * later writes can safely refer to earlier ones.
22
+ */
23
+ export class PreviewTransport {
24
+ actions = [];
25
+ accesses = [];
26
+ sequence = 0;
27
+ data = new Map();
28
+ writtenPaths = new Set();
29
+ receiptsByReference = new Map();
30
+ idFactory;
31
+ timestampFactory;
32
+ constructor(options = {}) {
33
+ const fixtures = options.fixtures;
34
+ if (fixtures instanceof Map) {
35
+ for (const [fixturePath, value] of fixtures)
36
+ this.data.set(fixturePath, value);
37
+ }
38
+ else if (fixtures) {
39
+ for (const [fixturePath, value] of Object.entries(fixtures))
40
+ this.data.set(fixturePath, value);
41
+ }
42
+ this.idFactory = options.idFactory ?? defaultId;
43
+ this.timestampFactory = options.timestampFactory ?? defaultTimestamp;
44
+ }
45
+ seed(path, value) {
46
+ this.data.set(path, value);
47
+ return this;
48
+ }
49
+ async read(request) {
50
+ const parameters = { ...request.parameters };
51
+ const action = {
52
+ ...request,
53
+ kind: 'provider.read',
54
+ status: 'previewed',
55
+ data: { operation: 'read', parameters, path: request.path },
56
+ parameters,
57
+ method: 'read',
58
+ };
59
+ this.accesses.push(action);
60
+ this.actions.push(action);
61
+ return this.data.get(request.path);
62
+ }
63
+ async list(request) {
64
+ const parameters = { ...request.parameters };
65
+ const action = {
66
+ ...request,
67
+ kind: 'provider.read',
68
+ status: 'previewed',
69
+ data: { operation: 'list', parameters, path: request.path },
70
+ parameters,
71
+ method: 'list',
72
+ };
73
+ this.accesses.push(action);
74
+ this.actions.push(action);
75
+ const fixture = this.data.get(request.path);
76
+ if (Array.isArray(fixture))
77
+ return [...fixture];
78
+ const prefix = `${request.path.replace(/\/+$/u, '')}/`;
79
+ const records = [];
80
+ for (const [recordPath, value] of this.data) {
81
+ if (!recordPath.startsWith(prefix))
82
+ continue;
83
+ const remainder = recordPath.slice(prefix.length);
84
+ if (remainder && !remainder.includes('/') && remainder.endsWith('.json'))
85
+ records.push(value);
86
+ }
87
+ return records;
88
+ }
89
+ async write(request) {
90
+ this.sequence += 1;
91
+ const simulatedReceipt = {
92
+ id: this.idFactory(request, this.sequence),
93
+ timestamp: this.timestampFactory(this.sequence),
94
+ };
95
+ const path = collectionRecordPath(request.path, simulatedReceipt.id);
96
+ const body = this.resolveParentReference(request.body);
97
+ const parameters = { ...request.parameters };
98
+ const action = {
99
+ ...request,
100
+ id: simulatedReceipt.id,
101
+ kind: 'provider.write',
102
+ status: 'previewed',
103
+ data: { operation: 'write', parameters, path, body, simulatedReceipt },
104
+ method: 'write',
105
+ parameters,
106
+ path,
107
+ body,
108
+ simulatedReceipt,
109
+ };
110
+ this.actions.push(action);
111
+ this.data.set(path, body);
112
+ this.writtenPaths.add(path);
113
+ this.receiptsByReference.set(path, simulatedReceipt);
114
+ this.receiptsByReference.set(simulatedReceipt.id, simulatedReceipt);
115
+ return {
116
+ path,
117
+ absolutePath: path,
118
+ receipt: {
119
+ id: simulatedReceipt.id,
120
+ created: simulatedReceipt.id,
121
+ externalId: simulatedReceipt.id,
122
+ ts: simulatedReceipt.id,
123
+ timestamp: simulatedReceipt.timestamp,
124
+ path,
125
+ ok: true,
126
+ },
127
+ };
128
+ }
129
+ clear() {
130
+ for (const path of this.writtenPaths)
131
+ this.data.delete(path);
132
+ this.writtenPaths.clear();
133
+ this.actions.length = 0;
134
+ this.accesses.length = 0;
135
+ this.sequence = 0;
136
+ this.receiptsByReference.clear();
137
+ }
138
+ resolveParentReference(body) {
139
+ if (!isRecord(body) || typeof body.parentRef !== 'string')
140
+ return body;
141
+ const parent = this.receiptsByReference.get(body.parentRef);
142
+ return parent ? { ...body, thread_ts: parent.id } : { ...body };
143
+ }
144
+ }
145
+ const PROCESS_TRANSPORT_KEY = Symbol.for('agentworkforce.preview-transport');
146
+ function processTransportRegistry() {
147
+ return globalThis;
148
+ }
149
+ /** Return the process-scoped transport used by legacy no-argument clients. */
150
+ export function getProcessRelayTransport() {
151
+ return processTransportRegistry()[PROCESS_TRANSPORT_KEY];
152
+ }
153
+ /** Set or clear the process-scoped transport used by legacy no-argument clients. */
154
+ export function setProcessRelayTransport(transport) {
155
+ processTransportRegistry()[PROCESS_TRANSPORT_KEY] = transport;
156
+ }
157
+ /** Compatibility name used by the preview runtime integration. */
158
+ export function setPreviewTransport(transport) {
159
+ setProcessRelayTransport(transport);
160
+ }
161
+ /** Clear the process-scoped preview transport. */
162
+ export function clearPreviewTransport() {
163
+ setProcessRelayTransport(undefined);
164
+ }
165
+ /**
166
+ * Bind a process transport and return a restoration callback. Nested bindings
167
+ * restore correctly; the callback will not overwrite a newer binding.
168
+ */
169
+ export function bindRelayTransport(transport) {
170
+ const previous = getProcessRelayTransport();
171
+ setProcessRelayTransport(transport);
172
+ return () => {
173
+ if (getProcessRelayTransport() === transport)
174
+ setProcessRelayTransport(previous);
175
+ };
176
+ }
177
+ /** Convenience name for the common process-scoped preview binding. */
178
+ export const bindPreviewTransport = bindRelayTransport;
179
+ /** Explicit constructor injection always wins over the process binding. */
180
+ export function resolveRelayTransport(options) {
181
+ return options.transport ?? getProcessRelayTransport();
182
+ }
183
+ /**
184
+ * Capture explicit constructor injection while resolving the process binding
185
+ * lazily for every operation. The lazy half is essential for handlers that
186
+ * construct a no-argument client at module load before a Run binds preview.
187
+ */
188
+ export function createRelayTransportResolver(options) {
189
+ const explicitTransport = options.transport;
190
+ return () => explicitTransport ?? getProcessRelayTransport();
191
+ }
192
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AA6DA,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC3F,OAAO,UAAU,IAAI,QAAQ,CAAC;AAChC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,qBAAqB,CAAC,GAAG,SAAS,CAAC;AAChE,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,mBAAmB,CAAC,SAAyB;IAC3D,wBAAwB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,qBAAqB;IACnC,wBAAwB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAyB;IAC1D,MAAM,QAAQ,GAAG,wBAAwB,EAAE,CAAC;IAC5C,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,GAAG,EAAE;QACV,IAAI,wBAAwB,EAAE,KAAK,SAAS;YAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACnF,CAAC,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD,2EAA2E;AAC3E,MAAM,UAAU,qBAAqB,CAAC,OAA2B;IAC/D,OAAO,OAAO,CAAC,SAAS,IAAI,wBAAwB,EAAE,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAA2B;IAE3B,MAAM,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;IAC5C,OAAO,GAAG,EAAE,CAAC,iBAAiB,IAAI,wBAAwB,EAAE,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,39 @@
1
+ export interface EffectPolicyV1 {
2
+ reads: 'deny' | 'fixtures' | 'live';
3
+ writes: 'deny' | 'preview' | 'sandbox' | 'live';
4
+ model: 'stub' | 'fixture' | 'live';
5
+ shell: 'deny' | 'simulate' | 'sandbox' | 'live';
6
+ compose: 'deny' | 'preview' | 'sandbox' | 'live';
7
+ allowedHttp: Array<{
8
+ method: string;
9
+ urlGlob: string;
10
+ }>;
11
+ allowedProviders?: string[];
12
+ }
13
+ export interface PreviewSimulatedReceipt {
14
+ id: string;
15
+ timestamp: string;
16
+ }
17
+ export type PreviewParameters = Record<string, string | number>;
18
+ export interface PreviewAction {
19
+ id?: string;
20
+ kind: 'provider.read' | 'provider.write';
21
+ provider: string;
22
+ resource: string;
23
+ status: 'previewed';
24
+ data: Record<string, unknown>;
25
+ extensions?: Record<string, unknown>;
26
+ method: 'read' | 'list' | 'write';
27
+ path: string;
28
+ parameters?: PreviewParameters;
29
+ body?: unknown;
30
+ simulatedReceipt?: PreviewSimulatedReceipt;
31
+ }
32
+ export type TransportPreviewAction = PreviewAction;
33
+ export type PreviewAccess = PreviewAction & {
34
+ kind: 'provider.read';
35
+ method: 'read' | 'list';
36
+ body?: never;
37
+ simulatedReceipt?: never;
38
+ };
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;IAChD,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACnC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IAChD,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;IACjD,WAAW,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,eAAe,GAAG,gBAAgB,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;CAC5C;AAED,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC1C,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,gBAAgB,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ // relay-helpers owns this type; @agentworkforce/runtime maps it when consuming.
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relayfile/relay-helpers",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Ergonomic, catalog-backed provider clients for Relayfile integration handlers",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -17,6 +17,16 @@
17
17
  "import": "./dist/index.js",
18
18
  "default": "./dist/index.js"
19
19
  },
20
+ "./transport": {
21
+ "types": "./dist/transport.d.ts",
22
+ "import": "./dist/transport.js",
23
+ "default": "./dist/transport.js"
24
+ },
25
+ "./types": {
26
+ "types": "./dist/types.d.ts",
27
+ "import": "./dist/types.js",
28
+ "default": "./dist/types.js"
29
+ },
20
30
  "./package.json": "./package.json"
21
31
  },
22
32
  "files": [
@@ -31,7 +41,8 @@
31
41
  "prepublishOnly": "npm run build"
32
42
  },
33
43
  "dependencies": {
34
- "@relayfile/adapter-core": "^0.4.6",
35
- "@relayfile/adapter-linear": "^0.4.2"
44
+ "@relayfile/adapter-core": "^0.5.3",
45
+ "@relayfile/adapter-linear": "^0.4.4",
46
+ "@relayfile/adapter-reddit": "^0.2.3"
36
47
  }
37
48
  }