@anchrd/intel-ui 0.18.0 → 0.20.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 (78) hide show
  1. package/package.json +2 -9
  2. package/src/app/app-tree/app-tree.tsx +68 -147
  3. package/src/app/header-search/header-search.tsx +2 -1
  4. package/src/app/reindex-dialog/reindex-dialog.tsx +79 -0
  5. package/src/app/settings-dialog/settings-dialog.tsx +10 -32
  6. package/src/app/user-footer/user-footer.tsx +19 -0
  7. package/src/archive/archive.tsx +2 -1
  8. package/src/data/intel-data-provider/intel-data-provider.ts +42 -191
  9. package/src/data/intel-data-provider/intel-data-provider.types.ts +36 -120
  10. package/src/document-link/document-link.tsx +1 -1
  11. package/src/entry-picker/entry-picker.tsx +7 -7
  12. package/src/flow-runs/flow-runs.tsx +1 -1
  13. package/src/flows/flows.tsx +3 -2
  14. package/src/flows/node-icon/node-icon.ts +1 -1
  15. package/src/flows/node-palette/node-palette.tsx +1 -1
  16. package/src/flows/node-palette/node-palette.types.ts +1 -1
  17. package/src/graph-pane/graph-pane.tsx +1 -1
  18. package/src/i18n/de.json +14 -217
  19. package/src/i18n/en.json +14 -217
  20. package/src/i18n/es.json +14 -217
  21. package/src/import-bundle/import-bundle.tsx +152 -0
  22. package/src/kind-icon.ts +1 -15
  23. package/src/main.tsx +7 -10
  24. package/src/node-editor/node-editor.tsx +1 -1
  25. package/src/node-graph/graph-notice.tsx +1 -1
  26. package/src/node-graph/node-graph.ts +1 -1
  27. package/src/node-graph/node-graph.tsx +1 -1
  28. package/src/node-table/node-table.tsx +3 -3
  29. package/src/nodes/nodes.tsx +1 -35
  30. package/src/resource-menu/resource-menu.tsx +45 -21
  31. package/src/section-hint/section-hint.tsx +2 -2
  32. package/src/title-row/title-row.tsx +5 -22
  33. package/src/tools/tools.tsx +1 -3
  34. package/vite.config.ts +0 -4
  35. package/src/agent/agent-avatar/agent-avatar.tsx +0 -34
  36. package/src/agent/agent-calendar/agent-calendar.tsx +0 -160
  37. package/src/agent/agent-chat/agent-chat.tsx +0 -118
  38. package/src/agent/agent-costs/agent-costs.ts +0 -95
  39. package/src/agent/agent-cron/agent-cron.ts +0 -68
  40. package/src/agent/agent-definition/agent-definition.ts +0 -96
  41. package/src/agent/agent-delegation-notice/agent-delegation-notice.ts +0 -48
  42. package/src/agent/agent-entry-title/agent-entry-title.ts +0 -72
  43. package/src/agent/agent-log/agent-log.tsx +0 -308
  44. package/src/agent/agent-models/agent-models.ts +0 -166
  45. package/src/agent/agent-models/agent-models.types.ts +0 -24
  46. package/src/agent/agent-profile/agent-profile.tsx +0 -1006
  47. package/src/agent/agent-state/agent-state.ts +0 -85
  48. package/src/agent/agent-status-dot/agent-status-dot.ts +0 -73
  49. package/src/agent/agent.tsx +0 -507
  50. package/src/board/board-calendar/board-calendar.tsx +0 -89
  51. package/src/board/board-card/board-card.tsx +0 -106
  52. package/src/board/board-data/board-data.ts +0 -241
  53. package/src/board/board-data/board-data.types.ts +0 -63
  54. package/src/board/board-detail/board-detail.tsx +0 -629
  55. package/src/board/board-gantt/board-gantt.ts +0 -545
  56. package/src/board/board-gantt/board-gantt.tsx +0 -286
  57. package/src/board/board-graph/board-graph.ts +0 -174
  58. package/src/board/board-graph/board-graph.tsx +0 -168
  59. package/src/board/board-items/board-items.ts +0 -183
  60. package/src/board/board-kanban/board-kanban.ts +0 -137
  61. package/src/board/board-kanban/board-kanban.tsx +0 -257
  62. package/src/board/board-status/board-status.ts +0 -59
  63. package/src/board/board-statuses/board-statuses.ts +0 -63
  64. package/src/board/board-statuses/board-statuses.tsx +0 -228
  65. package/src/board/board-table/board-table.ts +0 -33
  66. package/src/board/board-table/board-table.tsx +0 -413
  67. package/src/board/board-views/board-views.tsx +0 -68
  68. package/src/board/board-views/board-views.types.ts +0 -29
  69. package/src/board/board.tsx +0 -251
  70. package/src/components/ui/item-calendar.tsx +0 -181
  71. package/src/components/ui/item-gantt.tsx +0 -463
  72. package/src/components/ui/kanban.tsx +0 -282
  73. package/src/data/agent-runtime/agent-runtime.ts +0 -131
  74. package/src/hooks/use-capabilities.ts +0 -22
  75. package/src/hooks/use-model-catalog.ts +0 -26
  76. package/src/timezone/timezone-combobox/timezone-combobox.tsx +0 -149
  77. package/src/timezone/timezone-context.tsx +0 -65
  78. package/src/timezone/timezone.ts +0 -174
