@ziggs-ai/api-client 0.1.18 → 0.1.20

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.
@@ -1,12 +1,14 @@
1
1
  import 'dotenv/config';
2
2
  import { type Creds } from '../types.js';
3
+ /** Shape of GET /chats/mine items — the backend's ChatReadDto (ZIG-665). */
3
4
  export interface ChatSummary {
4
5
  chatId: string;
5
- userIds?: string[];
6
- agentIds?: string[];
7
- createdAt?: string;
8
- updatedAt?: string;
9
- [key: string]: unknown;
6
+ members: Array<{
7
+ principalId: string;
8
+ agentId: string | null;
9
+ }>;
10
+ orgId: string | null;
11
+ isOrgChat: boolean;
10
12
  }
11
13
  export declare function openConversation(participantId: string, creds: Creds): Promise<{
12
14
  chatId: string;
@@ -39,7 +39,6 @@ export declare class ContextGrantsClient {
39
39
  private readonly agentId;
40
40
  private readonly baseUrl;
41
41
  constructor(operatorKey: string, agentId: string, baseUrl?: string);
42
- listGrants(holderId?: string): Promise<ContextGrantRecord[]>;
43
42
  issueGrant(input: IssueContextGrantInput): Promise<ContextGrantRecord>;
44
43
  delegateGrant(parentGrantId: string, input: DelegateContextGrantInput): Promise<ContextGrantRecord>;
45
44
  revokeGrant(grantId: string): Promise<{
@@ -49,24 +49,6 @@ export class ContextGrantsClient {
49
49
  this.agentId = agentId;
50
50
  this.baseUrl = baseUrl || getBackendUrl();
51
51
  }
52
- async listGrants(holderId) {
53
- assertCreds({ operatorKey: this.operatorKey, agentId: this.agentId }, 'listGrants');
54
- const qs = holderId
55
- ? `?${new URLSearchParams({ holderId }).toString()}`
56
- : '';
57
- const res = await fetch(`${this.baseUrl}/context/grants${qs}`, {
58
- headers: buildHeaders({
59
- operatorKey: this.operatorKey,
60
- agentId: this.agentId,
61
- }),
62
- });
63
- const body = await res.text().catch(() => '');
64
- if (!res.ok) {
65
- throwApiError(res, body, `listGrants failed: ${res.status} ${res.statusText}`);
66
- }
67
- const parsed = JSON.parse(body);
68
- return parsed.grants ?? [];
69
- }
70
52
  async issueGrant(input) {
71
53
  assertCreds({ operatorKey: this.operatorKey, agentId: this.agentId }, 'issueGrant');
72
54
  const res = await fetch(`${this.baseUrl}/context/grants`, {
@@ -35,14 +35,25 @@ export interface InboxConnectionRequestRef {
35
35
  message: string | null;
36
36
  requestedAt: string | null;
37
37
  }
38
+ /** Agent asking its principal to connect an MCP server + grant tools (ZIG-686). */
39
+ export interface InboxMcpServerRequestRef {
40
+ requestId: string;
41
+ requesterAgentId: string;
42
+ serverUrl: string;
43
+ tools: string[];
44
+ reason: string | null;
45
+ requestedAt: string | null;
46
+ }
38
47
  /** Pull-only MCP: prompt the human when proposals need a decision (ZIG-482 / ZIG-481). */
39
48
  export interface InboxHumanAttention {
40
49
  required: true;
41
- reason: 'proposals_awaiting_me' | 'connection_requests_awaiting_me' | 'multiple';
50
+ reason: 'proposals_awaiting_me' | 'connection_requests_awaiting_me' | 'mcp_server_requests_awaiting_me' | 'multiple';
42
51
  proposalCount: number;
43
52
  truncatedProposals: number;
44
53
  connectionRequestCount: number;
45
54
  truncatedConnectionRequests: number;
55
+ mcpServerRequestCount: number;
56
+ truncatedMcpServerRequests: number;
46
57
  promptUser: string;
47
58
  }
48
59
  export interface InboxEnvelope {
@@ -54,6 +65,9 @@ export interface InboxEnvelope {
54
65
  truncatedProposals: number;
55
66
  connectionRequestsAwaitingMe: InboxConnectionRequestRef[];
56
67
  truncatedConnectionRequests: number;
68
+ /** Agent requests to connect an MCP server awaiting the user (ZIG-686). */
69
+ mcpServerRequestsAwaitingMe: InboxMcpServerRequestRef[];
70
+ truncatedMcpServerRequests: number;
57
71
  humanAttention?: InboxHumanAttention;
58
72
  }
59
73
  export interface InboxAck {
@@ -17,4 +17,4 @@ export type { ContextGrantRecord, ContextGrantScope, ContextGrantScopeKind, Cont
17
17
  export { AgentSearchClient } from './AgentSearchClient.js';
18
18
  export { TelemetryClient } from './TelemetryClient.js';
19
19
  export { InboxClient } from './InboxClient.js';
20
- export type { InboxScopeKind, InboxScopeEntry, InboxProposalRef, InboxConnectionRequestRef, InboxEnvelope, InboxAck, InboxAckResult, } from './InboxClient.js';
20
+ export type { InboxScopeKind, InboxScopeEntry, InboxProposalRef, InboxConnectionRequestRef, InboxMcpServerRequestRef, InboxHumanAttention, InboxEnvelope, InboxAck, InboxAckResult, } from './InboxClient.js';
package/dist/types.d.ts CHANGED
@@ -23,18 +23,26 @@ export interface Task {
23
23
  /** Explicit delegation target (ZIG-586) — id of the agent/user this task is assigned to, or null when unassigned. */
24
24
  assigneeId?: string | null;
25
25
  agreementId?: string;
26
- agreement?: Agreement;
26
+ /** Compact reference to the governing agreement (ZIG-665). Read endpoints
27
+ * never inline the full agreement — fetch it via getAgreement when the
28
+ * paper-work (money, approvals) matters. */
29
+ agreement?: AgreementSummary | null;
27
30
  state: TaskState;
28
- processing?: boolean;
29
- deleted?: boolean;
30
31
  result?: unknown;
31
32
  errorMessage?: string;
32
33
  createdAt?: string;
33
34
  updatedAt?: string;
34
35
  parentTaskId?: string;
35
36
  rootTaskId?: string;
36
- plan?: PlanStep[];
37
+ plan?: {
38
+ steps?: PlanStep[];
39
+ };
40
+ planReview?: unknown;
37
41
  history?: unknown[];
42
+ creatorIsYou?: boolean;
43
+ providerIsYou?: boolean;
44
+ payerIsYou?: boolean;
45
+ proposedToIsYou?: boolean;
38
46
  }
39
47
  export type AgreementStatus = 'pending' | 'active' | 'fulfilled' | 'cancelled' | 'rejected' | (string & {});
40
48
  export type ProposalStatus = 'pending' | 'approved' | 'rejected' | 'countered' | 'expired' | (string & {});
@@ -46,6 +54,23 @@ export declare const AGREEMENT_ENGAGEMENT_KIND: {
46
54
  readonly LINK: "link";
47
55
  };
48
56
  export type EngagementKind = (typeof AGREEMENT_ENGAGEMENT_KIND)[keyof typeof AGREEMENT_ENGAGEMENT_KIND];
57
+ /** Compact agreement reference carried by task reads (ZIG-665). */
58
+ export interface AgreementSummary {
59
+ agreementId: string;
60
+ description: string;
61
+ status: AgreementStatus;
62
+ parties?: {
63
+ proposedTo?: string | null;
64
+ provider?: string | null;
65
+ payer?: string | null;
66
+ creator?: string | null;
67
+ creatorAgent?: string | null;
68
+ providerAgent?: string | null;
69
+ };
70
+ /** The opposite party relative to the requesting agent; null for observers,
71
+ * broadcast sentinels, and self-agreements. */
72
+ counterparty: string | null;
73
+ }
49
74
  export interface AgreementApprovalEntry {
50
75
  partyId: string;
51
76
  role?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",