@agent-relay/slack-primitive 6.0.12
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/actions/post-message.d.ts +9 -0
- package/dist/actions/post-message.d.ts.map +1 -0
- package/dist/actions/post-message.js +48 -0
- package/dist/actions/post-message.js.map +1 -0
- package/dist/actions/resolve-channel.d.ts +9 -0
- package/dist/actions/resolve-channel.d.ts.map +1 -0
- package/dist/actions/resolve-channel.js +29 -0
- package/dist/actions/resolve-channel.js.map +1 -0
- package/dist/actions/resolve-user.d.ts +13 -0
- package/dist/actions/resolve-user.d.ts.map +1 -0
- package/dist/actions/resolve-user.js +93 -0
- package/dist/actions/resolve-user.js.map +1 -0
- package/dist/adapter.d.ts +23 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +194 -0
- package/dist/adapter.js.map +1 -0
- package/dist/client.d.ts +62 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +91 -0
- package/dist/client.js.map +1 -0
- package/dist/cloud-relay-runtime.d.ts +32 -0
- package/dist/cloud-relay-runtime.d.ts.map +1 -0
- package/dist/cloud-relay-runtime.js +156 -0
- package/dist/cloud-relay-runtime.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/local-runtime.d.ts +17 -0
- package/dist/local-runtime.d.ts.map +1 -0
- package/dist/local-runtime.js +28 -0
- package/dist/local-runtime.js.map +1 -0
- package/dist/noop-runtime.d.ts +22 -0
- package/dist/noop-runtime.d.ts.map +1 -0
- package/dist/noop-runtime.js +70 -0
- package/dist/noop-runtime.js.map +1 -0
- package/dist/types.d.ts +202 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +27 -0
- package/dist/types.js.map +1 -0
- package/dist/workflow-step.d.ts +80 -0
- package/dist/workflow-step.d.ts.map +1 -0
- package/dist/workflow-step.js +355 -0
- package/dist/workflow-step.js.map +1 -0
- package/examples/README.md +40 -0
- package/examples/notify-on-pr.ts +93 -0
- package/package.json +50 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseSlackAdapter } from './adapter.js';
|
|
2
|
+
import { type PostMessageOutput, type PostMessageParams, type ResolveChannelParams, type ResolveUserParams, type SlackChannelSummary, type SlackResolvedMention, type SlackRuntime, type SlackRuntimeConfig } from './types.js';
|
|
3
|
+
export type CloudRelayFetch = (input: string | URL, init?: {
|
|
4
|
+
method?: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
body?: string;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
ok: boolean;
|
|
10
|
+
status: number;
|
|
11
|
+
statusText: string;
|
|
12
|
+
json: () => Promise<unknown>;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Slack adapter that proxies postMessage through relay-cloud's
|
|
16
|
+
* /api/v1/slack/post-message endpoint, which uses the workspace's
|
|
17
|
+
* configured Nango Slack connection (the ricky app).
|
|
18
|
+
*
|
|
19
|
+
* Used when the caller has CLOUD_API_TOKEN + CLOUD_API_URL but no local
|
|
20
|
+
* SLACK_BOT_TOKEN. Resolve operations are not supported in this mode —
|
|
21
|
+
* Phase A intentionally exposes only postMessage.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SlackCloudRelayClient extends BaseSlackAdapter {
|
|
24
|
+
private readonly fetchImpl;
|
|
25
|
+
constructor(config?: SlackRuntimeConfig, fetchImpl?: CloudRelayFetch);
|
|
26
|
+
getRuntime(): SlackRuntime;
|
|
27
|
+
isAuthenticated(): Promise<boolean>;
|
|
28
|
+
postMessage(params: PostMessageParams): Promise<PostMessageOutput>;
|
|
29
|
+
resolveUser(_params: ResolveUserParams): Promise<SlackResolvedMention>;
|
|
30
|
+
resolveChannel(_params: ResolveChannelParams): Promise<SlackChannelSummary>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=cloud-relay-run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AAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAMlF"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { BaseSlackAdapter, normalizeSlackRuntimeConfig } from './adapter.js';
|
|
2
|
+
import { SlackPostBackError, } from './types.js';
|
|
3
|
+
const POST_MESSAGE_PATH = '/api/v1/slack/post-message';
|
|
4
|
+
/**
|
|
5
|
+
* Slack adapter that proxies postMessage through relay-cloud's
|
|
6
|
+
* /api/v1/slack/post-message endpoint, which uses the workspace's
|
|
7
|
+
* configured Nango Slack connection (the ricky app).
|
|
8
|
+
*
|
|
9
|
+
* Used when the caller has CLOUD_API_TOKEN + CLOUD_API_URL but no local
|
|
10
|
+
* SLACK_BOT_TOKEN. Resolve operations are not supported in this mode —
|
|
11
|
+
* Phase A intentionally exposes only postMessage.
|
|
12
|
+
*/
|
|
13
|
+
export class SlackCloudRelayClient extends BaseSlackAdapter {
|
|
14
|
+
fetchImpl;
|
|
15
|
+
constructor(config = {}, fetchImpl) {
|
|
16
|
+
const normalized = normalizeSlackRuntimeConfig(config);
|
|
17
|
+
if (!normalized.cloudApiToken) {
|
|
18
|
+
throw new SlackPostBackError('auth_token_missing', 'auth_token_missing: CLOUD_API_TOKEN is required for Slack cloud-relay runtime.');
|
|
19
|
+
}
|
|
20
|
+
if (!normalized.cloudApiUrl) {
|
|
21
|
+
throw new SlackPostBackError('auth_token_missing', 'auth_token_missing: CLOUD_API_URL is required for Slack cloud-relay runtime.');
|
|
22
|
+
}
|
|
23
|
+
super({ ...normalized, runtime: 'cloud-relay' }, createCloudRelaySlackStub());
|
|
24
|
+
const resolved = fetchImpl ?? globalThis.fetch;
|
|
25
|
+
if (!resolved) {
|
|
26
|
+
throw new SlackPostBackError('upstream_error', 'cloud-relay runtime requires a fetch implementation; pass one explicitly or run on Node 18+.');
|
|
27
|
+
}
|
|
28
|
+
this.fetchImpl = resolved;
|
|
29
|
+
}
|
|
30
|
+
getRuntime() {
|
|
31
|
+
return 'cloud-relay';
|
|
32
|
+
}
|
|
33
|
+
async isAuthenticated() {
|
|
34
|
+
return Boolean(this.config.cloudApiToken && this.config.cloudApiUrl);
|
|
35
|
+
}
|
|
36
|
+
async postMessage(params) {
|
|
37
|
+
if (!params.channel) {
|
|
38
|
+
throw new SlackPostBackError('channel_not_found', 'channel is required for postMessage');
|
|
39
|
+
}
|
|
40
|
+
if (!params.text) {
|
|
41
|
+
throw new SlackPostBackError('slack_api_error', 'text is required for postMessage');
|
|
42
|
+
}
|
|
43
|
+
const baseUrl = trimTrailingSlash(this.config.cloudApiUrl);
|
|
44
|
+
const url = `${baseUrl}${POST_MESSAGE_PATH}`;
|
|
45
|
+
const body = {
|
|
46
|
+
channel: params.channel,
|
|
47
|
+
text: params.text,
|
|
48
|
+
};
|
|
49
|
+
if (params.threadTs)
|
|
50
|
+
body.threadTs = params.threadTs;
|
|
51
|
+
if (typeof params.unfurl === 'boolean') {
|
|
52
|
+
body.unfurlLinks = params.unfurl;
|
|
53
|
+
body.unfurlMedia = params.unfurl;
|
|
54
|
+
}
|
|
55
|
+
const controller = typeof AbortController === 'function' ? new AbortController() : null;
|
|
56
|
+
const timeoutHandle = controller && this.config.timeout > 0
|
|
57
|
+
? setTimeout(() => controller.abort(), this.config.timeout)
|
|
58
|
+
: null;
|
|
59
|
+
let response;
|
|
60
|
+
try {
|
|
61
|
+
response = await this.fetchImpl(url, {
|
|
62
|
+
method: 'POST',
|
|
63
|
+
headers: {
|
|
64
|
+
'content-type': 'application/json',
|
|
65
|
+
authorization: `Bearer ${this.config.cloudApiToken}`,
|
|
66
|
+
},
|
|
67
|
+
body: JSON.stringify(body),
|
|
68
|
+
...(controller ? { signal: controller.signal } : {}),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw new SlackPostBackError('upstream_error', `cloud-relay request failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
if (timeoutHandle)
|
|
76
|
+
clearTimeout(timeoutHandle);
|
|
77
|
+
}
|
|
78
|
+
const payload = (await response.json().catch(() => null));
|
|
79
|
+
if (!payload) {
|
|
80
|
+
throw new SlackPostBackError('upstream_error', `cloud-relay returned non-JSON response (${response.status} ${response.statusText})`);
|
|
81
|
+
}
|
|
82
|
+
if (!payload.ok) {
|
|
83
|
+
throw mapCloudRelayError(payload);
|
|
84
|
+
}
|
|
85
|
+
const warnings = [];
|
|
86
|
+
const unresolvedMentions = [];
|
|
87
|
+
if (params.mentions && params.mentions.length > 0) {
|
|
88
|
+
for (const mention of params.mentions) {
|
|
89
|
+
unresolvedMentions.push(mention);
|
|
90
|
+
warnings.push({
|
|
91
|
+
type: 'mention_unresolved',
|
|
92
|
+
input: mention,
|
|
93
|
+
message: 'mention resolution is not supported in cloud-relay runtime; pass user IDs in text directly.',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
channel: payload.channel,
|
|
99
|
+
ts: payload.ts,
|
|
100
|
+
text: params.text,
|
|
101
|
+
resolvedMentions: [],
|
|
102
|
+
unresolvedMentions,
|
|
103
|
+
warnings,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async resolveUser(_params) {
|
|
107
|
+
throw new SlackPostBackError('unsupported_in_cloud_relay', 'resolveUser is not supported in cloud-relay runtime (Phase A). Pass a Slack user ID directly.');
|
|
108
|
+
}
|
|
109
|
+
async resolveChannel(_params) {
|
|
110
|
+
throw new SlackPostBackError('unsupported_in_cloud_relay', 'resolveChannel is not supported in cloud-relay runtime (Phase A). Pass a Slack channel ID or #name directly.');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Stub Slack web-api shaped object for the BaseSlackAdapter constructor.
|
|
115
|
+
* Cloud-relay overrides every action at the class level, so this stub
|
|
116
|
+
* only fires if a future change forgets to override one — in which case
|
|
117
|
+
* we want a loud error rather than a silent no-op.
|
|
118
|
+
*/
|
|
119
|
+
function createCloudRelaySlackStub() {
|
|
120
|
+
const unsupported = (method) => async () => {
|
|
121
|
+
throw new SlackPostBackError('unsupported_in_cloud_relay', `${method} is not available in cloud-relay runtime`);
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
chat: { postMessage: unsupported('chat.postMessage') },
|
|
125
|
+
conversations: { list: unsupported('conversations.list') },
|
|
126
|
+
users: { lookupByEmail: unsupported('users.lookupByEmail') },
|
|
127
|
+
auth: { test: unsupported('auth.test') },
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function mapCloudRelayError(payload) {
|
|
131
|
+
const code = mapErrorCode(payload.code);
|
|
132
|
+
return new SlackPostBackError(code, `${payload.code}: ${payload.error}`, {
|
|
133
|
+
cause: payload,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function mapErrorCode(code) {
|
|
137
|
+
switch (code) {
|
|
138
|
+
case 'unauthorized':
|
|
139
|
+
return 'unauthorized';
|
|
140
|
+
case 'not_connected':
|
|
141
|
+
return 'not_connected';
|
|
142
|
+
case 'rate_limited':
|
|
143
|
+
return 'rate_limited';
|
|
144
|
+
case 'slack_error':
|
|
145
|
+
return 'slack_api_error';
|
|
146
|
+
case 'bad_request':
|
|
147
|
+
return 'slack_api_error';
|
|
148
|
+
case 'upstream_error':
|
|
149
|
+
default:
|
|
150
|
+
return 'upstream_error';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function trimTrailingSlash(value) {
|
|
154
|
+
return value.endsWith('/') ? value.slice(0, -1) : value;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=cloud-relay-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-relay-runtime.js","sourceRoot":"","sources":["../src/cloud-relay-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,kB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E;QACvE,KAAK,EAAE,OAAO;KACf,CAAC,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,cAAc;YACjB,OAAO,cAAc,CAAC;QACxB,KAAK,eAAe;YAClB,OAAO,eAAe,CAAC;QACzB,KAAK,cAAc;YACjB,OAAO,cAAc,CAAC;QACxB,KAAK,aAAa;YAChB,OAAO,iBAAiB,CAAC;QAC3B,KAAK,aAAa;YAChB,OAAO,iBAAiB,CAAC;QAC3B,KAAK,gBAAgB,CAAC;QACtB;YACE,OAAO,gBAAgB,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './adapter.js';
|
|
3
|
+
export * from './local-runtime.js';
|
|
4
|
+
export * from './cloud-relay-runtime.js';
|
|
5
|
+
export * from './noop-runtime.js';
|
|
6
|
+
export * from './client.js';
|
|
7
|
+
export * from './workflow-step.js';
|
|
8
|
+
export * from './actions/post-message.js';
|
|
9
|
+
export * from './actions/resolve-user.js';
|
|
10
|
+
export * from './actions/resolve-channel.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './adapter.js';
|
|
3
|
+
export * from './local-runtime.js';
|
|
4
|
+
export * from './cloud-relay-runtime.js';
|
|
5
|
+
export * from './noop-runtime.js';
|
|
6
|
+
export * from './client.js';
|
|
7
|
+
export * from './workflow-step.js';
|
|
8
|
+
export * from './actions/post-message.js';
|
|
9
|
+
export * from './actions/resolve-user.js';
|
|
10
|
+
export * from './actions/resolve-channel.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseSlackAdapter } from './adapter.js';
|
|
2
|
+
import { type SlackRuntime, type SlackRuntimeConfig, type SlackWebApiLike } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Local Slack Web API adapter backed by SLACK_BOT_TOKEN.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SlackWebApiClient extends BaseSlackAdapter {
|
|
7
|
+
constructor(config?: SlackRuntimeConfig, slack?: SlackWebApiLike);
|
|
8
|
+
getRuntime(): SlackRuntime;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create a Slack WebClient instance.
|
|
12
|
+
* @param token - Slack bot token.
|
|
13
|
+
* @param timeout - Request timeout in milliseconds.
|
|
14
|
+
* @returns Slack Web API compatible client.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createSlackWebClient(token: string, timeout: number): SlackWebApiLike;
|
|
17
|
+
//# sourceMappingURL=local-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-runtime.d.ts","sourceRoot":"","sources":["../src/local-runtime.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAA+B,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAElH;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,MAAM,GAAE,kBAAuB,EAAE,KAAK,CAAC,EAAE,eAAe;IAYpE,UAAU,IAAI,YAAY;CAG3B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe,CAEpF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WebClient } from '@slack/web-api';
|
|
2
|
+
import { BaseSlackAdapter, normalizeSlackRuntimeConfig } from './adapter.js';
|
|
3
|
+
import { SlackPostBackError } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Local Slack Web API adapter backed by SLACK_BOT_TOKEN.
|
|
6
|
+
*/
|
|
7
|
+
export class SlackWebApiClient extends BaseSlackAdapter {
|
|
8
|
+
constructor(config = {}, slack) {
|
|
9
|
+
const normalized = normalizeSlackRuntimeConfig(config);
|
|
10
|
+
if (!normalized.token) {
|
|
11
|
+
throw new SlackPostBackError('auth_token_missing', 'auth_token_missing: SLACK_BOT_TOKEN is required for Slack local runtime.');
|
|
12
|
+
}
|
|
13
|
+
super(normalized, slack ?? createSlackWebClient(normalized.token, normalized.timeout));
|
|
14
|
+
}
|
|
15
|
+
getRuntime() {
|
|
16
|
+
return 'local';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a Slack WebClient instance.
|
|
21
|
+
* @param token - Slack bot token.
|
|
22
|
+
* @param timeout - Request timeout in milliseconds.
|
|
23
|
+
* @returns Slack Web API compatible client.
|
|
24
|
+
*/
|
|
25
|
+
export function createSlackWebClient(token, timeout) {
|
|
26
|
+
return new WebClient(token, { timeout });
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=local-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-runtime.js","sourceRoot":"","sources":["../src/local-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAoE,MAAM,YAAY,CAAC;AAElH;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,gBAAgB;IACrD,YAAY,SAA6B,EAAE,EAAE,KAAuB;QAClE,MAAM,UAAU,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,kBAAkB,CAC1B,oBAAoB,EACpB,0EAA0E,CAC3E,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,UAAU,EAAE,KAAK,IAAI,oBAAoB,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACzF,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,OAAe;IACjE,OAAO,IAAI,SAAS,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAoB,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseSlackAdapter } from './adapter.js';
|
|
2
|
+
import { type PostMessageOutput, type PostMessageParams, type ResolveChannelParams, type ResolveUserParams, type SlackChannelSummary, type SlackResolvedMention, type SlackRuntime, type SlackRuntimeConfig } from './types.js';
|
|
3
|
+
export type NoopLogger = (message: string, context: Record<string, unknown>) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Slack adapter that no-ops all actions.
|
|
6
|
+
*
|
|
7
|
+
* Used when neither SLACK_BOT_TOKEN nor CLOUD_API_TOKEN is configured.
|
|
8
|
+
* Lets workflows run end-to-end without hard-failing on missing Slack
|
|
9
|
+
* credentials in environments (CI, smoke tests, demos) where Slack
|
|
10
|
+
* delivery isn't required. Each call logs a warning so the operator
|
|
11
|
+
* can see that messages are being dropped.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SlackNoopClient extends BaseSlackAdapter {
|
|
14
|
+
private readonly logger;
|
|
15
|
+
constructor(config?: SlackRuntimeConfig, logger?: NoopLogger);
|
|
16
|
+
getRuntime(): SlackRuntime;
|
|
17
|
+
isAuthenticated(): Promise<boolean>;
|
|
18
|
+
postMessage(params: PostMessageParams): Promise<PostMessageOutput>;
|
|
19
|
+
resolveUser(_params: ResolveUserParams): Promise<SlackResolvedMention>;
|
|
20
|
+
resolveChannel(_params: ResolveChannelParams): Promise<SlackChannelSummary>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=noop-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-runtime.d.ts","sourceRoot":"","sources":["../src/noop-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA+B,MAAM,cAAc,CAAC;AAC7E,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAExB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAExB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;AASrF;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,gBAAgB;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBAExB,MAAM,GAAE,kBAAuB,EAAE,MAAM,CAAC,EAAE,UAAU;IAMhE,UAAU,IAAI,YAAY;IAIpB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyBlE,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAOtE,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAMlF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { BaseSlackAdapter, normalizeSlackRuntimeConfig } from './adapter.js';
|
|
2
|
+
import { SlackPostBackError, } from './types.js';
|
|
3
|
+
const DEFAULT_LOGGER = (message, context) => {
|
|
4
|
+
// eslint-disable-next-line no-console
|
|
5
|
+
console.warn(`[slack-primitive:noop] ${message}`, context);
|
|
6
|
+
};
|
|
7
|
+
const NOOP_TS = '0000000000.000000';
|
|
8
|
+
/**
|
|
9
|
+
* Slack adapter that no-ops all actions.
|
|
10
|
+
*
|
|
11
|
+
* Used when neither SLACK_BOT_TOKEN nor CLOUD_API_TOKEN is configured.
|
|
12
|
+
* Lets workflows run end-to-end without hard-failing on missing Slack
|
|
13
|
+
* credentials in environments (CI, smoke tests, demos) where Slack
|
|
14
|
+
* delivery isn't required. Each call logs a warning so the operator
|
|
15
|
+
* can see that messages are being dropped.
|
|
16
|
+
*/
|
|
17
|
+
export class SlackNoopClient extends BaseSlackAdapter {
|
|
18
|
+
logger;
|
|
19
|
+
constructor(config = {}, logger) {
|
|
20
|
+
const normalized = normalizeSlackRuntimeConfig(config);
|
|
21
|
+
super({ ...normalized, runtime: 'noop' }, createNoopSlackStub());
|
|
22
|
+
this.logger = logger ?? DEFAULT_LOGGER;
|
|
23
|
+
}
|
|
24
|
+
getRuntime() {
|
|
25
|
+
return 'noop';
|
|
26
|
+
}
|
|
27
|
+
async isAuthenticated() {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
async postMessage(params) {
|
|
31
|
+
const channel = params.channel ?? this.config.env.SLACK_DEFAULT_CHANNEL ?? '#noop';
|
|
32
|
+
this.logger('postMessage dropped: no SLACK_BOT_TOKEN and no CLOUD_API_TOKEN configured.', {
|
|
33
|
+
channel,
|
|
34
|
+
preview: params.text.slice(0, 80),
|
|
35
|
+
});
|
|
36
|
+
const warnings = [
|
|
37
|
+
{
|
|
38
|
+
type: 'mention_unresolved',
|
|
39
|
+
input: channel,
|
|
40
|
+
message: 'Slack runtime is noop; configure SLACK_BOT_TOKEN or CLOUD_API_TOKEN to deliver messages.',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
return {
|
|
44
|
+
channel,
|
|
45
|
+
ts: NOOP_TS,
|
|
46
|
+
text: params.text,
|
|
47
|
+
resolvedMentions: [],
|
|
48
|
+
unresolvedMentions: params.mentions ?? [],
|
|
49
|
+
warnings,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async resolveUser(_params) {
|
|
53
|
+
throw new SlackPostBackError('auth_token_missing', 'resolveUser requires SLACK_BOT_TOKEN; current runtime is noop.');
|
|
54
|
+
}
|
|
55
|
+
async resolveChannel(_params) {
|
|
56
|
+
throw new SlackPostBackError('auth_token_missing', 'resolveChannel requires SLACK_BOT_TOKEN; current runtime is noop.');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function createNoopSlackStub() {
|
|
60
|
+
const unsupported = (method) => async () => {
|
|
61
|
+
throw new SlackPostBackError('auth_token_missing', `${method} is not available in noop runtime`);
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
chat: { postMessage: unsupported('chat.postMessage') },
|
|
65
|
+
conversations: { list: unsupported('conversations.list') },
|
|
66
|
+
users: { lookupByEmail: unsupported('users.lookupByEmail') },
|
|
67
|
+
auth: { test: unsupported('auth.test') },
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=noop-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-runtime.js","sourceRoot":"","sources":["../src/noop-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,kBAAkB,GAWnB,MAAM,YAAY,CAAC;AAIpB,MAAM,cAAc,GAAe,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IACtD,sCAAsC;IACtC,OAAO,CAAC,IAAI,CAAC,0BAA0B,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAgB,SAAQ,gBAAgB;IAClC,MAAM,CAAa;IAEpC,YAAY,SAA6B,EAAE,EAAE,MAAmB;QAC9D,MAAM,UAAU,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;QACvD,KAAK,CAAC,EAAE,GAAG,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,cAAc,CAAC;IACzC,CAAC;IAED,UAAU;QACR,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAyB;QACzC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,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W,CAAC,WAAW,CAAC,EAAE;KACX,CAAC;AAClC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export type SlackRuntime = 'local' | 'cloud-relay' | 'noop';
|
|
2
|
+
export type SlackRuntimePreference = SlackRuntime | 'auto';
|
|
3
|
+
export declare enum SlackAction {
|
|
4
|
+
PostMessage = "postMessage",
|
|
5
|
+
ResolveUser = "resolveUser",
|
|
6
|
+
ResolveChannel = "resolveChannel"
|
|
7
|
+
}
|
|
8
|
+
export type SlackActionName = `${SlackAction}`;
|
|
9
|
+
export declare const SLACK_ACTIONS: SlackAction[];
|
|
10
|
+
export interface SlackRuntimeConfig {
|
|
11
|
+
/** Runtime mode. Defaults to 'auto' (cloud-relay → local → noop priority). */
|
|
12
|
+
runtime?: SlackRuntimePreference;
|
|
13
|
+
/** Slack bot token. Defaults to SLACK_BOT_TOKEN. */
|
|
14
|
+
token?: string;
|
|
15
|
+
/** Cloud API bearer token used by the cloud-relay runtime. Defaults to CLOUD_API_TOKEN. */
|
|
16
|
+
cloudApiToken?: string;
|
|
17
|
+
/** Cloud API base URL used by the cloud-relay runtime. Defaults to CLOUD_API_URL. */
|
|
18
|
+
cloudApiUrl?: string;
|
|
19
|
+
/** Environment used for token lookup. Defaults to process.env. */
|
|
20
|
+
env?: Record<string, string | undefined>;
|
|
21
|
+
/** Request timeout in milliseconds passed to the Slack WebClient or cloud-relay fetch. */
|
|
22
|
+
timeout?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RequiredSlackRuntimeConfig extends SlackRuntimeConfig {
|
|
25
|
+
runtime: SlackRuntime;
|
|
26
|
+
env: Record<string, string | undefined>;
|
|
27
|
+
token: string;
|
|
28
|
+
cloudApiToken: string;
|
|
29
|
+
cloudApiUrl: string;
|
|
30
|
+
timeout: number;
|
|
31
|
+
}
|
|
32
|
+
export interface SlackRuntimeAvailability {
|
|
33
|
+
runtime: SlackRuntime;
|
|
34
|
+
available: boolean;
|
|
35
|
+
authenticated?: boolean;
|
|
36
|
+
reason: string;
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface SlackRuntimeDetectionResult {
|
|
40
|
+
runtime: SlackRuntime;
|
|
41
|
+
requestedRuntime: SlackRuntimePreference;
|
|
42
|
+
source: 'config' | 'environment';
|
|
43
|
+
available: boolean;
|
|
44
|
+
reason: string;
|
|
45
|
+
checkedAt: string;
|
|
46
|
+
local: SlackRuntimeAvailability;
|
|
47
|
+
cloudRelay: SlackRuntimeAvailability;
|
|
48
|
+
noop: SlackRuntimeAvailability;
|
|
49
|
+
}
|
|
50
|
+
export type SlackPostBackErrorCode = 'auth_token_missing' | 'channel_not_found' | 'slack_api_error' | 'not_connected' | 'rate_limited' | 'upstream_error' | 'unauthorized' | 'unsupported_in_cloud_relay';
|
|
51
|
+
export declare class SlackPostBackError extends Error {
|
|
52
|
+
readonly code: SlackPostBackErrorCode;
|
|
53
|
+
readonly cause?: unknown;
|
|
54
|
+
constructor(code: SlackPostBackErrorCode, message?: string, options?: {
|
|
55
|
+
cause?: unknown;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export interface SlackUserSummary {
|
|
59
|
+
id: string;
|
|
60
|
+
name?: string;
|
|
61
|
+
realName?: string;
|
|
62
|
+
profile?: {
|
|
63
|
+
email?: string;
|
|
64
|
+
displayName?: string;
|
|
65
|
+
realName?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface SlackChannelSummary {
|
|
69
|
+
id: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
isChannel?: boolean;
|
|
72
|
+
isGroup?: boolean;
|
|
73
|
+
isIm?: boolean;
|
|
74
|
+
isPrivate?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface SlackResolutionWarning {
|
|
77
|
+
type: 'mention_unresolved';
|
|
78
|
+
input: string;
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
|
81
|
+
export interface SlackResolvedMention {
|
|
82
|
+
input: string;
|
|
83
|
+
userId: string;
|
|
84
|
+
}
|
|
85
|
+
export interface PostMessageParams {
|
|
86
|
+
channel?: string;
|
|
87
|
+
text: string;
|
|
88
|
+
threadTs?: string;
|
|
89
|
+
mentions?: string[];
|
|
90
|
+
unfurl?: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface ResolveUserParams {
|
|
93
|
+
mention: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ResolveChannelParams {
|
|
96
|
+
channel: string;
|
|
97
|
+
}
|
|
98
|
+
export interface PostMessageOutput {
|
|
99
|
+
channel: string;
|
|
100
|
+
ts: string;
|
|
101
|
+
text: string;
|
|
102
|
+
resolvedMentions: SlackResolvedMention[];
|
|
103
|
+
unresolvedMentions: string[];
|
|
104
|
+
warnings: SlackResolutionWarning[];
|
|
105
|
+
}
|
|
106
|
+
export interface SlackActionParamsMap {
|
|
107
|
+
[SlackAction.PostMessage]: PostMessageParams;
|
|
108
|
+
[SlackAction.ResolveUser]: ResolveUserParams;
|
|
109
|
+
[SlackAction.ResolveChannel]: ResolveChannelParams;
|
|
110
|
+
}
|
|
111
|
+
export interface SlackActionOutputMap {
|
|
112
|
+
[SlackAction.PostMessage]: PostMessageOutput;
|
|
113
|
+
[SlackAction.ResolveUser]: SlackResolvedMention;
|
|
114
|
+
[SlackAction.ResolveChannel]: SlackChannelSummary;
|
|
115
|
+
}
|
|
116
|
+
export interface SlackActionResult<TOutput = unknown> {
|
|
117
|
+
success: boolean;
|
|
118
|
+
output: string;
|
|
119
|
+
data?: TOutput;
|
|
120
|
+
error?: string;
|
|
121
|
+
metadata?: {
|
|
122
|
+
runtime?: SlackRuntime;
|
|
123
|
+
executionTime?: number;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface SlackChatPostMessageParams {
|
|
127
|
+
channel: string;
|
|
128
|
+
text: string;
|
|
129
|
+
thread_ts?: string;
|
|
130
|
+
unfurl_links?: boolean;
|
|
131
|
+
unfurl_media?: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface SlackPostMessageResponse {
|
|
134
|
+
ok?: boolean;
|
|
135
|
+
channel?: string;
|
|
136
|
+
ts?: string;
|
|
137
|
+
message?: {
|
|
138
|
+
text?: string;
|
|
139
|
+
};
|
|
140
|
+
error?: string;
|
|
141
|
+
}
|
|
142
|
+
export interface SlackLookupByEmailResponse {
|
|
143
|
+
ok?: boolean;
|
|
144
|
+
user?: SlackUserSummary;
|
|
145
|
+
error?: string;
|
|
146
|
+
}
|
|
147
|
+
export interface SlackUsersListResponse {
|
|
148
|
+
ok?: boolean;
|
|
149
|
+
members?: SlackUserSummary[];
|
|
150
|
+
response_metadata?: {
|
|
151
|
+
next_cursor?: string;
|
|
152
|
+
};
|
|
153
|
+
error?: string;
|
|
154
|
+
}
|
|
155
|
+
export interface SlackConversationsListResponse {
|
|
156
|
+
ok?: boolean;
|
|
157
|
+
channels?: SlackChannelSummary[];
|
|
158
|
+
response_metadata?: {
|
|
159
|
+
next_cursor?: string;
|
|
160
|
+
};
|
|
161
|
+
error?: string;
|
|
162
|
+
}
|
|
163
|
+
export interface SlackWebApiLike {
|
|
164
|
+
chat: {
|
|
165
|
+
postMessage(params: SlackChatPostMessageParams): Promise<SlackPostMessageResponse>;
|
|
166
|
+
};
|
|
167
|
+
users: {
|
|
168
|
+
lookupByEmail(params: {
|
|
169
|
+
email: string;
|
|
170
|
+
}): Promise<SlackLookupByEmailResponse>;
|
|
171
|
+
list(params?: {
|
|
172
|
+
cursor?: string;
|
|
173
|
+
limit?: number;
|
|
174
|
+
}): Promise<SlackUsersListResponse>;
|
|
175
|
+
};
|
|
176
|
+
conversations: {
|
|
177
|
+
list(params?: {
|
|
178
|
+
cursor?: string;
|
|
179
|
+
limit?: number;
|
|
180
|
+
types?: string;
|
|
181
|
+
}): Promise<SlackConversationsListResponse>;
|
|
182
|
+
};
|
|
183
|
+
auth?: {
|
|
184
|
+
test(): Promise<{
|
|
185
|
+
ok?: boolean;
|
|
186
|
+
error?: string;
|
|
187
|
+
}>;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
export declare abstract class SlackClientInterface {
|
|
191
|
+
protected readonly config: RequiredSlackRuntimeConfig;
|
|
192
|
+
constructor(config: RequiredSlackRuntimeConfig);
|
|
193
|
+
getRuntimeConfig(): RequiredSlackRuntimeConfig;
|
|
194
|
+
abstract getRuntime(): SlackRuntime;
|
|
195
|
+
abstract isAuthenticated(): Promise<boolean>;
|
|
196
|
+
abstract executeAction<Name extends SlackAction>(action: Name, params: SlackActionParamsMap[Name]): Promise<SlackActionResult<SlackActionOutputMap[Name]>>;
|
|
197
|
+
abstract executeAction<TOutput = unknown>(action: SlackAction | SlackActionName, params?: unknown): Promise<SlackActionResult<TOutput>>;
|
|
198
|
+
abstract postMessage(params: PostMessageParams): Promise<PostMessageOutput>;
|
|
199
|
+
abstract resolveUser(params: ResolveUserParams): Promise<SlackResolvedMention>;
|
|
200
|
+
abstract resolveChannel(params: ResolveChannelParams): Promise<SlackChannelSummary>;
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC;AAE5D,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,MAAM,CAAC;AAE3D,oBAAY,WAAW;IACrB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;CAClC;AAED,MAAM,MAAM,eAAe,GAAG,GAAG,WAAW,EAAE,CAAC;AAE/C,eAAO,MAAM,aAAa,eAA6B,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,aAAa,CAAC,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) {
|
|
3
|
+
SlackAction["PostMessage"] = "postMessage";
|
|
4
|
+
SlackAction["ResolveUser"] = "resolveUser";
|
|
5
|
+
SlackAction["ResolveChannel"] = "resolveChannel";
|
|
6
|
+
})(SlackAction || (SlackAction = {}));
|
|
7
|
+
export const SLACK_ACTIONS = Object.values(SlackAction);
|
|
8
|
+
export class SlackPostBackError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
cause;
|
|
11
|
+
constructor(code, message, options = {}) {
|
|
12
|
+
super(message ?? code);
|
|
13
|
+
this.name = 'SlackPostBackError';
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.cause = options.cause;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class SlackClientInterface {
|
|
19
|
+
config;
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.config = config;
|
|
22
|
+
}
|
|
23
|
+
getRuntimeConfig() {
|
|
24
|
+
return this.config;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,0CAA2B,CAAA;IAC3B,gDAAiC,CAAA;AACnC,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAID,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAwDxD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAyB;IAC7B,KAAK,CAAW;IAEzB,YAAY,IAA4B,EAAE,OAAgB,EAAE,UAA+B,EAAE;QAC3F,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC7B,CAAC;CACF;AA+ID,MAAM,OAAgB,oBAAoB;IACrB,MAAM,CAA6B;IAEtD,YAAY,MAAkC;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CAeF"}
|