@ziggs-ai/api-client 0.1.24 → 0.1.26
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/http/AgreementClient.d.ts +16 -1
- package/dist/http/AgreementClient.js +21 -0
- package/dist/http/ContextDiscoveryClient.d.ts +17 -0
- package/dist/http/ContextDiscoveryClient.js +22 -0
- package/dist/http/ContextGrantsClient.d.ts +23 -15
- package/dist/http/ContextGrantsClient.js +11 -2
- package/dist/http/MessagesClient.js +5 -1
- package/dist/http/TaskClient.d.ts +4 -0
- package/dist/http/TaskClient.js +56 -1
- package/dist/http/grants.d.ts +39 -0
- package/dist/http/grants.js +4 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.js +1 -0
- package/dist/websocket/WebSocketClient.d.ts +6 -0
- package/package.json +1 -1
|
@@ -17,7 +17,12 @@ export interface ProposeTerms {
|
|
|
17
17
|
agreementDescription?: string;
|
|
18
18
|
parentAgreementId?: string;
|
|
19
19
|
parentTaskId?: string;
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Who does the work. Required on direct proposals (your own id = you offer;
|
|
22
|
+
* the proposedTo id = you commission the recipient); forbidden on
|
|
23
|
+
* broadcasts. The payer is always derived server-side as the non-providing
|
|
24
|
+
* side — there is no payer input.
|
|
25
|
+
*/
|
|
21
26
|
providerId?: string;
|
|
22
27
|
plan?: unknown;
|
|
23
28
|
planReviewTiming?: PlanReviewTiming;
|
|
@@ -146,6 +151,12 @@ export declare function revokeAgreement(agreementId: string, creds: Creds): Prom
|
|
|
146
151
|
ok: boolean;
|
|
147
152
|
agreement: Agreement;
|
|
148
153
|
}>;
|
|
154
|
+
/** ZIG-832: mark an agreement fulfilled (complete). A provider closing its own
|
|
155
|
+
* delivered work — party-gated server-side. */
|
|
156
|
+
export declare function fulfillAgreement(agreementId: string, creds: Creds): Promise<{
|
|
157
|
+
ok: boolean;
|
|
158
|
+
agreement: Agreement;
|
|
159
|
+
}>;
|
|
149
160
|
/**
|
|
150
161
|
* Claim an open agreement (ZIG-524 phase 2 / ZIG-525):
|
|
151
162
|
* - open link invite (`engagementKind: link`, proposedTo everyone)
|
|
@@ -200,6 +211,10 @@ export declare class AgreementClient {
|
|
|
200
211
|
ok: boolean;
|
|
201
212
|
agreement: Agreement;
|
|
202
213
|
}>;
|
|
214
|
+
fulfill(id: string): Promise<{
|
|
215
|
+
ok: boolean;
|
|
216
|
+
agreement: Agreement;
|
|
217
|
+
}>;
|
|
203
218
|
claimAgreement(id: string): Promise<{
|
|
204
219
|
ok: boolean;
|
|
205
220
|
agreement: Agreement;
|
|
@@ -370,6 +370,26 @@ export async function revokeAgreement(agreementId, creds) {
|
|
|
370
370
|
}
|
|
371
371
|
return data;
|
|
372
372
|
}
|
|
373
|
+
/** ZIG-832: mark an agreement fulfilled (complete). A provider closing its own
|
|
374
|
+
* delivered work — party-gated server-side. */
|
|
375
|
+
export async function fulfillAgreement(agreementId, creds) {
|
|
376
|
+
if (!agreementId)
|
|
377
|
+
throw new Error('agreementId is required to fulfill');
|
|
378
|
+
assertCreds(creds, 'agreement fulfillment');
|
|
379
|
+
const res = await fetch(`${getAgreementBaseUrl()}/${encodeURIComponent(agreementId)}/fulfill`, {
|
|
380
|
+
method: 'POST',
|
|
381
|
+
headers: buildHeaders(creds),
|
|
382
|
+
});
|
|
383
|
+
if (!res.ok) {
|
|
384
|
+
const body = await res.text().catch(() => '');
|
|
385
|
+
throwApiError(res, body, `Agreement fulfillment failed: ${res.status} ${res.statusText}`);
|
|
386
|
+
}
|
|
387
|
+
const data = await res.json().catch(() => null);
|
|
388
|
+
if (!data?.['agreement']) {
|
|
389
|
+
throw new Error('Invalid response: expected { ok, agreement } from POST /agreements/:id/fulfill');
|
|
390
|
+
}
|
|
391
|
+
return data;
|
|
392
|
+
}
|
|
373
393
|
/**
|
|
374
394
|
* Claim an open agreement (ZIG-524 phase 2 / ZIG-525):
|
|
375
395
|
* - open link invite (`engagementKind: link`, proposedTo everyone)
|
|
@@ -596,6 +616,7 @@ export class AgreementClient {
|
|
|
596
616
|
get(id) { return getAgreement(id, this.creds); }
|
|
597
617
|
create(data) { return createAgreement(data, this.creds); }
|
|
598
618
|
revoke(id) { return revokeAgreement(id, this.creds); }
|
|
619
|
+
fulfill(id) { return fulfillAgreement(id, this.creds); }
|
|
599
620
|
claimAgreement(id) { return claimAgreement(id, this.creds); }
|
|
600
621
|
listByChat(chatId) { return getAgreementsByChat(chatId, this.creds); }
|
|
601
622
|
linkToChat(id, chatId, linkType) { return linkAgreementToChat(id, chatId, linkType ?? 'mention', this.creds); }
|
|
@@ -11,6 +11,16 @@ export interface ContextReachDescriptor {
|
|
|
11
11
|
parentGrantId: string | null;
|
|
12
12
|
createdAt: string;
|
|
13
13
|
}
|
|
14
|
+
/** Labels-only pointer to context the agent could request access to (P4). */
|
|
15
|
+
export interface DiscoverableItem {
|
|
16
|
+
type: 'chat';
|
|
17
|
+
label: string;
|
|
18
|
+
scopeRef: {
|
|
19
|
+
kind: 'chat' | 'agreement' | 'org';
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
orgId: string;
|
|
23
|
+
}
|
|
14
24
|
/**
|
|
15
25
|
* ZIG-412 discovery — scope descriptors only, no content.
|
|
16
26
|
*/
|
|
@@ -24,4 +34,11 @@ export declare class ContextDiscoveryClient {
|
|
|
24
34
|
*/
|
|
25
35
|
constructor(operatorKey: string, agentId?: string, baseUrl?: string);
|
|
26
36
|
discover(): Promise<ContextReachDescriptor[]>;
|
|
37
|
+
/**
|
|
38
|
+
* P4: what context EXISTS in the agent's engaged orgs that it does NOT hold
|
|
39
|
+
* a grant for — so it can request access rather than fail blind. Labels only.
|
|
40
|
+
* Defensively re-shapes each row to the whitelist (type/label/scopeRef/orgId)
|
|
41
|
+
* so an over-broad server response can never leak content/tokens through here.
|
|
42
|
+
*/
|
|
43
|
+
discoverGrantable(): Promise<DiscoverableItem[]>;
|
|
27
44
|
}
|
|
@@ -31,4 +31,26 @@ export class ContextDiscoveryClient {
|
|
|
31
31
|
const parsed = JSON.parse(body);
|
|
32
32
|
return parsed.reach ?? [];
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* P4: what context EXISTS in the agent's engaged orgs that it does NOT hold
|
|
36
|
+
* a grant for — so it can request access rather than fail blind. Labels only.
|
|
37
|
+
* Defensively re-shapes each row to the whitelist (type/label/scopeRef/orgId)
|
|
38
|
+
* so an over-broad server response can never leak content/tokens through here.
|
|
39
|
+
*/
|
|
40
|
+
async discoverGrantable() {
|
|
41
|
+
const res = await fetch(`${this.baseUrl}/context/discovery/available`, {
|
|
42
|
+
headers: buildOperatorHeaders(this.operatorKey, this.agentId),
|
|
43
|
+
});
|
|
44
|
+
const body = await res.text().catch(() => '');
|
|
45
|
+
if (!res.ok) {
|
|
46
|
+
throw new Error(`ContextDiscoveryClient.discoverGrantable ${res.status} ${body.slice(0, 200)}`);
|
|
47
|
+
}
|
|
48
|
+
const parsed = JSON.parse(body);
|
|
49
|
+
return (parsed.items ?? []).map((i) => ({
|
|
50
|
+
type: i.type,
|
|
51
|
+
label: i.label,
|
|
52
|
+
scopeRef: { kind: i.scopeRef.kind, id: i.scopeRef.id },
|
|
53
|
+
orgId: i.orgId,
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
34
56
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
|
+
import type { GrantView } from './grants.js';
|
|
2
3
|
export type ContextGrantScopeKind = 'chat' | 'agreement' | 'org';
|
|
3
4
|
export type ContextTemporal = 'from-now' | 'from-start';
|
|
4
5
|
export interface ContextGrantScope {
|
|
5
6
|
kind: ContextGrantScopeKind;
|
|
6
7
|
id: string;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
expiresAt: string | null;
|
|
18
|
-
revoked: boolean;
|
|
19
|
-
createdAt: string;
|
|
20
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated ZIG-646 — context grants now serialise to the canonical
|
|
11
|
+
* {@link GrantView} like every other rail. This alias previously declared a
|
|
12
|
+
* flat `scopeKind`/`scopeId` + `revoked` shape that the backend never actually
|
|
13
|
+
* emitted (it sends nested `scope: { kind, id }` and folds temporal/watermark
|
|
14
|
+
* into `caveats`), so reads like `record.scopeKind` were always `undefined`.
|
|
15
|
+
* Use `GrantView`; this remains only so existing name-imports keep resolving.
|
|
16
|
+
*/
|
|
17
|
+
export type ContextGrantRecord = GrantView;
|
|
21
18
|
export interface IssueContextGrantInput {
|
|
22
19
|
holderId: string;
|
|
23
20
|
scope: ContextGrantScope;
|
|
@@ -31,6 +28,17 @@ export interface DelegateContextGrantInput {
|
|
|
31
28
|
expiresAt?: string | null;
|
|
32
29
|
watermarkAt?: string;
|
|
33
30
|
}
|
|
31
|
+
/** Delegating your own principal's grant mints immediately; passing a grant
|
|
32
|
+
* whose original owner is a different party opens a request that owner
|
|
33
|
+
* approves — no grant is minted until then. */
|
|
34
|
+
export type DelegateContextGrantResult = {
|
|
35
|
+
status: 'granted';
|
|
36
|
+
grant: GrantView;
|
|
37
|
+
} | {
|
|
38
|
+
status: 'pending_approval';
|
|
39
|
+
agreementId: string;
|
|
40
|
+
ownerId?: string;
|
|
41
|
+
};
|
|
34
42
|
/**
|
|
35
43
|
* ZIG-411 context grant management — list / issue / delegate / revoke.
|
|
36
44
|
*/
|
|
@@ -43,8 +51,8 @@ export declare class ContextGrantsClient {
|
|
|
43
51
|
* @param agentId Required for fleet keys (sent as X-Agent-Id). Omit for agent-scoped keys.
|
|
44
52
|
*/
|
|
45
53
|
constructor(operatorKey: string, agentId?: string, baseUrl?: string);
|
|
46
|
-
issueGrant(input: IssueContextGrantInput): Promise<
|
|
47
|
-
delegateGrant(parentGrantId: string, input: DelegateContextGrantInput): Promise<
|
|
54
|
+
issueGrant(input: IssueContextGrantInput): Promise<GrantView>;
|
|
55
|
+
delegateGrant(parentGrantId: string, input: DelegateContextGrantInput): Promise<DelegateContextGrantResult>;
|
|
48
56
|
revokeGrant(grantId: string): Promise<{
|
|
49
57
|
status: string;
|
|
50
58
|
revokedCount?: number;
|
|
@@ -74,10 +74,19 @@ export class ContextGrantsClient {
|
|
|
74
74
|
throwApiError(res, body, `delegateGrant failed: ${res.status} ${res.statusText}`);
|
|
75
75
|
}
|
|
76
76
|
const parsed = JSON.parse(body);
|
|
77
|
+
// Re-granting a grant whose original owner is a different party does not
|
|
78
|
+
// mint — it opens a request that owner must approve.
|
|
79
|
+
if (parsed.status === 'pending_approval' && parsed.agreementId) {
|
|
80
|
+
return {
|
|
81
|
+
status: 'pending_approval',
|
|
82
|
+
agreementId: parsed.agreementId,
|
|
83
|
+
ownerId: parsed.ownerId,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
77
86
|
if (!parsed.grant?.grantId) {
|
|
78
|
-
throw new Error('Invalid response: expected { grant } from POST /context/grants/:id/delegate');
|
|
87
|
+
throw new Error('Invalid response: expected { grant } or { status: "pending_approval" } from POST /context/grants/:id/delegate');
|
|
79
88
|
}
|
|
80
|
-
return parsed.grant;
|
|
89
|
+
return { status: 'granted', grant: parsed.grant };
|
|
81
90
|
}
|
|
82
91
|
async revokeGrant(grantId) {
|
|
83
92
|
const res = await fetch(`${this.baseUrl}/context/grants/${encodeURIComponent(grantId)}`, {
|
|
@@ -35,7 +35,11 @@ export class MessagesClient {
|
|
|
35
35
|
const res = await fetch(url.toString(), { headers: this._headers() });
|
|
36
36
|
if (!res.ok) {
|
|
37
37
|
const body = await res.text().catch(() => '');
|
|
38
|
-
|
|
38
|
+
const err = new Error(`MessagesClient.list ${res.status} ${res.statusText} ${body.slice(0, 200)}`);
|
|
39
|
+
// Callers branch on the HTTP status (404 = chat deleted/not visible)
|
|
40
|
+
// without parsing the message string.
|
|
41
|
+
err.status = res.status;
|
|
42
|
+
throw err;
|
|
39
43
|
}
|
|
40
44
|
return (await res.json());
|
|
41
45
|
}
|
|
@@ -8,6 +8,8 @@ export interface CreateTaskData {
|
|
|
8
8
|
idempotencyKey?: string;
|
|
9
9
|
/** Explicit delegation target (ZIG-586) — must be a party to the agreement; validated server-side. */
|
|
10
10
|
assigneeId?: string;
|
|
11
|
+
/** ZIG-734: prior-step artifact handles consumed as structured input links. */
|
|
12
|
+
inputArtifactIds?: string[];
|
|
11
13
|
}
|
|
12
14
|
export declare function createTask(taskData: CreateTaskData, creds: Creds): Promise<Task>;
|
|
13
15
|
export declare function getTask(taskId: string, creds: Creds): Promise<Task>;
|
|
@@ -26,6 +28,7 @@ export interface PlanReplaceStep {
|
|
|
26
28
|
order: number;
|
|
27
29
|
}
|
|
28
30
|
export declare function replaceTaskPlan(taskId: string, steps: PlanReplaceStep[], creds: Creds): Promise<Task>;
|
|
31
|
+
export declare function updateTaskPlanStep(taskId: string, stepId: string, status: string, result: unknown, creds: Creds): Promise<Task>;
|
|
29
32
|
export declare function reportTask(taskId: string, message: string | undefined, creds: Creds): Promise<Task>;
|
|
30
33
|
export declare function setTaskSatisfaction(taskId: string, satisfaction: 'positive' | 'negative', creds: Creds): Promise<Task>;
|
|
31
34
|
export interface ListTasksOptions {
|
|
@@ -63,6 +66,7 @@ export declare class TaskClient {
|
|
|
63
66
|
cancelTask(taskId: string): Promise<Task>;
|
|
64
67
|
getSubtasks(parentTaskId: string): Promise<Task[]>;
|
|
65
68
|
replaceTaskPlan(taskId: string, steps: PlanReplaceStep[]): Promise<Task>;
|
|
69
|
+
updateTaskPlanStep(taskId: string, stepId: string, status: string, result?: unknown): Promise<Task>;
|
|
66
70
|
reportTask(taskId: string, message?: string): Promise<Task>;
|
|
67
71
|
setTaskSatisfaction(taskId: string, satisfaction: 'positive' | 'negative'): Promise<Task>;
|
|
68
72
|
listTasks(options?: ListTasksOptions): Promise<ListTasksResult>;
|
package/dist/http/TaskClient.js
CHANGED
|
@@ -117,7 +117,38 @@ export async function getActiveTasksForAgent(agentId, creds) {
|
|
|
117
117
|
throwApiError(res, body, `Get active tasks for agent failed: ${res.status} ${res.statusText}`);
|
|
118
118
|
}
|
|
119
119
|
const data = await res.json().catch(() => null);
|
|
120
|
-
|
|
120
|
+
const fromAgent = Array.isArray(data?.['tasks']) ? data['tasks'] : [];
|
|
121
|
+
if (fromAgent.length > 0)
|
|
122
|
+
return fromAgent;
|
|
123
|
+
// Fallback when /agents/:id/tasks is empty but party-agreement tasks exist (ZIG-802).
|
|
124
|
+
return getActiveTasksForAgentViaPartyAgreements(agentId, creds);
|
|
125
|
+
}
|
|
126
|
+
async function getActiveTasksForAgentViaPartyAgreements(agentId, creds) {
|
|
127
|
+
const { listAgreements } = await import('./AgreementClient.js');
|
|
128
|
+
const agreements = await listAgreements({ status: 'active' }, creds);
|
|
129
|
+
const partyIds = agreements
|
|
130
|
+
.filter((a) => {
|
|
131
|
+
const p = a.parties ?? {};
|
|
132
|
+
return (p.provider === agentId ||
|
|
133
|
+
p.providerAgent === agentId ||
|
|
134
|
+
p.creator === agentId ||
|
|
135
|
+
p.payer === agentId);
|
|
136
|
+
})
|
|
137
|
+
.map((a) => a.agreementId)
|
|
138
|
+
.filter(Boolean);
|
|
139
|
+
if (partyIds.length === 0)
|
|
140
|
+
return [];
|
|
141
|
+
const lists = await Promise.all(partyIds.map(async (aid) => {
|
|
142
|
+
const url = new URL(`${getBackendUrl()}/agreements/${encodeURIComponent(aid)}/tasks`);
|
|
143
|
+
url.searchParams.set('state', 'active');
|
|
144
|
+
const res = await fetch(url.toString(), { method: 'GET', headers: buildHeaders(creds) });
|
|
145
|
+
if (!res.ok)
|
|
146
|
+
return [];
|
|
147
|
+
const data = await res.json().catch(() => null);
|
|
148
|
+
return Array.isArray(data?.['tasks']) ? data['tasks'] : [];
|
|
149
|
+
}));
|
|
150
|
+
const merged = lists.flat();
|
|
151
|
+
return merged.filter((t) => !t.assigneeId || t.assigneeId === agentId);
|
|
121
152
|
}
|
|
122
153
|
// Backend deliberately has no `/chats/:id/tasks` route — it's composable
|
|
123
154
|
// from links → per-agreement tasks. We do the composition here so callers
|
|
@@ -205,6 +236,29 @@ export async function replaceTaskPlan(taskId, steps, creds) {
|
|
|
205
236
|
throw new Error('Invalid response: task data not found');
|
|
206
237
|
return task;
|
|
207
238
|
}
|
|
239
|
+
export async function updateTaskPlanStep(taskId, stepId, status, result, creds) {
|
|
240
|
+
if (!taskId)
|
|
241
|
+
throw new Error('updateTaskPlanStep: taskId is required');
|
|
242
|
+
if (!stepId)
|
|
243
|
+
throw new Error('updateTaskPlanStep: stepId is required');
|
|
244
|
+
if (!status)
|
|
245
|
+
throw new Error('updateTaskPlanStep: status is required');
|
|
246
|
+
assertCreds(creds, 'plan step update');
|
|
247
|
+
const res = await fetch(`${getTaskBaseUrl()}/${taskId}/plan`, {
|
|
248
|
+
method: 'PATCH',
|
|
249
|
+
headers: buildHeaders(creds),
|
|
250
|
+
body: JSON.stringify({ stepId, status, ...(result !== undefined && { result }) }),
|
|
251
|
+
});
|
|
252
|
+
if (!res.ok) {
|
|
253
|
+
const responseBody = await res.text().catch(() => '');
|
|
254
|
+
throwApiError(res, responseBody, `Plan step update failed: ${res.status} ${res.statusText}`);
|
|
255
|
+
}
|
|
256
|
+
const data = await res.json().catch(() => null);
|
|
257
|
+
const task = extractTask(data);
|
|
258
|
+
if (!task)
|
|
259
|
+
throw new Error('Invalid response: task data not found');
|
|
260
|
+
return task;
|
|
261
|
+
}
|
|
208
262
|
// ---------------------------------------------------------------------------
|
|
209
263
|
// Reporting & satisfaction
|
|
210
264
|
// ---------------------------------------------------------------------------
|
|
@@ -322,6 +376,7 @@ export class TaskClient {
|
|
|
322
376
|
cancelTask(taskId) { return cancelTask(taskId, this.creds); }
|
|
323
377
|
getSubtasks(parentTaskId) { return getSubtasks(parentTaskId, this.creds); }
|
|
324
378
|
replaceTaskPlan(taskId, steps) { return replaceTaskPlan(taskId, steps, this.creds); }
|
|
379
|
+
updateTaskPlanStep(taskId, stepId, status, result) { return updateTaskPlanStep(taskId, stepId, status, result, this.creds); }
|
|
325
380
|
reportTask(taskId, message) { return reportTask(taskId, message, this.creds); }
|
|
326
381
|
setTaskSatisfaction(taskId, satisfaction) { return setTaskSatisfaction(taskId, satisfaction, this.creds); }
|
|
327
382
|
listTasks(options) { return listTasks(options ?? {}, this.creds); }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZIG-646: the one grant shape the backend presents on the wire, mirrored for
|
|
3
|
+
* SDK consumers. Context, connection, and payment grants all serialise to this
|
|
4
|
+
* exact object (see backend `src/grants/grant-view.ts`), so a caller reads one
|
|
5
|
+
* shape to answer "what grants exist, and are they live?" regardless of rail.
|
|
6
|
+
*
|
|
7
|
+
* `scope.kind` names the rail's resource: context grants keep chat/agreement/org;
|
|
8
|
+
* a connection grant is `connection` + connectionId; a payment grant is
|
|
9
|
+
* `wallet` + the root wallet id. A grant's bounds are its `caveats` — for
|
|
10
|
+
* context grants (which have no caveat column) the temporal mode and read
|
|
11
|
+
* watermark are presented as `temporal` / `watermark_at` caveats.
|
|
12
|
+
*/
|
|
13
|
+
export type GrantHealth = 'active' | 'expired' | 'revoked';
|
|
14
|
+
export type GrantScopeKind = 'chat' | 'agreement' | 'org' | 'connection' | 'wallet';
|
|
15
|
+
export interface GrantScopeView {
|
|
16
|
+
kind: GrantScopeKind;
|
|
17
|
+
id: string;
|
|
18
|
+
}
|
|
19
|
+
export interface GrantCaveatView {
|
|
20
|
+
type: string;
|
|
21
|
+
value: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface GrantView {
|
|
24
|
+
grantId: string;
|
|
25
|
+
issuerId: string;
|
|
26
|
+
holderId: string;
|
|
27
|
+
parentGrantId: string | null;
|
|
28
|
+
agreementId: string | null;
|
|
29
|
+
scope: GrantScopeView;
|
|
30
|
+
caveats: GrantCaveatView[];
|
|
31
|
+
revoked: boolean;
|
|
32
|
+
/** ISO-8601, or null for no expiry. */
|
|
33
|
+
expiresAt: string | null;
|
|
34
|
+
/** ISO-8601. */
|
|
35
|
+
createdAt: string;
|
|
36
|
+
health: GrantHealth;
|
|
37
|
+
}
|
|
38
|
+
/** Value of the first caveat of `type` on a grant, or undefined. */
|
|
39
|
+
export declare function grantCaveat(grant: GrantView, type: string): unknown | undefined;
|
package/dist/http/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export { ContextDiscoveryClient } from './ContextDiscoveryClient.js';
|
|
|
14
14
|
export type { ContextReachDescriptor } from './ContextDiscoveryClient.js';
|
|
15
15
|
export { ContextGrantsClient } from './ContextGrantsClient.js';
|
|
16
16
|
export type { ContextGrantRecord, ContextGrantScope, ContextGrantScopeKind, ContextTemporal, IssueContextGrantInput, DelegateContextGrantInput, } from './ContextGrantsClient.js';
|
|
17
|
+
export { grantCaveat } from './grants.js';
|
|
18
|
+
export type { GrantView, GrantScopeKind, GrantScopeView, GrantCaveatView, GrantHealth, } from './grants.js';
|
|
17
19
|
export { AgentSearchClient } from './AgentSearchClient.js';
|
|
18
20
|
export { TelemetryClient } from './TelemetryClient.js';
|
|
19
21
|
export { InboxClient } from './InboxClient.js';
|
package/dist/http/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { ScopeClient } from './ScopeClient.js';
|
|
|
8
8
|
export { ContextReadClient } from './ContextReadClient.js';
|
|
9
9
|
export { ContextDiscoveryClient } from './ContextDiscoveryClient.js';
|
|
10
10
|
export { ContextGrantsClient } from './ContextGrantsClient.js';
|
|
11
|
+
export { grantCaveat } from './grants.js';
|
|
11
12
|
export { AgentSearchClient } from './AgentSearchClient.js';
|
|
12
13
|
export { TelemetryClient } from './TelemetryClient.js';
|
|
13
14
|
export { InboxClient } from './InboxClient.js';
|
|
@@ -27,6 +27,12 @@ export interface ResourceEvent {
|
|
|
27
27
|
taskId?: string;
|
|
28
28
|
change?: 'created' | 'updated' | 'state-changed';
|
|
29
29
|
reason?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Principal whose action produced the event, when the backend knows it.
|
|
32
|
+
* Hosts drop events the receiving agent itself caused — its own writes
|
|
33
|
+
* aren't news to it.
|
|
34
|
+
*/
|
|
35
|
+
actorId?: string;
|
|
30
36
|
}
|
|
31
37
|
export type ResourceEventHandler = (event: ResourceEvent) => void | Promise<void>;
|
|
32
38
|
export interface SendOptions {
|