@copilotkit/web-inspector 1.71.0 → 1.71.2

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.
package/dist/index.cjs CHANGED
@@ -503,6 +503,10 @@ const AGENT_EVENT_TYPES = [
503
503
  "ACTIVITY_SNAPSHOT",
504
504
  "ACTIVITY_DELTA"
505
505
  ];
506
+ const THREADS_LOCKED_COPY = {
507
+ heading: "Production-grade chat threads without the complexity. Self hostable.",
508
+ description: "Chat threads that go beyond text with generative UI and multimodal inputs, built to replay missed events and stay in sync across tabs, sessions, and devices."
509
+ };
506
510
  const EMPTY_INSPECTOR_MESSAGES = [];
507
511
  function textFromUnknownContent(content) {
508
512
  if (typeof content === "string") return content;
@@ -4978,6 +4982,7 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
4978
4982
  };
4979
4983
  this.lastScrolledAgentNavigationLayout = null;
4980
4984
  this.selectedThreadId = null;
4985
+ this.ephemeralThreadsSetupOpen = false;
4981
4986
  this.inAppThreadId = null;
4982
4987
  this.inAppAgentId = null;
4983
4988
  this.inAppSource = null;
@@ -5261,14 +5266,14 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
5261
5266
  const clipboard = this.getClipboard(event);
5262
5267
  if (!clipboard?.writeText) return false;
5263
5268
  try {
5264
- await clipboard.writeText(require_home_briefing.homeFeatureImplementationPrompt(service, { onboardingRunId }));
5269
+ await clipboard.writeText(require_onboarding_prompt.createFeatureOnboardingPrompt(service.id, onboardingRunId));
5265
5270
  return true;
5266
5271
  } catch {
5267
5272
  return false;
5268
5273
  }
5269
5274
  };
5270
5275
  this.handleLearningSetupCopy = async (event, recopy = false) => {
5271
- const service = this.getHomeFeaturePromptTarget("threads");
5276
+ const service = this.getHomeFeaturePromptTarget("memory");
5272
5277
  if (!service || !this.core?.runtimeUrl) return;
5273
5278
  const request = ++this.learningSetupCopyRequest;
5274
5279
  const copied = await this.copyFeaturePromptToClipboard(service, event, this.getOnboardingRunId());
@@ -6064,6 +6069,7 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
6064
6069
  if (oldValue === value) return;
6065
6070
  this.detachFromCore();
6066
6071
  const hadResolvedCore = this.hasResolvedCore;
6072
+ this.ephemeralThreadsSetupOpen = false;
6067
6073
  this._core = value ?? null;
6068
6074
  if (this._core) this.hasResolvedCore = true;
6069
6075
  if (!hadResolvedCore && this._core) this.resolvePendingPersistedMenu();
@@ -6233,7 +6239,7 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
6233
6239
  }
6234
6240
  /** Report only real rows visible in the active, settled Threads view. */
6235
6241
  hasActiveVisibleThreads() {
6236
- if (this.selectedMenu !== "threads" || this.settingsOpen || !this.areThreadEndpointsAvailable()) return false;
6242
+ if (this.selectedMenu !== "threads" || this.settingsOpen || this.ephemeralThreadsSetupOpen || !this.areThreadEndpointsAvailable()) return false;
6237
6243
  const { displayThreads, threadsErrorMessage, threadsLoading } = this.getActiveThreadsState();
6238
6244
  return !threadsErrorMessage && !threadsLoading && displayThreads.length > 0;
6239
6245
  }
@@ -8540,6 +8546,24 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
8540
8546
  );
8541
8547
  }
8542
8548
 
8549
+ /* With no news or setup actions, the dismissal is the whole HUD. */
8550
+ .cpk-launcher-hud[data-cpk-hud-dismiss-only] {
8551
+ --hud-dismiss-day-height: 36px;
8552
+ width: max-content;
8553
+ }
8554
+
8555
+ .cpk-launcher-hud[data-cpk-hud-dismiss-only][data-cpk-hud-vertical="top"] {
8556
+ top: calc((var(--cpk-launcher-size) - var(--hud-dismiss-day-height)) / 2);
8557
+ }
8558
+
8559
+ .cpk-launcher-hud[data-cpk-hud-dismiss-only][data-cpk-hud-vertical="bottom"] {
8560
+ bottom: calc((var(--cpk-launcher-size) - var(--hud-dismiss-day-height)) / 2);
8561
+ }
8562
+
8563
+ .cpk-launcher-hud[data-cpk-hud-dismiss-only] .cpk-launcher-hud__card {
8564
+ width: max-content;
8565
+ }
8566
+
8543
8567
  .cpk-launcher-hud__list {
8544
8568
  margin: 0;
8545
8569
  padding: 0;
@@ -8706,6 +8730,11 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
8706
8730
  color 120ms ease;
8707
8731
  }
