@modality-counter/core 1.4.2 → 1.4.4

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 +6 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -700,7 +700,9 @@ 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}}KTa(gWt({recmaPlugins:[[Rqe,"yaml"]]}));var tOa=new l0i.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=YTa.parse(r[1]);return typeof i!="object"||i===null||Array.isArray(i)?{}:i}catch{return{}}}var $Ze=e=>{let t=XTa(Vfi(e)());return tOa.translate(t)},rOa=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=rOa(e),r=nOa(),i=eOa(r,t);return await iOa(i)},nOa=()=>{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=QTa(n||"")}}return e||process.cwd()},iOa=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 sOa}from"bun";import{jsx as d0i}from"react/jsx-runtime";function p0i(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]=p0i(e[i],t[i]):r[i]=t[i]}),r}function bWt(e){return e&&typeof e=="object"&&!Array.isArray(e)}var m0i=async(e,t)=>{if(typeof e=="string"){let r=await yWt(e);return $Ze(d0i(r,{...t}))}else return $Ze(d0i(e,{...t}))},lC=async(e,t)=>{let r=await m0i(e,t),i=g0i(r,!0);if(typeof e=="string"){let n=f0i(e,"utf-8"),o=Tee(n);Object.assign(i,o)}return i};function cOa(e){try{let t=__dirname||aOa(__filename),r=oOa(t,"prompts",e);return f0i(r,"utf-8")}catch(t){throw console.error(`Failed to read prompt file: ${e}`,t),new Error(`Could not load prompt: ${e}`)}}function h0i(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 g0i(e,t){let r=h0i(e).filter(i=>i.language==="yaml"||i.language==="yml");return t?r.reduce((i,n)=>{let o=sOa.parse(n.code);return p0i(i,o)},{}):r}import{existsSync as GLs}from"fs";import{join as KLs,basename as Yxr,extname as YLs,dirname as XLs}from"path";var AZe=["persona","method","workflow"],y0i=Re.object({topic:Re.string().describe("The topic for the Counter to discuss and debate"),context:Re.string().optional().describe("Optional additional context or background for the discussion"),recommendedHeroes:Re.array(Re.string()).optional().describe("Optional array of recommended hero names or call signs to prioritize for the discussion"),deployedHeroes:Re.array(Re.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"),b0i=Re.object({method:Re.string().describe("The method name to execute"),params:Re.preprocess(e=>typeof e=="string"?JSON.parse(e):e,Re.record(Re.string(),Re.any())).optional().describe("Parameters for the method")}),v0i=Re.object({callSign:Re.string().describe("The callSign to deploy (e.g., 'SARAH', 'JAMES')")}).describe("Deploy a specific Counter hero persona"),x0i=Re.object({name:Re.string().describe("The workflow identifier to deploy (e.g., 'team-architect')")}).describe("Execute a specific Counter workflow for multi-step task orchestration"),_0i=Re.object({types:Re.array(Re.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");kco();var Bvr=(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 Nqc=300*1e3,Rqc={initialize:1800*1e3,"tools/list":300*1e3,"resources/list":60*1e3,"prompts/list":300*1e3};DW();var qLs=function(t){var r,i=(r=(t??"")[0])===null||r===void 0?void 0:r.toUpperCase();return i?i+t.slice(1):null},$mo=qLs;var BLs={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"]},ZLs={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"}},Amo=e=>BLs[e]||[],Dst=e=>ZLs[e];var Kxr={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 Pmo(e){let t=e.toLowerCase().trim();return Kxr[t]?.toLowerCase()||t}async function Dmo(){try{return(await ym(["persona"])).map(t=>$mo(t.name))}catch(e){return console.error("Failed to get hero names:",e),[]}}DW();import{existsSync as VLs,readFileSync as WLs}from"fs";import{basename as Nmo,dirname as HLs,join as JLs}from"path";async function IOe(e){let t={};if(!e||!VLs(e))return t;try{let r=HLs(e),i=Nmo(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=WLs(o.fullPath,"utf-8"),s=Tee(a),c=Nmo(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 Rmo(e,t=`${DD}({method: "*${e}", params: {reference: "<reference-name>"}})`){return`These references are NOT files on disk \u2014 they are server-side content. MANDATORY: If the user's task matches any reference by name or description, load it BEFORE answering, planning, or editing files by calling: \`${t}\` where \`<reference-name>\` is copied verbatim from the list below, including the .md extension.`}function Mmo(e){return Object.entries(e).map(([t,r])=>`\`${t}\`${r.name?` (${r.name})`:""}: ${r.description}`)}function zmo(e,t,r){return[Rmo(t,r),Mmo(e).map(i=>`- ${i}`).join(`
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=QTa(n||"")}}return e||process.cwd()},iOa=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 sOa}from"bun";import{jsx as d0i}from"react/jsx-runtime";function p0i(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]=p0i(e[i],t[i]):r[i]=t[i]}),r}function bWt(e){return e&&typeof e=="object"&&!Array.isArray(e)}var m0i=async(e,t)=>{if(typeof e=="string"){let r=await yWt(e);return $Ze(d0i(r,{...t}))}else return $Ze(d0i(e,{...t}))},lC=async(e,t)=>{let r=await m0i(e,t),i=g0i(r,!0);if(typeof e=="string"){let n=f0i(e,"utf-8"),o=Tee(n);Object.assign(i,o)}return i};function cOa(e){try{let t=__dirname||aOa(__filename),r=oOa(t,"prompts",e);return f0i(r,"utf-8")}catch(t){throw console.error(`Failed to read prompt file: ${e}`,t),new Error(`Could not load prompt: ${e}`)}}function h0i(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 g0i(e,t){let r=h0i(e).filter(i=>i.language==="yaml"||i.language==="yml");return t?r.reduce((i,n)=>{let o=sOa.parse(n.code);return p0i(i,o)},{}):r}import{existsSync as GLs}from"fs";import{join as KLs,basename as Yxr,extname as YLs,dirname as XLs}from"path";var AZe=["persona","method","workflow"],y0i=Re.object({topic:Re.string().describe("The topic for the Counter to discuss and debate"),context:Re.string().optional().describe("Optional additional context or background for the discussion"),recommendedHeroes:Re.array(Re.string()).optional().describe("Optional array of recommended hero names or call signs to prioritize for the discussion"),deployedHeroes:Re.array(Re.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"),b0i=Re.object({method:Re.string().describe("The method name to execute"),params:Re.preprocess(e=>typeof e=="string"?JSON.parse(e):e,Re.record(Re.string(),Re.any())).optional().describe("Parameters for the method")}),v0i=Re.object({callSign:Re.string().describe("The callSign to deploy (e.g., 'SARAH', 'JAMES')")}).describe("Deploy a specific Counter hero persona"),x0i=Re.object({name:Re.string().describe("The workflow identifier to deploy (e.g., 'team-architect')")}).describe("Execute a specific Counter workflow for multi-step task orchestration"),_0i=Re.object({types:Re.array(Re.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");kco();var Bvr=(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 Nqc=300*1e3,Rqc={initialize:1800*1e3,"tools/list":300*1e3,"resources/list":60*1e3,"prompts/list":300*1e3};DW();var qLs=function(t){var r,i=(r=(t??"")[0])===null||r===void 0?void 0:r.toUpperCase();return i?i+t.slice(1):null},$mo=qLs;var BLs={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"]},ZLs={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"}},Amo=e=>BLs[e]||[],Dst=e=>ZLs[e];var Kxr={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 Pmo(e){let t=e.toLowerCase().trim();return Kxr[t]?.toLowerCase()||t}async function Dmo(){try{return(await ym(["persona"])).map(t=>$mo(t.name))}catch(e){return console.error("Failed to get hero names:",e),[]}}DW();import{existsSync as VLs,readFileSync as WLs}from"fs";import{basename as Nmo,dirname as HLs,join as JLs}from"path";async function IOe(e){let t={};if(!e||!VLs(e))return t;try{let r=HLs(e),i=Nmo(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=WLs(o.fullPath,"utf-8"),s=Tee(a),c=Nmo(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 Rmo(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:
704
+ \`${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 Mmo(e){return Object.entries(e).map(([t,r])=>`\`${t}\`${r.name?` (${r.name})`:""}: ${r.description}`)}function zmo(e,t,r){return[Rmo(t,r),Mmo(e).map(i=>`- ${i}`).join(`
704
706
  `)]}async function Fmo(e,t,r){if(!e)return;let i=await IOe(JLs(e,"references"));if(!(!i||Object.keys(i).length===0))return{referenceInstruction:Rmo(t,r?.buildInvocation?.(t)),referenceItems:Mmo(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!**
705
707
 
706
708
  **ACTIVE HEROES: ${r.activeHeroes||"UNKNOWN"}**
@@ -894,15 +896,15 @@ ${Vqs(c,{depth:null,colors:!0})}
894
896
  `)}async function tBs(e,t,r="skill"){let i=(await ym(["method"],t)).sort((s,c)=>s.id.localeCompare(c.id)),n=i[0]?.id,o=i[1]?.id,a=[`${e} ${r}`];return n&&(a.push(`${e} ${r} ${n}`),a.push(`${e} ${r} ${n} --help`)),o&&a.push(`${e} ${r} ${o}`),{usage:[`${e} ${r} <method-name>`,`${e} ${r} <method-name> --help`,`${e} ${r} <method-name> --refs`,`${e} ${r}${" ".repeat(20)}(list available methods)`],examples:a}}function rBs(e,t,r=Qqs,i="skill"){return async n=>{let o=n[0],a=n.includes("--help")||n.includes("-h");if(!o||o.startsWith("-")||!a)return!1;let s=await ym(["method"],t),c=s.find(u=>u.id===o);return c||(console.error(`Method '${o}' not found.`),s.length>0&&console.error(`Available: ${s.map(u=>u.id).join(", ")}`),process.exit(1)),console.log(await eBs(e,i,c,r)),!0}}var bm={ARRAY_MIN_ITEMS:1,ARRAY_MAX_ITEMS:20,GROUP_MIN_COUNT:2,GROUP_MAX_COUNT:5,ITEM_MIN_LENGTH:30,ITEM_MAX_LENGTH:200,GROUP_ITEM_MAX:6,GROUP_ITEM_MIN:1,TOTAL_ITEMS_MIN:3,TOTAL_ITEMS_MAX:20,GROUP_NAME_PATTERN:/^[a-z0-9-]+$/};var iCe={MIN_LENGTH:20,MAX_LENGTH:500};var zct=Re.lazy(()=>Re.union([Re.string().min(1,"Execution flow step cannot be empty"),Re.array(Re.lazy(()=>zct)).min(1,"Nested array must contain at least one step").max(10,"Nested array should not exceed 10 steps for clarity")])),OD=Re.array(zct).min(1,"Execution flow must contain at least one step").max(15,"Execution flow should not exceed 15 steps for clarity").optional();var Ayo=Re.string().min(bm.ITEM_MIN_LENGTH,`Output item should be at least ${bm.ITEM_MIN_LENGTH} characters`).max(bm.ITEM_MAX_LENGTH,`Output item should not exceed ${bm.ITEM_MAX_LENGTH} characters`).regex(/^[A-Z]/,"Output item should start with capital letter").refine(e=>![/comprehensive analysis/i,/detailed report/i,/complete overview/i,/thorough assessment/i].some(r=>r.test(e)),"Output item contains generic phrase - be more specific"),nBs=Re.array(Ayo).min(bm.ARRAY_MIN_ITEMS,`Expected output should contain at least ${bm.ARRAY_MIN_ITEMS} items`).max(bm.ARRAY_MAX_ITEMS,`Expected output should not exceed ${bm.ARRAY_MAX_ITEMS} items for readability`),iBs=Re.record(Re.string().regex(bm.GROUP_NAME_PATTERN,"Group name should be lowercase with dashes and numbers only"),Re.array(Ayo).min(bm.GROUP_ITEM_MIN,`Group should contain at least ${bm.GROUP_ITEM_MIN} item`).max(bm.GROUP_ITEM_MAX,`Group should not exceed ${bm.GROUP_ITEM_MAX} items for optimal cognitive load`)).refine(e=>Object.keys(e).length>=bm.GROUP_MIN_COUNT,`Nested expected_output should contain at least ${bm.GROUP_MIN_COUNT} groups`).refine(e=>Object.keys(e).length<=bm.GROUP_MAX_COUNT,`Nested expected_output should not exceed ${bm.GROUP_MAX_COUNT} groups for readability`).refine(e=>Object.values(e).reduce((r,i)=>r+i.length,0)>=bm.TOTAL_ITEMS_MIN,`Total items across all groups should be at least ${bm.TOTAL_ITEMS_MIN}`).refine(e=>Object.values(e).reduce((r,i)=>r+i.length,0)<=bm.TOTAL_ITEMS_MAX,`Total items across all groups should not exceed ${bm.TOTAL_ITEMS_MAX} for readability`),oBs=Re.union([nBs,iBs]),aBs=Re.string().min(iCe.MIN_LENGTH,`Purpose field should be at least ${iCe.MIN_LENGTH} characters`).max(iCe.MAX_LENGTH,`Purpose field should not exceed ${iCe.MAX_LENGTH} characters`).regex(/^[A-Z]/,"Purpose should start with capital letter").regex(/[.!]$/,"Purpose should end with punctuation"),sBs=Re.object({description:Re.string().min(1,"Parameter description is required"),type:Re.enum(["string","number","integer","boolean","array","object"]).optional(),required:Re.boolean().default(!1),options:Re.array(Re.string()).optional(),default:Re.union([Re.string(),Re.number(),Re.boolean()]).optional()}).catchall(Re.unknown()),cBs=Re.object({method:Re.string().min(1,"Usage method is required"),parameters:Re.record(Re.string(),sBs).optional(),examples:Re.array(Re.string()).optional(),elicit:Re.boolean().optional()}).strict(),uBs=Re.object({name:Re.string().regex(/^\*[a-z0-9-]+$/,"Method name should start with * and use lowercase with hyphens and numbers"),icon:Re.string().min(1,"Method icon is required"),category:Re.string().min(1,"Method category is required"),introduce:Re.string().min(1,"Method introduce is required"),usage:cBs,agent_compatibility:Re.array(Re.string()).min(1,"Agent compatibility is required and must contain at least one agent"),references:Re.record(Re.string(),Re.object({description:Re.string().min(1,"Reference description is required"),content:Re.string().optional()})).optional()}).strict(),lBs=Re.object({template_ref:Re.string().min(1,"Template reference filename is required"),description:Re.string().min(1,"Template description is required"),when_to_trigger:Re.array(Re.string()).optional()}).strict(),dBs=Re.array(lBs).min(1,"Template integration must be an array containing at least one template"),fBs=Re.object({method:Re.string().min(1,"Method is required for composition").regex(/^\*[a-z0-9-]+(\s+[^\s]+)*$/,"Method must start with * and follow method syntax with optional parameters like [target], [target]-suffix, keywords, or --flags"),purpose:Re.string().min(1,"Purpose is required for composition item").max(200,"Purpose should not exceed 200 characters for clarity"),execution_flow:OD,when_to_trigger:OD}).strict(),pBs=Re.record(Re.string().regex(/^[a-z0-9-]+$/,"Composition key should be lowercase with hyphens and numbers only"),fBs).refine(e=>Object.keys(e).length>=1,"Composition must contain at least one method").refine(e=>Object.keys(e).length<=10,"Composition should not exceed 10 methods for clarity").optional(),mBs=Re.record(Re.string(),Re.array(Re.union([Re.string().min(1,"Action checklist item cannot be empty"),Re.record(Re.string(),Re.string().min(1,"Protocol reference cannot be empty"))]))).optional(),hBs=Re.object({purpose:Re.string().min(1,"Usage mode purpose is required"),execution_flow:OD,fallback:Re.array(Re.string().min(1,"Fallback step cannot be empty")).optional(),when_to_trigger:OD,usage_example:Re.array(Re.string().min(1,"Usage example cannot be empty")).min(1,"At least one usage example is required when usage_example is specified").max(3,"Usage examples should not exceed 5 for clarity").optional()}).strict(),gBs=Re.record(Re.string().regex(/^[a-z0-9-]+$/,"Usage mode key should be lowercase with hyphens and numbers only"),hBs).optional(),yBs=Re.object({validation_protocols:Re.record(Re.string(),Re.any()).optional(),action_checklists:Re.union([mBs,Re.array(Re.string())]),mission_critical:OD}).strict(),bBs=Re.any().superRefine((e,t)=>{if(e&&typeof e=="object"){let i=Object.keys(e);if(i[i.length-1]!=="mission_critical")return t.addIssue({code:"custom",message:`mission_critical must be the last property in tactical_notes (current order: ${i.join(", ")})`,path:[]}),Re.NEVER}let r=yBs.safeParse(e);r.success||r.error.issues.forEach(i=>{t.addIssue({code:"custom",message:`${i.code}: ${i.message}`,path:i.path})})}),vBs=Re.object({purpose:aBs,expected_output:oBs,composition:pBs}).strict(),Pyo=Re.object({method:uBs,methodology:vBs,template_integration:dBs.optional(),integration_protocols:Re.record(Re.string(),Re.any()).optional(),usage_modes:gBs,tactical_notes:bBs}).catchall(Re.unknown()).refine(e=>{let t=["method","methodology","template_integration","tactical_notes","integration_protocols","usage_modes","multi_market_integration","data_sources"],i=Object.keys(e).filter(n=>!t.includes(n)).filter(n=>!n.endsWith("-tmpl")&&!n.endsWith("-protocol"));return i.length&&console.dir(i,{deep:!0}),i.length===0},{message:"Additional root properties found."});function DSr(e,t){let r=Pyo.safeParse(e);if(r.success)return{success:!0,data:r.data};{let i=t?`${t}: `:"";return{success:!1,errors:r.error.issues.map(n=>`${i}${n.path.join(".")}: ${n.message}`)}}}var xBs=Re.object({header_sections:Re.array(Re.string()).optional().describe("Header content sections"),separators:Re.record(Re.string(),Re.string()).optional().describe("Visual separator content as Record<string, string>"),body_sections:Re.array(Re.string()).optional().describe("Main content sections"),footer_sections:Re.array(Re.string()).optional().describe("Footer content sections")}).strict().describe("Output structure organization - strict validation enforces consistent *_sections naming pattern"),_Bs=Re.record(Re.string(),Re.any()).describe("Display format and presentation specifications - accepts any key-value pairs for flexible formatting options"),SBs=Re.object({format:Re.string().optional().describe("Output format type (e.g., 'structured_markdown_report')"),filename:Re.string().optional().describe("Filename pattern for template output (supports {{variables}})"),structure:xBs.optional().describe("Output structure organization into header/body/footer sections")}).describe("Template output configuration - specifies how template results are generated and structured"),wBs=Re.object({title:Re.string().optional().describe("Section display title"),description:Re.string().optional().describe("Section description and purpose"),sub_sections:Re.array(Re.string()).optional().describe("List of sub-section names or descriptions"),content:Re.string().optional().describe("Plaintext content, examples, or instructions for this section"),type:Re.string().optional().describe("Section type classification for categorization"),focus:Re.string().optional().describe("Specific focus area for this section")}).catchall(Re.unknown()).describe("Individual template section - supports custom fields via passthrough"),kBs=Re.record(Re.string(),wBs).describe("Map of section names to section configurations"),EBs=Re.object({output:SBs.optional().describe("File output configuration (filename, format, structure)"),display_format:_Bs.optional().describe("Display and presentation specifications")}).strict().describe("Core template configuration - groups output & display specifications under 'template:' key"),IBs=Re.object({template:EBs.describe("REQUIRED: Configuration section - groups output and display specifications"),execution_flow:OD.optional().describe("OPTIONAL: Root-level execution workflow steps"),sections:kBs.describe("REQUIRED: Root-level section definitions for template content")}).strict().describe("TEMPLATE FILE ROOT STRUCTURE - contains template config, execution workflow, and content sections"),Dyo=Re.object({name:Re.string().min(1,"Template name is required and must not be empty").describe("Template name from YAML frontmatter"),description:Re.string().min(1,"Template description is required and must not be empty").describe("Template description from YAML frontmatter")}).catchall(Re.union([IBs,Re.string(),Re.number(),Re.boolean(),Re.null(),Re.array(Re.unknown())])).describe("Complete template file: YAML frontmatter metadata + one template definition following TemplateContentSchema");function _6(e){let t=Dyo.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,errors:t.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`)}}var Ryo=Re.union([Re.string().min(10,"Protocol content should be at least 10 characters"),Re.array(Re.union([Re.string().min(3,"Array item should be at least 3 characters"),Re.record(Re.string(),Re.any())])).min(1,"Array should not be empty"),Re.record(Re.string(),Re.union([Re.string().min(3,"Object value should be at least 3 characters"),Re.array(zct),Re.record(Re.string(),Re.any())])).refine(e=>Object.keys(e).length>0,"Object should not be empty"),Re.lazy(()=>Re.record(Re.string(),Ryo))]),Nyo=Re.record(Re.string(),Ryo).refine(e=>{let t=Object.keys(e);return t.some(i=>{let n=e[i];return typeof n=="string"?n.trim().length>=10:Array.isArray(n)?n.length>0:typeof n=="object"&&n!==null?Object.keys(n).length>0:!1})&&t.length>0},"Protocol should contain at least one meaningful section with content"),TBs=Re.object({name:Re.string().min(1,"Protocol name is required"),description:Re.string().min(10,"Protocol description should be at least 10 characters")}).catchall(Nyo).refine(e=>{let t=["name","description"],r=Object.keys(e).filter(n=>!t.includes(n));if(r.length!==1)return!1;let i=e[r[0]];return Nyo.safeParse(i).success},"Protocol should have exactly one root key containing the protocol structure (in addition to name and description)");function OBs(e){let t=TBs.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,errors:t.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`)}}function CBs(e){let t=100;return t-=e.errors.length*25,t-=e.warnings.length*5,t-=e.advisories.length*1,Math.max(0,t)}function $Bs(e){let r={filename:"unknown",type:"protocol",status:"excellent",errors:[],warnings:[],advisories:[],score:0},i=OBs(e);return!i.success&&i.errors&&i.errors.forEach(n=>{n.includes("should be at least")||n.includes("should not exceed")||n.includes("should start with")||n.includes("should use")?r.advisories.push(`ADVISORY: ${n}`):n.includes("required")||n.includes("should contain")||n.includes("should have at least")?r.errors.push(`CRITICAL: ${n}`):r.warnings.push(`WARNING: ${n}`)}),r.score=CBs(r),r.errors.length===0&&r.warnings.length===0?r.status="excellent":r.errors.length===0?r.status="good_with_warnings":r.status="critical_error",r}import{describe as ABs,test as Myo,expect as zyo}from"bun:test";import{lstatSync as PBs,existsSync as DBs}from"fs";import{join as Fyo,basename as NBs,dirname as Fct}from"path";async function RBs(e){let t=await ym(["method"],e);ABs("Category Link Validation",()=>{Myo("All method categories should have valid symbolic links",()=>{if(t.length===0){console.log("\u23ED\uFE0F Skipping category link validation - no method items found");return}let r=[];for(let i of t){let n=i.filePath,o=i.category;if(!o)continue;let a=NBs(Fct(n)),s=Fct(Fct(n)),c=Fct(s),u=Fyo(c,"categories"),l=Fyo(u,o,a);if(!DBs(l)){r.push(`${l} not exists`);continue}try{PBs(l).isSymbolicLink()||r.push(`Not Link: ${l}`)}catch(f){r.push(`Error reading link ${l}: ${f}`)}}r.length>0&&console.error(`\u274C Link validation failures:
895
897
  ${r.join(`
896
898
  `)}`),zyo(r.length).toBe(0)}),Myo("should discover all method items",()=>{if(t.length===0){console.log("\u23ED\uFE0F Skipping method discovery check - no method items found");return}zyo(t.length).toBeGreaterThan(0),console.log(`\u2705 Validated ${t.length} method category links`)})})}import{describe as MBs,test as jyo,expect as Lyo}from"bun:test";import{existsSync as zBs}from"fs";import{join as FBs}from"path";async function jBs(e){let t=await ym(["method"],e);MBs("General Method Validation",()=>{jyo("All method files should pass validation",async()=>{if(t.length===0){console.log("\u23ED\uFE0F Skipping method validation - no method items found");return}let r=[];for(let i of t){let{promptData:n}=await sT(t,i.callSign)||{};n&&(delete n.callSign,delete n.name,delete n.description,delete n.method.references);let o=DSr(n,i.filePath);if(!o.success){let a=o.errors?.map(s=>`
897
- \u2192 ${s}`).join("")||"Unknown error";r.push(`\u{1F4C4} ${i.id}:${a}`)}}if(r.length>0)throw console.error(`
899
+ \u2192 ${s}`).join("")||"Unknown error";r.push(`\u{1F4C4} ${i.id}:${a}`)}}r.length>0&&console.error(`
898
900
  \u274C FAILURES (${r.length}/${t.length}):
899
901
  ${r.join(`
900
902
  `)}
901
- `),new Error(`Validation failed for ${r.length} files.`);console.log(`\u2705 Validated ${t.length} methods`),Lyo(r.length).toBe(0)}),jyo("All reference files should have parseable frontmatter with a description",async()=>{if(t.length===0){console.log("\u23ED\uFE0F Skipping reference validation - no method items found");return}let r=[],i=0;for(let n of t){if(!n.folderPath)continue;let o=FBs(n.folderPath,"references");if(!zBs(o))continue;let a=await IOe(o);for(let[s,c]of Object.entries(a))i++,c.description||r.push(`\u{1F4C4} ${n.id}/references/${s}: frontmatter has no parseable 'description' \u2014 likely invalid YAML (an unquoted ": " colon-space breaks the value; wrap it in double quotes).`)}if(r.length>0)throw console.error(`
903
+ `),console.log(`\u2705 Validated ${t.length} methods`),Lyo(r).toEqual([])}),jyo("All reference files should have parseable frontmatter with a description",async()=>{if(t.length===0){console.log("\u23ED\uFE0F Skipping reference validation - no method items found");return}let r=[],i=0;for(let n of t){if(!n.folderPath)continue;let o=FBs(n.folderPath,"references");if(!zBs(o))continue;let a=await IOe(o);for(let[s,c]of Object.entries(a))i++,c.description||r.push(`\u{1F4C4} ${n.id}/references/${s}: frontmatter has no usable 'description' \u2014 the field is missing, the frontmatter block is absent, or the YAML failed to parse (a common culprit is an unquoted ": " colon-space in a value; wrap such values in double quotes).`)}r.length>0&&console.error(`
902
904
  \u274C REFERENCE FAILURES (${r.length}/${i}):
903
905
  ${r.join(`
904
906
  `)}
905
- `),new Error(`Reference frontmatter validation failed for ${r.length} files.`);console.log(`\u2705 Validated ${i} reference files`),Lyo(r.length).toBe(0)})})}import{describe as VBs,test as WBs,expect as HBs}from"bun:test";var LBs=Re.object({id:Re.string().min(1,"Agent ID is required").regex(/^[a-z-]+$/,"Agent ID should follow format: {role} (e.g., developer, analyst)"),icon:Re.string().min(1,"Agent icon is required").regex(/^[\u{1F000}-\u{1F9FF}\u{2600}-\u{27BF}\u{E000}-\u{F8FF}][\u{FE00}-\u{FE0F}]?$/u,"Agent icon should be a single emoji"),introduce:Re.string().min(100,"Agent introduction should be at least 100 characters for proper context").max(2e3,"Agent introduction should not exceed 2000 characters for readability").regex(/^[A-Z]/,"Agent introduction should start with capital letter"),acronym:Re.string().min(5,"Agent acronym should be at least 10 characters").max(200,"Agent acronym should not exceed 200 characters"),whenToUse:Re.array(Re.string().min(3,"When to use item should be at least 3 characters").max(70,"When to use item should not exceed 70 characters")).min(3,"Agent should have at least 3 use cases").max(10,"Agent should not exceed 10 use cases for clarity")}).strict(),UBs=Re.object({core_principles:OD}).strict(),qBs=Re.record(Re.string().min(1,"Method key is required").regex(/^[a-z0-9-]+$/,"Method key should be lowercase with hyphens and numbers only"),Re.string().min(10,"Method description should be at least 10 characters").max(500,"Method description should not exceed 500 characters")).refine(e=>Object.keys(e).length>=3,"Persona should have at least 3 methods").refine(e=>Object.keys(e).length<=25,"Persona should not exceed 25 methods for usability"),BBs=Re.object({methods:Re.array(Re.string()).optional()}).strict(),ZBs=Re.object({name:Re.string().min(1,"Name is required").regex(/^[A-Z]+$/,"Name should be all uppercase letters (e.g., JAMES, FRIDAY)"),description:Re.string().min(5,"Description should be at least 100 characters for proper context").max(100,"Description should not exceed 2000 characters for readability").regex(/^[A-Z]/,"Description should start with capital letter"),agent:LBs,persona:UBs,methods:qBs,dependencies:BBs}).catchall(Re.unknown()).refine(e=>{let t=["name","description","agent","persona","methods","dependencies"],i=Object.keys(e).filter(n=>!t.includes(n)).filter(n=>!n.endsWith("-protocol"));return i.length&&console.dir(i,{deep:!0}),i.length===0},{message:"Additional root properties found."});function Uyo(e){let t=ZBs.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,errors:t.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`)}}import{readFileSync as JBs}from"fs";import{basename as GBs}from"path";async function KBs(e){let t=await ym(["persona"],e);VBs("General Persona Validation",()=>{WBs("All persona files should pass validation",async()=>{if(t.length===0){console.log("\u23ED\uFE0F Skipping persona validation - no persona files found");return}let r=[];for(let i of t){let n=JBs(i.filePath,"utf8"),o=GBs(i.filePath);if(!n.match(/```yaml\s*\n([\s\S]*?)\n\s*```/)){r.push(`\u{1F4C4} ${o}: No YAML block found`);continue}let s=await sT(t,i.callSign);delete s.promptData.callSign;let c=Uyo(s.promptData);if(!c.success){let u=c.errors?.map(l=>`
907
+ `),console.log(`\u2705 Validated ${i} reference files`),Lyo(r).toEqual([])})})}import{describe as VBs,test as WBs,expect as HBs}from"bun:test";var LBs=Re.object({id:Re.string().min(1,"Agent ID is required").regex(/^[a-z-]+$/,"Agent ID should follow format: {role} (e.g., developer, analyst)"),icon:Re.string().min(1,"Agent icon is required").regex(/^[\u{1F000}-\u{1F9FF}\u{2600}-\u{27BF}\u{E000}-\u{F8FF}][\u{FE00}-\u{FE0F}]?$/u,"Agent icon should be a single emoji"),introduce:Re.string().min(100,"Agent introduction should be at least 100 characters for proper context").max(2e3,"Agent introduction should not exceed 2000 characters for readability").regex(/^[A-Z]/,"Agent introduction should start with capital letter"),acronym:Re.string().min(5,"Agent acronym should be at least 10 characters").max(200,"Agent acronym should not exceed 200 characters"),whenToUse:Re.array(Re.string().min(3,"When to use item should be at least 3 characters").max(70,"When to use item should not exceed 70 characters")).min(3,"Agent should have at least 3 use cases").max(10,"Agent should not exceed 10 use cases for clarity")}).strict(),UBs=Re.object({core_principles:OD}).strict(),qBs=Re.record(Re.string().min(1,"Method key is required").regex(/^[a-z0-9-]+$/,"Method key should be lowercase with hyphens and numbers only"),Re.string().min(10,"Method description should be at least 10 characters").max(500,"Method description should not exceed 500 characters")).refine(e=>Object.keys(e).length>=3,"Persona should have at least 3 methods").refine(e=>Object.keys(e).length<=25,"Persona should not exceed 25 methods for usability"),BBs=Re.object({methods:Re.array(Re.string()).optional()}).strict(),ZBs=Re.object({name:Re.string().min(1,"Name is required").regex(/^[A-Z]+$/,"Name should be all uppercase letters (e.g., JAMES, FRIDAY)"),description:Re.string().min(5,"Description should be at least 100 characters for proper context").max(100,"Description should not exceed 2000 characters for readability").regex(/^[A-Z]/,"Description should start with capital letter"),agent:LBs,persona:UBs,methods:qBs,dependencies:BBs}).catchall(Re.unknown()).refine(e=>{let t=["name","description","agent","persona","methods","dependencies"],i=Object.keys(e).filter(n=>!t.includes(n)).filter(n=>!n.endsWith("-protocol"));return i.length&&console.dir(i,{deep:!0}),i.length===0},{message:"Additional root properties found."});function Uyo(e){let t=ZBs.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,errors:t.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`)}}import{readFileSync as JBs}from"fs";import{basename as GBs}from"path";async function KBs(e){let t=await ym(["persona"],e);VBs("General Persona Validation",()=>{WBs("All persona files should pass validation",async()=>{if(t.length===0){console.log("\u23ED\uFE0F Skipping persona validation - no persona files found");return}let r=[];for(let i of t){let n=JBs(i.filePath,"utf8"),o=GBs(i.filePath);if(!n.match(/```yaml\s*\n([\s\S]*?)\n\s*```/)){r.push(`\u{1F4C4} ${o}: No YAML block found`);continue}let s=await sT(t,i.callSign);delete s.promptData.callSign;let c=Uyo(s.promptData);if(!c.success){let u=c.errors?.map(l=>`
906
908
  \u2192 ${l}`).join("")||"Unknown error";r.push(`\u{1F4C4} ${o}:${u}`)}}if(r.length>0)throw console.error(`
907
909
  \u274C FAILURES (${r.length}/${t.length}):
908
910
  ${r.join(`
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.2",
2
+ "version": "1.4.4",
3
3
  "name": "@modality-counter/core",
4
4
  "repository": {
5
5
  "type": "git",