@hanzo/app 0.2.32 → 0.2.33

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/Chat.js CHANGED
@@ -75,7 +75,7 @@ import { first } from './lib/first.js';
75
75
  import { BAD } from "./lib/mix.js";
76
76
  import { brand } from './where.js';
77
77
  import { ThinkingEffort } from './ThinkingEffort.js';
78
- import { useChatPreferences } from './lib/chatPreferences.js';
78
+ import { shared, useChatPreferences } from './lib/chatPreferences.js';
79
79
  // NO REASONING PANEL HERE. Every assistant turn opened a "Thinking" disclosure
80
80
  // listing seven steps — "Planning CSS extraction for chat styles", "Designing
81
81
  // responsive top bar grid layout" — typed into this file as a literal array.
@@ -511,17 +511,10 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
511
511
  const { limits, notice, reload: reread } = useLimits(!anonymous, org(), (id) => nameOf(id, catalog.current));
512
512
  const mind = useMind(target, anonymous ? "free" : limits?.plan);
513
513
  catalog.current = mind.models;
514
+ // Chat's effort is its own (ThinkingEffort, sent as `reasoning_effort`); a
515
+ // pick of one Dev offers too moves Dev's, where it is made, and opening Chat
516
+ // never resets Dev's.
514
517
  const [chatPrefs, setChatPrefs] = useChatPreferences();
515
- useEffect(() => {
516
- const eff = chatPrefs.effort || "high";
517
- if (eff === "low" || eff === "medium" || eff === "high") {
518
- mind.pace(eff);
519
- }
520
- else if (eff === "xhigh" || eff === "max") {
521
- mind.pace("high");
522
- }
523
- // eslint-disable-next-line react-hooks/exhaustive-deps
524
- }, [chatPrefs.effort]);
525
518
  const ai = useAi();
526
519
  // In the app's frame the composer floats on the pane as a pane of its own.
527
520
  const framed = useContext(Framed);
@@ -1460,8 +1453,9 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1460
1453
  at: anonymous ? undefined : carry.plugins,
1461
1454
  // Auto vs Manual approval lives in Settings rather than floating under the composer.
1462
1455
  mode: null,
1463
- // The model, the effort and the mode under the frame (@hanzo/build).
1464
- mind,
1456
+ // The model under the frame (@hanzo/build) only where Settings' model
1457
+ // selector is on; the effort is ThinkingEffort, beside send.
1458
+ model: chatPrefs.showModelSelector ? mind : null,
1465
1459
  limits,
1466
1460
  onUpgrade: (id) => setAsk({ model: nameOf(id, listed) }),
1467
1461
  voice,
@@ -1591,19 +1585,15 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1591
1585
  column: { maxW: MEASURE }, composer: (() => {
1592
1586
  const basePrompt = prompt({
1593
1587
  ...composing,
1594
- mind: chatPrefs.showModelSelector ? mind : null,
1595
1588
  field: mention.field,
1596
1589
  }, mention.state);
1597
1590
  return {
1598
1591
  ...basePrompt,
1599
1592
  send: (_jsxs(XStack, { items: "center", gap: "$1.5", shrink: 0, children: [chatPrefs.showTurboApproval ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: 999, borderWidth: 1, borderColor: "$borderColor", bg: "$background", "aria-label": t("Turbo Approval: {mode}", { mode: chatPrefs.approvalMode }), children: [_jsx(Zap, { size: 12, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: chatPrefs.approvalMode === "manual" ? t("Manual") : t("Turbo") })] })) : null, _jsx(ThinkingEffort, { effort: chatPrefs.effort || 'high', onChange: (eff) => {
1600
1593
  setChatPrefs({ effort: eff });
1601
- if (eff === 'low' || eff === 'medium' || eff === 'high') {
1602
- mind.pace(eff);
1603
- }
1604
- else if (eff === 'xhigh' || eff === 'max') {
1605
- mind.pace('high');
1606
- }
1594
+ const next = shared(eff);
1595
+ if (next)
1596
+ mind.pace(next);
1607
1597
  }, disabled: chat.streaming || talk.open }), basePrompt.send] })),
