@ziggs-ai/api-client 0.1.18 → 0.1.19
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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`, {
|
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
|
|
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?:
|
|
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;
|