@modality-counter/core 0.9.9 → 0.9.11
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/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -531,7 +531,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
531
531
|
`),r=/^---\n([\s\S]+?)\n---/,i=t.match(r);if(!i||!i[1])return{};let n=i[1].trim(),o=n.split(`
|
|
532
532
|
`).filter(s=>s.trim());if(!o.every(s=>{let u=s.trim();return/^[#`*\-]/.test(u)?!1:s.includes(":")}))return{};try{let s=a0a.parse(n);return typeof s!="object"||s===null||Array.isArray(s)?{}:s}catch{let s={};for(let u of o){let c=u.indexOf(":");if(c>0){let l=u.slice(0,c).trim(),f=u.slice(c+1).trim();l&&(s[l]=f)}}return s}}var UBe=e=>{let t=s0a(Ksi(e)());return l0a.translate(t)},d0a=e=>e.endsWith(".mdx")||e.endsWith(".md")?e:`${e}.mdx`,NBt=async e=>{if(e==null)throw new Error(`Invalid file path: ${e}. Path must be relative and have .md or .mdx extension.`);let t=d0a(e),r=f0a(),i=c0a(r,t);return await p0a(i)},f0a=()=>{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(`
|
|
533
533
|
`).filter(n=>n.indexOf("at load")!==-1).pop()),i||(i=r.stack?.split(`
|
|
534
|
-
`).filter(n=>n.indexOf("at <anonymous>")!==-1).pop()),i){let n=/(?<path>[^\(\s]+):[0-9]+:[0-9]+/.exec(i)?.groups?.path.replace("file://","");e=u0a(n||"")}}return e||process.cwd()},p0a=async e=>{
|
|
534
|
+
`).filter(n=>n.indexOf("at <anonymous>")!==-1).pop()),i){let n=/(?<path>[^\(\s]+):[0-9]+:[0-9]+/.exec(i)?.groups?.path.replace("file://","");e=u0a(n||"")}}return e||process.cwd()},p0a=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 g0a}from"bun";import{jsx as mhi}from"react/jsx-runtime";function ghi(e,t){let r={...e};return MBt(e)&&MBt(t)&&Object.keys(t).forEach(i=>{Array.isArray(t[i])?Array.isArray(r[i])?r[i].push(...t[i]):r[i]=t[i]:MBt(t[i])&&i in e?r[i]=ghi(e[i],t[i]):r[i]=t[i]}),r}function MBt(e){return e&&typeof e=="object"&&!Array.isArray(e)}var yhi=async(e,t)=>{if(typeof e=="string"){let r=await NBt(e);return UBe(mhi(r,{...t}))}else return UBe(mhi(e,{...t}))},O4=async(e,t)=>{let r=await yhi(e,t),o=vhi(r).filter(a=>a.language==="yaml"||a.language==="yml").reduce((a,s)=>{let u=g0a.parse(s.code);return ghi(a,u)},{});if(typeof e=="string"){let a=hhi(e,"utf-8"),s=VQ(a);Object.assign(o,s)}return o};function y0a(e){try{let t=__dirname||h0a(__filename),r=m0a(t,"prompts",e);return hhi(r,"utf-8")}catch(t){throw console.error(`Failed to read prompt file: ${e}`,t),new Error(`Could not load prompt: ${e}`)}}function vhi(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}import{existsSync as Buo,readFileSync as r4s}from"fs";import{join as n4s,basename as ZTe,extname as i4s,dirname as Vuo}from"path";var qBe=["persona","method","workflow"],bhi=Ae.object({topic:Ae.string().describe("The topic for the Counter to discuss and debate"),context:Ae.string().optional().describe("Optional additional context or background for the discussion"),recommendedHeroes:Ae.array(Ae.string()).optional().describe("Optional array of recommended hero names or call signs to prioritize for the discussion"),deployedHeroes:Ae.array(Ae.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"),xhi=Ae.object({method:Ae.string().describe("The method name to execute"),params:Ae.preprocess(e=>typeof e=="string"?JSON.parse(e):e,Ae.record(Ae.string(),Ae.any())).optional().describe("Parameters for the method")}),_hi=Ae.object({callSign:Ae.string().describe("The callSign to deploy (e.g., 'SARAH', 'JAMES')")}).describe("Deploy a specific Counter hero persona"),Shi=Ae.object({name:Ae.string().describe("The workflow identifier to deploy (e.g., 'team-architect')")}).describe("Execute a specific Counter workflow for multi-step task orchestration"),whi=Ae.object({types:Ae.array(Ae.enum(qBe)).default(["persona"]).describe("Array of resource types to filter by. Defaults to ['persona'] for hero listings")}).describe("Get Counter resources filtered by type");Fro();var Zgr=(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);Qst();Qst();var E4u=300*1e3,I4u={initialize:1800*1e3,"tools/list":300*1e3,"resources/list":60*1e3,"prompts/list":300*1e3};async function f$(e,t,r,i){let n=e.find(o=>o.callSign===t.trim());try{if(!n)return!1;let o;r?.partyMode&&(o=`**PARTY MODE ACTIVE - ENGAGE OPENING PHASE PROTOCOLS NOW!**
|
|
535
535
|
|
|
536
536
|
**ACTIVE HEROES: ${r.activeHeroes||"UNKNOWN"}**
|
|
537
537
|
|
|
@@ -539,7 +539,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
539
539
|
|
|
540
540
|
`);let a=await O4(n.filePath,r);a.callSign=t;let s;if(i){let c=o4s(n.folderPath);if(c){let{aiTool:l}=await import(c),f=l.inputSchema;if(f){let d=await Wat(f);if(a.method.usage.parameters=d.properties,d.required&&d.required.length>0)for(let p of d.required)a.method.usage.parameters[p]=a.method.usage.parameters[p]||{},a.method.usage.parameters[p].required=!0;if(r!=null){let p={};Object.keys(d.properties||{}).forEach(h=>{p[h]=r[h]??void 0});let m=f.safeParse(p);if(!m.success)throw new Error(`Invalid parameters for ${t}: ${m.error.message}`)}}s=l.execute}}let u=await u4s(n.folderPath+"/references");if(u&&Object.keys(u).length>0){let c=Object.entries(u).map(([l,f])=>`- ${l}: ${f.description||""}`).join(`
|
|
541
541
|
|
|
542
|
-
`);a.method.references={referenceInstructions:[`Review these available references and Load a reference using: ${GU}(method: "${t}", params: {reference: "<filename.md>"})`,c],referenceList:u}}return{promptData:a,counterScript:s,partyMode:o}}catch(o){throw new Error(`Failed to get CounterContent for '${t}': ${o}`)}}var o4s=e=>{if(e){let t=n4s(e,"scripts","index.ts");if(Buo(t))return t}},eut=null;async function sv(e=[],t=import.meta.dir){if(eut==null){eut=X9t();for(let i of qBe)eut[i]=await a4s(t,i)}(!e||e.length===0)&&(e=[...qBe]);let r=[];for(let i of e)r.push(...eut[i]||[]);return r}async function a4s(e,t){let r=[]
|
|
542
|
+
`);a.method.references={referenceInstructions:[`Review these available references and Load a reference using: ${GU}(method: "${t}", params: {reference: "<filename.md>"})`,c],referenceList:u}}return{promptData:a,counterScript:s,partyMode:o}}catch(o){throw new Error(`Failed to get CounterContent for '${t}': ${o}`)}}var o4s=e=>{if(e){let t=n4s(e,"scripts","index.ts");if(Buo(t))return t}},eut=null;async function sv(e=[],t=import.meta.dir){if(eut==null){eut=X9t();for(let i of qBe)eut[i]=await a4s(t,i)}(!e||e.length===0)&&(e=[...qBe]);let r=[];for(let i of e)r.push(...eut[i]||[]);return r}async function a4s(e,t){let r=[],i,n,o=!1;t==="method"?(i="skills",n=s=>s==="SKILL.mdx",o=!0):(i=`${t}s`,n=s=>s.endsWith(".md")||s.endsWith(".mdx"));let a=Pve(e,{targetFolderName:i,fileNameFilter:n,searchInSubfolders:o,fileExtensions:[".md",".mdx"],excludePatterns:[".","__","hidden"]});if(t==="method")for(let s of a){let u=await O4(s.fullPath),c=Vuo(s.fullPath),l=ZTe(c).toLowerCase();r.push({callSign:`${t}-${l}`,type:t,id:l,name:tut(u,["name"]),folderPath:c,filePath:s.fullPath,description:tut(u,["description"]),category:tut(u,["category"])})}else for(let s of a){let u=await O4(s.fullPath),c=s4s(ZTe(s.fullPath));r.push({callSign:`${t}-${c}`,type:t,id:c,name:u.name,description:u.description,category:tut(u,["category"]),filePath:s.fullPath})}return r}var s4s=e=>ZTe(e,i4s(e)).toLowerCase(),tut=(e,t)=>{let r=["agent","method"];for(let i of r)for(let n of t){let o=AO(e,[i,n]);if(o!=null)return o}};function Wuo(e){return Pve(e,{targetFolderName:"templates",fileExtensions:[".md",".mdx"],fileNameFilter:t=>t.includes("tmpl")})}async function u4s(e){let t={};if(!e||!Buo(e))return t;try{let r=Vuo(e),i=ZTe(e),n=Pve(r,{targetFolderName:i,fileExtensions:[".md",".mdx"],fileNameFilter:o=>!o.toLowerCase().includes("readme")&&!o.toLowerCase().includes("summary"),excludePatterns:[".","_"]});for(let o of n)try{let a=r4s(o.fullPath,"utf-8"),s=VQ(a),u=ZTe(o.fullPath),c=s.description,l=s.name;t[u]={description:c,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}Qst();var c4s=function(t){var r,i=(r=(t??"")[0])===null||r===void 0?void 0:r.toUpperCase();return i?i+t.slice(1):null},Huo=c4s;var l4s={code:["change","modify","develop","update","implement","add","remove","fix","improve"],"code-verify":["check","code-test"],"fix-bun-test":["bun-test"],"counter-manager":["method-manager"],presentation:["ppt"],"daily-planner":["daily"],help:["assemble"],"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"]},d4s={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"},"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"}},Juo=e=>l4s[e]||[],Kvr=e=>d4s[e];var Yvr={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 Guo(e){let t=e.toLowerCase().trim();return Yvr[t]?.toLowerCase()||t}async function Kuo(){try{return(await sv(["persona"])).map(t=>Huo(t.name))}catch(e){return console.error("Failed to get hero names:",e),[]}}import{Fragment as h4s,jsx as qU,jsxs as g4s}from"react/jsx-runtime";import{jsx as rut}from"react/jsx-runtime";import{YAML as f4s}from"bun";var p4s=e=>rut("pre",{style:{whiteSpace:"pre-wrap"},children:`\`\`\`yaml
|
|
543
543
|
${f4s.stringify(e)}\`\`\``});function m4s(e={}){let{wrapper:t}=e.components||{};return t?rut(t,Object.assign({},e,{children:rut(r,{})})):r();function r(){return rut(p4s,e)}}var nut=m4s;var y4s=e=>{let t={active_heroes:e.activeHeroes,available_heroes:e.availableHeroes,topic:e.topic,context:e.context,meeting_type:"AI_ORCHESTRATED_ROUNDTABLE",description:"This party mode session brings together multiple AI heroes for collaborative discussion and problem-solving. Each hero contributes their unique expertise and perspective to create comprehensive solutions."};return qU(nut,{"party-mode-protocol":{sessionDetails:t}})};function v4s(e={}){let{wrapper:t}=e.components||{};return t?qU(t,Object.assign({},e,{children:qU(r,{})})):r();function r(){let i=Object.assign({hr:"hr",h2:"h2",pre:"pre",code:"code"},e.components);return g4s(h4s,{children:[qU(i.hr,{}),`
|
|
544
544
|
`,qU(i.h2,{children:`name: party-mode-protocol
|
|
545
545
|
description: "Behavior Protocol for Multi-Hero Party Mode Collaborative Discussions"`}),`
|
package/package.json
CHANGED