8708
8732
 
8733
+ .cpk-launcher-hud[data-cpk-hud-dismiss-only] .cpk-launcher-hud__dismiss-day {
8734
+ font-size: 11px;
8735
+ white-space: nowrap;
8736
+ }
8737
+
8709
8738
  .cpk-launcher-hud__dismiss-day:hover,
8710
8739
  .cpk-launcher-hud__dismiss-day:focus-visible {
8711
8740
  border-color: var(--hud-accent);
@@ -9925,6 +9954,7 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
9925
9954
  return titleCharacters.length > HUD_ANNOUNCEMENT_TITLE_LIMIT ? `${titleCharacters.slice(0, HUD_ANNOUNCEMENT_TITLE_LIMIT).join("").trimEnd()}...` : title;
9926
9955
  }
9927
9956
  renderHudRow(args) {
9957
+ if (args.connected) return lit.nothing;
9928
9958
  const detailId = `cpk-hud-detail-${args.id}`;
9929
9959
  return lit.html`
9930
9960
  <li
@@ -9996,11 +10026,13 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
9996
10026
  const learningOn = homeModel.services.some((service) => service.id === "memory" && service.enabled);
9997
10027
  const announcementTitle = this.getUnreadAnnouncementTitle();
9998
10028
  const featureBlockIntroIndex = announcementTitle ? 1 : 0;
10029
+ const dismissOnly = !announcementTitle && threadsOn && learningOn;
9999
10030
  return lit.html`
10000
10031
  <div
10001
10032
  class="cpk-launcher-hud"
10002
10033
  id="cpk-launcher-hud"
10003
10034
  data-cpk-launcher-hud
10035
+ ?data-cpk-hud-dismiss-only=${dismissOnly}
10004
10036
  data-cpk-hud-side=${this.launcherHudSide}
10005
10037
  data-cpk-hud-vertical=${this.contextState.button.anchor.vertical}
10006
10038
  data-cpk-hud-intro=${this.launcherHudIntro ? "true" : lit.nothing}
@@ -10010,7 +10042,9 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
10010
10042
  "--cpk-launcher-hud-waterfall-duration": `${LAUNCHER_HUD_INTRO_MS.waterfallDuration}ms`
10011
10043
  })}
10012
10044
  >
10013
- <span class="cpk-launcher-hud__arrow" aria-hidden="true"></span>
10045
+ ${dismissOnly ? lit.nothing : lit.html`
10046
+ <span class="cpk-launcher-hud__arrow" aria-hidden="true"></span>
10047
+ `}
10014
10048
  <div class="cpk-launcher-hud__card">
10015
10049
  ${announcementTitle ? lit.html`
10016
10050
  <div
@@ -10049,31 +10083,33 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
10049
10083
  </div>
10050
10084
  </div>
10051
10085
  ` : lit.nothing}
