@herbertgao/pi-extensions 2026.11.17 → 2026.11.19

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 (159) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +3 -3
  3. package/THIRD_PARTY_NOTICES.md +2 -23
  4. package/node_modules/@estebanforge/pi-antigravity-bridge/CHANGELOG.md +956 -0
  5. package/node_modules/{pi-antigravity → @estebanforge/pi-antigravity-bridge}/LICENSE +1 -1
  6. package/node_modules/@estebanforge/pi-antigravity-bridge/README.md +240 -0
  7. package/node_modules/@estebanforge/pi-antigravity-bridge/extensions/index.ts +2117 -0
  8. package/node_modules/@estebanforge/pi-antigravity-bridge/package.json +61 -0
  9. package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/connection.ts +644 -0
  10. package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/driver.ts +1043 -0
  11. package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/events.ts +323 -0
  12. package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/home.ts +145 -0
  13. package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/jsonrpc.ts +243 -0
  14. package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/setup.ts +107 -0
  15. package/node_modules/@estebanforge/pi-antigravity-bridge/src/acp/usage-estimate.ts +61 -0
  16. package/node_modules/@estebanforge/pi-antigravity-bridge/src/agents.ts +64 -0
  17. package/node_modules/@estebanforge/pi-antigravity-bridge/src/agy-install.ts +93 -0
  18. package/node_modules/@estebanforge/pi-antigravity-bridge/src/agy-paths.ts +30 -0
  19. package/node_modules/@estebanforge/pi-antigravity-bridge/src/agy-setup.ts +81 -0
  20. package/node_modules/@estebanforge/pi-antigravity-bridge/src/agy-version.ts +289 -0
  21. package/node_modules/@estebanforge/pi-antigravity-bridge/src/approval-detect.ts +161 -0
  22. package/node_modules/@estebanforge/pi-antigravity-bridge/src/approval-gate.ts +233 -0
  23. package/node_modules/@estebanforge/pi-antigravity-bridge/src/approval-hook.ts +325 -0
  24. package/node_modules/@estebanforge/pi-antigravity-bridge/src/artifacts-ui.ts +88 -0
  25. package/node_modules/@estebanforge/pi-antigravity-bridge/src/artifacts.ts +144 -0
  26. package/node_modules/@estebanforge/pi-antigravity-bridge/src/ask-tool.ts +1221 -0
  27. package/node_modules/@estebanforge/pi-antigravity-bridge/src/background-watch.ts +225 -0
  28. package/node_modules/@estebanforge/pi-antigravity-bridge/src/bridge-catalog.ts +197 -0
  29. package/node_modules/@estebanforge/pi-antigravity-bridge/src/config.ts +523 -0
  30. package/node_modules/@estebanforge/pi-antigravity-bridge/src/daily-log.ts +196 -0
  31. package/node_modules/@estebanforge/pi-antigravity-bridge/src/dialog-lock.ts +48 -0
  32. package/node_modules/@estebanforge/pi-antigravity-bridge/src/diff-render.ts +207 -0
  33. package/node_modules/@estebanforge/pi-antigravity-bridge/src/driver-types.ts +168 -0
  34. package/node_modules/@estebanforge/pi-antigravity-bridge/src/driver.ts +907 -0
  35. package/node_modules/@estebanforge/pi-antigravity-bridge/src/engine-picker.ts +160 -0
  36. package/node_modules/@estebanforge/pi-antigravity-bridge/src/frame-guard.ts +38 -0
  37. package/node_modules/@estebanforge/pi-antigravity-bridge/src/handoff-toast.ts +21 -0
  38. package/node_modules/@estebanforge/pi-antigravity-bridge/src/mcp-registration.ts +376 -0
  39. package/node_modules/@estebanforge/pi-antigravity-bridge/src/mcp-server.ts +618 -0
  40. package/node_modules/@estebanforge/pi-antigravity-bridge/src/models.ts +404 -0
  41. package/node_modules/@estebanforge/pi-antigravity-bridge/src/native-tools.ts +104 -0
  42. package/node_modules/@estebanforge/pi-antigravity-bridge/src/parked-turn.ts +125 -0
  43. package/node_modules/@estebanforge/pi-antigravity-bridge/src/patch-cleanup.ts +523 -0
  44. package/node_modules/@estebanforge/pi-antigravity-bridge/src/poll-fold.ts +55 -0
  45. package/node_modules/@estebanforge/pi-antigravity-bridge/src/prompt-images.ts +92 -0
  46. package/node_modules/@estebanforge/pi-antigravity-bridge/src/provider.ts +2214 -0
  47. package/node_modules/@estebanforge/pi-antigravity-bridge/src/queued-messages.ts +152 -0
  48. package/node_modules/@estebanforge/pi-antigravity-bridge/src/quota-notice.ts +40 -0
  49. package/node_modules/@estebanforge/pi-antigravity-bridge/src/redact.ts +27 -0
  50. package/node_modules/@estebanforge/pi-antigravity-bridge/src/sessions.ts +197 -0
  51. package/node_modules/@estebanforge/pi-antigravity-bridge/src/skills.ts +207 -0
  52. package/node_modules/@estebanforge/pi-antigravity-bridge/src/stream-events.ts +161 -0
  53. package/node_modules/@estebanforge/pi-antigravity-bridge/src/stream-sanitizer.ts +180 -0
  54. package/node_modules/@estebanforge/pi-antigravity-bridge/src/subagent-roster.ts +245 -0
  55. package/node_modules/@estebanforge/pi-antigravity-bridge/src/sysprompt-agent.ts +130 -0
  56. package/node_modules/@estebanforge/pi-antigravity-bridge/src/tasks-ui.ts +90 -0
  57. package/node_modules/@estebanforge/pi-antigravity-bridge/src/tasks.ts +174 -0
  58. package/node_modules/@estebanforge/pi-antigravity-bridge/src/usage.ts +174 -0
  59. package/node_modules/@estebanforge/pi-antigravity-bridge/src/web-tools.ts +320 -0
  60. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +12 -0
  61. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +1 -1
  62. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +3 -1
  63. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +7 -0
  64. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/agent-badge.ts +244 -0
  65. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +1 -1
  66. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +10 -3
  67. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +18 -0
  68. package/node_modules/@herbertgao/pi-cc-extensions/package.json +1 -1
  69. package/node_modules/@herbertgao/pi-inline-skill-commands/README.md +18 -0
  70. package/node_modules/@herbertgao/pi-inline-skill-commands/package.json +1 -1
  71. package/node_modules/@herbertgao/pi-inline-skill-commands/src/index.ts +80 -0
  72. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +320 -102
  73. package/node_modules/@herbertgao/pi-subagents/SECURITY.md +2 -2
  74. package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +240 -30
  75. package/node_modules/@herbertgao/pi-subagents/docs/translations.md +63 -0
  76. package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +1 -1
  77. package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
  78. package/node_modules/@herbertgao/pi-subagents/src/agent-file-toggle.ts +2 -0
  79. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +89 -6
  80. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +6 -2
  81. package/node_modules/@herbertgao/pi-subagents/src/agent-types.ts +27 -13
  82. package/node_modules/@herbertgao/pi-subagents/src/cache-retention.ts +39 -0
  83. package/node_modules/@herbertgao/pi-subagents/src/completion-outbox.ts +5 -0
  84. package/node_modules/@herbertgao/pi-subagents/src/cross-extension-rpc.ts +217 -41
  85. package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +7 -0
  86. package/node_modules/@herbertgao/pi-subagents/src/group-join.ts +9 -0
  87. package/node_modules/@herbertgao/pi-subagents/src/index.ts +126 -93
  88. package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +3 -2
  89. package/node_modules/@herbertgao/pi-subagents/src/settings.ts +21 -0
  90. package/node_modules/@herbertgao/pi-subagents/src/subagent-info.ts +115 -0
  91. package/node_modules/@herbertgao/pi-subagents/src/types.ts +11 -7
  92. package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +2 -3
  93. package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +1 -1
  94. package/node_modules/@herbertgao/pi-subagents/src/workflow/meta.ts +2 -2
  95. package/node_modules/@herbertgao/pi-subagents/src/workflow-info.ts +184 -0
  96. package/node_modules/pi-commandcode-provider/CHANGELOG.md +10 -0
  97. package/node_modules/pi-commandcode-provider/README.md +3 -2
  98. package/node_modules/pi-commandcode-provider/index.ts +120 -13
  99. package/node_modules/pi-commandcode-provider/package.json +4 -3
  100. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +11 -2
  101. package/node_modules/pi-commandcode-provider/src/pricing.ts +17 -1
  102. package/node_modules/pi-commandcode-provider/src/quota-command.ts +3 -2
  103. package/node_modules/pi-commandcode-provider/src/zdr.ts +163 -0
  104. package/package.json +12 -15
  105. package/node_modules/pi-antigravity/README.md +0 -298
  106. package/node_modules/pi-antigravity/docs/reader-guarantees.md +0 -35
  107. package/node_modules/pi-antigravity/package.json +0 -87
  108. package/node_modules/pi-antigravity/src/auth/accounts.ts +0 -327
  109. package/node_modules/pi-antigravity/src/auth/index.ts +0 -23
  110. package/node_modules/pi-antigravity/src/auth/oauth.ts +0 -445
  111. package/node_modules/pi-antigravity/src/client/client.ts +0 -602
  112. package/node_modules/pi-antigravity/src/client/enterprise.ts +0 -150
  113. package/node_modules/pi-antigravity/src/client/index.ts +0 -2
  114. package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +0 -104
  115. package/node_modules/pi-antigravity/src/diagnostics/index.ts +0 -1
  116. package/node_modules/pi-antigravity/src/features/generate-image.ts +0 -132
  117. package/node_modules/pi-antigravity/src/features/google-search.ts +0 -72
  118. package/node_modules/pi-antigravity/src/features/read-url-content.ts +0 -124
  119. package/node_modules/pi-antigravity/src/image/image.ts +0 -427
  120. package/node_modules/pi-antigravity/src/image/index.ts +0 -1
  121. package/node_modules/pi-antigravity/src/image/native.ts +0 -69
  122. package/node_modules/pi-antigravity/src/index.ts +0 -547
  123. package/node_modules/pi-antigravity/src/models/discovery.ts +0 -176
  124. package/node_modules/pi-antigravity/src/models/grouping.ts +0 -487
  125. package/node_modules/pi-antigravity/src/models/index.ts +0 -3
  126. package/node_modules/pi-antigravity/src/models/models.ts +0 -647
  127. package/node_modules/pi-antigravity/src/search/index.ts +0 -1
  128. package/node_modules/pi-antigravity/src/search/search.ts +0 -967
  129. package/node_modules/pi-antigravity/src/stream/index.ts +0 -1
  130. package/node_modules/pi-antigravity/src/stream/stream.ts +0 -1961
  131. package/node_modules/pi-antigravity/src/types/enums.ts +0 -52
  132. package/node_modules/pi-antigravity/src/types/index.ts +0 -2
  133. package/node_modules/pi-antigravity/src/types/types.ts +0 -329
  134. package/node_modules/pi-antigravity/src/usage/index.ts +0 -1
  135. package/node_modules/pi-antigravity/src/usage/usage.ts +0 -437
  136. package/node_modules/pi-antigravity/src/utils/address.ts +0 -180
  137. package/node_modules/pi-antigravity/src/utils/credits.ts +0 -149
  138. package/node_modules/pi-antigravity/src/utils/html.ts +0 -31
  139. package/node_modules/pi-antigravity/src/utils/http.ts +0 -96
  140. package/node_modules/pi-antigravity/src/utils/index.ts +0 -5
  141. package/node_modules/pi-antigravity/src/utils/security.ts +0 -278
  142. package/node_modules/pi-antigravity/src/utils/text.ts +0 -66
  143. package/node_modules/pi-antigravity/src/utils/util.ts +0 -217
  144. package/node_modules/pi-antigravity/src/web-fetch/document.ts +0 -83
  145. package/node_modules/pi-antigravity/src/web-fetch/fences.ts +0 -24
  146. package/node_modules/pi-antigravity/src/web-fetch/header.ts +0 -97
  147. package/node_modules/pi-antigravity/src/web-fetch/index.ts +0 -3
  148. package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +0 -328
  149. package/node_modules/pi-antigravity/src/web-fetch/limits.ts +0 -4
  150. package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +0 -744
  151. package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +0 -164
  152. package/node_modules/pi-antigravity/src/web-fetch/media.ts +0 -11
  153. package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +0 -9
  154. package/node_modules/pi-antigravity/src/web-fetch/representation.ts +0 -93
  155. package/node_modules/pi-antigravity/src/web-fetch/save.ts +0 -71
  156. package/node_modules/pi-antigravity/src/web-fetch/sites.ts +0 -138
  157. package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +0 -9
  158. package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +0 -957
  159. package/node_modules/pi-antigravity/tsconfig.json +0 -21
