@milabench/bujang 0.0.0-stage → 0.1.1

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 (52) hide show
  1. package/README.md +108 -2
  2. package/dist/api.d.ts +151 -0
  3. package/dist/components/AutocompleteInput.d.ts +15 -0
  4. package/dist/components/MonacoEditor.d.ts +11 -0
  5. package/dist/components/toaster.d.ts +2 -0
  6. package/dist/components/tooltip.d.ts +11 -0
  7. package/dist/constants.d.ts +3 -0
  8. package/dist/context.d.ts +44 -0
  9. package/dist/hooks/useColorMode.d.ts +4 -0
  10. package/dist/hooks/usePageTitle.d.ts +2 -0
  11. package/dist/index.d.ts +26 -0
  12. package/dist/index.js +5036 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/paths.d.ts +26 -0
  15. package/dist/routes.d.ts +22 -0
  16. package/dist/theme.css +72 -0
  17. package/dist/toast.d.ts +18 -0
  18. package/dist/types.d.ts +474 -0
  19. package/dist/views/AgentActivityView.d.ts +8 -0
  20. package/dist/views/JobDetails.d.ts +2 -0
  21. package/dist/views/JobLogs.d.ts +4 -0
  22. package/dist/views/JobSubmit.d.ts +22 -0
  23. package/dist/views/JobSubmitView.d.ts +2 -0
  24. package/dist/views/JobsView.d.ts +4 -0
  25. package/dist/views/LogDisplay.d.ts +11 -0
  26. package/dist/views/PipelinesView.d.ts +2 -0
  27. package/dist/views/ScheduledJobsView.d.ts +2 -0
  28. package/package.json +70 -4
  29. package/src/api.ts +602 -0
  30. package/src/components/AutocompleteInput.tsx +253 -0
  31. package/src/components/MonacoEditor.tsx +163 -0
  32. package/src/components/toaster.tsx +38 -0
  33. package/src/components/tooltip.tsx +52 -0
  34. package/src/constants.ts +3 -0
  35. package/src/context.tsx +106 -0
  36. package/src/hooks/useColorMode.ts +31 -0
  37. package/src/hooks/usePageTitle.ts +21 -0
  38. package/src/index.ts +33 -0
  39. package/src/paths.ts +71 -0
  40. package/src/routes.tsx +55 -0
  41. package/src/theme.css +72 -0
  42. package/src/toast.ts +35 -0
  43. package/src/types.ts +542 -0
  44. package/src/views/AgentActivityView.tsx +262 -0
  45. package/src/views/JobDetails.tsx +675 -0
  46. package/src/views/JobLogs.tsx +987 -0
  47. package/src/views/JobSubmit.tsx +1272 -0
  48. package/src/views/JobSubmitView.tsx +69 -0
  49. package/src/views/JobsView.tsx +736 -0
  50. package/src/views/LogDisplay.tsx +171 -0
  51. package/src/views/PipelinesView.tsx +1318 -0
  52. package/src/views/ScheduledJobsView.tsx +735 -0
