fix: remove import.meta.url banner from CJS files run by Node.js
The MCP server (#!/usr/bin/env node) and context generator run under Node.js, where import.meta.url throws SyntaxError in CJS mode. Only the worker-service needs the banner since it runs under Bun. CJS files under Node.js already have __dirname/__filename natively. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -824,7 +824,7 @@ View Observations Live @ http://localhost:${i}`:void 0;return{hookSpecificOutput
|
||||
`),s=!1;for(let o=i.length-1;o>=0;o--){let a=JSON.parse(i[o]);if(a.type===e&&(s=!0,a.message?.content)){let c="",u=a.message.content;if(typeof u=="string")c=u;else if(Array.isArray(u))c=u.filter(l=>l.type==="text").map(l=>l.text).join(`
|
||||
`);else throw new Error(`Unknown message content format in transcript. Type: ${typeof u}`);return r&&(c=c.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g,""),c=c.replace(/\n{3,}/g,`
|
||||
|
||||
`).trim()),c}}return""}var vv,O9=Pe(()=>{"use strict";vv=require("fs");oe()});var mge,O$,P$=Pe(()=>{"use strict";qr();oe();O9();gn();mge=Pf(_r.DEFAULT),O$={async execute(t){if(!await en())return{continue:!0,suppressOutput:!0,exitCode:st.SUCCESS};let{sessionId:r,transcriptPath:n}=t;if(!n)return y.debug("HOOK",`No transcriptPath in Stop hook input for session ${r} - skipping summary`),{continue:!0,suppressOutput:!0,exitCode:st.SUCCESS};let i="";try{i=R9(n,"assistant",!0)}catch(o){return y.warn("HOOK",`Failed to extract last assistant message: ${o instanceof Error?o.message:o}`),{continue:!0,suppressOutput:!0,exitCode:st.SUCCESS}}return y.dataIn("HOOK","Stop: Requesting summary",{hasLastAssistantMessage:!!i}),(await jt("/api/sessions/summarize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contentSessionId:r,last_assistant_message:i}),timeoutMs:mge})).ok?(y.debug("HOOK","Summary request sent successfully"),{continue:!0,suppressOutput:!0}):{continue:!0,suppressOutput:!0}}}});var P9,C$,A$=Pe(()=>{"use strict";P9=require("path");qr();gn();C$={async execute(t){if(!await en())return{exitCode:st.SUCCESS};let r=Ur(),n=(0,P9.basename)(t.cwd??process.cwd());try{let i=await jt(`/api/context/inject?project=${encodeURIComponent(n)}&colors=true`);if(!i.ok)return{exitCode:st.SUCCESS};let s=await i.text();process.stderr.write(`
|
||||
`).trim()),c}}return""}var vv,O9=Pe(()=>{"use strict";vv=require("fs");oe()});var mge,O$,P$=Pe(()=>{"use strict";qr();oe();O9();gn();mge=Pf(_r.DEFAULT),O$={async execute(t){if(!await en())return{continue:!0,suppressOutput:!0,exitCode:st.SUCCESS};let{sessionId:r,transcriptPath:n}=t;if(!n)return y.debug("HOOK",`No transcriptPath in Stop hook input for session ${r} - skipping summary`),{continue:!0,suppressOutput:!0,exitCode:st.SUCCESS};let i="";try{i=R9(n,"assistant",!0)}catch(o){return y.warn("HOOK",`Stop hook: failed to extract last assistant message for session ${r}: ${o instanceof Error?o.message:o}`),{continue:!0,suppressOutput:!0,exitCode:st.SUCCESS}}return y.dataIn("HOOK","Stop: Requesting summary",{hasLastAssistantMessage:!!i}),(await jt("/api/sessions/summarize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contentSessionId:r,last_assistant_message:i}),timeoutMs:mge})).ok?(y.debug("HOOK","Summary request sent successfully"),{continue:!0,suppressOutput:!0}):{continue:!0,suppressOutput:!0}}}});var P9,C$,A$=Pe(()=>{"use strict";P9=require("path");qr();gn();C$={async execute(t){if(!await en())return{exitCode:st.SUCCESS};let r=Ur(),n=(0,P9.basename)(t.cwd??process.cwd());try{let i=await jt(`/api/context/inject?project=${encodeURIComponent(n)}&colors=true`);if(!i.ok)return{exitCode:st.SUCCESS};let s=await i.text();process.stderr.write(`
|
||||
|
||||
`+String.fromCodePoint(128221)+` Claude-Mem Context Loaded
|
||||
|
||||
|
||||
Reference in New Issue
Block a user