@primitive.ai/prim 0.1.0-alpha.37 → 0.1.0-alpha.40
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/daemon/server.js +5 -1
- package/dist/index.js +22 -8
- package/package.json +1 -1
package/dist/daemon/server.js
CHANGED
|
@@ -47,6 +47,7 @@ var activeSessionId = process.env.PRIM_DAEMON_SESSION_ID ?? `daemon-${process.pi
|
|
|
47
47
|
var lastHeartbeatAt;
|
|
48
48
|
var lastOnlineCount;
|
|
49
49
|
var lastOnlineNames;
|
|
50
|
+
var lastOnlineTeammates;
|
|
50
51
|
var lastOkAtLocal;
|
|
51
52
|
var heartbeatTimer;
|
|
52
53
|
var tokenCheckTimer;
|
|
@@ -92,6 +93,7 @@ async function sendHeartbeat() {
|
|
|
92
93
|
}
|
|
93
94
|
lastOnlineCount = typeof result.onlineCount === "number" ? result.onlineCount : void 0;
|
|
94
95
|
lastOnlineNames = Array.isArray(result.onlineNames) ? result.onlineNames : void 0;
|
|
96
|
+
lastOnlineTeammates = Array.isArray(result.onlineTeammates) ? result.onlineTeammates : void 0;
|
|
95
97
|
}
|
|
96
98
|
} catch (err) {
|
|
97
99
|
process.stderr.write(
|
|
@@ -148,6 +150,7 @@ function handleStatusSnapshot(params) {
|
|
|
148
150
|
...base,
|
|
149
151
|
onlineCount: void 0,
|
|
150
152
|
onlineNames: void 0,
|
|
153
|
+
onlineTeammates: void 0,
|
|
151
154
|
presenceStale: false,
|
|
152
155
|
envMismatch: true
|
|
153
156
|
};
|
|
@@ -156,10 +159,11 @@ function handleStatusSnapshot(params) {
|
|
|
156
159
|
const presenceStale = lastOkAtLocal !== void 0 && !presenceFresh;
|
|
157
160
|
return {
|
|
158
161
|
...base,
|
|
159
|
-
// Withhold a frozen count/names once they're no longer fresh; the
|
|
162
|
+
// Withhold a frozen count/names/teammates once they're no longer fresh; the
|
|
160
163
|
// statusline shows "presence: stale" rather than a confident, wrong list.
|
|
161
164
|
onlineCount: presenceFresh ? lastOnlineCount : void 0,
|
|
162
165
|
onlineNames: presenceFresh ? lastOnlineNames : void 0,
|
|
166
|
+
onlineTeammates: presenceFresh ? lastOnlineTeammates : void 0,
|
|
163
167
|
presenceStale
|
|
164
168
|
};
|
|
165
169
|
}
|
package/dist/index.js
CHANGED
|
@@ -1056,17 +1056,29 @@ import { homedir as homedir3 } from "os";
|
|
|
1056
1056
|
import { join as join3 } from "path";
|
|
1057
1057
|
|
|
1058
1058
|
// src/lib/presence.ts
|
|
1059
|
-
function
|
|
1060
|
-
if (
|
|
1059
|
+
function formatLabeled(labels, cap) {
|
|
1060
|
+
if (labels === void 0) {
|
|
1061
1061
|
return "\u2014";
|
|
1062
1062
|
}
|
|
1063
|
-
if (
|
|
1063
|
+
if (labels.length === 0) {
|
|
1064
1064
|
return "just you";
|
|
1065
1065
|
}
|
|
1066
|
-
if (
|
|
1067
|
-
return
|
|
1066
|
+
if (labels.length <= cap) {
|
|
1067
|
+
return labels.join(", ");
|
|
1068
1068
|
}
|
|
1069
|
-
return `${
|
|
1069
|
+
return `${labels.slice(0, cap).join(", ")} +${String(labels.length - cap)}`;
|
|
1070
|
+
}
|
|
1071
|
+
function formatTeammates(names, cap) {
|
|
1072
|
+
return formatLabeled(names, cap);
|
|
1073
|
+
}
|
|
1074
|
+
function formatTeammatesWithArea(teammates, cap) {
|
|
1075
|
+
return formatLabeled(
|
|
1076
|
+
teammates?.map((t) => {
|
|
1077
|
+
const area = t.area?.trim();
|
|
1078
|
+
return area ? `${t.name} - ${area}` : t.name;
|
|
1079
|
+
}),
|
|
1080
|
+
cap
|
|
1081
|
+
);
|
|
1070
1082
|
}
|
|
1071
1083
|
|
|
1072
1084
|
// src/commands/daemon.ts
|
|
@@ -1622,7 +1634,7 @@ function formatRecentHuman(result) {
|
|
|
1622
1634
|
}
|
|
1623
1635
|
if (result.author !== void 0 && result.decisions.length === 0) {
|
|
1624
1636
|
if (result.authorHasDecisions === true) {
|
|
1625
|
-
return `[prim] recent \xB7 ${result.author.name} \xB7 0 decisions in this window (older decisions exist \u2014 widen --since
|
|
1637
|
+
return `[prim] recent \xB7 ${result.author.name} \xB7 0 decisions in this window (older decisions exist \u2014 widen --since)`;
|
|
1626
1638
|
}
|
|
1627
1639
|
if (result.authorHasDecisions === false) {
|
|
1628
1640
|
return `[prim] recent \xB7 ${result.author.name} \xB7 no feed-visible decisions yet (if unexpected, check prim setup/doctor on their machine and the repo they work in)`;
|
|
@@ -3811,7 +3823,9 @@ async function renderStatusline() {
|
|
|
3811
3823
|
return `primitive ${version} (daemon: live \xB7 presence: stale)`;
|
|
3812
3824
|
}
|
|
3813
3825
|
let team;
|
|
3814
|
-
if (snapshot.
|
|
3826
|
+
if (snapshot.onlineTeammates !== void 0) {
|
|
3827
|
+
team = `team: ${formatTeammatesWithArea(snapshot.onlineTeammates, STATUSLINE_NAME_CAP)}`;
|
|
3828
|
+
} else if (snapshot.onlineNames !== void 0) {
|
|
3815
3829
|
team = `team: ${formatTeammates(snapshot.onlineNames, STATUSLINE_NAME_CAP)}`;
|
|
3816
3830
|
} else if (typeof snapshot.onlineCount === "number") {
|
|
3817
3831
|
team = `team: ${String(snapshot.onlineCount)} online`;
|
package/package.json
CHANGED