@xmtp/convos-cli 0.1.0

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.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +572 -0
  3. package/bin/dev.js +4 -0
  4. package/bin/run.js +4 -0
  5. package/dist/baseCommand.d.ts +46 -0
  6. package/dist/baseCommand.js +171 -0
  7. package/dist/commands/agent/serve.d.ts +67 -0
  8. package/dist/commands/agent/serve.js +662 -0
  9. package/dist/commands/conversation/add-members.d.ts +19 -0
  10. package/dist/commands/conversation/add-members.js +39 -0
  11. package/dist/commands/conversation/consent-state.d.ts +18 -0
  12. package/dist/commands/conversation/consent-state.js +24 -0
  13. package/dist/commands/conversation/download-attachment.d.ts +28 -0
  14. package/dist/commands/conversation/download-attachment.js +164 -0
  15. package/dist/commands/conversation/explode.d.ts +24 -0
  16. package/dist/commands/conversation/explode.js +156 -0
  17. package/dist/commands/conversation/info.d.ts +22 -0
  18. package/dist/commands/conversation/info.js +79 -0
  19. package/dist/commands/conversation/invite.d.ts +26 -0
  20. package/dist/commands/conversation/invite.js +137 -0
  21. package/dist/commands/conversation/lock.d.ts +24 -0
  22. package/dist/commands/conversation/lock.js +98 -0
  23. package/dist/commands/conversation/members.d.ts +22 -0
  24. package/dist/commands/conversation/members.js +39 -0
  25. package/dist/commands/conversation/messages.d.ts +31 -0
  26. package/dist/commands/conversation/messages.js +141 -0
  27. package/dist/commands/conversation/permissions.d.ts +18 -0
  28. package/dist/commands/conversation/permissions.js +33 -0
  29. package/dist/commands/conversation/profiles.d.ts +22 -0
  30. package/dist/commands/conversation/profiles.js +80 -0
  31. package/dist/commands/conversation/remove-members.d.ts +19 -0
  32. package/dist/commands/conversation/remove-members.js +36 -0
  33. package/dist/commands/conversation/send-attachment.d.ts +30 -0
  34. package/dist/commands/conversation/send-attachment.js +187 -0
  35. package/dist/commands/conversation/send-reaction.d.ts +21 -0
  36. package/dist/commands/conversation/send-reaction.js +38 -0
  37. package/dist/commands/conversation/send-remote-attachment.d.ts +30 -0
  38. package/dist/commands/conversation/send-remote-attachment.js +96 -0
  39. package/dist/commands/conversation/send-reply.d.ts +32 -0
  40. package/dist/commands/conversation/send-reply.js +170 -0
  41. package/dist/commands/conversation/send-text.d.ts +24 -0
  42. package/dist/commands/conversation/send-text.js +64 -0
  43. package/dist/commands/conversation/stream.d.ts +24 -0
  44. package/dist/commands/conversation/stream.js +81 -0
  45. package/dist/commands/conversation/sync.d.ts +18 -0
  46. package/dist/commands/conversation/sync.js +25 -0
  47. package/dist/commands/conversation/update-consent.d.ts +19 -0
  48. package/dist/commands/conversation/update-consent.js +35 -0
  49. package/dist/commands/conversation/update-description.d.ts +19 -0
  50. package/dist/commands/conversation/update-description.js +28 -0
  51. package/dist/commands/conversation/update-name.d.ts +19 -0
  52. package/dist/commands/conversation/update-name.js +29 -0
  53. package/dist/commands/conversation/update-profile.d.ts +24 -0
  54. package/dist/commands/conversation/update-profile.js +97 -0
  55. package/dist/commands/conversations/create.d.ts +26 -0
  56. package/dist/commands/conversations/create.js +165 -0
  57. package/dist/commands/conversations/join.d.ts +27 -0
  58. package/dist/commands/conversations/join.js +232 -0
  59. package/dist/commands/conversations/list.d.ts +20 -0
  60. package/dist/commands/conversations/list.js +109 -0
  61. package/dist/commands/conversations/process-join-requests.d.ts +26 -0
  62. package/dist/commands/conversations/process-join-requests.js +261 -0
  63. package/dist/commands/conversations/sync.d.ts +19 -0
  64. package/dist/commands/conversations/sync.js +50 -0
  65. package/dist/commands/identity/create.d.ts +21 -0
  66. package/dist/commands/identity/create.js +56 -0
  67. package/dist/commands/identity/info.d.ts +22 -0
  68. package/dist/commands/identity/info.js +63 -0
  69. package/dist/commands/identity/list.d.ts +19 -0
  70. package/dist/commands/identity/list.js +59 -0
  71. package/dist/commands/identity/remove.d.ts +23 -0
  72. package/dist/commands/identity/remove.js +51 -0
  73. package/dist/commands/init.d.ts +16 -0
  74. package/dist/commands/init.js +91 -0
  75. package/dist/commands/reset.d.ts +17 -0
  76. package/dist/commands/reset.js +93 -0
  77. package/dist/help.d.ts +4 -0
  78. package/dist/help.js +31 -0
  79. package/dist/index.d.ts +9 -0
  80. package/dist/index.js +15 -0
  81. package/dist/utils/client.d.ts +8 -0
  82. package/dist/utils/client.js +58 -0
  83. package/dist/utils/config.d.ts +15 -0
  84. package/dist/utils/config.js +1 -0
  85. package/dist/utils/identities.d.ts +49 -0
  86. package/dist/utils/identities.js +92 -0
  87. package/dist/utils/invite.d.ts +70 -0
  88. package/dist/utils/invite.js +339 -0
  89. package/dist/utils/metadata.d.ts +39 -0
  90. package/dist/utils/metadata.js +180 -0
  91. package/dist/utils/mime.d.ts +2 -0
  92. package/dist/utils/mime.js +42 -0
  93. package/dist/utils/random.d.ts +5 -0
  94. package/dist/utils/random.js +19 -0
  95. package/dist/utils/upload.d.ts +14 -0
  96. package/dist/utils/upload.js +51 -0
  97. package/dist/utils/xmtp.d.ts +45 -0
  98. package/dist/utils/xmtp.js +298 -0
  99. package/oclif.manifest.json +5562 -0
  100. package/package.json +124 -0
  101. package/skills/convos-cli/SKILL.md +588 -0
