notemend 0.1.23 → 0.1.25

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
- const O=["before","after"],l=e=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(e))?.[1]??null,D=e=>{const t={};for(const n of e?.images||[]){const o=l(n);o&&(t[o]=n)}return t},d={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},g=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,f=/^(png|jpe?g|webp|gif|webm)$/i,x=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],I=e=>{const t=String(e??"").split(".").pop().toLowerCase(),n=x.find(([,,o])=>o.split(" ").includes(t));return n?{label:n[0],color:n[1]}:{label:"FILE",color:"#717171"}},$=e=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(e??"").split("?")[0]),h=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((e,t)=>[e,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][t]])),E=e=>String(e??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,t=>h[t]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),N=e=>{const t=/\.([a-z0-9]{1,8})$/i.exec(String(e??""));return t&&!g.test(t[1])?t[1].toLowerCase():""},z=e=>{const t=String(e??"");if(t.startsWith("data:")){const s=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(t);if(!s)return null;const r=/;ext=([a-z0-9]{1,8})/i.exec(s[2])?.[1]?.toLowerCase()??Object.keys(d).find(a=>d[a]===s[1]);return r?`${/;name=([\w-]+)/.exec(s[2])?.[1]||"document"}.${r}`:null}const n=t.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(n))return null;const o=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(n);return o&&!f.test(o[2])?`${o[1]||"document"}.${o[2].toLowerCase()}`:null},w=e=>{const t=[{author:"you",text:e.text,at:e.createdAt,by:e.by,byName:e.byName,images:[]},...e.note?[{author:"claude",text:e.note,at:e.updatedAt,images:[]}]:[],...(e.replies||[]).map(n=>({...n,images:[]}))];for(const n of e.images||[]){if(l(n))continue;const o=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(n)?.[1]);let s=0;t.forEach((r,a)=>{Date.parse(r.at)<=o&&(s=a)}),t[s].images.push(n)}return t.filter(n=>!n.deleted)},P=e=>e.nickname||e.name||e.email,c=(e,t)=>{const n="@"+t.toLowerCase();let o=-1;for(let s=e.indexOf(n);s!==-1;s=e.indexOf(n,s+1))/[\p{L}\p{N}_.-]/u.test(e[s+n.length]??"")||(o=s);return o},T=(e,t)=>{const n=String(e||"").toLowerCase();return n.includes("@")?[...new Set(t.filter(o=>[o.name,o.nickname,o.email].some(s=>s&&c(n,s)!==-1)).map(o=>o.email))]:[]},b={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},k=e=>b[e]||(e?"AI agent":"Claude"),_="3.6 3.6 10.8 10.8",A="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",i=e=>typeof e=="string"&&e.startsWith("agent:")?e.slice(6):null,p=e=>e==="claude"||i(e)!=null,L=/^[^\s@]+@[^\s@]+$/,j=e=>{if(e==="claude")return e;if(typeof e!="string"||e.length>210)return null;const t=e.toLowerCase();return L.test(i(t)??t)?t:null},S=["new","approved","progress","review","waiting","accepted"],u=e=>S.includes(e?.stage)?e.stage:p(e?.assignee)?"approved":"new",W=(e,t)=>{const n=i(e.assignee);return u(e)==="approved"&&(!e.assignee||e.assignee==="claude"||n!=null&&(t===void 0||n===t))&&!m(e)},C=()=>[{assignee:"claude",handle:"Claude",owner:null}],B=(e,t=[])=>{const n=String(e||"").toLowerCase();let o=null,s=-1;for(const r of C()){const a=c(n,r.handle);a>s&&(s=a,o=r.assignee)}return o},F=(e,t,n=o=>o)=>k(e)+(t?` \xB7 ${n(t)}`:""),M=2*36e5,v=(e,t=Date.now())=>e?.working&&e.status!=="done"&&t-Date.parse(e.working.at)<M?e.working:null,y=e=>/@guest\.notemend\.com$/i.test(String(e||"")),m=e=>y(e.by)&&!e.approvedBy,G=(e,t=Date.now())=>{if(!e)return null;if(e.status==="done")return e.doneBy==="claude"?"review":p(e.assignee)?"done":null;if(e.stage==="accepted")return p(e.assignee)?"done":null;if(m(e))return"held";if(!p(e.assignee))return null;const n=w(e),o=n[n.length-1];return n.length>1&&o.author==="claude"&&!(e.reopenedAt&&Date.parse(e.reopenedAt)>=Date.parse(o.at))?"asks":v(e,t)?"working":e.working?"stuck":u(e)==="approved"?"queued":null},R={held:0,queued:2,asks:6,working:6,stuck:6,review:10,done:12},H=A.split("M").filter(Boolean).map(e=>{const t=e.match(/[\d.]+/g).map(Number),[n,o]=/H/.test(e)?[t[2],t[1]]:/V/.test(e)?[t[0],t[2]]:[t[2],t[3]];return{d:"M"+e,a:(Math.atan2(n-9,9-o)+2*Math.PI)%(2*Math.PI)}}).sort((e,t)=>e.a-t.a).map(e=>e.d),K={plugin:"Claude Code: /plugin \u2192 Installed \u2192 notemend \u2192 Update now, then /reload-plugins",npx:'run it as npx -y notemend@latest (npx keeps an old copy of plain "notemend"), then restart the agent',project:"npm i -D notemend@latest in the site, then restart the agent",desktop:"Claude Desktop: download app.notemend.com/notemend.mcpb again and open it",source:"pull the notemend repository"},V=(e,t)=>{const n=String(e).split(".").map(Number),o=String(t).split(".").map(Number);for(let s=0;s<3;s++)if((n[s]||0)!==(o[s]||0))return(n[s]||0)>(o[s]||0);return!1},X=(e,t)=>{if(e.archivedAt)return!0;if(!t||e.status!=="done"||e.doneBy==="claude")return!1;const n=Math.max(Date.parse(e.confirmedAt||e.updatedAt||"")||0,...(e.replies||[]).filter(o=>!o.deleted).map(o=>Date.parse(o.at||"")||0));return!!n&&Date.now()-n>t*864e5};export{b as AGENTS,_ as AI_BOX,A as AI_RAYS,H as AI_RAYS_CW,g as BLOCKED,d as DOCS,x as FILE_KINDS,O as FRAMES,S as STAGES,R as STEP_RAYS,K as UPDATE_HOW,M as WORKING_TTL,C as agentHandles,F as agentLabel,B as agentMentioned,k as agentName,i as agentOwner,G as agentStep,X as archivedOf,j as cleanAssignee,z as docOf,E as docSlug,N as fileExt,I as fileKind,W as forAgentOf,l as frameOf,D as framesOf,P as handleOf,m as held,y as isGuest,T as mentionsIn,V as newer,$ as opensInTab,u as stageOf,w as threadOf,p as toAgent,v as workingOn};
1
+ const v=["before","after"],l=e=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(e))?.[1]??null,$=e=>{const t={};for(const n of e?.images||[]){const o=l(n);o&&(t[o]=n)}return t},d={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},m=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,f=/^(png|jpe?g|webp|gif|webm)$/i,x=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],N=e=>{const t=String(e??"").split(".").pop().toLowerCase(),n=x.find(([,,o])=>o.split(" ").includes(t));return n?{label:n[0],color:n[1]}:{label:"FILE",color:"#717171"}},_=e=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(e??"").split("?")[0]),h=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((e,t)=>[e,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][t]])),z=e=>String(e??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,t=>h[t]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),P=e=>{const t=/\.([a-z0-9]{1,8})$/i.exec(String(e??""));return t&&!m.test(t[1])?t[1].toLowerCase():""},T=e=>{const t=String(e??"");if(t.startsWith("data:")){const r=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(t);if(!r)return null;const s=/;ext=([a-z0-9]{1,8})/i.exec(r[2])?.[1]?.toLowerCase()??Object.keys(d).find(a=>d[a]===r[1]);return s?`${/;name=([\w-]+)/.exec(r[2])?.[1]||"document"}.${s}`:null}const n=t.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(n))return null;const o=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(n);return o&&!f.test(o[2])?`${o[1]||"document"}.${o[2].toLowerCase()}`:null},w=e=>{const t=[{author:"you",text:e.text,at:e.createdAt,by:e.by,byName:e.byName,images:[],...e.reactions?{reactions:e.reactions}:{}},...e.note?[{author:"claude",text:e.note,at:e.updatedAt,images:[]}]:[],...(e.replies||[]).map(n=>({...n,images:[]}))];for(const n of e.images||[]){if(l(n))continue;const o=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(n)?.[1]);let r=0;t.forEach((s,a)=>{Date.parse(s.at)<=o&&(r=a)}),t[r].images.push(n)}return t.filter(n=>!n.deleted)},j=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],R=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"],b=/^(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\p{Regional_Indicator}|\u200d|\ufe0f)+$/u,W=e=>typeof e!="string"||!e||e.length>16||!b.test(e)?null:[...new Intl.Segmenter().segment(e)].length===1?e:null,k=20,B=(e,t,n)=>{const o={...e||{}},r=o[t]||[];if(!r.length&&Object.keys(o).length>=k)return null;const s=r.includes(n)?r.filter(a=>a!==n):[...r,n];return s.length?o[t]=s:delete o[t],Object.keys(o).length?o:void 0},F=e=>e.nickname||e.name||e.email,c=(e,t)=>{const n="@"+t.toLowerCase();let o=-1;for(let r=e.indexOf(n);r!==-1;r=e.indexOf(n,r+1))/[\p{L}\p{N}_.-]/u.test(e[r+n.length]??"")||(o=r);return o},G=(e,t)=>{const n=String(e||"").toLowerCase();return n.includes("@")?[...new Set(t.filter(o=>[o.name,o.nickname,o.email].some(r=>r&&c(n,r)!==-1)).map(o=>o.email))]:[]},A={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},S=e=>A[e]||(e?"AI agent":"Claude"),K="3.6 3.6 10.8 10.8",L="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",i=e=>typeof e=="string"&&e.startsWith("agent:")?e.slice(6):null,p=e=>e==="claude"||i(e)!=null,M=/^[^\s@]+@[^\s@]+$/,H=e=>{if(e==="claude")return e;if(typeof e!="string"||e.length>210)return null;const t=e.toLowerCase();return M.test(i(t)??t)?t:null},O=["new","approved","progress","review","waiting"],u=e=>O.includes(e?.stage)?e.stage:e?.stage==="accepted"?"review":p(e?.assignee)?"approved":"new",C=e=>e?.client===!0||e?.shared===!0,V=(e,t)=>{const n=i(e.assignee);return!C(e)&&u(e)==="approved"&&(!e.assignee||e.assignee==="claude"||n!=null&&(t===void 0||n===t))&&!g(e)},I=()=>[{assignee:"claude",handle:"Claude",owner:null}],X=(e,t=[])=>{const n=String(e||"").toLowerCase();let o=null,r=-1;for(const s of I()){const a=c(n,s.handle);a>r&&(r=a,o=s.assignee)}return o},Y=(e,t,n=o=>o)=>S(e)+(t?` \xB7 ${n(t)}`:""),y=2*36e5,E=(e,t=Date.now())=>e?.working&&e.status!=="done"&&t-Date.parse(e.working.at)<y?e.working:null,D=e=>/@guest\.notemend\.com$/i.test(String(e||"")),g=e=>D(e.by)&&!e.approvedBy,U=(e,t=Date.now())=>{if(!e)return null;if(e.status==="done")return e.doneBy==="claude"?"review":p(e.assignee)?"done":null;if(g(e))return"held";if(!p(e.assignee))return null;const n=w(e),o=n[n.length-1];return n.length>1&&o.author==="claude"&&!(e.reopenedAt&&Date.parse(e.reopenedAt)>=Date.parse(o.at))?"asks":E(e,t)?"working":e.working?"stuck":u(e)==="approved"?"queued":null},q={held:0,queued:2,asks:6,working:6,stuck:6,review:10,done:12},J=L.split("M").filter(Boolean).map(e=>{const t=e.match(/[\d.]+/g).map(Number),[n,o]=/H/.test(e)?[t[2],t[1]]:/V/.test(e)?[t[0],t[2]]:[t[2],t[3]];return{d:"M"+e,a:(Math.atan2(n-9,9-o)+2*Math.PI)%(2*Math.PI)}}).sort((e,t)=>e.a-t.a).map(e=>e.d),Q={plugin:"Claude Code: /plugin \u2192 Installed \u2192 notemend \u2192 Update now, then /reload-plugins",npx:'run it as npx -y notemend@latest (npx keeps an old copy of plain "notemend"), then restart the agent',project:"npm i -D notemend@latest in the site, then restart the agent",desktop:"Claude Desktop: download app.notemend.com/notemend.mcpb again and open it",source:"pull the notemend repository"},Z=(e,t)=>{const n=String(e).split(".").map(Number),o=String(t).split(".").map(Number);for(let r=0;r<3;r++)if((n[r]||0)!==(o[r]||0))return(n[r]||0)>(o[r]||0);return!1},ee=(e,t)=>{if(e.archivedAt)return!0;if(!t||e.status!=="done"||e.doneBy==="claude")return!1;const n=Math.max(Date.parse(e.confirmedAt||e.updatedAt||"")||0,...(e.replies||[]).filter(o=>!o.deleted).map(o=>Date.parse(o.at||"")||0));return!!n&&Date.now()-n>t*864e5};export{A as AGENTS,K as AI_BOX,L as AI_RAYS,J as AI_RAYS_CW,m as BLOCKED,d as DOCS,R as EMOJI,x as FILE_KINDS,v as FRAMES,k as MAX_REACTIONS,j as QUICK,O as STAGES,q as STEP_RAYS,Q as UPDATE_HOW,y as WORKING_TTL,I as agentHandles,Y as agentLabel,X as agentMentioned,S as agentName,i as agentOwner,U as agentStep,ee as archivedOf,H as cleanAssignee,W as cleanEmoji,C as clientSpace,T as docOf,z as docSlug,P as fileExt,N as fileKind,V as forAgentOf,l as frameOf,$ as framesOf,F as handleOf,g as held,D as isGuest,G as mentionsIn,Z as newer,_ as opensInTab,u as stageOf,w as threadOf,p as toAgent,B as toggledReaction,E as workingOn};
package/thread.d.ts CHANGED
@@ -20,7 +20,8 @@ export function cleanAssignee(v: unknown): string | null;
20
20
  export const STAGES: string[];
