@agentrysh/mcp 0.0.13 → 0.0.15
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/README.md +1 -1
- package/dist/api.d.ts +83 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +25 -2
- package/dist/api.js.map +1 -1
- package/dist/friction-tracker.d.ts +77 -0
- package/dist/friction-tracker.d.ts.map +1 -0
- package/dist/friction-tracker.js +202 -0
- package/dist/friction-tracker.js.map +1 -0
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +14 -6
- package/dist/onboarding.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +625 -50
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Friction tracker — aggressive, low-precision feedback firing for the agentry
|
|
2
|
+
// team to AI-review. Patterns intentionally trigger more than necessary; the
|
|
3
|
+
// catalog/triage process filters. Better to capture noise than miss a signal.
|
|
4
|
+
//
|
|
5
|
+
// Module-level state persists for the lifetime of the MCP subprocess (one per
|
|
6
|
+
// Claude Code session). Each handler that detects a friction pattern calls
|
|
7
|
+
// `maybeFile()` with a structured signal; this module decides whether to fire
|
|
8
|
+
// `agentry_send_feedback` based on (a) per-session dedupe — one filing per
|
|
9
|
+
// distinct fingerprint per session, (b) threshold rules for cumulative
|
|
10
|
+
// patterns (same tool failing N times).
|
|
11
|
+
//
|
|
12
|
+
// All firings are fire-and-forget (no await on the caller's side). The user
|
|
13
|
+
// sees a short "filed feedback" line appended to the response so they know
|
|
14
|
+
// what was logged.
|
|
15
|
+
import { api } from "./api.js";
|
|
16
|
+
const callHistory = [];
|
|
17
|
+
const filedFingerprints = new Set(); // dedupe per-session
|
|
18
|
+
const HISTORY_CAP = 100;
|
|
19
|
+
/** Record an MCP tool invocation outcome. Cheap; bounded ring buffer. */
|
|
20
|
+
export function recordCall(record) {
|
|
21
|
+
callHistory.push(record);
|
|
22
|
+
if (callHistory.length > HISTORY_CAP)
|
|
23
|
+
callHistory.shift();
|
|
24
|
+
}
|
|
25
|
+
/** Last N calls to a given tool. */
|
|
26
|
+
function recentForTool(tool, n) {
|
|
27
|
+
const out = [];
|
|
28
|
+
for (let i = callHistory.length - 1; i >= 0 && out.length < n; i--) {
|
|
29
|
+
if (callHistory[i].tool === tool)
|
|
30
|
+
out.push(callHistory[i]);
|
|
31
|
+
}
|
|
32
|
+
return out.reverse();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fire-and-forget feedback filing with per-session dedupe. Returns the
|
|
36
|
+
* fingerprint if it actually fired (so the caller can surface the user-facing
|
|
37
|
+
* "filed feedback" line) or null if deduped/skipped.
|
|
38
|
+
*
|
|
39
|
+
* Never throws — failures are swallowed; observability never breaks the tool.
|
|
40
|
+
*/
|
|
41
|
+
export function maybeFile(cfg, signal) {
|
|
42
|
+
if (filedFingerprints.has(signal.fingerprint))
|
|
43
|
+
return null;
|
|
44
|
+
if (!cfg.api_key)
|
|
45
|
+
return null; // can't file without auth
|
|
46
|
+
filedFingerprints.add(signal.fingerprint);
|
|
47
|
+
// Fire and forget. We don't await — the tool result returns to the user
|
|
48
|
+
// immediately and the feedback POST happens in the background.
|
|
49
|
+
void api.sendFeedback(cfg, {
|
|
50
|
+
kind: signal.kind,
|
|
51
|
+
message: signal.message,
|
|
52
|
+
agent_note: signal.agent_note,
|
|
53
|
+
tool_name: signal.tool_name,
|
|
54
|
+
attempt_count: signal.attempt_count,
|
|
55
|
+
project_id: signal.project_id,
|
|
56
|
+
}).catch(() => { });
|
|
57
|
+
return signal.fingerprint;
|
|
58
|
+
}
|
|
59
|
+
// ── Pattern detectors — call these from handlers ───────────────────────────
|
|
60
|
+
/**
|
|
61
|
+
* Detect: a recipe ran but returned 0 rows. Likely cause: required events
|
|
62
|
+
* aren't firing in the user's project (the recipe's HogQL hardcodes event
|
|
63
|
+
* names that don't exist or have no recent data). Aggressive trigger — empty
|
|
64
|
+
* results are sometimes legitimate (early stage app), but better to over-fire
|
|
65
|
+
* and let AI review filter.
|
|
66
|
+
*/
|
|
67
|
+
export function detectEmptyRecipe(cfg, input) {
|
|
68
|
+
if (input.rows_returned > 0)
|
|
69
|
+
return null;
|
|
70
|
+
return maybeFile(cfg, {
|
|
71
|
+
fingerprint: `empty_recipe:${input.recipe_id}`,
|
|
72
|
+
kind: "ux_friction",
|
|
73
|
+
message: `Recipe '${input.recipe_id}' returned 0 rows in user's project. Likely cause: required events aren't being instrumented in the user's app.`,
|
|
74
|
+
agent_note: JSON.stringify({
|
|
75
|
+
recipe_id: input.recipe_id,
|
|
76
|
+
rows_returned: 0,
|
|
77
|
+
required_events: input.required_events ?? [],
|
|
78
|
+
hypothesis: "events not flowing OR events firing but with wrong property values",
|
|
79
|
+
suggested_next_action: "agentry_verify_install with shapes to detect missing events / missing properties",
|
|
80
|
+
}),
|
|
81
|
+
tool_name: "agentry_run_recipe",
|
|
82
|
+
project_id: input.project_id,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Detect: a HogQL query the user (via agent) asked returned 0 rows. Less
|
|
87
|
+
* precise than empty-recipe — many ad-hoc queries are legitimately empty.
|
|
88
|
+
* Only fires if the query mentions an event name in WHERE and 0 rows came
|
|
89
|
+
* back, which is the most common "wrong event name" signal.
|
|
90
|
+
*/
|
|
91
|
+
export function detectEmptyAnalyticsQuery(cfg, input) {
|
|
92
|
+
if (input.rows_returned > 0)
|
|
93
|
+
return null;
|
|
94
|
+
// Heuristic: only fire if the query references a specific event name. Empty
|
|
95
|
+
// results on `count(distinct user_id)` or aggregates are typically real-data
|
|
96
|
+
// signals, not friction.
|
|
97
|
+
const eventNameMatch = input.query.match(/event\s*=\s*['"]([a-z_$][a-z0-9_]*)['"]/i);
|
|
98
|
+
if (!eventNameMatch)
|
|
99
|
+
return null;
|
|
100
|
+
const eventName = eventNameMatch[1];
|
|
101
|
+
return maybeFile(cfg, {
|
|
102
|
+
fingerprint: `empty_query_event:${eventName}`,
|
|
103
|
+
kind: "ux_friction",
|
|
104
|
+
message: `Agent ran an analytics query filtering on event='${eventName}' but got 0 rows. Either the event isn't being instrumented or the agent guessed the event name wrong.`,
|
|
105
|
+
agent_note: JSON.stringify({
|
|
106
|
+
event_name: eventName,
|
|
107
|
+
query_snippet: input.query.slice(0, 400),
|
|
108
|
+
rows_returned: 0,
|
|
109
|
+
hypothesis: "event name doesn't exist in this project's PostHog (typo, never instrumented, or wrong vocabulary for this app)",
|
|
110
|
+
}),
|
|
111
|
+
tool_name: "agentry_analytics_query",
|
|
112
|
+
project_id: input.project_id,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Detect: same tool returning errors N times in a row. Signals an agentry
|
|
117
|
+
* bug (the tool is broken for this input shape) or a UX issue (the tool's
|
|
118
|
+
* input schema is hard to satisfy).
|
|
119
|
+
*/
|
|
120
|
+
export function detectRepeatedFailure(cfg, toolName, threshold = 3) {
|
|
121
|
+
const recent = recentForTool(toolName, threshold);
|
|
122
|
+
if (recent.length < threshold)
|
|
123
|
+
return null;
|
|
124
|
+
if (!recent.every((r) => !r.ok))
|
|
125
|
+
return null;
|
|
126
|
+
return maybeFile(cfg, {
|
|
127
|
+
fingerprint: `repeated_failure:${toolName}`,
|
|
128
|
+
kind: "bug",
|
|
129
|
+
message: `Agent retried '${toolName}' ${threshold} times in a row, all failing. Tool is either broken for this input shape or the input schema is hard to satisfy.`,
|
|
130
|
+
agent_note: JSON.stringify({
|
|
131
|
+
tool_name: toolName,
|
|
132
|
+
failure_count: recent.length,
|
|
133
|
+
recent_error_codes: recent.map((r) => r.errorCode ?? "unknown"),
|
|
134
|
+
}),
|
|
135
|
+
tool_name: toolName,
|
|
136
|
+
attempt_count: recent.length,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Detect: agentry_install_guide called 2+ times in a single session. The
|
|
141
|
+
* install guide is meant to be fetched once and walked. Re-fetching means
|
|
142
|
+
* the agent lost context or thinks something's wrong with the previous
|
|
143
|
+
* fetch — either way, friction signal.
|
|
144
|
+
*/
|
|
145
|
+
export function detectGuideRefetched(cfg) {
|
|
146
|
+
const recent = recentForTool("agentry_install_guide", 5);
|
|
147
|
+
if (recent.length < 2)
|
|
148
|
+
return null;
|
|
149
|
+
return maybeFile(cfg, {
|
|
150
|
+
fingerprint: "guide_refetched",
|
|
151
|
+
kind: "ux_friction",
|
|
152
|
+
message: `Agent fetched agentry_install_guide ${recent.length} times in one session — signals the agent lost context or doubled back during install. The guide is meant to be fetched once and walked sequentially.`,
|
|
153
|
+
agent_note: JSON.stringify({
|
|
154
|
+
fetch_count: recent.length,
|
|
155
|
+
hypothesis: "install-guide step ordering may be unclear, OR a step's validate criteria didn't tell the agent it was done",
|
|
156
|
+
}),
|
|
157
|
+
tool_name: "agentry_install_guide",
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Detect: agent called list_recipes but didn't follow up with run_recipe
|
|
162
|
+
* within the next K tool calls. Signals "agent looked, didn't find a fit" —
|
|
163
|
+
* a soft recipe_proposal signal even when the agent didn't realize it.
|
|
164
|
+
*/
|
|
165
|
+
export function detectRecipeLookedAtNotRun(cfg, withinCalls = 5) {
|
|
166
|
+
const lastListIdx = (() => {
|
|
167
|
+
for (let i = callHistory.length - 1; i >= 0; i--) {
|
|
168
|
+
if (callHistory[i].tool === "agentry_list_recipes")
|
|
169
|
+
return i;
|
|
170
|
+
}
|
|
171
|
+
return -1;
|
|
172
|
+
})();
|
|
173
|
+
if (lastListIdx < 0)
|
|
174
|
+
return null;
|
|
175
|
+
// Need at least `withinCalls` post-list-call frames to evaluate.
|
|
176
|
+
const post = callHistory.slice(lastListIdx + 1);
|
|
177
|
+
if (post.length < withinCalls)
|
|
178
|
+
return null;
|
|
179
|
+
if (post.some((c) => c.tool === "agentry_run_recipe"))
|
|
180
|
+
return null;
|
|
181
|
+
return maybeFile(cfg, {
|
|
182
|
+
fingerprint: `list_recipes_unused:${lastListIdx}`,
|
|
183
|
+
kind: "ux_friction",
|
|
184
|
+
message: `Agent fetched agentry_list_recipes but didn't run any recipe in the next ${withinCalls} calls. The catalog likely doesn't have what the user asked for.`,
|
|
185
|
+
agent_note: JSON.stringify({
|
|
186
|
+
hypothesis: "missing recipe — the user asked something the catalog doesn't cover",
|
|
187
|
+
suggested_action: "agent should also file kind='recipe_proposal' with the user's question",
|
|
188
|
+
}),
|
|
189
|
+
tool_name: "agentry_list_recipes",
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
// ── Helpers for handlers to append a user-facing note ──────────────────────
|
|
193
|
+
/**
|
|
194
|
+
* Append a one-line "filed feedback" suffix to a tool result's next_action
|
|
195
|
+
* (or wherever the user-facing text lives) so the user knows feedback fired.
|
|
196
|
+
*/
|
|
197
|
+
export function frictionNoticeSuffix(fingerprint) {
|
|
198
|
+
if (!fingerprint)
|
|
199
|
+
return "";
|
|
200
|
+
return ` (Filed friction feedback to the agentry team: ${fingerprint}.)`;
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=friction-tracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"friction-tracker.js","sourceRoot":"","sources":["../src/friction-tracker.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,8EAA8E;AAC9E,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,2EAA2E;AAC3E,uEAAuE;AACvE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,mBAAmB;AAGnB,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAa/B,MAAM,WAAW,GAAiB,EAAE,CAAC;AACrC,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC,CAAC,qBAAqB;AAClE,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,yEAAyE;AACz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AAO,EAAE,4EAA4E,WAAW,kEAAkE;QAClK,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;YACzB,UAAU,EAAE,qEAAqE;YACjF,gBAAgB,EAAE,wEAAwE;SAC3F,CAAC;QACF,SAAS,EAAE,sBAAsB;KAClC,CAAC,CAAC;AACL,CAAC;AAED,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAA0B;IAC7D,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAC5B,OAAO,kDAAkD,WAAW,IAAI,CAAC;AAC3E,CAAC"}
|
package/dist/onboarding.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../src/onboarding.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,eAAe,GAAG,OAAO,CAAC;AAElF,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../src/onboarding.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,eAAe,GAAG,OAAO,CAAC;AAElF,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CA4DpE"}
|
package/dist/onboarding.js
CHANGED
|
@@ -6,9 +6,10 @@ export function getOnboardingHint(cfg) {
|
|
|
6
6
|
state: "no_key",
|
|
7
7
|
next_tool: "agentry_login",
|
|
8
8
|
next_action: "Call `agentry_login`. It returns a verification URL and a short user_code; " +
|
|
9
|
-
"ask the user to open the URL in their browser
|
|
10
|
-
"
|
|
11
|
-
|
|
9
|
+
"ask the user to open the URL in their browser. They'll sign in with their provider " +
|
|
10
|
+
"of choice (GitHub, Google, or magic link). " +
|
|
11
|
+
"The tool blocks until they authorize (~30s), then persists the api_key locally.",
|
|
12
|
+
message: "No API key on file. Call `agentry_login` to authenticate (any of GitHub / Google / magic link).",
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
const projectIds = Object.keys(cfg.projects);
|
|
@@ -21,9 +22,16 @@ export function getOnboardingHint(cfg) {
|
|
|
21
22
|
message: "API key on file, but no project yet. Call `agentry_create_project` to mint a DSN.",
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const defaultProject = cfg.projects[cfg.default_project_id] ?? null;
|
|
26
|
+
if (defaultProject?.analytics_ready === false) {
|
|
27
|
+
return {
|
|
28
|
+
state: "needs_install",
|
|
29
|
+
next_tool: "agentry_repair_analytics",
|
|
30
|
+
next_action: "This project's analytics backend is not ready yet. Call `agentry_repair_analytics` for the " +
|
|
31
|
+
`default project (${cfg.default_project_id}), then re-run agentry_verify_install.`,
|
|
32
|
+
message: "Project exists, but project-scoped analytics provisioning still needs repair.",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
27
35
|
const anyVerified = projectIds.some((id) => cfg.projects[id]?.install_verified === true);
|
|
28
36
|
if (!anyVerified) {
|
|
29
37
|
return {
|
package/dist/onboarding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../src/onboarding.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,yEAAyE;AAazE,MAAM,UAAU,iBAAiB,CAAC,GAAkB;IAClD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO;YACL,KAAK,EAAE,QAAQ;YACf,SAAS,EAAE,eAAe;YAC1B,WAAW,EACT,6EAA6E;gBAC7E,
|
|
1
|
+
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../src/onboarding.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,yEAAyE;AAazE,MAAM,UAAU,iBAAiB,CAAC,GAAkB;IAClD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO;YACL,KAAK,EAAE,QAAQ;YACf,SAAS,EAAE,eAAe;YAC1B,WAAW,EACT,6EAA6E;gBAC7E,qFAAqF;gBACrF,6CAA6C;gBAC7C,iFAAiF;YACnF,OAAO,EACL,iGAAiG;SACpG,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;QACvD,OAAO;YACL,KAAK,EAAE,YAAY;YACnB,SAAS,EAAE,wBAAwB;YACnC,WAAW,EACT,sFAAsF;gBACtF,4FAA4F;YAC9F,OAAO,EACL,mFAAmF;SACtF,CAAC;IACJ,CAAC;IAED,MAAM,cAAc,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAC;IACpE,IAAI,cAAc,EAAE,eAAe,KAAK,KAAK,EAAE,CAAC;QAC9C,OAAO;YACL,KAAK,EAAE,eAAe;YACtB,SAAS,EAAE,0BAA0B;YACrC,WAAW,EACT,6FAA6F;gBAC7F,oBAAoB,GAAG,CAAC,kBAAkB,wCAAwC;YACpF,OAAO,EACL,+EAA+E;SAClF,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC,CAAC;IACzF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO;YACL,KAAK,EAAE,eAAe;YACtB,SAAS,EAAE,uBAAuB;YAClC,WAAW,EACT,2DAA2D;gBAC3D,2FAA2F;gBAC3F,oGAAoG;YACtG,OAAO,EAAE,sGAAsG;SAChH,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,oBAAoB;QAC/B,WAAW,EACT,oEAAoE;YACpE,mDAAmD;QACrD,OAAO,EAAE,mEAAmE;KAC7E,CAAC;AACJ,CAAC"}
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA2jD5C,CAAC;AA8HF,MAAM,WAAW,UAAU;IAEzB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC,OAAO,CAAC,UAAU,CAAC,CA6BrB"}
|