@a-company/paradigm 5.23.0 → 5.27.0
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/{agent-loader-EPXURMO7.js → agent-loader-MQMXCI3D.js} +1 -1
- package/dist/{agent-loader-PYGPX6D2.js → agent-loader-RGPE3LRD.js} +1 -1
- package/dist/{ambient-WEPHBAJD.js → ambient-2RAKMUC7.js} +2 -2
- package/dist/{chunk-V7K6CQVX.js → chunk-4YIKDQRB.js} +9 -9
- package/dist/chunk-73R63P7K.js +2 -0
- package/dist/{chunk-Z34K6GY2.js → chunk-CUOEZAVL.js} +4 -4
- package/dist/{chunk-HXKWL3VK.js → chunk-DJERXYEL.js} +1 -1
- package/dist/{chunk-4ZGGWZ32.js → chunk-HBGRP73K.js} +1 -1
- package/dist/{chunk-PUBB7LIT.js → chunk-PBVBTHGE.js} +1 -1
- package/dist/{chunk-AD5TAD2A.js → chunk-UELDOSWH.js} +1 -1
- package/dist/{chunk-6EX37L4Q.js → chunk-VZLGBGU3.js} +5 -5
- package/dist/{chunk-2QO33NYK.js → chunk-XGAOYG77.js} +2 -2
- package/dist/{chunk-XUFYOXOU.js → chunk-ZMQXXFG2.js} +2 -2
- package/dist/{compliance-TSXLXADI.js → compliance-LM2NN2S6.js} +2 -2
- package/dist/{docs-RXPN6CK7.js → docs-5BX2YWYK.js} +1 -1
- package/dist/{habits-LX5IWCZM.js → habits-GICVMTJL.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.js +24 -24
- package/dist/{nomination-engine-XF7TWPAP.js → nomination-engine-K7MQD53E.js} +1 -1
- package/dist/platform-server-G6MJIAJS.js +25 -0
- package/dist/reindex-HA3CJG7S.js +2 -0
- package/dist/{serve-JE6UF5P2.js → serve-ZJ3EXVA5.js} +1 -1
- package/dist/session-tracker-G7VOLRMR.js +2 -0
- package/dist/{session-work-log-3MNUDEZ6.js → session-work-log-HFOD7LEG.js} +1 -1
- package/dist/{session-work-log-J2H5OZBR.js → session-work-log-IEYBPFUC.js} +1 -1
- package/dist/{symphony-3QMBGCZY.js → symphony-43N4R6C2.js} +1 -1
- package/dist/{symphony-QI63XL62.js → symphony-ZQ5OHJTP.js} +3 -3
- package/dist/{symphony-loader-XACVV2E3.js → symphony-loader-XJT43FOS.js} +1 -1
- package/dist/{symphony-relay-5GY5JIPT.js → symphony-relay-KBHN3ZMR.js} +1 -1
- package/dist/university-FJ7OCOA3.js +2 -0
- package/package.json +1 -1
- package/platform-ui/dist/assets/AmbientSection-BYjt75R1.js +1 -0
- package/platform-ui/dist/assets/{CanvasSection-DLW0s-Bu.js → CanvasSection-rKvA_vZj.js} +2 -2
- package/platform-ui/dist/assets/{DocsSection-BQ9Hi51g.js → DocsSection-CI9K73M-.js} +1 -1
- package/platform-ui/dist/assets/GitSection-DSGj_c6S.js +4 -0
- package/platform-ui/dist/assets/{GraphSection-0c9C-w7K.js → GraphSection-CawN7pC5.js} +2 -2
- package/platform-ui/dist/assets/LoreSection-oO5dCe6O.js +1 -0
- package/platform-ui/dist/assets/{SentinelSection-C4OoME9U.js → SentinelSection-DNgoYMH0.js} +1 -1
- package/platform-ui/dist/assets/SymphonySection-C0zfcqv3.js +1 -0
- package/platform-ui/dist/assets/TeamSection-Bzd3Dt9Q.js +1 -0
- package/platform-ui/dist/assets/UniversitySection-B3ltVfpt.css +1 -0
- package/platform-ui/dist/assets/UniversitySection-tBr62R0S.js +1 -0
- package/platform-ui/dist/assets/{index-DPpOdAtC.js → index-BaOmyn11.js} +12 -12
- package/platform-ui/dist/index.html +1 -1
- package/dist/chunk-RMOALQJN.js +0 -2
- package/dist/platform-server-2KXHGHFV.js +0 -25
- package/dist/reindex-PGDQSM42.js +0 -2
- package/dist/session-tracker-SKOMBDOW.js +0 -2
- package/platform-ui/dist/assets/AmbientSection-DqQ2mfCO.js +0 -1
- package/platform-ui/dist/assets/GitSection-QQeUX6o3.js +0 -4
- package/platform-ui/dist/assets/LoreSection--t56kCj2.js +0 -1
- package/platform-ui/dist/assets/SymphonySection-B-rvsLxq.js +0 -1
- package/platform-ui/dist/assets/TeamSection-CBFmNEEo.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {t}from'./chunk-
|
|
2
|
+
import {t}from'./chunk-ZMQXXFG2.js';export{n as buildProfileEnrichment,p as checkPathPermission,q as checkToolPermission,r as computeIntegrityHash,i as createAgentProfile,a as decayedConfidence,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,g as loadAllAgentProfiles,b as loadProjectRoster,m as mergeAgentProfileWithManifest,j as queryExpertise,h as saveAgentProfile,d as saveProjectRoster,o as syncExpertiseFromLore,l as updateExpertiseFromAssessment,k as updateExpertiseFromLore,s as verifyIntegrity}from'./chunk-ZMQXXFG2.js';import'./chunk-5TAVYPOV.js';t();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{n as buildProfileEnrichment,p as checkPathPermission,q as checkToolPermission,r as computeIntegrityHash,i as createAgentProfile,a as decayedConfidence,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,g as loadAllAgentProfiles,b as loadProjectRoster,m as mergeAgentProfileWithManifest,j as queryExpertise,h as saveAgentProfile,d as saveProjectRoster,o as syncExpertiseFromLore,l as updateExpertiseFromAssessment,k as updateExpertiseFromLore,s as verifyIntegrity}from'./chunk-
|
|
2
|
+
export{n as buildProfileEnrichment,p as checkPathPermission,q as checkToolPermission,r as computeIntegrityHash,i as createAgentProfile,a as decayedConfidence,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,g as loadAllAgentProfiles,b as loadProjectRoster,m as mergeAgentProfileWithManifest,j as queryExpertise,h as saveAgentProfile,d as saveProjectRoster,o as syncExpertiseFromLore,l as updateExpertiseFromAssessment,k as updateExpertiseFromLore,s as verifyIntegrity}from'./chunk-XGAOYG77.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import {f as f$1,n,g,h}from'./chunk-XGAOYG77.js';import {b as b$2}from'./chunk-PBVBTHGE.js';import {c,b as b$1,d,a}from'./chunk-5TAVYPOV.js';import*as f from'fs';import*as b from'path';import*as P from'js-yaml';import*as Q from'os';var vt={};c(vt,{getJournalStats:()=>ne,loadAllJournalEntries:()=>ee,loadJournalEntries:()=>O,loadJournalEntry:()=>te,recordJournalEntry:()=>z});function G(n){let t=process.env.HOME||process.env.USERPROFILE||"";return b.join(t,".paradigm","agents",n,"journal")}function Zt(){let n=new Date,t=n.toISOString().slice(0,10),e=n.toISOString().slice(11,19).replace(/:/g,""),o=String(Math.floor(Math.random()*999)+1).padStart(3,"0");return `LJ-${t}-${e}-${o}`}function z(n,t){let e=new Date,o=Zt(),i={id:o,agent:n,timestamp:e.toISOString(),...t},r=G(n);f.mkdirSync(r,{recursive:true});let s=b.join(r,`${o}.yaml`);return f.writeFileSync(s,P.dump(i,{lineWidth:120,noRefs:true}),"utf8"),i}function O(n,t){let e=G(n);if(!f.existsSync(e))return [];let o=[],i=f.readdirSync(e).filter(s=>s.endsWith(".yaml"));for(let s of i)try{let a=f.readFileSync(b.join(e,s),"utf8"),c=P.load(a);c&&c.id&&o.push(c);}catch{}let r=o;return t?.trigger&&(r=r.filter(s=>s.trigger===t.trigger)),t?.project&&(r=r.filter(s=>s.project===t.project)),t?.transferable!==void 0&&(r=r.filter(s=>s.transferable===t.transferable)),t?.tag&&(r=r.filter(s=>s.tags?.some(a=>a.startsWith(t.tag)))),t?.dateFrom&&(r=r.filter(s=>s.timestamp>=t.dateFrom)),t?.dateTo&&(r=r.filter(s=>s.timestamp<=t.dateTo)),r.sort((s,a)=>a.timestamp.localeCompare(s.timestamp)),t?.limit&&(r=r.slice(0,t.limit)),r}function te(n,t){let e=G(n),o=b.join(e,`${t}.yaml`);if(!f.existsSync(o))return null;let i=f.readFileSync(o,"utf8");return P.load(i)}function ee(n){let t=process.env.HOME||process.env.USERPROFILE||"",e=b.join(t,".paradigm","agents");if(!f.existsSync(e))return [];let o=[],i=f.readdirSync(e,{withFileTypes:true}).filter(r=>r.isDirectory());for(let r of i){if(n?.agent&&r.name!==n.agent)continue;let s=O(r.name,n);o.push(...s);}return o.sort((r,s)=>s.timestamp.localeCompare(r.timestamp)),n?.limit?o.slice(0,n.limit):o}function ne(n){let t=O(n),e={},o={},i=0;for(let r of t)e[r.trigger]=(e[r.trigger]||0)+1,o[r.project]=(o[r.project]||0)+1,r.transferable&&i++;return {total:t.length,byTrigger:e,byProject:o,transferableCount:i,recentInsights:t.slice(0,5).map(r=>({id:r.id,trigger:r.trigger,insight:r.insight.slice(0,200),timestamp:r.timestamp}))}}var K=b$1(()=>{});var Dt={};c(Dt,{addNotebookEntry:()=>xt,incrementApplied:()=>se,loadNotebookEntries:()=>Et,promoteFromLore:()=>ie,searchNotebooks:()=>re});function Et(n,t,e){let o=new Map,i=b.join(V,n);jt(i,o);let r=b.join(t,Y,n);jt(r,o);let s=Array.from(o.values());if(e?.concepts&&e.concepts.length>0){let a=new Set(e.concepts.map(c=>c.toLowerCase()));s=s.filter(c=>c.concepts.some(d=>a.has(d.toLowerCase())));}if(e?.tags&&e.tags.length>0){let a=new Set(e.tags.map(c=>c.toLowerCase()));s=s.filter(c=>c.tags.some(d=>a.has(d.toLowerCase())));}return s.sort((a,c)=>c.appliedCount-a.appliedCount)}function jt(n,t){if(f.existsSync(n))try{let e=f.readdirSync(n).filter(o=>o.startsWith(oe)&&o.endsWith(X));for(let o of e)try{let i=f.readFileSync(b.join(n,o),"utf-8"),r=P.load(i);r?.id&&t.set(r.id,r);}catch{}}catch{}}function re(n,t,e){let o=Et(n,e),i=t.toLowerCase();return o.filter(r=>r.context.toLowerCase().includes(i)||r.snippet.toLowerCase().includes(i)||r.concepts.some(s=>s.toLowerCase().includes(i))||r.tags.some(s=>s.toLowerCase().includes(i)))}function xt(n,t,e,o){let i=new Date().toISOString(),r=(t.concepts[0]||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),s=Date.now().toString(36),a=`nb-${r}-${s}`,c={...t,id:a,appliedCount:0,created:i,updated:i},d=e==="global"?b.join(V,n):b.join(o||process.cwd(),Y,n);f.existsSync(d)||f.mkdirSync(d,{recursive:true});let u=`${a}${X}`,l=b.join(d,u),m=P.dump(c,{lineWidth:120,noRefs:true,sortKeys:false});return f.writeFileSync(l,m,"utf-8"),{entry:c,filePath:l}}async function ie(n,t,e,o="global"){let{loadLoreEntry:i}=await import('./lore-loader-XY5MZRR2.js'),r=await i(e,t);if(!r)return null;let s=[];if(r.symbols_touched)for(let d of r.symbols_touched){let u=d.replace(/^[#$^!~]/,"").toLowerCase();s.push(u);}let a=r.summary||"";r.body&&(a+=`
|
|
3
3
|
|
|
4
4
|
`+r.body);let c={source:"lore",loreEntryId:t,originProject:b.basename(e),createdBy:n};return xt(n,{context:r.title||`Promoted from ${t}`,snippet:a,provenance:c,confidence:r.confidence??.7,concepts:s,tags:r.tags||[]},o,e)}function se(n,t,e){let o=b.join(e,Y,n),i=b.join(V,n);for(let r of [o,i]){let s=b.join(r,`${t}${X}`);if(f.existsSync(s))try{let a=f.readFileSync(s,"utf-8"),c=P.load(a);if(c)return c.appliedCount=(c.appliedCount||0)+1,c.updated=new Date().toISOString(),f.writeFileSync(s,P.dump(c,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),!0}catch{}}return false}var V,Y,oe,X,Rt=b$1(()=>{V=b.join(Q.homedir(),".paradigm","notebooks"),Y=".paradigm/notebooks",oe="nb-",X=".yaml";});var ft=".paradigm/events",zt="stream.jsonl",I=1e3,N=[];function gt(n){return b.join(n,ft,zt)}function Kt(){let n=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `ev-${n}-${t}`}function J(n,t){let e={id:Kt(),timestamp:new Date().toISOString(),...t};N.push(e),N.length>I&&(N=N.slice(-I));try{let o=b.join(n,ft);f.mkdirSync(o,{recursive:!0});let i=gt(n);f.appendFileSync(i,JSON.stringify(e)+`
|
|
5
5
|
`,"utf8"),Vt(i);}catch{}return e}function Vt(n){try{if(f.statSync(n).size>512*1024){let o=f.readFileSync(n,"utf8").trim().split(`
|
|
@@ -31,5 +31,5 @@ import {b as b$2}from'./chunk-PUBB7LIT.js';import {f as f$1,n,g,h}from'./chunk-2
|
|
|
31
31
|
`,"utf8");}else f.writeFileSync(y,g,"utf8");break}}}}catch{}}catch{}return {promoted:a.length,entries:a}}var ve=".paradigm/surfacing.yaml";function Jt(n){let t=b.join(n,ve),e={default_min_urgency:"low",enable_debates:true};if(!f.existsSync(t))return e;try{let o=a("js-yaml"),i=f.readFileSync(t,"utf8"),r=o.load(i);return {...e,...r}}catch{return e}}function Mt(n,t){let e={critical:0,high:1,medium:2,low:3},o=e[t.default_min_urgency||"low"]??3;return n.filter(i=>{let r=e[i.urgency]??3;if(t.preferences){let s=t.preferences.find(a=>a.agent===i.agent);if(s){if(s.always_show)return true;if(s.mute_unless?.length&&!s.mute_unless.some(c=>i.urgency===c||i.type===c))return false;if(s.min_urgency){let a=e[s.min_urgency]??3;return r<=a}}}return r<=o})}var je=".paradigm/decisions";function Lt(n,t){let e=b.join(n,je);if(!f.existsSync(e))return [];let o=[],i=f.readdirSync(e).filter(s=>s.endsWith(".yaml"));for(let s of i)try{let a=f.readFileSync(b.join(e,s),"utf8"),c=P.load(a);c&&c.id&&o.push(c);}catch{}let r=o;return (r=r.filter(s=>s.status===t.status)),t?.participant&&(r=r.filter(s=>s.participants.some(a=>a.id===t.participant))),t?.symbol&&(r=r.filter(s=>s.symbols_affected?.includes(t.symbol))),t?.tag&&(r=r.filter(s=>s.tags?.some(a=>a.startsWith(t.tag)))),t?.dateFrom&&(r=r.filter(s=>s.timestamp>=t.dateFrom)),t?.dateTo&&(r=r.filter(s=>s.timestamp<=t.dateTo)),r.sort((s,a)=>a.timestamp.localeCompare(s.timestamp)),t?.limit&&(r=r.slice(0,t.limit)),r}K();function Ge(){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_neverland",description:"Neverland Validation \u2014 aggregate learning metrics across all agents. Shows acceptance rates, threshold drift, expertise growth, notebook counts, cross-project transfer, and overall health status (cold-start \u2192 accumulating \u2192 calibrating \u2192 mature). ~200 tokens.",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 ke(n){let t=Date.now(),e=n.match(/^(\d+)(m|h|d)$/);if(e){let o=parseInt(e[1],10),i=e[2],r=i==="m"?o*6e4:i==="h"?o*36e5:o*864e5;return new Date(t-r).toISOString()}return n}async function ze(n$1,t,e){let o=i=>JSON.stringify(i,null,2);switch(n$1){case "paradigm_ambient_nominations":{Ft(e.rootDir);let r=t.pending_only!==false,s=t.limit||20,a=k(e.rootDir,{agent:t.agent,urgency:t.urgency,pending_only:r,limit:s+20}),c=Jt(e.rootDir);a=Mt(a,c).slice(0,s);let d=b.join(e.rootDir,".paradigm/events/nominations.jsonl");if(f.existsSync(d))try{let l=f.readFileSync(d,"utf8"),m=new Set(a.map(p=>p.id)),y=l.trim().split(`
|
|
32
32
|
`).map(p=>{try{let g=JSON.parse(p);return m.has(g.id)?(g.surfaced=!0,JSON.stringify(g)):p}catch{return p}});f.writeFileSync(d,y.join(`
|
|
33
33
|
`)+`
|
|
34
|
-
`,"utf8");}catch{}let u={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=$t(e.rootDir).filter(y=>!y.resolution);u.debates=m.map(y=>({id:y.id,topic:y.topic,type:y.type,nominations:y.nominations})),u.debate_count=m.length;}return {text:o(u),handled:true}}case "paradigm_ambient_events":{let i=t.since?ke(t.since):void 0,r=t.limit||50,s=yt(e.rootDir,{type:t.type,source:t.source,symbol:t.symbol,agent:t.agent,since:i,limit:r});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 i=t.nomination_id,r=t.response,s=t.reason,a=Ot(e.rootDir,i,r,s);if(a)try{let{appendSessionWorkEntry:d}=await import('./session-work-log-
|
|
34
|
+
`,"utf8");}catch{}let u={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=$t(e.rootDir).filter(y=>!y.resolution);u.debates=m.map(y=>({id:y.id,topic:y.topic,type:y.type,nominations:y.nominations})),u.debate_count=m.length;}return {text:o(u),handled:true}}case "paradigm_ambient_events":{let i=t.since?ke(t.since):void 0,r=t.limit||50,s=yt(e.rootDir,{type:t.type,source:t.source,symbol:t.symbol,agent:t.agent,since:i,limit:r});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 i=t.nomination_id,r=t.response,s=t.reason,a=Ot(e.rootDir,i,r,s);if(a)try{let{appendSessionWorkEntry:d}=await import('./session-work-log-HFOD7LEG.js'),l=k(e.rootDir,{limit:500}).find(m=>m.id===i);d(e.rootDir,{timestamp:new Date().toISOString(),type:"user-verdict",agent:l?.agent,nominationId:i,verdict:r,reason:s});}catch{}let c=false;return t.resolve_debate&&a&&(c=At(e.rootDir,t.resolve_debate,i,t.reason)),{text:o({engaged:a,nomination_id:i,response:r,debate_resolved:c||void 0}),handled:true}}case "paradigm_context_compose":{let i=t.agent,r=t.symbols||[],s=t.include_nominations!==false,a=t.include_decisions!==false,c=t.include_journal!==false,d=t.max_decisions||5,u=t.max_journal||5,l=f$1(e.rootDir,i);if(!l)return {text:o({error:`Agent profile not found: ${i}`}),handled:true};let m=[],y=n(l,r);if(y.trim()&&m.push(y),a){let p=Lt(e.rootDir,{status:"active",limit:d});if(p.length>0){m.push("## Recent Team Decisions");for(let g of p)m.push(`- **${g.title}**: ${g.decision.slice(0,150)}${g.decision.length>150?"...":""}`);m.push("");}}if(c){let p=O(i,{transferable:true,limit:u});if(p.length>0){m.push("## Transferable Insights");for(let g of p)m.push(`- [${g.trigger}] ${g.insight.slice(0,150)}${g.insight.length>150?"...":""}`);m.push("");}}if(s){let p=k(e.rootDir,{pending_only:true,limit:10});if(p.length>0){m.push("## Pending Nominations");for(let g of p)m.push(`- [${g.urgency}] ${g.brief}`);m.push("");}}return {text:o({agent:i,context:m.join(`
|
|
35
35
|
`),sections_included:{profile:true,decisions:a,journal:c,nominations:s}}),handled:true}}case "paradigm_ambient_promote":{let i=t.agent,r=nt(e.rootDir,i);return {text:o({agent:i,promoted:r.promoted,entries:r.entries}),handled:true}}case "paradigm_ambient_learn":{let i=t.agent,r=t.dry_run===true,s=et(e.rootDir,i);if(r)return {text:o({agent:i,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=Ct(e.rootDir,i);return {text:o({agent:i,...a,stats:s}),handled:true}}case "paradigm_ambient_neverland":{let i=It(e.rootDir);return {text:o(i),handled:true}}case "paradigm_ambient_learn_postflight":return {text:o(await De(e.rootDir,t)),handled:true};default:return {text:`Unknown ambient tool: ${n$1}`,handled:false}}}var Ee={accepted:"human_feedback",dismissed:"confidence_miss",revised:"correction_received"};function xe(n){try{let t=b.join(n,".paradigm","config.yaml");if(f.existsSync(t)){let o=f.readFileSync(t,"utf8").match(/project:\s*["']?([^"'\n]+)["']?/);if(o)return o[1].trim()}}catch{}return b.basename(n)}async function De(n,t={}){let e=t.dry_run===true,o=xe(n),i=b$2(n),r=i.filter(p=>p.type==="user-verdict"&&p.verdict&&p.agent);if(r.length===0)return {sessionEntries:i.length,agentsProcessed:[],journalsWritten:0,journalsByAgent:{},promoted:0,promotedByAgent:{},dryRun:e,details:[]};let s=new Map;for(let p of r){let g=p.agent;s.has(g)||s.set(g,[]),s.get(g).push(p);}let a=i.filter(p=>p.type==="agent-contribution"),c=new Map;for(let p of a)p.agent&&(c.has(p.agent)||c.set(p.agent,[]),c.get(p.agent).push(p));let d=[],u={},l=0;for(let[p,g]of s){u[p]=0;let D=g.filter(h=>h.verdict==="accepted").length;g.filter(h=>h.verdict==="dismissed").length;g.filter(h=>h.verdict==="revised").length;let B=g.length,Bt=B>0?D/B:0;for(let h of g){let H=Ee[h.verdict];if(!H)continue;let Ht=c.get(p)?.shift(),it=Re(h,Ht,{acceptRate:Bt,total:B,accepted:D}),Wt=h.verdict==="accepted"?.85:h.verdict==="revised"?.6:.4,qt={agent:p,verdict:h.verdict,trigger:H,insight:it,symbols:h.symbols};if(d.push(qt),e)u[p]++,l++;else try{z(p,{trigger:H,insight:it,confidence_before:h.verdict==="accepted"?.7:.8,confidence_after:Wt,project:o,transferable:h.verdict==="dismissed",tags:["postflight",`verdict:${h.verdict}`,...(h.symbols||[]).map(Gt=>`symbol:${Gt}`)]}),u[p]++,l++;}catch{}}}let m={},y=0;if(!e)for(let p of s.keys())try{let g=nt(n,p);g.promoted>0&&(m[p]=g.promoted,y+=g.promoted);}catch{}return {sessionEntries:i.length,agentsProcessed:Array.from(s.keys()),journalsWritten:l,journalsByAgent:u,promoted:y,promotedByAgent:m,dryRun:e,details:d}}function Re(n,t,e){let o=n.symbols?.length?` (symbols: ${n.symbols.join(", ")})`:"",i=n.reason?` Reason: ${n.reason}.`:"";switch(n.verdict){case "accepted":return `Contribution accepted by user${o}.${i}`+(t?.contribution?` Original: "${t.contribution.slice(0,120)}".`:"")+` Session accept rate: ${(e.acceptRate*100).toFixed(0)}% (${e.accepted}/${e.total}).`;case "dismissed":return `Contribution dismissed by user${o}.${i}`+(t?.contribution?` Rejected contribution: "${t.contribution.slice(0,120)}".`:"")+` Learn from this dismissal to improve future nominations. Session accept rate: ${(e.acceptRate*100).toFixed(0)}% (${e.accepted}/${e.total}).`;case "revised":return `Contribution revised by user${o}.${i}`+(n.revisionDelta?` Delta: "${n.revisionDelta.slice(0,120)}".`:"")+(t?.contribution?` Original: "${t.contribution.slice(0,120)}".`:"")+` Partial credit \u2014 close but not accurate enough. Session accept rate: ${(e.acceptRate*100).toFixed(0)}% (${e.accepted}/${e.total}).`;default:return `Unknown verdict "${n.verdict}"${o}.${i}`}}export{Ge as getAmbientToolsList,ze as handleAmbientTool,De as runPostflightLearning};
|