nebula-notebook-mcp 0.2.0 → 0.3.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 (60) hide show
  1. package/bin/nebula +5 -0
  2. package/bin/nebula.js +4 -0
  3. package/dist/cli/compute.d.ts +11 -0
  4. package/dist/cli/compute.d.ts.map +1 -0
  5. package/dist/cli/compute.js +405 -0
  6. package/dist/cli/compute.js.map +1 -0
  7. package/dist/cli/index.d.ts +12 -0
  8. package/dist/cli/index.d.ts.map +1 -0
  9. package/dist/cli/index.js +87 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/cli/kernel.d.ts +8 -0
  12. package/dist/cli/kernel.d.ts.map +1 -0
  13. package/dist/cli/kernel.js +102 -0
  14. package/dist/cli/kernel.js.map +1 -0
  15. package/dist/cli/nb.d.ts +8 -0
  16. package/dist/cli/nb.d.ts.map +1 -0
  17. package/dist/cli/nb.js +331 -0
  18. package/dist/cli/nb.js.map +1 -0
  19. package/dist/cli/run.d.ts +7 -0
  20. package/dist/cli/run.d.ts.map +1 -0
  21. package/dist/cli/run.js +120 -0
  22. package/dist/cli/run.js.map +1 -0
  23. package/dist/cli/session.d.ts +10 -0
  24. package/dist/cli/session.d.ts.map +1 -0
  25. package/dist/cli/session.js +111 -0
  26. package/dist/cli/session.js.map +1 -0
  27. package/dist/cli/shared.d.ts +67 -0
  28. package/dist/cli/shared.d.ts.map +1 -0
  29. package/dist/cli/shared.js +213 -0
  30. package/dist/cli/shared.js.map +1 -0
  31. package/dist/cli/skill.d.ts +12 -0
  32. package/dist/cli/skill.d.ts.map +1 -0
  33. package/dist/cli/skill.js +176 -0
  34. package/dist/cli/skill.js.map +1 -0
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +4 -2
  38. package/dist/index.js.map +1 -1
  39. package/dist/notebook/client.d.ts +126 -2
  40. package/dist/notebook/client.d.ts.map +1 -1
  41. package/dist/notebook/client.js +62 -3
  42. package/dist/notebook/client.js.map +1 -1
  43. package/dist/tools/compute.d.ts +62 -0
  44. package/dist/tools/compute.d.ts.map +1 -0
  45. package/dist/tools/compute.js +307 -0
  46. package/dist/tools/compute.js.map +1 -0
  47. package/dist/tools/files.js +1 -1
  48. package/dist/tools/files.js.map +1 -1
  49. package/dist/tools/index.d.ts +8 -0
  50. package/dist/tools/index.d.ts.map +1 -1
  51. package/dist/tools/index.js +6 -0
  52. package/dist/tools/index.js.map +1 -1
  53. package/dist/tools/notebook.js +2 -2
  54. package/dist/tools/notebook.js.map +1 -1
  55. package/dist/types.d.ts +4 -0
  56. package/dist/types.d.ts.map +1 -1
  57. package/dist/utils/imageResize.d.ts.map +1 -1
  58. package/dist/utils/imageResize.js +18 -1
  59. package/dist/utils/imageResize.js.map +1 -1
  60. package/package.json +3 -2
