@ryubyte/dsh-a2a 0.1.3 → 0.1.5

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.
@@ -40,6 +40,8 @@ export interface PersistedServerConfig {
40
40
  agentDescription?: string;
41
41
  agentVersion?: string;
42
42
  endpointPath?: string;
43
+ /** Optional shared bearer token protecting the inbound /a2a endpoint. */
44
+ authToken?: string;
43
45
  skills?: Array<{
44
46
  id: string;
45
47
  name: string;
@@ -66,6 +68,26 @@ export interface PersistedA2AConfig {
66
68
  * guessing from cwd's basename.
67
69
  */
68
70
  export declare function profileNameFromArgv(): string | undefined;
71
+ /**
72
+ * Best-effort profile-name fallback for launchers that resolve a profile
73
+ * WITHOUT writing `--profile` back into argv.
74
+ *
75
+ * The dsh `web` subcommand is a hardcoded alias for `--profile web`: the
76
+ * launcher resolves the name internally and boots the web profile, but the
77
+ * process argv keeps the original tokens (`node …/dsh web [flags]`) — there
78
+ * is no `--profile` flag and no environment variable naming the profile. So
79
+ * when {@link profileNameFromArgv} finds nothing, check whether the first
80
+ * non-flag token after argv[0] is a known dsh subcommand alias:
81
+ *
82
+ * - `web` → boot profile `web` (alias, never followed by a name)
83
+ * - `--profile <n>` → already handled above
84
+ * - anything else → unknown/not a profile alias (e.g. `plugin`, which
85
+ * is a management mode, not a boot; returns undefined)
86
+ *
87
+ * Returns undefined when argv carries no recognizable alias, letting the
88
+ * caller fall through to the cwd-based resolution steps.
89
+ */
90
+ export declare function profileNameFromDshAlias(): string | undefined;
69
91
  /**
70
92
  * Resolve the a2a.json path for the current process, without depending on
71
93
  * the launch directory. The plugin must work no matter where `dsh` was
@@ -76,7 +98,9 @@ export declare function profileNameFromArgv(): string | undefined;
76
98
  *
77
99
  * Order:
78
100
  * 0. `$DSH_HOME/profiles/<argv --profile>/a2a.json` — the active profile
79
- * as named on the command line (most authoritative; works from ANY cwd)
101
+ * as named on the command line (most authoritative; works from ANY cwd).
102
+ * Also matches the `dsh web` alias, which boots profile `web` without
103
+ * writing `--profile` into argv.
80
104
  * 1. `cwd/a2a.json` — explicit when launched inside a profile dir
81
105
  * 2. outward from cwd: the nearest ancestor holding `a2a.json` — covers
82
106
  * launching from e.g. a repo checkout whose parent chain includes the
@@ -1 +1 @@
1
- {"version":3,"file":"a2a-config.d.ts","sourceRoot":"","sources":["../../src/a2a-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACzG;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpC,SAAS,CAAC,EA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,CAAC,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAmBpG"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAsC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAE9E,0DAA0D;AAC1D,eAAO,MAAM,MAAM,UAAY,CAAC;AAEhC,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAmB9C;AA6DD,KAAK,YAAY,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAErD,qDAAqD;AACrD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAqTnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAsC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAE9E,0DAA0D;AAC1D,eAAO,MAAM,MAAM,UAAY,CAAC;AAEhC,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAmB9C;AA6DD,KAAK,YAAY,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAErD,qDAAqD;AACrD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CA0UnE"}
@@ -90,11 +90,17 @@ export interface DashboardControlHooks {
90
90
  /** Reconnect is not meaningful for an inbound peer — rejects unless overridden. */
91
91
  reconnectPeer?: (peerId: string) => Promise<ControlResult>;
92
92
  /** Runtime-add an outbound agent (visual config). Returns the new connection id. */
93
- addAgent?: (name: string, agentCardUrl: string) => Promise<ControlResult>;
93
+ addAgent?: (name: string, agentCardUrl: string, opts?: {
94
+ bearerToken?: string;
95
+ }) => Promise<ControlResult>;
94
96
  /** Discover an Agent Card without connecting (for the import preview). */
95
- discoverAgent?: (agentCardUrl: string) => Promise<ControlResult>;
97
+ discoverAgent?: (agentCardUrl: string, opts?: {
98
+ bearerToken?: string;
99
+ }) => Promise<ControlResult>;
96
100
  /** Enable/disable the inbound A2A server (serve routes) at runtime. */
97
101
  setServerEnabled?: (enabled: boolean) => Promise<ControlResult>;
102
+ /** Set or clear the inbound server's shared bearer token at runtime (persisted). */
103
+ setServerAuthToken?: (token?: string) => Promise<ControlResult>;
98
104
  /** Read current inbound server status (for the serve panel). */
99
105
  serverStatus?: () => ControlResult;
100
106
  /** Runtime-remove an outbound agent by its connection id. */
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/dashboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CA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AAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI;IASxE,uCAAuC;IACvC,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAQtC,QAAQ,IAAI,iBAAiB;IAQvB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAsExG,OAAO,CAAC,cAAc;CAKvB;AAaD,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAUD,0EAA0E;AAC1E,wBAAgB,iBAAiB,IAAI,iBAAiB,CAGrD;AAED,4DAA4D;AAC5D,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
@@ -22,7 +22,7 @@
22
22
  */
23
23
  import type { Context } from '@deepseek-ai/cordis';
24
24
  import type { IncomingMessage, ServerResponse } from 'node:http';
25
- import { type ServerOptions } from './server.js';
25
+ import { type ServerOptions, type AgentRegistryLike } from './server.js';
26
26
  export interface A2APluginConfig {
27
27
  mode?: 'client' | 'server' | 'both';
28
28
  name?: string;
@@ -39,6 +39,8 @@ export interface A2APluginConfig {
39
39
  skills?: ServerOptions['skills'];
40
40
  endpointPath?: string;
41
41
  execute?: ServerOptions['execute'];
42
+ /** Optional shared bearer token protecting the inbound /a2a endpoint. */
43
+ authToken?: string;
42
44
  /** Serve the dashboard API on the webserver (default true). */
43
45
  dashboard?: boolean;
44
46
  }
@@ -46,7 +48,8 @@ export { A2AClient } from './client.js';
46
48
  export * from './protocol.js';
47
49
  export * from './errors.js';
48
50
  export { fetchAgentCard } from './card.js';
49
- export { A2AServer, TaskStore, defaultExecutor, defaultSkills } from './server.js';
51
+ export { A2AServer, TaskStore, defaultExecutor, notConfiguredExecutor, shellExecutor, defaultSkills, createDshAgentExecutor } from './server.js';
52
+ export type { AgentRegistryLike, AgentPresetsLike, DshAgentExecutorOptions } from './server.js';
50
53
  export { registerAgentTools } from './outbound.js';
51
54
  export { DashboardRegistry, getSharedRegistry } from './dashboard.js';
52
55
  export type { DashboardSnapshot, InboundPeer, OutboundAgent, ControlResult, } from './dashboard.js';
@@ -67,14 +70,50 @@ export interface WebServerService {
67
70
  handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
68
71
  }): () => void;
69
72
  }
73
+ /**
74
+ * Structural slice of `ctx.agentDefaultModel` (owned by
75
+ * `@deepseek-ai/dsh-agent-default-model`). It holds the deployment's default
76
+ * `{ provider, model }` (layered with the user's Settings choice). Reading it
77
+ * to seed a newly-created agent's model is the creating entry point's job — a
78
+ * fresh session has no model selection, and DSH's persona system prompt fails
79
+ * assembly on an empty `{{model}}` variable otherwise.
80
+ */
81
+ export interface AgentDefaultModelService {
82
+ currentSelection(): {
83
+ provider?: string;
84
+ model?: string;
85
+ reasoningEffort?: string;
86
+ };
87
+ }
88
+ /**
89
+ * Structural slice of `ctx.sessionTitle` (owned by `@deepseek-ai/dsh-session-title`).
90
+ * `rename` accepts an explicit user title and pins it. We name inbound sessions
91
+ * ourselves because their prompts carry a `plugin` source, which the title
92
+ * service's automatic first-prompt naming deliberately ignores (human messages
93
+ * only) — so without this they fall back to the cwd basename.
94
+ */
95
+ export interface SessionTitleService {
96
+ rename(session: unknown, title: string): unknown;
97
+ }
70
98
  declare module '@deepseek-ai/cordis' {
71
99
  interface Context {
72
100
  /** Provided by @deepseek-ai/dsh-host-webserver. */
73
101
  webServer: WebServerService;
102
+ /** Provided by @deepseek-ai/dsh-agent-default-model (optional). */
103
+ agentDefaultModel?: AgentDefaultModelService;
104
+ /** Provided by @deepseek-ai/dsh-session-title (optional). */
105
+ sessionTitle?: SessionTitleService;
74
106
  /** Provided by @deepseek-ai/dsh-tools. */
75
107
  tools: {
76
108
  register(def: unknown): () => void;
77
109
  };
110
+ /**
111
+ * Provided by @deepseek-ai/dsh-agent (the agent registry). Present whenever
112
+ * that layer is composed, but `create()` only succeeds once an agent-loop
113
+ * plugin has registered its factory — so server mode probes readiness
114
+ * before enabling {@link createDshAgentExecutor}, and never hard-injects it.
115
+ */
116
+ agents?: AgentRegistryLike;
78
117
  }
79
118
  }
80
119
  export declare const name = "a2a";
@@ -86,4 +125,22 @@ export declare const name = "a2a";
86
125
  */
87
126
  export declare const inject: readonly ["webServer", "tools"];
88
127
  export declare function apply(ctx: Context, config?: A2APluginConfig): void;
128
+ /**
129
+ * Derive the public base URL advertised in the AgentCard from the real wire
130
+ * listen address, when the operator did not pin `baseUrl` in config.
131
+ *
132
+ * The A2A AgentCard must carry a URL a REMOTE caller can reach. When the web
133
+ * server binds only loopback (`127.0.0.1`), that address is correct. But when
134
+ * it binds every interface (`0.0.0.0`), advertising `127.0.0.1` is wrong for
135
+ * every non-local caller — it points at the caller's own loopback. In that
136
+ * case pick the machine's best-known LAN address (the primary non-loopback
137
+ * IPv4 of the interface that routes to the default gateway), and only fall
138
+ * back to loopback when no such address exists. IPv6 link-local is skipped
139
+ * (not reachable without a scope id).
140
+ *
141
+ * @param host - the web server's configured bind host ('127.0.0.1' | '0.0.0.0').
142
+ * @param port - the OS-assigned (or configured) listen port.
143
+ * @returns a scheme+host+port URL for Agents to call back into this DSH.
144
+ */
145
+ export declare function inferBaseUrl(host: string, port: number): string;
89
146
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAW5D,MAAM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ts","sourceRoot":"","sources":["../../src/outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAA6B,MAAM,eAAe,CAAC;AAK1E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,CAAC,UAAU,EAAE,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;IACpE,gEAAgE;IAChE,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAmCD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,EAAE,CAAC,CAsC3B"}
1
+ {"version":3,"file":"outbound.d.ts","sourceRoot":"","sources":["../../src/outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAA6B,MAAM,eAAe,CAAC;AAK1E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,CAAC,UAAU,EAAE,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;IACpE,gEAAgE;IAChE,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAmCD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,EAAE,CAAC,CAyD3B"}
@@ -27,6 +27,14 @@ export interface ServerOptions {
27
27
  skills?: ServerSkill[];
28
28
  /** Override the executor that runs an incoming task. */
29
29
  execute?: TaskExecutor;
30
+ /**
31
+ * Optional shared bearer token. When set, the AgentCard declares an
32
+ * `http`/`bearer` security scheme and every inbound JSON-RPC request must
33
+ * carry `Authorization: Bearer <token>` or it is rejected with 401. When
34
+ * unset, no scheme is advertised and requests are not token-gated (but the
35
+ * default executor still refuses to act unless one is injected).
36
+ */
37
+ authToken?: string;
30
38
  /** Extra custom headers on the AgentCard (rarely needed). */
31
39
  iconUrl?: string;
32
40
  defaultInputModes?: string[];
@@ -90,13 +98,27 @@ export declare class A2AServer {
90
98
  private execute;
91
99
  private listeners;
92
100
  private baseUrl;
101
+ /** Abort controllers for in-flight tasks, so CancelTask can abort the executor. */
102
+ private running;
93
103
  constructor(options: ServerOptions, store?: TaskStore);
94
104
  /**
95
105
  * Update the base URL advertised in the AgentCard after the real listen
96
106
  * address is known (e.g. ephemeral port). Mutates `card` in place.
97
107
  */
98
108
  setBaseUrl(baseUrl: string): void;
109
+ /**
110
+ * Set or clear the shared bearer token that gates the inbound endpoint at
111
+ * runtime. Rebuilds the AgentCard so the `bearerAuth` security scheme is
112
+ * advertised (token set) or withdrawn (token cleared); `authorized()` reads
113
+ * `options.authToken` on each request, so the gate flips immediately. Pass
114
+ * `undefined` or an empty string to disable token gating.
115
+ */
116
+ setAuthToken(token?: string): void;
117
+ /** Whether the inbound endpoint is currently token-gated. */
118
+ get authConfigured(): boolean;
99
119
  private buildCard;
120
+ /** True when the request carries the configured bearer token. */
121
+ private authorized;
100
122
  private emit;
101
123
  /** Route an inbound HTTP request; returns true when handled. */
102
124
  handle(req: {
@@ -113,6 +135,7 @@ export declare class A2AServer {
113
135
  status: number;
114
136
  contentType: string;
115
137
  body: string;
138
+ headers?: Record<string, string>;
116
139
  }>;
117
140
  handleStream(req: {
118
141
  method?: string;
@@ -124,6 +147,7 @@ export declare class A2AServer {
124
147
  };
125
148
  }, body: string, onEvent: (frame: string) => void): Promise<{
126
149
  status: number;
150
+ headers?: Record<string, string>;
127
151
  }>;
128
152
  private ensureTask;
129
153
  private waitTerminal;
@@ -134,9 +158,209 @@ export declare class A2AServer {
134
158
  }
135
159
  export declare const defaultSkills: ServerSkill[];
136
160
  /**
137
- * Default executor: run the incoming prompt through the system shell and
161
+ * Safe default executor: refuses to act, telling the caller to inject a real
162
+ * executor. Used when an `A2AServer` is constructed without an `execute`
163
+ * option, so an inbound message never triggers arbitrary action (in particular
164
+ * never a shell command) unless the operator explicitly configured one.
165
+ */
166
+ export declare const notConfiguredExecutor: TaskExecutor;
167
+ /**
168
+ * Shell executor: run the incoming prompt through the system shell and
138
169
  * return the captured stdout/stderr as the task artifact. Honors the
139
170
  * AbortSignal (task cancellation / shutdown) by killing the child process.
171
+ *
172
+ * This is local-testing-only: arbitrary text from an inbound message becomes
173
+ * a `/bin/sh -c` command, so only use it against a trusted client. It is
174
+ * deliberately NOT the default — pass it explicitly to opt in:
175
+ *
176
+ * ```ts
177
+ * const server = new A2AServer({ ..., execute: shellExecutor }, store);
178
+ * ```
179
+ */
180
+ export declare const shellExecutor: TaskExecutor;
181
+ /**
182
+ * Backwards-compatible alias for {@link shellExecutor}. Kept for code that
183
+ * explicitly opted into the shell executor before it was renamed; the safe
184
+ * default for `A2AServer` is now {@link notConfiguredExecutor}, so using
185
+ * this alias still requires an explicit opt-in.
140
186
  */
141
187
  export declare const defaultExecutor: TaskExecutor;
188
+ /** The one ordered pending-message list we route inbound turns to. */
189
+ type InboxTarget = 'next-turn' | 'next-step';
190
+ /** A model-facing text block (mirrors `@deepseek-ai/dsh-llm` `TextBlock`). */
191
+ interface AgentTextBlock {
192
+ type: 'text';
193
+ text: string;
194
+ }
195
+ /** The subset of the derived message history we read back (mirrors `Message`). */
196
+ interface AgentMessage {
197
+ readonly role: 'system' | 'user' | 'assistant';
198
+ readonly content: ReadonlyArray<{
199
+ type: string;
200
+ text?: string;
201
+ }>;
202
+ }
203
+ /** A user-role message accepted by `agent.send` (mirrors `UserMessage`). */
204
+ interface AgentUserMessage {
205
+ readonly id: string;
206
+ readonly role: 'user';
207
+ readonly content: AgentTextBlock[];
208
+ readonly source: {
209
+ kind: 'plugin';
210
+ plugin: string;
211
+ };
212
+ }
213
+ /** The slice of a live `Agent` we drive (mirrors `@deepseek-ai/dsh-agent` `Agent`). */
214
+ interface LiveAgent {
215
+ readonly session: {
216
+ deriveMessages(): AgentMessage[];
217
+ };
218
+ send(message: AgentUserMessage, target: InboxTarget, wakeup: boolean): void;
219
+ whenIdle(): Promise<void>;
220
+ cancel(cause: string): void;
221
+ }
222
+ /** Owned agent + capability disposer (mirrors `AgentHandle`). */
223
+ interface AgentHandle {
224
+ agent: LiveAgent;
225
+ dispose(): Promise<void>;
226
+ }
227
+ /**
228
+ * The slice of `ctx.agents` (mirrors `AgentRegistry`) this executor calls.
229
+ * `create()` mints a brand-new session on a caller-supplied id and REJECTS when
230
+ * no agent-loop factory is registered, or when a persisted log already owns the
231
+ * id. `resume()` loads a persisted session by id.
232
+ *
233
+ * `setup` mirrors `CreateAgentOptions.setup`: it runs inside the DSH agent
234
+ * factory's unpublished creation window. That is the ONLY supported place to
235
+ * join an agent preset (`agentPresets.mount()`), because the join must exist
236
+ * before `session/created`/`agent/created` — otherwise the agent publishes
237
+ * with an empty tool catalog (its tools, prompt sections, and skills resolve
238
+ * against the "empty global layer", which is exactly the failure this executor
239
+ * used to produce for every inbound task).
240
+ */
241
+ export interface AgentRegistryLike {
242
+ create(options: {
243
+ readonly sessionId: string;
244
+ readonly meta?: {
245
+ readonly cwd?: string;
246
+ readonly agentPreset?: string;
247
+ };
248
+ readonly agentOptions?: {
249
+ provider?: string;
250
+ model?: string;
251
+ maxTokens?: number;
252
+ };
253
+ readonly setup?: (agentCtx: unknown) => void | Promise<void>;
254
+ }): Promise<AgentHandle>;
255
+ resume(options: {
256
+ readonly resumeSessionId: string;
257
+ readonly agentOptions?: {
258
+ provider?: string;
259
+ model?: string;
260
+ maxTokens?: number;
261
+ };
262
+ readonly setup?: (agentCtx: unknown) => void | Promise<void>;
263
+ }): Promise<AgentHandle>;
264
+ }
265
+ /**
266
+ * Structural slice of `ctx.agentPresets` (owned by `@deepseek-ai/dsh-agent-presets`),
267
+ * the preset roster service. Mirrors exactly the two methods the DSH host's own
268
+ * session entry point (`dsh-host-apiproxy` `composeAgent`) uses to compose a
269
+ * fresh agent:
270
+ * - `resolve(id)` resolves the requested preset (or the deployment default
271
+ * when `undefined`) and returns `{ id }`;
272
+ * - `mount(agentCtx, id)` joins the agent's scope to the preset's standing
273
+ * composition — the ONLY supported call site is the agent factory's
274
+ * `setup` hook, where a failure rolls the whole creation back.
275
+ */
276
+ export interface AgentPresetsLike {
277
+ resolve(id?: string): Promise<{
278
+ id: string;
279
+ }>;
280
+ mount(agentCtx: unknown, id: string): Promise<unknown>;
281
+ }
282
+ /** The executor function returned by {@link createDshAgentExecutor}, plus teardown. */
283
+ interface DshAgentExecutor extends TaskExecutor {
284
+ /** Dispose every live per-context session this executor created. */
285
+ disposeAll(): Promise<void>;
286
+ }
287
+ /** Options for {@link createDshAgentExecutor}. */
288
+ export interface DshAgentExecutorOptions {
289
+ /**
290
+ * Absolute workspace path bound to each spawned session's durable header.
291
+ * DSH validates this is absolute and freezes it at creation, so it MUST be
292
+ * absolute — pass `process.cwd()` (the profile's workspace) at wire time.
293
+ */
294
+ cwd: string;
295
+ /** `source.plugin` tag stamped on inbound messages (defaults to `'a2a'`). */
296
+ plugin?: string;
297
+ /** Optional static per-agent model routing forwarded to `create()`. */
298
+ agentOptions?: {
299
+ provider?: string;
300
+ model?: string;
301
+ maxTokens?: number;
302
+ };
303
+ /**
304
+ * Optional resolver for the per-agent model selection, evaluated ONCE PER
305
+ * TASK just before `create()`. This is how a workspace-bound session gets a
306
+ * model: DSH's persona system-prompt section interpolates a `{{model}}`
307
+ * variable that is only filled when the agent has a selected model, and
308
+ * seeding that selection is the creating entry point's responsibility (the
309
+ * deployment default lives on `ctx.agentDefaultModel`, not on the agent).
310
+ * Resolving per task (rather than fixing it at wire time) means a later model
311
+ * switch in Settings is picked up by the next inbound task. Takes precedence
312
+ * over the static {@link agentOptions} when it returns a value.
313
+ */
314
+ resolveAgentOptions?: () => {
315
+ provider?: string;
316
+ model?: string;
317
+ maxTokens?: number;
318
+ } | undefined;
319
+ /**
320
+ * Called ONCE per A2A context, right after its session is first opened
321
+ * (create or resume) and its first prompt sent. Lets the composition name the
322
+ * session and group it (e.g. `ctx.sessionTitle.rename` + a workspace attach)
323
+ * without this module depending on those services. Failures are swallowed by
324
+ * the caller — naming/grouping is cosmetic and must never fail a task.
325
+ */
326
+ onSessionOpened?: (info: {
327
+ sessionId: string;
328
+ contextId: string;
329
+ session: LiveAgent['session'];
330
+ firstPrompt: string;
331
+ }) => void | Promise<void>;
332
+ /**
333
+ * The DSH agent-preset roster (`ctx.agentPresets`), probed by the caller via
334
+ * the reflection layer — see `probeAgentPresets` in `index.ts`. When present,
335
+ * every spawned session is composed from the deployment's default preset so
336
+ * it actually gets tools (shell, fs, skills …). Without a roster, sessions
337
+ * keep the legacy behavior: they run against the host composition only.
338
+ */
339
+ agentPresets?: AgentPresetsLike;
340
+ }
341
+ /**
342
+ * DSH agent executor: forward each inbound A2A task to this harness's own agent
343
+ * loop and return the assistant reply as the task artifact.
344
+ *
345
+ * ONE A2A CONTEXT ⇒ ONE SESSION. A2A already scopes a conversation by
346
+ * `contextId`, so this executor keeps one workspace-bound agent session per
347
+ * context: the first task for a context `create()`s it (session id derived from
348
+ * the context, `meta.cwd` from `opts.cwd`), and later tasks for the same
349
+ * context reuse the SAME live agent so history accumulates. Distinct contexts
350
+ * get distinct sessions. A fresh process that sees a known context first tries
351
+ * `resume()` (load persisted history), falling back to `create()`.
352
+ *
353
+ * Sessions are NOT disposed per task — a disposed session couldn't accumulate
354
+ * context. The returned executor exposes {@link DshAgentExecutor.disposeAll} so
355
+ * the plugin disposes every live per-context session on unload/teardown.
356
+ *
357
+ * Per-context work is serialized on a promise chain so concurrent tasks for the
358
+ * same context (and the shared `whenIdle()` — a whole-agent quiescence signal,
359
+ * not a per-message one) can't interleave. Different contexts run in parallel.
360
+ *
361
+ * Enable this via the plugin's `execute` precedence in `index.ts`; it is not
362
+ * `A2AServer`'s default (the default stays {@link notConfiguredExecutor}).
363
+ */
364
+ export declare function createDshAgentExecutor(agents: AgentRegistryLike, opts: DshAgentExecutorOptions): DshAgentExecutor;
365
+ export {};
142
366
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,SAAS,EAET,U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AAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/I;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AA+BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,uBAAuB,GAC5B,gBAAgB,CAsIlB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ryubyte/dsh-a2a",
3
3
  "description": "Agent2Agent (A2A) protocol v1.0 plugin for DeepSeek Harness (DSH): outbound client (remote AgentCard skills as ctx.tools), inbound server (A2A JSON-RPC + AgentCard endpoint), and a settings dashboard of live A2A connections",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",
package/src/a2a-config.ts CHANGED
@@ -47,6 +47,8 @@ export interface PersistedServerConfig {
47
47
  agentDescription?: string;
48
48
  agentVersion?: string;
49
49
  endpointPath?: string;
50
+ /** Optional shared bearer token protecting the inbound /a2a endpoint. */
51
+ authToken?: string;
50
52
  skills?: Array<{ id: string; name: string; description: string; tags?: string[]; examples?: string[] }>;
51
53
  }
52
54
 
@@ -83,6 +85,38 @@ export function profileNameFromArgv(): string | undefined {
83
85
  return undefined;
84
86
  }
85
87
 
88
+ /**
89
+ * Best-effort profile-name fallback for launchers that resolve a profile
90
+ * WITHOUT writing `--profile` back into argv.
91
+ *
92
+ * The dsh `web` subcommand is a hardcoded alias for `--profile web`: the
93
+ * launcher resolves the name internally and boots the web profile, but the
94
+ * process argv keeps the original tokens (`node …/dsh web [flags]`) — there
95
+ * is no `--profile` flag and no environment variable naming the profile. So
96
+ * when {@link profileNameFromArgv} finds nothing, check whether the first
97
+ * non-flag token after argv[0] is a known dsh subcommand alias:
98
+ *
99
+ * - `web` → boot profile `web` (alias, never followed by a name)
100
+ * - `--profile <n>` → already handled above
101
+ * - anything else → unknown/not a profile alias (e.g. `plugin`, which
102
+ * is a management mode, not a boot; returns undefined)
103
+ *
104
+ * Returns undefined when argv carries no recognizable alias, letting the
105
+ * caller fall through to the cwd-based resolution steps.
106
+ */
107
+ export function profileNameFromDshAlias(): string | undefined {
108
+ const argv = process.argv ?? [];
109
+ // Only the `dsh <subcommand>` alias form counts: when a `--profile` flag is
110
+ // present, the flag parser owns the name and this fallback must yield.
111
+ if (argv.includes('--profile') || argv.some((a) => a.startsWith('--profile='))) return undefined;
112
+ // `dsh web …` puts the subcommand at argv[2] (argv[0]=node, argv[1]=script).
113
+ // The dsh launcher rejects parent flags before a subcommand, so the alias
114
+ // must be the FIRST user token — a later `web` is an app argument, not a
115
+ // profile alias.
116
+ if (argv[2] === 'web') return 'web';
117
+ return undefined;
118
+ }
119
+
86
120
  /**
87
121
  * Resolve the a2a.json path for the current process, without depending on
88
122
  * the launch directory. The plugin must work no matter where `dsh` was
@@ -93,7 +127,9 @@ export function profileNameFromArgv(): string | undefined {
93
127
  *
94
128
  * Order:
95
129
  * 0. `$DSH_HOME/profiles/<argv --profile>/a2a.json` — the active profile
96
- * as named on the command line (most authoritative; works from ANY cwd)
130
+ * as named on the command line (most authoritative; works from ANY cwd).
131
+ * Also matches the `dsh web` alias, which boots profile `web` without
132
+ * writing `--profile` into argv.
97
133
  * 1. `cwd/a2a.json` — explicit when launched inside a profile dir
98
134
  * 2. outward from cwd: the nearest ancestor holding `a2a.json` — covers
99
135
  * launching from e.g. a repo checkout whose parent chain includes the
@@ -112,8 +148,10 @@ export function resolveConfigPath(): string {
112
148
  const home = process.env.DSH_HOME ?? join(homedir(), '.dsh');
113
149
  const base = cwd.split(/[\\/]/).pop() ?? '';
114
150
 
115
- // 0. Active profile from argv — authoritative regardless of cwd.
116
- const profileName = profileNameFromArgv();
151
+ // 0. Active profile from argv — authoritative regardless of cwd. Also
152
+ // handles the `dsh web` alias, which boots profile `web` without putting
153
+ // `--profile` in argv.
154
+ const profileName = profileNameFromArgv() ?? profileNameFromDshAlias();
117
155
  if (profileName && profileName !== '.' && profileName !== '..' && !profileName.includes('/') && !profileName.includes('\\')) {
118
156
  const argvFile = join(home, 'profiles', profileName, A2A_CONFIG_FILENAME);
119
157
  if (existsSync(argvFile)) return argvFile;
@@ -195,6 +233,7 @@ export function mergePersisted(base: A2APluginConfig, persisted: PersistedA2ACon
195
233
  if (pServer.agentDescription) merged.agentDescription = pServer.agentDescription;
196
234
  if (pServer.agentVersion) merged.agentVersion = pServer.agentVersion;
197
235
  if (pServer.endpointPath) merged.endpointPath = pServer.endpointPath;
236
+ if (pServer.authToken !== undefined) merged.authToken = pServer.authToken;
198
237
  if (pServer.skills) merged.skills = pServer.skills;
199
238
  }
200
239
  return merged;