@displaydev/cli 0.18.0 → 0.20.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.
@@ -27,6 +27,19 @@ function _async_to_generator(fn) {
27
27
  });
28
28
  };
29
29
  }
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
30
43
  function _instanceof(left, right) {
31
44
  "@swc/helpers - instanceof";
32
45
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
@@ -35,6 +48,45 @@ function _instanceof(left, right) {
35
48
  return left instanceof right;
36
49
  }
37
50
  }
51
+ function _object_spread(target) {
52
+ for(var i = 1; i < arguments.length; i++){
53
+ var source = arguments[i] != null ? arguments[i] : {};
54
+ var ownKeys = Object.keys(source);
55
+ if (typeof Object.getOwnPropertySymbols === "function") {
56
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
57
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
58
+ }));
59
+ }
60
+ ownKeys.forEach(function(key) {
61
+ _define_property(target, key, source[key]);
62
+ });
63
+ }
64
+ return target;
65
+ }
66
+ function ownKeys(object, enumerableOnly) {
67
+ var keys = Object.keys(object);
68
+ if (Object.getOwnPropertySymbols) {
69
+ var symbols = Object.getOwnPropertySymbols(object);
70
+ if (enumerableOnly) {
71
+ symbols = symbols.filter(function(sym) {
72
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
73
+ });
74
+ }
75
+ keys.push.apply(keys, symbols);
76
+ }
77
+ return keys;
78
+ }
79
+ function _object_spread_props(target, source) {
80
+ source = source != null ? source : {};
81
+ if (Object.getOwnPropertyDescriptors) {
82
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
83
+ } else {
84
+ ownKeys(Object(source)).forEach(function(key) {
85
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
86
+ });
87
+ }
88
+ return target;
89
+ }
38
90
  function _ts_generator(thisArg, body) {
39
91
  var f, y, t, _ = {
40
92
  label: 0,
@@ -140,6 +192,7 @@ import { z } from 'zod';
140
192
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
141
193
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
142
194
  import { ApiError } from './api-client.js';
195
+ import { withUpdateNotice } from './update-notice.js';
143
196
  var FILE_ERROR_CODES = new Set([
144
197
  'ENOENT',
145
198
  'EACCES',
@@ -261,7 +314,7 @@ export function registerPublicTools(server, api) {
261
314
  'html',
262
315
  'md'
263
316
  ]).default('html').describe('Content format')
264
- }, function(args) {
317
+ }, withUpdateNotice(function(args) {
265
318
  return _async_to_generator(function() {
266
319
  var hasContent, hasFilePath, content, _tmp, result, err;
267
320
  return _ts_generator(this, function(_state) {
@@ -357,7 +410,7 @@ export function registerPublicTools(server, api) {
357
410
  }
358
411
  });
359
412
  })();
360
- });
413
+ }));
361
414
  }
