@iaforged/context-code 2.1.6 → 2.1.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as o,jsx as
|
|
1
|
+
import{jsxs as o,jsx as r}from"react/jsx-runtime";import{c as e}from"react/compiler-runtime";import t from"chalk";import i from"figures";import{useEffect as s}from"react";import{getAdditionalDirectoriesForClaudeMd as n,setAdditionalDirectoriesForClaudeMd as a}from"../../bootstrap/state.js";import{MessageResponse as c}from"../../components/MessageResponse.js";import{AddWorkspaceDirectory as d}from"../../components/permissions/rules/AddWorkspaceDirectory.js";import{Box as m,Text as l}from"../../ink.js";import{applyPermissionUpdate as p,persistPermissionUpdate as u}from"../../utils/permissions/PermissionUpdate.js";import{SandboxManager as f}from"../../utils/sandbox/sandbox-adapter.js";import{addDirHelpMessage as g,validateDirectoryForWorkspace as j}from"./validation.js";function AddDirError(t){const n=e(10),{message:a,args:d,onDone:p}=t;let u,f,g,j,b;return n[0]!==p?(u=()=>{const o=setTimeout(p,0);return()=>clearTimeout(o)},f=[p],n[0]=p,n[1]=u,n[2]=f):(u=n[1],f=n[2]),s(u,f),n[3]!==d?(g=o(l,{dimColor:!0,children:[i.pointer," /add-dir ",d]}),n[3]=d,n[4]=g):g=n[4],n[5]!==a?(j=r(c,{children:r(l,{children:a})}),n[5]=a,n[6]=j):j=n[6],n[7]!==g||n[8]!==j?(b=o(m,{flexDirection:"column",children:[g,j]}),n[7]=g,n[8]=j,n[9]=b):b=n[9],b}export async function call(o,e,i){const s=(i??"").trim(),c=e.getAppState(),handleAddDirectory=async(r,i=!1)=>{const s={type:"addDirectories",directories:[r],destination:i?"localSettings":"session"},c=e.getAppState(),d=p(c.toolPermissionContext,s);e.setAppState(o=>({...o,toolPermissionContext:d}));const m=n();let l;if(m.includes(r)||a([...m,r]),f.refreshConfig(),i)try{u(s),l=`Se añadió ${t.bold(r)} como directorio de trabajo y se guardó en la configuración local`}catch(o){l=`Se añadió ${t.bold(r)} como directorio de trabajo. No se pudo guardar en la configuración local: ${o instanceof Error?o.message:"Error desconocido"}`}else l=`Se añadió ${t.bold(r)} como directorio de trabajo para esta sesión`;const g=`${l} ${t.dim("· /permissions para administrar")}`;o(g)};if(!s)return r(d,{permissionContext:c.toolPermissionContext,onAddDirectory:handleAddDirectory,onCancel:()=>{o("No se añadió ningún directorio de trabajo.")}});const m=await j(s,c.toolPermissionContext);if("success"!==m.resultType){const e=g(m);return r(AddDirError,{message:e,args:i??"",onDone:()=>o(e)})}return r(d,{directoryPath:m.absolutePath,permissionContext:c.toolPermissionContext,onAddDirectory:handleAddDirectory,onCancel:()=>{o(`No se añadió ${t.bold(m.absolutePath)} como directorio de trabajo.`)}})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"chalk";import{stat as t}from"fs/promises";import{dirname as e,resolve as o}from"path";import{getErrnoCode as
|
|
1
|
+
import r from"chalk";import{stat as t}from"fs/promises";import{dirname as e,resolve as o}from"path";import{getErrnoCode as a}from"../../utils/errors.js";import{expandPath as i}from"../../utils/path.js";import{allWorkingDirectories as s,pathInWorkingPath as c}from"../../utils/permissions/filesystem.js";export async function validateDirectoryForWorkspace(r,e){if(!r)return{resultType:"emptyPath"};const n=o(i(r));try{if(!(await t(n)).isDirectory())return{resultType:"notADirectory",directoryPath:r,absolutePath:n}}catch(t){const e=a(t);if("ENOENT"===e||"ENOTDIR"===e||"EACCES"===e||"EPERM"===e)return{resultType:"pathNotFound",directoryPath:r,absolutePath:n};throw t}const u=s(e);for(const t of u)if(c(n,t))return{resultType:"alreadyInWorkingDirectory",directoryPath:r,workingDir:t};return{resultType:"success",absolutePath:n}}export function addDirHelpMessage(t){switch(t.resultType){case"emptyPath":return"Por favor, proporciona una ruta de directorio.";case"pathNotFound":return`La ruta ${r.bold(t.absolutePath)} no fue encontrada.`;case"notADirectory":{const o=e(t.absolutePath);return`${r.bold(t.directoryPath)} no es un directorio. ¿Quisiste decir añadir el directorio padre ${r.bold(o)}?`}case"alreadyInWorkingDirectory":return`${r.bold(t.directoryPath)} ya está accesible dentro del directorio de trabajo existente ${r.bold(t.workingDir)}.`;case"success":return`Se añadió ${r.bold(t.absolutePath)} como directorio de trabajo.`}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,Aa as r,Ba as i,C as a,Ca as o,Da as l,Ea as u,J as h,P as p,Q as b,a as g,aa as w,c as d,d as v,f
|
|
1
|
+
import{A as e,Aa as r,Ba as i,C as a,Ca as o,Da as l,Ea as u,J as h,P as p,Q as b,a as g,aa as w,c as d,d as v,f,h as E,i as m,j as y,k,l as O,m as T,o as C,pa as A,q as I,r as P,s as S,t as M,wa as N,xa as D,ya as W,za as L}from"./chunk-VAB2VXFI.js";var _="Service workers are disabled or not supported by this browser",x=class{serviceWorker;worker;registration;events;constructor(e,r){if(this.serviceWorker=e,e){let i=null,a=new v;this.worker=new d(e=>(null!==i&&e.next(i),a.subscribe(r=>e.next(r))));let s=()=>{let{controller:r}=e;null!==r&&(i=r,a.next(i))};e.addEventListener("controllerchange",s),s(),this.registration=this.worker.pipe(k(()=>e.getRegistration()));let o=new v;this.events=o.asObservable();let c=e=>{let{data:r}=e;r?.type&&o.next(r)};e.addEventListener("message",c),r?.get(b,null,{optional:!0})?.onDestroy(()=>{e.removeEventListener("controllerchange",s),e.removeEventListener("message",c)})}else this.worker=this.events=this.registration=new d(e=>e.error(new O(5601,!1)))}postMessage(e,r){return new Promise(i=>{this.worker.pipe(y(1)).subscribe(a=>{a.postMessage(g({action:e},r)),i()})})}postMessageWithOperation(e,r,i){let a=this.waitForOperationCompleted(i),o=this.postMessage(e,r);return Promise.all([o,a]).then(([,e])=>e)}generateNonce(){return Math.round(1e7*Math.random())}eventsOfType(e){let r;return r="string"==typeof e?r=>r.type===e:r=>e.includes(r.type),this.events.pipe(m(r))}nextEventOfType(e){return this.eventsOfType(e).pipe(y(1))}waitForOperationCompleted(e){return new Promise((r,i)=>{this.eventsOfType("OPERATION_COMPLETED").pipe(m(r=>r.nonce===e),y(1),f(e=>{if(void 0!==e.result)return e.result;throw new Error(e.error)})).subscribe({next:r,error:i})})}get isEnabled(){return!!this.serviceWorker}},V=(()=>{class n{sw;messages;notificationClicks;subscription;get isEnabled(){return this.sw.isEnabled}pushManager=null;subscriptionChanges=new v;constructor(e){if(this.sw=e,!e.isEnabled)return this.messages=E,this.notificationClicks=E,void(this.subscription=E);this.messages=this.sw.eventsOfType("PUSH").pipe(f(e=>e.data)),this.notificationClicks=this.sw.eventsOfType("NOTIFICATION_CLICK").pipe(f(e=>e.data)),this.pushManager=this.sw.registration.pipe(f(e=>e.pushManager));let r=this.pushManager.pipe(k(e=>e.getSubscription()));this.subscription=new d(e=>{let i=r.subscribe(e),a=this.subscriptionChanges.subscribe(e);return()=>{i.unsubscribe(),a.unsubscribe()}})}requestSubscription(e){if(!this.sw.isEnabled||null===this.pushManager)return Promise.reject(new Error(_));let r={userVisibleOnly:!0},i=this.decodeBase64(e.serverPublicKey.replace(/_/g,"/").replace(/-/g,"+")),a=new Uint8Array(new ArrayBuffer(i.length));for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return r.applicationServerKey=a,new Promise((e,i)=>{this.pushManager.pipe(k(e=>e.subscribe(r)),y(1)).subscribe({next:r=>{this.subscriptionChanges.next(r),e(r)},error:i})})}unsubscribe(){if(!this.sw.isEnabled)return Promise.reject(new Error(_));let t=e=>{if(null===e)throw new O(5602,!1);return e.unsubscribe().then(e=>{if(!e)throw new O(5603,!1);this.subscriptionChanges.next(null)})};return new Promise((e,r)=>{this.subscription.pipe(y(1),k(t)).subscribe({next:e,error:r})})}decodeBase64(e){return atob(e)}static ɵfac=function(e){return new(e||n)(P(x))};static ɵprov=C({token:n,factory:n.ɵfac})}return n})(),F=(()=>{class n{sw;versionUpdates;unrecoverable;get isEnabled(){return this.sw.isEnabled}constructor(e){if(this.sw=e,!e.isEnabled)return this.versionUpdates=E,void(this.unrecoverable=E);this.versionUpdates=this.sw.eventsOfType(["VERSION_DETECTED","VERSION_INSTALLATION_FAILED","VERSION_READY","NO_NEW_VERSION_DETECTED"]),this.unrecoverable=this.sw.eventsOfType("UNRECOVERABLE_STATE")}checkForUpdate(){if(!this.sw.isEnabled)return Promise.reject(new Error(_));let e=this.sw.generateNonce();return this.sw.postMessageWithOperation("CHECK_FOR_UPDATES",{nonce:e},e)}activateUpdate(){if(!this.sw.isEnabled)return Promise.reject(new O(5601,!1));let e=this.sw.generateNonce();return this.sw.postMessageWithOperation("ACTIVATE_UPDATE",{nonce:e},e)}static ɵfac=function(e){return new(e||n)(P(x))};static ɵprov=C({token:n,factory:n.ɵfac})}return n})(),R=new I("");function X(){let e=S(U);if(!("serviceWorker"in navigator)||!1===e.enabled)return;let r=S(R),i=S(a),o=S(b);i.runOutsideAngular(()=>{let e=navigator.serviceWorker,s=()=>e.controller?.postMessage({action:"INITIALIZE"});e.addEventListener("controllerchange",s),o.onDestroy(()=>{e.removeEventListener("controllerchange",s)})}),i.runOutsideAngular(()=>{let i,{registrationStrategy:a}=e;if("function"==typeof a)i=new Promise(e=>a().subscribe(()=>e()));else{let[e,...r]=(a||"registerWhenStable:30000").split(":");switch(e){case"registerImmediately":i=Promise.resolve();break;case"registerWithDelay":i=q(+r[0]||0);break;case"registerWhenStable":i=Promise.race([o.whenStable(),q(+r[0])]);break;default:throw new O(5600,!1)}}i.then(()=>{o.destroyed||navigator.serviceWorker.register(r,{scope:e.scope}).catch(e=>console.error(T(5604,!1)))})})}function q(e){return new Promise(r=>setTimeout(r,e))}function ee(e,r){return new x(!1!==e.enabled?navigator.serviceWorker:void 0,r)}var U=class{enabled;scope;registrationStrategy};N(class n{constructor(){this.auth=S(l),this.socket=S(u)}ngOnInit(){this.auth.hasToken()&&this.socket.connect()}static{this.ɵfac=function(e){return new(e||n)}}static{this.ɵcmp=h({type:n,selectors:[["cx-root"]],decls:1,vars:0,template:function(e,r){1&e&&w(0,"router-outlet")},dependencies:[L],encapsulation:2,changeDetection:0})}},{providers:[i([{path:"",redirectTo:"chat",pathMatch:"full"},{path:"login",loadComponent:()=>import("./chunk-NFYBHCXF.js").then(e=>e.LoginComponent)},{path:"chat",canActivate:[()=>{let e=S(l),i=S(r);return!!e.hasToken()||(i.navigate(["/login"]),!1)}],loadComponent:()=>import("./chunk-AMCDNAIG.js").then(e=>e.ChatComponent)},{path:"**",redirectTo:"chat"}],o()),D(W()),function(r,i={}){return M([V,F,{provide:R,useValue:r},{provide:U,useValue:i},{provide:x,useFactory:ee,deps:[U,e]},p(X)])}("ngsw-worker.js",{enabled:!A(),registrationStrategy:"registerWhenStable:30000"})]}).catch(e=>console.error("[webapp] bootstrap error",e));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iaforged/context-code",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "Context Code es un asistente de desarrollo para la terminal. Puede revisar tu proyecto, editar archivos, ejecutar comandos y apoyarte en tareas reales de programacion.",
|
|
5
5
|
"author": "Context AI",
|
|
6
6
|
"license": "MIT",
|