probe-research 0.18.0 → 0.20.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/bin/probe-research.js +30 -11
- package/package.json +1 -1
package/bin/probe-research.js
CHANGED
|
@@ -126,8 +126,14 @@ const FIX_MIN = "0.385.0";
|
|
|
126
126
|
* 0.418.0, not 0.417.0: 0.417.0 was cut from a commit before the agent install merged (#4350).
|
|
127
127
|
* 0.421.0 since PR4: the live example's `probe example` (which `needsAgentCli` routes here) came
|
|
128
128
|
* after 0.420.0 was cut, and one floor keeps every call of the install prompt on one release.
|
|
129
|
+
* 0.423.0 since PR4b: example.md's keep step runs `probe example keep`, which 0.422.0 (cut before it
|
|
130
|
+
* merged) lacks.
|
|
131
|
+
* 0.424.0 since PR12 (#4381): runs-only.md's `install --profile runs` and already-set-up.md's
|
|
132
|
+
* `install --profile` and `status --repaste-choice`; 0.423.0 was cut from the commit before it merged.
|
|
133
|
+
* 0.425.0 since PR15: past-work.md's `probe import folders|review|start|status|resume`; 0.424.0 was
|
|
134
|
+
* cut before it merged.
|
|
129
135
|
*/
|
|
130
|
-
const AGENT_MIN_CLI = "0.
|
|
136
|
+
const AGENT_MIN_CLI = "0.425.0";
|
|
131
137
|
/** `install` flags only AGENT_MIN_CLI knows (D36). */
|
|
132
138
|
const AGENT_INSTALL_FLAGS = Object.freeze(["--recommended", "--who-records", "--session-default", "--profile",
|
|
133
139
|
"--attempt"]);
|
|
@@ -203,21 +209,26 @@ function installedVersion(command = "probe") {
|
|
|
203
209
|
* its bin folder (a first download's, before the agent's shell PATH knows that folder); null.
|
|
204
210
|
*/
|
|
205
211
|
function findProbe(min) {
|
|
206
|
-
|
|
207
|
-
for (const candidate of candidates.filter(Boolean)) {
|
|
208
|
-
if (candidate !== "probe") {
|
|
209
|
-
try {
|
|
210
|
-
fs.accessSync(candidate, fs.constants.X_OK);
|
|
211
|
-
} catch {
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
212
|
+
for (const candidate of getProbeCommands()) {
|
|
215
213
|
const found = installedVersion(candidate);
|
|
216
214
|
if (found && atLeast(found, min)) return candidate;
|
|
217
215
|
}
|
|
218
216
|
return null;
|
|
219
217
|
}
|
|
220
218
|
|
|
219
|
+
/** Every `probe` here, answering or not: the one on PATH, then the runnable ones in uv's bin folders. */
|
|
220
|
+
function getProbeCommands() {
|
|
221
|
+
const installed = getUvBinFolders(process.env).map((d) => path.join(d, "probe")).filter((candidate) => {
|
|
222
|
+
try {
|
|
223
|
+
fs.accessSync(candidate, fs.constants.X_OK);
|
|
224
|
+
return true;
|
|
225
|
+
} catch {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
return [...(has("probe") ? ["probe"] : []), ...installed];
|
|
230
|
+
}
|
|
231
|
+
|
|
221
232
|
function baseUrl() {
|
|
222
233
|
const env = process.env.PROBE_BASE_URL;
|
|
223
234
|
if (env && /^https?:\/\//.test(env)) return env.replace(/\/+$/, "");
|
|
@@ -513,8 +524,9 @@ async function main() {
|
|
|
513
524
|
process.exit(1);
|
|
514
525
|
}
|
|
515
526
|
if (signInCodeAt(args) >= 0) console.error(SIGN_IN_CODE_NOTE);
|
|
516
|
-
if (isStatusJson(forwarded) &&
|
|
527
|
+
if (isStatusJson(forwarded) && getProbeCommands().length === 0) {
|
|
517
528
|
// No Probe here: the install prompt's first read (step 1b) answers at once, with no download (D37).
|
|
529
|
+
// A `probe` that does not answer (its service restarting) is Probe here: its status runs (P1b).
|
|
518
530
|
agentRun.answer({ v: 1, setup: NONE_SETUP }, 0);
|
|
519
531
|
}
|
|
520
532
|
const agentCli = needsAgentCli(forwarded);
|
|
@@ -627,9 +639,16 @@ const DOWNLOAD_POLL_MS = 1000;
|
|
|
627
639
|
/** The uninstall barrier (`probe.shared.updates.uninstall_barrier.path`). */
|
|
628
640
|
const BARRIER_FILE = [".local", "state", "probe", "uninstall", "barrier.json"];
|
|
629
641
|
|
|
642
|
+
/** `status` flags only AGENT_MIN_CLI knows: the re-paste menu's answer (D84). */
|
|
643
|
+
const AGENT_STATUS_FLAGS = Object.freeze(["--repaste-choice"]);
|
|
644
|
+
/** `import` verbs only AGENT_MIN_CLI has: bringing in past work (D49, D74). `import wandb` is older. */
|
|
645
|
+
const AGENT_IMPORT_VERBS = Object.freeze(["folders", "review", "start", "status", "resume"]);
|
|
646
|
+
|
|
630
647
|
/** `probe` arguments only AGENT_MIN_CLI runs (D36). */
|
|
631
648
|
function needsAgentCli(forwarded) {
|
|
632
649
|
if (forwarded[0] === "example") return true;
|
|
650
|
+
if (forwarded[0] === "import") return AGENT_IMPORT_VERBS.includes(forwarded[1]);
|
|
651
|
+
if (forwarded[0] === "status") return forwarded.some((word) => AGENT_STATUS_FLAGS.includes(word.split("=")[0]));
|
|
633
652
|
if (forwarded[0] !== LauncherVerb.WIZARD) return false;
|
|
634
653
|
return forwarded.includes("--pending")
|
|
635
654
|
|| forwarded.some((word) => AGENT_INSTALL_FLAGS.includes(word.split("=")[0]));
|