ozmoz 0.1.35 → 0.1.38

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/ozmoz-mcp.js CHANGED
@@ -79,7 +79,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
79
79
 
80
80
  Wait for their reply (Enter/'ok' for the recommended one, '2' or the other mode's name for the alternate).`,u=String(t||n||"").trim();if(!u)throw new Error("STOP: 'modeReply' is required and was not provided. "+c+" Then call this tool again with the exact same arguments, plus 'modeReply' set to the user's literal reply.");let l=u.toLowerCase();if(l.includes("standard"))return"standard";if(l.includes("high"))return"high";if(/^(|ok|okay|d'accord|oui|yes|go|vas-?y|allez|sure|1|\[1\])$/i.test(l)||l===r)return r;if(l==="2"||l==="[2]"||l===o)return o;throw new Error("STOP: 'modeReply' is missing or could not be mapped to a mode. "+c+" Then call this tool again with the exact same arguments, plus 'modeReply' set to their literal reply. Never write 'modeReply' yourself without an actual user reply.")}async function nC(e){let t=`1. If needed, scaffold the frontend (do not overwrite existing files), then run commandInit.
81
81
  2. Read 'ozmoz_contract.md', then IMMEDIATELY write the UI views in the same turn \u2014 do NOT stop or summarize progress before every view is written.
82
- 3. Once every view is written, start the dev server and ask the user to validate before calling 'oz_update_project'.`;try{let n=await fetch(`https://getagentdirectives-${Fh}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({data:{}})});if(!n.ok)return t;let i=await n.json(),r=i.result?.data||i.result||i.data;return typeof r?.createProjectNextSteps=="string"&&r.createProjectNextSteps.trim()?r.createProjectNextSteps:t}catch{return t}}var Bo=new Yc({name:"ozmoz-mcp",version:"1.0.0"},{capabilities:{tools:{},prompts:{}}});Bo.setRequestHandler(Ep,async()=>({prompts:[{name:"oz_contract_rules",description:"Loads strict architectural rules, invariants, and integrity directives for OZmoz SVRO."}]}));Bo.setRequestHandler(Zp,async e=>{if(e.params.name==="oz_contract_rules")return{description:"Official OZmoz SVRO architecture directives",messages:[{role:"user",content:{type:"text",text:mS}}]};throw new Error(`Unknown prompt: ${e.params.name}`)});Bo.setRequestHandler(Up,async()=>({tools:[{name:"oz_create_project",description:"Creates a NEW OZmoz Cloud project. Call this ONLY when starting a brand new application from scratch. DO NOT call it if the project is already initialized (OZ_DB_KEY present in .env, or svro.schema.json exists): use 'oz_update_project' instead. This tool is already authenticated and returns the exact next command to run: no shell command or filesystem search is needed before calling it, including this tool's own JSON definition file (e.g. under ~/.gemini/.../mcp/ozmoz/oz_create_project.json) \u2014 you already have this schema in context via the tool list. Only if it returns a missing-token error: run 'npx ozmoz login' once, wait for it to finish, then call this tool again.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Nom de l'application"},keyApp:{type:"string",description:"Slug unique (optionnel, auto-d\xE9duit si omis)"}},required:["name"]}},{name:"oz_update_project",description:"HARD STOP: call this tool ONLY after the user has explicitly approved the screens in a message that arrived AFTER you gave them the dev-server address (first sealing), or when they ask for a data change (later). NEVER in the same turn as writing UI code or asking for their approval: if they have not answered yet, ask and STOP. 'userApproval' must be their exact words. Models / updates the project's data contract (svro.schema.json + svro.workflow.json) from UI component files and business rules, additively. This is the ONLY way to evolve the contract: there is no shell command for it. Pass 'filePaths' (e.g. ['src/components/DeskList.jsx']); 'keyApp' is optional (read from .env). Do NOT read this tool's own JSON definition file from disk (e.g. under ~/.gemini/.../mcp/ozmoz/oz_update_project.json) before calling it \u2014 you already have this schema in context via the tool list; re-reading it wastes time and tokens for no new information. Before calling this tool, ask the user (like the framework question) which analysis depth they want for this modeling pass: briefly explain what this step does and what each mode costs, THEN show only the two options as a bare list (recommended option first) \u2014 and pass their LITERAL reply as 'modeReply' from your very first call. If you forget and call without it, the tool may fail and tell you to ask; that is a fallback, not the normal path. Afterwards run 'npx ozmoz sync' once.",inputSchema:{type:"object",properties:{keyApp:{type:"string",description:"Unique application key (e.g. coworking_prod). Optional: if omitted, it is read from OZ_KEY_APP in the project's .env."},name:{type:"string",description:"Application name"},userApproval:{type:"string",description:"The user's EXACT words authorizing this call: their approval of the screens, or their request to change the data. Never write it yourself."},rules:{type:"string",description:"New business rules, calculations, or state transitions."},reasoning:{type:"string",enum:["standard","high"],description:"DEPRECATED \u2014 ignored. Omit this."},modeReply:{type:"string",description:"MANDATORY \u2014 never omit it, never invent it. Before calling this tool, show the user a numbered [1]/[2] choice for the analysis depth (recommended option first, like you do for the framework question), wait for their reply, then pass their LITERAL reply here (empty/'ok'/'oui' for [1], '2' for [2])."},filePaths:{type:"array",items:{type:"string"},description:"Relative paths of ALL files that call oz.* or define data fields."},viewFiles:{type:"array",items:{type:"object",properties:{name:{type:"string"},content:{type:"string"}},required:["name","content"]},description:"View files already loaded in memory [{ name, content }]."}},required:["name","userApproval","modeReply"]}},{name:"oz_publish_function",description:"Deploys a private or public cloud utility function executed in a secure serverless environment.",inputSchema:{type:"object",properties:{enterpriseID:{type:"string",description:"Project enterpriseID infrastructure identifier"},functionName:{type:"string",description:"Function name (alphanumeric 3-40 chars, e.g. calculateTotal)"},code:{type:"string",description:"JS source code (e.g. async function calculateTotal(payload, oz) { ... })"},description:{type:"string",description:"Action documentation for the catalog and Alex AI"},isPublic:{type:"boolean",description:"true to publish to the global Marketplace, false for private function"}},required:["enterpriseID","functionName","code"]}},{name:"oz_get_contract",description:"Provides the official data contract, SDK directives, production lifecycle and canonical blueprint.",inputSchema:{type:"object",properties:{}}}]}));Bo.setRequestHandler(ao,async e=>{let{name:t,arguments:n}=e.params;if(t==="oz_get_contract")return{content:[{type:"text",text:mS}]};let i=await YR();if(!i)return{isError:!0,content:[{type:"text",text:"Error: FLEETBO_DEV_TOKEN missing. Run 'npx ozmoz login' ONCE, wait for it to finish (the developer approves in the browser), then call this tool again \u2014 no restart needed."}]};try{if(t==="oz_create_project"){let o=ot.object({name:ot.string().min(2),keyApp:ot.string().optional()}).parse(n),{keyApp:a,json:s}=await eC(o,async d=>{let f=await fetch(`https://createprojectlight-${Fh}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify({data:{name:o.name,keyApp:d}})});return{res:f,json:await f.json()}}),c=s.result?.data||s.data||{},u=c.enterpriseId||c.referenceId||c.id,l=`npx ozmoz init --keyApp=${a} --token=${c.bootstrapToken} && npx ozmoz sync`;return{content:[{type:"text",text:JSON.stringify({status:"SUCCESS",message:`Project "${o.name}" successfully created. Ready for bootstrap and modeling.`,enterpriseID:u,keyApp:a,bootstrapToken:c.bootstrapToken,commandInit:l,directive:"Do NOT start any dev server yet. If the folder has no package.json, scaffold the frontend first (step 1), then run commandInit.",nextSteps:await nC(i)},null,2)}]}}if(t==="oz_update_project"){tC(n&&n.userApproval);let r=await rC(Gt.resolve(process.cwd()),n&&n.modeReply,n&&n.reasoning),o=KR(Gt.resolve(process.cwd()))||n?.keyApp?.trim();if(!o)throw new Error("keyApp not provided and OZ_KEY_APP not found in the project's .env. Pass 'keyApp' explicitly.");let{spawnSync:a}=await import("node:child_process"),{fileURLToPath:s}=await import("node:url"),c=Gt.dirname(s(import.meta.url)),l=[[Gt.join(c,"cli.cjs"),Gt.join(c,"cli.js")].find(fr.existsSync)||Gt.join(c,"cli.cjs"),"update",`--reasoning=${r}`];n?.rules&&l.push(`--rules=${n.rules}`),n?.filePaths&&Array.isArray(n.filePaths)&&l.push(`--files=${n.filePaths.join(",")}`);let d=a(process.execPath,l,{cwd:process.cwd(),stdio:"pipe",encoding:"utf8",env:process.env});if(d.status!==0){let f=(d.stderr||d.stdout||"").trim();throw new Error(`Modeling update failed via CLI: ${f||"Unknown execution error"}`)}return{content:[{type:"text",text:JSON.stringify({status:"SUCCESS",keyApp:o,message:"Alex AI a mod\xE9lis\xE9 le contrat \xE0 partir du contractDraft extrait localement et l'a scell\xE9 \xE0 l'Edge.",actionRequired:"none",directive:`1. La structure des donn\xE9es a \xE9t\xE9 extraite et scell\xE9e \xE0 l'Edge via cli.js.
82
+ 3. Once every view is written, start the dev server and ask the user to validate before calling 'oz_update_project'.`;try{let n=await fetch(`https://getagentdirectives-${Fh}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({data:{}})});if(!n.ok)return t;let i=await n.json(),r=i.result?.data||i.result||i.data;return typeof r?.createProjectNextSteps=="string"&&r.createProjectNextSteps.trim()?r.createProjectNextSteps:t}catch{return t}}var Bo=new Yc({name:"ozmoz-mcp",version:"1.0.0"},{capabilities:{tools:{},prompts:{}},instructions:'OZmoz: before anything else, call the tool "oz_get_contract" to load the directives. They are not stored in a local file.'});Bo.setRequestHandler(Ep,async()=>({prompts:[{name:"oz_contract_rules",description:"Loads strict architectural rules, invariants, and integrity directives for OZmoz SVRO."}]}));Bo.setRequestHandler(Zp,async e=>{if(e.params.name==="oz_contract_rules")return{description:"Official OZmoz SVRO architecture directives",messages:[{role:"user",content:{type:"text",text:mS}}]};throw new Error(`Unknown prompt: ${e.params.name}`)});Bo.setRequestHandler(Up,async()=>({tools:[{name:"oz_create_project",description:"Creates a NEW OZmoz Cloud project. Call this ONLY when starting a brand new application from scratch. DO NOT call it if the project is already initialized (OZ_DB_KEY present in .env, or svro.schema.json exists): use 'oz_update_project' instead. This tool is already authenticated and returns the exact next command to run: no shell command or filesystem search is needed before calling it, including this tool's own JSON definition file (e.g. under ~/.gemini/.../mcp/ozmoz/oz_create_project.json) \u2014 you already have this schema in context via the tool list. Only if it returns a missing-token error: run 'npx ozmoz login' once, wait for it to finish, then call this tool again.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Nom de l'application"},keyApp:{type:"string",description:"Slug unique (optionnel, auto-d\xE9duit si omis)"}},required:["name"]}},{name:"oz_update_project",description:"HARD STOP: call this tool ONLY after the user has explicitly approved the screens in a message that arrived AFTER you gave them the dev-server address (first sealing), or when they ask for a data change (later). NEVER in the same turn as writing UI code or asking for their approval: if they have not answered yet, ask and STOP. 'userApproval' must be their exact words. Models / updates the project's data contract (svro.schema.json + svro.workflow.json) from UI component files and business rules, additively. This is the ONLY way to evolve the contract: there is no shell command for it. Pass 'filePaths' (e.g. ['src/components/DeskList.jsx']); 'keyApp' is optional (read from .env). Do NOT read this tool's own JSON definition file from disk (e.g. under ~/.gemini/.../mcp/ozmoz/oz_update_project.json) before calling it \u2014 you already have this schema in context via the tool list; re-reading it wastes time and tokens for no new information. Before calling this tool, ask the user (like the framework question) which analysis depth they want for this modeling pass: briefly explain what this step does and what each mode costs, THEN show only the two options as a bare list (recommended option first) \u2014 and pass their LITERAL reply as 'modeReply' from your very first call. If you forget and call without it, the tool may fail and tell you to ask; that is a fallback, not the normal path. Afterwards run 'npx ozmoz sync' once.",inputSchema:{type:"object",properties:{keyApp:{type:"string",description:"Unique application key (e.g. coworking_prod). Optional: if omitted, it is read from OZ_KEY_APP in the project's .env."},name:{type:"string",description:"Application name"},userApproval:{type:"string",description:"The user's EXACT words authorizing this call: their approval of the screens, or their request to change the data. Never write it yourself."},rules:{type:"string",description:"New business rules, calculations, or state transitions."},reasoning:{type:"string",enum:["standard","high"],description:"DEPRECATED \u2014 ignored. Omit this."},modeReply:{type:"string",description:"MANDATORY \u2014 never omit it, never invent it. Before calling this tool, show the user a numbered [1]/[2] choice for the analysis depth (recommended option first, like you do for the framework question), wait for their reply, then pass their LITERAL reply here (empty/'ok'/'oui' for [1], '2' for [2])."},filePaths:{type:"array",items:{type:"string"},description:"Relative paths of ALL files that call oz.* or define data fields."},viewFiles:{type:"array",items:{type:"object",properties:{name:{type:"string"},content:{type:"string"}},required:["name","content"]},description:"View files already loaded in memory [{ name, content }]."}},required:["name","userApproval","modeReply"]}},{name:"oz_publish_function",description:"Deploys a private or public cloud utility function executed in a secure serverless environment.",inputSchema:{type:"object",properties:{enterpriseID:{type:"string",description:"Project enterpriseID infrastructure identifier"},functionName:{type:"string",description:"Function name (alphanumeric 3-40 chars, e.g. calculateTotal)"},code:{type:"string",description:"JS source code (e.g. async function calculateTotal(payload, oz) { ... })"},description:{type:"string",description:"Action documentation for the catalog and Alex AI"},isPublic:{type:"boolean",description:"true to publish to the global Marketplace, false for private function"}},required:["enterpriseID","functionName","code"]}},{name:"oz_get_contract",description:"Provides the official data contract, SDK directives, production lifecycle and canonical blueprint.",inputSchema:{type:"object",properties:{}}}]}));Bo.setRequestHandler(ao,async e=>{let{name:t,arguments:n}=e.params;if(t==="oz_get_contract")return{content:[{type:"text",text:mS}]};let i=await YR();if(!i)return{isError:!0,content:[{type:"text",text:"Error: FLEETBO_DEV_TOKEN missing. Run 'npx ozmoz login' ONCE, wait for it to finish (the developer approves in the browser), then call this tool again \u2014 no restart needed."}]};try{if(t==="oz_create_project"){let o=ot.object({name:ot.string().min(2),keyApp:ot.string().optional()}).parse(n),{keyApp:a,json:s}=await eC(o,async d=>{let f=await fetch(`https://createprojectlight-${Fh}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify({data:{name:o.name,keyApp:d}})});return{res:f,json:await f.json()}}),c=s.result?.data||s.data||{},u=c.enterpriseId||c.referenceId||c.id,l=`npx ozmoz init --keyApp=${a} --token=${c.bootstrapToken} && npx ozmoz sync`;return{content:[{type:"text",text:JSON.stringify({status:"SUCCESS",message:`Project "${o.name}" successfully created. Ready for bootstrap and modeling.`,enterpriseID:u,keyApp:a,bootstrapToken:c.bootstrapToken,commandInit:l,directive:"Do NOT start any dev server yet. If the folder has no package.json, scaffold the frontend first (step 1), then run commandInit.",nextSteps:await nC(i)},null,2)}]}}if(t==="oz_update_project"){tC(n&&n.userApproval);let r=await rC(Gt.resolve(process.cwd()),n&&n.modeReply,n&&n.reasoning),o=KR(Gt.resolve(process.cwd()))||n?.keyApp?.trim();if(!o)throw new Error("keyApp not provided and OZ_KEY_APP not found in the project's .env. Pass 'keyApp' explicitly.");let{spawnSync:a}=await import("node:child_process"),{fileURLToPath:s}=await import("node:url"),c=Gt.dirname(s(import.meta.url)),l=[[Gt.join(c,"cli.cjs"),Gt.join(c,"cli.js")].find(fr.existsSync)||Gt.join(c,"cli.cjs"),"update",`--reasoning=${r}`];n?.rules&&l.push(`--rules=${n.rules}`),n?.filePaths&&Array.isArray(n.filePaths)&&l.push(`--files=${n.filePaths.join(",")}`);let d=a(process.execPath,l,{cwd:process.cwd(),stdio:"pipe",encoding:"utf8",env:process.env});if(d.status!==0){let f=(d.stderr||d.stdout||"").trim();throw new Error(`Modeling update failed via CLI: ${f||"Unknown execution error"}`)}return{content:[{type:"text",text:JSON.stringify({status:"SUCCESS",keyApp:o,message:"Alex AI a mod\xE9lis\xE9 le contrat \xE0 partir du contractDraft extrait localement et l'a scell\xE9 \xE0 l'Edge.",actionRequired:"none",directive:`1. La structure des donn\xE9es a \xE9t\xE9 extraite et scell\xE9e \xE0 l'Edge via cli.js.
83
83
  2. MANDATORY PHASE 2 CONCLUSION: Present the sync summary, then ask the user inside this exact visual frame:
84
84
  \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
85
85
  \u{1F449} PASSAGE EN MODE Live (R\xC9EL) : Voulez-vous activer la base de donn\xE9es r\xE9elle (OZ_PROTOTYPE=false) ?