362
415
  export function registerTools(server, api) {
363
416
  server.tool('publish', 'Publish an HTML or Markdown artifact behind company auth', {
@@ -381,7 +434,7 @@ export function registerTools(server, api) {
381
434
  'hide',
382
435
  'inherit'
383
436
  ]).optional().describe('display.dev attribution bar override. Paid tier only; defaults to org setting when omitted.')
384
- }, function(args) {
437
+ }, withUpdateNotice(function(args) {
385
438
  return _async_to_generator(function() {
386
439
  var _args_name, hasContent, hasFilePath, _args_name1, content, _tmp, result, _tmp1, err;
387
440
  return _ts_generator(this, function(_state) {
@@ -559,7 +612,7 @@ export function registerTools(server, api) {
559
612
  }
560
613
  });
561
614
  })();
562
- });
615
+ }));
563
616
  server.tool('find', 'List or search artifacts in the caller\'s organization. Omit `query` to list every artifact (paginated). Filter by name, one-or-more authors, one-or-more visibilities, or update time. Sort by `updated_at` (default), `view_count`, or `name`. Paginate via `cursor` — if the result includes a non-null `nextCursor`, pass it back to fetch the next page; if filters change between calls, drop the cursor. The response also carries `totalCount` (`-1` means the count query exceeded its budget — treat as "many"). `visibility: ["private"]` returns only your own private artifacts, not org-wide.', {
564
617
  query: z.string().optional().describe('Search by artifact name (case-insensitive substring). Omit to list all artifacts.'),
565
618
  author: z.array(z.string()).optional().describe('Filter by one or more authors. Each value: email, userId, or the literal "me". Multiple values are ORed. "me" requires a user-scoped credential — with an org API key the wire drops it.'),
@@ -580,7 +633,7 @@ export function registerTools(server, api) {
580
633
  ]).optional().describe('Sort direction. Defaults: desc for updated_at and view_count, asc for name.'),
581
634
  cursor: z.string().optional().describe('Opaque pagination token from a prior response. Pass it back to fetch the next page. WARNING: only valid for the same `sort`/`dir`/filter set that issued it — change a filter and drop the cursor, or results will be skewed without an error.'),
582
635
  limit: z.number().int().min(1).max(100).optional().describe('Max results per page (1–100, default 50).')
583
- }, function(args) {
636
+ }, withUpdateNotice(function(args) {
584
637
  return _async_to_generator(function() {
585
638
  var result, err;
586
639
  return _ts_generator(this, function(_state) {
@@ -615,11 +668,11 @@ export function registerTools(server, api) {
615
668
  }
616
669
  });
617
670
  })();
618
- });
671
+ }));
619
672
  server.tool('get', 'Get full details of a specific artifact', {
620
673
  short_id: z.string().describe('Artifact shortId'),
621
674
  include: z.array(z.string()).optional().describe('Include additional data (e.g. "versions")')
622
- }, function(args) {
675
+ }, withUpdateNotice(function(args) {
623
676
  return _async_to_generator(function() {
624
677
  var result, err;
625
678
  return _ts_generator(this, function(_state) {
@@ -654,11 +707,11 @@ export function registerTools(server, api) {
654
707
  }
655
708
  });
656
709
  })();
657
- });
710
+ }));
658
711
  server.tool('delete', 'Delete an artifact permanently', {
659
712
  short_id: z.string().describe('Artifact shortId to delete'),
660
713
  confirm: z.boolean().describe('Must be true to confirm deletion')
661
- }, function(args) {
714
+ }, withUpdateNotice(function(args) {
662
715
  return _async_to_generator(function() {
663
716
  var result, err;
664
717
  return _ts_generator(this, function(_state) {
@@ -712,7 +765,7 @@ export function registerTools(server, api) {
712
765
  }
713
766
  });
714
767
  })();
715
- });
768
+ }));
716
769
  server.tool('share', 'Change an artifact\'s visibility and/or add/remove individual shared-with emails without republishing.', {
717
770
  short_id: z.string().describe('Short ID of the artifact (8 chars).'),
718
771
  visibility: z.enum([
@@ -722,7 +775,7 @@ export function registerTools(server, api) {
722
775
  ]).optional().describe('Change the visibility level. Omit to keep current. "private" requires the Pro plan.'),
723
776
  add_users: z.array(z.string()).optional().describe('Emails to add to sharedWith (idempotent).'),
724
777
  remove_users: z.array(z.string()).optional().describe('Emails to remove from sharedWith (idempotent).')
725
- }, function(args) {
778
+ }, withUpdateNotice(function(args) {
726
779
  return _async_to_generator(function() {
727
780
  var result, err;
728
781
  return _ts_generator(this, function(_state) {
@@ -780,11 +833,11 @@ export function registerTools(server, api) {
780
833
  }
781
834
  });
782
835
  })();
783
- });
836
+ }));
784
837
  server.tool('rename', 'Rename a published artifact. The URL slug updates to match; existing URLs still resolve because routing uses the shortId.', {
785
838
  short_id: z.string().describe('The 8-character shortId returned at publish.'),
786
839
  name: z.string().describe('New display name. 1–200 characters.')
787
- }, function(args) {
840
+ }, withUpdateNotice(function(args) {
788
841
  return _async_to_generator(function() {
789
842
  var result, err;
790
843
  return _ts_generator(this, function(_state) {
@@ -823,7 +876,7 @@ export function registerTools(server, api) {
823
876
  }
824
877
  });
825
878
  })();
826
- });
879
+ }));
827
880
  server.tool('export', 'Retrieve the source bytes of a published artifact. `format: "original"` returns the publisher\'s upload (markdown for .md, HTML for .html). `format: "markdown"` always returns markdown — `.md` is unchanged, `.html` is converted via Workers AI (cached).', {
828
881
  short_id: z.string().describe('Short ID of the artifact (8 chars).'),
829
882
  version: z.number().int().min(1).optional().describe('Pinned version number. Omit for current.'),
@@ -831,7 +884,7 @@ export function registerTools(server, api) {
831
884
  'original',
832
885
  'markdown'
833
886
  ]).default('original').describe('Representation requested. Default "original".')
834
- }, function(args) {
887
+ }, withUpdateNotice(function(args) {
835
888
  return _async_to_generator(function() {
836
889
  var result, err;
837
890
  return _ts_generator(this, function(_state) {
@@ -879,7 +932,7 @@ export function registerTools(server, api) {
879
932
  }
880
933
  });
881
934
  })();
882
- });
935
+ }));
883
936
  // Metadata-only: does NOT bump the artifact version. Use the `publish`
