@amaster.ai/dsh-a2a 0.1.37 → 0.1.39

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.
@@ -79,6 +79,7 @@ export declare class A2aBridge {
79
79
  private readonly executing;
80
80
  private readonly asked;
81
81
  private readonly approvals;
82
+ private readonly preparing;
82
83
  private readonly codec;
83
84
  private readonly delegation;
84
85
  private readonly children;
@@ -96,8 +97,8 @@ export declare class A2aBridge {
96
97
  }>;
97
98
  private ensureTaskInner;
98
99
  private createAgent;
99
- /** A2A parts → dsh content blocks; throws only when no part is usable. */
100
- buildContent(message: Message, contextId: string): Promise<ContentBlock[]>;
100
+ /** A2A parts → dsh content blocks; rejects unusable messages and cancellation. */
101
+ buildContent(message: Message, contextId: string, signal?: AbortSignal, taskId?: string): Promise<ContentBlock[]>;
101
102
  isClearing(contextId: string): boolean;
102
103
  /** Called before the SDK starts an executor, so a bad reply cannot fail the live task. */
103
104
  validateApprovalMessage(message: Message): boolean;
@@ -26,6 +26,7 @@ export interface A2aFileMaterializer {
26
26
  bytes: Uint8Array;
27
27
  filename: string;
28
28
  mediaType: string;
29
+ signal?: AbortSignal;
29
30
  }): Promise<{
30
31
  readablePath: string;
31
32
  }>;
@@ -40,7 +41,7 @@ export interface UrlDownloadOptions {
40
41
  /** Private/loopback hosts are refused unless explicitly named here. */
41
42
  allowedHosts?: readonly string[];
42
43
  }
43
- export declare function buildMessageContent(parts: readonly Part[], attachments: AttachmentStore | undefined, dir: string, materialization?: Materialization, downloads?: UrlDownloadOptions): Promise<ContentBlock[]>;
44
+ export declare function buildMessageContent(parts: readonly Part[], attachments: AttachmentStore | undefined, dir: string, materialization?: Materialization, downloads?: UrlDownloadOptions, signal?: AbortSignal): Promise<ContentBlock[]>;
44
45
  /** The directory non-image file parts persist into without a materializer. */
45
46
  export declare function uploadsDir(root?: string): string;
46
47
  export {};
@@ -56,14 +56,16 @@ declare module '@deepseek-ai/cordis' {
56
56
  }
57
57
  /** Same-process queue control; wire messages and task subscriptions remain standard A2A. */
