agent-purge 0.2.8 → 0.2.9
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/README.md +12 -2
- package/backends/index.mjs +3 -3
- package/bin/agent-purge.mjs +58 -25
- package/lib/armed.mjs +3 -2
- package/lib/caps.mjs +4 -4
- package/lib/dsh.mjs +123 -31
- package/lib/persist.mjs +33 -12
- package/lib/personas.mjs +10 -0
- package/lib/slashes.mjs +241 -25
- package/lib/spawn.mjs +3 -1
- package/lib/state.mjs +22 -4
- package/matrix.json +2 -2
- package/package.json +2 -3
- package/web/server.mjs +59 -7
- package/web/ui.html +17 -8
package/web/ui.html
CHANGED
|
@@ -567,8 +567,8 @@ const ARM_INFO = {
|
|
|
567
567
|
shim: { name: "接管裸命令", desc: (h) => h?.id === "pi"
|
|
568
568
|
? "PATH 最前放个同名壳:敲 pi 就注入。想要“裸启动也带人设”,开这个。"
|
|
569
569
|
: `往 PATH 前置一个同名小壳:直接敲 ${h?.id || "<harness>"} 也是接管版。` },
|
|
570
|
-
slash: { name: "会话内热切", desc: (h) => h?.id === "pi"
|
|
571
|
-
?
|
|
570
|
+
slash: { name: "会话内热切", desc: (h) => h?.id === "pi" || h?.id === "omp"
|
|
571
|
+
? `写 ${h.id} 扩展,只挂 /purge:不敲 /purge 就原样跑,动手才改写。`
|
|
572
572
|
: "写 harness 自己支持的扩展/命令,会话里 /purge 切换。" },
|
|
573
573
|
install: { name: "配置文件常驻", desc: () => "写进 harness 自己的指令文件:连别人启动、GUI 里点开都生效。" },
|
|
574
574
|
};
|
|
@@ -688,7 +688,7 @@ function renderOverview() {
|
|
|
688
688
|
const hid = S.defaults.harness;
|
|
689
689
|
const h = S.harnesses.find((x) => x.id === hid) || S.harnesses[0];
|
|
690
690
|
const persona = S.personas.find((p) => p.id === (selPersona || S.persona)) || S.personas[0];
|
|
691
|
-
const hot = S.harnesses.filter((h) => (h.armed || []).length).map((h) => h.id + "(" + h.armed.join("/") + (h.id === "pi" && S.piAuto ? "+裸启动" : "") + ")");
|
|
691
|
+
const hot = S.harnesses.filter((h) => (h.armed || []).length).map((h) => h.id + "(" + h.armed.join("/") + (((h.id === "pi" && S.piAuto) || (h.id === "omp" && S.ompAuto)) ? "+裸启动" : "") + ")");
|
|
692
692
|
|
|
693
693
|
const why = mode === "off"
|
|
694
694
|
? "总电源关着 —— 下面写的都只是配置,实际一条都不会注入。"
|
|
@@ -704,7 +704,7 @@ function renderOverview() {
|
|
|
704
704
|
const say = (c) => c === "shim"
|
|
705
705
|
? (h.id === "pi" ? "敲 pi 会注入(PATH 刚加的前置壳)" : "敲 " + h.id + " 会注入(PATH 前置壳)")
|
|
706
706
|
: c === "slash"
|
|
707
|
-
? (h.id === "pi" ? (S.piAuto ?
|
|
707
|
+
? (h.id === "pi" || h.id === "omp" ? ((h.id === "pi" ? S.piAuto : S.ompAuto) ? `裸敲 ${h.id} 也注入(扩展常驻)` : `裸敲 ${h.id} 不注入,只有会话里 /purge 才改写`) : "会话里 /purge 展开成用户消息")
|
|
708
708
|
: "改了它的配置文件,连别人启动的也生效";
|
|
709
709
|
return chans.map(say).join(";") + "。";
|
|
710
710
|
})()
|
|
@@ -812,6 +812,13 @@ function harnessCard(h) {
|
|
|
812
812
|
<small class="${smallCls}" ${path && !why ? `title="${esc(path)}"` : ""}>${esc(smallText)}</small></span></button>`;
|
|
813
813
|
}).join("");
|
|
814
814
|
|
|
815
|
+
// omp 的裸启动注入靠扩展常驻(ompAuto);只有扩展已装(slash 已武装)才给这个开关
|
|
816
|
+
const ompAutoBtn = h.id === "omp" && h.armed?.includes("slash")
|
|
817
|
+
? `<button class="chan ${S.ompAuto ? "on" : ""}" data-ompauto="${S.ompAuto ? "off" : "on"}" type="button" title="扩展常驻,不改 PATH:开关写在 state.json 的 ompAuto">
|
|
818
|
+
<span class="dot"></span><span><b>裸命令接管${S.ompAuto ? " · 开" : ""}</b>
|
|
819
|
+
<small>${S.ompAuto ? "扩展常驻:敲 omp 就注入(每次启动)" : "关着:只有 /purge 或 agent-purge omp 才注入"}</small></span></button>`
|
|
820
|
+
: "";
|
|
821
|
+
|
|
815
822
|
const notes = []
|
|
816
823
|
// 卡片上的徽章已经写了“SYS 通过/部分通过”,同义的行就不再重复
|
|
817
824
|
.concat((row?.warnings || []).filter((w) => !/^(sys|user) (通过|部分通过|未通过)$/.test(w)))
|
|
@@ -856,7 +863,7 @@ function harnessCard(h) {
|
|
|
856
863
|
<span><k>home</k>${esc(h.home || "—")}${h.homeExists === false ? "(不存在)" : ""}</span>
|
|
857
864
|
</div>
|
|
858
865
|
${notes.length ? `<div class="hnote">${notes.map(esc).join("<br>")}</div>` : ""}
|
|
859
|
-
<div class="chans">${chans}</div>
|
|
866
|
+
<div class="chans">${chans}${ompAutoBtn}</div>
|
|
860
867
|
${profileRow}
|
|
861
868
|
</div>`;
|
|
862
869
|
}
|
|
@@ -1047,11 +1054,13 @@ $("#hpick").addEventListener("click", (e) => {
|
|
|
1047
1054
|
selHarness = b.dataset.hpick; renderHarness();
|
|
1048
1055
|
});
|
|
1049
1056
|
$("#hsel").addEventListener("click", async (e) => {
|
|
1050
|
-
const b = e.target.closest("[data-piauto]"); if (!b) return;
|
|
1057
|
+
const b = e.target.closest("[data-piauto], [data-ompauto]"); if (!b) return;
|
|
1058
|
+
const isPi = Boolean(b.dataset.piauto);
|
|
1059
|
+
const want = (isPi ? b.dataset.piauto : b.dataset.ompauto) === "on";
|
|
1051
1060
|
await withBusy(b, async () => {
|
|
1052
1061
|
try {
|
|
1053
|
-
await api("/api/pi-auto", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ on:
|
|
1054
|
-
toast("裸启动自动注入 → " + (
|
|
1062
|
+
await api(isPi ? "/api/pi-auto" : "/api/omp-auto", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ on: want }) });
|
|
1063
|
+
toast((isPi ? "pi" : "omp") + " 裸启动自动注入 → " + (want ? "开" : "关"));
|
|
1055
1064
|
await load();
|
|
1056
1065
|
} catch (err) { toast("失败:" + err.message, true); }
|
|
1057
1066
|
});
|