@krtclcdy/tersio 1.0.3 → 1.0.4

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.
@@ -63,6 +63,16 @@ export default function comboToggleExtension(pi) {
63
63
  c.ui.setStatus("rtk", undefined);
64
64
  c.ui.setStatus("ponytail", undefined);
65
65
  }
66
+ // ponytail: same persistence as /combo — siblings (incl. upstream ponytail)
67
+ // restore from these entries, so the fallback must write them too or the
68
+ // preset evaporates on resume and ponytail never activates.
69
+ function persistPreset(level) {
70
+ const modes = COMBO_LEVELS[level];
71
+ pi.appendEntry?.("caveman-mode", { mode: modes.caveman });
72
+ pi.appendEntry?.("rtk-mode", { enabled: modes.rtk === "on" });
73
+ pi.appendEntry?.("ponytail-mode", { mode: modes.ponytail });
74
+ pi.appendEntry?.("combo-level", { level });
75
+ }
66
76
  function useState(state, ctx) {
67
77
  currentState = state;
68
78
  syncStatus(ctx);
@@ -99,12 +109,7 @@ export default function comboToggleExtension(pi) {
99
109
  ctx?.ui?.notify?.(`Unknown combo level: ${arg}. Use: off | medium | balanced | max`, "warning");
100
110
  return;
101
111
  }
102
- const modes = COMBO_LEVELS[level];
103
- // Persist per-extension state so they restore on session_start
104
- pi.appendEntry?.("caveman-mode", { mode: modes.caveman });
105
- pi.appendEntry?.("rtk-mode", { enabled: modes.rtk === "on" });
106
- pi.appendEntry?.("ponytail-mode", { mode: modes.ponytail });
107
- pi.appendEntry?.("combo-level", { level });
112
+ persistPreset(level);
108
113
  useState(setSharedComboLevel(level), ctx);
109
114
  ctx?.ui?.notify?.(`Combo ${level} applied: ${levelSummary(currentState)}`, "info");
110
115
  if (ctx?.reload)
@@ -122,6 +127,7 @@ export default function comboToggleExtension(pi) {
122
127
  if (getSharedComboState().level === "off" && !(ctx?.sessionManager?.getBranch?.() || ctx?.sessionManager?.getEntries?.() || []).length) {
123
128
  const fallback = readComboDefault();
124
129
  if (fallback !== "off") {
130
+ persistPreset(fallback);
125
131
  useState(setSharedComboLevel(fallback), ctx);
126
132
  ctx?.ui?.notify?.(`Combo default applied: ${fallback}`, "info");
127
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krtclcdy/tersio",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Amanai reward detector and three toggleable OMP extensions for terse replies, compact shell output, and minimal code decisions \u2014 with a manual updater and dry-run support.",
5
5
  "keywords": [
6
6
  "omp",
package/tersio.js CHANGED
@@ -92,6 +92,8 @@ Commands:
92
92
 
93
93
  Options:
94
94
  --scope user|project|both
95
+ --remove-ponytail (uninstall: also remove the Ponytail plugin)
96
+ --remove-rtk (uninstall: also remove the RTK binary)
95
97
  --combo-default off|medium|balanced|max (implies caveman, rtk, ponytail)
96
98
  --caveman-default off|lite|full|ultra|wenyan (override; default follows combo)
97
99
  --rtk-default on|off (override; default follows combo)
@@ -800,6 +802,8 @@ async function runUninstall(options = {}) {
800
802
  const extDir = path.join(HOME, ".omp", "agent", "extensions");
801
803
  const configPath = path.join(HOME, ".omp", "agent", "config.yml");
802
804
  const rtkBin = path.join(HOME, ".bun", "bin", IS_WINDOWS ? "rtk.exe" : "rtk");
805
+ const pluginsDir = path.join(HOME, ".omp", "plugins");
806
+ const ponytailPkgDir = path.join(pluginsDir, "node_modules", "@dietrichgebert", "ponytail");
803
807
  const targets = [
804
808
  path.join(extDir, "caveman-session"),
805
809
  path.join(extDir, "rtk-session"),
@@ -807,6 +811,8 @@ async function runUninstall(options = {}) {
807
811
  path.join(extDir, "combo-toggle"),
808
812
  path.join(extDir, "shared"),
809
813
  path.join(extDir, "amanai-reward"),
814
+ // Only consumed by ai-addons-updater (removed above); otherwise orphaned.
815
+ path.join(extDir, "lib"),
810
816
  // Legacy always-on combo helper; imports shared/session-state.js, so it
811
817
  // breaks with a module-not-found warning once the shared dir is removed.
812
818
  path.join(extDir, "aaa-combo-boot"),
@@ -815,6 +821,9 @@ async function runUninstall(options = {}) {
815
821
  for (const t of targets) {
816
822
  console.log(` ${t}`);
817
823
  }
824
+ if (shouldRemovePonytail) {
825
+ console.log(` ${ponytailPkgDir} (ponytail plugin package)`);
826
+ }
818
827
  if (shouldRemoveRtk) {
819
828
  console.log(` ${rtkBin}`);
820
829
  }
@@ -861,8 +870,62 @@ async function runUninstall(options = {}) {
861
870
  }
862
871
  }
863
872
  }
873
+ // Remove the Ponytail plugin package the installer added (dep, files,
874
+ // lock entry); the config.yml entry was filtered above.
875
+ if (shouldRemovePonytail) {
876
+ const pluginsPkgPath = path.join(pluginsDir, "package.json");
877
+ const ponytailRaw = await readTextIfExists(pluginsPkgPath);
878
+ if (ponytailRaw) {
879
+ try {
880
+ const pkg = JSON.parse(ponytailRaw);
881
+ if (pkg.dependencies && "@dietrichgebert/ponytail" in pkg.dependencies) {
882
+ if (shouldDryRun)
883
+ console.log(` [dry-run] would remove @dietrichgebert/ponytail from ${pluginsPkgPath}`);
884
+ else {
885
+ delete pkg.dependencies["@dietrichgebert/ponytail"];
886
+ await fs.writeFile(pluginsPkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
887
+ console.log(" [write] Removed @dietrichgebert/ponytail from plugins/package.json");
888
+ }
889
+ }
890
+ }
891
+ catch {
892
+ debug("Could not update plugins/package.json for ponytail");
893
+ }
894
+ }
895
+ try {
896
+ if (shouldDryRun)
897
+ console.log(` [dry-run] would remove ${ponytailPkgDir}`);
898
+ else {
899
+ await fs.rm(ponytailPkgDir, { recursive: true, force: true });
900
+ console.log(` [rm] ${ponytailPkgDir}`);
901
+ await fs.rm(path.dirname(ponytailPkgDir));
902
+ console.log(` [rm] ${path.dirname(ponytailPkgDir)} (empty scope)`);
903
+ }
904
+ }
905
+ catch {
906
+ debug("Could not remove ponytail package dir (scope may hold other packages)");
907
+ }
908
+ const lockPath = path.join(pluginsDir, "omp-plugins.lock.json");
909
+ const lockRaw = await readTextIfExists(lockPath);
910
+ if (lockRaw) {
911
+ try {
912
+ const lock = JSON.parse(lockRaw);
913
+ if (lock.plugins && "@dietrichgebert/ponytail" in lock.plugins) {
914
+ if (shouldDryRun)
915
+ console.log(` [dry-run] would remove @dietrichgebert/ponytail from ${lockPath}`);
916
+ else {
917
+ delete lock.plugins["@dietrichgebert/ponytail"];
918
+ await fs.writeFile(lockPath, JSON.stringify(lock, null, 2) + "\n", "utf8");
919
+ console.log(` [write] Removed @dietrichgebert/ponytail from ${lockPath}`);
920
+ }
921
+ }
922
+ }
923
+ catch {
924
+ debug("Could not update omp-plugins.lock.json for ponytail");
925
+ }
926
+ }
927
+ }
864
928
  // Remove our plugin registration from ~/.omp/plugins
865
- const pluginsDir = path.join(HOME, ".omp", "plugins");
866
929
  const pluginsPkgPath = path.join(pluginsDir, "package.json");
867
930
  const pluginsPkgRaw = await readTextIfExists(pluginsPkgPath);
868
931
  if (pluginsPkgRaw) {