1608
1598
  };
1609
1599
  })() }), _jsx(AgentMaker, {}), carry.dialog, _jsx(Upgrade, { ask: ask, onClose: () => setAsk(null) })] }));
@@ -6,7 +6,7 @@ import { useMemo, useState } from 'react';
6
6
  import { phrase } from '@hanzo/i18n';
7
7
  import { useI18n } from '@hanzo/i18n/react';
8
8
  import { ArrowUpRight, Check, ExternalLink, Lock, Sparkles } from 'lucide-react';
9
- import { useChatPreferences } from './lib/chatPreferences.js';
9
+ import { shared, useChatPreferences } from './lib/chatPreferences.js';
10
10
  import { EFFORT_STEPS } from './ThinkingEffort.js';
11
11
  import { Box, Button, Input, Separator, Text, XStack, YStack, } from '@hanzo/ui';
12
12
  import { tap } from './lib/tap.js';
@@ -90,9 +90,9 @@ function Model() {
90
90
  const active = (chatPrefs.effort || 'high') === step.id;
91
91
  return (_jsx(Box, { render: _jsx("button", { type: "button" }), ...tap, onClick: () => {
92
92
  setChatPrefs({ effort: step.id });
93
- if (step.id === 'low' || step.id === 'medium' || step.id === 'high') {
94
- choose({ effort: step.id });
95
- }
93
+ const next = shared(step.id);
94
+ if (next)
95
+ choose({ effort: next });
96
96
  }, ...CHOICE, bg: active ? 'var(--edge, var(--white-14))' : 'transparent', borderColor: active ? 'var(--borderColor, var(--white-22))' : 'var(--white-08)', py: 6, px: 12, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$2", fontWeight: active ? '600' : '400', color: active ? '$ink' : '$soft', children: step.label }), active ? _jsx(Check, { size: 12, color: "var(--primary)", "aria-hidden": true }) : null] }) }, step.id));
97
97
  }) })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", "data-slot": "settings-approval-mode", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Tool & action approval') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Choose whether agents run tools and connectors automatically or ask for manual approval before each action.') }), _jsx(XStack, { gap: "$2", pt: "$1", children: [
98
98
  { id: 'auto', label: t('Auto'), desc: t('Runs tools on its own; pauses only for anything risky.') },
package/dist/dev.js CHANGED
@@ -41,6 +41,7 @@ import { CAST } from './agents.js';
41
41
  import { app, place, settings, visit } from './lib/host.js';
42
42
  import { link } from './lib/tags.js';
43
43
  import { payUrl } from './lib/pay.js';
44
+ import { useChatPreferences } from './lib/chatPreferences.js';
44
45
  /** Where the builder links out: every one of them an address of this site. */
45
46
  const LINKS = {
46
47
  github: app('-/sync'),
@@ -80,6 +81,7 @@ export function useDevHost() {
80
81
  const { router, path: pathname } = useRooms();
81
82
  const here = path(route(at(pathname)));
82
83
  const look = useLook();
84
+ const [prefs] = useChatPreferences();
83
85
  // The token's claims change only when the token does: a sign-in, a refresh.
84
86
  const memberships = useMemo(() => orgs(), [accessToken]); // eslint-disable-line react-hooks/exhaustive-deps
85
87
  const scoped = useMemo(() => org(), [accessToken]); // eslint-disable-line react-hooks/exhaustive-deps
@@ -111,6 +113,8 @@ export function useDevHost() {
111
113
  links: LINKS,
112
114
  // The sidebar lists Settings' sections and Customize's tabs (Column.tsx), and Customize › Agents offers the cast.
113
115
  sections: true,
116
+ // The model is named, and its picker offered, only where Settings' model selector is on (as in Chat).
117
+ models: prefs.showModelSelector,
114
118
  cast: CAST,
115
119
  // An address of the app moves the app, another of this site moves in the
116
120
  // router, and another origin is left in this tab. platform.hanzo.ai is
@@ -134,5 +138,5 @@ export function useDevHost() {
134
138
  },
135
139
  signIn: () => enter(),
136
140
  signOut: () => void logout(),
137
- }), [scoped, memberships, look.pref.theme, look.set, name, email, avatar, here, router, logout]);
141
+ }), [scoped, memberships, look.pref.theme, look.set, prefs.showModelSelector, name, email, avatar, here, router, logout]);
138
142
  }
