@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/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: 'plugin'; plugin: string };
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
- /** `source.plugin` tag stamped on inbound messages (defaults to `'a2a'`). */
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: 'plugin', plugin },
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