@openagt/dashboard 0.44.0 → 0.45.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.
@@ -1,4 +1,4 @@
1
- import type { Driver, DriverModel } from '@openagt/agent-driver';
1
+ import { type Driver, type DriverModel } from '@openagt/agent-driver';
2
2
  import { type DriverName } from '../driver-names.js';
3
3
  /** What one coding agent offers: its models, or why it could not say; `missing` when its CLI is not on the computer at all. */
4
4
  export type DriverModels = {
@@ -15,12 +15,14 @@ export interface ModelsSource {
15
15
  read(): Promise<ModelsView>;
16
16
  }
17
17
  /**
18
- * Ask each coding agent for its models, once: the first read asks, every later read answers from
19
- * what it said, for the daemon's life. The list changes only with a new CLI version or a new
20
- * login, and each question starts a CLI, so a menu opened again never waits on one. An agent that
21
- * could not say is asked again at the next read, so a CLI installed or logged in since is found.
18
+ * Ask each coding agent for its models, once per account: the first read asks, every later read
19
+ * answers from what it said while the agent's runs take the same account first. The list changes
20
+ * only with a new CLI version, a new login or another account, and each question starts a CLI, so
21
+ * a menu opened again never waits on one. An agent that could not say is asked again at the next
22
+ * read, so a CLI installed or logged in since is found. `whose` names the account an agent's runs
23
+ * take first.
22
24
  */
23
- export declare function cachedModelsSource(drivers: Record<DriverName, Pick<Driver, 'listModels'>>): ModelsSource;
24
- /** The daemon's own source: the coding agents on this machine, asked as the person's own login. */
25
+ export declare function cachedModelsSource(drivers: Record<DriverName, Pick<Driver, 'listModels'>>, whose?: (name: DriverName) => string): ModelsSource;
26
+ /** The daemon's own source: the coding agents on this machine, asked as the person's own login, on the Claude account runs take first. */
25
27
  export declare function defaultModelsSource(): ModelsSource;
26
28
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/dashboard/models.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAW,KAA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ACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,KAAK,GAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAiB,GAAG,YAAY,CAuBxJ;AAED,0IAA0I;AAC1I,wBAAgB,mBAAmB,IAAI,YAAY,CAMlD"}
@@ -1,30 +1,43 @@
1
- import { ClaudeCodeDriver } from '@openagt/agent-driver-claude';
1
+ import { ClaudeCodeDriver, claudeAccountsPath } from '@openagt/agent-driver-claude';
2
2
  import { CodexDriver } from '@openagt/agent-driver-codex';
3
+ import { pickAccount, readAccounts } from '@openagt/agent-driver';
3
4
  import { DRIVERS } from '../driver-names.js';
4
5
  /**
5
- * Ask each coding agent for its models, once: the first read asks, every later read answers from
6
- * what it said, for the daemon's life. The list changes only with a new CLI version or a new
7
- * login, and each question starts a CLI, so a menu opened again never waits on one. An agent that
8
- * could not say is asked again at the next read, so a CLI installed or logged in since is found.
6
+ * Ask each coding agent for its models, once per account: the first read asks, every later read
7
+ * answers from what it said while the agent's runs take the same account first. The list changes
8
+ * only with a new CLI version, a new login or another account, and each question starts a CLI, so
9
+ * a menu opened again never waits on one. An agent that could not say is asked again at the next
10
+ * read, so a CLI installed or logged in since is found. `whose` names the account an agent's runs
11
+ * take first.
9
12
  */
10
- export function cachedModelsSource(drivers) {
13
+ export function cachedModelsSource(drivers, whose = () => '') {
11
14
  const asked = new Map();
12
15
  const ask = (name) => {
13
- let answer = asked.get(name);
14
- if (!answer) {
16
+ const account = whose(name);
17
+ let kept = asked.get(name);
18
+ if (!kept || kept.account !== account) {
15
19
  const listModels = drivers[name].listModels;
16
- answer = listModels ? listModels.call(drivers[name]) : Promise.reject(new Error('this agent cannot list its models'));
17
- asked.set(name, answer);
18
- answer.catch(() => asked.delete(name));
20
+ const answer = listModels ? listModels.call(drivers[name]) : Promise.reject(new Error('this agent cannot list its models'));
21
+ const asking = { account, answer };
22
+ kept = asking;
23
+ asked.set(name, asking);
24
+ answer.catch(() => {
25
+ if (asked.get(name) === asking)
26
+ asked.delete(name);
27
+ });
19
28
  }
20
- return answer.then(models => ({ models }), (err) => ({ models: [], error: err instanceof Error ? err.message : String(err), ...(err.code === 'ENOENT' ? { missing: true } : {}) }));
29
+ return kept.answer.then(models => ({ models }), (err) => ({ models: [], error: err instanceof Error ? err.message : String(err), ...(err.code === 'ENOENT' ? { missing: true } : {}) }));
21
30
  };
22
31
  return {
23
32
  read: async () => Object.fromEntries(await Promise.all(DRIVERS.map(async (name) => [name, await ask(name)]))),
24
33
  };
25
34
  }
26
- /** The daemon's own source: the coding agents on this machine, asked as the person's own login. */
35
+ /** The daemon's own source: the coding agents on this machine, asked as the person's own login, on the Claude account runs take first. */
27
36
  export function defaultModelsSource() {
28
- return cachedModelsSource({ 'claude-code': new ClaudeCodeDriver(), codex: new CodexDriver() });
37
+ const claudeFirst = () => {
38
+ const first = pickAccount(readAccounts(claudeAccountsPath()), Date.now());
39
+ return first ? `${first.name} ${first.accountId ?? ''}` : '';
40
+ };
41
+ return cachedModelsSource({ 'claude-code': new ClaudeCodeDriver({ accounts: {} }), codex: new CodexDriver() }, name => (name === 'claude-code' ? claudeFirst() : ''));
29
42
  }
30
43
  //# sourceMappingURL=models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/dashboard/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD,OAAO,EAAE,OAAO,EAAmB,MAAM,oBAAoB,CAAA;AAa7D;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAuD;IACxF,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsC,CAAA;IAC3D,MAAM,GAAG,GAAG,CAAC,IAAgB,EAAyB,EAAE;QACtD,IAAI,MAAM,GAAG,KAAK,CAAC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CAAC,CAAA;IACD,OAAO,kBAAkB,CAAC,EAAE,aAAa,EAAE,IAAI,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACvK,CAAC"}
@@ -0,0 +1 @@
1
+ import{$ as e,A as t,Ar as n,B as r,C as i,Cn as a,Dr as o,E as s,En as c,Er as l,F as u,Fn as d,G as f,H as p,I as m,J as h,Jt as g,K as _,Kt as v,L as y,M as b,N as x,On as S,P as C,Q as w,Qt as T,R as E,S as D,Sr as O,Tn as k,Tr as A,U as j,V as M,W as N,X as P,Xt as F,Y as I,Yt as L,Z as R,_ as z,_n as B,_r as V,_t as H,a as U,an as W,br as G,c as K,cn as q,d as J,en as Y,et as X,f as Z,g as Q,gr as $,gt as ee,h as te,i as ne,in as re,jn as ie,k as ae,l as oe,ln as se,lt as ce,m as le,n as ue,nn as de,nt as fe,o as pe,on as me,pt as he,q as ge,qt as _e,r as ve,rn as ye,rt as be,s as xe,sn as Se,st as Ce,t as we,tn as Te,tt as Ee,u as De,un as Oe,ut as ke,v as Ae,w as je,wn as Me,xn as Ne,xr as Pe,yr as Fe,z as Ie}from"../module-Dgckd6JQ.js";export{Ce as Badge,G as Button,e as Card,X as CardContent,Ee as CardHeader,fe as CardTitle,be as CardTitleLink,ce as Checkbox,ke as ConfirmDialog,x as ContextMenu,C as ContextMenuTrigger,ee as Dialog,u as DiffStat,g as DropdownMenu,L as DropdownMenuCheckboxItem,F as DropdownMenuContent,T as DropdownMenuItem,Y as DropdownMenuSeparator,Te as DropdownMenuSub,de as DropdownMenuSubContent,ye as DropdownMenuSubTrigger,re as DropdownMenuTrigger,i as FileIcon,je as FilterChips,se as Input,f as Label,Ae as LinkActions,n as MAX_SPEND_OFFSET,d as MachineMark,he as Markdown,we as ModuleHostContext,ae as Page,t as PaneActions,b as PaneTitle,K as Pieces,y as Popover,E as PopoverContent,Ie as PopoverTrigger,Z as QrCode,me as RadioGroup,Se as RadioGroupItem,q as RadioGroupOption,m as RangeSlider,W as ScrollArea,r as Select,M as SelectContent,p as SelectItem,j as SelectTrigger,N as SelectValue,_e as Separator,te as SettingsRow,Q as SettingsSection,z as SettingsSelectRow,v as Skeleton,D as StartAgentButton,s as StatTile,w as Switch,_ as Table,ge as TableBody,h as TableCell,I as TableHead,P as TableHeader,R as TableRow,H as Textarea,$ as Tooltip,V as TooltipContent,Fe as TooltipTrigger,De as Waiting,Pe as buttonVariants,O as cn,ue as defineModule,Ne as forgetRemembered,k as formatAge,c as formatDateTime,S as formatDuration,ie as formatRelative,A as machineKind,l as machineName,ve as moduleHost,U as pathsIn,o as reachedByLine,Oe as useAction,B as useCodingAgents,pe as useFileNames,oe as useHighlighted,a as useLoaded,ne as useModuleHost,J as useNarrow,Me as usePolled,xe as useSchedule,le as useSettingsCrumb};