@@ -4,6 +4,7 @@ import { visibleWidth } from "@earendil-works/pi-tui";
4
4
  import { keyText } from "../../utils/keybindings.ts";
5
5
  import { config } from "../../config/config.ts";
6
6
  import { oneLine } from "../../utils/format.ts";
7
+ import { agentBadge, type BadgeTheme } from "./agent-badge.ts";
7
8
  import { headTruncateToWidth } from "./result.ts";
8
9
 
9
10
  /** toolLabelClip=0 时不设字符上限,交给渲染时的实际宽度截断。 */
@@ -64,6 +65,8 @@ export type ToolCallSummaryOptions = {
64
65
  export type ToolCallSummary = {
65
66
  main: string;
66
67
  detail: string;
68
+ /** Agent 行的派发类型:渲染层据它在类型有配置色时画徽章,替换标题里的类型名。 */
69
+ agentType?: string;
67
70
  /** 路径摘要保留结构,供最终渲染按实际宽度优先保留文件名。 */
68
71
  path?: { prefix: string; value: string };
69
72
  /** 标题之外的原始载荷(入参 JSON、脚本代码、命令、路径、查询…),已压成单行,渲染时用 muted 接在标题后。 */
@@ -282,6 +285,9 @@ export function toolCallSummary(
282
285
  return {
283
286
  main: `${title} ${displayName}`,
284
287
  detail: "",
288
+ // 徽章按「派发类型」查表,绝不按运行名:general-purpose 运行即使起名
289
+ // Code Reviewer,也不能捡到同名注册类型的颜色。
290
+ agentType: typeof type === "string" ? type : undefined,
285
291
  payload: description ? `\u00b7 ${description}` : undefined,
286
292
  };
287
293
  }
@@ -425,6 +431,7 @@ export function renderToolSummary(
425
431
  summary: ToolCallSummary,
426
432
  width: number,
427
433
  fg: (color: ThemeColor, text: string) => string,
434
+ theme?: BadgeTheme,
428
435
  ): string {
429
436
  // 路径摘要:前缀用标题色,值用次级色并按可用宽度中间截断(文件名优先保留)。
430
437
  if (summary.path) {
@@ -433,6 +440,17 @@ export function renderToolSummary(
433
440
  if (pathWidth < MIN_PAYLOAD_WIDTH) return fg("toolTitle", prefix);
434
441
  return `${fg("toolTitle", prefix)} ${fg("muted", truncatePathToWidth(summary.path.value, Math.min(pathWidth, clipLimit())))}`;
435
442
  }
443
+ // Agent 行:类型有配置色时用 pi-subagents 同款徽章替换「Subagent 类型名」标题,
444
+ // 无色或缓存未命中时保持纯文本(缓存在 subagents:ready / agents-changed 后拉取)。
445
+ if (summary.agentType && theme) {
446
+ const badge = agentBadge(summary.agentType, theme);
447
+ if (badge) {
448
+ const room = width - visibleWidth(badge);
449
+ return room >= MIN_PAYLOAD_WIDTH && summary.payload
450
+ ? `${badge}${fg("muted", headTruncateToWidth(` ${summary.payload}`, room))}`
451
+ : badge;
452
+ }
453
+ }
436
454
  const title = fitToolCallSummary(summary, width);
437
455
  if (!summary.payload) return fg("toolTitle", title);
438
456
  const room = width - visibleWidth(title);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-cc-extensions",
3
- "version": "1.0.21-local.2",
3
+ "version": "1.0.21-local.4",
4
4
  "license": "MIT",
5
5
  "description": "A Pi productivity suite with Claude Code-style UI, context inspection, and agent/session references",
6
6
  "type": "module",
@@ -24,6 +24,24 @@ pi install /absolute/path/to/pi-extensions/packages/pi-inline-skill-commands
24
24
 
25
25
  Restart Pi or run `/reload` after installation. If `@herbertgao/pi-extensions` already provides this extension, do not install the standalone package as well.
26
26
 
27
+ ## Session names
28
+
29
+ Expanding a skill rewrites the stored prompt, so `/resume` would otherwise show the skill body. A brand-new session is therefore named with the prompt you typed, both for a mid-prompt command and for a native start-of-prompt one, and later prompts leave that name alone. Extension-authored prompts do not trigger it.
30
+
31
+ ```text
32
+ Check this using the same pattern /skill:test
33
+ ```
34
+
35
+ That session appears in `/resume` as the sentence above, not as the expanded block. A prompt is named when it carries a recognised skill command: a native start-of-prompt command is named whether or not the skill exists, while a mid-prompt one is named only when it actually expands.
36
+
37
+ Sessions created before this package was installed keep their stored block until you run:
38
+
39
+ ```text
40
+ /resume-session-name
41
+ ```
42
+
43
+ It rebuilds the typed prompt from the first message's skill block (`/skill:name argue this` for a native command, the original sentence for a mid-prompt one) and sets it as the session name. Because a native block stores only the arguments, args that repeat the command itself (`/skill:name write about /skill:name usage`) come back without the leading command. Renaming writes one `session_info` entry, the same as `/name`, so `/name` and `/resume` both see it. The command reports a message and changes nothing when the first message with non-blank text has no skill block.
44
+
27
45
  ## Compatibility
28
46
 
29
47
  Pi currently filters `/` out of extension-provided autocomplete trigger characters. To provide automatic mid-text completion anyway, this package patches `CustomEditor` once and calls its private autocomplete trigger. It does not replace the active editor factory, so editor customizations from other packages remain in place. That internal dependency can break when Pi changes its editor. If the private trigger is unavailable, mid-text Tab completion and submission-time expansion still work.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-inline-skill-commands",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Complete and expand Pi's native /skill:name commands within a larger prompt.",
5
5
  "keywords": [
6
6
  "autocomplete",
@@ -3,10 +3,13 @@ import {
3
3
  CustomEditor,
4
4
  DefaultResourceLoader,
5
5
  getAgentDir,
6
+ parseSkillBlock,
6
7
  SettingsManager,
7
8
  stripFrontmatter,
8
9
  type ExtensionAPI,
9
10
  type ExtensionContext,
11
+ type InputSource,
12
+ type ParsedSkillBlock,
10
13
  type Skill,
11
14
  } from "@earendil-works/pi-coding-agent"
12
15
  import type {
@@ -208,6 +211,40 @@ async function loadSessionSkills(ctx: ExtensionContext): Promise<SkillMap> {
208
211
  )
209
212
  }
210
213
 
214
+ /** Rebuild the typed prompt from a stored skill block, keeping the command readable. */
215
+ function sessionNameFromBlock(block: ParsedSkillBlock): string {
216
+ const rest = block.userMessage?.trim()
217
+ // A body containing `</skill>` makes Pi's non-greedy envelope split early; the tail is not prose.
218
+ if (!rest || rest.includes("<skill ") || rest.includes("</skill>")) {
219
+ return `/skill:${block.name}`
220
+ }
221
+ // Same trailing rule as the expansion pattern: a dotted longer name is a different command.
222
+ const command = new RegExp(
223
+ `(^|${MID_SKILL_BOUNDARY})/skill:${escapeRegExp(block.name)}(?!\\.?[A-Za-z0-9_-])`,
224
+ )
225
+ return command.test(rest) ? rest : `/skill:${block.name} ${rest}`
226
+ }
227
+
228
+ function messageText(message: { content: unknown }): string {
229
+ const content = message.content
230
+ if (typeof content === "string") return content
231
+ if (!Array.isArray(content)) return ""
232
+ return content
233
+ .filter((part) => part?.type === "text")
234
+ .map((part) => part.text as string)
235
+ .join(" ")
236
+ }
237
+
238
+ /** First user message with non-blank text, so a text-less message never decides a name. */
239
+ function firstUserMessageText(ctx: ExtensionContext): string | undefined {
240
+ for (const entry of ctx.sessionManager.getEntries()) {
241
+ if (entry.type !== "message" || entry.message.role !== "user") continue
242
+ const text = messageText(entry.message)
243
+ if (text.trim()) return text
244
+ }
245
+ return undefined
246
+ }
247
+
211
248
  export default function piInlineSkillCommands(pi: ExtensionAPI): void {
212
249
  let skillsPromise: Promise<SkillMap> | undefined
213
250
  installMidSkillTrigger()
@@ -234,6 +271,49 @@ export default function piInlineSkillCommands(pi: ExtensionAPI): void {
234
271
  pi.on("input", async (event, ctx) => {
235
272
  if (!MID_SKILL_COMMAND.test(event.text)) return
236
273
  const text = expandMidSkillCommand(event.text, await getSkills(ctx))
274
+ const nativeStart = event.text.trimStart().startsWith("/skill:")
275
+ if (text === undefined && !nativeStart) return
276
+ try {
277
+ nameFirstSkillPrompt(pi, event.source, event.text, ctx)
278
+ } catch {
279
+ // A session name is cosmetic; never let it abort the expansion below.
280
+ }
237
281
  return text === undefined ? undefined : { action: "transform", text }
238
282
  })
283
+
284
+ pi.registerCommand("resume-session-name", {
285
+ description:
286
+ "Name this session from its first prompt instead of the expanded skill block",
287
+ handler: async (_args, ctx) => {
288
+ const first = firstUserMessageText(ctx)
289
+ if (first === undefined) {
290
+ ctx.ui.notify("This session has no user message with text yet", "info")
291
+ return
292
+ }
293
+ const block = parseSkillBlock(first)
294
+ if (!block) {
295
+ ctx.ui.notify("The first message has no expanded skill block", "info")
296
+ return
297
+ }
298
+ const name = sessionNameFromBlock(block)
299
+ pi.setSessionName(name)
300
+ ctx.ui.notify(`Session name set: ${pi.getSessionName() ?? name}`, "info")
301
+ },
302
+ })
303
+ }
304
+
305
+ /** A fresh session keeps the typed prompt as its name instead of the expanded block. */
306
+ function nameFirstSkillPrompt(
307
+ pi: ExtensionAPI,
308
+ source: InputSource,
309
+ text: string,
310
+ ctx: ExtensionContext,
311
+ ): void {
312
+ // Extension-authored prompts are not the user's first prompt.
313
+ if (source === "extension") return
314
+ if (ctx.sessionManager.getSessionName()) return
315
+ // A text-less first message leaves `/resume` showing the block, so it must not block naming.
316
+ if (firstUserMessageText(ctx) !== undefined) return
317
+ const name = text.trim()
318
+ if (name) pi.setSessionName(name)
239
319
  }