dsh-a2a-server 0.1.0 → 0.2.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/README.md +80 -40
- package/README.zh-CN.md +72 -37
- package/lib/config.d.ts +15 -7
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +6 -1
- package/lib/config.js.map +1 -1
- package/lib/index.d.ts +9 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +53 -20
- package/lib/index.js.map +1 -1
- package/lib/projection.d.ts +21 -19
- package/lib/projection.d.ts.map +1 -1
- package/lib/projection.js +15 -7
- package/lib/projection.js.map +1 -1
- package/lib/protocol/card.d.ts +25 -7
- package/lib/protocol/card.d.ts.map +1 -1
- package/lib/protocol/card.js +35 -14
- package/lib/protocol/card.js.map +1 -1
- package/lib/protocol/index.d.ts +10 -10
- package/lib/protocol/index.d.ts.map +1 -1
- package/lib/protocol/index.js +8 -8
- package/lib/protocol/index.js.map +1 -1
- package/lib/protocol/jsonrpc.d.ts +54 -6
- package/lib/protocol/jsonrpc.d.ts.map +1 -1
- package/lib/protocol/jsonrpc.js +70 -8
- package/lib/protocol/jsonrpc.js.map +1 -1
- package/lib/protocol/parse.d.ts +79 -0
- package/lib/protocol/parse.d.ts.map +1 -0
- package/lib/protocol/parse.js +249 -0
- package/lib/protocol/parse.js.map +1 -0
- package/lib/protocol/sse.d.ts +6 -3
- package/lib/protocol/sse.d.ts.map +1 -1
- package/lib/protocol/sse.js +4 -2
- package/lib/protocol/sse.js.map +1 -1
- package/lib/protocol/wire.d.ts +165 -54
- package/lib/protocol/wire.d.ts.map +1 -1
- package/lib/protocol/wire.js +54 -9
- package/lib/protocol/wire.js.map +1 -1
- package/lib/router.d.ts +10 -1
- package/lib/router.d.ts.map +1 -1
- package/lib/router.js +247 -107
- package/lib/router.js.map +1 -1
- package/lib/security.d.ts +33 -1
- package/lib/security.d.ts.map +1 -1
- package/lib/security.js +44 -2
- package/lib/security.js.map +1 -1
- package/lib/tasks.js +5 -5
- package/lib/tasks.js.map +1 -1
- package/lib/types.d.ts +3 -3
- package/lib/types.js +1 -1
- package/lib/version.d.ts +20 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +20 -0
- package/lib/version.js.map +1 -0
- package/package.json +1 -1
- package/lib/protocol/normalize.d.ts +0 -72
- package/lib/protocol/normalize.d.ts.map +0 -1
- package/lib/protocol/normalize.js +0 -278
- package/lib/protocol/normalize.js.map +0 -1
package/lib/security.d.ts
CHANGED
|
@@ -78,7 +78,39 @@ export declare const FILTERED = "[filtered]";
|
|
|
78
78
|
*/
|
|
79
79
|
export declare function filterInbound(text: string): string;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Replace lone surrogates so the text can be encoded as UTF-8.
|
|
82
|
+
*
|
|
83
|
+
* DEFENSIVE, against a defect upstream of this plugin: the model streaming path
|
|
84
|
+
* can hand us text whose multi-byte characters were decoded across a chunk
|
|
85
|
+
* boundary, leaving orphan bytes as lone surrogates (a split `议`, U+8BAE =
|
|
86
|
+
* `E8 AE AE`, leaves `\uDCAE`). Non-ASCII replies — Chinese, Japanese, emoji —
|
|
87
|
+
* are where this shows, and it is invisible in a terminal.
|
|
88
|
+
*
|
|
89
|
+
* A transport must not put that on the wire. `JSON.stringify` will happily emit
|
|
90
|
+
* `"\udcae"`, which is legal JSON *syntax* but decodes to a string a peer
|
|
91
|
+
* cannot then encode: Python's `json.loads` accepts it and the result raises on
|
|
92
|
+
* `.encode('utf-8')`, and Go and Rust decoders reject or mangle it. Replacing
|
|
93
|
+
* with U+FFFD is what the byte serializer would do anyway, so nothing on the
|
|
94
|
+
* wire changes — the difference is that the JSON now carries a valid string
|
|
95
|
+
* instead of an escape that detonates in the peer's decoder.
|
|
96
|
+
*
|
|
97
|
+
* Equivalent to ES2024's `String.prototype.toWellFormed()`, spelled out because
|
|
98
|
+
* this package compiles against `lib: ES2023`.
|
|
99
|
+
*
|
|
100
|
+
* Remove this once the upstream streaming decoder is chunk-safe; until then the
|
|
101
|
+
* marker is deliberate, because a lone surrogate means a character WAS lost and
|
|
102
|
+
* silently deleting the evidence is worse than showing it.
|
|
103
|
+
* @param text - the text about to be sent.
|
|
104
|
+
* @returns the same text, valid Unicode.
|
|
105
|
+
*/
|
|
106
|
+
export declare function wellFormed(text: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Make model-authored text safe to send to a peer.
|
|
109
|
+
*
|
|
110
|
+
* Two guarantees, both at the LAST point before text leaves the process:
|
|
111
|
+
* no credential-shaped substring, and no code unit that cannot be encoded.
|
|
112
|
+
* They live in one function because there is one outbound text path, and a
|
|
113
|
+
* future second path must not be able to pick up only half of this.
|
|
82
114
|
*
|
|
83
115
|
* This applies to REPLIES, not just to a hypothetical outbound client: an
|
|
84
116
|
* inbound-only server still ships model-authored text to a peer.
|
package/lib/security.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,iFAAiF;AACjF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAW/D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAI1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,WAAW,EAAE,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,GAC7C,YAAY,GAAG,SAAS,CAO1B;AAED,uEAAuE;AACvE,qBAAa,WAAW;IAQpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG;IARtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CA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C,IAAI,CAAoC;IAEzD;;;OAGG;gBAEgB,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,MAAM,MAAiB;IAG/C;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO;IAYtC,2CAA2C;IAC3C,KAAK,IAAI,IAAI;CAGd;AAED,mFAAmF;AACnF,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;IAElD;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAMhC;;;OAGG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI9B,2CAA2C;IAC3C,KAAK,IAAI,IAAI;CAGd;AAkBD,+CAA+C;AAC/C,eAAO,MAAM,QAAQ,eAAe,CAAA;AAEpC;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlD;AAsBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD"}
|
package/lib/security.js
CHANGED
|
@@ -155,7 +155,49 @@ const REDACTIONS = [
|
|
|
155
155
|
[/(?<=\b)[Bb]earer\s+[A-Za-z0-9._-]{20,}/g, 'Bearer [redacted]'],
|
|
156
156
|
];
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
158
|
+
* A UTF-16 code unit that is half of a surrogate pair with no other half.
|
|
159
|
+
*
|
|
160
|
+
* Either a high surrogate not followed by a low one, or a low surrogate not
|
|
161
|
+
* preceded by a high one. Such a string is not valid Unicode and cannot be
|
|
162
|
+
* encoded to UTF-8.
|
|
163
|
+
*/
|
|
164
|
+
const LONE_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
|
|
165
|
+
/**
|
|
166
|
+
* Replace lone surrogates so the text can be encoded as UTF-8.
|
|
167
|
+
*
|
|
168
|
+
* DEFENSIVE, against a defect upstream of this plugin: the model streaming path
|
|
169
|
+
* can hand us text whose multi-byte characters were decoded across a chunk
|
|
170
|
+
* boundary, leaving orphan bytes as lone surrogates (a split `议`, U+8BAE =
|
|
171
|
+
* `E8 AE AE`, leaves `\uDCAE`). Non-ASCII replies — Chinese, Japanese, emoji —
|
|
172
|
+
* are where this shows, and it is invisible in a terminal.
|
|
173
|
+
*
|
|
174
|
+
* A transport must not put that on the wire. `JSON.stringify` will happily emit
|
|
175
|
+
* `"\udcae"`, which is legal JSON *syntax* but decodes to a string a peer
|
|
176
|
+
* cannot then encode: Python's `json.loads` accepts it and the result raises on
|
|
177
|
+
* `.encode('utf-8')`, and Go and Rust decoders reject or mangle it. Replacing
|
|
178
|
+
* with U+FFFD is what the byte serializer would do anyway, so nothing on the
|
|
179
|
+
* wire changes — the difference is that the JSON now carries a valid string
|
|
180
|
+
* instead of an escape that detonates in the peer's decoder.
|
|
181
|
+
*
|
|
182
|
+
* Equivalent to ES2024's `String.prototype.toWellFormed()`, spelled out because
|
|
183
|
+
* this package compiles against `lib: ES2023`.
|
|
184
|
+
*
|
|
185
|
+
* Remove this once the upstream streaming decoder is chunk-safe; until then the
|
|
186
|
+
* marker is deliberate, because a lone surrogate means a character WAS lost and
|
|
187
|
+
* silently deleting the evidence is worse than showing it.
|
|
188
|
+
* @param text - the text about to be sent.
|
|
189
|
+
* @returns the same text, valid Unicode.
|
|
190
|
+
*/
|
|
191
|
+
export function wellFormed(text) {
|
|
192
|
+
return text.replace(LONE_SURROGATE, '�');
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Make model-authored text safe to send to a peer.
|
|
196
|
+
*
|
|
197
|
+
* Two guarantees, both at the LAST point before text leaves the process:
|
|
198
|
+
* no credential-shaped substring, and no code unit that cannot be encoded.
|
|
199
|
+
* They live in one function because there is one outbound text path, and a
|
|
200
|
+
* future second path must not be able to pick up only half of this.
|
|
159
201
|
*
|
|
160
202
|
* This applies to REPLIES, not just to a hypothetical outbound client: an
|
|
161
203
|
* inbound-only server still ships model-authored text to a peer.
|
|
@@ -163,7 +205,7 @@ const REDACTIONS = [
|
|
|
163
205
|
* @returns the scrubbed text.
|
|
164
206
|
*/
|
|
165
207
|
export function redactOutbound(text) {
|
|
166
|
-
let out = text;
|
|
208
|
+
let out = wellFormed(text);
|
|
167
209
|
for (const [pattern, replacement] of REDACTIONS)
|
|
168
210
|
out = out.replace(pattern, replacement);
|
|
169
211
|
return out;
|
package/lib/security.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.js","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAK7C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,CAAS,EAAE,CAAS;IACpD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IACnC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IACpC,+EAA+E;IAC/E,yEAAyE;IACzE,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;QACjC,yEAAyE;QACzE,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC3B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAA0B;IACpD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC1C,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,IAA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uBAAuB,EAAE,gBAAgB,CAAC;IAC3C,CAAC,8BAA8B,EAAE,gBAAgB,CAAC;IAClD,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;IACvC,CAAC,gEAAgE,EAAE,gBAAgB,CAAC;IACpF,CAAC,yCAAyC,EAAE,mBAAmB,CAAC;CACjE,CAAA;AAED;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,yEAAyE,CAAA;AAEhG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;AAC1C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAI,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;IAC1B,KAAK,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,UAAU;QAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;IACxF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/lib/tasks.js
CHANGED
|
@@ -60,7 +60,7 @@ export function artifactsFromTexts(taskId, texts) {
|
|
|
60
60
|
return [{
|
|
61
61
|
artifactId: `${taskId}-result`,
|
|
62
62
|
name: 'result',
|
|
63
|
-
parts: [{
|
|
63
|
+
parts: [{ text: joined, mediaType: 'text/plain' }],
|
|
64
64
|
}];
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -74,11 +74,11 @@ export function artifactsFromTexts(taskId, texts) {
|
|
|
74
74
|
*/
|
|
75
75
|
export function stateFromEnding(endReason) {
|
|
76
76
|
if (endReason === undefined)
|
|
77
|
-
return '
|
|
77
|
+
return 'TASK_STATE_CANCELED';
|
|
78
78
|
if (endReason === 'error')
|
|
79
|
-
return '
|
|
79
|
+
return 'TASK_STATE_FAILED';
|
|
80
80
|
if (endReason === 'cancelled' || endReason === 'canceled')
|
|
81
|
-
return '
|
|
82
|
-
return '
|
|
81
|
+
return 'TASK_STATE_CANCELED';
|
|
82
|
+
return 'TASK_STATE_COMPLETED';
|
|
83
83
|
}
|
|
84
84
|
//# sourceMappingURL=tasks.js.map
|
package/lib/tasks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAgCH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,MAAiB,EAAE,SAAiB;IAC7D,IAAI,MAA0D,CAAA;IAC9D,MAAM,OAAO,GAAG,IAAI,OAAO,CAAiB,CAAC,OAAO,EAAE,EAAE,GAAG,MAAM,GAAG,OAAO,CAAA,CAAC,CAAC,CAAC,CAAA;IAC9E,MAAM,IAAI,GAAa;QACrB,MAAM;QACN,SAAS;QACT,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,KAAK,EAAE,EAAE;QACT,OAAO;QACP,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE;YACrB,IAAI,IAAI,CAAC,IAAI;gBAAE,OAAM;YACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAChB,MAAM,EAAE,CAAC,UAAU,CAAC,CAAA;QACtB,CAAC;KACF,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,KAAwB;IAC5E,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAClC,OAAO,CAAC;YACN,UAAU,EAAE,GAAG,MAA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AAC;SACnD,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,SAA6B;IAC3D,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,qBAAqB,CAAA;IACzD,IAAI,SAAS,KAAK,OAAO;QAAE,OAAO,mBAAmB,CAAA;IACrD,IAAI,SAAS,KAAK,WAAW,IAAI,SAAS,KAAK,UAAU;QAAE,OAAO,qBAAqB,CAAA;IACvF,OAAO,sBAAsB,CAAA;AAC/B,CAAC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Two declaration merges carry the whole durable contract:
|
|
5
5
|
*
|
|
6
6
|
* - `a2a/task` extends `SessionEventMap` so a task's state lives in the
|
|
7
|
-
* append-only log. `
|
|
7
|
+
* append-only log. `GetTask` after a restart therefore has an answer,
|
|
8
8
|
* which a process-local task table could never give.
|
|
9
9
|
* - `a2aPeer` extends `MessageSourceMap` so an inbound message carries
|
|
10
10
|
* structured provenance instead of a warning string glued onto its text.
|
|
@@ -41,8 +41,8 @@ declare module '@deepseek-ai/dsh-session/types' {
|
|
|
41
41
|
* Carried on the edge rather than derived later because of the
|
|
42
42
|
* projection contract's whole-value rule — a state-carrying event must
|
|
43
43
|
* hold the complete post-change state. Without it a peer polling
|
|
44
|
-
* `
|
|
45
|
-
* "it worked and produced nothing" rather than "ask again".
|
|
44
|
+
* `GetTask` gets TASK_STATE_COMPLETED and an empty artifact list, which reads
|
|
45
|
+
* as "it worked and produced nothing" rather than "ask again".
|
|
46
46
|
*/
|
|
47
47
|
output?: string;
|
|
48
48
|
};
|
package/lib/types.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Two declaration merges carry the whole durable contract:
|
|
5
5
|
*
|
|
6
6
|
* - `a2a/task` extends `SessionEventMap` so a task's state lives in the
|
|
7
|
-
* append-only log. `
|
|
7
|
+
* append-only log. `GetTask` after a restart therefore has an answer,
|
|
8
8
|
* which a process-local task table could never give.
|
|
9
9
|
* - `a2aPeer` extends `MessageSourceMap` so an inbound message carries
|
|
10
10
|
* structured provenance instead of a warning string glued onto its text.
|
package/lib/version.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version this server publishes on its Agent Card.
|
|
3
|
+
*
|
|
4
|
+
* `AgentCard.version` is the AGENT's version, not the protocol's — that one
|
|
5
|
+
* lives in `supportedInterfaces[].protocolVersion`. Here the agent IS the
|
|
6
|
+
* plugin, so the card version and the npm version are one fact, and a card
|
|
7
|
+
* claiming a version npm never shipped points a peer at source that cannot
|
|
8
|
+
* explain the behaviour it is seeing.
|
|
9
|
+
*
|
|
10
|
+
* It stays a literal rather than an import of `package.json` because
|
|
11
|
+
* `rootDir` is `src`: the manifest sits outside the compiled tree, so
|
|
12
|
+
* importing it would move the emitted entry point. `tests/version.spec.ts` is
|
|
13
|
+
* what keeps the two in step instead — drift becomes a failing test rather
|
|
14
|
+
* than a card nobody rereads.
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-a2a/version
|
|
17
|
+
*/
|
|
18
|
+
/** Must equal `version` in package.json. */
|
|
19
|
+
export declare const SERVER_VERSION = "0.2.0";
|
|
20
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,4CAA4C;AAC5C,eAAO,MAAM,cAAc,UAAU,CAAA"}
|
package/lib/version.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version this server publishes on its Agent Card.
|
|
3
|
+
*
|
|
4
|
+
* `AgentCard.version` is the AGENT's version, not the protocol's — that one
|
|
5
|
+
* lives in `supportedInterfaces[].protocolVersion`. Here the agent IS the
|
|
6
|
+
* plugin, so the card version and the npm version are one fact, and a card
|
|
7
|
+
* claiming a version npm never shipped points a peer at source that cannot
|
|
8
|
+
* explain the behaviour it is seeing.
|
|
9
|
+
*
|
|
10
|
+
* It stays a literal rather than an import of `package.json` because
|
|
11
|
+
* `rootDir` is `src`: the manifest sits outside the compiled tree, so
|
|
12
|
+
* importing it would move the emitted entry point. `tests/version.spec.ts` is
|
|
13
|
+
* what keeps the two in step instead — drift becomes a failing test rather
|
|
14
|
+
* than a card nobody rereads.
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-a2a/version
|
|
17
|
+
*/
|
|
18
|
+
/** Must equal `version` in package.json. */
|
|
19
|
+
export const SERVER_VERSION = '0.2.0';
|
|
20
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dialect normalization between A2A v0.3.0 and v1.0.
|
|
3
|
-
*
|
|
4
|
-
* Inbound is permissive, outbound is strict: a request in either spelling is
|
|
5
|
-
* parsed into the internal v0.3 shape, and the response is rendered back in the
|
|
6
|
-
* dialect that request declared. Nothing mixes the two spellings in one reply.
|
|
7
|
-
*
|
|
8
|
-
* @module dsh-a2a/protocol/normalize
|
|
9
|
-
*/
|
|
10
|
-
import type { A2ADialect, A2AMessageSendParams, A2APart, A2ATask, A2ATaskStatusUpdateEvent, A2ATaskArtifactUpdateEvent } from './wire.ts';
|
|
11
|
-
/** The internal operation a peer's method name resolves to. */
|
|
12
|
-
export type A2AOperation = 'send' | 'stream' | 'get' | 'cancel' | 'resubscribe' | 'push_set' | 'push_get' | 'push_list' | 'push_delete';
|
|
13
|
-
/** One row of the method table: which operation, and which dialect it implies. */
|
|
14
|
-
interface MethodEntry {
|
|
15
|
-
operation: A2AOperation;
|
|
16
|
-
dialect: A2ADialect;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Resolve a method name to its operation and implied dialect.
|
|
20
|
-
* @param method - the raw `method` string from the request.
|
|
21
|
-
* @returns the entry, or undefined for an unknown method.
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolveMethod(method: string): MethodEntry | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Read a `Part` written in any of the three known spellings.
|
|
26
|
-
*
|
|
27
|
-
* v0.3 discriminates on `kind`, v1.0 on member presence, and pre-0.3 peers used
|
|
28
|
-
* `type`. Unknown shapes yield undefined rather than throwing, so one odd part
|
|
29
|
-
* cannot fail a request whose other parts are usable.
|
|
30
|
-
* @param raw - one element of a `parts` array.
|
|
31
|
-
* @returns the normalized part, or undefined when unrecognizable.
|
|
32
|
-
*/
|
|
33
|
-
export declare function parsePart(raw: unknown): A2APart | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Render every part as text the model can read.
|
|
36
|
-
*
|
|
37
|
-
* File and data parts become bracketed references rather than being dropped, so
|
|
38
|
-
* the agent knows something was attached and can ask about it. This is the same
|
|
39
|
-
* flattening `dsh-acp` applies to baseline resource links.
|
|
40
|
-
* @param parts - normalized parts, in order.
|
|
41
|
-
* @returns the joined text, empty when nothing rendered.
|
|
42
|
-
*/
|
|
43
|
-
export declare function partsToText(parts: readonly A2APart[]): string;
|
|
44
|
-
/**
|
|
45
|
-
* Parse `message/send` and `message/stream` parameters from either dialect.
|
|
46
|
-
* @param raw - the request's `params` value.
|
|
47
|
-
* @returns the normalized parameters, or undefined when the shape is unusable.
|
|
48
|
-
*/
|
|
49
|
-
export declare function parseSendParams(raw: unknown): A2AMessageSendParams | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Render a task in the requested dialect.
|
|
52
|
-
* @param task - the internal v0.3-shaped task.
|
|
53
|
-
* @param dialect - the dialect the peer spoke.
|
|
54
|
-
* @returns the wire object to serialize.
|
|
55
|
-
*/
|
|
56
|
-
export declare function renderTask(task: A2ATask, dialect: A2ADialect): unknown;
|
|
57
|
-
/**
|
|
58
|
-
* Render a status-update stream event in the requested dialect.
|
|
59
|
-
* @param event - the internal event.
|
|
60
|
-
* @param dialect - the dialect the peer spoke.
|
|
61
|
-
* @returns the wire object to serialize.
|
|
62
|
-
*/
|
|
63
|
-
export declare function renderStatusUpdate(event: A2ATaskStatusUpdateEvent, dialect: A2ADialect): unknown;
|
|
64
|
-
/**
|
|
65
|
-
* Render an artifact-update stream event in the requested dialect.
|
|
66
|
-
* @param event - the internal event.
|
|
67
|
-
* @param dialect - the dialect the peer spoke.
|
|
68
|
-
* @returns the wire object to serialize.
|
|
69
|
-
*/
|
|
70
|
-
export declare function renderArtifactUpdate(event: A2ATaskArtifactUpdateEvent, dialect: A2ADialect): unknown;
|
|
71
|
-
export {};
|
|
72
|
-
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/protocol/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EACV,UAAU,EAGV,oBAAoB,EACpB,OAAO,EAEP,OAAO,EAEP,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,WAAW,CAAA;AAElB,+DAA+D;AAC/D,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,aAAa,GACb,UAAU,GACV,UAAU,GACV,WAAW,GACX,aAAa,CAAA;AAEjB,kFAAkF;AAClF,UAAU,WAAW;IACnB,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,UAAU,CAAA;CACpB;AAiCD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAErE;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAsB3D;AAmCD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAc7D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS,CAqC9E;AAcD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAOtE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAGhG;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,0BAA0B,EACjC,OAAO,EAAE,UAAU,GAClB,OAAO,CAET"}
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dialect normalization between A2A v0.3.0 and v1.0.
|
|
3
|
-
*
|
|
4
|
-
* Inbound is permissive, outbound is strict: a request in either spelling is
|
|
5
|
-
* parsed into the internal v0.3 shape, and the response is rendered back in the
|
|
6
|
-
* dialect that request declared. Nothing mixes the two spellings in one reply.
|
|
7
|
-
*
|
|
8
|
-
* @module dsh-a2a/protocol/normalize
|
|
9
|
-
*/
|
|
10
|
-
import { A2AContextId, A2ATaskId } from "./brand.js";
|
|
11
|
-
/**
|
|
12
|
-
* Every method spelling this server answers.
|
|
13
|
-
*
|
|
14
|
-
* v0.3 is the mainline; the v1.0 PascalCase names are accepted so a peer built
|
|
15
|
-
* against the newer spec interoperates without a shim on its side.
|
|
16
|
-
*/
|
|
17
|
-
const METHODS = new Map([
|
|
18
|
-
// — v0.3.0 mainline —
|
|
19
|
-
['message/send', { operation: 'send', dialect: 'v0.3' }],
|
|
20
|
-
['message/stream', { operation: 'stream', dialect: 'v0.3' }],
|
|
21
|
-
['tasks/get', { operation: 'get', dialect: 'v0.3' }],
|
|
22
|
-
['tasks/cancel', { operation: 'cancel', dialect: 'v0.3' }],
|
|
23
|
-
['tasks/resubscribe', { operation: 'resubscribe', dialect: 'v0.3' }],
|
|
24
|
-
['tasks/pushNotificationConfig/set', { operation: 'push_set', dialect: 'v0.3' }],
|
|
25
|
-
['tasks/pushNotificationConfig/get', { operation: 'push_get', dialect: 'v0.3' }],
|
|
26
|
-
['tasks/pushNotificationConfig/list', { operation: 'push_list', dialect: 'v0.3' }],
|
|
27
|
-
['tasks/pushNotificationConfig/delete', { operation: 'push_delete', dialect: 'v0.3' }],
|
|
28
|
-
// — v1.0 —
|
|
29
|
-
['SendMessage', { operation: 'send', dialect: 'v1.0' }],
|
|
30
|
-
['SendStreamingMessage', { operation: 'stream', dialect: 'v1.0' }],
|
|
31
|
-
['GetTask', { operation: 'get', dialect: 'v1.0' }],
|
|
32
|
-
['CancelTask', { operation: 'cancel', dialect: 'v1.0' }],
|
|
33
|
-
['SubscribeToTask', { operation: 'resubscribe', dialect: 'v1.0' }],
|
|
34
|
-
['CreateTaskPushNotificationConfig', { operation: 'push_set', dialect: 'v1.0' }],
|
|
35
|
-
['GetTaskPushNotificationConfig', { operation: 'push_get', dialect: 'v1.0' }],
|
|
36
|
-
['ListTaskPushNotificationConfigs', { operation: 'push_list', dialect: 'v1.0' }],
|
|
37
|
-
['DeleteTaskPushNotificationConfig', { operation: 'push_delete', dialect: 'v1.0' }],
|
|
38
|
-
// — pre-0.3 aliases seen in the wild —
|
|
39
|
-
['tasks/pushNotification/set', { operation: 'push_set', dialect: 'v0.3' }],
|
|
40
|
-
]);
|
|
41
|
-
/**
|
|
42
|
-
* Resolve a method name to its operation and implied dialect.
|
|
43
|
-
* @param method - the raw `method` string from the request.
|
|
44
|
-
* @returns the entry, or undefined for an unknown method.
|
|
45
|
-
*/
|
|
46
|
-
export function resolveMethod(method) {
|
|
47
|
-
return METHODS.get(method);
|
|
48
|
-
}
|
|
49
|
-
/** v1.0 spells task states in SCREAMING_SNAKE_CASE. */
|
|
50
|
-
const STATE_TO_V1 = {
|
|
51
|
-
'submitted': 'TASK_STATE_SUBMITTED',
|
|
52
|
-
'working': 'TASK_STATE_WORKING',
|
|
53
|
-
'input-required': 'TASK_STATE_INPUT_REQUIRED',
|
|
54
|
-
'auth-required': 'TASK_STATE_AUTH_REQUIRED',
|
|
55
|
-
'completed': 'TASK_STATE_COMPLETED',
|
|
56
|
-
'canceled': 'TASK_STATE_CANCELED',
|
|
57
|
-
'failed': 'TASK_STATE_FAILED',
|
|
58
|
-
'rejected': 'TASK_STATE_REJECTED',
|
|
59
|
-
};
|
|
60
|
-
const ROLE_TO_V1 = {
|
|
61
|
-
user: 'ROLE_USER',
|
|
62
|
-
agent: 'ROLE_AGENT',
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Read a `Part` written in any of the three known spellings.
|
|
66
|
-
*
|
|
67
|
-
* v0.3 discriminates on `kind`, v1.0 on member presence, and pre-0.3 peers used
|
|
68
|
-
* `type`. Unknown shapes yield undefined rather than throwing, so one odd part
|
|
69
|
-
* cannot fail a request whose other parts are usable.
|
|
70
|
-
* @param raw - one element of a `parts` array.
|
|
71
|
-
* @returns the normalized part, or undefined when unrecognizable.
|
|
72
|
-
*/
|
|
73
|
-
export function parsePart(raw) {
|
|
74
|
-
if (raw === null || typeof raw !== 'object')
|
|
75
|
-
return undefined;
|
|
76
|
-
const part = raw;
|
|
77
|
-
const tag = typeof part['kind'] === 'string'
|
|
78
|
-
? part['kind']
|
|
79
|
-
: typeof part['type'] === 'string' ? part['type'] : undefined;
|
|
80
|
-
if (tag === 'text') {
|
|
81
|
-
return typeof part['text'] === 'string' ? { kind: 'text', text: part['text'] } : undefined;
|
|
82
|
-
}
|
|
83
|
-
if (tag === 'data')
|
|
84
|
-
return { kind: 'data', data: part['data'] };
|
|
85
|
-
if (tag === 'file')
|
|
86
|
-
return parseFilePart(part);
|
|
87
|
-
if (tag !== undefined)
|
|
88
|
-
return undefined;
|
|
89
|
-
// Untagged: v1.0 discriminates a part by which member is present. Order
|
|
90
|
-
// matters only in that each probe must be specific enough not to claim
|
|
91
|
-
// another variant's shape.
|
|
92
|
-
if (typeof part['text'] === 'string')
|
|
93
|
-
return { kind: 'text', text: part['text'] };
|
|
94
|
-
const file = parseFilePart(part);
|
|
95
|
-
if (file !== undefined)
|
|
96
|
-
return file;
|
|
97
|
-
if ('data' in part)
|
|
98
|
-
return { kind: 'data', data: part['data'] };
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Read a file part in either the v0.3 nested or the v1.0 flattened spelling.
|
|
103
|
-
* @param part - the raw part object.
|
|
104
|
-
* @returns the normalized file part, or undefined when no file member is present.
|
|
105
|
-
*/
|
|
106
|
-
function parseFilePart(part) {
|
|
107
|
-
const nested = part['file'];
|
|
108
|
-
if (nested !== null && typeof nested === 'object') {
|
|
109
|
-
return { kind: 'file', file: nested };
|
|
110
|
-
}
|
|
111
|
-
const uri = part['url'] ?? part['uri'];
|
|
112
|
-
const bytes = part['raw'] ?? part['bytes'];
|
|
113
|
-
if (typeof uri !== 'string' && typeof bytes !== 'string')
|
|
114
|
-
return undefined;
|
|
115
|
-
return {
|
|
116
|
-
kind: 'file',
|
|
117
|
-
file: {
|
|
118
|
-
...typeof uri === 'string' ? { uri } : {},
|
|
119
|
-
...typeof bytes === 'string' ? { bytes } : {},
|
|
120
|
-
...typeof part['filename'] === 'string' ? { name: part['filename'] } : {},
|
|
121
|
-
...typeof part['name'] === 'string' ? { name: part['name'] } : {},
|
|
122
|
-
...typeof part['mediaType'] === 'string' ? { mimeType: part['mediaType'] } : {},
|
|
123
|
-
...typeof part['mimeType'] === 'string' ? { mimeType: part['mimeType'] } : {},
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Render every part as text the model can read.
|
|
129
|
-
*
|
|
130
|
-
* File and data parts become bracketed references rather than being dropped, so
|
|
131
|
-
* the agent knows something was attached and can ask about it. This is the same
|
|
132
|
-
* flattening `dsh-acp` applies to baseline resource links.
|
|
133
|
-
* @param parts - normalized parts, in order.
|
|
134
|
-
* @returns the joined text, empty when nothing rendered.
|
|
135
|
-
*/
|
|
136
|
-
export function partsToText(parts) {
|
|
137
|
-
const chunks = [];
|
|
138
|
-
for (const part of parts) {
|
|
139
|
-
if (part.kind === 'text') {
|
|
140
|
-
if (part.text.length > 0)
|
|
141
|
-
chunks.push(part.text);
|
|
142
|
-
}
|
|
143
|
-
else if (part.kind === 'file') {
|
|
144
|
-
const name = part.file.name ?? part.file.uri ?? 'unnamed';
|
|
145
|
-
const type = part.file.mimeType === undefined ? '' : ` type=${part.file.mimeType}`;
|
|
146
|
-
chunks.push(`[file name=${name}${type}]`);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
chunks.push(`[data ${JSON.stringify(part.data)}]`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return chunks.join('\n');
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Parse `message/send` and `message/stream` parameters from either dialect.
|
|
156
|
-
* @param raw - the request's `params` value.
|
|
157
|
-
* @returns the normalized parameters, or undefined when the shape is unusable.
|
|
158
|
-
*/
|
|
159
|
-
export function parseSendParams(raw) {
|
|
160
|
-
if (raw === null || typeof raw !== 'object')
|
|
161
|
-
return undefined;
|
|
162
|
-
const params = raw;
|
|
163
|
-
const rawMessage = params['message'];
|
|
164
|
-
if (rawMessage === null || typeof rawMessage !== 'object')
|
|
165
|
-
return undefined;
|
|
166
|
-
const message = rawMessage;
|
|
167
|
-
const rawParts = message['parts'];
|
|
168
|
-
const parts = [];
|
|
169
|
-
if (Array.isArray(rawParts)) {
|
|
170
|
-
for (const item of rawParts) {
|
|
171
|
-
const part = parsePart(item);
|
|
172
|
-
if (part !== undefined)
|
|
173
|
-
parts.push(part);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
// v0.3 allows contextId at the top level too; the message wins when both appear.
|
|
177
|
-
const contextId = firstString(message['contextId'], params['contextId']);
|
|
178
|
-
const taskId = firstString(message['taskId'], params['taskId']);
|
|
179
|
-
const normalized = {
|
|
180
|
-
kind: 'message',
|
|
181
|
-
messageId: firstString(message['messageId']) ?? '',
|
|
182
|
-
role: message['role'] === 'ROLE_AGENT' || message['role'] === 'agent' ? 'agent' : 'user',
|
|
183
|
-
parts,
|
|
184
|
-
...contextId === undefined ? {} : { contextId: A2AContextId(contextId) },
|
|
185
|
-
...taskId === undefined ? {} : { taskId: A2ATaskId(taskId) },
|
|
186
|
-
};
|
|
187
|
-
const configuration = params['configuration'];
|
|
188
|
-
if (configuration !== null && typeof configuration === 'object') {
|
|
189
|
-
return {
|
|
190
|
-
message: normalized,
|
|
191
|
-
configuration: configuration,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
return { message: normalized };
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Return the first defined non-empty string among the candidates.
|
|
198
|
-
* @param values - candidate values in precedence order.
|
|
199
|
-
* @returns the winning string, or undefined.
|
|
200
|
-
*/
|
|
201
|
-
function firstString(...values) {
|
|
202
|
-
for (const value of values) {
|
|
203
|
-
if (typeof value === 'string' && value.length > 0)
|
|
204
|
-
return value;
|
|
205
|
-
}
|
|
206
|
-
return undefined;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Render a task in the requested dialect.
|
|
210
|
-
* @param task - the internal v0.3-shaped task.
|
|
211
|
-
* @param dialect - the dialect the peer spoke.
|
|
212
|
-
* @returns the wire object to serialize.
|
|
213
|
-
*/
|
|
214
|
-
export function renderTask(task, dialect) {
|
|
215
|
-
if (dialect === 'v0.3')
|
|
216
|
-
return task;
|
|
217
|
-
return {
|
|
218
|
-
...task,
|
|
219
|
-
status: renderStatusV1(task.status),
|
|
220
|
-
...task.history === undefined ? {} : { history: task.history.map(renderMessageV1) },
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Render a status-update stream event in the requested dialect.
|
|
225
|
-
* @param event - the internal event.
|
|
226
|
-
* @param dialect - the dialect the peer spoke.
|
|
227
|
-
* @returns the wire object to serialize.
|
|
228
|
-
*/
|
|
229
|
-
export function renderStatusUpdate(event, dialect) {
|
|
230
|
-
if (dialect === 'v0.3')
|
|
231
|
-
return event;
|
|
232
|
-
return { statusUpdate: { ...event, status: renderStatusV1(event.status) } };
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Render an artifact-update stream event in the requested dialect.
|
|
236
|
-
* @param event - the internal event.
|
|
237
|
-
* @param dialect - the dialect the peer spoke.
|
|
238
|
-
* @returns the wire object to serialize.
|
|
239
|
-
*/
|
|
240
|
-
export function renderArtifactUpdate(event, dialect) {
|
|
241
|
-
return dialect === 'v0.3' ? event : { artifactUpdate: event };
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Render a task status with v1.0 enum spellings.
|
|
245
|
-
* @param status - the internal status.
|
|
246
|
-
* @returns the v1.0-shaped status.
|
|
247
|
-
*/
|
|
248
|
-
function renderStatusV1(status) {
|
|
249
|
-
return {
|
|
250
|
-
...status,
|
|
251
|
-
state: STATE_TO_V1[status.state],
|
|
252
|
-
...status.message === undefined ? {} : { message: renderMessageV1(status.message) },
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Render a message with v1.0 enum spellings and member-presence parts.
|
|
257
|
-
* @param message - the internal message.
|
|
258
|
-
* @returns the v1.0-shaped message.
|
|
259
|
-
*/
|
|
260
|
-
function renderMessageV1(message) {
|
|
261
|
-
return {
|
|
262
|
-
...message,
|
|
263
|
-
role: ROLE_TO_V1[message.role],
|
|
264
|
-
parts: message.parts.map((part) => {
|
|
265
|
-
if (part.kind === 'text')
|
|
266
|
-
return { text: part.text };
|
|
267
|
-
if (part.kind === 'data')
|
|
268
|
-
return { data: part.data };
|
|
269
|
-
return {
|
|
270
|
-
...part.file.uri === undefined ? {} : { url: part.file.uri },
|
|
271
|
-
...part.file.bytes === undefined ? {} : { raw: part.file.bytes },
|
|
272
|
-
...part.file.name === undefined ? {} : { filename: part.file.name },
|
|
273
|
-
...part.file.mimeType === undefined ? {} : { mediaType: part.file.mimeType },
|
|
274
|
-
};
|
|
275
|
-
}),
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
//# sourceMappingURL=normalize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/protocol/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAgCpD;;;;;GAKG;AACH,MAAM,OAAO,GAAqC,IAAI,GAAG,CAAC;IACxD,sBAAsB;IACtB,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACxD,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAC5D,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACpD,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAC1D,CAAC,mBAAmB,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACpE,CAAC,kCAAkC,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAChF,CAAC,kCAAkC,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAChF,CAAC,mCAAmC,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClF,CAAC,qCAAqC,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,OAA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