@phren/cli 0.3.22 → 0.3.24

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.
@@ -132,7 +132,7 @@ export const BUILTIN_MODULES = [
132
132
  hookRoutes: [...routes("GET", ["/v1/dispatch", "/v1/dispatch/capacity", "/v1/dispatch/arrival", "/v1/conductor", "/v1/conductor/grants", "/v1/computers", "/v1/sets", "/v1/authority", "/v1/owner-inbox", "/v1/conductor/integrator"]),
133
133
  ...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/authority", "/v1/authority/confirm"]), ...routes("DELETE", ["/v1/conductor/grants", "/v1/authority"])],
134
134
  capabilities: ["dispatch", "conductorSets", "ownerInbox", "workerReports", "queuedHandOff"], storeFiles: ["global/skills/conductor/**"],
135
- localFiles: ["<bridge>/hooks.yaml", "<bridge>/conductor.yaml", "<bridge>/conductor-role.json", "<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"],
135
+ 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"],
136
136
  },
137
137
  {
138
138
  schemaVersion: 1, name: "fanout", version: VERSION, defaultEnabled: false, requires: ["memory", "hook"],
@@ -85,7 +85,13 @@ export function syncScopeSkillsToDir(phrenPath, scope, destDir) {
85
85
  }
86
86
  export function syncSkillLinksForScope(phrenPath, scope) {
87
87
  if (scope.toLowerCase() === "global") {
88
- return syncScopeSkillsToDir(phrenPath, "global", homePath(".claude", "skills"));
88
+ const manifest = syncScopeSkillsToDir(phrenPath, "global", homePath(".claude", "skills"));
89
+ for (const tool of [".agents", ".copilot"]) {
90
+ const dir = homePath(tool, "skills");
91
+ if (fs.existsSync(path.join(path.dirname(dir), "skill-manifest.json")))
92
+ syncScopeSkillsToDir(phrenPath, "global", dir);
93
+ }
94
+ return manifest;
89
95
  }
90
96
  const projectDir = findProjectDir(scope);
91
97
  if (!projectDir)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.22",
3
+ "version": "0.3.24",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +1,5 @@
1
1
  // Installed by Phren Hook and replaced on every update. Copy it under another name to customize.
2
+ import { request } from "node:http";
2
3
  import { execFileSync } from "node:child_process";
3
4
  import { lstatSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
4
5
  import { homedir } from "node:os";
@@ -253,6 +254,27 @@ function writePidBinding(sessionID) {
253
254
  * whose terminal does not watch its agents (tmux); Herdr has its own. */
254
255
  const statusFile = () => path.join(storeRoot(), ".runtime", "sessions", `opencode-status-${process.pid}.json`);
255
256
 
257
+ /** Context reads never hold up a model request when the Hook is unavailable. */
258
+ function conductorContext(session) {
259
+ return new Promise(resolve => {
260
+ const socketPath = path.join(process.env.PHREN_BRIDGE_HOME || path.join(homedir(), ".local/share/phren/bridge"), "agent.sock");
261
+ const data = JSON.stringify({ pid: process.pid, session });
262
+ const req = request({ socketPath, path: "/conductor-context", method: "POST",
263
+ headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(data) } }, res => {
264
+ let body = "";
265
+ res.on("data", chunk => { body += chunk; if (body.length > 16_384) req.destroy(); });
266
+ res.on("end", () => {
267
+ try { const value = JSON.parse(body); finish(res.statusCode === 200 && typeof value.context === "string" ? value.context : undefined); }
268
+ catch { finish(); }
269
+ });
270
+ res.on("error", () => finish());
271
+ });
272
+ const timer = setTimeout(() => { req.destroy(); finish(); }, 1_000);
273
+ function finish(value) { clearTimeout(timer); resolve(value); }
274
+ req.on("error", () => finish()); req.end(data);
275
+ });
276
+ }
277
+
256
278
  export const PhrenTranscriptPlugin = async input => {
257
279
  // The process's own API, bound to its in-process server (no port needed).
258
280
  const client = input?.client;
@@ -396,6 +418,12 @@ export const PhrenTranscriptPlugin = async input => {
396
418
  };
397
419
 
398
420
  return {
421
+ "experimental.chat.system.transform": async (input, output) => {
422
+ const sessionID = text(input?.sessionID);
423
+ if (process.env.PHREN_FANOUT_JOB || !OPENCODE_SESSION.test(sessionID) || sessionID !== boundSession || children.has(sessionID) || !Array.isArray(output?.system)) return;
424
+ const context = await conductorContext(sessionID);
425
+ if (context) output.system.push(context);
426
+ },
399
427
  "chat.message": async (input, output) => {
400
428
  if (!OPENCODE_SESSION.test(text(input?.sessionID)) || !output?.message) return;
401
429
  if (!process.env.PHREN_FANOUT_JOB && !children.has(input.sessionID) && boundSession !== input.sessionID) {