@tansr/cli 0.10.1 → 0.10.3
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/package.json +1 -1
- package/tansr-artifacts.json +443 -443
- package/{tansr-bg-OUP4JX3I.mjs → tansr-bg-EAYYM4XW.mjs} +2 -2
- package/{tansr-chunk-2AJTBN37.mjs → tansr-chunk-2X337GKC.mjs} +2 -2
- package/tansr-chunk-4LNN4SQL.mjs +22 -0
- package/{tansr-chunk-YAYVXUHY.mjs → tansr-chunk-5TJVZSZE.mjs} +2 -2
- package/{tansr-chunk-54YMMSEF.mjs → tansr-chunk-74H5GQTJ.mjs} +7 -7
- package/{tansr-chunk-R4W5HKDF.mjs → tansr-chunk-7T6OLLFW.mjs} +2 -2
- package/{tansr-chunk-MXYVQZY3.mjs → tansr-chunk-CJP7YEGC.mjs} +2 -2
- package/{tansr-chunk-LSGFLGLS.mjs → tansr-chunk-D7VSW2LQ.mjs} +2 -2
- package/{tansr-chunk-UAEARRRH.mjs → tansr-chunk-DN22GXHD.mjs} +2 -2
- package/{tansr-chunk-NCIMR6LB.mjs → tansr-chunk-GDJ5YVNY.mjs} +2 -2
- package/{tansr-chunk-4R5ZK4RG.mjs → tansr-chunk-GMPMRXL4.mjs} +3 -3
- package/tansr-chunk-GR6BWQGG.mjs +38 -0
- package/{tansr-chunk-S77B4PI7.mjs → tansr-chunk-HHL7HM62.mjs} +2 -2
- package/{tansr-chunk-BCOFZJWA.mjs → tansr-chunk-IZICOKKF.mjs} +9 -9
- package/{tansr-chunk-Q6MUMULP.mjs → tansr-chunk-J2LWM3S7.mjs} +2 -2
- package/{tansr-chunk-XIOD3RQD.mjs → tansr-chunk-KQVXXXEF.mjs} +2 -2
- package/{tansr-chunk-QNHXB55W.mjs → tansr-chunk-M6XHWCMA.mjs} +2 -2
- package/{tansr-chunk-TYJWMSVW.mjs → tansr-chunk-N3R2URKL.mjs} +2 -2
- package/{tansr-chunk-J2ED6CI4.mjs → tansr-chunk-QUFHVA3F.mjs} +2 -2
- package/{tansr-chunk-HQY7FXGU.mjs → tansr-chunk-X4GLXJ2Z.mjs} +2 -2
- package/{tansr-chunk-M63EZH2M.mjs → tansr-chunk-X5REV3T3.mjs} +2 -2
- package/{tansr-chunk-AEIS2NWD.mjs → tansr-chunk-ZV3NCXTD.mjs} +2 -2
- package/{tansr-main-O6RSYTGN.mjs → tansr-main-STVTNYAI.mjs} +3 -3
- package/{tansr-run-acp-entry-XJMGBZ7Q.mjs → tansr-run-acp-entry-6J44XOYJ.mjs} +3 -3
- package/{tansr-run-approvals-entry-I6FX6AYX.mjs → tansr-run-approvals-entry-HQWSIW3P.mjs} +2 -2
- package/{tansr-run-auth-entry-LJC3UJWR.mjs → tansr-run-auth-entry-7HA4C4NJ.mjs} +2 -2
- package/{tansr-run-doctor-RFMVNKS5.mjs → tansr-run-doctor-7T6IAXYE.mjs} +3 -3
- package/{tansr-run-headless-entry-G2G44HY3.mjs → tansr-run-headless-entry-XEFQC5LE.mjs} +2 -2
- package/{tansr-run-init-entry-JVJEH4PI.mjs → tansr-run-init-entry-3VKXS2WK.mjs} +2 -2
- package/{tansr-run-logout-entry-DI42PBLR.mjs → tansr-run-logout-entry-VNCNNCSS.mjs} +2 -2
- package/{tansr-run-mcp-serve-entry-ZPOSEKDA.mjs → tansr-run-mcp-serve-entry-5KLWER3G.mjs} +2 -2
- package/{tansr-run-orchestrate-entry-43QIZUZA.mjs → tansr-run-orchestrate-entry-AR57AZLR.mjs} +2 -2
- package/{tansr-run-org-entry-D2FTJY7E.mjs → tansr-run-org-entry-TJPRLGCL.mjs} +2 -2
- package/{tansr-run-policy-entry-SLI4BZ2I.mjs → tansr-run-policy-entry-DHMQ3PAP.mjs} +2 -2
- package/{tansr-run-profile-entry-643TLJUU.mjs → tansr-run-profile-entry-LOFPHFG4.mjs} +2 -2
- package/tansr-run-serve-entry-CHVKUY5J.mjs +99 -0
- package/{tansr-run-sessions-entry-MROXZKQS.mjs → tansr-run-sessions-entry-JOMFB5LJ.mjs} +2 -2
- package/{tansr-run-update-entry-BOZIZIWN.mjs → tansr-run-update-entry-XI6KG7UI.mjs} +2 -2
- package/{tansr-src-5BMLUX6E.mjs → tansr-src-A6WDMY6X.mjs} +3 -3
- package/{tansr-startup-account-YMNFBBH2.mjs → tansr-startup-account-7ZFSP3FV.mjs} +4 -4
- package/{tansr-startup-model-LYYMNZ32.mjs → tansr-startup-model-I6LOCFDP.mjs} +3 -3
- package/{tansr-tui-4EYUVRFQ.mjs → tansr-tui-OWG3JNA6.mjs} +5 -5
- package/tansr.mjs +1 -1
- package/tansrd.mjs +244 -244
- package/tansr-chunk-3GJD3L4B.mjs +0 -22
- package/tansr-chunk-LLW6GX7K.mjs +0 -38
- package/tansr-run-serve-entry-CX6EBQAV.mjs +0 -99
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __tansrCreateRequire } from 'module';const require=__tansrCreateRequire(import.meta.url);
|
|
2
2
|
import { fileURLToPath as __tansrFileURLToPath } from 'url';import { dirname as __tansrDirname } from 'path';
|
|
3
3
|
const __filename=__tansrFileURLToPath(import.meta.url);const __dirname=__tansrDirname(__filename);
|
|
4
|
-
import{gb as L,sb as j,tb as w,ub as O,vb as E,xb as N}from"./tansr-chunk-
|
|
4
|
+
import{gb as L,sb as j,tb as w,ub as O,vb as E,xb as N}from"./tansr-chunk-IZICOKKF.mjs";import{m as a}from"./tansr-chunk-NA22YT73.mjs";import{c as f}from"./tansr-chunk-QWGSXFEJ.mjs";var R={rejected:"cli.policy.lifecycle_rejected",verifyRejected:"cli.policy.lifecycle_verify_rejected",lkgFallback:"cli.policy.lifecycle_lkg_fallback",requiredMissing:"cli.policy.lifecycle_required_missing",modeLocked:"cli.policy.mode_locked",refuseLaunch:"cli.policy.refuse_launch",stateWriteFailed:"cli.policy.state_write_failed",stateCorrupted:"cli.policy.state_corrupted",stateCorruptedRefuse:"cli.policy.state_corrupted_refuse",sessionBundleExpired:"cli.policy.session_bundle_expired",sessionRequiredExpired:"cli.policy.session_required_expired"},I=["acceptEdits","auto","bypassPermissions"],$="lkg";function Q(e){return{highWater:{...e.highWater},revoked:Object.fromEntries(Object.entries(e.revoked).map(([o,t])=>[o,[...t]])),lkg:{...e.lkg}}}function C(e){if(e!=="verified")return e==="rejected"?"verify_rejected":e==="unsupported"?"verify_unsupported":"verify_unsigned"}function D(e){let o=e.now??Date.now(),t=e.anchor?.requiredBundles??[],i=[],r=[],n=Q(e.state),s=!1,l=new Map;for(let c of t)l.has(c.id)||l.set(c.id,c);let p=(c,m)=>{let g=O(m);g>(n.highWater[c]??0)&&(n.highWater[c]=g,s=!0);let u=m.meta.revokedSequences??[];if(u.length>0){let P=new Set(n.revoked[c]??[]),k=P.size;for(let S of u)P.add(S);P.size!==k&&(n.revoked[c]=[...P].sort((S,_)=>S-_),s=!0)}},d=[],y=new Map,h=new Map;for(let c of e.groups){if(c.builtin===!0){d.push(c);continue}let m=[];for(let g of c.bundles){let u=g.meta.id;if(y.has(u)){m.push(g);continue}let P=l.get(u),k=E(g,{now:o,...P!==void 0?{anchor:P}:{},...n.highWater[u]!==void 0?{highWater:n.highWater[u]}:{},...n.revoked[u]!==void 0?{revoked:n.revoked[u]}:{}});if(!k.ok){h.has(u)||h.set(u,k.reason),i.push({message:a(R.rejected,{id:u,reason:k.reason}),level:"error"});continue}let S=L(g,e.verify).status;if(P!==void 0){let _=C(S);if(_!==void 0){h.has(u)||h.set(u,_),i.push({message:a(R.verifyRejected,{id:u,reason:_}),level:"error"});continue}}else if(S==="rejected"||S==="unsupported"){m.push(g);continue}m.push(g),y.set(u,g),p(u,g)}m.length>0&&d.push({...c,bundles:m})}let b=[];for(let c of l.values()){let m=y.get(c.id);if(m===void 0){let g=h.get(c.id)??"absent",u=n.lkg[c.id],P=u===void 0?void 0:C(L(u,e.verify).status)??(()=>{let k=E(u,{now:o,anchor:c,...n.highWater[c.id]!==void 0?{highWater:n.highWater[c.id]}:{},...n.revoked[c.id]!==void 0?{revoked:n.revoked[c.id]}:{}});return k.ok?void 0:k.reason})();if(u!==void 0&&P===void 0)b.push(u),m=u,p(c.id,u),i.push({message:a(R.lkgFallback,{id:c.id,sequence:O(u),reason:g}),level:"error"});else{r.push({bundleId:c.id,reason:u!==void 0?P:g}),i.push({message:a(R.requiredMissing,{id:c.id,reason:u!==void 0?P:g}),level:"error"});continue}}JSON.stringify(n.lkg[c.id])!==JSON.stringify(m)&&(n.lkg[c.id]=m,s=!0)}for(let c of Object.keys(n.lkg))l.has(c)||(delete n.lkg[c],s=!0);let B=r.length>0;return B?{groups:d.filter(c=>c.builtin===!0),notices:i,refuseLaunch:B,refusals:r,state:n,stateChanged:s}:(b.length>0&&d.push({dir:$,bundles:b}),{groups:d,notices:i,refuseLaunch:B,refusals:r,state:n,stateChanged:s})}function Re(e,o){return e===void 0||o===void 0||!o.lockedModes.includes(e)?{mode:e}:{mode:"default",lockedMode:e}}function ve(e){return{message:a(R.modeLocked,{mode:e}),level:"error"}}function be(e){let o=e.now??Date.now(),t=new Set((e.anchor?.requiredBundles??[]).map(s=>s.id)),i=[],r=[],n=[];for(let s of e.groups){if(s.builtin===!0){n.push(s);continue}let l=[];for(let p of s.bundles){let d=E(p,{now:o});if(d.ok){l.push(p);continue}let y=p.meta.id;t.has(y)?(r.push({bundleId:y,reason:d.reason}),i.push({message:a(R.sessionRequiredExpired,{id:y,reason:d.reason}),level:"error"})):i.push({message:a(R.sessionBundleExpired,{id:y,reason:d.reason}),level:"error"})}l.length>0&&n.push({...s,bundles:l})}return{groups:n,notices:i,refuseSession:r.length>0,refusals:r}}import z from"node:os";import Y from"node:path";import{randomBytes as H}from"node:crypto";import{mkdir as Z,open as q,readFile as X,rename as ee,rm as ie}from"node:fs/promises";import oe from"node:os";import x from"node:path";var re="policy-state.json";function M(){return{highWater:{},revoked:{},lkg:{}}}function A(e,o=oe.homedir()){let t=e.TANSR_CONFIG_DIR?.trim(),i=t!==void 0&&t!==""?t:x.join(o,".tansr");return x.join(i,re)}function te(e){let o={};if(typeof e!="object"||e===null||Array.isArray(e))return o;for(let[t,i]of Object.entries(e))typeof i=="number"&&Number.isInteger(i)&&i>=0&&(o[t]=i);return o}function ne(e){let o={};if(typeof e!="object"||e===null||Array.isArray(e))return o;for(let[t,i]of Object.entries(e)){if(!Array.isArray(i))continue;let r=i.filter(n=>typeof n=="number"&&Number.isInteger(n)&&n>=0);r.length>0&&(o[t]=[...new Set(r)].sort((n,s)=>n-s))}return o}function se(e){let o={};if(typeof e!="object"||e===null||Array.isArray(e))return o;for(let[t,i]of Object.entries(e)){let r=j(i);r.ok&&r.bundle.meta.id===t&&(o[t]=r.bundle)}return o}async function T(e,o=t=>X(t,"utf8")){let t;try{t=await o(e)}catch{return{state:M(),corrupted:!1}}let i;try{i=JSON.parse(t)}catch{return{state:M(),corrupted:!0}}if(typeof i!="object"||i===null||Array.isArray(i))return{state:M(),corrupted:!0};let r=i;return{state:{highWater:te(r.highWater),revoked:ne(r.revoked),lkg:se(r.lkg)},corrupted:!1}}async function F(e,o,t){let i=`${JSON.stringify(o,null,2)}
|
|
5
5
|
`;if(t!==void 0){await t(e,i);return}let r=x.dirname(e);await Z(r,{recursive:!0});let n=`${e}.tmp-${process.pid}-${H(4).toString("hex")}`,s=await q(n,"w");try{await s.writeFile(i,"utf8"),await s.sync()}finally{await s.close()}try{await ee(n,e)}catch(l){throw await ie(n,{force:!0}),l}try{let l=await q(r,"r");try{await l.sync()}finally{await l.close()}}catch{}}var ce="TANSR_RECOMMENDED_RULES",le="tansr-recommended-v1",W={meta:{id:le,version:"1.0.0",issuer:"tansr",issuedAt:"2026-07-29T00:00:00Z"},rules:{ask:["Shell(git push --force *)","Shell(git push *)","Shell(gh pr merge *)","Shell(npm publish *)","Shell(pnpm publish *)","Shell(yarn publish *)","Shell(docker push *)","Shell(git reset --hard *)","Shell(git clean *)","Shell(git stash drop *)"]}};function V(e=process.env,o){let t=e[ce]?.trim();return t!==void 0&&t!==""?t!=="0":o!==!1}var v={loaded:"cli.policy.loaded",sourceError:"cli.policy.source_error",bundleSkipped:"cli.policy.bundle_skipped",invalidRules:"cli.policy.invalid_rules",trustLoaded:"cli.policy.trust_loaded",trustError:"cli.policy.trust_error",trustLoadedManaged:"cli.policy.trust_loaded_managed",trustErrorManaged:"cli.policy.trust_error_managed",sectionIgnored:"cli.policy.section_ignored",trustEnvIgnoredManaged:"cli.policy.trust_env_ignored_managed"},ue="TANSR_POLICY_TRUST",de=f.object({id:f.string().min(1),issuer:f.string().min(1),audience:f.string().min(1).optional(),minSequence:f.number().int().nonnegative().optional()}).strict(),J=f.object({keys:f.record(f.string().min(1)),unsignedPolicy:f.enum(["accept","reject"]).optional(),requiredBundles:f.array(de).optional(),lockedModes:f.array(f.enum(I)).optional(),autoTierCeiling:f.enum(["none","low","medium","high"]).optional(),qualificationRemote:f.object({url:f.string().min(1),required:f.boolean().optional()}).strict().optional(),adjudicatorPool:f.object({url:f.string().min(1),required:f.boolean().optional()}).strict().optional()}).strict(),ae=f.object({trust:J.optional()}).strict(),G={unsignedPolicy:"reject",verifiers:[]};function K(e,o,t){let i;try{i=[N({publicKeys:e.keys})]}catch{return o("trust_key_invalid")}let r=e.requiredBundles!==void 0||e.lockedModes!==void 0||e.autoTierCeiling!==void 0||e.qualificationRemote!==void 0||e.adjudicatorPool!==void 0?{requiredBundles:e.requiredBundles??[],lockedModes:e.lockedModes??[],...e.autoTierCeiling!==void 0?{autoTierCeiling:e.autoTierCeiling}:{},...e.qualificationRemote!==void 0?{qualificationRemote:e.qualificationRemote}:{},...e.adjudicatorPool!==void 0?{adjudicatorPool:e.adjudicatorPool}:{}}:void 0;return{verify:{unsignedPolicy:e.unsignedPolicy??"accept",verifiers:i},...r!==void 0?{anchor:r}:{},trustedKeys:e.keys,notices:[t(Object.keys(e.keys).length)]}}function fe(e){return(e?.ignoredLayers??[]).map(o=>({message:a(v.sectionIgnored,{layer:o}),level:"info"}))}async function ye(e={}){let o=e.env??process.env,t=fe(e.policy),i=s=>({...s,notices:[...t,...s.notices]}),r=o[ue]?.trim(),n=r!==void 0&&r!=="";if(e.policy!==void 0&&"managed"in e.policy){let s=p=>({verify:G,notices:[{message:a(v.trustErrorManaged,{code:p}),level:"error"}]}),l=ae.safeParse(e.policy.managed);if(!l.success)return i(s("trust_shape_invalid"));if(l.data.trust!==void 0){let p=n?[{message:a(v.trustEnvIgnoredManaged,{file:r}),level:"info"}]:[],d=K(l.data.trust,s,y=>({message:a(v.trustLoadedManaged,{count:y}),level:"info"}));return i({...d,notices:[...p,...d.notices]})}}if(n){let s=h=>({verify:G,notices:[{message:a(v.trustError,{code:h,file:r}),level:"error"}]}),l=e.fs?.readFile??pe,p;try{p=await l(r)}catch{return i(s("trust_unreadable"))}let d;try{d=JSON.parse(p)}catch{return i(s("trust_json_invalid"))}let y=J.safeParse(d);return y.success?i(K(y.data,s,h=>({message:a(v.trustLoaded,{count:h}),level:"info"}))):i(s("trust_shape_invalid"))}return{notices:t}}async function pe(e){let{readFile:o}=await import("node:fs/promises");return o(e,"utf8")}function Ae(e){let o=e.verify?.verifiers;if(!(o===void 0||o.length===0))return{verifiers:o}}function ge(e,o=z.homedir()){let t=[],i=e.TANSR_POLICY_DIR?.trim();i!==void 0&&i!==""&&t.push(i);let r=e.TANSR_CONFIG_DIR?.trim(),n=r!==void 0&&r!==""?r:Y.join(o,".tansr");return t.push(Y.join(n,"policies")),t}async function me(e={}){let o=e.env??process.env,t=[],i=[];for(let r of ge(o,e.homedir)){let s=await new w({dir:r,...e.fs!==void 0?{fs:e.fs}:{},onDiagnostic:l=>{l.code!=="dir_missing"&&t.push({message:a(v.sourceError,{code:l.code,file:l.file}),level:l.severity==="error"?"error":"info"})}}).load();s.length>0&&i.push({dir:r,bundles:s})}return V(o,e.recommendedRules)&&i.push({dir:"builtin",bundles:[W],builtin:!0}),{groups:i,notices:t}}function U(e,o,t){let i=[];for(let r of o){let n=e.loadPolicyBundles(r.bundles,{source:r.builtin===!0?"builtin":`localDir:${r.dir}`,...t!==void 0&&r.builtin!==!0?{verify:t}:{}}),s=0;for(let l of n)l.status==="loaded"?s+=1:(r.builtin!==!0||l.reason!=="duplicate_id")&&i.push({message:a(v.bundleSkipped,{id:l.bundleId,reason:l.reason??"unknown"}),level:"error"}),l.invalidRuleCount>0&&i.push({message:a(v.invalidRules,{id:l.bundleId,count:l.invalidRuleCount}),level:"error"});s>0&&r.builtin!==!0&&i.push({message:a(v.loaded,{count:s,dir:r.dir}),level:"info"})}return i}async function Te(e,o={}){let t=o.env??process.env,i=o.trust??await ye(o),{groups:r,notices:n}=await me(o),s=o.statePath??A(t,o.homedir??z.homedir()),l=await T(s,o.fs?.readFile),p=i.anchor?.requiredBundles??[];if(l.corrupted&&p.length>0){let h=p.map(c=>({bundleId:c.id,reason:"state_corrupted"})),b=[...i.notices,...n];b.push({message:a(R.stateCorruptedRefuse,{file:s}),level:"error"});for(let c of h)b.push({message:a(R.requiredMissing,{id:c.bundleId,reason:c.reason}),level:"error"});let B=r.filter(c=>c.builtin===!0);return b.push(...U(e,B,i.verify)),{notices:b,refuseLaunch:!0,refusals:h,...i.anchor!==void 0?{anchor:i.anchor}:{},groups:B}}l.corrupted&&n.push({message:a(R.stateCorrupted,{file:s}),level:"error"});let d=D({groups:r,verify:i.verify,anchor:i.anchor,state:l.state,...o.now!==void 0?{now:o.now}:{}}),y=[...i.notices,...n,...d.notices];if(d.stateChanged)try{await F(s,d.state,o.stateWriteFile)}catch{y.push({message:a(R.stateWriteFailed,{file:s}),level:"error"})}return y.push(...U(e,d.groups,i.verify)),{notices:y,refuseLaunch:d.refuseLaunch,refusals:d.refusals,...i.anchor!==void 0?{anchor:i.anchor}:{},groups:d.groups}}export{R as a,I as b,Re as c,ve as d,be as e,ye as f,Ae as g,ge as h,U as i,Te as j};
|
|
6
|
-
//# sourceMappingURL=tansr-chunk-
|
|
6
|
+
//# sourceMappingURL=tansr-chunk-HHL7HM62.mjs.map
|