notemend 0.1.24 → 0.1.26
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/.claude-plugin/plugin.json +1 -1
- package/bin/notemend.mjs +15 -15
- package/package.json +1 -1
- package/src/client/index.js +131 -115
- package/src/client/notemend.css +1 -1
- package/src/server/middleware.mjs +1 -1
- package/src/store/cloud.mjs +3 -3
- package/src/store/comments.mjs +3 -3
- package/src/store/status.mjs +1 -1
- package/src/store/thread.mjs +1 -1
- package/store.d.ts +2 -0
- package/thread.d.ts +21 -3
package/src/store/status.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o=e=>e.status!=="done"?"open":e.doneBy==="claude"?"claude":"done",n={open:"Open",done:"Resolved",claude:"
|
|
1
|
+
const o=e=>e.status!=="done"?"open":e.doneBy==="claude"?"claude":"done",n={open:"Open",done:"Resolved",claude:"To check"};export{n as STATE_LABEL,o as stateOf};
|
package/src/store/thread.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const j=["before","after"],u=e=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(e))?.[1]??null,z=e=>{const t={};for(const n of e?.images||[]){const o=u(n);o&&(t[o]=n)}return t},g={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},w=/^(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,b=/^(png|jpe?g|webp|gif|webm)$/i,k=[["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"]],T=e=>{const t=String(e??"").split(".").pop().toLowerCase(),n=k.find(([,,o])=>o.split(" ").includes(t));return n?{label:n[0],color:n[1]}:{label:"FILE",color:"#717171"}},B=e=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(e??"").split("?")[0]),L=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]])),F=e=>String(e??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,t=>L[t]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),W=e=>{const t=/\.([a-z0-9]{1,8})$/i.exec(String(e??""));return t&&!w.test(t[1])?t[1].toLowerCase():""},G=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(g).find(a=>g[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&&!b.test(o[2])?`${o[1]||"document"}.${o[2].toLowerCase()}`:null},S=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(u(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)},H=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],K=["\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"],y=/^(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\p{Regional_Indicator}|\u200d|\ufe0f)+$/u,U=e=>typeof e!="string"||!e||e.length>16||!y.test(e)?null:[...new Intl.Segmenter().segment(e)].length===1?e:null,A=20,V=(e,t,n)=>{const o={...e||{}},r=o[t]||[];if(!r.length&&Object.keys(o).length>=A)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},X=e=>e.nickname||e.name||e.email,m=(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},Y=(e,t)=>{const n=String(e||"").toLowerCase();return n.includes("@")?[...new Set(t.filter(o=>[o.name,o.nickname,o.email].some(r=>r&&m(n,r)!==-1)).map(o=>o.email))]:[]},C=/https?:\/\/[^\s<>"']+/g,f=e=>{const t=e.filter(Boolean).pop();try{return t?decodeURIComponent(t):""}catch{return t}},M=e=>{let t;try{t=new URL(e)}catch{return{label:String(e),kind:"link"}}const n=t.hostname.replace(/^www\./,""),o=t.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(n))return{label:o[2]?`Figma \xB7 ${f([o[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(n==="github.com"&&o.length){const[s,a,c,d]=o;return{label:`GitHub \xB7 ${a??s}${/^(pull|issues)$/.test(c??"")&&d?` #${d}`:""}`,kind:c==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(n))return{label:"Loom",kind:"link"};const r=f(o);return{label:r?`${n} \xB7 ${r.length>32?r.slice(0,31)+"\u2026":r}`:n,kind:"link"}},O=e=>{const t=String(e??""),n=[];let o=0;for(const r of t.matchAll(C)){const s=r[0].replace(/[.,;:!?)\]]+$/,"");r.index>o&&n.push(t.slice(o,r.index)),n.push({url:s,...M(s)}),o=r.index+s.length}return o<t.length&&n.push(t.slice(o)),n},q=e=>O(e).map(t=>typeof t=="string"?t:t.label).join(""),$={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},I=e=>$[e]||(e?"AI agent":"Claude"),J="3.6 3.6 10.8 10.8",E="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,l=e=>e==="claude"||i(e)!=null,D=/^[^\s@]+@[^\s@]+$/,Q=e=>{if(e==="claude")return e;if(typeof e!="string"||e.length>210)return null;const t=e.toLowerCase();return D.test(i(t)??t)?t:null},v=["new","approved","progress","review","waiting"],x=e=>v.includes(e?.stage)?e.stage:e?.stage==="accepted"?"review":l(e?.assignee)?"approved":"new",N=e=>e?.client===!0||e?.shared===!0,Z=(e,t)=>{const n=i(e.assignee);return!N(e)&&x(e)==="approved"&&(!e.assignee||e.assignee==="claude"||n!=null&&(t===void 0||n===t))&&!p(e)},_=()=>[{assignee:"claude",handle:"Claude",owner:null}],ee=(e,t=[])=>{const n=String(e||"").toLowerCase();let o=null,r=-1;for(const s of _()){const a=m(n,s.handle);a>r&&(r=a,o=s.assignee)}return o},te=(e,t,n=o=>o)=>I(e)+(t?` \xB7 ${n(t)}`:""),P=2*36e5,h=(e,t=Date.now())=>e?.working&&e.status!=="done"&&t-Date.parse(e.working.at)<P?e.working:null,ne=(e,t,n=Date.now())=>{const o=String(e?.by||e?.byName||"").toLowerCase();if(!o||t==="done")return null;const r=t==="claude"||l(e.assignee),s=p(e)?"":r?h(e,n)?.by||e.doneFor||e.handedBy||i(e.assignee)||o:e.assignee||"";return{writer:o,taker:String(s).toLowerCase(),claude:r}},R=e=>/@guest\.notemend\.com$/i.test(String(e||"")),p=e=>R(e.by)&&!e.approvedBy,oe=(e,t=Date.now())=>{if(!e)return null;if(e.status==="done")return e.doneBy==="claude"?"review":l(e.assignee)?"done":null;if(p(e))return"held";if(!l(e.assignee))return null;const n=S(e),o=n[n.length-1];return n.length>1&&o.author==="claude"&&!(e.reopenedAt&&Date.parse(e.reopenedAt)>=Date.parse(o.at))?"asks":h(e,t)?"working":e.working?"stuck":x(e)==="approved"?"queued":null},re={held:0,queued:2,asks:6,working:6,stuck:6,review:10,done:12},se=E.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),ae={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"},ie=(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},le=(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{$ as AGENTS,J as AI_BOX,E as AI_RAYS,se as AI_RAYS_CW,w as BLOCKED,g as DOCS,K as EMOJI,k as FILE_KINDS,j as FRAMES,A as MAX_REACTIONS,H as QUICK,v as STAGES,re as STEP_RAYS,ae as UPDATE_HOW,P as WORKING_TTL,_ as agentHandles,te as agentLabel,ee as agentMentioned,I as agentName,i as agentOwner,oe as agentStep,le as archivedOf,Q as cleanAssignee,U as cleanEmoji,N as clientSpace,G as docOf,F as docSlug,W as fileExt,T as fileKind,Z as forAgentOf,u as frameOf,z as framesOf,X as handleOf,p as held,R as isGuest,M as linkLabel,O as linkParts,q as linkWords,Y as mentionsIn,ie as newer,B as opensInTab,ne as pinWho,x as stageOf,S as threadOf,l as toAgent,V as toggledReaction,h as workingOn};
|
package/store.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface Comment {
|
|
|
27
27
|
confirmedBy?: string | null; confirmedAt?: string | null;
|
|
28
28
|
/** the person the agent ran as when it resolved it */
|
|
29
29
|
doneFor?: string | null;
|
|
30
|
+
/** who handed it to an agent — whose Claude its pin shows (the server sets it) */
|
|
31
|
+
handedBy?: string | null;
|
|
30
32
|
/** a guest's thread, approved by the studio */
|
|
31
33
|
approvedBy?: string | null;
|
|
32
34
|
/** the copy of the site it was written on — live, staging, localhost — as host[:port] */
|
package/thread.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ export type Mentionable = { email: string; name?: string | null; nickname?: stri
|
|
|
3
3
|
export function handleOf(p: Mentionable): string;
|
|
4
4
|
/** Everyone a text @mentions, by email */
|
|
5
5
|
export function mentionsIn(text: string, people: Mentionable[]): string[];
|
|
6
|
+
/** A link named the way a message shows it: "Figma · Notemend", "GitHub · notemend #42", or the host and the last part */
|
|
7
|
+
export function linkLabel(url: string): { label: string; kind: "link" | "github" | "pr" };
|
|
8
|
+
/** A text cut into its words and its links, in order */
|
|
9
|
+
export function linkParts(text: string | null | undefined): (string | { url: string; label: string; kind: "link" | "github" | "pr" })[];
|
|
10
|
+
/** The text with each link as its name, for a one-line preview */
|
|
11
|
+
export function linkWords(text: string | null | undefined): string;
|
|
6
12
|
/** Display names of the coding agents, by id */
|
|
7
13
|
export const AGENTS: Record<string, string>;
|
|
8
14
|
/** The name to show for an agent's message: its `agent`, or Claude when there is none */
|
|
@@ -20,7 +26,8 @@ export function cleanAssignee(v: unknown): string | null;
|
|
|
20
26
|
export const STAGES: string[];
|
|
21
27
|
export function stageOf(c: { stage?: string | null; assignee?: string | null } | null | undefined): "new" | "approved" | "progress" | "review" | "waiting" | "accepted";
|
|
22
28
|
/** 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;
|
|
29
|
+
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;
|
|
30
|
+
export function clientSpace(c: { shared?: boolean | null; client?: boolean | null } | null | undefined): boolean;
|
|
24
31
|
/** "Claude · Ann": the agent, and the person it ran as */
|
|
25
32
|
export function agentLabel(agent?: string | null, owner?: string | null, nameOf?: (email: string) => string): string;
|
|
26
33
|
export type Working = { agent: string; by?: string | null; at: string; v?: string };
|
|
@@ -68,8 +75,19 @@ export const FRAMES: ('before' | 'after')[];
|
|
|
68
75
|
export function frameOf(path: string): 'before' | 'after' | null;
|
|
69
76
|
/** A thread's latest frame of each kind */
|
|
70
77
|
export function framesOf(c: { images?: string[] } | null | undefined): { before?: string; after?: string };
|
|
71
|
-
|
|
78
|
+
/** Who reacted with what: emoji → their emails */
|
|
79
|
+
export type Reactions = Record<string, string[]>;
|
|
80
|
+
/** The card's first row of reactions, and the emoji behind "more" (the composer's too) */
|
|
81
|
+
export const QUICK: string[];
|
|
82
|
+
export const EMOJI: string[];
|
|
83
|
+
/** One emoji (a single grapheme of emoji code points), else null */
|
|
84
|
+
export function cleanEmoji(v: unknown): string | null;
|
|
85
|
+
/** The most kinds of reaction a message holds */
|
|
86
|
+
export const MAX_REACTIONS: number;
|
|
87
|
+
/** The reactions with `who`'s `emoji` toggled — undefined when none is left, null past MAX_REACTIONS kinds */
|
|
88
|
+
export function toggledReaction(reactions: Reactions | null | undefined, emoji: string, who: string): Reactions | undefined | null;
|
|
89
|
+
export type ThreadMessage = { author: string; text: string; at?: string | null; by?: string; byName?: string; agent?: string; deleted?: boolean; reactions?: Reactions; images: string[] };
|
|
72
90
|
/** 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[];
|
|
91
|
+
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
92
|
/** Put away: archived by a person, or resolved by one `days` ago with nobody saying a word since (the project's auto-archive). */
|
|
75
93
|
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;
|