@@ -1,3 +1,4 @@
1
+ import { type Effort } from '@hanzo/build/mind';
1
2
  import { type EffortLevel } from '../ThinkingEffort.js';
2
3
  export type ApprovalMode = 'auto' | 'manual';
3
4
  export interface ChatPreferences {
@@ -9,6 +10,8 @@ export interface ChatPreferences {
9
10
  showTurboApproval?: boolean;
10
11
  effortVersion?: number;
11
12
  }
13
+ /** The effort Dev takes for one chosen here (@hanzo/build `EFFORTS`: Auto, High, XHigh, Max), or null for Low and Medium, which only Chat offers. */
14
+ export declare function shared(effort: EffortLevel): Effort | null;
12
15
  export declare function getChatPreferences(): ChatPreferences;
13
16
  export declare function setChatPreferences(patch: Partial<ChatPreferences>): ChatPreferences;
14
17
  export declare function useChatPreferences(): [ChatPreferences, (patch: Partial<ChatPreferences>) => void];
@@ -5,6 +5,7 @@
5
5
  * - approvalMode: whether tools/actions run automatically ('auto') or ask for confirmation first ('manual') (default: 'auto')
6
6
  */
7
7
  import { useEffect, useState } from 'react';
8
+ import { EFFORTS } from '@hanzo/build/mind';
8
9
  import { DEFAULT_EFFORT, EFFORT_STEPS } from '../ThinkingEffort.js';
9
10
  const STORAGE_KEY = 'hanzo.chat.preferences';
10
11
  const AUTONOMY_KEY = 'hanzo.agent.autonomy';
@@ -19,6 +20,10 @@ const DEFAULT_PREFERENCES = {
19
20
  showTurboApproval: false,
20
21
  effortVersion: EFFORT_SCHEMA_VERSION,
21
22
  };
23
+ /** The effort Dev takes for one chosen here (@hanzo/build `EFFORTS`: Auto, High, XHigh, Max), or null for Low and Medium, which only Chat offers. */
24
+ export function shared(effort) {
25
+ return EFFORTS.some((e) => e.id === effort) ? effort : null;
26
+ }
22
27
  function validEffort(v) {
23
28
  return EFFORT_STEPS.some((s) => s.id === v) ? v : DEFAULT_EFFORT;
24
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.2.32",
3
+ "version": "0.2.33",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -51,7 +51,7 @@
51
51
  "peerDependencies": {
52
52
  "@hanzo/ai": ">=0.6.23",
53
53
  "@hanzo/appearance": ">=0.2.6",
54
- "@hanzo/build": ">=0.2.81",
54
+ "@hanzo/build": ">=0.2.83",
55
55
  "@hanzo/composer": ">=0.2.0",
56
56
  "@hanzo/event": ">=0.3.56",
57
57
  "@hanzo/gui": "^8.3.5",
@@ -71,7 +71,7 @@
71
71
  "devDependencies": {
72
72
  "@hanzo/ai": "0.6.23",
73
73
  "@hanzo/appearance": "0.2.8",
74
- "@hanzo/build": "0.2.81",
74
+ "@hanzo/build": "0.2.83",
75
75
  "@hanzo/composer": "0.2.0",
76
76
  "@hanzo/design": "0.5.34",
77
77
  "@hanzo/event": "0.3.56",