pi-cursor-sdk 0.1.19 → 0.1.20

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.
@@ -1,4 +1,10 @@
1
- import { CURSOR_REPLAY_ACTIVITY_TOOL_NAME, getCursorReplayDisplayLabel, type CursorReplayLegacyToolName } from "./cursor-tool-names.js";
1
+ import {
2
+ CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME,
3
+ CURSOR_REPLAY_ACTIVITY_TOOL_NAME,
4
+ getCursorReplayActivityTitle,
5
+ getCursorReplayDisplayLabel,
6
+ type CursorReplayLegacyToolName,
7
+ } from "./cursor-tool-names.js";
2
8
  import { resolveCursorEditDiff } from "./cursor-edit-diff.js";
3
9
  import {
4
10
  asRecord,
@@ -127,6 +133,10 @@ function buildReplaySummaryDisplay(
127
133
  };
128
134
  }
129
135
 
136
+ function getCursorToolActivityTitle(toolName: string): string {
137
+ return getCursorReplayActivityTitle(toolName) ?? buildGenericUnknownToolActivityTitle(toolName);
138
+ }
139
+
130
140
  function buildActivityReplayDisplay(cursorToolName: string, spec: ToolDisplaySpec, context: ToolDisplayContext): CursorPiToolDisplay {
131
141
  const activity = spec.activityReplay;
132
142
  if (!activity) throw new Error(`Missing activity replay spec for ${cursorToolName}`);
@@ -191,7 +201,7 @@ function buildEditPiToolDisplay(context: ToolDisplayContext): CursorPiToolDispla
191
201
  const nativeEditArgs = buildNativeEditDisplayArgs(rawName, args, options);
192
202
  const baseActivityArgs = buildCursorEditActivityDisplayArgs(args, options);
193
203
  const displayPath = typeof baseActivityArgs.path === "string" ? baseActivityArgs.path : undefined;
194
- const activityTitle = getCursorReplayDisplayLabel("cursor_edit");
204
+ const activityTitle = getCursorToolActivityTitle("edit");
195
205
  const activityArgs = buildCursorActivityDisplayArgs(baseActivityArgs, activityTitle, displayPath);
196
206
  const contentText = formatEdit(activityArgs, result, options);
197
207
  const details = {
@@ -240,7 +250,7 @@ function buildWritePiToolDisplay(context: ToolDisplayContext): CursorPiToolDispl
240
250
  expandedText: contentText,
241
251
  };
242
252
  if (content === undefined) {
243
- const activityTitle = getCursorReplayDisplayLabel("cursor_write");
253
+ const activityTitle = getCursorToolActivityTitle("write");
244
254
  return buildReplaySummaryDisplay(
245
255
  CURSOR_REPLAY_ACTIVITY_TOOL_NAME,
246
256
  buildCursorActivityDisplayArgs(displayArgs, activityTitle, displayPath ?? "file"),
@@ -336,7 +346,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
336
346
  formatTranscript: ({ args, result, options }) => formatDelete(args, result, options),
337
347
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("delete", TOOL_DISPLAY_SPECS.delete, context),
338
348
  activityReplay: {
339
- labelKey: "cursor_delete",
349
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.delete,
340
350
  buildActivityArgs: ({ args, options }) => {
341
351
  const displayPath = typeof args.path === "string" ? formatDisplayPath(args.path, options.cwd) : undefined;
342
352
  return displayPath ? { path: displayPath } : {};
@@ -360,7 +370,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
360
370
  formatTranscript: ({ args, result, options }) => formatReadLints(args, result, options),
361
371
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("readLints", TOOL_DISPLAY_SPECS.readLints, context),
362
372
  activityReplay: {
363
- labelKey: "cursor_read_lints",
373
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.readLints,
364
374
  buildActivityArgs: ({ args, result, options }) => {
365
375
  const paths = getReadLintPaths(args, result, options);
366
376
  const diagnosticCount = getReadLintDiagnostics(result, options).length;
@@ -378,7 +388,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
378
388
  formatTranscript: ({ args, result, options }) => formatTodos(args, result, options, "updateTodos"),
379
389
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("updateTodos", TOOL_DISPLAY_SPECS.updateTodos, context),
380
390
  activityReplay: {
381
- labelKey: "cursor_update_todos",
391
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.updateTodos,
382
392
  buildActivityArgs: ({ args, result }) => {
383
393
  const todos = getTodoItems(args, result);
384
394
  return { totalCount: getTodoTotalCount(args, result, todos) };
@@ -391,7 +401,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
391
401
  formatTranscript: ({ args, result, options }) => formatPlan(args, result, options),
392
402
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("createPlan", TOOL_DISPLAY_SPECS.createPlan, context),
393
403
  activityReplay: {
394
- labelKey: "cursor_create_plan",
404
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.createPlan,
395
405
  buildActivityArgs: ({ args, result }) => {
396
406
  const todos = getTodoItems(args, result);
397
407
  return { totalCount: getTodoTotalCount(args, result, todos) };
@@ -404,7 +414,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
404
414
  formatTranscript: ({ args, result, options }) => formatTask(args, result, options),
405
415
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("task", TOOL_DISPLAY_SPECS.task, context),
406
416
  activityReplay: {
407
- labelKey: "cursor_task",
417
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.task,
408
418
  buildActivityArgs: ({ args, result }) => {
409
419
  const description = getTaskDescription(args, result);
410
420
  return { description: truncateArg(description) };
@@ -420,7 +430,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
420
430
  formatTranscript: ({ args, result, options }) => formatGenerateImage(args, result, options),
421
431
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("generateImage", TOOL_DISPLAY_SPECS.generateImage, context),
422
432
  activityReplay: {
423
- labelKey: "cursor_generate_image",
433
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.generateImage,
424
434
  buildActivityArgs: ({ args }) => {
425
435
  const prompt = getString(args, "prompt") ?? getString(args, "description") ?? "image";
426
436
  return { prompt: truncateArg(prompt) };
@@ -447,7 +457,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
447
457
  formatTranscript: ({ args, result, options }) => formatMcp(args, result, options),
448
458
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("mcp", TOOL_DISPLAY_SPECS.mcp, context),
449
459
  activityReplay: {
450
- labelKey: "cursor_mcp",
460
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.mcp,
451
461
  buildActivityArgs: ({ args }) => {
452
462
  const toolName = getString(args, "toolName") ?? "mcp";
453
463
  return { toolName: truncateArg(toolName) };
@@ -462,7 +472,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
462
472
  formatTranscript: ({ args, result, options }) => formatSemSearch(args, result, options),
463
473
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("semSearch", TOOL_DISPLAY_SPECS.semSearch, context),
464
474
  activityReplay: {
465
- labelKey: "cursor_sem_search",
475
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.semSearch,
466
476
  buildActivityArgs: ({ args }) => {
467
477
  const query = getString(args, "query") ?? "semantic search";
468
478
  return { query: truncateArg(query) };
@@ -477,7 +487,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
477
487
  formatTranscript: ({ args, result, options }) => formatRecordScreen(args, result, options),
478
488
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("recordScreen", TOOL_DISPLAY_SPECS.recordScreen, context),
479
489
  activityReplay: {
480
- labelKey: "cursor_record_screen",
490
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.recordScreen,
481
491
  buildActivityArgs: ({ args, result, options }) => {
482
492
  const mode = getString(args, "mode");
483
493
  const path = getString(asRecord(result.value), "path");
@@ -499,7 +509,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
499
509
  formatTranscript: ({ args, result, options }) => formatWebSearch(args, result, options),
500
510
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("webSearch", TOOL_DISPLAY_SPECS.webSearch, context),
501
511
  activityReplay: {
502
- labelKey: "cursor_web_search",
512
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.webSearch,
503
513
  buildActivityArgs: ({ args }) => {
504
514
  const query = extractWebSearchQuery(args);
505
515
  return query ? { query: truncateArg(query) } : {};
@@ -507,6 +517,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
507
517
  buildActivitySummary: ({ args }) => truncateArg(extractWebSearchQuery(args) ?? "web search"),
508
518
  buildDetails: ({ result }, contentText) => ({
509
519
  summary: result.status === "error" ? undefined : firstNonEmptyLine(contentText) ?? "web search result captured",
520
+ collapseDetailsByDefault: true,
510
521
  }),
511
522
  },
512
523
  },
@@ -514,7 +525,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
514
525
  formatTranscript: ({ args, result, options }) => formatWebFetch(args, result, options),
515
526
  buildPiToolDisplay: (context) => buildActivityReplayDisplay("webFetch", TOOL_DISPLAY_SPECS.webFetch, context),
516
527
  activityReplay: {
517
- labelKey: "cursor_web_fetch",
528
+ labelKey: CURSOR_REPLAY_ACTIVITY_LABEL_KEYS_BY_TOOL_NAME.webFetch,
518
529
  buildActivityArgs: ({ args }) => {
519
530
  const target = extractWebFetchTarget(args);
520
531
  return target ? { url: truncateArg(target) } : {};
@@ -522,6 +533,7 @@ const TOOL_DISPLAY_SPECS: Record<string, ToolDisplaySpec> = {
522
533
  buildActivitySummary: ({ args }) => truncateArg(extractWebFetchTarget(args) ?? "web fetch"),
523
534
  buildDetails: ({ result }, contentText) => ({
524
535
  summary: result.status === "error" ? undefined : firstNonEmptyLine(contentText) ?? "web fetch result captured",
536
+ collapseDetailsByDefault: true,
525
537
  }),
526
538
  },
527
539
  },