package/src/types.ts ADDED
@@ -0,0 +1,542 @@
1
+ // Types for the bujang /api/slurm/* HTTP API.
2
+
3
+ export interface ApiError {
4
+ message: string;
5
+ status: number;
6
+ }
7
+
8
+
9
+ // Slurm-related types
10
+ export interface SlurmJob {
11
+ job_id: string | null;
12
+ jr_job_id?: string | null;
13
+ /** Submitted by an agent through the MCP server */
14
+ agent?: AgentTag | null;
15
+ created_at?: string;
16
+ partition?: string;
17
+ name?: string;
18
+ job_name?: string;
19
+ user?: string;
20
+ user_name?: string;
21
+ status?: string;
22
+ state?: string;
23
+ job_state?: string[];
24
+ state_reason?: string;
25
+ state_description?: string;
26
+ time?: string;
27
+ time_limit?: {
28
+ number: number,
29
+ set: boolean,
30
+ infinite: boolean
31
+ };
32
+ elapsed?: string;
33
+ nodes?: string;
34
+ nodelist?: string;
35
+ node_list?: string;
36
+ account?: string;
37
+ alloccpus?: string;
38
+ exit_code?: string;
39
+ raw_line?: string;
40
+ start_time?: {
41
+ number: number;
42
+ set: boolean;
43
+ infinite: boolean;
44
+ };
45
+ end_time?: {
46
+ number: number;
47
+ set: boolean;
48
+ infinite: boolean;
49
+ };
50
+ submit_time?: {
51
+ number: number;
52
+ set: boolean;
53
+ infinite: boolean;
54
+ };
55
+ }
56
+
57
+ /** A Slurm numeric field as returned by the Slurm REST API (`scontrol`-style). */
58
+ export interface SlurmNumericField {
59
+ number: number;
60
+ set: boolean;
61
+ infinite: boolean;
62
+ }
63
+
64
+ export interface SlurmJobResourceNode {
65
+ memory_allocated?: number;
66
+ [key: string]: unknown;
67
+ }
68
+
69
+ export interface SlurmJobResources {
70
+ allocated_nodes?: SlurmJobResourceNode[];
71
+ [key: string]: unknown;
72
+ }
73
+
74
+ /**
75
+ * Detailed job info as returned by `getSlurmJobInfo` — a passthrough of the
76
+ * Slurm REST API's `scontrol show job` response, richer than `SlurmJob`.
77
+ */
78
+ export interface SlurmJobDetail {
79
+ job_id?: string;
80
+ name?: string;
81
+ job_state?: string[];
82
+ partition?: string;
83
+ user_name?: string;
84
+ account?: string;
85
+ qos?: string;
86
+ priority?: SlurmNumericField;
87
+ node_count?: SlurmNumericField;
88
+ nodes?: string;
89
+ tasks?: SlurmNumericField;
90
+ cpus?: SlurmNumericField;
91
+ cpus_per_task?: SlurmNumericField;
92
+ tasks_per_node?: SlurmNumericField;
93
+ memory_per_node?: SlurmNumericField;
94
+ tres_alloc_str?: string;
95
+ submit_time?: SlurmNumericField;
96
+ start_time?: SlurmNumericField;
97
+ end_time?: SlurmNumericField;
98
+ eligible_time?: SlurmNumericField;
99
+ accrue_time?: SlurmNumericField;
100
+ time_limit?: SlurmNumericField;
101
+ command?: string;
102
+ current_working_directory?: string;
103
+ standard_output?: string;
104
+ standard_error?: string;
105
+ comment?: string;
106
+ exit_code?: { return_code?: SlurmNumericField; [key: string]: unknown };
107
+ restart_cnt?: number;
108
+ state_reason?: string;
109
+ elapsed?: string;
110
+ time?: string;
111
+ gres_detail?: string[] | string;
112
+ job_resources?: SlurmJobResources;
113
+ [key: string]: unknown;
114
+ }
115
+
116
+ export interface SlurmJobsResponse {
117
+ active_jobs: SlurmJob[];
118
+ completed_jobs: SlurmJob[];
119
+ }
120
+
121
+ export interface SlurmJobSubmitRequest {
122
+ script: string;
123
+ job_name?: string;
124
+ sbatch_args?: string[];
125
+ // Script arguments extracted from export statements
126
+ script_args?: Record<string, string>;
127
+ // Individual parameters for backward compatibility
128
+ partition?: string;
129
+ nodes?: number;
130
+ ntasks?: number;
131
+ cpus_per_task?: number;
132
+ mem?: string;
133
+ time_limit?: string;
134
+ gpus_per_task?: string;
135
+ ntasks_per_node?: number;
136
+ exclusive?: boolean;
137
+ export?: string;
138
+ nodelist?: string;
139
+ dependency?: [string, string][]
140
+ }
141
+
142
+ export interface SlurmJobSubmitResponse {
143
+ success: boolean;
144
+ job_id?: string;
145
+ jr_job_id?: string;
146
+ message?: string;
147
+ error?: string;
148
+ }
149
+
150
+
151
+ export interface SlurmJobLogs {
152
+ job_info: Record<string, string>;
153
+ stdout: string;
154
+ stderr: string;
155
+ }
156
+
157
+ export interface SlurmJobLogResponse {
158
+ data: string;
159
+ size: number;
160
+ }
161
+
162
+ export interface SlurmJobData {
163
+ job_id: string;
164
+ work_dir: string;
165
+ data_files: string[];
166
+ }
167
+
168
+ export interface SlurmClusterStatus {
169
+ status: 'online' | 'offline';
170
+ reason?: string;
171
+ }
172
+
173
+ export interface SlurmJobStatusResponse {
174
+ status: string;
175
+ }
176
+
177
+ export interface SlurmJobAccounting {
178
+ job_id: number;
179
+ account: string;
180
+ state: {
181
+ current: string[];
182
+ reason: string;
183
+ };
184
+ derived_exit_code: {
185
+ status: string[];
186
+ return_code: {
187
+ set: boolean;
188
+ infinite: boolean;
189
+ number: number;
190
+ };
191
+ signal: {
192
+ id: {
193
+ set: boolean;
194
+ infinite: boolean;
195
+ number: number;
196
+ };
197
+ name: string;
198
+ };
199
+ };
200
+ exit_code: {
201
+ status: string[];
202
+ return_code: {
203
+ set: boolean;
204
+ infinite: boolean;
205
+ number: number;
206
+ };
207
+ signal: {
208
+ id: {
209
+ set: boolean;
210
+ infinite: boolean;
211
+ number: number;
212
+ };
213
+ name: string;
214
+ };
215
+ };
216
+ time: {
217
+ elapsed: number;
218
+ eligible: number;
219
+ end: number;
220
+ start: number;
221
+ submission: number;
222
+ suspended: number;
223
+ limit: {
224
+ set: boolean;
225
+ infinite: boolean;
226
+ number: number;
227
+ };
228
+ };
229
+ name: string;
230
+ partition: string;
231
+ nodes: string;
232
+ user: string;
233
+ [key: string]: unknown; // For additional fields that might be present
234
+ }
235
+
236
+ export interface PersitedJobInfo {
237
+ name: string;
238
+ cluster?: string;
239
+ creation_time: string;
240
+ last_modified: string;
241
+ last_accessed: string;
242
+ freshness: number;
243
+ info: SlurmJob;
244
+ acc: SlurmJobAccounting;
245
+ /** Submitted by an agent through the MCP server */
246
+ agent?: AgentTag | null;
247
+ }
248
+
249
+ export interface SlurmPartition {
250
+ partition: string;
251
+ allocated: string;
252
+ nodes: string;
253
+ state: string;
254
+ nodelist: string;
255
+ }
256
+
257
+ export interface SlurmNode {
258
+ hostname: string;
259
+ partition: string;
260
+ state: string;
261
+ cpus: string;
262
+ memory: string;
263
+ gres: string;
264
+ }
265
+
266
+ export interface SlurmClusterInfo {
267
+ partitions: SlurmPartition[];
268
+ nodes: SlurmNode[];
269
+ }
270
+
271
+ export interface SlurmTemplate {
272
+ template: string;
273
+ description: string;
274
+ }
275
+
276
+ export interface SlurmProfile {
277
+ name: string;
278
+ cluster?: string;
279
+ // Node type of the cluster this profile (chunk) requests
280
+ node?: string;
281
+ description: string;
282
+ sbatch_args: string[];
283
+ parsed_args: {
284
+ job_name?: string;
285
+ partition?: string;
286
+ nodes?: number;
287
+ ntasks?: number;
288
+ cpus_per_task?: number;
289
+ mem?: string;
290
+ time_limit?: string;
291
+ gpus_per_task?: string;
292
+ ntasks_per_node?: number;
293
+ exclusive?: boolean;
294
+ export?: string;
295
+ nodelist?: string;
296
+ // sbatch arguments without a form field (--gpus, --tmp, ...)
297
+ extra?: string[];
298
+ };
299
+ // "slurm" (sbatch) or "ssh" (runs over ssh on one of `hosts`, outside of Slurm, e.g. data mover nodes)
300
+ executor?: 'slurm' | 'ssh';
301
+ hosts?: string[];
302
+ }
303
+
304
+ export interface SlurmProfileSaveRequest {
305
+ name: string;
306
+ description?: string;
307
+ sbatch_args: string[];
308
+ }
309
+
310
+ // Pipeline-related types
311
+ export interface PipelineJob {
312
+ type: 'job';
313
+ script: string;
314
+ // "<cluster>/<profile name>", profile names repeat between clusters
315
+ profile: string;
316
+ // environment variables exported before the script runs (same script, other settings)
317
+ env?: Record<string, string>;
318
+ // slurm steps: SOCKS proxy to the login node, unset: the cluster's `proxy` setting
319
+ proxy?: boolean;
320
+ job_id?: string;
321
+ slurm_jobid?: string;
322
+ // set once the pipeline is submitted
323
+ cluster?: string;
324
+ executor?: 'slurm' | 'ssh';
325
+ host?: string;
326
+ }
327
+
328
+ /** Response of a pipeline run: submitted in the background, follow it with its run id */
329
+ export interface PipelineRunResponse {
330
+ success: boolean;
331
+ run_id: string;
332
+ name: string;
333
+ }
334
+
335
+ /** submitting: the jobs are being submitted; failed: the submission failed (nothing runs) */
336
+ export type PipelineSubmissionStatus = 'submitting' | 'submitted' | 'failed';
337
+
338
+ /** A pipeline run in the list of runs */
339
+ export interface PipelineRunSummary {
340
+ run_id: string;
341
+ name: string;
342
+ started: number;
343
+ status: PipelineSubmissionStatus;
344
+ error?: string | null;
345
+ }
346
+
347
+ /** A step of a run with its current state (sacct/squeue state, HELD, or the ssh step state) */
348
+ export interface PipelineRunStep extends PipelineJob {
349
+ step?: string;
350
+ after?: string[];
351
+ held?: boolean;
352
+ state?: string;
353
+ }
354
+
355
+ /** Progress of a run */
356
+ export interface PipelineRunStatus {
357
+ run_id: string;
358
+ name?: string | null;
359
+ status: PipelineSubmissionStatus;
360
+ error?: string | null;
361
+ // once submitted
362
+ state?: 'running' | 'failing' | 'failed' | 'completed' | 'unknown';
363
+ steps?: PipelineRunStep[];
364
+ log?: string;
365
+ }
366
+
367
+ export interface PipelineSequential {
368
+ type: 'sequential';
369
+ name: string;
370
+ jobs: PipelineNode[];
371
+ }
372
+
373
+ export interface PipelineParallel {
374
+ type: 'parallel';
375
+ name: string;
376
+ jobs: PipelineNode[];
377
+ }
378
+
379
+ export interface Pipeline {
380
+ type: 'pipeline';
381
+ name: string;
382
+ // what the pipeline does, what to change
383
+ description?: string;
384
+ definition: PipelineNode;
385
+ job_id?: string;
386
+ }
387
+
388
+ export type PipelineNode = PipelineJob | PipelineSequential | PipelineParallel;
389
+
390
+ export interface PipelineRun {
391
+ id: string;
392
+ name: string;
393
+ status: 'pending' | 'running' | 'completed' | 'failed';
394
+ created_at: string;
395
+ started_at?: string;
396
+ completed_at?: string;
397
+ pipeline: Pipeline;
398
+ jobs: PipelineJobStatus[];
399
+ }
400
+
401
+ export interface PipelineJobStatus {
402
+ job_id: string;
403
+ slurm_jobid?: string;
404
+ name: string;
405
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
406
+ started_at?: string;
407
+ completed_at?: string;
408
+ dependencies?: string[];
409
+ }
410
+
411
+ export interface PipelineTemplate {
412
+ name: string;
413
+ description: string;
414
+ pipeline: Pipeline;
415
+ }
416
+
417
+ /** Payload sent to persist a pipeline as a reusable template file. */
418
+ export interface PipelineTemplatePayload {
419
+ name: string;
420
+ type: 'pipeline';
421
+ definition: PipelineNode;
422
+ job_id: string | null;
423
+ }
424
+
425
+ export interface PipelineCreateRequest {
426
+ name: string;
427
+ pipeline: Pipeline;
428
+ }
429
+
430
+ export interface PipelineRunRequest {
431
+ pipeline_id: string;
432
+ name?: string;
433
+ }
434
+
435
+ export interface PipelineListResponse {
436
+ pipelines: Pipeline[];
437
+ }
438
+
439
+ export interface PipelineRunsResponse {
440
+ runs: PipelineRun[];
441
+ }
442
+
443
+ // Push-related types
444
+ export interface PushFolderResponse {
445
+ status: "OK";
446
+ success: string[];
447
+ failures: Array<[string, string]>;
448
+ }
449
+
450
+ export interface EarlySyncResponse {
451
+ status: "ok" | "notok";
452
+ }
453
+
454
+
455
+ // Scheduled Slurm Jobs
456
+ export interface ScheduledJob {
457
+ _id: number;
458
+ name: string;
459
+ enabled: boolean;
460
+ cron_expression: string;
461
+ cluster: string;
462
+ script: string;
463
+ sbatch_args: string[];
464
+ job_name_prefix: string | null;
465
+ created_time: string | null;
466
+ modified_time: string | null;
467
+ last_run_time: string | null;
468
+ last_job_id: string | null;
469
+ next_run_time: string | null;
470
+ // Which scripts/slurm template this job's script was loaded from, if
471
+ // any, and whether that file has since changed (computed server-side).
472
+ source_template: string | null;
473
+ source_template_hash: string | null;
474
+ outdated?: boolean;
475
+ template_missing?: boolean;
476
+ }
477
+
478
+ export interface ScheduledJobTemplateDiff {
479
+ source_template: string;
480
+ current_script: string;
481
+ latest_script: string;
482
+ outdated: boolean;
483
+ }
484
+
485
+ export interface ScheduledJobRun {
486
+ _id: number;
487
+ scheduled_job_id: number;
488
+ jr_job_id: string | null;
489
+ slurm_job_id: string | null;
490
+ submitted_at: string | null;
491
+ status: string;
492
+ error: string | null;
493
+ }
494
+
495
+
496
+ // ── Agents (MCP server) ─────────────────────────────────────────────
497
+
498
+ export interface AgentTag {
499
+ session: string;
500
+ agent: string;
501
+ tool?: string | null;
502
+ reason?: string | null;
503
+ job_id?: string | null;
504
+ ts?: number;
505
+ }
506
+
507
+ export interface AgentEvent {
508
+ id: string;
509
+ ts: number;
510
+ session: string;
511
+ agent: string;
512
+ kind: 'call' | 'note';
513
+ tool?: string | null;
514
+ reason?: string | null;
515
+ // call
516
+ method?: string;
517
+ path?: string;
518
+ request?: Record<string, unknown> | null;
519
+ status?: number;
520
+ ok?: boolean;
521
+ write?: boolean;
522
+ result?: Record<string, unknown> | null;
523
+ duration_ms?: number;
524
+ // note
525
+ level?: 'plan' | 'progress' | 'finding' | 'question' | 'warning' | 'info';
526
+ message?: string;
527
+ jobs?: string[];
528
+ }
529
+
530
+ export interface AgentSession {
531
+ session: string;
532
+ agent: string;
533
+ started: number;
534
+ last: number;
535
+ calls: number;
536
+ writes: number;
537
+ errors: number;
538
+ notes: number;
539
+ jobs: { jr_job_id: string; job_id: string | null }[];
540
+ pipelines: string[];
541
+ last_note: string | null;
542
+ }