@adonis-agora/agent 0.76.3 → 0.77.1
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/CHANGELOG.md +22 -0
- package/dist/providers/agent_provider.d.ts.map +1 -1
- package/dist/providers/agent_provider.js +9 -0
- package/dist/providers/agent_provider.js.map +1 -1
- package/dist/providers/mcp_provider.d.ts.map +1 -1
- package/dist/providers/mcp_provider.js +46 -10
- package/dist/providers/mcp_provider.js.map +1 -1
- package/dist/providers/poppy_connections_provider.d.ts +17 -0
- package/dist/providers/poppy_connections_provider.d.ts.map +1 -0
- package/dist/providers/poppy_connections_provider.js +186 -0
- package/dist/providers/poppy_connections_provider.js.map +1 -0
- package/dist/providers/poppy_provider.d.ts +12 -0
- package/dist/providers/poppy_provider.d.ts.map +1 -0
- package/dist/providers/poppy_provider.js +159 -0
- package/dist/providers/poppy_provider.js.map +1 -0
- package/dist/src/a2a/handler.d.ts.map +1 -1
- package/dist/src/a2a/handler.js +4 -2
- package/dist/src/a2a/handler.js.map +1 -1
- package/dist/src/a2a/turn.d.ts +27 -4
- package/dist/src/a2a/turn.d.ts.map +1 -1
- package/dist/src/a2a/turn.js +66 -12
- package/dist/src/a2a/turn.js.map +1 -1
- package/dist/src/action-proposal-approval.d.ts.map +1 -1
- package/dist/src/action-proposal-approval.js +3 -3
- package/dist/src/action-proposal-approval.js.map +1 -1
- package/dist/src/action-proposal-listeners.d.ts +12 -0
- package/dist/src/action-proposal-listeners.d.ts.map +1 -0
- package/dist/src/action-proposal-listeners.js +27 -0
- package/dist/src/action-proposal-listeners.js.map +1 -0
- package/dist/src/action-proposal-receipt.d.ts +4 -0
- package/dist/src/action-proposal-receipt.d.ts.map +1 -1
- package/dist/src/action-proposal-receipt.js +3 -1
- package/dist/src/action-proposal-receipt.js.map +1 -1
- package/dist/src/action-proposal-worker.d.ts +6 -1
- package/dist/src/action-proposal-worker.d.ts.map +1 -1
- package/dist/src/action-proposal-worker.js +10 -1
- package/dist/src/action-proposal-worker.js.map +1 -1
- package/dist/src/agent-loop.d.ts.map +1 -1
- package/dist/src/agent-loop.js +8 -5
- package/dist/src/agent-loop.js.map +1 -1
- package/dist/src/channels/handler.d.ts +10 -0
- package/dist/src/channels/handler.d.ts.map +1 -1
- package/dist/src/channels/handler.js +47 -1
- package/dist/src/channels/handler.js.map +1 -1
- package/dist/src/channels/texts.d.ts +9 -0
- package/dist/src/channels/texts.d.ts.map +1 -1
- package/dist/src/channels/texts.js +4 -0
- package/dist/src/channels/texts.js.map +1 -1
- package/dist/src/client/sse.d.ts.map +1 -1
- package/dist/src/client/sse.js +3 -0
- package/dist/src/client/sse.js.map +1 -1
- package/dist/src/define_config.d.ts +3 -0
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/genui/channels.d.ts +5 -0
- package/dist/src/genui/channels.d.ts.map +1 -1
- package/dist/src/genui/channels.js +11 -0
- package/dist/src/genui/channels.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/auth.d.ts +17 -0
- package/dist/src/mcp/auth.d.ts.map +1 -1
- package/dist/src/mcp/auth.js +56 -1
- package/dist/src/mcp/auth.js.map +1 -1
- package/dist/src/mcp/discovery.d.ts +13 -2
- package/dist/src/mcp/discovery.d.ts.map +1 -1
- package/dist/src/mcp/discovery.js +17 -2
- package/dist/src/mcp/discovery.js.map +1 -1
- package/dist/src/mcp/index.d.ts +1 -1
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/mcp/scope.d.ts +13 -0
- package/dist/src/mcp/scope.d.ts.map +1 -0
- package/dist/src/mcp/scope.js +24 -0
- package/dist/src/mcp/scope.js.map +1 -0
- package/dist/src/mcp/server.d.ts +6 -1
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +1 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/poppy/auth.d.ts +77 -0
- package/dist/src/poppy/auth.d.ts.map +1 -0
- package/dist/src/poppy/auth.js +16 -0
- package/dist/src/poppy/auth.js.map +1 -0
- package/dist/src/poppy/conversations.d.ts +249 -0
- package/dist/src/poppy/conversations.d.ts.map +1 -0
- package/dist/src/poppy/conversations.js +1017 -0
- package/dist/src/poppy/conversations.js.map +1 -0
- package/dist/src/poppy/define_config.d.ts +98 -0
- package/dist/src/poppy/define_config.d.ts.map +1 -0
- package/dist/src/poppy/define_config.js +11 -0
- package/dist/src/poppy/define_config.js.map +1 -0
- package/dist/src/poppy/endpoints.d.ts +25 -0
- package/dist/src/poppy/endpoints.d.ts.map +1 -0
- package/dist/src/poppy/endpoints.js +31 -0
- package/dist/src/poppy/endpoints.js.map +1 -0
- package/dist/src/poppy/handler.d.ts +80 -0
- package/dist/src/poppy/handler.d.ts.map +1 -0
- package/dist/src/poppy/handler.js +362 -0
- package/dist/src/poppy/handler.js.map +1 -0
- package/dist/src/poppy/index.d.ts +17 -0
- package/dist/src/poppy/index.d.ts.map +1 -0
- package/dist/src/poppy/index.js +9 -0
- package/dist/src/poppy/index.js.map +1 -0
- package/dist/src/poppy/protocol.d.ts +132 -0
- package/dist/src/poppy/protocol.d.ts.map +1 -0
- package/dist/src/poppy/protocol.js +178 -0
- package/dist/src/poppy/protocol.js.map +1 -0
- package/dist/src/poppy/redis-store.d.ts +27 -0
- package/dist/src/poppy/redis-store.d.ts.map +1 -0
- package/dist/src/poppy/redis-store.js +148 -0
- package/dist/src/poppy/redis-store.js.map +1 -0
- package/dist/src/poppy/runtime.d.ts +6 -0
- package/dist/src/poppy/runtime.d.ts.map +1 -0
- package/dist/src/poppy/runtime.js +12 -0
- package/dist/src/poppy/runtime.js.map +1 -0
- package/dist/src/poppy/server_middleware.d.ts +11 -0
- package/dist/src/poppy/server_middleware.d.ts.map +1 -0
- package/dist/src/poppy/server_middleware.js +16 -0
- package/dist/src/poppy/server_middleware.js.map +1 -0
- package/dist/src/poppy/store.d.ts +207 -0
- package/dist/src/poppy/store.d.ts.map +1 -0
- package/dist/src/poppy/store.js +444 -0
- package/dist/src/poppy/store.js.map +1 -0
- package/dist/src/poppy-client/api.d.ts +36 -0
- package/dist/src/poppy-client/api.d.ts.map +1 -0
- package/dist/src/poppy-client/api.js +77 -0
- package/dist/src/poppy-client/api.js.map +1 -0
- package/dist/src/poppy-client/bin/poppy-agent.d.ts +3 -0
- package/dist/src/poppy-client/bin/poppy-agent.d.ts.map +1 -0
- package/dist/src/poppy-client/bin/poppy-agent.js +9 -0
- package/dist/src/poppy-client/bin/poppy-agent.js.map +1 -0
- package/dist/src/poppy-client/browser.d.ts +24 -0
- package/dist/src/poppy-client/browser.d.ts.map +1 -0
- package/dist/src/poppy-client/browser.js +83 -0
- package/dist/src/poppy-client/browser.js.map +1 -0
- package/dist/src/poppy-client/cli/main.d.ts +2 -0
- package/dist/src/poppy-client/cli/main.d.ts.map +1 -0
- package/dist/src/poppy-client/cli/main.js +776 -0
- package/dist/src/poppy-client/cli/main.js.map +1 -0
- package/dist/src/poppy-client/cli/prompt.d.ts +13 -0
- package/dist/src/poppy-client/cli/prompt.d.ts.map +1 -0
- package/dist/src/poppy-client/cli/prompt.js +50 -0
- package/dist/src/poppy-client/cli/prompt.js.map +1 -0
- package/dist/src/poppy-client/company.d.ts +87 -0
- package/dist/src/poppy-client/company.d.ts.map +1 -0
- package/dist/src/poppy-client/company.js +336 -0
- package/dist/src/poppy-client/company.js.map +1 -0
- package/dist/src/poppy-client/conversations.d.ts +89 -0
- package/dist/src/poppy-client/conversations.d.ts.map +1 -0
- package/dist/src/poppy-client/conversations.js +332 -0
- package/dist/src/poppy-client/conversations.js.map +1 -0
- package/dist/src/poppy-client/discovery.d.ts +41 -0
- package/dist/src/poppy-client/discovery.d.ts.map +1 -0
- package/dist/src/poppy-client/discovery.js +217 -0
- package/dist/src/poppy-client/discovery.js.map +1 -0
- package/dist/src/poppy-client/dpop.d.ts +19 -0
- package/dist/src/poppy-client/dpop.d.ts.map +1 -0
- package/dist/src/poppy-client/dpop.js +43 -0
- package/dist/src/poppy-client/dpop.js.map +1 -0
- package/dist/src/poppy-client/errors.d.ts +50 -0
- package/dist/src/poppy-client/errors.d.ts.map +1 -0
- package/dist/src/poppy-client/errors.js +55 -0
- package/dist/src/poppy-client/errors.js.map +1 -0
- package/dist/src/poppy-client/http.d.ts +40 -0
- package/dist/src/poppy-client/http.d.ts.map +1 -0
- package/dist/src/poppy-client/http.js +95 -0
- package/dist/src/poppy-client/http.js.map +1 -0
- package/dist/src/poppy-client/identity.d.ts +61 -0
- package/dist/src/poppy-client/identity.d.ts.map +1 -0
- package/dist/src/poppy-client/identity.js +111 -0
- package/dist/src/poppy-client/identity.js.map +1 -0
- package/dist/src/poppy-client/identity_server.d.ts +29 -0
- package/dist/src/poppy-client/identity_server.d.ts.map +1 -0
- package/dist/src/poppy-client/identity_server.js +84 -0
- package/dist/src/poppy-client/identity_server.js.map +1 -0
- package/dist/src/poppy-client/index.d.ts +19 -0
- package/dist/src/poppy-client/index.d.ts.map +1 -0
- package/dist/src/poppy-client/index.js +18 -0
- package/dist/src/poppy-client/index.js.map +1 -0
- package/dist/src/poppy-client/keys.d.ts +13 -0
- package/dist/src/poppy-client/keys.d.ts.map +1 -0
- package/dist/src/poppy-client/keys.js +31 -0
- package/dist/src/poppy-client/keys.js.map +1 -0
- package/dist/src/poppy-client/llm.d.ts +31 -0
- package/dist/src/poppy-client/llm.d.ts.map +1 -0
- package/dist/src/poppy-client/llm.js +230 -0
- package/dist/src/poppy-client/llm.js.map +1 -0
- package/dist/src/poppy-client/mcp.d.ts +16 -0
- package/dist/src/poppy-client/mcp.d.ts.map +1 -0
- package/dist/src/poppy-client/mcp.js +57 -0
- package/dist/src/poppy-client/mcp.js.map +1 -0
- package/dist/src/poppy-client/open_url.d.ts +3 -0
- package/dist/src/poppy-client/open_url.d.ts.map +1 -0
- package/dist/src/poppy-client/open_url.js +13 -0
- package/dist/src/poppy-client/open_url.js.map +1 -0
- package/dist/src/poppy-client/signin.d.ts +59 -0
- package/dist/src/poppy-client/signin.d.ts.map +1 -0
- package/dist/src/poppy-client/signin.js +210 -0
- package/dist/src/poppy-client/signin.js.map +1 -0
- package/dist/src/poppy-client/sse.d.ts +15 -0
- package/dist/src/poppy-client/sse.d.ts.map +1 -0
- package/dist/src/poppy-client/sse.js +74 -0
- package/dist/src/poppy-client/sse.js.map +1 -0
- package/dist/src/poppy-client/store.d.ts +89 -0
- package/dist/src/poppy-client/store.d.ts.map +1 -0
- package/dist/src/poppy-client/store.js +79 -0
- package/dist/src/poppy-client/store.js.map +1 -0
- package/dist/src/poppy-client/token_client.d.ts +69 -0
- package/dist/src/poppy-client/token_client.d.ts.map +1 -0
- package/dist/src/poppy-client/token_client.js +154 -0
- package/dist/src/poppy-client/token_client.js.map +1 -0
- package/dist/src/poppy-client/types.d.ts +184 -0
- package/dist/src/poppy-client/types.d.ts.map +1 -0
- package/dist/src/poppy-client/types.js +8 -0
- package/dist/src/poppy-client/types.js.map +1 -0
- package/dist/src/poppy-client/util.d.ts +42 -0
- package/dist/src/poppy-client/util.d.ts.map +1 -0
- package/dist/src/poppy-client/util.js +122 -0
- package/dist/src/poppy-client/util.js.map +1 -0
- package/dist/src/poppy-connections/config.d.ts +134 -0
- package/dist/src/poppy-connections/config.d.ts.map +1 -0
- package/dist/src/poppy-connections/config.js +44 -0
- package/dist/src/poppy-connections/config.js.map +1 -0
- package/dist/src/poppy-connections/crypto.d.ts +12 -0
- package/dist/src/poppy-connections/crypto.d.ts.map +1 -0
- package/dist/src/poppy-connections/crypto.js +36 -0
- package/dist/src/poppy-connections/crypto.js.map +1 -0
- package/dist/src/poppy-connections/http.d.ts +63 -0
- package/dist/src/poppy-connections/http.d.ts.map +1 -0
- package/dist/src/poppy-connections/http.js +217 -0
- package/dist/src/poppy-connections/http.js.map +1 -0
- package/dist/src/poppy-connections/index.d.ts +14 -0
- package/dist/src/poppy-connections/index.d.ts.map +1 -0
- package/dist/src/poppy-connections/index.js +17 -0
- package/dist/src/poppy-connections/index.js.map +1 -0
- package/dist/src/poppy-connections/resume.d.ts +46 -0
- package/dist/src/poppy-connections/resume.d.ts.map +1 -0
- package/dist/src/poppy-connections/resume.js +109 -0
- package/dist/src/poppy-connections/resume.js.map +1 -0
- package/dist/src/poppy-connections/runtime.d.ts +4 -0
- package/dist/src/poppy-connections/runtime.d.ts.map +1 -0
- package/dist/src/poppy-connections/runtime.js +9 -0
- package/dist/src/poppy-connections/runtime.js.map +1 -0
- package/dist/src/poppy-connections/server_middleware.d.ts +10 -0
- package/dist/src/poppy-connections/server_middleware.d.ts.map +1 -0
- package/dist/src/poppy-connections/server_middleware.js +14 -0
- package/dist/src/poppy-connections/server_middleware.js.map +1 -0
- package/dist/src/poppy-connections/service.d.ts +179 -0
- package/dist/src/poppy-connections/service.d.ts.map +1 -0
- package/dist/src/poppy-connections/service.js +648 -0
- package/dist/src/poppy-connections/service.js.map +1 -0
- package/dist/src/poppy-connections/store.d.ts +139 -0
- package/dist/src/poppy-connections/store.d.ts.map +1 -0
- package/dist/src/poppy-connections/store.js +260 -0
- package/dist/src/poppy-connections/store.js.map +1 -0
- package/dist/src/poppy-connections/tools.d.ts +65 -0
- package/dist/src/poppy-connections/tools.d.ts.map +1 -0
- package/dist/src/poppy-connections/tools.js +574 -0
- package/dist/src/poppy-connections/tools.js.map +1 -0
- package/dist/src/react/core/approvals/use-action-proposals.d.ts +6 -1
- package/dist/src/react/core/approvals/use-action-proposals.d.ts.map +1 -1
- package/dist/src/react/core/approvals/use-action-proposals.js +18 -3
- package/dist/src/react/core/approvals/use-action-proposals.js.map +1 -1
- package/dist/src/react/core/use-agent-chat.d.ts +6 -0
- package/dist/src/react/core/use-agent-chat.d.ts.map +1 -1
- package/dist/src/react/core/use-agent-chat.js +47 -1
- package/dist/src/react/core/use-agent-chat.js.map +1 -1
- package/dist/src/tool-presentation.d.ts +6 -0
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +1 -0
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/types.d.ts +6 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +41 -2
- package/skills/agent-governance/SKILL.md +13 -2
- package/skills/agent-personas-agents/SKILL.md +1 -1
- package/skills/agent-tools/SKILL.md +20 -3
package/dist/src/mcp/server.js
CHANGED
|
@@ -11,7 +11,7 @@ import { createNoopEmitUi } from '../tool-ui.js';
|
|
|
11
11
|
*/
|
|
12
12
|
const LOOP_SERVED_KINDS = new Set(['agent', 'ask', 'skill', 'memory']);
|
|
13
13
|
/** Whether this tool may be reached over MCP at all — the same answer for listing and for calling. */
|
|
14
|
-
function isExposable(spec, actions) {
|
|
14
|
+
export function isExposable(spec, actions) {
|
|
15
15
|
if (spec === undefined || LOOP_SERVED_KINDS.has(spec.kind)) {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4DAA4D,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAInG,OAAO,EAAE,iBAAiB,EAAgB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAiDjD;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEvE,sGAAsG;AACtG,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/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,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/D,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;YACpE,OAAO;gBACL,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;iBACrF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACvE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Actor } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Who a Poppy request comes from: a Personal Agent (`clientId`) acting for one of its Users
|
|
4
|
+
* (`userId`, the pairwise User ID — not an account) in one Session. `signedIn`, with the app
|
|
5
|
+
* account (`accountId`) and `scopes`, once the User signed in here (§4.4); a signed-out token has
|
|
6
|
+
* neither. The shape `@adonis-agora/authkit-server` answers.
|
|
7
|
+
*/
|
|
8
|
+
export interface PoppyPrincipal {
|
|
9
|
+
/** The opaque, stable id the Personal Agent gave this User here. */
|
|
10
|
+
userId: string;
|
|
11
|
+
/** The app account, when the Session is signed in; `null` signed out. */
|
|
12
|
+
accountId: string | null;
|
|
13
|
+
/** The Personal Agent's `client_id` (its metadata document URL). */
|
|
14
|
+
clientId: string;
|
|
15
|
+
/** The token's account scopes (`poppy:read`, `poppy:write`, custom). Empty signed out. */
|
|
16
|
+
scopes: string[];
|
|
17
|
+
sessionId: string;
|
|
18
|
+
signedIn: boolean;
|
|
19
|
+
/** The `resource` the token was issued for (RFC 8707), or `null`. */
|
|
20
|
+
resource?: string | null;
|
|
21
|
+
tokenType?: 'DPoP' | 'Bearer';
|
|
22
|
+
/** What the app's `personalAgents.poppy.toActor` answered, when it has one. */
|
|
23
|
+
actor?: Actor;
|
|
24
|
+
}
|
|
25
|
+
/** The request a resolver verifies — the Session Token and its DPoP proof are in `headers`. */
|
|
26
|
+
export interface PoppyAuthRequest {
|
|
27
|
+
method: string;
|
|
28
|
+
/** The full PUBLIC request URL (the DPoP `htu` is checked against it; the query is ignored). */
|
|
29
|
+
url: string;
|
|
30
|
+
/** The request's headers as received (lower-cased names) — `authorization` and `dpop` included. */
|
|
31
|
+
headers: Record<string, string | string[] | undefined>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* What a resolver may be asked to require besides a valid token. The conversation endpoint asks for
|
|
35
|
+
* none: which scopes a turn needs is decided per tool, and the `resource` a token must carry is
|
|
36
|
+
* derived by the resolver from the URL (the `resource` of the `poppy` protocol entry, if any).
|
|
37
|
+
*/
|
|
38
|
+
export interface PoppyAuthOptions {
|
|
39
|
+
scopes?: string[];
|
|
40
|
+
signedIn?: boolean;
|
|
41
|
+
resource?: string | null;
|
|
42
|
+
}
|
|
43
|
+
export type PoppyAuthFailure = {
|
|
44
|
+
ok: false;
|
|
45
|
+
status: 400 | 401 | 403;
|
|
46
|
+
error: 'invalid_token' | 'sign_in_required' | 'insufficient_scope' | 'invalid_dpop_proof' | 'use_dpop_nonce' | (string & {});
|
|
47
|
+
scope?: string;
|
|
48
|
+
/** The challenge to answer with, verbatim. */
|
|
49
|
+
wwwAuthenticate: string;
|
|
50
|
+
/** For logs and the body's `error_description` — never the token. */
|
|
51
|
+
description?: string;
|
|
52
|
+
/** Extra headers to answer with (`DPoP-Nonce`). */
|
|
53
|
+
headers?: Record<string, string>;
|
|
54
|
+
};
|
|
55
|
+
export type PoppyAuthResult = {
|
|
56
|
+
ok: true;
|
|
57
|
+
principal: PoppyPrincipal;
|
|
58
|
+
} | PoppyAuthFailure;
|
|
59
|
+
/**
|
|
60
|
+
* Verifies a request's Session Token. `@adonis-agora/authkit-server` installs one in the global
|
|
61
|
+
* slot {@link POPPY_AUTHENTICATE_SLOT}; an app can pass its own (`definePoppyConfig({ authenticate })`).
|
|
62
|
+
*
|
|
63
|
+
* @experimental Tracks Personal Agent Protocol Draft 0.1 (https://personalagentprotocol.org/docs/spec),
|
|
64
|
+
* a spec still in development: this API WILL change as the spec evolves — possibly in breaking
|
|
65
|
+
* ways, outside semver majors while it is a draft.
|
|
66
|
+
*/
|
|
67
|
+
export type PoppyAuthenticate = (request: PoppyAuthRequest, options?: PoppyAuthOptions) => Promise<PoppyAuthResult>;
|
|
68
|
+
/**
|
|
69
|
+
* The contract with the authorization server is this global symbol, not a module: neither package
|
|
70
|
+
* imports the other (like `Symbol.for('@adonis-agora/oauth:resources')` for MCP).
|
|
71
|
+
*/
|
|
72
|
+
export declare const POPPY_AUTHENTICATE_SLOT: unique symbol;
|
|
73
|
+
/** The resolver installed in the global slot, if any — read per request, so install order is free. */
|
|
74
|
+
export declare function globalPoppyAuthenticate(): PoppyAuthenticate | undefined;
|
|
75
|
+
/** The Poppy issuer authkit announces (`Symbol.for('@adonis-agora/poppy:issuer')`), if any. */
|
|
76
|
+
export declare function globalPoppyIssuer(): string | undefined;
|
|
77
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/poppy/auth.ts"],"names":[],"mappings":"AAA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AAM,CAAC;IACxB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,GAAG,gBAAgB,CAAC;AAEzF;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,gBAAgB,EACzB,OAAO,CAAC,EAAE,gBAAgB,KACvB,OAAO,CAAC,eAAe,CAAC,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,uBAAuB,eAAiD,CAAC;AAEtF,sGAAsG;AACtG,wBAAgB,uBAAuB,IAAI,iBAAiB,GAAG,SAAS,CAGvE;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAGtD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contract with the authorization server is this global symbol, not a module: neither package
|
|
3
|
+
* imports the other (like `Symbol.for('@adonis-agora/oauth:resources')` for MCP).
|
|
4
|
+
*/
|
|
5
|
+
export const POPPY_AUTHENTICATE_SLOT = Symbol.for('@adonis-agora/poppy:authenticate');
|
|
6
|
+
/** The resolver installed in the global slot, if any — read per request, so install order is free. */
|
|
7
|
+
export function globalPoppyAuthenticate() {
|
|
8
|
+
const value = globalThis[POPPY_AUTHENTICATE_SLOT];
|
|
9
|
+
return typeof value === 'function' ? value : undefined;
|
|
10
|
+
}
|
|
11
|
+
/** The Poppy issuer authkit announces (`Symbol.for('@adonis-agora/poppy:issuer')`), if any. */
|
|
12
|
+
export function globalPoppyIssuer() {
|
|
13
|
+
const value = globalThis[Symbol.for('@adonis-agora/poppy:issuer')];
|
|
14
|
+
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/poppy/auth.ts"],"names":[],"mappings":"AAgFA;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAEtF,sGAAsG;AACtG,MAAM,UAAU,uBAAuB;IACrC,MAAM,KAAK,GAAI,UAAsC,CAAC,uBAAuB,CAAC,CAAC;IAC/E,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAE,KAA2B,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,iBAAiB;IAC/B,MAAM,KAAK,GAAI,UAAsC,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAChG,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { type A2aActionPolicy, type A2aTurnOutcome, type A2aTurnService } from '../a2a/turn.js';
|
|
2
|
+
import type { Actor } from '../types.js';
|
|
3
|
+
import type { PoppyPrincipal } from './auth.js';
|
|
4
|
+
import { type PoppyEvent, type PoppyEventMessage, type PoppyResponder, type PoppySendBody, type PoppySender, type PoppyStatus } from './protocol.js';
|
|
5
|
+
import { type PoppyConversationRecord, type PoppyStore } from './store.js';
|
|
6
|
+
/** What the hooks are told about a conversation. */
|
|
7
|
+
export interface PoppyHookContext {
|
|
8
|
+
conversationId: string;
|
|
9
|
+
conversation: PoppyConversationRecord;
|
|
10
|
+
/** Who the conversation's turns run as (its latest request); `null` before any. */
|
|
11
|
+
actor: Actor | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What {@link PoppyHandoffHooks.request} decided:
|
|
15
|
+
* - `'queued'` — someone will join: call {@link PoppyConversations.humanJoined} when they do, or
|
|
16
|
+
* {@link PoppyConversations.handoffUnavailable} if nobody can.
|
|
17
|
+
* - `'joined'` — a person took it now.
|
|
18
|
+
* - `{ unavailable }` — nobody can; the text is what the Company Agent says (§7.9).
|
|
19
|
+
*/
|
|
20
|
+
export type PoppyHandoffDecision = 'queued' | 'joined' | {
|
|
21
|
+
unavailable: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* How the app brings a person in (§7.9). Without these, a handoff is answered by the Company Agent
|
|
25
|
+
* saying no one is available — the conversation stays with the agent.
|
|
26
|
+
*/
|
|
27
|
+
export interface PoppyHandoffHooks {
|
|
28
|
+
/** A person was asked for — by the Personal Agent (`requested`) or by the app (`company`). */
|
|
29
|
+
request(ctx: PoppyHookContext & {
|
|
30
|
+
by: 'requested' | 'company';
|
|
31
|
+
}): PoppyHandoffDecision | Promise<PoppyHandoffDecision>;
|
|
32
|
+
/**
|
|
33
|
+
* A message from the Personal Agent while a person handles the conversation or is being found —
|
|
34
|
+
* the agent does not answer those. Route it to your support tool.
|
|
35
|
+
*/
|
|
36
|
+
message?(ctx: PoppyHookContext & {
|
|
37
|
+
message: PoppyEventMessage;
|
|
38
|
+
}): void | Promise<void>;
|
|
39
|
+
/** The conversation closed while a person was handling it or being found (§7.12). */
|
|
40
|
+
cancel?(ctx: PoppyHookContext): void | Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
/** Notified when the Personal Agent opens or closes a Direct Conversation (§7.10). */
|
|
43
|
+
export interface PoppyDirectHooks {
|
|
44
|
+
opened?(ctx: PoppyHookContext & {
|
|
45
|
+
parentId: string;
|
|
46
|
+
}): void | Promise<void>;
|
|
47
|
+
closed?(ctx: PoppyHookContext & {
|
|
48
|
+
parentId: string;
|
|
49
|
+
}): void | Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/** What the Company Agent says on its own. */
|
|
52
|
+
export interface PoppyTexts {
|
|
53
|
+
/** A handoff with no one to take it (§7.9). */
|
|
54
|
+
handoffUnavailable: string;
|
|
55
|
+
/** A turn that failed before saying anything. */
|
|
56
|
+
failed: string;
|
|
57
|
+
/** Asked in a Direct Conversation alongside an `authorization` event (§7.11 SHOULD). */
|
|
58
|
+
signIn: string;
|
|
59
|
+
/** An action that ran — `{title}` is the app's confirmation title (default {@link formatPoppyAction}). */
|
|
60
|
+
actionSucceeded: string;
|
|
61
|
+
/** An approved action that did not run. `{title}`, `{error}`. */
|
|
62
|
+
actionFailed: string;
|
|
63
|
+
/** An action the policy refused. `{title}`. */
|
|
64
|
+
actionRejected: string;
|
|
65
|
+
}
|
|
66
|
+
export declare const DEFAULT_POPPY_TEXTS: PoppyTexts;
|
|
67
|
+
/** An action of the turn, as the reply's `data.actions` carries it. */
|
|
68
|
+
export type PoppyActionOutcome = A2aTurnOutcome;
|
|
69
|
+
/**
|
|
70
|
+
* Words an action for the reply's text (§7: the message must make sense without `data`). Return
|
|
71
|
+
* `null` to leave it out. Default {@link formatPoppyAction}.
|
|
72
|
+
*/
|
|
73
|
+
export type PoppyActionFormatter = (action: PoppyActionOutcome, texts: PoppyTexts) => string | null | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Default wording: the status line from `texts` with the confirmation title (a question like
|
|
76
|
+
* "Log this dose?" loses its `?`), then the confirmation detail.
|
|
77
|
+
*/
|
|
78
|
+
export declare function formatPoppyAction(action: PoppyActionOutcome, texts: PoppyTexts): string;
|
|
79
|
+
export interface PoppyConversationsOptions {
|
|
80
|
+
store: PoppyStore;
|
|
81
|
+
/** What runs a turn — `AgentService`, or an app's adapter (the A2A surface's contract). */
|
|
82
|
+
service: A2aTurnService & {
|
|
83
|
+
drive?(runId: string): Promise<void>;
|
|
84
|
+
};
|
|
85
|
+
/** The roles a tool declares, for matching the token's scopes. */
|
|
86
|
+
toolRoles: (toolName: string) => string[] | undefined;
|
|
87
|
+
/** The registered agent that answers. Omitted → the agent provider's default. */
|
|
88
|
+
agentName?: string;
|
|
89
|
+
/** What happens to `action` calls that park for approval. Default `'approve-delegated'`. */
|
|
90
|
+
actions?: A2aActionPolicy;
|
|
91
|
+
/** Give up on a turn after this many ms. Default 120 000. */
|
|
92
|
+
timeoutMs?: number;
|
|
93
|
+
/** Drive a durable run left pending, in this process (see `AgentService.drive`). Default `true`. */
|
|
94
|
+
drive?: boolean;
|
|
95
|
+
/** Map a principal without an actor to the app's actor. Default: `poppy:<hash>`. */
|
|
96
|
+
actorFor?: (principal: PoppyPrincipal, defaults: Actor) => Actor | Promise<Actor>;
|
|
97
|
+
/** Words each action of a reply. Default {@link formatPoppyAction}. */
|
|
98
|
+
formatAction?: PoppyActionFormatter;
|
|
99
|
+
handoff?: PoppyHandoffHooks;
|
|
100
|
+
direct?: PoppyDirectHooks;
|
|
101
|
+
texts?: Partial<PoppyTexts>;
|
|
102
|
+
/** Keep events this long, then prune them (a cursor there is `cursor_expired`). Default: forever. */
|
|
103
|
+
retentionMs?: number;
|
|
104
|
+
/** How often a waiting read looks for events another replica appended. Default 1000 ms. */
|
|
105
|
+
pollMs?: number;
|
|
106
|
+
/** Logs what fails outside a request (a turn, a hook). */
|
|
107
|
+
onError?: (error: unknown, context: string) => void;
|
|
108
|
+
}
|
|
109
|
+
/** What a read answers (§7.5). */
|
|
110
|
+
export interface PoppyReadResult {
|
|
111
|
+
conversation_id: string;
|
|
112
|
+
events: PoppyEvent[];
|
|
113
|
+
cursor: string | null;
|
|
114
|
+
has_more: boolean;
|
|
115
|
+
status: PoppyStatus;
|
|
116
|
+
responder: PoppyResponder;
|
|
117
|
+
}
|
|
118
|
+
/** What a stream yields: a stored event, or a provisional piece of text (§7.6). */
|
|
119
|
+
export type PoppyStreamItem = {
|
|
120
|
+
kind: 'event';
|
|
121
|
+
event: PoppyEvent;
|
|
122
|
+
} | {
|
|
123
|
+
kind: 'delta';
|
|
124
|
+
messageId: string;
|
|
125
|
+
text: string;
|
|
126
|
+
} | {
|
|
127
|
+
kind: 'state';
|
|
128
|
+
status: PoppyStatus;
|
|
129
|
+
};
|
|
130
|
+
/** The actor of a principal the resolver gave none: stable per (Personal Agent, its User). */
|
|
131
|
+
export declare function poppyActorId(clientId: string, userId: string): string;
|
|
132
|
+
/**
|
|
133
|
+
* Poppy conversations (§7) over the agent runtime: the state machine, the event log and the turns.
|
|
134
|
+
* HTTP-free — `createPoppyHandler` puts the protocol's requests on it, and the app drives the
|
|
135
|
+
* Company side through it (a person joining, their messages, `user_requested`).
|
|
136
|
+
*
|
|
137
|
+
* A conversation is an agent thread owned by the principal's actor. A user message is appended to
|
|
138
|
+
* the event log, and the log is the turn queue: a pump per conversation (one replica at a time,
|
|
139
|
+
* by lease) answers the messages after `turnSeq` in one turn, streams its text as `text-delta`,
|
|
140
|
+
* then appends the reply as a `message` event. A replica that finds a conversation `working` with
|
|
141
|
+
* no pump picks it up, so a reply survives the process that started it.
|
|
142
|
+
*
|
|
143
|
+
* @experimental Tracks Personal Agent Protocol Draft 0.1 (https://personalagentprotocol.org/docs/spec),
|
|
144
|
+
* a spec still in development: this API WILL change as the spec evolves — possibly in breaking
|
|
145
|
+
* ways, outside semver majors while it is a draft.
|
|
146
|
+
*/
|
|
147
|
+
export declare class PoppyConversations {
|
|
148
|
+
#private;
|
|
149
|
+
private readonly options;
|
|
150
|
+
constructor(options: PoppyConversationsOptions);
|
|
151
|
+
/**
|
|
152
|
+
* The actor a principal's turns run as: the resolver's (`toActor`), else the app's `actorFor`,
|
|
153
|
+
* else — signed in — the ACCOUNT, `{ id: accountId }`, the way a PACT delegation runs as the
|
|
154
|
+
* account; signed out, `poppy:<hash>` (stable per Personal Agent and User, never an account).
|
|
155
|
+
* It ALWAYS carries `personal_agent` (what puts it behind `personalAgentGate`) and one
|
|
156
|
+
* `scope:<id>` role per account scope of a signed-in token — the roles a PACT delegation gives,
|
|
157
|
+
* so a tool written for personal agents gates both surfaces alike.
|
|
158
|
+
*/
|
|
159
|
+
actorOf(principal: PoppyPrincipal): Promise<Actor>;
|
|
160
|
+
/** `POST {endpoint}` — start a conversation (or a Direct Conversation) with its first message. */
|
|
161
|
+
start(principal: PoppyPrincipal, body: PoppySendBody): Promise<{
|
|
162
|
+
status: number;
|
|
163
|
+
body: Record<string, unknown>;
|
|
164
|
+
conversationId: string;
|
|
165
|
+
}>;
|
|
166
|
+
/** `POST {endpoint}/{id}/messages` — another message (§7.3). */
|
|
167
|
+
send(principal: PoppyPrincipal, conversationId: string, body: PoppySendBody): Promise<{
|
|
168
|
+
status: number;
|
|
169
|
+
body: Record<string, unknown>;
|
|
170
|
+
}>;
|
|
171
|
+
/** `GET {endpoint}/{id}/events` without streaming — read (and wait for) events (§7.5). */
|
|
172
|
+
read(principal: PoppyPrincipal, conversationId: string, options: {
|
|
173
|
+
cursor?: string;
|
|
174
|
+
waitMs?: number;
|
|
175
|
+
}): Promise<PoppyReadResult>;
|
|
176
|
+
/** A read of a conversation already checked — also what a POST with `wait` answers (§7.3). */
|
|
177
|
+
readOwned(conversation: PoppyConversationRecord, options: {
|
|
178
|
+
cursor?: string;
|
|
179
|
+
waitMs?: number;
|
|
180
|
+
}): Promise<PoppyReadResult>;
|
|
181
|
+
/** Check a conversation is the principal's, for a caller that reads it afterwards. */
|
|
182
|
+
owned(principal: PoppyPrincipal, conversationId: string): Promise<PoppyConversationRecord>;
|
|
183
|
+
/**
|
|
184
|
+
* `GET {endpoint}/{id}/events` as SSE (§7.6): the events after `cursor`, then new ones as they
|
|
185
|
+
* come, with `text-delta` pieces of a reply being written in this process. Ends when `signal`
|
|
186
|
+
* aborts, or once the conversation is closed and every event was sent.
|
|
187
|
+
*/
|
|
188
|
+
stream(conversation: PoppyConversationRecord, cursor: string | undefined, signal: AbortSignal): AsyncGenerator<PoppyStreamItem>;
|
|
189
|
+
/** `POST {endpoint}/{id}/handoff` — ask for a person at the Company (§7.9). */
|
|
190
|
+
requestHandoff(principal: PoppyPrincipal, conversationId: string): Promise<{
|
|
191
|
+
status: PoppyStatus;
|
|
192
|
+
responder: PoppyResponder;
|
|
193
|
+
}>;
|
|
194
|
+
/** `POST {endpoint}/{id}/close` — close the conversation (§7.12). */
|
|
195
|
+
closeByAgent(principal: PoppyPrincipal, conversationId: string): Promise<{
|
|
196
|
+
status: PoppyStatus;
|
|
197
|
+
responder: PoppyResponder;
|
|
198
|
+
}>;
|
|
199
|
+
/** Look a conversation up — for the app's own routing (a support tool, an admin page). */
|
|
200
|
+
get(conversationId: string): Promise<PoppyConversationRecord | null>;
|
|
201
|
+
/**
|
|
202
|
+
* Close a conversation (§7.12): its open Direct Conversation first, a pending handoff is
|
|
203
|
+
* cancelled, and a `closed` state event added. Nothing it started is undone. Idempotent.
|
|
204
|
+
*/
|
|
205
|
+
close(conversationId: string): Promise<{
|
|
206
|
+
status: PoppyStatus;
|
|
207
|
+
responder: PoppyResponder;
|
|
208
|
+
}>;
|
|
209
|
+
/** The Company Agent hands off to a person on its own (§7.9) — e.g. from one of your tools. */
|
|
210
|
+
handoff(conversationId: string): Promise<{
|
|
211
|
+
status: PoppyStatus;
|
|
212
|
+
responder: PoppyResponder;
|
|
213
|
+
}>;
|
|
214
|
+
/** A person at the Company joined: `responder` becomes `human` (§7.7). */
|
|
215
|
+
humanJoined(conversationId: string): Promise<{
|
|
216
|
+
status: PoppyStatus;
|
|
217
|
+
responder: PoppyResponder;
|
|
218
|
+
}>;
|
|
219
|
+
/** The person left: the Company Agent answers again. */
|
|
220
|
+
humanLeft(conversationId: string): Promise<{
|
|
221
|
+
status: PoppyStatus;
|
|
222
|
+
responder: PoppyResponder;
|
|
223
|
+
}>;
|
|
224
|
+
/**
|
|
225
|
+
* No one could take a queued handoff: the Company Agent says why, and the conversation goes back
|
|
226
|
+
* to `idle` with the agent (§7.9).
|
|
227
|
+
*/
|
|
228
|
+
handoffUnavailable(conversationId: string, reason?: string): Promise<{
|
|
229
|
+
status: PoppyStatus;
|
|
230
|
+
responder: PoppyResponder;
|
|
231
|
+
}>;
|
|
232
|
+
/**
|
|
233
|
+
* Add a Company message — a person's (`sender: 'human'`, while they handle the conversation) or
|
|
234
|
+
* an automated one. Answers the message's id.
|
|
235
|
+
*/
|
|
236
|
+
postMessage(conversationId: string, message: {
|
|
237
|
+
text?: string;
|
|
238
|
+
data?: Record<string, unknown>;
|
|
239
|
+
sender: PoppySender;
|
|
240
|
+
}): Promise<string>;
|
|
241
|
+
/**
|
|
242
|
+
* Ask to talk with the User directly (§7.10): a `user_requested` event. Only the Personal Agent
|
|
243
|
+
* opens the Direct Conversation, once the User agrees.
|
|
244
|
+
*/
|
|
245
|
+
requestUser(conversationId: string, reason: string): Promise<void>;
|
|
246
|
+
/** Stop pumping and waiting in this process (shutdown). */
|
|
247
|
+
shutdown(): void;
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/poppy/conversations.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,cAAc,EAEpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAKL,KAAK,UAAU,EAEf,KAAK,iBAAiB,EAEtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,KAAK,uBAAuB,EAE5B,KAAK,UAAU,EAEhB,MAAM,YAAY,CAAC;AAEpB,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,uBAAuB,CAAC;IACtC,mFAAmF;IACnF,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GA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