@armoriq/sdk-dev 0.3.8 → 0.3.9
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/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/google_adk_mcp_toolset.d.ts +64 -0
- package/dist/integrations/google_adk_mcp_toolset.d.ts.map +1 -0
- package/dist/integrations/google_adk_mcp_toolset.js +91 -0
- package/dist/integrations/google_adk_mcp_toolset.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export { ArmorIQException, InvalidTokenException, IntentMismatchException, MCPIn
|
|
|
14
14
|
export { IntentToken, PlanCapture, MCPInvocation, MCPInvocationResult, DelegationRequest, DelegationResult, SDKConfig, MCPSemanticMetadata, ToolSemanticEntry, PolicyContext, InvokeOptions, HoldInfo, DelegationRequestParams, DelegationRequestResult, ApprovedDelegation, ToolCall, McpCredential, McpCredentialMap, } from './models';
|
|
15
15
|
export { defaultToolNameParser, buildPlanFromToolCalls, hashToolCalls, ToolNameParser, PlanStep, BuiltPlan, } from './plan_builder';
|
|
16
16
|
export { ArmorIQConfig, ArmorIQConfigError, IdentityConfig, ProxyConfig, MCPAuthConfig, MCPAuthType, MCPServerConfig, PolicyConfig, IntentConfig, Environment, loadArmorIQConfig, parseArmorIQConfig, resolveEnvReference, resolveEnvReferences, saveArmorIQConfig, DEFAULT_PROXY_URL, } from './config';
|
|
17
|
+
export { ArmorIQMCPToolset } from './integrations/google_adk_mcp_toolset';
|
|
18
|
+
export type { ArmorIQMCPToolsetOptions } from './integrations/google_adk_mcp_toolset';
|
|
17
19
|
export declare const VERSION = "0.3.0";
|
|
18
20
|
export declare const AUTHOR = "ArmorIQ Team";
|
|
19
21
|
export declare const EMAIL = "license@armoriq.io";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EACL,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,EACb,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,QAAQ,EACR,SAAS,GACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,eAAO,MAAM,KAAK,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG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.3.0
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.EMAIL = exports.AUTHOR = exports.VERSION = exports.DEFAULT_PROXY_URL = exports.saveArmorIQConfig = exports.resolveEnvReferences = exports.resolveEnvReference = exports.parseArmorIQConfig = exports.loadArmorIQConfig = exports.ArmorIQConfigError = exports.hashToolCalls = exports.buildPlanFromToolCalls = exports.defaultToolNameParser = exports.IntentToken = exports.PolicyHoldException = exports.PolicyBlockedException = exports.ConfigurationException = exports.RevokedTokenError = exports.DelegationException = exports.TokenExpiredException = exports.MCPInvocationException = exports.IntentMismatchException = exports.InvalidTokenException = exports.ArmorIQException = exports.ArmorIQSession = exports.ArmorIQUserScope = exports.ArmorIQClient = void 0;
|
|
13
|
+
exports.EMAIL = exports.AUTHOR = exports.VERSION = exports.ArmorIQMCPToolset = exports.DEFAULT_PROXY_URL = exports.saveArmorIQConfig = exports.resolveEnvReferences = exports.resolveEnvReference = exports.parseArmorIQConfig = exports.loadArmorIQConfig = exports.ArmorIQConfigError = exports.hashToolCalls = exports.buildPlanFromToolCalls = exports.defaultToolNameParser = exports.IntentToken = exports.PolicyHoldException = exports.PolicyBlockedException = exports.ConfigurationException = exports.RevokedTokenError = exports.DelegationException = exports.TokenExpiredException = exports.MCPInvocationException = exports.IntentMismatchException = exports.InvalidTokenException = exports.ArmorIQException = exports.ArmorIQSession = exports.ArmorIQUserScope = exports.ArmorIQClient = void 0;
|
|
14
14
|
var client_1 = require("./client");
|
|
15
15
|
Object.defineProperty(exports, "ArmorIQClient", { enumerable: true, get: function () { return client_1.ArmorIQClient; } });
|
|
16
16
|
Object.defineProperty(exports, "ArmorIQUserScope", { enumerable: true, get: function () { return client_1.ArmorIQUserScope; } });
|
|
@@ -41,6 +41,8 @@ Object.defineProperty(exports, "resolveEnvReference", { enumerable: true, get: f
|
|
|
41
41
|
Object.defineProperty(exports, "resolveEnvReferences", { enumerable: true, get: function () { return config_1.resolveEnvReferences; } });
|
|
42
42
|
Object.defineProperty(exports, "saveArmorIQConfig", { enumerable: true, get: function () { return config_1.saveArmorIQConfig; } });
|
|
43
43
|
Object.defineProperty(exports, "DEFAULT_PROXY_URL", { enumerable: true, get: function () { return config_1.DEFAULT_PROXY_URL; } });
|
|
44
|
+
var google_adk_mcp_toolset_1 = require("./integrations/google_adk_mcp_toolset");
|
|
45
|
+
Object.defineProperty(exports, "ArmorIQMCPToolset", { enumerable: true, get: function () { return google_adk_mcp_toolset_1.ArmorIQMCPToolset; } });
|
|
44
46
|
exports.VERSION = '0.3.0';
|
|
45
47
|
exports.AUTHOR = 'ArmorIQ Team';
|
|
46
48
|
exports.EMAIL = 'license@armoriq.io';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,mCAA2D;AAAlD,uGAAA,aAAa,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AACxC,qCAMmB;AALjB,yGAAA,cAAc,OAAA;AAMhB,2CAWsB;AAVpB,8GAAA,gBAAgB,OAAA;AAChB,mHAAA,qBAAqB,OAAA;AACrB,qHAAA,uBAAuB,OAAA;AACvB,oHAAA,sBAAsB,OAAA;AACtB,mHAAA,qBAAqB,OAAA;AACrB,iHAAA,mBAAmB,OAAA;AACnB,+GAAA,iBAAiB,OAAA;AACjB,oHAAA,sBAAsB,OAAA;AACtB,oHAAA,sBAAsB,OAAA;AACtB,iHAAA,mBAAmB,OAAA;AAErB,mCAmBkB;AAlBhB,qGAAA,WAAW,OAAA;AAoBb,+CAOwB;AANtB,qHAAA,qBAAqB,OAAA;AACrB,sHAAA,sBAAsB,OAAA;AACtB,6GAAA,aAAa,OAAA;AAMf,mCAiBkB;AAfhB,4GAAA,kBAAkB,OAAA;AASlB,2GAAA,iBAAiB,OAAA;AACjB,4GAAA,kBAAkB,OAAA;AAClB,6GAAA,mBAAmB,OAAA;AACnB,8GAAA,oBAAoB,OAAA;AACpB,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,mCAA2D;AAAlD,uGAAA,aAAa,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AACxC,qCAMmB;AALjB,yGAAA,cAAc,OAAA;AAMhB,2CAWsB;AAVpB,8GAAA,gBAAgB,OAAA;AAChB,mHAAA,qBAAqB,OAAA;AACrB,qHAAA,uBAAuB,OAAA;AACvB,oHAAA,sBAAsB,OAAA;AACtB,mHAAA,qBAAqB,OAAA;AACrB,iHAAA,mBAAmB,OAAA;AACnB,+GAAA,iBAAiB,OAAA;AACjB,oHAAA,sBAAsB,OAAA;AACtB,oHAAA,sBAAsB,OAAA;AACtB,iHAAA,mBAAmB,OAAA;AAErB,mCAmBkB;AAlBhB,qGAAA,WAAW,OAAA;AAoBb,+CAOwB;AANtB,qHAAA,qBAAqB,OAAA;AACrB,sHAAA,sBAAsB,OAAA;AACtB,6GAAA,aAAa,OAAA;AAMf,mCAiBkB;AAfhB,4GAAA,kBAAkB,OAAA;AASlB,2GAAA,iBAAiB,OAAA;AACjB,4GAAA,kBAAkB,OAAA;AAClB,6GAAA,mBAAmB,OAAA;AACnB,8GAAA,oBAAoB,OAAA;AACpB,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;AAGnB,gFAA0E;AAAjE,2HAAA,iBAAiB,OAAA;AAGb,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,cAAc,CAAC;AACxB,QAAA,KAAK,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArmorIQ — Drop-in replacement for ADK's MCPToolset that routes every
|
|
3
|
+
* tool execution through armoriq-proxy-server instead of fetching the
|
|
4
|
+
* MCP HTTP endpoint directly.
|
|
5
|
+
*
|
|
6
|
+
* import { MCPToolset } from '@google/adk';
|
|
7
|
+
* import { ArmorIQMCPToolset } from '@armoriq/sdk-dev/integrations/google_adk_mcp_toolset';
|
|
8
|
+
*
|
|
9
|
+
* const fhir = new ArmorIQMCPToolset({
|
|
10
|
+
* mcpName: 'fhir-mcp',
|
|
11
|
+
* getSession: () => armoriq.currentScope?.session,
|
|
12
|
+
* client: armoriq.client,
|
|
13
|
+
* inner: new MCPToolset({ type: 'StreamableHTTPConnectionParams', url: FHIR_MCP_URL }),
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* new LlmAgent({ tools: [fhir], ... });
|
|
17
|
+
*
|
|
18
|
+
* What changes vs. raw MCPToolset:
|
|
19
|
+
* - Tool discovery (getTools) still hits the real MCP URL via the
|
|
20
|
+
* wrapped inner instance, so the LLM gets accurate schemas.
|
|
21
|
+
* - Tool *execution* (runAsync) is rerouted through client.invoke(),
|
|
22
|
+
* which POSTs to {proxyEndpoint}/invoke. The proxy then runs its
|
|
23
|
+
* per-call enforcement chain (PAP verify, OPA decision, audit) and
|
|
24
|
+
* forwards to the upstream MCP server-side — the agent process
|
|
25
|
+
* never fetches the MCP directly during an LLM-driven tool call.
|
|
26
|
+
*/
|
|
27
|
+
import type { ArmorIQClient } from '../client';
|
|
28
|
+
import type { ArmorIQSession } from '../session';
|
|
29
|
+
export interface ArmorIQMCPToolsetOptions {
|
|
30
|
+
/** Name of the MCP server as registered in conmap (e.g. "fhir-mcp"). */
|
|
31
|
+
mcpName: string;
|
|
32
|
+
/** The real ADK MCPToolset instance to wrap. */
|
|
33
|
+
inner: any;
|
|
34
|
+
/** SDK client used to route tool calls through the proxy. */
|
|
35
|
+
client: ArmorIQClient;
|
|
36
|
+
/**
|
|
37
|
+
* Callback returning the current per-request session. Called at
|
|
38
|
+
* runAsync time so the wrapper picks up the intent token minted for
|
|
39
|
+
* the active turn. Return undefined to skip the proxy and fall back
|
|
40
|
+
* to a direct MCP call.
|
|
41
|
+
*/
|
|
42
|
+
getSession: () => ArmorIQSession | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* When true, throw if the proxy call can't be made (no session / no
|
|
45
|
+
* token / proxy unreachable). When false (default), fall back to a
|
|
46
|
+
* direct MCP call so the agent stays functional. Set true in prod.
|
|
47
|
+
*/
|
|
48
|
+
proxyRequired?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare class ArmorIQMCPToolset {
|
|
51
|
+
private readonly inner;
|
|
52
|
+
private readonly client;
|
|
53
|
+
private readonly mcpName;
|
|
54
|
+
private readonly getSession;
|
|
55
|
+
private readonly proxyRequired;
|
|
56
|
+
readonly toolFilter: any;
|
|
57
|
+
readonly prefix: any;
|
|
58
|
+
constructor(opts: ArmorIQMCPToolsetOptions);
|
|
59
|
+
getTools(context?: any): Promise<any[]>;
|
|
60
|
+
close(): Promise<void>;
|
|
61
|
+
processLlmRequest(toolContext: any, llmRequest: any): Promise<void> | undefined;
|
|
62
|
+
private wrap;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=google_adk_mcp_toolset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google_adk_mcp_toolset.d.ts","sourceRoot":"","sources":["../../src/integrations/google_adk_mcp_toolset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,wBAAwB;IACvC,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,KAAK,EAAE,GAAG,CAAC;IACX,6DAA6D;IAC7D,MAAM,EAAE,aAAa,CAAC;IACtB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,cAAc,GAAG,SAAS,CAAC;IAC7C;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAM;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IAKxC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;gBAET,IAAI,EAAE,wBAAwB;IAapC,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAKvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,iBAAiB,CAAC,WAAW,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS;IAI/E,OAAO,CAAC,IAAI;CAkCb"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ArmorIQ — Drop-in replacement for ADK's MCPToolset that routes every
|
|
4
|
+
* tool execution through armoriq-proxy-server instead of fetching the
|
|
5
|
+
* MCP HTTP endpoint directly.
|
|
6
|
+
*
|
|
7
|
+
* import { MCPToolset } from '@google/adk';
|
|
8
|
+
* import { ArmorIQMCPToolset } from '@armoriq/sdk-dev/integrations/google_adk_mcp_toolset';
|
|
9
|
+
*
|
|
10
|
+
* const fhir = new ArmorIQMCPToolset({
|
|
11
|
+
* mcpName: 'fhir-mcp',
|
|
12
|
+
* getSession: () => armoriq.currentScope?.session,
|
|
13
|
+
* client: armoriq.client,
|
|
14
|
+
* inner: new MCPToolset({ type: 'StreamableHTTPConnectionParams', url: FHIR_MCP_URL }),
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* new LlmAgent({ tools: [fhir], ... });
|
|
18
|
+
*
|
|
19
|
+
* What changes vs. raw MCPToolset:
|
|
20
|
+
* - Tool discovery (getTools) still hits the real MCP URL via the
|
|
21
|
+
* wrapped inner instance, so the LLM gets accurate schemas.
|
|
22
|
+
* - Tool *execution* (runAsync) is rerouted through client.invoke(),
|
|
23
|
+
* which POSTs to {proxyEndpoint}/invoke. The proxy then runs its
|
|
24
|
+
* per-call enforcement chain (PAP verify, OPA decision, audit) and
|
|
25
|
+
* forwards to the upstream MCP server-side — the agent process
|
|
26
|
+
* never fetches the MCP directly during an LLM-driven tool call.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ArmorIQMCPToolset = void 0;
|
|
30
|
+
class ArmorIQMCPToolset {
|
|
31
|
+
inner;
|
|
32
|
+
client;
|
|
33
|
+
mcpName;
|
|
34
|
+
getSession;
|
|
35
|
+
proxyRequired;
|
|
36
|
+
// ADK's BaseToolset is detected via a private symbol. Copy any symbol
|
|
37
|
+
// properties off the inner instance so duck-type checks see us as a
|
|
38
|
+
// valid toolset.
|
|
39
|
+
toolFilter;
|
|
40
|
+
prefix;
|
|
41
|
+
constructor(opts) {
|
|
42
|
+
this.inner = opts.inner;
|
|
43
|
+
this.client = opts.client;
|
|
44
|
+
this.mcpName = opts.mcpName;
|
|
45
|
+
this.getSession = opts.getSession;
|
|
46
|
+
this.proxyRequired = opts.proxyRequired ?? false;
|
|
47
|
+
this.toolFilter = this.inner.toolFilter ?? [];
|
|
48
|
+
this.prefix = this.inner.prefix;
|
|
49
|
+
for (const sym of Object.getOwnPropertySymbols(this.inner)) {
|
|
50
|
+
this[sym] = this.inner[sym];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async getTools(context) {
|
|
54
|
+
const tools = await this.inner.getTools(context);
|
|
55
|
+
return tools.map((tool) => this.wrap(tool));
|
|
56
|
+
}
|
|
57
|
+
async close() {
|
|
58
|
+
return this.inner.close();
|
|
59
|
+
}
|
|
60
|
+
processLlmRequest(toolContext, llmRequest) {
|
|
61
|
+
return this.inner.processLlmRequest?.(toolContext, llmRequest);
|
|
62
|
+
}
|
|
63
|
+
wrap(tool) {
|
|
64
|
+
const client = this.client;
|
|
65
|
+
const mcpName = this.mcpName;
|
|
66
|
+
const proxyRequired = this.proxyRequired;
|
|
67
|
+
const getSession = this.getSession;
|
|
68
|
+
const origRunAsync = tool.runAsync?.bind(tool);
|
|
69
|
+
tool.runAsync = async (request) => {
|
|
70
|
+
const session = getSession();
|
|
71
|
+
const intentToken = session?.currentToken;
|
|
72
|
+
if (session && intentToken) {
|
|
73
|
+
try {
|
|
74
|
+
return await client.invoke(mcpName, tool.name, intentToken, request.args ?? {});
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
if (proxyRequired || !origRunAsync)
|
|
78
|
+
throw err;
|
|
79
|
+
console.warn(`[armoriq] proxy invoke failed for ${tool.name}: ${err.message} — falling back to direct MCP call`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else if (proxyRequired) {
|
|
83
|
+
throw new Error(`[armoriq] ArmorIQMCPToolset: no active session or intent token for tool ${tool.name}`);
|
|
84
|
+
}
|
|
85
|
+
return origRunAsync ? origRunAsync(request) : undefined;
|
|
86
|
+
};
|
|
87
|
+
return tool;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.ArmorIQMCPToolset = ArmorIQMCPToolset;
|
|
91
|
+
//# sourceMappingURL=google_adk_mcp_toolset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google_adk_mcp_toolset.js","sourceRoot":"","sources":["../../src/integrations/google_adk_mcp_toolset.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AA2BH,MAAa,iBAAiB;IACX,KAAK,CAAM;IACX,MAAM,CAAgB;IACtB,OAAO,CAAS;IAChB,UAAU,CAAmC;IAC7C,aAAa,CAAU;IAExC,s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