10052
- <ul
10053
- class="cpk-launcher-hud__list cpk-launcher-hud__feature-list"
10054
- role="list"
10055
- style=${(0, lit_directives_style_map_js.styleMap)({ "--cpk-hud-waterfall-delay": launcherHudWaterfallDelay(featureBlockIntroIndex) })}
10056
- >
10057
- ${this.renderHudRow({
10086
+ ${threadsOn && learningOn ? lit.nothing : lit.html`
10087
+ <ul
10088
+ class="cpk-launcher-hud__list cpk-launcher-hud__feature-list"
10089
+ role="list"
10090
+ style=${(0, lit_directives_style_map_js.styleMap)({ "--cpk-hud-waterfall-delay": launcherHudWaterfallDelay(featureBlockIntroIndex) })}
10091
+ >
10092
+ ${this.renderHudRow({
10058
10093
  id: "threads",
10059
10094
  label: HUD_THREADS_LABEL,
10060
10095
  icon: "MessageSquare",
10061
10096
  connected: threadsOn,
10062
10097
  introIndex: featureBlockIntroIndex + 1
10063
10098
  })}
10064
- ${this.renderHudRow({
10099
+ ${this.renderHudRow({
10065
10100
  id: "learning",
10066
10101
  label: HUD_LEARNING_LABEL,
10067
10102
  icon: "Brain",
10068
10103
  connected: learningOn,
10069
- introIndex: featureBlockIntroIndex + 2
10104
+ introIndex: featureBlockIntroIndex + (threadsOn ? 1 : 2)
10070
10105
  })}
10071
- </ul>
10106
+ </ul>
10107
+ `}
10072
10108
  <button
10073
10109
  type="button"
10074
10110
  class="cpk-launcher-hud__dismiss-day"
10075
10111
  data-cpk-dismiss-inspector="day"
10076
- style=${(0, lit_directives_style_map_js.styleMap)({ "--cpk-hud-waterfall-delay": launcherHudWaterfallDelay(featureBlockIntroIndex + 3) })}
10112
+ style=${(0, lit_directives_style_map_js.styleMap)({ "--cpk-hud-waterfall-delay": launcherHudWaterfallDelay(dismissOnly ? 0 : featureBlockIntroIndex + Number(!threadsOn) + Number(!learningOn) + 1) })}
10077
10113
  @click=${this.handleHudDismissDayClick}
10078
10114
  @pointerdown=${(event) => event.stopPropagation()}
10079
10115
  >
@@ -13482,23 +13518,6 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
13482
13518
  </div>
13483
13519
  `;
13484
13520
  }
13485
- getThreadsLockedCopy() {
13486
- switch (this.inspectorMetadataProjection.licenseState) {
13487
- case "valid": return {
13488
- heading: "Finish setting up Rich Threads",
13489
- description: "Copy this prompt into your coding agent to finish the setup."
13490
- };
13491
- case "none":
13492
- case "unknown": return {
13493
- heading: "Production-grade chat threads without the complexity. Self hostable.",
13494
- description: "Chat threads that go beyond text with generative UI and multimodal inputs, built to replay missed events and stay in sync across tabs, sessions, and devices."
13495
- };
13496
- case "expired": return {
13497
- heading: "Renew Intelligence to inspect Threads.",
13498
- description: "Your Intelligence access has expired. Renew it to inspect saved thread history."
13499
- };
13500
- }
13501
- }
13502
13521
  /**
13503
13522
  * Renders the realtime-connection indicator in the memory-store header.
13504
13523
  * Only `"connected"` shows the live (green-dot) state; `"connecting"` shows a
@@ -13549,7 +13568,7 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
13549
13568
  videoTitle: "CopilotKit Learning overview",
13550
13569
  outlineItems: LEARNING_LOCKED_FEATURE_OUTLINE,
13551
13570
  setupPrompt: {
13552
- serviceId: "threads",
13571
+ serviceId: "memory",
13553
13572
  copyState: this.learningPromptCopyState,
13554
13573
  onClick: (event) => void this.handleLearningSetupCopy(event)
13555
13574
  }
@@ -13565,7 +13584,7 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
13565
13584
  .setupActive=${this.isLearningSetupActive()}
13566
13585
  .copyState=${this.learningPromptCopyState}
13567
13586
  .recopyState=${this.learningPromptRecopyState}
13568
- .setupPrompt=${this.getHomeFeaturePromptTarget("threads") ? require_home_briefing.homeFeatureImplementationPrompt(this.getHomeFeaturePromptTarget("threads"), { onboardingRunId: this.getOnboardingRunId() }) : ""}
13587
+ .setupPrompt=${require_onboarding_prompt.createFeatureOnboardingPrompt("memory", this.getOnboardingRunId())}
13569
13588
  @learning-retry=${() => this.refreshLearningSnapshot({ preserve: this.learningSnapshot !== null })}
13570
13589
  @learning-copy-setup=${(event) => this.handleLearningSetupCopy(event)}
13571
13590
  @learning-recopy-setup=${(event) => this.handleLearningSetupCopy(event, true)}
@@ -13805,20 +13824,36 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
13805
13824
  `;
13806
13825
  }
13807
13826
  renderThreadsView() {
13808
- if (!this.areThreadEndpointsAvailable()) {
13827
+ const { displayThreads, threadsErrorMessage, threadsLoading } = this.getActiveThreadsState();
13828
+ const ephemeral = !this._core?.intelligence;
13829
+ const available = this.areThreadEndpointsAvailable();
13830
+ const hasEphemeralThreads = ephemeral && available && displayThreads.length > 0;
13831
+ if (!ephemeral) this.ephemeralThreadsSetupOpen = false;
13832
+ if (!available || ephemeral && displayThreads.length === 0 && !threadsLoading && !threadsErrorMessage || this.ephemeralThreadsSetupOpen) {
13809
13833
  this.trackThreadsViewStateOnce("locked");
13810
- const lockedCopy = this.getThreadsLockedCopy();
13811
- return this.renderLockedFeatureOverview({
13834
+ return lit.html`
13835
+ ${hasEphemeralThreads ? lit.html`
13836
+ <nav class="cpk-threads-setup-navigation" aria-label="Threads setup navigation">
13837
+ <button type="button" class="cpk-threads-setup-back"
13838
+ data-inspector-ephemeral-back
13839
+ @click=${() => {
13840
+ this.ephemeralThreadsSetupOpen = false;
13841
+ this.requestUpdate();
13842
+ }}>
13843
+ <span aria-hidden="true">←</span> Back to your threads
13844
+ </button>
13845
+ </nav>
13846
+ ` : lit.nothing}
13847
+ ${this.renderLockedFeatureOverview({
13812
13848
  serviceId: "threads",
13813
13849
  featureName: "Rich Threads",
13814
- heading: lockedCopy.heading,
13815
- description: lockedCopy.description,
13850
+ heading: THREADS_LOCKED_COPY.heading,
13851
+ description: THREADS_LOCKED_COPY.description,
13816
13852
  videoUrl: THREADS_LOCKED_VIDEO_URL,
13817
13853
  videoTitle: "Rich Threads overview",
13818
13854
  outlineItems: THREADS_LOCKED_FEATURE_OUTLINE
13819
- });
13855
+ })}`;
13820
13856
  }
13821
- const { displayThreads, threadsErrorMessage, threadsLoading } = this.getActiveThreadsState();
13822
13857
  const loadingWithoutRows = threadsLoading && !threadsErrorMessage && displayThreads.length === 0;
13823
13858
  const showingExamples = this.shouldRenderExampleThreads(displayThreads, threadsErrorMessage, threadsLoading);
13824
13859
  const visibleThreads = threadsErrorMessage || loadingWithoutRows ? [] : showingExamples ? THREADS_EXAMPLE_THREADS : displayThreads;
@@ -13835,6 +13870,24 @@ var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
13835
13870
  <div
13836
13871
  style="width:${this.threadListWidth}px;flex-shrink:0;overflow:hidden;display:flex;flex-direction:column;border-right:1px solid #DBDBE5;"
13837
13872
  >
13873
+ ${ephemeral ? lit.html`
13874
+ <button type="button" class="cpk-ephemeral-threads-banner"
13875
+ data-inspector-ephemeral-banner data-inspector-ephemeral-upgrade
13876
+ aria-label="Make threads permanent. Ephemeral history can disappear on restart."
13877
+ @click=${() => {
13878
+ this.ephemeralThreadsSetupOpen = true;
13879
+ this.requestUpdate();
13880
+ }}>
13881
+ <span class="cpk-ephemeral-threads-icon" aria-hidden="true">${this.renderIcon("Clock")}</span>
13882
+ <span class="cpk-ephemeral-threads-copy">
13883
+ <span class="cpk-ephemeral-threads-headline">
13884
+ <strong>Keep your threads.</strong>
13885
+ </span>
13886
+ <span class="cpk-ephemeral-threads-description">Ephemeral history can disappear on restart.</span>
13887
+ <span class="cpk-ephemeral-threads-upgrade">Make them permanent <span aria-hidden="true">${this.renderIcon("ArrowRight")}</span></span>
13888
+ </span>
13889
+ </button>
13890
+ ` : lit.nothing}
13838
13891
  <cpk-thread-list
13839
13892
  style="min-height:0;flex:1;"
13840
13893
  data-color-scheme=${this.colorScheme}