@chatpanel/sdk 0.12.0 → 0.13.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/dist/api.generated.d.ts +95 -0
- package/dist/api.generated.js +31 -0
- package/dist/types.generated.d.ts +67 -0
- package/package.json +1 -1
package/dist/api.generated.d.ts
CHANGED
|
@@ -762,6 +762,56 @@ export declare const OPERATIONS: {
|
|
|
762
762
|
readonly pathParams: readonly [];
|
|
763
763
|
readonly queryParams: readonly ["workdir"];
|
|
764
764
|
};
|
|
765
|
+
readonly "a2a.card": {
|
|
766
|
+
readonly id: "a2a.card";
|
|
767
|
+
readonly method: "POST";
|
|
768
|
+
readonly path: "/a2a/card";
|
|
769
|
+
readonly auth: "token";
|
|
770
|
+
readonly since: "0.53.0";
|
|
771
|
+
readonly stream: null;
|
|
772
|
+
readonly pathParams: readonly [];
|
|
773
|
+
readonly queryParams: readonly [];
|
|
774
|
+
};
|
|
775
|
+
readonly "a2a.message": {
|
|
776
|
+
readonly id: "a2a.message";
|
|
777
|
+
readonly method: "POST";
|
|
778
|
+
readonly path: "/a2a/message";
|
|
779
|
+
readonly auth: "token";
|
|
780
|
+
readonly since: "0.53.0";
|
|
781
|
+
readonly stream: null;
|
|
782
|
+
readonly pathParams: readonly [];
|
|
783
|
+
readonly queryParams: readonly [];
|
|
784
|
+
};
|
|
785
|
+
readonly "a2a.stream": {
|
|
786
|
+
readonly id: "a2a.stream";
|
|
787
|
+
readonly method: "POST";
|
|
788
|
+
readonly path: "/a2a/message/stream";
|
|
789
|
+
readonly auth: "token";
|
|
790
|
+
readonly since: "0.53.0";
|
|
791
|
+
readonly stream: "sse";
|
|
792
|
+
readonly pathParams: readonly [];
|
|
793
|
+
readonly queryParams: readonly [];
|
|
794
|
+
};
|
|
795
|
+
readonly "a2a.task": {
|
|
796
|
+
readonly id: "a2a.task";
|
|
797
|
+
readonly method: "POST";
|
|
798
|
+
readonly path: "/a2a/task";
|
|
799
|
+
readonly auth: "token";
|
|
800
|
+
readonly since: "0.53.0";
|
|
801
|
+
readonly stream: null;
|
|
802
|
+
readonly pathParams: readonly [];
|
|
803
|
+
readonly queryParams: readonly [];
|
|
804
|
+
};
|
|
805
|
+
readonly "a2a.agents": {
|
|
806
|
+
readonly id: "a2a.agents";
|
|
807
|
+
readonly method: "GET";
|
|
808
|
+
readonly path: "/a2a/agents";
|
|
809
|
+
readonly auth: "token";
|
|
810
|
+
readonly since: "0.53.0";
|
|
811
|
+
readonly stream: null;
|
|
812
|
+
readonly pathParams: readonly [];
|
|
813
|
+
readonly queryParams: readonly [];
|
|
814
|
+
};
|
|
765
815
|
readonly "agents.listDefs": {
|
|
766
816
|
readonly id: "agents.listDefs";
|
|
767
817
|
readonly method: "GET";
|
|
@@ -1350,6 +1400,50 @@ export declare class SkillsApi {
|
|
|
1350
1400
|
skill: T.Skill | null;
|
|
1351
1401
|
}>;
|
|
1352
1402
|
}
|
|
1403
|
+
/** Remote agents reached over the Agent2Agent protocol — discovery, messages, tasks. */
|
|
1404
|
+
export declare class A2aApi {
|
|
1405
|
+
private readonly rt;
|
|
1406
|
+
constructor(rt: Runtime);
|
|
1407
|
+
/** Fetch a remote agent's card, revalidating the one already held. The gateway is the only component allowed to reach a remote agent: every outbound host goes through its SSRF guard, and a card names the endpoints this machine will then talk to. Cached per §8.6 — an ETag is revalidated with `If-None-Match`, so `fresh: false` means the peer answered 304 and the card is unchanged. Plain HTTP is refused for a remote host; loopback is not. — Requires the gateway token. Gateway 0.53.0+. */
|
|
1408
|
+
card(body: {
|
|
1409
|
+
/** The agent's origin, or a card URL outright. */
|
|
1410
|
+
url: string;
|
|
1411
|
+
/** Skip the TTL and revalidate — the ETag is still sent. */
|
|
1412
|
+
force?: boolean;
|
|
1413
|
+
/** Drop the cached card first. */
|
|
1414
|
+
forget?: boolean;
|
|
1415
|
+
/** An Authorization header value for agents that need one. */
|
|
1416
|
+
auth?: string;
|
|
1417
|
+
}, opts?: RequestOptions): Promise<{
|
|
1418
|
+
ok?: boolean;
|
|
1419
|
+
card?: T.AgentCard;
|
|
1420
|
+
/** Changes when the card's content does. */
|
|
1421
|
+
fingerprint?: string;
|
|
1422
|
+
/** false when the peer answered 304. */
|
|
1423
|
+
fresh?: boolean;
|
|
1424
|
+
changed?: boolean;
|
|
1425
|
+
url?: string;
|
|
1426
|
+
}>;
|
|
1427
|
+
/** Send a message to a remote agent and wait for the answer. The reply is a TASK or a MESSAGE — an agent that can answer at once returns a message and no task is ever created, so `kind` says which. `text` and `needs` are derived here rather than by each caller: `needs` is `answer` for an input stop and `approval` for an authorization one, and telling a caller to send a message when approval is wanted is how a task sits forever with both ends waiting. — Requires the gateway token. Gateway 0.53.0+. */
|
|
1428
|
+
message(body: T.A2ASendRequest, opts?: RequestOptions): Promise<T.A2AResult>;
|
|
1429
|
+
/** Send a message and stream the answer as it is produced. Server-sent events, one per protocol frame — `task`, `status`, `artifact`, `message`, then `done` with the final result (or `error`). Each event carries the task as it stands, so a chunked artifact arrives whole rather than as fragments the caller must reassemble. Requires the agent to advertise `capabilities.streaming`. — Requires the gateway token. Gateway 0.53.0+. */
|
|
1430
|
+
stream(body: T.A2ASendRequest, opts?: RequestOptions): AsyncIterable<SseFrame<unknown>>;
|
|
1431
|
+
/** Poll or cancel a task on a remote agent. — Requires the gateway token. Gateway 0.53.0+. */
|
|
1432
|
+
task(body: {
|
|
1433
|
+
id: string;
|
|
1434
|
+
url?: string;
|
|
1435
|
+
card?: T.AgentCard;
|
|
1436
|
+
/** Cancel instead of polling. */
|
|
1437
|
+
cancel?: boolean;
|
|
1438
|
+
auth?: string;
|
|
1439
|
+
}, opts?: RequestOptions): Promise<T.A2AResult>;
|
|
1440
|
+
/** Every remote agent this gateway has spoken to. What the audit lists — an agent a person connected is a host this machine talks to. — Requires the gateway token. Gateway 0.53.0+. */
|
|
1441
|
+
agents(opts?: RequestOptions): Promise<{
|
|
1442
|
+
agents: Array<{
|
|
1443
|
+
[key: string]: unknown;
|
|
1444
|
+
}>;
|
|
1445
|
+
}>;
|
|
1446
|
+
}
|
|
1353
1447
|
/** Several models as one — union, draft + target, fallback. */
|
|
1354
1448
|
export declare class FusionsApi {
|
|
1355
1449
|
private readonly rt;
|
|
@@ -1375,5 +1469,6 @@ export declare function buildApi(rt: Runtime): {
|
|
|
1375
1469
|
retrieval: RetrievalApi;
|
|
1376
1470
|
engines: EnginesApi;
|
|
1377
1471
|
skills: SkillsApi;
|
|
1472
|
+
a2a: A2aApi;
|
|
1378
1473
|
fusions: FusionsApi;
|
|
1379
1474
|
};
|
package/dist/api.generated.js
CHANGED
|
@@ -76,6 +76,11 @@ export const OPERATIONS = {
|
|
|
76
76
|
"engines.card": { id: "engines.card", method: "GET", path: "/v1/engines/{engineKey}/card", auth: "open", since: "0.6.89", stream: null, pathParams: ["engineKey"], queryParams: ["entries", "minCalls"] },
|
|
77
77
|
"engines.appendEntry": { id: "engines.appendEntry", method: "POST", path: "/v1/engines/{engineKey}/entries", auth: "open", since: "0.6.89", stream: null, pathParams: ["engineKey"], queryParams: [] },
|
|
78
78
|
"skills.quarantined": { id: "skills.quarantined", method: "GET", path: "/skills-quarantined", auth: "open", since: "0.48.0", stream: null, pathParams: [], queryParams: ["workdir"] },
|
|
79
|
+
"a2a.card": { id: "a2a.card", method: "POST", path: "/a2a/card", auth: "token", since: "0.53.0", stream: null, pathParams: [], queryParams: [] },
|
|
80
|
+
"a2a.message": { id: "a2a.message", method: "POST", path: "/a2a/message", auth: "token", since: "0.53.0", stream: null, pathParams: [], queryParams: [] },
|
|
81
|
+
"a2a.stream": { id: "a2a.stream", method: "POST", path: "/a2a/message/stream", auth: "token", since: "0.53.0", stream: "sse", pathParams: [], queryParams: [] },
|
|
82
|
+
"a2a.task": { id: "a2a.task", method: "POST", path: "/a2a/task", auth: "token", since: "0.53.0", stream: null, pathParams: [], queryParams: [] },
|
|
83
|
+
"a2a.agents": { id: "a2a.agents", method: "GET", path: "/a2a/agents", auth: "token", since: "0.53.0", stream: null, pathParams: [], queryParams: [] },
|
|
79
84
|
"agents.listDefs": { id: "agents.listDefs", method: "GET", path: "/agent-defs", auth: "open", since: "0.48.0", stream: null, pathParams: [], queryParams: ["workdir", "dir"] },
|
|
80
85
|
"agents.getDef": { id: "agents.getDef", method: "GET", path: "/agent-defs/{agentId}", auth: "open", since: "0.48.0", stream: null, pathParams: ["agentId"], queryParams: ["workdir"] },
|
|
81
86
|
"agents.exportPlan": { id: "agents.exportPlan", method: "POST", path: "/agent-defs/export-plan", auth: "token", since: "0.48.0", stream: null, pathParams: [], queryParams: [] },
|
|
@@ -496,6 +501,31 @@ export class SkillsApi {
|
|
|
496
501
|
return this.rt.request(OPERATIONS["skills.get"], { path: { skillId }, query: query, headers: opts?.headers, body: undefined, opts });
|
|
497
502
|
}
|
|
498
503
|
}
|
|
504
|
+
/** Remote agents reached over the Agent2Agent protocol — discovery, messages, tasks. */
|
|
505
|
+
export class A2aApi {
|
|
506
|
+
rt;
|
|
507
|
+
constructor(rt) { this.rt = rt; }
|
|
508
|
+
/** Fetch a remote agent's card, revalidating the one already held. The gateway is the only component allowed to reach a remote agent: every outbound host goes through its SSRF guard, and a card names the endpoints this machine will then talk to. Cached per §8.6 — an ETag is revalidated with `If-None-Match`, so `fresh: false` means the peer answered 304 and the card is unchanged. Plain HTTP is refused for a remote host; loopback is not. — Requires the gateway token. Gateway 0.53.0+. */
|
|
509
|
+
card(body, opts) {
|
|
510
|
+
return this.rt.request(OPERATIONS["a2a.card"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
511
|
+
}
|
|
512
|
+
/** Send a message to a remote agent and wait for the answer. The reply is a TASK or a MESSAGE — an agent that can answer at once returns a message and no task is ever created, so `kind` says which. `text` and `needs` are derived here rather than by each caller: `needs` is `answer` for an input stop and `approval` for an authorization one, and telling a caller to send a message when approval is wanted is how a task sits forever with both ends waiting. — Requires the gateway token. Gateway 0.53.0+. */
|
|
513
|
+
message(body, opts) {
|
|
514
|
+
return this.rt.request(OPERATIONS["a2a.message"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
515
|
+
}
|
|
516
|
+
/** Send a message and stream the answer as it is produced. Server-sent events, one per protocol frame — `task`, `status`, `artifact`, `message`, then `done` with the final result (or `error`). Each event carries the task as it stands, so a chunked artifact arrives whole rather than as fragments the caller must reassemble. Requires the agent to advertise `capabilities.streaming`. — Requires the gateway token. Gateway 0.53.0+. */
|
|
517
|
+
stream(body, opts) {
|
|
518
|
+
return this.rt.stream(OPERATIONS["a2a.stream"], { path: {}, query: undefined, headers: opts?.headers, opts });
|
|
519
|
+
}
|
|
520
|
+
/** Poll or cancel a task on a remote agent. — Requires the gateway token. Gateway 0.53.0+. */
|
|
521
|
+
task(body, opts) {
|
|
522
|
+
return this.rt.request(OPERATIONS["a2a.task"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
523
|
+
}
|
|
524
|
+
/** Every remote agent this gateway has spoken to. What the audit lists — an agent a person connected is a host this machine talks to. — Requires the gateway token. Gateway 0.53.0+. */
|
|
525
|
+
agents(opts) {
|
|
526
|
+
return this.rt.request(OPERATIONS["a2a.agents"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
527
|
+
}
|
|
528
|
+
}
|
|
499
529
|
/** Several models as one — union, draft + target, fallback. */
|
|
500
530
|
export class FusionsApi {
|
|
501
531
|
rt;
|
|
@@ -524,6 +554,7 @@ export function buildApi(rt) {
|
|
|
524
554
|
retrieval: new RetrievalApi(rt),
|
|
525
555
|
engines: new EnginesApi(rt),
|
|
526
556
|
skills: new SkillsApi(rt),
|
|
557
|
+
a2a: new A2aApi(rt),
|
|
527
558
|
fusions: new FusionsApi(rt),
|
|
528
559
|
};
|
|
529
560
|
}
|
|
@@ -787,6 +787,73 @@ export interface QuarantinedSkill {
|
|
|
787
787
|
verdict?: "suspicious" | "dangerous";
|
|
788
788
|
[key: string]: unknown;
|
|
789
789
|
}
|
|
790
|
+
/** An A2A Agent Card (protocol 1.0). Unknown fields are preserved, so a card from a later spec round-trips. */
|
|
791
|
+
export interface AgentCard {
|
|
792
|
+
name: string;
|
|
793
|
+
description: string;
|
|
794
|
+
version: string;
|
|
795
|
+
supportedInterfaces?: Array<{
|
|
796
|
+
url?: string;
|
|
797
|
+
/** JSONRPC, GRPC, HTTP+JSON — an open string, so an unknown binding is carried. */
|
|
798
|
+
protocolBinding?: string;
|
|
799
|
+
protocolVersion?: string;
|
|
800
|
+
/** Echoed on every request to this interface when set. */
|
|
801
|
+
tenant?: string;
|
|
802
|
+
}>;
|
|
803
|
+
provider?: {
|
|
804
|
+
organization?: string;
|
|
805
|
+
url?: string;
|
|
806
|
+
};
|
|
807
|
+
capabilities?: {
|
|
808
|
+
streaming?: boolean;
|
|
809
|
+
pushNotifications?: boolean;
|
|
810
|
+
extendedAgentCard?: boolean;
|
|
811
|
+
[key: string]: unknown;
|
|
812
|
+
};
|
|
813
|
+
defaultInputModes?: Array<string>;
|
|
814
|
+
defaultOutputModes?: Array<string>;
|
|
815
|
+
skills?: Array<{
|
|
816
|
+
[key: string]: unknown;
|
|
817
|
+
}>;
|
|
818
|
+
iconUrl?: string;
|
|
819
|
+
documentationUrl?: string;
|
|
820
|
+
[key: string]: unknown;
|
|
821
|
+
}
|
|
822
|
+
/** Either `url` or `card` identifies the agent; either `text` or `message` is what to say. */
|
|
823
|
+
export interface A2ASendRequest {
|
|
824
|
+
url?: string;
|
|
825
|
+
card?: AgentCard;
|
|
826
|
+
/** Shorthand for a one-part text message. */
|
|
827
|
+
text?: string;
|
|
828
|
+
/** A full A2A Message. */
|
|
829
|
+
message?: {
|
|
830
|
+
[key: string]: unknown;
|
|
831
|
+
};
|
|
832
|
+
/** Groups related interactions. */
|
|
833
|
+
contextId?: string;
|
|
834
|
+
/** Continues an existing task — how an input or auth stop is answered. */
|
|
835
|
+
taskId?: string;
|
|
836
|
+
/** Do not wait for a terminal or interrupted state. */
|
|
837
|
+
returnImmediately?: boolean;
|
|
838
|
+
auth?: string;
|
|
839
|
+
}
|
|
840
|
+
/** The reply, plus the two facts every caller derives — done, and what a person must do. */
|
|
841
|
+
export interface A2AResult {
|
|
842
|
+
ok?: boolean;
|
|
843
|
+
/** A2A returns one or the other; an agent answering at once creates no task. */
|
|
844
|
+
kind?: "task" | "message";
|
|
845
|
+
task?: {
|
|
846
|
+
[key: string]: unknown;
|
|
847
|
+
};
|
|
848
|
+
message?: {
|
|
849
|
+
[key: string]: unknown;
|
|
850
|
+
};
|
|
851
|
+
/** The answer as text — artifacts first, then what the agent actually said. */
|
|
852
|
+
text?: string;
|
|
853
|
+
done?: boolean;
|
|
854
|
+
/** `answer` for TASK_STATE_INPUT_REQUIRED, `approval` for TASK_STATE_AUTH_REQUIRED, null otherwise. */
|
|
855
|
+
needs?: "answer" | "approval";
|
|
856
|
+
}
|
|
790
857
|
/** An agent definition, read from whichever tool's dialect wrote it. */
|
|
791
858
|
export interface AgentDef {
|
|
792
859
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Typed client for the local ChatPanel gateway — chat through the privacy proxy, search the user's history, read and write memory, follow team runs. Zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|