@chatpanel/sdk 0.12.0 → 0.14.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 +107 -0
- package/dist/api.generated.js +36 -0
- package/dist/types.generated.d.ts +76 -0
- package/package.json +1 -1
package/dist/api.generated.d.ts
CHANGED
|
@@ -342,6 +342,16 @@ export declare const OPERATIONS: {
|
|
|
342
342
|
readonly pathParams: readonly [];
|
|
343
343
|
readonly queryParams: readonly [];
|
|
344
344
|
};
|
|
345
|
+
readonly "teams.stream": {
|
|
346
|
+
readonly id: "teams.stream";
|
|
347
|
+
readonly method: "GET";
|
|
348
|
+
readonly path: "/v1/teams/stream";
|
|
349
|
+
readonly auth: "token";
|
|
350
|
+
readonly since: "0.55.0";
|
|
351
|
+
readonly stream: "sse";
|
|
352
|
+
readonly pathParams: readonly [];
|
|
353
|
+
readonly queryParams: readonly [];
|
|
354
|
+
};
|
|
345
355
|
readonly "teams.getRun": {
|
|
346
356
|
readonly id: "teams.getRun";
|
|
347
357
|
readonly method: "GET";
|
|
@@ -762,6 +772,56 @@ export declare const OPERATIONS: {
|
|
|
762
772
|
readonly pathParams: readonly [];
|
|
763
773
|
readonly queryParams: readonly ["workdir"];
|
|
764
774
|
};
|
|
775
|
+
readonly "a2a.card": {
|
|
776
|
+
readonly id: "a2a.card";
|
|
777
|
+
readonly method: "POST";
|
|
778
|
+
readonly path: "/a2a/card";
|
|
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.message": {
|
|
786
|
+
readonly id: "a2a.message";
|
|
787
|
+
readonly method: "POST";
|
|
788
|
+
readonly path: "/a2a/message";
|
|
789
|
+
readonly auth: "token";
|
|
790
|
+
readonly since: "0.53.0";
|
|
791
|
+
readonly stream: null;
|
|
792
|
+
readonly pathParams: readonly [];
|
|
793
|
+
readonly queryParams: readonly [];
|
|
794
|
+
};
|
|
795
|
+
readonly "a2a.stream": {
|
|
796
|
+
readonly id: "a2a.stream";
|
|
797
|
+
readonly method: "POST";
|
|
798
|
+
readonly path: "/a2a/message/stream";
|
|
799
|
+
readonly auth: "token";
|
|
800
|
+
readonly since: "0.53.0";
|
|
801
|
+
readonly stream: "sse";
|
|
802
|
+
readonly pathParams: readonly [];
|
|
803
|
+
readonly queryParams: readonly [];
|
|
804
|
+
};
|
|
805
|
+
readonly "a2a.task": {
|
|
806
|
+
readonly id: "a2a.task";
|
|
807
|
+
readonly method: "POST";
|
|
808
|
+
readonly path: "/a2a/task";
|
|
809
|
+
readonly auth: "token";
|
|
810
|
+
readonly since: "0.53.0";
|
|
811
|
+
readonly stream: null;
|
|
812
|
+
readonly pathParams: readonly [];
|
|
813
|
+
readonly queryParams: readonly [];
|
|
814
|
+
};
|
|
815
|
+
readonly "a2a.agents": {
|
|
816
|
+
readonly id: "a2a.agents";
|
|
817
|
+
readonly method: "GET";
|
|
818
|
+
readonly path: "/a2a/agents";
|
|
819
|
+
readonly auth: "token";
|
|
820
|
+
readonly since: "0.53.0";
|
|
821
|
+
readonly stream: null;
|
|
822
|
+
readonly pathParams: readonly [];
|
|
823
|
+
readonly queryParams: readonly [];
|
|
824
|
+
};
|
|
765
825
|
readonly "agents.listDefs": {
|
|
766
826
|
readonly id: "agents.listDefs";
|
|
767
827
|
readonly method: "GET";
|
|
@@ -1020,6 +1080,8 @@ export declare class TeamsApi {
|
|
|
1020
1080
|
ok: boolean;
|
|
1021
1081
|
run: T.TeamRun;
|
|
1022
1082
|
}>;
|
|
1083
|
+
/** Run changes, pushed — `hello` once, then a `run` notice whenever a run is created, moves or is removed. A Runs or Board view listens here and re-reads a run (`GET /v1/teams/runs/{runId}`) or the list only when a notice names one, instead of polling. Facts only — a task's streamed text never produces a notice. Staleness is judged by the clock, not by an event, so a view keeps a slow re-read beside the stream. — Requires the gateway token. Gateway 0.55.0+. */
|
|
1084
|
+
stream(opts?: RequestOptions): AsyncIterable<SseFrame<T.TeamsStreamEvent>>;
|
|
1023
1085
|
/** One run, optionally with its events. — Gateway 0.6.78+. */
|
|
1024
1086
|
getRun(runId: string, query?: {
|
|
1025
1087
|
events?: boolean;
|
|
@@ -1350,6 +1412,50 @@ export declare class SkillsApi {
|
|
|
1350
1412
|
skill: T.Skill | null;
|
|
1351
1413
|
}>;
|
|
1352
1414
|
}
|
|
1415
|
+
/** Remote agents reached over the Agent2Agent protocol — discovery, messages, tasks. */
|
|
1416
|
+
export declare class A2aApi {
|
|
1417
|
+
private readonly rt;
|
|
1418
|
+
constructor(rt: Runtime);
|
|
1419
|
+
/** 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+. */
|
|
1420
|
+
card(body: {
|
|
1421
|
+
/** The agent's origin, or a card URL outright. */
|
|
1422
|
+
url: string;
|
|
1423
|
+
/** Skip the TTL and revalidate — the ETag is still sent. */
|
|
1424
|
+
force?: boolean;
|
|
1425
|
+
/** Drop the cached card first. */
|
|
1426
|
+
forget?: boolean;
|
|
1427
|
+
/** An Authorization header value for agents that need one. */
|
|
1428
|
+
auth?: string;
|
|
1429
|
+
}, opts?: RequestOptions): Promise<{
|
|
1430
|
+
ok?: boolean;
|
|
1431
|
+
card?: T.AgentCard;
|
|
1432
|
+
/** Changes when the card's content does. */
|
|
1433
|
+
fingerprint?: string;
|
|
1434
|
+
/** false when the peer answered 304. */
|
|
1435
|
+
fresh?: boolean;
|
|
1436
|
+
changed?: boolean;
|
|
1437
|
+
url?: string;
|
|
1438
|
+
}>;
|
|
1439
|
+
/** 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+. */
|
|
1440
|
+
message(body: T.A2ASendRequest, opts?: RequestOptions): Promise<T.A2AResult>;
|
|
1441
|
+
/** 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+. */
|
|
1442
|
+
stream(body: T.A2ASendRequest, opts?: RequestOptions): AsyncIterable<SseFrame<unknown>>;
|
|
1443
|
+
/** Poll or cancel a task on a remote agent. — Requires the gateway token. Gateway 0.53.0+. */
|
|
1444
|
+
task(body: {
|
|
1445
|
+
id: string;
|
|
1446
|
+
url?: string;
|
|
1447
|
+
card?: T.AgentCard;
|
|
1448
|
+
/** Cancel instead of polling. */
|
|
1449
|
+
cancel?: boolean;
|
|
1450
|
+
auth?: string;
|
|
1451
|
+
}, opts?: RequestOptions): Promise<T.A2AResult>;
|
|
1452
|
+
/** 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+. */
|
|
1453
|
+
agents(opts?: RequestOptions): Promise<{
|
|
1454
|
+
agents: Array<{
|
|
1455
|
+
[key: string]: unknown;
|
|
1456
|
+
}>;
|
|
1457
|
+
}>;
|
|
1458
|
+
}
|
|
1353
1459
|
/** Several models as one — union, draft + target, fallback. */
|
|
1354
1460
|
export declare class FusionsApi {
|
|
1355
1461
|
private readonly rt;
|
|
@@ -1375,5 +1481,6 @@ export declare function buildApi(rt: Runtime): {
|
|
|
1375
1481
|
retrieval: RetrievalApi;
|
|
1376
1482
|
engines: EnginesApi;
|
|
1377
1483
|
skills: SkillsApi;
|
|
1484
|
+
a2a: A2aApi;
|
|
1378
1485
|
fusions: FusionsApi;
|
|
1379
1486
|
};
|
package/dist/api.generated.js
CHANGED
|
@@ -34,6 +34,7 @@ export const OPERATIONS = {
|
|
|
34
34
|
"prefs.events": { id: "prefs.events", method: "GET", path: "/v1/prefs/events", auth: "open", since: "0.6.77", stream: "sse", pathParams: [], queryParams: [] },
|
|
35
35
|
"teams.listRuns": { id: "teams.listRuns", method: "GET", path: "/v1/teams/runs", auth: "open", since: "0.6.78", stream: null, pathParams: [], queryParams: ["limit", "team"] },
|
|
36
36
|
"teams.createRun": { id: "teams.createRun", method: "POST", path: "/v1/teams/runs", auth: "open", since: "0.6.78", stream: null, pathParams: [], queryParams: [] },
|
|
37
|
+
"teams.stream": { id: "teams.stream", method: "GET", path: "/v1/teams/stream", auth: "token", since: "0.55.0", stream: "sse", pathParams: [], queryParams: [] },
|
|
37
38
|
"teams.getRun": { id: "teams.getRun", method: "GET", path: "/v1/teams/runs/{runId}", auth: "open", since: "0.6.78", stream: null, pathParams: ["runId"], queryParams: ["events"] },
|
|
38
39
|
"teams.deleteRun": { id: "teams.deleteRun", method: "DELETE", path: "/v1/teams/runs/{runId}", auth: "open", since: "0.6.110", stream: null, pathParams: ["runId"], queryParams: [] },
|
|
39
40
|
"teams.runEvents": { id: "teams.runEvents", method: "GET", path: "/v1/teams/runs/{runId}/events", auth: "open", since: "0.6.78", stream: "sse", pathParams: ["runId"], queryParams: ["after"] },
|
|
@@ -76,6 +77,11 @@ export const OPERATIONS = {
|
|
|
76
77
|
"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
78
|
"engines.appendEntry": { id: "engines.appendEntry", method: "POST", path: "/v1/engines/{engineKey}/entries", auth: "open", since: "0.6.89", stream: null, pathParams: ["engineKey"], queryParams: [] },
|
|
78
79
|
"skills.quarantined": { id: "skills.quarantined", method: "GET", path: "/skills-quarantined", auth: "open", since: "0.48.0", stream: null, pathParams: [], queryParams: ["workdir"] },
|
|
80
|
+
"a2a.card": { id: "a2a.card", method: "POST", path: "/a2a/card", auth: "token", since: "0.53.0", stream: null, pathParams: [], queryParams: [] },
|
|
81
|
+
"a2a.message": { id: "a2a.message", method: "POST", path: "/a2a/message", auth: "token", since: "0.53.0", stream: null, pathParams: [], queryParams: [] },
|
|
82
|
+
"a2a.stream": { id: "a2a.stream", method: "POST", path: "/a2a/message/stream", auth: "token", since: "0.53.0", stream: "sse", pathParams: [], queryParams: [] },
|
|
83
|
+
"a2a.task": { id: "a2a.task", method: "POST", path: "/a2a/task", auth: "token", since: "0.53.0", stream: null, pathParams: [], queryParams: [] },
|
|
84
|
+
"a2a.agents": { id: "a2a.agents", method: "GET", path: "/a2a/agents", auth: "token", since: "0.53.0", stream: null, pathParams: [], queryParams: [] },
|
|
79
85
|
"agents.listDefs": { id: "agents.listDefs", method: "GET", path: "/agent-defs", auth: "open", since: "0.48.0", stream: null, pathParams: [], queryParams: ["workdir", "dir"] },
|
|
80
86
|
"agents.getDef": { id: "agents.getDef", method: "GET", path: "/agent-defs/{agentId}", auth: "open", since: "0.48.0", stream: null, pathParams: ["agentId"], queryParams: ["workdir"] },
|
|
81
87
|
"agents.exportPlan": { id: "agents.exportPlan", method: "POST", path: "/agent-defs/export-plan", auth: "token", since: "0.48.0", stream: null, pathParams: [], queryParams: [] },
|
|
@@ -268,6 +274,10 @@ export class TeamsApi {
|
|
|
268
274
|
createRun(body, opts) {
|
|
269
275
|
return this.rt.request(OPERATIONS["teams.createRun"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
270
276
|
}
|
|
277
|
+
/** Run changes, pushed — `hello` once, then a `run` notice whenever a run is created, moves or is removed. A Runs or Board view listens here and re-reads a run (`GET /v1/teams/runs/{runId}`) or the list only when a notice names one, instead of polling. Facts only — a task's streamed text never produces a notice. Staleness is judged by the clock, not by an event, so a view keeps a slow re-read beside the stream. — Requires the gateway token. Gateway 0.55.0+. */
|
|
278
|
+
stream(opts) {
|
|
279
|
+
return this.rt.stream(OPERATIONS["teams.stream"], { path: {}, query: undefined, headers: opts?.headers, opts });
|
|
280
|
+
}
|
|
271
281
|
/** One run, optionally with its events. — Gateway 0.6.78+. */
|
|
272
282
|
getRun(runId, query, opts) {
|
|
273
283
|
return this.rt.request(OPERATIONS["teams.getRun"], { path: { runId }, query: query, headers: opts?.headers, body: undefined, opts });
|
|
@@ -496,6 +506,31 @@ export class SkillsApi {
|
|
|
496
506
|
return this.rt.request(OPERATIONS["skills.get"], { path: { skillId }, query: query, headers: opts?.headers, body: undefined, opts });
|
|
497
507
|
}
|
|
498
508
|
}
|
|
509
|
+
/** Remote agents reached over the Agent2Agent protocol — discovery, messages, tasks. */
|
|
510
|
+
export class A2aApi {
|
|
511
|
+
rt;
|
|
512
|
+
constructor(rt) { this.rt = rt; }
|
|
513
|
+
/** 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+. */
|
|
514
|
+
card(body, opts) {
|
|
515
|
+
return this.rt.request(OPERATIONS["a2a.card"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
516
|
+
}
|
|
517
|
+
/** 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+. */
|
|
518
|
+
message(body, opts) {
|
|
519
|
+
return this.rt.request(OPERATIONS["a2a.message"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
520
|
+
}
|
|
521
|
+
/** 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+. */
|
|
522
|
+
stream(body, opts) {
|
|
523
|
+
return this.rt.stream(OPERATIONS["a2a.stream"], { path: {}, query: undefined, headers: opts?.headers, opts });
|
|
524
|
+
}
|
|
525
|
+
/** Poll or cancel a task on a remote agent. — Requires the gateway token. Gateway 0.53.0+. */
|
|
526
|
+
task(body, opts) {
|
|
527
|
+
return this.rt.request(OPERATIONS["a2a.task"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
528
|
+
}
|
|
529
|
+
/** 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+. */
|
|
530
|
+
agents(opts) {
|
|
531
|
+
return this.rt.request(OPERATIONS["a2a.agents"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
532
|
+
}
|
|
533
|
+
}
|
|
499
534
|
/** Several models as one — union, draft + target, fallback. */
|
|
500
535
|
export class FusionsApi {
|
|
501
536
|
rt;
|
|
@@ -524,6 +559,7 @@ export function buildApi(rt) {
|
|
|
524
559
|
retrieval: new RetrievalApi(rt),
|
|
525
560
|
engines: new EnginesApi(rt),
|
|
526
561
|
skills: new SkillsApi(rt),
|
|
562
|
+
a2a: new A2aApi(rt),
|
|
527
563
|
fusions: new FusionsApi(rt),
|
|
528
564
|
};
|
|
529
565
|
}
|
|
@@ -712,6 +712,15 @@ export interface HistoryStreamEvent {
|
|
|
712
712
|
ids?: Array<string>;
|
|
713
713
|
at?: number;
|
|
714
714
|
}
|
|
715
|
+
export interface TeamsStreamEvent {
|
|
716
|
+
type: "hello" | "run";
|
|
717
|
+
/** On `hello`. */
|
|
718
|
+
at?: number;
|
|
719
|
+
/** The run that changed. */
|
|
720
|
+
id?: string;
|
|
721
|
+
/** True when the run left the store. */
|
|
722
|
+
removed?: boolean;
|
|
723
|
+
}
|
|
715
724
|
export interface PrefsEvent {
|
|
716
725
|
type: "hello" | "changed";
|
|
717
726
|
revision?: number;
|
|
@@ -787,6 +796,73 @@ export interface QuarantinedSkill {
|
|
|
787
796
|
verdict?: "suspicious" | "dangerous";
|
|
788
797
|
[key: string]: unknown;
|
|
789
798
|
}
|
|
799
|
+
/** An A2A Agent Card (protocol 1.0). Unknown fields are preserved, so a card from a later spec round-trips. */
|
|
800
|
+
export interface AgentCard {
|
|
801
|
+
name: string;
|
|
802
|
+
description: string;
|
|
803
|
+
version: string;
|
|
804
|
+
supportedInterfaces?: Array<{
|
|
805
|
+
url?: string;
|
|
806
|
+
/** JSONRPC, GRPC, HTTP+JSON — an open string, so an unknown binding is carried. */
|
|
807
|
+
protocolBinding?: string;
|
|
808
|
+
protocolVersion?: string;
|
|
809
|
+
/** Echoed on every request to this interface when set. */
|
|
810
|
+
tenant?: string;
|
|
811
|
+
}>;
|
|
812
|
+
provider?: {
|
|
813
|
+
organization?: string;
|
|
814
|
+
url?: string;
|
|
815
|
+
};
|
|
816
|
+
capabilities?: {
|
|
817
|
+
streaming?: boolean;
|
|
818
|
+
pushNotifications?: boolean;
|
|
819
|
+
extendedAgentCard?: boolean;
|
|
820
|
+
[key: string]: unknown;
|
|
821
|
+
};
|
|
822
|
+
defaultInputModes?: Array<string>;
|
|
823
|
+
defaultOutputModes?: Array<string>;
|
|
824
|
+
skills?: Array<{
|
|
825
|
+
[key: string]: unknown;
|
|
826
|
+
}>;
|
|
827
|
+
iconUrl?: string;
|
|
828
|
+
documentationUrl?: string;
|
|
829
|
+
[key: string]: unknown;
|
|
830
|
+
}
|
|
831
|
+
/** Either `url` or `card` identifies the agent; either `text` or `message` is what to say. */
|
|
832
|
+
export interface A2ASendRequest {
|
|
833
|
+
url?: string;
|
|
834
|
+
card?: AgentCard;
|
|
835
|
+
/** Shorthand for a one-part text message. */
|
|
836
|
+
text?: string;
|
|
837
|
+
/** A full A2A Message. */
|
|
838
|
+
message?: {
|
|
839
|
+
[key: string]: unknown;
|
|
840
|
+
};
|
|
841
|
+
/** Groups related interactions. */
|
|
842
|
+
contextId?: string;
|
|
843
|
+
/** Continues an existing task — how an input or auth stop is answered. */
|
|
844
|
+
taskId?: string;
|
|
845
|
+
/** Do not wait for a terminal or interrupted state. */
|
|
846
|
+
returnImmediately?: boolean;
|
|
847
|
+
auth?: string;
|
|
848
|
+
}
|
|
849
|
+
/** The reply, plus the two facts every caller derives — done, and what a person must do. */
|
|
850
|
+
export interface A2AResult {
|
|
851
|
+
ok?: boolean;
|
|
852
|
+
/** A2A returns one or the other; an agent answering at once creates no task. */
|
|
853
|
+
kind?: "task" | "message";
|
|
854
|
+
task?: {
|
|
855
|
+
[key: string]: unknown;
|
|
856
|
+
};
|
|
857
|
+
message?: {
|
|
858
|
+
[key: string]: unknown;
|
|
859
|
+
};
|
|
860
|
+
/** The answer as text — artifacts first, then what the agent actually said. */
|
|
861
|
+
text?: string;
|
|
862
|
+
done?: boolean;
|
|
863
|
+
/** `answer` for TASK_STATE_INPUT_REQUIRED, `approval` for TASK_STATE_AUTH_REQUIRED, null otherwise. */
|
|
864
|
+
needs?: "answer" | "approval";
|
|
865
|
+
}
|
|
790
866
|
/** An agent definition, read from whichever tool's dialect wrote it. */
|
|
791
867
|
export interface AgentDef {
|
|
792
868
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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",
|