@adecore/agents-react 0.54.1 → 0.54.3

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 (37) hide show
  1. package/README.md +3 -3
  2. package/dist/agents/model-name.js +1 -1
  3. package/dist/agents/option-words.js +1 -1
  4. package/dist/chat/logic/resume-compaction.js +1 -1
  5. package/dist/chat/runtime-modes.js +1 -1
  6. package/dist/chat/ui/RunSettings.js +1 -1
  7. package/dist/chat/ui/markdown-blocks.js +3 -3
  8. package/dist/locales/en/agent-chat.js +1 -1
  9. package/dist/locales/en/agent-providers.js +3 -3
  10. package/dist/locales/nl/agent-chat.js +1 -1
  11. package/dist/locales/nl/agent-providers.js +3 -3
  12. package/dist/locales.js +1 -1
  13. package/dist/prompts/logic/subjects.js +1 -1
  14. package/dist/state/usage.d.ts +2 -1
  15. package/dist/state/usage.js +14 -4
  16. package/dist/testing/prompts.js +1 -1
  17. package/dist/usage/UsageLimitsCard.js +1 -1
  18. package/dist/usage/UsagePane.js +1 -1
  19. package/package.json +9 -9
  20. package/src/agents/model-name.ts +1 -1
  21. package/src/agents/option-words.ts +1 -1
  22. package/src/chat/logic/resume-compaction.ts +1 -1
  23. package/src/chat/runtime-modes.ts +1 -1
  24. package/src/chat/ui/RunSettings.tsx +2 -1
  25. package/src/chat/ui/markdown-blocks.ts +3 -3
  26. package/src/chat/ui/rows/SubagentRow.tsx +1 -1
  27. package/src/host.ts +1 -1
  28. package/src/locales/en/agent-chat.ts +1 -1
  29. package/src/locales/en/agent-providers.ts +3 -3
  30. package/src/locales/nl/agent-chat.ts +1 -1
  31. package/src/locales/nl/agent-providers.ts +3 -3
  32. package/src/locales.ts +1 -1
  33. package/src/prompts/logic/subjects.ts +2 -2
  34. package/src/state/usage.ts +14 -6
  35. package/src/testing/prompts.ts +1 -1
  36. package/src/usage/UsageLimitsCard.tsx +1 -1
  37. package/src/usage/UsagePane.tsx +2 -1
package/README.md CHANGED
@@ -40,7 +40,7 @@ import { Composer, Timeline } from '@adecore/agents-react/chat/ui';
40
40
  </ChatHostProvider>;
41
41
  ```
42
42
 
43
- [Getting started](https://adecore.dev/agents-react/guide/getting-started) covers the words, the host, the scope and its transport.
43
+ [Getting started](https://adecore.dev/agents-react/getting-started) covers the words, the host, the scope and its transport.
44
44
 
45
45
  The root holds the host, the scope and the transport; `/chat`, `/chat/ui`, `/prompts`, `/providers`, `/state`, `/usage`, `/locales` and `/testing` hold the rest. A module that no entry exports is internal.
46
46
 
@@ -48,7 +48,7 @@ The root holds the host, the scope and the transport; `/chat`, `/chat/ui`, `/pro
48
48
 
49
49
  | Page | What it covers |
50
50
  |---|---|