@@ -0,0 +1,111 @@
1
+ /**
2
+ * `nebula session …` — agent-lock sessions.
3
+ *
4
+ * `session start` acquires the agent lock via the shared client and persists
5
+ * the agent token to $NEBULA_STATE_DIR (or ~/.nebula), keyed by hash of
6
+ * url+path, so separate CLI invocations share the same lock. Other commands
7
+ * attach the token automatically (see makeClient in shared.ts).
8
+ */
9
+ import { NebulaClient } from '../notebook/client.js';
10
+ import { CliError, EXIT, clearSessionState, loadSessionState, newAgentId, parse, printHint, printJson, requirePositional, resolveUrl, saveSessionState, } from './shared.js';
11
+ const SESSION_HELP = `usage: nebula session start <path> [--name NAME]
12
+ nebula session end <path>
13
+
14
+ Holds/releases the agent lock for a notebook. The session token is stored in
15
+ $NEBULA_STATE_DIR (default ~/.nebula), so every later nebula invocation for
16
+ the same server+notebook automatically carries the lock until 'session end'.
17
+
18
+ examples:
19
+ nebula session start analysis.ipynb --name refactor-bot
20
+ nebula nb edit analysis.ipynb cell-3 --content 'x = 1' # uses the lock
21
+ nebula session end analysis.ipynb`;
22
+ export async function cmdSession(argv) {
23
+ const [sub, ...rest] = argv;
24
+ switch (sub) {
25
+ case 'start':
26
+ return sessionStart(rest);
27
+ case 'end':
28
+ return sessionEnd(rest);
29
+ case undefined:
30
+ case '--help':
31
+ case '-h':
32
+ console.log(SESSION_HELP);
33
+ return sub === undefined ? EXIT.USAGE : EXIT.OK;
34
+ default:
35
+ throw new CliError(`unknown session subcommand: ${sub}`, EXIT.USAGE, "run 'nebula session --help' for usage");
36
+ }
37
+ }
38
+ async function sessionStart(argv) {
39
+ const { values, positionals } = parse(argv, { name: { type: 'string' } });
40
+ if (values.help) {
41
+ console.log(SESSION_HELP);
42
+ return EXIT.OK;
43
+ }
44
+ const nbPath = requirePositional(positionals, 0, 'path', 'nebula session start <path> [--name NAME]');
45
+ const url = resolveUrl(values.url);
46
+ const name = values.name;
47
+ // Reuse an existing token for this url+path so a re-start keeps the identity.
48
+ const existing = loadSessionState(url, nbPath);
49
+ const agentId = existing?.agentId ?? newAgentId();
50
+ const client = new NebulaClient({
51
+ baseUrl: url,
52
+ agentId,
53
+ clientName: name ?? 'nebula-cli',
54
+ autoStartAgentSession: false,
55
+ });
56
+ const result = await client.startAgentSession(nbPath, agentId);
57
+ if (!result.success) {
58
+ throw new CliError(result.error ?? 'failed to start session', EXIT.ERROR);
59
+ }
60
+ const stateFile = saveSessionState({
61
+ url,
62
+ path: nbPath,
63
+ agentId,
64
+ name,
65
+ startedAt: Date.now(),
66
+ });
67
+ if (values.json) {
68
+ printJson({ path: nbPath, agentId, stateFile, warning: result.data?.warning });
69
+ return EXIT.OK;
70
+ }
71
+ console.log(`session started for ${nbPath} (agent ${agentId})`);
72
+ if (result.data?.warning) {
73
+ console.log(`warning: ${result.data.warning}`);
74
+ }
75
+ printHint(`later invocations reuse this lock; release it with: nebula session end ${nbPath}`, values);
76
+ return EXIT.OK;
77
+ }
78
+ async function sessionEnd(argv) {
79
+ const { values, positionals } = parse(argv);
80
+ if (values.help) {
81
+ console.log(SESSION_HELP);
82
+ return EXIT.OK;
83
+ }
84
+ const nbPath = requirePositional(positionals, 0, 'path', 'nebula session end <path>');
85
+ const url = resolveUrl(values.url);
86
+ const existing = loadSessionState(url, nbPath);
87
+ if (!existing) {
88
+ throw new CliError(`no CLI session for ${nbPath}`, EXIT.ERROR, `start one with: nebula session start ${nbPath}`);
89
+ }
90
+ const client = new NebulaClient({
91
+ baseUrl: url,
92
+ agentId: existing.agentId,
93
+ clientName: existing.name ?? 'nebula-cli',
94
+ autoStartAgentSession: false,
95
+ });
96
+ const result = await client.endAgentSession(nbPath);
97
+ if (!result.success) {
98
+ // Keep the state file so the user can retry ending the session.
99
+ throw new CliError(result.error ?? 'failed to end session', EXIT.ERROR);
100
+ }
101
+ clearSessionState(url, nbPath);
102
+ if (values.json) {
103
+ printJson({ path: nbPath, ended: true, sessionDuration: result.data?.sessionDuration });
104
+ return EXIT.OK;
105
+ }
106
+ const duration = result.data?.sessionDuration;
107
+ console.log(duration !== undefined ? `session ended (${Math.round(duration / 1000)}s)` : 'session ended');
108
+ printHint(`reads still work without a session; start a new one with: nebula session start ${nbPath}`, values);
109
+ return EXIT.OK;
110
+ }
111
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/cli/session.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,KAAK,EACL,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,MAAM,YAAY,GAAG;;;;;;;;;;oCAUe,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAc;IAC7C,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5B,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,YAAY,CAAC,IAAI,CAA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AAS,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IAC1G,SAAS,CAAC,kFAAkF,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;IAC9G,OAAO,IAAI,CAAC,EAAE,CAAC;AACjB,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Shared CLI plumbing: exit codes, flag parsing, server URL resolution,
3
+ * session-state persistence, and output helpers.
4
+ *
5
+ * The CLI is a thin layer over the shared NebulaClient / tools code (the same
6
+ * code the MCP server uses) — nothing in here talks HTTP directly.
7
+ */
8
+ import { NebulaClient } from '../notebook/client.js';
9
+ export declare const EXIT: {
10
+ readonly OK: 0;
11
+ /** Generic failure */
12
+ readonly ERROR: 1;
13
+ /** Usage / configuration error (bad flags, missing NEBULA_URL, …) */
14
+ readonly USAGE: 2;
15
+ /** Kernel dead or not found */
16
+ readonly KERNEL: 7;
17
+ /** Optimistic-concurrency conflict (cell changed since last read) */
18
+ readonly CONFLICT: 9;
19
+ /** Execution still running when --max-wait expired (not an error) */
20
+ readonly RUNNING: 3;
21
+ };
22
+ export declare class CliError extends Error {
23
+ readonly code: number;
24
+ readonly hintText?: string | undefined;
25
+ constructor(message: string, code?: number, hintText?: string | undefined);
26
+ }
27
+ export interface ParsedArgs {
28
+ values: Record<string, string | boolean | undefined>;
29
+ positionals: string[];
30
+ }
31
+ type FlagSpec = Record<string, {
32
+ type: 'string' | 'boolean';
33
+ short?: string;
34
+ }>;
35
+ export declare function parse(argv: string[], flags?: FlagSpec): ParsedArgs;
36
+ export declare function requirePositional(positionals: string[], index: number, name: string, usage: string): string;
37
+ export declare function resolveUrl(flagUrl: unknown): string;
38
+ export interface CliSessionState {
39
+ url: string;
40
+ path: string;
41
+ agentId: string;
42
+ name?: string;
43
+ startedAt: number;
44
+ }
45
+ /** State file is keyed by hash(url + notebook path) so invocations share the lock. */
46
+ export declare function sessionFilePath(url: string, notebookPath: string): string;
47
+ export declare function loadSessionState(url: string, notebookPath: string): CliSessionState | null;
48
+ export declare function saveSessionState(state: CliSessionState): string;
49
+ export declare function clearSessionState(url: string, notebookPath: string): void;
50
+ export declare function newAgentId(): string;
51
+ /**
52
+ * Build a NebulaClient for a command. If a CLI session exists for this
53
+ * url+notebook, its agent token is attached automatically so the invocation
54
+ * shares the agent lock started by `nebula session start`.
55
+ */
56
+ export declare function makeClient(url: string, notebookPath?: string): NebulaClient;
57
+ export declare function resolveContentInput(content: unknown, contentFile: unknown, stdinMarker: boolean): Promise<string>;
58
+ export declare function printJson(data: unknown): void;
59
+ /** At most one contextual next-step hint per command (AXI); suppressed by --quiet/--json. */
60
+ export declare function printHint(text: string, values: ParsedArgs['values']): void;
61
+ export declare function firstLineOf(content: string, max?: number): string;
62
+ export declare function tailLines(text: string, n: number): string[];
63
+ export declare function parseIntFlag(value: unknown, name: string, fallback: number): number;
64
+ /** Map an operation error message to a CliError with the right exit code/hint. */
65
+ export declare function toCliError(message: string | undefined, notebookPath?: string): CliError;
66
+ export {};
67
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/cli/shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAMrD,eAAO,MAAM,IAAI;;IAEf,sBAAsB;;IAEtB,qEAAqE;;IAErE,+BAA+B;;IAE/B,qEAAqE;;IAErE,qEAAqE;;CAE7D,CAAC;AAEX,qBAAa,QAAS,SAAQ,KAAK;IAG/B,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM;gBAF1B,OAAO,EAAE,MAAM,EACN,IAAI,GAAE,MAAmB,EACzB,QAAQ,CAAC,EAAE,MAAM,YAAA;CAK7B;AAMD,MAAM,WAAW,UAAU;IACzB,MAA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AM,GAAG,YAAY,CAS3E;AAcD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,OAAO,EACpB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,MAAM,CAAC,CAsBjB;AAMD,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED,6FAA6F;AAC7F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,IAAI,CAI1E;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,MAAM,CAS7D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAG3D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOnF;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,CASvF"}
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Shared CLI plumbing: exit codes, flag parsing, server URL resolution,
3
+ * session-state persistence, and output helpers.
4
+ *
5
+ * The CLI is a thin layer over the shared NebulaClient / tools code (the same
6
+ * code the MCP server uses) — nothing in here talks HTTP directly.
7
+ */
8
+ import { parseArgs } from 'node:util';
9
+ import * as fs from 'node:fs';
10
+ import * as os from 'node:os';
11
+ import * as path from 'node:path';
12
+ import { createHash, randomBytes } from 'node:crypto';
13
+ import { NebulaClient } from '../notebook/client.js';
14
+ // =============================================================================
15
+ // Exit codes
16
+ // =============================================================================
17
+ export const EXIT = {
18
+ OK: 0,
19
+ /** Generic failure */
20
+ ERROR: 1,
21
+ /** Usage / configuration error (bad flags, missing NEBULA_URL, …) */
22
+ USAGE: 2,
23
+ /** Kernel dead or not found */
24
+ KERNEL: 7,
25
+ /** Optimistic-concurrency conflict (cell changed since last read) */
26
+ CONFLICT: 9,
27
+ /** Execution still running when --max-wait expired (not an error) */
28
+ RUNNING: 3,
29
+ };
30
+ export class CliError extends Error {
31
+ code;
32
+ hintText;
33
+ constructor(message, code = EXIT.ERROR, hintText) {
34
+ super(message);
35
+ this.code = code;
36
+ this.hintText = hintText;
37
+ this.name = 'CliError';
38
+ }
39
+ }
40
+ /** Flags accepted by every command. */
41
+ const COMMON_FLAGS = {
42
+ url: { type: 'string' },
43
+ json: { type: 'boolean' },
44
+ quiet: { type: 'boolean' },
45
+ help: { type: 'boolean', short: 'h' },
46
+ };
47
+ export function parse(argv, flags = {}) {
48
+ const options = { ...COMMON_FLAGS, ...flags };
49
+ // parseArgs rejects `--index -1` as ambiguous; fold negative-number values
50
+ // of string flags into `--index=-1` form before parsing.
51
+ const args = [];
52
+ for (let i = 0; i < argv.length; i++) {
53
+ const arg = argv[i];
54
+ const name = arg.startsWith('--') ? arg.slice(2) : undefined;
55
+ const next = argv[i + 1];
56
+ if (name && options[name]?.type === 'string' && next !== undefined && /^-\d/.test(next)) {
57
+ args.push(`${arg}=${next}`);
58
+ i += 1;
59
+ }
60
+ else {
61
+ args.push(arg);
62
+ }
63
+ }
64
+ try {
65
+ const { values, positionals } = parseArgs({
66
+ args,
67
+ options,
68
+ allowPositionals: true,
69
+ strict: true,
70
+ });
71
+ return { values: values, positionals };
72
+ }
73
+ catch (e) {
74
+ throw new CliError(e instanceof Error ? e.message : String(e), EXIT.USAGE, "run the command with --help for usage");
75
+ }
76
+ }
77
+ export function requirePositional(positionals, index, name, usage) {
78
+ const value = positionals[index];
79
+ if (!value) {
80
+ throw new CliError(`missing <${name}>`, EXIT.USAGE, `usage: ${usage}`);
81
+ }
82
+ return value;
83
+ }
84
+ // =============================================================================
85
+ // Server URL resolution: --url flag > NEBULA_URL env > error
86
+ // =============================================================================
87
+ export function resolveUrl(flagUrl) {
88
+ const url = (typeof flagUrl === 'string' && flagUrl) || process.env.NEBULA_URL;
89
+ if (!url) {
90
+ throw new CliError('no Nebula server URL configured', EXIT.USAGE, 'pass --url http://localhost:8000 or export NEBULA_URL=http://localhost:8000');
91
+ }
92
+ return url.replace(/\/+$/, '');
93
+ }
94
+ function stateDir() {
95
+ return process.env.NEBULA_STATE_DIR || path.join(os.homedir(), '.nebula');
96
+ }
97
+ /** State file is keyed by hash(url + notebook path) so invocations share the lock. */
98
+ export function sessionFilePath(url, notebookPath) {
99
+ const key = createHash('sha256').update(`${url}\n${notebookPath}`).digest('hex').slice(0, 16);
100
+ return path.join(stateDir(), `cli-session-${key}.json`);
101
+ }
102
+ export function loadSessionState(url, notebookPath) {
103
+ try {
104
+ const raw = fs.readFileSync(sessionFilePath(url, notebookPath), 'utf-8');
105
+ const parsed = JSON.parse(raw);
106
+ return typeof parsed.agentId === 'string' && parsed.agentId ? parsed : null;
107
+ }
108
+ catch {
109
+ return null;
110
+ }
111
+ }
112
+ export function saveSessionState(state) {
113
+ const file = sessionFilePath(state.url, state.path);
114
+ fs.mkdirSync(path.dirname(file), { recursive: true });
115
+ fs.writeFileSync(file, JSON.stringify(state, null, 2) + '\n', 'utf-8');
116
+ return file;
117
+ }
118
+ export function clearSessionState(url, notebookPath) {
119
+ fs.rmSync(sessionFilePath(url, notebookPath), { force: true });
120
+ }
121
+ export function newAgentId() {
122
+ return `nebula-cli-${randomBytes(4).toString('hex')}`;
123
+ }
124
+ /**
125
+ * Build a NebulaClient for a command. If a CLI session exists for this
126
+ * url+notebook, its agent token is attached automatically so the invocation
127
+ * shares the agent lock started by `nebula session start`.
128
+ */
129
+ export function makeClient(url, notebookPath) {
130
+ const session = notebookPath ? loadSessionState(url, notebookPath) : null;
131
+ return new NebulaClient({
132
+ baseUrl: url,
133
+ agentId: session?.agentId,
134
+ clientName: session?.name ?? 'nebula-cli',
135
+ // Sessions are explicit in the CLI (nebula session start/end).
136
+ autoStartAgentSession: false,
137
+ });
138
+ }
139
+ // =============================================================================
140
+ // Content input: --content <str> | --content-file <f> | "-" (stdin)
141
+ // =============================================================================
142
+ async function readStdin() {
143
+ const chunks = [];
144
+ for await (const chunk of process.stdin) {
145
+ chunks.push(Buffer.from(chunk));
146
+ }
147
+ return Buffer.concat(chunks).toString('utf-8');
148
+ }
149
+ export async function resolveContentInput(content, contentFile, stdinMarker) {
150
+ const provided = [content !== undefined, contentFile !== undefined, stdinMarker].filter(Boolean);
151
+ if (provided.length !== 1) {
152
+ throw new CliError('provide exactly one of --content <str>, --content-file <file>, or - (stdin)', EXIT.USAGE);
153
+ }
154
+ if (typeof content === 'string') {
155
+ return content;
156
+ }
157
+ if (typeof contentFile === 'string') {
158
+ try {
159
+ return fs.readFileSync(contentFile, 'utf-8');
160
+ }
161
+ catch (e) {
162
+ throw new CliError(`cannot read --content-file ${contentFile}: ${e instanceof Error ? e.message : String(e)}`, EXIT.USAGE);
163
+ }
164
+ }
165
+ return readStdin();
166
+ }
167
+ // =============================================================================
168
+ // Output helpers
169
+ // =============================================================================
170
+ export function printJson(data) {
171
+ console.log(JSON.stringify(data, null, 2));
172
+ }
173
+ /** At most one contextual next-step hint per command (AXI); suppressed by --quiet/--json. */
174
+ export function printHint(text, values) {
175
+ if (!values.quiet && !values.json) {
176
+ console.log(`hint: ${text}`);
177
+ }
178
+ }
179
+ export function firstLineOf(content, max = 80) {
180
+ const lines = content.split('\n');
181
+ let first = lines[0];
182
+ let truncated = lines.length > 1;
183
+ if (first.length > max) {
184
+ first = first.slice(0, max);
185
+ truncated = true;
186
+ }
187
+ return truncated ? `${first}…` : first;
188
+ }
189
+ export function tailLines(text, n) {
190
+ const lines = text.replace(/\n$/, '').split('\n');
191
+ return lines.slice(Math.max(0, lines.length - n));
192
+ }
193
+ export function parseIntFlag(value, name, fallback) {
194
+ if (value === undefined)
195
+ return fallback;
196
+ const n = Number.parseInt(String(value), 10);
197
+ if (Number.isNaN(n)) {
198
+ throw new CliError(`${name} must be an integer, got "${String(value)}"`, EXIT.USAGE);
199
+ }
200
+ return n;
201
+ }
202
+ /** Map an operation error message to a CliError with the right exit code/hint. */
203
+ export function toCliError(message, notebookPath) {
204
+ const msg = message || 'operation failed';
205
+ if (/agent session required/i.test(msg)) {
206
+ return new CliError(msg, EXIT.ERROR, `start one with: nebula session start ${notebookPath ?? '<path>'}`);
207
+ }
208
+ if (/kernel session not found|no kernel|kernel .*dead/i.test(msg)) {
209
+ return new CliError(msg, EXIT.KERNEL);
210
+ }
211
+ return new CliError(msg, EXIT.ERROR);
212
+ }
213
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/cli/shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,EAAE,EAAE,CAAC;IACL,sBAAsB;IACtB,KAAK,EAAE,CAAC;IACR,qEAAqE;IACrE,KAAK,EAAE,CAAC;IACR,+BAA+B;IAC/B,MAAM,EAAE,CAAC;IACT,qEAAqE;IACrE,QAAQ,EAAE,CAAC;IACX,qEAAqE;IACrE,OAAO,EAAE,CAAC;CACF,CAAC;AAEX,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGtB;IACA;IAHX,YACE,OAAe,EACN,OAAe,IAAI,CAAC,KAAK,EACzB,QAAiB;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,SAAI,GAAJ,IAA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AC,CAAC;AACX,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,UAAU,CAAC,OAA2B,EAAE,YAAqB;IAC3E,MAAM,GAAG,GAAG,OAAO,IAAI,kBAAkB,CAAC;IAC1C,IAAI,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,wCAAwC,YAAY,IAAI,QAAQ,EAAE,CAAC,CAAC;IAC3G,CAAC;IACD,IAAI,mDAAmD,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClE,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `nebula setup-skill` — install a Claude Code Agent Skill that teaches
3
+ * agents launched OUTSIDE Nebula terminals (plain shells, SSH sessions, other
4
+ * projects) how to drive notebooks with this CLI. Inside Nebula terminals the
5
+ * bootstrap prompt + PATH injection already cover this; the skill closes the
6
+ * gap everywhere else.
7
+ *
8
+ * The skill content is embedded here (single source of truth) so `npx
9
+ * nebula-notebook-mcp` installs work without file-resolution games.
10
+ */
11
+ export declare function cmdSetupSkill(argv: string[]): Promise<number>;
12
+ //# sourceMappingURL=skill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/cli/skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA0HH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuDnE"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * `nebula setup-skill` — install a Claude Code Agent Skill that teaches
3
+ * agents launched OUTSIDE Nebula terminals (plain shells, SSH sessions, other
4
+ * projects) how to drive notebooks with this CLI. Inside Nebula terminals the
5
+ * bootstrap prompt + PATH injection already cover this; the skill closes the
6
+ * gap everywhere else.
7
+ *
8
+ * The skill content is embedded here (single source of truth) so `npx
9
+ * nebula-notebook-mcp` installs work without file-resolution games.
10
+ */
11
+ import { promises as fs } from 'node:fs';
12
+ import * as os from 'node:os';
13
+ import * as path from 'node:path';
14
+ import { parseArgs } from 'node:util';
15
+ import { CliError, EXIT } from './shared.js';
16
+ const SKILL_MD = `---
17
+ name: nebula-notebook
18
+ description: Drive Jupyter-style notebooks (.ipynb/.qmd/.py percent) on a Nebula Notebook server with the \`nebula\` CLI — read/edit/insert/delete cells, execute with output in one call, search, manage kernels. Use when the user asks to work on a notebook served by Nebula (a NEBULA_URL / localhost:3000 notebook server), run or fix notebook cells, or inspect notebook outputs.
19
+ ---
20
+
21
+ # Nebula Notebook CLI
22
+
23
+ Work with notebooks on a running Nebula server via the \`nebula\` CLI.
24
+
25
+ ## Connect (do this first — it depends on where you are running)
26
+
27
+ Find the server URL, in this order:
28
+
29
+ 1. **\`NEBULA_URL\` already set?** (\`echo $NEBULA_URL\`) — you are likely inside a
30
+ Nebula terminal; everything is pre-wired. Verify: \`curl -s $NEBULA_URL/api/health\`.
31
+ 2. **Same machine as the server?** Try \`curl -s http://localhost:3000/api/health\`
32
+ — if it answers \`{"status":"ok"...}\`, use \`export NEBULA_URL=http://localhost:3000\`.
33
+ 3. **Server is remote (common on HPC: it runs on a login node).** Two cases —
34
+ ASK THE USER which applies; do not guess:
35
+ - a tunnel is already forwarded (they browse Nebula at \`http://localhost:3000\`
36
+ on this machine) → step 2 will have worked;
37
+ - no tunnel yet → ask the user to run one, e.g.
38
+ \`ssh -L 3000:<server-host>:3000 <cluster>\`, or to give you a directly
39
+ reachable URL. The right URL is whatever THEY open the Nebula UI at.
40
+ 4. Health check fails everywhere → tell the user the server looks down and ask
41
+ how they normally start/reach it (\`npx nebula-notebook\` locally).
42
+
43
+ Notebook paths in commands are paths on the SERVER's filesystem (ask the user
44
+ or find them via the UI/file browser if unsure — they are usually absolute).
45
+
46
+ If \`nebula\` is not on PATH: \`npx -p nebula-notebook-mcp nebula …\`, or from a
47
+ Nebula repo checkout: \`<repo>/packages/mcp/bin/nebula\`.
48
+
49
+ ## Commands
50
+
51
+ \`\`\`bash
52
+ nebula nb read <path> # list cells: #idx id type [n] first-line
53
+ nebula nb read <path> --cells 3-8 --outputs --full
54
+ nebula run <path> <cell-id> --tail 40 # execute AND print output tail in one call
55
+ nebula nb edit <path> <cell-id> --content-file - # stdin; or --content '...'
56
+ nebula nb insert <path> --index N --content '...' [--type markdown] [--id my-id]
57
+ nebula nb delete <path> <cell-id>
58
+ nebula nb search <path> <query> --limit 5
59
+ nebula kernel status|restart|interrupt <path>
60
+ nebula session start <path> # hold the agent edit lock (persists across invocations)
61
+ nebula session end <path>
62
+ nebula compute status|queues|alloc|ls|use|cancel # cluster compute (see below)
63
+ \`\`\`
64
+
65
+ All commands accept \`--json\` (raw) and \`--quiet\` (no hint line).
66
+ Notebook paths are absolute paths on the SERVER's filesystem.
67
+
68
+ ## Long-running cells — no polling
69
+
70
+ \`nebula run\` BLOCKS until the cell finishes (it follows the execution
71
+ internally). So for anything that might take a while, **launch it as a
72
+ background shell task and move on** — the process exiting IS the completion
73
+ signal; you will be notified. Never write your own poll loop.
74
+
75
+ \`\`\`bash
76
+ nebula run <path> train-cell --max-wait 0 --tail 60 # run in background; 0 = wait however long it takes
77
+ \`\`\`
78
+
79
+ Exit codes tell you what happened: 0 done-ok · 1 cell errored (traceback in the
80
+ tail) · 3 still running when --max-wait expired. \`--no-wait\` exists for true
81
+ fire-and-forget (check later with \`nebula nb read --outputs\`).
82
+
83
+ ## Cluster compute (optional)
84
+
85
+ Some Nebula servers sit on HPC clusters and can run notebook kernels on
86
+ scheduler-backed compute allocations. The feature is detection-gated — absent
87
+ on laptops/plain servers — so **check \`nebula compute status\` first**; if it
88
+ says no scheduler, skip this section entirely (kernels run on the server).
89
+
90
+ Typical flow:
91
+
92
+ \`\`\`bash
93
+ nebula compute status # scheduler present?
94
+ nebula compute queues # partitions, idle CPUs/GPUs, backlog
95
+ nebula compute alloc --partition gpu --gpus 1 --walltime 2 --idle-timeout 60 --wait # background task; blocks until active
96
+ nebula compute use <alloc-id> <notebook.ipynb> # bind the notebook's kernels to it
97
+ nebula run <notebook.ipynb> <cell-id> # now executes on the allocation
98
+ nebula compute cancel <alloc-id> # when the task is done
99
+ \`\`\`
100
+
101
+ \`alloc --wait\` follows the queue internally (like \`nebula run\`): launch it
102
+ as a background shell task and the process exit is the signal — never write
103
+ your own poll loop.
104
+
105
+ Etiquette — allocations consume real cluster resources:
106
+
107
+ - Request modest resources: only the CPUs/GPUs/memory/walltime the task needs.
108
+ - Add \`--idle-timeout 60\` to allocations you create: the allocation ends
109
+ itself after 60 idle minutes (no kernel/terminal activity), so a forgotten
110
+ allocation never squats on GPUs.
111
+ - Cancel allocations you created as soon as the task completes (the idle
112
+ timeout is a safety net, not a substitute).
113
+ - NEVER cancel allocations you did not create (\`nebula compute ls\` shows all).
114
+
115
+ ## Rules
116
+
117
+ - **Read before editing.** Edits are OCC-checked against what you last read.
118
+ - **Exit code 9 = edit conflict**: the cell changed (usually the user typing).
119
+ The current content is printed — re-apply your change against it and retry.
120
+ This is normal collaboration, not an error.
121
+ - **Exit code 7** = no kernel session; \`nebula run\` starts one automatically.
122
+ - Prefer \`nebula run\` over edit-then-hope: it executes and returns status,
123
+ execution_count, and the output tail in a single call.
124
+ - For multi-edit work, \`nebula session start\` first (shows the user a purple
125
+ "agent session" badge and locks out conflicting edits), \`session end\` when done.
126
+ - Pipe freely: \`nebula nb read <path> --full | grep -n pattern\` filters
127
+ before output reaches your context.
128
+ `;
129
+ export async function cmdSetupSkill(argv) {
130
+ const { values } = parseArgs({
131
+ args: argv,
132
+ options: {
133
+ project: { type: 'boolean', default: false },
134
+ dir: { type: 'string' },
135
+ print: { type: 'boolean', default: false },
136
+ help: { type: 'boolean', short: 'h', default: false },
137
+ quiet: { type: 'boolean', default: false },
138
+ },
139
+ allowPositionals: false,
140
+ });
141
+ if (values.help) {
142
+ console.log(`nebula setup-skill — install the Claude Code skill for this CLI
143
+
144
+ Teaches agents in plain terminals (outside Nebula) when and how to use nebula.
145
+
146
+ nebula setup-skill # → ~/.claude/skills/nebula-notebook/SKILL.md (all projects)
147
+ nebula setup-skill --project # → ./.claude/skills/nebula-notebook/SKILL.md (this repo)
148
+ nebula setup-skill --dir <d> # → <d>/nebula-notebook/SKILL.md
149
+ nebula setup-skill --print # print the skill to stdout instead`);
150
+ return EXIT.OK;
151
+ }
152
+ if (values.print) {
153
+ process.stdout.write(SKILL_MD);
154
+ return EXIT.OK;
155
+ }
156
+ const baseDir = values.dir
157
+ ? path.resolve(values.dir)
158
+ : values.project
159
+ ? path.join(process.cwd(), '.claude', 'skills')
160
+ : path.join(os.homedir(), '.claude', 'skills');
161
+ const skillDir = path.join(baseDir, 'nebula-notebook');
162
+ const skillPath = path.join(skillDir, 'SKILL.md');
163
+ try {
164
+ await fs.mkdir(skillDir, { recursive: true });
165
+ await fs.writeFile(skillPath, SKILL_MD, 'utf-8');
166
+ }
167
+ catch (err) {
168
+ throw new CliError(`failed to write skill: ${err instanceof Error ? err.message : String(err)}`, EXIT.ERROR, 'check permissions, or use --dir / --print');
169
+ }
170
+ console.log(`installed: ${skillPath}`);
171
+ if (!values.quiet) {
172
+ console.log('hint: new Claude Code sessions will discover it automatically; set NEBULA_URL in shells where agents run');
173
+ }
174
+ return EXIT.OK;
175
+ }
176
+ //# sourceMappingURL=skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/cli/skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW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CAAC,GAAG,CAAC;QAC1B,CAAC,CAAC,MAAM,CAAC,OAAO;YACd,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC;YAC/C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAEnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAElD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,MAAM,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,QAAQ,CAChB,0BAA0B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAC5E,IAAI,CAAC,KAAK,EACV,2CAA2C,CAC5C,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,cAAc,SAAS,EAAE,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,0GAA0G,CAAC,CAAC;IAC1H,CAAC;IACD,OAAO,IAAI,CAAC,EAAE,CAAC;AACjB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  export * from './types.js';
8
8
  export { classifyError, getErrorMessage, formatErrorMessage, shouldRetry, calculateRetryDelay, ErrorCategory, type ClassifiedError, type RecoverabilityStatus, } from './errors.js';
