create-pmos 0.397.0 → 0.398.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 (145) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. package/workspace/public/pm/premium.js +0 -1146
@@ -0,0 +1,69 @@
1
+ /* pm/phone-moment.js — which moment of the day the phone companion is in, and what it brings (initiative c3-phone-companion).
2
+ * Pure: it reads today's meetings and the PM's own open items (GET /api/brief-page) and a clock, and returns one moment. No DOM, no fetch.
3
+ * Moved here from pm/c3-phone-model.js (premium-agreed-design), so premium pages load no c3-* module; c3-phone-model.js re-exports it.
4
+ *
5
+ * momentOf({ today, needs, now }) → { kind, meeting?, next?, minutes?, fits?, later }
6
+ * kind 'meeting' a meeting is under way (start ≤ now < end) meeting = that one
7
+ * 'before' the next meeting starts within BEFORE_MIN minutes meeting = the next one, minutes = until it starts
8
+ * 'after' a meeting ended less than AFTER_MIN minutes ago, nothing under way meeting = the one that ended
9
+ * 'gap' a free stretch of GAP_MIN minutes or more before the next meeting minutes = free minutes, fits = items that fit
10
+ * 'morning' before noon with no meeting under way or near next = the next meeting, or null
11
+ * 'work' working hours after noon with no meeting near next = the next meeting, or null
12
+ * 'recap' from WRAP_HOUR on: the evening recap of the day next = null
13
+ * 'night' from NIGHT_HOUR on, or before EARLY_HOUR: tomorrow at a glance next = null
14
+ * later the meetings still to come after the one the moment is about (time order), for "I'll bring up later".
15
+ * part the part of the day the moment belongs to (PART_OF), drawn as one icon in the header:
16
+ * morning · work (gap, work) · meeting (before, meeting, after) · evening (recap) · night
17
+ * fitsIn(needs, minutes) the own items worth doing in a free stretch: overdue first (most late first), then due today; at most two.
18
+ * The meeting rows are the brief page's today[] rows: { id, title, start, end, people, initiative, prepared, before }. */
19
+
20
+ export const BEFORE_MIN = 30;
21
+ export const AFTER_MIN = 20;
22
+ export const GAP_MIN = 15;
23
+ export const WRAP_HOUR = 17;
24
+ export const NIGHT_HOUR = 20;
25
+ export const EARLY_HOUR = 5;
26
+ export const PART_OF = Object.freeze({ morning: 'morning', gap: 'work', work: 'work', before: 'meeting', meeting: 'meeting', after: 'meeting', recap: 'evening', night: 'night' });
27
+
28
+ const ms = (iso) => Date.parse(iso);
29
+ const ok = (m) => m && m.id && !Number.isNaN(ms(m.start)) && !Number.isNaN(ms(m.end || m.start));
30
+
31
+ export function fitsIn(needs, minutes) {
32
+ if (!(minutes >= GAP_MIN)) return [];
33
+ const own = (needs || []).filter((n) => n && (n.kind === 'overdue' || n.kind === 'due-today'));
34
+ own.sort((a, b) => (a.kind === b.kind ? (b.days_late || 0) - (a.days_late || 0) : a.kind === 'overdue' ? -1 : 1));
35
+ return own.slice(0, 2);
36
+ }
37
+
38
+ export function momentOf(args = {}) {
39
+ const mo = kindOf(args);
40
+ return { ...mo, part: PART_OF[mo.kind] };
41
+ }
42
+
43
+ function kindOf({ today, needs, now } = {}) {
44
+ const t = (now instanceof Date ? now : new Date(now || Date.now())).getTime();
45
+ const hour = new Date(t).getHours();
46
+ const rows = (today || []).filter(ok).slice().sort((a, b) => ms(a.start) - ms(b.start));
47
+ const end = (m) => ms(m.end || m.start);
48
+ const cur = rows.find((m) => ms(m.start) <= t && t < end(m));
49
+ const upcoming = rows.filter((m) => ms(m.start) > t);
50
+ const next = upcoming[0] || null;
51
+ const laterThan = (m) => upcoming.filter((x) => x !== m);
52
+ if (cur) return { kind: 'meeting', meeting: cur, minutes: Math.round((end(cur) - t) / 60000), later: upcoming };
53
+ const until = next ? Math.round((ms(next.start) - t) / 60000) : null;
54
+ if (next && until <= BEFORE_MIN) return { kind: 'before', meeting: next, minutes: until, later: laterThan(next) };
55
+ const ended = rows.filter((m) => end(m) <= t && t - end(m) < AFTER_MIN * 60000).pop();
56
+ if (ended) return { kind: 'after', meeting: ended, later: upcoming };
57
+ if (hour >= NIGHT_HOUR || hour < EARLY_HOUR) return { kind: 'night', next: null, later: upcoming };
58
+ if (hour >= WRAP_HOUR) return { kind: 'recap', next: null, later: upcoming };
59
+ if (next && until >= GAP_MIN && rows.some((m) => end(m) <= t)) return { kind: 'gap', next, minutes: until, fits: fitsIn(needs, until), later: upcoming };
60
+ if (hour < 12) return { kind: 'morning', next, later: upcoming };
61
+ return { kind: 'work', next, minutes: until, fits: fitsIn(needs, until === null ? 120 : until), later: upcoming };
62
+ }
63
+
64
+ /** "in 25 min", "in 1 h 5 min" */
65
+ export function inText(minutes) {
66
+ const m = Math.max(0, Math.round(minutes || 0));
67
+ if (m < 60) return 'in ' + m + ' min';
68
+ return 'in ' + Math.floor(m / 60) + ' h' + (m % 60 ? ' ' + (m % 60) + ' min' : '');
69
+ }
@@ -30,7 +30,7 @@ import { el } from './dom.js';
30
30
  import { button } from './primitives.js';
31
31
  import { pmGet, pmPost } from './http.js';
32
32
  import { renderCase } from './c3-case.js';
33
- import { parseMd, toDom } from './c3-md.js';
33
+ import { parseMd, toDom } from './cozy-md.js';
34
34
  import { makeXp, attachExpand } from './c3-expand.js';
35
35
  import { attachSwipe } from './c3-swipe.js';
36
36
  import { toast } from './c3-toast.js';
@@ -129,7 +129,11 @@ export function mountAttach({ getKey, input, note, onSlash, onPad }) {
129
129
  me.add = add;
130
130
  }
131
131
  /** A note already saved (Share with Claude): a chip like a saved file; × takes it off the message and keeps the note. */
132
+ let SINK = null;
133
+ /** A page with its own message box (Home, premium-agreed-design) takes saved files here instead of the dialog's chip row. */
134
+ export function setAttachSink(fn) { SINK = typeof fn === 'function' ? fn : null; }
132
135
  export function attachSaved(f) {
136
+ if (!A && SINK && f && f.saved) { SINK(f); return; }
133
137
  if (!A || !f || !f.saved) return;
134
138
  if (A.files.some((x) => x.saved === f.saved)) return;
135
139
  if (A.files.length >= MAX_FILES) { if (A.say) A.say('A message takes ' + MAX_FILES + ' files at most.'); return; }