@justanarthur/modo-ui-ai 0.2.0 → 0.3.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 (74) hide show
  1. package/blocks/conversation/agent-prompt/index.tsx +3 -3
  2. package/blocks/conversation/composer/examples.mdx +50 -0
  3. package/blocks/conversation/composer/index.tsx +182 -48
  4. package/blocks/conversation/transcript/index.tsx +8 -6
  5. package/blocks/dialogs/command-palette/examples.mdx +17 -0
  6. package/blocks/dialogs/command-palette/index.tsx +12 -5
  7. package/blocks/panes/usage-pane/examples.mdx +10 -0
  8. package/blocks/panes/usage-pane/index.tsx +8 -5
  9. package/blocks/profiles/profile-switcher/examples.mdx +11 -0
  10. package/blocks/profiles/profile-switcher/index.tsx +18 -3
  11. package/blocks/profiles/profile-usage/examples.mdx +20 -0
  12. package/blocks/profiles/profile-usage/index.tsx +22 -8
  13. package/blocks/sessions/session-sidebar/examples.mdx +53 -3
  14. package/blocks/sessions/session-sidebar/index.tsx +133 -78
  15. package/components/conversation/agent-run/examples.mdx +8 -0
  16. package/components/conversation/agent-run/index.tsx +4 -3
  17. package/components/conversation/message/index.tsx +8 -6
  18. package/components/conversation/reasoning/examples.mdx +10 -0
  19. package/components/conversation/reasoning/index.tsx +5 -4
  20. package/dist/blocks/conversation/agent-prompt/index.d.ts +1 -1
  21. package/dist/blocks/conversation/agent-prompt/index.js +1 -1
  22. package/dist/blocks/conversation/composer/index.d.ts +1 -1
  23. package/dist/blocks/conversation/composer/index.js +3 -2
  24. package/dist/blocks/conversation/transcript/index.d.ts +11 -11
  25. package/dist/blocks/conversation/transcript/index.js +3 -3
  26. package/dist/blocks/dialogs/command-palette/index.d.ts +1 -1
  27. package/dist/blocks/dialogs/command-palette/index.js +4 -4
  28. package/dist/blocks/panes/side-pane/index.js +3 -3
  29. package/dist/blocks/panes/usage-pane/index.d.ts +1 -1
  30. package/dist/blocks/panes/usage-pane/index.js +2 -2
  31. package/dist/blocks/profiles/profile-switcher/index.d.ts +1 -1
  32. package/dist/blocks/profiles/profile-switcher/index.js +2 -1
  33. package/dist/blocks/profiles/profile-usage/index.d.ts +1 -1
  34. package/dist/blocks/profiles/profile-usage/index.js +2 -2
  35. package/dist/blocks/sessions/session-board/index.js +8 -7
  36. package/dist/blocks/sessions/session-sidebar/index.d.ts +1 -1
  37. package/dist/blocks/sessions/session-sidebar/index.js +4 -4
  38. package/dist/components/conversation/agent-run/index.d.ts +1 -1
  39. package/dist/components/conversation/message/index.d.ts +2 -2
  40. package/dist/components/conversation/message/index.js +5 -5
  41. package/dist/components/conversation/reasoning/index.d.ts +1 -1
  42. package/dist/components/conversation/reasoning/index.js +1 -1
  43. package/dist/index.d.ts +12 -12
  44. package/dist/index.js +17 -17
  45. package/dist/lib/pace-bar.d.ts +1 -1
  46. package/dist/lib/pace.d.ts +2 -2
  47. package/dist/lib/pace.js +3 -1
  48. package/dist/shared/{chunk-rzajcn44.d.ts → chunk-1hzrm8r5.d.ts} +3 -1
  49. package/dist/shared/{chunk-k5zegxje.d.ts → chunk-1qdwg7w5.d.ts} +10 -10
  50. package/dist/shared/{chunk-cd4f87as.d.ts → chunk-3ps5h55t.d.ts} +2 -0
  51. package/dist/shared/{chunk-45rqgey6.d.ts → chunk-3yaftgh0.d.ts} +6 -3
  52. package/dist/shared/{chunk-1f96cz69.js → chunk-58jh3mje.js} +3 -2
  53. package/dist/shared/{chunk-1aq2xzv5.js → chunk-6kwk9vag.js} +4 -4
  54. package/dist/shared/{chunk-4248zvmh.js → chunk-6rdwkymk.js} +1 -1
  55. package/dist/shared/{chunk-gkyk663q.d.ts → chunk-71j8qzvb.d.ts} +8 -4
  56. package/dist/shared/{chunk-6g4970a6.d.ts → chunk-74bvf3tw.d.ts} +3 -2
  57. package/dist/shared/{chunk-w5z8qnf8.js → chunk-7mfer3tp.js} +4 -3
  58. package/dist/shared/{chunk-bzs6amnv.js → chunk-94grzz9f.js} +4 -4
  59. package/dist/shared/{chunk-g28hweee.d.ts → chunk-b4dz15em.d.ts} +4 -3
  60. package/dist/shared/{chunk-8xg5gwwy.js → chunk-b5ccp5de.js} +2 -5
  61. package/dist/shared/{chunk-rjfwje37.d.ts → chunk-dxzrtvt9.d.ts} +58 -9
  62. package/dist/shared/{chunk-fbn0h7cr.js → chunk-fapc805j.js} +11 -4
  63. package/dist/shared/{chunk-sfqvyzcs.d.ts → chunk-fm1qyrae.d.ts} +6 -6
  64. package/dist/shared/{chunk-5k6xwqfj.d.ts → chunk-gb5ee5dw.d.ts} +27 -7
  65. package/dist/shared/{chunk-a4s440b6.js → chunk-mnzw0bav.js} +4 -3
  66. package/dist/shared/{chunk-wgvzavx1.js → chunk-n31qwnj2.js} +88 -32
  67. package/dist/shared/{chunk-kw9npka5.js → chunk-njf851p1.js} +44 -23
  68. package/dist/shared/{chunk-hd4gtj5z.d.ts → chunk-nkbgg7bw.d.ts} +4 -3
  69. package/dist/shared/{chunk-cmwby8f9.js → chunk-nvh33x9x.js} +112 -91
  70. package/dist/shared/{chunk-4n0v64qx.js → chunk-qt31n444.js} +7 -8
  71. package/dist/shared/{chunk-szkvrqg1.d.ts → chunk-ty2ccknv.d.ts} +4 -4
  72. package/dist/shared/{chunk-vd59gzzd.js → chunk-wq9h37gy.js} +3 -3
  73. package/lib/pace.ts +7 -3
  74. package/package.json +3 -3
