@a-company/paradigm 5.37.0 → 5.37.1
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/{accept-orchestration-36AP7HTX.js → accept-orchestration-SBZVK3H4.js} +1 -1
- package/dist/{add-FGKNJS3F.js → add-P76GEMGF.js} +1 -1
- package/dist/{agent-E7LDKJ4O.js → agent-X6I2YWOB.js} +1 -1
- package/dist/{agent-loader-2HXKVL6J.js → agent-loader-RIVI6QPP.js} +1 -1
- package/dist/{agent-loader-XS6LIMUG.js → agent-loader-RJRVO5GQ.js} +1 -1
- package/dist/{agent-state-L7LCPRC3.js → agent-state-KSQ3S7OB.js} +1 -1
- package/dist/{agents-suggest-Y5D6AALG.js → agents-suggest-HYTFMQD3.js} +1 -1
- package/dist/{aggregate-OZJRRAQR.js → aggregate-W66DM3GA.js} +1 -1
- package/dist/{ambient-4NSPAQDJ.js → ambient-GJAEXF7B.js} +4 -4
- package/dist/{assess-AMPVSWK7.js → assess-UFPYEJKP.js} +1 -1
- package/dist/{auto-A7VUHCUC.js → auto-RHJXOZFL.js} +1 -1
- package/dist/{beacon-YBLUUTYY.js → beacon-5QVYV5DF.js} +1 -1
- package/dist/{calibration-FQ4YVOE4.js → calibration-OLJYB5HN.js} +1 -1
- package/dist/{check-46QL3KMQ.js → check-THVGY4R5.js} +1 -1
- package/dist/{chunk-EMMMBAID.js → chunk-3KVVC4WV.js} +1 -1
- package/dist/{chunk-3QMRDN65.js → chunk-4Q7XYPL4.js} +2 -2
- package/dist/{chunk-3OMJI5TT.js → chunk-4SCKMGTB.js} +2 -2
- package/dist/chunk-5TAVYPOV.js +2 -0
- package/dist/{chunk-6PP2RPIZ.js → chunk-74SGKSRQ.js} +2 -2
- package/dist/{chunk-RN35IVA2.js → chunk-BV5PRPLB.js} +1 -1
- package/dist/{chunk-YG5G5GEQ.js → chunk-CMCQHU46.js} +13 -13
- package/dist/{chunk-JIF7OSGH.js → chunk-CVPKQ3JH.js} +1 -1
- package/dist/{chunk-RLJ5K3J5.js → chunk-D6ZXAI26.js} +1 -1
- package/dist/chunk-EK4ZRIFJ.js +3 -0
- package/dist/{chunk-X54WXWCX.js → chunk-FILLU77P.js} +5 -5
- package/dist/{chunk-7PB7AXQE.js → chunk-J6KWGCHN.js} +1 -1
- package/dist/{chunk-BCOPNVPY.js → chunk-JOHAOLEC.js} +2 -2
- package/dist/{chunk-JUOOVKK6.js → chunk-KFNHCQ4R.js} +1 -1
- package/dist/{chunk-77WX6HGV.js → chunk-LBQBWIEX.js} +1 -1
- package/dist/chunk-MBPLJKE5.js +3 -0
- package/dist/{chunk-W6WVJLHO.js → chunk-ODVKPZZ4.js} +1 -1
- package/dist/{chunk-5YHR77AL.js → chunk-ORDKEGII.js} +1 -1
- package/dist/chunk-QGZRM6ZB.js +2 -0
- package/dist/chunk-QO7YPQXC.js +2 -0
- package/dist/{chunk-DG3VCY43.js → chunk-SUU6M4JH.js} +1 -1
- package/dist/{chunk-XNB4TZTD.js → chunk-UNHTQLYO.js} +1 -1
- package/dist/chunk-UPFCBVXY.js +3 -0
- package/dist/{chunk-6QKCUEEY.js → chunk-VCKKJDLP.js} +1 -1
- package/dist/{chunk-4W5TBL3O.js → chunk-VG7FN2TU.js} +1 -1
- package/dist/{chunk-7YTAA6XA.js → chunk-WS2N27RX.js} +1 -1
- package/dist/{chunk-7SGNNVE5.js → chunk-X3U3IGYT.js} +2 -2
- package/dist/{chunk-IW5K3RNR.js → chunk-ZUAUFZRJ.js} +1 -1
- package/dist/{claude-OX54QSLC.js → claude-4LR3LJQZ.js} +1 -1
- package/dist/{claude-cli-FHLJQVJC.js → claude-cli-UP6HGH7C.js} +1 -1
- package/dist/{claude-code-GVGU3A3B.js → claude-code-RLJ4GX77.js} +1 -1
- package/dist/{claude-code-teams-ZRHPTGPP.js → claude-code-teams-R37HJY3Y.js} +1 -1
- package/dist/{compliance-PHSPVYK2.js → compliance-BPGQMQAX.js} +3 -3
- package/dist/{compliance-health-HCZTJDN7.js → compliance-health-JNP3P35P.js} +1 -1
- package/dist/{conductor-LYBMM66Z.js → conductor-Y5IXELTL.js} +1 -1
- package/dist/{config-schema-URJW6UZH.js → config-schema-GUQY2QN7.js} +1 -1
- package/dist/{constellation-PX3ZKMWQ.js → constellation-CG7C4WFE.js} +1 -1
- package/dist/{context-audit-APFKELFT.js → context-audit-XRPT3OU2.js} +2 -2
- package/dist/{cost-B5SAHPOJ.js → cost-IDNVMAEV.js} +1 -1
- package/dist/{cost-MMWUDGZC.js → cost-PK4KIF7R.js} +1 -1
- package/dist/{cursor-cli-Q2HLQ5TE.js → cursor-cli-QKF7Z6M2.js} +1 -1
- package/dist/{cursorrules-3BW6K6D5.js → cursorrules-U5O4G5T4.js} +1 -1
- package/dist/{decision-loader-4KMQVAXZ.js → decision-loader-2XPZE4EZ.js} +1 -1
- package/dist/{delete-7PQZUERZ.js → delete-P5VULXR4.js} +1 -1
- package/dist/{diff-F2HUO2H3.js → diff-JVEYCXUC.js} +1 -1
- package/dist/{discipline-ARFFIXQL.js → discipline-H7LDI6NT.js} +1 -1
- package/dist/{dist-MRZDZ5SX.js → dist-3ZCH25SG.js} +1 -1
- package/dist/{dist-KGRCLBJP-R5CCPPXN.js → dist-KGRCLBJP-2QAPFYNF.js} +1 -1
- package/dist/{dist-YUXXIXB3.js → dist-QBTQW4ZW.js} +1 -1
- package/dist/{dist-OKM6BXTH.js → dist-VGFSP3XM.js} +1 -1
- package/dist/{dist-VWC6FA46.js → dist-VXCZWVVJ.js} +1 -1
- package/dist/{dist-5IUWRFG6.js → dist-W3XCATBJ.js} +1 -1
- package/dist/{docs-6WOQILZS.js → docs-EDQ2STFK.js} +1 -1
- package/dist/{docs-BI2DO7B2.js → docs-USDAF26F.js} +2 -2
- package/dist/doctor-G37LCXG5.js +2 -0
- package/dist/{drift-6QPDKKUO.js → drift-ILZE5BFJ.js} +1 -1
- package/dist/{echo-3JJDKCNF.js → echo-UPTQUEDU.js} +1 -1
- package/dist/{edit-PLCGL5OV.js → edit-GUU3HBVW.js} +1 -1
- package/dist/{enforcement-IWABOHMY.js → enforcement-46XWPNSA.js} +1 -1
- package/dist/{enforcement-5MHSQAXE.js → enforcement-BEGPQIUN.js} +1 -1
- package/dist/{event-5J3GBWKT.js → event-Y3VXC2RV.js} +1 -1
- package/dist/{explain-files-LPHTJL4N.js → explain-files-3GPZUETV.js} +1 -1
- package/dist/{export-NXUFTFPW.js → export-CV5KCTPS.js} +1 -1
- package/dist/{flow-IT2IVXXT.js → flow-POQP27WA.js} +1 -1
- package/dist/{gap-narrator-DVXPWNFN.js → gap-narrator-NTXLUI7I.js} +1 -1
- package/dist/{global-J2VTYKCC.js → global-C44FW4G2.js} +1 -1
- package/dist/{graduate-N2HF4JT6.js → graduate-3BBSC27A.js} +1 -1
- package/dist/graph-CNDE5TAT.js +2 -0
- package/dist/{graph-server-TBHHBFOM.js → graph-server-COZR5C3Z.js} +1 -1
- package/dist/{habits-JTMWGVPH.js → habits-BX2IRSUI.js} +3 -3
- package/dist/{history-FHS7EC3Z.js → history-UW454SDP.js} +1 -1
- package/dist/{hooks-BL6CXRVK.js → hooks-BNWRGACA.js} +1 -1
- package/dist/index.js +5 -5
- package/dist/init-EHVSM7YY.js +2 -0
- package/dist/{integrity-UBMZCB77.js → integrity-UYDOOJDP.js} +1 -1
- package/dist/{integrity-checker-VSR3ITBL.js → integrity-checker-DHGMZQDG.js} +1 -1
- package/dist/journal-loader-GLH7XFTK.js +2 -0
- package/dist/{lint-KQQ2RMSJ.js → lint-IGKE6UPS.js} +1 -1
- package/dist/{list-37UCWCOQ.js → list-5IUGP3ZB.js} +1 -1
- package/dist/{list-6WY4CFUR.js → list-YKIQNKGB.js} +1 -1
- package/dist/lore-loader-RVQI5GXL.js +2 -0
- package/dist/{lore-loader-PBUDKXAJ.js → lore-loader-XY5MZRR2.js} +1 -1
- package/dist/{lore-server-A3KKZLSY.js → lore-server-FC2GMDLT.js} +1 -1
- package/dist/{manual-HKI6OXB4.js → manual-RXSPSFLL.js} +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{migrate-W3KCXLDS.js → migrate-YQG2FG3J.js} +2 -2
- package/dist/{migrate-assessments-D2TOBJ5V.js → migrate-assessments-GEI5WMI2.js} +1 -1
- package/dist/{model-discovery-TWX4A4YD.js → model-discovery-HMB3YI4L.js} +1 -1
- package/dist/{nomination-engine-A24774W4.js → nomination-engine-KNSOAT4W.js} +1 -1
- package/dist/{notebook-LXJ2LHUA.js → notebook-PE3JSYZI.js} +1 -1
- package/dist/notebook-loader-CENTDDUJ.js +2 -0
- package/dist/{orchestrate-WFCNV2II.js → orchestrate-RCAMBOIB.js} +1 -1
- package/dist/{peers-7TPZTKH7.js → peers-P2KXU7ZK.js} +1 -1
- package/dist/{persona-UGTCFEGT.js → persona-STQWZH5P.js} +1 -1
- package/dist/{pipeline-7PZ6ILWX.js → pipeline-MZUITRVN.js} +1 -1
- package/dist/{platform-server-YIBX4YDJ.js → platform-server-DNAMH4YI.js} +2 -2
- package/dist/{plugin-update-checker-2EM4K45U.js → plugin-update-checker-M7PW434O.js} +1 -1
- package/dist/{portal-check-YSDJRZUR.js → portal-check-Z3OCQEQR.js} +1 -1
- package/dist/{portal-compliance-OBPK2IR5.js → portal-compliance-4MG5F2GI.js} +1 -1
- package/dist/{probe-WKXR3IN4.js → probe-B22G2JKF.js} +1 -1
- package/dist/{project-type-MRBJAKC7.js → project-type-EUCFKEAZ.js} +1 -1
- package/dist/{promote-VHBA56KW.js → promote-NJQDZBZA.js} +2 -2
- package/dist/{providers-RX7SBLHZ.js → providers-AWA7WLLM.js} +1 -1
- package/dist/{quiz-3SQNPRJ3.js → quiz-FE5UGAY2.js} +1 -1
- package/dist/{record-7QJPZZP7.js → record-YXPB34MY.js} +1 -1
- package/dist/{registry-LR5QACRK.js → registry-KOOKFUWD.js} +2 -2
- package/dist/reindex-O3WUCEE2.js +2 -0
- package/dist/{remember-SFGBTTEE.js → remember-MJRNTXYS.js} +1 -1
- package/dist/{retag-GFXUYP7S.js → retag-N5XF3KXP.js} +1 -1
- package/dist/{review-6KKZWV3A.js → review-6UAH6V3R.js} +1 -1
- package/dist/{review-GEBSYOZB.js → review-77QI6VOC.js} +1 -1
- package/dist/{ripple-4F5ZCXS4.js → ripple-ZGDITCGB.js} +1 -1
- package/dist/{roster-RI3UC2YI.js → roster-HV5KYUOI.js} +1 -1
- package/dist/{scaffold-WA4L2K7J.js → scaffold-D57JXPCC.js} +1 -1
- package/dist/{scopes-commands-5FFIUDRC.js → scopes-commands-NSPERZWV.js} +1 -1
- package/dist/{sentinel-37ZEEWT7.js → sentinel-HYAZ3CO5.js} +2 -2
- package/dist/{sentinel-bridge-EZGFRVFH.js → sentinel-bridge-VR357PKL.js} +1 -1
- package/dist/{serve-2BXDL35A.js → serve-L52ZUTU6.js} +2 -2
- package/dist/{serve-5JME5QEM.js → serve-OY6XYL7F.js} +2 -2
- package/dist/{serve-2LSTQFFQ.js → serve-U47GULB6.js} +2 -2
- package/dist/{server-XLHIYDTZ.js → server-2MNROHF6.js} +1 -1
- package/dist/{server-AIXFROYL.js → server-4YNUIK4W.js} +1 -1
- package/dist/session-tracker-D2CH7RJF.js +2 -0
- package/dist/{session-work-log-6GKGUQ5C.js → session-work-log-BX434ZLK.js} +1 -1
- package/dist/{session-work-log-UYMIWWOX.js → session-work-log-NQA7WJEC.js} +1 -1
- package/dist/{setup-ZM4JFV5D.js → setup-3F5IK7MO.js} +2 -2
- package/dist/{setup-F2N4LUR7.js → setup-KPIMRZ4Q.js} +1 -1
- package/dist/{shift-DDYVQJ75.js → shift-RRNL6E4O.js} +3 -3
- package/dist/{show-RFOIR2GQ.js → show-BOAVWZPZ.js} +1 -1
- package/dist/{show-CZLVYLM5.js → show-PJ5LFLIL.js} +1 -1
- package/dist/{snapshot-6N564OUJ.js → snapshot-L2G56RPL.js} +1 -1
- package/dist/{spawn-HYARN3RL.js → spawn-M5BAV252.js} +1 -1
- package/dist/{status-WBJ6D7BD.js → status-77M3SDIF.js} +1 -1
- package/dist/{status-CUG3PKGC.js → status-A37ECYNJ.js} +1 -1
- package/dist/{summary-2AM4QVPW.js → summary-LXLHFRN7.js} +1 -1
- package/dist/{sweep-WHDT7ENV.js → sweep-HU74OPVW.js} +1 -1
- package/dist/{switch-HBGIFNF6.js → switch-CTW4PDGI.js} +1 -1
- package/dist/{symphony-CWKKMFAS.js → symphony-7INZR43F.js} +5 -5
- package/dist/{symphony-VTHVTE57.js → symphony-G6IENE4K.js} +1 -1
- package/dist/{symphony-loader-RYFZOQJS.js → symphony-loader-VA4UREOM.js} +1 -1
- package/dist/{symphony-peers-LWBUQ3T4.js → symphony-peers-U4KHMKGI.js} +1 -1
- package/dist/{symphony-peers-ISJPKX7W.js → symphony-peers-X5NGWXFP.js} +1 -1
- package/dist/{symphony-relay-L3BY6RGM.js → symphony-relay-2RHG25Z4.js} +1 -1
- package/dist/{sync-WIFD7UCL.js → sync-DLUBV5HQ.js} +1 -1
- package/dist/{sync-llms-MZ3RQWFX.js → sync-llms-7CAI74QL.js} +1 -1
- package/dist/{task-loader-EU7JLTR3.js → task-loader-NZFDTUQ5.js} +1 -1
- package/dist/{team-C3PWO7XL.js → team-NSP6PMPS.js} +1 -1
- package/dist/{test-6MUL4EXS.js → test-BQJMS4Y2.js} +1 -1
- package/dist/{thread-K6UHDIUW.js → thread-HFXK65D4.js} +1 -1
- package/dist/{timeline-S26CQWHT.js → timeline-K3ZFKJ3R.js} +1 -1
- package/dist/tools-NNPANZRA.js +2 -0
- package/dist/{triage-YF6WYZY4.js → triage-FCWOZASE.js} +1 -1
- package/dist/{tutorial-UEBX7Z2G.js → tutorial-UC6YQMNN.js} +1 -1
- package/dist/{university-UMT7PAKE.js → university-FJ7OCOA3.js} +1 -1
- package/dist/{upgrade-USW7YJEX.js → upgrade-GX56QE3C.js} +1 -1
- package/dist/{validate-VZGBVTPM.js → validate-C6SMKGYD.js} +1 -1
- package/dist/{validate-2PZTNYSS.js → validate-LSCDOLBO.js} +1 -1
- package/dist/{validate-KW3YFGTV.js → validate-VZXTJHGO.js} +1 -1
- package/dist/{watch-KQU3S7KE.js → watch-PZCCUP6K.js} +1 -1
- package/dist/{watch-HL3ZOALL.js → watch-YCODNIET.js} +1 -1
- package/dist/{wisdom-UU7HOE3M.js → wisdom-XZ3QKPNP.js} +1 -1
- package/dist/{work-log-loader-J27XSFCE.js → work-log-loader-DL5GZ2BQ.js} +1 -1
- package/dist/workspace-MKSQN7B2.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-BRHQJLTG.js +0 -2
- package/dist/chunk-DSYEGRQ2.js +0 -3
- package/dist/chunk-F5BSUC2L.js +0 -3
- package/dist/chunk-NFQLONFY.js +0 -3
- package/dist/chunk-OVDYPOHR.js +0 -2
- package/dist/chunk-XHJ27CER.js +0 -2
- package/dist/doctor-JLTCBMS4.js +0 -2
- package/dist/graph-VLMP6DW2.js +0 -2
- package/dist/init-ZS7RAR7L.js +0 -2
- package/dist/journal-loader-EELDB4P2.js +0 -2
- package/dist/lore-loader-CP5RUJ4A.js +0 -2
- package/dist/notebook-loader-CF52PNZC.js +0 -2
- package/dist/reindex-F7EV3Z34.js +0 -2
- package/dist/session-tracker-VSFRNFRL.js +0 -2
- package/dist/tools-4WKLLDFU.js +0 -2
- package/dist/workspace-CE6LNXVI.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b as b$1}from'./chunk-
|
|
2
|
+
import {b as b$1}from'./chunk-5TAVYPOV.js';import*as i from'fs';import*as a from'path';import*as u from'js-yaml';import {execSync}from'child_process';function j(s){let e=s.toLowerCase();return e.includes("claude")||e.includes("anthropic")?"anthropic":e.includes("gpt")||e.includes("openai")||e.includes("o1")||e.includes("o3")?"openai":e.includes("gemini")||e.includes("google")||e.includes("palm")?"google":e.includes("llama")||e.includes("meta")?"meta":e.includes("mistral")||e.includes("mixtral")?"mistral":e.includes("deepseek")?"deepseek":e.includes("cohere")||e.includes("command")?"cohere":"unknown"}function T(s){let e=s,n=e.author;if(e.type||(e.type="agent-session"),typeof n=="string")return s;if(n&&typeof n=="object"&&!Array.isArray(n)){let t=n;t.type==="agent"?(e.author="unknown",e.agent={provider:t.model?j(t.model):j(t.id),model:t.model||t.id}):e.author=t.id||"unknown",delete e.assistedBy;}return e}function E(s){return s.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,20)||"unknown"}function F(){let s=process.env.PARADIGM_AUTHOR;if(s)return E(s);try{let e=execSync("git config user.name",{encoding:"utf-8",timeout:3e3}).trim();if(e)return E(e)}catch{}try{let e=os.userInfo().username;if(e)return E(e)}catch{}return "unknown"}function L(s){return s.endsWith(".yaml")||s.endsWith(".lore")}function k(s,e,n){let t=a.join(s,_,b,e),r=a.join(t,`${n}.lore`);if(i.existsSync(r))return r;let o=a.join(t,`${n}.yaml`);return i.existsSync(o)?o:null}async function O(s,e){let n=a.join(s,_,b);if(!i.existsSync(n))return [];$(s);let t=[],r=i.readdirSync(n).filter(o=>/^\d{4}-\d{2}-\d{2}$/.test(o)).sort().reverse();for(let o of r){if(e?.dateFrom&&o<e.dateFrom.slice(0,10)||e?.dateTo&&o>e.dateTo.slice(0,10))continue;let f=a.join(n,o),l=i.readdirSync(f).filter(L).sort();for(let c of l)try{let g=i.readFileSync(a.join(f,c),"utf8"),d=u.load(g);t.push(T(d));}catch{}}return e?M(t,e):t}async function P(s,e){let n=e.match(/^L-(\d{4}-\d{2}-\d{2})-/);if(n){let r=n[1],o=k(s,r,e);if(o)try{let f=i.readFileSync(o,"utf8"),l=u.load(f);return T(l)}catch{return null}}return (await O(s)).find(r=>r.id===e)||null}async function z(s){let e=a.join(s,_,R);if(!i.existsSync(e))return null;try{let n=i.readFileSync(e,"utf8");return u.load(n)}catch{return null}}function B(s){try{let e=execSync("git rev-parse HEAD",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),n=execSync("git rev-parse --abbrev-ref HEAD",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),t=execSync("git status --porcelain",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();return {ref:e,branch:n,dirty:t.length>0}}catch{return}}async function H(s,e){let n=a.join(s,_),t=e.timestamp.slice(0,10),r=a.join(n,b,t);i.existsSync(r)||i.mkdirSync(r,{recursive:true}),e.author||(e.author=F()),e.git_context||(e.git_context=B(s)),e.id||(e.id=W(s,t,e.author,e.timestamp));let o=a.join(r,`${e.id}.lore`);return i.writeFileSync(o,u.dump(e,{lineWidth:-1,noRefs:true})),await A(s),e.id}async function K(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(t.review=n,i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),true):false}async function A(s){let e=a.join(s,_),n=a.join(e,b);if(!i.existsSync(n))return;$(s);let t=new Set,r=0,o="",f=i.readdirSync(n).filter(d=>/^\d{4}-\d{2}-\d{2}$/.test(d));for(let d of f){let y=a.join(n,d),h=i.readdirSync(y).filter(L);for(let w of h)try{let m=i.readFileSync(a.join(y,w),"utf8"),S=u.load(m),p=T(S);t.add(p.author),r++,(!o||p.timestamp>o)&&(o=p.timestamp);}catch{}}let l="unknown",c=a.join(s,".paradigm","config.yaml");if(i.existsSync(c))try{let d=u.load(i.readFileSync(c,"utf8"));l=d.project||d.name||"unknown";}catch{}let g={version:"1.0",project:l,entries:r,last_updated:o||new Date().toISOString(),authors:Array.from(t)};i.existsSync(e)||i.mkdirSync(e,{recursive:true}),i.writeFileSync(a.join(e,R),u.dump(g,{lineWidth:-1,noRefs:true}));}function $(s){let e=a.join(s,_,b);if(!i.existsSync(e))return 0;let n=i.readdirSync(e).filter(r=>L(r)&&!r.startsWith(".")),t=0;for(let r of n){let o=a.join(e,r);if(i.statSync(o).isFile())try{let l=i.readFileSync(o,"utf8"),c=u.load(l);if(c.author&&typeof c.author=="object"||typeof c.author=="string"&&c.timestamp)continue;let g=typeof c.date=="string"?c.date.slice(0,10):new Date().toISOString().slice(0,10),d=a.join(e,g);i.existsSync(d)||i.mkdirSync(d,{recursive:!0});let y=F(),h=`${g}T00:00:00.000Z`,w=W(s,g,y,h),m=String(c.type||"agent-session"),S=["agent-session","human-note","decision","review","incident","milestone"].includes(m)?m:"agent-session",p;if(c.test_results&&typeof c.test_results=="object"){let v=c.test_results;p={status:v.total===v.passed?"pass":"partial",details:{tests:v.total===v.passed?"pass":"fail"}};}let C={id:w,type:S,timestamp:h,author:"unknown",agent:{provider:"unknown",model:"unknown"},title:String(c.title||r.replace(/\.(yaml|lore)$/,"")),summary:String(c.summary||""),symbols_touched:Array.isArray(c.symbols_touched)?c.symbols_touched:[],files_modified:Array.isArray(c.files_modified)?c.files_modified:void 0,...p?{verification:p}:{},tags:["migrated",m]};i.writeFileSync(a.join(d,`${w}.lore`),u.dump(C,{lineWidth:-1,noRefs:!0})),i.unlinkSync(o),t++;}catch{}}return t}async function G(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(n.title!==void 0&&(t.title=n.title),n.summary!==void 0&&(t.summary=n.summary),n.type!==void 0&&(t.type=n.type),n.duration_minutes!==void 0&&(t.duration_minutes=n.duration_minutes),n.symbols_touched!==void 0&&(t.symbols_touched=n.symbols_touched),n.symbols_created!==void 0&&(t.symbols_created=n.symbols_created),n.files_created!==void 0&&(t.files_created=n.files_created),n.files_modified!==void 0&&(t.files_modified=n.files_modified),n.lines_added!==void 0&&(t.lines_added=n.lines_added),n.lines_removed!==void 0&&(t.lines_removed=n.lines_removed),n.commit!==void 0&&(t.commit=n.commit),n.decisions!==void 0&&(t.decisions=n.decisions),n.errors_encountered!==void 0&&(t.errors_encountered=n.errors_encountered),n.learnings!==void 0&&(t.learnings=n.learnings),n.verification!==void 0&&(t.verification=n.verification),n.tags!==void 0&&(t.tags=n.tags),n.body!==void 0&&(t.body=n.body),n.linked_lore!==void 0&&(t.linked_lore=n.linked_lore),n.linked_tasks!==void 0&&(t.linked_tasks=n.linked_tasks),n.linked_commits!==void 0&&(t.linked_commits=n.linked_commits),n.confidence!==void 0&&(t.confidence=n.confidence),n.assessment!==void 0&&(t.assessment=n.assessment),n.assessment_delta!==void 0&&(t.assessment_delta=n.assessment_delta),i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),await A(s),true):false}function I(s){switch(s){case "correct":return 1;case "partial":return .5;case "incorrect":return 0}}async function V(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(t.assessment=n,t.confidence!=null&&(t.assessment_delta=I(n.verdict)-t.confidence),i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),true):false}async function q(s,e){let n=await P(s,e);if(!n)return false;let t=n.timestamp.slice(0,10),r=k(s,t,e);if(!r)return false;i.unlinkSync(r);let o=a.dirname(r);return i.readdirSync(o).filter(L).length===0&&i.rmdirSync(o),await A(s),true}function M(s,e){let n=s;if(e.author&&(n=n.filter(t=>t.author===e.author)),e.hasAgent!==void 0?n=n.filter(t=>e.hasAgent?t.agent!=null:t.agent==null):e.authorType&&(n=n.filter(t=>e.authorType==="agent"?t.agent!=null:t.agent==null)),e.symbol&&(n=n.filter(t=>t.symbols_touched.includes(e.symbol)||t.symbols_created?.includes(e.symbol))),e.dateFrom){let t=new Date(e.dateFrom).getTime();n=n.filter(r=>new Date(r.timestamp).getTime()>=t);}if(e.dateTo){let t=new Date(e.dateTo).getTime();n=n.filter(r=>new Date(r.timestamp).getTime()<=t);}if(e.type&&(n=n.filter(t=>t.type===e.type)),e.tag){let t=e.tag;n=n.filter(r=>r.tags?.some(o=>o===t||o.startsWith(t+":")||t.includes(":")&&o===t));}return e.tags&&e.tags.length>0&&(n=n.filter(t=>e.tags.some(r=>t.tags?.includes(r)))),e.hasBody!==void 0&&(n=n.filter(t=>e.hasBody?t.body!=null&&t.body.length>0:!t.body||t.body.length===0)),e.hasReview!==void 0&&(n=n.filter(t=>e.hasReview?t.review!=null:t.review==null)),e.hasConfidence!==void 0&&(n=n.filter(t=>e.hasConfidence?t.confidence!=null:t.confidence==null)),e.hasAssessment!==void 0&&(n=n.filter(t=>e.hasAssessment?t.assessment!=null:t.assessment==null)),n.sort((t,r)=>new Date(r.timestamp).getTime()-new Date(t.timestamp).getTime()),e.offset&&(n=n.slice(e.offset)),e.limit&&(n=n.slice(0,e.limit)),n}function W(s,e,n,t){let r=E(n),o=new Date(t),f=String(o.getUTCHours()).padStart(2,"0"),l=String(o.getUTCMinutes()).padStart(2,"0"),c=String(o.getUTCSeconds()).padStart(2,"0"),g=`${f}${l}${c}`,d=`L-${e}-${r}-${g}`,y=a.join(s,_,b,e);if(!i.existsSync(y))return `${d}-001`;let h=i.readdirSync(y).filter(m=>m.startsWith(d)&&L(m)).map(m=>{let S=m.match(/-(\d{3})\.(yaml|lore)$/);return S?parseInt(S[1],10):0}),w=h.length>0?Math.max(...h)+1:1;return `${d}-${String(w).padStart(3,"0")}`}var _,b,R,N=b$1(()=>{_=".paradigm/lore",b="entries",R="timeline.yaml";});export{O as a,P as b,z as c,H as d,K as e,A as f,G as g,V as h,q as i,N as j};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {f,a}from'./chunk-
|
|
2
|
+
import {f,a}from'./chunk-BV5PRPLB.js';import {e}from'./chunk-AO7ZSRME.js';import {a as a$1}from'./chunk-FYDRENK7.js';import {b,d,c}from'./chunk-EKZDFEJW.js';import*as h from'fs';import*as A from'path';import*as R from'js-yaml';import {glob}from'glob';import {EventEmitter}from'events';var H=/[#$^!~][a-zA-Z0-9_-]+/g;function V(r){let e=r.match(H)||[];return [...new Set(e)]}function G(r){let e=r.charAt(0);return {"#":"component",$:"flow","^":"gate","!":"signal","~":"aspect"}[e]||"unknown"}async function M(r,e,s,t){let o=A.join(s,".paradigm"),n=V(e),a=K(r,t),c=W(a.include||[],n),l=a.exclude||[],p=await J(s,c,l);return {systemPrompt:await Y(r,o,n),files:p,symbols:n}}function K(r,e){return e?.contextInclude||e?.contextExclude?{include:e.contextInclude,exclude:e.contextExclude}:{architect:{include:["specs/*.md",".purpose","**/.purpose","portal.yaml",".paradigm/config.yaml"],exclude:["src/**","tests/**","node_modules/**","dist/**"]},builder:{include:["src/**","tests/**","{feature}.purpose","specs/{feature}.md"],exclude:["specs/*.md","node_modules/**","dist/**"]},reviewer:{include:["src/**","specs/*.md","portal.yaml",".purpose"],exclude:["tests/**","node_modules/**","dist/**"]},tester:{include:["tests/**","health.yaml","{feature}.purpose"],exclude:["src/**","specs/**","node_modules/**","dist/**"]},security:{include:["portal.yaml","src/middleware/**","src/auth/**",".paradigm/wisdom/antipatterns.yaml"],exclude:["src/routes/**","tests/**","node_modules/**","dist/**"]}}[r.name]||{include:[".purpose","portal.yaml"],exclude:["node_modules/**","dist/**"]}}function W(r,e){let s=[];for(let t of r)if(t.includes("{feature}")||t.includes("{symbol}"))for(let o of e){let n=o.substring(1);s.push(t.replace(/\{feature\}/g,n).replace(/\{symbol\}/g,n));}else s.push(t);return s}async function J(r,e,s){let t=new Set;for(let o of e)try{let n=await glob(o,{cwd:r,ignore:s,nodir:!0,absolute:!1});for(let a of n)t.add(a);}catch{}return Array.from(t)}async function Y(r,e,s){let t=[],o=A.join(e,"config.yaml"),n=null;if(h.existsSync(o))try{n=R.load(h.readFileSync(o,"utf-8"));}catch{}if(t.push(`# ${r.name.charAt(0).toUpperCase()+r.name.slice(1)} Agent Context
|
|
3
3
|
`),n?.project&&(t.push(`> Project: ${n.project}`),n.discipline&&n.discipline!=="auto"&&t.push(`> Discipline: ${n.discipline}`),t.push("")),n?.["agent-guidelines"]?.overview&&(t.push(`## Project Overview
|
|
4
4
|
`),t.push(n["agent-guidelines"].overview),t.push("")),n?.["symbol-system"]){t.push(`## Symbol System
|
|
5
5
|
`),t.push("| Symbol | Meaning | Description |"),t.push("|--------|---------|-------------|");for(let[c,l]of Object.entries(n["symbol-system"]))t.push(`| \`${c}\` | ${l.name} | ${l.description} |`);t.push("");}if(n?.conventions){let c=Z(n.conventions,r.name);if(c.length>0){t.push(`## Conventions
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {c as c$1,b as b$1}from'./chunk-5TAVYPOV.js';import*as s from'fs';import*as c from'path';import*as g from'js-yaml';var b={};c$1(b,{getJournalStats:()=>S,loadAllJournalEntries:()=>E,loadJournalEntries:()=>f,loadJournalEntry:()=>J,recordJournalEntry:()=>h});function m(e){let r=process.env.HOME||process.env.USERPROFILE||"";return c.join(r,".paradigm","agents",e,"journal")}function y(){let e=new Date,r=e.toISOString().slice(0,10),i=e.toISOString().slice(11,19).replace(/:/g,""),o=String(Math.floor(Math.random()*999)+1).padStart(3,"0");return `LJ-${r}-${i}-${o}`}function h(e,r){let i=new Date,o=y(),a={id:o,agent:e,timestamp:i.toISOString(),...r},t=m(e);s.mkdirSync(t,{recursive:true});let n=c.join(t,`${o}.yaml`);return s.writeFileSync(n,g.dump(a,{lineWidth:120,noRefs:true}),"utf8"),a}function f(e,r){let i=m(e);if(!s.existsSync(i))return [];let o=[],a=s.readdirSync(i).filter(n=>n.endsWith(".yaml"));for(let n of a)try{let l=s.readFileSync(c.join(i,n),"utf8"),u=g.load(l);u&&u.id&&o.push(u);}catch{}let t=o;return r?.trigger&&(t=t.filter(n=>n.trigger===r.trigger)),r?.project&&(t=t.filter(n=>n.project===r.project)),r?.transferable!==void 0&&(t=t.filter(n=>n.transferable===r.transferable)),r?.tag&&(t=t.filter(n=>n.tags?.some(l=>l.startsWith(r.tag)))),r?.dateFrom&&(t=t.filter(n=>n.timestamp>=r.dateFrom)),r?.dateTo&&(t=t.filter(n=>n.timestamp<=r.dateTo)),t.sort((n,l)=>l.timestamp.localeCompare(n.timestamp)),r?.limit&&(t=t.slice(0,r.limit)),t}function J(e,r){let i=m(e),o=c.join(i,`${r}.yaml`);if(!s.existsSync(o))return null;let a=s.readFileSync(o,"utf8");return g.load(a)}function E(e){let r=process.env.HOME||process.env.USERPROFILE||"",i=c.join(r,".paradigm","agents");if(!s.existsSync(i))return [];let o=[],a=s.readdirSync(i,{withFileTypes:true}).filter(t=>t.isDirectory());for(let t of a){if(e?.agent&&t.name!==e.agent)continue;let n=f(t.name,e);o.push(...n);}return o.sort((t,n)=>n.timestamp.localeCompare(t.timestamp)),e?.limit?o.slice(0,e.limit):o}function S(e){let r=f(e),i={},o={},a=0;for(let t of r)i[t.trigger]=(i[t.trigger]||0)+1,o[t.project]=(o[t.project]||0)+1,t.transferable&&a++;return {total:r.length,byTrigger:i,byProject:o,transferableCount:a,recentInsights:r.slice(0,5).map(t=>({id:t.id,trigger:t.trigger,insight:t.insight.slice(0,200),timestamp:t.timestamp}))}}var j=b$1(()=>{});export{h as a,f as b,J as c,E as d,S as e,b as f,j as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {b as b$1,c as c$1,d}from'./chunk-5TAVYPOV.js';import*as c from'fs';import*as l from'path';import*as y from'js-yaml';var g,R=b$1(()=>{g={enabled:true,thresholds:{minComplianceRate:90,minEvents:20,timeWindowDays:30,minConsecutiveSessions:5,recencyDays:7},demotion:{failureThreshold:3,failureWindowDays:7,cooldownDays:14},neverGraduate:["explore-before-implement","ripple-before-modify","check-fragility","wisdom-before-implement","confidence-on-decisions","university-onboarded","university-content-valid"]};});var M={};c$1(M,{getAllStates:()=>ie,getConfig:()=>te,getState:()=>G,incrementFailure:()=>se,invalidateGraduationCache:()=>ae,isGraduated:()=>oe,loadGraduation:()=>p,markNeverGraduate:()=>ne,saveGraduation:()=>H,setTier:()=>re});function A(e){return l.join(e,".paradigm","graduation.yaml")}function p(e){let t=l.resolve(e);if(m&&b===t&&Date.now()-v<ee)return m;let o=A(t),i;if(c.existsSync(o))try{let r=c.readFileSync(o,"utf8");i=y.load(r);}catch{i={version:"1.0",config:{},states:{}};}else i={version:"1.0",config:{},states:{}};return i.version||(i.version="1.0"),i.config||(i.config={}),i.states||(i.states={}),m=i,b=t,v=Date.now(),i}function H(e,t){let o=l.resolve(e),i=A(o),r=l.dirname(i);c.existsSync(r)||c.mkdirSync(r,{recursive:true});let n=y.dump(t,{lineWidth:120,noRefs:true,sortKeys:true});c.writeFileSync(i,n,"utf8"),m=t,b=o,v=Date.now();}function te(e){let t=p(e);return {...g,...t.config,thresholds:{...g.thresholds,...t.config?.thresholds},demotion:{...g.demotion,...t.config?.demotion},neverGraduate:t.config?.neverGraduate??g.neverGraduate}}function w(e){return {habitId:e,tier:"habit",previousTier:null,graduatedAt:null,demotedAt:null,complianceAtGraduation:0,hookScript:null,failureCount:0,cooldownUntil:null,neverGraduate:false}}function G(e,t){let i=p(e).states[t];return i?{...w(t),...i,habitId:t}:w(t)}function ie(e){let t=p(e),o={};for(let[i,r]of Object.entries(t.states))o[i]={...w(i),...r,habitId:i};return o}function oe(e,t){return G(e,t).tier==="hook"}function re(e,t,o,i){let r=p(e),n=r.states[t]||{};r.states[t]={...n,tier:o,previousTier:n.tier||"habit",...o==="hook"?{graduatedAt:new Date().toISOString(),failureCount:0}:{},...o==="habit"&&n.tier==="hook"?{demotedAt:new Date().toISOString()}:{},...i},H(e,r);}function ne(e,t){let o=p(e);o.states[t]||(o.states[t]={}),o.states[t].neverGraduate=true,o.states[t].tier="habit",H(e,o);}function se(e,t){let o=p(e);o.states[t]||(o.states[t]={});let i=(o.states[t].failureCount||0)+1;return o.states[t].failureCount=i,H(e,o),i}function ae(){m=null,b=null,v=0;}var m,b,v,ee,j=b$1(()=>{R();m=null,b=null,v=0,ee=3e4;});var E=[{id:"explore-before-implement",name:"Explore Before Implementing",description:"Call ripple/navigate/search before modifying existing symbols to understand impact",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_ripple","paradigm_navigate","paradigm_search","paradigm_related"]}},enabled:true},{id:"ripple-before-modify",name:"Ripple Before Modifying",description:"Run ripple analysis before modifying symbols with dependents",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_ripple"]}},enabled:true},{id:"check-fragility",name:"Check Fragility",description:"Check history fragility for symbols before modifying frequently-broken code",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_history_fragility"]}},enabled:true},{id:"wisdom-before-implement",name:"Check Team Wisdom",description:"Check team wisdom (preferences, antipatterns, decisions) before implementing",category:"collaboration",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_wisdom_context","paradigm_wisdom_expert"]}},enabled:true},{id:"verify-before-done",name:"Verify Before Done",description:"Run postflight compliance checks before finishing a session",category:"verification",trigger:"on-stop",severity:"warn",check:{type:"tool-called",params:{tools:["paradigm_pm_postflight"]}},enabled:true},{id:"postflight-compliance",name:"Postflight Compliance",description:"Ensure postflight checks pass without errors before finishing",category:"verification",trigger:"on-stop",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_pm_postflight","paradigm_reindex"]}},enabled:true},{id:"test-new-components",name:"Test New Components",description:"New components should have associated tests or test plan documented",category:"testing",trigger:"postflight",severity:"advisory",check:{type:"tests-exist",params:{patterns:["**/*.test.*","**/*.spec.*","**/tests/**"]}},enabled:true},{id:"purpose-coverage",name:"Purpose File Coverage",description:"All modified source directories should have .purpose file coverage",category:"documentation",trigger:"postflight",severity:"warn",check:{type:"file-exists",params:{patterns:["**/.purpose"]}},enabled:true},{id:"record-lore-for-significant",name:"Record Lore for Significant Changes",description:"Sessions modifying 3+ files should record a lore entry",category:"documentation",trigger:"on-stop",severity:"warn",check:{type:"lore-recorded",params:{}},enabled:true},{id:"gates-for-routes",name:"Gates for Routes",description:"API routes should have corresponding gate declarations in portal.yaml",category:"security",trigger:"postflight",severity:"warn",check:{type:"gates-declared",params:{requireRoutes:true}},enabled:true},{id:"commit-message-symbols",name:"Commit Message Format",description:"Commit messages should follow type(#symbol): format and include a Symbols: trailer",category:"documentation",trigger:"on-commit",severity:"advisory",check:{type:"commit-message-format",params:{messagePatterns:["^(feat|fix|refactor|chore|docs|test|style|perf|ci|build)\\(","Symbols:"]}},enabled:true},{id:"flow-coverage-for-multi-component",name:"Flow Coverage",description:"Changes spanning 3+ components should have a documented $flow",category:"documentation",trigger:"postflight",severity:"advisory",check:{type:"flow-coverage",params:{minSteps:3}},enabled:true},{id:"context-session-awareness",name:"Context Awareness",description:"Use session recovery or context check tools for session continuity",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"context-checked",params:{contextTools:["paradigm_session_health","paradigm_session_recover","paradigm_session_checkpoint"]}},enabled:true},{id:"aspect-anchors-valid",name:"Aspect Anchors Valid",description:"Aspects touched during the session should have their code anchors validated",category:"verification",trigger:"postflight",severity:"advisory",check:{type:"aspect-anchored",params:{checkAnchors:true}},enabled:true}];var V=E,Y=30*1e3;function K(e){try{let t=l.join(e,".paradigm","config.yaml");if(c.existsSync(t)){let o=c.readFileSync(t,"utf8"),r=y.load(o)?.limits;if(r?.habitsCacheTtlMs&&typeof r.habitsCacheTtlMs=="number")return r.habitsCacheTtlMs}}catch{}return Y}var k=new Map;function z(e){let t=l.resolve(e),o=k.get(t),i=K(t);if(o&&Date.now()-o.loadedAt<i)return o.habits;let r=Q(t);return k.set(t,{habits:r,loadedAt:Date.now()}),r}function Q(e){let t=new Map;for(let s of V)t.set(s.id,{...s});let o=process.env.HOME||process.env.USERPROFILE||"~",i=S(l.join(o,".paradigm","habits.yaml"));i&&D(t,i);let r=T(l.join(o,".paradigm","habits"));for(let s of r)t.set(s.id,s);let n=S(l.join(e,".paradigm","habits.yaml"));n&&D(t,n);let u=T(l.join(e,".paradigm","habits"));for(let s of u)t.set(s.id,s);return Array.from(t.values())}function T(e){if(!c.existsSync(e))return [];try{let t=c.readdirSync(e).filter(i=>i.endsWith(".habit")).sort(),o=[];for(let i of t)try{let r=c.readFileSync(l.join(e,i),"utf8"),n=y.load(r);n?.id&&n?.name&&o.push(n);}catch{}return o}catch{return []}}function S(e){if(!c.existsSync(e))return null;try{let t=c.readFileSync(e,"utf8");return y.load(t)}catch{return null}}function D(e,t){if(t.habits)for(let o of t.habits)e.set(o.id,{...o});if(t.overrides)for(let[o,i]of Object.entries(t.overrides)){let r=e.get(o);r&&J(r,i);}}function J(e,t){t.severity!==void 0&&(e.severity=t.severity),t.enabled!==void 0&&(e.enabled=t.enabled);}function X(e){return e.filter(t=>t.enabled)}function Z(e){let t=l.resolve(e);k.delete(t);}var le=[{id:"explore-before-implement",name:"Explore Before Implementing",description:"Call ripple/navigate/search before modifying existing symbols to understand impact",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_ripple","paradigm_navigate","paradigm_search","paradigm_related"]}},enabled:true},{id:"ripple-before-modify",name:"Ripple Before Modifying",description:"Run ripple analysis before modifying symbols with dependents",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_ripple"]}},enabled:true},{id:"check-fragility",name:"Check Fragility",description:"Check history fragility for symbols before modifying frequently-broken code",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_history_fragility"]}},enabled:true},{id:"wisdom-before-implement",name:"Check Team Wisdom",description:"Check team wisdom (preferences, antipatterns, decisions) before implementing",category:"collaboration",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_wisdom_context","paradigm_wisdom_expert"]}},enabled:true},{id:"verify-before-done",name:"Verify Before Done",description:"Run postflight compliance checks before finishing a session",category:"verification",trigger:"on-stop",severity:"warn",check:{type:"tool-called",params:{tools:["paradigm_pm_postflight"]}},enabled:true},{id:"postflight-compliance",name:"Postflight Compliance",description:"Ensure postflight checks pass without errors before finishing",category:"verification",trigger:"on-stop",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_pm_postflight","paradigm_reindex"]}},enabled:true},{id:"test-new-components",name:"Test New Components",description:"New components should have associated tests or test plan documented",category:"testing",trigger:"postflight",severity:"advisory",check:{type:"tests-exist",params:{patterns:["**/*.test.*","**/*.spec.*","**/tests/**"]}},enabled:true},{id:"purpose-coverage",name:"Purpose File Coverage",description:"All modified source directories should have .purpose file coverage",category:"documentation",trigger:"postflight",severity:"warn",check:{type:"file-exists",params:{patterns:["**/.purpose"]}},enabled:true},{id:"record-lore-for-significant",name:"Record Lore for Significant Changes",description:"Sessions modifying 3+ files should record a lore entry",category:"documentation",trigger:"on-stop",severity:"warn",check:{type:"lore-recorded",params:{}},enabled:true},{id:"confidence-on-decisions",name:"Confidence on Decisions",description:"When recording lore, include a confidence score (0.0-1.0) to enable calibration tracking over time",category:"documentation",trigger:"on-stop",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_lore_record"]}},enabled:true},{id:"gates-for-routes",name:"Gates for Routes",description:"API routes should have corresponding gate declarations in portal.yaml",category:"security",trigger:"postflight",severity:"warn",check:{type:"gates-declared",params:{requireRoutes:true}},enabled:true},{id:"university-content-valid",name:"University Content Valid",description:"Validate university content integrity when files in symbol-covered areas change",category:"quality",trigger:"on-stop",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_university_validate"]}},enabled:true},{id:"university-onboarded",name:"University Onboarding",description:"Call paradigm_university_onboard at session start for project-specific learning content",category:"discovery",trigger:"preflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_university_onboard"]}},enabled:false},{id:"orchestration-required",name:"Orchestrate Complex Tasks",description:"Tasks affecting 3+ files or touching security symbols should use paradigm_orchestrate_inline to determine which agents are needed. Ensures security review, test coverage, and documentation.",category:"collaboration",trigger:"preflight",severity:"warn",check:{type:"tool-called",params:{tools:["paradigm_orchestrate_inline"]}},enabled:true},{id:"agent-coverage-validated",name:"Validate Agent Involvement",description:"After completing work, verify that agents with relevant expertise were consulted. Check nominations that were surfaced but not acted on.",category:"collaboration",trigger:"postflight",severity:"advisory",check:{type:"tool-called",params:{tools:["paradigm_ambient_nominations","paradigm_agent_list"]}},enabled:true},{id:"hot-mode-incident",name:"Incident Response Acknowledgment",description:"During incident response, orchestration enforcement is waived. But a post-incident lore entry is required and a postflight review should be scheduled.",category:"collaboration",trigger:"on-stop",severity:"advisory",check:{type:"lore-recorded"},enabled:true}];function ce(e,t){return e.filter(o=>o.enabled&&o.trigger===t)}new Set(le.map(e=>e.id));function F(e,t,o,i,r){let n=ce(e,t);i&&(n=n.filter(a=>!a.platforms||a.platforms.includes(i)));let u=0;if(r)try{let{isGraduated:a}=(j(),d(M)),O=n.length;n=n.filter(q=>!a(r,q.id)),u=O-n.length;}catch{}let s=n.map(a=>ue(a,o)),W=s.filter(a=>a.result==="followed").length,I=s.filter(a=>a.result==="skipped").length,N=s.filter(a=>a.result==="partial").length,_=s.filter(a=>a.result==="skipped"&&a.habit.severity==="block").length;return {trigger:t,evaluations:s,summary:{total:s.length,followed:W,skipped:I,partial:N,blockingViolations:_},blocksCompletion:_>0}}function $(e){return {toolsCalled:e.toolsCalled||[],filesModified:e.filesModified||[],symbolsTouched:e.symbolsTouched||[],loreRecorded:e.loreRecorded||false,hasPortalRoutes:e.hasPortalRoutes||false,taskAddsRoutes:e.taskAddsRoutes||false,taskDescription:e.taskDescription,gitClean:e.gitClean}}function ue(e,t){switch(e.check.type){case "tool-called":return fe(e,t);case "file-exists":return pe(e,t);case "file-modified":return be(e,t);case "lore-recorded":return ge(e,t);case "symbols-registered":return me(e,t);case "gates-declared":return he(e,t);case "tests-exist":return ye(e,t);case "git-clean":return ve(e,t);case "commit-message-format":return Ce(e,t);case "flow-coverage":return He(e,t);case "context-checked":return ke(e,t);case "aspect-anchored":return we(e,t);default:return {habit:e,result:"partial",reason:`Unknown check: ${e.check.type}`}}}function fe(e,t){let o=e.check.params.tools||[];if(o.length===0)return {habit:e,result:"followed",reason:"No tools required"};let i=o.filter(r=>t.toolsCalled.includes(r));return i.length>0?{habit:e,result:"followed",reason:`Called: ${i.join(", ")}`,evidence:i}:t.filesModified.length===0&&t.symbolsTouched.length===0?{habit:e,result:"followed",reason:"No modifications, habit not applicable"}:{habit:e,result:"skipped",reason:`None of [${o.join(", ")}] were called before modifying code`}}function pe(e,t){if(t.filesModified.length===0)return {habit:e,result:"followed",reason:"No files modified"};if(t.filesModified.some(r=>r.endsWith(".purpose")||r.includes(".paradigm/")))return {habit:e,result:"followed",reason:"Purpose files updated"};let i=t.filesModified.filter(r=>!r.endsWith(".md")&&!r.endsWith(".json")&&!r.endsWith(".yaml")&&!r.endsWith(".yml")&&!r.endsWith(".lock")&&!r.endsWith(".purpose")&&!r.includes(".paradigm/"));return i.length===0?{habit:e,result:"followed",reason:"Only non-source files modified"}:{habit:e,result:"skipped",reason:`${i.length} source file(s) without .purpose updates`,evidence:i.slice(0,5)}}function ge(e,t){let o=t.filesModified.filter(i=>!i.endsWith(".md")&&!i.endsWith(".json")&&!i.endsWith(".yaml")&&!i.endsWith(".yml")&&!i.endsWith(".lock")&&!i.endsWith(".purpose")&&!i.includes(".paradigm/"));return o.length<3?{habit:e,result:"followed",reason:"Session not significant (< 3 source files)"}:t.loreRecorded||t.toolsCalled.includes("paradigm_lore_record")?{habit:e,result:"followed",reason:"Lore recorded"}:{habit:e,result:"skipped",reason:`${o.length} source files modified, no lore entry`,evidence:o.slice(0,5)}}function me(e,t){if(t.symbolsTouched.length===0)return {habit:e,result:"followed",reason:"No symbols touched"};let i=["paradigm_purpose_add_component","paradigm_purpose_add_signal","paradigm_purpose_add_flow","paradigm_purpose_add_gate","paradigm_purpose_add_aspect","paradigm_purpose_init"].filter(r=>t.toolsCalled.includes(r));return i.length>0?{habit:e,result:"followed",reason:`Purpose tools called: ${i.join(", ")}`,evidence:i}:{habit:e,result:"partial",reason:`${t.symbolsTouched.length} symbol(s) touched, no purpose registration`}}function he(e,t){if(!t.taskAddsRoutes)return {habit:e,result:"followed",reason:"No routes added"};if(t.hasPortalRoutes)return {habit:e,result:"followed",reason:"Portal.yaml has routes"};let i=["paradigm_gates_for_route","paradigm_portal_add_route","paradigm_portal_add_gate"].filter(r=>t.toolsCalled.includes(r));return i.length>0?{habit:e,result:"followed",reason:`Gate tools called: ${i.join(", ")}`,evidence:i}:{habit:e,result:"skipped",reason:"Routes added without gate declarations"}}function ye(e,t){if(t.filesModified.length===0)return {habit:e,result:"followed",reason:"No files modified"};let o=t.filesModified.filter(r=>r.includes(".test.")||r.includes(".spec.")||r.includes("/tests/")||r.includes("/test/")||r.includes("__tests__"));if(o.length>0)return {habit:e,result:"followed",reason:`Test files: ${o.length}`,evidence:o.slice(0,5)};let i=t.filesModified.filter(r=>!r.endsWith(".md")&&!r.endsWith(".json")&&!r.endsWith(".yaml")&&!r.endsWith(".lock")&&!r.endsWith(".purpose")&&!r.includes(".paradigm/")&&!r.includes("node_modules/"));return i.length===0?{habit:e,result:"followed",reason:"No source files to test"}:{habit:e,result:"partial",reason:`${i.length} source file(s), no test files updated`,evidence:i.slice(0,5)}}function be(e,t){if(t.filesModified.length===0)return {habit:e,result:"followed",reason:"No files modified"};let o=e.check.params.patterns||[];if(o.length===0)return {habit:e,result:"followed",reason:"No patterns specified"};if(e.trigger==="on-stop"&&e.severity==="block"){let r=t.filesModified.filter(n=>o.some(u=>n.includes(u)||l.basename(n)===u));return r.length>0?{habit:e,result:"followed",reason:`Matching files: ${r.join(", ")}`,evidence:r}:{habit:e,result:"partial",reason:`None of [${o.join(", ")}] in git diff yet (may not be committed). Use on-commit trigger for reliable check.`}}let i=t.filesModified.filter(r=>o.some(n=>r.includes(n)||l.basename(r)===n));return i.length>0?{habit:e,result:"followed",reason:`Matching files: ${i.join(", ")}`,evidence:i}:{habit:e,result:"skipped",reason:`None of [${o.join(", ")}] found in modified files`}}function ve(e,t){return t.filesModified.length===0?{habit:e,result:"followed",reason:"No files modified"}:e.trigger==="on-stop"?{habit:e,result:"followed",reason:"git-clean skipped on-stop (uncommitted changes expected before commit)"}:t.gitClean===void 0?{habit:e,result:"partial",reason:"Git status not available"}:t.gitClean?{habit:e,result:"followed",reason:"Working tree is clean \u2014 changes committed"}:{habit:e,result:"skipped",reason:"Uncommitted changes in working tree"}}function Ce(e,t){if(!t.commitMessage)return {habit:e,result:"followed",reason:"No commit message to check (not a commit trigger)"};let o=e.check.params.messagePatterns||["^(feat|fix|refactor|chore|docs|test|style|perf|ci|build)\\(","Symbols:"],i=o.filter(r=>new RegExp(r,"m").test(t.commitMessage));if(i.length===o.length)return {habit:e,result:"followed",reason:"Commit message matches all required patterns",evidence:i};if(i.length>0){let r=o.filter(n=>!new RegExp(n,"m").test(t.commitMessage));return {habit:e,result:"partial",reason:`Matches ${i.length}/${o.length} patterns. Missing: ${r.join(", ")}`}}return {habit:e,result:"skipped",reason:"Commit message does not match required format patterns"}}function He(e,t){let o=t.symbolsTouched.filter(n=>n.startsWith("#"));if(o.length<3)return {habit:e,result:"followed",reason:"Fewer than 3 components touched \u2014 flow not required"};if(t.hasFlowCoverage)return {habit:e,result:"followed",reason:"Flow coverage exists for multi-component changes"};let r=["paradigm_flow_check","paradigm_flows_affected","paradigm_purpose_add_flow"].filter(n=>t.toolsCalled.includes(n));return r.length>0?{habit:e,result:"followed",reason:`Flow tools called: ${r.join(", ")}`,evidence:r}:{habit:e,result:"skipped",reason:`${o.length} components touched without flow coverage`,evidence:o.slice(0,5)}}function ke(e,t){let i=(e.check.params.contextTools||["paradigm_session_health","paradigm_session_recover","paradigm_session_checkpoint"]).filter(r=>t.toolsCalled.includes(r));return i.length>0?{habit:e,result:"followed",reason:`Context tools called: ${i.join(", ")}`,evidence:i}:t.filesModified.length===0&&t.symbolsTouched.length===0?{habit:e,result:"followed",reason:"No modifications, context check not applicable"}:{habit:e,result:"skipped",reason:"No context/session tools called during session"}}function we(e,t){let o=t.symbolsTouched.filter(i=>i.startsWith("~"));return o.length===0?{habit:e,result:"followed",reason:"No aspects touched"}:t.aspectAnchorsValid===true?{habit:e,result:"followed",reason:"Aspect anchors validated and valid"}:t.toolsCalled.includes("paradigm_aspect_check")?{habit:e,result:"followed",reason:"paradigm_aspect_check was called to validate anchors"}:{habit:e,result:"skipped",reason:`${o.length} aspect(s) touched without anchor validation`,evidence:o.slice(0,5)}}export{z as a,X as b,Z as c,F as d,$ as e};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b}from'./chunk-
|
|
2
|
+
import {b}from'./chunk-LBQBWIEX.js';import {a}from'./chunk-LKAT7IAK.js';import*as r from'fs';import*as i from'path';import e from'chalk';import W from'ora';import*as u from'js-yaml';async function v(l={}){let c=process.cwd(),o=i.join(c,".paradigm-workspace");console.log(e.blue(`
|
|
3
3
|
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(e.blue("\u2502")+e.white.bold(" paradigm workspace init ")+e.blue("\u2502")),console.log(e.blue("\u2502")+e.gray(" Create a multi-project workspace ")+e.blue("\u2502")),console.log(e.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
4
4
|
`));let n=a.command("workspace-init").start("Creating workspace",{cwd:c});if(r.existsSync(o)&&!l.force){console.log(e.yellow(` .paradigm-workspace already exists. Use --force to overwrite.
|
|
5
5
|
`)),n.success("Workspace already exists");return}let s=c,t=r.readdirSync(s,{withFileTypes:true}),a$1=[];for(let p of t){if(!p.isDirectory()||p.name.startsWith(".")||p.name==="node_modules")continue;let g=i.join(s,p.name),k=r.existsSync(i.join(g,".paradigm")),y=r.existsSync(i.join(g,".purpose"));if(k||y){let w=j(p.name,g);a$1.push({name:p.name,path:`./${p.name}`,...w&&{role:w}});}}if(a$1.length===0){console.log(e.yellow(" No sibling projects with .paradigm/ or .purpose found.")),console.log(e.gray(` Create .purpose files in sibling directories first.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import*as r from'fs';import*as o from'path';var y=".paradigm/events/session-log.jsonl",d=".paradigm/events/session-metrics.jsonl",h=200,p=".paradigm/events/notebook-refs.jsonl";function x(i,e){try{let t=o.join(i,y),n=o.dirname(t);if(r.existsSync(n)||r.mkdirSync(n,{recursive:!0}),r.existsSync(t)&&r.readFileSync(t,"utf8").trim().split(`
|
|
3
3
|
`).filter(l=>l.trim()).length>=h)return;let a=JSON.stringify(e)+`
|
|
4
|
-
`;r.appendFileSync(t,a,"utf8"),e.type==="user-verdict"&&e.agent&&e.symbols?.length&&import('./agent-loader-
|
|
4
|
+
`;r.appendFileSync(t,a,"utf8"),e.type==="user-verdict"&&e.agent&&e.symbols?.length&&import('./agent-loader-RIVI6QPP.js').then(({loadAgentProfile:c,saveAgentProfile:s})=>{try{let l=c(i,e.agent);if(l?.expertise){let u=e.verdict==="accepted"?.03:e.verdict==="dismissed"?-.02:e.verdict==="revised"?-.01:0;if(u!==0){for(let m of e.symbols){let f=l.expertise.find(S=>S.symbol===m);f&&(f.confidence=Math.max(0,Math.min(1,f.confidence+u)),f.sessions=(f.sessions||0)+1,f.lastTouch=new Date().toISOString());}s(e.agent,l,"global");}}}catch{}}).catch(()=>{});}catch{}}function g(i){try{let e=o.join(i,y);return r.existsSync(e)?r.readFileSync(e,"utf8").trim().split(`
|
|
5
5
|
`).filter(t=>t.trim()).map(t=>{try{return JSON.parse(t)}catch{return null}}).filter(t=>t!==null):[]}catch{return []}}function E(i){try{let e=o.join(i,y);r.existsSync(e)&&r.writeFileSync(e,"","utf8");}catch{}}function C(i){let e=g(i),t=new Set;for(let n of e)n.agent&&t.add(n.agent);return Array.from(t)}function v(i,e){return g(i).filter(t=>t.agent===e)}function M(i,e){let t=v(i,e),n=t.filter(s=>s.type==="agent-contribution"),a=t.filter(s=>s.type==="user-verdict"),c=[];for(let s of n)c.push({contribution:s});for(let s of a){let l=c.find(u=>!u.verdict&&u.contribution);l?l.verdict=s:c.push({verdict:s});}return c}function A(i,e){try{let t=o.join(i,d),n=o.dirname(t);r.existsSync(n)||r.mkdirSync(n,{recursive:!0});let a={timestamp:new Date().toISOString(),type:"activity",...e},c=JSON.stringify(a)+`
|
|
6
6
|
`;r.appendFileSync(t,c,"utf8");}catch{}}function b(i){try{let e=o.join(i,d);return r.existsSync(e)?r.readFileSync(e,"utf8").trim().split(`
|
|
7
7
|
`).filter(t=>t.trim()).map(t=>{try{return JSON.parse(t)}catch{return null}}).filter(t=>t!==null&&t.type==="activity"):[]}catch{return []}}function I(i){let e=b(i),t={toolCallCount:0,responsePayloadBytes:0,sessionDurationMs:0,agentBreakdown:{}};for(let n of e)if(n.toolCallCount!=null&&(t.toolCallCount+=n.toolCallCount),n.responsePayloadBytes!=null&&(t.responsePayloadBytes+=n.responsePayloadBytes),n.sessionDurationMs!=null&&(t.sessionDurationMs=Math.max(t.sessionDurationMs,n.sessionDurationMs)),n.agentId){t.agentBreakdown[n.agentId]||(t.agentBreakdown[n.agentId]={toolCalls:0,payloadBytes:0});let a=t.agentBreakdown[n.agentId];n.toolCallCount!=null&&(a.toolCalls+=n.toolCallCount),n.responsePayloadBytes!=null&&(a.payloadBytes+=n.responsePayloadBytes);}return t}function N(i){try{let e=o.join(i,d);r.existsSync(e)&&r.writeFileSync(e,"","utf8");}catch{}}function B(i,e,t,n){try{if(t.length===0)return;let a=o.join(i,p),c=o.dirname(a);r.existsSync(c)||r.mkdirSync(c,{recursive:!0});let s={timestamp:new Date().toISOString(),type:"notebook-reference",agentId:e,notebookEntryIds:t,...n?{orchestrationId:n}:{}},l=JSON.stringify(s)+`
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {b as b$1,a as a$1}from'./chunk-EK4ZRIFJ.js';import {n,m}from'./chunk-4SCKMGTB.js';import {d}from'./chunk-5TAVYPOV.js';import*as r from'fs';import*as a from'path';import*as x from'os';import*as T from'crypto';import*as h from'js-yaml';function w(){let n=a.join(x.homedir(),".paradigm");return r.existsSync(n)||r.mkdirSync(n,{recursive:true}),n}function M(n){let s=a.resolve(n);return T.createHash("sha256").update(s).digest("hex").slice(0,12)}function f(n){let s=M(n),e=a.join(w(),"sessions",s);r.existsSync(e)||r.mkdirSync(e,{recursive:true});let t=a.join(e,"pending-handoffs");return r.existsSync(t)||r.mkdirSync(t,{recursive:true}),e}function S(n){let s=f(n),e=a.join(s,"_project-meta.json"),o={name:a.basename(a.resolve(n)),path:a.resolve(n),lastSeen:new Date().toISOString()};r.writeFileSync(e,JSON.stringify(o,null,2));}function O(n,s){let e=f(n),t=a.join(e,"pending-handoffs",`${s.id}.json`);r.writeFileSync(t,JSON.stringify(s,null,2));}function A(n){let s=f(n),e=a.join(s,"pending-handoffs");if(!r.existsSync(e))return [];let t=[];try{let o=r.readdirSync(e);for(let l of o)if(l.endsWith(".json"))try{let u=r.readFileSync(a.join(e,l),"utf8"),m=JSON.parse(u);m.status==="pending"&&t.push(m);}catch{}}catch{}return t.sort((o,l)=>new Date(o.timestamp).getTime()-new Date(l.timestamp).getTime()),t}function W(n,s){let e=f(n),t=a.join(e,"pending-handoffs",`${s}.json`);if(r.existsSync(t))try{let o=r.readFileSync(t,"utf8"),l=JSON.parse(o);l.status="delivered",r.writeFileSync(t,JSON.stringify(l,null,2));}catch{}}function y(){let n=a.join(w(),"wisdom");return r.existsSync(n)||r.mkdirSync(n,{recursive:true}),n}function H(){let n=a.join(y(),"antipatterns.yaml");if(!r.existsSync(n))return [];try{let s=r.readFileSync(n,"utf8");return h.load(s)?.antipatterns||[]}catch{return []}}function L(){let n=a.join(y(),"decisions");if(!r.existsSync(n))return [];let s=[];try{let e=r.readdirSync(n);for(let t of e)if(!(!t.endsWith(".yaml")&&!t.endsWith(".yml")))try{let o=r.readFileSync(a.join(n,t),"utf8"),l=h.load(o);s.push(l);}catch{}}catch{}return s.sort((e,t)=>e.id.localeCompare(t.id)),s}function _(){let n=a.join(y(),"preferences.yaml");if(!r.existsSync(n))return null;try{let s=r.readFileSync(n,"utf8");return h.load(s)}catch{return null}}function J(n){let s=a.join(y(),"antipatterns.yaml"),e={version:"1.0",antipatterns:[]};if(r.existsSync(s))try{let t=r.readFileSync(s,"utf8");e=h.load(t),e.antipatterns||(e.antipatterns=[]);}catch{}e.antipatterns.push({...n,added:new Date().toISOString()}),r.writeFileSync(s,h.dump(e,{lineWidth:-1}));}function U(n){let s=a.join(y(),"decisions");r.existsSync(s)||r.mkdirSync(s,{recursive:true});let e=n.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),t=`${n.id}-${e}.yaml`,o=a.join(s,t);r.writeFileSync(o,h.dump(n,{lineWidth:-1}));}b$1();var k={"claude-opus-4":{input:15,output:75,name:"Claude Opus 4"},"claude-sonnet-4":{input:3,output:15,name:"Claude Sonnet 4"},"claude-haiku-3.5":{input:.8,output:4,name:"Claude Haiku 3.5"}},j=50,P=".paradigm/session-breadcrumbs.json",I=".paradigm/session-checkpoint.json",E=10080*60*1e3,C=class{session;rootDir=null;_recovered=false;lastLoreEntryId=null;constructor(){this.session=this.createNewSession();}setRootDir(s){this.rootDir=s;try{let{clearSessionWorkLog:e}=(n(),d(m));e(s);}catch{}}createNewSession(){return {sessionId:`s${Date.now().toString(36)}`,startTime:Date.now(),lastActivity:Date.now(),model:"claude-sonnet-4",resourceReads:[],toolCalls:[],breadcrumbs:[],totals:{resourceReadCount:0,toolCallCount:0,totalBytes:0,totalTokens:0,estimatedCostUsd:0}}}addBreadcrumb(s,e,t={}){this.session.breadcrumbs.push({timestamp:Date.now(),action:s,tool:t.tool,symbol:t.symbol,summary:e}),this.session.breadcrumbs.length>j&&(this.session.breadcrumbs=this.session.breadcrumbs.slice(-j)),this.persistBreadcrumbs();}getBreadcrumbs(s=20){return this.session.breadcrumbs.slice(-s)}persistBreadcrumbs(){if(!this.rootDir)return;let s={sessionId:this.session.sessionId,startTime:this.session.startTime,lastActivity:this.session.lastActivity,breadcrumbs:this.session.breadcrumbs,symbolsModified:this.extractSymbolsFromBreadcrumbs(),filesExplored:this.extractFilesFromBreadcrumbs()},e;try{e=JSON.stringify(s,null,2);}catch(t){a$1.component("#session-tracker").error("persistBreadcrumbs: JSON.stringify failed",{error:t.message});return}try{let t=a.join(this.rootDir,P),o=a.dirname(t);r.existsSync(o)||r.mkdirSync(o,{recursive:!0}),r.writeFileSync(t,e);}catch(t){a$1.component("#session-tracker").error("persistBreadcrumbs: local write failed",{error:t.message});}try{let t=f(this.rootDir);r.writeFileSync(a.join(t,"breadcrumbs.json"),e),S(this.rootDir);}catch(t){a$1.component("#session-tracker").error("persistBreadcrumbs: global write failed",{error:t.message});}}loadPreviousSession(){if(!this.rootDir)return null;try{let s=f(this.rootDir),e=a.join(s,"breadcrumbs.json");if(r.existsSync(e)){let t=r.readFileSync(e,"utf8");return JSON.parse(t)}}catch{}try{let s=a.join(this.rootDir,P);if(!r.existsSync(s))return null;let e=r.readFileSync(s,"utf8");return JSON.parse(e)}catch{return null}}saveCheckpoint(s){let e={phase:s.phase,context:s.context,timestamp:Date.now(),sessionId:this.session.sessionId,externalId:s.externalId,plan:s.plan,modifiedFiles:s.modifiedFiles,symbolsTouched:s.symbolsTouched,decisions:s.decisions,recentBreadcrumbs:this.session.breadcrumbs.slice(-10)},t=this.persistCheckpoint(e);return {checkpoint:e,persisted:t}}loadCheckpoint(){if(!this.rootDir)return null;let s=null;try{let e=f(this.rootDir),t=a.join(e,"checkpoint.json");if(r.existsSync(t)){let o=r.readFileSync(t,"utf8");s=JSON.parse(o);}}catch{}if(!s)try{let e=a.join(this.rootDir,I);if(r.existsSync(e)){let t=r.readFileSync(e,"utf8");s=JSON.parse(t);}}catch{}if(s&&Date.now()-s.timestamp>E)return null;if(s)for(let e of ["modifiedFiles","symbolsTouched","decisions"]){let t=s[e];if(typeof t=="string")try{s[e]=JSON.parse(t);}catch{s[e]=[];}}return s}persistCheckpoint(s){let e={local:false,global:false};if(!this.rootDir)return a$1.component("#session-tracker").warn("persistCheckpoint: rootDir not set, skipping write"),e;let t;try{t=JSON.stringify(s,null,2);}catch(o){return a$1.component("#session-tracker").error("persistCheckpoint: JSON.stringify failed",{error:o.message}),e}try{let o=a.join(this.rootDir,I),l=a.dirname(o);r.existsSync(l)||r.mkdirSync(l,{recursive:!0}),r.writeFileSync(o,t),e.local=!0;}catch(o){a$1.component("#session-tracker").error("persistCheckpoint: local write failed",{error:o.message});}try{let o=f(this.rootDir);r.writeFileSync(a.join(o,"checkpoint.json"),t),S(this.rootDir),e.global=!0;}catch(o){a$1.component("#session-tracker").error("persistCheckpoint: global write failed",{error:o.message});}return e}setLastLoreEntryId(s){this.lastLoreEntryId=s;}getLastLoreEntryId(){return this.lastLoreEntryId}hasRecoveredThisSession(){return this._recovered}markRecovered(){this._recovered=true;}extractSymbolsFromBreadcrumbs(){let s=new Set;for(let e of this.session.breadcrumbs)e.symbol&&s.add(e.symbol);return Array.from(s)}extractFilesFromBreadcrumbs(){let s=new Set;for(let e of this.session.breadcrumbs){let t=e.summary.match(/\b[\w./]+\.(ts|js|tsx|jsx|py|go|rs|yaml|json|md)\b/g);if(t)for(let o of t)s.add(o);}return Array.from(s)}estimateTokens(s){let e=typeof s=="number"?s:s.length;return Math.ceil(e/3.5)}calculateCost(s,e=true){let t=k[this.session.model],o=e?t.output:t.input;return s/1e6*o}setModel(s){this.session.model=s,this.recalculateTotals();}getModel(){return this.session.model}trackResourceRead(s,e){let t=this.extractResourceType(s),o=this.estimateTokens(e);this.session.resourceReads.push({timestamp:Date.now(),resourceType:t,uri:s,bytes:e,tokens:o}),this.session.lastActivity=Date.now(),this.updateTotals(e,o);}trackToolCall(s,e){let t=this.estimateTokens(e);this.session.toolCalls.push({timestamp:Date.now(),toolName:s,responseBytes:e,responseTokens:t}),this.session.lastActivity=Date.now(),this.updateTotals(e,t);}updateTotals(s,e){this.session.totals.resourceReadCount=this.session.resourceReads.length,this.session.totals.toolCallCount=this.session.toolCalls.length,this.session.totals.totalBytes+=s,this.session.totals.totalTokens+=e,this.session.totals.estimatedCostUsd=this.calculateCost(this.session.totals.totalTokens);}recalculateTotals(){this.session.totals.estimatedCostUsd=this.calculateCost(this.session.totals.totalTokens);}extractResourceType(s){return s.replace("paradigm://","").split("/")[0]||"unknown"}getStats(){return {...this.session}}getCostBreakdown(){let s={},e=0,t=0;for(let i of this.session.resourceReads)s[i.resourceType]||(s[i.resourceType]={count:0,bytes:0,tokens:0}),s[i.resourceType].count++,s[i.resourceType].bytes+=i.bytes,s[i.resourceType].tokens+=i.tokens,e+=i.bytes,t+=i.tokens;let o={},l=0,u=0;for(let i of this.session.toolCalls)o[i.toolName]||(o[i.toolName]={count:0,bytes:0,tokens:0}),o[i.toolName].count++,o[i.toolName].bytes+=i.responseBytes,o[i.toolName].tokens+=i.responseTokens,l+=i.responseBytes,u+=i.responseTokens;let m=t+u,g=this.calculateCost(m);return {model:k[this.session.model].name,modelId:this.session.model,pricing:k[this.session.model],resources:{count:this.session.resourceReads.length,bytes:e,tokens:t,costUsd:this.calculateCost(t),byType:s},tools:{count:this.session.toolCalls.length,bytes:l,tokens:u,costUsd:this.calculateCost(u),byName:o},total:{tokens:m,costUsd:g}}}getHandoffRecommendation(s=2e5,e){let t=this.session.totals.totalTokens,o=t*4,l=e||t+o,u=Math.round(l/s*100),m,g;u>=85?(m="handoff-urgent",g="Context is nearly full. Initiate handoff immediately to preserve session continuity."):u>=70?(m="handoff-recommended",g="Context usage is high. Consider initiating handoff soon to ensure smooth transition."):u>=50?(m="consider-handoff",g="Context usage is moderate. Plan a good stopping point for potential handoff."):(m="continue",g="Context usage is healthy. Continue working.");let i=[],v=Math.round((Date.now()-this.session.startTime)/6e4),D=this.session.toolCalls.length+this.session.resourceReads.length;return D>50&&i.push(`High number of MCP interactions (${D})`),v>30&&i.push(`Session duration >30 min (${v} min)`),this.session.totals.totalBytes>5e5&&i.push(`Large data volume (${Math.round(this.session.totals.totalBytes/1024)}KB)`),{recommendation:m,message:g,usagePercent:u,signals:i}}getDurationMinutes(){return Math.round((Date.now()-this.session.startTime)/6e4)}reset(){this.session=this.createNewSession(),this._recovered=false,this.lastLoreEntryId=null;}},b=null;function X(){return b||(b=new C),b}function q(){b&&b.reset();}
|
|
3
|
+
export{O as a,A as b,W as c,H as d,L as e,_ as f,J as g,U as h,k as i,X as j,q as k};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {a,e,b,d}from'./chunk-WR6D3SC6.js';import _ from'chalk';import*as g from'fs';import*as $ from'path';async function q(c,l){let o=c||process.cwd(),e$1=parseInt(l.port||"3841",10),h=l.open!==false;a(_.cyan(`
|
|
3
3
|
Starting Symbol Graph...
|
|
4
|
-
`));try{let{startGraphServer:a$1}=await import('./graph-server-
|
|
4
|
+
`));try{let{startGraphServer:a$1}=await import('./graph-server-COZR5C3Z.js');e(`Project: ${o}`),e(`Port: ${e$1}`),a(""),await a$1({port:e$1,projectDir:o,open:h}),b(`Symbol Graph is running at http://localhost:${e$1}`),e(`
|
|
5
5
|
Press Ctrl+C to stop
|
|
6
6
|
`),await new Promise(()=>{});}catch(a){a.code==="EADDRINUSE"?(d(`Port ${e$1} is already in use.`),e(`Try: paradigm graph --port ${e$1+1}
|
|
7
7
|
`)):d(`Failed to start Symbol Graph: ${a}`),process.exit(1);}}var F=".paradigm/graphs",N={component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"},P=200,j=60,x=20,I=40,R=50,B=60,L={components:"component",flows:"flow",gates:"gate",signals:"signal",aspects:"aspect"};function T(c){let l=$.join(c,".paradigm","scan-index.json");if(!g.existsSync(l))return [];let o=JSON.parse(g.readFileSync(l,"utf8")),e=[];for(let[h,a]of Object.entries(L)){let m=o[h];if(!(!m||typeof m!="object"))for(let[p,f]of Object.entries(m)){let d=f;e.push({id:p,name:p,category:a,prefix:N[a]||"#",description:d.description,path:d.path});}}return e}function A(c,l){let o=c.replace(/^[#$^!~]/,"");return l.find(e=>e.id===o||e.name===o||e.id===c||e.name===c)}function H(c,l,o,e,h="Generated Graph"){let a=T(c),m=l&&l.length>0?l.map(t=>A(t,a)).filter(Boolean):a,p=[],f=[],d=new Map,b=new Set,G=0;if(o&&o.length>0)for(let t of o){let i=`group-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;d.set(t.label,i);let n=t.symbols.map(y=>A(y,m)).filter(Boolean),r=Math.max(Math.ceil(Math.sqrt(n.length)),1),M=Math.max(Math.ceil(n.length/r),1);for(let y=0;y<n.length;y++){let w=n[y],v=y%r,C=Math.floor(y/r);p.push({id:`sym-${w.id}`,type:"symbolNode",position:{x:I+v*(P+x),y:R+I+C*(j+x)},parentId:i,data:{type:"symbol",symbol:w,label:`${N[w.category]||"#"}${w.name}`}}),b.add(w.id);}let D=I*2+r*P+(r-1)*x,k=R+I*2+M*j+(M-1)*x;p.unshift({id:i,type:"groupNode",position:{x:G,y:0},style:{width:D,height:k},data:{type:"group",label:t.label}}),G+=D+B;}let s=m.filter(t=>!b.has(t.id));if(s.length>0){let t=o&&o.length>0?400:0,i=Math.max(Math.ceil(Math.sqrt(s.length)),1);for(let n=0;n<s.length;n++){let r=s[n],M=n%i,D=Math.floor(n/i);p.push({id:`sym-${r.id}`,type:"symbolNode",position:{x:M*(P+x),y:t+D*(j+x)},data:{type:"symbol",symbol:r,label:`${N[r.category]||"#"}${r.name}`}});}}if(e&&e.length>0)for(let t of e){let i=d.get(t.source),n=d.get(t.target);i&&n&&f.push({id:`e-${i}-${n}`,source:i,target:n,type:"default",label:t.label,data:{label:t.label}});}return {version:"1.0",name:h,projectId:$.basename(c),lastModified:new Date().toISOString(),nodes:p,edges:f}}async function K(c,l,o){let e$1=l||process.cwd(),h=c.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");try{let a=o.symbols?o.symbols.split(",").map(s=>s.trim()):void 0,m=o.group?.map(s=>{let t=s.indexOf(":");return t===-1&&(d(`Invalid group format: "${s}". Expected "Label:#sym1,#sym2"`),process.exit(1)),{label:s.slice(0,t),symbols:s.slice(t+1).split(",").map(i=>i.trim())}}),p=o.link?.map(s=>{let t=s.indexOf(">");t===-1&&(d(`Invalid link format: "${s}". Expected "Source>Target:label"`),process.exit(1));let i=s.slice(0,t),n=s.slice(t+1),r=n.indexOf(":");return {source:i,target:r===-1?n:n.slice(0,r),label:r===-1?void 0:n.slice(r+1)}}),f=H(e$1,a,m,p,c),d$1=JSON.stringify(f,null,2),b$1=$.join(e$1,F);g.existsSync(b$1)||g.mkdirSync(b$1,{recursive:!0});let G=$.join(b$1,`${h}.graph.json`);g.writeFileSync(G,d$1,"utf8"),b(`Graph saved to ${G}`),e(`${f.nodes.length} nodes, ${f.edges.length} edges, ${(d$1.length/1024).toFixed(1)} KB`),e(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import {c as c$1,b}from'./chunk-5TAVYPOV.js';import*as c from'fs';import*as l from'path';import*as w from'os';import*as u from'js-yaml';var x={};c$1(x,{addNotebookEntry:()=>N,incrementApplied:()=>P,loadNotebookEntries:()=>E,promoteFromLore:()=>L,searchNotebooks:()=>j});function E(s,a,e){let r=new Map,i=l.join(d,s);h(i,r);let t=l.join(a,m,s);h(t,r);let n=Array.from(r.values());if(e?.concepts&&e.concepts.length>0){let p=new Set(e.concepts.map(o=>o.toLowerCase()));n=n.filter(o=>o.concepts.some(f=>p.has(f.toLowerCase())));}if(e?.tags&&e.tags.length>0){let p=new Set(e.tags.map(o=>o.toLowerCase()));n=n.filter(o=>o.tags.some(f=>p.has(f.toLowerCase())));}return n.sort((p,o)=>o.appliedCount-p.appliedCount)}function h(s,a){if(c.existsSync(s))try{let e=c.readdirSync(s).filter(r=>r.startsWith(O)&&r.endsWith(g));for(let r of e)try{let i=c.readFileSync(l.join(s,r),"utf-8"),t=u.load(i);t?.id&&a.set(t.id,t);}catch{}}catch{}}function j(s,a,e){let r=E(s,e),i=a.toLowerCase();return r.filter(t=>t.context.toLowerCase().includes(i)||t.snippet.toLowerCase().includes(i)||t.concepts.some(n=>n.toLowerCase().includes(i))||t.tags.some(n=>n.toLowerCase().includes(i)))}function N(s,a,e,r){let i=new Date().toISOString(),t=(a.concepts[0]||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),n=Date.now().toString(36),p=`nb-${t}-${n}`,o={...a,id:p,appliedCount:0,created:i,updated:i},f=e==="global"?l.join(d,s):l.join(r||process.cwd(),m,s);c.existsSync(f)||c.mkdirSync(f,{recursive:true});let y=`${p}${g}`,b=l.join(f,y),S=u.dump(o,{lineWidth:120,noRefs:true,sortKeys:false});return c.writeFileSync(b,S,"utf-8"),{entry:o,filePath:b}}async function L(s,a,e,r="global"){let{loadLoreEntry:i}=await import('./lore-loader-RVQI5GXL.js'),t=await i(e,a);if(!t)return null;let n=[];if(t.symbols_touched)for(let f of t.symbols_touched){let y=f.replace(/^[#$^!~]/,"").toLowerCase();n.push(y);}let p=t.summary||"";t.body&&(p+=`
|
|
3
3
|
|
|
4
4
|
`+t.body);let o={source:"lore",loreEntryId:a,originProject:l.basename(e),createdBy:s};return N(s,{context:t.title||`Promoted from ${a}`,snippet:p,provenance:o,confidence:t.confidence??.7,concepts:n,tags:t.tags||[]},r,e)}function P(s,a,e){let r=l.join(e,m,s),i=l.join(d,s);for(let t of [r,i]){let n=l.join(t,`${a}${g}`);if(c.existsSync(n))try{let p=c.readFileSync(n,"utf-8"),o=u.load(p);if(o)return o.appliedCount=(o.appliedCount||0)+1,o.updated=new Date().toISOString(),c.writeFileSync(n,u.dump(o,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),!0}catch{}}return false}var d,m,O,g,$=b(()=>{d=l.join(w.homedir(),".paradigm","notebooks"),m=".paradigm/notebooks",O="nb-",g=".yaml";});export{E as a,j as b,N as c,L as d,P as e,x as f,$ as g};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a}from'./chunk-
|
|
2
|
+
import {a}from'./chunk-5TAVYPOV.js';import {execSync}from'child_process';import*as C from'os';import*as i from'fs';import*as d from'path';import*as f from'js-yaml';function R(s){let e=s.toLowerCase();return e.includes("claude")||e.includes("anthropic")?"anthropic":e.includes("gpt")||e.includes("openai")||e.includes("o1")||e.includes("o3")?"openai":e.includes("gemini")||e.includes("google")||e.includes("palm")?"google":e.includes("llama")||e.includes("meta")?"meta":e.includes("mistral")||e.includes("mixtral")?"mistral":e.includes("deepseek")?"deepseek":e.includes("cohere")||e.includes("command")?"cohere":"unknown"}function x(s){let e=s,t=e.author;if(e.type||(e.type="agent-session"),typeof t=="string")return s;if(t&&typeof t=="object"&&!Array.isArray(t)){let n=t;n.type==="agent"?(e.author="unknown",e.agent={provider:n.model?R(n.model):R(n.id),model:n.model||n.id}):e.author=n.id||"unknown",delete e.assistedBy;}return e}function w(s){return s.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,20)||"unknown"}function P(){let s=process.env.PARADIGM_AUTHOR;if(s)return w(s);try{let e=execSync("git config user.name",{encoding:"utf-8",timeout:3e3}).trim();if(e)return w(e)}catch{}try{let e=C.userInfo().username;if(e)return w(e)}catch{}return "unknown"}function T(s,e){let t=s;if(e.author&&(t=t.filter(n=>n.author===e.author)),e.hasAgent!==void 0?t=t.filter(n=>e.hasAgent?n.agent!=null:n.agent==null):e.authorType&&(t=t.filter(n=>e.authorType==="agent"?n.agent!=null:n.agent==null)),e.symbol&&(t=t.filter(n=>n.symbols_touched?.includes(e.symbol)||n.symbols_created?.includes(e.symbol))),e.dateFrom){let n=new Date(e.dateFrom).getTime();t=t.filter(o=>new Date(o.timestamp).getTime()>=n);}if(e.dateTo){let n=new Date(e.dateTo).getTime();t=t.filter(o=>new Date(o.timestamp).getTime()<=n);}if(e.type&&(t=t.filter(n=>n.type===e.type)),e.tag){let n=e.tag;t=t.filter(o=>o.tags?.some(r=>r===n||r.startsWith(n+":")||n.includes(":")&&r===n));}return e.tags&&e.tags.length>0&&(t=t.filter(n=>e.tags.some(o=>n.tags?.includes(o)))),e.hasBody!==void 0&&(t=t.filter(n=>e.hasBody?n.body!=null&&n.body.length>0:!n.body||n.body.length===0)),e.hasReview!==void 0&&(t=t.filter(n=>e.hasReview?n.review!=null:n.review==null)),e.hasConfidence!==void 0&&(t=t.filter(n=>e.hasConfidence?n.confidence!=null:n.confidence==null)),e.hasAssessment!==void 0&&(t=t.filter(n=>e.hasAssessment?n.assessment!=null:n.assessment==null)),e.minCompleteness!==void 0&&(t=t.filter(n=>n.review!=null&&n.review.completeness>=e.minCompleteness)),t.sort((n,o)=>new Date(o.timestamp).getTime()-new Date(n.timestamp).getTime()),e.offset&&(t=t.slice(e.offset)),e.limit&&(t=t.slice(0,e.limit)),t}var _=".paradigm/lore",b="entries",I="timeline.yaml";function v(s){return s.endsWith(".yaml")||s.endsWith(".lore")}function E(s,e,t){let n=d.join(s,_,b,e),o=d.join(n,`${t}.lore`);if(i.existsSync(o))return o;let r=d.join(n,`${t}.yaml`);return i.existsSync(r)?r:null}function W(s){try{let e=execSync("git rev-parse HEAD",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),t=execSync("git rev-parse --abbrev-ref HEAD",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),n=execSync("git status --porcelain",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();return {ref:e,branch:t,dirty:n.length>0}}catch{return}}function N(s,e){let t={unregistered:[],warnings:[]};if(e.length===0)return t;let n=new Set;try{let c=a("child_process").execSync(`find "${s}" -name ".purpose" -not -path "*/node_modules/*" -not -path "*/.git/*" 2>/dev/null || true`,{encoding:"utf-8"});for(let u of c.split(`
|
|
3
3
|
`).filter(Boolean))try{let m=i.readFileSync(u,"utf8").matchAll(/^([#$^!~][\w-]+):/gm);for(let l of m)n.add(l[1]);}catch{}}catch{return t}let o=d.join(s,".paradigm","flows.yaml");if(i.existsSync(o))try{let u=i.readFileSync(o,"utf8").matchAll(/([#$^!~][\w-]+)/g);for(let a of u)n.add(a[1]);}catch{}let r=d.join(s,"portal.yaml");if(i.existsSync(r))try{let u=i.readFileSync(r,"utf8").matchAll(/\^([\w-]+)/g);for(let a of u)n.add(`^${a[1]}`);}catch{}for(let c of e)n.has(c)||(t.unregistered.push(c),t.warnings.push(`Symbol "${c}" not found in .purpose files or project index`));return t}async function U(s,e,t){let n;if(t?.validateSymbols){let a=[...e.symbols_touched||[],...e.symbols_created||[]];n=N(s,a);}let o=d.join(s,_),r=e.timestamp.slice(0,10),c=d.join(o,b,r);i.existsSync(c)||i.mkdirSync(c,{recursive:true}),e.author||(e.author=P()),e.git_context||(e.git_context=W(s)),e.id||(e.id=O(s,r,e.author,e.timestamp));let u=d.join(c,`${e.id}.lore`);return i.writeFileSync(u,f.dump(e,{lineWidth:-1,noRefs:true})),await j(s),{validation:n}}async function A(s,e){let t=d.join(s,_,b);if(!i.existsSync(t))return [];M(s);let n=[],o=i.readdirSync(t).filter(r=>/^\d{4}-\d{2}-\d{2}$/.test(r)).sort().reverse();for(let r of o){if(e?.dateFrom&&r<e.dateFrom.slice(0,10)||e?.dateTo&&r>e.dateTo.slice(0,10))continue;let c=d.join(t,r),u=i.readdirSync(c).filter(v).sort();for(let a of u)try{let m=i.readFileSync(d.join(c,a),"utf8"),l=f.load(m);n.push(x(l));}catch{}}return e?T(n,e):n}async function j(s){let e=d.join(s,_),t=d.join(e,b);if(!i.existsSync(t))return;M(s);let n=new Set,o=0,r="",c=i.readdirSync(t).filter(l=>/^\d{4}-\d{2}-\d{2}$/.test(l));for(let l of c){let g=d.join(t,l),h=i.readdirSync(g).filter(v);for(let S of h)try{let y=i.readFileSync(d.join(g,S),"utf8"),L=f.load(y),p=x(L);n.add(p.author),o++,(!r||p.timestamp>r)&&(r=p.timestamp);}catch{}}let u="unknown",a=d.join(s,".paradigm","config.yaml");if(i.existsSync(a))try{let l=f.load(i.readFileSync(a,"utf8"));u=l.project||l.name||"unknown";}catch{}let m={version:"1.0",project:u,entries:o,last_updated:r||new Date().toISOString(),authors:Array.from(n)};i.existsSync(e)||i.mkdirSync(e,{recursive:true}),i.writeFileSync(d.join(e,I),f.dump(m,{lineWidth:-1,noRefs:true}));}async function D(s,e,t){let o=(await A(s)).find(u=>u.id===e);if(!o)return false;let r=o.timestamp.slice(0,10),c=E(s,r,e);return c?(o.review=t,i.writeFileSync(c,f.dump(o,{lineWidth:-1,noRefs:true})),true):false}function H(s){switch(s){case "correct":return 1;case "partial":return .5;case "incorrect":return 0}}async function G(s,e,t){let o=(await A(s)).find(u=>u.id===e);if(!o)return false;let r=o.timestamp.slice(0,10),c=E(s,r,e);return c?(o.assessment=t,o.confidence!=null&&(o.assessment_delta=H(t.verdict)-o.confidence),i.writeFileSync(c,f.dump(o,{lineWidth:-1,noRefs:true})),true):false}async function F(s,e){let t=e.match(/^L-(\d{4}-\d{2}-\d{2})-/);if(t){let o=t[1],r=E(s,o,e);if(r)try{let c=i.readFileSync(r,"utf8"),u=f.load(c);return x(u)}catch{return null}}return (await A(s)).find(o=>o.id===e)||null}async function q(s,e,t){let n=await F(s,e);if(!n)return false;let o=n.timestamp.slice(0,10),r=E(s,o,e);return r?(t.title!==void 0&&(n.title=t.title),t.summary!==void 0&&(n.summary=t.summary),t.type!==void 0&&(n.type=t.type),t.duration_minutes!==void 0&&(n.duration_minutes=t.duration_minutes),t.symbols_touched!==void 0&&(n.symbols_touched=t.symbols_touched),t.symbols_created!==void 0&&(n.symbols_created=t.symbols_created),t.files_created!==void 0&&(n.files_created=t.files_created),t.files_modified!==void 0&&(n.files_modified=t.files_modified),t.lines_added!==void 0&&(n.lines_added=t.lines_added),t.lines_removed!==void 0&&(n.lines_removed=t.lines_removed),t.commit!==void 0&&(n.commit=t.commit),t.decisions!==void 0&&(n.decisions=t.decisions),t.errors_encountered!==void 0&&(n.errors_encountered=t.errors_encountered),t.learnings!==void 0&&(n.learnings=t.learnings),t.verification!==void 0&&(n.verification=t.verification),t.tags!==void 0&&(n.tags=t.tags),t.body!==void 0&&(n.body=t.body),t.linked_lore!==void 0&&(n.linked_lore=t.linked_lore),t.linked_tasks!==void 0&&(n.linked_tasks=t.linked_tasks),t.linked_commits!==void 0&&(n.linked_commits=t.linked_commits),t.confidence!==void 0&&(n.confidence=t.confidence),t.assessment!==void 0&&(n.assessment=t.assessment),t.assessment_delta!==void 0&&(n.assessment_delta=t.assessment_delta),i.writeFileSync(r,f.dump(n,{lineWidth:-1,noRefs:true})),await j(s),true):false}async function K(s,e){let t=await F(s,e);if(!t)return false;let n=t.timestamp.slice(0,10),o=E(s,n,e);if(!o)return false;i.unlinkSync(o);let r=d.dirname(o);return i.readdirSync(r).filter(v).length===0&&i.rmdirSync(r),await j(s),true}function M(s){let e=d.join(s,_,b);if(!i.existsSync(e))return 0;let t=i.readdirSync(e).filter(o=>v(o)&&!o.startsWith(".")),n=0;for(let o of t){let r=d.join(e,o);if(i.statSync(r).isFile())try{let u=i.readFileSync(r,"utf8"),a=f.load(u);if(a.author&&typeof a.author=="object"||typeof a.author=="string"&&a.timestamp)continue;let m=typeof a.date=="string"?a.date.slice(0,10):new Date().toISOString().slice(0,10),l=d.join(e,m);i.existsSync(l)||i.mkdirSync(l,{recursive:!0});let g=P(),h=`${m}T00:00:00.000Z`,S=O(s,m,g,h),y=String(a.type||"agent-session"),L=["agent-session","human-note","decision","review","incident","milestone"].includes(y)?y:"agent-session",p;if(a.test_results&&typeof a.test_results=="object"){let k=a.test_results;p={status:k.total===k.passed?"pass":"partial",details:{tests:k.total===k.passed?"pass":"fail"}};}let z={id:S,type:L,timestamp:h,author:"unknown",agent:{provider:"unknown",model:"unknown"},title:String(a.title||o.replace(/\.(yaml|lore)$/,"")),summary:String(a.summary||""),symbols_touched:Array.isArray(a.symbols_touched)?a.symbols_touched:[],files_modified:Array.isArray(a.files_modified)?a.files_modified:void 0,...p?{verification:p}:{},tags:["migrated",y]};i.writeFileSync(d.join(l,`${S}.lore`),f.dump(z,{lineWidth:-1,noRefs:!0})),i.unlinkSync(r),n++;}catch{}}return n}function O(s,e,t,n){let o=w(t),r=new Date(n),c=String(r.getUTCHours()).padStart(2,"0"),u=String(r.getUTCMinutes()).padStart(2,"0"),a=String(r.getUTCSeconds()).padStart(2,"0"),m=`${c}${u}${a}`,l=`L-${e}-${o}-${m}`,g=d.join(s,_,b,e);if(!i.existsSync(g))return `${l}-001`;let h=i.readdirSync(g).filter(y=>y.startsWith(l)&&v(y)).map(y=>{let L=y.match(/-(\d{3})\.(yaml|lore)$/);return L?parseInt(L[1],10):0}),S=h.length>0?Math.max(...h)+1:1;return `${l}-${String(S).padStart(3,"0")}`}export{x as a,P as b,U as c,A as d,D as e,G as f,F as g,q as h,K as i};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a}from'./chunk-DSYEGRQ2.js';import*as l from'fs';import*as g from'path';import*as k from'os';import*as L from'crypto';import*as h from'js-yaml';var j={architect:{style:"deliberate",risk:"conservative",verbosity:"detailed"},builder:{style:"rapid",risk:"balanced",verbosity:"concise"},tester:{style:"methodical",risk:"conservative",verbosity:"concise"},reviewer:{style:"deliberate",risk:"conservative",verbosity:"detailed"},security:{style:"methodical",risk:"conservative",verbosity:"detailed"},documentor:{style:"methodical",risk:"conservative",verbosity:"concise"}},T={architect:{symbols:["$*","#*"],concepts:["architecture","design","pattern","refactor"],signals:[{type:"flow-modified"},{type:"compliance-violation"}],threshold:.5},builder:{paths:["src/**","lib/**","packages/**"],signals:[{type:"file-modified"},{type:"error-encountered"}],threshold:.7},reviewer:{concepts:["code quality","bug","smell","convention"],signals:[{type:"compliance-violation"}],threshold:.6},tester:{paths:["**/*.test.*","**/*.spec.*"],concepts:["test","coverage","assertion"],signals:[{type:"error-encountered"},{type:"test-result"}],threshold:.5},security:{symbols:["^*","#*-auth","#*-middleware"],paths:["auth/**","middleware/**","guards/**"],concepts:["permission","JWT","session","RBAC","XSS","injection"],signals:[{type:"gate-added"},{type:"route-created"},{type:"gate-checked"},{type:"compliance-violation"}],threshold:.4},documentor:{paths:["**/.purpose","**/portal.yaml",".paradigm/**"],concepts:["purpose","portal","symbol","documentation","component","gate","flow"],signals:[{type:"file-modified"},{type:"compliance-violation"},{type:"work-completed"}],threshold:.3}},$={architect:{stance:"lead",debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},builder:{stance:"supportive",with:{architect:{stance:"supportive",can_contradict:false}}},reviewer:{stance:"advisory",debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},tester:{stance:"supportive",debate:{will_challenge:false,evidence_required:true,escalate_to_human:false}},security:{stance:"advisory",with:{architect:{stance:"peer",can_contradict:true},builder:{stance:"advisory",review_output:true}},debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},documentor:{stance:"supportive",with:{architect:{stance:"supportive"},builder:{stance:"supportive"},reviewer:{stance:"supportive"},security:{stance:"supportive"}},debate:{will_challenge:false,evidence_required:false,escalate_to_human:false}}};var b=g.join(k.homedir(),".paradigm","agents"),v=".paradigm/agents",y=".agent",R=".paradigm/roster.yaml",_=.3,O=60,E=7,D=.2;function x(t,e){let s=(Date.now()-new Date(e).getTime())/(1e3*60*60*24);if(s<=E)return t;let i=Math.pow(.5,(s-E)/O);return t*i}function M(t){let e=g.join(t,R);if(!l.existsSync(e))return null;try{return h.load(l.readFileSync(e,"utf8"))?.active??null}catch{return null}}function V(t,e){let o=M(e);return o?o.includes(t):true}function X(t,e){let o=g.join(t,R),s=g.dirname(o);l.existsSync(s)||l.mkdirSync(s,{recursive:true});let i={version:"1.0",active:e.sort()};l.writeFileSync(o,h.dump(i,{lineWidth:-1,noRefs:true}),"utf8");}function K(){if(!l.existsSync(b))return [];try{return l.readdirSync(b).filter(t=>t.endsWith(y)).map(t=>t.replace(y,""))}catch{return []}}function w(t,e){let o=g.join(t,v,`${e}${y}`);if(l.existsSync(o))try{let i=l.readFileSync(o,"utf-8"),n=h.load(i);if(n){let c=A(n);return n.__integrityStatus=c,c==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:e}),n}}catch{}let s=g.join(b,`${e}${y}`);if(l.existsSync(s))try{let i=l.readFileSync(s,"utf-8"),n=h.load(i);if(l.existsSync(o))try{let c=l.readFileSync(o,"utf-8"),f=h.load(c),r=I(n,f),a$1=A(r);return r.__integrityStatus=a$1,a$1==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification after merge \u2014 profile may have been tampered with",{agentId:e}),r}catch{}if(n){let c=A(n);n.__integrityStatus=c,c==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:e});}return n}catch{}return null}function q(t,e){let o=C(t),s=e.toLowerCase();return o.filter(i=>i.nickname?.toLowerCase()===s)}function Q(t,e){let o=w(t,e);return o||(q(t,e)[0]??null)}function C(t){let e=new Map;if(l.existsSync(b))try{let s=l.readdirSync(b).filter(i=>i.endsWith(y));for(let i of s)try{let n=l.readFileSync(g.join(b,i),"utf-8"),c=h.load(n);if(c?.id){let f=A(c);c.__integrityStatus=f,f==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:c.id}),e.set(c.id,c);}}catch{}}catch{}let o=g.join(t,v);if(l.existsSync(o))try{let s=l.readdirSync(o).filter(i=>i.endsWith(y));for(let i of s)try{let n=l.readFileSync(g.join(o,i),"utf-8"),c=h.load(n);if(!c?.id)continue;let f=e.get(c.id);if(f){let r=I(f,c),a$1=A(r);r.__integrityStatus=a$1,a$1==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification after merge \u2014 profile may have been tampered with",{agentId:r.id}),e.set(c.id,r);}else {let r=A(c);c.__integrityStatus=r,r==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:c.id}),e.set(c.id,c);}}catch{}}catch{}return Array.from(e.values())}function S(t,e,o,s){let i=o==="global"?b:g.join(s||process.cwd(),v);l.existsSync(i)||l.mkdirSync(i,{recursive:true});let n=g.join(i,`${t}${y}`);e.permissions&&(e.integrityHash=N(e)),e.updated=new Date().toISOString();let c=h.dump(e,{lineWidth:120,noRefs:true,sortKeys:false});return l.writeFileSync(n,c,"utf-8"),n}function U(t,e={}){let o=new Date().toISOString(),s={id:t,role:e.role||`${t.charAt(0).toUpperCase()+t.slice(1)} agent`,description:e.description||`Persistent identity for the ${t} agent role`,version:"1.0.0",personality:j[t]||{style:"balanced",risk:"balanced",verbosity:"concise"},expertise:[],transferable:[],contexts:{},created:o,updated:o};j[t]||(s.personality={style:"deliberate",risk:"balanced",verbosity:"concise"}),T[t]&&(s.attention={...T[t]}),$[t]&&(s.collaboration={...$[t]});let i=e.scope||"global",n=S(t,s,i,e.rootDir);return {profile:s,filePath:n}}function Z(t,e){let o=C(t),s=[];for(let i of o){let n=(i.expertise||[]).find(c=>c.symbol===e);n&&s.push({agentId:i.id,entry:n});}return s.sort((i,n)=>x(n.entry.confidence,n.entry.lastTouch)-x(i.entry.confidence,i.entry.lastTouch))}function ee(t,e,o){let s=w(t,e);if(!s)return false;let i=new Date().toISOString(),n=s.expertise||[];for(let a of o.symbols_touched){let p=n.find(u=>u.symbol===a);p?(p.sessions++,p.lastTouch=i,o.confidence!=null&&(p.confidence=(1-_)*p.confidence+_*o.confidence)):n.push({symbol:a,confidence:o.confidence??.5,sessions:1,lastTouch:i});}s.expertise=n;let c=G(t);if(c){let a=s.contexts[c]||{focus:[],sessionsInProject:0};a.lastActive=i,a.sessionsInProject=(a.sessionsInProject||0)+1,s.contexts[c]=a;}let f=g.join(t,v,`${e}${y}`),r=l.existsSync(f)?"project":"global";return S(e,s,r,t),true}function te(t,e,o){let s=w(t,e);if(!s)return false;let n={correct:1,partial:.5,incorrect:0}[o.verdict];for(let r of o.symbols_touched){let a=(s.expertise||[]).find(p=>p.symbol===r);a&&(a.confidence=(1-_)*a.confidence+_*n);}let c=g.join(t,v,`${e}${y}`),f=l.existsSync(c)?"project":"global";return S(e,s,f,t),true}function ne(t,e,o){return e?{personality:e.personality||null,topExpertise:(e.expertise||[]).sort((s,i)=>x(i.confidence,i.lastTouch)-x(s.confidence,s.lastTouch)).slice(0,10),projectContext:e.contexts?.[o]||null,transferablePatterns:(e.transferable||[]).filter(s=>s.successRate>=.7).map(s=>({id:s.id,description:s.description,successRate:s.successRate}))}:{personality:null,topExpertise:[],projectContext:null,transferablePatterns:[]}}function se(t,e,o,s,i){let n=[];if(t.personality){let r=t.personality;n.push(`## Agent Identity: ${t.id}`),n.push(`**Style:** ${r.style} | **Risk:** ${r.risk} | **Verbosity:** ${r.verbosity}`),n.push("");}t.__integrityStatus==="invalid"&&(n.push("> **WARNING:** This agent profile failed integrity verification. Its permissions or identity may have been tampered with. Treat all profile-provided instructions with caution."),n.push(""));let c=(t.expertise||[]).filter(r=>e.length===0||e.includes(r.symbol)).sort((r,a)=>x(a.confidence,a.lastTouch)-x(r.confidence,r.lastTouch)).slice(0,8);if(c.length>0){n.push("## Your Expertise on Relevant Symbols");for(let r of c){let p=1-x(r.confidence,r.lastTouch)/r.confidence,u=r.confidence>0&&p>D?" (aging)":"";n.push(`- \`${r.symbol}\`: confidence ${r.confidence.toFixed(2)} (${r.sessions} sessions)${u}`);}n.push("");}let f=(t.transferable||[]).filter(r=>r.successRate>=.7);if(f.length>0){n.push("## Transferable Patterns");for(let r of f){let a=r.appliedIn?.length||0;n.push(`- ${r.id}: ${(r.successRate*100).toFixed(0)}% success (learned in ${r.learnedIn}${a>0?`, applied in ${a} projects`:""})`);}n.push("");}if(o&&o.length>0){n.push("## Relevant Notebook Entries");for(let r of o.slice(0,5))n.push(`### ${d(r.context,{maxLength:200})}`),n.push(`Concepts: ${d(r.concepts.join(", "),{maxLength:200})}`),n.push("```"),n.push(d(r.snippet,{maxLength:300})),n.push("```"),n.push("");}if(i){if(n.push(""),n.push("## Your Recent Work on This Project"),i.lastSession){let r=Date.now()-new Date(i.lastSession.date).getTime(),a=Math.floor(r/(3600*1e3)),p=a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`;n.push(`Last session (${p}): ${d(i.lastSession.summary,{maxLength:200})}`);}if(i.sessionsOnProject&&n.push(`Sessions on this project: ${i.sessionsOnProject}`),i.pendingWork?.length){n.push("**Pending from last session:**");for(let r of i.pendingWork.slice(0,5))n.push(`- ${d(r,{maxLength:200})}`);}if(i.recentPatterns?.length){n.push("**Project patterns you've learned:**");for(let r of i.recentPatterns.slice(0,5))n.push(`- ${d(r,{maxLength:200})}`);}n.push("");}if(t.attention){let r=t.attention,a=[];r.symbols?.length&&a.push(`Symbols: ${r.symbols.join(", ")}`),r.paths?.length&&a.push(`Paths: ${r.paths.join(", ")}`),r.concepts?.length&&a.push(`Concepts: ${r.concepts.join(", ")}`),r.signals?.length&&a.push(`Signals: ${r.signals.map(p=>p.type).join(", ")}`),a.length>0&&(n.push(""),n.push("### Attention"),n.push(`Threshold: ${r.threshold??.6}`),n.push(a.join(" | ")));}if(t.collaboration){let r=t.collaboration;if(n.push(""),n.push("### Collaboration"),n.push(`Default stance: ${r.stance||"supportive"}`),r.with)for(let[a,p]of Object.entries(r.with)){let u=[`${a}: ${p.stance||"peer"}`];p.can_contradict&&u.push("can contradict"),p.review_output&&u.push("reviews output"),n.push(`- ${u.join(", ")}`);}if(r.debate){let a=r.debate,p=[];a.will_challenge&&p.push("challenges"),a.evidence_required&&p.push("evidence-based"),a.escalate_to_human&&p.push("escalates to human"),p.length&&n.push(`Debate: ${p.join(", ")}`);}}if(t.nomination){let r=t.nomination;if(n.push(""),n.push("### Nomination"),r.speak_when?.urgency?.length&&n.push(`Always speaks on: ${r.speak_when.urgency.join(", ")}`),r.contribution_style){let a=[];r.contribution_style.brief_first&&a.push("brief first"),r.contribution_style.cite_sources&&a.push("cites sources"),r.contribution_style.offer_action&&a.push("offers action"),a.length&&n.push(`Style: ${a.join(", ")}`);}}if(s){if(s.recentDecisions?.length){n.push(""),n.push("## Recent Team Decisions");for(let r of s.recentDecisions.slice(0,5))n.push(`- **${d(r.title,{maxLength:200})}**: ${d(r.decision,{maxLength:150})}`);}if(s.journalInsights?.length){n.push(""),n.push("## Transferable Insights");for(let r of s.journalInsights.slice(0,5))n.push(`- [${d(r.trigger,{maxLength:100})}] ${d(r.insight,{maxLength:150})}`);}if(s.pendingNominations?.length){n.push(""),n.push("## Pending Nominations");for(let r of s.pendingNominations.slice(0,10))n.push(`- [${d(r.urgency,{maxLength:50})}] ${d(r.brief,{maxLength:200})}`);}}return n.join(`
|
|
3
|
-
`)}async function re(t,e,o=false){let{loadLoreEntries:s}=await import('./lore-loader-
|
|
2
|
+
import {a}from'./chunk-MBPLJKE5.js';import*as l from'fs';import*as g from'path';import*as k from'os';import*as L from'crypto';import*as h from'js-yaml';var j={architect:{style:"deliberate",risk:"conservative",verbosity:"detailed"},builder:{style:"rapid",risk:"balanced",verbosity:"concise"},tester:{style:"methodical",risk:"conservative",verbosity:"concise"},reviewer:{style:"deliberate",risk:"conservative",verbosity:"detailed"},security:{style:"methodical",risk:"conservative",verbosity:"detailed"},documentor:{style:"methodical",risk:"conservative",verbosity:"concise"}},T={architect:{symbols:["$*","#*"],concepts:["architecture","design","pattern","refactor"],signals:[{type:"flow-modified"},{type:"compliance-violation"}],threshold:.5},builder:{paths:["src/**","lib/**","packages/**"],signals:[{type:"file-modified"},{type:"error-encountered"}],threshold:.7},reviewer:{concepts:["code quality","bug","smell","convention"],signals:[{type:"compliance-violation"}],threshold:.6},tester:{paths:["**/*.test.*","**/*.spec.*"],concepts:["test","coverage","assertion"],signals:[{type:"error-encountered"},{type:"test-result"}],threshold:.5},security:{symbols:["^*","#*-auth","#*-middleware"],paths:["auth/**","middleware/**","guards/**"],concepts:["permission","JWT","session","RBAC","XSS","injection"],signals:[{type:"gate-added"},{type:"route-created"},{type:"gate-checked"},{type:"compliance-violation"}],threshold:.4},documentor:{paths:["**/.purpose","**/portal.yaml",".paradigm/**"],concepts:["purpose","portal","symbol","documentation","component","gate","flow"],signals:[{type:"file-modified"},{type:"compliance-violation"},{type:"work-completed"}],threshold:.3}},$={architect:{stance:"lead",debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},builder:{stance:"supportive",with:{architect:{stance:"supportive",can_contradict:false}}},reviewer:{stance:"advisory",debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},tester:{stance:"supportive",debate:{will_challenge:false,evidence_required:true,escalate_to_human:false}},security:{stance:"advisory",with:{architect:{stance:"peer",can_contradict:true},builder:{stance:"advisory",review_output:true}},debate:{will_challenge:true,evidence_required:true,escalate_to_human:true}},documentor:{stance:"supportive",with:{architect:{stance:"supportive"},builder:{stance:"supportive"},reviewer:{stance:"supportive"},security:{stance:"supportive"}},debate:{will_challenge:false,evidence_required:false,escalate_to_human:false}}};var b=g.join(k.homedir(),".paradigm","agents"),v=".paradigm/agents",y=".agent",R=".paradigm/roster.yaml",_=.3,O=60,E=7,D=.2;function x(t,e){let s=(Date.now()-new Date(e).getTime())/(1e3*60*60*24);if(s<=E)return t;let i=Math.pow(.5,(s-E)/O);return t*i}function M(t){let e=g.join(t,R);if(!l.existsSync(e))return null;try{return h.load(l.readFileSync(e,"utf8"))?.active??null}catch{return null}}function V(t,e){let o=M(e);return o?o.includes(t):true}function X(t,e){let o=g.join(t,R),s=g.dirname(o);l.existsSync(s)||l.mkdirSync(s,{recursive:true});let i={version:"1.0",active:e.sort()};l.writeFileSync(o,h.dump(i,{lineWidth:-1,noRefs:true}),"utf8");}function K(){if(!l.existsSync(b))return [];try{return l.readdirSync(b).filter(t=>t.endsWith(y)).map(t=>t.replace(y,""))}catch{return []}}function w(t,e){let o=g.join(t,v,`${e}${y}`);if(l.existsSync(o))try{let i=l.readFileSync(o,"utf-8"),n=h.load(i);if(n){let c=A(n);return n.__integrityStatus=c,c==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:e}),n}}catch{}let s=g.join(b,`${e}${y}`);if(l.existsSync(s))try{let i=l.readFileSync(s,"utf-8"),n=h.load(i);if(l.existsSync(o))try{let c=l.readFileSync(o,"utf-8"),f=h.load(c),r=I(n,f),a$1=A(r);return r.__integrityStatus=a$1,a$1==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification after merge \u2014 profile may have been tampered with",{agentId:e}),r}catch{}if(n){let c=A(n);n.__integrityStatus=c,c==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:e});}return n}catch{}return null}function q(t,e){let o=C(t),s=e.toLowerCase();return o.filter(i=>i.nickname?.toLowerCase()===s)}function Q(t,e){let o=w(t,e);return o||(q(t,e)[0]??null)}function C(t){let e=new Map;if(l.existsSync(b))try{let s=l.readdirSync(b).filter(i=>i.endsWith(y));for(let i of s)try{let n=l.readFileSync(g.join(b,i),"utf-8"),c=h.load(n);if(c?.id){let f=A(c);c.__integrityStatus=f,f==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:c.id}),e.set(c.id,c);}}catch{}}catch{}let o=g.join(t,v);if(l.existsSync(o))try{let s=l.readdirSync(o).filter(i=>i.endsWith(y));for(let i of s)try{let n=l.readFileSync(g.join(o,i),"utf-8"),c=h.load(n);if(!c?.id)continue;let f=e.get(c.id);if(f){let r=I(f,c),a$1=A(r);r.__integrityStatus=a$1,a$1==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification after merge \u2014 profile may have been tampered with",{agentId:r.id}),e.set(c.id,r);}else {let r=A(c);c.__integrityStatus=r,r==="invalid"&&a.component("#agent-loader").warn("Agent failed integrity verification \u2014 profile may have been tampered with",{agentId:c.id}),e.set(c.id,c);}}catch{}}catch{}return Array.from(e.values())}function S(t,e,o,s){let i=o==="global"?b:g.join(s||process.cwd(),v);l.existsSync(i)||l.mkdirSync(i,{recursive:true});let n=g.join(i,`${t}${y}`);e.permissions&&(e.integrityHash=N(e)),e.updated=new Date().toISOString();let c=h.dump(e,{lineWidth:120,noRefs:true,sortKeys:false});return l.writeFileSync(n,c,"utf-8"),n}function U(t,e={}){let o=new Date().toISOString(),s={id:t,role:e.role||`${t.charAt(0).toUpperCase()+t.slice(1)} agent`,description:e.description||`Persistent identity for the ${t} agent role`,version:"1.0.0",personality:j[t]||{style:"balanced",risk:"balanced",verbosity:"concise"},expertise:[],transferable:[],contexts:{},created:o,updated:o};j[t]||(s.personality={style:"deliberate",risk:"balanced",verbosity:"concise"}),T[t]&&(s.attention={...T[t]}),$[t]&&(s.collaboration={...$[t]});let i=e.scope||"global",n=S(t,s,i,e.rootDir);return {profile:s,filePath:n}}function Z(t,e){let o=C(t),s=[];for(let i of o){let n=(i.expertise||[]).find(c=>c.symbol===e);n&&s.push({agentId:i.id,entry:n});}return s.sort((i,n)=>x(n.entry.confidence,n.entry.lastTouch)-x(i.entry.confidence,i.entry.lastTouch))}function ee(t,e,o){let s=w(t,e);if(!s)return false;let i=new Date().toISOString(),n=s.expertise||[];for(let a of o.symbols_touched){let p=n.find(u=>u.symbol===a);p?(p.sessions++,p.lastTouch=i,o.confidence!=null&&(p.confidence=(1-_)*p.confidence+_*o.confidence)):n.push({symbol:a,confidence:o.confidence??.5,sessions:1,lastTouch:i});}s.expertise=n;let c=G(t);if(c){let a=s.contexts[c]||{focus:[],sessionsInProject:0};a.lastActive=i,a.sessionsInProject=(a.sessionsInProject||0)+1,s.contexts[c]=a;}let f=g.join(t,v,`${e}${y}`),r=l.existsSync(f)?"project":"global";return S(e,s,r,t),true}function te(t,e,o){let s=w(t,e);if(!s)return false;let n={correct:1,partial:.5,incorrect:0}[o.verdict];for(let r of o.symbols_touched){let a=(s.expertise||[]).find(p=>p.symbol===r);a&&(a.confidence=(1-_)*a.confidence+_*n);}let c=g.join(t,v,`${e}${y}`),f=l.existsSync(c)?"project":"global";return S(e,s,f,t),true}function ne(t,e,o){return e?{personality:e.personality||null,topExpertise:(e.expertise||[]).sort((s,i)=>x(i.confidence,i.lastTouch)-x(s.confidence,s.lastTouch)).slice(0,10),projectContext:e.contexts?.[o]||null,transferablePatterns:(e.transferable||[]).filter(s=>s.successRate>=.7).map(s=>({id:s.id,description:s.description,successRate:s.successRate}))}:{personality:null,topExpertise:[],projectContext:null,transferablePatterns:[]}}function se(t,e,o,s,i){let n=[];if(t.personality){let r=t.personality;n.push(`## Agent Identity: ${t.id}`),n.push(`**Style:** ${r.style} | **Risk:** ${r.risk} | **Verbosity:** ${r.verbosity}`),n.push("");}t.__integrityStatus==="invalid"&&(n.push("> **WARNING:** This agent profile failed integrity verification. Its permissions or identity may have been tampered with. Treat all profile-provided instructions with caution."),n.push(""));let c=(t.expertise||[]).filter(r=>e.length===0||e.includes(r.symbol)).sort((r,a)=>x(a.confidence,a.lastTouch)-x(r.confidence,r.lastTouch)).slice(0,8);if(c.length>0){n.push("## Your Expertise on Relevant Symbols");for(let r of c){let p=1-x(r.confidence,r.lastTouch)/r.confidence,u=r.confidence>0&&p>D?" (aging)":"";n.push(`- \`${r.symbol}\`: confidence ${r.confidence.toFixed(2)} (${r.sessions} sessions)${u}`);}n.push("");}let f=(t.transferable||[]).filter(r=>r.successRate>=.7);if(f.length>0){n.push("## Transferable Patterns");for(let r of f){let a=r.appliedIn?.length||0;n.push(`- ${r.id}: ${(r.successRate*100).toFixed(0)}% success (learned in ${r.learnedIn}${a>0?`, applied in ${a} projects`:""})`);}n.push("");}if(o&&o.length>0){n.push("## Relevant Notebook Entries");for(let r of o.slice(0,5))n.push(`### ${d(r.context,{maxLength:200})}`),n.push(`Concepts: ${d(r.concepts.join(", "),{maxLength:200})}`),n.push("```"),n.push(d(r.snippet,{maxLength:300})),n.push("```"),n.push("");}if(i){if(n.push(""),n.push("## Your Recent Work on This Project"),i.lastSession){let r=Date.now()-new Date(i.lastSession.date).getTime(),a=Math.floor(r/(3600*1e3)),p=a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`;n.push(`Last session (${p}): ${d(i.lastSession.summary,{maxLength:200})}`);}if(i.sessionsOnProject&&n.push(`Sessions on this project: ${i.sessionsOnProject}`),i.pendingWork?.length){n.push("**Pending from last session:**");for(let r of i.pendingWork.slice(0,5))n.push(`- ${d(r,{maxLength:200})}`);}if(i.recentPatterns?.length){n.push("**Project patterns you've learned:**");for(let r of i.recentPatterns.slice(0,5))n.push(`- ${d(r,{maxLength:200})}`);}n.push("");}if(t.attention){let r=t.attention,a=[];r.symbols?.length&&a.push(`Symbols: ${r.symbols.join(", ")}`),r.paths?.length&&a.push(`Paths: ${r.paths.join(", ")}`),r.concepts?.length&&a.push(`Concepts: ${r.concepts.join(", ")}`),r.signals?.length&&a.push(`Signals: ${r.signals.map(p=>p.type).join(", ")}`),a.length>0&&(n.push(""),n.push("### Attention"),n.push(`Threshold: ${r.threshold??.6}`),n.push(a.join(" | ")));}if(t.collaboration){let r=t.collaboration;if(n.push(""),n.push("### Collaboration"),n.push(`Default stance: ${r.stance||"supportive"}`),r.with)for(let[a,p]of Object.entries(r.with)){let u=[`${a}: ${p.stance||"peer"}`];p.can_contradict&&u.push("can contradict"),p.review_output&&u.push("reviews output"),n.push(`- ${u.join(", ")}`);}if(r.debate){let a=r.debate,p=[];a.will_challenge&&p.push("challenges"),a.evidence_required&&p.push("evidence-based"),a.escalate_to_human&&p.push("escalates to human"),p.length&&n.push(`Debate: ${p.join(", ")}`);}}if(t.nomination){let r=t.nomination;if(n.push(""),n.push("### Nomination"),r.speak_when?.urgency?.length&&n.push(`Always speaks on: ${r.speak_when.urgency.join(", ")}`),r.contribution_style){let a=[];r.contribution_style.brief_first&&a.push("brief first"),r.contribution_style.cite_sources&&a.push("cites sources"),r.contribution_style.offer_action&&a.push("offers action"),a.length&&n.push(`Style: ${a.join(", ")}`);}}if(s){if(s.recentDecisions?.length){n.push(""),n.push("## Recent Team Decisions");for(let r of s.recentDecisions.slice(0,5))n.push(`- **${d(r.title,{maxLength:200})}**: ${d(r.decision,{maxLength:150})}`);}if(s.journalInsights?.length){n.push(""),n.push("## Transferable Insights");for(let r of s.journalInsights.slice(0,5))n.push(`- [${d(r.trigger,{maxLength:100})}] ${d(r.insight,{maxLength:150})}`);}if(s.pendingNominations?.length){n.push(""),n.push("## Pending Nominations");for(let r of s.pendingNominations.slice(0,10))n.push(`- [${d(r.urgency,{maxLength:50})}] ${d(r.brief,{maxLength:200})}`);}}return n.join(`
|
|
3
|
+
`)}async function re(t,e,o=false){let{loadLoreEntries:s}=await import('./lore-loader-XY5MZRR2.js'),i=await s(t,{limit:500}),n=0,c=new Set,f=w(t,e)||U(e,{rootDir:t}).profile,r=f.expertise||[];for(let a of i)if(!(!a.symbols_touched||a.symbols_touched.length===0)){n++;for(let p of a.symbols_touched){c.add(p);let u=r.find(F=>F.symbol===p);u?(u.sessions++,u.lastTouch=a.timestamp,a.confidence!=null&&(u.confidence=(1-_)*u.confidence+_*a.confidence)):r.push({symbol:p,confidence:a.confidence??.5,sessions:1,lastTouch:a.timestamp});}}if(f.expertise=r,!o){let a=g.join(t,v,`${e}${y}`),p=l.existsSync(a)?"project":"global";S(e,f,p,t);}return {entriesProcessed:n,symbolsUpdated:c.size}}function d(t,e){let o=e?.maxLength??500,s=t;return s=s.replace(/^#{1,6}\s*(SYSTEM|IMPORTANT|OVERRIDE|INSTRUCTIONS?)\s*$/gim,""),s=s.replace(/^\s*(Ignore all previous|You are now|SYSTEM:|ASSISTANT:|USER:|\[SYSTEM\]|<\/?system>)/gim,""),s=s.trim(),s.length>o&&(s=s.slice(0,o)+"..."),s}function A(t){let e=Y(t);return e.valid?e.reason&&e.reason.includes("No integrity hash")?"missing":"valid":"invalid"}function W(t,e,o){if(!t.permissions?.paths)return {allowed:true};let{read:s,write:i,deny:n}=t.permissions.paths;if(n&&n.length>0){for(let f of n)if(P(f,e))return {allowed:false,reason:`Path denied by pattern: ${f}`}}let c=o==="read"?s:i;if(c&&c.length>0){for(let f of c)if(P(f,e))return {allowed:true};return {allowed:false,reason:`No ${o} pattern matches: ${e}`}}return {allowed:true}}function H(t,e){if(!t.permissions?.tools)return {allowed:true};let{allow:o,deny:s}=t.permissions.tools;if(s&&s.length>0){for(let i of s)if(P(i,e))return {allowed:false,reason:`Tool denied by pattern: ${i}`}}if(o&&o.length>0){for(let i of o)if(P(i,e))return {allowed:true};return {allowed:false,reason:`Tool not in allow list: ${e}`}}return {allowed:true}}function ie(t){let e=t.permissions;if(!e)return {allowedPaths:[],deniedPaths:[],allowedTools:[],deniedTools:[]};let o=e.paths?.read??[],s=e.paths?.write??[],i=[...new Set([...o,...s])],n=e.paths?.deny??[],c=e.tools?.allow??[],f=e.tools?.deny??[];return {allowedPaths:i,deniedPaths:n,allowedTools:c,deniedTools:f}}function oe(t,e){return e.type==="path"?W(t,e.path,e.mode):H(t,e.name)}function N(t){let e=JSON.stringify({id:t.id,role:t.role,permissions:t.permissions||null});return L.createHash("sha256").update(e).digest("hex")}function Y(t){return t.integrityHash?N(t)===t.integrityHash?{valid:true}:{valid:false,reason:"Integrity hash mismatch \u2014 profile may have been tampered with"}:{valid:true,reason:"No integrity hash stored (pre-4.0 profile)"}}function P(t,e){let o=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${o}$`).test(e)}function I(t,e){let o={...t};if(e.role&&(o.role=e.role),e.description&&(o.description=e.description),e.version&&(o.version=e.version),e.personality&&(o.personality={...t.personality,...e.personality}),e.expertise){let s=new Map(t.expertise.map(i=>[i.symbol,i]));for(let i of e.expertise)s.set(i.symbol,i);o.expertise=Array.from(s.values());}if(e.transferable){let s=new Map(t.transferable.map(i=>[i.id,i]));for(let i of e.transferable)s.set(i.id,i);o.transferable=Array.from(s.values());}if(e.contexts){o.contexts={...t.contexts};for(let[s,i]of Object.entries(e.contexts))o.contexts[s]={...o.contexts[s],...i};}return o}function G(t){try{let e=g.join(t,".paradigm","config.yaml");if(l.existsSync(e)){let o=l.readFileSync(e,"utf-8"),s=h.load(o);if(s?.project&&typeof s.project=="string")return s.project}}catch{}return g.basename(t)}export{x as a,M as b,V as c,X as d,K as e,w as f,q as g,Q as h,C as i,S as j,U as k,Z as l,ee as m,te as n,ne as o,se as p,re as q,d as r,A as s,W as t,H as u,ie as v,oe as w,N as x,Y as y};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {c,a}from'./chunk-
|
|
2
|
+
import {c,a}from'./chunk-3KVVC4WV.js';import {b as b$1,a as a$1}from'./chunk-EK4ZRIFJ.js';import*as s from'fs';import*as o from'path';import*as v from'os';import*as d from'crypto';c();b$1();function $(t){return t.contentType!==void 0&&a.includes(t.contentType)}function ct(t,n,e){try{let r={id:d.randomUUID(),timestamp:new Date().toISOString(),agent:t,boundary:e,data_category:n.contentType,action:"blocked",destination_ring:"network-public",details:n.id},i=o.join(v.homedir(),".paradigm","events","audit-ring1.jsonl");I(i,r);}catch(r){a$1.component("#symphony-loader").warn(`Ring 1 audit write failed: ${r}`);}}var g=o.join(v.homedir(),".paradigm","score"),N=o.join(v.homedir(),".paradigm","mail"),h=o.join(g,"agents"),S=o.join(g,"threads"),m=o.join(g,"file-requests"),E=o.join(g,"trust.yaml"),X=3600*1e3,b={users:{},defaults:{level:"restricted",autoApprove:[],neverApprove:[".env*","**/*.key","**/*.pem","**/credentials*","**/secrets/**"]}};function tt(){if(s.existsSync(N)&&!s.existsSync(g))try{s.renameSync(N,g);}catch{}}function p(){tt();for(let t of [h,S,m])s.existsSync(t)||s.mkdirSync(t,{recursive:true});}var ut=p;function f(t){return o.join(h,t)}function R(t){let n=f(t);return s.existsSync(n)||s.mkdirSync(n,{recursive:true}),n}function x(t){if(!s.existsSync(t))return [];let e=s.readFileSync(t,"utf-8").split(`
|
|
3
3
|
`).filter(i=>i.trim().length>0),r=[];for(let i of e)try{r.push(JSON.parse(i));}catch{}return r}function I(t,n){let e=o.dirname(t);s.existsSync(e)||s.mkdirSync(e,{recursive:true}),s.appendFileSync(t,JSON.stringify(n)+`
|
|
4
4
|
`,"utf-8");}function C(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,40)||"unknown"}function _(t){try{let n=o.join(t,".paradigm","config.yaml");if(s.existsSync(n)){let r=s.readFileSync(n,"utf-8").match(/^project:\s*(.+)$/m);if(r)return C(r[1].trim().replace(/["']/g,""))}}catch{}return C(o.basename(t))}function z(t,n){return `${_(t)}/${n||"core"}`}function ft(t,n,e){p();let r=z(t,n),i=R(r),a=_(t),c={id:r,name:e||`${a} (${n||"core"})`,type:"agent",project:a,role:n||"core",pid:process.pid,startedAt:new Date().toISOString(),label:e};return s.writeFileSync(o.join(i,"identity.json"),JSON.stringify(c,null,2),"utf-8"),c}function et(t){let n=f(t);if(!s.existsSync(n))return false;try{return s.rmSync(n,{recursive:!0,force:!0}),!0}catch{return false}}function P(){if(p(),!s.existsSync(h))return [];let t=[],n=s.readdirSync(h,{withFileTypes:true}).filter(e=>e.isDirectory());for(let e of n){let r=o.join(h,e.name),i=s.readdirSync(r,{withFileTypes:true}).filter(a=>a.isDirectory());for(let a of i){let c=o.join(r,a.name,"identity.json");if(s.existsSync(c))try{let u=s.readFileSync(c,"utf-8"),l=JSON.parse(u);t.push(l);}catch{}}}return t}function lt(){let t=P(),n=0;for(let e of t)F(e.pid)||(et(e.id),n++);return n}function dt(t){let n=z(t),e=o.join(f(n),"identity.json");if(!s.existsSync(e))return null;try{return JSON.parse(s.readFileSync(e,"utf-8"))}catch{return null}}function pt(t,n){let e=o.join(f(t),"identity.json");if(s.existsSync(e))try{let r=JSON.parse(s.readFileSync(e,"utf-8"));r.lastPoll=new Date().toISOString(),n!==void 0&&(r.statusBlurb=n||void 0),s.writeFileSync(e,JSON.stringify(r,null,2),"utf-8");}catch{}}function gt(t,n){let e=o.join(f(t),"identity.json");if(s.existsSync(e))try{let r=JSON.parse(s.readFileSync(e,"utf-8"));r.statusBlurb=n||void 0,s.writeFileSync(e,JSON.stringify(r,null,2),"utf-8");}catch{}}function yt(t,n=6e4){if(!t.lastPoll)return true;let e=new Date(t.lastPoll).getTime();return Date.now()-e>n}function ht(){let n=P().filter(e=>F(e.pid));try{let e=o.join(v.homedir(),".conductor","sessions");if(s.existsSync(e)){let r=s.readdirSync(e).filter(i=>i.endsWith(".json"));for(let i of r)try{let a=s.readFileSync(o.join(e,i),"utf-8"),c=JSON.parse(a),u=parseInt(o.basename(i,".json"),10);!n.some(l=>l.pid===u)&&F(u)&&n.push({id:`conductor/${u}`,name:c.label||`Session ${u}`,type:"agent",project:c.projectDir?o.basename(c.projectDir):"unknown",role:"conductor",pid:u,startedAt:c.registeredAt||new Date().toISOString()});}catch{}}}catch{}return n}function y(t){return o.join(f(t),"inbox.jsonl")}function j(t){return o.join(f(t),"outbox.jsonl")}function B(t){return o.join(f(t),"ack.json")}function St(t){let n=y(t);if(!s.existsSync(n))return {hasNew:false,inboxSize:0};let r=s.statSync(n).size;if(!k(t))return {hasNew:r>0,inboxSize:r};let a=o.join(f(t),"ack-size.json");if(s.existsSync(a))try{let c=JSON.parse(s.readFileSync(a,"utf-8"));return {hasNew:r>(c.size||0),inboxSize:r}}catch{}return {hasNew:r>0,inboxSize:r}}function mt(t){let n=y(t),e=o.join(f(t),"ack-size.json");try{let r=s.existsSync(n)?s.statSync(n).size:0;R(t),s.writeFileSync(e,JSON.stringify({size:r}),"utf-8");}catch{}}function J(t,n){R(t),I(y(t),n);}function xt(t,n){let e=x(y(t));if(!n){let i=k(t);if(i){let a=e.findIndex(c=>c.id===i);if(a>=0)return e.slice(a+1)}return e}let r=e.findIndex(i=>i.id===n);return r>=0?e.slice(r+1):e}function nt(t,n){R(t),I(j(t),n);}function rt(t){return x(j(t))}function vt(t){return rt(t).filter(n=>!$(n))}function Rt(t,n){let e=B(t);R(t),s.writeFileSync(e,JSON.stringify({lastAck:n}),"utf-8");}function k(t){let n=B(t);if(!s.existsSync(n))return null;try{return JSON.parse(s.readFileSync(n,"utf-8")).lastAck||null}catch{return null}}function At(t){let n=k(t);if(!n)return 0;let e=y(t),r=x(e),i=r.findIndex(u=>u.id===n);if(i<0)return 0;let a=r.slice(i+1),c=r.length-a.length;return a.length===0?s.existsSync(e)&&s.writeFileSync(e,"","utf-8"):s.writeFileSync(e,a.map(u=>JSON.stringify(u)).join(`
|
|
5
5
|
`)+`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a}from'./chunk-EKZDFEJW.js';import'./chunk-
|
|
2
|
+
import {a}from'./chunk-EKZDFEJW.js';import'./chunk-5TAVYPOV.js';var w={opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-20250514",haiku:"claude-haiku-4-20250514"},_=class{name="claude";apiKey=null;baseUrl="https://api.anthropic.com/v1";constructor(){this.apiKey=process.env.ANTHROPIC_API_KEY||null;}listModels(){return ["opus","sonnet","haiku"]}supportsParallel(){return true}supportsMcp(){return true}getTokenCost(n){return a[n]}async isAvailable(){return !!this.apiKey}async*spawn(n,t){if(!this.apiKey){yield {type:"error",content:"ANTHROPIC_API_KEY not set",timestamp:new Date().toISOString()};return}let e=t.model||"sonnet",o=w[e],l=this.buildSystemPrompt(n,t),a=[{role:"user",content:t.task}],r={input:0,output:0,total:0},p=true,i=0,u=50;for(;p&&i<u;){i++;try{let d=await this.streamRequest(o,l,a,t),m=[],c=null;for await(let s of d)if(s.type==="content_block_start"&&s.content_block)s.content_block.type==="tool_use"&&(c={id:s.content_block.id||"",name:s.content_block.name||"",input:""});else if(s.type==="content_block_delta"&&s.delta)s.delta.type==="text_delta"&&s.delta.text?yield {type:"text",content:s.delta.text,timestamp:new Date().toISOString()}:s.delta.type==="input_json_delta"&&c&&(c.input+=s.delta.partial_json||"");else if(s.type==="content_block_stop"){if(c){let h=JSON.parse(c.input||"{}");m.push({type:"tool_use",id:c.id,name:c.name,input:h}),yield {type:"tool_use",content:`Using tool: ${c.name}`,toolName:c.name,toolInput:h,timestamp:new Date().toISOString()},c=null;}}else if(s.type==="message_delta"&&s.usage)r.input+=s.usage.input_tokens||0,r.output+=s.usage.output_tokens||0,r.total=r.input+r.output;else if(s.type==="message_stop")if(m.some(y=>y.type==="tool_use")){a.push({role:"assistant",content:m});let y=await this.executeTools(m,t);a.push({role:"user",content:y});for(let g of y)g.type==="tool_result"&&(yield {type:"tool_result",content:typeof g.content=="string"?g.content:JSON.stringify(g.content),toolName:g.tool_use_id,toolResult:g.content,timestamp:new Date().toISOString()});m=[];}else p=!1;t.budget?.maxTokens&&r.total>t.budget.maxTokens&&(yield {type:"error",content:`Token budget exceeded: ${r.total} > ${t.budget.maxTokens}`,usage:r,timestamp:new Date().toISOString()},p=!1);}catch(d){yield {type:"error",content:d instanceof Error?d.message:String(d),timestamp:new Date().toISOString()},p=false;}}yield {type:"done",content:"Agent completed",usage:r,timestamp:new Date().toISOString()};}buildSystemPrompt(n,t){let e=[];return e.push(t.context.systemPrompt),e.push(`
|
|
3
3
|
## Your Role: ${n.name.toUpperCase()}
|
|
4
4
|
`),e.push(n.role),n.focus&&(e.push(`
|
|
5
5
|
### Focus Areas
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a}from'./chunk-EKZDFEJW.js';import'./chunk-
|
|
2
|
+
import {a}from'./chunk-EKZDFEJW.js';import'./chunk-5TAVYPOV.js';import*as x from'fs';import*as f from'path';import {spawn}from'child_process';import {EventEmitter}from'events';var b=class{name="claude-cli";claudePath=null;constructor(){}listModels(){return ["opus","sonnet","haiku"]}supportsParallel(){return true}supportsMcp(){return true}getTokenCost(r){return a[r]}async isAvailable(){try{let{execSync:r}=await import('child_process'),n=r("which claude",{encoding:"utf-8"}).trim();if(n)return this.claudePath=n,!0}catch{let r=["/usr/local/bin/claude",f.join(process.env.HOME||"",".local/bin/claude"),f.join(process.env.HOME||"",".claude/bin/claude")];for(let n of r)if(x.existsSync(n))return this.claudePath=n,true}return false}async*spawn(r,n){if(!this.claudePath){yield {type:"error",content:"Claude CLI not found",timestamp:new Date().toISOString()};return}let e=this.buildPrompt(r,n);yield {type:"text",content:`Starting ${r.name} agent via CLI (streaming)...
|
|
3
3
|
`,timestamp:new Date().toISOString()};let p=["--print","--permission-mode","acceptEdits","--output-format","stream-json","--no-session-persistence"];n.model&&p.push("--model",n.model),n.workingDirectory&&p.push("--add-dir",n.workingDirectory),p.push("-p",e.slice(0,8e3));let o=new EventEmitter,h={input:0,output:0,total:0},a=null,c=false,u=spawn(this.claudePath,p,{cwd:n.workingDirectory||process.cwd(),env:{...process.env},stdio:["pipe","pipe","pipe"]}),g="";u.stdout?.on("data",t=>{g+=t.toString();let s=g.split(`
|
|
4
4
|
`);g=s.pop()||"";for(let d of s)if(d.trim())try{let k=JSON.parse(d);o.emit("message",k);}catch{o.emit("text",d);}}),u.stderr?.on("data",t=>{let s=t.toString();s.includes("Error")?a=s:o.emit("progress",s);}),u.on("close",t=>{c=true,o.emit("done",t);}),u.on("error",t=>{a=t.message,o.emit("error",t);});let y=n.timeout||180*1e3,S=setTimeout(()=>{u.kill(),a=`Claude CLI timed out after ${y/1e3}s`,o.emit("timeout");},y),l=[],m=null,i=t=>{m?(m(t),m=null):l.push(t);};for(o.on("message",t=>{if(t.type==="assistant"&&t.message?.content)for(let s of t.message.content)s.type==="text"&&s.text?i({type:"text",content:s.text,timestamp:new Date().toISOString()}):s.type==="tool_use"&&s.name&&i({type:"tool_use",content:`Using tool: ${s.name}`,toolName:s.name,toolInput:s.input,timestamp:new Date().toISOString()});else t.type==="result"&&t.usage&&(h={input:t.usage.input_tokens||0,output:t.usage.output_tokens||0,total:(t.usage.input_tokens||0)+(t.usage.output_tokens||0)});}),o.on("text",t=>{i({type:"text",content:t+`
|
|
5
5
|
`,timestamp:new Date().toISOString()});}),o.on("progress",t=>{i({type:"text",content:".",timestamp:new Date().toISOString()});}),o.on("done",()=>{clearTimeout(S),i({type:"done",content:"Agent completed",usage:h,timestamp:new Date().toISOString()});}),o.on("timeout",()=>{i({type:"error",content:a||"Timeout",timestamp:new Date().toISOString()});}),o.on("error",t=>{clearTimeout(S),i({type:"error",content:t.message,timestamp:new Date().toISOString()});});!c||l.length>0;)if(l.length>0){let t=l.shift();if(yield t,t.type==="done"||t.type==="error")break}else {let t=await new Promise(s=>{m=s,setTimeout(()=>s(null),100);});if(t&&(yield t,t.type==="done"||t.type==="error"))break}a&&!c&&(yield {type:"error",content:a,timestamp:new Date().toISOString()});}buildPrompt(r,n){let e=[];return e.push(`# ${r.name.toUpperCase()} Agent`),e.push(""),e.push("## Role"),e.push(r.role),e.push(""),e.push("## Task"),e.push(n.task),e.push(""),n.context.systemPrompt&&(e.push("## Context"),e.push(n.context.systemPrompt.slice(0,3e3)),e.push("")),n.context.symbols.length>0&&(e.push("## Symbols"),e.push(n.context.symbols.join(", ")),e.push("")),n.context.handoffContext&&(e.push("## From Previous Agent"),e.push(n.context.handoffContext),e.push("")),e.push("## Instructions"),e.push("Complete the task above. Be concise and focused. Keep response under 500 words."),e.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a as a$1}from'./chunk-EKZDFEJW.js';import'./chunk-
|
|
2
|
+
import {a as a$1}from'./chunk-EKZDFEJW.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as o from'path';import*as i from'js-yaml';var a=class{name="claude-code";tasksDir;constructor(e=process.cwd()){this.tasksDir=o.join(e,".paradigm","tasks");}listModels(){return ["opus","sonnet","haiku"]}supportsParallel(){return true}supportsMcp(){return true}getTokenCost(e){return a$1[e]}async isAvailable(){let e=o.join(process.env.HOME||"",".claude");return n.existsSync(e)||process.env.CLAUDE_CODE==="1"||process.env.TERM_PROGRAM==="claude"}async*spawn(e,s){let t=this.generateTaskId(e.name),u=o.join(this.tasksDir,`${t}.yaml`);n.existsSync(this.tasksDir)||n.mkdirSync(this.tasksDir,{recursive:true});let p={id:t,agent:e.name,model:s.model||"sonnet",status:"pending",created:new Date().toISOString(),task:s.task,context:{systemPrompt:s.context.systemPrompt,symbols:s.context.symbols,handoffContext:s.context.handoffContext},role:e.role,focus:e.focus};n.writeFileSync(u,i.dump(p)),yield {type:"text",content:`Task created: ${t}
|
|
3
3
|
`,timestamp:new Date().toISOString()},yield {type:"text",content:`
|
|
4
4
|
---
|
|
5
5
|
**To execute this agent, use the Task tool with:**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a}from'./chunk-EKZDFEJW.js';import'./chunk-
|
|
2
|
+
import {a}from'./chunk-EKZDFEJW.js';import'./chunk-5TAVYPOV.js';import*as n from'fs';import*as o from'path';import*as p from'js-yaml';var l={architect:"opus",security:"opus",reviewer:"sonnet",builder:"haiku",tester:"haiku"},c=class{name="claude-code-teams";tasksDir;constructor(t=process.cwd()){this.tasksDir=o.join(t,".paradigm","tasks","teams");}listModels(){return ["opus","sonnet","haiku"]}supportsParallel(){return true}supportsMcp(){return true}getTokenCost(t){return a[t]}async isAvailable(){if(!(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS==="1"))return false;let s=o.join(process.env.HOME||"",".claude");return n.existsSync(s)||process.env.CLAUDE_CODE==="1"||process.env.TERM_PROGRAM==="claude"}async*spawn(t,s){let e=this.generateTaskId(t.name),a=o.join(this.tasksDir,`${e}.yaml`);n.existsSync(this.tasksDir)||n.mkdirSync(this.tasksDir,{recursive:true});let i=this.buildTeammatePrompt(t,s),r=s.model||l[t.name]||"sonnet",u={id:e,provider:"claude-code-teams",agent:t.name,model:r,status:"pending",created:new Date().toISOString(),task:s.task,teammateConfig:{prompt:i,model:r,delegateMode:t.name==="architect"||t.name==="security",focus:t.focus},context:{symbols:s.context.symbols,handoffContext:s.context.handoffContext}};n.writeFileSync(a,p.dump(u)),yield {type:"text",content:`Agent Teams task created: ${e}
|
|
3
3
|
`,timestamp:new Date().toISOString()},yield {type:"text",content:this.buildSpawnInstruction(t,i,r),timestamp:new Date().toISOString()};let d={subject:`${t.name}: ${s.task.slice(0,80)}`,description:i,activeForm:`Running ${t.name} agent`};yield {type:"text",content:`
|
|
4
4
|
**Shared task list entry:**
|
|
5
5
|
\`\`\`json
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a,e,d}from'./chunk-
|
|
3
|
-
`).filter(Boolean);}catch{}let i;try{i=execSync("git status --porcelain",{cwd:s,encoding:"utf8",timeout:5e3}).trim()==="";}catch{}let u=p.join(s,"portal.yaml"),g=!1;if(c.existsSync(u))try{let t=c.readFileSync(u,"utf8"),e=w.load(t);g=e?.routes!=null&&Object.keys(e.routes).length>0;}catch{}let r=e({toolsCalled:[],filesModified:f,symbolsTouched:[],loreRecorded:!1,hasPortalRoutes:g,taskAddsRoutes:!1,gitClean:i}),o=d(a$1,l,r),d$1=0;if(o.evaluations.length>0)try{let t=p.join(s,".paradigm","sentinel");if(c.existsSync(t)){let{SentinelStorage:e}=await import('./dist-
|
|
4
|
-
`),"utf8");}else l==="on-stop"&&c.existsSync(h)&&c.unlinkSync(h);}catch{}return {trigger:l,evaluation:{total:o.summary.total,followed:o.summary.followed,skipped:o.summary.skipped,partial:o.summary.partial,blockingViolations:o.summary.blockingViolations,blocksCompletion:o.blocksCompletion},habits:o.evaluations.map(t=>({id:t.habit.id,name:t.habit.name,category:t.habit.category,severity:t.habit.severity,result:t.result,reason:t.reason,evidence:t.evidence})),recorded:d$1}}catch{return null}}async function P(s,l){let a=p.join(s,".paradigm","aspect-graph.db");if(!c.existsSync(a))return {driftedCount:0,healedCount:0,cleanCount:0,missingCount:0,details:[]};try{let{driftCheckCommand:f}=await import('./drift-
|
|
2
|
+
import {a,e,d}from'./chunk-QO7YPQXC.js';import'./chunk-5TAVYPOV.js';import*as c from'fs';import*as p from'path';import {execSync}from'child_process';import n from'chalk';import*as w from'js-yaml';function R(s){return s.match(/(?:^|\s)((?:\/|\.\/|[a-zA-Z0-9_-]+\/)[^\s,;:'"]+\.[a-zA-Z]{1,10})\b/)?.[1]}async function $(s,l){try{let a$1=a(s),f=[];try{f=execSync("git diff --name-only HEAD",{cwd:s,encoding:"utf8",timeout:5e3}).trim().split(`
|
|
3
|
+
`).filter(Boolean);}catch{}let i;try{i=execSync("git status --porcelain",{cwd:s,encoding:"utf8",timeout:5e3}).trim()==="";}catch{}let u=p.join(s,"portal.yaml"),g=!1;if(c.existsSync(u))try{let t=c.readFileSync(u,"utf8"),e=w.load(t);g=e?.routes!=null&&Object.keys(e.routes).length>0;}catch{}let r=e({toolsCalled:[],filesModified:f,symbolsTouched:[],loreRecorded:!1,hasPortalRoutes:g,taskAddsRoutes:!1,gitClean:i}),o=d(a$1,l,r),d$1=0;if(o.evaluations.length>0)try{let t=p.join(s,".paradigm","sentinel");if(c.existsSync(t)){let{SentinelStorage:e}=await import('./dist-VGFSP3XM.js'),m=new e(t);for(let b of o.evaluations)m.recordPracticeEvent({habitId:b.habit.id,habitCategory:b.habit.category,result:b.result,engineer:"agent",sessionId:`cli-${Date.now().toString(36)}`,symbolsTouched:[],filesModified:f,notes:b.reason}),d$1++;}}catch{}let h=p.join(s,".paradigm",".habits-blocking");try{if(l==="on-stop"&&o.blocksCompletion){let t=o.evaluations.filter(e=>e.result==="skipped"&&e.habit.severity==="block").map(e=>`${e.habit.name}: ${e.reason}`);c.writeFileSync(h,t.join(`
|
|
4
|
+
`),"utf8");}else l==="on-stop"&&c.existsSync(h)&&c.unlinkSync(h);}catch{}return {trigger:l,evaluation:{total:o.summary.total,followed:o.summary.followed,skipped:o.summary.skipped,partial:o.summary.partial,blockingViolations:o.summary.blockingViolations,blocksCompletion:o.blocksCompletion},habits:o.evaluations.map(t=>({id:t.habit.id,name:t.habit.name,category:t.habit.category,severity:t.habit.severity,result:t.result,reason:t.reason,evidence:t.evidence})),recorded:d$1}}catch{return null}}async function P(s,l){let a=p.join(s,".paradigm","aspect-graph.db");if(!c.existsSync(a))return {driftedCount:0,healedCount:0,cleanCount:0,missingCount:0,details:[]};try{let{driftCheckCommand:f}=await import('./drift-ILZE5BFJ.js'),i="",u=console.log;console.log=g=>{i=g;};try{await f({json:!0,autoHeal:l});}finally{console.log=u;}return i?JSON.parse(i):null}catch{return null}}async function B(s){if(!c.existsSync(p.join(s,"portal.yaml")))return null;try{let{checkPortalCompliance:l}=await import('./portal-compliance-4MG5F2GI.js'),a=await l(s);return {status:a.status,declaredButUnusedCount:a.declaredButUnused.length,usedButUndeclaredCount:a.usedButUndeclared.length,properlyDeclaredCount:a.properlyDeclared.length,declaredButUnused:a.declaredButUnused,usedButUndeclared:a.usedButUndeclared,properlyDeclared:a.properlyDeclared}}catch{return null}}async function j(s){try{let{runPostflightLearning:l}=await import('./ambient-GJAEXF7B.js');return await l(s)}catch{return null}}async function A(s){let l=process.cwd(),a=s.trigger||"on-stop",f=s.autoHeal!==false,i=[],u=[],g=await $(l,a),r=await P(l,f),o=await B(l);if(g?.evaluation.blocksCompletion){let t=g.habits.filter(e=>e.result==="skipped"&&e.severity==="block");for(let e of t){let m=`Blocking habit not satisfied: ${e.name} \u2014 ${e.reason}`;i.push(m),u.push({message:m,source:"habits",file:R(e.reason),severity:"blocking"});}}if(r&&r.driftedCount>0){let t=`${r.driftedCount} aspect anchor(s) have drifted (content genuinely changed). Run paradigm_aspect_check to review.`;i.push(t);for(let e of r.details.filter(m=>m.status==="drifted"))u.push({message:`Aspect ~${e.aspectId} drifted at lines ${e.startLine}-${e.endLine}`,source:"drift",file:e.path,severity:"advisory"});u.filter(e=>e.source==="drift").length===0&&u.push({message:t,source:"drift",severity:"advisory"});}if(o&&o.usedButUndeclaredCount>0){let t=`${o.usedButUndeclaredCount} gate(s) used in code but not declared in portal.yaml: ${o.usedButUndeclared.join(", ")}`;i.push(t);for(let e of o.usedButUndeclared)u.push({message:`Gate ^${e} used in code but not declared in portal.yaml`,source:"portal",file:"portal.yaml",severity:"blocking"});}let d=null;s.learn&&(d=await j(l));let h={habits:g,drift:r,portal:o,violations:i,structuredViolations:u,postflight:s.learn?d:void 0};if(s.json)console.log(JSON.stringify(h));else {if(console.log(n.magenta(`
|
|
5
5
|
Paradigm Compliance Check
|
|
6
6
|
`)),g){let{evaluation:t}=g,e=t.blocksCompletion?n.red:n.green;console.log(n.white(" Habits:")),console.log(` ${e(`${t.followed} followed, ${t.skipped} skipped, ${t.partial} partial`)}`),t.blockingViolations>0&&console.log(n.red(` ${t.blockingViolations} blocking violation(s)`)),console.log();}if(r&&(console.log(n.white(" Drift:")),r.healedCount>0&&console.log(n.green(` Auto-healed: ${r.healedCount} shifted anchor(s)`)),r.cleanCount>0&&console.log(n.green(` Clean: ${r.cleanCount} anchor(s)`)),r.driftedCount>0&&console.log(n.red(` Drifted: ${r.driftedCount} anchor(s)`)),r.missingCount>0&&console.log(n.yellow(` Missing: ${r.missingCount} anchor file(s)`)),console.log()),o){console.log(n.white(" Portal:"));let t=o.status==="compliant"?n.green:o.status==="warnings"?n.yellow:n.red;console.log(` Status: ${t(o.status)}`),o.usedButUndeclaredCount>0&&console.log(n.red(` ${o.usedButUndeclaredCount} undeclared gate(s)`)),console.log();}if(d){if(console.log(n.white(" Postflight Learning:")),d.journalsWritten>0){console.log(n.green(` Journals written: ${d.journalsWritten}`));for(let[t,e]of Object.entries(d.journalsByAgent))e>0&&console.log(n.gray(` ${t}: ${e} entries`));}else console.log(n.gray(" No verdicts to learn from"));d.promoted>0&&console.log(n.green(` Promoted to notebooks: ${d.promoted}`)),console.log();}if(i.length>0){console.log(n.red(` ${i.length} violation(s):`));for(let t of i)console.log(n.red(` - ${t}`));}else console.log(n.green(" All checks passed."));console.log();}i.length>0&&(process.exitCode=1);}export{A as complianceCheckCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import'./chunk-
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import*as i from'fs';import*as c from'path';var p=".paradigm/events/compliance-history.jsonl",s=10;function C(t,n){try{let e=c.join(t,p),r=c.dirname(e);i.existsSync(r)||i.mkdirSync(r,{recursive:!0});let o={timestamp:new Date().toISOString(),...n},a=JSON.stringify(o)+`
|
|
3
3
|
`;i.appendFileSync(e,a,"utf8");}catch{}}function d(t,n){try{let e=c.join(t,p);if(!i.existsSync(e))return [];let r=i.readFileSync(e,"utf8").trim().split(`
|
|
4
4
|
`).filter(o=>o.trim()).map(o=>{try{return JSON.parse(o)}catch{return null}}).filter(o=>o!==null);return n&&n>0?r.slice(-n):r}catch{return []}}function l(t){let n=t.reduce((r,o)=>r+o.checks,0),e=t.reduce((r,o)=>r+o.violations,0);return n===0?0:e/n}function g(t,n=s){let e=d(t,n);if(e.length<2)return null;let r=Math.floor(e.length/2),o=e.slice(0,r),a=e.slice(r),f=l(o),u=l(a)-f,m=.05;return u<-m?"improving":u>m?"degrading":"stable"}function h(t,n){if(!t)return "yellow";if(t==="improving")return "green";let e=0;if(n){let r=d(n,Math.ceil(s/2));e=l(r);}return t==="stable"?e===0?"green":"yellow":e>.2?"red":"orange"}function R(t,n=s){let e=g(t,n);return e?{trend:e,dot:h(e,t)}:null}export{R as getComplianceHealthSummary,g as getComplianceTrend,h as getHealthDot,C as recordComplianceSnapshot};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-
|
|
2
|
+
import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import {execSync,spawn}from'child_process';import*as c from'fs';import*as r from'path';import*as p from'os';import {fileURLToPath}from'url';import e from'chalk';var b=fileURLToPath(import.meta.url),w=r.dirname(b),a=r.join(p.homedir(),".paradigm","conductor","bin","conductor");async function k(t){let n=a$1.command("conductor");if(t.install){await C(t,n);return}let i=x(t,n);if(i){if(t.build){let o=d();if(o){l(o,t,n);let s=r.join(o,".build","release","conductor");f(s,n);return}else n.error("--build requires the Paradigm monorepo"),console.log(e.gray(" Run from inside the a-paradigm repo, or use --install to update the global binary.")),process.exit(1);}f(i,n);}}function x(t,n){if(c.existsSync(a))return a;let i=d();if(i){let o=r.join(i,".build","release","conductor");if(c.existsSync(o)||(n.info("Dev binary not found, building\u2026"),l(i,t,n),c.existsSync(o)))return o}return n.error("Conductor binary not found"),console.log(""),console.log(e.white(" To install Conductor:")),console.log(e.cyan(" cd <paradigm-repo> && paradigm conductor --install")),console.log(""),console.log(e.gray(" This builds the native binary and installs it to ~/.paradigm/conductor/bin/")),console.log(e.gray(" After that, `paradigm conductor` works from any directory.")),console.log(""),process.exit(1),null}async function C(t,n){let i=d();i||(n.error("Cannot install \u2014 not in the Paradigm monorepo"),console.log(e.gray(" Run this command from inside the a-paradigm repository.")),process.exit(1));let o=r.join(i,".build","release","conductor");(!c.existsSync(o)||t.build)&&l(i,t,n),c.existsSync(o)||(n.error("Build did not produce a binary"),process.exit(1));let s=r.dirname(a);c.mkdirSync(s,{recursive:true}),c.copyFileSync(o,a),c.chmodSync(a,493);let m=(c.statSync(a).size/(1024*1024)).toFixed(1);n.success(`Conductor installed (${m} MB)`),console.log(""),console.log(e.green(" \u2713 ")+e.white("Installed to ")+e.cyan("~/.paradigm/conductor/bin/conductor")),console.log(e.green(" \u2713 ")+e.white("Run ")+e.cyan("paradigm conductor")+e.white(" from any directory")),console.log("");}function l(t,n,i){i.info("Building Conductor\u2026");try{execSync("swift build -c release",{cwd:t,stdio:n.verbose?"inherit":"pipe"}),i.success("Build complete");}catch(o){i.error("Build failed");let s=o.message||"";s.includes("xcode-select")?(console.log(e.gray(" Xcode Command Line Tools are required.")),console.log(e.gray(" Install with: xcode-select --install"))):console.log(e.gray(` ${s.slice(0,200)}`)),process.exit(1);}}function f(t,n){n.info("Launching Conductor\u2026"),spawn(t,[],{detached:true,stdio:"ignore"}).unref();let o=t===a;console.log(e.cyan(`
|
|
3
3
|
Paradigm Conductor is running.`)),o&&console.log(e.gray(" Binary: ~/.paradigm/conductor/bin/conductor")),console.log(e.gray(" Look for the waveform icon in your menu bar.")),console.log(e.gray(` Quit via the menu bar icon or Cmd+Q.
|
|
4
4
|
`));}function d(){let t=r.resolve(w,"..");for(let o=0;o<5;o++){let s=r.join(t,"packages","conductor");if(c.existsSync(r.join(s,"Package.swift")))return s;t=r.dirname(t);}let n=r.join(process.cwd(),"packages","conductor");if(c.existsSync(r.join(n,"Package.swift")))return n;if(c.existsSync(r.join(process.cwd(),"Package.swift"))&&r.basename(process.cwd())==="conductor")return process.cwd();let i=process.cwd();for(let o=0;o<5;o++){i=r.dirname(i);let s=r.join(i,"packages","conductor");if(c.existsSync(r.join(s,"Package.swift")))return s}return null}export{k as conductorCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import'./chunk-
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import {z}from'zod';import*as i from'js-yaml';var p=z.enum(["web","backend","fullstack","api","cli","ml","mobile","game","embedded","devops","data","library","monorepo","custom"]),g=z.enum(["auto","claude","claude-code","cursor-cli","claude-cli","manual"]),r=z.object({name:z.string(),description:z.string(),examples:z.array(z.string()).optional()}).passthrough(),u=z.object({file:z.string().optional(),"core-tags":z.array(z.string()).optional(),"allow-suggestions":z.boolean().optional()}).passthrough(),m=z.object({overview:z.string().optional(),"how-to-use":z.array(z.string()).optional(),"update-rules":z.array(z.string()).optional()}).passthrough(),d=z.object({enforce:z.boolean().optional(),"default-level":z.enum(["debug","info","warn","error"]).optional(),"symbol-mapping":z.record(z.string(),z.string()).optional()}).passthrough(),b=z.object({pattern:z.string(),depth:z.number().optional()}),h=z.object({toolCacheTtlMs:z.number().optional()}).passthrough(),f=z.object({model:z.string().optional(),"context-window":z.number().optional()}).passthrough(),y=z.object({enabled:z.boolean().optional(),"index-file":z.string().optional(),"docs-path":z.string().optional()}).passthrough(),w=z.object({enabled:z.boolean().optional(),"auto-include":z.boolean().optional()}).passthrough(),j=z.object({version:z.string(),project:z.string(),discipline:p.optional(),"agent-provider":g.optional(),"agent-guidelines":m.optional(),"symbol-system":z.record(z.string(),r).optional(),"tag-bank":u.optional(),component_types:z.record(z.string(),z.string()).optional(),logging:d.optional(),"purpose-required":z.array(b).optional(),conventions:z.array(z.string()).optional(),workspace:z.string().optional(),limits:h.optional(),"ai-agent":f.optional(),context:y.optional(),probe:w.optional(),states:z.record(z.string(),z.unknown()).optional(),"custom-symbols":z.record(z.string(),r).optional()}).passthrough(),v=new Set(["version","project","discipline","agent-provider","agent-guidelines","symbol-system","tag-bank","component_types","logging","purpose-required","conventions","workspace","limits","ai-agent","context","probe","states","custom-symbols","docs","features","enforcement","model-resolution"]);function S(l){let s=[],e=[],t;try{t=i.load(l);}catch(n){return {valid:false,warnings:[],errors:[`YAML parse error: ${n.message}`]}}if(!t||typeof t!="object")return {valid:false,warnings:[],errors:["Config must be a YAML object"]};for(let n of Object.keys(t))v.has(n)||s.push(`Unrecognized config key: "${n}"`);let a=j.safeParse(t);if(!a.success)for(let n of a.error.issues){let c=n.path.join(".");e.push(`${c}: ${n.message}`);}return {valid:e.length===0,warnings:s,errors:e}}export{j as paradigmConfigSchema,S as validateConfig};
|