21
21
  export function stageOf(c: { stage?: string | null; assignee?: string | null } | null | undefined): "new" | "approved" | "progress" | "review" | "waiting" | "accepted";
22
22
  /** A thread for the agent running as `me` (null: a CI key, the shared queue only; undefined: a local store, all) */
23
- export function forAgentOf(c: { assignee?: string | null; stage?: string | null; by?: string | null; approvedBy?: string | null }, me?: string | null): boolean;
23
+ export function forAgentOf(c: { assignee?: string | null; stage?: string | null; by?: string | null; approvedBy?: string | null; shared?: boolean | null; client?: boolean | null }, me?: string | null): boolean;
24
+ export function clientSpace(c: { shared?: boolean | null; client?: boolean | null } | null | undefined): boolean;
24
25
  /** "Claude · Ann": the agent, and the person it ran as */
25
26
  export function agentLabel(agent?: string | null, owner?: string | null, nameOf?: (email: string) => string): string;
26
27
  export type Working = { agent: string; by?: string | null; at: string; v?: string };
@@ -68,8 +69,19 @@ export const FRAMES: ('before' | 'after')[];
68
69
  export function frameOf(path: string): 'before' | 'after' | null;
69
70
  /** A thread's latest frame of each kind */
70
71
  export function framesOf(c: { images?: string[] } | null | undefined): { before?: string; after?: string };
