@ziggs-ai/api-client 0.9.2 → 0.9.3

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.
@@ -38,16 +38,25 @@ export const listGrantsCapability = {
38
38
  key: 'grant_list',
39
39
  names: { sdk: 'grant_list', mcp: 'ziggs_grant_list' },
40
40
  descriptions: {
41
- sdk: 'List every grant this agent holds across all rails in one call — context (chat/agreement/org/artifact), connection, and wallet — as canonical grants (grantId, scope, caveats, expiresAt, health; no message/artifact content or credentials). Holder-scoped and cross-session. It answers "what grants do I HOLD?", which is narrower than "what can I reach?": reach you have by authoring something, by sitting in a chat, by being a party to an agreement, or through your org is not a grant row and never appears here — so an empty list means "no grants", never "no access". Filter by scopeKind (rail) and health (defaults to active). Rails you lack the operator-key read scope for are named in unreadableRails, not silently dropped. Cursor-paginated: pass cursor from a prior nextCursor. To answer "what can I reach?" instead, use context_expand_reach to enumerate a scope, or context_read to read through a grant.',
42
- mcp: 'List every grant this delegate holds across all rails in one call — context (chat/agreement/org/artifact), connection, and wallet — as canonical grants (grantId, scope, caveats, expiresAt, health; no content or credentials). Holder-scoped and cross-session. It answers "what grants do I HOLD?", which is narrower than "what can I reach?": reach you have by authoring something, by sitting in a chat, by being a party to an agreement, or through your org is not a grant row and never appears here — so an empty list means "no grants", never "no access". Filter by scopeKind (rail) and health (defaults to active). Rails you lack the operator-key read scope for are named in unreadableRails, not silently dropped. Cursor-paginated: pass cursor from a prior nextCursor to page. To answer "what can I reach?" instead, use ziggs_context_expand_reach to enumerate a scope, or pass a grantId to ziggs_context_read to pin a specific grant.',
41
+ sdk: 'List grants this agent holds — or, with role=issuer, grants this agent caused (author-shares and delegate children). Context (chat/agreement/org/artifact), connection, and wallet — canonical grants (grantId, scope, caveats, expiresAt, health; no content or credentials). Default role=holder answers "what grants do I HOLD?", which is narrower than "what can I reach?": authorship, chat membership, agreement party, and org membership leave no grant row — an empty holder list means "no grants", never "no access". role=issuer answers "who did I share with / what did I mint?" after artifact_share. Filter by scopeKind, scopeId, and health (defaults to active). Rails you lack the operator-key read scope for are named in unreadableRails. Cursor-paginated.',
42
+ mcp: 'List grants this delegate holds — or, with role=issuer, grants this delegate caused (author-shares and delegate children). Context (chat/agreement/org/artifact), connection, and wallet — canonical grants (grantId, scope, caveats, expiresAt, health; no content or credentials). Default role=holder answers "what grants do I HOLD?", which is narrower than "what can I reach?": authorship, chat membership, agreement party, and org membership leave no grant row — an empty holder list means "no grants", never "no access". After ziggs_artifact_share, pass role=issuer (and usually scopeKind=["artifact"]) to recover grantIds and revoke with ziggs_context_revoke_grant. Filter by scopeKind, scopeId, and health (defaults to active). Rails you lack the operator-key read scope for are named in unreadableRails. Cursor-paginated.',
43
43
  },
44
44
  annotation: 'read-only',
45
45
  params: {
46
+ role: {
47
+ type: 'string',
48
+ enum: ['holder', 'issuer'],
49
+ description: 'holder (default): grants you hold. issuer: grants you caused — author-shares you made and delegate children you minted (not your human owner\'s full issuer view).',
50
+ },
46
51
  scopeKind: {
47
52
  type: 'array',
48
53
  items: { type: 'string', enum: SCOPE_KINDS },
49
54
  description: 'Rail filter (repeatable): chat | agreement | org | artifact (context) | connection | wallet. Omit for every rail you can read.',
50
55
  },
56
+ scopeId: {
57
+ type: 'string',
58
+ description: 'Narrow to one resource id (e.g. one artifactId) within the rails above.',
59
+ },
51
60
  health: {
52
61
  type: 'string',
53
62
  enum: HEALTHS,
@@ -64,8 +73,14 @@ export const listGrantsCapability = {
64
73
  if (healthArg !== undefined && !HEALTHS.includes(healthArg)) {
65
74
  throw new Error(`health must be one of ${HEALTHS.join(', ')}`);
66
75
  }
76
+ const roleArg = args['role'];
77
+ if (roleArg !== undefined && roleArg !== 'holder' && roleArg !== 'issuer') {
78
+ throw new Error('role must be holder or issuer');
79
+ }
67
80
  const { items, nextCursor, unreadableRails } = await new GrantsClient(creds.operatorKey, creds.agentId, env.baseUrl).listGrants({
68
81
  scopeKind,
82
+ scopeId: typeof args['scopeId'] === 'string' ? args['scopeId'] : undefined,
83
+ role: roleArg,
69
84
  // Reach = live grants only by default; pass health to see expired/revoked.
70
85
  health: healthArg ?? 'active',
71
86
  cursor: args['cursor'],
@@ -10,6 +10,15 @@ export interface ListGrantsQuery {
10
10
  * kinds: chat, agreement, org). Absent = every rail.
11
11
  */
12
12
  scopeKind?: GrantScopeKind | GrantScopeKind[];
13
+ /**
14
+ * Narrow to one resource id (e.g. one artifact). Server-side page filter.
15
+ */
16
+ scopeId?: string;
17
+ /**
18
+ * `'holder'` (default) = grants you hold. `'issuer'` = grants you caused
19
+ * (ZIG-1217 for agents: author-shares + delegate children).
20
+ */
21
+ role?: 'holder' | 'issuer';
13
22
  /** Filter to grants of one health. */
14
23
  health?: GrantHealth;
15
24
  cursor?: string;
@@ -30,6 +30,10 @@ export class GrantsClient {
30
30
  for (const k of kinds)
31
31
  url.searchParams.append('scopeKind', k);
32
32
  }
33
+ if (query.scopeId)
34
+ url.searchParams.set('scopeId', query.scopeId);
35
+ if (query.role)
36
+ url.searchParams.set('role', query.role);
33
37
  if (query.health)
34
38
  url.searchParams.set('health', query.health);
35
39
  if (query.cursor)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",