@ziggs-ai/api-client 0.28.0 → 0.28.1

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.
@@ -66,6 +66,7 @@ export const openConversationCapability = {
66
66
  participantIds: { type: 'array', items: { type: 'string' }, description: '1–20 known ids. Without chatId: people, for a separate group. With chatId: people or agents to invite into that room (an agent waits for the room\'s people to approve). Use instead of participantId. Each invitation is authorized separately.' },
67
67
  chatId: { type: 'string', description: 'Existing room to invite participantIds into. Never creates another room. Omit creation options and agreementId.' },
68
68
  idempotencyKey: { type: 'string', description: 'Required for group creation: a unique key for this conversation, reused unchanged on retries. A different participant set needs a new key.' },
69
+ name: { type: 'string', description: 'Name for a new group, 1–80 characters. Pair rooms and team channels take no name. A retry of the same idempotencyKey keeps the first name. Rename later is PATCH /chats/:chatId by someone who can admit people.' },
69
70
  createIfMissing: { type: 'boolean', description: 'Set false to reuse only an existing room for this acting agent and participant. A missing room is refused without creating a replacement.' },
70
71
  newChat: {
71
72
  type: 'boolean',
@@ -99,7 +100,10 @@ export const openConversationCapability = {
99
100
  else if (args.chatId || args.idempotencyKey) {
100
101
  throw new Error('chatId and idempotencyKey require participantIds');
101
102
  }
102
- const { chatId, reused, invited } = await openConversation({
103
+ if (typeof args.name === 'string' && args.name.trim() && !Array.isArray(args.participantIds)) {
104
+ throw new Error('A name is for a new group. Pair rooms take no name; the person is the name.');
105
+ }
106
+ const { chatId, reused, invited, name } = await openConversation({
103
107
  ...(typeof args.participantId === 'string' ? { participantId: args.participantId } : {}),
104
108
  ...(Array.isArray(args.participantIds) ? { participantIds: args.participantIds } : {}),
105
109
  ...(typeof args.chatId === 'string' ? { chatId: args.chatId } : {}),
@@ -107,6 +111,7 @@ export const openConversationCapability = {
107
111
  ...(args.newChat === true ? { newChat: true } : {}),
108
112
  ...(typeof args.createIfMissing === 'boolean' ? { createIfMissing: args.createIfMissing } : {}),
109
113
  ...(typeof args.agreementId === 'string' && args.agreementId ? { agreementId: args.agreementId } : {}),
114
+ ...(typeof args.name === 'string' && args.name.trim() ? { name: args.name.trim() } : {}),
110
115
  }, fullCreds(env));
111
116
  const lister = env.surface === 'mcp' ? 'ziggs_grant_list' : 'grant_list';
112
117
  const grantNote = `Use ${lister} with scopeKind ["chat"] to inspect your room grants. Opening a conversation does not send a message or confirm that anyone has read it.`;
@@ -126,6 +131,7 @@ export const openConversationCapability = {
126
131
  chatId,
127
132
  actingAgentId: fullCreds(env).agentId,
128
133
  ...(typeof reused === 'boolean' ? { reused } : {}),
134
+ ...(name ? { name } : {}),
129
135
  ...(invited ? { invited } : {}),
130
136
  note: `${outcomeNote} ${grantNote}`,
131
137
  };
@@ -26,6 +26,8 @@ export interface OpenConversationInput {
26
26
  participantIds?: string[];
27
27
  chatId?: string;
28
28
  idempotencyKey?: string;
29
+ /** Name for a new group. Pair rooms take no name. */
30
+ name?: string;
29
31
  newChat?: boolean;
30
32
  agreementId?: string;
31
33
  createIfMissing?: boolean;
@@ -38,6 +40,7 @@ export declare function openConversation(participant: string | OpenConversationI
38
40
  chatId: string;
39
41
  reused?: boolean;
40
42
  invited?: ChatOpenInvite[];
43
+ name?: string;
41
44
  }>;
42
45
  export interface SendChatMessageInput {
43
46
  /**
@@ -158,6 +161,7 @@ export declare class ChatClient {
158
161
  chatId: string;
159
162
  reused?: boolean;
160
163
  invited?: ChatOpenInvite[];
164
+ name?: string;
161
165
  }>;
162
166
  addMember(input: AddChatMemberInput): Promise<AddChatMemberResult>;
163
167
  sendMessage(input: SendChatMessageInput): Promise<SendChatMessageResult>;
@@ -38,12 +38,14 @@ export async function openConversation(participant, creds, { newChat = false, ag
38
38
  // the room — defaulting to false would report a reused conversation as fresh,
39
39
  // which is worse than saying nothing.
40
40
  const reused = data['reused'];
41
+ const name = data['name'];
41
42
  const invited = Array.isArray(data['invited'])
42
43
  ? data['invited']
43
44
  : undefined;
44
45
  return {
45
46
  chatId: data['chatId'],
46
47
  ...(typeof reused === 'boolean' ? { reused } : {}),
48
+ ...(typeof name === 'string' && name ? { name } : {}),
47
49
  ...(invited ? { invited } : {}),
48
50
  };
49
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",