probe-research 0.32.0 → 0.34.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.
@@ -150,8 +150,10 @@ const FIX_MIN = "0.385.0";
150
150
  * PR C's confirmed `service stop` (0.455.0); 0.456.0 was cut before #4527 merged.
151
151
  * 0.461.0 since probe auto mode (#4543): `session control` and `install --session-control`, the pages' "Who
152
152
  * turns Probe on or off in each chat?"; 0.460.0 was cut before #4543 merged.
153
+ * 0.475.0 since fixes-1108b: `import review --chats-limit` (#4613; past-work.md's "just a few first"), settings
154
+ * read back with `incomplete_settings` and the install's `stage` (#4612, 0.474.0), the W&B login check (#4610).
153
155
  */
154
- const AGENT_MIN_CLI = "0.461.0";
156
+ const AGENT_MIN_CLI = "0.475.0";
155
157
  /** `install` flags only AGENT_MIN_CLI knows (D36). */
156
158
  const AGENT_INSTALL_FLAGS = Object.freeze(["--recommended", "--who-records", "--session-default", "--session-control",
157
159
  "--profile", "--attempt"]);
@@ -913,8 +915,28 @@ async function waitForRunningDownload(startedMs, step, watch = null) {
913
915
  const isRunning = record && record.state === download.DownloadState.RUNNING;
914
916
  await updateWatch(watch, step, isRunning ? record.stage || download.DownloadStage.DOWNLOADING : null);
915
917
  if (!isRunning) return record;
916
- if (Date.now() >= until) await refuseUnfinished(step, watch, record.stage || download.DownloadStage.DOWNLOADING);
918
+ // Not approved yet: the approval is read on to the budget's end, the download with it (fixes-1108b).
919
+ if (Date.now() >= (watch && watch.isPending() ? getWatchEndMs(startedMs) : until)) {
920
+ await refuseUnfinished(step, watch, record.stage || download.DownloadStage.DOWNLOADING);
921
+ }
922
+ await sleep(DOWNLOAD_POLL_MS);
923
+ }
924
+ }
925
+
926
+ /** When a call still waiting for the approval stops reading it: its last read and its answer inside the budget. */
927
+ function getWatchEndMs(startedMs) {
928
+ return startedMs + agentRun.AGENT_BUDGET_MS - agentRun.CLI_MARGIN_MS - signIn.APPROVAL_TIMEOUT_MS;
929
+ }
930
+
931
+ /**
932
+ * Not approved yet, with no time left to hand the CLI anything: the approval is read here until the budget's end,
933
+ * so a call waits for it the whole budget and never answers `waiting_for_approval` early (fixes-1108b). An approval
934
+ * that comes meanwhile while Probe still installs is answered at once, as PR39b's.
935
+ */
936
+ async function watchUntilBudgetEnd(watch, startedMs, step, stage) {
937
+ while (watch && watch.isPending() && Date.now() + DOWNLOAD_POLL_MS < getWatchEndMs(startedMs)) {
917
938
  await sleep(DOWNLOAD_POLL_MS);
939
+ await updateWatch(watch, step, stage);
918
940
  }
919
941
  }
920
942
 
@@ -1042,10 +1064,19 @@ async function waitForSignIn(json, startedMs) {
1042
1064
  AgentStep.SIGN_IN_WAIT, watch);
1043
1065
  }
1044
1066
 
1045
- /** Probe installed during the wait (PR39): approved, say so, and hand the CLI the save only with time for it. */
1067
+ /** Probe installed during the wait (PR39): approved, say so, and hand the CLI the save only with time for it. Too
1068
+ * little left and not approved yet: the approval is waited for here (fixes-1108b), never handed to a CLI that would
1069
+ * answer `waiting_for_approval` the moment it started. */
1046
1070
  async function sayInstalled(watch, startedMs) {
1047
1071
  await updateWatch(watch, AgentStep.SIGN_IN_WAIT, approval.InstallStage.DONE);
1048
- if (!watch.isApproved() || startedMs + agentRun.AGENT_BUDGET_MS - Date.now() >= APPROVED_RESERVE_MS) return;
1072
+ if (startedMs + agentRun.AGENT_BUDGET_MS - Date.now() >= APPROVED_RESERVE_MS) return;
1073
+ await watchUntilBudgetEnd(watch, startedMs, AgentStep.SIGN_IN_WAIT, approval.InstallStage.DONE);
1074
+ if (watch.isPending()) {
1075
+ await refuseAgent(AgentStep.SIGN_IN_WAIT, agentRun.Reason.WAITING_FOR_APPROVAL,
1076
+ "Waiting for the browser approval: run this again.", agentRun.EXIT_AGAIN,
1077
+ watch.getRunAgainFacts(approval.InstallStage.DONE));
1078
+ }
1079
+ if (!watch.isApproved()) return;
1049
1080
  watch.markSaid(approval.InstallStage.DONE);
1050
1081
  await refuseAgent(AgentStep.SIGN_IN_WAIT, agentRun.Reason.RUN_AGAIN,
1051
1082
  "Probe is installed, with too little time left to save the sign-in: run the same command again.",
@@ -1068,6 +1099,7 @@ async function getAgentProbe(startedMs, step, watch = null) {
1068
1099
  if (!probe && done && done.state === download.DownloadState.DONE) {
1069
1100
  // Installed, but its `probe` did not answer yet: the Probe service it just started restarts
1070
1101
  // once for its first update, and `probe --version` goes through it (PR3b dry run, 1 in 4).
1102
+ await watchUntilBudgetEnd(watch, startedMs, step, approval.InstallStage.STARTING);
1071
1103
  await refuseUnfinished(step, watch, approval.InstallStage.STARTING,
1072
1104
  "Probe is finishing its install: run the same command again.");
1073
1105
  }
package/lib/sign-in.js CHANGED
@@ -359,6 +359,7 @@ async function fetchApproval(pending, { fetchImpl = fetch, timeoutMs = APPROVAL_
359
359
 
360
360
  module.exports = {
361
361
  AGENT_CLIENT_CONTEXT,
362
+ APPROVAL_TIMEOUT_MS,
362
363
  AGENT_MARKERS,
363
364
  AGENT_GRANTS,
364
365
  ACCOUNT_NAME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "probe-research",
3
- "version": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "description": "Setup wizard for Probe Research in your coding agents. Runs from zero with npx.",
5
5
  "bin": {
6
6
  "probe-research": "bin/probe-research.js"
package/upkeep.json CHANGED
@@ -41,6 +41,7 @@
41
41
  "--chats-agent": 1,
42
42
  "--chats-all": 0,
43
43
  "--chats-folder": 1,
44
+ "--chats-limit": 1,
44
45
  "--chats-since": 1,
45
46
  "--folder": 1,
46
47
  "--json": 0,