@fugood/bricks-cli 2.23.0-beta.61 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +2 -2
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -2735,7 +2735,7 @@ import{createRequire as e}from"node:module";const t=e(import.meta.url);import*as
|
|
|
2735
2735
|
createdAt
|
|
2736
2736
|
updatedAt
|
|
2737
2737
|
}
|
|
2738
|
-
`,xh=e=>{const t=function({endpointURL:e,subscriptionEndpointURL:t,accessToken:n,boxId:r,passcode:a,origin:i,enableSubscription:o,enableRetry:s=!0,subscriptionOnConnectionOrError:p,onNetworkError:l=()=>{}}){const u=r&&a,d={};i&&(d.origin=i),u||(d.authorization=`Bearer ${n}`);const c=new dh({uri:e,headers:d});let m,f,h,_;o&&(m=bh({url:t,lazy:!0,connectionParams:d,retryAttempts:1/0,shouldRetry:()=>!0,keepAlive:1e4,on:{error:p,opened:e=>{p?.(),h=e},ping:e=>{e||(_=setTimeout(()=>{h.readyState===WebSocket.OPEN&&h.close(4205,"Client Restart")},5e3))},pong:e=>{e&&
|
|
2738
|
+
`,xh=e=>{const t=function({endpointURL:e,subscriptionEndpointURL:t,accessToken:n,boxId:r,passcode:a,origin:i,enableSubscription:o,enableRetry:s=!0,subscriptionOnConnectionOrError:p,onNetworkError:l=()=>{}}){const u=r&&a,d={};i&&(d.origin=i),u||(d.authorization=`Bearer ${n}`);const c=new dh({uri:e,headers:d});let m,f,h,_;const y=()=>{_&&(clearTimeout(_),_=void 0)};o&&(m=bh({url:t,lazy:!0,connectionParams:d,retryAttempts:1/0,shouldRetry:()=>!0,keepAlive:1e4,on:{error:e=>{y(),p?.(e)},opened:e=>{p?.(),h=e,y()},ping:e=>{e||(y(),_=setTimeout(()=>{h&&h.readyState===WebSocket.OPEN&&h.close(4205,"Client Restart")},5e3))},pong:e=>{e&&y()},closed:()=>{y()}}}),f=new fh(m));const E=fc.C.from([Sh(({networkError:e,operation:t})=>{e&&l(e,t)}),s&&new Xf,new(Ih())(3e4),o?fc.C.split(({query:e})=>{const{kind:t,operation:n}=jh(e);return"OperationDefinition"===t&&"subscription"===n},f,c):c].filter(Boolean));return E.closeSubscriptionClient=()=>o&&m.close(!0,!0),E}(e),n=new cc.D,r=new dc.R({link:t,cache:n,defaultOptions:{watchQuery:{fetchPolicy:"no-cache",errorPolicy:"ignore"},query:{fetchPolicy:"no-cache",errorPolicy:"all"}}});return r.close=()=>t.closeSubscriptionClient(),r},Fh=_c.default`
|
|
2739
2739
|
query MediaClient_workspaces {
|
|
2740
2740
|
mediaWorkspaces {
|
|
2741
2741
|
...mediaWorkspaceArguments
|
|
@@ -3066,4 +3066,4 @@ import{createRequire as e}from"node:module";const t=e(import.meta.url);import*as
|
|
|
3066
3066
|
}
|
|
3067
3067
|
}
|
|
3068
3068
|
${Mh}
|
|
3069
|
-
`,c_={query:"query",mutation:"mutate"},m_=(e,t,n)=>([r,a])=>{if(e[r])throw new Error(`Overwriting client.${r}`);e[r]=async(i,o={})=>{let s,p;const l={[t]:a,variables:i,...o};if(n&&(l.variables={...n,...l.variables}),o.readQuery?s=e.readQuery(l):o.writeQuery?e.writeQuery({...l,data:o.writeQuery}):({data:s,errors:p}=await e[c_[t]](l)),p)throw new Error(p.map(e=>e.message).join("\n"));return s?s[r]:null}},f_=e=>{const t=(({endpoint:e="http://localhost:3002",accessToken:t,boxId:n,passcode:r,enableSubscription:a=!0,enableRetry:i=!0,subscriptionOnConnectionOrError:o,onNetworkError:s}={})=>{const p=n&&r;let l=`${e}/api/graphql`;return p&&(l=`${e}/api/graphql_with_passcode`),xh({endpointURL:l,subscriptionEndpointURL:l.replace("http:","ws:"),accessToken:t,enableSubscription:!p&&a,enableRetry:i,subscriptionOnConnectionOrError:o,onNetworkError:s})})(e);if(e.boxId&&e.passcode){t.type="passcode",t.queries=R,t.mutations=v;const n={boxId:e.boxId,passcode:e.passcode};Object.entries(R).forEach(m_(t,"query",n)),Object.entries(v).forEach(m_(t,"mutation",n)),t.listenBoxChanged=(e,r)=>t.subscribe({query:d_,variables:{...n,...e}}).subscribe({next:async({data:e})=>{await r(null,e.mediaBoxChanged)},error(e){r(e)}})}else t.accessToken=e.accessToken,t.type="token",t.queries=T,t.mutations=g,Object.entries(T).forEach(m_(t,"query")),Object.entries(g).forEach(m_(t,"mutation")),t.listenBoxChanged=(e,n)=>t.subscribe({query:r_,variables:e}).subscribe({next:async({data:e})=>{await n(null,e.mediaBoxChanged)},error(e){n(e)}});return t};function h_(e,t,n){switch(n){case"user":return new pf(e,t);case"workspace":return new Wf(e,t);default:throw new Error(`Invalid token type: ${n}.`)}}process.env.STAGE,process.env.URL_BASE;var __="bricks-mcp",y_={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools"},E_=(process.env.AUTH0_DOMAIN,process.env.CACHE_URL,c(1639));const T_=function(e){var t,n,r=e.type,a=e.title,i=e.template_key,o=(0,E_.makeId)(r);switch(r){case"subspace":t={title:a,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:{}},n={"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 s=Jd(Xd.canvas);t={title:a,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(s.propTypes).map(function(e){var t=X(e,2),n=t[0],r=t[1];return[n,Object.assign({},r,{description:s.brickPropDescriptions[n]})]}))},event_map:{$definitions:Object.fromEntries(Object.entries(s.eventTypes).map(function(e){var t=X(e,1)[0];return[t,{description:s.brickEventDescriptions[t]}]}))}},n={property_bank_map:Wu({},(0,E_.makeId)("property_bank"),{title:`Canvas ID: ${a}`,type:"string",value:o,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"})};break;case"brick":var p=Jd(Xd.components.Basic),l=Jd(Xd.brickMapping[i]);if(!l)throw new Error(`Brick ${i} not found`);var u=Object.assign({},l,{propTypes:Object.assign({},p.propTypes,l.propTypes),brickPropDescriptions:Object.assign({},p.brickPropDescriptions,l.brickPropDescriptions),eventTypes:Object.assign({},p.eventTypes,l.eventTypes),brickEventDescriptions:Object.assign({},p.brickEventDescriptions,l.brickEventDescriptions)});t={title:a,template_key:i,property:{$definitions:Object.fromEntries(Object.entries(u.propTypes).map(function(e){var t=X(e,2),n=t[0],r=t[1];return[n,Object.assign({},r,{description:u.brickPropDescriptions[n]})]}))},event_map:{$definitions:Object.fromEntries(Object.entries(u.eventTypes).map(function(e){var t=X(e,1)[0];return[t,{description:u.brickEventDescriptions[t]}]}))},outlet:{$definitions:Object.fromEntries(Object.entries(u.outletTypes).map(function(e){var t=X(e,1)[0];return[t,{description:u.brickOutletDescriptions[t]}]}))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},n={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":t={title:a,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 d=Jd(Xd.generatorMapping[i]);if(!d)throw new Error(`Generator ${i} not found`);t={title:a,template_key:i,property:{$definitions:Object.fromEntries(Object.entries(d.propTypes).map(function(e){var t=X(e,2),n=t[0],r=t[1];return[n,Object.assign({},r,{description:d.brickPropDescriptions[n]})]}))},event_map:{$definitions:Object.fromEntries(Object.entries(d.eventTypes).map(function(e){var t=X(e,1)[0];return[t,{description:d.brickEventDescriptions[t]}]}))},outlet:{$definitions:Object.fromEntries(Object.entries(d.outletTypes).map(function(e){var t=X(e,1)[0];return[t,{description:d.brickOutletDescriptions[t]}]}))}};break;case"animation":t={title:a,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":t={title:a,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(Xd.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 c=(0,E_.makeId)("property_bank_command"),m=(0,E_.makeId)("property_bank_command"),f=(0,E_.makeId)("property_bank_command"),h="const { arg_name } = inputs;\n\nreturn { arg_name };";t={title:a,map:Wu(Wu(Wu(Wu(Wu(Wu({$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> | ${c}`,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> | ${c}`,port:"obj | inputs"}]}}},c,{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:h,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:f,port:"result"},{id:m,port:"result"}]}}),f,{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:c,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}}),m,{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:c,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:m,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:m,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:a,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:h,$note:"Required, info for GUI editor"}}}return qu({id:o,example:t,extraInfo:n})};function g_(e,t){var n,r,a,i,o,s,p,l,u,d,c,m,f,h,_,y,E,T,g,R="user"===t.tokenType,v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){var a=n.name,i=n.description,o=n.inputSchema,s=n.permission;ac(t,s)&&e.tool(a,i,o,r)}}(e,t),b=function(e){return Object.assign({},e,R?{workspace_id:Jt().describe("Workspace ID")}:{})},N=t.client,A=R?function(e){var t=e.endpoint,n=e.accessToken;if(!t)throw new Error("Media API endpoint is required");if(!n)throw new Error("Access token is required");return f_({endpoint:t,accessToken:n,enableSubscription:!1,enableRetry:!0})}({endpoint:y_.media,accessToken:t.token}):N;R&&e.tool("list_workspaces","List all workspaces",{},O(function*(){return qu(yield N.workspaces())})),v({name:"get_workspace_overview",description:"Get comprehensive overview of the BRICKS workspace including stats and summary",inputSchema:b({}),permission:"info"},function(){var e=O(function*(e){var t,n,r,a,i,o=e.workspace_id,s=yield Promise.all([N.workspace({id:o}),N.applications({workspaceId:o,paginate:{limit:50,offset:0}}),N.modules({workspaceId:o,paginate:{limit:50,offset:0}}),N.devices({workspaceId:o,paginate:{limit:50,offset:0}}),R?A.mediaWorkspace({workspaceId:o}).catch(function(){return null}):A.mediaWorkspace().catch(function(){return null}),R?A.mediaBoxes({workspaceId:o}).catch(function(){return[]}):A.mediaBoxes().catch(function(){return[]})]),p=X(s,6),l=p[0],u=p[1],d=p[2],c=p[3],m=p[4],f=p[5];if(!l)throw new Error("Authentication failed, please check your token");return qu({workspace:l,stats:{applications:null!=(t=null==u?void 0:u.length)?t:"No permission",modules:null!=(n=null==d?void 0:d.length)?n:"No permission",devices:null!=(r=null==c?void 0:c.length)?r:"No permission",running_apps:null!=(a=null==u?void 0:u.filter(function(e){var t;return null==(t=e.status)?void 0:t.running}).length)?a:"No permission",media_boxes:null!=(i=null==f?void 0:f.length)?i:"No permission",media_enabled:!!m,notes:"Note: The stats are based on the first 50 applications, modules, and devices in the workspace."},recent_activity:{latest_apps:(null==u?void 0:u.slice(0,5).map(function(e){var t;return{id:e._id,name:e.name,status:null!=(t=e.status)&&t.running?"running":"stopped",last_update:e.last_modify_datetime}}))||[]},media_info:m?{workspace_id:m.id,name:m.name,size_used:m.size,size_limit:m.sizeLimit,boxes:(null==f?void 0:f.slice(0,5).map(function(e){return{id:e.id,name:e.name,size:e.size,description:e.description}}))||[]}:{enabled:!1,note:"Media workspace is not enabled for this workspace"}})});return function(t){return e.apply(this,arguments)}}()),v({name:"get_applications",description:"List all applications in the workspace",inputSchema:b({limit:Zt().describe("Maximum number of applications to return").optional().default(50),offset:Zt().describe("Number of applications to skip").optional().default(0)}),permission:"query_application"},function(){var e=O(function*(e){var t=e.workspace_id,n=e.limit,r=void 0===n?50:n,a=e.offset,i=void 0===a?0:a;return qu(yield N.applications({workspaceId:t,paginate:{limit:r,offset:i}}))});return function(t){return e.apply(this,arguments)}}()),v({name:"get_application",description:"Get detailed info and config of a specific application",inputSchema:b({id:Jt().describe("Application ID")}),permission:"query_application"},function(){var e=O(function*(e){var t=e.workspace_id,n=e.id;return qu(yield N.application({workspaceId:t,id:n}))});return function(t){return e.apply(this,arguments)}}()),v({name:"get_modules",description:"List all modules in the workspace",inputSchema:b({limit:Zt().describe("Maximum number of modules to return").optional().default(50),offset:Zt().describe("Number of modules to skip").optional().default(0)}),permission:"query_module"},function(){var e=O(function*(e){var t=e.workspace_id,n=e.limit,r=void 0===n?50:n,a=e.offset,i=void 0===a?0:a;return qu(yield N.modules({workspaceId:t,paginate:{limit:r,offset:i}}))});return function(t){return e.apply(this,arguments)}}()),v({name:"get_module",description:"Get detailed info and config of a specific module",inputSchema:b({id:Jt().describe("Module ID")}),permission:"query_module"},function(){var e=O(function*(e){var t=e.workspace_id,n=e.id;return qu(yield N.module({workspaceId:t,id:n}))});return function(t){return e.apply(this,arguments)}}()),v({name:"update_module_info",description:"Update a specific module info",inputSchema:b({id:Jt().describe("Module ID"),name:Jt().describe("Module name"),description:Jt().describe("Module description")}),permission:"update_module"},(n=O(function*(e){var t=e.workspace_id,n=e.id,r=e.name,a=e.description;return qu(yield N.updateModule({workspaceId:t,id:n,name:r,description:a}))}),function(e){return n.apply(this,arguments)})),v({name:"update_module_config",description:"Update a specific module configuration",inputSchema:b({id:Jt().describe("Module ID"),config:tn({}).passthrough().describe("New configuration object, see file://docs/config-schema.md for schema reference")}),permission:"update_module"},(r=O(function*(e){var t=e.workspace_id,n=e.id,r=e.config,a=yield Qd(r);if(!a.valid)throw new Error(`Config validation failed: ${a.errors.join(", ")}`);return qu(yield N.updateModule({workspaceId:t,id:n,config:JSON.stringify(r),validateConfig:!0}))}),function(e){return r.apply(this,arguments)})),v({name:"get_devices",description:"List all devices in the workspace",inputSchema:b({limit:Zt().describe("Maximum number of devices to return").optional().default(50),offset:Zt().describe("Number of devices to skip").optional().default(0)}),permission:"query_device"},(a=O(function*(e){var t=e.workspace_id,n=e.limit,r=void 0===n?50:n,a=e.offset,i=void 0===a?0:a;return qu(yield N.devices({workspaceId:t,paginate:{limit:r,offset:i}}))}),function(e){return a.apply(this,arguments)})),v({name:"create_application",description:"Create a new BRICKS application with default grid layout",inputSchema:b({name:Jt().describe("Application name"),description:Jt().describe("Application description").optional(),grid_width:Zt().describe("Grid width in units").optional().default(96),grid_height:Zt().describe("Grid height in units").optional().default(54)}),permission:"create_application"},(i=O(function*(e){var t=e.workspace_id,n=e.name,r=e.description,a=e.grid_width,i=e.grid_height;return qu(yield N.createApplication({workspaceId:t,name:n,description:r,gridWidth:a,gridHeight:i}))}),function(e){return i.apply(this,arguments)})),v({name:"update_application_info",description:"Update application info",inputSchema:{id:Jt().describe("Application ID"),name:Jt().describe("Application name"),description:Jt().describe("Application description")},permission:"update_application"},(o=O(function*(e){var t=e.id,n=e.name,r=e.description;return qu(yield N.updateApplication({id:t,name:n,description:r}))}),function(e){return o.apply(this,arguments)})),v({name:"update_application_config",description:"Update application configuration with validation",inputSchema:{id:Jt().describe("Application ID"),config:tn({}).passthrough().describe("New application configuration. Please read `getting-started` for BRICKS concepts before changing")},permission:"update_application"},(s=O(function*(e){var t=e.id,n=e.config,r=yield Qd(n);if(!r.valid)throw new Error(`Config validation failed: ${r.errors.join(", ")}`);return qu(yield N.updateApplication({id:t,config:JSON.stringify(n)}))}),function(e){return s.apply(this,arguments)})),v({name:"bind_application",description:"Bind application to device with viewport configuration",inputSchema:{app_id:Jt().describe("Application ID"),viewports:en(tn({device_id:Jt().describe("Device ID"),x:Zt().describe("X coordinate"),y:Zt().describe("Y coordinate"),width:Zt().describe("Width"),height:Zt().describe("Height"),rotate:Zt().describe("Rotation"),rotateType:Jt().describe("Rotation type")})).describe("Viewport configuration")},permission:"bind_application"},(p=O(function*(e){var t=e.app_id,n=e.viewports;return qu(yield N.bindApplication({id:t,bind_devices:n.map(function(e){return e.device_id}),device_frames:n.reduce(function(e,t){return Object.assign({},e,Wu({},t.device_id,{x:t.x,y:t.y,width:t.width,height:t.height,rotate:t.rotate,rotateType:t.rotateType}))},{})}))}),function(e){return p.apply(this,arguments)})),v({name:"unbind_application",description:"Unbind application from device",inputSchema:{app_id:Jt().describe("Application ID"),device_id:Jt().describe("Device ID")},permission:"bind_application"},(l=O(function*(e){var t=e.app_id,n=e.device_id;return qu(yield N.bindApplication({id:t,unbindDevices:[n]}))}),function(e){return l.apply(this,arguments)})),R&&v({name:"list_media_workspaces",description:"List all media workspaces",inputSchema:{},permission:"query_media_flow"},O(function*(){return qu(yield A.mediaWorkspaces())})),v({name:"get_media_workspace",description:"Get media workspace information and status",inputSchema:b({}),permission:"query_media_flow"},(u=O(function*(e){var t=e.workspace_id;return qu(yield A.mediaWorkspace({workspaceId:t}))}),function(e){return u.apply(this,arguments)})),v({name:"list_media_boxes",description:"List all media boxes in the workspace",inputSchema:b({}),permission:"query_media_flow"},(d=O(function*(e){var t=e.workspace_id;return qu(yield A.mediaBoxes({workspaceId:t}))}),function(e){return d.apply(this,arguments)})),v({name:"get_media_box",description:"Get detailed information about a specific media box",inputSchema:{box_id:Jt().describe("Media box ID")},permission:"query_media_flow"},(c=O(function*(e){var t=e.box_id;return qu(yield A.mediaBox({boxId:t}))}),function(e){return c.apply(this,arguments)})),v({name:"list_media_files",description:"List media files in a specific box with filtering options",inputSchema:{box_id:Jt().describe("Media box ID"),include_types:en(Jt()).optional().describe('Filter by file types (e.g., ["image", "video", "audio"])'),user_tags:en(Jt()).optional().describe("Filter by user tags"),limit:Zt().optional().default(50).describe("Maximum number of files to return"),offset:Zt().optional().default(0).describe("Number of files to skip")},permission:"query_media_flow"},(m=O(function*(e){var t=e.box_id,n=e.include_types,r=e.user_tags,a=e.limit,i=e.offset;return qu(yield A.mediaFiles({boxId:t,includeTypes:n,userTags:r,limit:a,offset:i}))}),function(e){return m.apply(this,arguments)})),v({name:"get_media_file_meta",description:"Get detailed information about a specific media file",inputSchema:{file_id:Jt().describe("Media file ID")},permission:"query_media_flow"},(f=O(function*(e){var t=e.file_id;return qu(yield A.mediaFile({fileId:t}))}),function(e){return f.apply(this,arguments)})),v({name:"media_box_upload",description:"Upload a file to a media box from URL or base64 data",inputSchema:{box_id:Jt().describe("Target media box ID"),name:Jt().describe("File name"),description:Jt().optional().default("").describe("File description"),file_type:nn(["image","video","audio","file"]).describe("File type"),source_url:Jt().optional().describe("URL to download the file from"),base64_data:Jt().optional().describe("Base64 encoded file data"),user_tags:en(Jt()).optional().default([]).describe("User-defined tags for the file")},permission:"write_media_flow"},(h=O(function*(e){var t=e.box_id,n=e.name,r=e.description,a=e.source_url,i=e.base64_data,o=e.file_type,s=e.user_tags;if(!a&&!i)throw new Error("Either source_url or base64_data must be provided");if(a&&i)throw new Error("Provide either source_url OR base64_data, not both");var p=a?null:"application/octet-stream",l=a?yield(0,Qu.Ay)(a,{agent:pd(a)}).then(function(e){return p=e.headers.get("content-type"),e.blob()}):new Blob([Ku.Buffer.from(i,"base64")],{type:p}),u=yield A.requestFileUpload({name:n,description:r,boxId:t,fileType:R?o.toUpperCase():o,contentType:p,userTags:s,meta:{}}),d=JSON.parse(null==u?void 0:u.meta.uploadInfo),c=new FormData;c.append("file",l),c.append("Content-Type",p),c.append("AWSAccessKeyId",d.AWSAccessKeyId),c.append("Signature",d.Signature),c.append("Policy",d.Policy),c.append("acl",d.acl),c.append("key",d.key);var m=yield(0,Qu.Ay)(d.url,{method:"POST",body:c}).then(function(e){return e.ok}).catch(function(){return!1});return qu({file_id:u.id,upload_success:m,upload_info:{content_type:p,file_type:o,source_type:a?"url":"base64",processing_note:"File will be processed automatically. Use get_media_file to check processing status."}})}),function(e){return h.apply(this,arguments)})),v({name:"update_media_file_meta",description:"Update media file information",inputSchema:{file_id:Jt().describe("Media file ID"),name:Jt().optional().describe("New file name"),description:Jt().optional().describe("New file description"),user_tags:en(Jt()).optional().describe("New user tags")},permission:"write_media_flow"},(_=O(function*(e){var t=e.file_id,n=e.name,r=e.description,a=e.user_tags;return qu(yield A.updateMediaFile({fileId:t,name:n,description:r,userTags:a,requestUploadAgain:!1}))}),function(e){return _.apply(this,arguments)})),v({name:"copy_media_files",description:"Copy media files from one box to another",inputSchema:{from_box_id:Jt().describe("Source media box ID"),to_box_id:Jt().describe("Target media box ID"),file_ids:en(Jt()).describe("Array of media file IDs to copy")},permission:"write_media_flow"},(y=O(function*(e){var t=e.from_box_id,n=e.to_box_id,r=e.file_ids;return qu(yield A.copyMediaFiles({fromBoxId:t,toBoxId:n,list:r}))}),function(e){return y.apply(this,arguments)})),v({name:"delete_media_files",description:"Delete specific media files from a box",inputSchema:{box_id:Jt().describe("Media box ID"),file_ids:en(Jt()).describe("Array of media file IDs to delete")},permission:"write_media_flow"},(E=O(function*(e){var t=e.box_id,n=e.file_ids;return qu(yield A.deleteMediaFiles({boxId:t,list:n}))}),function(e){return E.apply(this,arguments)})),v({name:"cleanup_media_box",description:"Delete all files in a media box, optionally filtered by type",inputSchema:{box_id:Jt().describe("Media box ID"),include_types:en(Jt()).optional().describe('Only delete files of these types (e.g., ["image", "video"])')},permission:"write_media_flow"},(T=O(function*(e){var t=e.box_id,n=e.include_types;if("deleteMediaBoxFiles"in A)return qu(yield A.deleteMediaBoxFiles({boxId:t,includeTypes:n}));var r=yield A.mediaFiles({boxId:t,includeTypes:n});return qu(yield A.deleteMediaFiles({boxId:t,list:r.map(function(e){return e.id})}))}),function(e){return T.apply(this,arguments)})),e.tool("calculate_grid_layout","Calculate grid layout and pixel conversions for different device resolutions",{device_width:Zt().describe("Device width in pixels"),device_height:Zt().describe("Device height in pixels"),app_grid_width:Zt().describe("Application grid width").optional().default(96),app_grid_height:Zt().describe("Application grid height").optional().default(54)},(g=O(function*(e){var t,n,r=e.device_width,a=e.device_height,i=e.app_grid_width,o=e.app_grid_height,s={deviceBrickWidth:(t=r)/(n=t/i),deviceBrickHeight:a/n,deviceBrickUnit:n},p=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:96,r=e/n;return t>e&&(r=t/n),{deviceBrickWidth:Math.round(e/r),deviceBrickHeight:Math.round(t/r),deviceBrickUnit:r}}(r,a,i);return qu({device_resolution:{width:r,height:a,aspect_ratio:(r/a).toFixed(2)},current_grid:{width:i,height:o,unit_size_px:s.deviceBrickUnit.toFixed(2),total_pixels:{width:s.deviceBrickWidth.toFixed(2),height:s.deviceBrickHeight.toFixed(2)}},recommended_grid:{width:p.deviceBrickWidth,height:p.deviceBrickHeight,unit_size_px:p.deviceBrickUnit.toFixed(2),note:"Optimized for device aspect ratio"}})}),function(e){return g.apply(this,arguments)})),e.tool("create_item","Use this tool to create new item that you can put in application configuration",{type:nn(["subspace","canvas","brick","generator","property_bank","property_bank_calc","property_bank_command","animation","state_group","automation_map"]).describe("Item type"),title:Jt().describe("Item title"),template_key:Jt().optional().describe("Template key for brick or generator")},T_),e.tool("getting_started","Get documentation content for getting started",{},O(function*(){return qu(rc)}))}var R_="2.23.0-beta.61";function v_(){return v_=O(function*(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).token||process.env.BRICKS_API_TOKEN;if(!e)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=Uu({queryStringParameters:{token:e}});if(!t.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(t.message),new Error("Invalid BRICKS_API_TOKEN");var n,r=new wu({name:__,version:R_}),a=Object.assign({},t,{client:h_(y_.bricks,t.token,t.tokenType)});(n=r).prompt("getting-started","Getting started with BRICKS",{},O(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:Jt().describe("Name for the new application"),description:Jt().describe("Short description for the new application").optional()},function(){var e=O(function*(e){var t=(null==e?void 0:e.app_name)||"New Application",n=(null==e?void 0:e.description)||"";return{messages:[{role:"user",content:{type:"text",text:`Help me create a new BRICKS application called "${t}".\n\n${n?`Goal: ${n}`:""}\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`}}]}});return function(t){return e.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"},O(function*(){return qu(Hu,{uri:"file://docs/getting-started.md",mimeType:"text/markdown"})}))}(r),g_(r,a);var i=new Fu;try{yield r.connect(i),console.error("BRICKS MCP Server running on STDIO"),console.error(`Server: ${__} v${R_}`),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}}),v_.apply(this,arguments)}var O_=new P("mcp").description("MCP server management");O_.command("start").description("Start the BRICKS MCP server in STDIO mode").option("-t, --token <token>","API token (overrides saved token)").action(function(){var e=O(function*(e){var t=(0,V.getCurrentProfile)(),n=e.token||(0,V.getToken)(t);n||(console.error(M.Ay.red("Error: No API token found.")),console.error(M.Ay.gray("Please login first with: bricks auth login <passcode>")),console.error(M.Ay.gray("Or provide a token with: bricks mcp start --token <token>")),process.exit(1));try{yield function(){return v_.apply(this,arguments)}({token:n})}catch(e){console.error(M.Ay.red(`Failed to start MCP server: ${e.message}`)),process.exit(1)}});return function(t){return e.apply(this,arguments)}}());var b_=function(){var e=O(function*(){if(N.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.23.0-beta.61").enablePositionalOptions(),N.addCommand(U),N.addCommand(te),N.addCommand(se),N.addCommand(le),N.addCommand(me),N.addCommand(ye),N.addCommand(ve),N.addCommand(O_),N.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(O(function*(){try{(0,(yield c.e(612).then(c.bind(c,9612))).runInteractiveMode)()}catch(e){console.error(M.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),N.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=yield Promise.resolve().then(c.bind(c,8765)),n=t.getToken,r=t.getBaseUrl,a=t.getCurrentProfile,i=(yield Promise.resolve().then(c.bind(c,7742))).createClient,o=(yield Promise.resolve().then(c.bind(c,9790))).default,s=n(a());s||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var p=o("Fetching workspace info...").start();try{var l,u,d=i(r(),s),m=yield d.workspace();if(p.stop(),e.json)return void console.log(JSON.stringify(m,null,2));console.log(M.Ay.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${M.Ay.green(m.name)}`),console.log(`ID: ${M.Ay.gray(m._id)}`),console.log(`Description: ${m.description||M.Ay.gray("N/A")}`),console.log(`\n${M.Ay.bold("Data")}`),console.log(`Remote Update: ${null!=(l=m.bank)&&l.enable_remote_update?M.Ay.green("Enabled"):M.Ay.gray("Disabled")}`),console.log(`Spacename: ${(null==(u=m.bank)?void 0:u.spacename)||M.Ay.gray("N/A")}`),console.log("─".repeat(60))}catch(e){p.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),N.on("--help",function(){console.log(""),console.log(M.Ay.bold("Examples:")),console.log(""),console.log(M.Ay.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(M.Ay.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(M.Ay.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(M.Ay.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(M.Ay.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(M.Ay.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(M.Ay.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(M.Ay.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(M.Ay.gray("Get workspace token from BRICKS Controller:")),console.log(M.Ay.cyan(" https://control.bricks.tools")),console.log(M.Ay.gray(" Go to Workspace Settings > API Token"))}),0===process.argv.slice(2).length)try{return void(0,(yield c.e(612).then(c.bind(c,9612))).runInteractiveMode)()}catch(e){console.error(M.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}yield N.parseAsync(process.argv)});return function(){return e.apply(this,arguments)}}();const N_=b_;export{N_ as default,b_ as run};
|
|
3069
|
+
`,c_={query:"query",mutation:"mutate"},m_=(e,t,n)=>([r,a])=>{if(e[r])throw new Error(`Overwriting client.${r}`);e[r]=async(i,o={})=>{let s,p;const l={[t]:a,variables:i,...o};if(n&&(l.variables={...n,...l.variables}),o.readQuery?s=e.readQuery(l):o.writeQuery?e.writeQuery({...l,data:o.writeQuery}):({data:s,errors:p}=await e[c_[t]](l)),p)throw new Error(p.map(e=>e.message).join("\n"));return s?s[r]:null}},f_=e=>{const t=(({endpoint:e="http://localhost:3002",accessToken:t,boxId:n,passcode:r,enableSubscription:a=!0,enableRetry:i=!0,subscriptionOnConnectionOrError:o,onNetworkError:s}={})=>{const p=n&&r;let l=`${e}/api/graphql`;return p&&(l=`${e}/api/graphql_with_passcode`),xh({endpointURL:l,subscriptionEndpointURL:l.replace("http:","ws:"),accessToken:t,enableSubscription:!p&&a,enableRetry:i,subscriptionOnConnectionOrError:o,onNetworkError:s})})(e);if(e.boxId&&e.passcode){t.type="passcode",t.queries=R,t.mutations=v;const n={boxId:e.boxId,passcode:e.passcode};Object.entries(R).forEach(m_(t,"query",n)),Object.entries(v).forEach(m_(t,"mutation",n)),t.listenBoxChanged=(e,r)=>t.subscribe({query:d_,variables:{...n,...e}}).subscribe({next:async({data:e})=>{await r(null,e.mediaBoxChanged)},error(e){r(e)}})}else t.accessToken=e.accessToken,t.type="token",t.queries=T,t.mutations=g,Object.entries(T).forEach(m_(t,"query")),Object.entries(g).forEach(m_(t,"mutation")),t.listenBoxChanged=(e,n)=>t.subscribe({query:r_,variables:e}).subscribe({next:async({data:e})=>{await n(null,e.mediaBoxChanged)},error(e){n(e)}});return t};function h_(e,t,n){switch(n){case"user":return new pf(e,t);case"workspace":return new Wf(e,t);default:throw new Error(`Invalid token type: ${n}.`)}}process.env.STAGE,process.env.URL_BASE;var __="bricks-mcp",y_={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools"},E_=(process.env.AUTH0_DOMAIN,process.env.CACHE_URL,c(1639));const T_=function(e){var t,n,r=e.type,a=e.title,i=e.template_key,o=(0,E_.makeId)(r);switch(r){case"subspace":t={title:a,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:{}},n={"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 s=Jd(Xd.canvas);t={title:a,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(s.propTypes).map(function(e){var t=X(e,2),n=t[0],r=t[1];return[n,Object.assign({},r,{description:s.brickPropDescriptions[n]})]}))},event_map:{$definitions:Object.fromEntries(Object.entries(s.eventTypes).map(function(e){var t=X(e,1)[0];return[t,{description:s.brickEventDescriptions[t]}]}))}},n={property_bank_map:Wu({},(0,E_.makeId)("property_bank"),{title:`Canvas ID: ${a}`,type:"string",value:o,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"})};break;case"brick":var p=Jd(Xd.components.Basic),l=Jd(Xd.brickMapping[i]);if(!l)throw new Error(`Brick ${i} not found`);var u=Object.assign({},l,{propTypes:Object.assign({},p.propTypes,l.propTypes),brickPropDescriptions:Object.assign({},p.brickPropDescriptions,l.brickPropDescriptions),eventTypes:Object.assign({},p.eventTypes,l.eventTypes),brickEventDescriptions:Object.assign({},p.brickEventDescriptions,l.brickEventDescriptions)});t={title:a,template_key:i,property:{$definitions:Object.fromEntries(Object.entries(u.propTypes).map(function(e){var t=X(e,2),n=t[0],r=t[1];return[n,Object.assign({},r,{description:u.brickPropDescriptions[n]})]}))},event_map:{$definitions:Object.fromEntries(Object.entries(u.eventTypes).map(function(e){var t=X(e,1)[0];return[t,{description:u.brickEventDescriptions[t]}]}))},outlet:{$definitions:Object.fromEntries(Object.entries(u.outletTypes).map(function(e){var t=X(e,1)[0];return[t,{description:u.brickOutletDescriptions[t]}]}))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},n={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":t={title:a,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 d=Jd(Xd.generatorMapping[i]);if(!d)throw new Error(`Generator ${i} not found`);t={title:a,template_key:i,property:{$definitions:Object.fromEntries(Object.entries(d.propTypes).map(function(e){var t=X(e,2),n=t[0],r=t[1];return[n,Object.assign({},r,{description:d.brickPropDescriptions[n]})]}))},event_map:{$definitions:Object.fromEntries(Object.entries(d.eventTypes).map(function(e){var t=X(e,1)[0];return[t,{description:d.brickEventDescriptions[t]}]}))},outlet:{$definitions:Object.fromEntries(Object.entries(d.outletTypes).map(function(e){var t=X(e,1)[0];return[t,{description:d.brickOutletDescriptions[t]}]}))}};break;case"animation":t={title:a,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":t={title:a,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(Xd.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 c=(0,E_.makeId)("property_bank_command"),m=(0,E_.makeId)("property_bank_command"),f=(0,E_.makeId)("property_bank_command"),h="const { arg_name } = inputs;\n\nreturn { arg_name };";t={title:a,map:Wu(Wu(Wu(Wu(Wu(Wu({$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> | ${c}`,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> | ${c}`,port:"obj | inputs"}]}}},c,{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:h,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:f,port:"result"},{id:m,port:"result"}]}}),f,{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:c,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}}),m,{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:c,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:m,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:m,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:a,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:h,$note:"Required, info for GUI editor"}}}return qu({id:o,example:t,extraInfo:n})};function g_(e,t){var n,r,a,i,o,s,p,l,u,d,c,m,f,h,_,y,E,T,g,R="user"===t.tokenType,v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){var a=n.name,i=n.description,o=n.inputSchema,s=n.permission;ac(t,s)&&e.tool(a,i,o,r)}}(e,t),b=function(e){return Object.assign({},e,R?{workspace_id:Jt().describe("Workspace ID")}:{})},N=t.client,A=R?function(e){var t=e.endpoint,n=e.accessToken;if(!t)throw new Error("Media API endpoint is required");if(!n)throw new Error("Access token is required");return f_({endpoint:t,accessToken:n,enableSubscription:!1,enableRetry:!0})}({endpoint:y_.media,accessToken:t.token}):N;R&&e.tool("list_workspaces","List all workspaces",{},O(function*(){return qu(yield N.workspaces())})),v({name:"get_workspace_overview",description:"Get comprehensive overview of the BRICKS workspace including stats and summary",inputSchema:b({}),permission:"info"},function(){var e=O(function*(e){var t,n,r,a,i,o=e.workspace_id,s=yield Promise.all([N.workspace({id:o}),N.applications({workspaceId:o,paginate:{limit:50,offset:0}}),N.modules({workspaceId:o,paginate:{limit:50,offset:0}}),N.devices({workspaceId:o,paginate:{limit:50,offset:0}}),R?A.mediaWorkspace({workspaceId:o}).catch(function(){return null}):A.mediaWorkspace().catch(function(){return null}),R?A.mediaBoxes({workspaceId:o}).catch(function(){return[]}):A.mediaBoxes().catch(function(){return[]})]),p=X(s,6),l=p[0],u=p[1],d=p[2],c=p[3],m=p[4],f=p[5];if(!l)throw new Error("Authentication failed, please check your token");return qu({workspace:l,stats:{applications:null!=(t=null==u?void 0:u.length)?t:"No permission",modules:null!=(n=null==d?void 0:d.length)?n:"No permission",devices:null!=(r=null==c?void 0:c.length)?r:"No permission",running_apps:null!=(a=null==u?void 0:u.filter(function(e){var t;return null==(t=e.status)?void 0:t.running}).length)?a:"No permission",media_boxes:null!=(i=null==f?void 0:f.length)?i:"No permission",media_enabled:!!m,notes:"Note: The stats are based on the first 50 applications, modules, and devices in the workspace."},recent_activity:{latest_apps:(null==u?void 0:u.slice(0,5).map(function(e){var t;return{id:e._id,name:e.name,status:null!=(t=e.status)&&t.running?"running":"stopped",last_update:e.last_modify_datetime}}))||[]},media_info:m?{workspace_id:m.id,name:m.name,size_used:m.size,size_limit:m.sizeLimit,boxes:(null==f?void 0:f.slice(0,5).map(function(e){return{id:e.id,name:e.name,size:e.size,description:e.description}}))||[]}:{enabled:!1,note:"Media workspace is not enabled for this workspace"}})});return function(t){return e.apply(this,arguments)}}()),v({name:"get_applications",description:"List all applications in the workspace",inputSchema:b({limit:Zt().describe("Maximum number of applications to return").optional().default(50),offset:Zt().describe("Number of applications to skip").optional().default(0)}),permission:"query_application"},function(){var e=O(function*(e){var t=e.workspace_id,n=e.limit,r=void 0===n?50:n,a=e.offset,i=void 0===a?0:a;return qu(yield N.applications({workspaceId:t,paginate:{limit:r,offset:i}}))});return function(t){return e.apply(this,arguments)}}()),v({name:"get_application",description:"Get detailed info and config of a specific application",inputSchema:b({id:Jt().describe("Application ID")}),permission:"query_application"},function(){var e=O(function*(e){var t=e.workspace_id,n=e.id;return qu(yield N.application({workspaceId:t,id:n}))});return function(t){return e.apply(this,arguments)}}()),v({name:"get_modules",description:"List all modules in the workspace",inputSchema:b({limit:Zt().describe("Maximum number of modules to return").optional().default(50),offset:Zt().describe("Number of modules to skip").optional().default(0)}),permission:"query_module"},function(){var e=O(function*(e){var t=e.workspace_id,n=e.limit,r=void 0===n?50:n,a=e.offset,i=void 0===a?0:a;return qu(yield N.modules({workspaceId:t,paginate:{limit:r,offset:i}}))});return function(t){return e.apply(this,arguments)}}()),v({name:"get_module",description:"Get detailed info and config of a specific module",inputSchema:b({id:Jt().describe("Module ID")}),permission:"query_module"},function(){var e=O(function*(e){var t=e.workspace_id,n=e.id;return qu(yield N.module({workspaceId:t,id:n}))});return function(t){return e.apply(this,arguments)}}()),v({name:"update_module_info",description:"Update a specific module info",inputSchema:b({id:Jt().describe("Module ID"),name:Jt().describe("Module name"),description:Jt().describe("Module description")}),permission:"update_module"},(n=O(function*(e){var t=e.workspace_id,n=e.id,r=e.name,a=e.description;return qu(yield N.updateModule({workspaceId:t,id:n,name:r,description:a}))}),function(e){return n.apply(this,arguments)})),v({name:"update_module_config",description:"Update a specific module configuration",inputSchema:b({id:Jt().describe("Module ID"),config:tn({}).passthrough().describe("New configuration object, see file://docs/config-schema.md for schema reference")}),permission:"update_module"},(r=O(function*(e){var t=e.workspace_id,n=e.id,r=e.config,a=yield Qd(r);if(!a.valid)throw new Error(`Config validation failed: ${a.errors.join(", ")}`);return qu(yield N.updateModule({workspaceId:t,id:n,config:JSON.stringify(r),validateConfig:!0}))}),function(e){return r.apply(this,arguments)})),v({name:"get_devices",description:"List all devices in the workspace",inputSchema:b({limit:Zt().describe("Maximum number of devices to return").optional().default(50),offset:Zt().describe("Number of devices to skip").optional().default(0)}),permission:"query_device"},(a=O(function*(e){var t=e.workspace_id,n=e.limit,r=void 0===n?50:n,a=e.offset,i=void 0===a?0:a;return qu(yield N.devices({workspaceId:t,paginate:{limit:r,offset:i}}))}),function(e){return a.apply(this,arguments)})),v({name:"create_application",description:"Create a new BRICKS application with default grid layout",inputSchema:b({name:Jt().describe("Application name"),description:Jt().describe("Application description").optional(),grid_width:Zt().describe("Grid width in units").optional().default(96),grid_height:Zt().describe("Grid height in units").optional().default(54)}),permission:"create_application"},(i=O(function*(e){var t=e.workspace_id,n=e.name,r=e.description,a=e.grid_width,i=e.grid_height;return qu(yield N.createApplication({workspaceId:t,name:n,description:r,gridWidth:a,gridHeight:i}))}),function(e){return i.apply(this,arguments)})),v({name:"update_application_info",description:"Update application info",inputSchema:{id:Jt().describe("Application ID"),name:Jt().describe("Application name"),description:Jt().describe("Application description")},permission:"update_application"},(o=O(function*(e){var t=e.id,n=e.name,r=e.description;return qu(yield N.updateApplication({id:t,name:n,description:r}))}),function(e){return o.apply(this,arguments)})),v({name:"update_application_config",description:"Update application configuration with validation",inputSchema:{id:Jt().describe("Application ID"),config:tn({}).passthrough().describe("New application configuration. Please read `getting-started` for BRICKS concepts before changing")},permission:"update_application"},(s=O(function*(e){var t=e.id,n=e.config,r=yield Qd(n);if(!r.valid)throw new Error(`Config validation failed: ${r.errors.join(", ")}`);return qu(yield N.updateApplication({id:t,config:JSON.stringify(n)}))}),function(e){return s.apply(this,arguments)})),v({name:"bind_application",description:"Bind application to device with viewport configuration",inputSchema:{app_id:Jt().describe("Application ID"),viewports:en(tn({device_id:Jt().describe("Device ID"),x:Zt().describe("X coordinate"),y:Zt().describe("Y coordinate"),width:Zt().describe("Width"),height:Zt().describe("Height"),rotate:Zt().describe("Rotation"),rotateType:Jt().describe("Rotation type")})).describe("Viewport configuration")},permission:"bind_application"},(p=O(function*(e){var t=e.app_id,n=e.viewports;return qu(yield N.bindApplication({id:t,bind_devices:n.map(function(e){return e.device_id}),device_frames:n.reduce(function(e,t){return Object.assign({},e,Wu({},t.device_id,{x:t.x,y:t.y,width:t.width,height:t.height,rotate:t.rotate,rotateType:t.rotateType}))},{})}))}),function(e){return p.apply(this,arguments)})),v({name:"unbind_application",description:"Unbind application from device",inputSchema:{app_id:Jt().describe("Application ID"),device_id:Jt().describe("Device ID")},permission:"bind_application"},(l=O(function*(e){var t=e.app_id,n=e.device_id;return qu(yield N.bindApplication({id:t,unbindDevices:[n]}))}),function(e){return l.apply(this,arguments)})),R&&v({name:"list_media_workspaces",description:"List all media workspaces",inputSchema:{},permission:"query_media_flow"},O(function*(){return qu(yield A.mediaWorkspaces())})),v({name:"get_media_workspace",description:"Get media workspace information and status",inputSchema:b({}),permission:"query_media_flow"},(u=O(function*(e){var t=e.workspace_id;return qu(yield A.mediaWorkspace({workspaceId:t}))}),function(e){return u.apply(this,arguments)})),v({name:"list_media_boxes",description:"List all media boxes in the workspace",inputSchema:b({}),permission:"query_media_flow"},(d=O(function*(e){var t=e.workspace_id;return qu(yield A.mediaBoxes({workspaceId:t}))}),function(e){return d.apply(this,arguments)})),v({name:"get_media_box",description:"Get detailed information about a specific media box",inputSchema:{box_id:Jt().describe("Media box ID")},permission:"query_media_flow"},(c=O(function*(e){var t=e.box_id;return qu(yield A.mediaBox({boxId:t}))}),function(e){return c.apply(this,arguments)})),v({name:"list_media_files",description:"List media files in a specific box with filtering options",inputSchema:{box_id:Jt().describe("Media box ID"),include_types:en(Jt()).optional().describe('Filter by file types (e.g., ["image", "video", "audio"])'),user_tags:en(Jt()).optional().describe("Filter by user tags"),limit:Zt().optional().default(50).describe("Maximum number of files to return"),offset:Zt().optional().default(0).describe("Number of files to skip")},permission:"query_media_flow"},(m=O(function*(e){var t=e.box_id,n=e.include_types,r=e.user_tags,a=e.limit,i=e.offset;return qu(yield A.mediaFiles({boxId:t,includeTypes:n,userTags:r,limit:a,offset:i}))}),function(e){return m.apply(this,arguments)})),v({name:"get_media_file_meta",description:"Get detailed information about a specific media file",inputSchema:{file_id:Jt().describe("Media file ID")},permission:"query_media_flow"},(f=O(function*(e){var t=e.file_id;return qu(yield A.mediaFile({fileId:t}))}),function(e){return f.apply(this,arguments)})),v({name:"media_box_upload",description:"Upload a file to a media box from URL or base64 data",inputSchema:{box_id:Jt().describe("Target media box ID"),name:Jt().describe("File name"),description:Jt().optional().default("").describe("File description"),file_type:nn(["image","video","audio","file"]).describe("File type"),source_url:Jt().optional().describe("URL to download the file from"),base64_data:Jt().optional().describe("Base64 encoded file data"),user_tags:en(Jt()).optional().default([]).describe("User-defined tags for the file")},permission:"write_media_flow"},(h=O(function*(e){var t=e.box_id,n=e.name,r=e.description,a=e.source_url,i=e.base64_data,o=e.file_type,s=e.user_tags;if(!a&&!i)throw new Error("Either source_url or base64_data must be provided");if(a&&i)throw new Error("Provide either source_url OR base64_data, not both");var p=a?null:"application/octet-stream",l=a?yield(0,Qu.Ay)(a,{agent:pd(a)}).then(function(e){return p=e.headers.get("content-type"),e.blob()}):new Blob([Ku.Buffer.from(i,"base64")],{type:p}),u=yield A.requestFileUpload({name:n,description:r,boxId:t,fileType:R?o.toUpperCase():o,contentType:p,userTags:s,meta:{}}),d=JSON.parse(null==u?void 0:u.meta.uploadInfo),c=new FormData;c.append("file",l),c.append("Content-Type",p),c.append("AWSAccessKeyId",d.AWSAccessKeyId),c.append("Signature",d.Signature),c.append("Policy",d.Policy),c.append("acl",d.acl),c.append("key",d.key);var m=yield(0,Qu.Ay)(d.url,{method:"POST",body:c}).then(function(e){return e.ok}).catch(function(){return!1});return qu({file_id:u.id,upload_success:m,upload_info:{content_type:p,file_type:o,source_type:a?"url":"base64",processing_note:"File will be processed automatically. Use get_media_file to check processing status."}})}),function(e){return h.apply(this,arguments)})),v({name:"update_media_file_meta",description:"Update media file information",inputSchema:{file_id:Jt().describe("Media file ID"),name:Jt().optional().describe("New file name"),description:Jt().optional().describe("New file description"),user_tags:en(Jt()).optional().describe("New user tags")},permission:"write_media_flow"},(_=O(function*(e){var t=e.file_id,n=e.name,r=e.description,a=e.user_tags;return qu(yield A.updateMediaFile({fileId:t,name:n,description:r,userTags:a,requestUploadAgain:!1}))}),function(e){return _.apply(this,arguments)})),v({name:"copy_media_files",description:"Copy media files from one box to another",inputSchema:{from_box_id:Jt().describe("Source media box ID"),to_box_id:Jt().describe("Target media box ID"),file_ids:en(Jt()).describe("Array of media file IDs to copy")},permission:"write_media_flow"},(y=O(function*(e){var t=e.from_box_id,n=e.to_box_id,r=e.file_ids;return qu(yield A.copyMediaFiles({fromBoxId:t,toBoxId:n,list:r}))}),function(e){return y.apply(this,arguments)})),v({name:"delete_media_files",description:"Delete specific media files from a box",inputSchema:{box_id:Jt().describe("Media box ID"),file_ids:en(Jt()).describe("Array of media file IDs to delete")},permission:"write_media_flow"},(E=O(function*(e){var t=e.box_id,n=e.file_ids;return qu(yield A.deleteMediaFiles({boxId:t,list:n}))}),function(e){return E.apply(this,arguments)})),v({name:"cleanup_media_box",description:"Delete all files in a media box, optionally filtered by type",inputSchema:{box_id:Jt().describe("Media box ID"),include_types:en(Jt()).optional().describe('Only delete files of these types (e.g., ["image", "video"])')},permission:"write_media_flow"},(T=O(function*(e){var t=e.box_id,n=e.include_types;if("deleteMediaBoxFiles"in A)return qu(yield A.deleteMediaBoxFiles({boxId:t,includeTypes:n}));var r=yield A.mediaFiles({boxId:t,includeTypes:n});return qu(yield A.deleteMediaFiles({boxId:t,list:r.map(function(e){return e.id})}))}),function(e){return T.apply(this,arguments)})),e.tool("calculate_grid_layout","Calculate grid layout and pixel conversions for different device resolutions",{device_width:Zt().describe("Device width in pixels"),device_height:Zt().describe("Device height in pixels"),app_grid_width:Zt().describe("Application grid width").optional().default(96),app_grid_height:Zt().describe("Application grid height").optional().default(54)},(g=O(function*(e){var t,n,r=e.device_width,a=e.device_height,i=e.app_grid_width,o=e.app_grid_height,s={deviceBrickWidth:(t=r)/(n=t/i),deviceBrickHeight:a/n,deviceBrickUnit:n},p=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:96,r=e/n;return t>e&&(r=t/n),{deviceBrickWidth:Math.round(e/r),deviceBrickHeight:Math.round(t/r),deviceBrickUnit:r}}(r,a,i);return qu({device_resolution:{width:r,height:a,aspect_ratio:(r/a).toFixed(2)},current_grid:{width:i,height:o,unit_size_px:s.deviceBrickUnit.toFixed(2),total_pixels:{width:s.deviceBrickWidth.toFixed(2),height:s.deviceBrickHeight.toFixed(2)}},recommended_grid:{width:p.deviceBrickWidth,height:p.deviceBrickHeight,unit_size_px:p.deviceBrickUnit.toFixed(2),note:"Optimized for device aspect ratio"}})}),function(e){return g.apply(this,arguments)})),e.tool("create_item","Use this tool to create new item that you can put in application configuration",{type:nn(["subspace","canvas","brick","generator","property_bank","property_bank_calc","property_bank_command","animation","state_group","automation_map"]).describe("Item type"),title:Jt().describe("Item title"),template_key:Jt().optional().describe("Template key for brick or generator")},T_),e.tool("getting_started","Get documentation content for getting started",{},O(function*(){return qu(rc)}))}var R_="2.23.0";function v_(){return v_=O(function*(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).token||process.env.BRICKS_API_TOKEN;if(!e)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=Uu({queryStringParameters:{token:e}});if(!t.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(t.message),new Error("Invalid BRICKS_API_TOKEN");var n,r=new wu({name:__,version:R_}),a=Object.assign({},t,{client:h_(y_.bricks,t.token,t.tokenType)});(n=r).prompt("getting-started","Getting started with BRICKS",{},O(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:Jt().describe("Name for the new application"),description:Jt().describe("Short description for the new application").optional()},function(){var e=O(function*(e){var t=(null==e?void 0:e.app_name)||"New Application",n=(null==e?void 0:e.description)||"";return{messages:[{role:"user",content:{type:"text",text:`Help me create a new BRICKS application called "${t}".\n\n${n?`Goal: ${n}`:""}\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`}}]}});return function(t){return e.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"},O(function*(){return qu(Hu,{uri:"file://docs/getting-started.md",mimeType:"text/markdown"})}))}(r),g_(r,a);var i=new Fu;try{yield r.connect(i),console.error("BRICKS MCP Server running on STDIO"),console.error(`Server: ${__} v${R_}`),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}}),v_.apply(this,arguments)}var O_=new P("mcp").description("MCP server management");O_.command("start").description("Start the BRICKS MCP server in STDIO mode").option("-t, --token <token>","API token (overrides saved token)").action(function(){var e=O(function*(e){var t=(0,V.getCurrentProfile)(),n=e.token||(0,V.getToken)(t);n||(console.error(M.Ay.red("Error: No API token found.")),console.error(M.Ay.gray("Please login first with: bricks auth login <passcode>")),console.error(M.Ay.gray("Or provide a token with: bricks mcp start --token <token>")),process.exit(1));try{yield function(){return v_.apply(this,arguments)}({token:n})}catch(e){console.error(M.Ay.red(`Failed to start MCP server: ${e.message}`)),process.exit(1)}});return function(t){return e.apply(this,arguments)}}());var b_=function(){var e=O(function*(){if(N.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.23.0").enablePositionalOptions(),N.addCommand(U),N.addCommand(te),N.addCommand(se),N.addCommand(le),N.addCommand(me),N.addCommand(ye),N.addCommand(ve),N.addCommand(O_),N.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(O(function*(){try{(0,(yield c.e(612).then(c.bind(c,9612))).runInteractiveMode)()}catch(e){console.error(M.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),N.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=yield Promise.resolve().then(c.bind(c,8765)),n=t.getToken,r=t.getBaseUrl,a=t.getCurrentProfile,i=(yield Promise.resolve().then(c.bind(c,7742))).createClient,o=(yield Promise.resolve().then(c.bind(c,9790))).default,s=n(a());s||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var p=o("Fetching workspace info...").start();try{var l,u,d=i(r(),s),m=yield d.workspace();if(p.stop(),e.json)return void console.log(JSON.stringify(m,null,2));console.log(M.Ay.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${M.Ay.green(m.name)}`),console.log(`ID: ${M.Ay.gray(m._id)}`),console.log(`Description: ${m.description||M.Ay.gray("N/A")}`),console.log(`\n${M.Ay.bold("Data")}`),console.log(`Remote Update: ${null!=(l=m.bank)&&l.enable_remote_update?M.Ay.green("Enabled"):M.Ay.gray("Disabled")}`),console.log(`Spacename: ${(null==(u=m.bank)?void 0:u.spacename)||M.Ay.gray("N/A")}`),console.log("─".repeat(60))}catch(e){p.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),N.on("--help",function(){console.log(""),console.log(M.Ay.bold("Examples:")),console.log(""),console.log(M.Ay.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(M.Ay.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(M.Ay.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(M.Ay.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(M.Ay.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(M.Ay.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(M.Ay.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(M.Ay.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(M.Ay.gray("Get workspace token from BRICKS Controller:")),console.log(M.Ay.cyan(" https://control.bricks.tools")),console.log(M.Ay.gray(" Go to Workspace Settings > API Token"))}),0===process.argv.slice(2).length)try{return void(0,(yield c.e(612).then(c.bind(c,9612))).runInteractiveMode)()}catch(e){console.error(M.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}yield N.parseAsync(process.argv)});return function(){return e.apply(this,arguments)}}();const N_=b_;export{N_ as default,b_ as run};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-cli",
|
|
3
|
-
"version": "2.23.0
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "BRICKS CLI - Command-line interface for BRICKS Workspace API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"graphql"
|
|
51
51
|
],
|
|
52
52
|
"license": "UNLICENSED",
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "398352b9923f97e914ac60acab519ca014aa6fb8"
|
|
54
54
|
}
|