9
9
  export { CircuitBreaker, createCircuitBreaker, CircuitState, type CircuitBreakerOptions, type CircuitBreakerEvent, type CircuitBreakerListener, type CircuitBreakerResult, } from './circuit-breaker.js';
10
- export { NebulaClient, createNebulaClient, type NebulaClientConfig, type KernelSession, type ExecutionResult, type WriteCellResult, } from './notebook/client.js';
11
- export { type Tool, type ToolDefinition, type ToolResult, type MCPContent, allTools, toolsByName, toolCategories, notebookTools, kernelTools, executionTools, getToolDefinitions, executeToolByName, executeToolForMCP, getTool, hasTool, getToolNamesByCategory, readNotebookTool, readCellTool, readOutputTool, insertCellTool, updateCellTool, deleteCellTool, createNotebookTool, moveCellTool, duplicateCellTool, searchCellsTool, updateMetadataTool, listKernelsTool, kernelStartTool, kernelStopTool, kernelRestartTool, kernelInterruptTool, executeCellTool, } from './tools/index.js';
10
+ export { NebulaClient, createNebulaClient, type NebulaClientConfig, type KernelSession, type ExecutionResult, type WriteCellResult, type ComputeAllocation, type ComputeAllocationState, type ComputeSpec, type ComputeStatus, type ComputePartitions, type ComputePartitionLoad, type ComputeQosLoad, type ComputeStartEstimate, } from './notebook/client.js';
11
+ export { type Tool, type ToolDefinition, type ToolResult, type MCPContent, allTools, toolsByName, toolCategories, notebookTools, kernelTools, executionTools, computeTools, getToolDefinitions, executeToolByName, executeToolForMCP, getTool, hasTool, getToolNamesByCategory, readNotebookTool, readCellTool, readOutputTool, insertCellTool, updateCellTool, deleteCellTool, createNotebookTool, moveCellTool, duplicateCellTool, searchCellsTool, updateMetadataTool, listKernelsTool, kernelStartTool, kernelStopTool, kernelRestartTool, kernelInterruptTool, executeCellTool, computeStatusTool, listComputeQueuesTool, requestAllocationTool, listAllocationsTool, cancelAllocationTool, useAllocationTool, } from './tools/index.js';
12
12
  export { readNotebookCells, writeNotebookCell, executeCell, searchNotebookCells, readCellsToolDefinition, writeCellToolDefinition, executeCellToolDefinition, searchCellsToolDefinition, type ReadCellsParams, type ReadCellsResult, type WriteCellParams, type ExecuteCellParams, type ExecuteCellResult, type SearchCellsParams, type SearchCellsResult, } from './notebook/tools.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,cAAc,YAAY,CAAC;AAK3B,OAAO,EACL,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,UAAU,EAGf,QAAQ,EACR,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EAGd,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,sBAAsB,EAGtB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAGlB,eAAe,EACf,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EAGnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EAC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