884
937
  // tool (with `show_branding`) when you're changing content at the same
885
938
  // time so both writes happen in one transaction.
@@ -890,7 +943,7 @@ export function registerTools(server, api) {
890
943
  'hide',
891
944
  'inherit'
892
945
  ]).describe('show = force branding on; hide = force off; inherit = follow org default')
893
- }, function(args) {
946
+ }, withUpdateNotice(function(args) {
894
947
  return _async_to_generator(function() {
895
948
  var result, err;
896
949
  return _ts_generator(this, function(_state) {
@@ -925,14 +978,14 @@ export function registerTools(server, api) {
925
978
  }
926
979
  });
927
980
  })();
928
- });
981
+ }));
929
982
  server.tool('set_logo', 'Upload or replace the org logo (paid tiers only). Used as the favicon on every artifact the org publishes. Stdio variant reads bytes from a local file path.', {
930
983
  file_path: z.string().describe('Path to a local PNG or WebP file. Square, 32×32 to 1024×1024, ≤256 KB.'),
931
984
  content_type: z.enum([
932
985
  'image/png',
933
986
  'image/webp'
934
987
  ]).optional().describe('Optional declared MIME type; inferred from the file extension when omitted.')
935
- }, function(args) {
988
+ }, withUpdateNotice(function(args) {
936
989
  return _async_to_generator(function() {
937
990
  var bytes, err, contentType, lower, result, err1;
938
991
  return _ts_generator(this, function(_state) {
@@ -1021,8 +1074,8 @@ export function registerTools(server, api) {
1021
1074
  }
1022
1075
  });
1023
1076
  })();
1024
- });
1025
- server.tool('clear_logo', 'Remove the org logo. Idempotent — succeeds even when no logo is currently set.', {}, function() {
1077
+ }));
1078
+ server.tool('clear_logo', 'Remove the org logo. Idempotent — succeeds even when no logo is currently set.', {}, withUpdateNotice(function() {
1026
1079
  return _async_to_generator(function() {
1027
1080
  var err;
1028
1081
  return _ts_generator(this, function(_state) {
@@ -1059,5 +1112,447 @@ export function registerTools(server, api) {
1059
1112
  }
1060
1113
  });
1061
1114
  })();
1062
- });
1115
+ }));
1116
+ registerCommentTools(server, api);
1117
+ }
1118
+ /**
1119
+ * Comment tools (feat-comments §3) — stdio transport mirror of the
1120
+ * eight HTTP MCP tools in `api/src/mcp/comment-tools.ts`. KB-page
1121
+ * subjects return `subject_type_not_implemented` here too; the
1122
+ * polymorphic shape is part of the public contract so the CLI's MCP
1123
+ * surface accepts the same input even when the wire path 501s.
1124
+ */ function registerCommentTools(server, api) {
1125
+ function rejectKbPage() {
1126
+ return {
1127
+ content: [
1128
+ {
1129
+ type: 'text',
1130
+ text: JSON.stringify({
1131
+ error: 'subject_type_not_implemented',
1132
+ message: 'KB-page subjects are not yet supported. Pass subject_type="artifact".',
1133
+ status: 501
1134
+ })
1135
+ }
1136
+ ],
1137
+ isError: true
1138
+ };
1139
+ }
1140
+ function requireShortId(args) {
1141
+ if (!args.short_id) {
1142
+ return {
1143
+ content: [
1144
+ {
1145
+ type: 'text',
1146
+ text: JSON.stringify({
1147
+ error: 'validation_error',
1148
+ message: 'short_id is required for subject_type=artifact',
1149
+ status: 400
1150
+ })
1151
+ }
1152
+ ],
1153
+ isError: true
1154
+ };
1155
+ }
1156
+ return args.short_id;
1157
+ }
1158
+ var subjectArgs = {
1159
+ subject_type: z.enum([
1160
+ 'artifact',
1161
+ 'kb_page'
1162
+ ]).describe('Subject discriminator'),
1163
+ short_id: z.string().optional().describe('Artifact shortId (subject_type=artifact)'),
1164
+ kb_name: z.string().optional().describe('KB name (subject_type=kb_page; not yet supported)'),
1165
+ file_path: z.string().optional().describe('KB page path (subject_type=kb_page; not yet supported)')
1166
+ };
1167
+ var anchorSchema = z.object({
1168
+ textQuote: z.object({
1169
+ prefix: z.string(),
1170
+ exact: z.string(),
1171
+ suffix: z.string()
1172
+ }),
1173
+ cssPath: z.string(),
1174
+ textPosition: z.object({
1175
+ start: z.number().int(),
1176
+ end: z.number().int()
1177
+ }).optional()
1178
+ }).optional();
1179
+ server.tool('add_comment', 'Post a root comment or reply on an artifact. Root: pass `anchor` and omit `parent_id`. Reply: pass `parent_id` (the root comment id) and omit `anchor` (replies inherit the root anchor).', _object_spread_props(_object_spread({}, subjectArgs), {
1180
+ body: z.string().min(1).max(10000).describe('Comment body (≤10k chars)'),
1181
+ parent_id: z.string().optional().describe('Root comment id when posting a reply'),
1182
+ anchor: anchorSchema
1183
+ }), withUpdateNotice(function(args) {
1184
+ return _async_to_generator(function() {
1185
+ var shortIdOrErr, result, err;
1186
+ return _ts_generator(this, function(_state) {
1187
+ switch(_state.label){
1188
+ case 0:
1189
+ if (args.subject_type === 'kb_page') {
1190
+ return [
1191
+ 2,
1192
+ rejectKbPage()
1193
+ ];
1194
+ }
1195
+ shortIdOrErr = requireShortId(args);
1196
+ if (typeof shortIdOrErr !== 'string') {
1197
+ return [
1198
+ 2,
1199
+ shortIdOrErr
1200
+ ];
1201
+ }
1202
+ _state.label = 1;
1203
+ case 1:
1204
+ _state.trys.push([
1205
+ 1,
1206
+ 3,
1207
+ ,
1208
+ 4
1209
+ ]);
1210
+ return [
1211
+ 4,
1212
+ api.addComment(shortIdOrErr, {
1213
+ body: args.body,
1214
+ anchor: args.anchor,
1215
+ parentId: args.parent_id
1216
+ })
1217
+ ];
1218
+ case 2:
1219
+ result = _state.sent();
1220
+ return [
1221
+ 2,
1222
+ okResponse(result)
1223
+ ];
1224
+ case 3:
1225
+ err = _state.sent();
1226
+ return [
1227
+ 2,
1228
+ errorResponse(err)
1229
+ ];
1230
+ case 4:
1231
+ return [
1232
+ 2
1233
+ ];
1234
+ }
1235
+ });
1236
+ })();
1237
+ }));
1238
+ server.tool('list_comments', 'List comment threads on a subject. Reads from Postgres (not the KV widget cache).', _object_spread_props(_object_spread({}, subjectArgs), {
1239
+ status: z.enum([
1240
+ 'open',
1241
+ 'resolved',
1242
+ 'all'
1243
+ ]).optional().describe('Defaults to "open"'),
1244
+ since: z.string().optional().describe('ISO-8601 — return only threads with activity at or after this timestamp')
1245
+ }), withUpdateNotice(function(args) {
1246
+ return _async_to_generator(function() {
1247
+ var shortIdOrErr, result, err;
1248
+ return _ts_generator(this, function(_state) {
1249
+ switch(_state.label){
1250
+ case 0:
1251
+ if (args.subject_type === 'kb_page') {
1252
+ return [
1253
+ 2,
1254
+ rejectKbPage()
1255
+ ];
1256
+ }
1257
+ shortIdOrErr = requireShortId(args);
1258
+ if (typeof shortIdOrErr !== 'string') {
1259
+ return [
1260
+ 2,
1261
+ shortIdOrErr
1262
+ ];
1263
+ }
1264
+ _state.label = 1;
1265
+ case 1:
1266
+ _state.trys.push([
1267
+ 1,
1268
+ 3,
1269
+ ,
1270
+ 4
1271
+ ]);
1272
+ return [
1273
+ 4,
1274
+ api.listComments(shortIdOrErr, {
1275
+ status: args.status,
1276
+ since: args.since
1277
+ })
1278
+ ];
1279
+ case 2:
1280
+ result = _state.sent();
1281
+ return [
1282
+ 2,
1283
+ okResponse(result)
1284
+ ];
1285
+ case 3:
1286
+ err = _state.sent();
1287
+ return [
1288
+ 2,
1289
+ errorResponse(err)
1290
+ ];
1291
+ case 4:
1292
+ return [
1293
+ 2
1294
+ ];
1295
+ }
1296
+ });
1297
+ })();
1298
+ }));
1299
+ server.tool('edit_comment', 'Edit your own comment within the 5-minute author window. After 5 minutes the body is locked.', {
1300
+ comment_id: z.string(),
1301
+ body: z.string().min(1).max(10000)
1302
+ }, withUpdateNotice(function(args) {
1303
+ return _async_to_generator(function() {
1304
+ var result, err;
1305
+ return _ts_generator(this, function(_state) {
1306
+ switch(_state.label){
1307
+ case 0:
1308
+ _state.trys.push([
1309
+ 0,
1310
+ 2,
1311
+ ,
1312
+ 3
1313
+ ]);
1314
+ return [
1315
+ 4,
1316
+ api.editComment(args.comment_id, args.body)
1317
+ ];
1318
+ case 1:
1319
+ result = _state.sent();
1320
+ return [
1321
+ 2,
1322
+ okResponse(result)
1323
+ ];
1324
+ case 2:
1325
+ err = _state.sent();
1326
+ return [
1327
+ 2,
1328
+ errorResponse(err)
1329
+ ];
1330
+ case 3:
1331
+ return [
1332
+ 2
1333
+ ];
1334
+ }
1335
+ });
1336
+ })();
1337
+ }));
1338
+ server.tool('delete_comment', 'Soft-delete a comment. Author / artifact creator / org admin. Replies remain visible; body becomes "[deleted]".', {
1339
+ comment_id: z.string()
1340
+ }, withUpdateNotice(function(args) {
1341
+ return _async_to_generator(function() {
1342
+ var err;
1343
+ return _ts_generator(this, function(_state) {
1344
+ switch(_state.label){
1345
+ case 0:
1346
+ _state.trys.push([
1347
+ 0,
1348
+ 2,
1349
+ ,
1350
+ 3
1351
+ ]);
1352
+ return [
1353
+ 4,
1354
+ api.deleteComment(args.comment_id)
1355
+ ];
1356
+ case 1:
1357
+ _state.sent();
1358
+ return [
1359
+ 2,
1360
+ okResponse({
1361
+ deleted: true
1362
+ })
1363
+ ];
1364
+ case 2:
1365
+ err = _state.sent();
1366
+ return [
1367
+ 2,
1368
+ errorResponse(err)
1369
+ ];
1370
+ case 3:
1371
+ return [
1372
+ 2
1373
+ ];
1374
+ }
1375
+ });
1376
+ })();
1377
+ }));
1378
+ server.tool('resolve_thread', 'Mark a thread resolved (root comment id). Thread participant / artifact creator / org admin.', {
1379
+ comment_id: z.string()
1380
+ }, withUpdateNotice(function(args) {
1381
+ return _async_to_generator(function() {
1382
+ var result, err;
1383
+ return _ts_generator(this, function(_state) {
1384
+ switch(_state.label){
1385
+ case 0:
1386
+ _state.trys.push([
1387
+ 0,
1388
+ 2,
1389
+ ,
1390
+ 3
1391
+ ]);
1392
+ return [
1393
+ 4,
1394
+ api.resolveThread(args.comment_id)
1395
+ ];
1396
+ case 1:
1397
+ result = _state.sent();
1398
+ return [
1399
+ 2,
1400
+ okResponse(result)
1401
+ ];
1402
+ case 2:
1403
+ err = _state.sent();
1404
+ return [
1405
+ 2,
1406
+ errorResponse(err)
1407
+ ];
1408
+ case 3:
1409
+ return [
1410
+ 2
1411
+ ];
1412
+ }
1413
+ });
1414
+ })();
1415
+ }));
1416
+ server.tool('reopen_thread', 'Reopen a resolved thread. Any authenticated user with view access on the artifact.', {
1417
+ comment_id: z.string()
1418
+ }, withUpdateNotice(function(args) {
1419
+ return _async_to_generator(function() {
1420
+ var result, err;
1421
+ return _ts_generator(this, function(_state) {
1422
+ switch(_state.label){
1423
+ case 0:
1424
+ _state.trys.push([
1425
+ 0,
1426
+ 2,
1427
+ ,
1428
+ 3
1429
+ ]);
1430
+ return [
1431
+ 4,
1432
+ api.reopenThread(args.comment_id)
1433
+ ];
1434
+ case 1:
1435
+ result = _state.sent();
1436
+ return [
1437
+ 2,
1438
+ okResponse(result)
1439
+ ];
1440
+ case 2:
1441
+ err = _state.sent();
1442
+ return [
1443
+ 2,
1444
+ errorResponse(err)
1445
+ ];
1446
+ case 3:
1447
+ return [
1448
+ 2
1449
+ ];
1450
+ }
1451
+ });
1452
+ })();
1453
+ }));
1454
+ server.tool('watch', 'Watch the subject for comment notifications. Per-user; service-account API keys cannot subscribe.', subjectArgs, withUpdateNotice(function(args) {
1455
+ return _async_to_generator(function() {
1456
+ var shortIdOrErr, result, err;
1457
+ return _ts_generator(this, function(_state) {
1458
+ switch(_state.label){
1459
+ case 0:
1460
+ if (args.subject_type === 'kb_page') {
1461
+ return [
1462
+ 2,
1463
+ rejectKbPage()
1464
+ ];
1465
+ }
1466
+ shortIdOrErr = requireShortId(args);
1467
+ if (typeof shortIdOrErr !== 'string') {
1468
+ return [
1469
+ 2,
1470
+ shortIdOrErr
1471
+ ];
1472
+ }
1473
+ _state.label = 1;
1474
+ case 1:
1475
+ _state.trys.push([
1476
+ 1,
1477
+ 3,
1478
+ ,
1479
+ 4
1480
+ ]);
1481
+ return [
1482
+ 4,
1483
+ api.watchArtifact(shortIdOrErr)
1484
+ ];
1485
+ case 2:
1486
+ result = _state.sent();
1487
+ return [
1488
+ 2,
1489
+ okResponse(result)
1490
+ ];
1491
+ case 3:
1492
+ err = _state.sent();
1493
+ return [
1494
+ 2,
1495
+ errorResponse(err)
1496
+ ];
1497
+ case 4:
1498
+ return [
1499
+ 2
1500
+ ];
1501
+ }
1502
+ });
1503
+ })();
1504
+ }));
1505
+ server.tool('unwatch', 'Unwatch the subject. Per-user; service-account API keys cannot subscribe.', subjectArgs, withUpdateNotice(function(args) {
1506
+ return _async_to_generator(function() {
1507
+ var shortIdOrErr, err;
1508
+ return _ts_generator(this, function(_state) {
1509
+ switch(_state.label){
1510
+ case 0:
1511
+ if (args.subject_type === 'kb_page') {
1512
+ return [
1513
+ 2,
1514
+ rejectKbPage()
1515
+ ];
1516
+ }
1517
+ shortIdOrErr = requireShortId(args);
1518
+ if (typeof shortIdOrErr !== 'string') {
1519
+ return [
1520
+ 2,
1521
+ shortIdOrErr
1522
+ ];
1523
+ }
1524
+ _state.label = 1;
1525
+ case 1:
1526
+ _state.trys.push([
1527
+ 1,
1528
+ 3,
1529
+ ,
1530
+ 4
1531
+ ]);
1532
+ return [
1533
+ 4,
1534
+ api.unwatchArtifact(shortIdOrErr)
1535
+ ];
1536
+ case 2:
1537
+ _state.sent();
1538
+ return [
1539
+ 2,
1540
+ okResponse({
1541
+ watching: false
1542
+ })
1543
+ ];
1544
+ case 3:
1545
+ err = _state.sent();
1546
+ return [
1547
+ 2,
1548
+ errorResponse(err)
1549
+ ];
1550
+ case 4:
1551
+ return [
1552
+ 2
1553
+ ];
1554
+ }
1555
+ });
1556
+ })();
1557
+ }));
1063
1558
  }