@@ -1,166 +0,0 @@
1
- import { AgentModel, type ModelCatalogEntry } from "@anchrd/intel-contract";
2
- import { z } from "zod";
3
- import type { ModelFacts } from "./agent-models.types.ts";
4
-
5
- /**
6
- * Which models this installation offers.
7
- *
8
- * ⚠️ There is no endpoint to ask. The runtime's registry answers one question — "is this provider
9
- * configured" — and only when a run is already starting; nothing anywhere lists what a deployment
10
- * pays for. Rather than invent an API for one screen, the list is build configuration
11
- * (`VITE_AGENT_MODELS`, a JSON array of `{provider, model}`), with the offering below as the default.
12
- *
13
- * ⚠️ The definition's current model is always offered, even when it is not in the list. A select
14
- * that silently dropped it would turn "look at this agent" into "change this agent" for anyone who
15
- * then saved — and the definition is written by MCP and by other installations too, not only here.
16
- */
17
- const ConfiguredModels = z.array(AgentModel);
18
-
19
- /**
20
- * ⚠️ The brand comes from the model id, never from `provider`. `provider` says who serves the model,
21
- * so every Workers AI entry would read "Cloudflare" — thirteen identical labels in a list whose whole
22
- * job is to tell them apart. The name a reader looks for sits in the id, as its second segment:
23
- * `@cf/openai/gpt-oss-120b` is OpenAI's.
24
- */
25
- const brands: Record<string, string> = {
26
- aisingapore: "AI Singapore",
27
- "deepseek-ai": "DeepSeek",
28
- google: "Google",
29
- "ibm-granite": "IBM",
30
- meta: "Meta",
31
- "meta-llama": "Meta",
32
- mistralai: "Mistral",
33
- moonshotai: "Moonshot",
34
- nvidia: "NVIDIA",
35
- openai: "OpenAI",
36
- qwen: "Qwen",
37
- "zai-org": "Z.ai",
38
- };
39
-
40
- const firstFallback: AgentModel = { provider: "anthropic", model: "claude-sonnet-5" };
41
- const fallback: [AgentModel, ...AgentModel[]] = [
42
- firstFallback,
43
- { provider: "anthropic", model: "claude-opus-5" },
44
- { provider: "anthropic", model: "claude-haiku-4-5" },
45
- { provider: "anthropic", model: "claude-sonnet-4" },
46
- { provider: "workers-ai", model: "@cf/openai/gpt-oss-120b" },
47
- { provider: "workers-ai", model: "@cf/openai/gpt-oss-20b" },
48
- { provider: "workers-ai", model: "@cf/moonshotai/kimi-k2.6" },
49
- { provider: "workers-ai", model: "@cf/moonshotai/kimi-k2.7-code" },
50
- { provider: "workers-ai", model: "@cf/zai-org/glm-5.2" },
51
- { provider: "workers-ai", model: "@cf/zai-org/glm-4.7-flash" },
52
- { provider: "workers-ai", model: "@cf/google/gemma-4-26b-a4b-it" },
53
- { provider: "workers-ai", model: "@cf/nvidia/nemotron-3-120b-a12b" },
54
- { provider: "workers-ai", model: "@cf/meta/llama-4-scout-17b-16e-instruct" },
55
- { provider: "workers-ai", model: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" },
56
- { provider: "workers-ai", model: "@cf/mistralai/mistral-small-3.1-24b-instruct" },
57
- { provider: "workers-ai", model: "@cf/ibm-granite/granite-4.0-h-micro" },
58
- { provider: "workers-ai", model: "@cf/qwen/qwen3-30b-a3b-fp8" },
59
- ];
60
-
61
- export function modelKey(model: AgentModel): string {
62
- return `${model.provider}:${model.model}`;
63
- }
64
-
65
- export function parseModelKey(key: string): AgentModel | null {
66
- const boundary = key.indexOf(":");
67
- if (boundary <= 0) return null;
68
- const parsed = AgentModel.safeParse({
69
- provider: key.slice(0, boundary),
70
- model: key.slice(boundary + 1),
71
- });
72
- return parsed.success ? parsed.data : null;
73
- }
74
-
75
- /**
76
- * How a model is written for a person: brand first, then the model's own name, then the two numbers
77
- * somebody actually chooses on.
78
- *
79
- * ⚠️ The figures come IN, from intel's catalog (#257). There is no table in this package any more,
80
- * and putting one back would restore exactly what the removed one was accused of: it was a copy, it
81
- * aged silently, and a wrong price in the interface is worse than none. What this file still owns is
82
- * how a model is written down — the brand, the fallback name, the two formats — none of which is a
83
- * fact about money.
84
- *
85
- * ⚠️ A missing catalog and an unknown model produce the SAME answer: a name and no figures. The
86
- * select therefore renders while the catalog is still on its way, and it renders at all when the
87
- * catalog could not be fetched — an agent whose model cannot be chosen is an agent nobody can repair
88
- * from this screen.
89
- */
90
- export function modelFacts(model: AgentModel, catalog?: ModelCatalogEntry[]): ModelFacts {
91
- const known = catalog?.find(
92
- (entry) => entry.provider === model.provider && entry.model === model.model,
93
- );
94
- if (known) {
95
- return {
96
- brand: brandOf(model),
97
- name: known.name,
98
- contextTokens: known.contextTokens,
99
- price: known.price,
100
- // Nothing is stale when there is nothing to be stale: a model the catalog carries no price
101
- // for shows no price, and no warning about a price it never showed.
102
- stale: known.source === "builtin" && known.price !== null,
103
- };
104
- }
105
- return {
106
- brand: brandOf(model),
107
- name: unknownName(model),
108
- contextTokens: null,
109
- price: null,
110
- stale: false,
111
- };
112
- }
113
-
114
- function brandOf(model: AgentModel): string {
115
- if (model.provider === "anthropic") return "Claude";
116
- const vendor = model.model.split("/")[1];
117
- if (!vendor) return "Workers AI";
118
- return brands[vendor] ?? vendor;
119
- }
120
-
121
- // The id itself, not a prettified guess. "claude-opus-4-1" would become "Opus 4 1" under any rule
122
- // simple enough to write here, and a wrong name is harder to recognise than a raw one.
123
- function unknownName(model: AgentModel): string {
124
- if (model.provider === "anthropic") return model.model.replace(/^claude-/, "");
125
- const segments = model.model.split("/");
126
- return segments[segments.length - 1] ?? model.model;
127
- }
128
-
129
- export function formatContextTokens(tokens: number): string {
130
- if (tokens >= 1_000_000) return `${Math.round(tokens / 1_000_000)}M`;
131
- if (tokens >= 1_000) return `${Math.round(tokens / 1_000)}k`;
132
- return String(tokens);
133
- }
134
-
135
- // ⚠️ Two decimals at least, three at most, and always per one million tokens. Granite costs $0.017
136
- // per million in: rounded to two decimals it reads $0.02, which is the same price as a model that
137
- // costs seventeen percent more.
138
- export function formatPricePerMillion(dollars: number, locale: string): string {
139
- return dollars.toLocaleString(locale, { minimumFractionDigits: 2, maximumFractionDigits: 3 });
140
- }
141
-
142
- export function configuredModels(): AgentModel[] {
143
- const raw = import.meta.env.VITE_AGENT_MODELS;
144
- if (!raw) return fallback;
145
- try {
146
- const parsed = ConfiguredModels.safeParse(JSON.parse(raw));
147
- // A malformed variable falls back rather than emptying the select: an agent whose model cannot
148
- // be chosen is an agent that cannot be repaired from this screen.
149
- return parsed.success && parsed.data.length > 0 ? parsed.data : fallback;
150
- } catch {
151
- return fallback;
152
- }
153
- }
154
-
155
- // The offered list with the agent's own model folded in, deduplicated, order preserved.
156
- export function selectableModels(current: AgentModel | null): AgentModel[] {
157
- const models = configuredModels();
158
- if (!current || models.some((model) => modelKey(model) === modelKey(current))) return models;
159
- return [current, ...models];
160
- }
161
-
162
- // What a newly created agent gets. The first offered model, because a create dialog that asked for
163
- // a provider before the agent has a name would be a settings screen wearing a form's clothes.
164
- export function defaultModel(): AgentModel {
165
- return configuredModels()[0] ?? firstFallback;
166
- }
@@ -1,24 +0,0 @@
1
- import type { ModelPrice } from "@anchrd/intel-contract";
2
-
3
- /** What a reader needs in order to pick a model: whose it is, what it is called, and what it costs. */
4
- export interface ModelFacts {
5
- brand: string;
6
- name: string;
7
- /**
8
- * ⚠️ Both are null for a model this installation has no figures for, and the display then shows
9
- * nothing rather than a zero. A definition is written by MCP and by other installations too, so an
10
- * unknown model is normal — and an invented "0" would be a false statement about money.
11
- */
12
- contextTokens: number | null;
13
- price: ModelPrice | null;
14
- /**
15
- * Whether the two figures came off a written-out table rather than from Cloudflare (#257).
16
- *
17
- * ⚠️ It exists so the screen can SAY so. A silent fallback onto typed-out prices is the state
18
- * this feature replaced, with more code — and a wrong price in the interface is worse than none.
19
- * `false` for a model with no figures at all: there is nothing there to be stale.
20
- */
21
- stale: boolean;
22
- }
23
-
24
- export type { ModelPrice };