@hanphone/dsh-a2a 0.1.0
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/LICENSE +21 -0
- package/README.md +196 -0
- package/README.zh.md +195 -0
- package/cordis.patch.yml +11 -0
- package/lib/client.js +166 -0
- package/lib/index.js +2073 -0
- package/lib/tsconfig.client.tsbuildinfo +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/api.d.ts +41 -0
- package/lib/types/api.d.ts.map +1 -0
- package/lib/types/api.js +86 -0
- package/lib/types/api.js.map +1 -0
- package/lib/types/client/index.d.ts +35 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js +155 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/commands.d.ts +10 -0
- package/lib/types/commands.d.ts.map +1 -0
- package/lib/types/commands.js +93 -0
- package/lib/types/commands.js.map +1 -0
- package/lib/types/events.d.ts +74 -0
- package/lib/types/events.d.ts.map +1 -0
- package/lib/types/events.js +10 -0
- package/lib/types/events.js.map +1 -0
- package/lib/types/index.d.ts +54 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +296 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/jsonrpc.d.ts +20 -0
- package/lib/types/jsonrpc.d.ts.map +1 -0
- package/lib/types/jsonrpc.js +48 -0
- package/lib/types/jsonrpc.js.map +1 -0
- package/lib/types/outbound/calls.d.ts +37 -0
- package/lib/types/outbound/calls.d.ts.map +1 -0
- package/lib/types/outbound/calls.js +120 -0
- package/lib/types/outbound/calls.js.map +1 -0
- package/lib/types/outbound/registry.d.ts +102 -0
- package/lib/types/outbound/registry.d.ts.map +1 -0
- package/lib/types/outbound/registry.js +249 -0
- package/lib/types/outbound/registry.js.map +1 -0
- package/lib/types/outbound/tools.d.ts +30 -0
- package/lib/types/outbound/tools.d.ts.map +1 -0
- package/lib/types/outbound/tools.js +86 -0
- package/lib/types/outbound/tools.js.map +1 -0
- package/lib/types/protocol.d.ts +194 -0
- package/lib/types/protocol.d.ts.map +1 -0
- package/lib/types/protocol.js +78 -0
- package/lib/types/protocol.js.map +1 -0
- package/lib/types/server/a2a-server.d.ts +98 -0
- package/lib/types/server/a2a-server.d.ts.map +1 -0
- package/lib/types/server/a2a-server.js +397 -0
- package/lib/types/server/a2a-server.js.map +1 -0
- package/lib/types/server/card.d.ts +48 -0
- package/lib/types/server/card.d.ts.map +1 -0
- package/lib/types/server/card.js +75 -0
- package/lib/types/server/card.js.map +1 -0
- package/lib/types/server/exec/agent-runtime.d.ts +126 -0
- package/lib/types/server/exec/agent-runtime.d.ts.map +1 -0
- package/lib/types/server/exec/agent-runtime.js +138 -0
- package/lib/types/server/exec/agent-runtime.js.map +1 -0
- package/lib/types/server/exec/session.d.ts +11 -0
- package/lib/types/server/exec/session.d.ts.map +1 -0
- package/lib/types/server/exec/session.js +22 -0
- package/lib/types/server/exec/session.js.map +1 -0
- package/lib/types/server/exec/subagent.d.ts +39 -0
- package/lib/types/server/exec/subagent.d.ts.map +1 -0
- package/lib/types/server/exec/subagent.js +44 -0
- package/lib/types/server/exec/subagent.js.map +1 -0
- package/lib/types/server/executor.d.ts +63 -0
- package/lib/types/server/executor.d.ts.map +1 -0
- package/lib/types/server/executor.js +38 -0
- package/lib/types/server/executor.js.map +1 -0
- package/lib/types/server/routes.d.ts +32 -0
- package/lib/types/server/routes.d.ts.map +1 -0
- package/lib/types/server/routes.js +131 -0
- package/lib/types/server/routes.js.map +1 -0
- package/lib/types/server/store.d.ts +157 -0
- package/lib/types/server/store.d.ts.map +1 -0
- package/lib/types/server/store.js +239 -0
- package/lib/types/server/store.js.map +1 -0
- package/lib/types/service.d.ts +49 -0
- package/lib/types/service.d.ts.map +1 -0
- package/lib/types/service.js +46 -0
- package/lib/types/service.js.map +1 -0
- package/package.json +82 -0
- package/src/api.ts +115 -0
- package/src/client/index.ts +293 -0
- package/src/commands.ts +92 -0
- package/src/events.ts +58 -0
- package/src/index.ts +353 -0
- package/src/jsonrpc.ts +61 -0
- package/src/outbound/calls.ts +145 -0
- package/src/outbound/registry.ts +290 -0
- package/src/outbound/tools.ts +118 -0
- package/src/protocol.ts +212 -0
- package/src/server/a2a-server.ts +455 -0
- package/src/server/card.ts +106 -0
- package/src/server/exec/agent-runtime.ts +197 -0
- package/src/server/exec/session.ts +25 -0
- package/src/server/exec/subagent.ts +67 -0
- package/src/server/executor.ts +73 -0
- package/src/server/routes.ts +156 -0
- package/src/server/store.ts +320 -0
- package/src/service.ts +78 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A settings dashboard — browser half.
|
|
3
|
+
*
|
|
4
|
+
* Registers one `settings.section` ("A2A 连接") listing who is connected TO
|
|
5
|
+
* this DSH (inbound server state + tasks) and who this DSH is connected TO
|
|
6
|
+
* (outbound agents), with per-agent controls (enable/disable/remove/refresh)
|
|
7
|
+
* and the inbound-server toggle. All data and controls live behind the host's
|
|
8
|
+
* loopback-only `/a2a/api` route (src/api.ts); this half is a thin read/write
|
|
9
|
+
* client with no protocol knowledge and no direct storage access.
|
|
10
|
+
*
|
|
11
|
+
* Styling: one idempotent `<style>` injector built on the product's
|
|
12
|
+
* `--dsw-alias-*` design tokens so light/dark themes follow the DSH shell.
|
|
13
|
+
* No inline styles.
|
|
14
|
+
* @module dsh-a2a/client
|
|
15
|
+
*/
|
|
16
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
17
|
+
import type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
18
|
+
import { type ReactElement } from 'react';
|
|
19
|
+
/** Services this plugin needs from the client runtime. */
|
|
20
|
+
export declare const inject: string[];
|
|
21
|
+
export declare function apply(ctx: ClientContext): void;
|
|
22
|
+
/** Wire types — mirror the host's src/api.ts snapshot. */
|
|
23
|
+
export interface ApiSnapshot {
|
|
24
|
+
readonly server: {
|
|
25
|
+
readonly enabled: boolean;
|
|
26
|
+
readonly cardUrl?: string;
|
|
27
|
+
readonly skills: readonly string[];
|
|
28
|
+
};
|
|
29
|
+
readonly tasks: readonly unknown[];
|
|
30
|
+
readonly agents: readonly unknown[];
|
|
31
|
+
}
|
|
32
|
+
type SectionProps = PropsRuntime<'settings.section'>;
|
|
33
|
+
export declare function A2aSection(_props: SectionProps): ReactElement;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAsC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAE7E,0DAA0D;AAC1D,eAAO,MAAM,MAAM,UAAY,CAAA;AA6B/B,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAe9C;AAED,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAA;IAC7G,QAAQ,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,CAAA;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAA;CACpC;AAoCD,KAAK,YAAY,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAA;AAEpD,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAoL7D"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A settings dashboard — browser half.
|
|
3
|
+
*
|
|
4
|
+
* Registers one `settings.section` ("A2A 连接") listing who is connected TO
|
|
5
|
+
* this DSH (inbound server state + tasks) and who this DSH is connected TO
|
|
6
|
+
* (outbound agents), with per-agent controls (enable/disable/remove/refresh)
|
|
7
|
+
* and the inbound-server toggle. All data and controls live behind the host's
|
|
8
|
+
* loopback-only `/a2a/api` route (src/api.ts); this half is a thin read/write
|
|
9
|
+
* client with no protocol knowledge and no direct storage access.
|
|
10
|
+
*
|
|
11
|
+
* Styling: one idempotent `<style>` injector built on the product's
|
|
12
|
+
* `--dsw-alias-*` design tokens so light/dark themes follow the DSH shell.
|
|
13
|
+
* No inline styles.
|
|
14
|
+
* @module dsh-a2a/client
|
|
15
|
+
*/
|
|
16
|
+
import { createElement, useEffect, useState } from 'react';
|
|
17
|
+
/** Services this plugin needs from the client runtime. */
|
|
18
|
+
export const inject = ['slots'];
|
|
19
|
+
const NS = 'a2a';
|
|
20
|
+
function injectStyles() {
|
|
21
|
+
const tag = document.createElement('style');
|
|
22
|
+
tag.dataset.plugin = NS;
|
|
23
|
+
tag.dataset.pluginCss = `${NS}/dashboard`;
|
|
24
|
+
tag.textContent = `
|
|
25
|
+
.dsh-a2a-panel { display: flex; flex-direction: column; gap: 16px; padding: 12px 0; }
|
|
26
|
+
.dsh-a2a-card { border: 1px solid var(--dsw-alias-border, #d0d7de); border-radius: 8px; padding: 12px 14px; }
|
|
27
|
+
.dsh-a2a-card h3 { margin: 0 0 8px; font-size: 14px; }
|
|
28
|
+
.dsh-a2a-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
|
|
29
|
+
.dsh-a2a-row .muted { color: var(--dsw-alias-text-secondary, #59636e); font-size: 12px; }
|
|
30
|
+
.dsh-a2a-row button { padding: 2px 10px; border-radius: 6px; border: 1px solid var(--dsw-alias-border, #d0d7de); background: transparent; cursor: pointer; }
|
|
31
|
+
.dsh-a2a-row button.primary { background: var(--dsw-alias-accent, #0f6); color: var(--dsw-alias-bg, #fff); border-color: transparent; }
|
|
32
|
+
.dsh-a2a-state { font-weight: 600; font-size: 12px; padding: 1px 8px; border-radius: 10px; }
|
|
33
|
+
.dsh-a2a-state.ok { background: #1a7f3722; color: #1a7f37; }
|
|
34
|
+
.dsh-a2a-state.bad { background: #d1242f22; color: #d1242f; }
|
|
35
|
+
.dsh-a2a-form { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
|
|
36
|
+
.dsh-a2a-form input { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--dsw-alias-border, #d0d7de); background: transparent; color: inherit; }
|
|
37
|
+
.dsh-a2a-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
38
|
+
.dsh-a2a-table th, .dsh-a2a-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--dsw-alias-border, #d0d7de); }
|
|
39
|
+
.dsh-a2a-error { color: #d1242f; font-size: 12px; }
|
|
40
|
+
`;
|
|
41
|
+
document.head.appendChild(tag);
|
|
42
|
+
return () => tag.remove();
|
|
43
|
+
}
|
|
44
|
+
export function apply(ctx) {
|
|
45
|
+
ctx.effect(() => injectStyles(), `${NS}: dashboard styles`);
|
|
46
|
+
ctx.effect(() => {
|
|
47
|
+
try {
|
|
48
|
+
const off = ctx.slots.register({
|
|
49
|
+
name: 'settings.section',
|
|
50
|
+
id: 'a2a',
|
|
51
|
+
order: 90,
|
|
52
|
+
label: () => 'A2A 连接',
|
|
53
|
+
inject: () => ({}),
|
|
54
|
+
}, A2aSection);
|
|
55
|
+
return () => off();
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
console.error('[dsh-a2a] failed to register A2A settings section:', err);
|
|
59
|
+
return () => { };
|
|
60
|
+
}
|
|
61
|
+
}, `${NS}: settings section`);
|
|
62
|
+
}
|
|
63
|
+
async function fetchSnapshot() {
|
|
64
|
+
const res = await fetch('/a2a/api', { headers: { accept: 'application/json' } });
|
|
65
|
+
if (!res.ok)
|
|
66
|
+
throw new Error(`snapshot HTTP ${res.status}`);
|
|
67
|
+
return (await res.json());
|
|
68
|
+
}
|
|
69
|
+
async function postControl(payload) {
|
|
70
|
+
const res = await fetch('/a2a/api', {
|
|
71
|
+
method: 'POST',
|
|
72
|
+
headers: { 'content-type': 'application/json' },
|
|
73
|
+
body: JSON.stringify(payload),
|
|
74
|
+
});
|
|
75
|
+
const body = (await res.json().catch(() => ({ ok: false, message: `HTTP ${res.status}` })));
|
|
76
|
+
return body;
|
|
77
|
+
}
|
|
78
|
+
export function A2aSection(_props) {
|
|
79
|
+
const [snap, setSnap] = useState(undefined);
|
|
80
|
+
const [error, setError] = useState(undefined);
|
|
81
|
+
const [agentName, setAgentName] = useState('');
|
|
82
|
+
const [agentUrl, setAgentUrl] = useState('');
|
|
83
|
+
const [busy, setBusy] = useState(false);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
let alive = true;
|
|
86
|
+
const tick = async () => {
|
|
87
|
+
try {
|
|
88
|
+
const next = await fetchSnapshot();
|
|
89
|
+
if (alive) {
|
|
90
|
+
setSnap(next);
|
|
91
|
+
setError(undefined);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
if (alive)
|
|
96
|
+
setError(err.message);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
void tick();
|
|
100
|
+
const timer = setInterval(() => void tick(), 3000);
|
|
101
|
+
return () => {
|
|
102
|
+
alive = false;
|
|
103
|
+
clearInterval(timer);
|
|
104
|
+
};
|
|
105
|
+
}, []);
|
|
106
|
+
const control = async (payload) => {
|
|
107
|
+
setBusy(true);
|
|
108
|
+
try {
|
|
109
|
+
const result = await postControl(payload);
|
|
110
|
+
if (!result.ok)
|
|
111
|
+
setError(result.message);
|
|
112
|
+
setSnap(await fetchSnapshot());
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
setError(err.message);
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
setBusy(false);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const server = snap?.server;
|
|
122
|
+
const agents = (snap?.agents ?? []);
|
|
123
|
+
const tasks = (snap?.tasks ?? []);
|
|
124
|
+
return createElement('div', { className: 'dsh-a2a-panel' }, error !== undefined ? createElement('div', { className: 'dsh-a2a-error' }, error) : null,
|
|
125
|
+
// ── inbound server ───────────────────────────────────────────────────
|
|
126
|
+
createElement('div', { className: 'dsh-a2a-card' }, createElement('h3', null, '入站 Server'), server === undefined
|
|
127
|
+
? createElement('div', { className: 'muted' }, '加载中…')
|
|
128
|
+
: createElement('div', { className: 'dsh-a2a-row' }, createElement('span', { className: `dsh-a2a-state ${server.enabled ? 'ok' : 'bad'}` }, server.enabled ? '已启用' : '已停用'), createElement('button', {
|
|
129
|
+
className: server.enabled ? '' : 'primary',
|
|
130
|
+
disabled: busy,
|
|
131
|
+
onClick: () => void control({ action: server.enabled ? 'server.disable' : 'server.enable' }),
|
|
132
|
+
}, server.enabled ? '停用' : '启用')), server !== undefined && server.enabled
|
|
133
|
+
? createElement('div', { className: 'dsh-a2a-row muted' }, `AgentCard: ${server.cardUrl ?? '(n/a)'} · 技能: ${server.skills.join(', ') || '(chat)'}`)
|
|
134
|
+
: null),
|
|
135
|
+
// ── outbound agents ──────────────────────────────────────────────────
|
|
136
|
+
createElement('div', { className: 'dsh-a2a-card' }, createElement('h3', null, `出站 Agents(${agents.length})`), agents.length === 0
|
|
137
|
+
? createElement('div', { className: 'muted' }, '未配置远程 agent。')
|
|
138
|
+
: createElement('table', { className: 'dsh-a2a-table' }, createElement('thead', null, createElement('tr', null, createElement('th', null, '名称'), createElement('th', null, '状态'), createElement('th', null, '工具'), createElement('th', null, '操作'))), createElement('tbody', null, ...agents.map((a) => createElement('tr', { key: a.id }, createElement('td', null, createElement('div', null, a.name), createElement('div', { className: 'muted' }, a.agentCardUrl), a.lastError !== undefined ? createElement('div', { className: 'dsh-a2a-error' }, a.lastError) : null), createElement('td', null, createElement('span', { className: `dsh-a2a-state ${a.state === 'connected' ? 'ok' : 'bad'}` }, a.state)), createElement('td', null, `${a.toolCount} / ${a.skillCount}`), createElement('td', null, createElement('button', { disabled: busy, onClick: () => void control({ action: a.enabled ? 'agent.disable' : 'agent.enable', id: a.id }) }, a.enabled ? '停用' : '启用'), ' ', createElement('button', { disabled: busy, onClick: () => void control({ action: 'agent.refresh', id: a.id }) }, '刷新'), ' ', createElement('button', { disabled: busy, onClick: () => void control({ action: 'agent.remove', id: a.id }) }, '删除')))))), createElement('form', {
|
|
139
|
+
className: 'dsh-a2a-form',
|
|
140
|
+
onSubmit: (ev) => {
|
|
141
|
+
ev.preventDefault();
|
|
142
|
+
if (!agentName.trim() || !agentUrl.trim())
|
|
143
|
+
return;
|
|
144
|
+
void control({ action: 'agent.add', name: agentName.trim(), agentCardUrl: agentUrl.trim() }).then(() => {
|
|
145
|
+
setAgentName('');
|
|
146
|
+
setAgentUrl('');
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
}, createElement('input', { value: agentName, placeholder: '名称', onChange: (e) => setAgentName(e.target.value) }), createElement('input', { value: agentUrl, placeholder: 'AgentCard URL', onChange: (e) => setAgentUrl(e.target.value) }), createElement('button', { type: 'submit', className: 'primary', disabled: busy }, '添加 Agent'))),
|
|
150
|
+
// ── tasks ────────────────────────────────────────────────────────────
|
|
151
|
+
createElement('div', { className: 'dsh-a2a-card' }, createElement('h3', null, `任务(${tasks.length})`), tasks.length === 0
|
|
152
|
+
? createElement('div', { className: 'muted' }, '暂无任务。')
|
|
153
|
+
: createElement('table', { className: 'dsh-a2a-table' }, createElement('thead', null, createElement('tr', null, createElement('th', null, 'ID'), createElement('th', null, '技能'), createElement('th', null, '状态'), createElement('th', null, '操作'))), createElement('tbody', null, ...tasks.slice(-20).reverse().map((t) => createElement('tr', { key: t.id }, createElement('td', null, createElement('span', { className: 'muted' }, t.id)), createElement('td', null, t.metadata?.skill ?? '-'), createElement('td', null, t.status?.state ?? '-'), createElement('td', null, createElement('button', { disabled: busy, onClick: () => void control({ action: 'task.cancel', id: t.id }) }, '取消'))))))));
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAA;AAE7E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,CAAA;AAE/B,MAAM,EAAE,GAAG,KAAK,CAAA;AAEhB,SAAS,YAAY;IACnB,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC3C,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAA;IACvB,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE,YAAY,CAAA;IACzC,GAAG,CAAC,WAAW,GAAG;;;;;;;;;;;;;;;;CAgBnB,CAAA;IACC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IAC9B,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,GAAkB;IACtC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,oBAAoB,CAAC,CAAA;IAC3D,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE;QACd,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,QAAQ,CAC5B;gBACE,IAAI,EAAE,kBAAkB;gBACxB,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,EAAE;gBACT,KAAK,EAAE,GAAG,EAAE,CAAC,QAAQ;gBACrB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;aAC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AO,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9E,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,IAAI,GAAG,CAAC,EACnD,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,IAAI,GAAG,CAAC,EACjD,aAAa,CAAC,IAAI,EAAE,IAAI,EACtB,aAAa,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,CACpH,CACF,CACF,CACF,CACF,CACN,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `/a2a` command surface: status, server enable/disable, card, agents,
|
|
3
|
+
* and task control — the P0 operations surface (the settings panel is P1).
|
|
4
|
+
* @module dsh-a2a/commands
|
|
5
|
+
*/
|
|
6
|
+
import type { CommandDefinition } from '@deepseek-ai/dsh-commands';
|
|
7
|
+
import type { A2AServiceImpl } from './service.ts';
|
|
8
|
+
/** Build the `/a2a` command definition over the service facade. */
|
|
9
|
+
export declare function buildA2aCommand(impl: A2AServiceImpl): CommandDefinition;
|
|
10
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAoC,MAAM,2BAA2B,CAAA;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,iBAAiB,CAqEvE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `/a2a` command surface: status, server enable/disable, card, agents,
|
|
3
|
+
* and task control — the P0 operations surface (the settings panel is P1).
|
|
4
|
+
* @module dsh-a2a/commands
|
|
5
|
+
*/
|
|
6
|
+
/** Build the `/a2a` command definition over the service facade. */
|
|
7
|
+
export function buildA2aCommand(impl) {
|
|
8
|
+
return {
|
|
9
|
+
name: 'a2a',
|
|
10
|
+
description: 'Manage the A2A plugin: status, server, agents, tasks, card.',
|
|
11
|
+
handler: async (invocation) => {
|
|
12
|
+
const [verb, ...rest] = invocation.rawInput.trim().split(/\s+/);
|
|
13
|
+
switch (verb ?? '') {
|
|
14
|
+
case '': {
|
|
15
|
+
const status = impl.status();
|
|
16
|
+
return success(`A2A status\n${JSON.stringify(status, null, 2)}`);
|
|
17
|
+
}
|
|
18
|
+
case 'status':
|
|
19
|
+
return success(JSON.stringify(impl.status(), null, 2));
|
|
20
|
+
case 'enable':
|
|
21
|
+
return outcome(await impl.enableServer(true));
|
|
22
|
+
case 'disable':
|
|
23
|
+
return outcome(await impl.enableServer(false));
|
|
24
|
+
case 'card':
|
|
25
|
+
return success(JSON.stringify(impl.listTasks(), null, 2).slice(0, 4000));
|
|
26
|
+
case 'agents':
|
|
27
|
+
return success(JSON.stringify(impl.agents(), null, 2));
|
|
28
|
+
case 'agent': {
|
|
29
|
+
const [action, ...args] = rest;
|
|
30
|
+
switch (action ?? '') {
|
|
31
|
+
case 'add': {
|
|
32
|
+
const url = args[0];
|
|
33
|
+
if (!url)
|
|
34
|
+
return error('usage: /a2a agent add <agentCardUrl> [name]');
|
|
35
|
+
const name = args[1] ?? url;
|
|
36
|
+
return outcome(await impl.addAgent({ name, agentCardUrl: url }));
|
|
37
|
+
}
|
|
38
|
+
case 'remove': {
|
|
39
|
+
const id = args[0];
|
|
40
|
+
if (!id)
|
|
41
|
+
return error('usage: /a2a agent remove <id>');
|
|
42
|
+
return outcome(await impl.removeAgent(id));
|
|
43
|
+
}
|
|
44
|
+
case 'enable': {
|
|
45
|
+
const id = args[0];
|
|
46
|
+
if (!id)
|
|
47
|
+
return error('usage: /a2a agent enable <id>');
|
|
48
|
+
return outcome(await impl.setAgentEnabled(id, true));
|
|
49
|
+
}
|
|
50
|
+
case 'disable': {
|
|
51
|
+
const id = args[0];
|
|
52
|
+
if (!id)
|
|
53
|
+
return error('usage: /a2a agent disable <id>');
|
|
54
|
+
return outcome(await impl.setAgentEnabled(id, false));
|
|
55
|
+
}
|
|
56
|
+
case 'refresh': {
|
|
57
|
+
const id = args[0];
|
|
58
|
+
if (!id)
|
|
59
|
+
return error('usage: /a2a agent refresh <id>');
|
|
60
|
+
return outcome(await impl.refreshAgentCard(id));
|
|
61
|
+
}
|
|
62
|
+
default:
|
|
63
|
+
return error('usage: /a2a agent add|remove|enable|disable|refresh ...');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
case 'tasks':
|
|
67
|
+
return success(JSON.stringify(impl.listTasks(), null, 2));
|
|
68
|
+
case 'task': {
|
|
69
|
+
const [action, id] = rest;
|
|
70
|
+
if (action === 'get' && id)
|
|
71
|
+
return success(JSON.stringify(impl.getTask(id), null, 2));
|
|
72
|
+
if (action === 'cancel' && id)
|
|
73
|
+
return outcome(await impl.cancelTask(id));
|
|
74
|
+
return error('usage: /a2a task get|cancel <taskId>');
|
|
75
|
+
}
|
|
76
|
+
case 'help':
|
|
77
|
+
return success('a2a commands: status | enable | disable | card | agents | agent add/remove/enable/disable/refresh | tasks | task get/cancel <id> | help');
|
|
78
|
+
default:
|
|
79
|
+
return error(`unknown a2a verb "${verb}" (try /a2a help)`);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function success(text) {
|
|
85
|
+
return { kind: 'success', text };
|
|
86
|
+
}
|
|
87
|
+
function error(text) {
|
|
88
|
+
return { kind: 'error', text };
|
|
89
|
+
}
|
|
90
|
+
function outcome(result) {
|
|
91
|
+
return result.ok ? success(result.message) : error(result.message);
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,mEAAmE;AACnE,MAAM,UAAU,eAAe,CAAC,IAAoB;IAClD,OAAO;QACL,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,6DAA6D;QAC1E,OAAO,EAAE,KAAK,EAAE,UAA6B,EAA0B,EAAE;YACvE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAC/D,QAAQ,IAAI,IAAI,EAAE,EAAE,CAAC;gBACnB,KAAK,EAAE,CAAC,CAAC,CAAC;oBACR,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAA4C,CAAA;oBACtE,OAAO,OAAO,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;gBAClE,CAAC;gBACD,KAAK,QAAQ;oBACX,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;gBACxD,KAAK,QAAQ;oBACX,OAAO,OAAO,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAA;gBAC/C,KAAK,SAAS;oBACZ,OAAO,OAAO,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;gBAChD,KAAK,MAAM;oBACT,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAA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qBAAqB,IAAI,mBAAmB,CAAC,CAAA;YAC9D,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAClC,CAAC;AAED,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,MAA0D;IACzE,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACpE,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `a2a/*` event domain and the `ctx.a2a` service key. P0 ships exactly one
|
|
3
|
+
* event — `a2a/inbound-task`, the policy seam — so the governance story has a
|
|
4
|
+
* real built-in consumer (skill gate + audit) and third-party plugins can hang
|
|
5
|
+
* approval-style policy on inbound tasks. Further events are deferred until a
|
|
6
|
+
* consumer exists (see design §4).
|
|
7
|
+
* @module dsh-a2a/events
|
|
8
|
+
*/
|
|
9
|
+
import type { Part } from './protocol.ts';
|
|
10
|
+
/** The mutable policy decision for one inbound task, before execution. */
|
|
11
|
+
export interface InboundTaskDecision {
|
|
12
|
+
readonly contextId: string;
|
|
13
|
+
readonly skill: string;
|
|
14
|
+
readonly parts: readonly Part[];
|
|
15
|
+
/** Request source identity (auth hash or null) for audit. */
|
|
16
|
+
readonly remotePeerId: string | null;
|
|
17
|
+
/** Set by a policy listener to defer the task for human approval (P1). */
|
|
18
|
+
requiresApproval?: boolean;
|
|
19
|
+
/** Set by a policy listener to veto the task outright. */
|
|
20
|
+
rejected?: {
|
|
21
|
+
readonly reason: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** The facade other plugins read as `ctx.a2a`. */
|
|
25
|
+
export interface A2AServiceLike {
|
|
26
|
+
status(): unknown;
|
|
27
|
+
enableServer(enable: boolean): Promise<{
|
|
28
|
+
readonly ok: boolean;
|
|
29
|
+
readonly message: string;
|
|
30
|
+
}>;
|
|
31
|
+
listTasks(): unknown;
|
|
32
|
+
getTask(taskId: string): unknown;
|
|
33
|
+
cancelTask(taskId: string): Promise<{
|
|
34
|
+
readonly ok: boolean;
|
|
35
|
+
readonly message: string;
|
|
36
|
+
}>;
|
|
37
|
+
agents(): unknown;
|
|
38
|
+
addAgent(spec: unknown): Promise<{
|
|
39
|
+
readonly ok: boolean;
|
|
40
|
+
readonly message: string;
|
|
41
|
+
}>;
|
|
42
|
+
removeAgent(id: string): Promise<{
|
|
43
|
+
readonly ok: boolean;
|
|
44
|
+
readonly message: string;
|
|
45
|
+
}>;
|
|
46
|
+
setAgentEnabled(id: string, enabled: boolean): Promise<{
|
|
47
|
+
readonly ok: boolean;
|
|
48
|
+
readonly message: string;
|
|
49
|
+
}>;
|
|
50
|
+
refreshAgentCard(id: string): Promise<{
|
|
51
|
+
readonly ok: boolean;
|
|
52
|
+
readonly message: string;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
declare module '@deepseek-ai/cordis' {
|
|
56
|
+
interface Context {
|
|
57
|
+
/** The A2A service facade, provided while the plugin is mounted. */
|
|
58
|
+
a2a: A2AServiceLike;
|
|
59
|
+
}
|
|
60
|
+
interface Events {
|
|
61
|
+
/**
|
|
62
|
+
* Policy seam for one inbound task, dispatched as a waterfall before the
|
|
63
|
+
* task starts. Listeners mutate the decision (attach `requiresApproval`,
|
|
64
|
+
* set `rejected`) and MUST call `next(decision)` to delegate; returning
|
|
65
|
+
* without `next()` short-circuits and the returned value is final.
|
|
66
|
+
* @mode waterfall
|
|
67
|
+
* @param decision — the mutable task decision.
|
|
68
|
+
* @param next - delegate the (possibly mutated) decision downstream.
|
|
69
|
+
* @returns the final decision after all listeners.
|
|
70
|
+
*/
|
|
71
|
+
'a2a/inbound-task'(this: unknown, decision: InboundTaskDecision, next: (d: InboundTaskDecision) => Promise<InboundTaskDecision> | InboundTaskDecision): Promise<InboundTaskDecision>;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEzC,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAA;IAC/B,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CACvC;AAED,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC7B,MAAM,IAAI,OAAO,CAAA;IACjB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC1F,SAAS,IAAI,OAAO,CAAA;IACpB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IAChC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACvF,MAAM,IAAI,OAAO,CAAA;IACjB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACpF,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACpF,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC1G,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC1F;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,oEAAoE;QACpE,GAAG,EAAE,cAAc,CAAA;KACpB;IAED,UAAU,MAAM;QACd;;;;;;;;;WASG;QACH,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,mBAAmB,KAAK,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;KACrL;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `a2a/*` event domain and the `ctx.a2a` service key. P0 ships exactly one
|
|
3
|
+
* event — `a2a/inbound-task`, the policy seam — so the governance story has a
|
|
4
|
+
* real built-in consumer (skill gate + audit) and third-party plugins can hang
|
|
5
|
+
* approval-style policy on inbound tasks. Further events are deferred until a
|
|
6
|
+
* consumer exists (see design §4).
|
|
7
|
+
* @module dsh-a2a/events
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hanphone/dsh-a2a — Cordis plugin entry.
|
|
3
|
+
*
|
|
4
|
+
* Mounts the A2A v1.0 dual-end plugin: the inbound server (AgentCard derived
|
|
5
|
+
* from the live tool registry, JSON-RPC + SSE, durable SQLite task store,
|
|
6
|
+
* session/subagent executors, the `a2a/inbound-task` policy gate + audit)
|
|
7
|
+
* and the outbound client (persisted multi-agent registry, skills mapped to
|
|
8
|
+
* model tools, sync calls with per-agent timeout). Optional services are
|
|
9
|
+
* probed rather than injected so a composition lacking one half idles just
|
|
10
|
+
* that half; only the storage domain is required.
|
|
11
|
+
*
|
|
12
|
+
* Function-plugin export shape: named `name`/`inject`/`Config`/`apply`, no
|
|
13
|
+
* default export (mixing forms makes the Loader drop the namespace).
|
|
14
|
+
* @module dsh-a2a
|
|
15
|
+
*/
|
|
16
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
17
|
+
import z from '@deepseek-ai/schemastery';
|
|
18
|
+
import { type OutboundAgentSpec } from './outbound/registry.ts';
|
|
19
|
+
import type { AgentSkill, TaskState } from './protocol.ts';
|
|
20
|
+
export declare const name = "a2a";
|
|
21
|
+
/** Only the storage domain is required; the other halves are probed. */
|
|
22
|
+
export declare const inject: readonly ["storageDomain"];
|
|
23
|
+
export interface A2AConfig {
|
|
24
|
+
server: {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
version: string;
|
|
29
|
+
/** Advertised base URL; null/absent lets the host webServer address be used. */
|
|
30
|
+
baseUrl?: string;
|
|
31
|
+
endpointPath: string;
|
|
32
|
+
/** Environment variable name for the inbound bearer token; absent = anonymous. */
|
|
33
|
+
authTokenEnv?: string;
|
|
34
|
+
skills: {
|
|
35
|
+
ids: string[];
|
|
36
|
+
exclude: string[];
|
|
37
|
+
};
|
|
38
|
+
executors: Record<string, 'session' | 'subagent'>;
|
|
39
|
+
subagentProvider: string;
|
|
40
|
+
};
|
|
41
|
+
client: {
|
|
42
|
+
agents: OutboundAgentSpec[];
|
|
43
|
+
toolPrefix: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Loader-validated config schema (defaults applied by the Loader). */
|
|
47
|
+
export declare const Config: z<A2AConfig>;
|
|
48
|
+
export declare function apply(ctx: Context, config: A2AConfig): void;
|
|
49
|
+
export type { TaskState };
|
|
50
|
+
export type { AgentSkill };
|
|
51
|
+
export { A2AServer } from './server/a2a-server.ts';
|
|
52
|
+
export { A2AClient, A2AError } from './outbound/calls.ts';
|
|
53
|
+
export { A2AService } from './service.ts';
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAaxC,OAAO,EAA2C,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAIxG,OAAO,KAAK,EAAa,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAErE,eAAO,MAAM,IAAI,QAAQ,CAAA;AAEzB,wEAAwE;AACxE,eAAO,MAAM,MAAM,4BAA6B,CAAA;AAEhD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE;QACN,OAAO,EAAE,OAAO,CAAA;QAChB,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