@@ -13,12 +13,11 @@ import {
13
13
  chapter_nav_default
14
14
  } from "./chunk-bh2b5d1z.js";
15
15
  import {
16
- Working2,
17
16
  message_default
18
- } from "./chunk-bzs6amnv.js";
17
+ } from "./chunk-94grzz9f.js";
19
18
  import {
20
19
  reasoning_default
21
- } from "./chunk-8xg5gwwy.js";
20
+ } from "./chunk-b5ccp5de.js";
22
21
  import {
23
22
  recap_default
24
23
  } from "./chunk-skg3m9m0.js";
@@ -44,13 +43,13 @@ import { jsx, jsxs } from "react/jsx-runtime";
44
43
  * ToolCall, AgentRun, WorkSummary, ChapterNav, TodoList, Recap), aliased as
45
44
  * statics.
46
45
  */
47
- function User(props) {
46
+ function UserTurn(props) {
48
47
  return /* @__PURE__ */ jsx(message_default, {
49
48
  role: "user",
50
49
  ...props
51
50
  });
52
51
  }
53
- function Assistant({ children, streaming, ...props }) {
52
+ function AssistantTurn({ children, streaming, ...props }) {
54
53
  if (typeof children === "string")
55
54
  return /* @__PURE__ */ jsxs("div", {
56
55
  className: "flex flex-col gap-3",
@@ -59,7 +58,7 @@ function Assistant({ children, streaming, ...props }) {
59
58
  streaming,
60
59
  children
61
60
  }),
62
- streaming && /* @__PURE__ */ jsx(Working2, {})
61
+ streaming && /* @__PURE__ */ jsx(message_default.Working, {})
63
62
  ]
64
63
  });
65
64
  return /* @__PURE__ */ jsx(message_default, {
@@ -161,8 +160,8 @@ var Transcript2 = Object.assign(function Transcript({ children, chapters, defaul
161
160
  ]
162
161
  });
163
162
  }, {
164
- User,
165
- Assistant,
163
+ User: UserTurn,
164
+ Assistant: AssistantTurn,
166
165
  Work: work_summary_default,
167
166
  Thinking: reasoning_default,
168
167
  Tools: tool_call_default.Group,
@@ -13,7 +13,7 @@ interface OfferProps2 {
13
13
  onChoose?: (where: "new-session" | "here") => void;
14
14
  }
15
15
  type Element_12xgc = JSX_1kxb["Element"];
16
- declare function Offer({ title, brief, onChoose }: OfferProps2): Element_12xgc;
16
+ declare function OfferPrompt({ title, brief, onChoose }: OfferProps2): Element_12xgc;
17
17
  interface TaskProps2 {
18
18
  /** The proposed task. */
19
19
  title: string;
@@ -24,7 +24,7 @@ interface TaskProps2 {
24
24
  /** Called with the decision. */
25
25
  onDecide?: (decision: "start" | "dismiss") => void;
26
26
  }
27
- declare function Task({ title, brief, where, onDecide }: TaskProps2): Element_12xgc;
27
+ declare function TaskPrompt({ title, brief, where, onDecide }: TaskProps2): Element_12xgc;
28
28
  /**
29
29
  * Everything the agent stops to ask you mid-turn, as one family of lifted
30
30
  * cards under the transcript.
@@ -48,7 +48,7 @@ declare const AgentPrompt2: ((props: AgentPromptProps2) => Element_12xgc) & {
48
48
  Permission: typeof PermissionRequest2;
49
49
  Question: typeof QuestionPrompt2;
50
50
  Plan: typeof PlanApproval2;
51
- Offer: typeof Offer;
52
- Task: typeof Task;
51
+ Offer: typeof OfferPrompt;
52
+ Task: typeof TaskPrompt;
53
53
  };
54
54
  export { AgentPromptProps2, OfferProps2, TaskProps2, AgentPrompt2 };
@@ -23,7 +23,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
23
23
  * block adds the session cards (an offer to split work off, an
24
24
  * own-initiative task) and gathers them all as statics.
25
25
  */
26
- function Offer({ title, brief, onChoose }) {
26
+ function OfferPrompt({ title, brief, onChoose }) {
27
27
  return /* @__PURE__ */ jsx(PromptCard2, {
28
28
  icon: "split",
29
29
  title,
@@ -49,7 +49,7 @@ function Offer({ title, brief, onChoose }) {
49
49
  })
50
50
  });
51
51
  }
52
- function Task({ title, brief, where, onDecide }) {
52
+ function TaskPrompt({ title, brief, where, onDecide }) {
53
53
  return /* @__PURE__ */ jsx(PromptCard2, {
54
54
  icon: "git-fork",
55
55
  title,
@@ -81,6 +81,6 @@ var AgentPrompt2 = Object.assign(function AgentPrompt(props) {
81
81
  return /* @__PURE__ */ jsx(PromptCard2, {
82
82
  ...props
83
83
  });
84
- }, { Permission: PermissionRequest2, Question: QuestionPrompt2, Plan: PlanApproval2, Offer, Task });
84
+ }, { Permission: PermissionRequest2, Question: QuestionPrompt2, Plan: PlanApproval2, Offer: OfferPrompt, Task: TaskPrompt });
85
85
  var agent_prompt_default = AgentPrompt2;
86
86
  export { AgentPrompt2, agent_prompt_default };
package/lib/pace.ts CHANGED
@@ -24,8 +24,8 @@ export interface LimitPace {
24
24
  export interface ProfilePace {
25
25
  profile: Profile
26
26
  limits: LimitPace[]
27
- /** The limit that runs out first, or lands highest at its reset. */
28
- binding: LimitPace
27
+ /** The limit that runs out first, or lands highest at its reset; undefined while the profile has no limits yet (none reported before its first turn). */
28
+ binding?: LimitPace
29
29
  }
30
30
 
31
31
  /** Projected share from which a limit counts as only just lasting. */
@@ -44,9 +44,10 @@ function paceOfLimit(limit: UsageLimit): LimitPace {
44
44
  return { limit, elapsed: elapsedHours / limit.windowHours, projected, runsOutInHours, verdict }
45
45
  }
46
46
 
47
+ /** Each limit's pace and the binding one. A profile with no limits yet gets `limits: []` and no `binding`. */
47
48
  export function paceOf(profile: Profile): ProfilePace {
48
49
  const limits = profile.limits.map(paceOfLimit)
49
- const binding = [...limits].sort((a, b) => b.projected - a.projected)[0] ?? paceOfLimit(profile.limits[0]!)
50
+ const binding = [...limits].sort((a, b) => b.projected - a.projected)[0]
50
51
  return { profile, limits, binding }
51
52
  }
52
53
 
@@ -62,6 +63,9 @@ export function duration(hours: number) {
62
63
  return `${Math.round(hours / 24)}d`
63
64
  }
64
65
 
66
+ /** What a profile with no limits yet shows in place of a share or a verdict. */
67
+ export const NO_USAGE = 'No usage yet'
68
+
65
69
  export function percent(share: number) {
66
70
  return `${Math.round(share * 100)}%`
67
71
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justanarthur/modo-ui-ai",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "description": "An AI agent app kit on modo-ui: messages, tool calls, prompts, a composer, a transcript, side panes, settings and full app screens. Documented with modo.",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -101,8 +101,8 @@
101
101
  }
102
102
  },
103
103
  "devDependencies": {
104
- "@justanarthur/modo": "1.0.0",
105
- "@justanarthur/modo-ui": "2.0.0",
104
+ "@justanarthur/modo": "1.1.0",
105
+ "@justanarthur/modo-ui": "2.2.0",
106
106
  "@types/react": "^18.3.0",
107
107
  "@types/react-dom": "^18.3.0",
108
108
  "bunup": "^0.16.0",