viveworker 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "viveworker",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A local iPhone companion for Codex Desktop approvals, plans, questions, and completions.",
5
+ "author": "oeneril <hoshino.lireneo@gmail.com>",
6
+ "keywords": [
7
+ "vivecoding",
8
+ "codex",
9
+ "remote"
10
+ ],
11
+ "homepage": "https://lp.hazbase.com/",
12
+ "repository": "viveworker/viveworker",
5
13
  "type": "module",
6
14
  "bin": {
7
15
  "viveworker": "./scripts/viveworker.mjs"
@@ -8502,7 +8502,7 @@ function summarizeNotificationText(value) {
8502
8502
  }
8503
8503
 
8504
8504
  function normalizeLongText(value) {
8505
- return String(stripMarkdownLinks(value) || "")
8505
+ return String(stripEnvironmentContextBlocks(stripMarkdownLinks(value)) || "")
8506
8506
  .replace(/\r\n/gu, "\n")
8507
8507
  .replace(/[ \t]+\n/gu, "\n")
8508
8508
  .replace(/\n{3,}/gu, "\n\n")
@@ -8575,6 +8575,13 @@ function stripMarkdownLinks(value) {
8575
8575
  return String(value || "").replace(/\[([^\]]+)\]\(([^)]+)\)/gu, "$1");
8576
8576
  }
8577
8577
 
8578
+ function stripEnvironmentContextBlocks(value) {
8579
+ return String(value || "")
8580
+ .replace(/<environment_context>[\s\S]*?<\/environment_context>\s*/giu, "")
8581
+ .replace(/^\s*<environment_context>[\s\S]*$/giu, "")
8582
+ .replace(/^\s*environment_context\s*$/gimu, "");
8583
+ }
8584
+
8578
8585
  function stripNotificationMarkup(value) {
8579
8586
  return String(value || "")
8580
8587
  .replace(/^\s*<\/?proposed_plan>\s*$/gimu, "")
package/web/app.js CHANGED
@@ -6,6 +6,7 @@ const PUSH_BANNER_DISMISS_KEY = "viveworker-push-banner-dismissed-v1";
6
6
  const INITIAL_DETECTED_LOCALE = detectBrowserLocale();
7
7
  const TIMELINE_MESSAGE_KINDS = new Set(["user_message", "assistant_commentary", "assistant_final"]);
8
8
  const TIMELINE_OPERATIONAL_KINDS = new Set(["approval", "plan", "plan_ready", "choice", "completion"]);
9
+ const THREAD_FILTER_INTERACTION_DEFER_MS = 8000;
9
10
 
10
11
  const state = {
11
12
  session: null,
@@ -29,6 +30,7 @@ const state = {
29
30
  pendingDetailScrollReset: false,
30
31
  listScrollState: null,
31
32
  pendingListScrollRestore: false,
33
+ threadFilterInteractionUntilMs: 0,
32
34
  choiceLocalDrafts: {},
33
35
  completionReplyDrafts: {},
34
36
  pairError: "",
@@ -124,7 +126,7 @@ async function boot() {
124
126
  return;
125
127
  }
126
128
  await refreshAuthenticatedState();
127
- if (!shouldDeferRenderForActiveReplyComposer()) {
129
+ if (!shouldDeferRenderForActiveInteraction()) {
128
130
  await renderShell();
129
131
  }
130
132
  }, 3000);
@@ -674,15 +676,30 @@ function currentViewportScrollY() {
674
676
  return window.scrollY || window.pageYOffset || document.documentElement?.scrollTop || 0;
675
677
  }
676
678
 
677
- function shouldDeferRenderForActiveReplyComposer() {
679
+ function markThreadFilterInteraction() {
680
+ state.threadFilterInteractionUntilMs = Date.now() + THREAD_FILTER_INTERACTION_DEFER_MS;
681
+ }
682
+
683
+ function clearThreadFilterInteraction() {
684
+ state.threadFilterInteractionUntilMs = 0;
685
+ }
686
+
687
+ function shouldDeferRenderForActiveInteraction() {
678
688
  const activeElement = document.activeElement;
679
- if (!(activeElement instanceof HTMLTextAreaElement)) {
680
- return false;
689
+ if (
690
+ activeElement instanceof HTMLTextAreaElement &&
691
+ activeElement.matches("[data-completion-reply-textarea]") &&
692
+ normalizeClientText(activeElement.dataset.replyToken) === normalizeClientText(state.currentItem?.token)
693
+ ) {
694
+ return true;
681
695
  }
682
- if (!activeElement.matches("[data-completion-reply-textarea]")) {
683
- return false;
696
+ if (
697
+ activeElement instanceof HTMLSelectElement &&
698
+ activeElement.matches("[data-timeline-thread-select], [data-completed-thread-select]")
699
+ ) {
700
+ return true;
684
701
  }
685
- return normalizeClientText(activeElement.dataset.replyToken) === normalizeClientText(state.currentItem?.token);
702
+ return state.threadFilterInteractionUntilMs > Date.now();
686
703
  }
687
704
 
688
705
  function normalizeChoiceAnswersMap(value) {
@@ -2712,7 +2729,18 @@ function bindShellInteractions() {
2712
2729
  }
2713
2730
 
2714
2731
  for (const select of document.querySelectorAll("[data-timeline-thread-select]")) {
2732
+ const handleInteractionStart = () => {
2733
+ markThreadFilterInteraction();
2734
+ };
2735
+ const handleInteractionEnd = () => {
2736
+ clearThreadFilterInteraction();
2737
+ };
2738
+ select.addEventListener("pointerdown", handleInteractionStart);
2739
+ select.addEventListener("click", handleInteractionStart);
2740
+ select.addEventListener("focus", handleInteractionStart);
2741
+ select.addEventListener("blur", handleInteractionEnd);
2715
2742
  select.addEventListener("change", async () => {
2743
+ clearThreadFilterInteraction();
2716
2744
  state.timelineThreadFilter = select.value || "all";
2717
2745
  alignCurrentItemToVisibleEntries();
2718
2746
  await renderShell();
@@ -2720,7 +2748,18 @@ function bindShellInteractions() {
2720
2748
  }
2721
2749
 
2722
2750
  for (const select of document.querySelectorAll("[data-completed-thread-select]")) {
2751
+ const handleInteractionStart = () => {
2752
+ markThreadFilterInteraction();
2753
+ };
2754
+ const handleInteractionEnd = () => {
2755
+ clearThreadFilterInteraction();
2756
+ };
2757
+ select.addEventListener("pointerdown", handleInteractionStart);
2758
+ select.addEventListener("click", handleInteractionStart);
2759
+ select.addEventListener("focus", handleInteractionStart);
2760
+ select.addEventListener("blur", handleInteractionEnd);
2723
2761
  select.addEventListener("change", async () => {
2762
+ clearThreadFilterInteraction();
2724
2763
  state.completedThreadFilter = select.value || "all";
2725
2764
  alignCurrentItemToVisibleEntries();
2726
2765
  await renderShell();