@phren/cli 0.3.2 → 0.3.3
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/bridge/server-routes.d.ts +1 -0
- package/dist/bridge/server-routes.js +1 -1
- package/dist/bridge/speech.d.ts +22 -0
- package/dist/bridge/speech.js +54 -5
- package/dist/bridge-hook.mjs +46 -7
- package/dist/cli/namespaces-store.js +62 -2
- package/dist/cli-registry.js +1 -1
- package/dist/modules/registry.js +1 -1
- package/package.json +1 -1
|
@@ -51,7 +51,7 @@ async function childActivity(source, session) {
|
|
|
51
51
|
export const capabilities = { transcript: true, progress: true, images: true, prompt: true, stop: true,
|
|
52
52
|
terminal: "ssh-pty", shell: "ssh-pty", herdr: true, diff: true, webServers: true, webPreview: "ssh-exec", activity: true,
|
|
53
53
|
approvals: true, questions: false, accountUsage: true, providers: ["codex", "claude", "copilot", "opencode"],
|
|
54
|
-
files: true, repositoryFiles: true, subagents: true, sideQuestions: true, dispatch: true, approvalPush: "direct-apns", simulators: process.platform === "darwin", code: true, overviewStream: true, speech: true, transcribe: true, memoryStore: true };
|
|
54
|
+
files: true, repositoryFiles: true, subagents: true, sideQuestions: true, dispatch: true, approvalPush: "direct-apns", simulators: process.platform === "darwin", code: true, overviewStream: true, speech: true, speechTimestamps: true, transcribe: true, memoryStore: true };
|
|
55
55
|
export function capabilitiesForModules(snapshot) {
|
|
56
56
|
const allowed = new Set(snapshot.modules.flatMap(module => module.capabilities));
|
|
57
57
|
const result = Object.fromEntries(Object.entries(capabilities).filter(([name]) => allowed.has(name)));
|
package/dist/bridge/speech.d.ts
CHANGED
|
@@ -14,7 +14,15 @@ export declare const SPEECH_MODEL = "eleven_flash_v2_5";
|
|
|
14
14
|
export declare const DEFAULT_SPEECH_VOICE = "SAz9YHcvj6GT2YYXdXww";
|
|
15
15
|
export declare const speechRequest: z.ZodObject<{
|
|
16
16
|
text: z.ZodString;
|
|
17
|
+
timestamps: z.ZodOptional<z.ZodBoolean>;
|
|
17
18
|
}, z.core.$strip>;
|
|
19
|
+
/** When each character of the voiced text starts and ends, in seconds from
|
|
20
|
+
* the start of the audio. */
|
|
21
|
+
export interface SpeechAlignment {
|
|
22
|
+
characters: string[];
|
|
23
|
+
starts: number[];
|
|
24
|
+
ends: number[];
|
|
25
|
+
}
|
|
18
26
|
export interface SpeechOptions {
|
|
19
27
|
fetch?: typeof fetch;
|
|
20
28
|
/** Resolves the ElevenLabs key; defaults to ELEVENLABS_API_KEY, then the stored key (speech-key.ts). */
|
|
@@ -32,7 +40,21 @@ export declare function speechError(upstream: Response): Promise<BridgeError>;
|
|
|
32
40
|
export declare function speakableText(text: string): string;
|
|
33
41
|
/** Starts ElevenLabs' streaming synthesis and returns its audio body. */
|
|
34
42
|
export declare function synthesizeSpeech(text: string, signal: AbortSignal, options?: SpeechOptions): Promise<ReadableStream<Uint8Array>>;
|
|
43
|
+
/** Voices the text in one piece with ElevenLabs' character alignment. */
|
|
44
|
+
export declare function synthesizeTimedSpeech(text: string, signal: AbortSignal, options?: SpeechOptions): Promise<{
|
|
45
|
+
audio: string;
|
|
46
|
+
alignment: SpeechAlignment | null;
|
|
47
|
+
}>;
|
|
48
|
+
/** ElevenLabs' alignment, kept only when its three lists line up. */
|
|
49
|
+
export declare function alignmentOf(raw: {
|
|
50
|
+
characters?: unknown;
|
|
51
|
+
character_start_times_seconds?: unknown;
|
|
52
|
+
character_end_times_seconds?: unknown;
|
|
53
|
+
} | null | undefined): SpeechAlignment | null;
|
|
35
54
|
/** POST /v1/speech: writes the audio to the phone as ElevenLabs produces it.
|
|
55
|
+
* With `timestamps`, answers JSON instead: `{ audio, audioFormat, alignment }`,
|
|
56
|
+
* the audio base64 in the same PCM format and the alignment null when
|
|
57
|
+
* ElevenLabs sent none.
|
|
36
58
|
* Failures before the first byte are thrown for the route's JSON error; a
|
|
37
59
|
* failure mid-stream cuts the response off, which the phone treats as an
|
|
38
60
|
* error. The phone hanging up cancels the ElevenLabs request. */
|
package/dist/bridge/speech.js
CHANGED
|
@@ -15,7 +15,12 @@ export const SPEECH_MODEL = "eleven_flash_v2_5";
|
|
|
15
15
|
/** River: relaxed, neutral and informative. PHREN_SPEECH_VOICE overrides it. */
|
|
16
16
|
export const DEFAULT_SPEECH_VOICE = "SAz9YHcvj6GT2YYXdXww";
|
|
17
17
|
const MAX_TEXT = 2_000;
|
|
18
|
-
export const speechRequest = z.object({
|
|
18
|
+
export const speechRequest = z.object({
|
|
19
|
+
text: z.string().trim().min(1).max(MAX_TEXT),
|
|
20
|
+
/** Answer JSON with the audio and when each character is spoken, so the
|
|
21
|
+
* phone can highlight the word being read (talk mode's karaoke). */
|
|
22
|
+
timestamps: z.boolean().optional(),
|
|
23
|
+
});
|
|
19
24
|
/** A fixed message per ElevenLabs failure: its own response text is never
|
|
20
25
|
* passed on. */
|
|
21
26
|
export async function speechError(upstream) {
|
|
@@ -69,11 +74,42 @@ export function speakableText(text) {
|
|
|
69
74
|
}
|
|
70
75
|
/** Starts ElevenLabs' streaming synthesis and returns its audio body. */
|
|
71
76
|
export async function synthesizeSpeech(text, signal, options = {}) {
|
|
77
|
+
const upstream = await elevenLabs("stream", text, signal, options);
|
|
78
|
+
if (!upstream.body)
|
|
79
|
+
throw await speechError(upstream);
|
|
80
|
+
return upstream.body;
|
|
81
|
+
}
|
|
82
|
+
/** Voices the text in one piece with ElevenLabs' character alignment. */
|
|
83
|
+
export async function synthesizeTimedSpeech(text, signal, options = {}) {
|
|
84
|
+
const upstream = await elevenLabs("with-timestamps", text, signal, options);
|
|
85
|
+
let body;
|
|
86
|
+
try {
|
|
87
|
+
body = (await upstream.json());
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
throw new BridgeError(502, "ElevenLabs sent an unreadable reply.", { code: "speech-failed" });
|
|
91
|
+
}
|
|
92
|
+
if (typeof body.audio_base64 !== "string")
|
|
93
|
+
throw new BridgeError(502, "ElevenLabs sent an unreadable reply.", { code: "speech-failed" });
|
|
94
|
+
return { audio: body.audio_base64, alignment: alignmentOf(body.alignment) };
|
|
95
|
+
}
|
|
96
|
+
/** ElevenLabs' alignment, kept only when its three lists line up. */
|
|
97
|
+
export function alignmentOf(raw) {
|
|
98
|
+
const characters = raw?.characters, starts = raw?.character_start_times_seconds, ends = raw?.character_end_times_seconds;
|
|
99
|
+
if (!Array.isArray(characters) || !Array.isArray(starts) || !Array.isArray(ends))
|
|
100
|
+
return null;
|
|
101
|
+
if (characters.length !== starts.length || characters.length !== ends.length)
|
|
102
|
+
return null;
|
|
103
|
+
if (!characters.every(c => typeof c === "string") || ![...starts, ...ends].every(t => typeof t === "number" && Number.isFinite(t)))
|
|
104
|
+
return null;
|
|
105
|
+
return { characters: characters, starts: starts, ends: ends };
|
|
106
|
+
}
|
|
107
|
+
async function elevenLabs(endpoint, text, signal, options) {
|
|
72
108
|
const key = await (options.key ?? readSpeechKey)();
|
|
73
109
|
if (!key)
|
|
74
110
|
throw new BridgeError(503, "Spoken replies aren't set up on this computer: it has no ElevenLabs key.", { code: "speech-unconfigured" });
|
|
75
111
|
const voice = options.voice ?? process.env.PHREN_SPEECH_VOICE ?? DEFAULT_SPEECH_VOICE;
|
|
76
|
-
const url = `https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(voice)}
|
|
112
|
+
const url = `https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(voice)}/${endpoint}?output_format=${OUTPUT_FORMAT}`;
|
|
77
113
|
let upstream;
|
|
78
114
|
try {
|
|
79
115
|
upstream = await (options.fetch ?? fetch)(url, {
|
|
@@ -85,21 +121,34 @@ export async function synthesizeSpeech(text, signal, options = {}) {
|
|
|
85
121
|
catch {
|
|
86
122
|
throw new BridgeError(502, "Couldn't reach ElevenLabs from this computer.", { code: "speech-unreachable" });
|
|
87
123
|
}
|
|
88
|
-
if (!upstream.ok
|
|
124
|
+
if (!upstream.ok)
|
|
89
125
|
throw await speechError(upstream);
|
|
90
|
-
return upstream
|
|
126
|
+
return upstream;
|
|
91
127
|
}
|
|
92
128
|
/** POST /v1/speech: writes the audio to the phone as ElevenLabs produces it.
|
|
129
|
+
* With `timestamps`, answers JSON instead: `{ audio, audioFormat, alignment }`,
|
|
130
|
+
* the audio base64 in the same PCM format and the alignment null when
|
|
131
|
+
* ElevenLabs sent none.
|
|
93
132
|
* Failures before the first byte are thrown for the route's JSON error; a
|
|
94
133
|
* failure mid-stream cuts the response off, which the phone treats as an
|
|
95
134
|
* error. The phone hanging up cancels the ElevenLabs request. */
|
|
96
135
|
export async function streamSpeech(data, response, options = {}) {
|
|
97
|
-
const
|
|
136
|
+
const request = speechRequest.parse(data);
|
|
137
|
+
const text = speakableText(request.text);
|
|
98
138
|
if (!text)
|
|
99
139
|
throw new BridgeError(400, "There is nothing to say in this reply.", { code: "speech-invalid" });
|
|
140
|
+
// With timestamps, the alignment covers these spoken words, not the markdown.
|
|
141
|
+
const { timestamps } = request;
|
|
100
142
|
const abort = new AbortController();
|
|
101
143
|
response.once("close", () => { if (!response.writableEnded)
|
|
102
144
|
abort.abort(); });
|
|
145
|
+
if (timestamps) {
|
|
146
|
+
const { audio, alignment } = await synthesizeTimedSpeech(text, abort.signal, options);
|
|
147
|
+
response.statusCode = 200;
|
|
148
|
+
response.setHeader("Content-Type", "application/json");
|
|
149
|
+
response.end(JSON.stringify({ audio, audioFormat: SPEECH_AUDIO, alignment }));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
103
152
|
const audio = await synthesizeSpeech(text, abort.signal, options);
|
|
104
153
|
response.statusCode = 200;
|
|
105
154
|
response.setHeader("Content-Type", "application/octet-stream");
|
package/dist/bridge-hook.mjs
CHANGED
|
@@ -28275,7 +28275,7 @@ var init_package_metadata = __esm({
|
|
|
28275
28275
|
__dirname = path24.dirname(fileURLToPath2(import.meta.url));
|
|
28276
28276
|
ROOT = path24.join(__dirname, "..");
|
|
28277
28277
|
PACKAGE_JSON_PATH = path24.join(ROOT, "package.json");
|
|
28278
|
-
BUNDLED_VERSION = true ? "0.3.
|
|
28278
|
+
BUNDLED_VERSION = true ? "0.3.3" : "0.0.0";
|
|
28279
28279
|
PACKAGE_JSON = readPackageJson();
|
|
28280
28280
|
PACKAGE_NAME = PACKAGE_JSON.name || "phren";
|
|
28281
28281
|
VERSION = PACKAGE_JSON.version || BUNDLED_VERSION;
|
|
@@ -33310,6 +33310,7 @@ var BUILTIN_MODULES = [
|
|
|
33310
33310
|
"simulators",
|
|
33311
33311
|
"overviewStream",
|
|
33312
33312
|
"speech",
|
|
33313
|
+
"speechTimestamps",
|
|
33313
33314
|
"transcribe"
|
|
33314
33315
|
],
|
|
33315
33316
|
storeFiles: [".runtime/sessions/opencode-*.events.jsonl", ".runtime/approvals/opencode-*.json"],
|
|
@@ -47253,7 +47254,12 @@ var OUTPUT_FORMAT = "pcm_24000";
|
|
|
47253
47254
|
var SPEECH_MODEL = "eleven_flash_v2_5";
|
|
47254
47255
|
var DEFAULT_SPEECH_VOICE = "SAz9YHcvj6GT2YYXdXww";
|
|
47255
47256
|
var MAX_TEXT = 2e3;
|
|
47256
|
-
var speechRequest = external_exports.object({
|
|
47257
|
+
var speechRequest = external_exports.object({
|
|
47258
|
+
text: external_exports.string().trim().min(1).max(MAX_TEXT),
|
|
47259
|
+
/** Answer JSON with the audio and when each character is spoken, so the
|
|
47260
|
+
* phone can highlight the word being read (talk mode's karaoke). */
|
|
47261
|
+
timestamps: external_exports.boolean().optional()
|
|
47262
|
+
});
|
|
47257
47263
|
async function speechError(upstream) {
|
|
47258
47264
|
let detail = "";
|
|
47259
47265
|
try {
|
|
@@ -47284,10 +47290,33 @@ function speakableText(text3) {
|
|
|
47284
47290
|
}).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
|
|
47285
47291
|
}
|
|
47286
47292
|
async function synthesizeSpeech(text3, signal, options = {}) {
|
|
47293
|
+
const upstream = await elevenLabs("stream", text3, signal, options);
|
|
47294
|
+
if (!upstream.body) throw await speechError(upstream);
|
|
47295
|
+
return upstream.body;
|
|
47296
|
+
}
|
|
47297
|
+
async function synthesizeTimedSpeech(text3, signal, options = {}) {
|
|
47298
|
+
const upstream = await elevenLabs("with-timestamps", text3, signal, options);
|
|
47299
|
+
let body2;
|
|
47300
|
+
try {
|
|
47301
|
+
body2 = await upstream.json();
|
|
47302
|
+
} catch {
|
|
47303
|
+
throw new BridgeError(502, "ElevenLabs sent an unreadable reply.", { code: "speech-failed" });
|
|
47304
|
+
}
|
|
47305
|
+
if (typeof body2.audio_base64 !== "string") throw new BridgeError(502, "ElevenLabs sent an unreadable reply.", { code: "speech-failed" });
|
|
47306
|
+
return { audio: body2.audio_base64, alignment: alignmentOf(body2.alignment) };
|
|
47307
|
+
}
|
|
47308
|
+
function alignmentOf(raw) {
|
|
47309
|
+
const characters = raw?.characters, starts = raw?.character_start_times_seconds, ends = raw?.character_end_times_seconds;
|
|
47310
|
+
if (!Array.isArray(characters) || !Array.isArray(starts) || !Array.isArray(ends)) return null;
|
|
47311
|
+
if (characters.length !== starts.length || characters.length !== ends.length) return null;
|
|
47312
|
+
if (!characters.every((c) => typeof c === "string") || ![...starts, ...ends].every((t) => typeof t === "number" && Number.isFinite(t))) return null;
|
|
47313
|
+
return { characters, starts, ends };
|
|
47314
|
+
}
|
|
47315
|
+
async function elevenLabs(endpoint, text3, signal, options) {
|
|
47287
47316
|
const key = await (options.key ?? readSpeechKey)();
|
|
47288
47317
|
if (!key) throw new BridgeError(503, "Spoken replies aren't set up on this computer: it has no ElevenLabs key.", { code: "speech-unconfigured" });
|
|
47289
47318
|
const voice = options.voice ?? process.env.PHREN_SPEECH_VOICE ?? DEFAULT_SPEECH_VOICE;
|
|
47290
|
-
const url2 = `https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(voice)}
|
|
47319
|
+
const url2 = `https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(voice)}/${endpoint}?output_format=${OUTPUT_FORMAT}`;
|
|
47291
47320
|
let upstream;
|
|
47292
47321
|
try {
|
|
47293
47322
|
upstream = await (options.fetch ?? fetch)(url2, {
|
|
@@ -47299,16 +47328,25 @@ async function synthesizeSpeech(text3, signal, options = {}) {
|
|
|
47299
47328
|
} catch {
|
|
47300
47329
|
throw new BridgeError(502, "Couldn't reach ElevenLabs from this computer.", { code: "speech-unreachable" });
|
|
47301
47330
|
}
|
|
47302
|
-
if (!upstream.ok
|
|
47303
|
-
return upstream
|
|
47331
|
+
if (!upstream.ok) throw await speechError(upstream);
|
|
47332
|
+
return upstream;
|
|
47304
47333
|
}
|
|
47305
47334
|
async function streamSpeech(data, response, options = {}) {
|
|
47306
|
-
const
|
|
47335
|
+
const request6 = speechRequest.parse(data);
|
|
47336
|
+
const text3 = speakableText(request6.text);
|
|
47307
47337
|
if (!text3) throw new BridgeError(400, "There is nothing to say in this reply.", { code: "speech-invalid" });
|
|
47338
|
+
const { timestamps } = request6;
|
|
47308
47339
|
const abort = new AbortController();
|
|
47309
47340
|
response.once("close", () => {
|
|
47310
47341
|
if (!response.writableEnded) abort.abort();
|
|
47311
47342
|
});
|
|
47343
|
+
if (timestamps) {
|
|
47344
|
+
const { audio: audio2, alignment } = await synthesizeTimedSpeech(text3, abort.signal, options);
|
|
47345
|
+
response.statusCode = 200;
|
|
47346
|
+
response.setHeader("Content-Type", "application/json");
|
|
47347
|
+
response.end(JSON.stringify({ audio: audio2, audioFormat: SPEECH_AUDIO, alignment }));
|
|
47348
|
+
return;
|
|
47349
|
+
}
|
|
47312
47350
|
const audio = await synthesizeSpeech(text3, abort.signal, options);
|
|
47313
47351
|
response.statusCode = 200;
|
|
47314
47352
|
response.setHeader("Content-Type", "application/octet-stream");
|
|
@@ -47367,6 +47405,7 @@ var capabilities = {
|
|
|
47367
47405
|
code: true,
|
|
47368
47406
|
overviewStream: true,
|
|
47369
47407
|
speech: true,
|
|
47408
|
+
speechTimestamps: true,
|
|
47370
47409
|
transcribe: true,
|
|
47371
47410
|
memoryStore: true
|
|
47372
47411
|
};
|
|
@@ -49015,7 +49054,7 @@ async function readSecret(prompt) {
|
|
|
49015
49054
|
// src/bridge/hook-main.ts
|
|
49016
49055
|
init_utils_helpers();
|
|
49017
49056
|
Object.assign(process.env, nonInteractiveGitEnv());
|
|
49018
|
-
runBridge(process.argv.slice(2), "0.3.
|
|
49057
|
+
runBridge(process.argv.slice(2), "0.3.3").then((code) => {
|
|
49019
49058
|
process.exitCode = code;
|
|
49020
49059
|
}).catch((error62) => {
|
|
49021
49060
|
console.error(error62 instanceof Error ? error62.message : "Phren Hook failed.");
|
|
@@ -6,16 +6,67 @@ import { getPhrenPath } from "../shared.js";
|
|
|
6
6
|
import { isValidProjectName, errorMessage, getOptionValue } from "../utils.js";
|
|
7
7
|
import { resolveAllStores, addStoreToRegistry, removeStoreFromRegistry, generateStoreId, getStoreProjectDirs, readTeamBootstrap, } from "../store-registry.js";
|
|
8
8
|
import { mergeStoreUpstream } from "../sync/store-merge.js";
|
|
9
|
+
import { aheadBehind, logSyncOutcome } from "../sync/outcome.js";
|
|
10
|
+
import { getRuntimeHealth, updateRuntimeHealth } from "../shared/governance.js";
|
|
9
11
|
function printStoreUsage() {
|
|
10
12
|
console.log("Usage:");
|
|
11
13
|
console.log(" phren store list List registered stores");
|
|
12
14
|
console.log(" phren store add <name> --remote <url> Add a team store");
|
|
13
15
|
console.log(" phren store remove <name> Remove a store (local only)");
|
|
14
|
-
console.log(" phren store sync Pull all stores");
|
|
16
|
+
console.log(" phren store sync Pull and push all stores");
|
|
15
17
|
console.log(" phren store activity [--limit N] Recent team findings");
|
|
16
18
|
console.log(" phren store subscribe <name> <project...> Subscribe store to projects");
|
|
17
19
|
console.log(" phren store unsubscribe <name> <project...> Unsubscribe store from projects");
|
|
18
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Push what a sync left ahead of the upstream: the merge commit and any local
|
|
23
|
+
* commits. Without this a merge that resolved conflicts stayed local, and the
|
|
24
|
+
* store sat N commits ahead until someone ran `git push` by hand.
|
|
25
|
+
*/
|
|
26
|
+
async function pushStoreUpstream(store, git) {
|
|
27
|
+
if (store.sync === "pull-only" || store.role === "readonly")
|
|
28
|
+
return { status: "skipped", detail: "pull-only store" };
|
|
29
|
+
const counts = await aheadBehind(store.path, git);
|
|
30
|
+
if (!counts)
|
|
31
|
+
return { status: "skipped", detail: "no tracking remote" };
|
|
32
|
+
if (counts.ahead === 0)
|
|
33
|
+
return { status: "in-sync", detail: "nothing to push" };
|
|
34
|
+
const branch = await git(store.path, ["symbolic-ref", "--quiet", "HEAD"]);
|
|
35
|
+
const refs = branch.ok
|
|
36
|
+
? await git(store.path, ["for-each-ref", "--format=%(upstream:remotename)%09%(upstream:remoteref)", branch.output])
|
|
37
|
+
: branch;
|
|
38
|
+
const [remote, remoteRef] = refs.ok ? refs.output.split("\t") : [];
|
|
39
|
+
if (!remote || !remoteRef)
|
|
40
|
+
return { status: "failed", detail: "cannot read the upstream branch" };
|
|
41
|
+
const pushed = await git(store.path, ["push", "--quiet", "--", remote, `HEAD:${remoteRef}`]);
|
|
42
|
+
if (!pushed.ok)
|
|
43
|
+
return { status: "failed", detail: `push failed: ${(pushed.error || "unknown Git error").split("\n")[0]}` };
|
|
44
|
+
return { status: "pushed", detail: `pushed ${counts.ahead} commit${counts.ahead === 1 ? "" : "s"}` };
|
|
45
|
+
}
|
|
46
|
+
/** Record a sync's push on the primary store, so doctor's runtime-auto-save check reflects it. */
|
|
47
|
+
async function recordPrimaryPush(phrenPath, push, git) {
|
|
48
|
+
if (push.status === "skipped")
|
|
49
|
+
return;
|
|
50
|
+
const now = new Date().toISOString();
|
|
51
|
+
const previous = getRuntimeHealth(phrenPath).lastSync;
|
|
52
|
+
const counts = await aheadBehind(phrenPath, git);
|
|
53
|
+
const detail = `store sync: ${push.detail}`;
|
|
54
|
+
const failed = push.status === "failed";
|
|
55
|
+
updateRuntimeHealth(phrenPath, {
|
|
56
|
+
lastAutoSave: { at: now, status: failed ? "sync-failed" : "saved-pushed", detail },
|
|
57
|
+
lastSync: {
|
|
58
|
+
...previous,
|
|
59
|
+
lastPushAt: now,
|
|
60
|
+
lastPushStatus: failed ? "push-failed" : "saved-pushed",
|
|
61
|
+
lastPushDetail: detail,
|
|
62
|
+
unsyncedCommits: counts?.ahead ?? previous?.unsyncedCommits,
|
|
63
|
+
consecutiveFailures: failed ? (previous?.consecutiveFailures ?? 0) + 1 : 0,
|
|
64
|
+
...(failed ? {} : { lastSuccessfulPushAt: now }),
|
|
65
|
+
...(counts ?? {}),
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
logSyncOutcome(phrenPath, "store-sync", { ok: !failed, detail: push.detail, counts });
|
|
69
|
+
}
|
|
19
70
|
function countStoreProjects(store) {
|
|
20
71
|
if (!fs.existsSync(store.path))
|
|
21
72
|
return 0;
|
|
@@ -279,7 +330,16 @@ export async function handleStoreNamespace(args) {
|
|
|
279
330
|
// sparse-checkout not configured — nothing to reapply
|
|
280
331
|
}
|
|
281
332
|
}
|
|
282
|
-
|
|
333
|
+
const push = await pushStoreUpstream(store, git);
|
|
334
|
+
if (store.role === "primary")
|
|
335
|
+
await recordPrimaryPush(store.path, push, git);
|
|
336
|
+
if (push.status === "failed") {
|
|
337
|
+
console.log(` ${store.name}: PUSH FAILED (${result.detail} ${push.detail}; the store is still ahead of the remote)`);
|
|
338
|
+
hasErrors = true;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
console.log(` ${store.name}: ok (${result.detail}${push.status === "pushed" ? ` Then ${push.detail}.` : ""})`);
|
|
342
|
+
}
|
|
283
343
|
if (store.role === "primary")
|
|
284
344
|
primarySynced = true;
|
|
285
345
|
}
|
package/dist/cli-registry.js
CHANGED
|
@@ -121,7 +121,7 @@ const STORE_SUBCOMMANDS = [
|
|
|
121
121
|
{ name: "list", usage: "phren store list", summary: "List registered stores" },
|
|
122
122
|
{ name: "add", usage: "phren store add <name> --remote <url>", summary: "Add a team store" },
|
|
123
123
|
{ name: "remove", usage: "phren store remove <name>", summary: "Remove a store (local only)" },
|
|
124
|
-
{ name: "sync", usage: "phren store sync", summary: "Pull all stores" },
|
|
124
|
+
{ name: "sync", usage: "phren store sync", summary: "Pull and push all stores" },
|
|
125
125
|
];
|
|
126
126
|
const TEAM_SUBCOMMANDS = [
|
|
127
127
|
{ name: "init", usage: "phren team init <name> [--remote <url>]", summary: "Create a new team store" },
|
package/dist/modules/registry.js
CHANGED
|
@@ -96,7 +96,7 @@ export const BUILTIN_MODULES = [
|
|
|
96
96
|
capabilities: [
|
|
97
97
|
"hook", "transcript", "progress", "images", "prompt", "stop", "terminal", "shell", "herdr",
|
|
98
98
|
"webServers", "webPreview", "activity", "approvals", "questions", "accountUsage", "providers",
|
|
99
|
-
"files", "repositoryFiles", "subagents", "sideQuestions", "approvalPush", "simulators", "overviewStream", "speech", "transcribe",
|
|
99
|
+
"files", "repositoryFiles", "subagents", "sideQuestions", "approvalPush", "simulators", "overviewStream", "speech", "speechTimestamps", "transcribe",
|
|
100
100
|
],
|
|
101
101
|
storeFiles: [".runtime/sessions/opencode-*.events.jsonl", ".runtime/approvals/opencode-*.json"],
|
|
102
102
|
localFiles: ["<bridge>/installed.json", "<bridge>/versions/**", "<bridge>/current", "<bridge>/dispatch", "<bridge>/computer-id", "<bridge>/canary.json", "<bridge>/canary-daily"],
|