@milabench/bujang 0.1.13 → 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 {
@@ -335,6 +342,8 @@ export interface PipelineRunSummary {
335
342
  name: string;
336
343
  /** the saved pipeline it was started from; runs older than this field have none */
337
344
  template?: string | null;
345
+ /** the clusters its steps ran on */
346
+ clusters?: string[];
338
347
  started: number;
339
348
  status: PipelineSubmissionStatus;
340
349
  error?: string | null;
@@ -342,6 +351,8 @@ export interface PipelineRunSummary {
342
351
  state?: PipelineRunState | null;
343
352
  /** when `state` was read (epoch seconds) */
344
353
  checked?: number | null;
354
+ /** Started by an agent through the MCP server */
355
+ agent?: AgentTag | null;
345
356
  }
346
357
  /** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
347
358
  export interface PipelineRunStep extends PipelineJob {
@@ -365,6 +376,8 @@ export interface PipelineRunStatus {
365
376
  log?: string;
366
377
  /** the definition the run was started with (the saved pipeline may have changed since) */
367
378
  definition?: PipelineNode | null;
379
+ /** Started by an agent through the MCP server */
380
+ agent?: AgentTag | null;
368
381
  }
369
382
  export interface PipelineSequential {
370
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.13",
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/constants.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  export const NO_JOB_ID = "-";
2
2
  export const NO_JOB_STATE = "-";
3
3
  export const NO_JR_JOB_ID = "-";
4
+
5
+ /** `css` of a dense table: less vertical padding in the body cells than Chakra's `sm` (8px) */
6
+ export const COMPACT_ROWS = { '& tbody td': { paddingBlock: '4px' } } as const;
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 */
@@ -375,6 +379,8 @@ export interface PipelineRunSummary {
375
379
  name: string;
376
380
  /** the saved pipeline it was started from; runs older than this field have none */
377
381
  template?: string | null;
382
+ /** the clusters its steps ran on */
383
+ clusters?: string[];
378
384
  started: number;
379
385
  status: PipelineSubmissionStatus;
380
386
  error?: string | null;
@@ -382,6 +388,8 @@ export interface PipelineRunSummary {
382
388
  state?: PipelineRunState | null;
383
389
  /** when `state` was read (epoch seconds) */
384
390
  checked?: number | null;
391
+ /** Started by an agent through the MCP server */
392
+ agent?: AgentTag | null;
385
393
  }
386
394
 
387
395
  /** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
@@ -408,6 +416,8 @@ export interface PipelineRunStatus {
408
416
  log?: string;
409
417
  /** the definition the run was started with (the saved pipeline may have changed since) */
410
418
  definition?: PipelineNode | null;
419
+ /** Started by an agent through the MCP server */
420
+ agent?: AgentTag | null;
411
421
  }
412
422
 
413
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
  );
@@ -255,7 +255,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
255
255
  if (!files.length) {
256
256
  return (
257
257
  <Card.Root bg="var(--color-bg-card)" border="1px solid" borderColor="var(--color-border)">
258
- <Card.Body>
258
+ <Card.Body p={3}>
259
259
  <Text color="var(--color-text-muted)">
260
260
  No JSONL data (*.jsonl, *.ndjson, *.data) in {(data?.folders || ['output']).map((f) => `${f}/`).join(', ')} of this job.
261
261
  A job writes its results in <Code>output/</Code>.
@@ -303,7 +303,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
303
303
  <Text fontSize="sm" fontWeight="semibold" pt={2}>Explore the data</Text>
304
304
  {/* Files and event */}
305
305
  <Card.Root {...cardProps}>
306
- <Card.Body py={3}>
306
+ <Card.Body px={3} py={2}>
307
307
  <Flex gap={6} wrap="wrap" align="start">
308
308
  <VStack align="stretch" gap={1} flex="1" minW="300px">
309
309
  <HStack justify="space-between">
@@ -361,7 +361,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
361
361
 
362
362
  {/* Chart builder + chart */}
363
363
  <Card.Root {...cardProps}>
364
- <Card.Body py={3}>
364
+ <Card.Body px={3} py={2}>
365
365
  <Wrap gap={3} align="end" mb={3}>
366
366
  <VStack align="stretch" gap={0}>
367
367
  <Text fontSize="xs" color="var(--color-text-muted)">mark</Text>
@@ -423,7 +423,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
423
423
  {/* Spec + Altair */}
424
424
  <Flex gap={4} direction={{ base: 'column', xl: 'row' }}>
425
425
  <Card.Root {...cardProps} flex="1" minW={0}>
426
- <Card.Header py={2}>
426
+ <Card.Header px={3} py={2}>
427
427
  <HStack justify="space-between">
428
428
  <Text fontSize="sm" fontWeight="semibold">Vega-Lite spec (data: the dataset "rows")</Text>
429
429
  <HStack gap={1}>
@@ -439,7 +439,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
439
439
  </HStack>
440
440
  {specError && <Text fontSize="xs" color="red.500">{specError}</Text>}
441
441
  </Card.Header>
442
- <Card.Body pt={0}>
442
+ <Card.Body px={3} pt={0} pb={3}>
443
443
  <MonacoEditor
444
444
  value={specText ?? JSON.stringify(builtSpec, null, 2)}
445
445
  onChange={(value) => setSpecText(value)}
@@ -449,7 +449,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
449
449
  </Card.Body>
450
450
  </Card.Root>
451
451
  <Card.Root {...cardProps} flex="1" minW={0}>
452
- <Card.Header py={2}>
452
+ <Card.Header px={3} py={2}>
453
453
  <HStack justify="space-between">
454
454
  <Text fontSize="sm" fontWeight="semibold">Altair</Text>
455
455
  <HStack gap={1}>
@@ -458,7 +458,7 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
458
458
  </HStack>
459
459
  </HStack>
460
460
  </Card.Header>
461
- <Card.Body pt={0}>
461
+ <Card.Body px={3} pt={0} pb={3}>
462
462
  <Box as="pre" fontFamily="mono" fontSize="xs" overflow="auto" maxH="320px" p={2}
463
463
  bg="var(--color-bg)" border="1px solid" borderColor="var(--color-border)" borderRadius="md">
464
464
  {altair}
@@ -469,12 +469,12 @@ export const JobDataOverview: React.FC<{ jrJobId: string }> = ({ jrJobId }) => {
469
469
 
470
470
  {/* Fields */}
471
471
  <Card.Root {...cardProps}>
472
- <Card.Header py={2}>
472
+ <Card.Header px={3} py={2}>
473
473
  <Text fontSize="sm" fontWeight="semibold">
474
474
  Fields of {activeEvent ? <Code>{activeEvent}</Code> : 'the records'} · click to plot on y (number) or x
475
475
  </Text>
476
476
  </Card.Header>
477
- <Card.Body pt={0} maxH="360px" overflowY="auto">
477
+ <Card.Body px={3} pt={0} pb={3} maxH="360px" overflowY="auto">
478
478
  <Table.Root size="sm" variant="line">
479
479
  <Table.Header>
480
480
  <Table.Row>
@@ -579,21 +579,28 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
579
579
  <HStack justify="space-between">
580
580
  <HStack gap={3}>
581
581
  <Heading size="lg" mb={2}>Job Logs</Heading>
582
+ {/* 40px high like the outline buttons of the header: 32px items, 3px padding, 1px border */}
582
583
  <SegmentGroup.Root
583
- size="md"
584
+ size="sm"
584
585
  mb={2}
585
586
  ml={3}
586
- p={1}
587
+ p="3px"
587
588
  gap={1}
588
589
  value={activeTab}
589
590
  onValueChange={(details) => details.value && setActiveTab(details.value)}
591
+ bg="var(--color-bg-page)"
592
+ border="1px solid"
593
+ borderColor="var(--color-border)"
590
594
  >
591
- <SegmentGroup.Indicator />
595
+ <SegmentGroup.Indicator bg="var(--color-primary)" boxShadow="none" />
592
596
  <SegmentGroup.Items
593
- items={[{ value: 'logs', label: 'Logs' }, { value: 'overview', label: 'Overview' }]}
597
+ items={[{ value: 'overview', label: 'Overview' }, { value: 'logs', label: 'Logs' }]}
594
598
  px={5}
595
599
  minW="96px"
596
600
  justifyContent="center"
601
+ color="var(--color-text-muted)"
602
+ _hover={{ color: 'var(--color-text)' }}
603
+ _checked={{ color: 'var(--color-primary-text)', fontWeight: 'semibold' }}
597
604
  />
598
605
  </SegmentGroup.Root>
599
606
  {clusterStatus?.status === 'offline' && (
@@ -692,7 +699,7 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
692
699
 
693
700
  {/* Job Quick Info */}
694
701
  <Card.Root bg="var(--color-bg-card)" padding="10px" border="1px solid" borderColor="var(--color-border)">
695
- <Card.Body>
702
+ <Card.Body p={0}>
696
703
  <Wrap gap={4} rowGap={2} align="center">
697
704
  {jobClusterData?.cluster && (
698
705
  <WrapItem>
@@ -818,7 +825,7 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
818
825
  {/* Loading state for logs */}
819
826
  {activeTab === 'logs' && !jobStatus && statusLoading && (
820
827
  <Card.Root bg="var(--color-bg-card)" border="1px solid" borderColor="var(--color-border)" flex="1">
821
- <Card.Body>
828
+ <Card.Body p={2}>
822
829
  <VStack gap={4} justify="center" h="100%">
823
830
  <Spinner size="xl" />
824
831
  <Text>Loading job status...</Text>
@@ -851,7 +858,7 @@ export const JobLogsView: React.FC<JobLogsViewProps> = () => {
851
858
  >
852
859
  <Dialog.Backdrop />
853
860
  <Dialog.Positioner>
854
- <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">
855
862
  <Dialog.Header>
856
863
  <Dialog.Title>Edit & Resubmit Job</Dialog.Title>
857
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 />