71
- export type ThreadMessage = { author: string; text: string; at?: string | null; by?: string; byName?: string; agent?: string; deleted?: boolean; images: string[] };
72
+ /** Who reacted with what: emoji → their emails */
73
+ export type Reactions = Record<string, string[]>;
74
+ /** The card's first row of reactions, and the emoji behind "more" (the composer's too) */
75
+ export const QUICK: string[];
76
+ export const EMOJI: string[];
77
+ /** One emoji (a single grapheme of emoji code points), else null */
78
+ export function cleanEmoji(v: unknown): string | null;
79
+ /** The most kinds of reaction a message holds */
80
+ export const MAX_REACTIONS: number;
81
+ /** The reactions with `who`'s `emoji` toggled — undefined when none is left, null past MAX_REACTIONS kinds */
82
+ export function toggledReaction(reactions: Reactions | null | undefined, emoji: string, who: string): Reactions | undefined | null;
83
+ export type ThreadMessage = { author: string; text: string; at?: string | null; by?: string; byName?: string; agent?: string; deleted?: boolean; reactions?: Reactions; images: string[] };
72
84
  /** The comment, the note and the replies in order, each with the screenshots sent with it; deleted replies left out */
73
- export function threadOf(c: { text: string; createdAt?: string; by?: string; byName?: string; note?: string; updatedAt?: string | null; replies?: Record<string, any>[]; images?: string[] }): ThreadMessage[];
85
+ export function threadOf(c: { text: string; reactions?: Reactions; createdAt?: string; by?: string; byName?: string; note?: string; updatedAt?: string | null; replies?: Record<string, any>[]; images?: string[] }): ThreadMessage[];
74
86
  /** Put away: archived by a person, or resolved by one `days` ago with nobody saying a word since (the project's auto-archive). */
75
87
  export function archivedOf(c: { archivedAt?: string | null; status?: string; doneBy?: string | null; confirmedAt?: string | null; updatedAt?: string | null; replies?: { at?: string; deleted?: boolean }[] }, days?: number | null): boolean;