@fulldivevr/workcord-cli 1.0.0 → 1.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 (77) hide show
  1. package/README.md +67 -25
  2. package/dist/auth.js +38 -4
  3. package/dist/client.js +5 -5
  4. package/dist/commands/auth.js +7 -2
  5. package/dist/commands/challenges.js +2 -7
  6. package/dist/commands/custom-agents.js +3 -8
  7. package/dist/commands/dm.js +2 -3
  8. package/dist/commands/messages.js +8 -21
  9. package/dist/commands/room-agents.js +2 -7
  10. package/dist/commands/rooms.js +24 -31
  11. package/dist/commands/users.js +4 -9
  12. package/dist/commands/whoami.js +24 -7
  13. package/dist/generated/commands/activity.js +3 -6
  14. package/dist/generated/commands/ai.js +3 -6
  15. package/dist/generated/commands/ambassador.js +3 -6
  16. package/dist/generated/commands/apple-iap.js +4 -9
  17. package/dist/generated/commands/attribution.js +6 -15
  18. package/dist/generated/commands/auth.js +9 -24
  19. package/dist/generated/commands/challenges.js +13 -36
  20. package/dist/generated/commands/clips.js +3 -6
  21. package/dist/generated/commands/contact-match.js +7 -18
  22. package/dist/generated/commands/content-crawler.js +2 -3
  23. package/dist/generated/commands/custom-agents.js +22 -63
  24. package/dist/generated/commands/desktop-releases.js +5 -12
  25. package/dist/generated/commands/discover.js +9 -24
  26. package/dist/generated/commands/dm.js +10 -27
  27. package/dist/generated/commands/drafts.js +3 -6
  28. package/dist/generated/commands/embed.js +3 -6
  29. package/dist/generated/commands/explore.js +2 -3
  30. package/dist/generated/commands/feed.js +4 -9
  31. package/dist/generated/commands/feedback.js +2 -3
  32. package/dist/generated/commands/gamification.js +3 -6
  33. package/dist/generated/commands/google-play-iap.js +4 -9
  34. package/dist/generated/commands/health.js +3 -6
  35. package/dist/generated/commands/internal.js +9 -24
  36. package/dist/generated/commands/interview.js +4 -9
  37. package/dist/generated/commands/invite-redirect.js +2 -3
  38. package/dist/generated/commands/jesuscord-admin.js +3 -6
  39. package/dist/generated/commands/join.js +2 -3
  40. package/dist/generated/commands/kits.js +7 -18
  41. package/dist/generated/commands/meetings.js +6 -15
  42. package/dist/generated/commands/message-folders.js +5 -12
  43. package/dist/generated/commands/messages.js +17 -48
  44. package/dist/generated/commands/one-emulator.js +2 -3
  45. package/dist/generated/commands/pdf-export.js +2 -3
  46. package/dist/generated/commands/pin-folders.js +5 -12
  47. package/dist/generated/commands/pinned-messages.js +4 -9
  48. package/dist/generated/commands/polls.js +6 -15
  49. package/dist/generated/commands/premium-feeds.js +2 -3
  50. package/dist/generated/commands/processors.js +2 -3
  51. package/dist/generated/commands/questions.js +3 -6
  52. package/dist/generated/commands/referrals.js +2 -3
  53. package/dist/generated/commands/reports.js +2 -3
  54. package/dist/generated/commands/room-a2-a.js +6 -15
  55. package/dist/generated/commands/room-agents.js +13 -36
  56. package/dist/generated/commands/room-invites.js +9 -24
  57. package/dist/generated/commands/room-owned-agent.js +3 -6
  58. package/dist/generated/commands/room-page.js +2 -3
  59. package/dist/generated/commands/rooms.js +45 -132
  60. package/dist/generated/commands/saved-messages.js +4 -9
  61. package/dist/generated/commands/saved-stories.js +7 -18
  62. package/dist/generated/commands/search.js +2 -3
  63. package/dist/generated/commands/shadow-home-agent.js +3 -6
  64. package/dist/generated/commands/shadow.js +5 -12
  65. package/dist/generated/commands/share-cards.js +4 -9
  66. package/dist/generated/commands/share.js +2 -3
  67. package/dist/generated/commands/sponsors.js +2 -3
  68. package/dist/generated/commands/stories.js +12 -33
  69. package/dist/generated/commands/story-by-id.js +2 -3
  70. package/dist/generated/commands/submissions.js +4 -9
  71. package/dist/generated/commands/subscriptions.js +8 -21
  72. package/dist/generated/commands/tips.js +3 -6
  73. package/dist/generated/commands/users.js +16 -45
  74. package/dist/generated/commands/voice-token.js +2 -3
  75. package/dist/generated/commands/well-known.js +3 -6
  76. package/dist/generated/commands/wrapped.js +2 -3
  77. package/package.json +3 -2
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "challenges", "Challenges operations");
@@ -17,9 +18,7 @@ export function register(program) {
17
18
  .requiredOption("--starts-at <value>", "string")
18
19
  .requiredOption("--ends-at <value>", "string")
19
20
  .action(async (opts) => {
20
- const { as } = program.opts();
21
- if (!as)
22
- throw new Error("--as <userId> is required");
21
+ const as = actingUserId(program);
23
22
  const path = `/api/v1/challenges`;
24
23
  const body = {};
25
24
  {
@@ -83,9 +82,7 @@ export function register(program) {
83
82
  .requiredOption("--room-id <value>", "roomId (path param)")
84
83
  .option("--challenge-id <json>", " (JSON)")
85
84
  .action(async (opts) => {
86
- const { as } = program.opts();
87
- if (!as)
88
- throw new Error("--as <userId> is required");
85
+ const as = actingUserId(program);
89
86
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/challenge/current`;
90
87
  const query = {};
91
88
  {
@@ -104,9 +101,7 @@ export function register(program) {
104
101
  .requiredOption("--id <value>", "id (path param)")
105
102
  .option("--body <json>", "request body as JSON (no schema available)")
106
103
  .action(async (opts) => {
107
- const { as } = program.opts();
108
- if (!as)
109
- throw new Error("--as <userId> is required");
104
+ const as = actingUserId(program);
110
105
  const path = `/api/v1/challenges/${encodeURIComponent(opts.id)}/join`;
111
106
  const body = opts.body ? JSON.parse(opts.body) : undefined;
112
107
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -119,9 +114,7 @@ export function register(program) {
119
114
  .description("GET /api/v1/challenges/{id}/card")
120
115
  .requiredOption("--id <value>", "id (path param)")
121
116
  .action(async (opts) => {
122
- const { as } = program.opts();
123
- if (!as)
124
- throw new Error("--as <userId> is required");
117
+ const as = actingUserId(program);
125
118
  const path = `/api/v1/challenges/${encodeURIComponent(opts.id)}/card`;
126
119
  const data = await call({ method: "GET", path, asUserId: as });
127
120
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -133,9 +126,7 @@ export function register(program) {
133
126
  .description("GET /api/v1/challenges/{id}/leaderboard")
134
127
  .requiredOption("--id <value>", "id (path param)")
135
128
  .action(async (opts) => {
136
- const { as } = program.opts();
137
- if (!as)
138
- throw new Error("--as <userId> is required");
129
+ const as = actingUserId(program);
139
130
  const path = `/api/v1/challenges/${encodeURIComponent(opts.id)}/leaderboard`;
140
131
  const data = await call({ method: "GET", path, asUserId: as });
141
132
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -147,9 +138,7 @@ export function register(program) {
147
138
  .description("GET /api/v1/challenges/invite/{inviteCode}")
148
139
  .requiredOption("--invite-code <value>", "inviteCode (path param)")
149
140
  .action(async (opts) => {
150
- const { as } = program.opts();
151
- if (!as)
152
- throw new Error("--as <userId> is required");
141
+ const as = actingUserId(program);
153
142
  const path = `/api/v1/challenges/invite/${encodeURIComponent(opts.inviteCode)}`;
154
143
  const data = await call({ method: "GET", path, asUserId: as });
155
144
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -162,9 +151,7 @@ export function register(program) {
162
151
  .requiredOption("--invite-code <value>", "inviteCode (path param)")
163
152
  .option("--body <json>", "request body as JSON (no schema available)")
164
153
  .action(async (opts) => {
165
- const { as } = program.opts();
166
- if (!as)
167
- throw new Error("--as <userId> is required");
154
+ const as = actingUserId(program);
168
155
  const path = `/api/v1/challenges/invite/${encodeURIComponent(opts.inviteCode)}/click`;
169
156
  const body = opts.body ? JSON.parse(opts.body) : undefined;
170
157
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -177,9 +164,7 @@ export function register(program) {
177
164
  .description("GET /api/v1/rooms/{roomId}/challenges")
178
165
  .requiredOption("--room-id <value>", "roomId (path param)")
179
166
  .action(async (opts) => {
180
- const { as } = program.opts();
181
- if (!as)
182
- throw new Error("--as <userId> is required");
167
+ const as = actingUserId(program);
183
168
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/challenges`;
184
169
  const data = await call({ method: "GET", path, asUserId: as });
185
170
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -192,9 +177,7 @@ export function register(program) {
192
177
  .requiredOption("--id <value>", "id (path param)")
193
178
  .option("--body <json>", "request body as JSON (no schema available)")
194
179
  .action(async (opts) => {
195
- const { as } = program.opts();
196
- if (!as)
197
- throw new Error("--as <userId> is required");
180
+ const as = actingUserId(program);
198
181
  const path = `/api/v1/challenges/${encodeURIComponent(opts.id)}/close`;
199
182
  const body = opts.body ? JSON.parse(opts.body) : undefined;
200
183
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -208,9 +191,7 @@ export function register(program) {
208
191
  .requiredOption("--id <value>", "id (path param)")
209
192
  .option("--body <json>", "request body as JSON (no schema available)")
210
193
  .action(async (opts) => {
211
- const { as } = program.opts();
212
- if (!as)
213
- throw new Error("--as <userId> is required");
194
+ const as = actingUserId(program);
214
195
  const path = `/api/v1/challenges/${encodeURIComponent(opts.id)}/regenerate-image`;
215
196
  const body = opts.body ? JSON.parse(opts.body) : undefined;
216
197
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -224,9 +205,7 @@ export function register(program) {
224
205
  .requiredOption("--id <value>", "id (path param)")
225
206
  .option("--body <json>", "request body as JSON (no schema available)")
226
207
  .action(async (opts) => {
227
- const { as } = program.opts();
228
- if (!as)
229
- throw new Error("--as <userId> is required");
208
+ const as = actingUserId(program);
230
209
  const path = `/api/v1/challenges/${encodeURIComponent(opts.id)}/regenerate-cards`;
231
210
  const body = opts.body ? JSON.parse(opts.body) : undefined;
232
211
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -239,9 +218,7 @@ export function register(program) {
239
218
  .description("DELETE /api/v1/challenges/{id}")
240
219
  .requiredOption("--id <value>", "id (path param)")
241
220
  .action(async (opts) => {
242
- const { as } = program.opts();
243
- if (!as)
244
- throw new Error("--as <userId> is required");
221
+ const as = actingUserId(program);
245
222
  const path = `/api/v1/challenges/${encodeURIComponent(opts.id)}`;
246
223
  const data = await call({ method: "DELETE", path, asUserId: as });
247
224
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "clips", "Clips operations");
@@ -12,9 +13,7 @@ export function register(program) {
12
13
  .option("--show-source-logos <true|false>", "boolean")
13
14
  .option("--show-end-card <true|false>", "boolean")
14
15
  .action(async (opts) => {
15
- const { as } = program.opts();
16
- if (!as)
17
- throw new Error("--as <userId> is required");
16
+ const as = actingUserId(program);
18
17
  const path = `/api/v1/stories/${encodeURIComponent(opts.storyId)}/clips`;
19
18
  const body = {};
20
19
  {
@@ -48,9 +47,7 @@ export function register(program) {
48
47
  .option("--cursor <value>", "string")
49
48
  .option("--limit <value>", "string")
50
49
  .action(async (opts) => {
51
- const { as } = program.opts();
52
- if (!as)
53
- throw new Error("--as <userId> is required");
50
+ const as = actingUserId(program);
54
51
  const path = `/api/v1/users/me/clips`;
55
52
  const query = {};
56
53
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "contact-match", "ContactMatch operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/users/me/contacts/match")
9
10
  .option("--body <json>", "request body as JSON (no schema available)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/users/me/contacts/match`;
15
14
  const body = opts.body ? JSON.parse(opts.body) : undefined;
16
15
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -22,9 +21,7 @@ export function register(program) {
22
21
  .command("list")
23
22
  .description("GET /api/v1/users/me/contacts")
24
23
  .action(async (opts) => {
25
- const { as } = program.opts();
26
- if (!as)
27
- throw new Error("--as <userId> is required");
24
+ const as = actingUserId(program);
28
25
  const path = `/api/v1/users/me/contacts`;
29
26
  const data = await call({ method: "GET", path, asUserId: as });
30
27
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -36,9 +33,7 @@ export function register(program) {
36
33
  .description("POST /api/v1/users/me/contacts/sync")
37
34
  .option("--body <json>", "request body as JSON (no schema available)")
38
35
  .action(async (opts) => {
39
- const { as } = program.opts();
40
- if (!as)
41
- throw new Error("--as <userId> is required");
36
+ const as = actingUserId(program);
42
37
  const path = `/api/v1/users/me/contacts/sync`;
43
38
  const body = opts.body ? JSON.parse(opts.body) : undefined;
44
39
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -51,9 +46,7 @@ export function register(program) {
51
46
  .description("POST /api/v1/users/me/contacts/add")
52
47
  .option("--body <json>", "request body as JSON (no schema available)")
53
48
  .action(async (opts) => {
54
- const { as } = program.opts();
55
- if (!as)
56
- throw new Error("--as <userId> is required");
49
+ const as = actingUserId(program);
57
50
  const path = `/api/v1/users/me/contacts/add`;
58
51
  const body = opts.body ? JSON.parse(opts.body) : undefined;
59
52
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -66,9 +59,7 @@ export function register(program) {
66
59
  .description("DELETE /api/v1/users/me/contacts/{contactId}")
67
60
  .requiredOption("--contact-id <value>", "contactId (path param)")
68
61
  .action(async (opts) => {
69
- const { as } = program.opts();
70
- if (!as)
71
- throw new Error("--as <userId> is required");
62
+ const as = actingUserId(program);
72
63
  const path = `/api/v1/users/me/contacts/${encodeURIComponent(opts.contactId)}`;
73
64
  const data = await call({ method: "DELETE", path, asUserId: as });
74
65
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -80,9 +71,7 @@ export function register(program) {
80
71
  .description("GET /api/v1/users/me/contacts/check/{userId}")
81
72
  .requiredOption("--user-id <value>", "userId (path param)")
82
73
  .action(async (opts) => {
83
- const { as } = program.opts();
84
- if (!as)
85
- throw new Error("--as <userId> is required");
74
+ const as = actingUserId(program);
86
75
  const path = `/api/v1/users/me/contacts/check/${encodeURIComponent(opts.userId)}`;
87
76
  const data = await call({ method: "GET", path, asUserId: as });
88
77
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "content-crawler", "ContentCrawler operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--room-id <value>", "roomId (path param)")
10
11
  .requiredOption("--query <value>", "string")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/content-search`;
16
15
  const body = {};
17
16
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "custom-agents", "CustomAgents operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/agents")
9
10
  .option("--body <json>", "request body as JSON (no schema available)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/agents`;
15
14
  const body = opts.body ? JSON.parse(opts.body) : undefined;
16
15
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -23,9 +22,7 @@ export function register(program) {
23
22
  .description("GET /api/v1/agents/mine")
24
23
  .option("--include-shadow <value>", "string")
25
24
  .action(async (opts) => {
26
- const { as } = program.opts();
27
- if (!as)
28
- throw new Error("--as <userId> is required");
25
+ const as = actingUserId(program);
29
26
  const path = `/api/v1/agents/mine`;
30
27
  const query = {};
31
28
  {
@@ -42,9 +39,7 @@ export function register(program) {
42
39
  .command("get-config")
43
40
  .description("GET /api/v1/agents/config")
44
41
  .action(async (opts) => {
45
- const { as } = program.opts();
46
- if (!as)
47
- throw new Error("--as <userId> is required");
42
+ const as = actingUserId(program);
48
43
  const path = `/api/v1/agents/config`;
49
44
  const data = await call({ method: "GET", path, asUserId: as });
50
45
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -55,9 +50,7 @@ export function register(program) {
55
50
  .command("get-mcp-catalog")
56
51
  .description("GET /api/v1/agents/mcp-catalog")
57
52
  .action(async (opts) => {
58
- const { as } = program.opts();
59
- if (!as)
60
- throw new Error("--as <userId> is required");
53
+ const as = actingUserId(program);
61
54
  const path = `/api/v1/agents/mcp-catalog`;
62
55
  const data = await call({ method: "GET", path, asUserId: as });
63
56
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -68,9 +61,7 @@ export function register(program) {
68
61
  .command("list-hermes-flavors")
69
62
  .description("GET /api/v1/agents/hermes-flavors")
70
63
  .action(async (opts) => {
71
- const { as } = program.opts();
72
- if (!as)
73
- throw new Error("--as <userId> is required");
64
+ const as = actingUserId(program);
74
65
  const path = `/api/v1/agents/hermes-flavors`;
75
66
  const data = await call({ method: "GET", path, asUserId: as });
76
67
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -82,9 +73,7 @@ export function register(program) {
82
73
  .description("POST /api/v1/agents/hermes-flavors")
83
74
  .option("--body <json>", "request body as JSON (no schema available)")
84
75
  .action(async (opts) => {
85
- const { as } = program.opts();
86
- if (!as)
87
- throw new Error("--as <userId> is required");
76
+ const as = actingUserId(program);
88
77
  const path = `/api/v1/agents/hermes-flavors`;
89
78
  const body = opts.body ? JSON.parse(opts.body) : undefined;
90
79
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -98,9 +87,7 @@ export function register(program) {
98
87
  .requiredOption("--flavor-id <value>", "flavorId (path param)")
99
88
  .requiredOption("--version <value>", "version (path param)")
100
89
  .action(async (opts) => {
101
- const { as } = program.opts();
102
- if (!as)
103
- throw new Error("--as <userId> is required");
90
+ const as = actingUserId(program);
104
91
  const path = `/api/v1/agents/hermes-flavors/${encodeURIComponent(opts.flavorId)}/versions/${encodeURIComponent(opts.version)}/contents`;
105
92
  const data = await call({ method: "GET", path, asUserId: as });
106
93
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -115,9 +102,7 @@ export function register(program) {
115
102
  .option("--page <value>", "string")
116
103
  .option("--limit <value>", "string")
117
104
  .action(async (opts) => {
118
- const { as } = program.opts();
119
- if (!as)
120
- throw new Error("--as <userId> is required");
105
+ const as = actingUserId(program);
121
106
  const path = `/api/v1/agents/marketplace`;
122
107
  const query = {};
123
108
  {
@@ -150,9 +135,7 @@ export function register(program) {
150
135
  .description("GET /api/v1/agents/marketplace/{id}")
151
136
  .requiredOption("--id <value>", "id (path param)")
152
137
  .action(async (opts) => {
153
- const { as } = program.opts();
154
- if (!as)
155
- throw new Error("--as <userId> is required");
138
+ const as = actingUserId(program);
156
139
  const path = `/api/v1/agents/marketplace/${encodeURIComponent(opts.id)}`;
157
140
  const data = await call({ method: "GET", path, asUserId: as });
158
141
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -164,9 +147,7 @@ export function register(program) {
164
147
  .description("GET /api/v1/agents/{id}")
165
148
  .requiredOption("--id <value>", "id (path param)")
166
149
  .action(async (opts) => {
167
- const { as } = program.opts();
168
- if (!as)
169
- throw new Error("--as <userId> is required");
150
+ const as = actingUserId(program);
170
151
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}`;
171
152
  const data = await call({ method: "GET", path, asUserId: as });
172
153
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -179,9 +160,7 @@ export function register(program) {
179
160
  .requiredOption("--id <value>", "id (path param)")
180
161
  .option("--body <json>", "request body as JSON (no schema available)")
181
162
  .action(async (opts) => {
182
- const { as } = program.opts();
183
- if (!as)
184
- throw new Error("--as <userId> is required");
163
+ const as = actingUserId(program);
185
164
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}`;
186
165
  const body = opts.body ? JSON.parse(opts.body) : undefined;
187
166
  const data = await call({ method: "PATCH", path, asUserId: as, body });
@@ -194,9 +173,7 @@ export function register(program) {
194
173
  .description("DELETE /api/v1/agents/{id}")
195
174
  .requiredOption("--id <value>", "id (path param)")
196
175
  .action(async (opts) => {
197
- const { as } = program.opts();
198
- if (!as)
199
- throw new Error("--as <userId> is required");
176
+ const as = actingUserId(program);
200
177
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}`;
201
178
  const data = await call({ method: "DELETE", path, asUserId: as });
202
179
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -209,9 +186,7 @@ export function register(program) {
209
186
  .requiredOption("--id <value>", "id (path param)")
210
187
  .option("--body <json>", "request body as JSON (no schema available)")
211
188
  .action(async (opts) => {
212
- const { as } = program.opts();
213
- if (!as)
214
- throw new Error("--as <userId> is required");
189
+ const as = actingUserId(program);
215
190
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}/icon`;
216
191
  const body = opts.body ? JSON.parse(opts.body) : undefined;
217
192
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -225,9 +200,7 @@ export function register(program) {
225
200
  .requiredOption("--id <value>", "id (path param)")
226
201
  .option("--body <json>", "request body as JSON (no schema available)")
227
202
  .action(async (opts) => {
228
- const { as } = program.opts();
229
- if (!as)
230
- throw new Error("--as <userId> is required");
203
+ const as = actingUserId(program);
231
204
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}/keys`;
232
205
  const body = opts.body ? JSON.parse(opts.body) : undefined;
233
206
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -240,9 +213,7 @@ export function register(program) {
240
213
  .description("GET /api/v1/agents/{id}/keys")
241
214
  .requiredOption("--id <value>", "id (path param)")
242
215
  .action(async (opts) => {
243
- const { as } = program.opts();
244
- if (!as)
245
- throw new Error("--as <userId> is required");
216
+ const as = actingUserId(program);
246
217
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}/keys`;
247
218
  const data = await call({ method: "GET", path, asUserId: as });
248
219
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -255,9 +226,7 @@ export function register(program) {
255
226
  .requiredOption("--id <value>", "id (path param)")
256
227
  .requiredOption("--key-id <value>", "keyId (path param)")
257
228
  .action(async (opts) => {
258
- const { as } = program.opts();
259
- if (!as)
260
- throw new Error("--as <userId> is required");
229
+ const as = actingUserId(program);
261
230
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}/keys/${encodeURIComponent(opts.keyId)}`;
262
231
  const data = await call({ method: "DELETE", path, asUserId: as });
263
232
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -270,9 +239,7 @@ export function register(program) {
270
239
  .requiredOption("--room-id <value>", "roomId (path param)")
271
240
  .option("--body <json>", "request body as JSON (no schema available)")
272
241
  .action(async (opts) => {
273
- const { as } = program.opts();
274
- if (!as)
275
- throw new Error("--as <userId> is required");
242
+ const as = actingUserId(program);
276
243
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/agents/install-hermes-flavor`;
277
244
  const body = opts.body ? JSON.parse(opts.body) : undefined;
278
245
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -287,9 +254,7 @@ export function register(program) {
287
254
  .requiredOption("--agent-id <value>", "agentId (path param)")
288
255
  .option("--body <json>", "request body as JSON (no schema available)")
289
256
  .action(async (opts) => {
290
- const { as } = program.opts();
291
- if (!as)
292
- throw new Error("--as <userId> is required");
257
+ const as = actingUserId(program);
293
258
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/agents/install/${encodeURIComponent(opts.agentId)}`;
294
259
  const body = opts.body ? JSON.parse(opts.body) : undefined;
295
260
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -303,9 +268,7 @@ export function register(program) {
303
268
  .requiredOption("--id <value>", "id (path param)")
304
269
  .option("--body <json>", "request body as JSON (no schema available)")
305
270
  .action(async (opts) => {
306
- const { as } = program.opts();
307
- if (!as)
308
- throw new Error("--as <userId> is required");
271
+ const as = actingUserId(program);
309
272
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}/start-dm`;
310
273
  const body = opts.body ? JSON.parse(opts.body) : undefined;
311
274
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -318,9 +281,7 @@ export function register(program) {
318
281
  .description("GET /api/v1/agents/{id}/.well-known/agent.json")
319
282
  .requiredOption("--id <value>", "id (path param)")
320
283
  .action(async (opts) => {
321
- const { as } = program.opts();
322
- if (!as)
323
- throw new Error("--as <userId> is required");
284
+ const as = actingUserId(program);
324
285
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}/.well-known/agent.json`;
325
286
  const data = await call({ method: "GET", path, asUserId: as });
326
287
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -333,9 +294,7 @@ export function register(program) {
333
294
  .requiredOption("--id <value>", "id (path param)")
334
295
  .option("--body <json>", "request body as JSON (no schema available)")
335
296
  .action(async (opts) => {
336
- const { as } = program.opts();
337
- if (!as)
338
- throw new Error("--as <userId> is required");
297
+ const as = actingUserId(program);
339
298
  const path = `/api/v1/agents/${encodeURIComponent(opts.id)}/a2a`;
340
299
  const body = opts.body ? JSON.parse(opts.body) : undefined;
341
300
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "desktop-releases", "DesktopReleases operations");
@@ -12,9 +13,7 @@ export function register(program) {
12
13
  .requiredOption("--arch <value>", "string")
13
14
  .requiredOption("--files <json>", "array (JSON)")
14
15
  .action(async (opts) => {
15
- const { as } = program.opts();
16
- if (!as)
17
- throw new Error("--as <userId> is required");
16
+ const as = actingUserId(program);
18
17
  const path = `/api/v1/desktop/releases/upload-url`;
19
18
  const body = {};
20
19
  {
@@ -64,9 +63,7 @@ export function register(program) {
64
63
  .option("--release-notes <value>", "string")
65
64
  .option("--is-updater-payload <true|false>", "boolean")
66
65
  .action(async (opts) => {
67
- const { as } = program.opts();
68
- if (!as)
69
- throw new Error("--as <userId> is required");
66
+ const as = actingUserId(program);
70
67
  const path = `/api/v1/desktop/releases`;
71
68
  const body = {};
72
69
  {
@@ -149,9 +146,7 @@ export function register(program) {
149
146
  .option("--cursor <value>", "string")
150
147
  .option("--limit <value>", "string")
151
148
  .action(async (opts) => {
152
- const { as } = program.opts();
153
- if (!as)
154
- throw new Error("--as <userId> is required");
149
+ const as = actingUserId(program);
155
150
  const path = `/api/v1/desktop/releases`;
156
151
  const query = {};
157
152
  {
@@ -198,9 +193,7 @@ export function register(program) {
198
193
  .option("--arch <value>", "string")
199
194
  .option("--file-type <value>", "string")
200
195
  .action(async (opts) => {
201
- const { as } = program.opts();
202
- if (!as)
203
- throw new Error("--as <userId> is required");
196
+ const as = actingUserId(program);
204
197
  const path = `/api/v1/desktop/releases/latest`;
205
198
  const query = {};
206
199
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "discover", "Discover operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("tags")
8
9
  .description("GET /api/v1/discover/tags")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/api/v1/discover/tags`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -28,9 +27,7 @@ export function register(program) {
28
27
  .option("--limit <value>", "string")
29
28
  .option("--page <value>", "string")
30
29
  .action(async (opts) => {
31
- const { as } = program.opts();
32
- if (!as)
33
- throw new Error("--as <userId> is required");
30
+ const as = actingUserId(program);
34
31
  const path = `/api/v1/discover/rooms`;
35
32
  const query = {};
36
33
  {
@@ -82,9 +79,7 @@ export function register(program) {
82
79
  .command("trending-rooms")
83
80
  .description("GET /api/v1/discover/rooms/trending")
84
81
  .action(async (opts) => {
85
- const { as } = program.opts();
86
- if (!as)
87
- throw new Error("--as <userId> is required");
82
+ const as = actingUserId(program);
88
83
  const path = `/api/v1/discover/rooms/trending`;
89
84
  const data = await call({ method: "GET", path, asUserId: as });
90
85
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -96,9 +91,7 @@ export function register(program) {
96
91
  .description("GET /api/v1/discover/rooms/by-slug/{slug}")
97
92
  .requiredOption("--slug <value>", "slug (path param)")
98
93
  .action(async (opts) => {
99
- const { as } = program.opts();
100
- if (!as)
101
- throw new Error("--as <userId> is required");
94
+ const as = actingUserId(program);
102
95
  const path = `/api/v1/discover/rooms/by-slug/${encodeURIComponent(opts.slug)}`;
103
96
  const data = await call({ method: "GET", path, asUserId: as });
104
97
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -110,9 +103,7 @@ export function register(program) {
110
103
  .description("GET /api/v1/discover/stories/trending")
111
104
  .option("--limit <value>", "string")
112
105
  .action(async (opts) => {
113
- const { as } = program.opts();
114
- if (!as)
115
- throw new Error("--as <userId> is required");
106
+ const as = actingUserId(program);
116
107
  const path = `/api/v1/discover/stories/trending`;
117
108
  const query = {};
118
109
  {
@@ -137,9 +128,7 @@ export function register(program) {
137
128
  .option("--limit <value>", "string")
138
129
  .option("--page <value>", "string")
139
130
  .action(async (opts) => {
140
- const { as } = program.opts();
141
- if (!as)
142
- throw new Error("--as <userId> is required");
131
+ const as = actingUserId(program);
143
132
  const path = `/api/v1/discover/rooms/enriched`;
144
133
  const query = {};
145
134
  {
@@ -192,9 +181,7 @@ export function register(program) {
192
181
  .description("GET /api/v1/discover/challenges/active")
193
182
  .option("--limit <value>", "string")
194
183
  .action(async (opts) => {
195
- const { as } = program.opts();
196
- if (!as)
197
- throw new Error("--as <userId> is required");
184
+ const as = actingUserId(program);
198
185
  const path = `/api/v1/discover/challenges/active`;
199
186
  const query = {};
200
187
  {
@@ -213,9 +200,7 @@ export function register(program) {
213
200
  .option("--cursor <value>", "string")
214
201
  .option("--limit <value>", "string")
215
202
  .action(async (opts) => {
216
- const { as } = program.opts();
217
- if (!as)
218
- throw new Error("--as <userId> is required");
203
+ const as = actingUserId(program);
219
204
  const path = `/api/v1/discover/templates`;
220
205
  const query = {};
221
206
  {