@mohak34/opencode-notifier 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -843,7 +843,7 @@ function formatTimestamp() {
843
843
  return `${h}:${m}:${s}`;
844
844
  }
845
845
  function extractAgentNameFromSessionTitle(sessionTitle) {
846
- if (!sessionTitle) {
846
+ if (typeof sessionTitle !== "string" || sessionTitle.length === 0) {
847
847
  return "";
848
848
  }
849
849
  const match = sessionTitle.match(/\s*\(@([^\s)]+)\s+subagent\)\s*$/);
@@ -968,9 +968,10 @@ async function getElapsedSinceLastPrompt(client, sessionID, nowMs = Date.now())
968
968
  async function getSessionInfo(client, sessionID) {
969
969
  try {
970
970
  const response = await client.session.get({ path: { id: sessionID } });
971
+ const title = typeof response.data?.title === "string" ? response.data.title : null;
971
972
  return {
972
973
  isChild: !!response.data?.parentID,
973
- title: response.data?.title ?? null
974
+ title
974
975
  };
975
976
  } catch {
976
977
  return { isChild: false, title: null };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohak34/opencode-notifier",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "OpenCode plugin that sends system notifications and plays sounds when permission is needed, generation completes, or errors occur",
5
5
  "author": "mohak34",
6
6
  "license": "MIT",