orient-cli 0.2.1 → 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.
- package/dist/extensions/orient-playwright.d.ts +7 -0
- package/dist/extensions/orient-playwright.js +8 -0
- package/dist/extensions/orient-playwright.js.map +1 -0
- package/dist/extensions/orient-web-search.d.ts +5 -0
- package/dist/extensions/orient-web-search.js +6 -0
- package/dist/extensions/orient-web-search.js.map +1 -0
- package/dist/integrations/notebooklm/setup.d.ts +94 -0
- package/dist/integrations/notebooklm/setup.js +311 -0
- package/dist/integrations/notebooklm/setup.js.map +1 -0
- package/dist/integrations/playwright/bridge.d.ts +85 -0
- package/dist/integrations/playwright/bridge.js +225 -0
- package/dist/integrations/playwright/bridge.js.map +1 -0
- package/dist/integrations/playwright/playwright-extension.d.ts +22 -0
- package/dist/integrations/playwright/playwright-extension.js +209 -0
- package/dist/integrations/playwright/playwright-extension.js.map +1 -0
- package/dist/integrations/web-search/bridge.d.ts +79 -0
- package/dist/integrations/web-search/bridge.js +298 -0
- package/dist/integrations/web-search/bridge.js.map +1 -0
- package/dist/integrations/web-search/web-search-extension.d.ts +26 -0
- package/dist/integrations/web-search/web-search-extension.js +122 -0
- package/dist/integrations/web-search/web-search-extension.js.map +1 -0
- package/dist/orient/orient-extension.js +149 -1
- package/dist/orient/orient-extension.js.map +1 -1
- package/dist/package-paths.js +6 -1
- package/dist/package-paths.js.map +1 -1
- package/node_modules/@orient-cli/agent-core/package.json +2 -2
- package/node_modules/@orient-cli/ai/package.json +1 -1
- package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js +2 -2
- package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/node_modules/@orient-cli/coding-agent/package.json +4 -4
- package/node_modules/@orient-cli/tui/package.json +1 -1
- package/node_modules/mime-db/HISTORY.md +541 -0
- package/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/mime-db/README.md +109 -0
- package/node_modules/mime-db/db.json +9342 -0
- package/node_modules/mime-db/index.js +12 -0
- package/node_modules/mime-db/package.json +56 -0
- package/node_modules/mime-types/HISTORY.md +428 -0
- package/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/mime-types/README.md +126 -0
- package/node_modules/mime-types/index.js +211 -0
- package/node_modules/mime-types/mimeScore.js +57 -0
- package/node_modules/mime-types/package.json +49 -0
- package/package.json +13 -6
- package/scripts/postinstall.mjs +235 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled pi extension re-export for the playwright integration.
|
|
3
|
+
*
|
|
4
|
+
* Lives at `dist/extensions/orient-playwright.js` after build so the
|
|
5
|
+
* CLI bootstrap can inject it via `--extension <path>`.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from "../integrations/playwright/playwright-extension.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled pi extension re-export for the playwright integration.
|
|
3
|
+
*
|
|
4
|
+
* Lives at `dist/extensions/orient-playwright.js` after build so the
|
|
5
|
+
* CLI bootstrap can inject it via `--extension <path>`.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from "../integrations/playwright/playwright-extension.js";
|
|
8
|
+
//# sourceMappingURL=orient-playwright.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orient-playwright.js","sourceRoot":"","sources":["../../src/extensions/orient-playwright.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orient-web-search.js","sourceRoot":"","sources":["../../src/extensions/orient-web-search.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NotebookLM setup flow
|
|
3
|
+
* ======================
|
|
4
|
+
*
|
|
5
|
+
* Interactive installer + authenticator for `notebooklm-py`, invoked
|
|
6
|
+
* on-demand when the user enters the Research phase in ORIENT mode at
|
|
7
|
+
* verbosity tier 3 (thorough). At lower tiers the Research phase
|
|
8
|
+
* works without NotebookLM — it falls back to pi's built-in read /
|
|
9
|
+
* grep / find / web-fetch tools. Tier 3 is where NotebookLM is worth
|
|
10
|
+
* the setup cost (real Google auth, browser install, cookie harvest).
|
|
11
|
+
*
|
|
12
|
+
* The flow:
|
|
13
|
+
*
|
|
14
|
+
* 1. Check whether Python + pip are available on PATH.
|
|
15
|
+
* 2. Check whether `notebooklm-py` is already installed and
|
|
16
|
+
* authenticated by asking the existing bridge's
|
|
17
|
+
* `checkAvailability()`.
|
|
18
|
+
* 3. If not installed, run `pip install "notebooklm-py[browser]"`
|
|
19
|
+
* — the `[browser]` extra pulls in Playwright's Python bindings
|
|
20
|
+
* required for the headed login flow. Then run
|
|
21
|
+
* `playwright install chromium` to fetch the Chromium browser
|
|
22
|
+
* binary the login flow drives.
|
|
23
|
+
* 4. If not authenticated, run `notebooklm login`. This opens a
|
|
24
|
+
* real Chromium window where the user signs into their Google
|
|
25
|
+
* account. The library then harvests session cookies (SID,
|
|
26
|
+
* HSID, SSID, APISID, SAPISID, __Secure-1PSID, __Secure-3PSID)
|
|
27
|
+
* and persists them at `~/.notebooklm/profiles/default/
|
|
28
|
+
* storage_state.json`.
|
|
29
|
+
* 5. Re-check availability and report success / failure.
|
|
30
|
+
*
|
|
31
|
+
* On headless servers (no X display), the `notebooklm login` command
|
|
32
|
+
* will fail because it needs a visible browser window. We detect this
|
|
33
|
+
* via `process.env.DISPLAY` and print fallback instructions that tell
|
|
34
|
+
* the user how to (a) run the login on a workstation, (b) copy the
|
|
35
|
+
* `~/.notebooklm/` profile directory to the server, and (c) set
|
|
36
|
+
* `NOTEBOOKLM_HOME` to point at it.
|
|
37
|
+
*
|
|
38
|
+
* This file is a pure async module — the actual ctx.ui.select() /
|
|
39
|
+
* ctx.ui.notify() wiring happens in the orient extension.
|
|
40
|
+
*/
|
|
41
|
+
import { exec } from "node:child_process";
|
|
42
|
+
declare const execAsync: typeof exec.__promisify__;
|
|
43
|
+
export interface SetupStep {
|
|
44
|
+
label: string;
|
|
45
|
+
status: "pending" | "running" | "ok" | "skipped" | "failed";
|
|
46
|
+
detail?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface SetupResult {
|
|
49
|
+
success: boolean;
|
|
50
|
+
steps: SetupStep[];
|
|
51
|
+
/** Final availability state after the flow. */
|
|
52
|
+
installed: boolean;
|
|
53
|
+
authenticated: boolean;
|
|
54
|
+
/** Terminal-friendly summary message for ctx.ui.notify(). */
|
|
55
|
+
message: string;
|
|
56
|
+
}
|
|
57
|
+
export interface SetupOptions {
|
|
58
|
+
/**
|
|
59
|
+
* Callback invoked after each step transitions. Lets callers stream
|
|
60
|
+
* progress to the TUI in real time instead of waiting for the whole
|
|
61
|
+
* flow to finish.
|
|
62
|
+
*/
|
|
63
|
+
onProgress?: (step: SetupStep) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Skip the `notebooklm login` step. Useful when the setup is running
|
|
66
|
+
* on a headless server and the caller wants to run the install
|
|
67
|
+
* portion now and defer the auth to a workstation.
|
|
68
|
+
*/
|
|
69
|
+
skipAuth?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Maximum number of seconds the login subprocess is allowed to run.
|
|
72
|
+
* The Google sign-in can legitimately take a minute or two, so the
|
|
73
|
+
* default is 5 minutes. Set to 0 to disable the timeout.
|
|
74
|
+
*/
|
|
75
|
+
loginTimeoutSeconds?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Full setup flow. Updates the provided `steps` array and invokes
|
|
79
|
+
* `onProgress` after every status change so the caller can stream
|
|
80
|
+
* the UI. Returns a structured `SetupResult`.
|
|
81
|
+
*/
|
|
82
|
+
export declare function setupNotebookLM(options?: SetupOptions): Promise<SetupResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Check whether the caller's environment has a notebooklm profile
|
|
85
|
+
* directory already (useful for detecting "setup has been run before"
|
|
86
|
+
* without invoking the bridge's auth-check subprocess).
|
|
87
|
+
*/
|
|
88
|
+
export declare function hasExistingProfile(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Compact one-liner describing current setup state. Used by the
|
|
91
|
+
* session_start hook to surface status without running the full flow.
|
|
92
|
+
*/
|
|
93
|
+
export declare function describeStatus(): Promise<string>;
|
|
94
|
+
export { execAsync };
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NotebookLM setup flow
|
|
3
|
+
* ======================
|
|
4
|
+
*
|
|
5
|
+
* Interactive installer + authenticator for `notebooklm-py`, invoked
|
|
6
|
+
* on-demand when the user enters the Research phase in ORIENT mode at
|
|
7
|
+
* verbosity tier 3 (thorough). At lower tiers the Research phase
|
|
8
|
+
* works without NotebookLM — it falls back to pi's built-in read /
|
|
9
|
+
* grep / find / web-fetch tools. Tier 3 is where NotebookLM is worth
|
|
10
|
+
* the setup cost (real Google auth, browser install, cookie harvest).
|
|
11
|
+
*
|
|
12
|
+
* The flow:
|
|
13
|
+
*
|
|
14
|
+
* 1. Check whether Python + pip are available on PATH.
|
|
15
|
+
* 2. Check whether `notebooklm-py` is already installed and
|
|
16
|
+
* authenticated by asking the existing bridge's
|
|
17
|
+
* `checkAvailability()`.
|
|
18
|
+
* 3. If not installed, run `pip install "notebooklm-py[browser]"`
|
|
19
|
+
* — the `[browser]` extra pulls in Playwright's Python bindings
|
|
20
|
+
* required for the headed login flow. Then run
|
|
21
|
+
* `playwright install chromium` to fetch the Chromium browser
|
|
22
|
+
* binary the login flow drives.
|
|
23
|
+
* 4. If not authenticated, run `notebooklm login`. This opens a
|
|
24
|
+
* real Chromium window where the user signs into their Google
|
|
25
|
+
* account. The library then harvests session cookies (SID,
|
|
26
|
+
* HSID, SSID, APISID, SAPISID, __Secure-1PSID, __Secure-3PSID)
|
|
27
|
+
* and persists them at `~/.notebooklm/profiles/default/
|
|
28
|
+
* storage_state.json`.
|
|
29
|
+
* 5. Re-check availability and report success / failure.
|
|
30
|
+
*
|
|
31
|
+
* On headless servers (no X display), the `notebooklm login` command
|
|
32
|
+
* will fail because it needs a visible browser window. We detect this
|
|
33
|
+
* via `process.env.DISPLAY` and print fallback instructions that tell
|
|
34
|
+
* the user how to (a) run the login on a workstation, (b) copy the
|
|
35
|
+
* `~/.notebooklm/` profile directory to the server, and (c) set
|
|
36
|
+
* `NOTEBOOKLM_HOME` to point at it.
|
|
37
|
+
*
|
|
38
|
+
* This file is a pure async module — the actual ctx.ui.select() /
|
|
39
|
+
* ctx.ui.notify() wiring happens in the orient extension.
|
|
40
|
+
*/
|
|
41
|
+
import { exec, execFile, spawn } from "node:child_process";
|
|
42
|
+
import { existsSync } from "node:fs";
|
|
43
|
+
import { promisify } from "node:util";
|
|
44
|
+
import { NotebookLMBridge } from "./bridge.js";
|
|
45
|
+
const execAsync = promisify(exec);
|
|
46
|
+
const execFileAsync = promisify(execFile);
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// Capability probes
|
|
49
|
+
// ============================================================================
|
|
50
|
+
/**
|
|
51
|
+
* Check whether a binary is resolvable via `which`. Returns the path if
|
|
52
|
+
* found, or `null` otherwise. Works on Linux/macOS; on Windows a
|
|
53
|
+
* caller should provide a PowerShell fallback.
|
|
54
|
+
*/
|
|
55
|
+
async function which(binary) {
|
|
56
|
+
try {
|
|
57
|
+
const { stdout } = await execFileAsync("which", [binary], { timeout: 5_000 });
|
|
58
|
+
const path = stdout.trim();
|
|
59
|
+
return path.length > 0 ? path : null;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Detect the Python interpreter to use. Prefers `python3` because on
|
|
67
|
+
* every modern distribution `python` either points at Python 2 or is
|
|
68
|
+
* absent entirely. Returns a binary name or null.
|
|
69
|
+
*/
|
|
70
|
+
async function detectPython() {
|
|
71
|
+
if (await which("python3"))
|
|
72
|
+
return "python3";
|
|
73
|
+
if (await which("python"))
|
|
74
|
+
return "python";
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Detect a usable pip entry point. Prefers running pip as a Python
|
|
79
|
+
* module (`python3 -m pip ...`) because that guarantees the pip
|
|
80
|
+
* invocation matches the interpreter we just located — standalone
|
|
81
|
+
* `pip` can point at a different Python from `python3`.
|
|
82
|
+
*/
|
|
83
|
+
async function detectPip(python) {
|
|
84
|
+
try {
|
|
85
|
+
await execFileAsync(python, ["-m", "pip", "--version"], { timeout: 10_000 });
|
|
86
|
+
return [python, "-m", "pip"];
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Heuristic for "this is a headless box". If `$DISPLAY` is empty and
|
|
94
|
+
* `$WAYLAND_DISPLAY` is empty, no X / Wayland is available and the
|
|
95
|
+
* `notebooklm login` browser window will fail.
|
|
96
|
+
*/
|
|
97
|
+
function looksHeadless() {
|
|
98
|
+
if (process.platform === "win32" || process.platform === "darwin")
|
|
99
|
+
return false;
|
|
100
|
+
return !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY;
|
|
101
|
+
}
|
|
102
|
+
// ============================================================================
|
|
103
|
+
// Install step implementations
|
|
104
|
+
// ============================================================================
|
|
105
|
+
async function runPipInstall(pip, onProgress) {
|
|
106
|
+
return new Promise((resolve, reject) => {
|
|
107
|
+
const args = [...pip.slice(1), "install", "--user", "notebooklm-py[browser]"];
|
|
108
|
+
const proc = spawn(pip[0], args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
109
|
+
let stderr = "";
|
|
110
|
+
proc.stdout.on("data", (chunk) => onProgress?.(chunk.toString()));
|
|
111
|
+
proc.stderr.on("data", (chunk) => {
|
|
112
|
+
stderr += chunk.toString();
|
|
113
|
+
onProgress?.(chunk.toString());
|
|
114
|
+
});
|
|
115
|
+
proc.on("error", reject);
|
|
116
|
+
proc.on("close", (code) => {
|
|
117
|
+
if (code === 0)
|
|
118
|
+
resolve();
|
|
119
|
+
else
|
|
120
|
+
reject(new Error(`pip install failed (exit ${code}): ${stderr.slice(0, 400)}`));
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async function runPlaywrightInstall(python, onProgress) {
|
|
125
|
+
// Use `python -m playwright install chromium` because the playwright
|
|
126
|
+
// binary may not be on PATH even though the Python module is.
|
|
127
|
+
return new Promise((resolve, reject) => {
|
|
128
|
+
const proc = spawn(python, ["-m", "playwright", "install", "chromium"], {
|
|
129
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
130
|
+
});
|
|
131
|
+
let stderr = "";
|
|
132
|
+
proc.stdout.on("data", (chunk) => onProgress?.(chunk.toString()));
|
|
133
|
+
proc.stderr.on("data", (chunk) => {
|
|
134
|
+
stderr += chunk.toString();
|
|
135
|
+
onProgress?.(chunk.toString());
|
|
136
|
+
});
|
|
137
|
+
proc.on("error", reject);
|
|
138
|
+
proc.on("close", (code) => {
|
|
139
|
+
if (code === 0)
|
|
140
|
+
resolve();
|
|
141
|
+
else
|
|
142
|
+
reject(new Error(`playwright install chromium failed (exit ${code}): ${stderr.slice(0, 400)}`));
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
async function runNotebookLMLogin(timeoutSeconds) {
|
|
147
|
+
return new Promise((resolve, reject) => {
|
|
148
|
+
const proc = spawn("notebooklm", ["login"], { stdio: "inherit" });
|
|
149
|
+
const timer = timeoutSeconds > 0
|
|
150
|
+
? setTimeout(() => {
|
|
151
|
+
proc.kill("SIGTERM");
|
|
152
|
+
reject(new Error(`notebooklm login timed out after ${timeoutSeconds}s`));
|
|
153
|
+
}, timeoutSeconds * 1000)
|
|
154
|
+
: null;
|
|
155
|
+
proc.on("error", (err) => {
|
|
156
|
+
if (timer)
|
|
157
|
+
clearTimeout(timer);
|
|
158
|
+
reject(err);
|
|
159
|
+
});
|
|
160
|
+
proc.on("close", (code) => {
|
|
161
|
+
if (timer)
|
|
162
|
+
clearTimeout(timer);
|
|
163
|
+
if (code === 0)
|
|
164
|
+
resolve();
|
|
165
|
+
else
|
|
166
|
+
reject(new Error(`notebooklm login exited with code ${code}`));
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
// ============================================================================
|
|
171
|
+
// Orchestration
|
|
172
|
+
// ============================================================================
|
|
173
|
+
/**
|
|
174
|
+
* Full setup flow. Updates the provided `steps` array and invokes
|
|
175
|
+
* `onProgress` after every status change so the caller can stream
|
|
176
|
+
* the UI. Returns a structured `SetupResult`.
|
|
177
|
+
*/
|
|
178
|
+
export async function setupNotebookLM(options = {}) {
|
|
179
|
+
const steps = [
|
|
180
|
+
{ label: "Detect Python interpreter", status: "pending" },
|
|
181
|
+
{ label: "Detect pip", status: "pending" },
|
|
182
|
+
{ label: "Install notebooklm-py[browser] via pip", status: "pending" },
|
|
183
|
+
{ label: "Install Chromium via playwright", status: "pending" },
|
|
184
|
+
{ label: "Authenticate with Google (notebooklm login)", status: "pending" },
|
|
185
|
+
{ label: "Verify availability", status: "pending" },
|
|
186
|
+
];
|
|
187
|
+
const emit = (step) => options.onProgress?.(step);
|
|
188
|
+
const mark = (i, patch) => {
|
|
189
|
+
steps[i] = { ...steps[i], ...patch };
|
|
190
|
+
emit(steps[i]);
|
|
191
|
+
};
|
|
192
|
+
// Step 1: Python
|
|
193
|
+
mark(0, { status: "running" });
|
|
194
|
+
const python = await detectPython();
|
|
195
|
+
if (!python) {
|
|
196
|
+
mark(0, {
|
|
197
|
+
status: "failed",
|
|
198
|
+
detail: "Python 3 not found. Install Python 3.10+ and re-run `/orient.research.setup`.",
|
|
199
|
+
});
|
|
200
|
+
return finalize(steps, false, false, "Python 3 is required for notebooklm-py. Install it first.");
|
|
201
|
+
}
|
|
202
|
+
mark(0, { status: "ok", detail: python });
|
|
203
|
+
// Step 2: pip
|
|
204
|
+
mark(1, { status: "running" });
|
|
205
|
+
const pip = await detectPip(python);
|
|
206
|
+
if (!pip) {
|
|
207
|
+
mark(1, {
|
|
208
|
+
status: "failed",
|
|
209
|
+
detail: `pip not available for ${python}. Install pip (e.g. \`sudo apt install python3-pip\`) and re-run.`,
|
|
210
|
+
});
|
|
211
|
+
return finalize(steps, false, false, "pip is required. Install python3-pip and re-run.");
|
|
212
|
+
}
|
|
213
|
+
mark(1, { status: "ok", detail: pip.join(" ") });
|
|
214
|
+
// Step 3: pip install (idempotent — pip will skip if already installed)
|
|
215
|
+
mark(2, { status: "running" });
|
|
216
|
+
try {
|
|
217
|
+
await runPipInstall(pip);
|
|
218
|
+
mark(2, { status: "ok" });
|
|
219
|
+
}
|
|
220
|
+
catch (err) {
|
|
221
|
+
mark(2, { status: "failed", detail: err.message });
|
|
222
|
+
return finalize(steps, false, false, "notebooklm-py install failed. Run `pip install --user notebooklm-py[browser]` manually and diagnose.");
|
|
223
|
+
}
|
|
224
|
+
// Step 4: playwright chromium
|
|
225
|
+
mark(3, { status: "running" });
|
|
226
|
+
try {
|
|
227
|
+
await runPlaywrightInstall(python);
|
|
228
|
+
mark(3, { status: "ok" });
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
mark(3, { status: "failed", detail: err.message });
|
|
232
|
+
return finalize(steps, true, false, "Chromium install failed. Run `python3 -m playwright install chromium` manually.");
|
|
233
|
+
}
|
|
234
|
+
// Step 5: auth (conditionally skipped)
|
|
235
|
+
if (options.skipAuth) {
|
|
236
|
+
mark(4, { status: "skipped", detail: "skipAuth=true — run `notebooklm login` on a workstation later." });
|
|
237
|
+
}
|
|
238
|
+
else if (looksHeadless()) {
|
|
239
|
+
mark(4, {
|
|
240
|
+
status: "skipped",
|
|
241
|
+
detail: "No $DISPLAY detected. `notebooklm login` needs a visible browser. Run it on a workstation, then copy ~/.notebooklm/ to this host (or set NOTEBOOKLM_HOME).",
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
mark(4, { status: "running" });
|
|
246
|
+
const timeout = options.loginTimeoutSeconds ?? 300;
|
|
247
|
+
try {
|
|
248
|
+
await runNotebookLMLogin(timeout);
|
|
249
|
+
mark(4, { status: "ok" });
|
|
250
|
+
}
|
|
251
|
+
catch (err) {
|
|
252
|
+
mark(4, { status: "failed", detail: err.message });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Step 6: verify via the existing bridge
|
|
256
|
+
mark(5, { status: "running" });
|
|
257
|
+
const bridge = new NotebookLMBridge();
|
|
258
|
+
const availability = await bridge.checkAvailability();
|
|
259
|
+
mark(5, {
|
|
260
|
+
status: availability.authenticated ? "ok" : "failed",
|
|
261
|
+
detail: `installed=${availability.installed} authenticated=${availability.authenticated}`,
|
|
262
|
+
});
|
|
263
|
+
return finalize(steps, availability.installed, availability.authenticated, availability.authenticated
|
|
264
|
+
? "NotebookLM is ready. Tier-3 Research phase now has notebook creation, source ingestion, web research, cited answers, and artifact generation."
|
|
265
|
+
: availability.installed
|
|
266
|
+
? "NotebookLM installed but not authenticated. Run `/orient.research.setup` again once a display is available, or set NOTEBOOKLM_HOME to a pre-authenticated profile."
|
|
267
|
+
: "NotebookLM setup failed — see the step log above. Tier-3 Research will fall back to pi's built-in tools.");
|
|
268
|
+
}
|
|
269
|
+
function finalize(steps, installed, authenticated, message) {
|
|
270
|
+
return {
|
|
271
|
+
success: installed && authenticated,
|
|
272
|
+
steps,
|
|
273
|
+
installed,
|
|
274
|
+
authenticated,
|
|
275
|
+
message,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
// ============================================================================
|
|
279
|
+
// Shortcut helpers
|
|
280
|
+
// ============================================================================
|
|
281
|
+
/**
|
|
282
|
+
* Check whether the caller's environment has a notebooklm profile
|
|
283
|
+
* directory already (useful for detecting "setup has been run before"
|
|
284
|
+
* without invoking the bridge's auth-check subprocess).
|
|
285
|
+
*/
|
|
286
|
+
export function hasExistingProfile() {
|
|
287
|
+
const home = process.env.NOTEBOOKLM_HOME || `${process.env.HOME ?? "~"}/.notebooklm`;
|
|
288
|
+
const profile = process.env.NOTEBOOKLM_PROFILE || "default";
|
|
289
|
+
const stateFile = `${home}/profiles/${profile}/storage_state.json`;
|
|
290
|
+
return existsSync(stateFile);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Compact one-liner describing current setup state. Used by the
|
|
294
|
+
* session_start hook to surface status without running the full flow.
|
|
295
|
+
*/
|
|
296
|
+
export async function describeStatus() {
|
|
297
|
+
const bridge = new NotebookLMBridge();
|
|
298
|
+
const availability = await bridge.checkAvailability();
|
|
299
|
+
if (availability.authenticated)
|
|
300
|
+
return "notebooklm ready";
|
|
301
|
+
if (availability.installed)
|
|
302
|
+
return "notebooklm installed, not authenticated";
|
|
303
|
+
if (hasExistingProfile())
|
|
304
|
+
return "notebooklm profile found but CLI missing — reinstall via /orient.research.setup";
|
|
305
|
+
return "notebooklm not installed (auto-installs on tier-3 Research)";
|
|
306
|
+
}
|
|
307
|
+
// Re-export `execAsync` as a typed alias so callers that want to
|
|
308
|
+
// extend the setup with custom steps can reuse the same promise-based
|
|
309
|
+
// subprocess utility the module uses internally.
|
|
310
|
+
export { execAsync };
|
|
311
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/integrations/notebooklm/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WA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OAAO,6DAA6D,CAAC;AACtE,CAAC;AAED,iEAAiE;AACjE,sEAAsE;AACtE,iDAAiD;AACjD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playwright bridge for ORIENT CLI
|
|
3
|
+
* =================================
|
|
4
|
+
*
|
|
5
|
+
* Thin subprocess wrapper around `playwright-cli` (the active
|
|
6
|
+
* microsoft/playwright-cli repo, published as `@playwright/cli`).
|
|
7
|
+
* ORIENT ships `@playwright/cli` as a default dependency so browser
|
|
8
|
+
* automation works out of the box — the same pattern Gemini CLI,
|
|
9
|
+
* OpenCode, and Droid use for their own browser tools.
|
|
10
|
+
*
|
|
11
|
+
* Why subprocess and not programmatic?
|
|
12
|
+
* - @playwright/cli maintains its own per-session browser state
|
|
13
|
+
* under `PLAYWRIGHT_CLI_SESSION=<name>`. Reusing that session
|
|
14
|
+
* machinery through the CLI is free; reimplementing it on top
|
|
15
|
+
* of the `playwright` library would duplicate work.
|
|
16
|
+
* - The agent can also invoke `playwright-cli` directly via the
|
|
17
|
+
* bash tool, so having our extension call the same binary keeps
|
|
18
|
+
* both entry points consistent (no drift between "ORIENT tool"
|
|
19
|
+
* and "bash playwright-cli").
|
|
20
|
+
* - Upgrading playwright-cli is a pure npm dependency bump; no
|
|
21
|
+
* extension code changes required.
|
|
22
|
+
*
|
|
23
|
+
* Chromium browser binaries are NOT shipped with this package —
|
|
24
|
+
* `playwright install chromium` has to be run once per machine
|
|
25
|
+
* (~170 MB download). The bridge detects when the binary is
|
|
26
|
+
* missing and returns a helpful error pointing at the install
|
|
27
|
+
* command. Users can pre-warm via `/orient.playwright.setup`.
|
|
28
|
+
*/
|
|
29
|
+
export interface PlaywrightAvailability {
|
|
30
|
+
cliInstalled: boolean;
|
|
31
|
+
chromiumInstalled: boolean;
|
|
32
|
+
sessionName: string;
|
|
33
|
+
}
|
|
34
|
+
export interface PlaywrightSnapshot {
|
|
35
|
+
url: string;
|
|
36
|
+
title: string;
|
|
37
|
+
text: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check whether `playwright-cli` is resolvable and whether the
|
|
41
|
+
* Chromium browser binary has been installed. Chromium absence is
|
|
42
|
+
* treated as an expected first-run state, not an error.
|
|
43
|
+
*/
|
|
44
|
+
export declare function checkPlaywrightAvailability(sessionName?: string): Promise<PlaywrightAvailability>;
|
|
45
|
+
/**
|
|
46
|
+
* Run `npx playwright install chromium` to fetch the Chromium
|
|
47
|
+
* browser binary. Streams stdout / stderr via the onProgress
|
|
48
|
+
* callback so callers can surface the ~170 MB download in the TUI.
|
|
49
|
+
*/
|
|
50
|
+
export declare function installChromium(onProgress?: (chunk: string) => void): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Navigate the session's browser to a URL. Opens the page if no page
|
|
53
|
+
* is active for the session yet.
|
|
54
|
+
*/
|
|
55
|
+
export declare function goto(url: string, sessionName?: string): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Take a snapshot of the current page. `playwright-cli snapshot`
|
|
58
|
+
* returns an accessibility-tree-style text representation optimized
|
|
59
|
+
* for LLM consumption (same pattern as Playwright MCP).
|
|
60
|
+
*/
|
|
61
|
+
export declare function snapshot(sessionName?: string): Promise<PlaywrightSnapshot>;
|
|
62
|
+
/**
|
|
63
|
+
* Click an element matched by a Playwright selector (CSS, text, role,
|
|
64
|
+
* or one of playwright-cli's own locator shortcuts).
|
|
65
|
+
*/
|
|
66
|
+
export declare function click(selector: string, sessionName?: string): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Fill a text input matched by `selector` with `value`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function fill(selector: string, value: string, sessionName?: string): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Take a screenshot of the current page and save it to `outputPath`.
|
|
73
|
+
* Returns the full path of the saved file.
|
|
74
|
+
*/
|
|
75
|
+
export declare function screenshot(outputPath: string, sessionName?: string): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Evaluate JavaScript against the current page. Used for ad-hoc
|
|
78
|
+
* DOM extraction the agent couldn't get from `snapshot`.
|
|
79
|
+
*/
|
|
80
|
+
export declare function evaluate(expression: string, sessionName?: string): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Close the session's browser cleanly. Call this at end-of-packet so
|
|
83
|
+
* headless chromium processes don't linger.
|
|
84
|
+
*/
|
|
85
|
+
export declare function close(sessionName?: string): Promise<void>;
|