@@ -0,0 +1,170 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { basename } from "node:path";
3
+ import { Args, Flags } from "@oclif/core";
4
+ import { encodeAttachment, encodeRemoteAttachment, encryptAttachment, encodeText, } from "@xmtp/node-sdk";
5
+ import { ConvosBaseCommand } from "../../baseCommand.js";
6
+ import { createClientForIdentity } from "../../utils/client.js";
7
+ import { createIdentityStore } from "../../utils/identities.js";
8
+ import { getMimeType } from "../../utils/mime.js";
9
+ import { getUploadProvider, INLINE_ATTACHMENT_MAX_BYTES, } from "../../utils/upload.js";
10
+ export default class ConversationSendReply extends ConvosBaseCommand {
11
+ static description = `Send a reply to a message.
12
+
13
+ By default, sends a text reply. Use --file to reply with a file
14
+ attachment instead. Small files (≤1MB) are sent inline; large files
15
+ are automatically encrypted and uploaded via the configured upload
16
+ provider, then sent as a remote attachment.`;
17
+ static examples = [
18
+ {
19
+ command: '<%= config.bin %> <%= command.id %> <conversation-id> <message-id> "Reply text"',
20
+ description: "Reply with text",
21
+ },
22
+ {
23
+ command: "<%= config.bin %> <%= command.id %> <conversation-id> <message-id> --file ./photo.jpg",
24
+ description: "Reply with a photo",
25
+ },
26
+ ];
27
+ static args = {
28
+ id: Args.string({ description: "The conversation ID", required: true }),
29
+ "message-id": Args.string({
30
+ description: "The message ID to reply to",
31
+ required: true,
32
+ }),
33
+ text: Args.string({ description: "The reply text" }),
34
+ };
35
+ static flags = {
36
+ ...ConvosBaseCommand.baseFlags,
37
+ file: Flags.string({
38
+ char: "f",
39
+ description: "Path to a file to send as the reply (instead of text)",
40
+ helpValue: "<path>",
41
+ }),
42
+ "mime-type": Flags.string({
43
+ description: "Override the auto-detected MIME type (with --file)",
44
+ helpValue: "<type>",
45
+ }),
46
+ remote: Flags.boolean({
47
+ description: "Force sending file as a remote attachment, even for small files",
48
+ default: false,
49
+ }),
50
+ "upload-provider": Flags.string({
51
+ description: "Upload provider for remote attachments",
52
+ helpValue: "<provider>",
53
+ }),
54
+ "upload-provider-token": Flags.string({
55
+ description: "Authentication token for the upload provider",
56
+ helpValue: "<token>",
57
+ }),
58
+ "upload-provider-gateway": Flags.string({
59
+ description: "Custom gateway URL for the upload provider",
60
+ helpValue: "<url>",
61
+ }),
62
+ };
63
+ async run() {
64
+ const { args, flags } = await this.parse(ConversationSendReply);
65
+ const config = {
66
+ ...this.getConvosConfig(),
67
+ ...(flags["upload-provider"] && {
68
+ uploadProvider: flags["upload-provider"],
69
+ }),
70
+ ...(flags["upload-provider-token"] && {
71
+ uploadProviderToken: flags["upload-provider-token"],
72
+ }),
73
+ ...(flags["upload-provider-gateway"] && {
74
+ uploadProviderGateway: flags["upload-provider-gateway"],
75
+ }),
76
+ };
77
+ const store = createIdentityStore();
78
+ const identity = store.getByConversationId(args.id);
79
+ if (!identity) {
80
+ this.error(`No identity found for conversation: ${args.id}`);
81
+ }
82
+ const client = await createClientForIdentity(identity, config);
83
+ const conversation = await client.conversations.getConversationById(args.id);
84
+ if (!conversation) {
85
+ this.error(`Conversation not found: ${args.id}`);
86
+ }
87
+ if (flags.file) {
88
+ await this.sendFileReply(args, flags, config, conversation);
89
+ }
90
+ else if (args.text) {
91
+ await this.sendTextReply(args, conversation);
92
+ }
93
+ else {
94
+ this.error('No content provided. Pass reply text as an argument or use --file.');
95
+ }
96
+ }
97
+ async sendTextReply(args, conversation) {
98
+ const reply = {
99
+ reference: args["message-id"],
100
+ content: encodeText(args.text),
101
+ };
102
+ const messageId = await conversation.sendReply(reply);
103
+ this.output({
104
+ success: true,
105
+ messageId,
106
+ conversationId: args.id,
107
+ referenceMessageId: args["message-id"],
108
+ text: args.text,
109
+ });
110
+ }
111
+ async sendFileReply(args, flags, config, conversation) {
112
+ const filePath = flags.file;
113
+ const content = await readFile(filePath);
114
+ const filename = basename(filePath);
115
+ const mimeType = flags["mime-type"] ?? getMimeType(filePath);
116
+ const attachment = { mimeType, content, filename };
117
+ const needsRemote = flags.remote || content.length > INLINE_ATTACHMENT_MAX_BYTES;
118
+ let encodedContent;
119
+ let type;
120
+ let url;
121
+ let providerName;
122
+ if (needsRemote) {
123
+ const provider = getUploadProvider(config);
124
+ if (!provider) {
125
+ this.error(`File is ${content.length} bytes (>${INLINE_ATTACHMENT_MAX_BYTES}). ` +
126
+ `Configure an upload provider to send large files.\n\n` +
127
+ `Set in your .env:\n` +
128
+ ` CONVOS_UPLOAD_PROVIDER=pinata\n` +
129
+ ` CONVOS_UPLOAD_PROVIDER_TOKEN=<your-jwt>\n\n` +
130
+ `Or use flags:\n` +
131
+ ` --upload-provider pinata --upload-provider-token <jwt>`);
132
+ }
133
+ const encrypted = encryptAttachment(attachment);
134
+ url = await provider.upload(encrypted.payload, filename, mimeType);
135
+ providerName = provider.name;
136
+ encodedContent = encodeRemoteAttachment({
137
+ url,
138
+ contentDigest: encrypted.contentDigest,
139
+ secret: encrypted.secret,
140
+ salt: encrypted.salt,
141
+ nonce: encrypted.nonce,
142
+ scheme: "https",
143
+ contentLength: encrypted.payload.length,
144
+ filename,
145
+ });
146
+ type = "remote";
147
+ }
148
+ else {
149
+ encodedContent = encodeAttachment(attachment);
150
+ type = "inline";
151
+ }
152
+ const reply = {
153
+ reference: args["message-id"],
154
+ content: encodedContent,
155
+ };
156
+ const messageId = await conversation.sendReply(reply);
157
+ this.output({
158
+ success: true,
159
+ messageId,
160
+ conversationId: args.id,
161
+ referenceMessageId: args["message-id"],
162
+ filename,
163
+ mimeType,
164
+ size: content.length,
165
+ type,
166
+ ...(url && { url }),
167
+ ...(providerName && { provider: providerName }),
168
+ });
169
+ }
170
+ }
@@ -0,0 +1,24 @@
1
+ import { ConvosBaseCommand } from "../../baseCommand.js";
2
+ export default class ConversationSendText extends ConvosBaseCommand {
3
+ static description: string;
4
+ static examples: {
5
+ command: string;
6
+ description: string;
7
+ }[];
8
+ static strict: boolean;
9
+ static args: {
10
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
+ };
12
+ static flags: {
13
+ text: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ "log-level": import("@oclif/core/interfaces").OptionFlag<"off" | "error" | "warn" | "info" | "debug" | "trace" | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ "structured-logging": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ "app-version": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ "env-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ env: import("@oclif/core/interfaces").OptionFlag<"local" | "dev" | "production" | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ "gateway-host": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ };
23
+ run(): Promise<void>;
24
+ }
@@ -0,0 +1,64 @@
1
+ import { Args, Flags } from "@oclif/core";
2
+ import { ConvosBaseCommand } from "../../baseCommand.js";
3
+ import { createClientForIdentity } from "../../utils/client.js";
4
+ import { createIdentityStore } from "../../utils/identities.js";
5
+ export default class ConversationSendText extends ConvosBaseCommand {
6
+ static description = `Send a text message to a conversation.
7
+
8
+ Automatically resolves the per-conversation identity and sends
9
+ the message using the correct XMTP client.
10
+
11
+ The text can be provided as a positional argument or via --text.
12
+ Use --text to avoid shell quoting issues (e.g. smart quotes on macOS).`;
13
+ static examples = [
14
+ {
15
+ command: '<%= config.bin %> <%= command.id %> <conversation-id> "Hello!"',
16
+ description: "Send a text message",
17
+ },
18
+ {
19
+ command: '<%= config.bin %> <%= command.id %> <conversation-id> --text "Hello!"',
20
+ description: "Send using --text flag (avoids shell quoting issues)",
21
+ },
22
+ ];
23
+ static strict = false;
24
+ static args = {
25
+ id: Args.string({
26
+ description: "The conversation ID",
27
+ required: true,
28
+ }),
29
+ };
30
+ static flags = {
31
+ ...ConvosBaseCommand.baseFlags,
32
+ text: Flags.string({
33
+ char: "t",
34
+ description: "The text message to send",
35
+ helpValue: "<message>",
36
+ }),
37
+ };
38
+ async run() {
39
+ const { args, argv, flags } = await this.parse(ConversationSendText);
40
+ const config = this.getConvosConfig();
41
+ const store = createIdentityStore();
42
+ // Text can come from --text flag or remaining positional args
43
+ const text = flags.text ?? argv.slice(1).join(" ");
44
+ if (!text) {
45
+ this.error("No message provided. Pass text as an argument or use --text.");
46
+ }
47
+ const identity = store.getByConversationId(args.id);
48
+ if (!identity) {
49
+ this.error(`No identity found for conversation: ${args.id}\nUse 'convos conversations list' to see available conversations.`);
50
+ }
51
+ const client = await createClientForIdentity(identity, config);
52
+ const conversation = await client.conversations.getConversationById(args.id);
53
+ if (!conversation) {
54
+ this.error(`Conversation not found: ${args.id}`);
55
+ }
56
+ const messageId = await conversation.sendText(text);
57
+ this.output({
58
+ success: true,
59
+ messageId,
60
+ conversationId: args.id,
61
+ text,
62
+ });
63
+ }
64
+ }
@@ -0,0 +1,24 @@
1
+ import { ConvosBaseCommand } from "../../baseCommand.js";
2
+ export default class ConversationStream extends ConvosBaseCommand {
3
+ static description: string;
4
+ static examples: {
5
+ command: string;
6
+ description: string;
7
+ }[];
8
+ static args: {
9
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
10
+ };
11
+ static flags: {
12
+ timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ count: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ "log-level": import("@oclif/core/interfaces").OptionFlag<"off" | "error" | "warn" | "info" | "debug" | "trace" | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ "structured-logging": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ "app-version": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ "env-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ env: import("@oclif/core/interfaces").OptionFlag<"local" | "dev" | "production" | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ "gateway-host": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ };
23
+ run(): Promise<void>;
24
+ }
@@ -0,0 +1,81 @@
1
+ import { Args, Flags } from "@oclif/core";
2
+ import { ConvosBaseCommand } from "../../baseCommand.js";
3
+ import { createClientForIdentity } from "../../utils/client.js";
4
+ import { createIdentityStore } from "../../utils/identities.js";
5
+ import { buildProfileMap, isDisplayableMessage, normalizeMessageContent, requireGroup, } from "../../utils/xmtp.js";
6
+ export default class ConversationStream extends ConvosBaseCommand {
7
+ static description = `Stream messages in a conversation.
8
+
9
+ Listens for new messages in real-time using the per-conversation identity.
10
+
11
+ The stream continues until timeout, count limit, or Ctrl+C.`;
12
+ static examples = [
13
+ {
14
+ command: "<%= config.bin %> <%= command.id %> <conversation-id>",
15
+ description: "Stream messages indefinitely",
16
+ },
17
+ {
18
+ command: "<%= config.bin %> <%= command.id %> <conversation-id> --timeout 60",
19
+ description: "Stream for 60 seconds",
20
+ },
21
+ ];
22
+ static args = {
23
+ id: Args.string({ description: "The conversation ID", required: true }),
24
+ };
25
+ static flags = {
26
+ ...ConvosBaseCommand.baseFlags,
27
+ timeout: Flags.integer({
28
+ description: "Stop streaming after N seconds",
29
+ helpValue: "<seconds>",
30
+ }),
31
+ count: Flags.integer({
32
+ description: "Stop after receiving N messages",
33
+ helpValue: "<number>",
34
+ }),
35
+ };
36
+ async run() {
37
+ const { args, flags } = await this.parse(ConversationStream);
38
+ const config = this.getConvosConfig();
39
+ const store = createIdentityStore();
40
+ const identity = store.getByConversationId(args.id);
41
+ if (!identity) {
42
+ this.error(`No identity found for conversation: ${args.id}`);
43
+ }
44
+ const client = await createClientForIdentity(identity, config);
45
+ const conversation = await client.conversations.getConversationById(args.id);
46
+ if (!conversation) {
47
+ this.error(`Conversation not found: ${args.id}`);
48
+ }
49
+ const group = requireGroup(conversation);
50
+ let messageCount = 0;
51
+ const stream = await conversation.stream();
52
+ let timeoutId;
53
+ if (flags.timeout) {
54
+ timeoutId = setTimeout(() => void stream.return(), flags.timeout * 1000);
55
+ }
56
+ try {
57
+ for await (const message of stream) {
58
+ if (!isDisplayableMessage(message))
59
+ continue;
60
+ // Rebuild profiles each time so newly-joined members are resolved
61
+ const profiles = buildProfileMap(group.appData ?? "");
62
+ this.streamOutput({
63
+ id: message.id,
64
+ senderInboxId: message.senderInboxId,
65
+ contentType: message.contentType,
66
+ content: normalizeMessageContent(message, profiles),
67
+ sentAt: message.sentAt.toISOString(),
68
+ deliveryStatus: message.deliveryStatus,
69
+ });
70
+ messageCount++;
71
+ if (flags.count && messageCount >= flags.count)
72
+ break;
73
+ }
74
+ }
75
+ finally {
76
+ if (timeoutId)
77
+ clearTimeout(timeoutId);
78
+ await stream.return();
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,18 @@
1
+ import { ConvosBaseCommand } from "../../baseCommand.js";
2
+ export default class ConversationSync extends ConvosBaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ "log-level": import("@oclif/core/interfaces").OptionFlag<"off" | "error" | "warn" | "info" | "debug" | "trace" | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ "structured-logging": import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ "app-version": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ "env-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ env: import("@oclif/core/interfaces").OptionFlag<"local" | "dev" | "production" | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ "gateway-host": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ };
17
+ run(): Promise<void>;
18
+ }
@@ -0,0 +1,25 @@
1
+ import { Args } from "@oclif/core";
2
+ import { ConvosBaseCommand } from "../../baseCommand.js";
3
+ import { createClientForIdentity } from "../../utils/client.js";
4
+ import { createIdentityStore } from "../../utils/identities.js";
5
+ export default class ConversationSync extends ConvosBaseCommand {
6
+ static description = `Sync a specific conversation from the network.`;
7
+ static args = {
8
+ id: Args.string({ description: "The conversation ID", required: true }),
9
+ };
10
+ static flags = { ...ConvosBaseCommand.baseFlags };
11
+ async run() {
12
+ const { args } = await this.parse(ConversationSync);
13
+ const config = this.getConvosConfig();
14
+ const store = createIdentityStore();
15
+ const identity = store.getByConversationId(args.id);
16
+ if (!identity)
17
+ this.error(`No identity found for conversation: ${args.id}`);
18
+ const client = await createClientForIdentity(identity, config);
19
+ const conversation = await client.conversations.getConversationById(args.id);
20
+ if (!conversation)
21
+ this.error(`Conversation not found: ${args.id}`);
22
+ await conversation.sync();
23
+ this.output({ success: true, conversationId: args.id });
24
+ }
25
+ }
@@ -0,0 +1,19 @@
1
+ import { ConvosBaseCommand } from "../../baseCommand.js";
2
+ export default class ConversationUpdateConsent extends ConvosBaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ state: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ "log-level": import("@oclif/core/interfaces").OptionFlag<"off" | "error" | "warn" | "info" | "debug" | "trace" | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ "structured-logging": import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ "app-version": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ "env-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ env: import("@oclif/core/interfaces").OptionFlag<"local" | "dev" | "production" | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ "gateway-host": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ };
18
+ run(): Promise<void>;
19
+ }
@@ -0,0 +1,35 @@
1
+ import { Args } from "@oclif/core";
2
+ import { ConvosBaseCommand } from "../../baseCommand.js";
3
+ import { createClientForIdentity } from "../../utils/client.js";
4
+ import { createIdentityStore } from "../../utils/identities.js";
5
+ export default class ConversationUpdateConsent extends ConvosBaseCommand {
6
+ static description = `Update the consent state of a conversation.`;
7
+ static args = {
8
+ id: Args.string({ description: "The conversation ID", required: true }),
9
+ state: Args.string({
10
+ description: "The new consent state",
11
+ required: true,
12
+ options: ["allowed", "denied", "unknown"],
13
+ }),
14
+ };
15
+ static flags = { ...ConvosBaseCommand.baseFlags };
16
+ async run() {
17
+ const { args } = await this.parse(ConversationUpdateConsent);
18
+ const config = this.getConvosConfig();
19
+ const store = createIdentityStore();
20
+ const identity = store.getByConversationId(args.id);
21
+ if (!identity)
22
+ this.error(`No identity found for conversation: ${args.id}`);
23
+ const client = await createClientForIdentity(identity, config);
24
+ const conversation = await client.conversations.getConversationById(args.id);
25
+ if (!conversation)
26
+ this.error(`Conversation not found: ${args.id}`);
27
+ const map = {
28
+ allowed: 1 /* ConsentState.Allowed */,
29
+ denied: 2 /* ConsentState.Denied */,
30
+ unknown: 0 /* ConsentState.Unknown */,
31
+ };
32
+ conversation.updateConsentState(map[args.state]);
33
+ this.output({ success: true, conversationId: args.id, consentState: args.state });
34
+ }
35
+ }
@@ -0,0 +1,19 @@
1
+ import { ConvosBaseCommand } from "../../baseCommand.js";
2
+ export default class ConversationUpdateDescription extends ConvosBaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ description: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ "log-level": import("@oclif/core/interfaces").OptionFlag<"off" | "error" | "warn" | "info" | "debug" | "trace" | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ "structured-logging": import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ "app-version": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ "env-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ env: import("@oclif/core/interfaces").OptionFlag<"local" | "dev" | "production" | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ "gateway-host": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ };
18
+ run(): Promise<void>;
19
+ }
@@ -0,0 +1,28 @@
1
+ import { Args } from "@oclif/core";
2
+ import { requireGroup } from "../../utils/xmtp.js";
3
+ import { ConvosBaseCommand } from "../../baseCommand.js";
4
+ import { createClientForIdentity } from "../../utils/client.js";
5
+ import { createIdentityStore } from "../../utils/identities.js";
6
+ export default class ConversationUpdateDescription extends ConvosBaseCommand {
7
+ static description = `Update the description of a conversation.`;
8
+ static args = {
9
+ id: Args.string({ description: "The conversation ID", required: true }),
10
+ description: Args.string({ description: "The new description", required: true }),
11
+ };
12
+ static flags = { ...ConvosBaseCommand.baseFlags };
13
+ async run() {
14
+ const { args } = await this.parse(ConversationUpdateDescription);
15
+ const config = this.getConvosConfig();
16
+ const store = createIdentityStore();
17
+ const identity = store.getByConversationId(args.id);
18
+ if (!identity)
19
+ this.error(`No identity found for conversation: ${args.id}`);
20
+ const client = await createClientForIdentity(identity, config);
21
+ const conversation = await client.conversations.getConversationById(args.id);
22
+ if (!conversation)
23
+ this.error(`Conversation not found: ${args.id}`);
24
+ const group = requireGroup(conversation);
25
+ await group.updateDescription(args.description);
26
+ this.output({ success: true, conversationId: args.id, description: args.description });
27
+ }
28
+ }
@@ -0,0 +1,19 @@
1
+ import { ConvosBaseCommand } from "../../baseCommand.js";
2
+ export default class ConversationUpdateName extends ConvosBaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ "log-level": import("@oclif/core/interfaces").OptionFlag<"off" | "error" | "warn" | "info" | "debug" | "trace" | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ "structured-logging": import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ "app-version": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ "env-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ env: import("@oclif/core/interfaces").OptionFlag<"local" | "dev" | "production" | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ "gateway-host": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ };
18
+ run(): Promise<void>;
19
+ }
@@ -0,0 +1,29 @@
1
+ import { Args } from "@oclif/core";
2
+ import { requireGroup } from "../../utils/xmtp.js";
3
+ import { ConvosBaseCommand } from "../../baseCommand.js";
4
+ import { createClientForIdentity } from "../../utils/client.js";
5
+ import { createIdentityStore } from "../../utils/identities.js";
6
+ export default class ConversationUpdateName extends ConvosBaseCommand {
7
+ static description = `Update the name of a conversation. Visible to all members.`;
8
+ static args = {
9
+ id: Args.string({ description: "The conversation ID", required: true }),
10
+ name: Args.string({ description: "The new name", required: true }),
11
+ };
12
+ static flags = { ...ConvosBaseCommand.baseFlags };
13
+ async run() {
14
+ const { args } = await this.parse(ConversationUpdateName);
15
+ const config = this.getConvosConfig();
16
+ const store = createIdentityStore();
17
+ const identity = store.getByConversationId(args.id);
18
+ if (!identity)
19
+ this.error(`No identity found for conversation: ${args.id}`);
20
+ const client = await createClientForIdentity(identity, config);
21
+ const conversation = await client.conversations.getConversationById(args.id);
22
+ if (!conversation)
23
+ this.error(`Conversation not found: ${args.id}`);
24
+ const group = requireGroup(conversation);
25
+ await group.updateName(args.name);
26
+ store.update(identity.id, { label: args.name });
27
+ this.output({ success: true, conversationId: args.id, name: args.name });
28
+ }
29
+ }
@@ -0,0 +1,24 @@
1
+ import { ConvosBaseCommand } from "../../baseCommand.js";
2
+ export default class UpdateProfile extends ConvosBaseCommand {
3
+ static description: string;
4
+ static examples: {
5
+ command: string;
6
+ description: string;
7
+ }[];
8
+ static args: {
9
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
10
+ };
11
+ static flags: {
12
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ image: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ "log-level": import("@oclif/core/interfaces").OptionFlag<"off" | "error" | "warn" | "info" | "debug" | "trace" | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ "structured-logging": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ "app-version": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ "env-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ env: import("@oclif/core/interfaces").OptionFlag<"local" | "dev" | "production" | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ "gateway-host": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ };
23
+ run(): Promise<void>;
24
+ }