51
- | [Getting started](https://adecore.dev/agents-react/guide/getting-started) | Install, CSS, words, the host and a first chat |
51
+ | [Getting started](https://adecore.dev/agents-react/getting-started) | Install, CSS, words, the host and a first chat |
52
52
  | [Host adapters](https://adecore.dev/agents-react/guide/host) | Everything a `ChatHostProvider` takes |
53
53
  | [Chat client and state](https://adecore.dev/agents-react/guide/chat-client) | The transport, `ChatClient` and the stores |
54
54
  | [Persistence](https://adecore.dev/agents-react/guide/persistence) | Drafts, preferences and their storage keys |
@@ -61,4 +61,4 @@ The root holds the host, the scope and the transport; `/chat`, `/chat/ui`, `/pro
61
61
 
62
62
  FSL-1.1-MIT. See [LICENSE](./LICENSE).
63
63
 
64
- Diagrams in a reply are drawn by [Pele](https://github.com/obsidianmd/pele), a dependency under the MIT license, loaded only when a reply holds one.
64
+ [Pele](https://github.com/obsidianmd/pele), a dependency under the MIT license, draws the diagrams in a reply. It loads only when a reply holds one.
@@ -19,7 +19,7 @@ export function modelNameFromSlug(slug) {
19
19
  }
20
20
  return words.map(word => word === 'gpt' ? 'GPT' : word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
21
21
  }
22
- /* What the CLI calls the model, so every surface says the same thing; a slug it no longer offers is read as one. */
22
+ /* What the CLI calls the model, so every view says the same thing; a slug it no longer offers is read as one. */
23
23
  export function modelName(slug, models) {
24
24
  return models?.find(entry => entry.slug === slug)?.name ?? modelNameFromSlug(slug);
25
25
  }
@@ -15,7 +15,7 @@ export function optionWord(option) {
15
15
  export function choiceWord(optionId, choice) {
16
16
  return catalogWord(`agent-chat:modelOptions.${optionId}.choices.${choice.id}`, choice.label);
17
17
  }
18
- /* The option with the words a person reads, for a surface that draws its labels and choices. */
18
+ /* The option with the words a person reads, for a view that draws its labels and choices. */
19
19
  export function localizedOption(option) {
20
20
  const label = optionWord(option);
21
21
  if (option.type !== 'select') {
@@ -48,7 +48,7 @@ function dueAtOf(info, endedAt) {
48
48
  }
49
49
  /*
50
50
  * When the next message would pay for the whole thread again, or null while nothing could be offered,
51
- * so a surface knows whether to keep a timer.
51
+ * so a view knows whether to keep a timer.
52
52
  */
53
53
  export function resumeCompactionDueAt(input) {
54
54
  const endedAt = offerableTurn(input)?.endedAt ?? null;
@@ -2,7 +2,7 @@ import { RuntimeModeSchema } from '@adecore/agent-contracts';
2
2
  import i18next from 'i18next';
3
3
  /*
4
4
  * The runtime modes in the order they are offered: the schema's, which the host reads as the rank
5
- * from narrowest to widest. Their words are read when a surface draws one, not when this module loads.
5
+ * from narrowest to widest. Their words are read when a view draws one, not when this module loads.
6
6
  */
7
7
  export const RUNTIME_MODES = RuntimeModeSchema.options;
8
8
  export function runtimeModeLabel(mode) {
@@ -1323,7 +1323,7 @@ function ContextUsage(t0) {
1323
1323
  } else {
1324
1324
  t6 = $[17];
1325
1325
  }
1326
- const t7 = disabled || usage.contextTokens === 0;
1326
+ const t7 = disabled || usage.contextTokens === 0 || usage.turns === 0;
1327
1327
  let t8;
1328
1328
  if ($[18] !== t) {
1329
1329
  t8 = t("contextMeter.compactNow");
@@ -82,9 +82,9 @@ function scanMarkdownBlocks(text, checkpoints = false) {
82
82
  const blocks = [];
83
83
  let start = 0;
84
84
  let offset = 0;
85
- // The fence as a reading line by line sees it, blind to lists and indented code. A blank line is
86
- // only cut at where this reading agrees, so every such cut is one this split made before it
87
- // followed fences any further.
85
+ // The fence as a reading line by line sees it, blind to lists and indented code. The split cuts
86
+ // at a blank line only where this reading agrees, so it made every such cut before it followed
87
+ // fences any further.
88
88
  let lineFence = null;
89
89
  let afterBlank = false;
90
90
  // A fence inside a list item.
@@ -473,7 +473,7 @@ export default {
473
473
  backToMain: 'Back to main agent',
474
474
  loading: 'Loading conversation…',
475
475
  working: 'Working…',
476
- unsupported: 'Update Ruimte on this machine to read sub-agents.',
476
+ unsupported: 'Update the app on this machine to read sub-agents.',
477
477
  unreadable: 'Could not read conversation.',
478
478
  noAnswer: 'The machine did not answer',
479
479
  stopFailed: 'Could not stop sub-agent',
@@ -24,7 +24,7 @@ export default {
24
24
  missing: 'Missing',
25
25
  notInstalledNote: 'Install to use it here.',
26
26
  none: 'No agents found on this machine.',
27
- noAccounts: 'Update Ruimte on this machine to add accounts.'
27
+ noAccounts: 'Update the app on this machine to add accounts.'
28
28
  },
29
29
  install: {
30
30
  notInstalled: 'Not installed',
@@ -58,7 +58,7 @@ export default {
58
58
  description: 'Pick {{provider}} for your next chat or terminal.'
59
59
  },
60
60
  footer: {
61
- missing: 'Not found yet. Ruimte checks again when you come back to this window.',
61
+ missing: 'Not found yet. The app checks again when you come back to this window.',
62
62
  found: 'Found on this machine.'
63
63
  },
64
64
  fallback: 'Install {{provider}} to use it here.'
@@ -161,7 +161,7 @@ export default {
161
161
  advanced: 'Advanced',
162
162
  link: {
163
163
  label: 'Link an existing folder',
164
- description: 'Use an existing config folder. Ruimte never moves or deletes it.',
164
+ description: 'Use an existing config folder. The app never moves or deletes it.',
165
165
  placeholder: 'Path on the machine'
166
166
  },
167
167
  create: 'Add account',
@@ -473,7 +473,7 @@ export default {
473
473
  backToMain: 'Terug naar de main agent',
474
474
  loading: 'Gesprek laden…',
475
475
  working: 'Bezig…',
476
- unsupported: 'Werk Ruimte op deze machine bij om sub-agents te lezen.',
476
+ unsupported: 'Werk de app op deze machine bij om sub-agents te lezen.',
477
477
  unreadable: 'Kon het gesprek niet lezen.',
478
478
  noAnswer: 'De machine antwoordde niet',
479
479
  stopFailed: 'Kon de sub-agent niet stoppen',
@@ -24,7 +24,7 @@ export default {
24
24
  missing: 'Ontbreekt',
25
25
  notInstalledNote: 'Installeer om hem hier te gebruiken.',
26
26
  none: 'Geen agents gevonden op deze machine.',
27
- noAccounts: 'Werk Ruimte op deze machine bij om accounts toe te voegen.'
27
+ noAccounts: 'Werk de app op deze machine bij om accounts toe te voegen.'
28
28
  },
29
29
  install: {
30
30
  notInstalled: 'Niet geïnstalleerd',
@@ -58,7 +58,7 @@ export default {
58
58
  description: 'Kies {{provider}} voor je volgende chat of terminal.'
59
59
  },
60
60
  footer: {
61
- missing: 'Nog niet gevonden. Ruimte kijkt opnieuw als je terugkomt in dit venster.',
61
+ missing: 'Nog niet gevonden. De app kijkt opnieuw als je terugkomt in dit venster.',
62
62
  found: 'Gevonden op deze machine.'
63
63
  },
64
64
  fallback: 'Installeer {{provider}} om hem hier te gebruiken.'
@@ -161,7 +161,7 @@ export default {
161
161
  advanced: 'Geavanceerd',
162
162
  link: {
163
163
  label: 'Een bestaande map koppelen',
164
- description: 'Gebruik een bestaande configuratiemap. Ruimte verplaatst of verwijdert hem nooit.',
164
+ description: 'Gebruik een bestaande configuratiemap. De app verplaatst of verwijdert hem nooit.',
165
165
  placeholder: 'Pad op de machine'
166
166
  },
167
167
  create: 'Account toevoegen',
package/dist/locales.js CHANGED
@@ -1,4 +1,4 @@
1
- /* The words of this package, a namespace per surface, which the app adds to its i18next beside its own namespaces. */
1
+ /* The words of this package, a namespace per part of the package, which the app adds to its i18next beside its own namespaces. */
2
2
  export const AGENTS_NAMESPACES = ['agent-chat', 'agent-prompts', 'agent-providers', 'agent-usage'];
3
3
  async function open(files) {
4
4
  return Object.fromEntries(await Promise.all(Object.entries(files).map(async ([namespace, file]) => [namespace, (await file()).default])));
@@ -1,6 +1,6 @@
1
1
  import i18next from 'i18next';
2
2
  import { isBlockingPrompt } from './prompts.js';
3
- /* Unique across the chats of a surface and the app's own prompts, and stable while the prompt waits. */
3
+ /* Unique across the chats of a view and the app's own prompts, and stable while the prompt waits. */
4
4
  export function promptIdOf(subject) {
5
5
  return subject.kind === 'chat' ? `agent-chat:${subject.nodeId}:${subject.item.requestId}` : subject.prompt.id;
6
6
  }
@@ -1,4 +1,4 @@
1
- import type { UsageLimitsSnapshot, UsageSummaryPayload, UsageSummaryResult } from '@adecore/agent-contracts';
1
+ import { type UsageLimitsSnapshot, type UsageRate, type UsageSummaryPayload, type UsageSummaryResult } from '@adecore/agent-contracts';
2
2
  import type { UsageCurrency } from '../usage/format.js';
3
3
  export type UsagePeriod = 'today' | '7d' | '30d' | '90d';
4
4
  export type UsageMetric = 'cost' | 'tokens';
@@ -11,6 +11,7 @@ interface Preferences {
11
11
  period: UsagePeriod;
12
12
  metric: UsageMetric;
13
13
  currency: UsageCurrency;
14
+ rate: UsageRate | null;
14
15
  }
15
16
  export declare function dayOf(date: Date): string;
16
17
  export declare function windowFor(period: UsagePeriod, now?: Date): UsageSummaryPayload;
@@ -1,4 +1,5 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
+ import { UsageRateSchema } from '@adecore/agent-contracts';
2
3
  import { localTimeZone } from '@adecore/ui/format';
3
4
  import { persistedJson } from '../chat/persisted-json.js';
4
5
  import { useChatScope } from '../scope.js';
@@ -25,7 +26,8 @@ onChatStorageConfiguration(() => {
25
26
  const DEFAULTS = {
26
27
  period: '7d',
27
28
  metric: 'cost',
28
- currency: 'USD'
29
+ currency: 'USD',
30
+ rate: null
29
31
  };
30
32
  function parsePreferences(raw) {
31
33
  try {
@@ -33,19 +35,21 @@ function parsePreferences(raw) {
33
35
  return {
34
36
  period: USAGE_PERIODS.some(period => period.id === stored.period) ? stored.period : DEFAULTS.period,
35
37
  metric: stored.metric === 'tokens' || stored.metric === 'cost' ? stored.metric : DEFAULTS.metric,
36
- currency: stored.currency === 'EUR' ? 'EUR' : DEFAULTS.currency
38
+ currency: stored.currency === 'EUR' ? 'EUR' : DEFAULTS.currency,
39
+ rate: UsageRateSchema.safeParse(stored.rate).data ?? DEFAULTS.rate
37
40
  };
38
41
  } catch {
39
42
  return DEFAULTS;
40
43
  }
41
44
  }
42
45
  const storage = persistedJson(storageKey, parsePreferences, DEFAULTS, () => chatStorageLegacyKeys('usage'));
43
- /* The three stored choices out of the store, so a setter writes the other two back unchanged. */
46
+ /* What is stored, out of the store, so a setter writes the rest back unchanged. */
44
47
  function chosen(state) {
45
48
  return {
46
49
  period: state.period,
47
50
  metric: state.metric,
48
- currency: state.currency
51
+ currency: state.currency,
52
+ rate: state.rate
49
53
  };
50
54
  }
51
55
  function pad(value) {
@@ -144,6 +148,11 @@ export const useUsageStore = createChatStore((set, get) => {
144
148
  loading: false,
145
149
  failed: false
146
150
  });
151
+ if (summary.rate !== null && JSON.stringify(summary.rate) !== JSON.stringify(get().rate)) {
152
+ choosePreference({
153
+ rate: summary.rate
154
+ });
155
+ }
147
156
  },
148
157
  fail(scopeId) {
149
158
  patchRow(scopeId, {
@@ -178,6 +187,7 @@ export function useUsage(select) {
178
187
  period: s.period,
179
188
  metric: s.metric,
180
189
  currency: s.currency,
190
+ rate: s.rate,
181
191
  ...(s.byScope[id] ?? EMPTY)
182
192
  });
183
193
  $[0] = id;
@@ -83,7 +83,7 @@ export const PROMPT_SAMPLES = [{
83
83
  toolUseId: null,
84
84
  input: {
85
85
  command: 'bun run check && bun test',
86
- cwd: '/projects/ruimte'
86
+ cwd: '/projects/app'
87
87
  },
88
88
  description: "Run the project's validation checks before continuing.",
89
89
  canAllowAlways: true,
@@ -6,7 +6,7 @@ import { useLimitGroups, useUsageLimits } from './limits.js';
6
6
  import { AccountLimitsList } from './LimitsList.js';
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const MINUTE_MS = 60_000;
9
- /* Asking the CLIs starts a process each, so the question waits until the card is actually opened. */
9
+ /* Asking the CLIs starts a process each, so the question waits until the card opens. */
10
10
  function CardBody(t0) {
11
11
  const $ = _c(7);
12
12
  const {
@@ -169,7 +169,7 @@ function _temp3(id_0) {
169
169
  return useUsageStore.getState().setCurrency(id_0);
170
170
  }
171
171
  function _temp2(s_0) {
172
- return s_0.summary?.rate ?? null;
172
+ return s_0.summary?.rate ?? s_0.rate;
173
173
  }
174
174
  function _temp(s) {
175
175
  return s.currency;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.54.1",
3
+ "version": "0.54.3",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,12 +72,12 @@
72
72
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@adecore/agent-contracts": "0.54.1",
76
- "@adecore/editor": "0.54.1",
77
- "@adecore/editor-react": "0.54.1",
78
- "@adecore/intelligent-ui": "0.54.1",
79
- "@adecore/merge": "0.54.1",
80
- "@adecore/utils": "0.54.1",
75
+ "@adecore/agent-contracts": "0.54.3",
76
+ "@adecore/editor": "0.54.3",
77
+ "@adecore/editor-react": "0.54.3",
78
+ "@adecore/intelligent-ui": "0.54.3",
79
+ "@adecore/merge": "0.54.3",
80
+ "@adecore/utils": "0.54.3",
81
81
  "@codemirror/commands": "^6.11.1",
82
82
  "@codemirror/language": "^6.13.1",
83
83
  "@codemirror/state": "^6.7.6",
@@ -101,14 +101,14 @@
101
101
  "zustand": "^5.0.16"
102
102
  },
103
103
  "peerDependencies": {
104
- "@adecore/ui": "^0.54.1",
104
+ "@adecore/ui": "^0.54.3",
105
105
  "i18next": "^26.4.2",
106
106
  "react": "^19.3.0",
107
107
  "react-dom": "^19.3.0",
108
108
  "react-i18next": "^17.0.15"
109
109
  },
110
110
  "devDependencies": {
111
- "@adecore/ui": "0.54.1",
111
+ "@adecore/ui": "0.54.3",
112
112
  "@types/bun": "^1.4.4",
113
113
  "@types/react": "^19.3.0",
114
114
  "@types/react-dom": "^19.3.0",
@@ -26,7 +26,7 @@ export function modelNameFromSlug(slug: string): string {
26
26
  return words.map((word) => (word === 'gpt' ? 'GPT' : word.charAt(0).toUpperCase() + word.slice(1))).join(' ');
27
27
  }
28
28
 
29
- /* What the CLI calls the model, so every surface says the same thing; a slug it no longer offers is read as one. */
29
+ /* What the CLI calls the model, so every view says the same thing; a slug it no longer offers is read as one. */
30
30
  export function modelName(slug: string, models: readonly ModelInfo[] | undefined): string {
31
31
  return models?.find((entry) => entry.slug === slug)?.name ?? modelNameFromSlug(slug);
32
32
  }
@@ -17,7 +17,7 @@ export function choiceWord(optionId: string, choice: { id: string; label: string
17
17
  return catalogWord(`agent-chat:modelOptions.${optionId}.choices.${choice.id}`, choice.label);
18
18
  }
19
19
 
20
- /* The option with the words a person reads, for a surface that draws its labels and choices. */
20
+ /* The option with the words a person reads, for a view that draws its labels and choices. */
21
21
  export function localizedOption(option: ModelOptionDescriptor): ModelOptionDescriptor {
22
22
  const label = optionWord(option);
23
23
 
@@ -78,7 +78,7 @@ function dueAtOf(info: ChatInfo, endedAt: number): number {
78
78
 
79
79
  /*
80
80
  * When the next message would pay for the whole thread again, or null while nothing could be offered,
81
- * so a surface knows whether to keep a timer.
81
+ * so a view knows whether to keep a timer.
82
82
  */
83
83
  export function resumeCompactionDueAt(input: OfferInput): number | null {
84
84
  const endedAt = offerableTurn(input)?.endedAt ?? null;
@@ -3,7 +3,7 @@ import i18next from 'i18next';
3
3
 
4
4
  /*
5
5
  * The runtime modes in the order they are offered: the schema's, which the host reads as the rank
6
- * from narrowest to widest. Their words are read when a surface draws one, not when this module loads.
6
+ * from narrowest to widest. Their words are read when a view draws one, not when this module loads.
7
7
  */
8
8
  export const RUNTIME_MODES: readonly RuntimeMode[] = RuntimeModeSchema.options;
9
9
 
@@ -638,7 +638,8 @@ function ContextUsage({ usage, disabled, onCompact }: { usage: ChatUsage; disabl
638
638
  <Menu.Item
639
639
  unstyled
640
640
  className="flex shrink-0 cursor-default items-center gap-0.5 rounded font-medium text-accent outline-none data-disabled:opacity-50 data-highlighted:underline"
641
- disabled={disabled || usage.contextTokens === 0}
641
+ // A CLI can report the system prompt before any turn, which leaves nothing of the conversation to compact.
642
+ disabled={disabled || usage.contextTokens === 0 || usage.turns === 0}
642
643
  onClick={onCompact}
643
644
  >
644
645
  {t('contextMeter.compactNow')}
@@ -157,9 +157,9 @@ function scanMarkdownBlocks(text: string, checkpoints = false): MarkdownScan {
157
157
  const blocks: MarkdownBlock[] = [];
158
158
  let start = 0;
159
159
  let offset = 0;
160
- // The fence as a reading line by line sees it, blind to lists and indented code. A blank line is
161
- // only cut at where this reading agrees, so every such cut is one this split made before it
162
- // followed fences any further.
160
+ // The fence as a reading line by line sees it, blind to lists and indented code. The split cuts
161
+ // at a blank line only where this reading agrees, so it made every such cut before it followed
162
+ // fences any further.
163
163
  let lineFence: OpenFence | null = null;
164
164
  let afterBlank = false;
165
165
  // A fence inside a list item.
@@ -154,7 +154,7 @@ export function SubagentRow({
154
154
  work: ChatItem[];
155
155
  expanded: boolean;
156
156
  onToggle(): void;
157
- /* Opens everything it did in the thread's place, for a surface that has somewhere to open it. */
157
+ /* Opens everything it did in the thread's place, for a view that has somewhere to open it. */
158
158
  onOpenConversation?(): void;
159
159
  }) {
160
160
  const { t } = useTranslation('agent-chat');
package/src/host.ts CHANGED
@@ -48,7 +48,7 @@ export interface ChatToast {
48
48
  }
49
49
 
50
50
  /*
51
- * What a person does to a chat from its own surfaces. Without an app's own set, each one is the request
51
+ * What a person does to a chat from its own views. Without an app's own set, each one is the request
52
52
  * a chat host answers; an app that runs every action through one door (confirmations, voice, an
53
53
  * activity log) hands its own. A refusal throws something with a `code`.
54
54
  */
@@ -473,7 +473,7 @@ export default {
473
473
  backToMain: 'Back to main agent',
474
474
  loading: 'Loading conversation…',
475
475
  working: 'Working…',
476
- unsupported: 'Update Ruimte on this machine to read sub-agents.',
476
+ unsupported: 'Update the app on this machine to read sub-agents.',
477
477
  unreadable: 'Could not read conversation.',
478
478
  noAnswer: 'The machine did not answer',
479
479
  stopFailed: 'Could not stop sub-agent',
@@ -24,7 +24,7 @@ export default {
24
24
  missing: 'Missing',
25
25
  notInstalledNote: 'Install to use it here.',
26
26
  none: 'No agents found on this machine.',
27
- noAccounts: 'Update Ruimte on this machine to add accounts.'
27
+ noAccounts: 'Update the app on this machine to add accounts.'
28
28
  },
29
29
  install: {
30
30
  notInstalled: 'Not installed',
@@ -58,7 +58,7 @@ export default {
58
58
  description: 'Pick {{provider}} for your next chat or terminal.'
59
59
  },
60
60
  footer: {
61
- missing: 'Not found yet. Ruimte checks again when you come back to this window.',
61
+ missing: 'Not found yet. The app checks again when you come back to this window.',
62
62
  found: 'Found on this machine.'
63
63
  },
64
64
  fallback: 'Install {{provider}} to use it here.'
@@ -161,7 +161,7 @@ export default {
161
161
  advanced: 'Advanced',
162
162
  link: {
163
163
  label: 'Link an existing folder',
164
- description: 'Use an existing config folder. Ruimte never moves or deletes it.',
164
+ description: 'Use an existing config folder. The app never moves or deletes it.',
165
165
  placeholder: 'Path on the machine'
166
166
  },
167
167
  create: 'Add account',
@@ -473,7 +473,7 @@ export default {
473
473
  backToMain: 'Terug naar de main agent',
474
474
  loading: 'Gesprek laden…',
475
475
  working: 'Bezig…',
476
- unsupported: 'Werk Ruimte op deze machine bij om sub-agents te lezen.',
476
+ unsupported: 'Werk de app op deze machine bij om sub-agents te lezen.',
477
477
  unreadable: 'Kon het gesprek niet lezen.',
478
478
  noAnswer: 'De machine antwoordde niet',
479
479
  stopFailed: 'Kon de sub-agent niet stoppen',
@@ -24,7 +24,7 @@ export default {
24
24
  missing: 'Ontbreekt',
25
25
  notInstalledNote: 'Installeer om hem hier te gebruiken.',
26
26
  none: 'Geen agents gevonden op deze machine.',
27
- noAccounts: 'Werk Ruimte op deze machine bij om accounts toe te voegen.'
27
+ noAccounts: 'Werk de app op deze machine bij om accounts toe te voegen.'
28
28
  },
29
29
  install: {
30
30
  notInstalled: 'Niet geïnstalleerd',
@@ -58,7 +58,7 @@ export default {
58
58
  description: 'Kies {{provider}} voor je volgende chat of terminal.'
59
59
  },
60
60
  footer: {
61
- missing: 'Nog niet gevonden. Ruimte kijkt opnieuw als je terugkomt in dit venster.',
61
+ missing: 'Nog niet gevonden. De app kijkt opnieuw als je terugkomt in dit venster.',
62
62
  found: 'Gevonden op deze machine.'
63
63
  },
64
64
  fallback: 'Installeer {{provider}} om hem hier te gebruiken.'
@@ -161,7 +161,7 @@ export default {
161
161
  advanced: 'Geavanceerd',
162
162
  link: {
163
163
  label: 'Een bestaande map koppelen',
164
- description: 'Gebruik een bestaande configuratiemap. Ruimte verplaatst of verwijdert hem nooit.',
164
+ description: 'Gebruik een bestaande configuratiemap. De app verplaatst of verwijdert hem nooit.',
165
165
  placeholder: 'Pad op de machine'
166
166
  },
167
167
  create: 'Account toevoegen',
package/src/locales.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  type Bundle = Record<string, unknown>;
2
2
 
3
- /* The words of this package, a namespace per surface, which the app adds to its i18next beside its own namespaces. */
3
+ /* The words of this package, a namespace per part of the package, which the app adds to its i18next beside its own namespaces. */
4
4
  export const AGENTS_NAMESPACES = ['agent-chat', 'agent-prompts', 'agent-providers', 'agent-usage'] as const;
5
5
 
6
6
  export type AgentsNamespace = (typeof AGENTS_NAMESPACES)[number];
@@ -10,7 +10,7 @@ import { isBlockingPrompt, type PendingPrompt, type PromptAction, type PromptDra
10
10
  * rest and keeps its draft.
11
11
  */
12
12
  export interface HostPrompt {
13
- /* Unique across the prompts of a surface, and stable while the prompt waits. */
13
+ /* Unique across the prompts of a view, and stable while the prompt waits. */
14
14
  id: string;
15
15
  createdAt: number;
16
16
  blocking: boolean;
@@ -59,7 +59,7 @@ export interface ApprovalButtonSpec {
59
59
  action: PromptAction;
60
60
  }
61
61
 
62
- /* Unique across the chats of a surface and the app's own prompts, and stable while the prompt waits. */
62
+ /* Unique across the chats of a view and the app's own prompts, and stable while the prompt waits. */
63
63
  export function promptIdOf(subject: PromptSubject): string {
64
64
  return subject.kind === 'chat' ? `agent-chat:${subject.nodeId}:${subject.item.requestId}` : subject.prompt.id;
65
65
  }
@@ -1,4 +1,4 @@
1
- import type { UsageLimitsSnapshot, UsageSummaryPayload, UsageSummaryResult } from '@adecore/agent-contracts';
1
+ import { UsageRateSchema, type UsageLimitsSnapshot, type UsageRate, type UsageSummaryPayload, type UsageSummaryResult } from '@adecore/agent-contracts';
2
2
  import { localTimeZone } from '@adecore/ui/format';
3
3
  import { persistedJson } from '../chat/persisted-json';
4
4
  import { useChatScope } from '../scope';
@@ -29,9 +29,12 @@ interface Preferences {
29
29
  metric: UsageMetric;
30
30
  /* Dollars until someone asks for euros; it is the viewer's setting, not the project's. */
31
31
  currency: UsageCurrency;
32
+
33
+ /* The last exchange rate a summary brought, so the settings can name it before the page is opened again. */
34
+ rate: UsageRate | null;
32
35
  }
33
36
 
34
- const DEFAULTS: Preferences = { period: '7d', metric: 'cost', currency: 'USD' };
37
+ const DEFAULTS: Preferences = { period: '7d', metric: 'cost', currency: 'USD', rate: null };
35
38
 
36
39
  function parsePreferences(raw: string | null): Preferences {
37
40
  try {
@@ -40,7 +43,8 @@ function parsePreferences(raw: string | null): Preferences {
40
43
  return {
41
44
  period: USAGE_PERIODS.some((period) => period.id === stored.period) ? stored.period! : DEFAULTS.period,
42
45
  metric: stored.metric === 'tokens' || stored.metric === 'cost' ? stored.metric : DEFAULTS.metric,
43
- currency: stored.currency === 'EUR' ? 'EUR' : DEFAULTS.currency
46
+ currency: stored.currency === 'EUR' ? 'EUR' : DEFAULTS.currency,
47
+ rate: UsageRateSchema.safeParse(stored.rate).data ?? DEFAULTS.rate
44
48
  };
45
49
  } catch {
46
50
  return DEFAULTS;
@@ -49,9 +53,9 @@ function parsePreferences(raw: string | null): Preferences {
49
53
 
50
54
  const storage = persistedJson(storageKey, parsePreferences, DEFAULTS, () => chatStorageLegacyKeys('usage'));
51
55
 
52
- /* The three stored choices out of the store, so a setter writes the other two back unchanged. */
56
+ /* What is stored, out of the store, so a setter writes the rest back unchanged. */
53
57
  function chosen(state: Preferences): Preferences {
54
- return { period: state.period, metric: state.metric, currency: state.currency };
58
+ return { period: state.period, metric: state.metric, currency: state.currency, rate: state.rate };
55
59
  }
56
60
 
57
61
  function pad(value: number): string {
@@ -158,6 +162,10 @@ export const useUsageStore = createChatStore<UsageStore>(
158
162
  },
159
163
  receive(scopeId, asked, summary) {
160
164
  patchRow(scopeId, { asked, summary, loading: false, failed: false });
165
+
166
+ if (summary.rate !== null && JSON.stringify(summary.rate) !== JSON.stringify(get().rate)) {
167
+ choosePreference({ rate: summary.rate });
168
+ }
161
169
  },
162
170
  fail(scopeId) {
163
171
  patchRow(scopeId, { loading: false, failed: true });
@@ -183,5 +191,5 @@ export type UsageView = Preferences & UsageRow;
183
191
  export function useUsage<T>(select: (view: UsageView) => T): T {
184
192
  const { id } = useChatScope();
185
193
 
186
- return useUsageStore((s) => select({ period: s.period, metric: s.metric, currency: s.currency, ...(s.byScope[id] ?? EMPTY) }));
194
+ return useUsageStore((s) => select({ period: s.period, metric: s.metric, currency: s.currency, rate: s.rate, ...(s.byScope[id] ?? EMPTY) }));
187
195
  }
@@ -71,7 +71,7 @@ export const PROMPT_SAMPLES: Array<{ label: string; items: PendingPrompt[] }> =
71
71
  kind: 'approval',
72
72
  toolName: 'Bash',
73
73
  toolUseId: null,
74
- input: { command: 'bun run check && bun test', cwd: '/projects/ruimte' },
74
+ input: { command: 'bun run check && bun test', cwd: '/projects/app' },
75
75
  description: "Run the project's validation checks before continuing.",
76
76
  canAllowAlways: true,
77
77
  allowAlways: { label: 'Allow for this session', description: 'Allow commands in this session until it ends.' },
@@ -6,7 +6,7 @@ import { AccountLimitsList } from './LimitsList';
6
6
 
7
7
  const MINUTE_MS = 60_000;
8
8
 
9
- /* Asking the CLIs starts a process each, so the question waits until the card is actually opened. */
9
+ /* Asking the CLIs starts a process each, so the question waits until the card opens. */
10
10
  function CardBody({ folded, onFoldedChange }: { folded: ReadonlySet<string>; onFoldedChange: (folded: ReadonlySet<string>) => void }) {
11
11
  const limits = useUsageLimits();
12
12
  const groups = useLimitGroups(limits);
@@ -14,7 +14,8 @@ const CURRENCIES: readonly UsageCurrency[] = ['USD', 'EUR'];
14
14
  export function UsagePane({ onOpenPage }: { onOpenPage(): void }) {
15
15
  const { t } = useTranslation('agent-usage');
16
16
  const currency = useUsage((s) => s.currency);
17
- const rate = useUsage((s) => s.summary?.rate ?? null);
17
+ // The summary on screen, or the rate the last one brought: the page may not have been opened since this window started.
18
+ const rate = useUsage((s) => s.summary?.rate ?? s.rate);
18
19
 
19
20
  return (
20
21
  <SettingsSection>