@milabench/bujang 0.1.14 → 0.1.15

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/theme.css CHANGED
@@ -70,3 +70,29 @@
70
70
  --color-pipeline-par-bg: #1a202c;
71
71
  --color-pipeline-par-border: #4a5568;
72
72
  }
73
+
74
+ /*
75
+ * Dialogs (Dialog.Content className="bujang-dialog"): Chakra paints them with its own
76
+ * neutral palette (bg.panel, border, fg...). Inside a bujang dialog, those Chakra
77
+ * tokens point at the bujang colours above, so the panel, its inputs, selects,
78
+ * tables and buttons match the cards of the pages. Only bujang dialogs change:
79
+ * a host's own dialogs keep its Chakra theme.
80
+ */
81
+ :where(.bujang-dialog) {
82
+ --chakra-colors-bg: var(--color-bg-card);
83
+ --chakra-colors-bg-panel: var(--color-bg-card);
84
+ --chakra-colors-bg-subtle: var(--color-bg-header);
85
+ --chakra-colors-bg-muted: var(--color-bg-hover);
86
+ --chakra-colors-bg-emphasized: var(--color-bg-hover);
87
+ --chakra-colors-fg: var(--color-text);
88
+ --chakra-colors-fg-muted: var(--color-text-muted);
89
+ --chakra-colors-fg-subtle: var(--color-text-muted);
90
+ --chakra-colors-border: var(--color-input-border);
91
+ --chakra-colors-border-subtle: var(--color-border);
92
+ --chakra-colors-border-muted: var(--color-border);
93
+ --chakra-colors-border-emphasized: var(--color-input-border);
94
+ --chakra-colors-gray-subtle: var(--color-bg-hover);
95
+ --chakra-colors-gray-muted: var(--color-bg-hover);
96
+ color: var(--color-text);
97
+ border: 1px solid var(--color-border);
98
+ }
package/dist/types.d.ts CHANGED
@@ -5,6 +5,8 @@ export interface ApiError {
5
5
  export interface SlurmJob {
6
6
  job_id: string | null;
7
7
  jr_job_id?: string | null;
8
+ /** The cluster whose squeue listed the job (GET /jobs) */
9
+ cluster?: string;
8
10
  /** Submitted by an agent through the MCP server */
9
11
  agent?: AgentTag | null;
10
12
  created_at?: string;
@@ -240,6 +242,11 @@ export interface PersitedJobInfo {
240
242
  important?: boolean;
241
243
  /** The manual groups of the job (groups/<group>/<job id>) */
242
244
  groups?: string[];
245
+ /** A step of a pipeline run: the run, and the saved pipeline it was started from (else the run's name) */
246
+ pipeline?: {
247
+ run_id: string;
248
+ name: string;
249
+ } | null;
243
250
  }
244
251
  /** GET/POST /jobs/<jr>/marks: whether a job is important, its groups, every group, git */
245
252
  export interface JobMarks {
@@ -344,6 +351,8 @@ export interface PipelineRunSummary {
344
351
  state?: PipelineRunState | null;
345
352
  /** when `state` was read (epoch seconds) */
346
353
  checked?: number | null;
354
+ /** Started by an agent through the MCP server */
355
+ agent?: AgentTag | null;
347
356
  }
348
357
  /** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
349
358
  export interface PipelineRunStep extends PipelineJob {
@@ -367,6 +376,8 @@ export interface PipelineRunStatus {
367
376
  log?: string;
368
377
  /** the definition the run was started with (the saved pipeline may have changed since) */
369
378
  definition?: PipelineNode | null;
379
+ /** Started by an agent through the MCP server */
380
+ agent?: AgentTag | null;
370
381
  }
371
382
  export interface PipelineSequential {
372
383
  type: 'sequential';
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { AgentTag } from '../types';
3
- /** Badge for the jobs submitted by an agent, its reason on hover */
3
+ export declare const agentColor: (agent: string) => string;
4
+ /** Robot icon of what an agent submitted or started, colored per agent; its name and reason on hover */
4
5
  export declare const AgentBadge: React.FC<{
5
6
  tag?: AgentTag | null;
6
7
  }>;
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { Card } from '@chakra-ui/react';
3
+ import type { AgentTag, PersitedJobInfo, SlurmJob } from '../types';
4
+ /** One row of the jobs table: a job in squeue, a job folder, or both (same jr job id) */
5
+ export interface JobRow {
6
+ key: string;
7
+ /** in squeue now: its state is live */
8
+ active: boolean;
9
+ /** has a job folder in the local cache (marks, groups, rerun) */
10
+ persisted: boolean;
11
+ jobId: string;
12
+ jrJobId: string | null;
13
+ name: string;
14
+ status: string;
15
+ cluster: string;
16
+ partition: string;
17
+ user: string;
18
+ timeLimit: string;
19
+ /** minutes, for sorting */
20
+ timeLimitMin: number | null;
21
+ agent?: AgentTag | null;
22
+ important: boolean;
23
+ groups: string[];
24
+ pipeline?: {
25
+ run_id: string;
26
+ name: string;
27
+ } | null;
28
+ /** seconds since the job folder last changed */
29
+ freshness: number | null;
30
+ }
31
+ export declare const fromActive: (job: SlurmJob) => JobRow;
32
+ export declare const fromPersisted: (p: PersitedJobInfo) => JobRow;
33
+ /** One row per job: the squeue state wins, the job folder brings its marks, groups and pipeline */
34
+ export declare const mergeRows: (active: SlurmJob[], persisted: PersitedJobInfo[]) => JobRow[];
35
+ interface JobsTableProps {
36
+ title: string;
37
+ rows: JobRow[];
38
+ /** before the organizer filters: "3 of 12 jobs" */
39
+ total: number;
40
+ loading: boolean;
41
+ error?: {
42
+ message?: string;
43
+ } | null;
44
+ empty: string;
45
+ emptyHint: string;
46
+ maxH: string;
47
+ onCancel: (jobId: string) => void;
48
+ onRerun: (jrJobId: string) => void;
49
+ onGroup: (group: string) => void;
50
+ }
51
+ export declare const JobsTable: React.FC<JobsTableProps & {
52
+ cardProps?: React.ComponentProps<typeof Card.Root>;
53
+ }>;
54
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milabench/bujang",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -247,7 +247,7 @@ export const SshConnectDialog: React.FC<SshConnectDialogProps> = ({ open, onClos
247
247
  <Dialog.Root open={open} onOpenChange={(d) => { if (!d.open) close(); }} size="lg">
248
248
  <Dialog.Backdrop />
249
249
  <Dialog.Positioner>
250
- <Dialog.Content>
250
+ <Dialog.Content className="bujang-dialog">
251
251
  <Dialog.Header>
252
252
  <Dialog.Title>{cluster ? `Connect to ${cluster}` : 'Connect to the clusters'}</Dialog.Title>
253
253
  <Dialog.CloseTrigger />
package/src/theme.css CHANGED
@@ -70,3 +70,29 @@
70
70
  --color-pipeline-par-bg: #1a202c;
71
71
  --color-pipeline-par-border: #4a5568;
72
72
  }
73
+
74
+ /*
75
+ * Dialogs (Dialog.Content className="bujang-dialog"): Chakra paints them with its own
76
+ * neutral palette (bg.panel, border, fg...). Inside a bujang dialog, those Chakra
77
+ * tokens point at the bujang colours above, so the panel, its inputs, selects,
78
+ * tables and buttons match the cards of the pages. Only bujang dialogs change:
79
+ * a host's own dialogs keep its Chakra theme.
80
+ */
81
+ :where(.bujang-dialog) {
82
+ --chakra-colors-bg: var(--color-bg-card);
83
+ --chakra-colors-bg-panel: var(--color-bg-card);
84
+ --chakra-colors-bg-subtle: var(--color-bg-header);
85
+ --chakra-colors-bg-muted: var(--color-bg-hover);
86
+ --chakra-colors-bg-emphasized: var(--color-bg-hover);
87
+ --chakra-colors-fg: var(--color-text);
88
+ --chakra-colors-fg-muted: var(--color-text-muted);
89
+ --chakra-colors-fg-subtle: var(--color-text-muted);
90
+ --chakra-colors-border: var(--color-input-border);
91
+ --chakra-colors-border-subtle: var(--color-border);
92
+ --chakra-colors-border-muted: var(--color-border);
93
+ --chakra-colors-border-emphasized: var(--color-input-border);
94
+ --chakra-colors-gray-subtle: var(--color-bg-hover);
95
+ --chakra-colors-gray-muted: var(--color-bg-hover);
96
+ color: var(--color-text);
97
+ border: 1px solid var(--color-border);
98
+ }
package/src/types.ts CHANGED
@@ -10,6 +10,8 @@ export interface ApiError {
10
10
  export interface SlurmJob {
11
11
  job_id: string | null;
12
12
  jr_job_id?: string | null;
13
+ /** The cluster whose squeue listed the job (GET /jobs) */
14
+ cluster?: string;
13
15
  /** Submitted by an agent through the MCP server */
14
16
  agent?: AgentTag | null;
15
17
  created_at?: string;
@@ -260,6 +262,8 @@ export interface PersitedJobInfo {
260
262
  important?: boolean;
261
263
  /** The manual groups of the job (groups/<group>/<job id>) */
262
264
  groups?: string[];
265
+ /** A step of a pipeline run: the run, and the saved pipeline it was started from (else the run's name) */
266
+ pipeline?: { run_id: string; name: string } | null;
263
267
  }
264
268
 
265
269
  /** GET/POST /jobs/<jr>/marks: whether a job is important, its groups, every group, git */
@@ -384,6 +388,8 @@ export interface PipelineRunSummary {
384
388
  state?: PipelineRunState | null;
385
389
  /** when `state` was read (epoch seconds) */
386
390
  checked?: number | null;
391
+ /** Started by an agent through the MCP server */
392
+ agent?: AgentTag | null;
387
393
  }
388
394
 
389
395
  /** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
@@ -410,6 +416,8 @@ export interface PipelineRunStatus {
410
416
  log?: string;
411
417
  /** the definition the run was started with (the saved pipeline may have changed since) */
412
418
  definition?: PipelineNode | null;
419
+ /** Started by an agent through the MCP server */
420
+ agent?: AgentTag | null;
413
421
  }
414
422
 
415
423
  export interface PipelineSequential {
@@ -49,16 +49,25 @@ function jobLink(paths: BujangPaths, jrJobId: string, jobId?: unknown) {
49
49
  return paths.jobDetails(String(jobId || 0), jrJobId);
50
50
  }
51
51
 
52
- /** Badge for the jobs submitted by an agent, its reason on hover */
52
+ // one color per agent name, the same on every page
53
+ const AGENT_COLORS = ['purple', 'blue', 'teal', 'orange', 'pink', 'cyan', 'green', 'red', 'yellow'];
54
+
55
+ export const agentColor = (agent: string): string => {
56
+ let hash = 0;
57
+ for (const c of agent) hash = (hash * 31 + c.charCodeAt(0)) | 0;
58
+ return `${AGENT_COLORS[Math.abs(hash) % AGENT_COLORS.length]}.500`;
59
+ };
60
+
61
+ /** Robot icon of what an agent submitted or started, colored per agent; its name and reason on hover */
53
62
  export const AgentBadge: React.FC<{ tag?: AgentTag | null }> = ({ tag }) => {
54
63
  const paths = useBujangPaths();
55
64
  if (!tag) return null;
56
65
  return (
57
66
  <Tooltip content={tag.reason ? `${tag.agent}: ${tag.reason}` : tag.agent} showArrow>
58
- <RouterLink to={paths.agent(tag.session)}>
59
- <Badge colorPalette="purple" variant="subtle" ml={2}>
60
- <LuBot /> {tag.agent}
61
- </Badge>
67
+ <RouterLink to={paths.agent(tag.session)} aria-label={`Started by ${tag.agent}`} onClick={(e) => e.stopPropagation()}>
68
+ <Box as="span" display="inline-flex" verticalAlign="middle" color={agentColor(tag.agent)}>
69
+ <LuBot />
70
+ </Box>
62
71
  </RouterLink>
63
72
  </Tooltip>
64
73
  );
@@ -858,7 +858,7 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
858
858
  >
859
859
  <Dialog.Backdrop />
860
860
  <Dialog.Positioner>
861
- <Dialog.Content maxW="95vw" maxH="95vh" overflow="hidden" display="flex" flexDirection="column">
861
+ <Dialog.Content className="bujang-dialog" maxW="95vw" maxH="95vh" overflow="hidden" display="flex" flexDirection="column">
862
862
  <Dialog.Header>
863
863
  <Dialog.Title>Edit & Resubmit Job</Dialog.Title>
864
864
  <Dialog.CloseTrigger />
@@ -116,7 +116,7 @@ export const JobGroupsButton: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
116
116
  <Dialog.Root open={open} onOpenChange={(details) => setOpen(details.open)}>
117
117
  <Dialog.Backdrop />
118
118
  <Dialog.Positioner>
119
- <Dialog.Content>
119
+ <Dialog.Content className="bujang-dialog">
120
120
  <Dialog.Header>
121
121
  <Dialog.Title>Groups of this job</Dialog.Title>
122
122
  <Dialog.CloseTrigger />