@a-company/paradigm 6.0.2 → 6.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accept-orchestration-QQISPINV.js → accept-orchestration-TIXUQQGR.js} +1 -1
- package/dist/agent-MB3H5EZA.js +33 -0
- package/dist/{agent-loader-2WJHD46U.js → agent-loader-VGBPL3TH.js} +1 -1
- package/dist/{agent-loader-YKS2PQWO.js → agent-loader-W3RQJVW7.js} +1 -1
- package/dist/{agents-suggest-HYTFMQD3.js → agents-suggest-IKY6VD2R.js} +1 -1
- package/dist/{ambient-NVKQCW2A.js → ambient-AI42BOM5.js} +2 -2
- package/dist/{ambient-BE3SQXNN.js → ambient-FNNFB4AP.js} +1 -1
- package/dist/authority-FA3HLEOA.js +2 -0
- package/dist/{chunk-TZDYIPVU.js → chunk-23T6UG73.js} +111 -27
- package/dist/{chunk-FEYOQMZ5.js → chunk-2AU5L333.js} +1 -1
- package/dist/{chunk-M3PPXJU4.js → chunk-4N56FRNE.js} +1 -1
- package/dist/{chunk-TNVWGPCE.js → chunk-6QXBXZF6.js} +1 -1
- package/dist/{chunk-WESTEMIM.js → chunk-AMLD7IYC.js} +1 -1
- package/dist/{chunk-3DZK54RU.js → chunk-DBEWOKD6.js} +32 -7
- package/dist/{chunk-VXIIVMTM.js → chunk-F6E3HW45.js} +1 -1
- package/dist/{chunk-TBWWFRL5.js → chunk-GD4F2HC6.js} +1 -1
- package/dist/{chunk-6SKSV5B2.js → chunk-IOVHF4SR.js} +1 -1
- package/dist/{chunk-M2HKWR25.js → chunk-KAFQA7HV.js} +2 -2
- package/dist/{chunk-GAFKOFAV.js → chunk-LAYBUKMB.js} +1 -1
- package/dist/{chunk-AO7ZSRME.js → chunk-TQOT2LBO.js} +2 -2
- package/dist/{chunk-PHEX6LU4.js → chunk-WXF5VFB4.js} +2 -2
- package/dist/chunk-XQLO5URP.js +11 -0
- package/dist/{compliance-BNFWQPKM.js → compliance-J3VOV445.js} +1 -1
- package/dist/{diff-MF55KQZH.js → diff-75MABOSL.js} +1 -1
- package/dist/{docs-O37YLLRN.js → docs-TSAAS4W3.js} +1 -1
- package/dist/doctor-L5XZENCF.js +2 -0
- package/dist/{hooks-TFMMMB2H.js → hooks-KUEE5KMM.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/mcp.js +1 -1
- package/dist/{migrate-Z5UQN57G.js → migrate-ZPNYDNM4.js} +1 -1
- package/dist/migration-notices-BHLEYC4T.js +4 -0
- package/dist/{nomination-engine-QPZJH6XO.js → nomination-engine-NCLTGMAK.js} +1 -1
- package/dist/{orchestrate-RID7HHHH.js → orchestrate-K4KBTBYK.js} +1 -1
- package/dist/{providers-4PXMWA7V.js → providers-TBPOE4DI.js} +1 -1
- package/dist/registry-OUTA3DXW.js +20 -0
- package/dist/reindex-IZCD2JGD.js +2 -0
- package/dist/{serve-MO35XIZE.js → serve-3FMUWW5K.js} +1 -1
- package/dist/session-tracker-HHNY6J4I.js +2 -0
- package/dist/{session-work-log-EE4UIZ33.js → session-work-log-MEJ33TYD.js} +1 -1
- package/dist/{session-work-log-4IEVE4KK.js → session-work-log-ZVVJGO7X.js} +1 -1
- package/dist/shift-WGMZGWOC.js +60 -0
- package/dist/{spawn-UH5RENSE.js → spawn-KKDDR6UR.js} +1 -1
- package/dist/{team-MGT66HZQ.js → team-2LGZQRP4.js} +1 -1
- package/dist/tools-4RRFTU5H.js +2 -0
- package/dist/university-content/notes/N-para-451-agent-routing.md +117 -0
- package/dist/university-content/notes/N-para-451-archetypes-vs-instances.md +82 -0
- package/dist/university-content/notes/N-para-451-identity-layers.md +76 -0
- package/dist/university-content/notes/N-para-451-orchestration-modes.md +85 -0
- package/dist/university-content/notes/N-para-451-paradigm-shift.md +95 -0
- package/dist/university-content/notes/N-para-451-partners-primitive.md +107 -0
- package/dist/university-content/notes/N-para-451-roster-management.md +132 -0
- package/dist/university-content/notes/N-para-451-roster-reference.md +106 -0
- package/dist/university-content/notes/N-para-451-the-team-pattern.md +87 -0
- package/dist/university-content/notes/N-para-451-tiers.md +81 -0
- package/dist/university-content/notes/N-para-451-welcome.md +55 -0
- package/dist/university-content/notes/N-para-451-what-is-an-agent.md +73 -0
- package/dist/university-content/paths/LP-para-451.yaml +69 -0
- package/dist/university-content/quizzes/Q-para-451-foundations.yaml +154 -0
- package/dist/university-content/quizzes/Q-para-451-when-to-invoke.yaml +182 -0
- package/package.json +1 -1
- package/dist/agent-X6I2YWOB.js +0 -33
- package/dist/chunk-R5ECMBIV.js +0 -11
- package/dist/doctor-IG5XM4C4.js +0 -2
- package/dist/registry-KOOKFUWD.js +0 -20
- package/dist/reindex-FWPD2VGM.js +0 -2
- package/dist/session-tracker-KGORN6B5.js +0 -2
- package/dist/shift-TVNY2CQF.js +0 -60
- package/dist/tools-QJHAVYI6.js +0 -2
- /package/dist/{chunk-IZSBGW6E.js → chunk-HXGYVS2N.js} +0 -0
- /package/dist/{platform-server-UD45NTGV.js → platform-server-ANOALDPL.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b}from'./chunk-
|
|
2
|
+
import {b}from'./chunk-IOVHF4SR.js';import'./chunk-TYWB5IQJ.js';import'./chunk-AMLD7IYC.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import'./chunk-TQOT2LBO.js';import'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as g from'path';import e from'chalk';async function u(n,s,r){let a=s?g.resolve(s):process.cwd();if(!n){r.json?console.log(JSON.stringify({error:"Orchestration ID required"})):(console.log(e.red(`
|
|
3
3
|
Orchestration ID required.`)),console.log(e.gray(`Usage: paradigm team accept <orchestration-id>
|
|
4
4
|
`)));return}let l=new b(a),o=l.getOrchestration(n);if(!o){r.json?console.log(JSON.stringify({error:"Orchestration not found",id:n})):console.log(e.red(`
|
|
5
5
|
Orchestration not found: ${n}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as p from'path';import*as R from'os';import n from'chalk';import*as m from'js-yaml';var h=p.join(R.homedir(),".paradigm","agents"),x=".paradigm/agents",$=".agent",k=".paradigm/roster.yaml";function A(e){let s=p.join(e,k);if(!a.existsSync(s))return null;try{return m.load(a.readFileSync(s,"utf8"))?.active??null}catch{return null}}function F(e,s){let c=p.join(e,k),o=p.dirname(c);a.existsSync(o)||a.mkdirSync(o,{recursive:true});let t={version:"1.0",active:s.sort()};a.writeFileSync(c,m.dump(t,{lineWidth:-1,noRefs:true}),"utf8");}function C(){if(!a.existsSync(h))return [];try{return a.readdirSync(h).filter(e=>e.endsWith($)).map(e=>e.replace($,""))}catch{return []}}var E={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"}};async function D(e={}){let s=process.cwd(),c=a$1.command("agent-list").start("Listing agent profiles",{cwd:s}),o=[];if(!e.project&&a.existsSync(h))try{let f=a.readdirSync(h).filter(r=>r.endsWith($));for(let r of f)try{let d=a.readFileSync(p.join(h,r),"utf-8"),i=m.load(d);i?.id&&o.push(i);}catch{}}catch{}let t=p.join(s,x);if(!e.global&&a.existsSync(t))try{let f=a.readdirSync(t).filter(r=>r.endsWith($));for(let r of f)try{let d=a.readFileSync(p.join(t,r),"utf-8"),i=m.load(d);if(i?.id){let g=o.findIndex(u=>u.id===i.id);g>=0?o[g]=i:o.push(i);}}catch{}}catch{}if(e.json){console.log(JSON.stringify({count:o.length,agents:o.map(T)},null,2)),c.success(`Found ${o.length} agents`);return}if(console.log(n.blue(`
|
|
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(n.blue("\u2502")+n.white.bold(" paradigm agent list ")+n.blue("\u2502")),console.log(n.blue("\u2502")+n.gray(" Persistent agent identity profiles ")+n.blue("\u2502")),console.log(n.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
|
+
`)),o.length===0){console.log(n.yellow(" No .agent profiles found.")),console.log(n.gray(` Create one: paradigm agent create <id> --global
|
|
5
|
+
`)),c.success("No agents found");return}let l=new Set(o.map(f=>f.id)),y=false;for(let f of o){let d=(f.expertise||[]).sort((i,g)=>g.confidence-i.confidence).slice(0,3).map(i=>`${i.symbol} (${(i.confidence*100).toFixed(0)}%)`).join(", ")||n.gray("none yet");if(console.log(` ${n.white.bold(f.id)} \u2014 ${n.gray(f.role)}`),console.log(` Style: ${f.personality?.style||"?"} | Risk: ${f.personality?.risk||"?"} | Verbosity: ${f.personality?.verbosity||"?"}`),console.log(` Top expertise: ${d}`),f.partners&&f.partners.length>0){let i=f.partners.map(g=>l.has(g.id)?g.id:(y=true,`${g.id}${n.yellow("*")}`));console.log(` Partners: ${i.join(", ")}`);}console.log(` Projects: ${Object.keys(f.contexts||{}).join(", ")||n.gray("none")}`),console.log("");}y&&(console.log(n.dim(" * not installed \u2014 run: paradigm agent install <id>")),console.log("")),c.success(`Listed ${o.length} agents`);}async function L(e,s={}){let c=process.cwd(),o=a$1.command("agent-show").start(`Showing agent ${e}`,{cwd:c}),t=j(c,e);if(!t){s.json?console.log(JSON.stringify({error:`Agent "${e}" not found`})):(console.log(n.red(`
|
|
6
|
+
Agent "${e}" not found.`)),console.log(n.gray(` Create: paradigm agent create ${e} --global
|
|
7
|
+
`))),o.error(`Agent ${e} not found`);return}if(s.json){console.log(JSON.stringify(t,null,2)),o.success(`Showed agent ${e}`);return}if(console.log(n.blue(`
|
|
8
|
+
\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(n.blue("\u2502")+n.white.bold(` Agent: ${e}`.padEnd(50))+n.blue("\u2502")),console.log(n.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
|
|
9
|
+
`)),console.log(` ${n.white.bold("Role:")} ${t.role}`),console.log(` ${n.white.bold("Description:")} ${t.description}`),console.log(` ${n.white.bold("Version:")} ${t.version}`),console.log(` ${n.white.bold("Created:")} ${t.created}`),console.log(` ${n.white.bold("Updated:")} ${t.updated}`),console.log(""),t.personality){let d=t.personality;console.log(` ${n.white.bold("Personality")}`),console.log(` Style: ${d.style} | Risk: ${d.risk} | Verbosity: ${d.verbosity}`),console.log("");}if(t.partners&&t.partners.length>0){let d=O(c),i=new Set(d.map(g=>g.id));console.log(` ${n.white.bold("Partners")} (${t.partners.length})`);for(let g of t.partners){if(!i.has(g.id)){console.log(` ${g.id} ${n.yellow("(not installed)")} ${n.dim("\u2014 paradigm agent install "+g.id)}`);continue}let b=d.find(w=>w.id===g.id)?.partners?.some(w=>w.id===t.id)??false;console.log(b?` ${g.id} ${n.green("\u2713 reciprocal")}${g.relation?n.dim(` \u2014 ${g.relation}`):""}`:` ${g.id} ${n.yellow("\u26A0 pending")} ${n.dim(`(${g.id} does not list ${t.id})`)}`);}console.log("");}let l=(t.expertise||[]).sort((d,i)=>i.confidence-d.confidence);if(l.length>0){console.log(` ${n.white.bold("Expertise")} (${l.length} symbols)`),console.log(` ${"Symbol".padEnd(30)} ${"Confidence".padEnd(12)} ${"Sessions".padEnd(10)} Last Touch`),console.log(` ${"-".repeat(70)}`);for(let d of l.slice(0,20)){let i=`${(d.confidence*100).toFixed(0)}%`.padEnd(12),g=String(d.sessions).padEnd(10),u=d.lastTouch?d.lastTouch.split("T")[0]:"\u2014";console.log(` ${d.symbol.padEnd(30)} ${i} ${g} ${u}`);}l.length>20&&console.log(n.gray(` ... and ${l.length-20} more`)),console.log("");}else console.log(n.gray(" No expertise recorded. Run `paradigm agent sync` to bootstrap from lore.\n"));let y=t.transferable||[];if(y.length>0){console.log(` ${n.white.bold("Transferable Patterns")} (${y.length})`);for(let d of y)console.log(` ${d.id}: ${(d.successRate*100).toFixed(0)}% success \u2014 ${d.description}`),console.log(n.gray(` Learned in: ${d.learnedIn} | Applied in: ${d.appliedIn.join(", ")||"none"}`));console.log("");}let f=Object.entries(t.contexts||{});if(f.length>0){console.log(` ${n.white.bold("Project Contexts")} (${f.length})`);for(let[d,i]of f)console.log(` ${n.white(d)}: ${i.sessionsInProject||0} sessions, last active ${i.lastActive?.split("T")[0]||"\u2014"}`),i.defaultModel&&console.log(` Model: ${i.defaultModel}`),i.focus?.length&&console.log(` Focus: ${i.focus.join(", ")}`);console.log("");}let r=t.permissions;r&&(console.log(` ${n.white.bold("Permissions")}`),r.paths?.read?.length&&console.log(` Read: ${r.paths.read.join(", ")}`),r.paths?.write?.length&&console.log(` Write: ${r.paths.write.join(", ")}`),r.paths?.deny?.length&&console.log(` Deny: ${n.red(r.paths.deny.join(", "))}`),r.tools?.allow?.length&&console.log(` Tools allow: ${r.tools.allow.join(", ")}`),r.tools?.deny?.length&&console.log(` Tools deny: ${n.red(r.tools.deny.join(", "))}`),r.dangerous_actions?.length&&console.log(` Requires approval: ${r.dangerous_actions.join(", ")}`),console.log("")),o.success(`Showed agent ${e}`);}async function W(e,s={}){let c=process.cwd(),o=s.global?"global":"project",t=a$1.command("agent-create").start(`Creating agent ${e} (${o})`,{cwd:c}),l=o==="global"?h:p.join(c,x);a.existsSync(l)||a.mkdirSync(l,{recursive:true});let y=p.join(l,`${e}${$}`);if(a.existsSync(y)){console.log(n.yellow(`
|
|
10
|
+
Agent "${e}" already exists at ${y}`)),console.log(n.gray(" Use `paradigm agent show` to view.\n")),t.error("Agent already exists");return}let f=new Date().toISOString(),r=E[e]||{style:"deliberate",risk:"balanced",verbosity:"concise"},d={id:e,role:s.role||`${e.charAt(0).toUpperCase()+e.slice(1)} agent`,description:s.description||`Persistent identity for the ${e} agent role`,version:"1.0.0",personality:r,expertise:[],transferable:[],contexts:{},created:f,updated:f};if(s.denyPaths){let g=s.denyPaths.split(",").map(u=>u.trim());d.permissions={paths:{deny:g}};}let i=m.dump(d,{lineWidth:120,noRefs:true,sortKeys:false});a.writeFileSync(y,i,"utf-8"),console.log(n.green(`
|
|
11
|
+
\u2713 Created agent "${e}" at ${y}`)),console.log(n.gray(" Run `paradigm agent sync` to bootstrap expertise from lore.\n")),t.success(`Created agent ${e}`);}async function M(e,s={}){let c=process.cwd(),o=a$1.command("agent-sync").start(`Syncing expertise for ${e}`,{cwd:c}),t=p.join(c,".paradigm","lore","entries");if(!a.existsSync(t)){console.log(n.yellow(`
|
|
12
|
+
No lore directory found. Nothing to sync from.
|
|
13
|
+
`)),o.error("No lore found");return}let l=j(c,e);if(!l){if(s.dryRun){console.log(n.yellow(`
|
|
14
|
+
Agent "${e}" not found. Would create with --no-dry-run.
|
|
15
|
+
`)),o.success("Dry run \u2014 would create");return}let g=(a.existsSync(p.join(h,`${e}${$}`))?"global":"project")==="global"?h:p.join(c,x);a.existsSync(g)||a.mkdirSync(g,{recursive:true});let u=new Date().toISOString(),b=E[e]||{style:"deliberate",risk:"balanced",verbosity:"concise"};l={id:e,role:`${e.charAt(0).toUpperCase()+e.slice(1)} agent`,description:`Persistent identity for the ${e} agent role`,version:"1.0.0",personality:b,expertise:[],transferable:[],contexts:{},created:u,updated:u};}let y=l.expertise||[],f=0,r=new Set,d=I(t);for(let i of d)if(!(!i.symbols_touched||i.symbols_touched.length===0)){f++;for(let g of i.symbols_touched){r.add(g);let u=y.find(b=>b.symbol===g);u?(u.sessions++,u.lastTouch=i.timestamp||u.lastTouch,i.confidence!=null&&(u.confidence=.7*u.confidence+.3*i.confidence)):y.push({symbol:g,confidence:i.confidence??.5,sessions:1,lastTouch:i.timestamp||new Date().toISOString()});}}if(l.expertise=y,s.json)console.log(JSON.stringify({agentId:e,entriesProcessed:f,symbolsUpdated:r.size,dryRun:!!s.dryRun,topExpertise:y.sort((i,g)=>g.confidence-i.confidence).slice(0,10)},null,2));else if(console.log(n.blue(`
|
|
16
|
+
Syncing expertise for "${e}" from ${f} lore entries...`)),console.log(` ${n.green("\u2713")} ${r.size} symbols updated`),console.log(` ${n.green("\u2713")} ${f} entries processed`),y.length>0){console.log(`
|
|
17
|
+
Top expertise:`);for(let i of y.sort((g,u)=>u.confidence-g.confidence).slice(0,5))console.log(` ${i.symbol}: ${(i.confidence*100).toFixed(0)}% (${i.sessions} sessions)`);}if(s.dryRun)s.json||console.log(n.yellow(`
|
|
18
|
+
Dry run \u2014 no changes written.
|
|
19
|
+
`));else {l.updated=new Date().toISOString();let i=p.join(c,x,`${e}${$}`),g=p.join(h,`${e}${$}`),u=a.existsSync(i)?"project":"global",b=u==="global"?h:p.join(c,x);a.existsSync(b)||a.mkdirSync(b,{recursive:true});let w=u==="global"?g:i;a.writeFileSync(w,m.dump(l,{lineWidth:120,noRefs:true,sortKeys:false}),"utf-8"),s.json||console.log(n.green(`
|
|
20
|
+
\u2713 Saved to ${w}
|
|
21
|
+
`));}o.success(`Synced ${r.size} symbols from ${f} entries`);}async function U(e={}){let s=process.cwd(),c=a$1.command("agent-roster").start("Agent roster",{cwd:s}),o=[];if(a.existsSync(h))for(let r of a.readdirSync(h).filter(d=>d.endsWith($)))try{let d=m.load(a.readFileSync(p.join(h,r),"utf-8"));d?.id&&o.push(d);}catch{}let t=p.join(s,x);if(a.existsSync(t))for(let r of a.readdirSync(t).filter(d=>d.endsWith($)))try{let d=m.load(a.readFileSync(p.join(t,r),"utf-8"));if(d?.id){let i=o.findIndex(g=>g.id===d.id);i>=0?o[i]=d:o.push(d);}}catch{}let l=A(s),y=l?o.filter(r=>l.includes(r.id)):o,f=l?o.filter(r=>!l.includes(r.id)):[];if(e.json){console.log(JSON.stringify({active:y.map(r=>v(r,false)),benched:f.map(r=>v(r,true))},null,2)),c.success(`${y.length} active, ${f.length} benched`);return}if(console.log(n.blue(`
|
|
22
|
+
\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(n.blue("\u2502")+n.white.bold(" Agent Roster ")+n.blue("\u2502")),console.log(n.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
|
|
23
|
+
`)),y.length>0){console.log(n.green.bold(" Active"));for(let r of y)P(r);}if(f.length>0){console.log(n.gray.bold(`
|
|
24
|
+
Benched`));for(let r of f)P(r,true);}o.length===0?console.log(n.yellow(` No agents found.
|
|
25
|
+
`)):console.log(""),c.success(`${y.length} active, ${f.length} benched`);}function P(e,s=false){let c=(e.expertise||[]).sort((r,d)=>d.confidence-r.confidence),o=c[0]?`${c[0].symbol} (${(c[0].confidence*100).toFixed(0)}%)`:n.gray("\u2014"),t=s?n.gray:n.white,l=e.nickname?` (${e.nickname})`:"",y=e.attention?.threshold,f=y!=null?` | thr: ${y.toFixed(2)}`:"";console.log(` ${t.bold(e.id)}${n.gray(l)} \u2014 ${n.gray(e.role)}`),console.log(` Top: ${o} | ${c.length} symbols${f}`);}function v(e,s=false){let c=(e.expertise||[]).sort((o,t)=>t.confidence-o.confidence);return {id:e.id,role:e.role,nickname:e.nickname,benched:s,expertiseCount:c.length,topExpertise:c.slice(0,3).map(o=>({symbol:o.symbol,confidence:parseFloat(o.confidence.toFixed(2))})),threshold:e.attention?.threshold}}async function J(e){let s=process.cwd(),c=a$1.command("agent-bench").start(`Benching agent ${e}`,{cwd:s}),o=j(s,e);if(!o){console.log(n.red(`
|
|
26
|
+
Agent "${e}" not found.
|
|
27
|
+
`)),c.error("Not found");return}let t=A(s);t?t=t.filter(l=>l!==o.id):t=C().filter(l=>l!==o.id),F(s,t),console.log(n.yellow(`
|
|
28
|
+
Agent "${o.id}" removed from this project's roster.`)),console.log(n.gray(` Maestro will skip this agent during orchestration. Still available globally.
|
|
29
|
+
`)),c.success(`Benched ${o.id} (roster: ${t.length} active)`);}async function z(e){let s=process.cwd(),c=a$1.command("agent-activate").start(`Activating agent ${e}`,{cwd:s}),o=j(s,e);if(!o){console.log(n.red(`
|
|
30
|
+
Agent "${e}" not found.
|
|
31
|
+
`)),c.error("Not found");return}let t=A(s);if(t)t.includes(o.id)||t.push(o.id);else {let l=C();t=l.includes(o.id)?l:[...l,o.id];}F(s,t),console.log(n.green(`
|
|
32
|
+
\u25B6 Agent "${o.id}" added to this project's roster.`)),console.log(n.gray(` Maestro will include this agent in orchestration. Roster is per-project.
|
|
33
|
+
`)),c.success(`Activated ${o.id} (roster: ${t.length} active)`);}function j(e,s){let c=p.join(e,x,`${s}${$}`);if(a.existsSync(c))try{return m.load(a.readFileSync(c,"utf-8"))}catch{}let o=p.join(h,`${s}${$}`);if(a.existsSync(o))try{return m.load(a.readFileSync(o,"utf-8"))}catch{}return null}function O(e){let s=[],c=new Set;if(a.existsSync(h))try{for(let t of a.readdirSync(h).filter(l=>l.endsWith($)))try{let l=m.load(a.readFileSync(p.join(h,t),"utf-8"));l?.id&&!c.has(l.id)&&(s.push(l),c.add(l.id));}catch{}}catch{}let o=p.join(e,x);if(a.existsSync(o))try{for(let t of a.readdirSync(o).filter(l=>l.endsWith($)))try{let l=m.load(a.readFileSync(p.join(o,t),"utf-8"));if(l?.id){let y=s.findIndex(f=>f.id===l.id);y>=0?s[y]=l:(s.push(l),c.add(l.id));}}catch{}}catch{}return s}function T(e){return {id:e.id,role:e.role,personality:e.personality,expertiseCount:(e.expertise||[]).length,topExpertise:(e.expertise||[]).sort((s,c)=>c.confidence-s.confidence).slice(0,3).map(s=>({symbol:s.symbol,confidence:parseFloat(s.confidence.toFixed(2))})),projectContexts:Object.keys(e.contexts||{}),transferableCount:(e.transferable||[]).length}}function I(e){let s=[];try{let c=a.readdirSync(e,{withFileTypes:!0});for(let o of c){if(!o.isDirectory())continue;let t=p.join(e,o.name);try{let l=a.readdirSync(t).filter(y=>y.endsWith(".yaml")||y.endsWith(".yml"));for(let y of l)try{let f=a.readFileSync(p.join(t,y),"utf-8"),r=m.load(f);r?.symbols_touched&&Array.isArray(r.symbols_touched)&&s.push({symbols_touched:r.symbols_touched,confidence:typeof r.confidence=="number"?r.confidence:void 0,timestamp:r.timestamp||o.name});}catch{}}catch{}}}catch{}return s}export{z as agentActivateCommand,J as agentBenchCommand,W as agentCreateCommand,D as agentListCommand,U as agentRosterCommand,L as agentShowCommand,M as agentSyncCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-
|
|
2
|
+
export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-GD4F2HC6.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {z}from'./chunk-
|
|
2
|
+
import {z}from'./chunk-KAFQA7HV.js';export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';z();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a}from'./chunk-TYWB5IQJ.js';import {e}from'./chunk-
|
|
2
|
+
import {a}from'./chunk-TYWB5IQJ.js';import {e}from'./chunk-TQOT2LBO.js';import'./chunk-5TAVYPOV.js';import o from'chalk';async function y(s,g){let r=process.cwd(),t=e(r);t||(g.json?console.log(JSON.stringify({error:"No agents.yaml found"})):console.log(o.red("\nNo agents.yaml found. Run `paradigm team init` first.\n")),process.exit(1));let e$1=a(s,t.agents);if(g.json){console.log(JSON.stringify({task:s,suggestions:e$1},null,2));return}if(console.log(o.cyan(`
|
|
3
3
|
Suggested agents for this task:
|
|
4
4
|
`)),console.log(o.gray(` Task: "${s}"
|
|
5
5
|
`)),e$1.length===0){console.log(o.yellow(` No agents matched. Consider using architect \u2192 builder flow.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {f,p as p$1,i,c as c$1,j}from'./chunk-
|
|
2
|
+
import {f,p as p$1,i,c as c$1,j}from'./chunk-GD4F2HC6.js';import {e,b as b$2,f as f$1}from'./chunk-F6E3HW45.js';import {b as b$3}from'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.js';import {c,b as b$1,d,a}from'./chunk-5TAVYPOV.js';import*as p from'fs';import*as b from'path';import*as T from'js-yaml';import*as Z from'os';var kt={};c(kt,{getJournalStats:()=>se,loadAllJournalEntries:()=>re,loadJournalEntries:()=>O,loadJournalEntry:()=>ie,recordJournalEntry:()=>V});function G(e){let t=process.env.HOME||process.env.USERPROFILE||"";return b.join(t,".paradigm","agents",e,"journal")}function oe(){let e=new Date,t=e.toISOString().slice(0,10),n=e.toISOString().slice(11,19).replace(/:/g,""),o=String(Math.floor(Math.random()*999)+1).padStart(3,"0");return `LJ-${t}-${n}-${o}`}function V(e,t){let n=new Date,o=oe(),r={id:o,agent:e,timestamp:n.toISOString(),...t},i=G(e);p.mkdirSync(i,{recursive:true});let s=b.join(i,`${o}.yaml`);return p.writeFileSync(s,T.dump(r,{lineWidth:120,noRefs:true}),"utf8"),r}function O(e,t){let n=G(e);if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n).filter(s=>s.endsWith(".yaml"));for(let s of r)try{let a=p.readFileSync(b.join(n,s),"utf8"),c=T.load(a);c&&c.id&&o.push(c);}catch{}let i=o;return t?.trigger&&(i=i.filter(s=>s.trigger===t.trigger)),t?.project&&(i=i.filter(s=>s.project===t.project)),t?.transferable!==void 0&&(i=i.filter(s=>s.transferable===t.transferable)),t?.tag&&(i=i.filter(s=>s.tags?.some(a=>a.startsWith(t.tag)))),t?.dateFrom&&(i=i.filter(s=>s.timestamp>=t.dateFrom)),t?.dateTo&&(i=i.filter(s=>s.timestamp<=t.dateTo)),i.sort((s,a)=>a.timestamp.localeCompare(s.timestamp)),t?.limit&&(i=i.slice(0,t.limit)),i}function ie(e,t){let n=G(e),o=b.join(n,`${t}.yaml`);if(!p.existsSync(o))return null;let r=p.readFileSync(o,"utf8");return T.load(r)}function re(e){let t=process.env.HOME||process.env.USERPROFILE||"",n=b.join(t,".paradigm","agents");if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n,{withFileTypes:true}).filter(i=>i.isDirectory());for(let i of r){if(e?.agent&&i.name!==e.agent)continue;let s=O(i.name,e);o.push(...s);}return o.sort((i,s)=>s.timestamp.localeCompare(i.timestamp)),e?.limit?o.slice(0,e.limit):o}function se(e){let t=O(e),n={},o={},r=0;for(let i of t)n[i.trigger]=(n[i.trigger]||0)+1,o[i.project]=(o[i.project]||0)+1,i.transferable&&r++;return {total:t.length,byTrigger:n,byProject:o,transferableCount:r,recentInsights:t.slice(0,5).map(i=>({id:i.id,trigger:i.trigger,insight:i.insight.slice(0,200),timestamp:i.timestamp}))}}var K=b$1(()=>{});var Tt={};c(Tt,{addNotebookEntry:()=>Rt,classifyNotebookScope:()=>$t,incrementApplied:()=>de,loadNotebookEntries:()=>Nt,promoteFromLore:()=>le,searchNotebooks:()=>ce});function Nt(e,t,n){let o=new Map,r=b.join(X,e);xt(r,o);let i=b.join(t,Y,e);xt(i,o);let s=Array.from(o.values());if(n?.concepts&&n.concepts.length>0){let a=new Set(n.concepts.map(c=>c.toLowerCase()));s=s.filter(c=>c.concepts.some(u=>a.has(u.toLowerCase())));}if(n?.tags&&n.tags.length>0){let a=new Set(n.tags.map(c=>c.toLowerCase()));s=s.filter(c=>c.tags.some(u=>a.has(u.toLowerCase())));}return s.sort((a,c)=>c.appliedCount-a.appliedCount)}function xt(e,t){if(p.existsSync(e))try{let n=p.readdirSync(e).filter(o=>o.startsWith(ae)&&o.endsWith(Q));for(let o of n)try{let r=p.readFileSync(b.join(e,o),"utf-8"),i=T.load(r);i?.id&&t.set(i.id,i);}catch{}}catch{}}function ce(e,t,n){let o=Nt(e,n),r=t.toLowerCase();return o.filter(i=>i.context.toLowerCase().includes(r)||i.snippet.toLowerCase().includes(r)||i.concepts.some(s=>s.toLowerCase().includes(r))||i.tags.some(s=>s.toLowerCase().includes(r)))}function $t(e){let t=[e.context,e.snippet,...e.concepts,...e.tags].join(" ").toLowerCase();return ["paradigm","mcp_","mcp tool",".paradigm/","lore entry","lore record","aspect","^gate","portal.yaml",".purpose","sentinel","symphony","ambient nomination","paradigm_"," pan ","agent notebook","concept anchor","symbol system","work log","knowledge stream","nevr.land","neverland"].some(o=>t.includes(o))?"platform-specific":/[#$^!~][a-z][a-z0-9-]{2,}/.test(t)||/\/[a-z0-9_-]{2,}\/[a-z0-9_-]/.test(t)?"project-specific":"generalizable"}function Rt(e,t,n,o){let r=new Date().toISOString(),i=(t.concepts[0]||t.context.split(" ").slice(0,4).join(" ")||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),a=`nb-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}-${i}`,c=t.scope??$t({context:t.context,snippet:t.snippet,concepts:t.concepts,tags:t.tags}),u={...t,id:a,scope:c,publishable:t.publishable??true,appliedCount:0,created:r,updated:r},d=n==="global"?b.join(X,e):b.join(o||process.cwd(),Y,e);p.existsSync(d)||p.mkdirSync(d,{recursive:true});let l=`${a}${Q}`,m=b.join(d,l),g=T.dump(u,{lineWidth:120,noRefs:true,sortKeys:false});return p.writeFileSync(m,g,"utf-8"),{entry:u,filePath:m}}async function le(e,t,n,o="global"){let{loadLoreEntry:r}=await import('./lore-loader-D2ISOASW.js'),i=await r(n,t);if(!i)return null;let s=[];if(i.symbols_touched)for(let u of i.symbols_touched){let d=u.replace(/^[#$^!~]/,"").toLowerCase();s.push(d);}let a=i.summary||"";i.body&&(a+=`
|
|
3
3
|
|
|
4
4
|
`+i.body);let c={source:"lore",loreEntryId:t,originProject:b.basename(n),createdBy:e};return Rt(e,{context:i.title||`Promoted from ${t}`,snippet:a,provenance:c,confidence:i.confidence??.7,concepts:s,tags:i.tags||[]},o,n)}function de(e,t,n){let o=b.join(n,Y,e),r=b.join(X,e);for(let i of [o,r]){let s=b.join(i,`${t}${Q}`);if(p.existsSync(s))try{let a=p.readFileSync(s,"utf-8"),c=T.load(a);if(c)return c.appliedCount=(c.appliedCount||0)+1,c.updated=new Date().toISOString(),p.writeFileSync(s,T.dump(c,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),!0}catch{}}return false}var X,Y,ae,Q,Pt=b$1(()=>{X=b.join(Z.homedir(),".paradigm","notebooks"),Y=".paradigm/notebooks",ae="nb-",Q=".yaml";});var ht=".paradigm/events",Yt="stream.jsonl",J=1e3,$=[];function bt(e){return b.join(e,ht,Yt)}function Qt(){let e=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `ev-${e}-${t}`}function M(e,t){let n={id:Qt(),timestamp:new Date().toISOString(),...t};$.push(n),$.length>J&&($=$.slice(-J));try{let o=b.join(e,ht);p.mkdirSync(o,{recursive:!0});let r=bt(e);p.appendFileSync(r,JSON.stringify(n)+`
|
|
5
5
|
`,"utf8"),Zt(r);}catch{}return n}function Zt(e){try{if(p.statSync(e).size>512*1024){let o=p.readFileSync(e,"utf8").trim().split(`
|
|
@@ -31,5 +31,5 @@ import {f,p as p$1,i,c as c$1,j}from'./chunk-TBWWFRL5.js';import {e,b as b$2,f a
|
|
|
31
31
|
`,"utf8");}else p.writeFileSync(g,y,"utf8");break}}}}catch{}}catch{}return {promoted:a.length,entries:a}}var xe=".paradigm/surfacing.yaml";function Ht(e){let t=b.join(e,xe),n={default_min_urgency:"low",enable_debates:true};if(!p.existsSync(t))return n;try{let o=a("js-yaml"),r=p.readFileSync(t,"utf8"),i=o.load(r);return {...n,...i}}catch{return n}}function Bt(e,t){let n={critical:0,high:1,medium:2,low:3},o=n[t.default_min_urgency||"low"]??3;return e.filter(r=>{let i=n[r.urgency]??3;if(t.preferences){let s=t.preferences.find(a=>a.agent===r.agent);if(s){if(s.always_show)return true;if(s.mute_unless?.length&&!s.mute_unless.some(c=>r.urgency===c||r.type===c))return false;if(s.min_urgency){let a=n[s.min_urgency]??3;return i<=a}}}return i<=o})}var De=".paradigm/decisions";function Wt(e,t){let n=b.join(e,De);if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n).filter(s=>s.endsWith(".yaml"));for(let s of r)try{let a=p.readFileSync(b.join(n,s),"utf8"),c=T.load(a);c&&c.id&&o.push(c);}catch{}let i=o;return (i=i.filter(s=>s.status===t.status)),t?.participant&&(i=i.filter(s=>s.participants.some(a=>a.id===t.participant))),t?.symbol&&(i=i.filter(s=>s.symbols_affected?.includes(t.symbol))),t?.tag&&(i=i.filter(s=>s.tags?.some(a=>a.startsWith(t.tag)))),t?.dateFrom&&(i=i.filter(s=>s.timestamp>=t.dateFrom)),t?.dateTo&&(i=i.filter(s=>s.timestamp<=t.dateTo)),i.sort((s,a)=>a.timestamp.localeCompare(s.timestamp)),t?.limit&&(i=i.slice(0,t.limit)),i}K();function Ye(){return [{name:"paradigm_ambient_nominations",description:"Get pending agent nominations \u2014 agents that self-nominated contributions based on recent events. Filters by urgency, agent, pending status. Marks returned nominations as surfaced. ~200 tokens.",inputSchema:{type:"object",properties:{urgency:{type:"string",enum:["critical","high","medium","low"],description:"Filter by urgency level"},agent:{type:"string",description:"Filter by agent ID"},pending_only:{type:"boolean",description:"Only show un-engaged nominations (default: true)"},include_debates:{type:"boolean",description:"Include debate groupings (default: false)"},limit:{type:"number",description:"Max nominations to return (default: 20)"}}},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_events",description:"Query the ambient event stream \u2014 recent tool calls, file edits, gate checks, and other project activity. Filters by type, source, symbol, agent, time window. ~200 tokens.",inputSchema:{type:"object",properties:{type:{type:"string",description:'Event type filter (e.g., "file-modified", "gate-checked", "decision-made")'},source:{type:"string",description:'Event source filter (e.g., "mcp-tool-call", "post-write-hook")'},symbol:{type:"string",description:"Filter events referencing this symbol"},agent:{type:"string",description:"Filter events from this agent"},since:{type:"string",description:'Relative time filter (e.g., "1h", "30m", "2d") or ISO timestamp'},limit:{type:"number",description:"Max events to return (default: 50)"}}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_engage",description:"Accept, dismiss, or defer a nomination. Optionally resolves a debate by choosing this nomination over others. ~50 tokens.",inputSchema:{type:"object",properties:{nomination_id:{type:"string",description:"Nomination ID to engage with"},response:{type:"string",enum:["accepted","dismissed","deferred"],description:"How to respond"},resolve_debate:{type:"string",description:"Optional debate ID to resolve by choosing this nomination"},reason:{type:"string",description:"Reason for response \u2014 stored on nomination for learning feedback. Especially valuable for dismissals."}},required:["nomination_id","response"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_context_compose",description:"Compose full agent session context: profile enrichment + recent decisions + transferable journal entries + pending nominations. Returns a markdown context block for prompt injection. ~300 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID to compose context for"},symbols:{type:"array",items:{type:"string"},description:"Relevant symbols for expertise filtering"},include_nominations:{type:"boolean",description:"Include pending nominations (default: true)"},include_decisions:{type:"boolean",description:"Include recent team decisions (default: true)"},include_journal:{type:"boolean",description:"Include transferable journal entries (default: true)"},max_decisions:{type:"number",description:"Max decisions to include (default: 5)"},max_journal:{type:"number",description:"Max journal entries to include (default: 5)"}},required:["agent"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_promote",description:"Auto-promote high-confidence pattern discoveries from an agent's learning journal to its notebook. Promotes entries with trigger=pattern_discovered and confidence_after >= 0.8. ~100 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID whose journal to scan"}},required:["agent"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_learn",description:"Analyze an agent's nomination acceptance/dismissal history and adjust its attention threshold. If >60% dismissed \u2192 raise threshold (less noise). If >80% accepted \u2192 lower threshold (contribute more). Also returns engagement stats. ~100 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID to analyze and adjust"},dry_run:{type:"boolean",description:"If true, return stats without adjusting (default: false)"}},required:["agent"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_health",description:"Agent learning health metrics \u2014 aggregate learning quality across all agents: nomination acceptance rates, threshold drift, notebook counts, expertise growth, and overall health status (cold-start \u2192 accumulating \u2192 calibrating \u2192 mature).",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_learn_postflight",description:"Postflight learning pass \u2014 converts session work log verdicts into agent journal entries. Reads accepted/dismissed/revised verdicts from the session log, creates journal entries for each agent, then auto-promotes high-confidence entries to notebooks. Typically called at session end by the stop hook. ~200 tokens.",inputSchema:{type:"object",properties:{session_id:{type:"string",description:"Session ID (default: current session)"},dry_run:{type:"boolean",description:"If true, show what would be written without writing (default: false)"}}},annotations:{readOnlyHint:false,destructiveHint:false}}]}function Ne(e){let t=Date.now(),n=e.match(/^(\d+)(m|h|d)$/);if(n){let o=parseInt(n[1],10),r=n[2],i=r==="m"?o*6e4:r==="h"?o*36e5:o*864e5;return new Date(t-i).toISOString()}return e}async function Qe(e,t,n){let o=r=>JSON.stringify(r,null,2);switch(e){case "paradigm_ambient_nominations":{Mt(n.rootDir);let i=t.pending_only!==false,s=t.limit||20,a=E(n.rootDir,{agent:t.agent,urgency:t.urgency,pending_only:i,limit:s+20}),c=Ht(n.rootDir);a=Bt(a,c).slice(0,s);let u=b.join(n.rootDir,".paradigm/events/nominations.jsonl");if(p.existsSync(u))try{let l=p.readFileSync(u,"utf8"),m=new Set(a.map(f=>f.id)),g=l.trim().split(`
|
|
32
32
|
`).map(f=>{try{let y=JSON.parse(f);return m.has(y.id)?(y.surfaced=!0,JSON.stringify(y)):f}catch{return f}});p.writeFileSync(u,g.join(`
|
|
33
33
|
`)+`
|
|
34
|
-
`,"utf8");}catch{}let d={count:a.length,nominations:a.map(l=>({id:l.id,agent:l.agent,urgency:l.urgency,type:l.type,brief:l.brief,relevance:l.relevance,timestamp:l.timestamp,engaged:l.engaged,response:l.response}))};if(t.include_debates){let m=It(n.rootDir).filter(g=>!g.resolution);d.debates=m.map(g=>({id:g.id,topic:g.topic,type:g.type,nominations:g.nominations})),d.debate_count=m.length;}return {text:o(d),handled:true}}case "paradigm_ambient_events":{let r=t.since?Ne(t.since):void 0,i=t.limit||50,s=St(n.rootDir,{type:t.type,source:t.source,symbol:t.symbol,agent:t.agent,since:r,limit:i});return {text:o({count:s.length,events:s.map(a=>({id:a.id,type:a.type,source:a.source,timestamp:a.timestamp,path:a.path,symbols:a.symbols,context:a.context,agent:a.agent,tool:a.tool,severity:a.severity}))}),handled:true}}case "paradigm_ambient_engage":{let r=t.nomination_id,i=t.response,s=t.reason,a=Ct(n.rootDir,r,i,s);if(a)try{let{appendSessionWorkEntry:u,appendVerdictEntry:d}=await import('./session-work-log-
|
|
34
|
+
`,"utf8");}catch{}let d={count:a.length,nominations:a.map(l=>({id:l.id,agent:l.agent,urgency:l.urgency,type:l.type,brief:l.brief,relevance:l.relevance,timestamp:l.timestamp,engaged:l.engaged,response:l.response}))};if(t.include_debates){let m=It(n.rootDir).filter(g=>!g.resolution);d.debates=m.map(g=>({id:g.id,topic:g.topic,type:g.type,nominations:g.nominations})),d.debate_count=m.length;}return {text:o(d),handled:true}}case "paradigm_ambient_events":{let r=t.since?Ne(t.since):void 0,i=t.limit||50,s=St(n.rootDir,{type:t.type,source:t.source,symbol:t.symbol,agent:t.agent,since:r,limit:i});return {text:o({count:s.length,events:s.map(a=>({id:a.id,type:a.type,source:a.source,timestamp:a.timestamp,path:a.path,symbols:a.symbols,context:a.context,agent:a.agent,tool:a.tool,severity:a.severity}))}),handled:true}}case "paradigm_ambient_engage":{let r=t.nomination_id,i=t.response,s=t.reason,a=Ct(n.rootDir,r,i,s);if(a)try{let{appendSessionWorkEntry:u,appendVerdictEntry:d}=await import('./session-work-log-ZVVJGO7X.js'),m=E(n.rootDir,{limit:500}).find(f=>f.id===r),g={timestamp:new Date().toISOString(),type:"user-verdict",agent:m?.agent,nominationId:r,verdict:i,reason:s};u(n.rootDir,g),d(n.rootDir,g);}catch{}let c=false;return t.resolve_debate&&a&&(c=Jt(n.rootDir,t.resolve_debate,r,t.reason)),{text:o({engaged:a,nomination_id:r,response:i,debate_resolved:c||void 0}),handled:true}}case "paradigm_context_compose":{let r=t.agent,i=t.symbols||[],s=t.include_nominations!==false,a=t.include_decisions!==false,c=t.include_journal!==false,u=t.max_decisions||5,d=t.max_journal||5,l=f(n.rootDir,r);if(!l)return {text:o({error:`Agent profile not found: ${r}`}),handled:true};let m=[],g=p$1(l,i);if(g.trim()&&m.push(g),a){let f=Wt(n.rootDir,{status:"active",limit:u});if(f.length>0){m.push("## Recent Team Decisions");for(let y of f)m.push(`- **${y.title}**: ${y.decision.slice(0,150)}${y.decision.length>150?"...":""}`);m.push("");}}if(c){let f=O(r,{transferable:true,limit:d});if(f.length>0){m.push("## Transferable Insights");for(let y of f)m.push(`- [${y.trigger}] ${y.insight.slice(0,150)}${y.insight.length>150?"...":""}`);m.push("");}}if(s){let f=E(n.rootDir,{pending_only:true,limit:10});if(f.length>0){m.push("## Pending Nominations");for(let y of f)m.push(`- [${y.urgency}] ${y.brief}`);m.push("");}}return {text:o({agent:r,context:m.join(`
|
|
35
35
|
`),sections_included:{profile:true,decisions:a,journal:c,nominations:s}}),handled:true}}case "paradigm_ambient_promote":{let r=t.agent,i=ot(n.rootDir,r);return {text:o({agent:r,promoted:i.promoted,entries:i.entries}),handled:true}}case "paradigm_ambient_learn":{let r=t.agent,i=t.dry_run===true,s=nt(n.rootDir,r);if(i)return {text:o({agent:r,dry_run:true,stats:s,note:s.total<5?"Insufficient data for threshold adjustment (need 5+ engaged nominations)":`Accept rate: ${(s.acceptRate*100).toFixed(0)}% \u2014 ${s.acceptRate>.8?"would lower threshold":s.acceptRate<.4?"would raise threshold":"no adjustment needed"}`}),handled:true};let a=Lt(n.rootDir,r);return {text:o({agent:r,...a,stats:s}),handled:true}}case "paradigm_ambient_health":case "paradigm_ambient_neverland":{let r=Ut(n.rootDir);return {text:o(r),handled:true}}case "paradigm_ambient_learn_postflight":return {text:o(await Te(n.rootDir,t)),handled:true};default:return {text:`Unknown ambient tool: ${e}`,handled:false}}}var $e={accepted:"human_feedback",dismissed:"confidence_miss",revised:"correction_received"};function Re(e){try{let t=b.join(e,".paradigm","config.yaml");if(p.existsSync(t)){let o=p.readFileSync(t,"utf8").match(/project:\s*["']?([^"'\n]+)["']?/);if(o)return o[1].trim()}}catch{}return b.basename(e)}async function Te(e$1,t={}){let n=t.dry_run===true,o=Re(e$1),r=e(e$1).filter(f=>f.verdict&&f.agent),i=b$2(e$1);if(r.length===0)return {sessionEntries:i.length,agentsProcessed:[],journalsWritten:0,journalsByAgent:{},promoted:0,promotedByAgent:{},dryRun:n,details:[]};let s=new Map;for(let f of r){let y=f.agent;s.has(y)||s.set(y,[]),s.get(y).push(f);}let a=i.filter(f=>f.type==="agent-contribution"),c=new Map;for(let f of a)f.agent&&(c.has(f.agent)||c.set(f.agent,[]),c.get(f.agent).push(f));let u=[],d={},l=0;for(let[f,y]of s){d[f]=0;let D=y.filter(h=>h.verdict==="accepted").length;y.filter(h=>h.verdict==="dismissed").length;y.filter(h=>h.verdict==="revised").length;let H=y.length,zt=H>0?D/H:0;for(let h of y){let B=$e[h.verdict];if(!B)continue;let Gt=c.get(f)?.shift(),st=Pe(h,Gt,{acceptRate:zt,total:H,accepted:D}),Vt=h.verdict==="accepted"?.85:h.verdict==="revised"?.6:.4,Kt={agent:f,verdict:h.verdict,trigger:B,insight:st,symbols:h.symbols};if(u.push(Kt),n)d[f]++,l++;else try{V(f,{trigger:B,insight:st,confidence_before:h.verdict==="accepted"?.7:.8,confidence_after:Vt,project:o,transferable:h.verdict==="dismissed",tags:["postflight",`verdict:${h.verdict}`,...(h.symbols||[]).map(Xt=>`symbol:${Xt}`)]}),d[f]++,l++;}catch{}}}let m={},g=0;if(!n)for(let f of s.keys())try{let y=ot(e$1,f);y.promoted>0&&(m[f]=y.promoted,g+=y.promoted);}catch{}return !n&&r.length>0&&f$1(e$1,r.map(f=>f.nominationId).filter(Boolean)),{sessionEntries:i.length,agentsProcessed:Array.from(s.keys()),journalsWritten:l,journalsByAgent:d,promoted:g,promotedByAgent:m,dryRun:n,details:u}}function Pe(e,t,n){let o=e.symbols?.length?` (symbols: ${e.symbols.join(", ")})`:"",r=e.reason?` Reason: ${e.reason}.`:"";switch(e.verdict){case "accepted":return `Contribution accepted by user${o}.${r}`+(t?.contribution?` Original: "${t.contribution.slice(0,120)}".`:"")+` Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;case "dismissed":return `Contribution dismissed by user${o}.${r}`+(t?.contribution?` Rejected contribution: "${t.contribution.slice(0,120)}".`:"")+` Learn from this dismissal to improve future nominations. Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;case "revised":return `Contribution revised by user${o}.${r}`+(e.revisionDelta?` Delta: "${e.revisionDelta.slice(0,120)}".`:"")+(t?.contribution?` Original: "${t.contribution.slice(0,120)}".`:"")+` Partial credit \u2014 close but not accurate enough. Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;default:return `Unknown verdict "${e.verdict}"${o}.${r}`}}export{Ye as getAmbientToolsList,Qe as handleAmbientTool,Te as runPostflightLearning};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import'./chunk-5TAVYPOV.js';import*as s from'path';import t from'chalk';async function g(n){let e=n.project?s.resolve(n.project):process.cwd(),r=n.dryRun===true,{readPendingVerdicts:a}=await import('./session-work-log-
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import*as s from'path';import t from'chalk';async function g(n){let e=n.project?s.resolve(n.project):process.cwd(),r=n.dryRun===true,{readPendingVerdicts:a}=await import('./session-work-log-ZVVJGO7X.js'),i=a(e);if(i.length===0){console.log(t.dim("[paradigm] No pending verdicts \u2014 postflight skipped."));return}console.log(t.cyan(`[paradigm] Running postflight \u2014 ${i.length} pending verdict(s)${r?" (dry run)":""}...`));let{runPostflightLearning:l}=await import('./ambient-AI42BOM5.js'),o=await l(e,{dry_run:r});if(o.journalsWritten===0&&o.promoted===0){console.log(t.dim("[paradigm] Postflight complete \u2014 no new journals written."));return}console.log(t.green("[paradigm] Postflight complete:")),o.journalsWritten>0&&console.log(` ${t.bold(o.journalsWritten)} journal entries written across ${o.agentsProcessed.length} agent(s)`),o.promoted>0&&console.log(` ${t.bold(o.promoted)} entries auto-promoted to notebooks`);}export{g as ambientPostflightCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import*as t from'fs/promises';import*as i from'path';import*as s from'js-yaml';var n=i.join(".paradigm","authority.yaml");async function l(c,e){let a=i.join(c,n);try{await t.access(a);return}catch{}await t.mkdir(i.dirname(a),{recursive:true});let r=new Date().toISOString(),o=s.dump({version:"1.0",schema:"v0-experimental",claims:{"aspect-coverage":{claimant:"compliance",severity:"advise",since:r,source:e},"aspect-drift":{claimant:"compliance",severity:"advise",since:r,source:e},"anchor-staleness":{claimant:"compliance",severity:"advise",since:r,source:e}}},{lineWidth:100,sortKeys:false});await t.writeFile(a,o,"utf8");}export{l as writeArchetypeDefaults};
|