@evandu/super-pi 0.1.242 → 0.1.244

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.
@@ -69,29 +69,3 @@ export function claimUpdateSlot() {
69
69
  export function releaseUpdateSlot() {
70
70
  updateInFlight = false;
71
71
  }
72
- /**
73
- * Whether an update is running RIGHT NOW.
74
- *
75
- * The client used to keep its buttons disabled only for as long as its own request was in
76
- * flight, which ended the moment the server answered 202 - while npm was still installing.
77
- * The server knew the whole time (it holds the slot above), so it says so out loud and the
78
- * client asks.
79
- */
80
- export function isUpdateInFlight() {
81
- return updateInFlight;
82
- }
83
- /**
84
- * WHAT THE LAST UPDATE ACTUALLY DID.
85
- *
86
- * The outcome of the most recent update, so the client can tell the user what actually
87
- * happened instead of showing a spinner forever.
88
- */
89
- let lastUpdate;
90
- /** Records the outcome of an update attempt. */
91
- export function recordUpdateOutcome(ok, code) {
92
- lastUpdate = { ok, code, at: new Date().toISOString() };
93
- }
94
- /** The most recent update outcome, or undefined when no update has run in this process. */
95
- export function getLastUpdateOutcome() {
96
- return lastUpdate;
97
- }
@@ -14,6 +14,36 @@ export type GroupMember = {
14
14
  description: string;
15
15
  };
16
16
  export type GroupStatus = "queued" | "running" | "completed" | "failed" | "cancelled" | "interrupted";
17
+ export type GroupExecutionActivity = {
18
+ kind: "thinking";
19
+ } | {
20
+ kind: "tool";
21
+ name: string;
22
+ detail?: string;
23
+ };
24
+ type GroupExecutionStepBase = {
25
+ id: string;
26
+ startedAt: string;
27
+ status: "running" | "completed" | "failed" | "interrupted";
28
+ };
29
+ export type GroupExecutionStep = GroupExecutionStepBase & ({
30
+ kind: "thinking";
31
+ text: string;
32
+ } | {
33
+ kind: "tool";
34
+ name: string;
35
+ detail?: string;
36
+ lastUpdateAt?: string;
37
+ durationMs?: number;
38
+ });
39
+ export type GroupExecutionTrace = {
40
+ steps: GroupExecutionStep[];
41
+ truncated?: true;
42
+ };
43
+ export type GroupExecutionSnapshot = GroupExecutionTrace & {
44
+ status: GroupStatus;
45
+ revision: string;
46
+ };
17
47
  type GroupPost = {
18
48
  id: string;
19
49
  content: string;
@@ -42,15 +72,34 @@ export type GroupReply = GroupPost & {
42
72
  assignment?: string;
43
73
  routeReason?: string;
44
74
  background?: boolean;
75
+ settledAt?: string;
76
+ executionActivity?: GroupExecutionActivity;
77
+ handoff?: {
78
+ memberId: string;
79
+ assignment: string;
80
+ };
45
81
  };
46
82
  export type GroupMessage = GroupUserPost | GroupReply;
47
- export type GroupSummary = {
83
+ export type GroupActivity = {
84
+ status: "idle" | "running" | "awaiting_background" | "completed" | "failed";
85
+ revision: number;
86
+ };
87
+ export type GroupActivityUpdate = {
88
+ id: string;
89
+ workspaceId: string;
90
+ activity: GroupActivity;
91
+ };
92
+ type GroupIdentity = {
48
93
  id: string;
49
94
  workspaceId: string;
50
95
  title: string;
51
96
  updatedAt: string;
97
+ archivedAt?: string;
98
+ };
99
+ export type GroupSummary = GroupIdentity & {
100
+ activity: GroupActivity;
52
101
  };
53
- export type GroupRoom = GroupSummary & {
102
+ export type GroupRoom = GroupIdentity & {
54
103
  members: GroupMember[];
55
104
  moderator: GroupModerator;
56
105
  revision: number;
@@ -58,5 +107,6 @@ export type GroupRoom = GroupSummary & {
58
107
  };
59
108
  export type GroupSnapshot = Omit<GroupRoom, "revision"> & {
60
109
  revision: string;
110
+ activity: GroupActivity;
61
111
  };
62
112
  export {};
@@ -0,0 +1,28 @@
1
+ export type UpdateVersions = {
2
+ runningVersion: string;
3
+ diskVersion: string;
4
+ needsRestart: boolean;
5
+ };
6
+ export type UpdatePhase = "installing" | "restarting" | "completed" | "failed";
7
+ export type UpdateOperation = {
8
+ id: string;
9
+ action: "update" | "restart";
10
+ phase: UpdatePhase;
11
+ fromVersion: string;
12
+ targetVersion?: string;
13
+ startedAt: string;
14
+ changedAt: string;
15
+ failure?: {
16
+ step: "installing" | "restarting";
17
+ message: string;
18
+ code?: number;
19
+ };
20
+ };
21
+ export type UpdateStatus = UpdateVersions & {
22
+ operation: UpdateOperation | null;
23
+ };
24
+ export type UpdateCheck = UpdateStatus & {
25
+ latestVersion?: string;
26
+ updateAvailable: boolean;
27
+ };
28
+ export declare const updateIsActive: (operation?: UpdateOperation | null) => boolean;
@@ -0,0 +1 @@
1
+ export const updateIsActive = (operation) => operation?.phase === "installing" || operation?.phase === "restarting";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evandu/super-pi",
3
- "version": "0.1.242",
3
+ "version": "0.1.244",
4
4
  "description": "Web control plane and companion for Pi",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -91,6 +91,14 @@ child.unref();
91
91
  // the new server is LEFT RUNNING: a start that is merely slow will still come up, and a process
92
92
  // that is stuck is worth more than no process at all.
93
93
  const READINESS_BUDGET_MS = 120000;
94
- for (let elapsed = 0; elapsed < READINESS_BUDGET_MS; elapsed += 200) { try { const response = await fetch(`http://127.0.0.1:${port}/api/health`); const body = await response.json(); if (response.ok && body.status === "ok" && body.service === "super-pi") { console.log("Server ready: /api/health passed."); process.exit(0); } } catch {} await waitMs(200); }
94
+ const deadline = Date.now() + READINESS_BUDGET_MS;
95
+ while (Date.now() < deadline) {
96
+ try {
97
+ const response = await fetch(`http://127.0.0.1:${port}/api/health`, { signal: AbortSignal.timeout(2_000) });
98
+ const body = await response.json();
99
+ if (response.ok && body.status === "ok" && body.service === "super-pi") { console.log("Server ready: /api/health passed."); process.exit(0); }
100
+ } catch { /* The replacement is still starting. */ }
101
+ await waitMs(200);
102
+ }
95
103
  console.error(`Server did not become reachable within ${READINESS_BUDGET_MS}ms. It is STILL RUNNING - do not kill it, a slow start still ends up serving. See ${logPath}:`); try { console.error(readFileSync(logPath, "utf8").slice(-8000)); } catch {}
96
104
  process.exit(1);