58
58
  export interface A2aInbox {
59
+ /** Scoped, conservative candidates; discovery never resolves or wakes an agent. */
60
+ recoveryCandidates(context?: ServerCallContext): Promise<string[]>;
59
61
  get(contextId: string, page?: InboxPageOptions): Promise<InboxSnapshot>;
60
62
  update(contextId: string, id: string, message: Message, page?: InboxPageOptions): Promise<InboxSnapshot>;
61
63
  move(contextId: string, id: string, index: number, page?: InboxPageOptions): Promise<InboxSnapshot>;
62
64
  remove(contextId: string, id: string, page?: InboxPageOptions): Promise<InboxSnapshot>;
63
65
  clearPending(contextId: string, page?: InboxPageOptions): Promise<InboxSnapshot>;
64
66
  executePending(contextId: string, id?: string, page?: InboxPageOptions): Promise<InboxSnapshot>;
65
- resolve(contextId: string): Promise<Agent>;
66
- content(message: Message, contextId: string): Promise<ContentBlock[]>;
67
+ resolve(contextId: string, context?: ServerCallContext): Promise<Agent>;
68
+ content(message: Message, contextId: string, signal?: AbortSignal): Promise<ContentBlock[]>;
67
69
  /** Admit a same-process host follow-up under an existing task's durable identity. */
68
70
  enqueue(taskId: string, message: Message, options?: {
69
71
  target?: InboxTarget;
@@ -116,8 +118,9 @@ export declare class NativeInbox implements A2aInbox {
116
118
  private readonly persistence?;
117
119
  constructor(ctx: Context, bridge: A2aBridge, store: ManagedTaskStore, retainPending?: boolean, notifications?: boolean);
118
120
  private unloading;
119
- content(message: Message, contextId: string): Promise<ContentBlock[]>;
120
- resolve(contextId: string): Promise<Agent>;
121
+ content(message: Message, contextId: string, signal?: AbortSignal): Promise<ContentBlock[]>;
122
+ resolve(contextId: string, context?: ServerCallContext): Promise<Agent>;
123
+ recoveryCandidates(context?: ServerCallContext): Promise<string[]>;
121
124
  get(contextId: string, page?: InboxPageOptions): Promise<InboxSnapshot>;
122
125
  private editQueue;
123
126
  private queued;
@@ -152,9 +155,9 @@ export declare class NativeInbox implements A2aInbox {
152
155
  /** Reattach a cold task before the SDK decides whether cancellation has a live executor. */
153
156
  beforeTask(taskId: string, context: ServerCallContext): Promise<void>;
154
157
  private outcome;
155
- private terminal;
156
158
  private admit;
157
159
  execute(request: RequestContext, bus: ExecutionEventBus): Promise<void>;
160
+ private committedInputs;
158
161
  private restoreTask;
159
162
  private select;
160
163
  private protocolMessage;
@@ -11,5 +11,7 @@ export declare class FilesystemTaskStore implements ManagedTaskStore {
11
11
  save(task: Task, context: ServerCallContext): Promise<void>;
12
12
  load(id: string, context: ServerCallContext): Promise<Task | undefined>;
13
13
  delete(id: string, context: ServerCallContext): Promise<void>;
14
+ private shells;
15
+ recoveryCandidates(context: ServerCallContext): Promise<string[]>;
14
16
  list(params: ListTasksRequest, context: ServerCallContext): Promise<ListTasksResponse>;
15
17
  }
@@ -29,6 +29,8 @@ export declare class GcsTaskStore implements ManagedTaskStore {
29
29
  save(task: Task, context: ServerCallContext): Promise<void>;
30
30
  load(taskId: string, context: ServerCallContext): Promise<Task | undefined>;
31
31
  delete(taskId: string, context: ServerCallContext): Promise<void>;
32
+ private shells;
33
+ recoveryCandidates(context: ServerCallContext): Promise<string[]>;
32
34
  list(params: ListTasksRequest, context: ServerCallContext): Promise<ListTasksResponse>;
33
35
  /**
34
36
  * Tar + gzip the workspace directory to `tasks/{scope}/{taskId}/workspace.tar.gz`.
@@ -0,0 +1,10 @@
1
+ import type { ListTasksRequest, ListTasksResponse, Task } from '@a2a-js/sdk';
2
+ export declare const LIST_PREFIX_BYTES = 8192;
3
+ /** Only the fields needed by listShells; never retain history or status-message content. */
4
+ export declare function taskListShell(task: Task): Task;
5
+ export declare function parseListShell(value: unknown): Task | undefined;
6
+ /** A JSON-compatible header shares the snapshot's atomic write, including on older readers. */
7
+ export declare function serializeTaskSnapshot(task: Task, json?: unknown): string;
8
+ export declare function snapshotListShell(prefix: string): Task | undefined;
9
+ /** Hydrate only the selected page, with bounded I/O and the existing artifact semantics. */
10
+ export declare function loadTaskPage(shells: Task[], params: ListTasksRequest, load: (ids: string[]) => Promise<Array<Task | undefined>>): Promise<ListTasksResponse>;
@@ -25,6 +25,8 @@ export declare class RedisTaskStore implements ManagedTaskStore {
25
25
  save(task: Task, context: ServerCallContext): Promise<void>;
26
26
  load(taskId: string, context: ServerCallContext): Promise<Task | undefined>;
27
27
  delete(taskId: string, context: ServerCallContext): Promise<void>;
28
+ private shells;
29
+ recoveryCandidates(context: ServerCallContext): Promise<string[]>;
28
30
  list(params: ListTasksRequest, context: ServerCallContext): Promise<ListTasksResponse>;
29
31
  close(): Promise<void>;
30
32
  }
@@ -24,12 +24,18 @@ export declare function commitInboxInput(history: Message[], message: Message):
24
24
  export declare function sanitizeTask(task: Task): Task;
25
25
  /** TaskStore with the optional lifecycle our backends add. */
26
26
  export interface ManagedTaskStore extends TaskStore {
27
+ /** Conservative discovery only; does not establish that input is safe to execute. */
28
+ recoveryCandidates?(context: ServerCallContext): Promise<string[]>;
27
29
  /** Durable admission checkpoint even when task state has not changed. */
28
30
  checkpoint?(task: Task, context: ServerCallContext): Promise<void>;
29
31
  init?(): Promise<void>;
30
32
  delete(taskId: string, context: ServerCallContext): Promise<void>;
31
33
  close?(): Promise<void>;
32
34
  }
35
+ export declare function isTerminalTask(task: Task): boolean;
36
+ export declare function recoveryContextIds(tasks: Task[]): string[];
37
+ /** Custom stores retain a complete, if more expensive, discovery path. */
38
+ export declare function findRecoveryCandidates(store: ManagedTaskStore, context: ServerCallContext): Promise<string[]>;
33
39
  /** A safe path/key segment for the SDK's tenant and owner scope. */
34
40
  export declare function taskScopeKey(context: ServerCallContext): string;
35
41
  /** The SDK memory store has no delete operation; keep the same shell contract. */
@@ -39,6 +45,7 @@ export declare class MemoryTaskStore implements ManagedTaskStore {
39
45
  save(task: Task, context: ServerCallContext): Promise<void>;
40
46
  load(taskId: string, context: ServerCallContext): Promise<Task | undefined>;
41
47
  list(params: ListTasksRequest, context: ServerCallContext): Promise<ListTasksResponse>;
48
+ recoveryCandidates(context: ServerCallContext): Promise<string[]>;
42
49
  delete(taskId: string, context: ServerCallContext): Promise<void>;
43
50
  }
44
51
  /** Saves task snapshots on state transitions while keeping active deltas in process. */
@@ -59,6 +66,7 @@ export declare class SanitizedTaskStore implements ManagedTaskStore {
59
66
  save(task: Task, context: ServerCallContext, checkpoint?: boolean): Promise<void>;
60
67
  load(taskId: string, context: ServerCallContext): Promise<Task | undefined>;
61
68
  list(params: ListTasksRequest, context: ServerCallContext): Promise<ListTasksResponse>;
69
+ recoveryCandidates(context: ServerCallContext): Promise<string[]>;
62
70
  }
63
71
  /**
64
72
  * Shared `listTasks` semantics for the backends: filter by contextId / status /
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/dsh-a2a",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "A2A protocol (JSON-RPC + SSE) server plugin for DeepSeek Harness: expose dsh agents as A2A agents.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",