@phren/cli 0.3.43 → 0.3.44

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.
@@ -1,10 +1,12 @@
1
1
  import * as fs from "node:fs";
2
2
  import { request } from "node:http";
3
3
  import path from "node:path";
4
- import { SCHEDULE_EVERY, SCHEDULE_HARNESSES, SCHEDULE_SESSIONS, WEEKDAYS, canonicalComputer, newScheduleId, parseSchedule, readScheduleDocument, writeScheduleDocument, } from "../bridge/schedules.js";
4
+ import { SCHEDULE_EVERY, SCHEDULE_HARNESSES, SCHEDULE_SESSIONS, WEEKDAYS, computerMatches, canonicalComputer, newScheduleId, parseSchedule, readScheduleDocument, writeScheduleDocument, } from "../bridge/schedules.js";
5
5
  import { object, socketPath } from "../bridge/protocol.js";
6
6
  import { listMachines } from "../profile-store.js";
7
7
  import { getProjectDirs } from "../shared.js";
8
+ import { scheduleProblems } from "../bridge/schedule-problems.js";
9
+ import { localNames } from "../bridge/computer-names.js";
8
10
  function option(args, name) {
9
11
  const index = args.indexOf(name);
10
12
  if (index < 0)
@@ -14,6 +16,10 @@ function option(args, name) {
14
16
  throw new Error(`${name} needs a value.`);
15
17
  return value;
16
18
  }
19
+ /** Whether this computer is the one the schedule names. */
20
+ function ownsHere(schedule) {
21
+ return localNames().some(name => computerMatches(schedule.computer, name));
22
+ }
17
23
  function projectDirectory(store, name) {
18
24
  const directory = getProjectDirs(store).find(candidate => path.basename(candidate).toLowerCase() === name.toLowerCase());
19
25
  if (!directory)
@@ -41,6 +47,9 @@ async function list(store, projectName) {
41
47
  console.log(`${project} ${schedule.id} ${schedule.enabled ? "enabled " : "paused "} ${schedule.name}`);
42
48
  if (schedule.projects)
43
49
  console.log(` targets: ${schedule.projects.join(", ")}`);
50
+ const problems = await scheduleProblems(schedule, project, { store, owned: ownsHere(schedule) });
51
+ for (const problem of problems)
52
+ console.log(` ! ${problem}`);
44
53
  console.log(` ${schedule.computer} · ${schedule.harness}${schedule.model ? `/${schedule.model}` : ""} · ${scheduleDescription(schedule)}${schedule.session === "reuse" ? " · continues one session" : ""}`);
45
54
  }
46
55
  }
@@ -88,6 +97,10 @@ async function add(store, args) {
88
97
  if (schedule.days?.some(day => !WEEKDAYS.includes(day)))
89
98
  throw new Error(`--days accepts: ${WEEKDAYS.join(", ")}.`);
90
99
  const validated = parseSchedule(schedule);
100
+ // Refuse what could never fire: the owning computer is this one, so its source paths can be checked now.
101
+ const problems = await scheduleProblems(validated, path.basename(directory), { store, owned: ownsHere(validated) });
102
+ if (problems.length)
103
+ throw new Error(`This schedule could not run: ${problems.join(" ")}`);
91
104
  await writeScheduleDocument(directory, [...file.schedules, validated], file.document);
92
105
  console.log(`Added schedule ${validated.id} to ${path.basename(directory)}.`);
93
106
  }
@@ -170,7 +170,8 @@ export const REGISTRY = [
170
170
  { name: "returns", usage: "phren dispatch returns", summary: "List unread worker returns (done, needs you, blocked, gone) and mark them read" },
171
171
  { name: "sessions", usage: "phren dispatch sessions", summary: "List live agent sessions on this and every enrolled computer" },
172
172
  { name: "usage", usage: "phren dispatch usage [--json]", summary: "Show agent usage on this and every enrolled computer, merged by account" },
173
- { name: "report", usage: "phren dispatch report --prs <JSON>", summary: "Record this worker turn's PR evidence for the integrator" }],
173
+ { name: "report", usage: "phren dispatch report --prs <JSON>", summary: "Record this worker turn's PR evidence for the integrator" },
174
+ { name: "close-self", usage: "phren dispatch close-self", summary: "Close the pane this agent runs in once its work is committed and reported (the sanctioned form of herdr pane close)" }],
174
175
  run: async (args) => (await import("./bridge/dispatch-command.js")).runDispatch(args),
175
176
  },
176
177
  {
@@ -132,7 +132,7 @@ export const BUILTIN_MODULES = [
132
132
  schemaVersion: 1, name: "conductor", version: VERSION, defaultEnabled: false, requires: ["memory", "hook"],
133
133
  tools: full(["dispatch", "dispatch_returns", "dispatch_approve", "hand_off", "live_sessions", "account_usage", "authority", "dispatch_report", "owner_inbox", "move_session"]), cliCommands: ["dispatch", "dispatch status", "dispatch returns", "dispatch sessions", "dispatch usage", "dispatch report", "hand-off", "move", "conductor", "conductor grants", "conductor status", "conductor make", "conductor stop", "conductor sets", "conductor integrator", "owner-inbox", "authority", "bridge enroll-computer"], agentHooks: [],
134
134
  hookRoutes: [...routes("GET", ["/v1/dispatch", "/v1/dispatch/capacity", "/v1/dispatch/arrival", "/v1/dispatch/brief", "/v1/conductor", "/v1/conductor/grants", "/v1/computers", "/v1/sets", "/v1/authority", "/v1/owner-inbox", "/v1/conductor/integrator"]),
135
- ...routes("POST", ["/v1/dispatch", "/v1/dispatch/workers", "/v1/dispatch/returns", "/v1/dispatch/approve", "/v1/dispatch/report", "/v1/dispatch/close", "/v1/owner-inbox", "/v1/conductor/integrator", "/v1/hand-off", "/v1/hand-off/status", "/v1/conductor/grants", "/v1/conductor/make", "/v1/conductor/stop", "/v1/sets/name", "/v1/sets/link", "/v1/authority", "/v1/authority/confirm"]), ...routes("DELETE", ["/v1/conductor/grants", "/v1/authority"])],
135
+ ...routes("POST", ["/v1/dispatch", "/v1/dispatch/workers", "/v1/dispatch/returns", "/v1/dispatch/approve", "/v1/dispatch/report", "/v1/dispatch/close", "/v1/dispatch/close-self", "/v1/owner-inbox", "/v1/conductor/integrator", "/v1/hand-off", "/v1/hand-off/status", "/v1/conductor/grants", "/v1/conductor/make", "/v1/conductor/stop", "/v1/sets/name", "/v1/sets/link", "/v1/authority", "/v1/authority/confirm"]), ...routes("DELETE", ["/v1/conductor/grants", "/v1/authority"])],
136
136
  capabilities: ["dispatch", "conductorSets", "setLink", "ownerInbox", "workerReports", "queuedHandOff"], storeFiles: ["global/skills/conductor/**"],
137
137
  localFiles: ["<bridge>/hooks.yaml", "<bridge>/conductor.yaml", "<bridge>/conductor-role.json", "<bridge>/conductor/brief.md", "<bridge>/authority.yaml", "<bridge>/authority-confirmations.json", "<bridge>/dispatches/*.json", "<bridge>/hand-offs/*.json", "<bridge>/worker-reports/*.json", "<bridge>/closed-workers/*.json", "<bridge>/owner-inbox.json", "<bridge>/integrator.json"], phoneScreens: [], skills: ["conductor"],
138
138
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.43",
3
+ "version": "0.3.44",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {