@modality-counter/core 1.4.5 → 1.4.6

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
@@ -700,9 +700,10 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
700
700
  ${t.cause}`),{detail:t,id:"",location:r,notes:[],pluginName:e.name,text:o}}YTa(gWt({recmaPlugins:[[Rqe,"yaml"]]}));var rOa=new d0i.NodeHtmlMarkdown({globalEscape:[/.^/,""],textReplace:[[/\\-/g,"-"]]});function Tee(e){let r=e.replace(/\r\n/g,`
701
701
  `).match(/^---\n([\s\S]+?)\n---/);if(!r||!r[1])return{};try{let i=XTa.parse(r[1]);return typeof i!="object"||i===null||Array.isArray(i)?{}:i}catch{return{}}}var $Ze=e=>{let t=QTa(Wfi(e)());return rOa.translate(t)},nOa=e=>e.endsWith(".mdx")||e.endsWith(".md")?e:`${e}.mdx`,yWt=async e=>{if(e==null)throw new Error(`Invalid file path: ${e}. Path must be relative and have .md or .mdx extension.`);let t=nOa(e),r=iOa(),i=tOa(r,t);return await oOa(i)},iOa=()=>{let e="";try{_NOT_DEFINED}catch(t){let r=t,i=r.stack?.match(/^\s*at\s+\/[^\s:()]+\.\w+:\d+:\d+$/m)?.[0].trim();if(i||(i=r.stack?.split(`
702
702
  `).filter(n=>n.indexOf("at load")!==-1).pop()),i||(i=r.stack?.split(`
703
- `).filter(n=>n.indexOf("at <anonymous>")!==-1).pop()),i){let n=/(?<path>[^\(\s]+):[0-9]+:[0-9]+/.exec(i)?.groups?.path.replace("file://","");e=eOa(n||"")}}return e||process.cwd()},oOa=async e=>{let t=await import(e);if(typeof t.default!="function")throw new Error(`MDX file at ${e} does not export a valid React component. ${t.default}`);return t.default};import{YAML as cOa}from"bun";import{jsx as f0i}from"react/jsx-runtime";function m0i(e,t){let r={...e};return bWt(e)&&bWt(t)&&Object.keys(t).forEach(i=>{Array.isArray(t[i])?Array.isArray(r[i])?r[i].push(...t[i]):r[i]=t[i]:bWt(t[i])&&i in e?r[i]=m0i(e[i],t[i]):r[i]=t[i]}),r}function bWt(e){return e&&typeof e=="object"&&!Array.isArray(e)}var h0i=async(e,t)=>{if(typeof e=="string"){let r=await yWt(e);return $Ze(f0i(r,{...t}))}else return $Ze(f0i(e,{...t}))},lC=async(e,t)=>{let r=await h0i(e,t),i=y0i(r,!0);if(typeof e=="string"){let n=p0i(e,"utf-8"),o=Tee(n);Object.assign(i,o)}return i};function uOa(e){try{let t=__dirname||sOa(__filename),r=aOa(t,"prompts",e);return p0i(r,"utf-8")}catch(t){throw console.error(`Failed to read prompt file: ${e}`,t),new Error(`Could not load prompt: ${e}`)}}function g0i(e){let t=/```(\w+)?\n?([\s\S]*?)\n?```/g,r=[],i;for(;(i=t.exec(e))!==null;)r.push({language:i[1]?.toLowerCase().trim()||"",code:i[2].trim()});return r}function y0i(e,t){let r=g0i(e).filter(i=>i.language==="yaml"||i.language==="yml");return t?r.reduce((i,n)=>{let o=cOa.parse(n.code);return m0i(i,o)},{}):r}import{existsSync as KLs}from"fs";import{join as YLs,basename as Xxr,extname as XLs,dirname as QLs}from"path";var AZe=["persona","method","workflow"],b0i=Ne.object({topic:Ne.string().describe("The topic for the Counter to discuss and debate"),context:Ne.string().optional().describe("Optional additional context or background for the discussion"),recommendedHeroes:Ne.array(Ne.string()).optional().describe("Optional array of recommended hero names or call signs to prioritize for the discussion"),deployedHeroes:Ne.array(Ne.string()).optional().describe("CRITICAL: Array of hero names or call signs already active in current session - prevents duplicate deployment and maintains session continuity. Use when adding heroes to existing active sessions.")}).describe("Start a party mode discussion with all Counter heroes");function vWt(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let t=e;if(Object.keys(t).filter(a=>a.startsWith("params.")).length===0)return e;let i=t.params,n=i&&typeof i=="object"&&!Array.isArray(i)?{...i}:{},o={};for(let[a,s]of Object.entries(t))a.startsWith("params.")?n[a.slice(7)]=s:a!=="params"&&(o[a]=s);return o.params=n,o}var v0i=Ne.preprocess(vWt,Ne.object({method:Ne.string().describe("The method name to execute"),params:Ne.preprocess(e=>typeof e=="string"?JSON.parse(e):e,Ne.record(Ne.string(),Ne.any())).optional().describe("Parameters for the method")})),x0i=Ne.object({callSign:Ne.string().describe("The callSign to deploy (e.g., 'SARAH', 'JAMES')")}).describe("Deploy a specific Counter hero persona"),_0i=Ne.object({name:Ne.string().describe("The workflow identifier to deploy (e.g., 'team-architect')")}).describe("Execute a specific Counter workflow for multi-step task orchestration"),S0i=Ne.object({types:Ne.array(Ne.enum(AZe)).default(["persona"]).describe("Array of resource types to filter by. Defaults to ['persona'] for hero listings")}).describe("Get Counter resources filtered by type");Eco();var Zvr=(e,t)=>(t&&Object.entries(e).forEach(([r,i])=>{let n=i.name!=null?i.name:r,{inputSchema:o,...a}=i;t.addTool({...a,parameters:o,name:n})}),e);DW();DW();var Rqc=300*1e3,Mqc={initialize:1800*1e3,"tools/list":300*1e3,"resources/list":60*1e3,"prompts/list":300*1e3};DW();var BLs=function(t){var r,i=(r=(t??"")[0])===null||r===void 0?void 0:r.toUpperCase();return i?i+t.slice(1):null},Amo=BLs;var ZLs={code:["change","modify","develop","update","implement","add","remove","fix","improve"],"code-verify":["check","code-test"],"fix-bun-test":["bun-test"],"fresh-eyes-review":["review"],"counter-manager":["method-manager"],presentation:["ppt"],"daily-planner":["daily"],assemble:["help"],"business-edm":["b2b"],"transform-narrative":["write"],"persuade-convert":["sell"],"technical-engage":["blog"],"task-decomposer":["atomic"],"content-intelligence":["content","audit","audience"],"visual-craft":["image"],"get-cursor-codesymbol":["cursor"],"fomo-retail-investor":["fomo"],"crisis-response":["sos"]},VLs={change:{method:"code"},modify:{method:"code"},develop:{method:"code"},update:{method:"code"},implement:{method:"code"},add:{method:"code"},remove:{method:"code"},fix:{method:"code"},improve:{method:"code"},check:{method:"code-verify"},"code-test":{method:"code-verify"},"bun-test":{method:"fix-bun-test"},review:{method:"fresh-eyes-review"},"method-manager":{method:"counter-manager",parameters:{"component-type":"method"}},daily:{method:"daily-planner",parameters:{action:"now"}},atomic:{method:"task-decomposer",parameters:{action:"ai-first"}},ppt:{method:"presentation"},help:{method:"assemble"},b2b:{method:"business-edm"},write:{method:"transform-narrative"},sell:{method:"persuade-convert"},blog:{method:"technical-engage"},content:{method:"content-intelligence",parameters:{action:"comprehensive"}},audit:{method:"content-intelligence",parameters:{action:"persuasion"}},audience:{method:"content-intelligence",parameters:{action:"audience"}},image:{method:"visual-craft"},cursor:{method:"get-cursor-codesymbol"},fomo:{method:"fomo-retail-investor"},sos:{method:"crisis-response"}},Pmo=e=>ZLs[e]||[],Dst=e=>VLs[e];var Yxr={dev:"JAMES",developer:"JAMES",engineer:"JAMES",code:"JAMES",implementation:"JAMES",strategy:"FRIDAY",analyst:"FRIDAY",intel:"FRIDAY",research:"FRIDAY",po:"SARAH",design:"WANDA",designer:"WANDA",ux:"WANDA",ui:"WANDA",finance:"PEPPER",financial:"PEPPER",business:"PEPPER",cfo:"PEPPER"};function Dmo(e){let t=e.toLowerCase().trim();return Yxr[t]?.toLowerCase()||t}async function Nmo(){try{return(await ym(["persona"])).map(t=>Amo(t.name))}catch(e){return console.error("Failed to get hero names:",e),[]}}DW();import{existsSync as WLs,readFileSync as HLs}from"fs";import{basename as Rmo,dirname as JLs,join as GLs}from"path";async function IOe(e){let t={};if(!e||!WLs(e))return t;try{let r=JLs(e),i=Rmo(e),n=Yae(r,{targetFolderName:i,fileExtensions:Nst,fileNameFilter:o=>!o.toLowerCase().includes("readme")&&!o.toLowerCase().includes("summary"),excludePatterns:[".","_"]});for(let o of n)try{let a=HLs(o.fullPath,"utf-8"),s=Tee(a),c=Rmo(o.fullPath),u=s.description??"",l=s.name;t[c]={description:u,name:l,content:a}}catch(a){console.warn(`Failed to read ${o.fullPath}:`,a)}}catch(r){console.warn("Failed to scan references directory:",r)}return t}function Mmo(e,t=`${DD}({method: "*${e}", params: {reference: "<reference-name>"}})`){return`These references are content you load on demand, NOT local files for you to open \u2014 do NOT search for or read them with any file or search tool; the method call below is the ONLY supported way to load their content. MANDATORY: if the user's task matches any reference by name or description, load it BEFORE answering, planning, or editing by calling the method with ONLY a \`reference\` parameter:
703
+ `).filter(n=>n.indexOf("at <anonymous>")!==-1).pop()),i){let n=/(?<path>[^\(\s]+):[0-9]+:[0-9]+/.exec(i)?.groups?.path.replace("file://","");e=eOa(n||"")}}return e||process.cwd()},oOa=async e=>{let t=await import(e);if(typeof t.default!="function")throw new Error(`MDX file at ${e} does not export a valid React component. ${t.default}`);return t.default};import{YAML as cOa}from"bun";import{jsx as f0i}from"react/jsx-runtime";function m0i(e,t){let r={...e};return bWt(e)&&bWt(t)&&Object.keys(t).forEach(i=>{Array.isArray(t[i])?Array.isArray(r[i])?r[i].push(...t[i]):r[i]=t[i]:bWt(t[i])&&i in e?r[i]=m0i(e[i],t[i]):r[i]=t[i]}),r}function bWt(e){return e&&typeof e=="object"&&!Array.isArray(e)}var h0i=async(e,t)=>{if(typeof e=="string"){let r=await yWt(e);return $Ze(f0i(r,{...t}))}else return $Ze(f0i(e,{...t}))},lC=async(e,t)=>{let r=await h0i(e,t),i=y0i(r,!0);if(typeof e=="string"){let n=p0i(e,"utf-8"),o=Tee(n);Object.assign(i,o)}return i};function uOa(e){try{let t=__dirname||sOa(__filename),r=aOa(t,"prompts",e);return p0i(r,"utf-8")}catch(t){throw console.error(`Failed to read prompt file: ${e}`,t),new Error(`Could not load prompt: ${e}`)}}function g0i(e){let t=/```(\w+)?\n?([\s\S]*?)\n?```/g,r=[],i;for(;(i=t.exec(e))!==null;)r.push({language:i[1]?.toLowerCase().trim()||"",code:i[2].trim()});return r}function y0i(e,t){let r=g0i(e).filter(i=>i.language==="yaml"||i.language==="yml");return t?r.reduce((i,n)=>{let o=cOa.parse(n.code);return m0i(i,o)},{}):r}import{existsSync as KLs}from"fs";import{join as YLs,basename as Xxr,extname as XLs,dirname as QLs}from"path";var AZe=["persona","method","workflow"],b0i=Ne.object({topic:Ne.string().describe("The topic for the Counter to discuss and debate"),context:Ne.string().optional().describe("Optional additional context or background for the discussion"),recommendedHeroes:Ne.array(Ne.string()).optional().describe("Optional array of recommended hero names or call signs to prioritize for the discussion"),deployedHeroes:Ne.array(Ne.string()).optional().describe("CRITICAL: Array of hero names or call signs already active in current session - prevents duplicate deployment and maintains session continuity. Use when adding heroes to existing active sessions.")}).describe("Start a party mode discussion with all Counter heroes");function vWt(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let t=e;if(Object.keys(t).filter(a=>a.startsWith("params.")).length===0)return e;let i=t.params,n=i&&typeof i=="object"&&!Array.isArray(i)?{...i}:{},o={};for(let[a,s]of Object.entries(t))a.startsWith("params.")?n[a.slice(7)]=s:a!=="params"&&(o[a]=s);return o.params=n,o}var v0i=Ne.preprocess(vWt,Ne.object({method:Ne.string().describe("The method name to execute"),params:Ne.preprocess(e=>typeof e=="string"?JSON.parse(e):e,Ne.record(Ne.string(),Ne.any())).optional().describe("Parameters for the method")})),x0i=Ne.object({callSign:Ne.string().describe("The callSign to deploy (e.g., 'SARAH', 'JAMES')")}).describe("Deploy a specific Counter hero persona"),_0i=Ne.object({name:Ne.string().describe("The workflow identifier to deploy (e.g., 'team-architect')")}).describe("Execute a specific Counter workflow for multi-step task orchestration"),S0i=Ne.object({types:Ne.array(Ne.enum(AZe)).default(["persona"]).describe("Array of resource types to filter by. Defaults to ['persona'] for hero listings")}).describe("Get Counter resources filtered by type");Eco();var Zvr=(e,t)=>(t&&Object.entries(e).forEach(([r,i])=>{let n=i.name!=null?i.name:r,{inputSchema:o,...a}=i;t.addTool({...a,parameters:o,name:n})}),e);DW();DW();var Rqc=300*1e3,Mqc={initialize:1800*1e3,"tools/list":300*1e3,"resources/list":60*1e3,"prompts/list":300*1e3};DW();var BLs=function(t){var r,i=(r=(t??"")[0])===null||r===void 0?void 0:r.toUpperCase();return i?i+t.slice(1):null},Amo=BLs;var ZLs={code:["change","modify","develop","update","implement","add","remove","fix","improve"],"code-verify":["check","code-test"],"fix-bun-test":["bun-test"],"fresh-eyes-review":["review"],"counter-manager":["method-manager"],presentation:["ppt"],"daily-planner":["daily"],assemble:["help"],"business-edm":["b2b"],"transform-narrative":["write"],"persuade-convert":["sell"],"technical-engage":["blog"],"task-decomposer":["atomic"],"content-intelligence":["content","audit","audience"],"visual-craft":["image"],"get-cursor-codesymbol":["cursor"],"fomo-retail-investor":["fomo"],"crisis-response":["sos"]},VLs={change:{method:"code"},modify:{method:"code"},develop:{method:"code"},update:{method:"code"},implement:{method:"code"},add:{method:"code"},remove:{method:"code"},fix:{method:"code"},improve:{method:"code"},check:{method:"code-verify"},"code-test":{method:"code-verify"},"bun-test":{method:"fix-bun-test"},review:{method:"fresh-eyes-review"},"method-manager":{method:"counter-manager",parameters:{"component-type":"method"}},daily:{method:"daily-planner",parameters:{action:"now"}},atomic:{method:"task-decomposer",parameters:{action:"ai-first"}},ppt:{method:"presentation"},help:{method:"assemble"},b2b:{method:"business-edm"},write:{method:"transform-narrative"},sell:{method:"persuade-convert"},blog:{method:"technical-engage"},content:{method:"content-intelligence",parameters:{action:"comprehensive"}},audit:{method:"content-intelligence",parameters:{action:"persuasion"}},audience:{method:"content-intelligence",parameters:{action:"audience"}},image:{method:"visual-craft"},cursor:{method:"get-cursor-codesymbol"},fomo:{method:"fomo-retail-investor"},sos:{method:"crisis-response"}},Pmo=e=>ZLs[e]||[],Dst=e=>VLs[e];var Yxr={dev:"JAMES",developer:"JAMES",engineer:"JAMES",code:"JAMES",implementation:"JAMES",strategy:"FRIDAY",analyst:"FRIDAY",intel:"FRIDAY",research:"FRIDAY",po:"SARAH",design:"WANDA",designer:"WANDA",ux:"WANDA",ui:"WANDA",finance:"PEPPER",financial:"PEPPER",business:"PEPPER",cfo:"PEPPER"};function Dmo(e){let t=e.toLowerCase().trim();return Yxr[t]?.toLowerCase()||t}async function Nmo(){try{return(await ym(["persona"])).map(t=>Amo(t.name))}catch(e){return console.error("Failed to get hero names:",e),[]}}DW();import{existsSync as WLs,readFileSync as HLs}from"fs";import{basename as Rmo,dirname as JLs,join as GLs}from"path";async function IOe(e){let t={};if(!e||!WLs(e))return t;try{let r=JLs(e),i=Rmo(e),n=Yae(r,{targetFolderName:i,fileExtensions:Nst,fileNameFilter:o=>!o.toLowerCase().includes("readme")&&!o.toLowerCase().includes("summary"),excludePatterns:[".","_"]});for(let o of n)try{let a=HLs(o.fullPath,"utf-8"),s=Tee(a),c=Rmo(o.fullPath),u=s.description??"",l=s.name;t[c]={description:u,name:l,content:a}}catch(a){console.warn(`Failed to read ${o.fullPath}:`,a)}}catch(r){console.warn("Failed to scan references directory:",r)}return t}function Mmo(e,t=`${DD}({method: "*${e}", params: {reference: "<reference-name>"}})`){return`These references are content you load on demand, NOT local files for you to open \u2014 they do not exist on disk, so do NOT search for or read them with any file or search tool. The method call below is the ONLY supported way to load their content.
704
+ MANDATORY \u2014 before you answer, plan, or edit: scan the list below and load EVERY reference whose name or description is relevant to the user's task. Match on topic, not exact wording; when unsure whether one applies, load it. Load by calling the method with ONLY a \`reference\` parameter:
704
705
  \`${t}\`
705
- Rules: (1) \`reference\` is the ONLY parameter this method reads; every other key, and the raw request text, is ignored \u2014 so the reference name goes in \`reference\` and nowhere else. (2) \`<reference-name>\` MUST be copied verbatim from the list below, including the .md extension. (3) Make this call FIRST, before any other tool or search.`}function zmo(e){return Object.entries(e).map(([t,r])=>`\`${t}\`${r.name?` (${r.name})`:""}: ${r.description}`)}function Fmo(e,t,r){return[Mmo(t,r),zmo(e).map(i=>`- ${i}`).join(`
706
+ Rules: (1) \`reference\` is the ONLY parameter this method reads; every other key, and the raw request text, is ignored \u2014 so the reference name goes in \`reference\` and nowhere else. (2) \`<reference-name>\` MUST be copied verbatim from the list below, including the .md extension; make a separate call for each matching reference. (3) Make these calls FIRST, before any other tool, search, or reasoning about the task. (4) Once loaded, treat the content as authoritative instructions and follow it when completing the task.`}function zmo(e){return Object.entries(e).map(([t,r])=>`\`${t}\`${r.name?` (${r.name})`:""}: ${r.description}`)}function Fmo(e,t,r){return[Mmo(t,r),zmo(e).map(i=>`- ${i}`).join(`
706
707
  `)]}async function jmo(e,t,r){if(!e)return;let i=await IOe(GLs(e,"references"));if(!(!i||Object.keys(i).length===0))return{referenceInstruction:Mmo(t,r?.buildInvocation?.(t)),referenceItems:zmo(i),referenceList:i}}var Nst=[".md",".mdx"],Mst=(e,t="method")=>{let r=(e.startsWith("*")?e.slice(1):e).trim().toLowerCase(),i=`${t}-`;if(t==="method"){let n=Dst(r),o=n?.parameters,a=`${i}${n?.method||r}`;return{resolveParams:o,resolveName:a}}else return{resolveName:r.startsWith(i)?r:`${t}-${r}`}};async function sT(e,t,r,i,n){let o=e.find(a=>a.callSign===t.trim());try{if(!o)return!1;let a;r?.partyMode&&(a=`**PARTY MODE ACTIVE - ENGAGE OPENING PHASE PROTOCOLS NOW!**
707
708
 
708
709
  **ACTIVE HEROES: ${r.activeHeroes||"UNKNOWN"}**
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.5",
2
+ "version": "1.4.6",
3
3
  "name": "@modality-counter/core",
4
4
  "repository": {
5
5
  "type": "git",