@fugood/bricks-cli 2.24.5 → 2.24.7
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/lib/425.js +1 -1
- package/lib/737.js +1 -1
- package/lib/999.js +1 -1
- package/lib/index.js +34 -22
- package/package.json +1 -1
package/lib/737.js
CHANGED
|
@@ -2449,4 +2449,4 @@ export const __webpack_esm_id__=737;export const __webpack_esm_ids__=[737];expor
|
|
|
2449
2449
|
}
|
|
2450
2450
|
}
|
|
2451
2451
|
${zt}
|
|
2452
|
-
`,wn={query:"query",mutation:"mutate"},An=(e,i,t)=>([n,a])=>{if(e[n])throw new Error(`Overwriting client.${n}`);e[n]=async(o,r={})=>{let s,d;const c={[i]:a,variables:o,...r};if(t&&(c.variables={...t,...c.variables}),r.readQuery)s=e.readQuery(c);else if(r.writeQuery)e.writeQuery({...c,data:r.writeQuery});else{const t=await e[wn[i]](c);({data:s,errors:d}=t||{})}if(d)throw new Error(d.map(e=>e.message).join("\n"));return s?s[n]:null}},Sn=e=>({data:i,errors:t})=>{const n=((e,i)=>e?.length?new Error(e.map(e=>e.message).join("\n")):i?new Error(i):null)(t,!i?.mediaBoxChanged&&"Missing mediaBoxChanged payload");return n?e(n):e(null,i.mediaBoxChanged)},Cn=(e={})=>{const i=(({endpoint:e="http://localhost:3002",accessToken:i,boxId:t,passcode:n,enableSubscription:a=!0,enableRetry:o=!0,subscriptionOnConnectionOrError:r,onNetworkError:s}={})=>{const d=t&&n;let c=`${e}/api/graphql`;return d&&(c=`${e}/api/graphql_with_passcode`),Jt({endpointURL:c,subscriptionEndpointURL:c.replace("http:","ws:"),accessToken:i,enableSubscription:!d&&a,enableRetry:o,subscriptionOnConnectionOrError:r,onNetworkError:s})})(e);if(e.boxId&&e.passcode){i.type="passcode",i.queries=l,i.mutations=u;const t={boxId:e.boxId,passcode:e.passcode};Object.entries(l).forEach(An(i,"query",t)),Object.entries(u).forEach(An(i,"mutation",t)),i.listenBoxChanged=(e,n)=>{const a=i.subscribe({query:Dn,variables:{...t,...e}}).subscribe({next:Sn(n),error(e){n(e)}});return a}}else i.accessToken=e.accessToken,i.type="token",i.queries=c,i.mutations=p,Object.entries(c).forEach(An(i,"query")),Object.entries(p).forEach(An(i,"mutation")),i.listenBoxChanged=(e,t)=>{const n=i.subscribe({query:fn,variables:e}).subscribe({next:Sn(t),error(e){t(e)}});return n};return i};var Tn,xn,En,Bn,Un=K(function e(i,t){G(this,e),this.baseUrl=i,this.token=t,this.graphqlUrl=`${i}/api/graphql`},[{key:"graphql",value:(Bn=m(function*(e,i){var t=yield(0,A.Ay)(this.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`,Accept:"application/json"},body:JSON.stringify({query:e,variables:i})});if(!t.ok){var n=yield t.text().catch(()=>"");throw new Error(`Activity-log query failed (${t.status}): ${n}`)}var a=yield t.json();if(a.errors?.length)throw new Error(a.errors.map(e=>e.message).join("\n"));return a.data}),function(e,i){return Bn.apply(this,arguments)})},{key:"events",value:(En=m(function*(e,{limit:i,offset:t}={}){var n={...e};return null!=i&&(n.limit=i),null!=t&&(n.offset=t),(yield this.graphql("\n query AL_events($filter: EventsFilter!) {\n events(filter: $filter) {\n device_id\n event_type\n event_name\n subspace_id\n sender\n payload\n timestamp\n }\n }\n",{filter:n})).events}),function(e){return En.apply(this,arguments)})},{key:"screenshots",value:(xn=m(function*(e){return(yield this.graphql("\n query AL_screenshots($filter: ScreenshotFilter!) {\n screenshots(filter: $filter) {\n timestamp\n }\n }\n",{filter:e})).screenshots}),function(e){return xn.apply(this,arguments)})},{key:"downloadScreenshot",value:(Tn=m(function*(e,i,t){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(i)}/screenshot?ts=${encodeURIComponent(t)}`,a=yield(0,A.Ay)(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!a.ok){var o=yield a.text().catch(()=>"");throw new Error(`Screenshot fetch failed (${a.status}): ${o}`)}return Buffer.from(yield a.arrayBuffer())}),function(e,i,t){return Tn.apply(this,arguments)})}]);function Rn(e,i,t){switch(t){case"user":return new Gi(e,i);case"workspace":return new Ut(e,i);default:throw new Error(`Invalid token type: ${t}.`)}}process.env.STAGE,process.env.URL_BASE;var Mn="bricks-mcp",On={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools",activityLog:process.env.ACTIVITY_LOG_API_SERVER||"https://activity-log-beta.bricks.tools"},Pn=(process.env.AUTH0_DOMAIN,process.env.CACHE_URL,t(1639));const Fn=({type:e,title:i,template_key:t})=>{var n,a,o=(0,Pn.makeId)(e);switch(e){case"subspace":n={title:i,layout:{width:"number",height:"number"},root_canvas_id:"CANVAS_<UUID>",canvas_map:{},brick_map:{},animation_map:{},generator_map:{},property_bank_map:{},property_bank_calc_map:{}},a={"canvas_map.CANVAS_<UUID>.item_list":[{type:"subspace",subspace_id:"SUBSPACE_<UUID>",$note:"If not a root subspace, it can be linked to canvas in other subspace"}]};break;case"canvas":var r=F(P.canvas);n={title:i,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(r.propTypes).map(([e,i])=>[e,{...i,description:r.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(r.eventTypes).map(([e])=>[e,{description:r.brickEventDescriptions[e]}]))}},a={property_bank_map:{[(0,Pn.makeId)("property_bank")]:{title:`Canvas ID: ${i}`,type:"string",value:o,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"}}};break;case"brick":var s=F(P.components.Basic),d=F(P.brickMapping[t]);if(!d)throw new Error(`Brick ${t} not found`);var c={...d,propTypes:{...s.propTypes,...d.propTypes},brickPropDescriptions:{...s.brickPropDescriptions,...d.brickPropDescriptions},eventTypes:{...s.eventTypes,...d.eventTypes},brickEventDescriptions:{...s.brickEventDescriptions,...d.brickEventDescriptions}};n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(c.propTypes).map(([e,i])=>[e,{...i,description:c.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(c.eventTypes).map(([e])=>[e,{description:c.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(c.outletTypes).map(([e])=>[e,{description:c.brickOutletDescriptions[e]}]))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},a={canvas_map:{"CANVAS_<UUID WHICH NEED DISPLAY THIS BRICK>":{item_list:[{type:"brick",brick_id:o,frame:{x:"number",y:"number",width:"number",height:"number",standby_mode:"custom|top|left|right|bottom",standby_delay:"number",standby_easing:{default:{method:"ease",duration:"number"}}}}]}}};break;case"state_group":n={title:i,description:"State Group Description",conds:[{type:"property_bank|inner_state",key:"PROPERTY_BANK#<Data Node ID>|[current_canvas|BRICK_<OUTLET NAME>]|",method:"==|!=|>|>=|<|<=",value:"value_to_compare"}],override:{property:!1,event:!1,outlet:!1},commented:!1,break:!1,property:{},outlet:{},animation:{}};case"generator":var p=F(P.generatorMapping[t]);if(!p)throw new Error(`Generator ${t} not found`);n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(p.propTypes).map(([e,i])=>[e,{...i,description:p.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(p.eventTypes).map(([e])=>[e,{description:p.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(p.outletTypes).map(([e])=>[e,{description:p.brickOutletDescriptions[e]}]))}};break;case"animation":n={title:i,type:"timing|decay|spring",property:"opacity|transform.translateX|transform.scale|etc",config:{$note:"Config for the animation"},compose_type:"parallel|sequence",item_list:[{animation_id:"ANIMATION_<SUB ANIMATION UUID>"}]};break;case"property_bank":n={title:i,description:"Property Bank Description",linkedFrom:"SUBSPACE_<UUID WHICH IS CROSS SUBSPACE>",type:"string|number|bool|object|array|any",kind:"color|datetime|id|media-resource-*|lottie-file-uri",unit:"grid|px|ms",routing:"read-only|default",value:"fit-to-type",event_map:{$note:`Available events: ${Object.keys(P.propertyBank.eventTypes).join(", ")}`},local_sync:{update_mode:"all|main-only|minor-only|dont-sync"},$remote_update_additional:{$note:"Configure remote update behavior",enable_remote_update:!0,bank_type:"create|create-device-specific"}};break;case"property_bank_command":break;case"property_bank_calc":var l=(0,Pn.makeId)("property_bank_command"),u=(0,Pn.makeId)("property_bank_command"),m=(0,Pn.makeId)("property_bank_command"),_="const { arg_name } = inputs;\n\nreturn { arg_name };";n={title:i,map:{$note:"Required, actual implementation","PROPERTY_BANK_DATA_NODE_<UUID>":{type:"data-node",properties:{},in:{change:null},out:{value:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID>",port:"value"}]},$note:"Use this to input data to the sandbox"},"PROPERTY_BANK_COMMAND_NODE_<UUID FIRST>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:null,path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${l}`,port:"obj | inputs"}]}},"PROPERTY_BANK_COMMAND_NODE_<UUID SECOND>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PREVIOUS>",port:"result"}],path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID SECOND>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${l}`,port:"obj | inputs"}]}},[l]:{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:_,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:m,port:"result"},{id:u,port:"result"}]}},[m]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:l,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}},[u]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:l,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT> | null",port:"change"}]}},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT>":{type:"data-node",properties:{},in:{change:[{id:u,port:"result"}]},out:{value:null},$note:"Put full result into data node"},"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>":{type:"command-node-object",title:"Command: OBJECT_GET",properties:{command:"OBJECT_GET",args:{path:"obj_key"}},in:{obj:[{id:u,port:"obj"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>",port:"change"}]},$note:"Parse result object into data node"},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>":{type:"data-node",properties:{},in:{change:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>",port:"result"}]},out:{value:null},$note:"Put partial result into data node"}},editor_info:{},type:"script",script_config:{title:i,enable_async:!1,inputs:{"PROPERTY_BANK_DATA_NODE_<UUID>":"arg_name"},disabled_triggers:{},error:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR> | null",output:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | null",outputs:{obj_key:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>"},code:_,$note:"Required, info for GUI editor"}}}return D({id:o,example:n,extraInfo:a})};function Nn(e,i){var t,n,a,o,r,s,d,c,p,l,u,_,g,f,y,$,v,h,I,C,T,x,E,B,U,R,O,P,F="user"===i.tokenType,N=((e,i=null)=>({name:t,description:n,inputSchema:a,permission:o},r)=>{Y(i,o)&&e.tool(t,n,a,r)})(e,i),q=e=>({...e,...F?{workspace_id:b.Yj().describe("Workspace ID")}:{}}),W=i.client,j=F?function(e){var i=e.endpoint,t=e.accessToken;if(!i)throw new Error("Media API endpoint is required");if(!t)throw new Error("Access token is required");return Cn({endpoint:i,accessToken:t,enableSubscription:!1,enableRetry:!0})}({endpoint:On.media,accessToken:i.token}):W;if(F&&e.tool("list_workspaces","List all workspaces",{},m(function*(){return D(yield W.workspaces())})),N({name:"get_workspace_overview",description:"Get comprehensive overview of the BRICKS workspace including stats and summary",inputSchema:q({}),permission:"info"},(t=m(function*({workspace_id:e}){var i=yield Promise.all([W.workspace({id:e}),W.applications({workspaceId:e,paginate:{limit:50,offset:0}}),W.modules({workspaceId:e,paginate:{limit:50,offset:0}}),W.devices({workspaceId:e,paginate:{limit:50,offset:0}}),F?j.mediaWorkspace({workspaceId:e}).catch(()=>null):j.mediaWorkspace().catch(()=>null),F?j.mediaBoxes({workspaceId:e}).catch(()=>[]):j.mediaBoxes().catch(()=>[])]),t=w(i,6),n=t[0],a=t[1],o=t[2],r=t[3],s=t[4],d=t[5];if(!n)throw new Error("Authentication failed, please check your token");return D({workspace:n,stats:{applications:a?.length??"No permission",modules:o?.length??"No permission",devices:r?.length??"No permission",running_apps:a?.filter(e=>e.status?.running).length??"No permission",media_boxes:d?.length??"No permission",media_enabled:!!s,notes:"Note: The stats are based on the first 50 applications, modules, and devices in the workspace."},recent_activity:{latest_apps:a?.slice(0,5).map(e=>({id:e._id,name:e.name,status:e.status?.running?"running":"stopped",last_update:e.last_modify_datetime}))||[]},media_info:s?{workspace_id:s.id,name:s.name,size_used:s.size,size_limit:s.sizeLimit,boxes:d?.slice(0,5).map(e=>({id:e.id,name:e.name,size:e.size,description:e.description}))||[]}:{enabled:!1,note:"Media workspace is not enabled for this workspace"}})}),function(e){return t.apply(this,arguments)})),N({name:"get_applications",description:"List all applications in the workspace",inputSchema:q({limit:b.ai().describe("Maximum number of applications to return").optional().default(50),offset:b.ai().describe("Number of applications to skip").optional().default(0)}),permission:"query_application"},(n=m(function*({workspace_id:e,limit:i=50,offset:t=0}){return D(yield W.applications({workspaceId:e,paginate:{limit:i,offset:t}}))}),function(e){return n.apply(this,arguments)})),N({name:"get_application",description:"Get detailed info and config of a specific application",inputSchema:q({id:b.Yj().describe("Application ID")}),permission:"query_application"},(a=m(function*({workspace_id:e,id:i}){return D(yield W.application({workspaceId:e,id:i}))}),function(e){return a.apply(this,arguments)})),N({name:"get_modules",description:"List all modules in the workspace",inputSchema:q({limit:b.ai().describe("Maximum number of modules to return").optional().default(50),offset:b.ai().describe("Number of modules to skip").optional().default(0)}),permission:"query_module"},(o=m(function*({workspace_id:e,limit:i=50,offset:t=0}){return D(yield W.modules({workspaceId:e,paginate:{limit:i,offset:t}}))}),function(e){return o.apply(this,arguments)})),N({name:"get_module",description:"Get detailed info and config of a specific module",inputSchema:q({id:b.Yj().describe("Module ID")}),permission:"query_module"},(r=m(function*({workspace_id:e,id:i}){return D(yield W.module({workspaceId:e,id:i}))}),function(e){return r.apply(this,arguments)})),N({name:"update_module_info",description:"Update a specific module info",inputSchema:q({id:b.Yj().describe("Module ID"),name:b.Yj().describe("Module name"),description:b.Yj().describe("Module description")}),permission:"update_module"},(s=m(function*({workspace_id:e,id:i,name:t,description:n}){return D(yield W.updateModule({workspaceId:e,id:i,name:t,description:n}))}),function(e){return s.apply(this,arguments)})),N({name:"update_module_config",description:"Update a specific module configuration",inputSchema:q({id:b.Yj().describe("Module ID"),config:b.Ik({}).passthrough().describe("New configuration object, see file://docs/config-schema.md for schema reference")}),permission:"update_module"},(d=m(function*({workspace_id:e,id:i,config:t}){var n=yield M(t);if(!n.valid)throw new Error(`Config validation failed: ${n.errors.join(", ")}`);return D(yield W.updateModule({workspaceId:e,id:i,config:JSON.stringify(t),validateConfig:!0}))}),function(e){return d.apply(this,arguments)})),N({name:"get_devices",description:"List all devices in the workspace",inputSchema:q({limit:b.ai().describe("Maximum number of devices to return").optional().default(50),offset:b.ai().describe("Number of devices to skip").optional().default(0)}),permission:"query_device"},(c=m(function*({workspace_id:e,limit:i=50,offset:t=0}){return D(yield W.devices({workspaceId:e,paginate:{limit:i,offset:t}}))}),function(e){return c.apply(this,arguments)})),N({name:"create_application",description:"Create a new BRICKS application with default grid layout",inputSchema:q({name:b.Yj().describe("Application name"),description:b.Yj().describe("Application description").optional(),grid_width:b.ai().describe("Grid width in units").optional().default(96),grid_height:b.ai().describe("Grid height in units").optional().default(54)}),permission:"create_application"},(p=m(function*({workspace_id:e,name:i,description:t,grid_width:n,grid_height:a}){return D(yield W.createApplication({workspaceId:e,name:i,description:t,gridWidth:n,gridHeight:a}))}),function(e){return p.apply(this,arguments)})),N({name:"update_application_info",description:"Update application info",inputSchema:{id:b.Yj().describe("Application ID"),name:b.Yj().describe("Application name"),description:b.Yj().describe("Application description")},permission:"update_application"},(l=m(function*({id:e,name:i,description:t}){return D(yield W.updateApplication({id:e,name:i,description:t}))}),function(e){return l.apply(this,arguments)})),N({name:"update_application_config",description:"Update application configuration with validation",inputSchema:{id:b.Yj().describe("Application ID"),config:b.Ik({}).passthrough().describe("New application configuration. Please read `getting-started` for BRICKS concepts before changing")},permission:"update_application"},(u=m(function*({id:e,config:i}){var t=yield M(i);if(!t.valid)throw new Error(`Config validation failed: ${t.errors.join(", ")}`);return D(yield W.updateApplication({id:e,config:JSON.stringify(i)}))}),function(e){return u.apply(this,arguments)})),N({name:"bind_application",description:"Bind application to device with viewport configuration",inputSchema:{app_id:b.Yj().describe("Application ID"),viewports:b.YO(b.Ik({device_id:b.Yj().describe("Device ID"),x:b.ai().describe("X coordinate"),y:b.ai().describe("Y coordinate"),width:b.ai().describe("Width"),height:b.ai().describe("Height"),rotate:b.ai().describe("Rotation"),rotateType:b.Yj().describe("Rotation type")})).describe("Viewport configuration")},permission:"bind_application"},(_=m(function*({app_id:e,viewports:i}){return D(yield W.bindApplication({id:e,bind_devices:i.map(e=>e.device_id),device_frames:i.reduce((e,i)=>({...e,[i.device_id]:{x:i.x,y:i.y,width:i.width,height:i.height,rotate:i.rotate,rotateType:i.rotateType}}),{})}))}),function(e){return _.apply(this,arguments)})),N({name:"unbind_application",description:"Unbind application from device",inputSchema:{app_id:b.Yj().describe("Application ID"),device_id:b.Yj().describe("Device ID")},permission:"bind_application"},(g=m(function*({app_id:e,device_id:i}){return D(yield W.bindApplication({id:e,unbindDevices:[i]}))}),function(e){return g.apply(this,arguments)})),F&&N({name:"list_media_workspaces",description:"List all media workspaces",inputSchema:{},permission:"query_media_flow"},m(function*(){return D(yield j.mediaWorkspaces())})),N({name:"get_media_workspace",description:"Get media workspace information and status",inputSchema:q({}),permission:"query_media_flow"},(f=m(function*({workspace_id:e}){return D(yield j.mediaWorkspace({workspaceId:e}))}),function(e){return f.apply(this,arguments)})),N({name:"list_media_boxes",description:"List all media boxes in the workspace",inputSchema:q({}),permission:"query_media_flow"},(y=m(function*({workspace_id:e}){return D(yield j.mediaBoxes({workspaceId:e}))}),function(e){return y.apply(this,arguments)})),N({name:"get_media_box",description:"Get detailed information about a specific media box",inputSchema:{box_id:b.Yj().describe("Media box ID")},permission:"query_media_flow"},($=m(function*({box_id:e}){return D(yield j.mediaBox({boxId:e}))}),function(e){return $.apply(this,arguments)})),N({name:"list_media_files",description:"List media files in a specific box with filtering options",inputSchema:{box_id:b.Yj().describe("Media box ID"),include_types:b.YO(b.Yj()).optional().describe('Filter by file types (e.g., ["image", "video", "audio"])'),user_tags:b.YO(b.Yj()).optional().describe("Filter by user tags"),limit:b.ai().optional().default(50).describe("Maximum number of files to return"),offset:b.ai().optional().default(0).describe("Number of files to skip")},permission:"query_media_flow"},(v=m(function*({box_id:e,include_types:i,user_tags:t,limit:n,offset:a}){return D(yield j.mediaFiles({boxId:e,includeTypes:i,userTags:t,limit:n,offset:a}))}),function(e){return v.apply(this,arguments)})),N({name:"get_media_file_meta",description:"Get detailed information about a specific media file",inputSchema:{file_id:b.Yj().describe("Media file ID")},permission:"query_media_flow"},(h=m(function*({file_id:e}){return D(yield j.mediaFile({fileId:e}))}),function(e){return h.apply(this,arguments)})),N({name:"media_box_upload",description:"Upload a file to a media box from URL or base64 data",inputSchema:{box_id:b.Yj().describe("Target media box ID"),name:b.Yj().describe("File name"),description:b.Yj().optional().default("").describe("File description"),file_type:b.k5(["image","video","audio","file"]).describe("File type"),source_url:b.Yj().optional().describe("URL to download the file from"),base64_data:b.Yj().optional().describe("Base64 encoded file data"),user_tags:b.YO(b.Yj()).optional().default([]).describe("User-defined tags for the file")},permission:"write_media_flow"},(I=m(function*({box_id:e,name:i,description:t,source_url:n,base64_data:a,file_type:o,user_tags:r}){if(!n&&!a)throw new Error("Either source_url or base64_data must be provided");if(n&&a)throw new Error("Provide either source_url OR base64_data, not both");var s=n?null:"application/octet-stream",d=n?yield(0,A.Ay)(n,{agent:(0,S.fJ)(n)}).then(e=>(s=e.headers.get("content-type"),e.blob())):new Blob([k.Buffer.from(a,"base64")],{type:s}),c=yield j.requestFileUpload({name:i,description:t,boxId:e,fileType:F?o.toUpperCase():o,contentType:s,userTags:r,meta:{}}),p=JSON.parse(c?.meta.uploadInfo),l=new FormData;l.append("file",d),l.append("Content-Type",s),l.append("AWSAccessKeyId",p.AWSAccessKeyId),l.append("Signature",p.Signature),l.append("Policy",p.Policy),l.append("acl",p.acl),l.append("key",p.key);var u=yield(0,A.Ay)(p.url,{method:"POST",body:l}).then(e=>e.ok).catch(()=>!1);return D({file_id:c.id,upload_success:u,upload_info:{content_type:s,file_type:o,source_type:n?"url":"base64",processing_note:"File will be processed automatically. Use get_media_file to check processing status."}})}),function(e){return I.apply(this,arguments)})),N({name:"update_media_file_meta",description:"Update media file information",inputSchema:{file_id:b.Yj().describe("Media file ID"),name:b.Yj().optional().describe("New file name"),description:b.Yj().optional().describe("New file description"),user_tags:b.YO(b.Yj()).optional().describe("New user tags")},permission:"write_media_flow"},(C=m(function*({file_id:e,name:i,description:t,user_tags:n}){return D(yield j.updateMediaFile({fileId:e,name:i,description:t,userTags:n,requestUploadAgain:!1}))}),function(e){return C.apply(this,arguments)})),N({name:"copy_media_files",description:"Copy media files from one box to another",inputSchema:{from_box_id:b.Yj().describe("Source media box ID"),to_box_id:b.Yj().describe("Target media box ID"),file_ids:b.YO(b.Yj()).describe("Array of media file IDs to copy")},permission:"write_media_flow"},(T=m(function*({from_box_id:e,to_box_id:i,file_ids:t}){return D(yield j.copyMediaFiles({fromBoxId:e,toBoxId:i,list:t}))}),function(e){return T.apply(this,arguments)})),N({name:"delete_media_files",description:"Delete specific media files from a box",inputSchema:{box_id:b.Yj().describe("Media box ID"),file_ids:b.YO(b.Yj()).describe("Array of media file IDs to delete")},permission:"write_media_flow"},(x=m(function*({box_id:e,file_ids:i}){return D(yield j.deleteMediaFiles({boxId:e,list:i}))}),function(e){return x.apply(this,arguments)})),N({name:"cleanup_media_box",description:"Delete all files in a media box, optionally filtered by type",inputSchema:{box_id:b.Yj().describe("Media box ID"),include_types:b.YO(b.Yj()).optional().describe('Only delete files of these types (e.g., ["image", "video"])')},permission:"write_media_flow"},(E=m(function*({box_id:e,include_types:i}){if("deleteMediaBoxFiles"in j)return D(yield j.deleteMediaBoxFiles({boxId:e,includeTypes:i}));var t=yield j.mediaFiles({boxId:e,includeTypes:i});return D(yield j.deleteMediaFiles({boxId:e,list:t.map(e=>e.id)}))}),function(e){return E.apply(this,arguments)})),e.tool("calculate_grid_layout","Calculate grid layout and pixel conversions for different device resolutions",{device_width:b.ai().describe("Device width in pixels"),device_height:b.ai().describe("Device height in pixels"),app_grid_width:b.ai().describe("Application grid width").optional().default(96),app_grid_height:b.ai().describe("Application grid height").optional().default(54)},(B=m(function*({device_width:e,device_height:i,app_grid_width:t,app_grid_height:n}){var a,o,r={deviceBrickWidth:(a=e)/(o=a/t),deviceBrickHeight:i/o,deviceBrickUnit:o},s=function(e,i,t=96){var n=e/t;return i>e&&(n=i/t),{deviceBrickWidth:Math.round(e/n),deviceBrickHeight:Math.round(i/n),deviceBrickUnit:n}}(e,i,t);return D({device_resolution:{width:e,height:i,aspect_ratio:(e/i).toFixed(2)},current_grid:{width:t,height:n,unit_size_px:r.deviceBrickUnit.toFixed(2),total_pixels:{width:r.deviceBrickWidth.toFixed(2),height:r.deviceBrickHeight.toFixed(2)}},recommended_grid:{width:s.deviceBrickWidth,height:s.deviceBrickHeight,unit_size_px:s.deviceBrickUnit.toFixed(2),note:"Optimized for device aspect ratio"}})}),function(e){return B.apply(this,arguments)})),e.tool("create_item","Use this tool to create new item that you can put in application configuration",{type:b.k5(["subspace","canvas","brick","generator","property_bank","property_bank_calc","property_bank_command","animation","state_group","automation_map"]).describe("Item type"),title:b.Yj().describe("Item title"),template_key:b.Yj().optional().describe("Template key for brick or generator")},Fn),e.tool("getting_started","Get documentation content for getting started",{},m(function*(){return D(V)})),!F){var K=()=>{return e=On.activityLog,t=i.token,new Un(e,t);var e,t};N({name:"activity_log_events",description:"Query activity log events. Returns raw events (general, data, local_sync) with filtering. Max 30-day range.",inputSchema:q({start_time:b.Yj().describe("Start time (ISO 8601)"),end_time:b.Yj().describe("End time (ISO 8601)"),device_id:b.Yj().optional().describe("Filter by device ID"),event_type:b.k5(["general","data","local_sync"]).optional().describe("Filter by event type"),event_name:b.Yj().optional().describe("Filter by event name (e.g. BRICK_xxx_ON_PRESS)"),subspace_id:b.Yj().optional().describe("Filter by subspace ID"),sender:b.Yj().optional().describe("Filter by sender"),limit:b.ai().optional().default(50).describe("Max events to return per page"),offset:b.ai().optional().default(0).describe("Number of events to skip (for pagination)")}),permission:"query_activity_log"},(O=m(function*({start_time:e,end_time:i,device_id:t,event_type:n,event_name:a,subspace_id:o,sender:r,limit:s=50,offset:d=0}){var c=K(),p={start_time:e,end_time:i};t&&(p.device_id=t),n&&(p.event_type=n),a&&(p.event_name=a),o&&(p.subspace_id=o),r&&(p.sender=r);var l=yield c.events(p,{limit:s,offset:d});return D(l)}),function(e){return O.apply(this,arguments)})),N({name:"activity_log_screenshots",description:"List available screenshot timestamps for a device in a time range.",inputSchema:q({device_id:b.Yj().describe("Device ID (required)"),start_time:b.Yj().describe("Start time (ISO 8601)"),end_time:b.Yj().describe("End time (ISO 8601)")}),permission:"query_activity_log"},(R=m(function*({device_id:e,start_time:i,end_time:t}){var n=K(),a=yield n.screenshots({device_id:e,start_time:i,end_time:t});return D(a)}),function(e){return R.apply(this,arguments)})),N({name:"activity_log_screenshot",description:"Download a device screenshot at a specific timestamp. Returns JPEG image as blob.",inputSchema:q({device_id:b.Yj().describe("Device ID"),ts:b.Yj().describe("Screenshot timestamp (ISO 8601 or epoch ms)")}),permission:"query_activity_log"},(U=m(function*({workspace_id:e,device_id:t,ts:n}){var a=e||i.tokenInfo?.w_id;if(!a)throw new Error("Could not determine workspace ID");var o=K(),r=/^\d+$/.test(n)?n:new Date(n).getTime(),s=yield o.downloadScreenshot(a,t,r);return D(s,{mimeType:"image/jpeg"})}),function(e){return U.apply(this,arguments)}))}N({name:"get_device_usage",description:"Get device usage metrics (uptime, memory, disk) for a date range. Data from BRICKS main server.",inputSchema:q({device_id:b.Yj().describe("Device ID"),start_date:b.Yj().optional().describe("Start date/time in ISO 8601 format (default: start of today)"),end_date:b.Yj().optional().describe("End date/time in ISO 8601 format (default: now)")}),permission:"query_device"},(P=m(function*({device_id:e,start_date:i,end_date:t}){var n=new Date,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()).toISOString(),o=yield W.deviceUsage({deviceId:e,startDate:i?new Date(i).toISOString():a,endDate:t?new Date(t).toISOString():n.toISOString()});return D(o)}),function(e){return P.apply(this,arguments)}))}var qn="2.24.5";function Wn(){return jn.apply(this,arguments)}function jn(){return jn=m(function*(e={}){var i=e.token||process.env.BRICKS_API_TOKEN;if(!i)throw console.error("Error: API token is required"),console.error("Please provide a token via options or set BRICKS_API_TOKEN environment variable"),new Error("API token is required");var t=h({queryStringParameters:{token:i}});if(!t.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(t.message),new Error("Invalid BRICKS_API_TOKEN");var n,a,o=new _._({name:Mn,version:qn}),r={...t,client:Rn(On.bricks,t.token,t.tokenType)};(n=o).prompt("getting-started","Getting started with BRICKS",{},m(function*(){return{messages:[{role:"user",content:{type:"text",text:'Welcome to BRICKS — start here.\n\nBefore doing any complex work (application design, deployments, etc.),\nalways consult the official docs rather than guessing.\n\nIMPORTANT: BRICKS users interact through a GUI editor, not raw config files.\nNever show users JSON config details, schema fields, or technical implementation.\nFocus on user-friendly descriptions of what the app will do and how it will look.\n\nGolden rules for working with BRICKS:\n1) Read before you act\n - Open these resources first, then proceed:\n - `getting-started` — overview & architecture\n - `config-schema` — canonical schema for apps, subspaces, bricks, generators, etc.\n - `components-index` — available bricks/generators\n2) Source of truth\n - Rely on the docs above; do not invent fields not present in the schema\n3) No guessing\n - If names, constraints, or device details are missing, ask to fetch them first\n4) Plan then execute\n - Propose a clear step-by-step plan and wait for approval before writing or mutating data\n5) User-friendly communication\n - Describe features in terms of what users see and do, not technical config\n - Use visual/functional language: "text display", "button", "screen transition"\n - Avoid exposing JSON, IDs, or schema details to end users\n\nBRICKS essentials:\n- Applications: interactive digital signage experiences\n- Devices: deployment targets (screens/players)\n- Modules: Reusable module across applications\n- Grid system: default 96×54; 1 unit = device_width/96 (e.g., 20px at 1920×1080)\n- Key primitives: Subspaces, Canvas, Bricks, Generators, Property Banks (Data)\n\nQuick actions:\n- "Create a new application" → use the `create-application` prompt\n- "Deploy an application to a device" → use the `deploy-to-device` prompt\n\nTry asking:\n- "Draft a plan to create an app with a text display and deploy it; ask any missing questions first"'}}]}})),n.prompt("create-application","Create a new BRICKS application with guided setup",{app_name:b.Yj().describe("Name for the new application"),description:b.Yj().describe("Short description for the new application").optional()},(a=m(function*(e){var i=e?.app_name||"New Application",t=e?.description||"";return{messages:[{role:"user",content:{type:"text",text:`Help me create a new BRICKS application called "${i}".\n\n${t?`Goal: ${t}`:""}\n\nIMPORTANT: Users see a visual GUI editor, not raw config. Describe features in user-friendly terms:\n- "text display" not "BRICK_TEXT"\n- "image" not "BRICK_IMAGE"\n- "canvas name" not "CANVAS_xxx"\n- "data storage" not "PROPERTY_BANK"\n- Focus on what users see and do, not technical implementation\n\nHow we'll proceed (no guessing, schema-first):\n1) Confirm intent\n - Restate objectives and success criteria in 1–3 bullets\n2) Consult docs (as needed)\n - getting-started, config-schema, components-index\n - Ensure proposed fields exist in the schema\n3) Ask missing questions before changes\n - Target device(s) and resolution(s)\n - Layout needs (pages/screens), content types, data sources\n - Localization, scheduling, or interaction needs\n4) Propose a minimal viable design (After confirming intent)\n - App structure: screens → visual elements\n - Initial component selection with rationale\n - Grid usage: default 96×54 (≈20px at 1920×1080)\n5) Produce a schema-valid skeleton (no side effects yet)\n - Include only fields defined by config-schema\n - Use clear placeholders for text/assets/URLs/ids\n\nWhat I'll produce first:\n- Short recap of requirements\n- Clarifying questions (only what's necessary)\n- High-level architecture plan\n- Minimal config skeleton that validates against the schema`}}]}}),function(e){return a.apply(this,arguments)})),function(e){e.resource("getting-started-docs","file://docs/getting-started.md",{mimeType:"text/markdown",title:"Getting Started with BRICKS",description:"Comprehensive guide to BRICKS architecture, concepts, and development workflow"},m(function*(){return D(I,{uri:"file://docs/getting-started.md",mimeType:"text/markdown"})}))}(o),Nn(o,r);var s=new g.S;try{yield o.connect(s),console.error("BRICKS MCP Server running on STDIO"),console.error(`Server: ${Mn} v${qn}`),console.error(`Token Type: ${t.tokenType}`),console.error(`Permissions: ${t.tokenInfo.permissions.join(", ")}`),console.error("Ready to accept requests...")}catch(e){throw console.error("Failed to start MCP server:",e),e}}),jn.apply(this,arguments)}}};
|
|
2452
|
+
`,wn={query:"query",mutation:"mutate"},An=(e,i,t)=>([n,a])=>{if(e[n])throw new Error(`Overwriting client.${n}`);e[n]=async(o,r={})=>{let s,d;const c={[i]:a,variables:o,...r};if(t&&(c.variables={...t,...c.variables}),r.readQuery)s=e.readQuery(c);else if(r.writeQuery)e.writeQuery({...c,data:r.writeQuery});else{const t=await e[wn[i]](c);({data:s,errors:d}=t||{})}if(d)throw new Error(d.map(e=>e.message).join("\n"));return s?s[n]:null}},Sn=e=>({data:i,errors:t})=>{const n=((e,i)=>e?.length?new Error(e.map(e=>e.message).join("\n")):i?new Error(i):null)(t,!i?.mediaBoxChanged&&"Missing mediaBoxChanged payload");return n?e(n):e(null,i.mediaBoxChanged)},Cn=(e={})=>{const i=(({endpoint:e="http://localhost:3002",accessToken:i,boxId:t,passcode:n,enableSubscription:a=!0,enableRetry:o=!0,subscriptionOnConnectionOrError:r,onNetworkError:s}={})=>{const d=t&&n;let c=`${e}/api/graphql`;return d&&(c=`${e}/api/graphql_with_passcode`),Jt({endpointURL:c,subscriptionEndpointURL:c.replace("http:","ws:"),accessToken:i,enableSubscription:!d&&a,enableRetry:o,subscriptionOnConnectionOrError:r,onNetworkError:s})})(e);if(e.boxId&&e.passcode){i.type="passcode",i.queries=l,i.mutations=u;const t={boxId:e.boxId,passcode:e.passcode};Object.entries(l).forEach(An(i,"query",t)),Object.entries(u).forEach(An(i,"mutation",t)),i.listenBoxChanged=(e,n)=>{const a=i.subscribe({query:Dn,variables:{...t,...e}}).subscribe({next:Sn(n),error(e){n(e)}});return a}}else i.accessToken=e.accessToken,i.type="token",i.queries=c,i.mutations=p,Object.entries(c).forEach(An(i,"query")),Object.entries(p).forEach(An(i,"mutation")),i.listenBoxChanged=(e,t)=>{const n=i.subscribe({query:fn,variables:e}).subscribe({next:Sn(t),error(e){t(e)}});return n};return i};var Tn,xn,En,Bn,Un=K(function e(i,t){G(this,e),this.baseUrl=i,this.token=t,this.graphqlUrl=`${i}/api/graphql`},[{key:"graphql",value:(Bn=m(function*(e,i){var t=yield(0,A.Ay)(this.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`,Accept:"application/json"},body:JSON.stringify({query:e,variables:i})});if(!t.ok){var n=yield t.text().catch(()=>"");throw new Error(`Activity-log query failed (${t.status}): ${n}`)}var a=yield t.json();if(a.errors?.length)throw new Error(a.errors.map(e=>e.message).join("\n"));return a.data}),function(e,i){return Bn.apply(this,arguments)})},{key:"events",value:(En=m(function*(e,{limit:i,offset:t}={}){var n={...e};return null!=i&&(n.limit=i),null!=t&&(n.offset=t),(yield this.graphql("\n query AL_events($filter: EventsFilter!) {\n events(filter: $filter) {\n device_id\n event_type\n event_name\n subspace_id\n sender\n payload\n timestamp\n }\n }\n",{filter:n})).events}),function(e){return En.apply(this,arguments)})},{key:"screenshots",value:(xn=m(function*(e){return(yield this.graphql("\n query AL_screenshots($filter: ScreenshotFilter!) {\n screenshots(filter: $filter) {\n timestamp\n }\n }\n",{filter:e})).screenshots}),function(e){return xn.apply(this,arguments)})},{key:"downloadScreenshot",value:(Tn=m(function*(e,i,t){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(i)}/screenshot?ts=${encodeURIComponent(t)}`,a=yield(0,A.Ay)(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!a.ok){var o=yield a.text().catch(()=>"");throw new Error(`Screenshot fetch failed (${a.status}): ${o}`)}return Buffer.from(yield a.arrayBuffer())}),function(e,i,t){return Tn.apply(this,arguments)})}]);function Rn(e,i,t){switch(t){case"user":return new Gi(e,i);case"workspace":return new Ut(e,i);default:throw new Error(`Invalid token type: ${t}.`)}}process.env.STAGE,process.env.URL_BASE;var Mn="bricks-mcp",On={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools",activityLog:process.env.ACTIVITY_LOG_API_SERVER||"https://activity-log-beta.bricks.tools"},Pn=(process.env.AUTH0_DOMAIN,process.env.CACHE_URL,t(1639));const Fn=({type:e,title:i,template_key:t})=>{var n,a,o=(0,Pn.makeId)(e);switch(e){case"subspace":n={title:i,layout:{width:"number",height:"number"},root_canvas_id:"CANVAS_<UUID>",canvas_map:{},brick_map:{},animation_map:{},generator_map:{},property_bank_map:{},property_bank_calc_map:{}},a={"canvas_map.CANVAS_<UUID>.item_list":[{type:"subspace",subspace_id:"SUBSPACE_<UUID>",$note:"If not a root subspace, it can be linked to canvas in other subspace"}]};break;case"canvas":var r=F(P.canvas);n={title:i,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(r.propTypes).map(([e,i])=>[e,{...i,description:r.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(r.eventTypes).map(([e])=>[e,{description:r.brickEventDescriptions[e]}]))}},a={property_bank_map:{[(0,Pn.makeId)("property_bank")]:{title:`Canvas ID: ${i}`,type:"string",value:o,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"}}};break;case"brick":var s=F(P.components.Basic),d=F(P.brickMapping[t]);if(!d)throw new Error(`Brick ${t} not found`);var c={...d,propTypes:{...s.propTypes,...d.propTypes},brickPropDescriptions:{...s.brickPropDescriptions,...d.brickPropDescriptions},eventTypes:{...s.eventTypes,...d.eventTypes},brickEventDescriptions:{...s.brickEventDescriptions,...d.brickEventDescriptions}};n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(c.propTypes).map(([e,i])=>[e,{...i,description:c.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(c.eventTypes).map(([e])=>[e,{description:c.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(c.outletTypes).map(([e])=>[e,{description:c.brickOutletDescriptions[e]}]))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},a={canvas_map:{"CANVAS_<UUID WHICH NEED DISPLAY THIS BRICK>":{item_list:[{type:"brick",brick_id:o,frame:{x:"number",y:"number",width:"number",height:"number",standby_mode:"custom|top|left|right|bottom",standby_delay:"number",standby_easing:{default:{method:"ease",duration:"number"}}}}]}}};break;case"state_group":n={title:i,description:"State Group Description",conds:[{type:"property_bank|inner_state",key:"PROPERTY_BANK#<Data Node ID>|[current_canvas|BRICK_<OUTLET NAME>]|",method:"==|!=|>|>=|<|<=",value:"value_to_compare"}],override:{property:!1,event:!1,outlet:!1},commented:!1,break:!1,property:{},outlet:{},animation:{}};case"generator":var p=F(P.generatorMapping[t]);if(!p)throw new Error(`Generator ${t} not found`);n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(p.propTypes).map(([e,i])=>[e,{...i,description:p.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(p.eventTypes).map(([e])=>[e,{description:p.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(p.outletTypes).map(([e])=>[e,{description:p.brickOutletDescriptions[e]}]))}};break;case"animation":n={title:i,type:"timing|decay|spring",property:"opacity|transform.translateX|transform.scale|etc",config:{$note:"Config for the animation"},compose_type:"parallel|sequence",item_list:[{animation_id:"ANIMATION_<SUB ANIMATION UUID>"}]};break;case"property_bank":n={title:i,description:"Property Bank Description",linkedFrom:"SUBSPACE_<UUID WHICH IS CROSS SUBSPACE>",type:"string|number|bool|object|array|any",kind:"color|datetime|id|media-resource-*|lottie-file-uri",unit:"grid|px|ms",routing:"read-only|default",value:"fit-to-type",event_map:{$note:`Available events: ${Object.keys(P.propertyBank.eventTypes).join(", ")}`},local_sync:{update_mode:"all|main-only|minor-only|dont-sync"},$remote_update_additional:{$note:"Configure remote update behavior",enable_remote_update:!0,bank_type:"create|create-device-specific"}};break;case"property_bank_command":break;case"property_bank_calc":var l=(0,Pn.makeId)("property_bank_command"),u=(0,Pn.makeId)("property_bank_command"),m=(0,Pn.makeId)("property_bank_command"),_="const { arg_name } = inputs;\n\nreturn { arg_name };";n={title:i,map:{$note:"Required, actual implementation","PROPERTY_BANK_DATA_NODE_<UUID>":{type:"data-node",properties:{},in:{change:null},out:{value:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID>",port:"value"}]},$note:"Use this to input data to the sandbox"},"PROPERTY_BANK_COMMAND_NODE_<UUID FIRST>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:null,path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${l}`,port:"obj | inputs"}]}},"PROPERTY_BANK_COMMAND_NODE_<UUID SECOND>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PREVIOUS>",port:"result"}],path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID SECOND>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${l}`,port:"obj | inputs"}]}},[l]:{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:_,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:m,port:"result"},{id:u,port:"result"}]}},[m]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:l,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}},[u]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:l,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT> | null",port:"change"}]}},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT>":{type:"data-node",properties:{},in:{change:[{id:u,port:"result"}]},out:{value:null},$note:"Put full result into data node"},"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>":{type:"command-node-object",title:"Command: OBJECT_GET",properties:{command:"OBJECT_GET",args:{path:"obj_key"}},in:{obj:[{id:u,port:"obj"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>",port:"change"}]},$note:"Parse result object into data node"},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>":{type:"data-node",properties:{},in:{change:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>",port:"result"}]},out:{value:null},$note:"Put partial result into data node"}},editor_info:{},type:"script",script_config:{title:i,enable_async:!1,inputs:{"PROPERTY_BANK_DATA_NODE_<UUID>":"arg_name"},disabled_triggers:{},error:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR> | null",output:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | null",outputs:{obj_key:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>"},code:_,$note:"Required, info for GUI editor"}}}return D({id:o,example:n,extraInfo:a})};function Nn(e,i){var t,n,a,o,r,s,d,c,p,l,u,_,g,f,y,$,v,h,I,C,T,x,E,B,U,R,O,P,F="user"===i.tokenType,N=((e,i=null)=>({name:t,description:n,inputSchema:a,permission:o},r)=>{Y(i,o)&&e.tool(t,n,a,r)})(e,i),q=e=>({...e,...F?{workspace_id:b.Yj().describe("Workspace ID")}:{}}),W=i.client,j=F?function(e){var i=e.endpoint,t=e.accessToken;if(!i)throw new Error("Media API endpoint is required");if(!t)throw new Error("Access token is required");return Cn({endpoint:i,accessToken:t,enableSubscription:!1,enableRetry:!0})}({endpoint:On.media,accessToken:i.token}):W;if(F&&e.tool("list_workspaces","List all workspaces",{},m(function*(){return D(yield W.workspaces())})),N({name:"get_workspace_overview",description:"Get comprehensive overview of the BRICKS workspace including stats and summary",inputSchema:q({}),permission:"info"},(t=m(function*({workspace_id:e}){var i=yield Promise.all([W.workspace({id:e}),W.applications({workspaceId:e,paginate:{limit:50,offset:0}}),W.modules({workspaceId:e,paginate:{limit:50,offset:0}}),W.devices({workspaceId:e,paginate:{limit:50,offset:0}}),F?j.mediaWorkspace({workspaceId:e}).catch(()=>null):j.mediaWorkspace().catch(()=>null),F?j.mediaBoxes({workspaceId:e}).catch(()=>[]):j.mediaBoxes().catch(()=>[])]),t=w(i,6),n=t[0],a=t[1],o=t[2],r=t[3],s=t[4],d=t[5];if(!n)throw new Error("Authentication failed, please check your token");return D({workspace:n,stats:{applications:a?.length??"No permission",modules:o?.length??"No permission",devices:r?.length??"No permission",running_apps:a?.filter(e=>e.status?.running).length??"No permission",media_boxes:d?.length??"No permission",media_enabled:!!s,notes:"Note: The stats are based on the first 50 applications, modules, and devices in the workspace."},recent_activity:{latest_apps:a?.slice(0,5).map(e=>({id:e._id,name:e.name,status:e.status?.running?"running":"stopped",last_update:e.last_modify_datetime}))||[]},media_info:s?{workspace_id:s.id,name:s.name,size_used:s.size,size_limit:s.sizeLimit,boxes:d?.slice(0,5).map(e=>({id:e.id,name:e.name,size:e.size,description:e.description}))||[]}:{enabled:!1,note:"Media workspace is not enabled for this workspace"}})}),function(e){return t.apply(this,arguments)})),N({name:"get_applications",description:"List all applications in the workspace",inputSchema:q({limit:b.ai().describe("Maximum number of applications to return").optional().default(50),offset:b.ai().describe("Number of applications to skip").optional().default(0)}),permission:"query_application"},(n=m(function*({workspace_id:e,limit:i=50,offset:t=0}){return D(yield W.applications({workspaceId:e,paginate:{limit:i,offset:t}}))}),function(e){return n.apply(this,arguments)})),N({name:"get_application",description:"Get detailed info and config of a specific application",inputSchema:q({id:b.Yj().describe("Application ID")}),permission:"query_application"},(a=m(function*({workspace_id:e,id:i}){return D(yield W.application({workspaceId:e,id:i}))}),function(e){return a.apply(this,arguments)})),N({name:"get_modules",description:"List all modules in the workspace",inputSchema:q({limit:b.ai().describe("Maximum number of modules to return").optional().default(50),offset:b.ai().describe("Number of modules to skip").optional().default(0)}),permission:"query_module"},(o=m(function*({workspace_id:e,limit:i=50,offset:t=0}){return D(yield W.modules({workspaceId:e,paginate:{limit:i,offset:t}}))}),function(e){return o.apply(this,arguments)})),N({name:"get_module",description:"Get detailed info and config of a specific module",inputSchema:q({id:b.Yj().describe("Module ID")}),permission:"query_module"},(r=m(function*({workspace_id:e,id:i}){return D(yield W.module({workspaceId:e,id:i}))}),function(e){return r.apply(this,arguments)})),N({name:"update_module_info",description:"Update a specific module info",inputSchema:q({id:b.Yj().describe("Module ID"),name:b.Yj().describe("Module name"),description:b.Yj().describe("Module description")}),permission:"update_module"},(s=m(function*({workspace_id:e,id:i,name:t,description:n}){return D(yield W.updateModule({workspaceId:e,id:i,name:t,description:n}))}),function(e){return s.apply(this,arguments)})),N({name:"update_module_config",description:"Update a specific module configuration",inputSchema:q({id:b.Yj().describe("Module ID"),config:b.Ik({}).passthrough().describe("New configuration object, see file://docs/config-schema.md for schema reference")}),permission:"update_module"},(d=m(function*({workspace_id:e,id:i,config:t}){var n=yield M(t);if(!n.valid)throw new Error(`Config validation failed: ${n.errors.join(", ")}`);return D(yield W.updateModule({workspaceId:e,id:i,config:JSON.stringify(t),validateConfig:!0}))}),function(e){return d.apply(this,arguments)})),N({name:"get_devices",description:"List all devices in the workspace",inputSchema:q({limit:b.ai().describe("Maximum number of devices to return").optional().default(50),offset:b.ai().describe("Number of devices to skip").optional().default(0)}),permission:"query_device"},(c=m(function*({workspace_id:e,limit:i=50,offset:t=0}){return D(yield W.devices({workspaceId:e,paginate:{limit:i,offset:t}}))}),function(e){return c.apply(this,arguments)})),N({name:"create_application",description:"Create a new BRICKS application with default grid layout",inputSchema:q({name:b.Yj().describe("Application name"),description:b.Yj().describe("Application description").optional(),grid_width:b.ai().describe("Grid width in units").optional().default(96),grid_height:b.ai().describe("Grid height in units").optional().default(54)}),permission:"create_application"},(p=m(function*({workspace_id:e,name:i,description:t,grid_width:n,grid_height:a}){return D(yield W.createApplication({workspaceId:e,name:i,description:t,gridWidth:n,gridHeight:a}))}),function(e){return p.apply(this,arguments)})),N({name:"update_application_info",description:"Update application info",inputSchema:{id:b.Yj().describe("Application ID"),name:b.Yj().describe("Application name"),description:b.Yj().describe("Application description")},permission:"update_application"},(l=m(function*({id:e,name:i,description:t}){return D(yield W.updateApplication({id:e,name:i,description:t}))}),function(e){return l.apply(this,arguments)})),N({name:"update_application_config",description:"Update application configuration with validation",inputSchema:{id:b.Yj().describe("Application ID"),config:b.Ik({}).passthrough().describe("New application configuration. Please read `getting-started` for BRICKS concepts before changing")},permission:"update_application"},(u=m(function*({id:e,config:i}){var t=yield M(i);if(!t.valid)throw new Error(`Config validation failed: ${t.errors.join(", ")}`);return D(yield W.updateApplication({id:e,config:JSON.stringify(i)}))}),function(e){return u.apply(this,arguments)})),N({name:"bind_application",description:"Bind application to device with viewport configuration",inputSchema:{app_id:b.Yj().describe("Application ID"),viewports:b.YO(b.Ik({device_id:b.Yj().describe("Device ID"),x:b.ai().describe("X coordinate"),y:b.ai().describe("Y coordinate"),width:b.ai().describe("Width"),height:b.ai().describe("Height"),rotate:b.ai().describe("Rotation"),rotateType:b.Yj().describe("Rotation type")})).describe("Viewport configuration")},permission:"bind_application"},(_=m(function*({app_id:e,viewports:i}){return D(yield W.bindApplication({id:e,bind_devices:i.map(e=>e.device_id),device_frames:i.reduce((e,i)=>({...e,[i.device_id]:{x:i.x,y:i.y,width:i.width,height:i.height,rotate:i.rotate,rotateType:i.rotateType}}),{})}))}),function(e){return _.apply(this,arguments)})),N({name:"unbind_application",description:"Unbind application from device",inputSchema:{app_id:b.Yj().describe("Application ID"),device_id:b.Yj().describe("Device ID")},permission:"bind_application"},(g=m(function*({app_id:e,device_id:i}){return D(yield W.bindApplication({id:e,unbindDevices:[i]}))}),function(e){return g.apply(this,arguments)})),F&&N({name:"list_media_workspaces",description:"List all media workspaces",inputSchema:{},permission:"query_media_flow"},m(function*(){return D(yield j.mediaWorkspaces())})),N({name:"get_media_workspace",description:"Get media workspace information and status",inputSchema:q({}),permission:"query_media_flow"},(f=m(function*({workspace_id:e}){return D(yield j.mediaWorkspace({workspaceId:e}))}),function(e){return f.apply(this,arguments)})),N({name:"list_media_boxes",description:"List all media boxes in the workspace",inputSchema:q({}),permission:"query_media_flow"},(y=m(function*({workspace_id:e}){return D(yield j.mediaBoxes({workspaceId:e}))}),function(e){return y.apply(this,arguments)})),N({name:"get_media_box",description:"Get detailed information about a specific media box",inputSchema:{box_id:b.Yj().describe("Media box ID")},permission:"query_media_flow"},($=m(function*({box_id:e}){return D(yield j.mediaBox({boxId:e}))}),function(e){return $.apply(this,arguments)})),N({name:"list_media_files",description:"List media files in a specific box with filtering options",inputSchema:{box_id:b.Yj().describe("Media box ID"),include_types:b.YO(b.Yj()).optional().describe('Filter by file types (e.g., ["image", "video", "audio"])'),user_tags:b.YO(b.Yj()).optional().describe("Filter by user tags"),limit:b.ai().optional().default(50).describe("Maximum number of files to return"),offset:b.ai().optional().default(0).describe("Number of files to skip")},permission:"query_media_flow"},(v=m(function*({box_id:e,include_types:i,user_tags:t,limit:n,offset:a}){return D(yield j.mediaFiles({boxId:e,includeTypes:i,userTags:t,limit:n,offset:a}))}),function(e){return v.apply(this,arguments)})),N({name:"get_media_file_meta",description:"Get detailed information about a specific media file",inputSchema:{file_id:b.Yj().describe("Media file ID")},permission:"query_media_flow"},(h=m(function*({file_id:e}){return D(yield j.mediaFile({fileId:e}))}),function(e){return h.apply(this,arguments)})),N({name:"media_box_upload",description:"Upload a file to a media box from URL or base64 data",inputSchema:{box_id:b.Yj().describe("Target media box ID"),name:b.Yj().describe("File name"),description:b.Yj().optional().default("").describe("File description"),file_type:b.k5(["image","video","audio","file"]).describe("File type"),source_url:b.Yj().optional().describe("URL to download the file from"),base64_data:b.Yj().optional().describe("Base64 encoded file data"),user_tags:b.YO(b.Yj()).optional().default([]).describe("User-defined tags for the file")},permission:"write_media_flow"},(I=m(function*({box_id:e,name:i,description:t,source_url:n,base64_data:a,file_type:o,user_tags:r}){if(!n&&!a)throw new Error("Either source_url or base64_data must be provided");if(n&&a)throw new Error("Provide either source_url OR base64_data, not both");var s=n?null:"application/octet-stream",d=n?yield(0,A.Ay)(n,{agent:(0,S.fJ)(n)}).then(e=>(s=e.headers.get("content-type"),e.blob())):new Blob([k.Buffer.from(a,"base64")],{type:s}),c=yield j.requestFileUpload({name:i,description:t,boxId:e,fileType:F?o.toUpperCase():o,contentType:s,userTags:r,meta:{}}),p=JSON.parse(c?.meta.uploadInfo),l=new FormData;l.append("file",d),l.append("Content-Type",s),l.append("AWSAccessKeyId",p.AWSAccessKeyId),l.append("Signature",p.Signature),l.append("Policy",p.Policy),l.append("acl",p.acl),l.append("key",p.key);var u=yield(0,A.Ay)(p.url,{method:"POST",body:l}).then(e=>e.ok).catch(()=>!1);return D({file_id:c.id,upload_success:u,upload_info:{content_type:s,file_type:o,source_type:n?"url":"base64",processing_note:"File will be processed automatically. Use get_media_file to check processing status."}})}),function(e){return I.apply(this,arguments)})),N({name:"update_media_file_meta",description:"Update media file information",inputSchema:{file_id:b.Yj().describe("Media file ID"),name:b.Yj().optional().describe("New file name"),description:b.Yj().optional().describe("New file description"),user_tags:b.YO(b.Yj()).optional().describe("New user tags")},permission:"write_media_flow"},(C=m(function*({file_id:e,name:i,description:t,user_tags:n}){return D(yield j.updateMediaFile({fileId:e,name:i,description:t,userTags:n,requestUploadAgain:!1}))}),function(e){return C.apply(this,arguments)})),N({name:"copy_media_files",description:"Copy media files from one box to another",inputSchema:{from_box_id:b.Yj().describe("Source media box ID"),to_box_id:b.Yj().describe("Target media box ID"),file_ids:b.YO(b.Yj()).describe("Array of media file IDs to copy")},permission:"write_media_flow"},(T=m(function*({from_box_id:e,to_box_id:i,file_ids:t}){return D(yield j.copyMediaFiles({fromBoxId:e,toBoxId:i,list:t}))}),function(e){return T.apply(this,arguments)})),N({name:"delete_media_files",description:"Delete specific media files from a box",inputSchema:{box_id:b.Yj().describe("Media box ID"),file_ids:b.YO(b.Yj()).describe("Array of media file IDs to delete")},permission:"write_media_flow"},(x=m(function*({box_id:e,file_ids:i}){return D(yield j.deleteMediaFiles({boxId:e,list:i}))}),function(e){return x.apply(this,arguments)})),N({name:"cleanup_media_box",description:"Delete all files in a media box, optionally filtered by type",inputSchema:{box_id:b.Yj().describe("Media box ID"),include_types:b.YO(b.Yj()).optional().describe('Only delete files of these types (e.g., ["image", "video"])')},permission:"write_media_flow"},(E=m(function*({box_id:e,include_types:i}){if("deleteMediaBoxFiles"in j)return D(yield j.deleteMediaBoxFiles({boxId:e,includeTypes:i}));var t=yield j.mediaFiles({boxId:e,includeTypes:i});return D(yield j.deleteMediaFiles({boxId:e,list:t.map(e=>e.id)}))}),function(e){return E.apply(this,arguments)})),e.tool("calculate_grid_layout","Calculate grid layout and pixel conversions for different device resolutions",{device_width:b.ai().describe("Device width in pixels"),device_height:b.ai().describe("Device height in pixels"),app_grid_width:b.ai().describe("Application grid width").optional().default(96),app_grid_height:b.ai().describe("Application grid height").optional().default(54)},(B=m(function*({device_width:e,device_height:i,app_grid_width:t,app_grid_height:n}){var a,o,r={deviceBrickWidth:(a=e)/(o=a/t),deviceBrickHeight:i/o,deviceBrickUnit:o},s=function(e,i,t=96){var n=e/t;return i>e&&(n=i/t),{deviceBrickWidth:Math.round(e/n),deviceBrickHeight:Math.round(i/n),deviceBrickUnit:n}}(e,i,t);return D({device_resolution:{width:e,height:i,aspect_ratio:(e/i).toFixed(2)},current_grid:{width:t,height:n,unit_size_px:r.deviceBrickUnit.toFixed(2),total_pixels:{width:r.deviceBrickWidth.toFixed(2),height:r.deviceBrickHeight.toFixed(2)}},recommended_grid:{width:s.deviceBrickWidth,height:s.deviceBrickHeight,unit_size_px:s.deviceBrickUnit.toFixed(2),note:"Optimized for device aspect ratio"}})}),function(e){return B.apply(this,arguments)})),e.tool("create_item","Use this tool to create new item that you can put in application configuration",{type:b.k5(["subspace","canvas","brick","generator","property_bank","property_bank_calc","property_bank_command","animation","state_group","automation_map"]).describe("Item type"),title:b.Yj().describe("Item title"),template_key:b.Yj().optional().describe("Template key for brick or generator")},Fn),e.tool("getting_started","Get documentation content for getting started",{},m(function*(){return D(V)})),!F){var K=()=>{return e=On.activityLog,t=i.token,new Un(e,t);var e,t};N({name:"activity_log_events",description:"Query activity log events. Returns raw events (general, data, local_sync) with filtering. Max 30-day range.",inputSchema:q({start_time:b.Yj().describe("Start time (ISO 8601)"),end_time:b.Yj().describe("End time (ISO 8601)"),device_id:b.Yj().optional().describe("Filter by device ID"),event_type:b.k5(["general","data","local_sync"]).optional().describe("Filter by event type"),event_name:b.Yj().optional().describe("Filter by event name (e.g. BRICK_xxx_ON_PRESS)"),subspace_id:b.Yj().optional().describe("Filter by subspace ID"),sender:b.Yj().optional().describe("Filter by sender"),limit:b.ai().optional().default(50).describe("Max events to return per page"),offset:b.ai().optional().default(0).describe("Number of events to skip (for pagination)")}),permission:"query_activity_log"},(O=m(function*({start_time:e,end_time:i,device_id:t,event_type:n,event_name:a,subspace_id:o,sender:r,limit:s=50,offset:d=0}){var c=K(),p={start_time:e,end_time:i};t&&(p.device_id=t),n&&(p.event_type=n),a&&(p.event_name=a),o&&(p.subspace_id=o),r&&(p.sender=r);var l=yield c.events(p,{limit:s,offset:d});return D(l)}),function(e){return O.apply(this,arguments)})),N({name:"activity_log_screenshots",description:"List available screenshot timestamps for a device in a time range.",inputSchema:q({device_id:b.Yj().describe("Device ID (required)"),start_time:b.Yj().describe("Start time (ISO 8601)"),end_time:b.Yj().describe("End time (ISO 8601)")}),permission:"query_activity_log"},(R=m(function*({device_id:e,start_time:i,end_time:t}){var n=K(),a=yield n.screenshots({device_id:e,start_time:i,end_time:t});return D(a)}),function(e){return R.apply(this,arguments)})),N({name:"activity_log_screenshot",description:"Download a device screenshot at a specific timestamp. Returns JPEG image as blob.",inputSchema:q({device_id:b.Yj().describe("Device ID"),ts:b.Yj().describe("Screenshot timestamp (ISO 8601 or epoch ms)")}),permission:"query_activity_log"},(U=m(function*({workspace_id:e,device_id:t,ts:n}){var a=e||i.tokenInfo?.w_id;if(!a)throw new Error("Could not determine workspace ID");var o=K(),r=/^\d+$/.test(n)?n:new Date(n).getTime(),s=yield o.downloadScreenshot(a,t,r);return D(s,{mimeType:"image/jpeg"})}),function(e){return U.apply(this,arguments)}))}N({name:"get_device_usage",description:"Get device usage metrics (uptime, memory, disk) for a date range. Data from BRICKS main server.",inputSchema:q({device_id:b.Yj().describe("Device ID"),start_date:b.Yj().optional().describe("Start date/time in ISO 8601 format (default: start of today)"),end_date:b.Yj().optional().describe("End date/time in ISO 8601 format (default: now)")}),permission:"query_device"},(P=m(function*({device_id:e,start_date:i,end_date:t}){var n=new Date,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()).toISOString(),o=yield W.deviceUsage({deviceId:e,startDate:i?new Date(i).toISOString():a,endDate:t?new Date(t).toISOString():n.toISOString()});return D(o)}),function(e){return P.apply(this,arguments)}))}var qn="2.24.7";function Wn(){return jn.apply(this,arguments)}function jn(){return jn=m(function*(e={}){var i=e.token||process.env.BRICKS_API_TOKEN;if(!i)throw console.error("Error: API token is required"),console.error("Please provide a token via options or set BRICKS_API_TOKEN environment variable"),new Error("API token is required");var t=h({queryStringParameters:{token:i}});if(!t.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(t.message),new Error("Invalid BRICKS_API_TOKEN");var n,a,o=new _._({name:Mn,version:qn}),r={...t,client:Rn(On.bricks,t.token,t.tokenType)};(n=o).prompt("getting-started","Getting started with BRICKS",{},m(function*(){return{messages:[{role:"user",content:{type:"text",text:'Welcome to BRICKS — start here.\n\nBefore doing any complex work (application design, deployments, etc.),\nalways consult the official docs rather than guessing.\n\nIMPORTANT: BRICKS users interact through a GUI editor, not raw config files.\nNever show users JSON config details, schema fields, or technical implementation.\nFocus on user-friendly descriptions of what the app will do and how it will look.\n\nGolden rules for working with BRICKS:\n1) Read before you act\n - Open these resources first, then proceed:\n - `getting-started` — overview & architecture\n - `config-schema` — canonical schema for apps, subspaces, bricks, generators, etc.\n - `components-index` — available bricks/generators\n2) Source of truth\n - Rely on the docs above; do not invent fields not present in the schema\n3) No guessing\n - If names, constraints, or device details are missing, ask to fetch them first\n4) Plan then execute\n - Propose a clear step-by-step plan and wait for approval before writing or mutating data\n5) User-friendly communication\n - Describe features in terms of what users see and do, not technical config\n - Use visual/functional language: "text display", "button", "screen transition"\n - Avoid exposing JSON, IDs, or schema details to end users\n\nBRICKS essentials:\n- Applications: interactive digital signage experiences\n- Devices: deployment targets (screens/players)\n- Modules: Reusable module across applications\n- Grid system: default 96×54; 1 unit = device_width/96 (e.g., 20px at 1920×1080)\n- Key primitives: Subspaces, Canvas, Bricks, Generators, Property Banks (Data)\n\nQuick actions:\n- "Create a new application" → use the `create-application` prompt\n- "Deploy an application to a device" → use the `deploy-to-device` prompt\n\nTry asking:\n- "Draft a plan to create an app with a text display and deploy it; ask any missing questions first"'}}]}})),n.prompt("create-application","Create a new BRICKS application with guided setup",{app_name:b.Yj().describe("Name for the new application"),description:b.Yj().describe("Short description for the new application").optional()},(a=m(function*(e){var i=e?.app_name||"New Application",t=e?.description||"";return{messages:[{role:"user",content:{type:"text",text:`Help me create a new BRICKS application called "${i}".\n\n${t?`Goal: ${t}`:""}\n\nIMPORTANT: Users see a visual GUI editor, not raw config. Describe features in user-friendly terms:\n- "text display" not "BRICK_TEXT"\n- "image" not "BRICK_IMAGE"\n- "canvas name" not "CANVAS_xxx"\n- "data storage" not "PROPERTY_BANK"\n- Focus on what users see and do, not technical implementation\n\nHow we'll proceed (no guessing, schema-first):\n1) Confirm intent\n - Restate objectives and success criteria in 1–3 bullets\n2) Consult docs (as needed)\n - getting-started, config-schema, components-index\n - Ensure proposed fields exist in the schema\n3) Ask missing questions before changes\n - Target device(s) and resolution(s)\n - Layout needs (pages/screens), content types, data sources\n - Localization, scheduling, or interaction needs\n4) Propose a minimal viable design (After confirming intent)\n - App structure: screens → visual elements\n - Initial component selection with rationale\n - Grid usage: default 96×54 (≈20px at 1920×1080)\n5) Produce a schema-valid skeleton (no side effects yet)\n - Include only fields defined by config-schema\n - Use clear placeholders for text/assets/URLs/ids\n\nWhat I'll produce first:\n- Short recap of requirements\n- Clarifying questions (only what's necessary)\n- High-level architecture plan\n- Minimal config skeleton that validates against the schema`}}]}}),function(e){return a.apply(this,arguments)})),function(e){e.resource("getting-started-docs","file://docs/getting-started.md",{mimeType:"text/markdown",title:"Getting Started with BRICKS",description:"Comprehensive guide to BRICKS architecture, concepts, and development workflow"},m(function*(){return D(I,{uri:"file://docs/getting-started.md",mimeType:"text/markdown"})}))}(o),Nn(o,r);var s=new g.S;try{yield o.connect(s),console.error("BRICKS MCP Server running on STDIO"),console.error(`Server: ${Mn} v${qn}`),console.error(`Token Type: ${t.tokenType}`),console.error(`Permissions: ${t.tokenInfo.permissions.join(", ")}`),console.error("Ready to accept requests...")}catch(e){throw console.error("Failed to start MCP server:",e),e}}),jn.apply(this,arguments)}}};
|
package/lib/999.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const __webpack_esm_id__=999;export const __webpack_esm_ids__=[999];export const __webpack_esm_modules__={12999:(e,r
|
|
1
|
+
export const __webpack_esm_id__=999;export const __webpack_esm_ids__=[999];export const __webpack_esm_modules__={12999:(e,o,r)=>{r.a(e,async(e,t)=>{try{r.r(o),r.d(o,{createCdpClient:()=>d});var n=r(99436),s=r(84361),a=e([s]),c=a.then?(await a)():a;s=c[0];var l=({address:e,port:o,method:r,phase:t="request",closeCode:n,closeReason:s,local:a=!1})=>{var c=(e=>e?Buffer.isBuffer(e)?e.toString("utf8"):String(e):"")(s),l="connect"===t?"before the CDP session opened":r?`while waiting for ${r}`:"during the CDP session",i=`${e}:${o}`,d=[];null!=n&&d.push(`code ${n}`),c&&d.push(`reason: ${c}`);var m=[a?`CDP client closed the connection to ${i} ${l}.`:`CDP connection to ${i} closed ${l}.`,d.length>0?`WebSocket close ${d.join(", ")}.`:null,a?null:"The DevTools server currently accepts one CDP client at a time. Another DevTools window or CLI command may have replaced this session. Retry the command, close the other inspector, or avoid running DevTools commands in parallel."].filter(Boolean).join("\n"),h=new Error(m);return h.code="CDP_CONNECTION_CLOSED",h.method=r,h.phase=t,h.closeCode=n,h.closeReason=c,h},i=(m=n(function*(e,o,r){if(!r)try{var t=new AbortController,n=setTimeout(()=>t.abort(),3e3),s=yield fetch(`http://${e}:${o}/json/list`,{signal:t.signal});if(clearTimeout(n),s.ok){var a=yield s.json(),c=a?.[0]?.webSocketDebuggerUrl;if(c){var l=c.match(/\/ws(?:\/.*)?$/);if(l)return`ws://${e}:${o}${l[0]}`}}}catch{}return r?`ws://${e}:${o}/ws/${encodeURIComponent(r)}`:`ws://${e}:${o}/ws`}),function(e,o,r){return m.apply(this,arguments)}),d=(e,o,r)=>{var t,a,c=0,d=new Map,m=new Map,h=null,u=e=>{for(var o of d.values()){var r=o.reject,t=o.timer,n=o.method;clearTimeout(t),r(e(n))}d.clear()};return{connect:(a=n(function*(){var n=yield i(e,o,r);return new Promise((r,a)=>{t=new s.WebSocket(n);var c=!1;t.once("open",()=>{c=!0,h=null,r()}),t.once("error",r=>{c||a(new Error(r.message||`Cannot connect to ${e}:${o}`))}),t.on("message",e=>{try{var o=JSON.parse(e.toString());if(null!=o.id&&d.has(o.id)){var r=d.get(o.id),t=r.resolve,n=r.reject,s=r.timer;return clearTimeout(s),d.delete(o.id),void(o.error?n(new Error(o.error.message)):t(o.result))}if(o.method){var a=m.get(o.method);if(a)for(var c of a)c(o.params)}}catch{}}),t.on("close",(r,t)=>{h={closeCode:r,closeReason:t},c||a(l({address:e,port:o,phase:"connect",closeCode:r,closeReason:t})),u(n=>l({address:e,port:o,method:n,closeCode:r,closeReason:t}))})})}),function(){return a.apply(this,arguments)}),send:(r,n={},s=15e3)=>new Promise((a,i)=>{if(!t||t.readyState!==t.OPEN)return h?void i(l({address:e,port:o,method:r,closeCode:h.closeCode,closeReason:h.closeReason})):void i(new Error(`Not connected to CDP at ${e}:${o} while sending ${r}`));var m=++c,u=setTimeout(()=>{d.delete(m),i(new Error(`Timeout: ${r}`))},s);d.set(m,{resolve:a,reject:i,timer:u,method:r}),t.send(JSON.stringify({id:m,method:r,params:n}))}),on:(e,o)=>{m.has(e)||m.set(e,[]),m.get(e).push(o)},off:(e,o)=>{var r=m.get(e);if(r){var t=r.indexOf(o);t>=0&&r.splice(t,1)}},close:()=>{u(r=>l({address:e,port:o,method:r,local:!0})),t&&(t.terminate(),t=null)}}};t()}catch(e){t(e)}var m})}};
|