@oh-my-pi/pi-coding-agent 15.11.7 → 15.12.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 (107) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/dist/cli.js +8106 -7708
  3. package/dist/types/cli/args.d.ts +2 -0
  4. package/dist/types/collab/crypto.d.ts +7 -0
  5. package/dist/types/collab/guest.d.ts +23 -0
  6. package/dist/types/collab/host.d.ts +29 -0
  7. package/dist/types/collab/protocol.d.ts +113 -0
  8. package/dist/types/collab/relay-client.d.ts +22 -0
  9. package/dist/types/commands/join.d.ts +12 -0
  10. package/dist/types/config/settings-schema.d.ts +60 -5
  11. package/dist/types/export/custom-share.d.ts +1 -2
  12. package/dist/types/export/html/index.d.ts +39 -1
  13. package/dist/types/export/share.d.ts +43 -0
  14. package/dist/types/extensibility/slash-commands.d.ts +1 -11
  15. package/dist/types/main.d.ts +2 -0
  16. package/dist/types/modes/components/agent-hub.d.ts +32 -1
  17. package/dist/types/modes/components/collab-prompt-message.d.ts +10 -0
  18. package/dist/types/modes/components/hook-selector.d.ts +4 -6
  19. package/dist/types/modes/components/segment-track.d.ts +11 -6
  20. package/dist/types/modes/components/status-line/component.d.ts +10 -2
  21. package/dist/types/modes/components/status-line/types.d.ts +11 -0
  22. package/dist/types/modes/controllers/event-controller.d.ts +7 -0
  23. package/dist/types/modes/controllers/input-controller.d.ts +1 -1
  24. package/dist/types/modes/controllers/session-focus-controller.d.ts +31 -0
  25. package/dist/types/modes/interactive-mode.d.ts +16 -0
  26. package/dist/types/modes/session-observer-registry.d.ts +7 -0
  27. package/dist/types/modes/theme/theme.d.ts +2 -1
  28. package/dist/types/modes/types.d.ts +20 -0
  29. package/dist/types/session/agent-session.d.ts +13 -0
  30. package/dist/types/session/codex-auto-reset.d.ts +8 -4
  31. package/dist/types/session/session-manager.d.ts +21 -0
  32. package/dist/types/session/snapcompact-inline.d.ts +6 -3
  33. package/dist/types/slash-commands/builtin-registry.d.ts +9 -0
  34. package/dist/types/task/executor.d.ts +7 -0
  35. package/dist/types/task/types.d.ts +9 -0
  36. package/package.json +14 -13
  37. package/scripts/bench-guard.ts +71 -0
  38. package/scripts/build-binary.ts +4 -0
  39. package/scripts/bundle-dist.ts +4 -0
  40. package/scripts/generate-share-viewer.ts +34 -0
  41. package/src/cli/args.ts +2 -0
  42. package/src/cli-commands.ts +1 -0
  43. package/src/collab/crypto.ts +63 -0
  44. package/src/collab/guest.ts +450 -0
  45. package/src/collab/host.ts +556 -0
  46. package/src/collab/protocol.ts +232 -0
  47. package/src/collab/relay-client.ts +216 -0
  48. package/src/commands/join.ts +39 -0
  49. package/src/config/model-registry.ts +22 -14
  50. package/src/config/settings-schema.ts +67 -5
  51. package/src/config/settings.ts +12 -0
  52. package/src/export/custom-share.ts +1 -1
  53. package/src/export/html/index.ts +122 -17
  54. package/src/export/html/share-loader.js +102 -0
  55. package/src/export/html/template.css +745 -459
  56. package/src/export/html/template.html +6 -3
  57. package/src/export/html/template.js +240 -915
  58. package/src/export/html/tool-views.generated.js +38 -0
  59. package/src/export/share.ts +268 -0
  60. package/src/extensibility/slash-commands.ts +1 -97
  61. package/src/internal-urls/docs-index.generated.ts +74 -73
  62. package/src/main.ts +33 -11
  63. package/src/modes/components/agent-hub.ts +659 -431
  64. package/src/modes/components/assistant-message.ts +126 -6
  65. package/src/modes/components/collab-prompt-message.ts +30 -0
  66. package/src/modes/components/hook-selector.ts +4 -5
  67. package/src/modes/components/segment-track.ts +44 -7
  68. package/src/modes/components/status-line/component.ts +59 -6
  69. package/src/modes/components/status-line/presets.ts +1 -1
  70. package/src/modes/components/status-line/segments.ts +18 -1
  71. package/src/modes/components/status-line/types.ts +12 -0
  72. package/src/modes/components/tips.txt +4 -1
  73. package/src/modes/controllers/command-controller.ts +55 -96
  74. package/src/modes/controllers/event-controller.ts +45 -16
  75. package/src/modes/controllers/input-controller.ts +175 -9
  76. package/src/modes/controllers/selector-controller.ts +13 -15
  77. package/src/modes/controllers/session-focus-controller.ts +112 -0
  78. package/src/modes/controllers/streaming-reveal.ts +7 -0
  79. package/src/modes/interactive-mode.ts +56 -6
  80. package/src/modes/session-observer-registry.ts +11 -0
  81. package/src/modes/theme/theme.ts +6 -0
  82. package/src/modes/types.ts +20 -0
  83. package/src/modes/utils/ui-helpers.ts +23 -13
  84. package/src/prompts/tools/job.md +1 -1
  85. package/src/sdk.ts +239 -36
  86. package/src/session/agent-session.ts +82 -7
  87. package/src/session/codex-auto-reset.ts +23 -11
  88. package/src/session/session-manager.ts +44 -0
  89. package/src/session/snapcompact-inline.ts +9 -3
  90. package/src/slash-commands/builtin-registry.ts +261 -24
  91. package/src/task/executor.ts +14 -0
  92. package/src/task/index.ts +5 -1
  93. package/src/task/render.ts +76 -5
  94. package/src/task/types.ts +9 -0
  95. package/src/tiny/worker.ts +17 -95
  96. package/src/tools/job.ts +6 -9
  97. package/src/tools/read.ts +38 -5
  98. package/src/tools/write.ts +13 -42
  99. package/dist/tokenizers.linux-x64-gnu-xcjh3jwk.node +0 -0
  100. package/dist/types/export/html/template.generated.d.ts +0 -1
  101. package/dist/types/export/html/template.macro.d.ts +0 -5
  102. package/dist/types/tiny/compiled-runtime.d.ts +0 -35
  103. package/scripts/generate-template.ts +0 -33
  104. package/src/bun-imports.d.ts +0 -28
  105. package/src/export/html/template.generated.ts +0 -2
  106. package/src/export/html/template.macro.ts +0 -25
  107. package/src/tiny/compiled-runtime.ts +0 -179
