opencode-telegram-link 1.0.0-rc.2 → 1.0.0-rc.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.
@@ -1 +1 @@
1
- {"version":3,"file":"config-helper.d.ts","sourceRoot":"","sources":["../../src/opencode/config-helper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,WAAW,CAAC;AAGtE,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CA6E1E;AAED,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,EAAE,CAgC7E;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAqCjC;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CA+B1E;AAED,wBAAsB,0BAA0B,CAC9C,eAAe,CAAC,EAAE,OAAO,EACzB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CA4FrC;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA0ItD;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAwErD"}
1
+ {"version":3,"file":"config-helper.d.ts","sourceRoot":"","sources":["../../src/opencode/config-helper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,WAAW,CAAC;AAGtE,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CA6E1E;AAED,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,EAAE,CAgC7E;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAqCjC;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CA+B1E;AAED,wBAAsB,0BAA0B,CAC9C,eAAe,CAAC,EAAE,OAAO,EACzB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CA4FrC;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgJtD;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAoFrD"}
package/dist/plugin.js CHANGED
@@ -15923,14 +15923,11 @@ async function injectOpenCodeConfig(targetPath, config2) {
15923
15923
  chatId: config2.telegram.chatId
15924
15924
  };
15925
15925
  }
15926
+ delete existingJson["opencode-telegram-link"];
15927
+ delete existingJson["telegram-link"];
15926
15928
  const isMatch = (entry) => {
15927
- if (typeof entry === "string") {
15928
- return entry === "opencode-telegram-link" || entry.endsWith("opencode-telegram-link");
15929
- }
15930
- if (Array.isArray(entry) && typeof entry[0] === "string") {
15931
- return entry[0] === "opencode-telegram-link" || entry[0].endsWith("opencode-telegram-link");
15932
- }
15933
- return false;
15929
+ const name = typeof entry === "string" ? entry : Array.isArray(entry) && typeof entry[0] === "string" ? entry[0] : "";
15930
+ return name === "opencode-telegram-link" || name.startsWith("opencode-telegram-link") || name.includes("opencode-telegram-link") || name.includes("opencode_notification") || name.includes("telegram-link");
15934
15931
  };
15935
15932
  function mergePluginOptions(existing, updated) {
15936
15933
  const existingObj = existing && typeof existing === "object" && !Array.isArray(existing) ? existing : {};
@@ -15953,19 +15950,15 @@ async function injectOpenCodeConfig(targetPath, config2) {
15953
15950
  return merged;
15954
15951
  }
15955
15952
  if (Array.isArray(existingJson.plugin)) {
15956
- const index = existingJson.plugin.findIndex(isMatch);
15957
- if (index >= 0) {
15958
- const existingEntry = existingJson.plugin[index];
15959
- const existingOptions = Array.isArray(existingEntry) ? existingEntry[1] : undefined;
15960
- const pluginName = Array.isArray(existingEntry) && typeof existingEntry[0] === "string" ? existingEntry[0] : "opencode-telegram-link";
15961
- existingJson.plugin[index] = [pluginName, mergePluginOptions(existingOptions, pluginConfig)];
15962
- } else {
15963
- existingJson.plugin.push(["opencode-telegram-link", pluginConfig]);
15964
- }
15953
+ const existingEntry = existingJson.plugin.find(isMatch);
15954
+ const existingOptions = Array.isArray(existingEntry) ? existingEntry[1] : undefined;
15955
+ const mergedOptions = mergePluginOptions(existingOptions, pluginConfig);
15956
+ const cleanedPlugins = existingJson.plugin.filter((p) => !isMatch(p));
15957
+ cleanedPlugins.push(["opencode-telegram-link", mergedOptions]);
15958
+ existingJson.plugin = cleanedPlugins;
15965
15959
  } else if (Array.isArray(existingJson.plugins)) {
15966
- if (!existingJson.plugins.includes("opencode-telegram-link")) {
15967
- existingJson.plugins.push("opencode-telegram-link");
15968
- }
15960
+ const plugins = existingJson.plugins;
15961
+ existingJson.plugins = [...plugins.filter((p) => !isMatch(p)), "opencode-telegram-link"];
15969
15962
  const existingPluginMap = existingJson.plugin && typeof existingJson.plugin === "object" ? existingJson.plugin : {};
15970
15963
  existingPluginMap["opencode-telegram-link"] = mergePluginOptions(existingPluginMap["opencode-telegram-link"], pluginConfig);
15971
15964
  existingJson.plugin = existingPluginMap;
@@ -15987,14 +15980,17 @@ async function removeOpenCodeConfig(targetPath) {
15987
15980
  const existingJson = parseJsonc(existingContent);
15988
15981
  let modified = false;
15989
15982
  const isPluginMatch = (entry) => {
15990
- if (typeof entry === "string") {
15991
- return entry === "opencode-telegram-link" || entry.endsWith("opencode_notification") || entry.endsWith("opencode-telegram-link");
15992
- }
15993
- if (Array.isArray(entry) && typeof entry[0] === "string") {
15994
- return isPluginMatch(entry[0]);
15995
- }
15996
- return false;
15983
+ const name = typeof entry === "string" ? entry : Array.isArray(entry) && typeof entry[0] === "string" ? entry[0] : "";
15984
+ return name === "opencode-telegram-link" || name.startsWith("opencode-telegram-link") || name.includes("opencode-telegram-link") || name.includes("opencode_notification") || name.includes("telegram-link");
15997
15985
  };
15986
+ if ("opencode-telegram-link" in existingJson) {
15987
+ delete existingJson["opencode-telegram-link"];
15988
+ modified = true;
15989
+ }
15990
+ if ("telegram-link" in existingJson) {
15991
+ delete existingJson["telegram-link"];
15992
+ modified = true;
15993
+ }
15998
15994
  if (Array.isArray(existingJson.plugin)) {
15999
15995
  const originalLength = existingJson.plugin.length;
16000
15996
  const filtered = existingJson.plugin.filter((p) => !isPluginMatch(p));
@@ -16721,7 +16717,7 @@ async function runSessionSpawnCommand(client, directory, command) {
16721
16717
  }
16722
16718
 
16723
16719
  // src/version.ts
16724
- var PACKAGE_VERSION = "1.0.0-rc.2";
16720
+ var PACKAGE_VERSION = "1.0.0-rc.4";
16725
16721
 
16726
16722
  // src/plugin.ts
16727
16723
  function trace(msg) {
@@ -16910,4 +16906,4 @@ export {
16910
16906
  plugin_default as default
16911
16907
  };
16912
16908
 
16913
- //# debugId=A99CDF0C9EBE439D64756E2164756E21
16909
+ //# debugId=AD8C9FBF4329185664756E2164756E21