@prohost/cli 0.16.10 → 0.16.11

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/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ builds via `prepack`, runs the suite, publishes, and tags `cli-v<version>`.
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 0.16.11
10
+
11
+ - **An end that can't check what is left of a terminal is retried, never said done.** When a retry
12
+ of `code_thread.end_requested` (after a kill whose tmux answer was lost) couldn't ask `ps` which
13
+ saved panes still belong to the terminal, it reported the end done with nothing reaped, so a
14
+ process group that outlived its window could keep running. Now what was just closed is reaped,
15
+ the saved panes stay in the unfinished `.ended` mark, and the end is asked for again until `ps`
16
+ answers.
17
+
9
18
  ## 0.16.10
10
19
 
11
20
  - **A Code thread's terminal can be ended from ProhostAI.** `code_thread.end_requested` closes the
@@ -544,8 +544,8 @@ export declare class CodeTerminals {
544
544
  * Of panes an earlier attempt saved, those whose process group is still this terminal's. A group
545
545
  * outlives its leader, and a pid is never handed out while a group of that id exists: so one whose
546
546
  * leader pid runs no process now is ours if anything is left in it. One whose pid runs a process is
547
- * ours only if that process started when the saved one did; one with no saved start, or when `ps`
548
- * can't say, is left alone.
547
+ * ours only if that process started when the saved one did; one with no saved start is left alone.
548
+ * `undefined` when `ps` couldn't say: nothing is judged, and the caller keeps them for a retry.
549
549
  */
550
550
  private stillOurs;
551
551
  restart(request: RestartRequest, outcome?: RestartOutcome, hooks?: RestartHooks): Promise<boolean>;
@@ -856,7 +856,22 @@ export class CodeTerminals {
856
856
  this.records.delete(request.terminalId);
857
857
  this.panePids.delete(request.terminalId);
858
858
  this.lastInterrupt.delete(request.terminalId);
859
- await this.reapGroups(fresh.map((entry) => entry.pid), await this.stillOurs(saved));
859
+ const ours = await this.stillOurs(saved);
860
+ if (ours === undefined) {
861
+ // `ps` couldn't say which saved panes are still this terminal's: what was just closed is reaped,
862
+ // the rest stays saved in the unfinished mark, and the end is asked for again rather than said done.
863
+ await this.reapGroups(fresh.map((entry) => entry.pid));
864
+ try {
865
+ this.markEnded(request, saved, false);
866
+ }
867
+ catch {
868
+ /* the earlier mark still holds them */
869
+ }
870
+ this.log(` ! code thread ${short}: couldn't check what is left of its terminal; retrying`);
871
+ outcome.retry = true;
872
+ return false;
873
+ }
874
+ await this.reapGroups(fresh.map((entry) => entry.pid), ours);
860
875
  try {
861
876
  // Finished and reaped: nothing left for a retry to signal, and a late redelivery is answered ended.
862
877
  this.markEnded(request, [], true);
@@ -899,8 +914,8 @@ export class CodeTerminals {
899
914
  * Of panes an earlier attempt saved, those whose process group is still this terminal's. A group
900
915
  * outlives its leader, and a pid is never handed out while a group of that id exists: so one whose
901
916
  * leader pid runs no process now is ours if anything is left in it. One whose pid runs a process is
902
- * ours only if that process started when the saved one did; one with no saved start, or when `ps`
903
- * can't say, is left alone.
917
+ * ours only if that process started when the saved one did; one with no saved start is left alone.
918
+ * `undefined` when `ps` couldn't say: nothing is judged, and the caller keeps them for a retry.
904
919
  */
905
920
  async stillOurs(saved) {
906
921
  if (saved.length === 0)
@@ -910,7 +925,7 @@ export class CodeTerminals {
910
925
  starts = await (this.options.paneStarts ?? paneStarts)(saved.map((entry) => entry.pid));
911
926
  }
912
927
  catch {
913
- return [];
928
+ return undefined;
914
929
  }
915
930
  return saved
916
931
  .filter((entry) => {
package/dist/version.d.ts CHANGED
@@ -7,6 +7,6 @@
7
7
  * `package.json`, so a release bump that forgets this file fails the suite
8
8
  * instead of shipping a `User-Agent` that lies about which build is calling.
9
9
  */
10
- export declare const CLI_VERSION = "0.16.10";
10
+ export declare const CLI_VERSION = "0.16.11";
11
11
  /** Sent on every HTTP request the CLI makes back into ProhostAI. */
12
- export declare const USER_AGENT = "prohost-cli/0.16.10";
12
+ export declare const USER_AGENT = "prohost-cli/0.16.11";
package/dist/version.js CHANGED
@@ -7,6 +7,6 @@
7
7
  * `package.json`, so a release bump that forgets this file fails the suite
8
8
  * instead of shipping a `User-Agent` that lies about which build is calling.
9
9
  */
10
- export const CLI_VERSION = '0.16.10';
10
+ export const CLI_VERSION = '0.16.11';
11
11
  /** Sent on every HTTP request the CLI makes back into ProhostAI. */
12
12
  export const USER_AGENT = `prohost-cli/${CLI_VERSION}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prohost/cli",
3
- "version": "0.16.10",
3
+ "version": "0.16.11",
4
4
  "description": "Run your own AI agent as a ProhostAI teammate, and stream your account's webhooks to your laptop.",
5
5
  "type": "module",
6
6
  "license": "MIT",