package/src/main.ts CHANGED
@@ -66,6 +66,7 @@ import {
66
66
  import type { AgentSession } from "./session/agent-session";
67
67
  import type { AuthStorage } from "./session/auth-storage";
68
68
  import { resolveResumableSession, type SessionInfo, SessionManager } from "./session/session-manager";
69
+ import { executeBuiltinSlashCommand } from "./slash-commands/builtin-registry";
69
70
  import { discoverTitleSystemPromptFile, resolvePromptInput } from "./system-prompt";
70
71
  import { initTelemetryExport, isTelemetryExportEnabled } from "./telemetry-export";
71
72
  import { AUTO_THINKING } from "./thinking";
@@ -243,6 +244,22 @@ export interface InteractiveModeNotify {
243
244
  message: string;
244
245
  }
245
246
 
247
+ export function buildModelScopeNotification(
248
+ scopedModelsForDisplay: readonly Pick<ScopedModel, "model" | "thinkingLevel" | "explicitThinkingLevel">[],
249
+ startupQuiet: boolean,
250
+ ): InteractiveModeNotify | null {
251
+ if (startupQuiet || scopedModelsForDisplay.length === 0) {
252
+ return null;
253
+ }
254
+ const modelList = scopedModelsForDisplay
255
+ .map(scopedModel => {
256
+ const thinkingStr =
257
+ scopedModel.explicitThinkingLevel && scopedModel.thinkingLevel ? `:${scopedModel.thinkingLevel}` : "";
258
+ return `${scopedModel.model.id}${thinkingStr}`;
259
+ })
260
+ .join(", ");
261
+ return { kind: "info", message: `Model scope: ${modelList} (Ctrl+P to cycle)` };
262
+ }
246
263
  export async function submitInteractiveInput(
247
264
  mode: Pick<
248
265
  InteractiveMode,
@@ -346,6 +363,7 @@ async function runInteractiveMode(
346
363
  initialMessage?: string,
347
364
  initialImages?: ImageContent[],
348
365
  titleSystemPrompt?: string,
366
+ joinLink?: string,
349
367
  ): Promise<void> {
350
368
  const mode = new InteractiveMode(
351
369
  session,
@@ -414,6 +432,12 @@ async function runInteractiveMode(
414
432
  }
415
433
  }
416
434
 
435
+ // `omp join <link>`: dispatch through the same builtin path as a typed
436
+ // `/join` so collab guards and error rendering stay in one place.
437
+ if (joinLink !== undefined) {
438
+ await executeBuiltinSlashCommand(`/join ${joinLink}`, { ctx: mode });
439
+ }
440
+
417
441
  if (initialMessage !== undefined) {
418
442
  try {
419
443
  using _keepalive = new EventLoopKeepalive();
@@ -889,7 +913,7 @@ export async function runRootCommand(
889
913
 
890
914
  // Create AuthStorage and ModelRegistry upfront
891
915
  const authStorage = await logger.time("discoverAuthStorage", deps.discoverAuthStorage ?? discoverAuthStorage);
892
- const modelRegistry = new ModelRegistry(authStorage);
916
+ const modelRegistry = logger.time("modelRegistry:init", () => new ModelRegistry(authStorage));
893
917
 
894
918
  if (parsedArgs.version) {
895
919
  process.stdout.write(`${VERSION}\n`);
@@ -1138,7 +1162,7 @@ export async function runRootCommand(
1138
1162
  // Both are no-ops when OTEL_EXPORTER_OTLP_ENDPOINT is unset. An empty config
1139
1163
  // is enough to enable telemetry — content capture is governed by the
1140
1164
  // standard OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT env var.
1141
- await initTelemetryExport();
1165
+ await logger.time("initTelemetryExport", initTelemetryExport);
1142
1166
  if (isTelemetryExportEnabled()) {
1143
1167
  sessionOptions.telemetry = {};
1144
1168
  }
@@ -1259,18 +1283,15 @@ export async function runRootCommand(
1259
1283
  const versionCheckPromise = checkForNewVersion(VERSION).catch(() => undefined);
1260
1284
  const changelogMarkdown = await logger.time("main:getChangelogForDisplay", getChangelogForDisplay, parsedArgs);
1261
1285
 
1262
- const scopedModelsForDisplay = sessionOptions.scopedModels ?? scopedModels;
1263
- if (scopedModelsForDisplay.length > 0) {
1264
- const modelList = scopedModelsForDisplay
1265
- .map(scopedModel => {
1266
- const thinkingStr = !scopedModel.thinkingLevel ? `:${scopedModel.thinkingLevel}` : "";
1267
- return `${scopedModel.model.id}${thinkingStr}`;
1268
- })
1269
- .join(", ");
1286
+ const modelScopeNotification = buildModelScopeNotification(
1287
+ scopedModels,
1288
+ settingsInstance.get("startup.quiet"),
1289
+ );
1290
+ if (modelScopeNotification) {
1270
1291
  // Routed through the TUI (not stdout): the startup capture owns the
1271
1292
  // terminal in raw mode here, and the TUI's first clearScrollback paint
1272
1293
  // would wipe a pre-TUI line anyway.
1273
- notifs.push({ kind: "info", message: `Model scope: ${modelList} (Ctrl+P to cycle)` });
1294
+ notifs.push(modelScopeNotification);
1274
1295
  }
1275
1296
 
1276
1297
  if ($env.PI_TIMING) {
@@ -1298,6 +1319,7 @@ export async function runRootCommand(
1298
1319
  initialMessage,
1299
1320
  initialImages,
1300
1321
  titleSystemPrompt,
1322
+ parsedArgs.join,
1301
1323
  );
1302
1324
  } else {
1303
1325
  // Branch-only single-shot runner: keep print-mode code out of normal interactive startup.