@telepath-computer/television 0.1.105 → 0.1.106

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/cli.cjs CHANGED
@@ -35086,9 +35086,7 @@ function getTelevisionStoragePath() {
35086
35086
  function resolveACPAgentProfile(env = process.env) {
35087
35087
  const rawAgent = env[TELEVISION_ACP_AGENT_ENV];
35088
35088
  if (rawAgent === void 0) {
35089
- throw new Error(
35090
- 'TELEVISION_ACP_AGENT is required for server startup. Set it to "openclaw" or "hermes".'
35091
- );
35089
+ return null;
35092
35090
  }
35093
35091
  const agent = rawAgent.trim().toLowerCase();
35094
35092
  if (agent === "openclaw" || agent === "hermes") {
@@ -35099,11 +35097,14 @@ function resolveACPAgentProfile(env = process.env) {
35099
35097
  );
35100
35098
  }
35101
35099
  function buildPersistedACPEnvironment(env) {
35102
- const profile = resolveACPAgentProfile(env);
35103
35100
  const pathValue = env.PATH;
35104
35101
  if (pathValue === void 0) {
35105
35102
  throw new Error("PATH is required to build the persisted ACP environment.");
35106
35103
  }
35104
+ const profile = resolveACPAgentProfile(env);
35105
+ if (!profile) {
35106
+ return { PATH: pathValue };
35107
+ }
35107
35108
  const snapshot = {
35108
35109
  PATH: pathValue,
35109
35110
  [TELEVISION_ACP_AGENT_ENV]: profile.agent
@@ -49555,7 +49556,7 @@ function registerRoutes(app, store, options) {
49555
49556
  sendError(res, HTTP_FORBIDDEN, "Only the primary content file is HTTP-writable");
49556
49557
  });
49557
49558
  app.get("/display", ...auth, (_req, res) => {
49558
- res.json(store.getDisplayState());
49559
+ res.json({ ...store.getDisplayState(), acpEnabled: options.acpEnabled });
49559
49560
  });
49560
49561
  app.patch("/display", ...auth, (req, res) => {
49561
49562
  const parsed = patchDisplaySchema.safeParse(req.body);
@@ -49851,7 +49852,7 @@ var ACPBridge = class extends withDisposable(class {
49851
49852
  constructor(options) {
49852
49853
  super();
49853
49854
  this.send = options.send;
49854
- this.profile = options.profile ?? resolveACPAgentProfile();
49855
+ this.profile = options.profile;
49855
49856
  this.launchProcess = options.launchProcess ?? launchACPProcess;
49856
49857
  this.sessionCwd = import_node_path6.default.resolve(process.cwd());
49857
49858
  }
@@ -49997,6 +49998,9 @@ var ACPServer = class extends withDisposable(class {
49997
49998
  profile;
49998
49999
  constructor(options) {
49999
50000
  super();
50001
+ if (!options.profile) {
50002
+ throw new Error("ACPServer requires an ACP agent profile.");
50003
+ }
50000
50004
  this.authToken = options.authToken;
50001
50005
  this.publicServer = options.publicServer;
50002
50006
  this.profile = options.profile;
@@ -50160,8 +50164,14 @@ var Server = class {
50160
50164
  });
50161
50165
  this.app.use(import_express2.default.json());
50162
50166
  this.events = new EventStreamServer({ store: this.store, publicServer: this.publicServer });
50167
+ this.acp = options.acpProfile ? new ACPServer({
50168
+ authToken: this.store.authToken,
50169
+ publicServer: this.publicServer,
50170
+ profile: options.acpProfile
50171
+ }) : null;
50163
50172
  registerRoutes(this.app, this.store, {
50164
- requireAuth: this.publicServer ? null : this.requireAuthorization
50173
+ requireAuth: this.publicServer ? null : this.requireAuthorization,
50174
+ acpEnabled: this.acp !== null
50165
50175
  });
50166
50176
  if (options.canonicalDir) {
50167
50177
  this.app.get(
@@ -50176,11 +50186,6 @@ var Server = class {
50176
50186
  if (options.staticDir) {
50177
50187
  this.app.use(import_express2.default.static(options.staticDir));
50178
50188
  }
50179
- this.acp = new ACPServer({
50180
- authToken: this.store.authToken,
50181
- publicServer: this.publicServer,
50182
- profile: options.acpProfile
50183
- });
50184
50189
  this.httpServer.on("upgrade", (request, socket, head) => {
50185
50190
  const parsed = new URL(request.url ?? "/", this.baseURL);
50186
50191
  const duplex = socket;
@@ -50188,7 +50193,7 @@ var Server = class {
50188
50193
  this.events.handleUpgrade(request, duplex, head);
50189
50194
  return;
50190
50195
  }
50191
- if (parsed.pathname === "/acp") {
50196
+ if (parsed.pathname === "/acp" && this.acp) {
50192
50197
  this.acp.handleUpgrade(request, duplex, head);
50193
50198
  return;
50194
50199
  }
@@ -50220,13 +50225,17 @@ var Server = class {
50220
50225
  return this.store.authToken;
50221
50226
  }
50222
50227
  getACPBridgePID() {
50223
- return this.acp.getChildPIDs()[0] ?? null;
50228
+ return this.acp?.getChildPIDs()[0] ?? null;
50224
50229
  }
50225
50230
  getACPBridgePIDs() {
50226
- return this.acp.getChildPIDs();
50231
+ return this.acp?.getChildPIDs() ?? [];
50227
50232
  }
50228
50233
  async dispose() {
50229
- await Promise.all([this.events.dispose(), this.acp.dispose(), Promise.resolve(this.store.dispose())]);
50234
+ await Promise.all([
50235
+ this.events.dispose(),
50236
+ this.acp?.dispose() ?? Promise.resolve(),
50237
+ Promise.resolve(this.store.dispose())
50238
+ ]);
50230
50239
  await new Promise((resolve, reject) => {
50231
50240
  this.httpServer.closeAllConnections?.();
50232
50241
  this.httpServer.closeIdleConnections?.();
@@ -51434,8 +51443,8 @@ function resolveVercelSkillsInstallerBin() {
51434
51443
  return localRequire.resolve("skills/bin/cli.mjs");
51435
51444
  }
51436
51445
  function readCLIVersion() {
51437
- if ("0.1.105".length > 0) {
51438
- return "0.1.105";
51446
+ if ("0.1.106".length > 0) {
51447
+ return "0.1.106";
51439
51448
  }
51440
51449
  const devPackageJsonPath = import_node_path10.default.join(getDevPackageDir(), "package.json");
51441
51450
  if (!(0, import_node_fs7.existsSync)(devPackageJsonPath)) {
@@ -51776,7 +51785,7 @@ function createProgram(env, argv = []) {
51776
51785
  const storagePath = opts.storagePath ?? getTelevisionStoragePath();
51777
51786
  const profile2 = resolveACPAgentProfile(process.env);
51778
51787
  const daemonEnv = buildPersistedACPEnvironment(process.env);
51779
- if (!isACPCommandResolvable(profile2.command, daemonEnv)) {
51788
+ if (profile2 && !isACPCommandResolvable(profile2.command, daemonEnv)) {
51780
51789
  throw createDirectiveError(
51781
51790
  `Could not find ACP agent command \`${profile2.command}\` for \`TELEVISION_ACP_AGENT=${profile2.agent}\` on the persisted PATH. Set TELEVISION_ACP_AGENT to \`openclaw\` or \`hermes\`, and ensure the selected agent binary is available on PATH before running \`tv serve --persist\`.`
51782
51791
  );
@@ -51804,7 +51813,7 @@ function createProgram(env, argv = []) {
51804
51813
  return;
51805
51814
  }
51806
51815
  const profile = resolveACPAgentProfile(process.env);
51807
- if (!isACPCommandResolvable(profile.command, process.env)) {
51816
+ if (profile && !isACPCommandResolvable(profile.command, process.env)) {
51808
51817
  throw createDirectiveError(
51809
51818
  `Could not find ACP agent command \`${profile.command}\` for \`TELEVISION_ACP_AGENT=${profile.agent}\` on PATH. Set TELEVISION_ACP_AGENT to \`openclaw\` or \`hermes\`, and ensure the selected agent binary is available on PATH before running \`tv serve\`.`
51810
51819
  );
@@ -51817,7 +51826,7 @@ function createProgram(env, argv = []) {
51817
51826
  canonicalDir: env.resolveCanonicalDir(),
51818
51827
  bundledViewsPath: env.resolveBundledViewsPath(),
51819
51828
  public: opts.public,
51820
- acpProfile: profile
51829
+ ...profile ? { acpProfile: profile } : {}
51821
51830
  });
51822
51831
  await server.start();
51823
51832
  writeJSON(env.stdout, opts.public ? { serverURL: server.getBaseURL() } : { serverURL: server.getBaseURL(), token: server.getAuthToken() });
@@ -129,9 +129,9 @@ When the CLI rejects a command, follow the directive it prints rather than guess
129
129
 
130
130
  ### Server operation notes
131
131
 
132
- `tv serve` starts the local server and requires `TELEVISION_ACP_AGENT=openclaw` or `TELEVISION_ACP_AGENT=hermes`. It preflights the selected ACP command on `PATH` and fails before listening if the binary is missing.
132
+ `tv serve` starts the local server. ACP chat is optional: with no `TELEVISION_ACP_AGENT`, the server starts without ACP wiring, `/acp` is unavailable, and the web UI hides chat. Set `TELEVISION_ACP_AGENT=openclaw` or `TELEVISION_ACP_AGENT=hermes` to enable chat; in that case `tv serve` preflights the selected ACP command on `PATH` and fails before listening if the binary is missing.
133
133
 
134
- `tv serve --persist` installs or refreshes the user system service. It captures the ACP-relevant shell environment into the service definition: exact `PATH`, canonical `TELEVISION_ACP_AGENT`, and matching `OPENCLAW_*` or `HERMES_*` variables. It validates the ACP command against that captured PATH before changing the installed service; rerun it after changing PATH, ACP agent env vars, the ACP agent install, or the Node/TV install. The refresh is non-atomic: if uninstall succeeds but install fails, fix the env and rerun `tv serve --persist`.
134
+ `tv serve --persist` installs or refreshes the user system service. It always captures the exact `PATH`. When an ACP agent is configured, it also captures canonical `TELEVISION_ACP_AGENT` and matching `OPENCLAW_*` or `HERMES_*` variables, and validates the ACP command against that captured PATH before changing the installed service. When no agent is configured, ACP env capture and preflight are skipped and the service runs with chat disabled. Rerun it after changing PATH, ACP agent env vars, the ACP agent install, or the Node/TV install. The refresh is non-atomic: if uninstall succeeds but install fails, fix the env and rerun `tv serve --persist`.
135
135
 
136
136
  `tv serve --persist-uninstall` removes the service and is equivalent to `tv stop`. Both are idempotent and print `{ "status": "stopped" }` whether or not a service was installed.
137
137