@ryubyte/dsh-a2a 0.2.0 → 0.3.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.en.md +19 -81
- package/README.md +16 -77
- package/lib/client.js +63 -18
- package/lib/index.js +119 -13
- package/lib/types/a2a-config.d.ts +2 -0
- package/lib/types/a2a-config.d.ts.map +1 -1
- package/lib/types/client/dashboard.css.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/dashboard.d.ts +2 -0
- package/lib/types/dashboard.d.ts.map +1 -1
- package/lib/types/index.d.ts +16 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/server.d.ts +12 -3
- package/lib/types/server.d.ts.map +1 -1
- package/package.json +24 -8
- package/src/a2a-config.ts +3 -0
- package/src/client/dashboard.css.ts +5 -0
- package/src/client/index.ts +127 -20
- package/src/dashboard.ts +10 -0
- package/src/index.ts +132 -9
- package/src/server.ts +14 -3
package/src/server.ts
CHANGED
|
@@ -303,6 +303,17 @@ export class A2AServer {
|
|
|
303
303
|
return card;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
/**
|
|
307
|
+
* True when the request carries the configured bearer token. Public wrapper
|
|
308
|
+
* for transports that must decide response headers/status BEFORE streaming
|
|
309
|
+
* frames — see index.ts's SSE branch, which must send `content-type:
|
|
310
|
+
* text/event-stream` + CORS headers before the first `res.write()`, and
|
|
311
|
+
* therefore needs the auth outcome up front.
|
|
312
|
+
*/
|
|
313
|
+
checkAuth(req: { headers?: Record<string, string> }): boolean {
|
|
314
|
+
return this.authorized(req);
|
|
315
|
+
}
|
|
316
|
+
|
|
306
317
|
/** True when the request carries the configured bearer token. */
|
|
307
318
|
private authorized(req: { headers?: Record<string, string> }): boolean {
|
|
308
319
|
const token = this.options.authToken;
|
|
@@ -697,7 +708,7 @@ interface AgentUserMessage {
|
|
|
697
708
|
readonly id: string;
|
|
698
709
|
readonly role: 'user';
|
|
699
710
|
readonly content: AgentTextBlock[];
|
|
700
|
-
readonly source: { kind:
|
|
711
|
+
readonly source: { kind: string };
|
|
701
712
|
}
|
|
702
713
|
|
|
703
714
|
/** The slice of a live `Agent` we drive (mirrors `@deepseek-ai/dsh-agent` `Agent`). */
|
|
@@ -772,7 +783,7 @@ export interface DshAgentExecutorOptions {
|
|
|
772
783
|
* absolute — pass `process.cwd()` (the profile's workspace) at wire time.
|
|
773
784
|
*/
|
|
774
785
|
cwd: string;
|
|
775
|
-
/**
|
|
786
|
+
/** Producer tag stamped on inbound messages (defaults to `'a2a'`); serialized as `plugin:<name>` under session format v4. */
|
|
776
787
|
plugin?: string;
|
|
777
788
|
/** Optional static per-agent model routing forwarded to `create()`. */
|
|
778
789
|
agentOptions?: { provider?: string; model?: string; maxTokens?: number };
|
|
@@ -935,7 +946,7 @@ export function createDshAgentExecutor(
|
|
|
935
946
|
id: crypto.randomUUID(),
|
|
936
947
|
role: 'user',
|
|
937
948
|
content: [{ type: 'text', text: prompt }],
|
|
938
|
-
source: { kind:
|
|
949
|
+
source: { kind: `plugin:${plugin}` },
|
|
939
950
|
});
|
|
940
951
|
agent.send(userMessage, 'next-turn', true);
|
|
941
952
|
// Fire the one-time naming/grouping hook after the first prompt is queued
|