@prohost/cli 0.16.5 → 0.16.7

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,16 +69,32 @@ export function hostStatsBody(stats) {
69
69
  battery_pct: stats?.batteryPct ?? null,
70
70
  };
71
71
  }
72
+ function clip(value, max) {
73
+ if (value === null || value === undefined)
74
+ return null;
75
+ // By code point, as the server counts (`len()` of a Python str): never half a surrogate pair,
76
+ // which it would refuse as invalid Unicode.
77
+ const points = Array.from(value);
78
+ return points.length > max ? points.slice(0, max).join('') : value;
79
+ }
72
80
  /** A login as the status body names it: no email, no directory. */
73
81
  export function loginBody(login, conversations) {
74
82
  return {
75
83
  account_key: login.account_key,
76
- label: login.label,
77
- runtime: login.runtime,
78
- subscription_type: login.subscription_type,
79
- plan_label: login.plan_label,
84
+ label: clip(login.label, 120) || 'login',
85
+ runtime: clip(login.runtime, 40),
86
+ subscription_type: clip(login.subscription_type, 40),
87
+ plan_label: clip(login.plan_label, 80),
80
88
  auth_state: login.auth_state,
81
- quota_windows: login.quota_windows.map((w) => ({ ...w })),
89
+ quota_windows: login.quota_windows
90
+ .filter((w) => typeof w.kind === 'string' && w.kind.length > 0)
91
+ .slice(0, 16)
92
+ .map((w) => ({
93
+ kind: clip(w.kind, 40),
94
+ used_percent: Math.min(100, Math.max(0, w.used_percent)),
95
+ resets_at: w.resets_at,
96
+ ...(w.model_label ? { model_label: clip(w.model_label, 40) } : {}),
97
+ })),
82
98
  conversations,
83
99
  };
84
100
  }
@@ -89,11 +105,13 @@ export function buildStatusBody(inputs) {
89
105
  slots: { ...inputs.slots },
90
106
  logins: inputs.logins.map((login) => loginBody(login, inputs.conversationsPerLogin.get(login.account_key) ?? 0)),
91
107
  running: inputs.running.map((entry) => ({
92
- run_id: entry.run_id,
108
+ run_id: clip(entry.run_id, 128),
93
109
  agent_id: entry.agent_id,
94
- conversation_key: entry.conversation_key ?? null,
110
+ ...(entry.runtime ? { runtime: clip(entry.runtime, 40) } : {}),
111
+ conversation_key: clip(entry.conversation_key, 256),
95
112
  kind: entry.kind,
96
- started_at: entry.started_at,
113
+ // Never '' (the server reads it as a date): a time, or null.
114
+ started_at: entry.started_at || null,
97
115
  peak_mem_mb: entry.peak_mem_mb ?? null,
98
116
  ...(entry.started_by_user_id ? { started_by_user_id: entry.started_by_user_id } : {}),
99
117
  })),
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.5";
10
+ export declare const CLI_VERSION = "0.16.7";
11
11
  /** Sent on every HTTP request the CLI makes back into ProhostAI. */
12
- export declare const USER_AGENT = "prohost-cli/0.16.5";
12
+ export declare const USER_AGENT = "prohost-cli/0.16.7";
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.5';
10
+ export const CLI_VERSION = '0.16.7';
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.5",
3
+ "version": "0.16.7",
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",