@modality-counter/core 1.2.6 → 1.2.7
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 +1 -1
- package/dist/types/util_prompts.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -560,7 +560,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
560
560
|
${t.cause}`),{detail:t,id:"",location:r,notes:[],pluginName:e.name,text:o}}B0a(BZt({recmaPlugins:[[e8e,"yaml"]]}));var J0a=new Uhi.NodeHtmlMarkdown({globalEscape:[/.^/,""],textReplace:[[/\\-/g,"-"]]});function FQ(e){let r=e.replace(/\r\n/g,`
|
|
561
561
|
`).match(/^---\n([\s\S]+?)\n---/);if(!r||!r[1])return{};try{let i=Z0a.parse(r[1]);return typeof i!="object"||i===null||Array.isArray(i)?{}:i}catch{return{}}}var Gqe=e=>{let t=V0a(Sui(e)());return J0a.translate(t)},G0a=e=>e.endsWith(".mdx")||e.endsWith(".md")?e:`${e}.mdx`,ZZt=async e=>{if(e==null)throw new Error(`Invalid file path: ${e}. Path must be relative and have .md or .mdx extension.`);let t=G0a(e),r=K0a(),i=H0a(r,t);return await Y0a(i)},K0a=()=>{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(`
|
|
562
562
|
`).filter(n=>n.indexOf("at load")!==-1).pop()),i||(i=r.stack?.split(`
|
|
563
|
-
`).filter(n=>n.indexOf("at <anonymous>")!==-1).pop()),i){let n=/(?<path>[^\(\s]+):[0-9]+:[0-9]+/.exec(i)?.groups?.path.replace("file://","");e=W0a(n||"")}}return e||process.cwd()},Y0a=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 e_a}from"bun";import{jsx as qhi}from"react/jsx-runtime";function Zhi(e,t){let r={...e};return VZt(e)&&VZt(t)&&Object.keys(t).forEach(i=>{Array.isArray(t[i])?Array.isArray(r[i])?r[i].push(...t[i]):r[i]=t[i]:VZt(t[i])&&i in e?r[i]=Zhi(e[i],t[i]):r[i]=t[i]}),r}function VZt(e){return e&&typeof e=="object"&&!Array.isArray(e)}var Vhi=async(e,t)=>{if(typeof e=="string"){let r=await ZZt(e);return Gqe(qhi(r,{...t}))}else return Gqe(qhi(e,{...t}))},HO=async(e,t)=>{let r=await Vhi(e,t),
|
|
563
|
+
`).filter(n=>n.indexOf("at <anonymous>")!==-1).pop()),i){let n=/(?<path>[^\(\s]+):[0-9]+:[0-9]+/.exec(i)?.groups?.path.replace("file://","");e=W0a(n||"")}}return e||process.cwd()},Y0a=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 e_a}from"bun";import{jsx as qhi}from"react/jsx-runtime";function Zhi(e,t){let r={...e};return VZt(e)&&VZt(t)&&Object.keys(t).forEach(i=>{Array.isArray(t[i])?Array.isArray(r[i])?r[i].push(...t[i]):r[i]=t[i]:VZt(t[i])&&i in e?r[i]=Zhi(e[i],t[i]):r[i]=t[i]}),r}function VZt(e){return e&&typeof e=="object"&&!Array.isArray(e)}var Vhi=async(e,t)=>{if(typeof e=="string"){let r=await ZZt(e);return Gqe(qhi(r,{...t}))}else return Gqe(qhi(e,{...t}))},HO=async(e,t)=>{let r=await Vhi(e,t),i=Hhi(r,!0);if(typeof e=="string"){let n=Bhi(e,"utf-8"),o=FQ(n);Object.assign(i,o)}return i};function t_a(e){try{let t=__dirname||Q0a(__filename),r=X0a(t,"prompts",e);return Bhi(r,"utf-8")}catch(t){throw console.error(`Failed to read prompt file: ${e}`,t),new Error(`Could not load prompt: ${e}`)}}function Whi(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 Hhi(e,t){let r=Whi(e).filter(i=>i.language==="yaml"||i.language==="yml");return t?r.reduce((i,n)=>{let o=e_a.parse(n.code);return Zhi(i,o)},{}):r}import{existsSync as n4s}from"fs";import{join as i4s,basename as cvr,extname as o4s,dirname as a4s}from"path";var Kqe=["persona","method","workflow"],Jhi=Ce.object({topic:Ce.string().describe("The topic for the Counter to discuss and debate"),context:Ce.string().optional().describe("Optional additional context or background for the discussion"),recommendedHeroes:Ce.array(Ce.string()).optional().describe("Optional array of recommended hero names or call signs to prioritize for the discussion"),deployedHeroes:Ce.array(Ce.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"),Ghi=Ce.object({method:Ce.string().describe("The method name to execute"),params:Ce.preprocess(e=>typeof e=="string"?JSON.parse(e):e,Ce.record(Ce.string(),Ce.any())).optional().describe("Parameters for the method")}),Khi=Ce.object({callSign:Ce.string().describe("The callSign to deploy (e.g., 'SARAH', 'JAMES')")}).describe("Deploy a specific Counter hero persona"),Yhi=Ce.object({name:Ce.string().describe("The workflow identifier to deploy (e.g., 'team-architect')")}).describe("Execute a specific Counter workflow for multi-step task orchestration"),Xhi=Ce.object({types:Ce.array(Ce.enum(Kqe)).default(["persona"]).describe("Array of resource types to filter by. Defaults to ['persona'] for hero listings")}).describe("Get Counter resources filtered by type");mno();var tyr=(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);KV();KV();var b4u=300*1e3,v4u={initialize:1800*1e3,"tools/list":300*1e3,"resources/list":60*1e3,"prompts/list":300*1e3};KV();var KNs=function(t){var r,i=(r=(t??"")[0])===null||r===void 0?void 0:r.toUpperCase();return i?i+t.slice(1):null},xco=KNs;var YNs={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"]},XNs={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"}},_co=e=>YNs[e]||[],iat=e=>XNs[e];var uvr={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 Sco(e){let t=e.toLowerCase().trim();return uvr[t]?.toLowerCase()||t}async function wco(){try{return(await lm(["persona"])).map(t=>xco(t.name))}catch(e){return console.error("Failed to get hero names:",e),[]}}KV();import{existsSync as QNs,readFileSync as e4s}from"fs";import{basename as kco,dirname as t4s}from"path";async function r4s(e){let t={};if(!e||!QNs(e))return t;try{let r=t4s(e),i=kco(e),n=lae(r,{targetFolderName:i,fileExtensions:oat,fileNameFilter:o=>!o.toLowerCase().includes("readme")&&!o.toLowerCase().includes("summary"),excludePatterns:[".","_"]});for(let o of n)try{let a=e4s(o.fullPath,"utf-8"),s=FQ(a),u=kco(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}async function Eco(e,t){if(!e)return;let r=await r4s(e+"/references");if(!r||Object.keys(r).length===0)return;let i=Object.entries(r).map(([n,o])=>`- ${n}: ${o.description||""}`).join(`
|
|
564
564
|
|
|
565
565
|
`);return{referenceInstructions:[`Review these available references. MANDATORY: If the user's task matches any reference by filename, name, or description, load the relevant reference BEFORE answering, planning, or editing files using: ${ZU}(method: "*${t}", params: {reference: "<filename.md>"})`,i],referenceList:r}}var oat=[".md",".mdx"],sat=(e,t="method")=>{let r=(e.startsWith("*")?e.slice(1):e).trim().toLowerCase(),i=`${t}-`;if(t==="method"){let n=iat(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 ZI(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!**
|
|
566
566
|
|
|
@@ -11,4 +11,5 @@ export declare const readMdxYaml: (Prompt: string | React.ComponentType<any>, pa
|
|
|
11
11
|
export declare function readPrompt(promptPath: string): string;
|
|
12
12
|
export declare function extractCodeBlocks(markdown: string): CodeBlock[];
|
|
13
13
|
export declare function extractYamlBlocks(markdown: string): CodeBlock[];
|
|
14
|
+
export declare function extractYamlBlocks(markdown: string, merge: true): any;
|
|
14
15
|
export {};
|
package/package.json
CHANGED